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.

179 lines
3.7 KiB

  1. /*++
  2. Copyright (C) Microsoft Corporation, 1998 - 1999
  3. Module Name:
  4. rbc.h
  5. Abstract:
  6. These are the structures and defines used in the Reduced Block Command set
  7. Authors:
  8. George Chrysanthakopoulos(georgioc) - April 1998
  9. Revision History:
  10. Dan Knudson (DanKn), 23 Sep 1999 - updated per rev 10 of RBC spec
  11. --*/
  12. #ifndef _NTRBC_
  13. #define _NTRBC_
  14. #include "scsi.h"
  15. //
  16. // Command Descriptor Block. encapsulated under the bus/protocol specific request block
  17. //
  18. typedef union _CDB_RBC {
  19. //
  20. // format unit
  21. //
  22. struct _FORMAT_RBC {
  23. UCHAR OperationCode;
  24. UCHAR VendorSpecific;
  25. UCHAR Increment : 1;
  26. UCHAR Percent_Time : 1;
  27. UCHAR Reserved1 : 1;
  28. UCHAR VendorSpecific1 : 5;
  29. UCHAR Reserved2[2];
  30. UCHAR Control;
  31. } FORMAT_RBC, *PFORMAT_RBC;
  32. //
  33. // prevent/allow medium removal
  34. //
  35. struct _MEDIA_REMOVAL_RBC {
  36. UCHAR OperationCode;
  37. UCHAR Reserved[3];
  38. UCHAR Prevent : 1;
  39. UCHAR Persistant : 1;
  40. UCHAR Reserved3 : 6;
  41. UCHAR Control;
  42. } MEDIA_REMOVAL_RBC, *PMEDIA_REMOVAL_RBC;
  43. //
  44. // START_STOP_UNIT
  45. //
  46. struct _START_STOP_RBC {
  47. UCHAR OperationCode;
  48. UCHAR Immediate: 1;
  49. UCHAR Reserved1 : 7;
  50. UCHAR Reserved2[2];
  51. UCHAR Start : 1;
  52. UCHAR LoadEject : 1;
  53. UCHAR Reserved3 : 2;
  54. UCHAR PowerConditions : 4;
  55. UCHAR Control;
  56. } START_STOP_RBC, *PSTART_STOP_RBC;
  57. struct _SYNCHRONIZE_CACHE_RBC {
  58. UCHAR OperationCode; // 0x35
  59. UCHAR Reserved[8];
  60. UCHAR Control;
  61. } SYNCHRONIZE_CACHE_RBC, *PSYNCHRONIZE_CACHE_RBC;
  62. } CDB_RBC, *PCDB_RBC;
  63. //
  64. // START_STOP_UNIT Power Condition descriptions
  65. //
  66. #define START_STOP_RBC_POWER_CND_NO_CHANGE 0
  67. #define START_STOP_RBC_POWER_CND_ACTIVE 1
  68. #define START_STOP_RBC_POWER_CND_IDLE 2
  69. #define START_STOP_RBC_POWER_CND_STANDBY 3
  70. #define START_STOP_RBC_POWER_CND_SLEEP 5
  71. #define START_STOP_RBC_POWER_CND_DEVICE_CTRL 7
  72. //
  73. // Mode Sense/Select page constants.
  74. //
  75. #define MODE_PAGE_RBC_DEVICE_PARAMETERS 0x06
  76. //
  77. // DeviceType field in inquiry Data
  78. //
  79. #define RBC_DEVICE 0x0E
  80. //
  81. // Define Device Capabilities page.
  82. //
  83. typedef struct _MODE_RBC_DEVICE_PARAMETERS_PAGE {
  84. UCHAR PageCode : 6;
  85. UCHAR Reserved : 1;
  86. UCHAR PageSavable : 1;
  87. UCHAR PageLength;
  88. UCHAR WriteCacheDisable : 1;
  89. UCHAR Reserved1 : 7;
  90. UCHAR LogicalBlockSize[2];
  91. UCHAR NumberOfLogicalBlocks[5];
  92. UCHAR PowerPerformance;
  93. UCHAR LockDisabled : 1;
  94. UCHAR FormatDisabled : 1;
  95. UCHAR WriteDisabled : 1;
  96. UCHAR ReadDisabled : 1;
  97. UCHAR Reserved2 : 4;
  98. UCHAR Reserved3;
  99. }MODE_RBC_DEVICE_PARAMETERS_PAGE, *PMODE_RBC_DEVICE_PARAMETERS_PAGE;
  100. typedef struct _MODE_RBC_DEVICE_PARAMETERS_HEADER_AND_PAGE {
  101. MODE_PARAMETER_HEADER Header;
  102. MODE_RBC_DEVICE_PARAMETERS_PAGE Page;
  103. }MODE_RBC_DEVICE_PARAMETERS_HEADER_AND_PAGE,
  104. *PMODE_RBC_DEVICE_PARAMETERS_HEADER_AND_PAGE;
  105. //
  106. // unsolicited status sense code qualifier values
  107. //
  108. #define RBC_UNSOLICITED_STATUS 0x02
  109. #define RBC_UNSOLICITED_SENSE_KEY 0x06
  110. #define RBC_UNSOLICITED_SC_PWR_STATE_CHNG 0xFF
  111. #define RBC_UNSOLICITED_SC_EVENT_STATUS 0xFE
  112. #define RBC_UNSOLICITED_CLASS_ASQ_DEVICE 0x06
  113. #define RBC_UNSOLICITED_CLASS_ASQ_MEDIA 0x04
  114. #define RBC_UNSOLICITED_CLASS_ASQ_POWER 0x02
  115. //
  116. // Translation routine used to convert SCSI requests that differ from RBC
  117. //
  118. NTSTATUS
  119. Rbc_Scsi_Conversion(
  120. IN PSCSI_REQUEST_BLOCK Srb,
  121. IN PSCSI_REQUEST_BLOCK *OriginalSrb,
  122. IN PMODE_RBC_DEVICE_PARAMETERS_HEADER_AND_PAGE RbcHeaderAndPage,
  123. IN BOOLEAN OutgoingRequest,
  124. IN BOOLEAN RemovableMedia
  125. );
  126. #endif