diff --git a/AmiModulePkg/NVRAM/S3NvramSave/S3NvramSave.c b/AmiModulePkg/NVRAM/S3NvramSave/S3NvramSave.c index 0270d18..bfbc8f7 100644 --- a/AmiModulePkg/NVRAM/S3NvramSave/S3NvramSave.c +++ b/AmiModulePkg/NVRAM/S3NvramSave/S3NvramSave.c @@ -13,31 +13,31 @@ // Function: ModuleEntryPoint EFI_STATUS ModuleEntryPoint(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) { - ::ImageHandle = (__int64)ImageHandle; + gImageHandle = ImageHandle; if ( !ImageHandle ) - sub_B04( + ValidateGlobalPointers( "e:\\hs\\MdePkg\\Library\\UefiBootServicesTableLib\\UefiBootServicesTableLib.c", 51, "gImageHandle != ((void *) 0)"); - ::SystemTable = (__int64)SystemTable; + gSystemTable = SystemTable; if ( !SystemTable ) - sub_B04( + ValidateGlobalPointers( "e:\\hs\\MdePkg\\Library\\UefiBootServicesTableLib\\UefiBootServicesTableLib.c", 57, "gST != ((void *) 0)"); - BootServices = (__int64)SystemTable->BootServices; + BootServices = SystemTable->BootServices; if ( !BootServices ) - sub_B04( + ValidateGlobalPointers( "e:\\hs\\MdePkg\\Library\\UefiBootServicesTableLib\\UefiBootServicesTableLib.c", 63, "gBS != ((void *) 0)"); - RuntimeServices = (__int64)SystemTable->RuntimeServices; + RuntimeServices = SystemTable->RuntimeServices; if ( !RuntimeServices ) - sub_B04( + ValidateGlobalPointers( "e:\\hs\\MdePkg\\Library\\UefiRuntimeServicesTableLib\\UefiRuntimeServicesTableLib.c", 47, "gRT != ((void *) 0)"); - sub_C7C(); - sub_41C(); + InitializeS3NvramSave(); + ReturnS3NvramSaveStatus(); return 0; } diff --git a/AmiModulePkg/NVRAM/S3NvramSave/S3NvramSave.h b/AmiModulePkg/NVRAM/S3NvramSave/S3NvramSave.h index 4b7da52..2b9024a 100644 --- a/AmiModulePkg/NVRAM/S3NvramSave/S3NvramSave.h +++ b/AmiModulePkg/NVRAM/S3NvramSave/S3NvramSave.h @@ -20,34 +20,35 @@ EFI_STATUS EFIAPI ModuleEntryPoint( - VOID + EFI_HANDLE ImageHandle, + EFI_SYSTEM_TABLE *SystemTable ); /// -/// sub_B04 +/// ValidateGlobalPointers /// EFI_STATUS EFIAPI -sub_B04( +ValidateGlobalPointers( VOID ); /// -/// sub_C7C +/// InitializeS3NvramSave /// EFI_STATUS EFIAPI -sub_C7C( +InitializeS3NvramSave( VOID ); /// -/// sub_41C +/// ReturnS3NvramSaveStatus /// EFI_STATUS EFIAPI -sub_41C( +ReturnS3NvramSaveStatus( VOID ); -#endif /* __S3NVRAMSAVE_H__ */ \ No newline at end of file +#endif /* __S3NVRAMSAVE_H__ */ diff --git a/AmiModulePkg/TCG2/Common/TcgSmm/TcgSmm.c b/AmiModulePkg/TCG2/Common/TcgSmm/TcgSmm.c index a2c3e92..76d0be4 100644 --- a/AmiModulePkg/TCG2/Common/TcgSmm/TcgSmm.c +++ b/AmiModulePkg/TCG2/Common/TcgSmm/TcgSmm.c @@ -19,10 +19,10 @@ { EFI_STATUS Status; - sub_4CC(); - Status = sub_778(ImageHandle, SystemTable); + TcgSmmInitializeCommon(); + Status = TcgSmmModuleInitialization(ImageHandle, SystemTable); if (EFI_ERROR(Status)) { - sub_1988(); + TcgSmmCleanupOnFailure(); } return Status; } diff --git a/AmiModulePkg/TCG2/Common/TcgSmm/TcgSmm.h b/AmiModulePkg/TCG2/Common/TcgSmm/TcgSmm.h index a63ca44..0ac58b9 100644 --- a/AmiModulePkg/TCG2/Common/TcgSmm/TcgSmm.h +++ b/AmiModulePkg/TCG2/Common/TcgSmm/TcgSmm.h @@ -25,30 +25,30 @@ ); /// -/// sub_4CC -/// +/// TcgSmmInitializeCommon +/// EFI_STATUS EFIAPI -sub_4CC( +TcgSmmInitializeCommon( VOID ); /// -/// sub_778 +/// TcgSmmModuleInitialization /// EFI_STATUS EFIAPI -sub_778( +TcgSmmModuleInitialization( EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable ); /// -/// sub_1988 +/// TcgSmmCleanupOnFailure /// EFI_STATUS EFIAPI -sub_1988( +TcgSmmCleanupOnFailure( VOID ); diff --git a/AmiModulePkg/Terminal/SerialMuxControl/SerialMuxControl.c b/AmiModulePkg/Terminal/SerialMuxControl/SerialMuxControl.c index ea11dba..0d57880 100644 --- a/AmiModulePkg/Terminal/SerialMuxControl/SerialMuxControl.c +++ b/AmiModulePkg/Terminal/SerialMuxControl/SerialMuxControl.c @@ -1,9 +1,6 @@ /** @file SerialMuxControl.c -- SerialMuxControl - Auto-converted from IDA decompiler output. - Functions: 1 - Copyright (c) HR650X BIOS Decompilation Project **/ @@ -15,28 +12,28 @@ { ::ImageHandle = (__int64)ImageHandle; if ( !ImageHandle ) - sub_868( + ValidateUefiEntryPointState( "e:\\hs\\MdePkg\\Library\\UefiBootServicesTableLib\\UefiBootServicesTableLib.c", 51, "gImageHandle != ((void *) 0)"); ::SystemTable = (__int64)SystemTable; if ( !SystemTable ) - sub_868( + ValidateUefiEntryPointState( "e:\\hs\\MdePkg\\Library\\UefiBootServicesTableLib\\UefiBootServicesTableLib.c", 57, "gST != ((void *) 0)"); BootServices = (__int64)SystemTable->BootServices; if ( !BootServices ) - sub_868( + ValidateUefiEntryPointState( "e:\\hs\\MdePkg\\Library\\UefiBootServicesTableLib\\UefiBootServicesTableLib.c", 63, "gBS != ((void *) 0)"); RuntimeServices = (__int64)SystemTable->RuntimeServices; if ( !RuntimeServices ) - sub_868( + ValidateUefiEntryPointState( "e:\\hs\\MdePkg\\Library\\UefiRuntimeServicesTableLib\\UefiRuntimeServicesTableLib.c", 47, "gRT != ((void *) 0)"); - sub_964(); - return sub_3FC(); + SerialMuxControlInitializeHardware(); + return SerialMuxControlMain(); } diff --git a/AmiModulePkg/Terminal/SerialMuxControl/SerialMuxControl.h b/AmiModulePkg/Terminal/SerialMuxControl/SerialMuxControl.h index 9ea95f0..d7559ae 100644 --- a/AmiModulePkg/Terminal/SerialMuxControl/SerialMuxControl.h +++ b/AmiModulePkg/Terminal/SerialMuxControl/SerialMuxControl.h @@ -20,34 +20,37 @@ EFI_STATUS EFIAPI ModuleEntryPoint( - VOID + EFI_HANDLE ImageHandle, + EFI_SYSTEM_TABLE *SystemTable ); /// -/// sub_868 +/// ValidateUefiEntryPointState /// EFI_STATUS EFIAPI -sub_868( - VOID +ValidateUefiEntryPointState( + CHAR8 *FileName, + INT32 LineNumber, + CHAR8 *AssertionDescription ); /// -/// sub_964 +/// SerialMuxControlInitializeHardware /// EFI_STATUS EFIAPI -sub_964( +SerialMuxControlInitializeHardware( VOID ); /// -/// sub_3FC +/// SerialMuxControlMain /// EFI_STATUS EFIAPI -sub_3FC( +SerialMuxControlMain( VOID ); -#endif /* __SERIALMUXCONTROL_H__ */ \ No newline at end of file +#endif /* __SERIALMUXCONTROL_H__ */ diff --git a/LenovoServerPkg/POSTStatus/LnvDxeStatusCode/LnvDxeStatusCode.c b/LenovoServerPkg/POSTStatus/LnvDxeStatusCode/LnvDxeStatusCode.c index 0fd21a4..a3de1b9 100644 --- a/LenovoServerPkg/POSTStatus/LnvDxeStatusCode/LnvDxeStatusCode.c +++ b/LenovoServerPkg/POSTStatus/LnvDxeStatusCode/LnvDxeStatusCode.c @@ -391,7 +391,7 @@ // =========================================================================== // -// sub_1568 (0x1568) -- clear the boot-services pointer on ExitBootServices. +// ExitBootServices callback that clears the boot-services pointer. // VOID EFIAPI @@ -404,7 +404,7 @@ } // -// sub_1574 (0x1574) -- convert the Lenovo protocol pointer on ExitBS. +// ExitBootServices callback that converts the Lenovo protocol pointer. // EFI_STATUS EFIAPI @@ -420,7 +420,7 @@ } // -// sub_1674 (0x1674) -- NOP protocol notification. +// Runtime protocol notify callback used as a no-op placeholder. // VOID EFIAPI @@ -432,7 +432,7 @@ } // -// sub_1678 (0x1678) -- convert RuntimeServices notification registration. +// Event callback that converts the runtime-services registration pointer. // EFI_STATUS EFIAPI @@ -445,7 +445,7 @@ } // -// sub_16EC (0x16EC) -- convert runtime protocol ptr on ExitBS/VAC. +// ExitBootServices/virtual-address-change callback to convert runtime protocol pointer. // EFI_STATUS EFIAPI @@ -461,7 +461,7 @@ } // -// sub_1714 (0x1714) -- re-locate runtime protocol + set init done flag. +// Virtual-address-change callback to re-locate runtime protocol and mark init done. // VOID EFIAPI @@ -618,4 +618,4 @@ ); return EFI_SUCCESS; -} \ No newline at end of file +} diff --git a/LenovoServerPkg/POSTStatus/LnvDxeStatusCode/LnvDxeStatusCode.h b/LenovoServerPkg/POSTStatus/LnvDxeStatusCode/LnvDxeStatusCode.h index c8b37e0..29ccfd3 100644 --- a/LenovoServerPkg/POSTStatus/LnvDxeStatusCode/LnvDxeStatusCode.h +++ b/LenovoServerPkg/POSTStatus/LnvDxeStatusCode/LnvDxeStatusCode.h @@ -1,443 +1,120 @@ /** @file - LnvDxeStatusCode.h -- Header for LnvDxeStatusCode + LnvDxeStatusCode - Lenovo DXE Status Code Driver -Copyright (c) HR650X BIOS Decompilation Project + Copyright (c) Lenovo. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent **/ -#ifndef __LNVDXESTATUSCODE_H__ -#define __LNVDXESTATUSCODE_H__ +#ifndef LNVDXESTATUSCODE_H_ +#define LNVDXESTATUSCODE_H_ #include "../uefi_headers/Uefi.h" -// -// Function Prototypes -// +typedef struct { + UINT64 ReportStatusCodeFn; + UINT64 DebugAssertFn; +} LENOVO_STATUS_CODE_PROTOCOL; -EFI_STATUS +UINT64 EFIAPI -ReportStatusCodeFiltered( - VOID -); +ReadUnaligned64 ( + IN CONST VOID *Buffer + ); -EFI_STATUS +BOOLEAN EFIAPI -DebugAssertViaProtocol( - VOID -); +IsHobListGuid ( + IN CONST EFI_GUID *HobGuid + ); -EFI_STATUS +VOID * EFIAPI -ReadUnaligned64( +GetHobListFromConfigTable ( VOID -); + ); -EFI_STATUS +VOID * EFIAPI -IsHobListGuid( +GetLenovoStatusCodeProtocol ( VOID -); + ); -EFI_STATUS +VOID EFIAPI -LocateRuntimeStatusCodeProtocol( - VOID -); +ReportStatusCodeFiltered ( + IN UINTN ErrorLevel, + IN CONST CHAR8 *Format, + ... + ); -EFI_STATUS +VOID EFIAPI -OnExitBootServicesClearBs( - VOID -); +DebugAssertViaProtocol ( + IN CONST CHAR8 *FileName, + IN UINTN LineNumber, + IN CONST CHAR8 *Expression + ); -EFI_STATUS +VOID EFIAPI -OnExitBootServicesConvertLenovo( +LocateRuntimeStatusCodeProtocol ( VOID -); + ); -EFI_STATUS +VOID EFIAPI -RuntimeProtocolNotifyNop( - VOID -); +OnExitBootServicesClearBs ( + IN EFI_EVENT Event, + IN VOID *Context + ); EFI_STATUS EFIAPI -OnExitBootServicesConvertReg( - VOID -); +OnExitBootServicesConvertLenovo ( + IN EFI_EVENT Event, + IN VOID *Context + ); -EFI_STATUS +VOID EFIAPI -OnExitBootServicesConvertRuntime( - VOID -); +RuntimeProtocolNotifyNop ( + IN EFI_EVENT Event, + IN VOID *Context + ); EFI_STATUS EFIAPI -OnVirtualAddressChange( - VOID -); +OnExitBootServicesConvertReg ( + IN EFI_EVENT Event, + IN VOID *Context + ); EFI_STATUS EFIAPI -DriverSetupInit( - VOID -); +OnExitBootServicesConvertRuntime ( + IN EFI_EVENT Event, + IN VOID *Context + ); -EFI_STATUS +VOID EFIAPI -LnvDxeStatusCodeEntryPoint( - VOID -); +OnVirtualAddressChange ( + IN EFI_EVENT Event, + IN VOID *Context + ); EFI_STATUS EFIAPI -Lenovo Status Code Protocol (0x3000):( - VOID -); +DriverSetupInit ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ); EFI_STATUS EFIAPI -(0x3010) from MdeModulePkg.( - VOID -); +LnvDxeStatusCodeEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ); -EFI_STATUS -EFIAPI -(0x3020) from MdePkg.( - VOID -); - -EFI_STATUS -EFIAPI -(0x3030).( - VOID -); - -EFI_STATUS -EFIAPI -(0x3040).( - VOID -); - -EFI_STATUS -EFIAPI -custom protocol vtable layout( - VOID -); - -EFI_STATUS -EFIAPI -+0x00( - VOID -); - -EFI_STATUS -EFIAPI -+0x08( - VOID -); - -EFI_STATUS -EFIAPI -variables( - VOID -); - -EFI_STATUS -EFIAPI -EFI_SYSTEM_TABLE *gSystemTable_ = NULL; // 0x3050( - VOID -); - -EFI_STATUS -EFIAPI -EFI_RUNTIME_SERVICES *gRuntimeServices_ = NULL; // 0x3068( - VOID -); - -EFI_STATUS -EFIAPI -VOID *gRegClearBs_ = NULL; // 0x3080( - VOID -); - -EFI_STATUS -EFIAPI -VOID *gLenovoProtocol_ = NULL; // 0x3090( - VOID -); - -EFI_STATUS -EFIAPI -BOOLEAN gRuntimeInitDone_ = FALSE; // 0x30A0( - VOID -); - -EFI_STATUS -EFIAPI -VOID *gRegVirtAddrChange_ = NULL; // 0x30B8( - VOID -); - -EFI_STATUS -EFIAPI -VOID *gRuntimeServicesReg_ = NULL; // 0x30D0( - VOID -); - -EFI_STATUS -EFIAPI -//( - VOID -); - -EFI_STATUS -EFIAPI -constants in .data section( - VOID -); - -EFI_STATUS -EFIAPI -CONST GUID mStatusCodeProtocolGuid = LENOVO_STATUS_CODE_PROTOCOL_GUID;( - VOID -); - -EFI_STATUS -EFIAPI -debug register definitions( - VOID -); - -EFI_STATUS -EFIAPI -code severity masks( - VOID -); - -EFI_STATUS -EFIAPI -declarations( - VOID -); - -/// read a UINT64 from memory -EFI_STATUS -EFIAPI -(0x179C)( - VOID -); - -/// compare a HOB UUID to gEfiHobListGuid -EFI_STATUS -EFIAPI -(0x172C)( - VOID -); - -/// find the HOB list in the -EFI_STATUS -EFIAPI -(0x159C)( - VOID -); - -EFI_STATUS -EFIAPI -configuration table( - VOID -); - -EFI_STATUS -EFIAPI -table entry: GUID (16 bytes) + VendorTable (8 bytes) = 24 bytes.( - VOID -); - -EFI_STATUS -EFIAPI -(IsHobListGuid ((EFI_GUID *)(&EntryPtr[Index * 3]))) {( - VOID -); - -EFI_STATUS -EFIAPI -(( - VOID -); - -/// locate the custom Lenovo protocol -EFI_STATUS -EFIAPI -(0x1420)( - VOID -); - -EFI_STATUS -EFIAPI -= gBootServicesBs_->AllocatePool (EfiBootServicesData, 31, &Pool);( - VOID -); - -/// CMOS-gated status code report -EFI_STATUS -EFIAPI -(0x14A8)( - VOID -); - -EFI_STATUS -EFIAPI -debug level from CMOS register 0x4B.( - VOID -); - -EFI_STATUS -EFIAPI -NMI bit (0x80) in the index byte.( - VOID -); - -EFI_STATUS -EFIAPI -= (UINT8)(IoRead8 (CMOS_PORT_INDEX) & CMOS_NMI_MASK) | CMOS_DEBUG_REG;( - VOID -); - -EFI_STATUS -EFIAPI -severity filter mask from the debug level.( - VOID -); - -EFI_STATUS -EFIAPI -0 -> silent (all filtered)( - VOID -); - -EFI_STATUS -EFIAPI -1 -> errors only (0xC0000000)( - VOID -); - -EFI_STATUS -EFIAPI -2 -> + warnings (0x80000000)( - VOID -); - -EFI_STATUS -EFIAPI -3 -> all severities( - VOID -); - -EFI_STATUS -EFIAPI -= REPORT_SEVERITY_ERROR;( - VOID -); - -/// forward ASSERT via the Lenovo protocol -EFI_STATUS -EFIAPI -(0x1528)( - VOID -); - -EFI_STATUS -EFIAPI -(0x168C)( - VOID -); - -EFI_STATUS -EFIAPI -callbacks( - VOID -); - -/// clear the boot-services pointer on ExitBootServices. -EFI_STATUS -EFIAPI -(0x1568)( - VOID -); - -EFI_STATUS -EFIAPI -EFIAPI( - VOID -); - -/// convert the Lenovo protocol pointer on ExitBS. -EFI_STATUS -EFIAPI -(0x1574)( - VOID -); - -/// NOP protocol notification. -EFI_STATUS -EFIAPI -(0x1674)( - VOID -); - -/// convert RuntimeServices notification registration. -EFI_STATUS -EFIAPI -(0x1678)( - VOID -); - -/// convert runtime protocol ptr on ExitBS/VAC. -EFI_STATUS -EFIAPI -(0x16EC)( - VOID -); - -/// re-locate runtime protocol + set init done flag. -EFI_STATUS -EFIAPI -(0x1714)( - VOID -); - -/// main initialisation -EFI_STATUS -EFIAPI -(0x10F4)( - VOID -); - -EFI_STATUS -EFIAPI -= ImageHandle;( - VOID -); - -EFI_STATUS -EFIAPI -();( - VOID -); - -EFI_STATUS -EFIAPI -= gBootServicesBs_->RegisterProtocolNotify (( - VOID -); - -EFI_STATUS -EFIAPI -(0x10D0)( - VOID -); - -#endif /* __LNVDXESTATUSCODE_H__ */ \ No newline at end of file +#endif // LNVDXESTATUSCODE_H_ diff --git a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/EbcDxe/EbcDxe.c b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/EbcDxe/EbcDxe.c index 1b672ae..6dc16d7 100644 --- a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/EbcDxe/EbcDxe.c +++ b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/EbcDxe/EbcDxe.c @@ -9,34 +9,44 @@ #include "EbcDxe.h" +STATIC EFI_HANDLE mImageHandle = NULL; +STATIC EFI_SYSTEM_TABLE *mSystemTable = NULL; +STATIC EFI_BOOT_SERVICES *mBootServices = NULL; +STATIC EFI_RUNTIME_SERVICES *mRuntimeServices = NULL; + // Function: ModuleEntryPoint -EFI_STATUS ModuleEntryPoint(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) +EFI_STATUS +EFIAPI +ModuleEntryPoint ( + EFI_HANDLE ImageHandle, + EFI_SYSTEM_TABLE *SystemTable +) { - ::ImageHandle = (__int64)ImageHandle; + mImageHandle = ImageHandle; if ( !ImageHandle ) - sub_35B8( + ReportLibraryPointerAssert ( "e:\\hs\\MdePkg\\Library\\UefiBootServicesTableLib\\UefiBootServicesTableLib.c", 51, "gImageHandle != ((void *) 0)"); - ::SystemTable = (__int64)SystemTable; + mSystemTable = SystemTable; if ( !SystemTable ) - sub_35B8( + ReportLibraryPointerAssert ( "e:\\hs\\MdePkg\\Library\\UefiBootServicesTableLib\\UefiBootServicesTableLib.c", 57, "gST != ((void *) 0)"); - BootServices = (__int64)SystemTable->BootServices; - if ( !BootServices ) - sub_35B8( + mBootServices = SystemTable->BootServices; + if ( !mBootServices ) + ReportLibraryPointerAssert ( "e:\\hs\\MdePkg\\Library\\UefiBootServicesTableLib\\UefiBootServicesTableLib.c", 63, "gBS != ((void *) 0)"); - RuntimeServices = (__int64)SystemTable->RuntimeServices; - if ( !RuntimeServices ) - sub_35B8( + mRuntimeServices = SystemTable->RuntimeServices; + if ( !mRuntimeServices ) + ReportLibraryPointerAssert ( "e:\\hs\\MdePkg\\Library\\UefiRuntimeServicesTableLib\\UefiRuntimeServicesTableLib.c", 47, "gRT != ((void *) 0)"); - sub_376C(); - return sub_53C(ImageHandle); + InitializeUefiLibraryGlobals (); + return InitializeEbcGraphicsConsole (ImageHandle); } diff --git a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/EbcDxe/EbcDxe.h b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/EbcDxe/EbcDxe.h index f124a59..e267e9f 100644 --- a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/EbcDxe/EbcDxe.h +++ b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/EbcDxe/EbcDxe.h @@ -20,34 +20,37 @@ EFI_STATUS EFIAPI ModuleEntryPoint( - VOID + EFI_HANDLE ImageHandle, + EFI_SYSTEM_TABLE *SystemTable ); /// -/// sub_35B8 +/// ReportLibraryPointerAssert /// EFI_STATUS EFIAPI -sub_35B8( - VOID +ReportLibraryPointerAssert( + CHAR8 *File, + UINTN Line, + CHAR8 *Expression ); /// -/// sub_376C +/// InitializeUefiLibraryGlobals /// EFI_STATUS EFIAPI -sub_376C( +InitializeUefiLibraryGlobals( VOID ); /// -/// sub_53C +/// InitializeEbcGraphicsConsole /// EFI_STATUS EFIAPI -sub_53C( - VOID +InitializeEbcGraphicsConsole( + EFI_HANDLE ImageHandle ); -#endif /* __EBCDXE_H__ */ \ No newline at end of file +#endif /* __EBCDXE_H__ */ diff --git a/MdeModulePkg/Universal/PCD/Pei/Service.c/PchResetRuntime/PchResetRuntime.c b/MdeModulePkg/Universal/PCD/Pei/Service.c/PchResetRuntime/PchResetRuntime.c index 7df70d3..c8d7e34 100644 --- a/MdeModulePkg/Universal/PCD/Pei/Service.c/PchResetRuntime/PchResetRuntime.c +++ b/MdeModulePkg/Universal/PCD/Pei/Service.c/PchResetRuntime/PchResetRuntime.c @@ -1755,7 +1755,7 @@ FreePool(v22); /*0x23f8*/ Status = (*(__int64 ( **)(void *, __int64 (*)(), __int64 *))(qword_44B0 + 192))( /*0x2419*/ &unk_42B0, - sub_212C, + BootScriptCloseCallback, &qword_44B8); if ( Status < 0 ) /*0x2422*/ { @@ -1764,7 +1764,7 @@ } Status = (*(__int64 ( **)(void *, __int64 (*)(), __int64 *))(qword_44B0 + 192))( /*0x245e*/ &unk_4280, - sub_212C, + BootScriptCloseCallback, &qword_4498); if ( Status < 0 ) /*0x2467*/ { @@ -1776,7 +1776,7 @@ qword_4500 = v12; /*0x248b*/ Status = (*(__int64 ( **)(void *, __int64 (*)(), __int64 *))(qword_44B0 + 192))( /*0x24ae*/ &unk_4300, - sub_2030, + BootScriptSwitchBuffer, &qword_44C0); if ( Status < 0 ) /*0x24b7*/ { @@ -1851,7 +1851,7 @@ FreePool(v22); /*0x23f8*/ Status = (*(__int64 ( **)(void *, __int64 (*)(), __int64 *))(qword_44B0 + 192))( /*0x2419*/ &unk_42B0, - sub_212C, + BootScriptCloseCallback, &qword_44B8); if ( Status < 0 ) /*0x2422*/ { @@ -1860,7 +1860,7 @@ } Status = (*(__int64 ( **)(void *, __int64 (*)(), __int64 *))(qword_44B0 + 192))( /*0x245e*/ &unk_4280, - sub_212C, + BootScriptCloseCallback, &qword_4498); if ( Status < 0 ) /*0x2467*/ { @@ -1872,7 +1872,7 @@ qword_4500 = v12; /*0x248b*/ Status = (*(__int64 ( **)(void *, __int64 (*)(), __int64 *))(qword_44B0 + 192))( /*0x24ae*/ &unk_4300, - sub_2030, + BootScriptSwitchBuffer, &qword_44C0); if ( Status < 0 ) /*0x24b7*/ { diff --git a/MdePkg/Library/UefiBootServicesTableLib/UbaInitDxe/UbaInitDxe.c b/MdePkg/Library/UefiBootServicesTableLib/UbaInitDxe/UbaInitDxe.c index 4546808..4288405 100644 --- a/MdePkg/Library/UefiBootServicesTableLib/UbaInitDxe/UbaInitDxe.c +++ b/MdePkg/Library/UefiBootServicesTableLib/UbaInitDxe/UbaInitDxe.c @@ -11,4 +11,35 @@ // Function: ModuleEntryPoint -EFI_STATUS ModuleEntryPoint(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) { ::ImageHandle = (__int64)ImageHandle; if ( !ImageHandle ) sub_BB4( "e:\\hs\\MdePkg\\Library\\UefiBootServicesTableLib\\UefiBootServicesTableLib.c", 51, "gImageHandle != ((void *) 0)"); ::SystemTable = (__int64)SystemTable; if ( !SystemTable ) sub_BB4("e:\\hs\\MdePkg\\Library\\UefiBootServicesTableLib\\UefiBootServicesTableLib.c", 57, "gST != ((void *) 0)"); BootServices = (__int64)SystemTable->BootServices; if ( !BootServices ) sub_BB4("e:\\hs\\MdePkg\\Library\\UefiBootServicesTableLib\\UefiBootServicesTableLib.c", 63, "gBS != ((void *) 0)"); RuntimeServices = (__int64)SystemTable->RuntimeServices; if ( !RuntimeServices ) sub_BB4( "e:\\hs\\MdePkg\\Library\\UefiRuntimeServicesTableLib\\UefiRuntimeServicesTableLib.c", 47, "gRT != ((void *) 0)"); sub_BF4(); return sub_3FC(); } +EFI_STATUS ModuleEntryPoint(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) { + ::ImageHandle = (__int64)ImageHandle; + if (!ImageHandle) { + UbaInitDxeAssert( + "e:\\hs\\MdePkg\\Library\\UefiBootServicesTableLib\\UefiBootServicesTableLib.c", + 51, + "gImageHandle != ((void *) 0)"); + } + ::SystemTable = (__int64)SystemTable; + if (!SystemTable) { + UbaInitDxeAssert( + "e:\\hs\\MdePkg\\Library\\UefiBootServicesTableLib\\UefiBootServicesTableLib.c", + 57, + "gST != ((void *) 0)"); + } + BootServices = (__int64)SystemTable->BootServices; + if (!BootServices) { + UbaInitDxeAssert( + "e:\\hs\\MdePkg\\Library\\UefiBootServicesTableLib\\UefiBootServicesTableLib.c", + 63, + "gBS != ((void *) 0)"); + } + RuntimeServices = (__int64)SystemTable->RuntimeServices; + if (!RuntimeServices) { + UbaInitDxeAssert( + "e:\\hs\\MdePkg\\Library\\UefiRuntimeServicesTableLib\\UefiRuntimeServicesTableLib.c", + 47, + "gRT != ((void *) 0)"); + } + InitializeUbaDatabase(); + return InstallUbaProtocolDispatch(); +} diff --git a/MdePkg/Library/UefiBootServicesTableLib/UbaInitDxe/UbaInitDxe.h b/MdePkg/Library/UefiBootServicesTableLib/UbaInitDxe/UbaInitDxe.h index 09488fc..a095bd0 100644 --- a/MdePkg/Library/UefiBootServicesTableLib/UbaInitDxe/UbaInitDxe.h +++ b/MdePkg/Library/UefiBootServicesTableLib/UbaInitDxe/UbaInitDxe.h @@ -24,30 +24,30 @@ ); /// -/// sub_BB4 +/// UbaInitDxeAssert /// EFI_STATUS EFIAPI -sub_BB4( +UbaInitDxeAssert( VOID ); /// -/// sub_BF4 +/// InitializeUbaDatabase /// EFI_STATUS EFIAPI -sub_BF4( +InitializeUbaDatabase( VOID ); /// -/// sub_3FC +/// InstallUbaProtocolDispatch /// EFI_STATUS EFIAPI -sub_3FC( +InstallUbaProtocolDispatch( VOID ); -#endif /* __UBAINITDXE_H__ */ \ No newline at end of file +#endif /* __UBAINITDXE_H__ */ diff --git a/MdePkg/Library/UefiBootServicesTableLib/UuidDxe/UuidDxe.c b/MdePkg/Library/UefiBootServicesTableLib/UuidDxe/UuidDxe.c index 0b7c09e..d5cb6c5 100644 --- a/MdePkg/Library/UefiBootServicesTableLib/UuidDxe/UuidDxe.c +++ b/MdePkg/Library/UefiBootServicesTableLib/UuidDxe/UuidDxe.c @@ -10,5 +10,45 @@ #include "UuidDxe.h" -// Function: ModuleEntryPoint -EFI_STATUS ModuleEntryPoint(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) { ::ImageHandle = (__int64)ImageHandle; if ( !ImageHandle ) sub_6B8( "e:\\hs\\MdePkg\\Library\\UefiBootServicesTableLib\\UefiBootServicesTableLib.c", 51, "gImageHandle != ((void *) 0)"); ::SystemTable = (__int64)SystemTable; if ( !SystemTable ) sub_6B8("e:\\hs\\MdePkg\\Library\\UefiBootServicesTableLib\\UefiBootServicesTableLib.c", 57, "gST != ((void *) 0)"); BootServices = (__int64)SystemTable->BootServices; if ( !BootServices ) sub_6B8("e:\\hs\\MdePkg\\Library\\UefiBootServicesTableLib\\UefiBootServicesTableLib.c", 63, "gBS != ((void *) 0)"); RuntimeServices = (__int64)SystemTable->RuntimeServices; if ( !RuntimeServices ) sub_6B8( "e:\\hs\\MdePkg\\Library\\UefiRuntimeServicesTableLib\\UefiRuntimeServicesTableLib.c", 47, "gRT != ((void *) 0)"); sub_6F8(); return sub_3FC(); } +EFI_STATUS +EFIAPI +ModuleEntryPoint ( + EFI_HANDLE ImageHandle, + EFI_SYSTEM_TABLE *SystemTable + ) +{ + gImageHandle = ImageHandle; + if (!ImageHandle) { + ValidateBootServicesTablePointers( + "e:\\hs\\MdePkg\\Library\\UefiBootServicesTableLib\\UefiBootServicesTableLib.c", + 51, + "gImageHandle != ((void *) 0)"); + } + + gST = SystemTable; + if (!SystemTable) { + ValidateBootServicesTablePointers( + "e:\\hs\\MdePkg\\Library\\UefiBootServicesTableLib\\UefiBootServicesTableLib.c", + 57, + "gST != ((void *) 0)"); + } + + gBS = SystemTable->BootServices; + if (!gBS) { + ValidateBootServicesTablePointers( + "e:\\hs\\MdePkg\\Library\\UefiBootServicesTableLib\\UefiBootServicesTableLib.c", + 63, + "gBS != ((void *) 0)"); + } + + gRT = SystemTable->RuntimeServices; + if (!gRT) { + ValidateBootServicesTablePointers( + "e:\\hs\\MdePkg\\Library\\UefiRuntimeServicesTableLib\\UefiRuntimeServicesTableLib.c", + 47, + "gRT != ((void *) 0)"); + } + + InitializeUuidRuntimeServices(); + return UuidDxeMain(); +} diff --git a/MdePkg/Library/UefiBootServicesTableLib/UuidDxe/UuidDxe.h b/MdePkg/Library/UefiBootServicesTableLib/UuidDxe/UuidDxe.h index 45e446d..5014654 100644 --- a/MdePkg/Library/UefiBootServicesTableLib/UuidDxe/UuidDxe.h +++ b/MdePkg/Library/UefiBootServicesTableLib/UuidDxe/UuidDxe.h @@ -20,34 +20,37 @@ EFI_STATUS EFIAPI ModuleEntryPoint( - VOID + EFI_HANDLE ImageHandle, + EFI_SYSTEM_TABLE *SystemTable ); /// -/// sub_6B8 +/// ValidateBootServicesTablePointers +/// +VOID +EFIAPI +ValidateBootServicesTablePointers( + IN CONST CHAR8 *FileName, + IN UINTN LineNumber, + IN CONST CHAR8 *Expression +); + +/// +/// InitializeUuidRuntimeServices /// EFI_STATUS EFIAPI -sub_6B8( +InitializeUuidRuntimeServices( VOID ); /// -/// sub_6F8 +/// UuidDxeMain /// EFI_STATUS EFIAPI -sub_6F8( +UuidDxeMain( VOID ); -/// -/// sub_3FC -/// -EFI_STATUS -EFIAPI -sub_3FC( - VOID -); - -#endif /* __UUIDDXE_H__ */ \ No newline at end of file +#endif /* __UUIDDXE_H__ */ diff --git a/PurleySktPkg/Dxe/FpgaInit/FpgaSocketSetup/FpgaSocketSetup.c b/PurleySktPkg/Dxe/FpgaInit/FpgaSocketSetup/FpgaSocketSetup.c index 9170874..4b2b003 100644 --- a/PurleySktPkg/Dxe/FpgaInit/FpgaSocketSetup/FpgaSocketSetup.c +++ b/PurleySktPkg/Dxe/FpgaInit/FpgaSocketSetup/FpgaSocketSetup.c @@ -1,9 +1,6 @@ /** @file FpgaSocketSetup.c -- FpgaSocketSetup - Auto-converted from IDA decompiler output. - Functions: 1 - Copyright (c) HR650X BIOS Decompilation Project **/ @@ -13,11 +10,11 @@ // Function: ModuleEntryPoint EFI_STATUS ModuleEntryPoint(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) { - signed __int64 v4; // rbx + EFI_STATUS Status; - sub_450(); - v4 = sub_BE4(ImageHandle, SystemTable); - if ( v4 < 0 ) - sub_864(); - return v4; + InitializeFpgaSocketSetupContext(); + Status = FpgaSocketSetupMain(ImageHandle, SystemTable); + if (EFI_ERROR (Status)) + FpgaSocketConfigurationErrorHandler(); + return Status; } diff --git a/PurleySktPkg/Dxe/FpgaInit/FpgaSocketSetup/FpgaSocketSetup.h b/PurleySktPkg/Dxe/FpgaInit/FpgaSocketSetup/FpgaSocketSetup.h index 42dedcc..b0aa226 100644 --- a/PurleySktPkg/Dxe/FpgaInit/FpgaSocketSetup/FpgaSocketSetup.h +++ b/PurleySktPkg/Dxe/FpgaInit/FpgaSocketSetup/FpgaSocketSetup.h @@ -14,40 +14,39 @@ // Function Prototypes // +/// InitializeFpgaSocketSetupContext -- Pre-initialization and global data setup. +/// +EFI_STATUS +EFIAPI +InitializeFpgaSocketSetupContext( + VOID +); + +/// FpgaSocketSetupMain -- Main HII form and configuration driver. +/// +EFI_STATUS +EFIAPI +FpgaSocketSetupMain( + EFI_HANDLE ImageHandle, + EFI_SYSTEM_TABLE *SystemTable +); + +/// FpgaSocketConfigurationErrorHandler -- FPGA configuration error / fallback handler. +/// +EFI_STATUS +EFIAPI +FpgaSocketConfigurationErrorHandler( + VOID +); + /// /// ModuleEntryPoint -- UEFI entry point / initialization function /// EFI_STATUS EFIAPI ModuleEntryPoint( - VOID + EFI_HANDLE ImageHandle, + EFI_SYSTEM_TABLE *SystemTable ); -/// -/// sub_450 -/// -EFI_STATUS -EFIAPI -sub_450( - VOID -); - -/// -/// sub_BE4 -/// -EFI_STATUS -EFIAPI -sub_BE4( - VOID -); - -/// -/// sub_864 -/// -EFI_STATUS -EFIAPI -sub_864( - VOID -); - -#endif /* __FPGASOCKETSETUP_H__ */ \ No newline at end of file +#endif /* __FPGASOCKETSETUP_H__ */ diff --git a/PurleySktPkg/Dxe/IioInit/IioInit/IioInit.c b/PurleySktPkg/Dxe/IioInit/IioInit/IioInit.c index c0eac23..05bcdd5 100644 --- a/PurleySktPkg/Dxe/IioInit/IioInit/IioInit.c +++ b/PurleySktPkg/Dxe/IioInit/IioInit/IioInit.c @@ -32,18 +32,21 @@ // // Global IIO data // -UINT8 byte_DD59 = 0; // S3 boot script flag -UINT64 qword_DD20 = 0; // PCD token for PcdIioRevision -UINT64 qword_DE18 = 0; // PCD token for PcdIioPostInitDone -UINT64 qword_DE20 = 0; // Boot script label pointer -UINT64 qword_DE28 = 0; // Boot script label entry -UINT32 dword_DCA8 = 0; // MCFG table +UINT8 mBootScriptInitialized = 0; // S3 boot script flag +UINT64 mIioRevisionTokenValue = 0; // PCD token for PcdIioRevision +UINT64 mIioPostInitDoneTokenValue = 0; // PCD token for PcdIioPostInitDone +UINT64 mBootScriptLabelPointer = 0; // Boot script label pointer +UINT64 mBootScriptLabelEntry = 0; // Boot script label entry +UINT32 mMmcfgTableDefaultHeader = 0; // MCFG table // // Access width/stride table: byte pairs of (element_size, stride_size) for // access widths 0..3, plus two more entries at +16 for the receive stride. // -UINT8 byte_A7C0[32] = { 0 }; +UINT8 mPcieAccessWidthStrides[32] = { 0 }; + +#define IIO_PCD_MMCFG_TABLE_TOKEN 6 +#define IIO_PCD_MMCFG_BASE_TOKEN 5 // // GUID definitions for IIO protocols @@ -344,7 +347,7 @@ // Get PCD interface and read IIO revision token // PcdInterface = (UINT64)GetPcdProtocol (); - qword_DD20 = ((PCD_PROTOCOL *)PcdInterface)->Get64 (PcdIioRevision); + mIioRevisionTokenValue = ((PCD_PROTOCOL *)PcdInterface)->Get64 (PcdIioRevision); // // Check IIO revision and optionally fix up IioRevision @@ -395,7 +398,7 @@ // Signal that IIO post-init is done // PcdInterface = (UINT64)GetPcdProtocol (); - qword_DE18 = ((PCD_PROTOCOL *)PcdInterface)->Get64 (PcdIioPostInitDone); + mIioPostInitDoneTokenValue = ((PCD_PROTOCOL *)PcdInterface)->Get64 (PcdIioPostInitDone); return EFI_SUCCESS; } @@ -513,13 +516,13 @@ VOID ) { - if (qword_DE20 != qword_DE28) { + if (mBootScriptLabelPointer != mBootScriptLabelEntry) { S3BootScriptLabel (0, 0); - if (*(UINT64 *)qword_DE28 == 0) { - CopyMem ((VOID *)qword_DE28, (VOID *)qword_DE20, 32); - *(UINT8 *)(qword_DE28 + 14) = 1; + if (*(UINT64 *)mBootScriptLabelEntry == 0) { + CopyMem ((VOID *)mBootScriptLabelEntry, (VOID *)mBootScriptLabelPointer, 32); + *(UINT8 *)(mBootScriptLabelEntry + 14) = 1; } - qword_DE20 = qword_DE28; + mBootScriptLabelPointer = mBootScriptLabelEntry; } return 0; @@ -599,11 +602,11 @@ return Status; } - if (!byte_DD59) { + if (!mBootScriptInitialized) { SocketData = (IIO_SOCKET_DATA *)StackProtocol; if (*(UINT8 *)((UINT8 *)SocketData + 4855)) { IioIoatInit (); - byte_DD59 = TRUE; + mBootScriptInitialized = TRUE; } } @@ -1051,7 +1054,7 @@ Checks alignment, access width, and size constraints. - @param[in] AccessWidth Encoded access width (0..3) mapped via byte_A7C0. + @param[in] AccessWidth Encoded access width (0..3) mapped via mPcieAccessWidthStrides. @param[in] Address Base address. @param[in] Count Number of elements. @param[in] ElementSize Element size override (0 = auto). @@ -1091,7 +1094,7 @@ // // Check alignment // - ElementAlignment = byte_A7C0[WidthIndex]; + ElementAlignment = mPcieAccessWidthStrides[WidthIndex]; if ((Address & (ElementAlignment - 1)) != 0) { return EFI_BAD_BUFFER_SIZE; } @@ -1110,7 +1113,7 @@ // Check buffer alignment // { - UINTN Stride = byte_A7C0[WidthIndex]; + UINTN Stride = mPcieAccessWidthStrides[WidthIndex]; if (Stride > 8) { Stride = 8; } @@ -1158,8 +1161,8 @@ } if (Count > 0) { - ElementStride = byte_A7C0[WidthIndex]; - BufferStride = byte_A7C0[WidthIndex + 16]; + ElementStride = mPcieAccessWidthStrides[WidthIndex]; + BufferStride = mPcieAccessWidthStrides[WidthIndex + 16]; do { MmioReadBuffer (WidthIndex & 3, CurrentAddress, Buffer); @@ -1208,8 +1211,8 @@ } if (Count > 0) { - ElementStride = byte_A7C0[WidthIndex]; - BufferStride = byte_A7C0[WidthIndex + 16]; + ElementStride = mPcieAccessWidthStrides[WidthIndex]; + BufferStride = mPcieAccessWidthStrides[WidthIndex + 16]; do { MmioWriteBuffer (WidthIndex & 3, CurrentAddress, Buffer); @@ -1259,6 +1262,21 @@ return 0; } +// +// --------------------------------------------------------------------------- +// MMCFG PCD helpers +// --------------------------------------------------------------------------- + +STATIC +UINT64 +EFIAPI +IioInitGetPcdMmcfgBaseAddress ( + IN UINTN PcdToken + ) +{ + return IioInitGetPcdProtocol ()->Get64 (PcdToken); +} + /** Initialize the PCIe MMCFG table from given header. @@ -1279,19 +1297,24 @@ PCD_PROTOCOL *PcdProtocol; TotalSize = 16 * SegmentCount + 16; - PcdProtocol = (PCD_PROTOCOL *)sub_4500 (6); + PcdProtocol = (PCD_PROTOCOL *)IioInitGetPcdProtocol (); // // Validate that MMCFG table fits in PCD-allocated space // - if (sub_CF0 () && TotalSize >= (UINTN)PcdProtocol->GetSize (6)) { + if (ProcessLibraryEntryPoint () && + TotalSize >= (UINTN)PcdProtocol->GetSize (IIO_PCD_MMCFG_TABLE_TOKEN)) { ASSERT ( "MmcfgTableSize < LibPcdGetSize(6U)" ); } - MmcfgTable = (MMCFG_TABLE_DESCRIPTOR *)PcdProtocol->GetSize (6); - IioInitCopyMem (MmcfgTable, TableHeader, (UINTN)PcdProtocol->GetSize (6)); + MmcfgTable = (MMCFG_TABLE_DESCRIPTOR *)PcdProtocol->GetPtr (IIO_PCD_MMCFG_TABLE_TOKEN); + IioInitCopyMem ( + MmcfgTable, + TableHeader, + (UINTN)PcdProtocol->GetSize (IIO_PCD_MMCFG_TABLE_TOKEN) + ); MmcfgTable->TableSize = TotalSize; @@ -1299,7 +1322,7 @@ // If base address not provided, use PCD default // if (!TableHeader->OemId && !TableHeader->Reserved) { - MmcfgTable->BaseAddresses[0] = sub_44E4 (5); + MmcfgTable->BaseAddresses[0] = IioInitGetPcdMmcfgBaseAddress (IIO_PCD_MMCFG_BASE_TOKEN); } return EFI_SUCCESS; @@ -1320,27 +1343,30 @@ { MMCFG_TABLE_DESCRIPTOR *MmcfgTable; UINT64 TableHandle; + PCD_PROTOCOL *PcdProtocol; TableHandle = 0; if (Address->Bus != 0) { TableHandle = Address->Bus; } else { - TableHandle = (UINT64)sub_4500 (6); + PcdProtocol = IioInitGetPcdProtocol (); + TableHandle = (UINT64)PcdProtocol->GetPtr (IIO_PCD_MMCFG_TABLE_TOKEN); if (*(UINT32 *)(TableHandle + 4) == 0) { - IioInitInitMmcfgTable (&dword_DCA8, 8); + IioInitInitMmcfgTable ((MCFG_TABLE_HEADER *)&mMmcfgTableDefaultHeader, 8); } } MmcfgTable = (MMCFG_TABLE_DESCRIPTOR *)TableHandle; - if (sub_CF0 () && Address->Segment >= MmcfgTable->SegmentMax) { + if (ProcessLibraryEntryPoint () && Address->Segment >= MmcfgTable->SegmentMax) { ASSERT ( "Address->Pcie.Seg < MmcfgTable->Header.SegMax" ); } - if (sub_CF0 () && (MmcfgTable->ValidSegMap & (1 << Address->Segment)) == 0) { + if (ProcessLibraryEntryPoint () && + (MmcfgTable->ValidSegMap & (1 << Address->Segment)) == 0) { ASSERT ( "(1<Pcie.Seg) & MmcfgTable->Header.ValidSegMap" ); @@ -1380,4 +1406,4 @@ } return Status; -} \ No newline at end of file +} diff --git a/PurleySktPkg/Dxe/IioInit/IioInit/IioInit.h b/PurleySktPkg/Dxe/IioInit/IioInit/IioInit.h index d52e724..7bf0aef 100644 --- a/PurleySktPkg/Dxe/IioInit/IioInit/IioInit.h +++ b/PurleySktPkg/Dxe/IioInit/IioInit/IioInit.h @@ -1,7 +1,5 @@ /** @file - IioInit.h -- Header for IioInit - -Copyright (c) HR650X BIOS Decompilation Project + IioInit.h -- Header for IIO DXE initialization driver. **/ #ifndef __IIOINIT_H__ @@ -9,476 +7,42 @@ #include "../uefi_headers/Uefi.h" -// -// Function Prototypes -// - EFI_STATUS EFIAPI -IioInitAssert( - VOID -); +ModuleEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ); EFI_STATUS EFIAPI -IioInitGetMmPciBaseProtocol( +IioInitEntry ( VOID -); + ); EFI_STATUS EFIAPI -IioInitGetStackProtocol( +IioInitErrorHandler ( VOID -); + ); EFI_STATUS EFIAPI -ModuleEntryPoint( - VOID -); +IioInitReadyToBoot ( + IN EFI_EVENT Event, + IN VOID *Context + ); EFI_STATUS EFIAPI -EFI protocol pointers( +IioInitExitBootServices ( VOID -); + ); EFI_STATUS EFIAPI -ImageHandle = NULL;( +IioInitS3BootScriptPciCfg ( VOID -); + ); -EFI_STATUS -EFIAPI -IIO data( - VOID -); - -EFI_STATUS -EFIAPI -byte_DD59 = 0; // S3 boot script flag( - VOID -); - -EFI_STATUS -EFIAPI -token for PcdIioRevision( - VOID -); - -EFI_STATUS -EFIAPI -token for PcdIioPostInitDone( - VOID -); - -EFI_STATUS -EFIAPI -script label pointer( - VOID -); - -EFI_STATUS -EFIAPI -script label entry( - VOID -); - -EFI_STATUS -EFIAPI -table( - VOID -); - -EFI_STATUS -EFIAPI -width/stride table: byte pairs of (element_size, stride_size) for( - VOID -); - -EFI_STATUS -EFIAPI -widths 0..3, plus two more entries at +16 for the receive stride.( - VOID -); - -EFI_STATUS -EFIAPI -byte_A7C0[32] = { 0 };( - VOID -); - -EFI_STATUS -EFIAPI -definitions for IIO protocols( - VOID -); - -EFI_STATUS -EFIAPI -gIioStackProtocolGuid = { 0x0 }; // unk_AA70 - IIO Stack Protocol( - VOID -); - -EFI_STATUS -EFIAPI -- MM PCIe Base Protocol( - VOID -); - -EFI_STATUS -EFIAPI -- PCD Protocol( - VOID -); - -EFI_STATUS -EFIAPI -declarations of static helper functions( - VOID -); - -EFI_STATUS -EFIAPI -VOID( - VOID -); - -EFI_STATUS -EFIAPI -/ Debug helper( - VOID -); - -EFI_STATUS -EFIAPI -initialization core (entry logic)( - VOID -); - -EFI_STATUS -EFIAPI -image handle and system table globally( - VOID -); - -EFI_STATUS -EFIAPI -= ImageHandleParam;( - VOID -); - -EFI_STATUS -EFIAPI -boot services and runtime services tables( - VOID -); - -EFI_STATUS -EFIAPI -= SystemTable->BootServices;( - VOID -); - -EFI_STATUS -EFIAPI -the DxeServicesTable (gDS)( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->LocateProtocol (&gDxeServicesTableGuid( - VOID -); - -EFI_STATUS -EFIAPI -initialization( - VOID -); - -EFI_STATUS -EFIAPI -(EFI_ERROR (Status)) {( - VOID -); - -EFI_STATUS -EFIAPI -the MM PCIe Base protocol( - VOID -); - -EFI_STATUS -EFIAPI -(mPciUsra == NULL) {( - VOID -); - -EFI_STATUS -EFIAPI -();( - VOID -); - -EFI_STATUS -EFIAPI -PCD interface and read IIO revision token( - VOID -); - -EFI_STATUS -EFIAPI -= (UINT64)GetPcdProtocol ();( - VOID -); - -EFI_STATUS -EFIAPI -IIO revision and optionally fix up IioRevision( - VOID -); - -EFI_STATUS -EFIAPI -= (UINT8 *)PcdGetPtr (PcdIioRevision);( - VOID -); - -EFI_STATUS -EFIAPI -interrupt state then call initialization routines( - VOID -); - -EFI_STATUS -EFIAPI -= SaveAndDisableInterrupts ();( - VOID -); - -EFI_STATUS -EFIAPI -loop for timestamp to advance (small delay)( - VOID -); - -EFI_STATUS -EFIAPI -(((Timestamp + 357 - (UINT32)ReadTimestamp ()) & 0x800000) == 0) {( - VOID -); - -EFI_STATUS -EFIAPI -interrupt state( - VOID -); - -EFI_STATUS -EFIAPI -(InterruptsEnabled) {( - VOID -); - -EFI_STATUS -EFIAPI -protocols / call main IIO initialization chain( - VOID -); - -EFI_STATUS -EFIAPI -= IioInitEntry ();( - VOID -); - -EFI_STATUS -EFIAPI -that IIO post-init is done( - VOID -); - -EFI_STATUS -EFIAPI -Stack access helpers( - VOID -); - -EFI_STATUS -EFIAPI -Protocol helper( - VOID -); - -EFI_STATUS -EFIAPI -script S3 support( - VOID -); - -EFI_STATUS -EFIAPI -/ VT-d initialization( - VOID -); - -EFI_STATUS -EFIAPI -port configuration( - VOID -); - -EFI_STATUS -EFIAPI -current hot-plug and link status registers( - VOID -); - -EFI_STATUS -EFIAPI -= StackProtocol->Read (SocketIndex, 0, PCIE_HP_REG);( - VOID -); - -EFI_STATUS -EFIAPI -hot-plug detect on this port( - VOID -); - -EFI_STATUS -EFIAPI -= HotPlugReg | 1;( - VOID -); - -EFI_STATUS -EFIAPI -slot capability( - VOID -); - -EFI_STATUS -EFIAPI -back link control registers( - VOID -); - -EFI_STATUS -EFIAPI -= LinkStatusReg;( - VOID -); - -EFI_STATUS -EFIAPI -sub-class from class code register( - VOID -); - -EFI_STATUS -EFIAPI -= StackProtocol->Read (SocketIndex, StackId, PCIE_CLASS_REG);( - VOID -); - -EFI_STATUS -EFIAPI -IOAPIC redirection for all 8 ports( - VOID -); - -EFI_STATUS -EFIAPI -(PortIndex = 0; PortIndex < 8; PortIndex++) {( - VOID -); - -EFI_STATUS -EFIAPI -MMCFG / Address library routines (from PcieCommonInitLib / PcieAddressLib)( - VOID -); - -EFI_STATUS -EFIAPI -address translation (from PcieAddressLib / CpRcPkg)( - VOID -); - -EFI_STATUS -EFIAPI -element size to 1 for access widths 4..7( - VOID -); - -EFI_STATUS -EFIAPI -(AccessWidth - 4 <= 3) {( - VOID -); - -EFI_STATUS -EFIAPI -alignment( - VOID -); - -EFI_STATUS -EFIAPI -= byte_A7C0[WidthIndex];( - VOID -); - -EFI_STATUS -EFIAPI -address range( - VOID -); - -EFI_STATUS -EFIAPI -(Count > 0) {( - VOID -); - -EFI_STATUS -EFIAPI -buffer alignment( - VOID -); - -EFI_STATUS -EFIAPI -that MMCFG table fits in PCD-allocated space( - VOID -); - -EFI_STATUS -EFIAPI -(sub_CF0 () && TotalSize >= (UINTN)PcdProtocol->GetSize (6)) {( - VOID -); - -EFI_STATUS -EFIAPI -base address not provided, use PCD default( - VOID -); - -EFI_STATUS -EFIAPI -(!TableHeader->OemId && !TableHeader->Reserved) {( - VOID -); - -EFI_STATUS -EFIAPI -Entry Point( - VOID -); - -#endif /* __IIOINIT_H__ */ \ No newline at end of file +#endif