Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Nov 2005 00:50:41 +0800
From:      kylin <fierykylin@gmail.com>
To:        freebsd-hackers@freebsd.org
Subject:   puzzle about the pci_add_child
Message-ID:  <87ab37ab0511280850y1bca554n1da9b11c321be34b@mail.gmail.com>

index | next in thread | raw e-mail

 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!


help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?87ab37ab0511280850y1bca554n1da9b11c321be34b>