]>
Commit | Line | Data |
---|---|---|
afdfe8f0 | 1 | /** @file\r |
2 | PEI Services Table Pointer Library.\r | |
3 | \r | |
4 | This library is used for PEIM which does executed from flash device directly but\r | |
5 | executed in memory.\r | |
6 | \r | |
7 | Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r | |
8 | This program and the accompanying materials\r | |
9 | are licensed and made available under the terms and conditions of the BSD License\r | |
10 | which accompanies this distribution. The full text of the license may be found at\r | |
11 | http://opensource.org/licenses/bsd-license.php.\r | |
12 | \r | |
13 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
14 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
15 | \r | |
16 | **/\r | |
17 | \r | |
18 | #include <PiPei.h>\r | |
19 | #include <Library/PeiServicesTablePointerLib.h>\r | |
20 | #include <Library/DebugLib.h>\r | |
21 | #include <Library/PcdLib.h>\r | |
22 | \r | |
23 | /**\r | |
24 | Caches a pointer PEI Services Table. \r | |
25 | \r | |
26 | Caches the pointer to the PEI Services Table specified by PeiServicesTablePointer \r | |
27 | in a platform specific manner.\r | |
28 | \r | |
29 | If PeiServicesTablePointer is NULL, then ASSERT().\r | |
30 | \r | |
31 | @param PeiServicesTablePointer The address of PeiServices pointer.\r | |
32 | **/\r | |
33 | VOID\r | |
34 | EFIAPI\r | |
35 | SetPeiServicesTablePointer (\r | |
36 | IN CONST EFI_PEI_SERVICES ** PeiServicesTablePointer\r | |
37 | )\r | |
38 | {\r | |
39 | UINTN *PeiPtrLoc;\r | |
40 | ASSERT (PeiServicesTablePointer != NULL);\r | |
41 | \r | |
42 | PeiPtrLoc = (UINTN *)(UINTN)PcdGet32(PcdPeiServicePtrAddr);\r | |
43 | *PeiPtrLoc = (UINTN)PeiServicesTablePointer;\r | |
44 | }\r | |
45 | \r | |
46 | /**\r | |
47 | Retrieves the cached value of the PEI Services Table pointer.\r | |
48 | \r | |
49 | Returns the cached value of the PEI Services Table pointer in a CPU specific manner \r | |
50 | as specified in the CPU binding section of the Platform Initialization Pre-EFI \r | |
51 | Initialization Core Interface Specification.\r | |
52 | \r | |
53 | If the cached PEI Services Table pointer is NULL, then ASSERT().\r | |
54 | \r | |
55 | @return The pointer to PeiServices.\r | |
56 | \r | |
57 | **/\r | |
58 | CONST EFI_PEI_SERVICES **\r | |
59 | EFIAPI\r | |
60 | GetPeiServicesTablePointer (\r | |
61 | VOID\r | |
62 | )\r | |
63 | {\r | |
64 | UINTN *PeiPtrLoc;\r | |
65 | \r | |
66 | PeiPtrLoc = (UINTN *)(UINTN)PcdGet32(PcdPeiServicePtrAddr);\r | |
67 | return (CONST EFI_PEI_SERVICES **)*PeiPtrLoc;\r | |
68 | }\r | |
69 | \r | |
70 | \r |