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.

1046 lines
20 KiB

  1. #ifndef _MPATH_H_
  2. #define _MPATH_H_
  3. #include <ntddk.h>
  4. #include <wmilib.h>
  5. #include <ntdddisk.h>
  6. #include "dsm.h"
  7. #include "mpspf.h"
  8. #include "mpdevf.h"
  9. #include "mplib.h"
  10. #include "wmi.h"
  11. #include "stdarg.h"
  12. #include "stdio.h"
  13. //#define USE_BINARY_MOF_QUERY
  14. #define DD_MULTIPATH_CONTROL_DEVICE_NAME L"\\Device\\MPathControl"
  15. #define DD_MULTIPATH_CONTROL_DOS_NAME L"\\DosDevices\\MPathControl"
  16. #define MULTIPATH_CONTROL ((ULONG) 'mp')
  17. //
  18. // Internal IOCTL that control sends to it's children.
  19. //
  20. #define IOCTL_MPCTL_DEVFLTR_ARRIVED CTL_CODE (MULTIPATH_CONTROL, 0x20, METHOD_BUFFERED, FILE_ANY_ACCESS)
  21. #define IOCTL_MPCTL_DEVFLTR_REMOVED CTL_CODE (MULTIPATH_CONTROL, 0x21, METHOD_BUFFERED, FILE_ANY_ACCESS)
  22. //
  23. // Internal device types.
  24. //
  25. #define MPIO_CONTROL 0x00000001
  26. #define MPIO_MPDISK 0x00000002
  27. //
  28. // State Values.
  29. //
  30. #define MPIO_STATE_NORMAL 0x00000001
  31. #define MPIO_STATE_WAIT1 0x00000002
  32. #define MPIO_STATE_WAIT2 0x00000003
  33. #define MPIO_STATE_WAIT3 0x00000004
  34. #define MPIO_STATE_DEGRADED 0x00000005
  35. #define MPIO_STATE_IN_FO 0x00000006
  36. //
  37. // Arbitrarly Maximum Paths handled by one MPDisk
  38. //
  39. #define MAX_NUMBER_PATHS 0x00000008
  40. #define MAX_EMERGENCY_CONTEXT 32
  41. //
  42. // Inquiry data defines
  43. //
  44. #define VENDOR_ID_LENGTH 8
  45. #define PRODUCT_ID_LENGTH 16
  46. #define REVISION_LENGTH 4
  47. #define PDO_NAME_LENGTH 100
  48. #define FDO_NAME_LENGTH 128
  49. #define MPIO_STRING_LENGTH (sizeof(WCHAR)*63)
  50. //
  51. // Various thread operations.
  52. //
  53. #define INITIATE_FAILOVER 0x00000001
  54. #define SHUTDOWN 0x00000002
  55. #define FORCE_RESCAN 0x00000003
  56. #define PATH_REMOVAL 0x00000004
  57. #define DEVICE_REMOVAL 0x00000005
  58. extern PVOID CurrentFailurePath;
  59. typedef struct _MP_QUEUE {
  60. LIST_ENTRY ListEntry;
  61. ULONG QueuedItems;
  62. KSPIN_LOCK SpinLock;
  63. ULONG QueueIndicator;
  64. } MP_QUEUE, *PMP_QUEUE;
  65. typedef struct _MPIO_ADDRESS {
  66. UCHAR Bus;
  67. UCHAR Device;
  68. UCHAR Function;
  69. UCHAR Pad;
  70. } MPIO_ADDRESS, *PMPIO_ADDRESS;
  71. typedef struct _ID_ENTRY {
  72. LIST_ENTRY ListEntry;
  73. //
  74. // This is the path id. returned
  75. // from the DSM.
  76. //
  77. PVOID PathID;
  78. //
  79. // The port driver fdo.
  80. //
  81. PDEVICE_OBJECT PortFdo;
  82. //
  83. // The filter DO
  84. //
  85. PDEVICE_OBJECT AdapterFilter;
  86. //
  87. // Constructed 64-bit value to pass
  88. // to user-mode for path Identification
  89. //
  90. LONGLONG UID;
  91. //
  92. // The PCI Bus, Device, Function.
  93. //
  94. MPIO_ADDRESS Address;
  95. //
  96. // It's name.
  97. //
  98. UNICODE_STRING AdapterName;
  99. //
  100. // Indicates whether UID is valid.
  101. //
  102. BOOLEAN UIDValid;
  103. UCHAR Pad[3];
  104. } ID_ENTRY, *PID_ENTRY;
  105. typedef struct _DSM_ENTRY {
  106. LIST_ENTRY ListEntry;
  107. DSM_INQUIRE_DRIVER InquireDriver;
  108. DSM_COMPARE_DEVICES CompareDevices;
  109. DSM_SET_DEVICE_INFO SetDeviceInfo;
  110. DSM_GET_CONTROLLER_INFO GetControllerInfo;
  111. DSM_IS_PATH_ACTIVE IsPathActive;
  112. DSM_PATH_VERIFY PathVerify;
  113. DSM_INVALIDATE_PATH InvalidatePath;
  114. DSM_REMOVE_PENDING RemovePending;
  115. DSM_REMOVE_DEVICE RemoveDevice;
  116. DSM_REMOVE_PATH RemovePath;
  117. DSM_SRB_DEVICE_CONTROL SrbDeviceControl;
  118. DSM_REENABLE_PATH ReenablePath;
  119. DSM_LB_GET_PATH GetPath;
  120. DSM_INTERPRET_ERROR InterpretError;
  121. DSM_UNLOAD Unload;
  122. DSM_SET_COMPLETION SetCompletion;
  123. DSM_CATEGORIZE_REQUEST CategorizeRequest;
  124. DSM_BROADCAST_SRB BroadcastSrb;
  125. DSM_WMILIB_CONTEXT WmiContext;
  126. PVOID DsmContext;
  127. UNICODE_STRING DisplayName;
  128. } DSM_ENTRY, *PDSM_ENTRY;
  129. typedef struct _REAL_DEV_INFO {
  130. //
  131. // The adapter filter. Used as PathId.
  132. //
  133. PDEVICE_OBJECT AdapterFilter;
  134. //
  135. // Port driver FDO.
  136. //
  137. PDEVICE_OBJECT PortFdo;
  138. //
  139. // Optionally, the DSM can update 'path', so
  140. // this PVOID contains either the DSM value
  141. // or AdapterFilter.
  142. //
  143. PVOID PathId;
  144. //
  145. // Number of requests on this device.
  146. //
  147. LONG Requests;
  148. //
  149. // Used to enable upper-layers to match
  150. // adapters/paths/luns
  151. //
  152. ULONGLONG Identifier;
  153. //
  154. // The associated controller's id.
  155. //
  156. ULONGLONG ControllerId;
  157. //
  158. // The real scsiport PDO.
  159. //
  160. PDEVICE_OBJECT PortPdo;
  161. //
  162. // The device filter DO. Requests get sent
  163. // here.
  164. //
  165. PDEVICE_OBJECT DevFilter;
  166. //
  167. // The DSM's ID for the real DO
  168. //
  169. PVOID DsmID;
  170. //
  171. // Indicates whether this is an active or passive path.
  172. //
  173. BOOLEAN PathActive;
  174. BOOLEAN PathFailed;
  175. BOOLEAN DSMInit;
  176. BOOLEAN PathUIDValue;
  177. BOOLEAN NeedsRemoval;
  178. UCHAR Pad[3];
  179. SCSI_ADDRESS ScsiAddress;
  180. } REAL_DEV_INFO, *PREAL_DEV_INFO;
  181. typedef struct _MPDISK_EXTENSION {
  182. //
  183. // MPCtl's deviceObject.
  184. //
  185. PDEVICE_OBJECT ControlObject;
  186. //
  187. // The MPIO Disk Ordinal. Used in construction
  188. // of the device object and PnP IDs
  189. //
  190. ULONG DeviceOrdinal;
  191. //
  192. // Flags indicating:
  193. // whether a class driver has claimed the MPDisk.
  194. // Whether to run the State checking code.
  195. // Whether the device property name has been acquired (mpiowmi.c )
  196. // Whether the fail-over completed, and a new path has been set by the DSM.
  197. // Whether a transition to IN_FO is necessary.
  198. // Whether a missing path has come back.
  199. //
  200. BOOLEAN IsClaimed;
  201. BOOLEAN CheckState;
  202. BOOLEAN HasName;
  203. BOOLEAN NewPathSet;
  204. BOOLEAN FailOver;
  205. BOOLEAN PathBackOnLine;
  206. UCHAR Pad[2];
  207. //
  208. // Ref count of requests sent.
  209. //
  210. LONG OutstandingRequests;
  211. LONG ResubmitRequests;
  212. LONG FailOverRequests;
  213. //
  214. // List of requests that were outstanding at the time
  215. // that a Fail-Over event occurred. As each comes back
  216. // they are put on this queue.
  217. //
  218. MP_QUEUE ResubmitQueue;
  219. //
  220. // All new requests that arrive during the Fail-Over
  221. // operations are put on this queue.
  222. //
  223. MP_QUEUE FailOverQueue;
  224. //
  225. // Used to queue things to the thread.
  226. //
  227. LIST_ENTRY PendingWorkList;
  228. LIST_ENTRY WorkList;
  229. KSPIN_LOCK WorkListLock;
  230. KEVENT ThreadEvent;
  231. HANDLE Handle;
  232. //
  233. // Counter of items in the pending list.
  234. //
  235. ULONG PendingItems;
  236. //
  237. // Re-hash of the inquiry data + any serial number stuff
  238. // Used for PnP ID stuff and various WMI/IOCTLs
  239. // Just use the first one, as the other paths PDO all
  240. // are the same device.
  241. //
  242. PSTORAGE_DEVICE_DESCRIPTOR DeviceDescriptor;
  243. //
  244. // Indicates the max. number of paths that this
  245. // device object has seen.
  246. //
  247. ULONG MaxPaths;
  248. //
  249. // Bitmap used to show which array locations
  250. // are currently occupied.
  251. //
  252. ULONG DeviceMap;
  253. //
  254. // Indicates the path where the last request was sent.
  255. //
  256. PVOID CurrentPath;
  257. //
  258. // The most current failed path value.
  259. // Used to re-start the state machine after a F.O. completes.
  260. //
  261. PVOID FailedPath;
  262. //
  263. // Generic timer value inced by 1 sec. timer.
  264. //
  265. ULONG TickCount;
  266. //
  267. // Indicates the base time for doing
  268. // a rescan on adapters with failed devices.
  269. //
  270. ULONG RescanCount;
  271. PVOID FailedAdapter;
  272. //
  273. // G.P. SpinLock.
  274. //
  275. KSPIN_LOCK SpinLock;
  276. //
  277. // Array of Dsm IDs. Passed to several
  278. // DSM functions. Though a copy of what's in TargetInfo,
  279. // it speeds up handling requests.
  280. //
  281. DSM_IDS DsmIdList;
  282. ULONG Buffer[32];
  283. //
  284. // Number of valid TargetInfo elements in the following array.
  285. //
  286. ULONG TargetInfoCount;
  287. //
  288. // This is a list of the device filter DO's and scsiport PDO's
  289. // being handled by this MPIO PDO.
  290. //
  291. REAL_DEV_INFO TargetInfo[MAX_NUMBER_PATHS];
  292. DSM_ENTRY DsmInfo;
  293. UNICODE_STRING PdoName;
  294. } MPDISK_EXTENSION, *PMPDISK_EXTENSION;
  295. typedef struct _DISK_ENTRY {
  296. LIST_ENTRY ListEntry;
  297. //
  298. // The MPDisk D.O.
  299. //
  300. PDEVICE_OBJECT PdoObject;
  301. } DISK_ENTRY, *PDISK_ENTRY;
  302. #define FLTR_FLAGS_QDR 0x00000001
  303. #define FLTR_FLAGS_QDR_COMPLETE 0x00000002
  304. #define FLTR_FLAGS_NEED_RESCAN 0x00000004
  305. #define FLTR_FLAGS_RESCANNING 0x00000008
  306. typedef struct _FLTR_ENTRY {
  307. LIST_ENTRY ListEntry;
  308. //
  309. // The D.O. of the filter
  310. //
  311. PDEVICE_OBJECT FilterObject;
  312. PDEVICE_OBJECT PortFdo;
  313. PDEVICE_RELATIONS CachedRelations;
  314. PFLTR_DEVICE_LIST FltrGetDeviceList;
  315. ULONG Flags;
  316. } FLTR_ENTRY, *PFLTR_ENTRY;
  317. typedef struct _CONTROLLER_ENTRY {
  318. LIST_ENTRY ListEntry;
  319. //
  320. // The DSM controlling the controller.
  321. //
  322. PDSM_ENTRY Dsm;
  323. //
  324. // The actual info returned from the DSM.
  325. //
  326. PCONTROLLER_INFO ControllerInfo;
  327. } CONTROLLER_ENTRY, *PCONTROLLER_ENTRY;
  328. typedef struct _CONTROL_EXTENSION {
  329. //
  330. // Current number of MPDisk's
  331. //
  332. ULONG NumberDevices;
  333. //
  334. // Number Registered Adapter Filters.
  335. //
  336. ULONG NumberFilters;
  337. //
  338. // Number registers DSMs.
  339. //
  340. ULONG NumberDSMs;
  341. //
  342. // Number of paths that have been
  343. // discovered. Note that this isn't
  344. // necessarily the real state of the world, due
  345. // to when the value is updated.
  346. //
  347. ULONG NumberPaths;
  348. //
  349. // The number of controllers found from all DSM's.
  350. //
  351. ULONG NumberControllers;
  352. //
  353. // The of fail-over packets currently being
  354. // handled.
  355. //
  356. ULONG NumberFOPackets;
  357. //
  358. // SpinLock for list manipulations.
  359. //
  360. KSPIN_LOCK SpinLock;
  361. //
  362. // List of MPDisks.
  363. //
  364. LIST_ENTRY DeviceList;
  365. //
  366. // List of Filters
  367. //
  368. LIST_ENTRY FilterList;
  369. //
  370. // List of DSM's.
  371. //
  372. LIST_ENTRY DsmList;
  373. //
  374. // List of PathIdentifer structs.
  375. //
  376. LIST_ENTRY IdList;
  377. //
  378. // List of controller structs.
  379. //
  380. LIST_ENTRY ControllerList;
  381. //
  382. // List of failover packets.
  383. //
  384. LIST_ENTRY FailPacketList;
  385. } CONTROL_EXTENSION, *PCONTROL_EXTENSION;
  386. typedef struct _DEVICE_EXTENSION {
  387. //
  388. // Pointer to the device object.
  389. //
  390. PDEVICE_OBJECT DeviceObject;
  391. //
  392. // The dev filter device object if this is a PDO.
  393. // The PnP PDO, if this is the FDO.
  394. // The object to which requests get sent.
  395. //
  396. PDEVICE_OBJECT LowerDevice;
  397. //
  398. // Pdo (root)
  399. //
  400. PDEVICE_OBJECT Pdo;
  401. //
  402. // The driver object.
  403. //
  404. PDRIVER_OBJECT DriverObject;
  405. //
  406. // Identifies what type this is:
  407. // Control or pseudo disk.
  408. //
  409. ULONG Type;
  410. //
  411. // DeviceExtension - Either PDO or FDO depending
  412. // on value of Type.
  413. //
  414. PVOID TypeExtension;
  415. //
  416. // Request tracking tag.
  417. //
  418. LONG SequenceNumber;
  419. //
  420. // Current State of the world.
  421. // See defines above.
  422. //
  423. ULONG State;
  424. ULONG LastState;
  425. ULONG CompletionState;
  426. //
  427. // Some WMI stuff.
  428. //
  429. BOOLEAN FireLogEvent;
  430. UCHAR Reserved[3];
  431. WMILIB_CONTEXT WmiLib;
  432. //
  433. // Saved registry path string.
  434. //
  435. UNICODE_STRING RegistryPath;
  436. //
  437. // List of Completion Context structures.
  438. //
  439. NPAGED_LOOKASIDE_LIST ContextList;
  440. //
  441. // SpinLock for Emergency buffer handling.
  442. //
  443. KSPIN_LOCK EmergencySpinLock;
  444. //
  445. // Array of emergency context buffers.
  446. //
  447. PVOID EmergencyContext[MAX_EMERGENCY_CONTEXT];
  448. //
  449. // Bitmap of buffer usage.
  450. //
  451. ULONG EmergencyContextMap;
  452. //
  453. // Remove lock.
  454. //
  455. IO_REMOVE_LOCK RemoveLock;
  456. } DEVICE_EXTENSION, *PDEVICE_EXTENSION;
  457. typedef
  458. NTSTATUS
  459. (*PMPIO_COMPLETION_ROUTINE)(
  460. IN PDEVICE_OBJECT DeviceObject,
  461. IN PIRP Irp,
  462. IN PSCSI_REQUEST_BLOCK Srb,
  463. IN PVOID Context,
  464. IN OUT PBOOLEAN Retry,
  465. IN OUT PBOOLEAN Fatal
  466. );
  467. typedef
  468. VOID
  469. (*MPIO_CALLBACK)(
  470. IN PDEVICE_OBJECT DeviceObject,
  471. IN ULONG Operation,
  472. IN NTSTATUS Status
  473. );
  474. typedef struct _MPIO_CONTEXT {
  475. ULONG CurrentState;
  476. ULONG OriginalState;
  477. ULONG QueuedInto;
  478. BOOLEAN Allocated;
  479. BOOLEAN Freed;
  480. BOOLEAN ReIssued;
  481. UCHAR Reserved;
  482. ULONG EmergencyIndex;
  483. PIRP Irp;
  484. DSM_COMPLETION_INFO DsmCompletion;
  485. PREAL_DEV_INFO TargetInfo;
  486. SCSI_REQUEST_BLOCK Srb;
  487. } MPIO_CONTEXT, *PMPIO_CONTEXT;
  488. typedef struct _MPIO_THREAD_CONTEXT {
  489. PDEVICE_OBJECT DeviceObject;
  490. PKEVENT Event;
  491. } MPIO_THREAD_CONTEXT, *PMPIO_THREAD_CONTEXT;
  492. typedef struct _MPIO_REQUEST_INFO {
  493. LIST_ENTRY ListEntry;
  494. MPIO_CALLBACK RequestComplete;
  495. ULONG Operation;
  496. PVOID OperationSpecificInfo;
  497. ULONG ErrorMask;
  498. } MPIO_REQUEST_INFO, *PMPIO_REQUEST_INFO;
  499. typedef struct _MPIO_DEVICE_REMOVAL {
  500. PDEVICE_OBJECT DeviceObject;
  501. PREAL_DEV_INFO TargetInfo;
  502. } MPIO_DEVICE_REMOVAL, *PMPIO_DEVICE_REMOVAL;
  503. typedef struct _MPIO_FAILOVER_INFO {
  504. LIST_ENTRY ListEntry;
  505. PDEVICE_OBJECT DeviceObject;
  506. PVOID PathId;
  507. } MPIO_FAILOVER_INFO, *PMPIO_FAILOVER_INFO;
  508. NTSTATUS
  509. MPPdoGlobalCompletion(
  510. IN PDEVICE_OBJECT DeviceObject,
  511. IN PIRP Irp,
  512. IN PVOID Context
  513. );
  514. NTSTATUS
  515. MPIOResubmitCompletion(
  516. IN PDEVICE_OBJECT DeviceObject,
  517. IN PIRP Irp,
  518. IN PVOID Context
  519. );
  520. //
  521. // Routines in utils.c
  522. //
  523. NTSTATUS
  524. MPIOForwardRequest(
  525. IN PDEVICE_OBJECT DeviceObject,
  526. IN PIRP Irp
  527. );
  528. NTSTATUS
  529. MPIOSyncCompletion(
  530. IN PDEVICE_OBJECT DeviceObject,
  531. IN PIRP Irp,
  532. IN PVOID Context
  533. );
  534. PREAL_DEV_INFO
  535. MPIOGetTargetInfo(
  536. IN PMPDISK_EXTENSION DiskExtension,
  537. IN PVOID PathId,
  538. IN PDEVICE_OBJECT Filter
  539. );
  540. PDISK_ENTRY
  541. MPIOGetDiskEntry(
  542. IN PDEVICE_OBJECT DeviceObject,
  543. IN ULONG DiskIndex
  544. );
  545. BOOLEAN
  546. MPIOFindLowerDevice(
  547. IN PDEVICE_OBJECT MPDiskObject,
  548. IN PDEVICE_OBJECT LowerDevice
  549. );
  550. PDSM_ENTRY
  551. MPIOGetDsm(
  552. IN PDEVICE_OBJECT DeviceObject,
  553. IN ULONG DsmIndex
  554. );
  555. PFLTR_ENTRY
  556. MPIOGetFltrEntry(
  557. IN PDEVICE_OBJECT DeviceObject,
  558. IN PDEVICE_OBJECT PortFdo,
  559. IN PDEVICE_OBJECT AdapterFilter
  560. );
  561. NTSTATUS
  562. MPIOHandleNewDevice(
  563. IN PDEVICE_OBJECT DeviceObject,
  564. IN PDEVICE_OBJECT FilterObject,
  565. IN PDEVICE_OBJECT PortObject,
  566. IN PADP_DEVICE_INFO DeviceInfo,
  567. IN PDSM_ENTRY DsmEntry,
  568. IN PVOID DsmExtension
  569. );
  570. NTSTATUS
  571. MPIOGetScsiAddress(
  572. IN PDEVICE_OBJECT DeviceObject,
  573. OUT PSCSI_ADDRESS *ScsiAddress
  574. );
  575. PMPIO_CONTEXT
  576. MPIOAllocateContext(
  577. IN PDEVICE_EXTENSION DeviceExtension
  578. );
  579. VOID
  580. MPIOFreeContext(
  581. IN PDEVICE_EXTENSION DeviceExtension,
  582. IN PMPIO_CONTEXT Context
  583. );
  584. VOID
  585. MPIOCopyMemory(
  586. IN PVOID Destination,
  587. IN PVOID Source,
  588. IN ULONG Length
  589. );
  590. VOID
  591. MPIOCompleteRequest(
  592. IN PDEVICE_OBJECT DeviceObject,
  593. IN PIRP Irp,
  594. IN CCHAR Boost
  595. );
  596. NTSTATUS
  597. MPIOQueueRequest(
  598. IN PDEVICE_OBJECT DeviceObject,
  599. IN PIRP Irp,
  600. IN PMPIO_CONTEXT Context,
  601. IN PMP_QUEUE Queue
  602. );
  603. NTSTATUS
  604. MPIOFailOverHandler(
  605. IN PDEVICE_OBJECT DeviceObject,
  606. IN ULONG ErrorMask,
  607. IN PREAL_DEV_INFO FailingDevice
  608. );
  609. VOID
  610. MPIOSetRequestBusy(
  611. IN PSCSI_REQUEST_BLOCK Srb
  612. );
  613. PDEVICE_RELATIONS
  614. MPIOHandleDeviceRemovals(
  615. IN PDEVICE_OBJECT DeviceObject,
  616. IN PADP_DEVICE_LIST DeviceList,
  617. IN PDEVICE_RELATIONS Relations
  618. );
  619. NTSTATUS
  620. MPIOHandleDeviceArrivals(
  621. IN PDEVICE_OBJECT DeviceObject,
  622. IN PADP_DEVICE_LIST DeviceList,
  623. IN PDEVICE_RELATIONS CachedRelations,
  624. IN PDEVICE_RELATIONS Relations,
  625. IN PDEVICE_OBJECT PortObject,
  626. IN PDEVICE_OBJECT FilterObject,
  627. IN BOOLEAN NewList
  628. );
  629. NTSTATUS
  630. MPIORemoveDeviceAsync(
  631. IN PDEVICE_OBJECT DeviceObject,
  632. IN PREAL_DEV_INFO TargetInfo
  633. );
  634. NTSTATUS
  635. MPIOHandleRemoveAsync(
  636. IN PDEVICE_OBJECT DeviceObject,
  637. IN PREAL_DEV_INFO TargetInfo
  638. );
  639. NTSTATUS
  640. MPIORemoveSingleDevice(
  641. IN PDEVICE_OBJECT DeviceObject,
  642. IN PDEVICE_OBJECT Pdo
  643. );
  644. NTSTATUS
  645. MPIORemoveDevices(
  646. IN PDEVICE_OBJECT DeviceObject,
  647. IN PDEVICE_OBJECT AdapterFilter
  648. );
  649. NTSTATUS
  650. MPIOSetNewPath(
  651. IN PDEVICE_OBJECT DeviceObject,
  652. IN PVOID PathId
  653. );
  654. VOID
  655. MPIOSetFailed(
  656. IN PDEVICE_OBJECT DeviceObject,
  657. IN PVOID PathId
  658. );
  659. VOID
  660. MPIOSetState(
  661. IN PDEVICE_OBJECT DeviceObject,
  662. IN PVOID PathId,
  663. IN ULONG State
  664. );
  665. NTSTATUS
  666. MPIOCreatePathEntry(
  667. IN PDEVICE_OBJECT DeviceObject,
  668. IN PDEVICE_OBJECT FilterObject,
  669. IN PDEVICE_OBJECT PortFdo,
  670. IN PVOID PathID
  671. );
  672. NTSTATUS
  673. MPIOGetAdapterAddress(
  674. IN PDEVICE_OBJECT DeviceObject,
  675. IN OUT PMPIO_ADDRESS Address
  676. );
  677. LONGLONG
  678. MPIOCreateUID(
  679. IN PDEVICE_OBJECT DeviceObject,
  680. IN PVOID PathID
  681. );
  682. ULONGLONG
  683. MPIOBuildControllerInfo(
  684. IN PDEVICE_OBJECT ControlObect,
  685. IN PDSM_ENTRY Dsm,
  686. IN PVOID DsmID
  687. );
  688. ULONG
  689. MPIOHandleStateTransition(
  690. IN PDEVICE_OBJECT DeviceObject
  691. );
  692. NTSTATUS
  693. MPIOForceRescan(
  694. IN PDEVICE_OBJECT AdapterFilter
  695. );
  696. NTSTATUS
  697. MPIOCheckState(
  698. IN PDEVICE_OBJECT DeviceObject
  699. );
  700. //
  701. // Routines defined in fdo.c
  702. //
  703. NTSTATUS
  704. MPIOFdoPnP(
  705. IN PDEVICE_OBJECT DeviceObject,
  706. IN PIRP Irp
  707. );
  708. NTSTATUS
  709. MPIOFdoPower(
  710. IN PDEVICE_OBJECT DeviceObject,
  711. IN PIRP Irp
  712. );
  713. NTSTATUS
  714. MPIOFdoInternalDeviceControl(
  715. IN PDEVICE_OBJECT DeviceObject,
  716. IN PIRP Irp
  717. );
  718. PDEVICE_RELATIONS
  719. MPIOBuildRelations(
  720. IN PADP_DEVICE_LIST DeviceList
  721. );
  722. //
  723. // Routines defined in pdo.c
  724. //
  725. NTSTATUS
  726. MPIOPdoRegistration(
  727. IN PDEVICE_OBJECT MPDiskObject,
  728. IN PDEVICE_OBJECT FilterObject,
  729. IN PDEVICE_OBJECT LowerDevice,
  730. IN OUT PMPIO_PDO_INFO PdoInformation
  731. );
  732. BOOLEAN
  733. MPIOFindMatchingDevice(
  734. IN PDEVICE_OBJECT MPDiskObject,
  735. IN PADP_DEVICE_INFO DeviceInfo,
  736. IN PDSM_ENTRY DsmEntry,
  737. IN PVOID DsmId
  738. );
  739. NTSTATUS
  740. MPIOUpdateDevice(
  741. IN PDEVICE_OBJECT DeviceObject,
  742. IN PDEVICE_OBJECT AdapterFilter,
  743. IN PDEVICE_OBJECT PortObject,
  744. IN PADP_DEVICE_INFO DeviceInfo,
  745. IN PVOID DsmId
  746. );
  747. NTSTATUS
  748. MPIOCreateDevice(
  749. IN PDEVICE_OBJECT DeviceObject,
  750. IN PDEVICE_OBJECT FilterObject,
  751. IN PDEVICE_OBJECT PortObject,
  752. IN PADP_DEVICE_INFO DeviceInfo,
  753. IN PDSM_ENTRY DsmEntry,
  754. IN PVOID DsmId,
  755. IN OUT PDEVICE_OBJECT *NewDeviceObject
  756. );
  757. NTSTATUS
  758. MPIOPdoCreateClose(
  759. IN PDEVICE_OBJECT DeviceObject,
  760. IN PIRP Irp
  761. );
  762. NTSTATUS
  763. MPIOPdoDeviceControl(
  764. IN PDEVICE_OBJECT DeviceObject,
  765. IN PIRP Irp
  766. );
  767. NTSTATUS
  768. MPIOPdoInternalDeviceControl(
  769. IN PDEVICE_OBJECT DeviceObject,
  770. IN PIRP Irp
  771. );
  772. NTSTATUS
  773. MPIOPdoShutdownFlush(
  774. IN PDEVICE_OBJECT DeviceObject,
  775. IN PIRP Irp
  776. );
  777. NTSTATUS
  778. MPIOPdoPnp(
  779. IN PDEVICE_OBJECT DeviceObject,
  780. IN PIRP Irp
  781. );
  782. NTSTATUS
  783. MPIOPdoPower(
  784. IN PDEVICE_OBJECT DeviceObject,
  785. IN PIRP Irp
  786. );
  787. NTSTATUS
  788. MPIOPdoUnhandled(
  789. IN PDEVICE_OBJECT DeviceObject,
  790. IN PIRP Irp
  791. );
  792. //
  793. // Routines in pnp.c
  794. //
  795. NTSTATUS
  796. MPIOPdoQdr(
  797. IN PDEVICE_OBJECT DeviceObject,
  798. IN PIRP Irp
  799. );
  800. NTSTATUS
  801. MPIOPdoQueryId(
  802. IN PDEVICE_OBJECT DeviceObject,
  803. IN PIRP Irp
  804. );
  805. NTSTATUS
  806. MPIOQueryDeviceText(
  807. IN PDEVICE_OBJECT DeviceObject,
  808. IN PIRP Irp
  809. );
  810. //
  811. // Structs and Routines in queue.c
  812. //
  813. typedef struct _MPQUEUE_ENTRY {
  814. LIST_ENTRY ListEntry;
  815. PIRP Irp;
  816. } MPQUEUE_ENTRY, *PMPQUEUE_ENTRY;
  817. VOID
  818. MPIOInitQueue(
  819. IN PMP_QUEUE Queue,
  820. IN ULONG QueueTag
  821. );
  822. VOID
  823. MPIOInsertQueue(
  824. IN PMP_QUEUE Queue,
  825. IN PMPQUEUE_ENTRY QueueEntry
  826. );
  827. PMPQUEUE_ENTRY
  828. MPIORemoveQueue(
  829. IN PMP_QUEUE Queue
  830. );
  831. NTSTATUS
  832. MPIOIssueQueuedRequests(
  833. IN PREAL_DEV_INFO TargetInfo,
  834. IN PMP_QUEUE Queue,
  835. IN ULONG State,
  836. IN PULONG RequestCount
  837. );
  838. //
  839. // Thread.c
  840. //
  841. VOID
  842. MPIORecoveryThread(
  843. IN PVOID Context
  844. );
  845. //
  846. // Wmi.c
  847. //
  848. VOID
  849. MPIOSetupWmi(
  850. IN PDEVICE_OBJECT DeviceObject
  851. );
  852. NTSTATUS
  853. MPIOFdoWmi(
  854. IN PDEVICE_OBJECT DeviceObject,
  855. IN PIRP Irp
  856. );
  857. NTSTATUS
  858. MPIOPdoWmi(
  859. IN PDEVICE_OBJECT DeviceObject,
  860. IN PIRP Irp
  861. );
  862. NTSTATUS
  863. MPIOFireEvent(
  864. IN PDEVICE_OBJECT DeviceObject,
  865. IN PWCHAR ComponentName,
  866. IN PWCHAR EventDescription,
  867. IN ULONG Severity
  868. );
  869. #endif // _MPATH_H