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(__cpu_preinit_ppc970)
20 /* Do nothing if not running in HV mode */
25 /* Make sure HID4:rm_ci is off before MMU is turned off, that large
26 * pages are enabled with HID4:61 and clear HID5:DCBZ_size and
31 rldimi r3,r0,40,23 /* clear bit 23 (rm_ci) */
32 rldimi r3,r0,2,61 /* clear bit 61 (lg_pg_en) */
38 rldimi r3,r0,6,56 /* clear bits 56 & 57 (DCBZ*) */
44 /* Setup some basic HID1 features */
46 li r3,0x1200 /* enable i-fetch cacheability */
47 sldi r3,r3,44 /* and prefetch */
56 mtspr SPRN_HIOR,0 /* Clear interrupt prefix */
60 /* Definitions for the table use to save CPU states */
68 .balign L1_CACHE_BYTES,0
71 .balign L1_CACHE_BYTES,0
75 _GLOBAL(__setup_cpu_ppc970)
76 /* Do nothing if not running in HV mode */
82 li r11,5 /* clear DOZE and SLEEP */
83 rldimi r0,r11,52,8 /* set NAP and DPM */
85 rldimi r0,r11,32,31 /* clear EN_ATTN */
86 b load_hids /* Jump to shared code */
89 _GLOBAL(__setup_cpu_ppc970MP)
90 /* Do nothing if not running in HV mode */
96 li r11,0x15 /* clear DOZE and SLEEP */
97 rldimi r0,r11,52,6 /* set DEEPNAP, NAP and DPM */
99 rldimi r0,r11,32,31 /* clear EN_ATTN */
112 /* Try to set LPES = 01 in HID4 */
114 clrldi r0,r0,1 /* clear LPES0 */
115 ori r0,r0,HID4_LPES1 /* set LPES1 */
120 /* Save away cpu state */
121 LOAD_REG_ADDR(r5,cpu_state_storage)
123 /* Save HID0,1,4 and 5 */
133 /* See if we successfully set LPES1 to 1; if not we are in Apple mode */
134 andi. r4,r4,HID4_LPES1
138 /* Disable CPU_FTR_HVMODE and exit, since we don't have HV mode */
139 ld r5,CPU_SPEC_FEATURES(r4)
140 LOAD_REG_IMMEDIATE(r6,CPU_FTR_HVMODE)
142 std r5,CPU_SPEC_FEATURES(r4)
145 /* Called with no MMU context (typically MSR:IR/DR off) to
146 * restore CPU state as backed up by the previous
147 * function. This does not include cache setting
149 _GLOBAL(__restore_cpu_ppc970)
150 /* Do nothing if not running in HV mode */
155 LOAD_REG_ADDR(r5,cpu_state_storage)
156 /* Before accessing memory, we make sure rm_ci is clear */
159 rldimi r3,r0,40,23 /* clear bit 23 (rm_ci) */
165 /* Clear interrupt prefix */