3 Copyright (c) 1999 Intel Corporation
11 Functions to make SAL and PAL proc calls
21 Copyright (c) 1999 Intel Corporation
29 EFI Runtime library functions
61 CALL_SAL_PROC GlobalSalProc;
62 CALL_PAL_PROC GlobalPalProc;
65 LibInitSalAndPalProc (
66 OUT PLABEL *SalPlabel,
70 SAL_SYSTEM_TABLE_ASCENDING_ORDER *SalSystemTable;
76 Status = LibGetSystemConfigurationTable(&SalSystemTableGuid, (VOID **)&SalSystemTable);
77 if (EFI_ERROR(Status)) {
82 // BugBug: Add code to test checksum on the Sal System Table
84 if (SalSystemTable->Entry0.Type != 0) {
88 SalProcPlabel.ProcEntryPoint = SalSystemTable->Entry0.SalProcEntry;
89 SalProcPlabel.GP = SalSystemTable->Entry0.GlobalDataPointer;
90 GlobalSalProc = (CALL_SAL_PROC)&SalProcPlabel.ProcEntryPoint;
93 // Need to check the PAL spec to make sure I'm not responsible for
94 // storing more state.
95 // We are passing in a Plabel that should be ignorred by the PAL. Call
96 // this way will cause use to retore our gp after the PAL returns.
98 PalProcPlabel.ProcEntryPoint = SalSystemTable->Entry0.PalProcEntry;
99 PalProcPlabel.GP = SalSystemTable->Entry0.GlobalDataPointer;
100 GlobalPalProc = (CALL_PAL_PROC)PalProcPlabel.ProcEntryPoint;
102 *PalEntry = PalProcPlabel.ProcEntryPoint;
103 *SalPlabel = SalProcPlabel;
107 LibGetSalIoPortMapping (
108 OUT UINT64 *IoPortMapping
112 Get the IO Port Map from the SAL System Table.
113 DO NOT USE THIS TO DO YOU OWN IO's!!!!!!!!!!!!
114 Only use this for getting info, or initing the built in EFI IO abstraction.
115 Always use the EFI Device IO protoocl to access IO space.
119 SAL_SYSTEM_TABLE_ASCENDING_ORDER *SalSystemTable;
120 SAL_ST_MEMORY_DESCRIPTOR_ENTRY *SalMemDesc;
123 Status = LibGetSystemConfigurationTable(&SalSystemTableGuid, (VOID **)&SalSystemTable);
124 if (EFI_ERROR(Status)) {
125 return EFI_UNSUPPORTED;
129 // BugBug: Add code to test checksum on the Sal System Table
131 if (SalSystemTable->Entry0.Type != 0) {
132 return EFI_UNSUPPORTED;
136 // The SalSystemTable pointer includes the Type 0 entry.
137 // The SalMemDesc is Type 1 so it comes next.
139 SalMemDesc = (SAL_ST_MEMORY_DESCRIPTOR_ENTRY *)(SalSystemTable + 1);
140 while (SalMemDesc->Type == SAL_ST_MEMORY_DESCRIPTOR) {
141 if (SalMemDesc->MemoryType == SAL_IO_PORT_MAPPING) {
142 *IoPortMapping = SalMemDesc->PhysicalMemoryAddress;
147 return EFI_UNSUPPORTED;
156 Get the IPI block from the SAL system table
160 SAL_SYSTEM_TABLE_ASCENDING_ORDER *SalSystemTable;
161 SAL_ST_MEMORY_DESCRIPTOR_ENTRY *SalMemDesc;
164 Status = LibGetSystemConfigurationTable(&SalSystemTableGuid, (VOID*)&SalSystemTable);
165 if (EFI_ERROR(Status)) {
166 return EFI_UNSUPPORTED;
170 // BugBug: Add code to test checksum on the Sal System Table
172 if (SalSystemTable->Entry0.Type != 0) {
173 return EFI_UNSUPPORTED;
177 // The SalSystemTable pointer includes the Type 0 entry.
178 // The SalMemDesc is Type 1 so it comes next.
180 SalMemDesc = (SAL_ST_MEMORY_DESCRIPTOR_ENTRY *)(SalSystemTable + 1);
181 while (SalMemDesc->Type == SAL_ST_MEMORY_DESCRIPTOR) {
182 if (SalMemDesc->MemoryType == SAL_SAPIC_IPI_BLOCK ) {
183 *IpiBlock = SalMemDesc->PhysicalMemoryAddress;
188 return EFI_UNSUPPORTED;
192 LibGetSalWakeupVector (
193 OUT UINT64 *WakeVector
197 Get the wakeup vector from the SAL system table
201 SAL_ST_AP_WAKEUP_DECRIPTOR *ApWakeUp;
203 ApWakeUp = LibSearchSalSystemTable (SAL_ST_AP_WAKEUP);
206 return EFI_UNSUPPORTED;
208 *WakeVector = ApWakeUp->ExternalInterruptVector;
213 LibSearchSalSystemTable (
219 SAL_SYSTEM_TABLE_ASCENDING_ORDER *SalSystemTable;
223 Status = LibGetSystemConfigurationTable(&SalSystemTableGuid, (VOID*)&SalSystemTable);
224 if (EFI_ERROR(Status)) {
228 EntryCount = SalSystemTable->Header.EntryCount;
229 if (EntryCount == 0) {
233 // BugBug: Add code to test checksum on the Sal System Table
236 SalTableHack = (UINT8 *)&SalSystemTable->Entry0;
237 for (Count = 0; Count < EntryCount ;Count++) {
238 if (*SalTableHack == EntryType) {
239 return (VOID *)SalTableHack;
241 switch (*SalTableHack) {
242 case SAL_ST_ENTRY_POINT:
245 case SAL_ST_MEMORY_DESCRIPTOR:
248 case SAL_ST_PLATFORM_FEATURES:
251 case SAL_ST_TR_USAGE:
257 case SAL_ST_AP_WAKEUP:
278 OUT rArg *Results OPTIONAL
283 ReturnValue.p0 = -3; // SAL status return completed with error
285 ReturnValue = GlobalSalProc(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8);
289 CopyMem (Results, &ReturnValue, sizeof(rArg));
295 IN UINT64 Arg1, // Pal Proc index
299 OUT rArg *Results OPTIONAL
305 ReturnValue.p0 = -3; // PAL status return completed with error
308 // check for valid PalProc entry point
311 if (!GlobalPalProc) {
313 CopyMem (Results, &ReturnValue, sizeof(rArg));
318 // check if index falls within stacked or static register calling conventions
319 // and call appropriate Pal stub call
322 if (((Arg1 >=255) && (Arg1 <=511)) ||
323 ((Arg1 >=768) && (Arg1 <=1023))) {
324 ReturnValue = MakeStackedPALCall((UINT64)GlobalPalProc,Arg1,Arg2,Arg3,Arg4);
327 ReturnValue = MakeStaticPALCall((UINT64)GlobalPalProc,Arg1,Arg2,Arg3,Arg4);
331 CopyMem (Results, &ReturnValue, sizeof(rArg));