ReactOS  0.4.14-dev-358-gbef841c
dma.c File Reference
#include <videoprt.h>
#include <debug.h>
Include dependency graph for dma.c:

Go to the source code of this file.

Classes

struct  VIP_DMA_ADAPTER
 
struct  DMA_START_CONTEXT
 

Macros

#define NDEBUG
 

Typedefs

typedef struct VIP_DMA_ADAPTERPVIP_DMA_ADAPTER
 
typedef struct DMA_START_CONTEXTPDMA_START_CONTEXT
 

Functions

PVOID NTAPI VideoPortAllocateCommonBuffer (IN PVOID HwDeviceExtension, IN PVP_DMA_ADAPTER VpDmaAdapter, IN ULONG DesiredLength, OUT PPHYSICAL_ADDRESS LogicalAddress, IN BOOLEAN CacheEnabled, PVOID Reserved)
 
VOID NTAPI VideoPortReleaseCommonBuffer (IN PVOID HwDeviceExtension, IN PVP_DMA_ADAPTER VpDmaAdapter, IN ULONG Length, IN PHYSICAL_ADDRESS LogicalAddress, IN PVOID VirtualAddress, IN BOOLEAN CacheEnabled)
 
VOID NTAPI VideoPortPutDmaAdapter (IN PVOID HwDeviceExtension, IN PVP_DMA_ADAPTER VpDmaAdapter)
 
PVP_DMA_ADAPTER NTAPI VideoPortGetDmaAdapter (IN PVOID HwDeviceExtension, IN PVP_DEVICE_DESCRIPTION VpDeviceExtension)
 
VOID NTAPI VideoPortFreeCommonBuffer (IN PVOID HwDeviceExtension, IN ULONG Length, IN PVOID VirtualAddress, IN PHYSICAL_ADDRESS LogicalAddress, IN BOOLEAN CacheEnabled)
 
PVOID NTAPI VideoPortGetCommonBuffer (IN PVOID HwDeviceExtension, IN ULONG DesiredLength, IN ULONG Alignment, OUT PPHYSICAL_ADDRESS LogicalAddress, OUT PULONG pActualLength, IN BOOLEAN CacheEnabled)
 
BOOLEAN NTAPI VideoPortUnmapDmaMemory (PVOID HwDeviceExtension, PVOID VirtualAddress, HANDLE ProcessHandle, PDMA BoardMemoryHandle)
 
PDMA NTAPI VideoPortMapDmaMemory (IN PVOID HwDeviceExtension, IN PVIDEO_REQUEST_PACKET pVrp, IN PHYSICAL_ADDRESS BoardAddress, IN PULONG Length, IN PULONG InIoSpace, IN PVOID MappedUserEvent, IN PVOID DisplayDriverEvent, IN OUT PVOID *VirtualAddress)
 
VOID NTAPI VideoPortSetDmaContext (IN PVOID HwDeviceExtension, OUT PDMA pDma, IN PVOID InstanceContext)
 
BOOLEAN NTAPI VideoPortSignalDmaComplete (IN PVOID HwDeviceExtension, IN PDMA pDmaHandle)
 
BOOLEAN NTAPI SyncScatterRoutine (IN PVOID Context)
 
VOID NTAPI ScatterAdapterControl (IN PDEVICE_OBJECT *DeviceObject, IN PIRP *Irp, IN PSCATTER_GATHER_LIST ScatterGather, IN PVOID Context)
 
VP_STATUS NTAPI VideoPortStartDma (IN PVOID HwDeviceExtension, IN PVP_DMA_ADAPTER VpDmaAdapter, IN PVOID Mdl, IN ULONG Offset, IN OUT PULONG pLength, IN PEXECUTE_DMA ExecuteDmaRoutine, IN PVOID Context, IN BOOLEAN WriteToDevice)
 
PVOID NTAPI VideoPortGetDmaContext (IN PVOID HwDeviceExtension, IN PDMA pDma)
 
PDMA NTAPI VideoPortDoDma (IN PVOID HwDeviceExtension, IN PDMA pDma, IN DMA_FLAGS DmaFlags)
 
