]>
Commit | Line | Data |
---|---|---|
ed8717c5 | 1 | /** @file\r |
2 | PAL Call Services Function.\r | |
3 | \r | |
19388d29 HT |
4 | Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r |
5 | This program and the accompanying materials \r | |
9638ba6d | 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 | |
2fc59a00 | 8 | http://opensource.org/licenses/bsd-license.php. \r |
ed8717c5 | 9 | \r |
9638ba6d | 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 | |
ed8717c5 | 13 | **/\r |
14 | \r | |
15 | \r | |
16 | #include <PiPei.h>\r | |
ed8717c5 | 17 | \r |
18 | #include <Ppi/SecPlatformInformation.h>\r | |
19 | \r | |
4d52c1f3 | 20 | #include <Library/PalLib.h>\r |
ed8717c5 | 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 | |
ed8717c5 | 27 | Makes a PAL procedure call.\r |
4cb0344e | 28 | \r |
ed8717c5 | 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 | |
ac644614 | 34 | caller's responsibility to check for this return code after calling any optional PAL\r |
ed8717c5 | 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 | |
3745e1a6 | 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 | |
ed8717c5 | 47 | \r |
98ea597b | 48 | @return Structure returned from the PAL Call procedure, including the status and return value.\r |
ed8717c5 | 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 | |
53f32495 | 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 | |
ed8717c5 | 67 | \r |
68 | //\r | |
4cb0344e | 69 | // Get PEI Service Table Pointer\r |
ed8717c5 | 70 | //\r |
5240b97c | 71 | PeiServices = GetPeiServicesTablePointer ();\r |
ed8717c5 | 72 | \r |
73 | //\r | |
4cb0344e | 74 | // Locate SEC Platform Information PPI\r |
ed8717c5 | 75 | //\r |
ed8717c5 | 76 | Status = PeiServicesLocatePpi (\r |
4cb0344e | 77 | &gEfiSecPlatformInformationPpiGuid,\r |
78 | 0,\r | |
79 | NULL,\r | |
80 | (VOID **)&SecPlatformPpi\r | |
81 | );\r | |
ed8717c5 | 82 | ASSERT_EFI_ERROR (Status);\r |
83 | \r | |
4cb0344e | 84 | //\r |
85 | // Retrieve PAL call address from platform information reported by the PPI\r | |
86 | //\r | |
53f32495 | 87 | RecordSize = sizeof (SecPlatformInfoRecord);\r |
ed8717c5 | 88 | SecPlatformPpi->PlatformInformation (\r |
4cb0344e | 89 | PeiServices,\r |
90 | &RecordSize,\r | |
53f32495 | 91 | &SecPlatformInfoRecord\r |
4cb0344e | 92 | );\r |
53f32495 | 93 | PalCallAddress = SecPlatformInfoRecord.ItaniumHealthFlags.PalCallAddress;\r |
ed8717c5 | 94 | \r |
95 | ReturnVal = AsmPalCall (PalCallAddress, Index, Arg2, Arg3, Arg4);\r | |
96 | \r | |
97 | return ReturnVal;\r | |
98 | }\r | |
99 | \r |