14c24c4eeb48672cdce06cf1d1f90f9e9c14a15a0qhuang/** @file 24c24c4eeb48672cdce06cf1d1f90f9e9c14a15a0qhuang 34c24c4eeb48672cdce06cf1d1f90f9e9c14a15a0qhuang Template and Sample instance of PalCallLib. 44c24c4eeb48672cdce06cf1d1f90f9e9c14a15a0qhuang 52fc59a003ed9104f9feebe0e418f2a04a50f3284myronporter Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR> 619388d2960b2fe0347da23799e93ccc52f540214hhtian This program and the accompanying materials 79638ba6d3f663ba64cb06193f22bc5c70356da64gikidy are licensed and made available under the terms and conditions of the BSD License 89638ba6d3f663ba64cb06193f22bc5c70356da64gikidy which accompanies this distribution. The full text of the license may be found at 92fc59a003ed9104f9feebe0e418f2a04a50f3284myronporter http://opensource.org/licenses/bsd-license.php. 104c24c4eeb48672cdce06cf1d1f90f9e9c14a15a0qhuang 119638ba6d3f663ba64cb06193f22bc5c70356da64gikidy THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 124c24c4eeb48672cdce06cf1d1f90f9e9c14a15a0qhuang WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 139638ba6d3f663ba64cb06193f22bc5c70356da64gikidy 144c24c4eeb48672cdce06cf1d1f90f9e9c14a15a0qhuang**/ 159638ba6d3f663ba64cb06193f22bc5c70356da64gikidy 164c24c4eeb48672cdce06cf1d1f90f9e9c14a15a0qhuang#include <Base.h> 174c24c4eeb48672cdce06cf1d1f90f9e9c14a15a0qhuang#include <Library/PalLib.h> 184c24c4eeb48672cdce06cf1d1f90f9e9c14a15a0qhuang#include <Library/DebugLib.h> 194c24c4eeb48672cdce06cf1d1f90f9e9c14a15a0qhuang 204c24c4eeb48672cdce06cf1d1f90f9e9c14a15a0qhuang/** 214c24c4eeb48672cdce06cf1d1f90f9e9c14a15a0qhuang Makes a PAL procedure call. 224c24c4eeb48672cdce06cf1d1f90f9e9c14a15a0qhuang 23efb2311707ec50ff04ebaecbb151ce8d8f168ee4gikidy This is a wrapper function to make a PAL procedure call. Based on the Index value, 24efb2311707ec50ff04ebaecbb151ce8d8f168ee4gikidy this API will make static or stacked PAL call. Architected procedures may be designated 25efb2311707ec50ff04ebaecbb151ce8d8f168ee4gikidy as required or optional. If a PAL procedure is specified as optional, a unique return 26efb2311707ec50ff04ebaecbb151ce8d8f168ee4gikidy code of 0xFFFFFFFFFFFFFFFF is returned in the Status field of the PAL_CALL_RETURN structure. 27efb2311707ec50ff04ebaecbb151ce8d8f168ee4gikidy This indicates that the procedure is not present in this PAL implementation. It is the 28efb2311707ec50ff04ebaecbb151ce8d8f168ee4gikidy caller's responsibility to check for this return code after calling any optional PAL 29efb2311707ec50ff04ebaecbb151ce8d8f168ee4gikidy procedure. No parameter checking is performed on the 4 input parameters, but there are 30efb2311707ec50ff04ebaecbb151ce8d8f168ee4gikidy some common rules that the caller should follow when making a PAL call. Any address 31efb2311707ec50ff04ebaecbb151ce8d8f168ee4gikidy passed to PAL as buffers for return parameters must be 8-byte aligned. Unaligned addresses 32efb2311707ec50ff04ebaecbb151ce8d8f168ee4gikidy may cause undefined results. For those parameters defined as reserved or some fields 33efb2311707ec50ff04ebaecbb151ce8d8f168ee4gikidy defined as reserved must be zero filled or the invalid argument return value may be 34efb2311707ec50ff04ebaecbb151ce8d8f168ee4gikidy returned or undefined result may occur during the execution of the procedure. 35efb2311707ec50ff04ebaecbb151ce8d8f168ee4gikidy This function is only available on IPF. 36efb2311707ec50ff04ebaecbb151ce8d8f168ee4gikidy 37efb2311707ec50ff04ebaecbb151ce8d8f168ee4gikidy @param Index The PAL procedure Index number. 38efb2311707ec50ff04ebaecbb151ce8d8f168ee4gikidy @param Arg2 The 2nd parameter for PAL procedure calls. 39efb2311707ec50ff04ebaecbb151ce8d8f168ee4gikidy @param Arg3 The 3rd parameter for PAL procedure calls. 40efb2311707ec50ff04ebaecbb151ce8d8f168ee4gikidy @param Arg4 The 4th parameter for PAL procedure calls. 414c24c4eeb48672cdce06cf1d1f90f9e9c14a15a0qhuang 422fc59a003ed9104f9feebe0e418f2a04a50f3284myronporter @return The structure returned from the PAL Call procedure, including the status and return value. 434c24c4eeb48672cdce06cf1d1f90f9e9c14a15a0qhuang 444c24c4eeb48672cdce06cf1d1f90f9e9c14a15a0qhuang**/ 454c24c4eeb48672cdce06cf1d1f90f9e9c14a15a0qhuangPAL_CALL_RETURN 464c24c4eeb48672cdce06cf1d1f90f9e9c14a15a0qhuangEFIAPI 474c24c4eeb48672cdce06cf1d1f90f9e9c14a15a0qhuangPalCall ( 484c24c4eeb48672cdce06cf1d1f90f9e9c14a15a0qhuang IN UINT64 Index, 494c24c4eeb48672cdce06cf1d1f90f9e9c14a15a0qhuang IN UINT64 Arg2, 504c24c4eeb48672cdce06cf1d1f90f9e9c14a15a0qhuang IN UINT64 Arg3, 514c24c4eeb48672cdce06cf1d1f90f9e9c14a15a0qhuang IN UINT64 Arg4 524c24c4eeb48672cdce06cf1d1f90f9e9c14a15a0qhuang ) 534c24c4eeb48672cdce06cf1d1f90f9e9c14a15a0qhuang{ 544c24c4eeb48672cdce06cf1d1f90f9e9c14a15a0qhuang PAL_CALL_RETURN Ret; 554c24c4eeb48672cdce06cf1d1f90f9e9c14a15a0qhuang 564c24c4eeb48672cdce06cf1d1f90f9e9c14a15a0qhuang Ret.Status = (UINT64) -1; 574c24c4eeb48672cdce06cf1d1f90f9e9c14a15a0qhuang ASSERT (!RETURN_ERROR (RETURN_UNSUPPORTED)); 584c24c4eeb48672cdce06cf1d1f90f9e9c14a15a0qhuang return Ret; 594c24c4eeb48672cdce06cf1d1f90f9e9c14a15a0qhuang} 60