Fixed line endings.

svn path=/trunk/; revision=6139
This commit is contained in:
Filip Navara 2003-09-25 18:29:45 +00:00
parent 636d453391
commit 72d8964737
5 changed files with 3038 additions and 3038 deletions

File diff suppressed because it is too large Load diff

View file

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

File diff suppressed because it is too large Load diff

View file

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

File diff suppressed because it is too large Load diff