3 * Rich Ireland, Enterasys Networks, rireland@enterasys.com.
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
26 #include <asm/processor.h>
30 #ifdef CONFIG_ADDR_MAP
34 DECLARE_GLOBAL_DATA_PTR;
36 int write_bat (ppc_bat_t bat, unsigned long upper, unsigned long lower)
44 mtspr (DBAT0L, lower);
45 mtspr (DBAT0U, upper);
49 mtspr (IBAT0L, lower);
50 mtspr (IBAT0U, upper);
53 mtspr (DBAT1L, lower);
54 mtspr (DBAT1U, upper);
58 mtspr (IBAT1L, lower);
59 mtspr (IBAT1U, upper);
62 mtspr (DBAT2L, lower);
63 mtspr (DBAT2U, upper);
67 mtspr (IBAT2L, lower);
68 mtspr (IBAT2U, upper);
71 mtspr (DBAT3L, lower);
72 mtspr (DBAT3U, upper);
76 mtspr (IBAT3L, lower);
77 mtspr (IBAT3U, upper);
79 #ifdef CONFIG_HIGH_BATS
81 mtspr (DBAT4L, lower);
82 mtspr (DBAT4U, upper);
86 mtspr (IBAT4L, lower);
87 mtspr (IBAT4U, upper);
90 mtspr (DBAT5L, lower);
91 mtspr (DBAT5U, upper);
95 mtspr (IBAT5L, lower);
96 mtspr (IBAT5U, upper);
99 mtspr (DBAT6L, lower);
100 mtspr (DBAT6U, upper);
104 mtspr (IBAT6L, lower);
105 mtspr (IBAT6U, upper);
108 mtspr (DBAT7L, lower);
109 mtspr (DBAT7U, upper);
113 mtspr (IBAT7L, lower);
114 mtspr (IBAT7U, upper);
121 #ifdef CONFIG_ADDR_MAP
122 if ((gd->flags & GD_FLG_RELOC) && (batn >= 0)) {
124 if (!BATU_VALID(upper))
127 size = BATU_SIZE(upper);
128 addrmap_set_entry(BATU_VADDR(upper), BATL_PADDR(lower),
139 int read_bat (ppc_bat_t bat, unsigned long *upper, unsigned long *lower)
141 unsigned long register u;
142 unsigned long register l;
177 #ifdef CONFIG_HIGH_BATS
221 void print_bats(void)
223 printf("BAT registers:\n");
225 printf ("\tIBAT0L = 0x%08X ", mfspr (IBAT0L));
226 printf ("\tIBAT0U = 0x%08X\n", mfspr (IBAT0U));
227 printf ("\tDBAT0L = 0x%08X ", mfspr (DBAT0L));
228 printf ("\tDBAT0U = 0x%08X\n", mfspr (DBAT0U));
229 printf ("\tIBAT1L = 0x%08X ", mfspr (IBAT1L));
230 printf ("\tIBAT1U = 0x%08X\n", mfspr (IBAT1U));
231 printf ("\tDBAT1L = 0x%08X ", mfspr (DBAT1L));
232 printf ("\tDBAT1U = 0x%08X\n", mfspr (DBAT1U));
233 printf ("\tIBAT2L = 0x%08X ", mfspr (IBAT2L));
234 printf ("\tIBAT2U = 0x%08X\n", mfspr (IBAT2U));
235 printf ("\tDBAT2L = 0x%08X ", mfspr (DBAT2L));
236 printf ("\tDBAT2U = 0x%08X\n", mfspr (DBAT2U));
237 printf ("\tIBAT3L = 0x%08X ", mfspr (IBAT3L));
238 printf ("\tIBAT3U = 0x%08X\n", mfspr (IBAT3U));
239 printf ("\tDBAT3L = 0x%08X ", mfspr (DBAT3L));
240 printf ("\tDBAT3U = 0x%08X\n", mfspr (DBAT3U));
242 #ifdef CONFIG_HIGH_BATS
243 printf ("\tIBAT4L = 0x%08X ", mfspr (IBAT4L));
244 printf ("\tIBAT4U = 0x%08X\n", mfspr (IBAT4U));
245 printf ("\tDBAT4L = 0x%08X ", mfspr (DBAT4L));
246 printf ("\tDBAT4U = 0x%08X\n", mfspr (DBAT4U));
247 printf ("\tIBAT5L = 0x%08X ", mfspr (IBAT5L));
248 printf ("\tIBAT5U = 0x%08X\n", mfspr (IBAT5U));
249 printf ("\tDBAT5L = 0x%08X ", mfspr (DBAT5L));
250 printf ("\tDBAT5U = 0x%08X\n", mfspr (DBAT5U));
251 printf ("\tIBAT6L = 0x%08X ", mfspr (IBAT6L));
252 printf ("\tIBAT6U = 0x%08X\n", mfspr (IBAT6U));
253 printf ("\tDBAT6L = 0x%08X ", mfspr (DBAT6L));
254 printf ("\tDBAT6U = 0x%08X\n", mfspr (DBAT6U));
255 printf ("\tIBAT7L = 0x%08X ", mfspr (IBAT7L));
256 printf ("\tIBAT7U = 0x%08X\n", mfspr (IBAT7U));
257 printf ("\tDBAT7L = 0x%08X ", mfspr (DBAT7L));
258 printf ("\tDBAT7U = 0x%08X\n", mfspr (DBAT7U));