]>
Commit | Line | Data |
---|---|---|
863be5d0 | 1 | /** @file\r |
2 | PAL Library Class implementation built upon Extended SAL Procedures.\r | |
3 | \r | |
4 | Copyright (c) 2007 - 2011, 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 | #include <PiDxe.h>\r | |
16 | \r | |
17 | #include <Protocol/ExtendedSalServiceClasses.h>\r | |
18 | \r | |
19 | #include <Library/PalLib.h>\r | |
20 | #include <Library/ExtendedSalLib.h>\r | |
21 | \r | |
22 | /**\r | |
23 | Makes a PAL procedure call.\r | |
24 | \r | |
25 | This is a wrapper function to make a PAL procedure call. Based on the Index value,\r | |
26 | this API will make static or stacked PAL call. Architected procedures may be designated\r | |
27 | as required or optional. If a PAL procedure is specified as optional, a unique return\r | |
28 | code of 0xFFFFFFFFFFFFFFFF is returned in the Status field of the PAL_CALL_RETURN structure.\r | |
29 | This indicates that the procedure is not present in this PAL implementation. It is the\r | |
30 | caller's responsibility to check for this return code after calling any optional PAL\r | |
31 | procedure. No parameter checking is performed on the 4 input parameters, but there are\r | |
32 | some common rules that the caller should follow when making a PAL call. Any address\r | |
33 | passed to PAL as buffers for return parameters must be 8-byte aligned. Unaligned addresses\r | |
34 | may cause undefined results. For those parameters defined as reserved or some fields\r | |
35 | defined as reserved must be zero filled or the invalid argument return value may be\r | |
36 | returned or undefined result may occur during the execution of the procedure.\r | |
37 | This function is only available on IPF.\r | |
38 | \r | |
39 | @param Index - The PAL procedure Index number.\r | |
40 | @param Arg2 - The 2nd parameter for PAL procedure calls.\r | |
41 | @param Arg3 - The 3rd parameter for PAL procedure calls.\r | |
42 | @param Arg4 - The 4th parameter for PAL procedure calls.\r | |
43 | \r | |
44 | @return structure returned from the PAL Call procedure, including the status and return value.\r | |
45 | \r | |
46 | **/\r | |
47 | PAL_CALL_RETURN\r | |
48 | EFIAPI\r | |
49 | PalCall (\r | |
50 | IN UINT64 Index,\r | |
51 | IN UINT64 Arg2,\r | |
52 | IN UINT64 Arg3,\r | |
53 | IN UINT64 Arg4\r | |
54 | )\r | |
55 | {\r | |
56 | SAL_RETURN_REGS SalReturn;\r | |
57 | PAL_CALL_RETURN *PalReturn;\r | |
58 | \r | |
59 | SalReturn = EsalCall (\r | |
60 | EFI_EXTENDED_SAL_PAL_SERVICES_PROTOCOL_GUID_LO,\r | |
61 | EFI_EXTENDED_SAL_PAL_SERVICES_PROTOCOL_GUID_HI,\r | |
62 | PalProcFunctionId, \r | |
63 | Index, \r | |
64 | Arg2, \r | |
65 | Arg3, \r | |
66 | Arg4, \r | |
67 | 0, \r | |
68 | 0, \r | |
69 | 0\r | |
70 | );\r | |
71 | PalReturn = (PAL_CALL_RETURN *) (UINTN) (&SalReturn);\r | |
72 | return *PalReturn;\r | |
73 | }\r |