ReactOS 0.4.17-dev-684-ga6524ef
arbdma.c File Reference
#include <ntoskrnl.h>
#include <debug.h>
Include dependency graph for arbdma.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

NTSTATUS NTAPI IopArbDmaUnpackRequirements (_In_ PIO_RESOURCE_DESCRIPTOR IoDescriptor, _Out_ PUINT64 OutMinimumAddress, _Out_ PUINT64 OutMaximumAddress, _Out_ PUINT64 OutLength, _Out_ PUINT64 OutAlignment)
 
NTSTATUS NTAPI IopArbDmaPackResource (_In_ PIO_RESOURCE_DESCRIPTOR IoDescriptor, _In_ UINT64 Start, _Out_ PCM_PARTIAL_RESOURCE_DESCRIPTOR CmDescriptor)
 
NTSTATUS NTAPI IopArbDmaUnpackResource (_In_ PCM_PARTIAL_RESOURCE_DESCRIPTOR CmDescriptor, _Out_ PUINT64 Start, _Out_ PUINT64 OutLength)
 
INT32 NTAPI IopArbDmaScoreRequirement (_In_ PIO_RESOURCE_DESCRIPTOR IoDescriptor)
 
NTSTATUS NTAPI IopArbDmaInitialize (VOID)
 Initialize the RootDmaArbiter.
 

Variables

ARBITER_INSTANCE IopRootDmaArbiter
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 11 of file arbdma.c.

Function Documentation

◆ IopArbDmaInitialize()

NTSTATUS NTAPI IopArbDmaInitialize ( VOID  )

Initialize the RootDmaArbiter.

Returns
NTSTATUS
Return values
STATUS_SUCCESS
STATUS_UNSUCCESSFUL
STATUS_INSUFFICIENT_RESOURCES

Definition at line 106 of file arbdma.c.

107{
109
110 PAGED_CODE();
111 IopRootDmaArbiter.Name = L"RootDma";
116
118 NULL,
121 L"Root",
122 NULL);
123 if (!NT_SUCCESS(Status))
124 {
125 DPRINT1("IopArbDmaInitialize: Failed with %X", Status);
126 }
127
128 return Status;
129}
#define PAGED_CODE()
INT32 NTAPI IopArbDmaScoreRequirement(_In_ PIO_RESOURCE_DESCRIPTOR IoDescriptor)
Definition: arbdma.c:89
NTSTATUS NTAPI IopArbDmaPackResource(_In_ PIO_RESOURCE_DESCRIPTOR IoDescriptor, _In_ UINT64 Start, _Out_ PCM_PARTIAL_RESOURCE_DESCRIPTOR CmDescriptor)
Definition: arbdma.c:41
NTSTATUS NTAPI IopArbDmaUnpackResource(_In_ PCM_PARTIAL_RESOURCE_DESCRIPTOR CmDescriptor, _Out_ PUINT64 Start, _Out_ PUINT64 OutLength)
Definition: arbdma.c:74
NTSTATUS NTAPI IopArbDmaUnpackRequirements(_In_ PIO_RESOURCE_DESCRIPTOR IoDescriptor, _Out_ PUINT64 OutMinimumAddress, _Out_ PUINT64 OutMaximumAddress, _Out_ PUINT64 OutLength, _Out_ PUINT64 OutAlignment)
Definition: arbdma.c:22
ARBITER_INSTANCE IopRootDmaArbiter
Definition: pnpinit.c:25
NTSTATUS NTAPI ArbiterLibInitializeInstance(_Inout_ PARBITER_INSTANCE Arbiter, _In_ PDEVICE_OBJECT BusDeviceObject, _In_ CM_RESOURCE_TYPE ResourceType, _In_ PCWSTR ArbiterName, _In_ PCWSTR OrderName, _In_ PARB_TRANSLATE_ORDERING TranslateOrderingFunction)
Definition: arbiter.c:299
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
#define NULL
Definition: types.h:112
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define L(x)
Definition: resources.c:13
Status
Definition: gdiplustypes.h:24
#define CmResourceTypeDma
Definition: restypes.h:107
PARB_UNPACK_RESOURCE UnpackResource
Definition: arbiter.h:294
PARB_SCORE_REQUIREMENT ScoreRequirement
Definition: arbiter.h:295
PARB_UNPACK_REQUIREMENT UnpackRequirement
Definition: arbiter.h:292
PARB_PACK_RESOURCE PackResource
Definition: arbiter.h:293
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132

