puzzle about the pci_add_child
kylin
fierykylin at gmail.com
Mon Nov 28 16:50:43 GMT 2005
i am reading the pci code of freeBSD 53 ,and come to the puzzle of
pci_add_child.
1
why should we =09pci_cfg_save(dinfo->cfg.dev, dinfo, 0); after we have
already fill the cfg in pci_read_device ?
2
what 's the purpose of the function couple
pci_cfg_save(dinfo->cfg.dev, dinfo, 0);
pci_cfg_restore(dinfo->cfg.dev, dinfo)
below is the function ,thank u
pci_add_child(device_t bus, struct pci_devinfo *dinfo)
{
device_t pcib;
pcib = device_get_parent(bus);
dinfo->cfg.dev = device_add_child(bus, NULL, -1);//NULLmeans no
devclass to create
// for pci bus refers to pci device node
device_set_ivars(dinfo->cfg.dev, dinfo);
pci_cfg_save(dinfo->cfg.dev, dinfo, 0);//for what read and write?
pci_cfg_restore(dinfo->cfg.dev, dinfo);//not store ,but REstore ,power related
pci_add_resources(pcib, bus, dinfo->cfg.dev);//see resource are bridge related
pci_print_verbose(dinfo);
...
}
--
we who r about to die,salute u!
More information about the freebsd-hackers
mailing list