implemented HalAllocateCommonBuffer

svn path=/trunk/; revision=5974
This commit is contained in:
Vizzini 2003-09-04 06:45:38 +00:00
parent 02ee3e3600
commit f0496db9c5

View file

@ -1,10 +1,10 @@
/* $Id: dma.c,v 1.5 2003/08/20 04:18:31 royce Exp $ /* $Id: dma.c,v 1.6 2003/09/04 06:45:38 vizzini 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/hal/x86/dma.c * FILE: ntoskrnl/hal/x86/dma.c
* PURPOSE: DMA functions * PURPOSE: DMA functions
* PROGRAMMER: David Welch (welch@mcmail.com) * PROGRAMMERS: David Welch (welch@mcmail.com)
* UPDATE HISTORY: * UPDATE HISTORY:
* Created 22/05/98 * Created 22/05/98
*/ */
@ -26,10 +26,10 @@ ADAPTER_OBJECT AdapterObjects[] = {
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
PVOID STDCALL PVOID STDCALL
HalAllocateCommonBuffer (PADAPTER_OBJECT AdapterObject, HalAllocateCommonBuffer (PADAPTER_OBJECT AdapterObject,
ULONG Length, ULONG Length,
PPHYSICAL_ADDRESS LogicalAddress, PPHYSICAL_ADDRESS LogicalAddress,
BOOLEAN CacheEnabled) BOOLEAN CacheEnabled)
/* /*
* FUNCTION: Allocates memory that is visible to both the processor(s) and * FUNCTION: Allocates memory that is visible to both the processor(s) and
* a dma device * a dma device
@ -42,9 +42,25 @@ HalAllocateCommonBuffer (PADAPTER_OBJECT AdapterObject,
* CacheEnabled = Specifies if the memory can be cached * CacheEnabled = Specifies if the memory can be cached
* RETURNS: The base virtual address of the memory allocated * RETURNS: The base virtual address of the memory allocated
* NULL on failure * NULL on failure
* NOTES:
* CacheEnabled is ignored - it's all cache-disabled (like in NT)
*/ */
{ {
UNIMPLEMENTED; PHYSICAL_ADDRESS HighestAddress;
PVOID BaseAddress;
HighestAddress.u.HighPart = 0;
HighestAddress.u.LowPart = -1;
BaseAddress = MmAllocateContiguousMemory(Length, HighestAddress);
if (!BaseAddress)
return 0;
*LogicalAddress = MmGetPhysicalAddress(BaseAddress);
/* is this supposed to be tracked in the adapter object? */
return BaseAddress;
} }
BOOLEAN STDCALL BOOLEAN STDCALL
@ -83,12 +99,15 @@ HalGetAdapter (PDEVICE_DESCRIPTION DeviceDescription,
* allocate for DMA transfer operations * allocate for DMA transfer operations
* RETURNS: The allocated adapter object on success * RETURNS: The allocated adapter object on success
* NULL on failure * NULL on failure
* TODO:
* Figure out what to do with the commented-out cases
*/ */
{ {
/* Validate parameters in device description, and return a pointer to /* Validate parameters in device description, and return a pointer to
the adapter object for the requested dma channel */ the adapter object for the requested dma channel */
if( DeviceDescription->Version != DEVICE_DESCRIPTION_VERSION ) if( DeviceDescription->Version != DEVICE_DESCRIPTION_VERSION )
return NULL; return NULL;
/*
if( DeviceDescription->Master ) if( DeviceDescription->Master )
return NULL; return NULL;
if( DeviceDescription->ScatterGather ) if( DeviceDescription->ScatterGather )
@ -99,6 +118,7 @@ HalGetAdapter (PDEVICE_DESCRIPTION DeviceDescription,
return NULL; return NULL;
if( DeviceDescription->InterfaceType != Isa ) if( DeviceDescription->InterfaceType != Isa )
return NULL; return NULL;
*/
/* if( DeviceDescription->DmaWidth != Width8Bits ) /* if( DeviceDescription->DmaWidth != Width8Bits )
return NULL;*/ return NULL;*/
*NumberOfMapRegisters = 0x10; *NumberOfMapRegisters = 0x10;