]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.c
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Library / DxeServicesTableLib / DxeServicesTableLib.c
CommitLineData
e386b444 1/** @file\r
f468abda 2 This library implement library class DxeServiceTableLib.\r
3 It produce EFI_DXE_SERVICE pointer in global variable gDS in library's constructure.\r
9095d37b 4\r
f468abda 5 A DXE driver can use gDS pointer to access services in EFI_DXE_SERVICE, if this\r
9095d37b 6 DXE driver declare that use DxeServicesTableLib library class and link to this\r
f468abda 7 library instance.\r
8\r
9095d37b 9 Please attention this library instance can not be used util EFI_SYSTEM_TABLE was\r
f468abda 10 initialized.\r
9095d37b 11\r
bb347ec2 12 This library contains contruct function to retrieve EFI_DXE_SERIVCE, this construct\r
13 function will be invoked in DXE driver's autogen file.\r
e386b444 14\r
9095d37b 15 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
9344f092 16 SPDX-License-Identifier: BSD-2-Clause-Patent\r
e386b444 17\r
e386b444 18**/\r
19\r
c7d265a9 20#include <PiDxe.h>\r
c7d265a9 21#include <Guid/DxeServices.h>\r
c7d265a9 22#include <Library/DxeServicesTableLib.h>\r
23#include <Library/DebugLib.h>\r
24#include <Library/UefiLib.h>\r
e386b444 25\r
26//\r
27// Cache copy of the DXE Services Table\r
28//\r
29EFI_DXE_SERVICES *gDS = NULL;\r
30\r
31/**\r
32 The constructor function caches the pointer of DXE Services Table.\r
33\r
34 The constructor function caches the pointer of DXE Services Table.\r
35 It will ASSERT() if that operation fails.\r
36 It will ASSERT() if the pointer of DXE Services Table is NULL.\r
37 It will always return EFI_SUCCESS.\r
38\r
39 @param ImageHandle The firmware allocated handle for the EFI image.\r
40 @param SystemTable A pointer to the EFI System Table.\r
41\r
42 @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.\r
43\r
44**/\r
45EFI_STATUS\r
46EFIAPI\r
47DxeServicesTableLibConstructor (\r
48 IN EFI_HANDLE ImageHandle,\r
49 IN EFI_SYSTEM_TABLE *SystemTable\r
50 )\r
51{\r
52 EFI_STATUS Status;\r
53\r
54 //\r
55 // Cache copy of the DXE Services Table\r
56 //\r
57 Status = EfiGetSystemConfigurationTable (&gEfiDxeServicesTableGuid, (VOID **) &gDS);\r
58 ASSERT_EFI_ERROR (Status);\r
59 ASSERT (gDS != NULL);\r
60\r
61 return Status;\r
62}\r