Leaked source code of windows server 2003
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.

1029 lines
21 KiB

  1. /*++
  2. Copyright (c) 1995-2000 Microsoft Corporation
  3. Module Name:
  4. busp.h
  5. Abstract:
  6. Hardware independent header file for Pnp Isa bus extender.
  7. Author:
  8. Shie-Lin Tzong (shielint) July-26-1995
  9. Environment:
  10. Kernel mode only.
  11. Revision History:
  12. --*/
  13. #ifndef _IN_KERNEL_
  14. #define _IN_KERNEL_
  15. #endif
  16. #include <stdio.h>
  17. #include <ntddk.h>
  18. #include <stdarg.h>
  19. #include <regstr.h>
  20. #include <strsafe.h>
  21. #include "message.h"
  22. #ifdef POOL_TAGGING
  23. #undef ExAllocatePool
  24. #define ExAllocatePool(a,b) ExAllocatePoolWithTag(a,b,'pasI')
  25. #endif
  26. //
  27. // Turn this on to track resource start/stop printfs
  28. //
  29. #define VERBOSE_DEBUG 1
  30. //
  31. // ISOLATE_CARDS enables the code that actually isolates ISAPNP
  32. // devices. WIth this turned off, all aspects of ISAPNP are disabled except
  33. // ejecting an ISA Interrupt translator. This is intended for
  34. // circumstances in which we aren't sure if we can get ISAPNP not to
  35. // load at all but for which we want ISAPNP not to isolate ISAPNP
  36. // cards i.e Win64
  37. //
  38. #if defined(_WIN64)
  39. #define ISOLATE_CARDS 0
  40. #else
  41. #define ISOLATE_CARDS 1
  42. #endif
  43. //
  44. // NT4_DRIVER_COMPAT enables the code which checks if a force config
  45. // is installed for an ISA pnp device. If yes, isapnp.sys will
  46. // activate the device. Else, the device is deactivated until isapnp
  47. // receives a start irp. This supports NT4 PNPISA drivers that expect
  48. // to find the device activated at the 'force config' that was created
  49. // when the driver was installed.
  50. //
  51. #define NT4_DRIVER_COMPAT 1
  52. #define BOOT_CONFIG_PRIORITY 0x2000
  53. #define KEY_VALUE_DATA(k) ((PCHAR)(k) + (k)->DataOffset)
  54. //
  55. // Define PnpISA driver unique error code to specify where the error was reported.
  56. //
  57. #define PNPISA_INIT_ACQUIRE_PORT_RESOURCE 0x01
  58. #define PNPISA_INIT_MAP_PORT 0x02
  59. #define PNPISA_ACQUIREPORTRESOURCE_1 0x10
  60. #define PNPISA_ACQUIREPORTRESOURCE_2 0x11
  61. #define PNPISA_ACQUIREPORTRESOURCE_3 0x12
  62. #define PNPISA_CHECKBUS_1 0x20
  63. #define PNPISA_CHECKBUS_2 0x21
  64. #define PNPISA_CHECKDEVICE_1 0x30
  65. #define PNPISA_CHECKDEVICE_2 0x31
  66. #define PNPISA_CHECKDEVICE_3 0x32
  67. #define PNPISA_CHECKDEVICE_4 0x33
  68. #define PNPISA_CHECKDEVICE_5 0x34
  69. #define PNPISA_CHECKINSTALLED_1 0x40
  70. #define PNPISA_CHECKINSTALLED_2 0x41
  71. #define PNPISA_CHECKINSTALLED_3 0x42
  72. #define PNPISA_BIOSTONTRESOURCES_1 0x50
  73. #define PNPISA_BIOSTONTRESOURCES_2 0x51
  74. #define PNPISA_BIOSTONTRESOURCES_3 0x52
  75. #define PNPISA_BIOSTONTRESOURCES_4 0x53
  76. #define PNPISA_READBOOTRESOURCES_1 0x60
  77. #define PNPISA_READBOOTRESOURCES_2 0x61
  78. #define PNPISA_CLEANUP_1 0x70
  79. #define ISAPNP_IO_VERSION 1
  80. #define ISAPNP_IO_REVISION 1
  81. //
  82. // Structures
  83. //
  84. //
  85. // Extension data for Bus extender
  86. //
  87. typedef struct _PI_BUS_EXTENSION {
  88. //
  89. // Flags
  90. //
  91. ULONG Flags;
  92. //
  93. // Number of cards selected
  94. //
  95. UCHAR NumberCSNs;
  96. //
  97. // ReadDataPort addr
  98. //
  99. PUCHAR ReadDataPort;
  100. BOOLEAN DataPortMapped;
  101. //
  102. // Address Port
  103. //
  104. PUCHAR AddressPort;
  105. BOOLEAN AddrPortMapped;
  106. //
  107. // Command port
  108. //
  109. PUCHAR CommandPort;
  110. BOOLEAN CmdPortMapped;
  111. //
  112. // Next Slot Number to assign
  113. //
  114. ULONG NextSlotNumber;
  115. //
  116. // DeviceList is the DEVICE_INFORMATION link list.
  117. //
  118. SINGLE_LIST_ENTRY DeviceList;
  119. //
  120. // CardList is the list of CARD_INFORMATION
  121. //
  122. SINGLE_LIST_ENTRY CardList;
  123. //
  124. // Physical device object
  125. //
  126. PDEVICE_OBJECT PhysicalBusDevice;
  127. //
  128. // Functional device object
  129. //
  130. PDEVICE_OBJECT FunctionalBusDevice;
  131. //
  132. // Attached Device object
  133. //
  134. PDEVICE_OBJECT AttachedDevice;
  135. //
  136. // Bus Number
  137. //
  138. ULONG BusNumber;
  139. //
  140. // Power management data
  141. //
  142. //
  143. // System Power state of the device
  144. //
  145. SYSTEM_POWER_STATE SystemPowerState;
  146. //
  147. // Device power state of the device
  148. //
  149. DEVICE_POWER_STATE DevicePowerState;
  150. } PI_BUS_EXTENSION, *PPI_BUS_EXTENSION;
  151. //
  152. // CARD_INFORMATION Flags masks
  153. //
  154. typedef struct _CARD_INFORMATION_ {
  155. //
  156. // Next points to next CARD_INFORMATION structure
  157. //
  158. SINGLE_LIST_ENTRY CardList;
  159. //
  160. // Card select number for this Pnp Isa card.
  161. //
  162. UCHAR CardSelectNumber;
  163. //
  164. // Number logical devices in the card.
  165. //
  166. UCHAR NumberLogicalDevices;
  167. //
  168. // Logical device link list
  169. //
  170. SINGLE_LIST_ENTRY LogicalDeviceList;
  171. //
  172. // Pointer to card data which includes:
  173. // 9 byte serial identifier for the pnp isa card
  174. // PlugPlay Version number type for the pnp isa card
  175. // Identifier string resource type for the pnp isa card
  176. // Logical device Id resource type (repeat for each logical device)
  177. //
  178. PVOID CardData;
  179. ULONG CardDataLength;
  180. // Flags for card-specific workarounds
  181. ULONG CardFlags;
  182. } CARD_INFORMATION, *PCARD_INFORMATION;
  183. //
  184. // DEVICE_INFORMATION Flags masks
  185. //
  186. typedef struct _DEVICE_INFORMATION_ {
  187. //
  188. // Flags
  189. //
  190. ULONG Flags;
  191. //
  192. // Device power state of the device
  193. //
  194. DEVICE_POWER_STATE DevicePowerState;
  195. //
  196. // The device object of the device extension. I.e. the PDO
  197. //
  198. PDEVICE_OBJECT PhysicalDeviceObject;
  199. //
  200. // The isapnp bus extension which owns this device.
  201. //
  202. PPI_BUS_EXTENSION ParentDeviceExtension;
  203. //
  204. // Link list for ALL the Pnp Isa logical devices.
  205. // NextDevice points to next DEVICE_INFORMATION structure
  206. //
  207. SINGLE_LIST_ENTRY DeviceList;
  208. //
  209. // ResourceRequirements list
  210. //
  211. PIO_RESOURCE_REQUIREMENTS_LIST ResourceRequirements;
  212. //
  213. // Pointer to the CARD_INFORMATION for this device
  214. //
  215. PCARD_INFORMATION CardInformation;
  216. //
  217. // Link list for all the logical devices in a Pnp Isa card.
  218. //
  219. SINGLE_LIST_ENTRY LogicalDeviceList;
  220. //
  221. // LogicalDeviceNumber selects the corresponding logical device in the
  222. // pnp isa card specified by CSN.
  223. //
  224. UCHAR LogicalDeviceNumber;
  225. //
  226. // Pointer to device specific data
  227. //
  228. PUCHAR DeviceData;
  229. //
  230. // Length of the device data
  231. //
  232. ULONG DeviceDataLength;
  233. //
  234. // Boot resources
  235. //
  236. PCM_RESOURCE_LIST BootResources;
  237. ULONG BootResourcesLength;
  238. //
  239. // AllocatedResources
  240. //
  241. PCM_RESOURCE_LIST AllocatedResources;
  242. //
  243. // LogConfHandle - the LogConfHandle whose AllocatedResources needs to be deleted on removal irp.
  244. //
  245. HANDLE LogConfHandle;
  246. // Counts of how many paging and crash dump paths
  247. // this device is on.
  248. LONG Paging, CrashDump;
  249. } DEVICE_INFORMATION, *PDEVICE_INFORMATION;
  250. //
  251. // IRP dispatch routines
  252. //
  253. typedef
  254. NTSTATUS
  255. (*PPI_DISPATCH)(
  256. PDEVICE_OBJECT DeviceObject,
  257. PIRP Irp
  258. );
  259. //
  260. // These must be updated if any new PNP or PO IRPs are added
  261. //
  262. #define IRP_MN_PNP_MAXIMUM_FUNCTION IRP_MN_QUERY_LEGACY_BUS_INFORMATION
  263. #define IRP_MN_PO_MAXIMUM_FUNCTION IRP_MN_QUERY_POWER
  264. //
  265. // Flags definitions of DEVICE_INFORMATION and BUS_EXTENSION
  266. //
  267. #define DF_DELETED 0x00000001
  268. #define DF_REMOVED 0X00000002
  269. #define DF_NOT_FUNCTIONING 0x00000004
  270. #define DF_ENUMERATED 0x00000008
  271. #define DF_ACTIVATED 0x00000010
  272. #define DF_QUERY_STOPPED 0x00000020
  273. #define DF_SURPRISE_REMOVED 0x00000040
  274. #define DF_PROCESSING_RDP 0x00000080
  275. #define DF_STOPPED 0x00000100
  276. #define DF_RESTARTED_MOVED 0x00000200
  277. #define DF_RESTARTED_NOMOVE 0x00000400
  278. #define DF_REQ_TRIMMED 0x00000800
  279. #define DF_NEEDS_RESCAN 0x00001000
  280. #define DF_READ_DATA_PORT 0x40000000
  281. #define DF_BUS 0x80000000
  282. //
  283. // Flags definitions for card-related hacks
  284. //
  285. //
  286. #define CF_ISOLATION_BROKEN 0x00000001 /* once started, isolation is broken */
  287. #define CF_IGNORE_BOOTCONFIG 0x00000002 /* unusually sensitive to bad bioses */
  288. #define CF_FORCE_LEVEL 0x00000004 /* force level triggered interrupt */
  289. #define CF_FORCE_EDGE 0x00000008 /* force edge triggered interrupt */
  290. #define CF_IBM_MEMBOOTCONFIG 0x00000010 /* bad register on ibm isapnp token ring */
  291. // Possible bus states
  292. typedef enum {
  293. PiSUnknown, // not sure of exact state
  294. PiSWaitForKey, //
  295. PiSSleep, //
  296. PiSIsolation, // performing isolation sequence
  297. PiSConfig, // one card in config
  298. } PNPISA_STATE;
  299. //
  300. // The read data port range is from 0x200 - 0x3ff.
  301. // We will try the following optimal ranges first
  302. // if they all fail, we then pick any port from 0x200 - 0x3ff
  303. //
  304. // BEST:
  305. // One 4-byte range in 274-2FF
  306. // One 4-byte range in 374-3FF
  307. // One 4-byte range in 338-37F
  308. // One 4-byte range in 238-27F
  309. //
  310. // NORMAL:
  311. // One 4-byte range in 200-3FF
  312. //
  313. #define READ_DATA_PORT_RANGE_CHOICES 6
  314. typedef struct _READ_DATA_PORT_RANGE {
  315. ULONG MinimumAddress;
  316. ULONG MaximumAddress;
  317. ULONG Alignment;
  318. UCHAR CardsFound;
  319. } READ_DATA_PORT_RANGE, *PREAD_DATA_PORT_RANGE;
  320. //
  321. // List node for Bus Extensions.
  322. //
  323. typedef struct _BUS_EXTENSION_LIST {
  324. PVOID Next;
  325. PPI_BUS_EXTENSION BusExtension;
  326. } BUS_EXTENSION_LIST, *PBUS_EXTENSION_LIST;
  327. //
  328. // Constanct to control PipSelectLogicalDevice
  329. //
  330. #define SELECT_AND_ACTIVATE 0x1
  331. #define SELECT_AND_DEACTIVATE 0x2
  332. #define SELECT_ONLY 0x3
  333. //
  334. // Global Data references
  335. //
  336. extern PDRIVER_OBJECT PipDriverObject;
  337. extern UNICODE_STRING PipRegistryPath;
  338. extern PUCHAR PipReadDataPort;
  339. extern PUCHAR PipAddressPort;
  340. extern PUCHAR PipCommandPort;
  341. extern READ_DATA_PORT_RANGE PipReadDataPortRanges[];
  342. extern KEVENT PipDeviceTreeLock;
  343. extern KEVENT IsaBusNumberLock;
  344. extern ULONG BusNumber;
  345. extern ULONG ActiveIsaCount;
  346. extern PBUS_EXTENSION_LIST PipBusExtension;
  347. extern ULONG BusNumberBuffer[];
  348. extern RTL_BITMAP BusNumBMHeader;
  349. extern PRTL_BITMAP BusNumBM;
  350. extern PDEVICE_INFORMATION PipRDPNode;
  351. extern USHORT PipFirstInit;
  352. extern PPI_DISPATCH PiPnpDispatchTableFdo[];
  353. extern PPI_DISPATCH PiPnpDispatchTablePdo[];
  354. extern ULONG PipDebugMask;
  355. extern PNPISA_STATE PipState;
  356. extern BOOLEAN PipIsolationDisabled;
  357. //
  358. // Devnode / compat ID for the RDP
  359. //
  360. #define wReadDataPort (L"ReadDataPort")
  361. #define IDReadDataPort (L"PNPRDP")
  362. //
  363. // Global strings
  364. //
  365. #define DEVSTR_PNPISA_DEVICE_NAME (L"\\Device\\PnpIsa_Fdo_0")
  366. #define BRIDGE_CHECK_KEY (L"DeferBridge")
  367. extern WCHAR rgzPNPISADeviceName[sizeof(DEVSTR_PNPISA_DEVICE_NAME)/sizeof(WCHAR)];
  368. //
  369. // Prototypes
  370. //
  371. NTSTATUS
  372. PipPassIrp(
  373. PDEVICE_OBJECT pDeviceObject,
  374. PIRP pIrp
  375. );
  376. VOID
  377. PipCompleteRequest(
  378. IN OUT PIRP Irp,
  379. IN NTSTATUS Status,
  380. IN PVOID Information
  381. );
  382. NTSTATUS
  383. DriverEntry(
  384. IN PDRIVER_OBJECT DriverObject,
  385. IN PUNICODE_STRING RegistryPath
  386. );
  387. VOID
  388. PiUnload(
  389. IN PDRIVER_OBJECT DriverObject
  390. );
  391. NTSTATUS
  392. PipGetReadDataPort(
  393. PPI_BUS_EXTENSION BusExtension
  394. );
  395. NTSTATUS
  396. PiAddDevice(
  397. IN PDRIVER_OBJECT DriverObject,
  398. IN PDEVICE_OBJECT DeviceObject
  399. );
  400. NTSTATUS
  401. PiDispatchPnp(
  402. IN PDEVICE_OBJECT DeviceObject,
  403. IN OUT PIRP Irp
  404. );
  405. NTSTATUS
  406. PiDispatchPnpFdo(
  407. IN PDEVICE_OBJECT DeviceObject,
  408. IN OUT PIRP Irp
  409. );
  410. NTSTATUS
  411. PiDispatchPnpPdo(
  412. IN PDEVICE_OBJECT DeviceObject,
  413. IN OUT PIRP Irp
  414. );
  415. NTSTATUS
  416. PiDispatchPower(
  417. IN PDEVICE_OBJECT DeviceObject,
  418. IN OUT PIRP Irp
  419. );
  420. NTSTATUS
  421. PiDispatchDevCtl(
  422. IN PDEVICE_OBJECT DeviceObject,
  423. IN OUT PIRP Irp
  424. );
  425. NTSTATUS
  426. PiDispatchCreate(
  427. IN PDEVICE_OBJECT DeviceObject,
  428. IN OUT PIRP Irp
  429. );
  430. NTSTATUS
  431. PiDispatchClose(
  432. IN PDEVICE_OBJECT DeviceObject,
  433. IN OUT PIRP Irp
  434. );
  435. NTSTATUS
  436. PipGetCardIdentifier (
  437. PUCHAR CardData,
  438. PWCHAR *Buffer,
  439. PULONG BufferLength
  440. );
  441. NTSTATUS
  442. PipGetFunctionIdentifier (
  443. PUCHAR DeviceData,
  444. PWCHAR *Buffer,
  445. PULONG BufferLength
  446. );
  447. NTSTATUS
  448. PipQueryDeviceUniqueId (
  449. PDEVICE_INFORMATION DeviceInfo,
  450. PWCHAR *DeviceId,
  451. PULONG DeviceIdLength
  452. );
  453. NTSTATUS
  454. PipQueryDeviceId (
  455. PDEVICE_INFORMATION DeviceInfo,
  456. PWCHAR *DeviceId,
  457. PULONG DeviceIdLength,
  458. ULONG IdIndex
  459. );
  460. NTSTATUS
  461. PipQueryDeviceResources (
  462. PDEVICE_INFORMATION DeviceInfo,
  463. ULONG BusNumber,
  464. PCM_RESOURCE_LIST *CmResources,
  465. PULONG Length
  466. );
  467. NTSTATUS
  468. PipQueryDeviceResourceRequirements (
  469. PDEVICE_INFORMATION DeviceInfo,
  470. ULONG BusNumber,
  471. ULONG Slot,
  472. PCM_RESOURCE_LIST BootResources,
  473. USHORT IrqFlags,
  474. PIO_RESOURCE_REQUIREMENTS_LIST *IoResources,
  475. ULONG *Size
  476. );
  477. NTSTATUS
  478. PipSetDeviceResources (
  479. PDEVICE_INFORMATION DeviceInfo,
  480. PCM_RESOURCE_LIST CmResources
  481. );
  482. PVOID
  483. PipGetMappedAddress(
  484. IN INTERFACE_TYPE BusType,
  485. IN ULONG BusNumber,
  486. IN PHYSICAL_ADDRESS IoAddress,
  487. IN ULONG NumberOfBytes,
  488. IN ULONG AddressSpace,
  489. OUT PBOOLEAN MappedAddress
  490. );
  491. NTSTATUS
  492. PipMapReadDataPort (
  493. IN PPI_BUS_EXTENSION BusExtension,
  494. IN PHYSICAL_ADDRESS BaseAddressLow,
  495. IN ULONG PortLength
  496. );
  497. NTSTATUS
  498. PipMapAddressAndCmdPort (
  499. IN PPI_BUS_EXTENSION BusExtension
  500. );
  501. VOID
  502. PipDecompressEisaId(
  503. IN ULONG CompressedId,
  504. OUT PWCHAR EisaId
  505. );
  506. VOID
  507. PipCheckBus (
  508. IN PPI_BUS_EXTENSION BusExtension
  509. );
  510. NTSTATUS
  511. PipReadCardResourceData (
  512. OUT PUCHAR NumberLogicalDevices,
  513. IN PVOID *ResourceData,
  514. OUT PULONG ResourceDataLength
  515. );
  516. NTSTATUS
  517. PipReadDeviceResources (
  518. IN ULONG BusNumber,
  519. IN PUCHAR BiosRequirements,
  520. IN ULONG CardFlags,
  521. OUT PCM_RESOURCE_LIST *ResourceData,
  522. OUT PULONG Length,
  523. OUT PUSHORT irqFlags
  524. );
  525. USHORT
  526. PipIrqLevelRequirementsFromDeviceData(
  527. IN PUCHAR BiosRequirements, ULONG Length);
  528. NTSTATUS
  529. PipWriteDeviceResources (
  530. IN PUCHAR BiosRequirements,
  531. IN PCM_RESOURCE_LIST CmResources
  532. );
  533. VOID
  534. PipFixBootConfigIrqs(
  535. IN PCM_RESOURCE_LIST BootResources,
  536. IN USHORT irqFlags
  537. );
  538. VOID
  539. PipActivateDevice (
  540. );
  541. VOID
  542. PipDeactivateDevice (
  543. );
  544. VOID
  545. PipSelectLogicalDevice (
  546. IN USHORT Csn,
  547. IN USHORT LogicalDeviceNumber,
  548. IN ULONG Control
  549. );
  550. VOID
  551. PipLFSRInitiation (
  552. VOID
  553. );
  554. VOID
  555. PipIsolateCards (
  556. OUT PUCHAR NumberCSNs
  557. );
  558. VOID
  559. PipWakeAndSelectDevice(
  560. IN UCHAR Csn,
  561. IN UCHAR Device
  562. );
  563. ULONG
  564. PipFindNextLogicalDeviceTag (
  565. IN OUT PUCHAR *CardData,
  566. IN OUT LONG *Limit
  567. );
  568. NTSTATUS
  569. PipGetCompatibleDeviceId (
  570. PUCHAR DeviceData,
  571. ULONG IdIndex,
  572. PWCHAR *Buffer,
  573. PULONG BufferSize
  574. );
  575. VOID
  576. PipLogError(
  577. IN NTSTATUS ErrorCode,
  578. IN ULONG UniqueErrorValue,
  579. IN NTSTATUS FinalStatus,
  580. IN PULONG DumpData,
  581. IN ULONG DumpCount,
  582. IN USHORT StringLength,
  583. IN PWCHAR String
  584. );
  585. VOID
  586. PipCleanupAcquiredResources (
  587. IN PPI_BUS_EXTENSION BusExtension
  588. );
  589. PCARD_INFORMATION
  590. PipIsCardEnumeratedAlready(
  591. IN PPI_BUS_EXTENSION BusExtension,
  592. IN PUCHAR CardData,
  593. IN ULONG DataLength
  594. );
  595. NTSTATUS
  596. PipQueryDeviceRelations (
  597. IN PPI_BUS_EXTENSION BusExtension,
  598. PDEVICE_RELATIONS *DeviceRelations,
  599. BOOLEAN Removal
  600. );
  601. PDEVICE_INFORMATION
  602. PipReferenceDeviceInformation (
  603. PDEVICE_OBJECT DeviceObject, BOOLEAN ConfigHardware
  604. );
  605. VOID
  606. PipDereferenceDeviceInformation (
  607. PDEVICE_INFORMATION DeviceInformation, BOOLEAN ConfigHardware
  608. );
  609. VOID
  610. PipLockDeviceDatabase (
  611. VOID
  612. );
  613. VOID
  614. PipUnlockDeviceDatabase (
  615. VOID
  616. );
  617. NTSTATUS
  618. PipOpenRegistryKey(
  619. OUT PHANDLE Handle,
  620. IN HANDLE BaseHandle OPTIONAL,
  621. IN PUNICODE_STRING KeyName,
  622. IN ACCESS_MASK DesiredAccess,
  623. IN BOOLEAN Create
  624. );
  625. NTSTATUS
  626. PipGetRegistryValue(
  627. IN HANDLE KeyHandle,
  628. IN PWSTR ValueName,
  629. OUT PKEY_VALUE_FULL_INFORMATION *Information
  630. );
  631. NTSTATUS
  632. PipOpenCurrentHwProfileDeviceInstanceKey(
  633. OUT PHANDLE Handle,
  634. IN PUNICODE_STRING DeviceInstanceName,
  635. IN ACCESS_MASK DesiredAccess
  636. );
  637. NTSTATUS
  638. PipGetDeviceInstanceCsConfigFlags(
  639. IN PUNICODE_STRING DeviceInstance,
  640. OUT PULONG CsConfigFlags
  641. );
  642. NTSTATUS
  643. PipValidateResourceList(
  644. IN PCM_RESOURCE_LIST ResourceList,
  645. IN ULONG Length
  646. );
  647. NTSTATUS
  648. PiQueryInterface (
  649. IN PPI_BUS_EXTENSION BusExtension,
  650. IN OUT PIRP Irp
  651. );
  652. ULONG
  653. PipDetermineResourceListSize(
  654. IN PCM_RESOURCE_LIST ResourceList
  655. );
  656. VOID
  657. PipDeleteDevice (
  658. PDEVICE_OBJECT DeviceObject
  659. );
  660. NTSYSAPI
  661. NTSTATUS
  662. NTAPI
  663. ZwDeleteValueKey(
  664. IN HANDLE KeyHandle,
  665. IN PUNICODE_STRING ValueName
  666. );
  667. NTSTATUS
  668. PipReleaseInterfaces(
  669. IN PPI_BUS_EXTENSION PipBusExtension
  670. );
  671. NTSTATUS
  672. PipRebuildInterfaces(
  673. IN PPI_BUS_EXTENSION PipBusExtension
  674. );
  675. VOID
  676. PipResetGlobals (
  677. VOID
  678. );
  679. BOOLEAN
  680. PipMinimalCheckBus (
  681. IN PPI_BUS_EXTENSION BusExtension
  682. );
  683. NTSTATUS
  684. PipStartAndSelectRdp(
  685. PDEVICE_INFORMATION DeviceInfo,
  686. PPI_BUS_EXTENSION BusExtension,
  687. PDEVICE_OBJECT DeviceObject,
  688. PCM_RESOURCE_LIST StartResources
  689. );
  690. NTSTATUS
  691. PipStartReadDataPort(
  692. PDEVICE_INFORMATION DeviceInfo,
  693. PPI_BUS_EXTENSION BusExtension,
  694. PDEVICE_OBJECT DeviceObject,
  695. PCM_RESOURCE_LIST StartResources
  696. );
  697. NTSTATUS
  698. PipCreateReadDataPort(
  699. PPI_BUS_EXTENSION BusExtension
  700. );
  701. BOOLEAN
  702. PiNeedDeferISABridge(
  703. IN PDRIVER_OBJECT DriverObject,
  704. IN PDEVICE_OBJECT DeviceObject
  705. );
  706. void
  707. PipReleaseDeviceResources (
  708. PDEVICE_INFORMATION deviceInfo
  709. );
  710. VOID
  711. PipReportStateChange(
  712. PNPISA_STATE State
  713. );
  714. //
  715. // System defined levels
  716. //
  717. #define DEBUG_ERROR DPFLTR_ERROR_LEVEL
  718. #define DEBUG_WARN DPFLTR_WARNING_LEVEL
  719. #define DEBUG_TRACE DPFLTR_TRACE_LEVEL
  720. #define DEBUG_INFO DPFLTR_INFO_LEVEL
  721. //
  722. // Driver defined levels.
  723. // Or in DPFLTR_MASK so that these are interpreted
  724. // as mask values rather than levels.
  725. //
  726. #define DEBUG_PNP (0x00000010 | DPFLTR_MASK)
  727. #define DEBUG_POWER (0x00000020 | DPFLTR_MASK)
  728. #define DEBUG_STATE (0x00000040 | DPFLTR_MASK)
  729. #define DEBUG_ISOLATE (0x00000080 | DPFLTR_MASK)
  730. #define DEBUG_RDP (0x00000100 | DPFLTR_MASK)
  731. #define DEBUG_CARDRES (0x00000200 | DPFLTR_MASK)
  732. #define DEBUG_UNUSED (0x00000400 | DPFLTR_MASK)
  733. #define DEBUG_UNUSED2 (0x00000800 | DPFLTR_MASK)
  734. #define DEBUG_IRQ (0x00001000 | DPFLTR_MASK)
  735. #define DEBUG_RESOURCE (0x00002000 | DPFLTR_MASK)
  736. //
  737. // Set this bit to break in after printing a
  738. // debug message
  739. //
  740. #define DEBUG_BREAK 0x08000000
  741. VOID
  742. PipDebugPrint (
  743. ULONG Level,
  744. PCCHAR DebugMessage,
  745. ...
  746. );
  747. VOID
  748. PipDebugPrintContinue (
  749. ULONG Level,
  750. PCCHAR DebugMessage,
  751. ...
  752. );
  753. VOID
  754. PipDumpIoResourceDescriptor (
  755. IN PUCHAR Indent,
  756. IN PIO_RESOURCE_DESCRIPTOR Desc
  757. );
  758. VOID
  759. PipDumpIoResourceList (
  760. IN PIO_RESOURCE_REQUIREMENTS_LIST IoList
  761. );
  762. VOID
  763. PipDumpCmResourceDescriptor (
  764. IN PUCHAR Indent,
  765. IN PCM_PARTIAL_RESOURCE_DESCRIPTOR Desc
  766. );
  767. VOID
  768. PipDumpCmResourceList (
  769. IN PCM_RESOURCE_LIST CmList
  770. );
  771. #if DBG
  772. #define DebugPrint(arg) PipDebugPrint arg
  773. #define DebugPrintContinue(arg) PipDebugPrintContinue arg
  774. #else
  775. #define DebugPrint(arg)
  776. #define DebugPrintContinue(arg)
  777. #endif
  778. VOID
  779. PipUnlockDeviceDatabase (
  780. VOID
  781. );
  782. VOID
  783. PipLockDeviceDatabase (
  784. VOID
  785. );
  786. ULONG
  787. PipGetCardFlags(
  788. IN PCARD_INFORMATION CardInfo
  789. );
  790. NTSTATUS
  791. PipSaveBootIrqFlags(
  792. IN PDEVICE_INFORMATION DeviceInfo,
  793. IN USHORT IrqFlags
  794. );
  795. NTSTATUS
  796. PipGetBootIrqFlags(
  797. IN PDEVICE_INFORMATION DeviceInfo,
  798. OUT PUSHORT IrqFlags
  799. );
  800. NTSTATUS
  801. PipSaveBootResources(
  802. IN PDEVICE_INFORMATION DeviceInfo
  803. );
  804. NTSTATUS
  805. PipGetSavedBootResources(
  806. IN PDEVICE_INFORMATION DeviceInfo,
  807. OUT PCM_RESOURCE_LIST *BootResources
  808. );
  809. NTSTATUS
  810. PipTrimResourceRequirements (
  811. IN PIO_RESOURCE_REQUIREMENTS_LIST *IoList,
  812. IN USHORT IrqFlags,
  813. IN PCM_RESOURCE_LIST BootResources
  814. );
  815. //
  816. // Name of the volative key under the DeviceParameters key where data that needs
  817. // to be persistent accross removes, but NOT reboots is stored
  818. //
  819. #define BIOS_CONFIG_KEY_NAME L"BiosConfig"