]>
Commit | Line | Data |
---|---|---|
e386b444 | 1 | /** @file\r |
9095d37b | 2 | This library retrieve the EFI_BOOT_SERVICES pointer from EFI system table in\r |
bf295af2 | 3 | library's constructor.\r |
e386b444 | 4 | \r |
9095d37b | 5 | Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r |
9344f092 | 6 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
e386b444 | 7 | \r |
e386b444 | 8 | **/\r |
9 | \r | |
60c93673 | 10 | #include <Uefi.h>\r |
c892d846 | 11 | \r |
c7d265a9 | 12 | #include <Library/UefiBootServicesTableLib.h>\r |
13 | #include <Library/DebugLib.h>\r | |
e386b444 | 14 | \r |
15 | EFI_HANDLE gImageHandle = NULL;\r | |
16 | EFI_SYSTEM_TABLE *gST = NULL;\r | |
17 | EFI_BOOT_SERVICES *gBS = NULL;\r | |
18 | \r | |
19 | /**\r | |
20 | The constructor function caches the pointer of Boot Services Table.\r | |
9095d37b | 21 | \r |
e386b444 | 22 | The constructor function caches the pointer of Boot Services Table through System Table.\r |
23 | It will ASSERT() if the pointer of System Table is NULL.\r | |
24 | It will ASSERT() if the pointer of Boot Services Table is NULL.\r | |
25 | It will always return EFI_SUCCESS.\r | |
26 | \r | |
27 | @param ImageHandle The firmware allocated handle for the EFI image.\r | |
28 | @param SystemTable A pointer to the EFI System Table.\r | |
29 | \r | |
30 | @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.\r | |
31 | \r | |
32 | **/\r | |
33 | EFI_STATUS\r | |
34 | EFIAPI\r | |
35 | UefiBootServicesTableLibConstructor (\r | |
36 | IN EFI_HANDLE ImageHandle,\r | |
37 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
38 | )\r | |
39 | {\r | |
40 | //\r | |
41 | // Cache the Image Handle\r | |
42 | //\r | |
43 | gImageHandle = ImageHandle;\r | |
44 | ASSERT (gImageHandle != NULL);\r | |
45 | \r | |
46 | //\r | |
47 | // Cache pointer to the EFI System Table\r | |
48 | //\r | |
49 | gST = SystemTable;\r | |
50 | ASSERT (gST != NULL);\r | |
51 | \r | |
52 | //\r | |
53 | // Cache pointer to the EFI Boot Services Table\r | |
54 | //\r | |
55 | gBS = SystemTable->BootServices;\r | |
56 | ASSERT (gBS != NULL);\r | |
57 | \r | |
58 | return EFI_SUCCESS;\r | |
59 | }\r |