1 /**
2   This protocol is used to report and control what BIOS is mapped to the
3   BIOS address space anchored at 4GB boundary.
4 
5   This protocol is EFI compatible.
6 
7   E.G. For current generation ICH, the 4GB-16MB to 4GB range can be mapped
8   to PCI, SPI, or FWH.
9 
10 Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
11 
12   This program and the accompanying materials are licensed and made available under
13   the terms and conditions of the BSD License that accompanies this distribution.
14   The full text of the license may be found at
15   http://opensource.org/licenses/bsd-license.php.
16 
17   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
18   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19 
20 
21 **/
22 
23 
24 #ifndef _EFI_ACTIVE_BIOS_PROTOCOL_H_
25 #define _EFI_ACTIVE_BIOS_PROTOCOL_H_
26 
27 //
28 // Define the  protocol GUID
29 //
30 #define EFI_ACTIVE_BIOS_PROTOCOL_GUID  \
31   { 0xebbe2d1b, 0x1647, 0x4bda, {0xab, 0x9a, 0x78, 0x63, 0xe3, 0x96, 0xd4, 0x1a} }
32 
33 typedef struct _EFI_ACTIVE_BIOS_PROTOCOL EFI_ACTIVE_BIOS_PROTOCOL;
34 
35 //
36 // Protocol definitions
37 //
38 typedef enum {
39   ActiveBiosStateSpi,
40   ActiveBiosStatePci,
41   ActiveBiosStateLpc,
42   ActiveBiosStateMax
43 } EFI_ACTIVE_BIOS_STATE;
44 
45 typedef
46 EFI_STATUS
47 (EFIAPI *EFI_ACTIVE_BIOS_SET_ACTIVE_BIOS_STATE) (
48   IN EFI_ACTIVE_BIOS_PROTOCOL     *This,
49   IN EFI_ACTIVE_BIOS_STATE        DesiredState,
50   IN UINTN                        Key
51   );
52 /*++
53 
54 Routine Description:
55 
56   Change the current active BIOS settings to the requested state.
57   The caller is responsible for requesting a supported state from
58   the EFI_ACTIVE_BIOS_STATE selections.
59 
60   This will fail if someone has locked the interface and the correct key is
61   not provided.
62 
63 Arguments:
64 
65   This                    Pointer to the EFI_ACTIVE_BIOS_PROTOCOL instance.
66   DesiredState            The requested state to configure the system for.
67   Key                     If the interface is locked, Key must be the Key
68                           returned from the LockState function call.
69 
70 Returns:
71 
72   EFI_SUCCESS             Command succeed.
73   EFI_ACCESS_DENIED       The interface is currently locked.
74   EFI_DEVICE_ERROR        Device error, command aborts abnormally.
75 
76 --*/
77 
78 typedef
79 EFI_STATUS
80 (EFIAPI *EFI_ACTIVE_BIOS_LOCK_ACTIVE_BIOS_STATE) (
81   IN     EFI_ACTIVE_BIOS_PROTOCOL   *This,
82   IN     BOOLEAN                    Lock,
83   IN OUT UINTN                      *Key
84   );
85 /*++
86 
87 Routine Description:
88 
89   Lock the current active BIOS state from further changes.  This allows a
90   caller to implement a critical section.  This is optionally supported
91   functionality.  Size conscious implementations may choose to require
92   callers cooperate without support from this protocol.
93 
94 Arguments:
95 
96   This                    Pointer to the EFI_ACTIVE_BIOS_PROTOCOL instance.
97   Lock                    TRUE to lock the current state, FALSE to unlock.
98   Key                     If Lock is TRUE, then a key will be returned.  If
99                           Lock is FALSE, the key returned from the prior call
100                           to lock the protocol must be provided to unlock the
101                           protocol.  The value of Key is undefined except that it
102                           will never be 0.
103 
104 Returns:
105 
106   EFI_SUCCESS             Command succeed.
107   EFI_UNSUPPORTED         The function is not supported.
108   EFI_ACCESS_DENIED       The interface is currently locked.
109   EFI_DEVICE_ERROR        Device error, command aborts abnormally.
110 
111 --*/
112 
113 //
114 // Protocol definition
115 //
116 // Note that some functions are optional.  This means that they may be NULL.
117 // Caller is required to verify that an optional function is defined by checking
118 // that the value is not NULL.
119 //
120 struct _EFI_ACTIVE_BIOS_PROTOCOL {
121   EFI_ACTIVE_BIOS_STATE                       State;
122   EFI_ACTIVE_BIOS_SET_ACTIVE_BIOS_STATE       SetState;
123   EFI_ACTIVE_BIOS_LOCK_ACTIVE_BIOS_STATE      LockState;
124 };
125 
126 //
127 // Extern the GUID for protocol users.
128 //
129 extern EFI_GUID gEfiActiveBiosProtocolGuid;
130 
131 #endif
132