Solaris Source Insight: PCI bus driver moduls
<!--@page { margin: 0.79in }P { margin-bottom: 0.08in }-->Implementation of misc/pcicfg
This module provids below twointerfaces to configure/unconfigure pci devices (include thechildren).
540 /*
541* This entry pointis called to configure a device (and
542* all its children)on the given bus. It is called when
543* a new device isadded to the PCI domain.This routine
544* will create thedevice tree and program the devices
545* registers.
546*/
547 int
548pcicfg_configure(dev_info_t *devi, uint_t device, uint_t function,
549 pcicfg_flags_tflags)
In pcicfg_configure(), the followingprocedures followed:
[*]probe the device (includechildren), create devinfo node for each PCI device, and bind it todriver if below configuration is successful.
[*]Allocate and program the resoursesfor both bridges and leaf devices.
[*]Update standard and specificproperties.
1422 /*
1423* This will turn resources allocated by pcicfg_configure()
1424* and remove thedevice tree from the Hotplug Connection (CN)
1425* and below.Theroutine assumes the devices have their
1426* drivers detached.
1427*/
1428 int
1429pcicfg_unconfigure(dev_info_t *devi, uint_t device, uint_t function,
1430 pcicfg_flags_tflags)
In pcicfg_unconfigure(), the followingprocedures followed:
[*]Offline the devinfo nodes, thatmeans detaching the device driver and preventing it fromreattaching.
[*]Free up resources the devicesconsumed, disable the device and tear down the devinfo node (includechildren).
By the way, this should be a bug incode.
code review comments:
585 |_______|_______if((function != PCICFG_ALL_FUNC) && (function != func))
586|_______|_______|_______goto next;
… ...
657 next:
658 |_______|_______/*
659 |_______|_______ *Determine if ARI Forwarding should be enabled.
660 |_______|_______ */
661 |_______|_______if(func == 0) {
662|_______|_______|_______if ((pcie_ari_supported(devi)
663|_______|_______|_______ == PCIE_ARI_FORW_SUPPORTED) &&
664|_______|_______|_______ (pcie_ari_device(new_device) ==PCIE_ARI_DEVICE)) {
new_device could be used here beforeinitialized.
页:
[1]