]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/PeiServicesTablePointerLibKr1/PeiServicesTablePointer.c
Enhanced the <Build_Library> macro to check OBJECTS property in case it's empty
[mirror_edk2.git] / MdePkg / Library / PeiServicesTablePointerLibKr1 / PeiServicesTablePointer.c
CommitLineData
9e95f418 1/*++\r
2\r
3Copyright (c) 2006 Intel Corporation. All rights reserved\r
4This software and associated documentation (if any) is furnished\r
5under a license and may only be used or copied in accordance\r
6with the terms of the license. Except as permitted by such\r
7license, no part of this software or documentation may be\r
8reproduced, stored in a retrieval system, or transmitted in any\r
9form or by any means without the express written consent of\r
10Intel Corporation.\r
11\r
12\r
13Module Name:\r
14\r
15 PeiServicesTablePointer.c\r
16\r
17Abstract:\r
18\r
19 PEI Services Table Pointer Library.\r
20 \r
21--*/\r
22\r
23\r
24/**\r
25 Reads the current value of Kr1.\r
26\r
27 @return The current value of Kr1.\r
28\r
29**/\r
30UINT64\r
31EFIAPI\r
32AsmReadKr1 (\r
33 VOID\r
34 );\r
35\r
36/**\r
37 Writes the current value of Kr1.\r
38\r
39 @param Value The 64-bit value to write to Kr1.\r
40\r
41**/\r
42VOID\r
43EFIAPI\r
44AsmWriteKr1 (\r
45 IN UINT64 Value\r
46 );\r
47\r
48/**\r
49 The function returns the pointer to PeiServices.\r
50\r
51 The function returns the pointer to PeiServices.\r
52 It will ASSERT() if the pointer to PeiServices is NULL.\r
53\r
54 @retval The pointer to PeiServices.\r
55\r
56**/\r
57EFI_PEI_SERVICES **\r
58EFIAPI\r
59GetPeiServicesTablePointer (\r
60 VOID\r
61 )\r
62{\r
63 EFI_PEI_SERVICES **PeiServices;\r
64\r
65 PeiServices = (EFI_PEI_SERVICES **)(UINTN)AsmReadKr1 ();\r
66 ASSERT (PeiServices != NULL);\r
67 return PeiServices;\r
68}\r
69\r
70/**\r
71 The constructor function caches the pointer to PEI services.\r
72\r
73 The constructor function caches the pointer to PEI services.\r
74 It will always return EFI_SUCCESS.\r
75\r
76 @param FfsHeader Pointer to FFS header the loaded driver.\r
77 @param PeiServices Pointer to the PEI services.\r
78\r
79 @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.\r
80\r
81**/\r
82EFI_STATUS\r
83EFIAPI\r
84PeiServicesTablePointerLibConstructor (\r
85 IN EFI_FFS_FILE_HEADER *FfsHeader,\r
86 IN EFI_PEI_SERVICES **PeiServices\r
87 )\r
88{\r
89 AsmWriteKr1 ((UINT64)(UINTN)PeiServices);\r
90 return EFI_SUCCESS;\r
91}\r