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

pnpbusno.c File Reference

#include "iop.h"

Go to the source code of this file.

Defines

#define MAX_ULONGLONG   ((ULONGLONG) -1)

Functions

NTSTATUS IopBusNumberInitialize (VOID)
NTSTATUS IopBusNumberUnpackRequirement (IN PIO_RESOURCE_DESCRIPTOR Descriptor, OUT PULONGLONG Minimum, OUT PULONGLONG Maximum, OUT PULONG Length, OUT PULONG Alignment)
NTSTATUS IopBusNumberPackResource (IN PIO_RESOURCE_DESCRIPTOR Requirement, IN ULONGLONG Start, OUT PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor)
LONG IopBusNumberScoreRequirement (IN PIO_RESOURCE_DESCRIPTOR Descriptor)
NTSTATUS IopBusNumberUnpackResource (IN PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor, OUT PULONGLONG Start, OUT PULONG Length)


Define Documentation

#define MAX_ULONGLONG   ((ULONGLONG) -1)
 

Definition at line 30 of file pnpbusno.c.

Referenced by RtlInvertRangeList().


Function Documentation

NTSTATUS IopBusNumberInitialize VOID   ) 
 

Definition at line 89 of file pnpbusno.c.

References _ARBITER_INSTANCE::Allocation, ArbInitializeArbiterInstance(), IopBusNumberPackResource(), IopBusNumberScoreRequirement(), IopBusNumberUnpackRequirement(), IopBusNumberUnpackResource(), IopRootBusNumberArbiter, L, NT_SUCCESS, NTSTATUS(), NULL, _ARBITER_INSTANCE::PackResource, RtlAddRange(), _ARBITER_INSTANCE::ScoreRequirement, _ARBITER_INSTANCE::UnpackRequirement, and _ARBITER_INSTANCE::UnpackResource.

