| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * This file contains the power_save function for 6xx & 7xxx CPUs |
|---|
| 3 | 4 | * rewritten in assembler |
|---|
| .. | .. |
|---|
| 6 | 7 | * it will have PLL 1 set to low speed mode (used during NAP/DOZE). |
|---|
| 7 | 8 | * if this is not the case some additional changes will have to |
|---|
| 8 | 9 | * be done to check a runtime var (a bit like powersave-nap) |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is free software; you can redistribute it and/or |
|---|
| 11 | | - * modify it under the terms of the GNU General Public License |
|---|
| 12 | | - * as published by the Free Software Foundation; either version |
|---|
| 13 | | - * 2 of the License, or (at your option) any later version. |
|---|
| 14 | 10 | */ |
|---|
| 15 | 11 | |
|---|
| 16 | 12 | #include <linux/threads.h> |
|---|
| .. | .. |
|---|
| 133 | 129 | END_FTR_SECTION_IFCLR(CPU_FTR_NO_DPM) |
|---|
| 134 | 130 | mtspr SPRN_HID0,r4 |
|---|
| 135 | 131 | BEGIN_FTR_SECTION |
|---|
| 136 | | - DSSALL |
|---|
| 132 | + PPC_DSSALL |
|---|
| 137 | 133 | sync |
|---|
| 138 | 134 | END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC) |
|---|
| 139 | | - CURRENT_THREAD_INFO(r9, r1) |
|---|
| 140 | | - lwz r8,TI_LOCAL_FLAGS(r9) /* set napping bit */ |
|---|
| 135 | + lwz r8,TI_LOCAL_FLAGS(r2) /* set napping bit */ |
|---|
| 141 | 136 | ori r8,r8,_TLF_NAPPING /* so when we take an exception */ |
|---|
| 142 | | - stw r8,TI_LOCAL_FLAGS(r9) /* it will return to our caller */ |
|---|
| 137 | + stw r8,TI_LOCAL_FLAGS(r2) /* it will return to our caller */ |
|---|
| 143 | 138 | mfmsr r7 |
|---|
| 144 | 139 | ori r7,r7,MSR_EE |
|---|
| 145 | 140 | oris r7,r7,MSR_POW@h |
|---|
| .. | .. |
|---|
| 159 | 154 | stw r9,_NIP(r11) /* make it do a blr */ |
|---|
| 160 | 155 | |
|---|
| 161 | 156 | #ifdef CONFIG_SMP |
|---|
| 162 | | - CURRENT_THREAD_INFO(r12, r11) |
|---|
| 163 | | - lwz r11,TI_CPU(r12) /* get cpu number * 4 */ |
|---|
| 157 | + lwz r11,TASK_CPU(r2) /* get cpu number * 4 */ |
|---|
| 164 | 158 | slwi r11,r11,2 |
|---|
| 165 | 159 | #else |
|---|
| 166 | 160 | li r11,0 |
|---|
| .. | .. |
|---|
| 172 | 166 | mfspr r9,SPRN_HID0 |
|---|
| 173 | 167 | andis. r9,r9,HID0_NAP@h |
|---|
| 174 | 168 | beq 1f |
|---|
| 169 | +#ifdef CONFIG_VMAP_STACK |
|---|
| 170 | + addis r9, r11, nap_save_msscr0@ha |
|---|
| 171 | +#else |
|---|
| 175 | 172 | addis r9,r11,(nap_save_msscr0-KERNELBASE)@ha |
|---|
| 173 | +#endif |
|---|
| 176 | 174 | lwz r9,nap_save_msscr0@l(r9) |
|---|
| 177 | 175 | mtspr SPRN_MSSCR0, r9 |
|---|
| 178 | 176 | sync |
|---|
| .. | .. |
|---|
| 180 | 178 | 1: |
|---|
| 181 | 179 | END_FTR_SECTION_IFSET(CPU_FTR_NAP_DISABLE_L2_PR) |
|---|
| 182 | 180 | BEGIN_FTR_SECTION |
|---|
| 181 | +#ifdef CONFIG_VMAP_STACK |
|---|
| 182 | + addis r9, r11, nap_save_hid1@ha |
|---|
| 183 | +#else |
|---|
| 183 | 184 | addis r9,r11,(nap_save_hid1-KERNELBASE)@ha |
|---|
| 185 | +#endif |
|---|
| 184 | 186 | lwz r9,nap_save_hid1@l(r9) |
|---|
| 185 | 187 | mtspr SPRN_HID1, r9 |
|---|
| 186 | 188 | END_FTR_SECTION_IFSET(CPU_FTR_DUAL_PLL_750FX) |
|---|
| 187 | 189 | b transfer_to_handler_cont |
|---|
| 190 | +_ASM_NOKPROBE_SYMBOL(power_save_ppc32_restore) |
|---|
| 188 | 191 | |
|---|
| 189 | 192 | .data |
|---|
| 190 | 193 | |
|---|