Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

864 lines
20 KiB

  1. /*++
  2. Copyright (c) 1997 Microsoft Corporation
  3. Module Name:
  4. arbiter.h
  5. Abstract:
  6. This module contains support routines for the Pnp resource arbiters.
  7. Author:
  8. Andrew Thornton (andrewth) 1-April-1997
  9. Environment:
  10. Kernel mode
  11. --*/
  12. #ifndef _ARBITER_
  13. #define _ARBITER_
  14. #if !defined(MAXULONGLONG)
  15. #define MAXULONGLONG ((ULONGLONG)-1)
  16. #endif
  17. #if ARB_DBG
  18. //
  19. // Debug print level:
  20. // -1 = no messages
  21. // 0 = vital messages only
  22. // 1 = call trace
  23. // 2 = verbose messages
  24. //
  25. extern LONG ArbDebugLevel;
  26. #define ARB_PRINT(Level, Message) \
  27. if (Level <= ArbDebugLevel) DbgPrint Message
  28. #define ARB_INDENT(Level, Count) \
  29. if (Level < ArbDebugLevel) ArbpIndent(Count)
  30. #else
  31. #define ARB_PRINT(Level, Message)
  32. #define ARB_INDENT(Level, Count)
  33. #endif // ARB_DBG
  34. //
  35. // The ARBITER_ORDRING_LIST abstract data type
  36. //
  37. typedef struct _ARBITER_ORDERING {
  38. ULONGLONG Start;
  39. ULONGLONG End;
  40. } ARBITER_ORDERING, *PARBITER_ORDERING;
  41. typedef struct _ARBITER_ORDERING_LIST {
  42. //
  43. // The number of valid entries in the array
  44. //
  45. USHORT Count;
  46. //
  47. // The maximum number of entries that can fit in the Ordering buffer
  48. //
  49. USHORT Maximum;
  50. //
  51. // Array of orderings
  52. //
  53. PARBITER_ORDERING Orderings;
  54. } ARBITER_ORDERING_LIST, *PARBITER_ORDERING_LIST;
  55. NTSTATUS
  56. ArbInitializeOrderingList(
  57. IN OUT PARBITER_ORDERING_LIST List
  58. );
  59. VOID
  60. ArbFreeOrderingList(
  61. IN OUT PARBITER_ORDERING_LIST List
  62. );
  63. NTSTATUS
  64. ArbCopyOrderingList(
  65. OUT PARBITER_ORDERING_LIST Destination,
  66. IN PARBITER_ORDERING_LIST Source
  67. );
  68. NTSTATUS
  69. ArbAddOrdering(
  70. OUT PARBITER_ORDERING_LIST List,
  71. IN ULONGLONG Start,
  72. IN ULONGLONG End
  73. );
  74. NTSTATUS
  75. ArbPruneOrdering(
  76. IN OUT PARBITER_ORDERING_LIST OrderingList,
  77. IN ULONGLONG Start,
  78. IN ULONGLONG End
  79. );
  80. //
  81. // ULONGLONG
  82. // ALIGN_ADDRESS_DOWN(
  83. // ULONGLONG address,
  84. // ULONG alignment
  85. // );
  86. //
  87. // This aligns address to the previously correctly aligned value
  88. //
  89. #define ALIGN_ADDRESS_DOWN(address, alignment) \
  90. ((address) & ~((ULONGLONG)alignment - 1))
  91. //
  92. // ULONGLONG
  93. // ALIGN_ADDRESS_UP(
  94. // ULONGLONG address,
  95. // ULONG alignment
  96. // );
  97. //
  98. // This aligns address to the next correctly aligned value
  99. //
  100. #define ALIGN_ADDRESS_UP(address, alignment) \
  101. (ALIGN_ADDRESS_DOWN( (address + alignment - 1), alignment))
  102. #define LENGTH_OF(_start, _end) \
  103. ((_end) - (_start) + 1)
  104. //
  105. // This indicates that the alternative can coexist with shared resources and
  106. // should be added to the range lists shared
  107. //
  108. #define ARBITER_ALTERNATIVE_FLAG_SHARED 0x00000001
  109. //
  110. // This indicates that the request if for a specific range with no alternatives.
  111. // ie (End - Start + 1 == Length) eg port 60-60 L1 A1
  112. //
  113. #define ARBITER_ALTERNATIVE_FLAG_FIXED 0x00000002
  114. //
  115. // This indicates that request is invalid
  116. //
  117. #define ARBITER_ALTERNATIVE_FLAG_INVALID 0x00000004
  118. typedef struct _ARBITER_ALTERNATIVE {
  119. //
  120. // The minimum acceptable start value from the requirement descriptor
  121. //
  122. ULONGLONG Minimum;
  123. //
  124. // The maximum acceptable end value from the requirement descriptor
  125. //
  126. ULONGLONG Maximum;
  127. //
  128. // The length from the requirement descriptor
  129. //
  130. ULONG Length;
  131. //
  132. // The alignment from the requirement descriptor
  133. //
  134. ULONG Alignment;
  135. //
  136. // Priority index - see comments below
  137. //
  138. LONG Priority;
  139. //
  140. // Flags - ARBITER_ALTERNATIVE_FLAG_SHARED - indicates the current
  141. // requirement was for a shared resource.
  142. // ARBITER_ALTERNATIVE_FLAG_FIXED - indicates the current
  143. // requirement is for a specific resource (eg ports 220-230 and
  144. // nothing else)
  145. //
  146. ULONG Flags;
  147. //
  148. // Descriptor - the descriptor describing this alternative
  149. //
  150. PIO_RESOURCE_DESCRIPTOR Descriptor;
  151. //
  152. // Packing...
  153. //
  154. ULONG Reserved[3];
  155. } ARBITER_ALTERNATIVE, *PARBITER_ALTERNATIVE;
  156. /*
  157. The priorities are a LONG values organised as:
  158. <------Preferred priorities-----> <-----Ordinary Priorities----->
  159. MINLONG--------------------------0-----------------------------MAXLONG
  160. ^ ^ ^ ^
  161. | | | |
  162. NULL PREFERRED_RESERVED | |
  163. RESERVED |
  164. EXHAUSTED
  165. An ordinary priority is calculated the (index + 1) of the next ordering it
  166. intersects with (and has enough space for an allocation).
  167. A preferred priority is the ordinary priority * - 1
  168. In this way by examining each of the alternatives in priority order (lowest
  169. first) we achieve the desired allocation order of:
  170. (1) Preferred alternative with non-reserved resources
  171. (2) Alternatives with non-reserved resources
  172. (3) Preferred reserved resources
  173. (4) Reserved Resources
  174. MAXLONG the worst priority indicates that there are no more allocation range
  175. left.
  176. */
  177. //
  178. // The least significant 16 bits are reserved for the base arbitration code
  179. // the most significant are arbiter specific
  180. //
  181. #define ARBITER_STATE_FLAG_RETEST 0x0001
  182. #define ARBITER_STATE_FLAG_BOOT 0x0002
  183. #define ARBITER_STATE_FLAG_CONFLICT 0x0004
  184. #define ARBITER_STATE_FLAG_NULL_CONFLICT_OK 0x0008
  185. typedef struct _ARBITER_ALLOCATION_STATE {
  186. //
  187. // The current value being considered as a possible start value
  188. //
  189. ULONGLONG Start;
  190. //
  191. // The current value being considered as a possible end value
  192. //
  193. ULONGLONG End;
  194. //
  195. // The values currently being considered as the Minimum and Maximum (this is
  196. // different because the prefered orderings can restrict the ranges where
  197. // we can allocate)
  198. //
  199. ULONGLONG CurrentMinimum;
  200. ULONGLONG CurrentMaximum;
  201. //
  202. // The entry in the arbitration list containing this request.
  203. //
  204. PARBITER_LIST_ENTRY Entry;
  205. //
  206. // The alternative currently being considered
  207. //
  208. PARBITER_ALTERNATIVE CurrentAlternative;
  209. //
  210. // The number of alternatives in the Alternatives array
  211. //
  212. ULONG AlternativeCount;
  213. //
  214. // The arbiters representation of the alternatives being considered
  215. //
  216. PARBITER_ALTERNATIVE Alternatives;
  217. //
  218. // Flags - ARBITER_STATE_FLAG_RETEST - indicates that we are in a retest
  219. // operation not a test.
  220. // ARBITER_STATE_FLAG_BOOT - indicates we are in a boot allocation
  221. // operation not a test.
  222. //
  223. USHORT Flags;
  224. //
  225. // RangeAttributes - these are logically ORed in to the attributes for all
  226. // ranges added to the range list.
  227. //
  228. UCHAR RangeAttributes;
  229. //
  230. // Ranges that are to be considered available
  231. //
  232. UCHAR RangeAvailableAttributes;
  233. //
  234. // Space for the arbiter to use as it wishes
  235. //
  236. ULONG_PTR WorkSpace;
  237. } ARBITER_ALLOCATION_STATE, *PARBITER_ALLOCATION_STATE;
  238. typedef struct _ARBITER_INSTANCE ARBITER_INSTANCE, *PARBITER_INSTANCE;
  239. typedef
  240. NTSTATUS
  241. (*PARBITER_UNPACK_REQUIREMENT) (
  242. IN PIO_RESOURCE_DESCRIPTOR Descriptor,
  243. OUT PULONGLONG Minimum,
  244. OUT PULONGLONG Maximum,
  245. OUT PULONG Length,
  246. OUT PULONG Alignment
  247. );
  248. typedef
  249. NTSTATUS
  250. (*PARBITER_PACK_RESOURCE) (
  251. IN PIO_RESOURCE_DESCRIPTOR Requirement,
  252. IN ULONGLONG Start,
  253. OUT PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor
  254. );
  255. typedef
  256. NTSTATUS
  257. (*PARBITER_UNPACK_RESOURCE) (
  258. IN PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor,
  259. OUT PULONGLONG Start,
  260. OUT PULONG Length
  261. );
  262. typedef
  263. LONG
  264. (*PARBITER_SCORE_REQUIREMENT) (
  265. IN PIO_RESOURCE_DESCRIPTOR Descriptor
  266. );
  267. typedef
  268. NTSTATUS
  269. (*PARBITER_PREPROCESS_ENTRY)(
  270. IN PARBITER_INSTANCE Arbiter,
  271. IN PARBITER_ALLOCATION_STATE Entry
  272. );
  273. typedef
  274. NTSTATUS
  275. (*PARBITER_ALLOCATE_ENTRY)(
  276. IN PARBITER_INSTANCE Arbiter,
  277. IN PARBITER_ALLOCATION_STATE Entry
  278. );
  279. typedef
  280. NTSTATUS
  281. (*PARBITER_TEST_ALLOCATION)(
  282. IN PARBITER_INSTANCE Arbiter,
  283. IN OUT PLIST_ENTRY ArbitrationList
  284. );
  285. typedef
  286. NTSTATUS
  287. (*PARBITER_COMMIT_ALLOCATION)(
  288. IN PARBITER_INSTANCE Arbiter
  289. );
  290. typedef
  291. NTSTATUS
  292. (*PARBITER_ROLLBACK_ALLOCATION)(
  293. IN PARBITER_INSTANCE Arbiter
  294. );
  295. typedef
  296. NTSTATUS
  297. (*PARBITER_RETEST_ALLOCATION)(
  298. IN PARBITER_INSTANCE Arbiter,
  299. IN OUT PLIST_ENTRY ArbitrationList
  300. );
  301. typedef
  302. NTSTATUS
  303. (*PARBITER_BOOT_ALLOCATION)(
  304. IN PARBITER_INSTANCE Arbiter,
  305. IN OUT PLIST_ENTRY ArbitrationList
  306. );
  307. typedef
  308. NTSTATUS
  309. (*PARBITER_ADD_RESERVED)(
  310. IN PARBITER_INSTANCE Arbiter,
  311. IN PIO_RESOURCE_DESCRIPTOR Requirement OPTIONAL,
  312. IN PCM_PARTIAL_RESOURCE_DESCRIPTOR Resource OPTIONAL
  313. );
  314. typedef
  315. BOOLEAN
  316. (*PARBITER_GET_NEXT_ALLOCATION_RANGE)(
  317. PARBITER_INSTANCE Arbiter,
  318. PARBITER_ALLOCATION_STATE State
  319. );
  320. typedef
  321. BOOLEAN
  322. (*PARBITER_FIND_SUITABLE_RANGE)(
  323. IN PARBITER_INSTANCE Arbiter,
  324. IN PARBITER_ALLOCATION_STATE State
  325. );
  326. typedef
  327. VOID
  328. (*PARBITER_ADD_ALLOCATION)(
  329. IN PARBITER_INSTANCE Arbiter,
  330. IN PARBITER_ALLOCATION_STATE State
  331. );
  332. typedef
  333. VOID
  334. (*PARBITER_BACKTRACK_ALLOCATION)(
  335. IN PARBITER_INSTANCE Arbiter,
  336. IN PARBITER_ALLOCATION_STATE State
  337. );
  338. typedef
  339. BOOLEAN
  340. (*PARBITER_OVERRIDE_CONFLICT)(
  341. IN PARBITER_INSTANCE Arbiter,
  342. IN PARBITER_ALLOCATION_STATE State
  343. );
  344. typedef
  345. NTSTATUS
  346. (*PARBITER_QUERY_ARBITRATE)(
  347. IN PARBITER_INSTANCE Arbiter,
  348. IN PLIST_ENTRY ArbitrationList
  349. );
  350. typedef
  351. NTSTATUS
  352. (*PARBITER_QUERY_CONFLICT)(
  353. IN PARBITER_INSTANCE Arbiter,
  354. IN PDEVICE_OBJECT PhysicalDeviceObject,
  355. IN PIO_RESOURCE_DESCRIPTOR ConflictingResource,
  356. OUT PULONG ConflictCount,
  357. OUT PARBITER_CONFLICT_INFO *Conflicts
  358. );
  359. typedef
  360. NTSTATUS
  361. (*PARBITER_START_ARBITER)(
  362. IN PARBITER_INSTANCE Arbiter,
  363. IN PCM_RESOURCE_LIST StartResources
  364. );
  365. //
  366. // Attributes for the ranges
  367. //
  368. #define ARBITER_RANGE_BOOT_ALLOCATED 0x01
  369. #define ARBITER_RANGE_SHARE_DRIVER_EXCLUSIVE 0x02
  370. #define ARBITER_RANGE_ALIAS 0x10
  371. #define ARBITER_RANGE_POSITIVE_DECODE 0x20
  372. #define INITIAL_ALLOCATION_STATE_SIZE PAGE_SIZE
  373. #define ARBITER_INSTANCE_SIGNATURE 'sbrA'
  374. typedef struct _ARBITER_INSTANCE {
  375. //
  376. // Signature - must be ARBITER_INSTANCE_SIGNATURE
  377. //
  378. ULONG Signature;
  379. //
  380. // Synchronisation lock
  381. //
  382. PKEVENT MutexEvent;
  383. //
  384. // The name of this arbiter - used for debugging and registry storage
  385. //
  386. PWSTR Name;
  387. //
  388. // The resource type this arbiter arbitrates.
  389. //
  390. CM_RESOURCE_TYPE ResourceType;
  391. //
  392. // Pointer to a pool allocated range list which contains the current
  393. // allocation
  394. //
  395. PRTL_RANGE_LIST Allocation;
  396. //
  397. // Pointer to a pool allocated range list which contains the allocation
  398. // under considetation. This is set by test allocation.
  399. //
  400. PRTL_RANGE_LIST PossibleAllocation;
  401. //
  402. // The order in which these resources should be allocated. Taken from the
  403. // HKLM\System\CurrentControlSet\Control\SystemResources\AssignmentOrdering
  404. // key and modified based on the reserved resources.
  405. //
  406. ARBITER_ORDERING_LIST OrderingList;
  407. //
  408. // The resources that should be reserved (not allocated until absolutley
  409. // necessary)
  410. //
  411. ARBITER_ORDERING_LIST ReservedList;
  412. //
  413. // The reference count of the number of entities that are using the
  414. // ARBITER_INTERFACE associated with this instance.
  415. //
  416. LONG ReferenceCount;
  417. //
  418. // The ARBITER_INTERFACE associated with this instance.
  419. //
  420. PARBITER_INTERFACE Interface;
  421. //
  422. // The size in bytes of the currently allocated AllocationStack
  423. //
  424. ULONG AllocationStackMaxSize;
  425. //
  426. // A pointer to an array of ARBITER_ALLOCATION_STATE entries encapsulating
  427. // the state of the current arbitration
  428. //
  429. PARBITER_ALLOCATION_STATE AllocationStack;
  430. //
  431. // Required helper function dispatches - these functions must always be
  432. // provided
  433. //
  434. PARBITER_UNPACK_REQUIREMENT UnpackRequirement;
  435. PARBITER_PACK_RESOURCE PackResource;
  436. PARBITER_UNPACK_RESOURCE UnpackResource;
  437. PARBITER_SCORE_REQUIREMENT ScoreRequirement;
  438. //
  439. // Main arbiter action dispatches
  440. //
  441. PARBITER_TEST_ALLOCATION TestAllocation; OPTIONAL
  442. PARBITER_RETEST_ALLOCATION RetestAllocation; OPTIONAL
  443. PARBITER_COMMIT_ALLOCATION CommitAllocation; OPTIONAL
  444. PARBITER_ROLLBACK_ALLOCATION RollbackAllocation; OPTIONAL
  445. PARBITER_BOOT_ALLOCATION BootAllocation; OPTIONAL
  446. PARBITER_QUERY_ARBITRATE QueryArbitrate; OPTIONAL
  447. PARBITER_QUERY_CONFLICT QueryConflict; OPTIONAL
  448. PARBITER_ADD_RESERVED AddReserved; OPTIONAL
  449. PARBITER_START_ARBITER StartArbiter; OPTIONAL
  450. //
  451. // Optional helper functions
  452. //
  453. PARBITER_PREPROCESS_ENTRY PreprocessEntry; OPTIONAL
  454. PARBITER_ALLOCATE_ENTRY AllocateEntry; OPTIONAL
  455. PARBITER_GET_NEXT_ALLOCATION_RANGE GetNextAllocationRange; OPTIONAL
  456. PARBITER_FIND_SUITABLE_RANGE FindSuitableRange; OPTIONAL
  457. PARBITER_ADD_ALLOCATION AddAllocation; OPTIONAL
  458. PARBITER_BACKTRACK_ALLOCATION BacktrackAllocation; OPTIONAL
  459. PARBITER_OVERRIDE_CONFLICT OverrideConflict; OPTIONAL
  460. //
  461. // Debugging support
  462. //
  463. BOOLEAN TransactionInProgress;
  464. //
  465. // Arbiter specific extension - can be used to store extra arbiter specific
  466. // information
  467. //
  468. PVOID Extension;
  469. //
  470. // The bus device we arbitrate for
  471. //
  472. PDEVICE_OBJECT BusDeviceObject;
  473. //
  474. // Callback and context for RtlFindRange/RtlIsRangeAvailable to allow
  475. // complex conflicts
  476. //
  477. PVOID ConflictCallbackContext;
  478. PRTL_CONFLICT_RANGE_CALLBACK ConflictCallback;
  479. } ARBITER_INSTANCE, *PARBITER_INSTANCE;
  480. //
  481. // Lock primitives that leave us at PASSIVE_LEVEL after acquiring the lock.
  482. // (A FAST_MUTEX or CriticalRegion leave us at APC level and some people (ACPI)
  483. // need to be at passive level in their arbiter)
  484. //
  485. #define ArbAcquireArbiterLock(_Arbiter) \
  486. KeWaitForSingleObject( (_Arbiter)->MutexEvent, Executive, KernelMode, FALSE, NULL )
  487. #define ArbReleaseArbiterLock(_Arbiter) \
  488. KeSetEvent( (_Arbiter)->MutexEvent, 0, FALSE )
  489. //
  490. // Iteration macros
  491. //
  492. //
  493. // Control macro (used like a for loop) which iterates over all entries in
  494. // a standard doubly linked list. Head is the list head and the entries are of
  495. // type Type. A member called ListEntry is assumed to be the LIST_ENTRY
  496. // structure linking the entries together. Current contains a pointer to each
  497. // entry in turn.
  498. //
  499. #define FOR_ALL_IN_LIST(Type, Head, Current) \
  500. for((Current) = CONTAINING_RECORD((Head)->Flink, Type, ListEntry); \
  501. (Head) != &(Current)->ListEntry; \
  502. (Current) = CONTAINING_RECORD((Current)->ListEntry.Flink, \
  503. Type, \
  504. ListEntry) \
  505. )
  506. //
  507. // Similar to the above only iteration is over an array of length _Size.
  508. //
  509. #define FOR_ALL_IN_ARRAY(_Array, _Size, _Current) \
  510. for ( (_Current) = (_Array); \
  511. (_Current) < (_Array) + (_Size); \
  512. (_Current)++ )
  513. //
  514. // As above only iteration begins with the entry _Current
  515. //
  516. #define FOR_REST_IN_ARRAY(_Array, _Size, _Current) \
  517. for ( ; \
  518. (_Current) < (_Array) + (_Size); \
  519. (_Current)++ )
  520. //
  521. // BOOLEAN
  522. // INTERSECT(
  523. // ULONGLONG s1,
  524. // ULONGLONG e1,
  525. // ULONGLONG s2,
  526. // ULONGLONG e2
  527. // );
  528. //
  529. // Determines if the ranges s1-e1 and s2-e2 intersect
  530. //
  531. #define INTERSECT(s1,e1,s2,e2) \
  532. !( ((s1) < (s2) && (e1) < (s2)) \
  533. ||((s2) < (s1) && (e2) < (s1)) )
  534. //
  535. // ULONGLONG
  536. // INTERSECT_SIZE(
  537. // ULONGLONG s1,
  538. // ULONGLONG e1,
  539. // ULONGLONG s2,
  540. // ULONGLONG e2
  541. // );
  542. //
  543. // Returns the size of the intersection of s1-e1 and s2-e2, undefined if they
  544. // don't intersect
  545. //
  546. #define INTERSECT_SIZE(s1,e1,s2,e2) \
  547. ( __min((e1),(e2)) - __max((s1),(s2)) + 1)
  548. #define LEGACY_REQUEST(_Entry) \
  549. ((_Entry)->RequestSource == ArbiterRequestLegacyReported || \
  550. (_Entry)->RequestSource == ArbiterRequestLegacyAssigned)
  551. #define PNP_REQUEST(_Entry) \
  552. ((_Entry)->RequestSource == ArbiterRequestPnpDetected || \
  553. (_Entry)->RequestSource == ArbiterRequestPnpEnumerated)
  554. //
  555. // Priorities used in ArbGetNextAllocationRange
  556. //
  557. #define ARBITER_PRIORITY_NULL 0
  558. #define ARBITER_PRIORITY_PREFERRED_RESERVED (MAXLONG-2)
  559. #define ARBITER_PRIORITY_RESERVED (MAXLONG-1)
  560. #define ARBITER_PRIORITY_EXHAUSTED (MAXLONG)
  561. typedef
  562. NTSTATUS
  563. (*PARBITER_TRANSLATE_ALLOCATION_ORDER)(
  564. OUT PIO_RESOURCE_DESCRIPTOR TranslatedDescriptor,
  565. IN PIO_RESOURCE_DESCRIPTOR RawDescriptor
  566. );
  567. //
  568. // Common arbiter routines
  569. //
  570. NTSTATUS
  571. ArbInitializeArbiterInstance(
  572. OUT PARBITER_INSTANCE Arbiter,
  573. IN PDEVICE_OBJECT BusDevice,
  574. IN CM_RESOURCE_TYPE ResourceType,
  575. IN PWSTR Name,
  576. IN PWSTR OrderingName,
  577. IN PARBITER_TRANSLATE_ALLOCATION_ORDER TranslateOrdering
  578. );
  579. VOID
  580. ArbDeleteArbiterInstance(
  581. IN PARBITER_INSTANCE Arbiter
  582. );
  583. NTSTATUS
  584. ArbArbiterHandler(
  585. IN PVOID Context,
  586. IN ARBITER_ACTION Action,
  587. IN OUT PARBITER_PARAMETERS Params
  588. );
  589. NTSTATUS
  590. ArbTestAllocation(
  591. IN PARBITER_INSTANCE Arbiter,
  592. IN OUT PLIST_ENTRY ArbitrationList
  593. );
  594. NTSTATUS
  595. ArbRetestAllocation(
  596. IN PARBITER_INSTANCE Arbiter,
  597. IN OUT PLIST_ENTRY ArbitrationList
  598. );
  599. NTSTATUS
  600. ArbCommitAllocation(
  601. PARBITER_INSTANCE Arbiter
  602. );
  603. NTSTATUS
  604. ArbRollbackAllocation(
  605. PARBITER_INSTANCE Arbiter
  606. );
  607. NTSTATUS
  608. ArbAddReserved(
  609. IN PARBITER_INSTANCE Arbiter,
  610. IN PIO_RESOURCE_DESCRIPTOR Requirement OPTIONAL,
  611. IN PCM_PARTIAL_RESOURCE_DESCRIPTOR Resource OPTIONAL
  612. );
  613. NTSTATUS
  614. ArbPreprocessEntry(
  615. IN PARBITER_INSTANCE Arbiter,
  616. IN PARBITER_ALLOCATION_STATE State
  617. );
  618. NTSTATUS
  619. ArbAllocateEntry(
  620. IN PARBITER_INSTANCE Arbiter,
  621. IN PARBITER_ALLOCATION_STATE State
  622. );
  623. NTSTATUS
  624. ArbSortArbitrationList(
  625. IN OUT PLIST_ENTRY ArbitrationList
  626. );
  627. VOID
  628. ArbConfirmAllocation(
  629. IN PARBITER_INSTANCE Arbiter,
  630. IN PARBITER_ALLOCATION_STATE State
  631. );
  632. BOOLEAN
  633. ArbOverrideConflict(
  634. IN PARBITER_INSTANCE Arbiter,
  635. IN PARBITER_ALLOCATION_STATE State
  636. );
  637. NTSTATUS
  638. ArbQueryConflict(
  639. IN PARBITER_INSTANCE Arbiter,
  640. IN PDEVICE_OBJECT PhysicalDeviceObject,
  641. IN PIO_RESOURCE_DESCRIPTOR ConflictingResource,
  642. OUT PULONG ConflictCount,
  643. OUT PARBITER_CONFLICT_INFO *Conflicts
  644. );
  645. VOID
  646. ArbBacktrackAllocation(
  647. IN PARBITER_INSTANCE Arbiter,
  648. IN PARBITER_ALLOCATION_STATE State
  649. );
  650. BOOLEAN
  651. ArbGetNextAllocationRange(
  652. PARBITER_INSTANCE Arbiter,
  653. PARBITER_ALLOCATION_STATE State
  654. );
  655. BOOLEAN
  656. ArbFindSuitableRange(
  657. PARBITER_INSTANCE Arbiter,
  658. PARBITER_ALLOCATION_STATE State
  659. );
  660. VOID
  661. ArbAddAllocation(
  662. IN PARBITER_INSTANCE Arbiter,
  663. IN PARBITER_ALLOCATION_STATE State
  664. );
  665. NTSTATUS
  666. ArbBootAllocation(
  667. IN PARBITER_INSTANCE Arbiter,
  668. IN OUT PLIST_ENTRY ArbitrationList
  669. );
  670. NTSTATUS
  671. ArbStartArbiter(
  672. IN PARBITER_INSTANCE Arbiter,
  673. IN PCM_RESOURCE_LIST StartResources
  674. );
  675. NTSTATUS
  676. ArbBuildAssignmentOrdering(
  677. IN OUT PARBITER_INSTANCE Arbiter,
  678. IN PWSTR AllocationOrderName,
  679. IN PWSTR ReservedResourcesName,
  680. IN PARBITER_TRANSLATE_ALLOCATION_ORDER Translate OPTIONAL
  681. );
  682. #if ARB_DBG
  683. VOID
  684. ArbpIndent(
  685. ULONG Count
  686. );
  687. #endif // DBG
  688. #endif