00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
#include "iop.h"
00023
#pragma hdrstop
00024
00025
00026
00027
00028
00029
00030 #define MAX_ULONGLONG ((ULONGLONG) -1)
00031
00032
00033
00034
00035
00036
NTSTATUS
00037
IopDmaInitialize(
00038 VOID
00039 );
00040
00041
NTSTATUS
00042
IopDmaUnpackRequirement(
00043 IN PIO_RESOURCE_DESCRIPTOR Descriptor,
00044 OUT PULONGLONG Minimum,
00045 OUT PULONGLONG Maximum,
00046 OUT PULONG Length,
00047 OUT PULONG Alignment
00048 );
00049
00050
NTSTATUS
00051
IopDmaPackResource(
00052 IN PIO_RESOURCE_DESCRIPTOR Requirement,
00053 IN ULONGLONG Start,
00054 OUT PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor
00055 );
00056
00057 LONG
00058
IopDmaScoreRequirement(
00059 IN PIO_RESOURCE_DESCRIPTOR Descriptor
00060 );
00061
00062
NTSTATUS
00063
IopDmaUnpackResource(
00064 IN PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor,
00065 OUT PULONGLONG Start,
00066 OUT PULONG Length
00067 );
00068
00069
00070 BOOLEAN
00071
IopDmaOverrideConflict(
00072 IN
PARBITER_INSTANCE Arbiter,
00073 IN
PARBITER_ALLOCATION_STATE State
00074 );
00075
00076
00077
00078
00079
00080
#ifdef ALLOC_PRAGMA
00081
00082
#pragma alloc_text(PAGE, IopDmaInitialize)
00083
#pragma alloc_text(PAGE, IopDmaUnpackRequirement)
00084
#pragma alloc_text(PAGE, IopDmaPackResource)
00085
#pragma alloc_text(PAGE, IopDmaScoreRequirement)
00086
#pragma alloc_text(PAGE, IopDmaUnpackResource)
00087
#pragma alloc_text(PAGE, IopDmaOverrideConflict)
00088
#endif // ALLOC_PRAGMA
00089
00090
00091
00092
00093
00094
NTSTATUS
00095 IopDmaInitialize(
00096 VOID
00097 )
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115 {
00116
00117
IopRootDmaArbiter.
UnpackRequirement =
IopDmaUnpackRequirement;
00118
IopRootDmaArbiter.
PackResource =
IopDmaPackResource;
00119
IopRootDmaArbiter.
UnpackResource =
IopDmaUnpackResource;
00120
IopRootDmaArbiter.
ScoreRequirement =
IopDmaScoreRequirement;
00121
IopRootDmaArbiter.
OverrideConflict =
IopDmaOverrideConflict;
00122
00123
return ArbInitializeArbiterInstance(&
IopRootDmaArbiter,
00124
NULL,
00125 CmResourceTypeDma,
00126
L"RootDMA",
00127
L"Root",
00128
NULL
00129 );
00130 }
00131
00132
00133
00134
00135
00136
NTSTATUS
00137 IopDmaUnpackRequirement(
00138 IN PIO_RESOURCE_DESCRIPTOR Descriptor,
00139 OUT PULONGLONG Minimum,
00140 OUT PULONGLONG Maximum,
00141 OUT PULONG Length,
00142 OUT PULONG Alignment
00143 )
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171 {
00172
ASSERT(Descriptor);
00173
ASSERT(Descriptor->Type == CmResourceTypeDma);
00174
00175
ARB_PRINT(2,
00176 (
"Unpacking DMA requirement %p => 0x%I64x-0x%I64x\n",
00177 Descriptor,
00178 (ULONGLONG) Descriptor->u.Dma.MinimumChannel,
00179 (ULONGLONG) Descriptor->u.Dma.MaximumChannel
00180 ));
00181
00182 *Minimum = (ULONGLONG) Descriptor->u.Dma.MinimumChannel;
00183 *Maximum = (ULONGLONG) Descriptor->u.Dma.MaximumChannel;
00184 *Length = 1;
00185 *Alignment = 1;
00186
00187
return STATUS_SUCCESS;
00188
00189 }
00190
00191 LONG
00192 IopDmaScoreRequirement(
00193 IN PIO_RESOURCE_DESCRIPTOR Descriptor
00194 )
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215 {
00216 LONG score;
00217
00218
ASSERT(Descriptor);
00219
ASSERT(Descriptor->Type == CmResourceTypeDma);
00220
00221 score = Descriptor->u.Dma.MaximumChannel - Descriptor->u.Dma.MinimumChannel;
00222
00223
ARB_PRINT(2,
00224 (
"Scoring DMA resource %p => %i\n",
00225 Descriptor,
00226 score
00227 ));
00228
00229
return score;
00230 }
00231
00232
NTSTATUS
00233 IopDmaPackResource(
00234 IN PIO_RESOURCE_DESCRIPTOR Requirement,
00235 IN ULONGLONG Start,
00236 OUT PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor
00237 )
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259 {
00260
ASSERT(Descriptor);
00261
ASSERT(
Start < ((ULONG)-1));
00262
ASSERT(Requirement);
00263
ASSERT(Requirement->Type == CmResourceTypeDma);
00264
00265
ARB_PRINT(2,
00266 (
"Packing DMA resource %p => 0x%I64x\n",
00267 Descriptor,
00268
Start
00269 ));
00270
00271 Descriptor->Type = CmResourceTypeDma;
00272 Descriptor->ShareDisposition = Requirement->ShareDisposition;
00273 Descriptor->Flags = Requirement->Flags;
00274 Descriptor->u.Dma.Channel = (ULONG)
Start;
00275 Descriptor->u.Dma.Port = 0;
00276
00277
return STATUS_SUCCESS;
00278 }
00279
00280
NTSTATUS
00281 IopDmaUnpackResource(
00282 IN PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor,
00283 OUT PULONGLONG Start,
00284 OUT PULONG Length
00285 )
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307 {
00308
00309 *
Start = Descriptor->u.Dma.Channel;
00310 *Length = 1;
00311
00312
ARB_PRINT(2,
00313 (
"Unpacking DMA resource %p => 0x%I64x\n",
00314 Descriptor,
00315 *
Start
00316 ));
00317
00318
return STATUS_SUCCESS;
00319
00320 }
00321
00322
00323 BOOLEAN
00324 IopDmaOverrideConflict(
00325 IN PARBITER_INSTANCE Arbiter,
00326 IN
PARBITER_ALLOCATION_STATE State
00327 )
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347 {
00348
PAGED_CODE();
00349
00350
return FALSE;
00351 }
00352