summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/dev/cardbus/cardbus_cis.c9
-rw-r--r--sys/dev/cardbus/cardbus_cis.h2
2 files changed, 4 insertions, 7 deletions
diff --git a/sys/dev/cardbus/cardbus_cis.c b/sys/dev/cardbus/cardbus_cis.c
index a676e95..deef8cd 100644
--- a/sys/dev/cardbus/cardbus_cis.c
+++ b/sys/dev/cardbus/cardbus_cis.c
@@ -274,7 +274,7 @@ DECODE_PROTOTYPE(bar)
type = SYS_RES_MEMORY;
}
bar = (reg & TPL_BAR_REG_ASI_MASK) - 1;
- if (bar < 0 || bar > 6) {
+ if (bar < 0 || bar > 5 || (type == SYS_RES_IOPORT && bar == 5)) {
device_printf(dev, "Invalid BAR number: %02x(%02x)\n",
reg, bar);
return EINVAL;
@@ -282,13 +282,10 @@ DECODE_PROTOTYPE(bar)
bar = CARDBUS_BASE0_REG + bar * 4;
DEVPRINTF((dev, "Opening BAR: type=%s, bar=%02x, len=%04x\n",
(type==SYS_RES_MEMORY)?"MEM":"IO", bar, len));
- res = bus_generic_alloc_resource(child, child, type, &reg, 0,
+ res = bus_generic_alloc_resource(child, child, type, &bar, 0,
~0, len, rman_make_alignment_flags(len) | RF_ACTIVE);
if (res == NULL) {
- device_printf(dev, "Cannot allocate BAR %02x\n", reg);
- } else {
- start = rman_get_start(res);
- pci_write_config(child, reg, start, 4);
+ device_printf(dev, "Cannot allocate BAR %02x\n", bar);
}
}
return 0;
diff --git a/sys/dev/cardbus/cardbus_cis.h b/sys/dev/cardbus/cardbus_cis.h
index 3fdc5f2..9268582 100644
--- a/sys/dev/cardbus/cardbus_cis.h
+++ b/sys/dev/cardbus/cardbus_cis.h
@@ -80,7 +80,7 @@ int cardbus_do_cis(device_t dev, device_t child);
/* BAR */
#define TPL_BAR_REG_ASI_MASK 0x07
-#define TPL_BAR_REG_AS 0x08
+#define TPL_BAR_REG_AS 0x10
/* CISTPL_FUNC */
#define TPL_FUNC_MF 0 /* multi function tuple */
OpenPOWER on IntegriCloud