PDMA NTAPI VideoPortAssociateEventsWithDmaHandle (IN PVOID HwDeviceExtension, IN OUT PVIDEO_REQUEST_PACKET pVrp, IN PVOID MappedUserEvent, IN PVOID DisplayDriverEvent)
 
VP_STATUS NTAPI VideoPortCompleteDma (IN PVOID HwDeviceExtension, IN PVP_DMA_ADAPTER VpDmaAdapter, IN PVP_SCATTER_GATHER_LIST VpScatterGather, IN BOOLEAN WriteToDevice)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 13 of file dma.c.

Typedef Documentation

◆ PDMA_START_CONTEXT

◆ PVIP_DMA_ADAPTER

Function Documentation

◆ ScatterAdapterControl()

VOID NTAPI ScatterAdapterControl ( IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp,
IN PSCATTER_GATHER_LIST  ScatterGather,
IN PVOID  Context 
)

Definition at line 336 of file dma.c.

341 {
343 
344  StartContext->ScatterGatherList = ScatterGather;
345 
347  ExFreePool(StartContext);
348 }
PSCATTER_GATHER_LIST ScatterGatherList
Definition: dma.c:28
VPAPI BOOLEAN NTAPI VideoPortSynchronizeExecution(IN PVOID HwDeviceExtension, IN VIDEO_SYNCHRONIZE_PRIORITY Priority, IN PMINIPORT_SYNCHRONIZE_ROUTINE SynchronizeRoutine, IN PVOID Context)
PVOID HwDeviceExtension
Definition: dma.c:27
_In_ struct _IRP _In_ struct _SCATTER_GATHER_LIST * ScatterGather
Definition: iotypes.h:2259
struct DMA_START_CONTEXT * PDMA_START_CONTEXT
BOOLEAN NTAPI SyncScatterRoutine(IN PVOID Context)
Definition: dma.c:325
#define ExFreePool(addr)
Definition: env_spec_w32.h:352

Referenced by VideoPortStartDma().

◆ SyncScatterRoutine()

BOOLEAN NTAPI SyncScatterRoutine ( IN PVOID  Context)

Definition at line 325 of file dma.c.

327 {
329 
330  StartContext->ExecuteDmaRoutine(StartContext->HwDeviceExtension, StartContext->VpDmaAdapter, (PVP_SCATTER_GATHER_LIST)StartContext->ScatterGatherList, StartContext->Context);
331  return TRUE;
332 }
PSCATTER_GATHER_LIST ScatterGatherList
Definition: dma.c:28
#define TRUE
Definition: types.h:120
PVOID Context
Definition: dma.c:30
PVP_DMA_ADAPTER VpDmaAdapter
Definition: dma.c:31
PVOID HwDeviceExtension
Definition: dma.c:27
PEXECUTE_DMA ExecuteDmaRoutine
Definition: dma.c:29
struct DMA_START_CONTEXT * PDMA_START_CONTEXT

Referenced by ScatterAdapterControl().

◆ VideoPortAllocateCommonBuffer()

PVOID NTAPI VideoPortAllocateCommonBuffer ( IN PVOID  HwDeviceExtension,
IN PVP_DMA_ADAPTER  VpDmaAdapter,
IN ULONG  DesiredLength,
OUT PPHYSICAL_ADDRESS  LogicalAddress,
IN BOOLEAN  CacheEnabled,
PVOID  Reserved 
)

Definition at line 43 of file dma.c.

49 {
50  PVIP_DMA_ADAPTER Adapter = (PVIP_DMA_ADAPTER)VpDmaAdapter;
51 
52  /* check for valid arguments */
53  if (!Adapter || !Adapter->Adapter)
54  {
55  /* invalid parameter */
56  return NULL;
57  }
58 
59  /* allocate common buffer */
60  return Adapter->Adapter->DmaOperations->AllocateCommonBuffer(Adapter->Adapter, DesiredLength, LogicalAddress, CacheEnabled);
61 }
struct _DMA_OPERATIONS * DmaOperations
Definition: iotypes.h:2187
smooth NULL
Definition: ftsmooth.c:416
struct VIP_DMA_ADAPTER * PVIP_DMA_ADAPTER
PDMA_ADAPTER Adapter
Definition: dma.c:19

