Path: blob/master/arch/powerpc/kernel/cpu_setup_ppc970.S
10817 views
/*1* This file contains low level CPU setup functions.2* Copyright (C) 2003 Benjamin Herrenschmidt ([email protected])3*4* This program is free software; you can redistribute it and/or5* modify it under the terms of the GNU General Public License6* as published by the Free Software Foundation; either version7* 2 of the License, or (at your option) any later version.8*9*/1011#include <asm/processor.h>12#include <asm/page.h>13#include <asm/cputable.h>14#include <asm/ppc_asm.h>15#include <asm/asm-offsets.h>16#include <asm/cache.h>1718_GLOBAL(__cpu_preinit_ppc970)19/* Do nothing if not running in HV mode */20mfmsr r021rldicl. r0,r0,4,6322beqlr2324/* Make sure HID4:rm_ci is off before MMU is turned off, that large25* pages are enabled with HID4:61 and clear HID5:DCBZ_size and26* HID5:DCBZ32_ill27*/28li r0,029mfspr r3,SPRN_HID430rldimi r3,r0,40,23 /* clear bit 23 (rm_ci) */31rldimi r3,r0,2,61 /* clear bit 61 (lg_pg_en) */32sync33mtspr SPRN_HID4,r334isync35sync36mfspr r3,SPRN_HID537rldimi r3,r0,6,56 /* clear bits 56 & 57 (DCBZ*) */38sync39mtspr SPRN_HID5,r340isync41sync4243/* Setup some basic HID1 features */44mfspr r0,SPRN_HID145li r3,0x1200 /* enable i-fetch cacheability */46sldi r3,r3,44 /* and prefetch */47or r0,r0,r348mtspr SPRN_HID1,r049mtspr SPRN_HID1,r050isync5152/* Clear HIOR */53li r0,054sync55mtspr SPRN_HIOR,0 /* Clear interrupt prefix */56isync57blr5859/* Definitions for the table use to save CPU states */60#define CS_HID0 061#define CS_HID1 862#define CS_HID4 1663#define CS_HID5 2464#define CS_SIZE 326566.data67.balign L1_CACHE_BYTES,068cpu_state_storage:69.space CS_SIZE70.balign L1_CACHE_BYTES,071.text727374_GLOBAL(__setup_cpu_ppc970)75/* Do nothing if not running in HV mode */76mfmsr r077rldicl. r0,r0,4,6378beqlr7980mfspr r0,SPRN_HID081li r11,5 /* clear DOZE and SLEEP */82rldimi r0,r11,52,8 /* set NAP and DPM */83li r11,084rldimi r0,r11,32,31 /* clear EN_ATTN */85b load_hids /* Jump to shared code */868788_GLOBAL(__setup_cpu_ppc970MP)89/* Do nothing if not running in HV mode */90mfmsr r091rldicl. r0,r0,4,6392beqlr9394mfspr r0,SPRN_HID095li r11,0x15 /* clear DOZE and SLEEP */96rldimi r0,r11,52,6 /* set DEEPNAP, NAP and DPM */97li r11,098rldimi r0,r11,32,31 /* clear EN_ATTN */99100load_hids:101mtspr SPRN_HID0,r0102mfspr r0,SPRN_HID0103mfspr r0,SPRN_HID0104mfspr r0,SPRN_HID0105mfspr r0,SPRN_HID0106mfspr r0,SPRN_HID0107mfspr r0,SPRN_HID0108sync109isync110111/* Save away cpu state */112LOAD_REG_ADDR(r5,cpu_state_storage)113114/* Save HID0,1,4 and 5 */115mfspr r3,SPRN_HID0116std r3,CS_HID0(r5)117mfspr r3,SPRN_HID1118std r3,CS_HID1(r5)119mfspr r3,SPRN_HID4120std r3,CS_HID4(r5)121mfspr r3,SPRN_HID5122std r3,CS_HID5(r5)123124blr125126/* Called with no MMU context (typically MSR:IR/DR off) to127* restore CPU state as backed up by the previous128* function. This does not include cache setting129*/130_GLOBAL(__restore_cpu_ppc970)131/* Do nothing if not running in HV mode */132mfmsr r0133rldicl. r0,r0,4,63134beqlr135136LOAD_REG_ADDR(r5,cpu_state_storage)137/* Before accessing memory, we make sure rm_ci is clear */138li r0,0139mfspr r3,SPRN_HID4140rldimi r3,r0,40,23 /* clear bit 23 (rm_ci) */141sync142mtspr SPRN_HID4,r3143isync144sync145146/* Clear interrupt prefix */147li r0,0148sync149mtspr SPRN_HIOR,0150isync151152/* Restore HID0 */153ld r3,CS_HID0(r5)154sync155isync156mtspr SPRN_HID0,r3157mfspr r3,SPRN_HID0158mfspr r3,SPRN_HID0159mfspr r3,SPRN_HID0160mfspr r3,SPRN_HID0161mfspr r3,SPRN_HID0162mfspr r3,SPRN_HID0163sync164isync165166/* Restore HID1 */167ld r3,CS_HID1(r5)168sync169isync170mtspr SPRN_HID1,r3171mtspr SPRN_HID1,r3172sync173isync174175/* Restore HID4 */176ld r3,CS_HID4(r5)177sync178isync179mtspr SPRN_HID4,r3180sync181isync182183/* Restore HID5 */184ld r3,CS_HID5(r5)185sync186isync187mtspr SPRN_HID5,r3188sync189isync190blr191192193194