Path: blob/master/arch/powerpc/kernel/cpu_setup_a2.S
10817 views
/*1* A2 specific assembly support code2*3* Copyright 2009 Ben Herrenschmidt, IBM Corp.4*5* This program is free software; you can redistribute it and/or6* modify it under the terms of the GNU General Public License7* as published by the Free Software Foundation; either version8* 2 of the License, or (at your option) any later version.9*/1011#include <asm/asm-offsets.h>12#include <asm/ppc_asm.h>13#include <asm/ppc-opcode.h>14#include <asm/processor.h>15#include <asm/reg_a2.h>16#include <asm/reg.h>17#include <asm/thread_info.h>1819/*20* Disable thdid and class fields in ERATs to bump PID to full 14 bits capacity.21* This also prevents external LPID accesses but that isn't a problem when not a22* guest. Under PV, this setting will be ignored and MMUCR will return the right23* number of PID bits we can use.24*/25#define MMUCR1_EXTEND_PID \26(MMUCR1_ICTID | MMUCR1_ITTID | MMUCR1_DCTID | \27MMUCR1_DTTID | MMUCR1_DCCD)2829/*30* Use extended PIDs if enabled.31* Don't clear the ERATs on context sync events and enable I & D LRU.32* Enable ERAT back invalidate when tlbwe overwrites an entry.33*/34#define INITIAL_MMUCR1 \35(MMUCR1_EXTEND_PID | MMUCR1_CSINV_NEVER | MMUCR1_IRRE | \36MMUCR1_DRRE | MMUCR1_TLBWE_BINV)3738_GLOBAL(__setup_cpu_a2)39/* Some of these are actually thread local and some are40* core local but doing it always won't hurt41*/4243#ifdef CONFIG_PPC_WSP_COPRO44/* Make sure ACOP starts out as zero */45li r3,046mtspr SPRN_ACOP,r34748/* Enable icswx instruction */49mfspr r3,SPRN_A2_CCR250ori r3,r3,A2_CCR2_ENABLE_ICSWX51mtspr SPRN_A2_CCR2,r35253/* Unmask all CTs in HACOP */54li r3,-155mtspr SPRN_HACOP,r356#endif /* CONFIG_PPC_WSP_COPRO */5758/* Enable doorbell */59mfspr r3,SPRN_A2_CCR260oris r3,r3,A2_CCR2_ENABLE_PC@h61mtspr SPRN_A2_CCR2,r362isync6364/* Setup CCR0 to disable power saving for now as it's busted65* in the current implementations. Setup CCR1 to wake on66* interrupts normally (we write the default value but who67* knows what FW may have clobbered...)68*/69li r3,070mtspr SPRN_A2_CCR0, r371LOAD_REG_IMMEDIATE(r3,0x0f0f0f0f)72mtspr SPRN_A2_CCR1, r37374/* Initialise MMUCR1 */75lis r3,INITIAL_MMUCR1@h76ori r3,r3,INITIAL_MMUCR1@l77mtspr SPRN_MMUCR1,r37879/* Set MMUCR2 to enable 4K, 64K, 1M, 16M and 1G pages */80LOAD_REG_IMMEDIATE(r3, 0x000a7531)81mtspr SPRN_MMUCR2,r38283/* Set MMUCR3 to write all thids bit to the TLB */84LOAD_REG_IMMEDIATE(r3, 0x0000000f)85mtspr SPRN_MMUCR3,r38687/* Don't do ERAT stuff if running guest mode */88mfmsr r389andis. r0,r3,MSR_GS@h90bne 1f9192/* Now set the I-ERAT watermark to 15 */93lis r4,(MMUCR0_TLBSEL_I|MMUCR0_ECL)@h94mtspr SPRN_MMUCR0, r495li r4,A2_IERAT_SIZE-196PPC_ERATWE(r4,r4,3)9798/* Now set the D-ERAT watermark to 31 */99lis r4,(MMUCR0_TLBSEL_D|MMUCR0_ECL)@h100mtspr SPRN_MMUCR0, r4101li r4,A2_DERAT_SIZE-1102PPC_ERATWE(r4,r4,3)103104/* And invalidate the beast just in case. That won't get rid of105* a bolted entry though it will be in LRU and so will go away eventually106* but let's not bother for now107*/108PPC_ERATILX(0,0,0)1091:110blr111112_GLOBAL(__restore_cpu_a2)113b __setup_cpu_a2114115116