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.
This commit is contained in:
jhibbits 2016-02-23 02:28:19 +00:00
parent bd90256ab3
commit 580950437f

View File

@ -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)