void pciio_device_info_unregister(devfs_handle_t connectpt, pciio_info_t pciio_info) { char name[32]; devfs_handle_t pconn; if (!pciio_info) return; pciio_slot_func_to_name(name, pciio_info->c_slot, pciio_info->c_func); hwgraph_edge_remove(connectpt,name,&pconn); pciio_info_set(pconn,0); /* Remove the link to our pci provider */ hwgraph_edge_remove(pconn, EDGE_LBL_MASTER, NULL); hwgraph_vertex_unref(pconn); hwgraph_vertex_destroy(pconn); }
vertex_hdl_t pciio_device_info_register( vertex_hdl_t connectpt, /* vertex at center of bus */ pciio_info_t pciio_info) /* details about the connectpt */ { char name[32]; vertex_hdl_t pconn; int device_master_set(vertex_hdl_t, vertex_hdl_t); pciio_slot_func_to_name(name, pciio_info->c_slot, pciio_info->c_func); if (GRAPH_SUCCESS != hwgraph_path_add(connectpt, name, &pconn)) return pconn; pciio_info->c_vertex = pconn; pciio_info_set(pconn, pciio_info); #ifdef DEBUG_PCIIO { int pos; char dname[256]; pos = devfs_generate_path(pconn, dname, 256); printk("%s : pconn path= %s \n", __FUNCTION__, &dname[pos]); } #endif /* DEBUG_PCIIO */ /* * create link to our pci provider */ device_master_set(pconn, pciio_info->c_master); return pconn; }
devfs_handle_t pciio_device_info_register( devfs_handle_t connectpt, /* vertex at center of bus */ pciio_info_t pciio_info) /* details about the connectpt */ { char name[32]; devfs_handle_t pconn; pciio_slot_func_to_name(name, pciio_info->c_slot, pciio_info->c_func); if (GRAPH_SUCCESS != hwgraph_path_add(connectpt, name, &pconn)) return pconn; pciio_info->c_vertex = pconn; pciio_info_set(pconn, pciio_info); #ifdef BRINGUP { int pos; char dname[256]; pos = devfs_generate_path(pconn, dname, 256); #ifdef DEBUG_PCIIO printk("%s : pconn path= %s \n", __FUNCTION__, &dname[pos]); #endif } #endif /* BRINGUP */ /* * create link to our pci provider */ device_master_set(pconn, pciio_info->c_master); #if USRPCI /* * Call into usrpci provider to let it initialize for * the given slot. */ if (pciio_info->c_slot != PCIIO_SLOT_NONE) usrpci_device_register(pconn, pciio_info->c_master, pciio_info->c_slot); #endif return pconn; }
/* * pciio_cardinfo_get * * Get the pciio info structure corresponding to the * specified PCI "slot" (we like it when the same index * number is used for the PCI IDSEL, the REQ/GNT pair, * and the interrupt line being used for INTA. We like * it so much we call it the slot number). */ static pciio_info_t pciio_cardinfo_get( devfs_handle_t pciio_vhdl, pciio_slot_t pci_slot) { char namebuf[16]; pciio_info_t info = 0; devfs_handle_t conn; pciio_slot_func_to_name(namebuf, pci_slot, PCIIO_FUNC_NONE); if (GRAPH_SUCCESS == hwgraph_traverse(pciio_vhdl, namebuf, &conn)) { info = pciio_info_chk(conn); hwgraph_vertex_unref(conn); } return info; }