/* * Print vendor ID and device ID for PCI devices */ int print_pciid(di_node_t node, di_prom_handle_t ph) { di_node_t pnode = di_parent_node(node); char *s = NULL; int *i, type = di_nodeid(node); if (LOOKUP_PROP(strings, ph, type, DDI_DEV_T_ANY, pnode, "device_type", &s) <= 0) return (0); if (!ISPCI(s)) return (0); /* not a pci device */ (void) printf(" (%s", s); if (LOOKUP_PROP(ints, ph, type, DDI_DEV_T_ANY, node, "vendor-id", &i) > 0) (void) printf("%x", i[0]); if (LOOKUP_PROP(ints, ph, type, DDI_DEV_T_ANY, node, "device-id", &i) > 0) (void) printf(",%x", i[0]); (void) printf(")"); return (1); }
/* * Print vendor ID and device ID for PCI devices */ int print_pciid(di_node_t node, di_prom_handle_t ph, pcidb_hdl_t *pci) { pcidb_vendor_t *vend; pcidb_device_t *dev; di_node_t pnode = di_parent_node(node); char *s = NULL; int *i, type = di_nodeid(node); if (LOOKUP_PROP(strings, ph, type, DDI_DEV_T_ANY, pnode, "device_type", &s) <= 0) return (0); if (!ISPCI(s)) return (0); /* not a pci device */ (void) printf(" (%s", s); if (LOOKUP_PROP(ints, ph, type, DDI_DEV_T_ANY, node, "vendor-id", &i) > 0) (void) printf("%x", i[0]); if (pci != NULL) vend = pcidb_lookup_vendor(pci, i[0]); if (LOOKUP_PROP(ints, ph, type, DDI_DEV_T_ANY, node, "device-id", &i) > 0) (void) printf(",%x", i[0]); if (pci != NULL) dev = pcidb_lookup_device_by_vendor(vend, i[0]); (void) printf(") ["); if (vend != NULL) (void) printf("%s ", pcidb_vendor_name(vend)); else (void) printf("unknown vendor, "); if (dev != NULL) (void) printf("%s", pcidb_device_name(dev)); else (void) printf("unknown device"); (void) printf("]"); return (1); }