/* * Hook for modifying the OS boot path. This hook allows us to handle * device arguments that the OS can't handle. */ void mangle_os_bootpath(char *bpath) { pnode_t node; char *stripped_pathname; node = prom_finddevice(bpath); if (prom_devicetype(node, "network") == 0) return; /* * The OS can't handle network device arguments * eg: boot net:promiscuous,speed=100,duplex=full * So, we remove any argument strings in the device * pathname we hand off to the OS for network devices. * * Internally, within boot, bpath is used to access * the device, but v2path (as the boot property "boot-path") * is the pathname passed to the OS. */ stripped_pathname = kmem_alloc(OBP_MAXPATHLEN, 0); prom_strip_options(bpath, stripped_pathname); v2path = stripped_pathname; }
static int walk_cpus_cb(pnode_t node, void *arg, void *result) { walk_cpu_data_t *wcd = arg; /* * Sun4v doesn't support port_id on guest. */ #ifndef sun4v int port_id; #endif /* sun4v */ if (!prom_devicetype(node, OBP_CPU)) return (PROM_WALK_CONTINUE); #ifndef sun4v if ((prom_getprop(node, "portid", (caddr_t)&port_id) == -1) && (prom_getprop(node, "upa-portid", (caddr_t)&port_id) == -1) && (prom_getprop(node, "cpuid", (caddr_t)&port_id) == -1)) { warn("cpu node %x has no identifying properties\n", node); return (PROM_WALK_CONTINUE); } #endif /* sun4v */ if (wcd->wcd_cb(node, wcd->wcd_arg, result) != 0) return (PROM_WALK_TERMINATE); return (PROM_WALK_CONTINUE); }
/* * prom_findnode_bydevtype() searches the prom device subtree rooted at 'node' * and returns the first node whose device type property matches the type * supplied in 'devtype'. */ static int bytype_cb(pnode_t node, void *arg, void *result) { if (prom_devicetype(node, (char *)arg)) { *((pnode_t *)result) = node; return (PROM_WALK_TERMINATE); } return (PROM_WALK_CONTINUE); }
int prom_stdout_is_framebuffer(void) { static int remember = -1; if (remember == -1) remember = prom_devicetype((pnode_t)prom_stdout_node(), OBP_DISPLAY); return (remember); }
boolean_t is_netdev(char *devpath) { pnode_t node = prom_finddevice(devpath); char *options; if ((node == OBP_NONODE) || (node == OBP_BADNODE)) return (B_FALSE); if (prom_devicetype(node, "network") != 0) return (B_TRUE); /* * For Infiniband, network device names will be of the * format XXX/ib@0:port=1,pkey=1234,protocol=ip[,YYY] where * XXX is typically /pci@8,700000/pci@1. The device_type * property will be "ib". */ if (prom_devicetype(node, "ib") != 0) { options = prom_path_options(devpath); if (options != NULL) { #define SEARCHSTRING ",protocol=ip" #define SEARCHSTRLEN strlen(SEARCHSTRING) if (strstr(options, ",protocol=ip,") != NULL) return (B_TRUE); while ((options = strstr(options, SEARCHSTRING)) != NULL) { char nextc; nextc = options[SEARCHSTRLEN]; if ((nextc == ',') || (nextc == 0)) return (B_TRUE); options += SEARCHSTRLEN; } } } return (B_FALSE); }