Plug & Play manager improvments + few other things

ntoskrnl/ntoskrnl.edf:
   Added exports for IoGetDmaAdapter, IoIsWdmVersionAvailable,
   KefAcquireSpinLockAtDpcLevel, KefReleaseSpinLockFromDpcLevel,
   ExFreePoolWithTag.
ntoskrnl/io/driver.c:
   Implementation of NtUnloadDriver.
ntoskrnl/io/device.c:
   Added prepending "\\SystemRoot\" and displaying "PnP Loading xxx..." message
   in IopInitializeDeviceNodeService.
ntoskrnl/io/pnpmgr.c:
   Split into ntoskrnl/io/pnpmgr.c, ntoskrnl/io/deviface.c,
   ntoskrnl/io/pnpnotify.c, ntoskrnl/io/pnpmgr/pnpdma.c,
   ntoskrnl/io/pnpmgr.c, ntoskrnl/io/pnpmgr/pnproot.c,
   ntoskrnl/io/remlock.c, ntoskrnl/io/pnpmgr/pnpreport.c.
   Fixed registry handling in IopActionInterrogateDeviceStack and
   IopActionConfigureChildServices.
   Partial implementation of IoGetDeviceProperty.
ntoskrnl/io/pnpdma.c:
   Implementation of IoGetDmaAdapter.
ntoskrnl/io/wdm.c:
   New file. Contains implementation of IoIsWdmVersionAvailable.
ntoskrnl/ke/spinlock.c:
   Added KeAcquireSpinLockAtDpcLevel and KefReleaseSpinLockFromDpcLevel.
ntoskrnl/mm/pool.c:
   Partial implementation of ExFreePoolWithTag.

svn path=/trunk/; revision=6136
This commit is contained in:
Filip Navara 2003-09-25 15:54:43 +00:00
parent bf8e3b5659
commit 7ea418b4eb
16 changed files with 5181 additions and 4191 deletions

View file

@ -1,4 +1,4 @@
/* $Id: iotypes.h,v 1.54 2003/09/04 16:52:10 vizzini Exp $
/* $Id: iotypes.h,v 1.55 2003/09/25 15:54:42 navaraf Exp $
*
*/
@ -1136,4 +1136,168 @@ typedef struct _IO_MAILSLOT_CREATE_BUFFER
LARGE_INTEGER TimeOut;
} IO_MAILSLOT_CREATE_BUFFER, *PIO_MAILSLOT_CREATE_BUFFER;
/* DMA types */
typedef struct _SCATTER_GATHER_ELEMENT {
PHYSICAL_ADDRESS Address;
ULONG Length;
ULONG_PTR Reserved;
} SCATTER_GATHER_ELEMENT, *PSCATTER_GATHER_ELEMENT;
typedef struct _SCATTER_GATHER_LIST {
ULONG NumberOfElements;
ULONG_PTR Reserved;
SCATTER_GATHER_ELEMENT Elements[];
} SCATTER_GATHER_LIST, *PSCATTER_GATHER_LIST;
typedef struct _DMA_OPERATIONS *PDMA_OPERATIONS;
typedef struct _DMA_ADAPTER {
USHORT Version;
USHORT Size;
PDMA_OPERATIONS DmaOperations;
PADAPTER_OBJECT HalAdapter;
} DMA_ADAPTER, *PDMA_ADAPTER;
typedef VOID (*PPUT_DMA_ADAPTER)(
PDMA_ADAPTER DmaAdapter
);
typedef PVOID (*PALLOCATE_COMMON_BUFFER)(
IN PDMA_ADAPTER DmaAdapter,
IN ULONG Length,
OUT PPHYSICAL_ADDRESS LogicalAddress,
IN BOOLEAN CacheEnabled
);
typedef VOID (*PFREE_COMMON_BUFFER)(
IN PDMA_ADAPTER DmaAdapter,
IN ULONG Length,
IN PHYSICAL_ADDRESS LogicalAddress,
IN PVOID VirtualAddress,
IN BOOLEAN CacheEnabled
);
typedef NTSTATUS (*PALLOCATE_ADAPTER_CHANNEL)(
IN PDMA_ADAPTER DmaAdapter,
IN PDEVICE_OBJECT DeviceObject,
IN ULONG NumberOfMapRegisters,
IN PDRIVER_CONTROL ExecutionRoutine,
IN PVOID Context
);
typedef BOOLEAN (*PFLUSH_ADAPTER_BUFFERS)(
IN PDMA_ADAPTER DmaAdapter,
IN PMDL Mdl,
IN PVOID MapRegisterBase,
IN PVOID CurrentVa,
IN ULONG Length,
IN BOOLEAN WriteToDevice
);
typedef VOID (*PFREE_ADAPTER_CHANNEL)(
IN PDMA_ADAPTER DmaAdapter
);
typedef VOID (*PFREE_MAP_REGISTERS)(
IN PDMA_ADAPTER DmaAdapter,
PVOID MapRegisterBase,
ULONG NumberOfMapRegisters
);
typedef PHYSICAL_ADDRESS (*PMAP_TRANSFER)(
IN PDMA_ADAPTER DmaAdapter,
IN PMDL Mdl,
IN PVOID MapRegisterBase,
IN PVOID CurrentVa,
IN OUT PULONG Length,
IN BOOLEAN WriteToDevice
);
typedef ULONG (*PGET_DMA_ALIGNMENT)(
IN PDMA_ADAPTER DmaAdapter
);
typedef ULONG (*PREAD_DMA_COUNTER)(
IN PDMA_ADAPTER DmaAdapter
);
typedef VOID (*PDRIVER_LIST_CONTROL)(
IN struct _DEVICE_OBJECT *DeviceObject,
IN struct _IRP *Irp,
IN PSCATTER_GATHER_LIST ScatterGather,
IN PVOID Context
);
typedef NTSTATUS (*PGET_SCATTER_GATHER_LIST)(
IN PDMA_ADAPTER DmaAdapter,
IN PDEVICE_OBJECT DeviceObject,
IN PMDL Mdl,
IN PVOID CurrentVa,
IN ULONG Length,
IN PDRIVER_LIST_CONTROL ExecutionRoutine,
IN PVOID Context,
IN BOOLEAN WriteToDevice
);
typedef VOID (*PPUT_SCATTER_GATHER_LIST)(
IN PDMA_ADAPTER DmaAdapter,
IN PSCATTER_GATHER_LIST ScatterGather,
IN BOOLEAN WriteToDevice
);
typedef struct _DMA_OPERATIONS {
ULONG Size;
PPUT_DMA_ADAPTER PutDmaAdapter;
PALLOCATE_COMMON_BUFFER AllocateCommonBuffer;
PFREE_COMMON_BUFFER FreeCommonBuffer;
PALLOCATE_ADAPTER_CHANNEL AllocateAdapterChannel;
PFLUSH_ADAPTER_BUFFERS FlushAdapterBuffers;
PFREE_ADAPTER_CHANNEL FreeAdapterChannel;
PFREE_MAP_REGISTERS FreeMapRegisters;
PMAP_TRANSFER MapTransfer;
PGET_DMA_ALIGNMENT GetDmaAlignment;
PREAD_DMA_COUNTER ReadDmaCounter;
PGET_SCATTER_GATHER_LIST GetScatterGatherList;
PPUT_SCATTER_GATHER_LIST PutScatterGatherList;
} DMA_OPERATIONS;
/* Standard bus interface */
struct _DEVICE_DESCRIPTION;
typedef BOOLEAN STDCALL (*PTRANSLATE_BUS_ADDRESS)(
IN PVOID Context,
IN PHYSICAL_ADDRESS BusAddress,
IN ULONG Length,
IN OUT PULONG AddressSpace,
OUT PPHYSICAL_ADDRESS TranslatedAddress);
typedef PDMA_ADAPTER STDCALL (*PGET_DMA_ADAPTER)(
IN PVOID Context,
IN struct _DEVICE_DESCRIPTION *DeviceDescriptor,
OUT PULONG NumberOfMapRegisters);
typedef ULONG STDCALL (*PGET_SET_DEVICE_DATA)(
IN PVOID Context,
IN ULONG DataType,
IN PVOID Buffer,
IN ULONG Offset,
IN ULONG Length);
typedef struct _BUS_INTERFACE_STANDARD {
USHORT Size;
USHORT Version;
PVOID Context;
PINTERFACE_REFERENCE InterfaceReference;
PINTERFACE_DEREFERENCE InterfaceDereference;
PTRANSLATE_BUS_ADDRESS TranslateBusAddress;
PGET_DMA_ADAPTER GetDmaAdapter;
PGET_SET_DEVICE_DATA SetBusData;
PGET_SET_DEVICE_DATA GetBusData;
} BUS_INTERFACE_STANDARD, *PBUS_INTERFACE_STANDARD;
#endif /* __INCLUDE_DDK_IOTYPES_H */

