2005-04-16 15:20:36 -07:00
/ *
2006-03-28 09:28:14 +11:00
* This f i l e c o n t a i n s t h e p o w e r _ s a v e f u n c t i o n f o r 9 7 0 - f a m i l y C P U s .
2005-04-16 15:20:36 -07:00
*
* This p r o g r a m i s f r e e s o f t w a r e ; you can redistribute it and/or
* modify i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e
* as p u b l i s h e d b y t h e F r e e S o f t w a r e F o u n d a t i o n ; either version
* 2 of t h e L i c e n s e , o r ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n .
* /
# include < l i n u x / t h r e a d s . h >
# include < a s m / p r o c e s s o r . h >
# include < a s m / p a g e . h >
# include < a s m / c p u t a b l e . h >
# include < a s m / t h r e a d _ i n f o . h >
# include < a s m / p p c _ a s m . h >
2005-09-09 20:57:26 +02:00
# include < a s m / a s m - o f f s e t s . h >
2005-04-16 15:20:36 -07:00
# undef D E B U G
.text
_ GLOBAL( p o w e r4 _ i d l e )
BEGIN_ F T R _ S E C T I O N
blr
END_ F T R _ S E C T I O N _ I F C L R ( C P U _ F T R _ C A N _ N A P )
/* Now check if user or arch enabled NAP mode */
2006-01-13 14:56:25 +11:00
LOAD_ R E G _ A D D R B A S E ( r3 ,p o w e r s a v e _ n a p )
lwz r4 ,A D D R O F F ( p o w e r s a v e _ n a p ) ( r3 )
2005-04-16 15:20:36 -07:00
cmpwi 0 ,r4 ,0
beqlr
2005-10-01 18:43:42 +10:00
/* Go to NAP now */
[POWERPC] Lazy interrupt disabling for 64-bit machines
This implements a lazy strategy for disabling interrupts. This means
that local_irq_disable() et al. just clear the 'interrupts are
enabled' flag in the paca. If an interrupt comes along, the interrupt
entry code notices that interrupts are supposed to be disabled, and
clears the EE bit in SRR1, clears the 'interrupts are hard-enabled'
flag in the paca, and returns. This means that interrupts only
actually get disabled in the processor when an interrupt comes along.
When interrupts are enabled by local_irq_enable() et al., the code
sets the interrupts-enabled flag in the paca, and then checks whether
interrupts got hard-disabled. If so, it also sets the EE bit in the
MSR to hard-enable the interrupts.
This has the potential to improve performance, and also makes it
easier to make a kernel that can boot on iSeries and on other 64-bit
machines, since this lazy-disable strategy is very similar to the
soft-disable strategy that iSeries already uses.
This version renames paca->proc_enabled to paca->soft_enabled, and
changes a couple of soft-disables in the kexec code to hard-disables,
which should fix the crash that Michael Ellerman saw. This doesn't
yet use a reserved CR field for the soft_enabled and hard_enabled
flags. This applies on top of Stephen Rothwell's patches to make it
possible to build a combined iSeries/other kernel.
Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-10-04 16:47:49 +10:00
mfmsr r7
rldicl r0 ,r7 ,4 8 ,1
rotldi r0 ,r0 ,1 6
mtmsrd r0 ,1 / * h a r d - d i s a b l e i n t e r r u p t s * /
li r0 ,1
stb r0 ,P A C A S O F T I R Q E N ( r13 ) / * w e ' l l h a r d - e n a b l e s h o r t l y * /
stb r0 ,P A C A H A R D I R Q E N ( r13 )
2005-04-16 15:20:36 -07:00
BEGIN_ F T R _ S E C T I O N
DSSALL
sync
END_ F T R _ S E C T I O N _ I F S E T ( C P U _ F T R _ A L T I V E C )
2006-04-18 21:49:11 +10:00
clrrdi r9 ,r1 ,T H R E A D _ S H I F T / * c u r r e n t t h r e a d _ i n f o * /
ld r8 ,T I _ L O C A L _ F L A G S ( r9 ) / * s e t n a p p i n g b i t * /
ori r8 ,r8 ,_ T L F _ N A P P I N G / * s o w h e n w e t a k e a n e x c e p t i o n * /
std r8 ,T I _ L O C A L _ F L A G S ( r9 ) / * i t w i l l r e t u r n t o o u r c a l l e r * /
2006-03-28 09:28:14 +11:00
ori r7 ,r7 ,M S R _ E E
2005-04-16 15:20:36 -07:00
oris r7 ,r7 ,M S R _ P O W @h
2006-04-18 21:49:11 +10:00
1 : sync
2005-04-16 15:20:36 -07:00
isync
mtmsrd r7
isync
2006-04-18 21:49:11 +10:00
b 1 b