]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdePkg/Library/PeiServicesTablePointerLibKr7/PeiServicesTablePointer.c
Base on PI spec, GetPeiServicesTablePointer is updated to return CONST EFI_PEI_SERVIC...
[mirror_edk2.git] / MdePkg / Library / PeiServicesTablePointerLibKr7 / PeiServicesTablePointer.c
... / ...
CommitLineData
1/** @file\r
2 PEI Services Table Pointer Library implementation for IPF that uses Kernel\r
3 Register 7 to store the pointer.\r
4\r
5 Copyright (c) 2006 - 2008, Intel Corporation.<BR>\r
6 All rights reserved. This program and the accompanying materials\r
7 are licensed and made available under the terms and conditions of the BSD License\r
8 which accompanies this distribution. The full text of the license may be found at\r
9 http://opensource.org/licenses/bsd-license.php\r
10\r
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14**/\r
15\r
16#include <PiPei.h>\r
17#include <Library/BaseLib.h>\r
18#include <Library/DebugLib.h>\r
19\r
20/**\r
21 The function returns the pointer to PeiServices.\r
22\r
23 The function returns the pointer to PeiServices.\r
24 It will ASSERT() if the pointer to PeiServices is NULL.\r
25\r
26 @return The pointer to PeiServices.\r
27\r
28**/\r
29CONST EFI_PEI_SERVICES **\r
30EFIAPI\r
31GetPeiServicesTablePointer (\r
32 VOID\r
33 )\r
34{\r
35 CONST EFI_PEI_SERVICES **PeiServices;\r
36\r
37 PeiServices = (CONST EFI_PEI_SERVICES **)(UINTN)AsmReadKr7 ();\r
38 ASSERT (PeiServices != NULL);\r
39 return PeiServices;\r
40}\r
41\r
42/**\r
43 The constructor function caches the pointer to PEI services.\r
44\r
45 The constructor function caches the pointer to PEI services.\r
46 It will always return EFI_SUCCESS.\r
47\r
48 @param FfsHeader Pointer to FFS header the loaded driver.\r
49 @param PeiServices Pointer to the PEI services.\r
50\r
51 @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.\r
52\r
53**/\r
54EFI_STATUS\r
55EFIAPI\r
56PeiServicesTablePointerLibConstructor (\r
57 IN EFI_PEI_FILE_HANDLE *FfsHeader,\r
58 IN EFI_PEI_SERVICES **PeiServices\r
59 )\r
60{\r
61 AsmWriteKr7 ((UINT64)(UINTN)PeiServices);\r
62 return EFI_SUCCESS;\r
63}\r
64\r
65/**\r
66 The function set the pointer of PEI services in KR7 register \r
67 according to PI specification.\r
68 \r
69 @param PeiServicesTablePointer The address of PeiServices pointer.\r
70**/\r
71VOID\r
72EFIAPI\r
73SetPeiServicesTablePointer (\r
74 IN EFI_PEI_SERVICES ** PeiServicesTablePointer\r
75 )\r
76{\r
77 AsmWriteKr7 ((UINT64)(UINTN)PeiServicesTablePointer);\r
78}\r
79 \r
80\r
81\r
82\r