Skip to content

Commit 177cbd8

Browse files
committed
Revert "[FREELDR] Pass the correct ACPI table for Windows (reactos#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 185225a.
1 parent b6562a6 commit 177cbd8

File tree

8 files changed

+36
-106
lines changed

8 files changed

+36
-106
lines changed

boot/freeldr/freeldr/arch/i386/hwacpi.c

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -54,20 +54,6 @@ FindAcpiBios(VOID)
5454
return NULL;
5555
}
5656

57-
PVOID
58-
FindAcpiTable(VOID)
59-
{
60-
PRSDP_DESCRIPTOR Rsdp = FindAcpiBios();
61-
if (!Rsdp)
62-
return NULL;
63-
64-
PVOID OutputPointer = (Rsdp->revision > 1 && Rsdp->xsdt_physical_address) ?
65-
(PVOID)((ULONG_PTR)Rsdp->xsdt_physical_address) :
66-
(PVOID)((ULONG_PTR)Rsdp->rsdt_physical_address);
67-
68-
TRACE("ACPI table at 0x%p\n", OutputPointer);
69-
return OutputPointer;
70-
}
7157

7258
VOID
7359
DetectAcpiBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
@@ -113,11 +99,16 @@ DetectAcpiBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
11399
/* Fill the table */
114100
AcpiBiosData = (PACPI_BIOS_DATA)&PartialResourceList->PartialDescriptors[1];
115101

116-
TRACE("ACPI %s1.0, using %cSDT address\n", Rsdp->revision > 1 ? ">" : "", Rsdp->revision > 1 ? 'X' : 'R');
117-
if (Rsdp->revision > 1 && Rsdp->xsdt_physical_address)
102+
if (Rsdp->revision > 0)
103+
{
104+
TRACE("ACPI >1.0, using XSDT address\n");
118105
AcpiBiosData->RSDTAddress.QuadPart = Rsdp->xsdt_physical_address;
106+
}
119107
else
108+
{
109+
TRACE("ACPI 1.0, using RSDT address\n");
120110
AcpiBiosData->RSDTAddress.LowPart = Rsdp->rsdt_physical_address;
111+
}
121112

122113
AcpiBiosData->Count = PcBiosMapCount;
123114
memcpy(AcpiBiosData->MemoryMap, PcBiosMemoryMap,

boot/freeldr/freeldr/arch/uefi/uefihw.c

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -50,21 +50,6 @@ FindAcpiBios(VOID)
5050
return rsdp;
5151
}
5252

53-
PVOID
54-
FindAcpiTable(VOID)
55-
{
56-
PRSDP_DESCRIPTOR Rsdp = FindAcpiBios();
57-
if (!Rsdp)
58-
return NULL;
59-
60-
PVOID OutputPointer = (Rsdp->revision > 1 && Rsdp->xsdt_physical_address) ?
61-
(PVOID)((ULONG_PTR)Rsdp->xsdt_physical_address) :
62-
(PVOID)((ULONG_PTR)Rsdp->rsdt_physical_address);
63-
64-
TRACE("ACPI table at 0x%p\n", OutputPointer);
65-
return OutputPointer;
66-
}
67-
6853
VOID
6954
DetectAcpiBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
7055
{
@@ -108,11 +93,16 @@ DetectAcpiBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
10893
/* Fill the table */
10994
AcpiBiosData = (PACPI_BIOS_DATA)&PartialResourceList->PartialDescriptors[1];
11095

111-
TRACE("ACPI %s1.0, using %cSDT address\n", Rsdp->revision > 1 ? ">" : "", Rsdp->revision > 1 ? 'X' : 'R');
112-
if (Rsdp->revision > 1 && Rsdp->xsdt_physical_address)
96+
if (Rsdp->revision > 0)
97+
{
98+
TRACE("ACPI >1.0, using XSDT address\n");
11399
AcpiBiosData->RSDTAddress.QuadPart = Rsdp->xsdt_physical_address;
100+
}
114101
else
102+
{
103+
TRACE("ACPI 1.0, using RSDT address\n");
115104
AcpiBiosData->RSDTAddress.LowPart = Rsdp->rsdt_physical_address;
105+
}
116106

117107
AcpiBiosData->Count = FreeldrDescCount;
118108
memcpy(AcpiBiosData->MemoryMap, EfiMemoryMap,

boot/freeldr/freeldr/freeldr.spec

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@
108108
@ cdecl GetArgumentValue()
109109
@ cdecl GetBootMgrInfo()
110110
@ cdecl IsAcpiPresent()
111-
@ cdecl FindAcpiTable()
112111
@ cdecl LoadSettings()
113112
@ cdecl MachHwDetect()
114113
@ cdecl MachPrepareForReactOS()

boot/freeldr/freeldr/include/arch/pc/hardware.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA SystemKey,
8484
PCONFIGURATION_COMPONENT_DATA BusKey);
8585

8686
/* hwacpi.c */
87-
PVOID FindAcpiTable(VOID);
8887
VOID DetectAcpiBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber);
8988

