/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* This file contains ddi functions needed during boot and DR.
* Many functions in swapgeneric.c can be moved here.
*
* The object file is currently linked into unix.
*/
#include <sys/bootconf.h>
#include <sys/ddi_impldefs.h>
#include <sys/ddi_implfuncs.h>
#include <sys/instance.h>
#include <sys/ndi_impldefs.h>
#include <sys/systeminfo.h>
#include <sys/sysevent_impl.h>
#include <sys/sunldi_impl.h>
#include <sys/bootconf.h>
#include <sys/ddifm_impl.h>
extern dev_info_t *top_devinfo;
extern dev_info_t *scsi_vhci_dip;
/*
* This lock must be held while updating devi_sibling pointers of
* rootnex immediate children
*/
/*
* Forward declarations
*/
static void impl_create_root_class(void);
static void create_devinfo_tree(void);
#if defined(__x86)
#endif
/*
* Setup the DDI but don't necessarily init the DDI. This will happen
* later once /boot is released.
*/
void
setup_ddi(void)
{
fm_init();
ndi_fm_init();
irm_init();
(void) i_ddi_load_drvconf(DDI_MAJOR_T_NONE);
ldi_init();
}
/*
* Perform setup actions post startup (i_ddi_io_initialized)
*/
void
setup_ddi_poststartup(void)
{
extern void i_ddi_start_flush_daemon(void);
extern void i_ddi_irm_poststartup(void);
extern void i_ddi_intr_redist_all_cpus(void);
/* Startup Interrupt Resource Management (IRM) */
/*
* For platforms that support INTR_WEIGHTED_DIST, we perform a
* redistribution at this point (after NICs configured) so that
* "isolation" relative to "ddi-intr-weight" occurs.
*/
}
/*
* Create classes and major number bindings for the name of my root.
* Called immediately before 'loadrootmodules'
*/
static void
impl_create_root_class(void)
{
char *cp;
/*
* The name for the root nexus is exactly as the manufacturer
* placed it in the prom name property. No translation.
*/
panic("Couldn't find major number for 'rootnex'");
/*
* C OBP (Serengeti) does not include the NULL when returning
* the length of the name property, while this violates 1275,
* Solaris needs to work around this by allocating space for
* an extra character.
*/
/*
* Fix conflict between OBP names and filesystem names.
* Substitute '_' for '/' in the name. Ick. This is only
* needed for the root node since '/' is not a legal name
* character in an OBP device name.
*/
if (*cp == '/')
*cp = '_';
/*
* Bind rootname to rootnex driver
*/
"registered the name \"%s\". The root nexus needs to "
"use this name, and will override the existing entry. "
"Please correct /etc/name_to_major and/or "
"/etc/driver_aliases and reboot.", rootname);
/*
* Resort to the emergency measure of blowing away the
* existing hash entry and replacing it with rootname's.
*/
panic("mb_hashtab: inconsistent state.");
}
/*
* The `platform' or `implementation architecture' name has been
* translated by boot to be proper for file system use. It is
* the `name' of the platform actually booted. Note the assumption
* is that the name will `fit' in the buffer platform (which is
* of size SYS_NMLN, which is far bigger than will actually ever
* be needed).
*/
#if defined(__x86)
/*
* Retrieve and honor the bootpath and optional fstype properties
*/
if (size != -1) {
}
if (size != -1) {
}
#endif
}
/*
* Note that this routine does not take into account the endianness
* of the host or the device (or PROM) when retrieving properties.
*/
static int
{
int size;
return (-1);
return (-1);
/*
* Workaround for bugid 1085575 - OBP may return a "name" property
* without null terminating the string with '\0'. When this occurs,
* append a '\0' and return (size + 1).
*/
size += 1;
}
}
return (size);
}
/*ARGSUSED1*/
static int
{
return (DDI_WALK_CONTINUE);
switch (flag) {
case DDI_WALK_PRUNESIB:
break;
case DDI_WALK_PRUNECHILD:
break;
case 0:
break;
default:
return (DDI_WALK_TERMINATE);
}
/*
* add the first sibling that passes check_status()
*/
sizeof (buf)) > 0) {
DDI_SUCCESS) {
snid, -1);
break;
}
}
}
}
/*
* add the first child that passes check_status()
*/
} else {
== DDI_SUCCESS) {
(void) ddi_add_child(
break;
}
}
}
}
}
}
return (DDI_WALK_CONTINUE);
}
static void
{
(void) (*f)(devi, 0);
if (devi) {
}
}
{
char *buf;
return (NULL);
}
return (NULL);
/*
* Don't create any siblings of the branch root, just
* children.
*/
return (dip);
}
static void
create_devinfo_tree(void)
{
#if defined(__sparc)
nodeid = prom_nextnode(0);
#else /* x86 */
#endif
/*
* Bind root node.
* This code is special because root node has no parent
*/
/*
* Record that devinfos have been made for "rootnex."
* di_dfs() is used to read the prom because it doesn't get the
* next sibling until the function returns, unlike ddi_walk_devs().
*/
#if !defined(__sparc)
/*
* On x86, there is no prom. Create device tree by
* probing pci config space
*/
{
extern void impl_setup_ddi(void);
}
#endif /* x86 */
}
/*
* Init and attach the root node. root node is the first one to be
* attached, so the process is somewhat "handcrafted".
*/
void
{
#ifdef DDI_PROP_DEBUG
#endif /* DDI_PROP_DEBUG */
/*
* Initialize root node
*/
panic("Could not initialize root nexus");
/*
* Attach root node (no need to probe)
* Hold both devinfo and rootnex driver so they can't go away.
*/
panic("Could not attach root nexus");
/*
* Now, expand .conf children of root
*/
(void) i_ndi_make_spec_children(top_devinfo, 0);
/*
* Must be set up before attaching root or pseudo drivers
*/
/*
* Attach options dip
*/
/*
* Attach pseudo nexus and enumerate its children
*/
(void) i_ndi_make_spec_children(pseudo_dip, 0);
/*
* Attach and hold clone dip
*/
/*
* Attach scsi_vhci for MPXIO, this registers scsi vhci class
* with the MPXIO framework.
*/
}