View file

@ -1,4 +1,4 @@
# $Id: Makefile,v 1.105 2003/08/24 12:08:16 dwelch Exp $
# $Id: Makefile,v 1.106 2003/09/25 15:54:42 navaraf Exp $
#
# ReactOS Operating System
#
@ -175,6 +175,7 @@ OBJECTS_IO = \
io/cntrller.o \
io/create.o \
io/device.o \
io/deviface.o \
io/dir.o \
io/driver.o \
io/errlog.o \
@ -194,11 +195,15 @@ OBJECTS_IO = \
io/npipe.o \
io/page.o \
io/parttab.o \
io/pnpmgr.o \
io/pnproot.o \
io/process.o \
io/pnpnotify.o \
io/pnpdma.o \
io/pnpmgr.o \
io/pnpreport.o \
io/pnproot.o \
io/queue.o \
io/rawfs.o \
io/remlock.o \
io/resource.o \
io/rw.o \
io/share.o \
@ -206,6 +211,7 @@ OBJECTS_IO = \
io/symlink.o \
io/timer.o \
io/vpb.o \
io/wdm.o \
io/xhaldisp.o \
io/xhaldrv.o

View file

@ -1,4 +1,4 @@
/* $Id: device.c,v 1.58 2003/08/24 11:35:41 dwelch Exp $
/* $Id: device.c,v 1.59 2003/09/25 15:54:42 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -483,7 +483,7 @@ IopInitializeService(
}
}
Status = IopInitializeDevice(DeviceNode, TRUE);
Status = IopInitializeDevice(DeviceNode, FALSE);
return(Status);
}
@ -491,6 +491,64 @@ IopInitializeService(
NTSTATUS
IopInitializeDeviceNodeService(PDEVICE_NODE DeviceNode)
{
#if 1
RTL_QUERY_REGISTRY_TABLE QueryTable[2];
UNICODE_STRING ImagePath;
NTSTATUS Status;
WCHAR FullImagePathBuffer[MAX_PATH];
UNICODE_STRING FullImagePath;
CHAR TextBuffer [256];
ULONG x, y, cx, cy;
RtlZeroMemory(QueryTable, sizeof(QueryTable));
RtlInitUnicodeString(&ImagePath, NULL);
QueryTable[0].Name = L"ImagePath";
QueryTable[0].Flags = RTL_QUERY_REGISTRY_DIRECT;
QueryTable[0].EntryContext = &ImagePath;
Status = RtlQueryRegistryValues(RTL_REGISTRY_SERVICES,
DeviceNode->ServiceName.Buffer,
QueryTable,
NULL,
NULL);
DPRINT("RtlQueryRegistryValues() returned status %x\n", Status);
if (NT_SUCCESS(Status))
{
DPRINT("Got ImagePath %S\n", ImagePath.Buffer);
if (ImagePath.Buffer[0] != L'\\')
{
wcscpy(FullImagePathBuffer, L"\\SystemRoot\\");
wcscat(FullImagePathBuffer, ImagePath.Buffer);
}
else
{
wcscpy(FullImagePathBuffer, ImagePath.Buffer);
}
RtlFreeUnicodeString(&ImagePath);
RtlInitUnicodeString(&FullImagePath, FullImagePathBuffer);
HalQueryDisplayParameters(&x, &y, &cx, &cy);
RtlFillMemory(TextBuffer, x, ' ');
TextBuffer[x] = '\0';
HalSetDisplayParameters(0, y-1);
HalDisplayString(TextBuffer);
sprintf(TextBuffer, "PnP Loading %S...\n", DeviceNode->ServiceName.Buffer);
HalSetDisplayParameters(0, y-1);
HalDisplayString(TextBuffer);
HalSetDisplayParameters(cx, cy);
Status = IopInitializeService(DeviceNode, &FullImagePath);
}
return(Status);
#else
RTL_QUERY_REGISTRY_TABLE QueryTable[2];
UNICODE_STRING ImagePath;
HANDLE KeyHandle;
@ -534,6 +592,7 @@ IopInitializeDeviceNodeService(PDEVICE_NODE DeviceNode)
}
return(Status);
#endif
}
NTSTATUS

View file

@ -0,0 +1,115 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/io/pnpmgr/devintrf.c
* PURPOSE: Device interface functions
* PROGRAMMER: Filip Navara (xnavara@volny.cz)
* UPDATE HISTORY:
* 22/09/2003 FiN Created
*/
/* INCLUDES ******************************************************************/
#include <ddk/ntddk.h>
#include <reactos/bugcodes.h>
#include <internal/io.h>
#include <internal/po.h>
#include <internal/ldr.h>
#include <internal/registry.h>
#include <internal/module.h>
//#define NDEBUG
#include <internal/debug.h>
#include <ole32/guiddef.h>
#ifdef DEFINE_GUID
DEFINE_GUID(GUID_CLASS_COMPORT, 0x86e0d1e0L, 0x8089, 0x11d0, 0x9c, 0xe4, 0x08, 0x00, 0x3e, 0x30, 0x1f, 0x73);
DEFINE_GUID(GUID_SERENUM_BUS_ENUMERATOR, 0x4D36E978L, 0xE325, 0x11CE, 0xBF, 0xC1, 0x08, 0x00, 0x2B, 0xE1, 0x03, 0x18);
#endif // DEFINE_GUID
/* FUNCTIONS *****************************************************************/
/*
* @unimplemented
*/
NTSTATUS
STDCALL
IoOpenDeviceInterfaceRegistryKey(
IN PUNICODE_STRING SymbolicLinkName,
IN ACCESS_MASK DesiredAccess,
OUT PHANDLE DeviceInterfaceKey)
{
DPRINT("IoOpenDeviceInterfaceRegistryKey called (UNIMPLEMENTED)\n");
return STATUS_NOT_IMPLEMENTED;
}
/*
* @unimplemented
*/
NTSTATUS
STDCALL
IoGetDeviceInterfaceAlias(
IN PUNICODE_STRING SymbolicLinkName,
IN CONST GUID *AliasInterfaceClassGuid,
OUT PUNICODE_STRING AliasSymbolicLinkName)
{
DPRINT("IoGetDeviceInterfaceAlias called (UNIMPLEMENTED)\n");
return STATUS_NOT_IMPLEMENTED;
}
/*
* @unimplemented
*/
NTSTATUS
STDCALL
IoGetDeviceInterfaces(
IN CONST GUID *InterfaceClassGuid,
IN PDEVICE_OBJECT PhysicalDeviceObject OPTIONAL,
IN ULONG Flags,
OUT PWSTR *SymbolicLinkList)
{
DPRINT("IoGetDeviceInterfaces called (UNIMPLEMENTED)\n");
return STATUS_NOT_IMPLEMENTED;
}
/*
* @unimplemented
*/
NTSTATUS
STDCALL
IoRegisterDeviceInterface(
IN PDEVICE_OBJECT PhysicalDeviceObject,
IN CONST GUID *InterfaceClassGuid,
IN PUNICODE_STRING ReferenceString OPTIONAL,
OUT PUNICODE_STRING SymbolicLinkName)
{
PWCHAR KeyNameString = L"\\Device\\Serenum";
DPRINT("IoRegisterDeviceInterface called (UNIMPLEMENTED)\n");
if (IsEqualGUID(InterfaceClassGuid, (LPGUID)&GUID_SERENUM_BUS_ENUMERATOR))
{
RtlInitUnicodeString(SymbolicLinkName, KeyNameString);
return STATUS_SUCCESS;
}
return STATUS_INVALID_DEVICE_REQUEST;
// return STATUS_NOT_IMPLEMENTED;
}
/*
* @unimplemented
*/
NTSTATUS
STDCALL
IoSetDeviceInterfaceState(
IN PUNICODE_STRING SymbolicLinkName,
IN BOOLEAN Enable)
{
DPRINT("IoSetDeviceInterfaceState called (UNIMPLEMENTED)\n");
return STATUS_SUCCESS;
// return STATUS_OBJECT_NAME_EXISTS;
// return STATUS_OBJECT_NAME_NOT_FOUND;
// return STATUS_NOT_IMPLEMENTED;
}
/* EOF */

