Only check to see if a memory resource is a PCI ROM BAR when activating

and deactivating PCI resources.  Previously, if a device had more than
48 MSI interrupts, then activating message 48 (which has a rid == PCIR_BIOS)
would incorrectly try to enable the PCI ROM BAR.

Tested by:	Olivier Cinquin  ocinquin uci edu
MFC after:	3 days
This commit is contained in:
John Baldwin 2012-05-23 13:41:12 +00:00
parent 4cc50ab413
commit d79a477554

View File

@ -4260,7 +4260,7 @@ pci_activate_resource(device_t dev, device_t child, int type, int rid,
if (device_get_parent(child) == dev) {
/* Device ROMs need their decoding explicitly enabled. */
dinfo = device_get_ivars(child);
if (PCIR_IS_BIOS(&dinfo->cfg, rid))
if (type == SYS_RES_MEMORY && PCIR_IS_BIOS(&dinfo->cfg, rid))
pci_write_bar(child, pci_find_bar(child, rid),
rman_get_start(r) | PCIM_BIOS_ENABLE);
switch (type) {
@ -4287,7 +4287,7 @@ pci_deactivate_resource(device_t dev, device_t child, int type,
/* Disable decoding for device ROMs. */
if (device_get_parent(child) == dev) {
dinfo = device_get_ivars(child);
if (PCIR_IS_BIOS(&dinfo->cfg, rid))
if (type == SYS_RES_MEMORY && PCIR_IS_BIOS(&dinfo->cfg, rid))
pci_write_bar(child, pci_find_bar(child, rid),
rman_get_start(r));
}