1fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang/** @file
250a64e5b0b92772b3aa02c23a64745b51094916bjji  Provides library functions for each of the UEFI Runtime Services.
350a64e5b0b92772b3aa02c23a64745b51094916bjji  Only available to DXE and UEFI module types.
4fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
59df063a06aef048c042498e2f542fb693e93493ahhtianCopyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
6af2dc6a70b9380d702bd0720cdb029d630c505e3myronporterThis program and the accompanying materials are licensed and made available under
7af2dc6a70b9380d702bd0720cdb029d630c505e3myronporterthe terms and conditions of the BSD License that accompanies this distribution.
8af2dc6a70b9380d702bd0720cdb029d630c505e3myronporterThe full text of the license may be found at
9af2dc6a70b9380d702bd0720cdb029d630c505e3myronporterhttp://opensource.org/licenses/bsd-license.php.
10fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
1150a64e5b0b92772b3aa02c23a64745b51094916bjjiTHE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
1250a64e5b0b92772b3aa02c23a64745b51094916bjjiWITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang**/
14fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
15fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang#ifndef __UEFI_RUNTIME_LIB__
16fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang#define __UEFI_RUNTIME_LIB__
17fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
18fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang/**
1922d9510d9af09c2affb829191ea696ce4211ac84jji  This function allows the caller to determine if UEFI ExitBootServices() has been called.
20fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
2122d9510d9af09c2affb829191ea696ce4211ac84jji  This function returns TRUE after all the EVT_SIGNAL_EXIT_BOOT_SERVICES functions have
2222d9510d9af09c2affb829191ea696ce4211ac84jji  executed as a result of the OS calling ExitBootServices().  Prior to this time FALSE
2322d9510d9af09c2affb829191ea696ce4211ac84jji  is returned. This function is used by runtime code to decide it is legal to access
2422d9510d9af09c2affb829191ea696ce4211ac84jji  services that go away after ExitBootServices().
25fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
2622d9510d9af09c2affb829191ea696ce4211ac84jji  @retval  TRUE  The system has finished executing the EVT_SIGNAL_EXIT_BOOT_SERVICES event.
2722d9510d9af09c2affb829191ea696ce4211ac84jji  @retval  FALSE The system has not finished executing the EVT_SIGNAL_EXIT_BOOT_SERVICES event.
28fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
29fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang**/
30fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshangBOOLEAN
31fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshangEFIAPI
32fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshangEfiAtRuntime (
333b89de633df7b66c0dd4502f2f217a0c54cb06cdvanjeff  VOID
34fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  );
35fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
36fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang/**
3722d9510d9af09c2affb829191ea696ce4211ac84jji  This function allows the caller to determine if UEFI SetVirtualAddressMap() has been called.
38fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
3922d9510d9af09c2affb829191ea696ce4211ac84jji  This function returns TRUE after all the EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE functions have
4022d9510d9af09c2affb829191ea696ce4211ac84jji  executed as a result of the OS calling SetVirtualAddressMap(). Prior to this time FALSE
4122d9510d9af09c2affb829191ea696ce4211ac84jji  is returned. This function is used by runtime code to decide it is legal to access services
4222d9510d9af09c2affb829191ea696ce4211ac84jji  that go away after SetVirtualAddressMap().
4322d9510d9af09c2affb829191ea696ce4211ac84jji
4422d9510d9af09c2affb829191ea696ce4211ac84jji  @retval  TRUE  The system has finished executing the EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE event.
4522d9510d9af09c2affb829191ea696ce4211ac84jji  @retval  FALSE The system has not finished executing the EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE event.
46fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
47fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang**/
48fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshangBOOLEAN
49fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshangEFIAPI
50fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshangEfiGoneVirtual (
513b89de633df7b66c0dd4502f2f217a0c54cb06cdvanjeff  VOID
52fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  );
53fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
54fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang/**
5522d9510d9af09c2affb829191ea696ce4211ac84jji  This service is a wrapper for the UEFI Runtime Service GetTime().
5622d9510d9af09c2affb829191ea696ce4211ac84jji
5722d9510d9af09c2affb829191ea696ce4211ac84jji  The GetTime() function returns a time that was valid sometime during the call to the function.
5822d9510d9af09c2affb829191ea696ce4211ac84jji  While the returned EFI_TIME structure contains TimeZone and Daylight savings time information,
5922d9510d9af09c2affb829191ea696ce4211ac84jji  the actual clock does not maintain these values. The current time zone and daylight saving time
6022d9510d9af09c2affb829191ea696ce4211ac84jji  information returned by GetTime() are the values that were last set via SetTime().
6122d9510d9af09c2affb829191ea696ce4211ac84jji  The GetTime() function should take approximately the same amount of time to read the time each
6222d9510d9af09c2affb829191ea696ce4211ac84jji  time it is called. All reported device capabilities are to be rounded up.
631a2f870c9babe077c2d3abea23b6e8e044778341pkandel  During runtime, if a PC-AT CMOS device is present in the platform, the caller must synchronize
6422d9510d9af09c2affb829191ea696ce4211ac84jji  access to the device before calling GetTime().
65fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
66fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  @param  Time         A pointer to storage to receive a snapshot of the current time.
67fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  @param  Capabilities An optional pointer to a buffer to receive the real time clock device's
68fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang                       capabilities.
693b89de633df7b66c0dd4502f2f217a0c54cb06cdvanjeff
7022d9510d9af09c2affb829191ea696ce4211ac84jji  @retval  EFI_SUCCESS            The operation completed successfully.
7122d9510d9af09c2affb829191ea696ce4211ac84jji  @retval  EFI_INVALID_PARAMETER  Time is NULL.
7222d9510d9af09c2affb829191ea696ce4211ac84jji  @retval  EFI_DEVICE_ERROR       The time could not be retrieved due to a hardware error.
73fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
74fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang**/
75fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshangEFI_STATUS
76fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshangEFIAPI
77fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshangEfiGetTime (
78fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  OUT EFI_TIME                    *Time,
7922d9510d9af09c2affb829191ea696ce4211ac84jji  OUT EFI_TIME_CAPABILITIES       *Capabilities  OPTIONAL
80fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  );
81fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
82fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang/**
8322d9510d9af09c2affb829191ea696ce4211ac84jji  This service is a wrapper for the UEFI Runtime Service SetTime().
8422d9510d9af09c2affb829191ea696ce4211ac84jji
8522d9510d9af09c2affb829191ea696ce4211ac84jji  The SetTime() function sets the real time clock device to the supplied time, and records the
8622d9510d9af09c2affb829191ea696ce4211ac84jji  current time zone and daylight savings time information. The SetTime() function is not allowed
8722d9510d9af09c2affb829191ea696ce4211ac84jji  to loop based on the current time. For example, if the device does not support a hardware reset
8822d9510d9af09c2affb829191ea696ce4211ac84jji  for the sub-resolution time, the code is not to implement the feature by waiting for the time to
8922d9510d9af09c2affb829191ea696ce4211ac84jji  wrap.
901a2f870c9babe077c2d3abea23b6e8e044778341pkandel  During runtime, if a PC-AT CMOS device is present in the platform, the caller must synchronize
9122d9510d9af09c2affb829191ea696ce4211ac84jji  access to the device before calling SetTime().
9222d9510d9af09c2affb829191ea696ce4211ac84jji
9322d9510d9af09c2affb829191ea696ce4211ac84jji  @param  Time  A pointer to the current time. Type EFI_TIME is defined in the GetTime()
9422d9510d9af09c2affb829191ea696ce4211ac84jji                function description. Full error checking is performed on the different
9522d9510d9af09c2affb829191ea696ce4211ac84jji                fields of the EFI_TIME structure (refer to the EFI_TIME definition in the
9622d9510d9af09c2affb829191ea696ce4211ac84jji                GetTime() function description for full details), and EFI_INVALID_PARAMETER
9722d9510d9af09c2affb829191ea696ce4211ac84jji                is returned if any field is out of range.
9822d9510d9af09c2affb829191ea696ce4211ac84jji
9922d9510d9af09c2affb829191ea696ce4211ac84jji  @retval  EFI_SUCCESS            The operation completed successfully.
10022d9510d9af09c2affb829191ea696ce4211ac84jji  @retval  EFI_INVALID_PARAMETER  A time field is out of range.
10122d9510d9af09c2affb829191ea696ce4211ac84jji  @retval  EFI_DEVICE_ERROR       The time could not be set due to a hardware error.
102fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
103fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang**/
104fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshangEFI_STATUS
105fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshangEFIAPI
106fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshangEfiSetTime (
107fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  IN EFI_TIME                   *Time
108fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  );
109fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
110fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang/**
111cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  This service is a wrapper for the UEFI Runtime Service GetWakeupTime().
112fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
11322d9510d9af09c2affb829191ea696ce4211ac84jji  The alarm clock time may be rounded from the set alarm clock time to be within the resolution
11422d9510d9af09c2affb829191ea696ce4211ac84jji  of the alarm clock device. The resolution of the alarm clock device is defined to be one second.
11522d9510d9af09c2affb829191ea696ce4211ac84jji  During runtime, if a PC-AT CMOS device is present in the platform the caller must synchronize
11622d9510d9af09c2affb829191ea696ce4211ac84jji  access to the device before calling GetWakeupTime().
1173b89de633df7b66c0dd4502f2f217a0c54cb06cdvanjeff
11822d9510d9af09c2affb829191ea696ce4211ac84jji  @param  Enabled  Indicates if the alarm is currently enabled or disabled.
11922d9510d9af09c2affb829191ea696ce4211ac84jji  @param  Pending  Indicates if the alarm signal is pending and requires acknowledgement.
12022d9510d9af09c2affb829191ea696ce4211ac84jji  @param  Time     The current alarm setting. Type EFI_TIME is defined in the GetTime()
12122d9510d9af09c2affb829191ea696ce4211ac84jji                   function description.
12222d9510d9af09c2affb829191ea696ce4211ac84jji
123af2dc6a70b9380d702bd0720cdb029d630c505e3myronporter  @retval  EFI_SUCCESS            The alarm settings were returned.
12422d9510d9af09c2affb829191ea696ce4211ac84jji  @retval  EFI_INVALID_PARAMETER  Enabled is NULL.
12522d9510d9af09c2affb829191ea696ce4211ac84jji  @retval  EFI_INVALID_PARAMETER  Pending is NULL.
12622d9510d9af09c2affb829191ea696ce4211ac84jji  @retval  EFI_INVALID_PARAMETER  Time is NULL.
12722d9510d9af09c2affb829191ea696ce4211ac84jji  @retval  EFI_DEVICE_ERROR       The wakeup time could not be retrieved due to a hardware error.
12822d9510d9af09c2affb829191ea696ce4211ac84jji  @retval  EFI_UNSUPPORTED        A wakeup timer is not supported on this platform.
129fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
130fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang**/
131fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshangEFI_STATUS
132fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshangEFIAPI
133fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshangEfiGetWakeupTime (
134fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  OUT BOOLEAN                     *Enabled,
135fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  OUT BOOLEAN                     *Pending,
136fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  OUT EFI_TIME                    *Time
137fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  );
138fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
139fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang/**
140cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  This service is a wrapper for the UEFI Runtime Service SetWakeupTime()
141cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji
142cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  Setting a system wakeup alarm causes the system to wake up or power on at the set time.
143cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  When the alarm fires, the alarm signal is latched until it is acknowledged by calling SetWakeupTime()
144cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  to disable the alarm. If the alarm fires before the system is put into a sleeping or off state,
145cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  since the alarm signal is latched the system will immediately wake up. If the alarm fires while
146cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  the system is off and there is insufficient power to power on the system, the system is powered
147cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  on when power is restored.
148fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
14922d9510d9af09c2affb829191ea696ce4211ac84jji  @param  Enable  Enable or disable the wakeup alarm.
15022d9510d9af09c2affb829191ea696ce4211ac84jji  @param  Time    If Enable is TRUE, the time to set the wakeup alarm for. Type EFI_TIME
15122d9510d9af09c2affb829191ea696ce4211ac84jji                  is defined in the GetTime() function description. If Enable is FALSE,
15222d9510d9af09c2affb829191ea696ce4211ac84jji                  then this parameter is optional, and may be NULL.
1533b89de633df7b66c0dd4502f2f217a0c54cb06cdvanjeff
15422d9510d9af09c2affb829191ea696ce4211ac84jji  @retval  EFI_SUCCESS            If Enable is TRUE, then the wakeup alarm was enabled.
15522d9510d9af09c2affb829191ea696ce4211ac84jji                                  If Enable is FALSE, then the wakeup alarm was disabled.
15622d9510d9af09c2affb829191ea696ce4211ac84jji  @retval  EFI_INVALID_PARAMETER  A time field is out of range.
15722d9510d9af09c2affb829191ea696ce4211ac84jji  @retval  EFI_DEVICE_ERROR       The wakeup time could not be set due to a hardware error.
15822d9510d9af09c2affb829191ea696ce4211ac84jji  @retval  EFI_UNSUPPORTED        A wakeup timer is not supported on this platform.
159fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
160fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang**/
161fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshangEFI_STATUS
162fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshangEFIAPI
163fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshangEfiSetWakeupTime (
164fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  IN BOOLEAN                      Enable,
16522d9510d9af09c2affb829191ea696ce4211ac84jji  IN EFI_TIME                     *Time   OPTIONAL
166fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  );
167fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
168fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang/**
169cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  This service is a wrapper for the UEFI Runtime Service GetVariable().
170fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
171cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  Each vendor may create and manage its own variables without the risk of name conflicts by
1721a2f870c9babe077c2d3abea23b6e8e044778341pkandel  using a unique VendorGuid. When a variable is set, its Attributes are supplied to indicate
173cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  how the data variable should be stored and maintained by the system. The attributes affect
174cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  when the variable may be accessed and volatility of the data. Any attempts to access a variable
175cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  that does not have the attribute set for runtime access will yield the EFI_NOT_FOUND error.
176cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  If the Data buffer is too small to hold the contents of the variable, the error EFI_BUFFER_TOO_SMALL
177cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  is returned and DataSize is set to the required buffer size to obtain the data.
178cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji
179cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  @param  VariableName the name of the vendor's variable, it's a Null-Terminated Unicode String
180fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  @param  VendorGuid   Unify identifier for vendor.
1813b89de633df7b66c0dd4502f2f217a0c54cb06cdvanjeff  @param  Attributes   Point to memory location to return the attributes of variable. If the point
182fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang                       is NULL, the parameter would be ignored.
18328d3e14ffb529238c70d86a529752d5d0e815e89gikidy  @param  DataSize     As input, point to the maximum size of return Data-Buffer.
184fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang                       As output, point to the actual size of the returned Data-Buffer.
185fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  @param  Data         Point to return Data-Buffer.
1863b89de633df7b66c0dd4502f2f217a0c54cb06cdvanjeff
18722d9510d9af09c2affb829191ea696ce4211ac84jji  @retval  EFI_SUCCESS            The function completed successfully.
18822d9510d9af09c2affb829191ea696ce4211ac84jji  @retval  EFI_NOT_FOUND          The variable was not found.
18922d9510d9af09c2affb829191ea696ce4211ac84jji  @retval  EFI_BUFFER_TOO_SMALL   The DataSize is too small for the result. DataSize has
19022d9510d9af09c2affb829191ea696ce4211ac84jji                                  been updated with the size needed to complete the request.
19122d9510d9af09c2affb829191ea696ce4211ac84jji  @retval  EFI_INVALID_PARAMETER  VariableName is NULL.
19222d9510d9af09c2affb829191ea696ce4211ac84jji  @retval  EFI_INVALID_PARAMETER  VendorGuid is NULL.
19322d9510d9af09c2affb829191ea696ce4211ac84jji  @retval  EFI_INVALID_PARAMETER  DataSize is NULL.
19422d9510d9af09c2affb829191ea696ce4211ac84jji  @retval  EFI_INVALID_PARAMETER  The DataSize is not too small and Data is NULL.
19522d9510d9af09c2affb829191ea696ce4211ac84jji  @retval  EFI_DEVICE_ERROR       The variable could not be retrieved due to a hardware error.
19622d9510d9af09c2affb829191ea696ce4211ac84jji  @retval  EFI_SECURITY_VIOLATION The variable could not be retrieved due to an authentication failure.
197fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang**/
198fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshangEFI_STATUS
199fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshangEFIAPI
200fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshangEfiGetVariable (
201fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  IN      CHAR16                   *VariableName,
202fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  IN      EFI_GUID                 *VendorGuid,
203201c76681b80b5762b7cf282c4293d9382d00c2bxli  OUT     UINT32                   *Attributes OPTIONAL,
204fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  IN OUT  UINTN                    *DataSize,
205fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  OUT     VOID                     *Data
206bf231ea60e0c607732ca17b3f797faae97186699AJFISH  );
207fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
208fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang/**
209cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  This service is a wrapper for the UEFI Runtime Service GetNextVariableName().
210cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji
211cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  GetNextVariableName() is called multiple times to retrieve the VariableName and VendorGuid of
212cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  all variables currently available in the system. On each call to GetNextVariableName() the
213cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  previous results are passed into the interface, and on output the interface returns the next
214cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  variable name data. When the entire variable list has been returned, the error EFI_NOT_FOUND
215cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  is returned.
216fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
21728d3e14ffb529238c70d86a529752d5d0e815e89gikidy  @param  VariableNameSize As input, point to maximum size of variable name.
21828d3e14ffb529238c70d86a529752d5d0e815e89gikidy                           As output, point to actual size of variable name.
2193b89de633df7b66c0dd4502f2f217a0c54cb06cdvanjeff  @param  VariableName     As input, supplies the last VariableName that was returned by
220fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang                           GetNextVariableName().
2213b89de633df7b66c0dd4502f2f217a0c54cb06cdvanjeff                           As output, returns the name of variable. The name
222fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang                           string is Null-Terminated Unicode string.
2233b89de633df7b66c0dd4502f2f217a0c54cb06cdvanjeff  @param  VendorGuid       As input, supplies the last VendorGuid that was returned by
224fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang                           GetNextVriableName().
225fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang                           As output, returns the VendorGuid of the current variable.
2263b89de633df7b66c0dd4502f2f217a0c54cb06cdvanjeff
22722d9510d9af09c2affb829191ea696ce4211ac84jji  @retval  EFI_SUCCESS           The function completed successfully.
22822d9510d9af09c2affb829191ea696ce4211ac84jji  @retval  EFI_NOT_FOUND         The next variable was not found.
22922d9510d9af09c2affb829191ea696ce4211ac84jji  @retval  EFI_BUFFER_TOO_SMALL  The VariableNameSize is too small for the result.
23022d9510d9af09c2affb829191ea696ce4211ac84jji                                 VariableNameSize has been updated with the size needed
23122d9510d9af09c2affb829191ea696ce4211ac84jji                                 to complete the request.
23222d9510d9af09c2affb829191ea696ce4211ac84jji  @retval  EFI_INVALID_PARAMETER VariableNameSize is NULL.
23322d9510d9af09c2affb829191ea696ce4211ac84jji  @retval  EFI_INVALID_PARAMETER VariableName is NULL.
23422d9510d9af09c2affb829191ea696ce4211ac84jji  @retval  EFI_INVALID_PARAMETER VendorGuid is NULL.
23522d9510d9af09c2affb829191ea696ce4211ac84jji  @retval  EFI_DEVICE_ERROR      The variable name could not be retrieved due to a hardware error.
236fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
237fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang**/
238fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshangEFI_STATUS
239fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshangEFIAPI
240fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshangEfiGetNextVariableName (
241fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  IN OUT UINTN                    *VariableNameSize,
242fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  IN OUT CHAR16                   *VariableName,
243fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  IN OUT EFI_GUID                 *VendorGuid
244fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  );
245fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
246fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang/**
247cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  This service is a wrapper for the UEFI Runtime Service GetNextVariableName()
248cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji
249cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  Variables are stored by the firmware and may maintain their values across power cycles. Each vendor
250cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  may create and manage its own variables without the risk of name conflicts by using a unique VendorGuid.
251fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
2521a2f870c9babe077c2d3abea23b6e8e044778341pkandel  @param  VariableName the name of the vendor's variable, as a
253fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang                       Null-Terminated Unicode String
254fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  @param  VendorGuid   Unify identifier for vendor.
2553b89de633df7b66c0dd4502f2f217a0c54cb06cdvanjeff  @param  Attributes   Point to memory location to return the attributes of variable. If the point
256fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang                       is NULL, the parameter would be ignored.
257fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  @param  DataSize     The size in bytes of Data-Buffer.
258fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  @param  Data         Point to the content of the variable.
259fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
26022d9510d9af09c2affb829191ea696ce4211ac84jji  @retval  EFI_SUCCESS            The firmware has successfully stored the variable and its data as
26122d9510d9af09c2affb829191ea696ce4211ac84jji                                  defined by the Attributes.
26222d9510d9af09c2affb829191ea696ce4211ac84jji  @retval  EFI_INVALID_PARAMETER  An invalid combination of attribute bits was supplied, or the
26322d9510d9af09c2affb829191ea696ce4211ac84jji                                  DataSize exceeds the maximum allowed.
26422d9510d9af09c2affb829191ea696ce4211ac84jji  @retval  EFI_INVALID_PARAMETER  VariableName is an empty Unicode string.
26522d9510d9af09c2affb829191ea696ce4211ac84jji  @retval  EFI_OUT_OF_RESOURCES   Not enough storage is available to hold the variable and its data.
26622d9510d9af09c2affb829191ea696ce4211ac84jji  @retval  EFI_DEVICE_ERROR       The variable could not be saved due to a hardware failure.
26722d9510d9af09c2affb829191ea696ce4211ac84jji  @retval  EFI_WRITE_PROTECTED    The variable in question is read-only.
26822d9510d9af09c2affb829191ea696ce4211ac84jji  @retval  EFI_WRITE_PROTECTED    The variable in question cannot be deleted.
26922d9510d9af09c2affb829191ea696ce4211ac84jji  @retval  EFI_SECURITY_VIOLATION The variable could not be written due to EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS
27022d9510d9af09c2affb829191ea696ce4211ac84jji                                  set but the AuthInfo does NOT pass the validation check carried
27122d9510d9af09c2affb829191ea696ce4211ac84jji                                  out by the firmware.
27222d9510d9af09c2affb829191ea696ce4211ac84jji  @retval  EFI_NOT_FOUND          The variable trying to be updated or deleted was not found.
273fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
274fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang**/
275fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshangEFI_STATUS
276fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshangEFIAPI
277fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshangEfiSetVariable (
278fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  IN CHAR16                       *VariableName,
279fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  IN EFI_GUID                     *VendorGuid,
280fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  IN UINT32                       Attributes,
281fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  IN UINTN                        DataSize,
282fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  IN VOID                         *Data
283fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  );
284fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
285fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang/**
286cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  This service is a wrapper for the UEFI Runtime Service GetNextHighMonotonicCount().
287cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji
288cd2ed84a474a7bd16d88a289a49959fb6d04b348qhuang  The platform's monotonic counter is comprised of two 32-bit quantities: the high 32 bits and
289cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  the low 32 bits. During boot service time the low 32-bit value is volatile: it is reset to zero
290cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  on every system reset and is increased by 1 on every call to GetNextMonotonicCount(). The high
291cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  32-bit value is nonvolatile and is increased by 1 whenever the system resets or whenever the low
292cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  32-bit count (returned by GetNextMonoticCount()) overflows.
293fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
294fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  @param  HighCount Pointer to returned value.
295fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
29622d9510d9af09c2affb829191ea696ce4211ac84jji  @retval  EFI_SUCCESS           The next high monotonic count was returned.
29722d9510d9af09c2affb829191ea696ce4211ac84jji  @retval  EFI_DEVICE_ERROR      The device is not functioning properly.
29822d9510d9af09c2affb829191ea696ce4211ac84jji  @retval  EFI_INVALID_PARAMETER HighCount is NULL.
299fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
300fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang**/
301fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshangEFI_STATUS
302fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshangEFIAPI
303fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshangEfiGetNextHighMonotonicCount (
304fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  OUT UINT32                      *HighCount
305fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  );
306fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
307fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang/**
308cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  This service is a wrapper for the UEFI Runtime Service ResetSystem().
309cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji
310cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  The ResetSystem()function resets the entire platform, including all processors and devices,and reboots the system.
311cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  Calling this interface with ResetType of EfiResetCold causes a system-wide reset. This sets all circuitry within
312cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  the system to its initial state. This type of reset is asynchronous to system operation and operates without regard
313cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  to cycle boundaries. EfiResetCold is tantamount to a system power cycle.
314cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  Calling this interface with ResetType of EfiResetWarm causes a system-wide initialization. The processors are set to
315cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  their initial state, and pending cycles are not corrupted. If the system does not support this reset type, then an
316cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  EfiResetCold must be performed.
317cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  Calling this interface with ResetType of EfiResetShutdown causes the system to enter a power state equivalent to the
318cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  ACPI G2/S5 or G3 states. If the system does not support this reset type, then when the system is rebooted, it should
319cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  exhibit the EfiResetCold attributes.
32028d3e14ffb529238c70d86a529752d5d0e815e89gikidy  The platform may optionally log the parameters from any non-normal reset that occurs.
321cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  The ResetSystem() function does not return.
322fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
323fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  @param  ResetType   The type of reset to perform.
324cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  @param  ResetStatus The status code for the reset. If the system reset is part of a normal operation, the status code
325cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji                      would be EFI_SUCCESS. If the system reset is due to some type of failure the most appropriate EFI
326cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji                      Status code would be used.
32722d9510d9af09c2affb829191ea696ce4211ac84jji  @param  DataSizeThe size, in bytes, of ResetData.
328cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  @param  ResetData   For a ResetType of EfiResetCold, EfiResetWarm, or EfiResetShutdown the data buffer starts with a
329cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji                      Null-terminated Unicode string, optionally followed by additional binary data. The string is a
330cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji                      description that the caller may use to further indicate the reason for the system reset. ResetData
331cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji                      is only valid if ResetStatus is something other then EFI_SUCCESS. This pointer must be a physical
332cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji                      address. For a ResetType of EfiRestUpdate the data buffer also starts with a Null-terminated string
333cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji                      that is followed by a physical VOID * to an EFI_CAPSULE_HEADER.
334fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
335fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang**/
336fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshangVOID
337201c76681b80b5762b7cf282c4293d9382d00c2bxliEFIAPI
338fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshangEfiResetSystem (
339fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  IN EFI_RESET_TYPE               ResetType,
340fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  IN EFI_STATUS                   ResetStatus,
341fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  IN UINTN                        DataSize,
342008dfe313e0a2ab27a7568332e45e817bcbede0aqhuang  IN VOID                         *ResetData OPTIONAL
343fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  );
344fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
345fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang/**
346cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  This service is a wrapper for the UEFI Runtime Service ConvertPointer().
347cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji
348cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  The ConvertPointer() function is used by an EFI component during the SetVirtualAddressMap() operation.
349cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  ConvertPointer()must be called using physical address pointers during the execution of SetVirtualAddressMap().
350fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
351fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  @param  DebugDisposition   Supplies type information for the pointer being converted.
3523b89de633df7b66c0dd4502f2f217a0c54cb06cdvanjeff  @param  Address            The pointer to a pointer that is to be fixed to be the
3533b89de633df7b66c0dd4502f2f217a0c54cb06cdvanjeff                             value needed for the new virtual address mapping being
354fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang                             applied.
355fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
35622d9510d9af09c2affb829191ea696ce4211ac84jji  @retval  EFI_SUCCESS            The pointer pointed to by Address was modified.
35722d9510d9af09c2affb829191ea696ce4211ac84jji  @retval  EFI_NOT_FOUND          The pointer pointed to by Address was not found to be part of
35822d9510d9af09c2affb829191ea696ce4211ac84jji                                  the current memory map. This is normally fatal.
35922d9510d9af09c2affb829191ea696ce4211ac84jji  @retval  EFI_INVALID_PARAMETER  Address is NULL.
36022d9510d9af09c2affb829191ea696ce4211ac84jji  @retval  EFI_INVALID_PARAMETER  *Address is NULL and DebugDispositio
361fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
362fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang**/
363fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshangEFI_STATUS
364fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshangEFIAPI
365fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshangEfiConvertPointer (
366fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  IN UINTN                  DebugDisposition,
367fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  IN OUT VOID               **Address
368fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  );
369fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
37020742255f1a40578d4b24ee22aa95ab67f57edd8qhuang/**
37120742255f1a40578d4b24ee22aa95ab67f57edd8qhuang  Determines the new virtual address that is to be used on subsequent memory accesses.
37220742255f1a40578d4b24ee22aa95ab67f57edd8qhuang
373030cd1a2e95018683638462e9fcfa2d204aaff33qhuang  For IA32, x64, and EBC, this service is a wrapper for the UEFI Runtime Service
37420742255f1a40578d4b24ee22aa95ab67f57edd8qhuang  ConvertPointer().  See the UEFI Specification for details.
37520742255f1a40578d4b24ee22aa95ab67f57edd8qhuang  For IPF, this function interprets Address as a pointer to an EFI_PLABEL structure
37620742255f1a40578d4b24ee22aa95ab67f57edd8qhuang  and both the EntryPoint and GP fields of an EFI_PLABEL are converted from physical
37720742255f1a40578d4b24ee22aa95ab67f57edd8qhuang  to virtiual addressing.  Since IPF allows the GP to point to an address outside
37820742255f1a40578d4b24ee22aa95ab67f57edd8qhuang  a PE/COFF image, the physical to virtual offset for the EntryPoint field is used
37920742255f1a40578d4b24ee22aa95ab67f57edd8qhuang  to adjust the GP field.  The UEFI Runtime Service ConvertPointer() is used to convert
38020742255f1a40578d4b24ee22aa95ab67f57edd8qhuang  EntryPoint and the status code for this conversion is always returned.   If the convertion
38120742255f1a40578d4b24ee22aa95ab67f57edd8qhuang  of EntryPoint fails, then neither EntryPoint nor GP are modified.  See the UEFI
38220742255f1a40578d4b24ee22aa95ab67f57edd8qhuang  Specification for details on the UEFI Runtime Service ConvertPointer().
38320742255f1a40578d4b24ee22aa95ab67f57edd8qhuang
38420742255f1a40578d4b24ee22aa95ab67f57edd8qhuang  @param  DebugDisposition   Supplies type information for the pointer being converted.
38520742255f1a40578d4b24ee22aa95ab67f57edd8qhuang  @param  Address            The pointer to a pointer that is to be fixed to be the
38620742255f1a40578d4b24ee22aa95ab67f57edd8qhuang                             value needed for the new virtual address mapping being
38720742255f1a40578d4b24ee22aa95ab67f57edd8qhuang                             applied.
38820742255f1a40578d4b24ee22aa95ab67f57edd8qhuang
38922d9510d9af09c2affb829191ea696ce4211ac84jji  @return  EFI_STATUS value from EfiConvertPointer().
39020742255f1a40578d4b24ee22aa95ab67f57edd8qhuang
39120742255f1a40578d4b24ee22aa95ab67f57edd8qhuang**/
39220742255f1a40578d4b24ee22aa95ab67f57edd8qhuangEFI_STATUS
39320742255f1a40578d4b24ee22aa95ab67f57edd8qhuangEFIAPI
39420742255f1a40578d4b24ee22aa95ab67f57edd8qhuangEfiConvertFunctionPointer (
39520742255f1a40578d4b24ee22aa95ab67f57edd8qhuang  IN UINTN                DebugDisposition,
39620742255f1a40578d4b24ee22aa95ab67f57edd8qhuang  IN OUT VOID             **Address
39720742255f1a40578d4b24ee22aa95ab67f57edd8qhuang  );
398fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
399fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang/**
400cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  This service is a wrapper for the UEFI Runtime Service SetVirtualAddressMap().
401cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji
402cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  The SetVirtualAddressMap() function is used by the OS loader. The function can only be called
403cd2ed84a474a7bd16d88a289a49959fb6d04b348qhuang  at runtime, and is called by the owner of the system's memory map. I.e., the component which
404cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  called ExitBootServices(). All events of type EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE must be signaled
405cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  before SetVirtualAddressMap() returns.
406fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
407fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  @param  MemoryMapSize         The size in bytes of VirtualMap.
408fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  @param  DescriptorSize        The size in bytes of an entry in the VirtualMap.
409fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  @param  DescriptorVersion     The version of the structure entries in VirtualMap.
410fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  @param  VirtualMap            An array of memory descriptors which contain new virtual
411fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang                                address mapping information for all runtime ranges. Type
412fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang                                EFI_MEMORY_DESCRIPTOR is defined in the
413fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang                                GetMemoryMap() function description.
414fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
415fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  @retval EFI_SUCCESS           The virtual address map has been applied.
416fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  @retval EFI_UNSUPPORTED       EFI firmware is not at runtime, or the EFI firmware is already in
417fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang                                virtual address mapped mode.
418fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  @retval EFI_INVALID_PARAMETER DescriptorSize or DescriptorVersion is
419fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang                                invalid.
420fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  @retval EFI_NO_MAPPING        A virtual address was not supplied for a range in the memory
421fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang                                map that requires a mapping.
422fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  @retval EFI_NOT_FOUND         A virtual address was supplied for an address that is not found
423fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang                                in the memory map.
424fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang**/
425fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshangEFI_STATUS
426fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshangEFIAPI
427fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshangEfiSetVirtualAddressMap (
428fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  IN UINTN                          MemoryMapSize,
429fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  IN UINTN                          DescriptorSize,
430fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  IN UINT32                         DescriptorVersion,
431fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  IN CONST EFI_MEMORY_DESCRIPTOR    *VirtualMap
432fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  );
433fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
434fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
435fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang/**
436bf231ea60e0c607732ca17b3f797faae97186699AJFISH  Convert the standard Lib double linked list to a virtual mapping.
437fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
43822d9510d9af09c2affb829191ea696ce4211ac84jji  This service uses EfiConvertPointer() to walk a double linked list and convert all the link
43922d9510d9af09c2affb829191ea696ce4211ac84jji  pointers to their virtual mappings. This function is only guaranteed to work during the
44022d9510d9af09c2affb829191ea696ce4211ac84jji  EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE event and calling it at other times has undefined results.
44122d9510d9af09c2affb829191ea696ce4211ac84jji
442fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  @param  DebugDisposition   Supplies type information for the pointer being converted.
443fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  @param  ListHead           Head of linked list to convert.
444fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
445af2dc6a70b9380d702bd0720cdb029d630c505e3myronporter  @retval  EFI_SUCCESS  Successfully executed the function.
4461a2f870c9babe077c2d3abea23b6e8e044778341pkandel  @retval  !EFI_SUCCESS Failed to execute the function.
447fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
448fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang**/
449fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshangEFI_STATUS
450fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshangEFIAPI
451fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshangEfiConvertList (
452fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  IN UINTN                DebugDisposition,
453fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  IN OUT LIST_ENTRY       *ListHead
454fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  );
455fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
456fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang/**
457cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  This service is a wrapper for the UEFI Runtime Service UpdateCapsule().
458cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji
459cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  Passes capsules to the firmware with both virtual and physical mapping. Depending on the intended
460cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  consumption, the firmware may process the capsule immediately. If the payload should persist across a
461cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  system reset, the reset value returned from EFI_QueryCapsuleCapabilities must be passed into ResetSystem()
462cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  and will cause the capsule to be processed by the firmware as part of the reset process.
4633b89de633df7b66c0dd4502f2f217a0c54cb06cdvanjeff
464fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  @param  CapsuleHeaderArray    Virtual pointer to an array of virtual pointers to the capsules
465fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang                                being passed into update capsule. Each capsules is assumed to
466fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang                                stored in contiguous virtual memory. The capsules in the
467fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang                                CapsuleHeaderArray must be the same capsules as the
468fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang                                ScatterGatherList. The CapsuleHeaderArray must
469fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang                                have the capsules in the same order as the ScatterGatherList.
470fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  @param  CapsuleCount          Number of pointers to EFI_CAPSULE_HEADER in
471fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang                                CaspuleHeaderArray.
472fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  @param  ScatterGatherList     Physical pointer to a set of
473fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang                                EFI_CAPSULE_BLOCK_DESCRIPTOR that describes the
474fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang                                location in physical memory of a set of capsules. See Related
475fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang                                Definitions for an explanation of how more than one capsule is
476fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang                                passed via this interface. The capsules in the
477fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang                                ScatterGatherList must be in the same order as the
478fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang                                CapsuleHeaderArray. This parameter is only referenced if
479fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang                                the capsules are defined to persist across system reset.
480fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
481af2dc6a70b9380d702bd0720cdb029d630c505e3myronporter  @retval EFI_SUCCESS           A valid capsule was passed. If CAPSULE_FLAGS_PERSIT_ACROSS_RESET is not set,
48222d9510d9af09c2affb829191ea696ce4211ac84jji                                the capsule has been successfully processed by the firmware.
483eaa8a2348676f92f766778ea11e293412923f24eqhuang  @retval EFI_INVALID_PARAMETER CapsuleSize is NULL, or an incompatible set of flags were
484eaa8a2348676f92f766778ea11e293412923f24eqhuang                                set in the capsule header.
48522d9510d9af09c2affb829191ea696ce4211ac84jji  @retval EFI_INVALID_PARAMETER CapsuleCount is 0
486fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  @retval EFI_DEVICE_ERROR      The capsule update was started, but failed due to a device error.
48722d9510d9af09c2affb829191ea696ce4211ac84jji  @retval EFI_UNSUPPORTED       The capsule type is not supported on this platform.
48822d9510d9af09c2affb829191ea696ce4211ac84jji  @retval EFI_OUT_OF_RESOURCES  There were insufficient resources to process the capsule.
489fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
490fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang**/
491fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshangEFI_STATUS
492fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshangEFIAPI
493fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshangEfiUpdateCapsule (
4943b89de633df7b66c0dd4502f2f217a0c54cb06cdvanjeff  IN EFI_CAPSULE_HEADER       **CapsuleHeaderArray,
495fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  IN UINTN                    CapsuleCount,
496d27e363bc35c5d2ad71609fb478cd1e613268c8eklu  IN EFI_PHYSICAL_ADDRESS     ScatterGatherList OPTIONAL
497fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  );
498fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
499fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
500fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang/**
501cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  This service is a wrapper for the UEFI Runtime Service QueryCapsuleCapabilities().
502cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji
503fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  The QueryCapsuleCapabilities() function allows a caller to test to see if a capsule or
504fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  capsules can be updated via UpdateCapsule(). The Flags values in the capsule header and
505fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  size of the entire capsule is checked.
506fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  If the caller needs to query for generic capsule capability a fake EFI_CAPSULE_HEADER can be
507fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  constructed where CapsuleImageSize is equal to HeaderSize that is equal to sizeof
508fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  (EFI_CAPSULE_HEADER). To determine reset requirements,
509fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  CAPSULE_FLAGS_PERSIST_ACROSS_RESET should be set in the Flags field of the
510fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  EFI_CAPSULE_HEADER.
511fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  The firmware must support any capsule that has the
512fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  CAPSULE_FLAGS_PERSIST_ACROSS_RESET flag set in EFI_CAPSULE_HEADER. The
513fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  firmware sets the policy for what capsules are supported that do not have the
514fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  CAPSULE_FLAGS_PERSIST_ACROSS_RESET flag set.
5153b89de633df7b66c0dd4502f2f217a0c54cb06cdvanjeff
516fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  @param  CapsuleHeaderArray    Virtual pointer to an array of virtual pointers to the capsules
517fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang                                being passed into update capsule. The capsules are assumed to
518fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang                                stored in contiguous virtual memory.
519fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  @param  CapsuleCount          Number of pointers to EFI_CAPSULE_HEADER in
520fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang                                CaspuleHeaderArray.
52142eedea958591087603bbacd1c2227d2494026afyshang  @param  MaximumCapsuleSize     On output the maximum size that UpdateCapsule() can
522fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang                                support as an argument to UpdateCapsule() via
523fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang                                CapsuleHeaderArray and ScatterGatherList.
524fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang                                Undefined on input.
525fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  @param  ResetType             Returns the type of reset required for the capsule update.
526fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
527af2dc6a70b9380d702bd0720cdb029d630c505e3myronporter  @retval EFI_SUCCESS           A valid answer was returned.
528fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  @retval EFI_INVALID_PARAMETER MaximumCapsuleSize is NULL.
529fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  @retval EFI_UNSUPPORTED       The capsule type is not supported on this platform, and
530fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang                                MaximumCapsuleSize and ResetType are undefined.
53122d9510d9af09c2affb829191ea696ce4211ac84jji  @retval EFI_OUT_OF_RESOURCES  There were insufficient resources to process the query request.
532fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
533fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang**/
534fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshangEFI_STATUS
535fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshangEFIAPI
536fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshangEfiQueryCapsuleCapabilities (
5373b89de633df7b66c0dd4502f2f217a0c54cb06cdvanjeff  IN  EFI_CAPSULE_HEADER       **CapsuleHeaderArray,
5383b89de633df7b66c0dd4502f2f217a0c54cb06cdvanjeff  IN  UINTN                    CapsuleCount,
539fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  OUT UINT64                   *MaximumCapsuleSize,
540fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  OUT EFI_RESET_TYPE           *ResetType
541fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  );
542fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
543fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
544fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang/**
545cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji  This service is a wrapper for the UEFI Runtime Service QueryVariableInfo().
54622d9510d9af09c2affb829191ea696ce4211ac84jji
547fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  The QueryVariableInfo() function allows a caller to obtain the information about the
548fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  maximum size of the storage space available for the EFI variables, the remaining size of the storage
549fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  space available for the EFI variables and the maximum size of each individual EFI variable,
550fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  associated with the attributes specified.
551fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  The returned MaximumVariableStorageSize, RemainingVariableStorageSize,
552fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  MaximumVariableSize information may change immediately after the call based on other
553fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  runtime activities including asynchronous error events. Also, these values associated with different
554fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  attributes are not additive in nature.
5553b89de633df7b66c0dd4502f2f217a0c54cb06cdvanjeff
556fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  @param  Attributes            Attributes bitmask to specify the type of variables on
557fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang                                which to return information. Refer to the
558fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang                                GetVariable() function description.
5593b89de633df7b66c0dd4502f2f217a0c54cb06cdvanjeff  @param  MaximumVariableStorageSize
560fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang                                On output the maximum size of the storage space
561fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang                                available for the EFI variables associated with the
562fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang                                attributes specified.
5633b89de633df7b66c0dd4502f2f217a0c54cb06cdvanjeff  @param  RemainingVariableStorageSize
564fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang                                Returns the remaining size of the storage space
565fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang                                available for the EFI variables associated with the
566af2dc6a70b9380d702bd0720cdb029d630c505e3myronporter                                attributes specified.
567fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  @param  MaximumVariableSize   Returns the maximum size of the individual EFI
568fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang                                variables associated with the attributes specified.
569fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
570af2dc6a70b9380d702bd0720cdb029d630c505e3myronporter  @retval EFI_SUCCESS           A valid answer was returned.
571fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  @retval EFI_INVALID_PARAMETER An invalid combination of attribute bits was supplied.
572fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  @retval EFI_UNSUPPORTED       EFI_UNSUPPORTED The attribute is not supported on this platform, and the
573fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang                                MaximumVariableStorageSize,
574fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang                                RemainingVariableStorageSize, MaximumVariableSize
575fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang                                are undefined.
576cf8ae2f6fe7795c3ebe2792401d0ee839393dae8jji
577fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang**/
578fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshangEFI_STATUS
579fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshangEFIAPI
580fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshangEfiQueryVariableInfo (
58142eedea958591087603bbacd1c2227d2494026afyshang  IN UINT32   Attributes,
582fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  OUT UINT64  *MaximumVariableStorageSize,
583fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  OUT UINT64  *RemainingVariableStorageSize,
584fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  OUT UINT64  *MaximumVariableSize
585fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang  );
586fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
587fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang#endif
588fb3df220f89e6eecaf1862b9241d8a1214eeda1cyshang
589