+++ /dev/null
-/*++\r
-\r
-Copyright (c) 2004, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials \r
-are licensed and made available under the terms and conditions of the BSD License \r
-which accompanies this distribution. The full text of the license may be found at \r
-http://opensource.org/licenses/bsd-license.php \r
- \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
-\r
-Module Name:\r
- \r
- EfiMgmtModeRuntimeLib.h\r
-\r
-Abstract:\r
-\r
- Light weight lib to support EFI drivers.\r
-\r
---*/\r
-\r
-#ifndef _EFI_RT_SUPPORT_LIB_H_\r
-#define _EFI_RT_SUPPORT_LIB_H_\r
-\r
-#ifndef EFI_LOAD_IMAGE_SMM\r
-#define EFI_LOAD_DRIVER_SMM FALSE\r
-#else\r
-#define EFI_LOAD_DRIVER_SMM TRUE\r
-#endif\r
-\r
-#ifndef EFI_NO_LOAD_IMAGE_RT\r
-#define EFI_NO_LOAD_DRIVER_RT FALSE\r
-#else\r
-#define EFI_NO_LOAD_DRIVER_RT TRUE\r
-#endif\r
-\r
-#include "EfiCommonLib.h"\r
-#include "LinkedList.h"\r
-#include "ProcDep.h"\r
-\r
-#include EFI_PROTOCOL_DEFINITION (CpuIo)\r
-#include EFI_PROTOCOL_DEFINITION (FirmwareVolumeBlock)\r
-\r
-//\r
-// Driver Lib Globals.\r
-//\r
-extern EFI_BOOT_SERVICES *gBS;\r
-extern EFI_SYSTEM_TABLE *gST;\r
-extern UINTN gRtErrorLevel;\r
-extern BOOLEAN mEfiLoadDriverSmm;\r
-extern BOOLEAN mEfiNoLoadDriverRt;\r
-extern EFI_DEVICE_PATH_PROTOCOL *mFilePath;\r
-\r
-//\r
-// Runtime Memory Allocation/De-Allocation tools (Should be used in Boot Phase only)\r
-//\r
-EFI_STATUS\r
-EfiAllocateRuntimeMemoryPool (\r
- IN UINTN Size,\r
- OUT VOID **Buffer\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Allocate EfiRuntimeServicesData pool of specified size.\r
-\r
-Arguments:\r
-\r
- Size - Pool size\r
- Buffer - Memory pointer for output\r
-\r
-Returns:\r
-\r
- Status code\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-EfiFreeRuntimeMemoryPool (\r
- IN VOID *Buffer\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Free allocated pool\r
-\r
-Arguments:\r
-\r
- Buffer - Pool to be freed\r
-\r
-Returns:\r
-\r
- Status code\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-EfiLocateProtocolHandleBuffers (\r
- IN EFI_GUID *Protocol,\r
- IN OUT UINTN *NumberHandles,\r
- OUT EFI_HANDLE **Buffer\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Returns an array of handles that support the requested protocol in a buffer allocated from pool.\r
-\r
-Arguments:\r
-\r
- Protocol - Provides the protocol to search by.\r
- NumberHandles - The number of handles returned in Buffer.\r
- Buffer - A pointer to the buffer to return the requested array of handles that\r
- support Protocol.\r
-\r
-Returns:\r
-\r
- Status code\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-EfiHandleProtocol (\r
- IN EFI_HANDLE Handle,\r
- IN EFI_GUID *Protocol,\r
- OUT VOID **Interface\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Queries a handle to determine if it supports a specified protocol.\r
-\r
-Arguments:\r
-\r
- Handle - The handle being queried.\r
- Protocol - The published unique identifier of the protocol.\r
- Interface - Supplies the address where a pointer to the corresponding Protocol\r
- Interface is returned. NULL will be returned in *Interface if a\r
- structure is not associated with Protocol.\r
-\r
-Returns:\r
-\r
- Status code\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-EfiInstallProtocolInterface (\r
- IN OUT EFI_HANDLE *Handle,\r
- IN EFI_GUID *Protocol,\r
- IN EFI_INTERFACE_TYPE InterfaceType,\r
- IN VOID *Interface\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Installs a protocol interface on a device handle. If the handle does not exist, it is created and added\r
-to the list of handles in the system.\r
-\r
-Arguments:\r
-\r
- Handle - A pointer to the EFI_HANDLE on which the interface is to be installed.\r
- Protocol - The numeric ID of the protocol interface.\r
- InterfaceType - Indicates whether Interface is supplied in native form.\r
- Interface - A pointer to the protocol interface.\r
-\r
-Returns:\r
-\r
- Status code\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-EfiReinstallProtocolInterface (\r
- IN EFI_HANDLE SmmProtocolHandle,\r
- IN EFI_GUID *Protocol,\r
- IN VOID *OldInterface,\r
- IN VOID *NewInterface\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Reinstalls a protocol interface on a device handle.\r
-\r
-Arguments:\r
-\r
- SmmProtocolHandle - Handle on which the interface is to be reinstalled.\r
- Protocol - The numeric ID of the interface.\r
- OldInterface - A pointer to the old interface.\r
- NewInterface - A pointer to the new interface.\r
-\r
-Returns:\r
-\r
- Status code\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-EfiLocateProtocolInterface (\r
- EFI_GUID *Protocol,\r
- VOID *Registration, OPTIONAL\r
- VOID **Interface\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Returns the first protocol instance that matches the given protocol.\r
-\r
-Arguments:\r
-\r
- Protocol - Provides the protocol to search for.\r
- Registration - Optional registration key returned from\r
- RegisterProtocolNotify(). If Registration is NULL, then\r
- it is ignored.\r
- Interface - On return, a pointer to the first interface that matches Protocol and\r
- Registration.\r
-\r
-Returns:\r
-\r
- Status code\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-UninstallProtocolInterface (\r
- IN EFI_HANDLE SmmProtocolHandle,\r
- IN EFI_GUID *Protocol,\r
- IN VOID *Interface\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Removes a protocol interface from a device handle.\r
-\r
-Arguments:\r
-\r
- SmmProtocolHandle - The handle on which the interface was installed.\r
- Protocol - The numeric ID of the interface.\r
- Interface - A pointer to the interface.\r
-\r
-Returns:\r
-\r
- Status code\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-EfiRegisterProtocolCallback (\r
- IN EFI_EVENT_NOTIFY CallbackFunction,\r
- IN VOID *Context,\r
- IN EFI_GUID *ProtocolGuid,\r
- IN EFI_TPL NotifyTpl,\r
- OUT VOID **Registeration,\r
- OUT EFI_EVENT *Event\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Register a callback function to be signaled whenever an interface is installed for \r
- a specified protocol.\r
-\r
-Arguments:\r
-\r
- CallbackFunction - Call back function\r
- Context - Context of call back function\r
- ProtocolGuid - The numeric ID of the protocol for which the callback function\r
- is to be registered.\r
- NotifyTpl - Notify tpl of callback function\r
- Registeration - A pointer to a memory location to receive the registration value.\r
- Event - Event that is to be signaled whenever a protocol interface is registered\r
- for Protocol.\r
-\r
-Returns:\r
-\r
- Status code\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-EfiSignalProtocolEvent (\r
- EFI_EVENT Event\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Signals an event.\r
-\r
-Arguments:\r
-\r
- Event - The event to signal.\r
-\r
-Returns:\r
-\r
- Status code\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-EfiInstallVendorConfigurationTable (\r
- IN EFI_GUID *Guid,\r
- IN VOID *Table\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Adds, updates, or removes a configuration table entry from the EFI System Table.\r
-\r
-Arguments:\r
-\r
- Guid - A pointer to the GUID for the entry to add, update, or remove.\r
- Table - A pointer to the configuration table for the entry to add, update, or\r
- remove. May be NULL.\r
-\r
-Returns:\r
-\r
- Status code\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-EfiGetVendorConfigurationTable (\r
- IN EFI_GUID *Guid,\r
- OUT VOID **Table\r
- )\r
-/*++\r
-\r
-Routine Description:\r
- \r
- Return the EFI 1.0 System Tabl entry with TableGuid\r
-\r
-Arguments:\r
-\r
- Guid - Name of entry to return in the system table\r
- Table - Pointer in EFI system table associated with TableGuid\r
-\r
-Returns: \r
-\r
- EFI_SUCCESS - Table returned;\r
- EFI_NOT_FOUND - TableGuid not in EFI system table\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-EfiInitializeUtilsRuntimeDriverLib (\r
- IN EFI_HANDLE ImageHandle,\r
- IN EFI_SYSTEM_TABLE *SystemTable,\r
- IN EFI_EVENT_NOTIFY GoVirtualChildEvent\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Intialize runtime Driver Lib if it has not yet been initialized. \r
-\r
-Arguments:\r
-\r
- ImageHandle - The firmware allocated handle for the EFI image.\r
- \r
- SystemTable - A pointer to the EFI System Table.\r
-\r
- GoVirtualChildEvent - Caller can register a virtual notification event.\r
-\r
-Returns: \r
-\r
- EFI_STATUS always returns EFI_SUCCESS\r
-\r
---*/\r
-;\r
-\r
-BOOLEAN\r
-EfiInManagementInterrupt (\r
- VOID\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Indicate whether the caller is already in SMM or not.\r
-\r
-Arguments:\r
-\r
- None\r
-\r
-Returns:\r
-\r
- TRUE - In SMM\r
- FALSE - Not in SMM\r
-\r
---*/\r
-;\r
-\r
-//\r
-// This MACRO initializes the RUNTIME invironment and optionally loads Image to SMM or Non-SMM space\r
-// based upon the presence of build flags EFI_LOAD_DRIVER_SMM and EFI_NO_LOAD_DRIVER_RT.\r
-//\r
-#define EFI_INITIALIZE_RUNTIME_DRIVER_LIB(ImageHandle, SystemTable, GoVirtualChildEvent, FilePath) \\r
- mEfiLoadDriverSmm = EFI_LOAD_DRIVER_SMM; \\r
- mEfiNoLoadDriverRt = EFI_NO_LOAD_DRIVER_RT; \\r
- mFilePath = (EFI_DEVICE_PATH_PROTOCOL*) FilePath; \\r
- EfiInitializeUtilsRuntimeDriverLib ((EFI_HANDLE) ImageHandle, (EFI_SYSTEM_TABLE*) SystemTable, (EFI_EVENT_NOTIFY) GoVirtualChildEvent); \\r
- if (!EfiInManagementInterrupt()) { \\r
- if (mEfiNoLoadDriverRt) { \\r
- return EFI_SUCCESS; \\r
- } \\r
- } \r
-\r
-#endif\r