]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/PeiServicesTablePointerLibMm7/PeiServicesTablePointer.c
add in PeiServicesTablePointerLibMm7.inf
[mirror_edk2.git] / MdePkg / Library / PeiServicesTablePointerLibMm7 / PeiServicesTablePointer.c
1 /** @file
2 PEI Services Table Pointer Library.
3
4 Copyright (c) 2006, 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: PeiServicesTablePointer.c
14
15 **/
16
17
18 #include <PiPei.h>
19
20
21 #include <Library/PeiServicesTablePointerLib.h>
22 #include <Library/BaseLib.h>
23 #include <Library/DebugLib.h>
24
25 /**
26 The function returns the pointer to PeiServices.
27
28 The function returns the pointer to PeiServices.
29 It will ASSERT() if the pointer to PeiServices is NULL.
30
31 @retval The pointer to PeiServices.
32
33 **/
34 EFI_PEI_SERVICES **
35 EFIAPI
36 GetPeiServicesTablePointer (
37 VOID
38 )
39 {
40 EFI_PEI_SERVICES **PeiServices;
41
42 PeiServices = (EFI_PEI_SERVICES **)(UINTN)AsmReadMm7 ();
43 ASSERT (PeiServices != NULL);
44 return PeiServices;
45 }
46
47 /**
48 The constructor function caches the pointer to PEI services.
49
50 The constructor function caches the pointer to PEI services.
51 It will always return EFI_SUCCESS.
52
53 @param FfsHeader Pointer to FFS header the loaded driver.
54 @param PeiServices Pointer to the PEI services.
55
56 @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
57
58 **/
59 EFI_STATUS
60 EFIAPI
61 PeiServicesTablePointerLibConstructor (
62 IN EFI_FFS_FILE_HEADER *FfsHeader,
63 IN EFI_PEI_SERVICES **PeiServices
64 )
65 {
66 AsmWriteMm7 ((UINT64)(UINTN)PeiServices);
67 return EFI_SUCCESS;
68 }