summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2009-09-22 15:43:03 +0000
committerjhb <jhb@FreeBSD.org>2009-09-22 15:43:03 +0000
commit335809a00b5cc09d0ebd4b51f8513a42306fa5b5 (patch)
tree3b2215d62b07e1549485987818fbbad54de0f4cc
parent7af86ad4d9bf06fa578d5124c3645ec933e50940 (diff)
downloadFreeBSD-src-335809a00b5cc09d0ebd4b51f8513a42306fa5b5.zip
FreeBSD-src-335809a00b5cc09d0ebd4b51f8513a42306fa5b5.tar.gz
Don't reread the command register to see if enabling I/O or memory
decoding "took". Other OS's that I checked do not do this and it breaks some amdpm(4) devices. Prior to 7.2 we did not honor the error returned when this failed anyway, so this in effect restores previous behavior. PR: kern/137668 Tested by: Aurelien Mere aurelien.mere amc-os.com MFC after: 3 days
-rw-r--r--sys/dev/pci/pci.c26
1 files changed, 1 insertions, 25 deletions
diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c
index 0b7b267..47aedbd 100644
--- a/sys/dev/pci/pci.c
+++ b/sys/dev/pci/pci.c
@@ -2149,62 +2149,38 @@ pci_disable_busmaster_method(device_t dev, device_t child)
int
pci_enable_io_method(device_t dev, device_t child, int space)
{
- uint16_t command;
uint16_t bit;
- char *error;
-
- bit = 0;
- error = NULL;
switch(space) {
case SYS_RES_IOPORT:
bit = PCIM_CMD_PORTEN;
- error = "port";
break;
case SYS_RES_MEMORY:
bit = PCIM_CMD_MEMEN;
- error = "memory";
break;
default:
return (EINVAL);
}
pci_set_command_bit(dev, child, bit);
- /* Some devices seem to need a brief stall here, what do to? */
- command = PCI_READ_CONFIG(dev, child, PCIR_COMMAND, 2);
- if (command & bit)
- return (0);
- device_printf(child, "failed to enable %s mapping!\n", error);
- return (ENXIO);
+ return (0);
}
int
pci_disable_io_method(device_t dev, device_t child, int space)
{
- uint16_t command;
uint16_t bit;
- char *error;
-
- bit = 0;
- error = NULL;
switch(space) {
case SYS_RES_IOPORT:
bit = PCIM_CMD_PORTEN;
- error = "port";
break;
case SYS_RES_MEMORY:
bit = PCIM_CMD_MEMEN;
- error = "memory";
break;
default:
return (EINVAL);
}
pci_clear_command_bit(dev, child, bit);
- command = PCI_READ_CONFIG(dev, child, PCIR_COMMAND, 2);
- if (command & bit) {
- device_printf(child, "failed to disable %s mapping!\n", error);
- return (ENXIO);
- }
return (0);
}
OpenPOWER on IntegriCloud