From 580950437f2f3ad9b6b6adac3400bf3b0ffe9423 Mon Sep 17 00:00:00 2001 From: jhibbits Date: Tue, 23 Feb 2016 02:28:19 +0000 Subject: Allow the size argument for law_enable() to be non-power-of-2. Although the local access windows are powers of 2 in size, allow arguments that aren't power of 2, and round up. --- sys/powerpc/mpc85xx/mpc85xx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sys/powerpc/mpc85xx') diff --git a/sys/powerpc/mpc85xx/mpc85xx.c b/sys/powerpc/mpc85xx/mpc85xx.c index 717e98a..f67aa29 100644 --- a/sys/powerpc/mpc85xx/mpc85xx.c +++ b/sys/powerpc/mpc85xx/mpc85xx.c @@ -157,7 +157,8 @@ law_find_free(void) return (i); } -#define _LAW_SR(trgt,size) (0x80000000 | (trgt << 20) | (ffsl(size) - 2)) +#define _LAW_SR(trgt,size) (0x80000000 | (trgt << 20) | \ + (flsl(size + (size - 1)) - 2)) int law_enable(int trgt, uint64_t bar, uint32_t size) -- cgit v1.1