mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 14:43:02 +00:00
Revert "[FREELDR] Pass the correct ACPI table for Windows (#7486)"
Sorry this is something I had to do, I should have investigated deeper
before approving it and that's on me so ill take this over and get this
done. and credit you once again. Thank you @ILauncherDev
This reverts commit 185225a5fc
.
This commit is contained in:
parent
b6562a664b
commit
177cbd81af
8 changed files with 36 additions and 106 deletions
|
@ -54,20 +54,6 @@ FindAcpiBios(VOID)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
PVOID
|
|
||||||
FindAcpiTable(VOID)
|
|
||||||
{
|
|
||||||
PRSDP_DESCRIPTOR Rsdp = FindAcpiBios();
|
|
||||||
if (!Rsdp)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
PVOID OutputPointer = (Rsdp->revision > 1 && Rsdp->xsdt_physical_address) ?
|
|
||||||
(PVOID)((ULONG_PTR)Rsdp->xsdt_physical_address) :
|
|
||||||
(PVOID)((ULONG_PTR)Rsdp->rsdt_physical_address);
|
|
||||||
|
|
||||||
TRACE("ACPI table at 0x%p\n", OutputPointer);
|
|
||||||
return OutputPointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
DetectAcpiBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
|
DetectAcpiBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
|
||||||
|
@ -113,11 +99,16 @@ DetectAcpiBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
|
||||||
/* Fill the table */
|
/* Fill the table */
|
||||||
AcpiBiosData = (PACPI_BIOS_DATA)&PartialResourceList->PartialDescriptors[1];
|
AcpiBiosData = (PACPI_BIOS_DATA)&PartialResourceList->PartialDescriptors[1];
|
||||||
|
|
||||||
TRACE("ACPI %s1.0, using %cSDT address\n", Rsdp->revision > 1 ? ">" : "", Rsdp->revision > 1 ? 'X' : 'R');
|
if (Rsdp->revision > 0)
|
||||||
if (Rsdp->revision > 1 && Rsdp->xsdt_physical_address)
|
{
|
||||||
|
TRACE("ACPI >1.0, using XSDT address\n");
|
||||||
AcpiBiosData->RSDTAddress.QuadPart = Rsdp->xsdt_physical_address;
|
AcpiBiosData->RSDTAddress.QuadPart = Rsdp->xsdt_physical_address;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
TRACE("ACPI 1.0, using RSDT address\n");
|
||||||
AcpiBiosData->RSDTAddress.LowPart = Rsdp->rsdt_physical_address;
|
AcpiBiosData->RSDTAddress.LowPart = Rsdp->rsdt_physical_address;
|
||||||
|
}
|
||||||
|
|
||||||
AcpiBiosData->Count = PcBiosMapCount;
|
AcpiBiosData->Count = PcBiosMapCount;
|
||||||
memcpy(AcpiBiosData->MemoryMap, PcBiosMemoryMap,
|
memcpy(AcpiBiosData->MemoryMap, PcBiosMemoryMap,
|
||||||
|
|
|
@ -50,21 +50,6 @@ FindAcpiBios(VOID)
|
||||||
return rsdp;
|
return rsdp;
|
||||||
}
|
}
|
||||||
|
|
||||||
PVOID
|
|
||||||
FindAcpiTable(VOID)
|
|
||||||
{
|
|
||||||
PRSDP_DESCRIPTOR Rsdp = FindAcpiBios();
|
|
||||||
if (!Rsdp)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
PVOID OutputPointer = (Rsdp->revision > 1 && Rsdp->xsdt_physical_address) ?
|
|
||||||
(PVOID)((ULONG_PTR)Rsdp->xsdt_physical_address) :
|
|
||||||
(PVOID)((ULONG_PTR)Rsdp->rsdt_physical_address);
|
|
||||||
|
|
||||||
TRACE("ACPI table at 0x%p\n", OutputPointer);
|
|
||||||
return OutputPointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
DetectAcpiBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
|
DetectAcpiBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
|
||||||
{
|
{
|
||||||
|
@ -108,11 +93,16 @@ DetectAcpiBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
|
||||||
/* Fill the table */
|
/* Fill the table */
|
||||||
AcpiBiosData = (PACPI_BIOS_DATA)&PartialResourceList->PartialDescriptors[1];
|
AcpiBiosData = (PACPI_BIOS_DATA)&PartialResourceList->PartialDescriptors[1];
|
||||||
|
|
||||||
TRACE("ACPI %s1.0, using %cSDT address\n", Rsdp->revision > 1 ? ">" : "", Rsdp->revision > 1 ? 'X' : 'R');
|
if (Rsdp->revision > 0)
|
||||||
if (Rsdp->revision > 1 && Rsdp->xsdt_physical_address)
|
{
|
||||||
|
TRACE("ACPI >1.0, using XSDT address\n");
|
||||||
AcpiBiosData->RSDTAddress.QuadPart = Rsdp->xsdt_physical_address;
|
AcpiBiosData->RSDTAddress.QuadPart = Rsdp->xsdt_physical_address;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
TRACE("ACPI 1.0, using RSDT address\n");
|
||||||
AcpiBiosData->RSDTAddress.LowPart = Rsdp->rsdt_physical_address;
|
AcpiBiosData->RSDTAddress.LowPart = Rsdp->rsdt_physical_address;
|
||||||
|
}
|
||||||
|
|
||||||
AcpiBiosData->Count = FreeldrDescCount;
|
AcpiBiosData->Count = FreeldrDescCount;
|
||||||
memcpy(AcpiBiosData->MemoryMap, EfiMemoryMap,
|
memcpy(AcpiBiosData->MemoryMap, EfiMemoryMap,
|
||||||
|
|
|
@ -108,7 +108,6 @@
|
||||||
@ cdecl GetArgumentValue()
|
@ cdecl GetArgumentValue()
|
||||||
@ cdecl GetBootMgrInfo()
|
@ cdecl GetBootMgrInfo()
|
||||||
@ cdecl IsAcpiPresent()
|
@ cdecl IsAcpiPresent()
|
||||||
@ cdecl FindAcpiTable()
|
|
||||||
@ cdecl LoadSettings()
|
@ cdecl LoadSettings()
|
||||||
@ cdecl MachHwDetect()
|
@ cdecl MachHwDetect()
|
||||||
@ cdecl MachPrepareForReactOS()
|
@ cdecl MachPrepareForReactOS()
|
||||||
|
|
|
@ -84,7 +84,6 @@ DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA SystemKey,
|
||||||
PCONFIGURATION_COMPONENT_DATA BusKey);
|
PCONFIGURATION_COMPONENT_DATA BusKey);
|
||||||
|
|
||||||
/* hwacpi.c */
|
/* hwacpi.c */
|
||||||
PVOID FindAcpiTable(VOID);
|
|
||||||
VOID DetectAcpiBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber);
|
VOID DetectAcpiBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber);
|
||||||
|
|
||||||
/* hwapm.c */
|
/* hwapm.c */
|
||||||
|
|
|
@ -1,51 +0,0 @@
|
||||||
/*
|
|
||||||
* PROJECT: FreeLoader
|
|
||||||
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
|
|
||||||
* PURPOSE: Define ACPI Structures
|
|
||||||
* COPYRIGHT: Copyright 2006-2019 Aleksey Bragin <aleksey@reactos.org>
|
|
||||||
* Copyright 2024 Daniel Victor <ilauncherdeveloper@gmail.com>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <pshpack1.h>
|
|
||||||
|
|
||||||
typedef struct /* ACPI Description Header */
|
|
||||||
{
|
|
||||||
CHAR Signature[4];
|
|
||||||
ULONG Length;
|
|
||||||
UCHAR Revision;
|
|
||||||
UCHAR Checksum;
|
|
||||||
CHAR OEMID[6];
|
|
||||||
CHAR OEMTableID[8];
|
|
||||||
ULONG OEMRevision;
|
|
||||||
ULONG CreatorID;
|
|
||||||
ULONG CreatorRev;
|
|
||||||
} DESCRIPTION_HEADER, *PDESCRIPTION_HEADER;
|
|
||||||
|
|
||||||
typedef struct /* Root System Descriptor Table */
|
|
||||||
{
|
|
||||||
DESCRIPTION_HEADER Header;
|
|
||||||
ULONG PointerToOtherSDT[];
|
|
||||||
} RSDT_DESCRIPTOR, *PRSDT_DESCRIPTOR;
|
|
||||||
|
|
||||||
typedef struct /* eXtended System Descriptor Table */
|
|
||||||
{
|
|
||||||
DESCRIPTION_HEADER Header;
|
|
||||||
ULONGLONG PointerToOtherSDT[];
|
|
||||||
} XSDT_DESCRIPTOR, *PXSDT_DESCRIPTOR;
|
|
||||||
|
|
||||||
typedef struct /* Root System Descriptor Pointer */
|
|
||||||
{
|
|
||||||
CHAR signature [8]; /* contains "RSD PTR " */
|
|
||||||
UCHAR checksum; /* to make sum of struct == 0 */
|
|
||||||
CHAR oem_id [6]; /* OEM identification */
|
|
||||||
UCHAR revision; /* Must be 0 for 1.0, 2 for 2.0 */
|
|
||||||
ULONG rsdt_physical_address; /* 32-bit physical address of RSDT */
|
|
||||||
ULONG length; /* XSDT Length in bytes including hdr */
|
|
||||||
ULONGLONG xsdt_physical_address; /* 64-bit physical address of XSDT */
|
|
||||||
UCHAR extended_checksum; /* Checksum of entire table */
|
|
||||||
CHAR reserved [3]; /* reserved field must be 0 */
|
|
||||||
} RSDP_DESCRIPTOR, *PRSDP_DESCRIPTOR;
|
|
||||||
|
|
||||||
#include <poppack.h>
|
|
|
@ -8,13 +8,29 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <arc/setupblk.h>
|
#include <arc/setupblk.h>
|
||||||
#include <hwacpi.h>
|
|
||||||
|
|
||||||
// See freeldr/ntldr/winldr.h
|
// See freeldr/ntldr/winldr.h
|
||||||
#define TAG_WLDR_DTE 'eDlW'
|
#define TAG_WLDR_DTE 'eDlW'
|
||||||
#define TAG_WLDR_BDE 'dBlW'
|
#define TAG_WLDR_BDE 'dBlW'
|
||||||
#define TAG_WLDR_NAME 'mNlW'
|
#define TAG_WLDR_NAME 'mNlW'
|
||||||
|
|
||||||
|
// Some definitions
|
||||||
|
|
||||||
|
#include <pshpack1.h>
|
||||||
|
typedef struct /* Root System Descriptor Pointer */
|
||||||
|
{
|
||||||
|
CHAR signature [8]; /* contains "RSD PTR " */
|
||||||
|
UCHAR checksum; /* to make sum of struct == 0 */
|
||||||
|
CHAR oem_id [6]; /* OEM identification */
|
||||||
|
UCHAR revision; /* Must be 0 for 1.0, 2 for 2.0 */
|
||||||
|
ULONG rsdt_physical_address; /* 32-bit physical address of RSDT */
|
||||||
|
ULONG length; /* XSDT Length in bytes including hdr */
|
||||||
|
ULONGLONG xsdt_physical_address; /* 64-bit physical address of XSDT */
|
||||||
|
UCHAR extended_checksum; /* Checksum of entire table */
|
||||||
|
CHAR reserved [3]; /* reserved field must be 0 */
|
||||||
|
} RSDP_DESCRIPTOR, *PRSDP_DESCRIPTOR;
|
||||||
|
#include <poppack.h>
|
||||||
|
|
||||||
typedef struct _ARC_DISK_SIGNATURE_EX
|
typedef struct _ARC_DISK_SIGNATURE_EX
|
||||||
{
|
{
|
||||||
ARC_DISK_SIGNATURE DiskSignature;
|
ARC_DISK_SIGNATURE DiskSignature;
|
||||||
|
|
|
@ -246,11 +246,12 @@ WinLdrInitializePhase1(PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
/* FIXME! HACK value for docking profile */
|
/* FIXME! HACK value for docking profile */
|
||||||
Extension->Profile.Status = 2;
|
Extension->Profile.Status = 2;
|
||||||
|
|
||||||
PDESCRIPTION_HEADER AcpiTable = FindAcpiTable();
|
/* Check if FreeLdr detected a ACPI table */
|
||||||
if (AcpiTable)
|
if (IsAcpiPresent())
|
||||||
{
|
{
|
||||||
Extension->AcpiTable = AcpiTable;
|
/* Set the pointer to something for compatibility */
|
||||||
Extension->AcpiTableSize = AcpiTable->Length;
|
Extension->AcpiTable = (PVOID)1;
|
||||||
|
// FIXME: Extension->AcpiTableSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VersionToBoot >= _WIN32_WINNT_VISTA)
|
if (VersionToBoot >= _WIN32_WINNT_VISTA)
|
||||||
|
|
|
@ -173,7 +173,6 @@ MempSetupPagingForRegion(
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
WinLdrSetupMemoryLayout(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock)
|
WinLdrSetupMemoryLayout(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||||
{
|
{
|
||||||
PLOADER_PARAMETER_EXTENSION Extension = VaToPa(LoaderBlock->Extension);
|
|
||||||
PFN_NUMBER i, PagesCount, MemoryMapSizeInPages, NoEntries;
|
PFN_NUMBER i, PagesCount, MemoryMapSizeInPages, NoEntries;
|
||||||
PFN_NUMBER LastPageIndex, MemoryMapStartPage;
|
PFN_NUMBER LastPageIndex, MemoryMapStartPage;
|
||||||
PPAGE_LOOKUP_TABLE_ITEM MemoryMap;
|
PPAGE_LOOKUP_TABLE_ITEM MemoryMap;
|
||||||
|
@ -232,20 +231,6 @@ WinLdrSetupMemoryLayout(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Always map the ACPI table if present, otherwise Windows will crash.
|
|
||||||
if (Extension->AcpiTable)
|
|
||||||
{
|
|
||||||
PVOID AcpiTableClone = MmAllocateMemoryWithType(Extension->AcpiTableSize, LoaderFirmwarePermanent);
|
|
||||||
if (!AcpiTableClone)
|
|
||||||
{
|
|
||||||
ERR("Cannot allocate ACPI table\n");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
RtlCopyMemory(AcpiTableClone, Extension->AcpiTable, Extension->AcpiTableSize);
|
|
||||||
Extension->AcpiTable = AcpiTableClone;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Before creating the map, we need to map pages to kernel mode */
|
/* Before creating the map, we need to map pages to kernel mode */
|
||||||
LastPageIndex = 1;
|
LastPageIndex = 1;
|
||||||
LastPageType = MemoryMap[1].PageAllocated;
|
LastPageType = MemoryMap[1].PageAllocated;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue