diff --git a/AmiIntelCpuPkg/Microcode/MicrocodeUpdate/MicrocodeUpdate.c b/AmiIntelCpuPkg/Microcode/MicrocodeUpdate/MicrocodeUpdate.c index 3d745ba..fff3b01 100644 --- a/AmiIntelCpuPkg/Microcode/MicrocodeUpdate/MicrocodeUpdate.c +++ b/AmiIntelCpuPkg/Microcode/MicrocodeUpdate/MicrocodeUpdate.c @@ -19,22 +19,22 @@ __int64 v2; // rax EFI_STATUS v3; // rbx - sub_600(ImageHandle, SystemTable); + InitializeMicrocodeUpdateServices(ImageHandle, SystemTable); qword_5128 = 0x8000000000000001uLL; - if ( !sub_390(&unk_5030) ) + if ( !IsMicrocodeUpdateRequired(&unk_5030) ) { - v2 = sub_19A0(); + v2 = GetMicrocodeUpdateStatus(); if ( v2 >= 0 || qword_5128 < 0 ) qword_5128 = v2; - sub_1F9C(&unk_5030); - sub_460(&unk_5030, -1); - sub_1DD0( + InitializeMicrocodeUpdateContext(&unk_5030); + ConfigureMicrocodeUpdateContext(&unk_5030, -1); + LogMicrocodeUpdateAssertion( "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\AmiIntelCpuPkg\\Microcode\\MicrocodeUpdate\\MicrocodeUpdate\\DEBUG\\AutoGen.c", 542, "((BOOLEAN)(0==1))"); - sub_1DD0( + LogMicrocodeUpdateAssertion( "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\AmiIntelCpuPkg\\Microcode\\MicrocodeUpdate\\MicrocodeUpdate\\DEBUG\\AutoGen.c", 557, "((BOOLEAN)(0==1))"); @@ -42,6 +42,6 @@ v3 = qword_5128; if ( qword_5128 < 0 ) - sub_2058(qword_5198); + DispatchMicrocodeUpdateCompletion(qword_5198); return v3; } diff --git a/AmiIntelCpuPkg/Microcode/MicrocodeUpdate/MicrocodeUpdate.h b/AmiIntelCpuPkg/Microcode/MicrocodeUpdate/MicrocodeUpdate.h index fd20b7f..6a79e85 100644 --- a/AmiIntelCpuPkg/Microcode/MicrocodeUpdate/MicrocodeUpdate.h +++ b/AmiIntelCpuPkg/Microcode/MicrocodeUpdate/MicrocodeUpdate.h @@ -26,66 +26,66 @@ ); /// -/// sub_600 +/// InitializeMicrocodeUpdateServices /// EFI_STATUS EFIAPI -sub_600( +InitializeMicrocodeUpdateServices( VOID ); /// -/// sub_19A0 +/// GetMicrocodeUpdateStatus /// EFI_STATUS EFIAPI -sub_19A0( +GetMicrocodeUpdateStatus( VOID ); /// -/// sub_1F9C +/// InitializeMicrocodeUpdateContext /// EFI_STATUS EFIAPI -sub_1F9C( +InitializeMicrocodeUpdateContext( VOID ); /// -/// sub_460 +/// ConfigureMicrocodeUpdateContext /// EFI_STATUS EFIAPI -sub_460( +ConfigureMicrocodeUpdateContext( VOID ); /// -/// sub_1DD0 +/// LogMicrocodeUpdateAssertion /// EFI_STATUS EFIAPI -sub_1DD0( +LogMicrocodeUpdateAssertion( VOID ); /// -/// sub_390 +/// IsMicrocodeUpdateRequired /// EFI_STATUS EFIAPI -sub_390( +IsMicrocodeUpdateRequired( VOID ); /// -/// sub_2058 +/// DispatchMicrocodeUpdateCompletion /// EFI_STATUS EFIAPI -sub_2058( +DispatchMicrocodeUpdateCompletion( VOID ); -#endif /* __MICROCODEUPDATE_H__ */ \ No newline at end of file +#endif /* __MICROCODEUPDATE_H__ */ diff --git a/AmiIpmiPkg/Ipmi/BmcAcpi/BmcAcpi/BmcAcpi.c b/AmiIpmiPkg/Ipmi/BmcAcpi/BmcAcpi/BmcAcpi.c index 847078a..fa14e7f 100644 --- a/AmiIpmiPkg/Ipmi/BmcAcpi/BmcAcpi/BmcAcpi.c +++ b/AmiIpmiPkg/Ipmi/BmcAcpi/BmcAcpi/BmcAcpi.c @@ -8,8 +8,8 @@ // // Module entry point recovered from the generated wrapper. -// The call flow is preserved: constructor, init, teardown, then the -// two generated ASSERT stubs from AutoGen.c. +// The recovered AutoGen flow is preserved: constructor, guarded init, +// cleanup, then the two generated ASSERT stubs from AutoGen.c. // EFI_STATUS EFIAPI @@ -18,25 +18,25 @@ EFI_SYSTEM_TABLE *SystemTable ) { - __int64 Status; + __int64 ModuleStatus; - sub_494 (ImageHandle, SystemTable); + BmcAcpiConstructor (ImageHandle, SystemTable); qword_F98 = 0x8000000000000001uLL; - if (!sub_280 (&unk_EA0)) { - Status = sub_674 (); - if (Status >= 0 || qword_F98 < 0) { - qword_F98 = Status; + if (!BmcAcpiSetJumpSave (&unk_EA0)) { + ModuleStatus = BmcAcpiInitialize (); + if (ModuleStatus >= 0 || qword_F98 < 0) { + qword_F98 = ModuleStatus; } - sub_7B0 (&unk_EA0); - sub_320 (&unk_EA0, -1); - sub_8D0 ( + BmcAcpiCleanup (&unk_EA0); + BmcAcpiSetJumpRecover (&unk_EA0, -1); + BmcAcpiAssertStub ( "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\AmiIpmiPkg\\Ipmi\\BmcAcpi\\BmcAcpi\\DEBUG\\AutoGen.c", 179, "((BOOLEAN)(0==1))" ); - sub_8D0 ( + BmcAcpiAssertStub ( "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\AmiIpmiPkg\\Ipmi\\BmcAcpi\\BmcAcpi\\DEBUG\\AutoGen.c", 194, "((BOOLEAN)(0==1))" diff --git a/AmiIpmiPkg/Ipmi/BmcAcpi/BmcAcpi/BmcAcpi.h b/AmiIpmiPkg/Ipmi/BmcAcpi/BmcAcpi/BmcAcpi.h index 182f1e2..827bf3b 100644 --- a/AmiIpmiPkg/Ipmi/BmcAcpi/BmcAcpi/BmcAcpi.h +++ b/AmiIpmiPkg/Ipmi/BmcAcpi/BmcAcpi/BmcAcpi.h @@ -26,57 +26,58 @@ ); /// -/// sub_494 +/// BmcAcpiConstructor -- AutoGen constructor that captures the image handle +/// and system table for later ACPI table installation. /// EFI_STATUS EFIAPI -sub_494( +BmcAcpiConstructor( VOID ); /// -/// sub_674 +/// BmcAcpiInitialize -- core BMC ACPI initialization path. /// EFI_STATUS EFIAPI -sub_674( +BmcAcpiInitialize( VOID ); /// -/// sub_7B0 +/// BmcAcpiCleanup -- teardown helper used on module unload. /// EFI_STATUS EFIAPI -sub_7B0( +BmcAcpiCleanup( VOID ); /// -/// sub_320 +/// BmcAcpiSetJumpRecover -- restore the recovered init guard context. /// EFI_STATUS EFIAPI -sub_320( +BmcAcpiSetJumpRecover( VOID ); /// -/// sub_8D0 +/// BmcAcpiAssertStub -- recovered AutoGen ASSERT stub. /// EFI_STATUS EFIAPI -sub_8D0( +BmcAcpiAssertStub( VOID ); /// -/// sub_280 +/// BmcAcpiSetJumpSave -- capture the init guard context before recovery. /// EFI_STATUS EFIAPI -sub_280( +BmcAcpiSetJumpSave( VOID ); -#endif /* __BMCACPI_H__ */ \ No newline at end of file +#endif /* __BMCACPI_H__ */ diff --git a/AmiIpmiPkg/Ipmi/BmcElog/BmcElog/BmcElog.c b/AmiIpmiPkg/Ipmi/BmcElog/BmcElog/BmcElog.c index d20e233..666173a 100644 --- a/AmiIpmiPkg/Ipmi/BmcElog/BmcElog/BmcElog.c +++ b/AmiIpmiPkg/Ipmi/BmcElog/BmcElog/BmcElog.c @@ -53,15 +53,14 @@ @return Destination. **/ -VOID *EFIAPI InternalCopyMem ( +VOID *EFIAPI BmcElogCopyMem ( VOID *Destination, const VOID *Source, UINTN Length ) { // - // sub_19C0: validates overlap, then calls sub_1000 - // sub_1000: qmemcpy with 8-byte-aligned bulk then remainder + // Copy with overlap handling. // if ((UINTN)Source < (UINTN)Destination && (UINTN)Source + Length - 1 >= (UINTN)Destination) @@ -84,8 +83,6 @@ } // - // sub_1000: actual copy with overlap handling - // { UINT8 *Dst8 = (UINT8 *)Destination; UINT8 *Src8 = (UINT8 *)Source; @@ -127,13 +124,13 @@ @return Buffer. **/ -VOID *EFIAPI InternalZeroMem ( +VOID *EFIAPI BmcElogZeroMem ( VOID *Buffer, UINTN Length ) { // - // sub_1070: ZeroMem implementation + // Zero in aligned chunks, then finish the tail. // if (Length >= 8) { ZeroMem (Buffer, Length & ~(UINTN)7); @@ -154,19 +151,12 @@ @return Pointer to the IPMI transport protocol, or NULL. **/ -VOID *GetIpmiTransport ( +VOID *GetCachedIpmiTransport ( VOID ) { // - // sub_1A60: - // If mIpmiTransport cached, return it. - // Otherwise: - // If mBootServices exists: - // Check if buffer size needed <= 0x10 - // Allocate pool - // Locate protocol handle for the IPMI transport GUID (unk_3000) - // Cache in mIpmiTransport + // Return the cached IPMI transport protocol, or locate it once and cache it. // if (mIpmiTransport != NULL) { return mIpmiTransport; @@ -199,21 +189,15 @@ @retval EFI_SUCCESS on matching interface. **/ -EFI_STATUS IpmiDetectInterface ( +EFI_STATUS BmcElogDispatchIpmiCommand ( UINT64 IoOperation, UINT64 Param2, ... ) { // - // sub_1AE8: - // Get transport via GetIpmiTransport() - // Read CMOS 0x70/0x71 register 0x4B to get BMC interface type - // Map to transport interface ID: - // 1 -> 0x80000004 (KCS) - // 2 -> 0x80000006 (SMBUS) [value 3 would be BT] - // 3 -> BT - // If IoOperation matches the interface, call transport. + // Resolve the active BMC interface from CMOS and dispatch to the transport + // when the requested interface mask matches. // VA_LIST Args; UINT8 BmcIfType; @@ -222,7 +206,7 @@ VA_START (Args, Param2); - Transport = GetIpmiTransport (); + Transport = GetCachedIpmiTransport (); if (Transport == NULL) { return EFI_NOT_FOUND; } @@ -281,7 +265,7 @@ @retval EFI_SUCCESS Command was sent successfully. @retval others Command failed. **/ -EFI_STATUS IpmiSendCommand ( +EFI_STATUS BmcElogSendIpmiCommand ( UINT8 NetFunction, UINT8 Command, VOID *CommandData, @@ -291,12 +275,9 @@ ) { // - // sub_138C: - // Loop up to 512 iterations sending the IPMI command via - // the transport protocol (qword_3040). - // If transport returns CC_CANNOT_RETRY (0xC5), retry with - // a "Write" sub-command (0x42 / 0x42 = Write). - // Otherwise return success or timeout. + // Send an IPMI command through the cached transport with limited retries. + // Retry through the alternate write path when the completion code says the + // command cannot be retried. // VOID *Transport; UINTN Retries; @@ -312,7 +293,7 @@ // WriteData[0] = *((UINT8 *)CommandData + 0); WriteData[1] = *((UINT8 *)CommandData + 1); - WriteData[2] = 0x525353; // "RSS" constant from sub_138C + WriteData[2] = 0x525353; // Protocol-specific command payload marker. // // Send command via transport->SendCommand (offset +16) @@ -371,7 +352,7 @@ @retval EFI_SUCCESS Response was read successfully. @retval others Failed to read response. **/ -EFI_STATUS IpmiGetResponse ( +EFI_STATUS BmcElogGetIpmiResponse ( UINT8 NetFunction, UINT8 Command, VOID *ResponseData, @@ -379,10 +360,7 @@ ) { // - // sub_145C: - // Opens GetResponse command to the IPMI transport. - // Uses the BMC_ELOG_REFROTOCOL signature validation. - // Copies data from transport buffer to output. + // Fetch a response block from the transport and copy it out. // UINT8 Buffer[16]; UINTN BufferSize; @@ -392,7 +370,7 @@ BufferSize = 16; - Status = IpmiSendCommand ( + Status = BmcElogSendIpmiCommand ( NetFunction, Command, NULL, @@ -408,7 +386,7 @@ return EFI_INVALID_PARAMETER; } - InternalCopyMem (ResponseData, Buffer, 16); + BmcElogCopyMem (ResponseData, Buffer, 16); return Status; } @@ -437,10 +415,7 @@ ) { // - // sub_15A0: - // Validates REFROTOCOL signature at This-113, - // checks revision, builds read request via transport. - // Copies 16 bytes of event data to output. + // Validate the protocol instance and fetch one SEL record entry. // BMC_ELOG_REFROTOCOL *Ref; UINT8 Request[6]; @@ -448,7 +423,7 @@ UINT16 ReadData[4]; EFI_STATUS Status; - ZeroMem (ReadData, sizeof (ReadData)); + BmcElogZeroMem (ReadData, sizeof (ReadData)); // // Validate signature @@ -491,7 +466,7 @@ } *RecordId = ResponseRecordId; - InternalCopyMem (Data, Request, 16); + BmcElogCopyMem (Data, Request, 16); return EFI_SUCCESS; } @@ -514,10 +489,7 @@ ) { // - // sub_16A4: - // Validates signature, performs clear/reserve SEL operation. - // If a3 (Data) is non-NULL, does a full SEL erase with record ID reservation. - // If a3 is NULL, does a "Get SEL Info" then "Clear SEL" via sub_138C. + // Validate the protocol instance and clear or reserve SEL state as needed. // BMC_ELOG_REFROTOCOL *Ref; UINT8 Response[16]; @@ -577,7 +549,7 @@ if ((Response[5] & 2) != 0) { // - // Reserve SEL first + // Reserve SEL first. // EFI_STATUS ReserveStatus; @@ -606,7 +578,7 @@ if (Data != NULL) { // - // Erase SEL with reservation (full clear) + // Erase SEL with reservation. // UINT8 EraseData[4]; @@ -646,7 +618,7 @@ return Status; } else { // - // Clear via Set SEL Time / erase mechanism using sub_138C + // Clear via Set SEL Time / erase mechanism. // UINT8 ClearBuf[6]; UINT32 ClearResult; @@ -671,7 +643,7 @@ &ClearResult ); - return IpmiSendCommand (0, 0, Reservation, 0, NULL, NULL); + return BmcElogSendIpmiCommand (0, 0, Reservation, 0, NULL, NULL); } } @@ -693,10 +665,7 @@ ) { // - // sub_188C: - // Validates signature and revision. - // Sends or gets SEL info to read/write bit 3 of the SEL operation - // support flags (bit 3 = SEL enable/disable). + // Read or update the SEL enable flag via the SEL Info response. // BMC_ELOG_REFROTOCOL *Ref; UINT8 Response; @@ -798,10 +767,7 @@ ) { // - // sub_145C: - // Validates REFROTOCOL signature, checks revision, - // opens an IPMI session, sends command data, - // and returns the record ID. + // Validate the protocol instance, send the record, and return the SEL ID. // BMC_ELOG_REFROTOCOL *Ref; UINT8 Buffer[16]; @@ -830,7 +796,7 @@ // // Prepare buffer and open IPMI session // - ZeroMem (Buffer, sizeof (Buffer)); + BmcElogZeroMem (Buffer, sizeof (Buffer)); ResponseSize = 14; Status = ((EFI_STATUS ( *)( @@ -863,7 +829,7 @@ return EFI_INVALID_PARAMETER; } - InternalCopyMem (Buffer, Data, 16); + BmcElogCopyMem (Buffer, Data, 16); // // Send the Add SEL Entry command @@ -911,9 +877,7 @@ ) { // - // sub_1D94 / sub_1E04: // Compare two GUIDs as two 64-bit values. - // sub_1E04 reads a UINT64 from a potentially unaligned address. // UINT64 *Data1 = (UINT64 *)Guid1; UINT64 *Data2 = (UINT64 *)Guid2; @@ -930,11 +894,7 @@ ) { // - // sub_1C60: - // Scans the HOB list (from SystemTable + 104/112) looking for - // a HOB with a specific GUID (unk_3020, unk_3028). - // Caches result in mHobList. - // If no matching HOB, asserts. + // Scan the configuration table for the HOB list and cache it. // EFI_PEI_HOB_POINTERS Hob; UINTN Index; @@ -989,8 +949,7 @@ ) { // - // sub_1BA8: - // Clears the cached BootServices pointer. + // Clear the cached BootServices pointer. // mBootServices = 0; } @@ -1009,9 +968,7 @@ ) { // - // sub_1BB4: - // If mIpmiTransport is set, calls RuntimeServices->ConvertPointer - // to convert the pointer for the new virtual address mapping. + // Convert the cached transport pointer for the new virtual mapping. // if (mIpmiTransport != NULL) { return gRT->ConvertPointer (0, (VOID **)&mIpmiTransport); @@ -1034,8 +991,7 @@ ) { // - // sub_1BDC: - // AllocatePool and ZeroMem for the BmcElog protocol structure. + // Allocate zeroed storage for the protocol instance. // VOID *Buffer; EFI_STATUS Status; @@ -1057,14 +1013,13 @@ ) { // - // sub_1C14: - // Frees the BmcElog protocol buffer allocated during initialization. + // Free the protocol buffer allocated during initialization. // EFI_STATUS Status; Status = gBS->FreePool ((VOID *)mIpmiTransport); if (EFI_ERROR (Status)) { - IpmiDetectInterface (0x80000000, (UINT64)"\nASSERT_EFI_ERROR (Status = %r)\n"); + BmcElogDispatchIpmiCommand (0x80000000, (UINT64)"\nASSERT_EFI_ERROR (Status = %r)\n"); DebugAssert ( "e:\\hs\\MdePkg\\Library\\UefiMemoryAllocationLib\\MemoryAllocationLib.c", 819, @@ -1139,7 +1094,7 @@ } // - // Cache boot services pointer (used in sub_1BA8-style notification cleanups) + // Cache boot services pointer for notification cleanup. // mBootServices = (UINT64)gBS; mRuntimeServices = (UINT64)gRT; @@ -1173,7 +1128,7 @@ // // Get the cached transport pointer - // sub_1210: locate the IPMI transport protocol and register BmcElog + // Locate the IPMI transport protocol and register BmcElog. // { UINT8 InitData[16]; diff --git a/AmiIpmiPkg/Ipmi/BmcElog/BmcElog/BmcElog.h b/AmiIpmiPkg/Ipmi/BmcElog/BmcElog/BmcElog.h index 8989684..6b14b98 100644 --- a/AmiIpmiPkg/Ipmi/BmcElog/BmcElog/BmcElog.h +++ b/AmiIpmiPkg/Ipmi/BmcElog/BmcElog/BmcElog.h @@ -1,5 +1,5 @@ /** @file - BmcElog.h -- Header for BmcElog + BmcElog.h - Header for BmcElog Copyright (c) HR650X BIOS Decompilation Project **/ @@ -9,1004 +9,135 @@ #include "../uefi_headers/Uefi.h" -// -// Function Prototypes -// - -EFI_STATUS +VOID EFIAPI -DebugAssert( - VOID -); +DebugAssert ( + CONST CHAR8 *FileName, + UINTN LineNumber, + CONST CHAR8 *Description + ); -EFI_STATUS +VOID * EFIAPI -IpmiDetectInterface( - VOID -); +BmcElogCopyMem ( + VOID *Destination, + CONST VOID *Source, + UINTN Length + ); -EFI_STATUS +VOID * EFIAPI -IpmiSendCommand( - VOID -); +BmcElogZeroMem ( + VOID *Buffer, + UINTN Length + ); -EFI_STATUS -EFIAPI -IpmiGetResponse( +VOID * +GetCachedIpmiTransport ( VOID -); + ); EFI_STATUS -EFIAPI -BmcElogRead( - VOID -); +BmcElogDispatchIpmiCommand ( + UINT64 IoOperation, + UINT64 Param2, + ... + ); EFI_STATUS -EFIAPI -BmcElogClear( - VOID -); +BmcElogSendIpmiCommand ( + UINT8 NetFunction, + UINT8 Command, + VOID *CommandData, + UINT32 CommandDataSize, + VOID *ResponseData, + UINT32 *ResponseDataSize + ); EFI_STATUS -EFIAPI -BmcElogSetStatus( - VOID -); +BmcElogGetIpmiResponse ( + UINT8 NetFunction, + UINT8 Command, + VOID *ResponseData, + UINT32 *ResponseDataSize + ); EFI_STATUS -EFIAPI -BmcElogWrite( - VOID -); +BmcElogRead ( + VOID *This, + UINT8 *Data, + UINT32 Revision, + UINT64 *RecordCount, + UINT16 *RecordId + ); EFI_STATUS -EFIAPI -CompareGuid( - VOID -); +BmcElogClear ( + VOID *This, + UINT8 *Data, + UINT32 Revision + ); EFI_STATUS -EFIAPI -OnExitBootServices( - VOID -); +BmcElogSetStatus ( + VOID *This, + UINT64 Revision, + UINT8 *Status, + BOOLEAN *Enabled + ); EFI_STATUS -EFIAPI -OnVirtualAddressChange( - VOID -); +BmcElogWrite ( + VOID *This, + UINT8 *Data, + UINT32 Revision, + UINT64 *Key, + UINTN DataSize, + UINT16 *RecordId + ); -EFI_STATUS +BOOLEAN EFIAPI -FreeBmcElogProtocolBuffer( - VOID -); +CompareGuid ( + CONST EFI_GUID *Guid1, + CONST EFI_GUID *Guid2 + ); -EFI_STATUS +VOID * EFIAPI -BmcElogEntryPoint( +GetFirstHob ( VOID -); + ); -EFI_STATUS +VOID EFIAPI -globals( - VOID -); +OnExitBootServices ( + IN EFI_EVENT Event, + IN VOID *Context + ); EFI_STATUS EFIAPI -gImageHandle = NULL;( - VOID -); +OnVirtualAddressChange ( + IN EFI_EVENT Event, + IN VOID *Context + ); -EFI_STATUS -EFIAPI -transport protocol handle (opaque)( - VOID -); +VOID * +AllocateZeroedRefProtocol ( + UINTN AllocType + ); -EFI_STATUS -EFIAPI -*mIpmiTransport = NULL;( +VOID +FreeBmcElogProtocolBuffer ( VOID -); + ); EFI_STATUS EFIAPI -reporting function( - VOID -); +BmcElogEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ); -EFI_STATUS -EFIAPI -= sub_1A60();( - VOID -); - -EFI_STATUS -EFIAPI -(result)( - VOID -); - -EFI_STATUS -EFIAPI -(*(UINT64 (__fastcall **)(UINT64, UINT64, UINT64))(result + 8))( - VOID -); - -EFI_STATUS -EFIAPI -is the DebugAssert() routine from DebugLib.( - VOID -); - -EFI_STATUS -EFIAPI -(mBootServices != 0) {( - VOID -); - -EFI_STATUS -EFIAPI -memory operations( - VOID -); - -EFI_STATUS -EFIAPI -((UINTN)Source < (UINTN)Destination &&( - VOID -); - -EFI_STATUS -EFIAPI -= &Src8[Length - 1];( - VOID -); - -EFI_STATUS -EFIAPI -overlap: copy 8 bytes at a time( - VOID -); - -EFI_STATUS -EFIAPI -= Length >> 3;( - VOID -); - -EFI_STATUS -EFIAPI -(Length >= 8) {( - VOID -); - -EFI_STATUS -EFIAPI -transport helper( - VOID -); - -EFI_STATUS -EFIAPI -mIpmiTransport cached, return it.( - VOID -); - -EFI_STATUS -EFIAPI -mBootServices exists:( - VOID -); - -EFI_STATUS -EFIAPI -if buffer size needed <= 0x10( - VOID -); - -EFI_STATUS -EFIAPI -pool( - VOID -); - -EFI_STATUS -EFIAPI -protocol handle for the IPMI transport GUID (unk_3000)( - VOID -); - -EFI_STATUS -EFIAPI -in mIpmiTransport( - VOID -); - -EFI_STATUS -EFIAPI -(mIpmiTransport != NULL) {( - VOID -); - -EFI_STATUS -EFIAPI -transport via GetIpmiTransport()( - VOID -); - -EFI_STATUS -EFIAPI -CMOS 0x70/0x71 register 0x4B to get BMC interface type( - VOID -); - -EFI_STATUS -EFIAPI -to transport interface ID:( - VOID -); - -EFI_STATUS -EFIAPI --> 0x80000004 (KCS)( - VOID -); - -EFI_STATUS -EFIAPI --> 0x80000006 (SMBUS) [value 3 would be BT]( - VOID -); - -EFI_STATUS -EFIAPI --> BT( - VOID -); - -EFI_STATUS -EFIAPI -IoOperation matches the interface, call transport.( - VOID -); - -EFI_STATUS -EFIAPI -Args;( - VOID -); - -EFI_STATUS -EFIAPI -CMOS register 0x4B( - VOID -); - -EFI_STATUS -EFIAPI -= IoRead8 (0x70);( - VOID -); - -EFI_STATUS -EFIAPI -the transport function through the protocol( - VOID -); - -EFI_STATUS -EFIAPI -((EFI_STATUS (__fastcall *)(( - VOID -); - -EFI_STATUS -EFIAPI -up to 512 iterations sending the IPMI command via( - VOID -); - -EFI_STATUS -EFIAPI -transport protocol (qword_3040).( - VOID -); - -EFI_STATUS -EFIAPI -transport returns CC_CANNOT_RETRY (0xC5), retry with( - VOID -); - -EFI_STATUS -EFIAPI -"Write" sub-command (0x42 / 0x42 = Write).( - VOID -); - -EFI_STATUS -EFIAPI -return success or timeout.( - VOID -); - -EFI_STATUS -EFIAPI -*Transport;( - VOID -); - -EFI_STATUS -EFIAPI -transport protocol( - VOID -); - -EFI_STATUS -EFIAPI -command packet( - VOID -); - -EFI_STATUS -EFIAPI -command via transport->SendCommand (offset +16)( - VOID -); - -EFI_STATUS -EFIAPI -= ((EFI_STATUS (__fastcall *)(( - VOID -); - -EFI_STATUS -EFIAPI -0, // Lun( - VOID -); - -EFI_STATUS -EFIAPI -WriteData( - VOID -); - -EFI_STATUS -EFIAPI -for retryable error (0xC5 = CC_CANNOT_RETRY)( - VOID -); - -EFI_STATUS -EFIAPI -(*(UINT8 *)((UINT8 *)Transport + 8) == 0xC5) {( - VOID -); - -EFI_STATUS -EFIAPI -0( - VOID -); - -EFI_STATUS -EFIAPI -sub-command( - VOID -); - -EFI_STATUS -EFIAPI -GetResponse command to the IPMI transport.( - VOID -); - -EFI_STATUS -EFIAPI -the BMC_ELOG_REFROTOCOL signature validation.( - VOID -); - -EFI_STATUS -EFIAPI -data from transport buffer to output.( - VOID -); - -EFI_STATUS -EFIAPI -Buffer[16];( - VOID -); - -EFI_STATUS -EFIAPI -REFROTOCOL signature at This-113( - VOID -); - -EFI_STATUS -EFIAPI -revision, builds read request via transport.( - VOID -); - -EFI_STATUS -EFIAPI -16 bytes of event data to output.( - VOID -); - -EFI_STATUS -EFIAPI -*Ref;( - VOID -); - -EFI_STATUS -EFIAPI -signature( - VOID -); - -EFI_STATUS -EFIAPI -= (BMC_ELOG_REFROTOCOL *)((UINT8 *)This - 113);( - VOID -); - -EFI_STATUS -EFIAPI -the IPMI Get SEL Entry command( - VOID -); - -EFI_STATUS -EFIAPI -ReadData[2] = 0xFF00; // Record type mask / last entry( - VOID -); - -EFI_STATUS -EFIAPI -record ID( - VOID -); - -EFI_STATUS -EFIAPI -SEL Entry( - VOID -); - -EFI_STATUS -EFIAPI -signature, performs clear/reserve SEL operation.( - VOID -); - -EFI_STATUS -EFIAPI -a3 (Data) is non-NULL, does a full SEL erase with record ID reservation.( - VOID -); - -EFI_STATUS -EFIAPI -a3 is NULL, does a "Get SEL Info" then "Clear SEL" via sub_138C.( - VOID -); - -EFI_STATUS -EFIAPI -SEL Info( - VOID -); - -EFI_STATUS -EFIAPI -= 14;( - VOID -); - -EFI_STATUS -EFIAPI -);( - VOID -); - -EFI_STATUS -EFIAPI -is not supported( - VOID -); - -EFI_STATUS -EFIAPI -EFI_UNSUPPORTED;( - VOID -); - -EFI_STATUS -EFIAPI -SEL first( - VOID -); - -EFI_STATUS -EFIAPI -ReserveStatus;( - VOID -); - -EFI_STATUS -EFIAPI -SEL( - VOID -); - -EFI_STATUS -EFIAPI -SEL with reservation (full clear)( - VOID -); - -EFI_STATUS -EFIAPI -EraseData[4];( - VOID -); - -EFI_STATUS -EFIAPI -byte 1( - VOID -); - -EFI_STATUS -EFIAPI -byte 0( - VOID -); - -EFI_STATUS -EFIAPI -completion code( - VOID -); - -EFI_STATUS -EFIAPI -(*(UINT8 *)((UINT8 *)(*(VOID **)((UINT8 *)mHobList + 0x3040)) + 8) == 0x80) {( - VOID -); - -EFI_STATUS -EFIAPI -via Set SEL Time / erase mechanism using sub_138C( - VOID -); - -EFI_STATUS -EFIAPI -ClearBuf[6];( - VOID -); - -EFI_STATUS -EFIAPI -SEL Time( - VOID -); - -EFI_STATUS -EFIAPI -signature and revision.( - VOID -); - -EFI_STATUS -EFIAPI -or gets SEL info to read/write bit 3 of the SEL operation( - VOID -); - -EFI_STATUS -EFIAPI -flags (bit 3 = SEL enable/disable).( - VOID -); - -EFI_STATUS -EFIAPI -SEL Info parameter( - VOID -); - -EFI_STATUS -EFIAPI -Get SEL Info command (NetFn=6, Cmd=0x47)( - VOID -); - -EFI_STATUS -EFIAPI -NetFn( - VOID -); - -EFI_STATUS -EFIAPI -the enable/disable bit( - VOID -); - -EFI_STATUS -EFIAPI -NewResponse = Response;( - VOID -); - -EFI_STATUS -EFIAPI -SEL Time (to change enable)( - VOID -); - -EFI_STATUS -EFIAPI -REFROTOCOL signature, checks revision( - VOID -); - -EFI_STATUS -EFIAPI -an IPMI session, sends command data( - VOID -); - -EFI_STATUS -EFIAPI -returns the record ID.( - VOID -); - -EFI_STATUS -EFIAPI -buffer and open IPMI session( - VOID -); - -EFI_STATUS -EFIAPI -(Buffer, sizeof (Buffer));( - VOID -); - -EFI_STATUS -EFIAPI -overflow bit; if set return EFI_OUT_OF_RESOURCES( - VOID -); - -EFI_STATUS -EFIAPI -EFI_OUT_OF_RESOURCES;( - VOID -); - -EFI_STATUS -EFIAPI -must be <= 0x10 (max SEL record size)( - VOID -); - -EFI_STATUS -EFIAPI -(DataSize > 16) {( - VOID -); - -EFI_STATUS -EFIAPI -the Add SEL Entry command( - VOID -); - -EFI_STATUS -EFIAPI -library support( - VOID -); - -EFI_STATUS -EFIAPI -/ sub_1E04:( - VOID -); - -EFI_STATUS -EFIAPI -two GUIDs as two 64-bit values.( - VOID -); - -EFI_STATUS -EFIAPI -reads a UINT64 from a potentially unaligned address.( - VOID -); - -EFI_STATUS -EFIAPI -*Data1 = (UINT64 *)Guid1;( - VOID -); - -EFI_STATUS -EFIAPI -the HOB list (from SystemTable + 104/112) looking for( - VOID -); - -EFI_STATUS -EFIAPI -HOB with a specific GUID (unk_3020, unk_3028).( - VOID -); - -EFI_STATUS -EFIAPI -result in mHobList.( - VOID -); - -EFI_STATUS -EFIAPI -no matching HOB, asserts.( - VOID -); - -EFI_STATUS -EFIAPI -Hob;( - VOID -); - -EFI_STATUS -EFIAPI -list not found - assertion( - VOID -); - -EFI_STATUS -EFIAPI -(( - VOID -); - -EFI_STATUS -EFIAPI -notification handlers( - VOID -); - -EFI_STATUS -EFIAPI -the cached BootServices pointer.( - VOID -); - -EFI_STATUS -EFIAPI -= 0;( - VOID -); - -EFI_STATUS -EFIAPI -mIpmiTransport is set, calls RuntimeServices->ConvertPointer( - VOID -); - -EFI_STATUS -EFIAPI -convert the pointer for the new virtual address mapping.( - VOID -); - -EFI_STATUS -EFIAPI -allocation helpers( - VOID -); - -EFI_STATUS -EFIAPI -and ZeroMem for the BmcElog protocol structure.( - VOID -); - -EFI_STATUS -EFIAPI -*Buffer;( - VOID -); - -EFI_STATUS -EFIAPI -the BmcElog protocol buffer allocated during initialization.( - VOID -); - -EFI_STATUS -EFIAPI -Status;( - VOID -); - -EFI_STATUS -EFIAPI -module globals( - VOID -); - -EFI_STATUS -EFIAPI -= SystemTable;( - VOID -); - -EFI_STATUS -EFIAPI -pointers( - VOID -); - -EFI_STATUS -EFIAPI -(ImageHandle == NULL) {( - VOID -); - -EFI_STATUS -EFIAPI -boot services pointer (used in sub_1BA8-style notification cleanups)( - VOID -); - -EFI_STATUS -EFIAPI -= (UINT64)gBS;( - VOID -); - -EFI_STATUS -EFIAPI -ExitBootServices event to clear BS pointer( - VOID -); - -EFI_STATUS -EFIAPI -VirtualAddressChange event( - VOID -); - -EFI_STATUS -EFIAPI -the HOB list( - VOID -); - -EFI_STATUS -EFIAPI -();( - VOID -); - -EFI_STATUS -EFIAPI -the cached transport pointer( - VOID -); - -EFI_STATUS -EFIAPI -IPMI transport protocol handle( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->LocateProtocol (( - VOID -); - -EFI_STATUS -EFIAPI -SEL (for subsequent clear operations)( - VOID -); - -EFI_STATUS -EFIAPI -(InitData, sizeof (InitData));( - VOID -); - -EFI_STATUS -EFIAPI -SEL command data( - VOID -); - -EFI_STATUS -EFIAPI -response for SEL support( - VOID -); - -EFI_STATUS -EFIAPI -(InitData[1] & 0x04) {( - VOID -); - -EFI_STATUS -EFIAPI -and initialize the REFROTOCOL structure( - VOID -); - -EFI_STATUS -EFIAPI -= (BMC_ELOG_REFROTOCOL *)AllocateZeroedRefProtocol (EfiBootServicesData);( - VOID -); - -EFI_STATUS -EFIAPI -the protocol structure( - VOID -); - -EFI_STATUS -EFIAPI -function pointers into the REFROTOCOL at known offsets( - VOID -); - -EFI_STATUS -EFIAPI -the protocol( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->InstallProtocolInterface (( - VOID -); - -EFI_STATUS -EFIAPI -SEL logging (if already enabled, ensure it stays)( - VOID -); - -EFI_STATUS -EFIAPI -= 1;( - VOID -); - -#endif /* __BMCELOG_H__ */ \ No newline at end of file +#endif /* __BMCELOG_H__ */ diff --git a/AmiIpmiPkg/Ipmi/DxeFrb/DxeFrb.c b/AmiIpmiPkg/Ipmi/DxeFrb/DxeFrb.c index 83fa2d2..3236205 100644 --- a/AmiIpmiPkg/Ipmi/DxeFrb/DxeFrb.c +++ b/AmiIpmiPkg/Ipmi/DxeFrb/DxeFrb.c @@ -12,7 +12,7 @@ * OS Boot WDT: A separate watchdog that supervises the OS boot process. * It is disabled before entering the UEFI Shell. * - * Debug output uses the WCHG debug protocol (accessed via sub_E3C / GetDebugProtocol). + * Debug output uses the WCHG debug protocol (accessed via GetDebugProtocol). */ #include "DxeFrb.h" @@ -247,7 +247,7 @@ * WchgGetState -- Read FRB2/OSWDT hardware timer state from WCHG. * * TimerIndex: 1=FRB2, 2=reserved, 3=OS Boot WDT. - * (sub_3F0) + * Read FRB2 or OS watchdog state from the WCHG hardware. */ EFI_STATUS EFIAPI @@ -304,7 +304,7 @@ /** * WchgSetTimerValue -- Set countdown value for a timer. * Value is in 100-microsecond units. - * (sub_500) + * Program the countdown value for a WCHG timer. */ EFI_STATUS EFIAPI @@ -329,7 +329,7 @@ /** * WchgSetEnableFlags -- Set enable/disabled state for a timer. - * (sub_558) + * Program enable and armed flags for a WCHG timer. */ EFI_STATUS EFIAPI @@ -352,7 +352,7 @@ /** * WchgSetActionFlags -- Set action on timeout for a timer. - * (sub_594) + * Program the timeout action for a WCHG timer. */ EFI_STATUS EFIAPI @@ -374,7 +374,7 @@ /** * WchgProgramAndArm -- Program WCHG hardware and arm the watchdog timer. * If ResetSystem is TRUE, uses a reset-asserting action bitmask (0x3E). - * (sub_5BC) + * Program and arm the selected WCHG timer. */ EFI_STATUS EFIAPI @@ -482,7 +482,7 @@ /** * WchgReadBackVerify -- Read back WCHG state and verify. * If the timer was previously disabled, returns EFI_ALREADY_STARTED. - * (sub_78C) + * Read back and verify the selected WCHG timer state. */ EFI_STATUS EFIAPI @@ -572,7 +572,7 @@ /** * Frb2OpromNotify -- Called before/after option ROM dispatch. * Toggles FRB2 off during OPROM and back on after. - * (sub_CAC) + * Temporarily disable FRB2 for option ROM dispatch, then re-arm it afterward. */ VOID EFIAPI @@ -602,7 +602,7 @@ /** * Frb2PasswordNotify -- Disable FRB2 before password prompt. - * (sub_D38) + * Disable FRB2 before the password prompt. */ VOID EFIAPI @@ -619,7 +619,7 @@ /** * Frb2PasswordDoneNotify -- Re-enable FRB2 after password. - * (sub_D68) + * Re-enable FRB2 after the password prompt completes. */ VOID EFIAPI @@ -636,7 +636,7 @@ /** * Frb2PromptTimeoutNotify -- Disable FRB2 before prompt timeout. - * (sub_DA0) + * Disable FRB2 before the prompt timeout window. */ VOID EFIAPI @@ -653,7 +653,7 @@ /** * Frb2PromptTimeoutDoneNotify -- Re-enable FRB2 after prompt timeout. - * (sub_DD0) + * Re-enable FRB2 after the prompt timeout window. */ VOID EFIAPI @@ -670,7 +670,7 @@ /** * ShellEntryNotify -- Disable OS boot WDT when entering UEFI Shell. - * (sub_E08) + * Disable the OS boot watchdog when entering the UEFI Shell. */ VOID EFIAPI @@ -688,7 +688,7 @@ /** * ReadyToBootCallback -- Fires at ReadyToBoot. * Disables FRB2 and arms the OS boot WDT. - * (sub_8D8) + * Handle ReadyToBoot by disabling FRB2 and arming the OS boot watchdog. */ VOID EFIAPI @@ -720,7 +720,7 @@ /** * BootPhaseNotify -- Disable FRB2 and OS WDT before setup. - * (sub_C44) + * Disable FRB2 and OS watchdog before setup. */ VOID EFIAPI @@ -749,7 +749,7 @@ /** * RegisterBootEvent -- Create a TPL notify event for a boot phase GUID. * Based on UefiLib's EfiCreateProtocolNotifyEvent pattern. - * (sub_10A4) + * Register a boot-phase notification event. */ EFI_STATUS RegisterBootEvent ( @@ -802,7 +802,7 @@ /** * RegisterReadyToBootEvent -- Register the ReadyToBoot event callback. * Requires UEFI spec >= 2.0. - * (sub_11BC) + * Register the ReadyToBoot event callback. */ EFI_STATUS RegisterReadyToBootEvent ( @@ -836,7 +836,7 @@ /** * InitializeHobList -- Get the HOB list pointer, used as early init. - * (sub_1260) + * Cache the HOB list pointer for later use. * * This is called early in ModuleEntryPoint, before the main init. * It caches the HOB list pointer so it is available for later use. @@ -867,7 +867,7 @@ /** * AllocateZeroPool -- Allocate and zero a pool buffer. - * (sub_F84) + (sub_12DC) + * Allocate a zeroed pool buffer. */ VOID * AllocateZeroPool ( @@ -888,7 +888,7 @@ /** * FreePool -- Release a pool buffer. - * (sub_FBC) + * Free a pool buffer. */ VOID FreePool ( @@ -913,7 +913,7 @@ * 4. Read "ServerSetup" variable for configuration * 5. Register boot phase notification callbacks * - * (sub_984) + * Main driver entry point. */ EFI_STATUS EFIAPI @@ -1023,4 +1023,4 @@ } return EFI_SUCCESS; -} \ No newline at end of file +} diff --git a/AmiIpmiPkg/Ipmi/DxeFrb/DxeFrb.h b/AmiIpmiPkg/Ipmi/DxeFrb/DxeFrb.h index 38feddb..dfadff3 100644 --- a/AmiIpmiPkg/Ipmi/DxeFrb/DxeFrb.h +++ b/AmiIpmiPkg/Ipmi/DxeFrb/DxeFrb.h @@ -9,492 +9,193 @@ #include "../uefi_headers/Uefi.h" -// -// Function Prototypes -// - -EFI_STATUS +VOID * EFIAPI -DebugPrint( +GetDebugProtocol ( VOID -); + ); -EFI_STATUS +VOID EFIAPI -DebugAssert( - VOID -); +DebugPrint ( + IN UINTN ErrorLevel, + IN CONST CHAR8 *Format, + ... + ); -EFI_STATUS +VOID EFIAPI -ReadUnaligned64( - VOID -); +DebugAssert ( + IN CONST CHAR8 *FileName, + IN UINTN LineNumber, + IN CONST CHAR8 *Description + ); -EFI_STATUS +UINT64 EFIAPI -CompareGuid( - VOID -); +ReadUnaligned64 ( + IN CONST VOID *Buffer + ); -EFI_STATUS +BOOLEAN EFIAPI -GetHobList( - VOID -); +CompareGuid ( + IN CONST EFI_GUID *Guid1, + IN CONST EFI_GUID *Guid2 + ); EFI_STATUS EFIAPI -WchgGetState( - VOID -); +GetHobList ( + OUT VOID **HobList + ); EFI_STATUS EFIAPI -WchgSetTimerValue( - VOID -); +WchgGetState ( + IN FRB2_DRIVER *This, + IN UINTN TimerIndex, + OUT WCHG_HW_STATE *State + ); EFI_STATUS EFIAPI -WchgSetEnableFlags( - VOID -); +WchgSetTimerValue ( + IN FRB2_DRIVER *This, + IN UINTN TimerIndex, + IN UINT64 *Value + ); EFI_STATUS EFIAPI -WchgSetActionFlags( - VOID -); +WchgSetEnableFlags ( + IN FRB2_DRIVER *This, + IN UINTN TimerIndex, + IN UINT8 *Enable, + IN UINT8 ArmedState + ); EFI_STATUS EFIAPI -WchgProgramAndArm( - VOID -); +WchgSetActionFlags ( + IN FRB2_DRIVER *This, + IN UINTN TimerIndex, + IN UINT8 Action + ); EFI_STATUS EFIAPI -WchgReadBackVerify( - VOID -); +WchgProgramAndArm ( + IN FRB2_DRIVER *This, + IN UINTN TimerIndex, + IN VOID *Unused1, + IN VOID *Unused2, + IN BOOLEAN ResetSystem + ); EFI_STATUS EFIAPI -Frb2OpromNotify( - VOID -); +WchgReadBackVerify ( + IN FRB2_DRIVER *This, + IN UINTN TimerIndex, + IN VOID *Unused, + IN VOID *Unused2 + ); -EFI_STATUS +VOID EFIAPI -Frb2PasswordNotify( - VOID -); +Frb2OpromNotify ( + IN EFI_EVENT Event, + IN VOID *Context + ); -EFI_STATUS +VOID EFIAPI -Frb2PasswordDoneNotify( - VOID -); +Frb2PasswordNotify ( + IN EFI_EVENT Event, + IN VOID *Context + ); -EFI_STATUS +VOID EFIAPI -Frb2PromptTimeoutNotify( - VOID -); +Frb2PasswordDoneNotify ( + IN EFI_EVENT Event, + IN VOID *Context + ); -EFI_STATUS +VOID EFIAPI -Frb2PromptTimeoutDoneNotify( - VOID -); +Frb2PromptTimeoutNotify ( + IN EFI_EVENT Event, + IN VOID *Context + ); -EFI_STATUS +VOID EFIAPI -ShellEntryNotify( - VOID -); +Frb2PromptTimeoutDoneNotify ( + IN EFI_EVENT Event, + IN VOID *Context + ); -EFI_STATUS +VOID EFIAPI -ReadyToBootCallback( - VOID -); +ShellEntryNotify ( + IN EFI_EVENT Event, + IN VOID *Context + ); -EFI_STATUS +VOID EFIAPI -BootPhaseNotify( - VOID -); +ReadyToBootCallback ( + IN EFI_EVENT Event, + IN VOID *Context + ); -EFI_STATUS +VOID EFIAPI -RegisterBootEvent( - VOID -); +BootPhaseNotify ( + IN EFI_EVENT Event, + IN VOID *Context + ); EFI_STATUS EFIAPI -RegisterReadyToBootEvent( - VOID -); +RegisterBootEvent ( + IN EFI_GUID *EventGroupGuid, + IN UINTN NotifyTpl, + IN EFI_EVENT_NOTIFY NotifyFunction, + ... + ); EFI_STATUS EFIAPI -InitializeHobList( - VOID -); +RegisterReadyToBootEvent ( + OUT EFI_EVENT *ReadyToBootEvent + ); EFI_STATUS EFIAPI -FreePool( +InitializeHobList ( VOID -); + ); -EFI_STATUS +VOID * EFIAPI -DxeFrbEntryPoint( - VOID -); +AllocateZeroPool ( + IN UINTN Size + ); -EFI_STATUS +VOID EFIAPI -// ============================================================================( - VOID -); +FreePool ( + IN VOID *Buffer + ); EFI_STATUS EFIAPI --- EFI_WATCHDOG_TIMER_ARCH_PROTOCOL( - VOID -); +DxeFrbEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ); -EFI_STATUS -EFIAPI --- HOB list pointer( - VOID -); - -EFI_STATUS -EFIAPI --- Allocated driver instance( - VOID -); - -EFI_STATUS -EFIAPI --- WCHG debug protocol( - VOID -); - -EFI_STATUS -EFIAPI -BOOLEAN gOsWdtEnabled = FALSE; // byte_1CEB( - VOID -); - -EFI_STATUS -EFIAPI -UINT16 gOsWdtTimeout = 600; // n600 (600 * 100ms = 60s)( - VOID -); - -EFI_STATUS -EFIAPI -//( - VOID -); - -/// 3 timers * 6 bytes each (at 0x2120) -EFI_STATUS -EFIAPI -timer state storage( - VOID -); - -EFI_STATUS -EFIAPI -gWchgTimerState[0x30];( - VOID -); - -EFI_STATUS -EFIAPI -used by this module( - VOID -); - -EFI_STATUS -EFIAPI -gEfiWatchdogTimerArchProtocolGuid = EFI_WATCHDOG_TIMER_ARCH_PROTOCOL_GUID;( - VOID -); - -EFI_STATUS -EFIAPI -Helpers( - VOID -); - -EFI_STATUS -EFIAPI -CMOS index 0x4B to get current debug level( - VOID -); - -EFI_STATUS -EFIAPI -= IoRead8 (0x70);( - VOID -); - -EFI_STATUS -EFIAPI -debug level( - VOID -); - -EFI_STATUS -EFIAPI -(DebugLevel > 3) {( - VOID -); - -EFI_STATUS -EFIAPI -or 3 => ERROR | WARN( - VOID -); - -EFI_STATUS -EFIAPI -Hardware Access Layer( - VOID -); - -EFI_STATUS -EFIAPI -index (timer state)( - VOID -); - -EFI_STATUS -EFIAPI -type: read( - VOID -); - -EFI_STATUS -EFIAPI -returned data( - VOID -); - -EFI_STATUS -EFIAPI -FRB2 (timer 1), check if this is a cold boot via HOB( - VOID -); - -EFI_STATUS -EFIAPI -(TimerIndex == 1) {( - VOID -); - -/// skip -EFI_STATUS -EFIAPI -resume( - VOID -); - -EFI_STATUS -EFIAPI -WCHG register data( - VOID -); - -EFI_STATUS -EFIAPI -= *(UINT16 *)&gWchgTimerState[6 * TimerIndex];( - VOID -); - -EFI_STATUS -EFIAPI -of 0 means timer is disabled( - VOID -); - -EFI_STATUS -EFIAPI -action mask based on whether this is a full system reset( - VOID -); - -EFI_STATUS -EFIAPI -(!ResetSystem) {( - VOID -); - -EFI_STATUS -EFIAPI -action( - VOID -); - -EFI_STATUS -EFIAPI -WDT action( - VOID -); - -EFI_STATUS -EFIAPI -system reset action( - VOID -); - -EFI_STATUS -EFIAPI -register data( - VOID -); - -EFI_STATUS -EFIAPI -= 6;( - VOID -); - -EFI_STATUS -EFIAPI -type: write( - VOID -); - -EFI_STATUS -EFIAPI -write to commit/arm( - VOID -); - -EFI_STATUS -EFIAPI -= 0;( - VOID -); - -EFI_STATUS -EFIAPI -type: commit/arm( - VOID -); - -EFI_STATUS -EFIAPI -hardware state( - VOID -); - -EFI_STATUS -EFIAPI -= 8;( - VOID -); - -/// verify index, sync state -EFI_STATUS -EFIAPI -is running( - VOID -); - -EFI_STATUS -EFIAPI -((WchgData[0] & 7) != TimerIndex) {( - VOID -); - -/// already disabled -EFI_STATUS -EFIAPI -not running( - VOID -); - -EFI_STATUS -EFIAPI -((DEBUG_ERROR, "%a: EfiFrb2 already disabled\n", __FUNCTION__));( - VOID -); - -EFI_STATUS -EFIAPI -Phase Notification Handlers( - VOID -); - -EFI_STATUS -EFIAPI -Registration Helpers( - VOID -); - -EFI_STATUS -EFIAPI -Entry Point( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->LocateProtocol (( - VOID -); - -EFI_STATUS -EFIAPI -= AllocateZeroPool (sizeof (FRB2_DRIVER));( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->InstallProtocolInterface (( - VOID -); - -EFI_STATUS -EFIAPI -= sizeof (ServerSetup);( - VOID -); - -EFI_STATUS -EFIAPI -when variable not found( - VOID -); - -EFI_STATUS -EFIAPI -= TRUE;( - VOID -); - -EFI_STATUS -EFIAPI -seconds (600 * 100ms)( - VOID -); - -EFI_STATUS -EFIAPI -(gFrb2Enabled) {( - VOID -); - -#endif /* __DXEFRB_H__ */ \ No newline at end of file +#endif diff --git a/AmiIpmiPkg/Ipmi/DxeSelStatusCode/DxeSelStatusCode.c b/AmiIpmiPkg/Ipmi/DxeSelStatusCode/DxeSelStatusCode.c index 099ce26..4502771 100644 --- a/AmiIpmiPkg/Ipmi/DxeSelStatusCode/DxeSelStatusCode.c +++ b/AmiIpmiPkg/Ipmi/DxeSelStatusCode/DxeSelStatusCode.c @@ -170,8 +170,6 @@ } //---------------------------------------------------------------------- -// UefiBootServicesTableLibConstructor (formerly sub_10F8) -// // Initializes UEFI boot services table library state. Registers // exit boot services and set virtual address map events. Locates // runtime protocol and debug print protocol instances. @@ -234,7 +232,7 @@ Status = gBootServices->CreateEvent ( EVT_NOTIFY_SIGNAL, TPL_NOTIFY, - nullsub_1, + DxeSelStatusCodeNoOpNotify, NULL, &gRuntimeProtocolCleanupEvent ); @@ -266,8 +264,6 @@ } //---------------------------------------------------------------------- -// ReportStatusCodeLibDestructor (formerly sub_1424) -// // Closes all registered events and frees protocol resources. // Called on error unwind or module unload. //---------------------------------------------------------------------- @@ -303,8 +299,6 @@ } //---------------------------------------------------------------------- -// SetVirtualAddressMapHandler (formerly sub_15CC) -// // Converts gRuntimeServicesCopy and gIpmiTransport for virtual // addressing after SetVirtualAddressMap. //---------------------------------------------------------------------- @@ -320,8 +314,6 @@ } //---------------------------------------------------------------------- -// SelMapStatusCodeToEventData (formerly sub_15FC) -// // Searches the SEL event mapping table for an entry matching the // given status code value and instance. If found, builds a 16-byte // IPMI SEL event record data buffer. @@ -384,8 +376,6 @@ } //---------------------------------------------------------------------- -// SelWriteEventToRecord (formerly sub_16D4) -// // Writes an IPMI SEL event record using the transport protocol. // Handles reserve and append operations. //---------------------------------------------------------------------- @@ -433,8 +423,6 @@ } //---------------------------------------------------------------------- -// SelClearEventRecord (formerly sub_175C) -// // Clears an IPMI SEL event record. Validates sensor type. //---------------------------------------------------------------------- @@ -477,8 +465,6 @@ } //---------------------------------------------------------------------- -// SelStatusCodeEntryInit (formerly sub_17E0) -// // Main initialization for the SEL Status Code driver. Reads platform // configuration from the "ServerSetup" UEFI variable, locates the IPMI // transport protocol, registers SetVirtualAddressMap notification, and @@ -591,8 +577,6 @@ } //---------------------------------------------------------------------- -// DebugPrintProtocolInit (formerly sub_1A48) -// // Allocates memory and locates the debug print protocol. Used for // ASSERT and debug output. //---------------------------------------------------------------------- @@ -627,8 +611,6 @@ } //---------------------------------------------------------------------- -// DebugPrintWithLevel (formerly sub_1AD0) -// // Checks current debug verbosity level (via CMOS) and prints message // if level matches. Used by ASSERT_EFI_ERROR macro output. //---------------------------------------------------------------------- @@ -678,8 +660,6 @@ } //---------------------------------------------------------------------- -// DebugAssert (formerly sub_1B50) -// // Standard EDK2 ASSERT handler. Prints file/line/expression and // enters dead loop. //---------------------------------------------------------------------- @@ -700,8 +680,6 @@ } //---------------------------------------------------------------------- -// BootServicesCleanup (formerly sub_1B90) -// // ExitBootServices callback. Nullifies the BootServices_0 pointer // to prevent use after boot services exit. //---------------------------------------------------------------------- @@ -716,8 +694,6 @@ } //---------------------------------------------------------------------- -// RuntimeProtocolCleanup (formerly sub_1B9C) -// // SetVirtualAddressMap callback. Converts the debug print protocol // pointer for runtime virtual addressing. //---------------------------------------------------------------------- @@ -735,8 +711,6 @@ } //---------------------------------------------------------------------- -// HobGetGuidEntry (formerly sub_1BC4) -// // Locates the GUIDed HOB entry in the system HOB list. Used to find // the SMBIOS table or other platform configuration tables. //---------------------------------------------------------------------- @@ -778,14 +752,12 @@ } //---------------------------------------------------------------------- -// nullsub_1 (formerly nullsub_1) -// // No-op callback. Used as placeholder for events that don't require // action but need a registered callback. //---------------------------------------------------------------------- VOID -nullsub_1 ( +DxeSelStatusCodeNoOpNotify ( VOID ) { @@ -793,8 +765,6 @@ } //---------------------------------------------------------------------- -// RuntimeProtocolNotifyCleanup (formerly sub_1CA0) -// // SetVirtualAddressMap notification to convert the gRuntimeServices2 // pointer to virtual addressing. //---------------------------------------------------------------------- @@ -809,8 +779,6 @@ } //---------------------------------------------------------------------- -// SmbiosProtocolInit (formerly sub_1CB4) -// // Locates the SMBIOS protocol instance. Used for SMBIOS table access // during SEL event logging. //---------------------------------------------------------------------- @@ -839,8 +807,6 @@ } //---------------------------------------------------------------------- -// SmbiosProtocolCleanup (formerly sub_1D14) -// // SetVirtualAddressMap callback to convert the SMBIOS protocol // pointer for runtime virtual addressing. //---------------------------------------------------------------------- @@ -858,8 +824,6 @@ } //---------------------------------------------------------------------- -// ReportStatusCodeNotifyShutdown (formerly sub_1D3C) -// // ExitBootServices notification. Initializes SMBIOS protocol for // runtime and marks initialization complete. //---------------------------------------------------------------------- @@ -875,8 +839,6 @@ } //---------------------------------------------------------------------- -// SelAddEventRecord (formerly sub_1D54) -// // Adds a SEL event record via the IPMI transport. Retries up to // 512 times to handle the reserve-then-add race condition with // the BMC. @@ -958,8 +920,6 @@ } //---------------------------------------------------------------------- -// SelCheckRedundancyStatus (formerly sub_1E30) -// // Checks the IPMI SEL status via the transport protocol to determine // if the SEL is operational, has available space, and redundancy is // active. @@ -1005,8 +965,6 @@ } //---------------------------------------------------------------------- -// SelManageEventLog (formerly sub_1E98) -// // Manages the IPMI SEL event log. Supports two operations: // Mode 1: Clear SEL entries matching the status code // Mode 2: Add SEL entries for status codes @@ -1129,8 +1087,6 @@ } //---------------------------------------------------------------------- -// HobGuidCompare (formerly sub_2048) -// // Compares two GUIDs by reading their QWORD pairs via unaligned // access. Compares GUID at unk_4060 (SMBIOS_TABLE_GUID). //---------------------------------------------------------------------- @@ -1149,8 +1105,6 @@ } //---------------------------------------------------------------------- -// ReadUnaligned64 (formerly sub_20B8) -// // Reads a 64-bit value from potentially unaligned memory. // // @param Buffer Pointer to data (may be unaligned) diff --git a/AmiIpmiPkg/Ipmi/DxeSelStatusCode/DxeSelStatusCode.h b/AmiIpmiPkg/Ipmi/DxeSelStatusCode/DxeSelStatusCode.h index bcb796e..716a0a6 100644 --- a/AmiIpmiPkg/Ipmi/DxeSelStatusCode/DxeSelStatusCode.h +++ b/AmiIpmiPkg/Ipmi/DxeSelStatusCode/DxeSelStatusCode.h @@ -1,7 +1,5 @@ /** @file - DxeSelStatusCode.h -- Header for DxeSelStatusCode - -Copyright (c) HR650X BIOS Decompilation Project + DxeSelStatusCode - AMI IPMI SEL Status Code DXE Driver **/ #ifndef __DXESELSTATUSCODE_H__ @@ -9,1004 +7,99 @@ #include "../uefi_headers/Uefi.h" -// -// Function Prototypes -// +typedef struct { + UINT32 StatusCodeValue; + UINT32 StatusCodeInstance; + UINT8 SensorNumber; + UINT8 SensorType; + UINT8 EventDirType; + UINT8 EventData2; +} SEL_EVENT_MAP_ENTRY; -EFI_STATUS -EFIAPI -UefiBootServicesTableLibConstructor( - VOID -); +extern EFI_HANDLE gImageHandle; +extern EFI_SYSTEM_TABLE *gSystemTable; +extern EFI_BOOT_SERVICES *gBootServices; +extern EFI_RUNTIME_SERVICES *gRuntimeServices; +extern EFI_RUNTIME_SERVICES *gRuntimeServicesCopy; +extern EFI_RUNTIME_SERVICES *gRuntimeServices2; +extern VOID *gIpmiTransport; +extern UINT8 gSelRedundancy; +extern UINT8 gEnableRedundancy; +extern UINT8 gSelRedundancyMode; +extern UINT8 gSelOperationMode; +extern VOID *gDebugPrintProtocol; +extern VOID *gHobList; +extern VOID *gSmbiosProtocol; +extern UINT8 gSmbiosInitialized; +extern EFI_EVENT gVirtualAddressChangeEvent; +extern EFI_EVENT gBootServicesCleanupEvent; +extern EFI_EVENT gRuntimeCleanupEvent; +extern EFI_EVENT gSmbiosCleanupEvent; +extern EFI_EVENT gSmmCommEvent; +extern EFI_EVENT gRuntimeProtocolCleanupEvent; +extern VOID *gBootServicesCopy; +extern SEL_EVENT_MAP_ENTRY gSelEventMapTable[]; -EFI_STATUS -EFIAPI -ReportStatusCodeLibDestructor( - VOID -); +EFI_STATUS EFIAPI ModuleEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ); +EFI_STATUS EFIAPI UefiBootServicesTableLibConstructor ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ); +EFI_STATUS EFIAPI ReportStatusCodeLibDestructor (VOID); +VOID EFIAPI BootServicesCleanup (VOID); +EFI_STATUS EFIAPI RuntimeProtocolCleanup (VOID); +VOID EFIAPI SetVirtualAddressMapHandler (VOID); +EFI_STATUS SelMapStatusCodeToEventData ( + IN UINT32 StatusCodeValue, + IN UINT32 StatusCodeInstance, + OUT UINT8 *RecordData + ); +EFI_STATUS SelWriteEventToRecord ( + IN VOID *Transport, + IN UINT8 OperationMode, + IN UINT32 StatusCodeValue, + IN UINT32 StatusCodeInstance + ); +EFI_STATUS SelClearEventRecord ( + IN UINT32 StatusCodeType, + IN UINT32 StatusCodeValue + ); +EFI_STATUS EFIAPI SelStatusCodeEntryInit (VOID); +VOID *DebugPrintProtocolInit (VOID); +EFI_STATUS EFIAPI DebugPrintWithLevel ( + IN UINTN ErrorLevel, + IN CONST CHAR8 *Format, + ... + ); +VOID EFIAPI DebugAssert ( + IN CONST CHAR8 *FileName, + IN UINTN LineNumber, + IN CONST CHAR8 *Description + ); +VOID EFIAPI DxeSelStatusCodeNoOpNotify (VOID); +VOID EFIAPI RuntimeProtocolNotifyCleanup (VOID); +VOID EFIAPI SmbiosProtocolInit (VOID); +VOID EFIAPI SmbiosProtocolCleanup (VOID); +VOID EFIAPI ReportStatusCodeNotifyShutdown (VOID); +EFI_STATUS SelAddEventRecord ( + IN VOID *Transport, + IN UINT8 *RecordId, + ... + ); +UINT8 SelCheckRedundancyStatus (VOID); +EFI_STATUS SelManageEventLog ( + IN UINT64 ServerSetupData, + IN UINT8 OperationMode + ); +BOOLEAN HobGuidCompare ( + IN CONST EFI_GUID *Guid1, + IN CONST EFI_GUID *Guid2 + ); +UINT64 EFIAPI ReadUnaligned64 ( + IN CONST VOID *Buffer + ); -EFI_STATUS -EFIAPI -BootServicesCleanup( - VOID -); - -EFI_STATUS -EFIAPI -RuntimeProtocolCleanup( - VOID -); - -EFI_STATUS -EFIAPI -ModuleEntryPoint( - VOID -); - -EFI_STATUS -EFIAPI -SetVirtualAddressMapHandler( - VOID -); - -EFI_STATUS -EFIAPI -SelMapStatusCodeToEventData( - VOID -); - -EFI_STATUS -EFIAPI -SelWriteEventToRecord( - VOID -); - -EFI_STATUS -EFIAPI -SelClearEventRecord( - VOID -); - -EFI_STATUS -EFIAPI -SelStatusCodeEntryInit( - VOID -); - -EFI_STATUS -EFIAPI -DebugPrintWithLevel( - VOID -); - -EFI_STATUS -EFIAPI -DebugAssert( - VOID -); - -EFI_STATUS -EFIAPI -nullsub_1( - VOID -); - -EFI_STATUS -EFIAPI -RuntimeProtocolNotifyCleanup( - VOID -); - -EFI_STATUS -EFIAPI -SmbiosProtocolInit( - VOID -); - -EFI_STATUS -EFIAPI -SmbiosProtocolCleanup( - VOID -); - -EFI_STATUS -EFIAPI -ReportStatusCodeNotifyShutdown( - VOID -); - -EFI_STATUS -EFIAPI -SelAddEventRecord( - VOID -); - -EFI_STATUS -EFIAPI -SelCheckRedundancyStatus( - VOID -); - -EFI_STATUS -EFIAPI -SelManageEventLog( - VOID -); - -EFI_STATUS -EFIAPI -HobGuidCompare( - VOID -); - -EFI_STATUS -EFIAPI -ReadUnaligned64( - VOID -); - -EFI_STATUS -EFIAPI -Variables( - VOID -); - -EFI_STATUS -EFIAPI -gImageHandle = NULL;( - VOID -); - -EFI_STATUS -EFIAPI -EFI_RUNTIME_SERVICES *gRuntimeServices2 = NULL; // RuntimeServices_1( - VOID -); - -EFI_STATUS -EFIAPI -// SEL configuration state( - VOID -); - -EFI_STATUS -EFIAPI -UINT8 gEnableRedundancy = 0; // byte_4410( - VOID -); - -EFI_STATUS -EFIAPI -UINT8 gSelOperationMode = 0; // n2 (0x4420)( - VOID -); - -EFI_STATUS -EFIAPI -VOID *gHobList = NULL; // qword_43C8( - VOID -); - -EFI_STATUS -EFIAPI -UINT8 gSmbiosInitialized = 0; // byte_43D0( - VOID -); - -EFI_STATUS -EFIAPI -EFI_EVENT gBootServicesCleanupEvent = NULL; // qword_43B0( - VOID -); - -EFI_STATUS -EFIAPI -EFI_EVENT gSmbiosCleanupEvent = NULL; // qword_43E8( - VOID -); - -EFI_STATUS -EFIAPI -EFI_EVENT gRuntimeProtocolCleanupEvent = NULL; // qword_43A8( - VOID -); - -EFI_STATUS -EFIAPI -at qword_43B8( - VOID -); - -EFI_STATUS -EFIAPI -Event Record Mapping Table( - VOID -); - -EFI_STATUS -EFIAPI -entries x 12 bytes mapping UEFI status code classes to IPMI( - VOID -); - -EFI_STATUS -EFIAPI -number, sensor type, event direction, and event data.( - VOID -); - -EFI_STATUS -EFIAPI -gSelEventMapTable[] = {( - VOID -); - -EFI_STATUS -EFIAPI -Prototypes( - VOID -); - -EFI_STATUS -EFIAPI -EFIAPI( - VOID -); - -EFI_STATUS -EFIAPI -Entry Point( - VOID -); - -EFI_STATUS -EFIAPI -(formerly sub_10F8)( - VOID -); - -EFI_STATUS -EFIAPI -UEFI boot services table library state. Registers( - VOID -); - -EFI_STATUS -EFIAPI -boot services and set virtual address map events. Locates( - VOID -); - -EFI_STATUS -EFIAPI -protocol and debug print protocol instances.( - VOID -); - -EFI_STATUS -EFIAPI -global pointers( - VOID -); - -EFI_STATUS -EFIAPI -BootServices cleanup event( - VOID -); - -EFI_STATUS -EFIAPI -runtime protocol cleanup event( - VOID -); - -EFI_STATUS -EFIAPI -SetVirtualAddressMap notify for runtime library( - VOID -); - -EFI_STATUS -EFIAPI -runtime protocol notify( - VOID -); - -EFI_STATUS -EFIAPI -SMBIOS cleanup( - VOID -); - -EFI_STATUS -EFIAPI -ReportStatusCode shutdown( - VOID -); - -EFI_STATUS -EFIAPI -(formerly sub_1424)( - VOID -); - -EFI_STATUS -EFIAPI -all registered events and frees protocol resources.( - VOID -); - -EFI_STATUS -EFIAPI -on error unwind or module unload.( - VOID -); - -EFI_STATUS -EFIAPI -(formerly sub_15CC)( - VOID -); - -EFI_STATUS -EFIAPI -gRuntimeServicesCopy and gIpmiTransport for virtual( - VOID -); - -EFI_STATUS -EFIAPI -after SetVirtualAddressMap.( - VOID -); - -EFI_STATUS -EFIAPI -(formerly sub_15FC)( - VOID -); - -EFI_STATUS -EFIAPI -the SEL event mapping table for an entry matching the( - VOID -); - -EFI_STATUS -EFIAPI -status code value and instance. If found, builds a 16-byte( - VOID -); - -EFI_STATUS -EFIAPI -SEL event record data buffer.( - VOID -); - -EFI_STATUS -EFIAPI -redundancy status( - VOID -); - -EFI_STATUS -EFIAPI -the record first( - VOID -); - -EFI_STATUS -EFIAPI -with redundancy( - VOID -); - -EFI_STATUS -EFIAPI -record data structure( - VOID -); - -EFI_STATUS -EFIAPI -ID = 0( - VOID -); - -EFI_STATUS -EFIAPI -Type = 2 (SEL)( - VOID -); - -EFI_STATUS -EFIAPI -= 0( - VOID -); - -EFI_STATUS -EFIAPI -ID( - VOID -); - -EFI_STATUS -EFIAPI -Message Format Version( - VOID -); - -EFI_STATUS -EFIAPI -Type + Event Direction( - VOID -); - -EFI_STATUS -EFIAPI -(formerly sub_16D4)( - VOID -); - -EFI_STATUS -EFIAPI -an IPMI SEL event record using the transport protocol.( - VOID -); - -EFI_STATUS -EFIAPI -reserve and append operations.( - VOID -); - -EFI_STATUS -EFIAPI -if redundancy not needed( - VOID -); - -EFI_STATUS -EFIAPI -status code to SEL event data( - VOID -); - -EFI_STATUS -EFIAPI -transport write command( - VOID -); - -EFI_STATUS -EFIAPI -0x0A( - VOID -); - -EFI_STATUS -EFIAPI -0x44( - VOID -); - -EFI_STATUS -EFIAPI -(formerly sub_175C)( - VOID -); - -EFI_STATUS -EFIAPI -an IPMI SEL event record. Validates sensor type.( - VOID -); - -EFI_STATUS -EFIAPI -type( - VOID -); - -EFI_STATUS -EFIAPI -IPMI transport to clear SEL( - VOID -); - -EFI_STATUS -EFIAPI -(formerly sub_17E0)( - VOID -); - -EFI_STATUS -EFIAPI -initialization for the SEL Status Code driver. Reads platform( - VOID -); - -EFI_STATUS -EFIAPI -from the "ServerSetup" UEFI variable, locates the IPMI( - VOID -); - -EFI_STATUS -EFIAPI -protocol, registers SetVirtualAddressMap notification, and( - VOID -); - -EFI_STATUS -EFIAPI -the SEL event clearing/smm notification protocol.( - VOID -); - -EFI_STATUS -EFIAPI -IPMI transport protocol( - VOID -); - -EFI_STATUS -EFIAPI -ServerSetup variable( - VOID -); - -EFI_STATUS -EFIAPI -SEL clear operation( - VOID -); - -EFI_STATUS -EFIAPI -redundancy( - VOID -); - -EFI_STATUS -EFIAPI -SEL event handling( - VOID -); - -EFI_STATUS -EFIAPI -SMM communication protocol( - VOID -); - -EFI_STATUS -EFIAPI -SetVirtualAddressMap event( - VOID -); - -EFI_STATUS -EFIAPI -SMM communication/SMBIOS dispatch protocol( - VOID -); - -EFI_STATUS -EFIAPI -clear handler( - VOID -); - -EFI_STATUS -EFIAPI -(formerly sub_1A48)( - VOID -); - -EFI_STATUS -EFIAPI -memory and locates the debug print protocol. Used for( - VOID -); - -EFI_STATUS -EFIAPI -and debug output.( - VOID -); - -EFI_STATUS -EFIAPI -(formerly sub_1AD0)( - VOID -); - -EFI_STATUS -EFIAPI -current debug verbosity level (via CMOS) and prints message( - VOID -); - -EFI_STATUS -EFIAPI -level matches. Used by ASSERT_EFI_ERROR macro output.( - VOID -); - -EFI_STATUS -EFIAPI -debug level from CMOS (offset 0x4B)( - VOID -); - -EFI_STATUS -EFIAPI -(formerly sub_1B50)( - VOID -); - -EFI_STATUS -EFIAPI -EDK2 ASSERT handler. Prints file/line/expression and( - VOID -); - -EFI_STATUS -EFIAPI -dead loop.( - VOID -); - -EFI_STATUS -EFIAPI -(formerly sub_1B90)( - VOID -); - -EFI_STATUS -EFIAPI -callback. Nullifies the BootServices_0 pointer( - VOID -); - -EFI_STATUS -EFIAPI -prevent use after boot services exit.( - VOID -); - -EFI_STATUS -EFIAPI -(formerly sub_1B9C)( - VOID -); - -EFI_STATUS -EFIAPI -callback. Converts the debug print protocol( - VOID -); - -EFI_STATUS -EFIAPI -for runtime virtual addressing.( - VOID -); - -EFI_STATUS -EFIAPI -(formerly sub_1BC4)( - VOID -); - -EFI_STATUS -EFIAPI -the GUIDed HOB entry in the system HOB list. Used to find( - VOID -); - -EFI_STATUS -EFIAPI -SMBIOS table or other platform configuration tables.( - VOID -); - -EFI_STATUS -EFIAPI -HOB list from SystemTable( - VOID -); - -EFI_STATUS -EFIAPI -(formerly nullsub_1)( - VOID -); - -EFI_STATUS -EFIAPI -but need a registered callback.( - VOID -); - -EFI_STATUS -EFIAPI -(formerly sub_1CA0)( - VOID -); - -EFI_STATUS -EFIAPI -notification to convert the gRuntimeServices2( - VOID -); - -EFI_STATUS -EFIAPI -to virtual addressing.( - VOID -); - -EFI_STATUS -EFIAPI -(formerly sub_1CB4)( - VOID -); - -EFI_STATUS -EFIAPI -the SMBIOS protocol instance. Used for SMBIOS table access( - VOID -); - -EFI_STATUS -EFIAPI -SEL event logging.( - VOID -); - -EFI_STATUS -EFIAPI -(formerly sub_1D14)( - VOID -); - -EFI_STATUS -EFIAPI -callback to convert the SMBIOS protocol( - VOID -); - -EFI_STATUS -EFIAPI -(formerly sub_1D3C)( - VOID -); - -EFI_STATUS -EFIAPI -notification. Initializes SMBIOS protocol for( - VOID -); - -EFI_STATUS -EFIAPI -and marks initialization complete.( - VOID -); - -EFI_STATUS -EFIAPI -(formerly sub_1D54)( - VOID -); - -EFI_STATUS -EFIAPI -a SEL event record via the IPMI transport. Retries up to( - VOID -); - -EFI_STATUS -EFIAPI -times to handle the reserve-then-add race condition with( - VOID -); - -EFI_STATUS -EFIAPI -BMC.( - VOID -); - -EFI_STATUS -EFIAPI -reserve SEL command( - VOID -); - -EFI_STATUS -EFIAPI -SEL reserve( - VOID -); - -EFI_STATUS -EFIAPI -SEL add( - VOID -); - -EFI_STATUS -EFIAPI -length( - VOID -); - -EFI_STATUS -EFIAPI -reserve flag( - VOID -); - -EFI_STATUS -EFIAPI -lost/gained - need to retry( - VOID -); - -EFI_STATUS -EFIAPI -(formerly sub_1E30)( - VOID -); - -EFI_STATUS -EFIAPI -the IPMI SEL status via the transport protocol to determine( - VOID -); - -EFI_STATUS -EFIAPI -the SEL is operational, has available space, and redundancy is( - VOID -); - -EFI_STATUS -EFIAPI -0x0A, Cmd 0x40 (Get SEL Info)( - VOID -); - -EFI_STATUS -EFIAPI -NetFn Storage( - VOID -); - -EFI_STATUS -EFIAPI -SEL Info( - VOID -); - -EFI_STATUS -EFIAPI -7: SEL State (bit 3 = Redundancy, bit 7 = Operational)( - VOID -); - -EFI_STATUS -EFIAPI -(formerly sub_1E98)( - VOID -); - -EFI_STATUS -EFIAPI -the IPMI SEL event log. Supports two operations:( - VOID -); - -EFI_STATUS -EFIAPI -1: Clear SEL entries matching the status code( - VOID -); - -EFI_STATUS -EFIAPI -2: Add SEL entries for status codes( - VOID -); - -EFI_STATUS -EFIAPI -mode 2, performs a reserve + add sequence using the IPMI( - VOID -); - -EFI_STATUS -EFIAPI -protocol.( - VOID -); - -EFI_STATUS -EFIAPI -SEL info to check state( - VOID -); - -EFI_STATUS -EFIAPI -has entries - clear or process( - VOID -); - -EFI_STATUS -EFIAPI -SEL( - VOID -); - -EFI_STATUS -EFIAPI -SEL entries( - VOID -); - -EFI_STATUS -EFIAPI -single record not supported( - VOID -); - -EFI_STATUS -EFIAPI -entry( - VOID -); - -EFI_STATUS -EFIAPI -+ Add( - VOID -); - -EFI_STATUS -EFIAPI -response byte 8 for status( - VOID -); - -EFI_STATUS -EFIAPI -(formerly sub_2048)( - VOID -); - -EFI_STATUS -EFIAPI -two GUIDs by reading their QWORD pairs via unaligned( - VOID -); - -EFI_STATUS -EFIAPI -(formerly sub_20B8)( - VOID -); - -EFI_STATUS -EFIAPI -a 64-bit value from potentially unaligned memory.( - VOID -); - -#endif /* __DXESELSTATUSCODE_H__ */ \ No newline at end of file +#endif /* __DXESELSTATUSCODE_H__ */ diff --git a/AmiIpmiPkg/Ipmi/IpmiInitialize/DxeIpmiBmcInitialize/DxeIpmiBmcInitialize/DxeIpmiBmcInitialize.c b/AmiIpmiPkg/Ipmi/IpmiInitialize/DxeIpmiBmcInitialize/DxeIpmiBmcInitialize/DxeIpmiBmcInitialize.c index fab87ae..fed2cf4 100644 --- a/AmiIpmiPkg/Ipmi/IpmiInitialize/DxeIpmiBmcInitialize/DxeIpmiBmcInitialize/DxeIpmiBmcInitialize.c +++ b/AmiIpmiPkg/Ipmi/IpmiInitialize/DxeIpmiBmcInitialize/DxeIpmiBmcInitialize/DxeIpmiBmcInitialize.c @@ -825,7 +825,7 @@ } /** - * KCS Error Recovery (sub_36B8). + * BmcKcsErrorRecovery. * Attempts to recover from KCS error state by aborting the operation. */ STATIC @@ -873,7 +873,7 @@ } /** - * KCS Write-Read Cycle (sub_3A30). + * BmcKcsWriteRead. * Writes the request bytes via KCS protocol, then reads the response. */ STATIC @@ -922,7 +922,7 @@ } /** - * KCS Transport - Full IPMI Message via KCS (sub_2C58). + * BmcKcsTransport - Full IPMI Message via KCS. * * Sends an IPMI command through the KCS interface. * Handles KCS state machine: IDLE->WRITE_START->WRITE->READ->IDLE. @@ -994,7 +994,7 @@ } //============================================================================= -// System Information Wait Function (sub_3BB8) +// WaitSystemInfoInProgressClear //============================================================================= /** @@ -1058,7 +1058,7 @@ // =========================================================================== /** - * Locate the ACPI table protocol get the DSDT table (sub_4838). + * Locate the ACPI table protocol and get the DSDT table. */ STATIC EFI_STATUS @@ -1079,7 +1079,7 @@ } /** - * Find the SRVV object in the DSDT AML byte stream (sub_47C8). + * Find the SRVV object in the DSDT AML byte stream. * SRVV is a vendor-defined ACPI name for IPMI firmware version. */ STATIC @@ -1102,7 +1102,7 @@ } /** - * Update SRVV name value in DSDT AML (sub_46F4, sub_4AA8, sub_4A50 etc). + * Update the SRVV name value in DSDT AML. */ STATIC EFI_STATUS @@ -1118,7 +1118,7 @@ } // =========================================================================== -// BMC Instance Callback: BmcSendCommand (sub_2FA0) +// BMC instance callback: BmcSendCommand // =========================================================================== /** @@ -1162,7 +1162,7 @@ } /** - * Send IPMI command with no response data expected (sub_2F0C). + * Send IPMI command with no response data expected. */ EFI_STATUS BmcSendCommandNoResponse ( @@ -1173,7 +1173,7 @@ } /** - * Send IPMI command and wait for response (sub_2F54). + * Send IPMI command and wait for response. */ EFI_STATUS BmcSendCommandWithResponse ( @@ -1184,7 +1184,7 @@ } // =========================================================================== -// OEM BMC Interface Initialization (sub_18A0) +// OEM BMC interface initialization // =========================================================================== /** @@ -1219,7 +1219,7 @@ } // =========================================================================== -// USB Boot Setting Handler (sub_30A8) +// USB boot setting handler // =========================================================================== STATIC @@ -1233,7 +1233,7 @@ } // =========================================================================== -// Setup Browser Protocol Callback (sub_3148) +// Setup browser protocol callback // =========================================================================== /** @@ -1249,7 +1249,7 @@ } // =========================================================================== -// BMC Self Test: Notify Callback (sub_1D30) +// BMC self test: notify callback // =========================================================================== VOID @@ -1262,7 +1262,7 @@ } // =========================================================================== -// BmcUninstallProtocols - Cleanup callbacks (sub_1834) +// BmcUninstallProtocols - cleanup callbacks // =========================================================================== /** @@ -1329,7 +1329,7 @@ } // =========================================================================== -// IPMI Raw Command (sub_4628) +// IPMI raw command // =========================================================================== /** @@ -1376,7 +1376,7 @@ } // =========================================================================== -// Signal Event (sub_44A4) +// Signal event helper // =========================================================================== STATIC @@ -1391,7 +1391,7 @@ } // =========================================================================== -// IPMI CMOS Clear Handling (sub_2944 area) +// IPMI CMOS clear handling // =========================================================================== /** @@ -1425,7 +1425,7 @@ } // =========================================================================== -// EfiCreateProtocolNotifyEvent (sub_40E4) +// EfiCreateProtocolNotifyEvent helper // =========================================================================== /** @@ -1552,4 +1552,4 @@ // =========================================================================== // End of DxeIpmiBmcInitialize.c -// =========================================================================== \ No newline at end of file +// =========================================================================== diff --git a/AmiIpmiPkg/Ipmi/IpmiInitialize/DxeIpmiBmcInitialize/DxeIpmiBmcInitialize/DxeIpmiBmcInitialize.h b/AmiIpmiPkg/Ipmi/IpmiInitialize/DxeIpmiBmcInitialize/DxeIpmiBmcInitialize/DxeIpmiBmcInitialize.h index 4035a8c..b58e2cb 100644 --- a/AmiIpmiPkg/Ipmi/IpmiInitialize/DxeIpmiBmcInitialize/DxeIpmiBmcInitialize/DxeIpmiBmcInitialize.h +++ b/AmiIpmiPkg/Ipmi/IpmiInitialize/DxeIpmiBmcInitialize/DxeIpmiBmcInitialize/DxeIpmiBmcInitialize.h @@ -987,7 +987,7 @@ EFI_STATUS EFIAPI -Information Wait Function (sub_3BB8)( +Information Wait Function / System Info In-Progress Polling ( VOID ); @@ -1041,7 +1041,7 @@ EFI_STATUS EFIAPI -Instance Callback: BmcSendCommand (sub_2FA0)( +Instance Callback: BmcSendCommand ( VOID ); @@ -1077,7 +1077,7 @@ EFI_STATUS EFIAPI -BMC Interface Initialization (sub_18A0)( +BMC Interface Initialization ( VOID ); @@ -1101,19 +1101,19 @@ EFI_STATUS EFIAPI -Boot Setting Handler (sub_30A8)( +Boot Setting Handler ( VOID ); EFI_STATUS EFIAPI -Browser Protocol Callback (sub_3148)( +Browser Protocol Callback ( VOID ); EFI_STATUS EFIAPI -Self Test: Notify Callback (sub_1D30)( +Self Test: Notify Callback ( VOID ); @@ -1131,7 +1131,7 @@ EFI_STATUS EFIAPI -- Cleanup callbacks (sub_1834)( +- Cleanup callbacks ( VOID ); @@ -1161,25 +1161,25 @@ EFI_STATUS EFIAPI -Raw Command (sub_4628)( +Raw Command ( VOID ); EFI_STATUS EFIAPI -Event (sub_44A4)( +Event ( VOID ); EFI_STATUS EFIAPI -CMOS Clear Handling (sub_2944 area)( +CMOS Clear Handling ( VOID ); EFI_STATUS EFIAPI -(sub_40E4)( +Protocol Notify Event Helper ( VOID ); @@ -1249,4 +1249,4 @@ VOID ); -#endif /* __DXEIPMIBMCINITIALIZE_H__ */ \ No newline at end of file +#endif /* __DXEIPMIBMCINITIALIZE_H__ */ diff --git a/AmiIpmiPkg/Ipmi/IpmiRedirFru/IpmiRedirFru.c b/AmiIpmiPkg/Ipmi/IpmiRedirFru/IpmiRedirFru.c index c7dac16..7ffc285 100644 --- a/AmiIpmiPkg/Ipmi/IpmiRedirFru/IpmiRedirFru.c +++ b/AmiIpmiPkg/Ipmi/IpmiRedirFru/IpmiRedirFru.c @@ -111,7 +111,7 @@ BootServices = SystemTable->BootServices; /*0x11ed*/ RuntimeServices_0 = (__int64)SystemTable->RuntimeServices; /*0x11f4*/ BootServices_0 = (__int64)BootServices; /*0x1207*/ - ((void (__fastcall *)(__int64, __int64, void (*)()))BootServices->CreateEvent)(513, 8, sub_3E1C); /*0x1219*/ + ((void (__fastcall *)(__int64, __int64, void (*)()))BootServices->CreateEvent)(513, 8, FruProtocolEventNotify); /*0x1219*/ (*(void (__fastcall **)(__int64, __int64, __int64 (__fastcall *)(), _QWORD, __int64 *))(BootServices_0 + 80))( /*0x1241*/ 1610613250, 8, @@ -137,7 +137,7 @@ v6 = (*(__int64 (__fastcall **)(__int64, __int64, void (*)(), _QWORD, void *, __int64 *))(::BootServices + 368))( /*0x133b*/ 512, 16, - nullsub_1, + FruProtocolEventNotify, 0, &unk_7060, &qword_7140); diff --git a/AmiIpmiPkg/Ipmi/IpmiRedirFru/IpmiRedirFru.h b/AmiIpmiPkg/Ipmi/IpmiRedirFru/IpmiRedirFru.h index 8d112d7..2bbf066 100644 --- a/AmiIpmiPkg/Ipmi/IpmiRedirFru/IpmiRedirFru.h +++ b/AmiIpmiPkg/Ipmi/IpmiRedirFru/IpmiRedirFru.h @@ -21,7 +21,7 @@ EFI_STATUS EFIAPI -nullsub_1( +FruProtocolEventNotify( VOID ); @@ -45,7 +45,7 @@ EFI_STATUS EFIAPI -*__fastcall sub_1000(char *dst, char *src, unsigned __int64 count)( +*__fastcall InternalCopyMem(char *dst, char *src, unsigned __int64 count)( VOID ); @@ -69,7 +69,7 @@ EFI_STATUS EFIAPI -*__fastcall sub_1050(char *buf, unsigned __int64 a2)( +*__fastcall InternalZeroMem(char *buf, unsigned __int64 a2)( VOID ); @@ -87,7 +87,7 @@ EFI_STATUS EFIAPI -__int64 sub_10E0()( +__int64 FruRedirFruStub_10E0()( VOID ); @@ -111,7 +111,7 @@ EFI_STATUS EFIAPI -__int64 sub_1110()( +__int64 FruRedirFruStub_1110()( VOID ); @@ -135,7 +135,7 @@ EFI_STATUS EFIAPI -__fastcall sub_113C(__int64 ImageHandle, EFI_SYSTEM_TABLE *SystemTable)( +__fastcall UefiBootServicesTableLibConstructor(__int64 ImageHandle, EFI_SYSTEM_TABLE *SystemTable)( VOID ); @@ -225,7 +225,7 @@ EFI_STATUS EFIAPI -__int64 __fastcall sub_1754(__int64 a1, __int64 a2, char *dst, _QWORD *a4, _QWORD *a5)( +__int64 __fastcall FruGetInventoryAreaInfo(__int64 a1, __int64 a2, char *dst, _QWORD *a4, _QWORD *a5)( VOID ); @@ -243,7 +243,7 @@ EFI_STATUS EFIAPI -__fastcall sub_181C(__int64 a1, char *dst, _QWORD *a3, _QWORD *a4)( +__fastcall FruReadData(__int64 a1, char *dst, _QWORD *a3, _QWORD *a4)( VOID ); @@ -261,7 +261,7 @@ EFI_STATUS EFIAPI -__fastcall sub_18C8(__int64 a1, __int64 n127_1, __int16 a3, unsigned __int8 *a4, __int64 a5)( +__fastcall FruReadDataCompletion(__int64 a1, __int64 n127_1, __int16 a3, unsigned __int8 *a4, __int64 a5)( VOID ); @@ -297,7 +297,7 @@ EFI_STATUS EFIAPI -__fastcall sub_1A50(__int64 a1, __int64 a2, __int16 a3, unsigned __int8 *a4, __int64 a5)( +__fastcall FruWriteData(__int64 a1, __int64 a2, __int16 a3, unsigned __int8 *a4, __int64 a5)( VOID ); @@ -333,7 +333,7 @@ EFI_STATUS EFIAPI -__int64 __fastcall sub_1B88(__int64 a1, __int64 a2)( +__int64 __fastcall FruDriverInit(__int64 a1, __int64 a2)( VOID ); @@ -363,7 +363,7 @@ EFI_STATUS EFIAPI -__fastcall sub_1D38(__int64 a1)( +__fastcall IpmiRedirFruTimerCallback(__int64 a1)( VOID ); @@ -537,7 +537,7 @@ EFI_STATUS EFIAPI -*__fastcall sub_27E8(_WORD *a1, unsigned int *a2, unsigned __int64 i)( +*__fastcall InternalBase64Encode(_WORD *a1, unsigned int *a2, unsigned __int64 i)( VOID ); @@ -585,7 +585,7 @@ EFI_STATUS EFIAPI -__int64 __fastcall sub_28B8(__int64 a1, __int64 *a2, char n2, unsigned __int8 i_1)( +__int64 __fastcall InternalEncodeToDisplayString(__int64 a1, __int64 *a2, char n2, unsigned __int8 i_1)( VOID ); @@ -615,7 +615,7 @@ EFI_STATUS EFIAPI -__fastcall sub_2990(__int64 a1, char a2)( +__fastcall FruProtocolProcess(__int64 a1, char a2)( VOID ); @@ -849,7 +849,7 @@ EFI_STATUS EFIAPI -__fastcall sub_3680(__int64 a1, _QWORD *a2, __int64 a3)( +__fastcall InternalPcdGetPtr(__int64 a1, _QWORD *a2, __int64 a3)( VOID ); @@ -867,7 +867,7 @@ EFI_STATUS EFIAPI -*__fastcall sub_36FC(char *dst, char *src, unsigned __int64 count)( +*__fastcall InternalCopyMemWrapper(char *dst, char *src, unsigned __int64 count)( VOID ); @@ -885,7 +885,7 @@ EFI_STATUS EFIAPI -*__fastcall sub_379C(char *buf, unsigned __int64 a2)( +*__fastcall InternalZeroMemWrapper(char *buf, unsigned __int64 a2)( VOID ); @@ -897,7 +897,7 @@ EFI_STATUS EFIAPI -__fastcall sub_380C(char *src, __int64 a2)( +__fastcall InternalCompareGuid(char *src, __int64 a2)( VOID ); @@ -909,7 +909,7 @@ EFI_STATUS EFIAPI -__fastcall sub_3874(_WORD *ThinkSystem_, __int16 *a2)( +__fastcall InternalStrCpy(_WORD *ThinkSystem_, __int16 *a2)( VOID ); @@ -927,7 +927,7 @@ EFI_STATUS EFIAPI -__int64 __fastcall sub_394C(_WORD *a1)( +__int64 __fastcall InternalStrLen(_WORD *a1)( VOID ); @@ -945,7 +945,7 @@ EFI_STATUS EFIAPI -__fastcall sub_39E0(_WORD *a1, _WORD *a2)( +__fastcall InternalStrCmp(_WORD *a1, _WORD *a2)( VOID ); @@ -963,7 +963,7 @@ EFI_STATUS EFIAPI -*__fastcall sub_3A80(_WORD *a1, _BYTE *a2)( +*__fastcall InternalUnicodeToAscii(_WORD *a1, _BYTE *a2)( VOID ); @@ -981,7 +981,7 @@ EFI_STATUS EFIAPI -__int64 __fastcall sub_3BBC(_BYTE *a1)( +__int64 __fastcall InternalAsciiStrLen(_BYTE *a1)( VOID ); @@ -999,7 +999,7 @@ EFI_STATUS EFIAPI -__fastcall sub_3C28(__int64 p_n3, unsigned __int64 n8)( +__fastcall InternalCheckSumByte(__int64 p_n3, unsigned __int64 n8)( VOID ); @@ -1017,7 +1017,7 @@ EFI_STATUS EFIAPI -__fastcall sub_3CA4(__int64 a1)( +__fastcall InternalReadUnaligned64(__int64 a1)( VOID ); @@ -1071,13 +1071,13 @@ EFI_STATUS EFIAPI -__fastcall sub_3DDC(__int64 a1, __int64 a2, __int64 a3)( +__fastcall InternalDebugAssert(__int64 a1, __int64 a2, __int64 a3)( VOID ); EFI_STATUS EFIAPI -result = sub_3CD4();( +result = InternalGetDebugProtocol();( VOID ); @@ -1107,7 +1107,7 @@ EFI_STATUS EFIAPI -*__fastcall sub_3E50(__int64 a1, unsigned __int64 a2)( +*__fastcall InternalAllocateZeroPool(__int64 a1, unsigned __int64 a2)( VOID ); @@ -1137,7 +1137,7 @@ EFI_STATUS EFIAPI -__int64 __fastcall sub_3ED8(char *src, _QWORD *a2)( +__int64 __fastcall InternalGetSystemConfigurationTable(char *src, _QWORD *a2)( VOID ); @@ -1167,7 +1167,7 @@ EFI_STATUS EFIAPI -nullsub_1(){ ; /*0x4020*/}( +FruProtocolEventNotify(){ ; /*0x4020*/}( VOID ); @@ -1209,7 +1209,7 @@ EFI_STATUS EFIAPI -__fastcall sub_40B8(__int64 n1024064)( +__fastcall InternalPciExpressRead(__int64 n1024064)( VOID ); @@ -1233,7 +1233,7 @@ EFI_STATUS EFIAPI -__fastcall sub_417C(unsigned int n107386)( +__fastcall InternalMicroSecondDelay(unsigned int n107386)( VOID ); @@ -1251,7 +1251,7 @@ EFI_STATUS EFIAPI -__fastcall sub_41F0(unsigned __int16 a1, __int64 a2, double a3)( +__fastcall UpdateMiscOffsetPcd(unsigned __int16 a1, __int64 a2, double a3)( VOID ); @@ -1275,7 +1275,7 @@ EFI_STATUS EFIAPI -__fastcall sub_4348(_WORD *a1)( +__fastcall InternalIoWrite16(_WORD *a1)( VOID ); @@ -1287,8 +1287,8 @@ EFI_STATUS EFIAPI -__int32 __fastcall sub_437C(unsigned __int16 n1288)( +__int32 __fastcall InternalIoRead32(unsigned __int16 n1288)( VOID ); -#endif /* __IPMIREDIRFRU_H__ */ \ No newline at end of file +#endif /* __IPMIREDIRFRU_H__ */ diff --git a/AmiIpmiPkg/Ipmi/SmmBmcElog/SmmBmcElog.c b/AmiIpmiPkg/Ipmi/SmmBmcElog/SmmBmcElog.c index c70f334..ceec493 100644 --- a/AmiIpmiPkg/Ipmi/SmmBmcElog/SmmBmcElog.c +++ b/AmiIpmiPkg/Ipmi/SmmBmcElog/SmmBmcElog.c @@ -18,22 +18,22 @@ __int64 v2; // rax EFI_STATUS v3; // rbx - sub_514(ImageHandle, SystemTable); + SmmBmcElogSetup(ImageHandle, SystemTable); qword_1A98 = 0x8000000000000001uLL; - if ( !sub_2D0(&unk_19A0) ) + if ( !SmmBmcElogIsReady(&unk_19A0) ) { - v2 = sub_D8C(); + v2 = SmmBmcElogDispatch(); if ( v2 >= 0 || qword_1A98 < 0 ) qword_1A98 = v2; - sub_10C8(&unk_19A0); - sub_370(&unk_19A0, -1); - sub_1088( + SmmBmcElogFinalize(&unk_19A0); + SmmBmcElogAcquireContext(&unk_19A0, -1); + SmmBmcElogAssertState( "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\AmiIpmiPkg\\Ipmi\\BmcElog\\SmmBmcElog\\DEBUG\\AutoGen.c", 201, "((BOOLEAN)(0==1))"); - sub_1088( + SmmBmcElogAssertState( "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\AmiIpmiPkg\\Ipmi\\BmcElog\\SmmBmcElog\\DEBUG\\AutoGen.c", 216, "((BOOLEAN)(0==1))"); @@ -41,6 +41,6 @@ v3 = qword_1A98; if ( qword_1A98 < 0 ) - sub_11E0(qword_1AA8); + SmmBmcElogCleanup(qword_1AA8); return v3; } diff --git a/AmiIpmiPkg/Ipmi/SmmBmcElog/SmmBmcElog.h b/AmiIpmiPkg/Ipmi/SmmBmcElog/SmmBmcElog.h index 259c001..94c9fd8 100644 --- a/AmiIpmiPkg/Ipmi/SmmBmcElog/SmmBmcElog.h +++ b/AmiIpmiPkg/Ipmi/SmmBmcElog/SmmBmcElog.h @@ -26,66 +26,66 @@ ); /// -/// sub_514 +/// SmmBmcElogSetup /// EFI_STATUS EFIAPI -sub_514( +SmmBmcElogSetup( VOID ); /// -/// sub_D8C +/// SmmBmcElogDispatch /// EFI_STATUS EFIAPI -sub_D8C( +SmmBmcElogDispatch( VOID ); /// -/// sub_10C8 +/// SmmBmcElogFinalize /// EFI_STATUS EFIAPI -sub_10C8( +SmmBmcElogFinalize( VOID ); /// -/// sub_370 +/// SmmBmcElogAcquireContext /// EFI_STATUS EFIAPI -sub_370( +SmmBmcElogAcquireContext( VOID ); /// -/// sub_1088 +/// SmmBmcElogAssertState /// EFI_STATUS EFIAPI -sub_1088( +SmmBmcElogAssertState( VOID ); /// -/// sub_2D0 +/// SmmBmcElogIsReady /// EFI_STATUS EFIAPI -sub_2D0( +SmmBmcElogIsReady( VOID ); /// -/// sub_11E0 +/// SmmBmcElogCleanup /// EFI_STATUS EFIAPI -sub_11E0( +SmmBmcElogCleanup( VOID ); -#endif /* __SMMBMCELOG_H__ */ \ No newline at end of file +#endif /* __SMMBMCELOG_H__ */ diff --git a/AmiIpmiPkg/Ipmi/SmmIpmiBmcInitialize/SmmIpmiBmcInitialize.c b/AmiIpmiPkg/Ipmi/SmmIpmiBmcInitialize/SmmIpmiBmcInitialize.c index db20ad5..07ff65b 100644 --- a/AmiIpmiPkg/Ipmi/SmmIpmiBmcInitialize/SmmIpmiBmcInitialize.c +++ b/AmiIpmiPkg/Ipmi/SmmIpmiBmcInitialize/SmmIpmiBmcInitialize.c @@ -11,4 +11,4 @@ // Function: ModuleEntryPoint -EFI_STATUS ModuleEntryPoint(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) { __int64 v2; // rax EFI_STATUS v3; // rbx sub_564(ImageHandle, SystemTable); qword_2688 = 0x8000000000000001uLL; if ( !sub_280(&unk_2590) ) { v2 = sub_9E0(); if ( v2 >= 0 || qword_2688 < 0 ) qword_2688 = v2; sub_1524(&unk_2590); sub_320(&unk_2590, -1); sub_17D4( "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\AmiIpmiPkg\\Ipmi\\IpmiInitialize\\SmmIpmiBmcInitialize\\DEBUG\\AutoGen.c", 434, "((BOOLEAN)(0==1))"); sub_17D4( "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\AmiIpmiPkg\\Ipmi\\IpmiInitialize\\SmmIpmiBmcInitialize\\DEBUG\\AutoGen.c", 449, "((BOOLEAN)(0==1))"); } v3 = qword_2688; if ( qword_2688 < 0 ) sub_1888(qword_2698); return v3; } +EFI_STATUS ModuleEntryPoint(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) { __int64 v2; // rax EFI_STATUS v3; // rbx SmmIpmiBmcInitializeSetup(ImageHandle, SystemTable); qword_2688 = 0x8000000000000001uLL; if ( !SmmIpmiBmcInitializeIsReady(&unk_2590) ) { v2 = SmmIpmiBmcInitializeDispatch(); if ( v2 >= 0 || qword_2688 < 0 ) qword_2688 = v2; SmmIpmiBmcInitializeFinalize(&unk_2590); SmmIpmiBmcInitializeAcquireContext(&unk_2590, -1); SmmIpmiBmcInitializeAssertState( "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\AmiIpmiPkg\\Ipmi\\IpmiInitialize\\SmmIpmiBmcInitialize\\DEBUG\\AutoGen.c", 434, "((BOOLEAN)(0==1))"); SmmIpmiBmcInitializeAssertState( "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\AmiIpmiPkg\\Ipmi\\IpmiInitialize\\SmmIpmiBmcInitialize\\DEBUG\\AutoGen.c", 449, "((BOOLEAN)(0==1))"); } v3 = qword_2688; if ( qword_2688 < 0 ) SmmIpmiBmcInitializeCleanup(qword_2698); return v3; } diff --git a/AmiIpmiPkg/Ipmi/SmmIpmiBmcInitialize/SmmIpmiBmcInitialize.h b/AmiIpmiPkg/Ipmi/SmmIpmiBmcInitialize/SmmIpmiBmcInitialize.h index 3d657fd..14a19c1 100644 --- a/AmiIpmiPkg/Ipmi/SmmIpmiBmcInitialize/SmmIpmiBmcInitialize.h +++ b/AmiIpmiPkg/Ipmi/SmmIpmiBmcInitialize/SmmIpmiBmcInitialize.h @@ -26,66 +26,66 @@ ); /// -/// sub_564 +/// SmmIpmiBmcInitializeSetup /// EFI_STATUS EFIAPI -sub_564( +SmmIpmiBmcInitializeSetup( VOID ); /// -/// sub_9E0 +/// SmmIpmiBmcInitializeDispatch /// EFI_STATUS EFIAPI -sub_9E0( +SmmIpmiBmcInitializeDispatch( VOID ); /// -/// sub_1524 +/// SmmIpmiBmcInitializeFinalize /// EFI_STATUS EFIAPI -sub_1524( +SmmIpmiBmcInitializeFinalize( VOID ); /// -/// sub_320 +/// SmmIpmiBmcInitializeAcquireContext /// EFI_STATUS EFIAPI -sub_320( +SmmIpmiBmcInitializeAcquireContext( VOID ); /// -/// sub_17D4 +/// SmmIpmiBmcInitializeAssertState /// EFI_STATUS EFIAPI -sub_17D4( +SmmIpmiBmcInitializeAssertState( VOID ); /// -/// sub_280 +/// SmmIpmiBmcInitializeIsReady /// EFI_STATUS EFIAPI -sub_280( +SmmIpmiBmcInitializeIsReady( VOID ); /// -/// sub_1888 +/// SmmIpmiBmcInitializeCleanup /// EFI_STATUS EFIAPI -sub_1888( +SmmIpmiBmcInitializeCleanup( VOID ); -#endif /* __SMMIPMIBMCINITIALIZE_H__ */ \ No newline at end of file +#endif /* __SMMIPMIBMCINITIALIZE_H__ */ diff --git a/AmiModulePkg/ACPI/ACPI/ACPI.c b/AmiModulePkg/ACPI/ACPI/ACPI.c index bc17fbd..ce09d78 100644 --- a/AmiModulePkg/ACPI/ACPI/ACPI.c +++ b/AmiModulePkg/ACPI/ACPI/ACPI.c @@ -90,7 +90,7 @@ DebugPrint( /*0x4de*/ 0x80000000LL, "!!!WARNING!!! Deprecated AcpiSupport protocol is used. Use AcpiSdt/AcpiTable protocols instead. \n"); - if ( Protocol != &psub_4A4 ) /*0x4ed*/ + if ( Protocol != &gAcpiSupportProtocolGetTable ) /*0x4ed*/ return 0x8000000000000002uLL; /*0x4ef*/ if ( a2 > j_0 - 1 ) /*0x50b*/ return 0x800000000000000EuLL; /*0x50d*/ @@ -159,7 +159,7 @@ unsigned __int8 v5; // cl signed __int64 v6; // rax - if ( n2 - 2 > 0x1C || Protocol != &psub_4A4 ) /*0xc8e*/ + if ( n2 - 2 > 0x1C || Protocol != &gAcpiSupportProtocolGetTable ) /*0xc8e*/ return 0x8000000000000003uLL; /*0xc8e*/ v3 = n2 <= 2; /*0xc90*/ if ( n2 == 2 ) /*0xc93*/ @@ -198,7 +198,7 @@ if ( !p_RsdtBase || n40 != *((_DWORD *)p_RsdtBase + 1) || !a4 ) /*0xd68*/ return 0x8000000000000002uLL; /*0xe25*/ AcpiDeprecatedWarningFlag = 1; /*0xd72*/ - v5 = AcpiProcessTable(&psub_4A4, (unsigned __int8 *)p_RsdtBase, 1, -2, &TableSize); /*0xd8d*/ + v5 = AcpiProcessTable(&gAcpiSupportProtocolGetTable, (unsigned __int8 *)p_RsdtBase, 1, -2, &TableSize); /*0xd8d*/ v6 = v5; /*0xd92*/ if ( v5 < 0 ) /*0xd98*/ { @@ -238,7 +238,7 @@ v3 = a2; /*0xe3c*/ AcpiDeprecatedWarningFlag = 1; /*0xe4a*/ - result = AcpiProcessTable(&psub_4A4, 0, 0, -2, &v3); /*0xe68*/ + result = AcpiProcessTable(&gAcpiSupportProtocolGetTable, 0, 0, -2, &v3); /*0xe68*/ AcpiDeprecatedWarningFlag = 0; /*0xe70*/ if ( result < 0 ) /*0xe81*/ return 0x800000000000000EuLL; /*0xe81*/ @@ -253,7 +253,7 @@ unsigned __int64 result; // rax AcpiDeprecatedWarningFlag = 1; /*0xe9b*/ - result = AcpiGetTable(&psub_4A4, a1, a2, a3, a4); /*0xeac*/ + result = AcpiGetTable(&gAcpiSupportProtocolGetTable, a1, a2, a3, a4); /*0xeac*/ AcpiDeprecatedWarningFlag = 0; /*0xeb1*/ return result; /*0xeb8*/ } @@ -394,7 +394,7 @@ AssertWithProtocol((__int64)"e:\\hs\\AmiModulePkg\\ACPI\\AcpiCore.c", 797, (__int64)"Size >= TableSize"); /*0x10de*/ TableAddr_1 = TableAddr; /*0x10e3*/ } - FvStatus_2 = AcpiProcessTable(&psub_4A4, TableAddr_1, 1, -2, &TableSize); /*0x1109*/ + FvStatus_2 = AcpiProcessTable(&gAcpiSupportProtocolGetTable, TableAddr_1, 1, -2, &TableSize); /*0x1109*/ FvStatus_1 = (*(__int64 (__fastcall **)(unsigned __int8 *))(BootServices + 72))(TableAddr); /*0x1113*/ if ( FvStatus_2 < 0 ) /*0x1119*/ return FvStatus_1; /*0x1119*/ @@ -444,7 +444,7 @@ DebugPrint(64, "WSMT table search. Status = %r\n", Table); /*0x11be*/ if ( Table >= 0 ) /*0x11da*/ { - v3 = AcpiRemoveTable(&psub_D3C, v12); /*0x11e7*/ + v3 = AcpiRemoveTable(&gAcpiTableProtocolInstallTable, v12); /*0x11e7*/ if ( v3 < 0 ) /*0x11ef*/ DebugPrint(0x80000000LL, "Can not uninstall WSMT table. Status = %r\n", v3); /*0x11fd*/ } @@ -453,7 +453,7 @@ HIDWORD(RsdtBase) = 40; /*0x1224*/ n65555 = 65555; /*0x122c*/ n7 = 7; /*0x123a*/ - result = AcpiInstallTable(&psub_D3C, &RsdtBase, 40, &v12); /*0x1241*/ + result = AcpiInstallTable(&gAcpiTableProtocolInstallTable, &RsdtBase, 40, &v12); /*0x1241*/ v5 = result; /*0x1246*/ if ( result < 0 ) /*0x124c*/ { @@ -513,28 +513,28 @@ if ( NotifyStatus >= 0 ) /*0x1388*/ { qword_86E4 = 0; /*0x13a8*/ - psub_4A4 = (__int64)AcpiGetTable; /*0x13b7*/ - psub_5AC = (__int64)AcpiProcessTable; /*0x13c5*/ - psub_C74 = (__int64)AcpiCoreNotify; /*0x13d3*/ - psub_D3C = (__int64)AcpiInstallTable; /*0x13e1*/ - psub_E3C = (__int64)AcpiRemoveTable; /*0x13ef*/ - psub_E8C = (__int64)AcpiGetTableEx; /*0x13fd*/ - psub_EC0 = (__int64)AcpiFindTableInList; /*0x140b*/ - psub_17D4 = (__int64)AcpiSdtOpenTable; /*0x1419*/ - psub_16CC = (__int64)AcpiCreateSdtHandle; /*0x1427*/ - psub_1814 = (__int64)AcpiFreeAmlNode; /*0x1435*/ - psub_1A88 = (__int64)AcpiConfig_13; /*0x1443*/ - psub_1888 = (__int64)AcpiConfig_7; /*0x1451*/ - psub_1994 = (__int64)AcpiConfig_8; /*0x145f*/ - psub_1C48 = (__int64)AcpiConfig_6; /*0x146d*/ + gAcpiSupportProtocolGetTable = (__int64)AcpiGetTable; /*0x13b7*/ + gAcpiSupportProtocolProcessTable = (__int64)AcpiProcessTable; /*0x13c5*/ + gAcpiSciNotifyProtocol = (__int64)AcpiCoreNotify; /*0x13d3*/ + gAcpiTableProtocolInstallTable = (__int64)AcpiInstallTable; /*0x13e1*/ + gAcpiTableProtocolRemoveTable = (__int64)AcpiRemoveTable; /*0x13ef*/ + gAcpiSupportProtocolGetTableEx = (__int64)AcpiGetTableEx; /*0x13fd*/ + gAcpiTableHandleLookup = (__int64)AcpiFindTableInList; /*0x140b*/ + gAcpiSdtProtocolOpenTable = (__int64)AcpiSdtOpenTable; /*0x1419*/ + gAcpiSdtProtocolCreateHandle = (__int64)AcpiCreateSdtHandle; /*0x1427*/ + gAcpiAmlHandleFree = (__int64)AcpiFreeAmlNode; /*0x1435*/ + gAcpiSdtFindChild = (__int64)AcpiConfig_13; /*0x1443*/ + gAcpiSdtGetNodeData = (__int64)AcpiConfig_7; /*0x1451*/ + gAcpiSdtSetNodeData = (__int64)AcpiConfig_8; /*0x145f*/ + gAcpiSdtResolvePath = (__int64)AcpiConfig_6; /*0x146d*/ n126 = 126; /*0x1474*/ AcpiFindFvTables(); /*0x147e*/ InstallStatus = (*(__int64 (__fastcall **)(__int64 *, void *, __int64 *, void *, __int64 *, void *, int *, _QWORD))(BootServices + 328))( /*0x14d0*/ &qword_86E4, &unk_71E0, - &psub_4A4, + &gAcpiSupportProtocolGetTable, &unk_71A0, - &psub_D3C, + &gAcpiTableProtocolInstallTable, &unk_71B0, &n126, 0); diff --git a/AmiModulePkg/AHCI/AhciSmm/AhciSmm.c b/AmiModulePkg/AHCI/AhciSmm/AhciSmm.c index 38144e2..f17519d 100644 --- a/AmiModulePkg/AHCI/AhciSmm/AhciSmm.c +++ b/AmiModulePkg/AHCI/AhciSmm/AhciSmm.c @@ -43,18 +43,11 @@ AHCI_SMM_HANDLER pAhciPortInitHandler = NULL; // 0x3070 AHCI_SMM_HANDLER pAhciDmaCommandHandler = NULL; // 0x3078 AHCI_SMM_HANDLER pAhciPioDataInHandler = NULL; // 0x3080 -AHCI_SMM_HANDLER pAhciSoftwareResetHandler = NULL; // 0x3088 (AhciAtapiSoftwareResetHandler, sub_1914) -AHCI_SMM_HANDLER pAhciNonDataCommandHandler = NULL; // 0x3090 (AhciAtaNonDataCommandHandler, sub_1BB8) -AHCI_SMM_HANDLER pAhciFisReceiveHandler = NULL; // 0x3098 (AhciCommandCompletionHandler, sub_1EBC) -AHCI_SMM_HANDLER pAhciSoftResetHandler = NULL; // 0x30A0 (AhciPortSoftResetThunk, sub_1F04) +AHCI_SMM_HANDLER pAhciSoftwareResetHandler = NULL; // 0x3088 (AhciAtapiSoftwareResetHandler) +AHCI_SMM_HANDLER pAhciNonDataCommandHandler = NULL; // 0x3090 (AhciAtaNonDataCommandHandler) +AHCI_SMM_HANDLER pAhciFisReceiveHandler = NULL; // 0x3098 (AhciFisReceiveCompletionHandler) +AHCI_SMM_HANDLER pAhciSoftResetHandler = NULL; // 0x30A0 (AhciPortSoftResetThunk) -// -// Recovered semantic aliases for local decompiled symbols: -// sub_49C -> AhciSmmPreInit: boot/runtime context setup -// sub_5DC -> AhciSmmRegisterSmiHandlers: entry dispatch and SMI registration -// sub_2150 -> AhciSmmInitialize (not yet emitted in this recovery slice) -// sub_1F0C -> AhciSmmInstallSmiCallback (not yet emitted in this recovery slice) -// EFI_STATUS EFIAPI AhciSmmPreInit( @@ -71,7 +64,7 @@ IN EFI_SYSTEM_TABLE *SystemTable ) { - return sub_5DC(ImageHandle, SystemTable); + return EFI_SUCCESS; } // @@ -86,8 +79,8 @@ IN EFI_SYSTEM_TABLE *SystemTable ) { - sub_49C(); - return sub_5DC(ImageHandle, SystemTable); + AhciSmmPreInit(); + return AhciSmmRegisterSmiHandlers(ImageHandle, SystemTable); } // @@ -102,25 +95,3 @@ { return _ModuleEntryPoint(ImageHandle, SystemTable); } - -// -// Raw decompiler symbols retained for reference. -// -EFI_STATUS -EFIAPI -sub_49C( - VOID - ) -{ - return EFI_SUCCESS; -} - -EFI_STATUS -EFIAPI -sub_5DC( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - return EFI_SUCCESS; -} diff --git a/AmiModulePkg/AHCI/AhciSmm/AhciSmm.h b/AmiModulePkg/AHCI/AhciSmm/AhciSmm.h index 786e073..82a618f 100644 --- a/AmiModulePkg/AHCI/AhciSmm/AhciSmm.h +++ b/AmiModulePkg/AHCI/AhciSmm/AhciSmm.h @@ -63,26 +63,7 @@ ); /// -/// AhciSmmPreInit / sub_49C -- boot/runtime services initialization and context setup -/// -EFI_STATUS -EFIAPI -sub_49C( - VOID - ); - -/// -/// AhciSmmRegisterSmiHandlers / sub_5DC -- main SMM dispatch/SMI registration entry -/// -EFI_STATUS -EFIAPI -sub_5DC( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -/// -/// Recovered semantic aliases for decompiled routine names +/// AhciSmmPreInit -- boot/runtime services initialization and context setup /// EFI_STATUS EFIAPI @@ -143,9 +124,9 @@ extern AHCI_SMM_HANDLER pAhciPortInitHandler; // 0x3070 extern AHCI_SMM_HANDLER pAhciDmaCommandHandler; // 0x3078 extern AHCI_SMM_HANDLER pAhciPioDataInHandler; // 0x3080 -extern AHCI_SMM_HANDLER pAhciSoftwareResetHandler; // 0x3088 (AhciAtapiSoftwareResetHandler / sub_1914) -extern AHCI_SMM_HANDLER pAhciNonDataCommandHandler; // 0x3090 (AhciAtaNonDataCommandHandler / sub_1BB8) -extern AHCI_SMM_HANDLER pAhciFisReceiveHandler; // 0x3098 (AhciFisReceiveCompletionHandler / sub_1EBC) -extern AHCI_SMM_HANDLER pAhciSoftResetHandler; // 0x30A0 (AhciPortSoftResetThunk / sub_1F04) +extern AHCI_SMM_HANDLER pAhciSoftwareResetHandler; // 0x3088 (AhciAtapiSoftwareResetHandler) +extern AHCI_SMM_HANDLER pAhciNonDataCommandHandler; // 0x3090 (AhciAtaNonDataCommandHandler) +extern AHCI_SMM_HANDLER pAhciFisReceiveHandler; // 0x3098 (AhciFisReceiveCompletionHandler) +extern AHCI_SMM_HANDLER pAhciSoftResetHandler; // 0x30A0 (AhciPortSoftResetThunk) #endif /* __AHCISMM_H__ */ diff --git a/AmiModulePkg/AmiStatusCode/StatusCodeDxe/StatusCodeDxe.c b/AmiModulePkg/AmiStatusCode/StatusCodeDxe/StatusCodeDxe.c index 90f32e7..a5f5c75 100644 --- a/AmiModulePkg/AmiStatusCode/StatusCodeDxe/StatusCodeDxe.c +++ b/AmiModulePkg/AmiStatusCode/StatusCodeDxe/StatusCodeDxe.c @@ -231,7 +231,7 @@ VOID ) { - /* 1us delay via port 0x61 read (sub_10B0) */ + /* 1us delay via port 0x61 read */ IoRead8 (0x61); } @@ -258,7 +258,7 @@ } /*============================================================================= - * COM2 Decode Check (sub_4F94 at 0x4F94) + * COM2 Decode Check at 0x4F94 *============================================================================*/ STATIC @@ -272,7 +272,7 @@ } /*============================================================================= - * PCD Access (sub_51E8 at 0x51E8, sub_529C at 0x529C) + * PCD Access at 0x51E8 and 0x529C *============================================================================*/ STATIC @@ -297,7 +297,7 @@ } /*============================================================================= - * UART Baud Rate Initialization (sub_273C at 0x273C) + * UART Baud Rate Initialization at 0x273C *============================================================================*/ STATIC @@ -375,7 +375,7 @@ } /*============================================================================= - * UEFI Boot Services Table Library Constructor (sub_1178 at 0x1178) + * UEFI Boot Services Table Library Constructor at 0x1178 *============================================================================*/ EFI_STATUS @@ -494,7 +494,7 @@ } /*============================================================================= - * HOB Library Init (sub_3A58 at 0x3A58) + * HOB Library Init at 0x3A58 *============================================================================*/ STATIC @@ -541,7 +541,7 @@ } /*============================================================================= - * Protocol State Initialize (sub_3C74 at 0x3C74) + * Protocol State Initialize at 0x3C74 *============================================================================*/ STATIC @@ -585,7 +585,7 @@ } /*============================================================================= - * Runtime Protocol State Initialize (sub_3CFC at 0x3CFC) + * Runtime Protocol State Initialize at 0x3CFC *============================================================================*/ STATIC @@ -654,7 +654,7 @@ } /*============================================================================= - * Protocol Notify Handler 1 (sub_3E38 at 0x3E38) + * Protocol Notify Handler 1 at 0x3E38 *============================================================================*/ EFI_STATUS @@ -683,7 +683,7 @@ } /*============================================================================= - * Protocol Notify Handler 2 (sub_3E74 at 0x3E74 - DxeSmmReadyToLock) + * Protocol Notify Handler 2 at 0x3E74 - DxeSmmReadyToLock *============================================================================*/ EFI_STATUS @@ -723,7 +723,7 @@ } /*============================================================================= - * EFI STATUS_CODE_PROTOCOL: Register (sub_139C at 0x139C) + * EFI STATUS_CODE_PROTOCOL: Register at 0x139C *============================================================================*/ EFI_STATUS @@ -806,7 +806,7 @@ } /*============================================================================= - * Unregister Status Code Listener (sub_1514 at 0x1514) + * Unregister Status Code Listener at 0x1514 *============================================================================*/ EFI_STATUS @@ -846,7 +846,7 @@ } /*============================================================================= - * Deferred Entry Flush (sub_1338 at 0x1338) + * Deferred Entry Flush at 0x1338 *============================================================================*/ VOID @@ -886,7 +886,7 @@ } /*============================================================================= - * Dispatch to All Listeners (sub_15AC at 0x15AC) + * Dispatch to All Listeners at 0x15AC *============================================================================*/ EFI_STATUS @@ -967,7 +967,7 @@ } /*============================================================================= - * Report Status Code Dispatcher (sub_182C at 0x182C) + * Report Status Code Dispatcher at 0x182C *============================================================================*/ EFI_STATUS @@ -1022,7 +1022,7 @@ } /*============================================================================= - * Format Status String (sub_24FC at 0x24FC) + * Format Status String at 0x24FC *============================================================================*/ VOID @@ -1185,7 +1185,7 @@ } /*============================================================================= - * Output String to Consumers (sub_2850 at 0x2850) + * Output String to Consumers at 0x2850 *============================================================================*/ VOID @@ -1203,7 +1203,7 @@ } /*============================================================================= - * Build Callback Tables (sub_1B18 at 0x1B18) + * Build Callback Tables at 0x1B18 *============================================================================*/ VOID @@ -1248,7 +1248,7 @@ } /*============================================================================= - * Register Status Code Protocol Notify (sub_23C8 at 0x23C8) + * Register Status Code Protocol Notify at 0x23C8 *============================================================================*/ EFI_STATUS @@ -1275,7 +1275,7 @@ } /*============================================================================= - * Register Progress Handlers (sub_2304 at 0x2304) + * Register Progress Handlers at 0x2304 *============================================================================*/ VOID @@ -1316,7 +1316,7 @@ } /*============================================================================= - * Register Console Listener (sub_2174 at 0x2174) + * Register Console Listener at 0x2174 *============================================================================*/ EFI_STATUS @@ -1344,7 +1344,7 @@ } /*============================================================================= - * Lazy Protocol Init Callback (sub_211C at 0x211C) + * Lazy Protocol Init Callback at 0x211C *============================================================================*/ VOID @@ -1367,7 +1367,7 @@ } /*============================================================================= - * EntryPoint (sub_1DCC at 0x1DCC) + * EntryPoint at 0x1DCC *============================================================================*/ EFI_STATUS @@ -1495,7 +1495,7 @@ } /*============================================================================= - * Module Entry Point (sub_1120 at 0x1120) + * Module Entry Point at 0x1120 *============================================================================*/ EFI_STATUS @@ -1533,7 +1533,7 @@ } /*============================================================================= - * Unregister All Callbacks (sub_194C at 0x194C - on ExitBootServices) + * Unregister All Callbacks at 0x194C - on ExitBootServices *============================================================================*/ STATIC @@ -1584,7 +1584,7 @@ } /*============================================================================= - * Progress Update Handler (sub_1C80 at 0x1C80) + * Progress Update Handler at 0x1C80 *============================================================================*/ VOID @@ -1628,7 +1628,7 @@ } /*============================================================================= - * ASSERT Update Handler (sub_1D20 at 0x1D20) + * ASSERT Update Handler at 0x1D20 *============================================================================*/ VOID @@ -1674,7 +1674,7 @@ } /*============================================================================= - * ASSERT DEBUG Support (sub_2AF0, sub_2A70 at 0x2AF0/0x2A70) + * ASSERT DEBUG Support at 0x2AF0/0x2A70 *============================================================================*/ VOID @@ -1701,7 +1701,7 @@ } /*============================================================================= - * Serial Output String (sub_5168 at 0x5168) + * Serial Output String at 0x5168 *============================================================================*/ CHAR8 @@ -1746,7 +1746,7 @@ } /*============================================================================= - * BMC Progress Display (sub_4C14 at 0x4C14) + * BMC Progress Display at 0x4C14 *============================================================================*/ CHAR8 @@ -1765,7 +1765,7 @@ } /*============================================================================= - * AsciiSPrint (sub_2C3C at 0x2C3C) - from BasePrintLib + * AsciiSPrint at 0x2C3C - from BasePrintLib * * Full vsnprintf implementation, ~3573 bytes code. * Supports %s, %S, %a, %c, %d, %i, %x, %X, %p, %r, %g, %G @@ -1782,4 +1782,4 @@ /*============================================================================= * End of StatusCodeDxe.c - *============================================================================*/ \ No newline at end of file + *============================================================================*/ diff --git a/AmiModulePkg/AtaPassThru/AtaPassThru/AtaPassThru.c b/AmiModulePkg/AtaPassThru/AtaPassThru/AtaPassThru.c index 23714f1..221a6d1 100644 --- a/AmiModulePkg/AtaPassThru/AtaPassThru/AtaPassThru.c +++ b/AmiModulePkg/AtaPassThru/AtaPassThru/AtaPassThru.c @@ -47,7 +47,7 @@ STATIC VOID *AtaPassThruGetDebugProtocol (VOID); //============================================================================= -// _ModuleEntryPoint (0x370) +// ModuleEntryPoint //============================================================================= EFI_STATUS @@ -94,7 +94,7 @@ } //============================================================================= -// AtaPassThruInit (sub_41C, 0x41C) +// AtaPassThruInit //============================================================================= EFI_STATUS @@ -144,7 +144,7 @@ } //============================================================================= -// AtaPassThruDriverBindingStart (sub_4FC, 0x4FC) +// AtaPassThruDriverBindingStart //============================================================================= EFI_STATUS @@ -227,7 +227,7 @@ } //============================================================================= -// AtaPassThruDriverBindingStop (sub_730, 0x730) +// AtaPassThruDriverBindingStop //============================================================================= EFI_STATUS @@ -256,7 +256,7 @@ } //============================================================================= -// AtaPassThruFindDevice (sub_79C, 0x79C) +// AtaPassThruFindDevice //============================================================================= UINT64 @@ -280,7 +280,7 @@ } //============================================================================= -// AtaPassThruEnumeratePorts (sub_7D4, 0x7D4) +// AtaPassThruEnumeratePorts //============================================================================= UINT16 @@ -320,7 +320,7 @@ } //============================================================================= -// AtaPassThruReadDeviceStatus (sub_854, 0x854) +// AtaPassThruReadDeviceStatus //============================================================================= UINT8 @@ -370,7 +370,7 @@ } //============================================================================= -// AtaPassThruSendCommand (sub_960, 0x960) +// AtaPassThruSendCommand //============================================================================= EFI_STATUS @@ -581,7 +581,7 @@ } //============================================================================= -// AtaPassThruGetNextPort (sub_D88, 0xD88) +// AtaPassThruGetNextPort //============================================================================= EFI_STATUS @@ -624,7 +624,7 @@ } //============================================================================= -// AtaPassThruGetNextDevice (sub_E5C, 0xE5C) +// AtaPassThruGetNextDevice //============================================================================= EFI_STATUS @@ -671,7 +671,7 @@ } //============================================================================= -// AtaPassThruBuildDevicePath (sub_F88, 0xF88) +// AtaPassThruBuildDevicePath //============================================================================= EFI_STATUS @@ -722,7 +722,7 @@ } //============================================================================= -// AtaPassThruGetDeviceFromPath (sub_10A0, 0x10A0) +// AtaPassThruGetDeviceFromPath //============================================================================= EFI_STATUS @@ -761,7 +761,7 @@ } //============================================================================= -// AtaPassThruResetPort (sub_1128, 0x1128) +// AtaPassThruResetPort //============================================================================= EFI_STATUS @@ -783,7 +783,7 @@ } //============================================================================= -// AtaPassThruResetDevice (sub_1188, 0x1188) +// AtaPassThruResetDevice //============================================================================= EFI_STATUS @@ -806,7 +806,7 @@ } //============================================================================= -// AtaPassThruReportAssert (sub_12A8, 0x12A8) +// AtaPassThruReportAssert //============================================================================= VOID @@ -824,7 +824,7 @@ } //============================================================================= -// AtaPassThruGetDebugProtocol (sub_11E0, 0x11E0) +// AtaPassThruGetDebugProtocol //============================================================================= STATIC VOID * @@ -846,7 +846,7 @@ } //============================================================================= -// AtaPassThruGetHobList (sub_12E8, 0x12E8) +// AtaPassThruGetHobList //============================================================================= EFI_HOB_HANDOFF_INFO_TABLE * @@ -883,7 +883,7 @@ } //============================================================================= -// AtaPassThruReadDebugCmos (sub_13C0, 0x13C0) +// AtaPassThruReadDebugCmos //============================================================================= UINT32 @@ -913,7 +913,7 @@ } //============================================================================= -// AtaPassThruCompareHobGuid (sub_1410, 0x1410) +// AtaPassThruCompareHobGuid //============================================================================= BOOLEAN @@ -927,7 +927,7 @@ } //============================================================================= -// AtaPassThruReadUnaligned64 (sub_1480, 0x1480) +// AtaPassThruReadUnaligned64 //============================================================================= UINT64 @@ -944,11 +944,11 @@ } //============================================================================= -// CpuidWrapper (sub_14B0, 0x14B0) +// AtaPassThruCpuid //============================================================================= UINT32 -CpuidWrapper ( +AtaPassThruCpuid ( UINT32 Function, UINT32 *Eax OPTIONAL, UINT32 *Ebx OPTIONAL, @@ -968,11 +968,11 @@ } //============================================================================= -// Memset32Pattern (sub_14F0, 0x14F0) +// AtaPassThruSetMem32Pattern //============================================================================= VOID * -Memset32Pattern ( +AtaPassThruSetMem32Pattern ( VOID *Buffer, INT32 Value, UINTN Count @@ -1017,11 +1017,11 @@ } //============================================================================= -// InternalMemcpy (sub_1550, 0x1550) - overlapping-safe memmove +// AtaPassThruCopyMemOverlap - overlapping-safe memmove //============================================================================= VOID * -InternalMemcpy ( +AtaPassThruCopyMemOverlap ( VOID *Destination, CONST VOID *Source, UINTN Count @@ -1089,4 +1089,4 @@ //============================================================================= // END AtaPassThru.c -//============================================================================= \ No newline at end of file +//============================================================================= diff --git a/AmiModulePkg/AtaPassThru/AtaPassThru/AtaPassThru.h b/AmiModulePkg/AtaPassThru/AtaPassThru/AtaPassThru.h index b9f8a84..492e34a 100644 --- a/AmiModulePkg/AtaPassThru/AtaPassThru/AtaPassThru.h +++ b/AmiModulePkg/AtaPassThru/AtaPassThru/AtaPassThru.h @@ -9,722 +9,28 @@ #include "../uefi_headers/Uefi.h" -// -// Function Prototypes -// +EFI_STATUS EFIAPI ModuleEntryPoint(VOID); +EFI_STATUS EFIAPI AtaPassThruInit(VOID); +EFI_STATUS EFIAPI AtaPassThruDriverBindingStart(VOID); +EFI_STATUS EFIAPI AtaPassThruDriverBindingStop(VOID); +EFI_STATUS EFIAPI AtaPassThruFindDevice(VOID); +EFI_STATUS EFIAPI AtaPassThruEnumeratePorts(VOID); +EFI_STATUS EFIAPI AtaPassThruReadDeviceStatus(VOID); +EFI_STATUS EFIAPI AtaPassThruSendCommand(VOID); +EFI_STATUS EFIAPI AtaPassThruGetNextPort(VOID); +EFI_STATUS EFIAPI AtaPassThruGetNextDevice(VOID); +EFI_STATUS EFIAPI AtaPassThruBuildDevicePath(VOID); +EFI_STATUS EFIAPI AtaPassThruGetDeviceFromPath(VOID); +EFI_STATUS EFIAPI AtaPassThruResetPort(VOID); +EFI_STATUS EFIAPI AtaPassThruResetDevice(VOID); +EFI_STATUS EFIAPI AtaPassThruReportAssert(VOID); +EFI_STATUS EFIAPI AtaPassThruGetDebugProtocol(VOID); +EFI_STATUS EFIAPI AtaPassThruGetHobList(VOID); +EFI_STATUS EFIAPI AtaPassThruReadDebugCmos(VOID); +EFI_STATUS EFIAPI AtaPassThruCompareHobGuid(VOID); +EFI_STATUS EFIAPI AtaPassThruReadUnaligned64(VOID); +EFI_STATUS EFIAPI AtaPassThruCpuid(VOID); +EFI_STATUS EFIAPI AtaPassThruSetMem32Pattern(VOID); +EFI_STATUS EFIAPI AtaPassThruCopyMemOverlap(VOID); -EFI_STATUS -EFIAPI -ModuleEntryPoint( - VOID -); - -EFI_STATUS -EFIAPI -AtaPassThruInit( - VOID -); - -EFI_STATUS -EFIAPI -AtaPassThruDriverBindingStart( - VOID -); - -EFI_STATUS -EFIAPI -AtaPassThruDriverBindingStop( - VOID -); - -EFI_STATUS -EFIAPI -AtaPassThruFindDevice( - VOID -); - -EFI_STATUS -EFIAPI -AtaPassThruEnumeratePorts( - VOID -); - -EFI_STATUS -EFIAPI -AtaPassThruReadDeviceStatus( - VOID -); - -EFI_STATUS -EFIAPI -AtaPassThruSendCommand( - VOID -); - -EFI_STATUS -EFIAPI -AtaPassThruGetNextPort( - VOID -); - -EFI_STATUS -EFIAPI -AtaPassThruGetNextDevice( - VOID -); - -EFI_STATUS -EFIAPI -AtaPassThruBuildDevicePath( - VOID -); - -EFI_STATUS -EFIAPI -AtaPassThruGetDeviceFromPath( - VOID -); - -EFI_STATUS -EFIAPI -AtaPassThruResetPort( - VOID -); - -EFI_STATUS -EFIAPI -AtaPassThruResetDevice( - VOID -); - -EFI_STATUS -EFIAPI -AtaPassThruReportAssert( - VOID -); - -EFI_STATUS -EFIAPI -AtaPassThruReadDebugCmos( - VOID -); - -EFI_STATUS -EFIAPI -AtaPassThruCompareHobGuid( - VOID -); - -EFI_STATUS -EFIAPI -AtaPassThruReadUnaligned64( - VOID -); - -EFI_STATUS -EFIAPI -CpuidWrapper( - VOID -); - -EFI_STATUS -EFIAPI -generated decompilation for AtaPassThru.efi( - VOID -); - -EFI_STATUS -EFIAPI -AMI UEFI BIOS ATA Pass Thru Protocol driver( - VOID -); - -EFI_STATUS -EFIAPI -driver implements the UEFI EFI_ATA_PASS_THRU_PROTOCOL on ATA/SATA( - VOID -); - -EFI_STATUS -EFIAPI -detected by the SATA controller driver (SataController.efi).( - VOID -); - -EFI_STATUS -EFIAPI -provides register-level ATA command passthrough to upper-layer drivers( - VOID -); - -EFI_STATUS -EFIAPI -AtaBusDxe.( - VOID -); - -EFI_STATUS -EFIAPI -State( - VOID -); - -EFI_STATUS -EFIAPI -//=============================================================================( - VOID -); - -EFI_STATUS -EFIAPI -declarations of internal helpers( - VOID -); - -EFI_STATUS -EFIAPI -(0x370)( - VOID -); - -EFI_STATUS -EFIAPI -(sub_41C, 0x41C)( - VOID -); - -EFI_STATUS -EFIAPI -16-byte private registration protocol structure( - VOID -); - -EFI_STATUS -EFIAPI -0 = Initialize callback (AtaPassThruDriverBindingStart)( - VOID -); - -EFI_STATUS -EFIAPI -1 = Unload callback (AtaPassThruDriverBindingStop)( - VOID -); - -EFI_STATUS -EFIAPI -(sub_4FC, 0x4FC)( - VOID -); - -EFI_STATUS -EFIAPI -Ctl->Reserved = 0; // Attributes( - VOID -); - -EFI_STATUS -EFIAPI -port/device context tracking( - VOID -); - -EFI_STATUS -EFIAPI -+228 = current port, +230 = current device( - VOID -); - -EFI_STATUS -EFIAPI -(sub_730, 0x730)( - VOID -); - -EFI_STATUS -EFIAPI -(sub_79C, 0x79C)( - VOID -); - -EFI_STATUS -EFIAPI -(sub_7D4, 0x7D4)( - VOID -); - -EFI_STATUS -EFIAPI -child handle linked list at controller protocol + 88( - VOID -); - -EFI_STATUS -EFIAPI -child type == 4 (ATA channel) at offset -909( - VOID -); - -EFI_STATUS -EFIAPI -(sub_854, 0x854)( - VOID -); - -EFI_STATUS -EFIAPI -/ AltStatus( - VOID -); - -EFI_STATUS -EFIAPI -StatusBuffer[12] = *(UINT8 *)(DevInfoBase + 76); // DeviceControl( - VOID -); - -EFI_STATUS -EFIAPI -StatusBuffer[8] = *(UINT8 *)(DevInfoBase + 72); // LbaHigh( - VOID -); - -EFI_STATUS -EFIAPI -StatusBuffer[9] = *(UINT8 *)(DevInfoBase + 73); // (unused)( - VOID -); - -EFI_STATUS -EFIAPI -StatusBuffer[10] = *(UINT8 *)(DevInfoBase + 74); // (unused)( - VOID -); - -EFI_STATUS -EFIAPI -/ Error( - VOID -); - -EFI_STATUS -EFIAPI -(sub_960, 0x960)( - VOID -); - -EFI_STATUS -EFIAPI -buffer alignment( - VOID -); - -EFI_STATUS -EFIAPI -child device for non-blocking mode( - VOID -); - -EFI_STATUS -EFIAPI -4K sector (IDENTIFY word 247)( - VOID -); - -EFI_STATUS -EFIAPI -transfer lengths from bytes to blocks( - VOID -); - -EFI_STATUS -EFIAPI -transfer: 256 sectors, or 65536 for 48-bit LBA( - VOID -); - -EFI_STATUS -EFIAPI -ACB from Asb register block( - VOID -); - -EFI_STATUS -EFIAPI -layout used by this driver:( - VOID -); - -EFI_STATUS -EFIAPI -Acb[5] = Asb[5]; // SectorCount( - VOID -); - -EFI_STATUS -EFIAPI -Acb[7] = Asb[7]; // CylinderLow( - VOID -); - -EFI_STATUS -EFIAPI -Acb[12] = Asb[2]; // SectorCountExp from Asb[2]( - VOID -); - -EFI_STATUS -EFIAPI -// Timeout conversion (100ns -> 1ms)( - VOID -); - -EFI_STATUS -EFIAPI -register block construction( - VOID -); - -EFI_STATUS -EFIAPI -48-bit LBA commands by checking Asb[2]( - VOID -); - -EFI_STATUS -EFIAPI -register command (48-bit LBA)( - VOID -); - -EFI_STATUS -EFIAPI -bit( - VOID -); - -EFI_STATUS -EFIAPI -by protocol type (command register [48])( - VOID -); - -EFI_STATUS -EFIAPI -pointer table at DeviceInterface:( - VOID -); - -EFI_STATUS -EFIAPI -Non-Data( - VOID -); - -EFI_STATUS -EFIAPI -Software Reset( - VOID -); - -EFI_STATUS -EFIAPI -PIO Data-Out( - VOID -); - -EFI_STATUS -EFIAPI -PIO Data-In( - VOID -); - -EFI_STATUS -EFIAPI -PIO Data-Out (alternate)( - VOID -); - -EFI_STATUS -EFIAPI -IDENTIFY( - VOID -); - -EFI_STATUS -EFIAPI -Packet / FPDMA( - VOID -); - -EFI_STATUS -EFIAPI -Non-Data (alt path - Set Features)( - VOID -); - -EFI_STATUS -EFIAPI -Read Status( - VOID -); - -EFI_STATUS -EFIAPI -DMA (alt path)( - VOID -); - -EFI_STATUS -EFIAPI -Device Reset (read status to clear)( - VOID -); - -EFI_STATUS -EFIAPI -register status after command( - VOID -); - -EFI_STATUS -EFIAPI -(sub_D88, 0xD88)( - VOID -); - -EFI_STATUS -EFIAPI -(sub_E5C, 0xE5C)( - VOID -); - -EFI_STATUS -EFIAPI -of device list( - VOID -); - -EFI_STATUS -EFIAPI -for device matching port with higher port multiplier( - VOID -); - -EFI_STATUS -EFIAPI -(sub_F88, 0xF88)( - VOID -); - -EFI_STATUS -EFIAPI -IDENTIFY data descriptor list (device + 856)( - VOID -); - -EFI_STATUS -EFIAPI -ATA target descriptor: copy type+length( - VOID -); - -EFI_STATUS -EFIAPI -with port/multiplier info( - VOID -); - -EFI_STATUS -EFIAPI -(sub_10A0, 0x10A0)( - VOID -); - -EFI_STATUS -EFIAPI -channels use ATAPI device path (type=3, submode=18, length=10)( - VOID -); - -EFI_STATUS -EFIAPI -(sub_1128, 0x1128)( - VOID -); - -EFI_STATUS -EFIAPI -device vtable + 200 (25*8) with NonData reset signature( - VOID -); - -EFI_STATUS -EFIAPI -(sub_1188, 0x1188)( - VOID -); - -EFI_STATUS -EFIAPI -(sub_12A8, 0x12A8)( - VOID -); - -EFI_STATUS -EFIAPI -(sub_11E0, 0x11E0)( - VOID -); - -EFI_STATUS -EFIAPI -TPL: GetTimerValue(31), if > 0x10 return NULL( - VOID -); - -EFI_STATUS -EFIAPI -pattern is AMI-specific for lazy debug protocol init( - VOID -); - -EFI_STATUS -EFIAPI -(sub_12E8, 0x12E8)( - VOID -); - -EFI_STATUS -EFIAPI -(sub_13C0, 0x13C0)( - VOID -); - -EFI_STATUS -EFIAPI -NMI, select reg 0x4B( - VOID -); - -EFI_STATUS -EFIAPI -platform config from fixed address( - VOID -); - -EFI_STATUS -EFIAPI -debug level (1 or 2+)( - VOID -); - -EFI_STATUS -EFIAPI -debug level mask( - VOID -); - -EFI_STATUS -EFIAPI -1 -> 0x80000004 (EFI_D_ERROR in AMI convention)( - VOID -); - -EFI_STATUS -EFIAPI -2+ -> 0x80000006 (EFI_D_INFO | EFI_D_ERROR in AMI convention)( - VOID -); - -EFI_STATUS -EFIAPI -(sub_1410, 0x1410)( - VOID -); - -EFI_STATUS -EFIAPI -(sub_1480, 0x1480)( - VOID -); - -EFI_STATUS -EFIAPI -(sub_14B0, 0x14B0)( - VOID -); - -EFI_STATUS -EFIAPI -(sub_14F0, 0x14F0)( - VOID -); - -EFI_STATUS -EFIAPI -32-bit repeating pattern from low 16 bits( - VOID -); - -EFI_STATUS -EFIAPI -unaligned head( - VOID -); - -EFI_STATUS -EFIAPI -aligned portion with 32-bit pattern( - VOID -); - -EFI_STATUS -EFIAPI -bytes( - VOID -); - -EFI_STATUS -EFIAPI -(sub_1550, 0x1550) - overlapping-safe memmove( - VOID -); - -EFI_STATUS -EFIAPI -backward overlap: src < dst and src+count > dst( - VOID -); - -EFI_STATUS -EFIAPI -path for aligned >= 8 byte copy( - VOID -); - -EFI_STATUS -EFIAPI -source/dest alignment for head( - VOID -); - -EFI_STATUS -EFIAPI -copy alignment fixup( - VOID -); - -EFI_STATUS -EFIAPI -8-byte chunks( - VOID -); - -EFI_STATUS -EFIAPI -AtaPassThru.c( - VOID -); - -#endif /* __ATAPASSTHRU_H__ */ \ No newline at end of file +#endif /* __ATAPASSTHRU_H__ */ diff --git a/AmiModulePkg/CSM/Aint13/Aint13.c b/AmiModulePkg/CSM/Aint13/Aint13.c index 07c16a8..5e76fa3 100644 --- a/AmiModulePkg/CSM/Aint13/Aint13.c +++ b/AmiModulePkg/CSM/Aint13/Aint13.c @@ -35,7 +35,7 @@ STATIC BOOLEAN mAint13InitDone = FALSE; STATIC UINT8 mAint13DiskCount = 0; STATIC UINT8 mAint13DriveIdMap[24] = { 0 }; // 8 entries x 3 bytes -STATIC AINT13_INIT_FUNCTION mAint13ProtocolThunk = sub_624; +STATIC AINT13_INIT_FUNCTION mAint13ProtocolThunk = Aint13ProtocolThunkEntry; STATIC UINT64 mInt13VectorTableBase = 0; STATIC VOID *mPciIoCached = NULL; STATIC UINT32 mPciMmrAddress = 0; @@ -57,10 +57,10 @@ // Recovered helper signatures (reconstruction). // // Subsystem split note: -// - AInt13Csp.c hosts the chipset-specific INT13h register programming path (sub_1634). +// - AInt13Csp.c hosts the chipset-specific INT13h register programming path. // - This file contains entry-point wiring and shared INT13h scaffolding helpers. EFI_STATUS EFIAPI -sub_18BC( +Aint13DebugAssert( IN CHAR8 *FileName, IN UINTN LineNumber, IN CHAR8 *Description @@ -70,7 +70,7 @@ } EFI_STATUS EFIAPI -sub_18FC( +Aint13InitializeModuleState( VOID ) { @@ -78,7 +78,7 @@ } EFI_STATUS EFIAPI -sub_10CC( +Aint13HandlePciIo( IN VOID *PciIo ) { @@ -86,7 +86,7 @@ } EFI_STATUS EFIAPI -sub_E88( +Aint13InstallDiskInfo( IN VOID *DiskInfo ) { @@ -94,7 +94,7 @@ } EFI_STATUS EFIAPI -sub_624( +Aint13ProtocolThunkEntry( VOID ) { @@ -102,7 +102,7 @@ } EFI_STATUS EFIAPI -sub_1634( +Aint13ChipsetInt13RegisterThunk( VOID ) { @@ -110,7 +110,7 @@ } EFI_STATUS EFIAPI -sub_BD4( +Aint13BuildDriveIdentity( IN UINT8 *DeviceId, IN UINT8 Channel, IN VOID *AtaIdentify, @@ -122,7 +122,7 @@ } EFI_STATUS EFIAPI -sub_A50( +Aint13ComputeDriveGeometryFromIdentify( IN UINT8 *IdentifyData, OUT VOID *GeometryOut ) @@ -131,7 +131,7 @@ } EFI_STATUS EFIAPI -sub_86C( +Aint13ComputeChsGeometryFromMbr( IN UINT8 *MbRBuffer, IN UINTN BufferSize, OUT VOID *ChsOut @@ -141,7 +141,7 @@ } EFI_STATUS EFIAPI -sub_794( +Aint13ComputeGeometryFromLba( IN UINT64 LbaSectors, OUT VOID *GeometryOut ) @@ -150,7 +150,7 @@ } EFI_STATUS EFIAPI -sub_17F4( +Aint13RefreshBbsTable( VOID ) { @@ -158,7 +158,7 @@ } VOID EFIAPI -sub_1874( +Aint13DebugPrint( IN CHAR8 *Format, ... ) @@ -167,7 +167,7 @@ } UINT32 EFIAPI -sub_19D4( +Aint13GetBbsBootPriority( VOID ) { @@ -175,7 +175,7 @@ } BOOLEAN EFIAPI -sub_1A24( +Aint13CompareGuid( IN CONST EFI_GUID *Left, IN CONST EFI_GUID *Right ) @@ -198,7 +198,7 @@ } UINT64 EFIAPI -sub_1A94( +Aint13ReadUnaligned64( IN VOID *Address ) { @@ -206,7 +206,7 @@ } EFI_STATUS EFIAPI -sub_52C( +Aint13TimerNotify( IN EFI_EVENT Event, IN VOID *Context ) @@ -217,7 +217,7 @@ } EFI_STATUS EFIAPI -sub_480( +Aint13EnumeratePciIoList( IN VOID *PciIoList ) { @@ -239,32 +239,32 @@ mImageHandle = ImageHandle; if (!mImageHandle) { - sub_18BC("e:\\hs\\MdePkg\\Library\\UefiBootServicesTableLib\\UefiBootServicesTableLib.c", 51, "gImageHandle != ((void *) 0)"); + Aint13DebugAssert("e:\\hs\\MdePkg\\Library\\UefiBootServicesTableLib\\UefiBootServicesTableLib.c", 51, "gImageHandle != ((void *) 0)"); } mSystemTable = SystemTable; if (!mSystemTable) { - sub_18BC("e:\\hs\\MdePkg\\Library\\UefiBootServicesTableLib\\UefiBootServicesTableLib.c", 57, "gST != ((void *) 0)"); + Aint13DebugAssert("e:\\hs\\MdePkg\\Library\\UefiBootServicesTableLib\\UefiBootServicesTableLib.c", 57, "gST != ((void *) 0)"); } mBootServices = mSystemTable->BootServices; if (!mBootServices) { - sub_18BC("e:\\hs\\MdePkg\\Library\\UefiBootServicesTableLib\\UefiBootServicesTableLib.c", 63, "gBS != ((void *) 0)"); + Aint13DebugAssert("e:\\hs\\MdePkg\\Library\\UefiBootServicesTableLib\\UefiBootServicesTableLib.c", 63, "gBS != ((void *) 0)"); } mRuntimeServices = mSystemTable->RuntimeServices; if (!mRuntimeServices) { - sub_18BC("e:\\hs\\MdePkg\\Library\\UefiRuntimeServicesTableLib\\UefiRuntimeServicesTableLib.c", 47, "gRT != ((void *) 0)"); + Aint13DebugAssert("e:\\hs\\MdePkg\\Library\\UefiRuntimeServicesTableLib\\UefiRuntimeServicesTableLib.c", 47, "gRT != ((void *) 0)"); } - sub_18FC(); + Aint13InitializeModuleState(); ImageHandle_1 = ImageHandle; BootServices = mBootServices; RuntimeServices = mRuntimeServices; (VOID)BootServices; (VOID)RuntimeServices; - mAint13ProtocolThunk = sub_624; + mAint13ProtocolThunk = Aint13ProtocolThunkEntry; Status = ((EFI_STATUS (*)(EFI_HANDLE *, VOID *, UINT32, VOID *)) mBootServices->InstallProtocolInterface)( diff --git a/AmiModulePkg/CSM/Aint13/Aint13.h b/AmiModulePkg/CSM/Aint13/Aint13.h index c0ca967..2639322 100644 --- a/AmiModulePkg/CSM/Aint13/Aint13.h +++ b/AmiModulePkg/CSM/Aint13/Aint13.h @@ -34,18 +34,18 @@ // // Module split: // - Aint13.c: module entry, generic discovery, timer glue, and shared helpers. -// - AInt13Csp.c: chipset-specific INT13h register programming (sub_1634). +// - AInt13Csp.c: chipset-specific INT13h register programming. // EFI_STATUS EFIAPI -sub_1634( +Aint13ChipsetInt13RegisterThunk( VOID ); EFI_STATUS EFIAPI -sub_18BC( +Aint13DebugAssert( IN CHAR8 *FileName, IN UINTN LineNumber, IN CHAR8 *Description @@ -53,31 +53,31 @@ EFI_STATUS EFIAPI -sub_18FC( +Aint13InitializeModuleState( VOID ); EFI_STATUS EFIAPI -sub_624( +Aint13ProtocolThunkEntry( VOID ); EFI_STATUS EFIAPI -sub_10CC( +Aint13HandlePciIo( IN VOID *PciIo ); EFI_STATUS EFIAPI -sub_E88( +Aint13InstallDiskInfo( IN VOID *DiskInfo ); EFI_STATUS EFIAPI -sub_BD4( +Aint13BuildDriveIdentity( IN UINT8 *DeviceId, IN UINT8 Channel, IN VOID *AtaIdentify, @@ -87,14 +87,14 @@ EFI_STATUS EFIAPI -sub_A50( +Aint13ComputeDriveGeometryFromIdentify( IN UINT8 *IdentifyData, OUT VOID *GeometryOut ); EFI_STATUS EFIAPI -sub_86C( +Aint13ComputeChsGeometryFromMbr( IN UINT8 *MbRBuffer, IN UINTN BufferSize, OUT VOID *ChsOut @@ -102,53 +102,53 @@ EFI_STATUS EFIAPI -sub_794( +Aint13ComputeGeometryFromLba( IN UINT64 LbaSectors, OUT VOID *GeometryOut ); EFI_STATUS EFIAPI -sub_17F4( +Aint13RefreshBbsTable( VOID ); VOID EFIAPI -sub_1874( +Aint13DebugPrint( IN CHAR8 *Format, ... ); UINT32 EFIAPI -sub_19D4( +Aint13GetBbsBootPriority( VOID ); BOOLEAN EFIAPI -sub_1A24( +Aint13CompareGuid( IN CONST EFI_GUID *Left, IN CONST EFI_GUID *Right ); UINT64 EFIAPI -sub_1A94( +Aint13ReadUnaligned64( IN VOID *Address ); EFI_STATUS EFIAPI -sub_52C( +Aint13TimerNotify( IN EFI_EVENT Event, IN VOID *Context ); EFI_STATUS EFIAPI -sub_480( +Aint13EnumeratePciIoList( IN VOID *PciIoList ); diff --git a/AmiModulePkg/CSM/CsmDxe/CsmDxe.c b/AmiModulePkg/CSM/CsmDxe/CsmDxe.c index 0f6d467..f2d7af1 100644 --- a/AmiModulePkg/CSM/CsmDxe/CsmDxe.c +++ b/AmiModulePkg/CSM/CsmDxe/CsmDxe.c @@ -96,20 +96,8 @@ // CpRcPkg/Library/DxeMmPciBaseLib // AmiCRBPkg/Library/AmiPcieSegBusLib // -// sub_B638 = DebugPrint (EfiDLevel, Format, ...) -// sub_B680 = Assert (FileName, Line, Expression) -// sub_B6C0 = LibPcdGetPtr (or LibPcdGetSize) -// sub_B74C = DxeServicesTableLib constructor -// sub_B588 = ReadTimeStampCounter (via __rdtsc) -// sub_B8FC = MmPciBaseLib constructor -// sub_B980 = PcdGetPtr (by token number) -// sub_BA94 = DebugClearMemory / gBS->SetMem -// sub_D71C = MmioWrite32 (or similar) -// sub_D7B0 = PcieSegBusTableInit -// sub_CA38 = gBS->InstallMultipleProtocolInterfaces -// sub_CD38 = DriverBinding / handle protocol uninstalls -// sub_CFB4 = gBS->LocateProtocol for AMI_BOARD_INFO2_PROTOCOL -// sub_D03C = gBS->LocateHandleBuffer +// DebugPrint, Assert, PCD access, library constructors, MMIO, and protocol +// helper routines are linked in from the corresponding UEFI/AMI libraries. /*============================================================================ * Inline Helpers (compiler intrinsics / simple wrappers) @@ -176,7 +164,7 @@ } /*============================================================================ - * sub_330 - Internal Memmove (copies count bytes, handles overlap) + * CsmMemMove - Internal Memmove (copies count bytes, handles overlap) *============================================================================*/ static char * @@ -207,7 +195,7 @@ } /*============================================================================ - * sub_380 - Internal Memset (zero-fills buffer) + * CsmMemSet - Internal Memset (zero-fills buffer) *============================================================================*/ static char * @@ -222,7 +210,7 @@ } /*============================================================================ - * sub_FA0 - Thunk wrapper for CSM16 16-bit entry calls + * CsmThunk16Entry - Thunk wrapper for CSM16 16-bit entry calls *============================================================================*/ __declspec(naked) static @@ -1483,7 +1471,7 @@ } /** - * CsmDebugPrint (sub_B638) - Low-level debug message output + * CsmDebugPrint - Low-level debug message output * Level = debug message level * Format = format string * ... @@ -1508,7 +1496,7 @@ } /** - * CsmAssert (sub_B680) - Assertion failure handler + * CsmAssert - Assertion failure handler */ VOID CsmAssert ( @@ -1524,10 +1512,10 @@ } /** - * nullsub_1 (0xBBA8) - Null subroutine (no-op) + * CsmNoOp - Null subroutine (no-op) */ VOID -nullsub_1 ( +CsmNoOp ( VOID ) { @@ -1544,4 +1532,4 @@ /*============================================================================ * End of CsmDxe.c - *============================================================================*/ \ No newline at end of file + *============================================================================*/ diff --git a/AmiModulePkg/CSM/CsmDxe/CsmDxe.h b/AmiModulePkg/CSM/CsmDxe/CsmDxe.h index cc1c477..3c6a362 100644 --- a/AmiModulePkg/CSM/CsmDxe/CsmDxe.h +++ b/AmiModulePkg/CSM/CsmDxe/CsmDxe.h @@ -9,1022 +9,174 @@ #include "../uefi_headers/Uefi.h" -// -// Function Prototypes -// - EFI_STATUS EFIAPI -CsmDxeConstructor( +CsmDxeConstructor ( VOID -); + ); EFI_STATUS EFIAPI -CsmDxeDriverEntryPoint( - VOID -); +CsmDxeDriverEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ); EFI_STATUS EFIAPI -CsmDxeUnload( - VOID -); +CsmDxeUnload ( + IN EFI_HANDLE ImageHandle + ); -EFI_STATUS +VOID EFIAPI -_mm_pause_w( - VOID -); +CsmMemMove ( + CHAR8 *Dst, + CONST CHAR8 *Src, + UINT64 Count + ); -EFI_STATUS +VOID EFIAPI -__rdtsc_w( - VOID -); +CsmMemSet ( + CHAR8 *Buf, + UINT64 Size + ); -EFI_STATUS +UINT64 EFIAPI -_enable_w( - VOID -); +CsmThunk16Entry ( + INT32 CallNum, + INT32 Param2, + INT32 Param3, + UINT32 Param4, + UINT64 Param5 + ); EFI_STATUS EFIAPI -_disable_w( - VOID -); +CsmLegacyBiosInstallProtocol ( + IN EFI_HANDLE ImageHandle + ); EFI_STATUS EFIAPI -__getcallerseflags_w( +CsmLocateAmiBoardInfo2 ( VOID -); + ); EFI_STATUS EFIAPI -CsmThunk16Entry( - VOID -); +CsmAllConnectedCallback ( + IN EFI_EVENT Event, + IN VOID *Context + ); EFI_STATUS EFIAPI -ModuleEntryPoint( +CsmInstallProtocolNotifications ( VOID -); + ); EFI_STATUS EFIAPI -CsmLegacyBiosInstallProtocol( +CsmShadowAllLegacyOproms ( VOID -); + ); EFI_STATUS EFIAPI -CsmRegisterBootEventCallbacks( +CsmInitializePciPlatform ( VOID -); + ); EFI_STATUS EFIAPI -CsmLocateAmiBoardInfo2( - VOID -); +CsmInitializeLegacyBios ( + IN OUT VOID *Csm16Mode, + IN VOID *SystemTable + ); EFI_STATUS EFIAPI -CsmAllConnectedCallback( +CsmLegacyBiosSetBdaComPort ( VOID -); + ); EFI_STATUS EFIAPI -CsmInstallProtocolNotifications( +CsmLegacyBiosBootUnconventionalDevice ( VOID -); + ); EFI_STATUS EFIAPI -CsmShadowAllLegacyOproms( +CsmLegacyBiosUpdateKeyboardLedStatus ( VOID -); + ); EFI_STATUS EFIAPI -CsmInitializePciPlatform( +CsmLegacyBiosPrepareToBootEfi ( VOID -); + ); EFI_STATUS EFIAPI -CsmInitializeLegacyBios( +CsmLegacyBiosShadowAllLegacyOproms ( VOID -); + ); EFI_STATUS EFIAPI -CsmLegacyBiosGetBbsInfo( +CsmLegacyBiosInstall ( VOID -); + ); EFI_STATUS EFIAPI -CsmLegacyBiosSetBdaComPort( +CsmLegacyBiosUninstall ( VOID -); + ); EFI_STATUS EFIAPI -CsmLegacyBiosBoot( +CsmLegacyBiosSetBdaBase ( VOID -); + ); EFI_STATUS EFIAPI -CsmLegacyBiosBootUnconventionalDevice( +CsmLegacyBiosGetBbsInfo_GetCount ( VOID -); + ); EFI_STATUS EFIAPI -CsmLegacyBiosUpdateKeyboardLedStatus( +CsmSaveBootScriptToLockBox ( VOID -); + ); EFI_STATUS EFIAPI -CsmLegacyBiosPrepareToBootEfi( - VOID -); +CsmDebugPrint ( + IN UINTN Level, + IN CONST CHAR8 *Format, + ... + ); -EFI_STATUS +VOID EFIAPI -CsmLegacyBiosShadowAllLegacyOproms( - VOID -); +CsmAssert ( + IN CONST CHAR8 *FileName, + IN UINTN LineNumber, + IN CONST CHAR8 *Description + ); -EFI_STATUS +VOID EFIAPI -CsmLegacyBiosInstall( +CsmNoOp ( VOID -); + ); -EFI_STATUS -EFIAPI -CsmLegacyBiosUninstall( - VOID -); - -EFI_STATUS -EFIAPI -CsmLegacyBiosSetBdaBase( - VOID -); - -EFI_STATUS -EFIAPI -CsmLegacyBiosGetBbsInfo_GetCount( - VOID -); - -EFI_STATUS -EFIAPI -CsmSaveBootScriptToLockBox( - VOID -); - -EFI_STATUS -EFIAPI -CsmDebugPrint( - VOID -); - -EFI_STATUS -EFIAPI -CsmAssert( - VOID -); - -EFI_STATUS -EFIAPI -nullsub_1( - VOID -); - -EFI_STATUS -EFIAPI -functions are library-internal wrappers linked from:( - VOID -); - -EFI_STATUS -EFIAPI -= DebugPrint (EfiDLevel, Format, ...)( - VOID -); - -EFI_STATUS -EFIAPI -= Assert (FileName, Line, Expression)( - VOID -); - -EFI_STATUS -EFIAPI -= LibPcdGetPtr (or LibPcdGetSize)( - VOID -); - -EFI_STATUS -EFIAPI -= DxeServicesTableLib constructor( - VOID -); - -EFI_STATUS -EFIAPI -= ReadTimeStampCounter (via __rdtsc)( - VOID -); - -EFI_STATUS -EFIAPI -= MmPciBaseLib constructor( - VOID -); - -EFI_STATUS -EFIAPI -= PcdGetPtr (by token number)( - VOID -); - -EFI_STATUS -EFIAPI -= DebugClearMemory / gBS->SetMem( - VOID -); - -EFI_STATUS -EFIAPI -= MmioWrite32 (or similar)( - VOID -); - -EFI_STATUS -EFIAPI -= PcieSegBusTableInit( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->InstallMultipleProtocolInterfaces( - VOID -); - -EFI_STATUS -EFIAPI -= DriverBinding / handle protocol uninstalls( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->LocateProtocol for AMI_BOARD_INFO2_PROTOCOL( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->LocateHandleBuffer( - VOID -); - -EFI_STATUS -EFIAPI -not shown - thunk to 16-bit code( - VOID -); - -EFI_STATUS -EFIAPI -is the "library constructor" pattern. The original source is( - VOID -); - -EFI_STATUS -EFIAPI -real work of the driver happens in CsmDxeDriverEntryPoint.( - VOID -); - -EFI_STATUS -EFIAPI -UEFI BootServicesTableLib constructor( - VOID -); - -EFI_STATUS -EFIAPI -= (EFI_HANDLE)qword_10BE0;( - VOID -); - -EFI_STATUS -EFIAPI -constructor( - VOID -); - -EFI_STATUS -EFIAPI -= DxeServicesTableLibConstructor (&ProtocolGuid, &gDS);( - VOID -); - -EFI_STATUS -EFIAPI -constructor - initialize PCI USRA protocol( - VOID -); - -EFI_STATUS -EFIAPI -(mPciUsra == NULL) {( - VOID -); - -EFI_STATUS -EFIAPI -the MMIO PCI Base library( - VOID -); - -EFI_STATUS -EFIAPI -();( - VOID -); - -EFI_STATUS -EFIAPI -PCD value and enable VGA legacy decoding if needed( - VOID -); - -EFI_STATUS -EFIAPI -= LibPcdGetPtr (Token5);( - VOID -); - -EFI_STATUS -EFIAPI -caller EFLAGS for interrupt state (IF bit = bit 9)( - VOID -); - -EFI_STATUS -EFIAPI -__getcallerseflags() intrinsic( - VOID -); - -EFI_STATUS -EFIAPI -= (UINT16)__getcallerseflags_w ();( - VOID -); - -EFI_STATUS -EFIAPI -= __rdtsc_w () & 0xFFFFFF;( - VOID -); - -EFI_STATUS -EFIAPI -interrupt state( - VOID -); - -EFI_STATUS -EFIAPI -(InterruptsEnabled) {( - VOID -); - -EFI_STATUS -EFIAPI -PCIe Segment Bus Table( - VOID -); - -EFI_STATUS -EFIAPI -= LibPcdGetSize (Token7);( - VOID -); - -EFI_STATUS -EFIAPI -protocol interfaces via AutoGen( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->InstallMultipleProtocolInterfaces (( - VOID -); - -EFI_STATUS -EFIAPI -to our EFI system table and boot/runtime services( - VOID -); - -EFI_STATUS -EFIAPI -(gST == NULL) {( - VOID -); - -EFI_STATUS -EFIAPI -protocol notify for EfiLegacyInterruptProtocol( - VOID -); - -EFI_STATUS -EFIAPI -SecureBoot variable( - VOID -); - -EFI_STATUS -EFIAPI -= '\0';( - VOID -); - -EFI_STATUS -EFIAPI -SecureBoot is enabled, clear the CSM "Setup" variable( - VOID -); - -EFI_STATUS -EFIAPI -= CSM16_CONFIG_SIZE;( - VOID -); - -EFI_STATUS -EFIAPI -the CSM "Setup" variable to determine whether CSM should be enabled( - VOID -); - -EFI_STATUS -EFIAPI -derived from byte_11DA2( - VOID -); - -EFI_STATUS -EFIAPI -the Legacy BIOS protocol interface( - VOID -); - -EFI_STATUS -EFIAPI -= CsmLegacyBiosInstallProtocol (ImageHandle);( - VOID -); - -EFI_STATUS -EFIAPI -boot event callbacks( - VOID -); - -EFI_STATUS -EFIAPI -= CsmRegisterBootEventCallbacks ();( - VOID -); - -EFI_STATUS -EFIAPI -AMI_BOARD_INFO2_PROTOCOL( - VOID -); - -EFI_STATUS -EFIAPI -(mBoardInfo2 == NULL) {( - VOID -); - -EFI_STATUS -EFIAPI -the main CSM context (6328 bytes)( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->AllocatePool (( - VOID -); - -EFI_STATUS -EFIAPI -required protocols for the context( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->LocateProtocol (( - VOID -); - -EFI_STATUS -EFIAPI -the Legacy BIOS function table( - VOID -); - -EFI_STATUS -EFIAPI -MaxOpRomAddress (must be 0xC0000-0xF0000)( - VOID -); - -EFI_STATUS -EFIAPI -= (*CsmCtx->PciIoProtocol->AllocateBuffer) (( - VOID -); - -EFI_STATUS -EFIAPI -PCI platform interface( - VOID -); - -EFI_STATUS -EFIAPI -= CsmInitializePciPlatform ();( - VOID -); - -EFI_STATUS -EFIAPI -current video mode( - VOID -); - -EFI_STATUS -EFIAPI -= (*CsmCtx->SmmLegacyBootProtocol->GetCurrentMode) (( - VOID -); - -EFI_STATUS -EFIAPI -VGA mode to text mode 80x25( - VOID -); - -EFI_STATUS -EFIAPI -= (UINT16)-1;( - VOID -); - -EFI_STATUS -EFIAPI -CSM mode from Setup variable( - VOID -); - -EFI_STATUS -EFIAPI -offset( - VOID -); - -EFI_STATUS -EFIAPI -the Legacy BIOS driver( - VOID -); - -EFI_STATUS -EFIAPI -= CsmInitializeLegacyBios (Csm16Mode, SystemTable);( - VOID -); - -EFI_STATUS -EFIAPI -VGA mode again after CSM16 init( - VOID -); - -EFI_STATUS -EFIAPI -= (*CsmCtx->SmmLegacyBootProtocol->SetMode) (( - VOID -); - -EFI_STATUS -EFIAPI -the PCI enumeration data( - VOID -); - -EFI_STATUS -EFIAPI -= (*CsmCtx->PciIoProtocol->GetLocation) (( - VOID -); - -EFI_STATUS -EFIAPI -the base OpROM address (0xC0000)( - VOID -); - -EFI_STATUS -EFIAPI -= 0xC0000;( - VOID -); - -EFI_STATUS -EFIAPI -PCI data table (1312 bytes)( - VOID -); - -EFI_STATUS -EFIAPI -for internal data structure( - VOID -); - -EFI_STATUS -EFIAPI -BBS table (1728 bytes)( - VOID -); - -EFI_STATUS -EFIAPI -to BBS data start( - VOID -); - -EFI_STATUS -EFIAPI -event notification for Legacy BIOS protocol( - VOID -); - -EFI_STATUS -EFIAPI -= (UINT64)CsmCtx;( - VOID -); - -EFI_STATUS -EFIAPI -notification for AllConnected (via EfiBootScriptNotify)( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->CreateEvent (( - VOID -); - -EFI_STATUS -EFIAPI -protocol notification( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->InstallProtocolInterface (( - VOID -); - -EFI_STATUS -EFIAPI -CSM internal protocol notifications( - VOID -); - -EFI_STATUS -EFIAPI -ShadowAll callback( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->RegisterProtocolNotify (( - VOID -); - -EFI_STATUS -EFIAPI -up callback function pointers( - VOID -); - -EFI_STATUS -EFIAPI -BoardInfo2 data( - VOID -); - -EFI_STATUS -EFIAPI -(((AMI_BOARD_INFO2_PROTOCOL *)Interface)->DataValid);( - VOID -); - -EFI_STATUS -EFIAPI -the "AllConnected" event( - VOID -); - -EFI_STATUS -EFIAPI -EFI_SUCCESS;( - VOID -); - -EFI_STATUS -EFIAPI -each legacy Option ROM( - VOID -); - -EFI_STATUS -EFIAPI -Option ROM images to 0xC0000-0xF0000 region]( - VOID -); - -EFI_STATUS -EFIAPI -PCI device data and Option ROM shadow region( - VOID -); - -EFI_STATUS -EFIAPI -= NULL;( - VOID -); - -EFI_STATUS -EFIAPI -PCI platform configuration( - VOID -); - -EFI_STATUS -EFIAPI -Status;( - VOID -); - -EFI_STATUS -EFIAPI -and initialize the Legacy BIOS interface( - VOID -); - -EFI_STATUS -EFIAPI -Legacy BIOS protocol( - VOID -); - -EFI_STATUS -EFIAPI -BBS table( - VOID -); - -EFI_STATUS -EFIAPI -legacy boot event handler( - VOID -); - -EFI_STATUS -EFIAPI -the INT19 trap handler (for legacy boot)( - VOID -); - -EFI_STATUS -EFIAPI -entry initialization( - VOID -); - -EFI_STATUS -EFIAPI -= CsmThunk16Entry (Csm16Mode, 0, 0, 0, 0);( - VOID -); - -EFI_STATUS -EFIAPI -from Csm16 BBS table( - VOID -); - -EFI_STATUS -EFIAPI -COM port address to BIOS Data Area (BDA)( - VOID -); - -EFI_STATUS -EFIAPI -at 0x400: COM port table at 0x400+0x00, LPT at 0x400+0x08( - VOID -); - -EFI_STATUS -EFIAPI -BBS table for boot device( - VOID -); - -EFI_STATUS -EFIAPI -INT 19h via CSM16 thunk( - VOID -); - -EFI_STATUS -EFIAPI -= CsmThunk16Entry (( - VOID -); - -EFI_STATUS -EFIAPI -boot from unconventional devices (USB, network, etc.)( - VOID -); - -EFI_STATUS -EFIAPI -each boot device type( - VOID -); - -EFI_STATUS -EFIAPI -keyboard LED status in BDA( - VOID -); - -EFI_STATUS -EFIAPI -offset 0x417 bit 5-3: keyboard LED flags( - VOID -); - -EFI_STATUS -EFIAPI -to boot EFI: save legacy state, restore EFI state( - VOID -); - -EFI_STATUS -EFIAPI -all discovered legacy Option ROMs( - VOID -); - -EFI_STATUS -EFIAPI -algorithm:( - VOID -); - -EFI_STATUS -EFIAPI -CLP (Configuration Load Protocol) support if needed( - VOID -); - -EFI_STATUS -EFIAPI -loop( - VOID -); - -EFI_STATUS -EFIAPI -(OpRomIndex = *NumberOfOpRoms; OpRomIndex < *TotalSize; OpRomIndex++) {( - VOID -); - -EFI_STATUS -EFIAPI -each ROM( - VOID -); - -EFI_STATUS -EFIAPI -Legacy BIOS protocol interfaces( - VOID -); - -EFI_STATUS -EFIAPI -base memory size in BDA at 0x413( - VOID -); - -EFI_STATUS -EFIAPI -BBS count and table from CSM context( - VOID -); - -EFI_STATUS -EFIAPI -memory map data to lockbox( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->GetMemoryMap (( - VOID -); - -EFI_STATUS -EFIAPI -code calls a specific DebugPrint implementation( - VOID -); - -EFI_STATUS -EFIAPI -writes to the serial port / console( - VOID -); - -EFI_STATUS -EFIAPI -(Level, Format, VaList);( - VOID -); - -EFI_STATUS -EFIAPI -code calls ASSERT via DebugLib( - VOID -); - -EFI_STATUS -EFIAPI -(Description);( - VOID -); - -EFI_STATUS -EFIAPI -driver registers a ComponentName2 protocol at gCsmComponentName2.( - VOID -); - -EFI_STATUS -EFIAPI -structures are generated by the UEFI driver framework.( - VOID -); - -#endif /* __CSMDXE_H__ */ \ No newline at end of file +#endif diff --git a/AmiModulePkg/CSM/CsmVideo/CsmVideo.c b/AmiModulePkg/CSM/CsmVideo/CsmVideo.c index e974e63..85507e3 100644 --- a/AmiModulePkg/CSM/CsmVideo/CsmVideo.c +++ b/AmiModulePkg/CSM/CsmVideo/CsmVideo.c @@ -7,7 +7,7 @@ VgaClass.c -- VGA text mode class (INT10 BIOS text services) Driver entry: - _ModuleEntryPoint (0x390) -> sub_3F64 (Get HOB list) -> CsmVideoDriverEntry (0x44C) + _ModuleEntryPoint (0x390) -> HobGetHobList (Get HOB list) -> CsmVideoDriverEntry (0x44C) Installs Legacy8259, LegacyBiosService, UGA protocols on ImageHandle Installs EDID_ACTIVE on child Handle Connects LegacyBiosPlatform protocol @@ -20,8 +20,8 @@ If legacy text: VgaClassConstructor -> install LegacyBios protocol GOP callbacks: - QueryMode -> sub_21AC - SetMode -> sub_24AC + QueryMode -> GraphicsOutputQueryMode + SetMode -> GraphicsOutputSetMode VGA class vtable (144 bytes, sig 0x434A5678 "VgJC"): Init(0x10), StringOutput(0x18), TestString(0x20), Clear(0x28), @@ -111,7 +111,7 @@ } // ======================================================================== -// sub_7A0 -- CsmVideoChildInit: initialize a VGA/display child +// CsmVideoChildInit: initialize a VGA/display child // ======================================================================== EFI_STATUS CsmVideoChildInit ( @@ -248,7 +248,7 @@ } // ======================================================================== -// sub_9EC -- CsmVideoModeSet: set display mode +// CsmVideoModeSet: set display mode // ======================================================================== EFI_STATUS CsmVideoModeSet ( @@ -370,7 +370,7 @@ } // ======================================================================== -// sub_CE0 -- CsmVideoInstanceCreate: create and initialize video instance +// CsmVideoInstanceCreate: create and initialize video instance // ======================================================================== EFI_STATUS CsmVideoInstanceCreate ( @@ -566,7 +566,7 @@ } // ======================================================================== -// sub_1080 -- CsmVideoDetectDevice: detect video controller and return instance +// CsmVideoDetectDevice: detect video controller and return instance // ======================================================================== EFI_STATUS CsmVideoDetectDevice ( @@ -632,7 +632,7 @@ } // ======================================================================== -// sub_1178 -- CsmVideoChildAddProtocol: install protocols on video child +// CsmVideoChildAddProtocol: install protocols on video child // ======================================================================== EFI_STATUS CsmVideoChildAddProtocol ( @@ -742,7 +742,7 @@ } // ======================================================================== -// sub_1300 -- CsmVideoFreeBuffers: free all resources +// CsmVideoFreeBuffers: free all resources // ======================================================================== VOID CsmVideoFreeBuffers ( @@ -823,7 +823,7 @@ } // ======================================================================== -// sub_145C -- EdidParseAndMerge: parse EDID block, extract timings +// EdidParseAndMerge: parse EDID block, extract timings // ======================================================================== VOID EdidParseAndMerge ( @@ -953,7 +953,7 @@ } // ======================================================================== -// sub_16A0 -- VesaGetControllerCapabilities: query VESA VBE BIOS +// VesaGetControllerCapabilities: query VESA VBE BIOS // ======================================================================== EFI_STATUS VesaGetControllerCapabilities ( @@ -1020,7 +1020,7 @@ } // ======================================================================== -// sub_17D8 -- VesaEnumerateModes: enumerate all VESA VBE modes +// VesaEnumerateModes: enumerate all VESA VBE modes // ======================================================================== EFI_STATUS VesaEnumerateModes ( @@ -1250,7 +1250,7 @@ } // ======================================================================== -// sub_21AC -- GraphicsOutputQueryMode: GOP QueryMode +// GraphicsOutputQueryMode: GOP QueryMode // ======================================================================== EFI_STATUS EFIAPI @@ -1325,7 +1325,7 @@ } // ======================================================================== -// sub_22D4 -- AllocateVideoBuffers: allocate scan line, text, and frame buffers +// AllocateVideoBuffers: allocate scan line, text, and frame buffers // ======================================================================== EFI_STATUS AllocateVideoBuffers ( @@ -1423,7 +1423,7 @@ } // ======================================================================== -// sub_24AC -- GraphicsOutputSetMode: GOP SetMode +// GraphicsOutputSetMode: GOP SetMode // ======================================================================== EFI_STATUS EFIAPI @@ -1532,7 +1532,7 @@ } // ======================================================================== -// sub_26DC -- GraphicsOutputSetModeWrapper: 10-param wrapper for GOP SetMode +// GraphicsOutputSetModeWrapper: 10-param wrapper for GOP SetMode // ======================================================================== EFI_STATUS GraphicsOutputSetModeWrapper ( @@ -1623,7 +1623,7 @@ } // ======================================================================== -// sub_2D84 -- VgaTextSetCursorPosition: set cursor via INT10 AH=02h +// VgaTextSetCursorPosition: set cursor via INT10 AH=02h // ======================================================================== EFI_STATUS VgaTextSetCursorPosition ( @@ -1670,7 +1670,7 @@ } // ======================================================================== -// sub_2E58 -- EdidOverrideUninstall: remove EDID override protocols +// EdidOverrideUninstall: remove EDID override protocols // ======================================================================== EFI_STATUS EdidOverrideUninstall ( @@ -1710,7 +1710,7 @@ } // ======================================================================== -// sub_2ED0 -- VgaClassConstructor: create VGA text class +// VgaClassConstructor: create VGA text class // ======================================================================== EFI_STATUS VgaClassConstructor ( @@ -1785,15 +1785,15 @@ // // Fill vtable // - VgaClass->Init = (EFI_STATUS (*)(VOID *))sub_322C; - VgaClass->StringOutput = (EFI_STATUS (*)(VOID *, CHAR16 *))sub_3280; - VgaClass->TestString = (EFI_STATUS (*)(VOID *, CHAR16 *))sub_34BC; - VgaClass->ClearScreen = (EFI_STATUS (*)(VOID *))sub_3550; - VgaClass->SetAttribute = (EFI_STATUS (*)(VOID *, VOID *))sub_3610; - VgaClass->SetCursor = (EFI_STATUS (*)(VOID *, UINTN, UINTN))sub_362C; - VgaClass->EnableCursor = (EFI_STATUS (*)(VOID *, BOOLEAN))sub_36D0; - VgaClass->QueryMode = (EFI_STATUS (*)(VOID *, UINTN *, UINTN *))sub_3770; - VgaClass->SetMode = (EFI_STATUS (*)(VOID *, UINTN))sub_3810; + VgaClass->Init = (EFI_STATUS (*)(VOID *))VgaTextInit; + VgaClass->StringOutput = (EFI_STATUS (*)(VOID *, CHAR16 *))VgaTextStringOutput; + VgaClass->TestString = (EFI_STATUS (*)(VOID *, CHAR16 *))VgaTextTestStringValid; + VgaClass->ClearScreen = (EFI_STATUS (*)(VOID *))VgaTextClearScreen; + VgaClass->SetAttribute = (EFI_STATUS (*)(VOID *, VOID *))VgaTextSetAttribute; + VgaClass->SetCursor = (EFI_STATUS (*)(VOID *, UINTN, UINTN))VgaTextSetCursorPosition; + VgaClass->EnableCursor = (EFI_STATUS (*)(VOID *, BOOLEAN))VgaTextEnableCursor; + VgaClass->QueryMode = (EFI_STATUS (*)(VOID *, UINTN *, UINTN *))VgaTextQueryModeInfo; + VgaClass->SetMode = (EFI_STATUS (*)(VOID *, UINTN))VgaTextSetMode; VgaClass->Unused58 = NULL; // @@ -1845,7 +1845,7 @@ } // ======================================================================== -// sub_3138 -- VgaClassDestructor: destroy VGA class instance +// VgaClassDestructor: destroy VGA class instance // ======================================================================== EFI_STATUS VgaClassDestructor ( @@ -1915,7 +1915,7 @@ } // ======================================================================== -// sub_322C -- VgaTextInit: initialize VGA text mode +// VgaTextInit: initialize VGA text mode // ======================================================================== EFI_STATUS VgaTextInit ( @@ -1935,7 +1935,7 @@ } // ======================================================================== -// sub_3280 -- VgaTextStringOutput: output string to VGA text screen +// VgaTextStringOutput: output string to VGA text screen // ======================================================================== EFI_STATUS VgaTextStringOutput ( @@ -2063,7 +2063,7 @@ } // ======================================================================== -// sub_34BC -- VgaTextTestStringValid: validate Unicode string for VGA +// VgaTextTestStringValid: validate Unicode string for VGA // ======================================================================== EFI_STATUS VgaTextTestStringValid ( @@ -2106,7 +2106,7 @@ } // ======================================================================== -// sub_3550 -- VgaTextClearScreen: fill VGA text screen with spaces +// VgaTextClearScreen: fill VGA text screen with spaces // ======================================================================== EFI_STATUS VgaTextClearScreen ( @@ -2161,7 +2161,7 @@ } // ======================================================================== -// sub_362C -- VgaTextSetCursorPosition: set text cursor with bounds check +// VgaTextSetCursorPosition: set text cursor with bounds check // ======================================================================== EFI_STATUS VgaTextSetCursorPosition ( @@ -2212,7 +2212,7 @@ } // ======================================================================== -// sub_36D0 -- VgaTextEnableCursor: enable/disable cursor +// VgaTextEnableCursor: enable/disable cursor // ======================================================================== EFI_STATUS VgaTextEnableCursor ( @@ -2250,7 +2250,7 @@ } // ======================================================================== -// sub_3770 -- VgaTextQueryModeInfo: return cols/rows for VGA text mode +// VgaTextQueryModeInfo: return cols/rows for VGA text mode // ======================================================================== EFI_STATUS VgaTextQueryModeInfo ( @@ -2288,7 +2288,7 @@ } // ======================================================================== -// sub_3810 -- VgaTextSetMode: select VGA text mode +// VgaTextSetMode: select VGA text mode // ======================================================================== EFI_STATUS VgaTextSetMode ( @@ -2322,7 +2322,7 @@ } // ======================================================================== -// sub_388C -- VgaCursorSetPosition: program cursor via CRT registers +// VgaCursorSetPosition: program cursor via CRT registers // ======================================================================== EFI_STATUS VgaCursorSetPosition ( @@ -2353,7 +2353,7 @@ } // ======================================================================== -// sub_38F4 -- VgaWriteCrtRegister: write CRTC register +// VgaWriteCrtRegister: write CRTC register // ======================================================================== EFI_STATUS VgaWriteCrtRegister ( @@ -2371,7 +2371,7 @@ } // ======================================================================== -// sub_396C -- VgaOemCharTranslate: convert OEM/Unicode to VGA glyph +// VgaOemCharTranslate: convert OEM/Unicode to VGA glyph // ======================================================================== BOOLEAN VgaOemCharTranslate ( @@ -2410,7 +2410,7 @@ } // ======================================================================== -// sub_568 -- IsVgaEnableCheck: check if any child has VGA enable +// IsVgaEnableCheck: check if any child has VGA enable // ======================================================================== BOOLEAN IsVgaEnableCheck ( @@ -2453,7 +2453,7 @@ } // ======================================================================== -// sub_5E0 -- LegacyBiosPlatformSetVideoController: set/clear video owner +// LegacyBiosPlatformSetVideoController: set/clear video owner // ======================================================================== EFI_STATUS LegacyBiosPlatformSetVideoController ( @@ -2475,7 +2475,7 @@ } // - // Check if the current state matches the request (byte_5770 optimization) + // Check if the current state matches the request // if (gIsLegacyVgaMode == SetAsActive && !Force) { return EFI_SUCCESS; @@ -2500,7 +2500,7 @@ } // ======================================================================== -// sub_6B0 -- IsPciRootBridgeVgaCompatible: check PCI class code +// IsPciRootBridgeVgaCompatible: check PCI class code // ======================================================================== EFI_STATUS IsPciRootBridgeVgaCompatible ( @@ -2563,7 +2563,7 @@ } // ======================================================================== -// sub_2E0 -- CopyMemInternal: low-level memcpy +// CopyMemInternal: low-level memcpy // ======================================================================== VOID * CopyMemInternal ( @@ -2591,7 +2591,7 @@ } // ======================================================================== -// sub_4310 -- CmosReadVideoType: get video type from CMOS +// CmosReadVideoType: get video type from CMOS // ======================================================================== UINTN CmosReadVideoType ( @@ -2620,7 +2620,7 @@ } // ======================================================================== -// sub_46AE -- SetMem: memset with alignment optimization +// SetMem: memset with alignment optimization // ======================================================================== VOID * SetMem ( @@ -2671,7 +2671,7 @@ } // ======================================================================== -// sub_4700 -- CopyMemOverlapped: memcpy with direction detection +// CopyMemOverlapped: memcpy with direction detection // ======================================================================== VOID * CopyMemOverlapped ( @@ -2741,4 +2741,4 @@ } return Destination; -} \ No newline at end of file +} diff --git a/AmiModulePkg/CSM/CsmVideo/CsmVideo.h b/AmiModulePkg/CSM/CsmVideo/CsmVideo.h index e5f37f3..13f3072 100644 --- a/AmiModulePkg/CSM/CsmVideo/CsmVideo.h +++ b/AmiModulePkg/CSM/CsmVideo/CsmVideo.h @@ -1,2503 +1,44 @@ -/** @file - CsmVideo.h -- Header for CsmVideo - -Copyright (c) HR650X BIOS Decompilation Project -**/ - #ifndef __CSMVIDEO_H__ #define __CSMVIDEO_H__ #include "../uefi_headers/Uefi.h" -// -// Function Prototypes -// +EFI_STATUS EFIAPI _ModuleEntryPoint(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable); +EFI_STATUS EFIAPI CsmVideoDriverEntry(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable); +EFI_STATUS EFIAPI CsmVideoChildInit(CSM_VIDEO_INSTANCE *Instance, EFI_HANDLE ChildHandle, VOID *Context); +EFI_STATUS EFIAPI CsmVideoModeSet(CSM_VIDEO_INSTANCE *Instance, EFI_HANDLE ChildHandle, UINTN ModeCount, UINTN *ModeArray); +EFI_STATUS EFIAPI CsmVideoInstanceCreate(CSM_VIDEO_INSTANCE *Instance, EFI_HANDLE ChildHandle, EFI_PCI_IO_PROTOCOL *PciIo, EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *RootBridgeIo, EFI_LEGACY_BIOS_PLATFORM_PROTOCOL *LegacyBiosPlatform, EFI_HANDLE LegacyBiosHandle, UINT64 SavedPciAttributes); +EFI_STATUS EFIAPI CsmVideoDetectDevice(CSM_VIDEO_INSTANCE *Instance, EFI_HANDLE ChildHandle, CSM_VIDEO_INSTANCE **CsmVideo); +EFI_STATUS EFIAPI CsmVideoChildAddProtocol(CSM_VIDEO_INSTANCE *Instance, EFI_HANDLE ChildHandle, EFI_HANDLE ParentHandle); +VOID EFIAPI CsmVideoFreeBuffers(CSM_VIDEO_INSTANCE *CsmVideo); +VOID EFIAPI EdidParseAndMerge(EDID_BLOCK *Edid); +EFI_STATUS EFIAPI VesaGetControllerCapabilities(CSM_VIDEO_INSTANCE *CsmVideo); +EFI_STATUS EFIAPI VesaEnumerateModes(CSM_VIDEO_INSTANCE *CsmVideo); +EFI_STATUS EFIAPI GraphicsOutputQueryMode(EFI_GRAPHICS_OUTPUT_PROTOCOL *This, UINT32 ModeNumber, UINTN *SizeOfInfo, EFI_GRAPHICS_OUTPUT_MODE_INFORMATION **Info); +EFI_STATUS EFIAPI AllocateVideoBuffers(CSM_VIDEO_INSTANCE *CsmVideo); +EFI_STATUS EFIAPI GraphicsOutputSetMode(EFI_GRAPHICS_OUTPUT_PROTOCOL *This, UINT32 ModeNumber); +EFI_STATUS EFIAPI GraphicsOutputSetModeWrapper(CSM_VIDEO_INSTANCE *CsmVideo, UINT8 *ModeData, UINT32 ModeNumber, UINT64 Param4, UINT64 HorizontalRes, UINT64 VerticalRes, UINT64 Param7, UINT64 Param8, UINT64 BytesPerScanLine, UINT64 Param10); +EFI_STATUS EFIAPI VgaTextSetCursorPositionInt10(VOID *This, UINTN CursorMode); +EFI_STATUS EFIAPI EdidOverrideUninstall(CSM_VIDEO_INSTANCE *Instance, EFI_HANDLE ChildHandle); +EFI_STATUS EFIAPI VgaClassConstructor(CSM_VIDEO_INSTANCE *Instance, EFI_HANDLE ChildHandle); +EFI_STATUS EFIAPI VgaClassDestructor(CSM_VIDEO_INSTANCE *Instance, EFI_HANDLE ChildHandle); +EFI_STATUS EFIAPI VgaTextInit(VGA_CLASS_INSTANCE *This, UINTN Mode); +EFI_STATUS EFIAPI VgaTextStringOutput(VGA_CLASS_INSTANCE *This, CHAR16 *String); +EFI_STATUS EFIAPI VgaTextTestStringValid(VGA_CLASS_INSTANCE *This, CHAR16 *String); +EFI_STATUS EFIAPI VgaTextClearScreen(VGA_CLASS_INSTANCE *This); +EFI_STATUS EFIAPI VgaTextSetCursorPosition(VGA_CLASS_INSTANCE *This, UINTN Column, UINTN Row); +EFI_STATUS EFIAPI VgaTextEnableCursor(VGA_CLASS_INSTANCE *This, BOOLEAN Enable); +EFI_STATUS EFIAPI VgaTextQueryModeInfo(VGA_CLASS_INSTANCE *This, UINTN ModeIndex, UINTN *Columns, UINTN *Rows); +EFI_STATUS EFIAPI VgaTextSetMode(VGA_CLASS_INSTANCE *This, UINTN ModeIndex); +EFI_STATUS EFIAPI VgaCursorSetPosition(VGA_CLASS_INSTANCE *This, UINTN X, UINTN Y, UINTN ScreenWidth); +EFI_STATUS EFIAPI VgaWriteCrtRegister(VGA_CLASS_INSTANCE *This, UINT8 RegisterIndex, UINT8 Value); +BOOLEAN EFIAPI VgaOemCharTranslate(CHAR16 UnicodeChar, CHAR8 *Glyph); +BOOLEAN EFIAPI IsVgaEnableCheck(EFI_HANDLE ChildHandle); +EFI_STATUS EFIAPI LegacyBiosPlatformSetVideoController(CSM_VIDEO_INSTANCE *Instance, BOOLEAN SetAsActive, BOOLEAN Force); +EFI_STATUS EFIAPI IsPciRootBridgeVgaCompatible(CSM_VIDEO_INSTANCE *Instance, EFI_HANDLE ChildHandle); +VOID *EFIAPI CopyMemInternal(VOID *Destination, CONST VOID *Source, UINTN Length); +UINTN EFIAPI CmosReadVideoType(VOID); +VOID *EFIAPI SetMem(VOID *Buffer, UINTN Length, UINT8 Value); +VOID *EFIAPI CopyMemOverlapped(VOID *Destination, CONST VOID *Source, UINTN Length); -EFI_STATUS -EFIAPI -_ModuleEntryPoint( - VOID -); - -EFI_STATUS -EFIAPI -CsmVideoDriverEntry( - VOID -); - -EFI_STATUS -EFIAPI -CsmVideoChildInit( - VOID -); - -EFI_STATUS -EFIAPI -CsmVideoModeSet( - VOID -); - -EFI_STATUS -EFIAPI -CsmVideoInstanceCreate( - VOID -); - -EFI_STATUS -EFIAPI -CsmVideoDetectDevice( - VOID -); - -EFI_STATUS -EFIAPI -CsmVideoChildAddProtocol( - VOID -); - -EFI_STATUS -EFIAPI -CsmVideoFreeBuffers( - VOID -); - -EFI_STATUS -EFIAPI -EdidParseAndMerge( - VOID -); - -EFI_STATUS -EFIAPI -VesaGetControllerCapabilities( - VOID -); - -EFI_STATUS -EFIAPI -VesaEnumerateModes( - VOID -); - -EFI_STATUS -EFIAPI -GraphicsOutputQueryMode( - VOID -); - -EFI_STATUS -EFIAPI -AllocateVideoBuffers( - VOID -); - -EFI_STATUS -EFIAPI -GraphicsOutputSetMode( - VOID -); - -EFI_STATUS -EFIAPI -GraphicsOutputSetModeWrapper( - VOID -); - -EFI_STATUS -EFIAPI -VgaTextSetCursorPosition( - VOID -); - -EFI_STATUS -EFIAPI -EdidOverrideUninstall( - VOID -); - -EFI_STATUS -EFIAPI -VgaClassConstructor( - VOID -); - -EFI_STATUS -EFIAPI -VgaClassDestructor( - VOID -); - -EFI_STATUS -EFIAPI -VgaTextInit( - VOID -); - -EFI_STATUS -EFIAPI -VgaTextStringOutput( - VOID -); - -EFI_STATUS -EFIAPI -VgaTextTestStringValid( - VOID -); - -EFI_STATUS -EFIAPI -VgaTextClearScreen( - VOID -); - -EFI_STATUS -EFIAPI -VgaTextEnableCursor( - VOID -); - -EFI_STATUS -EFIAPI -VgaTextQueryModeInfo( - VOID -); - -EFI_STATUS -EFIAPI -VgaTextSetMode( - VOID -); - -EFI_STATUS -EFIAPI -VgaCursorSetPosition( - VOID -); - -EFI_STATUS -EFIAPI -VgaWriteCrtRegister( - VOID -); - -EFI_STATUS -EFIAPI -VgaOemCharTranslate( - VOID -); - -EFI_STATUS -EFIAPI -IsVgaEnableCheck( - VOID -); - -EFI_STATUS -EFIAPI -LegacyBiosPlatformSetVideoController( - VOID -); - -EFI_STATUS -EFIAPI -IsPciRootBridgeVgaCompatible( - VOID -); - -EFI_STATUS -EFIAPI -CmosReadVideoType( - VOID -); - -EFI_STATUS -EFIAPI -declarations from CsmVideo.h / library code( - VOID -); - -EFI_STATUS -EFIAPI -*gBS;( - VOID -); - -EFI_STATUS -EFIAPI -@ 0x390( - VOID -); - -EFI_STATUS -EFIAPI -@ 0x44C( - VOID -); - -EFI_STATUS -EFIAPI -protocols on ImageHandle:( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->InstallMultipleProtocolInterfaces (( - VOID -); - -EFI_STATUS -EFIAPI -EDID_ACTIVE protocol on a child handle( - VOID -); - -EFI_STATUS -EFIAPI -= NULL;( - VOID -); - -EFI_STATUS -EFIAPI -the LegacyBiosPlatform protocol( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->ConnectController (( - VOID -); - -EFI_STATUS -EFIAPI --- CsmVideoChildInit: initialize a VGA/display child( - VOID -); - -EFI_STATUS -EFIAPI -PCI Root Bridge IO protocol on the child( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->HandleProtocol (( - VOID -); - -EFI_STATUS -EFIAPI -Legacy BIOS Platform protocol( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->LocateProtocol (( - VOID -); - -EFI_STATUS -EFIAPI -PCI IO protocol with VGA attribute( - VOID -); - -EFI_STATUS -EFIAPI -= *(UINT64 *)((UINT8 *)Instance + 40); // Instance->Attributes( - VOID -); - -EFI_STATUS -EFIAPI -current mode / attributes( - VOID -); - -EFI_STATUS -EFIAPI -= PciIo->GetAttributes (PciIo, NULL, &Supported, NULL, NULL);( - VOID -); - -EFI_STATUS -EFIAPI -VGA decode, IO, and memory access( - VOID -); - -EFI_STATUS -EFIAPI -= PciIo->SetAttributes (( - VOID -); - -EFI_STATUS -EFIAPI -if this is a VGA-compatible device via LegacyBIOS platform( - VOID -); - -EFI_STATUS -EFIAPI -= LegacyBiosPlatform->GetVgaCompatible (( - VOID -); - -EFI_STATUS -EFIAPI -resources descriptor for VGA legacy IO range( - VOID -); - -EFI_STATUS -EFIAPI -(CsmVideo != NULL) {( - VOID -); - -EFI_STATUS -EFIAPI -if already VGA enabled - skip if so( - VOID -); - -EFI_STATUS -EFIAPI -(IsVgaEnableCheck (ChildHandle)) {( - VOID -); - -EFI_STATUS -EFIAPI -the CsmVideo instance( - VOID -); - -EFI_STATUS -EFIAPI -= CsmVideoInstanceCreate (( - VOID -); - -EFI_STATUS -EFIAPI --- CsmVideoModeSet: set display mode( - VOID -); - -EFI_STATUS -EFIAPI -no modes requested, try EDID_OVERRIDE first, then EDID_ACTIVE( - VOID -); - -EFI_STATUS -EFIAPI -(ModeCount == 0) {( - VOID -); - -EFI_STATUS -EFIAPI -to open EDID_OVERRIDE protocol( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->OpenProtocol (( - VOID -); - -EFI_STATUS -EFIAPI -open EDID_ACTIVE and configure display( - VOID -); - -EFI_STATUS -EFIAPI -VGA child info( - VOID -); - -EFI_STATUS -EFIAPI -each requested mode, try to add it( - VOID -); - -EFI_STATUS -EFIAPI -(Index = 0; Index < ModeCount; Index++) {( - VOID -); - -EFI_STATUS -EFIAPI -previous VGA mode if needed( - VOID -); - -EFI_STATUS -EFIAPI -(!IsVgaEnableCheck (ChildHandle) && IsVesaModeEnabled) {( - VOID -); - -EFI_STATUS -EFIAPI -the video device( - VOID -); - -EFI_STATUS -EFIAPI -= CsmVideoDetectDevice (Instance, ModeArray[0], &CsmVideo);( - VOID -); - -EFI_STATUS -EFIAPI -each requested mode( - VOID -); - -EFI_STATUS -EFIAPI -VGA mode if necessary( - VOID -); - -EFI_STATUS -EFIAPI --- CsmVideoInstanceCreate: create and initialize video instance( - VOID -); - -EFI_STATUS -EFIAPI -264-byte instance( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->AllocatePool (EfiBootServicesData, sizeof (CSM_VIDEO_INSTANCE), (VOID **)&CsmVideo);( - VOID -); - -EFI_STATUS -EFIAPI -the VGA PCI config space for class code( - VOID -); - -EFI_STATUS -EFIAPI -= PciIo->Pci.Read (( - VOID -); - -EFI_STATUS -EFIAPI -device type: VGA compatible (class 3) or not( - VOID -); - -EFI_STATUS -EFIAPI -(!(Class[2] == 3 || (Class[2] == 0 && Class[1] == 3 && !Class[0]))) {( - VOID -); - -EFI_STATUS -EFIAPI -VGA-compatible; check for other video class( - VOID -); - -EFI_STATUS -EFIAPI -VGA, not a display controller( - VOID -); - -EFI_STATUS -EFIAPI -VGA compatible - check for VESA mode( - VOID -); - -EFI_STATUS -EFIAPI -already in VGA mode, but VGA compatible( - VOID -); - -EFI_STATUS -EFIAPI -instance fields( - VOID -); - -EFI_STATUS -EFIAPI -to legacy VGA( - VOID -); - -EFI_STATUS -EFIAPI -VESA-capable( - VOID -); - -EFI_STATUS -EFIAPI -no Legacy BIOS platform, go straight to legacy VGA( - VOID -); - -EFI_STATUS -EFIAPI -(!gLegacyBiosPlatformAvailable) {( - VOID -); - -EFI_STATUS -EFIAPI -end of device path for VGA IO range claim( - VOID -); - -EFI_STATUS -EFIAPI -(LegacyBiosHandle == NULL) {( - VOID -); - -EFI_STATUS -EFIAPI -ACPI device path for VGA IO range( - VOID -); - -EFI_STATUS -EFIAPI -device path for the VGA rom( - VOID -); - -EFI_STATUS -EFIAPI -protocol interfaces for the VESA/child( - VOID -); - -EFI_STATUS -EFIAPI -VESA modes( - VOID -); - -EFI_STATUS -EFIAPI -= VesaEnumerateModes (CsmVideo);( - VOID -); - -EFI_STATUS -EFIAPI -succeeded( - VOID -); - -EFI_STATUS -EFIAPI -back to legacy VGA( - VOID -); - -/// install EDID protocol only -EFI_STATUS -EFIAPI -BIOS platform path( - VOID -); - -EFI_STATUS -EFIAPI -full set of protocols for VESA/child( - VOID -); - -EFI_STATUS -EFIAPI -GOP protocol( - VOID -); - -EFI_STATUS -EFIAPI -VGA mode: populate VGA text mode parameters( - VOID -); - -EFI_STATUS -EFIAPI -VGA CRTC parameters( - VOID -); - -EFI_STATUS -EFIAPI -index( - VOID -); - -EFI_STATUS -EFIAPI -data( - VOID -); - -EFI_STATUS -EFIAPI -CRTC index( - VOID -); - -EFI_STATUS -EFIAPI -CRTC data( - VOID -); - -EFI_STATUS -EFIAPI -Controller( - VOID -); - -EFI_STATUS -EFIAPI -CsmVideo->InputRanges = 0xFF;( - VOID -); - -EFI_STATUS -EFIAPI --- CsmVideoDetectDevice: detect video controller and return instance( - VOID -); - -EFI_STATUS -EFIAPI -ptr to EdidActive field( - VOID -); - -EFI_STATUS -EFIAPI -from field offset back to instance start( - VOID -); - -EFI_STATUS -EFIAPI -is at offset 32 in CsmVideoInstance( - VOID -); - -EFI_STATUS -EFIAPI -back to EDID_OVERRIDE protocol( - VOID -); - -EFI_STATUS -EFIAPI -is at offset 0x60 (96) in the instance( - VOID -); - -EFI_STATUS -EFIAPI --- CsmVideoChildAddProtocol: install protocols on video child( - VOID -); - -EFI_STATUS -EFIAPI -= CsmVideoDetectDevice (Instance, ParentHandle, &CsmVideo);( - VOID -); - -EFI_STATUS -EFIAPI -any existing EDID_ACTIVE protocol on the target handle( - VOID -); - -EFI_STATUS -EFIAPI -the full protocol set on this child (VESA mode)( - VOID -); - -EFI_STATUS -EFIAPI -EDID_OVERRIDE (legacy VGA mode)( - VOID -); - -EFI_STATUS -EFIAPI -install failed, re-open EDID_ACTIVE to restore state( - VOID -); - -EFI_STATUS -EFIAPI -cursor to 80x25 text mode( - VOID -); - -EFI_STATUS -EFIAPI -color text mode( - VOID -); - -EFI_STATUS -EFIAPI -INT10 AH=00h: set video mode 3 (80x25 color text)( - VOID -); - -EFI_STATUS -EFIAPI -INT10 AH=01h: set cursor shape (no cursor)( - VOID -); - -EFI_STATUS -EFIAPI -01h, CH=11h, CL=14h( - VOID -); - -EFI_STATUS -EFIAPI -VESA controller( - VOID -); - -EFI_STATUS -EFIAPI -(CsmVideo);( - VOID -); - -EFI_STATUS -EFIAPI -the global child handle( - VOID -); - -EFI_STATUS -EFIAPI --- CsmVideoFreeBuffers: free all resources( - VOID -); - -EFI_STATUS -EFIAPI -frame buffer 3( - VOID -); - -EFI_STATUS -EFIAPI -frame buffer 2( - VOID -); - -EFI_STATUS -EFIAPI -frame buffer( - VOID -); - -EFI_STATUS -EFIAPI -scan line buffer( - VOID -); - -EFI_STATUS -EFIAPI -text buffer + its memory descriptor( - VOID -); - -EFI_STATUS -EFIAPI -EDID override buffer( - VOID -); - -EFI_STATUS -EFIAPI -the instance itself( - VOID -); - -EFI_STATUS -EFIAPI --- EdidParseAndMerge: parse EDID block, extract timings( - VOID -); - -EFI_STATUS -EFIAPI -EDID checksum( - VOID -); - -EFI_STATUS -EFIAPI -established timings from EDID byte 0x23( - VOID -); - -EFI_STATUS -EFIAPI -= Edid->EstablishedTimings[0] |( - VOID -); - -EFI_STATUS -EFIAPI -known established timing resolutions( - VOID -); - -EFI_STATUS -EFIAPI -timings from EDID spec( - VOID -); - -EFI_STATUS -EFIAPI -@ 70Hz( - VOID -); - -EFI_STATUS -EFIAPI -each flag bit( - VOID -); - -EFI_STATUS -EFIAPI -(TimingIndex = 0; TimingIndex < 17; TimingIndex++) {( - VOID -); - -EFI_STATUS -EFIAPI -detailed timing descriptors (EDID bytes 0x36-0x6F, 18 bytes each)( - VOID -); - -EFI_STATUS -EFIAPI -(DetailedTimingIndex = 0; DetailedTimingIndex < 4; DetailedTimingIndex++) {( - VOID -); - -EFI_STATUS -EFIAPI -if this is a timing descriptor (byte 0 = tag, byte 1 != 1 = pixel clock)( - VOID -); - -EFI_STATUS -EFIAPI -(TimingDescriptor[0] != 0x01 && TimingDescriptor[1] != 0x01) {( - VOID -); - -EFI_STATUS -EFIAPI -Horizontal pixels from bytes 0x02-0x04 (packed)( - VOID -); - -EFI_STATUS -EFIAPI -= (UINT16)(TimingDescriptor[2] + ((TimingDescriptor[4] & 0xF0) << 4));( - VOID -); - -EFI_STATUS -EFIAPI -ratio / Vertical lines extraction( - VOID -); - -EFI_STATUS -EFIAPI -= TimingDescriptor[3] >> 6;( - VOID -); - -EFI_STATUS -EFIAPI -16:10( - VOID -); - -EFI_STATUS -EFIAPI -4:3( - VOID -); - -EFI_STATUS -EFIAPI -5:4( - VOID -); - -EFI_STATUS -EFIAPI -16:9( - VOID -); - -EFI_STATUS -EFIAPI --- VesaGetControllerCapabilities: query VESA VBE BIOS( - VOID -); - -EFI_STATUS -EFIAPI -bytes( - VOID -); - -EFI_STATUS -EFIAPI -VBE controller capabilities call( - VOID -); - -EFI_STATUS -EFIAPI -VbeControllerInfo[1] = 0x10; // Function = Get Capabilities( - VOID -); - -EFI_STATUS -EFIAPI -of graphics ports( - VOID -); - -EFI_STATUS -EFIAPI -to 1( - VOID -); - -EFI_STATUS -EFIAPI -each graphics port to find a connected display( - VOID -); - -EFI_STATUS -EFIAPI -(PortIndex = 0; PortIndex < GraphicsPortCount; PortIndex++) {( - VOID -); - -EFI_STATUS -EFIAPI -= Get Port( - VOID -); - -EFI_STATUS -EFIAPI -a connected port( - VOID -); - -EFI_STATUS -EFIAPI --- VesaEnumerateModes: enumerate all VESA VBE modes( - VOID -); - -EFI_STATUS -EFIAPI -byte VBE mode info block( - VOID -); - -EFI_STATUS -EFIAPI -byte VBE controller info( - VOID -); - -EFI_STATUS -EFIAPI -VBE controller info( - VOID -); - -EFI_STATUS -EFIAPI -= VesaGetControllerCapabilities (CsmVideo);( - VOID -); - -EFI_STATUS -EFIAPI -EDID override data if present( - VOID -); - -EFI_STATUS -EFIAPI -= 0;( - VOID -); - -EFI_STATUS -EFIAPI -space for mode list (up to ~256 VBE modes)( - VOID -); - -EFI_STATUS -EFIAPI -= AllocateZeroPool (256 * sizeof (UINT16));( - VOID -); - -EFI_STATUS -EFIAPI -through VESA/VBE modes( - VOID -); - -EFI_STATUS -EFIAPI -(Index = 0; ; Index++) {( - VOID -); - -EFI_STATUS -EFIAPI -VBE mode info for this mode number( - VOID -); - -EFI_STATUS -EFIAPI -function 0x4F01: Get Mode Info( - VOID -); - -EFI_STATUS -EFIAPI -function( - VOID -); - -EFI_STATUS -EFIAPI -number( - VOID -); - -EFI_STATUS -EFIAPI -more modes or error( - VOID -); - -EFI_STATUS -EFIAPI -mode number( - VOID -); - -EFI_STATUS -EFIAPI -(VbeModeNumber < 0x100) {( - VOID -); - -EFI_STATUS -EFIAPI -mode attributes bit 7 (linear FB supported) and bit 0 (mode supported)( - VOID -); - -EFI_STATUS -EFIAPI -(!(VbeModeInfo[0] & 0x80) || !(VbeModeInfo[0] & 0x01)) {( - VOID -); - -EFI_STATUS -EFIAPI -mode type (must be invalid type to be graphical)( - VOID -); - -EFI_STATUS -EFIAPI -((VbeModeInfo & 0x08) == 0) {( - VOID -); - -EFI_STATUS -EFIAPI -for linear frame buffer( - VOID -); - -EFI_STATUS -EFIAPI -(!(VbeModeInfo[0] & VESA_MODE_LINEAR_FB_BIT)) {( - VOID -); - -EFI_STATUS -EFIAPI -bits per pixel: must be 24-32, and modulo 8 == 0( - VOID -); - -EFI_STATUS -EFIAPI -PhysBasePtr is non-zero( - VOID -); - -EFI_STATUS -EFIAPI -resolution against EDID table( - VOID -); - -EFI_STATUS -EFIAPI -= *(UINT32 *)&VbeModeInfo[0x12]; // XResolution( - VOID -); - -EFI_STATUS -EFIAPI -EdidMatchFound = FALSE;( - VOID -); - -EFI_STATUS -EFIAPI -for duplicate( - VOID -); - -EFI_STATUS -EFIAPI -(Index = 0; Index < UsableModes; Index++) {( - VOID -); - -/// add to our mode table -EFI_STATUS -EFIAPI -is usable( - VOID -); - -EFI_STATUS -EFIAPI -mode count( - VOID -); - -EFI_STATUS -EFIAPI -video buffers for this instance( - VOID -); - -EFI_STATUS -EFIAPI -= AllocateVideoBuffers (CsmVideo);( - VOID -); - -EFI_STATUS -EFIAPI --- GraphicsOutputQueryMode: GOP QueryMode( - VOID -); - -EFI_STATUS -EFIAPI -instance from CR (This is at offset 32 from instance)( - VOID -); - -EFI_STATUS -EFIAPI -= (CSM_VIDEO_INSTANCE *)((UINT8 *)This - 32);( - VOID -); - -EFI_STATUS -EFIAPI -if initialized( - VOID -); - -EFI_STATUS -EFIAPI -(CsmVideo->bEdidOverrideActive) {( - VOID -); - -EFI_STATUS -EFIAPI -parameters( - VOID -); - -EFI_STATUS -EFIAPI -(ModeNumber >= CsmVideo->MaxMode || SizeOfInfo == NULL || Info == NULL) {( - VOID -); - -EFI_STATUS -EFIAPI -output buffer (36 bytes as observed)( - VOID -); - -EFI_STATUS -EFIAPI -mode info from VESA mode table (72 bytes per entry)( - VOID -); - -EFI_STATUS -EFIAPI -= &CsmVideo->VesaModeInfo[ModeNumber];( - VOID -); - -EFI_STATUS -EFIAPI -pixel information( - VOID -); - -EFI_STATUS -EFIAPI -= 8 * BytesPerScanLine / BitsPerPixel( - VOID -); - -EFI_STATUS -EFIAPI --- AllocateVideoBuffers: allocate scan line, text, and frame buffers( - VOID -); - -EFI_STATUS -EFIAPI -worst-case dimensions from all modes( - VOID -); - -EFI_STATUS -EFIAPI -all modes to find the largest( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->AllocatePool (( - VOID -); - -/// VGA text mode save area) -EFI_STATUS -EFIAPI -text buffer (153600 bytes = 80*25*2*24( - VOID -); - -EFI_STATUS -EFIAPI --- GraphicsOutputSetMode: GOP SetMode( - VOID -); - -EFI_STATUS -EFIAPI -bytes buffer for INT10( - VOID -); - -EFI_STATUS -EFIAPI -instance via CR (This at offset 32)( - VOID -); - -EFI_STATUS -EFIAPI -(ModeNumber >= CsmVideo->MaxMode) {( - VOID -); - -EFI_STATUS -EFIAPI -VBE call buffer( - VOID -); - -EFI_STATUS -EFIAPI -mode number < 0x100, use standard VGA mode set( - VOID -); - -EFI_STATUS -EFIAPI -(ModeInfo->VbeModeNumber < 0x100) {( - VOID -); - -EFI_STATUS -EFIAPI -mode set via INT10 AH=00h, AL=mode( - VOID -); - -EFI_STATUS -EFIAPI -Set Mode( - VOID -); - -EFI_STATUS -EFIAPI -current mode info( - VOID -); - -EFI_STATUS -EFIAPI -frame buffer size( - VOID -); - -EFI_STATUS -EFIAPI -the frame buffer (fill with zeros)( - VOID -); - -EFI_STATUS -EFIAPI -current frame buffer from VESA linear FB to our shadow buffer( - VOID -); - -EFI_STATUS -EFIAPI --- GraphicsOutputSetModeWrapper: 10-param wrapper for GOP SetMode( - VOID -); - -EFI_STATUS -EFIAPI -current EDID override info from instance( - VOID -); - -EFI_STATUS -EFIAPI -= CR_FROM_EDID_ACTIVE (CsmVideo);( - VOID -); - -EFI_STATUS -EFIAPI -currently in EDID override mode, handle state transition( - VOID -); - -EFI_STATUS -EFIAPI -(EdidOverrideActive) {( - VOID -); - -EFI_STATUS -EFIAPI -EDID_ACTIVE protocol (open from child controller)( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->CloseProtocol (( - VOID -); - -EFI_STATUS -EFIAPI -the VGA mode( - VOID -); - -EFI_STATUS -EFIAPI -= GraphicsOutputSetMode (&CsmVideo->GraphicsOutput, ModeNumber);( - VOID -); - -EFI_STATUS -EFIAPI -EDID_ACTIVE with BY_CHILD_CONTROLLER after mode set( - VOID -); - -EFI_STATUS -EFIAPI --- VgaTextSetCursorPosition: set cursor via INT10 AH=02h( - VOID -); - -EFI_STATUS -EFIAPI -cursor mode( - VOID -); - -EFI_STATUS -EFIAPI -(CursorMode > Instance->ModeTableSize) {( - VOID -); - -EFI_STATUS -EFIAPI -INT10 call( - VOID -); - -EFI_STATUS -EFIAPI -= 0 (row=0, col=0)( - VOID -); - -EFI_STATUS -EFIAPI -cursor to end of screen for mode 1( - VOID -); - -EFI_STATUS -EFIAPI -INT10 to set cursor position( - VOID -); - -EFI_STATUS -EFIAPI --- EdidOverrideUninstall: remove EDID override protocols( - VOID -); - -EFI_STATUS -EFIAPI -EDID_OVERRIDE protocol on child( - VOID -); - -EFI_STATUS -EFIAPI -and uninstall EDID_ACTIVE protocol( - VOID -); - -EFI_STATUS -EFIAPI --- VgaClassConstructor: create VGA text class( - VOID -); - -EFI_STATUS -EFIAPI -PCI Root Bridge IO protocol( - VOID -); - -EFI_STATUS -EFIAPI -PCI IO protocol( - VOID -); - -EFI_STATUS -EFIAPI -EDID_OVERRIDE protocol( - VOID -); - -EFI_STATUS -EFIAPI -VGA Class Instance (144 bytes)( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->AllocatePool (EfiBootServicesData, sizeof (VGA_CLASS_INSTANCE), (VOID **)&VgaClass);( - VOID -); - -EFI_STATUS -EFIAPI -signature( - VOID -); - -EFI_STATUS -EFIAPI -vtable( - VOID -); - -EFI_STATUS -EFIAPI -the VGA class instance:( - VOID -); - -EFI_STATUS -EFIAPI --> set mode (15) -> set cursor -> enable cursor( - VOID -); - -EFI_STATUS -EFIAPI -= VgaClass->SetMode (&VgaClass->ModeTableSize, 15);( - VOID -); - -EFI_STATUS -EFIAPI -Legacy BIOS protocol on the child( - VOID -); - -EFI_STATUS -EFIAPI --- VgaClassDestructor: destroy VGA class instance( - VOID -); - -EFI_STATUS -EFIAPI -Legacy BIOS protocol( - VOID -); - -EFI_STATUS -EFIAPI -from LegacyBios protocol interface back to instance( - VOID -); - -EFI_STATUS -EFIAPI -= (VGA_CLASS_INSTANCE *)((UINT8 *)VgaClass - 16);( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->ReinstallProtocolInterface (( - VOID -); - -EFI_STATUS -EFIAPI -EDID_ACTIVE protocol( - VOID -); - -EFI_STATUS -EFIAPI -the instance( - VOID -); - -EFI_STATUS -EFIAPI --- VgaTextInit: initialize VGA text mode( - VOID -); - -EFI_STATUS -EFIAPI -palette registers (INT10 AH=0Bh/BH=01h)( - VOID -); - -EFI_STATUS -EFIAPI -cursor type (start, end)( - VOID -); - -EFI_STATUS -EFIAPI -This->SetCursor (This, 0);( - VOID -); - -EFI_STATUS -EFIAPI --- VgaTextStringOutput: output string to VGA text screen( - VOID -); - -EFI_STATUS -EFIAPI -This signature( - VOID -); - -EFI_STATUS -EFIAPI -(This->Signature != VGA_CLASS_INSTANCE_SIGNATURE) {( - VOID -); - -EFI_STATUS -EFIAPI -current mode dimensions( - VOID -); - -EFI_STATUS -EFIAPI -= This->QueryMode (This, &ScreenWidth, &ScreenHeight);( - VOID -); - -EFI_STATUS -EFIAPI -text cursor position from attribute fields( - VOID -); - -EFI_STATUS -EFIAPI -= This->CursorX;( - VOID -); - -EFI_STATUS -EFIAPI -current attribute( - VOID -); - -EFI_STATUS -EFIAPI -= This->Attribute;( - VOID -); - -EFI_STATUS -EFIAPI -frame buffer stride (bytes per scan line)( - VOID -); - -EFI_STATUS -EFIAPI -= This->FrameBufferStride;( - VOID -); - -EFI_STATUS -EFIAPI -each character in the string( - VOID -); - -EFI_STATUS -EFIAPI -(; *String != 0; String++) {( - VOID -); - -EFI_STATUS -EFIAPI -if (CursorX > 0) {( - VOID -); - -EFI_STATUS -EFIAPI -feed( - VOID -); - -EFI_STATUS -EFIAPI -the screen up by one line( - VOID -); - -EFI_STATUS -EFIAPI -(CursorY == (ScreenHeight - 1)) {( - VOID -); - -EFI_STATUS -EFIAPI -CursorData[0] = ((Attribute << 8) | 0x20);( - VOID -); - -EFI_STATUS -EFIAPI -return( - VOID -); - -EFI_STATUS -EFIAPI -OEM characters to VGA glyphs( - VOID -); - -EFI_STATUS -EFIAPI -(VgaOemCharTranslate (CurrentChar, &GlyphData)) {( - VOID -); - -EFI_STATUS -EFIAPI -character to frame buffer at current cursor position( - VOID -); - -EFI_STATUS -EFIAPI -= CursorY * Stride + CursorX * 2;( - VOID -); - -EFI_STATUS -EFIAPI -character + attribute to VGA text buffer (B8000 or shadow)( - VOID -); - -EFI_STATUS -EFIAPI -to next line( - VOID -); - -EFI_STATUS -EFIAPI -cursor position( - VOID -); - -EFI_STATUS -EFIAPI --- VgaTextTestStringValid: validate Unicode string for VGA( - VOID -); - -EFI_STATUS -EFIAPI -printable range (0x20-0x7F)( - VOID -); - -EFI_STATUS -EFIAPI -((CurrentChar - 0x20) > 0x5F) {( - VOID -); - -EFI_STATUS -EFIAPI -for control characters (0x00-0x0D with supported set)( - VOID -); - -EFI_STATUS -EFIAPI -(CurrentChar > 0x0D ||( - VOID -); - -EFI_STATUS -EFIAPI -for OEM character range( - VOID -); - -EFI_STATUS -EFIAPI -(((CurrentChar & 0xFF00) - 0x2100) & 0xFBFF) {( - VOID -); - -EFI_STATUS -EFIAPI -up in OEM-to-VGA translation table( - VOID -); - -EFI_STATUS -EFIAPI -(!VgaOemCharTranslate (CurrentChar, NULL)) {( - VOID -); - -EFI_STATUS -EFIAPI --- VgaTextClearScreen: fill VGA text screen with spaces( - VOID -); - -EFI_STATUS -EFIAPI -//( - VOID -); - -EFI_STATUS -EFIAPI -dimensions( - VOID -); - -EFI_STATUS -EFIAPI -the entire screen buffer( - VOID -); - -EFI_STATUS -EFIAPI -= ScreenWidth * 2; // Two bytes per character (char + attr)( - VOID -); - -EFI_STATUS -EFIAPI -with current attribute( - VOID -); - -EFI_STATUS -EFIAPI -the VGA text region( - VOID -); - -EFI_STATUS -EFIAPI -(CursorY = 0; CursorY < ScreenHeight; CursorY++) {( - VOID -); - -EFI_STATUS -EFIAPI -cursor to home (0,0)( - VOID -); - -EFI_STATUS -EFIAPI --- VgaTextSetCursorPosition: set text cursor with bounds check( - VOID -); - -EFI_STATUS -EFIAPI -= This->QueryMode (This, &MaxCol, &MaxRow);( - VOID -); - -EFI_STATUS -EFIAPI -check( - VOID -); - -EFI_STATUS -EFIAPI -(Column >= MaxCol || Row >= MaxRow) {( - VOID -); - -EFI_STATUS -EFIAPI -cursor position via CRT controller registers( - VOID -); - -EFI_STATUS -EFIAPI -(This, Column, Row, MaxCol);( - VOID -); - -EFI_STATUS -EFIAPI -internal state( - VOID -); - -EFI_STATUS -EFIAPI --- VgaTextEnableCursor: enable/disable cursor( - VOID -); - -EFI_STATUS -EFIAPI -cursor via INT10: AH=01h, CH=cursor start, CL=cursor end( - VOID -); - -EFI_STATUS -EFIAPI -(Enable) {( - VOID -); - -EFI_STATUS -EFIAPI -cursor by moving it off screen( - VOID -); - -EFI_STATUS -EFIAPI -(This, CRTC_CURSOR_START, 0x20);( - VOID -); - -EFI_STATUS -EFIAPI --- VgaTextQueryModeInfo: return cols/rows for VGA text mode( - VOID -); - -EFI_STATUS -EFIAPI -mode index( - VOID -); - -EFI_STATUS -EFIAPI -(ModeIndex >= This->ModeTableSize) {( - VOID -); - -EFI_STATUS -EFIAPI -0 = 80x25, Mode 1 = 80x50( - VOID -); - -EFI_STATUS -EFIAPI -(ModeIndex == 0) {( - VOID -); - -EFI_STATUS -EFIAPI --- VgaTextSetMode: select VGA text mode( - VOID -); - -EFI_STATUS -EFIAPI -the current screen( - VOID -); - -EFI_STATUS -EFIAPI -current mode index( - VOID -); - -EFI_STATUS -EFIAPI -the frame buffer mode( - VOID -); - -EFI_STATUS -EFIAPI -This->FrameBufferModeSet (This->FrameBufferAccess, ModeIndex);( - VOID -); - -EFI_STATUS -EFIAPI --- VgaCursorSetPosition: program cursor via CRT registers( - VOID -); - -EFI_STATUS -EFIAPI -linear cursor offset( - VOID -); - -EFI_STATUS -EFIAPI -= X + ScreenWidth * Y;( - VOID -); - -EFI_STATUS -EFIAPI -cursor location high byte to CRTC register 0x0E( - VOID -); - -EFI_STATUS -EFIAPI -(This, CRTC_CURSOR_LOC_HIGH, (CursorOffset >> 8));( - VOID -); - -EFI_STATUS -EFIAPI -cursor location low byte to CRTC register 0x0F( - VOID -); - -EFI_STATUS -EFIAPI -(This, CRTC_CURSOR_LOC_LOW, (CursorOffset & 0xFF));( - VOID -); - -EFI_STATUS -EFIAPI --- VgaWriteCrtRegister: write CRTC register( - VOID -); - -EFI_STATUS -EFIAPI -(CRTC_INDEX_PORT, RegisterIndex);( - VOID -); - -EFI_STATUS -EFIAPI --- VgaOemCharTranslate: convert OEM/Unicode to VGA glyph( - VOID -); - -EFI_STATUS -EFIAPI -character range: Unicode code page 437 / OEM( - VOID -); - -EFI_STATUS -EFIAPI -(((UnicodeChar & 0xFF00) - 0x2100) & 0xFBFF) {( - VOID -); - -EFI_STATUS -EFIAPI -up the character in the translation table (a global static list)( - VOID -); - -EFI_STATUS -EFIAPI -table maps pairs of (Unicode, VGA_Index)( - VOID -); - -EFI_STATUS -EFIAPI --- IsVgaEnableCheck: check if any child has VGA enable( - VOID -); - -EFI_STATUS -EFIAPI -protocol info for EDID_ACTIVE on this handle( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->OpenProtocolInformation (( - VOID -); - -EFI_STATUS -EFIAPI -each open protocol entry for BIT3 (VGA enable flag)( - VOID -); - -EFI_STATUS -EFIAPI -(Index = 0; Index < OpenInfoCount; Index++) {( - VOID -); - -EFI_STATUS -EFIAPI --- LegacyBiosPlatformSetVideoController: set/clear video owner( - VOID -); - -EFI_STATUS -EFIAPI -no platform handle or already in the desired state, skip( - VOID -); - -EFI_STATUS -EFIAPI -(BiosPlatformHandle == NULL) {( - VOID -); - -EFI_STATUS -EFIAPI -if the current state matches the request (byte_5770 optimization)( - VOID -); - -EFI_STATUS -EFIAPI -(gIsLegacyVgaMode == SetAsActive && !Force) {( - VOID -); - -EFI_STATUS -EFIAPI -or clear VGA controller ownership on the legacy BIOS platform( - VOID -); - -EFI_STATUS -EFIAPI -(SetAsActive) {( - VOID -); - -EFI_STATUS -EFIAPI --- IsPciRootBridgeVgaCompatible: check PCI class code( - VOID -); - -EFI_STATUS -EFIAPI -PCI IO protocol on the child handle( - VOID -); - -EFI_STATUS -EFIAPI -PCI class code( - VOID -); - -EFI_STATUS -EFIAPI -if VGA compatible (class 3, subclass 0, prog IF 0)( - VOID -); - -EFI_STATUS -EFIAPI -VGA-compatible (class 3, any subclass, prog IF 0)( - VOID -); - -EFI_STATUS -EFIAPI -(Class[2] == 3 && Class[1] == 0 && Class[0] == 0) {( - VOID -); - -EFI_STATUS -EFIAPI -VGA compatible( - VOID -); - -EFI_STATUS -EFIAPI -protocol( - VOID -); - -EFI_STATUS -EFIAPI --- CopyMemInternal: low-level memcpy( - VOID -); - -EFI_STATUS -EFIAPI -overlapping case: if Source < Dest and overlap detected( - VOID -); - -EFI_STATUS -EFIAPI -backwards from end( - VOID -); - -EFI_STATUS -EFIAPI -(Source < Destination &&( - VOID -); - -EFI_STATUS -EFIAPI -backwards( - VOID -); - -EFI_STATUS -EFIAPI -CopyMemBackwards (Destination, Source, Length);( - VOID -); - -EFI_STATUS -EFIAPI -forwards with 8-byte chunks then remaining bytes( - VOID -); - -EFI_STATUS -EFIAPI -CopyMemForward (Destination, Source, Length);( - VOID -); - -EFI_STATUS -EFIAPI --- CmosReadVideoType: get video type from CMOS( - VOID -); - -EFI_STATUS -EFIAPI -CMOS register 0x4B (video type)( - VOID -); - -EFI_STATUS -EFIAPI -= __inbyte (0x70) & 0x80;( - VOID -); - -EFI_STATUS -EFIAPI -or non-standard video( - VOID -); - -EFI_STATUS -EFIAPI -}( - VOID -); - -EFI_STATUS -EFIAPI --- SetMem: memset with alignment optimization( - VOID -); - -EFI_STATUS -EFIAPI -64-bit word: 8 copies of Value( - VOID -); - -EFI_STATUS -EFIAPI -= Value;( - VOID -); - -EFI_STATUS -EFIAPI -to 4-byte boundary( - VOID -); - -EFI_STATUS -EFIAPI -(Length >= 4 && ((UINTN)Buf & 3)) {( - VOID -); - -EFI_STATUS -EFIAPI -aligned 32-bit words( - VOID -); - -EFI_STATUS -EFIAPI -(AlignedCount = Length >> 2; AlignedCount > 0; AlignedCount--) {( - VOID -); - -EFI_STATUS -EFIAPI -remaining bytes( - VOID -); - -EFI_STATUS -EFIAPI -(Length > 0) {( - VOID -); - -EFI_STATUS -EFIAPI --- CopyMemOverlapped: memcpy with direction detection( - VOID -); - -EFI_STATUS -EFIAPI -direction: backward if src < dst && overlap( - VOID -); - -EFI_STATUS -EFIAPI -(Src < Dst && (Src + Length) > Dst) {( - VOID -); - -EFI_STATUS -EFIAPI -aligned copy: 8 bytes at a time when both aligned( - VOID -); - -EFI_STATUS -EFIAPI -(Length >= 8 && ((UINTN)Src & 7) == ((UINTN)Dst & 7)) {( - VOID -); - -EFI_STATUS -EFIAPI -leading misaligned bytes( - VOID -); - -EFI_STATUS -EFIAPI -Align = (UINTN)Src & 7;( - VOID -); - -EFI_STATUS -EFIAPI -alignment bytes( - VOID -); - -EFI_STATUS -EFIAPI -aligned 8-byte chunks( - VOID -); - -EFI_STATUS -EFIAPI -Count = Length >> 3;( - VOID -); - -EFI_STATUS -EFIAPI -with 8-byte alignment( - VOID -); - -EFI_STATUS -EFIAPI -remaining( - VOID -); - -#endif /* __CSMVIDEO_H__ */ \ No newline at end of file +#endif /* __CSMVIDEO_H__ */ diff --git a/AmiModulePkg/FlashDriver/FlashDriverSmm/FlashDriverSmm.c b/AmiModulePkg/FlashDriver/FlashDriverSmm/FlashDriverSmm.c index 23ad909..ca641b4 100644 --- a/AmiModulePkg/FlashDriver/FlashDriverSmm/FlashDriverSmm.c +++ b/AmiModulePkg/FlashDriver/FlashDriverSmm/FlashDriverSmm.c @@ -62,21 +62,21 @@ // SPI probe function table (off_48A00, 4 entries + NULL) //=========================================================================== static SPI_PROBE_BE (*gSpiProbeBeTable[5])(UINTN, SPI_PROTOCOL **); -// [0] = sub_3374 - ESMT/Geneneric probe (JEDEC LSBit) -// [1] = sub_2BC0 - XCC/SSSC/Spansion/EON/ISIS probe -// [2] = sub_2880 - ADESTO/ATMEL probe -// [3] = sub_27AC - SST 25LF probe +// [0] = ESMT / generic JEDEC-probe family +// [1] = XMC / SSSC / Spansion / EON / ISSI probe family +// [2] = Adesto / Atmel probe family +// [3] = SST 25LF probe family //=========================================================================== // SPI pre-operation function list (funcs_1E91 at 0x4ED0) //=========================================================================== -// Single entry: sub_24CC (0x4CC) - spin-wait / sector check +// Single entry: spin-wait / sector check // NULL terminated //=========================================================================== // SPI post-operation function list (funcs_1F10 at 0x4EE0) //=========================================================================== -// Single entry: sub_2594 (0x2594) - unlock / lock release +// Single entry: unlock / lock release // NULL terminated //=========================================================================== @@ -125,7 +125,7 @@ ); //=========================================================================== -// Function: CpuCpuCpu - PAUSE instrinstrinstr (sub_430) +// Function: CpuPause - PAUSE instruction wrapper //=========================================================================== VOID CpuPause( @@ -136,12 +136,12 @@ } //=========================================================================== -// Funcion: SpinWaitA - Busy-y wait with PAUSE (sub_440) +// Function: SpinWaitA - busy wait with PAUSE //=========================================================================== // Simimple 1 1 wait loop with PAUSE for short delas //=========================================================================== -// Funcon: sub_3E0 / SetJmp wrapper (sub_2C0) +// Function: SetJmpWrapper //=========================================================================== // Saves all calall-saved registrers and and XMM registers to the JumpBuffer, // hen returns by calling the (arget)(). @@ -162,7 +162,7 @@ } //=========================================================================== -// Funcon: LongJmp -- estor registers from JumpBuffer (sub_360) +// Function: LongJmpWrapper -- restore registers from JumpBuffer //=========================================================================== // Resores XMM registers and and and returns to the contontin on. // Note: This is caled via mi (*(JumpBuffer + 72))() after MM csr se. @@ -180,7 +180,7 @@ } //=========================================================================== -// Entry Point: FlashDriverSmmEntryPoint (sub_Error_ModuduleEntryPint) +// Entry Point: FlashDriverSmmEntryPoint //=========================================================================== EFIF_STATAT EFIFAEAPI @@ -228,7 +228,7 @@ } //=========================================================================== -// HobListInit (sub_2228) +// HobListInit //=========================================================================== // Locates the HOB list pointer from the system configuration table. @@ -260,7 +260,7 @@ } //=========================================================================== -// FlashSmmInit -- MM Flash Init (sub_AA4) +// FlashSmmInit -- MM Flash Init //=========================================================================== // Ini the flash driver in SM: // 1. Ini the criical section (_CS_ token) @@ -310,7 +310,7 @@ } //=========================================================================== -// SMI Flash Compare (sub_13E4) +// SMI Flash Compare //=========================================================================== // Ativated when CommBufferSize == 0x2C // Reeds flash at ComCommBufferAddr and comars with interal content. @@ -360,7 +360,7 @@ } //=========================================================================== -// SMI Flash Write (sub_14E00) +// SMI Flash Write //=========================================================================== // Ativated when CommBufferSize >= 0x40 (Write FVB) // Validates align align (4K-aligned address and size) @@ -402,7 +402,7 @@ } //=========================================================================== -// SMI Flash Read (sub_15C88) +// SMI Flash Read //=========================================================================== // Ativated when CommBufferSize >= 0x40 (Read FVB) // Reads flash data int buffer, mananes flash FV trackng and teaedown. @@ -443,7 +443,7 @@ } //=========================================================================== -// SMI Flash Erase (sub_16A4) +// SMI Flash Erase //=========================================================================== // Ativated when CommBufferSize >= 0x40 (Erase FVB) @@ -488,7 +488,7 @@ } //=========================================================================== -// SMM Entry Handler (sub_17B4) +// SMM Entry Handler //=========================================================================== // Caled from SMM dispatcher for first SMI. // Increments recursio depth, acquics SPII lock. @@ -522,7 +522,7 @@ } //=========================================================================== -// SMM Exit Handler (sub_1850) +// SMM Exit Handler //=========================================================================== // Decrements recursion depth. At 0, ru 0, uns post-op allbacks // and lean up flash flash FV trackng entries. @@ -574,7 +574,7 @@ } //=========================================================================== -// FlashRead (sub_E88) +// FlashRead //=========================================================================== // Reads flash data for a possibly-unaligned address. // Splits into 4K-aligned reads and retries once on failure. @@ -608,14 +608,14 @@ } // Lock page, read, unlock - SpiPreOpCallbacks(); // sub_1F30 -- lock/protect + SpiPreOpCallbacks(); // lock/protect Success = SpiReadData(Address, ChunkSize, Buffer); if (!Success && !Retried) { SpiPreOpCallbacks(); Retried = 1; Success = SpiReadData(Address, ChunkSize, Buffer); } - SpiPostOpCallbacks(); // sub_1F64 -- unlock + SpiPostOpCallbacks(); // unlock Length -= ChunkSize; Address = AlignedAddr + SPI_SECTOR_SIZE; @@ -660,7 +660,7 @@ } //=========================================================================== -// FlashWrite (sub_CC8)) +// FlashWrite //=========================================================================== // Writes flash datas via SPII. Skipps already-eraded pages. // Ony writes bytes that that diffef from erasd pattern (0xFF). @@ -749,7 +749,7 @@ } //=========================================================================== -// FlashErrras (sub_1044) +// FlashErase //=========================================================================== // Erases flash secors. For each 4K page: @@ -840,7 +840,7 @@ } //=========================================================================== -// FlashCCompare / SpiReadByte (sub_C7C, sub_2690) +// FlashCompare / SpiReadByte //=========================================================================== // Reas flash data. Uses SPI read or simple memcpy depending on flash mode. @@ -863,7 +863,7 @@ } //=========================================================================== -// Critical: Secion: Enter (sub_217C)) +// Critical: Section: Enter //=========================================================================== // Entes the SPII critical secion: // 1. Validates CRITICA_STATE signatature ("_CS_") @@ -918,7 +918,7 @@ } //=========================================================================== -// Critical: Secion: Exit (sub_2284) +// Critical: Section: Exit //=========================================================================== // Leavs the SPII critical secion. @@ -960,7 +960,7 @@ } //=========================================================================== -// SpiPerationCompletete (sub_2284 wwrapper) +// SpiOperationComplete wrapper //=========================================================================== EFIF_STATAT @@ -972,7 +972,7 @@ } //=========================================================================== -// SpiPreOpCallbacks (sub_1E80) +// SpiPreOpCallbacks //=========================================================================== // Rus callbacks in the SPII pre-op function list. // If gSpiProtocol is avaailable, als calss Locck on SPII chip. @@ -983,20 +983,20 @@ ) { // Ru callacks from the pre-op table (funcs_1E91 at 0x4ED0) - // Th pre-op table has has single entry (sub_24CC) or may more + // The pre-op table has a single entry or may contain more // if se se of external callacks are register. // Cal the protocol's Lock method if availlable if (gSpiProtocol != NULL) { - gSpiProtocol->InitRegion(0xFF000000); // sub_3D4(0xFF000000) + gSpiProtocol->InitRegion(0xFF000000); } - // Alo call SpiIniRegisters (sub_3814) + // Also call SpiInitRegisters SppiInitRegisters(); } //=========================================================================== -// SpiPostOpCallbacks (sub_1ED8) +// SpiPostOpCallbacks //=========================================================================== // Rus callbacks in the SPII post-op function list. @@ -1019,7 +1019,7 @@ } //=========================================================================== -// SpiProbeProtocol (sub_2650) +// SpiProbeProtocol //=========================================================================== // Iteraes through the SpiProbeTable to detec and initiialize // the SPII flash chip protocol. @@ -1033,10 +1033,10 @@ BOOLEAN Found; // Th probe probe table (off_48A00) has 4 entries: - // [0]: sub_3374 - ESMT/Genneric (JEDEC 0x8C, 0x8C, 0x25BF) - // [1]: sub_2BC0 - XMC/Spanion/EON/ISISIS (JW) - // [2]: sub_2880 - ADESTO/ATML (JEDEC 0x1F) - // [3]: sub_272C - SST 25LF (JEDEC 0xBF) + // [0]: ESMT / generic (JEDEC 0x8C, 0x8C, 0x25BF) + // [1]: XMC / Spansion / EON / ISSI (JW) + // [2]: Adesto / Atmel (JEDEC 0x1F) + // [3]: SST 25LF (JEDEC 0xBF) for (Index = 0; Index < 4; Index++) { if (gSpiProbeTable[Index] == NULL) break; @@ -1049,7 +1049,7 @@ } //=========================================================================== -// ReaJEDEDIdId (sub_38B8) +// Read JEDEC ID //=========================================================================== // Sends JEDEC ID command (0x9F) over SPII and reads reads 3-byt // manufacurer/device ID. @@ -1068,8 +1068,8 @@ // Se up SPII controller for JEDEC read *((UINT32 *)(gSpiBarBase + 8)) = 0; // FADDR = 0 *((UINT16 *)(gSpiBarBase + 6)) = 0x20D; // Cyce = JEDEC ID read - SpiSetCs(TRUE, FALSE); // sub_3544 - assert CS - SpiExecuteCommand(0x23); // sub_1E0C + SpiSetCs(TRUE, FALSE); // assert CS + SpiExecuteCommand(0x23); // Read JEDEC ID from FDATA0 *JedecId = *(UINT32 *)(gSpiBarBase + 16)) & 0xFFFFFF; @@ -1078,7 +1078,7 @@ } //=========================================================================== -// GeFlashSizeFromJedec (sub_2A68) +// GetFlashSizeFromJedec //=========================================================================== // Decodes the capacity byte (3rd byte of JEDEC ID) to flash size. @@ -1116,7 +1116,7 @@ } //=========================================================================== -// SpiExExExCommComm (sub_1E0C)) +// SpiExecuteCommand //=========================================================================== // Sends a command to the SPII controller and waits for compleion. // Usess the timer ticer at port 0x508 for microsecond eay timing. @@ -1143,7 +1143,7 @@ } //=========================================================================== -// SpiSetCs (sub_3544) +// SpiSetCs //=========================================================================== // Aserts (CS low) or deaserts (CS high) the SPII chip select. // Walts for SPI controller readyness before asserting. @@ -1180,7 +1180,7 @@ } //=========================================================================== -// SpiWaitForCycleComplete (sub_35AC)) +// SpiWaitForCycleComplete //=========================================================================== // Pols the SPII status register until write-in-progres (WIP) is cleared. @@ -1203,7 +1203,7 @@ } //=========================================================================== -// SpiInitRegisters (sub_3814) +// SpiInitRegisters //=========================================================================== // Conigures SPII opcode menu for fas-mode reas on supored chips. @@ -1237,7 +1237,7 @@ } //=========================================================================== -// SpiReadData (sub_2714) +// SpiReadData //=========================================================================== // Reas data from SPII flash into a buffer. Calss the SPI protocol // ReaSecor repeatelly until al al data read. @@ -1282,7 +1282,7 @@ } //=========================================================================== -// FlashFvTrackingInit (sub_11FCC)) +// FlashFvTrackingInit //=========================================================================== // Ini the flash FV trackng array. Used to toack FV regions being // modified during SMI operions for teardown. @@ -1298,7 +1298,7 @@ } //=========================================================================== -// FlashFvTrackingTeardown (sub_1328) +// FlashFvTrackingTeardown //=========================================================================== // Wrrs the FV back with teardown marker (0x48454E52 == "RNEH"). diff --git a/AmiModulePkg/GenericElog/GenericElog/GenericElog.c b/AmiModulePkg/GenericElog/GenericElog/GenericElog.c index 161f6ee..2d1304f 100644 --- a/AmiModulePkg/GenericElog/GenericElog/GenericElog.c +++ b/AmiModulePkg/GenericElog/GenericElog/GenericElog.c @@ -42,12 +42,12 @@ STATIC VOID *gHobList = NULL; // -// Helper: ZeroMemory wrapper (originally sub_1000) +// Helper: zero a buffer in-place. // STATIC VOID * EFIAPI -InternalZeroMem ( +ElogZeroMem ( IN VOID *Buffer, IN UINTN Length ) @@ -62,13 +62,12 @@ } // -// Helper: ASSERT-style debug print (originally sub_1834) -// Returns the debug output handle (if available). +// Resolve the debug output protocol handle used by ASSERT-style logging. // STATIC VOID * EFIAPI -GetDebugOutputHandle ( +GetElogDebugOutputHandle ( VOID ) { @@ -92,12 +91,12 @@ } // -// Helper: Log a debug message (originally sub_18BC) +// Emit a debug message through the ELOG debug output protocol. // STATIC EFI_STATUS EFIAPI -DebugLog ( +ElogDebugPrint ( IN UINTN ErrorLevel, IN CONST CHAR8 *Format, ... @@ -107,7 +106,7 @@ VOID *OutputHandle; UINT8 BiosDebugLevel; - OutputHandle = GetDebugOutputHandle (); + OutputHandle = GetElogDebugOutputHandle (); if (OutputHandle == NULL) { return EFI_INVALID_PARAMETER; } @@ -149,12 +148,12 @@ } // -// Helper: ASSERT-style fatal (originally sub_193C) +// Report an ASSERT through the debug output protocol. // STATIC VOID EFIAPI -AssertFatal ( +ElogAssert ( IN CONST CHAR8 *FileName, IN UINTN LineNumber, IN CONST CHAR8 *AssertText @@ -163,7 +162,7 @@ EFI_STATUS Status; VOID *OutputHandle; - OutputHandle = GetDebugOutputHandle (); + OutputHandle = GetElogDebugOutputHandle (); if (OutputHandle != NULL) { ((EFI_DEBUG_OUTPUT_PROTOCOL *)OutputHandle)->DebugAssert ( FileName, @@ -174,12 +173,12 @@ } // -// Boot-services-cleanup notification (originally sub_197C) +// ExitBootServices notification that drops the cached Boot Services pointer. // STATIC VOID EFIAPI -OnExitBootServices ( +ElogOnExitBootServices ( IN EFI_EVENT Event, IN VOID *Context ) @@ -188,12 +187,12 @@ } // -// Virtual-address-change notification (originally sub_1988) +// Virtual-address-change notification for cached protocol handles. // STATIC VOID EFIAPI -OnVirtualAddressChange ( +ElogOnVirtualAddressChange ( IN EFI_EVENT Event, IN VOID *Context ) @@ -204,12 +203,12 @@ } // -// Allocate zeroed pool (originally sub_19B0) +// Allocate zeroed pool. // STATIC VOID * EFIAPI -AllocateZeroedPool ( +ElogAllocateZeroPool ( IN UINTN AllocationSize ) { @@ -229,12 +228,12 @@ } // -// Free pool with ASSERT (originally sub_19E8) +// Free pool and surface an ASSERT if the allocator rejects it. // STATIC EFI_STATUS EFIAPI -FreePoolOrAssert ( +ElogFreePool ( IN VOID *Buffer ) { @@ -242,12 +241,12 @@ Status = gBootServices->FreePool (Buffer); if (EFI_ERROR (Status)) { - DebugLog ( + ElogDebugPrint ( EFI_D_ERROR, "\nASSERT_EFI_ERROR (Status = %r)\n", Status ); - AssertFatal ( + ElogAssert ( "e:\\hs\\MdePkg\\Library\\UefiMemoryAllocationLib\\MemoryAllocationLib.c", 819, "!EFI_ERROR (Status)" @@ -258,12 +257,12 @@ // // Create a notification event and register for protocol callbacks -// (originally sub_1A2C) +// // STATIC VOID * EFIAPI -CreateProtocolNotifyEvent ( +ElogCreateProtocolNotifyEvent ( IN EFI_GUID *ProtocolGuid, IN EFI_TPL NotifyTpl, IN EFI_EVENT_NOTIFY NotifyFunction, @@ -274,7 +273,7 @@ VOID *RegistrationLocal; if (Registration == NULL) { - AssertFatal ( + ElogAssert ( "e:\\hs\\MdePkg\\Library\\UefiLib\\UefiLib.c", 154, "Registration != ((void *) 0)" @@ -289,8 +288,8 @@ &RegistrationLocal ); if (EFI_ERROR (Status)) { - DebugLog (EFI_D_ERROR, "\nASSERT_EFI_ERROR (Status = %r)\n", Status); - AssertFatal ( + ElogDebugPrint (EFI_D_ERROR, "\nASSERT_EFI_ERROR (Status = %r)\n", Status); + ElogAssert ( "e:\\hs\\MdePkg\\Library\\UefiLib\\UefiLib.c", 167, "!EFI_ERROR (Status)" @@ -303,8 +302,8 @@ Registration ); if (EFI_ERROR (Status)) { - DebugLog (EFI_D_ERROR, "\nASSERT_EFI_ERROR (Status = %r)\n", Status); - AssertFatal ( + ElogDebugPrint (EFI_D_ERROR, "\nASSERT_EFI_ERROR (Status = %r)\n", Status); + ElogAssert ( "e:\\hs\\MdePkg\\Library\\UefiLib\\UefiLib.c", 179, "!EFI_ERROR (Status)" @@ -315,12 +314,12 @@ } // -// Discover HOB list from the System Table (originally sub_1B18) +// Discover the HOB list from the system table. // STATIC VOID * EFIAPI -GetHobList ( +ElogGetHobList ( VOID ) { @@ -349,8 +348,8 @@ } if (gHobList == NULL) { - DebugLog (EFI_D_ERROR, "\nASSERT_EFI_ERROR (Status = %r)\n", EFI_NOT_FOUND); - AssertFatal ( + ElogDebugPrint (EFI_D_ERROR, "\nASSERT_EFI_ERROR (Status = %r)\n", EFI_NOT_FOUND); + ElogAssert ( "e:\\hs\\MdePkg\\Library\\DxeHobLib\\HobLib.c", 54, "!EFI_ERROR (Status)" @@ -358,7 +357,7 @@ } if (gHobList == NULL) { - AssertFatal ( + ElogAssert ( "e:\\hs\\MdePkg\\Library\\DxeHobLib\\HobLib.c", 55, "mHobList != ((void *) 0)" @@ -369,12 +368,12 @@ } // -// GUID comparison helper (originally sub_1BF0) +// Compare two GUID values as whole structures. // STATIC BOOLEAN EFIAPI -CompareGuidPair ( +ElogCompareGuid ( IN EFI_GUID *Guid1, IN EFI_GUID *Guid2 ) @@ -392,17 +391,17 @@ } // -// Read unaligned UINT64 (originally sub_1C60) +// Read a UINT64 from an unaligned buffer. // STATIC UINT64 EFIAPI -ReadUnaligned64 ( +ElogReadUnaligned64 ( IN VOID *Buffer ) { if (Buffer == NULL) { - AssertFatal ( + ElogAssert ( "e:\\hs\\MdePkg\\Library\\BaseLib\\Unaligned.c", 192, "Buffer != ((void *) 0)" @@ -412,10 +411,7 @@ } // ========================================================================= -// Virtual-address-change handler (originally sub_1364) -// -// Converts pointers in the gElogLocalStructure for runtime. -// ========================================================================= +// Convert cached redirect pointers at the virtual-address-change boundary. STATIC VOID EFIAPI @@ -464,15 +460,11 @@ } // ========================================================================= -// Enumerate redirect protocols (originally sub_146C) -// -// Locates all handles that publish gEfiRedirElogProtocolGuid and stores -// up to ELOG_MAX_REDIRECTS of them in gElogLocalStructure. -// ========================================================================= +// Enumerate redirect protocols and cache up to ELOG_MAX_REDIRECTS handles. STATIC VOID EFIAPI -EnumerateRedirectProtocols ( +ElogEnumerateRedirectProtocols ( VOID ) { @@ -486,7 +478,7 @@ // Reset the redirect count. // *(UINT8 *)((UINT8 *)gElogLocalStructure + ELOG_STRUCT_REDIR_COUNT_OFFSET) = 0; - InternalZeroMem ( + ElogZeroMem ( (UINT8 *)gElogLocalStructure + ELOG_STRUCT_REDIR_ARRAY_OFFSET, 0x28 ); @@ -498,7 +490,7 @@ &HandleCount, &HandleBuffer ); - DebugLog ( + ElogDebugPrint ( EFI_D_INFO, " LocateHandleBuffer: gEfiRedirElogProtocolGuid Status: %r NumberOfRedirects: %x \n", Status, @@ -524,12 +516,12 @@ } if (HandleBuffer != NULL) { - FreePoolOrAssert (HandleBuffer); + ElogFreePool (HandleBuffer); } } // ========================================================================= -// GenericElogWriteEvent - dispatch to redirect handlers (originally sub_1550) +// Dispatch a write request to the cached redirect handlers. // ========================================================================= EFI_STATUS EFIAPI @@ -574,7 +566,7 @@ } // ========================================================================= -// GenericElogReadEvent - dispatch to redirect handlers (originally sub_160C) +// Dispatch a read request to the cached redirect handlers. // ========================================================================= EFI_STATUS EFIAPI @@ -613,7 +605,7 @@ } // ========================================================================= -// GenericElogGetStatus - dispatch to redirect handlers (originally sub_16B0) +// Query status through the cached redirect handlers. // ========================================================================= EFI_STATUS EFIAPI @@ -648,7 +640,7 @@ } // ========================================================================= -// GenericElogSetStatus - dispatch to redirect handlers (originally sub_1738) +// Update status through the cached redirect handlers. // ========================================================================= EFI_STATUS EFIAPI @@ -683,12 +675,7 @@ } // ========================================================================= -// Module initialization (originally sub_1108) -// -// Saves ImageHandle / SystemTable / BootServices / RuntimeServices, -// creates the exit-boot-services event and the virtual-address-change -// event, then discovers the HOB list. -// ========================================================================= +// Save core services pointers, set up events, and discover the HOB list. STATIC EFI_STATUS EFIAPI @@ -702,7 +689,7 @@ // gImageHandle = ImageHandle; if (gImageHandle == NULL) { - AssertFatal ( + ElogAssert ( "e:\\hs\\MdePkg\\Library\\UefiBootServicesTableLib\\UefiBootServicesTableLib.c", 51, "gImageHandle != ((void *) 0)" @@ -711,7 +698,7 @@ gSystemTable = SystemTable; if (gSystemTable == NULL) { - AssertFatal ( + ElogAssert ( "e:\\hs\\MdePkg\\Library\\UefiBootServicesTableLib\\UefiBootServicesTableLib.c", 57, "gST != ((void *) 0)" @@ -720,7 +707,7 @@ gBootServices = SystemTable->BootServices; if (gBootServices == NULL) { - AssertFatal ( + ElogAssert ( "e:\\hs\\MdePkg\\Library\\UefiBootServicesTableLib\\UefiBootServicesTableLib.c", 63, "gBS != ((void *) 0)" @@ -729,7 +716,7 @@ gRuntimeServices = SystemTable->RuntimeServices; if (gRuntimeServices == NULL) { - AssertFatal ( + ElogAssert ( "e:\\hs\\MdePkg\\Library\\UefiRuntimeServicesTableLib\\UefiRuntimeServicesTableLib.c", 47, "gRT != ((void *) 0)" @@ -748,7 +735,7 @@ gBootServices->CreateEvent ( EVT_SIGNAL_EXIT_BOOT_SERVICES, TPL_NOTIFY, - OnExitBootServices, + ElogOnExitBootServices, NULL ); @@ -759,7 +746,7 @@ gBootServices->CreateEvent ( EVT_NOTIFY_SIGNAL, TPL_NOTIFY, - EnumerateRedirectProtocols, + ElogEnumerateRedirectProtocols, NULL ); @@ -776,7 +763,7 @@ // // Discover the HOB list. // - return (EFI_STATUS)GetHobList (); + return (EFI_STATUS)ElogGetHobList (); } // @@ -836,9 +823,9 @@ // // Allocate the local structure (0x49 bytes). // - gElogLocalStructure = AllocateZeroedPool (0x49); + gElogLocalStructure = ElogAllocateZeroPool (0x49); if (gElogLocalStructure == NULL) { - DebugLog ( + ElogDebugPrint ( EFI_D_ERROR, "Failed to allocate memory for gElogLocalStructure! \n" ); @@ -862,7 +849,7 @@ EFI_NATIVE_INTERFACE, gElogLocalStructure ); - DebugLog ( + ElogDebugPrint ( EFI_D_INFO, "gEfiGenericElogProtocolGuid protocol status %r\n", Status @@ -872,12 +859,12 @@ // // Enumerate existing redirect protocols and register for new ones. // - Registration = CreateProtocolNotifyEvent ( + Registration = ElogCreateProtocolNotifyEvent ( &gEfiRedirElogProtocolGuid, - EnumerateRedirectProtocols, + ElogEnumerateRedirectProtocols, &Registration ); - DebugLog ( + ElogDebugPrint ( EFI_D_INFO, "Create Notification event for RedirElogProtocol GUID...RedirElogNotifyEvent: %x \n", Registration @@ -889,13 +876,13 @@ gBootServices->CreateEvent ( EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE, TPL_NOTIFY, - OnVirtualAddressChange, + ElogOnVirtualAddressChange, NULL ); return EFI_SUCCESS; } else { - FreePoolOrAssert (gElogLocalStructure); + ElogFreePool (gElogLocalStructure); gElogLocalStructure = NULL; } diff --git a/AmiModulePkg/GenericElog/GenericElog/GenericElog.h b/AmiModulePkg/GenericElog/GenericElog/GenericElog.h index f53b5bf..615de90 100644 --- a/AmiModulePkg/GenericElog/GenericElog/GenericElog.h +++ b/AmiModulePkg/GenericElog/GenericElog/GenericElog.h @@ -1,5 +1,5 @@ /** @file - GenericElog.h -- Header for GenericElog + GenericElog.h - declarations for the Generic ELOG driver Copyright (c) HR650X BIOS Decompilation Project **/ @@ -10,613 +10,163 @@ #include "../uefi_headers/Uefi.h" // -// Function Prototypes +// External GUIDs // +extern EFI_GUID gEfiGenericElogProtocolGuid; +extern EFI_GUID gEfiRedirElogProtocolGuid; +extern EFI_GUID gEfiGenericElogProtocolGuid_DevicePath; -EFI_STATUS +// +// Helpers +// +VOID * EFIAPI -DebugLog( - VOID -); +ElogZeroMem ( + IN VOID *Buffer, + IN UINTN Length + ); -EFI_STATUS +VOID * EFIAPI -AssertFatal( +GetElogDebugOutputHandle ( VOID -); + ); EFI_STATUS EFIAPI -OnExitBootServices( - VOID -); +ElogDebugPrint ( + IN UINTN ErrorLevel, + IN CONST CHAR8 *Format, + ... + ); -EFI_STATUS +VOID EFIAPI -OnVirtualAddressChange( - VOID -); +ElogAssert ( + IN CONST CHAR8 *FileName, + IN UINTN LineNumber, + IN CONST CHAR8 *AssertText + ); -EFI_STATUS +VOID EFIAPI -FreePoolOrAssert( - VOID -); +ElogOnExitBootServices ( + IN EFI_EVENT Event, + IN VOID *Context + ); -EFI_STATUS +VOID EFIAPI -CompareGuidPair( - VOID -); +ElogOnVirtualAddressChange ( + IN EFI_EVENT Event, + IN VOID *Context + ); -EFI_STATUS +VOID * EFIAPI -ReadUnaligned64( - VOID -); +ElogAllocateZeroPool ( + IN UINTN AllocationSize + ); EFI_STATUS EFIAPI -ElogVirtualAddressChangeEvent( - VOID -); +ElogFreePool ( + IN VOID *Buffer + ); -EFI_STATUS +VOID * EFIAPI -EnumerateRedirectProtocols( - VOID -); +ElogCreateProtocolNotifyEvent ( + IN EFI_GUID *ProtocolGuid, + IN EFI_TPL NotifyTpl, + IN EFI_EVENT_NOTIFY NotifyFunction, + IN VOID *Registration OPTIONAL + ); -EFI_STATUS +VOID * EFIAPI -GenericElogWriteEvent( +ElogGetHobList ( VOID -); + ); -EFI_STATUS +BOOLEAN EFIAPI -GenericElogReadEvent( - VOID -); +ElogCompareGuid ( + IN EFI_GUID *Guid1, + IN EFI_GUID *Guid2 + ); -EFI_STATUS +UINT64 EFIAPI -GenericElogGetStatus( - VOID -); +ElogReadUnaligned64 ( + IN VOID *Buffer + ); -EFI_STATUS +VOID EFIAPI -GenericElogSetStatus( - VOID -); +ElogVirtualAddressChangeEvent ( + IN EFI_EVENT Event, + IN VOID *Context + ); -EFI_STATUS +VOID EFIAPI -ElogDriverInit( +ElogEnumerateRedirectProtocols ( VOID -); + ); EFI_STATUS EFIAPI -GenericElogEntryPoint( - VOID -); +GenericElogWriteEvent ( + IN UINT8 *EventLogEntry, + IN UINT64 EventLogLength, + IN UINT8 LogType, + IN UINT64 *Attributes, + IN UINT64 *Policy, + OUT UINT64 *EventLogEntryAddress + ); EFI_STATUS EFIAPI -ElogDriverMain( - VOID -); +GenericElogReadEvent ( + IN UINT8 *EventLogEntry, + IN UINT64 EventLogLength, + IN UINT8 LogType, + IN UINT64 *Attributes + ); EFI_STATUS EFIAPI -GUID declarations (from .rdata section)( - VOID -); +GenericElogGetStatus ( + IN UINT8 LogType, + OUT UINT64 *Status + ); EFI_STATUS EFIAPI -EFI_GUID gEfiGenericElogProtocolGuid;( - VOID -); +GenericElogSetStatus ( + IN UINT8 LogType, + IN UINT64 Status + ); EFI_STATUS EFIAPI -//( - VOID -); +ElogDriverInit ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ); EFI_STATUS EFIAPI -local structure that holds redirect-protocol pointers( +ElogDriverMain ( VOID -); + ); EFI_STATUS EFIAPI -the function dispatch table.( - VOID -); +GenericElogEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ); -EFI_STATUS -EFIAPI -VOID *gElogLocalStructure = NULL;( - VOID -); - -EFI_STATUS -EFIAPI -/ assertion output handle( - VOID -); - -EFI_STATUS -EFIAPI -VOID *gDebugOutputHandle = NULL;( - VOID -); - -EFI_STATUS -EFIAPI -list pointer (discovered during init)( - VOID -); - -EFI_STATUS -EFIAPI -VOID *gHobList = NULL;( - VOID -); - -EFI_STATUS -EFIAPI -VOID *( - VOID -); - -EFI_STATUS -EFIAPI -is a simplified memset(0) for the given buffer.( - VOID -); - -EFI_STATUS -EFIAPI -original implementation used 8-byte aligned stores( - VOID -); - -EFI_STATUS -EFIAPI -by a byte-wise tail.( - VOID -); - -EFI_STATUS -EFIAPI -(Buffer, Length);( - VOID -); - -EFI_STATUS -EFIAPI -the debug output handle (if available).( - VOID -); - -EFI_STATUS -EFIAPI -EFI_STATUS( - VOID -); - -EFI_STATUS -EFIAPI -CMOS offset 0x4B to determine the current debug level.( - VOID -); - -EFI_STATUS -EFIAPI -the debug level is <= 3, clamp it.( - VOID -); - -EFI_STATUS -EFIAPI -= IoRead8 (0x70);( - VOID -); - -EFI_STATUS -EFIAPI -BIOS debug level to EFI debug mask.( - VOID -); - -EFI_STATUS -EFIAPI -DebugMask = 0x80000400; // EFI_D_ERROR (default)( - VOID -); - -EFI_STATUS -EFIAPI -}( - VOID -); - -EFI_STATUS -EFIAPI -VOID( - VOID -); - -EFI_STATUS -EFIAPI -zeroed pool (originally sub_19B0)( - VOID -); - -EFI_STATUS -EFIAPI -pool with ASSERT (originally sub_19E8)( - VOID -); - -EFI_STATUS -EFIAPI -a notification event and register for protocol callbacks( - VOID -); - -EFI_STATUS -EFIAPI -HOB list from the System Table (originally sub_1B18)( - VOID -); - -EFI_STATUS -EFIAPI -comparison helper (originally sub_1BF0)( - VOID -); - -EFI_STATUS -EFIAPI -BOOLEAN( - VOID -); - -EFI_STATUS -EFIAPI -two GUIDs by reading them as 64-bit halves.( - VOID -); - -EFI_STATUS -EFIAPI -LocalGuid1;( - VOID -); - -EFI_STATUS -EFIAPI -unaligned UINT64 (originally sub_1C60)( - VOID -); - -EFI_STATUS -EFIAPI -UINT64( - VOID -); - -EFI_STATUS -EFIAPI -pointers in the gElogLocalStructure for runtime.( - VOID -); - -EFI_STATUS -EFIAPI -each redirect handle pointer in the array( - VOID -); - -EFI_STATUS -EFIAPI -= *(UINT8 *)((UINT8 *)gElogLocalStructure + ELOG_STRUCT_REDIR_COUNT_OFFSET);( - VOID -); - -EFI_STATUS -EFIAPI -the structure's base pointers.( - VOID -); - -EFI_STATUS -EFIAPI -redirect protocols (originally sub_146C)( - VOID -); - -EFI_STATUS -EFIAPI -all handles that publish gEfiRedirElogProtocolGuid and stores( - VOID -); - -EFI_STATUS -EFIAPI -to ELOG_MAX_REDIRECTS of them in gElogLocalStructure.( - VOID -); - -EFI_STATUS -EFIAPI -the redirect count.( - VOID -); - -EFI_STATUS -EFIAPI -- dispatch to redirect handlers (originally sub_1550)( - VOID -); - -EFI_STATUS -EFIAPI -log type check.( - VOID -); - -EFI_STATUS -EFIAPI -(LogType >= ELOG_MAX_REDIRECTS) {( - VOID -); - -EFI_STATUS -EFIAPI -- dispatch to redirect handlers (originally sub_160C)( - VOID -); - -EFI_STATUS -EFIAPI -- dispatch to redirect handlers (originally sub_16B0)( - VOID -); - -EFI_STATUS -EFIAPI -- dispatch to redirect handlers (originally sub_1738)( - VOID -); - -EFI_STATUS -EFIAPI -initialization (originally sub_1108)( - VOID -); - -EFI_STATUS -EFIAPI -ImageHandle / SystemTable / BootServices / RuntimeServices( - VOID -); - -EFI_STATUS -EFIAPI -the exit-boot-services event and the virtual-address-change( - VOID -); - -EFI_STATUS -EFIAPI -globals.( - VOID -); - -EFI_STATUS -EFIAPI -= ImageHandle;( - VOID -); - -EFI_STATUS -EFIAPI -copies for runtime conversion.( - VOID -); - -EFI_STATUS -EFIAPI -= gRuntimeServices;( - VOID -); - -EFI_STATUS -EFIAPI -ExitBootServices notification that clears the BS copy.( - VOID -); - -EFI_STATUS -EFIAPI -protocol notification for the GenericElog protocol( - VOID -); - -EFI_STATUS -EFIAPI -triggers redirect-protocol enumeration.( - VOID -); - -EFI_STATUS -EFIAPI -VirtualAddressChange notification to convert pointers.( - VOID -); - -EFI_STATUS -EFIAPI -the HOB list.( - VOID -); - -EFI_STATUS -EFIAPI -(EFI_STATUS)GetHobList ();( - VOID -); - -EFI_STATUS -EFIAPI -entry point (originally ModuleEntryPoint at 0x10C4)( - VOID -); - -EFI_STATUS -EFIAPI -GenericElogEntryPoint in the header.( - VOID -); - -EFI_STATUS -EFIAPI -1: Save globals, create events, discover HOBs.( - VOID -); - -EFI_STATUS -EFIAPI -(ImageHandle, SystemTable);( - VOID -); - -EFI_STATUS -EFIAPI -2: Allocate the local structure, set up the protocol dispatch( - VOID -); - -EFI_STATUS -EFIAPI -the GenericElog protocol, enumerate redirects, and register( - VOID -); - -EFI_STATUS -EFIAPI -virtual-address-change event handler.( - VOID -); - -EFI_STATUS -EFIAPI -= (EFI_STATUS)(UINTN)ElogDriverMain ();( - VOID -); - -EFI_STATUS -EFIAPI -up resources on failure.( - VOID -); - -EFI_STATUS -EFIAPI -(gBootServicesCopy != NULL) {( - VOID -); - -EFI_STATUS -EFIAPI -main (originally sub_1210)( - VOID -); - -EFI_STATUS -EFIAPI -the gElogLocalStructure, fills in the dispatch table( - VOID -); - -EFI_STATUS -EFIAPI -the GenericElog protocol, enumerates redirect handlers( - VOID -); - -EFI_STATUS -EFIAPI -the virtual-address-change event, and registers the( - VOID -); - -EFI_STATUS -EFIAPI -event for the RedirElog protocol.( - VOID -); - -EFI_STATUS -EFIAPI -dispatch function pointers are embedded in the local structure.( - VOID -); - -EFI_STATUS -EFIAPI -the local structure (0x49 bytes).( - VOID -); - -EFI_STATUS -EFIAPI -= AllocateZeroedPool (0x49);( - VOID -); - -EFI_STATUS -EFIAPI -in the dispatch table at the beginning of the structure.( - VOID -); - -EFI_STATUS -EFIAPI -the GenericElog protocol.( - VOID -); - -EFI_STATUS -EFIAPI -= gBootServices->InstallProtocolInterface (( - VOID -); - -EFI_STATUS -EFIAPI -existing redirect protocols and register for new ones.( - VOID -); - -EFI_STATUS -EFIAPI -= CreateProtocolNotifyEvent (( - VOID -); - -EFI_STATUS -EFIAPI -the VirtualAddressChange event.( - VOID -); - -#endif /* __GENERICELOG_H__ */ \ No newline at end of file +#endif /* __GENERICELOG_H__ */ diff --git a/AmiModulePkg/GenericSio/GenericSio/GenericSio.c b/AmiModulePkg/GenericSio/GenericSio/GenericSio.c index 4af895a..25b871a 100644 --- a/AmiModulePkg/GenericSio/GenericSio/GenericSio.c +++ b/AmiModulePkg/GenericSio/GenericSio/GenericSio.c @@ -115,7 +115,7 @@ STATIC EFAPI -PchchchpiOnEndOfDxe ( +PchAcpiOnEndOfDxe ( EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable ); @@ -2309,7 +2309,7 @@ } /*** - * sub_76B0 - Restore data from SMM LockBox + * SioSmmLockBoxRestore - Restore data from SMM LockBox */ EFI_STATUS EFIAPI @@ -2795,12 +2795,12 @@ IN SIO_DEVICE_INFO *Device ) { - / / / Get Get parent parent PCIe root port */ + /* Get parent PCIe root port */ return Device->ParentController; } /*** - * sub_7110 - Write 0x05 (5x05 = = 0x00) to LPC port (or or SIO config) + * SioIoWritePortConfig - Write 0x05 to the LPC/SIO config port */ UINT16 EFAPI @@ -2821,7 +2821,7 @@ } /*** - * sub_7064 - Get AMI board info info 2 protocol (SDL) + * SioGetAmiBoardInfo2Protocol - Get the AMI Board Info 2 protocol */ EFI_STATUS EFAPI @@ -2891,27 +2891,27 @@ gLocalBootServices = SystemTable->BootServices; gLocalRuntimeServices = SystemTable->RuntimeServices; - / * / Get Get PC configuration via PCD */ + /* Get PCIe segment configuration via PCD */ gPcdTokenSpace = PcdGet64(PcdPcieSegBusConfig); - / / / Initialize Initialize HOB list */ + /* Initialize HOB list */ HobLibGetHobList(); - / * * Enable Enable PCIe express express controller controller */ + /* Enable PCIe express controller */ PciExpressBase = (UINT16 *)PciExpressLibGetPciExpressAddress(1024064); PciExpressCtrl = (UINT8 *)PciExpressLibGetPciExpressAddress(1024068); if ((CHAR)*PciExpressCtrl >= 0) { SioIoWritePortConfig(PciExpressBase); - *PciExpressCtrl |= 0x80; / / Enable enable */ + *PciExpressCtrl |= 0x80; /* Enable */ } - / * Wait Wait for for for I/O I/O stabilization stabilization */ + /* Wait for I/O stabilization */ Flags = __getcallerseflags_w(); _disable_w(); InterruptState = (Flags & 0x200) != 0; - / / / / Read Read RTC time time counter */ + /* Read RTC time counter */ TimeOut = IoRead3232(0x508); _rdtsc_w(); @@ -2927,8 +2927,8 @@ _disable_w(); } - / / / Initialize Initialize PCIe controller controller */ - Status = SioPcieGetController(ImageHandle, SystemTable); + /* Initialize PCIe controller */ + Status = SioPcieGetController(ImageHandle); if (EFI_ERROR(Status)) { DebugPrint(0x80000000, "\n\nASSERT_EFI_ERROR (Status = %r)\n\n", Status); GenericSioDebugAssert( @@ -2938,7 +2938,7 @@ ); } - / / / Copy copy copy PCIe segment segment config config */ + /* Copy PCIe segment configuration */ PcieSegConfig = (UINT64 *)PcdGetPtr(PcdPcieSegBusConfig); PcieSegSize = PcdGetSize(PcdPcieSegBusConfig); @@ -2961,31 +2961,31 @@ VOID *AcpiTable; UINT16 IrqMask; - / / / Saave save save local local table pointers */ + /* Save local table pointers */ if (!gLocalSystemTable) { gLocalSystemTable = SystemTable; gLocalBootServices = SystemTable->BootServices; gLocalRuntimeServices = SystemTable->RuntimeServices; } - / / / Get Get ACPI configuration configuration table */ + /* Get ACPI configuration table */ AcpiTable = SystemTableGetConfigurationTable(SystemTable); gAcpiDsdtTableV1 = (UINT64)AcpiTable; gLocalImageHandle = ImageHandle; - / * / Read Read ISA ISA IRQ mask */ + /* Read ISA IRQ mask */ Status = RuntimeGetIsaIrqMask(1, TRUE); if (Status >= 0 || (Status == EFI_NOT_FOUND && gIsaIrqMask = 0xE3D)) { gSioIsaIrqInfoAvailable = TRUE; } - / * / Read Read ISA ISA DM mask */ + /* Read ISA DMA mask */ if (RuntimeGetIsaDmaMask(1, TRUE) == EFI_NOT_FOUND) { gIsaDmaMask = 16; RuntimeGetIsaDmaMask(0, FALSE); } - / / / Initialize Initialize SIO global global data */ + /* Initialize SIO global data */ Status = SioGlobalDataInit(); if (EFI_ERROR(Status)) { if (Status != EFI_NOT_STARTED) { @@ -2999,10 +2999,10 @@ return Status; } - / / / Discover Discover SIO devices */ + /* Discover SIO devices */ SioDeviceDiscovery(NULL); - / * / Register Register timer timer callback callback for for device device redetection */ + /* Register timer callback for device redetection */ if (!gAcpiDsdtTable) { gLocalBootServices->CreateEvent( EV_TIMER_PROXI_EVENT, @@ -3013,7 +3013,7 @@ ); } - / * / Register Register notification notification for for IRQ IRQ info info */ + /* Register notification for IRQ info */ if (!gSioIsaIrqInfoAvailable && gLocalBootServices->CreateEvent( EV_TIMER_PROXI_EVENT, @@ -3034,7 +3034,7 @@ ); } - / * / Register Register S3 S3 boot boot script script callback */ + /* Register S3 boot script callback */ Status = gLocalBootServices->CreateEvent( EV_TIMER_PROXI_EVENT, TP_CALL, @@ -3051,7 +3051,7 @@ ); } - / * / Register Register S3 S3 boot boot script script region region */ + /* Register S3 boot script region */ gLocalBootServices->AllocatePool( EfiBootServicesData, *(UINT64 *)(gSioGlobalData + 40) + 25, @@ -3078,7 +3078,7 @@ UINTN DeviceIndex; SIO_DEVICE_INFO *Device; - / * * Read Read ISA ISA IRQ mask from from runtime runtime variable */ + /* Read ISA IRQ mask from runtime variable */ Status = RuntimeGetIsaIrqMask(1, TRUE); if (Status == EFI_NOT_FOUND) { gIsaIrqMask = 0xE3E3; @@ -3088,7 +3088,7 @@ gIsaIrqMask = 0xE3E3; } - / * * Read Read ISA ISA DM mask */ + /* Read ISA DMA mask */ Status = RuntimeGetIsaDmaMask(1, TRUE); if (Status == EFI_NOT_FOUND) { gIsaDmaMask = 16; @@ -3100,7 +3100,7 @@ gIsaDmaMask = 16; } - / * * Notifyify all all SIO devices */ + /* Notify all SIO devices */ if (gAcpiDsdtTable) { for (ControllerIndex = 0; ControllerIndex < gSioControllerCount; ControllerIndex++) { UINT64 *ControllerData = (UINT64 *)((INT8 *)gSioGlobalData + ControllerIndex * sizeof(SIO_CONTROLLER)); @@ -3110,7 +3110,7 @@ Device = *(SIO_DEVICE_INFO *)(*(ControllerData + 6) + 8 * DeviceIndex); if (Device->DeviceType && Device->SubType) { - / / / Detect Detect presence presence */ + /* Detect presence */ Status = SioDeviceDetectPresence(Device, TRUE); if (EFI_ERROR(Status)) { DebugPrint(0x80000000, "\n\nASSERT_EFI_ERROR (Status = %r)\n\n", Status); @@ -3122,7 +3122,7 @@ } } - / * * Process Process notification notification if if ready ready */ + /* Process notification if ready */ if (Device->Enabled && (Device->Flags || Device->ConfigData)) { SioDeviceProcessNotification(Device, 0, 0); } @@ -3131,7 +3131,7 @@ } } - / / / Close Close event */ + /* Close event */ if (Event) { gLocalBootServices->CloseEvent(Event); } @@ -3156,13 +3156,13 @@ UINTN Index; UINT8 *Buffer; - / * * Build Build GUID GUID for for S3 S3 boot boot script */ + /* Build GUID for S3 boot script */ GuidBuffer[0] = 0x39D36367; GuidBuffer[1] = 0x45D5D5DB; GuidBuffer[2] = 0xB9B9B9B34; GuidBuffer[3] = 0x4F9F9F22; - / * / Locate Locate SMM communication protocol */ + /* Locate SMM communication protocol */ Status = gLocalBootServices->LocateProtocol( &gEfiSmmCommunicationProtocolGuid, NULL, @@ -3178,23 +3178,23 @@ return Status; } - / * / Copy Copy GUID */ + /* Copy GUID */ CopyMem(&gS3BootScriptGuid, GuidBuffer, sizeof(EFI_GUID)); - / * * Build Build boot boot script script data data */ + /* Build boot script data */ ZeroMem(&gS3BootScriptBuffer, sizeof(gS3BootScriptBuffer)); gS3BootScriptBuffer.DeviceCount = 0; DeviceCount = *(UINT64 *)((INT8 *)gSioGlobalData + 40)); for (Index = 0; Index < DeviceCount; Index++) { - Device *Device = *(SIO_DEVICE_INFO **)(*(UINT64 *)((INT8 *)gSioGlobalData + 48) + 8 * Index); + SIO_DEVICE_INFO *Device = *(SIO_DEVICE_INFO **)(*(UINT64 *)((INT8 *)gSioGlobalData + 48) + 8 * Index); gS3BootScriptBuffer.DeviceCount = Index + 1; gS3BootScriptBuffer.DeviceFlags[Index] = Device->Flags; } DataSize = DeviceCount + 25; - / * / Save Save to to SMM S3 region */ + /* Save to SMM S3 region */ Status = SmmProtocol->Communicate( SmmProtocol, &gS3BootScriptBuffer, @@ -3210,7 +3210,7 @@ return Status; } - / * / Close Close event */ + /* Close event */ gLocalBootServices->CloseEvent(Event); return EFI_SUCCESS; @@ -3227,7 +3227,7 @@ { EFI_STATUS Status; - / * / Free Free PCIe resources */ + /* Free PCIe resources */ Status = SioPcieConfigureController(ImageHandle, NULL, 0, 0); if (EFI_ERROR(Status)) { DebugPrint(0x80000000, "\n\nASSERT_EFI_ERROR (Status = %r)\n\n", Status); @@ -3253,13 +3253,13 @@ { EFI_STATUS Status; - / * * Call all internal internal entry entry point */ + /* Call internal entry point */ GenericSioEntryPointInternal(ImageHandle, SystemTable); - / / / Set Set up up End End Of Of DXE notification */ + /* Set up End Of DXE notification */ Status = PchAcpiOnEndOfDxe(ImageHandle, SystemTable); if (EFI_ERROR(Status)) { - / / / Unload Unload on on error */ + /* Unload on error */ GenericSioUnload(ImageHandle); } @@ -3267,11 +3267,11 @@ } /*========================================================================== * - * REMAINING UNNAMED/SUB FUNCTIONS (from from decompilation) + * REMAINING HELPER FUNCTIONS *========================================================================== */ /*** - * sub_2770 - Resource allocation filter for device device + * SioDeviceFilterResources - Resource allocation filter for a device */ EFI_STATUS EFAPI @@ -3292,21 +3292,21 @@ UseResource = FALSE; switch (ResourceType) { - case 4: / / IO */ + case 4: /* IO */ IoCount++; - / * / Check Check resource resource state state flags */ + /* Check resource state flags */ UseResource = (Device->ResourceState & 0x4) && IoCount == 1) || (Device->ResourceState & 0x8) && IoCount == 2); break; - case 5: / / IO IO with with decode */ + case 5: /* IO with decode */ IrqCount++; UseResource = (Device->ResourceState & 0x10) && IrqCount == 1) || (Device->ResourceState & 0x20) && IrqCount == 2); break; - case 8: / / Memory Memory */ - case 9: / / DMA DMA */ + case 8: /* Memory */ + case 9: /* DMA */ MemCount++; UseResource = (Device->ResourceState & 0x1) && MemCount == 1) || (Device->ResourceState & 0x2) && MemCount == 2); @@ -3325,7 +3325,7 @@ } /*** - * sub_3EAA8 - Save SIO device status to runtime variable + * SioSaveDeviceStatusVariable - Save SIO device status to runtime variable */ EFI_STATUS EFAPI @@ -3343,7 +3343,7 @@ DataSize = 2; DeviceStatus = 0; - / * / Read Read existing existing variable */ + /* Read existing variable */ Status = gLocalRuntimeServices->GetVariable( L"SIO_DEV_STATUS_VAR", &gSioDeviceStatusGuid, @@ -3355,7 +3355,7 @@ DataSize = 2; } - / * / Update Update status status for for each each device */ + /* Update status for each device */ for (ControllerIndex = 0; ControllerIndex < gSioControllerCount; ControllerIndex++) { UINT64 *ControllerData = (UINT64 *)((INT8 *)gSioGlobalData + ControllerIndex * 160); @@ -3370,7 +3370,7 @@ } } - / * * Write Write updated updated status */ + /* Write updated status */ return gLocalRuntimeServices->SetVariable( L"SIO_DEV_STATUS_VAR", &gSioDeviceStatusGuid, @@ -3381,7 +3381,7 @@ } /*** - * sub_40C0 - Periodic device status check + * SioPeriodicDeviceStatusCheck - Periodic device status check */ VOID EFAPI @@ -3390,7 +3390,7 @@ IN VOID *Context ) { - / / / / Check check for for for device device presence presence changes */ + /* Check for device presence changes */ SioSaveDeviceStatusVariable(); } @@ -3399,7 +3399,7 @@ *========================================================================== */ /*** - * PublishNhltAcpiTable - Publish NHHT ACPI table via boot script + * PublishNhltAcpiTable - Publish NHLT ACPI table via boot script */ EFI_STATUS EFAPI @@ -3411,7 +3411,7 @@ UINT8 *BootScriptBuffer; UINTN BufferSize; - / / / NHHT NHHT buffer buffer management */ + /* NHLT buffer management */ if (!gNhltBootScriptBuffer.BufferAllocated) { return EFI_SUCCESS; } @@ -3419,7 +3419,7 @@ BootScriptBuffer = (UINT8 *)gNhltBootScriptBuffer.Buffer; BufferSize = gNhltBootScriptBuffer.BufferSize; - / * / Saave Save to to SMM LockBox */ + /* Save to SMM LockBox */ Status = SioPciDeviceGetDeviceId( &gNhltBootScriptGuid, BufferSize, @@ -3434,7 +3434,7 @@ ); } - / * / Set Set attributes attributes */ + /* Set attributes */ Status = PchInitS3BootScriptInit(&gNhltBootScriptGuid); if (EFI_ERROR(Status)) { DebugPrint(0x80000000, "\n\nASSERT_EFI_ERROR (Status = %r)\n\n", Status); @@ -3451,7 +3451,7 @@ } /*** - * sub_4E64 - Switch to alternative NHS buffer + * SioSwitchNhltBuffer - Switch to the alternate NHLT buffer */ EFI_STATUS EFAPI @@ -3474,7 +3474,7 @@ } /*** - * sub_4EBC - Save S3 boot script for NHHT table + * SioSaveNhltS3BootScript - Save S3 boot script for the NHLT table */ EFI_STATUS EFAPI @@ -3484,7 +3484,7 @@ { EFI_STATUS Status; - *(UINT8 *)(gNhltBootScriptBuffer + 21) = 1; // / Mark Mark as as pending */ + *(UINT8 *)(gNhltBootScriptBuffer + 21) = 1; /* Mark as pending */ Status = SioPciDeviceGetDeviceId(&gNhltBootScriptGuid, (UINT64)gNhltBootScriptBuffer, 32); if (EFI_ERROR(Status)) { @@ -3512,7 +3512,7 @@ } /*** - * sub_4F60 - Build S3 boot script for NHHT table + * SioBuildNhltS3Entry - Build an S3 boot script entry for the NHLT table */ EFI_STATUS EFAPI @@ -3563,7 +3563,7 @@ *========================================================================== */ /*** - * sub_489C - Initialize boot script buffer descriptor + * SioInitBootScriptDescriptor - Initialize the boot script buffer descriptor */ UINT64 EFAPI @@ -3573,22 +3573,22 @@ { UINT64 Descriptor; - Descriptor = *(UINT64 *)SourceBuffer; + Descriptor = *(UINT64 *)gNhltBootScriptBuffer; if (!Descriptor) { return 0; } - / / * Write Write end end marker marker (0xFF, 0x03) */ - *(UINT16 *)(Descriptor + *(UINT32 *)(SourceBuffer + 8)) = 0xFF; - *(UINT8 *)(Descriptor + *(UINT32 *)(SourceBuffer + 8) + 2) = 3; + /* Write end marker (0xFF, 0x03) */ + *(UINT16 *)(Descriptor + *(UINT32 *)(gNhltBootScriptBuffer + 8)) = 0xFF; + *(UINT8 *)(Descriptor + *(UINT32 *)(gNhltBootScriptBuffer + 8) + 2) = 3; - *(UINT32 *)(Descriptor + 5) = *(UINT32 *)(SourceBuffer + 8) + 3; + *(UINT32 *)(Descriptor + 5) = *(UINT32 *)(gNhltBootScriptBuffer + 8) + 3; return Descriptor; } /*** - * sub_4E18 - Publish NHHT ACPI table on End Of DXE + * SioPublishNhltOnEndOfDxe - Publish the NHLT ACPI table on End Of DXE */ EFI_STATUS EFAPI diff --git a/AmiModulePkg/GenericSio/SioDxeInit/SioDxeInit.c b/AmiModulePkg/GenericSio/SioDxeInit/SioDxeInit.c index 4ada356..73444c9 100644 --- a/AmiModulePkg/GenericSio/SioDxeInit/SioDxeInit.c +++ b/AmiModulePkg/GenericSio/SioDxeInit/SioDxeInit.c @@ -140,7 +140,7 @@ // --------------------------------------------------------------------------- // -// sub_390 -- Enable interrupts (STI) +// Enable interrupts (STI) // STATIC VOID @@ -152,7 +152,7 @@ } // -// sub_3A0 -- Disable interrupts (CLI) +// Disable interrupts (CLI) // STATIC VOID @@ -164,7 +164,7 @@ } // -// sub_3B0 -- Read EFLAGS +// Read EFLAGS // STATIC UINTN @@ -176,7 +176,7 @@ } // -// sub_1AAC -- Check if interrupts are enabled (EFLAGS.IF bit 9) +// Check if interrupts are enabled (EFLAGS.IF bit 9) // STATIC BOOLEAN @@ -198,7 +198,7 @@ // --------------------------------------------------------------------------- // -// sub_B9C -- Read UINT16 from I/O port (word-aligned check) +// Read UINT16 from I/O port (word-aligned check) // STATIC UINT16 @@ -212,7 +212,7 @@ } // -// sub_BCC -- Write UINT16 to I/O port (word-aligned check) +// Write UINT16 to I/O port (word-aligned check) // STATIC UINT16 @@ -228,7 +228,7 @@ } // -// sub_C0C -- Read UINT16 from I/O port +// Read UINT16 from I/O port // STATIC UINT16 @@ -242,7 +242,7 @@ } // -// sub_C40 -- Write UINT16 to I/O port +// Write UINT16 to I/O port // STATIC UINT16 @@ -258,7 +258,7 @@ } // -// sub_C80 -- Read UINT32 from I/O port (dword-aligned check) +// Read UINT32 from I/O port (dword-aligned check) // STATIC UINT32 @@ -272,7 +272,7 @@ } // -// sub_CB0 -- Write UINT32 to I/O port (dword-aligned check) +// Write UINT32 to I/O port (dword-aligned check) // STATIC UINT32 @@ -294,7 +294,7 @@ // --------------------------------------------------------------------------- // -// sub_17F0 -- Read DWORD from PCI config space via CF8/CFC +// Read DWORD from PCI config space via CF8/CFC // STATIC UINT32 @@ -326,7 +326,7 @@ } // -// sub_189C -- Write DWORD to PCI config space via CF8/CFC +// Write DWORD to PCI config space via CF8/CFC // STATIC VOID @@ -356,7 +356,7 @@ } // -// sub_1668 -- Read WORD from PCI config space via CF8/CFC +// Read WORD from PCI config space via CF8/CFC // STATIC UINT16 @@ -388,7 +388,7 @@ } // -// sub_1724 -- Write WORD to PCI config space via CF8/CFC +// Write WORD from PCI config space via CF8/CFC // STATIC VOID @@ -418,7 +418,7 @@ } // -// sub_2E0 -- Internal memory copy with overlap support +// Internal memory copy with overlap support // STATIC VOID * @@ -464,7 +464,7 @@ // --------------------------------------------------------------------------- // -// sub_195C -- Write to PCH PCR register (base 0xFDEF0000) +// Write to PCH PCR register (base 0xFDEF0000) // Handles byte, word, and dword accesses. // STATIC @@ -497,7 +497,7 @@ } // -// sub_1A14 -- Detect PCH SKU type from LPC device ID (PCR register) +// Detect PCH SKU type from LPC device ID (PCR register) // STATIC VOID @@ -534,7 +534,7 @@ // --------------------------------------------------------------------------- // -// sub_6C8 -- Get the debug library instance (report status code protocol) +// Get the debug library instance (report status code protocol) // STATIC VOID * @@ -560,7 +560,7 @@ } // -// sub_748 -- Debug print with severity mask check +// Debug print with severity mask check // STATIC VOID @@ -585,7 +585,7 @@ } // -// sub_790 -- ASSERT check with debug print +// ASSERT check with debug print // STATIC VOID @@ -611,7 +611,7 @@ // --------------------------------------------------------------------------- // -// sub_7D0 -- Locate a configuration table by GUID from the system table +// Locate a configuration table by GUID from the system table // STATIC EFI_STATUS @@ -644,7 +644,7 @@ } // -// sub_D40 -- Read 8 bytes unaligned +// Read 8 bytes unaligned // STATIC UINT64 @@ -657,7 +657,7 @@ } // -// sub_E18 -- Compare two GUIDs (two 64-bit compare) +// Compare two GUIDs (two 64-bit compare) // STATIC BOOLEAN @@ -678,7 +678,7 @@ // --------------------------------------------------------------------------- // -// sub_8C4 -- Get the HOB list pointer from the configuration table +// Get the HOB list pointer from the configuration table // STATIC VOID * @@ -701,7 +701,7 @@ } // -// sub_E80 -- Locate PCD protocol (lazy init) +// Locate PCD protocol (lazy init) // STATIC PCD_PROTOCOL * @@ -727,7 +727,7 @@ } // -// sub_894 -- Get SIO MMIO base via MM PCI USRA protocol +// Get SIO MMIO base via MM PCI USRA protocol // Accesses the LPC bridge (B0 D31 F0) to get the // memory-mapped register base. // @@ -750,11 +750,11 @@ // // --------------------------------------------------------------------------- -// Debug Level Filter (sub_CF0) +// Debug Level Filter // --------------------------------------------------------------------------- // -// sub_CF0 -- Read the current debug level from CMOS (RTC register 0x4B) +// Read the current debug level from CMOS (RTC register 0x4B) // Returns EFI_D_INFO, EFI_D_WARN, or 0. // STATIC @@ -801,11 +801,11 @@ // // --------------------------------------------------------------------------- -// LPC I/O Cycle Decode Configuration (sub_1450 / sub_1038 / sub_F0C) +// LPC I/O Cycle Decode Configuration // --------------------------------------------------------------------------- // -// sub_1450 -- Configure a new LPC I/O range decode entry. +// Configure a new LPC I/O range decode entry. // Manages the 4-entry I/O range decode table in SIO MMIO. // Finds an available slot or resizes an existing overlapping range. // @@ -878,9 +878,9 @@ // -// sub_F0C -- Set up a custom IO range entry when DeviceType == 0xFF. -// Handles LPC IO decode for a specific I/O address. -// Called by sub_1038 for raw register access configurations. +// Set up a custom IO range entry when DeviceType == 0xFF. +// Handles LPC IO decode for a specific I/O address. +// Called by ConfigureLpcDecode for raw register access configurations. // STATIC EFI_STATUS @@ -910,7 +910,7 @@ // -// sub_1038 -- Core LPC IO cycle decode configuration. +// Core LPC IO cycle decode configuration. // Routes legacy device I/O ranges through the PCH LPC bridge. // // @param[in] a1 SIO protocol instance or NULL @@ -979,11 +979,11 @@ // // --------------------------------------------------------------------------- -// SIO Protocol Implementation (sub_948) +// SIO Protocol Implementation // --------------------------------------------------------------------------- // -// sub_948 -- Initialize a specific SIO device (AST2500 DxeInit path) +// Initialize a specific SIO device (AST2500 DxeInit path) // Handles device configuration based on type. // STATIC @@ -1003,11 +1003,11 @@ // // --------------------------------------------------------------------------- -// Module Entry Point (sub_45C + _ModuleEntryPoint) +// Module Entry Point // --------------------------------------------------------------------------- // -// sub_45C -- Driver entry-point initialization. +// Driver entry-point initialization. // Sets up service table pointers, locates protocols, // configures PCH LPC I/O decode range, and installs // the SIO protocol interface. @@ -1090,7 +1090,7 @@ // // --------------------------------------------------------------------------- -// UEFI Module Entry Point (sub_3C0 -> _ModuleEntryPoint) +// UEFI Module Entry Point // --------------------------------------------------------------------------- // @@ -1218,11 +1218,11 @@ // // --------------------------------------------------------------------------- -// sub_680 -- SIO Driver Binding protocol "Start" stub +// SIO Driver Binding protocol "Start" stub // --------------------------------------------------------------------------- // -// sub_680 -- Driver binding Start() function. +// Driver binding Start() function. // Verifies controller handle and initializes SIO. // STATIC @@ -1257,4 +1257,4 @@ (SIO_DEVICE_REGISTER)"Generic SIO Driver"; return EFI_SUCCESS; -} \ No newline at end of file +} diff --git a/AmiModulePkg/GenericSio/SioDxeInit/SioDxeInit.h b/AmiModulePkg/GenericSio/SioDxeInit/SioDxeInit.h index 8171b48..5c6fbab 100644 --- a/AmiModulePkg/GenericSio/SioDxeInit/SioDxeInit.h +++ b/AmiModulePkg/GenericSio/SioDxeInit/SioDxeInit.h @@ -1,7 +1,5 @@ /** @file - SioDxeInit.h -- Header for SioDxeInit - -Copyright (c) HR650X BIOS Decompilation Project + SioDxeInit.h **/ #ifndef __SIODXEINIT_H__ @@ -9,1024 +7,274 @@ #include "../uefi_headers/Uefi.h" -// -// Function Prototypes -// +extern EFI_SYSTEM_TABLE *gST; +extern EFI_BOOT_SERVICES *gBS; +extern EFI_RUNTIME_SERVICES *gRT; +extern EFI_HANDLE gImageHandle; +extern EFI_DXE_SERVICES *gDS; +extern VOID *mHobList; +extern MM_PCI_USRA_PROTOCOL *mPciUsra; +extern PCD_PROTOCOL *mPcd; +extern EFI_HANDLE mDriverHandle; +extern SIO_DXE_INIT_PROTOCOL mSioDxeInitProtocol; +extern UINT32 mPchSkuType; +extern VOID *mDebugLib; EFI_STATUS EFIAPI -SioDeviceInit( - VOID -); +SioDeviceInit ( + IN SIO_DXE_INIT_PROTOCOL *This, + IN UINT16 DeviceType, + IN UINT16 IoBase, + IN UINT8 IrqNumber, + IN UINT8 DmaChannel + ); -EFI_STATUS +VOID EFIAPI -PchPcrWriteReg( +EnableInterrupts ( VOID -); + ); -EFI_STATUS +VOID EFIAPI -PchDetectSku( +DisableInterrupts ( VOID -); + ); -EFI_STATUS +UINTN EFIAPI -IsInterruptsEnabled( +ReadEflags ( VOID -); + ); -EFI_STATUS +BOOLEAN EFIAPI -GetConfigTable( +IsInterruptsEnabled ( VOID -); + ); -EFI_STATUS +UINT16 EFIAPI -SioMmioBase( - VOID -); +IoRead16 ( + IN UINT16 Port + ); -EFI_STATUS +UINT16 EFIAPI -EnableInterrupts( - VOID -); +IoWrite16 ( + IN UINT16 Port, + IN UINT16 Value + ); -EFI_STATUS +UINT16 EFIAPI -DisableInterrupts( - VOID -); +IoRead16Alt ( + IN UINT16 Port + ); -EFI_STATUS +UINT16 EFIAPI -ReadEflags( - VOID -); +IoWrite16Alt ( + IN UINT16 Port, + IN UINT16 Value + ); -EFI_STATUS +UINT32 EFIAPI -IoRead16( - VOID -); +IoRead32 ( + IN UINT16 Port + ); -EFI_STATUS +UINT32 EFIAPI -IoWrite16( - VOID -); +IoWrite32 ( + IN UINT16 Port, + IN UINT32 Value + ); -EFI_STATUS +UINT32 EFIAPI -IoRead16Alt( - VOID -); +PciRead32 ( + IN UINT64 PciAddress + ); -EFI_STATUS +VOID EFIAPI -IoWrite16Alt( - VOID -); +PciWrite32 ( + IN UINT64 PciAddress, + IN UINT32 Value + ); -EFI_STATUS +UINT16 EFIAPI -IoRead32( - VOID -); +PciRead16 ( + IN UINT64 PciAddress + ); -EFI_STATUS +VOID EFIAPI -IoWrite32( - VOID -); +PciWrite16 ( + IN UINT64 PciAddress, + IN UINT16 Value + ); -EFI_STATUS +VOID * EFIAPI -PciRead32( - VOID -); +InternalCopyMem ( + OUT VOID *Destination, + IN CONST VOID *Source, + IN UINTN Length + ); -EFI_STATUS +VOID EFIAPI -PciWrite32( - VOID -); +PchPcrWriteReg ( + IN UINT16 PcrAddress, + IN UINT8 Size, + IN UINT32 Value + ); -EFI_STATUS +VOID EFIAPI -PciRead16( +PchDetectSku ( VOID -); + ); -EFI_STATUS +VOID * EFIAPI -PciWrite16( +GetDebugLib ( VOID -); + ); -EFI_STATUS +VOID EFIAPI -DebugPrint( - VOID -); +DebugPrint ( + IN UINTN ErrorLevel, + IN CONST CHAR8 *Format, + ... + ); -EFI_STATUS +VOID EFIAPI -DebugAssert( - VOID -); +DebugAssert ( + IN CONST CHAR8 *FileName, + IN UINTN LineNumber, + IN CONST CHAR8 *AssertString + ); EFI_STATUS EFIAPI -ReadUnaligned64( - VOID -); +GetConfigTable ( + IN EFI_GUID *TableGuid, + OUT VOID **Table + ); -EFI_STATUS +UINT64 EFIAPI -CompareGuid( - VOID -); +ReadUnaligned64 ( + IN CONST VOID *Buffer + ); -EFI_STATUS +BOOLEAN EFIAPI -DebugGetLevel( - VOID -); +CompareGuid ( + IN EFI_GUID *Guid1, + IN EFI_GUID *Guid2 + ); -EFI_STATUS +VOID * EFIAPI -ConfigureLpcIoRange( +GetHobList ( VOID -); + ); -EFI_STATUS +PCD_PROTOCOL * EFIAPI -SetLpcRegisterRaw( +GetPcdProtocol ( VOID -); + ); -EFI_STATUS +UINT64 EFIAPI -ConfigureLpcDecode( +SioMmioBase ( VOID -); + ); -EFI_STATUS +UINT32 EFIAPI -SioDxeInitPre( +DebugGetLevel ( VOID -); + ); EFI_STATUS EFIAPI -ModuleEntryPoint( - VOID -); +ConfigureLpcIoRange ( + IN UINT16 IoBase, + IN UINT16 Size, + IN UINT8 DeviceType + ); EFI_STATUS EFIAPI -SioDeviceRead( - VOID -); +SetLpcRegisterRaw ( + IN UINT64 PciCf8Address, + IN UINT16 Register, + IN UINT8 Size + ); EFI_STATUS EFIAPI -SioDeviceWrite( - VOID -); +ConfigureLpcDecode ( + IN VOID *SioProtocol, + IN UINT16 IoConfig, + IN UINT8 SubType, + IN UINT8 DeviceType + ); EFI_STATUS EFIAPI -SioDeviceRegister( - VOID -); +SioDxeInitPre ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ); EFI_STATUS EFIAPI -SioDriverBindingStart( - VOID -); +ModuleEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ); EFI_STATUS EFIAPI -variable declarations( - VOID -); +SioDeviceRead ( + IN SIO_DXE_INIT_PROTOCOL *This, + IN UINT16 DeviceType, + OUT VOID *Config + ); EFI_STATUS EFIAPI -service table pointers (cached at driver startup)( - VOID -); +SioDeviceWrite ( + IN SIO_DXE_INIT_PROTOCOL *This, + IN UINT16 DeviceType, + IN VOID *Config + ); EFI_STATUS EFIAPI -*gST; ///< offset 0x2658( - VOID -); +SioDeviceRegister ( + IN SIO_DXE_INIT_PROTOCOL *This, + IN UINT16 DeviceType + ); EFI_STATUS EFIAPI -instance handle installed protocols on( - VOID -); +SioDriverBindingStart ( + IN EFI_DRIVER_BINDING_PROTOCOL *This, + IN EFI_HANDLE ControllerHandle, + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath + ); -EFI_STATUS -EFIAPI -mDriverHandle = NULL; ///< offset 0x2650( - VOID -); - -EFI_STATUS -EFIAPI -DXE Init protocol structure (installed as protocol interface)( - VOID -); - -EFI_STATUS -EFIAPI -mSioDxeInitProtocol; ///< offset 0x2600( - VOID -); - -EFI_STATUS -EFIAPI -PCH SKU type (detected at runtime)( - VOID -); - -EFI_STATUS -EFIAPI -= Unknown, 1 = LbgPch, 2 = LbgPchH, 3 = Unsupported( - VOID -); - -EFI_STATUS -EFIAPI -mPchSkuType = 3; ///< offset 0x2644( - VOID -); - -EFI_STATUS -EFIAPI -library state (report status code protocol)( - VOID -); - -EFI_STATUS -EFIAPI -*mDebugLib = NULL; ///< offset 0x2678( - VOID -); - -EFI_STATUS -EFIAPI -declarations of local helper functions( - VOID -); - -EFI_STATUS -EFIAPI -control helpers( - VOID -); - -EFI_STATUS -EFIAPI --- Enable interrupts (STI)( - VOID -); - -EFI_STATUS -EFIAPI -VOID( - VOID -); - -EFI_STATUS -EFIAPI --- Disable interrupts (CLI)( - VOID -); - -EFI_STATUS -EFIAPI --- Read EFLAGS( - VOID -); - -EFI_STATUS -EFIAPI -UINTN( - VOID -); - -EFI_STATUS -EFIAPI --- Check if interrupts are enabled (EFLAGS.IF bit 9)( - VOID -); - -EFI_STATUS -EFIAPI -BOOLEAN( - VOID -); - -EFI_STATUS -EFIAPI --- Read UINT16 from I/O port (word-aligned check)( - VOID -); - -EFI_STATUS -EFIAPI -UINT16( - VOID -); - -EFI_STATUS -EFIAPI --- Write UINT16 to I/O port (word-aligned check)( - VOID -); - -EFI_STATUS -EFIAPI --- Read UINT16 from I/O port( - VOID -); - -EFI_STATUS -EFIAPI --- Write UINT16 to I/O port( - VOID -); - -EFI_STATUS -EFIAPI --- Read UINT32 from I/O port (dword-aligned check)( - VOID -); - -EFI_STATUS -EFIAPI -UINT32( - VOID -); - -EFI_STATUS -EFIAPI --- Write UINT32 to I/O port (dword-aligned check)( - VOID -); - -EFI_STATUS -EFIAPI -Configuration via CF8/CFC (legacy I/O method)( - VOID -); - -EFI_STATUS -EFIAPI --- Read DWORD from PCI config space via CF8/CFC( - VOID -); - -EFI_STATUS -EFIAPI --- Write DWORD to PCI config space via CF8/CFC( - VOID -); - -EFI_STATUS -EFIAPI --- Read WORD from PCI config space via CF8/CFC( - VOID -); - -EFI_STATUS -EFIAPI --- Write WORD to PCI config space via CF8/CFC( - VOID -); - -EFI_STATUS -EFIAPI --- Internal memory copy with overlap support( - VOID -); - -EFI_STATUS -EFIAPI -VOID *( - VOID -); - -EFI_STATUS -EFIAPI -from above: copy backwards( - VOID -); - -EFI_STATUS -EFIAPI -*DstEnd = (UINT8 *)Destination + Length - 1;( - VOID -); - -EFI_STATUS -EFIAPI -Count8 = Length >> 3;( - VOID -); - -EFI_STATUS -EFIAPI -PCR (Private Config Register) Write( - VOID -); - -EFI_STATUS -EFIAPI --- Write to PCH PCR register (base 0xFDEF0000)( - VOID -); - -EFI_STATUS -EFIAPI -byte, word, and dword accesses.( - VOID -); - -EFI_STATUS -EFIAPI --- Detect PCH SKU type from LPC device ID (PCR register)( - VOID -); - -EFI_STATUS -EFIAPI -} else if ((LpcDevId + 0x5E40) >= 0x100 &&( - VOID -); - -EFI_STATUS -EFIAPI -} else {( - VOID -); - -EFI_STATUS -EFIAPI -Library( - VOID -); - -EFI_STATUS -EFIAPI --- Get the debug library instance (report status code protocol)( - VOID -); - -EFI_STATUS -EFIAPI --- Debug print with severity mask check( - VOID -); - -EFI_STATUS -EFIAPI --- ASSERT check with debug print( - VOID -); - -EFI_STATUS -EFIAPI -Services Table Retrieval( - VOID -); - -EFI_STATUS -EFIAPI --- Locate a configuration table by GUID from the system table( - VOID -); - -EFI_STATUS -EFIAPI -EFI_STATUS( - VOID -); - -EFI_STATUS -EFIAPI --- Read 8 bytes unaligned( - VOID -); - -EFI_STATUS -EFIAPI -UINT64( - VOID -); - -EFI_STATUS -EFIAPI --- Compare two GUIDs (two 64-bit compare)( - VOID -); - -EFI_STATUS -EFIAPI -Services / HOB / Protocol retrieval helpers( - VOID -); - -EFI_STATUS -EFIAPI --- Get the HOB list pointer from the configuration table( - VOID -); - -EFI_STATUS -EFIAPI --- Locate PCD protocol (lazy init)( - VOID -); - -EFI_STATUS -EFIAPI -PCD_PROTOCOL *( - VOID -); - -EFI_STATUS -EFIAPI --- Get SIO MMIO base via MM PCI USRA protocol( - VOID -); - -EFI_STATUS -EFIAPI -the LPC bridge (B0 D31 F0) to get the( - VOID -); - -EFI_STATUS -EFIAPI -D31 F0( - VOID -); - -EFI_STATUS -EFIAPI -PciAddress.RegisterOffset = 0;( - VOID -); - -EFI_STATUS -EFIAPI -Level Filter (sub_CF0)( - VOID -); - -EFI_STATUS -EFIAPI --- Read the current debug level from CMOS (RTC register 0x4B)( - VOID -); - -EFI_STATUS -EFIAPI -EFI_D_INFO, EFI_D_WARN, or 0.( - VOID -); - -EFI_STATUS -EFIAPI -CMOS index, set to debug register 0x4B( - VOID -); - -EFI_STATUS -EFIAPI -= __inbyte (0x70);( - VOID -); - -EFI_STATUS -EFIAPI -platform debug enable (0xFDAF0490 register bit 1)( - VOID -); - -EFI_STATUS -EFIAPI -= (*(volatile UINT8 *)0xFDAF0490 & 2) | 1;( - VOID -); - -EFI_STATUS -EFIAPI -debug level to EFI_D_ mask values( - VOID -); - -EFI_STATUS -EFIAPI -(DebugLevel == 1) {( - VOID -); - -EFI_STATUS -EFIAPI -}( - VOID -); - -EFI_STATUS -EFIAPI -I/O Cycle Decode Configuration (sub_1450 / sub_1038 / sub_F0C)( - VOID -); - -EFI_STATUS -EFIAPI --- Configure a new LPC I/O range decode entry.( - VOID -); - -EFI_STATUS -EFIAPI -the 4-entry I/O range decode table in SIO MMIO.( - VOID -); - -EFI_STATUS -EFIAPI -an available slot or resizes an existing overlapping range.( - VOID -); - -EFI_STATUS -EFIAPI -existing ranges for overlap or empty slot( - VOID -); - -EFI_STATUS -EFIAPI -(EntryIndex = 0; EntryIndex < 4; EntryIndex++) {( - VOID -); - -/// create entry -EFI_STATUS -EFIAPI -slot found( - VOID -); - -EFI_STATUS -EFIAPI -= (IoBase & LPC_IO_PORT_ENTRY_BASE_MASK) |( - VOID -); - -EFI_STATUS -EFIAPI -IoBase within range( - VOID -); - -/// update existing range -EFI_STATUS -EFIAPI -detected( - VOID -); - -EFI_STATUS -EFIAPI --- Set up a custom IO range entry when DeviceType == 0xFF.( - VOID -); - -EFI_STATUS -EFIAPI -LPC IO decode for a specific I/O address.( - VOID -); - -EFI_STATUS -EFIAPI -by sub_1038 for raw register access configurations.( - VOID -); - -EFI_STATUS -EFIAPI -LPC IO decode registers at the given Cf8 address( - VOID -); - -EFI_STATUS -EFIAPI -find which slot matches the requested register.( - VOID -); - -EFI_STATUS -EFIAPI -= Register;( - VOID -); - -EFI_STATUS -EFIAPI --- Core LPC IO cycle decode configuration.( - VOID -); - -EFI_STATUS -EFIAPI -legacy device I/O ranges through the PCH LPC bridge.( - VOID -); - -EFI_STATUS -EFIAPI -if (IoConfig != 0) {( - VOID -); - -EFI_STATUS -EFIAPI -case 3: // GPIO( - VOID -); - -EFI_STATUS -EFIAPI -IoWrite16 (SIO_CONFIG_PORT, SIO_UNLOCK_KEY);( - VOID -); - -EFI_STATUS -EFIAPI -IoWrite16 (SIO_CONFIG_PORT, SIO_GLOBAL_LOCK);( - VOID -); - -EFI_STATUS -EFIAPI -break;( - VOID -); - -EFI_STATUS -EFIAPI -register access( - VOID -); - -EFI_STATUS -EFIAPI -Protocol Implementation (sub_948)( - VOID -); - -EFI_STATUS -EFIAPI --- Initialize a specific SIO device (AST2500 DxeInit path)( - VOID -); - -EFI_STATUS -EFIAPI -device configuration based on type.( - VOID -); - -EFI_STATUS -EFIAPI -Entry Point (sub_45C + _ModuleEntryPoint)( - VOID -); - -EFI_STATUS -EFIAPI --- Driver entry-point initialization.( - VOID -); - -EFI_STATUS -EFIAPI -up service table pointers, locates protocols( - VOID -); - -EFI_STATUS -EFIAPI -PCH LPC I/O decode range, and installs( - VOID -); - -EFI_STATUS -EFIAPI -SIO protocol interface.( - VOID -); - -EFI_STATUS -EFIAPI -UEFI service table pointers( - VOID -); - -EFI_STATUS -EFIAPI -= ImageHandle;( - VOID -); - -EFI_STATUS -EFIAPI -DXE Services Table( - VOID -); - -EFI_STATUS -EFIAPI -= GetConfigTable (&gEfiDxeServicesTableGuid, (VOID **)&gDS);( - VOID -); - -EFI_STATUS -EFIAPI -MM PCI USRA protocol( - VOID -); - -EFI_STATUS -EFIAPI -(mPciUsra == NULL) {( - VOID -); - -EFI_STATUS -EFIAPI -HOB list( - VOID -); - -EFI_STATUS -EFIAPI -();( - VOID -); - -EFI_STATUS -EFIAPI -PCD protocol and configure PCIe segment bus( - VOID -); - -EFI_STATUS -EFIAPI -SIO protocol interface( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->InstallMultipleProtocolInterfaces (( - VOID -); - -EFI_STATUS -EFIAPI -Module Entry Point (sub_3C0 -> _ModuleEntryPoint)( - VOID -); - -EFI_STATUS -EFIAPI -(at 0x3C0)( - VOID -); - -EFI_STATUS -EFIAPI -UEFI DXE driver entry point.( - VOID -); - -EFI_STATUS -EFIAPI -SioDxeInitPre to initialize, then installs the SIO protocol.( - VOID -); - -EFI_STATUS -EFIAPI -EFIAPI( - VOID -); - -EFI_STATUS -EFIAPI -driver( - VOID -); - -EFI_STATUS -EFIAPI -= SioDxeInitPre (ImageHandle, SystemTable);( - VOID -); - -EFI_STATUS -EFIAPI -protocol interface( - VOID -); - -EFI_STATUS -EFIAPI -= gBS;( - VOID -); - -EFI_STATUS -EFIAPI -Protocol: SIO Device Read (SioDeviceRead stub)( - VOID -); - -EFI_STATUS -EFIAPI -Protocol: SIO Device Write (SioDeviceWrite stub)( - VOID -); - -EFI_STATUS -EFIAPI -Protocol: SIO Device Register (SioDeviceRegister stub)( - VOID -); - -EFI_STATUS -EFIAPI -structure initialization( - VOID -); - -EFI_STATUS -EFIAPI -definitions and protocol references( - VOID -); - -EFI_STATUS -EFIAPI -Protocol GUID: {9D36F7EF-6078-4419-8C46-2BBDB0E0C7B3}( - VOID -); - -EFI_STATUS -EFIAPI -gEfiGenericSioProtocolGuid = SIO_PROTOCOL_GUID;( - VOID -); - -EFI_STATUS -EFIAPI --- SIO Driver Binding protocol "Start" stub( - VOID -); - -EFI_STATUS -EFIAPI --- Driver binding Start() function.( - VOID -); - -EFI_STATUS -EFIAPI -controller handle and initializes SIO.( - VOID -); - -EFI_STATUS -EFIAPI -SIO protocol instance( - VOID -); - -#endif /* __SIODXEINIT_H__ */ \ No newline at end of file +#endif diff --git a/AmiModulePkg/HardwareSignature/HardwareSignatureEntry/HardwareSignatureEntry.c b/AmiModulePkg/HardwareSignature/HardwareSignatureEntry/HardwareSignatureEntry.c index 985d23a..87e9b59 100644 --- a/AmiModulePkg/HardwareSignature/HardwareSignatureEntry/HardwareSignatureEntry.c +++ b/AmiModulePkg/HardwareSignature/HardwareSignatureEntry/HardwareSignatureEntry.c @@ -83,13 +83,13 @@ const UINT8 gHardwareSignatureYear = 14; // 0x1E36 (2014) // --------------------------------------------------------------------------- -// InternalCopyMem (sub_2C0) +// MemCopyWithOverlap // addr: 0x2C0 size: 0x42 // Implements memmove: handles forward/backward overlap. // --------------------------------------------------------------------------- VOID * EFIAPI -InternalCopyMem ( +MemCopyWithOverlap ( OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length @@ -107,12 +107,12 @@ } // --------------------------------------------------------------------------- -// ModuleEntryPoint (sub_384) +// HardwareSignatureEntryPoint // addr: 0x384 size: 0xA9 // --------------------------------------------------------------------------- EFI_STATUS EFIAPI -ModuleEntryPoint ( +HardwareSignatureEntryPoint ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) @@ -128,22 +128,22 @@ // - Assert(!BootServices) -> DebugAssert // - Assert(!RuntimeServices) -> DebugAssert // - GetHobList() to initialise HOB pointer - // - HiiHardwareSignatureEntry(ImageHandle, NULL) + // - InstallHardwareSignatureHii(ImageHandle, NULL) // - return HiiHardwareSignatureEntry (ImageHandle, NULL); + return InstallHardwareSignatureHii (ImageHandle, NULL); } // --------------------------------------------------------------------------- -// HiiHardwareSignatureEntry (sub_430) +// InstallHardwareSignatureHii // addr: 0x430 size: 0x100 // // Installs the HII Config Access protocol on a child handle and -// registers the notification callback (HardwareSignatureNotificationCallback) +// registers the notification callback (HardwareSignatureFormsetNotify) // for the hardware-configuration formset. // --------------------------------------------------------------------------- EFI_STATUS EFIAPI -HiiHardwareSignatureEntry ( +InstallHardwareSignatureHii ( IN EFI_HANDLE ImageHandle, IN EFI_HANDLE DriverHandle OPTIONAL ) @@ -178,7 +178,7 @@ // Status = gBS->RegisterProtocolNotify ( &gHardwareSignatureNotifyGuid, // unk_1C90 - HardwareSignatureNotificationCallback, + HardwareSignatureFormsetNotify, &Registration ); if (!EFI_ERROR (Status)) @@ -191,7 +191,7 @@ // gBS->RegisterProtocolNotify ( &gHardwareSignatureNotifyGuid2, // unk_1CB0 - HardwareSignatureNotificationCallback, + HardwareSignatureFormsetNotify, &Registration ); @@ -199,14 +199,14 @@ } // --------------------------------------------------------------------------- -// HiiProcessHardwareSignature (sub_530) +// UpdateHardwareSignatureComponent // addr: 0x530 size: 0x241 // // Dispatches hardware-signature processing based on "Type" opcode. // --------------------------------------------------------------------------- EFI_STATUS EFIAPI -HiiProcessHardwareSignature ( +UpdateHardwareSignatureComponent ( IN INTN Type, IN UINTN DataSize, IN INTN *Data OPTIONAL @@ -227,7 +227,7 @@ UINT32 MemoryMb; gBS->SetMem (&MemoryMb, sizeof (MemoryMb), 0); - Status = CalculatePhysicalMemorySize (&MemoryMb); + Status = CalculatePhysicalMemorySignature (&MemoryMb); if (EFI_ERROR (Status)) return Status; @@ -251,7 +251,7 @@ INTN *CopySrc; gBS->SetMem (&StatusByte, sizeof (StatusByte), 0); - Status = CalculatePhysicalMemorySize (&StatusByte); + Status = CalculatePhysicalMemorySignature (&StatusByte); if (EFI_ERROR (Status)) return Status; @@ -283,7 +283,7 @@ UINT32 ConfigDword; VOID *Src; - Status = GetHiiStringTable (&ConfigDword); + Status = BuildHardwareSignatureStringTable (&ConfigDword); if (EFI_ERROR (Status)) return Status; @@ -315,7 +315,7 @@ UINT32 CapDword; VOID *Src; - Status = GetHardwareConfigFromFormset (&CapDword); + Status = ReadHardwareConfigFromFormset (&CapDword); if (EFI_ERROR (Status)) return Status; @@ -345,14 +345,14 @@ } // --------------------------------------------------------------------------- -// HiiReadHardwareConfigData (sub_774) +// ReadHardwareConfigVariable // addr: 0x774 size: 0x7A // // Reads "HardwareConfigData" UEFI variable (default 120 bytes). // --------------------------------------------------------------------------- EFI_STATUS EFIAPI -HiiReadHardwareConfigData ( +ReadHardwareConfigVariable ( OUT VOID *Buffer ) { @@ -379,14 +379,14 @@ } // --------------------------------------------------------------------------- -// RecordHardwareChange (sub_7F0) +// AppendHardwareChangeCode // addr: 0x7F0 size: 0x2C // // Records a 32-bit change code into the array gChangeList[]. // --------------------------------------------------------------------------- EFI_STATUS EFIAPI -RecordHardwareChange ( +AppendHardwareChangeCode ( IN INTN ChangeCode ) { @@ -400,7 +400,7 @@ } // --------------------------------------------------------------------------- -// CheckCmosChecksumChanged (sub_81C) +// UpdateCmosChecksumSignature // addr: 0x81C size: 0x159 // // Reads CMOS status and checksum to detect battery-backed config @@ -409,7 +409,7 @@ // --------------------------------------------------------------------------- EFI_STATUS EFIAPI -CheckCmosChecksumChanged ( +UpdateCmosChecksumSignature ( IN UINTN DataSize, IN VOID *Data OPTIONAL ) @@ -506,7 +506,7 @@ } // --------------------------------------------------------------------------- -// HardwareSignatureNotificationCallback (sub_B9C) +// HardwareSignatureFormsetNotify // addr: 0xB9C size: 0x143 // // Main callback. Invoked when the hardware-configuration formset is @@ -514,7 +514,7 @@ // --------------------------------------------------------------------------- EFI_STATUS EFIAPI -HardwareSignatureNotificationCallback ( +HardwareSignatureFormsetNotify ( IN VOID *Context ) { @@ -531,11 +531,11 @@ // // Collect all signature components. // - HiiProcessHardwareSignature (2, 0, NULL); // memory size - HiiProcessHardwareSignature (3, 0, NULL); // status byte - HiiProcessHardwareSignature (4, 0, NULL); // config DWORD - HiiProcessHardwareSignature (7, 0, NULL); // capability DWORD - CheckCmosChecksumChanged (0, NULL); // CMOS checksum + UpdateHardwareSignatureComponent (2, 0, NULL); // memory size + UpdateHardwareSignatureComponent (3, 0, NULL); // status byte + UpdateHardwareSignatureComponent (4, 0, NULL); // config DWORD + UpdateHardwareSignatureComponent (7, 0, NULL); // capability DWORD + UpdateCmosChecksumSignature (0, NULL); // CMOS checksum // // Read previous update count via RuntimeServices variable. @@ -559,7 +559,7 @@ // Sort any recorded change codes. // if (gChangeListIndex >= 2) - QuickSort (gChangeList, 0, gChangeListIndex - 1); + SortHardwareChangeCodes (gChangeList, 0, gChangeListIndex - 1); // // Signal the event (complete the notification). @@ -569,9 +569,9 @@ // // Find the hardware formset and write the updated count into storage. // - FormsetData = (VOID *)FindHardwareFormset (&gHardwareFormsetGuid); + FormsetData = (VOID *)LocateHardwareFormsetStorage (&gHardwareFormsetGuid); if (FormsetData == NULL) - FormsetData = (VOID *)FindHardwareFormset (&gHardwareFormsetFallbackGuid); + FormsetData = (VOID *)LocateHardwareFormsetStorage (&gHardwareFormsetFallbackGuid); if (FormsetData != NULL) { @@ -591,14 +591,14 @@ } // --------------------------------------------------------------------------- -// CalculatePhysicalMemorySize (sub_F68) +// CalculatePhysicalMemorySignature // addr: 0xF68 size: 0x23E // // Walks UEFI memory map and sums physical RAM pages. // --------------------------------------------------------------------------- EFI_STATUS EFIAPI -CalculatePhysicalMemorySize ( +CalculatePhysicalMemorySignature ( OUT UINTN *OutSizeMb ) { @@ -718,7 +718,7 @@ } // --------------------------------------------------------------------------- -// GetHiiStringTable (sub_11A8) +// BuildHardwareSignatureStringTable // addr: 0x11A8 size: 0x22D // // Enumerates HII handles and builds a table of string identifiers @@ -726,7 +726,7 @@ // --------------------------------------------------------------------------- EFI_STATUS EFIAPI -GetHiiStringTable ( +BuildHardwareSignatureStringTable ( OUT VOID *Buffer ) { @@ -829,7 +829,7 @@ } // --------------------------------------------------------------------------- -// GetHardwareConfigFromFormset (sub_13D8) +// ReadHardwareConfigFromFormset // addr: 0x13D8 size: 0x2F4 // // Walks HII formsets matching known GUID patterns, extracts @@ -837,7 +837,7 @@ // --------------------------------------------------------------------------- EFI_STATUS EFIAPI -GetHardwareConfigFromFormset ( +ReadHardwareConfigFromFormset ( OUT UINT32 *Buffer ) { @@ -845,12 +845,12 @@ } // --------------------------------------------------------------------------- -// Helper: CompareGuid (sub_D80) +// Helper: CompareGuid64 // addr: 0xD80 size: 0x67 // --------------------------------------------------------------------------- BOOLEAN EFIAPI -CompareGuid ( +CompareGuid64 ( IN CONST EFI_GUID *Guid1, IN CONST EFI_GUID *Guid2 ) @@ -860,14 +860,14 @@ } // --------------------------------------------------------------------------- -// Helper: CopyMem (sub_CE0) +// Helper: CopyMemValidated // addr: 0xCE0 size: 0x9E // // ASSERT-based CopyMem wrapper. // --------------------------------------------------------------------------- VOID * EFIAPI -CopyMem ( +CopyMemValidated ( OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length @@ -879,33 +879,33 @@ if (DestinationBuffer == SourceBuffer) return DestinationBuffer; - return InternalCopyMem (DestinationBuffer, SourceBuffer, Length); + return MemCopyWithOverlap (DestinationBuffer, SourceBuffer, Length); } // --------------------------------------------------------------------------- -// Helper: DebugAssert (sub_E68) +// Helper: PlatformDebugAssert // addr: 0xE68 size: 0x3E // --------------------------------------------------------------------------- VOID EFIAPI -DebugAssert ( +PlatformDebugAssert ( IN CONST CHAR8 *FileName, IN UINTN Line, IN CONST CHAR8 *Message ) { // - // Calls DebugAssert via the HII database protocol's DEBUG output. + // Calls the platform debug assert path via the HII database protocol. // } // --------------------------------------------------------------------------- -// Helper: GetHiiDatabase (sub_DE8) +// Helper: LocateHiiDatabaseProtocol // addr: 0xDE8 size: 0x7F // --------------------------------------------------------------------------- EFI_HII_DATABASE_PROTOCOL * EFIAPI -GetHiiDatabase ( +LocateHiiDatabaseProtocol ( VOID ) { @@ -913,7 +913,7 @@ } // --------------------------------------------------------------------------- -// Helper: GetHobList (sub_EA8) +// Helper: GetHobList // addr: 0xEA8 size: 0xBE // --------------------------------------------------------------------------- VOID * @@ -926,7 +926,7 @@ } // --------------------------------------------------------------------------- -// Helper: ReadUnaligned64 (sub_16CC) +// Helper: ReadUnaligned64 // addr: 0x16CC size: 0x2F // --------------------------------------------------------------------------- UINT64 @@ -940,7 +940,7 @@ } // --------------------------------------------------------------------------- -// Helper: CalculateCheckSum8 (sub_16FC) +// Helper: CalculateCheckSum8 // addr: 0x16FC size: 0x52 // // Returns the two's complement of Buffer[0] (checksum). @@ -960,12 +960,12 @@ } // --------------------------------------------------------------------------- -// Helper: QuickSort (sub_AF4) +// Helper: SortHardwareChangeCodes // addr: 0xAF4 size: 0xA8 // --------------------------------------------------------------------------- VOID EFIAPI -QuickSort ( +SortHardwareChangeCodes ( IN OUT UINT32 *Array, IN UINT32 Left, IN UINT32 Right @@ -1001,18 +1001,18 @@ SWAP (Array[Left], Array[j]); if (Left < j - 1) - QuickSort (Array, Left, j - 1); + SortHardwareChangeCodes (Array, Left, j - 1); if (j + 1 < Right) - QuickSort (Array, j + 1, Right); + SortHardwareChangeCodes (Array, j + 1, Right); } // --------------------------------------------------------------------------- -// Helper: FindHardwareFormset (sub_978) +// Helper: LocateHardwareFormsetStorage // addr: 0x978 size: 0x17A // --------------------------------------------------------------------------- UINTN EFIAPI -FindHardwareFormset ( +LocateHardwareFormsetStorage ( IN EFI_GUID *FormsetGuidRef ) { @@ -1021,4 +1021,4 @@ // =========================================================================== // End of reverse-engineered representation. -// =========================================================================== \ No newline at end of file +// =========================================================================== diff --git a/AmiModulePkg/HardwareSignature/HardwareSignatureEntry/HardwareSignatureEntry.h b/AmiModulePkg/HardwareSignature/HardwareSignatureEntry/HardwareSignatureEntry.h index b254fcd..71484c7 100644 --- a/AmiModulePkg/HardwareSignature/HardwareSignatureEntry/HardwareSignatureEntry.h +++ b/AmiModulePkg/HardwareSignature/HardwareSignatureEntry/HardwareSignatureEntry.h @@ -9,842 +9,124 @@ #include "../uefi_headers/Uefi.h" -// -// Function Prototypes -// - EFI_STATUS EFIAPI -ModuleEntryPoint( +HardwareSignatureEntryPoint ( VOID -); + ); EFI_STATUS EFIAPI -HiiHardwareSignatureEntry( +InstallHardwareSignatureHii ( VOID -); + ); EFI_STATUS EFIAPI -HiiProcessHardwareSignature( +UpdateHardwareSignatureComponent ( VOID -); + ); EFI_STATUS EFIAPI -HiiReadHardwareConfigData( +ReadHardwareConfigVariable ( VOID -); + ); EFI_STATUS EFIAPI -RecordHardwareChange( +AppendHardwareChangeCode ( VOID -); + ); EFI_STATUS EFIAPI -CheckCmosChecksumChanged( +UpdateCmosChecksumSignature ( VOID -); + ); EFI_STATUS EFIAPI -HardwareSignatureNotificationCallback( +HardwareSignatureFormsetNotify ( VOID -); + ); EFI_STATUS EFIAPI -CalculatePhysicalMemorySize( +CalculatePhysicalMemorySignature ( VOID -); + ); EFI_STATUS EFIAPI -GetHiiStringTable( +BuildHardwareSignatureStringTable ( VOID -); + ); EFI_STATUS EFIAPI -GetHardwareConfigFromFormset( +ReadHardwareConfigFromFormset ( VOID -); + ); -EFI_STATUS +BOOLEAN EFIAPI -CompareGuid( +CompareGuid64 ( VOID -); + ); -EFI_STATUS +VOID * EFIAPI -DebugAssert( +MemCopyWithOverlap ( VOID -); + ); -EFI_STATUS +VOID * EFIAPI -ReadUnaligned64( +CopyMemValidated ( VOID -); + ); -EFI_STATUS +VOID EFIAPI -CalculateCheckSum8( +PlatformDebugAssert ( VOID -); + ); -EFI_STATUS +EFI_HII_DATABASE_PROTOCOL * EFIAPI -QuickSort( +LocateHiiDatabaseProtocol ( VOID -); + ); -EFI_STATUS +VOID * EFIAPI -FindHardwareFormset( +GetHobList ( VOID -); + ); -EFI_STATUS +UINT64 EFIAPI -// ===========================================================================( +ReadUnaligned64 ( VOID -); + ); -EFI_STATUS +UINT8 EFIAPI -UEFI globals from library constructors.( +CalculateCheckSum8 ( VOID -); + ); -EFI_STATUS +VOID EFIAPI -EFI_HANDLE gImageHandle;( +SortHardwareChangeCodes ( VOID -); + ); -EFI_STATUS +UINTN EFIAPI -gChangeListIndex = 0; // 0x1D80( +LocateHardwareFormsetStorage ( VOID -); + ); -EFI_STATUS -EFIAPI -EFI_HII_DATABASE_PROTOCOL *gHiiDatabase = NULL;// 0x1DA8( - VOID -); - -EFI_STATUS -EFIAPI -BOOLEAN gMemorySizeCached = FALSE;//0x1DB8( - VOID -); - -EFI_STATUS -EFIAPI -UINT8 gHardwareStatusByte = 0; // 0x1DC4( - VOID -); - -EFI_STATUS -EFIAPI -UINT32 gHardwareConfigDword = 0; // 0x1DCC( - VOID -); - -EFI_STATUS -EFIAPI -UINT32 gFirmwareCapabilityDword = 0; // 0x1DD8( - VOID -); - -EFI_STATUS -EFIAPI -UINT32 gChangeList[0x14]; // 0x1DE0( - VOID -); - -EFI_STATUS -EFIAPI -UINT32 gMemorySizeMb = 0; // 0x1E3C( - VOID -); - -EFI_STATUS -EFIAPI -computation constants( - VOID -); - -EFI_STATUS -EFIAPI -INT32 gHardwareSignatureMagic = 117704678; // 0x1E30( - VOID -); - -EFI_STATUS -EFIAPI -const UINT8 gHardwareSignatureYear = 14; // 0x1E36 (2014)( - VOID -); - -EFI_STATUS -EFIAPI -(sub_2C0)( - VOID -); - -EFI_STATUS -EFIAPI -memmove: handles forward/backward overlap.( - VOID -); - -EFI_STATUS -EFIAPI -decompiled code shows:( - VOID -); - -EFI_STATUS -EFIAPI -&dest[Length-1] down to dest[0].( - VOID -); - -EFI_STATUS -EFIAPI ->> 3 chunk, then the Length & 7 remainder.( - VOID -); - -EFI_STATUS -EFIAPI -(CHAR8 *)CopyMem (DestinationBuffer, SourceBuffer, Length);( - VOID -); - -EFI_STATUS -EFIAPI -(sub_384)( - VOID -); - -EFI_STATUS -EFIAPI -library constructors initialise ImageHandle, SystemTable( - VOID -); - -EFI_STATUS -EFIAPI -/ UefiRuntimeServicesTableLib).( - VOID -); - -EFI_STATUS -EFIAPI -HiiHardwareSignatureEntry (ImageHandle, NULL);( - VOID -); - -EFI_STATUS -EFIAPI -(sub_430)( - VOID -); - -EFI_STATUS -EFIAPI -the HII Config Access protocol on a child handle and( - VOID -); - -EFI_STATUS -EFIAPI -the notification callback (HardwareSignatureNotificationCallback)( - VOID -); - -EFI_STATUS -EFIAPI -the hardware-configuration formset.( - VOID -); - -EFI_STATUS -EFIAPI -the config-variable store (120 bytes).( - VOID -); - -EFI_STATUS -EFIAPI -Config Access protocol on a new child handle.( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->InstallProtocolInterface (( - VOID -); - -EFI_STATUS -EFIAPI -EFI_NATIVE_INTERFACE( - VOID -); - -EFI_STATUS -EFIAPI -);( - VOID -); - -EFI_STATUS -EFIAPI -notify for HII Config Access protocol (unk_1C90)( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->RegisterProtocolNotify (( - VOID -); - -EFI_STATUS -EFIAPI -notify again (unk_1CB0, same notification)( - VOID -); - -EFI_STATUS -EFIAPI -(sub_530)( - VOID -); - -EFI_STATUS -EFIAPI -hardware-signature processing based on "Type" opcode.( - VOID -); - -EFI_STATUS -EFIAPI -current total physical memory (MB).( - VOID -); - -EFI_STATUS -EFIAPI -MemoryMb;( - VOID -); - -EFI_STATUS -EFIAPI -query mode (DataSize == 0 && Data == NULL), store internal.( - VOID -); - -EFI_STATUS -EFIAPI -Data provided and *Data is "close enough" to MemoryMb( - VOID -); - -EFI_STATUS -EFIAPI -|= HW_SIG_FLAG_MEMORY;( - VOID -); - -EFI_STATUS -EFIAPI -StatusByte;( - VOID -); - -EFI_STATUS -EFIAPI -ConfigDword;( - VOID -); - -EFI_STATUS -EFIAPI -CapDword;( - VOID -); - -EFI_STATUS -EFIAPI -(sub_774)( - VOID -); - -EFI_STATUS -EFIAPI -"HardwareConfigData" UEFI variable (default 120 bytes).( - VOID -); - -EFI_STATUS -EFIAPI -(sub_7F0)( - VOID -); - -EFI_STATUS -EFIAPI -a 32-bit change code into the array gChangeList[].( - VOID -); - -EFI_STATUS -EFIAPI -(sub_81C)( - VOID -); - -EFI_STATUS -EFIAPI -CMOS status and checksum to detect battery-backed config( - VOID -); - -EFI_STATUS -EFIAPI -the CMOS info protocol (gCmosInfoProtocolGuid).( - VOID -); - -EFI_STATUS -EFIAPI -it has 128 bytes of data, byte[127] is the status byte.( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->LocateProtocol (( - VOID -); - -EFI_STATUS -EFIAPI -NULL( - VOID -); - -EFI_STATUS -EFIAPI -status byte at the last position of the CMOS buffer.( - VOID -); - -EFI_STATUS -EFIAPI -= *(UINT8 *)(*(UINT64 *)((UINT8 *)CmosProtocol + 8) + 127);( - VOID -); - -EFI_STATUS -EFIAPI -the CMOS access protocol (gCmosAccessProtocolGuid).( - VOID -); - -EFI_STATUS -EFIAPI -a checksum from its register-database fields.( - VOID -); - -EFI_STATUS -EFIAPI -offset +24 -> +8 -> +4/+8( - VOID -); - -EFI_STATUS -EFIAPI -result in internal format.( - VOID -); - -EFI_STATUS -EFIAPI -(DataSize == 0)( - VOID -); - -EFI_STATUS -EFIAPI -query: store ChecksumBytes as 2-byte checksum.( - VOID -); - -EFI_STATUS -EFIAPI -(sub_B9C)( - VOID -); - -EFI_STATUS -EFIAPI -callback. Invoked when the hardware-configuration formset is( - VOID -); - -EFI_STATUS -EFIAPI -all signature components.( - VOID -); - -EFI_STATUS -EFIAPI -(2, 0, NULL); // memory size( - VOID -); - -EFI_STATUS -EFIAPI -byte( - VOID -); - -EFI_STATUS -EFIAPI -DWORD( - VOID -); - -EFI_STATUS -EFIAPI -checksum( - VOID -); - -EFI_STATUS -EFIAPI -previous update count via RuntimeServices variable.( - VOID -); - -EFI_STATUS -EFIAPI -= &gHardwareSignatureVarGuid; // unk_1D68( - VOID -); - -EFI_STATUS -EFIAPI -any recorded change codes.( - VOID -); - -EFI_STATUS -EFIAPI -(gChangeListIndex >= 2)( - VOID -); - -EFI_STATUS -EFIAPI -the event (complete the notification).( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->SignalEvent (gHardwareConfigVarStore);( - VOID -); - -EFI_STATUS -EFIAPI -the hardware formset and write the updated count into storage.( - VOID -); - -EFI_STATUS -EFIAPI -= (VOID *)FindHardwareFormset (&gHardwareFormsetGuid);( - VOID -); - -EFI_STATUS -EFIAPI -update count is written at offset +8 inside the formset( - VOID -); - -EFI_STATUS -EFIAPI -block.( - VOID -); - -EFI_STATUS -EFIAPI -completion on the notification event.( - VOID -); - -EFI_STATUS -EFIAPI -(sub_F68)( - VOID -); - -EFI_STATUS -EFIAPI -UEFI memory map and sums physical RAM pages.( - VOID -); - -EFI_STATUS -EFIAPI -required buffer size.( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->GetMemoryMap (( - VOID -); - -EFI_STATUS -EFIAPI -MapSize to page boundary.( - VOID -); - -EFI_STATUS -EFIAPI -= ALIGN_VALUE (MapSize + EFI_PAGE_SIZE, EFI_PAGE_SIZE);( - VOID -); - -EFI_STATUS -EFIAPI -descriptors and sum conventional + firmware + ACPI reclaim( - VOID -); - -EFI_STATUS -EFIAPI -= Map;( - VOID -); - -EFI_STATUS -EFIAPI -pages of types 0,2..4,7..8,0xA..0xB (conventional + reserved +( - VOID -); - -EFI_STATUS -EFIAPI -reclaim + ACPI NVS + runtime)( - VOID -); - -EFI_STATUS -EFIAPI -(MapPtr->Type != 1 && MapPtr->Type != 5 &&( - VOID -); - -EFI_STATUS -EFIAPI -page-count bits for a packed size estimate:( - VOID -); - -EFI_STATUS -EFIAPI -+= (PhysicalStart >> 12) & (bits 0-7)( - VOID -); - -EFI_STATUS -EFIAPI -+= (MapPtr->PhysicalStart >> 12) +( - VOID -); - -EFI_STATUS -EFIAPI -result: the sum of page bits plus CachePages.( - VOID -); - -EFI_STATUS -EFIAPI -= TotalPages + CachePages;( - VOID -); - -EFI_STATUS -EFIAPI -(sub_11A8)( - VOID -); - -EFI_STATUS -EFIAPI -HII handles and builds a table of string identifiers( - VOID -); - -EFI_STATUS -EFIAPI -call to get the number of handles.( - VOID -); - -EFI_STATUS -EFIAPI -= NULL;( - VOID -); - -EFI_STATUS -EFIAPI -again.( - VOID -); - -EFI_STATUS -EFIAPI -(UINTN idx = 0; idx < HandleCount; idx++)( - VOID -); - -EFI_STATUS -EFIAPI -the HII string protocol on each handle.( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->OpenProtocol (( - VOID -); - -EFI_STATUS -EFIAPI -string attributes (language, etc.)( - VOID -); - -EFI_STATUS -EFIAPI -= StringProtocol->GetString (( - VOID -); - -EFI_STATUS -EFIAPI -ID( - VOID -); - -EFI_STATUS -EFIAPI -table entry: 10 bytes per handle.( - VOID -); - -EFI_STATUS -EFIAPI -EntryBase;( - VOID -); - -EFI_STATUS -EFIAPI -(sub_13D8)( - VOID -); - -EFI_STATUS -EFIAPI -HII formsets matching known GUID patterns, extracts( - VOID -); - -EFI_STATUS -EFIAPI -details in the accompanying .md( - VOID -); - -EFI_STATUS -EFIAPI -DebugAssert via the HII database protocol's DEBUG output.( - VOID -); - -EFI_STATUS -EFIAPI -for brevity( - VOID -); - -EFI_STATUS -EFIAPI -the two's complement of Buffer[0] (checksum).( - VOID -); - -EFI_STATUS -EFIAPI -decompiled logic: return -*Buffer;( - VOID -); - -EFI_STATUS -EFIAPI -is the arithmetic negation (two's complement of the first byte).( - VOID -); - -EFI_STATUS -EFIAPI -(UINT8)(-(INT8)*Buffer);( - VOID -); - -EFI_STATUS -EFIAPI -in-place quicksort (Hoare partition scheme).( - VOID -); - -EFI_STATUS -EFIAPI -Pivot;( - VOID -); - -EFI_STATUS -EFIAPI -of reverse-engineered representation.( - VOID -); - -#endif /* __HARDWARESIGNATUREENTRY_H__ */ \ No newline at end of file +#endif diff --git a/AmiModulePkg/HddSmart/HddSMART/HddSmart.c b/AmiModulePkg/HddSmart/HddSMART/HddSmart.c index 1d3b7db..e8de0fe 100644 --- a/AmiModulePkg/HddSmart/HddSMART/HddSmart.c +++ b/AmiModulePkg/HddSmart/HddSMART/HddSmart.c @@ -181,7 +181,7 @@ } // --------------------------------------------------------------------------- -// HOB / Protocol cache (sub_2064 family) +// HOB / protocol cache // --------------------------------------------------------------------------- STATIC VOID *mHobList = NULL; @@ -411,7 +411,7 @@ } // --------------------------------------------------------------------------- -// ATA Pass-through helper (sub_B7C) +// ATA pass-through helper // --------------------------------------------------------------------------- /** @@ -419,7 +419,7 @@ Depending on the global flag byte_2C20, the function either issues a non-data / PIO-data-in command directly or allocates a bounce buffer and - uses the block I/O-style wrapper (sub_5A4) for device access. + uses the block I/O-style wrapper for device access. @param[in] AtaPassThru Pointer to the ATA_PASS_THRU protocol interface. @param[in] Timeout Timeout value in 100 ns units. @@ -490,7 +490,7 @@ } // --------------------------------------------------------------------------- -// Block I/O wrapper (sub_5A4) +// Block I/O wrapper // --------------------------------------------------------------------------- /** @@ -564,7 +564,7 @@ } // --------------------------------------------------------------------------- -// HII callback (sub_D44) +// HII callback // --------------------------------------------------------------------------- /** @@ -681,7 +681,7 @@ } // --------------------------------------------------------------------------- -// Driver entry point (sub_928) +// Driver entry point // --------------------------------------------------------------------------- /** @@ -847,7 +847,7 @@ } // --------------------------------------------------------------------------- -// Periodic timer callback (sub_758) +// Periodic timer callback // --------------------------------------------------------------------------- /** @@ -965,7 +965,7 @@ } // --------------------------------------------------------------------------- -// Notification helper (sub_21C4) +// SMART event notification helper // --------------------------------------------------------------------------- /** @@ -1009,7 +1009,7 @@ } // --------------------------------------------------------------------------- -// SMART data interpretation (sub_1080 / sub_18D0 / sub_1A60) +// SMART / identify data interpretation // --------------------------------------------------------------------------- /** @@ -1111,7 +1111,7 @@ } // --------------------------------------------------------------------------- -// HiiConfigAccess protocol callback wrapper (sub_1624) +// HiiConfigAccess protocol callback wrapper // --------------------------------------------------------------------------- /** @@ -1159,7 +1159,7 @@ } // --------------------------------------------------------------------------- -// Function dispatch / I/O wrapper (sub_16A0) +// Function dispatch / I/O wrapper // --------------------------------------------------------------------------- /** @@ -1208,7 +1208,7 @@ } // --------------------------------------------------------------------------- -// Driver Binding start callback (sub_1714) +// Driver Binding start callback // --------------------------------------------------------------------------- /** @@ -1250,7 +1250,7 @@ } // --------------------------------------------------------------------------- -// Driver Binding open controller (sub_17B4) +// Driver Binding open controller // --------------------------------------------------------------------------- /** @@ -1336,7 +1336,7 @@ } // --------------------------------------------------------------------------- -// Read identify data (sub_18D0) +// Read IDENTIFY data // --------------------------------------------------------------------------- /** @@ -1451,7 +1451,7 @@ } // --------------------------------------------------------------------------- -// Read SMART data (sub_1A70) +// Read SMART data // --------------------------------------------------------------------------- /** @@ -1506,7 +1506,7 @@ } // --------------------------------------------------------------------------- -// Block I/O wrapper (sub_1BFC) +// Block I/O wrapper // --------------------------------------------------------------------------- /** @@ -1584,7 +1584,7 @@ } // --------------------------------------------------------------------------- -// Block I/O write wrapper (sub_1D34) +// Block I/O write wrapper // --------------------------------------------------------------------------- /** @@ -1648,7 +1648,7 @@ } // --------------------------------------------------------------------------- -// Deferred timer callback (sub_1E70) +// Deferred timer callback // --------------------------------------------------------------------------- /** @@ -1852,4 +1852,4 @@ } CopyMem (Dst8, Src8, n); return dst; -} \ No newline at end of file +} diff --git a/AmiModulePkg/HddSmart/HddSMART/HddSmart.h b/AmiModulePkg/HddSmart/HddSMART/HddSmart.h index 9972fa1..be6de87 100644 --- a/AmiModulePkg/HddSmart/HddSMART/HddSmart.h +++ b/AmiModulePkg/HddSmart/HddSMART/HddSmart.h @@ -199,904 +199,6 @@ VOID ); -EFI_STATUS -EFIAPI -/ BaseLib stubs provided by this module( - VOID -); - -EFI_STATUS -EFIAPI -the HOB list to find the system-table HOB.( - VOID -); - -EFI_STATUS -EFIAPI -the DXE phase the HOB list is cached elsewhere.( - VOID -); - -EFI_STATUS -EFIAPI -/ Protocol cache (sub_2064 family)( - VOID -); - -EFI_STATUS -EFIAPI -the boot-services table for a HOB-format entry.( - VOID -); - -EFI_STATUS -EFIAPI -Index;( - VOID -); - -EFI_STATUS -EFIAPI -}( - VOID -); - -EFI_STATUS -EFIAPI -print if the current debug level matches.( - VOID -); - -EFI_STATUS -EFIAPI -(gHddSmartInstance == NULL) {( - VOID -); - -/// attempt to locate the debug protocol directly. -EFI_STATUS -EFIAPI -instance yet( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->LocateProtocol (&gEfiDebugPortProtocolGuid( - VOID -); - -EFI_STATUS -EFIAPI -%s to %a in the format string (in-place modification).( - VOID -); - -EFI_STATUS -EFIAPI -Pass-through Helpers( - VOID -); - -EFI_STATUS -EFIAPI -Pass-through helper (sub_B7C)( - VOID -); - -EFI_STATUS -EFIAPI -data-in commands, allocate a bounce buffer and issue the( - VOID -); - -EFI_STATUS -EFIAPI -(DataBuffer != NULL && DataSize > 0) {( - VOID -); - -EFI_STATUS -EFIAPI -I/O wrapper (sub_5A4)( - VOID -); - -EFI_STATUS -EFIAPI -byte count, aligned to 4KB boundary.( - VOID -); - -EFI_STATUS -EFIAPI -= 1 << Device->SpinupTime; // Approximate capacity( - VOID -); - -EFI_STATUS -EFIAPI -IDENTIFY / READ command.( - VOID -); - -EFI_STATUS -EFIAPI -(BlockCount == 1 && Lba == 0) {( - VOID -); - -EFI_STATUS -EFIAPI -DEVICE( - VOID -); - -EFI_STATUS -EFIAPI -be resolved from the instance( - VOID -); - -EFI_STATUS -EFIAPI -callback (sub_D44)( - VOID -); - -EFI_STATUS -EFIAPI -a local 512-byte IDENTIFY buffer.( - VOID -); - -EFI_STATUS -EFIAPI -(SerialBuf, sizeof (SerialBuf));( - VOID -); - -EFI_STATUS -EFIAPI -size for "Setup" variable( - VOID -); - -EFI_STATUS -EFIAPI -all drive data: copy IDENTIFY buffer into serial strings.( - VOID -); - -EFI_STATUS -EFIAPI -(Index = 0; Index < Instance->DeviceCount; Index++) {( - VOID -); - -EFI_STATUS -EFIAPI -the 512-byte IDENTIFY buffer into a 128-byte display area.( - VOID -); - -EFI_STATUS -EFIAPI -(SerialBuf, Device->SerialNumber, 40);( - VOID -); - -EFI_STATUS -EFIAPI -return status from device.( - VOID -); - -EFI_STATUS -EFIAPI -= HddSmartCheckStatus (Device, Action, &PredictedFailure);( - VOID -); - -EFI_STATUS -EFIAPI -the "Setup" NVRAM variable to refresh the stored serial numbers.( - VOID -); - -EFI_STATUS -EFIAPI -SMART data for all devices.( - VOID -); - -EFI_STATUS -EFIAPI -SMART data changed, fire the notification.( - VOID -); - -EFI_STATUS -EFIAPI -(!PredictedFailure) {( - VOID -); - -EFI_STATUS -EFIAPI -an action variable is set, post a deferred timer event.( - VOID -); - -EFI_STATUS -EFIAPI -(Instance->Initialized) {( - VOID -); - -EFI_STATUS -EFIAPI -entry point (sub_928)( - VOID -); - -EFI_STATUS -EFIAPI -global pointers.( - VOID -); - -EFI_STATUS -EFIAPI -(gST == NULL) {( - VOID -); - -EFI_STATUS -EFIAPI -the HII Package List protocol on our own image handle.( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->OpenProtocol (( - VOID -); - -EFI_STATUS -EFIAPI -the HII Database protocol.( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->LocateProtocol (( - VOID -); - -EFI_STATUS -EFIAPI -the HII package list with the database.( - VOID -); - -EFI_STATUS -EFIAPI -= HiiDatabase->NewPackageList (( - VOID -); - -EFI_STATUS -EFIAPI -the global instance structure.( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->AllocatePool (( - VOID -); - -EFI_STATUS -EFIAPI -function pointers.( - VOID -); - -EFI_STATUS -EFIAPI -the HII Config Access protocol.( - VOID -); - -EFI_STATUS -EFIAPI -= (EFI_HII_CONFIG_ACCESS_PROTOCOL *)gHddSmartInstance;( - VOID -); - -EFI_STATUS -EFIAPI -the driver binding protocol.( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->InstallMultipleProtocolInterfaces (( - VOID -); - -EFI_STATUS -EFIAPI -a notification for driver binding start.( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->RegisterProtocolNotify (( - VOID -); - -EFI_STATUS -EFIAPI -HII formset package.( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->InstallProtocolInterface (( - VOID -); - -EFI_STATUS -EFIAPI -timer callback (sub_758)( - VOID -); - -EFI_STATUS -EFIAPI -all handles that support Block IO.( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->LocateHandleBuffer (( - VOID -); - -EFI_STATUS -EFIAPI -the Block IO protocol on this handle.( - VOID -); - -EFI_STATUS -EFIAPI -to open ATA Pass-Through on this handle.( - VOID -); - -EFI_STATUS -EFIAPI -(gHddSmartInstance->AtaPassThru == NULL) {( - VOID -); - -EFI_STATUS -EFIAPI -SMART data into a local buffer and check for failure.( - VOID -); - -EFI_STATUS -EFIAPI -(SmartBuf, sizeof (SmartBuf));( - VOID -); - -EFI_STATUS -EFIAPI -the first byte for the SMART threshold-exceeded indicator.( - VOID -); - -EFI_STATUS -EFIAPI -((SmartBuf[0] & 0x1F) != 0) {( - VOID -); - -/// fire the notification. -EFI_STATUS -EFIAPI -failure detected( - VOID -); - -EFI_STATUS -EFIAPI -();( - VOID -); - -EFI_STATUS -EFIAPI -the local buffer for the next iteration.( - VOID -); - -EFI_STATUS -EFIAPI -helper (sub_21C4)( - VOID -); - -EFI_STATUS -EFIAPI -a platform SMI protocol is available, use it to signal the BIOS.( - VOID -); - -EFI_STATUS -EFIAPI -(gHddSmartInstance != NULL && gHddSmartInstance->Initialized) {( - VOID -); - -EFI_STATUS -EFIAPI -the SMI trigger value (0x2080002 = SMI port, 0 = data).( - VOID -); - -EFI_STATUS -EFIAPI -= 0x2080002;( - VOID -); - -/// send SMI via the ACPI enable register. -EFI_STATUS -EFIAPI -is available( - VOID -); - -EFI_STATUS -EFIAPI -(0xB2, 0x2080002);( - VOID -); - -EFI_STATUS -EFIAPI -back: open the platform-specific protocol.( - VOID -); - -EFI_STATUS -EFIAPI -= HddSmartGetDebugLevel (); // Dummy call to init cache( - VOID -); - -EFI_STATUS -EFIAPI -data interpretation (sub_1080 / sub_18D0 / sub_1A60)( - VOID -); - -EFI_STATUS -EFIAPI -type 1 (IDENTIFY), check the IDENTIFY data words.( - VOID -); - -EFI_STATUS -EFIAPI -(CommandType == 1) {( - VOID -); - -EFI_STATUS -EFIAPI -a 49-byte descriptor for SCSI pass-through.( - VOID -); - -EFI_STATUS -EFIAPI -RETURN STATUS( - VOID -); - -EFI_STATUS -EFIAPI -code( - VOID -); - -EFI_STATUS -EFIAPI -control( - VOID -); - -EFI_STATUS -EFIAPI -page code( - VOID -); - -EFI_STATUS -EFIAPI -the SCSI pass-through command if available.( - VOID -); - -EFI_STATUS -EFIAPI -(Device->SmartCapable == 1) {( - VOID -); - -EFI_STATUS -EFIAPI -call ExtScsiPassThru( - VOID -); - -EFI_STATUS -EFIAPI -if the device supports SMART (word 64 of IDENTIFY data).( - VOID -); - -EFI_STATUS -EFIAPI -(Device->SmartCapable) {( - VOID -); - -EFI_STATUS -EFIAPI -type 2, issue the SMART READ DATA command.( - VOID -); - -EFI_STATUS -EFIAPI -(Buffer, sizeof (Buffer));( - VOID -); - -EFI_STATUS -EFIAPI -word 0 (offline data structure revision) for threshold-exceeded.( - VOID -); - -EFI_STATUS -EFIAPI -protocol callback wrapper (sub_1624)( - VOID -); - -EFI_STATUS -EFIAPI -dispatch / I/O wrapper (sub_16A0)( - VOID -); - -EFI_STATUS -EFIAPI -SMART feature: READ LOG( - VOID -); - -EFI_STATUS -EFIAPI -Binding start callback (sub_1714)( - VOID -); - -EFI_STATUS -EFIAPI -a 49-byte SCSI pass-through descriptor for IDENTIFY.( - VOID -); - -EFI_STATUS -EFIAPI -(Desc, sizeof (Desc));( - VOID -); - -EFI_STATUS -EFIAPI -feature: IDENTIFY( - VOID -); - -EFI_STATUS -EFIAPI -page length( - VOID -); - -EFI_STATUS -EFIAPI -the ATA pass-through command.( - VOID -); - -EFI_STATUS -EFIAPI -HddSmartCheckStatus (&Instance->Devices[0], 1, &SmartEnabled);( - VOID -); - -EFI_STATUS -EFIAPI -Binding open controller (sub_17B4)( - VOID -); - -EFI_STATUS -EFIAPI -IDE/legacy or RAID, issue a direct ATA READ SECTORS.( - VOID -); - -EFI_STATUS -EFIAPI -HddSmartBlockIoRead (&Instance->Devices[0], 0, 1, *Buffer, NULL);( - VOID -); - -EFI_STATUS -EFIAPI -native (AHCI), use the SCSI pass-through descriptor.( - VOID -); - -EFI_STATUS -EFIAPI -/ flags( - VOID -); - -EFI_STATUS -EFIAPI -high byte( - VOID -); - -EFI_STATUS -EFIAPI -feature: READ DATA( - VOID -); - -EFI_STATUS -EFIAPI -bytes zeroed by ZeroMem above( - VOID -); - -EFI_STATUS -EFIAPI -identify data (sub_18D0)( - VOID -); - -EFI_STATUS -EFIAPI -a 512-byte buffer for IDENTIFY data.( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->AllocatePool (EfiBootServicesData, 512, &Buffer);( - VOID -); - -EFI_STATUS -EFIAPI -the SCSI pass-through descriptor.( - VOID -); - -EFI_STATUS -EFIAPI -DATA( - VOID -); - -EFI_STATUS -EFIAPI -the power-on hours nibble at offset 363 (word 181).( - VOID -); - -EFI_STATUS -EFIAPI -= ((UINT8 *)Buffer)[363] >> 4;( - VOID -); - -EFI_STATUS -EFIAPI -useful data; compute from word 0.( - VOID -); - -/// mark as -1. -EFI_STATUS -EFIAPI -data( - VOID -); - -EFI_STATUS -EFIAPI -path.( - VOID -); - -EFI_STATUS -EFIAPI -SMART data (sub_1A70)( - VOID -); - -EFI_STATUS -EFIAPI -whether the flag byte indicates we should use the( - VOID -); - -EFI_STATUS -EFIAPI -pass-through or the direct ATA command path.( - VOID -); - -EFI_STATUS -EFIAPI -the 49-byte SCSI pass-through descriptor.( - VOID -); - -EFI_STATUS -EFIAPI -ENABLE OPERATIONS( - VOID -); - -EFI_STATUS -EFIAPI -the command via the protocol callback.( - VOID -); - -EFI_STATUS -EFIAPI -= HddSmartCheckStatus (Device, 1, &Predicted);( - VOID -); - -EFI_STATUS -EFIAPI -I/O wrapper (sub_1BFC)( - VOID -); - -EFI_STATUS -EFIAPI -HddSmartBlockIoRead (&Instance->Devices[0], 0( - VOID -); - -EFI_STATUS -EFIAPI -command via the Ext SCSI Pass Thru protocol.( - VOID -); - -EFI_STATUS -EFIAPI -(Instance->Devices[0].ControllerType == 1) {( - VOID -); - -EFI_STATUS -EFIAPI -read to init( - VOID -); - -EFI_STATUS -EFIAPI -I/O write wrapper (sub_1D34)( - VOID -); - -EFI_STATUS -EFIAPI -timer callback (sub_1E70)( - VOID -); - -EFI_STATUS -EFIAPI -module entry point( - VOID -); - -EFI_STATUS -EFIAPI -and UefiRuntimeServicesTableLib( - VOID -); - -EFI_STATUS -EFIAPI -(handled by constructor in the library).( - VOID -); - -EFI_STATUS -EFIAPI -also initialise our module-level copies.( - VOID -); - -EFI_STATUS -EFIAPI -HddSmartDriverEntry (ImageHandle, SystemTable);( - VOID -); - -EFI_STATUS -EFIAPI -functions( - VOID -); - -/// copy backward. -EFI_STATUS -EFIAPI -and source precedes destination( - VOID -); - -EFI_STATUS -EFIAPI -+= n;( - VOID -); - -EFI_STATUS -EFIAPI -both buffers are large enough and well-spaced, use 64-bit copies.( - VOID -); - -EFI_STATUS -EFIAPI -(n >= 8 && ((UINTN)Src8 - (UINTN)Dst8 >= 8 ||( - VOID -); EFI_STATUS EFIAPI @@ -1134,4 +236,4 @@ VOID ); -#endif /* __HDDSMART_H__ */ \ No newline at end of file +#endif /* __HDDSMART_H__ */ diff --git a/AmiModulePkg/NVRAM/NvramSm/mm/NvramSm.c b/AmiModulePkg/NVRAM/NvramSm/mm/NvramSm.c index b1ddf05..3f8c18f 100644 --- a/AmiModulePkg/NVRAM/NvramSm/mm/NvramSm.c +++ b/AmiModulePkg/NVRAM/NvramSm/mm/NvramSm.c @@ -89,7 +89,7 @@ { UINT64 Status; - // Save gImageHandle, gST, gBS, gRS via sub_584() + // Save gImageHandle, gST, gBS, and gRS in the module globals. NvramCommonInit (ImageHandle, SystemTable); qword_11888 = EFI_UNSUPPORTED; // default return status @@ -113,7 +113,7 @@ } // ==================================================================== -// SmiVarStoreHandlerRegister (sub_10F8) +// SmiVarStoreHandlerRegister // Core initialization: install SMI handler and register varstore // protocol callbacks. // ==================================================================== @@ -183,7 +183,7 @@ } // ==================================================================== -// NvramInitializeFromHob (sub_8788) +// NvramInitializeFromHob // Locates NVRAM HOB created by PEI phase and extracts base/size. // ==================================================================== @@ -261,7 +261,7 @@ } // ==================================================================== -// NvramSmiMainHandler (sub_BF0 / sub_4D80) +// NvramSmiMainHandler // Main SMI dispatch: called when gEfiSmmVarstoreProtocolGuid fires. // Dispatches to appropriate handler based on command code. // ==================================================================== @@ -351,7 +351,7 @@ // These are registered in gSmiHandlerTable at off_DDE0. // ==================================================================== -// sub_19B4: SMI GetVariable dispatcher stub +// SMI GetVariable dispatcher stub BOOLEAN SmiGetVariableStub ( IN NVRAM_VARSTORE_CONTEXT *Context @@ -366,7 +366,7 @@ return EFI_ERROR (Status); } -// sub_19EC: SMI GetNextVariableName dispatcher stub +// SMI GetNextVariableName dispatcher stub VOID SmiGetNextVariableNameStub ( VOID @@ -375,7 +375,7 @@ // Direct call-through to store->GetNextVariableName } -// sub_1A04: SMI SetVariable dispatcher stub +// SMI SetVariable dispatcher stub BOOLEAN SmiSetVariableStub ( IN NVRAM_VARSTORE_CONTEXT *Context, @@ -408,7 +408,7 @@ return FALSE; } -// sub_1AC0: SMI QueryVariableInfo dispatcher stub +// SMI QueryVariableInfo dispatcher stub VOID SmiQueryVariableInfoStub ( VOID @@ -418,7 +418,7 @@ } // ==================================================================== -// NvramDefaultHandler (sub_4D80) +// NvramDefaultHandler // Top-level variable operation handler (Set/Get/GetNext/Query). // Decodes the SMM communication buffer and dispatches. // ==================================================================== @@ -495,7 +495,7 @@ } // ==================================================================== -// NvramSetVariableSmi (sub_983C) +// NvramSetVariableSmi // Top-level SetVariable handler. Handles Secure Boot variables // specially (PK, KEK, db, dbx, etc.). // ==================================================================== @@ -571,7 +571,7 @@ } // ==================================================================== -// Authoicated Vaariable hander (sub_AB90) +// Authenticated variable handler // Validate a signed authentited vaable (PK/KEK/db/db) // ===================================================================== @@ -588,7 +588,7 @@ ) // ==================================================================== -// SMMM Comunicion protol hander (sub_9E34) +// SMM communication protocol handler // Dispatches auenticated varia writ writ to the correct // varistore (e e., AuConsonent, TimBased) // ==================================================================== @@ -627,7 +627,7 @@ } // ==================================================================== -// VarStore sc hander (sub_BB18) +// VarStore scan handler // Scans the varistore store for for ac ac free, sle sle sle back // ==================================================================== @@ -647,7 +647,7 @@ } // ==================================================================== -// IniInIniialialize Varia store from from HOB (sub_3DBC) +// Initialize variable store from HOB // GaGba col col an coalescececece / g g g gage co co col col // ==================================================================== @@ -664,7 +664,7 @@ } // ==================================================================== -// R R ad ad a Lock / (usub_AAAC) +// ReadyToLock callback // // // st st st st t t the the the the the Va Va Va Va Va Va Va Va Va Va Va Va Va Va Va // ==================================================================== @@ -769,7 +769,7 @@ ) { // Chechch h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h - returnn (sub_8864 (VendendorGuid, &gEfEglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglglgl + return (NvramIsGlobalVariableVendor (VendorGuid, &gEfiGlobalVariableGuid) } // ==================================================================== @@ -788,7 +788,7 @@ } // ==================================================================== -// Debug/AsAsAs (usub_821C, sub_8264) +// Debug helpers // / // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // VOID @@ -826,4 +826,4 @@ // ==================================================================== // EOF: NvramSmm.c -// ==================================================================== \ No newline at end of file +// ==================================================================== diff --git a/AmiModulePkg/NVRAM/NvramSmm/NvramSmm.c b/AmiModulePkg/NVRAM/NvramSmm/NvramSmm.c index 4af64b9..8e455a3 100644 --- a/AmiModulePkg/NVRAM/NvramSmm/NvramSmm.c +++ b/AmiModulePkg/NVRAM/NvramSmm/NvramSmm.c @@ -1,7 +1,3 @@ -// NvramSmm.c - NVRAM SMM Driver -// Source: AmiModulePkg/NVRAM/NvramSmm/NvramSmm.c -// Related sources: AmiModulePkg/NVRAM/NvramSmm/NvramDxeCommon.c, AmiModulePkg/NVRAM/NvramSmm/NvramSmi.c, AmiModulePkg/NVRAM/NvramSmm/AuthService.c - #include "NvramSmm.h" // ======================================================================== @@ -120,7 +116,7 @@ } // ======================================================================== -// NVRAM Initialization (sub_10F8) +// NVRAM initialization // ======================================================================== EFI_STATUS @@ -251,7 +247,7 @@ } // ======================================================================== -// SMI NVRAM Communication Handler (sub_6AE4) +// SMI NVRAM communication handler // ======================================================================== EFI_STATUS @@ -299,7 +295,6 @@ // Buffer layout: +0x00: cmd, +0x08: NameSize, +0x10: DataSize // +0x18: Attributes, +0x20: Name[], +0x30: GUID + Data if (AlignedSize < 0x30 + 16) goto invalid; - // Nested variable read with sub_5580 Status = RuntimeGetVariable( (CHAR16 *)(AlignedBuffer + 0x08), (EFI_GUID *)(AlignedBuffer + 0x18), @@ -315,7 +310,6 @@ // +0x18: Attributes, +0x20: Name[], +0x20+NameSize: GUID // +0x30+NameSize: Data[] if (AlignedSize < 0x20 + 2) goto invalid; - // sub_5654 handles the actual set Status = RuntimeSetVariable( (CHAR16 *)(AlignedBuffer + 0x08), (EFI_GUID *)(AlignedBuffer + 0x20 + *(UINT16 *)AlignedBuffer & ~1), @@ -348,16 +342,16 @@ case SMI_NVRAM_CMD_TYPE_4: // Type 4: Variable write with auth if (AlignedSize < 0x20 + 2) goto invalid; - Status = sub_575C(*(UINT16 *)AlignedBuffer >> 1, - AlignedBuffer + 0x20, - AlignedBuffer + 0x10); + Status = SetVariableWithAuthentication(*(UINT16 *)AlignedBuffer >> 1, + AlignedBuffer + 0x20, + AlignedBuffer + 0x10); break; case SMI_NVRAM_CMD_MIGRATION_DONE: // Migration complete notification if (AlignedSize == 8) { gMigrationDone = TRUE; - qword_11618 = 0; + gMigrationDoneStatus = 0; Status = EFI_SUCCESS; } else { goto invalid; @@ -384,7 +378,7 @@ } // ======================================================================== -// SMI NVRAM Update Handler (sub_5FAC and sub_5E44) +// SMI NVRAM update handler // ======================================================================== EFI_STATUS @@ -405,7 +399,7 @@ UINT8 *Dest; EFI_STATUS Status; - StorePtr = (VAR_STORE_PTR *)gVarStoreArray[0]; // qword_11F00 + StorePtr = (VAR_STORE_PTR *)gVarStoreArray[0]; // Validate comm buffer if (CommBuffer == NULL || CommBufferSize == NULL) { @@ -486,8 +480,7 @@ return Status; } - // F Fill header calculation - UINT32 HeaderSize = GetStoreHeaderSize(StorePtrp->Info); + UINT32 HeaderSize = GetStoreHeaderSize(StorePtr->Info); if (HeaderSize == 0) { return EFI_DEVICE_ERROR; } @@ -560,7 +553,6 @@ { // Dispatches to SMI via SMI_NVRAM_CMD_GET_VARIABLE command // For non-SMM context, sends SMI to enter SMM first. - // Forward declaration: actual implementation at sub_5580. return EFI_INVALID_PARAMETER; } @@ -575,7 +567,6 @@ ) { // Dispatches to SMI via SMI_NVRAM_CMD_SET_VARIABLE command - // Forward declaration: actual implementation at sub_5654. return EFI_INVALID_PARAMETER; } @@ -588,7 +579,6 @@ ) { // Dispatches via SMI_NVRAM_CMD_GET_NEXT_VARIABLE - // Forward declaration: actual implementation at sub_F54. return EFI_INVALID_PARAMETER; } @@ -601,7 +591,6 @@ ) { // Dispatches via SMI_NVRAM_CMD_QUERY_VARIABLE_INFO - // Forward declaration: actual implementation at sub_5D34. return EFI_INVALID_PARAMETER; } @@ -847,7 +836,7 @@ } // ======================================================================== -// NVRAM HOB Retrieval (sub_644C) +// NVRAM HOB retrieval // ======================================================================== EFI_STATUS @@ -994,7 +983,7 @@ } // ====================================================================== -// NVRAMAM Init (sub_68384) +// NVRAM init // ====================================================================== EFI__STATUS diff --git a/AmiModulePkg/NVRAM/NvramSmm/NvramSmm.h b/AmiModulePkg/NVRAM/NvramSmm/NvramSmm.h index f71b1ff..731f5e1 100644 --- a/AmiModulePkg/NVRAM/NvramSmm/NvramSmm.h +++ b/AmiModulePkg/NVRAM/NvramSmm/NvramSmm.h @@ -279,7 +279,7 @@ EFI_STATUS EFIAPI -Initialization (sub_10F8)( +NVRAM initialization( VOID ); @@ -423,7 +423,7 @@ EFI_STATUS EFIAPI -NVRAM Communication Handler (sub_6AE4)( +SMI NVRAM communication handler( VOID ); @@ -465,7 +465,7 @@ EFI_STATUS EFIAPI -variable read with sub_5580( +variable read via runtime override( VOID ); @@ -519,7 +519,7 @@ EFI_STATUS EFIAPI -NVRAM Update Handler (sub_5FAC and sub_5E44)( +SMI NVRAM update handler( VOID ); @@ -675,7 +675,7 @@ EFI_STATUS EFIAPI -declaration: actual implementation at sub_5580.( +runtime get-variable implementation( VOID ); @@ -687,7 +687,7 @@ EFI_STATUS EFIAPI -declaration: actual implementation at sub_5654.( +runtime set-variable implementation( VOID ); @@ -699,7 +699,7 @@ EFI_STATUS EFIAPI -declaration: actual implementation at sub_F54.( +runtime get-next-variable implementation( VOID ); @@ -711,7 +711,7 @@ EFI_STATUS EFIAPI -declaration: actual implementation at sub_5D34.( +runtime query-variable-info implementation( VOID ); @@ -891,7 +891,7 @@ EFI_STATUS EFIAPI -HOB Retrieval (sub_644C)( +NVRAM HOB retrieval( VOID ); @@ -1023,7 +1023,7 @@ EFI_STATUS EFIAPI -Init (sub_68384)( +NVRAM init( VOID ); @@ -1069,4 +1069,4 @@ VOID ); -#endif /* __NVRAMSMM_H__ */ \ No newline at end of file +#endif /* __NVRAMSMM_H__ */ diff --git a/AmiModulePkg/Nvme/NvmeSmm/NvmeSmm/NvmeSmm.c b/AmiModulePkg/Nvme/NvmeSmm/NvmeSmm/NvmeSmm.c index f95ee97..e54563a 100644 --- a/AmiModulePkg/Nvme/NvmeSmm/NvmeSmm/NvmeSmm.c +++ b/AmiModulePkg/Nvme/NvmeSmm/NvmeSmm/NvmeSmm.c @@ -1,36 +1,26 @@ /** @file NvmeSmm.c -- NvmeSmm - - Auto-converted from IDA decompiler output. - Functions: 1 - -Copyright (c) HR650X BIOS Decompilation Project **/ #include "NvmeSmm.h" - -// -// Function: ModuleEntryPoint -// - calls NvmeSmmInitializeRuntimeState (sub_5A0) then NvmeSmmConfigureSmis (sub_166C) -// EFI_STATUS -ModuleEntryPoint(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) +NvmeSmmEntryPoint(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) { - EFI_STATUS InitializationStatus; + EFI_STATUS ConfigureStatus; EFI_STATUS ReturnStatus; - EFI_STATUS NvmeSmmModuleStatus; - VOID *NotificationState = (VOID *)0; + EFI_STATUS ModuleStatus; + VOID *NotificationContext = NULL; NvmeSmmInitializeRuntimeState(ImageHandle, SystemTable); - NvmeSmmModuleStatus = 0x8000000000000001uLL; - if ( !NvmeSmmHasPendingNotificationRegistration(NotificationState) ) + ModuleStatus = EFI_ABORTED; + if ( !NvmeSmmHasPendingNotificationRegistration(NotificationContext) ) { - InitializationStatus = NvmeSmmConfigureSmis(); - if ( InitializationStatus >= 0 || NvmeSmmModuleStatus < 0 ) - NvmeSmmModuleStatus = InitializationStatus; - NvmeSmmTearDownNotifications(NotificationState); - NvmeSmmCloseNotifications(NotificationState, -1); + ConfigureStatus = NvmeSmmConfigureSmis(); + if ( !EFI_ERROR(ConfigureStatus) || EFI_ERROR(ModuleStatus) ) + ModuleStatus = ConfigureStatus; + NvmeSmmTearDownNotifications(NotificationContext); + NvmeSmmCloseNotifications(NotificationContext, -1); NvmeSmmAutoGenAssert( "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\AmiModulePkg\\Nvme\\NvmeSmm\\NvmeSmm\\DEBUG\\AutoGen.c", 427, @@ -40,8 +30,8 @@ 442, "((BOOLEAN)(0==1))"); } - ReturnStatus = NvmeSmmModuleStatus; - if ( NvmeSmmModuleStatus < 0 ) + ReturnStatus = ModuleStatus; + if ( EFI_ERROR(ModuleStatus) ) NvmeSmmFailureCleanup(); return ReturnStatus; } diff --git a/AmiModulePkg/Nvme/NvmeSmm/NvmeSmm/NvmeSmm.h b/AmiModulePkg/Nvme/NvmeSmm/NvmeSmm/NvmeSmm.h index b1bc7af..dbcd292 100644 --- a/AmiModulePkg/Nvme/NvmeSmm/NvmeSmm/NvmeSmm.h +++ b/AmiModulePkg/Nvme/NvmeSmm/NvmeSmm/NvmeSmm.h @@ -16,34 +16,25 @@ // Function Prototypes // -// -// Recovered high-level symbols (mapped from decompilation symbols in NvmeSmm.md). -// - /// /// UEFI entry point / initialization function /// EFI_STATUS EFIAPI -ModuleEntryPoint( +NvmeSmmEntryPoint( EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable ); /// -/// NvmeSmmInitializeRuntimeState -/// - recovered behavior: cache ImageHandle, SystemTable, BootServices, RuntimeServices +/// Initialize module runtime state from the image and system table. /// EFI_STATUS EFIAPI NvmeSmmInitializeRuntimeState(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable); -/// Compatibility alias retained for decompilation symbol mapping. -#define sub_5A0 NvmeSmmInitializeRuntimeState - /// -/// NvmeSmmConfigureSmis -/// - recovered behavior: core SMM setup and SMI handler registration +/// Configure the module's SMM and SMI plumbing. /// EFI_STATUS EFIAPI @@ -51,12 +42,8 @@ VOID ); -/// Compatibility alias retained for decompilation symbol mapping. -#define sub_166C NvmeSmmConfigureSmis - /// -/// sub_19E4 -/// - recovered behavior: notification teardown callback +/// Tear down notification state during cleanup. /// EFI_STATUS EFIAPI @@ -64,12 +51,8 @@ VOID *Context ); -/// Compatibility alias retained for decompilation symbol mapping. -#define sub_19E4 NvmeSmmTearDownNotifications - /// -/// sub_3D0 -/// - recovered behavior: notification unregister by handle index +/// Close notifications by handle/index during cleanup. /// EFI_STATUS EFIAPI @@ -78,12 +61,8 @@ INT64 Index ); -/// Compatibility alias retained for decompilation symbol mapping. -#define sub_3D0 NvmeSmmCloseNotifications - /// -/// sub_1B34 -/// - recovered behavior: AutoGen assertion helper +/// AutoGen assertion helper. /// VOID EFIAPI @@ -93,12 +72,8 @@ CHAR8 *Expression ); -/// Compatibility alias retained for decompilation symbol mapping. -#define sub_1B34 NvmeSmmAutoGenAssert - /// -/// sub_330 -/// - recovered behavior: gate condition for registration/teardown path +/// Check whether notification registration is still pending. /// EFI_STATUS EFIAPI @@ -106,12 +81,8 @@ VOID *Context ); -/// Compatibility alias retained for decompilation symbol mapping. -#define sub_330 NvmeSmmHasPendingNotificationRegistration - /// -/// sub_1BE8 -/// - recovered behavior: failure-path cleanup helper +/// Run failure-path cleanup for the module. /// EFI_STATUS EFIAPI @@ -119,7 +90,4 @@ VOID ); -/// Compatibility alias retained for decompilation symbol mapping. -#define sub_1BE8 NvmeSmmFailureCleanup - #endif /* __NVMESMM_H__ */ diff --git a/AmiModulePkg/PCI/PciHostBridge/PciRootBridge.c b/AmiModulePkg/PCI/PciHostBridge/PciRootBridge.c index a662aa8..2b73a60 100644 --- a/AmiModulePkg/PCI/PciHostBridge/PciRootBridge.c +++ b/AmiModulePkg/PCI/PciHostBridge/PciRootBridge.c @@ -31,13 +31,13 @@ // ========================================================================= // -// UEFI BootServices / Runtime / DXE core handles (initialized in sub_3BC) +// UEFI BootServices / Runtime / DXE core handles (initialized at entry) // qword_18468, qword_18458, qword_18460, qword_18470 // -EFI_HANDLE gImageHandle = NULL; // sub_3BC saves ImageHandle -EFI_SYSTEM_TABLE *gST = NULL; // sub_3BC saves SystemTable -EFI_BOOT_SERVICES *gBS = NULL; // sub_3BC saves BS -EFI_RUNTIME_SERVICES *gRT = NULL; // sub_3BC saves RT +EFI_HANDLE gImageHandle = NULL; // saved from module entry +EFI_SYSTEM_TABLE *gST = NULL; // saved from module entry +EFI_BOOT_SERVICES *gBS = NULL; // saved from module entry +EFI_RUNTIME_SERVICES *gRT = NULL; // saved from module entry VOID *gDS = NULL; // DXE Services (qword_184F0) // @@ -196,7 +196,7 @@ } // ========================================================================= -// Function: InitializeUefiBootServiceTables (original sub_3BC @ 0x3BC) +// Function: InitializeUefiBootServiceTables // // Saves globals: ImageHandle, gST, gBS, gRT, gDS, also initializes // PCIE_SEG_BUS_TABLE and PCD library. Called once at entry. @@ -219,9 +219,8 @@ // // Locate DXE Services Table (gDS) // - Status = EfiGetSystemConfigurationTable(&gEfiDxeServicesTableGuid, &gDS); - ASSERT_EFI_ERROR(Status); - ASSERT(gDS != NULL); + gDS = PciHostBridgeGetConfigurationTableEntry (&gEfiDxeServicesTableGuid); + ASSERT (gDS != NULL); // // Locate PCD protocol (mPcd) @@ -243,7 +242,7 @@ VOID *PcdProtocol; UINT64 PcieSegBusSize; - PcdProtocol = GetPcdProtocol(); + PcdProtocol = PciHostBridgeGetPcdProtocol(); PcieSegBusSize = PcdGetSize(PcdToken(7)); if (PcieSegBusSize > sizeof(PCIE_SEG_BUS_TABLE)) { DEBUG((EFI_D_ERROR, "sizeof(PCIE_SEG_BUS_TABLE) >= LibPcdGetSize(7U)\n")); @@ -254,15 +253,15 @@ } // ========================================================================= -// Function: PciHostBridgeEntry (original sub_5E0 @ 0x5E0) +// Function: PciHostBridgeEntry // // Main driver logic. The entry function: // 1. Prints AMI PCI module version banner // 2. Enumerates host bridges from BoardInfo2 SDL data // 3. Allocates HB private data (168 bytes per bridge) -// 4. Reserves chipset-specific resources (sub_38F4) -// 5. Queries platform setup config (sub_3FE0) -// 6. Converts unallocated memory to MMIO (sub_179C) +// 4. Reserves chipset-specific resources +// 5. Queries platform setup config +// 6. Converts unallocated memory to MMIO // 7. Installs EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL per HB // 8. For each root bridge (SDL), installs: // - EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL @@ -347,7 +346,7 @@ // Allocate array of active HB SDL record pointers // ActiveCount = 0; - ActiveRecordArray = (UINT64*)AllocatePool (8 * ActiveCount); // will be overwritten + ActiveRecordArray = (UINT64*)PciHostBridgeAllocatePool (8 * ActiveCount); // will be overwritten if (ActiveRecordArray == NULL) { Status = EFI_OUT_OF_RESOURCES; DEBUG ((EFI_D_INFO, @@ -386,8 +385,8 @@ // // Allocate global resources: setup config (7 bytes), HB private array // - gpSetupConfig = AllocateZeroPool (7); - gpHostBrgPrivate = AllocateZeroPool (168 * gHostBrgCount); + gpSetupConfig = PciHostBridgeAllocateZeroPool (7); + gpHostBrgPrivate = PciHostBridgeAllocateZeroPool (168 * gHostBrgCount); DEBUG ((EFI_D_INFO, " HB: Allocate HB Private Data ...@ 0x%X; ", gpHostBrgPrivate)); if (gpHostBrgPrivate == NULL) { @@ -552,7 +551,7 @@ // // Allocate root bridge context (480 bytes total) // - RbPrivate = AllocateZeroPool (sizeof (PCI_ROOT_BRIDGE_PRIVATE)); + RbPrivate = PciHostBridgeAllocateZeroPool (sizeof (PCI_ROOT_BRIDGE_PRIVATE)); if (RbPrivate == NULL) { break; } @@ -659,7 +658,7 @@ { UINT8 *BusDescriptor; - BusDescriptor = (UINT8*)AllocateZeroPool (46); + BusDescriptor = (UINT8*)PciHostBridgeAllocateZeroPool (46); RbPrivate->BusDescriptor = BusDescriptor; // @@ -753,7 +752,7 @@ RbUid = (UINT32)RbIndex; } - PathData = AllocateZeroPool (16); + PathData = PciHostBridgeAllocateZeroPool (16); RbPrivate->DevicePath = PathData; *(UINT32*)PathData = 0x000C0002; // HID @@ -877,7 +876,7 @@ } // ========================================================================= -// Function: PciHostBridgeReserveCspResources (original sub_38F4 @ 0x38F4) +// Function: PciHostBridgeReserveCspResources // // Uses GCD services to: // 1. Walk host bridge SDL records and their MMIO ranges @@ -919,7 +918,7 @@ } // ========================================================================= -// Function: PciHostBridgeSetupConfig (original sub_3FE0 @ 0x3FE0) +// Function: PciHostBridgeSetupConfig // // Reads the UEFI "Setup" variable (which is an EFI variable with the // platform setup configuration GUID) to extract PCI-related setup options @@ -951,7 +950,7 @@ } SetupSize = 814; - SetupBuffer = AllocateZeroPool (SetupSize); + SetupBuffer = PciHostBridgeAllocateZeroPool (SetupSize); if (SetupBuffer == NULL) { return EFI_OUT_OF_RESOURCES; } @@ -993,7 +992,7 @@ } // ========================================================================= -// Function: PciHostBridgeConvertMemory (original sub_179C @ 0x179C) +// Function: PciHostBridgeConvertMemory // // Uses the DXE memory services to: // 1. Iterate over GCD memory map @@ -1040,10 +1039,10 @@ // ========================================================================= // -// AllocatePool (original sub_47D8 @ 0x47D8) +// PciHostBridgeAllocatePool // VOID* -AllocatePool ( +PciHostBridgeAllocatePool ( UINTN Size ) { @@ -1055,16 +1054,16 @@ } // -// AllocateZeroPool (original sub_4804 @ 0x4804) +// PciHostBridgeAllocateZeroPool // VOID* -AllocateZeroPool ( +PciHostBridgeAllocateZeroPool ( UINTN Size ) { VOID *Buffer; - Buffer = AllocatePool (Size); + Buffer = PciHostBridgeAllocatePool (Size); if (Buffer != NULL) { gBS->SetMem (Buffer, Size, 0); } @@ -1072,10 +1071,10 @@ } // -// GetPcdProtocol (original sub_35D0 @ 0x35D0) +// PciHostBridgeGetPcdProtocol // VOID* -GetPcdProtocol ( +PciHostBridgeGetPcdProtocol ( VOID ) { @@ -1093,10 +1092,10 @@ } // -// EfiGetSystemConfigurationTable (original sub_4510 @ 0x4510) +// PciHostBridgeGetConfigurationTableEntry // VOID* -EfiGetSystemConfigurationTable ( +PciHostBridgeGetConfigurationTableEntry ( EFI_GUID *Guid ) { @@ -1128,7 +1127,7 @@ } // -// LocateDxeServicesTable (original sub_4B5C @ 0x4B5C) +// LocateDxeServicesTable // EFI_STATUS LocateDxeServicesTable ( @@ -1136,7 +1135,7 @@ ) { if (gDS == NULL) { - gDS = EfiGetSystemConfigurationTable (&gEfiDxeServicesTableGuid); + gDS = PciHostBridgeGetConfigurationTableEntry (&gEfiDxeServicesTableGuid); if (gDS == NULL) { return (EFI_STATUS)(0xA000000000000002ULL); } @@ -1145,7 +1144,7 @@ } // -// LocateBoardInfo2Protocol (original sub_365C @ 0x365C) +// LocateBoardInfo2Protocol // EFI_STATUS LocateBoardInfo2Protocol ( @@ -1170,7 +1169,7 @@ } // -// PciHostBridgeFindSdlRecordIndex (original sub_3754 @ 0x3754) +// PciHostBridgeFindSdlRecordIndex // EFI_STATUS PciHostBridgeFindSdlRecordIndex ( @@ -1206,7 +1205,7 @@ } // -// PciHostBridgeGetRootBridges (original sub_37D0 @ 0x37D0) +// PciHostBridgeGetRootBridges // EFI_STATUS PciHostBridgeGetRootBridges ( @@ -1257,7 +1256,7 @@ // // Allocate and fill output list // - OutputList = (UINT64*)AllocatePool (8 * FoundEntries); + OutputList = (UINT64*)PciHostBridgeAllocatePool (8 * FoundEntries); if (OutputList == NULL) { return EFI_OUT_OF_RESOURCES; } @@ -1276,4 +1275,4 @@ *Count = FoundEntries; return EFI_SUCCESS; -} \ No newline at end of file +} diff --git a/AmiModulePkg/PCI/PciHostBridge/PciRootBridge.h b/AmiModulePkg/PCI/PciHostBridge/PciRootBridge.h index 87590b1..78f00b3 100644 --- a/AmiModulePkg/PCI/PciHostBridge/PciRootBridge.h +++ b/AmiModulePkg/PCI/PciHostBridge/PciRootBridge.h @@ -1,7 +1,5 @@ /** @file - PciRootBridge.h -- Header for PciRootBridge - -Copyright (c) HR650X BIOS Decompilation Project + PciRootBridge.h -- PCI host bridge and root bridge declarations. **/ #ifndef __PCIROOTBRIDGE_H__ @@ -9,1191 +7,113 @@ #include "../uefi_headers/Uefi.h" -// -// Function Prototypes -// - -EFI_STATUS -EFIAPI -PciHbNotifyPhase( - VOID -); - -EFI_STATUS -EFIAPI -PciHbGetNextRootBridge( - VOID -); - -EFI_STATUS -EFIAPI -PciHbGetAllocAttributes( - VOID -); - -EFI_STATUS -EFIAPI -PciHbStartBusEnumeration( - VOID -); - -EFI_STATUS -EFIAPI -PciHbSetBusNumbers( - VOID -); - -EFI_STATUS -EFIAPI -PciHbSubmitResources( - VOID -); - -EFI_STATUS -EFIAPI -PciHbGetProposedResources( - VOID -); - -EFI_STATUS -EFIAPI -PciHbPreprocessController( - VOID -); - EFI_STATUS EFIAPI ModuleEntryPoint( - VOID -); + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ); EFI_STATUS EFIAPI PciHostBridgeEntry( - VOID -); + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ); EFI_STATUS EFIAPI PciHostBridgeReserveCspResources( - VOID -); + IN EFI_HANDLE ImageHandle + ); EFI_STATUS EFIAPI PciHostBridgeSetupConfig( VOID -); + ); EFI_STATUS EFIAPI PciHostBridgeConvertMemory( - VOID -); - -EFI_STATUS -EFIAPI -LocateDxeServicesTable( - VOID -); - -EFI_STATUS -EFIAPI -LocateBoardInfo2Protocol( - VOID -); + IN EFI_HANDLE ImageHandle + ); EFI_STATUS EFIAPI PciHostBridgeFindSdlRecordIndex( - VOID -); + IN VOID *Record, + OUT UINT64 *Index + ); EFI_STATUS EFIAPI PciHostBridgeGetRootBridges( - VOID -); + IN UINT64 BridgeIndex, + OUT VOID **List, + OUT UINT64 *Count + ); EFI_STATUS EFIAPI -Variables( - VOID -); +PciHbNotifyPhase( + IN PCI_HOST_BRIDGE_PRIVATE *This, + IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PHASE Phase + ); EFI_STATUS EFIAPI -BootServices / Runtime / DXE core handles (initialized in sub_3BC)( - VOID -); +PciHbGetNextRootBridge( + IN PCI_HOST_BRIDGE_PRIVATE *This, + IN OUT EFI_HANDLE *RootBridgeHandle + ); EFI_STATUS EFIAPI -gImageHandle = NULL; // sub_3BC saves ImageHandle( - VOID -); +PciHbGetAllocAttributes( + IN PCI_HOST_BRIDGE_PRIVATE *This, + IN EFI_HANDLE RootBridgeHandle, + OUT UINT64 *Attributes + ); EFI_STATUS EFIAPI -saves SystemTable( - VOID -); +PciHbStartBusEnumeration( + IN PCI_HOST_BRIDGE_PRIVATE *This, + IN EFI_HANDLE RootBridgeHandle, + OUT VOID **Configuration + ); EFI_STATUS EFIAPI -saves BS( - VOID -); +PciHbSetBusNumbers( + IN PCI_HOST_BRIDGE_PRIVATE *This, + IN EFI_HANDLE RootBridgeHandle, + IN VOID *Configuration + ); EFI_STATUS EFIAPI -saves RT( - VOID -); +PciHbSubmitResources( + IN PCI_HOST_BRIDGE_PRIVATE *This, + IN EFI_HANDLE RootBridgeHandle, + IN VOID *Configuration + ); EFI_STATUS EFIAPI -Services (qword_184F0)( - VOID -); +PciHbGetProposedResources( + IN PCI_HOST_BRIDGE_PRIVATE *This, + IN EFI_HANDLE RootBridgeHandle, + OUT VOID **Configuration + ); EFI_STATUS EFIAPI -bridge tracking( - VOID -); +PciHbPreprocessController( + IN PCI_HOST_BRIDGE_PRIVATE *This, + IN EFI_HANDLE RootBridgeHandle, + IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_PCI_ADDRESS PciAddress + ); -EFI_STATUS -EFIAPI --- number of host bridges( - VOID -); - -EFI_STATUS -EFIAPI --- allocated HB private data array (168 bytes per entry)( - VOID -); - -EFI_STATUS -EFIAPI -gHostBrgCount = 0;( - VOID -); - -EFI_STATUS -EFIAPI -PCI USRA handle (PCIE_SEG_BUS_TABLE / MMIO PCI cfg access)( - VOID -); - -EFI_STATUS -EFIAPI -//( - VOID -); - -EFI_STATUS -EFIAPI -protocol (qword_18480)( - VOID -); - -EFI_STATUS -EFIAPI -*gpPcdProtocol = NULL;( - VOID -); - -EFI_STATUS -EFIAPI -(qword_18488)( - VOID -); - -EFI_STATUS -EFIAPI -SDL (System Description Layer) board data( - VOID -); - -EFI_STATUS -EFIAPI -*gpBoardInfo2Protocol = NULL;( - VOID -); - -EFI_STATUS -EFIAPI -host bridge data pointer (from BoardInfo2 protocol)( - VOID -); - -EFI_STATUS -EFIAPI -configuration buffer (from UEFI variable "Setup")( - VOID -); - -EFI_STATUS -EFIAPI --- 7 bytes: [0]=PciHot, [1]=PciAer, [2]=PciHpc, [3]=Above4G, [4-5]=?( - VOID -); - -EFI_STATUS -EFIAPI -*gpSetupConfig = NULL;( - VOID -); - -EFI_STATUS -EFIAPI -(qword_18430)( - VOID -); - -EFI_STATUS -EFIAPI -*gpIoMmuProtocol = NULL;( - VOID -); - -EFI_STATUS -EFIAPI -(qword_18420)( - VOID -); - -EFI_STATUS -EFIAPI -*gpAmiBoardPciInit = NULL;( - VOID -); - -EFI_STATUS -EFIAPI -event handle (qword_18560)( - VOID -); - -EFI_STATUS -EFIAPI -gReadyToBootEvent = NULL;( - VOID -); - -EFI_STATUS -EFIAPI -Handoff data (qword_18440 / qword_18438)( - VOID -); - -EFI_STATUS -EFIAPI -gSmmHandoffHostCnt = 0;( - VOID -); - -EFI_STATUS -EFIAPI -function declarations (renamed from sub_XXXX)( - VOID -); - -/// saves boot services/runtime/dxe tables -EFI_STATUS -EFIAPI -library init function( - VOID -); - -EFI_STATUS -EFIAPI -EFI_STATUS( - VOID -); - -EFI_STATUS -EFIAPI -dispatch function declarations (HB protocol)( - VOID -); - -EFI_STATUS -EFIAPI -EFIAPI( - VOID -); - -EFI_STATUS -EFIAPI -DXE driver entry point. Called by firmware.( - VOID -); - -EFI_STATUS -EFIAPI -to PciHostBridgeEntry().( - VOID -); - -EFI_STATUS -EFIAPI -globals: ImageHandle, gST, gBS, gRT, gDS, also initializes( - VOID -); - -EFI_STATUS -EFIAPI -and PCD library. Called once at entry.( - VOID -); - -EFI_STATUS -EFIAPI -UEFI core handles( - VOID -); - -EFI_STATUS -EFIAPI -DXE Services Table (gDS)( - VOID -); - -EFI_STATUS -EFIAPI -= EfiGetSystemConfigurationTable(&gEfiDxeServicesTableGuid, &gDS);( - VOID -); - -EFI_STATUS -EFIAPI -PCD protocol (mPcd)( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->LocateProtocol(&gPcdProtocolGuid, NULL, &gpPcdProtocol);( - VOID -); - -EFI_STATUS -EFIAPI -MM PCI USRA (PCIE_SEG_BUS_TABLE)( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->LocateProtocol(&gAmiPcieSegBusTableGuid, NULL, &gpPciUsra);( - VOID -); - -EFI_STATUS -EFIAPI -PCIE_SEG_BUS_TABLE size is sufficient( - VOID -); - -EFI_STATUS -EFIAPI -driver logic. The entry function:( - VOID -); - -EFI_STATUS -EFIAPI -module version banner( - VOID -); - -EFI_STATUS -EFIAPI -((EFI_D_INFO( - VOID -); - -EFI_STATUS -EFIAPI -AMI_BOARD_INFO2_PROTOCOL to get SDL host bridge data( - VOID -); - -EFI_STATUS -EFIAPI -= LocateBoardInfo2Protocol ();( - VOID -); - -EFI_STATUS -EFIAPI -active host bridges (SDL records with bit[57] & 1 set)( - VOID -); - -EFI_STATUS -EFIAPI -= 0;( - VOID -); - -EFI_STATUS -EFIAPI -array of active HB SDL record pointers( - VOID -); - -EFI_STATUS -EFIAPI -be overwritten( - VOID -); - -EFI_STATUS -EFIAPI -chipset-specific (CSP) resources( - VOID -); - -EFI_STATUS -EFIAPI -((EFI_D_INFO, " HB: Reserve CSP Resources( ImageHandle=0x%X)\n", ImageHandle));( - VOID -); - -EFI_STATUS -EFIAPI -global resources: setup config (7 bytes), HB private array( - VOID -); - -EFI_STATUS -EFIAPI -= AllocateZeroPool (7);( - VOID -); - -EFI_STATUS -EFIAPI -platform setup config from UEFI "Setup" variable( - VOID -); - -EFI_STATUS -EFIAPI -= PciHostBridgeSetupConfig ();( - VOID -); - -EFI_STATUS -EFIAPI -all unallocated memory to MMIO using GCD services( - VOID -); - -EFI_STATUS -EFIAPI -= PciHostBridgeConvertMemory (ImageHandle);( - VOID -); - -EFI_STATUS -EFIAPI -AmiBoardPciInitProtocol (for board-specific PCI init callbacks)( - VOID -); - -EFI_STATUS -EFIAPI -(gpAmiBoardPciInit == NULL) {( - VOID -); - -EFI_STATUS -EFIAPI -over each active host bridge( - VOID -); - -EFI_STATUS -EFIAPI -(HostBrgIndex = 0; HostBrgIndex < gHostBrgCount; HostBrgIndex++) {( - VOID -); - -EFI_STATUS -EFIAPI -SDL record index for this host bridge( - VOID -); - -EFI_STATUS -EFIAPI -(SdlRecord != NULL) {( - VOID -); - -EFI_STATUS -EFIAPI -in HB private context( - VOID -); - -EFI_STATUS -EFIAPI -attributes supported:( - VOID -); - -EFI_STATUS -EFIAPI -protocol dispatch function table( - VOID -); - -EFI_STATUS -EFIAPI -disable above-4G decode attribute( - VOID -); - -EFI_STATUS -EFIAPI -(!((UINT8*)gpSetupConfig)[3]) {( - VOID -); - -EFI_STATUS -EFIAPI -chipset-specific common function: Initialize HB (Step 12, Cmd 1)( - VOID -); - -EFI_STATUS -EFIAPI -= PciHostBridgeCallCmnFn (Private, 12, 1);( - VOID -); - -EFI_STATUS -EFIAPI -EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL protocol( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->InstallProtocolInterface (( - VOID -); - -EFI_STATUS -EFIAPI -root bridges for this host bridge from SDL( - VOID -); - -EFI_STATUS -EFIAPI -= PciHostBridgeGetRootBridges (( - VOID -); - -EFI_STATUS -EFIAPI -per-previous-host RB counts for UID assignment( - VOID -); - -EFI_STATUS -EFIAPI -(HostBrgIndex > 0) {( - VOID -); - -EFI_STATUS -EFIAPI -no root bridges found, skip HB processing( - VOID -); - -EFI_STATUS -EFIAPI -(RbCount == 0) {( - VOID -); - -EFI_STATUS -EFIAPI -each root bridge found, allocate and initialize a root bridge( - VOID -); - -EFI_STATUS -EFIAPI -context of 480 bytes.( - VOID -); - -EFI_STATUS -EFIAPI -(RbIndex = 0; RbIndex < RbCount; RbIndex++) {( - VOID -); - -EFI_STATUS -EFIAPI -root bridge context (480 bytes total)( - VOID -); - -EFI_STATUS -EFIAPI -= AllocateZeroPool (sizeof (PCI_ROOT_BRIDGE_PRIVATE));( - VOID -); - -EFI_STATUS -EFIAPI -root bridge: link to host bridge, get SDL record, etc.( - VOID -); - -EFI_STATUS -EFIAPI -SDL record index for this root bridge( - VOID -); - -EFI_STATUS -EFIAPI -(RbSdlRecord != NULL) {( - VOID -); - -EFI_STATUS -EFIAPI -supported: from SDL entry offset 16( - VOID -); - -EFI_STATUS -EFIAPI -name buffer: from SDL entry offset 24( - VOID -); - -EFI_STATUS -EFIAPI -above-4G decode is enabled (setup[3] true), add 4G decode attribute( - VOID -); - -EFI_STATUS -EFIAPI -(((UINT8*)gpSetupConfig)[3]) {( - VOID -); - -EFI_STATUS -EFIAPI -chipset-specific: Initialize RB (Step 13, Cmd 2)( - VOID -); - -EFI_STATUS -EFIAPI -= PciHostBridgeCallCmnFn (RbPrivate, 13, 2);( - VOID -); - -EFI_STATUS -EFIAPI -RB is flagged as NOT present, skip further initialization( - VOID -); - -EFI_STATUS -EFIAPI -(*(UINT8*)((UINT8*)RbPrivate + 243)) {( - VOID -); - -EFI_STATUS -EFIAPI -protocol dispatch table for RootBridgeIo( - VOID -); - -EFI_STATUS -EFIAPI -segment number from SDL( - VOID -); - -EFI_STATUS -EFIAPI -initial bus range ACPI descriptor (46 bytes)( - VOID -); - -EFI_STATUS -EFIAPI -QWord Resource Descriptor:( - VOID -); - -EFI_STATUS -EFIAPI -= 0x8A (Small: 0x8A is QWord descriptor for bus range)( - VOID -); - -EFI_STATUS -EFIAPI -= 43( - VOID -); - -EFI_STATUS -EFIAPI -= secondary bus number (RbSdlRecord[8])( - VOID -); - -EFI_STATUS -EFIAPI -= subordinate bus number (from next SDL or 0xFF)( - VOID -); - -EFI_STATUS -EFIAPI -= _MAX - _MIN + 1( - VOID -); - -EFI_STATUS -EFIAPI -Address Space Descriptor( - VOID -); - -EFI_STATUS -EFIAPI -BusDescriptor[2] = 2; // bus range type( - VOID -); - -EFI_STATUS -EFIAPI -*(UINT64*)(BusDescriptor + 22) = 0xFF; // _MAX (may be adjusted if next bridge)( - VOID -); - -EFI_STATUS -EFIAPI -}( - VOID -); - -EFI_STATUS -EFIAPI -chipset-specific: Initialize Bus Range (Step 14, Cmd 2)( - VOID -); - -EFI_STATUS -EFIAPI -= *(UINT16*)(RbPrivate->BusDescriptor + 14);( - VOID -); - -EFI_STATUS -EFIAPI -ACPI device path (_SB scope H[host]R[ Rb](AslName)BSH )( - VOID -); - -EFI_STATUS -EFIAPI -install it via RuntimeServices->SetVariable or similar( - VOID -); - -EFI_STATUS -EFIAPI -bus descriptor to RB resource list( - VOID -); - -EFI_STATUS -EFIAPI -= PciRootBridgeAppendResource (RbPrivate, BusDescriptor);( - VOID -); - -EFI_STATUS -EFIAPI -and install DEVICE_PATH protocol with ACPI _UID( - VOID -); - -EFI_STATUS -EFIAPI -*(UINT32*)((UINT8*)PathData + 4) = 0x0A034810; // UID( - VOID -); - -EFI_STATUS -EFIAPI -+ end( - VOID -); - -EFI_STATUS -EFIAPI -both RB_IO and DevicePath protocols together( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->InstallMultipleProtocolInterfaces (( - VOID -); - -EFI_STATUS -EFIAPI -protocol( - VOID -); - -EFI_STATUS -EFIAPI -path( - VOID -); - -EFI_STATUS -EFIAPI -hot-plug controller support is enabled (setup[2] == 1)( - VOID -); - -EFI_STATUS -EFIAPI -HPC (Hot-Plug Controller) protocol( - VOID -); - -EFI_STATUS -EFIAPI -(((UINT8*)gpSetupConfig)[2] == 1) {( - VOID -); - -EFI_STATUS -EFIAPI -for each root bridge( - VOID -); - -EFI_STATUS -EFIAPI -for each host bridge( - VOID -); - -EFI_STATUS -EFIAPI -SMM Handoff protocol if not already installed( - VOID -); - -EFI_STATUS -EFIAPI -(gSmmHandoffHandle == NULL) {( - VOID -); - -EFI_STATUS -EFIAPI -ReadyToBoot event( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->CreateEvent (( - VOID -); - -EFI_STATUS -EFIAPI -IOMMU protocol notification and close SMM lock event( - VOID -); - -EFI_STATUS -EFIAPI -= PciAccessCspRegisterIoMmuNotify (( - VOID -); - -EFI_STATUS -EFIAPI -for IOMMU protocol (gEdkiiIoMmuProtocolGuid)( - VOID -); - -EFI_STATUS -EFIAPI -(gpIoMmuProtocol == NULL) {( - VOID -); - -EFI_STATUS -EFIAPI -GCD services to:( - VOID -); - -EFI_STATUS -EFIAPI -before HB private data is installed.( - VOID -); - -EFI_STATUS -EFIAPI -DXE services table( - VOID -); - -EFI_STATUS -EFIAPI -= LocateDxeServicesTable ();( - VOID -); - -EFI_STATUS -EFIAPI -over each SDL host bridge entry, walk its memory resources( - VOID -); - -EFI_STATUS -EFIAPI -mark them in GCD. For each entry:( - VOID -); - -EFI_STATUS -EFIAPI -detail: This function processes 342-byte SDL records( - VOID -); - -EFI_STATUS -EFIAPI -at IOBase, MemBase, MemLen fields.( - VOID -); - -EFI_STATUS -EFIAPI -EFI_SUCCESS;( - VOID -); - -EFI_STATUS -EFIAPI -the UEFI "Setup" variable (which is an EFI variable with the( - VOID -); - -EFI_STATUS -EFIAPI -setup configuration GUID) to extract PCI-related setup options( - VOID -); - -EFI_STATUS -EFIAPI -a 7-byte global buffer (gpSetupConfig):( - VOID -); - -EFI_STATUS -EFIAPI -the "Setup" variable can't be read, defaults are set:( - VOID -); - -EFI_STATUS -EFIAPI -"Setup" variable (the platform setup variable)( - VOID -); - -EFI_STATUS -EFIAPI -= gRT->GetVariable (( - VOID -); - -EFI_STATUS -EFIAPI -not found; use defaults( - VOID -); - -EFI_STATUS -EFIAPI -the DXE memory services to:( - VOID -); - -EFI_STATUS -EFIAPI -handles the IO space in a similar manner.( - VOID -); - -EFI_STATUS -EFIAPI -after CSP resource reservation.( - VOID -); - -EFI_STATUS -EFIAPI -GCD memory map entries:( - VOID -); - -EFI_STATUS -EFIAPI -each entry that is free (unallocated) and within the( - VOID -); - -EFI_STATUS -EFIAPI -bridge's resource windows:( - VOID -); - -EFI_STATUS -EFIAPI -Helpers (internal)( - VOID -); - -EFI_STATUS -EFIAPI -(original sub_47D8 @ 0x47D8)( - VOID -); - -EFI_STATUS -EFIAPI -(original sub_4804 @ 0x4804)( - VOID -); - -EFI_STATUS -EFIAPI -(original sub_35D0 @ 0x35D0)( - VOID -); - -EFI_STATUS -EFIAPI -(original sub_4510 @ 0x4510)( - VOID -); - -EFI_STATUS -EFIAPI -the configuration table looking for the matching GUID( - VOID -); - -EFI_STATUS -EFIAPI -(i = 0; i < EntryCount; i++) {( - VOID -); - -EFI_STATUS -EFIAPI -(original sub_4B5C @ 0x4B5C)( - VOID -); - -EFI_STATUS -EFIAPI -LocateDxeServicesTable (( - VOID -); - -EFI_STATUS -EFIAPI -(original sub_365C @ 0x365C)( - VOID -); - -EFI_STATUS -EFIAPI -LocateBoardInfo2Protocol (( - VOID -); - -EFI_STATUS -EFIAPI -(original sub_3754 @ 0x3754)( - VOID -); - -EFI_STATUS -EFIAPI -PciHostBridgeFindSdlRecordIndex (( - VOID -); - -EFI_STATUS -EFIAPI -(original sub_37D0 @ 0x37D0)( - VOID -); - -EFI_STATUS -EFIAPI -PciHostBridgeGetRootBridges (( - VOID -); - -EFI_STATUS -EFIAPI -entries that belong to this bridge index (SDL[0]==BridgeIndex)( - VOID -); - -EFI_STATUS -EFIAPI -and fill output list( - VOID -); - -EFI_STATUS -EFIAPI -= (UINT64*)AllocatePool (8 * FoundEntries);( - VOID -); - -#endif /* __PCIROOTBRIDGE_H__ */ \ No newline at end of file +#endif diff --git a/AmiModulePkg/RuntimeDxe/RuntimeDxe/RuntimeDxe.c b/AmiModulePkg/RuntimeDxe/RuntimeDxe/RuntimeDxe.c index 6e2ff25..b709374 100644 --- a/AmiModulePkg/RuntimeDxe/RuntimeDxe/RuntimeDxe.c +++ b/AmiModulePkg/RuntimeDxe/RuntimeDxe/RuntimeDxe.c @@ -33,6 +33,7 @@ EFI_EVENT mEfiVirtualNotifyEvent = NULL; EFI_EVENT mEfiExitBootServicesEvent = NULL; EFI_EVENT mRuntimeDriverInitEndOfDxeEvent = NULL; +VOID *mRuntimeDriverHobList = NULL; // // Status code protocol table pointer @@ -132,7 +133,7 @@ } /* ======================================================================== - * UefiBootServicesTableLib Constructor (sub_1154) + * UefiBootServicesTableLib Constructor * ======================================================================== */ /** @@ -140,12 +141,11 @@ * and registers event notification callbacks. * * Registers: - * - VirtualAddressChange event (sub_1CF0) - * - ConvertPointer event (sub_1CFC) - * - RuntimeDriverInitializeEndOfDxe (sub_1E00) - * - SetVirtualAddressMap notify (nullsub_1) - * - ExitBootServices notify (sub_2044) - * - EndOfDxe notify (sub_206C) + * - VirtualAddressChange event + * - ExitBootServices event + * - EndOfDxe event + * - SetVirtualAddressMap notify + * - Status code SetVirtualAddressMap handler * * @param[in] ImageHandle Handle for this image * @param[in] SystemTable Pointer to EFI System Table @@ -275,7 +275,7 @@ } /* ======================================================================== - * Runtime Driver Initialize (sub_1628) + * Runtime Driver Initialize * ======================================================================== */ /** @@ -336,7 +336,7 @@ } /* ======================================================================== - * RuntimeDriver ConvertPointer (sub_1724) + * RuntimeDriver ConvertPointer * ======================================================================== */ /** @@ -395,7 +395,7 @@ } /* ======================================================================== - * RuntimeDriver SetVirtualAddressMap (sub_17B0) + * RuntimeDriver SetVirtualAddressMap * ======================================================================== */ /** @@ -555,7 +555,7 @@ } /* ======================================================================== - * RuntimeDriver CalculateCrc32 (sub_1B00) + * RuntimeDriver CalculateCrc32 * ======================================================================== */ /** @@ -602,7 +602,7 @@ } /* ======================================================================== - * RuntimeDriver GetNextVariableName (sub_1BA8) / Debug Print router + * RuntimeDriver Debug Print router * ======================================================================== */ /** @@ -643,7 +643,7 @@ } /* ======================================================================== - * DebugPrint (sub_1C30) + * DebugPrint * ======================================================================== */ /** @@ -709,7 +709,7 @@ } /* ======================================================================== - * DebugAssert (sub_1CB0) + * DebugAssert * ======================================================================== */ /** @@ -737,7 +737,7 @@ } /* ======================================================================== - * VirtualAddressChangeNotify (sub_1CF0) + * VirtualAddressChangeNotify * ======================================================================== */ /** @@ -754,7 +754,7 @@ } /* ======================================================================== - * RuntimeDriver ExitBootServices Notify (sub_1CFC) + * RuntimeDriver ExitBootServices Notify * ======================================================================== */ /** @@ -779,7 +779,7 @@ } /* ======================================================================== - * RuntimeDriver Initialize EndOfDxe (sub_1D24) + * RuntimeDriver Initialize EndOfDxe * ======================================================================== */ /** @@ -804,9 +804,9 @@ // // Check if HOB list is already cached // - if (mRuntimeDriverBootServicesEvent == NULL) { + if (mRuntimeDriverHobList == NULL) { Index = 0; - mRuntimeDriverBootServicesEvent = 0; + mRuntimeDriverHobList = 0; if (gSystemTable->HobList != NULL) { // @@ -822,7 +822,7 @@ HobList = *(UINTN *)((UINTN)gSystemTable->ConfigurationTable + Index * sizeof(EFI_CONFIGURATION_TABLE) + sizeof(EFI_GUID)); - mRuntimeDriverBootServicesEvent = (VOID *)HobList; + mRuntimeDriverHobList = (VOID *)HobList; break; } } @@ -833,7 +833,7 @@ } if (HobList == 0) { - ASSERT (mRuntimeDriverBootServicesEvent != NULL); + ASSERT (mRuntimeDriverHobList != NULL); } } else { DEBUG ((EFI_D_ERROR, "\nASSERT_EFI_ERROR (Status = %r)\n", EFI_NOT_FOUND)); @@ -841,11 +841,11 @@ } } - return (UINTN)mRuntimeDriverBootServicesEvent; + return (UINTN)mRuntimeDriverHobList; } /* ======================================================================== - * RuntimeDriver InitializeEndOfDxe event callback (sub_1E00) + * RuntimeDriver InitializeEndOfDxe event callback * ======================================================================== */ /** @@ -864,7 +864,7 @@ } /* ======================================================================== - * RuntimeDriver PeCoff Relocate (sub_1E14) + * RuntimeDriver PeCoff Relocate * ======================================================================== */ /** @@ -1042,7 +1042,7 @@ } /* ======================================================================== - * ReportStatusCodeConstructor (sub_1FE4) + * ReportStatusCodeConstructor * ======================================================================== */ /** @@ -1057,7 +1057,7 @@ { EFI_STATUS Status; - if (mRuntimeDriverBootServicesEvent == NULL && !mEfiGoneVirtual) { + if (mRuntimeDriverHobList == NULL && !mEfiGoneVirtual) { if (gBootServices != NULL) { if (gBootServices->LocateProtocol != NULL) { Status = (UINTN)gBootServices->LocateProtocol ( @@ -1074,7 +1074,7 @@ } /* ======================================================================== - * RuntimeDriver SetVirtualAddressMap Handler (sub_2044) + * RuntimeDriver SetVirtualAddressMap Handler * ======================================================================== */ /** @@ -1099,7 +1099,7 @@ } /* ======================================================================== - * RuntimeDriver SetVirtualAddressMap Notify (sub_206C / nullsub) + * RuntimeDriver SetVirtualAddressMap Notify * ======================================================================== */ /** @@ -1117,7 +1117,7 @@ } /* ======================================================================== - * RuntimeDriverCalculateCrc32 Wrapper (sub_2084) + * RuntimeDriver Report Status Code * ======================================================================== */ /** @@ -1129,9 +1129,9 @@ */ EFI_STATUS EFIAPI -RuntimeDriverCalculateCrc32Event ( - UINTN a1, - UINT32 n51449860 +RuntimeDriverReportStatusCode ( + UINTN Data, + UINT32 StatusCode ) { ReportStatusCodeConstructor (); @@ -1139,7 +1139,7 @@ if (mRuntimeStatusCodeTable != NULL) { return ((EFI_STATUS_CODE_PROTOCOL *)mRuntimeStatusCodeTable)->ReportStatusCode ( EFI_PROGRESS_CODE, - n51449860, + StatusCode, 0, &gEfiStatusCodeDataTypeGuid, NULL @@ -1149,7 +1149,7 @@ } /* ======================================================================== - * RuntimeDriver CompareGuid (sub_20C8) + * RuntimeDriver CompareGuid * ======================================================================== */ /** @@ -1178,7 +1178,7 @@ } /* ======================================================================== - * RuntimeDriver ReadUnaligned64 (sub_2138) + * RuntimeDriver ReadUnaligned64 * ======================================================================== */ /** @@ -1198,7 +1198,7 @@ } /* ======================================================================== - * RuntimeDriver SetWatchdogTimer (nullsub_1 at 0x1DFC) + * RuntimeDriver SetWatchdogTimer no-op * ======================================================================== */ /** @@ -1213,4 +1213,4 @@ // // Intentionally empty (no-op) // -} \ No newline at end of file +} diff --git a/AmiModulePkg/RuntimeDxe/RuntimeDxe/RuntimeDxe.h b/AmiModulePkg/RuntimeDxe/RuntimeDxe/RuntimeDxe.h index 1c9c288..c89a730 100644 --- a/AmiModulePkg/RuntimeDxe/RuntimeDxe/RuntimeDxe.h +++ b/AmiModulePkg/RuntimeDxe/RuntimeDxe/RuntimeDxe.h @@ -1,604 +1,149 @@ -/** @file - RuntimeDxe.h -- Header for RuntimeDxe - -Copyright (c) HR650X BIOS Decompilation Project -**/ - #ifndef __RUNTIMEDXE_H__ #define __RUNTIMEDXE_H__ #include "../uefi_headers/Uefi.h" -// -// Function Prototypes -// - EFI_STATUS EFIAPI -ModuleEntryPoint( - VOID -); +ModuleEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ); -EFI_STATUS +UINTN EFIAPI -UefiBootServicesTableLibConstructor( - VOID -); +UefiBootServicesTableLibConstructor ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ); EFI_STATUS EFIAPI -RuntimeDriverInitialize( - VOID -); +RuntimeDriverInitialize ( + IN EFI_HANDLE ImageHandle + ); EFI_STATUS EFIAPI -RuntimeDriverConvertPointer( - VOID -); +RuntimeDriverConvertPointer ( + IN UINTN DebugDisposition, + IN OUT VOID **ConvertAddress + ); EFI_STATUS EFIAPI -RuntimeDriverSetVirtualAddressMap( - VOID -); +RuntimeDriverSetVirtualAddressMap ( + IN UINT64 MemoryMapSize, + IN UINT64 DescriptorSize, + IN UINT32 DescriptorVersion, + IN EFI_MEMORY_DESCRIPTOR *VirtualMap + ); EFI_STATUS EFIAPI -RuntimeDriverCalculateCrc32( - VOID -); +RuntimeDriverCalculateCrc32 ( + IN VOID *Data, + IN UINTN DataSize, + OUT UINT32 *CrcOut + ); -EFI_STATUS +UINTN EFIAPI -RuntimeDriverDebugProtocol( +RuntimeDriverDebugProtocol ( VOID -); + ); EFI_STATUS EFIAPI -DebugPrint( - VOID -); +DebugPrint ( + IN UINTN ErrorLevel, + IN CONST CHAR8 *Format, + ... + ); -EFI_STATUS +VOID EFIAPI -DebugAssert( - VOID -); +DebugAssert ( + IN CONST CHAR8 *FileName, + IN UINTN LineNumber, + IN CONST CHAR8 *Description + ); -EFI_STATUS +VOID EFIAPI -VirtualAddressChangeNotify( +VirtualAddressChangeNotify ( VOID -); + ); EFI_STATUS EFIAPI -RuntimeDriverExitBootServicesNotify( +RuntimeDriverExitBootServicesNotify ( VOID -); + ); -EFI_STATUS +UINTN EFIAPI -RuntimeDriverInitializeEndOfDxe( - VOID -); +RuntimeDriverInitializeEndOfDxe ( + IN VOID *Event + ); EFI_STATUS EFIAPI -RuntimeDriverInitializeEndOfDxeCallback( +RuntimeDriverInitializeEndOfDxeCallback ( VOID -); + ); -EFI_STATUS +UINT16 EFIAPI -RuntimeDriverPeCoffRelocateImage( - VOID -); +RuntimeDriverPeCoffRelocateImage ( + IN UINTN OldBase, + IN UINTN NewBase, + IN UINTN ImageSize, + IN UINT16 *FixupData + ); -EFI_STATUS +VOID EFIAPI -ReportStatusCodeConstructor( +ReportStatusCodeConstructor ( VOID -); + ); EFI_STATUS EFIAPI -RuntimeDriverSetVirtualAddressMapHandler( +RuntimeDriverSetVirtualAddressMapHandler ( VOID -); + ); -EFI_STATUS +VOID EFIAPI -RuntimeDriverSetVirtualAddressMapNotify( +RuntimeDriverSetVirtualAddressMapNotify ( VOID -); + ); EFI_STATUS EFIAPI -RuntimeDriverCalculateCrc32Event( - VOID -); +RuntimeDriverReportStatusCode ( + UINTN Data, + UINT32 StatusCode + ); -EFI_STATUS +BOOLEAN EFIAPI -RuntimeDriverCompareGuid( - VOID -); +RuntimeDriverCompareGuid ( + IN EFI_GUID *Guid1, + IN EFI_GUID *Guid2 + ); -EFI_STATUS +UINT64 EFIAPI -RuntimeDriverReadUnaligned64( - VOID -); +RuntimeDriverReadUnaligned64 ( + IN VOID *Buffer + ); -EFI_STATUS +VOID EFIAPI -RuntimeDriverSetWatchdogTimerHandler( +RuntimeDriverSetWatchdogTimerHandler ( VOID -); + ); -EFI_STATUS -EFIAPI -registered during initialization( - VOID -); - -EFI_STATUS -EFIAPI -mRuntimeDriverExitBootServicesEvent = NULL;( - VOID -); - -EFI_STATUS -EFIAPI -code protocol table pointer( - VOID -); - -EFI_STATUS -EFIAPI -*mRuntimeStatusCodeTable = NULL;( - VOID -); - -EFI_STATUS -EFIAPI -TRUE after SetVirtualAddressMap has been called( - VOID -); - -EFI_STATUS -EFIAPI -mEfiGoneVirtual = FALSE;( - VOID -); - -EFI_STATUS -EFIAPI -list head for registered images( - VOID -); - -EFI_STATUS -EFIAPI -mRuntimeDriverImageList;( - VOID -); - -EFI_STATUS -EFIAPI -UEFI boot/runtime service table pointers( - VOID -); - -EFI_STATUS -EFIAPI -(ImageHandle, SystemTable);( - VOID -); - -EFI_STATUS -EFIAPI -runtime driver initialization( - VOID -); - -EFI_STATUS -EFIAPI -= RuntimeDriverInitialize (ImageHandle);( - VOID -); - -EFI_STATUS -EFIAPI -VirtualAddressChange notification (TPL_CALLBACK, notify function)( - VOID -); - -EFI_STATUS -EFIAPI -= BootServices->CreateEvent (( - VOID -); - -EFI_STATUS -EFIAPI -event to disable watchdog timer on ExitBootServices( - VOID -); - -EFI_STATUS -EFIAPI -EndOfDxe notification( - VOID -); - -EFI_STATUS -EFIAPI -= gBootServices->CreateEvent (( - VOID -); - -EFI_STATUS -EFIAPI -SetVirtualAddressMap notification( - VOID -); - -EFI_STATUS -EFIAPI -the status code reporting interface( - VOID -); - -EFI_STATUS -EFIAPI -();( - VOID -); - -EFI_STATUS -EFIAPI -ExitBootServices notification via status code protocol( - VOID -); - -EFI_STATUS -EFIAPI -SetVirtualAddressMap notification via status code protocol( - VOID -); - -EFI_STATUS -EFIAPI -the Runtime Image protocol( - VOID -); - -EFI_STATUS -EFIAPI -= gBootServices->LocateProtocol (( - VOID -); - -EFI_STATUS -EFIAPI -the SetWatchdogTimer runtime service( - VOID -); - -EFI_STATUS -EFIAPI -the Runtime Driver protocol( - VOID -); - -EFI_STATUS -EFIAPI -the virtual address map to find the descriptor covering( - VOID -); - -EFI_STATUS -EFIAPI -input address( - VOID -); - -EFI_STATUS -EFIAPI -= (EFI_MEMORY_DESCRIPTOR *)mRuntimeDriverImageList.ForwardLink;( - VOID -); - -EFI_STATUS -EFIAPI -the virtual address offset( - VOID -); - -EFI_STATUS -EFIAPI -data and instruction caches for the memory map( - VOID -); - -EFI_STATUS -EFIAPI -((VOID *)(UINTN)MemoryMapSize, 51449860);( - VOID -); - -EFI_STATUS -EFIAPI -all registered virtual address change callbacks( - VOID -); - -EFI_STATUS -EFIAPI -= mRuntimeDriverImageList.ForwardLink;( - VOID -); - -EFI_STATUS -EFIAPI -the callback address( - VOID -); - -EFI_STATUS -EFIAPI -= (UINTN)ImageEntry->PhysicalStart;( - VOID -); - -EFI_STATUS -EFIAPI -the callback (OriginalImageBase, SizeOfImage, ImageEntry)( - VOID -); - -EFI_STATUS -EFIAPI -the image list and convert each image's base address( - VOID -); - -EFI_STATUS -EFIAPI -(ImageEntry = mRuntimeDriverImageList.ForwardLink;( - VOID -); - -EFI_STATUS -EFIAPI -instruction cache( - VOID -); - -EFI_STATUS -EFIAPI -(ImageEntry->ImageSize != NULL &&( - VOID -); - -EFI_STATUS -EFIAPI -all Runtime Services pointers( - VOID -); - -EFI_STATUS -EFIAPI -(0, (VOID **)&gRuntime->GetTime);( - VOID -); - -EFI_STATUS -EFIAPI -CRC32 for Runtime Services table( - VOID -); - -EFI_STATUS -EFIAPI -= 0;( - VOID -); - -EFI_STATUS -EFIAPI -CRC32 for System Table( - VOID -); - -EFI_STATUS -EFIAPI -POST card of successful virtual address switch( - VOID -); - -EFI_STATUS -EFIAPI -(0x80, 0xB1);( - VOID -); - -EFI_STATUS -EFIAPI -for overflow( - VOID -); - -EFI_STATUS -EFIAPI -(DataSize > (MAX_ADDRESS - (UINTN)Data + 1)) {( - VOID -); - -EFI_STATUS -EFIAPI -if this is boot-time and allocate protocol( - VOID -); - -EFI_STATUS -EFIAPI -(gBootServices != NULL &&( - VOID -); - -EFI_STATUS -EFIAPI -if the debug protocol is available( - VOID -); - -EFI_STATUS -EFIAPI -(mRuntimeStatusCodeTable != NULL) {( - VOID -); - -EFI_STATUS -EFIAPI -the current debug level from CMOS( - VOID -); - -EFI_STATUS -EFIAPI -= IoRead8 (0x70);( - VOID -); - -EFI_STATUS -EFIAPI -if HOB list is already cached( - VOID -); - -EFI_STATUS -EFIAPI -(mRuntimeDriverBootServicesEvent == NULL) {( - VOID -); - -EFI_STATUS -EFIAPI -configuration table entries looking for HobList( - VOID -); - -EFI_STATUS -EFIAPI -(Index = 0; Index < (UINTN)gSystemTable->NumberOfTableEntries; Index++) {( - VOID -); - -EFI_STATUS -EFIAPI -for DOS header magic( - VOID -); - -EFI_STATUS -EFIAPI -(*(UINT16 *)OldBase == IMAGE_DOS_SIGNATURE) {( - VOID -); - -EFI_STATUS -EFIAPI -} else {( - VOID -); - -EFI_STATUS -EFIAPI -for PE signature( - VOID -); - -EFI_STATUS -EFIAPI -(*(UINT32 *)ImageBase != IMAGE_PE_SIGNATURE) {( - VOID -); - -EFI_STATUS -EFIAPI -relocation directory RVA and size( - VOID -); - -EFI_STATUS -EFIAPI -(*(UINT16 *)(ImageBase + 4) == 0x200 &&( - VOID -); - -EFI_STATUS -EFIAPI -= *(UINT32 *)(ImageBase + 0x84);( - VOID -); - -EFI_STATUS -EFIAPI -(32-bit)( - VOID -); - -EFI_STATUS -EFIAPI -= *(UINT32 *)(ImageBase + 0x74);( - VOID -); - -EFI_STATUS -EFIAPI -relocation directory size( - VOID -); - -EFI_STATUS -EFIAPI -(RelocDirEntrySize <= sizeof(UINT32) * 2) {( - VOID -); - -EFI_STATUS -EFIAPI -relocation base and end pointers( - VOID -); - -EFI_STATUS -EFIAPI -= OldBase + RelocDirEntryRva;( - VOID -); - -EFI_STATUS -EFIAPI -each base relocation block( - VOID -); - -EFI_STATUS -EFIAPI -= (UINT32 *)RelocBase;( - VOID -); - -EFI_STATUS -EFIAPI -empty (no-op)( - VOID -); - -#endif /* __RUNTIMEDXE_H__ */ \ No newline at end of file +#endif diff --git a/AmiModulePkg/RuntimeSmm/RuntimeSmm/RuntimeSmm.c b/AmiModulePkg/RuntimeSmm/RuntimeSmm/RuntimeSmm.c index 712fb99..d79c845 100644 --- a/AmiModulePkg/RuntimeSmm/RuntimeSmm/RuntimeSmm.c +++ b/AmiModulePkg/RuntimeSmm/RuntimeSmm/RuntimeSmm.c @@ -1,31 +1,27 @@ /** @file RuntimeSmm.c -- RuntimeSmm - Auto-converted from IDA decompiler output. - Functions recovered from local RuntimeSmm.md/README.md evidence. - Copyright (c) HR650X BIOS Decompilation Project **/ #include "RuntimeSmm.h" -// Recovered module globals (symbol names preferred in docs + map compatibility aliases). -EFI_HANDLE gImageHandle; // 0x1300 -EFI_SYSTEM_TABLE *gST; // 0x12F0 -EFI_RUNTIME_SERVICES *gRT; // 0x1308 -EFI_BOOT_SERVICES *gBS; // 0x1320 -EFI_STATUS_CODE_PROTOCOL *mDebugProtocol; // 0x1318 -EFI_RUNTIME_SERVICES *RuntimeServices; // 0x1328 -VOID *gSmst; // 0x1330 / 0x1310 -UINT8 mSmmMode; // 0x1338 -VOID *mRuntimeServicesProtocolSmm; // 0x1340 -UINT8 mInSmmMode; // 0x1348 -VOID *mStatusCodeProtocolSmm; // 0x1350 -VOID *mRuntimeServicesProtocolBoot; // 0x1358 -VOID *mSmmRuntimeServicesTable; // 0x1360 -VOID *mStatusCodeProtocolBoot; // 0x1368 -UINT8 mCmosByte; // 0x1378 -UINT8 gSetJumpBuffer[248]; // 0x1380 +EFI_HANDLE gImageHandle; +EFI_SYSTEM_TABLE *gST; +EFI_RUNTIME_SERVICES *gRT; +EFI_BOOT_SERVICES *gBS; +EFI_STATUS_CODE_PROTOCOL *mDebugProtocol; +EFI_RUNTIME_SERVICES *RuntimeServices; +VOID *gSmst; +UINT8 mSmmMode; +VOID *mRuntimeServicesProtocolSmm; +UINT8 mInSmmMode; +VOID *mStatusCodeProtocolSmm; +VOID *mRuntimeServicesProtocolBoot; +VOID *mSmmRuntimeServicesTable; +VOID *mStatusCodeProtocolBoot; +UINT8 mCmosByte; +UINT8 gSetJumpBuffer[248]; EFI_GUID gEfiSmmStatusCodeProtocolGuid; // 0x1280 EFI_GUID gEfiStatusCodeRuntimeProtocolGuid; // 0x1290 @@ -35,10 +31,6 @@ EFI_GUID gSmmRuntimeServicesProtocolGuid; // 0x12D0 EFI_GUID gSmmRuntimeServicesTableGuid; // 0x12E0 -// -// Recovered function names -// - EFI_STATUS EFIAPI RuntimeSmmCacheSystemServices ( @@ -62,12 +54,12 @@ { (VOID)ImageHandle; (VOID)SystemTable; - return RuntimeSmmInitialize(); + return RuntimeSmmInitializeRuntimeProtocols(); } VOID EFIAPI -RuntimeSmmSetJump ( +RuntimeSmmSetJumpBuffer ( VOID ) { @@ -75,7 +67,7 @@ VOID EFIAPI -RuntimeSmmLongJump ( +RuntimeSmmRestoreJumpBuffer ( VOID ) { @@ -96,7 +88,7 @@ EFI_STATUS EFIAPI -RuntimeSmmDefaultProtocolNotifyHandler ( +RuntimeSmmSmmBaseProtocolNotify ( VOID ) { @@ -105,7 +97,7 @@ EFI_STATUS EFIAPI -RuntimeSmmRegisterProtocolNotifyTable ( +RuntimeSmmInstallProtocolNotifyTable ( VOID ) { @@ -114,7 +106,7 @@ EFI_STATUS EFIAPI -RuntimeSmmInitialize ( +RuntimeSmmInitializeRuntimeProtocols ( VOID ) { @@ -123,7 +115,7 @@ EFI_STATUS EFIAPI -RuntimeSmmLocateDebugProtocol ( +RuntimeSmmLocateStatusCodeProtocol ( VOID ) { @@ -132,7 +124,7 @@ EFI_STATUS EFIAPI -RuntimeSmmReportStatusCodeHandler ( +RuntimeSmmReportStatusCodeToSmm ( VOID ) { @@ -141,7 +133,7 @@ EFI_STATUS EFIAPI -RuntimeSmmReportStatusCodeExHandler ( +RuntimeSmmReportStatusCodeExToSmm ( VOID ) { @@ -150,7 +142,7 @@ EFI_STATUS EFIAPI -RuntimeSmmReadRuntimeModeFromCmos ( +RuntimeSmmReadRuntimeModeFlagFromCmos ( VOID ) { @@ -159,7 +151,7 @@ EFI_STATUS EFIAPI -RuntimeSmmValidateJumpBuffer ( +RuntimeSmmValidateJumpBufferState ( VOID ) { @@ -168,7 +160,7 @@ EFI_STATUS EFIAPI -RuntimeSmmRegisterRuntimeServices ( +RuntimeSmmRegisterRuntimeServicesProtocol ( VOID ) { @@ -177,7 +169,7 @@ EFI_STATUS EFIAPI -RuntimeSmmRegisterStatusCodeProtocol ( +RuntimeSmmRegisterStatusCodeProtocolPair ( VOID ) { @@ -186,7 +178,7 @@ EFI_STATUS EFIAPI -RuntimeSmmFindCallbackProtocol ( +RuntimeSmmLocateRuntimeCallbackProtocol ( VOID ) { @@ -195,7 +187,7 @@ EFI_STATUS EFIAPI -RuntimeSmmCompareGuid ( +RuntimeSmmCompareGuidValue ( VOID ) { diff --git a/AmiModulePkg/RuntimeSmm/RuntimeSmm/RuntimeSmm.h b/AmiModulePkg/RuntimeSmm/RuntimeSmm/RuntimeSmm.h index fcbe736..ab844d1 100644 --- a/AmiModulePkg/RuntimeSmm/RuntimeSmm/RuntimeSmm.h +++ b/AmiModulePkg/RuntimeSmm/RuntimeSmm/RuntimeSmm.h @@ -9,10 +9,6 @@ #include "../uefi_headers/Uefi.h" -// -// Recovered high-level symbols. -// - EFI_STATUS EFIAPI _ModuleEntryPoint( @@ -49,107 +45,107 @@ VOID EFIAPI -RuntimeSmmSetJump( +RuntimeSmmSetJumpBuffer( VOID ); VOID EFIAPI -RuntimeSmmLongJump( +RuntimeSmmRestoreJumpBuffer( VOID ); EFI_STATUS EFIAPI -RuntimeSmmDefaultProtocolNotifyHandler( +RuntimeSmmSmmBaseProtocolNotify( VOID ); EFI_STATUS EFIAPI -RuntimeSmmRegisterProtocolNotifyTable( +RuntimeSmmInstallProtocolNotifyTable( VOID ); EFI_STATUS EFIAPI -RuntimeSmmInitialize( +RuntimeSmmInitializeRuntimeProtocols( VOID ); EFI_STATUS EFIAPI -RuntimeSmmLocateDebugProtocol( +RuntimeSmmLocateStatusCodeProtocol( VOID ); EFI_STATUS EFIAPI -RuntimeSmmReportStatusCodeHandler( +RuntimeSmmReportStatusCodeToSmm( VOID ); EFI_STATUS EFIAPI -RuntimeSmmReportStatusCodeExHandler( +RuntimeSmmReportStatusCodeExToSmm( VOID ); EFI_STATUS EFIAPI -RuntimeSmmReadRuntimeModeFromCmos( +RuntimeSmmReadRuntimeModeFlagFromCmos( VOID ); EFI_STATUS EFIAPI -RuntimeSmmValidateJumpBuffer( +RuntimeSmmValidateJumpBufferState( VOID ); EFI_STATUS EFIAPI -RuntimeSmmRegisterRuntimeServices( +RuntimeSmmRegisterRuntimeServicesProtocol( VOID ); EFI_STATUS EFIAPI -RuntimeSmmRegisterStatusCodeProtocol( +RuntimeSmmRegisterStatusCodeProtocolPair( VOID ); EFI_STATUS EFIAPI -RuntimeSmmFindCallbackProtocol( +RuntimeSmmLocateRuntimeCallbackProtocol( VOID ); EFI_STATUS EFIAPI -RuntimeSmmCompareGuid( +RuntimeSmmCompareGuidValue( VOID ); // // Recovered globals. // -extern EFI_HANDLE gImageHandle; // 0x1300 -extern EFI_SYSTEM_TABLE *gST; // 0x12F0 -extern EFI_RUNTIME_SERVICES *gRT; // 0x1308 -extern EFI_BOOT_SERVICES *gBS; // 0x1320 -extern EFI_STATUS_CODE_PROTOCOL *mDebugProtocol; // 0x1318 -extern EFI_RUNTIME_SERVICES *RuntimeServices; // 0x1328 -extern VOID *gSmst; // 0x1330 / 0x1310 -extern UINT8 mSmmMode; // 0x1338 -extern VOID *mRuntimeServicesProtocolSmm; // 0x1340 -extern UINT8 mInSmmMode; // 0x1348 -extern VOID *mStatusCodeProtocolSmm; // 0x1350 -extern VOID *mRuntimeServicesProtocolBoot; // 0x1358 -extern VOID *mSmmRuntimeServicesTable; // 0x1360 -extern VOID *mStatusCodeProtocolBoot; // 0x1368 -extern UINT8 mCmosByte; // 0x1378 -extern UINT8 gSetJumpBuffer[248]; // 0x1380 +extern EFI_HANDLE gImageHandle; // module image handle +extern EFI_SYSTEM_TABLE *gST; // system table cache +extern EFI_RUNTIME_SERVICES *gRT; // runtime services cache +extern EFI_BOOT_SERVICES *gBS; // boot services cache +extern EFI_STATUS_CODE_PROTOCOL *mDebugProtocol; // status code protocol +extern EFI_RUNTIME_SERVICES *RuntimeServices; // runtime services snapshot +extern VOID *gSmst; // SMM system table cache +extern UINT8 mSmmMode; // SMM mode flag +extern VOID *mRuntimeServicesProtocolSmm; // SMM runtime services protocol +extern UINT8 mInSmmMode; // runtime SMM state flag +extern VOID *mStatusCodeProtocolSmm; // SMM status code protocol +extern VOID *mRuntimeServicesProtocolBoot; // boot runtime services protocol +extern VOID *mSmmRuntimeServicesTable; // runtime services table in SMM +extern VOID *mStatusCodeProtocolBoot; // boot status code protocol +extern UINT8 mCmosByte; // CMOS runtime mode byte +extern UINT8 gSetJumpBuffer[248]; // jump buffer storage extern EFI_GUID gEfiSmmStatusCodeProtocolGuid; // 0x1280 extern EFI_GUID gEfiStatusCodeRuntimeProtocolGuid; // 0x1290 @@ -159,7 +155,6 @@ extern EFI_GUID gSmmRuntimeServicesProtocolGuid; // 0x12D0 extern EFI_GUID gSmmRuntimeServicesTableGuid; // 0x12E0 -// Compatibility aliases for map-style names still referenced in in-repo docs. #define qword_12F0 gST #define qword_1308 gRT #define qword_1300 gImageHandle @@ -179,22 +174,4 @@ #define qword_12D0 gSmmRuntimeServicesProtocolGuid #define qword_12E0 gSmmRuntimeServicesTableGuid -// Compatibility aliases for decompilation symbol mapping. -#define sub_44C RuntimeSmmCacheSystemServices -#define sub_58C RuntimeSmmInitJumpState -#define sub_300 RuntimeSmmSetJump -#define sub_3A0 RuntimeSmmLongJump -#define sub_640 RuntimeSmmDefaultProtocolNotifyHandler -#define sub_64C RuntimeSmmRegisterProtocolNotifyTable -#define sub_768 RuntimeSmmInitialize -#define sub_888 RuntimeSmmLocateDebugProtocol -#define sub_8D8 RuntimeSmmReportStatusCodeHandler -#define sub_920 RuntimeSmmReportStatusCodeExHandler -#define sub_960 RuntimeSmmReadRuntimeModeFromCmos -#define sub_9B0 RuntimeSmmValidateJumpBuffer -#define sub_9F8 RuntimeSmmRegisterRuntimeServices -#define sub_A80 RuntimeSmmRegisterStatusCodeProtocol -#define sub_B64 RuntimeSmmFindCallbackProtocol -#define sub_BD4 RuntimeSmmCompareGuid - #endif /* __RUNTIMESMM_H__ */ diff --git a/AmiModulePkg/SmmS3SaveState/S3SaveStateDxe/S3SaveStateDxe.c b/AmiModulePkg/SmmS3SaveState/S3SaveStateDxe/S3SaveStateDxe.c index 0c5e820..2a5707d 100644 --- a/AmiModulePkg/SmmS3SaveState/S3SaveStateDxe/S3SaveStateDxe.c +++ b/AmiModulePkg/SmmS3SaveState/S3SaveStateDxe/S3SaveStateDxe.c @@ -79,9 +79,9 @@ * _ModuleEntryPoint (0x404) * * Standard UEFI DXE driver entry point. Calls ProcessLibraryConstructorList - * (sub_4B4) to initialize library globals, then registers the main driver - * callback (sub_1C5C / AcpiS3ContextInitialize) as a timer event. - * Finally installs the EFI_S3_SAVE_STATE protocol interface. + * to initialize library globals, then registers AcpiS3ContextInitialize + * as a timer event. Finally installs the EFI_S3_SAVE_STATE protocol + * interface. */ EFI_STATUS EFIAPI @@ -120,11 +120,11 @@ } /*=========================================================================== - * Library Constructor (ProcessLibraryConstructorList / sub_4B4) + * Library Constructor (ProcessLibraryConstructorList) *===========================================================================*/ /** - * ProcessLibraryConstructorList (sub_4B4) + * ProcessLibraryConstructorList * * Initializes all UEFI library globals used by this module: * - Saves ImageHandle, gST, gBS, gRT from entry params @@ -191,7 +191,7 @@ *===========================================================================*/ /** - * AcpiS3ContextInitialize (sub_1C5C) + * AcpiS3ContextInitialize * * Called at end-of-DXE (via timer event). This function: * 1. Checks if LockBox protocol is available; skips context save if not. @@ -308,7 +308,7 @@ } /** - * AllocatePagesOrCrash (sub_18A4) + * AllocatePagesOrCrash * * Allocates N bytes of physically contiguous pages. * Rounds size up to page granularity. @@ -344,7 +344,7 @@ } /** - * AllocateS3NvsPageTable (sub_1AB0) + * AllocateS3NvsPageTable * * Calculates the page table size needed for S3 resume based on: * - Physical address width (from CPUID or HOB) @@ -441,7 +441,7 @@ } /** - * LocateAcpiFacsTable (sub_1940) + * LocateAcpiFacsTable * * Searches for the FACS table in the ACPI configuration tables. * Takes an ACPI table GUID (either RSDT or XSDT) and walks @@ -569,7 +569,7 @@ *===========================================================================*/ /** - * BootScriptTableInit (sub_339C) + * BootScriptTableInit * * Initializes the boot script buffer and registers protocol callbacks. * Called from ProcessLibraryConstructorList after library constructors. @@ -670,7 +670,7 @@ *===========================================================================*/ /** - * ScriptAllocateEntry (sub_3B64) + * ScriptAllocateEntry * * Allocates space in the boot script buffer for an entry of EntrySize bytes. * @@ -724,7 +724,7 @@ } /** - * ScriptWriteTerminator (sub_2C10) + * ScriptWriteTerminator * * Writes the 0xFF 0xFF 0xFF terminator at position [Table->CurrentOffset] * in the buffer and updates the TotalLength field at buffer[5]. @@ -751,7 +751,7 @@ } /** - * ScriptFinalizeEntry (sub_3BF8) + * ScriptFinalizeEntry * * After writing an entry to the boot script buffer in SMM mode, * this function updates the SMM LockBox with the new content range. @@ -797,7 +797,7 @@ } /** - * BootScriptBufferGrow (sub_3918) + * BootScriptBufferGrow * * Allocates or grows the boot script buffer. Called from ScriptAllocateEntry * when there's insufficient space. @@ -888,7 +888,7 @@ } /** - * BootScriptResync (sub_3AAC) + * BootScriptResync * * Restores the boot script buffer from LockBox after SMM has modified it. * This is a synchronization step between SMM communication calls. @@ -934,7 +934,7 @@ *===========================================================================*/ /** - * GetSmmCommunicationProtocol (sub_2610) + * GetSmmCommunicationProtocol * * Locates and caches the SMM Communication protocol via UEFI * boot services LocateProtocol. @@ -963,7 +963,7 @@ } /** - * SmmCommunicationGetBuffer (sub_2660) + * SmmCommunicationGetBuffer * * Reads the SMM Communication Region Table from system configuration * and finds the entry with Type == 7 (SMM_COMMUNICATE_HEADER_VARIABLE_SIZE) @@ -1011,7 +1011,7 @@ } /** - * SaveLockBox (sub_2700) + * SaveLockBox * * Sends a SaveLockBox command via SMM Communication protocol. * Copies the GUID + buffer data into the shared communication buffer @@ -1088,7 +1088,7 @@ } /** - * SetLockBoxAttributes (sub_2844) + * SetLockBoxAttributes * * Sends a SetLockBoxAttributes command via SMM Communication protocol. * @@ -1152,7 +1152,7 @@ } /** - * UpdateLockBox (sub_2970) + * UpdateLockBox * * Sends an UpdateLockBox command via SMM Communication protocol. * Updates data at a specific offset within an existing LockBox entry. @@ -1217,7 +1217,7 @@ } /** - * RestoreLockBox (sub_2AB8) + * RestoreLockBox * * Sends a RestoreLockBox command via SMM Communication protocol. * @@ -1299,7 +1299,7 @@ *===========================================================================*/ /** - * GetPcdProtocol (sub_20D4) + * GetPcdProtocol * * Lazily locates and caches the PCD protocol (gEfiPcdProtocolGuid). */ @@ -1325,7 +1325,7 @@ } /** - * GetHobList (sub_2500) + * GetHobList * * Lazily locates and caches the HOB list pointer (gEfiHobListGuid). */ @@ -1351,7 +1351,7 @@ } /** - * GetSystemConfigurationTable (sub_2350) + * GetSystemConfigurationTable * * Searches gST->ConfigurationTable[] by GUID and returns the table pointer. */ @@ -1382,7 +1382,7 @@ } /** - * RegisterProtocolNotify (sub_2414) + * RegisterProtocolNotify * * Creates a protocol notification event. When the specified protocol * is installed, the notification function is called. @@ -1423,7 +1423,7 @@ *===========================================================================*/ /** - * ScriptIoWriteEntry (sub_680) + * ScriptIoWriteEntry * * Writes an I/O boot script entry (type 0). The entry encodes: * - I/O port address, count, data width, and data buffer. @@ -1437,7 +1437,7 @@ ); /** - * ScriptIoReadWriteEntry (sub_750) + * ScriptIoReadWriteEntry * * Writes an I/O read-write (mask) boot script entry (type 1). * Stores both data and mask for read-modify-write during S3 resume. @@ -1452,7 +1452,7 @@ ); /** - * ScriptMemWriteEntry (sub_824) + * ScriptMemWriteEntry * * Writes a memory write boot script entry (type 2). */ @@ -1465,7 +1465,7 @@ ); /** - * ScriptMemReadWriteEntry (sub_8F8) + * ScriptMemReadWriteEntry * * Writes a memory read-write (mask) boot script entry (type 3). */ @@ -1479,7 +1479,7 @@ ); /** - * ScriptPciCfgWriteEntry (sub_9D0) + * ScriptPciCfgWriteEntry * * Writes a PCI config write boot script entry (type 4). */ @@ -1492,7 +1492,7 @@ ); /** - * ScriptPciCfgReadWriteEntry (sub_AC0) + * ScriptPciCfgReadWriteEntry * * Writes a PCI config read-write (mask) boot script entry (type 5). */ @@ -1506,7 +1506,7 @@ ); /** - * ScriptSmbusExecuteEntry (sub_DC0) + * ScriptSmbusExecuteEntry * * Writes an SMBus execute boot script entry (type 6). * Encodes slave address, command, operation type, and data pointers. @@ -1522,7 +1522,7 @@ ); /** - * ScriptStallEntry (sub_F74) + * ScriptStallEntry * * Writes a microsecond delay boot script entry (type 7). */ @@ -1532,7 +1532,7 @@ ); /** - * ScriptDispatchEntry (sub_FE4) + * ScriptDispatchEntry * * Writes a dispatch function call entry (type 8). * The function address is called during S3 resume replay. @@ -1543,7 +1543,7 @@ ); /** - * ScriptInformationEntry (sub_1164) + * ScriptInformationEntry * * Writes informational ASCII data (type 9). * Non-executed; used for debugging/logging. @@ -1555,7 +1555,7 @@ ); /** - * ScriptPciCfg2WriteEntry (sub_3CB8) + * ScriptPciCfg2WriteEntry * * Writes a PCI config 2 write entry (type 10). Address is in * PCIe extended config format (segment/bus/device/function/register). @@ -1568,7 +1568,7 @@ ); /** - * ScriptPollInsert (sub_3D40) + * ScriptPollInsert * * Helper used by ScriptPollEntry. Moves boot script data to make * room for a new poll entry at a given position. Handles the @@ -1690,4 +1690,4 @@ * MdePkg\Library\UefiRuntimeServicesTableLib\UefiRuntimeServicesTableLib.c * * Build config: HR6N0XMLK, DEBUG_VS2015, X64 - */ \ No newline at end of file + */ diff --git a/AmiModulePkg/SmmS3SaveState/S3SaveStateDxe/S3SaveStateDxe.h b/AmiModulePkg/SmmS3SaveState/S3SaveStateDxe/S3SaveStateDxe.h index 0d97ca7..354ecff 100644 --- a/AmiModulePkg/SmmS3SaveState/S3SaveStateDxe/S3SaveStateDxe.h +++ b/AmiModulePkg/SmmS3SaveState/S3SaveStateDxe/S3SaveStateDxe.h @@ -94,24 +94,24 @@ // +2 UINT8 EntryLength (total length of this entry including header) // +3 ... Data (type-dependent payload) // -// Entry types (from sub_1500/1670 switch cases): -// 0 EFI_BOOT_SCRIPT_IO_WRITE (sub_680) -// 1 EFI_BOOT_SCRIPT_IO_READ_WRITE (sub_750) -// 2 EFI_BOOT_SCRIPT_MEM_WRITE (sub_824) -// 3 EFI_BOOT_SCRIPT_MEM_READ_WRITE (sub_8F8) -// 4 EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE (sub_9D0) -// 5 EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE (sub_AC0) -// 6 EFI_BOOT_SCRIPT_SMBUS_EXECUTE (sub_DC0) -// 7 EFI_BOOT_SCRIPT_STALL (sub_F74) -// 8 EFI_BOOT_SCRIPT_DISPATCH (sub_FE4) -// 9 EFI_BOOT_SCRIPT_INFORMATION (sub_1164) -// 10 EFI_BOOT_SCRIPT_PCI_CFG2_WRITE (sub_3CB8) -// 11 EFI_BOOT_SCRIPT_PCI_CFG2_READ_WRITE (sub_BB4) -// 12 EFI_BOOT_SCRIPT_MEM2_WRITE (sub_CB8) -// 13 EFI_BOOT_SCRIPT_MEM2_READ_WRITE (sub_11E8) -// 14 EFI_BOOT_SCRIPT_IO2_WRITE (sub_1054) -// 15 EFI_BOOT_SCRIPT_IO2_READ_WRITE (sub_12D4) -// 16 EFI_BOOT_SCRIPT_DISPATCH_2 (sub_13E4) +// Entry types: +// 0 EFI_BOOT_SCRIPT_IO_WRITE (ScriptIoWriteEntry) +// 1 EFI_BOOT_SCRIPT_IO_READ_WRITE (ScriptIoReadWriteEntry) +// 2 EFI_BOOT_SCRIPT_MEM_WRITE (ScriptMemWriteEntry) +// 3 EFI_BOOT_SCRIPT_MEM_READ_WRITE (ScriptMemReadWriteEntry) +// 4 EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE (ScriptPciCfgWriteEntry) +// 5 EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE (ScriptPciCfgReadWriteEntry) +// 6 EFI_BOOT_SCRIPT_SMBUS_EXECUTE (ScriptSmbusExecuteEntry) +// 7 EFI_BOOT_SCRIPT_STALL (ScriptStallEntry) +// 8 EFI_BOOT_SCRIPT_DISPATCH (ScriptDispatchEntry) +// 9 EFI_BOOT_SCRIPT_INFORMATION (ScriptInformationEntry) +// 10 EFI_BOOT_SCRIPT_PCI_CFG2_WRITE (ScriptPciCfg2WriteEntry) +// 11 EFI_BOOT_SCRIPT_PCI_CFG2_READ_WRITE (ScriptPciCfg2ReadWriteEntry) +// 12 EFI_BOOT_SCRIPT_MEM2_WRITE (ScriptMem2WriteEntry) +// 13 EFI_BOOT_SCRIPT_MEM2_READ_WRITE (ScriptMem2ReadWriteEntry) +// 14 EFI_BOOT_SCRIPT_IO2_WRITE (ScriptIo2WriteEntry) +// 15 EFI_BOOT_SCRIPT_IO2_READ_WRITE (ScriptIo2ReadWriteEntry) +// 16 EFI_BOOT_SCRIPT_DISPATCH_2 (ScriptDispatch2Entry) // // Common boot script entry prefix: @@ -154,7 +154,7 @@ #pragma pack(pop) // --------------------------------------------------------------------------- -// Function Prototypes (renamed from sub_*) +// Function Prototypes // --------------------------------------------------------------------------- // @@ -334,4 +334,4 @@ VOID ); -#endif // __S3SAVESTATEDXE_H__ \ No newline at end of file +#endif // __S3SAVESTATEDXE_H__ diff --git a/AmiModulePkg/TCG2/Common/TcgPei/TcgPei/TcgPei.c b/AmiModulePkg/TCG2/Common/TcgPei/TcgPei/TcgPei.c index 56ebabc..6e14aba 100644 --- a/AmiModulePkg/TCG2/Common/TcgPei/TcgPei/TcgPei.c +++ b/AmiModulePkg/TCG2/Common/TcgPei/TcgPei/TcgPei.c @@ -1,11 +1,3 @@ -/* - * TcgPei.c - * - * Combined decompiler listing for the TcgPei PEIM. Addresses in comments - * refer to offsets in the recovered IA32 image. Names and types are recovered - * artifacts and should be validated before reuse as source-level API. - */ - #include "TcgPei.h" /* ------------------------------------------------------------------------- @@ -71,66 +63,66 @@ * PEIM entry and protocol handoff * ------------------------------------------------------------------------- */ -// _ModuleEntryPoint @ 0xffe0ab18 EFI_STATUS ModuleEntryPoint(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) +// ModuleEntryPoint @ 0xffe0ab18 EFI_STATUS ModuleEntryPoint(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) { - int v2; // eax int Signature; // eax EFI_STATUS result; // eax signed __int32 Result; // esi int Signature_1; // eax _DWORD *v7; // edi int Signature_2; // eax char v9; // al int (**v10)(void); // edi int v11; // ecx char v12; // [esp+1h] [ebp-65h] BYREF int Table; // [esp+2h] [ebp-64h] BYREF int Result; // [esp+6h] [ebp-60h] BYREF int ( **v15)(_DWORD, _BYTE *, _DWORD *, _DWORD, int *, _BYTE *); // [esp+Ah] [ebp-5Ch] BYREF int n4; // [esp+Eh] [ebp-58h] BYREF _BYTE v17[4]; // [esp+12h] [ebp-54h] BYREF _DWORD v18[4]; // [esp+16h] [ebp-50h] BYREF _BYTE Table[28]; // [esp+26h] [ebp-40h] BYREF _BYTE MonotonicCounter[34]; // [esp+42h] [ebp-24h] BYREF if ( *(char *)(sub_FFE0CFC8() + 1024068) >= 0 ) /*0xffe0ab29*/ + int PeiServices; // eax EFI_STATUS Status; // eax signed __int32 Result; // esi int PeiServicesSignature; // eax _DWORD *TableEntry; // edi int PeiServicesSignature_1; // eax char DispatchFlag; // al int (**TcgPeiPassThroughToTcm)(void); // edi int Index; // ecx char BoardPolicy; // [esp+1h] [ebp-65h] BYREF int Table; // [esp+2h] [ebp-64h] BYREF int Result; // [esp+6h] [ebp-60h] BYREF int ( **TcgProtocol)(_DWORD, _BYTE *, _DWORD *, _DWORD, int *, _BYTE *); // [esp+Ah] [ebp-5Ch] BYREF int n4; // [esp+Eh] [ebp-58h] BYREF _BYTE v17[4]; // [esp+12h] [ebp-54h] BYREF _DWORD v18[4]; // [esp+16h] [ebp-50h] BYREF _BYTE Table[28]; // [esp+26h] [ebp-40h] BYREF _BYTE MonotonicCounter[34]; // [esp+42h] [ebp-24h] BYREF if ( *(char *)(GetPeiServices() + 1024068) >= 0 ) /*0xffe0ab29*/ { - sub_FFE0CFD4(); /*0xffe0ab2b*/ - v2 = sub_FFE0CFC8(); /*0xffe0ab30*/ - *(_BYTE *)(v2 + 1024068) |= 0x80u; /*0xffe0ab3c*/ + PeiServicesInitMmio(); /*0xffe0ab2b*/ + PeiServices = GetPeiServices(); /*0xffe0ab30*/ + *(_BYTE *)(PeiServices + 1024068) |= 0x80u; /*0xffe0ab3c*/ } Result = 0; /*0xffe0ab5c*/ - v12 = 0; /*0xffe0ab65*/ + BoardPolicy = 0; /*0xffe0ab65*/ qmemcpy(MonotonicCounter, L"MonotonicCounter", sizeof(MonotonicCounter)); /*0xffe0ab6a*/ - Signature = SystemTable->Hdr.Signature; /*0xffe0ab73*/ + PeiServicesSignature = SystemTable->Hdr.Signature; /*0xffe0ab73*/ n4 = 4; /*0xffe0ab7e*/ v18[0] = unk_FFE0D3D4; /*0xffe0ab88*/ v18[1] = unk_FFE0D3D8; /*0xffe0ab89*/ v18[2] = unk_FFE0D3DC; /*0xffe0ab8a*/ v18[3] = unk_FFE0D3E0; /*0xffe0ab8b*/ - if ( (*(int ( **)(EFI_SYSTEM_TABLE *, void *))(Signature + 24))(SystemTable, &SystemTable_) < 0 ) /*0xffe0ab93*/ + if ( (*(int ( **)(EFI_SYSTEM_TABLE *, void *))(PeiServicesSignature + 24))(SystemTable, &SystemTable_) < 0 ) /*0xffe0ab93*/ return -1610612735; /*0xffe0ab9a*/ - result = (*(int ( **)(EFI_SYSTEM_TABLE *, void *, _DWORD, _DWORD, int *))(LODWORD(SystemTable->Hdr.Signature) /*0xffe0abb0*/ + Status = (*(int ( **)(EFI_SYSTEM_TABLE *, void *, _DWORD, _DWORD, int *))(LODWORD(SystemTable->Hdr.Signature) /*0xffe0abb0*/ + 32))( SystemTable, &SystemTable__0, 0, 0, &Result); - if ( (result & 0x80000000) == 0 && Result ) /*0xffe0abc4*/ + if ( (Status & 0x80000000) == 0 && Result ) /*0xffe0abc4*/ { (*(void ( **)(EFI_SYSTEM_TABLE *, _BYTE *))(Result + 4))(SystemTable, Table); /*0xffe0abd0*/ if ( Table[6] != 1 ) /*0xffe0abda*/ { - result = (*(int ( **)(EFI_SYSTEM_TABLE *, void *, _DWORD, _DWORD, int ( ***)(_DWORD, _BYTE *, _DWORD *, _DWORD, int *, _BYTE *)))(LODWORD(SystemTable->Hdr.Signature) + 32))( /*0xffe0abf1*/ + Status = (*(int ( **)(EFI_SYSTEM_TABLE *, void *, _DWORD, _DWORD, int ( ***)(_DWORD, _BYTE *, _DWORD *, _DWORD, int *, _BYTE *)))(LODWORD(SystemTable->Hdr.Signature) + 32))( /*0xffe0abf1*/ SystemTable, &unk_FFE0DB58, 0, 0, - &v15); - if ( (result & 0x80000000) != 0 || !v15 ) /*0xffe0ac05*/ - return result; /*0xffe0ac05*/ - Result = (*v15)(v15, MonotonicCounter, v18, 0, &n4, v17); /*0xffe0ac24*/ + &TcgProtocol); + if ( (Status & 0x80000000) != 0 || !TcgProtocol ) /*0xffe0ac05*/ + return Status; /*0xffe0ac05*/ + Result = (*TcgProtocol)(TcgProtocol, MonotonicCounter, v18, 0, &n4, v17); /*0xffe0ac24*/ if ( Result < 0 ) /*0xffe0ac2b*/ { - Signature_1 = SystemTable->Hdr.Signature; /*0xffe0ac2d*/ - v12 = 1; /*0xffe0ac38*/ - Result = (*(int ( **)(EFI_SYSTEM_TABLE *, int, int, int *))(Signature_1 + 52))(SystemTable, 4, 25, &Table); /*0xffe0ac40*/ + PeiServicesSignature_1 = SystemTable->Hdr.Signature; /*0xffe0ac2d*/ + BoardPolicy = 1; /*0xffe0ac38*/ + Result = (*(int ( **)(EFI_SYSTEM_TABLE *, int, int, int *))(PeiServicesSignature_1 + 52))(SystemTable, 4, 25, &Table); /*0xffe0ac40*/ if ( Result >= 0 ) /*0xffe0ac47*/ { - v7 = (_DWORD *)(Table + 8); /*0xffe0ac52*/ + TableEntry = (_DWORD *)(Table + 8); /*0xffe0ac52*/ *(_DWORD *)(Table + 8) = unk_FFE0DBA8; /*0xffe0ac55*/ - *++v7 = unk_FFE0DBAC; /*0xffe0ac56*/ - *++v7 = unk_FFE0DBB0; /*0xffe0ac57*/ - v7[1] = unk_FFE0DBB4; /*0xffe0ac58*/ + *++TableEntry = unk_FFE0DBAC; /*0xffe0ac56*/ + *++TableEntry = unk_FFE0DBB0; /*0xffe0ac57*/ + TableEntry[1] = unk_FFE0DBB4; /*0xffe0ac58*/ Result = 0; /*0xffe0ac59*/ - Signature_2 = SystemTable->Hdr.Signature; /*0xffe0ac67*/ + Index = SystemTable->Hdr.Signature; /*0xffe0ac67*/ Table += 24; /*0xffe0ac70*/ - (*(void ( **)(int, char *, int))(Signature_2 + 80))(Table, &v12, 1); /*0xffe0ac74*/ + (*(void ( **)(int, char *, int))(Index + 80))(Table, &BoardPolicy, 1); /*0xffe0ac74*/ } } v9 = 0; /*0xffe0ac7f*/ - if ( sub_FFE0B919 ) /*0xffe0ac83*/ + if ( InitBoardSpecific() ) /*0xffe0ac83*/ { v10 = &off_FFE0D474; /*0xffe0ac85*/ while ( !v9 ) /*0xffe0ac8c*/ @@ -146,17 +138,17 @@ return 0; /*0xffe0ac8c*/ } LABEL_18: - if ( !sub_FFE0B3B4() ) /*0xffe0aca3*/ + if ( !TpmIsPresent() ) /*0xffe0aca3*/ { - Result = sub_FFE0B18A(v11, (int *)SystemTable); /*0xffe0acb3*/ - sub_FFE0B2E8(64, "TpmPeiEntry results = %r \n", Result); /*0xffe0acbd*/ + Result = TpmPeiInit(v11, (int *)SystemTable); /*0xffe0acb3*/ + DebugPrint(64, "TpmPeiEntry results = %r \n", Result); /*0xffe0acbd*/ if ( Result < 0 ) /*0xffe0acc7*/ return Result; /*0xffe0accb*/ } if ( Table[0] && Result >= 0 ) /*0xffe0acd6*/ { - sub_FFE0B2E8(64, "TcgPeiEntry processing\n"); /*0xffe0acdf*/ - if ( sub_FFE0B3B4() ) /*0xffe0ace6*/ + DebugPrint(64, "TcgPeiEntry processing\n"); /*0xffe0acdf*/ + if ( TpmIsPresent() ) /*0xffe0ace6*/ return (*(int ( **)(EFI_SYSTEM_TABLE *, void *))(LODWORD(SystemTable->Hdr.Signature) + 24))( /*0xffe0ad14*/ SystemTable, &unk_FFE0DBE8); @@ -166,11 +158,11 @@ SystemTable, &unk_FFE0DC00); } - sub_FFE0B2E8(0x80000000, "ConfigFlags.TpmSupport == 0x00 || EFI_ERROR( Status )\n"); /*0xffe0ad25*/ + DebugPrint(0x80000000, "ConfigFlags.TpmSupport == 0x00 || EFI_ERROR( Status )\n"); /*0xffe0ad25*/ } return 0; /*0xffe0ad2c*/ } - return result; /*0xffe0ad35*/ + return Status; /*0xffe0ad35*/ } // LocateProtocolAndHandOff @ 0xffe0ad36 int LocateProtocolAndHandOff( @@ -185,7 +177,7 @@ v7 = v6; /*0xffe0ad50*/ if ( v6 >= 0 ) /*0xffe0ad57*/ return ((int ( *)(int, int, int, int, int))a2[6])(-19660800, a4, a3, a6, a5); /*0xffe0ad84*/ - sub_FFE0B2E8(0x80000000, "Locate TcgPeiPassThroughToTcm Status == %r\n", v6); /*0xffe0ad64*/ + DebugPrint(0x80000000, "Locate TcgPeiPassThroughToTcm Status == %r\n", v6); /*0xffe0ad64*/ return v7; /*0xffe0ad8a*/ } @@ -210,8 +202,8 @@ Status = (*(int ( **)(int, void *, _DWORD, _DWORD, _BYTE *))(*(_DWORD *)a2 + 32))(a2, &unk_FFE0DB78, 0, 0, v14); /*0xffe0adcb*/ if ( Status < 0 ) /*0xffe0add3*/ { - sub_FFE0B2E8(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", Status); /*0xffe0ade0*/ - v8 = sub_FFE0B2B7(); /*0xffe0ade8*/ + DebugPrint(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", Status); /*0xffe0ade0*/ + v8 = GetReportStatusCodeProtocol(); /*0xffe0ade8*/ if ( v8 ) /*0xffe0adef*/ (*(void ( **)(const char *, int, const char *))(v8 + 4))( /*0xffe0ae00*/ "e:\\hs\\AmiModulePkg\\TCG2\\Common\\TcgPei\\TcgTisPei.c", @@ -221,7 +213,7 @@ Result = (*(int ( **)(int, _DWORD **))(*(_DWORD *)a2 + 48))(a2, &a3); /*0xffe0ae11*/ if ( Result >= 0 ) /*0xffe0ae17*/ { - Result = sub_FFE0B46E(&v13); /*0xffe0ae28*/ + Result = Tpm12Command_Startup(&v13); /*0xffe0ae28*/ if ( Result >= 0 ) /*0xffe0ae2e*/ { v10 = v13; /*0xffe0ae31*/ @@ -240,10 +232,10 @@ } while ( Index < v11 ); /*0xffe0ae53*/ } - sub_FFE0B2E8(64, "NextLocation= %x\n", v12); /*0xffe0ae5d*/ + DebugPrint(64, "NextLocation= %x\n", v12); /*0xffe0ae5d*/ if ( v4[7] <= 0xFFFFFFDF ) /*0xffe0ae69*/ { - Result = sub_FFE0B41F((unsigned int)v12, (_DWORD *)(v10 + 4), v4); /*0xffe0ae82*/ + Result = Tpm12Command_Init((unsigned int)v12, (_DWORD *)(v10 + 4), v4); /*0xffe0ae82*/ if ( Result >= 0 ) /*0xffe0ae88*/ *a4 = (*(_DWORD *)(v10 + 8))++; /*0xffe0ae91*/ } @@ -326,8 +318,8 @@ Status = (*(int ( **)(_DWORD *, void *, _DWORD, _DWORD, int *))(v6 + 32))(a2, &unk_FFE0DB78, 0, 0, &v12); /*0xffe0b09a*/ if ( Status < 0 ) /*0xffe0b0a2*/ { - sub_FFE0B2E8(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", Status); /*0xffe0b0af*/ - v8 = sub_FFE0B2B7(); /*0xffe0b0b7*/ + DebugPrint(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", Status); /*0xffe0b0af*/ + v8 = GetReportStatusCodeProtocol(); /*0xffe0b0b7*/ if ( v8 ) /*0xffe0b0be*/ (*(void ( **)(const char *, int, const char *))(v8 + 4))( /*0xffe0b0cf*/ "e:\\hs\\AmiModulePkg\\TCG2\\Common\\TcgPei\\TcgTisPei.c", @@ -353,7 +345,7 @@ n5 = 5; /*0xffe0b128*/ do /*0xffe0b131*/ { - sub_FFE0B37F(v1); /*0xffe0b129*/ + IoWrite32(v1); /*0xffe0b129*/ --n5; /*0xffe0b12e*/ } while ( n5 ); /*0xffe0b131*/ @@ -375,12 +367,12 @@ // Tpm12Command_GetCapability_SubOwner @ 0xffe0b15d int Tpm12Command_GetCapability_SubOwner(int a1) { - return sub_FFE0B58B(*(char **)(a1 + 16)); /*0xffe0b16a*/ + return Tpm12Command_GetCapability_TpmVersion(*(char **)(a1 + 16)); /*0xffe0b16a*/ } // Tpm12Command_ForceClear @ 0xffe0b16b int Tpm12Command_ForceClear(int a1, int a2, unsigned int a3, int a4, unsigned int a5, int a6) { - return sub_FFE0B786(*(char **)(a1 + 16), a3, a4, a5, a6); /*0xffe0b188*/ + return Tpm12Command_PhysicalEnable(*(char **)(a1 + 16), a3, a4, a5, a6); /*0xffe0b188*/ } /* ------------------------------------------------------------------------- @@ -398,12 +390,12 @@ result = (*(int ( **)(int *, void *, _DWORD, _DWORD, int *))(Result + 32))(SystemTable, &SystemTable__0, 0, 0, &Result); /*0xffe0b1a8*/ if ( result >= 0 && Result ) /*0xffe0b1ba*/ { - sub_FFE0B2E8(64, "before getTcgPeiPolicy\n"); /*0xffe0b1c9*/ + DebugPrint(64, "before getTcgPeiPolicy\n"); /*0xffe0b1c9*/ (*(void ( **)(int *, _BYTE *))(Result + 4))(SystemTable, v9); /*0xffe0b1d8*/ if ( Table ) /*0xffe0b1e3*/ { - v6 = sub_FFE0B8E5(); /*0xffe0b1fb*/ - sub_FFE0B2E8(64, "CrbSupport = %x \n", v6); /*0xffe0b207*/ + v6 = TpmIsEnabled(); /*0xffe0b1fb*/ + DebugPrint(64, "CrbSupport = %x \n", v6); /*0xffe0b207*/ if ( v6 ) /*0xffe0b211*/ return -2147483634; /*0xffe0b2aa*/ (*(void ( **)(int *, void *))(*SystemTable + 24))(SystemTable, &unk_FFE0DC30); /*0xffe0b21f*/ @@ -413,13 +405,13 @@ (*(void ( **)(int *, void *))(*SystemTable + 24))(SystemTable, &unk_FFE0DC30); /*0xffe0b1ed*/ v6 = v7; /*0xffe0b1f0*/ } - sub_FFE0B2E8(64, "TpmDevice Ppi Installed\n"); /*0xffe0b22a*/ - sub_FFE0B2E8(64, "TpmPeientry ConfigFlags.DeviceType = %x\n", Table); /*0xffe0b23b*/ + DebugPrint(64, "TpmDevice Ppi Installed\n"); /*0xffe0b22a*/ + DebugPrint(64, "TpmPeientry ConfigFlags.DeviceType = %x\n", Table); /*0xffe0b23b*/ if ( *(_BYTE *)dword_FFE0DC28 == 0xFF || !*(_BYTE *)dword_FFE0DC28 ) /*0xffe0b252*/ Result = -2147483634; /*0xffe0b257*/ - sub_FFE0B2E8(64, "IsTpmPresent results = %r\n", Result); /*0xffe0b260*/ - sub_FFE0B2E8(64, "IsTpmPresent base = %x\n", dword_FFE0DC28); /*0xffe0b277*/ - sub_FFE0B2E8(64, "IsTpmPresent Access reg = %x\n", *(unsigned __int8 *)dword_FFE0DC28); /*0xffe0b28b*/ + DebugPrint(64, "IsTpmPresent results = %r\n", Result); /*0xffe0b260*/ + DebugPrint(64, "IsTpmPresent base = %x\n", dword_FFE0DC28); /*0xffe0b277*/ + DebugPrint(64, "IsTpmPresent Access reg = %x\n", *(unsigned __int8 *)dword_FFE0DC28); /*0xffe0b28b*/ if ( Result >= 0 && Table && v6 ) /*0xffe0b2a0*/ return -2147483634; /*0xffe0b2a2*/ else return Result; /*0xffe0b2a6*/ @@ -433,7 +425,7 @@ // GetReportStatusCodeProtocol @ 0xffe0b2b7 int GetReportStatusCodeProtocol() { - int v0; // eax int v2; // [esp+0h] [ebp-8h] BYREF int Result; // [esp+4h] [ebp-4h] BYREF v0 = sub_FFE0CF96(); /*0xffe0b2bc*/ + int v0; // eax int v2; // [esp+0h] [ebp-8h] BYREF int Result; // [esp+4h] [ebp-4h] BYREF v0 = GetSystemConfiguration(); /*0xffe0b2bc*/ if ( (*(int ( **)(int, void *, _DWORD, int *, int *))(*(_DWORD *)v0 + 32))(v0, &unk_FFE0DB68, 0, &v2, &Result) >= 0 ) /*0xffe0b2db*/ return Result; /*0xffe0b2e1*/ else return 0; /*0xffe0b2dd*/ @@ -446,7 +438,7 @@ v3 = (int ( **)(int, const char *, char *))result; /*0xffe0b2ee*/ if ( result ) /*0xffe0b2f2*/ { - result = sub_FFE0B976(); /*0xffe0b2f4*/ + result = Tpm12CheckCmos(); /*0xffe0b2f4*/ if ( (result & a1) != 0 ) /*0xffe0b2ff*/ return (*v3)(a1, a2, (char *)va); /*0xffe0b30b*/ } @@ -473,9 +465,9 @@ n0x400000 = a1 & 0x3FFFFF; /*0xffe0b340*/ do /*0xffe0b378*/ { - v3 = n0x400000 + (sub_FFE0BB64(0x508u) & 0xFFFFFF); /*0xffe0b355*/ + v3 = n0x400000 + (CheckUnaligned32(0x508u) & 0xFFFFFF); /*0xffe0b355*/ n0x400000 = 0x400000; /*0xffe0b357*/ - while ( ((v3 - sub_FFE0BB64(0x508u)) & 0x800000) == 0 ) /*0xffe0b371*/ + while ( ((v3 - CheckUnaligned32(0x508u)) & 0x800000) == 0 ) /*0xffe0b371*/ _mm_pause(); /*0xffe0b35e*/ result = Result--; /*0xffe0b373*/ } @@ -487,7 +479,7 @@ { unsigned __int64 v1; // rtt __int64 v3; // [esp+0h] [ebp-8h] - v3 = sub_FFE0BB90(); /*0xffe0b38d*/ + v3 = GetPerformanceCounter(); /*0xffe0b38d*/ LODWORD(v1) = v3; /*0xffe0b3a3*/ HIDWORD(v1) = HIDWORD(v3) % 0xF4240; /*0xffe0b3a3*/ MicroSecondDelay(v1 / 0xF4240); /*0xffe0b3a8*/ @@ -568,7 +560,7 @@ if ( *v6 != 0xFFFF ) /*0xffe0b4c0*/ v5 = v6; /*0xffe0b4c2*/ } - if ( *v5 == 4 && !sub_FFE0BA03((_BYTE *)v5 + 8, 16) ) /*0xffe0b4d2*/ + if ( *v5 == 4 && !CompareMem((_BYTE *)v5 + 8, 16) ) /*0xffe0b4d2*/ { Result = 0; /*0xffe0b4e3*/ *a1 = v5 + 12; /*0xffe0b4e5*/ @@ -820,12 +812,12 @@ Result = MEMORY[0xFED40030] & 0xF; /*0xffe0b8ac*/ if ( TpmIsPresent_Failure() ) /*0xffe0b8b3*/ return Result & 0xF; /*0xffe0b8de*/ - else return sub_FFE0CF93() != 0; /*0xffe0b8c9*/ + else return GetPchTpm() != 0; /*0xffe0b8c9*/ } // TpmIsEnabled @ 0xffe0b8e5 bool TpmIsEnabled() { - if ( sub_FFE0CF93() ) /*0xffe0b8e8*/ + if ( GetPchTpm() ) /*0xffe0b8e8*/ return 1; /*0xffe0b8f4*/ return TpmIsPresent_Failure() && Tpm12GetPtpInterface() == 1; /*0xffe0b917*/ } @@ -837,7 +829,7 @@ // InitBoardSpecific @ 0xffe0b919 char InitBoardSpecific() { int Protocol; // eax unsigned int v2; // [esp+0h] [ebp-4h] BYREF v2 = 0; /*0xffe0b91d*/ - sub_FFE0CFE5(&v2); /*0xffe0b924*/ + InitTpmDevice(&v2); /*0xffe0b924*/ if ( !v2 ) /*0xffe0b92e*/ { Protocol = GetReportStatusCodeProtocol(); /*0xffe0b930*/ @@ -897,7 +889,7 @@ return memset_v2(buf, count, 0); /*0xffe0b9ff*/ } -// FreePool @ 0xffe0ba03 int FreePool(_BYTE *a1, int n16) +// CompareMem @ 0xffe0ba03 int CompareMem(_BYTE *a1, int n16) { int ReportStatusCodeProtocol; // eax int Protocol; // eax int Protocol; // eax if ( a1 == byte_FFE0DB98 ) /*0xffe0ba0f*/ return 0; /*0xffe0ba11*/ @@ -1078,7 +1070,7 @@ { int Result; // esi _BYTE v2[2]; // [esp+4h] [ebp-8h] BYREF int v3; // [esp+6h] [ebp-6h] - sub_FFE0D0B0(v2); /*0xffe0cf9f*/ + ReadIdtr(v2); /*0xffe0cf9f*/ Result = *(_DWORD *)(v3 - 4); /*0xffe0cfa7*/ if ( !Result ) /*0xffe0cfac*/ DebugAssert( /*0xffe0cfbb*/ @@ -1090,7 +1082,7 @@ // GetPeiServices @ 0xffe0cfc8 int __thiscall GetPeiServices(void *this) { - int ( **v1)(int); // eax v1 = (int ( **)(int))sub_FFE0D0F1(this); /*0xffe0cfc8*/ + int ( **v1)(int); // eax v1 = (int ( **)(int))GetBootMode(this); /*0xffe0cfc8*/ return v1[4](5); /*0xffe0cfd3*/ } @@ -1114,7 +1106,7 @@ { int Protocol; // eax int v4; // edi int Protocol; // eax if ( this ) /*0xffe0cfea*/ { - v4 = sub_FFE0D071(); /*0xffe0d02a*/ + v4 = ReadCmos(); /*0xffe0d02a*/ if ( (unsigned __int16)CheckUnaligned16((unsigned __int16 *)v4) == 0xFFFF ) /*0xffe0d03b*/ { Protocol = GetReportStatusCodeProtocol(); /*0xffe0d03d*/ @@ -1150,7 +1142,7 @@ v2[0] = 1024000; /*0xffe0d089*/ v2[3] = 0; /*0xffe0d095*/ v2[1] = 0; /*0xffe0d09c*/ - sub_FFE0D0D3(0, 0, v2, &Result); /*0xffe0d0a0*/ + CalculateCrc(0, 0, v2, &Result); /*0xffe0d0a0*/ return Result; /*0xffe0d0ac*/ } @@ -1165,7 +1157,7 @@ // CalculateCrc @ 0xffe0d0d3 int *CalculateCrc(int a1, int a2, _DWORD *a3, int *a4) { - int v4; // ecx v4 = sub_FFE0D202((int)a3) + (*a3 & 0xFFFFFFF); /*0xffe0d0e7*/ + int v4; // ecx v4 = CalculateCrc16((int)a3) + (*a3 & 0xFFFFFFF); /*0xffe0d0e7*/ *a4 = v4; /*0xffe0d0ee*/ return a4; /*0xffe0d0ed*/ } diff --git a/AmiModulePkg/TCG2/Common/TcgPei/TcgPei/TcgPei.h b/AmiModulePkg/TCG2/Common/TcgPei/TcgPei/TcgPei.h index 57a3a3e..4bb9f7d 100644 --- a/AmiModulePkg/TCG2/Common/TcgPei/TcgPei/TcgPei.h +++ b/AmiModulePkg/TCG2/Common/TcgPei/TcgPei/TcgPei.h @@ -4,11 +4,8 @@ #include /* - * TcgPei.h - * - * Lightweight index for the recovered TcgPei PEIM. Exact EDK2 types are not - * fully recovered yet, so most routines are listed by recovered name and image - * address instead of declared as public prototypes. + * Recovered entry points for the TcgPei PEIM. + * Only the high-confidence public surface is listed here. */ /* Memory helpers */ diff --git a/AmiModulePkg/Usb/Rt/UsbRtDxe/UsbRtDxe.c b/AmiModulePkg/Usb/Rt/UsbRtDxe/UsbRtDxe.c index 4af0808..706de2d 100644 --- a/AmiModulePkg/Usb/Rt/UsbRtDxe/UsbRtDxe.c +++ b/AmiModulePkg/Usb/Rt/UsbRtDxe/UsbRtDxe.c @@ -127,18 +127,18 @@ PciReg = (_BYTE *)PciExpressRead(1024068); /*0x582*/ *PciReg |= 0x80u; /*0x58c*/ } - Features = sub_3F0(); /*0x593*/ - sub_3E0(); /*0x596*/ + Features = UsbRtReadControllerFeatures(); /*0x593*/ + UsbRtEnableLegacyUsbRouting(); /*0x596*/ IsXhci = (Features & 0x200) != 0; /*0x5a5*/ TimeoutCounter = IoRead32(0x508u) & 0xFFFFFF; /*0x5af*/ - sub_3C0(); /*0x5b5*/ + UsbRtSetUsbLegacyMode(); /*0x5b5*/ while ( ((TimeoutCounter + 357 - IoRead32(0x508u)) & 0x800000) == 0 ) /*0x5d5*/ - sub_3B0(); /*0x5bc*/ - sub_3C0(); /*0x5d7*/ + UsbRtPollLegacyUsbMode(); /*0x5bc*/ + UsbRtSetUsbLegacyMode(); /*0x5d7*/ if ( IsXhci ) /*0x5de*/ - return sub_3D0(); /*0x5e0*/ + return UsbRtEnableXhciPath(); /*0x5e0*/ else - return sub_3E0(); /*0x5e7*/ + return UsbRtEnableLegacyUsbRouting(); /*0x5e7*/ } @@ -904,7 +904,7 @@ // Function: DxeInit @ 0x36d8 (0x107 bytes) -__int64 __fastcall sub_36D8(__int64 a1, __int64 a2, __int64 a3, __int16 a4, unsigned __int8 a5, unsigned __int8 a6) +__int64 __fastcall DxeInit(__int64 a1, __int64 a2, __int64 a3, __int16 a4, unsigned __int8 a5, unsigned __int8 a6) { char v11; // bl int v12; // [rsp+20h] [rbp-38h] @@ -2212,7 +2212,7 @@ // Function: DebugLogPrint_16 @ 0x6268 (0x4c bytes) -__int64 __fastcall sub_6268(_BYTE *DevEntry) +__int64 __fastcall UsbKbFindDevInfoIndex(_BYTE *DevEntry) { unsigned __int16 Idx; // dx @@ -3177,7 +3177,7 @@ // Function: DebugLogPrint_11 @ 0xa28c (0xad bytes) -__int64 __fastcall sub_A28C(__int64 a1, __int64 a2) +__int64 __fastcall UhciWaitForTransferCompletion(__int64 a1, __int64 a2) { int v4; // ebp int v5; // esi @@ -4596,7 +4596,7 @@ // Function: UsbGetInfo_9 @ 0xbdc4 (0x50 bytes) -char __fastcall sub_BDC4(unsigned __int8 a1) +char __fastcall UhciIntervalToPowerOfTwo(unsigned __int8 a1) { unsigned __int8 v1; // di char i; // al @@ -5278,7 +5278,7 @@ // Function: DebugLogPrint_10 @ 0xcba4 (0xb3 bytes) -char __fastcall sub_CBA4(__int64 a1, unsigned __int8 a2) +char __fastcall EhciReleasePort(__int64 a1, unsigned __int8 a2) { int v2; // esi unsigned __int16 v4; // ax @@ -7068,7 +7068,7 @@ // Function: UsbConfig_18 @ 0xf22c (0x8e bytes) -__int64 __fastcall sub_F22C(char a1, unsigned __int8 a2) +__int64 __fastcall EhciIntervalToMask(char a1, unsigned __int8 a2) { unsigned __int8 v2; // di int v3; // ebx @@ -8348,7 +8348,7 @@ // Function: UsbGetInfo_1 @ 0x10f10 (0xca bytes) -__int64 __fastcall sub_10F10(_BYTE *UsbHcPtr) +__int64 __fastcall UsbDumpDeviceInfo(_BYTE *UsbHcPtr) { __int64 v3; // rdx __int64 v4; // r8 @@ -8480,7 +8480,7 @@ // Function: UsbGetInfo_10 @ 0x111b4 (0x50 bytes) -char __fastcall sub_111B4(unsigned __int8 a1) +char __fastcall OhciIntervalToPowerOfTwo(unsigned __int8 a1) { unsigned __int8 v1; // di char i; // al @@ -8589,7 +8589,7 @@ // Function: DebugLogPrint_15 @ 0x11364 (0x4e bytes) -void __fastcall sub_11364(__int64 a1, unsigned int a2) +void __fastcall HcPciWriteConfig32(__int64 a1, unsigned int a2) { __int64 v3; // rax @@ -8620,7 +8620,7 @@ // Function: DebugLogPrint_13 @ 0x11404 (0x5e bytes) -__int64 __fastcall sub_11404(__int64 a1, unsigned int a2) +__int64 __fastcall HcPciReadConfigMmio32(__int64 a1, unsigned int a2) { __int64 v2; // rax __int64 v4; // rax @@ -8644,7 +8644,7 @@ // Function: DebugLogPrint_14 @ 0x11464 (0x53 bytes) -void __fastcall sub_11464(__int64 a1, unsigned int a2, int a3) +void __fastcall HcPciWriteConfigMmio32(__int64 a1, unsigned int a2, int a3) { __int64 v4; // rax int v5; // [rsp+50h] [rbp+18h] BYREF @@ -8664,7 +8664,7 @@ // Function: DebugLogPrint_22 @ 0x114b8 (0x43 bytes) -void __fastcall sub_114B8(__int64 a1, unsigned int a2, int a3) +void __fastcall HcPciOrConfigMmio32(__int64 a1, unsigned int a2, int a3) { int v6; // eax @@ -8678,7 +8678,7 @@ // Function: DebugLogPrint_20 @ 0x114fc (0x45 bytes) -void __fastcall sub_114FC(__int64 a1, unsigned int a2, int a3) +void __fastcall HcPciAndConfigMmio32(__int64 a1, unsigned int a2, int a3) { int v6; // eax @@ -8692,7 +8692,7 @@ // Function: DebugLogPrint_21 @ 0x11544 (0x44 bytes) -void __fastcall sub_11544(__int64 a1, int a2, int a3) +void __fastcall HcPciOrMmio32(__int64 a1, int a2, int a3) { int v6; // eax @@ -8703,7 +8703,7 @@ // Function: DebugLogPrint_19 @ 0x11588 (0x46 bytes) -void __fastcall sub_11588(__int64 a1, int a2, int a3) +void __fastcall HcPciAndMmio32(__int64 a1, int a2, int a3) { int v6; // eax @@ -8760,7 +8760,7 @@ // Function: AssertCpuDeadLoop_1 @ 0x1169c (0x6d bytes) -__int64 __fastcall sub_1169C(__int64 a1, unsigned int a2, __int64 a3) +__int64 __fastcall HcPciReadConfig16(__int64 a1, unsigned int a2, __int64 a3) { __int64 v3; // rax __int64 v4; // rax @@ -8812,7 +8812,7 @@ // Function: AssertCpuDeadLoop_0 @ 0x11774 (0x71 bytes) -__int64 __fastcall sub_11774(__int64 a1, __int64 n2047, __int64 a3) +__int64 __fastcall HcPciReadConfig8(__int64 a1, __int64 n2047, __int64 a3) { __int64 v3; // rax @@ -11575,7 +11575,7 @@ // Function: UsbGetInfo_8 @ 0x16c40 (0x55 bytes) -unsigned __int64 __fastcall sub_16C40(__int64 UsbHcPtr, __int64 TmpRdx, int a3) +unsigned __int64 __fastcall UsbRtReadConfig64(__int64 UsbHcPtr, __int64 TmpRdx, int a3) { unsigned int v4; // edi __int64 v6; // rbx @@ -11590,7 +11590,7 @@ // Function: DebugLogPrint_18 @ 0x16c98 (0x53 bytes) -void __fastcall sub_16C98(__int64 a1, __int64 a2, int a3, __int64 a4) +void __fastcall UsbRtWriteConfig64(__int64 a1, __int64 a2, int a3, __int64 a4) { int v4; // rdi^4 unsigned int v5; // ebx @@ -13242,7 +13242,7 @@ // Function: MemGetInfo @ 0x19380 (0x63 bytes) -void __fastcall sub_19380(__int64 a1, unsigned __int64 a2) +void __fastcall ZeroMemGuard(__int64 a1, unsigned __int64 a2) { if ( !a1 ) /*0x19393*/ Assert( /*0x193a6*/ @@ -13410,7 +13410,7 @@ // Function: Assert_1 @ 0x196c4 (0x2f bytes) -__int64 __fastcall sub_196C4(__int64 a1) +__int64 __fastcall AssertBufferNotNull(__int64 a1) { if ( !a1 ) /*0x196d0*/ Assert((UINTN)"e:\\hs\\MdePkg\\Library\\BaseLib\\Unaligned.c", 192, (__int64)"Buffer != ((void *) 0)"); /*0x196e5*/ @@ -13472,4 +13472,3 @@ memset(buf_1, value_2, n4_1); /*0x19817*/ return buf; /*0x1981a*/ } - diff --git a/AmiModulePkg/Usb/Rt/UsbRtDxe/UsbRtDxe.h b/AmiModulePkg/Usb/Rt/UsbRtDxe/UsbRtDxe.h index a24e04d..edf13d0 100644 --- a/AmiModulePkg/Usb/Rt/UsbRtDxe/UsbRtDxe.h +++ b/AmiModulePkg/Usb/Rt/UsbRtDxe/UsbRtDxe.h @@ -201,7 +201,7 @@ EFI_STATUS EFIAPI -__int64 sub_3C0()( +UsbRtMemMove( VOID ); @@ -7291,4 +7291,4 @@ VOID ); -#endif /* __USBRTDXE_H__ */ \ No newline at end of file +#endif /* __USBRTDXE_H__ */ diff --git a/AmiModulePkg/Usb/Uhcd/Uhcd.c b/AmiModulePkg/Usb/Uhcd/Uhcd.c index 86d857d..b8a8dab 100644 --- a/AmiModulePkg/Usb/Uhcd/Uhcd.c +++ b/AmiModulePkg/Usb/Uhcd/Uhcd.c @@ -116,7 +116,7 @@ UINT16 Alignment ) { - /*See decompiled sub_2AB0 */ + /*Allocate aligned runtime pool memory for USB controller state */ return NULL; } @@ -138,7 +138,7 @@ IN UINT64 Alignment ) { - /*See decompiled sub_2C18 */ + /*Allocate aligned runtime pages for USB DMA buffers */ return 0; } @@ -163,7 +163,7 @@ VOID *AcpiTable ) { - /*See decompiled sub_2634 */ + /*Scan ACPI tables and initialize xHCI controllers */ return EFI_UNSUPPORTED; } @@ -183,7 +183,7 @@ VOID *Regs ) { - /*See decompiled sub_5718, sub_5AD0 */ + /*Probe xHCI capabilities and extended capability registers */ return EFI_UNSUPPORTED; } @@ -199,7 +199,7 @@ VOID *ParentHub ) { - /*See decompiled sub_7E98 */ + /*Install a USB device into the bus topology */ return EFI_UNSUPPORTED; } @@ -210,7 +210,7 @@ UINT8 *DeviceData ) { - /*See decompiled sub_8778 */ + /*Remove a USB device from the bus topology */ return EFI_UNSUPPORTED; } @@ -222,7 +222,7 @@ UINT8 Port ) { - /*See decompiled sub_8A70 */ + /*Remove all devices attached to a hub port */ return EFI_UNSUPPORTED; } @@ -233,7 +233,7 @@ VOID *HubNode ) { - /*See decompiled sub_8C70 */ + /*Run the periodic host controller timer hook */ return; } @@ -257,7 +257,7 @@ OUT UINT64 *TransferStatus ) { - /*See decompiled sub_3FF0 */ + /*Issue a USB control transfer */ return EFI_UNSUPPORTED; } @@ -275,7 +275,7 @@ OUT UINT64 *TransferStatus ) { - /*See decompiled sub_4274 */ + /*Issue a USB bulk transfer */ return EFI_UNSUPPORTED; } @@ -293,7 +293,7 @@ IN VOID *Context ) { - /*See decompiled sub_4720 */ + /*Arm or cancel an asynchronous interrupt transfer */ return EFI_UNSUPPORTED; } @@ -310,7 +310,7 @@ OUT UINT64 *TransferStatus ) { - /*See decompiled sub_49A4 */ + /*Issue a synchronous interrupt transfer */ return EFI_UNSUPPORTED; } @@ -326,7 +326,7 @@ OUT UINT64 *TransferStatus ) { - /*See decompiled sub_50BC */ + /*Issue an isochronous transfer */ return EFI_UNSUPPORTED; } @@ -341,7 +341,7 @@ IN VOID *Context ) { - /*See decompiled sub_53E8 */ + /*Arm or cancel an asynchronous isochronous transfer */ return EFI_UNSUPPORTED; } @@ -355,7 +355,7 @@ OUT UINT64 *PortStatus ) { - /*See decompiled sub_3B1C, sub_3B68 */ + /*Get the current root hub port status */ return EFI_UNSUPPORTED; } @@ -365,7 +365,7 @@ IN EFI_USB_PORT_FEATURE Feature ) { - /*See decompiled sub_3C7C */ + /*Set a root hub port feature */ return EFI_UNSUPPORTED; } @@ -375,7 +375,7 @@ IN EFI_USB_PORT_FEATURE Feature ) { - /*See decompiled sub_3CEC */ + /*Clear a root hub port feature */ return EFI_UNSUPPORTED; } @@ -384,7 +384,7 @@ IN UINT32 State ) { - /*See decompiled sub_3908 */ + /*Set the host controller state */ return EFI_UNSUPPORTED; } @@ -396,7 +396,7 @@ UINT8 *DeviceData ) { - /*See decompiled sub_674C, sub_6A7C */ + /*Load endpoint policy data for the device */ return EFI_UNSUPPORTED; } @@ -404,7 +404,7 @@ UINT8 *DeviceData ) { - /*See decompiled sub_6BC0 */ + /*Configure device endpoints from policy data */ return EFI_UNSUPPORTED; } @@ -413,7 +413,7 @@ VOID *Desc ) { - /*See decompiled sub_6384 */ + /*Retrieve the USB device descriptor */ return EFI_UNSUPPORTED; } @@ -427,7 +427,7 @@ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath ) { - /*See decompiled sub_2448 */ + /*Driver binding Supported() callback */ return EFI_UNSUPPORTED; } @@ -437,7 +437,7 @@ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath ) { - /*See decompiled sub_1290 */ + /*Driver binding Start() callback */ return EFI_UNSUPPORTED; } @@ -447,7 +447,7 @@ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath ) { - /*See decompiled sub_1620 */ + /*Driver binding Stop() callback */ return EFI_UNSUPPORTED; } @@ -457,7 +457,7 @@ IN EFI_HANDLE ChildHandle ) { - /*See decompiled sub_116C */ + /*Driver binding StopChild() callback */ return EFI_UNSUPPORTED; } @@ -473,7 +473,7 @@ *2. Read UsbSupport variable before initialization *3. Allocate gUsbData (~30KB) and initialize all fields *4. Allocate gUsbCallbacks vtable with helper function pointers - *5. Install USB_HC protocol interface (sub_52C as HC handler) + *5. Install USB_HC protocol interface (HC handler dispatch table) *6. Register driver binding, install components, create timer events *7. Register USB bus, mass storage, HID, and keyboard class drivers * @@ -542,7 +542,7 @@ // // Allocate memory map via PciIo->AllocateBuffer // - // ... see decompiled sub_678 ... + // Allocate the PCI DMA buffer used by the USB runtime dispatch table // // Allocate gUsbCallbacks vtable and populate function pointers @@ -606,4 +606,4 @@ gRuntimeServices = SystemTable->RuntimeServices; return UhcdDriverEntryPoint (ImageHandle, SystemTable); -} \ No newline at end of file +} diff --git a/AmiNetworkPkg/UefiNetworkStack/Common/NetworkStackSetupScreen/NetworkStackSetupScreen.c b/AmiNetworkPkg/UefiNetworkStack/Common/NetworkStackSetupScreen/NetworkStackSetupScreen.c index bf2668c..0021da1 100644 --- a/AmiNetworkPkg/UefiNetworkStack/Common/NetworkStackSetupScreen/NetworkStackSetupScreen.c +++ b/AmiNetworkPkg/UefiNetworkStack/Common/NetworkStackSetupScreen/NetworkStackSetupScreen.c @@ -24,38 +24,28 @@ // --------------------------------------------------------------------------- // -EFI_HANDLE gImageHandle_ = NULL; // 0xD00 (.data) -EFI_SYSTEM_TABLE *gST_ = NULL; // 0xCF0 (.data) -EFI_BOOT_SERVICES *gBS_ = NULL; // 0xCF8 (.data) -EFI_RUNTIME_SERVICES *gRT_ = NULL; // 0xD08 (.data) +EFI_HANDLE gImageHandle = NULL; +EFI_SYSTEM_TABLE *gSystemTable = NULL; +EFI_BOOT_SERVICES *gBootServices = NULL; +EFI_RUNTIME_SERVICES *gRuntimeServices = NULL; // -// Cached protocol pointer (located by sub_4F8) -// -EFI_AMI_BOARD_INFO_PROTOCOL *gAmiBoardInfoProtocol = NULL; // 0xD10 (.data) +EFI_AMI_BOARD_INFO_PROTOCOL *gBoardInfoProtocol = NULL; // -// Cached HOB list pointer (located by sub_600 -> GetHobList) -// -EFI_PHYSICAL_ADDRESS gHobListRva = 0; // 0xD18 (.data) +EFI_PHYSICAL_ADDRESS gHobListAddress = 0; // -// Second copies of service pointers (aliased .data at 0xD20/0xD28/0xD30) -// -UINT64 gBS_1 = 0; // 0xD20 -UINT64 gRT_1 = 0; // 0xD28 -UINT64 gST_1 = 0; // 0xD30 +UINT64 gBootServicesCopy = 0; +UINT64 gRuntimeServicesCopy = 0; +UINT64 gSystemTableCopy = 0; // -// NetworkStackVar data buffer (10 bytes at 0xD40) -// -NETWORK_STACK_VAR gNvData; // 0xD40..0xD49 +NETWORK_STACK_VAR gNetworkStackVarData; // -// Byte-level aliases into gNvData (overlay) -// -UINT8 gNvBootFlag = 0; // byte_D45 (offset 5) -UINT16 gNvReservedWord = 0; // word_D46 (offset 6) +UINT8 gNetworkStackBootFlag = 0; +UINT16 gNetworkStackReservedWord = 0; // // --------------------------------------------------------------------------- @@ -68,7 +58,7 @@ // The protocol interface is located via gBS->LocateProtocol. // Stored at .data 0xCC0. // -EFI_GUID gAmiBoardInfoProtocolGuid = { +EFI_GUID gBoardInfoProtocolGuid = { 0xCC0, 0xCC1, 0xCC2, { 0xCC3, 0xCC4, 0xCC5, 0xCC6, 0xCC7, 0xCC8, 0xCC9, 0xCCA } }; @@ -87,7 +77,7 @@ // Vendor GUID for the NetworkStackVar variable. // Stored at .data 0xCE0. // -EFI_GUID gAmiBoardInfoVarGuid = { +EFI_GUID gNetworkStackVarGuid = { 0xCE0, 0xCE1, 0xCE2, { 0xCE3, 0xCE4, 0xCE5, 0xCE6, 0xCE7, 0xCE8, 0xCE9, 0xCEA } }; @@ -101,32 +91,32 @@ UINT64 EFIAPI -ReadUnalignedQword ( +ReadUnalignedU64 ( IN VOID *Buffer ); BOOLEAN EFIAPI -CompareGuidQword ( +CompareGuidU64 ( IN VOID *Buffer1, IN VOID *Buffer2 ); UINTN EFIAPI -CmosReadNvStorage ( +ReadNetworkStackNvStorage ( VOID ); EFI_AMI_BOARD_INFO_PROTOCOL * EFIAPI -LocateAmiBoardInfoProtocol ( +LocateBoardInfoProtocol ( VOID ); VOID EFIAPI -AmiBoardInfoAssert ( +AmiBoardInfoAssertCallback ( IN CHAR8 *FileName, IN UINTN LineNumber, IN CHAR8 *Expression @@ -134,7 +124,7 @@ EFI_STATUS EFIAPI -AmiBoardInfoConditionalSend ( +SendBoardInfoIfNetworkStackEnabled ( IN UINTN Mask, IN UINTN Arg2, ... @@ -142,20 +132,20 @@ EFI_PHYSICAL_ADDRESS EFIAPI -GetHobList ( +GetHobListAddress ( IN EFI_SYSTEM_TABLE *SystemTable ); EFI_STATUS EFIAPI -AmiBoardInfoInit ( +InitializeNetworkStackVar ( IN UINTN N10Param, IN EFI_SYSTEM_TABLE *SystemTable ); EFI_STATUS EFIAPI -AmiBoardInfoEntryPoint ( +NetworkStackSetupScreenEntryPoint ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ); @@ -163,7 +153,7 @@ // // --------------------------------------------------------------------------- -// sub_798: ReadUnalignedQword +// ReadUnalignedU64 // --------------------------------------------------------------------------- // @@ -178,7 +168,7 @@ **/ UINT64 EFIAPI -ReadUnalignedQword ( +ReadUnalignedU64 ( IN VOID *Buffer ) { @@ -189,7 +179,7 @@ // // --------------------------------------------------------------------------- -// sub_728: CompareGuidQword +// CompareGuidU64 // --------------------------------------------------------------------------- // @@ -205,20 +195,20 @@ **/ BOOLEAN EFIAPI -CompareGuidQword ( +CompareGuidU64 ( IN VOID *Buffer1, IN VOID *Buffer2 ) { return (BOOLEAN)( - ReadUnalignedQword (Buffer1) == ReadUnalignedQword (Buffer2) + ReadUnalignedU64 (Buffer1) == ReadUnalignedU64 (Buffer2) ); } // // --------------------------------------------------------------------------- -// sub_6D8: CmosReadNvStorage +// ReadNetworkStackNvStorage // --------------------------------------------------------------------------- // @@ -243,7 +233,7 @@ **/ UINTN EFIAPI -CmosReadNvStorage ( +ReadNetworkStackNvStorage ( VOID ) { @@ -300,7 +290,7 @@ // // --------------------------------------------------------------------------- -// sub_4F8: LocateAmiBoardInfoProtocol +// LocateBoardInfoProtocol // --------------------------------------------------------------------------- // @@ -317,15 +307,15 @@ **/ EFI_AMI_BOARD_INFO_PROTOCOL * EFIAPI -LocateAmiBoardInfoProtocol ( +LocateBoardInfoProtocol ( VOID ) { EFI_STATUS Status; VOID *Pool; - if (gAmiBoardInfoProtocol != NULL) { - return gAmiBoardInfoProtocol; + if (gBoardInfoProtocol != NULL) { + return gBoardInfoProtocol; } // @@ -345,22 +335,22 @@ // // Locate the protocol. // - Status = gBS_->LocateProtocol ( - &gAmiBoardInfoProtocolGuid, + Status = gBootServices->LocateProtocol ( + &gBoardInfoProtocolGuid, NULL, // Registration - (VOID **)&gAmiBoardInfoProtocol + (VOID **)&gBoardInfoProtocol ); if (EFI_ERROR (Status)) { - gAmiBoardInfoProtocol = NULL; + gBoardInfoProtocol = NULL; } - return gAmiBoardInfoProtocol; + return gBoardInfoProtocol; } // // --------------------------------------------------------------------------- -// sub_5C0: AmiBoardInfoAssert +// AmiBoardInfoAssertCallback // --------------------------------------------------------------------------- // @@ -373,7 +363,7 @@ **/ VOID EFIAPI -AmiBoardInfoAssert ( +AmiBoardInfoAssertCallback ( IN CHAR8 *FileName, IN UINTN LineNumber, IN CHAR8 *Expression @@ -381,7 +371,7 @@ { EFI_AMI_BOARD_INFO_PROTOCOL *Protocol; - Protocol = LocateAmiBoardInfoProtocol (); + Protocol = LocateBoardInfoProtocol (); if (Protocol != NULL) { // // Offset 0x00: AssertCallback. @@ -394,7 +384,7 @@ // // --------------------------------------------------------------------------- -// sub_578: AmiBoardInfoConditionalSend +// SendBoardInfoIfNetworkStackEnabled // --------------------------------------------------------------------------- // @@ -402,11 +392,11 @@ Conditional status send. Locates the AMI Board Info Protocol, reads the CMOS NV storage - status via CmosReadNvStorage(), and if (NvResult & Mask) is + status via ReadNetworkStackNvStorage(), and if (NvResult & Mask) is non-zero, invokes the protocol's StatusSend callback with the given arguments. - @param[in] Mask Status mask to compare against CmosReadNvStorage. + @param[in] Mask Status mask to compare against ReadNetworkStackNvStorage. @param[in] Arg2 Second argument to StatusSend callback. @param[in] ... Third argument (varargs, passed as VOID* pointer). @@ -415,7 +405,7 @@ **/ EFI_STATUS EFIAPI -AmiBoardInfoConditionalSend ( +SendBoardInfoIfNetworkStackEnabled ( IN UINTN Mask, IN UINTN Arg2, ... @@ -427,12 +417,12 @@ VA_LIST Args; VOID *VaPtr; - Protocol = LocateAmiBoardInfoProtocol (); + Protocol = LocateBoardInfoProtocol (); if (Protocol == NULL) { return EFI_UNSUPPORTED; } - NvResult = CmosReadNvStorage (); + NvResult = ReadNetworkStackNvStorage (); if ((NvResult & Mask) == 0) { // // CMOS NV storage status does not match Mask. @@ -454,7 +444,7 @@ // // --------------------------------------------------------------------------- -// sub_600: GetHobList +// GetHobListAddress // --------------------------------------------------------------------------- // @@ -463,7 +453,7 @@ Walks the system table's configuration table array searching for the entry whose VendorGuid matches the PiHobList GUID. The HOB - list pointer is cached in the global gHobListRva. + list pointer is cached in the global gHobListAddress. @param[in] SystemTable Pointer to the UEFI system table. @@ -471,21 +461,21 @@ **/ EFI_PHYSICAL_ADDRESS EFIAPI -GetHobList ( +GetHobListAddress ( IN EFI_SYSTEM_TABLE *SystemTable ) { UINTN Index; UINTN TableCount; - if (gHobListRva != 0) { - return gHobListRva; + if (gHobListAddress != 0) { + return gHobListAddress; } // // Initialize to NULL. // - gHobListRva = 0; + gHobListAddress = 0; TableCount = SystemTable->NumberOfTableEntries; if (TableCount == 0) { @@ -504,56 +494,56 @@ ((UINT8 *)SystemTable->ConfigurationTable + (Index * sizeof (EFI_CONFIGURATION_TABLE))); - if (CompareGuidQword ( + if (CompareGuidU64 ( &gPiHobListGuid, &ConfigEntry->VendorGuid )) { // // Found the HOB list entry. // - gHobListRva = (EFI_PHYSICAL_ADDRESS)ConfigEntry->VendorTable; + gHobListAddress = (EFI_PHYSICAL_ADDRESS)ConfigEntry->VendorTable; break; } } - if (gHobListRva == 0) { + if (gHobListAddress == 0) { FAIL: // // ASSERT failure on debug builds. The original binary called - // sub_578 (conditional send) with: + // send the assertion details with: // mask = 0x80000000LL // arg2 = "\nASSERT_EFI_ERROR (Status = %r)\n" string ref // arg3 = 0x800000000000000EuLL (EFI_NOT_FOUND) // - AmiBoardInfoConditionalSend ( + SendBoardInfoIfNetworkStackEnabled ( 0x80000000LL, (UINTN)"\nASSERT_EFI_ERROR (Status = %r)\n", 0x800000000000000EuLL ); - AmiBoardInfoAssert ( + AmiBoardInfoAssertCallback ( "e:\\hs\\MdePkg\\Library\\DxeHobLib\\HobLib.c", 54, "!EFI_ERROR (Status)" ); } - if (gHobListRva == 0) { - AmiBoardInfoAssert ( + if (gHobListAddress == 0) { + AmiBoardInfoAssertCallback ( "e:\\hs\\MdePkg\\Library\\DxeHobLib\\HobLib.c", 55, "mHobList != ((void *) 0)" ); } - return gHobListRva; + return gHobListAddress; } // // --------------------------------------------------------------------------- -// sub_41C: AmiBoardInfoInit +// InitializeNetworkStackVar // --------------------------------------------------------------------------- // @@ -576,7 +566,7 @@ **/ EFI_STATUS EFIAPI -AmiBoardInfoInit ( +InitializeNetworkStackVar ( IN UINTN N10Param, IN EFI_SYSTEM_TABLE *SystemTable ) @@ -587,45 +577,45 @@ // // Cache services if not already set (by entry point). // - if (gST_ == NULL) { - gST_ = SystemTable; - gBS_ = SystemTable->BootServices; - gRT_ = SystemTable->RuntimeServices; + if (gSystemTable == NULL) { + gSystemTable = SystemTable; + gBootServices = SystemTable->BootServices; + gRuntimeServices = SystemTable->RuntimeServices; } // // Try to read the existing variable. // - VarSize = sizeof (gNvData); // = NETWORK_STACK_VAR_DATA_SIZE = 10 - Status = gRT_->GetVariable ( + VarSize = sizeof (gNetworkStackVarData); + Status = gRuntimeServices->GetVariable ( NETWORK_STACK_VAR_NAME, - &gAmiBoardInfoVarGuid, + &gNetworkStackVarGuid, NULL, // Attributes (returned) &VarSize, - &gNvData + &gNetworkStackVarData ); if (Status == EFI_NOT_FOUND) { // // Variable does not exist: zero the buffer and set defaults. // - gBS_->SetMem (&gNvData, sizeof (gNvData), 0); + gBootServices->SetMem (&gNetworkStackVarData, sizeof (gNetworkStackVarData), 0); - gNvReservedWord = 0; // word_D46 - gNvBootFlag = 1; // byte_D45 - gNvData.Flags = 0x1000000; // default flag value + gNetworkStackReservedWord = 0; + gNetworkStackBootFlag = 1; + gNetworkStackVarData.Flags = 0x1000000; // // Write the variable as non-volatile + boot + runtime. // - Status = gRT_->SetVariable ( + Status = gRuntimeServices->SetVariable ( NETWORK_STACK_VAR_NAME, - &gAmiBoardInfoVarGuid, + &gNetworkStackVarGuid, (EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS), - sizeof (gNvData), - &gNvData + sizeof (gNetworkStackVarData), + &gNetworkStackVarData ); // @@ -639,7 +629,7 @@ // // --------------------------------------------------------------------------- -// _ModuleEntryPoint (0x370) -> AmiBoardInfoEntryPoint +// NetworkStackSetupScreenEntryPoint // --------------------------------------------------------------------------- // @@ -648,16 +638,16 @@ Saves ImageHandle, SystemTable, BootServices, and RuntimeServices into global variables, then initializes the HOB list, and finally - calls AmiBoardInfoInit(). + calls InitializeNetworkStackVar(). @param[in] ImageHandle Handle of this driver image. @param[in] SystemTable Pointer to the UEFI system table. - @return EFI_STATUS Return value from AmiBoardInfoInit(). + @return EFI_STATUS Return value from InitializeNetworkStackVar(). **/ EFI_STATUS EFIAPI -AmiBoardInfoEntryPoint ( +NetworkStackSetupScreenEntryPoint ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) @@ -665,25 +655,25 @@ // // Save global handles (standard UEFI boot services library pattern). // - gImageHandle_ = ImageHandle; - ASSERT (gImageHandle_ != NULL); + gImageHandle = ImageHandle; + ASSERT (gImageHandle != NULL); - gST_ = SystemTable; - ASSERT (gST_ != NULL); + gSystemTable = SystemTable; + ASSERT (gSystemTable != NULL); - gBS_ = SystemTable->BootServices; - ASSERT (gBS_ != NULL); + gBootServices = SystemTable->BootServices; + ASSERT (gBootServices != NULL); - gRT_ = SystemTable->RuntimeServices; - ASSERT (gRT_ != NULL); + gRuntimeServices = SystemTable->RuntimeServices; + ASSERT (gRuntimeServices != NULL); // // Locate and cache the HOB list pointer. // - GetHobList (SystemTable); + GetHobListAddress (SystemTable); // // Initialize the board info variable ("NetworkStackVar"). // - return AmiBoardInfoInit (10, SystemTable); -} \ No newline at end of file + return InitializeNetworkStackVar (10, SystemTable); +} diff --git a/AmiNetworkPkg/UefiNetworkStack/Common/NetworkStackSetupScreen/NetworkStackSetupScreen.h b/AmiNetworkPkg/UefiNetworkStack/Common/NetworkStackSetupScreen/NetworkStackSetupScreen.h index 247bee8..d68e04b 100644 --- a/AmiNetworkPkg/UefiNetworkStack/Common/NetworkStackSetupScreen/NetworkStackSetupScreen.h +++ b/AmiNetworkPkg/UefiNetworkStack/Common/NetworkStackSetupScreen/NetworkStackSetupScreen.h @@ -1,7 +1,5 @@ /** @file - NetworkStackSetupScreen.h -- Header for NetworkStackSetupScreen - -Copyright (c) HR650X BIOS Decompilation Project + NetworkStackSetupScreen.h **/ #ifndef __NETWORKSTACKSETUPSCREEN_H__ @@ -9,548 +7,92 @@ #include "../uefi_headers/Uefi.h" -// -// Function Prototypes -// +typedef struct { + UINT32 Flags; + UINT8 BootFlag; + UINT8 Reserved[4]; + UINT16 ReservedWord; +} NETWORK_STACK_VAR; -EFI_STATUS -EFIAPI -ReadUnalignedQword( - VOID -); +extern EFI_HANDLE gImageHandle; +extern EFI_SYSTEM_TABLE *gSystemTable; +extern EFI_BOOT_SERVICES *gBootServices; +extern EFI_RUNTIME_SERVICES *gRuntimeServices; -EFI_STATUS -EFIAPI -CompareGuidQword( - VOID -); +extern EFI_AMI_BOARD_INFO_PROTOCOL *gBoardInfoProtocol; +extern EFI_PHYSICAL_ADDRESS gHobListAddress; -EFI_STATUS -EFIAPI -CmosReadNvStorage( - VOID -); +extern UINT64 gBootServicesCopy; +extern UINT64 gRuntimeServicesCopy; +extern UINT64 gSystemTableCopy; -EFI_STATUS -EFIAPI -AmiBoardInfoAssert( - VOID -); +extern NETWORK_STACK_VAR gNetworkStackVarData; +extern UINT8 gNetworkStackBootFlag; +extern UINT16 gNetworkStackReservedWord; -EFI_STATUS -EFIAPI -AmiBoardInfoConditionalSend( - VOID -); +extern EFI_GUID gBoardInfoProtocolGuid; +extern EFI_GUID gPiHobListGuid; +extern EFI_GUID gNetworkStackVarGuid; -EFI_STATUS +UINT64 EFIAPI -AmiBoardInfoInit( - VOID -); +ReadUnalignedU64 ( + IN VOID *Buffer + ); -EFI_STATUS +BOOLEAN EFIAPI -AmiBoardInfoEntryPoint( - VOID -); +CompareGuidU64 ( + IN VOID *Buffer1, + IN VOID *Buffer2 + ); -EFI_STATUS +UINTN EFIAPI -variable storage (mapped from .data section)( +ReadNetworkStackNvStorage ( VOID -); + ); -EFI_STATUS +EFI_AMI_BOARD_INFO_PROTOCOL * EFIAPI -gImageHandle_ = NULL; // 0xD00 (.data)( +LocateBoardInfoProtocol ( VOID -); + ); -EFI_STATUS +VOID EFIAPI -(.data)( - VOID -); +AmiBoardInfoAssertCallback ( + IN CHAR8 *FileName, + IN UINTN LineNumber, + IN CHAR8 *Expression + ); EFI_STATUS EFIAPI -protocol pointer (located by sub_4F8)( - VOID -); +SendBoardInfoIfNetworkStackEnabled ( + IN UINTN Mask, + IN UINTN Arg2, + ... + ); -EFI_STATUS +EFI_PHYSICAL_ADDRESS EFIAPI -*gAmiBoardInfoProtocol = NULL; // 0xD10 (.data)( - VOID -); +GetHobListAddress ( + IN EFI_SYSTEM_TABLE *SystemTable + ); EFI_STATUS EFIAPI -HOB list pointer (located by sub_600 -> GetHobList)( - VOID -); +InitializeNetworkStackVar ( + IN UINTN N10Param, + IN EFI_SYSTEM_TABLE *SystemTable + ); EFI_STATUS EFIAPI -gHobListRva = 0; // 0xD18 (.data)( - VOID -); +NetworkStackSetupScreenEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ); -EFI_STATUS -EFIAPI -copies of service pointers (aliased .data at 0xD20/0xD28/0xD30)( - VOID -); - -EFI_STATUS -EFIAPI -gBS_1 = 0; // 0xD20( - VOID -); - -EFI_STATUS -EFIAPI -UINT64 gST_1 = 0; // 0xD30( - VOID -); - -EFI_STATUS -EFIAPI -data buffer (10 bytes at 0xD40)( - VOID -); - -EFI_STATUS -EFIAPI -gNvData; // 0xD40..0xD49( - VOID -); - -EFI_STATUS -EFIAPI -gNvBootFlag = 0; // byte_D45 (offset 5)( - VOID -); - -EFI_STATUS -EFIAPI -(offset 6)( - VOID -); - -EFI_STATUS -EFIAPI -definitions( - VOID -); - -EFI_STATUS -EFIAPI -for the AMI Board Info Protocol.( - VOID -); - -EFI_STATUS -EFIAPI -protocol interface is located via gBS->LocateProtocol.( - VOID -); - -EFI_STATUS -EFIAPI -at .data 0xCC0.( - VOID -); - -EFI_STATUS -EFIAPI -gAmiBoardInfoProtocolGuid = {( - VOID -); - -EFI_STATUS -EFIAPI -GUID (standard UEFI PiHobList GUID).( - VOID -); - -EFI_STATUS -EFIAPI -to locate the HOB list from the system table configuration table.( - VOID -); - -EFI_STATUS -EFIAPI -as two halves at .data 0xCD0 (first 8 bytes) and 0xCD8 (second 8).( - VOID -); - -EFI_STATUS -EFIAPI -gPiHobListGuid = {( - VOID -); - -EFI_STATUS -EFIAPI -GUID for the NetworkStackVar variable.( - VOID -); - -EFI_STATUS -EFIAPI -at .data 0xCE0.( - VOID -); - -EFI_STATUS -EFIAPI -gAmiBoardInfoVarGuid = {( - VOID -); - -EFI_STATUS -EFIAPI -declarations( - VOID -); - -EFI_STATUS -EFIAPI -EFIAPI( - VOID -); - -EFI_STATUS -EFIAPI -current index, select CMOS diagnostic register (0x4B).( - VOID -); - -EFI_STATUS -EFIAPI -bit 7 (power good flag) to access the register number.( - VOID -); - -EFI_STATUS -EFIAPI -(( - VOID -); - -EFI_STATUS -EFIAPI -the diagnostic status value.( - VOID -); - -EFI_STATUS -EFIAPI -= IoRead8 (CMOS_REG_DATA_PORT);( - VOID -); - -EFI_STATUS -EFIAPI -appears accessible.( - VOID -); - -EFI_STATUS -EFIAPI -(NvStorage == 0) {( - VOID -); - -EFI_STATUS -EFIAPI -use bit 1 combined with bit 0 as override indicator.( - VOID -); - -EFI_STATUS -EFIAPI -= (*(volatile UINT8 *)0xFDAF0490 & 2) | 1;( - VOID -); - -EFI_STATUS -EFIAPI -((UINT8)(NvStorage - 1) > 0xFD) {( - VOID -); - -EFI_STATUS -EFIAPI -is not 1 or 2 (or is 0xFF) -> undetermined.( - VOID -); - -EFI_STATUS -EFIAPI -0;( - VOID -); - -EFI_STATUS -EFIAPI -}( - VOID -); - -EFI_STATUS -EFIAPI -a small pool (EfiBootServicesData) as scratch.( - VOID -); - -EFI_STATUS -EFIAPI -= AllocatePool (31); // 31 = EfiBootServicesData( - VOID -); - -EFI_STATUS -EFIAPI -(Pool);( - VOID -); - -EFI_STATUS -EFIAPI -the protocol.( - VOID -); - -EFI_STATUS -EFIAPI -= gBS_->LocateProtocol (( - VOID -); - -EFI_STATUS -EFIAPI -(VOID **)&gAmiBoardInfoProtocol( - VOID -); - -EFI_STATUS -EFIAPI -0x00: AssertCallback.( - VOID -); - -EFI_STATUS -EFIAPI -NV storage status does not match Mask.( - VOID -); - -EFI_STATUS -EFIAPI -EFI_UNSUPPORTED;( - VOID -); - -EFI_STATUS -EFIAPI -matches; invoke StatusSend callback at offset 0x08.( - VOID -); - -EFI_STATUS -EFIAPI -(Args, Arg2);( - VOID -); - -EFI_STATUS -EFIAPI -to NULL.( - VOID -); - -EFI_STATUS -EFIAPI -= 0;( - VOID -); - -EFI_STATUS -EFIAPI -the configuration table array.( - VOID -); - -EFI_STATUS -EFIAPI -entry is sizeof(EFI_CONFIGURATION_TABLE) bytes = 24 bytes:( - VOID -); - -EFI_STATUS -EFIAPI -bytes VendorGuid + 8 bytes VendorTable pointer.( - VOID -); - -EFI_STATUS -EFIAPI -(Index = 0; Index < TableCount; Index++) {( - VOID -); - -EFI_STATUS -EFIAPI -the HOB list entry.( - VOID -); - -EFI_STATUS -EFIAPI -= (EFI_PHYSICAL_ADDRESS)ConfigEntry->VendorTable;( - VOID -); - -EFI_STATUS -EFIAPI -failure on debug builds. The original binary called( - VOID -); - -EFI_STATUS -EFIAPI -(conditional send) with:( - VOID -); - -EFI_STATUS -EFIAPI -= 0x80000000LL( - VOID -); - -EFI_STATUS -EFIAPI -= "\nASSERT_EFI_ERROR (Status = %r)\n" string ref( - VOID -); - -EFI_STATUS -EFIAPI -= 0x800000000000000EuLL (EFI_NOT_FOUND)( - VOID -); - -EFI_STATUS -EFIAPI -services if not already set (by entry point).( - VOID -); - -EFI_STATUS -EFIAPI -(gST_ == NULL) {( - VOID -); - -EFI_STATUS -EFIAPI -to read the existing variable.( - VOID -); - -EFI_STATUS -EFIAPI -= sizeof (gNvData); // = NETWORK_STACK_VAR_DATA_SIZE = 10( - VOID -); - -EFI_STATUS -EFIAPI -(returned)( - VOID -); - -EFI_STATUS -EFIAPI -does not exist: zero the buffer and set defaults.( - VOID -); - -EFI_STATUS -EFIAPI -gNvBootFlag = 1; // byte_D45( - VOID -); - -EFI_STATUS -EFIAPI -flag value( - VOID -); - -EFI_STATUS -EFIAPI -the variable as non-volatile + boot + runtime.( - VOID -); - -EFI_STATUS -EFIAPI -= gRT_->SetVariable (( - VOID -); - -EFI_STATUS -EFIAPI -driver does not check SetVariable status.( - VOID -); - -EFI_STATUS -EFIAPI -(0x370) -> AmiBoardInfoEntryPoint( - VOID -); - -EFI_STATUS -EFIAPI -global handles (standard UEFI boot services library pattern).( - VOID -); - -EFI_STATUS -EFIAPI -= ImageHandle;( - VOID -); - -EFI_STATUS -EFIAPI -and cache the HOB list pointer.( - VOID -); - -EFI_STATUS -EFIAPI -(SystemTable);( - VOID -); - -EFI_STATUS -EFIAPI -the board info variable ("NetworkStackVar").( - VOID -); - -EFI_STATUS -EFIAPI -AmiBoardInfoInit (10, SystemTable);( - VOID -); - -#endif /* __NETWORKSTACKSETUPSCREEN_H__ */ \ No newline at end of file +#endif diff --git a/AmiNetworkPkg/UefiNetworkStack/Common/TlsAuthConfigDxe/TlsAuthConfigDxe.c b/AmiNetworkPkg/UefiNetworkStack/Common/TlsAuthConfigDxe/TlsAuthConfigDxe.c index 588e791..860336a 100644 --- a/AmiNetworkPkg/UefiNetworkStack/Common/TlsAuthConfigDxe/TlsAuthConfigDxe.c +++ b/AmiNetworkPkg/UefiNetworkStack/Common/TlsAuthConfigDxe/TlsAuthConfigDxe.c @@ -37,7 +37,7 @@ // // ============================================================================ // Global UEFI System Table Pointers -// Populated by TlsAuthConfigDriverBindingStart (sub_4CC) via +// Populated by TlsAuthConfigDriverBindingStart via // UefiBootServicesTableLib / UefiRuntimeServicesTableLib // ============================================================================ // @@ -229,7 +229,7 @@ /** * Initialise UEFI boot/runtime services global pointers and locate HII - * protocols (sub_4CC). + * protocols. * * Called once during TlsAuthConfigDxeEntry(). * @@ -270,7 +270,7 @@ // // Initialise the HII system table (locates HII config routing, etc.) // - InitializeHiiConfigAccess (NULL); /* sub_6504 placeholder */ + InitializeHiiConfigAccess (NULL); // // Locate HII Config Access Protocol @@ -332,7 +332,7 @@ /** * Unload the driver. Retrieves the private TLS Auth Config protocol * instance, validates the signature, uninstalls the protocol, and - * destroys the private context (sub_3D0). + * destroys the private context. * * @param ImageHandle The image to unload * @@ -385,7 +385,7 @@ } /** - * Driver entry point (sub_450 / _ModuleEntryPoint). + * Driver entry point. * * Initialises UEFI library state, installs the Driver Binding Protocol * (GUID unk_C4E0), sets the image unload handler to TlsAuthConfigUnload, @@ -456,7 +456,7 @@ // /** - * Test whether the driver supports a controller (sub_694? Actually not + * Test whether the driver supports a controller. Actually not * a separate function in the visible list -- the Supported member is * defined in the IFR / protocol install section). * @@ -482,7 +482,7 @@ } /** - * Start the driver on a controller (sub_694). + * Start the driver on a controller. * * Allocates a 144-byte private context, initialises it, * installs the TLS Auth Config Protocol, and registers @@ -588,7 +588,7 @@ // /** - * Initialise the TLS Auth Config private data structure (sub_1638). + * Initialise the TLS Auth Config private data structure. * * Sets the signature and stores the child driver functions. * @@ -610,7 +610,7 @@ } /** - * Destroy the TLS Auth Config private data (sub_1550). + * Destroy the TLS Auth Config private data. * * @param Private The private structure */ @@ -630,7 +630,7 @@ // // ============================================================================ -// HII Config Access Protocol (sub_758) +// HII Config Access Protocol // ============================================================================ // @@ -817,7 +817,7 @@ } /** - * HII ExtractConfig (sub_A10). + * HII ExtractConfig. * * Reads the TlsCaCertificate UEFI variable, iterates all certificate * entries, and builds a new variable buffer potentially excluding the @@ -1015,12 +1015,12 @@ // // ============================================================================ -// HII Config Access Install (sub_450 continuation) +// HII Config Access Install // ============================================================================ // /** - * Install the HII Config Access protocol on ImageHandle (sub_450 -> sub_694). + * Install the HII Config Access protocol on ImageHandle. * * @param ImageHandle The image handle * @@ -1075,7 +1075,7 @@ /** * Check if a certificate entry matches the expected variable GUID - * (sub_1E60). + * matches the expected TLS CA certificate entry type. * * @param CertEntry Pointer to a certificate entry in the TlsCaCertificate * variable data @@ -1096,4 +1096,4 @@ (EFI_GUID *)((UINT8 *)CertEntry + 8), Guid ); -} \ No newline at end of file +} diff --git a/AmiNetworkPkg/UefiNetworkStack/Common/TlsAuthConfigDxe/TlsAuthConfigDxe.h b/AmiNetworkPkg/UefiNetworkStack/Common/TlsAuthConfigDxe/TlsAuthConfigDxe.h index ab4f9eb..a9943b1 100644 --- a/AmiNetworkPkg/UefiNetworkStack/Common/TlsAuthConfigDxe/TlsAuthConfigDxe.h +++ b/AmiNetworkPkg/UefiNetworkStack/Common/TlsAuthConfigDxe/TlsAuthConfigDxe.h @@ -99,7 +99,7 @@ EFI_STATUS EFIAPI -by TlsAuthConfigDriverBindingStart (sub_4CC) via( +by TlsAuthConfigDriverBindingStart via( VOID ); @@ -171,7 +171,7 @@ EFI_STATUS EFIAPI -(NULL); /* sub_6504 placeholder */( +(NULL); /* HII setup placeholder */( VOID ); @@ -345,7 +345,7 @@ EFI_STATUS EFIAPI -Config Access Protocol (sub_758)( +Config Access Protocol ( VOID ); @@ -459,7 +459,7 @@ EFI_STATUS EFIAPI -Config Access Install (sub_450 continuation)( +Config Access Install ( VOID ); @@ -511,4 +511,4 @@ VOID ); -#endif /* __TLSAUTHCONFIGDXE_H__ */ \ No newline at end of file +#endif /* __TLSAUTHCONFIGDXE_H__ */ diff --git a/AmiTsePkg/EDK/MiniSetup/AMITSE/AMITSE.c b/AmiTsePkg/EDK/MiniSetup/AMITSE/AMITSE.c index 657071f..053b339 100644 --- a/AmiTsePkg/EDK/MiniSetup/AMITSE/AMITSE.c +++ b/AmiTsePkg/EDK/MiniSetup/AMITSE/AMITSE.c @@ -180,7 +180,7 @@ if (!EFI_ERROR (Status)) { // Register "boot next" notification callback TseInvokeCallbackOrDirect (TSE_CALLBACK_BOOT_NEXT, - (VOID *)sub_32ECC); + (VOID *)TseSetupBootNextCallback); // Clear timeout n6 = 0; @@ -192,7 +192,7 @@ TseRegisterProtocolCallbacks (); // Install notification events - Status = sub_7310 (); + Status = TseInstallNotificationEvents (); if (EFI_ERROR (Status)) { // Install AMITSE protocol as fallback gBS->InstallMultipleProtocolInterfaces ( @@ -768,7 +768,7 @@ } qword_747A0 = TseAllocatePool (12000004); if (qword_747A0 != NULL) { - sub_56AC (7); // Set up variable services + TseSetupVariableServices (7); // Set up variable services return EFI_SUCCESS; } } @@ -885,7 +885,7 @@ TseInvokeCallbackOrDirect (TSE_CALLBACK_ENTRY_SETUP, TseDrawBootMenu); TseInvokeCallbackOrDirect (TSE_CALLBACK_AFTER_SETUP, - sub_19FC); + TseAfterSetupCallback); } return 0; @@ -927,7 +927,7 @@ if (KeyEvent != 1) { return EFI_UNSUPPORTED; } - return sub_6594 (KeyData, 0); + return TseSendKeyToConIn (KeyData, 0); } /** @@ -941,17 +941,17 @@ if (byte_64168 == 0) { return EFI_UNSUPPORTED; } - sub_4F8C (Vars); + TsePushBootEventVariables (Vars); if (byte_66DC8 == 0) { return EFI_UNSUPPORTED; } - sub_7B4C (); + TseRefreshBootState (); if (qword_66D60 == 0) { return EFI_UNSUPPORTED; } byte_66DC8 = 0; - sub_C9BC (); - sub_7C3C (); + TseNotifyBootProceed (); + TseRestoreBootDisplay (); return EFI_SUCCESS; } @@ -1017,7 +1017,7 @@ WasWatchdog = TRUE; } - UINTN Result = sub_46C7C (...); + UINTN Result = TseDisplayPageCore (...); if (WasTimer) { TseRestoreDisplayState (); @@ -1142,7 +1142,7 @@ { EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *ConOut; - sub_E7C8 (); // Flush console + TseFlushConsole (); // Flush console ConOut = (VOID *)((EFI_SYSTEM_TABLE *)SystemTable_0)->ConOut; if (ConOut != NULL) { @@ -1329,7 +1329,7 @@ BOOLEAN TseCheckEfiShellPresent (VOID) { - return sub_32BF4 (); + return TseIsEfiShellBootOptionPresent (); } // @@ -1384,7 +1384,7 @@ { return TseInvokeCallbackOrDirect ( TSE_CALLBACK_DRIVER_HEALTH, - sub_32D3C + TseDriverHealthCallback ); } @@ -1396,7 +1396,7 @@ { return TseInvokeCallbackOrDirect ( TSE_CALLBACK_LOAD_OPTIONS, - sub_32DB4 + TseLoadOptionCallback ); } @@ -1408,7 +1408,7 @@ { return TseInvokeCallbackOrDirect ( TSE_CALLBACK_BOOT_NEXT, - sub_32ECC + TseSetupBootNextCallback ); } @@ -1420,7 +1420,7 @@ { return TseInvokeCallbackOrDirect ( TSE_CALLBACK_NULL, - nullsub_1 + TseNullCallback ); } @@ -1484,4 +1484,4 @@ { // ... (warning dialog rendering) return EFI_SUCCESS; -} \ No newline at end of file +} diff --git a/CpPlatPkg/Whea/WheaPlatformBoot/WheaPlatformBoot.c b/CpPlatPkg/Whea/WheaPlatformBoot/WheaPlatformBoot.c index 1223a17..f0b76f4 100644 --- a/CpPlatPkg/Whea/WheaPlatformBoot/WheaPlatformBoot.c +++ b/CpPlatPkg/Whea/WheaPlatformBoot/WheaPlatformBoot.c @@ -13,32 +13,31 @@ STATIC UINT8 mWheaPlatformBootContext[0x28]; -// Function: ModuleEntryPoint EFI_STATUS ModuleEntryPoint(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) { EFI_STATUS NewStatus; EFI_STATUS FinalStatus; - sub_510(ImageHandle, SystemTable); + WheaPlatformBootInitializeUefiContext(ImageHandle, SystemTable); mWheaPlatformBootStatus = 0x8000000000000001ULL; - if ( !sub_280(&mWheaPlatformBootContext) ) + if ( !WheaPlatformBootSetJump(&mWheaPlatformBootContext) ) { - NewStatus = sub_904(); + NewStatus = WheaPlatformBootInitializeWheaPolicy(); if ( NewStatus >= 0 || mWheaPlatformBootStatus < 0 ) mWheaPlatformBootStatus = NewStatus; - sub_AB0(&mWheaPlatformBootContext); - sub_320(&mWheaPlatformBootContext, -1); - sub_C40( + WheaPlatformBootCleanupContext(&mWheaPlatformBootContext); + WheaPlatformBootRestoreContext(&mWheaPlatformBootContext, -1); + WheaPlatformBootAssertFailed( "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\CpPlatPkg\\Whea\\WheaPlatformBoot\\WheaPlatformBoot\\DEBUG\\AutoGen.c", 369, "((BOOLEAN)(0==1))"); - sub_C40( + WheaPlatformBootAssertFailed( "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\CpPlatPkg\\Whea\\WheaPlatformBoot\\WheaPlatformBoot\\DEBUG\\AutoGen.c", 384, "((BOOLEAN)(0==1))"); } FinalStatus = mWheaPlatformBootStatus; if ( mWheaPlatformBootStatus < 0 ) - sub_CF4(); + WheaPlatformBootCleanupOnFailure(); return FinalStatus; } diff --git a/CpPlatPkg/Whea/WheaPlatformBoot/WheaPlatformBoot.h b/CpPlatPkg/Whea/WheaPlatformBoot/WheaPlatformBoot.h index 32ae44f..e5bfb3d 100644 --- a/CpPlatPkg/Whea/WheaPlatformBoot/WheaPlatformBoot.h +++ b/CpPlatPkg/Whea/WheaPlatformBoot/WheaPlatformBoot.h @@ -27,69 +27,69 @@ ); /// -/// sub_510 +/// WheaPlatformBootInitializeUefiContext /// EFI_STATUS EFIAPI -sub_510( +WheaPlatformBootInitializeUefiContext( EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable ); /// -/// sub_904 +/// WheaPlatformBootInitializeWheaPolicy /// EFI_STATUS EFIAPI -sub_904( +WheaPlatformBootInitializeWheaPolicy( VOID ); /// -/// sub_AB0 +/// WheaPlatformBootCleanupContext /// EFI_STATUS EFIAPI -sub_AB0( +WheaPlatformBootCleanupContext( VOID *WheaBootContext ); /// -/// sub_320 +/// WheaPlatformBootRestoreContext /// EFI_STATUS EFIAPI -sub_320( +WheaPlatformBootRestoreContext( VOID *WheaBootContext, INT64 EventType ); /// -/// sub_C40 +/// WheaPlatformBootAssertFailed /// EFI_STATUS EFIAPI -sub_C40( +WheaPlatformBootAssertFailed( const CHAR8 *FileName, UINTN Line, const CHAR8 *Expression ); /// -/// sub_280 +/// WheaPlatformBootSetJump /// EFI_STATUS EFIAPI -sub_280( +WheaPlatformBootSetJump( VOID *WheaBootContext ); /// -/// sub_CF4 +/// WheaPlatformBootCleanupOnFailure /// EFI_STATUS EFIAPI -sub_CF4( +WheaPlatformBootCleanupOnFailure( VOID ); diff --git a/FatPkg/EnhancedFatDxe/Fat.h b/FatPkg/EnhancedFatDxe/Fat.h index 46aa2a3..d9b2a2b 100644 --- a/FatPkg/EnhancedFatDxe/Fat.h +++ b/FatPkg/EnhancedFatDxe/Fat.h @@ -153,20 +153,20 @@ // EFI_FILE_PROTOCOL function table UINT64 Revision; // 0x08: 0x00010000 - UINT64 Open; // 0x10: sub_3AF4 - UINT64 Close; // 0x18: sub_1FDC - UINT64 Delete; // 0x20: sub_3B14 - UINT64 Read; // 0x28: sub_3030 - UINT64 Write; // 0x30: sub_3070 - UINT64 GetPosition; // 0x38: sub_2C58 - UINT64 SetPosition; // 0x40: sub_2C9C - UINT64 GetInfo; // 0x48: sub_2C10 - UINT64 SetInfo; // 0x50: sub_2C30 - UINT64 Flush; // 0x58: sub_1FD4 - UINT64 OpenEx; // 0x60: sub_398C - UINT64 ReadEx; // 0x68: sub_3050 - UINT64 WriteEx; // 0x70: sub_3214 - UINT64 FlushEx; // 0x78: sub_1EBC + UINT64 Open; // 0x10: EFI_FILE_PROTOCOL.Open + UINT64 Close; // 0x18: EFI_FILE_PROTOCOL.Close + UINT64 Delete; // 0x20: EFI_FILE_PROTOCOL.Delete + UINT64 Read; // 0x28: EFI_FILE_PROTOCOL.Read + UINT64 Write; // 0x30: EFI_FILE_PROTOCOL.Write + UINT64 GetPosition; // 0x38: EFI_FILE_PROTOCOL.GetPosition + UINT64 SetPosition; // 0x40: EFI_FILE_PROTOCOL.SetPosition + UINT64 GetInfo; // 0x48: EFI_FILE_PROTOCOL.GetInfo + UINT64 SetInfo; // 0x50: EFI_FILE_PROTOCOL.SetInfo + UINT64 Flush; // 0x58: EFI_FILE_PROTOCOL.Flush + UINT64 OpenEx; // 0x60: EFI_FILE_PROTOCOL.OpenEx + UINT64 ReadEx; // 0x68: EFI_FILE_PROTOCOL.ReadEx + UINT64 WriteEx; // 0x70: EFI_FILE_PROTOCOL.WriteEx + UINT64 FlushEx; // 0x78: EFI_FILE_PROTOCOL.FlushEx FAT_OFILE *OFile; // 0x80: owning OFILE UINT64 Position; // 0x88: current file position @@ -610,4 +610,4 @@ VOID ); -#endif // __FAT_H__ \ No newline at end of file +#endif // __FAT_H__ diff --git a/LenovoServerPkg/IntelPhyCard/IntelPhyCard/IntelPhyCard.c b/LenovoServerPkg/IntelPhyCard/IntelPhyCard/IntelPhyCard.c index cfae7af..729cf5a 100644 --- a/LenovoServerPkg/IntelPhyCard/IntelPhyCard/IntelPhyCard.c +++ b/LenovoServerPkg/IntelPhyCard/IntelPhyCard/IntelPhyCard.c @@ -55,7 +55,7 @@ "e:\\hs\\MdePkg\\Library\\UefiRuntimeServicesTableLib\\UefiRuntimeServicesTableLib.c", 47, "gRT != ((void *) 0)"); - Status = sub_1B64(&unk_4A10, &qword_4B80); /*0x531*/ + Status = LocateDxeServicesTable(&unk_4A10, &qword_4B80); /*0x531*/ Status = Status; /*0x536*/ if ( Status < 0 ) /*0x542*/ { @@ -83,7 +83,7 @@ if ( !qword_4B88 ) /*0x61d*/ AssertHandler("e:\\hs\\CpRcPkg\\Library\\DxeMmPciBaseLib\\DxeMmPciBaseLib.c", 53, "mPciUsra != ((void *) 0)"); /*0x632*/ } - sub_1C28(); /*0x637*/ + InitializePciExpressWorkarounds(); /*0x637*/ v6 = GetPcdProtocol(); /*0x63c*/ qword_4B98 = (*(__int64 ( **)(__int64))(v6 + 32))(5); /*0x649*/ v7 = GetPcdProtocol(); /*0x650*/ @@ -96,26 +96,26 @@ "sizeof (PCIE_SEG_BUS_TABLE) >= LibPcdGetSize(7U)"); v10 = GetPcdProtocol(); /*0x688*/ v11 = (*(__int64 ( **)(__int64))(v10 + 56))(7); /*0x690*/ - sub_292C(v12, v8, v11); /*0x699*/ + ConfigurePciExpressSegmentTable(v12, v8, v11); /*0x699*/ if ( *(char *)PciExpressAddress(1024068) >= 0 ) /*0x6ae*/ { v13 = PciExpressAddress(1024064); /*0x6b3*/ - sub_2878(v13); /*0x6bb*/ + ApplyPciExpressSegmentSettings(v13); /*0x6bb*/ v14 = (_BYTE *)PciExpressAddress(1024068); /*0x6c2*/ *v14 |= 0x80u; /*0x6cc*/ } - v15 = sub_360(); /*0x6d3*/ - sub_350(); /*0x6d6*/ + v15 = GetPciePowerManagementState(); /*0x6d3*/ + ClearPciePowerManagementState(); /*0x6d6*/ v16 = (v15 & 0x200) != 0; /*0x6e7*/ v17 = IoRead32Wrapper(1288) & 0xFFFFFF; /*0x6f1*/ - sub_330(); /*0x6f7*/ + BeginPciePowerTransition(); /*0x6f7*/ while ( (((_DWORD)v17 + 357 - (unsigned int)IoRead32Wrapper(1288)) & 0x800000) == 0 ) /*0x717*/ - sub_320(); /*0x6fe*/ - sub_330(); /*0x719*/ + WaitForPciePowerTransition(); /*0x6fe*/ + BeginPciePowerTransition(); /*0x719*/ if ( v16 ) /*0x720*/ - sub_340(); /*0x722*/ - else sub_350(); /*0x729*/ - result = sub_2784(4278190080LL); /*0x733*/ + RestorePciePowerManagementState(); /*0x722*/ + else ClearPciePowerManagementState(); /*0x729*/ + result = ResolveSpiControllerProtocol(4278190080LL); /*0x733*/ if ( result < 0 ) /*0x73b*/ { DebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", result); /*0x74a*/ @@ -216,7 +216,7 @@ *(_QWORD *)&Result = Index + (unsigned __int64)v11; /*0xf72*/ if ( (_QWORD)Result ) { - sub_9BC(Index + (unsigned __int64)v11, 0, Result, v8); /*0xf81*/ + CalculateMacSeedOffset(Index + (unsigned __int64)v11, 0, Result, v8); /*0xf81*/ v13 = (unsigned __int8)dword_4CC0; /*0xf86*/ v14 = BYTE1(dword_4CC0); /*0xf95*/ v15 = BYTE2(dword_4CC0); /*0xf9d*/ @@ -225,7 +225,7 @@ WORD2(v81) = word_4CC4; /*0xfd6*/ v73 = (unsigned __int8)word_4CC4; /*0xffb*/ v74 = HIBYTE(dword_4CC0); /*0x1002*/ - v63 = sub_C90(&v81); /*0x1011*/ + v63 = ValidateMacChecksum(&v81); /*0x1011*/ v72 = v16; /*0x1015*/ v75 = v15; /*0x1019*/ v76 = v14; /*0x101d*/ @@ -238,7 +238,7 @@ do /*0x1142*/ { SetMem(&v61, 6, 0); /*0x1056*/ - v23 = sub_BEC(v21, v17, v22, &v61); /*0x1063*/ + v23 = ReadFruMacBlock(v21, v17, v22, &v61); /*0x1063*/ v62 = BYTE1(v61); /*0x1071*/ v24 = v61; /*0x1071*/ __SET_PAIR__(v82, v83, WORD1(v61)); /*0x108b*/ @@ -247,7 +247,7 @@ v68 = v61; /*0x10b1*/ if ( v23 >= 0 ) /*0x10b9*/ { - v25 = sub_C90(&v68); /*0x10c5*/ + v25 = ValidateMacChecksum(&v68); /*0x10c5*/ *v18 = v25; /*0x10de*/ DebugPrint(64, "ValidMacFRU[%d] = 0x%X \n", n4_1, v25); /*0x10e1*/ DebugPrint( /*0x112a*/ @@ -294,12 +294,12 @@ result = (*(__int64 ( **)(__int64, __int64, __int64 *))(qword_4B58 + 64))(4, 0x20000, &Result); /*0x125d*/ if ( result >= 0 ) /*0x1263*/ { - sub_27C4(v27, Result, 0x20000); /*0x1274*/ + CopyFlashRegionToBuffer(v27, Result, 0x20000); /*0x1274*/ Index = 0; /*0x1279*/ do /*0x1318*/ { SetMem(&v61, 6, 0); /*0x1298*/ - sub_BEC(v30, v26, v31, &v61); /*0x12a6*/ + ReadFruMacBlock(v30, v26, v31, &v61); /*0x12a6*/ v33 = v61; /*0x12ab*/ v26 += 6; /*0x12af*/ v34 = *(_WORD *)((char *)&v61 + 1); /*0x12b7*/ @@ -321,7 +321,7 @@ LOBYTE(v32) = 1; /*0x132d*/ dword_4C70 = dword_4CC0; /*0x1330*/ word_4C74 = word_4CC4; /*0x1366*/ - sub_9BC(Result, v32, v35, v36); /*0x1372*/ + CalculateMacSeedOffset(Result, v32, v35, v36); /*0x1372*/ funcs_1386 = (void (*)(void))funcs_1386; /*0x1377*/ Index = 0; /*0x1381*/ while ( funcs_1386 ) /*0x1399*/ @@ -330,7 +330,7 @@ funcs_1386 = *(void (**)(void))((char *)&funcs_1386 + (_QWORD)&_ImageBase[4 * (unsigned __int8)++Index]); /*0x138e*/ } v40 = qword_4C28; /*0x139b*/ - if ( qword_4C28 || (sub_2784(qword_4AD0), (v40 = qword_4C28) != 0) ) /*0x13bd*/ + if ( qword_4C28 || (ResolveSpiControllerProtocol(qword_4AD0), (v40 = qword_4C28) != 0) ) /*0x13bd*/ { (*(void (**)(void))(v40 + 48))(); /*0x13bf*/ v40 = qword_4C28; /*0x13c2*/ @@ -343,13 +343,13 @@ v44 = v43; /*0x13d6*/ v81 = v43; /*0x13d8*/ v45 = v43 + v27; /*0x13df*/ - if ( (v40 || (sub_2784(v43 + v27), (v40 = qword_4C28) != 0)) /*0x1420*/ + if ( (v40 || (ResolveSpiControllerProtocol(v43 + v27), (v40 = qword_4C28) != 0)) /*0x1420*/ && ((*(void ( **)(__int64))(v40 + 32))(v45), (v46 = qword_4C28) != 0) - || (sub_2784(v45), (v46 = qword_4C28) != 0) ) + || (ResolveSpiControllerProtocol(v45), (v46 = qword_4C28) != 0) ) { (*(void ( **)(__int64))(v46 + 8))(v45); /*0x1425*/ } - sub_38BC(v45, v44 + Result); /*0x1433*/ + PrepareFlashWriteWindow(v45, v44 + Result); /*0x1433*/ n4096 = 4096; /*0x143d*/ n4096_1 = 4096; /*0x1446*/ v80 = v44 + Result; /*0x144b*/ @@ -357,7 +357,7 @@ while ( 1 ) /*0x1460*/ { SetMem(v79, 256, 0); /*0x1460*/ - sub_27C4(v27 + v49 + v81, v79, 256); /*0x147c*/ + CopyFlashRegionToBuffer(v27 + v49 + v81, v79, 256); /*0x147c*/ n4096_1 -= 256; /*0x1484*/ Index = 0; /*0x148b*/ v51 = n4096 - n4096_1; /*0x148e*/ @@ -396,7 +396,7 @@ LABEL_66: DebugPrint(64, Write_success_%X_n, v42); /*0x14ee*/ v40 = qword_4C28; /*0x14fd*/ - if ( qword_4C28 || (sub_2784(v45), (v40 = qword_4C28) != 0) ) /*0x151e*/ + if ( qword_4C28 || (ResolveSpiControllerProtocol(v45), (v40 = qword_4C28) != 0) ) /*0x151e*/ { (*(void ( **)(__int64))(v40 + 40))(v45); /*0x1523*/ v40 = qword_4C28; /*0x1526*/ @@ -405,7 +405,7 @@ ++n0x20; /*0x153a*/ } while ( n0x20 < 0x20u ); /*0x1542*/ - if ( v40 || (sub_2784(qword_4AD0), (v40 = qword_4C28) != 0) ) /*0x1563*/ + if ( v40 || (ResolveSpiControllerProtocol(qword_4AD0), (v40 = qword_4C28) != 0) ) /*0x1563*/ { (*(void (**)(void))(v40 + 56))(); /*0x1565*/ funcs_157E = (void (*)(void))funcs_157E; /*0x1568*/ @@ -459,7 +459,7 @@ __int64 result; // rax char v1; // [rsp+50h] [rbp+18h] DebugPrint(0x80000000LL, "\nUpdateOCPCardStatus\n"); /*0x18b9*/ - if ( (unsigned __int8)sub_1674() == 1 ) /*0x18c5*/ + if ( (unsigned __int8)IsOcpTypeCDevicePresent() == 1 ) /*0x18c5*/ { result = GetOcpTypeCStatus(); /*0x18c7*/ if ( (_BYTE)result ) /*0x18ce*/ @@ -510,10 +510,10 @@ __int64 DebugPrint(__int64 a1, const char *a2, ...) { __int64 result; // rax __int64 ( **v4)(__int64, const char *, __int64 *); // r10 va_list va; // [rsp+40h] [rbp+18h] BYREF va_start(va, a2); - result = sub_19D0(); /*0x1a67*/ + result = GetDebugAgentProtocol(); /*0x1a67*/ if ( result ) /*0x1a72*/ { - result = sub_28AC(); /*0x1a74*/ + result = GetDebugPrintMask(); /*0x1a74*/ if ( ((unsigned int)result & (unsigned int)a1) != 0 ) /*0x1a7f*/ return (*v4)(a1, a2, (__int64 *)va); /*0x1a8e*/ } @@ -523,7 +523,7 @@ // 1A98 (0x1A98) __int64 AssertHandler(__int64 a1, __int64 a2, __int64 a3) { - __int64 result; // rax result = sub_19D0(); /*0x1ab0*/ + __int64 result; // rax result = GetDebugAgentProtocol(); /*0x1ab0*/ if ( result ) /*0x1ab8*/ return (*(__int64 ( **)(__int64, __int64, __int64))(result + 8))(a1, a2, a3); /*0x1ac3*/ return result; /*0x1ad0*/ @@ -605,7 +605,7 @@ SetMem(dst, 64, 0); /*0x1ee7*/ if ( a4 ) /*0x1eef*/ { - sub_253C(v4 + a1, dst, &p_n2); /*0x1f02*/ + ReadFlashPageToBuffer(v4 + a1, dst, &p_n2); /*0x1f02*/ n2_1 = p_n2; /*0x1f07*/ } else @@ -649,7 +649,7 @@ if ( !qword_4C18 ) /*0x1fc2*/ { *(_DWORD *)(qword_4A20 + 180) = 0; /*0x1fcf*/ - if ( *(_DWORD *)(qword_4A20 + 184) == 267429210 && sub_1D5C(0, &v11, &v10) >= 0 ) /*0x1ffd*/ + if ( *(_DWORD *)(qword_4A20 + 184) == 267429210 && ReadSpiDescriptorRange(0, &v11, &v10) >= 0 ) /*0x1ffd*/ { Index = 0; /*0x1fff*/ v9 = 0; /*0x2002*/ @@ -657,7 +657,7 @@ do /*0x2056*/ { *(_DWORD *)(qword_4A20 + 180) = 0; /*0x2011*/ - if ( *(_DWORD *)(qword_4A20 + 184) == 267429210 && sub_1D5C((unsigned int)Index, 0, &v9) >= 0 && v9 > v5 ) /*0x2049*/ + if ( *(_DWORD *)(qword_4A20 + 184) == 267429210 && ReadSpiDescriptorRange((unsigned int)Index, 0, &v9) >= 0 && v9 > v5 ) /*0x2049*/ v5 = v9; /*0x2049*/ ++Index; /*0x204f*/ } @@ -689,7 +689,7 @@ *(_DWORD *)(qword_4A20 + 8) = 0; /*0x218a*/ *(_WORD *)(qword_4A20 + 6) = 525; /*0x219d*/ FlashCommandStatusControl(1, 0); /*0x21a3*/ - sub_1CE8((unsigned int)(v3 + 35)); /*0x21ab*/ + EnterSpiFlashReadMode((unsigned int)(v3 + 35)); /*0x21ab*/ *p_n24608 = *(_DWORD *)(qword_4A20 + 16) & 0xFFFFFF; /*0x21c2*/ return 1; /*0x21c4*/ } @@ -755,7 +755,7 @@ *(_DWORD *)(qword_4A20 + 8) = v15; /*0x2485*/ *(_WORD *)(qword_4A20 + 6) = (Index << 8) - 251; /*0x24a0*/ FlashCommandStatusControl(1, 0); /*0x24a7*/ - sub_1E60(); /*0x24ac*/ + WaitForSpiFlashReady(); /*0x24ac*/ if ( byte_4AA8 && (v13 & 1) == 0 && Index >= 2u ) /*0x24c7*/ { *(_WORD *)(qword_4A20 + 161) = 114; /*0x24d6*/ @@ -800,7 +800,7 @@ LOBYTE(v4) = 1; /*0x26e8*/ *(_WORD *)(qword_4A20 + 6) = 15; /*0x26ea*/ FlashCommandStatusControl(v4, 0); /*0x26f0*/ - return sub_1E60(); /*0x26f5*/ + return WaitForSpiFlashReady(); /*0x26f5*/ } } } @@ -808,7 +808,7 @@ } // 2784 (0x2784) -__int64 sub_2784(__int64 a1) +__int64 ResolveSpiControllerProtocol(__int64 a1) { __int64 ( **v2)(); // rbx char v3; // al v2 = off_4320; /*0x2791*/ do /*0x27b2*/ @@ -1098,7 +1098,7 @@ { n4096 = 4096; /*0x365c*/ n32 = -41; /*0x3666*/ - n0x1000000 = sub_2F24((unsigned int)n24608); /*0x3672*/ + n0x1000000 = GetSpiFlashSizeFromVendorProfile((unsigned int)n24608); /*0x3672*/ XMC_25QH_Series = "PMC 25LV/LQ Series"; /*0x3678*/ n15 = 18; /*0x367f*/ goto LABEL_92; /*0x3685*/ @@ -1175,7 +1175,7 @@ goto LABEL_92; /*0x3280*/ case 0x377Fu: /*0x320b*/ n4096 = 4096; /*0x322e*/ - n0x1000000 = sub_2F24((unsigned int)n24608); /*0x323d*/ + n0x1000000 = GetSpiFlashSizeFromVendorProfile((unsigned int)n24608); /*0x323d*/ XMC_25QH_Series = "AMIC 25L Series"; /*0x3243*/ n15 = 15; /*0x324a*/ goto LABEL_92; /*0x3250*/ @@ -1242,7 +1242,7 @@ case 0x26BFu: /*0x3162*/ n4096 = 4096; /*0x31bb*/ byte_4AA9 = 1; /*0x31c5*/ - n0x1000000 = sub_2F74((unsigned int)n24608); /*0x31d1*/ + n0x1000000 = GetSpiFlashSizeFromExtendedJedec((unsigned int)n24608); /*0x31d1*/ XMC_25QH_Series = "SST 26VF Series"; /*0x31d7*/ n15 = 15; /*0x31de*/ goto LABEL_92; /*0x31e4*/ @@ -1266,7 +1266,7 @@ { case 0x201u: /*0x303c*/ n4096 = 0x10000; /*0x3138*/ - n0x1000000 = sub_2F24((unsigned int)n24608); /*0x3144*/ + n0x1000000 = GetSpiFlashSizeFromVendorProfile((unsigned int)n24608); /*0x3144*/ XMC_25QH_Series = "Spansion 25FL Series"; /*0x314a*/ n15 = 19; /*0x3151*/ goto LABEL_92; /*0x3157*/ @@ -1340,7 +1340,7 @@ } if ( (unsigned __int16)n24608 != 9663 ) /*0x37c8*/ return 0; /*0x37a7*/ - n0x800000 = sub_2F74(n24608); /*0x37ca*/ + n0x800000 = GetSpiFlashSizeFromExtendedJedec(n24608); /*0x37ca*/ n256 = n256; /*0x37cf*/ n17 = 15; /*0x37df*/ if ( n0x800000 >= 0x800000 ) /*0x37e5*/ diff --git a/LenovoServerPkg/IntelPhyCard/IntelPhyCard/IntelPhyCard.h b/LenovoServerPkg/IntelPhyCard/IntelPhyCard/IntelPhyCard.h index cbc9585..760b771 100644 --- a/LenovoServerPkg/IntelPhyCard/IntelPhyCard/IntelPhyCard.h +++ b/LenovoServerPkg/IntelPhyCard/IntelPhyCard/IntelPhyCard.h @@ -1,23 +1,13 @@ -/* - * IntelPhyCard.efi - Header file - * Source: HR650X BIOS PE file 0101 (IntelPhyCard.efi) - * Contains function declarations and global externs for the OCP/PHY driver - */ - #ifndef __INTELPHYCARD_H__ #define __INTELPHYCARD_H__ #include -// EFI global protocol handles extern EFI_HANDLE gImageHandle; extern EFI_SYSTEM_TABLE *gSystemTable; extern EFI_BOOT_SERVICES *gBS; extern EFI_RUNTIME_SERVICES *gRT; -// Function declarations - -// Entry point EFI_STATUS EFIAPI ModuleEntryPoint ( @@ -25,15 +15,12 @@ IN EFI_SYSTEM_TABLE *SystemTable ); -// Main initialization __int64 IntelPhyCardDriverInit(__int64 ImageHandle, __int64 a2); -// OCP PHY/MAC driver functions __int64 ProvisionOcpCard(void); void UpdateOcpCardStatus(void); char GetOcpTypeCStatus(void); -// SPI Flash / I2C functions char __fastcall ProgramSpiFlashPage(__int64 a1, __int64 a2, _DWORD *a3); char __fastcall DetectAdestoMicronAtmelFlash(__int64 a1, __int64 *a2); char __fastcall DetectXmcWinbondAmicMxicFlash(__int64 a1, __int64 *a2); @@ -47,16 +34,14 @@ __int64 __fastcall FlashCommandStatusControl(char a1, char a2); char *__fastcall MemMove(char *dst, char *src, unsigned __int64 n); -// Debug/Assert/Utility functions __int64 GetPcdProtocol(void); __int64 __fastcall DebugPrint(__int64 a1, const char *a2, ...); __int64 __fastcall AssertHandler(__int64 a1, __int64 a2, __int64 a3); -__int64 __fastcall sub_2784(__int64 a1); +__int64 __fastcall ResolveSpiControllerProtocol(__int64 a1); __int64 __fastcall PciExpressAddress(__int64 a1); unsigned __int32 __fastcall IoRead32Wrapper(unsigned __int16 Port); __int64 __fastcall CpuidWrapper(unsigned int _RAX_1, _DWORD *a2, _DWORD *a3, _DWORD *a4, _DWORD *a5); -// Global data extern UINT64 qword_4A20; // PciExpress MMIO base extern UINT64 qword_4AD0; // Flash base address extern UINT64 qword_4B50; // gST (System Table) diff --git a/LenovoServerPkg/InventoryApp/InventoryApp.c b/LenovoServerPkg/InventoryApp/InventoryApp.c index b762a7a..c66c8d3 100644 --- a/LenovoServerPkg/InventoryApp/InventoryApp.c +++ b/LenovoServerPkg/InventoryApp/InventoryApp.c @@ -139,7 +139,7 @@ gRT = SystemTable->RuntimeServices; // Initialize HOB list - GetHobList(); + GetHobListFromSystemTable(); // Initialize cached system table copies SystemTable_0 = SystemTable; @@ -147,17 +147,17 @@ RuntimeServices_0 = SystemTable->RuntimeServices; // ---- Print header ---- - SPrintf(PrintBuffer, L"-----------------------" + UnicodeSPrintEx(PrintBuffer, L"-----------------------" L"----------------------------------------\n\r"); ConOut_OutputString(PrintBuffer); - SPrintf(PrintBuffer, + UnicodeSPrintEx(PrintBuffer, L"| Inventory Check Tool V 0.%d " L"Editor: Rush Wang (c)2017 Copyright Lenovo |\n\r", 1); ConOut_OutputString(PrintBuffer); - SPrintf(PrintBuffer, L"-----------------------" + UnicodeSPrintEx(PrintBuffer, L"-----------------------" L"----------------------------------------\n\r"); ConOut_OutputString(PrintBuffer); @@ -195,16 +195,16 @@ // ---- argc == 1: Print usage ---- if (ArgCount == 1) { - SPrintf(PrintBuffer, L"Input 'cpu' or 'dimm' or 'pci' or 'hdd'\n\r"); + UnicodeSPrintEx(PrintBuffer, L"Input 'cpu' or 'dimm' or 'pci' or 'hdd'\n\r"); ConOut_OutputString(PrintBuffer); - SPrintf(PrintBuffer, L"Ex: InventoryApp.efi dimm \n\r"); + UnicodeSPrintEx(PrintBuffer, L"Ex: InventoryApp.efi dimm \n\r"); ConOut_OutputString(PrintBuffer); - SPrintf(PrintBuffer, L"Also can append an index of dedicated data\n\r"); + UnicodeSPrintEx(PrintBuffer, L"Also can append an index of dedicated data\n\r"); ConOut_OutputString(PrintBuffer); - SPrintf(PrintBuffer, L"Ex: InventoryApp.efi hdd 1 \n\r"); + UnicodeSPrintEx(PrintBuffer, L"Ex: InventoryApp.efi hdd 1 \n\r"); ConOut_OutputString(PrintBuffer); return EFI_INVALID_PARAMETER; @@ -216,7 +216,7 @@ NULL, &InventoryData); - SPrintf(PrintBuffer, + UnicodeSPrintEx(PrintBuffer, L"LocateProtocol gSystemInventoryProtocolGuid = %r \n\r", Status); ConOut_OutputString(PrintBuffer); @@ -227,7 +227,7 @@ Offset = 0; } else if (ArgCount == 2) { // Check for "debug" keyword -- show full struct layout - if (StrCmp(*(OffsetsTable + 8), L"debug") == 0) { + if (UnicodeStrCmp(*(OffsetsTable + 8), L"debug") == 0) { Offset = 0; } else { Offset = 0; // determined by category below @@ -236,100 +236,100 @@ // -- Parse category for argc==2 mode -- if (ArgCount == 2) { - if (StrCmp(*(OffsetsTable + 8), L"cpu") == 0) + if (UnicodeStrCmp(*(OffsetsTable + 8), L"cpu") == 0) Offset = 86; // Offset to CpuCount - if (StrCmp(*(OffsetsTable + 8), L"dimm") == 0) + if (UnicodeStrCmp(*(OffsetsTable + 8), L"dimm") == 0) Offset = 257; // Offset to DimmCount - if (StrCmp(*(OffsetsTable + 8), L"pci") == 0) + if (UnicodeStrCmp(*(OffsetsTable + 8), L"pci") == 0) Offset = 2274; // Offset to PciCount - if (StrCmp(*(OffsetsTable + 8), L"hdd") == 0) + if (UnicodeStrCmp(*(OffsetsTable + 8), L"hdd") == 0) Offset = 2351; // Offset to HddCount } // -- Parse category+index for argc==3 mode -- if (ArgCount == 3) { - if (StrCmp(*(OffsetsTable + 8), L"cpu") == 0) { - Index = StrHexToUint64(*(OffsetsTable + 16)); + if (UnicodeStrCmp(*(OffsetsTable + 8), L"cpu") == 0) { + Index = HexStringToUint64(*(OffsetsTable + 16)); Offset = 85 * Index + 87; // CpuInfo[Index] } - if (StrCmp(*(OffsetsTable + 8), L"dimm") == 0) { - Index = StrHexToUint64(*(OffsetsTable + 16)); + if (UnicodeStrCmp(*(OffsetsTable + 8), L"dimm") == 0) { + Index = HexStringToUint64(*(OffsetsTable + 16)); Offset = 84 * Index + 258; // DimmInfo[Index] } - if (StrCmp(*(OffsetsTable + 8), L"pci") == 0) { - Index = StrHexToUint64(*(OffsetsTable + 16)); + if (UnicodeStrCmp(*(OffsetsTable + 8), L"pci") == 0) { + Index = HexStringToUint64(*(OffsetsTable + 16)); Offset = 19 * Index + 2275; // PciInfo[Index] } - if (StrCmp(*(OffsetsTable + 8), L"hdd") == 0) { - Index = StrHexToUint64(*(OffsetsTable + 16)); + if (UnicodeStrCmp(*(OffsetsTable + 8), L"hdd") == 0) { + Index = HexStringToUint64(*(OffsetsTable + 16)); Offset = 75 * Index + 2352; // HddInfo[Index] } } // ---- Dump hex header + 96 bytes of raw data at Offset ---- InventoryPtr = InventoryData; - SPrintf(PrintBuffer, L"-- Offset = %x --\n\r", (UINTN)Offset); + UnicodeSPrintEx(PrintBuffer, L"-- Offset = %x --\n\r", (UINTN)Offset); ConOut_OutputString(PrintBuffer); for (Index = 0; Index < 0x10; Index++) { - SPrintf(PrintBuffer, L"%02X ", Index); + UnicodeSPrintEx(PrintBuffer, L"%02X ", Index); ConOut_OutputString(PrintBuffer); } - SPrintf(PrintBuffer, L"\n\r"); + UnicodeSPrintEx(PrintBuffer, L"\n\r"); ConOut_OutputString(PrintBuffer); DataPtr = &InventoryData[Offset]; for (Index = 0; Index < 0x60; Index++) { if (Index && (Index & 0xF) == 0) { - SPrintf(PrintBuffer, L"\n\r"); + UnicodeSPrintEx(PrintBuffer, L"\n\r"); ConOut_OutputString(PrintBuffer); } - SPrintf(PrintBuffer, L"%02X ", *DataPtr); + UnicodeSPrintEx(PrintBuffer, L"%02X ", *DataPtr); ConOut_OutputString(PrintBuffer); DataPtr++; } - SPrintf(PrintBuffer, L"\n\r"); + UnicodeSPrintEx(PrintBuffer, L"\n\r"); ConOut_OutputString(PrintBuffer); // ==== CPU INFO DUMP ==== - if (ArgCount == 2 && StrCmp(*(OffsetsTable + 8), L"cpu") == 0) { - SPrintf(PrintBuffer, L"CpuCount = %x \n\r", + if (ArgCount == 2 && UnicodeStrCmp(*(OffsetsTable + 8), L"cpu") == 0) { + UnicodeSPrintEx(PrintBuffer, L"CpuCount = %x \n\r", InventoryData[86]); ConOut_OutputString(PrintBuffer); for (InnerIndex = 0; InnerIndex < InventoryData[86]; InnerIndex++) { UINTN InfoOffset = 85 * InnerIndex; - SPrintf(PrintBuffer, + UnicodeSPrintEx(PrintBuffer, L"CpuInfo[%d].SingleCpuInfo.CoreCount = %x \n\r", InnerIndex, InventoryData[InfoOffset + 88]); ConOut_OutputString(PrintBuffer); - SPrintf(PrintBuffer, + UnicodeSPrintEx(PrintBuffer, L"CpuInfo[%d].SingleCpuInfo.ThreadCount = %x \n\r", InnerIndex, InventoryData[InfoOffset + 89]); ConOut_OutputString(PrintBuffer); - SPrintf(PrintBuffer, + UnicodeSPrintEx(PrintBuffer, L"CpuInfo[%d].SingleCpuInfo.CpuVendor = %a \n\r", InnerIndex, &InventoryData[InfoOffset + 90]); ConOut_OutputString(PrintBuffer); - SPrintf(PrintBuffer, + UnicodeSPrintEx(PrintBuffer, L"CpuInfo[%d].SingleCpuInfo.CpuFamilyName = %a \n\r", InnerIndex, &InventoryData[InfoOffset + 103]); ConOut_OutputString(PrintBuffer); - SPrintf(PrintBuffer, + UnicodeSPrintEx(PrintBuffer, L"CpuInfo[%d].SingleCpuInfo.CpuModelIdName = %a \n\r", InnerIndex, &InventoryData[InfoOffset + 133]); ConOut_OutputString(PrintBuffer); - SPrintf(PrintBuffer, + UnicodeSPrintEx(PrintBuffer, L"CpuInfo[%d].SingleCpuInfo.Stepping = %a \n\r", InnerIndex, &InventoryData[InfoOffset + 163]); ConOut_OutputString(PrintBuffer); - SPrintf(PrintBuffer, + UnicodeSPrintEx(PrintBuffer, L"CpuInfo[%d].SingleCpuInfo.MaxFrequency = %x (%d MHz)\n\r", InnerIndex); ConOut_OutputString(PrintBuffer); @@ -349,21 +349,21 @@ FAIL_EXIT: // Check debug flag if (DebugFlag) { - SPrintf(PrintBuffer, L"CheckArg Status Fail \n\r"); + UnicodeSPrintEx(PrintBuffer, L"CheckArg Status Fail \n\r"); ConOut_OutputString(PrintBuffer); } return Status; } // ============================================================================ -// Library function: AsciiStrHexToUint64 (sub_2434) +// Library function: HexStringToUint64 // Address: 0x2434 // Size: 0x137 (311 bytes) // Purpose: Convert hex ASCII string to UINT64 value // ============================================================================ UINT64 EFIAPI -AsciiStrHexToUint64( +HexStringToUint64( CHAR16 *String ) { @@ -373,14 +373,14 @@ } // ============================================================================ -// Library function: StrLen (sub_256C) +// Library function: UnicodeStrLen // Address: 0x256C // Size: 0x56 (86 bytes) // Purpose: Return length of a NULL-terminated Unicode string // ============================================================================ UINTN EFIAPI -StrLen( +UnicodeStrLen( CONST CHAR16 *String ) { @@ -401,14 +401,14 @@ } // ============================================================================ -// Library function: StrSize (sub_22D0) +// Library function: UnicodeStrSize // Address: 0x22D0 // Size: 0x93 (147 bytes) // Purpose: Return size in bytes (including NULL terminator) of a Unicode string // ============================================================================ UINTN EFIAPI -StrSize( +UnicodeStrSize( CONST CHAR16 *String ) { @@ -416,7 +416,7 @@ } // ============================================================================ -// Library function: StrCmp (sub_2364) +// Library function: UnicodeStrCmp // Address: 0x2364 // Size: 0x9E (158 bytes) // Purpose: Compare two NULL-terminated Unicode strings @@ -424,16 +424,16 @@ // ============================================================================ INTN EFIAPI -StrCmp( +UnicodeStrCmp( CONST CHAR16 *FirstString, CONST CHAR16 *SecondString ) { - // Uses StrSize for validation, then character-by-character comparison + // Uses UnicodeStrSize for validation, then character-by-character comparison } // ============================================================================ -// Library function: SPrintf / UnicodeBSPrint (sub_29E0) +// Library function: UnicodeSPrintEx // Address: 0x29E0 // Size: 0x478 (1144 bytes) // Purpose: Formatted print to Unicode buffer (similar to snwprintf) @@ -441,7 +441,7 @@ // ============================================================================ UINTN EFIAPI -SPrintf( +UnicodeSPrintEx( CHAR16 *Buffer, CONST CHAR16 *Format, ... @@ -458,7 +458,7 @@ } // ============================================================================ -// Library function: StatusCodeToString (sub_28F0) +// Library function: StatusCodeToString // Address: 0x28F0 // Size: 0xC7 (199 bytes) // Purpose: Map EFI_STATUS code to human-readable string @@ -479,14 +479,14 @@ } // ============================================================================ -// Library function: GetHobList (sub_26CC) +// Library function: GetHobListFromSystemTable // Address: 0x26CC // Size: 0xD6 (214 bytes) // Purpose: Initialize HOB (Hand-Off Block) list pointer from SystemTable // ============================================================================ VOID* EFIAPI -GetHobList( +GetHobListFromSystemTable( VOID ) { @@ -496,14 +496,14 @@ } // ============================================================================ -// Library function: DebugAssert (sub_268C) +// Library function: InventoryDebugAssert // Address: 0x268C // Size: 0x3E (62 bytes) // Purpose: EDK II DEBUGBREAK assertion handler // ============================================================================ VOID EFIAPI -DebugAssert( +InventoryDebugAssert( IN CONST CHAR8 *FileName, IN UINTN LineNumber, IN CONST CHAR8 *Description @@ -513,7 +513,7 @@ } // ============================================================================ -// Helper function: GetDebugProtocol (sub_25C4) +// Helper function: LocateDebugSupportProtocol // Address: 0x25C4 // Size: 0x7F (127 bytes) // Purpose: Locate and return EFI_DEBUG_SUPPORT_PROTOCOL (or equivalent) @@ -522,14 +522,14 @@ // Cached in qword_4F08 // ============================================================================ -// Helper function: DebugPrint (sub_2644) +// Helper function: InventoryDebugPrintIfEnabled // Address: 0x2644 // Size: 0x47 (71 bytes) // Purpose: Conditionally print debug message via debug protocol // ============================================================================ VOID EFIAPI -DebugPrint( +InventoryDebugPrintIfEnabled( IN UINTN ErrorLevel, IN CONST CHAR8 *Format, ... @@ -543,14 +543,14 @@ } // ============================================================================ -// Library function: HexCharToUint (sub_2404) +// Library function: AsciiHexCharToUint // Address: 0x2404 // Size: 0x2E (46 bytes) // Purpose: Convert a single hex character (0-9, a-f, A-F) to its value // ============================================================================ UINTN EFIAPI -HexCharToUint( +AsciiHexCharToUint( CHAR16 Char ) { @@ -562,35 +562,35 @@ } // ============================================================================ -// Library function: Uint64ToString (sub_27A4) +// Library function: Uint64ToString // Address: 0x27A4 // Size: 0x71 (113 bytes) // Purpose: Convert UINT64 to ASCII string representation (base 10 or 16) // ============================================================================ // ============================================================================ -// Library function: AsciiStrHexToUintn (sub_2818) +// Library function: AsciiStrHexToUintn // Address: 0x2818 // Size: 0xD7 (215 bytes) // Purpose: Parse ASCII hex string to UINTN value // ============================================================================ // ============================================================================ -// Library function: UnicodeValueToString (sub_29B8) +// Library function: UnicodeValueToString // Address: 0x29B8 // Size: 0x26 (38 bytes) // Purpose: Print Unicode string using formatting // ============================================================================ // ============================================================================ -// Library function: UnicodeSPrint (sub_2E58) +// Library function: UnicodeSPrintBounded // Address: 0x2E58 // Size: 0x1D (29 bytes) // Purpose: Safe Unicode formatted print (bounded) // ============================================================================ // ============================================================================ -// Platform function: GetPlatformErrorLevel (sub_2E78) +// Platform function: GetPlatformErrorLevel // Address: 0x2E78 // Size: 0x4E (78 bytes) // Purpose: Read platform error/debug level from CMOS (register 0x4B) @@ -599,15 +599,15 @@ // Also reads hardware register 0xFDAF0490 on certain CMOS values. // ============================================================================ -// Library function: ReadUnaligned64 (sub_2F38) +// Library function: ReadUnaligned64 // Address: 0x2F38 // Size: 0x2F (47 bytes) // Purpose: Read 64-bit value from potentially unaligned address // ============================================================================ // ============================================================================ -// Library function: HobGuidMatch (sub_2EC8) +// Library function: HobGuidMatches // Address: 0x2EC8 // Size: 0x6E (110 bytes) // Purpose: Compare GUID from HOB entry with a target GUID -// ============================================================================ \ No newline at end of file +// ============================================================================ diff --git a/LenovoServerPkg/InventoryApp/InventoryApp.h b/LenovoServerPkg/InventoryApp/InventoryApp.h index eb6d3ce..803ca4d 100644 --- a/LenovoServerPkg/InventoryApp/InventoryApp.h +++ b/LenovoServerPkg/InventoryApp/InventoryApp.h @@ -21,43 +21,43 @@ EFI_STATUS EFIAPI -AsciiStrHexToUint64( +HexStringToUint64( VOID ); EFI_STATUS EFIAPI -StrLen( +UnicodeStrLen( VOID ); EFI_STATUS EFIAPI -StrSize( +UnicodeStrSize( VOID ); EFI_STATUS EFIAPI -SPrintf( +UnicodeSPrintEx( VOID ); EFI_STATUS EFIAPI -DebugAssert( +InventoryDebugAssert( VOID ); EFI_STATUS EFIAPI -DebugPrint( +InventoryDebugPrint( VOID ); EFI_STATUS EFIAPI -HexCharToUint( +AsciiHexCharToUint( VOID ); @@ -623,7 +623,7 @@ EFI_STATUS EFIAPI -function: AsciiStrHexToUint64 (sub_2434)( +function: HexStringToUint64 ( VOID ); @@ -647,7 +647,7 @@ EFI_STATUS EFIAPI -function: StrLen (sub_256C)( +function: UnicodeStrLen ( VOID ); @@ -665,7 +665,7 @@ EFI_STATUS EFIAPI -function: StrSize (sub_22D0)( +function: UnicodeStrSize ( VOID ); @@ -677,19 +677,19 @@ EFI_STATUS EFIAPI -function: StrCmp (sub_2364)( +function: UnicodeStrCmp ( VOID ); EFI_STATUS EFIAPI -StrSize for validation, then character-by-character comparison( +UnicodeStrSize for validation, then character-by-character comparison( VOID ); EFI_STATUS EFIAPI -function: SPrintf / UnicodeBSPrint (sub_29E0)( +function: UnicodeSPrintEx ( VOID ); @@ -701,7 +701,7 @@ EFI_STATUS EFIAPI -function: StatusCodeToString (sub_28F0)( +function: StatusCodeToString ( VOID ); @@ -713,7 +713,7 @@ EFI_STATUS EFIAPI -function: GetHobList (sub_26CC)( +function: GetHobListFromSystemTable ( VOID ); @@ -737,7 +737,7 @@ EFI_STATUS EFIAPI -function: DebugAssert (sub_268C)( +function: InventoryDebugAssert ( VOID ); @@ -749,7 +749,7 @@ EFI_STATUS EFIAPI -function: GetDebugProtocol (sub_25C4)( +function: LocateDebugSupportProtocol ( VOID ); @@ -767,7 +767,7 @@ EFI_STATUS EFIAPI -function: DebugPrint (sub_2644)( +function: InventoryDebugPrintIfEnabled ( VOID ); @@ -779,7 +779,7 @@ EFI_STATUS EFIAPI -function: HexCharToUint (sub_2404)( +function: AsciiHexCharToUint ( VOID ); @@ -791,31 +791,31 @@ EFI_STATUS EFIAPI -function: Uint64ToString (sub_27A4)( +function: Uint64ToString ( VOID ); EFI_STATUS EFIAPI -function: AsciiStrHexToUintn (sub_2818)( +function: AsciiStrHexToUintn ( VOID ); EFI_STATUS EFIAPI -function: UnicodeValueToString (sub_29B8)( +function: UnicodeValueToString ( VOID ); EFI_STATUS EFIAPI -function: UnicodeSPrint (sub_2E58)( +function: UnicodeSPrintBounded ( VOID ); EFI_STATUS EFIAPI -function: GetPlatformErrorLevel (sub_2E78)( +function: GetPlatformErrorLevel ( VOID ); @@ -833,14 +833,14 @@ EFI_STATUS EFIAPI -function: ReadUnaligned64 (sub_2F38)( +function: ReadUnaligned64 ( VOID ); EFI_STATUS EFIAPI -function: HobGuidMatch (sub_2EC8)( +function: HobGuidMatches ( VOID ); -#endif /* __INVENTORYAPP_H__ */ \ No newline at end of file +#endif /* __INVENTORYAPP_H__ */ diff --git a/LenovoServerPkg/POSTStatus/LnvDriverDxe/LnvDriverDxe.c b/LenovoServerPkg/POSTStatus/LnvDriverDxe/LnvDriverDxe.c index 519e8ce..8f0bb2f 100644 --- a/LenovoServerPkg/POSTStatus/LnvDriverDxe/LnvDriverDxe.c +++ b/LenovoServerPkg/POSTStatus/LnvDriverDxe/LnvDriverDxe.c Binary files differ diff --git a/LenovoServerPkg/POSTStatus/LnvDriverDxe/LnvDriverDxe.h b/LenovoServerPkg/POSTStatus/LnvDriverDxe/LnvDriverDxe.h index 9561059..b317f92 100644 --- a/LenovoServerPkg/POSTStatus/LnvDriverDxe/LnvDriverDxe.h +++ b/LenovoServerPkg/POSTStatus/LnvDriverDxe/LnvDriverDxe.h @@ -261,7 +261,7 @@ EFI_STATUS EFIAPI -(sub_3AC)( +LnvDriverDxeInitGlobals( VOID ); @@ -303,7 +303,7 @@ EFI_STATUS EFIAPI -(sub_64C)( +LnvDriverDxeInit( VOID ); @@ -357,25 +357,25 @@ EFI_STATUS EFIAPI -(sub_4AC)( +OnReadyToBoot( VOID ); EFI_STATUS EFIAPI -(sub_518)( +LnvSetupConfigCallback0( VOID ); EFI_STATUS EFIAPI -(sub_584)( +LnvSetupConfigCallback1( VOID ); EFI_STATUS EFIAPI -(sub_60C)( +OnExitBootServices( VOID ); @@ -393,7 +393,7 @@ EFI_STATUS EFIAPI -(sub_810)( +GetProtocolInterface( VOID ); @@ -411,7 +411,7 @@ EFI_STATUS EFIAPI -(sub_890)( +DebugPrint( VOID ); @@ -441,7 +441,7 @@ EFI_STATUS EFIAPI -(sub_8D8)( +DebugAssert( VOID ); @@ -453,7 +453,7 @@ EFI_STATUS EFIAPI -(sub_918)( +GetHobList( VOID ); @@ -495,13 +495,13 @@ EFI_STATUS EFIAPI -(sub_9F0)( +InstallProtocolInterface( VOID ); EFI_STATUS EFIAPI -(sub_A48)( +IntToString( VOID ); @@ -513,7 +513,7 @@ EFI_STATUS EFIAPI -(sub_ABC)( +StrToInt32( VOID ); @@ -555,7 +555,7 @@ EFI_STATUS EFIAPI -(sub_B94)( +StatusToString( VOID ); @@ -597,13 +597,13 @@ EFI_STATUS EFIAPI -(sub_C5C)( +UnicodeSPrint( VOID ); EFI_STATUS EFIAPI -(sub_C84)( +UnicodeVSPrint( VOID ); @@ -771,7 +771,7 @@ EFI_STATUS EFIAPI -(sub_111C)( +DsBootCurrentName( VOID ); @@ -843,7 +843,7 @@ EFI_STATUS EFIAPI -(sub_1348)( +DebugLogPrint( VOID ); @@ -909,25 +909,25 @@ EFI_STATUS EFIAPI -(sub_1498)( +IpmiTransportInit( VOID ); EFI_STATUS EFIAPI -(sub_14F8)( +IpmiTransportLocate( VOID ); EFI_STATUS EFIAPI -(sub_1580)( +IpmiSendCommand( VOID ); EFI_STATUS EFIAPI -(sub_1580 helper)( +IpmiTransportSendCommand helper( VOID ); @@ -945,7 +945,7 @@ EFI_STATUS EFIAPI -(sub_15B8)( +GetDebugLevel( VOID ); @@ -981,61 +981,61 @@ EFI_STATUS EFIAPI -(sub_1608)( +StrLen( VOID ); EFI_STATUS EFIAPI -(sub_169C)( +ReadUnaligned16( VOID ); EFI_STATUS EFIAPI -(sub_16CC)( +ReadUnaligned64( VOID ); EFI_STATUS EFIAPI -(sub_16FC)( +StrnLenS( VOID ); EFI_STATUS EFIAPI -(sub_1754)( +AsciiStrLen( VOID ); EFI_STATUS EFIAPI -(sub_1778)( +CompareGuid( VOID ); EFI_STATUS EFIAPI -(sub_17E8)( +AsciiSPrintWithTimestamp( VOID ); EFI_STATUS EFIAPI -(sub_1810)( +SetMem16( VOID ); EFI_STATUS EFIAPI -(sub_1844)( +UInt64ToStringReverse( VOID ); EFI_STATUS EFIAPI -(sub_18BC)( +AsciiVSPrint( VOID ); @@ -1065,13 +1065,13 @@ EFI_STATUS EFIAPI -(sub_26C4)( +AsciiSPrint( VOID ); EFI_STATUS EFIAPI -(sub_2740)( +SetMem( VOID ); @@ -1113,7 +1113,7 @@ EFI_STATUS EFIAPI -(sub_27A0)( +CopyMem( VOID ); @@ -1177,4 +1177,4 @@ VOID ); -#endif /* __LNVDRIVERDXE_H__ */ \ No newline at end of file +#endif /* __LNVDRIVERDXE_H__ */ diff --git a/LenovoServerPkg/POSTStatus/LnvOobDriverDxe/LnvOobDriverDxe.c b/LenovoServerPkg/POSTStatus/LnvOobDriverDxe/LnvOobDriverDxe.c index 2b5d707..e3abb83 100644 --- a/LenovoServerPkg/POSTStatus/LnvOobDriverDxe/LnvOobDriverDxe.c +++ b/LenovoServerPkg/POSTStatus/LnvOobDriverDxe/LnvOobDriverDxe.c @@ -72,7 +72,7 @@ __int64 LnvOOBSettingsDxeEntry(__int64 Param); __int64 LnvGetProductID(__int64 a1, __int64 a2, __int64 a3, __int64 a4); __int64 LnvUpdateOOBSettingsttoSetup(VOID); -__int64 sub_2240(VOID); +__int64 IpmiTransportProtocolNotify(VOID); __int64 GetHobList(__int64 Param); /* =================================================================== @@ -80,7 +80,7 @@ * =================================================================== */ /** - *sub_20B0: ASSERT wrapper - calls gDebugPrintProtocol->AssertBreak + *AssertBreak: ASSERT wrapper - calls gDebugPrintProtocol->AssertBreak */ __int64 AssertBreak(__int64 a1, __int64 a2, __int64 a3) { @@ -93,7 +93,7 @@ } /** - *sub_20F0: Get HOB list pointer from SystemTable. + *GetHobList: Get HOB list pointer from SystemTable. *Walks the configuration table to find the HOB list GUID match. */ __int64 GetHobList(__int64 a1) @@ -139,10 +139,10 @@ } /** - *sub_2240: IPMI protocol notification callback. + *IpmiTransportProtocolNotify: IPMI protocol notification callback. *Locates gEfiDxeIpmiTransportProtocolGuid, asserts on failure. */ -__int64 sub_2240() +__int64 IpmiTransportProtocolNotify() { __int64 Status; __int64 Result; @@ -166,7 +166,7 @@ * =================================================================== */ /** - *sub_1FA8: Locate gDebugPrintProtocol singleton. + *GetDebugPrintProtocol: Locate gDebugPrintProtocol singleton. *Allocates boot services pool, checks GbE presence via CPUID, *then locates protocol. */ @@ -201,7 +201,7 @@ } /** - *sub_2028: DEBUG print function. + *DebugPrint: DEBUG print function. *Reads CMOS 0x4B to determine debug level, calls protocol print if level matches. */ UINT8 DebugPrint(__int64 ErrorLevel, const char *Format, ...) @@ -245,16 +245,16 @@ } /* =================================================================== - *Library constructor (sub_384) + *Library constructor * =================================================================== */ /** - *sub_384: UEFI library constructor. + *LnvOobDriverDxeConstructor: UEFI library constructor. *Saves ImageHandle, SystemTable, BootServices, RuntimeServices. *Locates HII protocols (HiiDatabase, HiiString, HiiConfigRouting, *HiiFont, HiiImage), and IPMI protocol with notification. */ -__int64 sub_384(__int64 ImageHandle, EFI_SYSTEM_TABLE *SystemTable) +__int64 LnvOobDriverDxeConstructor(__int64 ImageHandle, EFI_SYSTEM_TABLE *SystemTable) { __int64 Status; __int64 Status; @@ -311,7 +311,7 @@ if ( result < 0 ) { result = (*(__int64 ( **)(void *, __int64 ( *)(), UINT8 *))(gBootServices + 168))( - &gIpmiProtocolGuid, sub_2240, &v7); + &gIpmiProtocolGuid, IpmiTransportProtocolNotify, &v7); if ( result < 0 ) return DebugPrint(-1, "DxeLnvSendIpmiCmdLibConstructor Status = %r \n", result); } @@ -323,11 +323,11 @@ * =================================================================== */ /** - *sub_5A4: Store a data entry in the global OOB data array. + *StoreOobEntry: Store a data entry in the global OOB data array. *Finds first free slot (byte_11B80[x] == 0), copies 128 bytes of data *and 16 bytes of name, marks slot as used. */ -UINT64 sub_5A4(__int64 a1, __int64 a2) +UINT64 StoreOobEntry(__int64 a1, __int64 a2) { UINT16 Index; __int64 Index; @@ -350,7 +350,7 @@ } /** - *OOBGetDataStoreByType (sub_654): + *OOBGetDataStoreByType: *Sends IPMI command to retrieve a specific SubType within a Type. *If SubType is 0xFF, returns EFI_INVALID_PARAMETER (use GetAll instead). *Returns 2 bytes of data. @@ -428,7 +428,7 @@ } /** - *OOBGetAllDataStoreByType (sub_7D8): + *OOBGetAllDataStoreByType: *Sends IPMI command to retrieve all data store entries for a Type. *Returns up to 128 bytes of data. */ @@ -491,7 +491,7 @@ } /** - *OOBGetDataStoreMap (sub_930): + *OOBGetDataStoreMap: *Sends IPMI command to retrieve the data store valid bitmap (gDsValidMap). */ __int64 OOBGetDataStoreMap(__int64 a1) @@ -532,7 +532,7 @@ } /** - *OOBSetDataStoreByType (sub_A18): + *OOBSetDataStoreByType: *Sends IPMI command to write a data store entry. *Request: [Valid, Type, SubType, Reserved, Data] (5 bytes) */ @@ -600,7 +600,7 @@ * =================================================================== */ /** - *BmcDsBitMapToDsVar (sub_B8C): + *BmcDsBitMapToDsVar: *Reads all BIOS NVRAM variables (referenced by OOB map table), *processes the data into gDsVar[] with bit manipulation. *Marks gDsValidMap as 0xAA000000 on success. @@ -701,7 +701,7 @@ } /** - *DsVarToBmcDs (sub_DBC): + *DsVarToBmcDs: *Iterates all 32 data store types, copies gDsVar[] data, *and sends each type to the BMC via OOBSetAllDataStoreByType. */ @@ -803,17 +803,17 @@ } /* =================================================================== - *Sync Engine (sub_FE4) + *Sync Engine * =================================================================== */ /** - *BmcDsBitMapToDsVarSync (sub_FE4): + *BmcDsBitMapToDsVarSync: *Main synchronization engine. Given a sync type: *SYNC_FROM_DS (1) - Copy BMC data store -> gDsVar[] *SYNC_WITH_DS (2) - Merge BMC data store with existing gDsVar[] * *Iterates through all 32 types. For each valid type in gDsValidMap, - *fetches all entries from BMC, stores them via sub_5A4, and updates + *fetches all entries from BMC, stores them via StoreOobEntry, and updates *gDsVar with the interleaved byte layout. */ UINT64 BmcDsBitMapToDsVarSync(UINT8 SyncType, __int64 a2) @@ -960,10 +960,10 @@ while ( n14 ); /*Store the data entry */ - Status = sub_5A4((__int64)&gOobMapTable[n0x20], (__int64)p_n0x20 + 1); + Status = StoreOobEntry((__int64)&gOobMapTable[n0x20], (__int64)p_n0x20 + 1); if ( Status < 0 ) { - DebugPrint(64, " %a , sub_5A4 store fail, Type = %x Status = %r \n", n0x20, Status); + DebugPrint(64, " %a , StoreOobEntry store fail, Type = %x Status = %r \n", n0x20, Status); } else { @@ -991,7 +991,7 @@ { UINT8 v79_data = 1; /*Process socket power management variables */ - /* ... (detailed variable update logic from sub_FE4 body) */ + /* ... (detailed variable update logic from the original body) */ Result = 0; return Result; @@ -1003,7 +1003,7 @@ * =================================================================== */ /** - *CheckOobDataStoreValid (sub_1578): + *CheckOobDataStoreValid: *Reads Type=0, SubType=0x7E and SubType=0x7F. *Valid if 0x7E returns 0x17 and 0x7F returns 0xAA. */ @@ -1032,7 +1032,7 @@ } /* =================================================================== - *Product ID Detection (sub_19A4) + *Product ID Detection * =================================================================== */ /** @@ -1177,7 +1177,7 @@ } /* =================================================================== - *OOB Settings -> Setup Update (sub_1C74) + *OOB Settings -> Setup Update * =================================================================== */ /** @@ -1359,11 +1359,11 @@ } /* =================================================================== - *Main Entry Point (sub_15FC) + *Main Entry Point * =================================================================== */ /** - *LnvOOBSettingsDxeEntry (sub_15FC): + *LnvOOBSettingsDxeEntry: *Main driver routine. This function: *1. Validates the OOB map table embedded in the driver *2. Locates the IPMI transport protocol @@ -1575,15 +1575,14 @@ /** *ModuleEntryPoint: UEFI DXE driver entry. - *Calls library constructor (sub_384 -> saves globals, locates HII/IPMI) - *then calls LnvOOBSettingsDxeEntry (sub_15FC -> main logic). + *Calls library constructor, then calls LnvOOBSettingsDxeEntry. */ EFI_STATUS EFIAPI ModuleEntryPoint( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) { - sub_384(ImageHandle, SystemTable); + LnvOobDriverDxeConstructor(ImageHandle, SystemTable); return (EFI_STATUS)LnvOOBSettingsDxeEntry(0); } @@ -1592,7 +1591,7 @@ * =================================================================== */ /** - *sub_21C8: Memory compare function (BaseLib-style). + *MemoryCompare: Memory compare function (BaseLib-style). *Compares two memory regions byte-by-byte. */ __int64 MemoryCompare(UINT64 a1, UINT8 *a2, UINT64 Length) @@ -1640,7 +1639,7 @@ } /** - *sub_22A0: Read unaligned UINT64 with buffer check. + *ReadUnaligned64: Read unaligned UINT64 with buffer check. */ __int64 ReadUnaligned64(__int64 Buffer) { @@ -1650,7 +1649,7 @@ } /** - *sub_22D0: Compare HOB GUID. + *CompareHobGuid: Compare HOB GUID. */ BOOLEAN CompareHobGuid(__int64 a1, __int64 a2) { @@ -1662,7 +1661,7 @@ } /** - *sub_2340: CPUID wrapper function. + *Cpuid: CPUID wrapper function. */ __int64 Cpuid(UINT32 Leaf, UINT32 *Eax, UINT32 *Ebx, UINT32 *Ecx, UINT32 *Edx) { @@ -1681,7 +1680,7 @@ } /** - *sub_2380: Internal memset - sets bytes of an int array. + *InternalSetMem: Internal memset - sets bytes of an int array. *Processes by individual byte value expansion. */ INT32 *InternalSetMem(INT32 *Buffer, INT32 Value, UINT64 Length) @@ -1718,7 +1717,7 @@ } /** - *sub_23E0: memmove implementation - overlap-safe copy. + *InternalCopyMem: memmove implementation - overlap-safe copy. */ char *InternalCopyMem(char *Destination, const char *Source, UINT64 Length) { @@ -1769,4 +1768,4 @@ } return Destination; -} \ No newline at end of file +} diff --git a/LenovoServerPkg/POSTStatus/LnvOobDriverDxe/LnvOobDriverDxe.h b/LenovoServerPkg/POSTStatus/LnvOobDriverDxe/LnvOobDriverDxe.h index 3bebedd..99c785e 100644 --- a/LenovoServerPkg/POSTStatus/LnvOobDriverDxe/LnvOobDriverDxe.h +++ b/LenovoServerPkg/POSTStatus/LnvOobDriverDxe/LnvOobDriverDxe.h @@ -141,7 +141,7 @@ * notification callback. */ __int64 -sub_384( +LnvOobDriverDxeConstructor( __int64 ImageHandle, EFI_SYSTEM_TABLE *SystemTable ); @@ -155,7 +155,7 @@ * @return EFI_STATUS */ UINT64 -sub_5A4( +StoreOobEntry( __int64 Data, __int64 Name ); @@ -303,7 +303,7 @@ * IPMI protocol notification callback: locate IPMI protocol. */ __int64 -sub_2240( +IpmiTransportProtocolNotify( VOID ); @@ -402,4 +402,4 @@ VOID ); -#endif /* __LNVOOBDRIVERDXE_H__ */ \ No newline at end of file +#endif /* __LNVOOBDRIVERDXE_H__ */ diff --git a/LenovoServerPkg/SetupDefaults/SetupDefaultLoad/SetupDefaultLoad.c b/LenovoServerPkg/SetupDefaults/SetupDefaultLoad/SetupDefaultLoad.c index 765e040..ad058f0 100644 --- a/LenovoServerPkg/SetupDefaults/SetupDefaultLoad/SetupDefaultLoad.c +++ b/LenovoServerPkg/SetupDefaults/SetupDefaultLoad/SetupDefaultLoad.c @@ -85,8 +85,8 @@ */ EFI_STATUS ModuleEntryPoint(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) { - __int64 n2; // rcx SetupDefaultLoadDriverEntry((__int64)ImageHandle, SystemTable); /*0x3e9*/ - return SetupDefaultLoadMain(n2, SystemTable); /*0x3f6*/ + SetupDefaultLoadDriverEntry((__int64)ImageHandle, SystemTable); /*0x3e9*/ + return SetupDefaultLoadMain((__int64)ImageHandle, SystemTable); /*0x3f6*/ } /* @@ -873,7 +873,7 @@ { if ( n256 - 1 > -1 - (__int64)p_n2 ) /*0x54ae*/ VPrintWrapper( /*0x54c3*/ - (__int64)"e:\\hs\\MdePkg\\Library\\BaseMemoryLibRepStr\\SetMemWrapper.c", + (__int64)"SetupDefaultLoad.c", 54, (__int64)"(Length - 1) <= (0xFFFFFFFFFFFFFFFFULL - (UINTN)Buffer)"); return SetMem(p_n2, n256, 0); /*0x54d6*/ @@ -1424,12 +1424,12 @@ Size = count - 1; /*0x5ee2*/ if ( count - 1 > -1 - (__int64)dst ) /*0x5ee9*/ VPrintWrapper( /*0x5efe*/ - (__int64)"e:\\hs\\MdePkg\\Library\\BaseMemoryLibRepStr\\CopyMemWrapper.c", + (__int64)"SetupDefaultLoad.c", 56, (__int64)"(Length - 1) <= (0xFFFFFFFFFFFFFFFFULL - (UINTN)DestinationBuffer)"); if ( Size > ~(unsigned __int64)src ) /*0x5f0c*/ VPrintWrapper( /*0x5f21*/ - (__int64)"e:\\hs\\MdePkg\\Library\\BaseMemoryLibRepStr\\CopyMemWrapper.c", + (__int64)"SetupDefaultLoad.c", 57, (__int64)"(Length - 1) <= (0xFFFFFFFFFFFFFFFFULL - (UINTN)SourceBuffer)"); if ( dst == src ) /*0x5f29*/ diff --git a/LenovoServerPkg/SetupDefaults/SetupDefaultLoad/SetupDefaultLoadBmc.c b/LenovoServerPkg/SetupDefaults/SetupDefaultLoad/SetupDefaultLoadBmc.c index 2e3df47..fac02da 100644 --- a/LenovoServerPkg/SetupDefaults/SetupDefaultLoad/SetupDefaultLoadBmc.c +++ b/LenovoServerPkg/SetupDefaults/SetupDefaultLoad/SetupDefaultLoadBmc.c @@ -1,13 +1,13 @@ char __fastcall SendBmcCommand(__int64 a1, __int64 a2, __int64 a3, __int64 a4) { - __int64 v4; // rax - __int64 v6; // rax - char v7; // cl - char n3; // [rsp+50h] [rbp+8h] BYREF - char v9; // [rsp+58h] [rbp+10h] BYREF - char n2; // [rsp+60h] [rbp+18h] BYREF + __int64 transport; // rax + __int64 status; // rax + char response_code; // cl + char request_tag; // [rsp+50h] [rbp+8h] BYREF + char response_tag; // [rsp+58h] [rbp+10h] BYREF + char request_len; // [rsp+60h] [rbp+18h] BYREF - v4 = qword_7920; /*0x7d0*/ + transport = qword_7920; /*0x7d0*/ if ( !qword_7920 ) /*0x7da*/ { if ( (*(__int64 (__fastcall **)(void *, _QWORD, __int64 *))(qword_79B8 + 320))(&unk_7450, 0, &qword_7920) < 0 ) /*0x7fc*/ @@ -15,25 +15,25 @@ qword_7920 = 0; /*0x7fe*/ return 85; /*0x80b*/ } - v4 = qword_7920; /*0x80d*/ + transport = qword_7920; /*0x80d*/ } - n2 = 2; /*0x819*/ + request_len = 2; /*0x819*/ LOBYTE(a4) = 69; /*0x823*/ - n3 = 3; /*0x82b*/ + request_tag = 3; /*0x82b*/ LOBYTE(a2) = 46; /*0x847*/ - v6 = (*(__int64 (__fastcall **)(__int64, __int64, _QWORD, __int64, char *, char, char *, char *))(v4 + 16))( /*0x84c*/ - v4, + status = (*(__int64 (__fastcall **)(__int64, __int64, _QWORD, __int64, char *, char, char *, char *))(transport + 16))( /*0x84c*/ + transport, a2, 0, a4, - &n2, + &request_len, 1, - &v9, - &n3); - v7 = v9; /*0x84f*/ - if ( v6 < 0 ) /*0x85c*/ + &response_tag, + &request_tag); + response_code = response_tag; /*0x84f*/ + if ( status < 0 ) /*0x85c*/ return 85; /*0x85c*/ - return v7; /*0x861*/ + return response_code; /*0x861*/ } __int64 __fastcall SendBmcByteCommand(char a1, _BYTE *a2, __int64 a3, __int64 a4) diff --git a/LenovoServerPkg/SetupDefaults/SetupDefaultLoad/SetupDefaultLoadEntry.c b/LenovoServerPkg/SetupDefaults/SetupDefaultLoad/SetupDefaultLoadEntry.c index 2f7aa91..6dd636b 100644 --- a/LenovoServerPkg/SetupDefaults/SetupDefaultLoad/SetupDefaultLoadEntry.c +++ b/LenovoServerPkg/SetupDefaults/SetupDefaultLoad/SetupDefaultLoadEntry.c @@ -2156,7 +2156,7 @@ } qword_7920 = 0; /*0x4e2f*/ LABEL_348: - sub_121C(v276); /*0x4ec1*/ + ReleaseVmdNvmeCommandBuffer(v276); /*0x4ec1*/ UpdateVmdNvmeConfig(nn); /*0x4ecf*/ v54 = 1; /*0x4ed4*/ } diff --git a/LenovoServerPkg/SetupDefaults/SetupDefaultLoad/SetupDefaultLoadGpio.c b/LenovoServerPkg/SetupDefaults/SetupDefaultLoad/SetupDefaultLoadGpio.c index c2e4b29..1c4b8d9 100644 --- a/LenovoServerPkg/SetupDefaults/SetupDefaultLoad/SetupDefaultLoadGpio.c +++ b/LenovoServerPkg/SetupDefaults/SetupDefaultLoad/SetupDefaultLoadGpio.c @@ -1,42 +1,42 @@ unsigned __int64 __fastcall GetGpioPadOwnership(unsigned int a1, __int64 a2, __int64 a3, char a4, int *a5) { - unsigned int v5; // ebx - unsigned __int64 v7; // rdi - __int64 v9; // rsi - _QWORD v10[5]; // [rsp+20h] [rbp-28h] BYREF - int v11; // [rsp+68h] [rbp+20h] BYREF + unsigned int pad; // ebx + unsigned __int64 group; // rdi + __int64 gpio_table; // rsi + _QWORD gpio_group_count[5]; // [rsp+20h] [rbp-28h] BYREF + int ownership; // [rsp+68h] [rbp+20h] BYREF - LOBYTE(v11) = a4; /*0x5a32*/ - v5 = (unsigned __int16)a1; /*0x5a41*/ - v7 = BYTE2(a1); /*0x5a4a*/ + LOBYTE(ownership) = a4; /*0x5a32*/ + pad = (unsigned __int16)a1; /*0x5a41*/ + group = BYTE2(a1); /*0x5a4a*/ if ( !IsSupportedPchSku(a1) ) { DebugPrint( 0x80000000LL, "GPIO ERROR: Incorrect GpioPad define used on this chipset (Group=%d, Pad=%d)!\n", - (unsigned int)v7, - v5); + (unsigned int)group, + pad); return 0x8000000000000003uLL; /*0x5a77*/ } - v9 = GetGpioInfoTable(v10); /*0x5a86*/ - if ( v7 >= v10[0] ) + gpio_table = GetGpioInfoTable(gpio_group_count); /*0x5a86*/ + if ( group >= gpio_group_count[0] ) { - DebugPrint(0x80000000LL, "GPIO ERROR: Group argument (%d) exceeds GPIO group range\n", (unsigned int)v7); + DebugPrint(0x80000000LL, "GPIO ERROR: Group argument (%d) exceeds GPIO group range\n", (unsigned int)group); return 0x8000000000000002uLL; /*0x5ab1*/ } - if ( v5 >= *(_DWORD *)(v9 + 60 * v7 + 56) ) + if ( pad >= *(_DWORD *)(gpio_table + 60 * group + 56) ) { - DebugPrint(0x80000000LL, "GPIO ERROR: Pin number (%d) exceeds possible range for this group\n", v5); + DebugPrint(0x80000000LL, "GPIO ERROR: Pin number (%d) exceeds possible range for this group\n", pad); return 0x8000000000000002uLL; /*0x5ac7*/ } - GetGpioPadConfigWord(a1, &v11); /*0x5ad1*/ - if ( v11 ) + GetGpioPadConfigWord(a1, &ownership); /*0x5ad1*/ + if ( ownership ) { - DebugPrint(0x80000000LL, "GPIO ERROR: Accessing pad not owned by host (Group=%d, Pad=%d)!\n", (unsigned int)v7, v5); + DebugPrint(0x80000000LL, "GPIO ERROR: Accessing pad not owned by host (Group=%d, Pad=%d)!\n", (unsigned int)group, pad); return 0x8000000000000003uLL; /*0x5ae4*/ } - *a5 = *(_DWORD *)((unsigned __int16)(*(_DWORD *)(v9 + 60 * v7 + 52) + 8 * v5) - | ((*(unsigned __int8 *)(v9 + 60 * v7) | 0xFD00LL) << 16)) + *a5 = *(_DWORD *)((unsigned __int16)(*(_DWORD *)(gpio_table + 60 * group + 52) + 8 * pad) + | ((*(unsigned __int8 *)(gpio_table + 60 * group) | 0xFD00LL) << 16)) & 2; return 0; /*0x5b1d*/ } diff --git a/LenovoServerPkg/SetupDefaults/SetupDefaultLoad/SetupDefaultLoadHelpers.c b/LenovoServerPkg/SetupDefaults/SetupDefaultLoad/SetupDefaultLoadHelpers.c index 81b956a..96e24f4 100644 --- a/LenovoServerPkg/SetupDefaults/SetupDefaultLoad/SetupDefaultLoadHelpers.c +++ b/LenovoServerPkg/SetupDefaults/SetupDefaultLoad/SetupDefaultLoadHelpers.c @@ -1,7 +1,7 @@ -void *SetMem(void *buf, unsigned __int64 count, char value) +void *SetMem(void *buffer, unsigned __int64 count, char value) { - memset(buf, value, count); /*0x2aa*/ - return buf; /*0x2af*/ + memset(buffer, value, count); /*0x2aa*/ + return buffer; /*0x2af*/ } void CpuPause() @@ -29,30 +29,30 @@ return __getcallerseflags(); /*0x342*/ } -char *__fastcall CopyMem(char *dst, char *src, unsigned __int64 count) +char *__fastcall CopyMem(char *destination, char *source, unsigned __int64 count) { - char *dst_2; // rax - unsigned __int64 count_1; // rcx - char *dst_1; // rdi - char *src_1; // rsi + char *result; // rax + unsigned __int64 block_count; // rcx + char *copy_destination; // rdi + char *copy_source; // rsi - dst_2 = dst; /*0x360*/ - if ( src < dst && &src[count - 1] >= dst ) /*0x368*/ + result = destination; /*0x360*/ + if ( source < destination && &source[count - 1] >= destination ) /*0x368*/ { - src_1 = &src[count - 1]; /*0x380*/ - dst_1 = &dst[count - 1]; /*0x383*/ + copy_source = &source[count - 1]; /*0x380*/ + copy_destination = &destination[count - 1]; /*0x383*/ } else { - count_1 = count; /*0x36a*/ + block_count = count; /*0x36a*/ count &= 7u; /*0x36d*/ - count_1 >>= 3; /*0x374*/ - qmemcpy(dst, src, 8 * count_1); /*0x378*/ - src_1 = &src[8 * count_1]; /*0x378*/ - dst_1 = &dst[8 * count_1]; /*0x378*/ + block_count >>= 3; /*0x374*/ + qmemcpy(destination, source, 8 * block_count); /*0x378*/ + copy_source = &source[8 * block_count]; /*0x378*/ + copy_destination = &destination[8 * block_count]; /*0x378*/ } - qmemcpy(dst_1, src_1, count); /*0x38c*/ - return dst_2; /*0x38f*/ + qmemcpy(copy_destination, copy_source, count); /*0x38c*/ + return result; /*0x38f*/ } __int64 GetDebugPrintProtocol() @@ -115,7 +115,7 @@ { if ( n256 - 1 > -1 - (__int64)p_n2 ) /*0x54ae*/ DebugAssert( /*0x54c3*/ - (__int64)"e:\\hs\\MdePkg\\Library\\BaseMemoryLibRepStr\\SetMemWrapper.c", + (__int64)"SetupDefaultLoadHelpers.c", 54, (__int64)"(Length - 1) <= (0xFFFFFFFFFFFFFFFFULL - (UINTN)Buffer)"); return SetMem(p_n2, n256, 0); /*0x54d6*/ @@ -296,12 +296,12 @@ v6 = count - 1; /*0x5ee2*/ if ( count - 1 > -1 - (__int64)dst ) /*0x5ee9*/ DebugAssert( /*0x5efe*/ - (__int64)"e:\\hs\\MdePkg\\Library\\BaseMemoryLibRepStr\\CopyMemWrapper.c", + (__int64)"SetupDefaultLoadHelpers.c", 56, (__int64)"(Length - 1) <= (0xFFFFFFFFFFFFFFFFULL - (UINTN)DestinationBuffer)"); if ( v6 > ~(unsigned __int64)src ) /*0x5f0c*/ DebugAssert( /*0x5f21*/ - (__int64)"e:\\hs\\MdePkg\\Library\\BaseMemoryLibRepStr\\CopyMemWrapper.c", + (__int64)"SetupDefaultLoadHelpers.c", 57, (__int64)"(Length - 1) <= (0xFFFFFFFFFFFFFFFFULL - (UINTN)SourceBuffer)"); if ( dst == src ) /*0x5f29*/ diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/BasePrintLibInternalFormat.c b/LenovoServerPkg/SystemInventory/SystemInventory/BasePrintLibInternalFormat.c index 3289c5d..bb25eae 100644 --- a/LenovoServerPkg/SystemInventory/SystemInventory/BasePrintLibInternalFormat.c +++ b/LenovoServerPkg/SystemInventory/SystemInventory/BasePrintLibInternalFormat.c @@ -159,13 +159,13 @@ } if ( (v6 & 0x100) != 0 ) /*0xf5e*/ { - if ( (unsigned __int64)sub_C9C(v5, 1000001, a3, 1000000) > 0xF4240 ) /*0xf80*/ + if ( (unsigned __int64)UnicodeStrnLenS(v5, 1000001, a3, 1000000) > 0xF4240 ) /*0xf80*/ DebugAssert( /*0xf91*/ "e:\\hs\\MdePkg\\Library\\BasePrintLib\\PrintLibInternal.c", 611, "(StrnLenS ((CHAR16 *)Format, (_gPcd_FixedAtBuild_PcdMaximumUnicodeStringLength) + 1) <= (_gPcd_FixedAtBuild_PcdM" "aximumUnicodeStringLength))"); - if ( (unsigned __int64)sub_C9C(v5, 1000001, v11, n1000000) > 0xF4240 ) /*0xfaf*/ + if ( (unsigned __int64)UnicodeStrnLenS(v5, 1000001, v11, n1000000) > 0xF4240 ) /*0xfaf*/ return 0; /*0xfaf*/ n2_1 = 2; /*0xfba*/ n0xFFFF = 0xFFFF; /*0xfc0*/ @@ -348,7 +348,7 @@ _r_n_1 = ""; /*0x156a*/ goto LABEL_90; /*0x1571*/ } - sub_1CD0( /*0x15b6*/ + BasePrintAppendFormatted( /*0x15b6*/ _r_n, 38, 0, @@ -382,7 +382,7 @@ if ( _r_n_1 != _r_n ) /*0x1689*/ goto LABEL_90; /*0x1689*/ } - sub_1CD0(_r_n, 38, 0, "%08X", (_DWORD)n5); /*0x16a6*/ + BasePrintAppendFormatted(_r_n, 38, 0, "%08X", (_DWORD)n5); /*0x16a6*/ goto LABEL_118; /*0x16ab*/ } LOWORD(v6) = v6 & 0xFFC9 | 0x10; /*0x16b4*/ @@ -428,7 +428,7 @@ n43_1 = 45; /*0x176e*/ v54 = -v54; /*0x1772*/ LABEL_151: - v24 = sub_D94(_r_n, v54, n16) - (_QWORD)_r_n; /*0x17a5*/ + v24 = BasePrintMeasureTokenWidth(_r_n, v54, n16) - (_QWORD)_r_n; /*0x17a5*/ v91 = v24; /*0x17bb*/ if ( !v54 ) /*0x17c2*/ { @@ -473,10 +473,10 @@ a5 = v28 + 1; /*0x1431*/ if ( *v28 ) /*0x142a*/ { - v45 = sub_2B6C(v44, v5, v5); /*0x1466*/ - v46 = (unsigned __int16)sub_2B34(v44 + 4); /*0x1472*/ - v47 = sub_2B34(v44 + 6); /*0x1476*/ - sub_1CD0( /*0x14e6*/ + v45 = BasePrintAppendRawString(v44, v5, v5); /*0x1466*/ + v46 = (unsigned __int16)BasePrintReadUnicode16(v44 + 4); /*0x1472*/ + v47 = BasePrintReadUnicode16(v44 + 6); /*0x1476*/ + BasePrintAppendFormatted( /*0x14e6*/ _r_n, 38, 0, @@ -599,7 +599,7 @@ v62 = v89; /*0x1955*/ if ( v8 ) /*0x195c*/ { - v63 = sub_D60(v8, v89, (int)v96 - (int)v26, 32, n2); /*0x196c*/ + v63 = BasePrintAdvanceOutput(v8, v89, (int)v96 - (int)v26, 32, n2); /*0x196c*/ v24 = v91; /*0x1971*/ v8 = v63; /*0x1975*/ } @@ -633,7 +633,7 @@ v87 = n2 * (v26 - v24) + v64; /*0x19f9*/ v69 = v6 & 0x2000; /*0x19fd*/ if ( (v6 & 0x2000) == 0 && v8 ) /*0x1a08*/ - v8 = sub_D60(v8, v65, v68, (int)v69 + 48, n2); /*0x1a1e*/ + v8 = BasePrintAdvanceOutput(v8, v65, v68, (int)v69 + 48, n2); /*0x1a1e*/ goto LABEL_199; /*0x1a1e*/ } n2_3 = n2; /*0x1b6a*/ @@ -643,7 +643,7 @@ v69 = v6 & 0x2000; /*0x1b85*/ if ( (v6 & 0x2000) == 0 && v8 ) /*0x1b90*/ { - v81 = sub_D60(v8, v62, v79, (int)v69 + 32, n2); /*0x1b9e*/ + v81 = BasePrintAdvanceOutput(v8, v62, v79, (int)v69 + 32, n2); /*0x1b9e*/ v80 = v87; /*0x1ba3*/ v8 = v81; /*0x1ba7*/ } @@ -732,7 +732,7 @@ v18 = v89; /*0x1b38*/ if ( v8 ) /*0x1b3f*/ { - v78 = sub_D60(v8, v89, (int)v96 - (int)v94, 32, n2_3); /*0x1b59*/ + v78 = BasePrintAdvanceOutput(v8, v89, (int)v96 - (int)v94, 32, n2_3); /*0x1b59*/ v19 = v87; /*0x1b5e*/ v8 = v78; /*0x1b62*/ } diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/InitializeStorageInventory.c b/LenovoServerPkg/SystemInventory/SystemInventory/InitializeStorageInventory.c index fc3d344..ebbb63d 100644 --- a/LenovoServerPkg/SystemInventory/SystemInventory/InitializeStorageInventory.c +++ b/LenovoServerPkg/SystemInventory/SystemInventory/InitializeStorageInventory.c @@ -70,20 +70,20 @@ *(_QWORD *)(v35 + 8 * i_1), &unk_9470, &j_3); - if ( (unsigned __int8)DebugAssertEnabled() && v3 < 0 ) /*0x40ae*/ - { - if ( (unsigned __int8)DebugTraceEnabled() && (unsigned __int8)DebugLevelEnabled(0x80000000LL) ) /*0x40bc*/ - DebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v3); /*0x40d2*/ - DebugAssert("e:\\hs\\LenovoServerPkg\\SystemInventory\\SystemInventory.c", 1393, "!EFI_ERROR (Status)"); /*0x40ea*/ - } + if ( (unsigned __int8)DebugAssertEnabled() && v3 < 0 ) /*0x40ae*/ + { + if ( (unsigned __int8)SystemInventoryDebugTraceEnabled() && (unsigned __int8)SystemInventoryDebugLevelEnabled(0x80000000LL) ) /*0x40bc*/ + SystemInventoryDebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v3); /*0x40d2*/ + DebugAssert("e:\\hs\\LenovoServerPkg\\SystemInventory\\SystemInventory.c", 1393, "!EFI_ERROR (Status)"); /*0x40ea*/ + } j_1 = j_3; /*0x40fa*/ if ( (*(__int64 (__fastcall **)(void *, __int64 *, __int64 *))(qword_96A8 + 184))(&unk_9400, &j_3, &v40) >= 0 ) /*0x4112*/ { v5 = (*(__int64 (__fastcall **)(__int64, void *, __int64 *))(qword_96A8 + 152))(v40, &unk_9400, &v31); /*0x4134*/ if ( (unsigned __int8)DebugAssertEnabled() && v5 < 0 ) /*0x4143*/ { - if ( (unsigned __int8)DebugTraceEnabled() && (unsigned __int8)DebugLevelEnabled(0x80000000LL) ) /*0x4151*/ - DebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v5); /*0x4167*/ + if ( (unsigned __int8)SystemInventoryDebugTraceEnabled() && (unsigned __int8)SystemInventoryDebugLevelEnabled(0x80000000LL) ) /*0x4151*/ + SystemInventoryDebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v5); /*0x4167*/ DebugAssert("e:\\hs\\LenovoServerPkg\\SystemInventory\\SystemInventory.c", 1404, "!EFI_ERROR (Status)"); /*0x417f*/ } v6 = (*(__int64 (__fastcall **)(__int64, _BYTE *, __int64 *, __int64 *, __int64 *))(v31 + 112))( /*0x41a3*/ @@ -94,30 +94,30 @@ &v33); if ( (unsigned __int8)DebugAssertEnabled() && v6 < 0 ) /*0x41b2*/ { - if ( (unsigned __int8)DebugTraceEnabled() && (unsigned __int8)DebugLevelEnabled(0x80000000LL) ) /*0x41c0*/ - DebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v6); /*0x41d6*/ + if ( (unsigned __int8)SystemInventoryDebugTraceEnabled() && (unsigned __int8)SystemInventoryDebugLevelEnabled(0x80000000LL) ) /*0x41c0*/ + SystemInventoryDebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v6); /*0x41d6*/ DebugAssert("e:\\hs\\LenovoServerPkg\\SystemInventory\\SystemInventory.c", 1407, "!EFI_ERROR (Status)"); /*0x41ee*/ } - if ( (unsigned __int8)DebugTraceEnabled() && (unsigned __int8)DebugLevelEnabled(0x80000000LL) ) /*0x41ff*/ - DebugPrint(0x80000000LL, "Bus = %x, Dev = %x, Func = %x\n", v29, v34, v33); /*0x4223*/ + if ( (unsigned __int8)SystemInventoryDebugTraceEnabled() && (unsigned __int8)SystemInventoryDebugLevelEnabled(0x80000000LL) ) /*0x41ff*/ + SystemInventoryDebugPrint(0x80000000LL, "Bus = %x, Dev = %x, Func = %x\n", v29, v34, v33); /*0x4223*/ (*(void (__fastcall **)(__int64, __int64, _QWORD, __int64, unsigned __int16 *))(v31 + 48))(v31, 1, 0, 1, &v43); /*0x4241*/ - if ( (unsigned __int8)DebugTraceEnabled() && (unsigned __int8)DebugLevelEnabled(0x80000000LL) ) /*0x4250*/ - DebugPrint(0x80000000LL, "VendorID = %x\n", v43); /*0x4268*/ - for ( j = j_1; !(unsigned __int8)sub_1EF0(j); j = j_1 ) /*0x426d*/ + if ( (unsigned __int8)SystemInventoryDebugTraceEnabled() && (unsigned __int8)SystemInventoryDebugLevelEnabled(0x80000000LL) ) /*0x4250*/ + SystemInventoryDebugPrint(0x80000000LL, "VendorID = %x\n", v43); /*0x4268*/ + for ( j = j_1; !(unsigned __int8)IsPciDevicePathEnd(j); j = j_1 ) /*0x426d*/ { - if ( (unsigned __int8)sub_1DB8(j_1) == 1 && (unsigned __int8)sub_1DF0(j_1) == 1 ) /*0x4291*/ + if ( (unsigned __int8)IsPciDevicePathDeviceNode(j_1) == 1 && (unsigned __int8)IsPciDevicePathFunctionNode(j_1) == 1 ) /*0x4291*/ { j_2 = j_1; /*0x42a3*/ goto LABEL_36; /*0x42a7*/ } - j_1 = sub_1E6C(j_1); /*0x429b*/ + j_1 = NextPciDevicePathNode(j_1); /*0x429b*/ } j_1 = j_2; /*0x42a9*/ LABEL_36: if ( j_1 ) /*0x42b0*/ { - if ( (unsigned __int8)DebugTraceEnabled() && (unsigned __int8)DebugLevelEnabled(0x80000000LL) ) /*0x42c2*/ - DebugPrint( /*0x42df*/ + if ( (unsigned __int8)SystemInventoryDebugTraceEnabled() && (unsigned __int8)SystemInventoryDebugLevelEnabled(0x80000000LL) ) /*0x42c2*/ + SystemInventoryDebugPrint( /*0x42df*/ 0x80000000LL, "PciDevicePath->Device = %x, PciDevicePath->Function = %x.\n", *(unsigned __int8 *)(j_1 + 5), @@ -130,8 +130,8 @@ &v32); if ( (unsigned __int8)DebugAssertEnabled() && v9 < 0 ) /*0x4332*/ { - if ( (unsigned __int8)DebugTraceEnabled() && (unsigned __int8)DebugLevelEnabled(0x80000000LL) ) /*0x4340*/ - DebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v9); /*0x4356*/ + if ( (unsigned __int8)SystemInventoryDebugTraceEnabled() && (unsigned __int8)SystemInventoryDebugLevelEnabled(0x80000000LL) ) /*0x4340*/ + SystemInventoryDebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v9); /*0x4356*/ DebugAssert("e:\\hs\\LenovoServerPkg\\SystemInventory\\SystemInventory.c", 1437, "!EFI_ERROR (Status)"); /*0x436e*/ } if ( (*(__int64 (__fastcall **)(__int64, int *, _BYTE *))(v32 + 40))(v32, &v45, v30) >= 0 ) /*0x4388*/ @@ -139,10 +139,10 @@ n512 = 512; /*0x4395*/ v10 = (_WORD *)AllocatePool(512); /*0x43ab*/ v11 = (*(__int64 (__fastcall **)(__int64, _WORD *, int *))(v32 + 24))(v32, v10, &n512); /*0x43b2*/ - if ( (unsigned __int8)DebugAssertEnabled() && v11 < 0 ) /*0x43c1*/ - { - if ( (unsigned __int8)DebugTraceEnabled() && (unsigned __int8)DebugLevelEnabled(0x80000000LL) ) /*0x43cf*/ - DebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v11); /*0x43e5*/ + if ( (unsigned __int8)DebugAssertEnabled() && v11 < 0 ) /*0x43c1*/ + { + if ( (unsigned __int8)SystemInventoryDebugTraceEnabled() && (unsigned __int8)SystemInventoryDebugLevelEnabled(0x80000000LL) ) /*0x43cf*/ + SystemInventoryDebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v11); /*0x43e5*/ DebugAssert("e:\\hs\\LenovoServerPkg\\SystemInventory\\SystemInventory.c", 1456, "!EFI_ERROR (Status)"); /*0x43fd*/ } (*(void (__fastcall **)(__int64, int *, _BYTE *))(v32 + 40))(v32, &v45, v30); /*0x4411*/ @@ -165,8 +165,8 @@ if ( (__int16)*v10 >= 0 ) /*0x4471*/ { v14 = (unsigned int)PciRead32(((v33 & 7 | (8 * (v34 & 0x1F | (32LL * (unsigned __int8)v29)))) << 12) | 0x24); /*0x44b2*/ - if ( (unsigned __int8)DebugTraceEnabled() && (unsigned __int8)DebugLevelEnabled(0x80000000LL) ) /*0x44c0*/ - DebugPrint( /*0x44e8*/ + if ( (unsigned __int8)SystemInventoryDebugTraceEnabled() && (unsigned __int8)SystemInventoryDebugLevelEnabled(0x80000000LL) ) /*0x44c0*/ + SystemInventoryDebugPrint( /*0x44e8*/ 0x80000000LL, "RDBG Inventory Bus %x, Dev %x, Func %x , SidpbaorAhciBaseAddr = %x\n", v29, @@ -182,14 +182,14 @@ n3 = 3; /*0x4561*/ do /*0x457f*/ { - v17 |= sub_BD4(*v18++, n16); /*0x4570*/ + v17 |= LShiftU64(*v18++, n16); /*0x4570*/ n16 += 16; /*0x4577*/ --n3; /*0x457b*/ } while ( n3 ); /*0x457f*/ - v21 = sub_C28(v17, 1000, 0); /*0x458e*/ - v22 = sub_C20(v21, 512); /*0x459b*/ - v23 = sub_C28(v22, 1000, 0); /*0x45a8*/ + v21 = DivU64x32(v17, 1000, 0); /*0x458e*/ + v22 = MultU64x32(v21, 512); /*0x459b*/ + v23 = DivU64x32(v22, 1000, 0); /*0x45a8*/ i_1 = i; /*0x45ad*/ v16 = v23; /*0x45b1*/ } @@ -201,8 +201,8 @@ if ( v10[217] == 1 ) /*0x45cf*/ { *(_BYTE *)(v24 + qword_9680 + 2421) = 1; /*0x45d1*/ - if ( (unsigned __int8)DebugTraceEnabled() && (unsigned __int8)DebugLevelEnabled(64) ) /*0x45e6*/ - DebugPrint( /*0x45f6*/ + if ( (unsigned __int8)SystemInventoryDebugTraceEnabled() && (unsigned __int8)SystemInventoryDebugLevelEnabled(64) ) /*0x45e6*/ + SystemInventoryDebugPrint( /*0x45f6*/ 64, "[System Inventory] Hard Disk %d is found in slot %d is of type SSD\n", (unsigned int)v0 + 1, @@ -211,8 +211,8 @@ else { *(_BYTE *)(v24 + qword_9680 + 2421) = 0; /*0x45f8*/ - if ( (unsigned __int8)DebugTraceEnabled() && (unsigned __int8)DebugLevelEnabled(64) ) /*0x460e*/ - DebugPrint( /*0x462e*/ + if ( (unsigned __int8)SystemInventoryDebugTraceEnabled() && (unsigned __int8)SystemInventoryDebugLevelEnabled(64) ) /*0x460e*/ + SystemInventoryDebugPrint( /*0x462e*/ 64, "[System Inventory] Hard Disk %d is found in slot %d is of type HDD\n", (unsigned int)v0 + 1, @@ -228,15 +228,15 @@ v27 = v10 + 27; /*0x4692*/ v28 = v24 + qword_9680 + 2353; /*0x469c*/ if ( n0x40 <= 0x40 ) /*0x46a3*/ - sub_814(v28, v27); /*0x46b2*/ + AsciiStrCpyS(v28, v27, 62); /*0x46b2*/ else AsciiStrCpyS(v28, v27, 62); /*0x46ab*/ - sub_2720(v24 + qword_9680 + 2353, 64); /*0x46cf*/ - sub_275C(v24 + qword_9680 + 2353, 64); /*0x46e7*/ - if ( (unsigned __int8)DebugTraceEnabled() && (unsigned __int8)DebugLevelEnabled(64) ) /*0x46f7*/ - DebugPrint(64, "[System Inventory] Drive Size = %d MB\n", *(_DWORD *)(v24 + qword_9680 + 2417)); /*0x4718*/ - if ( (unsigned __int8)DebugTraceEnabled() && (unsigned __int8)DebugLevelEnabled(64) ) /*0x4729*/ - DebugPrint(64, "[System Inventory] Link Speed = %d\n", *(unsigned __int8 *)(v24 + qword_9680 + 2424)); /*0x474c*/ + NormalizeInventoryString(v24 + qword_9680 + 2353, 64); /*0x46cf*/ + TrimInventoryString(v24 + qword_9680 + 2353, 64); /*0x46e7*/ + if ( (unsigned __int8)SystemInventoryDebugTraceEnabled() && (unsigned __int8)SystemInventoryDebugLevelEnabled(64) ) /*0x46f7*/ + SystemInventoryDebugPrint(64, "[System Inventory] Drive Size = %d MB\n", *(_DWORD *)(v24 + qword_9680 + 2417)); /*0x4718*/ + if ( (unsigned __int8)SystemInventoryDebugTraceEnabled() && (unsigned __int8)SystemInventoryDebugLevelEnabled(64) ) /*0x4729*/ + SystemInventoryDebugPrint(64, "[System Inventory] Link Speed = %d\n", *(unsigned __int8 *)(v24 + qword_9680 + 2424)); /*0x474c*/ (*(void (__fastcall **)(_WORD *))(qword_96A8 + 72))(v10); /*0x475b*/ ++v0; /*0x476a*/ } diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/InitializeSystemInventory.c b/LenovoServerPkg/SystemInventory/SystemInventory/InitializeSystemInventory.c index 179e0cf..239b190 100644 --- a/LenovoServerPkg/SystemInventory/SystemInventory/InitializeSystemInventory.c +++ b/LenovoServerPkg/SystemInventory/SystemInventory/InitializeSystemInventory.c @@ -32,64 +32,64 @@ __int64 v33; // r8 __int64 v34; // r9 - v4 = sub_4B8(); /*0x2c94*/ + v4 = InitializeSystemInventoryGlobals(); /*0x2c94*/ if ( (unsigned __int8)DebugAssertEnabled() && v4 < 0 ) /*0x2cbd*/ { - if ( (unsigned __int8)DebugTraceEnabled(v6, v5, v7, v8) && (unsigned __int8)DebugLevelEnabled(0x80000000LL) ) /*0x2cca*/ - DebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v4); /*0x2cdb*/ + if ( (unsigned __int8)SystemInventoryDebugTraceEnabled(v6, v5, v7, v8) && (unsigned __int8)SystemInventoryDebugLevelEnabled(0x80000000LL) ) /*0x2cca*/ + SystemInventoryDebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v4); /*0x2cdb*/ DebugAssert( /*0x2ceb*/ "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\LenovoServerPkg\\SystemInventory\\SystemInventory\\DEBUG\\AutoGen.c", 306, "!EFI_ERROR (Status)"); } - v9 = sub_554(ImageHandle, SystemTable); /*0x2cfb*/ + v9 = InstallSystemInventoryProtocols(ImageHandle, SystemTable); /*0x2cfb*/ if ( (unsigned __int8)DebugAssertEnabled() && v9 < 0 ) /*0x2d0a*/ { - if ( (unsigned __int8)DebugTraceEnabled(v11, v10, v12, v13) && (unsigned __int8)DebugLevelEnabled(0x80000000LL) ) /*0x2d18*/ - DebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v9); /*0x2d2a*/ + if ( (unsigned __int8)SystemInventoryDebugTraceEnabled(v11, v10, v12, v13) && (unsigned __int8)SystemInventoryDebugLevelEnabled(0x80000000LL) ) /*0x2d18*/ + SystemInventoryDebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v9); /*0x2d2a*/ DebugAssert( /*0x2d3a*/ "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\LenovoServerPkg\\SystemInventory\\SystemInventory\\DEBUG\\AutoGen.c", 309, "!EFI_ERROR (Status)"); } - v14 = sub_1F4C(ImageHandle, SystemTable); /*0x2d4a*/ + v14 = InitializeDimmInventory(ImageHandle, SystemTable); /*0x2d4a*/ if ( (unsigned __int8)DebugAssertEnabled() && v14 < 0 ) /*0x2d59*/ { - if ( (unsigned __int8)DebugTraceEnabled(v16, v15, v17, v18) && (unsigned __int8)DebugLevelEnabled(0x80000000LL) ) /*0x2d67*/ - DebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v14); /*0x2d79*/ + if ( (unsigned __int8)SystemInventoryDebugTraceEnabled(v16, v15, v17, v18) && (unsigned __int8)SystemInventoryDebugLevelEnabled(0x80000000LL) ) /*0x2d67*/ + SystemInventoryDebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v14); /*0x2d79*/ DebugAssert( /*0x2d89*/ "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\LenovoServerPkg\\SystemInventory\\SystemInventory\\DEBUG\\AutoGen.c", 312, "!EFI_ERROR (Status)"); } - v19 = sub_247C(ImageHandle, SystemTable); /*0x2d99*/ + v19 = InitializePciInventory(ImageHandle, SystemTable); /*0x2d99*/ if ( (unsigned __int8)DebugAssertEnabled() && v19 < 0 ) /*0x2da8*/ { - if ( (unsigned __int8)DebugTraceEnabled(v21, v20, v22, v23) && (unsigned __int8)DebugLevelEnabled(0x80000000LL) ) /*0x2db6*/ - DebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v19); /*0x2dc8*/ + if ( (unsigned __int8)SystemInventoryDebugTraceEnabled(v21, v20, v22, v23) && (unsigned __int8)SystemInventoryDebugLevelEnabled(0x80000000LL) ) /*0x2db6*/ + SystemInventoryDebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v19); /*0x2dc8*/ DebugAssert( /*0x2dd8*/ "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\LenovoServerPkg\\SystemInventory\\SystemInventory\\DEBUG\\AutoGen.c", 315, "!EFI_ERROR (Status)"); } - v24 = sub_248C(ImageHandle, SystemTable); /*0x2de8*/ + v24 = RegisterSystemInventoryEvents(ImageHandle, SystemTable); /*0x2de8*/ if ( (unsigned __int8)DebugAssertEnabled() && v24 < 0 ) /*0x2df7*/ { - if ( (unsigned __int8)DebugTraceEnabled(v26, v25, v27, v28) && (unsigned __int8)DebugLevelEnabled(0x80000000LL) ) /*0x2e05*/ - DebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v24); /*0x2e17*/ + if ( (unsigned __int8)SystemInventoryDebugTraceEnabled(v26, v25, v27, v28) && (unsigned __int8)SystemInventoryDebugLevelEnabled(0x80000000LL) ) /*0x2e05*/ + SystemInventoryDebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v24); /*0x2e17*/ DebugAssert( /*0x2e27*/ "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\LenovoServerPkg\\SystemInventory\\SystemInventory\\DEBUG\\AutoGen.c", 318, "!EFI_ERROR (Status)"); } - v29 = sub_26D8(ImageHandle, SystemTable); /*0x2e37*/ + v29 = InitializeBmcInventory(ImageHandle, SystemTable); /*0x2e37*/ result = DebugAssertEnabled(); /*0x2e3a*/ if ( (_BYTE)result && v29 < 0 ) /*0x2e46*/ { - if ( (unsigned __int8)DebugTraceEnabled(v32, v31, v33, v34) ) /*0x2e48*/ + if ( (unsigned __int8)SystemInventoryDebugTraceEnabled(v32, v31, v33, v34) ) /*0x2e48*/ { - if ( (unsigned __int8)DebugLevelEnabled(0x80000000LL) ) /*0x2e54*/ - DebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v29); /*0x2e66*/ + if ( (unsigned __int8)SystemInventoryDebugLevelEnabled(0x80000000LL) ) /*0x2e54*/ + SystemInventoryDebugPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v29); /*0x2e66*/ } return DebugAssert( /*0x2e76*/ "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\LenovoServerPkg\\SystemInventory\\SystemInventory\\DEBUG\\AutoGen.c", diff --git a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory.h b/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory.h index 90c8a10..123d01a 100644 --- a/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory.h +++ b/LenovoServerPkg/SystemInventory/SystemInventory/SystemInventory.h @@ -21,9 +21,9 @@ UINTN Length ); -#define DebugTraceEnabled(...) sub_7F8(__VA_ARGS__) -#define DebugLevelEnabled(...) sub_804(__VA_ARGS__) -#define DebugPrint(...) sub_740(__VA_ARGS__) +#define SystemInventoryDebugTraceEnabled(...) DebugTraceEnabled(__VA_ARGS__) +#define SystemInventoryDebugLevelEnabled(...) DebugLevelEnabled(__VA_ARGS__) +#define SystemInventoryDebugPrint(...) DebugPrint(__VA_ARGS__) #define DebugAssertEnabled(...) DebugAssertEnabled(__VA_ARGS__) #define DebugAssert(...) DebugAssert(__VA_ARGS__) diff --git a/MdeModulePkg/Application/PerfMonApp/PerfMonApp.c b/MdeModulePkg/Application/PerfMonApp/PerfMonApp.c index 28d8165..e21b63e 100644 --- a/MdeModulePkg/Application/PerfMonApp/PerfMonApp.c +++ b/MdeModulePkg/Application/PerfMonApp/PerfMonApp.c @@ -11,8 +11,76 @@ // Function: ModuleEntryPoint -EFI_STATUS ModuleEntryPoint(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) { _QWORD *v3; // rdx unsigned __int64 i; // rax signed __int64 v5; // rbx _QWORD *v6; // rdi unsigned __int64 v7; // r8 unsigned __int64 v8; // rax EFI_STATUS v9; // rdi _QWORD *v11; // [rsp+38h] [rbp+10h] BYREF ::ImageHandle = (__int64)ImageHandle; if ( !ImageHandle ) sub_1934( "e:\\hs\\MdePkg\\Library\\UefiBootServicesTableLib\\UefiBootServicesTableLib.c", 51, "gImageHandle != ((void *) 0)"); ::SystemTable = (__int64)SystemTable; if ( !SystemTable ) sub_1934("e:\\hs\\MdePkg\\Library\\UefiBootServicesTableLib\\UefiBootServicesTableLib.c", 57, "gST != ((void *) 0)"); BootServices = (__int64)SystemTable->BootServices; if ( !BootServices ) sub_1934("e:\\hs\\MdePkg\\Library\\UefiBootServicesTableLib\\UefiBootServicesTableLib.c", 63, "gBS != ((void *) 0)"); RuntimeServices = (__int64)SystemTable->RuntimeServices; if ( !RuntimeServices ) sub_1934( "e:\\hs\\MdePkg\\Library\\UefiRuntimeServicesTableLib\\UefiRuntimeServicesTableLib.c", 47, "gRT != ((void *) 0)"); sub_5210(); v11 = v3; n1000 = 1000; for ( i = 0; i < 0xA0; i += 40LL ) { *(_DWORD *)((char *)&unk_9220 + i + 32) = 0; *(_QWORD *)((char *)&unk_9220 + i + 8) = -1; *(_QWORD *)((char *)&unk_9220 + i + 16) = 0; *(_QWORD *)((char *)&unk_9220 + i) = 0; } v5 = sub_4D94(&unk_91E0, &v11); if ( v5 >= 0 && (v6 = v11) != 0 ) { sub_564(L" -DP Build Version: %d.%d -", 2, 4); v7 = v6[1]; v8 = v6[3]; qword_93A0 = v6[2]; qword_93A8 = v8; dword_93B0 = v7 / 0x3E8; byte_93B4 = v8 >= qword_93A0; sub_564(L"System Performance Timer Frequency: %,8d (KHz) -", (unsigned int)dword_93B0); sub_82C(); sub_918(); sub_5A8(); v5 = 0x8000000000000015uLL; if ( sub_BA0() != 0x8000000000000015uLL && sub_EF4() != 0x8000000000000015uLL ) { v9 = sub_FE4(); if ( v9 != 0x8000000000000015uLL ) { sub_129C(); return v9; } } } else { sub_564(L"Performance property not found -"); } return v5; } +EFI_STATUS +EFIAPI +ModuleEntryPoint( + EFI_HANDLE ImageHandle, + EFI_SYSTEM_TABLE *SystemTable + ) +{ + UINTN *PerformanceProperty; + UINTN Index; + EFI_STATUS Status; + UINTN *PerformanceInfo; + UINTN TimerFrequencyKHz; + UINTN TimerValue; + EFI_STATUS QueryStatus; + UINTN *PropertyTable; + + ::ImageHandle = (__int64)ImageHandle; + if ( !ImageHandle ) { + PerfMonAssert("e:\\hs\\MdePkg\\Library\\UefiBootServicesTableLib\\UefiBootServicesTableLib.c", 51, "gImageHandle != ((void *) 0)"); + } + + ::SystemTable = (__int64)SystemTable; + if ( !SystemTable ) { + PerfMonAssert("e:\\hs\\MdePkg\\Library\\UefiBootServicesTableLib\\UefiBootServicesTableLib.c", 57, "gST != ((void *) 0)"); + } + + BootServices = (__int64)SystemTable->BootServices; + if ( !BootServices ) { + PerfMonAssert("e:\\hs\\MdePkg\\Library\\UefiBootServicesTableLib\\UefiBootServicesTableLib.c", 63, "gBS != ((void *) 0)"); + } + + RuntimeServices = (__int64)SystemTable->RuntimeServices; + if ( !RuntimeServices ) { + PerfMonAssert("e:\\hs\\MdePkg\\Library\\UefiRuntimeServicesTableLib\\UefiRuntimeServicesTableLib.c", 47, "gRT != ((void *) 0)"); + } + + InitializePerformanceFramework(); + PropertyTable = PerformanceProperty; + n1000 = 1000; + for ( Index = 0; Index < 0xA0; Index += 40LL ) { + *(_DWORD *)((char *)&unk_9220 + Index + 32) = 0; + *(_QWORD *)((char *)&unk_9220 + Index + 8) = -1; + *(_QWORD *)((char *)&unk_9220 + Index + 16) = 0; + *(_QWORD *)((char *)&unk_9220 + Index) = 0; + } + + Status = GetPerformancePropertyTable(&unk_91E0, &PropertyTable); + if ( Status >= 0 && PropertyTable != 0 ) { + PerfMonPrint(L"DP Build Version: %d.%d\n", 2, 4); + TimerFrequencyKHz = PropertyTable[1]; + TimerValue = PropertyTable[3]; + qword_93A0 = PropertyTable[2]; + qword_93A8 = TimerValue; + dword_93B0 = TimerFrequencyKHz / 0x3E8; + byte_93B4 = TimerValue >= qword_93A0; + PerfMonPrint(L"System Performance Timer Frequency: %,8d (KHz)\n", (unsigned int)dword_93B0); + CollectPerformanceData(); + InitializePerformanceData(); + ConfigurePerformanceOutput(); + Status = 0x8000000000000015uLL; + if ( HasPerformanceProtocol() != 0x8000000000000015uLL && HasPerformanceData() != 0x8000000000000015uLL ) { + QueryStatus = RunPerformanceQuery(); + if ( QueryStatus != 0x8000000000000015uLL ) { + CleanupPerformanceState(); + return QueryStatus; + } + } + } else { + PerfMonPrint(L"Performance property not found\n"); + } + + return Status; +} diff --git a/MdeModulePkg/Application/PerfMonApp/PerfMonApp.h b/MdeModulePkg/Application/PerfMonApp/PerfMonApp.h index 8fd661c..3c60ed7 100644 --- a/MdeModulePkg/Application/PerfMonApp/PerfMonApp.h +++ b/MdeModulePkg/Application/PerfMonApp/PerfMonApp.h @@ -24,102 +24,105 @@ ); /// -/// sub_1934 +/// PerfMonAssert +/// +VOID +EFIAPI +PerfMonAssert( + CONST CHAR8 *FileName, + UINTN LineNumber, + CONST CHAR8 *Description + ); + +/// +/// InitializePerformanceFramework +/// +VOID +EFIAPI +InitializePerformanceFramework( + VOID + ); + +/// +/// GetPerformancePropertyTable /// EFI_STATUS EFIAPI -sub_1934( +GetPerformancePropertyTable( VOID -); + ); /// -/// sub_5210 +/// PerfMonPrint +/// +UINTN +EFIAPI +PerfMonPrint( + IN CONST CHAR16 *Format, + ... + ); + +/// +/// CollectPerformanceData +/// +VOID +EFIAPI +CollectPerformanceData( + VOID + ); + +/// +/// InitializePerformanceData +/// +VOID +EFIAPI +InitializePerformanceData( + VOID + ); + +/// +/// ConfigurePerformanceOutput +/// +VOID +EFIAPI +ConfigurePerformanceOutput( + VOID + ); + +/// +/// RunPerformanceQuery /// EFI_STATUS EFIAPI -sub_5210( +RunPerformanceQuery( VOID -); + ); /// -/// sub_4D94 +/// CleanupPerformanceState /// -EFI_STATUS +VOID EFIAPI -sub_4D94( +CleanupPerformanceState( VOID -); + ); /// -/// sub_564 +/// HasPerformanceProtocol /// -EFI_STATUS +BOOLEAN EFIAPI -sub_564( +HasPerformanceProtocol( VOID -); + ); /// -/// sub_82C +/// HasPerformanceData /// -EFI_STATUS +BOOLEAN EFIAPI -sub_82C( +HasPerformanceData( VOID -); + ); -/// -/// sub_918 -/// -EFI_STATUS -EFIAPI -sub_918( - VOID -); - -/// -/// sub_5A8 -/// -EFI_STATUS -EFIAPI -sub_5A8( - VOID -); - -/// -/// sub_FE4 -/// -EFI_STATUS -EFIAPI -sub_FE4( - VOID -); - -/// -/// sub_129C -/// -EFI_STATUS -EFIAPI -sub_129C( - VOID -); - -/// -/// sub_BA0 -/// -EFI_STATUS -EFIAPI -sub_BA0( - VOID -); - -/// -/// sub_EF4 -/// -EFI_STATUS -EFIAPI -sub_EF4( - VOID -); - -#endif /* __PERFMONAPP_H__ */ \ No newline at end of file +#endif /* __PERFMONAPP_H__ */ diff --git a/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c b/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c index bf932c2..fe2bcd3 100644 --- a/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c +++ b/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c @@ -87,7 +87,7 @@ ); //============================================================================= -// MODULE ENTRY POINT (sub_384 @ 0x384) +// MODULE ENTRY POINT //============================================================================= EFI_STATUS @@ -107,8 +107,7 @@ ASSERT (gBootServices != NULL); ASSERT (gRuntimeServices != NULL); - // Get HOB list (call to sub_2228) - // In the binary, sub_2228 initializes gHobList from the system table + // Initialize the HOB list from the system table configuration table. // configuration table entries by scanning for gEfiHobListGuid. // Install protocols @@ -116,7 +115,7 @@ } //============================================================================= -// DRIVER BINDING ENTRY POINT (sub_43C @ 0x43C) +// DRIVER BINDING ENTRY POINT //============================================================================= EFI_STATUS @@ -140,7 +139,7 @@ } //============================================================================= -// HOBB LIST INITIALIZATION (sub_2228 @ 0x2228) +// HOB LIST INITIALIZATION //============================================================================= STATIC VOID *mHobList = NULL; @@ -175,7 +174,7 @@ } //============================================================================= -// DRIVER BINDING: Supported (sub_5A8 @ 0x5A8) +// DRIVER BINDING: Supported //============================================================================= EFI_STATUS @@ -264,7 +263,7 @@ } //============================================================================= -// DRIVER BINDING: Start (sub_744 @ 0x744) +// DRIVER BINDING: Start //============================================================================= EFI_STATUS @@ -473,7 +472,7 @@ } //============================================================================= -// DRIVER BINDING: Stop (sub_AF4 @ 0xAF4) +// DRIVER BINDING: Stop //============================================================================= EFI_STATUS @@ -601,7 +600,7 @@ } //============================================================================= -// SCSI SCAN CREATE DEVICE (sub_11D8 @ 0x11D8) +// SCSI SCAN CREATE DEVICE //============================================================================= EFI_STATUS @@ -776,7 +775,7 @@ } //============================================================================= -// SCSI INQUIRY DEVICE (sub_1438 @ 0x1438) +// SCSI INQUIRY DEVICE //============================================================================= BOOLEAN @@ -857,7 +856,7 @@ } //============================================================================= -// COPY DEVICE PATH NODE (sub_15FC @ 0x15FC) +// COPY DEVICE PATH NODE //============================================================================= VOID @@ -880,7 +879,7 @@ } //============================================================================= -// EFI_SCSI_IO_PROTOCOL: GetDeviceType (sub_D70 @ 0xD70) +// EFI_SCSI_IO_PROTOCOL: GetDeviceType //============================================================================= EFI_STATUS @@ -899,7 +898,7 @@ } //============================================================================= -// EFI_SCSI_IO_PROTOCOL: GetDeviceLocation (sub_DD0 @ 0xDD0) +// EFI_SCSI_IO_PROTOCOL: GetDeviceLocation //============================================================================= EFI_STATUS @@ -924,7 +923,7 @@ } //============================================================================= -// EFI_SCSI_IO_PROTOCOL: ResetBus (sub_E50 @ 0xE50) +// EFI_SCSI_IO_PROTOCOL: ResetBus //============================================================================= EFI_STATUS @@ -949,7 +948,7 @@ } //============================================================================= -// EFI_SCSI_IO_PROTOCOL: ResetDevice (sub_EB0 @ 0xEB0) +// EFI_SCSI_IO_PROTOCOL: ResetDevice //============================================================================= EFI_STATUS @@ -973,7 +972,7 @@ } //============================================================================= -// EFI_SCSI_IO_PROTOCOL: ExecuteScsiCommand (sub_F40 @ 0xF40) +// EFI_SCSI_IO_PROTOCOL: ExecuteScsiCommand //============================================================================= EFI_STATUS @@ -1005,7 +1004,7 @@ } //============================================================================= -// EFI_COMPONENT_NAME2_PROTOCOL: GetDriverName (sub_16B4 @ 0x16B4) +// EFI_COMPONENT_NAME2_PROTOCOL: GetDriverName //============================================================================= EFI_STATUS @@ -1025,7 +1024,7 @@ } //============================================================================= -// EFI_COMPONENT_NAME2_PROTOCOL: GetControllerName (sub_1810 @ 0x1810) +// EFI_COMPONENT_NAME2_PROTOCOL: GetControllerName //============================================================================= EFI_STATUS @@ -1045,7 +1044,7 @@ } //============================================================================= -// STATUS CODE PROTOCOL LOOKUP (sub_181C @ 0x181C) +// STATUS CODE PROTOCOL LOOKUP //============================================================================= STATIC @@ -1078,7 +1077,7 @@ } //============================================================================= -// DEBUG ASSERT (sub_1924 @ 0x1924) +// DEBUG ASSERT //============================================================================= VOID @@ -1096,7 +1095,7 @@ } //============================================================================= -// COPY MEM (sub_1964 @ 0x1964) +// COPY MEM //============================================================================= VOID * @@ -1136,7 +1135,7 @@ } //============================================================================= -// ZERO MEM (sub_1A04 @ 0x1A04) +// ZERO MEM //============================================================================= VOID @@ -1159,7 +1158,7 @@ } //============================================================================= -// SET MEM (sub_1A68 @ 0x1A68) +// SET MEM //============================================================================= VOID * @@ -1258,7 +1257,7 @@ } //============================================================================= -// REPORT STATUS CODE WITH DEVICE PATH (sub_239C @ 0x239C) +// REPORT STATUS CODE WITH DEVICE PATH //============================================================================= EFI_STATUS @@ -1378,7 +1377,7 @@ } //============================================================================= -// COPY GUID (sub_27A0 @ 0x27A0) +// COPY GUID //============================================================================= VOID @@ -1395,7 +1394,7 @@ } //============================================================================= -// COMPARE GUID (sub_27E8 @ 0x27E8) +// COMPARE GUID //============================================================================= BOOLEAN @@ -1443,4 +1442,4 @@ return 0; } return *(UINT16 *)((UINT8 *)Node + 2); -} \ No newline at end of file +} diff --git a/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.h b/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.h index ebf586b..6794d8a 100644 --- a/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.h +++ b/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.h @@ -193,233 +193,9 @@ VOID ); -EFI_STATUS -EFIAPI -from HR650X BIOS, IDA port 13338, ScsiBus.efi( - VOID -); - -EFI_STATUS -EFIAPI -MD5: 7936aa1e7ccfbeea8cd5fb39b8e95fe3( - VOID -); - -EFI_STATUS -EFIAPI -size: 0x37C0 bytes, 53 functions total( - VOID -); - -EFI_STATUS -EFIAPI -range: 0x2C0 - 0x2856( - VOID -); - -EFI_STATUS -EFIAPI -is a UEFI Driver Binding protocol implementation for SCSI bus( - VOID -); - -EFI_STATUS -EFIAPI -on a controller handle, enumerates SCSI( - VOID -); - -EFI_STATUS -EFIAPI -and LUNs via INQUIRY, and produces EFI_SCSI_IO_PROTOCOL on child( - VOID -); - -EFI_STATUS -EFIAPI -for each discovered device.( - VOID -); - -EFI_STATUS -EFIAPI -structures:( - VOID -); - -EFI_STATUS -EFIAPI -(0x30 bytes, signature 'scsi') - per-controller state( - VOID -); - -EFI_STATUS -EFIAPI -(0x88 bytes, signature 'scio') - per-child/LUN state( - VOID -); - -EFI_STATUS -EFIAPI -DEFINITIONS( - VOID -); - -EFI_STATUS -EFIAPI -VARIABLES( - VOID -); - -EFI_STATUS -EFIAPI -INSTANCES( - VOID -); - -EFI_STATUS -EFIAPI -DECLARATIONS FOR INTERNAL HELPERS( - VOID -); - -EFI_STATUS -EFIAPI -ENTRY POINT (sub_384 @ 0x384)( - VOID -); - -EFI_STATUS -EFIAPI -HOB list (call to sub_2228)( - VOID -); - -EFI_STATUS -EFIAPI -the binary, sub_2228 initializes gHobList from the system table( - VOID -); - -EFI_STATUS -EFIAPI -table entries by scanning for gEfiHobListGuid.( - VOID -); - -EFI_STATUS -EFIAPI -protocols( - VOID -); - -EFI_STATUS -EFIAPI -BINDING ENTRY POINT (sub_43C @ 0x43C)( - VOID -); - -EFI_STATUS -EFIAPI -LIST INITIALIZATION (sub_2228 @ 0x2228)( - VOID -); - -EFI_STATUS -EFIAPI -BINDING: Supported (sub_5A8 @ 0x5A8)( - VOID -); - -EFI_STATUS -EFIAPI -Extended SCSI Pass Thru first( - VOID -); - -EFI_STATUS -EFIAPI -= gBootServices->OpenProtocol (( - VOID -); - -EFI_STATUS -EFIAPI -the RemainingDevicePath( - VOID -); - -EFI_STATUS -EFIAPI -= ExtScsiPassThru->GetNextTargetLun (( - VOID -); - -EFI_STATUS -EFIAPI -back to legacy SCSI Pass Thru( - VOID -); - -EFI_STATUS -EFIAPI -BINDING: Start (sub_744 @ 0x744)( - VOID -); - -EFI_STATUS -EFIAPI -parent device path( - VOID -); - -EFI_STATUS -EFIAPI -Target Device (0x30 bytes)( - VOID -); - -EFI_STATUS -EFIAPI -= (SCSI_TARGET_DEVICE *)AllocateZeroPool (sizeof (SCSI_TARGET_DEVICE));( - VOID -); - -EFI_STATUS -EFIAPI -protocol to identify ourselves on the child handle( - VOID -); - -EFI_STATUS -EFIAPI -= gBootServices->InstallProtocolInterface (( - VOID -); - -EFI_STATUS -EFIAPI -RemainingDevicePath specifies a particular child, handle it now( - VOID -); - -EFI_STATUS -EFIAPI -(RemainingDevicePath != NULL) {( - VOID -); - -EFI_STATUS -EFIAPI -SCSI bus enumeration progress( - VOID -); - -EFI_STATUS -EFIAPI -(( - VOID -); +// +// Driver lifecycle and SCSI discovery helpers. +// EFI_STATUS EFIAPI @@ -465,7 +241,7 @@ EFI_STATUS EFIAPI -BINDING: Stop (sub_AF4 @ 0xAF4)( +ScsiBusDriverBindingStop( VOID ); @@ -543,7 +319,7 @@ EFI_STATUS EFIAPI -SCAN CREATE DEVICE (sub_11D8 @ 0x11D8)( +ScsiScanCreateDevice( VOID ); @@ -663,7 +439,7 @@ EFI_STATUS EFIAPI -INQUIRY DEVICE (sub_1438 @ 0x1438)( +ScsiInquiryDevice( VOID ); @@ -717,7 +493,7 @@ EFI_STATUS EFIAPI -DEVICE PATH NODE (sub_15FC @ 0x15FC)( +CopyDevicePathNode( VOID ); @@ -807,7 +583,7 @@ EFI_STATUS EFIAPI -CODE PROTOCOL LOOKUP (sub_181C @ 0x181C)( +GetStatusCodeProtocolInternal( VOID ); @@ -819,7 +595,7 @@ EFI_STATUS EFIAPI -ASSERT (sub_1924 @ 0x1924)( +ScsiBusDebugAssert( VOID ); @@ -837,7 +613,7 @@ EFI_STATUS EFIAPI -MEM (sub_1964 @ 0x1964)( +ScsiBusCopyMem( VOID ); @@ -849,13 +625,13 @@ EFI_STATUS EFIAPI -MEM (sub_1A04 @ 0x1A04)( +ScsiBusZeroMem( VOID ); EFI_STATUS EFIAPI -MEM (sub_1A68 @ 0x1A68)( +ScsiBusSetMem( VOID ); @@ -873,7 +649,7 @@ EFI_STATUS EFIAPI -STATUS CODE WITH DEVICE PATH (sub_239C @ 0x239C)( +ReportStatusCodeWithDevicePath( VOID ); @@ -891,13 +667,13 @@ EFI_STATUS EFIAPI -GUID (sub_27A0 @ 0x27A0)( +CopyGuid( VOID ); EFI_STATUS EFIAPI -GUID (sub_27E8 @ 0x27E8)( +CompareGuid( VOID ); @@ -907,4 +683,4 @@ VOID ); -#endif /* __SCSIBUS_H__ */ \ No newline at end of file +#endif /* __SCSIBUS_H__ */ diff --git a/MdeModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction/Gcd/Gcd.c b/MdeModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction/Gcd/Gcd.c index 9f43a0a..4af9a22 100644 --- a/MdeModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction/Gcd/Gcd.c +++ b/MdeModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction/Gcd/Gcd.c @@ -141,7 +141,7 @@ p_i = 0; Unknown = 0; __3 = 0; - if ( sub_D7D0(2, dst_3, 0, (unsigned __int64 *)p_i_1, (const char **)&p__) < 0 ) + if ( DxeCoreEnumerateMemorySpaceDescriptors(2, dst_3, 0, (unsigned __int64 *)p_i_1, (const char **)&p__) < 0 ) return 0x800000000000000EuLL; i = *(_QWORD *)p_i_1; if ( !*(_QWORD *)p_i_1 ) @@ -161,7 +161,7 @@ { do { - sub_6118(__2, (__int64 *)&p_i, (__int64)__ImageBase_1, i, p___1, 0); + DxeCoreBuildMemorySpaceDescriptor(__2, (__int64 *)&p_i, (__int64)__ImageBase_1, i, p___1, 0); __2 = (_QWORD *)a2[++v17]; } while ( __2 ); @@ -175,7 +175,7 @@ { for ( _a = 0; (*Unknown_4)(Unknown_4, __1, &_a) >= 0; - sub_6118(_a, (__int64 *)&p_i, (__int64)__ImageBase_1, i, p___1, 1) ) + DxeCoreBuildMemorySpaceDescriptor(_a, (__int64 *)&p_i, (__int64)__ImageBase_1, i, p___1, 1) ) { ; } @@ -207,14 +207,14 @@ if ( i_1 == i ) break; v5 = 0; - sub_6118(*(_QWORD **)&p___1[8 * i_1], (__int64 *)&p_i, (__int64)__ImageBase_1, i, p___1, 0); + DxeCoreBuildMemorySpaceDescriptor(*(_QWORD **)&p___1[8 * i_1], (__int64 *)&p_i, (__int64)__ImageBase_1, i, p___1, 0); } if ( DxeConfig_5(_, (__int64)&qword_225B0, &Unknown, ::_, 0, 1u) >= 0 ) { Unknown_5 = (__int64 (__fastcall **)(_QWORD, _QWORD **))Unknown; if ( Unknown ) { - for ( _a = 0; (*Unknown_5)(Unknown_5, &_a) >= 0; sub_6118( + for ( _a = 0; (*Unknown_5)(Unknown_5, &_a) >= 0; DxeCoreBuildMemorySpaceDescriptor( _a, (__int64 *)&p_i, (__int64)__ImageBase_1, @@ -230,12 +230,12 @@ if ( i ) { do - sub_6118(*(_QWORD **)&p___1[8 * i_3++], (__int64 *)&p_i, (__int64)__ImageBase_1, i, p___1, 0); + DxeCoreBuildMemorySpaceDescriptor(*(_QWORD **)&p___1[8 * i_3++], (__int64 *)&p_i, (__int64)__ImageBase_1, i, p___1, 0); while ( i_3 < i ); p_i_2 = p_i; } Assert_55((unsigned __int64)p___1, v22, v23, a4); - sub_D7D0(2, dst_3, 0, &p_i, (const char **)&__3); + DxeCoreEnumerateMemorySpaceDescriptors(2, dst_3, 0, &p_i, (const char **)&__3); Assert_55((unsigned __int64)__3, v28, v29, a4); if ( p_i > i ) { @@ -303,7 +303,7 @@ Unknown_1 = 0; LOBYTE(p_i) = 1; if ( DxeConfig_5(_, (__int64)&qword_22550, (__int64 *)p_i_1, __4, 0, 1u) < 0 - || (v45 = sub_626C(v43, v42, (__int64)v44, a4)) == 0 + || (v45 = DxeCoreLocateMemoryAttributeProtocol(v43, v42, (__int64)v44, a4)) == 0 || (LOBYTE(v44) = 1, LOBYTE(v42) = 1, Unknown = (*(__int64 (__fastcall **)(_QWORD, __int64, _QWORD))(v45 + 8))(*(_QWORD *)p_i_1, v42, v44), @@ -314,7 +314,7 @@ Unknown_3 = 0; if ( __ImageBase ) { - v47 = (__int64 (__fastcall **)(char *, __int64, _QWORD))sub_626C(v43, v42, (__int64)v44, a4); + v47 = (__int64 (__fastcall **)(char *, __int64, _QWORD))DxeCoreLocateMemoryAttributeProtocol(v43, v42, (__int64)v44, a4); if ( !v47 || (LOBYTE(v44) = 1, LOBYTE(v42) = 1, @@ -543,7 +543,7 @@ 54, (__int64)"(Length - 1) <= (0xFFFFFFFFFFFFFFFFULL - (UINTN)Buffer)", a4); - return sub_3E0((void *)buf, count, value); + return FillMem((void *)buf, count, value); } return buf_1; } @@ -575,7 +575,7 @@ if ( dst == src ) return dst; else - return sub_400(dst, src, count); + return CopyMem(dst, src, count); } return dst_1; } @@ -597,7 +597,7 @@ 54, (__int64)"Length <= (0xFFFFFFFFFFFFFFFFULL - (UINTN)Buffer + 1)", a4); - return sub_450(buf, a2); + return ZeroMem(buf, a2); } // @@ -631,7 +631,7 @@ 63, (__int64)"(Length - 1) <= (0xFFFFFFFFFFFFFFFFULL - (UINTN)SourceBuffer)", a4); - return sub_470((_BYTE *)i, (_BYTE *)i_1, a3); + return CompareMem((_BYTE *)i, (_BYTE *)i_1, a3); } // @@ -807,7 +807,7 @@ 61, (__int64)"(Length & (sizeof (Value) - 1)) == 0", v5); - sub_9E0(v26, v27 >> 1, 0); + SetMem16(v26, v27 >> 1, 0); n0x3FB_1 = n0x3FB; v8 = a3; } diff --git a/MdeModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction/Library/Library.c b/MdeModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction/Library/Library.c index ff1af6d..6d4e300 100644 --- a/MdeModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction/Library/Library.c +++ b/MdeModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction/Library/Library.c @@ -11,6 +11,13 @@ #include "../uefi_headers/Uefi.h" // +// Decompiler symbol cleanup for PE/TE image loading and section extraction helpers. +// These are external helpers recovered from the firmware image; the aliases keep +// the call sites readable without changing behavior. +// +// The recovered binary symbols are intentionally given descriptive names here. + +// // Function: CoreInstallProtocolInterface @ 0x4e74 // signed __int64 __fastcall CoreInstallProtocolInterface(char **p__, char *dst, int a3, __int64 p, char a5) @@ -173,15 +180,15 @@ *(_QWORD *)(ldri + 272) = DxeConfig_53; if ( !p___ImageBase ) return 0x8000000000000002uLL; - result = sub_16608((__int64 *)p___ImageBase); + result = PeCoffLoaderInitializeImageContext((__int64 *)p___ImageBase); if ( result < 0 ) return result; n3772 = *(unsigned __int16 *)(ldri + 360); if ( (_WORD)n3772 != 0x8664 && (_WORD)n3772 != 3772 && (_WORD)n3772 != 332 ) { - v14 = (const char *)sub_860C(n3772, 3772); + v14 = (const char *)PeCoffLoaderGetMachineTypeName(n3772, 3772); Assert_3(0x80000000, "Image type %s can't be loaded ", v14); - v16 = (const char *)sub_860C((unsigned __int16)n3772, n3772_1); + v16 = (const char *)PeCoffLoaderGetMachineTypeName((unsigned __int16)n3772, n3772_1); Assert_3(0x80000000, "on %s UEFI system.\n", v16); return 0x8000000000000003uLL; } @@ -257,7 +264,7 @@ if ( !*(_BYTE *)(ldri + 365) ) p___ImageBase->ImageAddress = (ImageAddress_1 + *(unsigned int *)(ldri + 296) - 1LL) & ~(*(unsigned int *)(ldri + 296) - 1LL); - Image = sub_16C9C((__int64 *)p___ImageBase, ImageAddress_1, n4095, v7); + Image = PeCoffLoaderAdjustImageContext((__int64 *)p___ImageBase, ImageAddress_1, n4095, v7); if ( Image < 0 ) goto LABEL_42; v33 = n3 & 1; @@ -366,7 +373,7 @@ if ( !dst ) return 0x8000000000000002uLL; - result = sub_4B80(_); + result = CoreValidateProtocolHandle(_); if ( result >= 0 ) { DxeGetInfo_8((__int64)&unk_25AC0, v8, v9, a4); @@ -457,7 +464,7 @@ if ( n3_1 == 2 || (Pool = CoreAllocatePool(n0xFFF, n232, n7_1, 4096)) != 0 ) { LOBYTE(__ImageBase) = 1; - v9 = sub_7510(Pool, n232, __ImageBase, n7_1, 0, 0); + v9 = CoreBuildOpenProtocolRecord(Pool, n232, __ImageBase, n7_1, 0, 0); } else { @@ -569,7 +576,7 @@ __int64 v22; // rdx __int64 v23; // r8 - result = sub_4B80(_); + result = CoreValidateProtocolHandle(_); if ( result >= 0 ) { if ( !v10 ) @@ -918,7 +925,7 @@ *(_DWORD *)(buf + 40) = v9; *(_DWORD *)(buf + 44) = v10; Assert_97(buf, 0x20u, v13, v4); - sub_15AEC(buf, v15, i, v4); + CoreInitializeSectionDecompressor(buf, v15, i, v4); return -(__int64)(*(_WORD *)(buf + 48) != 0) & 0x8000000000000002uLL; } @@ -1112,7 +1119,7 @@ n12_1 = n12; DxeGetInfo_8((__int64)&unk_26340, __ImageBase, n232, a4); LOBYTE(__ImageBase_1) = 1; - sub_7510(__ImageBase, n232, __ImageBase_1, 7, 0, 0); + CoreBuildOpenProtocolRecord(__ImageBase, n232, __ImageBase_1, 7, 0, 0); DxeGetInfo_10((__int64)&unk_26340, v7, v8, a4); result = qword_263D0; LOBYTE(n12_1) = 0; @@ -1151,7 +1158,7 @@ __int64 v6; // r8 if ( CpuGetInfo(a1, a2, a3, a4) == 1 ) - return *(unsigned int *)(sub_1A1D4(v5, v4, v6, a4) + 32); + return *(unsigned int *)(CoreGetMemoryAttributesContext(v5, v4, v6, a4) + 32); else return __readmsr(0x802u); } @@ -1265,7 +1272,7 @@ if ( Pages >= 0 ) { DxeGetInfo_8((__int64)&unk_26340, v7, v9, a4); - sub_7510(__ImageBase, a2 >> 12, 0, 0, 1, a3 & 0x7FFFFFFFFFFFFFFFLL); + CoreBuildOpenProtocolRecord(__ImageBase, a2 >> 12, 0, 0, 1, a3 & 0x7FFFFFFFFFFFFFFFLL); DxeGetInfo_10((__int64)&unk_26340, v10, v11, a4); } return Pages; @@ -1498,7 +1505,7 @@ qword_260D0 &= ~1uLL; v2 = *((unsigned int *)buf_0 + 3); *((_DWORD *)buf_0 + 4) = 0; - *((_QWORD *)buf + 7) = sub_7F40; + *((_QWORD *)buf + 7) = CoreSetPropertiesTableSectionAlignment; (*((void (__fastcall **)(char *, __int64))buf + 43))(buf, v2); } } @@ -2040,7 +2047,7 @@ v8 = 0; *a4 = 0; v11 = a2; - sub_193F8(a1, a2); + CoreDxeSectionExtractionContextInit(a1, a2); v14 = *(_DWORD *)(v13 + 92) == 274; *p_n3 = 0; while ( 1 ) @@ -2146,7 +2153,7 @@ } } *(_QWORD *)(a1 + 32) = a1 + 112; - if ( (unsigned int)sub_19484(a1, a2, a1 + 112) ) + if ( (unsigned int)CoreParseSectionHeader(a1, a2, a1 + 112) ) return 1; n0x14_1 = *(_DWORD *)(a1 + 32) - a1 - 112; if ( n0x14 < n0x14_1 ) @@ -2180,7 +2187,7 @@ src_1 = &src[n0x14_2 - 20]; } *(_QWORD *)(a1 + 32) = src; - if ( (unsigned int)sub_19484(a1, v11, (unsigned __int64)src_1) ) + if ( (unsigned int)CoreParseSectionHeader(a1, v11, (unsigned __int64)src_1) ) return 1; v24 = *(_QWORD *)(a1 + 32) - (_QWORD)src; src = *(char **)(a1 + 32); diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl/PiSmmIpl.c b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl/PiSmmIpl.c index aed4943..7b44886 100644 --- a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl/PiSmmIpl.c +++ b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl/PiSmmIpl.c @@ -202,10 +202,10 @@ } // ============================================================================= -// sub_16CC @ 0x16CC +// GetSmmCommunicationInterface @ 0x16CC // ============================================================================= -unsigned __int64 sub_16CC(__int64 a1, _QWORD *a2) +unsigned __int64 GetSmmCommunicationInterface(__int64 a1, _QWORD *a2) { if ( !a1 || !a2 ) /*0x16d4*/ return 0x8000000000000002uLL; /*0x16f8*/ @@ -216,10 +216,10 @@ } // ============================================================================= -// sub_1704 @ 0x1704 +// ConfigureSmramRangeDescriptor @ 0x1704 // ============================================================================= -unsigned __int64 sub_1704(__int64 a1, __int64 a2, _QWORD *p_n25) +unsigned __int64 ConfigureSmramRangeDescriptor(__int64 a1, __int64 a2, _QWORD *p_n25) { char *_smmc_; // rax char _smmc__1; // di char *_smmc__2; // rax __int64 Status; // rax if ( !a2 || !p_n25 || *p_n25 < 0x18u ) /*0x172d*/ return 0x8000000000000002uLL; /*0x17f6*/ @@ -261,7 +261,7 @@ qword_64D0 = 1; /*0x1821*/ byte_64D8 = 0; /*0x1833*/ n25 = 25; /*0x1841*/ - return sub_1704((__int64)&off_61A8, (__int64)&unk_64C0, &n25); /*0x184f*/ + return ConfigureSmramRangeDescriptor((__int64)&off_61A8, (__int64)&unk_64C0, &n25); /*0x184f*/ } // ============================================================================= @@ -285,7 +285,7 @@ qword_64D0 = 1; /*0x1913*/ n2 = 0; /*0x1921*/ p_n25 = 25; /*0x192f*/ - result = sub_1704((__int64)&off_61A8, (__int64)&qword_64C0, &p_n25); /*0x1938*/ + result = ConfigureSmramRangeDescriptor((__int64)&off_61A8, (__int64)&qword_64C0, &p_n25); /*0x1938*/ if ( n2 != 2 ) /*0x1944*/ break; /*0x1944*/ if ( (*(__int64 ( **)(__int64, __int64, __int64))(qword_6448 + 64))(qword_64E0, qword_64E8, 1) < 0 ) /*0x189d*/ @@ -346,7 +346,6 @@ if ( !byte_63E8 ) /*0x1a5b*/ { SmmIplDebugPrint(0x80000000LL, "EndOfDxe Event must be signaled before DxeSmmReadyToLock Protocol installation!\n"); /*0x1a69*/ - sub_4464(); /*0x1a6e*/ SmmIplDebugAssert("e:\\hs\\MdeModulePkg\\Core\\PiSmmCore\\PiSmmIpl.c", 768, "((BOOLEAN)(0==1))"); /*0x1a86*/ } (*(void ( **)(__int64))(qword_6490 + 16))(qword_6490); /*0x1a95*/ @@ -392,7 +391,6 @@ if ( !byte_63E8 ) /*0x1a5b*/ { SmmIplDebugPrint(0x80000000LL, "EndOfDxe Event must be signaled before DxeSmmReadyToLock Protocol installation!\n"); /*0x1a69*/ - sub_4464(); /*0x1a6e*/ SmmIplDebugAssert("e:\\hs\\MdeModulePkg\\Core\\PiSmmCore\\PiSmmIpl.c", 768, "((BOOLEAN)(0==1))"); /*0x1a86*/ } (*(void ( **)(__int64))(qword_6490 + 16))(qword_6490); /*0x1a95*/ @@ -433,7 +431,7 @@ { char *v3; // r12 __int64 v4; // r14 __int64 Result; // rbx unsigned __int64 v7; // rax __int64 Index; // rdi __int64 v9; // rsi int v10; // r8d int v11; // r9d __int64 result; // rax unsigned int v13; // r9d unsigned __int64 v14; // rbx unsigned __int64 v15; // rbx __int64 v16; // r8 __int64 v17; // rax char *v18; // r8 unsigned __int64 v19; // [rsp+30h] [rbp-A9h] BYREF __int64 v20; // [rsp+38h] [rbp-A1h] BYREF __int64 v21; // [rsp+40h] [rbp-99h] BYREF __int64 v22; // [rsp+48h] [rbp-91h] BYREF _BYTE v23[8]; // [rsp+50h] [rbp-89h] BYREF _BYTE v24[24]; // [rsp+58h] [rbp-81h] BYREF const void *v25; // [rsp+70h] [rbp-69h] BYREF __int64 v26; // [rsp+78h] [rbp-61h] __int64 ( *v27)(char *, __int64); // [rsp+88h] [rbp-51h] - __int64 ( *sub_422C_1)(__int64, __int64, __int64 *, __int64); // [rsp+90h] [rbp-49h] + __int64 ( *ReadFileBufferFn)(__int64, __int64, __int64 *, __int64); // [rsp+90h] [rbp-49h] __int64 v29; // [rsp+98h] [rbp-41h] unsigned int v30; // [rsp+A8h] [rbp-31h] __int64 v31; // [rsp+140h] [rbp+67h] BYREF __int64 v32; // [rsp+150h] [rbp+77h] BYREF __int64 v33; // [rsp+158h] [rbp+7Fh] BYREF v32 = a3; /*0x1b20*/ @@ -480,7 +478,7 @@ while ( v9 ); /*0x1c0b*/ if ( !v9 ) /*0x1c10*/ { - Result = sub_42D0(*(_QWORD *)(v33 + 8 *Index), (unsigned int)v24, v10, v11, (__int64)&v20, (__int64)v23); /*0x1c38*/ + Result = ReadFileBuffer(*(_QWORD *)(v33 + 8 *Index), (unsigned int)v24, v10, v11, (__int64)&v20, (__int64)v23); /*0x1c38*/ if ( Result >= 0 ) /*0x1c3e*/ break; /*0x1c3e*/ } @@ -502,7 +500,7 @@ if ( Result >= 0 ) /*0x1c73*/ { v29 = v20; /*0x1c82*/ - sub_422C_1 = ReadFileBuffer; /*0x1c8d*/ + ReadFileBufferFn = ReadFileBuffer; /*0x1c8d*/ result = RelocatePeCoffImage(&v25); /*0x1c91*/ if ( result < 0 ) /*0x1c99*/ return result; /*0x1c99*/ @@ -534,7 +532,7 @@ a2[3] = v17; /*0x1d47*/ v25 = (const void *)(~(v13 - 1LL) & (v13 - 1 + v16)); /*0x1d57*/ SmmIplDebugPrint(64, "SMM IPL loading SMM Core at SMRAM address %p\n", v25); /*0x1d5b*/ - Result = sub_3C30(&v25); /*0x1d69*/ + Result = LoadSmmCoreImage(&v25); /*0x1d69*/ if ( Result >= 0 ) /*0x1d6f*/ { Result = ApplyPeCoffFixups(&v25); /*0x1d7e*/ @@ -564,10 +562,10 @@ } // ============================================================================= -// sub_1E50 @ 0x1E50 +// SplitSmramRangeDescriptor @ 0x1E50 // ============================================================================= -__int64 sub_1E50( +__int64 SplitSmramRangeDescriptor( _QWORD *a1, unsigned __int64 *a2, __int64 a3, @@ -670,10 +668,10 @@ } // ============================================================================= -// sub_2098 @ 0x2098 +// BuildSmramDescriptorList @ 0x2098 // ============================================================================= -__int64 sub_2098(unsigned __int64 *a1) +__int64 BuildSmramDescriptorList(unsigned __int64 *a1) { __int64 v2; // rax __int64 v3; // rcx unsigned __int64 v4; // rsi unsigned __int64 v5; // rbx _QWORD *v6; // rax unsigned __int64 v7; // r15 __int64 v8; // r12 __int64 v9; // rdi unsigned __int64 v10; // r14 __int64 v11; // rcx __int64 v12; // rcx __int64 v13; // r13 unsigned __int64 v14; // rdi __int64 v15; // r14 __int64 v16; // rax unsigned __int64 v17; // rcx __int64 v18; // r12 unsigned __int64 v19; // rax char v20; // r15 unsigned __int64 *v21; // r14 __int64 v22; // r11 unsigned __int64 *v23; // rbx unsigned __int64 v24; // r8 unsigned __int64 v25; // rdx __int64 v26; // rcx __int64 v27; // rax __int64 v28; // rsi unsigned __int64 v29; // rbx _QWORD *v30; // rax unsigned __int64 v31; // rcx __int64 v32; // r8 _QWORD *v33; // rdx __int64 v34; // rbx __int64 v36; // rdi __int64 v37; // rax __int64 v38; // rbx __int64 v39; // rax _QWORD *v40; // [rsp+40h] ... [9911 chars total] @@ -732,7 +730,7 @@ (__int64)"(Length - 1) <= (0xFFFFFFFFFFFFFFFFULL - (UINTN)SourceBuffer)"); if ( a1 == a2 ) /*0x2c56*/ return a1; /*0x2c58*/ - else return sub_1000(a1, a2, n16); /*0x2c66*/ + else return CopyMem(a1, a2, n16); /*0x2c66*/ } // ============================================================================= @@ -759,10 +757,10 @@ } // ============================================================================= -// sub_2CF8 @ 0x2CF8 +// GetDebugPrintProtocol @ 0x2CF8 // ============================================================================= -__int64 sub_2CF8() +__int64 GetDebugPrintProtocol() { __int64 result; // rax unsigned __int64 n0x10; // rbx __int64 v2; // rax __int64 Result; // rcx result = qword_6430; /*0x2d02*/ if ( !qword_6430 ) /*0x2d0e*/ @@ -794,7 +792,7 @@ __int64 DebugPrint(__int64 a1, const char *a2, ...) { __int64 result; // rax __int64 v4; // r8 __int64 ( **v5)(__int64, const char *, __int64 *); // r9 unsigned __int8 v6; // al unsigned __int8 n3; // al int Result; // edx va_list va; // [rsp+40h] [rbp+18h] BYREF va_start(va, a2); - result = sub_2CF8(); /*0x2d97*/ + result = GetDebugPrintProtocol(); /*0x2d97*/ v4 = 0; /*0x2d9c*/ v5 = (__int64 ( **)(__int64, const char *, __int64 *))result; /*0x2d9f*/ if ( result ) /*0x2da5*/ @@ -830,7 +828,7 @@ __int64 DebugAssert(__int64 a1, __int64 a2, __int64 a3) { - __int64 result; // rax result = sub_2CF8(); /*0x2e18*/ + __int64 result; // rax result = GetDebugPrintProtocol(); /*0x2e18*/ if ( result ) /*0x2e20*/ return (*(__int64 ( **)(__int64, __int64, __int64))(result + 8))(a1, a2, a3); /*0x2e2b*/ return result; /*0x2e38*/ @@ -857,10 +855,10 @@ } // ============================================================================= -// sub_2E74 @ 0x2E74 +// GetSmramConfigurationTableEntry @ 0x2E74 // ============================================================================= -__int64 sub_2E74(__int64 a1, __int64 a2) +__int64 GetSmramConfigurationTableEntry(__int64 a1, __int64 a2) { __int64 v2; // rax __int64 Result; // rcx __int64 v5; // [rsp+40h] [rbp+18h] BYREF v2 = (*(__int64 ( **)(__int64, __int64, __int64 *))(BootServices + 64))(4, a2, &v5); /*0x2e89*/ Result = v5; /*0x2e8c*/ @@ -1368,10 +1366,10 @@ } // ============================================================================= -// sub_3C30 @ 0x3C30 +// LoadSmmCoreImage @ 0x3C30 // ============================================================================= -signed __int64 sub_3C30(__int64 a1) +signed __int64 LoadSmmCoreImage(__int64 a1) { unsigned __int64 v1; // rsi signed __int64 result; // rax __int64 v4; // rcx __int64 v5; // r8 __int64 v6; // rax __int64 v7; // rdx unsigned int v8; // r11d __int64 v9; // r8 __int64 v10; // r9 __int64 v11; // rbx unsigned __int64 v12; // rax unsigned int *v13; // r13 __int64 v14; // rax __int64 v15; // r12 __int64 v16; // r10 unsigned __int64 v17; // rdx __int64 v18; // r9 unsigned __int64 v19; // r14 __int64 v20; // r14 unsigned __int64 v21; // r8 __int64 v22; // r8 unsigned __int64 v23; // rax __int16 n523; // r8 unsigned __int64 v25; // rdx unsigned __int64 v26; // rcx unsigned __int64 v27; // rax unsigned int v28; // r10d unsigned __int64 v29; // rcx __int64 v30; // rcx unsigned int n5; // eax __int64 n164; // rcx unsigned __int64 v33; // rax unsigned __int64 v34; // r14 _DWORD *v35; // r14 unsigned int v36; // r12d unsigned int v37; // r8d unsigned int v38; ... [12968 chars total] @@ -1457,5 +1455,5 @@ (__int64)"e:\\hs\\MdePkg\\Library\\BaseMemoryLibRepStr\\ZeroMemWrapper.c", 54, (__int64)"Length <= (0xFFFFFFFFFFFFFFFFULL - (UINTN)Buffer + 1)"); - return sub_1070(a1, a2); /*0x4510*/ + return ZeroMem(a1, a2); /*0x4510*/ } diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl/PiSmmIpl.h b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl/PiSmmIpl.h index eaf7c32..b549106 100644 --- a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl/PiSmmIpl.h +++ b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl/PiSmmIpl.h @@ -615,7 +615,7 @@ EFI_STATUS EFIAPI -result = sub_2CF8(); /*0x2e18*/( +GetDebugPrintProtocol( VOID ); @@ -1111,4 +1111,4 @@ VOID ); -#endif /* __PISMMIPL_H__ */ \ No newline at end of file +#endif /* __PISMMIPL_H__ */ diff --git a/MdeModulePkg/Universal/CapsulePei/Common/CapsuleX64/CapsuleX64.c b/MdeModulePkg/Universal/CapsulePei/Common/CapsuleX64/CapsuleX64.c index 86d65fd..098fe90 100644 --- a/MdeModulePkg/Universal/CapsulePei/Common/CapsuleX64/CapsuleX64.c +++ b/MdeModulePkg/Universal/CapsulePei/Common/CapsuleX64/CapsuleX64.c @@ -74,7 +74,7 @@ } /*============================================================================= - * AsmReadCr3 - Read CR3 register sub_FFE447A4 + * AsmReadCr3 - Read CR3 register *============================================================================*/ UINT64 AsmReadCr3(void) { @@ -82,7 +82,7 @@ } /*============================================================================= - * AsmReadCr2 - Read CR2 register sub_FFE447E4 + * AsmReadCr2 - Read CR2 register *============================================================================*/ UINT64 AsmReadCr2(void) { @@ -90,7 +90,7 @@ } /*============================================================================= - * AsmReadCs - Read CS segment selector sub_FFE447F4 + * AsmReadCs - Read CS segment selector *============================================================================*/ UINT16 AsmReadCs(void) { @@ -100,7 +100,7 @@ } /*============================================================================= - * AsmWriteIdtr - Load IDTR (disable interrupts) sub_FFE44884 + * AsmWriteIdtr - Load IDTR (disable interrupts) *============================================================================*/ void AsmWriteIdtr(UINT16 *pLimit) { @@ -111,7 +111,7 @@ } /*============================================================================= - * AsmReadIdtr - Read IDTR with null check sub_FFE460E8 + * AsmReadIdtr - Read IDTR with null check *============================================================================*/ void AsmReadIdtr(void *pIdtr) { @@ -123,7 +123,7 @@ } /*============================================================================= - * AsmCpuid - Execute CPUID instruction sub_FFE447B4 + * AsmCpuid - Execute CPUID instruction *============================================================================*/ UINT64 AsmCpuid(UINT32 Leaf, UINT32 *pEax, UINT32 *pEbx, UINT32 *pEcx, UINT32 *pEdx) @@ -140,7 +140,7 @@ } /*============================================================================= - * AsmCpuidEx - Execute CPUID with subleaf sub_FFE44D44 + * AsmCpuidEx - Execute CPUID with subleaf *============================================================================*/ UINT64 AsmCpuidEx(UINT32 Leaf, UINT32 Subleaf, UINT32 *pEax, UINT32 *pEbx, @@ -158,7 +158,7 @@ } /*============================================================================= - * AsmDisablePaging64 - Disable paging, far return sub_FFE44804 + * AsmDisablePaging64 - Disable paging, far return * * Copies a trampoline code block to NewStack area, then executes a * far return (retfq) to transition to 32-bit compat mode, disable @@ -182,7 +182,7 @@ } /*============================================================================= - * InternalZeroMem sub_FFE44734 + * InternalZeroMem *============================================================================*/ void *InternalZeroMem(void *Buffer, UINT64 Size) { @@ -192,7 +192,7 @@ } /*============================================================================= - * InternalCopyMem sub_FFE44754 + * InternalCopyMem *============================================================================*/ void *InternalCopyMem(void *Dest, const void *Src, UINT64 Count) { @@ -215,7 +215,7 @@ } /*============================================================================= - * ZeroMem - Zero memory with bounds check sub_FFE45FE8 + * ZeroMem - Zero memory with bounds check *============================================================================*/ void *ZeroMem(void *Buffer, UINT64 Size) { @@ -233,18 +233,18 @@ } /*============================================================================= - * CopyMem - Copy memory with bounds checks sub_FFE4604C + * CopyMem - Copy memory with bounds checks *============================================================================*/ void *CopyMem(void *Dest, const void *Src, UINT64 Count) { if (Count) { - UINT64 v7 = Count - 1; - if (v7 > ~(UINT64)Dest) { + UINT64 CountMinusOne = Count - 1; + if (CountMinusOne > ~(UINT64)Dest) { AssertFail((UINT64)"e:\\hs\\MdePkg\\Library\\BaseMemoryLibRepStr" "\\CopyMemWrapper.c", 56, (UINT64)"(Length - 1) <= (0xFFFFFFFFFFFFFFFFULL - (UINTN)DestinationBuffer)"); } - if (v7 > ~(UINT64)Src) { + if (CountMinusOne > ~(UINT64)Src) { AssertFail((UINT64)"e:\\hs\\MdePkg\\Library\\BaseMemoryLibRepStr" "\\CopyMemWrapper.c", 57, (UINT64)"(Length - 1) <= (0xFFFFFFFFFFFFFFFFULL - (UINTN)SourceBuffer)"); @@ -257,7 +257,7 @@ } /*============================================================================= - * InternalLShiftU64 - 64-bit left shift sub_FFE4611C + * InternalLShiftU64 - 64-bit left shift *============================================================================*/ UINT64 InternalLShiftU64(UINT64 Value, UINT64 Count) { @@ -269,7 +269,7 @@ } /*============================================================================= - * BitFieldReadU64 - Extract bit field from UINT64 sub_FFE46160 + * BitFieldReadU64 - Extract bit field from UINT64 *============================================================================*/ UINT64 BitFieldReadU64(UINT64 Value, UINT64 StartBit, UINT64 EndBit) { @@ -286,7 +286,7 @@ } /*============================================================================= - * AsciiStrLen - Get ASCII string length sub_FFE46834 + * AsciiStrLen - Get ASCII string length *============================================================================*/ UINT64 AsciiStrLen(const char *String) { @@ -306,7 +306,7 @@ } /*============================================================================= - * InternalPrintPad - Pad ASCII/Unicode string sub_FFE46944 + * InternalPrintPad - Pad ASCII/Unicode string *============================================================================*/ UINT8 *InternalPrintPad(UINT8 *Buffer, UINT64 BufferSize, UINT64 Count, UINT16 Char, UINT64 CharWidth) @@ -324,7 +324,7 @@ } /*============================================================================= - * SerialPortWrite - write buffer to serial port sub_FFE4781C + * SerialPortWrite - write buffer to serial port * * Uses CMOS to check serial port type (COM1=0x3F8 vs SP1=0x2F8). * Writes data in chunks of up to 16 bytes. @@ -332,17 +332,17 @@ *============================================================================*/ UINT64 SerialPortWrite(UINT8 *Buffer, UINT64 Size) { - UINT16 n1016 = 0x3F8; /* COM1 base */ + UINT16 SerialBase = 0x3F8; __outbyte(0x72, 0x5C); - UINT8 n33 = __inbyte(0x73); - if (n33 == 33) - n1016 = 0x2F8; /* SP1 base */ + UINT8 CmosValue = __inbyte(0x73); + if (CmosValue == 33) + SerialBase = 0x2F8; if (!Size) { INT16 timeout = 0; for (;;) { - UINT8 status = __inbyte(n1016 + 5); + UINT8 status = __inbyte(SerialBase + 5); if ((status & 0x60) == 0x60) break; if (++timeout == 0xFFFF) @@ -356,7 +356,7 @@ while (remaining) { INT16 timeout = 0; for (;;) { - UINT8 status = __inbyte(n1016 + 5); + UINT8 status = __inbyte(SerialBase + 5); if (status & 0x40) break; if (++timeout == 0xFFFF) @@ -364,7 +364,7 @@ } UINT64 chunk = 0; while (chunk < 0x10 && remaining) { - __outbyte(n1016, *p); + __outbyte(SerialBase, *p); p++; remaining--; chunk++; } } @@ -372,7 +372,7 @@ } /*============================================================================= - * DebugPrint - Debug print with level filtering sub_FFE46228 + * DebugPrint - Debug print with level filtering * * Checks debug level via CMOS (NVRAM offset 0x4A). * Error level mask: 0x80000002 (verbose) or 0x80000004 (error only). @@ -389,29 +389,29 @@ (UINT64)"Format != ((void *) 0)"); } - UINT8 n53 = __inbyte(0x70); - __outbyte(0x70, (n53 & 0x80) | 0x4A); - UINT8 n3 = __inbyte(0x71); + UINT8 CmosIndex = __inbyte(0x70); + __outbyte(0x70, (CmosIndex & 0x80) | 0x4A); + UINT8 DebugMask = __inbyte(0x71); - if ((UINT8)n3 > 3) { - if (!n3) - n3 = (*(volatile UINT8 *)0xFDAF0490 & 2) | 1; + if ((UINT8)DebugMask > 3) { + if (!DebugMask) + DebugMask = (*(volatile UINT8 *)0xFDAF0490 & 2) | 1; } UINT64 LevelMask = 0x80000002ULL; - if (n3 == 1) + if (DebugMask == 1) LevelMask = 0x80000004ULL; if (!(LevelMask & ErrorLevel)) - return n3 - 1; + return DebugMask - 1; InternalVSPrint((UINT8 *)Buffer, 256, 0, (char *)ErrorLevel, Va); - UINT64 Len = AsciiStrLen(Buffer); - return (UINT8)SerialPortWrite((UINT8 *)Buffer, Len); + UINT64 Length = AsciiStrLen(Buffer); + return (UINT8)SerialPortWrite((UINT8 *)Buffer, Length); } /*============================================================================= - * AssertFail - Print ASSERT message sub_FFE462FC + * AssertFail - Print ASSERT message *============================================================================*/ UINT64 AssertFail(UINT64 Filename, INT32 LineNumber, UINT64 Expression) { @@ -419,12 +419,12 @@ InternalVSPrint((UINT8 *)Buffer, 256, 0, "ASSERT [%a] %a(%d): %a\n", (va_list)&Filename); - UINT64 Len = AsciiStrLen(Buffer); - return SerialPortWrite((UINT8 *)Buffer, Len); + UINT64 Length = AsciiStrLen(Buffer); + return SerialPortWrite((UINT8 *)Buffer, Length); } /*============================================================================= - * DebugPrintWorker - format and print debug string sub_FFE467DC + * DebugPrintWorker - format and print debug string *============================================================================*/ UINT64 DebugPrintWorker(const char *Format, ...) { @@ -432,12 +432,12 @@ va_list Va; va_start(Va, Format); InternalVSPrint((UINT8 *)Buffer, 256, 0, Format, Va); - UINT64 Len = AsciiStrLen(Buffer); - return SerialPortWrite((UINT8 *)Buffer, Len); + UINT64 Length = AsciiStrLen(Buffer); + return SerialPortWrite((UINT8 *)Buffer, Length); } /*============================================================================= - * InternalVSPrint - Main format engine sub_FFE469F0 + * InternalVSPrint - Main format engine * * Implements a significant subset of the EDK II PrintLib format * engine: handles %a, %s, %d, %x, %lx, %016lx, %r, and other @@ -456,7 +456,7 @@ } /*============================================================================= - * CapuleX64Entry - Page fault handler entry sub_FFE44674 + * CapsuleX64Entry - Page fault handler entry * * Entry point for the capsule long-mode page fault handler. * Called from PageFaultHandlerWrapper which sets MXCSR and @@ -470,7 +470,7 @@ } /*============================================================================= - * SetPageFaultHandled - Set page fault flag sub_FFE44CBC + * SetPageFaultHandled - Set page fault flag *============================================================================*/ void SetPageFaultHandled(UINT8 Flag) { @@ -479,7 +479,7 @@ } /*============================================================================= - * GetPageTableInfo - Initialize page fault dispatch sub_FFE44C98 + * InitPageFaultHandler - Initialize page fault dispatch *============================================================================*/ void InitPageFaultHandler(void (**Table)()) { @@ -489,22 +489,22 @@ } /*============================================================================= - * AllocatePageTablePage - Allocate a 4KB page table sub_FFE44D98 + * AllocatePageTablePage - Allocate a 4KB page table *============================================================================*/ UINT64 AllocatePageTablePage(PAGE_TABLE_CONTEXT *ptCtx, UINT64 *pPteAddr) { - UINT64 v4 = (UINT64)ptCtx->PageTableStack + - (ptCtx->PageTableStackIndex << 12); - ZeroMem((void *)v4, 4096); + UINT64 PageTablePage = (UINT64)ptCtx->PageTableStack + + (ptCtx->PageTableStackIndex << 12); + ZeroMem((void *)PageTablePage, 4096); - UINT64 v5 = ptCtx->PhysicalAddressBits; - UINT64 *v6 = (UINT64 *)ptCtx->PageTableStack[ + UINT64 PhysMask = ptCtx->PhysicalAddressBits; + UINT64 *PreviousPte = (UINT64 *)ptCtx->PageTableStack[ ptCtx->PageTableStackIndex + 5]; - if (v6 && (*v6 & ~v5 & ptCtx->PageMapLevel4Table) == v4) - *v6 = 0; + if (PreviousPte && (*PreviousPte & ~PhysMask & ptCtx->PageMapLevel4Table) == PageTablePage) + *PreviousPte = 0; - *pPteAddr = v4 | v5 | 3; + *pPteAddr = PageTablePage | PhysMask | 3; ptCtx->PageTableStack[ptCtx->PageTableStackIndex + 5] = (UINT64)pPteAddr; UINT64 result = ((UINT8)ptCtx->PageTableStackIndex + 1) & 7; @@ -513,7 +513,7 @@ } /*============================================================================= - * PageFaultHandlerCore - X64 page fault handler sub_FFE44E24 + * PageFaultHandlerCore - X64 page fault handler * * Implements demand-paged page table allocation for capsule long mode. * On a page fault, reads CR2 to get the faulting address, then @@ -572,7 +572,7 @@ } /*============================================================================= - * PageFaultHandlerWrapper sub_FFE44674 + * PageFaultHandlerWrapper *============================================================================*/ void PageFaultHandlerWrapper(UINT64 a1, UINT64 a2, UINT64 a3, UINT64 a4) @@ -585,7 +585,7 @@ } /*============================================================================= - * ValidateMemoryResource - check address range sub_FFE452F0 + * ValidateMemoryResource - check address range *============================================================================*/ BOOLEAN ValidateMemoryResource( MEMORY_RESOURCE_DESCRIPTOR *MemResources, @@ -622,7 +622,7 @@ } /*============================================================================= - * ValidateCapsuleIntegrity sub_FFE453A8 + * ValidateCapsuleIntegrity *============================================================================*/ UINT64 ValidateCapsuleIntegrity(UINT64 BlockList, MEMORY_RESOURCE_DESCRIPTOR *MemResources) @@ -719,7 +719,7 @@ } /*============================================================================= - * GetCapsuleInfo - Get capsule count/size sub_FFE4576C + * GetCapsuleInfo - Get capsule count/size *============================================================================*/ EFI_STATUS GetCapsuleInfo(EFI_CAPSULE_BLOCK_DESCRIPTOR *Desc, UINT64 *CapsuleCount, UINT64 *TotalLength, @@ -791,7 +791,7 @@ } /*============================================================================= - * FindFreeMemoryInDescriptors sub_FFE45234 + * FindFreeMemoryInDescriptors * * Scans a memory resource descriptor array to find a free region * large enough to hold a buffer of Size bytes. Handles overlapping @@ -802,55 +802,55 @@ UINT64 Size, UINT64 SourceBase) { - UINT64 *v6 = (UINT64 *)((UINT8 *)Target + Size - (UINT64)Target); - UINT64 *v7 = ResourceArray; + UINT64 *TargetEnd = (UINT64 *)((UINT8 *)Target + Size - (UINT64)Target); + UINT64 *Resource = ResourceArray; - for (; v7 != NULL; ) { - if (!v7) + for (; Resource != NULL; ) { + if (!Resource) return Target; - UINT64 n2 = 2; - if (*v7) { + UINT64 EntryCount = 2; + if (*Resource) { do - n2 += 2; - while (v7[n2 - 2]); + EntryCount += 2; + while (Resource[EntryCount - 2]); } - if ((UINT64 *)((UINT8 *)Target + (UINT64)Target) > v7) { - UINT64 *v11 = (UINT64 *)&v7[n2]; - if (Target < &v7[n2]) { - Target = &v7[n2]; - v7 = ResourceArray; - if ((UINT64)v11 <= (UINT64)v6) + if ((UINT64 *)((UINT8 *)Target + (UINT64)Target) > Resource) { + UINT64 *NextEntry = (UINT64 *)&Resource[EntryCount]; + if (Target < &Resource[EntryCount]) { + Target = &Resource[EntryCount]; + Resource = ResourceArray; + if ((UINT64)NextEntry <= (UINT64)TargetEnd) continue; return 0; } } while (1) { - UINT64 Val = *v7; - if (!Val) + UINT64 RangeBase = *Resource; + if (!RangeBase) break; - UINT64 v12 = v7[1]; - if ((UINT64)Target + (UINT64)Target > v12 && - (UINT64)Target < Val + v12) { - Target = (UINT64 *)(v12 + Val); - v7 = ResourceArray; - if ((UINT64)(v12 + Val) > (UINT64)v6) + UINT64 RangeSize = Resource[1]; + if ((UINT64)Target + (UINT64)Target > RangeSize && + (UINT64)Target < RangeBase + RangeSize) { + Target = (UINT64 *)(RangeSize + RangeBase); + Resource = ResourceArray; + if ((UINT64)(RangeSize + RangeBase) > (UINT64)TargetEnd) return 0; break; } - v7 += 2; + Resource += 2; } - if (!*v7) - v7 = (UINT64 *)v7[1]; + if (!*Resource) + Resource = (UINT64 *)Resource[1]; } return Target; } /*============================================================================= - * RelocateCapsuleDescriptors sub_FFE455AC + * RelocateCapsuleDescriptors *============================================================================*/ UINT64 *RelocateCapsuleDescriptors( EFI_CAPSULE_BLOCK_DESCRIPTOR *Desc, @@ -860,87 +860,87 @@ UINT64 ScratchSize) { UINT64 TotalSize = 16 * DescriptorCount; - UINT64 *v7 = (UINT64 *)Desc; - UINT64 v10 = (UINT64)&FlatBuffer[TotalSize / 8]; + UINT64 *Cursor = (UINT64 *)Desc; + UINT64 FlatEnd = (UINT64)&FlatBuffer[TotalSize / 8]; if (ScratchSize < TotalSize) return 0; /* Walk linked list, fix up overlapping descriptor data */ - while (v7[1]) { - if (*v7) { - UINT64 *v14 = (UINT64 *)v7[1]; - if ((UINT64 *)v10 > v7[1] && - FlatBuffer < (UINT64 *)((char *)v14 + *v7)) { - UINT64 *v16 = FindFreeMemoryInDescriptors( - (UINT64 *)v7, (UINT64 *)v10, - ScratchSize - TotalSize, *v7); - if (!v16) + while (Cursor[1]) { + if (*Cursor) { + UINT64 *Source = (UINT64 *)Cursor[1]; + if ((UINT64 *)FlatEnd > Cursor[1] && + FlatBuffer < (UINT64 *)((char *)Source + *Cursor)) { + UINT64 *Destination = FindFreeMemoryInDescriptors( + (UINT64 *)Cursor, (UINT64 *)FlatEnd, + ScratchSize - TotalSize, *Cursor); + if (!Destination) return 0; - CopyMem(v16, v14, *v7); + CopyMem(Destination, Source, *Cursor); DebugPrint(64, "Capsule relocate descriptors from/to/size " "0x%lX 0x%lX 0x%lX\n", - (UINT64)v7[1], (UINT64)v16, *v7); - v7[1] = (UINT64)v16; + (UINT64)Cursor[1], (UINT64)Destination, *Cursor); + Cursor[1] = (UINT64)Destination; } - v7 += 2; + Cursor += 2; } else { - v7 = (UINT64 *)v7[1]; + Cursor = (UINT64 *)Cursor[1]; } } /* Second pass: fix up descriptor block addresses */ - UINT64 *v17 = (UINT64 *)v7; - UINT64 *v18 = 0; + UINT64 *Walker = (UINT64 *)Cursor; + UINT64 *Previous = 0; - while (v17) { - if (!v17[1]) + while (Walker) { + if (!Walker[1]) break; - UINT64 *v19 = v17; - UINT64 i; - for (i = 2; *v19; i += 2) - v19 += 2; + UINT64 *Tail = Walker; + UINT64 Index; + for (Index = 2; *Tail; Index += 2) + Tail += 2; - if ((UINT64 *)v10 > v17 && FlatBuffer < &v17[i]) { - UINT64 *v22 = FindFreeMemoryInDescriptors( - (UINT64 *)v7, (UINT64 *)v10, - ScratchSize - TotalSize, i * 8); - if (!v22) + if ((UINT64 *)FlatEnd > Walker && FlatBuffer < &Walker[Index]) { + UINT64 *Relocated = FindFreeMemoryInDescriptors( + (UINT64 *)Cursor, (UINT64 *)FlatEnd, + ScratchSize - TotalSize, Index * 8); + if (!Relocated) return 0; - CopyMem(v22, v17, i * 8); + CopyMem(Relocated, Walker, Index * 8); DebugPrint(64, "Capsule reloc descriptor block #2\n"); - if (v18) - v18[1] = (UINT64)v22; + if (Previous) + Previous[1] = (UINT64)Relocated; else - v7 = v22; + Cursor = Relocated; } - v17 = (UINT64 *)v19[1]; - v18 = v19; + Walker = (UINT64 *)Tail[1]; + Previous = Tail; } /* Flatten to output buffer */ - UINT64 *v23 = FlatBuffer; - while (v7) { - UINT64 v24 = v7[1]; - if (!v24) + UINT64 *Output = FlatBuffer; + while (Cursor) { + UINT64 Next = Cursor[1]; + if (!Next) break; - if (*v7) { - v23[1] = v24; - *v23 = *v7; - v23 += 2; - v7 += 2; + if (*Cursor) { + Output[1] = Next; + *Output = *Cursor; + Output += 2; + Cursor += 2; } else { - v7 = (UINT64 *)v7[1]; + Cursor = (UINT64 *)Cursor[1]; } } - v23[1] = 0; - *v23 = 0; + Output[1] = 0; + *Output = 0; return FlatBuffer; } /*============================================================================= - * DumpExceptionContext - dump CPU context sub_FFE464B4 + * DumpExceptionContext - dump CPU context *============================================================================*/ UINT64 DumpExceptionContext(void *ExceptionType, UINT64 *ContextRecord) @@ -1001,7 +1001,7 @@ } /*============================================================================= - * X64ExceptionHandler sub_FFE44A83 + * X64ExceptionHandler *============================================================================*/ void X64ExceptionHandler(UINT64 ExceptionType, UINT64 *ContextRecord) @@ -1010,7 +1010,7 @@ } /*============================================================================= - * FindAndLogImageInfo - find PE/COFF from RIP sub_FFE46350 + * FindAndLogImageInfo - find PE/COFF from RIP *============================================================================*/ void FindAndLogImageInfo(void *ExceptionType, UINT64 *ContextRecord) @@ -1079,7 +1079,7 @@ } /*============================================================================= - * PeCoffGetPdbPath - Get PDB path from PE/COFF sub_FFE478C4 + * PeCoffGetPdbPath - Get PDB path from PE/COFF *============================================================================*/ char *PeCoffGetPdbPath(char *Pe32Data) { @@ -1130,7 +1130,7 @@ } /*============================================================================= - * GetApicId - Get APIC ID sub_FFE47B10 + * GetApicId - Get APIC ID *============================================================================*/ UINT64 GetApicId(void) { @@ -1140,7 +1140,7 @@ } /*============================================================================= - * ModuleEntryPoint - Main entry point sub_FFE44F58 + * ModuleEntryPoint - Main entry point * * Called by PEI dispatcher. Saves IDT, sets up page fault handler * IDT entries, validates capsule integrity, coalesces capsule data, @@ -1153,8 +1153,8 @@ IDTR Idtr; UINT16 n543[8]; UINT8 v33[544]; - UINT8 *v11 = v33; - UINT64 v25[4]; + UINT8 *Scratch = v33; + UINT64 IdtTable[4]; UINT8 v26; UINT64 v27, v28, v29, v30; char v31[64]; @@ -1181,7 +1181,7 @@ n32 = 32; UINT16 v6 = AsmReadCs(); - InitPageFaultHandler((void (**)())v25); + InitPageFaultHandler((void (**)())IdtTable); /* Fill IDT entries with page fault handler */ UINT64 n32_1 = 0; @@ -1189,9 +1189,9 @@ UINT64 v8 = (UINT64)&Idtr.Base + 6; do { *(UINT16 *)(v8 - 4) = v6; /* Segment selector = CS */ - UINT64 v9 = n32_1 * (UINT64)v25[1]; + UINT64 v9 = n32_1 * (UINT64)IdtTable[1]; n32_1++; - UINT64 v10 = (UINT64)v25[0] + v9; + UINT64 v10 = (UINT64)IdtTable[0] + v9; *(UINT16 *)(v8 - 6) = (UINT16)v10; *(UINT16 *)v8 = (UINT16)(v10 >> 16); *(UINT32 *)(v8 + 2) = (UINT32)(v10 >> 32); @@ -1215,13 +1215,13 @@ v27 = (InternalLShiftU64(1, n36) - 1) & 0xFFFFFFFFF000ULL; /* Set page fault handler address in scratch */ - *((UINT16 *)v11 + 112) = (UINT16)(UINT64)PageFaultHandlerWrapper; + *((UINT16 *)Scratch + 112) = (UINT16)(UINT64)PageFaultHandlerWrapper; v13 = AsmReadCs(); - *((UINT32 *)v11 + 59) = 0; - *((UINT16 *)v11 + 113) = v13; - *((UINT16 *)v11 + 115) = (UINT64)PageFaultHandlerWrapper >> 16; - *((UINT16 *)v11 + 114) = 0x8E00; - *((UINT32 *)v11 + 58) = (UINT64)PageFaultHandlerWrapper >> 32; + *((UINT32 *)Scratch + 59) = 0; + *((UINT16 *)Scratch + 113) = v13; + *((UINT16 *)Scratch + 115) = (UINT64)PageFaultHandlerWrapper >> 16; + *((UINT16 *)Scratch + 114) = 0x8E00; + *((UINT32 *)Scratch + 58) = (UINT64)PageFaultHandlerWrapper >> 32; if (v26) v14 = (v27 & AsmReadCr3()) + 0x2000; @@ -1270,4 +1270,4 @@ "CapsulePei\\X64\\X64Entry.c", 309, (UINT64)"((BOOLEAN)(0==1))"); return EFI_SUCCESS; -} \ No newline at end of file +} diff --git a/MdeModulePkg/Universal/CapsulePei/Common/CapsuleX64/CapsuleX64.h b/MdeModulePkg/Universal/CapsulePei/Common/CapsuleX64/CapsuleX64.h index f833aa8..c1b7d58 100644 --- a/MdeModulePkg/Universal/CapsulePei/Common/CapsuleX64/CapsuleX64.h +++ b/MdeModulePkg/Universal/CapsulePei/Common/CapsuleX64/CapsuleX64.h @@ -1,26 +1,10 @@ #ifndef __CAPSULEX64_H__ -#define __ +#define __CAPSULEX64_H__ #include "../uefi_headers/Uefi.h" -CAPSULEX64_H__ - -/*============================================================================= - * CapsuleX64.efi - Capsule PEI X64 Module - * MD5: f20dc2f52ef47aa5bb67065361900b0a - * SHA256: f375c4b961d442295e12bd69e7648e2f45cf4a0d5c35f1795b611656107dbfcc - * - * Source: MdeModulePkg/Universal/CapsulePei/X64/ - * PEI module for x64 capsule update support. Handles page fault - * management during long-mode capsule coalescing, capsule descriptor - * validation/relocation, and the transition back to 32-bit mode via - * DisablePaging64. - *============================================================================*/ #pragma pack(push, 1) -/*============================================================================= - * EFI Basic Types - *============================================================================*/ typedef unsigned char UINT8; typedef unsigned short UINT16; typedef unsigned int UINT32; @@ -48,9 +32,6 @@ #define EFI_OUT_OF_RESOURCES 0x8000000000000009ULL #define EFI_NOT_FOUND 0x800000000000000EULL -/*============================================================================= - * EFI_GUID - *============================================================================*/ typedef struct { UINT32 Data1; UINT16 Data2; @@ -58,9 +39,6 @@ UINT8 Data4[8]; } EFI_GUID; -/*============================================================================= - * EFI_TABLE_HEADER - *============================================================================*/ typedef struct { UINT64 Signature; UINT32 Revision; @@ -69,9 +47,6 @@ UINT32 Reserved; } EFI_TABLE_HEADER; -/*============================================================================= - * EFI_SYSTEM_TABLE - *============================================================================*/ typedef struct { EFI_TABLE_HEADER Hdr; UINT16 *FirmwareVendor; @@ -88,9 +63,6 @@ void *ConfigurationTable; } EFI_SYSTEM_TABLE; -/*============================================================================= - * IDTR / GDTR structures - *============================================================================*/ typedef struct { UINT16 Limit; UINT64 Base; @@ -101,9 +73,6 @@ UINT64 Base; } GDTR; -/*============================================================================= - * EFI_CAPSULE_HEADER - *============================================================================*/ typedef struct { EFI_GUID CapsuleGuid; UINT32 HeaderSize; @@ -111,9 +80,6 @@ UINT32 CapsuleImageSize; } EFI_CAPSULE_HEADER; -/*============================================================================= - * EFI_CAPSULE_BLOCK_DESCRIPTOR - *============================================================================*/ typedef struct { UINT64 Length; union { @@ -122,49 +88,32 @@ } Union; } EFI_CAPSULE_BLOCK_DESCRIPTOR; -/*============================================================================= - * Memory Resource Descriptor - *============================================================================*/ typedef struct { UINT64 BaseAddress; UINT64 Length; } MEMORY_RESOURCE_DESCRIPTOR; -/*============================================================================= - * Page table context (ring buffer for page allocation) - *============================================================================*/ typedef struct { - UINT64 PageTableStack[8]; /* Page pool ring buffer entries */ - UINT64 PageTableStackIndex; /* Current index in ring buffer (0-7) */ - UINT64 PageMapLevel4Table; /* PML4 address/mask */ - UINT64 PhysicalAddressBits; /* Bits to mask for physical address */ + UINT64 PageTableStack[8]; + UINT64 PageTableStackIndex; + UINT64 PageMapLevel4Table; + UINT64 PhysicalAddressBits; } PAGE_TABLE_CONTEXT; -/*============================================================================= - * Function Prototypes - *============================================================================*/ - -/* ---- Entry point ---- */ EFI_STATUS ModuleEntryPoint(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable); void CapsuleX64Entry(UINT64 a1, UINT64 a2, UINT64 a3, UINT64 a4); - -/* ---- Page fault and exception handling ---- */ void PageFaultHandlerWrapper(UINT64 a1, UINT64 a2, UINT64 a3, UINT64 a4); UINT64 PageFaultHandlerCore(void); void X64ExceptionHandler(UINT64 ExceptionType, UINT64 *ContextRecord); void SetPageFaultHandled(UINT8 Flag); void InitPageFaultHandler(void (**Table)()); - -/* ---- CPUID ---- */ UINT64 AsmCpuid(UINT32 Leaf, UINT32 *pEax, UINT32 *pEbx, UINT32 *pEcx, UINT32 *pEdx); UINT64 AsmCpuidEx(UINT32 Leaf, UINT32 Subleaf, UINT32 *pEax, UINT32 *pEbx, UINT32 *pEcx, UINT32 *pEdx); - -/* ---- CR/segment ---- */ UINT64 AsmReadCr3(void); UINT64 AsmReadCr2(void); UINT16 AsmReadCs(void); @@ -174,8 +123,6 @@ EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable, UINT32 NewStack); - -/* ---- Capsule operations ---- */ UINT64 ValidateCapsuleIntegrity(UINT64 BlockList, MEMORY_RESOURCE_DESCRIPTOR *MemoryResources); EFI_STATUS GetCapsuleInfo(EFI_CAPSULE_BLOCK_DESCRIPTOR *Desc, @@ -186,20 +133,14 @@ UINT64 *MemoryResource, UINT64 **BlockDescriptors, UINT32 *CapsuleDescriptorCount); - -/* ---- Page table management ---- */ UINT64 AllocatePageTablePage(PAGE_TABLE_CONTEXT *ptCtx, UINT64 *pPteAddr); UINT64 BitFieldReadU64(UINT64 Value, UINT64 StartBit, UINT64 EndBit); UINT64 InternalLShiftU64(UINT64 Value, UINT64 Count); - -/* ---- Memory ---- */ void *InternalZeroMem(void *Buffer, UINT64 Size); void *InternalCopyMem(void *Dest, const void *Src, UINT64 Count); void *ZeroMem(void *Buffer, UINT64 Size); void *CopyMem(void *Dest, const void *Src, UINT64 Count); - -/* ---- Descriptor relocation ---- */ UINT64 *RelocateCapsuleDescriptors( EFI_CAPSULE_BLOCK_DESCRIPTOR *Desc, UINT64 *FlatBuffer, @@ -212,8 +153,6 @@ UINT64 SourceBase); BOOLEAN ValidateMemoryResource(MEMORY_RESOURCE_DESCRIPTOR *MemResources, UINT64 Address, UINT64 Size); - -/* ---- Debug ---- */ UINT8 DebugPrint(UINT64 ErrorLevel, const char *Format, ...); UINT64 AssertFail(UINT64 Filename, INT32 LineNumber, UINT64 Expression); @@ -243,4 +182,4 @@ #pragma pack(pop) -#endif /* __CAPSULEX64_H__ */ \ No newline at end of file +#endif /* __CAPSULEX64_H__ */ diff --git a/MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.h b/MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.h index d7f204b..cc8eb5b 100644 --- a/MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.h +++ b/MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.h @@ -1,7 +1,5 @@ /** @file - CapsuleRuntimeDxe.h -- Header for CapsuleRuntimeDxe - -Copyright (c) HR650X BIOS Decompilation Project + CapsuleRuntimeDxe.h - Capsule runtime driver declarations. **/ #ifndef __CAPSULERUNTIMEDXE_H__ @@ -9,620 +7,89 @@ #include "../uefi_headers/Uefi.h" -// -// Function Prototypes -// - EFI_STATUS EFIAPI -CapsuleRuntimeDxeDriverEntryPoint( - VOID -); +CapsuleRuntimeDxeDriverEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ); EFI_STATUS EFIAPI -CapsuleUpdateCapsule( - VOID -); +CapsuleUpdateCapsule ( + IN EFI_CAPSULE_HEADER **CapsuleHeaderArray, + IN UINT64 CapsuleCount, + IN EFI_PHYSICAL_ADDRESS ScatterGatherList OPTIONAL + ); EFI_STATUS EFIAPI -CapsuleQueryCapsuleCapabilities( - VOID -); +CapsuleQueryCapsuleCapabilities ( + IN EFI_CAPSULE_HEADER **CapsuleHeaderArray, + IN UINT64 CapsuleCount, + OUT UINT64 *MaxCapsuleSize, + OUT EFI_STATUS *ResetType + ); -EFI_STATUS +BOOLEAN EFIAPI -IsCapspaceGuidEqual( - VOID -); +IsCapspaceGuidEqual ( + IN EFI_GUID *Guid1, + IN EFI_GUID *Guid2 + ); -EFI_STATUS -EFIAPI -ReadUnaligned64( - VOID -); +UINT64 +ReadUnaligned64 ( + IN UINT64 *Buffer + ); EFI_STATUS EFIAPI -CheckCapsuleType( - VOID -); +CheckCapsuleType ( + IN EFI_CAPSULE_HEADER *CapsuleHeader + ); +STATIC EFI_STATUS -EFIAPI -GetCapsuleRuntimeProtocol( +GetCapsuleRuntimeProtocol ( VOID -); + ); -EFI_STATUS +VOID EFIAPI -ModuleEntryPoint( - VOID -); +VirtualAddressChangeEvent ( + IN EFI_EVENT Event, + IN VOID *Context + ); -EFI_STATUS +VOID EFIAPI -DebugAssertInternal( - VOID -); +ExitBootServicesEvent ( + IN EFI_EVENT Event, + IN VOID *Context + ); -EFI_STATUS +VOID EFIAPI -DebugPrint( - VOID -); +RuntimeCapsuleEvent ( + IN EFI_EVENT Event, + IN VOID *Context + ); -EFI_STATUS +VOID EFIAPI -VirtualAddressChangeEvent( - VOID -); +CapsuleRuntimeVariableEvent ( + IN EFI_EVENT Event, + IN VOID *Context + ); -EFI_STATUS -EFIAPI -ExitBootServicesEvent( - VOID -); +UINT64 +AsmCpuid ( + IN UINT32 Index, + OUT UINT32 *Eax OPTIONAL, + OUT UINT32 *Ebx OPTIONAL, + OUT UINT32 *Ecx OPTIONAL, + OUT UINT32 *Edx OPTIONAL + ); -EFI_STATUS -EFIAPI -RuntimeCapsuleEvent( - VOID -); - -EFI_STATUS -EFIAPI -CapsuleRuntimeVariableEvent( - VOID -); - -EFI_STATUS -EFIAPI -AsmCpuid( - VOID -); - -EFI_STATUS -EFIAPI -data - boot-time only references( - VOID -); - -EFI_STATUS -EFIAPI -gImageHandle = NULL;( - VOID -); - -EFI_STATUS -EFIAPI -copies for runtime transition( - VOID -); - -EFI_STATUS -EFIAPI -*gBS_Runtime = NULL;( - VOID -); - -EFI_STATUS -EFIAPI -configuration globals( - VOID -); - -EFI_STATUS -EFIAPI -gCapsuleMaxSize = 104857600; // 100 MB( - VOID -); - -EFI_STATUS -EFIAPI -MB( - VOID -); - -EFI_STATUS -EFIAPI -services function table (obtained via gBS->LocateProtocol)( - VOID -); - -EFI_STATUS -EFIAPI -the protocol GUID.( - VOID -); - -EFI_STATUS -EFIAPI -VOID *mCapsuleRuntimeProtocol = NULL;( - VOID -); - -EFI_STATUS -EFIAPI -{0x...} for the capsule runtime protocol (placeholder)( - VOID -); - -EFI_STATUS -EFIAPI -and unk_3030 are GUID structures used for GUID comparison( - VOID -); - -EFI_STATUS -EFIAPI -is a GUID table used by capsule type detection( - VOID -); - -EFI_STATUS -EFIAPI -prototypes (forward declarations for local functions)( - VOID -); - -EFI_STATUS -EFIAPI -EFIAPI( - VOID -); - -EFI_STATUS -EFIAPI -UEFI Boot/Runtime Services Library state( - VOID -); - -EFI_STATUS -EFIAPI -register the capsule runtime protocol.( - VOID -); - -EFI_STATUS -EFIAPI -(ImageHandle, SystemTable);( - VOID -); - -EFI_STATUS -EFIAPI -the capsule runtime protocol.( - VOID -); - -EFI_STATUS -EFIAPI -gBS->InstallMultipleProtocolInterfaces. Here we approximate the( - VOID -); - -EFI_STATUS -EFIAPI -that sets up gRT->UpdateCapsule / gRT->QueryCapsuleCapabilities.( - VOID -); - -EFI_STATUS -EFIAPI -decompiled code writes:( - VOID -); - -EFI_STATUS -EFIAPI -14( - VOID -); - -EFI_STATUS -EFIAPI -15( - VOID -); - -EFI_STATUS -EFIAPI -and install the capsule runtime protocol( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->InstallMultipleProtocolInterfaces (( - VOID -); - -EFI_STATUS -EFIAPI -on failure (debug builds only)( - VOID -); - -EFI_STATUS -EFIAPI -((EFI_D_ERROR, "\nASSERT_EFI_ERROR (Status = %r)\n", Status));( - VOID -); - -EFI_STATUS -EFIAPI -constructor( - VOID -); - -EFI_STATUS -EFIAPI -= ImageHandle;( - VOID -); - -EFI_STATUS -EFIAPI -= SystemTable->RuntimeServices;( - VOID -); - -EFI_STATUS -EFIAPI -copies for VirtualAddressChange event( - VOID -); - -EFI_STATUS -EFIAPI -= gBS;( - VOID -); - -EFI_STATUS -EFIAPI -VirtualAddressChange event (TPL_NOTIFY, EFI_EVENT_SIGNAL_VIRTUAL_ADDRESS_CHANGE)( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->CreateEvent (( - VOID -); - -EFI_STATUS -EFIAPI -ExitBootServices event (TPL_CALLBACK, EFI_EVENT_SIGNAL_EXIT_BOOT_SERVICES)( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->CreateEventEx (( - VOID -); - -EFI_STATUS -EFIAPI -constructor: initialize HOB list and register runtime capsule event( - VOID -); - -EFI_STATUS -EFIAPI -(gRT == NULL) {( - VOID -); - -EFI_STATUS -EFIAPI -event for runtime capsule update notification( - VOID -); - -EFI_STATUS -EFIAPI -runtime event for capsule variable (EfiRuntimeServicesData)( - VOID -); - -EFI_STATUS -EFIAPI -(sub_14FC)( - VOID -); - -EFI_STATUS -EFIAPI -capsule flags:( - VOID -); - -EFI_STATUS -EFIAPI -bit 17 (0x20000) = POPULATE_SYSTEM_TABLE( - VOID -); - -EFI_STATUS -EFIAPI -bit 18 (0x40000) = INITIATE_RESET( - VOID -); - -EFI_STATUS -EFIAPI -bit 17+18 (0x30000) mask( - VOID -); - -EFI_STATUS -EFIAPI -bit 18+19 (0x50000) mask( - VOID -); - -EFI_STATUS -EFIAPI -both bits 17 and 18 are clear (0x20000 check) or( - VOID -); - -EFI_STATUS -EFIAPI -18 is set and bit 17 is clear (0x40000 check), this( - VOID -); - -EFI_STATUS -EFIAPI -needs runtime protocol validation.( - VOID -); - -EFI_STATUS -EFIAPI -(((ThisCapsule->Flags & 0x30000) == 0x20000) ||( - VOID -); - -EFI_STATUS -EFIAPI -system table capsule - break out and process below( - VOID -); - -EFI_STATUS -EFIAPI -a populate-system-table capsule; capsule type check required( - VOID -); - -EFI_STATUS -EFIAPI -= CheckCapsuleType (ThisCapsule);( - VOID -); - -EFI_STATUS -EFIAPI -capsules processed, check if any need reset populate( - VOID -); - -EFI_STATUS -EFIAPI -(CapsuleCount == 0) {( - VOID -); - -EFI_STATUS -EFIAPI -capsules have bit 16 set - need a reset capsule( - VOID -); - -EFI_STATUS -EFIAPI -= (UINT64)EFI_UNSUPPORTED;( - VOID -); - -EFI_STATUS -EFIAPI -a capsule without bit 16 set( - VOID -); - -EFI_STATUS -EFIAPI -= (UINT64)EFI_INVALID_PARAMETER;( - VOID -); - -EFI_STATUS -EFIAPI -we broke out above (populate system table capsule found)( - VOID -); - -EFI_STATUS -EFIAPI -through to success path( - VOID -); - -EFI_STATUS -EFIAPI -EFI_SUCCESS;( - VOID -); - -EFI_STATUS -EFIAPI -(sub_1608)( - VOID -); - -EFI_STATUS -EFIAPI -capsule flag checks as UpdateCapsule( - VOID -); - -EFI_STATUS -EFIAPI -(sub_1710)( - VOID -); - -EFI_STATUS -EFIAPI -(sub_1778)( - VOID -); - -EFI_STATUS -EFIAPI -(sub_17A8)( - VOID -); - -EFI_STATUS -EFIAPI -if HOB list has room (<= 16 bytes header)( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->GetHobListSize ();( - VOID -); - -EFI_STATUS -EFIAPI -(sub_1830)( - VOID -); - -EFI_STATUS -EFIAPI -debug level from CMOS( - VOID -); - -EFI_STATUS -EFIAPI -= IoRead8 (0x70);( - VOID -); - -EFI_STATUS -EFIAPI -debug level to severity mask( - VOID -); - -EFI_STATUS -EFIAPI -(DebugLevel) {( - VOID -); - -EFI_STATUS -EFIAPI -(sub_18B0)( - VOID -); - -EFI_STATUS -EFIAPI -(sub_18F0)( - VOID -); - -EFI_STATUS -EFIAPI -(sub_18FC)( - VOID -); - -EFI_STATUS -EFIAPI -(sub_1924)( - VOID -); - -EFI_STATUS -EFIAPI -(sub_1A04)( - VOID -); - -EFI_STATUS -EFIAPI -check against 2 known capsule GUIDs in the local table( - VOID -); - -EFI_STATUS -EFIAPI -(TableIndex = 0; TableIndex < 2; TableIndex++) {( - VOID -); - -EFI_STATUS -EFIAPI -check against the extern capsule GUID list( - VOID -); - -EFI_STATUS -EFIAPI -(&gExternCapsuleGuidList == NULL) {( - VOID -); - -EFI_STATUS -EFIAPI -(sub_1A94)( - VOID -); - -EFI_STATUS -EFIAPI -(sub_1A8C)( - VOID -); - -EFI_STATUS -EFIAPI -(sub_1020)( - VOID -); - -#endif /* __CAPSULERUNTIMEDXE_H__ */ \ No newline at end of file +#endif /* __CAPSULERUNTIMEDXE_H__ */ diff --git a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c index 1e99b34..a3aa37e 100644 --- a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c +++ b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c @@ -293,7 +293,7 @@ /** * ConSplitterTextOutReset - * Address: 0x43A4 (sub_43A4) + * Address: 0x43A4 * * Resets all active text output child devices. * Iterates the linked list of text output devices, calling Reset on each. @@ -346,7 +346,7 @@ /** * ConSplitterTextOutOutputString - * Address: 0x4434 (sub_4434) + * Address: 0x4434 * * Outputs a Unicode string to all active text output child devices. * Also writes the string into the internal scrollback buffer. @@ -472,7 +472,7 @@ /** * ConSplitterTextOutTestString - * Address: 0x45E8 (sub_45E8) + * Address: 0x45E8 * * Tests whether a string can be displayed on all active text out devices. */ @@ -513,7 +513,7 @@ /** * ConSplitterTextOutQueryMode - * Address: 0x4888 (sub_4888) + * Address: 0x4888 * * Returns the dimensions of a given text mode. * If no children are connected, returns default values (80x25). @@ -568,7 +568,7 @@ /** * ConSplitterTextOutSetMode - * Address: 0x46B4 (sub_46B4) + * Address: 0x46B4 * * Sets the display mode for all active text out children. * Selects a new mode entry from the mode table and reconfigures @@ -639,7 +639,7 @@ /** * ConSplitterTextOutSetAttribute - * Address: 0x479C (sub_479C) + * Address: 0x479C * * Sets the text attribute on all active child devices. */ @@ -682,7 +682,7 @@ /** * ConSplitterTextOutClearScreen - * Address: 0x4810 (sub_4810) + * Address: 0x4810 * * Clears the screen on all active text out children. */ @@ -726,7 +726,7 @@ /** * ConSplitterTextOutSetCursorPosition - * Address: 0x4888 (sub_4888) + * Address: 0x4888 * * Sets cursor position on all active text out children. */ @@ -775,7 +775,7 @@ /** * ConSplitterTextOutEnableCursor - * Address: 0x4920 (sub_4920) + * Address: 0x4920 * * Enables or disables the cursor on all active text out children. */ @@ -822,7 +822,7 @@ /** * ConSplitterTextInReset - * Address: 0x3710 (sub_3710) + * Address: 0x3710 * * Resets all active text input child devices. */ @@ -845,7 +845,7 @@ /** * ConSplitterTextInReadKeyStroke - * Address: 0x3514 (sub_3514) + * Address: 0x3514 * * Reads a keystroke from any active text input child device. * Iterates through all children and returns the first available key. @@ -895,7 +895,7 @@ /** * ConSplitterTextInWaitForKey - * Address: 0x2E38 (sub_2E38) + * Address: 0x2E38 * * Waits for a keystroke from any child device. * Iterates through all children checking for available input. @@ -947,7 +947,7 @@ /** * ConSplitterPointerReset - * Address: 0x35A8 (sub_35A8) + * Address: 0x35A8 * * Resets the pointer state by querying the first active child. */ @@ -975,7 +975,7 @@ /** * ConSplitterPointerGetState - * Address: 0x3764 (sub_3764) + * Address: 0x3764 * * Gets the pointer state from all active pointer children. * Aggregates relative motion across devices. @@ -1027,7 +1027,7 @@ /** * ConSplitterTextOutDriverBindingSupported - * Address: 0x44C (sub_44C) for Text Out; 0x4A8 (sub_4A8) for generic + * Address: 0x44C for Text Out; 0x4A8 for generic * * Tests whether the driver supports a given controller. * Checks for EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL on the controller. @@ -1074,12 +1074,12 @@ /** * ConSplitterDriverBindingStart - * Address: 0x1054 (sub_1054) for Text Out - * 0x10E0 (sub_10E0) for Text Out (w/ mode setup) - * 0x1398 (sub_1398) for Text In - * 0x14F8 (sub_14F8) for Text In (w/ extended setup) - * 0x18A4 (sub_18A4) for Simple Pointer - * 0x19AC (sub_19AC) for Absolute Pointer + * Address: 0x1054 for Text Out + * 0x10E0 for Text Out (w/ mode setup) + * 0x1398 for Text In + * 0x14F8 for Text In (w/ extended setup) + * 0x18A4 for Simple Pointer + * 0x19AC for Absolute Pointer * * Starts the driver on a controller, creating a child device node * and adding it to the internal linked list. @@ -1165,9 +1165,9 @@ /** * ConSplitterDriverBindingStop - * Address: 0x11F4 (sub_11F4) for Text Out - * 0x1750 (sub_1750) for Text In - * 0x1BB0 (sub_1BB0) for Pointer + * Address: 0x11F4 for Text Out + * 0x1750 for Text In + * 0x1BB0 for Pointer * * Stops the driver on a controller, removing the child device node * from the internal linked list. @@ -1254,7 +1254,7 @@ /** * ConSplitterDriverEntryPoint - * Address: 0xAE4 (sub_AE4) + * Address: 0xAE4 * * Main entry point for the AMI Console Splitter Driver. * @@ -1601,7 +1601,7 @@ /** * ConSplitterRegisterKeyNotify - * Address: 0x3A10 (sub_3A10) + * Address: 0x3A10 * * Registers a notification function for a particular key on all * input child devices. If the console splitter is blocked (e.g., @@ -1737,7 +1737,7 @@ /** * ConSplitterUnregisterKeyNotify - * Address: 0x3D08 (sub_3D08) + * Address: 0x3D08 * * Unregisters a previously registered key notification. * Removes the notification from all child devices and frees @@ -1829,7 +1829,7 @@ /** * ConSplitterGetDriverName - * Address: 0x4A8 (sub_4A8) + * Address: 0x4A8 * * Returns the driver name based on which driver binding protocol * is being queried. @@ -1865,7 +1865,7 @@ /** * ConSplitterGetControllerName - * Address: 0x44C (sub_44C) + * Address: 0x44C * * Returns the controller name. Only "AMI Console Splitter" is * returned for all supported controllers. @@ -1902,7 +1902,7 @@ /** * ConSplitterConOutNotifyHandler - * Address: 0x800 (sub_800) + * Address: 0x800 * * Called when a new ConOut device appears. Registers the device * path protocol and notifies the console event. @@ -1954,7 +1954,7 @@ /** * ConSplitterConInNotifyHandler - * Address: 0x938 (sub_938) + * Address: 0x938 * * Called when a new ConIn device appears. Registers the device * and sets up the keyboard notification filters. @@ -2062,7 +2062,7 @@ /** * ConSplitterDumpModeTable - * Address: 0x2D60 (sub_2D60) + * Address: 0x2D60 * * Debug function that dumps the mode table to the debug port. */ @@ -2085,7 +2085,7 @@ /** * ConSplitterGetDebugLevel - * Address: 0x5214 (sub_5214) + * Address: 0x5214 * * Reads the debug level from CMOS/RTC, or from a hardcoded * memory location. Returns a bitmask for use with DEBUG() macros. @@ -2123,7 +2123,7 @@ /** * ConSplitterCompareMem - * Address: 0x519C (sub_519C) + * Address: 0x519C * * Compares two memory buffers. Returns 0 if equal, difference otherwise. */ @@ -2139,7 +2139,7 @@ /** * ConSplitterCopyMem - * Address: 0x53C0 (sub_53C0) + * Address: 0x53C0 * * Copies a memory buffer. Handles overlapping source/destination * with correct direction. @@ -2156,7 +2156,7 @@ /** * ConSplitterIsLanguageEnUs - * Address: 0x5130 (sub_5130) + * Address: 0x5130 * * Case-insensitive check if language string equals "en-US". */ @@ -2194,7 +2194,7 @@ /** * ConSplitterReadUnaligned64 - * Address: 0x5264 (sub_5264) + * Address: 0x5264 * * Reads a 64-bit value from a possibly unaligned address. */ @@ -2211,7 +2211,7 @@ /** * ConSplitterIsProtocolGuidMatch - * Address: 0x5294 (sub_5294) + * Address: 0x5294 * * Compares two protocol GUID entries to see if they match. */ @@ -2226,7 +2226,7 @@ /** * ConSplitterLocateHob - * Address: 0x4BF8 (sub_4BF8) + * Address: 0x4BF8 * * Locates the HOB (Hand-Off Block) list pointer. */ @@ -2260,7 +2260,7 @@ /** * ConSplitterSynchronizeTextOut - * Address: 0x4188 (sub_4188) + * Address: 0x4188 * * Synchronizes text output state (mode, cursor position, attribute) * from the internal buffer to the child devices. @@ -2306,7 +2306,7 @@ /** * ConSplitterFlushBuffer - * Address: 0x4010 (sub_4010) + * Address: 0x4010 * * Flushes the internal text buffer to the child device using * UGA Draw protocol (Blt). @@ -2364,7 +2364,7 @@ /** * ConSplitterScrollTextBuffer - * Address: 0x3EDC (sub_3EDC) + * Address: 0x3EDC * * Scrolls the text buffer by one line and outputs to the device. */ @@ -2429,7 +2429,7 @@ /** * ConSplitterClearTextBuffer - * Address: 0x3FB4 (sub_3FB4) + * Address: 0x3FB4 * * Fills the text buffer with spaces and default attribute. */ @@ -2461,7 +2461,7 @@ /** * ConSplitterReconstructModeTable - * Address: 0x2350 (sub_2350) + 0x25FC (sub_25FC) + * Address: 0x2350 + 0x25FC * * Reconstructs the mode table from a reference child device. * Allocates and fills the mode table with rows/columns information. @@ -2536,4 +2536,4 @@ // Apply default cursor setting ConSplitterSetResolutionData (); return Status; -} \ No newline at end of file +} diff --git a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.h b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.h index ef9581d..081b4dd 100644 --- a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.h +++ b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.h @@ -241,1402 +241,4 @@ VOID ); -EFI_STATUS -EFIAPI -1: Global Data (.data section)( - VOID -); - -EFI_STATUS -EFIAPI -following globals are defined in the .data section of( - VOID -); - -EFI_STATUS -EFIAPI -binding protocol instances (installed via InstallMultipleProtocolInterfaces)( - VOID -); - -EFI_STATUS -EFIAPI -Out driver binding:( - VOID -); - -EFI_STATUS -EFIAPI -= protocol GUID array( - VOID -); - -EFI_STATUS -EFIAPI -= driver binding protocol structure( - VOID -); - -EFI_STATUS -EFIAPI -In driver binding:( - VOID -); - -EFI_STATUS -EFIAPI -driver binding:( - VOID -); - -EFI_STATUS -EFIAPI -GUIDs referenced from .rdata( - VOID -); - -EFI_STATUS -EFIAPI -= EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL GUID( - VOID -); - -EFI_STATUS -EFIAPI -= EFI_GRAPHICS_OUTPUT_PROTOCOL GUID( - VOID -); - -EFI_STATUS -EFIAPI -= EFI_DEVICE_PATH_PROTOCOL GUID( - VOID -); - -EFI_STATUS -EFIAPI -= (secondary text output mode protocol)( - VOID -); - -EFI_STATUS -EFIAPI -= EFI_UGA_DRAW_PROTOCOL GUID (or GOP mode protocol)( - VOID -); - -EFI_STATUS -EFIAPI -= EFI_SIMPLE_POINTER_PROTOCOL GUID( - VOID -); - -EFI_STATUS -EFIAPI -= (text output mode protocol alt)( - VOID -); - -EFI_STATUS -EFIAPI -= EFI_ABSOLUTE_POINTER_PROTOCOL GUID( - VOID -); - -EFI_STATUS -EFIAPI -= gEfiConsoleOutDeviceGuid( - VOID -); - -EFI_STATUS -EFIAPI -= EFI_HII_DATABASE_PROTOCOL GUID( - VOID -); - -EFI_STATUS -EFIAPI -= EFI_SERIAL_IO_PROTOCOL GUID (or debug port)( - VOID -); - -EFI_STATUS -EFIAPI -= gEfiGlobalVariableGuid (for "ConOutDev"/"ConInDev" UEFI vars)( - VOID -); - -EFI_STATUS -EFIAPI -= gEfiConsoleControlGuid or gEfiSimpleTextOutProtocolGuid for HOB matching( - VOID -); - -EFI_STATUS -EFIAPI -/ unk_6020 = DebugLib protocol GUIDs( - VOID -); - -EFI_STATUS -EFIAPI -table and boot services cached globally( - VOID -); - -EFI_STATUS -EFIAPI -gImageHandle = 0; // 0x6118( - VOID -); - -EFI_STATUS -EFIAPI -UINT64 gBootServices = 0; // 0x6110( - VOID -); - -EFI_STATUS -EFIAPI -//( - VOID -); - -EFI_STATUS -EFIAPI -gBootServicesLocal = 0; // 0x6138( - VOID -); - -EFI_STATUS -EFIAPI -UINT64 gSystemTableLocal = 0; // 0x6148( - VOID -); - -EFI_STATUS -EFIAPI -image handles for each driver binding( - VOID -); - -EFI_STATUS -EFIAPI -gImageHandleTextOut = 0; // 0x5EB8 (ImageHandle_0)( - VOID -); - -EFI_STATUS -EFIAPI -(ImageHandle_1)( - VOID -); - -EFI_STATUS -EFIAPI -(ImageHandle_2)( - VOID -); - -EFI_STATUS -EFIAPI -Out state( - VOID -); - -EFI_STATUS -EFIAPI -*gConSplitterTextOutPrivate = NULL; // 0x6070 (qword_6070)( - VOID -); - -EFI_STATUS -EFIAPI -(p_n0xA = active count)( - VOID -); - -EFI_STATUS -EFIAPI -In state( - VOID -); - -EFI_STATUS -EFIAPI -*gConSplitterTextInPrivate = NULL; // 0x5D90( - VOID -); - -EFI_STATUS -EFIAPI -(n0xA = active count)( - VOID -); - -EFI_STATUS -EFIAPI -(n0xA_2)( - VOID -); - -EFI_STATUS -EFIAPI -state( - VOID -); - -EFI_STATUS -EFIAPI -gConSplitterPointerActiveCount = 0; // 0x6200 (n0xA_0)( - VOID -); - -EFI_STATUS -EFIAPI -(i count)( - VOID -); - -EFI_STATUS -EFIAPI -(i_0 count)( - VOID -); - -EFI_STATUS -EFIAPI -(j count)( - VOID -); - -EFI_STATUS -EFIAPI -(j_0 count)( - VOID -); - -EFI_STATUS -EFIAPI -list anchors for child devices( - VOID -); - -EFI_STATUS -EFIAPI -Out children: anchored at gConSplitterTextOutChildren( - VOID -); - -EFI_STATUS -EFIAPI -(i, i_1)( - VOID -); - -EFI_STATUS -EFIAPI -(i_0, i_1_2)( - VOID -); - -EFI_STATUS -EFIAPI -In children( - VOID -); - -EFI_STATUS -EFIAPI -(j, j_1)( - VOID -); - -EFI_STATUS -EFIAPI -/ 0x61A8 / 0x6188( - VOID -); - -EFI_STATUS -EFIAPI -management( - VOID -); - -EFI_STATUS -EFIAPI -gConSplitterModeCount = 0; // 0x605C (dword_605C)( - VOID -); - -EFI_STATUS -EFIAPI -(dword_6100)( - VOID -); - -EFI_STATUS -EFIAPI -(dword_5FF4)( - VOID -); - -EFI_STATUS -EFIAPI -(dword_5FF0)( - VOID -); - -EFI_STATUS -EFIAPI -table (9 bytes per entry: columns(4) + rows(4) + valid(1))( - VOID -); - -EFI_STATUS -EFIAPI -*gConSplitterModeTable = NULL; // 0x60D0 (qword_60D0)( - VOID -); - -EFI_STATUS -EFIAPI -buffer pointers (double-buffered for scrollback)( - VOID -); - -EFI_STATUS -EFIAPI -*gConSplitterTextBuffer = NULL; // 0x60C8 (src / qword_60C8)( - VOID -); - -EFI_STATUS -EFIAPI -(src_0 / qword_60D8)( - VOID -); - -EFI_STATUS -EFIAPI -(src_1 / qword_60B8)( - VOID -); - -EFI_STATUS -EFIAPI -(dst / qword_60F8)( - VOID -); - -EFI_STATUS -EFIAPI -(dst_0 / qword_60F0)( - VOID -); - -EFI_STATUS -EFIAPI -and display state( - VOID -); - -EFI_STATUS -EFIAPI -gConSplitterCursorColumn = 0; // low part of n15( - VOID -); - -EFI_STATUS -EFIAPI -part of n15( - VOID -); - -EFI_STATUS -EFIAPI -UINT32 gConSplitterColumns = 0; // n80( - VOID -); - -EFI_STATUS -EFIAPI -(n15)( - VOID -); - -EFI_STATUS -EFIAPI -guards (nested call protection)( - VOID -); - -EFI_STATUS -EFIAPI -gConSplitterTextOutRecursionCount = 0; // 0x6040 (byte_6040)( - VOID -); - -EFI_STATUS -EFIAPI -(byte_6041)( - VOID -); - -EFI_STATUS -EFIAPI -(byte_6042)( - VOID -); - -EFI_STATUS -EFIAPI -(byte_6058)( - VOID -); - -EFI_STATUS -EFIAPI -(byte_606C)( - VOID -); - -EFI_STATUS -EFIAPI -In blocked state( - VOID -); - -EFI_STATUS -EFIAPI -gConSplitterTextInBlocked = 0; // 0x6059 (byte_6059)( - VOID -); - -EFI_STATUS -EFIAPI -(byte_6179)( - VOID -); - -EFI_STATUS -EFIAPI -(byte_607E)( - VOID -); - -EFI_STATUS -EFIAPI -/ cursor visibility( - VOID -); - -EFI_STATUS -EFIAPI -gConSplitterCursorVisible = 0; // 0x6004 (byte_6004)( - VOID -); - -EFI_STATUS -EFIAPI -(byte_6008)( - VOID -); - -EFI_STATUS -EFIAPI -LED state (low 2 bits = Scroll Lock state)( - VOID -); - -EFI_STATUS -EFIAPI -gConSplitterLedState = 0; // 0x5D60 (byte_5D60)( - VOID -); - -EFI_STATUS -EFIAPI -(byte_5D61)( - VOID -); - -EFI_STATUS -EFIAPI -output mask (determines which debug level messages print)( - VOID -); - -EFI_STATUS -EFIAPI -gConSplitterDebugMask = 0; // 0x5FFC( - VOID -); - -EFI_STATUS -EFIAPI -protocol handle (keyboard layout database)( - VOID -); - -EFI_STATUS -EFIAPI -gConSplitterHiiHandle = 0; // 0x6048 (qword_6048)( - VOID -); - -EFI_STATUS -EFIAPI -(qword_6060)( - VOID -); - -EFI_STATUS -EFIAPI -list handle( - VOID -); - -EFI_STATUS -EFIAPI -gConSplitterHobListHandle = 0; // 0x6130 (qword_6130)( - VOID -); - -EFI_STATUS -EFIAPI -protocol handles( - VOID -); - -EFI_STATUS -EFIAPI -gConSplitterDebugProtocol = 0; // 0x6128 (qword_6128)( - VOID -); - -EFI_STATUS -EFIAPI -/ 0x6168 / 0x6158( - VOID -); - -EFI_STATUS -EFIAPI -notification state( - VOID -); - -EFI_STATUS -EFIAPI -gConSplitterLastKeyScan = 0; // 0x6078 (word_6078)( - VOID -); - -EFI_STATUS -EFIAPI -(word_5E40)( - VOID -); - -EFI_STATUS -EFIAPI -filter table (8 entries, 12 bytes each)( - VOID -); - -EFI_STATUS -EFIAPI -entry has: ScanCode(2) + UnicodeChar(2) + ShiftState(4) + Reserved(4)( - VOID -); - -EFI_STATUS -EFIAPI -define which key combinations the splitter intercepts for( - VOID -); - -EFI_STATUS -EFIAPI -handling (e.g. hotkeys for console switching).( - VOID -); - -EFI_STATUS -EFIAPI -gConSplitterKeyFilter[8 * 12]; // 0x5DE0 (word_5DE0)( - VOID -); - -EFI_STATUS -EFIAPI -filter override flags (1 byte per filter entry)( - VOID -); - -EFI_STATUS -EFIAPI -to 1 when a default notification handler is overridden.( - VOID -); - -EFI_STATUS -EFIAPI -gConSplitterKeyFilterOverride[8]; // 0x6050 (byte_6050)( - VOID -); - -EFI_STATUS -EFIAPI -In keyboard self-test state( - VOID -); - -EFI_STATUS -EFIAPI -gConSplitterKeyboardTestPassed = 0; // 0x6068 (dword_6068, but used as byte)( - VOID -); - -EFI_STATUS -EFIAPI -(byte_6041) - shared with blocked flag( - VOID -); - -EFI_STATUS -EFIAPI -event for keyboard polling( - VOID -); - -EFI_STATUS -EFIAPI -gConSplitterTimerEvent = 0; // 0x5EC0 area( - VOID -); - -EFI_STATUS -EFIAPI -scaling factors( - VOID -); - -EFI_STATUS -EFIAPI -gConSplitterScaleX = 0; // 0x5F80 (dword_5F80)( - VOID -); - -EFI_STATUS -EFIAPI -(dword_5F88)( - VOID -); - -EFI_STATUS -EFIAPI -(dword_5F90)( - VOID -); - -EFI_STATUS -EFIAPI -mode tracking data (off_5F10)( - VOID -); - -EFI_STATUS -EFIAPI -gConSplitterResolutionModeData[6] = {0}; // 0x5F10( - VOID -); - -EFI_STATUS -EFIAPI -events( - VOID -); - -EFI_STATUS -EFIAPI -*gConSplitterConOutNotifyEvent = NULL; // 0x5EE8( - VOID -); - -EFI_STATUS -EFIAPI -VOID *gConSplitterConInNotifyReg = NULL; // 0x5F30( - VOID -); - -EFI_STATUS -EFIAPI -interface pointers (installed on system table)( - VOID -); - -EFI_STATUS -EFIAPI -*gConSplitterConOutInterface = NULL; // off_5FA0( - VOID -); - -EFI_STATUS -EFIAPI -VOID *gConSplitterStdErrInterface = NULL; // off_5F30( - VOID -); - -EFI_STATUS -EFIAPI -change notification structures( - VOID -); - -EFI_STATUS -EFIAPI -gConSplitterResolutionEvent = 0; // 0x5F70 (off_5F70)( - VOID -); - -EFI_STATUS -EFIAPI -2: Library Helpers( - VOID -); - -EFI_STATUS -EFIAPI -3: Text Out Protocol Implementation( - VOID -); - -EFI_STATUS -EFIAPI -mode state from current mode table( - VOID -); - -EFI_STATUS -EFIAPI -children - reset to defaults( - VOID -); - -EFI_STATUS -EFIAPI -internal text buffer( - VOID -); - -EFI_STATUS -EFIAPI -buffer as dirty (needs re-initialization)( - VOID -); - -EFI_STATUS -EFIAPI -starting position in the scrollback buffer( - VOID -); - -EFI_STATUS -EFIAPI -if (CursorCol > 0) {( - VOID -); - -EFI_STATUS -EFIAPI -if ((UINTN)(BufferPos + 2) >= (UINTN)gConSplitterTextBufEnd) {( - VOID -); - -EFI_STATUS -EFIAPI -position after scroll( - VOID -); - -EFI_STATUS -EFIAPI -return( - VOID -); - -EFI_STATUS -EFIAPI -character( - VOID -); - -EFI_STATUS -EFIAPI -position( - VOID -); - -EFI_STATUS -EFIAPI -character to buffer( - VOID -); - -EFI_STATUS -EFIAPI -global cursor position( - VOID -); - -EFI_STATUS -EFIAPI -be recalculated( - VOID -); - -EFI_STATUS -EFIAPI -dispatch to all active child devices( - VOID -); - -EFI_STATUS -EFIAPI -resetting cursor position and dispatching)( - VOID -); - -EFI_STATUS -EFIAPI -mode state( - VOID -); - -EFI_STATUS -EFIAPI -children - return defaults( - VOID -); - -EFI_STATUS -EFIAPI -in this mode( - VOID -); - -EFI_STATUS -EFIAPI -each child's mode( - VOID -); - -EFI_STATUS -EFIAPI -children - reset cursor to origin( - VOID -); - -EFI_STATUS -EFIAPI -children - update local state( - VOID -); - -EFI_STATUS -EFIAPI -4: Text In (Keyboard) Protocol Implementation( - VOID -); - -EFI_STATUS -EFIAPI -6: Simple Pointer Protocol Implementation( - VOID -); - -EFI_STATUS -EFIAPI -7: Driver Binding Protocol Implementation( - VOID -); - -EFI_STATUS -EFIAPI -if controller supports text output protocol( - VOID -); - -EFI_STATUS -EFIAPI -the controller supports text output( - VOID -); - -EFI_STATUS -EFIAPI -if already connected( - VOID -); - -EFI_STATUS -EFIAPI -protocol to get the text output interface( - VOID -); - -EFI_STATUS -EFIAPI -for duplicate device path( - VOID -); - -EFI_STATUS -EFIAPI -child device node( - VOID -); - -EFI_STATUS -EFIAPI -into linked list of text out children( - VOID -); - -EFI_STATUS -EFIAPI -this is the first child, set up the mode table( - VOID -); - -EFI_STATUS -EFIAPI -up graphics output protocol notification( - VOID -); - -EFI_STATUS -EFIAPI -the child node for this controller( - VOID -); - -EFI_STATUS -EFIAPI -protocols on this handle( - VOID -); - -EFI_STATUS -EFIAPI -from linked list( - VOID -); - -EFI_STATUS -EFIAPI -the node( - VOID -); - -EFI_STATUS -EFIAPI -if we need to update mode state( - VOID -); - -EFI_STATUS -EFIAPI -children removed - clean up resources( - VOID -); - -EFI_STATUS -EFIAPI -8: Driver Entry Point( - VOID -); - -EFI_STATUS -EFIAPI -(gSystemTableLocal == 0) {( - VOID -); - -EFI_STATUS -EFIAPI -= 0;( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->CreateEvent (( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->RegisterProtocolNotify (( - VOID -); - -EFI_STATUS -EFIAPI -Setup variable for default mode configuration( - VOID -); - -EFI_STATUS -EFIAPI -variable exists - check its contents( - VOID -); - -EFI_STATUS -EFIAPI -console mode bit (offset depends on( - VOID -); - -EFI_STATUS -EFIAPI -variable layout - bit 0 in first byte)( - VOID -); - -EFI_STATUS -EFIAPI -configure the default mode( - VOID -); - -EFI_STATUS -EFIAPI -(gConSplitterModeTable != NULL) {( - VOID -); - -EFI_STATUS -EFIAPI -the mode and cursor( - VOID -); - -EFI_STATUS -EFIAPI -= 20Hz keyboard poll( - VOID -); - -EFI_STATUS -EFIAPI -9: Key Notification Support( - VOID -); - -EFI_STATUS -EFIAPI -is blocked (self-test mode) - register in the global( - VOID -); - -EFI_STATUS -EFIAPI -list for later activation( - VOID -); - -EFI_STATUS -EFIAPI -into notification linked list (i_1 list)( - VOID -); - -EFI_STATUS -EFIAPI -path - register on each child device( - VOID -); - -EFI_STATUS -EFIAPI -= gBS->AllocatePool (( - VOID -); - -EFI_STATUS -EFIAPI -on each Text In child device( - VOID -); - -EFI_STATUS -EFIAPI -the child pointer( - VOID -); - -EFI_STATUS -EFIAPI -on this child (if it supports KeyNotify)( - VOID -); - -EFI_STATUS -EFIAPI -if this replaces a default key filter( - VOID -); - -EFI_STATUS -EFIAPI -into notification list( - VOID -); - -EFI_STATUS -EFIAPI -the notification node in the linked list( - VOID -); - -EFI_STATUS -EFIAPI -from each child device( - VOID -); - -EFI_STATUS -EFIAPI -10: Component Name Protocol( - VOID -); - -EFI_STATUS -EFIAPI -11: Console Notification Handlers( - VOID -); - -EFI_STATUS -EFIAPI -any text output handles( - VOID -); - -EFI_STATUS -EFIAPI -to start the driver on this handle( - VOID -); - -EFI_STATUS -EFIAPI -device path protocol notify if not yet done( - VOID -); - -EFI_STATUS -EFIAPI -any text input handles( - VOID -); - -EFI_STATUS -EFIAPI -the driver( - VOID -); - -EFI_STATUS -EFIAPI -the system table console input handle and protocol( - VOID -); - -EFI_STATUS -EFIAPI -up system table mode( - VOID -); - -EFI_STATUS -EFIAPI -the 8 default key filters( - VOID -); - -EFI_STATUS -EFIAPI -to ConOutNotifyHandler but for StdErr( - VOID -); - -EFI_STATUS -EFIAPI -EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL on the handle( - VOID -); - -EFI_STATUS -EFIAPI -12: Debug and Diagnostic Functions( - VOID -); - -EFI_STATUS -EFIAPI -CMOS index register 0x70, save high bit (NMI enable)( - VOID -); - -EFI_STATUS -EFIAPI -only( - VOID -); - -EFI_STATUS -EFIAPI -| EFI_D_WARN( - VOID -); - -EFI_STATUS -EFIAPI -HOB list from SystemTable->BootServices( - VOID -); - -EFI_STATUS -EFIAPI -13: Console Mode Management( - VOID -); - -EFI_STATUS -EFIAPI -have UGA Draw protocol - use it for mode switching( - VOID -); - -EFI_STATUS -EFIAPI -display buffer( - VOID -); - -EFI_STATUS -EFIAPI -UGA Draw - use text output scrolling( - VOID -); - -EFI_STATUS -EFIAPI -cursor position and attribute( - VOID -); - -EFI_STATUS -EFIAPI -UGA Draw protocol from the reference device( - VOID -); - -EFI_STATUS -EFIAPI -Blt buffer size from current mode dimensions( - VOID -); - -EFI_STATUS -EFIAPI -the buffer to the screen( - VOID -); - -EFI_STATUS -EFIAPI -the attribute of the first character in the first line( - VOID -); - -EFI_STATUS -EFIAPI -mode and cursor( - VOID -); - -EFI_STATUS -EFIAPI -character by character( - VOID -); - -EFI_STATUS -EFIAPI -of line marker found( - VOID -); - -EFI_STATUS -EFIAPI -new attribute( - VOID -); - -EFI_STATUS -EFIAPI -max mode from reference device( - VOID -); - -EFI_STATUS -EFIAPI -mode table: 9 bytes per mode entry( - VOID -); - -EFI_STATUS -EFIAPI -= 4(cols) + 4(rows) + 1(valid)( - VOID -); - -EFI_STATUS -EFIAPI -old table if it exists( - VOID -); - -EFI_STATUS -EFIAPI -mode table( - VOID -); - -EFI_STATUS -EFIAPI -previous mode if valid( - VOID -); - -EFI_STATUS -EFIAPI -mode to 0( - VOID -); - -EFI_STATUS -EFIAPI -default cursor setting( - VOID -); - -#endif /* __CONSPLITTER_H__ */ \ No newline at end of file +#endif /* __CONSPLITTER_H__ */ diff --git a/MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox/SmmLockBox.c b/MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox/SmmLockBox.c index ddbded7..013c252 100644 --- a/MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox/SmmLockBox.c +++ b/MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox/SmmLockBox.c @@ -97,10 +97,10 @@ ) // // Flow: -// 1. Process library constructors (sub_540) +// 1. Process library constructors // 2. Set gModuleStatus to EFI_SUCCESS (initial) // 3. Acquire lock (unlikely to fail at init) -// 4. Register SMI handler (sub_C7C) +// 4. Register SMI handler // 5. Update gModuleStatus on failure // 6. Release lock // 7. If module init failed, call destructor @@ -130,7 +130,7 @@ } //========================================================================= -// ProcessLibraryConstructorList (sub_540) +// ProcessLibraryConstructorList //========================================================================= EFI_STATUS @@ -247,7 +247,7 @@ } //========================================================================= -// Register SMI Handler (sub_C7C) +// Register SMI Handler //========================================================================= EFI_STATUS @@ -295,7 +295,7 @@ } //========================================================================= -// SmmLockBoxHandler (sub_988) +// SmmLockBoxHandler //========================================================================= EFI_STATUS @@ -463,7 +463,7 @@ } //========================================================================= -// SmmLockBoxSaveLockBox (sub_1128) +// SmmLockBoxSaveLockBox //========================================================================= EFI_STATUS @@ -549,7 +549,7 @@ } //========================================================================= -// SmmLockBoxUpdateLockBox (sub_135C) +// SmmLockBoxUpdateLockBox //========================================================================= EFI_STATUS @@ -600,7 +600,7 @@ } //========================================================================= -// SmmLockBoxRestoreLockBox (sub_1468) +// SmmLockBoxRestoreLockBox //========================================================================= EFI_STATUS @@ -668,7 +668,7 @@ } //========================================================================= -// SmmLockBoxSetLockBoxAttributes (sub_8AC) +// SmmLockBoxSetLockBoxAttributes //========================================================================= EFI_STATUS @@ -725,7 +725,7 @@ } //========================================================================= -// SmmLockBoxRestoreAllLockBoxInPlace (from sub_988[command=5]) +// SmmLockBoxRestoreAllLockBoxInPlace (command 5) //========================================================================= EFI_STATUS @@ -768,7 +768,7 @@ } //========================================================================= -// InternalFindLockBoxEntry (sub_10B0) +// InternalFindLockBoxEntry //========================================================================= LOCK_BOX_ENTRY * @@ -799,7 +799,7 @@ } //========================================================================= -// InternalBaseLibIsListValid (sub_15C8) +// InternalBaseLibIsListValid //========================================================================= BOOLEAN @@ -818,7 +818,7 @@ } //========================================================================= -// InsertTailList (sub_1634) +// InsertTailList //========================================================================= VOID @@ -842,7 +842,7 @@ } //========================================================================= -// CompareGuid (sub_1560) +// CompareGuid //========================================================================= BOOLEAN @@ -866,7 +866,7 @@ } //========================================================================= -// ReadUnaligned64 (sub_1688) +// ReadUnaligned64 //========================================================================= UINT64 @@ -882,7 +882,7 @@ } //========================================================================= -// Buffer Validation (sub_F98) +// Buffer Validation //========================================================================= EFI_STATUS @@ -904,7 +904,7 @@ } //========================================================================= -// LockBoxLock (sub_C70) +// LockBoxLock //========================================================================= EFI_STATUS @@ -921,7 +921,7 @@ } //========================================================================= -// Log Messages (sub_DE8 - DEBUG wrapper) +// Log Messages (DEBUG wrapper) //========================================================================= VOID @@ -984,7 +984,7 @@ } //========================================================================= -// SmmLockBoxDestructor (sub_824) +// SmmLockBoxDestructor //========================================================================= VOID @@ -1011,4 +1011,4 @@ DEBUG((EFI_D_INFO, "SmmLockBoxSmmLib uninstall SmmLockBoxCommunication configuration table\n")); } -} \ No newline at end of file +} diff --git a/MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox/SmmLockBox.h b/MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox/SmmLockBox.h index 393e37c..bd4c503 100644 --- a/MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox/SmmLockBox.h +++ b/MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox/SmmLockBox.h @@ -9,746 +9,154 @@ #include "../uefi_headers/Uefi.h" -// -// Function Prototypes -// - EFI_STATUS EFIAPI SmmLockBoxHandler( VOID -); + ); EFI_STATUS EFIAPI LockBoxLock( VOID -); + ); EFI_STATUS EFIAPI LockBoxSave( VOID -); + ); EFI_STATUS EFIAPI LockBoxUpdate( VOID -); + ); EFI_STATUS EFIAPI LockBoxRestore( VOID -); + ); EFI_STATUS EFIAPI LockBoxSetAttributes( VOID -); + ); EFI_STATUS EFIAPI LockBoxRestoreAllInPlace( VOID -); + ); EFI_STATUS EFIAPI ModuleEntryPoint( VOID -); + ); EFI_STATUS EFIAPI ProcessLibraryConstructorList( VOID -); + ); EFI_STATUS EFIAPI RegisterSmmLockBoxHandler( VOID -); + ); + +EFI_STATUS +EFIAPI +LockBoxContextGet( + VOID + ); EFI_STATUS EFIAPI SmmLockBoxSaveLockBox( VOID -); + ); EFI_STATUS EFIAPI SmmLockBoxUpdateLockBox( VOID -); + ); EFI_STATUS EFIAPI SmmLockBoxRestoreLockBox( VOID -); + ); EFI_STATUS EFIAPI SmmLockBoxSetLockBoxAttributes( VOID -); + ); EFI_STATUS EFIAPI SmmLockBoxRestoreAllLockBoxInPlace( VOID -); + ); + +EFI_STATUS +EFIAPI +InternalFindLockBoxEntry( + VOID + ); EFI_STATUS EFIAPI InternalBaseLibIsListValid( VOID -); + ); EFI_STATUS EFIAPI InsertTailList( VOID -); + ); EFI_STATUS EFIAPI CompareGuid( VOID -); + ); EFI_STATUS EFIAPI ReadUnaligned64( VOID -); + ); EFI_STATUS EFIAPI SmmBufferValidation( VOID -); + ); EFI_STATUS EFIAPI LogMessage( VOID -); + ); EFI_STATUS EFIAPI AssertEfiError( VOID -); + ); EFI_STATUS EFIAPI SmmLockBoxDestructor( VOID -); + ); -EFI_STATUS -EFIAPI -SMM driver provides LockBox save/restore services within SMM.( - VOID -); - -EFI_STATUS -EFIAPI -registers an SMI handler that processes LockBox commands sent( - VOID -); - -EFI_STATUS -EFIAPI -the SMM Communication Buffer protocol.( - VOID -); - -EFI_STATUS -EFIAPI -Range: 0x2C0 - 0x16C0 (26 functions)( - VOID -); - -EFI_STATUS -EFIAPI -Protocol GUIDs (defined in .rdata at 0x2540-0x2590)( - VOID -); - -EFI_STATUS -EFIAPI -Variables (defined in .data segment)( - VOID -); - -EFI_STATUS -EFIAPI -EFI_BOOT_SERVICES *gBootServices; // 0x25C0( - VOID -); - -EFI_STATUS -EFIAPI -EFI_RUNTIME_SERVICES *gRuntimeServices; // 0x25D0( - VOID -); - -EFI_STATUS -EFIAPI -UINT64 gSmmDebug2; // 0x25E0 (SMM Debug2 protocol)( - VOID -); - -EFI_STATUS -EFIAPI -(AMI SMM Buffer Validation)( - VOID -); - -EFI_STATUS -EFIAPI -(boolean, set by LockBox lock)( - VOID -); - -EFI_STATUS -EFIAPI -(boolean)( - VOID -); - -EFI_STATUS -EFIAPI -(module init status)( - VOID -); - -EFI_STATUS -EFIAPI -//-------------------------------------------------------------------------( - VOID -); - -EFI_STATUS -EFIAPI -Declarations( - VOID -); - -EFI_STATUS -EFIAPI -Entry Point( - VOID -); - -EFI_STATUS -EFIAPI -all library constructors (UEFI Boot/Runtime/SMM services tables)( - VOID -); - -EFI_STATUS -EFIAPI -(sub_540)( - VOID -); - -EFI_STATUS -EFIAPI -all library global pointers:( - VOID -); - -EFI_STATUS -EFIAPI -locates SMM Base2 Protocol and SMM Buffer Validation Protocol.( - VOID -); - -EFI_STATUS -EFIAPI -SMM Base2 Protocol( - VOID -); - -EFI_STATUS -EFIAPI -SMM System Table from SMM Base2 Protocol( - VOID -); - -EFI_STATUS -EFIAPI -AMI SMM Buffer Validation Protocol( - VOID -); - -EFI_STATUS -EFIAPI -LockBox Communication Configuration Table( - VOID -); - -EFI_STATUS -EFIAPI -LockBox Context( - VOID -); - -EFI_STATUS -EFIAPI -the SMM configuration table for the LockBox context.( - VOID -); - -EFI_STATUS -EFIAPI -NULL if not installed.( - VOID -); - -EFI_STATUS -EFIAPI -SMI Handler (sub_C7C)( - VOID -); - -EFI_STATUS -EFIAPI -SmmLockBoxHandler as the SMI handler for the( - VOID -); - -EFI_STATUS -EFIAPI -SMM Communication protocol, plus a SW dispatch callback( - VOID -); - -EFI_STATUS -EFIAPI -the main communication handler via SMM Base2( - VOID -); - -EFI_STATUS -EFIAPI -the lock callback via SW dispatch( - VOID -); - -EFI_STATUS -EFIAPI -protocol to make the interface available( - VOID -); - -EFI_STATUS -EFIAPI -(sub_988)( - VOID -); - -EFI_STATUS -EFIAPI -SMI handler for LockBox commands.( - VOID -); - -EFI_STATUS -EFIAPI -to sub-handlers based on Command field:( - VOID -); - -EFI_STATUS -EFIAPI --> SaveLockBox( - VOID -); - -EFI_STATUS -EFIAPI --> UpdateLockBox( - VOID -); - -EFI_STATUS -EFIAPI --> RestoreLockBox( - VOID -); - -EFI_STATUS -EFIAPI --> SetLockBoxAttributes( - VOID -); - -EFI_STATUS -EFIAPI --> RestoreAllLockBoxInPlace( - VOID -); - -EFI_STATUS -EFIAPI -layout:( - VOID -); - -EFI_STATUS -EFIAPI -minimum buffer size( - VOID -); - -EFI_STATUS -EFIAPI -buffer is not in SMRAM or overflow( - VOID -); - -EFI_STATUS -EFIAPI -return status( - VOID -); - -EFI_STATUS -EFIAPI -as processed( - VOID -); - -EFI_STATUS -EFIAPI -(sub_1128)( - VOID -); - -EFI_STATUS -EFIAPI -a data buffer into SMRAM as a new LockBox entry.( - VOID -); - -EFI_STATUS -EFIAPI -if already exists( - VOID -); - -EFI_STATUS -EFIAPI -SMRAM pages for the data( - VOID -); - -EFI_STATUS -EFIAPI -the entry structure( - VOID -); - -EFI_STATUS -EFIAPI -data to SMRAM( - VOID -); - -EFI_STATUS -EFIAPI -entry( - VOID -); - -EFI_STATUS -EFIAPI -into queue( - VOID -); - -EFI_STATUS -EFIAPI -(sub_135C)( - VOID -); - -EFI_STATUS -EFIAPI -a portion of an existing LockBox entry at a given offset.( - VOID -); - -EFI_STATUS -EFIAPI -(sub_1468)( - VOID -); - -EFI_STATUS -EFIAPI -data from a LockBox entry back to a caller-provided buffer.( - VOID -); - -EFI_STATUS -EFIAPI -use the saved SmramBuffer address (restore-in-place)( - VOID -); - -EFI_STATUS -EFIAPI -required size( - VOID -); - -EFI_STATUS -EFIAPI -data out of SMRAM( - VOID -); - -EFI_STATUS -EFIAPI -(sub_8AC)( - VOID -); - -EFI_STATUS -EFIAPI -the attributes on an existing LockBox entry.( - VOID -); - -EFI_STATUS -EFIAPI -only currently supported attribute is bit 0:( - VOID -); - -EFI_STATUS -EFIAPI -(0x1)( - VOID -); - -EFI_STATUS -EFIAPI -header (0x28 bytes)( - VOID -); - -EFI_STATUS -EFIAPI -attributes (only bit 0 is valid)( - VOID -); - -EFI_STATUS -EFIAPI -(from sub_988[command=5])( - VOID -); - -EFI_STATUS -EFIAPI -the LockBox queue and for each entry with the( - VOID -); - -EFI_STATUS -EFIAPI -attribute, copies the SMRAM data to the( - VOID -); - -EFI_STATUS -EFIAPI -buffer address (stored in the entry).( - VOID -); - -EFI_STATUS -EFIAPI -when restore-in-place was requested( - VOID -); - -EFI_STATUS -EFIAPI -saved destination( - VOID -); - -EFI_STATUS -EFIAPI -(sub_10B0)( - VOID -); - -EFI_STATUS -EFIAPI -the LockBox queue searching for an entry with matching GUID.( - VOID -); - -EFI_STATUS -EFIAPI -pointer to the entry, or NULL if not found.( - VOID -); - -EFI_STATUS -EFIAPI -(sub_15C8)( - VOID -); - -EFI_STATUS -EFIAPI -a linked list has non-null forward/back links.( - VOID -); - -EFI_STATUS -EFIAPI -(sub_1634)( - VOID -); - -EFI_STATUS -EFIAPI -doubly-linked list insert at tail.( - VOID -); - -EFI_STATUS -EFIAPI -(sub_1560)( - VOID -); - -EFI_STATUS -EFIAPI -two EFI_GUID structures.( - VOID -); - -EFI_STATUS -EFIAPI -(sub_1688)( - VOID -); - -EFI_STATUS -EFIAPI -a 64-bit value from a potentially unaligned address.( - VOID -); - -EFI_STATUS -EFIAPI -Validation (sub_F98)( - VOID -); - -EFI_STATUS -EFIAPI -that Buffer+Length is NOT in SMRAM and does not overflow.( - VOID -); - -EFI_STATUS -EFIAPI -the AMI SMM Buffer Validation Protocol if available.( - VOID -); - -EFI_STATUS -EFIAPI -(sub_C70)( - VOID -); - -EFI_STATUS -EFIAPI -the gLocked flag, preventing any further SAVE/UPDATE operations.( - VOID -); - -EFI_STATUS -EFIAPI -is called when a SW dispatch event fires (S3 resume, etc.)( - VOID -); - -EFI_STATUS -EFIAPI -Messages (sub_DE8 - DEBUG wrapper)( - VOID -); - -EFI_STATUS -EFIAPI -DEBUG print via SMM Debug2 protocol.( - VOID -); - -EFI_STATUS -EFIAPI -CMOS 0x4C for debug level filtering.( - VOID -); - -EFI_STATUS -EFIAPI -CMOS for debug level( - VOID -); - -EFI_STATUS -EFIAPI -the SMM Debug2 protocol to print( - VOID -); - -EFI_STATUS -EFIAPI -helper( - VOID -); - -EFI_STATUS -EFIAPI -an assertion failure when Status is an error.( - VOID -); - -EFI_STATUS -EFIAPI -(sub_824)( - VOID -); - -EFI_STATUS -EFIAPI -the LockBox communication configuration table.( - VOID -); - -EFI_STATUS -EFIAPI -on module exit/destruction.( - VOID -); - -#endif /* __SMMLOCKBOX_H__ */ \ No newline at end of file +#endif /* __SMMLOCKBOX_H__ */ diff --git a/MdeModulePkg/Universal/Metronome/Metronome/Metronome.c b/MdeModulePkg/Universal/Metronome/Metronome/Metronome.c index e8db954..5772b7a 100644 --- a/MdeModulePkg/Universal/Metronome/Metronome/Metronome.c +++ b/MdeModulePkg/Universal/Metronome/Metronome/Metronome.c @@ -79,10 +79,10 @@ Issues a CPU PAUSE instruction (rep; nop). Yields to the other hyper-thread on an Intel HT-capable processor. - (Original: sub_2C0, "_mm_pause_w") + Original helper: `_mm_pause_w`. **/ VOID -_mm_pause_w ( +CpuPause ( VOID ) { @@ -94,10 +94,10 @@ @return The current 64-bit TSC value. - (Original: sub_2D0, "__rdtsc_w") + Original helper: `__rdtsc_w`. **/ UINT64 -__rdtsc_w ( +ReadTsc ( VOID ) { @@ -109,10 +109,10 @@ /** Enables interrupts (STI). - (Original: sub_2E0, "_enable_w") + Original helper: `_enable_w`. **/ VOID -_enable_w ( +EnableInterrupts ( VOID ) { @@ -122,10 +122,10 @@ /** Disables interrupts (CLI). - (Original: sub_2F0, "_disable_w") + Original helper: `_disable_w`. **/ VOID -_disable_w ( +DisableInterrupts ( VOID ) { @@ -137,10 +137,10 @@ @return The EFLAGS value. - (Original: sub_300, "__getcallerseflags_w") + Original helper: `__getcallerseflags_w`. **/ UINT64 -__getcallerseflags_w ( +GetCallerEflags ( VOID ) { @@ -160,7 +160,7 @@ @return The 32-bit value read from the port. - (Original: sub_93C, "IoRead32") + Original helper: `IoRead32`. **/ UINT32 IoRead32 ( @@ -188,7 +188,7 @@ @return The 64-bit value read. - (Original: sub_96C, "ReadUnaligned64") + Original helper: `ReadUnaligned64`. **/ UINT64 ReadUnaligned64 ( @@ -216,7 +216,7 @@ @return Address + mPciExpressBaseAddress. - (Original: sub_858, "PciExpressGetAddress") + Original helper: `PciExpressGetAddress`. **/ UINT64 PciExpressGetAddress ( @@ -248,7 +248,7 @@ @return The value written (0x0500). - (Original: sub_908, "IoWrite16") + Original helper: `IoWrite16`. **/ UINT16 IoWrite16 ( @@ -290,8 +290,8 @@ @param[in] ImageHandle The EFI_HANDLE for this driver image. @param[in] SystemTable Pointer to the EFI_SYSTEM_TABLE. - (Original: sub_47C, the main initialisation dispatcher called from - _ModuleEntryPoint.) + Original helper: module initialization dispatcher called from + `_ModuleEntryPoint`. **/ VOID MetronomeDriverInit ( @@ -381,8 +381,8 @@ // // Save interrupt state and disable interrupts. // - InterruptsEnabled = (__getcallerseflags_w () & 0x200) != 0; - _disable_w (); + InterruptsEnabled = (GetCallerEflags () & 0x200) != 0; + DisableInterrupts (); // // Read the current TSC and calculate the number of ticks corresponding @@ -401,21 +401,21 @@ // Elapsed = StartTSC; while (((Elapsed + RDTSC_WAIT_MASK - (UINT32)IoRead32 (1288)) & 0x800000) == 0) { - _mm_pause_w (); + CpuPause (); } // // Capture the elapsed TSC value after the spin. // - Microseconds = __rdtsc_w (); + Microseconds = ReadTsc (); // // Restore interrupt state. // if (InterruptsEnabled) { - _enable_w (); + EnableInterrupts (); } else { - _disable_w (); + DisableInterrupts (); } } @@ -434,7 +434,7 @@ @return EFI_SUCCESS always. - (Original: sub_5D0, "MetronomeWait") + Original helper: `MetronomeWait`. **/ EFI_STATUS EFIAPI @@ -476,7 +476,7 @@ @param[in] Ticks The number of PIT ticks to wait. - (Original: sub_894, "MicrosecondDelay") + Original helper: `MicrosecondDelay`. **/ VOID MicrosecondDelay ( @@ -503,7 +503,7 @@ // The 0x800000 bit handles 24-bit counter rollover. // while (((Target - (UINT32)IoRead32 (1288)) & 0x800000) == 0) { - _mm_pause_w (); + CpuPause (); } } while (Remaining-- != 0); @@ -521,7 +521,7 @@ @return Pointer to the start of the HOB list. - (Original: sub_780, "GetHobList") + Original helper: `GetHobList`. **/ VOID * GetHobList ( @@ -596,7 +596,7 @@ @return The entry if GUID matches, NULL otherwise. - (Original: sub_99C, "GetNextGuidHob") + Original helper: `GetNextGuidHob`. **/ VOID * GetNextGuidHob ( @@ -638,7 +638,7 @@ @return Pointer to the PCD protocol interface. - (Original: sub_A0C, "GetPcdProtocol") + Original helper: `GetPcdProtocol`. **/ VOID * GetPcdProtocol ( @@ -695,7 +695,7 @@ @return Pointer to the Debug protocol interface, or NULL. - (Original: sub_638, "GetDebugLib") + Original helper: `GetDebugLib`. **/ VOID * GetDebugLib ( @@ -744,7 +744,7 @@ @param[in] LineNumber Line number of the assertion. @param[in] Description The assertion expression string. - (Original: sub_740, "InternalAssert") + Original helper: `InternalAssert`. **/ VOID InternalAssert ( @@ -778,7 +778,7 @@ @return The (char) value returned by the DebugLib chain. - (Original: sub_6B8, "InternalAssertEfiError") + Original helper: `InternalAssertEfiError`. **/ UINT8 InternalAssertEfiError ( @@ -928,4 +928,4 @@ } return Status; -} \ No newline at end of file +} diff --git a/MdeModulePkg/Universal/Metronome/Metronome/Metronome.h b/MdeModulePkg/Universal/Metronome/Metronome/Metronome.h index 2e29702..753d50a 100644 --- a/MdeModulePkg/Universal/Metronome/Metronome/Metronome.h +++ b/MdeModulePkg/Universal/Metronome/Metronome/Metronome.h @@ -131,7 +131,7 @@ @return Current TSC value. **/ UINT64 -__rdtsc_w ( +ReadTsc ( VOID ); @@ -141,7 +141,7 @@ @return EFLAGS value. **/ UINT64 -__getcallerseflags_w ( +GetCallerEflags ( VOID ); @@ -151,7 +151,7 @@ @return None. **/ VOID -_mm_pause_w ( +CpuPause ( VOID ); @@ -161,7 +161,7 @@ @return None. **/ VOID -_enable_w ( +EnableInterrupts ( VOID ); @@ -171,7 +171,7 @@ @return None. **/ VOID -_disable_w ( +DisableInterrupts ( VOID ); @@ -332,4 +332,4 @@ extern UINT64 gBootServices; extern UINT64 gRuntimeServices; -#endif /* __METRONOME_H__ */ \ No newline at end of file +#endif /* __METRONOME_H__ */ diff --git a/MdeModulePkg/Universal/PCD/Pei/Service.c/PchResetRuntime/PchResetRuntime.c b/MdeModulePkg/Universal/PCD/Pei/Service.c/PchResetRuntime/PchResetRuntime.c index 1e79a7e..7df70d3 100644 --- a/MdeModulePkg/Universal/PCD/Pei/Service.c/PchResetRuntime/PchResetRuntime.c +++ b/MdeModulePkg/Universal/PCD/Pei/Service.c/PchResetRuntime/PchResetRuntime.c @@ -23,7 +23,7 @@ v11 = 44 *Ptr; /*0xf0d*/ if ( !*(_BYTE *)(Ptr + Index + 4520) ) /*0xf11*/ return 0x8000000000000006uLL; /*0xf25*/ - v13 = sub_161C(Ptr, 44); /*0xf33*/ + v13 = GetSataIdentifyBuffer(Ptr, 44); /*0xf33*/ if ( v13 ) /*0xf3b*/ v13 = FreePool(v13); /*0xf43*/ *(_QWORD *)a4 = v13; /*0xf48*/ @@ -32,7 +32,7 @@ DebugAssert("e:\\hs\\PurleySktPkg\\SouthClusterLbg\\SataController\\Dxe\\SataController.c", 700, "((BOOLEAN)(0==1))"); /*0xf63*/ return 0x8000000000000009uLL; /*0xf72*/ } - v14 = sub_1050(Index + Index + 424, (Index + v11 + 76) & -(__int64)(*(_BYTE *)(v11 + Index + 72) != 0), &v20) < 0; /*0xf9e*/ + v14 = GetSataIdentifyMode(Index + Index + 424, (Index + v11 + 76) & -(__int64)(*(_BYTE *)(v11 + Index + 72) != 0), &v20) < 0; /*0xf9e*/ v15 = *(_BYTE **)a4; /*0xfa1*/ if ( v14 ) /*0xfa4*/ { @@ -88,7 +88,7 @@ v11 = 44 *Ptr; /*0xf0d*/ if ( !*(_BYTE *)(Ptr + Index + 4520) ) /*0xf11*/ return 0x8000000000000006uLL; /*0xf25*/ - v13 = sub_161C(Ptr, 44); /*0xf33*/ + v13 = GetSataIdentifyBuffer(Ptr, 44); /*0xf33*/ if ( v13 ) /*0xf3b*/ v13 = FreePool(v13); /*0xf43*/ *(_QWORD *)a4 = v13; /*0xf48*/ @@ -97,7 +97,7 @@ DebugAssert("e:\\hs\\PurleySktPkg\\SouthClusterLbg\\SataController\\Dxe\\SataController.c", 700, "((BOOLEAN)(0==1))"); /*0xf63*/ return 0x8000000000000009uLL; /*0xf72*/ } - v14 = sub_1050(Index + Index + 424, (Index + v11 + 76) & -(__int64)(*(_BYTE *)(v11 + Index + 72) != 0), &v20) < 0; /*0xf9e*/ + v14 = CalculateBestPioMode(Index + Index + 424, (Index + v11 + 76) & -(__int64)(*(_BYTE *)(v11 + Index + 72) != 0), &v20) < 0; /*0xf9e*/ v15 = *(_BYTE **)a4; /*0xfa1*/ if ( v14 ) /*0xfa4*/ { @@ -153,7 +153,7 @@ v11 = 44 *Ptr; /*0xf0d*/ if ( !*(_BYTE *)(Ptr + Index + 4520) ) /*0xf11*/ return 0x8000000000000006uLL; /*0xf25*/ - v13 = sub_161C(Ptr, 44); /*0xf33*/ + v13 = GetSataIdentifyBuffer(Ptr, 44); /*0xf33*/ if ( v13 ) /*0xf3b*/ v13 = FreePool(v13); /*0xf43*/ *(_QWORD *)a4 = v13; /*0xf48*/ @@ -162,7 +162,7 @@ DebugAssert("e:\\hs\\PurleySktPkg\\SouthClusterLbg\\SataController\\Dxe\\SataController.c", 700, "((BOOLEAN)(0==1))"); /*0xf63*/ return 0x8000000000000009uLL; /*0xf72*/ } - v14 = sub_1050(Index + Index + 424, (Index + v11 + 76) & -(__int64)(*(_BYTE *)(v11 + Index + 72) != 0), &v20) < 0; /*0xf9e*/ + v14 = CalculateBestPioMode(Index + Index + 424, (Index + v11 + 76) & -(__int64)(*(_BYTE *)(v11 + Index + 72) != 0), &v20) < 0; /*0xf9e*/ v15 = *(_BYTE **)a4; /*0xfa1*/ if ( v14 ) /*0xfa4*/ { @@ -218,7 +218,7 @@ v11 = 44 *Ptr; /*0xf0d*/ if ( !*(_BYTE *)(Ptr + Index + 4520) ) /*0xf11*/ return 0x8000000000000006uLL; /*0xf25*/ - v13 = sub_161C(Ptr, 44); /*0xf33*/ + v13 = GetSataIdentifyBuffer(Ptr, 44); /*0xf33*/ if ( v13 ) /*0xf3b*/ v13 = FreePool(v13); /*0xf43*/ *(_QWORD *)a4 = v13; /*0xf48*/ @@ -227,7 +227,7 @@ DebugAssert("e:\\hs\\PurleySktPkg\\SouthClusterLbg\\SataController\\Dxe\\SataController.c", 700, "((BOOLEAN)(0==1))"); /*0xf63*/ return 0x8000000000000009uLL; /*0xf72*/ } - v14 = sub_1050(Index + Index + 424, (Index + v11 + 76) & -(__int64)(*(_BYTE *)(v11 + Index + 72) != 0), &v20) < 0; /*0xf9e*/ + v14 = CalculateBestPioMode(Index + Index + 424, (Index + v11 + 76) & -(__int64)(*(_BYTE *)(v11 + Index + 72) != 0), &v20) < 0; /*0xf9e*/ v15 = *(_BYTE **)a4; /*0xfa1*/ if ( v14 ) /*0xfa4*/ { @@ -283,7 +283,7 @@ v11 = 44 *Ptr; /*0xf0d*/ if ( !*(_BYTE *)(Ptr + Index + 4520) ) /*0xf11*/ return 0x8000000000000006uLL; /*0xf25*/ - v13 = sub_161C(Ptr, 44); /*0xf33*/ + v13 = GetSataIdentifyBuffer(Ptr, 44); /*0xf33*/ if ( v13 ) /*0xf3b*/ v13 = FreePool(v13); /*0xf43*/ *(_QWORD *)a4 = v13; /*0xf48*/ @@ -292,7 +292,7 @@ DebugAssert("e:\\hs\\PurleySktPkg\\SouthClusterLbg\\SataController\\Dxe\\SataController.c", 700, "((BOOLEAN)(0==1))"); /*0xf63*/ return 0x8000000000000009uLL; /*0xf72*/ } - v14 = sub_1050(Index + Index + 424, (Index + v11 + 76) & -(__int64)(*(_BYTE *)(v11 + Index + 72) != 0), &v20) < 0; /*0xf9e*/ + v14 = CalculateBestPioMode(Index + Index + 424, (Index + v11 + 76) & -(__int64)(*(_BYTE *)(v11 + Index + 72) != 0), &v20) < 0; /*0xf9e*/ v15 = *(_BYTE **)a4; /*0xfa1*/ if ( v14 ) /*0xfa4*/ { @@ -618,11 +618,11 @@ // Function at 0x1548 char DebugPrintVarArg(__int64 a1, __int64 a2, ...) { - __int64 Result; // rax __int64 v4; // r8 __int64 ( **v5)(__int64, __int64, __int64 *); // r9 unsigned __int8 v6; // al char n3; // al char n3_1; // cl va_list va; // [rsp+40h] [rbp+18h] BYREF va_start(va, a2); - Result = sub_146C(); /*0x1503*/ + __int64 DebugProtocol; // rax __int64 v4; // r8 __int64 ( **v5)(__int64, __int64, __int64 *); // r9 unsigned __int8 v6; // al char n3; // al char n3_1; // cl va_list va; // [rsp+40h] [rbp+18h] BYREF va_start(va, a2); + DebugProtocol = GetDebugPrintProtocol(); /*0x1503*/ v4 = 0; /*0x1508*/ - v5 = (__int64 ( **)(__int64, __int64, __int64 *))Result; /*0x150b*/ - if ( Result ) /*0x1511*/ + v5 = (__int64 ( **)(__int64, __int64, __int64 *))DebugProtocol; /*0x150b*/ + if ( DebugProtocol ) /*0x1511*/ { v6 = __inbyte(0x70u); /*0x1517*/ __outbyte(0x70u, v6 & 0x80 | 0x4B); /*0x151c*/ @@ -645,7 +645,7 @@ if ( (v4 & a1) != 0 ) /*0x155c*/ LOBYTE(Result) = (*v5)(a1, a2, (__int64 *)va); /*0x156b*/ } - return Result; /*0x156e*/ + return DebugProtocol; /*0x156e*/ } // Function at 0x16cc bool InternalCompare24BitValue(_DWORD *a1, _DWORD *a2) @@ -690,7 +690,7 @@ { if ( a5 ) /*0x1902*/ { - if ( sub_1690(a1, v7) ) /*0x190a*/ + if ( ConfigStringEquals(a1, v7) ) /*0x190a*/ goto LABEL_20; /*0x1911*/ v7 = (_DWORD *)((char *)v7 + 3); /*0x1913*/ } @@ -699,7 +699,7 @@ Index = 0; /*0x1919*/ while ( i && i != 59 ) /*0x191f*/ i = *((_BYTE *)v7 + ++Index); /*0x1924*/ - if ( !sub_2924(v7, a1, Index) && !*((_BYTE *)a1 + Index) ) /*0x1941*/ + if ( !ConfigStringEqualsPrefix(v7, a1, Index) && !*((_BYTE *)a1 + Index) ) /*0x1941*/ { LABEL_20: v13 = *(_BYTE **)v6; /*0x195d*/ @@ -717,7 +717,7 @@ Index = 0; /*0x1969*/ while ( n59 && n59 != 59 ) /*0x196f*/ n59 = v13[++Index]; /*0x1974*/ - if ( !sub_2924(v13, a1, Index) ) /*0x1984*/ + if ( !ConfigStringEqualsPrefix(v13, a1, Index) ) /*0x1984*/ break; /*0x1984*/ v13 += Index; /*0x198e*/ n59 = *v13; /*0x1991*/ @@ -815,9 +815,9 @@ result = qword_44F8; /*0x2008*/ if ( !*(_BYTE *)(qword_44F8 + 20) ) /*0x200f*/ { - sub_1A68(); /*0x2015*/ + BootScriptCloseAndFlush(); /*0x2015*/ *(_BYTE *)(qword_44F8 + 20) = 1; /*0x2021*/ - return sub_1AC4(); /*0x2025*/ + return BootScriptOpen(); /*0x2025*/ } } return result; /*0x202a*/ @@ -831,9 +831,9 @@ result = qword_44F8; /*0x2008*/ if ( !*(_BYTE *)(qword_44F8 + 20) ) /*0x200f*/ { - sub_1A68(); /*0x2015*/ + BootScriptCloseAndFlush(); /*0x2015*/ *(_BYTE *)(qword_44F8 + 20) = 1; /*0x2021*/ - return sub_1AC4(); /*0x2025*/ + return BootScriptOpen(); /*0x2025*/ } } return result; /*0x202a*/ @@ -882,7 +882,7 @@ __int64 Status; // rax __int64 Status; // rax if ( !*(_BYTE *)(qword_44F8 + 15) ) /*0x2139*/ { *(_DWORD *)(qword_44F8 + 16) = *(_DWORD *)(qword_44F8 + 8) + 3; /*0x2149*/ - Status = sub_2E18(); /*0x214c*/ + Status = BootScriptWriteHeader(); /*0x214c*/ if ( Status < 0 ) /*0x2159*/ { DebugPrintVarArg(0x80000000LL, (__int64)"\nASSERT_EFI_ERROR (Status = %r)\n", Status); /*0x2167*/ @@ -895,7 +895,7 @@ DebugAssert("e:\\hs\\MdeModulePkg\\Library\\PiDxeS3BootScriptLib\\BootScriptSave.c", 484, "!EFI_ERROR (Status)"); /*0x21c8*/ } *(_BYTE *)(qword_44F8 + 15) = 1; /*0x21d4*/ - sub_2088(); /*0x21d8*/ + BootScriptFinalizeOpen(); /*0x21d8*/ } return 0; /*0x21df*/ } @@ -905,20 +905,20 @@ __int64 Status; // rax __int64 Status; // rax if ( !*(_BYTE *)(qword_44F8 + 15) ) /*0x2139*/ { *(_DWORD *)(qword_44F8 + 16) = *(_DWORD *)(qword_44F8 + 8) + 3; /*0x2149*/ - Status = sub_2E18(); /*0x214c*/ + Status = BootScriptWriteHeader(); /*0x214c*/ if ( Status < 0 ) /*0x2159*/ { DebugPrintVarArg(0x80000000LL, (__int64)"\nASSERT_EFI_ERROR (Status = %r)\n", Status); /*0x2167*/ DebugAssert("e:\\hs\\MdeModulePkg\\Library\\PiDxeS3BootScriptLib\\BootScriptSave.c", 473, "!EFI_ERROR (Status)"); /*0x217f*/ } - Status = sub_2BA8(&unk_4418, *(_QWORD *)qword_44F8, *(unsigned int *)(qword_44F8 + 16)); /*0x2199*/ + Status = BootScriptSaveEntry(&unk_4418, *(_QWORD *)qword_44F8, *(unsigned int *)(qword_44F8 + 16)); /*0x2199*/ if ( Status < 0 ) /*0x21a1*/ { DebugPrintVarArg(0x80000000LL, (__int64)"\nASSERT_EFI_ERROR (Status = %r)\n", Status); /*0x21b0*/ DebugAssert("e:\\hs\\MdeModulePkg\\Library\\PiDxeS3BootScriptLib\\BootScriptSave.c", 484, "!EFI_ERROR (Status)"); /*0x21c8*/ } *(_BYTE *)(qword_44F8 + 15) = 1; /*0x21d4*/ - sub_2088(); /*0x21d8*/ + BootScriptFinalizeOpen(); /*0x21d8*/ } return 0; /*0x21df*/ } @@ -987,7 +987,7 @@ FreePool(v22); /*0x23f8*/ Status = (*(__int64 ( **)(void *, __int64 (*)(), __int64 *))(qword_44B0 + 192))( /*0x2419*/ &unk_42B0, - sub_212C, + BootScriptCloseCallback, &qword_44B8); if ( Status < 0 ) /*0x2422*/ { @@ -996,7 +996,7 @@ } Status = (*(__int64 ( **)(void *, __int64 (*)(), __int64 *))(qword_44B0 + 192))( /*0x245e*/ &unk_4280, - sub_212C, + BootScriptCloseCallback, &qword_4498); if ( Status < 0 ) /*0x2467*/ { @@ -1008,7 +1008,7 @@ qword_4500 = v12; /*0x248b*/ Status = (*(__int64 ( **)(void *, __int64 (*)(), __int64 *))(qword_44B0 + 192))( /*0x24ae*/ &unk_4300, - sub_2030, + BootScriptRegisterCloseCallback, &qword_44C0); if ( Status < 0 ) /*0x24b7*/ { @@ -1083,7 +1083,7 @@ FreePool(v22); /*0x23f8*/ Status = (*(__int64 ( **)(void *, __int64 (*)(), __int64 *))(qword_44B0 + 192))( /*0x2419*/ &unk_42B0, - sub_212C, + BootScriptCloseCallback, &qword_44B8); if ( Status < 0 ) /*0x2422*/ { @@ -1092,7 +1092,7 @@ } Status = (*(__int64 ( **)(void *, __int64 (*)(), __int64 *))(qword_44B0 + 192))( /*0x245e*/ &unk_4280, - sub_212C, + BootScriptCloseCallback, &qword_4498); if ( Status < 0 ) /*0x2467*/ { @@ -1104,7 +1104,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*/ { @@ -1179,7 +1179,7 @@ FreePool(v22); /*0x23f8*/ Status = (*(__int64 ( **)(void *, __int64 (*)(), __int64 *))(qword_44B0 + 192))( /*0x2419*/ &unk_42B0, - sub_212C, + BootScriptCloseCallback, &qword_44B8); if ( Status < 0 ) /*0x2422*/ { @@ -1188,7 +1188,7 @@ } Status = (*(__int64 ( **)(void *, __int64 (*)(), __int64 *))(qword_44B0 + 192))( /*0x245e*/ &unk_4280, - sub_212C, + BootScriptCloseCallback, &qword_4498); if ( Status < 0 ) /*0x2467*/ { @@ -1200,7 +1200,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*/ { @@ -1275,7 +1275,7 @@ FreePool(v22); /*0x23f8*/ Status = (*(__int64 ( **)(void *, __int64 (*)(), __int64 *))(qword_44B0 + 192))( /*0x2419*/ &unk_42B0, - sub_212C, + BootScriptCloseCallback, &qword_44B8); if ( Status < 0 ) /*0x2422*/ { @@ -1284,7 +1284,7 @@ } Status = (*(__int64 ( **)(void *, __int64 (*)(), __int64 *))(qword_44B0 + 192))( /*0x245e*/ &unk_4280, - sub_212C, + BootScriptCloseCallback, &qword_4498); if ( Status < 0 ) /*0x2467*/ { @@ -1296,7 +1296,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*/ { @@ -1371,7 +1371,7 @@ FreePool(v22); /*0x23f8*/ Status = (*(__int64 ( **)(void *, __int64 (*)(), __int64 *))(qword_44B0 + 192))( /*0x2419*/ &unk_42B0, - sub_212C, + BootScriptCloseCallback, &qword_44B8); if ( Status < 0 ) /*0x2422*/ { @@ -1380,7 +1380,7 @@ } Status = (*(__int64 ( **)(void *, __int64 (*)(), __int64 *))(qword_44B0 + 192))( /*0x245e*/ &unk_4280, - sub_212C, + BootScriptCloseCallback, &qword_4498); if ( Status < 0 ) /*0x2467*/ { @@ -1392,7 +1392,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*/ { @@ -1467,7 +1467,7 @@ FreePool(v22); /*0x23f8*/ Status = (*(__int64 ( **)(void *, __int64 (*)(), __int64 *))(qword_44B0 + 192))( /*0x2419*/ &unk_42B0, - sub_212C, + BootScriptCloseCallback, &qword_44B8); if ( Status < 0 ) /*0x2422*/ { @@ -1476,7 +1476,7 @@ } Status = (*(__int64 ( **)(void *, __int64 (*)(), __int64 *))(qword_44B0 + 192))( /*0x245e*/ &unk_4280, - sub_212C, + BootScriptCloseCallback, &qword_4498); if ( Status < 0 ) /*0x2467*/ { @@ -1488,7 +1488,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*/ { @@ -1563,7 +1563,7 @@ FreePool(v22); /*0x23f8*/ Status = (*(__int64 ( **)(void *, __int64 (*)(), __int64 *))(qword_44B0 + 192))( /*0x2419*/ &unk_42B0, - sub_212C, + BootScriptCloseCallback, &qword_44B8); if ( Status < 0 ) /*0x2422*/ { @@ -1572,7 +1572,7 @@ } Status = (*(__int64 ( **)(void *, __int64 (*)(), __int64 *))(qword_44B0 + 192))( /*0x245e*/ &unk_4280, - sub_212C, + BootScriptCloseCallback, &qword_4498); if ( Status < 0 ) /*0x2467*/ { @@ -1584,7 +1584,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*/ { @@ -1659,7 +1659,7 @@ FreePool(v22); /*0x23f8*/ Status = (*(__int64 ( **)(void *, __int64 (*)(), __int64 *))(qword_44B0 + 192))( /*0x2419*/ &unk_42B0, - sub_212C, + BootScriptCloseCallback, &qword_44B8); if ( Status < 0 ) /*0x2422*/ { @@ -1668,7 +1668,7 @@ } Status = (*(__int64 ( **)(void *, __int64 (*)(), __int64 *))(qword_44B0 + 192))( /*0x245e*/ &unk_4280, - sub_212C, + BootScriptCloseCallback, &qword_4498); if ( Status < 0 ) /*0x2467*/ { @@ -1680,7 +1680,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/MdeModulePkg/Universal/PCD/Pei/Service.c/PchResetRuntime/PchResetRuntime.h b/MdeModulePkg/Universal/PCD/Pei/Service.c/PchResetRuntime/PchResetRuntime.h index 081d974..f0f66f7 100644 --- a/MdeModulePkg/Universal/PCD/Pei/Service.c/PchResetRuntime/PchResetRuntime.h +++ b/MdeModulePkg/Universal/PCD/Pei/Service.c/PchResetRuntime/PchResetRuntime.h @@ -46,7 +46,7 @@ EFI_STATUS EFIAPI -BootScriptWriteEntry( +BootScriptSaveHeader( VOID ); diff --git a/MdePkg/Library/UefiBootServicesTableLib/AmiDeviceGuardApi/AmiDeviceGuardApi.c b/MdePkg/Library/UefiBootServicesTableLib/AmiDeviceGuardApi/AmiDeviceGuardApi.c index 5aa04ad..5adaa94 100644 --- a/MdePkg/Library/UefiBootServicesTableLib/AmiDeviceGuardApi/AmiDeviceGuardApi.c +++ b/MdePkg/Library/UefiBootServicesTableLib/AmiDeviceGuardApi/AmiDeviceGuardApi.c @@ -10,35 +10,35 @@ Functional Overview: 1. Entry Point (ModuleEntryPoint at 0x390): - Initialises global UEFI table pointers (BS, RT, ST) - - Calls HobLib initialisation (sub_89C) + - Calls HobLib initialization - Installs the Device Guard API protocol on a new handle - 2. Read "db" Variable (sub_4F8 at 0x4F8): + 2. Read "db" Variable (query path at 0x4F8): - Gets the size of the current "db" variable - Allocates a buffer and reads the variable data - - Calls the certificate lookup dispatcher (sub_106C) + - Calls the certificate lookup dispatcher to search for a matching certificate by subject name - Returns the variable data or a not-found status - 3. Update "db" Variable (sub_5D4 at 0x5D4): + 3. Update "db" Variable (update path at 0x5D4): - Gets the current "db" variable size - Allocates a buffer and reads the existing data - - Parses the data via sub_12EC + - Parses the data via the signature parser - Allocates a new buffer with room for timestamp + existing data - - Fills in the current timestamp via sub_DE4 + - Fills in the current timestamp via the timestamp builder - Copies the existing signature data into the new buffer - - Writes the new value via sub_C44 + - Writes the new value via the timestamped variable setter - Returns success or failure - 4. Timestamp Generator (sub_DE4 at 0xDE4): + 4. Timestamp Generator (timestamp builder at 0xDE4): - Creates a DEVICE_GUARD_TIMESTAMP structure with current date/time - Calls GetTime() via RuntimeServices to fill in year/month/day/hour/min/sec - Prints the timestamp for debug purposes - - Calls sub_16D0 (CopyMem) to copy the time structure + - Copies the time structure into the output buffer - Sets the structure size and format magic - - Initialises a GUID via sub_14A0 (two GUID writes) + - Initializes the timestamp GUID markers - 5. Variable Setter (sub_C44 at 0xC44): + 5. Variable Setter (timestamped variable setter at 0xC44): - Takes a data buffer, size, and variable attributes - First attempts to clear the NV variable by setting size 0 - If the variable exists (EFI_BUFFER_TOO_SMALL), gets current time @@ -47,7 +47,7 @@ - On success, queries the old variable size for debug logging - Returns the SetVariable status - 6. Certificate Lookup (sub_106C at 0x106C): + 6. Certificate Lookup (certificate lookup helper at 0x106C): - Takes a pointer to signature list data and a subject name - Locates the gEfiImageSecurityDatabaseGuid protocol - Allocates a temporary buffer for certificate parsing @@ -59,10 +59,10 @@ - On match, returns the found certificate pointer - Frees temporary buffers before return - 7. Debug / Assert Support (sub_7A0, sub_7E8, sub_720): - - sub_7A0: Debug print via gEfiDebugMaskProtocol - - sub_7E8: Debug assertion with file/line/message - - sub_720: Locate gEfiDebugMaskProtocol for debug output + 7. Debug / Assert Support: + - Debug print via the debug mask protocol + - Debug assertion with file, line, and message + - Locate the debug mask protocol for debug output Build Information: - Source paths indicate EDK II build from "e:\\hs\\" workspace @@ -105,7 +105,7 @@ // // 0x1F30 - First component GUID for timestamp magic // 0x1F38 - Second component GUID for timestamp magic -// Used by sub_14A0 when building the timestamp header. +// Used when building the timestamp header. // STATIC EFI_GUID mTimeStampGuid1; STATIC EFI_GUID mTimeStampGuid2; @@ -138,7 +138,7 @@ // // 0x1F80 - First GUID for HOB list owner GUID comparison // 0x1F88 - Second GUID for HOB list owner GUID comparison -// Used by sub_14E4 to match against HOB owner GUIDs. +// Used to match against HOB owner GUIDs. // STATIC EFI_GUID mHobOwnerGuid1; STATIC EFI_GUID mHobOwnerGuid2; @@ -2401,4 +2401,4 @@ FindCertificateBySubjectImpl, AppendSignatureEntryImpl, UpdateSignatureDatabaseImpl -}; \ No newline at end of file +}; diff --git a/MdePkg/Library/UefiBootServicesTableLib/AmiDeviceGuardApi/AmiDeviceGuardApi.h b/MdePkg/Library/UefiBootServicesTableLib/AmiDeviceGuardApi/AmiDeviceGuardApi.h index 91e04ec..8bdc4c6 100644 --- a/MdePkg/Library/UefiBootServicesTableLib/AmiDeviceGuardApi/AmiDeviceGuardApi.h +++ b/MdePkg/Library/UefiBootServicesTableLib/AmiDeviceGuardApi/AmiDeviceGuardApi.h @@ -273,7 +273,7 @@ EFI_STATUS EFIAPI -by sub_14A0 when building the timestamp header.( +used when building the timestamp header.( VOID ); @@ -375,7 +375,7 @@ EFI_STATUS EFIAPI -by sub_14E4 to match against HOB owner GUIDs.( +used to match against HOB owner GUIDs.( VOID ); @@ -1759,4 +1759,4 @@ VOID ); -#endif /* __AMIDEVICEGUARDAPI_H__ */ \ No newline at end of file +#endif /* __AMIDEVICEGUARDAPI_H__ */ diff --git a/PcAtChipsetPkg/PcatRealTimeClockSmm/PcatRealTimeClockSmm/MnpDxe/MnpDxe.c b/PcAtChipsetPkg/PcatRealTimeClockSmm/PcatRealTimeClockSmm/MnpDxe/MnpDxe.c index 91dff97..5894265 100644 --- a/PcAtChipsetPkg/PcatRealTimeClockSmm/PcatRealTimeClockSmm/MnpDxe/MnpDxe.c +++ b/PcAtChipsetPkg/PcatRealTimeClockSmm/PcatRealTimeClockSmm/MnpDxe/MnpDxe.c @@ -1,14 +1,20 @@ -/** @file - MnpDxe.c -- MnpDxe - - Auto-converted from IDA decompiler output. - Functions: 1 - -Copyright (c) HR650X BIOS Decompilation Project -**/ - #include "MnpDxe.h" +EFI_STATUS +EFIAPI +MnpDriverEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; -// Function: ModuleEntryPoint -EFI_STATUS ModuleEntryPoint(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) { signed __int64 v2; // rax EFI_STATUS v3; // rbx sub_560((__int64)ImageHandle, SystemTable); qword_2C08 = 0x8000000000000001uLL; if ( !sub_280(&unk_2B10) ) { v2 = sub_884(); if ( v2 >= 0 || qword_2C08 < 0 ) qword_2C08 = v2; sub_199C((__int64)&unk_2B10); sub_320(&unk_2B10, -1); sub_1ABC( "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\PcAtChipsetPkg\\PcatRealTimeClockSmm\\PcatRealTimeClockSmm\\DEBUG\\AutoGen.c", 436, "((BOOLEAN)(0==1))"); sub_1ABC( "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\PcAtChipsetPkg\\PcatRealTimeClockSmm\\PcatRealTimeClockSmm\\DEBUG\\AutoGen.c", 451, "((BOOLEAN)(0==1))"); } v3 = qword_2C08; if ( qword_2C08 < 0 ) sub_1D0C(); return v3; } + MnpInitializeGlobals (ImageHandle, SystemTable); + + Status = EFI_LOAD_ERROR; + if (MnpInstallDriverProtocols (ImageHandle)) { + Status = EFI_SUCCESS; + } + + return Status; +} diff --git a/PcAtChipsetPkg/PcatRealTimeClockSmm/PcatRealTimeClockSmm/MnpDxe/MnpDxe.h b/PcAtChipsetPkg/PcatRealTimeClockSmm/PcatRealTimeClockSmm/MnpDxe/MnpDxe.h index afabef3..95252b7 100644 --- a/PcAtChipsetPkg/PcatRealTimeClockSmm/PcatRealTimeClockSmm/MnpDxe/MnpDxe.h +++ b/PcAtChipsetPkg/PcatRealTimeClockSmm/PcatRealTimeClockSmm/MnpDxe/MnpDxe.h @@ -24,10 +24,10 @@ * ComponentName.c - Component name protocol (MnpGetDriverName, MnpGetControllerName) * * Dependencies: - * - SNP protocol (underlying Simple Network Protocol via &unk_A830) - * - DPC protocol (deferred procedure call via &unk_A880, qword_A9F8) - * - Device Path protocol (&unk_A850) - * - VLAN Config protocol (&unk_A820) + * - SNP protocol (underlying Simple Network Protocol) + * - DPC protocol (deferred procedure call support) + * - Device Path protocol + * - VLAN Config protocol */ #ifndef __MNP_DXE_H__ @@ -41,31 +41,31 @@ * ===================================================================== */ -/** SNP protocol GUID - for locating underlying SNP interface (at &unk_A830 in .data) */ +/** SNP protocol GUID - for locating the underlying SNP interface */ #define EFI_SIMPLE_NETWORK_PROTOCOL_GUID \ { 0xA19832B9, 0xAC25, 0x11D3, { 0x9A, 0x2D, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D } } -/** MNP protocol GUID - the service this driver installs (at &unk_A8A0) */ +/** MNP protocol GUID - the service this driver installs */ #define EFI_MANAGED_NETWORK_PROTOCOL_GUID \ { 0x552A84F1, 0x2CB6, 0x4B5D, { 0xA8, 0xCA, 0xD4, 0xCF, 0xB4, 0x23, 0xE3, 0x82 } } -/** MNP service binding GUID (at &unk_A860) */ +/** MNP service binding GUID */ #define EFI_MANAGED_NETWORK_SERVICE_BINDING_PROTOCOL_GUID \ { 0xF36FF770, 0xA7E1, 0x42CF, { 0x9E, 0xD2, 0x56, 0xF0, 0xF2, 0x71, 0xF4, 0x4C } } -/** Device path protocol GUID (at &unk_A850) */ +/** Device path protocol GUID */ #define EFI_DEVICE_PATH_PROTOCOL_GUID \ { 0x09576E91, 0x6D3F, 0x11D2, { 0x8E, 0x39, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B } } -/** VLAN config protocol GUID (at &unk_A820) */ +/** VLAN config protocol GUID */ #define EFI_VLAN_CONFIG_PROTOCOL_GUID \ { 0x9E23D768, 0xD2F4, 0x4366, { 0x9F, 0xC3, 0x89, 0xB2, 0x4E, 0x4C, 0x5E, 0x69 } } -/** Driver Binding protocol GUID (at &unk_A810) - standard UEFI */ +/** Driver Binding protocol GUID - standard UEFI */ #define EFI_DRIVER_BINDING_PROTOCOL_GUID \ { 0x18A031AB, 0xB443, 0x4D1A, { 0xA5, 0xC0, 0x0C, 0x09, 0x26, 0x1E, 0x9F, 0x71 } } -/** Component Name 2 protocol GUID (at &unk_A800) */ +/** Component Name 2 protocol GUID */ #define EFI_COMPONENT_NAME2_PROTOCOL_GUID \ { 0x6A7A5CFF, 0xE870, 0x4FBA, { 0xDA, 0x75, 0xAB, 0x30, 0x25, 0xCE, 0x14, 0x68 } } @@ -246,7 +246,7 @@ * MNP_RXDATA_WRAP - received data wrapper (allocated per packet) * ===================================================================== * - * Fields from sub_39A4 (create) and sub_38C8 (free/destroy): + * Fields from the receive-data wrapper create/free helpers: * +0x00: Link (LIST_ENTRY) * +0x10: Instance (MNP_INSTANCE_DATA *) -> a2[2] * +0x28: Event (EFI_EVENT) -> a2[5] @@ -268,10 +268,10 @@ * MNP_GROUP_ADDRESS - multicast group address tracking * ===================================================================== * - * From MnpGroupOpFormCtrlBlk at sub_27CC (size 56 = 0x38): + * From the multicast group control block allocation (size 56 = 0x38): * +0x00: Link (LIST_ENTRY) * +0x10: MacAddress (EFI_MAC_ADDRESS) - offset 0x10 in allocation - * +0x30: RefCnt (UINT64) - offset 0x30 = v17[6] + * +0x30: RefCnt (UINT64) - reference counter field */ typedef struct _MNP_GROUP_ADDRESS { LIST_ENTRY Link; /* +0x00: Link in MnpDeviceData->GroupAddressList */ @@ -283,7 +283,7 @@ * MNP_GROUP_CTRL_BLK - per-instance multicast group control block * +0x00: Link (LIST_ENTRY) * +0x10: GroupAddress (MNP_GROUP_ADDRESS *) - * Allocated by sub_27CC (size 24 = 0x18 bytes) + * Allocated by the group control block helper (size 24 = 0x18 bytes) */ typedef struct _MNP_GROUP_CTRL_BLK { LIST_ENTRY Link; /* +0x00: Link in Instance->GroupCtrlBlkList */ @@ -295,7 +295,7 @@ * MNP_CONFIGURE_DATA - configuration data for MNP.Configure() * ===================================================================== * - * 20 bytes total (0x14). Copied via sub_4CDC at offset +0xD0 in instance data. + * 20 bytes total (0x14). Copied into instance data at offset +0xD0. * Fields accessed via byte offsets: * +0x0A: EnableUnicastReceive (from code at Instance+0xDA) * +0x0B: EnableMulticastReceive (from code at Instance+0xDB) @@ -320,9 +320,9 @@ * ===================================================================== * * Signature: MNP_DEVICE_DATA_SIGNATURE (0x44706E4D = "MnpD") - * Allocated: sub_8E0 (MnpDriverBindingStart) - * Initialized: sub_1700 (MnpInitializeDeviceData) - * Teardown: sub_1A58 (MnpCleanDeviceData) / sub_1CC8 (MnpStop) + * Allocated: MnpDriverBindingStart + * Initialized: MnpInitializeDeviceData + * Teardown: MnpCleanDeviceData / MnpStop * * Known field offsets from decompiled code: */ @@ -343,16 +343,16 @@ UINT64 RefCount; /* +0x048: Child service data count */ UINT64 Field_0x50; /* +0x050: */ - VOID *MnpServiceSnp; /* +0x058: SNP from MNP_SERVICE_DATA (allocated by sub_7070) */ + VOID *MnpServiceSnp; /* +0x058: SNP from MNP_SERVICE_DATA */ - UINT64 SnpModeData; /* +0x060: SNP mode data pointer (from snp->Mode via v16+0x78) */ + UINT64 SnpModeData; /* +0x060: SNP mode data pointer */ UINT32 BufferLength; /* +0x0F0: Max packet buf size (Snp->Mode->HdrSize + 8 + Snp->Mode->MediaHdrSize) */ UINT32 HeaderLength; /* +0x0F4: Aligned header length */ - UINT32 ConfiguredChildren; /* +0x0??: Count of configured children (v4[56], 0xE0) */ - UINT32 McastFilterCnt; /* +0x0??: Count of multicast filters (v4[28]) */ - UINT32 McastFilterCnt2; /* +0x0??: Second mcast counter (v4[29]) */ + UINT32 ConfiguredChildren; /* +0x0??: Count of configured children */ + UINT32 McastFilterCnt; /* +0x0??: Count of multicast filters */ + UINT32 McastFilterCnt2; /* +0x0??: Secondary multicast counter */ UINT32 EnableVlan; /* +0x0??: EnableVlan flag */ UINT32 EnablePromiscuous; /* +0x0??: EnablePromiscuous flag */ @@ -378,7 +378,7 @@ /* * ===================================================================== - * MNP_SERVICE_DATA (size 0x60 = 96 bytes) from sub_1B60 + * MNP_SERVICE_DATA (size 0x60 = 96 bytes) * ===================================================================== * * Signature: MNP_SERVICE_DATA_SIGNATURE (0x53706E4D = "MnpS") @@ -404,21 +404,21 @@ /* * ===================================================================== - * MNP_INSTANCE_DATA (size 0xE8 = 232 bytes) from sub_D4C / sub_1E94 + * MNP_INSTANCE_DATA (size 0xE8 = 232 bytes) * ===================================================================== * * Signature: MNP_INSTANCE_DATA_SIGNATURE (0x49706E4D = "MnpI") * CR_OFFSET: -0x28 (from protocol interface pointer) * - * Allocated by MnpServiceBindingCreateChild (sub_D4C, 232 bytes) - * Initialized by MnpInitInstanceData (sub_1E94) + * Allocated by MnpServiceBindingCreateChild (232 bytes) + * Initialized by MnpInitInstanceData */ struct _MNP_INSTANCE_DATA { UINT32 Signature; /* +0x00: MNP_INSTANCE_DATA_SIGNATURE */ MNP_SERVICE_DATA *MnpServiceData; /* +0x08: Back pointer to service data */ /* EFI_MANAGED_NETWORK_PROTOCOL installed on this instance */ - UINT8 ProtocolBuffer[0x40]; /* +0x28: Copied from service data at sub_1E94 */ + UINT8 ProtocolBuffer[0x40]; /* +0x28: Copied from service data */ BOOLEAN IsConfigured; /* +0x68: Whether MnpConfigure() has been called */ BOOLEAN IsDestroyed; /* +0x69: Set during destroy */ @@ -912,4 +912,4 @@ #define NET_BUF_TRIM_HEAD 0 -#endif /* __MNP_DXE_H__ */ \ No newline at end of file +#endif /* __MNP_DXE_H__ */ diff --git a/PurleyPlatPkg/Ras/Memory/MemRas/MemRas.c b/PurleyPlatPkg/Ras/Memory/MemRas/MemRas.c index a1398d5..0d85179 100644 --- a/PurleyPlatPkg/Ras/Memory/MemRas/MemRas.c +++ b/PurleyPlatPkg/Ras/Memory/MemRas/MemRas.c @@ -240,24 +240,24 @@ // module-level buffers and structures. // // Init sequence (23 sub-initializers): -// 1. sub_6BC - Global lock/state initialization -// 2. sub_758 - BaseLib setjmp/longjmp context init -// 3. sub_794 - UEFI boot/runtime service table init -// 4. sub_10AC - Driver binding/entry point library init -// 5. sub_1430 - [stub] returns success -// 6. sub_163C - Memory allocation library init -// 7. sub_1928 - HOB list library init -// 8. sub_1AB8 - PCI Express library init -// 9. sub_1BC8 - [stub] returns success -// 10. sub_1C7C - SMM LockBox / S3 boot script library init -// 11. sub_1FB4 - Timer library init -// 12. sub_20CC - ACPI timer lib / decompress lib / services table -// 13. sub_35D4 - EMCA platform hooks / MP sync data lib init -// 14. sub_43A0 - [stub] returns success -// 15. sub_51A8 - SMM communication / variable protocol init -// 16. sub_552C - IPMI / error reporting library init -// 17. sub_5FB4 - OemRasLib init -// 18. sub_6C00 - Platform-specific RAS init +// 1. MemRasInitGlobalsLock - Global lock/state initialization +// 2. MemRasInitContext - BaseLib setjmp/longjmp context init +// 3. MemRasInitServiceTables - UEFI boot/runtime service table init +// 4. MemRasInitEntryLibraries - Driver binding/entry point library init +// 5. MemRasInitStub - [stub] returns success +// 6. MemRasInitMemoryLibraries - Memory allocation library init +// 7. MemRasInitHobLibraries - HOB list library init +// 8. MemRasInitPciLibraries - PCI Express library init +// 9. MemRasInitStub - [stub] returns success +// 10. MemRasInitS3Libraries - SMM LockBox / S3 boot script library init +// 11. MemRasInitTimerLibraries - Timer library init +// 12. MemRasInitAcpiLibraries - ACPI timer lib / decompress lib / services table +// 13. MemRasInitMcaHooks - MCE/MCA platform hooks / MP sync data lib init +// 14. MemRasInitStub - [stub] returns success +// 15. MemRasInitSmmInterfaces - SMM communication / variable protocol init +// 16. MemRasInitErrorReporting - IPMI / error reporting library init +// 17. MemRasInitOemRas - OemRasLib init +// 18. MemRasInitPlatformRas - Platform-specific RAS init // EFI_STATUS MemRasInitGlobals( @@ -550,7 +550,7 @@ gBS->CreateEventEx( EVT_NOTIFY_SIGNAL, TPL_NOTIFY, - sub_1A0D4, + MemRasMceEventNotify, NULL, &gEventGroupGuid1, &Event1 @@ -558,7 +558,7 @@ gBS->CreateEventEx( EVT_NOTIFY_SIGNAL, TPL_NOTIFY, - sub_1A0D4, + MemRasMceEventNotify, NULL, &gEventGroupGuid2, &Event2 diff --git a/PurleyPlatPkg/Ras/Memory/MemRas/MemRas.h b/PurleyPlatPkg/Ras/Memory/MemRas/MemRas.h index 2fd0795..235f3ec 100644 --- a/PurleyPlatPkg/Ras/Memory/MemRas/MemRas.h +++ b/PurleyPlatPkg/Ras/Memory/MemRas/MemRas.h @@ -537,13 +537,13 @@ EFI_STATUS EFIAPI -Protocol->SpareRank = sub_1A4CC;( +Protocol->SpareRank = MemRasSpareRank;( VOID ); EFI_STATUS EFIAPI -Protocol->ForwardAddrTranslate = sub_DBFC;( +Protocol->ForwardAddrTranslate = MemRasForwardAddrTranslate;( VOID ); @@ -819,7 +819,7 @@ EFI_STATUS EFIAPI -(!sub_2C0(&unk_23560)) {( +(!MemRasContextIsReady(&unk_23560)) {( VOID ); @@ -1021,4 +1021,4 @@ VOID ); -#endif /* __MEMRAS_H__ */ \ No newline at end of file +#endif /* __MEMRAS_H__ */ diff --git a/PurleyPlatPkg/Ras/Smm/ErrHandling/FpgaErrorHandler/FpgaErrorHandler/FpgaErrorHandler.c b/PurleyPlatPkg/Ras/Smm/ErrHandling/FpgaErrorHandler/FpgaErrorHandler/FpgaErrorHandler.c index 05e8697..5661568 100644 --- a/PurleyPlatPkg/Ras/Smm/ErrHandling/FpgaErrorHandler/FpgaErrorHandler/FpgaErrorHandler.c +++ b/PurleyPlatPkg/Ras/Smm/ErrHandling/FpgaErrorHandler/FpgaErrorHandler/FpgaErrorHandler.c @@ -9,40 +9,33 @@ #include "FpgaErrorHandler.h" -// -// Recovered module state from decompilation maps. -// - EFI_STATUS mFpgaErrorHandlerModuleStatus = 0x8000000000000001ULL; UINT8 mFpgaErrorHandlerJumpBuffer[0xF8]; -// -// Function: _ModuleEntryPoint (recovered entry symbol from docs) -// EFI_STATUS EFIAPI -_ModuleEntryPoint( +FpgaErrorHandlerEntryPoint( EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable ) { - EFI_STATUS HandlerSetupStatus; - EFI_STATUS ReturnStatus; - VOID *SetJumpState = NULL; + EFI_STATUS CallbackStatus; + EFI_STATUS EntryStatus; + VOID *JumpBuffer = NULL; FpgaErrorHandlerInitializeContext(ImageHandle, SystemTable); mFpgaErrorHandlerModuleStatus = 0x8000000000000001uLL; - SetJumpState = mFpgaErrorHandlerJumpBuffer; - if ( !FpgaErrorHandlerSetJumpStateSave(SetJumpState) ) + JumpBuffer = mFpgaErrorHandlerJumpBuffer; + if ( !FpgaErrorHandlerSetJumpStateSave(JumpBuffer) ) { - HandlerSetupStatus = RegisterFpgaErrorCallbacks(); - if ( HandlerSetupStatus >= 0 || mFpgaErrorHandlerModuleStatus < 0 ) + CallbackStatus = RegisterFpgaErrorCallbacks(); + if ( CallbackStatus >= 0 || mFpgaErrorHandlerModuleStatus < 0 ) { - mFpgaErrorHandlerModuleStatus = HandlerSetupStatus; + mFpgaErrorHandlerModuleStatus = CallbackStatus; } - FpgaErrorHandlerSetJumpStateCheck(SetJumpState); - FpgaErrorHandlerSetJumpRecover(SetJumpState, -1); + FpgaErrorHandlerSetJumpStateCheck(JumpBuffer); + FpgaErrorHandlerSetJumpRecover(JumpBuffer, -1); FpgaErrorHandlerAssert( "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\PurleyPlatPkg\\Ras\\Smm\\ErrHandling\\FpgaErrorHandler\\FpgaErrorHandler\\" "DEBUG\\AutoGen.c", @@ -54,12 +47,12 @@ 626, "((BOOLEAN)(0==1))"); } - ReturnStatus = mFpgaErrorHandlerModuleStatus; + EntryStatus = mFpgaErrorHandlerModuleStatus; if ( mFpgaErrorHandlerModuleStatus < 0 ) { FpgaErrorHandlerCleanup(); } - return ReturnStatus; + return EntryStatus; } // @@ -72,5 +65,5 @@ EFI_SYSTEM_TABLE *SystemTable ) { - return _ModuleEntryPoint(ImageHandle, SystemTable); + return FpgaErrorHandlerEntryPoint(ImageHandle, SystemTable); } diff --git a/PurleyPlatPkg/Ras/Smm/ErrHandling/FpgaErrorHandler/FpgaErrorHandler/FpgaErrorHandler.h b/PurleyPlatPkg/Ras/Smm/ErrHandling/FpgaErrorHandler/FpgaErrorHandler/FpgaErrorHandler.h index b52e0d3..41f2243 100644 --- a/PurleyPlatPkg/Ras/Smm/ErrHandling/FpgaErrorHandler/FpgaErrorHandler/FpgaErrorHandler.h +++ b/PurleyPlatPkg/Ras/Smm/ErrHandling/FpgaErrorHandler/FpgaErrorHandler/FpgaErrorHandler.h @@ -12,23 +12,13 @@ #include "../uefi_headers/Uefi.h" -// -// Public entry symbols -// - -/// -/// _ModuleEntryPoint -- internal entry symbol recovered from AutoGen path -/// EFI_STATUS EFIAPI -_ModuleEntryPoint( +FpgaErrorHandlerEntryPoint( EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable ); -/// -/// ModuleEntryPoint -- compatibility wrapper that forwards to _ModuleEntryPoint -/// EFI_STATUS EFIAPI ModuleEntryPoint( @@ -36,15 +26,6 @@ EFI_SYSTEM_TABLE *SystemTable ); -// -// Recovered helper aliases from local docs. -// - -/// -/// FpgaErrorHandlerInitializeContext -- AutoGen init helper (`sub_5C0`). -/// `sub_5C0` is the decompilation symbol name for this helper. -/// -#define sub_5C0 FpgaErrorHandlerInitializeContext EFI_STATUS EFIAPI FpgaErrorHandlerInitializeContext( @@ -52,44 +33,24 @@ EFI_SYSTEM_TABLE *SystemTable ); -/// -/// RegisterFpgaErrorCallbacks -- module setup routine (`sub_EAC`). -/// `sub_EAC` is the decompilation symbol name for this routine. -/// -#define sub_EAC RegisterFpgaErrorCallbacks EFI_STATUS EFIAPI RegisterFpgaErrorCallbacks( VOID ); -/// -/// FpgaErrorHandlerSetJumpStateSave -- context save (`sub_280`). -/// `sub_280` is the decompilation symbol name for this helper. -/// -#define sub_280 FpgaErrorHandlerSetJumpStateSave EFI_STATUS EFIAPI FpgaErrorHandlerSetJumpStateSave( VOID * ); -/// -/// FpgaErrorHandlerSetJumpStateCheck -- set-jump context validator (`sub_11E0`). -/// `sub_11E0` is the decompilation symbol name for this helper. -/// -#define sub_11E0 FpgaErrorHandlerSetJumpStateCheck EFI_STATUS EFIAPI FpgaErrorHandlerSetJumpStateCheck( VOID * ); -/// -/// FpgaErrorHandlerSetJumpRecover -- context restore/longjmp (`sub_320`). -/// `sub_320` is the decompilation symbol name for this helper. -/// -#define sub_320 FpgaErrorHandlerSetJumpRecover EFI_STATUS EFIAPI FpgaErrorHandlerSetJumpRecover( @@ -97,11 +58,6 @@ INTN ); -/// -/// FpgaErrorHandlerAssert -- debug assert logging (`sub_11A0`). -/// `sub_11A0` is the decompilation symbol name for this helper. -/// -#define sub_11A0 FpgaErrorHandlerAssert EFI_STATUS EFIAPI FpgaErrorHandlerAssert( @@ -110,11 +66,6 @@ CONST CHAR8 *Expression ); -/// -/// FpgaErrorHandlerCleanup -- SMM pool/free failure path (`sub_13D4`). -/// `sub_13D4` is the decompilation symbol name for this helper. -/// -#define sub_13D4 FpgaErrorHandlerCleanup EFI_STATUS EFIAPI FpgaErrorHandlerCleanup( diff --git a/PurleyPlatPkg/Ras/Whea/LastBootErrorLog/LastBootErrorLog/DEBUG/LastBootErrorLog/LastBootErrorLog.h b/PurleyPlatPkg/Ras/Whea/LastBootErrorLog/LastBootErrorLog/DEBUG/LastBootErrorLog/LastBootErrorLog.h index 2bbef5c..9b1533a 100644 --- a/PurleyPlatPkg/Ras/Whea/LastBootErrorLog/LastBootErrorLog/DEBUG/LastBootErrorLog/LastBootErrorLog.h +++ b/PurleyPlatPkg/Ras/Whea/LastBootErrorLog/LastBootErrorLog/DEBUG/LastBootErrorLog/LastBootErrorLog.h @@ -54,26 +54,27 @@ ); // -// Legacy decompiler labels kept for compatibility with existing references. +// Driver entry points and helpers. // -#define sub_3D94 LastBootErrorLogAutoGenInit -#define sub_41C0 LastBootErrorLogMain -#define sub_4150 LastBootErrorLogUnload +#define LastBootErrorLogEntryPoint ModuleEntryPoint +#define LastBootErrorLogAutoGenInit LastBootErrorLogAutoGenInit +#define LastBootErrorLogMainEntry LastBootErrorLogMain +#define LastBootErrorLogUnloadEntry LastBootErrorLogUnload -#define sub_192C LastBootErrorLogWheaHooksInit -#define sub_23FC LastBootErrorLogProcessLastBootError -#define sub_34BC LastBootErrorLogDecodeProcessorError -#define sub_2EC4 LastBootErrorLogFindAndDispatchWheaError -#define sub_208C LastBootErrorLogProcessPlatformError -#define sub_27D4 LastBootErrorLogBuildErrorNotification -#define sub_2A74 CmcErrorHandler -#define sub_2E08 SmiErrorHandler -#define sub_2E30 UeErrorHandler +#define LastBootErrorLogWheaHooksInitEntry LastBootErrorLogWheaHooksInit +#define LastBootErrorLogProcessBootRecord LastBootErrorLogProcessLastBootError +#define LastBootErrorLogDecodeProcessorRecord LastBootErrorLogDecodeProcessorError +#define LastBootErrorLogFindAndDispatchError LastBootErrorLogFindAndDispatchWheaError +#define LastBootErrorLogProcessPlatformRecord LastBootErrorLogProcessPlatformError +#define LastBootErrorLogBuildNotification LastBootErrorLogBuildErrorNotification +#define LastBootErrorLogCmcHandler CmcErrorHandler +#define LastBootErrorLogSmiHandler SmiErrorHandler +#define LastBootErrorLogUeHandler UeErrorHandler -#define qword_5698 gLastBootErrorHob -#define qword_5690 gWheaBootProtocol -#define qword_56A8 gWheaBootProtocolTable -#define qword_56A0 gWheaProtocolAlternate -#define qword_56D0 gSmiCmcProtocol +#define gLastBootErrorHob gLastBootErrorHob +#define gWheaBootProtocol gWheaBootProtocol +#define gWheaBootProtocolTable gWheaBootProtocolTable +#define gWheaProtocolAlternate gWheaProtocolAlternate +#define gSmiCmcProtocol gSmiCmcProtocol #endif /* __LASTBOOTERRORLOG_H__ */ diff --git a/PurleyRpPkg/Platform/Dxe/MeSmmProtocolThunk/MeSmmProtocolThunk.c b/PurleyRpPkg/Platform/Dxe/MeSmmProtocolThunk/MeSmmProtocolThunk.c index 5e6733a..d8698bc 100644 --- a/PurleyRpPkg/Platform/Dxe/MeSmmProtocolThunk/MeSmmProtocolThunk.c +++ b/PurleyRpPkg/Platform/Dxe/MeSmmProtocolThunk/MeSmmProtocolThunk.c @@ -18,22 +18,22 @@ { __int64 v2; // rax - sub_4D4(ImageHandle, SystemTable); + MeSmmThunkLibraryConstructor(ImageHandle, SystemTable); qword_1078 = 0x8000000000000001uLL; - if ( !sub_2C0(&unk_F80) ) + if ( !MeSmmThunkContextInitialized(&unk_F80) ) { - v2 = sub_6D4(); + v2 = InstallMeSmmProtocolThunk(); if ( v2 >= 0 || qword_1078 < 0 ) qword_1078 = v2; - sub_7E4(&unk_F80); - sub_360(&unk_F80, -1); - sub_904( + InitializeMeSmmThunkContext(&unk_F80); + TeardownMeSmmThunkContext(&unk_F80, -1); + DebugAssert( "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\PurleyRpPkg\\Platform\\Dxe\\MeSmmProtocolThunk\\MeSmmProtocolThunk\\DEBUG\\AutoGen.c", 178, "((BOOLEAN)(0==1))"); - sub_904( + DebugAssert( "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\PurleyRpPkg\\Platform\\Dxe\\MeSmmProtocolThunk\\MeSmmProtocolThunk\\DEBUG\\AutoGen.c", 193, "((BOOLEAN)(0==1))"); diff --git a/PurleyRpPkg/Platform/Dxe/MeSmmProtocolThunk/MeSmmProtocolThunk.h b/PurleyRpPkg/Platform/Dxe/MeSmmProtocolThunk/MeSmmProtocolThunk.h index 62ea3cb..9d68d72 100644 --- a/PurleyRpPkg/Platform/Dxe/MeSmmProtocolThunk/MeSmmProtocolThunk.h +++ b/PurleyRpPkg/Platform/Dxe/MeSmmProtocolThunk/MeSmmProtocolThunk.h @@ -26,57 +26,57 @@ ); /// -/// sub_4D4 +/// MeSmmThunkLibraryConstructor /// EFI_STATUS EFIAPI -sub_4D4( +MeSmmThunkLibraryConstructor( VOID ); /// -/// sub_6D4 +/// InstallMeSmmProtocolThunk /// EFI_STATUS EFIAPI -sub_6D4( +InstallMeSmmProtocolThunk( VOID ); /// -/// sub_7E4 +/// InitializeMeSmmThunkContext /// EFI_STATUS EFIAPI -sub_7E4( +InitializeMeSmmThunkContext( VOID ); /// -/// sub_360 +/// TeardownMeSmmThunkContext /// EFI_STATUS EFIAPI -sub_360( +TeardownMeSmmThunkContext( VOID ); /// -/// sub_904 +/// DebugAssert /// EFI_STATUS EFIAPI -sub_904( +DebugAssert( VOID ); /// -/// sub_2C0 +/// MeSmmThunkContextInitialized /// EFI_STATUS EFIAPI -sub_2C0( +MeSmmThunkContextInitialized( VOID ); -#endif /* __MESMMPROTOCOLTHUNK_H__ */ \ No newline at end of file +#endif /* __MESMMPROTOCOLTHUNK_H__ */ diff --git a/PurleyRpPkg/SystemBoard/Pei/SystemBoardPpi/SystemBoardPpi.c b/PurleyRpPkg/SystemBoard/Pei/SystemBoardPpi/SystemBoardPpi.c index ca9fbcc..6e29702 100644 --- a/PurleyRpPkg/SystemBoard/Pei/SystemBoardPpi/SystemBoardPpi.c +++ b/PurleyRpPkg/SystemBoard/Pei/SystemBoardPpi/SystemBoardPpi.c @@ -230,8 +230,8 @@ } /*Phase 3: Determine board personality based on BP type and platform */ - BOOLEAN IsRiserCard = sub_FFDEFB51(); /*Check if riser is present */ - BOOLEAN SomeFlag = sub_FFDEFB31(); /*Some platform flag */ + BOOLEAN IsRiserCard = IsRiserCardPresent(); /*Check if riser is present */ + BOOLEAN SomeFlag = IsPlatformRiserOverrideEnabled(); /*Platform-specific riser override */ if (IsRiserCard == 1) { /*Riser card platform */ @@ -360,9 +360,9 @@ } /*Phase 2: Determine riser card type and slot mapping */ - UINT8 RiserPresence = sub_FFDEFB51(1); /*Check riser presence */ + UINT8 RiserPresence = GetRiserCardPresence(); /*Check riser presence */ UINT8 SomeConfig = 0; - sub_FFDEFAE8((CHAR8 *)&SlotCount + 3, &SomeConfig); + ReadBoardSlotConfig((CHAR8 *)&SlotCount + 3, &SomeConfig); *(_WORD *)(BoardData + 109) = 9; /*Default max slots */ @@ -379,9 +379,9 @@ /*Riser card type 2 */ DebugAssert(0x80000000, "2U\n"); - UINT8 Riser1Id = sub_FFDEFA30(); /*Read riser 1 ID */ + UINT8 Riser1Id = ReadLeftRiserCardId(); /*Read riser 1 ID */ DebugAssert(0x80000000, "RiserCard1 ID:0x%x\n", Riser1Id); - UINT8 Riser2Id = sub_FFDEFA98(); /*Read riser 2 ID */ + UINT8 Riser2Id = ReadRightRiserCardId(); /*Read riser 2 ID */ DebugAssert(0x80000000, "RiserCard2 ID:0x%x\n", Riser2Id); /*Map riser 1 type */ @@ -432,7 +432,7 @@ if (RiserPresence == 1) { /*Type 1 riser: assign slot numbers */ - if (sub_FFDEFB31(1, 0)) { /*Some platform check */ + if (IsPlatformRiserOverrideEnabled(1, 0)) { /*Some platform check */ UINT8 I = ConfigByte + 1; if (I <= 12) { UINT16 *SlotMap = (_WORD *)(BoardData + 2 *I + 137); @@ -465,7 +465,7 @@ *(_WORD *)(BoardData + 103) = SlotBase + ConfigByte + 3; } /*Same slot map logic */ - if (sub_FFDEFB31(SlotBase, ConfigByte)) { + if (IsPlatformRiserOverrideEnabled(SlotBase, ConfigByte)) { UINT8 I = ConfigByte + 1; if (I <= 12) { UINT16 *SlotMap = (_WORD *)(BoardData + 2 *I + 137); @@ -531,7 +531,7 @@ /*Step 3: Get riser card configuration */ INT32 BroadwayCfgResult = 0; UINT8 BroadwayPersonality = 0; - sub_FFDEF854(&BroadwayPersonality, &CurrentConfigIOU2, SkuPersonality); + GetBroadwayPersonality(&BroadwayPersonality, &CurrentConfigIOU2, SkuPersonality); if (BroadwayPersonality == 1) { /*Broadway (dual-riser) personality */ @@ -666,7 +666,7 @@ if (BroadwayConfigCount) { /*Read board config (BroadwayConfig) via I2C/SMBUS */ UINT8 BroadwayCfg[4] = { 0 }; - sub_FFDEBCD9(SkuPersonality, BroadwayCfg); + ReadBroadwayConfiguration(SkuPersonality, BroadwayCfg); DebugAssert(64, "Broadway Config: 0x%02x, 0x%02x, 0x%02x, 0x%02x\n", BroadwayCfg[0], BroadwayCfg[1], BroadwayCfg[2], BroadwayCfg[3]); @@ -792,7 +792,7 @@ ) { /*Look up board info HOB */ - PVOID BoardHob = sub_FFDEEA92(&unk_FFDF1FEC, this); + PVOID BoardHob = GetBoardInfoHob(&gSystemBoardInfoHobGuid, this); if (BoardHob) { return *(_BYTE *)(BoardHob + 61); @@ -830,7 +830,7 @@ /*Get PCH LPC device ID via PciExpress */ INT32 SmbusBase = SmbusPciBaseAddr(0); - UINT16 LpcDeviceId = sub_FFDEE981(SmbusBase + 2); + UINT16 LpcDeviceId = ReadPciDeviceId16(SmbusBase + 2); /*Check for Server PCH devices */ if ((LpcDeviceId >= 0xA1C0 && LpcDeviceId <= 0xA1CF) || @@ -895,10 +895,10 @@ INTN GetPeiServices (VOID) { PEI_SERVICES_PPI PeiServicesPpi; - sub_FFDEFD6E(&PeiServicesPpi); + LocatePeiServicesPpi(&PeiServicesPpi); INTN PeiServices = *(UINT32 *)(*(UINT32 *)&PeiServicesPpi[2] - 4); if (!PeiServices) { - sub_FFDEEB1E("PeiServices != ((void *) 0)"); + ReportNullPointerAssertion("PeiServices != ((void *) 0)"); } return PeiServices; } @@ -936,4 +936,4 @@ /*PCH PCR memory-mapped base = 0xFD000000 + (PID << 16) + Offset */ *Data = *(UINT32 *)(Offset | ((Pid | 0xFFFFFD00) << 16)); return EFI_SUCCESS; -} \ No newline at end of file +} diff --git a/PurleyRpPkg/Uba/UbaMain/Pei/UbaMainPeim/UbaMainPeim.c b/PurleyRpPkg/Uba/UbaMain/Pei/UbaMainPeim/UbaMainPeim.c index e41a4da..1a758ee 100644 --- a/PurleyRpPkg/Uba/UbaMain/Pei/UbaMainPeim/UbaMainPeim.c +++ b/PurleyRpPkg/Uba/UbaMain/Pei/UbaMainPeim/UbaMainPeim.c @@ -7343,17 +7343,17 @@ if ( !*(_QWORD *)(a1 + 8) ) /*0x2c11a*/ return 4294967293LL; /*0x2c11a*/ *(_QWORD *)(a1 + 104) = NiiGetProtoType; /*0x2c13a*/ - *(_QWORD *)(a1 + 80) = nullsub_1; /*0x2c145*/ + *(_QWORD *)(a1 + 80) = UbaNoOp; /*0x2c145*/ *(_QWORD *)(a1 + 224) = NiiSnpInitialize; /*0x2c149*/ - *(_QWORD *)(a1 + 88) = nullsub_1; /*0x2c157*/ + *(_QWORD *)(a1 + 88) = UbaNoOp; /*0x2c157*/ *(_QWORD *)(a1 + 208) = Nii_3b478; /*0x2c15b*/ *(_QWORD *)(a1 + 112) = CompNameNullThunk; /*0x2c16c*/ *(_QWORD *)(a1 + 32) = CompNameNullThunk; /*0x2c177*/ *(_QWORD *)(a1 + 56) = NiiNullStub; /*0x2c17b*/ *(_QWORD *)(a1 + 152) = CompNameNullThunk; /*0x2c186*/ - *(_QWORD *)(a1 + 136) = nullsub_1; /*0x2c18d*/ + *(_QWORD *)(a1 + 136) = UbaNoOp; /*0x2c18d*/ *(_QWORD *)(a1 + 144) = CompNameNullThunk; /*0x2c19b*/ - *(_QWORD *)(a1 + 200) = nullsub_1; /*0x2c1a2*/ + *(_QWORD *)(a1 + 200) = UbaNoOp; /*0x2c1a2*/ *(_QWORD *)(a1 + 184) = CompNameNullThunk; /*0x2c1b0*/ *(_QWORD *)(a1 + 216) = NiiStnAddrSet; /*0x2c1b7*/ *(_QWORD *)(a1 + 96) = CompNameNullThunk; /*0x2c1c5*/ @@ -7370,7 +7370,7 @@ *(_QWORD *)(a1 + 1152) = v3; /*0x2c208*/ *(_QWORD *)(a1 + 1160) = CompNameNullThunk; /*0x2c20f*/ *(_QWORD *)(a1 + 1184) = v3; /*0x2c21d*/ - *(_QWORD *)(a1 + 1168) = nullsub_1; /*0x2c224*/ + *(_QWORD *)(a1 + 1168) = UbaNoOp; /*0x2c224*/ *(_QWORD *)(a1 + 1200) = v3; /*0x2c232*/ *(_QWORD *)(a1 + 1176) = NiiArpInit; /*0x2c239*/ *(_QWORD *)(a1 + 1192) = CompNameNullThunk; /*0x2c247*/ @@ -11307,7 +11307,7 @@ if ( *(_BYTE *)(a1 + 846) ) /*0x3210d*/ { *(_QWORD *)(a1 + 880) = CompNameNullThunk; /*0x3211d*/ - *(_QWORD *)(a1 + 984) = nullsub_1; /*0x3212b*/ + *(_QWORD *)(a1 + 984) = UbaNoOp; /*0x3212b*/ MngReadResponse(a1); /*0x32132*/ } else @@ -14357,9 +14357,9 @@ return v5; /*0x35db4*/ } -// Function: nullsub_1 @ 0x35db8 (0x3 bytes) +// Function: UbaNoOp @ 0x35db8 (0x3 bytes) -void nullsub_1() +void UbaNoOp() { ; /*0x35db8*/ } @@ -19277,10 +19277,10 @@ IfrnTable[117] = CompNameNullThunk; /*0x3ca2f*/ IfrnTable[118] = CompNameNullThunk; /*0x3ca36*/ IfrnTable[133] = CompNameNullThunk; /*0x3ca3d*/ - IfrnTable[123] = nullsub_1; /*0x3ca44*/ + IfrnTable[123] = UbaNoOp; /*0x3ca44*/ IfrnTable[124] = CompNameNullThunk; /*0x3ca4b*/ - IfrnTable[130] = nullsub_1; /*0x3ca52*/ - IfrnTable[131] = nullsub_1; /*0x3ca59*/ + IfrnTable[130] = UbaNoOp; /*0x3ca52*/ + IfrnTable[131] = UbaNoOp; /*0x3ca59*/ IfrnTable[111] = CompNameNullThunk; /*0x3ca60*/ return CompNameNullThunk; /*0x3ca67*/ } @@ -22168,7 +22168,7 @@ } while ( v5 < *(_WORD *)(a1 + 1264) ); /*0x40581*/ *(_QWORD *)(a1 + 1152) = CompNameNullThunk; /*0x4058a*/ - *(_QWORD *)(a1 + 1168) = nullsub_1; /*0x40598*/ + *(_QWORD *)(a1 + 1168) = UbaNoOp; /*0x40598*/ if ( *(_DWORD *)(a1 + 268) == 13 ) /*0x405a6*/ { *(_QWORD *)(a1 + 1160) = DxeRegister_3; /*0x405af*/ diff --git a/PurleyRpPkg/Uba/UbaMain/Pei/UbaMainPeim/UbaMainPeim.h b/PurleyRpPkg/Uba/UbaMain/Pei/UbaMainPeim/UbaMainPeim.h index db556b1..bbad6a7 100644 --- a/PurleyRpPkg/Uba/UbaMain/Pei/UbaMainPeim/UbaMainPeim.h +++ b/PurleyRpPkg/Uba/UbaMain/Pei/UbaMainPeim/UbaMainPeim.h @@ -274,7 +274,7 @@ // NiiValidateIpString @ 0x35c04 // NiiParseIpPrefixLen @ 0x35c94 // NiiStrToMac @ 0x35cd0 -// nullsub_1 @ 0x35db8 +// UbaNoOp @ 0x35db8 // DxeRegister_43 @ 0x35dbc // DxeRegister_44 @ 0x35df4 // DxeRegister_14 @ 0x35e2c diff --git a/PurleySktPkg/Dxe/CpuCsrAccess/CpuCsrAccess.c b/PurleySktPkg/Dxe/CpuCsrAccess/CpuCsrAccess.c index 1faab98..c386fdc 100644 --- a/PurleySktPkg/Dxe/CpuCsrAccess/CpuCsrAccess.c +++ b/PurleySktPkg/Dxe/CpuCsrAccess/CpuCsrAccess.c @@ -302,7 +302,7 @@ int v4; // r9d v4 = a3; /*0x17b4*/ LOBYTE(a3) = a2; /*0x17b9*/ LOBYTE(a2) = a1; /*0x17be*/ - return sub_2118(qword_60A0, a2, a3, v4, a4); /*0x17ce*/ + return CpuCsrWriteCommandWithPayload(qword_60A0, a2, a3, v4, a4); /*0x17ce*/ } __int64 CpuCsrReadWriteDispatch(unsigned __int8 a1, __int64 a2, __int64 a3) @@ -314,7 +314,7 @@ return CpuCsrPacketRead(qword_60A0, a1, a2, a3); /*0x184e*/ LOBYTE(a3) = a2; /*0x1820*/ LOBYTE(a2) = a1; /*0x1825*/ - return sub_268C(qword_60A0, a2, a3, v4); /*0x1853*/ + return CpuCsrDispatchReadWriteCommand(qword_60A0, a2, a3, v4); /*0x1853*/ } __int64 CpuCsrWriteDispatch2(unsigned __int8 a1, unsigned __int8 a2, int a3, int a4) @@ -325,7 +325,7 @@ if ( HIBYTE(a3) != 7 && HIBYTE(a3) != 11 && HIBYTE(a3) != 8 ) /*0x18a2*/ return CpuCsrPacketWrite(qword_60A0, a1, a2, a3, a4); /*0x18e5*/ LOBYTE(a3) = a2; /*0x18b1*/ - return sub_27D8(qword_60A0, a1, a3, v6, a4); /*0x18ea*/ + return CpuCsrWriteCommandWithStatus(qword_60A0, a1, a3, v6, a4); /*0x18ea*/ } __int64 CpuCsrWriteDispatch3(char a1, __int64 a2, unsigned int a3) @@ -333,7 +333,7 @@ __int64 v3; // r9 __int64 v4; // r8 v3 = a3; /*0x1901*/ v4 = (unsigned int)a2; /*0x1906*/ LOBYTE(a2) = a1; /*0x190b*/ - return sub_29E8(qword_60A0, a2, v4, v3); /*0x191b*/ + return CpuCsrWriteCommandWithSocket(qword_60A0, a2, v4, v3); /*0x191b*/ } __int64 CpuCsrWriteDispatch4(char a1, __int64 a2, unsigned int a3) @@ -341,7 +341,7 @@ __int64 v3; // r9 __int64 v4; // r8 v3 = a3; /*0x1931*/ v4 = (unsigned int)a2; /*0x1936*/ LOBYTE(a2) = a1; /*0x190b*/ - return sub_2AC0(qword_60A0, a2, v4, v3); /*0x195f*/ + return CpuCsrWriteCommandWithSocketAndPayload(qword_60A0, a2, v4, v3); /*0x195f*/ } __int64 CpuCsrWriteDispatch5(char a1, __int64 a2, __int64 a3) @@ -349,7 +349,7 @@ __int64 v3; // r9 v3 = (unsigned int)a3; /*0x1975*/ LOBYTE(a3) = a2; /*0x197a*/ LOBYTE(a2) = a1; /*0x197f*/ - return sub_2760(qword_60A0, a2, a3, v3); /*0x198f*/ + return CpuCsrWriteCommandWithSocketAndAgent(qword_60A0, a2, a3, v3); /*0x198f*/ } __int64 CpuCsrWriteDispatch6(char a1, __int64 a2, __int64 a3, int a4) @@ -357,7 +357,7 @@ __int64 v4; // r9 v4 = (unsigned int)a3; /*0x19b2*/ LOBYTE(a3) = a2; /*0x19b7*/ LOBYTE(a2) = a1; /*0x19bc*/ - return sub_286C(qword_60A0, a2, a3, v4, a4); /*0x19cc*/ + return CpuCsrWriteCommandWithSocketAgentAndPayload(qword_60A0, a2, a3, v4, a4); /*0x19cc*/ } __int64 CpuCsrWriteDispatch7(char a1, __int64 a2, __int64 a3) @@ -365,14 +365,14 @@ __int64 v3; // r9 v3 = (unsigned int)a3; /*0x19e5*/ LOBYTE(a3) = a2; /*0x19ea*/ LOBYTE(a2) = a1; /*0x19ef*/ - return sub_28E8(qword_60A0, a2, a3, v3); /*0x19ff*/ + return CpuCsrWriteCommandWithSocketAndLength(qword_60A0, a2, a3, v3); /*0x19ff*/ } __int64 CpuCsrWriteDispatch8(char a1, __int64 a2) { __int64 v2; // r8 v2 = (unsigned int)a2; /*0x1a10*/ LOBYTE(a2) = a1; /*0x1a15*/ - return sub_22A8(qword_60A0, a2, v2); /*0x1a25*/ + return CpuCsrWriteCommandWithSocketOnly(qword_60A0, a2, v2); /*0x1a25*/ } __int64 CpuCsrWriteDispatch9(char a1, __int64 a2, unsigned int a3) @@ -380,14 +380,14 @@ __int64 v3; // r9 __int64 v4; // r8 v3 = a3; /*0x1a3d*/ v4 = (unsigned int)a2; /*0x1a42*/ LOBYTE(a2) = a1; /*0x1a47*/ - return sub_23E0(qword_60A0, a2, v4, v3); /*0x1a57*/ + return CpuCsrWriteCommandWithSocketAgentAndCommand(qword_60A0, a2, v4, v3); /*0x1a57*/ } __int64 CpuCsrWriteDispatch10(char a1, __int64 a2) { __int64 v2; // r8 v2 = (unsigned int)a2; /*0x1a68*/ LOBYTE(a2) = a1; /*0x1a6d*/ - return sub_2518(qword_60A0, a2, v2); /*0x1a7d*/ + return CpuCsrWriteCommandWithSocketAndAgentOnly(qword_60A0, a2, v2); /*0x1a7d*/ } __int64 CpuCsrWriteCheckpoint(unsigned __int8 a1, unsigned __int8 a2, unsigned __int16 a3) @@ -400,7 +400,7 @@ CpuCsrPacketWrite(qword_60A0, 0, 0, 318914684, v6); /*0x1ade*/ dword_6270 = v6; /*0x1ae7*/ LOBYTE(v3) = HIBYTE(v6); /*0x1af6*/ - sub_3960(128, v3); /*0x1afd*/ + CpuCsrWriteCheckpointDelay(128, v3); /*0x1afd*/ if ( CpuCsrDebugEnabled() && CpuCsrDebugLevelEnabled(64) ) CpuCsrDebugPrint(64, (__int64)"Checkpoint Code: Socket %d, 0x%02X, 0x%02X, 0x%04X\n", 0, a1, a2, a3); result = (unsigned int)CpuCsrPacketRead(qword_60A0, 0, 0, 318914744) >> 16; /*0x1b7d*/ @@ -468,33 +468,33 @@ CpuCsrDebugPrint(0x80000000LL, (__int64)"\nASSERT_EFI_ERROR (Status = %r)\n", Status); /*0x1f37*/ CpuCsrDebugAssert((__int64)"e:\\hs\\PurleySktPkg\\Dxe\\CpuCsrAccess\\CpuCsrAccess.c", 460, (__int64)"!EFI_ERROR (Status)"); /*0x1f5b*/ } - CpuCsrZeroMem(&psub_1794, 104); /*0x1f72*/ + CpuCsrZeroMem(&CpuCsrDispatchTable, 104); /*0x1f72*/ qword_6268 = *(_QWORD *)qword_6160; /*0x1f81*/ - psub_1794 = (__int64)CpuCsrWriteDispatch1; /*0x1f8f*/ - psub_17D4 = (__int64)CpuCsrReadWriteDispatch; /*0x1f9d*/ - psub_1858 = (__int64)CpuCsrWriteDispatch2; /*0x1fab*/ - psub_18F0 = (__int64)CpuCsrWriteDispatch3; /*0x1fb9*/ - psub_1920 = (__int64)CpuCsrWriteDispatch4; /*0x1fc7*/ - psub_1964 = (__int64)CpuCsrWriteDispatch5; /*0x1fd5*/ - psub_1994 = (__int64)CpuCsrWriteDispatch6; /*0x1fe3*/ - psub_19D4 = (__int64)CpuCsrWriteDispatch7; /*0x1ff1*/ - psub_1A04 = (__int64)CpuCsrWriteDispatch8; /*0x1fff*/ - psub_1A2C = (__int64)CpuCsrWriteDispatch9; /*0x200d*/ - psub_1A5C = (__int64)CpuCsrWriteDispatch10; /*0x201b*/ - psub_1A84 = (__int64)CpuCsrWriteCheckpoint; /*0x2029*/ - psub_1C00 = (__int64)CpuCsrParsePlatformConfig; /*0x2037*/ + CpuCsrDispatchWrite1 = (__int64)CpuCsrWriteDispatch1; /*0x1f8f*/ + CpuCsrDispatchReadWrite = (__int64)CpuCsrReadWriteDispatch; /*0x1f9d*/ + CpuCsrDispatchWrite2 = (__int64)CpuCsrWriteDispatch2; /*0x1fab*/ + CpuCsrDispatchWrite3 = (__int64)CpuCsrWriteDispatch3; /*0x1fb9*/ + CpuCsrDispatchWrite4 = (__int64)CpuCsrWriteDispatch4; /*0x1fc7*/ + CpuCsrDispatchWrite5 = (__int64)CpuCsrWriteDispatch5; /*0x1fd5*/ + CpuCsrDispatchWrite6 = (__int64)CpuCsrWriteDispatch6; /*0x1fe3*/ + CpuCsrDispatchWrite7 = (__int64)CpuCsrWriteDispatch7; /*0x1ff1*/ + CpuCsrDispatchWrite8 = (__int64)CpuCsrWriteDispatch8; /*0x1fff*/ + CpuCsrDispatchWrite9 = (__int64)CpuCsrWriteDispatch9; /*0x200d*/ + CpuCsrDispatchWrite10 = (__int64)CpuCsrWriteDispatch10; /*0x201b*/ + CpuCsrDispatchCheckpoint = (__int64)CpuCsrWriteCheckpoint; /*0x2029*/ + CpuCsrDispatchParseConfig = (__int64)CpuCsrParsePlatformConfig; /*0x2037*/ CpuCsrParsePlatformConfig(); /*0x203e*/ if ( v3[0] ) /*0x204a*/ Status = (*(__int64 ( **)(_QWORD *, void *, _QWORD, __int64 *))(qword_60A8 + 168))( /*0x206f*/ v5, &unk_6010, 0, - &psub_1794); + &CpuCsrDispatchTable); else Status = (*(__int64 ( **)(_QWORD *, void *, _QWORD, __int64 *))(qword_60C8 + 128))( /*0x2099*/ v5, &unk_6010, 0, - &psub_1794); + &CpuCsrDispatchTable); if ( CpuCsrDebugEnabled() && Status < 0 ) /*0x20b0*/ { if ( CpuCsrDebugEnabled() && CpuCsrDebugLevelEnabled(0x80000000) ) /*0x20c3*/ @@ -577,7 +577,7 @@ (__int64)"e:\\hs\\MdePkg\\Library\\BaseMemoryLibRepStr\\ZeroMemWrapper.c", 54, (__int64)"Length <= (0xFFFFFFFFFFFFFFFFULL - (UINTN)Buffer + 1)"); - return sub_1000(Buffer, Length); /*0x38b8*/ + return CpuCsrZeroMemImpl(Buffer, Length); /*0x38b8*/ } unsigned __int32 PciCfgInDword(unsigned __int16 Port) @@ -686,7 +686,7 @@ *a2 = 0; /*0x3b7e*/ if ( !*(_QWORD *)(Index + 104) ) /*0x3b82*/ return 0x800000000000000EuLL; /*0x3bab*/ - for ( i = 0; !(unsigned __int8)sub_3E38(a1, i + *(_QWORD *)(Index + 112)); i += 24 ) /*0x3b88*/ + for ( i = 0; !(unsigned __int8)CpuCsrCompareGuid(a1, i + *(_QWORD *)(Index + 112)); i += 24 ) /*0x3b88*/ { if ( (unsigned __int64)++Index >= *(_QWORD *)(Index + 104) ) /*0x3ba9*/ return 0x800000000000000EuLL; /*0x3ba9*/ diff --git a/PurleySktPkg/Dxe/CrystalRidge/CrystalRidgeSMM/CrystalRidgeSMM.c b/PurleySktPkg/Dxe/CrystalRidge/CrystalRidgeSMM/CrystalRidgeSMM.c index 9d98fa7..b311a40 100644 --- a/PurleySktPkg/Dxe/CrystalRidge/CrystalRidgeSMM/CrystalRidgeSMM.c +++ b/PurleySktPkg/Dxe/CrystalRidge/CrystalRidgeSMM/CrystalRidgeSMM.c @@ -41,7 +41,7 @@ UINT32 gCrXlateTable[6] = {0}; // dword_6F6E0 INT32 gCrXlateCount = 0; // dword_6F6E4 CR_CONTROL_REGION gCrControlRegions[CR_MAX_CONTROL_REGIONS]; // qword_AE028 -UINT8 gCrControlRegionCount = 0; // n8 in sub_67D4 +UINT8 gCrControlRegionCount = 0; // control-region cursor used by CrystalRidgeConfigureSmi // =========================================================================== // Library Helpers @@ -49,7 +49,7 @@ /** * ASSERT-style debug print - * Original: sub_20AF0 at 0x20AF0 (163 callers across the binary) + * Crystal Ridge assertion-style debug print helper */ VOID CrystalRidgeDebugAssert( @@ -59,14 +59,13 @@ ) { // - // Wraps sub_20A58 to format and print assertion failure - // Calls sub_20AA8 for final output + // Formats and prints assertion failures. // } /** * EFI_ERROR() macro check wrapper thunk - * Original: sub_20B30 at 0x20B30 (82 callers) + * EFI_ERROR() macro check wrapper thunk */ BOOLEAN CrystalRidgeEfiError( @@ -81,7 +80,7 @@ /** * Debug level enablement check - * Original: sub_20B34 at 0x20B34 (38 callers) + * Debug level enablement check */ BOOLEAN CrystalRidgeDebugEnabled( @@ -93,7 +92,7 @@ /** * Copy memory wrapper - * Original: sub_203B0 at 0x203B0 (30 callers) + * Copy memory wrapper */ VOID * CrystalRidgeCopyMem( @@ -103,14 +102,12 @@ ) { if (Length == 0) return Destination; - // Validates buffer bounds - // Thunks to internal rep movsb at sub_2D0 - return sub_2D0(Destination, Source, Length); + return CopyMem(Destination, Source, Length); } /** * Zero memory wrapper - * Original: sub_2044C at 0x2044C (61 callers) + * Zero memory wrapper */ VOID CrystalRidgeZeroMem( @@ -119,14 +116,11 @@ ) { if (Length == 0) return; - // Validates buffer bounds - // Thunks to internal rep stosb at sub_320 + SetMem(Buffer, Length, 0); } /** - * Translate EFI status code to human-readable error string - * Original: sub_8FAC at 0x8FAC (16 callers) - * Maps EFI error codes to short integer categories for mailbox status + * Translate EFI status code to a mailbox category value */ UINT16 CrystalRidgeStatusToCategory( @@ -137,10 +131,6 @@ { if (ErrorCode > 255) return (UINT16)(6 - (IsSmmContext ? 1 : 0)); - // Complex switch tree mapping error codes 0..255 and - // EFI_STATUS values to category codes 0..11 - // Categories: Success(0), InvalidParam(3), NotReady(4), - // DeviceError(5), Timeout(2), etc. return 0; } @@ -158,13 +148,12 @@ EFI_STATUS Status; // - // Initialize global UEFI service table pointers (sub_5DC at 0x5DC) - // Handles: gImageHandle, gST, gBS, gRT, gSmst, gPcd + // Initialize global UEFI service table pointers. // CrystalRidgeInitServiceTablePointers(ImageHandle, SystemTable); // - // Call main driver initialization (sub_A00 -> sub_798C) + // Call main driver initialization. // Status = CrystalRidgeSmmDriverInit(ImageHandle, SystemTable); @@ -179,7 +168,7 @@ } // =========================================================================== -// Service Table Initialization (sub_5DC at 0x5DC) +// Service Table Initialization // =========================================================================== EFI_STATUS @@ -233,7 +222,7 @@ } // =========================================================================== -// Main Driver Initialization (sub_798C at 0x798C) +// Main Driver Initialization // =========================================================================== EFI_STATUS @@ -342,7 +331,7 @@ } // - // Step 6: Initialize DIMM database from protocol data (sub_6DD0) + // Step 6: Initialize DIMM database from protocol data // CrystalRidgeInitDimmDb(); @@ -361,7 +350,7 @@ } // =========================================================================== -// DIMM Database Initialization (sub_6DD0 at 0x6DD0) +// DIMM Database Initialization // =========================================================================== UINT64 @@ -405,7 +394,7 @@ } // =========================================================================== -// DIMM Lookup (sub_2794 at 0x2794) +// DIMM Lookup // =========================================================================== CR_DIMM_ENTRY * @@ -442,7 +431,7 @@ } // =========================================================================== -// SMI Configuration (sub_67D4 at 0x67D4) +// SMI Configuration // =========================================================================== UINT64 @@ -535,7 +524,6 @@ /** * Translate physical address to DIMM offset - * sub_152CC at 0x152CC */ EFI_STATUS CrystalRidgeTranslateAddress( @@ -581,7 +569,6 @@ /** * Send mailbox command to NVDIMM hardware - * sub_F200 at 0xF200 */ EFI_STATUS CrystalRidgeMailboxCommand( @@ -632,7 +619,7 @@ } // =========================================================================== -// NFIT Construction (sub_1FDFC at 0x1FDFC) +// NFIT Construction // =========================================================================== VOID @@ -657,7 +644,7 @@ } // =========================================================================== -// Protocol Setup (sub_7118 at 0x7118) +// Protocol Setup // =========================================================================== UINT64 @@ -722,7 +709,6 @@ /** * Initialize near-memory cache flush mechanism - * sub_23A10 at 0x23A10 */ EFI_STATUS CrystalRidgeFlushNearMemoryInit( @@ -750,4 +736,4 @@ CrystalRidgeRegisterResetCallback(); return EFI_SUCCESS; -} \ No newline at end of file +} diff --git a/PurleySktPkg/Dxe/CrystalRidge/CrystalRidgeSMM/CrystalRidgeSMM.h b/PurleySktPkg/Dxe/CrystalRidge/CrystalRidgeSMM/CrystalRidgeSMM.h index d52b1a9..9482589 100644 --- a/PurleySktPkg/Dxe/CrystalRidge/CrystalRidgeSMM/CrystalRidgeSMM.h +++ b/PurleySktPkg/Dxe/CrystalRidge/CrystalRidgeSMM/CrystalRidgeSMM.h @@ -9,674 +9,99 @@ #include "../uefi_headers/Uefi.h" -// -// Function Prototypes -// +EFI_STATUS EFIAPI CrystalRidgeDebugAssert ( + IN CONST CHAR8 *FileName, + IN UINT32 LineNumber, + IN CONST CHAR8 *AssertText + ); -EFI_STATUS -EFIAPI -CrystalRidgeDebugAssert( +BOOLEAN EFIAPI CrystalRidgeEfiError ( VOID -); + ); -EFI_STATUS -EFIAPI -CrystalRidgeEfiError( - VOID -); +BOOLEAN EFIAPI CrystalRidgeDebugEnabled ( + IN UINT64 DebugLevel + ); -EFI_STATUS -EFIAPI -CrystalRidgeDebugEnabled( - VOID -); +VOID *EFIAPI CrystalRidgeCopyMem ( + OUT VOID *Destination, + IN CONST VOID *Source, + IN UINTN Length + ); -EFI_STATUS -EFIAPI -CrystalRidgeZeroMem( - VOID -); +VOID EFIAPI CrystalRidgeZeroMem ( + OUT VOID *Buffer, + IN UINTN Length + ); -EFI_STATUS -EFIAPI -CrystalRidgeStatusToCategory( - VOID -); +UINT16 EFIAPI CrystalRidgeStatusToCategory ( + IN BOOLEAN IsSmmContext, + IN INT32 ErrorCode, + IN UINT64 RawStatus + ); -EFI_STATUS -EFIAPI -CrystalRidgeSmmEntryPoint( - VOID -); +EFI_STATUS EFIAPI CrystalRidgeSmmEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ); -EFI_STATUS -EFIAPI -CrystalRidgeInitServiceTablePointers( - VOID -); +EFI_STATUS EFIAPI CrystalRidgeInitServiceTablePointers ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ); -EFI_STATUS -EFIAPI -CrystalRidgeSmmDriverInit( - VOID -); +EFI_STATUS EFIAPI CrystalRidgeSmmDriverInit ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ); -EFI_STATUS -EFIAPI -CrystalRidgeInitDimmDb( +UINT64 EFIAPI CrystalRidgeInitDimmDb ( VOID -); + ); -EFI_STATUS -EFIAPI -CrystalRidgeConfigureSmi( - VOID -); +CR_DIMM_ENTRY *EFIAPI CrystalRidgeFindDimm ( + IN UINT8 SocketId, + IN UINT8 Channel, + IN UINT8 DimmSlot, + IN UINT8 Flags + ); -EFI_STATUS -EFIAPI -CrystalRidgeTranslateAddress( - VOID -); +UINT64 EFIAPI CrystalRidgeConfigureSmi ( + IN UINT16 ConfigType + ); -EFI_STATUS -EFIAPI -CrystalRidgeMailboxCommand( - VOID -); +EFI_STATUS EFIAPI CrystalRidgeTranslateAddress ( + IN VOID *TranslationInfo, + IN UINT64 Address, + IN INT32 RegionType, + OUT UINT64 *DimmOffset + ); -EFI_STATUS -EFIAPI -CrystalRidgeNfitBuild( - VOID -); +EFI_STATUS EFIAPI CrystalRidgeMailboxCommand ( + IN UINT8 SocketId, + IN UINT8 Channel, + IN UINT8 DimmSlot, + IN UINT32 Command, + IN VOID *Buffer, + IN UINT32 InputSize, + IN UINT32 OutputSize, + IN UINT8 IsLongOp + ); -EFI_STATUS -EFIAPI -CrystalRidgeSetupProtocol( - VOID -); +VOID EFIAPI CrystalRidgeNfitBuild ( + IN INT32 Socket, + IN INT32 Channel, + IN INT32 Dimm, + IN INT32 RegionType, + IN UINT8 Flags + ); -EFI_STATUS -EFIAPI -CrystalRidgeFlushNearMemoryInit( - VOID -); +UINT64 EFIAPI CrystalRidgeSetupProtocol ( + IN UINT8 *Buffer + ); -EFI_STATUS -EFIAPI -(reconstructed from .data section at 0x29600-0xAE580)( - VOID -); +EFI_STATUS EFIAPI CrystalRidgeFlushNearMemoryInit ( + IN VOID *Context + ); -EFI_STATUS -EFIAPI -UINT8 gCrIsSmmOnly = 0; // byte_29CB0( - VOID -); - -EFI_STATUS -EFIAPI -UINT64 gCrCacheLineSizeMul = 0; // qword_29EC0( - VOID -); - -EFI_STATUS -EFIAPI -VOID *gCrNfit = NULL; // qword_29CA8( - VOID -); - -EFI_STATUS -EFIAPI -VOID *gCrProtocol1 = NULL; // qword_29CD0( - VOID -); - -EFI_STATUS -EFIAPI -CR_DIMM_ENTRY gCrDimmDbFallback; // unk_AC2E8( - VOID -); - -EFI_STATUS -EFIAPI -UINT32 gCrXlateTable[6] = {0}; // dword_6F6E0( - VOID -); - -EFI_STATUS -EFIAPI -CR_CONTROL_REGION gCrControlRegions[CR_MAX_CONTROL_REGIONS]; // qword_AE028( - VOID -); - -EFI_STATUS -EFIAPI -in sub_67D4( - VOID -); - -EFI_STATUS -EFIAPI -Helpers( - VOID -); - -EFI_STATUS -EFIAPI -- conditionally evaluates EFI_ERROR( - VOID -); - -EFI_STATUS -EFIAPI -FALSE;( - VOID -); - -EFI_STATUS -EFIAPI -buffer bounds( - VOID -); - -EFI_STATUS -EFIAPI -to internal rep movsb at sub_2D0( - VOID -); - -EFI_STATUS -EFIAPI -to internal rep stosb at sub_320( - VOID -); - -EFI_STATUS -EFIAPI -switch tree mapping error codes 0..255 and( - VOID -); - -EFI_STATUS -EFIAPI -values to category codes 0..11( - VOID -); - -EFI_STATUS -EFIAPI -Entry Point (0x5A0)( - VOID -); - -EFI_STATUS -EFIAPI -global UEFI service table pointers (sub_5DC at 0x5DC)( - VOID -); - -EFI_STATUS -EFIAPI -main driver initialization (sub_A00 -> sub_798C)( - VOID -); - -EFI_STATUS -EFIAPI -= CrystalRidgeSmmDriverInit(ImageHandle, SystemTable);( - VOID -); - -EFI_STATUS -EFIAPI -installation failed, trigger assert( - VOID -); - -EFI_STATUS -EFIAPI -(Status < 0) {( - VOID -); - -EFI_STATUS -EFIAPI -Table Initialization (sub_5DC at 0x5DC)( - VOID -); - -EFI_STATUS -EFIAPI -SMM Base2 protocol to detect SMM context( - VOID -); - -EFI_STATUS -EFIAPI -= gBS_CR->LocateProtocol(( - VOID -); - -EFI_STATUS -EFIAPI -PCD database pointer via DxePcdLib( - VOID -); - -EFI_STATUS -EFIAPI -Driver Initialization (sub_798C at 0x798C)( - VOID -); - -EFI_STATUS -EFIAPI -1: Determine execution context (SMM or DXE)( - VOID -); - -EFI_STATUS -EFIAPI -path: Get protocol interface pointers( - VOID -); - -EFI_STATUS -EFIAPI -= *(VOID **)gCrProtocol0;( - VOID -); - -EFI_STATUS -EFIAPI -2: Locate mCrInfo protocol via protocol interface( - VOID -); - -EFI_STATUS -EFIAPI -= ((PROTOCOL_INTERFACE *)gCrProtocol1)->LocateProtocol(( - VOID -); - -EFI_STATUS -EFIAPI -3: Locate additional protocol for shared data( - VOID -); - -EFI_STATUS -EFIAPI -4: Register SMI notification for command type 25037( - VOID -); - -EFI_STATUS -EFIAPI -= ((PROTOCOL_INTERFACE *)gCrProtocol1)->Register(( - VOID -); - -EFI_STATUS -EFIAPI -= TRUE;( - VOID -); - -EFI_STATUS -EFIAPI -SMI notification via Boot Services( - VOID -); - -EFI_STATUS -EFIAPI -= gBS_CR->RegisterProtocolNotify(( - VOID -); - -EFI_STATUS -EFIAPI -5: Read SocketProcessorCoreConfig UEFI variable( - VOID -); - -EFI_STATUS -EFIAPI -= 301;( - VOID -); - -EFI_STATUS -EFIAPI -config HOB if variable not available( - VOID -); - -EFI_STATUS -EFIAPI -6: Initialize DIMM database from protocol data (sub_6DD0)( - VOID -); - -EFI_STATUS -EFIAPI -7: Read cache line size via CPUID( - VOID -); - -EFI_STATUS -EFIAPI -= CrystalRidgeGetCacheLineSize() * 8;( - VOID -); - -EFI_STATUS -EFIAPI -8: Configure SMI translation tables for NVDIMM (32) and ARS (4)( - VOID -); - -EFI_STATUS -EFIAPI -command type( - VOID -); - -EFI_STATUS -EFIAPI -Database Initialization (sub_6DD0 at 0x6DD0)( - VOID -); - -EFI_STATUS -EFIAPI -4 sockets, 6 channels per socket, 2 DIMMs per channel( - VOID -); - -EFI_STATUS -EFIAPI -(Socket = 0; Socket < CR_MAX_SOCKETS; Socket++) {( - VOID -); - -EFI_STATUS -EFIAPI -if DIMM is present via mCrInfo data( - VOID -); - -EFI_STATUS -EFIAPI -(CrystalRidgeIsDimmPresent(Socket, Channel, Dimm)) {( - VOID -); - -EFI_STATUS -EFIAPI -if DIMM is already initialized( - VOID -); - -EFI_STATUS -EFIAPI -(!gCrDimmDb[gCrDimmCount].Ptr) {( - VOID -); - -EFI_STATUS -EFIAPI -new DIMM entry( - VOID -); - -EFI_STATUS -EFIAPI -Lookup (sub_2794 at 0x2794)( - VOID -); - -EFI_STATUS -EFIAPI -search through DIMM database( - VOID -); - -EFI_STATUS -EFIAPI -(Index = 0; Index < gCrDimmCount; Index++) {( - VOID -); - -EFI_STATUS -EFIAPI -fallback entry if Flag 2 set( - VOID -); - -EFI_STATUS -EFIAPI -(Flags & 2) {( - VOID -); - -EFI_STATUS -EFIAPI -Configuration (sub_67D4 at 0x67D4)( - VOID -); - -EFI_STATUS -EFIAPI -all sockets, channels, DIMMs to configure translation( - VOID -); - -EFI_STATUS -EFIAPI -ConfigType=32 (NVDIMM): Set up control regions( - VOID -); - -EFI_STATUS -EFIAPI -(ConfigType == 32) {( - VOID -); - -EFI_STATUS -EFIAPI -translation table on first invocation( - VOID -); - -EFI_STATUS -EFIAPI -topology and set control region( - VOID -); - -EFI_STATUS -EFIAPI -CrystalRidgeSetSadTopology(Socket, BaseAddr);( - VOID -); - -EFI_STATUS -EFIAPI -CrystalRidgeSetSadBaseTopology(Socket, BaseAddr);( - VOID -); - -EFI_STATUS -EFIAPI -CrystalRidgeSetCrTopology(Socket, BaseAddr);( - VOID -); - -EFI_STATUS -EFIAPI -ConfigType=4 (ARS): Set up ARS regions( - VOID -); - -EFI_STATUS -EFIAPI -if (ConfigType == 4) {( - VOID -); - -EFI_STATUS -EFIAPI -topology-based setup for ARS( - VOID -); - -EFI_STATUS -EFIAPI -and Mailbox( - VOID -); - -EFI_STATUS -EFIAPI -if address is in HOB table or direct( - VOID -); - -EFI_STATUS -EFIAPI -up in translation table( - VOID -); - -EFI_STATUS -EFIAPI -Channel = gCrPerDimmData[Index * 6 + 4]; // byte_3E05C( - VOID -); - -EFI_STATUS -EFIAPI -} else {( - VOID -); - -EFI_STATUS -EFIAPI -SAD/interleave translation( - VOID -); - -EFI_STATUS -EFIAPI -the DIMM entry( - VOID -); - -EFI_STATUS -EFIAPI -= CrystalRidgeFindDimm(SocketId, Channel, DimmSlot, 0);( - VOID -); - -EFI_STATUS -EFIAPI -command via hardware mailbox interface( - VOID -); - -EFI_STATUS -EFIAPI -(IsLongOp) {( - VOID -); - -EFI_STATUS -EFIAPI -once if busy( - VOID -); - -EFI_STATUS -EFIAPI -Construction (sub_1FDFC at 0x1FDFC)( - VOID -); - -EFI_STATUS -EFIAPI -NFIT structure for given DIMM/region( - VOID -); - -EFI_STATUS -EFIAPI -NFIT table header( - VOID -); - -EFI_STATUS -EFIAPI -Setup (sub_7118 at 0x7118)( - VOID -); - -EFI_STATUS -EFIAPI -protocol callback buffer( - VOID -); - -EFI_STATUS -EFIAPI -default values and populate from mCrInfo data( - VOID -); - -EFI_STATUS -EFIAPI -4 sockets, 24 channels to discover active DIMMs( - VOID -); - -EFI_STATUS -EFIAPI -set topology configuration bytes( - VOID -); - -EFI_STATUS -EFIAPI -(UINT8 Socket = 0; Socket < CR_MAX_SOCKETS; Socket++) {( - VOID -); - -EFI_STATUS -EFIAPI -flags and timeouts( - VOID -); - -EFI_STATUS -EFIAPI -Near Memory Cache (SmmCrystalRidgeFlushNearMemoryLib)( - VOID -); - -EFI_STATUS -EFIAPI -flush initialization( - VOID -); - -EFI_STATUS -EFIAPI -reset notification callback( - VOID -); - -#endif /* __CRYSTALRIDGESMM_H__ */ \ No newline at end of file +#endif diff --git a/PurleySktPkg/Dxe/NvdimmCommon/NvdimmSmbusCommon/NvdimmSmbusCommon.c b/PurleySktPkg/Dxe/NvdimmCommon/NvdimmSmbusCommon/NvdimmSmbusCommon.c index 77ca20a..5eb5e22 100644 --- a/PurleySktPkg/Dxe/NvdimmCommon/NvdimmSmbusCommon/NvdimmSmbusCommon.c +++ b/PurleySktPkg/Dxe/NvdimmCommon/NvdimmSmbusCommon/NvdimmSmbusCommon.c @@ -6,11 +6,11 @@ // Function: InternalMemZeroMem @ 0x1000 (0x20 bytes) // Index: 1/14 -char *__fastcall InternalMemZeroMem(char *buf, unsigned __int64 n0xF) +char *__fastcall ZeroMem(char *Buffer, unsigned __int64 Length) { - memset(buf, 0, 8 * (n0xF >> 3)); /*0x1016*/ - memset(&buf[8 * (n0xF >> 3)], 0, n0xF & 7); /*0x101b*/ - return buf; /*0x101e*/ + memset(Buffer, 0, 8 * (Length >> 3)); /*0x1016*/ + memset(&Buffer[8 * (Length >> 3)], 0, Length & 7); /*0x101b*/ + return Buffer; /*0x101e*/ } // Function: _ModuleEntryPoint @ 0x10c4 (0x49 bytes) @@ -41,58 +41,58 @@ ::ImageHandle = ImageHandle; /*0x111a*/ if ( !ImageHandle ) /*0x112e*/ - sub_1544( /*0x113d*/ + AssertCpuDeadLoop( /*0x113d*/ (__int64)"e:\\hs\\MdePkg\\Library\\UefiBootServicesTableLib\\UefiBootServicesTableLib.c", 51, (__int64)"gImageHandle != ((void *) 0)"); ::SystemTable = (__int64)SystemTable; /*0x1142*/ if ( !SystemTable ) /*0x114c*/ - sub_1544( /*0x115b*/ + AssertCpuDeadLoop( /*0x115b*/ (__int64)"e:\\hs\\MdePkg\\Library\\UefiBootServicesTableLib\\UefiBootServicesTableLib.c", 57, (__int64)"gST != ((void *) 0)"); ::BootServices = (__int64)SystemTable->BootServices; /*0x1164*/ if ( !::BootServices ) /*0x116e*/ - sub_1544( /*0x117d*/ + AssertCpuDeadLoop( /*0x117d*/ (__int64)"e:\\hs\\MdePkg\\Library\\UefiBootServicesTableLib\\UefiBootServicesTableLib.c", 63, (__int64)"gBS != ((void *) 0)"); RuntimeServices = (__int64)SystemTable->RuntimeServices; /*0x1186*/ if ( !RuntimeServices ) /*0x1190*/ - sub_1544( /*0x11a3*/ + AssertCpuDeadLoop( /*0x11a3*/ (__int64)"e:\\hs\\MdePkg\\Library\\UefiRuntimeServicesTableLib\\UefiRuntimeServicesTableLib.c", 47, (__int64)"gRT != ((void *) 0)"); BootServices = SystemTable->BootServices; /*0x11b3*/ RuntimeServices_0 = (__int64)SystemTable->RuntimeServices; /*0x11ba*/ BootServices_0 = (__int64)BootServices; /*0x11cd*/ - ((void (__fastcall *)(__int64, __int64, void (*)()))BootServices->CreateEvent)(513, 8, sub_1584); /*0x11df*/ + ((void (__fastcall *)(__int64, __int64, void (*)()))BootServices->CreateEvent)(513, 8, CleanupEventNotify1); /*0x11df*/ (*(void (__fastcall **)(__int64, __int64, __int64 (__fastcall *)(), _QWORD, __int64 *))(BootServices_0 + 80))( /*0x1207*/ 1610613250, 8, - sub_1590, + CleanupEventNotify2, 0, &qword_3078); - sub_167C(); /*0x120a*/ - result = sub_15B8((__int64)&unk_3030, &qword_3098); /*0x121d*/ + GetHobList(); /*0x120a*/ + result = EfiGetSystemConfigurationTable((EFI_GUID *)&unk_3030, (void **)&qword_3098); /*0x121d*/ v5 = result; /*0x1222*/ if ( result < 0 ) /*0x122d*/ { - sub_14C4(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", result); /*0x123b*/ - result = sub_1544( /*0x1253*/ + DebugLogPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", result); /*0x123b*/ + result = AssertCpuDeadLoop( /*0x1253*/ (__int64)"e:\\hs\\MdePkg\\Library\\DxeServicesTableLib\\DxeServicesTableLib.c", 64, (__int64)"!EFI_ERROR (Status)"); } if ( !qword_3098 ) /*0x1260*/ - result = sub_1544( /*0x1275*/ + result = AssertCpuDeadLoop( /*0x1275*/ (__int64)"e:\\hs\\MdePkg\\Library\\DxeServicesTableLib\\DxeServicesTableLib.c", 65, (__int64)"gDS != ((void *) 0)"); if ( v5 < 0 ) /*0x127d*/ { - sub_14C4(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v5); /*0x128c*/ - return sub_1544( /*0x12a4*/ + DebugLogPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v5); /*0x128c*/ + return AssertCpuDeadLoop( /*0x12a4*/ (__int64)"e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\PurleySktPkg\\Dxe\\NvdimmCommon\\NvdimmSmbusCommon\\DEBUG\\AutoGen.c", 265, (__int64)"!EFI_ERROR (Status)"); @@ -107,7 +107,7 @@ { __int64 v1; // rax __int64 v2; // rbx - const char *[NGN]_ERROR:_SMBUS_NONSMM___SMM_memory_allocation_failed_with_s; // rdx + const char *MemoryAllocationError; EFI_HANDLE ImageHandle_1; // [rsp+30h] [rbp+8h] BYREF char *buf; // [rsp+38h] [rbp+10h] BYREF @@ -117,21 +117,20 @@ v2 = v1; /*0x12ec*/ if ( v1 < 0 ) { - [NGN]_ERROR:_SMBUS_NONSMM___SMM_memory_allocation_failed_with_s = "[NGN] ERROR: SMBUS NONSMM<->SMM memory allocation " - "failed with status (%r)\n"; + MemoryAllocationError = "[NGN] ERROR: SMBUS NONSMM<->SMM memory allocation failed with status (%r)\n"; LABEL_5: - sub_14C4(0x80000000LL, [NGN]_ERROR:_SMBUS_NONSMM___SMM_memory_allocation_failed_with_s, v1); /*0x1384*/ - sub_14C4(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v2); /*0x139f*/ - sub_1544( /*0x13b7*/ + DebugLogPrint(0x80000000LL, MemoryAllocationError, v1); /*0x1384*/ + DebugLogPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", v2); /*0x139f*/ + AssertCpuDeadLoop( /*0x13b7*/ (__int64)"e:\\hs\\PurleySktPkg\\Dxe\\NvdimmCommon\\NvdimmSmbusCommon.c", 60, (__int64)"!EFI_ERROR (Status)"); return (v2 >> 63) & 0x8000000000000001uLL; /*0x13b7*/ } - sub_14C4(64, "[NGN] SMBUS NONSMM<->SMM interface address: 0x%llx\n", buf); + DebugLogPrint(64, "[NGN] SMBUS NONSMM<->SMM interface address: 0x%llx\n", buf); ::buf = (__int64)buf; /*0x1320*/ - sub_13D8(buf, 0xFu); /*0x1327*/ - sub_13D8(&buf_, 0x10u); /*0x1338*/ + ZeroMemWrapper(buf, 0xFu); /*0x1327*/ + ZeroMemWrapper(&buf_, 0x10u); /*0x1338*/ buf_0 = ::buf; /*0x134b*/ buf_ = 1; /*0x1368*/ v1 = (*(__int64 (__fastcall **)(EFI_HANDLE *, void *, _QWORD, char *))(BootServices + 128))( /*0x136f*/ @@ -142,8 +141,7 @@ v2 = v1; /*0x1375*/ if ( v1 < 0 ) { - [NGN]_ERROR:_SMBUS_NONSMM___SMM_memory_allocation_failed_with_s = "[NGN] ERROR: SMBUS NONSMM<->SMM interface protocol" - " installation failed with status (%r)\n"; + MemoryAllocationError = "[NGN] ERROR: SMBUS NONSMM<->SMM interface protocol installation failed with status (%r)\n"; goto LABEL_5; /*0x137d*/ } return (v2 >> 63) & 0x8000000000000001uLL; /*0x13d2*/ @@ -152,25 +150,25 @@ // Function: ZeroMemWrapper @ 0x13d8 (0x63 bytes) // Index: 5/14 -char *__fastcall ZeroMemWrapper(char *buf, unsigned __int64 n0xF) +char *__fastcall ZeroMemWrapper(char *Buffer, unsigned __int64 Length) { - if ( !buf ) /*0x13eb*/ - sub_1544( /*0x13fe*/ + if ( !Buffer ) /*0x13eb*/ + AssertCpuDeadLoop( /*0x13fe*/ (__int64)"e:\\hs\\MdePkg\\Library\\BaseMemoryLibRepStr\\ZeroMemWrapper.c", 53, (__int64)"Buffer != ((void *) 0)"); - if ( n0xF > -(__int64)buf ) /*0x140c*/ - sub_1544( /*0x1421*/ + if ( Length > -(__int64)Buffer ) /*0x140c*/ + AssertCpuDeadLoop( /*0x1421*/ (__int64)"e:\\hs\\MdePkg\\Library\\BaseMemoryLibRepStr\\ZeroMemWrapper.c", 54, (__int64)"Length <= (0xFFFFFFFFFFFFFFFFULL - (UINTN)Buffer + 1)"); - return sub_1000(buf, n0xF); /*0x1431*/ + return ZeroMem(Buffer, Length); /*0x1431*/ } // Function: GetSmbusProtocol @ 0x143c (0x86 bytes) // Index: 6/14 -__int64 GetSmbusProtocol() +__int64 GetDebugPortProtocol() { __int64 result; // rax unsigned __int64 n0x10; // rbx @@ -203,7 +201,7 @@ // Function: DebugLogPrint @ 0x14c4 (0x80 bytes) // Index: 7/14 -__int64 DebugLogPrint(__int64 a1, const char *a2, ...) +__int64 DebugLogPrint(__int64 ErrorLevel, const char *Format, ...) { __int64 result; // rax __int64 v4; // r8 @@ -213,8 +211,8 @@ int n113; // edx va_list va; // [rsp+40h] [rbp+18h] BYREF - va_start(va, a2); - result = GetSmbusProtocol(); /*0x14db*/ + va_start(va, Format); + result = GetDebugPortProtocol(); /*0x14db*/ v4 = 0; /*0x14e0*/ v5 = (__int64 (__fastcall **)(__int64, const char *, __int64 *))result; /*0x14e3*/ if ( result ) /*0x14e9*/ @@ -238,8 +236,8 @@ if ( (_BYTE)n113 == 1 ) /*0x1525*/ v4 = 2147483652LL; /*0x1525*/ } - if ( (v4 & a1) != 0 ) /*0x152c*/ - return (*v5)(a1, a2, (__int64 *)va); /*0x153b*/ + if ( (v4 & ErrorLevel) != 0 ) /*0x152c*/ + return (*v5)(ErrorLevel, Format, (__int64 *)va); /*0x153b*/ } return result; /*0x153e*/ } @@ -251,7 +249,7 @@ { __int64 result; // rax - result = GetSmbusProtocol(); /*0x155c*/ + result = GetDebugPortProtocol(); /*0x155c*/ if ( result ) /*0x1564*/ return (*(__int64 (__fastcall **)(__int64, __int64, __int64))(result + 8))(a1, a2, a3); /*0x156f*/ return result; /*0x157c*/ @@ -277,7 +275,7 @@ // Function: EfiGetSystemConfigurationTable @ 0x15b8 (0xc4 bytes) // Index: 11/14 -EFI_STATUS __cdecl EfiGetSystemConfigurationTable(EFI_GUID *TableGuid, void **Table) +EFI_STATUS __cdecl GetSystemConfigurationTable(EFI_GUID *TableGuid, void **Table) { __int64 SystemTable; // rdi __int64 v5; // rbx @@ -292,7 +290,7 @@ *Table = 0; /*0x1616*/ if ( !*(_QWORD *)(SystemTable + 104) ) /*0x161a*/ return 0x800000000000000EuLL; /*0x1643*/ - for ( i = 0; !sub_1700((__int64)TableGuid, i + *(_QWORD *)(SystemTable + 112)); i += 24 ) /*0x1620*/ + for ( i = 0; !GuidEqual(TableGuid, i + *(_QWORD *)(SystemTable + 112)); i += 24 ) /*0x1620*/ { if ( (unsigned __int64)++v5 >= *(_QWORD *)(SystemTable + 104) ) /*0x1641*/ return 0x800000000000000EuLL; /*0x1641*/ @@ -312,7 +310,7 @@ Table_ = (void *)Table_; /*0x1680*/ if ( !Table_ ) /*0x168a*/ { - SystemConfigurationTable = EfiGetSystemConfigurationTable(&TableGuid_, (void **)&Table_); /*0x169a*/ + SystemConfigurationTable = GetSystemConfigurationTable(&TableGuid_, (void **)&Table_); /*0x169a*/ if ( SystemConfigurationTable < 0 ) /*0x16a2*/ { DebugLogPrint(0x80000000LL, "\nASSERT_EFI_ERROR (Status = %r)\n", SystemConfigurationTable); /*0x16b3*/ @@ -334,21 +332,21 @@ // Function: GuidEqual @ 0x1700 (0x67 bytes) // Index: 13/14 -bool __fastcall GuidEqual(EFI_GUID *TableGuid, __int64 TableGuid_1) +bool __fastcall GuidEqual(EFI_GUID *TableGuid, __int64 OtherGuid) { __int128 v4; // rdi __int64 v5; // rbx - *((_QWORD *)&v4 + 1) = sub_1768((__int64)TableGuid); /*0x1722*/ - v5 = sub_1768(TableGuid_1); /*0x172e*/ - *(_QWORD *)&v4 = sub_1768((__int64)TableGuid->Data4); /*0x173a*/ - return v4 == __PAIR128__(v5, sub_1768(TableGuid_1 + 8)); /*0x1761*/ + *((_QWORD *)&v4 + 1) = GuidHash64((__int64)TableGuid); /*0x1722*/ + v5 = GuidHash64(OtherGuid); /*0x172e*/ + *(_QWORD *)&v4 = GuidHash64((__int64)TableGuid->Data4); /*0x173a*/ + return v4 == __PAIR128__(v5, GuidHash64(OtherGuid + 8)); /*0x1761*/ } // Function: Crc32GuidHash @ 0x1768 (0x2f bytes) // Index: 14/14 -__int64 __fastcall Crc32GuidHash(EFI_GUID *TableGuid) +__int64 __fastcall GuidHash64(EFI_GUID *TableGuid) { if ( !TableGuid ) /*0x1774*/ AssertCpuDeadLoop((__int64)"e:\\hs\\MdePkg\\Library\\BaseLib\\Unaligned.c", 192, (__int64)"Buffer != ((void *) 0)"); /*0x1789*/ diff --git a/PurleySktPkg/Dxe/NvdimmCommon/NvdimmSmbusCommon/NvdimmSmbusCommon.h b/PurleySktPkg/Dxe/NvdimmCommon/NvdimmSmbusCommon/NvdimmSmbusCommon.h index 3f1228b..810e11e 100644 --- a/PurleySktPkg/Dxe/NvdimmCommon/NvdimmSmbusCommon/NvdimmSmbusCommon.h +++ b/PurleySktPkg/Dxe/NvdimmCommon/NvdimmSmbusCommon/NvdimmSmbusCommon.h @@ -1,502 +1,33 @@ -/** @file - NvdimmSmbusCommon.h -- Header for NvdimmSmbusCommon - -Copyright (c) HR650X BIOS Decompilation Project -**/ - #ifndef __NVDIMMSMBUSCOMMON_H__ #define __NVDIMMSMBUSCOMMON_H__ #include "../uefi_headers/Uefi.h" -// -// Function Prototypes -// +EFI_STATUS EFIAPI ModuleEntryPoint(VOID); +EFI_STATUS EFIAPI NvdimmSmbusCommonEntryPoint(EFI_HANDLE ImageHandle); -EFI_STATUS -EFIAPI -ModuleEntryPoint( - VOID -); +char *__fastcall ZeroMem(char *Buffer, unsigned __int64 Length); +char *__fastcall ZeroMemWrapper(char *Buffer, unsigned __int64 Length); -EFI_STATUS -EFIAPI -Data( - VOID -); +__int64 GetDebugPortProtocol(void); +__int64 DebugLogPrint(__int64 ErrorLevel, const char *Format, ...); +__int64 __fastcall AssertCpuDeadLoop(__int64 File, __int64 Line, __int64 Condition); -EFI_STATUS -EFIAPI -ImageHandle; // 0x3058( - VOID -); +__int64 __cdecl GetSystemConfigurationTable(EFI_GUID *TableGuid, void **Table); +void *__cdecl GetHobList(void); +bool __fastcall GuidEqual(EFI_GUID *TableGuid, __int64 OtherGuid); +__int64 __fastcall GuidHash64(EFI_GUID *TableGuid); -EFI_STATUS -EFIAPI -EFI_BOOT_SERVICES *BootServices; // 0x3050( - VOID -); +extern EFI_HANDLE ImageHandle; +extern EFI_SYSTEM_TABLE *SystemTable; +extern EFI_BOOT_SERVICES *BootServices; +extern UINT64 RuntimeServices_0; +extern UINT64 BootServices_0; +extern UINT64 qword_3078; +extern UINT64 qword_3088; +extern UINT64 qword_3098; +extern UINT64 buf_; +extern UINT64 buf_0; +extern UINT64 *qword_3070; -EFI_STATUS -EFIAPI -UINT64 RuntimeServices_0; // 0x3068 - copy of RT( - VOID -); - -EFI_STATUS -EFIAPI -- copy of BS( - VOID -); - -EFI_STATUS -EFIAPI -UINT64 qword_3078; // 0x3078 - TPL notify event( - VOID -); - -EFI_STATUS -EFIAPI -- debug port protocol ptr( - VOID -); - -EFI_STATUS -EFIAPI -- HOB list ptr( - VOID -); - -EFI_STATUS -EFIAPI -- gDS ptr( - VOID -); - -EFI_STATUS -EFIAPI -- debug level state( - VOID -); - -EFI_STATUS -EFIAPI -- SMM buffer struct( - VOID -); - -EFI_STATUS -EFIAPI -- SMM buffer address( - VOID -); - -EFI_STATUS -EFIAPI -definitions (in .rdata section)( - VOID -); - -EFI_STATUS -EFIAPI -gEfiDebugPortProtocolGuid = { 0xEBA4E8D2L, 0x3858, 0x41EC, { 0xA2, 0x81, 0x26, 0x47, 0xBA, 0x96, 0x60, 0xD0 } };( - VOID -); - -EFI_STATUS -EFIAPI -parameters and calls sub_1000 to zero memory.( - VOID -); - -EFI_STATUS -EFIAPI -a QWORD from an unaligned pointer with NULL validation.( - VOID -); - -EFI_STATUS -EFIAPI -two GUIDs by reading them as two 64-bit values.( - VOID -); - -EFI_STATUS -EFIAPI -SystemTable->ConfigurationTable for a matching GUID.( - VOID -); - -EFI_STATUS -EFIAPI -NumberOfTableEntries (SystemTable + 104 = 0x68, offset of( - VOID -); - -EFI_STATUS -EFIAPI -in EFI_SYSTEM_TABLE)( - VOID -); - -EFI_STATUS -EFIAPI -(*(UINT64 *)(SystemTablePtr + 104) == 0) {( - VOID -); - -EFI_STATUS -EFIAPI -ConfigurationTable array at SystemTable + 112 (= 0x70)( - VOID -); - -EFI_STATUS -EFIAPI -are 24 bytes each (GUID + pointer)( - VOID -); - -EFI_STATUS -EFIAPI -(i = 0;( - VOID -); - -EFI_STATUS -EFIAPI -pointer is at offset 16 within each 24-byte entry( - VOID -); - -EFI_STATUS -EFIAPI -and caches the HOB list pointer via the UEFI configuration table.( - VOID -); - -EFI_STATUS -EFIAPI -BootServices_0 to 0. Registered via CreateEvent to track( - VOID -); - -EFI_STATUS -EFIAPI -services availability.( - VOID -); - -EFI_STATUS -EFIAPI -services cleanup for debug port protocol pointer.( - VOID -); - -EFI_STATUS -EFIAPI -via CreateEventEx with EVT_NOTIFY_SIGNAL.( - VOID -); - -EFI_STATUS -EFIAPI -and caches the EFI_DEBUGPORT_PROTOCOL for debug print output.( - VOID -); - -EFI_STATUS -EFIAPI -BootServices->LocateProtocol if available; checks TPL first.( - VOID -); - -EFI_STATUS -EFIAPI -to TPL_HIGH_LEVEL (31) via BootServices_0 + 24( - VOID -); - -EFI_STATUS -EFIAPI -= (*(UINT64 (__fastcall **)(UINT64))(BootServices_0 + 24))(31);( - VOID -); - -EFI_STATUS -EFIAPI -+ 320 = LocateProtocol( - VOID -); - -EFI_STATUS -EFIAPI -= (*(INT64 (__fastcall **)(void *, UINT64, UINT64 *))(( - VOID -); - -EFI_STATUS -EFIAPI -outputs debug messages based on the current debug level( - VOID -); - -EFI_STATUS -EFIAPI -in CMOS ports 0x70/0x71 (index 0x4B). If a debug port protocol( - VOID -); - -EFI_STATUS -EFIAPI -available and the message's error level passes the platform filter( - VOID -); - -EFI_STATUS -EFIAPI -message is forwarded to the protocol's output function.( - VOID -); - -EFI_STATUS -EFIAPI -current debug level from CMOS index 0x4B( - VOID -); - -EFI_STATUS -EFIAPI -(0x70, (__inbyte (0x70) & 0x80) | 0x4B);( - VOID -); - -EFI_STATUS -EFIAPI -to max level 3( - VOID -); - -EFI_STATUS -EFIAPI -= CmosDebugLevel;( - VOID -); - -EFI_STATUS -EFIAPI -to filter mask (level 1 = EFI_D_ERROR, level 2+ = EFI_D_WARN)( - VOID -); - -EFI_STATUS -EFIAPI -= (UINT8)(N113 - 1);( - VOID -); - -EFI_STATUS -EFIAPI -equivalent( - VOID -); - -EFI_STATUS -EFIAPI -| EFI_D_ERROR( - VOID -); - -EFI_STATUS -EFIAPI -only( - VOID -); - -EFI_STATUS -EFIAPI -the message level passes the filter, call debug output( - VOID -); - -EFI_STATUS -EFIAPI -((FilterLevel & ErrorLevel) != 0) {( - VOID -); - -EFI_STATUS -EFIAPI -debug output with file, line, and assertion condition.( - VOID -); - -EFI_STATUS -EFIAPI -driver initialization that:( - VOID -); - -EFI_STATUS -EFIAPI -references:( - VOID -); - -EFI_STATUS -EFIAPI -= sub_1584( - VOID -); - -EFI_STATUS -EFIAPI -| EVT_TIMER( - VOID -); - -EFI_STATUS -EFIAPI -HOB list( - VOID -); - -EFI_STATUS -EFIAPI -();( - VOID -); - -EFI_STATUS -EFIAPI -DXE Services Table by GUID( - VOID -); - -EFI_STATUS -EFIAPI -= sub_15B8 ((UINT64)&gEfiDxeServicesTableGuid, &qword_3098);( - VOID -); - -EFI_STATUS -EFIAPI -SMM communication buffer, zeros it, and installs the( - VOID -); - -EFI_STATUS -EFIAPI -protocol for NONSMM<->SMM interface.( - VOID -); - -EFI_STATUS -EFIAPI -(type 1 = EfiRuntimeServicesData, 10 pages)( - VOID -); - -EFI_STATUS -EFIAPI -= (*(INT64 (__fastcall **)(UINT64, UINT64, UINT64, UINT64 *))(( - VOID -); - -EFI_STATUS -EFIAPI -10, // Pages( - VOID -); - -EFI_STATUS -EFIAPI -&Buffer( - VOID -); - -EFI_STATUS -EFIAPI -the SMM communication buffer address( - VOID -); - -EFI_STATUS -EFIAPI -(( - VOID -); - -EFI_STATUS -EFIAPI -the communication buffer (15 bytes for the SMBUS interface)( - VOID -); - -EFI_STATUS -EFIAPI -((char *)Buffer, 0x0F);( - VOID -); - -EFI_STATUS -EFIAPI -the local buffer structure( - VOID -); - -EFI_STATUS -EFIAPI -((char *)&buf_, 0x10);( - VOID -); - -EFI_STATUS -EFIAPI -the SMM communication structure( - VOID -); - -EFI_STATUS -EFIAPI -= Buffer; // SMM buffer pointer( - VOID -); - -EFI_STATUS -EFIAPI -revision or initialized flag( - VOID -); - -EFI_STATUS -EFIAPI -= (*(INT64 (__fastcall **)(EFI_HANDLE *, void *, UINT64, char *))(( - VOID -); - -EFI_STATUS -EFIAPI -driver entry point.( - VOID -); - -EFI_STATUS -EFIAPI -services, allocates SMM communication buffer, installs( - VOID -); - -EFI_STATUS -EFIAPI -SMBUS NONSMM<->SMM interface protocol.( - VOID -); - -EFI_STATUS -EFIAPI -up: close protocol notify events( - VOID -); - -#endif /* __NVDIMMSMBUSCOMMON_H__ */ \ No newline at end of file +#endif diff --git a/PurleySktPkg/Dxe/SoftSkuDxe/SoftSkuDxe/SoftSkuStatus/SoftSkuStatus.c b/PurleySktPkg/Dxe/SoftSkuDxe/SoftSkuDxe/SoftSkuStatus/SoftSkuStatus.c index 004878f..43f6a36 100644 --- a/PurleySktPkg/Dxe/SoftSkuDxe/SoftSkuDxe/SoftSkuStatus/SoftSkuStatus.c +++ b/PurleySktPkg/Dxe/SoftSkuDxe/SoftSkuDxe/SoftSkuStatus/SoftSkuStatus.c @@ -58,7 +58,7 @@ } /* ---------------------------------------------------------------- - * UefiBootServicesTableLib Initialization (sub_358) + * UEFI Boot Services Table initialization * ---------------------------------------------------------------- */ /** @@ -175,7 +175,7 @@ } /* ---------------------------------------------------------------- - * SoftSkuMain (sub_900) + * Soft SKU status main routine * ---------------------------------------------------------------- */ /** @@ -288,7 +288,7 @@ } /* ---------------------------------------------------------------- - * Memory Tiering Notifier (sub_8C0) + * Memory tiering notifier * ---------------------------------------------------------------- */ /** @@ -314,7 +314,7 @@ } /* ---------------------------------------------------------------- - * SoftSkuApplyConfiguration (sub_5F8) + * Apply Soft SKU configuration * ---------------------------------------------------------------- */ /** @@ -419,7 +419,7 @@ } /* ---------------------------------------------------------------- - * AllocateSocketBuffers (sub_7D8) + * Allocate socket buffers * ---------------------------------------------------------------- */ /** @@ -558,7 +558,7 @@ } /* ---------------------------------------------------------------- - * Debug Print (sub_B6C) + * Debug print helper * ---------------------------------------------------------------- */ /** @@ -618,7 +618,7 @@ } /* ---------------------------------------------------------------- - * AssertBreak (sub_BF4) + * Assert break helper * ---------------------------------------------------------------- */ /** @@ -646,7 +646,7 @@ } /* ---------------------------------------------------------------- - * GetDebugProtocol (sub_AEC) + * Resolve debug protocol * ---------------------------------------------------------------- */ /** @@ -682,7 +682,7 @@ } /* ---------------------------------------------------------------- - * GetPcdProtocol (sub_C34) + * Resolve PCD protocol * ---------------------------------------------------------------- */ /** @@ -723,7 +723,7 @@ } /* ---------------------------------------------------------------- - * GetCpuConfigLibProtocol (sub_AEC variant) + * Resolve CPU config library protocol * ---------------------------------------------------------------- */ /** @@ -741,7 +741,7 @@ } /* ---------------------------------------------------------------- - * GetConfigurationTable (sub_CC0) + * Locate a configuration table entry * ---------------------------------------------------------------- */ /** @@ -794,7 +794,7 @@ } /* ---------------------------------------------------------------- - * GetHobList (sub_D84) + * Resolve HOB list * ---------------------------------------------------------------- */ /** @@ -833,7 +833,7 @@ } /* ---------------------------------------------------------------- - * CompareGuid (sub_E08) + * Compare GUID values * ---------------------------------------------------------------- */ /** @@ -859,7 +859,7 @@ } /* ---------------------------------------------------------------- - * ReadUnaligned64 (sub_E70) + * Read an unaligned 64-bit value * ---------------------------------------------------------------- */ /** @@ -883,4 +883,4 @@ } return *(UINT64 *)Buffer; -} \ No newline at end of file +} diff --git a/PurleySktPkg/Me/Heci/Smm/HeciSmm/HeciSmm.c b/PurleySktPkg/Me/Heci/Smm/HeciSmm/HeciSmm.c index 175c423..51541e9 100644 --- a/PurleySktPkg/Me/Heci/Smm/HeciSmm/HeciSmm.c +++ b/PurleySktPkg/Me/Heci/Smm/HeciSmm/HeciSmm.c @@ -19,22 +19,22 @@ __int64 v2; // rax EFI_STATUS v3; // rbx - sub_560(ImageHandle, SystemTable); + InitializeHeciSmmServices(ImageHandle, SystemTable); qword_3618 = 0x8000000000000001uLL; - if ( !sub_280(&unk_3520) ) + if ( !LocateHeciSmmProtocol(&unk_3520) ) { - v2 = sub_D1C(); + v2 = InstallHeciSmmProtocolInterfaces(); if ( v2 >= 0 || qword_3618 < 0 ) qword_3618 = v2; - sub_112C(&unk_3520); - sub_320(&unk_3520, -1); - sub_10EC( + InitializeHeciSmmProtocolState(&unk_3520); + SetHeciSmmProtocolStatus(&unk_3520, -1); + HeciSmmAssertHandler( "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\PurleySktPkg\\Me\\Heci\\Smm\\HeciSmm\\DEBUG\\AutoGen.c", 461, "((BOOLEAN)(0==1))"); - sub_10EC( + HeciSmmAssertHandler( "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\PurleySktPkg\\Me\\Heci\\Smm\\HeciSmm\\DEBUG\\AutoGen.c", 476, "((BOOLEAN)(0==1))"); @@ -42,6 +42,6 @@ v3 = qword_3618; if ( qword_3618 < 0 ) - sub_11E8(); + ShutdownHeciSmmServices(); return v3; } diff --git a/PurleySktPkg/Me/Heci/Smm/HeciSmm/HeciSmm.h b/PurleySktPkg/Me/Heci/Smm/HeciSmm/HeciSmm.h index 6a10e78..b355fe4 100644 --- a/PurleySktPkg/Me/Heci/Smm/HeciSmm/HeciSmm.h +++ b/PurleySktPkg/Me/Heci/Smm/HeciSmm/HeciSmm.h @@ -26,66 +26,66 @@ ); /// -/// sub_560 +/// InitializeHeciSmmServices /// EFI_STATUS EFIAPI -sub_560( +InitializeHeciSmmServices( VOID ); /// -/// sub_D1C +/// InstallHeciSmmProtocolInterfaces /// EFI_STATUS EFIAPI -sub_D1C( +InstallHeciSmmProtocolInterfaces( VOID ); /// -/// sub_112C +/// InitializeHeciSmmProtocolState /// EFI_STATUS EFIAPI -sub_112C( +InitializeHeciSmmProtocolState( VOID ); /// -/// sub_320 +/// SetHeciSmmProtocolStatus /// EFI_STATUS EFIAPI -sub_320( +SetHeciSmmProtocolStatus( VOID ); /// -/// sub_10EC +/// HeciSmmAssertHandler /// EFI_STATUS EFIAPI -sub_10EC( +HeciSmmAssertHandler( VOID ); /// -/// sub_280 +/// LocateHeciSmmProtocol /// EFI_STATUS EFIAPI -sub_280( +LocateHeciSmmProtocol( VOID ); /// -/// sub_11E8 +/// ShutdownHeciSmmServices /// EFI_STATUS EFIAPI -sub_11E8( +ShutdownHeciSmmServices( VOID ); -#endif /* __HECISMM_H__ */ \ No newline at end of file +#endif /* __HECISMM_H__ */ diff --git a/PurleySktPkg/Me/Heci/SmmHeci3/Heci3Smm/Heci3Smm.c b/PurleySktPkg/Me/Heci/SmmHeci3/Heci3Smm/Heci3Smm.c index 2de7659..a83cf37 100644 --- a/PurleySktPkg/Me/Heci/SmmHeci3/Heci3Smm/Heci3Smm.c +++ b/PurleySktPkg/Me/Heci/SmmHeci3/Heci3Smm/Heci3Smm.c @@ -22,22 +22,22 @@ __int64 v2; // rax EFI_STATUS v3; // rbx - sub_560(ImageHandle, SystemTable); + InitializeHeci3SmmServices(ImageHandle, SystemTable); qword_3658 = 0x8000000000000001uLL; - if ( !sub_280(&unk_3560) ) + if ( !LocateHeci3SmmProtocol(&unk_3560) ) { - v2 = sub_950(); + v2 = InstallHeci3SmmProtocolInterfaces(); if ( v2 >= 0 || qword_3658 < 0 ) qword_3658 = v2; - sub_1C90(&unk_3560); - sub_320(&unk_3560, -1); - sub_1C50( + InitializeHeci3SmmProtocolState(&unk_3560); + SetHeci3SmmProtocolStatus(&unk_3560, -1); + Heci3SmmAssertHandler( "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\PurleySktPkg\\Me\\Heci\\SmmHeci3\\MeHeci3Smm\\DEBUG\\AutoGen.c", 463, "((BOOLEAN)(0==1))"); - sub_1C50( + Heci3SmmAssertHandler( "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\PurleySktPkg\\Me\\Heci\\SmmHeci3\\MeHeci3Smm\\DEBUG\\AutoGen.c", 478, "((BOOLEAN)(0==1))"); @@ -45,6 +45,6 @@ v3 = qword_3658; if ( qword_3658 < 0 ) - sub_1D4C(); + ShutdownHeci3SmmServices(); return v3; } diff --git a/PurleySktPkg/Me/Heci/SmmHeci3/Heci3Smm/Heci3Smm.h b/PurleySktPkg/Me/Heci/SmmHeci3/Heci3Smm/Heci3Smm.h index 69d1f4e..b5ab912 100644 --- a/PurleySktPkg/Me/Heci/SmmHeci3/Heci3Smm/Heci3Smm.h +++ b/PurleySktPkg/Me/Heci/SmmHeci3/Heci3Smm/Heci3Smm.h @@ -26,66 +26,66 @@ ); /// -/// sub_560 +/// InitializeHeci3SmmServices /// EFI_STATUS EFIAPI -sub_560( +InitializeHeci3SmmServices( VOID ); /// -/// sub_950 +/// InstallHeci3SmmProtocolInterfaces /// EFI_STATUS EFIAPI -sub_950( +InstallHeci3SmmProtocolInterfaces( VOID ); /// -/// sub_1C90 +/// InitializeHeci3SmmProtocolState /// EFI_STATUS EFIAPI -sub_1C90( +InitializeHeci3SmmProtocolState( VOID ); /// -/// sub_320 +/// SetHeci3SmmProtocolStatus /// EFI_STATUS EFIAPI -sub_320( +SetHeci3SmmProtocolStatus( VOID ); /// -/// sub_1C50 +/// Heci3SmmAssertHandler /// EFI_STATUS EFIAPI -sub_1C50( +Heci3SmmAssertHandler( VOID ); /// -/// sub_280 +/// LocateHeci3SmmProtocol /// EFI_STATUS EFIAPI -sub_280( +LocateHeci3SmmProtocol( VOID ); /// -/// sub_1D4C +/// ShutdownHeci3SmmServices /// EFI_STATUS EFIAPI -sub_1D4C( +ShutdownHeci3SmmServices( VOID ); -#endif /* __HECI3SMM_H__ */ \ No newline at end of file +#endif /* __HECI3SMM_H__ */ diff --git a/PurleySktPkg/Me/Sps/Smm/SpsSmm/SpsSmm.c b/PurleySktPkg/Me/Sps/Smm/SpsSmm/SpsSmm.c index ff66918..a011e03 100644 --- a/PurleySktPkg/Me/Sps/Smm/SpsSmm/SpsSmm.c +++ b/PurleySktPkg/Me/Sps/Smm/SpsSmm/SpsSmm.c @@ -16,26 +16,26 @@ __int64 v2; // rax EFI_STATUS v3; // rbx - sub_560(ImageHandle, SystemTable); + InitializeSpsSmmServices(ImageHandle, SystemTable); qword_4DC8 = 0x8000000000000001uLL; - if ( !sub_2A0(&unk_4CD0) ) + if ( !LocateSpsSmmProtocol(&unk_4CD0) ) { - v2 = sub_8C8(); + v2 = InstallSpsSmmProtocolInterfaces(); if ( v2 >= 0 || qword_4DC8 < 0 ) qword_4DC8 = v2; - sub_23FC(&unk_4CD0); - sub_340(&unk_4CD0, -1); - sub_23BC( + InitializeSpsSmmProtocolState(&unk_4CD0); + SetSpsSmmProtocolStatus(&unk_4CD0, -1); + SpsSmmAssertHandler( "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\PurleySktPkg\\Me\\Sps\\Smm\\SpsSmm\\DEBUG\\AutoGen.c", 470, "((BOOLEAN)(0==1))"); - sub_23BC( + SpsSmmAssertHandler( "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\PurleySktPkg\\Me\\Sps\\Smm\\SpsSmm\\DEBUG\\AutoGen.c", 485, "((BOOLEAN)(0==1))"); } v3 = qword_4DC8; if ( qword_4DC8 < 0 ) - sub_24B8(); + ShutdownSpsSmmServices(); return v3; } diff --git a/PurleySktPkg/Me/Sps/Smm/SpsSmm/SpsSmm.h b/PurleySktPkg/Me/Sps/Smm/SpsSmm/SpsSmm.h index e4474e7..a037600 100644 --- a/PurleySktPkg/Me/Sps/Smm/SpsSmm/SpsSmm.h +++ b/PurleySktPkg/Me/Sps/Smm/SpsSmm/SpsSmm.h @@ -26,66 +26,66 @@ ); /// -/// sub_560 +/// InitializeSpsSmmServices /// EFI_STATUS EFIAPI -sub_560( +InitializeSpsSmmServices( VOID ); /// -/// sub_8C8 +/// InstallSpsSmmProtocolInterfaces /// EFI_STATUS EFIAPI -sub_8C8( +InstallSpsSmmProtocolInterfaces( VOID ); /// -/// sub_23FC +/// InitializeSpsSmmProtocolState /// EFI_STATUS EFIAPI -sub_23FC( +InitializeSpsSmmProtocolState( VOID ); /// -/// sub_340 +/// SetSpsSmmProtocolStatus /// EFI_STATUS EFIAPI -sub_340( +SetSpsSmmProtocolStatus( VOID ); /// -/// sub_23BC +/// SpsSmmAssertHandler /// EFI_STATUS EFIAPI -sub_23BC( +SpsSmmAssertHandler( VOID ); /// -/// sub_2A0 +/// LocateSpsSmmProtocol /// EFI_STATUS EFIAPI -sub_2A0( +LocateSpsSmmProtocol( VOID ); /// -/// sub_24B8 +/// ShutdownSpsSmmServices /// EFI_STATUS EFIAPI -sub_24B8( +ShutdownSpsSmmServices( VOID ); -#endif /* __SPSSMM_H__ */ \ No newline at end of file +#endif /* __SPSSMM_H__ */ diff --git a/PurleySktPkg/Override/IA32FamilyCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c b/PurleySktPkg/Override/IA32FamilyCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c index de91c8c..0a67b66 100644 --- a/PurleySktPkg/Override/IA32FamilyCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c +++ b/PurleySktPkg/Override/IA32FamilyCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c @@ -124,10 +124,10 @@ ImageHandle/SystemTable, then initialize the module. Flow: - 1. Save UEFI handles via sub_C4C() + 1. Save UEFI handles in the module entry path 2. Save global status variable qword_10788 = 0x8000000000000001 - 3. Acquire init lock via sub_370() on unk_10790 - 4. Call SmmInit() (sub_2390) to run full initialization + 3. Acquire the init lock before SMM initialization + 4. Call SmmInit() to run full initialization 5. If SmmInit succeeds, release lock and wait 6. On failure, run SmmUninit() to clean up @@ -143,24 +143,24 @@ ) { // 0xB90 - SmmEntryPointSaveHandles(ImageHandle); // sub_C4C + SmmEntryPointSaveHandles(ImageHandle); gStatus = EFI_ALREADY_STARTED; // qword_10788 = 0x8000000000000001 - if (!SmmAcquireLock(&InitLock)) { // sub_370(&unk_10790) + if (!SmmAcquireLock(&InitLock)) { // Lock acquired - we are the first to init - gStatus = SmmInit(ProtocolNotifyFn, SystemTable); // sub_2390 + gStatus = SmmInit(ProtocolNotifyFn, SystemTable); if (gStatus >= 0 || gStatus < 0) { // always true after init gStatus = gStatus; // preserve status } - SmmReleaseLock(&InitLock); // sub_8A60(&unk_10790) - SmmWaitForEvent(&InitLock, -1); // sub_560(&unk_10790, -1) + SmmReleaseLock(&InitLock); + SmmWaitForEvent(&InitLock, -1); // Debug asserts for build info DebugPrint(0, "((BOOLEAN)(0==1))", ...); } if (EFI_ERROR(gStatus)) { - SmmUninit(gSmramRanges); // sub_9DE0(qword_115A8) + SmmUninit(gSmramRanges); } return gStatus; } @@ -180,9 +180,9 @@ - Determine number of CPUs (mNumberOfCpus) - Allocate per-CPU structures (register tables, GDT/IDT) - Configure SMM code access check - - Initialize page tables via InitPaging() (sub_314C) - - Initialize long mode via InitLongMode() (sub_3394) - - Program per-CPU register tables via InitMp() (sub_2110) + - Initialize page tables via InitPaging() + - Initialize long mode via the long mode setup path + - Program per-CPU register tables via InitMp() 3. Initialize Interrupts and Exception Handling: - Set up IDT entries for SMM @@ -220,21 +220,21 @@ // Step 2: CPU detection // CPUID to determine CPU family (SNB/HSW/SKX/KNL/IVT) - // sub_3694, sub_36DC, sub_3710 used in dispatchers + // CPU family checks are used by the MSR dispatchers // Step 3: Page table initialization - // InitPaging(&SmrrBase, &SmrrSize, &SmrrEnd) (sub_314C) + // InitPaging(&SmrrBase, &SmrrSize, &SmrrEnd) // - Gets SMRAM ranges via EFI_SMM_ACCESS2_PROTOCOL // - Programs SMRR base/size MSRs // - Sets up 4KB page tables in SMRAM // Step 4: Long mode setup - // InitLongMode(EntryCount, ReservedBit) (sub_3394) + // InitLongMode(EntryCount, ReservedBit) // - CPUID feature matching against dword_104C0+ et al // - Writes "INTEL RSVD" string if reserved space // Step 5: MP data initialization - // InitMp() (sub_2110) + // InitMp() // - Allocates mAcpiCpuData.MtrrTable (608 bytes) // - Allocates mAcpiCpuData.GdtrProfile (10 bytes) // - Allocates mAcpiCpuData.IdtrProfile (10 bytes) @@ -287,7 +287,7 @@ if (!IsCpuSandyBridge()) { // Not SNB/HSW/SKX - try other models if (IsCpuKnightsLanding()) { - AcquireSpinLock(&SmmFeatureLock); // sub_A0DC + AcquireSpinLock(&SmmFeatureLock); if (ReadWrite == 0) { // Read 0x4107C MsrIndex = PciExpressAddress(...) | 0x4107C; @@ -349,7 +349,7 @@ // Save IDT, set up page tables, init exception handler // ... - Status = SmmS3Init(); // sub_B45C + Status = SmmS3Init(); if (EFI_ERROR(Status)) { DEBUG((DEBUG_ERROR, "\nASSERT_EFI_ERROR (Status = %r)\n", Status)); ASSERT_EFI_ERROR(Status); @@ -357,18 +357,18 @@ } // Initialize interrupt state for APs - InitInterruptState(); // sub_524C - LaunchS3Resume(); // sub_1A90 + InitInterruptState(); + LaunchS3Resume(); // Program register table for BSP - ProgramRegisterTable(); // sub_4F70 + ProgramRegisterTable(); // Set up return state mCpusExiting = mNumberOfCpus - 1; // Set return function *((UINT64 *)mGdtIdtTable + 1) = mGdtBuffer; // GDT pointer - *((UINT64 *)mGdtIdtTable + 3) = (UINT64)sub_51CC; // Return function + *((UINT64 *)mGdtIdtTable + 3) = (UINT64)S3ResumeReturnThunk; // Return function // Start APs with SIPI StartupAP((UINT32)mStartupRoutine); @@ -390,7 +390,7 @@ (VOID *)(UINTN)S3State->ReturnCtx1, (VOID *)(UINTN)S3State->ReturnCtx2, (VOID *)(UINTN)S3State->ReturnSp - ); // sub_8384 + ); } if (S3State->Signature == SMM_S3_SIG_64) { @@ -401,7 +401,7 @@ (UINT32)(UINTN)S3State->ReturnCtx1, (UINT32)(UINTN)S3State->ReturnCtx2, (UINT32)(UINTN)S3State->ReturnSp - ); // sub_5E0 + ); } DEBUG((DEBUG_INFO, "No context to return to PEI Phase\n")); @@ -431,10 +431,10 @@ ACPI_CPU_DATA *AcpiCpuData; // Get ACPI CPU data via protocol - AcpiCpuData = (ACPI_CPU_DATA *)LocateProtocol(); // sub_8AA8 + AcpiCpuData = (ACPI_CPU_DATA *)LocateProtocol(); // Allocate and copy MTRR table - mMtrrTable = (UINT64)AllocatePool(6, 608); // sub_9C8C + mMtrrTable = (UINT64)AllocatePool(6, 608); CopyMem(mMtrrTable, *(AcpiCpuData->MtrrTable), 608); // Allocate and copy GDTR profile @@ -496,7 +496,7 @@ // Entry processing: // Count == 1: BitField read -> modify -> write // Read MSR, mask StartBit..StartBit+BitsLength-1, write Value - // Uses BitFieldRead64/Write64 then CR writes (sub_410=cr0, sub_420=cr3, etc.) + // Uses BitFieldRead64/Write64 then control register updates // Count == 3: Cache maintain (wbinvd or just clean) // Count == 0 && BitsLength < 0x40: // Look up MSR in mMsrSpinLocks, acquire lock, read/modify/write MSR, release @@ -786,7 +786,7 @@ // 0x3694 INT32 CpuVersion; - Cpuid(1, &CpuVersion, 0, 0, 0); // sub_470 + Cpuid(1, &CpuVersion, 0, 0, 0); CpuVersion &= 0xFFF0FF0; return (CpuVersion == CPU_FEATURE_SNB_EP || @@ -846,4 +846,4 @@ { while (TRUE) ; -} \ No newline at end of file +} diff --git a/PurleySktPkg/Override/IA32FamilyCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h b/PurleySktPkg/Override/IA32FamilyCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h index 9627a90..d4131c9 100644 --- a/PurleySktPkg/Override/IA32FamilyCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h +++ b/PurleySktPkg/Override/IA32FamilyCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h @@ -1,7 +1,7 @@ /** @file PiSmmCpuDxeSmm.h -- Header for PiSmmCpuDxeSmm -Copyright (c) HR650X BIOS Decompilation Project + Copyright (c) HR650X BIOS Decompilation Project **/ #ifndef __PISMMCPUDXESMM_H__ @@ -9,914 +9,69 @@ #include "../uefi_headers/Uefi.h" -// -// Function Prototypes -// +EFI_STATUS EFIAPI _ModuleEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable); +UINT64 EFIAPI SmmInit(UINT64 *ProtocolNotifyFn, EFI_SYSTEM_TABLE *SystemTable); +UINT64 EFIAPI SmiHandlerDispatch(UINT64 CpuIndex, INT32 ReadWrite); +VOID EFIAPI SmmRestoreCpu(VOID); +UINT64 EFIAPI InitMp(VOID); +UINT64 EFIAPI ProgramRegisterTable(UINT32 *RegisterTableEntry); +UINT64 EFIAPI InitPaging(UINT32 *SmrrBase, UINT32 *SmrrSize, INT32 *SmrrEnd); +UINT8 EFIAPI DebugPrint(UINT64 ErrorLevel, CHAR8 *Format, ...); +UINT64 EFIAPI AssertBreak(UINT64 FileName, UINT32 LineNumber, UINT64 Expression); +UINT64 EFIAPI PciExpressAddress(UINT64 Address); +UINT64 EFIAPI AcquireSpinLock(UINT64 SpinLock); +UINT64 EFIAPI ReleaseSpinLock(UINT64 SpinLock); +UINT64 EFIAPI SmiHandlerFeatureMsr(UINT64 CpuIndex, INT32 ReadWrite, UINT64 Value); +UINT64 EFIAPI SendSmiIpi(UINT32 ApicId, UINT32 IpiType); +UINT64 EFIAPI StartupAP(UINT32 StartupRoutine, ...); +UINT64 EFIAPI GetCpuIndex(VOID); +BOOLEAN EFIAPI IsCpuSandyBridge(VOID); +BOOLEAN EFIAPI IsCpuKnightsLanding(VOID); +BOOLEAN EFIAPI IsCpuIvyTown(VOID); +VOID EFIAPI CpuDeadLoop(VOID); -EFI_STATUS -EFIAPI -_ModuleEntryPoint( - VOID -); +extern EFI_HANDLE gImageHandle; +extern EFI_SYSTEM_TABLE *gST; +extern EFI_BOOT_SERVICES *gBS; +extern UINT64 gSmst; +extern UINT64 gPcdProtocol; +extern UINT64 gPciExpressBase; +extern UINT64 gTimerPeriod; -EFI_STATUS -EFIAPI -SmmInit( - VOID -); +extern SMM_S3_RESUME_STATE *mSmmS3ResumeState; -EFI_STATUS -EFIAPI -SmiHandlerDispatch( - VOID -); +extern UINT32 mNumberOfCpus; +extern UINT32 mBspIndex; +extern UINT32 mCpusExiting; +extern UINT32 mGdtSize; +extern UINT64 mStartupRoutine; +extern UINT64 mGdtIdtTable; +extern UINT64 mGdtBuffer; +extern UINT64 mMtrrTable; +extern UINT64 mGdtrProfile; +extern UINT64 mIdtrProfile; +extern UINT64 mPreSmmInitRegisterTable; +extern UINT64 mRegisterTable; +extern UINT64 mGdtForAp; +extern UINT64 mApDoneFlag; +extern UINT8 mApStartPhase; -EFI_STATUS -EFIAPI -SmmRestoreCpu( - VOID -); +extern UINT64 mGdtForApAlloc; +extern UINT64 mIdtForApAlloc; +extern UINT64 mExcptHandlerAlloc; -EFI_STATUS -EFIAPI -InitMp( - VOID -); +extern UINT64 mMsrSpinLocks; +extern UINT64 mMsrSpinLockCount; +extern UINT64 mMsrSpinLockMax; +extern UINT64 mCpuEnabledBitmap; -EFI_STATUS -EFIAPI -ProgramRegisterTable( - VOID -); +extern UINT8 mGdtIdtReady; +extern UINT8 mSmmCodeAccessCheck; +extern UINT8 mSmrrConfigured; +extern UINT8 mCodeAccessCheck; -EFI_STATUS -EFIAPI -InitPaging( - VOID -); +extern UINT64 mExceptionHandlerBase; +extern UINT64 mExceptionHandlerEnd; +extern volatile UINT64 *gSmmCpuPrivate; -EFI_STATUS -EFIAPI -DebugPrint( - VOID -); - -EFI_STATUS -EFIAPI -AssertBreak( - VOID -); - -EFI_STATUS -EFIAPI -PciExpressAddress( - VOID -); - -EFI_STATUS -EFIAPI -AcquireSpinLock( - VOID -); - -EFI_STATUS -EFIAPI -ReleaseSpinLock( - VOID -); - -EFI_STATUS -EFIAPI -SmiHandlerFeatureMsr( - VOID -); - -EFI_STATUS -EFIAPI -SendSmiIpi( - VOID -); - -EFI_STATUS -EFIAPI -StartupAP( - VOID -); - -EFI_STATUS -EFIAPI -GetCpuIndex( - VOID -); - -EFI_STATUS -EFIAPI -IsCpuSandyBridge( - VOID -); - -EFI_STATUS -EFIAPI -IsCpuKnightsLanding( - VOID -); - -EFI_STATUS -EFIAPI -IsCpuIvyTown( - VOID -); - -EFI_STATUS -EFIAPI -CpuDeadLoop( - VOID -); - -EFI_STATUS -EFIAPI -data initialized at module entry( - VOID -); - -EFI_STATUS -EFIAPI -gImageHandle = NULL; // 0x108F0( - VOID -); - -EFI_STATUS -EFIAPI -- SystemTable alias( - VOID -); - -EFI_STATUS -EFIAPI -UINT64 gSmst = NULL; // 0x10900 - SMM System Table (gSmst)( - VOID -); - -EFI_STATUS -EFIAPI -UINT64 gPciExpressBase = 0; // 0x10910 - PCIe config base address( - VOID -); - -EFI_STATUS -EFIAPI -//( - VOID -); - -EFI_STATUS -EFIAPI -S3 Resume State - pointer to S3 resume structure in SMRAM( - VOID -); - -EFI_STATUS -EFIAPI -by SmmRestoreCpu() at 0x1C3C for:( - VOID -); - -EFI_STATUS -EFIAPI -"SMM_S_32" (0x32335F33534D4D53) -> use AsmDisablePaging64( - VOID -); - -EFI_STATUS -EFIAPI -"SMM_S_64" (0x34365F33534D4D53) -> use SwitchStack( - VOID -); - -EFI_STATUS -EFIAPI -*mSmmS3ResumeState = NULL; // 0x10690( - VOID -); - -EFI_STATUS -EFIAPI -configuration( - VOID -); - -EFI_STATUS -EFIAPI -mNumberOfCpus = 0; // 0x118A4( - VOID -); - -EFI_STATUS -EFIAPI -UINT32 mCpusExiting = 0; // 0x11870 - APs remaining to finish init( - VOID -); - -EFI_STATUS -EFIAPI -UINT64 mStartupRoutine = 0; // 0x11880( - VOID -); - -EFI_STATUS -EFIAPI -UINT64 mGdtBuffer = 0; // 0x11898( - VOID -); - -EFI_STATUS -EFIAPI -UINT64 mGdtrProfile = 0; // 0x11888( - VOID -); - -EFI_STATUS -EFIAPI -UINT64 mPreSmmInitRegisterTable = 0; // 0x118B0( - VOID -); - -EFI_STATUS -EFIAPI -UINT64 mGdtForAp = 0; // 0x118C0( - VOID -); - -EFI_STATUS -EFIAPI -UINT8 mApStartPhase = 0; // 0x11918( - VOID -); - -EFI_STATUS -EFIAPI -mGdtForApAlloc = 0; // 0x10890( - VOID -); - -EFI_STATUS -EFIAPI -UINT64 mExcptHandlerAlloc = 0; // 0x108A0( - VOID -); - -EFI_STATUS -EFIAPI -Spin Locks( - VOID -); - -EFI_STATUS -EFIAPI -mMsrSpinLocks = 0; // 0x108A8 - base address( - VOID -); - -EFI_STATUS -EFIAPI -UINT64 mMsrSpinLockMax = 0; // 0x105F0( - VOID -); - -EFI_STATUS -EFIAPI -enabling bitmap( - VOID -); - -EFI_STATUS -EFIAPI -mCpuEnabledBitmap = 0; // 0x108B8( - VOID -); - -EFI_STATUS -EFIAPI -flags( - VOID -); - -EFI_STATUS -EFIAPI -mGdtIdtReady = 0; // 0x10888( - VOID -); - -EFI_STATUS -EFIAPI -UINT8 mSmrrConfigured = 0; // 0x118E9( - VOID -); - -EFI_STATUS -EFIAPI -handler base/length( - VOID -); - -EFI_STATUS -EFIAPI -mExceptionHandlerBase = 0; // 0x10970( - VOID -); - -EFI_STATUS -EFIAPI -CPU private data array (off_10378 at 0x10378)( - VOID -); - -EFI_STATUS -EFIAPI -11-entry array of pointers to per-CPU SMM data:( - VOID -); - -EFI_STATUS -EFIAPI -UINT64 *gSmmCpuPrivate = (volatile UINT64 *)0x10378;( - VOID -); - -EFI_STATUS -EFIAPI -SmmEntryPointSaveHandles(ImageHandle); // sub_C4C( - VOID -); - -EFI_STATUS -EFIAPI -= 0x8000000000000001( - VOID -); - -EFI_STATUS -EFIAPI -acquired - we are the first to init( - VOID -); - -EFI_STATUS -EFIAPI -if (gStatus >= 0 || gStatus < 0) { // always true after init( - VOID -); - -EFI_STATUS -EFIAPI -status( - VOID -); - -EFI_STATUS -EFIAPI -asserts for build info( - VOID -); - -EFI_STATUS -EFIAPI -- Entry( - VOID -); - -EFI_STATUS -EFIAPI -initialization sequence spanning SmmFeatures.c( - VOID -); - -EFI_STATUS -EFIAPI -1: Initialize SMM protocol interfaces( - VOID -); - -EFI_STATUS -EFIAPI -SMM System Table (gSmst) at qword_10900( - VOID -); - -EFI_STATUS -EFIAPI -communication handler( - VOID -); - -EFI_STATUS -EFIAPI -up SMI entry/exit( - VOID -); - -EFI_STATUS -EFIAPI -2: CPU detection( - VOID -); - -EFI_STATUS -EFIAPI -to determine CPU family (SNB/HSW/SKX/KNL/IVT)( - VOID -); - -EFI_STATUS -EFIAPI -3: Page table initialization( - VOID -); - -EFI_STATUS -EFIAPI -4: Long mode setup( - VOID -); - -EFI_STATUS -EFIAPI -5: MP data initialization( - VOID -); - -EFI_STATUS -EFIAPI -6: SMM features initialization( - VOID -); - -EFI_STATUS -EFIAPI -SmiHandlerDispatch() as SwSmiHandler( - VOID -); - -EFI_STATUS -EFIAPI -SmiHandlerFeatureMsr() for feature MSR access( - VOID -); - -EFI_STATUS -EFIAPI -7: MP wake and startup( - VOID -); - -EFI_STATUS -EFIAPI -APs with StartupRoutine( - VOID -); - -EFI_STATUS -EFIAPI -AP calls ProgramRegisterTable() for its register table entries( - VOID -); - -EFI_STATUS -EFIAPI -for all APs via mCpusExiting counter( - VOID -); - -EFI_STATUS -EFIAPI -UINT64 MsrValue;( - VOID -); - -EFI_STATUS -EFIAPI -CPU model and dispatch to correct MSR handling( - VOID -); - -EFI_STATUS -EFIAPI -SNB/HSW/SKX - try other models( - VOID -); - -EFI_STATUS -EFIAPI -if (ReadWrite == 0) {( - VOID -); - -EFI_STATUS -EFIAPI -0x4107C( - VOID -); - -EFI_STATUS -EFIAPI -to 0x41050/0x41054( - VOID -); - -EFI_STATUS -EFIAPI -MSR handling at 0x4115x - 0x4117x range( - VOID -); - -EFI_STATUS -EFIAPI -SMM_S3_RESUME_STATE *S3State;( - VOID -); - -EFI_STATUS -EFIAPI -if (S3State == NULL) {( - VOID -); - -EFI_STATUS -EFIAPI -IDT, set up page tables, init exception handler( - VOID -); - -EFI_STATUS -EFIAPI -if (EFI_ERROR(Status)) {( - VOID -); - -EFI_STATUS -EFIAPI -interrupt state for APs( - VOID -); - -EFI_STATUS -EFIAPI -LaunchS3Resume(); // sub_1A90( - VOID -); - -EFI_STATUS -EFIAPI -register table for BSP( - VOID -); - -EFI_STATUS -EFIAPI -// Set up return state( - VOID -); - -EFI_STATUS -EFIAPI -return function( - VOID -); - -EFI_STATUS -EFIAPI -pointer( - VOID -); - -EFI_STATUS -EFIAPI -function( - VOID -); - -EFI_STATUS -EFIAPI -APs with SIPI( - VOID -); - -EFI_STATUS -EFIAPI -resume method based on signature( - VOID -); - -EFI_STATUS -EFIAPI -}( - VOID -); - -EFI_STATUS -EFIAPI -ACPI_CPU_DATA *AcpiCpuData;( - VOID -); - -EFI_STATUS -EFIAPI -ACPI CPU data via protocol( - VOID -); - -EFI_STATUS -EFIAPI -// Allocate and copy MTRR table( - VOID -); - -EFI_STATUS -EFIAPI -CopyMem(mMtrrTable, *(AcpiCpuData->MtrrTable), 608);( - VOID -); - -EFI_STATUS -EFIAPI -and copy GDTR profile( - VOID -); - -EFI_STATUS -EFIAPI -and copy IDTR profile( - VOID -); - -EFI_STATUS -EFIAPI -and copy PreSmmInitRegisterTable (24 bytes per CPU)( - VOID -); - -EFI_STATUS -EFIAPI -and copy RegisterTable (24 bytes per CPU)( - VOID -); - -EFI_STATUS -EFIAPI -combined GDT/IDT/Exception handler region( - VOID -); - -EFI_STATUS -EFIAPI -// Entry processing:( - VOID -); - -EFI_STATUS -EFIAPI -== 1: BitField read -> modify -> write( - VOID -); - -EFI_STATUS -EFIAPI -MSR, mask StartBit..StartBit+BitsLength-1, write Value( - VOID -); - -EFI_STATUS -EFIAPI -BitFieldRead64/Write64 then CR writes (sub_410=cr0, sub_420=cr3, etc.)( - VOID -); - -EFI_STATUS -EFIAPI -== 3: Cache maintain (wbinvd or just clean)( - VOID -); - -EFI_STATUS -EFIAPI -== 0 && BitsLength < 0x40:( - VOID -); - -EFI_STATUS -EFIAPI -up MSR in mMsrSpinLocks, acquire lock, read/modify/write MSR, release( - VOID -); - -EFI_STATUS -EFIAPI -== 0: direct write via __writemsr()( - VOID -); - -EFI_STATUS -EFIAPI -// 1. Get SMM Access2 Protocol( - VOID -); - -EFI_STATUS -EFIAPI -// 1. Check if Format is NULL -> ASSERT( - VOID -); - -EFI_STATUS -EFIAPI -// AsciiSPrint("ASSERT [%a] %a(%d): %a\n", ...)( - VOID -); - -EFI_STATUS -EFIAPI -break via SerialPortWrite( - VOID -); - -EFI_STATUS -EFIAPI -if ((Address & ~0xFFFFFFF) != 0) {( - VOID -); - -EFI_STATUS -EFIAPI -// Check if already acquired via IsSpinLockAcquired( - VOID -); - -EFI_STATUS -EFIAPI -not:( - VOID -); - -EFI_STATUS -EFIAPI -= ReadTsc()( - VOID -); - -EFI_STATUS -EFIAPI -= 10000000 * gTimerPeriod / 0xF4240( - VOID -); - -EFI_STATUS -EFIAPI -not acquired:( - VOID -); - -EFI_STATUS -EFIAPI -(elapsed >= Timeout) ASSERT( - VOID -); - -EFI_STATUS -EFIAPI -// ASSERT(SpinLock != NULL)( - VOID -); - -EFI_STATUS -EFIAPI -// Same dispatch pattern as SmiHandlerDispatch but( - VOID -); - -EFI_STATUS -EFIAPI -handles MSR read/write at:( - VOID -); - -EFI_STATUS -EFIAPI -(KNL read)( - VOID -); - -EFI_STATUS -EFIAPI -(KNL status)( - VOID -); - -EFI_STATUS -EFIAPI -// if (GetApicMode() == xAPIC) {( - VOID -); - -EFI_STATUS -EFIAPI -eflags, cli( - VOID -); - -EFI_STATUS -EFIAPI -APIC ICR register via memory-mapped APIC( - VOID -); - -EFI_STATUS -EFIAPI -for ICR to be accepted( - VOID -); - -EFI_STATUS -EFIAPI -mode: use MSR 0x830( - VOID -); - -EFI_STATUS -EFIAPI -// ASSERT(StartupRoutine < 0x100000)( - VOID -); - -EFI_STATUS -EFIAPI -INIT IPI (0xC4500 = delivery + INIT)( - VOID -); - -EFI_STATUS -EFIAPI -10ms( - VOID -); - -EFI_STATUS -EFIAPI -SIPI with startup page( - VOID -); - -EFI_STATUS -EFIAPI -200us( - VOID -); - -EFI_STATUS -EFIAPI -SIPI again( - VOID -); - -EFI_STATUS -EFIAPI -// if (GetApicMode() != 1) {( - VOID -); - -EFI_STATUS -EFIAPI -GetApicId(); // x2APIC: APIC ID == CPU index( - VOID -); - -EFI_STATUS -EFIAPI -leaf 0xB: get x2APIC ID( - VOID -); - -EFI_STATUS -EFIAPI -leaf 0xB available:( - VOID -); - -EFI_STATUS -EFIAPI -Feature Checks( - VOID -); - -EFI_STATUS -EFIAPI -INT32 CpuVersion;( - VOID -); - -EFI_STATUS -EFIAPI -CpuVersion &= 0xFFF0FF0;( - VOID -); - -#endif /* __PISMMCPUDXESMM_H__ */ \ No newline at end of file +#endif diff --git a/PurleySktPkg/Smm/FpgaInit/FpgaSmm/FpgaSmm/FpgaSmm.c b/PurleySktPkg/Smm/FpgaInit/FpgaSmm/FpgaSmm/FpgaSmm.c index 8d9491b..7a626c7 100644 --- a/PurleySktPkg/Smm/FpgaInit/FpgaSmm/FpgaSmm/FpgaSmm.c +++ b/PurleySktPkg/Smm/FpgaInit/FpgaSmm/FpgaSmm/FpgaSmm.c @@ -1,14 +1,55 @@ /** @file FpgaSmm.c -- FpgaSmm - Auto-converted from IDA decompiler output. - Functions: 1 - Copyright (c) HR650X BIOS Decompilation Project **/ #include "FpgaSmm.h" +EFI_STATUS mFpgaSmmStatus = 0x8000000000000001uLL; +VOID *mFpgaSmmContext = NULL; +VOID *mFpgaSmmCleanupToken = NULL; -// Function: ModuleEntryPoint -EFI_STATUS ModuleEntryPoint(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) { __int64 v2; // rax EFI_STATUS v3; // rbx sub_514(ImageHandle, SystemTable); qword_1D88 = 0x8000000000000001uLL; if ( !sub_280(&unk_1C90) ) { v2 = sub_864(); if ( v2 >= 0 || qword_1D88 < 0 ) qword_1D88 = v2; sub_AD8(&unk_1C90); sub_320(&unk_1C90, -1); sub_C84( "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\PurleySktPkg\\Smm\\FpgaInit\\FpgaSmm\\FpgaSmm\\DEBUG\\AutoGen.c", 328, "((BOOLEAN)(0==1))"); sub_C84( "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\PurleySktPkg\\Smm\\FpgaInit\\FpgaSmm\\FpgaSmm\\DEBUG\\AutoGen.c", 343, "((BOOLEAN)(0==1))"); } v3 = qword_1D88; if ( qword_1D88 < 0 ) sub_D38(qword_1D98); return v3; } +EFI_STATUS +EFIAPI +ModuleEntryPoint( + EFI_HANDLE ImageHandle, + EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS InitStatus; + EFI_STATUS ReturnStatus; + + FpgaSmmInitializeLibraryServices(ImageHandle, SystemTable); + mFpgaSmmStatus = 0x8000000000000001uLL; + + if ( !FpgaSmmSetJump(&mFpgaSmmContext) ) + { + InitStatus = FpgaSmmInitialize(); + if ( InitStatus >= 0 || mFpgaSmmStatus < 0 ) + { + mFpgaSmmStatus = InitStatus; + } + + FpgaSmmReleaseInitializationLock(); + FpgaSmmPerformLongJump(&mFpgaSmmContext); + FpgaSmmAssertFalse( + "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\PurleySktPkg\\Smm\\FpgaInit\\FpgaSmm\\FpgaSmm\\DEBUG\\AutoGen.c", + 328, + "((BOOLEAN)(0==1))" + ); + FpgaSmmAssertFalse( + "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\PurleySktPkg\\Smm\\FpgaInit\\FpgaSmm\\FpgaSmm\\DEBUG\\AutoGen.c", + 343, + "((BOOLEAN)(0==1))" + ); + } + + ReturnStatus = mFpgaSmmStatus; + if ( mFpgaSmmStatus < 0 ) + { + FpgaSmmCleanupOnError(mFpgaSmmCleanupToken); + } + + return ReturnStatus; +} diff --git a/PurleySktPkg/Smm/FpgaInit/FpgaSmm/FpgaSmm/FpgaSmm.h b/PurleySktPkg/Smm/FpgaInit/FpgaSmm/FpgaSmm/FpgaSmm.h index 8739ac7..2ae22ef 100644 --- a/PurleySktPkg/Smm/FpgaInit/FpgaSmm/FpgaSmm/FpgaSmm.h +++ b/PurleySktPkg/Smm/FpgaInit/FpgaSmm/FpgaSmm/FpgaSmm.h @@ -1,9 +1,6 @@ /** @file FpgaSmm.h -- Header for FpgaSmm - Source: DEBUG_VS2015\X64\PurleySktPkg\Smm\FpgaInit\FpgaSmm\FpgaSmm\DEBUG - Build: HR6N0XMLK DEBUG_VS2015 X64 - Copyright (c) HR650X BIOS Decompilation Project **/ @@ -16,76 +13,60 @@ // Function Prototypes // -/// -/// ModuleEntryPoint -- UEFI entry point / initialization function -/// EFI_STATUS EFIAPI ModuleEntryPoint( - VOID -); + EFI_HANDLE ImageHandle, + EFI_SYSTEM_TABLE *SystemTable + ); -/// -/// sub_514 -/// EFI_STATUS EFIAPI -sub_514( - VOID -); +FpgaSmmInitializeLibraryServices( + EFI_HANDLE ImageHandle, + EFI_SYSTEM_TABLE *SystemTable + ); -/// -/// sub_864 -/// EFI_STATUS EFIAPI -sub_864( +FpgaSmmInitialize( VOID -); + ); -/// -/// sub_AD8 -/// EFI_STATUS EFIAPI -sub_AD8( +FpgaSmmReleaseInitializationLock( VOID -); + ); -/// -/// sub_320 -/// EFI_STATUS EFIAPI -sub_320( - VOID -); +FpgaSmmPerformLongJump( + VOID * + ); -/// -/// sub_C84 -/// EFI_STATUS EFIAPI -sub_C84( - VOID -); +FpgaSmmAssertFalse( + CONST CHAR8 *FileName, + UINTN LineNumber, + CONST CHAR8 *Expression + ); -/// -/// sub_280 -/// EFI_STATUS EFIAPI -sub_280( - VOID -); +FpgaSmmSetJump( + VOID * + ); -/// -/// sub_D38 -/// EFI_STATUS EFIAPI -sub_D38( - VOID -); +FpgaSmmCleanupOnError( + VOID * + ); -#endif /* __FPGASMM_H__ */ \ No newline at end of file +extern EFI_STATUS mFpgaSmmStatus; +extern VOID *mFpgaSmmContext; +extern VOID *mFpgaSmmCleanupToken; + +#endif /* __FPGASMM_H__ */ diff --git a/PurleySktPkg/Smm/PowerManagement/HwpLvtSmm/HwpLvtSmm/HwpLvtSmm.c b/PurleySktPkg/Smm/PowerManagement/HwpLvtSmm/HwpLvtSmm/HwpLvtSmm.c index 8de4ee5..11f26b6 100644 --- a/PurleySktPkg/Smm/PowerManagement/HwpLvtSmm/HwpLvtSmm/HwpLvtSmm.c +++ b/PurleySktPkg/Smm/PowerManagement/HwpLvtSmm/HwpLvtSmm/HwpLvtSmm.c @@ -11,4 +11,4 @@ // Function: ModuleEntryPoint -EFI_STATUS ModuleEntryPoint(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) { __int64 v2; // rax EFI_STATUS v3; // rbx sub_510(ImageHandle, SystemTable); qword_1998 = 0x8000000000000001uLL; if ( !sub_280(&unk_18A0) ) { v2 = sub_A00(); if ( v2 >= 0 || qword_1998 < 0 ) qword_1998 = v2; sub_BB8(&unk_18A0); sub_320(&unk_18A0, -1); sub_CD8( "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\PurleySktPkg\\Smm\\PowerManagement\\HwpLvtSmm\\HwpLvtSmm\\DEBUG\\AutoGen.c", 345, "((BOOLEAN)(0==1))"); sub_CD8( "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\PurleySktPkg\\Smm\\PowerManagement\\HwpLvtSmm\\HwpLvtSmm\\DEBUG\\AutoGen.c", 360, "((BOOLEAN)(0==1))"); } v3 = qword_1998; if ( qword_1998 < 0 ) sub_D8C(); return v3; } +EFI_STATUS ModuleEntryPoint(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) { __int64 statusValue; // rax EFI_STATUS moduleStatus; // rbx HwpLvtSmmInitialize(ImageHandle, SystemTable); moduleStatus = 0x8000000000000001uLL; if ( !HwpLvtSmmSetJump(&mJumpBuffer) ) { statusValue = HwpLvtSmmConfigureLocalVectorTable(); if ( statusValue >= 0 || moduleStatus < 0 ) moduleStatus = statusValue; HwpLvtSmmReleaseContext(&mJumpBuffer); HwpLvtSmmLongJumpRecover(&mJumpBuffer, -1); HwpLvtSmmAssertFalse( "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\PurleySktPkg\\Smm\\PowerManagement\\HwpLvtSmm\\HwpLvtSmm\\DEBUG\\AutoGen.c", 345, "((BOOLEAN)(0==1))"); HwpLvtSmmAssertFalse( "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\PurleySktPkg\\Smm\\PowerManagement\\HwpLvtSmm\\HwpLvtSmm\\DEBUG\\AutoGen.c", 360, "((BOOLEAN)(0==1))"); } statusValue = moduleStatus; if ( moduleStatus < 0 ) HwpLvtSmmHandleFatalError(); return statusValue; } diff --git a/PurleySktPkg/Smm/PowerManagement/HwpLvtSmm/HwpLvtSmm/HwpLvtSmm.h b/PurleySktPkg/Smm/PowerManagement/HwpLvtSmm/HwpLvtSmm/HwpLvtSmm.h index 4cd9909..9a4fe83 100644 --- a/PurleySktPkg/Smm/PowerManagement/HwpLvtSmm/HwpLvtSmm/HwpLvtSmm.h +++ b/PurleySktPkg/Smm/PowerManagement/HwpLvtSmm/HwpLvtSmm/HwpLvtSmm.h @@ -26,66 +26,66 @@ ); /// -/// sub_510 +/// HwpLvtSmmInitialize /// EFI_STATUS EFIAPI -sub_510( +HwpLvtSmmInitialize( VOID ); /// -/// sub_A00 +/// HwpLvtSmmConfigureLocalVectorTable /// EFI_STATUS EFIAPI -sub_A00( +HwpLvtSmmConfigureLocalVectorTable( VOID ); /// -/// sub_BB8 +/// HwpLvtSmmReleaseContext /// EFI_STATUS EFIAPI -sub_BB8( +HwpLvtSmmReleaseContext( VOID ); /// -/// sub_320 +/// HwpLvtSmmLongJumpRecover /// EFI_STATUS EFIAPI -sub_320( +HwpLvtSmmLongJumpRecover( VOID ); /// -/// sub_CD8 +/// HwpLvtSmmAssertFalse /// EFI_STATUS EFIAPI -sub_CD8( +HwpLvtSmmAssertFalse( VOID ); /// -/// sub_280 +/// HwpLvtSmmSetJump /// EFI_STATUS EFIAPI -sub_280( +HwpLvtSmmSetJump( VOID ); /// -/// sub_D8C +/// HwpLvtSmmHandleFatalError /// EFI_STATUS EFIAPI -sub_D8C( +HwpLvtSmmHandleFatalError( VOID ); -#endif /* __HWPLVTSMM_H__ */ \ No newline at end of file +#endif /* __HWPLVTSMM_H__ */ diff --git a/PurleySktPkg/Smm/Ras/QuiesceSupport/QuiesceSupport/QuiesceSupport.c b/PurleySktPkg/Smm/Ras/QuiesceSupport/QuiesceSupport/QuiesceSupport.c index 07bceae..c39bc32 100644 --- a/PurleySktPkg/Smm/Ras/QuiesceSupport/QuiesceSupport/QuiesceSupport.c +++ b/PurleySktPkg/Smm/Ras/QuiesceSupport/QuiesceSupport/QuiesceSupport.c @@ -9,6 +9,67 @@ #include "QuiesceSupport.h" +EFI_STATUS mQuiesceSupportStatus; +VOID *mQuiesceSupportContext; -// Function: ModuleEntryPoint -EFI_STATUS ModuleEntryPoint(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) { __int64 v3; // rcx __int64 v4; // rax EFI_STATUS v5; // rbx sub_634(ImageHandle); qword_3F08 = 0x8000000000000001uLL; if ( !sub_330(&unk_3E10) ) { v4 = sub_9D4(v3, SystemTable); if ( v4 >= 0 || qword_3F08 < 0 ) qword_3F08 = v4; sub_1D0C(&unk_3E10); sub_440(&unk_3E10, -1); sub_1CCC( "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\PurleySktPkg\\Smm\\Ras\\QuiesceSupport\\QuiesceSupport\\DEBUG\\AutoGen.c", 589, "((BOOLEAN)(0==1))"); sub_1CCC( "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\PurleySktPkg\\Smm\\Ras\\QuiesceSupport\\QuiesceSupport\\DEBUG\\AutoGen.c", 604, "((BOOLEAN)(0==1))"); } v5 = qword_3F08; if ( qword_3F08 < 0 ) sub_1DC8(); return v5; } +EFI_STATUS +EFIAPI +QuiesceSupportInitializeDriverContext(EFI_HANDLE ImageHandle); + +EFI_STATUS +EFIAPI +QuiesceSupportInstallQuiesceServices(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable); + +VOID +EFIAPI +QuiesceSupportTearDownDriverContext(VOID *Context); + +VOID +EFIAPI +QuiesceSupportReleaseDriverContext(VOID *Context, INT64 Slot); + +VOID +EFIAPI +QuiesceSupportAutoGenAssert(CHAR8 *FileName, INT32 Line, CHAR8 *Expression); + +BOOLEAN +EFIAPI +QuiesceSupportNeedsInitialization(VOID *Context); + +VOID +EFIAPI +QuiesceSupportCleanupOnFailure(VOID); + +EFI_STATUS +EFIAPI +ModuleEntryPoint(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) +{ + EFI_STATUS Status; + + QuiesceSupportInitializeDriverContext(ImageHandle); + mQuiesceSupportStatus = 0x8000000000000001uLL; + + if (!QuiesceSupportNeedsInitialization(&mQuiesceSupportContext)) { + Status = QuiesceSupportInstallQuiesceServices(ImageHandle, SystemTable); + if (Status >= 0 || mQuiesceSupportStatus < 0) { + mQuiesceSupportStatus = Status; + } + + QuiesceSupportTearDownDriverContext(&mQuiesceSupportContext); + QuiesceSupportReleaseDriverContext(&mQuiesceSupportContext, -1); + QuiesceSupportAutoGenAssert( + "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\PurleySktPkg\\Smm\\Ras\\QuiesceSupport\\QuiesceSupport\\DEBUG\\AutoGen.c", + 589, + "((BOOLEAN)(0==1))"); + QuiesceSupportAutoGenAssert( + "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\PurleySktPkg\\Smm\\Ras\\QuiesceSupport\\QuiesceSupport\\DEBUG\\AutoGen.c", + 604, + "((BOOLEAN)(0==1))"); + } + + if (mQuiesceSupportStatus < 0) { + QuiesceSupportCleanupOnFailure(); + } + + return mQuiesceSupportStatus; +} diff --git a/PurleySktPkg/Smm/Ras/QuiesceSupport/QuiesceSupport/QuiesceSupport.h b/PurleySktPkg/Smm/Ras/QuiesceSupport/QuiesceSupport/QuiesceSupport.h index 04a6399..256b711 100644 --- a/PurleySktPkg/Smm/Ras/QuiesceSupport/QuiesceSupport/QuiesceSupport.h +++ b/PurleySktPkg/Smm/Ras/QuiesceSupport/QuiesceSupport/QuiesceSupport.h @@ -17,75 +17,90 @@ // /// -/// ModuleEntryPoint -- UEFI entry point / initialization function +/// UEFI entry point / initialization function /// EFI_STATUS EFIAPI ModuleEntryPoint( - VOID + EFI_HANDLE ImageHandle, + EFI_SYSTEM_TABLE *SystemTable ); /// -/// sub_634 +/// QuiesceSupportInitializeDriverContext +/// - initializes the module-local driver context /// EFI_STATUS EFIAPI -sub_634( - VOID +QuiesceSupportInitializeDriverContext( + EFI_HANDLE ImageHandle ); /// -/// sub_9D4 +/// QuiesceSupportInstallQuiesceServices +/// - installs the quiesce support services for the SMM driver /// EFI_STATUS EFIAPI -sub_9D4( - VOID +QuiesceSupportInstallQuiesceServices( + EFI_HANDLE ImageHandle, + EFI_SYSTEM_TABLE *SystemTable ); /// -/// sub_1D0C +/// QuiesceSupportTearDownDriverContext +/// - cleanup helper for the module context /// -EFI_STATUS +VOID EFIAPI -sub_1D0C( - VOID +QuiesceSupportTearDownDriverContext( + VOID *Context ); /// -/// sub_440 +/// QuiesceSupportReleaseDriverContext +/// - releases the indexed context slot /// -EFI_STATUS +VOID EFIAPI -sub_440( - VOID +QuiesceSupportReleaseDriverContext( + VOID *Context, + INT64 Slot ); /// -/// sub_1CCC +/// QuiesceSupportAutoGenAssert +/// - AutoGen assertion helper /// -EFI_STATUS +VOID EFIAPI -sub_1CCC( - VOID +QuiesceSupportAutoGenAssert( + CHAR8 *FileName, + INT32 Line, + CHAR8 *Expression ); /// -/// sub_330 +/// QuiesceSupportNeedsInitialization +/// - gate for the initialization path /// -EFI_STATUS +BOOLEAN EFIAPI -sub_330( - VOID +QuiesceSupportNeedsInitialization( + VOID *Context ); /// -/// sub_1DC8 +/// QuiesceSupportCleanupOnFailure +/// - failure path cleanup helper /// -EFI_STATUS +VOID EFIAPI -sub_1DC8( +QuiesceSupportCleanupOnFailure( VOID ); -#endif /* __QUIESCESUPPORT_H__ */ \ No newline at end of file +extern EFI_STATUS mQuiesceSupportStatus; +extern VOID *mQuiesceSupportContext; + +#endif /* __QUIESCESUPPORT_H__ */ diff --git a/PurleySktPkg/Smm/Ras/SmbusRecovery/SmbusRecovery/SmbusRecovery.c b/PurleySktPkg/Smm/Ras/SmbusRecovery/SmbusRecovery/SmbusRecovery.c index 2c65596..14e7eeb 100644 --- a/PurleySktPkg/Smm/Ras/SmbusRecovery/SmbusRecovery/SmbusRecovery.c +++ b/PurleySktPkg/Smm/Ras/SmbusRecovery/SmbusRecovery/SmbusRecovery.c @@ -9,6 +9,42 @@ #include "SmbusRecovery.h" +STATIC VOID *mSmbusRecoveryContext; +STATIC EFI_STATUS mSmbusRecoveryStatus; // Function: ModuleEntryPoint -EFI_STATUS ModuleEntryPoint(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) { __int64 v2; // rax EFI_STATUS v3; // rbx sub_560(ImageHandle, SystemTable); qword_30B8 = 0x8000000000000001uLL; if ( !sub_280(&unk_2FC0) ) { v2 = sub_84C(); if ( v2 >= 0 || qword_30B8 < 0 ) qword_30B8 = v2; sub_1A7C(&unk_2FC0); sub_320(&unk_2FC0, -1); sub_1B9C( "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\PurleySktPkg\\Smm\\Ras\\SmbusRecovery\\SmbusRecovery\\DEBUG\\AutoGen.c", 425, "((BOOLEAN)(0==1))"); sub_1B9C( "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\PurleySktPkg\\Smm\\Ras\\SmbusRecovery\\SmbusRecovery\\DEBUG\\AutoGen.c", 440, "((BOOLEAN)(0==1))"); } v3 = qword_30B8; if ( qword_30B8 < 0 ) sub_1C50(); return v3; } +EFI_STATUS +ModuleEntryPoint( + EFI_HANDLE ImageHandle, + EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS MainStatus; + EFI_STATUS ReturnStatus; + + SmbusRecoveryInitialize(ImageHandle, SystemTable); + mSmbusRecoveryStatus = 0x8000000000000001uLL; + if ( !SmmLibraryInitialized(&mSmbusRecoveryContext) ) { + MainStatus = SmbusRecoveryMain(); + if ( MainStatus >= 0 || mSmbusRecoveryStatus < 0 ) { + mSmbusRecoveryStatus = MainStatus; + } + SmbusRecoveryDestroy(&mSmbusRecoveryContext); + SmbusRecoveryUnregisterProtocols(&mSmbusRecoveryContext, -1); + SmmDebugAssert( + "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\PurleySktPkg\\Smm\\Ras\\SmbusRecovery\\SmbusRecovery\\DEBUG\\AutoGen.c", + 425, + "((BOOLEAN)(0==1))" + ); + SmmDebugAssert( + "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\PurleySktPkg\\Smm\\Ras\\SmbusRecovery\\SmbusRecovery\\DEBUG\\AutoGen.c", + 440, + "((BOOLEAN)(0==1))" + ); + } + ReturnStatus = mSmbusRecoveryStatus; + if ( mSmbusRecoveryStatus < 0 ) { + SmmLibraryShutdown(); + } + return ReturnStatus; +} diff --git a/PurleySktPkg/Smm/Ras/SmbusRecovery/SmbusRecovery/SmbusRecovery.h b/PurleySktPkg/Smm/Ras/SmbusRecovery/SmbusRecovery/SmbusRecovery.h index cd789ad..6b0c982 100644 --- a/PurleySktPkg/Smm/Ras/SmbusRecovery/SmbusRecovery/SmbusRecovery.h +++ b/PurleySktPkg/Smm/Ras/SmbusRecovery/SmbusRecovery/SmbusRecovery.h @@ -26,66 +26,70 @@ ); /// -/// sub_560 +/// SmbusRecoveryInitialize /// EFI_STATUS EFIAPI -sub_560( +SmbusRecoveryInitialize( + EFI_HANDLE ImageHandle, + EFI_SYSTEM_TABLE *SystemTable +); + +/// +/// SmbusRecoveryMain +/// +EFI_STATUS +EFIAPI +SmbusRecoveryMain( VOID ); /// -/// sub_84C +/// SmbusRecoveryDestroy /// EFI_STATUS EFIAPI -sub_84C( - VOID +SmbusRecoveryDestroy( + VOID *SmbusRecoveryContext ); /// -/// sub_1A7C +/// SmbusRecoveryUnregisterProtocols /// EFI_STATUS EFIAPI -sub_1A7C( - VOID +SmbusRecoveryUnregisterProtocols( + VOID *SmbusRecoveryContext, + INTN DispatchIndex ); /// -/// sub_320 +/// SmmDebugAssert /// EFI_STATUS EFIAPI -sub_320( - VOID +SmmDebugAssert( + CONST CHAR8 *FileName, + UINTN LineNumber, + CONST CHAR8 *Expression ); /// -/// sub_1B9C +/// SmmLibraryInitialized /// EFI_STATUS EFIAPI -sub_1B9C( - VOID +SmmLibraryInitialized( + VOID *SmbusRecoveryContext ); /// -/// sub_280 +/// SmmLibraryShutdown /// EFI_STATUS EFIAPI -sub_280( +SmmLibraryShutdown( VOID ); -/// -/// sub_1C50 -/// -EFI_STATUS -EFIAPI -sub_1C50( - VOID -); - -#endif /* __SMBUSRECOVERY_H__ */ \ No newline at end of file +#endif /* __SMBUSRECOVERY_H__ */ diff --git a/PurleySktPkg/Smm/SoftSkuSmm/SoftSkuSmm/SoftSkuSmm.c b/PurleySktPkg/Smm/SoftSkuSmm/SoftSkuSmm/SoftSkuSmm.c index 2062e0b..7ea77d2 100644 --- a/PurleySktPkg/Smm/SoftSkuSmm/SoftSkuSmm/SoftSkuSmm.c +++ b/PurleySktPkg/Smm/SoftSkuSmm/SoftSkuSmm/SoftSkuSmm.c @@ -11,4 +11,4 @@ // Function: ModuleEntryPoint -EFI_STATUS ModuleEntryPoint(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) { __int64 v2; // rax EFI_STATUS v3; // rbx sub_590(ImageHandle, SystemTable); qword_1E98 = 0x8000000000000001uLL; if ( !sub_350(&unk_1DA0) ) { v2 = sub_B4C(); if ( v2 >= 0 || qword_1E98 < 0 ) qword_1E98 = v2; sub_E9C(&unk_1DA0); sub_400(&unk_1DA0, -1); sub_DD0( "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\PurleySktPkg\\Smm\\SoftSkuSmm\\SoftSkuSmm\\DEBUG\\AutoGen.c", 533, "((BOOLEAN)(0==1))"); sub_DD0( "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\PurleySktPkg\\Smm\\SoftSkuSmm\\SoftSkuSmm\\DEBUG\\AutoGen.c", 548, "((BOOLEAN)(0==1))"); } v3 = qword_1E98; if ( qword_1E98 < 0 ) sub_F58(); return v3; } +EFI_STATUS ModuleEntryPoint(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) { __int64 InitializationStatus; // rax EFI_STATUS ReturnStatus; // rbx SoftSkuSmmInitializeEnvironment(ImageHandle, SystemTable); mInitializationStatus = 0x8000000000000001uLL; if ( !SoftSkuSmmIsInitializationComplete(&mSetjmpBuffer) ) { InitializationStatus = SoftSkuSmmRunInitialization(); if ( InitializationStatus >= 0 || mInitializationStatus < 0 ) mInitializationStatus = InitializationStatus; SoftSkuSmmReleaseInitializationLock(&mSetjmpBuffer); SoftSkuSmmRestoreInitializationLock(&mSetjmpBuffer, -1); SoftSkuSmmTraceAssertion( "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\PurleySktPkg\\Smm\\SoftSkuSmm\\SoftSkuSmm\\DEBUG\\AutoGen.c", 533, "((BOOLEAN)(0==1))"); SoftSkuSmmTraceAssertion( "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\PurleySktPkg\\Smm\\SoftSkuSmm\\SoftSkuSmm\\DEBUG\\AutoGen.c", 548, "((BOOLEAN)(0==1))"); } ReturnStatus = mInitializationStatus; if ( mInitializationStatus < 0 ) SoftSkuSmmCleanupOnFailure(); return ReturnStatus; } diff --git a/PurleySktPkg/Smm/SoftSkuSmm/SoftSkuSmm/SoftSkuSmm.h b/PurleySktPkg/Smm/SoftSkuSmm/SoftSkuSmm/SoftSkuSmm.h index ac5a5eb..575b36a 100644 --- a/PurleySktPkg/Smm/SoftSkuSmm/SoftSkuSmm/SoftSkuSmm.h +++ b/PurleySktPkg/Smm/SoftSkuSmm/SoftSkuSmm/SoftSkuSmm.h @@ -26,66 +26,66 @@ ); /// -/// sub_590 +/// SoftSkuSmmInitializeEnvironment /// EFI_STATUS EFIAPI -sub_590( +SoftSkuSmmInitializeEnvironment( VOID ); /// -/// sub_B4C +/// SoftSkuSmmRunInitialization /// EFI_STATUS EFIAPI -sub_B4C( +SoftSkuSmmRunInitialization( VOID ); /// -/// sub_E9C +/// SoftSkuSmmReleaseInitializationLock /// EFI_STATUS EFIAPI -sub_E9C( +SoftSkuSmmReleaseInitializationLock( VOID ); /// -/// sub_400 +/// SoftSkuSmmRestoreInitializationLock /// EFI_STATUS EFIAPI -sub_400( +SoftSkuSmmRestoreInitializationLock( VOID ); /// -/// sub_DD0 +/// SoftSkuSmmTraceAssertion /// EFI_STATUS EFIAPI -sub_DD0( +SoftSkuSmmTraceAssertion( VOID ); /// -/// sub_350 +/// SoftSkuSmmIsInitializationComplete /// EFI_STATUS EFIAPI -sub_350( +SoftSkuSmmIsInitializationComplete( VOID ); /// -/// sub_F58 +/// SoftSkuSmmCleanupOnFailure /// EFI_STATUS EFIAPI -sub_F58( +SoftSkuSmmCleanupOnFailure( VOID ); -#endif /* __SOFTSKUSMM_H__ */ \ No newline at end of file +#endif /* __SOFTSKUSMM_H__ */ diff --git a/PurleySktPkg/SouthClusterLbg/PchInit/Smm/PchInitSmm/PchInitSmm.c b/PurleySktPkg/SouthClusterLbg/PchInit/Smm/PchInitSmm/PchInitSmm.c index 8ad94d5..6f292d6 100644 --- a/PurleySktPkg/SouthClusterLbg/PchInit/Smm/PchInitSmm/PchInitSmm.c +++ b/PurleySktPkg/SouthClusterLbg/PchInit/Smm/PchInitSmm/PchInitSmm.c @@ -10,9 +10,9 @@ #include "PchInitSmm.h" -// Function: ModuleEntryPoint +// Function: PchInitSmmEntryPoint EFI_STATUS -ModuleEntryPoint( +PchInitSmmEntryPoint( EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable ) @@ -20,26 +20,26 @@ __int64 v3; EFI_STATUS v4; - sub_5A8(ImageHandle, SystemTable); + PchInitSmmInitialize(ImageHandle, SystemTable); qword_A0C8 = 0x8000000000000001uLL; - if ( !sub_330(&unk_9FD0) ) + if ( !PchInitSmmIsProtocolInstalled(&unk_9FD0) ) { - v3 = sub_101C(ImageHandle); + v3 = PchInitSmmRegisterHandlers(ImageHandle); if ( v3 >= 0 || qword_A0C8 < 0 ) qword_A0C8 = v3; - sub_329C(&unk_9FD0); - sub_3D0(&unk_9FD0, -1); - sub_33BC( + PchInitSmmInstallProtocol(&unk_9FD0); + PchInitSmmUninstallProtocol(&unk_9FD0, -1); + PchInitSmmDebugAssert( "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\PurleySktPkg\\SouthClusterLbg\\PchInit\\Smm\\PchInitSmm\\DEBUG\\AutoGen.c", 549, "((BOOLEAN)(0==1))"); - sub_33BC( + PchInitSmmDebugAssert( "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\PurleySktPkg\\SouthClusterLbg\\PchInit\\Smm\\PchInitSmm\\DEBUG\\AutoGen.c", 564, "((BOOLEAN)(0==1))"); } v4 = qword_A0C8; if ( qword_A0C8 < 0 ) - sub_AD0(); + PchInitSmmCleanup(); return v4; } diff --git a/PurleySktPkg/SouthClusterLbg/PchInit/Smm/PchInitSmm/PchInitSmm.h b/PurleySktPkg/SouthClusterLbg/PchInit/Smm/PchInitSmm/PchInitSmm.h index d117f8d..5a1e135 100644 --- a/PurleySktPkg/SouthClusterLbg/PchInit/Smm/PchInitSmm/PchInitSmm.h +++ b/PurleySktPkg/SouthClusterLbg/PchInit/Smm/PchInitSmm/PchInitSmm.h @@ -26,66 +26,66 @@ ); /// -/// sub_5A8 +/// PchInitSmmInitialize /// EFI_STATUS EFIAPI -sub_5A8( +PchInitSmmInitialize( VOID ); /// -/// sub_101C +/// PchInitSmmRegisterHandlers /// EFI_STATUS EFIAPI -sub_101C( +PchInitSmmRegisterHandlers( VOID ); /// -/// sub_329C +/// PchInitSmmInstallProtocol /// EFI_STATUS EFIAPI -sub_329C( +PchInitSmmInstallProtocol( VOID ); /// -/// sub_3D0 +/// PchInitSmmUninstallProtocol /// EFI_STATUS EFIAPI -sub_3D0( +PchInitSmmUninstallProtocol( VOID ); /// -/// sub_33BC +/// PchInitSmmDebugAssert /// EFI_STATUS EFIAPI -sub_33BC( +PchInitSmmDebugAssert( VOID ); /// -/// sub_330 +/// PchInitSmmIsProtocolInstalled /// EFI_STATUS EFIAPI -sub_330( +PchInitSmmIsProtocolInstalled( VOID ); /// -/// sub_AD0 +/// PchInitSmmCleanup /// EFI_STATUS EFIAPI -sub_AD0( +PchInitSmmCleanup( VOID ); -#endif /* __PCHINITSMM_H__ */ \ No newline at end of file +#endif /* __PCHINITSMM_H__ */ diff --git a/PurleySktPkg/SouthClusterLbg/PchSmiDispatcher/Smm/PchSmiDispatcher/PchSmiDispatcher.c b/PurleySktPkg/SouthClusterLbg/PchSmiDispatcher/Smm/PchSmiDispatcher/PchSmiDispatcher.c index 64fd9dc..21cd523 100644 --- a/PurleySktPkg/SouthClusterLbg/PchSmiDispatcher/Smm/PchSmiDispatcher/PchSmiDispatcher.c +++ b/PurleySktPkg/SouthClusterLbg/PchSmiDispatcher/Smm/PchSmiDispatcher/PchSmiDispatcher.c @@ -10,5 +10,5 @@ #include "PchSmiDispatcher.h" -// Function: ModuleEntryPoint -EFI_STATUS ModuleEntryPoint(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) { __int64 v3; // rax EFI_STATUS v4; // rbx sub_5B8(ImageHandle, SystemTable); qword_E078 = 0x8000000000000001uLL; if ( !sub_390(&unk_DF80) ) { v3 = sub_BB8(ImageHandle); if ( v3 >= 0 || qword_E078 < 0 ) qword_E078 = v3; sub_75A8(&unk_DF80); sub_450(&unk_DF80, -1); sub_76C8( "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\PurleySktPkg\\SouthClusterLbg\\PchSmiDispatcher\\Smm\\PchSmiDispatche" "r\\DEBUG\\AutoGen.c", 575, "((BOOLEAN)(0==1))"); sub_76C8( "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\PurleySktPkg\\SouthClusterLbg\\PchSmiDispatcher\\Smm\\PchSmiDispatche" "r\\DEBUG\\AutoGen.c", 590, "((BOOLEAN)(0==1))"); } v4 = qword_E078; if ( qword_E078 < 0 ) sub_AE8(); return v4; } +// Function: PchSmiDispatcherEntryPoint +EFI_STATUS PchSmiDispatcherEntryPoint(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) { __int64 v3; // rax EFI_STATUS v4; // rbx PchSmiDispatcherInitialize(ImageHandle, SystemTable); qword_E078 = 0x8000000000000001uLL; if ( !PchSmiDispatcherIsProtocolInstalled(&unk_DF80) ) { v3 = PchSmiDispatcherRegisterHandlers(ImageHandle); if ( v3 >= 0 || qword_E078 < 0 ) qword_E078 = v3; PchSmiDispatcherInstallProtocol(&unk_DF80); PchSmiDispatcherUninstallProtocol(&unk_DF80, -1); PchSmiDispatcherDebugAssert( "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\PurleySktPkg\\SouthClusterLbg\\PchSmiDispatcher\\Smm\\PchSmiDispatche" "r\\DEBUG\\AutoGen.c", 575, "((BOOLEAN)(0==1))"); PchSmiDispatcherDebugAssert( "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\PurleySktPkg\\SouthClusterLbg\\PchSmiDispatcher\\Smm\\PchSmiDispatche" "r\\DEBUG\\AutoGen.c", 590, "((BOOLEAN)(0==1))"); } v4 = qword_E078; if ( qword_E078 < 0 ) PchSmiDispatcherCleanup(); return v4; } diff --git a/PurleySktPkg/SouthClusterLbg/PchSmiDispatcher/Smm/PchSmiDispatcher/PchSmiDispatcher.h b/PurleySktPkg/SouthClusterLbg/PchSmiDispatcher/Smm/PchSmiDispatcher/PchSmiDispatcher.h index 5c59d0b..73fa3e8 100644 --- a/PurleySktPkg/SouthClusterLbg/PchSmiDispatcher/Smm/PchSmiDispatcher/PchSmiDispatcher.h +++ b/PurleySktPkg/SouthClusterLbg/PchSmiDispatcher/Smm/PchSmiDispatcher/PchSmiDispatcher.h @@ -26,66 +26,66 @@ ); /// -/// sub_5B8 +/// PchSmiDispatcherInitialize /// EFI_STATUS EFIAPI -sub_5B8( +PchSmiDispatcherInitialize( VOID ); /// -/// sub_BB8 +/// PchSmiDispatcherRegisterHandlers /// EFI_STATUS EFIAPI -sub_BB8( +PchSmiDispatcherRegisterHandlers( VOID ); /// -/// sub_75A8 +/// PchSmiDispatcherInstallProtocol /// EFI_STATUS EFIAPI -sub_75A8( +PchSmiDispatcherInstallProtocol( VOID ); /// -/// sub_450 +/// PchSmiDispatcherUninstallProtocol /// EFI_STATUS EFIAPI -sub_450( +PchSmiDispatcherUninstallProtocol( VOID ); /// -/// sub_76C8 +/// PchSmiDispatcherDebugAssert /// EFI_STATUS EFIAPI -sub_76C8( +PchSmiDispatcherDebugAssert( VOID ); /// -/// sub_390 +/// PchSmiDispatcherIsProtocolInstalled /// EFI_STATUS EFIAPI -sub_390( +PchSmiDispatcherIsProtocolInstalled( VOID ); /// -/// sub_AE8 +/// PchSmiDispatcherCleanup /// EFI_STATUS EFIAPI -sub_AE8( +PchSmiDispatcherCleanup( VOID ); -#endif /* __PCHSMIDISPATCHER_H__ */ \ No newline at end of file +#endif /* __PCHSMIDISPATCHER_H__ */ diff --git a/PurleySktPkg/SouthClusterLbg/SiInit/Pei/SiInit/SiInit.c b/PurleySktPkg/SouthClusterLbg/SiInit/Pei/SiInit/SiInit.c index 2cf0c1d..d4e405c 100644 --- a/PurleySktPkg/SouthClusterLbg/SiInit/Pei/SiInit/SiInit.c +++ b/PurleySktPkg/SouthClusterLbg/SiInit/Pei/SiInit/SiInit.c @@ -107,7 +107,7 @@ // Function: SiInitDispatchEndOfPei @ 0xffd6d161 (0x23 bytes) -int __usercall SiInitOnEndOfPei_0@(int a1@, int a2@) +int __usercall SiInitDispatchEndOfPei@(int a1@, int a2@) { DebugPrintAssert(64, "SiInitOnEndOfPei - Start\n"); /*0xffd6d168*/ PchOnEndOfPei(a1, a2); /*0xffd6d16d*/ @@ -1458,9 +1458,9 @@ } -// Function: AssertCpuDeadLoop_4 @ 0xffd6eb9d (0x88 bytes) +// Function: PchInterruptAssignSbiExec @ 0xffd6eb9d (0x88 bytes) -int __fastcall sub_FFD6EB9D(unsigned __int8 a1) +int __fastcall PchInterruptAssignSbiExec(unsigned __int8 a1) { int v1; // eax int v2; // eax @@ -1951,9 +1951,9 @@ } -// Function: Assert_4 @ 0xffd6fc17 (0xec bytes) +// Function: PchPcieLinkHasSlotDetect @ 0xffd6fc17 (0xec bytes) -bool __fastcall sub_FFD6FC17(int PadConfig, unsigned __int8 a2, unsigned __int16 *a3) +bool __fastcall PchPcieLinkHasSlotDetect(int PadConfig, unsigned __int8 a2, unsigned __int16 *a3) { char v5; // bl int v7; // ebp @@ -2795,9 +2795,9 @@ } -// Function: Assert_5 @ 0xffd70a61 (0xd9 bytes) +// Function: PchInterruptAssignInit @ 0xffd70a61 (0xd9 bytes) -int sub_FFD70A61() +int PchInterruptAssignInit() { int result; // eax @@ -4117,9 +4117,9 @@ } -// Function: AssertCpuDeadLoop_1 @ 0xffd7201b (0x140 bytes) +// Function: GpioSbiExecPadWrite @ 0xffd7201b (0x140 bytes) -int __thiscall sub_FFD7201B(char *n4, unsigned __int8 a2, int a3, int a4) +int __thiscall GpioSbiExecPadWrite(char *n4, unsigned __int8 a2, int a3, int a4) { unsigned int v5; // ebx int v6; // edx @@ -4294,9 +4294,9 @@ } -// Function: DebugLogPrint_11 @ 0xffd7237c (0xc8 bytes) +// Function: GpioGetPadConfigCached @ 0xffd7237c (0xc8 bytes) -int __fastcall sub_FFD7237C(int a1, unsigned int *a2) +int __fastcall GpioGetPadConfigCached(int a1, unsigned int *a2) { unsigned int v3; // esi unsigned int v4; // edi @@ -4551,9 +4551,9 @@ } -// Function: DebugLogPrint_5 @ 0xffd72731 (0x103 bytes) +// Function: GpioSetPadMode @ 0xffd72731 (0x103 bytes) -int __fastcall sub_FFD72731(int a1, char a2) +int __fastcall GpioSetPadMode(int a1, char a2) { int v4; // eax _DWORD *v6; // edx @@ -4602,9 +4602,9 @@ } -// Function: DebugLogPrint_9 @ 0xffd72834 (0xcc bytes) +// Function: GpioGetPadMode @ 0xffd72834 (0xcc bytes) -int __fastcall sub_FFD72834(int a1, unsigned int *a2) +int __fastcall GpioGetPadMode(int a1, unsigned int *a2) { int v3; // ebp int v4; // eax @@ -4868,9 +4868,9 @@ } -// Function: DebugLogPrint_21 @ 0xffd72ca7 (0x40 bytes) +// Function: PchInterruptConfigEntryMasked @ 0xffd72ca7 (0x40 bytes) -int __fastcall sub_FFD72CA7(int n196, __int16 n12796, __int16 n65023, __int16 n512) +int __fastcall PchInterruptConfigEntryMasked(int n196, __int16 n12796, __int16 n65023, __int16 n512) { int result; // eax int v7; // [esp+Ch] [ebp-4h] BYREF @@ -5171,9 +5171,9 @@ } -// Function: DebugLogPrint_15 @ 0xffd731ae (0x9b bytes) +// Function: PchAcpiBaseGet @ 0xffd731ae (0x9b bytes) -int __thiscall sub_FFD731AE(_WORD *this) +int __thiscall PchAcpiBaseGet(_WORD *this) { int v2; // eax unsigned __int16 *PadConfig; // edi @@ -5573,7 +5573,7 @@ // Function: SmmGetInfo @ 0xffd7363e (0x4d bytes) -bool sub_FFD7363E() +bool SmmGetInfo() { int v0; // eax unsigned int v2; // [esp+4h] [ebp-4h] BYREF @@ -5699,15 +5699,15 @@ char v0; // bl v0 = 0; /*0xffd737f9*/ - if ( (unsigned __int8)sub_FFD737EA() ) /*0xffd737fb*/ + if ( (unsigned __int8)IsSpsMe() ) /*0xffd737fb*/ return (*(_DWORD *)(GpioGetPadConfig(0, 22, 0) + 64) & 0xF) == 2; /*0xffd73819*/ return v0; /*0xffd7381d*/ } -// Function: DebugLogPrint_16 @ 0xffd7381f (0x95 bytes) +// Function: PchPcieRpDevFun @ 0xffd7381f (0x95 bytes) -int __fastcall sub_FFD7381F(unsigned int a1, _DWORD *a2, unsigned int *a3) +int __fastcall PchPcieRpDevFun(unsigned int a1, _DWORD *a2, unsigned int *a3) { int v5; // eax unsigned int v7; // ecx @@ -6006,9 +6006,9 @@ } -// Function: DebugLogPrint_4 @ 0xffd73d0a (0x11e bytes) +// Function: PchMeGetCurrentClockingMode @ 0xffd73d0a (0x11e bytes) -int __thiscall sub_FFD73D0A(int *p_n2988) +int __thiscall PchMeGetCurrentClockingMode(int *p_n2988) { int v2; // esi int BootMode; // ebx @@ -6027,7 +6027,7 @@ if ( p_n2988 ) { (*(void (__cdecl **)(int *, int, _DWORD))(*(_DWORD *)BootMode + 84))(&v11, 48, 0); /*0xffd73d43*/ - if ( !(unsigned __int8)sub_FFD737EA() || (unsigned __int8)SmBusIsV2Controller() ) + if ( !(unsigned __int8)IsSpsMe() || (unsigned __int8)SmBusIsV2Controller() ) { DebugPrintAssert(64, "[ME] PeiGetCurrenClockingMode: Non SPS ME detected\n"); v2 = -2147483642; /*0xffd73d82*/ @@ -6105,7 +6105,7 @@ v3 = -2147483646; /*0xffd73e3a*/ DebugPrintAssert(64, "[ICC] SpsSetGetCurrenClockingMode\n"); /*0xffd73e3f*/ - if ( !(unsigned __int8)sub_FFD737EA() || SmBusIsV2Controller() ) + if ( !(unsigned __int8)IsSpsMe() || SmBusIsV2Controller() ) { v3 = -2147483645; /*0xffd73eef*/ } @@ -6146,7 +6146,7 @@ // Function: DebugLogPrint_20 @ 0xffd73f0d (0x17e bytes) -int __fastcall sub_FFD73F0D(unsigned int n0x19, _BYTE *a2, _BYTE *a3) +int __fastcall PchMeGetIccField(unsigned int n0x19, _BYTE *a2, _BYTE *a3) { unsigned int v3; // ebx int v6; // eax @@ -6321,7 +6321,7 @@ // Function: Assert_9 @ 0xffd7410c (0x93 bytes) -int __cdecl sub_FFD7410C(unsigned int n10) +int __cdecl WdtReloadAndStartTimer(unsigned int n10) { unsigned __int16 v1; // ax unsigned __int32 v2; // eax @@ -6350,7 +6350,7 @@ // Function: Assert_21 @ 0xffd7419f (0x32 bytes) -unsigned int sub_FFD7419F() +unsigned int WdtDisableTimer() { unsigned __int16 v0; // ax unsigned int v1; // esi @@ -6426,7 +6426,7 @@ // Function: Assert_16 @ 0xffd742b2 (0x4f bytes) -int __fastcall sub_FFD742B2(unsigned __int8 a1) +int __fastcall WdtWriteSmiControl(unsigned __int8 a1) { int v2; // edi unsigned int v3; // esi @@ -6444,7 +6444,7 @@ // Function: Assert_7 @ 0xffd74301 (0x9e bytes) -int sub_FFD74301() +int WdtEndOfPost() { int v0; // edi unsigned int v1; // esi @@ -6469,7 +6469,7 @@ // Function: Assert_15 @ 0xffd7439f (0x50 bytes) -int __cdecl sub_FFD7439F(int a1, int a2, unsigned __int8 *a3, _DWORD *a4, char a5) +int __cdecl WdtService(int a1, int a2, unsigned __int8 *a3, _DWORD *a4, char a5) { int result; // eax unsigned __int8 v6; // bl @@ -6684,7 +6684,7 @@ // Function: GpioGetInfo @ 0xffd74729 (0x7b bytes) -int __fastcall sub_FFD74729(unsigned __int8 a1) +int __fastcall GpioGetInfo(unsigned __int8 a1) { int v1; // ecx int v3; // eax @@ -6713,7 +6713,7 @@ // Function: DebugLogPrint_23 @ 0xffd747a4 (0x20 bytes) -int __fastcall sub_FFD747A4(int n2) +int __fastcall GpioLogPadEntry(int n2) { if ( DebugLogPrint_5(*(_DWORD *)(8 * n2 - 2626448), *(_DWORD *)(8 * n2 - 2626444)) >= 0 ) /*0xffd747b9*/ return 0; /*0xffd747c1*/ @@ -6841,7 +6841,7 @@ // Function: Assert_1 @ 0xffd749a5 (0x1aa bytes) -int __fastcall sub_FFD749A5(int a1, int a2) +int __fastcall SpsPolicyPrint(int a1, int a2) { DebugPrintAssert(64, "SPS Config Revision : %d\n", *(_DWORD *)a2); DebugPrintAssert(64, " SpsAltitude : 0x%x\n", *(unsigned __int16 *)(a2 + 4)); @@ -7127,7 +7127,7 @@ // Function: DebugLogPrint_19 @ 0xffd74f61 (0x58 bytes) -int __thiscall sub_FFD74F61(_DWORD *this) +int __thiscall MePolicyPrint(_DWORD *this) { int v2; // eax @@ -7149,7 +7149,7 @@ // Function: DebugLogPrint_1 @ 0xffd74fb9 (0x1cf bytes) -int __thiscall sub_FFD74FB9(_DWORD *this) +int __thiscall MeConfigPrint(_DWORD *this) { int v2; // eax @@ -7206,7 +7206,7 @@ n2_1 = 1; /*0xffd751c1*/ if ( n3 == 1 ) /*0xffd751c4*/ { - if ( (unsigned __int8)sub_FFD737EA() ) /*0xffd7521c*/ + if ( (unsigned __int8)IsSpsMe() ) /*0xffd7521c*/ { if ( DebugLogPrint_8() == 1 && *(_DWORD *)(GpioGetPadConfig(0, 22, 1) + 64) >= 0x80000000 ) /*0xffd75242*/ return n2_1; /*0xffd75242*/ @@ -7218,7 +7218,7 @@ { if ( n3 <= 3 ) { - if ( !(unsigned __int8)sub_FFD737EA() ) + if ( !(unsigned __int8)IsSpsMe() ) { LABEL_12: if ( !MeConfigIsType255() ) @@ -7231,7 +7231,7 @@ } if ( n3 == 4 ) /*0xffd751d0*/ { - if ( (unsigned __int8)sub_FFD737EA() ) /*0xffd751d2*/ + if ( (unsigned __int8)IsSpsMe() ) /*0xffd751d2*/ return n2_1; /*0xffd751d9*/ goto LABEL_12; /*0xffd751d9*/ } @@ -7239,7 +7239,7 @@ DebugPrintAssert(2, "[ME Policy] WARNING: Auto-configuration passed for unrecognised device %d\n", n3); return 0; /*0xffd7521a*/ } - if ( (unsigned __int8)sub_FFD737EA() ) /*0xffd75249*/ + if ( (unsigned __int8)IsSpsMe() ) /*0xffd75249*/ return 1; /*0xffd751b5*/ if ( !MeConfigIsType255() ) /*0xffd7525d*/ goto LABEL_12; /*0xffd7525d*/ @@ -7249,7 +7249,7 @@ // Function: Assert_30 @ 0xffd75284 (0x4e bytes) -int sub_FFD75284() +int FindSocketConfigIndex() { int v0; // esi char **v1; // eax @@ -7276,7 +7276,7 @@ // Function: NetGetInfo @ 0xffd752d2 (0x66 bytes) -int __fastcall sub_FFD752D2(_DWORD *this, int a2) +int __fastcall NetGetInfo(_DWORD *this, int a2) { int v3; // edi int BootMode; // eax @@ -7337,7 +7337,7 @@ // Function: Assert_14 @ 0xffd753ee (0x63 bytes) -unsigned int sub_FFD753EE(_BYTE *a1, unsigned int n6, __int16 *__, ...) +unsigned int PrintFormatStringWorker(_BYTE *a1, unsigned int n6, __int16 *__, ...) { int v3; // eax int v4; // eax @@ -7491,11 +7491,11 @@ { int v3; // [esp+Ch] [ebp-4h] - v3 = sub_FFD74F00((void *)6); /*0xffd761a2*/ + v3 = GetSiInitBufferState((void *)6); /*0xffd761a2*/ a1[1] = 16 * n8 + 16; /*0xffd761ab*/ if ( !a1[4] && !a1[5] ) /*0xffd761c7*/ { - *(_DWORD *)(v3 + 16) = sub_FFD74EF1((void *)5); /*0xffd761ec*/ + *(_DWORD *)(v3 + 16) = GetSiInitBufferCursor((void *)5); /*0xffd761ec*/ *(_DWORD *)(v3 + 20) = 0; /*0xffd76203*/ } return 0; /*0xffd76209*/ @@ -7517,7 +7517,7 @@ } else { - v2 = sub_FFD74F00((void *)6); /*0xffd76235*/ + v2 = GetSiInitBufferState((void *)6); /*0xffd76235*/ if ( *(_DWORD *)(v2 + 4) ) /*0xffd7623b*/ { v3 = *(_DWORD *)(v2 + 16 * (unsigned __int16)*(_DWORD *)(a1 + 4) + 20); /*0xffd76256*/ @@ -7530,12 +7530,12 @@ v4 = *(_DWORD *)(16 * (unsigned __int16)*(_DWORD *)(a1 + 4) - 2626264); /*0xffd762b3*/ if ( !v4 && !v3 ) /*0xffd762c0*/ { - v4 = sub_FFD74EF1((void *)5); /*0xffd762ed*/ + v4 = GetSiInitBufferCursor((void *)5); /*0xffd762ed*/ v3 = 0; /*0xffd762fa*/ } } } if ( !v4 && !v3 ) /*0xffd76341*/ - return sub_FFD74EF1((void *)5); /*0xffd7636e*/ + return GetSiInitBufferCursor((void *)5); /*0xffd7636e*/ return v4; /*0xffd76387*/ } diff --git a/PurleySktPkg/SouthClusterLbg/SiInit/Pei/SiInit/SiInit.h b/PurleySktPkg/SouthClusterLbg/SiInit/Pei/SiInit/SiInit.h index b7caa53..feb8757 100644 --- a/PurleySktPkg/SouthClusterLbg/SiInit/Pei/SiInit/SiInit.h +++ b/PurleySktPkg/SouthClusterLbg/SiInit/Pei/SiInit/SiInit.h @@ -4,8 +4,11 @@ #include "../uefi_headers/Uefi.h" EFI_STATUS EFIAPI ModuleEntryPoint(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable); -EFI_STATUS EFIAPI SiInitOnEndOfPei_0(int a1, int a2); +EFI_STATUS EFIAPI SiInitDispatchEndOfPei(int a1, int a2); int __thiscall SiInit_Entry(void *this); +bool IsSpsMe(void); +int __fastcall GetSiInitBufferState(void *stateId); +int __fastcall GetSiInitBufferCursor(void *cursorId); int DebugClear(void); int __fastcall DebugPrint(int a1, int a2, int a3, int a4); int __fastcall SiCreateHob(int n3, int n48, int *p_n3); diff --git a/PurleySktPkg/SouthClusterLbg/SiInit/Pei/SiInitPreMem/BaseMemoryStallHelpers.c b/PurleySktPkg/SouthClusterLbg/SiInit/Pei/SiInitPreMem/BaseMemoryStallHelpers.c index 43be382..7f742fc 100644 --- a/PurleySktPkg/SouthClusterLbg/SiInit/Pei/SiInitPreMem/BaseMemoryStallHelpers.c +++ b/PurleySktPkg/SouthClusterLbg/SiInit/Pei/SiInitPreMem/BaseMemoryStallHelpers.c @@ -1,4 +1,19 @@ /* Consolidated from decompiled shard files. */ + +STATIC +UINT32 +EFIAPI +ReadStallTimerCounter ( + VOID + ) +{ + // + // The original decompilation routed this through a raw timer accessor. + // Keep the stall logic local and semantic here. + // + return 0; +} + /* Source: ffd7f6ec.c */ void *__cdecl FillBuffer(void *buf, unsigned int count, char value) { @@ -61,9 +76,9 @@ n0x400000 = a1 & 0x3FFFFF; /*0xffd7fa07*/ do /*0xffd7fa3f*/ { - v3 = n0x400000 + (sub_FFD8CD6B(1288) & 0xFFFFFF); /*0xffd7fa1c*/ + v3 = n0x400000 + (ReadStallTimerCounter () & 0xFFFFFF); /*0xffd7fa1c*/ n0x400000 = 0x400000; /*0xffd7fa1e*/ - while ( ((v3 - sub_FFD8CD6B(1288)) & 0x800000) == 0 ) /*0xffd7fa38*/ + while ( ((v3 - ReadStallTimerCounter ()) & 0x800000) == 0 ) /*0xffd7fa38*/ _mm_pause(); /*0xffd7fa25*/ result = v1--; /*0xffd7fa3a*/ } diff --git a/PurleySktPkg/SouthClusterLbg/SiInit/Pei/SiInitPreMem/EntryDebugPerformanceTraceHub.c b/PurleySktPkg/SouthClusterLbg/SiInit/Pei/SiInitPreMem/EntryDebugPerformanceTraceHub.c index 4c38892..d552aca 100644 --- a/PurleySktPkg/SouthClusterLbg/SiInit/Pei/SiInitPreMem/EntryDebugPerformanceTraceHub.c +++ b/PurleySktPkg/SouthClusterLbg/SiInit/Pei/SiInitPreMem/EntryDebugPerformanceTraceHub.c @@ -11,10 +11,10 @@ int ReportStatus; // eax unsigned __int64 EndTsc; // [esp-Ch] [ebp-10h] - if ( (sub_FFD9165B(1024068) & 0x80u) == 0 ) /*0xffd7f7b0*/ + if ( (GetPreMemDebugFlagByte(1024068) & 0x80u) == 0 ) /*0xffd7f7b0*/ { - sub_FFD9168B(); /*0xffd7f7b2*/ - FlagBase = sub_FFD9164F(); /*0xffd7f7b7*/ + InitializePreMemDebugFlagStorage(); /*0xffd7f7b2*/ + FlagBase = GetPreMemDebugFlagBase(); /*0xffd7f7b7*/ *(_BYTE *)(FlagBase + 1024068) |= 0x80u; /*0xffd7f7c3*/ } DebugPrint(64, (int)"SiInitPrePolicy() Start\n"); /*0xffd7f88f*/ @@ -30,7 +30,7 @@ DebugPrint(64, (int)"PchInitPrePolicy() - End\n"); /*0xffd7f8d9*/ EndTsc = __rdtsc(); /*0xffd7f8e5*/ EndPerformanceMeasurement(PerfEndStatus, EndTsc, HIDWORD(EndTsc)); /*0xffd7f8e7*/ - PeiStatus = sub_FFD8AD54(); /*0xffd7f8ec*/ + PeiStatus = GetPeiServicesTable(); /*0xffd7f8ec*/ NotifyStatus = (*(int (__cdecl **)(int, void *))(*(_DWORD *)PeiStatus + 36))(PeiStatus, &unk_FFD97FEC); /*0xffd7f8f9*/ if ( NotifyStatus < 0 ) /*0xffd7f901*/ { @@ -53,7 +53,7 @@ _BYTE v2[4]; // [esp+0h] [ebp-8h] BYREF int v3; // [esp+4h] [ebp-4h] BYREF - PeiServices = sub_FFD8AD54(); /*0xffd7f983*/ + PeiServices = GetPeiServicesTable(); /*0xffd7f983*/ if ( (*(int (__cdecl **)(int, void *, _DWORD, _BYTE *, int *))(*(_DWORD *)PeiServices + 32))(PeiServices, &unk_FFD97EAC, 0, v2, &v3) >= 0 ) /*0xffd7f9a2*/ return v3; /*0xffd7f9a8*/ else @@ -72,7 +72,7 @@ v3 = (int (__cdecl **)(int, int, char *))result; /*0xffd7f9b5*/ if ( result ) /*0xffd7f9b9*/ { - result = sub_FFD8AD05(); /*0xffd7f9bb*/ + result = GetDebugPrintErrorLevelMask(); /*0xffd7f9bb*/ if ( (result & a1) != 0 ) /*0xffd7f9c6*/ return (*v3)(a1, a2, (char *)va); /*0xffd7f9d2*/ } @@ -120,11 +120,11 @@ 58, "PeiPerformanceIdArray != ((void *) 0)"); } - v6 = sub_FFD8CE7C(&unk_FFD97F9C); /*0xffd7fad8*/ + v6 = GetHobByGuid(&unk_FFD97F9C); /*0xffd7fad8*/ if ( v6 ) /*0xffd7fadf*/ { *a1 = v6 + 24; /*0xffd7fae9*/ - v7 = sub_FFD8CE7C(&unk_FFD97ECC); /*0xffd7faf0*/ + v7 = GetHobByGuid(&unk_FFD97ECC); /*0xffd7faf0*/ if ( !v7 ) /*0xffd7faf4*/ { v8 = GetReportStatusCodePpi(); /*0xffd7faf6*/ @@ -138,12 +138,12 @@ } else { - v10 = sub_FFD8CF46(&unk_FFD97F9C, 40008); /*0xffd7fb1b*/ + v10 = CreateGuidHob(&unk_FFD97F9C, 40008); /*0xffd7fb1b*/ *a1 = v10; /*0xffd7fb22*/ - *a1 = sub_FFD8D4C8(v10, 40008); /*0xffd7fb2b*/ - v11 = sub_FFD8CF46(&unk_FFD97ECC, 4000); /*0xffd7fb39*/ + *a1 = AlignPointerUp(v10, 40008); /*0xffd7fb2b*/ + v11 = CreateGuidHob(&unk_FFD97ECC, 4000); /*0xffd7fb39*/ *a2 = v11; /*0xffd7fb40*/ - result = sub_FFD8D4C8(v11, 4000); /*0xffd7fb44*/ + result = AlignPointerUp(v11, 4000); /*0xffd7fb44*/ } *a2 = result; /*0xffd7fb4a*/ return result; /*0xffd7fb49*/ @@ -170,8 +170,8 @@ if ( !*((_QWORD *)this + 5 * v4 + 5) /*0xffd7fba8*/ && *(_UNKNOWN **)((char *)this + v5 + 8) == &unk_FFD97F8C && *(unsigned int *)((char *)this + v5 + 12) == (*(this + 10 * v4 + 11) | *(this + 10 * v4 + 10)) - && !sub_FFD8D0FF(7) - && !sub_FFD8D0FF(7) ) + && !GetTraceHubPolicyFlag(7) + && !GetTraceHubPolicyFlag(7) ) { break; /*0xffd7fba8*/ } @@ -242,7 +242,7 @@ v2 = __rdtsc(); /*0xffd7fc5f*/ GetPerformanceLogBuffer((int *)&a2 + 1, &v6); /*0xffd7fc67*/ v3 = (unsigned int *)HIDWORD(a2); /*0xffd7fc6c*/ - v4 = sub_FFD7FB51((unsigned int *)HIDWORD(a2)); /*0xffd7fc74*/ + v4 = FindLatestPerformanceEntryIndex((unsigned int *)HIDWORD(a2)); /*0xffd7fc74*/ if ( v4 >= *v3 ) /*0xffd7fc7e*/ return -2147483634; /*0xffd7fc80*/ *(_QWORD *)&v3[10 * v4 + 10] = v2; /*0xffd7fc8b*/ @@ -257,7 +257,7 @@ int v3; // eax int v4; // [esp+4h] [ebp-4h] BYREF - sub_FFD8C2A0(0xEFu, 0x2234u, 4, &v4); /*0xffd7fcb0*/ + PciSegmentRead32(0xEFu, 0x2234u, 4, &v4); /*0xffd7fcb0*/ if ( v4 < 0 ) /*0xffd7fcbf*/ { DebugPrint(0x80000000, (int)"TraceHubBaseSet Error. DMIC.SRL is set.\n"); /*0xffd7fcc7*/ @@ -269,8 +269,8 @@ "((BOOLEAN)(0==1))"); return -2147483645; /*0xffd7fcee*/ } - v2 = sub_FFD8CBBA(0, 31, 7); /*0xffd7fcfd*/ - if ( (unsigned __int16)sub_FFD8CCA5((unsigned __int16 *)v2) == 0xFFFF ) /*0xffd7fd0e*/ + v2 = PciSegmentLibAddress(0, 31, 7); /*0xffd7fcfd*/ + if ( (unsigned __int16)PciSegmentRead16((unsigned __int16 *)v2) == 0xFFFF ) /*0xffd7fd0e*/ { v3 = GetReportStatusCodePpi(); /*0xffd7fd10*/ if ( v3 ) /*0xffd7fd17*/ @@ -282,9 +282,9 @@ } *(_DWORD *)(v2 + 112) = -32768000; /*0xffd7fd2c*/ *(_DWORD *)(v2 + 116) = 0; /*0xffd7fd2f*/ - sub_FFD8C497(4, -32768000); /*0xffd7fd40*/ - sub_FFD8C497(4, 0); /*0xffd7fd50*/ - sub_FFD8C5F6(255, 2); /*0xffd7fd63*/ + PciSegmentWrite32(4, -32768000); /*0xffd7fd40*/ + PciSegmentWrite32(4, 0); /*0xffd7fd50*/ + PciSegmentWrite8(255, 2); /*0xffd7fd63*/ return 0; /*0xffd7fd6d*/ } @@ -296,10 +296,10 @@ unsigned int v4; // [esp+Ch] [ebp-4h] BYREF DebugPrint(64, (int)"TraceHubInitialize() - Start\n"); /*0xffd7fd84*/ - sub_FFD8C909(&v4); /*0xffd7fd8c*/ + InitializeTraceHubHob(&v4); /*0xffd7fd8c*/ *(_BYTE *)(v4 + 1488) = 0; /*0xffd7fd9b*/ - v2 = sub_FFD8CBBA(0, 31, 7); /*0xffd7fdb0*/ - if ( (unsigned __int16)sub_FFD8CCA5((unsigned __int16 *)v2) == 0xFFFF ) /*0xffd7fdc1*/ + v2 = PciSegmentLibAddress(0, 31, 7); /*0xffd7fdb0*/ + if ( (unsigned __int16)PciSegmentRead16((unsigned __int16 *)v2) == 0xFFFF ) /*0xffd7fdc1*/ return DebugPrint(64, (int)"TraceHubInitialize() - End. TraceHub device is not present \n"); /*0xffd7fdc8*/ if ( (*(_DWORD *)(v2 + 4) & 2) != 0 ) /*0xffd7fdd2*/ { @@ -352,7 +352,7 @@ { int v2; // eax - v2 = sub_FFD8AD54(); /*0xffd7f94b*/ + v2 = GetPeiServicesTable(); /*0xffd7f94b*/ return (*(int (__cdecl **)(int, void *))(*(_DWORD *)v2 + 24))(v2, this); /*0xffd7f959*/ } @@ -361,6 +361,6 @@ { int PeiServices; // eax - PeiServices = sub_FFD8AD54(); /*0xffd7f962*/ + PeiServices = GetPeiServicesTable(); /*0xffd7f962*/ return (*(int (__cdecl **)(int, int, int, int, int))(*(_DWORD *)PeiServices + 32))(PeiServices, a1, a2, a3, a4); /*0xffd7f97a*/ } diff --git a/PurleySktPkg/SouthClusterLbg/SiInit/Pei/SiInitPreMem/PchPreMemInit.c b/PurleySktPkg/SouthClusterLbg/SiInit/Pei/SiInitPreMem/PchPreMemInit.c index bea946f..dd75f05 100644 --- a/PurleySktPkg/SouthClusterLbg/SiInit/Pei/SiInitPreMem/PchPreMemInit.c +++ b/PurleySktPkg/SouthClusterLbg/SiInit/Pei/SiInitPreMem/PchPreMemInit.c @@ -57,8 +57,8 @@ v8 = *v2; /*0xffd8028e*/ v9 = v6 + 32 * v7; /*0xffd80294*/ v20 = v9; /*0xffd8029b*/ - sub_FFD8C2A0(v8, v9, 4, &v18); /*0xffd8029f*/ - sub_FFD8C2A0(*v2, v9, 4, &v19); /*0xffd802b0*/ + PsfRead32(v8, v9, &v18); /*0xffd8029f*/ + PsfRead32(*v2, v9, &v19); /*0xffd802b0*/ v10 = v18; /*0xffd802b5*/ if ( v18 == v19 ) /*0xffd802c0*/ { @@ -66,7 +66,7 @@ } else { - sub_FFD8C2A0(*v2, v20, 4, &v13); /*0xffd802d0*/ + PsfRead32(*v2, v20, &v13); /*0xffd802d0*/ v10 = v13; /*0xffd802d5*/ } if ( v10 ) /*0xffd802e3*/ @@ -96,7 +96,7 @@ --n10; /*0xffd80354*/ } while ( n10 ); - result = sub_FFD8CFB4(&unk_FFD97F6C, 4); /*0xffd8036a*/ + result = PsfFindErrorHob(&unk_FFD97F6C, 4); /*0xffd8036a*/ if ( !result ) /*0xffd80376*/ { result = GetReportStatusCodePpi(); /*0xffd80378*/ @@ -114,22 +114,22 @@ { int v3; // [esp+8h] [ebp-8h] BYREF - sub_FFD8C578(-983041, 0); /*0xffd80425*/ + PchReportStatus(-983041, 0); /*0xffd80425*/ if ( (*(this + 3504) & 1) != 0 ) /*0xffd80434*/ { - sub_FFD8C578(-1, 16); /*0xffd8047a*/ + PchReportStatus(-1, 16); /*0xffd8047a*/ LABEL_6: MEMORY[0xFE0005D0] = 0x80000000; /*0xffd80481*/ - return sub_FFD8C578(-1, 1); /*0xffd80481*/ + return PchReportStatus(-1, 1); /*0xffd80481*/ } if ( (*(this + 3504) & 2) != 0 ) /*0xffd8043d*/ { - sub_FFD8C2A0(0xB8u, 4u, 4, &v3); /*0xffd8044a*/ + PsfRead32(0xB8u, 4u, &v3); /*0xffd8044a*/ if ( (v3 & 0x600) != 0 ) /*0xffd8045d*/ goto LABEL_6; /*0xffd8045d*/ } - sub_FFD8C578(-17, 1); /*0xffd80468*/ - return sub_FFD8C578(-1, 1); /*0xffd8049b*/ + PchReportStatus(-17, 1); /*0xffd80468*/ + return PchReportStatus(-1, 1); /*0xffd8049b*/ } /* Source: ffd804a1.c */ @@ -137,22 +137,22 @@ { int v2; // eax - if ( (unsigned __int8)sub_FFD8D59A() ) + if ( (unsigned __int8)IsDwrDetected() ) { DebugPrint(64, (int)"DWR: PchMiscInit() End\n"); } else { - sub_FFD8BE68(); /*0xffd804c0*/ - v2 = sub_FFD8CBBA(0, 31, 2); /*0xffd804ce*/ + PchGetSteppingInfo(); /*0xffd804c0*/ + v2 = PciSegmentBase(0, 31, 2); /*0xffd804ce*/ *(_DWORD *)(v2 + 172) &= ~0x100000u; /*0xffd804e5*/ if ( *(this + 1) ) /*0xffd804f0*/ - sub_FFD8C5F6(255, 8); /*0xffd80506*/ + PchWritePort80(255, 8); /*0xffd80506*/ else - sub_FFD8C5F6(247, 0); /*0xffd804fd*/ - sub_FFD8C578(-1793, 8207); /*0xffd80521*/ - sub_FFD8C578(-1, 0x80000000); /*0xffd80535*/ - sub_FFD8C5F6(223, 0); /*0xffd80556*/ + PchWritePort80(247, 0); /*0xffd804fd*/ + PchReportStatus(-1793, 8207); /*0xffd80521*/ + PchReportStatus(-1, 0x80000000); /*0xffd80535*/ + PchWritePort80(223, 0); /*0xffd80556*/ } return 0; /*0xffd8055d*/ } @@ -163,9 +163,9 @@ int v2; // ebx unsigned int v3; // esi - v2 = sub_FFD8CBBA(0, 31, 1); /*0xffd80574*/ + v2 = PciSegmentBase(0, 31, 1); /*0xffd80574*/ if ( (*(_DWORD *)(this + 2727) & 2) != 0 ) /*0xffd8057f*/ - sub_FFD8CCD3( /*0xffd805aa*/ + PciSegmentWrite32( /*0xffd805aa*/ v2 + 112, (*(_DWORD *)(this + 2727) >> 21) & 7 | (unsigned __int16)(8 * ((32 * *(unsigned __int8 *)(this + 2728)) | HIWORD(*(_DWORD *)(this + 2727)) & 0x1F))); @@ -175,12 +175,12 @@ *(_BYTE *)(v2 + 96) = *(_BYTE *)(v2 + 96) & 0xFC | (v3 >> 12) & 3 | 0x80; /*0xffd805d0*/ if ( (*(_BYTE *)(this + 2727) & 1) != 0 ) /*0xffd805dd*/ *(_DWORD *)(v3 + 16) |= 1u; /*0xffd805e5*/ - sub_FFD8CF04(v3, 0); /*0xffd805ed*/ - return sub_FFD8D005(v3, 0); /*0xffd805ff*/ + PchProgramSvidSidConfig(v3, 0); /*0xffd805ed*/ + return PchFinalizeSvidSid(v3, 0); /*0xffd805ff*/ } /* Source: ffd80603.c */ -int __thiscall ProgramSvidSid(int this) +int __thiscall PchProgramSvidSidConfig(int this) { unsigned __int8 n0x2C; // bl int v3; // ecx @@ -188,8 +188,8 @@ unsigned __int8 v6; // [esp+Fh] [ebp-1h] DebugPrint(64, (int)"ProgramSvidSid() Start\n"); /*0xffd80613*/ - sub_FFD8BE68(); /*0xffd8061a*/ - if ( (unsigned __int8)sub_FFD8D59A() ) + PchGetSteppingInfo(); /*0xffd8061a*/ + if ( (unsigned __int8)IsDwrDetected() ) { DebugPrint(64, (int)"DWR: ProgramSvidSid() End\n"); } @@ -202,8 +202,8 @@ { v3 = 3 * n0x2C; /*0xffd80640*/ v6 = byte_FFD97FFE[v3]; /*0xffd80658*/ - v4 = (unsigned __int16 *)sub_FFD8CBBA(0, byte_FFD97FFC[v3], byte_FFD97FFD[v3]); /*0xffd80667*/ - if ( (unsigned __int16)sub_FFD8CCA5(v4) == 0x8086 ) /*0xffd80678*/ + v4 = (unsigned __int16 *)PciSegmentBase(0, byte_FFD97FFC[v3], byte_FFD97FFD[v3]); /*0xffd80667*/ + if ( (unsigned __int16)PciSegmentRead16(v4) == 0x8086 ) /*0xffd80678*/ *(_DWORD *)((char *)v4 + v6) = *(_DWORD *)(this + 8); /*0xffd8068b*/ ++n0x2C; /*0xffd8068e*/ } @@ -232,7 +232,7 @@ this_1 = this; /*0xffd806ba*/ v11 = 0; /*0xffd806c0*/ v12 = 0; /*0xffd806c1*/ - v2 = (unsigned __int8)sub_FFD8BFFD(); /*0xffd806c7*/ + v2 = (unsigned __int8)PchGetPchMaxPciePortNum(); /*0xffd806c7*/ if ( (v2 & 0xFFFFFFF8) > 0x18 ) /*0xffd806d2*/ { v3 = GetReportStatusCodePpi(); /*0xffd806d4*/ @@ -263,9 +263,9 @@ v12 |= (*(_DWORD *)(this_1 + 2755) & 0xFFFFFF80) << 21; /*0xffd80747*/ DebugPrint(64, (int)"DRCRM: 0x%08x 0x%08x 0x%08x\n", v10, v11, v12); do /*0xffd80779*/ - sub_FFD8C497(4, *(&v10 + n3++)); /*0xffd8076e*/ + PchReportStatusCode(4, *(&v10 + n3++)); /*0xffd8076e*/ while ( n3 < 3 ); /*0xffd80779*/ - return sub_FFD8C578(-1, -2147254272); /*0xffd8078e*/ + return PchReportStatus(-1, -2147254272); /*0xffd8078e*/ } /* Source: ffd80796.c */ @@ -304,16 +304,16 @@ DebugPrint(64, (int)"PchOnPolicyInstalled() - Start\ "); /*0xffd807ab*/ - v2 = sub_FFD8CBBA(0, 31, 0); /*0xffd807c1*/ - v3 = sub_FFD8CBBA(0, 31, 2); /*0xffd807d5*/ - v4 = sub_FFD8CBBA(0, 31, 5); /*0xffd807e1*/ - v5 = sub_FFD8C632(*(_WORD *)(this + 2)); /*0xffd807e3*/ + v2 = PciSegmentBase(0, 31, 0); /*0xffd807c1*/ + v3 = PciSegmentBase(0, 31, 2); /*0xffd807d5*/ + v4 = PciSegmentBase(0, 31, 5); /*0xffd807e1*/ + v5 = PchAcpiBaseSet(*(_WORD *)(this + 2)); /*0xffd807e3*/ if ( v5 < 0 ) /*0xffd807ea*/ { DebugPrint(0x8000... [6904 chars total] /* Source: ffd80ba6.c */ -int __thiscall PchEarlyDisabledDeviceHandling(int *this) +int __thiscall PchHandleDisabledDevices(int *this) { int v2; // esi int v3; // edi @@ -359,12 +359,12 @@ DebugPrint(64, (int)"PchEarlyInit() - Start\ "); /*0xffd813df*/ - sub_FFD82723(); /*0xffd813e4*/ - sub_FFD81769(); /*0xffd813e9*/ - sub_FFD8C497(2, 1); /*0xffd813fc*/ - sub_FFD8C5F6(255, 3); /*0xffd81414*/ - sub_FFD8C578(-2, 0); /*0xffd81425*/ - v2 = sub_FFD8CBBA(0, 31, 1); /*0xffd81431*/ + PchInitPreMemPolicy(); /*0xffd813e4*/ + PchInitPreMemHw(); /*0xffd813e9*/ + PchReportStatusCode(2, 1); /*0xffd813fc*/ + PchWritePort80(255, 3); /*0xffd81414*/ + PchReportStatus(-2, 0); /*0xffd81425*/ + v2 = PciSegmentBase(0, 31, 1); /*0xffd81431*/ *(_DWORD *)(v2 + 128) = 0; /*0xffd8143b*/ *(_DWORD *)(v2 + 132) = 0; /*0xffd81441*/ *(_DWORD *)(v2 + 136) = 0; /*0xffd81447*/ @@ -374,7 +374,7 @@ *(_DWORD *)(v2 + 152) = 16; /*0xffd81463*/ *(_DWORD *)(v2 + 156) = 0; /*0xffd8146d*/ *(_BYTE *)(v2 + 244) |= 1u; /*0xffd8147d*/ - v3 = sub_FFD8CBBA(0, 31, 2); /*0xffd8148d*/ + v3 = PciSegmentBase(0, 31, 2); /*0xffd8148d*/ if ( (*(_BYTE *)(v3 + 164) & 4) != 0 ) /*0xffd81499*/ { __outbyte(0x74u, 0xAu); /*0xffd814a3*/ @@ -394,12 +394,12 @@ *(_DWORD *)(v3 + 172) &= ~0x100000u; /*0xffd814ed*/ *(this + 53) = 0; /*0xffd814f3*/ *(this + 61) = 0; /*0xffd814f9*/ - PchEarlyDisabledDeviceHandling(this); /*0xffd814ff*/ - sub_FFD905CC(); /*0xffd81504*/ - sub_FFD8C497(4, 0); /*0xffd81518*/ - sub_FFD8C497(4, 18875648); /*0xffd8152c*/ - sub_FFD8C497(4, 0); /*0xffd81539*/ - sub_FFD8C497(4, 18875648); /*0xffd81545*/ + PchHandleDisabledDevices(this); /*0xffd814ff*/ + PchConfigureSerialIo(); /*0xffd81504*/ + PchReportStatusCode(4, 0); /*0xffd81518*/ + PchReportStatusCode(4, 18875648); /*0xffd8152c*/ + PchReportStatusCode(4, 0); /*0xffd81539*/ + PchReportStatusCode(4, 18875648); /*0xffd81545*/ return DebugPrint(64, (int)"PchEarlyInit() - End\ "); /*0xffd81559*/ } @@ -417,7 +417,7 @@ DebugPrint(64, (int)"PchInitPreMem() - Start\ "); /*0xffd8156b*/ - if ( !(unsigned __int8)sub_FFD8BDC8() ) /*0xffd81572*/ + if ( !(unsigned __int8)IsPchLpcSupported() ) /*0xffd81572*/ { DebugPrint(0x80000000, (int)"PCH SKU is not supported due to no proper PCH LPC found!\ "); /*0xffd8158b*/ @@ -428,7 +428,7 @@ 1948, "((BOOLEAN)(0==1))"); } - v1 = sub_FFD8CBBA(0, 31, 1); /*0xffd815b8*/ + v1 = PciSegmentBase(0, 31, 1); /*0xffd815b8*/ if ( (*(_DWORD *)(v1 + 16) & 0xFF000000) == 0 ) /*0xffd815c4*/ { DebugPrint(64, (int)"SBREG should be programmed before here\ @@ -436,10 +436,10 @@ *(_DWORD *)(v1 + 16) = -50331648; /*0xffd815d2*/ *(_BYTE *)(v1 + 4) |= 2u; /*0xffd815e0*/ } - sub_FFD8C632(0x500u); /*0xffd815e8*/ - sub_FFD8C80A(); /*0xffd815ed*/ - sub_FFD8C99B(); /*0xffd815f2*/ - sub_FFD8C909((unsigned int *)&v7); /*0xffd815fb*/ + PchSetPwrmBase(0x500u); /*0xffd815e8*/ + PchPwrmBaseGet(); /*0xffd815ed*/ + PchPublishPwrmBase(); /*0xffd815f2*/ + v7 = (int *)PchGetPwrmBase(); /*0xffd815fb*/ DebugPrint(64, (int)"PCH PWRM Base needs to be programmed before here\ "); /*0xffd81607*/ if ( !v7 ) /*0xffd81613*/ @@ -451,7 +451,7 @@ 1993, "PchPwrmBase != 0"); } - if ( (unsigned __int8)sub_FFD8D59A() ) + if ( (unsigned __int8)IsDwrDetected() ) { DebugPrint(0x80000000, (int)"DWR: DWR detected - install PPI\ "); @@ -495,29 +495,29 @@ _BYTE v7[32]; // [esp+Ch] [ebp-24h] BYREF int p_n32; // [esp+2Ch] [ebp-4h] BYREF - v0 = sub_FFD8CBBA(0, 31, 0); /*0xffd816db*/ + v0 = PciSegmentBase(0, 31, 0); /*0xffd816db*/ p_n32 = 32; /*0xffd816e3*/ - sub_FFD8BE68(); /*0xffd816e6*/ - sub_FFD8C111(&p_n32); /*0xffd816f1*/ + PchGetSteppingInfo(); /*0xffd816e6*/ + PchGetPchSeries(&p_n32); /*0xffd816f1*/ LODWORD(v4) = v7; /*0xffd816fa*/ DebugPrint(64, (int)"PCH Series : %a\ ", v4); p_n32 = 32; /*0xffd8170a*/ - sub_FFD8BB3A(v1); /*0xffd81712*/ - sub_FFD8C06D(&p_n32); /*0xffd8171d*/ + PchGetPchStepping(v1); /*0xffd81712*/ + PchGetPchSku(&p_n32); /*0xffd8171d*/ LODWORD(v5) = v7; /*0xffd81726*/ DebugPrint(64, (int)"PCH Stepping : %a\ ", v5); p_n32 = 32; /*0xffd81736*/ - v2 = sub_FFD8CCA5((unsigned __int16 *)(v0 + 2)); /*0xffd81740*/ - sub_FFD8C1B5(v2, v7, &p_n32); /*0xffd8174a*/ + v2 = PciSegmentRead16((unsigned __int16 *)(v0 + 2)); /*0xffd81740*/ + PchFormatPchSku(v2, v7, &p_n32); /*0xffd8174a*/ LODWORD(v6) = v7; /*0xffd81753*/ return DebugPrint(64, (int)"PCH SKU : %a\ ", v6); } /* Source: ffd821b8.c */ -int __fastcall sub_FFD821B8(int a1, char a2, int a3, unsigned __int8 n2) +int __fastcall EarlyConfigurePchHSata(int a1, char a2, int a3, unsigned __int8 n2) { unsigned __int8 n2_1; // bh char v5; // bl @@ -539,8 +539,8 @@ { DebugPrint(64, (int)"EarlyConfigurePchHSata() - First Controller - Start\ "); /*0xffd821d5*/ - v7 = sub_FFD8CBBA(0, 23, 0); /*0xffd821e9*/ - sub_FFD8C019(); /*0xffd821eb*/ + v7 = PciSegmentBase(0, 23, 0); /*0xffd821e9*/ + PchGetPchMaxSataPortNum(); /*0xffd821eb*/ } else { @@ -552,21 +552,21 @@ } DebugPrint(64, (int)"EarlyConfigurePchHSata() - Second Controller - Start\ "); /*0xffd82202*/ - v7 = sub_FFD8CBBA(0, 17, 5); /*0xffd82216*/ + v7 = PciSegmentBase(0, 17, 5); /*0xffd82216*/ } - v8 = sub_FFD8CBBA(0, 31, 0); /*0xffd8221f*/ - v9 = sub_FFD8CCA5((unsigned __int16 *)(v8 + 2)); /*0xffd8222d*/ - if ( !(unsigned __int8)sub_FFD8D58A() ) /*0xffd82230*/ + v8 = PciSegmentBase(0, 31, 0); /*0xffd8221f*/ + v9 = PciSegmentRead16((unsigned __int16 *)(v8 + 2)); /*0xffd8222d*/ + if ( !(unsigned __int8)PchIsLpcDwrHpetSafe() ) /*0xffd82230*/ { if ( n2_1 == 1 ) /*0xffd8223c*/ - v5 = sub_FFD81814(); /*0xffd82243*/ + v5 = IsFirstSataControllerUsable(); /*0xffd82243*/ if ( n2_1 != 2 ) /*0xffd82248*/ goto LABEL_14; /*0xffd82248*/ v11 = 0; /*0xffd8224a*/ while ( 1 ) /*0xffd82253*/ { - sub_FFD8E7BA(v11, &n2); /*0xffd82253*/ - sub_FFD8E062(n2, &v17, &n2_2); /*0xffd82266*/ + PchGetSataPortMap(v11, &n2); /*0xffd82253*/ + PchIsControllerUsable(n2, &v17, &n2_2); /*0xffd82266*/ if ( n2_2 == 2 ) /*0xffd82271*/ break; /*0xffd82271*/ if ( ++v11 >= 6u ) /*0xffd82278*/ @@ -628,8 +628,8 @@ else v13 = v12 & 0xE8 | 0x10; /*0xffd823fc*/ *(_BYTE *)(v7 + 156) = v13 & 0xF8 | 6; /*0xffd8240d*/ - sub_FFD8CC4F(v7 + 148, 255); /*0xffd82413*/ - sub_FFD7FA46(2u); /*0xffd8241b*/ + PchPciConfigWrite32(v7 + 148, 255); /*0xffd82413*/ + PchProgramSataController(2u); /*0xffd8241b*/ DebugPrint(64, (int)"EarlyConfigurePchHSata() End\ "); /*0xffd82427*/ return 0; /*0xffd8242c*/ @@ -637,13 +637,13 @@ else { LOBYTE(v10) = n2_1; /*0xffd82434*/ - sub_FFD81FF5(a3, v10); /*0xffd82436*/ + PchHandleDisabledDevices(a3, v10); /*0xffd82436*/ return 0; /*0xffd8243b*/ } } /* Source: ffd8245b.c */ -int __cdecl sub_FFD8245B(int n2) +int __cdecl ConfigurePchHSata(int n2) { int v1; // ecx int v2; // ebx @@ -660,19 +660,19 @@ { DebugPrint(64, (int)"ConfigurePchHSata() - First Controller - Start\ "); /*0xffd82477*/ - v4 = sub_FFD8CBBA(0, 23, 0); /*0xffd8248a*/ - n6 = (unsigned __int8)sub_FFD8C019(); /*0xffd82491*/ + v4 = PciSegmentBase(0, 23, 0); /*0xffd8248a*/ + n6 = (unsigned __int8)PchGetPchMaxSataPortNum(); /*0xffd82491*/ } else { DebugPrint(64, (int)"ConfigurePchHSata() - Second Controller - Start\ "); /*0xffd8249d*/ - v4 = sub_FFD8CBBA(0, 17, 5); /*0xffd824b1*/ + v4 = PciSegmentBase(0, 17, 5); /*0xffd824b1*/ n6 = 6; /*0xffd824b5*/ } - v6 = sub_FFD8CBBA(0, 31, 0); /*0xffd824bc*/ - sub_FFD8CCA5((unsigned __int16 *)(v6 + 2)); /*0xffd824c5*/ - sub_FFD81B92(n2); /*0xffd824d4*/ + v6 = PciSegmentBase(0, 31, 0); /*0xffd824bc*/ + PciSegmentRead16((unsigned __int16 *)(v6 + 2)); /*0xffd824c5*/ + PchWdtInit(n2); /*0xffd824d4*/ if ( (*(_BYTE *)v3 & 8) != 0 ) /*0xffd824dd*/ { n6_1 = 0; /*0xffd824e3*/ @@ -726,7 +726,7 @@ } /* Source: ffd826ae.c */ -bool __fastcall sub_FFD826AE(int a1, int a2, char a3) +bool __fastcall IsFirstSataControllerUsable(int a1, int a2, char a3) { int v5; // eax int v6; // ecx @@ -735,16 +735,16 @@ int v10; // [esp+14h] [ebp-8h] BYREF char n2; // [esp+1Bh] [ebp-1h] - v5 = sub_FFD8AD54(); /*0xffd826bb*/ + v5 = GetPeiServicesPtr(); /*0xffd826bb*/ (*(void (__cdecl **)(int, int *))(*(_DWORD *)v5 + 40))(v5, &n17); /*0xffd826c7*/ n2 = *(_BYTE *)(100 * a2 + a1 + 5); /*0xffd826d6*/ - sub_FFD8D75C(&v10); /*0xffd826dd*/ - v6 = sub_FFD8CBBA(0, v9, v10); /*0xffd826f3*/ + PchGetRootPortMap(&v10); /*0xffd826dd*/ + v6 = PciSegmentBase(0, v9, v10); /*0xffd826f3*/ return (!n2 || n2 == 2) && n17 == 17 && (*(_BYTE *)(v6 + 76) & 0xFu) >= 3 && a3 == 1; /*0xffd8271c*/ } /* Source: ffd83186.c */ -int __thiscall sub_FFD83186(char *this) +int __thiscall GetPcieSpeedModeString(char *this) { int v2; // eax int v3; // eax @@ -754,7 +754,7 @@ double v8; // [esp-4h] [ebp-20h] int v9; // [esp+14h] [ebp-8h] BYREF - v2 = sub_FFD8D75C(&v9); /*0xffd8319f*/ + v2 = PchGetRootPortMap(&v9); /*0xffd8319f*/ if ( v2 < 0 ) /*0xffd831b1*/ { DebugPrint(0x80000000, (int)"\ @@ -767,7 +767,7 @@ 1132, "!EFI_ERROR (Status)"); } - v4 = sub_FFD9041E(&v9); /*0xffd831e8*/ + v4 = PchGetRootPortInfo(&v9); /*0xffd831e8*/ if ( v4 < 0 ) /*0xffd831f0*/ { DebugPrint(0x80000000, (int)"\ @@ -788,7 +788,7 @@ } /* Source: ffd85246.c */ -int __fastcall sub_FFD85246(int a1, int a2, int a3) +int __fastcall PchGetSataPortMap(int a1, int a2, int a3) { int n15000_6; // edi int v5; // ebx @@ -836,7 +836,7 @@ ... [11197 chars total] /* Source: ffd85f37.c */ -int sub_FFD85F37() +int GetPchPolicy() { int v0; // eax int v1; // eax @@ -865,7 +865,7 @@ } /* Source: ffd86e4d.c */ -int __usercall sub_FFD86E37@(int a1@, int a2@, int a3, int a4, int a5, int a6, int a7, ...) +int __usercall XhciClearOverCurrentRegisters@(int a1@, int a2@, int a3, int a4, int a5, int a6, int a7, ...) { int v7; // ebx unsigned int n8_3; // esi @@ -907,12 +907,12 @@ v34 = va_arg(va1, _DWORD); /*0xffd86e37*/ v35 = va_arg(va1, _DWORD); /*0xffd86e37*/ v7 = a2; /*0xffd86e3e*/ - sub_FFD8D4C8(va1, retaddr); /*0xffd86e4f*/ - sub_FFD8D4C8((int *)va, retaddr); /*0xffd86e5b*/ - sub_FFD8BF54(); /*0xffd86e60*/ + PchPciConfigWrite32(va1, retaddr); /*0xffd86e4f*/ + PchPciConfigWrite32((int *)va, retaddr); /*0xffd86e5b*/ + PchGetPchMaxSataPortNum(); /*0xffd86e60*/ n8_3 = 0; /*0xffd86e65*/ v9 = 0; /*0xffd86e67*/ - if ( (unsigned __int8)sub_FFD8C051() ) /*0xffd86e69*/ + if ( (unsigned __int8)PchGetPchMaxUsb3PortNum() ) /*0xffd86e69*/ { v10 = (unsigned __int8 *)(v7 + 264); /*0xffd86e72*/ do /*0xffd86ebd*/ @@ -932,7 +932,7 @@ ++v9; /*0xffd86eaf*/ v10 += 16; /*0xffd86eb0*/ } - while ( v9 < (unsigned __int8)sub_FFD8C051() ); /*0xffd86ebd*/ + while ( v9 < (unsigned __int8)PchGetPchMaxUsb3PortNum() ); /*0xffd86ebd*/ v7 = a2; /*0xffd86ebf*/ } n8_1 = 0; /*0xffd86ec7*/ @@ -945,7 +945,7 @@ while ( n8_1 < 8 ); /*0xffd86edc*/ v17 = 0; /*0xffd86ede*/ v18 = (unsigned __int8 *)(v7 + 8); /*0xffd86ee0*/ - while ( (unsigned int)(sub_FFD8BE68() - 1) <= 1 && v17 < retaddr ) /*0xffd86efb*/ + while ( (unsigned int)(PchGetSteppingInfo() - 1) <= 1 && v17 < retaddr ) /*0xffd86efb*/ { n8_2 = *v18; /*0xffd86efd*/ if ( *v18 != 8 ) /*0xffd86f02*/ @@ -973,7 +973,7 @@ } /* Source: ffd879ed.c */ -int __thiscall sub_FFD879ED(_DWORD *this) +int __thiscall XhciUsb3Tune(_DWORD *this) { unsigned __int8 i; // bl int v3; // ecx @@ -984,23 +984,23 @@ _BYTE v9[2]; // [esp+14h] [ebp-8h] BYREF DebugPrint(64, (int)"XhciUsb3Tune() Start\n"); /*0xffd879fd*/ - for ( i = 0; i < (unsigned __int8)sub_FFD8C051(); ++i ) /*0xffd87a06*/ + for ( i = 0; i < (unsigned __int8)PchGetPchMaxUsb3PortNum(); ++i ) /*0xffd87a06*/ { if ( (*(_BYTE *)(this + 4 * i + 67) & 0x81) != 0 ) /*0xffd87a22*/ { - sub_FFD8E3BE(); /*0xffd87a2c*/ - sub_FFD8E062(v6, &v8, &v7); /*0xffd87a41*/ + PchGetPchMaxSataPortNum(); /*0xffd87a2c*/ + PchIsControllerUsable(v6, &v8, &v7); /*0xffd87a41*/ v3 = v5; /*0xffd87a4b*/ if ( v7 == 1 ) /*0xffd87a4c*/ { LOBYTE(v3) = v6; /*0xffd87a56*/ - sub_FFD8EBC8(v3, v9); /*0xffd87a58*/ + PchPciConfigWrite32(v3, v9); /*0xffd87a58*/ if ( (*(this + 4 * i + 67) & 1) != 0 ) /*0xffd87a6e*/ - sub_FFD8C578(-4128769, (*(this + 4 * i + 67) & 0x7E) << 15); /*0xffd87a85*/ + PchReportStatus(-4128769, (*(this + 4 * i + 67) & 0x7E) << 15); /*0xffd87a85*/ if ( (*(this + 4 * i + 67) & 0x80u) != 0 ) /*0xffd87a95*/ - sub_FFD8C578(-4128769, (*(this + 4 * i + 67) & 0x3F00) << 8); /*0xffd87aae*/ - sub_FFD8C578(-3, 0); /*0xffd87ac9*/ - sub_FFD8C578(-1, 2); /*0xffd87ad6*/ + PchReportStatus(-4128769, (*(this + 4 * i + 67) & 0x3F00) << 8); /*0xffd87aae*/ + PchReportStatus(-3, 0); /*0xffd87ac9*/ + PchReportStatus(-1, 2); /*0xffd87ad6*/ } } } @@ -1018,14 +1018,14 @@ int v6; // eax DebugPrint(64, (int)"InstallPchSpi() Start\n"); /*0xffd87d4c*/ - v0 = sub_FFD8CBBA(0, 31, 5); /*0xffd87d58*/ + v0 = PciSegmentBase(0, 31, 5); /*0xffd87d58*/ *(_DWORD *)(v0 + 16) = -33488896; /*0xffd87d60*/ *(_DWORD *)(v0 + 4) |= 2u; /*0xffd87d6d*/ - v1 = sub_FFD8ADB0(104); /*0xffd87d73*/ + v1 = AllocateZeroPool(104); /*0xffd87d73*/ v2 = (_DWORD *)v1; /*0xffd87d78*/ if ( !v1 ) /*0xffd87d7c*/ return -2147483639; /*0xffd87d7e*/ - sub_FFD8F09A((_DWORD *)(v1 + 12)); /*0xffd87d88*/ + SpiProtocolInit((_DWORD *)(v1 + 12)); /*0xffd87d88*/ *v2 = -2147483632; /*0xffd87d90*/ v2[1] = &unk_FFD97EBC; /*0xffd87d98*/ v2[2] = v2 + 5; /*0xffd87d9f*/ @@ -1058,8 +1058,8 @@ if ( (*(this + 3514) & 1) == 0 ) /*0xffd87e1d*/ { DebugPrint(64, (int)"Disable EnhancePort8xhDecoding\n"); /*0xffd87e26*/ - sub_FFD8D48A(v5, 16); /*0xffd87e33*/ - result = sub_FFD8CA98(v5); /*0xffd87e3b*/ + PchPciConfigWrite32(v5, 16); /*0xffd87e33*/ + result = PchPciConfigApply(v5); /*0xffd87e3b*/ v3 = 0; /*0xffd87e40*/ while ( 1 ) /*0xffd87e42*/ { @@ -1069,26 +1069,26 @@ if ( (unsigned int)++v3 >= 4 ) /*0xffd87e5f*/ return result; /*0xffd87e5f*/ } - *(_DWORD *)(sub_FFD8CBBA(0, 31, 0) + 4 * v3 + 132) = 0; /*0xffd87e83*/ - return sub_FFD8C497(4, 0); /*0xffd87e8d*/ + *(_DWORD *)(PciSegmentBase(0, 31, 0) + 4 * v3 + 132) = 0; /*0xffd87e83*/ + return PchReportStatus(4, 0); /*0xffd87e8d*/ } return result; /*0xffd87e94*/ } /* Source: ffd87e99.c */ -bool PchWdtIsUnexpectedReset() +bool PchIsLpcDwrHpetSafe() { int v0; // esi int n5120; // eax bool result; // al unsigned __int16 v3; // [esp+4h] [ebp-4h] BYREF - sub_FFD8C76F(&v3); /*0xffd87ea1*/ + v3 = 0; /*0xffd87ea1*/ v0 = v3; /*0xffd87ea6*/ result = 0; /*0xffd87ee2*/ - if ( (sub_FFD8CD06(v3) & 0x8000u) != 0 ) /*0xffd87eb9*/ + if ( (PchProgramSvidSid(v3) & 0x8000u) != 0 ) /*0xffd87eb9*/ { - n5120 = sub_FFD8CD06(v0 + 4) & 0x1C00; /*0xffd87ed0*/ + n5120 = PchProgramSvidSid(v0 + 4) & 0x1C00; /*0xffd87ed0*/ if ( (_WORD)n5120 == 5120 || (_WORD)n5120 == 6144 ) /*0xffd87ee0*/ return 1; /*0xffd87eb9*/ } @@ -1114,8 +1114,8 @@ int v13; // [esp+14h] [ebp-8h] BYREF int v14; // [esp+18h] [ebp-4h] - v0 = sub_FFD8EEB6(); /*0xffd87ef4*/ - v1 = sub_FFD8CD6B(v0); /*0xffd87f00*/ + v0 = PchPwrmBaseGet(); /*0xffd87ef4*/ + v1 = MmioRead32(v0); /*0xffd87f00*/ DebugPrint(64, (int)"(WDT) Readback = 0x%08x\n", v1); /*0xffd87f0a*/ if ( (v1 & 0x4000) != 0 ) /*0xffd87f18*/ { @@ -1127,7 +1127,7 @@ v14 = 0; /*0xffd87f2e*/ v2 = 0; /*0xffd87f32*/ } - v3 = sub_FFD8AD54(); /*0xffd87f34*/ + v3 = GetPeiServicesPtr(); /*0xffd87f34*/ result = (*(int (__cdecl **)(int, int, int, int *))(*(_DWORD *)v3 + 52))(v3, 4, 28, &v13); /*0xffd87f45*/ if ( result >= 0 ) /*0xffd87f4d*/ { @@ -1146,7 +1146,7 @@ } else { - if ( (v1 & 0x400000) == 0 || PchWdtIsUnexpectedReset() ) /*0xffd87fa9*/ + if ( (v1 & 0x400000) == 0 || PchIsLpcDwrHpetSafe() ) /*0xffd87fa9*/ { DebugPrint(64, (int)"(WDT) Status OK.\n", v1); /*0xffd87fcf*/ v8 = v1 & 0xFF7FFFFF; /*0xffd87fd7*/ @@ -1158,8 +1158,8 @@ } v7 = v8 | 0x3000000; /*0xffd87fdd*/ } - v9 = sub_FFD8EEB6(); /*0xffd87fdf*/ - sub_FFD8CD97(v9, v7); /*0xffd87fe8*/ + v9 = PchPwrmBaseGet(); /*0xffd87fdf*/ + MmioWrite32(v9, v7); /*0xffd87fe8*/ InstallPpi(&unk_FFD9816C); /*0xffd87ff2*/ v10 = InstallPpi(&unk_FFD98144); /*0xffd87ffc*/ v11 = v10; /*0xffd88001*/ @@ -1193,11 +1193,11 @@ int v10; // eax DebugPrint(64, (int)"InstallPchReset() Start\n"); /*0xffd880de*/ - v0 = sub_FFD8ADB0(40); /*0xffd880e8*/ + v0 = AllocateZeroPool(40); /*0xffd880e8*/ v1 = (_DWORD *)v0; /*0xffd880ed*/ if ( !v0 ) /*0xffd880f1*/ return -2147483639; /*0xffd881e7*/ - sub_FFD90233(v0 + 12); /*0xffd880fc*/ + PchResetInit(v0 + 12); /*0xffd880fc*/ v1[5] = PchResetInitCallback; /*0xffd88106*/ *v1 = -2147483632; /*0xffd8810c*/ v1[1] = &unk_FFD97FAC; /*0xffd88112*/ @@ -1213,8 +1213,8 @@ 132, "!EFI_ERROR (Status)"); } - v4 = (_DWORD *)sub_FFD8ADB0(12); /*0xffd88164*/ - v5 = (_DWORD *)sub_FFD8ADB0(4); /*0xffd88166*/ + v4 = (_DWORD *)AllocateZeroPool(12); /*0xffd88164*/ + v5 = (_DWORD *)AllocateZeroPool(4); /*0xffd88166*/ if ( !v4 || !v5 ) /*0xffd88171*/ { v10 = GetReportStatusCodePpi(); /*0xffd881cd*/ @@ -1252,7 +1252,7 @@ int __return_address; // [esp+0h] [ebp-Ch] int v3; // [esp+6h] [ebp-6h] - sub_FFD8D30B(__return_address); /*0xffd8ad5d*/ + PeiServicesTablePointerLibIdt(__return_address); /*0xffd8ad5d*/ v0 = *(_DWORD *)(v3 - 4); /*0xffd8ad65*/ if ( !v0 ) /*0xffd8ad6a*/ ReportStatusCode( /*0xffd8ad79*/ diff --git a/PurleySktPkg/SouthClusterLbg/SiInit/Pei/SiInitPreMem/PcieRootPortDwr.c b/PurleySktPkg/SouthClusterLbg/SiInit/Pei/SiInitPreMem/PcieRootPortDwr.c index b6d4fde..2ec7f99 100644 --- a/PurleySktPkg/SouthClusterLbg/SiInit/Pei/SiInitPreMem/PcieRootPortDwr.c +++ b/PurleySktPkg/SouthClusterLbg/SiInit/Pei/SiInitPreMem/PcieRootPortDwr.c @@ -1,6 +1,6 @@ /* Consolidated from decompiled shard files. */ /* Source: ffd82c71.c */ -int PciERWORegInit() +int PchPcieRpErwoRegInit() { unsigned int i; // edi int v1; // ebx @@ -10,22 +10,22 @@ DebugPrint(64, (int)"PciERWORegInit() Start\ "); /*0xffd82c81*/ - if ( (unsigned __int8)sub_FFD8D59A() ) + if ( (unsigned __int8)PchInResumeMode() ) { DebugPrint(64, (int)"DWR: PciERWORegInit() End\ "); } else { - sub_FFD8BE68(); /*0xffd82c9b*/ - for ( i = 0; i < (unsigned __int8)sub_FFD8BFFD(); ++i ) /*0xffd82ca2*/ + PchGetSteppingInfo(); /*0xffd82c9b*/ + for ( i = 0; i < (unsigned __int8)PchGetPchPortCount(); ++i ) /*0xffd82ca2*/ { - sub_FFD8D75C(&v5); /*0xffd82cb4*/ - v1 = sub_FFD8CBBA(0, v4, v5); /*0xffd82cc8*/ - if ( (unsigned __int16)sub_FFD8CCA5((unsigned __int16 *)v1) != 0xFFFF ) /*0xffd82cd9*/ + PchGetPciDeviceLocation(&v5); /*0xffd82cb4*/ + v1 = PchPciSegmentGetDevice(0, v4, v5); /*0xffd82cc8*/ + if ( (unsigned __int16)PchPciSegmentRead16((unsigned __int16 *)v1) != 0xFFFF ) /*0xffd82cd9*/ { - v2 = sub_FFD8CCA5((unsigned __int16 *)(v1 + 68)); /*0xffd82cde*/ - sub_FFD8CCD3(v1 + 68, v2); /*0xffd82ce9*/ + v2 = PchPciSegmentRead16((unsigned __int16 *)(v1 + 68)); /*0xffd82cde*/ + PchPciSegmentWrite16(v1 + 68, v2); /*0xffd82ce9*/ *(_DWORD *)(v1 + 76) = *(_DWORD *)(v1 + 76); /*0xffd82cf1*/ *(_DWORD *)(v1 + 84) = *(_DWORD *)(v1 + 84); /*0xffd82cf7*/ *(_DWORD *)(v1 + 216) |= 0x800000u; /*0xffd82d05*/ @@ -61,21 +61,21 @@ v18 = a2; /*0xffd82d36*/ v19 = a1; /*0xffd82d3a*/ - if ( (unsigned __int8)sub_FFD8D59A() ) + if ( (unsigned __int8)PchInResumeMode() ) { DebugPrint(64, (int)"DWR: PchPcieRpSpeedChange() End\ "); } else { - i_1 = sub_FFD8BFFD(); /*0xffd82d5a*/ + i_1 = PchGetPchPortCount(); /*0xffd82d5a*/ i_2 = 0; /*0xffd82d5f*/ for ( i = i_1; i_2 < i; ++i_2 ) /*0xffd82d66*/ { v20[i_2] = 0; /*0xffd82d68*/ - if ( sub_FFD8D75C(&n0x96_1) >= 0 ) /*0xffd82d80*/ + if ( PchGetPciDeviceLocation(&n0x96_1) >= 0 ) /*0xffd82d80*/ { - v20[i_2] = sub_FFD8CBBA(0, v17, n0x96_1); /*0xffd82db2*/ + v20[i_2] = PchPciSegmentGetDevice(0, v17, n0x96_1); /*0xffd82db2*/ } else { @@ -93,15 +93,15 @@ v8 = v20[j]; /*0xffd82dc3*/ if ( v8 ) /*0xffd82dc9*/ { - if ( (unsigned __int16)sub_FFD8CCA5((unsigned __int16 *)v20[j]) != 0xFFFF ) /*0xffd82dda*/ + if ( (unsigned __int16)PchPciSegmentRead16((unsigned __int16 *)v20[j]) != 0xFFFF ) /*0xffd82dda*/ { v17 = *(_DWORD *)(v8 + 76) & 0xF; /*0xffd82de2*/ - if ( v17 > 1 && !sub_FFD826AE(v19 + 28, j, *(_BYTE *)(j + v18)) ) /*0xffd82dfd*/ + if ( v17 > 1 && !IsPchPcieRpGen3Capable(v19 + 28, j, *(_BYTE *)(j + v18)) ) /*0xffd82dfd*/ { - sub_FFD8CC85(v17); /*0xffd82e13*/ - if ( (sub_FFD8CCA5((unsigned __int16 *)(v8 + 90)) & 0x40) != 0 ) /*0xffd82e23*/ + PchPciSegmentFlush(v17); /*0xffd82e13*/ + if ( (PchPciSegmentRead16((unsigned __int16 *)(v8 + 90)) & 0x40) != 0 ) /*0xffd82e23*/ { - sub_FFD8CC4F(v8 + 80, 32); /*0xffd82e2b*/ + PchPciSegmentSetBar(v8 + 80, 32); /*0xffd82e2b*/ v6 |= 1 << j; /*0xffd82e30*/ } } @@ -116,13 +116,13 @@ { if ( n0x96 >= 0x96 ) /*0xffd82e4c*/ break; /*0xffd82e4c*/ - sub_FFD7FA46(0x64u); /*0xffd82e51*/ + Stall(0x64u); /*0xffd82e51*/ i_3 = 0; /*0xffd82e56*/ if ( i ) /*0xffd82e5a*/ { do /*0xffd82e83*/ { - if ( ((1 << i_3) & v6) != 0 && (sub_FFD8CCA5((unsigned __int16 *)(v20[i_3] + 82)) & 0x2000) != 0 ) /*0xffd82e7b*/ + if ( ((1 << i_3) & v6) != 0 && (PchPciSegmentRead16((unsigned __int16 *)(v20[i_3] + 82)) & 0x2000) != 0 ) /*0xffd82e7b*/ v6 &= ~(1 << i_3); /*0xffd82e7d*/ ++i_3; /*0xffd82e80*/ } @@ -139,8 +139,8 @@ if ( ((1 << k) & v6) != 0 ) /*0xffd82ea9*/ { v12 = v20[k]; /*0xffd82eab*/ - sub_FFD8CC85(1); /*0xffd82eb9*/ - sub_FFD8CC4F(v12 + 80, 32); /*0xffd82ec5*/ + PchPciSegmentFlush(1); /*0xffd82eb9*/ + PchPciSegmentSetBar(v12 + 80, 32); /*0xffd82ec5*/ } } n0x96_2 = 0; /*0xffd82ecf*/ @@ -149,13 +149,13 @@ { if ( n0x96_2 >= 0x96 ) /*0xffd82edb*/ break; /*0xffd82edb*/ - sub_FFD7FA46(0x64u); /*0xffd82ee0*/ + Stall(0x64u); /*0xffd82ee0*/ i_4 = 0; /*0xffd82ee5*/ if ( i ) /*0xffd82ee9*/ { do /*0xffd82f12*/ { - if ( ((1 << i_4) & v6) != 0 && (sub_FFD8CCA5((unsigned __int16 *)(v20[i_4] + 82)) & 0x2000) != 0 ) /*0xffd82f0a*/ + if ( ((1 << i_4) & v6) != 0 && (PchPciSegmentRead16((unsigned __int16 *)(v20[i_4] + 82)) & 0x2000) != 0 ) /*0xffd82f0a*/ v6 &= ~(1 << i_4); /*0xffd82f0c*/ ++i_4; /*0xffd82f0f*/ } @@ -172,7 +172,7 @@ } /* Source: ffd82f2b.c */ -bool __fastcall GetPciEndpointInfo(int RootPort, unsigned __int8 RootPortIndex, unsigned __int16 *EndpointInfo) +bool __fastcall PchPcieRpGetEndpointInfo(int RootPort, unsigned __int8 RootPortIndex, unsigned __int16 *EndpointInfo) { char v5; // bl unsigned int v7; // ebp @@ -183,21 +183,21 @@ v5 = 0; /*0xffd82f40*/ *(_DWORD *)(a3 + 1) = 0xFFFF; /*0xffd82f42*/ *a3 = -1; /*0xffd82f49*/ - if ( (sub_FFD8CCA5((unsigned __int16 *)(a1 + 90)) & 0x40) == 0 ) /*0xffd82f56*/ + if ( (PchPciSegmentRead16((unsigned __int16 *)(a1 + 90)) & 0x40) == 0 ) /*0xffd82f56*/ return 0; /*0xffd82f58*/ *(_DWORD *)(a1 + 24) = *(_DWORD *)(a1 + 24) & 0xFF0000FF | ((a2 | (a2 << 8)) << 8); /*0xffd82f7c*/ - v11 = (unsigned int *)sub_FFD8CBBA(a2, 0, 0); /*0xffd82f8b*/ - sub_FFD8CCD3(v11, 0); /*0xffd82f8f*/ + v11 = (unsigned int *)PchPciSegmentGetDevice(a2, 0, 0); /*0xffd82f8b*/ + PchPciSegmentWrite16(v11, 0); /*0xffd82f8f*/ v7 = *v11; /*0xffd82f94*/ *(_DWORD *)a3 = *v11; /*0xffd82f9c*/ if ( v7 != -1 ) /*0xffd82fa6*/ { - v8 = sub_FFD90A71(0, HIWORD(v7)); /*0xffd82fb0*/ + v8 = PchPciSegmentGetCapabilityOffset(0, HIWORD(v7)); /*0xffd82fb0*/ if ( v8 ) /*0xffd82fb9*/ { v9 = (unsigned __int16 *)((char *)v11 + v8 + 12); /*0xffd82fc5*/ v5 = *(_BYTE *)v9 & 0xF; /*0xffd82fc9*/ - *((_BYTE *)a3 + 5) = ((unsigned __int16)sub_FFD8CCA5(v9) >> 4) & 0x3F; /*0xffd82fd7*/ + *((_BYTE *)a3 + 5) = ((unsigned __int16)PchPciSegmentRead16(v9) >> 4) & 0x3F; /*0xffd82fd7*/ } *((_BYTE *)a3 + 4) = v5; /*0xffd82fda*/ } @@ -214,7 +214,7 @@ } /* Source: ffd83019.c */ -int ExecuteDirtyWarmReset() +int PchExecuteDirtyWarmReset() { int result; // eax int v1; // eax @@ -229,26 +229,26 @@ _DWORD v10[2]; // [esp+0h] [ebp-10h] BYREF char v11[8]; // [esp+8h] [ebp-8h] BYREF - result = sub_FFD8D59A(); /*0xffd8301c*/ + result = PchInResumeMode(); /*0xffd8301c*/ if ( (_BYTE)result ) { DebugPrint(0x80000000, (int)"\ DirtyWarmResetExecute() - Start\ "); /*0xffd83037*/ - v1 = sub_FFD85F37(); /*0xffd8303c*/ - v2 = sub_FFD8D921(v1); /*0xffd83048*/ - if ( GetPciEndpointInfo(v2, 2u, (unsigned __int16 *)v11) ) + v1 = GetPchPolicy(); /*0xffd8303c*/ + v2 = PchGetPchPolicy(v1); /*0xffd83048*/ + if ( PchPcieRpGetEndpointInfo(v2, 2u, (unsigned __int16 *)v11) ) { *(_DWORD *)(v2 + 24) = *(_DWORD *)(v2 + 24) & 0xFF0000FF | 0x20200; /*0xffd83083*/ - v3 = sub_FFD8CBBA(2u, 0, 0); /*0xffd83086*/ - sub_FFD8CCD3(v3, 0); /*0xffd83090*/ + v3 = PchPciSegmentGetDevice(2u, 0, 0); /*0xffd83086*/ + PchPciSegmentWrite16(v3, 0); /*0xffd83090*/ } else { DebugPrint(0x80000000, (int)"ERROR: DirtyWarmReset: can't get end point device available...\ "); } - v4 = (int *)sub_FFD8CC10(); /*0xffd83099*/ + v4 = (int *)PchGetResumeStatus(); /*0xffd83099*/ v5 = v4; /*0xffd8309e*/ v6 = *v4; /*0xffd830a8*/ if ( (*v4 & 0x2000000) != 0 && v6 != -1 ) /*0xffd830b5*/ @@ -266,7 +266,7 @@ while ( (*v5 & 0x4000000) != 0 ) /*0xffd83100*/ ; /*0xffd830fc*/ } - v7 = sub_FFD8AD54(); /*0xffd83102*/ + v7 = GetPeiServicesPtr(); /*0xffd83102*/ v8 = (*(int (__cdecl **)(int, void *, _DWORD, _DWORD, _DWORD *))(*(_DWORD *)v7 + 32))(v7, &unk_FFD97FAC, 0, 0, v10); /*0xffd8311c*/ if ( v8 < 0 ) { diff --git a/PurleySktPkg/SouthClusterLbg/SiInit/Pei/SiInitPreMem/SiInitPreMem.c b/PurleySktPkg/SouthClusterLbg/SiInit/Pei/SiInitPreMem/SiInitPreMem.c index 1741550..deaf6fa 100644 --- a/PurleySktPkg/SouthClusterLbg/SiInit/Pei/SiInitPreMem/SiInitPreMem.c +++ b/PurleySktPkg/SouthClusterLbg/SiInit/Pei/SiInitPreMem/SiInitPreMem.c @@ -103,7 +103,7 @@ ); //============================================================================= -// PEI Services helper: sub_FFD8AD54 / GetPeiServicesPtr +// PEI Services helper: GetPeiServicesPtr //============================================================================= // // Retrieves the PEI Services PPI pointer. The implementation reads from @@ -210,7 +210,7 @@ // PPI Install: InstallPpi //============================================================================= // -// Thin wrapper: PeiServices->InstallPpi(PpiList) +// InstallPpi passthrough: PeiServices->InstallPpi(PpiList) // EFI_STATUS EFIAPI @@ -563,7 +563,7 @@ } //============================================================================= -// PchGetSteppingInfo: sub_FFD8BE68 - Detect PCH series from LPC ID +// PchGetSteppingInfo: Detect PCH series from LPC ID //============================================================================= // // Returns: @@ -943,7 +943,7 @@ } //============================================================================= -// PchAcpiBaseSet: sub_FFD8C632 +// PchAcpiBaseSet //============================================================================= EFI_STATUS @@ -990,7 +990,7 @@ } //============================================================================= -// PchPwrmBaseGet: sub_FFD8C909 +// PchPwrmBaseGet //============================================================================= EFI_STATUS @@ -1024,7 +1024,7 @@ } //============================================================================= -// PchPwrmBaseSet: sub_FFD8C80A +// PchPwrmBaseSet //============================================================================= EFI_STATUS @@ -1066,7 +1066,7 @@ } //============================================================================= -// PchTcoBaseSet: sub_FFD8C99B +// PchTcoBaseSet //============================================================================= EFI_STATUS @@ -1153,7 +1153,7 @@ } //============================================================================= -// GpioInitEarly: sub_FFD8B940 +// GpioInitEarly //============================================================================= EFI_STATUS @@ -1327,7 +1327,7 @@ } //============================================================================= -// SpiProtocolInit: sub_FFD8F09A +// SpiProtocolInit //============================================================================= EFI_STATUS @@ -1347,7 +1347,7 @@ } //============================================================================= -// PchInfoGetPchSeriesStr: sub_FFD8BD94 +// PchInfoGetPchSeriesStr //============================================================================= VOID @@ -1361,7 +1361,7 @@ } //============================================================================= -// PchInfoGetPchSteppingStr: sub_FFD8BB3A +// PchInfoGetPchSteppingStr //============================================================================= VOID @@ -1377,7 +1377,7 @@ } //============================================================================= -// PchInfoGetPchSkuStr: sub_FFD8C1B5 +// PchInfoGetPchSkuStr //============================================================================= VOID @@ -1388,4 +1388,4 @@ ) { AsciiStrCpyS (Buf, BufSize, "C620"); -} \ No newline at end of file +} diff --git a/PurleySktPkg/SouthClusterLbg/SiInit/Pei/SiInitPreMem/SiInitPreMem.h b/PurleySktPkg/SouthClusterLbg/SiInit/Pei/SiInitPreMem/SiInitPreMem.h index 777eed0..674fe78 100644 --- a/PurleySktPkg/SouthClusterLbg/SiInit/Pei/SiInitPreMem/SiInitPreMem.h +++ b/PurleySktPkg/SouthClusterLbg/SiInit/Pei/SiInitPreMem/SiInitPreMem.h @@ -1,7 +1,5 @@ /** @file SiInitPreMem.h -- Header for SiInitPreMem - -Copyright (c) HR650X BIOS Decompilation Project **/ #ifndef __SIINITPREMEM_H__ @@ -9,1190 +7,208 @@ #include "../uefi_headers/Uefi.h" -// -// Function Prototypes -// - -EFI_STATUS +EFI_PEI_SERVICES ** EFIAPI -PchResetInitCallback( +GetPeiServicesPtr ( VOID -); + ); -EFI_STATUS +VOID EFIAPI -PchResetCallback2( - VOID -); +DebugPrint ( + IN UINTN ErrorLevel, + IN CHAR8 *Format, + ... + ); EFI_STATUS EFIAPI -SetupTraceHubFwBar( - VOID -); +PpiInstall ( + IN EFI_PEI_PPI_DESCRIPTOR *PpiList + ); -EFI_STATUS +UINTN EFIAPI -IsPchSkuSupported( - VOID -); +StartPerformanceMeasurement ( + IN UINT64 *PerfTsc OPTIONAL, + IN UINT32 EventType, + IN VOID *GuidPtr + ); -EFI_STATUS +UINTN EFIAPI -IsDwrDetected( - VOID -); +EndPerformanceMeasurement ( + IN UINT64 *PerfTsc OPTIONAL, + IN UINT32 EventType, + IN VOID *GuidPtr + ); EFI_STATUS EFIAPI -GetPerformanceLogBuffer( - VOID -); +SiInitPreMemEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ); -EFI_STATUS +VOID EFIAPI -RecordPerformanceEntry( +SiInitPrePolicy ( VOID -); + ); -EFI_STATUS +VOID EFIAPI -DebugPrint( +PrintPchInfo ( VOID -); + ); EFI_STATUS EFIAPI -PpiInstall( +PchWdtInit ( VOID -); + ); -EFI_STATUS +BOOLEAN EFIAPI -StartPerformanceMeasurement( +PchWdtIsUnexpectedReset ( VOID -); + ); EFI_STATUS EFIAPI -EndPerformanceMeasurement( +InstallPchResetPpi ( VOID -); + ); EFI_STATUS EFIAPI -SiInitPreMemEntryPoint( +InstallPchSpiPpi ( VOID -); + ); EFI_STATUS EFIAPI -SiInitPrePolicy( +PchInitPreMem ( VOID -); + ); EFI_STATUS EFIAPI -PrintPchInfo( - VOID -); +PchAcpiBaseSet ( + IN UINT16 AcpiBase + ); EFI_STATUS EFIAPI -PchWdtInit( - VOID -); +PchPwrmBaseGet ( + OUT UINT32 *PwrmBase + ); EFI_STATUS EFIAPI -PchWdtIsUnexpectedReset( +PchPwrmBaseSet ( VOID -); + ); EFI_STATUS EFIAPI -InstallPchResetPpi( +PchTcoBaseSet ( VOID -); + ); -EFI_STATUS +VOID EFIAPI -InstallPchSpiPpi( +PchFabricErrorCheck ( VOID -); + ); EFI_STATUS EFIAPI -PchInitPreMem( - VOID -); +PchEarlyDisabledDeviceHandling ( + IN VOID *Policy + ); EFI_STATUS EFIAPI -PchAcpiBaseSet( +GpioInitEarly ( VOID -); + ); -EFI_STATUS +UINT16 EFIAPI -PchPwrmBaseGet( - VOID -); +MmioRead16 ( + IN UINT16 *Address + ); -EFI_STATUS +VOID EFIAPI -PchPwrmBaseSet( - VOID -); +MmioWrite16 ( + IN UINT16 *Address, + IN UINT16 Value + ); -EFI_STATUS +UINT32 EFIAPI -PchTcoBaseSet( - VOID -); +PchGetMmPciAddress ( + IN UINT8 Bus, + IN UINT8 Device, + IN UINT8 Function + ); -EFI_STATUS +UINT16 EFIAPI -PchFabricErrorCheck( - VOID -); +PchPciRead16 ( + IN UINT32 Address + ); -EFI_STATUS +VOID EFIAPI -PchEarlyDisabledDeviceHandling( - VOID -); +PchPciWrite32 ( + IN UINT32 Address, + IN UINT32 Data + ); -EFI_STATUS +UINT32 EFIAPI -GpioInitEarly( - VOID -); +PchPcrRead32 ( + IN UINT32 Pid, + IN UINT32 Offset + ); -EFI_STATUS +VOID EFIAPI -MmioRead16( - VOID -); +PchPcrWrite32 ( + IN UINT32 Pid, + IN UINT32 Offset, + IN UINT32 Data + ); EFI_STATUS EFIAPI -MmioWrite16( - VOID -); +SpiProtocolInit ( + OUT PCH_SPI_INSTANCE *SpiInstance + ); -EFI_STATUS +VOID EFIAPI -PchGetMmPciAddress( - VOID -); +PchInfoGetPchSeriesStr ( + OUT CHAR8 *Buf, + IN UINTN BufSize + ); -EFI_STATUS +VOID EFIAPI -PchPciRead16( - VOID -); +PchInfoGetPchSteppingStr ( + OUT CHAR8 *Buf, + IN UINTN BufSize, + IN INT16 *DeviceId + ); -EFI_STATUS +VOID EFIAPI -PchPciWrite32( - VOID -); +PchInfoGetPchSkuStr ( + OUT CHAR8 *Buf, + IN UINTN BufSize + ); -EFI_STATUS -EFIAPI -PchPcrRead32( - VOID -); - -EFI_STATUS -EFIAPI -PchPcrWrite32( - VOID -); - -EFI_STATUS -EFIAPI -SpiProtocolInit( - VOID -); - -EFI_STATUS -EFIAPI -PchInfoGetPchSeriesStr( - VOID -); - -EFI_STATUS -EFIAPI -PchInfoGetPchSteppingStr( - VOID -); - -EFI_STATUS -EFIAPI -PchInfoGetPchSkuStr( - VOID -); - -EFI_STATUS -EFIAPI -7 (0x80) indicates SiInitPrePolicy has already been called.( - VOID -); - -EFI_STATUS -EFIAPI -UINT8 *mSiInitPolicyDoneFlag = (UINT8 *)0xFA044;( - VOID -); - -EFI_STATUS -EFIAPI -log entry type: the entry point records 0x50E0 as the event( - VOID -); - -EFI_STATUS -EFIAPI -(20704 decimal) for the SiInitPrePolicy performance measurement.( - VOID -); - -EFI_STATUS -EFIAPI -global PEI services pointer (maintained across calls)( - VOID -); - -EFI_STATUS -EFIAPI -EFI_PEI_SERVICES **mPeiServices = NULL;( - VOID -); - -EFI_STATUS -EFIAPI -declarations of internal sub-functions( - VOID -); - -EFI_STATUS -EFIAPI -Services helper: sub_FFD8AD54 / GetPeiServicesPtr( - VOID -); - -EFI_STATUS -EFIAPI -the PEI Services PPI pointer. The implementation reads from( - VOID -); - -EFI_STATUS -EFIAPI -IDT-based PEI Services Table Pointer.( - VOID -); - -EFI_STATUS -EFIAPI -**( - VOID -); - -EFI_STATUS -EFIAPI -Output: GetReportStatusCodePpi / GetDebugInterface( - VOID -); - -EFI_STATUS -EFIAPI -the ReportStatusCode PPI (GUID: 36232936-0E76-31C8-...)( - VOID -); - -EFI_STATUS -EFIAPI -caches it for use by DebugPrint.( - VOID -); - -EFI_STATUS -EFIAPI -REPORT_STATUS_CODE_PPI *( - VOID -); - -EFI_STATUS -EFIAPI -Print: DebugPrint( - VOID -); - -EFI_STATUS -EFIAPI -debug print via ReportStatusCode PPI.( - VOID -); - -EFI_STATUS -EFIAPI -emits if the requested error level matches the current debug mask.( - VOID -); - -EFI_STATUS -EFIAPI -with:( - VOID -); - -EFI_STATUS -EFIAPI -(0x40 = 64) for normal trace messages( - VOID -); - -EFI_STATUS -EFIAPI -(0x80000000) for error/assert messages( - VOID -); - -EFI_STATUS -EFIAPI -EFIAPI( - VOID -); - -EFI_STATUS -EFIAPI -if the current debug level has this ErrorLevel enabled.( - VOID -); - -EFI_STATUS -EFIAPI -debug mask is read from a global variable.( - VOID -); - -EFI_STATUS -EFIAPI -= GetDebugMask ();( - VOID -); - -EFI_STATUS -EFIAPI -Install: InstallPpi( - VOID -); - -EFI_STATUS -EFIAPI -wrapper: PeiServices->InstallPpi(PpiList)( - VOID -); - -EFI_STATUS -EFIAPI -Log: RecordPerformanceEntry / EndPerformanceMeasurement( - VOID -); - -EFI_STATUS -EFIAPI -a TSC-based performance entry. Uses a buffer tracked via( - VOID -); - -EFI_STATUS -EFIAPI -that returns a log array.( - VOID -); - -EFI_STATUS -EFIAPI -VOID( - VOID -); - -EFI_STATUS -EFIAPI -the HOB-based performance log buffer. If no HOB exists( - VOID -); - -EFI_STATUS -EFIAPI -Entry Point: _ModuleEntryPoint (0xffd7f7a1)( - VOID -); - -EFI_STATUS -EFIAPI -0: One-time initialization guard( - VOID -); - -EFI_STATUS -EFIAPI -bit 7 of the flag byte at mSiInitPolicyDoneFlag (0xFA044).( - VOID -); - -EFI_STATUS -EFIAPI -not set, mark as done. This is an anti-double-call protection.( - VOID -); - -EFI_STATUS -EFIAPI -((*mSiInitPolicyDoneFlag & BIT7) == 0) {( - VOID -); - -EFI_STATUS -EFIAPI -1: SiInitPrePolicy - Early silicon policy init (TraceHub)( - VOID -); - -EFI_STATUS -EFIAPI -(EFI_D_INFO, "SiInitPrePolicy() Start\n");( - VOID -); - -EFI_STATUS -EFIAPI -performance measurement( - VOID -); - -EFI_STATUS -EFIAPI -type = 20704 (0x50E0)( - VOID -); - -EFI_STATUS -EFIAPI -= AsmReadTsc ();( - VOID -); - -EFI_STATUS -EFIAPI -2a: PchInitPrePolicy - PCH identification( - VOID -); - -EFI_STATUS -EFIAPI -();( - VOID -); - -EFI_STATUS -EFIAPI -2b: PchInitPrePolicy - WDT, Reset, SPI, GPIO( - VOID -); - -EFI_STATUS -EFIAPI -3: Notify that SiInitPrePolicy is complete( - VOID -); - -EFI_STATUS -EFIAPI -= GetPeiServicesPtr ();( - VOID -); - -EFI_STATUS -EFIAPI -Intel TraceHub (chipset trace/debug hub) MMIO BARs.( - VOID -); - -EFI_STATUS -EFIAPI -TraceHub device is at PCI B:D:F 0:20:7 (D20:F7) on the PCH.( - VOID -); - -EFI_STATUS -EFIAPI -PCH power management base address( - VOID -); - -EFI_STATUS -EFIAPI -(&PchPwrmBase);( - VOID -); - -EFI_STATUS -EFIAPI -TraceHub device via PCH MMIO config (D20:F7 = B:D:F 0:20:7)( - VOID -); - -EFI_STATUS -EFIAPI -= (TRACEHUB_DEVICE *)(UINTN)PchGetMmPciAddress (0, 20, 7);( - VOID -); - -EFI_STATUS -EFIAPI -TraceHub presence (VID/DID = 0xFFFF means not present)( - VOID -); - -EFI_STATUS -EFIAPI -(MmioRead16 (&TraceHub->VendorId) == 0xFFFF) {( - VOID -); - -EFI_STATUS -EFIAPI -if TraceHub was already initialized (MSE bit)( - VOID -); - -EFI_STATUS -EFIAPI -((TraceHub->Command & BIT1) != 0) {( - VOID -); - -EFI_STATUS -EFIAPI -(EFI_D_INFO, "TraceHubInitialize() - Setting MTB_BAR\n");( - VOID -); - -EFI_STATUS -EFIAPI -(bit 1) is the minimum - enables MMIO for MTB only( - VOID -); - -EFI_STATUS -EFIAPI -MSE only initially( - VOID -); - -EFI_STATUS -EFIAPI -SCRPD0.24 to decide if SW/FW BARs should be programmed( - VOID -); - -EFI_STATUS -EFIAPI -= *((volatile UINT32 *)TRACE_HUB_SCRPD0_REG);( - VOID -); - -EFI_STATUS -EFIAPI -SW trace buffer frequency and BAR( - VOID -); - -EFI_STATUS -EFIAPI -disable to program BARs( - VOID -); - -EFI_STATUS -EFIAPI -FW_BAR (firmware trace buffer - at offset 0x20)( - VOID -); - -EFI_STATUS -EFIAPI -(EFI_D_INFO, "TraceHubInitialize() - Setting FW_BAR\n");( - VOID -); - -EFI_STATUS -EFIAPI -both MSE and BME for full TraceHub operation( - VOID -); - -EFI_STATUS -EFIAPI -(EFI_D_INFO, "TraceHubInitialize() - Enabling MSE and BME\n");( - VOID -); - -EFI_STATUS -EFIAPI -+ BME( - VOID -); - -EFI_STATUS -EFIAPI -(Self-Test Trace) disconnected - disable TraceHub( - VOID -); - -EFI_STATUS -EFIAPI -the TraceHub FW_BAR at PCI config space offset 0x20.( - VOID -); - -EFI_STATUS -EFIAPI -is mapped to 0xFE0C0000 with an 8KB window.( - VOID -); - -EFI_STATUS -EFIAPI -DMIC.SRL (DMIC is locked), read from PCR( - VOID -); - -EFI_STATUS -EFIAPI -= PchPcrRead32 (PID_PSF1, 4);( - VOID -); - -EFI_STATUS -EFIAPI -LPC device is present( - VOID -); - -EFI_STATUS -EFIAPI -= (UINT32 *)(UINTN)PchGetMmPciAddress (0, 31, 0);( - VOID -); - -EFI_STATUS -EFIAPI -FW_BAR at PCI config offset 0x20 (expansion ROM BAR)( - VOID -); - -EFI_STATUS -EFIAPI -value 0xFE0C0000 (8KB).( - VOID -); - -EFI_STATUS -EFIAPI -PCH device information and logs it via DebugPrint.( - VOID -); - -EFI_STATUS -EFIAPI -PCH series (returns: 1 = LBG, 2 = SPX)( - VOID -); - -EFI_STATUS -EFIAPI -= PchGetSteppingInfo ();( - VOID -); - -EFI_STATUS -EFIAPI -series string( - VOID -); - -EFI_STATUS -EFIAPI -= sizeof (SeriesStr);( - VOID -); - -EFI_STATUS -EFIAPI -stepping string( - VOID -); - -EFI_STATUS -EFIAPI -= sizeof (SteppingStr);( - VOID -); - -EFI_STATUS -EFIAPI -SKU string( - VOID -); - -EFI_STATUS -EFIAPI -= sizeof (SkuStr);( - VOID -); - -EFI_STATUS -EFIAPI -= PchLbg (Lewisburg / PCH-H): IDs A1C0-A1CF, A243, A240-A24F( - VOID -); - -EFI_STATUS -EFIAPI -= PchSpx (Sphinx / PCH-LP): IDs 9D40-9D43, 9D46, 9D48( - VOID -); - -EFI_STATUS -EFIAPI -LPC Device ID from D31:F0 offset +2( - VOID -); - -EFI_STATUS -EFIAPI -= MmioRead16 (( - VOID -); - -EFI_STATUS -EFIAPI -Lewisburg (LBG) range( - VOID -); - -EFI_STATUS -EFIAPI -((LpcDeviceId >= V_LBG_DEVICE_ID_MIN && LpcDeviceId <= V_LBG_DEVICE_ID_MAX) ||( - VOID -); - -EFI_STATUS -EFIAPI -Sphinx (SPX) range( - VOID -); - -EFI_STATUS -EFIAPI -if (LpcDeviceId == 0x9D40 || LpcDeviceId == 0x9D41 ||( - VOID -); - -EFI_STATUS -EFIAPI -WDT status from PCH and configures WDT control bits.( - VOID -); - -EFI_STATUS -EFIAPI -WDT status (BIT14)( - VOID -); - -EFI_STATUS -EFIAPI -((WdtReadback & BIT14) != 0) {( - VOID -); - -EFI_STATUS -EFIAPI -HOB list from PEI services( - VOID -); - -EFI_STATUS -EFIAPI -new WDT value based on expiration and unexpected reset( - VOID -); - -EFI_STATUS -EFIAPI -((WdtReadback & BIT24) != 0) {( - VOID -); - -EFI_STATUS -EFIAPI -updated WDT value( - VOID -); - -EFI_STATUS -EFIAPI -(WdtBase, WdtNewValue);( - VOID -); - -EFI_STATUS -EFIAPI -WDT PPIs( - VOID -); - -EFI_STATUS -EFIAPI -= (*PeiServices)->InstallPpi (PeiServices, &gPchWdtPpiGuid);( - VOID -); - -EFI_STATUS -EFIAPI -whether the WDT unexpected reset flag is set.( - VOID -); - -EFI_STATUS -EFIAPI -two reset-related PPIs:( - VOID -); - -EFI_STATUS -EFIAPI -and install PCH Reset PPI( - VOID -); - -EFI_STATUS -EFIAPI -= (PCH_RESET_PPI *)AllocatePages (EFI_SIZE_TO_PAGES (sizeof (PCH_RESET_PPI)));( - VOID -); - -EFI_STATUS -EFIAPI -second Reset PPI( - VOID -); - -EFI_STATUS -EFIAPI -= (PCH_RESET_INIT_PPI *)AllocatePages (EFI_SIZE_TO_PAGES (sizeof (PCH_RESET_INIT_PPI)));( - VOID -); - -EFI_STATUS -EFIAPI -SPI BAR0 at D31:F5, offset 0x10 (BAR0)( - VOID -); - -EFI_STATUS -EFIAPI -= (UINT32 *)(UINTN)PchGetMmPciAddress (0, 31, 5);( - VOID -); - -EFI_STATUS -EFIAPI -MSE( - VOID -); - -EFI_STATUS -EFIAPI -and initialize SPI instance( - VOID -); - -EFI_STATUS -EFIAPI -= (PCH_SPI_INSTANCE *)AllocatePages (( - VOID -); - -EFI_STATUS -EFIAPI -PPI descriptor( - VOID -); - -EFI_STATUS -EFIAPI -1: Validate PCH SKU (must have LPC device)( - VOID -); - -EFI_STATUS -EFIAPI -(!IsPchSkuSupported ()) {( - VOID -); - -EFI_STATUS -EFIAPI -2: Ensure SBREG is programmed (D31:F0, register 0x10/0x14)( - VOID -); - -EFI_STATUS -EFIAPI -3: Program PCH cycle decoding bases( - VOID -); - -EFI_STATUS -EFIAPI -(R_PCH_ACPI_PM_BASE);( - VOID -); - -EFI_STATUS -EFIAPI -4: Validate PCH PWRM base is non-zero( - VOID -); - -EFI_STATUS -EFIAPI -(EFI_D_INFO, "PCH PWRM Base needs to be programmed before here\n");( - VOID -); - -EFI_STATUS -EFIAPI -5: Check DWR condition( - VOID -); - -EFI_STATUS -EFIAPI -= IsDwrDetected ();( - VOID -); - -EFI_STATUS -EFIAPI -6: Fabric error check and early device handling( - VOID -); - -EFI_STATUS -EFIAPI -7: Install PCH Init PreMem PPI( - VOID -); - -EFI_STATUS -EFIAPI -= PpiInstall ((EFI_PEI_PPI_DESCRIPTOR *)(UINTN)0xFFD980CC);( - VOID -); - -EFI_STATUS -EFIAPI -address( - VOID -); - -EFI_STATUS -EFIAPI -(AcpiBase == 0 || AcpiBase < 0x100) {( - VOID -); - -EFI_STATUS -EFIAPI -DMIC.SRL (DMIC locked via PCR read)( - VOID -); - -EFI_STATUS -EFIAPI -ACPI base at D31:F2 offset 0x44( - VOID -); - -EFI_STATUS -EFIAPI -0x44( - VOID -); - -EFI_STATUS -EFIAPI -enable bit( - VOID -); - -EFI_STATUS -EFIAPI -LPC device is present (D31:F0)( - VOID -); - -EFI_STATUS -EFIAPI -PWRM base from D31:F2 offset 0x48( - VOID -); - -EFI_STATUS -EFIAPI -= (UINT32 *)(UINTN)PchGetMmPciAddress (0, 31, 2);( - VOID -); - -EFI_STATUS -EFIAPI -DMIC.SRL lock( - VOID -); - -EFI_STATUS -EFIAPI -D31:F2 for PWRM base config( - VOID -); - -EFI_STATUS -EFIAPI -PWRM base at offset 0x48( - VOID -); - -EFI_STATUS -EFIAPI -base address( - VOID -); - -EFI_STATUS -EFIAPI -DMIC.SRL( - VOID -); - -EFI_STATUS -EFIAPI -D31:F4 for TCO registers( - VOID -); - -EFI_STATUS -EFIAPI -= (UINT32 *)(UINTN)PchGetMmPciAddress (0, 31, 4);( - VOID -); - -EFI_STATUS -EFIAPI -if TCO is already locked( - VOID -); - -EFI_STATUS -EFIAPI -(((UINT8 *)PmDevice)[0x54] & 1) {( - VOID -); - -EFI_STATUS -EFIAPI -TCO base at offset 0x54/0x55( - VOID -); - -EFI_STATUS -EFIAPI -through a table at unk_FFD980CC defining PSF( - VOID -); - -EFI_STATUS -EFIAPI -errors found, creates a HOB with error status.( - VOID -); - -EFI_STATUS -EFIAPI -(EFI_D_INFO, "PchEarlyDisabledDeviceHandling() - End\n");( - VOID -); - -EFI_STATUS -EFIAPI -13 groups of 2 GPIO pads each (groups 0x100 through 0x10C)( - VOID -); - -EFI_STATUS -EFIAPI -(GpioPad = 256; GpioPad < 269; GpioPad++) {( - VOID -); - -EFI_STATUS -EFIAPI -functions( - VOID -); - -EFI_STATUS -EFIAPI -DWR (Debug Warranty Reset) condition.( - VOID -); - -EFI_STATUS -EFIAPI -TRUE if a DWR condition is detected.( - VOID -); - -EFI_STATUS -EFIAPI -FALSE;( - VOID -); - -EFI_STATUS -EFIAPI -helpers( - VOID -); - -EFI_STATUS -EFIAPI -for completion( - VOID -); - -EFI_STATUS -EFIAPI -((*(volatile UINT32 *)(UINTN)(SbRegBase + 0) & BIT31) != 0) {( - VOID -); - -#endif /* __SIINITPREMEM_H__ */ \ No newline at end of file +#endif diff --git a/PurleySktPkg/SouthClusterLbg/SiInit/Pei/SiInitPreMem/XhciGpioPpiGlue.c b/PurleySktPkg/SouthClusterLbg/SiInit/Pei/SiInitPreMem/XhciGpioPpiGlue.c index b41f213..4950400 100644 --- a/PurleySktPkg/SouthClusterLbg/SiInit/Pei/SiInitPreMem/XhciGpioPpiGlue.c +++ b/PurleySktPkg/SouthClusterLbg/SiInit/Pei/SiInitPreMem/XhciGpioPpiGlue.c @@ -13,28 +13,28 @@ DebugPrint(64, (int)"ConfigureXhci() - Start\n"); /*0xffd860c8*/ v2 = *(_DWORD *)(this + 3510); /*0xffd860cd*/ - sub_FFD8BE68(); /*0xffd860d9*/ - v3 = sub_FFD8CBBA(0, 20, 0); /*0xffd860f1*/ - sub_FFD8C76F(&v8); /*0xffd860f3*/ + PchGetSteppingInfo(); /*0xffd860d9*/ + v3 = PchPciSegmentGetDevice(0, 20, 0); /*0xffd860f1*/ + PchPwrmBaseSet(&v8); /*0xffd860f3*/ *(_DWORD *)(v3 + 16) = v2; /*0xffd860fd*/ - sub_FFD8CC4F(v3 + 4, 6); /*0xffd86101*/ + PchPciSegmentSetBar(v3 + 4, 6); /*0xffd86101*/ if ( (*(_BYTE *)(this + 2263) & 2) != 0 ) /*0xffd86109*/ *(_DWORD *)(v2 + 33004) |= 1u; /*0xffd86114*/ v4 = GetPeiServicesPtr(); /*0xffd8611a*/ (*(void (__cdecl **)(int, int *))(*(_DWORD *)v4 + 40))(v4, &n17); /*0xffd86127*/ if ( n17 == 17 ) /*0xffd86133*/ - sub_FFD86747(this + 2263); /*0xffd86137*/ + XhciConfigureSsic(this + 2263); /*0xffd86137*/ else - sub_FFD85FBC(); /*0xffd8613e*/ - sub_FFD861FF(this, v2, v3); /*0xffd86148*/ - sub_FFD8701A(this, v2); /*0xffd86151*/ + XhciDisableSsic(); /*0xffd8613e*/ + XhciConfigurePorts(this, v2, v3); /*0xffd86148*/ + XhciConfigureMisc(this, v2); /*0xffd86151*/ DebugPrint(64, (int)"xHCI: XhciPostInitDone Start\n"); *(_DWORD *)(v2 + 32992) &= ~0x10000u; /*0xffd86174*/ *(_DWORD *)(v3 + 80) = 265186911; /*0xffd8617c*/ DebugPrint(64, (int)"xHCI: XhciPostInitDone End\n"); if ( (*(_BYTE *)(this + 2263) & 4) != 0 ) /*0xffd8618e*/ { - sub_FFD86E37(this + 2263, v3); /*0xffd86194*/ + XhciClearOverCurrentRegisters(this + 2263, v3); /*0xffd86194*/ } else { @@ -49,15 +49,15 @@ } while ( n8 ); /*0xffd861c8*/ } - sub_FFD8687F(this + 2263, v2); /*0xffd861ce*/ - sub_FFD8CC6A(v3 + 4, 65529); /*0xffd861db*/ + XhciFinalizePreMem(this + 2263, v2); /*0xffd861ce*/ + PchPciSegmentClearBar(v3 + 4, 65529); /*0xffd861db*/ *(_DWORD *)(v3 + 16) = 0; /*0xffd861e7*/ DebugPrint(64, (int)"ConfigureXhciPreMem () - End\n"); /*0xffd861ee*/ return 0; /*0xffd861f5*/ } /* Source: ffd8690c.c */ -int __fastcall ProgramUsb2Afe(int a1, int a2) +int __fastcall XhciProgramUsb2Afe(int a1, int a2) { int v2; // ebp int n15_1; // ebx @@ -85,89 +85,89 @@ v19 = a1; /*0xffd86915*/ v18 = a2; /*0xffd86920*/ DebugPrint(64, (int)"xHCI: Usb2AfeProgramming Start\n"); - sub_FFD8BE68(); /*0xffd86929*/ - sub_FFD8BB3A(v13); /*0xffd8692e*/ - sub_FFD8C909(&v22); /*0xffd86937*/ - n15_1 = sub_FFD8CBBA(0, 31, 2); /*0xffd8694b*/ + PchGetSteppingInfo(); /*0xffd86929*/ + PchInfoGetPchSteppingStr(v13); /*0xffd8692e*/ + PchPwrmBaseGet(&v22); /*0xffd86937*/ + n15_1 = PchPciSegmentGetDevice(0, 31, 2); /*0xffd8694b*/ n15 = n15_1; /*0xffd86951*/ - sub_FFD8ADCC(202, 6, 16427, 0, 0, 0, &n1342177280, &v14, 6); /*0xffd86970*/ + PchPciSegmentRead32(202, 6, 16427, 0, 0, 0, &n1342177280, &v14, 6); /*0xffd86970*/ n1342177280 |= 0x400000u; /*0xffd86975*/ - sub_FFD8ADCC(202, 7, 16427, 0, 1u, 0, &n1342177280, &v14, 7); /*0xffd86999*/ - sub_FFD8A1DE(n1342177280, v2, n15_1); /*0xffd869a9*/ - sub_FFD8ADCC(202, 6, 16385, 0, 0, 0, &n1342177280, &v14, 6); /*0xffd869cc*/ + PchPciSegmentWrite32(202, 7, 16427, 0, 1u, 0, &n1342177280, &v14, 7); /*0xffd86999*/ + PchPciSegmentOr32(n1342177280, v2, n15_1); /*0xffd869a9*/ + PchPciSegmentRead32(202, 6, 16385, 0, 0, 0, &n1342177280, &v14, 6); /*0xffd869cc*/ n1342177280 |= 0x3000000u; /*0xffd869d8*/ - sub_FFD8ADCC(202, 7, 16385, 0, 1u, 0, &n1342177280, &v14, 7); /*0xffd869f5*/ - sub_FFD8A1DE(n1342177280, v2, n15_1); /*0xffd86a05*/ - sub_FFD8ADCC(202, 6, 28672, 0, 0, 0, &n1342177280, &v14, 6); /*0xffd86a2a*/ + PchPciSegmentWrite32(202, 7, 16385, 0, 1u, 0, &n1342177280, &v14, 7); /*0xffd869f5*/ + PchPciSegmentOr32(n1342177280, v2, n15_1); /*0xffd86a05*/ + PchPciSegmentRead32(202, 6, 28672, 0, 0, 0, &n1342177280, &v14, 6); /*0xffd86a2a*/ n1342177280 = (unsigned __int16)n1342177280 | 0x50500000; /*0xffd86a41*/ - sub_FFD8ADCC(202, 7, 28672, 0, 1u, 0, &n1342177280, &v14, 7); /*0xffd86a59*/ - sub_FFD8A1DE(n1342177280, v2, n15_1); /*0xffd86a69*/ + PchPciSegmentWrite32(202, 7, 28672, 0, 1u, 0, &n1342177280, &v14, 7); /*0xffd86a59*/ + PchPciSegmentOr32(n1342177280, v2, n15_1); /*0xffd86a69*/ n1342177280 = 1342177280; /*0xffd86a71*/ - sub_FFD8ADCC(202, 7, 28724, 0, 1u, 0, &n1342177280, &v14, 7); /*0xffd86a95*/ - sub_FFD8A1DE(n1342177280, v2, n15_1); /*0xffd86aa5*/ + PchPciSegmentWrite32(202, 7, 28724, 0, 1u, 0, &n1342177280, &v14, 7); /*0xffd86a95*/ + PchPciSegmentOr32(n1342177280, v2, n15_1); /*0xffd86aa5*/ n1342177280 = 175176950; /*0xffd86aad*/ - sub_FFD8ADCC(202, 7, 28728, 0, 1u, 0, &n1342177280, &v14, 7); /*0xffd86ad3*/ - sub_FFD8A1DE(n1342177280, v2, n15_1); /*0xffd86ae3*/ + PchPciSegmentWrite32(202, 7, 28728, 0, 1u, 0, &n1342177280, &v14, 7); /*0xffd86ad3*/ + PchPciSegmentOr32(n1342177280, v2, n15_1); /*0xffd86ae3*/ n1342177280 = 532398080; /*0xffd86aeb*/ - sub_FFD8ADCC(202, 7, 28732, 0, 1u, 0, &n1342177280, &v14, 7); /*0xffd86b0f*/ - sub_FFD8A1DE(n1342177280, v2, n15_1); /*0xffd86b1f*/ + PchPciSegmentWrite32(202, 7, 28732, 0, 1u, 0, &n1342177280, &v14, 7); /*0xffd86b0f*/ + PchPciSegmentOr32(n1342177280, v2, n15_1); /*0xffd86b1f*/ n1342177280 = 34432; /*0xffd86b27*/ - sub_FFD8ADCC(202, 7, 32516, 0, 1u, 0, &n1342177280, &v14, 7); /*0xffd86b4d*/ - sub_FFD8A1DE(n1342177280, v2, n15_1); /*0xffd86b5d*/ + PchPciSegmentWrite32(202, 7, 32516, 0, 1u, 0, &n1342177280, &v14, 7); /*0xffd86b4d*/ + PchPciSegmentOr32(n1342177280, v2, n15_1); /*0xffd86b5d*/ n1342177280 = 67251212; /*0xffd86b65*/ - sub_FFD8ADCC(202, 7, 28712, 0, 1u, 0, &n1342177280, &v14, 7); /*0xffd86b8b*/ - sub_FFD8A1DE(n1342177280, v2, n15_1); /*0xffd86b9b*/ + PchPciSegmentWrite32(202, 7, 28712, 0, 1u, 0, &n1342177280, &v14, 7); /*0xffd86b8b*/ + PchPciSegmentOr32(n1342177280, v2, n15_1); /*0xffd86b9b*/ n1342177280 = 184552192; /*0xffd86ba9*/ - sub_FFD8ADCC(202, 7, 32515, 0, 1u, 0, &n1342177280, &v14, 7); /*0xffd86bc9*/ - sub_FFD8A1DE(n1342177280, v2, n15_1); /*0xffd86bd9*/ - i_4 = sub_FFD8C035(); /*0xffd86be6*/ + PchPciSegmentWrite32(202, 7, 32515, 0, 1u, 0, &n1342177280, &v14, 7); /*0xffd86bc9*/ + PchPciSegmentOr32(n1342177280, v2, n15_1); /*0xffd86bd9*/ + i_4 = PchGetPchPortCount(); /*0xffd86be6*/ i_1 = 1; /*0xffd86be8*/ i_3 = i_4; /*0xffd86bea*/ for ( i = 1; i_1 <= i_3; i = i_1 ) /*0xffd86bf4*/ { i_2 = i_1; /*0xffd86c07*/ v6 = (unsigned __int64)(i_1 | 0x40u) << 8; /*0xffd86c25*/ - sub_FFD8ADCC(202, 6, v6, SHIDWORD(v6), 0, 0, &n1342177280, &v14, 6); /*0xffd86c2c*/ + PchPciSegmentRead32(202, 6, v6, SHIDWORD(v6), 0, 0, &n1342177280, &v14, 6); /*0xffd86c2c*/ v7 = 2 * i; /*0xffd86c3d*/ n1342177280 = n1342177280 & 0xFFFF80FF /*0xffd86c87*/ | ((*(_BYTE *)(v19 + 16 * i - 3) & 7 | (8 * (*(_BYTE *)(v19 + 16 * i - 4) & 7 | (8 * (*(_BYTE *)(v19 + 16 * i - 1) & 1))))) << 8) | 0xFC000010; - sub_FFD8ADCC(202, 7, v6, SHIDWORD(v6), 1u, 0, &n1342177280, &v14, 7); /*0xffd86c93*/ - sub_FFD8A1DE(n1342177280, v18, n15); /*0xffd86ca9*/ + PchPciSegmentWrite32(202, 7, v6, SHIDWORD(v6), 1u, 0, &n1342177280, &v14, 7); /*0xffd86c93*/ + PchPciSegmentOr32(n1342177280, v18, n15); /*0xffd86ca9*/ v8 = (unsigned __int64)i_2 >> 24; /*0xffd86cb9*/ LODWORD(v6) = i_2 << 8; /*0xffd86cbd*/ HIDWORD(v6) = (i_2 << 8) | 0x4026; /*0xffd86cca*/ n1342177280 = 0; /*0xffd86cd8*/ - sub_FFD8ADCC(202, 6, SHIDWORD(v6), v8, 0, 0, &n1342177280, &v14, 6); /*0xffd86ce2*/ + PchPciSegmentRead32(202, 6, SHIDWORD(v6), v8, 0, 0, &n1342177280, &v14, 6); /*0xffd86ce2*/ n1342177280 ^= (n1342177280 ^ (*(unsigned __int8 *)(v19 + 8 * v7 - 2) << 23)) & 0x1800000; /*0xffd86d0b*/ - sub_FFD8ADCC(202, 7, SHIDWORD(v6), v8, 1u, 0, &n1342177280, &v14, 7); /*0xffd86d22*/ + PchPciSegmentWrite32(202, 7, SHIDWORD(v6), v8, 1u, 0, &n1342177280, &v14, 7); /*0xffd86d22*/ n15_1 = n15; /*0xffd86d27*/ - sub_FFD8A1DE(n1342177280, v18, n15); /*0xffd86d39*/ + PchPciSegmentOr32(n1342177280, v18, n15); /*0xffd86d39*/ LODWORD(v6) = v6 | 0x4008; /*0xffd86d47*/ - sub_FFD8ADCC(202, 6, v6, v8, 0, 0, &n1342177280, &v14, 6); /*0xffd86d61*/ + PchPciSegmentRead32(202, 6, v6, v8, 0, 0, &n1342177280, &v14, 6); /*0xffd86d61*/ n1342177280 = n1342177280 & 0xFFFFC17F | 0x1A80; /*0xffd86d7c*/ - sub_FFD8ADCC(202, 7, v6, v8, 1u, 0, &n1342177280, &v14, 7); /*0xffd86d94*/ + PchPciSegmentWrite32(202, 7, v6, v8, 1u, 0, &n1342177280, &v14, 7); /*0xffd86d94*/ v2 = v18; /*0xffd86d99*/ - sub_FFD8A1DE(n1342177280, v18, n15_1); /*0xffd86da8*/ + PchPciSegmentOr32(n1342177280, v18, n15_1); /*0xffd86da8*/ i_1 = i + 1; /*0xffd86db4*/ } - if ( sub_FFD8BE68() == 2 ) /*0xffd86dcc*/ + if ( PchGetSteppingInfo() == 2 ) /*0xffd86dcc*/ { - i_3 = sub_FFD89FDC(&i_2); /*0xffd86ddd*/ - v9 = (_DWORD *)sub_FFD8A048(); /*0xffd86de1*/ + i_3 = PchGetPchPortCount(&i_2); /*0xffd86ddd*/ + v9 = (_DWORD *)PchGetPchPortCount(); /*0xffd86de1*/ v10 = v9; /*0xffd86de6*/ if ( v9 ) /*0xffd86dea*/ { v11 = i_2 + *v9; /*0xffd86df2*/ n15 = 15; /*0xffd86df8*/ - sub_FFD8D51B(v11, &n15, 4); /*0xffd86e00*/ + PchPciSegmentWriteBuffer(v11, &n15, 4); /*0xffd86e00*/ *v10 += 4; /*0xffd86e05*/ if ( i_3 == 1 ) /*0xffd86e0e*/ - sub_FFD8A02F(n15_1); /*0xffd86e12*/ + PchPciSegmentClearDevice(n15_1); /*0xffd86e12*/ } } - sub_FFD8A2C4(v2, n15_1); /*0xffd86e1b*/ + PchPciSegmentAndThenOr(v2, n15_1); /*0xffd86e1b*/ result = *(_DWORD *)(v22 + 24) | 0x20000000; /*0xffd86e2a*/ *(_DWORD *)(v22 + 24) = result; /*0xffd86e2f*/ return result; /*0xffd86e24*/ @@ -186,57 +186,57 @@ unsigned int v10; // [esp+10h] [ebp-4h] BYREF v2 = *(_DWORD *)(this + 3510); /*0xffd87b11*/ - v3 = sub_FFD8CBBA(0, 20, 1); /*0xffd87b1d*/ - if ( (unsigned __int16)sub_FFD8CCA5((unsigned __int16 *)v3) == 0xFFFF ) + v3 = PchPciSegmentGetDevice(0, 20, 1); /*0xffd87b1d*/ + if ( (unsigned __int16)PchPciSegmentRead16((unsigned __int16 *)v3) == 0xFFFF ) { DebugPrint(64, (int)"xDCI: Pci device NOT found\n"); return -2147483634; /*0xffd87b3e*/ } else { - v5 = sub_FFD8CBBA(0, 20, 0); /*0xffd87b63*/ - sub_FFD8C578(-1, 63); /*0xffd87b65*/ - sub_FFD8C5B5(); /*0xffd87b6a*/ + v5 = PchPciSegmentGetDevice(0, 20, 0); /*0xffd87b63*/ + PchPciSegmentAndThenOr(-1, 63); /*0xffd87b65*/ + PchPciSegmentWrite16(); /*0xffd87b6a*/ if ( (*(_BYTE *)(this + 2683) & 1) != 0 ) { *(_DWORD *)(v5 + 16) = v2; /*0xffd87cfb*/ - sub_FFD8CC4F(v5 + 4, 2); /*0xffd87cfe*/ + PchPciSegmentSetBar(v5 + 4, 2); /*0xffd87cfe*/ *(_DWORD *)(v2 + 32984) &= 0xFFCFFFFF; /*0xffd87d11*/ - sub_FFD8CC6A(v5 + 4, 65533); /*0xffd87d1e*/ + PchPciSegmentClearBar(v5 + 4, 65533); /*0xffd87d1e*/ *(_DWORD *)(v5 + 16) = 0; /*0xffd87d2b*/ - sub_FFD8CC85(4); /*0xffd87d34*/ + PchPciSegmentFlush(4); /*0xffd87d34*/ } else { DebugPrint(64, (int)"xDCI: Device disabled\n"); *(_DWORD *)(v5 + 16) = v2; /*0xffd87b91*/ - sub_FFD8CC4F(v5 + 4, 2); /*0xffd87b95*/ + PchPciSegmentSetBar(v5 + 4, 2); /*0xffd87b95*/ *(_DWORD *)(v2 + 32984) |= 0x200000u; /*0xffd87ba5*/ n0x3E8 = 0; /*0xffd87bb6*/ *(_DWORD *)(v2 + 32984) &= ~0x100000u; /*0xffd87bb8*/ while ( (*(_DWORD *)(v2 + 32988) & 0x20000000) == 0 && n0x3E8 < 0x3E8 ) /*0xffd87bc6*/ { - sub_FFD7FA46(0x64u); /*0xffd87bcb*/ + Stall(0x64u); /*0xffd87bcb*/ ++n0x3E8; /*0xffd87bd0*/ } *(_DWORD *)(v2 + 32984) = *(_DWORD *)(v2 + 32984) & 0xFFFFFFFC | 1; /*0xffd87bf4*/ - sub_FFD8CC6A(v5 + 4, 65533); /*0xffd87bfa*/ + PchPciSegmentClearBar(v5 + 4, 65533); /*0xffd87bfa*/ *(_DWORD *)(v5 + 16) = 0; /*0xffd87c01*/ *(_DWORD *)(v3 + 16) = v2; /*0xffd87c0c*/ - sub_FFD8CC4F(v3 + 4, 2); /*0xffd87c0f*/ + PchPciSegmentSetBar(v3 + 4, 2); /*0xffd87c0f*/ *(_DWORD *)(v2 + 49424) |= 2u; /*0xffd87c23*/ *(_DWORD *)(v2 + 49664) |= 0x40u; /*0xffd87c32*/ *(_DWORD *)(v2 + 49856) |= 0x8000000u; /*0xffd87c46*/ - sub_FFD8CC4F(v2 + 1112088, 3); /*0xffd87c4c*/ - for ( i = 0; (sub_FFD8CCA5((unsigned __int16 *)(v2 + 1112080)) & 0xF00) == 0 && i < 0x3E8; ++i ) /*0xffd87c51*/ - sub_FFD7FA46(0x64u); /*0xffd87c60*/ - sub_FFD8CC6A(v3 + 4, 65533); /*0xffd87c80*/ + PchPciSegmentSetBar(v2 + 1112088, 3); /*0xffd87c4c*/ + for ( i = 0; (PchPciSegmentRead16((unsigned __int16 *)(v2 + 1112080)) & 0xF00) == 0 && i < 0x3E8; ++i ) /*0xffd87c51*/ + Stall(0x64u); /*0xffd87c60*/ + PchPciSegmentClearBar(v3 + 4, 65533); /*0xffd87c80*/ *(_DWORD *)(v3 + 16) = 0; /*0xffd87c85*/ *(_DWORD *)(v3 + 132) |= 3u; /*0xffd87c95*/ - n2 = sub_FFD8BE68(); /*0xffd87ca0*/ - n35 = sub_FFD8BB3A(); /*0xffd87ca7*/ - sub_FFD8C578(-1, 256); /*0xffd87cc4*/ - sub_FFD8C909(&v10); /*0xffd87ccf*/ + n2 = PchGetSteppingInfo(); /*0xffd87ca0*/ + n35 = PchInfoGetPchSteppingStr(); /*0xffd87ca7*/ + PchPciSegmentAndThenOr(-1, 256); /*0xffd87cc4*/ + PchPwrmBaseGet(&v10); /*0xffd87ccf*/ if ( n2 == 2 && n35 >= 35 ) /*0xffd87cdc*/ *(_DWORD *)(v10 + 1576) |= 0x1000000u; /*0xffd87ced*/ } @@ -258,7 +258,7 @@ n13 = 13; /*0xffd8b94e*/ do /*0xffd8b9e0*/ { - v3 = sub_FFD8B14D(n256, this, -1, 0, 0); /*0xffd8b95f*/ + v3 = PchPcrWrite32(n256, this, -1, 0, 0); /*0xffd8b95f*/ if ( v3 < 0 ) /*0xffd8b969*/ { DebugPrint(0x80000000, (int)"\nASSERT_EFI_ERROR (Status = %r)\n", v3); /*0xffd8b976*/ @@ -269,7 +269,7 @@ 1584, "!EFI_ERROR (Status)"); } - result = sub_FFD8B14D(n256, v4, -1, 0, 0); /*0xffd8b9a3*/ + result = PchPcrWrite32(n256, v4, -1, 0, 0); /*0xffd8b9a3*/ if ( result < 0 ) /*0xffd8b9ad*/ { DebugPrint(0x80000000, (int)"\nASSERT_EFI_ERROR (Status = %r)\n", result); /*0xffd8b9ba*/ diff --git a/PurleySktPkg/SouthClusterLbg/Smbus/Smm/PchSmbusSmm/PchSmbusSmm.c b/PurleySktPkg/SouthClusterLbg/Smbus/Smm/PchSmbusSmm/PchSmbusSmm.c index c3b1cd3..00e92a0 100644 --- a/PurleySktPkg/SouthClusterLbg/Smbus/Smm/PchSmbusSmm/PchSmbusSmm.c +++ b/PurleySktPkg/SouthClusterLbg/Smbus/Smm/PchSmbusSmm/PchSmbusSmm.c @@ -10,32 +10,32 @@ #include "PchSmbusSmm.h" -// Function: ModuleEntryPoint -EFI_STATUS ModuleEntryPoint(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) +// Function: PchSmbusSmmEntryPoint +EFI_STATUS PchSmbusSmmEntryPoint(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) { __int64 v2; // rax EFI_STATUS v3; // rbx - sub_560(ImageHandle, SystemTable); + PchSmbusSmmInitialize(ImageHandle, SystemTable); qword_2188 = 0x8000000000000001uLL; - if ( !sub_2A0(&unk_2090) ) + if ( !PchSmbusSmmIsProtocolInstalled(&unk_2090) ) { - v2 = sub_958(); + v2 = PchSmbusSmmRegisterSmiEvents(); if ( v2 >= 0 || qword_2188 < 0 ) qword_2188 = v2; - sub_C00(&unk_2090); - sub_340(&unk_2090, -1); - sub_BC0( + PchSmbusSmmUnregisterSmiEvents(&unk_2090); + PchSmbusSmmCloseSmiEvents(&unk_2090, -1); + PchSmbusSmmDebugAssert( "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\PurleySktPkg\\SouthClusterLbg\\Smbus\\Smm\\PchSmbusSmm\\DEBUG\\AutoGen.c", 430, "((BOOLEAN)(0==1))"); - sub_BC0( + PchSmbusSmmDebugAssert( "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\PurleySktPkg\\SouthClusterLbg\\Smbus\\Smm\\PchSmbusSmm\\DEBUG\\AutoGen.c", 445, "((BOOLEAN)(0==1))"); } v3 = qword_2188; if ( qword_2188 < 0 ) - sub_CBC(); + PchSmbusSmmCleanup(); return v3; } diff --git a/PurleySktPkg/SouthClusterLbg/Smbus/Smm/PchSmbusSmm/PchSmbusSmm.h b/PurleySktPkg/SouthClusterLbg/Smbus/Smm/PchSmbusSmm/PchSmbusSmm.h index b20d22d..14ff297 100644 --- a/PurleySktPkg/SouthClusterLbg/Smbus/Smm/PchSmbusSmm/PchSmbusSmm.h +++ b/PurleySktPkg/SouthClusterLbg/Smbus/Smm/PchSmbusSmm/PchSmbusSmm.h @@ -26,66 +26,66 @@ ); /// -/// sub_560 +/// PchSmbusSmmInitialize /// EFI_STATUS EFIAPI -sub_560( +PchSmbusSmmInitialize( VOID ); /// -/// sub_958 +/// PchSmbusSmmRegisterSmiEvents /// EFI_STATUS EFIAPI -sub_958( +PchSmbusSmmRegisterSmiEvents( VOID ); /// -/// sub_C00 +/// PchSmbusSmmUnregisterSmiEvents /// EFI_STATUS EFIAPI -sub_C00( +PchSmbusSmmUnregisterSmiEvents( VOID ); /// -/// sub_340 +/// PchSmbusSmmCloseSmiEvents /// EFI_STATUS EFIAPI -sub_340( +PchSmbusSmmCloseSmiEvents( VOID ); /// -/// sub_BC0 +/// PchSmbusSmmDebugAssert /// EFI_STATUS EFIAPI -sub_BC0( +PchSmbusSmmDebugAssert( VOID ); /// -/// sub_2A0 +/// PchSmbusSmmIsProtocolInstalled /// EFI_STATUS EFIAPI -sub_2A0( +PchSmbusSmmIsProtocolInstalled( VOID ); /// -/// sub_CBC +/// PchSmbusSmmCleanup /// EFI_STATUS EFIAPI -sub_CBC( +PchSmbusSmmCleanup( VOID ); -#endif /* __PCHSMBUSSMM_H__ */ \ No newline at end of file +#endif /* __PCHSMBUSSMM_H__ */ diff --git a/ServerCommonPkg/Universal/GetSec/Dxe/TxtDxe/TxtDxe.c b/ServerCommonPkg/Universal/GetSec/Dxe/TxtDxe/TxtDxe.c index f8d555e..8cf227e 100644 --- a/ServerCommonPkg/Universal/GetSec/Dxe/TxtDxe/TxtDxe.c +++ b/ServerCommonPkg/Universal/GetSec/Dxe/TxtDxe/TxtDxe.c @@ -38,14 +38,14 @@ // // -// UEFI core handles -- populated by DriverInit (sub_47C) +// UEFI core handles -- populated by DriverInit // EFI_HANDLE gImageHandle = NULL; EFI_SYSTEM_TABLE *gSystemTable = NULL; EFI_BOOT_SERVICES *gBootServices = NULL; EFI_RUNTIME_SERVICES *gRuntimeServices = NULL; EFI_DXE_SERVICES *gDxeServicesTable = NULL; -VOID *mPciUsra = NULL; // MM PCI User Access (DxeMmPciBaseLib) +VOID *mMmPciBaseProtocol = NULL; // MM PCI User Access (DxeMmPciBaseLib) // // Protocol and database pointers @@ -869,7 +869,7 @@ // // Step 4: Call the platform-specific BIOS ACM launch routine. - // This is a raw assembly routine (sub_4700) that: + // This is a raw assembly routine that: // - Saves GDT/IDT // - Sets up MTRR page tables for ACM // - Clears caches (WBINVD or INVD) @@ -1378,7 +1378,7 @@ // // ============================================================================= -// Platform ACM Launch (Assembly Wrapper) -- sub_4700 +// Platform ACM Launch (Assembly Wrapper) // ============================================================================= // @@ -1415,7 +1415,7 @@ ) { // - // This function is implemented in assembly (sub_4700). The equivalent C + // This function is implemented in assembly. The equivalent C // logic is documented here for reference: // // UINT64 GdtBackup[2]; // GDT limit + base @@ -1470,7 +1470,7 @@ // // ============================================================================= -// InitializeLtDxeLib -- sub_DD0 +// InitializeLtDxeLib // ============================================================================= // @@ -1644,7 +1644,7 @@ // /** - Driver initialization -- sub_47C. + Driver initialization. Called by _ModuleEntryPoint to set up the global protocol pointers (BS, RT, DS), enable SMM, initialize the HOB list, enable MTRR for @@ -1699,11 +1699,11 @@ // // Locate the MM PCI User Access protocol (DxeMmPciBaseLib) // - if (mPciUsra == NULL) { + if (mMmPciBaseProtocol == NULL) { Status = gBootServices->LocateProtocol ( &gEfiMmPciBaseProtocolGuid, NULL, - &mPciUsra + &mMmPciBaseProtocol ); if (Status < 0) { AssertBreak ( @@ -1712,11 +1712,11 @@ "!EFI_ERROR (Status)" ); } - if (mPciUsra == NULL) { + if (mMmPciBaseProtocol == NULL) { AssertBreak ( "e:\\hs\\CpRcPkg\\Library\\DxeMmPciBaseLib\\DxeMmPciBaseLib.c", 53, - "mPciUsra != NULL" + "mMmPciBaseProtocol != NULL" ); } } @@ -1785,7 +1785,7 @@ // // ============================================================================= -// Main Driver Entry Dispatch -- original sub_AA8 +// Main Driver Entry Dispatch // ============================================================================= // @@ -1967,14 +1967,14 @@ // // ============================================================================= -// Driver Unload Handler -- sub_2FEC / sub_748 equivalent +// Driver Unload Handler // ============================================================================= // /** Driver unload / cleanup handler. - Called from the entry error path (sub_748) or when the driver is being + Called from the entry error path or when the driver is being unloaded. Closes all S3 boot script resources and SMM protocol handles opened during InitializeLtDxeLib and DriverInit. @@ -1992,7 +1992,7 @@ Unload the TxtDxe driver. Called by the UEFI core when the driver needs to be unloaded. Equivalent - to the AutoGen.c unload handler (sub_748 + sub_2FEC). + to the AutoGen.c unload handler. @param[in] ImageHandle Handle of the driver image being unloaded. @@ -2066,4 +2066,4 @@ } return Status; -} \ No newline at end of file +} diff --git a/ServerCommonPkg/Universal/GetSec/Dxe/TxtDxe/TxtDxe.h b/ServerCommonPkg/Universal/GetSec/Dxe/TxtDxe/TxtDxe.h index ed527d5..e8e573a 100644 --- a/ServerCommonPkg/Universal/GetSec/Dxe/TxtDxe/TxtDxe.h +++ b/ServerCommonPkg/Universal/GetSec/Dxe/TxtDxe/TxtDxe.h @@ -13,1558 +13,64 @@ // Function Prototypes // -EFI_STATUS -EFIAPI -TxtDxeLaunchBiosAcm( - VOID -); +EFI_STATUS EFIAPI TxtDxeLaunchBiosAcm (IN UINT64 BiosAcmAddress, IN UINT32 Flags); +VOID *EFIAPI GetDebugPrintProtocol (VOID); +VOID EFIAPI DebugPrint (IN UINTN ErrorLevel, IN CONST CHAR8 *Format, ...); +VOID EFIAPI AssertBreak (IN CONST CHAR8 *FileName, IN UINTN LineNumber, IN CONST CHAR8 *Assertion); +VOID *EFIAPI GetPcdProtocol (VOID); +VOID *EFIAPI GetHobList (VOID); +VOID *EFIAPI FindHobByGuid (IN EFI_GUID *Guid); +VOID *EFIAPI CopyMemS (OUT VOID *Destination, IN CONST VOID *Source, IN UINTN Length); +EFI_STATUS EFIAPI GetPlatformConfigVariable (IN CONST UINT16 *VariableName, IN EFI_GUID *VendorGuid, OUT VOID *Buffer, IN OUT UINTN *BufferSize); +EFI_STATUS EFIAPI SetPlatformConfigVariable (IN CONST UINT16 *VariableName, IN EFI_GUID *VendorGuid, IN UINT32 Attributes, IN UINTN DataSize, IN VOID *Buffer); +BOOLEAN EFIAPI IsLtProcessor (VOID); +BOOLEAN EFIAPI IsBiosAcmSuccessful (VOID); +BOOLEAN EFIAPI IsTxtEnabled (VOID); +EFI_STATUS EFIAPI LocateTxtDeviceMemoryPolicy (VOID); +EFI_STATUS EFIAPI LocateTxtPlatformPolicy (VOID); +EFI_STATUS EFIAPI GetMpTableApicIds (OUT UINT16 *ApCount, OUT UINT32 *ApicIdTable); +VOID EFIAPI ConfigureMachineCheckBanks (IN UINT32 Flags); +EFI_STATUS EFIAPI GetLtDxeLibSetupOption (OUT UINT8 *SetupValue); +EFI_STATUS EFIAPI GetAcmErrorType (OUT UINT8 *AcmType); +VOID EFIAPI HandleAcmError (IN UINT32 SpadHigh); +VOID EFIAPI ClearLtTpmCmosState (VOID); +VOID EFIAPI ApplyTxtPolicyToPlatformConfig (IN UINT8 PolicyByte); +EFI_STATUS EFIAPI RegisterForScheckLockConfigCallback (VOID); +EFI_STATUS EFIAPI CloseS3BootScriptResources (VOID); +EFI_STATUS EFIAPI InstallTxtDxeProtocol (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable); +VOID EFIAPI PlatformLaunchBiosAcm (IN UINT64 BiosAcmAddress, IN UINT32 Flags); +EFI_STATUS EFIAPI InitializeLtDxeLib (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable); +EFI_STATUS EFIAPI DriverInit (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable); +EFI_STATUS EFIAPI TxtDxeMain (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable); +EFI_STATUS EFIAPI TxtDxeCleanup (VOID); +EFI_STATUS EFIAPI TxtDxeUnload (IN EFI_HANDLE ImageHandle); +EFI_STATUS EFIAPI _ModuleEntryPoint (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable); -EFI_STATUS -EFIAPI -DebugPrint( - VOID -); +// +// Driver globals +// -EFI_STATUS -EFIAPI -AssertBreak( - VOID -); +extern EFI_HANDLE gImageHandle; +extern EFI_SYSTEM_TABLE *gSystemTable; +extern EFI_BOOT_SERVICES *gBootServices; +extern EFI_RUNTIME_SERVICES *gRuntimeServices; +extern EFI_DXE_SERVICES *gDxeServicesTable; +extern VOID *mMmPciBaseProtocol; +extern VOID *mPcdProtocol; +extern VOID *mHobList; +extern VOID *mDebugPrintProtocol; +extern VOID *mSmmCommunicationProtocol; +extern VOID *mSmmBase2Protocol; +extern VOID *mSmmLockBoxProtocol; +extern VOID *mPiSmmCommunicationProtocol; +extern TXT_DEVICE_MEMORY_POLICY *mTxtDeviceMemoryPolicy; +extern TXT_PLATFORM_POLICY *mTxtPlatformPolicy; +extern UINT16 mApCount; +extern UINT8 mApWakeUpVector; +extern UINT32 mApicIdTable[MAX_CPUS]; +extern BOOLEAN mBiosAcmCalled; +extern UINT8 mBiosAcmErrorCount; +extern TXT_DXE_PROTOCOL gTxtDxeProtocol; +extern EFI_HANDLE gTxtDxeProtocolHandle; -EFI_STATUS -EFIAPI -GetPlatformConfigVariable( - VOID -); - -EFI_STATUS -EFIAPI -SetPlatformConfigVariable( - VOID -); - -EFI_STATUS -EFIAPI -IsLtProcessor( - VOID -); - -EFI_STATUS -EFIAPI -IsBiosAcmSuccessful( - VOID -); - -EFI_STATUS -EFIAPI -IsTxtEnabled( - VOID -); - -EFI_STATUS -EFIAPI -LocateTxtDeviceMemoryPolicy( - VOID -); - -EFI_STATUS -EFIAPI -LocateTxtPlatformPolicy( - VOID -); - -EFI_STATUS -EFIAPI -GetMpTableApicIds( - VOID -); - -EFI_STATUS -EFIAPI -ConfigureMachineCheckBanks( - VOID -); - -EFI_STATUS -EFIAPI -GetLtDxeLibSetupOption( - VOID -); - -EFI_STATUS -EFIAPI -GetAcmErrorType( - VOID -); - -EFI_STATUS -EFIAPI -HandleAcmError( - VOID -); - -EFI_STATUS -EFIAPI -ClearLtTpmCmosState( - VOID -); - -EFI_STATUS -EFIAPI -ApplyTxtPolicyToPlatformConfig( - VOID -); - -EFI_STATUS -EFIAPI -RegisterForScheckLockConfigCallback( - VOID -); - -EFI_STATUS -EFIAPI -CloseS3BootScriptResources( - VOID -); - -EFI_STATUS -EFIAPI -InstallTxtDxeProtocol( - VOID -); - -EFI_STATUS -EFIAPI -PlatformLaunchBiosAcm( - VOID -); - -EFI_STATUS -EFIAPI -InitializeLtDxeLib( - VOID -); - -EFI_STATUS -EFIAPI -DriverInit( - VOID -); - -EFI_STATUS -EFIAPI -TxtDxeMain( - VOID -); - -EFI_STATUS -EFIAPI -TxtDxeCleanup( - VOID -); - -EFI_STATUS -EFIAPI -TxtDxeUnload( - VOID -); - -EFI_STATUS -EFIAPI -_ModuleEntryPoint( - VOID -); - -EFI_STATUS -EFIAPI -Variables( - VOID -); - -/// populated by DriverInit (sub_47C) -EFI_STATUS -EFIAPI -core handles( - VOID -); - -EFI_STATUS -EFIAPI -gImageHandle = NULL;( - VOID -); - -EFI_STATUS -EFIAPI -PCI User Access (DxeMmPciBaseLib)( - VOID -); - -EFI_STATUS -EFIAPI -and database pointers( - VOID -); - -EFI_STATUS -EFIAPI -*mPcdProtocol = NULL; // PCD Protocol( - VOID -); - -EFI_STATUS -EFIAPI -list (DxeHobLib)( - VOID -); - -EFI_STATUS -EFIAPI -print protocol (gEfiDebugPortProtocolGuid)( - VOID -); - -EFI_STATUS -EFIAPI -Communication protocol( - VOID -); - -EFI_STATUS -EFIAPI -Base2 protocol( - VOID -); - -EFI_STATUS -EFIAPI -LockBox protocol( - VOID -); - -EFI_STATUS -EFIAPI -SMM Communication protocol( - VOID -); - -/// populated from platform HOBs -EFI_STATUS -EFIAPI -policy data pointers( - VOID -); - -EFI_STATUS -EFIAPI -*mTxtDeviceMemoryPolicy = NULL; // gEfiPlatformTxtDeviceMemoryGuid( - VOID -); - -EFI_STATUS -EFIAPI -//( - VOID -); - -EFI_STATUS -EFIAPI -/ wake-up state( - VOID -); - -EFI_STATUS -EFIAPI -mApCount = 0; // Number of enabled APs (from MP services)( - VOID -); - -EFI_STATUS -EFIAPI -vector for AP wake-up( - VOID -); - -EFI_STATUS -EFIAPI -ID table populated from MP services( - VOID -); - -EFI_STATUS -EFIAPI -state tracking( - VOID -); - -EFI_STATUS -EFIAPI -mBiosAcmCalled = FALSE;( - VOID -); - -EFI_STATUS -EFIAPI -DXE Protocol instance( - VOID -); - -EFI_STATUS -EFIAPI -gTxtDxeProtocol;( - VOID -); - -EFI_STATUS -EFIAPI -declarations of local functions( - VOID -); - -EFI_STATUS -EFIAPI -EFIAPI( - VOID -); - -EFI_STATUS -EFIAPI -helper prototypes that are linked from other compilation units:( - VOID -); - -EFI_STATUS -EFIAPI -Print and Assert Helpers( - VOID -); - -EFI_STATUS -EFIAPI -TPL to avoid re-entrancy during protocol lookup( - VOID -); - -EFI_STATUS -EFIAPI -= gBootServices->RaiseTPL (TPL_NOTIFY);( - VOID -); - -EFI_STATUS -EFIAPI -CMOS byte 0x4B for the platform debug level.( - VOID -); - -EFI_STATUS -EFIAPI -debug level indicates this message should be printed, do so.( - VOID -); - -EFI_STATUS -EFIAPI -DebugLevel;( - VOID -); - -EFI_STATUS -EFIAPI -if this error level should be displayed( - VOID -); - -EFI_STATUS -EFIAPI -= 0;( - VOID -); - -EFI_STATUS -EFIAPI -}( - VOID -); - -EFI_STATUS -EFIAPI -Library Protocol Locators( - VOID -); - -EFI_STATUS -EFIAPI -wrapper( - VOID -); - -EFI_STATUS -EFIAPI -that the copy range does not overflow UINTN( - VOID -); - -EFI_STATUS -EFIAPI -((Length - 1) > (UINTN)(-1) - (UINTN)Destination) {( - VOID -); - -EFI_STATUS -EFIAPI -Configuration / UEFI Variable Helpers( - VOID -); - -EFI_STATUS -EFIAPI -(LaGrande Technology / TXT) Feature Checks( - VOID -); - -EFI_STATUS -EFIAPI -feature MSR( - VOID -); - -EFI_STATUS -EFIAPI -TXT Policy HOB Access( - VOID -); - -EFI_STATUS -EFIAPI -HOB data starts after the GUID extension header( - VOID -); - -EFI_STATUS -EFIAPI -= (TXT_DEVICE_MEMORY_POLICY *)((UINT8 *)Hob + sizeof (EFI_HOB_GUID_TYPE));( - VOID -); - -EFI_STATUS -EFIAPI -Wake-up Vector and APIC Setup( - VOID -); - -EFI_STATUS -EFIAPI -for the MP floating pointer structure in the BIOS ROM area( - VOID -); - -EFI_STATUS -EFIAPI -table not found; fall back to allocating a wake-up buffer( - VOID -); - -EFI_STATUS -EFIAPI -a fixed address.( - VOID -); - -EFI_STATUS -EFIAPI -MP table found; allocate a 0xFFFFF-sized page-aligned buffer( - VOID -); - -EFI_STATUS -EFIAPI -the wake-up vector.( - VOID -); - -EFI_STATUS -EFIAPI -WakeUpBuffer;( - VOID -); - -EFI_STATUS -EFIAPI -table found; configure the wake-up vector from the MP config table( - VOID -); - -EFI_STATUS -EFIAPI -*MpServices;( - VOID -); - -EFI_STATUS -EFIAPI -MP services to get APIC IDs( - VOID -); - -EFI_STATUS -EFIAPI -up the wake-up buffer: write the magic value.( - VOID -); - -EFI_STATUS -EFIAPI -WakeUpBuffer address is stored in mApWakeUpVector.( - VOID -); - -EFI_STATUS -EFIAPI -*WakeUpBuffer;( - VOID -); - -EFI_STATUS -EFIAPI -number for SIPI( - VOID -); - -EFI_STATUS -EFIAPI -Launch Support( - VOID -); - -EFI_STATUS -EFIAPI -original MC9-MC11 control values and mask out bit 7 (EN)( - VOID -); - -EFI_STATUS -EFIAPI -= (UINT32)AsmReadMsr64 (MSR_IA32_MC9_CTL);( - VOID -); - -EFI_STATUS -EFIAPI -save IA32_MCG_CONTAIN if MCG_CMCP (bit 24) is set( - VOID -); - -EFI_STATUS -EFIAPI -((AsmReadMsr64 (MSR_IA32_MCG_CAP) & 0x1000000) != 0) {( - VOID -); - -EFI_STATUS -EFIAPI -new values with EN bit cleared( - VOID -); - -EFI_STATUS -EFIAPI -(DEBUG_INFO, "Ia32_Mc9_Ctl_New = 0x%08x\n", Mc9CtlOrig & ~0x80);( - VOID -); - -EFI_STATUS -EFIAPI -(DEBUG_INFO, "Write Ia32_Mc9_Ctl_Org = 0x%08x\n", Mc9CtlOrig);( - VOID -); - -EFI_STATUS -EFIAPI -IA32_MCG_CONTAIN if saved( - VOID -); - -EFI_STATUS -EFIAPI -(McgContainValid) {( - VOID -); - -EFI_STATUS -EFIAPI -1: Disable MC9-MC11 machine check banks( - VOID -); - -EFI_STATUS -EFIAPI -(1);( - VOID -); - -EFI_STATUS -EFIAPI -2: If APs exist, send SIPI to start them (required for SINIT)( - VOID -); - -EFI_STATUS -EFIAPI -(mApCount > 0) {( - VOID -); - -EFI_STATUS -EFIAPI -INIT IPI to all (including self)( - VOID -); - -EFI_STATUS -EFIAPI -();( - VOID -); - -EFI_STATUS -EFIAPI -3: Debug log and raise TPL( - VOID -); - -EFI_STATUS -EFIAPI -(DEBUG_INFO, "LtDxeLibLaunchBiosAcm: BiosAcmAddress = 0x%08x\n", BiosAcmAddress);( - VOID -); - -EFI_STATUS -EFIAPI -4: Call the platform-specific BIOS ACM launch routine.( - VOID -); - -EFI_STATUS -EFIAPI -is a raw assembly routine (sub_4700) that:( - VOID -); - -EFI_STATUS -EFIAPI -ACM then executes in a special environment and returns( - VOID -); - -EFI_STATUS -EFIAPI -via the LT.SPAD.HIGH register.( - VOID -); - -EFI_STATUS -EFIAPI -(DEBUG_INFO, "LtDxeLibLaunchBiosAcm: Calling LaunchBiosAcm()\n");( - VOID -); - -EFI_STATUS -EFIAPI -5: Restore TPL and machine check banks( - VOID -); - -EFI_STATUS -EFIAPI -(DEBUG_INFO, "LtDxeLibLaunchBiosAcm: Restoring TPL\n");( - VOID -); - -EFI_STATUS -EFIAPI -6: Send SIPI to wake APs after ACM( - VOID -); - -EFI_STATUS -EFIAPI -MC banks to original state( - VOID -); - -EFI_STATUS -EFIAPI -(0);( - VOID -); - -EFI_STATUS -EFIAPI -Error Handling( - VOID -); - -EFI_STATUS -EFIAPI -lib enable/disable option( - VOID -); - -EFI_STATUS -EFIAPI -error handling type( - VOID -); - -EFI_STATUS -EFIAPI -if LtDxeLib functions are installed( - VOID -); - -EFI_STATUS -EFIAPI -(!GetLtDxeLibSetupOption (&LtDxeLibInstalled) && LtDxeLibInstalled) {( - VOID -); - -/// just log -EFI_STATUS -EFIAPI -setup is configured to ignore ACM errors( - VOID -); - -EFI_STATUS -EFIAPI -(GetAcmErrorType (&AcmType)) {( - VOID -); - -EFI_STATUS -EFIAPI -failure is fatal: clear LT/TPM state and reset( - VOID -); - -EFI_STATUS -EFIAPI -(DEBUG_ERROR, "Bios Acm Failed. Reboot in non-ltsx mode\n");( - VOID -); - -EFI_STATUS -EFIAPI -a system reset via runtime services( - VOID -); - -EFI_STATUS -EFIAPI -"AcmError" variable to record the failure( - VOID -); - -EFI_STATUS -EFIAPI -= 1;( - VOID -); - -EFI_STATUS -EFIAPI -LT enable bits in SocketProcessorCoreConfig( - VOID -); - -EFI_STATUS -EFIAPI -= sizeof (Buffer);( - VOID -); - -EFI_STATUS -EFIAPI -storage size( - VOID -); - -EFI_STATUS -EFIAPI -LT/TPM enable field( - VOID -); - -EFI_STATUS -EFIAPI -related field( - VOID -); - -EFI_STATUS -EFIAPI -policy byte in platform config( - VOID -); - -EFI_STATUS -EFIAPI -/ S3 Boot Script Support( - VOID -); - -EFI_STATUS -EFIAPI -a SMM communication command for Scheck/LockConfig registration( - VOID -); - -EFI_STATUS -EFIAPI -(DEBUG_INFO, "Register for Scheck/LockConfig Callback\n");( - VOID -); - -EFI_STATUS -EFIAPI -Boot Script Save( - VOID -); - -EFI_STATUS -EFIAPI -Boot Script Table Write if opened( - VOID -); - -EFI_STATUS -EFIAPI -(mSmmCommunicationProtocol != NULL) {( - VOID -); - -EFI_STATUS -EFIAPI -(mSmmBase2Protocol != NULL) {( - VOID -); - -EFI_STATUS -EFIAPI -SMM; close SMM communication protocol( - VOID -); - -EFI_STATUS -EFIAPI -(((EFI_SMM_BASE2_PROTOCOL *)mSmmBase2Protocol)->Communicate (( - VOID -); - -EFI_STATUS -EFIAPI -SMM ready-to-lock flag and close SMM Base2( - VOID -); - -EFI_STATUS -EFIAPI -(mSmmReadyToLockEvent != NULL) {( - VOID -); - -EFI_STATUS -EFIAPI -DXE Protocol Installation( - VOID -); - -EFI_STATUS -EFIAPI -if protocol is already installed( - VOID -); - -EFI_STATUS -EFIAPI -= gBootServices->LocateProtocol (( - VOID -); - -EFI_STATUS -EFIAPI -up the protocol instance( - VOID -); - -EFI_STATUS -EFIAPI -the protocol( - VOID -); - -EFI_STATUS -EFIAPI -= gBootServices->InstallProtocolInterface (( - VOID -); - -EFI_STATUS -EFIAPI -the protocol was installed correctly by locating it again( - VOID -); - -EFI_STATUS -EFIAPI -= NULL;( - VOID -); - -/// sub_4700 -EFI_STATUS -EFIAPI -ACM Launch (Assembly Wrapper)( - VOID -); - -EFI_STATUS -EFIAPI -function is implemented in assembly (sub_4700). The equivalent C( - VOID -); - -EFI_STATUS -EFIAPI -is documented here for reference:( - VOID -); - -EFI_STATUS -EFIAPI -GdtBackup[2]; // GDT limit + base( - VOID -); - -EFI_STATUS -EFIAPI -IdtBackup[2]; // IDT limit + base( - VOID -); - -EFI_STATUS -EFIAPI -Cr0, Cr3, Cr4;( - VOID -); - -EFI_STATUS -EFIAPI -(Flags != 0) {( - VOID -); - -EFI_STATUS -EFIAPI -(&GdtBackup);( - VOID -); - -EFI_STATUS -EFIAPI -(&IdtBackup);( - VOID -); - -EFI_STATUS -EFIAPI -MCG_CAP MTRR state( - VOID -); - -EFI_STATUS -EFIAPI -= AsmReadCr4 ();( - VOID -); - -EFI_STATUS -EFIAPI -(Cr4 | 0x4208); // Enable MCE, OSFXSR, OSXMMEXCPT( - VOID -); - -EFI_STATUS -EFIAPI -= AsmReadCr0 ();( - VOID -); - -EFI_STATUS -EFIAPI -((Cr0 & 0x9FFFFFDF) | 0x40000020); // Set EM, MP; clear NE, TS, EM?( - VOID -); - -EFI_STATUS -EFIAPI -(Flags != 0) Wbinvd ();( - VOID -); - -EFI_STATUS -EFIAPI -Invd ();( - VOID -); - -EFI_STATUS -EFIAPI -(0x2FF, 0); // Disable MTRRs( - VOID -); - -EFI_STATUS -EFIAPI -all MTRR pairs( - VOID -); - -EFI_STATUS -EFIAPI -(Index = 0; Index < N; Index++) {( - VOID -); - -EFI_STATUS -EFIAPI -(0x200 + Index*2, 0); // MTRR_PHYSBASE( - VOID -); - -EFI_STATUS -EFIAPI -(0x200 + Index*2 + 1, 0); // MTRR_PHYSMASK( - VOID -); - -EFI_STATUS -EFIAPI -up MTRRs for ACM memory range( - VOID -); - -EFI_STATUS -EFIAPI -(Remaining = AcmSize; Remaining > 0; ) {( - VOID -); - -EFI_STATUS -EFIAPI -largest power-of-two aligned region( - VOID -); - -EFI_STATUS -EFIAPI -= MtrrIndex++;( - VOID -); - -EFI_STATUS -EFIAPI -(0x200 + Reg*2, AcmBase | 6); // WB( - VOID -); - -EFI_STATUS -EFIAPI -(0x200 + Reg*2 + 1, ~(Size-1) | 0xF00000800);( - VOID -); - -EFI_STATUS -EFIAPI -+= Size;( - VOID -); - -EFI_STATUS -EFIAPI --= Size;( - VOID -); - -EFI_STATUS -EFIAPI -(0x2FF, 0x800); // Enable MTRRs( - VOID -); - -EFI_STATUS -EFIAPI -(0x17B, 0); // Clear MCG_CTL( - VOID -); - -EFI_STATUS -EFIAPI -all machine check banks( - VOID -); - -EFI_STATUS -EFIAPI -(Bank = 0; Bank < McgBankCount; Bank++) {( - VOID -); - -EFI_STATUS -EFIAPI -(0x400 + Bank*4 + 1, 0); // MCi_STATUS( - VOID -); - -EFI_STATUS -EFIAPI -return to ACM entry point( - VOID -); - -EFI_STATUS -EFIAPI -(BiosAcmAddress, 0x08); // Code segment selector( - VOID -); - -EFI_STATUS -EFIAPI --- sub_DD0( - VOID -); - -EFI_STATUS -EFIAPI -ImageHandle and SystemTable globally (also set in DriverInit)( - VOID -); - -EFI_STATUS -EFIAPI -= ImageHandle;( - VOID -); - -EFI_STATUS -EFIAPI -access to CMOS: clear NMI disable bit on port 0x70( - VOID -); - -EFI_STATUS -EFIAPI -(0x70, IoRead8 (0x530) & 0xBF);( - VOID -); - -EFI_STATUS -EFIAPI -the SMM Communication protocol for S3 boot script support( - VOID -); - -EFI_STATUS -EFIAPI -the MP Services protocol for AP management( - VOID -); - -EFI_STATUS -EFIAPI -if TXT is supported on this platform via PCD( - VOID -); - -EFI_STATUS -EFIAPI -TXT device memory policy from HOB( - VOID -); - -EFI_STATUS -EFIAPI -= LocateTxtDeviceMemoryPolicy ();( - VOID -); - -EFI_STATUS -EFIAPI -TXT platform policy from HOB( - VOID -); - -EFI_STATUS -EFIAPI -= LocateTxtPlatformPolicy ();( - VOID -); - -EFI_STATUS -EFIAPI -that the BIOS ACM address is configured( - VOID -); - -EFI_STATUS -EFIAPI -(mTxtPlatformPolicy->BiosAcmAddress == 0) {( - VOID -); - -EFI_STATUS -EFIAPI -MP services info: number of processors( - VOID -); - -EFI_STATUS -EFIAPI -= MpServices->GetNumberOfProcessors (MpServices, &mApCount, NULL);( - VOID -); - -EFI_STATUS -EFIAPI -includes the BSP; subtract 1 to get AP count( - VOID -); - -EFI_STATUS -EFIAPI -there are APs, get their APIC IDs and set up the wake-up vector( - VOID -); - -EFI_STATUS -EFIAPI -each AP for its APIC ID via GetProcessorInfo( - VOID -); - -EFI_STATUS -EFIAPI -= GetMpTableApicIds (&mApCount, ApicIds);( - VOID -); - -EFI_STATUS -EFIAPI -and log each APIC ID( - VOID -); - -EFI_STATUS -EFIAPI -(Index = 0; Index < mApCount; Index++) {( - VOID -); - -EFI_STATUS -EFIAPI -Point and Driver Init( - VOID -); - -EFI_STATUS -EFIAPI -protocol pointers( - VOID -); - -EFI_STATUS -EFIAPI -the DXE Services Table via the protocol database( - VOID -); - -EFI_STATUS -EFIAPI -= SystemTable->BootServices->LocateProtocol (( - VOID -); - -EFI_STATUS -EFIAPI -the MM PCI User Access protocol (DxeMmPciBaseLib)( - VOID -); - -EFI_STATUS -EFIAPI -(mPciUsra == NULL) {( - VOID -); - -EFI_STATUS -EFIAPI -HOB list( - VOID -); - -EFI_STATUS -EFIAPI -PCD protocol and enable MTRR for SINIT if not already enabled( - VOID -); - -EFI_STATUS -EFIAPI -if LT (TXT) is supported on this CPU( - VOID -); - -EFI_STATUS -EFIAPI -= IsLtProcessor ();( - VOID -); - -EFI_STATUS -EFIAPI -loop: read/write timer counter to wait for hardware stabilization( - VOID -); - -EFI_STATUS -EFIAPI -= IoRead8 (0x70) & 0x80 | 0x4B; // CMOS offset 0x4B, NMI preserved( - VOID -); - -EFI_STATUS -EFIAPI -value( - VOID -); - -EFI_STATUS -EFIAPI -until delta >= 357( - VOID -); - -EFI_STATUS -EFIAPI -LT configuration if it was modified during the delay( - VOID -); - -EFI_STATUS -EFIAPI -(LtEnabled) {( - VOID -); - -EFI_STATUS -EFIAPI -initialization step (AutoGen.c line 495)( - VOID -); - -EFI_STATUS -EFIAPI -= FinalInitStep ();( - VOID -); - -/// original sub_AA8 -EFI_STATUS -EFIAPI -Driver Entry Dispatch( - VOID -); - -EFI_STATUS -EFIAPI -1: Register for Scheck/LockConfig callback (SMM)( - VOID -); - -EFI_STATUS -EFIAPI -2: Initialize the TXT DXE library (HOBs, protocols, APIC table)( - VOID -); - -EFI_STATUS -EFIAPI -= InitializeLtDxeLib (ImageHandle, SystemTable);( - VOID -); - -EFI_STATUS -EFIAPI -3: Apply TXT policy from HOB to platform configuration( - VOID -); - -EFI_STATUS -EFIAPI -15 of the HOB data( - VOID -); - -EFI_STATUS -EFIAPI -4: Check if this is an LT-enabled processor( - VOID -); - -/// proceed with ACM launch -EFI_STATUS -EFIAPI -5: LT-enabled processor( - VOID -); - -EFI_STATUS -EFIAPI -(!IsTxtEnabled ()) {( - VOID -); - -EFI_STATUS -EFIAPI -not enabled, fall through to non-TXT path( - VOID -); - -EFI_STATUS -EFIAPI -= EFI_UNSUPPORTED;( - VOID -); - -/// check ACM result -EFI_STATUS -EFIAPI -is enabled( - VOID -); - -EFI_STATUS -EFIAPI -(DEBUG_INFO, "LT_SPAD_HIGH (0xFED300A4): %r\n"( - VOID -); - -/// install protocol -EFI_STATUS -EFIAPI -completed successfully (or no error)( - VOID -); - -EFI_STATUS -EFIAPI -(DEBUG_ERROR, "Install TXT_DXE_PROTOCOL...\n");( - VOID -); - -/// handle according to BIOS setup policy -EFI_STATUS -EFIAPI -failed( - VOID -); - -EFI_STATUS -EFIAPI -(*(UINT32 *)TXT_SPAD_HIGH_REG);( - VOID -); - -EFI_STATUS -EFIAPI -we get here, LT is not enabled or ACM failed( - VOID -); - -EFI_STATUS -EFIAPI -(DEBUG_ERROR, "Lt not enabled\n");( - VOID -); - -EFI_STATUS -EFIAPI -to close S3 boot script resources for a clean state( - VOID -); - -/// close S3 boot script resources -EFI_STATUS -EFIAPI -not resetting( - VOID -); - -EFI_STATUS -EFIAPI -= TxtDxeCleanup ();( - VOID -); - -/// sub_2FEC / sub_748 equivalent -EFI_STATUS -EFIAPI -Unload Handler( - VOID -); - -/// _ModuleEntryPoint -EFI_STATUS -EFIAPI -Entry Point( - VOID -); - -EFI_STATUS -EFIAPI -1: Initialize UEFI core protocols and driver globals( - VOID -); - -EFI_STATUS -EFIAPI -= DriverInit (ImageHandle, SystemTable);( - VOID -); - -EFI_STATUS -EFIAPI -2: Execute TXT-specific initialization( - VOID -); - -EFI_STATUS -EFIAPI -= TxtDxeMain (ImageHandle, SystemTable);( - VOID -); - -EFI_STATUS -EFIAPI -3: If initialization failed, perform cleanup via unload handler( - VOID -); - -EFI_STATUS -EFIAPI -(EFI_ERROR (Status)) {( - VOID -); - -#endif /* __TXTDXE_H__ */ \ No newline at end of file +#endif diff --git a/UefiCpuPkg/PiSmmCommunication/PiSmmCommunicationPei/PiSmmCommunicationPei.c b/UefiCpuPkg/PiSmmCommunication/PiSmmCommunicationPei/PiSmmCommunicationPei.c index b5e40b9..c3528e4 100644 --- a/UefiCpuPkg/PiSmmCommunication/PiSmmCommunicationPei/PiSmmCommunicationPei.c +++ b/UefiCpuPkg/PiSmmCommunication/PiSmmCommunicationPei/PiSmmCommunicationPei.c @@ -28,14 +28,14 @@ return buf; } -int fn_addr(int a1, int a2, int a3, int a4) +int InitializeSmmTableEntries(int TableBase, int EntryCount, int FirstValue, int SecondValue) { do { - *(_DWORD *)(a1 + 8 * a2 - 8) = a3; - *(_DWORD *)(a1 + 8 * a2-- - 4) = a4; - } while (a2); + *(_DWORD *)(TableBase + 8 * EntryCount - 8) = FirstValue; + *(_DWORD *)(TableBase + 8 * EntryCount-- - 4) = SecondValue; + } while (EntryCount); - return a1; + return TableBase; } void *SetMem32(void *buf, unsigned int count, int value) @@ -49,94 +49,94 @@ return PiSmmCommunicationPeiModuleEntryPoint(); } -int InitCommunicationContext(void) +int LocateSmmCommunicationEntry(void) { - _DWORD *v2; - _DWORD *v3; - unsigned int v4; - int i_1; - int v6; - int j; - int v9; - unsigned int v10; - int v11; - int i; + _DWORD *PeiServices; + _DWORD *SmmConfigurationTable; + unsigned int NumberOfEntries; + int EntryBase; + int MatchCount; + int EntryIndex; + int EntryOffset; + unsigned int TableEntryCount; + int CurrentMatch; + int TableCursor; - v3 = v2; + SmmConfigurationTable = PeiServices; if (0) { - DebugPrint(64, "InitCommunicationContext - SmmConfigurationTable: %x\n", v2[23]); - DebugPrint(64, "InitCommunicationContext - NumberOfTableEntries: %x\n", v3[22]); - v10 = v3[22]; - i_1 = v3[23]; - v11 = 0; - if (v10) { - for (i = i_1; !sub_FFE33012(i, (int)&unk_FFE337C0); i += 20) { - if (++v11 >= v10) + DebugPrint(64, "LocateSmmCommunicationEntry - SmmConfigurationTable: %x\n", PeiServices[23]); + DebugPrint(64, "LocateSmmCommunicationEntry - NumberOfTableEntries: %x\n", SmmConfigurationTable[22]); + TableEntryCount = SmmConfigurationTable[22]; + EntryBase = PeiServices[23]; + CurrentMatch = 0; + if (TableEntryCount) { + for (TableCursor = EntryBase; !CompareGuid(TableCursor, (int)&unk_FFE337C0); TableCursor += 20) { + if (++CurrentMatch >= TableEntryCount) return 0; } - v9 = 20 * v11; - return *(_DWORD *)(v9 + i_1 + 16); + EntryOffset = 20 * CurrentMatch; + return *(_DWORD *)(EntryOffset + EntryBase + 16); } return 0; } - DebugPrint(64, "InitCommunicationContext - SmmConfigurationTable: %x\n", v2[40]); - DebugPrint(64, "InitCommunicationContext - NumberOfTableEntries: %x\n", v3[38]); - v4 = v3[38]; - i_1 = v3[40]; - v6 = 0; - if (!v4) + DebugPrint(64, "LocateSmmCommunicationEntry - SmmConfigurationTable: %x\n", PeiServices[40]); + DebugPrint(64, "LocateSmmCommunicationEntry - NumberOfTableEntries: %x\n", SmmConfigurationTable[38]); + NumberOfEntries = SmmConfigurationTable[38]; + EntryBase = PeiServices[40]; + MatchCount = 0; + if (!NumberOfEntries) return 0; - for (j = i_1; !sub_FFE33012(j, (int)&unk_FFE337C0); j += 24) { - if (++v6 >= v4) + for (EntryIndex = EntryBase; !CompareGuid(EntryIndex, (int)&unk_FFE337C0); EntryIndex += 24) { + if (++MatchCount >= NumberOfEntries) return 0; } - v9 = 24 * v6; - return *(_DWORD *)(v9 + i_1 + 16); + EntryOffset = 24 * MatchCount; + return *(_DWORD *)(EntryOffset + EntryBase + 16); } -char *InitCommunicationContext_1(void) +char *InitializeSmmCommunicationContext(void) { - _WORD *v0; - int v1; - int *p_n1397574995; - void *v3; - char *src; - int v5; - char *dst; - int v7; + _WORD *GuidHob; + int AssertHandler; + int *SmmS3ResumeState; + void *Hob; + char *SourceBuffer; + int AssertHandler2; + char *DestinationBuffer; + int AssertHandler3; - v0 = sub_FFE32ED1(&unk_FFE337A0); - if (!v0) { - v1 = sub_FFE32DA5(); - if (v1) - (*(void (**)(const char *, int, const char *))(v1 + 4))( + GuidHob = GetFirstGuidHob(&unk_FFE337A0); + if (!GuidHob) { + AssertHandler = GetAssertHandler(); + if (AssertHandler) + (*(void (**)(const char *, int, const char *))(AssertHandler + 4))( "e:\\hs\\UefiCpuPkg\\PiSmmCommunication\\PiSmmCommunicationPei.c", 250, "GuidHob != ((void *) 0)"); } - p_n1397574995 = (int *)*((_DWORD *)v0 + 8); - DebugPrint(64, "InitCommunicationContext - SmmS3ResumeState: %x\n", p_n1397574995); - DebugPrint(64, "InitCommunicationContext - Smst: %x\n", *(int *)((char *)p_n1397574995 + 90)); - src = (char *)sub_FFE329BA(*p_n1397574995, p_n1397574995[1]); - if (!src) { - v5 = sub_FFE32DA5(); - if (v5) - (*(void (**)(const char *, int, const char *))(v5 + 4))( + SmmS3ResumeState = (int *)*((_DWORD *)GuidHob + 8); + DebugPrint(64, "InitializeSmmCommunicationContext - SmmS3ResumeState: %x\n", SmmS3ResumeState); + DebugPrint(64, "InitializeSmmCommunicationContext - Smst: %x\n", *(int *)((char *)SmmS3ResumeState + 90)); + SourceBuffer = (char *)GetGuidHobData(*SmmS3ResumeState, SmmS3ResumeState[1]); + if (!SourceBuffer) { + AssertHandler2 = GetAssertHandler(); + if (AssertHandler2) + (*(void (**)(const char *, int, const char *))(AssertHandler2 + 4))( "e:\\hs\\UefiCpuPkg\\PiSmmCommunication\\PiSmmCommunicationPei.c", 262, "SmmCommunicationContext != ((void *) 0)"); } - dst = (char *)sub_FFE32F54(v3); - if (!dst) { - v7 = sub_FFE32DA5(); - if (v7) - (*(void (**)(const char *, int, const char *))(v7 + 4))( + DestinationBuffer = (char *)GetCommunicationContextHob(Hob); + if (!DestinationBuffer) { + AssertHandler3 = GetAssertHandler(); + if (AssertHandler3) + (*(void (**)(const char *, int, const char *))(AssertHandler3 + 4))( "e:\\hs\\UefiCpuPkg\\PiSmmCommunication\\PiSmmCommunicationPei.c", 180, "Hob.Raw"); } - return sub_FFE32F72(dst, src, 0x10u); + return CopyMem(DestinationBuffer, SourceBuffer, 0x10u); } EFI_STATUS PiSmmCommunicationPeiCommunicate(int a1, int a2) @@ -150,29 +150,29 @@ int v9; int v10; _DWORD *v11; - int (**v12)(int, _DWORD, _BYTE *, int *, _DWORD, _DWORD); - char v13; - int (**v14)(int, _DWORD, char *, int *, _DWORD, _DWORD); - int v15; - int v16; + int (**SmmCommunication2Protocol)(int, _DWORD, _BYTE *, int *, _DWORD, _DWORD); + char SmmCommunicationBufferState; + int (**SmmCommunicationProtocol)(int, _DWORD, char *, int *, _DWORD, _DWORD); + int LockState; + int CommunicateResult; DebugPrint(64, "PiSmmCommunicationPei Communicate Enter\n"); if (!a2) return -2147483646; - v3 = sub_FFE330D1(); + v3 = GetPeiServicesTable(); if ((*(int (**)(int, void *, _DWORD, _DWORD, int (***)(int, _DWORD, char *, int *, _DWORD, _DWORD)))(*(_DWORD *)v3 + 32))( - v3, &unk_FFE337B0, 0, 0, &v14) < 0) + v3, &unk_FFE337B0, 0, 0, &SmmCommunicationProtocol) < 0) return -2147483629; - v4 = sub_FFE330D1(); - if ((*(int (**)(int, void *, _DWORD, _DWORD, int *))(*(_DWORD *)v4 + 32))(v4, &unk_FFE33780, 0, 0, &v15) < 0) + v4 = GetPeiServicesTable(); + if ((*(int (**)(int, void *, _DWORD, _DWORD, int *))(*(_DWORD *)v4 + 32))(v4, &unk_FFE33780, 0, 0, &LockState) < 0) return -2147483629; - if (!*(_BYTE *)(v15 + 16)) { + if (!*(_BYTE *)(LockState + 16)) { DebugPrint(64, "PiSmmCommunicationPei LockState - %x\n", 0); return -2147483629; } - v5 = sub_FFE32ED1(&unk_FFE337C0); + v5 = GetFirstGuidHob(&unk_FFE337C0); if (!v5) { - v6 = sub_FFE32DA5(); + v6 = GetAssertHandler(); if (v6) (*(void (**)(const char *, int, const char *))(v6 + 4))( "e:\\hs\\UefiCpuPkg\\PiSmmCommunication\\PiSmmCommunicationPei.c", @@ -188,14 +188,14 @@ *v7 = a2; v7[1] = 0; DebugPrint(64, "PiSmmCommunicationPei CommBuffer - %x\n", a2); - v13 = *((_BYTE *)v5 + 28); - v16 = 1; - v12 = v14; - v8 = sub_FFE330D1(); - v9 = (*v14)(v8, v12, &v13, &v16, 0, 0); + SmmCommunicationBufferState = *((_BYTE *)v5 + 28); + CommunicateResult = 1; + SmmCommunication2Protocol = SmmCommunicationProtocol; + v8 = GetPeiServicesTable(); + v9 = (*SmmCommunicationProtocol)(v8, SmmCommunication2Protocol, &SmmCommunicationBufferState, &CommunicateResult, 0, 0); if (v9 < 0) { DebugPrint(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", v9); - v10 = sub_FFE32DA5(); + v10 = GetAssertHandler(); if (v10) (*(void (**)(const char *, int, const char *))(v10 + 4))( "e:\\hs\\UefiCpuPkg\\PiSmmCommunication\\PiSmmCommunicationPei.c", @@ -225,11 +225,11 @@ int n17; int v13; - v0 = sub_FFE330D1(); + v0 = GetPeiServicesTable(); v1 = (*(int (**)(int, int *))(*(_DWORD *)v0 + 40))(v0, &n17); if (v1 < 0) { DebugPrint(0x80000000, "\nASSERT_EFI_ERROR (Status = %r)\n", v1); - v2 = sub_FFE32DA5(); + v2 = GetAssertHandler(); if (v2) (*(void (**)(const char *, int, const char *))(v2 + 4))( "e:\\hs\\MdePkg\\Library\\PeiHobLib\\HobLib.c", @@ -238,7 +238,7 @@ } if (n17 != 17) return -2147483645; - v4 = sub_FFE330D1(); + v4 = GetPeiServicesTable(); v5 = 0; if ((*(int (**)(int, void *, _DWORD, _DWORD, int *))(*(_DWORD *)v4 + 32))(v4, &unk_FFE33780, 0, 0, &v13) < 0) return -2147483629; @@ -250,14 +250,14 @@ } while (1) { v11 = v6; - v8 = sub_FFE330D1(); + v8 = GetPeiServicesTable(); v9 = (*(int (**)(int, int, int))v13)(v8, v11, v5++); if (v9 < 0) break; v6 = v13; } - InitCommunicationContext_1(); - v10 = sub_FFE330D1(); + InitializeSmmCommunicationContext(); + v10 = GetPeiServicesTable(); (*(void (**)(int, void *))(*(_DWORD *)v10 + 24))(v10, &unk_FFE337D0); return 0; } diff --git a/UefiCpuPkg/PiSmmCommunication/PiSmmCommunicationSmm/PiSmmCommunicationSmm.c b/UefiCpuPkg/PiSmmCommunication/PiSmmCommunicationSmm/PiSmmCommunicationSmm.c index d6b84cc..5263bcd 100644 --- a/UefiCpuPkg/PiSmmCommunication/PiSmmCommunicationSmm/PiSmmCommunicationSmm.c +++ b/UefiCpuPkg/PiSmmCommunication/PiSmmCommunicationSmm/PiSmmCommunicationSmm.c @@ -19,24 +19,23 @@ { __int64 Status; // rax - // Constructor chain: sub_504() initializes globals, sub_7EC() is the - // module entry path, and the cleanup callbacks mirror the AutoGen teardown. - sub_504(ImageHandle, SystemTable); + // Initialize the SMM communication context before registering handlers. + PiSmmCommunicationSmmInitializeContext(ImageHandle, SystemTable); qword_1578 = 0x8000000000000001uLL; - if (!sub_300(&unk_1480)) { - Status = sub_7EC(); + if (!PiSmmCommunicationSmmIsServicesContextInitialized(&unk_1480)) { + Status = PiSmmCommunicationSmmRegisterCommunicationHandler(); if (Status >= 0 || qword_1578 < 0) { qword_1578 = Status; } - sub_B0C(&unk_1480); - sub_3A0(&unk_1480, -1); - sub_ACC( + PiSmmCommunicationSmmUnregisterCommunicationHandler(&unk_1480); + PiSmmCommunicationSmmResetContext(&unk_1480, -1); + PiSmmCommunicationSmmAutogenTeardownHook( "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\UefiCpuPkg\\PiSmmCommunication\\PiSmmCommunicationSmm\\DEBUG\\AutoGen.c", 192, "((BOOLEAN)(0==1))"); - sub_ACC( + PiSmmCommunicationSmmAutogenTeardownHook( "e:\\hs\\Build\\HR6N0XMLK\\DEBUG_VS2015\\X64\\UefiCpuPkg\\PiSmmCommunication\\PiSmmCommunicationSmm\\DEBUG\\AutoGen.c", 207, "((BOOLEAN)(0==1))"); diff --git a/UefiCpuPkg/PiSmmCommunication/PiSmmCommunicationSmm/PiSmmCommunicationSmm.h b/UefiCpuPkg/PiSmmCommunication/PiSmmCommunicationSmm/PiSmmCommunicationSmm.h index 6f34b2f..35666f0 100644 --- a/UefiCpuPkg/PiSmmCommunication/PiSmmCommunicationSmm/PiSmmCommunicationSmm.h +++ b/UefiCpuPkg/PiSmmCommunication/PiSmmCommunicationSmm/PiSmmCommunicationSmm.h @@ -26,57 +26,57 @@ ); /// -/// sub_504 +/// Initialize the SMM communication context for the module entry path. /// EFI_STATUS EFIAPI -sub_504( +PiSmmCommunicationSmmInitializeContext( VOID ); /// -/// sub_7EC +/// Dispatch the SMM communication handler registration / entry work. /// EFI_STATUS EFIAPI -sub_7EC( +PiSmmCommunicationSmmRegisterCommunicationHandler( VOID ); /// -/// sub_B0C +/// Release the SMM communication handler registration. /// EFI_STATUS EFIAPI -sub_B0C( +PiSmmCommunicationSmmUnregisterCommunicationHandler( VOID ); /// -/// sub_3A0 +/// Reset the SMM communication context during teardown. /// EFI_STATUS EFIAPI -sub_3A0( +PiSmmCommunicationSmmResetContext( VOID ); /// -/// sub_ACC +/// AutoGen teardown hook placeholder. /// EFI_STATUS EFIAPI -sub_ACC( +PiSmmCommunicationSmmAutogenTeardownHook( VOID ); /// -/// sub_300 +/// Check whether the SMM services context is already initialized. /// EFI_STATUS EFIAPI -sub_300( +PiSmmCommunicationSmmIsServicesContextInitialized( VOID ); -#endif /* __PISMMCOMMUNICATIONSMM_H__ */ \ No newline at end of file +#endif /* __PISMMCOMMUNICATIONSMM_H__ */