Author: fireball
Date: Sun Dec 9 23:17:56 2007
New Revision: 31113
URL:
http://svn.reactos.org/svn/reactos?rev=31113&view=rev
Log:
- Refactor creation of component data under the HARDWARE\DESCRIPTION node to use separate
routines in a new ARC file, so that registry routines are factored out of the process.
This allows 1) Better portability with PPC branch (which will need to do the same kind of
hardware work) 2) Ability to eventually get rid of the registry calls and build a true ARC
hardware device tree instead (which the kernel will have to parse during boot). The idea
is to remove registry writing support from freeldr (because the code is old and freeldr
shouldn't be touching the registry anyway). Patch by Alex.
Added:
trunk/reactos/boot/freeldr/freeldr/reactos/archwsup.c (with props)
Modified:
trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c
trunk/reactos/boot/freeldr/freeldr/arch/i386/hwacpi.c
trunk/reactos/boot/freeldr/freeldr/arch/i386/hwapm.c
trunk/reactos/boot/freeldr/freeldr/arch/i386/hwpci.c
trunk/reactos/boot/freeldr/freeldr/freeldr_base.rbuild
trunk/reactos/boot/freeldr/freeldr/include/arch/i386/hardware.h
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 Sun Dec 9 23:17:56 2007
@@ -233,41 +233,12 @@
delay_count /= (MILLISEC / 2); /* Calculate delay_count for 1ms */
}
-
-VOID
-SetComponentInformation(FRLDRHKEY ComponentKey,
- ULONG Flags,
- ULONG Key,
- ULONG Affinity)
-{
- CM_COMPONENT_INFORMATION CompInfo;
- LONG Error;
-
- CompInfo.Flags = Flags;
- CompInfo.Version = 0;
- CompInfo.Key = Key;
- CompInfo.Affinity = Affinity;
-
- /* Set 'Component Information' value */
- Error = RegSetValue(ComponentKey,
- L"Component Information",
- REG_BINARY,
- (PCHAR)&CompInfo,
- sizeof(CM_COMPONENT_INFORMATION));
- if (Error != ERROR_SUCCESS)
- {
- DbgPrint((DPRINT_HWDETECT, "RegSetValue() failed (Error %u)\n",
(int)Error));
- }
-}
-
-
static VOID
DetectPnpBios(FRLDRHKEY SystemKey, ULONG *BusNumber)
{
PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
PCM_PNP_BIOS_DEVICE_NODE DeviceNode;
PCM_PNP_BIOS_INSTALLATION_CHECK InstData;
- WCHAR Buffer[80];
FRLDRHKEY BusKey;
ULONG x;
ULONG NodeSize = 0;
@@ -278,7 +249,6 @@
ULONG PnpBufferSize;
ULONG Size;
char *Ptr;
- LONG Error;
InstData = (PCM_PNP_BIOS_INSTALLATION_CHECK)PnpBiosSupported();
if (InstData == NULL || strncmp((CHAR*)InstData->Signature, "$PnP", 4))
@@ -304,40 +274,20 @@
DbgPrint((DPRINT_HWDETECT, "MaxNodeSize %u NodeCount %u\n", NodeSize,
NodeCount));
DbgPrint((DPRINT_HWDETECT, "Estimated buffer size %u\n", NodeSize *
NodeCount));
- /* Create new bus key */
- swprintf(Buffer,
- L"MultifunctionAdapter\\%u", *BusNumber);
- Error = RegCreateKey(SystemKey,
- Buffer,
- &BusKey);
- if (Error != ERROR_SUCCESS)
- {
- DbgPrint((DPRINT_HWDETECT, "RegCreateKey() failed (Error %u)\n",
(int)Error));
- return;
- }
-
- /* Increment bus number */
- (*BusNumber)++;
-
- /* Set 'Component Information' value similar to my NT4 box */
- SetComponentInformation(BusKey,
- 0x0,
- 0x0,
- 0xFFFFFFFF);
-
- /* Set 'Identifier' value */
- Error = RegSetValue(BusKey,
- L"Identifier",
- REG_SZ,
- (PCHAR)L"PNP BIOS",
- 9 * sizeof(WCHAR));
- if (Error != ERROR_SUCCESS)
- {
- DbgPrint((DPRINT_HWDETECT, "RegSetValue() failed (Error %u)\n",
(int)Error));
- return;
- }
-
- /* Set 'Configuration Data' value */
+ /* Create component key */
+ FldrCreateComponentKey(SystemKey, L"MultifunctionAdapter", *BusNumber,
&BusKey);
+ (*BusNumber)++;
+
+ /* Set the component information */
+ FldrSetComponentInformation(BusKey,
+ 0x0,
+ 0x0,
+ 0xFFFFFFFF);
+
+ /* Set the identifier */
+ FldrSetIdentifier(BusKey, L"PNP BIOS");
+
+ /* Set 'Configuration Data' value */
Size = sizeof(CM_FULL_RESOURCE_DESCRIPTOR) + (NodeSize * NodeCount);
FullResourceDescriptor = MmAllocateMemory(Size);
if (FullResourceDescriptor == NULL)
@@ -404,20 +354,9 @@
DbgPrint((DPRINT_HWDETECT, "Real buffer size: %u\n", PnpBufferSize));
DbgPrint((DPRINT_HWDETECT, "Resource size: %u\n", Size));
-
- /* Set 'Configuration Data' value */
- Error = RegSetValue(BusKey,
- L"Configuration Data",
- REG_FULL_RESOURCE_DESCRIPTOR,
- (PCHAR) FullResourceDescriptor,
- Size);
- MmFreeMemory(FullResourceDescriptor);
- if (Error != ERROR_SUCCESS)
- {
- DbgPrint((DPRINT_HWDETECT,
- "RegSetValue(Configuration Data) failed (Error %u)\n",
- (int)Error));
- }
+
+ FldrSetConfigurationData(BusKey, FullResourceDescriptor, Size);
+ MmFreeMemory(FullResourceDescriptor);
}
@@ -431,7 +370,6 @@
EXTENDED_GEOMETRY ExtGeometry;
GEOMETRY Geometry;
ULONG Size;
- LONG Error;
/* Set 'Configuration Data' value */
Size = sizeof(CM_FULL_RESOURCE_DESCRIPTOR) +
@@ -490,18 +428,8 @@
DiskGeometry->SectorsPerTrack,
DiskGeometry->BytesPerSector));
- Error = RegSetValue(DiskKey,
- L"Configuration Data",
- REG_FULL_RESOURCE_DESCRIPTOR,
- (PCHAR) FullResourceDescriptor,
- Size);
+ FldrSetConfigurationData(DiskKey, FullResourceDescriptor, Size);
MmFreeMemory(FullResourceDescriptor);
- if (Error != ERROR_SUCCESS)
- {
- DbgPrint((DPRINT_HWDETECT,
- "RegSetValue(Configuration Data) failed (Error %u)\n",
- (int)Error));
- }
}
@@ -516,7 +444,6 @@
ULONG Signature;
WCHAR Identifier[20];
CHAR ArcName[256];
- LONG Error;
/* Read the MBR */
if (!MachDiskReadLogicalSectors(DriveNumber, 0ULL, 1, (PVOID)DISKREADBUFFER))
@@ -573,17 +500,7 @@
DbgPrint((DPRINT_HWDETECT, "Identifier: %S\n", Identifier));
/* Set identifier */
- Error = RegSetValue(DiskKey,
- L"Identifier",
- REG_SZ,
- (PCHAR)Identifier,
- sizeof(Identifier));
- if (Error != ERROR_SUCCESS)
- {
- DbgPrint((DPRINT_HWDETECT,
- "RegSetValue(Identifier) failed (Error %u)\n",
- (int)Error));
- }
+ FldrSetIdentifier(DiskKey, Identifier);
}
@@ -594,12 +511,10 @@
PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
PCM_INT13_DRIVE_PARAMETER Int13Drives;
GEOMETRY Geometry;
- WCHAR Buffer[80];
FRLDRHKEY DiskKey;
ULONG DiskCount;
ULONG Size;
ULONG i;
- LONG Error;
BOOLEAN Changed;
/* Count the number of visible drives */
@@ -680,37 +595,17 @@
}
/* Set 'Configuration Data' value */
- Error = RegSetValue(SystemKey,
- L"Configuration Data",
- REG_FULL_RESOURCE_DESCRIPTOR,
- (PCHAR) FullResourceDescriptor,
- Size);
+ FldrSetConfigurationData(SystemKey, FullResourceDescriptor, Size);
MmFreeMemory(FullResourceDescriptor);
- if (Error != ERROR_SUCCESS)
- {
- DbgPrint((DPRINT_HWDETECT,
- "RegSetValue(Configuration Data) failed (Error %u)\n",
- (int)Error));
- return;
- }
/* Create and fill subkey for each harddisk */
for (i = 0; i < DiskCount; i++)
{
/* Create disk key */
- swprintf (Buffer,
- L"DiskController\\0\\DiskPeripheral\\%u",
- i);
-
- Error = RegCreateKey(BusKey,
- Buffer,
- &DiskKey);
- if (Error != ERROR_SUCCESS)
- {
- DbgPrint((DPRINT_HWDETECT, "Failed to create drive key\n"));
- continue;
- }
- DbgPrint((DPRINT_HWDETECT, "Created key: %S\n", Buffer));
+ FldrCreateComponentKey(BusKey,
+ L"DiskController\\0\\DiskPeripheral",
+ i,
+ &DiskKey);
/* Set disk values */
SetHarddiskConfigurationData(DiskKey, 0x80 + i);
@@ -764,11 +659,9 @@
PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
PCM_FLOPPY_DEVICE_DATA FloppyData;
- WCHAR KeyName[32];
WCHAR Identifier[20];
FRLDRHKEY PeripheralKey;
ULONG Size;
- LONG Error;
ULONG FloppyNumber;
UCHAR FloppyType;
ULONG MaxDensity[6] = {0, 360, 1200, 720, 1440, 2880};
@@ -784,25 +677,17 @@
DiskResetController(FloppyNumber);
Ptr = GetInt1eTable();
-
- swprintf(KeyName, L"FloppyDiskPeripheral\\%u", FloppyNumber);
-
- Error = RegCreateKey(ControllerKey,
- KeyName,
- &PeripheralKey);
- if (Error != ERROR_SUCCESS)
- {
- DbgPrint((DPRINT_HWDETECT, "Failed to create peripheral key\n"));
- return;
- }
-
- DbgPrint((DPRINT_HWDETECT, "Created key: %S\n", KeyName));
+
+ FldrCreateComponentKey(ControllerKey,
+ L"FloppyDiskPeripheral",
+ FloppyNumber,
+ &PeripheralKey);
/* Set 'ComponentInformation' value */
- SetComponentInformation(PeripheralKey,
- 0x0,
- FloppyNumber,
- 0xFFFFFFFF);
+ FldrSetComponentInformation(PeripheralKey,
+ 0x0,
+ FloppyNumber,
+ 0xFFFFFFFF);
Size = sizeof(CM_FULL_RESOURCE_DESCRIPTOR) +
sizeof(CM_FLOPPY_DEVICE_DATA);
@@ -838,33 +723,12 @@
FloppyData->DataTransferRate = 0;
/* Set 'Configuration Data' value */
- Error = RegSetValue(PeripheralKey,
- L"Configuration Data",
- REG_FULL_RESOURCE_DESCRIPTOR,
- (PCHAR) FullResourceDescriptor,
- Size);
+ FldrSetConfigurationData(PeripheralKey, FullResourceDescriptor, Size);
MmFreeMemory(FullResourceDescriptor);
- if (Error != ERROR_SUCCESS)
- {
- DbgPrint((DPRINT_HWDETECT,
- "RegSetValue(Configuration Data) failed (Error %u)\n",
- (int)Error));
- return;
- }
/* Set 'Identifier' value */
swprintf(Identifier, L"FLOPPY%u", FloppyNumber + 1);
- Error = RegSetValue(PeripheralKey,
- L"Identifier",
- REG_SZ,
- (PCHAR)Identifier,
- (wcslen(Identifier) + 1) * sizeof(WCHAR));
- if (Error != ERROR_SUCCESS)
- {
- DbgPrint((DPRINT_HWDETECT,
- "RegSetValue() failed (Error %u)\n",
- (int)Error));
- }
+ FldrSetIdentifier(PeripheralKey, Identifier);
}
}
@@ -877,7 +741,6 @@
PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
FRLDRHKEY ControllerKey;
ULONG Size;
- LONG Error;
ULONG FloppyCount;
FloppyCount = GetFloppyCount();
@@ -887,23 +750,18 @@
if (FloppyCount == 0)
return;
-
- Error = RegCreateKey(BusKey,
- L"DiskController\\0",
- &ControllerKey);
- if (Error != ERROR_SUCCESS)
- {
- DbgPrint((DPRINT_HWDETECT, "Failed to create controller key\n"));
- return;
- }
-
+
+ FldrCreateComponentKey(SystemKey,
+ L"DiskController",
+ 0,
+ &ControllerKey);
DbgPrint((DPRINT_HWDETECT, "Created key: DiskController\\0\n"));
/* Set 'ComponentInformation' value */
- SetComponentInformation(ControllerKey,
- 0x64,
- 0,
- 0xFFFFFFFF);
+ FldrSetComponentInformation(ControllerKey,
+ Output | Input | Removable,
+ 0,
+ 0xFFFFFFFF);
Size = sizeof(CM_FULL_RESOURCE_DESCRIPTOR) +
2 * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
@@ -950,19 +808,8 @@
PartialDescriptor->u.Dma.Port = 0;
/* Set 'Configuration Data' value */
- Error = RegSetValue(ControllerKey,
- L"Configuration Data",
- REG_FULL_RESOURCE_DESCRIPTOR,
- (PCHAR) FullResourceDescriptor,
- Size);
+ FldrSetConfigurationData(ControllerKey, FullResourceDescriptor, Size);
MmFreeMemory(FullResourceDescriptor);
- if (Error != ERROR_SUCCESS)
- {
- DbgPrint((DPRINT_HWDETECT,
- "RegSetValue(Configuration Data) failed (Error %u)\n",
- (int)Error));
- return;
- }
DetectBiosFloppyPeripheral(ControllerKey);
}
@@ -1153,7 +1000,6 @@
ULONG i;
ULONG j;
ULONG k;
- LONG Error;
DbgPrint((DPRINT_HWDETECT,
"DetectSerialPointerPeripheral()\n"));
@@ -1281,23 +1127,18 @@
}
/* Create 'PointerPeripheral' key */
- Error = RegCreateKey(ControllerKey,
- L"PointerPeripheral\\0",
- &PeripheralKey);
- if (Error != ERROR_SUCCESS)
- {
- DbgPrint((DPRINT_HWDETECT,
- "Failed to create peripheral key\n"));
- return;
- }
+ FldrCreateComponentKey(ControllerKey,
+ L"PointerPeripheral",
+ 0,
+ &PeripheralKey);
DbgPrint((DPRINT_HWDETECT,
"Created key: PointerPeripheral\\0\n"));
/* Set 'ComponentInformation' value */
- SetComponentInformation(PeripheralKey,
- 0x20,
- 0,
- 0xFFFFFFFF);
+ FldrSetComponentInformation(PeripheralKey,
+ Input,
+ 0,
+ 0xFFFFFFFF);
/* Set 'Configuration Data' value */
memset(&FullResourceDescriptor, 0, sizeof(CM_FULL_RESOURCE_DESCRIPTOR));
@@ -1307,31 +1148,13 @@
FullResourceDescriptor.PartialResourceList.Revision = 1;
FullResourceDescriptor.PartialResourceList.Count = 0;
- Error = RegSetValue(PeripheralKey,
- L"Configuration Data",
- REG_FULL_RESOURCE_DESCRIPTOR,
- (PCHAR)&FullResourceDescriptor,
- sizeof(CM_FULL_RESOURCE_DESCRIPTOR) -
- sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR));
- if (Error != ERROR_SUCCESS)
- {
- DbgPrint((DPRINT_HWDETECT,
- "RegSetValue(Configuration Data) failed (Error %u)\n",
- (int)Error));
- }
+ FldrSetConfigurationData(PeripheralKey,
+ &FullResourceDescriptor,
+ sizeof(CM_FULL_RESOURCE_DESCRIPTOR) -
+ sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR));
/* Set 'Identifier' value */
- Error = RegSetValue(PeripheralKey,
- L"Identifier",
- REG_SZ,
- (PCHAR)Identifier,
- (wcslen(Identifier) + 1) * sizeof(WCHAR));
- if (Error != ERROR_SUCCESS)
- {
- DbgPrint((DPRINT_HWDETECT,
- "RegSetValue() failed (Error %u)\n",
- (int)Error));
- }
+ FldrSetIdentifier(PeripheralKey, Identifier);
}
}
@@ -1349,7 +1172,6 @@
ULONG ControllerNumber = 0;
FRLDRHKEY ControllerKey;
ULONG i;
- LONG Error;
ULONG Size;
DbgPrint((DPRINT_HWDETECT, "DetectSerialPorts()\n"));
@@ -1368,25 +1190,16 @@
Base));
/* Create controller key */
- swprintf(Buffer,
- L"SerialController\\%u",
- ControllerNumber);
-
- Error = RegCreateKey(BusKey,
- Buffer,
- &ControllerKey);
- if (Error != ERROR_SUCCESS)
- {
- DbgPrint((DPRINT_HWDETECT, "Failed to create controller key\n"));
- continue;
- }
- DbgPrint((DPRINT_HWDETECT, "Created key: %S\n", Buffer));
+ FldrCreateComponentKey(BusKey,
+ L"SerialController",
+ ControllerNumber,
+ &ControllerKey);
/* Set 'ComponentInformation' value */
- SetComponentInformation(ControllerKey,
- 0x78,
- ControllerNumber,
- 0xFFFFFFFF);
+ FldrSetComponentInformation(ControllerKey,
+ Output | Input | ConsoleIn | ConsoleOut,
+ ControllerNumber,
+ 0xFFFFFFFF);
/* Build full device descriptor */
Size = sizeof(CM_FULL_RESOURCE_DESCRIPTOR) +
@@ -1438,35 +1251,12 @@
SerialDeviceData->BaudClock = 1843200; /* UART Clock frequency (Hertz) */
/* Set 'Configuration Data' value */
- Error = RegSetValue(ControllerKey,
- L"Configuration Data",
- REG_FULL_RESOURCE_DESCRIPTOR,
- (PCHAR) FullResourceDescriptor,
- Size);
+ FldrSetConfigurationData(ControllerKey, FullResourceDescriptor, Size);
MmFreeMemory(FullResourceDescriptor);
- if (Error != ERROR_SUCCESS)
- {
- DbgPrint((DPRINT_HWDETECT,
- "RegSetValue(Configuration Data) failed (Error %u)\n",
- (int)Error));
- }
-
+
/* Set 'Identifier' value */
- swprintf(Buffer,
- L"COM%u",
- i + 1);
- Error = RegSetValue(ControllerKey,
- L"Identifier",
- REG_SZ,
- (PCHAR)Buffer,
- (wcslen(Buffer) + 1) * sizeof(WCHAR));
- if (Error != ERROR_SUCCESS)
- {
- DbgPrint((DPRINT_HWDETECT,
- "RegSetValue() failed (Error %u)\n",
- (int)Error));
- continue;
- }
+ swprintf(Buffer, L"COM%u", i + 1);
+ FldrSetIdentifier(ControllerKey, Buffer);
DbgPrint((DPRINT_HWDETECT,
"Created value: Identifier %s\n",
Buffer));
@@ -1494,7 +1284,6 @@
ULONG Base;
ULONG ControllerNumber;
ULONG i;
- LONG Error;
ULONG Size;
DbgPrint((DPRINT_HWDETECT, "DetectParallelPorts() called\n"));
@@ -1513,25 +1302,16 @@
Base));
/* Create controller key */
- swprintf(Buffer,
- L"ParallelController\\%u",
- ControllerNumber);
-
- Error = RegCreateKey(BusKey,
- Buffer,
- &ControllerKey);
- if (Error != ERROR_SUCCESS)
- {
- DbgPrint((DPRINT_HWDETECT, "Failed to create controller key\n"));
- continue;
- }
- DbgPrint((DPRINT_HWDETECT, "Created key: %S\n", Buffer));
+ FldrCreateComponentKey(BusKey,
+ L"ParallelController",
+ ControllerNumber,
+ &ControllerKey);
/* Set 'ComponentInformation' value */
- SetComponentInformation(ControllerKey,
- 0x40,
- ControllerNumber,
- 0xFFFFFFFF);
+ FldrSetComponentInformation(ControllerKey,
+ Output,
+ ControllerNumber,
+ 0xFFFFFFFF);
/* Build full device descriptor */
Size = sizeof(CM_FULL_RESOURCE_DESCRIPTOR);
@@ -1576,35 +1356,12 @@
}
/* Set 'Configuration Data' value */
- Error = RegSetValue(ControllerKey,
- L"Configuration Data",
- REG_FULL_RESOURCE_DESCRIPTOR,
- (PCHAR) FullResourceDescriptor,
- Size);
+ FldrSetConfigurationData(ControllerKey, FullResourceDescriptor, Size);
MmFreeMemory(FullResourceDescriptor);
- if (Error != ERROR_SUCCESS)
- {
- DbgPrint((DPRINT_HWDETECT,
- "RegSetValue(Configuration Data) failed (Error %u)\n",
- (int)Error));
- }
/* Set 'Identifier' value */
- swprintf(Buffer,
- L"PARALLEL%u",
- i + 1);
- Error = RegSetValue(ControllerKey,
- L"Identifier",
- REG_SZ,
- (PCHAR)Buffer,
- (wcslen(Buffer) + 1) * sizeof(WCHAR));
- if (Error != ERROR_SUCCESS)
- {
- DbgPrint((DPRINT_HWDETECT,
- "RegSetValue() failed (Error %u)\n",
- (int)Error));
- continue;
- }
+ swprintf(Buffer, L"PARALLEL%u", i + 1);
+ FldrSetIdentifier(ControllerKey, Buffer);
DbgPrint((DPRINT_HWDETECT,
"Created value: Identifier %s\n",
Buffer));
@@ -1695,27 +1452,22 @@
PCM_KEYBOARD_DEVICE_DATA KeyboardData;
FRLDRHKEY PeripheralKey;
ULONG Size;
- LONG Error;
/* HACK: don't call DetectKeyboardDevice() as it fails in Qemu 0.8.2 */
if (TRUE || DetectKeyboardDevice())
{
- /* Create controller key */
- Error = RegCreateKey(ControllerKey,
- L"KeyboardPeripheral\\0",
- &PeripheralKey);
- if (Error != ERROR_SUCCESS)
- {
- DbgPrint((DPRINT_HWDETECT, "Failed to create peripheral key\n"));
- return;
- }
+ /* Create controller key */
+ FldrCreateComponentKey(ControllerKey,
+ L"KeyboardPeripheral",
+ 0,
+ &PeripheralKey);
DbgPrint((DPRINT_HWDETECT, "Created key: KeyboardPeripheral\\0\n"));
/* Set 'ComponentInformation' value */
- SetComponentInformation(ControllerKey,
- 0x28,
- 0,
- 0xFFFFFFFF);
+ FldrSetComponentInformation(ControllerKey,
+ Input | ConsoleIn,
+ 0,
+ 0xFFFFFFFF);
/* Set 'Configuration Data' value */
Size = sizeof(CM_FULL_RESOURCE_DESCRIPTOR) +
@@ -1749,31 +1501,11 @@
KeyboardData->KeyboardFlags = 0x20;
/* Set 'Configuration Data' value */
- Error = RegSetValue(PeripheralKey,
- L"Configuration Data",
- REG_FULL_RESOURCE_DESCRIPTOR,
- (PCHAR)FullResourceDescriptor,
- Size);
+ FldrSetConfigurationData(PeripheralKey, FullResourceDescriptor, Size);
MmFreeMemory(FullResourceDescriptor);
- if (Error != ERROR_SUCCESS)
- {
- DbgPrint((DPRINT_HWDETECT,
- "RegSetValue(Configuration Data) failed (Error %u)\n",
- (int)Error));
- }
/* Set 'Identifier' value */
- Error = RegSetValue(PeripheralKey,
- L"Identifier",
- REG_SZ,
- (PCHAR)L"PCAT_ENHANCED",
- 14 * sizeof(WCHAR));
- if (Error != ERROR_SUCCESS)
- {
- DbgPrint((DPRINT_HWDETECT,
- "RegSetValue() failed (Error %u)\n",
- (int)Error));
- }
+ FldrSetIdentifier(PeripheralKey, L"PCAT_ENHANCED");
}
}
@@ -1785,24 +1517,19 @@
PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
FRLDRHKEY ControllerKey;
ULONG Size;
- LONG Error;
/* Create controller key */
- Error = RegCreateKey(BusKey,
- L"KeyboardController\\0",
- &ControllerKey);
- if (Error != ERROR_SUCCESS)
- {
- DbgPrint((DPRINT_HWDETECT, "Failed to create controller key\n"));
- return;
- }
+ FldrCreateComponentKey(BusKey,
+ L"KeyboardController",
+ 0,
+ &ControllerKey);
DbgPrint((DPRINT_HWDETECT, "Created key: KeyboardController\\0\n"));
/* Set 'ComponentInformation' value */
- SetComponentInformation(ControllerKey,
- 0x28,
- 0,
- 0xFFFFFFFF);
+ FldrSetComponentInformation(ControllerKey,
+ Input | ConsoleIn,
+ 0,
+ 0xFFFFFFFF);
/* Set 'Configuration Data' value */
Size = sizeof(CM_FULL_RESOURCE_DESCRIPTOR) +
@@ -1851,20 +1578,9 @@
PartialDescriptor->u.Port.Length = 1;
/* Set 'Configuration Data' value */
- Error = RegSetValue(ControllerKey,
- L"Configuration Data",
- REG_FULL_RESOURCE_DESCRIPTOR,
- (PCHAR)FullResourceDescriptor,
- Size);
+ FldrSetConfigurationData(ControllerKey, FullResourceDescriptor, Size);
MmFreeMemory(FullResourceDescriptor);
- if (Error != ERROR_SUCCESS)
- {
- DbgPrint((DPRINT_HWDETECT,
- "RegSetValue(Configuration Data) failed (Error %u)\n",
- (int)Error));
- return;
- }
-
+
DetectKeyboardPeripheral(ControllerKey);
}
@@ -1984,28 +1700,23 @@
CM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
FRLDRHKEY ControllerKey;
FRLDRHKEY PeripheralKey;
- LONG Error;
if (DetectPS2AuxPort())
{
DbgPrint((DPRINT_HWDETECT, "Detected PS2 port\n"));
/* Create controller key */
- Error = RegCreateKey(BusKey,
- L"PointerController\\0",
- &ControllerKey);
- if (Error != ERROR_SUCCESS)
- {
- DbgPrint((DPRINT_HWDETECT, "Failed to create controller key\n"));
- return;
- }
+ FldrCreateComponentKey(BusKey,
+ L"PointerController",
+ 0,
+ &ControllerKey);
DbgPrint((DPRINT_HWDETECT, "Created key: PointerController\\0\n"));
/* Set 'ComponentInformation' value */
- SetComponentInformation(ControllerKey,
- 0x20,
- 0,
- 0xFFFFFFFF);
+ FldrSetComponentInformation(ControllerKey,
+ Input,
+ 0,
+ 0xFFFFFFFF);
memset(&FullResourceDescriptor, 0, sizeof(CM_FULL_RESOURCE_DESCRIPTOR));
@@ -2025,40 +1736,26 @@
FullResourceDescriptor.PartialResourceList.PartialDescriptors[0].u.Interrupt.Affinity =
0xFFFFFFFF;
/* Set 'Configuration Data' value */
- Error = RegSetValue(ControllerKey,
- L"Configuration Data",
- REG_FULL_RESOURCE_DESCRIPTOR,
- (PCHAR)&FullResourceDescriptor,
- sizeof(CM_FULL_RESOURCE_DESCRIPTOR));
- if (Error != ERROR_SUCCESS)
- {
- DbgPrint((DPRINT_HWDETECT,
- "RegSetValue(Configuration Data) failed (Error %u)\n",
- (int)Error));
- return;
- }
-
+ FldrSetConfigurationData(ControllerKey,
+ &FullResourceDescriptor,
+ sizeof(CM_FULL_RESOURCE_DESCRIPTOR));
if (DetectPS2AuxDevice())
{
DbgPrint((DPRINT_HWDETECT, "Detected PS2 mouse\n"));
- /* Create peripheral key */
- Error = RegCreateKey(ControllerKey,
- L"PointerPeripheral\\0",
- &PeripheralKey);
- if (Error != ERROR_SUCCESS)
- {
- DbgPrint((DPRINT_HWDETECT, "Failed to create peripheral key\n"));
- return;
- }
+ /* Create peripheral key */
+ FldrCreateComponentKey(ControllerKey,
+ L"PointerController",
+ 0,
+ &PeripheralKey);
DbgPrint((DPRINT_HWDETECT, "Created key: PointerPeripheral\\0\n"));
/* Set 'ComponentInformation' value */
- SetComponentInformation(PeripheralKey,
- 0x20,
- 0,
- 0xFFFFFFFF);
+ FldrSetComponentInformation(PeripheralKey,
+ Input,
+ 0,
+ 0xFFFFFFFF);
/* Initialize resource descriptor */
memset(&FullResourceDescriptor, 0, sizeof(CM_FULL_RESOURCE_DESCRIPTOR));
@@ -2069,35 +1766,15 @@
FullResourceDescriptor.PartialResourceList.Count = 0;
/* Set 'Configuration Data' value */
- Error = RegSetValue(PeripheralKey,
- L"Configuration Data",
- REG_FULL_RESOURCE_DESCRIPTOR,
- (PCHAR)&FullResourceDescriptor,
- sizeof(CM_FULL_RESOURCE_DESCRIPTOR) -
- sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR));
- if (Error != ERROR_SUCCESS)
- {
- DbgPrint((DPRINT_HWDETECT,
- "RegSetValue(Configuration Data) failed (Error %u)\n",
- (int)Error));
- return;
- }
+ FldrSetConfigurationData(PeripheralKey,
+ &FullResourceDescriptor,
+ sizeof(CM_FULL_RESOURCE_DESCRIPTOR) -
+ sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR));
/* Set 'Identifier' value */
- Error = RegSetValue(PeripheralKey,
- L"Identifier",
- REG_SZ,
- (PCHAR)L"MICROSOFT PS2 MOUSE",
- 20 * sizeof(WCHAR));
- if (Error != ERROR_SUCCESS)
- {
- DbgPrint((DPRINT_HWDETECT,
- "RegSetValue() failed (Error %u)\n",
- (int)Error));
- return;
- }
- }
- }
+ FldrSetIdentifier(PeripheralKey, L"MICROSOFT PS2 MOUSE");
+ }
+ }
}
@@ -2107,23 +1784,18 @@
WCHAR Buffer[80];
FRLDRHKEY ControllerKey;
USHORT VesaVersion;
- LONG Error;
-
- Error = RegCreateKey(BusKey,
- L"DisplayController\\0",
- &ControllerKey);
- if (Error != ERROR_SUCCESS)
- {
- DbgPrint((DPRINT_HWDETECT, "Failed to create controller key\n"));
- return;
- }
+
+ FldrCreateComponentKey(BusKey,
+ L"DisplayController",
+ 0,
+ &ControllerKey);
DbgPrint((DPRINT_HWDETECT, "Created key: DisplayController\\0\n"));
/* Set 'ComponentInformation' value */
- SetComponentInformation(ControllerKey,
- 0x00,
- 0,
- 0xFFFFFFFF);
+ FldrSetComponentInformation(ControllerKey,
+ 0x00,
+ 0,
+ 0xFFFFFFFF);
/* FIXME: Set 'ComponentInformation' value */
@@ -2153,18 +1825,7 @@
}
/* Set 'Identifier' value */
- Error = RegSetValue(ControllerKey,
- L"Identifier",
- REG_SZ,
- (PCHAR)Buffer,
- (wcslen(Buffer) + 1) * sizeof(WCHAR));
- if (Error != ERROR_SUCCESS)
- {
- DbgPrint((DPRINT_HWDETECT,
- "RegSetValue() failed (Error %u)\n",
- (int)Error));
- return;
- }
+ FldrSetIdentifier(ControllerKey, Buffer);
/* FIXME: Add display peripheral (monitor) data */
}
@@ -2174,43 +1835,26 @@
DetectIsaBios(FRLDRHKEY SystemKey, ULONG *BusNumber)
{
PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
- WCHAR Buffer[80];
FRLDRHKEY BusKey;
ULONG Size;
- LONG Error;
/* Create new bus key */
- swprintf(Buffer,
- L"MultifunctionAdapter\\%u", *BusNumber);
- Error = RegCreateKey(SystemKey,
- Buffer,
- &BusKey);
- if (Error != ERROR_SUCCESS)
- {
- DbgPrint((DPRINT_HWDETECT, "RegCreateKey() failed (Error %u)\n",
(int)Error));
- return;
- }
+ FldrCreateComponentKey(SystemKey,
+ L"MultifunctionAdapter",
+ *BusNumber,
+ &BusKey);
/* Set 'Component Information' value similar to my NT4 box */
- SetComponentInformation(BusKey,
- 0x0,
- 0x0,
- 0xFFFFFFFF);
+ FldrSetComponentInformation(BusKey,
+ 0x0,
+ 0x0,
+ 0xFFFFFFFF);
/* Increment bus number */
(*BusNumber)++;
/* Set 'Identifier' value */
- Error = RegSetValue(BusKey,
- L"Identifier",
- REG_SZ,
- (PCHAR)L"ISA",
- 4 * sizeof(WCHAR));
- if (Error != ERROR_SUCCESS)
- {
- DbgPrint((DPRINT_HWDETECT, "RegSetValue() failed (Error %u)\n",
(int)Error));
- return;
- }
+ FldrSetIdentifier(BusKey, L"ISA");
/* Set 'Configuration Data' value */
Size = sizeof(CM_FULL_RESOURCE_DESCRIPTOR) -
@@ -2232,19 +1876,8 @@
FullResourceDescriptor->PartialResourceList.Count = 0;
/* Set 'Configuration Data' value */
- Error = RegSetValue(BusKey,
- L"Configuration Data",
- REG_FULL_RESOURCE_DESCRIPTOR,
- (PCHAR) FullResourceDescriptor,
- Size);
+ FldrSetConfigurationData(BusKey, FullResourceDescriptor, Size);
MmFreeMemory(FullResourceDescriptor);
- if (Error != ERROR_SUCCESS)
- {
- DbgPrint((DPRINT_HWDETECT,
- "RegSetValue(Configuration Data) failed (Error %u)\n",
- (int)Error));
- return;
- }
/* Detect ISA/BIOS devices */
DetectBiosDisks(SystemKey, BusKey);
@@ -2270,27 +1903,19 @@
{
FRLDRHKEY SystemKey;
ULONG BusNumber = 0;
- LONG Error;
DbgPrint((DPRINT_HWDETECT, "DetectHardware()\n"));
/* Create the 'System' key */
- Error = RegCreateKey(NULL,
- L"\\Registry\\Machine\\HARDWARE\\DESCRIPTION\\System",
- &SystemKey);
- if (Error != ERROR_SUCCESS)
- {
- DbgPrint((DPRINT_HWDETECT, "RegCreateKey() failed (Error %u)\n",
(int)Error));
- return;
- }
-
+ FldrCreateSystemKey(&SystemKey);
+
/* Detect buses */
DetectPciBios(SystemKey, &BusNumber);
DetectApmBios(SystemKey, &BusNumber);
DetectPnpBios(SystemKey, &BusNumber);
DetectIsaBios(SystemKey, &BusNumber);
DetectAcpiBios(SystemKey, &BusNumber);
-
+
DbgPrint((DPRINT_HWDETECT, "DetectHardware() Done\n"));
}
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 Sun Dec 9 23:17:56 2007
@@ -51,49 +51,34 @@
VOID
DetectAcpiBios(FRLDRHKEY SystemKey, ULONG *BusNumber)
{
- WCHAR Buffer[80];
FRLDRHKEY BiosKey;
- LONG Error;
-
+
if (FindAcpiBios())
{
AcpiPresent = TRUE;
+
/* Create new bus key */
- swprintf(Buffer,
- L"MultifunctionAdapter\\%u", *BusNumber);
- Error = RegCreateKey(SystemKey,
- Buffer,
- &BiosKey);
- if (Error != ERROR_SUCCESS)
- {
- DbgPrint((DPRINT_HWDETECT, "RegCreateKey() failed (Error %u)\n",
(int)Error));
- return;
- }
-
+ FldrCreateComponentKey(SystemKey,
+ L"MultifunctionAdapter",
+ *BusNumber,
+ &BiosKey);
+
#if 0
- /* Set 'Component Information' */
- SetComponentInformation(BiosKey,
- 0x0,
- 0x0,
- 0xFFFFFFFF);
+ /* Set 'Component Information' */
+ FldrSetComponentInformation(BiosKey,
+ 0x0,
+ 0x0,
+ 0xFFFFFFFF);
#endif
-
+
/* Increment bus number */
(*BusNumber)++;
-
+
/* Set 'Identifier' value */
- Error = RegSetValue(BiosKey,
- L"Identifier",
- REG_SZ,
- (PCHAR)L"ACPI BIOS",
- 10 * sizeof(WCHAR));
- if (Error != ERROR_SUCCESS)
- {
- DbgPrint((DPRINT_HWDETECT, "RegSetValue() failed (Error %u)\n",
(int)Error));
- return;
- }
-
+ FldrSetIdentifier(BiosKey, L"ACPI BIOS");
}
+
+ /* FIXME: Add congiguration data */
}
/* EOF */
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/hwapm.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/hwapm.c (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/hwapm.c Sun Dec 9 23:17:56 2007
@@ -56,50 +56,32 @@
VOID
DetectApmBios(FRLDRHKEY SystemKey, ULONG *BusNumber)
{
- WCHAR Buffer[80];
- FRLDRHKEY BiosKey;
- LONG Error;
-
- if (FindApmBios())
+ FRLDRHKEY BiosKey;
+
+ if (FindApmBios())
{
- /* Create new bus key */
- swprintf(Buffer,
- L"MultifunctionAdapter\\%u", *BusNumber);
- Error = RegCreateKey(SystemKey,
- Buffer,
- &BiosKey);
- if (Error != ERROR_SUCCESS)
- {
- DbgPrint((DPRINT_HWDETECT, "RegCreateKey() failed (Error %u)\n",
(int)Error));
- return;
- }
-
+ /* Create new bus key */
+ FldrCreateComponentKey(SystemKey,
+ L"MultifunctionAdapter",
+ *BusNumber,
+ &BiosKey);
+
#if 0
- /* Set 'Component Information' */
- SetComponentInformation(BiosKey,
- 0x0,
- 0x0,
- 0xFFFFFFFF);
+ /* Set 'Component Information' */
+ FldrSetComponentInformation(BiosKey,
+ 0x0,
+ 0x0,
+ 0xFFFFFFFF);
#endif
-
- /* Increment bus number */
- (*BusNumber)++;
-
- /* Set 'Identifier' value */
- Error = RegSetValue(BiosKey,
- L"Identifier",
- REG_SZ,
- (PCHAR)L"APM",
- 4 * sizeof(WCHAR));
- if (Error != ERROR_SUCCESS)
- {
- DbgPrint((DPRINT_HWDETECT, "RegSetValue() failed (Error %u)\n",
(int)Error));
- return;
- }
-
+
+ /* Increment bus number */
+ (*BusNumber)++;
+
+ /* Set 'Identifier' value */
+ FldrSetIdentifier(BiosKey, L"APM");
}
-
- /* FIXME: Add congiguration data */
+
+ /* FIXME: Add congiguration data */
}
/* EOF */
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/hwpci.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/hwpci.c (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/hwpci.c Sun Dec 9 23:17:56 2007
@@ -147,39 +147,25 @@
PPCI_IRQ_ROUTING_TABLE Table;
FRLDRHKEY TableKey;
ULONG Size;
- LONG Error;
Table = GetPciIrqRoutingTable();
if (Table != NULL)
{
DbgPrint((DPRINT_HWDETECT, "Table size: %u\n", Table->Size));
- Error = RegCreateKey(BusKey,
- L"RealModeIrqRoutingTable\\0",
- &TableKey);
- if (Error != ERROR_SUCCESS)
- {
- DbgPrint((DPRINT_HWDETECT, "RegCreateKey() failed (Error %u)\n",
(int)Error));
- return;
- }
+ FldrCreateComponentKey(BusKey,
+ L"RealModeIrqRoutingTable",
+ 0,
+ &TableKey);
/* Set 'Component Information' */
- SetComponentInformation(TableKey,
- 0x0,
- 0x0,
- 0xFFFFFFFF);
+ FldrSetComponentInformation(TableKey,
+ 0x0,
+ 0x0,
+ 0xFFFFFFFF);
/* Set 'Identifier' value */
- Error = RegSetValue(TableKey,
- L"Identifier",
- REG_SZ,
- (PCHAR)L"PCI Real-mode IRQ Routing Table",
- 32 * sizeof(WCHAR));
- if (Error != ERROR_SUCCESS)
- {
- DbgPrint((DPRINT_HWDETECT, "RegSetValue() failed (Error %u)\n",
(int)Error));
- return;
- }
+ FldrSetIdentifier(TableKey, L"PCI Real-mode IRQ Routing Table");
/* Set 'Configuration Data' value */
Size = FIELD_OFFSET(CM_FULL_RESOURCE_DESCRIPTOR,
PartialResourceList.PartialDescriptors) +
@@ -216,19 +202,8 @@
Table->Size);
/* Set 'Configuration Data' value */
- Error = RegSetValue(TableKey,
- L"Configuration Data",
- REG_FULL_RESOURCE_DESCRIPTOR,
- (PCHAR) FullResourceDescriptor,
- Size);
+ FldrSetConfigurationData(TableKey, FullResourceDescriptor, Size);
MmFreeMemory(FullResourceDescriptor);
- if (Error != ERROR_SUCCESS)
- {
- DbgPrint((DPRINT_HWDETECT,
- "RegSetValue(Configuration Data) failed (Error %u)\n",
- (int)Error));
- return;
- }
}
}
@@ -238,10 +213,8 @@
{
PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
CM_PCI_BUS_DATA BusData;
- WCHAR Buffer[80];
FRLDRHKEY BiosKey;
ULONG Size;
- LONG Error;
#if 0
FRLDRHKEY BusKey;
ULONG i;
@@ -252,37 +225,22 @@
if (FindPciBios(&BusData))
{
/* Create new bus key */
- swprintf(Buffer,
- L"MultifunctionAdapter\\%u", *BusNumber);
- Error = RegCreateKey(SystemKey,
- Buffer,
- &BiosKey);
- if (Error != ERROR_SUCCESS)
- {
- DbgPrint((DPRINT_HWDETECT, "RegCreateKey() failed (Error %u)\n",
(int)Error));
- return;
- }
+ FldrCreateComponentKey(SystemKey,
+ L"MultifunctionAdapter",
+ *BusNumber,
+ &BiosKey);
/* Set 'Component Information' */
- SetComponentInformation(BiosKey,
- 0x0,
- 0x0,
- 0xFFFFFFFF);
+ FldrSetComponentInformation(BiosKey,
+ 0x0,
+ 0x0,
+ 0xFFFFFFFF);
/* Increment bus number */
(*BusNumber)++;
/* Set 'Identifier' value */
- Error = RegSetValue(BiosKey,
- L"Identifier",
- REG_SZ,
- (PCHAR)L"PCI BIOS",
- 9 * sizeof(WCHAR));
- if (Error != ERROR_SUCCESS)
- {
- DbgPrint((DPRINT_HWDETECT, "RegSetValue() failed (Error %u)\n",
(int)Error));
- return;
- }
+ FldrSetIdentifier(BiosKey, L"PCI BIOS");
/* Set 'Configuration Data' value */
Size = sizeof(CM_FULL_RESOURCE_DESCRIPTOR);
@@ -307,19 +265,8 @@
FullResourceDescriptor->PartialResourceList.PartialDescriptors[0].u.BusNumber.Length =
1;
/* Set 'Configuration Data' value */
- Error = RegSetValue(BiosKey,
- L"Configuration Data",
- REG_FULL_RESOURCE_DESCRIPTOR,
- (PCHAR) FullResourceDescriptor,
- Size);
+ FldrSetConfigurationData(BiosKey, FullResourceDescriptor, Size);
MmFreeMemory(FullResourceDescriptor);
- if (Error != ERROR_SUCCESS)
- {
- DbgPrint((DPRINT_HWDETECT,
- "RegSetValue(Configuration Data) failed (Error %u)\n",
- (int)Error));
- return;
- }
DetectPciIrqRoutingTable(BiosKey);
@@ -332,43 +279,25 @@
/* Report PCI buses */
for (i = 0; i < (ULONG)BusData.BusCount; i++)
- {
- swprintf(Buffer,
- L"MultifunctionAdapter\\%u", *BusNumber);
- Error = RegCreateKey(SystemKey,
- Buffer,
- &BusKey);
- if (Error != ERROR_SUCCESS)
- {
- DbgPrint((DPRINT_HWDETECT, "RegCreateKey() failed (Error %u)\n",
(int)Error));
- printf("RegCreateKey() failed (Error %u)\n", (int)Error);
- return;
- }
-
- /* Set 'Component Information' */
- SetComponentInformation(BusKey,
- 0x0,
- 0x0,
- 0xFFFFFFFF);
-
- /* Increment bus number */
- (*BusNumber)++;
-
-
- /* Set 'Identifier' value */
- Error = RegSetValue(BusKey,
- L"Identifier",
- REG_SZ,
- (PCSTR)szPci,
- sizeof(szPci));
- if (Error != ERROR_SUCCESS)
- {
- DbgPrint((DPRINT_HWDETECT, "RegSetValue() failed (Error %u)\n",
(int)Error));
- return;
- }
- }
+ {
+ FldrCreateComponentKey(SystemKey,
+ L"MultifunctionAdapter",
+ *BusNumber,
+ &BiosKey);
+
+ /* Set 'Component Information' */
+ FldrSetComponentInformation(BusKey,
+ 0x0,
+ 0x0,
+ 0xFFFFFFFF);
+
+ /* Increment bus number */
+ (*BusNumber)++;
+
+ /* Set 'Identifier' value */
+ FldrSetIdentifier(BiosKey, szPci);
+ }
#endif
-
}
}
Modified: trunk/reactos/boot/freeldr/freeldr/freeldr_base.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/freel…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/freeldr_base.rbuild (original)
+++ trunk/reactos/boot/freeldr/freeldr/freeldr_base.rbuild Sun Dec 9 23:17:56 2007
@@ -46,6 +46,7 @@
<directory name="reactos">
<file>registry.c</file>
<file>arcname.c</file>
+ <file>archwsup.c</file>
<file>binhive.c</file>
<file>reactos.c</file>
</directory>
Modified: trunk/reactos/boot/freeldr/freeldr/include/arch/i386/hardware.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/include/arch/i386/hardware.h (original)
+++ trunk/reactos/boot/freeldr/freeldr/include/arch/i386/hardware.h Sun Dec 9 23:17:56
2007
@@ -25,33 +25,51 @@
#include "../../reactos/registry.h"
#endif
-/* CM_PARTIAL_RESOURCE_DESCRIPTOR.Flags */
-#define CM_RESOURCE_PORT_MEMORY 0x0000
-#define CM_RESOURCE_PORT_IO 0x0001
-
-#define CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE 0x0000
-#define CM_RESOURCE_INTERRUPT_LATCHED 0x0001
-
-typedef struct _CM_COMPONENT_INFORMATION
-{
- ULONG Flags;
- ULONG Version;
- ULONG Key;
- ULONG Affinity;
-} __attribute__((packed)) CM_COMPONENT_INFORMATION, *PCM_COMPONENT_INFORMATION;
-
-
-/* CM_COMPONENT_INFORMATION.Flags */
-#define Failed 0x00000001
-//#define ReadOnly 0x00000002
-#define Removable 0x00000004
-#define ConsoleIn 0x00000008
-#define ConsoleOut 0x00000010
-#define Input 0x00000020
-#define Output 0x00000040
-
#define CONFIG_CMD(bus, dev_fn, where) \
(0x80000000 | (((ULONG)(bus)) << 16) | (((dev_fn) & 0x1F) << 11) |
(((dev_fn) & 0xE0) << 3) | ((where) & ~3))
+
+//
+// ARC Component Configuration Routines
+//
+VOID
+NTAPI
+FldrSetComponentInformation(
+ IN FRLDRHKEY ComponentKey,
+ IN IDENTIFIER_FLAG Flags,
+ IN ULONG Key,
+ IN ULONG Affinity
+);
+
+VOID
+NTAPI
+FldrSetIdentifier(
+ IN FRLDRHKEY ComponentKey,
+ IN PWCHAR Identifier
+);
+
+VOID
+NTAPI
+FldrCreateSystemKey(
+ OUT FRLDRHKEY *SystemKey
+);
+
+VOID
+NTAPI
+FldrCreateComponentKey(
+ IN FRLDRHKEY SystemKey,
+ IN PWCHAR BusName,
+ IN ULONG BusNumber,
+ OUT FRLDRHKEY *ComponentKey
+);
+
+VOID
+NTAPI
+FldrSetConfigurationData(
+ IN FRLDRHKEY ComponentKey,
+ IN PVOID ConfigurationData,
+ IN ULONG Size
+);
+
/* PROTOTYPES ***************************************************************/
@@ -60,11 +78,6 @@
VOID StallExecutionProcessor(ULONG Microseconds);
VOID HalpCalibrateStallExecution(VOID);
-
-VOID SetComponentInformation(FRLDRHKEY ComponentKey,
- ULONG Flags,
- ULONG Key,
- ULONG Affinity);
/* hwacpi.c */
VOID DetectAcpiBios(FRLDRHKEY SystemKey, ULONG *BusNumber);
Added: trunk/reactos/boot/freeldr/freeldr/reactos/archwsup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/react…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/reactos/archwsup.c (added)
+++ trunk/reactos/boot/freeldr/freeldr/reactos/archwsup.c Sun Dec 9 23:17:56 2007
@@ -1,0 +1,127 @@
+/*
+ * PROJECT: ReactOS Boot Loader (FreeLDR)
+ * LICENSE: GPL - See COPYING in the top level directory
+ * FILE: boot/freeldr/freeldr/reactos/archwsup.c
+ * PURPOSE: Routines for ARC Hardware Tree and Configuration Data
+ * PROGRAMMERS: Alex Ionescu (alex.ionescu(a)reactos.org)
+ */
+
+/* INCLUDES *******************************************************************/
+
+#include <freeldr.h>
+#define NDEBUG
+#include <debug.h>
+
+/* FUNCTIONS ******************************************************************/
+
+VOID
+NTAPI
+FldrSetComponentInformation(IN FRLDRHKEY ComponentKey,
+ IN IDENTIFIER_FLAG Flags,
+ IN ULONG Key,
+ IN ULONG Affinity)
+{
+ CONFIGURATION_COMPONENT ConfigurationComponent;
+ LONG Error;
+
+ /* Build the component information */
+ ConfigurationComponent.Flags = Flags;
+ ConfigurationComponent.Version = 0;
+ ConfigurationComponent.Revision = 0;
+ ConfigurationComponent.Key = Key;
+ ConfigurationComponent.AffinityMask = Affinity;
+
+ /* Set the value */
+ Error = RegSetValue(ComponentKey,
+ L"Component Information",
+ REG_BINARY,
+ (PVOID)&ConfigurationComponent.Flags,
+ FIELD_OFFSET(CONFIGURATION_COMPONENT, ConfigurationDataLength) -
+ FIELD_OFFSET(CONFIGURATION_COMPONENT, Flags));
+ if (Error != ERROR_SUCCESS)
+ {
+ DbgPrint((DPRINT_HWDETECT, "RegSetValue() failed (Error %u)\n",
Error));
+ }
+}
+
+VOID
+NTAPI
+FldrSetIdentifier(IN FRLDRHKEY ComponentKey,
+ IN PWCHAR Identifier)
+{
+ LONG Error;
+ ULONG IdentifierLength = (wcslen(Identifier) + 1) * sizeof(WCHAR);
+
+ /* Set the key */
+ Error = RegSetValue(ComponentKey,
+ L"Identifier",
+ REG_SZ,
+ (PCHAR)Identifier,
+ IdentifierLength);
+ if (Error != ERROR_SUCCESS)
+ {
+ DbgPrint((DPRINT_HWDETECT, "RegSetValue() failed (Error %u)\n",
Error));
+ return;
+ }
+}
+
+VOID
+NTAPI
+FldrCreateSystemKey(OUT FRLDRHKEY *SystemKey)
+{
+ LONG Error;
+
+ /* Create the key */
+ Error = RegCreateKey(NULL,
+
L"\\Registry\\Machine\\HARDWARE\\DESCRIPTION\\System",
+ SystemKey);
+ if (Error != ERROR_SUCCESS)
+ {
+ DbgPrint((DPRINT_HWDETECT, "RegCreateKey() failed (Error %u)\n",
Error));
+ return;
+ }
+}
+
+VOID
+NTAPI
+FldrCreateComponentKey(IN FRLDRHKEY SystemKey,
+ IN PWCHAR BusName,
+ IN ULONG BusNumber,
+ OUT FRLDRHKEY *ComponentKey)
+{
+ LONG Error;
+ WCHAR Buffer[80];
+
+ /* Build the key name */
+ swprintf(Buffer, L"%s\\%u", BusName, BusNumber);
+
+ /* Create the key */
+ Error = RegCreateKey(SystemKey, Buffer, ComponentKey);
+ if (Error != ERROR_SUCCESS)
+ {
+ DbgPrint((DPRINT_HWDETECT, "RegCreateKey() failed (Error %u)\n",
Error));
+ return;
+ }
+}
+
+VOID
+NTAPI
+FldrSetConfigurationData(IN FRLDRHKEY ComponentKey,
+ IN PVOID ConfigurationData,
+ IN ULONG Size)
+{
+ LONG Error;
+
+ /* Set 'Configuration Data' value */
+ Error = RegSetValue(ComponentKey,
+ L"Configuration Data",
+ REG_FULL_RESOURCE_DESCRIPTOR,
+ ConfigurationData,
+ Size);
+ if (Error != ERROR_SUCCESS)
+ {
+ DbgPrint((DPRINT_HWDETECT,
+ "RegSetValue(Configuration Data) failed (Error %u)\n",
+ Error));
+ }
+}
Propchange: trunk/reactos/boot/freeldr/freeldr/reactos/archwsup.c
------------------------------------------------------------------------------
svn:eol-style = native