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>

next in thread | raw e-mail | index | archive | help
 i am reading the pci code of freeBSD 53 ,and come to the puzzle of
   pci_add_child.
   1
    why should we =3D09pci_cfg_save(dinfo->cfg.dev, dinfo, 0); after we hav=
e
   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 =3D device_get_parent(bus);
dinfo->cfg.dev =3D 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 rela=
ted
pci_add_resources(pcib, bus, dinfo->cfg.dev);//see resource are bridge rela=
ted
pci_print_verbose(dinfo);
...
}

--
we who r about to die,salute u!



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