Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

pnpirq.c File Reference

#include "iop.h"

Go to the source code of this file.

Defines

#define MAX_ULONGLONG   ((ULONGLONG) -1)

Functions

NTSTATUS IopIrqInitialize (VOID)
NTSTATUS IopIrqUnpackRequirement (IN PIO_RESOURCE_DESCRIPTOR Descriptor, OUT PULONGLONG Minimum, OUT PULONGLONG Maximum, OUT PULONG Length, OUT PULONG Alignment)
NTSTATUS IopIrqPackResource (IN PIO_RESOURCE_DESCRIPTOR Requirement, IN ULONGLONG Start, OUT PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor)
LONG IopIrqScoreRequirement (IN PIO_RESOURCE_DESCRIPTOR Descriptor)
NTSTATUS IopIrqUnpackResource (IN PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor, OUT PULONGLONG Start, OUT PULONG Length)
NTSTATUS IopIrqTranslateOrdering (OUT PIO_RESOURCE_DESCRIPTOR Target, IN PIO_RESOURCE_DESCRIPTOR Source)
BOOLEAN IopIrqFindSuitableRange (PARBITER_INSTANCE Arbiter, PARBITER_ALLOCATION_STATE State)


Define Documentation

#define MAX_ULONGLONG   ((ULONGLONG) -1)
 

Definition at line 28 of file pnpirq.c.


Function Documentation

BOOLEAN IopIrqFindSuitableRange PARBITER_INSTANCE  Arbiter,
PARBITER_ALLOCATION_STATE  State
 

NTSTATUS IopIrqInitialize VOID   ) 
 

Referenced by IopInitializePlugPlayServices().

NTSTATUS IopIrqPackResource IN PIO_RESOURCE_DESCRIPTOR  Requirement,
IN ULONGLONG  Start,
OUT PCM_PARTIAL_RESOURCE_DESCRIPTOR  Descriptor
 

Definition at line 338 of file pnpirq.c.

References ARB_PRINT, ASSERT, and Start.

Referenced by IopIrqInitialize().

00346 : 00347 00348 This routine packs an resource descriptor. 00349 00350 Arguments: 00351 00352 Requirement - The requirement from which this resource was chosen. 00353 00354 Start - The start value of the resource. 00355 00356 Descriptor - Pointer to the descriptor to pack into. 00357 00358 Return Value: 00359 00360 Returns the status of this operation. 00361 00362 --*/ 00363 00364 { 00365 ASSERT(Descriptor); 00366 ASSERT(Start < ((ULONG)-1)); 00367 ASSERT(Requirement); 00368 ASSERT(Requirement->Type == CmResourceTypeInterrupt); 00369 00370 ARB_PRINT(2, 00371 ("Packing IRQ resource %p => 0x%I64x\n", 00372 Descriptor, 00373 Start 00374 )); 00375 00376 Descriptor->Type = CmResourceTypeInterrupt; 00377 Descriptor->Flags = Requirement->Flags; // BUGBUG - is this correct? 00378 Descriptor->ShareDisposition = Requirement->ShareDisposition; 00379 Descriptor->u.Interrupt.Vector = (ULONG) Start; 00380 Descriptor->u.Interrupt.Level = (ULONG) Start; 00381 Descriptor->u.Interrupt.Affinity = 0xFFFFFFFF; 00382 00383 return STATUS_SUCCESS; 00384 }

LONG IopIrqScoreRequirement IN PIO_RESOURCE_DESCRIPTOR  Descriptor  ) 
 

Definition at line 296 of file pnpirq.c.

References ARB_PRINT, and ASSERT.

Referenced by IopIrqInitialize().

00302 : 00303 00304 This routine scores a requirement based on how flexible it is. The least 00305 flexible devices are scored the least and so when the arbitration list is 00306 sorted we try to allocate their resources first. 00307 00308 Arguments: 00309 00310 Descriptor - The descriptor describing the requirement to score. 00311 00312 00313 Return Value: 00314 00315 The score. 00316 00317 --*/ 00318 00319 { 00320 LONG score; 00321 00322 ASSERT(Descriptor); 00323 ASSERT(Descriptor->Type == CmResourceTypeInterrupt); 00324 00325 score = Descriptor->u.Interrupt.MaximumVector - 00326 Descriptor->u.Interrupt.MinimumVector + 1; 00327 00328 ARB_PRINT(2, 00329 ("Scoring IRQ resource %p => %i\n", 00330 Descriptor, 00331 score 00332 )); 00333 00334 return score; 00335 }

NTSTATUS IopIrqTranslateOrdering OUT PIO_RESOURCE_DESCRIPTOR  Target,
IN PIO_RESOURCE_DESCRIPTOR  Source
 

Definition at line 100 of file pnpirq.c.

References ARB_PRINT, HalGetInterruptVector(), and PAGED_CODE.

Referenced by IopIrqInitialize().

