]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseLib/Cpu.c
1. Removed #ifndef to enable Capsule architecture protocol on IPF.
[mirror_edk2.git] / MdePkg / Library / BaseLib / Cpu.c
1 /** @file
2 Base Library CPU Functions for all architectures.
3
4 Copyright (c) 2006, Intel Corporation<BR>
5 All rights reserved. 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
9
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.
12
13 Module Name: Cpu.c
14
15 **/
16
17 /**
18 Disables CPU interrupts and returns the interrupt state prior to the disable
19 operation.
20
21 Disables CPU interrupts and returns the interrupt state prior to the disable
22 operation.
23
24 @retval TRUE CPU interrupts were enabled on entry to this call.
25 @retval FALSE CPU interrupts were disabled on entry to this call.
26
27 **/
28 BOOLEAN
29 EFIAPI
30 SaveAndDisableInterrupts (
31 VOID
32 )
33 {
34 BOOLEAN InterruptState;
35
36 InterruptState = GetInterruptState ();
37 DisableInterrupts ();
38 return InterruptState;
39 }
40
41 /**
42 Set the current CPU interrupt state.
43
44 Sets the current CPU interrupt state to the state specified by
45 InterruptState. If InterruptState is TRUE, then interrupts are enabled. If
46 InterruptState is FALSE, then interrupts are disabled. InterruptState is
47 returned.
48
49 @param InterruptState TRUE if interrupts should enabled. FALSE if
50 interrupts should be disabled.
51
52 @return InterruptState
53
54 **/
55 BOOLEAN
56 EFIAPI
57 SetInterruptState (
58 IN BOOLEAN InterruptState
59 )
60 {
61 if (InterruptState) {
62 EnableInterrupts ();
63 } else {
64 DisableInterrupts ();
65 }
66 return InterruptState;
67 }