From 892557fccc779fe9cf3abb3a7b3234b912e7bb53 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Thu, 11 Sep 2003 11:45:28 +0000 Subject: [PATCH] Added Adapter-Object used for PCI-Bus-Master-DMA. svn path=/trunk/; revision=6045 --- reactos/hal/halx86/dma.c | 42 +++++++++++++++++++++++--------- reactos/hal/halx86/include/hal.h | 2 ++ 2 files changed, 32 insertions(+), 12 deletions(-) diff --git a/reactos/hal/halx86/dma.c b/reactos/hal/halx86/dma.c index 3f318c7552e..a2e40615b88 100644 --- a/reactos/hal/halx86/dma.c +++ b/reactos/hal/halx86/dma.c @@ -1,4 +1,4 @@ -/* $Id: dma.c,v 1.6 2003/09/04 06:45:38 vizzini Exp $ +/* $Id: dma.c,v 1.7 2003/09/11 11:45:28 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -16,11 +16,14 @@ #include #include -ADAPTER_OBJECT AdapterObjects[] = { - { 0, (PVOID)0x87, (PVOID)0x1, (PVOID)0x0, 0, NULL }, - { 1, (PVOID)0x83, (PVOID)0x3, (PVOID)0x2, 0, NULL }, - { 2, (PVOID)0x81, (PVOID)0x5, (PVOID)0x4, 0, NULL }, - { 3, (PVOID)0x82, (PVOID)0x7, (PVOID)0x6, 0, NULL } }; +ADAPTER_OBJECT IsaSlaveAdapterObjects[] = { + { Isa, FALSE, 0, (PVOID)0x87, (PVOID)0x1, (PVOID)0x0, 0, NULL }, + { Isa, FALSE, 1, (PVOID)0x83, (PVOID)0x3, (PVOID)0x2, 0, NULL }, + { Isa, FALSE, 2, (PVOID)0x81, (PVOID)0x5, (PVOID)0x4, 0, NULL }, + { Isa, FALSE, 3, (PVOID)0x82, (PVOID)0x7, (PVOID)0x6, 0, NULL } }; + +ADAPTER_OBJECT PciBusMasterAdapterObjects[] = { + { PCIBus, TRUE, 0, (PVOID)0, (PVOID)0, (PVOID)0x0, 0, NULL } }; /* FUNCTIONS *****************************************************************/ @@ -48,9 +51,17 @@ HalAllocateCommonBuffer (PADAPTER_OBJECT AdapterObject, { PHYSICAL_ADDRESS HighestAddress; PVOID BaseAddress; - + HighestAddress.u.HighPart = 0; - HighestAddress.u.LowPart = -1; + if (AdapterObject->InterfaceType == Isa || + (AdapterObject->InterfaceType == MicroChannel && AdapterObject->Master == FALSE)) + { + HighestAddress.u.LowPart = 0x00FFFFFF; /* 24Bit: 16MB address range */ + } + else + { + HighestAddress.u.LowPart = 0xFFFFFFFF; /* 32Bit: 4GB address range */ + } BaseAddress = MmAllocateContiguousMemory(Length, HighestAddress); if (!BaseAddress) @@ -58,8 +69,6 @@ HalAllocateCommonBuffer (PADAPTER_OBJECT AdapterObject, *LogicalAddress = MmGetPhysicalAddress(BaseAddress); - /* is this supposed to be tracked in the adapter object? */ - return BaseAddress; } @@ -107,6 +116,15 @@ HalGetAdapter (PDEVICE_DESCRIPTION DeviceDescription, the adapter object for the requested dma channel */ if( DeviceDescription->Version != DEVICE_DESCRIPTION_VERSION ) return NULL; + + if (DeviceDescription->InterfaceType == PCIBus) + { + if (DeviceDescription->Master == FALSE) + return NULL; + + return &PciBusMasterAdapterObjects[0]; + } + /* if( DeviceDescription->Master ) return NULL; @@ -122,8 +140,8 @@ HalGetAdapter (PDEVICE_DESCRIPTION DeviceDescription, /* if( DeviceDescription->DmaWidth != Width8Bits ) return NULL;*/ *NumberOfMapRegisters = 0x10; - AdapterObjects[DeviceDescription->DmaChannel].Buffer = 0; - return &AdapterObjects[DeviceDescription->DmaChannel]; + IsaSlaveAdapterObjects[DeviceDescription->DmaChannel].Buffer = 0; + return &IsaSlaveAdapterObjects[DeviceDescription->DmaChannel]; } ULONG STDCALL diff --git a/reactos/hal/halx86/include/hal.h b/reactos/hal/halx86/include/hal.h index 499e91f4a70..fb2564998cf 100644 --- a/reactos/hal/halx86/include/hal.h +++ b/reactos/hal/halx86/include/hal.h @@ -34,6 +34,8 @@ VOID HalpInitPciBus (VOID); VOID HalpStartEnumerator (VOID); struct _ADAPTER_OBJECT { + INTERFACE_TYPE InterfaceType; + BOOLEAN Master; int Channel; PVOID PagePort; PVOID CountPort;