2 * This file is part of the coreboot project.
4 * Copyright (C) 2000 AG Electronics Ltd.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 * The aim of this code is to bring the machine from power-on to the point
22 * where we can jump to the the main coreboot entry point hardwaremain()
23 * which is written in C.
25 * At power-on, we have no RAM, a memory-mapped I/O space, and we are executing
26 * out of ROM, generally at 0xfff00100.
28 * Before we jump to harwaremain() we want to do the following:
30 * - enable L1 I/D caches, otherwise performance will be slow
31 * - set up DBATs for the following regions:
32 * - RAM (generally 0x00000000 -> 0x7fffffff)
33 * - ROM (_ROMBASE -> _ROMBASE + ROM_SIZE)
34 * - I/O (generally 0xfc000000 -> 0xfdffffff)
35 * - the main purpose for setting up the DBATs is so the I/O region
36 * can be marked cache inhibited/write through
37 * - set up IBATs for RAM and ROM
43 #define BSP_IOREGION1 0x80000000
44 #define BSP_IOMASK1 BAT_BL_256M | BAT_VALID_SUPERVISOR | BAT_VALID_USER
45 #define BSP_IOREGION2 0xFD000000
46 #define BSP_IOMASK2 BAT_BL_64M | BAT_VALID_SUPERVISOR | BAT_VALID_USER
52 * Disable dcache and MMU
60 li r4, 0x0030 /* IR & DR */
62 ori r3, r3, 0x2000 /* FP */
68 * Invalidate D & I BATS
82 * Clear segment registers (coreboot doesn't use these)
120 * DBAT0 covers RAM (0 -> 0x0FFFFFFF) (256Mb)
121 * DBAT1 covers PCI memory and ROM (0xFD000000 -> 0xFFFFFFFF) (64Mb)
122 * DBAT2 covers PCI memory (0x80000000 -> 0x8FFFFFFF) (256Mb)
126 ori r3, r2, BAT_BL_256M | BAT_VALID_SUPERVISOR | BAT_VALID_USER
127 ori r2, r2, BAT_READ_WRITE | BAT_GUARDED
132 lis r2, BSP_IOREGION2@h
133 ori r3, r2, BAT_BL_64M | BAT_VALID_SUPERVISOR | BAT_VALID_USER
134 ori r2, r2, BAT_CACHE_INHIBITED | BAT_GUARDED | BAT_READ_WRITE
139 lis r2, BSP_IOREGION1@h
140 ori r3, r2, BAT_BL_256M | BAT_VALID_SUPERVISOR | BAT_VALID_USER
141 ori r2, r2, BAT_CACHE_INHIBITED | BAT_GUARDED | BAT_READ_WRITE
149 * IBAT0 covers RAM (0 -> 256Mb)
150 * IBAT1 covers ROM (_ROMBASE -> _ROMBASE+ROM_SIZE)
153 ori r3, r2, BAT_BL_256M | BAT_VALID_SUPERVISOR | BAT_VALID_USER
154 ori r2, r2, BAT_READ_WRITE
160 #if ROM_SIZE > 1048576
161 ori r3, r2, BAT_BL_16M | BAT_VALID_SUPERVISOR | BAT_VALID_USER
163 ori r3, r2, BAT_BL_1M | BAT_VALID_SUPERVISOR | BAT_VALID_USER
165 ori r2, r2, BAT_READ_ONLY
174 ori r2, r2, MSR_DR | MSR_IR
180 * Enable and invalidate the L1 icache
183 ori r2, r2, HID0_ICE | HID0_ICFI
187 * Enable and invalidate the L1 dcache
190 ori r2, r2, HID0_DCE | HID0_DCFI