efiruntimelib.h
来自「EFI BIOS是Intel提出的下一代的BIOS标准。这里上传的Edk源代码是」· C头文件 代码 · 共 1,693 行 · 第 1/3 页
H
1,693 行
/*++
Copyright (c) 2004 - 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
EfiRuntimeLib.h
Abstract:
Light weight lib to support EFI drivers.
--*/
#ifndef _EFI_RUNTIME_LIB_H_
#define _EFI_RUNTIME_LIB_H_
#define MAX_FVB_COUNT 16
#include "EfiStatusCode.h"
#include "EfiCommonLib.h"
#include "LinkedList.h"
#include "GetImage.h"
#include "RtDevicePath.h"
#include EFI_GUID_DEFINITION (DxeServices)
#include EFI_GUID_DEFINITION (EventGroup)
#include EFI_GUID_DEFINITION (EventLegacyBios)
#include EFI_PROTOCOL_DEFINITION (CpuIo)
#include EFI_PROTOCOL_DEFINITION (FirmwareVolume)
#include EFI_PROTOCOL_DEFINITION (FirmwareVolumeBlock)
#include EFI_PROTOCOL_DEFINITION (FvbExtension)
#include "ProcDep.h"
typedef struct {
EFI_HANDLE Handle;
EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb;
EFI_FVB_EXTENSION_PROTOCOL *FvbExtension;
} FVB_ENTRY;
//
// Driver Lib Globals.
//
extern EFI_BOOT_SERVICES *gBS;
extern EFI_SYSTEM_TABLE *gST;
extern EFI_DXE_SERVICES *gDS;
extern UINTN gRtErrorLevel;
extern FVB_ENTRY *mFvbEntry;
VOID
EFIAPI
EfiRuntimeLibFvbVirtualNotifyEvent (
IN EFI_EVENT Event,
IN VOID *Context
)
/*++
Routine Description:
Notify function to convert pointers to Fvb functions after ExitBootServices
Arguments:
Event - Event whose notification function is being invoked.
Context - Pointer to the notification function’s context, which is
implementation-dependent.
Returns:
None
--*/
;
EFI_STATUS
EfiInitializeRuntimeDriverLib (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable,
IN EFI_EVENT_NOTIFY RuntimeNotifyEventHandler
)
/*++
Routine Description:
Intialize Runtime Driver Lib if it has not yet been initialized.
Arguments:
ImageHandle - The firmware allocated handle for the EFI image.
SystemTable - A pointer to the EFI System Table.
RuntimeNotifyEventHandler - Virtual address change notification event
Returns:
EFI_STATUS always returns EFI_SUCCESS
--*/
;
EFI_STATUS
EfiShutdownRuntimeDriverLib (
VOID
)
/*++
Routine Description:
This routine will free some resources which have been allocated in
EfiInitializeRuntimeDriverLib(). If a runtime driver exits with an error,
it must call this routine to free the allocated resource before the exiting.
Arguments:
None
Returns:
EFI_SUCCESS - Shotdown the Runtime Driver Lib successfully
EFI_UNSUPPORTED - Runtime Driver lib was not initialized at all
--*/
;
EFI_STATUS
EfiInitializeSmmDriverLib (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
/*++
Routine Description:
Intialize Smm Driver Lib if it has not yet been initialized.
Arguments:
ImageHandle - The firmware allocated handle for the EFI image.
SystemTable - A pointer to the EFI System Table.
Returns:
EFI_STATUS always returns EFI_SUCCESS
--*/
;
EFI_STATUS
EfiLibGetSystemConfigurationTable (
IN EFI_GUID *TableGuid,
IN OUT VOID **Table
)
/*++
Routine Description:
Return the EFI 1.0 System Tabl entry with TableGuid
Arguments:
TableGuid - Name of entry to return in the system table
Table - Pointer in EFI system table associated with TableGuid
Returns:
EFI_SUCCESS - Table returned;
EFI_NOT_FOUND - TableGuid not in EFI system table
--*/
;
BOOLEAN
EfiAtRuntime (
VOID
)
/*++
Routine Description:
Am I at runtime?
Arguments:
None
Returns:
TRUE - At runtime
FALSE - Not at runtime
--*/
;
BOOLEAN
EfiGoneVirtual (
VOID
)
/*++
Routine Description:
Return TRUE if SetVirtualAddressMap () has been called
Arguments:
NONE
Returns:
TRUE - If SetVirtualAddressMap () has been called
FALSE - If SetVirtualAddressMap () has not been called
--*/
;
EFI_STATUS
EfiLibGetSystemConfigurationTable (
IN EFI_GUID *TableGuid,
IN OUT VOID **Table
)
/*++
Routine Description:
Get table from configuration table by name
Arguments:
TableGuid - Table name to search
Table - Pointer to the table caller wants
Returns:
EFI_NOT_FOUND - Not found the table
EFI_SUCCESS - Found the table
--*/
;
EFI_EVENT
RtEfiLibCreateProtocolNotifyEvent (
IN EFI_GUID *ProtocolGuid,
IN EFI_TPL NotifyTpl,
IN EFI_EVENT_NOTIFY NotifyFunction,
IN VOID *NotifyContext,
OUT VOID **Registration
)
/*++
Routine Description:
Create a protocol notification event and return it.
Arguments:
ProtocolGuid - Protocol to register notification event on.
NotifyTpl - Maximum TPL to single the NotifyFunction.
NotifyFunction - EFI notification routine.
NotifyContext - Context passed into Event when it is created.
Registration - Registration key returned from RegisterProtocolNotify().
Returns:
The EFI_EVENT that has been registered to be signaled when a ProtocolGuid
is added to the system.
--*/
;
//
// Lock.c
//
typedef struct {
EFI_TPL Tpl;
EFI_TPL OwnerTpl;
UINTN Lock;
} EFI_LOCK;
VOID
EfiInitializeLock (
IN OUT EFI_LOCK *Lock,
IN EFI_TPL Priority
)
/*++
Routine Description:
Initialize a basic mutual exclusion lock. Each lock
provides mutual exclusion access at it's task priority
level. Since there is no-premption (at any TPL) or
multiprocessor support, acquiring the lock only consists
of raising to the locks TPL.
Note on a check build ASSERT()s are used to ensure proper
lock usage.
Arguments:
Lock - The EFI_LOCK structure to initialize
Priority - The task priority level of the lock
Returns:
An initialized Efi Lock structure.
--*/
;
//
// Macro to initialize the state of a lock when a lock variable is declared
//
#define EFI_INITIALIZE_LOCK_VARIABLE(Tpl) {Tpl,0,0}
VOID
EfiAcquireLock (
IN EFI_LOCK *Lock
)
/*++
Routine Description:
Raising to the task priority level of the mutual exclusion
lock, and then acquires ownership of the lock.
Arguments:
Lock - The lock to acquire
Returns:
Lock owned
--*/
;
EFI_STATUS
EfiAcquireLockOrFail (
IN EFI_LOCK *Lock
)
/*++
Routine Description:
Initialize a basic mutual exclusion lock. Each lock
provides mutual exclusion access at it's task priority
level. Since there is no-premption (at any TPL) or
multiprocessor support, acquiring the lock only consists
of raising to the locks TPL.
Arguments:
Lock - The EFI_LOCK structure to initialize
Returns:
EFI_SUCCESS - Lock Owned.
EFI_ACCESS_DENIED - Reentrant Lock Acquisition, Lock not Owned.
--*/
;
VOID
EfiReleaseLock (
IN EFI_LOCK *Lock
)
/*++
Routine Description:
Releases ownership of the mutual exclusion lock, and
restores the previous task priority level.
Arguments:
Lock - The lock to release
Returns:
None
--*/
;
#define EfiCopyMem EfiCommonLibCopyMem
#define EfiSetMem EfiCommonLibSetMem
#define EfiZeroMem EfiCommonLibZeroMem
INTN
EfiCompareMem (
IN VOID *MemOne,
IN VOID *MemTwo,
IN UINTN Len
)
/*++
Routine Description:
Compares two memory buffers of a given length.
Arguments:
MemOne - First memory buffer
MemTwo - Second memory buffer
Len - Length of Mem1 and Mem2 memory regions to compare
Returns:
= 0 if MemOne == MemTwo
> 0 if MemOne > MemTwo
< 0 if MemOne < MemTwo
--*/
;
//
// Debug.c init
//
EFI_STATUS
EfiDebugAssertInit (
VOID
)
/*++
Routine Description:
Locate Debug Assert Protocol and set as mDebugAssert
Arguments:
None
Returns:
Status code
--*/
;
//
// Wrapper for EFI runtime functions
//
VOID
EfiResetSystem (
IN EFI_RESET_TYPE ResetType,
IN EFI_STATUS ResetStatus,
IN UINTN DataSize,
IN CHAR16 *ResetData
)
/*++
Routine Description:
Resets the entire platform.
Arguments:
ResetType - The type of reset to perform.
ResetStatus - The status code for the reset.
DataSize - The size, in bytes, of ResetData.
ResetData - A data buffer that includes a Null-terminated Unicode string, optionally
followed by additional binary data.
Returns:
None
--*/
;
EFI_STATUS
EfiGetNextHighMonotonicCount (
OUT UINT32 *HighCount
)
/*++
Routine Description:
Returns the next high 32 bits of the platform’s monotonic counter.
Arguments:
HighCount - Pointer to returned value.
Returns:
Status code
--*/
;
EFI_STATUS
EfiGetTime (
OUT EFI_TIME *Time,
OUT EFI_TIME_CAPABILITIES *Capabilities
)
/*++
Routine Description:
Returns the current time and date information, and the time-keeping
capabilities of the hardware platform.
Arguments:
Time - A pointer to storage to receive a snapshot of the current time.
Capabilities - An optional pointer to a buffer to receive the real time clock device’s
capabilities.
Returns:
Status code
--*/
;
EFI_STATUS
EfiSetTime (
OUT EFI_TIME *Time
)
/*++
Routine Description:
Sets the current local time and date information.
Arguments:
Time - A pointer to the current time.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?