HalpSetupAcpiPhase0
INT64 __fastcall HalpSetupAcpiPhase0(INT64 a1){
INT64 result;
INT64 Table;
UINT8 *v4;
UINT64 v5;
UINT64 v6;
FADT *v7;
INT64 v8;
INT64 v9;
__int64 v10;
INT64 v11;
void *v12;
PSTR MemoryInternal;
INT64 v14;
__int64 v15;
__int64 v16;
LARGE_INTEGER MaxPhysicalAddress;
if( !HalpProcessedACPIPhase0 )
{
LODWORD(result) = HalpAcpiTableCacheInit((_LOADER_PARAMETER_BLOCK *)a1);
if( (int)result < 0 )
return result;
Table = HalpAcpiGetTable((volatile INT64 *)a1);
v4 = (UINT8 *)Table;
if( !Table )
return 3221226021i64;
v5 = *(unsigned int *)(Table + 4);
v6 = 276i64;
if( (unsigned int)v5 < 0x114 )
v6 = v5;
memmove(&HalpFixedAcpiDescTable, v4, v6);
HalpSetPlatformFlags((FADT *)&HalpFixedAcpiDescTable, (_LOADER_PARAMETER_BLOCK *)a1);
HalpAcpiInitializePmRegisters((FADT *)&HalpFixedAcpiDescTable);
if( (dword_140C49DF0 & 0x40000) != 0 )
HalpInterruptClusterModeForced = 1;
if( (dword_140C49DF0 & 0x80000) != 0 )
HalpInterruptPhysicalModeOnly = 1;
HalpAcpiDetectMachineSpecificActions((_LOADER_PARAMETER_BLOCK *)a1, v7);
HalpNumaInitializeStaticConfiguration((_LOADER_PARAMETER_BLOCK *)a1);
MaxPhysicalAddress.LowPart = 0;
HalpAcpiHmat = HalpAcpiGetTable((volatile INT64 *)a1);
if( HalpAcpiHmat )
{
if( HalpAcpiSrat )
{
if( (int)HalpNumaParseHmat(v8, 0i64, 0i64, (UINT64 *)&MaxPhysicalAddress.QuadPart) >= 0 )
{
MemoryInternal = HalpMmAllocateMemoryInternal(MaxPhysicalAddress.LowPart, MmCached);
v15 = (__int64)MemoryInternal;
if( MemoryInternal )
{
if( (int)HalpNumaParseHmat(
v14,
MemoryInternal,
MaxPhysicalAddress.LowPart,
(UINT64 *)&MaxPhysicalAddress.QuadPart) >= 0 )
HalpHmaConfig = v15;
}
}
}
}
PdttTable = 0i64;
v9 = HalpAcpiGetTable((volatile INT64 *)a1);
v10 = v9;
if( v9 )
{
v16 = *(unsigned __int8 *)(v9 + 36);
if( *(unsigned int *)(v10 + 4) >= (unsigned __int64)*(unsigned int *)(v10 + 40) + 2 * v16 )
{
qword_140C507E8 = (__int64)HalpMmAllocateMemoryInternal((unsigned int)(136 * v16), MmCached);
if( qword_140C507E8 )
PdttTable = v10;
}
}
v11 = HalpAcpiGetTable((volatile INT64 *)a1);
if( v11 )
HalpWAETDeviceFlags = *(_DWORD *)(v11 + 36);
if( !HalpLowStubPhysicalAddress )
{
MaxPhysicalAddress.QuadPart = 0x100000i64;
v12 = (void *)HalpAllocPhysicalMemory((_LOADER_PARAMETER_BLOCK *)a1, &MaxPhysicalAddress);
HalpLowStubPhysicalAddress = v12;
if( v12 )
HalpLowStub = HalpMap((LARGE_INTEGER)v12, MmCached, 1u);
}
if( (dword_140C49DF0 & 3) == 0 )
HalpVirtAddrForFlush = HalpMap((LARGE_INTEGER)HalpLowStubPhysicalAddress, MmCached, 1u);
HalpProcessedACPIPhase0 = 1;
qword_140C00B08 = (__int64)HalAcpiGetTableDispatch;
qword_140C00B10 = (__int64)xHalTimerWatchdogStop;
HalpInitBootTable(a1);
}
return 0i64;
}Referenced by:
HalpAcpiInitDiscard