Referenced by VideoPortGetCommonBuffer().

◆ VideoPortAssociateEventsWithDmaHandle()

PDMA NTAPI VideoPortAssociateEventsWithDmaHandle ( IN PVOID  HwDeviceExtension,
IN OUT PVIDEO_REQUEST_PACKET  pVrp,
IN PVOID  MappedUserEvent,
IN PVOID  DisplayDriverEvent 
)

Definition at line 439 of file dma.c.

443 {
444  /* Deprecated */
445  return NULL;
446 }
smooth NULL
Definition: ftsmooth.c:416

◆ VideoPortCompleteDma()

VP_STATUS NTAPI VideoPortCompleteDma ( IN PVOID  HwDeviceExtension,
IN PVP_DMA_ADAPTER  VpDmaAdapter,
IN PVP_SCATTER_GATHER_LIST  VpScatterGather,
IN BOOLEAN  WriteToDevice 
)

Definition at line 453 of file dma.c.

457 {
458  KIRQL OldIrql;
459  PVIP_DMA_ADAPTER Adapter = (PVIP_DMA_ADAPTER)VpDmaAdapter;
460 
462  Adapter->Adapter->DmaOperations->PutScatterGatherList(Adapter->Adapter, (PSCATTER_GATHER_LIST)VpScatterGather, WriteToDevice);
464 
465  return NO_ERROR;
466 }
#define KeRaiseIrql(irql, oldIrql)
Definition: env_spec_w32.h:597
#define KeLowerIrql(oldIrql)
Definition: env_spec_w32.h:602
#define NO_ERROR
Definition: dderror.h:5
struct _DMA_OPERATIONS * DmaOperations
Definition: iotypes.h:2187
UCHAR KIRQL
Definition: env_spec_w32.h:591
struct VIP_DMA_ADAPTER * PVIP_DMA_ADAPTER
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
PDMA_ADAPTER Adapter
Definition: dma.c:19
struct _SCATTER_GATHER_LIST * PSCATTER_GATHER_LIST
Definition: iotypes.h:2096

◆ VideoPortDoDma()

PDMA NTAPI VideoPortDoDma ( IN PVOID  HwDeviceExtension,
IN PDMA  pDma,
IN DMA_FLAGS  DmaFlags 
)

Definition at line 426 of file dma.c.

429 {
430  /* Deprecated */
431  return NULL;
432 }
smooth NULL
Definition: ftsmooth.c:416

◆ VideoPortFreeCommonBuffer()

VOID NTAPI VideoPortFreeCommonBuffer ( IN PVOID  HwDeviceExtension,
IN ULONG  Length,
IN PVOID  VirtualAddress,
IN PHYSICAL_ADDRESS  LogicalAddress,
IN BOOLEAN  CacheEnabled 
)

Definition at line 187 of file dma.c.

192 {
193  PVIP_DMA_ADAPTER VpDmaAdapter;
194  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
195 
196  /* sanity check */
197  ASSERT(!IsListEmpty(&DeviceExtension->DmaAdapterList));
198 
199  /* grab first dma adapter */
200  VpDmaAdapter = (PVIP_DMA_ADAPTER)CONTAINING_RECORD(DeviceExtension->DmaAdapterList.Flink, VIP_DMA_ADAPTER, Entry);
201 
202  /* sanity checks */
203  ASSERT(VpDmaAdapter->HwDeviceExtension == HwDeviceExtension);
204  ASSERT(VpDmaAdapter->Adapter != NULL);
205  ASSERT(VpDmaAdapter->MapRegisters != 0);
206 
207  VideoPortReleaseCommonBuffer(HwDeviceExtension, (PVP_DMA_ADAPTER)VpDmaAdapter, Length, LogicalAddress, VirtualAddress, CacheEnabled);
208 }
PVOID HwDeviceExtension
Definition: dma.c:21
#define VIDEO_PORT_GET_DEVICE_EXTENSION(MiniportExtension)
Definition: videoprt.h:133
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
smooth NULL
Definition: ftsmooth.c:416
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
struct __VP_DMA_ADAPTER * PVP_DMA_ADAPTER
Definition: video.h:159
struct VIP_DMA_ADAPTER * PVIP_DMA_ADAPTER
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
_In_ ULONG _In_ BOOLEAN _Must_inspect_result_ PVOID * VirtualAddress
Definition: ndis.h:3791
ULONG MapRegisters
Definition: dma.c:20
VOID NTAPI VideoPortReleaseCommonBuffer(IN PVOID HwDeviceExtension, IN PVP_DMA_ADAPTER VpDmaAdapter, IN ULONG Length, IN PHYSICAL_ADDRESS LogicalAddress, IN PVOID VirtualAddress, IN BOOLEAN CacheEnabled)
Definition: dma.c:68
PDMA_ADAPTER Adapter
Definition: dma.c:19
base of all file and directory entries
Definition: entries.h:82

◆ VideoPortGetCommonBuffer()

PVOID NTAPI VideoPortGetCommonBuffer ( IN PVOID  HwDeviceExtension,
IN ULONG  DesiredLength,
IN ULONG  Alignment,
OUT PPHYSICAL_ADDRESS  LogicalAddress,
OUT PULONG  pActualLength,
IN BOOLEAN  CacheEnabled 
)

Definition at line 215 of file dma.c.

221 {
222  PVOID Result;
223  PVIP_DMA_ADAPTER VpDmaAdapter;
224  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
225 
226  /* maximum palette size */
227  if (DesiredLength > 262144)
228  {
229  /* size exceeded */
230  return NULL;
231  }
232 
233  if (IsListEmpty(&DeviceExtension->DmaAdapterList))
234  {
235  /* no adapter available */
236  return NULL;
237  }
238 
239  /* grab first dma adapter */
240  VpDmaAdapter = (PVIP_DMA_ADAPTER)CONTAINING_RECORD(DeviceExtension->DmaAdapterList.Flink, VIP_DMA_ADAPTER, Entry);
241 
242  /* sanity checks */
243  ASSERT(VpDmaAdapter->HwDeviceExtension == HwDeviceExtension);
244  ASSERT(VpDmaAdapter->Adapter != NULL);
245  ASSERT(VpDmaAdapter->MapRegisters != 0);
246 
247  /* allocate common buffer */
248  Result = VideoPortAllocateCommonBuffer(HwDeviceExtension, (PVP_DMA_ADAPTER)VpDmaAdapter, DesiredLength, LogicalAddress, CacheEnabled, NULL);
249 
250  if (Result)
251  {
252  /* store length */
253  *pActualLength = DesiredLength;
254  }
255  else
256  {
257  /* failed to allocate common buffer */
258  *pActualLength = 0;
259  }
260 
261  return Result;
262 }
PVOID HwDeviceExtension
Definition: dma.c:21
#define VIDEO_PORT_GET_DEVICE_EXTENSION(MiniportExtension)
Definition: videoprt.h:133
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
smooth NULL
Definition: ftsmooth.c:416
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
PVOID NTAPI VideoPortAllocateCommonBuffer(IN PVOID HwDeviceExtension, IN PVP_DMA_ADAPTER VpDmaAdapter, IN ULONG DesiredLength, OUT PPHYSICAL_ADDRESS LogicalAddress, IN BOOLEAN CacheEnabled, PVOID Reserved)
Definition: dma.c:43
struct __VP_DMA_ADAPTER * PVP_DMA_ADAPTER
Definition: video.h:159
struct VIP_DMA_ADAPTER * PVIP_DMA_ADAPTER
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
ULONG MapRegisters
Definition: dma.c:20
PDMA_ADAPTER Adapter
Definition: dma.c:19
base of all file and directory entries
Definition: entries.h:82

◆ VideoPortGetDmaAdapter()

PVP_DMA_ADAPTER NTAPI VideoPortGetDmaAdapter ( IN PVOID  HwDeviceExtension,
IN PVP_DEVICE_DESCRIPTION  VpDeviceExtension 
)

