From 0a6c6a6dd264097f5ec3e82c18f205a2b72cc7f6 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Tue, 6 Apr 2004 22:50:50 +0000 Subject: [PATCH] Better checks to make sure that we get good alignment. This code is a bit of a bandaide until I get better pci bus code committed to head from my p4 tree. --- sys/dev/pccbb/pccbb.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/sys/dev/pccbb/pccbb.c b/sys/dev/pccbb/pccbb.c index 560e2fc3071c..75044ba17595 100644 --- a/sys/dev/pccbb/pccbb.c +++ b/sys/dev/pccbb/pccbb.c @@ -1638,14 +1638,13 @@ cbb_cardbus_alloc_resource(device_t brdev, device_t child, int type, start = cbb_start_mem; if (end < start) end = start; - if (RF_ALIGNMENT(flags) < CBB_MEMALIGN_BITS) { - if (count < CBB_MEMALIGN) - align = CBB_MEMALIGN; - else - align = count; - flags = (flags & ~RF_ALIGNMENT_MASK) | + if (count < CBB_MEMALIGN) + align = CBB_MEMALIGN; + else + align = count; + if (align > (1 << RF_ALIGNMENT(flags))) + flags = (flags & ~RF_ALIGNMENT_MASK) | rman_make_alignment_flags(align); - } break; }