Enable or Disable ?

Eric W. Biederman ebiederman at lnxi.com
Fri May 7 16:58:00 CEST 2004


Li-Ta Lo <ollie at lanl.gov> writes:

> Eric,
> 
> I still don't understand why we have to enable some device
> even the config file says the device is disabled. The code
> in pci_device.c:pci_scan_bus()
> 
> 		if (dev->chip && dev->chip->control &&
> 		    dev->chip->control->enable_dev) {
> 			int enabled  = dev->enabled;
> 			dev->enabled = 1;
> 			dev->chip->control->enable_dev(dev);
> 			dev->enabled = enabled;
> 		}
> 
> tries to ignore the dev->enabled flag and enable the device.
> Later the enable_dev() or enable() is called again.

Because we don't know what kind of devices it is, just that it exists.
We temporarily enable the device's config space so we can look up the
type of device (vendor/device id) and get more specific methods.  In
the case of the 8111 it does not matter.  For some chips we may need
to do more to disable an device than just disable it's pci
configuration space. 

The other half of the picture is that doing it that way more reliably
tests the code paths of a device.  So we catch it if someone forgets
to implement the code needed if the device is enabled.

Probably that piece of code deserves a comment.

Eric



More information about the coreboot mailing list