mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 08:15:41 +00:00
- Improve the FreeLDR->NTLDR conversion layer by now converting the ARC Hardware Tree.
- Apply relocation-style fixups to convert from FreeLDR to Kernel Addresses, since a contiguous buffer was used in FreeLDR, which means we only need to add a delta to each FreeLDR pointer to get the Kernel pointer. - Don't assert if we receive an ARC tree, since we now do! Instead, pretty-print it to the debug log. - Remove some registry debug spew. svn path=/trunk/; revision=31133
This commit is contained in:
parent
4b25246719
commit
4529c9c1ff
5 changed files with 242 additions and 12 deletions
|
@ -455,6 +455,16 @@ typedef struct _CM_PARSE_CONTEXT
|
|||
PCMHIVE OriginatingPoint;
|
||||
} CM_PARSE_CONTEXT, *PCM_PARSE_CONTEXT;
|
||||
|
||||
//
|
||||
// MultiFunction Adapter Recognizer Structure
|
||||
//
|
||||
typedef struct _CMP_MF_TYPE
|
||||
{
|
||||
PWCHAR Identifier;
|
||||
USHORT InterfaceType;
|
||||
USHORT Count;
|
||||
} CMP_MF_TYPE, *PCMP_MF_TYPE;
|
||||
|
||||
//
|
||||
// System Control Vector
|
||||
//
|
||||
|
@ -1387,6 +1397,10 @@ extern CM_SYSTEM_CONTROL_VECTOR CmControlVector[];
|
|||
extern ULONG CmpConfigurationAreaSize;
|
||||
extern PCM_FULL_RESOURCE_DESCRIPTOR CmpConfigurationData;
|
||||
extern UNICODE_STRING CmTypeName[];
|
||||
extern UNICODE_STRING CmClassName[];
|
||||
extern CMP_MF_TYPE CmpMultifunctionTypes[];
|
||||
extern USHORT CmpUnknownBusCount;
|
||||
extern ULONG CmpTypeCount[MaximumType + 1];
|
||||
extern HIVE_LIST_ENTRY CmpMachineHiveList[];
|
||||
extern UNICODE_STRING CmSymbolicLinkValueName;
|
||||
extern UNICODE_STRING CmpSystemStartOptions;
|
||||
|
|
|
@ -87,10 +87,10 @@ CmpInitializeRegistryNode(IN PCONFIGURATION_COMPONENT_DATA CurrentEntry,
|
|||
|
||||
/* Fail if the key couldn't be created, and make sure it's a new key */
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
ASSERT(Disposition == REG_CREATED_NEW_KEY);
|
||||
//ASSERT(Disposition == REG_CREATED_NEW_KEY);
|
||||
}
|
||||
|
||||
/* Sstup the compnent information key */
|
||||
/* Setup the component information key */
|
||||
RtlInitUnicodeString(&ValueName, L"Component Information");
|
||||
Status = NtSetValueKey(KeyHandle,
|
||||
&ValueName,
|
||||
|
@ -116,6 +116,7 @@ CmpInitializeRegistryNode(IN PCONFIGURATION_COMPONENT_DATA CurrentEntry,
|
|||
Status = RtlAnsiStringToUnicodeString(&ValueData,
|
||||
&TempString,
|
||||
TRUE);
|
||||
RtlCreateUnicodeString(&ValueData, (PWCHAR)Component->Identifier);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
/* Save the identifier in the registry */
|
||||
|
@ -194,6 +195,157 @@ CmpInitializeRegistryNode(IN PCONFIGURATION_COMPONENT_DATA CurrentEntry,
|
|||
return Status;
|
||||
}
|
||||
|
||||
int t, tabLevel;
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
CmpDumpHardwareTree(IN PCONFIGURATION_COMPONENT_DATA CurrentEntry,
|
||||
IN INTERFACE_TYPE InterfaceType,
|
||||
IN ULONG BusNumber)
|
||||
{
|
||||
PCONFIGURATION_COMPONENT Component;
|
||||
USHORT DeviceIndexTable[MaximumType + 1] = {0};
|
||||
ULONG Interface = InterfaceType, Bus = BusNumber, i;
|
||||
PCHAR InterfaceStrings[MaximumInterfaceType + 1] =
|
||||
{
|
||||
"Internal",
|
||||
"Isa",
|
||||
"Eisa",
|
||||
"MicroChannel",
|
||||
"TurboChannel",
|
||||
"PCIBus",
|
||||
"VMEBus",
|
||||
"NuBus",
|
||||
"PCMCIABus",
|
||||
"CBus",
|
||||
"MPIBus",
|
||||
"MPSABus",
|
||||
"ProcessorInternal",
|
||||
"InternalPowerBus",
|
||||
"PNPISABus",
|
||||
"PNPBus",
|
||||
"Unknown"
|
||||
};
|
||||
|
||||
while (CurrentEntry)
|
||||
{
|
||||
for (t = 0; t < tabLevel; t++) DbgPrint("\t");
|
||||
DbgPrint("Dumping node @ 0x%p\n", CurrentEntry);
|
||||
for (t = 0; t < tabLevel; t++) DbgPrint("\t");
|
||||
DbgPrint("Parent @ 0x%p Sibling @ 0x%p Child @ 0x%p\n",
|
||||
CurrentEntry->Parent, CurrentEntry->Sibling, CurrentEntry->Child);
|
||||
|
||||
/* Check if this is an adapter */
|
||||
Component = &CurrentEntry->ComponentEntry;
|
||||
if ((Component->Class == AdapterClass) &&
|
||||
(CurrentEntry->Parent->ComponentEntry.Class == SystemClass))
|
||||
{
|
||||
/* Check what kind of adapter it is */
|
||||
switch (Component->Type)
|
||||
{
|
||||
/* EISA */
|
||||
case EisaAdapter:
|
||||
|
||||
/* Fixup information */
|
||||
Interface = Eisa;
|
||||
Bus = CmpTypeCount[EisaAdapter]++;
|
||||
break;
|
||||
|
||||
/* Turbo-channel */
|
||||
case TcAdapter:
|
||||
|
||||
/* Fixup information */
|
||||
Interface = TurboChannel;
|
||||
Bus = CmpTypeCount[TurboChannel]++;
|
||||
break;
|
||||
|
||||
/* ISA, PCI, etc busses */
|
||||
case MultiFunctionAdapter:
|
||||
|
||||
/* Check if we have an identifier */
|
||||
if (Component->Identifier)
|
||||
{
|
||||
/* Loop each multi-function adapter type */
|
||||
for (i = 0; CmpMultifunctionTypes[i].Identifier; i++)
|
||||
{
|
||||
/* Check for a name match */
|
||||
if (!_wcsicmp(CmpMultifunctionTypes[i].Identifier,
|
||||
(PWCHAR)Component->Identifier))
|
||||
{
|
||||
/* Match found */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Fix up information */
|
||||
Interface = CmpMultifunctionTypes[i].InterfaceType;
|
||||
Bus = CmpMultifunctionTypes[i].Count++;
|
||||
}
|
||||
break;
|
||||
|
||||
/* SCSI Bus */
|
||||
case ScsiAdapter:
|
||||
|
||||
/* Fix up */
|
||||
Interface = Internal;
|
||||
Bus = CmpTypeCount[ScsiAdapter]++;
|
||||
break;
|
||||
|
||||
/* Unknown */
|
||||
default:
|
||||
Interface = -1;
|
||||
Bus = CmpUnknownBusCount++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Convert from NT to ARC class */
|
||||
if (Component->Class == SystemClass) Component->Type = ArcSystem;
|
||||
|
||||
/* Dump information on the component */
|
||||
for (t = 0; t < tabLevel; t++) DbgPrint("\t");
|
||||
DbgPrint("Component Type: %wZ\n", &CmTypeName[Component->Type]);
|
||||
for (t = 0; t < tabLevel; t++) DbgPrint("\t");
|
||||
DbgPrint("Class: %wZ\n", &CmClassName[Component->Class]);
|
||||
if (Component->Class != SystemClass)
|
||||
{
|
||||
for (t = 0; t < tabLevel; t++) DbgPrint("\t");
|
||||
DbgPrint("Device Index: %lx\n", DeviceIndexTable[Component->Type]++);
|
||||
}
|
||||
for (t = 0; t < tabLevel; t++) DbgPrint("\t");
|
||||
DbgPrint("Component Information:\n");
|
||||
for (t = 0; t < tabLevel; t++) DbgPrint("\t");
|
||||
DbgPrint("\tFlags: %lx\n", Component->Flags);
|
||||
for (t = 0; t < tabLevel; t++) DbgPrint("\t");
|
||||
DbgPrint("\tVersion: %lx\n", Component->Version);
|
||||
for (t = 0; t < tabLevel; t++) DbgPrint("\t");
|
||||
DbgPrint("\tAffinity: %lx\n", Component->AffinityMask);
|
||||
if (Component->IdentifierLength)
|
||||
{
|
||||
for (t = 0; t < tabLevel; t++) DbgPrint("\t");
|
||||
DbgPrint("Identifier: %S\n", Component->Identifier);
|
||||
}
|
||||
for (t = 0; t < tabLevel; t++) DbgPrint("\t");
|
||||
DbgPrint("Configuration Data: %p\n", CurrentEntry->ConfigurationData);
|
||||
for (t = 0; t < tabLevel; t++) DbgPrint("\t");
|
||||
DbgPrint("Interface Type: %s Bus Number: %d\n\n",
|
||||
InterfaceStrings[Interface],
|
||||
Bus);
|
||||
|
||||
/* Check for children */
|
||||
if (CurrentEntry->Child)
|
||||
{
|
||||
/* Recurse child */
|
||||
tabLevel++;
|
||||
CmpDumpHardwareTree(CurrentEntry->Child, Interface, Bus);
|
||||
tabLevel--;
|
||||
}
|
||||
|
||||
/* Get to the next entry */
|
||||
CurrentEntry = CurrentEntry->Sibling;
|
||||
}
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
CmpInitializeHardwareConfiguration(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||
|
@ -258,7 +410,10 @@ CmpInitializeHardwareConfiguration(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
|||
/* Check if we got anything from NTLDR */
|
||||
if (LoaderBlock->ConfigurationRoot)
|
||||
{
|
||||
ASSERTMSG("NTLDR ARC Hardware Tree Not Supported!\n", FALSE);
|
||||
/* Dump the hardware tree */
|
||||
DPRINT1("ARC Hardware Tree Received @ 0x%p. Dumping HW Info:\n\n",
|
||||
LoaderBlock->ConfigurationRoot);
|
||||
CmpDumpHardwareTree(LoaderBlock->ConfigurationRoot, -1, -1);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -272,3 +427,4 @@ CmpInitializeHardwareConfiguration(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
|||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -60,8 +60,23 @@ BOOLEAN CmpSelfHeal = TRUE;
|
|||
BOOLEAN CmpMiniNTBoot;
|
||||
ULONG CmpBootType;
|
||||
|
||||
USHORT CmpUnknownBusCount;
|
||||
ULONG CmpTypeCount[MaximumType + 1];
|
||||
|
||||
HANDLE CmpRegistryRootHandle;
|
||||
|
||||
UNICODE_STRING CmClassName[MaximumClass + 1] =
|
||||
{
|
||||
RTL_CONSTANT_STRING(L"System"),
|
||||
RTL_CONSTANT_STRING(L"Processor"),
|
||||
RTL_CONSTANT_STRING(L"Cache"),
|
||||
RTL_CONSTANT_STRING(L"Adapter"),
|
||||
RTL_CONSTANT_STRING(L"Controller"),
|
||||
RTL_CONSTANT_STRING(L"Peripheral"),
|
||||
RTL_CONSTANT_STRING(L"MemoryClass"),
|
||||
RTL_CONSTANT_STRING(L"Undefined")
|
||||
};
|
||||
|
||||
UNICODE_STRING CmTypeName[MaximumType + 1] =
|
||||
{
|
||||
RTL_CONSTANT_STRING(L"System"),
|
||||
|
@ -108,6 +123,19 @@ UNICODE_STRING CmTypeName[MaximumType + 1] =
|
|||
RTL_CONSTANT_STRING(L"Undefined")
|
||||
};
|
||||
|
||||
CMP_MF_TYPE CmpMultifunctionTypes[] =
|
||||
{
|
||||
{L"ISA", Isa, 0},
|
||||
{L"MCA", MicroChannel, 0},
|
||||
{L"PCI", PCIBus, 0},
|
||||
{L"VME", VMEBus, 0},
|
||||
{L"PCMCIA", PCMCIABus, 0},
|
||||
{L"CBUS", CBus, 0},
|
||||
{L"MPIPI", MPIBus, 0},
|
||||
{L"MPSA", MPSABus, 0},
|
||||
{NULL, Internal, 0}
|
||||
};
|
||||
|
||||
CM_SYSTEM_CONTROL_VECTOR CmControlVector[] =
|
||||
{
|
||||
{
|
||||
|
|
|
@ -1054,8 +1054,7 @@ CmpLoadHiveThread(IN PVOID StartContext)
|
|||
/* Get the hive index, make sure it makes sense */
|
||||
i = (ULONG)StartContext;
|
||||
ASSERT(CmpMachineHiveList[i].Name != NULL);
|
||||
DPRINT1("[HiveLoad] Parallel Thread: %d\n", i);
|
||||
|
||||
|
||||
/* We were started */
|
||||
CmpMachineHiveList[i].ThreadStarted = TRUE;
|
||||
|
||||
|
@ -1097,7 +1096,6 @@ CmpLoadHiveThread(IN PVOID StartContext)
|
|||
CmpMachineHiveList[i].Allocate = TRUE;
|
||||
|
||||
/* Load the hive file */
|
||||
DPRINT1("[HiveLoad]: Load from file %wZ\n", &FileName);
|
||||
Status = CmpInitHiveFromFile(&FileName,
|
||||
CmpMachineHiveList[i].HHiveFlags,
|
||||
&CmHive,
|
||||
|
@ -1122,12 +1120,10 @@ CmpLoadHiveThread(IN PVOID StartContext)
|
|||
}
|
||||
else
|
||||
{
|
||||
CmHive = CmpMachineHiveList[i].CmHive;
|
||||
/* We already have a hive, is it volatile? */
|
||||
CmHive = CmpMachineHiveList[i].CmHive;
|
||||
if (!(CmHive->Hive.HiveFlags & HIVE_VOLATILE))
|
||||
{
|
||||
DPRINT1("[HiveLoad]: Open from file %wZ\n", &FileName);
|
||||
|
||||
/* It's now, open the hive file and log */
|
||||
Status = CmpOpenHiveFiles(&FileName,
|
||||
L".LOG",
|
||||
|
@ -1305,7 +1301,6 @@ CmpInitializeHiveList(IN USHORT Flag)
|
|||
}
|
||||
|
||||
/* Now link the hive to its master */
|
||||
DPRINT1("[HiveLoad]: Link %wZ\n", &RegName);
|
||||
Status = CmpLinkHiveToMaster(&RegName,
|
||||
NULL,
|
||||
CmpMachineHiveList[i].CmHive2,
|
||||
|
|
|
@ -36,7 +36,7 @@ ULONG KeMemoryMapRangeCount;
|
|||
ULONG BldrCurrentMd;
|
||||
ULONG BldrCurrentMod;
|
||||
|
||||
/* NT Loader Data. Eats up about 80KB! */
|
||||
/* NT Loader Data. Eats up about 100KB! */
|
||||
LOADER_PARAMETER_BLOCK BldrLoaderBlock; // 0x0000
|
||||
LOADER_PARAMETER_EXTENSION BldrExtensionBlock; // 0x0060
|
||||
CHAR BldrCommandLine[256]; // 0x00DC
|
||||
|
@ -53,7 +53,7 @@ SETUP_LOADER_BLOCK BldrSetupBlock; // 0x11DE8
|
|||
ARC_DISK_INFORMATION BldrArcDiskInfo; // 0x12134
|
||||
CHAR BldrArcNames[32][256]; // 0x1213C
|
||||
ARC_DISK_SIGNATURE BldrDiskInfo[32]; // 0x1413C
|
||||
// 0x1443C
|
||||
CHAR BldrArcHwBuffer[16 * 1024]; // 0x1843C
|
||||
|
||||
/* BIOS Memory Map */
|
||||
BIOS_MEMORY_DESCRIPTOR BiosMemoryDescriptors[16] = {{0}};
|
||||
|
@ -860,6 +860,34 @@ KiRosBuildArcMemoryList(VOID)
|
|||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
KiRosFixupComponentTree(IN PCONFIGURATION_COMPONENT_DATA p,
|
||||
IN ULONG i)
|
||||
{
|
||||
PCONFIGURATION_COMPONENT pp;
|
||||
|
||||
/* Loop each entry */
|
||||
while (p)
|
||||
{
|
||||
/* Grab the component entry */
|
||||
pp = &p->ComponentEntry;
|
||||
|
||||
/* Fixup the pointers */
|
||||
if (pp->Identifier) pp->Identifier = (PVOID)((ULONG_PTR)pp->Identifier + i);
|
||||
if (p->ConfigurationData) p->ConfigurationData = (PVOID)((ULONG_PTR)p->ConfigurationData + i);
|
||||
if (p->Parent) p->Parent = (PVOID)((ULONG_PTR)p->Parent + i);
|
||||
if (p->Sibling) p->Sibling = (PVOID)((ULONG_PTR)p->Sibling + i);
|
||||
if (p->Child) p->Child = (PVOID)((ULONG_PTR)p->Child + i);
|
||||
|
||||
/* Check if we have a child */
|
||||
if (p->Child) KiRosFixupComponentTree(p->Child, i);
|
||||
|
||||
/* Get to the next entry */
|
||||
p = p->Sibling;
|
||||
}
|
||||
}
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
KiRosFrldrLpbToNtLpb(IN PROS_LOADER_PARAMETER_BLOCK RosLoaderBlock,
|
||||
|
@ -1185,6 +1213,15 @@ KiRosFrldrLpbToNtLpb(IN PROS_LOADER_PARAMETER_BLOCK RosLoaderBlock,
|
|||
InsertTailList(&LoaderBlock->ArcDiskInformation->DiskSignatureListHead,
|
||||
&ArcDiskInfo->ListEntry);
|
||||
}
|
||||
|
||||
/* Copy the ARC Hardware Tree */
|
||||
RtlCopyMemory(BldrArcHwBuffer, (PVOID)RosLoaderBlock->ArchExtra, 16 * 1024);
|
||||
LoaderBlock->ConfigurationRoot = (PVOID)BldrArcHwBuffer;
|
||||
|
||||
/* Apply fixups */
|
||||
KiRosFixupComponentTree(LoaderBlock->ConfigurationRoot,
|
||||
(ULONG_PTR)BldrArcHwBuffer -
|
||||
RosLoaderBlock->ArchExtra);
|
||||
}
|
||||
|
||||
VOID
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue