summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2010-01-11 04:31:41 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2010-01-11 04:31:41 +0000
commitf28b0593644f14df7c49e3b13efcecb73985c729 (patch)
treeebbd279712e0a5db336d25624bab648baf4239a9
parentf24f75f44d582e005fed41d187261a034bb7628a (diff)
When mapping CarBus memory BARs, enforce a minimum alignment of 0x1000. This
is the granularity of the windows provided by the CardBus bridge. A smaller alignment may result in those windows covering address space used by other PCI devices in the machines. Fixes CardBus xl(4) n naddy's X40.
-rw-r--r--sys/dev/pci/pccbb.c25
1 files changed, 7 insertions, 18 deletions
diff --git a/sys/dev/pci/pccbb.c b/sys/dev/pci/pccbb.c
index d5801ac2a34..2ad3132f4d3 100644
--- a/sys/dev/pci/pccbb.c
+++ b/sys/dev/pci/pccbb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pccbb.c,v 1.68 2009/08/28 15:54:52 kettenis Exp $ */
+/* $OpenBSD: pccbb.c,v 1.69 2010/01/11 04:31:40 kettenis Exp $ */
/* $NetBSD: pccbb.c,v 1.96 2004/03/28 09:49:31 nakayama Exp $ */
/*
@@ -2602,30 +2602,19 @@ pccbb_rbus_cb_space_alloc(cardbus_chipset_tag_t ct, rbus_tag_t rb,
("pccbb_rbus_cb_space_alloc: adr %lx, size %lx, mask %lx, align %lx\n",
addr, size, mask, align));
- if (align == 0) {
- align = size;
+ align = max(align, 4);
+ mask = max(mask, (4 - 1));
+ if (rb->rb_bt == sc->sc_memt) {
+ align = max(align, 0x1000);
+ mask = max(mask, (0x1000 - 1));
}
- if (rb->rb_bt == sc->sc_memt) {
- if (align < 16) {
- return 1;
- }
- } else if (rb->rb_bt == sc->sc_iot) {
- if (align < 4) {
- return 1;
- }
+ if (rb->rb_bt == sc->sc_iot) {
/* XXX: hack for avoiding ISA image */
if (mask < 0x0100) {
mask = 0x3ff;
addr = 0x300;
}
-
- } else {
- DPRINTF(
- ("pccbb_rbus_cb_space_alloc: Bus space tag %x is NOT used.\n",
- rb->rb_bt));
- return 1;
- /* XXX: panic here? */
}
if (rbus_space_alloc(rb, addr, size, mask, align, flags, addrp, bshp)) {