FsRtlOplockIsFastIoPossible(): Return TRUE (fast I/O is possible)
[reactos.git] / hal / halx86 / dma.c
1 /* $Id$
2  *
3  * COPYRIGHT:       See COPYING in the top level directory
4  * PROJECT:         ReactOS kernel
5  * FILE:            ntoskrnl/hal/x86/dma.c
6  * PURPOSE:         DMA functions
7  * PROGRAMMER:      David Welch (welch@mcmail.com)
8  * UPDATE HISTORY:
9  *                  Created 22/05/98
10  */
11
12 /* INCLUDES *****************************************************************/
13
14 #include <ddk/ntddk.h>
15
16 #include <internal/debug.h>
17 #include <hal.h>
18
19 ADAPTER_OBJECT AdapterObjects[] = {
20   { 0, (PVOID)0x87, (PVOID)0x1, (PVOID)0x0, { 0 }, NULL },
21   { 1, (PVOID)0x83, (PVOID)0x3, (PVOID)0x2, { 0 }, NULL },
22   { 2, (PVOID)0x81, (PVOID)0x5, (PVOID)0x4, { 0 }, NULL },
23   { 3, (PVOID)0x82, (PVOID)0x7, (PVOID)0x6, { 0 }, NULL } };
24
25
26 /* FUNCTIONS *****************************************************************/
27
28 PVOID STDCALL
29 HalAllocateCommonBuffer (PADAPTER_OBJECT                AdapterObject,
30                          ULONG                  Length,
31                          PPHYSICAL_ADDRESS      LogicalAddress,
32                          BOOLEAN                        CacheEnabled)
33 /*
34  * FUNCTION: Allocates memory that is visible to both the processor(s) and
35  * a dma device
36  * ARGUMENTS: 
37  *         AdapterObject = Adapter object representing the bus master or
38  *                         system dma controller
39  *         Length = Number of bytes to allocate
40  *         LogicalAddress = Logical address the driver can use to access the
41  *                          buffer 
42  *         CacheEnabled = Specifies if the memory can be cached
43  * RETURNS: The base virtual address of the memory allocated
44  *          NULL on failure
45  */
46 {
47    UNIMPLEMENTED;
48 }
49
50 BOOLEAN STDCALL
51 HalFlushCommonBuffer (ULONG     Unknown1,
52                       ULONG     Unknown2,
53                       ULONG     Unknown3,
54                       ULONG     Unknown4,
55                       ULONG     Unknown5,
56                       ULONG     Unknown6,
57                       ULONG     Unknown7,
58                       ULONG     Unknown8)
59 {
60    return TRUE;
61 }
62
63 VOID STDCALL
64 HalFreeCommonBuffer (PADAPTER_OBJECT            AdapterObject,
65                      ULONG                      Length,
66                      PHYSICAL_ADDRESS   LogicalAddress,
67                      PVOID                      VirtualAddress,
68                      BOOLEAN                    CacheEnabled)
69 {
70    MmFreeContiguousMemory(VirtualAddress);
71 }
72
73 PADAPTER_OBJECT STDCALL
74 HalGetAdapter (PDEVICE_DESCRIPTION      DeviceDescription,
75                PULONG                   NumberOfMapRegisters)
76 /*
77  * FUNCTION: Returns a pointer to an adapter object for the DMA device 
78  * defined in the device description structure
79  * ARGUMENTS:
80  *        DeviceDescription = Structure describing the attributes of the device
81  *        NumberOfMapRegisters (OUT) = Returns the maximum number of map
82  *                                     registers the device driver can
83  *                                     allocate for DMA transfer operations
84  * RETURNS: The allocated adapter object on success
85  *          NULL on failure
86  */
87 {
88   /* Validate parameters in device description, and return a pointer to
89      the adapter object for the requested dma channel */
90   if( DeviceDescription->Version != DEVICE_DESCRIPTION_VERSION )
91     return NULL;
92   if( DeviceDescription->Master )
93     return NULL;
94   if( DeviceDescription->ScatterGather )
95     return NULL;
96   if( DeviceDescription->AutoInitialize )
97     return NULL;
98   if( DeviceDescription->Dma32BitAddress )
99     return NULL;
100   if( DeviceDescription->InterfaceType != Isa )
101      return NULL;
102   /*  if( DeviceDescription->DmaWidth != Width8Bits )
103       return NULL;*/
104   *NumberOfMapRegisters = 0x10;
105   AdapterObjects[DeviceDescription->DmaChannel].Buffer = 0;
106   return &AdapterObjects[DeviceDescription->DmaChannel];
107 }
108
109 ULONG STDCALL
110 HalReadDmaCounter (PADAPTER_OBJECT      AdapterObject)
111 {
112    UNIMPLEMENTED;
113 }
114
115 /* EOF */