]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseCpuLib/Ipf/CpuSleep.c
2 Base Library CPU functions for Itanium
4 Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #include <Library/PalLib.h>
16 #include <Library/BaseLib.h>
19 Places the CPU in a sleep state until an interrupt is received.
21 Places the CPU in a sleep state until an interrupt is received. If interrupts
22 are disabled prior to calling this function, then the CPU will be placed in a
23 sleep state indefinitely.
35 // It is the TPR register that controls if external interrupt would bring processor in LIGHT HALT low-power state
36 // back to normal state. PAL_HALT_LIGHT does not depend on PSR setting.
37 // So here if interrupts are disabled (via PSR.i), TRP.mmi needs to be set to prevent processor being interrupted by external interrupts.
38 // If interrupts are enabled, then just use current TRP setting.
40 if (GetInterruptState ()) {
42 // If interrupts are enabled, then call PAL_HALT_LIGHT with the current TPR setting.
44 PalCall (PAL_HALT_LIGHT
, 0, 0, 0);
47 // If interrupts are disabled on entry, then mask all interrupts in TPR before calling PAL_HALT_LIGHT.
55 // Set TPR.mmi to mask all external interrupts
57 AsmWriteTpr (BIT16
| Tpr
);
59 PalCall (PAL_HALT_LIGHT
, 0, 0, 0);