diff options
author | Becky Bruce <beckyb@kernel.crashing.org> | 2009-02-03 18:10:52 -0600 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2009-02-10 00:29:49 +0100 |
commit | c9315e6b4f244981de0b2eaaa29a7838a165b494 (patch) | |
tree | a27fab62224cf8b5e7f831f4c1c64ad6ba258d5d /cpu/mpc86xx/cpu_init.c | |
parent | d35ae5a938679bd7e18167faf79d0fb3c6639b51 (diff) | |
download | u-boot-c9315e6b4f244981de0b2eaaa29a7838a165b494.tar.gz u-boot-c9315e6b4f244981de0b2eaaa29a7838a165b494.tar.xz u-boot-c9315e6b4f244981de0b2eaaa29a7838a165b494.zip |
mpc86xx: Add support to populate addr map based on BATs
If CONFIG_ADDR_MAP is enabled, update the address map
whenever we write a bat.
Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
Diffstat (limited to 'cpu/mpc86xx/cpu_init.c')
-rw-r--r-- | cpu/mpc86xx/cpu_init.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/cpu/mpc86xx/cpu_init.c b/cpu/mpc86xx/cpu_init.c index a7e6036dbe..4f29122f40 100644 --- a/cpu/mpc86xx/cpu_init.c +++ b/cpu/mpc86xx/cpu_init.c @@ -154,3 +154,30 @@ void setup_bats(void) return; } + +#ifdef CONFIG_ADDR_MAP +/* Initialize address mapping array */ +void init_addr_map(void) +{ + int i; + ppc_bat_t bat = DBAT0; + phys_size_t size; + unsigned long upper, lower; + + for (i = 0; i < CONFIG_SYS_NUM_ADDR_MAP; i++, bat++) { + if (read_bat(bat, &upper, &lower) != -1) { + if (!BATU_VALID(upper)) + size = 0; + else + size = BATU_SIZE(upper); + addrmap_set_entry(BATU_VADDR(upper), BATL_PADDR(lower), + size, i); + } +#ifdef CONFIG_HIGH_BATS + /* High bats are not contiguous with low BAT numbers */ + if (bat == DBAT3) + bat = DBAT4 - 1; +#endif + } +} +#endif |