/* * Create classes and major number bindings for the name of my root. * Called immediately before 'loadrootmodules' */ static void impl_create_root_class(void) { major_t major; size_t size; char *cp; /* * The name for the root nexus is exactly as the manufacturer * placed it in the prom name property. No translation. */ if ((major = ddi_name_to_major("rootnex")) == DDI_MAJOR_T_NONE) 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. */ size = (size_t)BOP_GETPROPLEN(bootops, "mfg-name") + 1; rootname = kmem_zalloc(size, KM_SLEEP); (void) BOP_GETPROP(bootops, "mfg-name", rootname); /* * 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. */ for (cp = rootname; *cp; cp++) if (*cp == '/') *cp = '_'; /* * Bind rootname to rootnex driver */ if (make_mbind(rootname, major, NULL, mb_hashtab) != 0) { cmn_err(CE_WARN, "A driver or driver alias has already " "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. */ delete_mbind(rootname, mb_hashtab); if (make_mbind(rootname, major, NULL, mb_hashtab) != 0) 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). */ (void) BOP_GETPROP(bootops, "impl-arch-name", platform); /* * If boot-aoepath is defined, assume it's AoE boot and set bootpath to * aoeblk/blkdev device corresponding to specified shelf.slot numbers. */ size = (size_t)BOP_GETPROPLEN(bootops, "boot-aoepath"); if (size != -1) { char aoedev[MAXPATHLEN]; char *delim; int shelf, slot; aoepath_prop = kmem_zalloc(size, KM_SLEEP); (void) BOP_GETPROP(bootops, "boot-aoepath", aoepath_prop); /* * If boot-aoepath is set to "auto", device will be * configured later during AoE autoconfiguration. */ if (strcmp(aoepath_prop, "auto") != 0) { if ((delim = strchr(aoepath_prop, '.')) != NULL) *delim++ = '\0'; if (ddi_strtol(aoepath_prop, (char **)NULL, 10, (long *)&shelf) != 0) shelf = 0; if (delim == NULL || ddi_strtol(delim, (char **)NULL, 10, (long *)&slot) != 0) slot = 0; /* FIXME aoeblk@0,0 ?! */ (void) snprintf(aoedev, MAXPATHLEN, "/aoe/aoeblk@0,0/blkdev@%d,%d", shelf, slot); setbootpath(aoedev); } } #if defined(__x86) /* * Retrieve and honor the bootpath and optional fstype properties */ size = (size_t)BOP_GETPROPLEN(bootops, "bootpath"); if (size != -1) { bootpath_prop = kmem_zalloc(size, KM_SLEEP); (void) BOP_GETPROP(bootops, "bootpath", bootpath_prop); setbootpath(bootpath_prop); } size = (size_t)BOP_GETPROPLEN(bootops, "fstype"); if (size != -1) { fstype_prop = kmem_zalloc(size, KM_SLEEP); (void) BOP_GETPROP(bootops, "fstype", fstype_prop); setbootfstype(fstype_prop); } #endif }
/* * Create classes and major number bindings for the name of my root. * Called immediately before 'loadrootmodules' */ static void impl_create_root_class(void) { major_t major; size_t size; char *cp; extern struct bootops *bootops; /* * The name for the root nexus is exactly as the manufacturer * placed it in the prom name property. No translation. */ if ((major = ddi_name_to_major("rootnex")) == (major_t)-1) panic("Couldn't find major number for 'rootnex'"); size = (size_t)BOP_GETPROPLEN(bootops, "mfg-name"); rootname = kmem_zalloc(size, KM_SLEEP); (void) BOP_GETPROP(bootops, "mfg-name", rootname); /* * 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. */ for (cp = rootname; *cp; cp++) if (*cp == '/') *cp = '_'; /* * Bind rootname to rootnex driver */ if (make_mbind(rootname, major, NULL, mb_hashtab) != 0) { cmn_err(CE_WARN, "A driver or driver alias has already " "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. */ delete_mbind(rootname, mb_hashtab); if (make_mbind(rootname, major, NULL, mb_hashtab) != 0) 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). */ (void) BOP_GETPROP(bootops, "impl-arch-name", platform); #if defined(__x86) /* * Retrieve and honor the bootpath and optional fstype properties */ size = (size_t)BOP_GETPROPLEN(bootops, "bootpath"); if (size != -1) { bootpath_prop = kmem_zalloc(size, KM_SLEEP); (void) BOP_GETPROP(bootops, "bootpath", bootpath_prop); setbootpath(bootpath_prop); } size = (size_t)BOP_GETPROPLEN(bootops, "fstype"); if (size != -1) { fstype_prop = kmem_zalloc(size, KM_SLEEP); (void) BOP_GETPROP(bootops, "fstype", fstype_prop); setbootfstype(fstype_prop); } #endif }