Newer
Older
AMI-Aptio-BIOS-Reversed / AmiModulePkg / BoardInfo / AmiBoardInfo2 / AmiBoardInfo2.h
@Ajax Dong Ajax Dong 2 days ago 4 KB Restructure the repo
/**
 * AmiBoardInfo2.h
 *
 * UEFI DXE driver from AMI ModulePkg (BoardInfo).
 * Extracts platform board configuration data (DSDT, SIO, IOAPIC)
 * from HOBs (Hand-Off Blocks) and publishes them via a protocol.
 *
 * Source:  e:\hs\AmiModulePkg\BoardInfo\AmiBoardInfo2.c
 * Module:  AmiBoardInfo2.efi
 * Arch:    x86_64
 * Size:    0x18a0 (6304 bytes)
 *
 * Protocol GUIDs referenced:
 *   Multi-Platform Board Info protocol   (unk_1650)
 *   AMI Board Info protocol              (unk_1660)
 *   Protocol installed by this driver    (unk_16E0)
 */

#ifndef __AMIBOARDINFO2_H__
#define __

#include "../uefi_headers/Uefi.h"
AMIBOARDINFO2_H__

//
// GUID signatures used for HOB matching (encoded as UINT64 little-endian ASCII)
//
#define HOB_SIGNATURE_DSDT     0x4154414449435024ULL   /* "$PCIDATA" -> DSDT ACPI table data */
#define HOB_SIGNATURE_SIO      0x415441444F495324ULL   /* "$SIODATA" -> SIO (Super I/O) data */
#define HOB_SIGNATURE_IOAPIC   0x4154414449504124ULL   /* "$APIDATA" -> IOAPIC data */

//
// HOB GUID constants for DXE phase protocol matching
//
#define HOB_GUID_SIGNATURE_0   0x4154414441544144ULL   /* "DATADATA" */
#define HOB_GUID_SIGNATURE_1   0x4154414441544144ULL

//
// AmiBoardInfo2 protocol structure (installed by this driver)
//
typedef struct _AMI_BOARD_INFO2_PROTOCOL {
  //
  // [0]  Placeholder / version
  //
  UINT64            Reserved0;
  //
  // [1]  Not used
  //
  UINT64            Reserved1;
  //
  // [2]  DSDT HOB data address
  //
  UINT64            DsdtHobDataAddr;
  //
  // [3]  SIO HOB data address
  //
  UINT64            SioHobDataAddr;
  //
  // [4]  IOAPIC HOB data address
  //
  UINT64            IoApicHobDataAddr;
  //
  // [5]  DSDT HOB data pointer (from HOB protocol lookup)
  //
  UINT64            DsdtDataPtr;
  //
  // [6]  DSDT HOB data size
  //
  UINT64            DsdtDataSize;
} AMI_BOARD_INFO2_PROTOCOL;

//
// Global variables (in .data segment at 0x15e0-0x1780)
//
extern EFI_HANDLE                  gImageHandle;
extern EFI_SYSTEM_TABLE           *gSystemTable;
extern EFI_BOOT_SERVICES          *gBootServices;
extern EFI_RUNTIME_SERVICES       *gRuntimeServices;

extern VOID                       *gHobList;               /* 0x1728 */
extern VOID                       *gDebugOutputProtocol;   /* 0x1720 */
extern EFI_STATUS                 *gDebugOutputProtocol2;  /* 0x1758 */
extern UINT8                       gDebugInitialized;      /* 0x1730 */
extern UINT8                       gDebugMode;             /* 0x1731 */

extern EFI_SYSTEM_TABLE           *gSavedSystemTable;      /* 0x1760 */
extern EFI_BOOT_SERVICES          *gSavedBootServices;     /* 0x1740 */
extern EFI_RUNTIME_SERVICES       *gSavedRuntimeServices;  /* 0x1748 */

//
// Function prototypes
//
EFI_STATUS
EFIAPI
_ModuleEntryPoint (
  IN EFI_HANDLE        ImageHandle,
  IN EFI_SYSTEM_TABLE *SystemTable
  );

EFI_STATUS
__fastcall
AmiBoardInfo2Entry (
  IN EFI_HANDLE        ImageHandle,
  IN EFI_SYSTEM_TABLE *SystemTable
  );

EFI_STATUS
__fastcall
HobFindGuid (
  IN     EFI_GUID *Guid,
  OUT    VOID     **Hob
  );

VOID *
__fastcall
GetHobList (
  VOID
  );

BOOLEAN
__fastcall
HobIsMatchingGuid (
  IN CONST EFI_GUID *Guid1,
  IN CONST EFI_GUID *Guid2
  );

EFI_STATUS
__fastcall
HobFindProtocolData (
  OUT UINT64 *DataAddr,
  OUT UINT64 *DataSize,
  IN  UINT32  Signature,
  IN  CHAR8  *NameFilter OPTIONAL
  );

VOID *
__fastcall
HobGetDataPtr (
  IN CONST VOID *Hob
  );

UINT64
__fastcall
ReadUnaligned64 (
  IN CONST UINT64 *Buffer
  );

INTN
__fastcall
CompareMem (
  IN CONST VOID *Buffer1,
  IN CONST VOID *Buffer2,
  IN UINTN       Length
  );

VOID *
__fastcall
InternalCopyMem (
  OUT VOID       *Destination,
  IN  CONST VOID *Source,
  IN  UINTN       Length
  );

//
// Debug output functions
//
VOID *
__fastcall
DebugLibGetDebugOutput (
  VOID
  );

UINTN
__fastcall
DebugVPrint (
  IN UINTN       ErrorLevel,
  IN CONST CHAR8 *Format,
  ...
  );

VOID
__fastcall
DebugPrintAssert (
  IN CONST CHAR8 *FileName,
  IN UINTN        LineNumber,
  IN CONST CHAR8 *FailedCondition
  );

UINTN
__fastcall
DebugGetPlatformDebugLevel (
  VOID
  );

EFI_STATUS
__fastcall
DebugLibInitialize (
  VOID
  );

UINTN
__fastcall
BoardInfoDebugPrint (
  IN UINTN       ErrorLevel,
  IN CONST CHAR8 *Format,
  ...
  );

#endif /* __AMIBOARDINFO2_H__ */