Referenced by IopInitializeArbiters().

◆ IopArbDmaPackResource()

NTSTATUS NTAPI IopArbDmaPackResource ( _In_ PIO_RESOURCE_DESCRIPTOR  IoDescriptor,
_In_ UINT64  Start,
_Out_ PCM_PARTIAL_RESOURCE_DESCRIPTOR  CmDescriptor 
)

Definition at line 41 of file arbdma.c.

45{
46 PAGED_CODE();
47
48 CmDescriptor->Type = CmResourceTypeDma;
49 CmDescriptor->ShareDisposition = IoDescriptor->ShareDisposition;
50 CmDescriptor->Flags = IoDescriptor->Flags;
51
52 /*
53 * TODO: this is only version gated temporarily,
54 * we need this for USB3 eventually, I marked it for now.
55 */
56#if (NTDDI_VERSION >= NTDDI_WIN8)
57 if (IoDescriptor->Flags & CM_RESOURCE_DMA_V3)
58 {
59 CmDescriptor->u.DmaV3.Channel = IoDescriptor->u.DmaV3.Channel;
60 CmDescriptor->u.DmaV3.RequestLine = IoDescriptor->u.DmaV3.RequestLine;
61 CmDescriptor->u.DmaV3.TransferWidth = (UCHAR)IoDescriptor->u.DmaV3.TransferWidth;
62 return STATUS_SUCCESS;
63 }
64#endif
65
66 CmDescriptor->u.Dma.Channel = (ULONG)Start;
67 CmDescriptor->u.Dma.Port = 0;
68
69 return STATUS_SUCCESS;
70}
static _Out_opt_ PULONGLONG Start
#define STATUS_SUCCESS
Definition: shellext.h:65
unsigned char UCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
#define CM_RESOURCE_DMA_V3
Definition: cmtypes.h:300

Referenced by IopArbDmaInitialize().

◆ IopArbDmaScoreRequirement()

INT32 NTAPI IopArbDmaScoreRequirement ( _In_ PIO_RESOURCE_DESCRIPTOR  IoDescriptor)

Definition at line 89 of file arbdma.c.

91{
92 PAGED_CODE();
93 return (INT32)(IoDescriptor->u.Dma.MaximumChannel - IoDescriptor->u.Dma.MinimumChannel);
94}
int32_t INT32
Definition: typedefs.h:58

Referenced by IopArbDmaInitialize().

◆ IopArbDmaUnpackRequirements()

NTSTATUS NTAPI IopArbDmaUnpackRequirements ( _In_ PIO_RESOURCE_DESCRIPTOR  IoDescriptor,
_Out_ PUINT64  OutMinimumAddress,
_Out_ PUINT64  OutMaximumAddress,
_Out_ PUINT64  OutLength,
_Out_ PUINT64  OutAlignment 
)

Definition at line 22 of file arbdma.c.

28{
29 PAGED_CODE();
30
31 *OutMinimumAddress = IoDescriptor->u.Dma.MinimumChannel;
32 *OutMaximumAddress = IoDescriptor->u.Dma.MaximumChannel;
33 *OutLength = 1;
34 *OutAlignment = 1;
35
36 return STATUS_SUCCESS;
37}

Referenced by IopArbDmaInitialize().

◆ IopArbDmaUnpackResource()

NTSTATUS NTAPI IopArbDmaUnpackResource ( _In_ PCM_PARTIAL_RESOURCE_DESCRIPTOR  CmDescriptor,
_Out_ PUINT64  Start,
_Out_ PUINT64  OutLength 
)

Definition at line 74 of file arbdma.c.

78{
79 PAGED_CODE();
80
81 *Start = CmDescriptor->u.Dma.Channel;
82 *OutLength = 1;
83
84 return STATUS_SUCCESS;
85}

Referenced by IopArbDmaInitialize().

Variable Documentation

◆ IopRootDmaArbiter

ARBITER_INSTANCE IopRootDmaArbiter
extern

Definition at line 25 of file pnpinit.c.

Referenced by IopArbDmaInitialize().