View file

@ -1,4 +1,4 @@
/* $Id: driver.c,v 1.15 2003/08/24 11:35:41 dwelch Exp $
/* $Id: driver.c,v 1.16 2003/09/25 15:54:42 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -239,9 +239,97 @@ NtLoadDriver(IN PUNICODE_STRING DriverServiceName)
NTSTATUS STDCALL
NtUnloadDriver(IN PUNICODE_STRING DriverServiceName)
{
RTL_QUERY_REGISTRY_TABLE QueryTable[2];
WCHAR FullImagePathBuffer[MAX_PATH];
UNICODE_STRING ImagePath;
UNICODE_STRING FullImagePath;
UNICODE_STRING ObjectName;
PDRIVER_OBJECT DriverObject;
NTSTATUS Status;
PMODULE_OBJECT ModuleObject;
LPWSTR Start;
DPRINT("DriverServiceName: '%wZ'\n", DriverServiceName);
return(STATUS_NOT_IMPLEMENTED);
/* Get the service name from the module name */
Start = wcsrchr(DriverServiceName->Buffer, L'\\');
if (Start == NULL)
Start = DriverServiceName->Buffer;
else
Start++;
ObjectName.Length = wcslen(Start) + 8;
ObjectName.Buffer = ExAllocatePool(NonPagedPool,
ObjectName.Length * sizeof(WCHAR));
wcscpy(ObjectName.Buffer, L"\\Driver\\");
memcpy(ObjectName.Buffer + 8, Start, (ObjectName.Length - 8) * sizeof(WCHAR));
/* Find the driver object */
Status = ObReferenceObjectByName(&ObjectName, 0, 0, 0, IoDriverObjectType,
KernelMode, 0, (PVOID*)&DriverObject);
if (!NT_SUCCESS(Status))
{
DPRINT("Can't locate driver object for %wZ\n", ObjectName);
return Status;
}
ObDereferenceObject(DriverObject);
RtlInitUnicodeString(&ImagePath, NULL);
/* Get service data */
RtlZeroMemory(&QueryTable,
sizeof(QueryTable));
QueryTable[0].Name = L"ImagePath";
QueryTable[0].Flags = RTL_QUERY_REGISTRY_DIRECT;
QueryTable[0].EntryContext = &ImagePath;
Status = RtlQueryRegistryValues(RTL_REGISTRY_ABSOLUTE,
DriverServiceName->Buffer,
QueryTable,
NULL,
NULL);
if (!NT_SUCCESS(Status))
{
DPRINT1("RtlQueryRegistryValues() failed (Status %lx)\n", Status);
RtlFreeUnicodeString(&ImagePath);
return(Status);
}
if (ImagePath.Length == 0)
{
wcscpy(FullImagePathBuffer, L"\\SystemRoot\\system32\\drivers");
wcscat(FullImagePathBuffer, wcsrchr(DriverServiceName->Buffer, L'\\'));
wcscat(FullImagePathBuffer, L".sys");
}
else if (ImagePath.Buffer[0] != L'\\')
{
wcscpy(FullImagePathBuffer, L"\\SystemRoot\\");
wcscat(FullImagePathBuffer, ImagePath.Buffer);
}
else
{
wcscpy(FullImagePathBuffer, ImagePath.Buffer);
}
RtlFreeUnicodeString(&ImagePath);
RtlInitUnicodeString(&FullImagePath, FullImagePathBuffer);
ModuleObject = LdrGetModuleObject(DriverServiceName);
if (ModuleObject == NULL)
{
return STATUS_UNSUCCESSFUL;
}
/* Unload the module and release the references to the device object */
if (DriverObject->DriverUnload)
(*DriverObject->DriverUnload)(DriverObject);
ObDereferenceObject(DriverObject);
ObDereferenceObject(DriverObject);
LdrUnloadModule(ModuleObject);
return STATUS_SUCCESS;
}

View file

