Author: fireball
Date: Mon Jan 28 16:29:45 2008
New Revision: 32035
URL:
http://svn.reactos.org/svn/reactos?rev=32035&view=rev
Log:
- Properly fill ACPI BIOS configuration entry (a couple of ACPI specification structures
were added, which should be moved to another header in future). This makes Windows 2003
initialize HAL (ACPI version) properly and be able to connect to the debugger.
- Make harddisk identifiers lowercase.
Modified:
trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c
trunk/reactos/boot/freeldr/freeldr/arch/i386/hwacpi.c
trunk/reactos/boot/freeldr/freeldr/include/winldr.h
trunk/reactos/boot/freeldr/freeldr/mm/mm.c
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c Mon Jan 28 16:29:45 2008
@@ -79,7 +79,7 @@
/* Timeout in ms for sending to keyboard controller. */
#define CONTROLLER_TIMEOUT 250
-static CHAR Hex[] = "0123456789ABCDEF";
+static CHAR Hex[] = "0123456789abcdef";
static unsigned int delay_count = 1;
extern ULONG reactos_disk_count;
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/hwacpi.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/hwacpi.c (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/hwacpi.c Mon Jan 28 16:29:45 2008
@@ -23,7 +23,7 @@
BOOLEAN AcpiPresent = FALSE;
-static BOOLEAN
+static PRSDP_DESCRIPTOR
FindAcpiBios(VOID)
{
PUCHAR Ptr;
@@ -36,7 +36,7 @@
{
DbgPrint((DPRINT_HWDETECT, "ACPI supported\n"));
- return TRUE;
+ return (PRSDP_DESCRIPTOR)Ptr;
}
Ptr = (PUCHAR)((ULONG)Ptr + 0x10);
@@ -44,7 +44,7 @@
DbgPrint((DPRINT_HWDETECT, "ACPI not supported\n"));
- return FALSE;
+ return NULL;
}
@@ -52,9 +52,16 @@
DetectAcpiBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
{
PCONFIGURATION_COMPONENT_DATA BiosKey;
- CM_PARTIAL_RESOURCE_LIST PartialResourceList;
+ PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
+ PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
+ PRSDP_DESCRIPTOR Rsdp;
+ PACPI_BIOS_DATA AcpiBiosData;
+ BIOS_MEMORY_MAP BiosMemoryMap[32];
+ ULONG BiosMemoryMapEntryCount, TableSize;
- if (FindAcpiBios())
+ Rsdp = FindAcpiBios();
+
+ if (Rsdp)
{
AcpiPresent = TRUE;
@@ -65,31 +72,57 @@
AdapterClass,
MultiFunctionAdapter,
&BiosKey);
-
+
/* Set 'Component Information' */
FldrSetComponentInformation(BiosKey,
0x0,
0x0,
0xFFFFFFFF);
-
+
+ /* Get BIOS memory map */
+ RtlZeroMemory(BiosMemoryMap, sizeof(BIOS_MEMORY_MAP) * 32);
+ BiosMemoryMapEntryCount = MachGetMemoryMap(BiosMemoryMap,
+ sizeof(BiosMemoryMap) / sizeof(BIOS_MEMORY_MAP));
+
+ /* Calculate the table size */
+ TableSize = BiosMemoryMapEntryCount * sizeof(BIOS_MEMORY_MAP) +
+ sizeof(ACPI_BIOS_DATA) - sizeof(BIOS_MEMORY_MAP);
+
/* Set 'Configuration Data' value */
- memset(&PartialResourceList, 0, sizeof(CM_PARTIAL_RESOURCE_LIST));
- PartialResourceList.Version = 0;
- PartialResourceList.Revision = 0;
- PartialResourceList.Count = 0;
+ PartialResourceList =
+ MmHeapAlloc(sizeof(CM_PARTIAL_RESOURCE_LIST) + TableSize);
+ memset(PartialResourceList, 0, sizeof(CM_PARTIAL_RESOURCE_LIST) + TableSize);
+ PartialResourceList->Version = 0;
+ PartialResourceList->Revision = 0;
+ PartialResourceList->Count = 1;
+
+ PartialDescriptor = &PartialResourceList->PartialDescriptors[0];
+ PartialDescriptor->Type = CmResourceTypeDeviceSpecific;
+ PartialDescriptor->ShareDisposition = CmResourceShareUndetermined;
+ PartialDescriptor->u.DeviceSpecificData.DataSize = TableSize;
+
+ /* Fill the table */
+ AcpiBiosData =
(PACPI_BIOS_DATA)&PartialResourceList->PartialDescriptors[1];
+ AcpiBiosData->RSDTAddress.LowPart = Rsdp->rsdt_physical_address;
+ AcpiBiosData->Count = BiosMemoryMapEntryCount;
+ memcpy(AcpiBiosData->MemoryMap, BiosMemoryMap,
+ BiosMemoryMapEntryCount * sizeof(BIOS_MEMORY_MAP));
+
+ DbgPrint((DPRINT_HWDETECT, "RSDT %p, data size %x\n",
Rsdp->rsdt_physical_address,
+ TableSize));
+
FldrSetConfigurationData(BiosKey,
- &PartialResourceList,
- sizeof(CM_PARTIAL_RESOURCE_LIST) -
- sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR));
+ PartialResourceList,
+ sizeof(CM_PARTIAL_RESOURCE_LIST) + TableSize
+ );
/* Increment bus number */
(*BusNumber)++;
-
+
/* Set 'Identifier' value */
FldrSetIdentifier(BiosKey, "ACPI BIOS");
+ MmFreeMemory(PartialResourceList);
}
-
- /* FIXME: Add congiguration data */
}
/* EOF */
Modified: trunk/reactos/boot/freeldr/freeldr/include/winldr.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/include/winldr.h (original)
+++ trunk/reactos/boot/freeldr/freeldr/include/winldr.h Mon Jan 28 16:29:45 2008
@@ -1,83 +1,107 @@
-/*
- * FreeLoader
- * Copyright (C) 1998-2003 Brian Palmer <brianp(a)sginet.com>
- * Copyright (C) 2006 Aleksey Bragin <aleksey(a)reactos.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef __WINLDR_H
-#define __WINLDR_H
-
-
-///////////////////////////////////////////////////////////////////////////////////////
-//
-// ReactOS Loading Functions
-//
-///////////////////////////////////////////////////////////////////////////////////////
-VOID LoadAndBootWindows(PCSTR OperatingSystemName, WORD OperatingSystemVersion);
-
-/* Entry-point to kernel */
-typedef
-VOID
-NTAPI
-(*KERNEL_ENTRY_POINT) (PLOADER_PARAMETER_BLOCK LoaderBlock);
-
-
-// Some definitions
-#define SECTOR_SIZE 512
-
-// Descriptors
-#define NUM_GDT 128 // Must be 128
-#define NUM_IDT 0x100 // only 16 are used though. Must be 0x100
-
-// conversion.c
-PVOID VaToPa(PVOID Va);
-PVOID PaToVa(PVOID Pa);
-VOID List_PaToVa(LIST_ENTRY *ListEntry);
-VOID ConvertConfigToVA(PCONFIGURATION_COMPONENT_DATA Start);
-
-// peloader.c
-BOOLEAN
-WinLdrLoadImage(IN PCHAR FileName,
- TYPE_OF_MEMORY MemoryType,
- OUT PVOID *ImageBasePA);
-
-
-BOOLEAN
-WinLdrAllocateDataTableEntry(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
- IN PCCH BaseDllName,
- IN PCCH FullDllName,
- IN PVOID BasePA,
- OUT PLDR_DATA_TABLE_ENTRY *NewEntry);
-
-BOOLEAN
-WinLdrScanImportDescriptorTable(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
- IN PCCH DirectoryPath,
- IN PLDR_DATA_TABLE_ENTRY ScanDTE);
-
-// wlmemory.c
-BOOLEAN
-WinLdrTurnOnPaging(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
- ULONG PcrBasePage,
- ULONG TssBasePage,
- PVOID GdtIdt);
-
-// wlregistry.c
-BOOLEAN WinLdrLoadAndScanSystemHive(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
- IN LPCSTR DirectoryPath);
-
-
-#endif // defined __WINLDR_H
+/*
+ * FreeLoader
+ * Copyright (C) 1998-2003 Brian Palmer <brianp(a)sginet.com>
+ * Copyright (C) 2006 Aleksey Bragin <aleksey(a)reactos.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef __WINLDR_H
+#define __WINLDR_H
+
+
+///////////////////////////////////////////////////////////////////////////////////////
+//
+// ReactOS Loading Functions
+//
+///////////////////////////////////////////////////////////////////////////////////////
+VOID LoadAndBootWindows(PCSTR OperatingSystemName, WORD OperatingSystemVersion);
+
+/* Entry-point to kernel */
+typedef
+VOID
+NTAPI
+(*KERNEL_ENTRY_POINT) (PLOADER_PARAMETER_BLOCK LoaderBlock);
+
+
+// Some definitions
+#define SECTOR_SIZE 512
+
+// Descriptors
+#define NUM_GDT 128 // Must be 128
+#define NUM_IDT 0x100 // only 16 are used though. Must be 0x100
+
+// conversion.c
+PVOID VaToPa(PVOID Va);
+PVOID PaToVa(PVOID Pa);
+VOID List_PaToVa(LIST_ENTRY *ListEntry);
+VOID ConvertConfigToVA(PCONFIGURATION_COMPONENT_DATA Start);
+
+// peloader.c
+BOOLEAN
+WinLdrLoadImage(IN PCHAR FileName,
+ TYPE_OF_MEMORY MemoryType,
+ OUT PVOID *ImageBasePA);
+
+
+BOOLEAN
+WinLdrAllocateDataTableEntry(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
+ IN PCCH BaseDllName,
+ IN PCCH FullDllName,
+ IN PVOID BasePA,
+ OUT PLDR_DATA_TABLE_ENTRY *NewEntry);
+
+BOOLEAN
+WinLdrScanImportDescriptorTable(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
+ IN PCCH DirectoryPath,
+ IN PLDR_DATA_TABLE_ENTRY ScanDTE);
+
+// wlmemory.c
+BOOLEAN
+WinLdrTurnOnPaging(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
+ ULONG PcrBasePage,
+ ULONG TssBasePage,
+ PVOID GdtIdt);
+
+// wlregistry.c
+BOOLEAN WinLdrLoadAndScanSystemHive(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
+ IN LPCSTR DirectoryPath);
+
+
+/* FIXME: Should be moved to NDK, and respective ACPI header files */
+typedef struct _ACPI_BIOS_DATA
+{
+ PHYSICAL_ADDRESS RSDTAddress;
+ ULONGLONG Count;
+ BIOS_MEMORY_MAP MemoryMap[1]; /* Count of BIOS memory map entries */
+} ACPI_BIOS_DATA, *PACPI_BIOS_DATA;
+
+#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>
+
+
+#endif // defined __WINLDR_H
Modified: trunk/reactos/boot/freeldr/freeldr/mm/mm.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/mm/mm…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/mm/mm.c (original)
+++ trunk/reactos/boot/freeldr/freeldr/mm/mm.c Mon Jan 28 16:29:45 2008
@@ -77,7 +77,6 @@
#ifdef DBG
DbgPrint((DPRINT_MEMORY, "Allocated %d bytes (%d pages) of memory starting at page
%d.\n", MemorySize, PagesNeeded, FirstFreePageFromEnd));
DbgPrint((DPRINT_MEMORY, "Memory allocation pointer: 0x%x\n", MemPointer));
- //VerifyHeap();
#endif // DBG
// Now return the pointer
@@ -174,7 +173,6 @@
#ifdef DBG
DbgPrint((DPRINT_MEMORY, "Allocated %d bytes (%d pages) of memory starting at page
%d.\n", MemorySize, PagesNeeded, StartPageNumber));
DbgPrint((DPRINT_MEMORY, "Memory allocation pointer: 0x%x\n", MemPointer));
- //VerifyHeap();
#endif // DBG
// Now return the pointer
@@ -228,7 +226,6 @@
#ifdef DBG
DbgPrint((DPRINT_MEMORY, "Allocated %d bytes (%d pages) of memory starting at page
%d.\n", MemorySize, PagesNeeded, FirstFreePageFromEnd));
DbgPrint((DPRINT_MEMORY, "Memory allocation pointer: 0x%x\n", MemPointer));
- //VerifyHeap();
#endif // DBG
// Now return the pointer