powerpc/book3s/32: fix number of bats in p/v_block_mapped()

This patch fixes the loop in p_block_mapped() and v_block_mapped()
to scan the entire bat_addrs[] array.

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
This commit is contained in:
Christophe Leroy 2018-11-16 17:27:42 +00:00 коммит произвёл Michael Ellerman
Родитель 712877f874
Коммит e93ba1b7eb
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -53,7 +53,7 @@ struct batrange { /* stores address ranges mapped by BATs */
phys_addr_t v_block_mapped(unsigned long va) phys_addr_t v_block_mapped(unsigned long va)
{ {
int b; int b;
for (b = 0; b < 4; ++b) for (b = 0; b < ARRAY_SIZE(bat_addrs); ++b)
if (va >= bat_addrs[b].start && va < bat_addrs[b].limit) if (va >= bat_addrs[b].start && va < bat_addrs[b].limit)
return bat_addrs[b].phys + (va - bat_addrs[b].start); return bat_addrs[b].phys + (va - bat_addrs[b].start);
return 0; return 0;
@ -65,7 +65,7 @@ phys_addr_t v_block_mapped(unsigned long va)
unsigned long p_block_mapped(phys_addr_t pa) unsigned long p_block_mapped(phys_addr_t pa)
{ {
int b; int b;
for (b = 0; b < 4; ++b) for (b = 0; b < ARRAY_SIZE(bat_addrs); ++b)
if (pa >= bat_addrs[b].phys if (pa >= bat_addrs[b].phys
&& pa < (bat_addrs[b].limit-bat_addrs[b].start) && pa < (bat_addrs[b].limit-bat_addrs[b].start)
+bat_addrs[b].phys) +bat_addrs[b].phys)