2 * This file contains low level CPU setup functions.
3 * Copyright (C) 2003 Benjamin Herrenschmidt (benh@kernel.crashing.org)
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
12 #include <linux/config.h>
13 #include <asm/processor.h>
15 #include <asm/cputable.h>
16 #include <asm/ppc_asm.h>
17 #include <asm/asm-offsets.h>
18 #include <asm/cache.h>
20 _GLOBAL(__970_cpu_preinit)
22 * Do nothing if not running in HV mode
29 * Deal only with PPC970 and PPC970FX.
41 /* Make sure HID4:rm_ci is off before MMU is turned off, that large
42 * pages are enabled with HID4:61 and clear HID5:DCBZ_size and
47 rldimi r3,r0,40,23 /* clear bit 23 (rm_ci) */
48 rldimi r3,r0,2,61 /* clear bit 61 (lg_pg_en) */
54 rldimi r3,r0,6,56 /* clear bits 56 & 57 (DCBZ*) */
60 /* Setup some basic HID1 features */
62 li r3,0x1200 /* enable i-fetch cacheability */
63 sldi r3,r3,44 /* and prefetch */
72 mtspr SPRN_HIOR,0 /* Clear interrupt prefix */
76 _GLOBAL(__setup_cpu_power4)
79 _GLOBAL(__setup_cpu_be)
80 /* Set large page sizes LP=0: 16MB, LP=1: 64KB */
93 _GLOBAL(__setup_cpu_ppc970)
95 li r11,5 /* clear DOZE and SLEEP */
96 rldimi r0,r11,52,8 /* set NAP and DPM */
108 /* Definitions for the table use to save CPU states */
116 .balign L1_CACHE_BYTES,0
119 .balign L1_CACHE_BYTES,0
122 /* Called in normal context to backup CPU 0 state. This
123 * does not include cache settings. This function is also
124 * called for machine sleep. This does not include the MMU
125 * setup, BATs, etc... but rather the "special" registers
126 * like HID0, HID1, HID4, etc...
128 _GLOBAL(__save_cpu_setup)
129 /* Some CR fields are volatile, we back it up all */
132 /* Get storage ptr */
133 LOADADDR(r5,cpu_state_storage)
135 /* We only deal with 970 for now */
145 1: /* Save HID0,1,4 and 5 */
159 /* Called with no MMU context (typically MSR:IR/DR off) to
160 * restore CPU state as backed up by the previous
161 * function. This does not include cache setting
163 _GLOBAL(__restore_cpu_setup)
164 /* Get storage ptr (FIXME when using anton reloc as we
165 * are running with translation disabled here
167 LOADADDR(r5,cpu_state_storage)
169 /* We only deal with 970 for now */
179 1: /* Before accessing memory, we make sure rm_ci is clear */
182 rldimi r3,r0,40,23 /* clear bit 23 (rm_ci) */
188 /* Clear interrupt prefix */