]> git.proxmox.com Git - mirror_edk2.git/blame - EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Cpu.c
Add in the 1st version of ECP.
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Library / EdkIIGlueLib / Library / BaseLib / Cpu.c
CommitLineData
3eb9473e 1/*++\r
2\r
3Copyright (c) 2004 - 2006, Intel Corporation \r
4All rights reserved. This program and the accompanying materials \r
5are licensed and made available under the terms and conditions of the BSD License \r
6which accompanies this distribution. The full text of the license may be found at \r
7http://opensource.org/licenses/bsd-license.php \r
8 \r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
11\r
12\r
13Module Name:\r
14\r
15 Cpu.c\r
16 \r
17Abstract: \r
18\r
19 Base Library CPU Functions for all architectures.\r
20\r
21--*/\r
22\r
23#include "BaseLibInternal.h"\r
24\r
25/**\r
26 Disables CPU interrupts and returns the interrupt state prior to the disable\r
27 operation.\r
28\r
29 Disables CPU interrupts and returns the interrupt state prior to the disable\r
30 operation.\r
31\r
32 @retval TRUE CPU interrupts were enabled on entry to this call.\r
33 @retval FALSE CPU interrupts were disabled on entry to this call.\r
34\r
35**/\r
36BOOLEAN\r
37EFIAPI\r
38SaveAndDisableInterrupts (\r
39 VOID\r
40 )\r
41{\r
42 BOOLEAN InterruptState;\r
43\r
44 InterruptState = GetInterruptState ();\r
45 DisableInterrupts ();\r
46 return InterruptState;\r
47}\r
48\r
49/**\r
50 Set the current CPU interrupt state.\r
51\r
52 Sets the current CPU interrupt state to the state specified by\r
53 InterruptState. If InterruptState is TRUE, then interrupts are enabled. If\r
54 InterruptState is FALSE, then interrupts are disabled. InterruptState is\r
55 returned.\r
56\r
57 @param InterruptState TRUE if interrupts should enabled. FALSE if\r
58 interrupts should be disabled.\r
59\r
60 @return InterruptState\r
61\r
62**/\r
63BOOLEAN\r
64EFIAPI\r
65SetInterruptState (\r
66 IN BOOLEAN InterruptState\r
67 )\r
68{\r
69 if (InterruptState) {\r
70 EnableInterrupts ();\r
71 } else {\r
72 DisableInterrupts ();\r
73 }\r
74 return InterruptState;\r
75}\r