]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.c
Add more comments for DxeServicesTableLib library instance.
[mirror_edk2.git] / MdePkg / Library / DxeServicesTableLib / DxeServicesTableLib.c
1 /** @file
2 This library produce EFI_DXE_SERVICE pointer in global EFI system table. It should
3 be linked to a DXE driver who use gBS.
4
5 This library contains contruct function to retrieve EFI_DXE_SERIVCE, this construct
6 function will be invoked in DXE driver's autogen file.
7
8 Copyright (c) 2006, Intel Corporation<BR>
9 All rights reserved. This program and the accompanying materials
10 are licensed and made available under the terms and conditions of the BSD License
11 which accompanies this distribution. The full text of the license may be found at
12 http://opensource.org/licenses/bsd-license.php
13
14 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
15 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16
17 **/
18
19 #include <PiDxe.h>
20 #include <Guid/DxeServices.h>
21 #include <Library/DxeServicesTableLib.h>
22 #include <Library/DebugLib.h>
23 #include <Library/UefiLib.h>
24
25 //
26 // Cache copy of the DXE Services Table
27 //
28 EFI_DXE_SERVICES *gDS = NULL;
29
30 /**
31 The constructor function caches the pointer of DXE Services Table.
32
33 The constructor function caches the pointer of DXE Services Table.
34 It will ASSERT() if that operation fails.
35 It will ASSERT() if the pointer of DXE Services Table is NULL.
36 It will always return EFI_SUCCESS.
37
38 @param ImageHandle The firmware allocated handle for the EFI image.
39 @param SystemTable A pointer to the EFI System Table.
40
41 @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
42
43 **/
44 EFI_STATUS
45 EFIAPI
46 DxeServicesTableLibConstructor (
47 IN EFI_HANDLE ImageHandle,
48 IN EFI_SYSTEM_TABLE *SystemTable
49 )
50 {
51 EFI_STATUS Status;
52
53 //
54 // Cache copy of the DXE Services Table
55 //
56 Status = EfiGetSystemConfigurationTable (&gEfiDxeServicesTableGuid, (VOID **) &gDS);
57 ASSERT_EFI_ERROR (Status);
58 ASSERT (gDS != NULL);
59
60 return Status;
61 }