Path: blob/master/arch/powerpc/kernel/idle_book3e.S
10818 views
/*1* Copyright 2010 IBM Corp, Benjamin Herrenschmidt <[email protected]>2*3* Generic idle routine for Book3E processors4*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 <linux/threads.h>12#include <asm/reg.h>13#include <asm/ppc_asm.h>14#include <asm/asm-offsets.h>15#include <asm/ppc-opcode.h>16#include <asm/processor.h>17#include <asm/thread_info.h>1819/* 64-bit version only for now */20#ifdef CONFIG_PPC642122_GLOBAL(book3e_idle)23/* Save LR for later */24mflr r025std r0,16(r1)2627/* Hard disable interrupts */28wrteei 02930/* Now check if an interrupt came in while we were soft disabled31* since we may otherwise lose it (doorbells etc...). We know32* that since PACAHARDIRQEN will have been cleared in that case.33*/34lbz r3,PACAHARDIRQEN(r13)35cmpwi cr0,r3,036beqlr3738/* Now we are going to mark ourselves as soft and hard enables in39* order to be able to take interrupts while asleep. We inform lockdep40* of that. We don't actually turn interrupts on just yet tho.41*/42#ifdef CONFIG_TRACE_IRQFLAGS43stdu r1,-128(r1)44bl .trace_hardirqs_on45#endif46li r0,147stb r0,PACASOFTIRQEN(r13)48stb r0,PACAHARDIRQEN(r13)4950/* Interrupts will make use return to LR, so get something we want51* in there52*/53bl 1f5455/* Hard disable interrupts again */56wrteei 05758/* Mark them off again in the PACA as well */59li r0,060stb r0,PACASOFTIRQEN(r13)61stb r0,PACAHARDIRQEN(r13)6263/* Tell lockdep about it */64#ifdef CONFIG_TRACE_IRQFLAGS65bl .trace_hardirqs_off66addi r1,r1,12867#endif68ld r0,16(r1)69mtlr r070blr71721: /* Let's set the _TLF_NAPPING flag so interrupts make us return73* to the right spot74*/75clrrdi r11,r1,THREAD_SHIFT76ld r10,TI_LOCAL_FLAGS(r11)77ori r10,r10,_TLF_NAPPING78std r10,TI_LOCAL_FLAGS(r11)7980/* We can now re-enable hard interrupts and go to sleep */81wrteei 1821: PPC_WAIT(0)83b 1b8485#endif /* CONFIG_PPC64 */868788