]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.c
Checked in part of MDE library instances following PI and UEFI. It includes:
[mirror_edk2.git] / MdePkg / Library / UefiBootServicesTableLib / UefiBootServicesTableLib.c
1 /** @file
2 UEFI Boot Services Table Library.
3
4 Copyright (c) 2006 - 2007, Intel Corporation<BR>
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 Module Name: UefiBootServicesTableLib.c
14
15 **/
16
17 //
18 // The package level header files this module uses
19 //
20 #include <PiDxe.h>
21 //
22 // The protocols, PPI and GUID defintions for this module
23 //
24 //
25 // The Library classes this module consumes
26 //
27 #include <Library/UefiBootServicesTableLib.h>
28 #include <Library/DebugLib.h>
29
30 EFI_HANDLE gImageHandle = NULL;
31 EFI_SYSTEM_TABLE *gST = NULL;
32 EFI_BOOT_SERVICES *gBS = NULL;
33
34 /**
35 The constructor function caches the pointer of Boot Services Table.
36
37 The constructor function caches the pointer of Boot Services Table through System Table.
38 It will ASSERT() if the pointer of System Table is NULL.
39 It will ASSERT() if the pointer of Boot Services Table is NULL.
40 It will always return EFI_SUCCESS.
41
42 @param ImageHandle The firmware allocated handle for the EFI image.
43 @param SystemTable A pointer to the EFI System Table.
44
45 @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
46
47 **/
48 EFI_STATUS
49 EFIAPI
50 UefiBootServicesTableLibConstructor (
51 IN EFI_HANDLE ImageHandle,
52 IN EFI_SYSTEM_TABLE *SystemTable
53 )
54 {
55 //
56 // Cache the Image Handle
57 //
58 gImageHandle = ImageHandle;
59 ASSERT (gImageHandle != NULL);
60
61 //
62 // Cache pointer to the EFI System Table
63 //
64 gST = SystemTable;
65 ASSERT (gST != NULL);
66
67 //
68 // Cache pointer to the EFI Boot Services Table
69 //
70 gBS = SystemTable->BootServices;
71 ASSERT (gBS != NULL);
72
73 return EFI_SUCCESS;
74 }