@ -0,0 +1,282 @@
/* $Id: pnpdma.c,v 1.1 2003/09/25 15:54:42 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/io/pnpmgr.c
* PURPOSE: PnP manager DMA routines
* PROGRAMMER: Filip Navara (xnavara@volny.cz)
* UPDATE HISTORY:
* 22/09/2003 FiN Created
*/
/* INCLUDES ******************************************************************/
#include <ddk/ntddk.h>
#include <ddk/pnptypes.h>
#include <ddk/pnpfuncs.h>
#include <reactos/bugcodes.h>
#include <internal/io.h>
#include <internal/po.h>
#include <internal/ldr.h>
#include <internal/registry.h>
#include <internal/module.h>
//#define NDEBUG
#include <internal/debug.h>
#ifdef __USE_W32API
#include <initguid.h>
#else
#include <ole32/guiddef.h>
#endif
DEFINE_GUID(GUID_BUS_INTERFACE_STANDARD, 0x496B8280L, 0x6F25, 0x11D0, 0xBE, 0xAF, 0x08, 0x00, 0x2B, 0xE2, 0x09, 0x2F);
typedef struct _DMA_ADAPTER_INTERNAL {
USHORT Version;
USHORT Size;
PDMA_OPERATIONS DmaOperations;
PADAPTER_OBJECT HalAdapter;
} DMA_ADAPTER_INTERNAL, *PDMA_ADAPTER_INTERNAL;
/* FUNCTIONS *****************************************************************/
VOID
IopPutDmaAdapter(
PDMA_ADAPTER DmaAdapter)
{
ExFreePool(DmaAdapter);
}
PVOID
IopAllocateCommonBuffer(
IN PDMA_ADAPTER DmaAdapter,
IN ULONG Length,
OUT PPHYSICAL_ADDRESS LogicalAddress,
IN BOOLEAN CacheEnabled)
{
return HalAllocateCommonBuffer(
((PDMA_ADAPTER_INTERNAL)DmaAdapter)->HalAdapter,
Length, LogicalAddress, CacheEnabled);
}
VOID
IopFreeCommonBuffer(
IN PDMA_ADAPTER DmaAdapter,
IN ULONG Length,
IN PHYSICAL_ADDRESS LogicalAddress,
IN PVOID VirtualAddress,
IN BOOLEAN CacheEnabled)
{
HalFreeCommonBuffer(
((PDMA_ADAPTER_INTERNAL)DmaAdapter)->HalAdapter,
Length, LogicalAddress, VirtualAddress, CacheEnabled);
}
NTSTATUS
IopAllocateAdapterChannel(
IN PDMA_ADAPTER DmaAdapter,
IN PDEVICE_OBJECT DeviceObject,
IN ULONG NumberOfMapRegisters,
IN PDRIVER_CONTROL ExecutionRoutine,
IN PVOID Context)
{
return HalAllocateAdapterChannel(
((PDMA_ADAPTER_INTERNAL)DmaAdapter)->HalAdapter,
DeviceObject, NumberOfMapRegisters, ExecutionRoutine, Context);
}
BOOLEAN
IopFlushAdapterBuffers(
IN PDMA_ADAPTER DmaAdapter,
IN PMDL Mdl,
IN PVOID MapRegisterBase,
IN PVOID CurrentVa,
IN ULONG Length,
IN BOOLEAN WriteToDevice)
{
return IoFlushAdapterBuffers(
((PDMA_ADAPTER_INTERNAL)DmaAdapter)->HalAdapter,
Mdl, MapRegisterBase, CurrentVa, Length, WriteToDevice);
}
VOID
IopFreeAdapterChannel(
IN PDMA_ADAPTER DmaAdapter)
{
IoFreeAdapterChannel(((PDMA_ADAPTER_INTERNAL)DmaAdapter)->HalAdapter);
}
VOID
IopFreeMapRegisters(
IN PDMA_ADAPTER DmaAdapter,
PVOID MapRegisterBase,
ULONG NumberOfMapRegisters)
{
IoFreeMapRegisters(
((PDMA_ADAPTER_INTERNAL)DmaAdapter)->HalAdapter,
MapRegisterBase, NumberOfMapRegisters);
}
PHYSICAL_ADDRESS
IopMapTransfer(
IN PDMA_ADAPTER DmaAdapter,
IN PMDL Mdl,
IN PVOID MapRegisterBase,
IN PVOID CurrentVa,
IN OUT PULONG Length,
IN BOOLEAN WriteToDevice)
{
return IoMapTransfer(
((PDMA_ADAPTER_INTERNAL)DmaAdapter)->HalAdapter,
Mdl, MapRegisterBase, CurrentVa, Length, WriteToDevice);
}
ULONG
IopGetDmaAlignment(
IN PDMA_ADAPTER DmaAdapter)
{
/* FIXME: This is actually true only on i386 and Amd64 */
return 1L;
}
ULONG
IopReadDmaCounter(
IN PDMA_ADAPTER DmaAdapter)
{
return HalReadDmaCounter(((PDMA_ADAPTER_INTERNAL)DmaAdapter)->HalAdapter);
}
NTSTATUS
IopGetScatterGatherList(
IN PDMA_ADAPTER DmaAdapter,
IN PDEVICE_OBJECT DeviceObject,
IN PMDL Mdl,
IN PVOID CurrentVa,
IN ULONG Length,
IN PDRIVER_LIST_CONTROL ExecutionRoutine,
IN PVOID Context,
IN BOOLEAN WriteToDevice)
{
/* FIXME */
return STATUS_UNSUCCESSFUL;
}
VOID
IopPutScatterGatherList(
IN PDMA_ADAPTER DmaAdapter,
IN PSCATTER_GATHER_LIST ScatterGather,
IN BOOLEAN WriteToDevice)
{
/* FIXME */
}
/*
* @implemented
*/
PDMA_ADAPTER
STDCALL
IoGetDmaAdapter(
IN PDEVICE_OBJECT PhysicalDeviceObject,
IN PDEVICE_DESCRIPTION DeviceDescription,
IN OUT PULONG NumberOfMapRegisters)
{
NTSTATUS Status;
ULONG ResultLength;
BUS_INTERFACE_STANDARD BusInterface;
IO_STATUS_BLOCK IoStatusBlock;
IO_STACK_LOCATION Stack;
DEVICE_DESCRIPTION PrivateDeviceDescription;
PDMA_ADAPTER Result = NULL;
PDMA_ADAPTER_INTERNAL ResultInternal = NULL;
PADAPTER_OBJECT HalAdapter;
DPRINT("IoGetDmaAdapter called\n");
/*
* Try to create DMA adapter through bus driver
*/
if (PhysicalDeviceObject != NULL)
{
if (DeviceDescription->InterfaceType == 0x0F /*PNPBus*/ ||
DeviceDescription->InterfaceType == 0xFFFFFFFF)
{
memcpy(&PrivateDeviceDescription, DeviceDescription,
sizeof(DEVICE_DESCRIPTION));
Status = IoGetDeviceProperty(PhysicalDeviceObject,
DevicePropertyLegacyBusType, sizeof(INTERFACE_TYPE),
&PrivateDeviceDescription.InterfaceType, &ResultLength);
if (!NT_SUCCESS(Status))
{
PrivateDeviceDescription.InterfaceType = Internal;
}
DeviceDescription = &PrivateDeviceDescription;
}
Stack.Parameters.QueryInterface.Size = sizeof(BUS_INTERFACE_STANDARD);
Stack.Parameters.QueryInterface.Version = 1;
Stack.Parameters.QueryInterface.Interface = (PINTERFACE)&BusInterface;
Stack.Parameters.QueryInterface.InterfaceType =
&GUID_BUS_INTERFACE_STANDARD;
Status = IopInitiatePnpIrp(PhysicalDeviceObject, &IoStatusBlock,
IRP_MN_QUERY_BUS_INFORMATION, &Stack);
if (!NT_SUCCESS(Status))
{
Result = BusInterface.GetDmaAdapter(BusInterface.Context,
DeviceDescription, NumberOfMapRegisters);
BusInterface.InterfaceDereference(BusInterface.Context);
if (Result != NULL)
return Result;
}
}
/*
* Fallback to HAL
*/
HalAdapter = HalGetAdapter(DeviceDescription, NumberOfMapRegisters);
if (HalAdapter == NULL)
{
return NULL;
}
ResultInternal = ExAllocatePool(PagedPool, sizeof(DMA_ADAPTER_INTERNAL) +
sizeof(DMA_OPERATIONS));
if (Result == NULL)
{
return NULL;
}
ResultInternal->Version = DEVICE_DESCRIPTION_VERSION;
ResultInternal->Size = sizeof(DMA_ADAPTER);
ResultInternal->DmaOperations = (PDMA_OPERATIONS)(ResultInternal + 1);
ResultInternal->DmaOperations->Size = sizeof(DMA_OPERATIONS);
ResultInternal->DmaOperations->PutDmaAdapter = IopPutDmaAdapter;
ResultInternal->DmaOperations->AllocateCommonBuffer = IopAllocateCommonBuffer;
ResultInternal->DmaOperations->FreeCommonBuffer = IopFreeCommonBuffer;
ResultInternal->DmaOperations->AllocateAdapterChannel = IopAllocateAdapterChannel;
ResultInternal->DmaOperations->FlushAdapterBuffers = IopFlushAdapterBuffers;
ResultInternal->DmaOperations->FreeAdapterChannel = IopFreeAdapterChannel;
ResultInternal->DmaOperations->FreeMapRegisters = IopFreeMapRegisters;
ResultInternal->DmaOperations->MapTransfer = IopMapTransfer;
ResultInternal->DmaOperations->GetDmaAlignment = IopGetDmaAlignment;
ResultInternal->DmaOperations->ReadDmaCounter = IopReadDmaCounter;
ResultInternal->DmaOperations->GetScatterGatherList = IopGetScatterGatherList;
ResultInternal->DmaOperations->PutScatterGatherList = IopPutScatterGatherList;
ResultInternal->HalAdapter = HalAdapter;
return (PDMA_ADAPTER)ResultInternal;
}
/* EOF */