Definition at line 120 of file dma.c.

122 {
124  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
126  PVIP_DMA_ADAPTER Adapter;
127  PDMA_ADAPTER DmaAdapter;
128 
129  /* allocate private adapter structure */
130  Adapter = ExAllocatePool(NonPagedPool, sizeof(VIP_DMA_ADAPTER));
131  if (!Adapter)
132  {
133  /* failed to allocate adapter structure */
134  return NULL;
135  }
136 
137  /* Zero the structure */
139  sizeof(DEVICE_DESCRIPTION));
140 
141  /* Initialize the structure */
146 
147  /* Copy data from caller's device extension */
148  DeviceDescription.ScatterGather = VpDeviceExtension->ScatterGather;
149  DeviceDescription.Dma32BitAddresses = VpDeviceExtension->Dma32BitAddresses;
150  DeviceDescription.Dma64BitAddresses = VpDeviceExtension->Dma64BitAddresses;
151  DeviceDescription.MaximumLength = VpDeviceExtension->MaximumLength;
152 
153  /* Copy data from the internal device extension */
154  DeviceDescription.BusNumber = DeviceExtension->SystemIoBusNumber;
156 
157  /* acquire dma adapter */
159  if (!DmaAdapter)
160  {
161  /* failed to acquire dma */
162  ExFreePool(Adapter);
163  return NULL;
164  }
165 
166  /* store dma adapter */
167  Adapter->Adapter = DmaAdapter;
168 
169  /* store map register count */
171 
172  /* store hw device extension */
173  Adapter->HwDeviceExtension = HwDeviceExtension;
174 
175  /* store in dma adapter list */
176  InsertTailList(&DeviceExtension->DmaAdapterList, &Adapter->Entry);
177 
178  /* return result */
179  return (PVP_DMA_ADAPTER)Adapter;
180 }
#define TRUE
Definition: types.h:120
_Out_ PULONG NumberOfMapRegisters
Definition: halfuncs.h:209
PDMA_ADAPTER NTAPI IoGetDmaAdapter(IN PDEVICE_OBJECT PhysicalDeviceObject, IN PDEVICE_DESCRIPTION DeviceDescription, IN OUT PULONG NumberOfMapRegisters)
Definition: pnpdma.c:23
PVOID HwDeviceExtension
Definition: dma.c:21
DMA_SPEED DmaSpeed
Definition: iotypes.h:2038
LIST_ENTRY Entry
Definition: dma.c:18
#define VIDEO_PORT_GET_DEVICE_EXTENSION(MiniportExtension)
Definition: videoprt.h:133
#define InsertTailList(ListHead, Entry)
#define DEVICE_DESCRIPTION_VERSION
Definition: iotypes.h:2020
PDEVICE_OBJECT PhysicalDeviceObject
Definition: videoprt.h:84
smooth NULL
Definition: ftsmooth.c:416
BOOLEAN Dma32BitAddresses
Definition: iotypes.h:2030
BOOLEAN Dma64BitAddresses
Definition: iotypes.h:2033
_Must_inspect_result_ _In_ PDEVICE_DESCRIPTION DeviceDescription
Definition: iofuncs.h:1015
struct __VP_DMA_ADAPTER * PVP_DMA_ADAPTER
Definition: video.h:159
BOOLEAN ScatterGather
Definition: iotypes.h:2027
DMA_WIDTH DmaWidth
Definition: iotypes.h:2037
#define ExAllocatePool(type, size)
Definition: fbtusb.h:44
ULONG MapRegisters
Definition: dma.c:20
PDMA_ADAPTER Adapter
Definition: dma.c:19
INTERFACE_TYPE InterfaceType
Definition: iotypes.h:2036
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
INTERFACE_TYPE AdapterInterfaceType
Definition: videoprt.h:95
#define ExFreePool(addr)
Definition: env_spec_w32.h:352

◆ VideoPortGetDmaContext()

PVOID NTAPI VideoPortGetDmaContext ( IN PVOID  HwDeviceExtension,
IN PDMA  pDma 
)

Definition at line 414 of file dma.c.

