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.

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