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>
29 #include <linux/compiler.h>
31 #ifdef CONFIG_ADDR_MAP
35 DECLARE_GLOBAL_DATA_PTR;
37 int write_bat (ppc_bat_t bat, unsigned long upper, unsigned long lower)
39 __maybe_unused int batn = -1;
45 mtspr (DBAT0L, lower);
46 mtspr (DBAT0U, upper);
50 mtspr (IBAT0L, lower);
51 mtspr (IBAT0U, upper);
54 mtspr (DBAT1L, lower);
55 mtspr (DBAT1U, upper);
59 mtspr (IBAT1L, lower);
60 mtspr (IBAT1U, upper);
63 mtspr (DBAT2L, lower);
64 mtspr (DBAT2U, upper);
68 mtspr (IBAT2L, lower);
69 mtspr (IBAT2U, upper);
72 mtspr (DBAT3L, lower);
73 mtspr (DBAT3U, upper);
77 mtspr (IBAT3L, lower);
78 mtspr (IBAT3U, upper);
80 #ifdef CONFIG_HIGH_BATS
82 mtspr (DBAT4L, lower);
83 mtspr (DBAT4U, upper);
87 mtspr (IBAT4L, lower);
88 mtspr (IBAT4U, upper);
91 mtspr (DBAT5L, lower);
92 mtspr (DBAT5U, upper);
96 mtspr (IBAT5L, lower);
97 mtspr (IBAT5U, upper);
100 mtspr (DBAT6L, lower);
101 mtspr (DBAT6U, upper);
105 mtspr (IBAT6L, lower);
106 mtspr (IBAT6U, upper);
109 mtspr (DBAT7L, lower);
110 mtspr (DBAT7U, upper);
114 mtspr (IBAT7L, lower);
115 mtspr (IBAT7U, upper);
122 #ifdef CONFIG_ADDR_MAP
123 if ((gd->flags & GD_FLG_RELOC) && (batn >= 0)) {
125 if (!BATU_VALID(upper))
128 size = BATU_SIZE(upper);
129 addrmap_set_entry(BATU_VADDR(upper), BATL_PADDR(lower),
140 int read_bat (ppc_bat_t bat, unsigned long *upper, unsigned long *lower)
142 unsigned long register u;
143 unsigned long register l;
178 #ifdef CONFIG_HIGH_BATS
222 void print_bats(void)
224 printf("BAT registers:\n");
226 printf ("\tIBAT0L = 0x%08X ", mfspr (IBAT0L));
227 printf ("\tIBAT0U = 0x%08X\n", mfspr (IBAT0U));
228 printf ("\tDBAT0L = 0x%08X ", mfspr (DBAT0L));
229 printf ("\tDBAT0U = 0x%08X\n", mfspr (DBAT0U));
230 printf ("\tIBAT1L = 0x%08X ", mfspr (IBAT1L));
231 printf ("\tIBAT1U = 0x%08X\n", mfspr (IBAT1U));
232 printf ("\tDBAT1L = 0x%08X ", mfspr (DBAT1L));
233 printf ("\tDBAT1U = 0x%08X\n", mfspr (DBAT1U));
234 printf ("\tIBAT2L = 0x%08X ", mfspr (IBAT2L));
235 printf ("\tIBAT2U = 0x%08X\n", mfspr (IBAT2U));
236 printf ("\tDBAT2L = 0x%08X ", mfspr (DBAT2L));
237 printf ("\tDBAT2U = 0x%08X\n", mfspr (DBAT2U));
238 printf ("\tIBAT3L = 0x%08X ", mfspr (IBAT3L));
239 printf ("\tIBAT3U = 0x%08X\n", mfspr (IBAT3U));
240 printf ("\tDBAT3L = 0x%08X ", mfspr (DBAT3L));
241 printf ("\tDBAT3U = 0x%08X\n", mfspr (DBAT3U));
243 #ifdef CONFIG_HIGH_BATS
244 printf ("\tIBAT4L = 0x%08X ", mfspr (IBAT4L));
245 printf ("\tIBAT4U = 0x%08X\n", mfspr (IBAT4U));
246 printf ("\tDBAT4L = 0x%08X ", mfspr (DBAT4L));
247 printf ("\tDBAT4U = 0x%08X\n", mfspr (DBAT4U));
248 printf ("\tIBAT5L = 0x%08X ", mfspr (IBAT5L));
249 printf ("\tIBAT5U = 0x%08X\n", mfspr (IBAT5U));
250 printf ("\tDBAT5L = 0x%08X ", mfspr (DBAT5L));
251 printf ("\tDBAT5U = 0x%08X\n", mfspr (DBAT5U));
252 printf ("\tIBAT6L = 0x%08X ", mfspr (IBAT6L));
253 printf ("\tIBAT6U = 0x%08X\n", mfspr (IBAT6U));
254 printf ("\tDBAT6L = 0x%08X ", mfspr (DBAT6L));
255 printf ("\tDBAT6U = 0x%08X\n", mfspr (DBAT6U));
256 printf ("\tIBAT7L = 0x%08X ", mfspr (IBAT7L));
257 printf ("\tIBAT7U = 0x%08X\n", mfspr (IBAT7U));
258 printf ("\tDBAT7L = 0x%08X ", mfspr (DBAT7L));
259 printf ("\tDBAT7U = 0x%08X\n", mfspr (DBAT7U));