Vishal Bhoj | 82c8071 | 2015-12-15 21:13:33 +0530 | [diff] [blame^] | 1 | /** @file
|
| 2 | This library retrieve the EFI_BOOT_SERVICES pointer from EFI system table in
|
| 3 | library's constructor.
|
| 4 |
|
| 5 | Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
|
| 6 | This program and the accompanying materials
|
| 7 | are licensed and made available under the terms and conditions of the BSD License
|
| 8 | which accompanies this distribution. The full text of the license may be found at
|
| 9 | http://opensource.org/licenses/bsd-license.php.
|
| 10 |
|
| 11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
| 12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
| 13 |
|
| 14 | **/
|
| 15 |
|
| 16 |
|
| 17 | #include <Uefi.h>
|
| 18 |
|
| 19 | #include <Library/UefiBootServicesTableLib.h>
|
| 20 | #include <Library/DebugLib.h>
|
| 21 |
|
| 22 | EFI_HANDLE gImageHandle = NULL;
|
| 23 | EFI_SYSTEM_TABLE *gST = NULL;
|
| 24 | EFI_BOOT_SERVICES *gBS = NULL;
|
| 25 |
|
| 26 | /**
|
| 27 | The constructor function caches the pointer of Boot Services Table.
|
| 28 |
|
| 29 | The constructor function caches the pointer of Boot Services Table through System Table.
|
| 30 | It will ASSERT() if the pointer of System Table is NULL.
|
| 31 | It will ASSERT() if the pointer of Boot Services Table is NULL.
|
| 32 | It will always return EFI_SUCCESS.
|
| 33 |
|
| 34 | @param ImageHandle The firmware allocated handle for the EFI image.
|
| 35 | @param SystemTable A pointer to the EFI System Table.
|
| 36 |
|
| 37 | @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
|
| 38 |
|
| 39 | **/
|
| 40 | EFI_STATUS
|
| 41 | EFIAPI
|
| 42 | UefiBootServicesTableLibConstructor (
|
| 43 | IN EFI_HANDLE ImageHandle,
|
| 44 | IN EFI_SYSTEM_TABLE *SystemTable
|
| 45 | )
|
| 46 | {
|
| 47 | //
|
| 48 | // Cache the Image Handle
|
| 49 | //
|
| 50 | gImageHandle = ImageHandle;
|
| 51 | ASSERT (gImageHandle != NULL);
|
| 52 |
|
| 53 | //
|
| 54 | // Cache pointer to the EFI System Table
|
| 55 | //
|
| 56 | gST = SystemTable;
|
| 57 | ASSERT (gST != NULL);
|
| 58 |
|
| 59 | //
|
| 60 | // Cache pointer to the EFI Boot Services Table
|
| 61 | //
|
| 62 | gBS = SystemTable->BootServices;
|
| 63 | ASSERT (gBS != NULL);
|
| 64 |
|
| 65 | return EFI_SUCCESS;
|
| 66 | }
|