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/ppc_asm.h>
16 #include <asm/cputable.h>
17 #include <asm/asm-offsets.h>
18 #include <asm/cache.h>
20 _GLOBAL(__970_cpu_preinit)
22 * Deal only with PPC970 and PPC970FX.
28 cror 4*cr0+eq,4*cr0+eq,4*cr1+eq
31 /* Make sure HID4:rm_ci is off before MMU is turned off, that large
32 * pages are enabled with HID4:61 and clear HID5:DCBZ_size and
37 rldimi r11,r0,40,23 /* clear bit 23 (rm_ci) */
38 rldimi r11,r0,2,61 /* clear bit 61 (lg_pg_en) */
44 rldimi r11,r0,6,56 /* clear bits 56 & 57 (DCBZ*) */
50 /* Setup some basic HID1 features */
52 li r11,0x1200 /* enable i-fetch cacheability */
53 sldi r11,r11,44 /* and prefetch */
62 mtspr SPRN_HIOR,0 /* Clear interrupt prefix */
66 _GLOBAL(__setup_cpu_ppc970)
68 li r11,5 /* clear DOZE and SLEEP */
69 rldimi r0,r11,52,8 /* set NAP and DPM */
81 /* Definitions for the table use to save CPU states */
89 .balign L1_CACHE_BYTES
92 .balign L1_CACHE_BYTES,0
95 /* Called in normal context to backup CPU 0 state. This
96 * does not include cache settings. This function is also
97 * called for machine sleep. This does not include the MMU
98 * setup, BATs, etc... but rather the "special" registers
99 * like HID0, HID1, HID4, etc...
101 _GLOBAL(__save_cpu_setup)
102 /* Some CR fields are volatile, we back it up all */
105 /* Get storage ptr */
106 lis r5,cpu_state_storage@h
107 ori r5,r5,cpu_state_storage@l
109 /* We only deal with 970 for now */
114 cror 4*cr0+eq,4*cr0+eq,4*cr1+eq
117 /* Save HID0,1,4 and 5 */
131 /* Called with no MMU context (typically MSR:IR/DR off) to
132 * restore CPU state as backed up by the previous
133 * function. This does not include cache setting
135 _GLOBAL(__restore_cpu_setup)
136 /* Some CR fields are volatile, we back it up all */
139 /* Get storage ptr */
140 lis r5,(cpu_state_storage-KERNELBASE)@h
141 ori r5,r5,cpu_state_storage@l
143 /* We only deal with 970 for now */
148 cror 4*cr0+eq,4*cr0+eq,4*cr1+eq
151 /* Clear interrupt prefix */