View file

@ -1,8 +1,8 @@
/* $Id: pnpmgr.c,v 1.14 2003/08/24 11:35:41 dwelch Exp $
/* $Id: pnpmgr.c,v 1.15 2003/09/25 15:54:42 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/io/pnpmgr.c
* FILE: ntoskrnl/io/pnpmgr/pnpmgr.c
* PURPOSE: Initializes the PnP manager
* PROGRAMMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
* UPDATE HISTORY:
@ -26,8 +26,7 @@ DEFINE_GUID(GUID_CLASS_COMPORT, 0x86e0d1e0L, 0x8089, 0x11d0, 0x9c, 0xe4
DEFINE_GUID(GUID_SERENUM_BUS_ENUMERATOR, 0x4D36E978L, 0xE325, 0x11CE, 0xBF, 0xC1, 0x08, 0x00, 0x2B, 0xE1, 0x03, 0x18);
#endif // DEFINE_GUID
#define NDEBUG
//#define NDEBUG
#include <internal/debug.h>
@ -45,56 +44,6 @@ PDRIVER_OBJECT IopRootDriverObject;
/*
* @unimplemented
*/
VOID
STDCALL
IoInitializeRemoveLockEx(
IN PIO_REMOVE_LOCK Lock,
IN ULONG AllocateTag,
IN ULONG MaxLockedMinutes,
IN ULONG HighWatermark,
IN ULONG RemlockSize)
{
}
/*
* @unimplemented
*/
NTSTATUS
STDCALL
IoAcquireRemoveLockEx(
IN PIO_REMOVE_LOCK RemoveLock,
IN OPTIONAL PVOID Tag,
IN LPCSTR File,
IN ULONG Line,
IN ULONG RemlockSize)
{
return STATUS_NOT_IMPLEMENTED;
}
/*
* @unimplemented
*/
VOID
STDCALL
IoReleaseRemoveLockEx(
IN PIO_REMOVE_LOCK RemoveLock,
IN PVOID Tag,
IN ULONG RemlockSize)
{
}
/*
* @unimplemented
*/
VOID
STDCALL
IoReleaseRemoveLockAndWaitEx(
IN PIO_REMOVE_LOCK RemoveLock,
IN PVOID Tag,
IN ULONG RemlockSize)
{
}
VOID
STDCALL
IoAdjustPagingPathCount(
@ -103,31 +52,17 @@ IoAdjustPagingPathCount(
{
}
/*
* @unimplemented
*/
NTSTATUS
STDCALL
IoGetDeviceInterfaceAlias(
IN PUNICODE_STRING SymbolicLinkName,
IN CONST GUID *AliasInterfaceClassGuid,
OUT PUNICODE_STRING AliasSymbolicLinkName)
IopQueryBusInformation(
PDEVICE_OBJECT DeviceObject,
PPNP_BUS_INFORMATION BusInformation)
{
return STATUS_NOT_IMPLEMENTED;
}
IO_STATUS_BLOCK IoStatusBlock;
IO_STACK_LOCATION Stack;
/*
* @unimplemented
*/
NTSTATUS
STDCALL
IoGetDeviceInterfaces(
IN CONST GUID *InterfaceClassGuid,
IN PDEVICE_OBJECT PhysicalDeviceObject OPTIONAL,
IN ULONG Flags,
OUT PWSTR *SymbolicLinkList)
{
return STATUS_NOT_IMPLEMENTED;
IoStatusBlock.Information = (ULONG)BusInformation;
return IopInitiatePnpIrp(DeviceObject, &IoStatusBlock,
IRP_MN_QUERY_BUS_INFORMATION, &Stack);
}
/*
@ -142,6 +77,82 @@ IoGetDeviceProperty(
OUT PVOID PropertyBuffer,
OUT PULONG ResultLength)
{
PNP_BUS_INFORMATION BusInformation;
NTSTATUS Status;
DPRINT("IoGetDeviceProperty called");
/*
* Used IRPs:
* IRP_MN_QUERY_ID
* IRP_MN_QUERY_BUS_INFORMATION
*/
switch (DeviceProperty)
{
/* Complete, untested */
case DevicePropertyBusNumber:
*ResultLength = sizeof(ULONG);
if (BufferLength < sizeof(ULONG))
return STATUS_BUFFER_TOO_SMALL;
Status = IopQueryBusInformation(DeviceObject, &BusInformation);
if (NT_SUCCESS(Status))
*((ULONG *)PropertyBuffer) = BusInformation.BusNumber;
return Status;
/* Complete, untested */
case DevicePropertyBusTypeGuid:
*ResultLength = 39 * sizeof(WCHAR);
if (BufferLength < (39 * sizeof(WCHAR)))
return STATUS_BUFFER_TOO_SMALL;
Status = IopQueryBusInformation(DeviceObject, &BusInformation);
if (NT_SUCCESS(Status))
swprintf((PWSTR)PropertyBuffer,
L"{%08lX-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
BusInformation.BusTypeGuid.Data1,
BusInformation.BusTypeGuid.Data2,
BusInformation.BusTypeGuid.Data3,
BusInformation.BusTypeGuid.Data4[0],
BusInformation.BusTypeGuid.Data4[1],
BusInformation.BusTypeGuid.Data4[2],
BusInformation.BusTypeGuid.Data4[3],
BusInformation.BusTypeGuid.Data4[4],
BusInformation.BusTypeGuid.Data4[5],
BusInformation.BusTypeGuid.Data4[6],
BusInformation.BusTypeGuid.Data4[7]);
return Status;
/* Complete, untested */
case DevicePropertyLegacyBusType:
*ResultLength = sizeof(INTERFACE_TYPE);
if (BufferLength < sizeof(INTERFACE_TYPE))
return STATUS_BUFFER_TOO_SMALL;
Status = IopQueryBusInformation(DeviceObject, &BusInformation);
if (NT_SUCCESS(Status))
memcpy(PropertyBuffer, &BusInformation.LegacyBusType,
sizeof(INTERFACE_TYPE));
return Status;
case DevicePropertyAddress:
case DevicePropertyBootConfiguration:
case DevicePropertyBootConfigurationTranslated:
case DevicePropertyClassGuid:
case DevicePropertyClassName:
case DevicePropertyCompatibleIDs:
case DevicePropertyDeviceDescription:
case DevicePropertyDriverKeyName:
case DevicePropertyEnumeratorName:
case DevicePropertyFriendlyName:
case DevicePropertyHardwareID:
case DevicePropertyLocationInformation:
case DevicePropertyManufacturer:
case DevicePropertyPhysicalDeviceObjectName:
case DevicePropertyUINumber:
break;
default:
return STATUS_INVALID_PARAMETER_2;
}
return STATUS_NOT_IMPLEMENTED;
}
@ -166,19 +177,6 @@ IoInvalidateDeviceState(
{
}
/*
* @unimplemented
*/
NTSTATUS
STDCALL
IoOpenDeviceInterfaceRegistryKey(
IN PUNICODE_STRING SymbolicLinkName,
IN ACCESS_MASK DesiredAccess,
OUT PHANDLE DeviceInterfaceKey)
{
return STATUS_NOT_IMPLEMENTED;
}
/*
* @unimplemented
*/
@ -193,105 +191,6 @@ IoOpenDeviceRegistryKey(
return STATUS_NOT_IMPLEMENTED;
}
/*
* @implemented
*/
NTSTATUS
STDCALL
IoRegisterDeviceInterface(
IN PDEVICE_OBJECT PhysicalDeviceObject,
IN CONST GUID *InterfaceClassGuid,
IN PUNICODE_STRING ReferenceString OPTIONAL,
OUT PUNICODE_STRING SymbolicLinkName)
{
PWCHAR KeyNameString = L"\\Device\\Serenum";
if (IsEqualGUID(InterfaceClassGuid, (LPGUID)&GUID_SERENUM_BUS_ENUMERATOR)) {
RtlInitUnicodeString(SymbolicLinkName, KeyNameString);
return STATUS_SUCCESS;
}
return STATUS_INVALID_DEVICE_REQUEST;
// return STATUS_NOT_IMPLEMENTED;
}
/*
* @unimplemented
*/
NTSTATUS
STDCALL
IoRegisterPlugPlayNotification(
IN IO_NOTIFICATION_EVENT_CATEGORY EventCategory,
IN ULONG EventCategoryFlags,
IN PVOID EventCategoryData OPTIONAL,
IN PDRIVER_OBJECT DriverObject,
IN PDRIVER_NOTIFICATION_CALLBACK_ROUTINE CallbackRoutine,
IN PVOID Context,
OUT PVOID *NotificationEntry)
{
return STATUS_NOT_IMPLEMENTED;
}
/*
* @unimplemented
*/
NTSTATUS
STDCALL
IoReportDetectedDevice(
IN PDRIVER_OBJECT DriverObject,
IN INTERFACE_TYPE LegacyBusType,
IN ULONG BusNumber,
IN ULONG SlotNumber,
IN PCM_RESOURCE_LIST ResourceList,
IN PIO_RESOURCE_REQUIREMENTS_LIST ResourceRequirements OPTIONAL,
IN BOOLEAN ResourceAssigned,
IN OUT PDEVICE_OBJECT *DeviceObject)
{
return STATUS_NOT_IMPLEMENTED;
}
/*
* @unimplemented
*/
NTSTATUS
STDCALL
IoReportResourceForDetection(
IN PDRIVER_OBJECT DriverObject,
IN PCM_RESOURCE_LIST DriverList OPTIONAL,
IN ULONG DriverListSize OPTIONAL,
IN PDEVICE_OBJECT DeviceObject OPTIONAL,
IN PCM_RESOURCE_LIST DeviceList OPTIONAL,
IN ULONG DeviceListSize OPTIONAL,
OUT PBOOLEAN ConflictDetected)
{
return STATUS_NOT_IMPLEMENTED;
}
/*
* @unimplemented
*/
NTSTATUS
STDCALL
IoReportTargetDeviceChange(
IN PDEVICE_OBJECT PhysicalDeviceObject,
IN PVOID NotificationStructure)
{
return STATUS_NOT_IMPLEMENTED;
}
/*
* @unimplemented
*/
NTSTATUS
STDCALL
IoReportTargetDeviceChangeAsynchronous(
IN PDEVICE_OBJECT PhysicalDeviceObject,
IN PVOID NotificationStructure,
IN PDEVICE_CHANGE_COMPLETE_CALLBACK Callback OPTIONAL,
IN PVOID Context OPTIONAL)
{
return STATUS_NOT_IMPLEMENTED;
}
/*
* @unimplemented
*/
@ -302,33 +201,6 @@ IoRequestDeviceEject(
{
}
/*
* @unimplemented
*/
NTSTATUS
STDCALL
IoSetDeviceInterfaceState(
IN PUNICODE_STRING SymbolicLinkName,
IN BOOLEAN Enable)
{
return STATUS_SUCCESS;
// return STATUS_OBJECT_NAME_EXISTS;
// return STATUS_OBJECT_NAME_NOT_FOUND;
// return STATUS_NOT_IMPLEMENTED;
}
/*
* @unimplemented
*/
NTSTATUS
STDCALL
IoUnregisterPlugPlayNotification(
IN PVOID NotificationEntry)
{
return STATUS_NOT_IMPLEMENTED;
}
BOOLEAN
IopCreateUnicodeString(
@ -721,6 +593,7 @@ IopActionInterrogateDeviceStack(
WCHAR InstancePath[MAX_PATH];
IO_STACK_LOCATION Stack;
NTSTATUS Status;
WCHAR KeyBuffer[MAX_PATH];
DPRINT("DeviceNode %x Context %x\n", DeviceNode, Context);
@ -933,6 +806,19 @@ IopActionInterrogateDeviceStack(
DPRINT("InstancePath is %S\n", DeviceNode->InstancePath.Buffer);
/*
* Create registry key for the device id, if it doesn't exist yet
*
* FIXME: This code is temporary until I figure out where these keys should
* be created. The keys are needed for installation of PnP drivers.
*
* FiN
*/
wcscpy(KeyBuffer, L"\\Registry\\Machine\\System\\CurrentControlSet\\Enum\\");
wcscat(KeyBuffer, DeviceNode->DeviceID.Buffer);
RtlpCreateRegistryKeyPath(KeyBuffer);
return STATUS_SUCCESS;
}
@ -954,6 +840,83 @@ IopActionConfigureChildServices(
* configured.
*/
{
/*
* FIXME: There are two versions of this function: one that creates registry
* and one that doesn't. The second is the right, but could not be used because
* there is not automatic parent key generation.
*
* Update: It could propably be used now, but there's no need anymore.
*
* FiN
*/
#if 1
RTL_QUERY_REGISTRY_TABLE QueryTable[2];
PDEVICE_NODE ParentDeviceNode;
PUNICODE_STRING Service;
NTSTATUS Status;
DPRINT("DeviceNode %x Context %x\n", DeviceNode, Context);
ParentDeviceNode = (PDEVICE_NODE)Context;
/* We are called for the parent too, but we don't need to do special
handling for this node */
if (DeviceNode == ParentDeviceNode)
{
DPRINT("Success\n");
return STATUS_SUCCESS;
}
/* Make sure this device node is a direct child of the parent device node
that is given as an argument */
if (DeviceNode->Parent != ParentDeviceNode)
{
/* Stop the traversal immediately and indicate successful operation */
DPRINT("Stop\n");
return STATUS_UNSUCCESSFUL;
}
/* Retrieve configuration from Enum key */
Service = &DeviceNode->ServiceName;
RtlZeroMemory(QueryTable, sizeof(QueryTable));
RtlInitUnicodeString(Service, NULL);
QueryTable[0].Name = L"Service";
QueryTable[0].Flags = RTL_QUERY_REGISTRY_DIRECT;
QueryTable[0].EntryContext = Service;
Status = RtlQueryRegistryValues(
RTL_REGISTRY_ENUM,
DeviceNode->InstancePath.Buffer,
QueryTable,
NULL,
NULL);
DPRINT("RtlQueryRegistryValues() returned status %x\n", Status);
DPRINT("Key: %S\n", DeviceNode->InstancePath.Buffer);
if (!NT_SUCCESS(Status))
{
/* FIXME: Log the error */
CPRINT("Could not retrieve configuration for device %S (Status %x)\n",
DeviceNode->InstancePath.Buffer, Status);
IopDeviceNodeSetFlag(DeviceNode, DNF_DISABLED);
return STATUS_SUCCESS;
}
if (Service->Buffer == NULL)
{
IopDeviceNodeSetFlag(DeviceNode, DNF_DISABLED);
return STATUS_SUCCESS;
}
DPRINT("Got Service %S\n", Service->Buffer);
return STATUS_SUCCESS;
#else
RTL_QUERY_REGISTRY_TABLE QueryTable[2];
PDEVICE_NODE ParentDeviceNode;
PUNICODE_STRING Service;
@ -1026,6 +989,7 @@ IopActionConfigureChildServices(
DPRINT("Got Service %S\n", Service->Buffer);
return STATUS_SUCCESS;
#endif
}
@ -1212,10 +1176,9 @@ IopInterrogateBusExtender(
return Status;
}
return Status;
return STATUS_SUCCESS;
}
VOID IopLoadBootStartDrivers(VOID)
{
IopInterrogateBusExtender(

View file

@ -0,0 +1,56 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/io/pnpmgr/remlock.c
* PURPOSE: Plug & Play notification functions
* PROGRAMMER: Filip Navara (xnavara@volny.cz)
* UPDATE HISTORY:
* 22/09/2003 FiN Created
*/
/* INCLUDES ******************************************************************/
#include <ddk/ntddk.h>
#include <reactos/bugcodes.h>
#include <internal/io.h>
#include <internal/po.h>
#include <internal/ldr.h>
#include <internal/registry.h>
#include <internal/module.h>
//#define NDEBUG
#include <internal/debug.h>
/* FUNCTIONS *****************************************************************/
/*
* @unimplemented
*/
NTSTATUS
STDCALL
IoRegisterPlugPlayNotification(
IN IO_NOTIFICATION_EVENT_CATEGORY EventCategory,
IN ULONG EventCategoryFlags,
IN PVOID EventCategoryData OPTIONAL,
IN PDRIVER_OBJECT DriverObject,
IN PDRIVER_NOTIFICATION_CALLBACK_ROUTINE CallbackRoutine,
IN PVOID Context,
OUT PVOID *NotificationEntry)
{
DPRINT("IoRegisterPlugPlayNotification called (UNIMPLEMENTED)\n");
return STATUS_NOT_IMPLEMENTED;
}
/*
* @unimplemented
*/
NTSTATUS
STDCALL
IoUnregisterPlugPlayNotification(
IN PVOID NotificationEntry)
{
DPRINT("IoUnregisterPlugPlayNotification called (UNIMPLEMENTED)\n");
return STATUS_NOT_IMPLEMENTED;
}
/* EOF */

View file

@ -0,0 +1,91 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/io/pnpmgr/report.c
* PURPOSE: Device Changes Reporting functions
* PROGRAMMER: Filip Navara (xnavara@volny.cz)
* UPDATE HISTORY:
* 22/09/2003 FiN Created
*/
/* INCLUDES ******************************************************************/
#include <ddk/ntddk.h>
#include <reactos/bugcodes.h>
#include <internal/io.h>
#include <internal/po.h>
#include <internal/ldr.h>
#include <internal/registry.h>
#include <internal/module.h>
//#define NDEBUG
#include <internal/debug.h>
/* FUNCTIONS *****************************************************************/
/*
* @unimplemented
*/
NTSTATUS
STDCALL
IoReportDetectedDevice(
IN PDRIVER_OBJECT DriverObject,
IN INTERFACE_TYPE LegacyBusType,
IN ULONG BusNumber,
IN ULONG SlotNumber,
IN PCM_RESOURCE_LIST ResourceList,
IN PIO_RESOURCE_REQUIREMENTS_LIST ResourceRequirements OPTIONAL,
IN BOOLEAN ResourceAssigned,
IN OUT PDEVICE_OBJECT *DeviceObject)
{
DPRINT("IoReportDetectedDevice called (UNIMPLEMENTED)\n");
return STATUS_NOT_IMPLEMENTED;
}
/*
* @unimplemented
*/
NTSTATUS
STDCALL
IoReportResourceForDetection(
IN PDRIVER_OBJECT DriverObject,
IN PCM_RESOURCE_LIST DriverList OPTIONAL,
IN ULONG DriverListSize OPTIONAL,
IN PDEVICE_OBJECT DeviceObject OPTIONAL,
IN PCM_RESOURCE_LIST DeviceList OPTIONAL,
IN ULONG DeviceListSize OPTIONAL,
OUT PBOOLEAN ConflictDetected)
{
DPRINT("IoReportResourceForDetection called (UNIMPLEMENTED)\n");
return STATUS_NOT_IMPLEMENTED;
}
/*
* @unimplemented
*/
NTSTATUS
STDCALL
IoReportTargetDeviceChange(
IN PDEVICE_OBJECT PhysicalDeviceObject,
IN PVOID NotificationStructure)
{
DPRINT("IoReportTargetDeviceChange called (UNIMPLEMENTED)\n");
return STATUS_NOT_IMPLEMENTED;
}
/*
* @unimplemented
*/
NTSTATUS
STDCALL
IoReportTargetDeviceChangeAsynchronous(
IN PDEVICE_OBJECT PhysicalDeviceObject,
IN PVOID NotificationStructure,
IN PDEVICE_CHANGE_COMPLETE_CALLBACK Callback OPTIONAL,
IN PVOID Context OPTIONAL)
{
DPRINT("IoReportTargetDeviceChangeAsynchronous called (UNIMPLEMENTED)\n");
return STATUS_NOT_IMPLEMENTED;
}
/* EOF */

View file

@ -1,8 +1,8 @@
/* $Id: pnproot.c,v 1.14 2003/07/21 21:53:51 royce Exp $
/* $Id: pnproot.c,v 1.15 2003/09/25 15:54:42 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/io/pnproot.c
* FILE: ntoskrnl/io/pnpmgr/pnproot.c
* PURPOSE: PnP manager root device
* PROGRAMMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
* UPDATE HISTORY:

View file

@ -0,0 +1,107 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/io/pnpmgr/remlock.c
* PURPOSE: Remove Lock functions
* PROGRAMMER: Filip Navara (xnavara@volny.cz)
* UPDATE HISTORY:
* 22/09/2003 FiN Created
*/
/* INCLUDES ******************************************************************/
#include <ddk/ntddk.h>
#include <reactos/bugcodes.h>
#include <internal/io.h>
#include <internal/po.h>
#include <internal/ldr.h>
#include <internal/registry.h>
#include <internal/module.h>
//#define NDEBUG
#include <internal/debug.h>
/* FUNCTIONS *****************************************************************/
/*
* @implemented
*/
VOID
STDCALL
IoInitializeRemoveLockEx(
IN PIO_REMOVE_LOCK RemoveLock,
IN ULONG AllocateTag,
IN ULONG MaxLockedMinutes,
IN ULONG HighWatermark,
IN ULONG RemlockSize)
{
DPRINT("IoInitializeRemoveLockEx called");
RtlZeroMemory(RemoveLock, RemlockSize);
RemoveLock->Common.IoCount = 1;
KeInitializeEvent(&RemoveLock->Common.RemoveEvent, NotificationEvent, FALSE);
}
/*
* @implemented
*/
NTSTATUS
STDCALL
IoAcquireRemoveLockEx(
IN PIO_REMOVE_LOCK RemoveLock,
IN OPTIONAL PVOID Tag,
IN LPCSTR File,
IN ULONG Line,
IN ULONG RemlockSize)
{
DPRINT("IoAcquireRemoveLockEx called");
InterlockedIncrement(&RemoveLock->Common.IoCount);
if (RemoveLock->Common.Removed)
{
if (InterlockedDecrement(&RemoveLock->Common.IoCount) == 0)
{
KeSetEvent(&RemoveLock->Common.RemoveEvent, IO_NO_INCREMENT, FALSE);
}
return STATUS_DELETE_PENDING;
}
return STATUS_SUCCESS;
}
/*
* @implemented
*/
VOID
STDCALL
IoReleaseRemoveLockEx(
IN PIO_REMOVE_LOCK RemoveLock,
IN PVOID Tag,
IN ULONG RemlockSize)
{
LONG IoCount;
DPRINT("IoReleaseRemoveLockEx called");
IoCount = InterlockedDecrement(&RemoveLock->Common.IoCount);
if (IoCount == 0)
{
KeSetEvent(&RemoveLock->Common.RemoveEvent, IO_NO_INCREMENT, FALSE);
}
}
/*
* @implemented
*/
VOID
STDCALL
IoReleaseRemoveLockAndWaitEx(
IN PIO_REMOVE_LOCK RemoveLock,
IN PVOID Tag,
IN ULONG RemlockSize)
{
DPRINT("IoReleaseRemoveLockAndWaitEx called");
RemoveLock->Common.Removed = TRUE;
InterlockedDecrement(&RemoveLock->Common.IoCount);
IoReleaseRemoveLockEx(RemoveLock, Tag, RemlockSize);
KeWaitForSingleObject(&RemoveLock->Common.RemoveEvent, Executive, KernelMode,
FALSE, NULL);
}
/* EOF */

23
reactos/ntoskrnl/io/wdm.c Normal file
View file

@ -0,0 +1,23 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/io/wdm.c
* PURPOSE: Various Windows Driver Model routines
* PROGRAMMER: Filip Navara (xnavara@volny.cz)
*/
#include <ddk/ntddk.h>
/*
* @implemented
*/
BOOLEAN STDCALL
IoIsWdmVersionAvailable(
IN UCHAR MajorVersion,
IN UCHAR MinorVersion
)
{
if (MajorVersion <= 1 && MinorVersion <= 10)
return TRUE;
return FALSE;
}

View file

@ -1,4 +1,4 @@
/* $Id: spinlock.c,v 1.18 2003/07/21 21:53:51 royce Exp $
/* $Id: spinlock.c,v 1.19 2003/09/25 15:54:42 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -69,19 +69,13 @@ KeInitializeSpinLock (PKSPIN_LOCK SpinLock)
*SpinLock = 0;
}
#undef KeAcquireSpinLockAtDpcLevel
#undef KefAcquireSpinLockAtDpcLevel
/*
* @implemented
*/
VOID STDCALL
KeAcquireSpinLockAtDpcLevel (PKSPIN_LOCK SpinLock)
/*
* FUNCTION: Acquires a spinlock when the caller is already running at
* dispatch level
* ARGUMENTS:
* SpinLock = Spinlock to acquire
*/
VOID FASTCALL
KefAcquireSpinLockAtDpcLevel(PKSPIN_LOCK SpinLock)
{
ULONG i;
@ -106,6 +100,39 @@ KeAcquireSpinLockAtDpcLevel (PKSPIN_LOCK SpinLock)
}
}
#undef KeAcquireSpinLockAtDpcLevel
/*
* @implemented
*/
VOID STDCALL
KeAcquireSpinLockAtDpcLevel (PKSPIN_LOCK SpinLock)
/*
* FUNCTION: Acquires a spinlock when the caller is already running at
* dispatch level
* ARGUMENTS:
* SpinLock = Spinlock to acquire
*/
{
KefAcquireSpinLockAtDpcLevel(SpinLock);
}
#undef KefReleaseSpinLockFromDpcLevel
/*
* @implemented
*/
VOID FASTCALL
KefReleaseSpinLockFromDpcLevel(PKSPIN_LOCK SpinLock)
{
if (*SpinLock != 1)
{
DbgPrint("Releasing unacquired spinlock %x\n", SpinLock);
KEBUGCHECK(0);
}
(void)InterlockedExchange((LONG *)SpinLock, 0);
}
#undef KeReleaseSpinLockFromDpcLevel
/*
@ -120,12 +147,7 @@ KeReleaseSpinLockFromDpcLevel (PKSPIN_LOCK SpinLock)
* SpinLock = Spinlock to release
*/
{
if (*SpinLock != 1)
{
DbgPrint("Releasing unacquired spinlock %x\n", SpinLock);
KEBUGCHECK(0);
}
(void)InterlockedExchange((LONG *)SpinLock, 0);
KefReleaseSpinLockFromDpcLevel(SpinLock);
}
/* EOF */

View file

@ -1,4 +1,4 @@
/* $Id: pool.c,v 1.22 2003/09/14 09:15:04 hbirr Exp $
/* $Id: pool.c,v 1.23 2003/09/25 15:54:43 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -158,6 +158,16 @@ ExFreePool(IN PVOID Block)
}
}
/*
* @implemented
*/
VOID STDCALL
ExFreePoolWithTag(IN PVOID Block, IN ULONG Tag)
{
/* FIXME: Validate the tag */
ExFreePool(Block);
}
/* EOF */

View file

@ -1,4 +1,4 @@
; $Id: ntoskrnl.def,v 1.164 2003/09/09 14:50:19 gvg Exp $
; $Id: ntoskrnl.def,v 1.165 2003/09/25 15:54:42 navaraf Exp $
;
; reactos/ntoskrnl/ntoskrnl.def
;
@ -45,6 +45,7 @@ ExDisableResourceBoostLite@4
ExEventObjectType DATA
ExExtendZone@12
ExFreePool@4
ExFreePoolWithTag@8
ExFreeToPagedLookasideList@8
ExGetExclusiveWaiterCount@4
ExGetPreviousMode@0

View file

@ -1,4 +1,4 @@
; $Id: ntoskrnl.edf,v 1.152 2003/09/09 14:50:19 gvg Exp $
; $Id: ntoskrnl.edf,v 1.153 2003/09/25 15:54:42 navaraf Exp $
;
; reactos/ntoskrnl/ntoskrnl.def
;
@ -45,6 +45,7 @@ ExDisableResourceBoostLite=ExDisableResourceBoostLite@4
ExEventObjectType DATA
ExExtendZone=ExExtendZone@12
ExFreePool=ExFreePool@4
ExFreePoolWithTag=ExFreePoolWithTag@8
ExFreeToPagedLookasideList=ExiFreeToPagedLookasideList@8
ExGetExclusiveWaiterCount=ExGetExclusiveWaiterCount@4
ExGetPreviousMode=ExGetPreviousMode@0
@ -285,6 +286,7 @@ IoGetConfigurationInformation=IoGetConfigurationInformation@0
IoGetCurrentProcess=IoGetCurrentProcess@0
IoGetDeviceObjectPointer=IoGetDeviceObjectPointer@16
IoGetDeviceToVerify=IoGetDeviceToVerify@4
IoGetDmaAdapter=IoGetDmaAdapter@12
IoGetFileObjectGenericMapping=IoGetFileObjectGenericMapping@0
IoGetInitialStack=IoGetInitialStack@0
IoGetRelatedDeviceObject=IoGetRelatedDeviceObject@4
@ -356,6 +358,7 @@ IoWritePartitionTable=IoWritePartitionTable@20
IoWriteTransferCount DATA
IofCallDriver=@IofCallDriver@8
IofCompleteRequest=@IofCompleteRequest@8
IoIsWdmVersionAvailable=IoIsWdmVersionAvailable@8
KdDebuggerEnabled DATA
KdDebuggerNotPresent DATA
KdPollBreakIn=KdPollBreakIn@0
@ -472,8 +475,8 @@ KeTickCount DATA
KeWaitForMultipleObjects=KeWaitForMultipleObjects@32
KeWaitForMutexObject=KeWaitForMutexObject@20
KeWaitForSingleObject=KeWaitForSingleObject@20
;KefAcquireSpinLockAtDpcLevel
;KefReleaseSpinLockFromDpcLevel
KefAcquireSpinLockAtDpcLevel=@KefAcquireSpinLockAtDpcLevel@4
KefReleaseSpinLockFromDpcLevel=@KefReleaseSpinLockFromDpcLevel@4
;Kei386EoiHelper
;KiAcquireSpinLock@4
;KiBugCheckData DATA