Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Paul Mackerras | ff2e6d7 | 2006-03-28 09:28:14 +1100 | [diff] [blame^] | 2 | * This file contains the power_save function for 970-family CPUs. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | * |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License |
| 6 | * as published by the Free Software Foundation; either version |
| 7 | * 2 of the License, or (at your option) any later version. |
| 8 | */ |
| 9 | |
| 10 | #include <linux/config.h> |
| 11 | #include <linux/threads.h> |
| 12 | #include <asm/processor.h> |
| 13 | #include <asm/page.h> |
| 14 | #include <asm/cputable.h> |
| 15 | #include <asm/thread_info.h> |
| 16 | #include <asm/ppc_asm.h> |
Sam Ravnborg | 0013a85 | 2005-09-09 20:57:26 +0200 | [diff] [blame] | 17 | #include <asm/asm-offsets.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | |
| 19 | #undef DEBUG |
| 20 | |
| 21 | .text |
| 22 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | _GLOBAL(power4_idle) |
| 24 | BEGIN_FTR_SECTION |
| 25 | blr |
| 26 | END_FTR_SECTION_IFCLR(CPU_FTR_CAN_NAP) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | /* Now check if user or arch enabled NAP mode */ |
David Gibson | e58c349 | 2006-01-13 14:56:25 +1100 | [diff] [blame] | 28 | LOAD_REG_ADDRBASE(r3,powersave_nap) |
| 29 | lwz r4,ADDROFF(powersave_nap)(r3) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 30 | cmpwi 0,r4,0 |
| 31 | beqlr |
| 32 | |
Stephen Rothwell | dc1c1ca | 2005-10-01 18:43:42 +1000 | [diff] [blame] | 33 | /* Go to NAP now */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | BEGIN_FTR_SECTION |
| 35 | DSSALL |
| 36 | sync |
| 37 | END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC) |
Paul Mackerras | ff2e6d7 | 2006-03-28 09:28:14 +1100 | [diff] [blame^] | 38 | mfmsr r7 |
| 39 | ori r7,r7,MSR_EE |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | oris r7,r7,MSR_POW@h |
| 41 | sync |
| 42 | isync |
| 43 | mtmsrd r7 |
| 44 | isync |
| 45 | sync |
| 46 | blr |