Commit cbcaff7d authored by Christophe Leroy's avatar Christophe Leroy Committed by Michael Ellerman

powerpc/32s: automatically allocate BAT in setbat()

If no BAT is given to setbat(), select an available BAT.
Signed-off-by: default avatarChristophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/a212bd36fbd6179e0929b6c727febc35132ac25c.1568665466.git.christophe.leroy@c-s.fr
parent d538aadc
...@@ -251,9 +251,18 @@ void __init setbat(int index, unsigned long virt, phys_addr_t phys, ...@@ -251,9 +251,18 @@ void __init setbat(int index, unsigned long virt, phys_addr_t phys,
{ {
unsigned int bl; unsigned int bl;
int wimgxpp; int wimgxpp;
struct ppc_bat *bat = BATS[index]; struct ppc_bat *bat;
unsigned long flags = pgprot_val(prot); unsigned long flags = pgprot_val(prot);
if (index == -1)
index = find_free_bat();
if (index == -1) {
pr_err("%s: no BAT available for mapping 0x%llx\n", __func__,
(unsigned long long)phys);
return;
}
bat = BATS[index];
if ((flags & _PAGE_NO_CACHE) || if ((flags & _PAGE_NO_CACHE) ||
(cpu_has_feature(CPU_FTR_NEED_COHERENT) == 0)) (cpu_has_feature(CPU_FTR_NEED_COHERENT) == 0))
flags &= ~_PAGE_COHERENT; flags &= ~_PAGE_COHERENT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment