mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 17:16:04 +00:00
- Fix various bugs in IoGetDmaAdapter.
- Fill the IoStatus values in the Irp I/O status block in IopInitiatePnpIrp. svn path=/trunk/; revision=11334
This commit is contained in:
parent
cbc7c9eac2
commit
953b49dd54
2 changed files with 37 additions and 38 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: pnpdma.c,v 1.7 2004/10/18 21:07:42 navaraf Exp $
|
/* $Id: pnpdma.c,v 1.8 2004/10/19 19:37:45 navaraf Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -12,6 +12,7 @@
|
||||||
/* INCLUDES ******************************************************************/
|
/* INCLUDES ******************************************************************/
|
||||||
|
|
||||||
#include <ntoskrnl.h>
|
#include <ntoskrnl.h>
|
||||||
|
#define NDEBUG
|
||||||
#include <internal/debug.h>
|
#include <internal/debug.h>
|
||||||
|
|
||||||
#ifdef __USE_W32API
|
#ifdef __USE_W32API
|
||||||
|
@ -193,6 +194,21 @@ IoGetDmaAdapter(
|
||||||
IN PDEVICE_DESCRIPTION DeviceDescription,
|
IN PDEVICE_DESCRIPTION DeviceDescription,
|
||||||
IN OUT PULONG NumberOfMapRegisters)
|
IN OUT PULONG NumberOfMapRegisters)
|
||||||
{
|
{
|
||||||
|
static DMA_OPERATIONS HalDmaOperations = {
|
||||||
|
sizeof(DMA_OPERATIONS),
|
||||||
|
IopPutDmaAdapter,
|
||||||
|
IopAllocateCommonBuffer,
|
||||||
|
IopFreeCommonBuffer,
|
||||||
|
IopAllocateAdapterChannel,
|
||||||
|
IopFlushAdapterBuffers,
|
||||||
|
IopFreeAdapterChannel,
|
||||||
|
IopFreeMapRegisters,
|
||||||
|
IopMapTransfer,
|
||||||
|
IopGetDmaAlignment,
|
||||||
|
IopReadDmaCounter,
|
||||||
|
IopGetScatterGatherList,
|
||||||
|
IopPutScatterGatherList
|
||||||
|
};
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
ULONG ResultLength;
|
ULONG ResultLength;
|
||||||
BUS_INTERFACE_STANDARD BusInterface;
|
BUS_INTERFACE_STANDARD BusInterface;
|
||||||
|
@ -213,7 +229,7 @@ IoGetDmaAdapter(
|
||||||
if (DeviceDescription->InterfaceType == 0x0F /*PNPBus*/ ||
|
if (DeviceDescription->InterfaceType == 0x0F /*PNPBus*/ ||
|
||||||
DeviceDescription->InterfaceType == 0xFFFFFFFF)
|
DeviceDescription->InterfaceType == 0xFFFFFFFF)
|
||||||
{
|
{
|
||||||
memcpy(&PrivateDeviceDescription, DeviceDescription,
|
RtlCopyMemory(&PrivateDeviceDescription, DeviceDescription,
|
||||||
sizeof(DEVICE_DESCRIPTION));
|
sizeof(DEVICE_DESCRIPTION));
|
||||||
Status = IoGetDeviceProperty(PhysicalDeviceObject,
|
Status = IoGetDeviceProperty(PhysicalDeviceObject,
|
||||||
DevicePropertyLegacyBusType, sizeof(INTERFACE_TYPE),
|
DevicePropertyLegacyBusType, sizeof(INTERFACE_TYPE),
|
||||||
|
@ -231,7 +247,7 @@ IoGetDmaAdapter(
|
||||||
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_INTERFACE, &Stack);
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
Result = BusInterface.GetDmaAdapter(BusInterface.Context,
|
Result = BusInterface.GetDmaAdapter(BusInterface.Context,
|
||||||
|
@ -248,33 +264,15 @@ IoGetDmaAdapter(
|
||||||
|
|
||||||
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));
|
if (ResultInternal == 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 = &HalDmaOperations;
|
||||||
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;
|
ResultInternal->HalAdapter = HalAdapter;
|
||||||
|
|
||||||
return (PDMA_ADAPTER)ResultInternal;
|
return (PDMA_ADAPTER)ResultInternal;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: pnpmgr.c,v 1.37 2004/10/11 19:07:25 ekohl Exp $
|
/* $Id: pnpmgr.c,v 1.38 2004/10/19 19:37:45 navaraf Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -535,22 +535,22 @@ IopInitiatePnpIrp(
|
||||||
|
|
||||||
KeInitializeEvent(
|
KeInitializeEvent(
|
||||||
&Event,
|
&Event,
|
||||||
NotificationEvent,
|
NotificationEvent,
|
||||||
FALSE);
|
FALSE);
|
||||||
|
|
||||||
/* PNP IRPs are always initialized with a status code of
|
|
||||||
STATUS_NOT_IMPLEMENTED */
|
|
||||||
IoStatusBlock->Status = STATUS_NOT_IMPLEMENTED;
|
|
||||||
IoStatusBlock->Information = 0;
|
|
||||||
|
|
||||||
Irp = IoBuildSynchronousFsdRequest(
|
Irp = IoBuildSynchronousFsdRequest(
|
||||||
IRP_MJ_PNP,
|
IRP_MJ_PNP,
|
||||||
TopDeviceObject,
|
TopDeviceObject,
|
||||||
NULL,
|
NULL,
|
||||||
0,
|
0,
|
||||||
NULL,
|
NULL,
|
||||||
&Event,
|
&Event,
|
||||||
IoStatusBlock);
|
IoStatusBlock);
|
||||||
|
|
||||||
|
/* PNP IRPs are always initialized with a status code of
|
||||||
|
STATUS_NOT_IMPLEMENTED */
|
||||||
|
Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED;
|
||||||
|
Irp->IoStatus.Information = 0;
|
||||||
|
|
||||||
IrpSp = IoGetNextIrpStackLocation(Irp);
|
IrpSp = IoGetNextIrpStackLocation(Irp);
|
||||||
IrpSp->MinorFunction = MinorFunction;
|
IrpSp->MinorFunction = MinorFunction;
|
||||||
|
@ -832,7 +832,8 @@ IopSetDeviceInstanceData(HANDLE InstanceKey,
|
||||||
sizeof(ULONG));
|
sizeof(ULONG));
|
||||||
|
|
||||||
/* Set 'UINumber' value */
|
/* Set 'UINumber' value */
|
||||||
if (DeviceNode->CapabilityFlags->UINumber != (ULONG)-1)
|
if (DeviceNode->CapabilityFlags != NULL &&
|
||||||
|
DeviceNode->CapabilityFlags->UINumber != (ULONG)-1)
|
||||||
{
|
{
|
||||||
RtlInitUnicodeString(&KeyName,
|
RtlInitUnicodeString(&KeyName,
|
||||||
L"UINumber");
|
L"UINumber");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue