Author: ion
Date: Wed Oct 18 21:46:55 2006
New Revision: 24563
URL:
http://svn.reactos.org/svn/reactos?rev=24563&view=rev
Log:
- Combine PnpInit1/2 since they were called one after the other.
- Load RAW driver while loading boot drivers.
- Cleanup IoInitSystem a bit more.
Modified:
trunk/reactos/ntoskrnl/io/iomgr/driver.c
trunk/reactos/ntoskrnl/io/iomgr/iomgr.c
trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c
Modified: trunk/reactos/ntoskrnl/io/iomgr/driver.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/driver.c…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/driver.c (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/driver.c Wed Oct 18 21:46:55 2006
@@ -918,7 +918,6 @@
* Return Value
* None
*/
-
VOID
FASTCALL
IopInitializeBootDrivers(VOID)
@@ -926,6 +925,50 @@
PLIST_ENTRY ListHead, NextEntry;
PLDR_DATA_TABLE_ENTRY LdrEntry;
UNICODE_STRING NtosSymName = RTL_CONSTANT_STRING(L"ntoskrnl.sym");
+ PDEVICE_NODE DeviceNode;
+ PDRIVER_OBJECT DriverObject;
+ LDR_DATA_TABLE_ENTRY ModuleObject;
+ NTSTATUS Status;
+
+ /* Use IopRootDeviceNode for now */
+ Status = IopCreateDeviceNode(IopRootDeviceNode, NULL, &DeviceNode);
+ if (!NT_SUCCESS(Status)) return;
+
+ /* Setup the module object for the RAW FS Driver */
+ ModuleObject.DllBase = NULL;
+ ModuleObject.SizeOfImage = 0;
+ ModuleObject.EntryPoint = RawFsDriverEntry;
+
+ /* Initialize it */
+ Status = IopInitializeDriverModule(DeviceNode,
+ &ModuleObject,
+ &DeviceNode->ServiceName,
+ TRUE,
+ &DriverObject);
+ if (!NT_SUCCESS(Status))
+ {
+ /* Fail */
+ IopFreeDeviceNode(DeviceNode);
+ return;
+ }
+
+ /* Now initialize the associated device */
+ Status = IopInitializeDevice(DeviceNode, DriverObject);
+ if (!NT_SUCCESS(Status))
+ {
+ /* Fail */
+ IopFreeDeviceNode(DeviceNode);
+ return;
+ }
+
+ /* Start it up */
+ Status = IopStartDevice(DeviceNode);
+ if (!NT_SUCCESS(Status))
+ {
+ /* Fail */
+ IopFreeDeviceNode(DeviceNode);
+ return;
+ }
/* Hack for NTOSKRNL.SYM */
KDB_SYMBOLFILE_HOOK(&NtosSymName);
Modified: trunk/reactos/ntoskrnl/io/iomgr/iomgr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/iomgr.c?…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/iomgr.c (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/iomgr.c Wed Oct 18 21:46:55 2006
@@ -442,9 +442,6 @@
IoInitSystem(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
{
LARGE_INTEGER ExpireTime;
- PDEVICE_NODE DeviceNode;
- PDRIVER_OBJECT DriverObject;
- LDR_DATA_TABLE_ENTRY ModuleObject;
NTSTATUS Status;
CHAR Buffer[256];
ANSI_STRING NtBootPath, RootString;
@@ -497,65 +494,16 @@
/* Create Object Directories */
if (!IopCreateRootDirectories()) return FALSE;
- /*
- * Initialize PnP manager
- */
+ /* Initialize PnP manager */
PnpInit();
- PnpInit2();
-
- IoCreateDriverList();
-
- KeInitializeSpinLock (&IoStatisticsLock);
-
- /* Initialize raw filesystem driver */
-
- /* Use IopRootDeviceNode for now */
- Status = IopCreateDeviceNode(IopRootDeviceNode, NULL, &DeviceNode);
- if (!NT_SUCCESS(Status))
- {
- CPRINT("IopCreateDeviceNode() failed with status (%x)\n", Status);
- return FALSE;
- }
-
- ModuleObject.DllBase = NULL;
- ModuleObject.SizeOfImage = 0;
- ModuleObject.EntryPoint = RawFsDriverEntry;
-
- Status = IopInitializeDriverModule(DeviceNode,
- &ModuleObject,
- &DeviceNode->ServiceName,
- TRUE,
- &DriverObject);
- if (!NT_SUCCESS(Status))
- {
- IopFreeDeviceNode(DeviceNode);
- CPRINT("IopInitializeDriver() failed with status (%x)\n", Status);
- return FALSE;
- }
-
- Status = IopInitializeDevice(DeviceNode, DriverObject);
- if (!NT_SUCCESS(Status))
- {
- IopFreeDeviceNode(DeviceNode);
- CPRINT("IopInitializeDevice() failed with status (%x)\n", Status);
- return FALSE;
- }
-
- Status = IopStartDevice(DeviceNode);
- if (!NT_SUCCESS(Status))
- {
- IopFreeDeviceNode(DeviceNode);
- CPRINT("IopInitializeDevice() failed with status (%x)\n", Status);
- return FALSE;
- }
-
- /*
- * Initialize PnP root releations
- */
+ /* Initialize PnP root relations */
IoSynchronousInvalidateDeviceRelations(IopRootDeviceNode->
PhysicalDeviceObject,
BusRelations);
+
+ /* Create the group driver list */
+ IoCreateDriverList();
/* Load boot start drivers */
IopInitializeBootDrivers();
Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.…
==============================================================================
--- trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c (original)
+++ trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c Wed Oct 18 21:46:55 2006
@@ -2610,73 +2610,6 @@
ExFreePool(Data);
}
-VOID INIT_FUNCTION
-PnpInit(VOID)
-{
- PDEVICE_OBJECT Pdo;
- NTSTATUS Status;
-
- DPRINT("PnpInit()\n");
-
- KeInitializeSpinLock(&IopDeviceTreeLock);
-
- /* Initialize the Bus Type GUID List */
- IopBusTypeGuidList = ExAllocatePool(PagedPool, sizeof(IO_BUS_TYPE_GUID_LIST));
- RtlZeroMemory(IopBusTypeGuidList, sizeof(IO_BUS_TYPE_GUID_LIST));
- ExInitializeFastMutex(&IopBusTypeGuidList->Lock);
-
- /* Initialize PnP-Event notification support */
- Status = IopInitPlugPlayEvents();
- if (!NT_SUCCESS(Status))
- {
- CPRINT("IopInitPlugPlayEvents() failed\n");
- KEBUGCHECKEX(PHASE1_INITIALIZATION_FAILED, Status, 0, 0, 0);
- }
-
- /*
- * Create root device node
- */
-
- Status = IopCreateDriverObject(&IopRootDriverObject, NULL, 0, FALSE, NULL, 0);
- if (!NT_SUCCESS(Status))
- {
- CPRINT("IoCreateDriverObject() failed\n");
- KEBUGCHECKEX(PHASE1_INITIALIZATION_FAILED, Status, 0, 0, 0);
- }
-
- Status = IoCreateDevice(IopRootDriverObject, 0, NULL, FILE_DEVICE_CONTROLLER,
- 0, FALSE, &Pdo);
- if (!NT_SUCCESS(Status))
- {
- CPRINT("IoCreateDevice() failed\n");
- KEBUGCHECKEX(PHASE1_INITIALIZATION_FAILED, Status, 0, 0, 0);
- }
-
- Status = IopCreateDeviceNode(NULL, Pdo, &IopRootDeviceNode);
- if (!NT_SUCCESS(Status))
- {
- CPRINT("Insufficient resources\n");
- KEBUGCHECKEX(PHASE1_INITIALIZATION_FAILED, Status, 0, 0, 0);
- }
-
- if (!RtlCreateUnicodeString(&IopRootDeviceNode->InstancePath,
- L"HTREE\\ROOT\\0"))
- {
- CPRINT("Failed to create the instance path!\n");
- KEBUGCHECKEX(PHASE1_INITIALIZATION_FAILED, STATUS_NO_MEMORY, 0, 0, 0);
- }
-
- /* Report the device to the user-mode pnp manager */
- IopQueueTargetDeviceEvent(&GUID_DEVICE_ARRIVAL,
- &IopRootDeviceNode->InstancePath);
-
- IopRootDeviceNode->PhysicalDeviceObject->Flags |= DO_BUS_ENUMERATED_DEVICE;
- PnpRootDriverEntry(IopRootDriverObject, NULL);
- IopRootDriverObject->DriverExtension->AddDevice(
- IopRootDriverObject,
- IopRootDeviceNode->PhysicalDeviceObject);
-}
-
static NTSTATUS INIT_FUNCTION
IopEnumerateDetectedDevices(
IN HANDLE hBaseKey,
@@ -3297,17 +3230,79 @@
}
VOID INIT_FUNCTION
-PnpInit2(VOID)
+PnpInit(VOID)
{
- NTSTATUS Status;
-
- /* Move information about devices detected by Freeloader to
SYSTEM\CurrentControlSet\Root\ */
- Status = IopUpdateRootKey();
- if (!NT_SUCCESS(Status))
- {
- CPRINT("IopUpdateRootKey() failed\n");
- KEBUGCHECKEX(PHASE1_INITIALIZATION_FAILED, Status, 0, 0, 0);
- }
+ PDEVICE_OBJECT Pdo;
+ NTSTATUS Status;
+
+ DPRINT("PnpInit()\n");
+
+ KeInitializeSpinLock(&IopDeviceTreeLock);
+
+ /* Initialize the Bus Type GUID List */
+ IopBusTypeGuidList = ExAllocatePool(PagedPool, sizeof(IO_BUS_TYPE_GUID_LIST));
+ RtlZeroMemory(IopBusTypeGuidList, sizeof(IO_BUS_TYPE_GUID_LIST));
+ ExInitializeFastMutex(&IopBusTypeGuidList->Lock);
+
+ /* Initialize PnP-Event notification support */
+ Status = IopInitPlugPlayEvents();
+ if (!NT_SUCCESS(Status))
+ {
+ CPRINT("IopInitPlugPlayEvents() failed\n");
+ KEBUGCHECKEX(PHASE1_INITIALIZATION_FAILED, Status, 0, 0, 0);
+ }
+
+ /*
+ * Create root device node
+ */
+
+ Status = IopCreateDriverObject(&IopRootDriverObject, NULL, 0, FALSE, NULL, 0);
+ if (!NT_SUCCESS(Status))
+ {
+ CPRINT("IoCreateDriverObject() failed\n");
+ KEBUGCHECKEX(PHASE1_INITIALIZATION_FAILED, Status, 0, 0, 0);
+ }
+
+ Status = IoCreateDevice(IopRootDriverObject, 0, NULL, FILE_DEVICE_CONTROLLER,
+ 0, FALSE, &Pdo);
+ if (!NT_SUCCESS(Status))
+ {
+ CPRINT("IoCreateDevice() failed\n");
+ KEBUGCHECKEX(PHASE1_INITIALIZATION_FAILED, Status, 0, 0, 0);
+ }
+
+ Status = IopCreateDeviceNode(NULL, Pdo, &IopRootDeviceNode);
+ if (!NT_SUCCESS(Status))
+ {
+ CPRINT("Insufficient resources\n");
+ KEBUGCHECKEX(PHASE1_INITIALIZATION_FAILED, Status, 0, 0, 0);
+ }
+
+ if (!RtlCreateUnicodeString(&IopRootDeviceNode->InstancePath,
+ L"HTREE\\ROOT\\0"))
+ {
+ CPRINT("Failed to create the instance path!\n");
+ KEBUGCHECKEX(PHASE1_INITIALIZATION_FAILED, STATUS_NO_MEMORY, 0, 0, 0);
+ }
+
+ /* Report the device to the user-mode pnp manager */
+ IopQueueTargetDeviceEvent(&GUID_DEVICE_ARRIVAL,
+ &IopRootDeviceNode->InstancePath);
+
+ IopRootDeviceNode->PhysicalDeviceObject->Flags |= DO_BUS_ENUMERATED_DEVICE;
+ PnpRootDriverEntry(IopRootDriverObject, NULL);
+ IopRootDriverObject->DriverExtension->AddDevice(
+ IopRootDriverObject,
+ IopRootDeviceNode->PhysicalDeviceObject);
+
+ /* Move information about devices detected by Freeloader to
SYSTEM\CurrentControlSet\Root\ */
+ Status = IopUpdateRootKey();
+ if (!NT_SUCCESS(Status))
+ {
+ CPRINT("IopUpdateRootKey() failed\n");
+ KEBUGCHECKEX(PHASE1_INITIALIZATION_FAILED, Status, 0, 0, 0);
+ }
}
+
/* EOF */