]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | PAL Call Services Function.\r | |
3 | \r | |
4 | Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r | |
5 | This program and the accompanying materials \r | |
6 | are licensed and made available under the terms and conditions of the BSD License \r | |
7 | which accompanies this distribution. The full text of the license may be found at \r | |
8 | http://opensource.org/licenses/bsd-license.php. \r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
12 | \r | |
13 | **/\r | |
14 | \r | |
15 | \r | |
16 | #include <PiPei.h>\r | |
17 | \r | |
18 | #include <Ppi/SecPlatformInformation.h>\r | |
19 | \r | |
20 | #include <Library/PalLib.h>\r | |
21 | #include <Library/PeiServicesTablePointerLib.h>\r | |
22 | #include <Library/PeiServicesLib.h>\r | |
23 | #include <Library/BaseLib.h>\r | |
24 | #include <Library/DebugLib.h>\r | |
25 | \r | |
26 | /**\r | |
27 | Makes a PAL procedure call.\r | |
28 | \r | |
29 | This is a wrapper function to make a PAL procedure call. Based on the Index value,\r | |
30 | this API will make static or stacked PAL call. Architected procedures may be designated\r | |
31 | as required or optional. If a PAL procedure is specified as optional, a unique return\r | |
32 | code of 0xFFFFFFFFFFFFFFFF is returned in the Status field of the PAL_CALL_RETURN structure.\r | |
33 | This indicates that the procedure is not present in this PAL implementation. It is the\r | |
34 | caller's responsibility to check for this return code after calling any optional PAL\r | |
35 | procedure. No parameter checking is performed on the 4 input parameters, but there are\r | |
36 | some common rules that the caller should follow when making a PAL call. Any address\r | |
37 | passed to PAL as buffers for return parameters must be 8-byte aligned. Unaligned addresses\r | |
38 | may cause undefined results. For those parameters defined as reserved or some fields\r | |
39 | defined as reserved must be zero filled or the invalid argument return value may be\r | |
40 | returned or undefined result may occur during the execution of the procedure.\r | |
41 | This function is only available on IPF.\r | |
42 | \r | |
43 | @param Index The PAL procedure Index number.\r | |
44 | @param Arg2 The 2nd parameter for PAL procedure calls.\r | |
45 | @param Arg3 The 3rd parameter for PAL procedure calls.\r | |
46 | @param Arg4 The 4th parameter for PAL procedure calls.\r | |
47 | \r | |
48 | @return Structure returned from the PAL Call procedure, including the status and return value.\r | |
49 | \r | |
50 | **/\r | |
51 | PAL_CALL_RETURN\r | |
52 | EFIAPI\r | |
53 | PalCall (\r | |
54 | IN UINT64 Index,\r | |
55 | IN UINT64 Arg2,\r | |
56 | IN UINT64 Arg3,\r | |
57 | IN UINT64 Arg4\r | |
58 | )\r | |
59 | {\r | |
60 | UINT64 PalCallAddress;\r | |
61 | PAL_CALL_RETURN ReturnVal;\r | |
62 | CONST EFI_PEI_SERVICES **PeiServices;\r | |
63 | EFI_STATUS Status;\r | |
64 | EFI_SEC_PLATFORM_INFORMATION_PPI *SecPlatformPpi;\r | |
65 | EFI_SEC_PLATFORM_INFORMATION_RECORD SecPlatformInfoRecord;\r | |
66 | UINT64 RecordSize;\r | |
67 | \r | |
68 | //\r | |
69 | // Get PEI Service Table Pointer\r | |
70 | //\r | |
71 | PeiServices = GetPeiServicesTablePointer ();\r | |
72 | \r | |
73 | //\r | |
74 | // Locate SEC Platform Information PPI\r | |
75 | //\r | |
76 | Status = PeiServicesLocatePpi (\r | |
77 | &gEfiSecPlatformInformationPpiGuid,\r | |
78 | 0,\r | |
79 | NULL,\r | |
80 | (VOID **)&SecPlatformPpi\r | |
81 | );\r | |
82 | ASSERT_EFI_ERROR (Status);\r | |
83 | \r | |
84 | //\r | |
85 | // Retrieve PAL call address from platform information reported by the PPI\r | |
86 | //\r | |
87 | RecordSize = sizeof (SecPlatformInfoRecord);\r | |
88 | SecPlatformPpi->PlatformInformation (\r | |
89 | PeiServices,\r | |
90 | &RecordSize,\r | |
91 | &SecPlatformInfoRecord\r | |
92 | );\r | |
93 | PalCallAddress = SecPlatformInfoRecord.ItaniumHealthFlags.PalCallAddress;\r | |
94 | \r | |
95 | ReturnVal = AsmPalCall (PalCallAddress, Index, Arg2, Arg3, Arg4);\r | |
96 | \r | |
97 | return ReturnVal;\r | |
98 | }\r | |
99 | \r |