00095 : 00096 00097 This routine initializes the arbiter 00098 00099 Parameters: 00100 00101 None 00102 00103 Return Value: 00104 00105 None 00106 00107 --*/ 00108 00109 { 00110 NTSTATUS status; 00111 00112 IopRootBusNumberArbiter.UnpackRequirement = IopBusNumberUnpackRequirement; 00113 IopRootBusNumberArbiter.PackResource = IopBusNumberPackResource; 00114 IopRootBusNumberArbiter.UnpackResource = IopBusNumberUnpackResource; 00115 IopRootBusNumberArbiter.ScoreRequirement = IopBusNumberScoreRequirement; 00116 00117 status = ArbInitializeArbiterInstance(&IopRootBusNumberArbiter, 00118 NULL, // Indicates a root arbiter 00119 CmResourceTypeBusNumber, 00120 L"RootBusNumber", 00121 L"Root", 00122 NULL // no translation of BusNumber 00123 ); 00124 if (NT_SUCCESS(status)) { 00125 00126 // 00127 // Add the invalid range 100 - ffffffff ffffffff 00128 // 00129 RtlAddRange( IopRootBusNumberArbiter.Allocation, 00130 (ULONGLONG) 0x100, 00131 (ULONGLONG) -1, 00132 0, // UserFlags 00133 0, // Flag 00134 NULL, 00135 NULL 00136 ); 00137 00138 } 00139 00140 return status; 00141 }

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

Definition at line 246 of file pnpbusno.c.

References ARB_PRINT, ASSERT, and Start.

Referenced by IopBusNumberInitialize().

00254 : 00255 00256 This routine packs an resource descriptor. 00257 00258 Arguments: 00259 00260 Requirement - The requirement from which this resource was chosen. 00261 00262 Start - The start value of the resource. 00263 00264 Descriptor - Pointer to the descriptor to pack into. 00265 00266 Return Value: 00267 00268 Returns the status of this operation. 00269 00270 --*/ 00271 00272 { 00273 ASSERT(Descriptor); 00274 ASSERT(Start < ((ULONG)-1)); 00275 ASSERT(Requirement); 00276 ASSERT(Requirement->Type == CmResourceTypeBusNumber); 00277 00278 ARB_PRINT(2, 00279 ("Packing BusNumber resource %p => 0x%I64x\n", 00280 Descriptor, 00281 Start 00282 )); 00283 00284 Descriptor->Type = CmResourceTypeBusNumber; 00285 Descriptor->ShareDisposition = Requirement->ShareDisposition; 00286 Descriptor->Flags = Requirement->Flags; 00287 Descriptor->u.BusNumber.Start = (ULONG) Start; 00288 Descriptor->u.BusNumber.Length = Requirement->u.BusNumber.Length; 00289 00290 return STATUS_SUCCESS; 00291 }

LONG IopBusNumberScoreRequirement IN PIO_RESOURCE_DESCRIPTOR  Descriptor  ) 
 

Definition at line 203 of file pnpbusno.c.

References ARB_PRINT, and ASSERT.

Referenced by IopBusNumberInitialize().

00209 : 00210 00211 This routine scores a requirement based on how flexible it is. The least 00212 flexible devices are scored the least and so when the arbitration list is 00213 sorted we try to allocate their resources first. 00214 00215 Arguments: 00216 00217 Descriptor - The descriptor describing the requirement to score. 00218 00219 00220 Return Value: 00221 00222 The score. 00223 00224 --*/ 00225 00226 { 00227 LONG score; 00228 00229 ASSERT(Descriptor); 00230 ASSERT(Descriptor->Type == CmResourceTypeBusNumber); 00231 00232 score = (Descriptor->u.BusNumber.MaxBusNumber - 00233 Descriptor->u.BusNumber.MinBusNumber) / 00234 Descriptor->u.BusNumber.Length; 00235 00236 ARB_PRINT(2, 00237 ("Scoring BusNumber resource %p => %i\n", 00238 Descriptor, 00239 score 00240 )); 00241 00242 return score; 00243 }

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

Definition at line 148 of file pnpbusno.c.

References ARB_PRINT, and ASSERT.

Referenced by IopBusNumberInitialize().

00158 : 00159 00160 This routine unpacks an resource requirement descriptor. 00161 00162 Arguments: 00163 00164 Descriptor - The descriptor describing the requirement to unpack. 00165 00166 Minimum - Pointer to where the minimum acceptable start value should be 00167 unpacked to. 00168 00169 Maximum - Pointer to where the maximum acceptable end value should be 00170 unpacked to. 00171 00172 Length - Pointer to where the required length should be unpacked to. 00173 00174 Minimum - Pointer to where the required alignment should be unpacked to. 00175 00176 Return Value: 00177 00178 Returns the status of this operation. 00179 00180 --*/ 00181 00182 { 00183 ASSERT(Descriptor); 00184 ASSERT(Descriptor->Type == CmResourceTypeBusNumber); 00185 00186 ARB_PRINT(2, 00187 ("Unpacking BusNumber requirement %p => 0x%I64x-0x%I64x\n", 00188 Descriptor, 00189 (ULONGLONG) Descriptor->u.BusNumber.MinBusNumber, 00190 (ULONGLONG) Descriptor->u.BusNumber.MaxBusNumber 00191 )); 00192 00193 *Minimum = (ULONGLONG) Descriptor->u.BusNumber.MinBusNumber; 00194 *Maximum = (ULONGLONG) Descriptor->u.BusNumber.MaxBusNumber; 00195 *Length = Descriptor->u.BusNumber.Length; 00196 *Alignment = 1; 00197 00198 return STATUS_SUCCESS; 00199 00200 }

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

Definition at line 294 of file pnpbusno.c.

References ARB_PRINT, ASSERT, and Start.

Referenced by IopBusNumberInitialize().

00302 : 00303 00304 This routine unpacks an resource descriptor. 00305 00306 Arguments: 00307 00308 Descriptor - The descriptor describing the resource to unpack. 00309 00310 Start - Pointer to where the start value should be unpacked to. 00311 00312 End - Pointer to where the end value should be unpacked to. 00313 00314 Return Value: 00315 00316 Returns the status of this operation. 00317 00318 --*/ 00319 00320 { 00321 ASSERT(Descriptor); 00322 ASSERT(Start); 00323 ASSERT(Length); 00324 ASSERT(Descriptor->Type == CmResourceTypeBusNumber); 00325 00326 *Start = (ULONGLONG) Descriptor->u.BusNumber.Start; 00327 *Length = Descriptor->u.BusNumber.Length; 00328 00329 ARB_PRINT(2, 00330 ("Unpacking BusNumber resource %p => 0x%I64x\n", 00331 Descriptor, 00332 *Start 00333 )); 00334 00335 return STATUS_SUCCESS; 00336 00337 }


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