Skip to contentSkip to conversation

better bar size calculation

PATCH New Bradley D. LaRonde 1 participant 1 message Jul 1, 2002 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 better bar size calculation

# 02/07/01 brad@dev1.(none) 1.72

# better bar size calculation
arch/mips/kernel/pci_auto.c +2 -1
diff -Nru a/arch/mips/kernel/pci_auto.c b/arch/mips/kernel/pci_auto.c
@@ -35,6 +35,7 @@
 #include <linux/init.h>
 #include <linux/types.h>
 #include <linux/pci.h>
+#include <linux/bitops.h>
 
 #include <asm/pci_channel.h>
 
@@ -152,7 +153,7 @@
 
 
 		/* Calculate requested size */
-		bar_size = ~(bar_response & addr_mask) + 1;
+		bar_size = 1 << (ffs(bar_response & addr_mask) - 1);
 
 		/* Allocate a base address */
 		bar_value = ((*lower_limit - 1) & ~(bar_size - 1)) + bar_size;