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 <asm/processor.h>
14 #include <asm/cputable.h>
15 #include <asm/ppc_asm.h>
16 #include <asm/asm-offsets.h>
17 #include <asm/cache.h>
19 _GLOBAL(__970_cpu_preinit)
21 * Do nothing if not running in HV mode
28 * Deal only with PPC970 and PPC970FX.
40 /* Make sure HID4:rm_ci is off before MMU is turned off, that large
41 * pages are enabled with HID4:61 and clear HID5:DCBZ_size and
46 rldimi r3,r0,40,23 /* clear bit 23 (rm_ci) */
47 rldimi r3,r0,2,61 /* clear bit 61 (lg_pg_en) */
53 rldimi r3,r0,6,56 /* clear bits 56 & 57 (DCBZ*) */
59 /* Setup some basic HID1 features */
61 li r3,0x1200 /* enable i-fetch cacheability */
62 sldi r3,r3,44 /* and prefetch */
71 mtspr SPRN_HIOR,0 /* Clear interrupt prefix */
75 _GLOBAL(__setup_cpu_ppc970)
77 li r11,5 /* clear DOZE and SLEEP */
78 rldimi r0,r11,52,8 /* set NAP and DPM */
90 /* Definitions for the table use to save CPU states */
98 .balign L1_CACHE_BYTES,0
101 .balign L1_CACHE_BYTES,0
104 /* Called in normal context to backup CPU 0 state. This
105 * does not include cache settings. This function is also
106 * called for machine sleep. This does not include the MMU
107 * setup, BATs, etc... but rather the "special" registers
108 * like HID0, HID1, HID4, etc...
110 _GLOBAL(__save_cpu_setup)
111 /* Some CR fields are volatile, we back it up all */
114 /* Get storage ptr */
115 LOAD_REG_IMMEDIATE(r5,cpu_state_storage)
117 /* We only deal with 970 for now */
127 1: /* skip if not running in HV mode */
132 /* Save HID0,1,4 and 5 */
146 /* Called with no MMU context (typically MSR:IR/DR off) to
147 * restore CPU state as backed up by the previous
148 * function. This does not include cache setting
150 _GLOBAL(__restore_cpu_setup)
151 /* Get storage ptr (FIXME when using anton reloc as we
152 * are running with translation disabled here
154 LOAD_REG_IMMEDIATE(r5,cpu_state_storage)
156 /* We only deal with 970 for now */
166 1: /* skip if not running in HV mode */
171 /* Before accessing memory, we make sure rm_ci is clear */
174 rldimi r3,r0,40,23 /* clear bit 23 (rm_ci) */
180 /* Clear interrupt prefix */