416 {
417  /* Deprecated */
418  return NULL;
419 }
smooth NULL
Definition: ftsmooth.c:416

◆ VideoPortMapDmaMemory()

PDMA NTAPI VideoPortMapDmaMemory ( IN PVOID  HwDeviceExtension,
IN PVIDEO_REQUEST_PACKET  pVrp,
IN PHYSICAL_ADDRESS  BoardAddress,
IN PULONG  Length,
IN PULONG  InIoSpace,
IN PVOID  MappedUserEvent,
IN PVOID  DisplayDriverEvent,
IN OUT PVOID VirtualAddress 
)

Definition at line 284 of file dma.c.

292 {
293  /* Deprecated */
294  return NULL;
295 }
smooth NULL
Definition: ftsmooth.c:416

◆ VideoPortPutDmaAdapter()

VOID NTAPI VideoPortPutDmaAdapter ( IN PVOID  HwDeviceExtension,
IN PVP_DMA_ADAPTER  VpDmaAdapter 
)

Definition at line 93 of file dma.c.

95 {
96  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
97  PVIP_DMA_ADAPTER Adapter = (PVIP_DMA_ADAPTER)VpDmaAdapter;
98 
99  /* get hw device extension */
100  DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
101 
102  /* sanity check */
103  ASSERT(!IsListEmpty(&DeviceExtension->DmaAdapterList));
104 
105  /* remove dma adapter from list */
106  RemoveEntryList(&Adapter->Entry);
107 
108  /* release dma adapter */
109  Adapter->Adapter->DmaOperations->PutDmaAdapter(Adapter->Adapter);
110 
111  /* free memory */
112  ExFreePool(Adapter);
113 }
LIST_ENTRY Entry
Definition: dma.c:18
#define VIDEO_PORT_GET_DEVICE_EXTENSION(MiniportExtension)
Definition: videoprt.h:133
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
struct _DMA_OPERATIONS * DmaOperations
Definition: iotypes.h:2187
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
struct VIP_DMA_ADAPTER * PVIP_DMA_ADAPTER
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
PDMA_ADAPTER Adapter
Definition: dma.c:19
#define ExFreePool(addr)
Definition: env_spec_w32.h:352

◆ VideoPortReleaseCommonBuffer()

VOID NTAPI VideoPortReleaseCommonBuffer ( IN PVOID  HwDeviceExtension,
IN PVP_DMA_ADAPTER  VpDmaAdapter,
IN ULONG  Length,
IN PHYSICAL_ADDRESS  LogicalAddress,
IN PVOID  VirtualAddress,
IN BOOLEAN  CacheEnabled 
)

Definition at line 68 of file dma.c.

74 {
75  PVIP_DMA_ADAPTER Adapter = (PVIP_DMA_ADAPTER)VpDmaAdapter;
76 
77  /* check for valid arguments */
78  if (!Adapter || !Adapter->Adapter)
79  {
80  /* invalid parameter */
81  return;
82  }
83 
84  /* release common buffer */
85  Adapter->Adapter->DmaOperations->FreeCommonBuffer(Adapter->Adapter, Length, LogicalAddress, VirtualAddress, CacheEnabled);
86 }
struct _DMA_OPERATIONS * DmaOperations
Definition: iotypes.h:2187
struct VIP_DMA_ADAPTER * PVIP_DMA_ADAPTER
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
_In_ ULONG _In_ BOOLEAN _Must_inspect_result_ PVOID * VirtualAddress
Definition: ndis.h:3791
PDMA_ADAPTER Adapter
Definition: dma.c:19

Referenced by VideoPortFreeCommonBuffer().

◆ VideoPortSetDmaContext()

VOID NTAPI VideoPortSetDmaContext ( IN PVOID  HwDeviceExtension,
OUT PDMA  pDma,
IN PVOID  InstanceContext 
)

Definition at line 302 of file dma.c.

305 {
306  /* Deprecated */
307  return;
308 }

◆ VideoPortSignalDmaComplete()

BOOLEAN NTAPI VideoPortSignalDmaComplete ( IN PVOID  HwDeviceExtension,
IN PDMA  pDmaHandle 
)

