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.

176 lines
3.0 KiB

  1. /*++
  2. Copyright (c) 2001 Microsoft Corporation
  3. Module Name:
  4. slgateway.h
  5. Abstract:
  6. Declaration of a gateway class that manages multiple interrelated
  7. sub-devices on a device.
  8. See gateway.c for more information.
  9. Author:
  10. Matthew D Hendel (math) 15-June-2000
  11. Revision History:
  12. --*/
  13. #pragma once
  14. typedef
  15. VOID
  16. (*PSTOR_IO_GATEWAY_BUSY_ROUTINE)(
  17. IN PVOID Context,
  18. IN LONG OutstandingRequests,
  19. OUT PLONG HighWaterMark,
  20. OUT PLONG LowWaterMark
  21. );
  22. typedef struct _STOR_IO_GATEWAY {
  23. //
  24. // Spinlock that protects the data in the adapter queue.
  25. //
  26. // PERF NOTE: This lock is the only adapter-wide lock
  27. // acquired in the IO path. Therefore, it is probably
  28. // the hottest lock in raidport. We should investigate
  29. // to accomplish this functionality without locking or
  30. // using only interlocked operations.
  31. //
  32. KSPIN_LOCK Lock;
  33. //
  34. // At the high water mark we should stop submitting requests to
  35. // the adapter.
  36. //
  37. // Protected by: Lock
  38. //
  39. LONG HighWaterMark;
  40. //
  41. // If we are busy and have dropped below the low water mark, we
  42. // can continue submitting requests to the unit queue.
  43. //
  44. // Protected by: Lock
  45. //
  46. LONG LowWaterMark;
  47. //
  48. // The number of outstanding requests the adapter is currently
  49. // processing.
  50. //
  51. // Protected by: Lock
  52. //
  53. LONG Outstanding;
  54. //
  55. // Count of how many times the gateway has been busied.
  56. //
  57. // Protected by: Lock
  58. //
  59. LONG BusyCount;
  60. //
  61. // Count of how many time the gateway has been paused.
  62. //
  63. LONG PauseCount;
  64. //
  65. // Information about how elements are queued to the device when it's
  66. // busy.
  67. //
  68. PSTOR_IO_GATEWAY_BUSY_ROUTINE BusyRoutine;
  69. //
  70. // Context information for the busy routine.
  71. //
  72. PVOID BusyContext;
  73. //
  74. // If non-NULL points to an event that should be set when the queue is
  75. // empty.
  76. //
  77. PKEVENT EmptyEvent;
  78. } STOR_IO_GATEWAY, *PSTOR_IO_GATEWAY;
  79. VOID
  80. StorCreateIoGateway(
  81. IN PSTOR_IO_GATEWAY Gateway,
  82. IN PSTOR_IO_GATEWAY_BUSY_ROUTINE BusyRoutine,
  83. IN PVOID BusyContext
  84. );
  85. BOOLEAN
  86. StorSubmitIoGatewayItem(
  87. IN PSTOR_IO_GATEWAY Gateway
  88. );
  89. BOOLEAN
  90. StorRemoveIoGatewayItem(
  91. IN PSTOR_IO_GATEWAY Gateway
  92. );
  93. //
  94. // Busy processing on the gateway.
  95. //
  96. VOID
  97. StorBusyIoGateway(
  98. IN PSTOR_IO_GATEWAY Gateway
  99. );
  100. VOID
  101. StorBusyIoGatewayEx(
  102. IN PSTOR_IO_GATEWAY Gateway,
  103. IN ULONG RequestsToComplete
  104. );
  105. BOOLEAN
  106. StorIsIoGatewayBusy(
  107. IN PSTOR_IO_GATEWAY Queue
  108. );
  109. VOID
  110. StorReadyIoGateway(
  111. IN PSTOR_IO_GATEWAY Gateway
  112. );
  113. LONG
  114. StorPauseIoGateway(
  115. IN PSTOR_IO_GATEWAY Gateway
  116. );
  117. BOOLEAN
  118. StorIsIoGatewayPaused(
  119. IN PSTOR_IO_GATEWAY Gateway
  120. );
  121. LONG
  122. StorResumeIoGateway(
  123. IN PSTOR_IO_GATEWAY Gateway
  124. );
  125. VOID
  126. StorSetIoGatewayEmptyEvent(
  127. IN PSTOR_IO_GATEWAY Gateway,
  128. IN PKEVENT Event
  129. );