Data Structures |
| struct | PSCATTER_GATHER_CONTEXT |
Defines |
| #define | NDEBUG |
| #define | MAX_SG_ELEMENTS 0x10 |
| #define | MAX_MAP_REGISTERS 64 |
| #define | TAG_DMA ' AMD' |
Functions |
| VOID INIT_FUNCTION | HalpInitDma (VOID) |
|
Get the maximum physical address acceptable by the device represented by the passed DMA adapter.
|
| PHYSICAL_ADDRESS NTAPI | HalpGetAdapterMaximumPhysicalAddress (IN PADAPTER_OBJECT AdapterObject) |
|
Allocate initial, or additional, map buffers for DMA master adapter.
- Parameters:
-
| MasterAdapter | DMA master adapter to allocate buffers for. |
| SizeOfMapBuffers | Size of the map buffers to allocate (not including the size already allocated). |
|
| BOOLEAN NTAPI | HalpGrowMapBuffers (IN PADAPTER_OBJECT AdapterObject, IN ULONG SizeOfMapBuffers) |
|
Helper routine to allocate and initialize master adapter object and it's associated map register buffers.
- See also:
- HalpInitDma
|
| PADAPTER_OBJECT NTAPI | HalpDmaAllocateMasterAdapter (VOID) |
|
Helper routine of HalGetAdapter. Allocate child adapter object and fill out some basic fields.
- See also:
- HalGetAdapter
|
| PADAPTER_OBJECT NTAPI | HalpDmaAllocateChildAdapter (IN ULONG NumberOfMapRegisters, IN PDEVICE_DESCRIPTION DeviceDescription) |
|
Setup DMA modes and extended modes for (E)ISA DMA adapter object.
|
| BOOLEAN NTAPI | HalpDmaInitializeEisaAdapter (IN PADAPTER_OBJECT AdapterObject, IN PDEVICE_DESCRIPTION DeviceDescription) |
|
Allocate an adapter object for DMA device.
- Parameters:
-
| DeviceDescription | Structure describing the attributes of the device. |
| NumberOfMapRegisters | On return filled with the maximum number of map registers the device driver can allocate for DMA transfer operations. |
- Returns:
- The DMA adapter on success, NULL otherwise.
|
| PADAPTER_OBJECT NTAPI | HalGetAdapter (IN PDEVICE_DESCRIPTION DeviceDescription, OUT PULONG NumberOfMapRegisters) |
|
Internal routine to allocate PnP DMA adapter object. It's exported through HalDispatchTable and used by IoGetDmaAdapter.
- See also:
- HalGetAdapter
|
| PDMA_ADAPTER NTAPI | HalpGetDmaAdapter (IN PVOID Context, IN PDEVICE_DESCRIPTION DeviceDescription, OUT PULONG NumberOfMapRegisters) |
|
Internal routine to free DMA adapter and resources for reuse. It's exported using the DMA_OPERATIONS interface by HalGetAdapter.
- See also:
- HalGetAdapter
|
| VOID NTAPI | HalPutDmaAdapter (IN PADAPTER_OBJECT AdapterObject) |
|
Allocates memory that is visible to both the processor(s) and the DMA device.
- Parameters:
-
| AdapterObject | Adapter object representing the bus master or system dma controller. |
| Length | Number of bytes to allocate. |
| LogicalAddress | Logical address the driver can use to access the buffer. |
| CacheEnabled | Specifies if the memory can be cached. |
- Returns:
- The base virtual address of the memory allocated or NULL on failure.
- See also:
- HalFreeCommonBuffer
|
| PVOID NTAPI | HalAllocateCommonBuffer (IN PADAPTER_OBJECT AdapterObject, IN ULONG Length, IN PPHYSICAL_ADDRESS LogicalAddress, IN BOOLEAN CacheEnabled) |
|
Free common buffer allocated with HalAllocateCommonBuffer.
- See also:
- HalAllocateCommonBuffer
|
| VOID NTAPI | HalFreeCommonBuffer (IN PADAPTER_OBJECT AdapterObject, IN ULONG Length, IN PHYSICAL_ADDRESS LogicalAddress, IN PVOID VirtualAddress, IN BOOLEAN CacheEnabled) |
| IO_ALLOCATION_ACTION NTAPI | HalpScatterGatherAdapterControl (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID MapRegisterBase, IN PVOID Context) |
|
Creates a scatter-gather list to be using in scatter/gather DMA
- Parameters:
-
| AdapterObject | Adapter object representing the bus master or system dma controller. |
| DeviceObject | The device target for DMA. |
| Mdl | The MDL that describes the buffer to be mapped. |
| CurrentVa | The current VA in the buffer to be mapped for transfer. |
| Length | Specifies the length of data in bytes to be mapped. |
| ExecutionRoutine | A caller supplied AdapterListControl routine to be called when DMA is available. |
| Context | Context passed to the AdapterListControl routine. |
| WriteToDevice | Indicates direction of DMA operation. |
- Returns:
- The status of the operation.
- See also:
- HalPutScatterGatherList
|
| NTSTATUS NTAPI | HalGetScatterGatherList (IN PADAPTER_OBJECT AdapterObject, IN PDEVICE_OBJECT DeviceObject, IN PMDL Mdl, IN PVOID CurrentVa, IN ULONG Length, IN PDRIVER_LIST_CONTROL ExecutionRoutine, IN PVOID Context, IN BOOLEAN WriteToDevice) |
|
Frees a scatter-gather list allocated from HalGetScatterGatherList
- Parameters:
-
| AdapterObject | Adapter object representing the bus master or system dma controller. |
| ScatterGather | The scatter/gather list to be freed. |
| WriteToDevice | Indicates direction of DMA operation. |
- Returns:
- None
- See also:
- HalGetScatterGatherList
|
| VOID NTAPI | HalPutScatterGatherList (IN PADAPTER_OBJECT AdapterObject, IN PSCATTER_GATHER_LIST ScatterGather, IN BOOLEAN WriteToDevice) |
|
Internal routine to return the DMA alignment requirement. It's exported using the DMA_OPERATIONS interface by HalGetAdapter.
- See also:
- HalGetAdapter
|
| ULONG NTAPI | HalpDmaGetDmaAlignment (IN PADAPTER_OBJECT AdapterObject) |
| ULONG NTAPI | HalReadDmaCounter (IN PADAPTER_OBJECT AdapterObject) |
|
Helper routine of HalAllocateAdapterChannel for allocating map registers at PASSIVE_LEVEL in work item.
|
| VOID NTAPI | HalpGrowMapBufferWorker (IN PVOID DeferredContext) |
|
Setup map registers for an adapter object.
- Parameters:
-
| AdapterObject | Pointer to an ADAPTER_OBJECT to set up. |
| WaitContextBlock | Context block to be used with ExecutionRoutine. |
| NumberOfMapRegisters | Number of map registers requested. |
| ExecutionRoutine | Callback to call when map registers are allocated. |
- Returns:
- If not enough map registers can be allocated then STATUS_INSUFFICIENT_RESOURCES is returned. If the function succeeds or the callback is queued for later delivering then STATUS_SUCCESS is returned.
- See also:
- IoFreeAdapterChannel
|
| NTSTATUS NTAPI | HalAllocateAdapterChannel (IN PADAPTER_OBJECT AdapterObject, IN PWAIT_CONTEXT_BLOCK WaitContextBlock, IN ULONG NumberOfMapRegisters, IN PDRIVER_CONTROL ExecutionRoutine) |
|
Free DMA resources allocated by IoAllocateAdapterChannel.
- Parameters:
-
| AdapterObject | Adapter object with resources to free. |
- See also:
- IoAllocateAdapterChannel
|
| VOID NTAPI | IoFreeAdapterChannel (IN PADAPTER_OBJECT AdapterObject) |
|
Free map registers reserved by the system for a DMA.
- Parameters:
-
| AdapterObject | DMA adapter to free map registers on. |
| MapRegisterBase | Handle to map registers to free. |
| NumberOfRegisters | Number of map registers to be freed. |
|
| VOID NTAPI | IoFreeMapRegisters (IN PADAPTER_OBJECT AdapterObject, IN PVOID MapRegisterBase, IN ULONG NumberOfMapRegisters) |
|
Helper function for copying data from/to map register buffers.
- See also:
- IoFlushAdapterBuffers, IoMapTransfer
|
| VOID NTAPI | HalpCopyBufferMap (IN PMDL Mdl, IN PROS_MAP_REGISTER_ENTRY MapRegisterBase, IN PVOID CurrentVa, IN ULONG Length, IN BOOLEAN WriteToDevice) |
|
Flush any data remaining in the DMA controller's memory into the host memory.
- Parameters:
-
| AdapterObject | The adapter object to flush. |
| Mdl | Original MDL to flush data into. |
| MapRegisterBase | Map register base that was just used by IoMapTransfer, etc. |
| CurrentVa | Offset into Mdl to be flushed into, same as was passed to IoMapTransfer. |
| Length | Length of the buffer to be flushed into. |
| WriteToDevice | TRUE if it's a write, FALSE if it's a read. |
- Returns:
- TRUE in all cases.
.
|
| BOOLEAN NTAPI | IoFlushAdapterBuffers (IN PADAPTER_OBJECT AdapterObject, IN PMDL Mdl, IN PVOID MapRegisterBase, IN PVOID CurrentVa, IN ULONG Length, IN BOOLEAN WriteToDevice) |
|
Map a DMA for transfer and do the DMA if it's a slave.
- Parameters:
-
| AdapterObject | Adapter object to do the DMA on. Bus-master may pass NULL. |
| Mdl | Locked-down user buffer to DMA in to or out of. |
| MapRegisterBase | Handle to map registers to use for this dma. |
| CurrentVa | Index into Mdl to transfer into/out of. |
| Length | Length of transfer. Number of bytes actually transferred on output. |
| WriteToDevice | TRUE if it's an output DMA, FALSE otherwise. |
- Returns:
- A logical address that can be used to program a DMA controller, it's not meaningful for slave DMA device.
|
| PHYSICAL_ADDRESS NTAPI | IoMapTransfer (IN PADAPTER_OBJECT AdapterObject, IN PMDL Mdl, IN PVOID MapRegisterBase, IN PVOID CurrentVa, IN OUT PULONG Length, IN BOOLEAN WriteToDevice) |
|
|
| BOOLEAN NTAPI | HalFlushCommonBuffer (IN PADAPTER_OBJECT AdapterObject, IN ULONG Length, IN PHYSICAL_ADDRESS LogicalAddress, IN PVOID VirtualAddress) |
| PVOID NTAPI | HalAllocateCrashDumpRegisters (IN PADAPTER_OBJECT AdapterObject, IN OUT PULONG NumberOfMapRegisters) |
Variables |
| static KEVENT | HalpDmaLock |
| static LIST_ENTRY | HalpDmaAdapterList |
| static PADAPTER_OBJECT | HalpEisaAdapter [8] |
| static BOOLEAN | HalpEisaDma |
| static PADAPTER_OBJECT | HalpMasterAdapter |
| static const ULONG_PTR | HalpEisaPortPage [8] |
| static DMA_OPERATIONS | HalpDmaOperations |