diff options
Diffstat (limited to 'roms/edk2/MdePkg/Library/UefiBootServicesTableLib')
3 files changed, 111 insertions, 0 deletions
diff --git a/roms/edk2/MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.c b/roms/edk2/MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.c new file mode 100644 index 000000000..4fb6bc8fb --- /dev/null +++ b/roms/edk2/MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.c @@ -0,0 +1,60 @@ +/** @file
+ This library retrieve the EFI_BOOT_SERVICES pointer from EFI system table in
+ library's constructor.
+
+ Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+
+#include <Uefi.h>
+
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/DebugLib.h>
+
+EFI_HANDLE gImageHandle = NULL;
+EFI_SYSTEM_TABLE *gST = NULL;
+EFI_BOOT_SERVICES *gBS = NULL;
+
+/**
+ The constructor function caches the pointer of Boot Services Table.
+
+ The constructor function caches the pointer of Boot Services Table through System Table.
+ It will ASSERT() if the pointer of System Table is NULL.
+ It will ASSERT() if the pointer of Boot Services Table is NULL.
+ It will always return EFI_SUCCESS.
+
+ @param ImageHandle The firmware allocated handle for the EFI image.
+ @param SystemTable A pointer to the EFI System Table.
+
+ @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
+
+**/
+EFI_STATUS
+EFIAPI
+UefiBootServicesTableLibConstructor (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ //
+ // Cache the Image Handle
+ //
+ gImageHandle = ImageHandle;
+ ASSERT (gImageHandle != NULL);
+
+ //
+ // Cache pointer to the EFI System Table
+ //
+ gST = SystemTable;
+ ASSERT (gST != NULL);
+
+ //
+ // Cache pointer to the EFI Boot Services Table
+ //
+ gBS = SystemTable->BootServices;
+ ASSERT (gBS != NULL);
+
+ return EFI_SUCCESS;
+}
diff --git a/roms/edk2/MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf b/roms/edk2/MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf new file mode 100644 index 000000000..3a17dc18f --- /dev/null +++ b/roms/edk2/MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf @@ -0,0 +1,35 @@ +## @file
+# UEFI Boot Services Table Library implementation.
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = UefiBootServicesTableLib
+ MODULE_UNI_FILE = UefiBootServicesTableLib.uni
+ FILE_GUID = ff5c7a2c-ab7a-4366-8616-11c6e53247b6
+ MODULE_TYPE = UEFI_DRIVER
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = UefiBootServicesTableLib|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER SMM_CORE
+
+ CONSTRUCTOR = UefiBootServicesTableLibConstructor
+
+#
+# VALID_ARCHITECTURES = IA32 X64 EBC
+#
+
+[Sources]
+ UefiBootServicesTableLib.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+
+
+[LibraryClasses]
+ DebugLib
+
diff --git a/roms/edk2/MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.uni b/roms/edk2/MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.uni new file mode 100644 index 000000000..a7698f70b --- /dev/null +++ b/roms/edk2/MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.uni @@ -0,0 +1,16 @@ +// /** @file
+// UEFI Boot Services Table Library implementation.
+//
+// UEFI Boot Services Table Library implementation.
+//
+// Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
+//
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+//
+// **/
+
+
+#string STR_MODULE_ABSTRACT #language en-US "UEFI Boot Services Table Library implementation"
+
+#string STR_MODULE_DESCRIPTION #language en-US "UEFI Boot Services Table Library implementation."
+
|