• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*++
2 
3 Copyright (c) 2004 - 2006, Intel Corporation. All rights reserved.<BR>
4 This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution.  The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8 
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11 
12 
13 Module Name:
14 
15   EdkIIGlueDxeRuntimeDriverLib.h
16 
17 Abstract:
18 
19   Library that abstracts runtime services
20 
21 --*/
22 
23 #ifndef __EDKII_GLUE_DXE_RUNTIME_DRIVER_LIB_H__
24 #define __EDKII_GLUE_DXE_RUNTIME_DRIVER_LIB_H__
25 
26 #ifdef MDE_CPU_IPF
27 #include "EdkIIGlueEdkDxeSalLib.h"
28 #endif
29 
30 #if (EFI_SPECIFICATION_VERSION < 0x00020000)
31 
32 typedef struct {
33   EFI_GUID  CapsuleGuid;
34   UINT32    HeaderSize;
35   UINT32    Flags;
36   UINT32    CapsuleImageSize;
37 } UEFI_CAPSULE_HEADER;
38 
39 #else
40 
41 typedef EFI_CAPSULE_HEADER UEFI_CAPSULE_HEADER;
42 
43 #endif
44 
45 extern const EFI_EVENT_NOTIFY _gDriverExitBootServicesEvent[];
46 
47 extern const EFI_EVENT_NOTIFY _gDriverSetVirtualAddressMapEvent[];
48 
49 /**
50   Check to see if the execute context is in Runtime phase or not.
51 
52   @param  None.
53 
54   @retval  TRUE  The driver is in SMM.
55   @retval  FALSE The driver is not in SMM.
56 
57 **/
58 BOOLEAN
59 EFIAPI
60 EfiAtRuntime (
61   VOID
62   );
63 
64 /**
65   Check to see if the SetVirtualAddressMsp() is invoked or not.
66 
67   @retval  TRUE  SetVirtualAddressMsp() has been called.
68   @retval  FALSE SetVirtualAddressMsp() has not been called.
69 
70 **/
71 BOOLEAN
72 EFIAPI
73 EfiGoneVirtual (
74   VOID
75   );
76 
77 /**
78   Return current time and date information, and time-keeping
79   capabilities of hardware platform.
80 
81   @param  Time         A pointer to storage to receive a snapshot of the current time.
82   @param  Capabilities An optional pointer to a buffer to receive the real time clock device's
83                        capabilities.
84 
85   @retval  EFI_SUCCESS  Success to execute the function.
86   @retval  !EFI_SUCCESS Failed to e3xecute the function.
87 
88 **/
89 EFI_STATUS
90 EFIAPI
91 EfiGetTime (
92   OUT EFI_TIME                    *Time,
93   OUT EFI_TIME_CAPABILITIES       *Capabilities
94   );
95 
96 /**
97   Set current time and date information.
98 
99   @param  Time         A pointer to cache of time setting.
100 
101   @retval  EFI_SUCCESS  Success to execute the function.
102   @retval  !EFI_SUCCESS Failed to execute the function.
103 
104 **/
105 EFI_STATUS
106 EFIAPI
107 EfiSetTime (
108   IN EFI_TIME                   *Time
109   );
110 
111 /**
112   Return current wakeup alarm clock setting.
113 
114   @param  Enabled Indicate if the alarm clock is enabled or disabled.
115   @param  Pending Indicate if the alarm signal is pending and requires acknowledgement.
116   @param  Time    Current alarm clock setting.
117 
118   @retval  EFI_SUCCESS  Success to execute the function.
119   @retval  !EFI_SUCCESS Failed to e3xecute the function.
120 
121 **/
122 EFI_STATUS
123 EFIAPI
124 EfiGetWakeupTime (
125   OUT BOOLEAN                     *Enabled,
126   OUT BOOLEAN                     *Pending,
127   OUT EFI_TIME                    *Time
128   );
129 
130 /**
131   Set current wakeup alarm clock.
132 
133   @param  Enable Enable or disable current alarm clock..
134   @param  Time   Point to alarm clock setting.
135 
136   @retval  EFI_SUCCESS  Success to execute the function.
137   @retval  !EFI_SUCCESS Failed to e3xecute the function.
138 
139 **/
140 EFI_STATUS
141 EFIAPI
142 EfiSetWakeupTime (
143   IN BOOLEAN                      Enable,
144   IN EFI_TIME                     *Time
145   );
146 
147 /**
148   Return value of variable.
149 
150   @param  VariableName the name of the vendor's variable, it's a
151                        Null-Terminated Unicode String
152   @param  VendorGuid   Unify identifier for vendor.
153   @param  Attributes   Point to memory location to return the attributes of variable. If the point
154                        is NULL, the parameter would be ignored.
155   @param  DataSize     As input, point to the maxinum size of return Data-Buffer.
156                        As output, point to the actual size of the returned Data-Buffer.
157   @param  Data         Point to return Data-Buffer.
158 
159   @retval  EFI_SUCCESS  Success to execute the function.
160   @retval  !EFI_SUCCESS Failed to e3xecute the function.
161 
162 **/
163 EFI_STATUS
164 EFIAPI
165 EfiGetVariable (
166   IN      CHAR16                   *VariableName,
167   IN      EFI_GUID                 *VendorGuid,
168   OUT     UINT32                   *Attributes,
169   IN OUT  UINTN                    *DataSize,
170   OUT     VOID                     *Data
171   );
172 
173 /**
174   Enumerates variable's name.
175 
176   @param  VariableNameSize As input, point to maxinum size of variable name.
177                            As output, point to actual size of varaible name.
178   @param  VariableName     As input, supplies the last VariableName that was returned by
179                            GetNextVariableName().
180                            As output, returns the name of variable. The name
181                            string is Null-Terminated Unicode string.
182   @param  VendorGuid       As input, supplies the last VendorGuid that was returned by
183                            GetNextVriableName().
184                            As output, returns the VendorGuid of the current variable.
185 
186   @retval  EFI_SUCCESS  Success to execute the function.
187   @retval  !EFI_SUCCESS Failed to e3xecute the function.
188 
189 **/
190 EFI_STATUS
191 EFIAPI
192 EfiGetNextVariableName (
193   IN OUT UINTN                    *VariableNameSize,
194   IN OUT CHAR16                   *VariableName,
195   IN OUT EFI_GUID                 *VendorGuid
196   );
197 
198 /**
199   Sets value of variable.
200 
201   @param  VariableName the name of the vendor's variable, it's a
202                        Null-Terminated Unicode String
203   @param  VendorGuid   Unify identifier for vendor.
204   @param  Attributes   Point to memory location to return the attributes of variable. If the point
205                        is NULL, the parameter would be ignored.
206   @param  DataSize     The size in bytes of Data-Buffer.
207   @param  Data         Point to the content of the variable.
208 
209   @retval  EFI_SUCCESS  Success to execute the function.
210   @retval  !EFI_SUCCESS Failed to e3xecute the function.
211 
212 **/
213 EFI_STATUS
214 EFIAPI
215 EfiSetVariable (
216   IN CHAR16                       *VariableName,
217   IN EFI_GUID                     *VendorGuid,
218   IN UINT32                       Attributes,
219   IN UINTN                        DataSize,
220   IN VOID                         *Data
221   );
222 
223 /**
224   Returns the next high 32 bits of platform's monotonic counter.
225 
226   @param  HighCount Pointer to returned value.
227 
228   @retval  EFI_SUCCESS  Success to execute the function.
229   @retval  !EFI_SUCCESS Failed to e3xecute the function.
230 
231 **/
232 EFI_STATUS
233 EFIAPI
234 EfiGetNextHighMonotonicCount (
235   OUT UINT32                      *HighCount
236   );
237 
238 /**
239   Resets the entire platform.
240 
241   @param  ResetType   The type of reset to perform.
242   @param  ResetStatus The status code for reset.
243   @param  DataSize    The size in bytes of reset data.
244   @param  ResetData   Pointer to data buffer that includes
245                       Null-Terminated Unicode string.
246 
247   @retval  EFI_SUCCESS  Success to execute the function.
248   @retval  !EFI_SUCCESS Failed to e3xecute the function.
249 
250 **/
251 VOID
252 EFIAPI
253 EfiResetSystem (
254   IN EFI_RESET_TYPE               ResetType,
255   IN EFI_STATUS                   ResetStatus,
256   IN UINTN                        DataSize,
257   IN CHAR16                       *ResetData
258   );
259 
260 /**
261   Determines the new virtual address that is to be used on subsequent memory accesses.
262 
263   @param  DebugDisposition   Supplies type information for the pointer being converted.
264   @param  Address            The pointer to a pointer that is to be fixed to be the
265                              value needed for the new virtual address mapping being
266                              applied.
267 
268   @retval  EFI_SUCCESS  Success to execute the function.
269   @retval  !EFI_SUCCESS Failed to e3xecute the function.
270 
271 **/
272 EFI_STATUS
273 EFIAPI
274 EfiConvertPointer (
275   IN UINTN                  DebugDisposition,
276   IN OUT VOID               **Address
277   );
278 
279 
280 /**
281   Change the runtime addressing mode of EFI firmware from physical to virtual.
282 
283   @param  MemoryMapSize         The size in bytes of VirtualMap.
284   @param  DescriptorSize        The size in bytes of an entry in the VirtualMap.
285   @param  DescriptorVersion     The version of the structure entries in VirtualMap.
286   @param  VirtualMap            An array of memory descriptors which contain new virtual
287                                 address mapping information for all runtime ranges. Type
288                                 EFI_MEMORY_DESCRIPTOR is defined in the
289                                 GetMemoryMap() function description.
290 
291   @retval EFI_SUCCESS           The virtual address map has been applied.
292   @retval EFI_UNSUPPORTED       EFI firmware is not at runtime, or the EFI firmware is already in
293                                 virtual address mapped mode.
294   @retval EFI_INVALID_PARAMETER DescriptorSize or DescriptorVersion is
295                                 invalid.
296   @retval EFI_NO_MAPPING        A virtual address was not supplied for a range in the memory
297                                 map that requires a mapping.
298   @retval EFI_NOT_FOUND         A virtual address was supplied for an address that is not found
299                                 in the memory map.
300 **/
301 EFI_STATUS
302 EFIAPI
303 EfiSetVirtualAddressMap (
304   IN UINTN                          MemoryMapSize,
305   IN UINTN                          DescriptorSize,
306   IN UINT32                         DescriptorVersion,
307   IN CONST EFI_MEMORY_DESCRIPTOR    *VirtualMap
308   );
309 
310 
311 /**
312   Conver the standard Lib double linked list to a virtual mapping.
313 
314   @param  DebugDisposition   Supplies type information for the pointer being converted.
315   @param  ListHead           Head of linked list to convert.
316 
317   @retval  EFI_SUCCESS  Success to execute the function.
318   @retval  !EFI_SUCCESS Failed to e3xecute the function.
319 
320 **/
321 EFI_STATUS
322 EFIAPI
323 EfiConvertList (
324   IN UINTN                DebugDisposition,
325   IN OUT LIST_ENTRY       *ListHead
326   );
327 
328 /**
329 
330   Passes capsules to the firmware with both virtual and physical mapping.
331   Depending on the intended consumption, the firmware may
332   process the capsule immediately. If the payload should persist across a
333   system reset, the reset value returned from EFI_QueryCapsuleCapabilities must
334   be passed into ResetSystem() and will cause the capsule to be processed by
335   the firmware as part of the reset process.
336 
337   @param  CapsuleHeaderArray    Virtual pointer to an array of virtual pointers to the capsules
338                                 being passed into update capsule. Each capsules is assumed to
339                                 stored in contiguous virtual memory. The capsules in the
340                                 CapsuleHeaderArray must be the same capsules as the
341                                 ScatterGatherList. The CapsuleHeaderArray must
342                                 have the capsules in the same order as the ScatterGatherList.
343   @param  CapsuleCount          Number of pointers to EFI_CAPSULE_HEADER in
344                                 CaspuleHeaderArray.
345   @param  ScatterGatherList     Physical pointer to a set of
346                                 EFI_CAPSULE_BLOCK_DESCRIPTOR that describes the
347                                 location in physical memory of a set of capsules. See Related
348                                 Definitions for an explanation of how more than one capsule is
349                                 passed via this interface. The capsules in the
350                                 ScatterGatherList must be in the same order as the
351                                 CapsuleHeaderArray. This parameter is only referenced if
352                                 the capsules are defined to persist across system reset.
353 
354   @retval EFI_SUCCESS           Valid capsule was passed. I Valid capsule was passed. If
355                                 CAPSULE_FLAGS_PERSIT_ACROSS_RESET is not set, the
356                                 capsule has been successfully processed by the firmware.
357   @retval EFI_INVALID_PARAMETER CapsuleSize is NULL or ResetTye is NULL.
358   @retval EFI_DEVICE_ERROR      The capsule update was started, but failed due to a device error.
359 
360 **/
361 EFI_STATUS
362 EFIAPI
363 EfiUpdateCapsule (
364   IN UEFI_CAPSULE_HEADER      **CapsuleHeaderArray,
365   IN UINTN                    CapsuleCount,
366   IN EFI_PHYSICAL_ADDRESS     ScatterGatherList
367   );
368 
369 
370 /**
371 
372   The QueryCapsuleCapabilities() function allows a caller to test to see if a capsule or
373   capsules can be updated via UpdateCapsule(). The Flags values in the capsule header and
374   size of the entire capsule is checked.
375   If the caller needs to query for generic capsule capability a fake EFI_CAPSULE_HEADER can be
376   constructed where CapsuleImageSize is equal to HeaderSize that is equal to sizeof
377   (EFI_CAPSULE_HEADER). To determine reset requirements,
378   CAPSULE_FLAGS_PERSIST_ACROSS_RESET should be set in the Flags field of the
379   EFI_CAPSULE_HEADER.
380   The firmware must support any capsule that has the
381   CAPSULE_FLAGS_PERSIST_ACROSS_RESET flag set in EFI_CAPSULE_HEADER. The
382   firmware sets the policy for what capsules are supported that do not have the
383   CAPSULE_FLAGS_PERSIST_ACROSS_RESET flag set.
384 
385   @param  CapsuleHeaderArray    Virtual pointer to an array of virtual pointers to the capsules
386                                 being passed into update capsule. The capsules are assumed to
387                                 stored in contiguous virtual memory.
388   @param  CapsuleCount          Number of pointers to EFI_CAPSULE_HEADER in
389                                 CaspuleHeaderArray.
390   @param  MaxiumCapsuleSize     On output the maximum size that UpdateCapsule() can
391                                 support as an argument to UpdateCapsule() via
392                                 CapsuleHeaderArray and ScatterGatherList.
393                                 Undefined on input.
394   @param  ResetType             Returns the type of reset required for the capsule update.
395 
396   @retval EFI_SUCCESS           Valid answer returned..
397   @retval EFI_INVALID_PARAMETER MaximumCapsuleSize is NULL.
398   @retval EFI_UNSUPPORTED       The capsule type is not supported on this platform, and
399                                 MaximumCapsuleSize and ResetType are undefined.
400 
401 **/
402 EFI_STATUS
403 EFIAPI
404 EfiQueryCapsuleCapabilities (
405   IN UEFI_CAPSULE_HEADER       **CapsuleHeaderArray,
406   IN UINTN                     CapsuleCount,
407   OUT UINT64                   *MaximumCapsuleSize,
408   OUT EFI_RESET_TYPE           *ResetType
409   );
410 
411 
412 /**
413 
414   The QueryVariableInfo() function allows a caller to obtain the information about the
415   maximum size of the storage space available for the EFI variables, the remaining size of the storage
416   space available for the EFI variables and the maximum size of each individual EFI variable,
417   associated with the attributes specified.
418   The returned MaximumVariableStorageSize, RemainingVariableStorageSize,
419   MaximumVariableSize information may change immediately after the call based on other
420   runtime activities including asynchronous error events. Also, these values associated with different
421   attributes are not additive in nature.
422 
423   @param  Attributes            Attributes bitmask to specify the type of variables on
424                                 which to return information. Refer to the
425                                 GetVariable() function description.
426   @param  MaximumVariableStorageSize
427                                 On output the maximum size of the storage space
428                                 available for the EFI variables associated with the
429                                 attributes specified.
430   @param  RemainingVariableStorageSize
431                                 Returns the remaining size of the storage space
432                                 available for the EFI variables associated with the
433                                 attributes specified..
434   @param  MaximumVariableSize   Returns the maximum size of the individual EFI
435                                 variables associated with the attributes specified.
436 
437   @retval EFI_SUCCESS           Valid answer returned.
438   @retval EFI_INVALID_PARAMETER An invalid combination of attribute bits was supplied.
439   @retval EFI_UNSUPPORTED       EFI_UNSUPPORTED The attribute is not supported on this platform, and the
440                                 MaximumVariableStorageSize,
441                                 RemainingVariableStorageSize, MaximumVariableSize
442                                 are undefined.
443 **/
444 EFI_STATUS
445 EFIAPI
446 EfiQueryVariableInfo (
447   IN UINT32   Attrubutes,
448   OUT UINT64  *MaximumVariableStorageSize,
449   OUT UINT64  *RemainingVariableStorageSize,
450   OUT UINT64  *MaximumVariableSize
451   );
452 
453 #endif
454 
455