Definition at line 315 of file dma.c.

317 {
318  /* Deprecated */
319  return FALSE;
320 }

◆ VideoPortStartDma()

VP_STATUS NTAPI VideoPortStartDma ( IN PVOID  HwDeviceExtension,
IN PVP_DMA_ADAPTER  VpDmaAdapter,
IN PVOID  Mdl,
IN ULONG  Offset,
IN OUT PULONG  pLength,
IN PEXECUTE_DMA  ExecuteDmaRoutine,
IN PVOID  Context,
IN BOOLEAN  WriteToDevice 
)

Definition at line 355 of file dma.c.

363 {
365  KIRQL OldIrql;
366  PDMA_START_CONTEXT StartContext;
367  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
368  PVIP_DMA_ADAPTER Adapter = (PVIP_DMA_ADAPTER)VpDmaAdapter;
369 
370  StartContext = ExAllocatePool(NonPagedPool, sizeof(DMA_START_CONTEXT));
371  if (!StartContext)
372  {
374  }
375 
376  StartContext->Context = Context;
377  StartContext->ExecuteDmaRoutine = ExecuteDmaRoutine;
378  StartContext->HwDeviceExtension = HwDeviceExtension;
379  StartContext->VpDmaAdapter = VpDmaAdapter;
380 
382 
383  Status = Adapter->Adapter->DmaOperations->GetScatterGatherList(Adapter->Adapter,
384  DeviceExtension->PhysicalDeviceObject,
385  Mdl,
387  MmGetMdlByteCount((PMDL)Mdl),
389  StartContext,
390  WriteToDevice);
391 
393 
394  if (!NT_SUCCESS(Status))
395  {
396  *pLength = 0;
397  ExFreePool(StartContext);
399  }
400  else
401  {
402  Status = NO_ERROR;
403  }
404 
405  /* Return status */
406  return Status;
407 }
#define KeRaiseIrql(irql, oldIrql)
Definition: env_spec_w32.h:597
#define KeLowerIrql(oldIrql)
Definition: env_spec_w32.h:602
VOID NTAPI ScatterAdapterControl(IN PDEVICE_OBJECT *DeviceObject, IN PIRP *Irp, IN PSCATTER_GATHER_LIST ScatterGather, IN PVOID Context)
Definition: dma.c:336
LONG NTSTATUS
Definition: precomp.h:26
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define VIDEO_PORT_GET_DEVICE_EXTENSION(MiniportExtension)
Definition: videoprt.h:133
#define NO_ERROR
Definition: dderror.h:5
struct _DMA_OPERATIONS * DmaOperations
Definition: iotypes.h:2187
UCHAR KIRQL
Definition: env_spec_w32.h:591
PVOID Context
Definition: dma.c:30
PDEVICE_OBJECT PhysicalDeviceObject
Definition: videoprt.h:84
PVP_DMA_ADAPTER VpDmaAdapter
Definition: dma.c:31
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
struct VIP_DMA_ADAPTER * PVIP_DMA_ADAPTER
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
#define ExAllocatePool(type, size)
Definition: fbtusb.h:44
Status
Definition: gdiplustypes.h:24
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
PDMA_ADAPTER Adapter
Definition: dma.c:19
DRIVER_LIST_CONTROL * PDRIVER_LIST_CONTROL
Definition: iotypes.h:2261
#define MmGetMdlByteCount(_Mdl)
PVOID HwDeviceExtension
Definition: dma.c:27
PEXECUTE_DMA ExecuteDmaRoutine
Definition: dma.c:29
struct tagContext Context
Definition: acpixf.h:1030
#define MmGetSystemAddressForMdl(Mdl)
#define ExFreePool(addr)
Definition: env_spec_w32.h:352

◆ VideoPortUnmapDmaMemory()

BOOLEAN NTAPI VideoPortUnmapDmaMemory ( PVOID  HwDeviceExtension,
PVOID  VirtualAddress,
HANDLE  ProcessHandle,
PDMA  BoardMemoryHandle 
)

Definition at line 269 of file dma.c.

274 {
275  /* Deprecated */
276  return FALSE;
277 }