9089
/* hwapm.c */

boot/freeldr/freeldr/include/hwacpi.h

Lines changed: 0 additions & 51 deletions
This file was deleted.

boot/freeldr/freeldr/include/ntldr/winldr.h

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,29 @@
88
#pragma once
99

1010
#include <arc/setupblk.h>
11-
#include <hwacpi.h>
1211

1312
// See freeldr/ntldr/winldr.h
1413
#define TAG_WLDR_DTE 'eDlW'
1514
#define TAG_WLDR_BDE 'dBlW'
1615
#define TAG_WLDR_NAME 'mNlW'
1716

17+
// Some definitions
18+
19+
#include <pshpack1.h>
20+
typedef struct /* Root System Descriptor Pointer */
21+
{
22+
CHAR signature [8]; /* contains "RSD PTR " */
23+
UCHAR checksum; /* to make sum of struct == 0 */
24+
CHAR oem_id [6]; /* OEM identification */
25+
UCHAR revision; /* Must be 0 for 1.0, 2 for 2.0 */
26+
ULONG rsdt_physical_address; /* 32-bit physical address of RSDT */
27+
ULONG length; /* XSDT Length in bytes including hdr */
28+
ULONGLONG xsdt_physical_address; /* 64-bit physical address of XSDT */
29+
UCHAR extended_checksum; /* Checksum of entire table */
30+
CHAR reserved [3]; /* reserved field must be 0 */
31+
} RSDP_DESCRIPTOR, *PRSDP_DESCRIPTOR;
32+
#include <poppack.h>
33+
1834
typedef struct _ARC_DISK_SIGNATURE_EX
1935
{
2036
ARC_DISK_SIGNATURE DiskSignature;

boot/freeldr/freeldr/ntldr/winldr.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,11 +246,12 @@ WinLdrInitializePhase1(PLOADER_PARAMETER_BLOCK LoaderBlock,
246246
/* FIXME! HACK value for docking profile */
247247
Extension->Profile.Status = 2;
248248

249-
PDESCRIPTION_HEADER AcpiTable = FindAcpiTable();
250-
if (AcpiTable)
249+
/* Check if FreeLdr detected a ACPI table */
250+
if (IsAcpiPresent())
251251
{
252-
Extension->AcpiTable = AcpiTable;
253-
Extension->AcpiTableSize = AcpiTable->Length;
252+
/* Set the pointer to something for compatibility */
253+
Extension->AcpiTable = (PVOID)1;
254+
// FIXME: Extension->AcpiTableSize;
254255
}
255256

256257
if (VersionToBoot >= _WIN32_WINNT_VISTA)

boot/freeldr/freeldr/ntldr/wlmemory.c

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@ MempSetupPagingForRegion(
173173
BOOLEAN
174174
WinLdrSetupMemoryLayout(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock)
175175
{
176-
PLOADER_PARAMETER_EXTENSION Extension = VaToPa(LoaderBlock->Extension);
177176
PFN_NUMBER i, PagesCount, MemoryMapSizeInPages, NoEntries;
178177
PFN_NUMBER LastPageIndex, MemoryMapStartPage;
179178
PPAGE_LOOKUP_TABLE_ITEM MemoryMap;
@@ -232,20 +231,6 @@ WinLdrSetupMemoryLayout(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock)
232231
return FALSE;
233232
}
234233

235-
// Always map the ACPI table if present, otherwise Windows will crash.
236-
if (Extension->AcpiTable)
237-
{
238-
PVOID AcpiTableClone = MmAllocateMemoryWithType(Extension->AcpiTableSize, LoaderFirmwarePermanent);
239-
if (!AcpiTableClone)
240-
{
241-
ERR("Cannot allocate ACPI table\n");
242-
return FALSE;
243-
}
244-
245-
RtlCopyMemory(AcpiTableClone, Extension->AcpiTable, Extension->AcpiTableSize);
246-
Extension->AcpiTable = AcpiTableClone;
247-
}
248-
249234
/* Before creating the map, we need to map pages to kernel mode */
250235
LastPageIndex = 1;
251236
LastPageType = MemoryMap[1].PageAllocated;

0 commit comments

Comments
 (0)