00107 : 00108 00109 This routine is called during arbiter initialization to translate the 00110 orderings. 00111 00112 Parameters: 00113 00114 Target - Place to put the translated descriptor 00115 00116 Source - Descriptor to translate 00117 00118 Return Value: 00119 00120 Status code 00121 00122 */ 00123 00124 { 00125 00126 KIRQL level; 00127 KAFFINITY affinity; 00128 00129 PAGED_CODE(); 00130 00131 // 00132 // Copy the source to the target 00133 // 00134 00135 *Target = *Source; 00136 00137 if (Source->Type != CmResourceTypeInterrupt) { 00138 return STATUS_SUCCESS; 00139 } 00140 00141 // 00142 // Translate the vector 00143 // 00144 00145 00146 ARB_PRINT( 00147 2, 00148 ("Translating Vector 0x%x-0x%x =>", 00149 Source->u.Interrupt.MinimumVector, 00150 Source->u.Interrupt.MaximumVector 00151 )); 00152 00153 Target->u.Interrupt.MinimumVector = 00154 HalGetInterruptVector(Isa, 00155 0, 00156 Source->u.Interrupt.MinimumVector, 00157 Source->u.Interrupt.MinimumVector, 00158 &level, 00159 &affinity 00160 ); 00161 00162 if (affinity == 0) { 00163 ARB_PRINT(2,("Translation failed\n")); 00164 *Target = *Source; 00165 return STATUS_SUCCESS; 00166 } 00167 00168 Target->u.Interrupt.MaximumVector = 00169 HalGetInterruptVector(Isa, 00170 0, 00171 Source->u.Interrupt.MaximumVector, 00172 Source->u.Interrupt.MaximumVector, 00173 &level, 00174 &affinity 00175 ); 00176 00177 if (affinity == 0) { 00178 ARB_PRINT(2,("Translation failed\n")); 00179 *Target = *Source; 00180 return STATUS_SUCCESS; 00181 } 00182 00183 ARB_PRINT( 00184 2, 00185 ("0x%x-0x%x\n", 00186 Target->u.Interrupt.MinimumVector, 00187 Target->u.Interrupt.MaximumVector 00188 )); 00189 00190 00191 return STATUS_SUCCESS; 00192 } #endif // NO_LEGACY_DRIVERS

NTSTATUS IopIrqUnpackRequirement IN PIO_RESOURCE_DESCRIPTOR  Descriptor,
OUT PULONGLONG  Minimum,
OUT PULONGLONG  Maximum,
OUT PULONG  Length,
OUT PULONG  Alignment
 

Definition at line 241 of file pnpirq.c.

References ARB_PRINT, and ASSERT.

Referenced by IopIrqInitialize().

00251 : 00252 00253 This routine unpacks an resource requirement descriptor. 00254 00255 Arguments: 00256 00257 Descriptor - The descriptor describing the requirement to unpack. 00258 00259 Minimum - Pointer to where the minimum acceptable start value should be 00260 unpacked to. 00261 00262 Maximum - Pointer to where the maximum acceptable end value should be 00263 unpacked to. 00264 00265 Length - Pointer to where the required length should be unpacked to. 00266 00267 Minimum - Pointer to where the required alignment should be unpacked to. 00268 00269 Return Value: 00270 00271 Returns the status of this operation. 00272 00273 --*/ 00274 00275 { 00276 ASSERT(Descriptor); 00277 ASSERT(Descriptor->Type == CmResourceTypeInterrupt); 00278 00279 ARB_PRINT(2, 00280 ("Unpacking IRQ requirement %p => 0x%I64x-0x%I64x\n", 00281 Descriptor, 00282 (ULONGLONG) Descriptor->u.Interrupt.MinimumVector, 00283 (ULONGLONG) Descriptor->u.Interrupt.MaximumVector 00284 )); 00285 00286 *Minimum = (ULONGLONG) Descriptor->u.Interrupt.MinimumVector; 00287 *Maximum = (ULONGLONG) Descriptor->u.Interrupt.MaximumVector; 00288 *Length = 1; 00289 *Alignment = 1; 00290 00291 return STATUS_SUCCESS; 00292 00293 }

NTSTATUS IopIrqUnpackResource IN PCM_PARTIAL_RESOURCE_DESCRIPTOR  Descriptor,
OUT PULONGLONG  Start,
OUT PULONG  Length
 

Definition at line 387 of file pnpirq.c.

References ARB_PRINT, ASSERT, and Start.

Referenced by IopIrqInitialize().

00395 : 00396 00397 This routine unpacks an resource descriptor. 00398 00399 Arguments: 00400 00401 Descriptor - The descriptor describing the requirement to unpack. 00402 00403 Start - Pointer to where the start value should be unpacked to. 00404 00405 End - Pointer to where the end value should be unpacked to. 00406 00407 Return Value: 00408 00409 Returns the status of this operation. 00410 00411 --*/ 00412 00413 00414 { 00415 00416 ASSERT(Descriptor); 00417 ASSERT(Descriptor->Type == CmResourceTypeInterrupt); 00418 00419 *Start = Descriptor->u.Interrupt.Vector; 00420 *Length = 1; 00421 00422 ARB_PRINT(2, 00423 ("Unpacking IRQ resource %p => 0x%I64x\n", 00424 Descriptor, 00425 *Start 00426 )); 00427 00428 return STATUS_SUCCESS; 00429 00430 } }


Generated on Sat May 15 19:45:14 2004 for test by doxygen 1.3.7