# Re: \[RFC/PATCH 1/3\] powerpc: add ioremap\_bat() function for setting up BAT translated IO regions.

- From: Grant Likely \<hidden\>
- Date: 2008-08-12 19:50:33 
- List: linuxppc-dev
- Page: https://ratatoskr.run/linuxppc-dev/2008/08/9444376
- Thread: https://ratatoskr.run/linuxppc-dev/2008/08/9444193/t.md

```text
On Thu, Aug 07, 2008 at 07:04:04PM -0500, Kumar Gala wrote:
>> mem_init_done isn't a good indication. We can do page tables when it's
>> 0, we would have to use a separate mem_preinit_done or something :-)
>>
>> I initially also though about a flag to ioremap_prot to be honest. But
>> it does obfuscate the normal ioremap code path and if there's a flag,
>> that means that callers know the difference and thus may as well call
>> a separate function, don't you think ?
>
> I'm ok with exposing a separate function as far as the API goes.. I'm  
> not ok with duplicating the logic of __ioremap().

Turns out there is very little actual duplication of code with
__ioremap().  The checks for p_mapped_by_* are the same, but all the
alignment checks are different because different boundaries are used.

I attempted to break things down to a common function, but there is not
a lot there.  But I will add a function to manage modification of
ioremap_bot.

g.
```
