From f28b0593644f14df7c49e3b13efcecb73985c729 Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Mon, 11 Jan 2010 04:31:41 +0000 Subject: 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. --- sys/dev/pci/pccbb.c | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) (limited to 'sys') 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)) { -- cgit v1.2.3