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/ppc_asm.h>
15 #include <asm/cputable.h>
16 #include <asm/asm-offsets.h>
17 #include <asm/cache.h>
19 _GLOBAL(__970_cpu_preinit)
21 * Deal only with PPC970 and PPC970FX.
27 cror 4*cr0+eq,4*cr0+eq,4*cr1+eq
30 /* Make sure HID4:rm_ci is off before MMU is turned off, that large
31 * pages are enabled with HID4:61 and clear HID5:DCBZ_size and
36 rldimi r11,r0,40,23 /* clear bit 23 (rm_ci) */
37 rldimi r11,r0,2,61 /* clear bit 61 (lg_pg_en) */
43 rldimi r11,r0,6,56 /* clear bits 56 & 57 (DCBZ*) */
49 /* Setup some basic HID1 features */
51 li r11,0x1200 /* enable i-fetch cacheability */
52 sldi r11,r11,44 /* and prefetch */
61 mtspr SPRN_HIOR,0 /* Clear interrupt prefix */
65 _GLOBAL(__setup_cpu_ppc970)
67 li r11,5 /* clear DOZE and SLEEP */
68 rldimi r0,r11,52,8 /* set NAP and DPM */
80 /* Definitions for the table use to save CPU states */
88 .balign L1_CACHE_BYTES
91 .balign L1_CACHE_BYTES,0
94 /* Called in normal context to backup CPU 0 state. This
95 * does not include cache settings. This function is also
96 * called for machine sleep. This does not include the MMU
97 * setup, BATs, etc... but rather the "special" registers
98 * like HID0, HID1, HID4, etc...
100 _GLOBAL(__save_cpu_setup)
101 /* Some CR fields are volatile, we back it up all */
104 /* Get storage ptr */
105 lis r5,cpu_state_storage@h
106 ori r5,r5,cpu_state_storage@l
108 /* We only deal with 970 for now */
113 cror 4*cr0+eq,4*cr0+eq,4*cr1+eq
116 /* Save HID0,1,4 and 5 */
130 /* Called with no MMU context (typically MSR:IR/DR off) to
131 * restore CPU state as backed up by the previous
132 * function. This does not include cache setting
134 _GLOBAL(__restore_cpu_setup)
135 /* Some CR fields are volatile, we back it up all */
138 /* Get storage ptr */
139 lis r5,(cpu_state_storage-KERNELBASE)@h
140 ori r5,r5,cpu_state_storage@l
142 /* We only deal with 970 for now */
147 cror 4*cr0+eq,4*cr0+eq,4*cr1+eq
150 /* Clear interrupt prefix */