aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMike Smith <msmith@FreeBSD.org>2000-09-01 23:09:02 +0000
committerMike Smith <msmith@FreeBSD.org>2000-09-01 23:09:02 +0000
commitf7c7ba14bf64872e57123c83d2d15ec3bda17a05 (patch)
tree34ec63099e8a88a268f4ec08286f6c28e46ce11c /sys
parent444476fd6219952af4d7f70cefa60a281e7eb4d0 (diff)
downloadsrc-f7c7ba14bf64872e57123c83d2d15ec3bda17a05.tar.gz
src-f7c7ba14bf64872e57123c83d2d15ec3bda17a05.zip
If a base address register has been set up by the BIOS, but the relevant
enable bit hasn't been set in the command register, set the bit and honour the register. It seems that quite a few lazy BIOS writers aren't bothering to do this, which upsets the existing code and causes us to miss out on properly-configured devices.
Notes
Notes: svn path=/head/; revision=65347
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/pci.c19
-rw-r--r--sys/pci/pci.c19
2 files changed, 26 insertions, 12 deletions
diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c
index 64f86b82b627..49b4611e4ca0 100644
--- a/sys/dev/pci/pci.c
+++ b/sys/dev/pci/pci.c
@@ -948,7 +948,7 @@ pci_add_map(device_t pcib, int b, int s, int f, int reg,
u_int8_t ln2size;
u_int8_t ln2range;
u_int32_t testval;
-
+ u_int16_t cmd;
int type;
map = PCIB_READ_CONFIG(pcib, b, s, f, reg, 4);
@@ -983,11 +983,18 @@ pci_add_map(device_t pcib, int b, int s, int f, int reg,
else
printf(", enabled\n");
}
-
- if (type == SYS_RES_IOPORT && !pci_porten(pcib, b, s, f))
- return 1;
- if (type == SYS_RES_MEMORY && !pci_memen(pcib, b, s, f))
- return 1;
+
+ /* Turn on resources that have been left off by a lazy BIOS */
+ if (type == SYS_RES_IOPORT && !pci_porten(pcib, b, s, f)) {
+ cmd = PCIB_READ_CONFIG(pcib, b, s, f, PCIR_COMMAND, 2);
+ cmd |= PCIM_CMD_PORTEN;
+ PCIB_WRITE_CONFIG(pcib, b, s, f, PCIR_COMMAND, cmd, 2);
+ }
+ if (type == SYS_RES_MEMORY && !pci_memen(pcib, b, s, f)) {
+ cmd = PCIB_READ_CONFIG(pcib, b, s, f, PCIR_COMMAND, 2);
+ cmd |= PCIM_CMD_MEMEN;
+ PCIB_WRITE_CONFIG(pcib, b, s, f, PCIR_COMMAND, cmd, 2);
+ }
resource_list_add(rl, type, reg,
base, base + (1 << ln2size) - 1,
diff --git a/sys/pci/pci.c b/sys/pci/pci.c
index 64f86b82b627..49b4611e4ca0 100644
--- a/sys/pci/pci.c
+++ b/sys/pci/pci.c
@@ -948,7 +948,7 @@ pci_add_map(device_t pcib, int b, int s, int f, int reg,
u_int8_t ln2size;
u_int8_t ln2range;
u_int32_t testval;
-
+ u_int16_t cmd;
int type;
map = PCIB_READ_CONFIG(pcib, b, s, f, reg, 4);
@@ -983,11 +983,18 @@ pci_add_map(device_t pcib, int b, int s, int f, int reg,
else
printf(", enabled\n");
}
-
- if (type == SYS_RES_IOPORT && !pci_porten(pcib, b, s, f))
- return 1;
- if (type == SYS_RES_MEMORY && !pci_memen(pcib, b, s, f))
- return 1;
+
+ /* Turn on resources that have been left off by a lazy BIOS */
+ if (type == SYS_RES_IOPORT && !pci_porten(pcib, b, s, f)) {
+ cmd = PCIB_READ_CONFIG(pcib, b, s, f, PCIR_COMMAND, 2);
+ cmd |= PCIM_CMD_PORTEN;
+ PCIB_WRITE_CONFIG(pcib, b, s, f, PCIR_COMMAND, cmd, 2);
+ }
+ if (type == SYS_RES_MEMORY && !pci_memen(pcib, b, s, f)) {
+ cmd = PCIB_READ_CONFIG(pcib, b, s, f, PCIR_COMMAND, 2);
+ cmd |= PCIM_CMD_MEMEN;
+ PCIB_WRITE_CONFIG(pcib, b, s, f, PCIR_COMMAND, cmd, 2);
+ }
resource_list_add(rl, type, reg,
base, base + (1 << ln2size) - 1,