intel_sata.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. /*
  2. * This file is provided under a dual BSD/GPLv2 license. When using or
  3. * redistributing this file, you may do so under either license.
  4. *
  5. * GPL LICENSE SUMMARY
  6. *
  7. * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of version 2 of the GNU General Public License as
  11. * published by the Free Software Foundation.
  12. *
  13. * This program is distributed in the hope that it will be useful, but
  14. * WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  21. * The full GNU General Public License is included in this distribution
  22. * in the file called LICENSE.GPL.
  23. *
  24. * BSD LICENSE
  25. *
  26. * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
  27. * All rights reserved.
  28. *
  29. * Redistribution and use in source and binary forms, with or without
  30. * modification, are permitted provided that the following conditions
  31. * are met:
  32. *
  33. * * Redistributions of source code must retain the above copyright
  34. * notice, this list of conditions and the following disclaimer.
  35. * * Redistributions in binary form must reproduce the above copyright
  36. * notice, this list of conditions and the following disclaimer in
  37. * the documentation and/or other materials provided with the
  38. * distribution.
  39. * * Neither the name of Intel Corporation nor the names of its
  40. * contributors may be used to endorse or promote products derived
  41. * from this software without specific prior written permission.
  42. *
  43. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  44. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  45. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  46. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  47. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  48. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  49. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  50. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  51. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  52. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  53. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  54. */
  55. #ifndef _SATA_H_
  56. #define _SATA_H_
  57. #include <linux/types.h>
  58. /**
  59. * This file defines all of the SATA releated constants, enumerations, and
  60. * types. Please note that this file does not necessarily contain an
  61. * exhaustive list of all contants and commands.
  62. *
  63. *
  64. */
  65. /**
  66. *
  67. *
  68. * SATA FIS Types These constants depict the various SATA FIS types devined in
  69. * the serial ATA specification.
  70. */
  71. #define SATA_FIS_TYPE_REGH2D 0x27
  72. #define SATA_FIS_TYPE_REGD2H 0x34
  73. #define SATA_FIS_TYPE_SETDEVBITS 0xA1
  74. #define SATA_FIS_TYPE_DMA_ACTIVATE 0x39
  75. #define SATA_FIS_TYPE_DMA_SETUP 0x41
  76. #define SATA_FIS_TYPE_BIST_ACTIVATE 0x58
  77. #define SATA_FIS_TYPE_PIO_SETUP 0x5F
  78. #define SATA_FIS_TYPE_DATA 0x46
  79. #define SATA_REGISTER_FIS_SIZE 0x20
  80. /**
  81. * struct sata_fis_header - This is the common definition for a SATA FIS Header
  82. * word. A different header word is defined for any FIS type that does not
  83. * use the standard header.
  84. *
  85. *
  86. */
  87. struct sata_fis_header {
  88. u32 fis_type:8; /* word 0 */
  89. u32 pm_port:4;
  90. u32 reserved:1;
  91. u32 direction_flag:1; /* direction */
  92. u32 interrupt_flag:1;
  93. u32 command_flag:1; /* command, auto_activate, or notification */
  94. u32 status:8;
  95. u32 error:8;
  96. };
  97. /**
  98. *
  99. *
  100. * Status field bit definitions
  101. */
  102. #define SATA_FIS_STATUS_DEVBITS_MASK (0x77)
  103. /**
  104. * struct sata_fis_set_dev_bits - SATA Set Device Bits FIS
  105. *
  106. *
  107. */
  108. struct sata_fis_set_dev_bits {
  109. u32 fis_type:8; /* word 0 */
  110. u32 pm_port:4;
  111. u32 reserved0:2;
  112. u32 irq:1;
  113. u32 notification:1;
  114. u32 status_low:4;
  115. u32 status_high:4;
  116. u32 error:8;
  117. u32 s_active; /* word 1 */
  118. };
  119. /**
  120. * struct sata_fis_dma_activate - SATA DMA Activate FIS
  121. *
  122. *
  123. */
  124. struct sata_fis_dma_activate {
  125. u32 fis_type:8; /* word 0 */
  126. u32 pm_port:4;
  127. u32 reserved0:24;
  128. };
  129. /**
  130. *
  131. *
  132. * The lower 5 bits in the DMA Buffer ID Low field of the DMA Setup are used to
  133. * communicate the command tag.
  134. */
  135. #define SATA_DMA_SETUP_TAG_ENABLE 0x1F
  136. #define SATA_DMA_SETUP_AUTO_ACT_ENABLE 0x80
  137. /**
  138. * struct sata_fis_dma_setup - SATA DMA Setup FIS
  139. *
  140. *
  141. */
  142. struct sata_fis_dma_setup {
  143. u32 fis_type:8; /* word 0 */
  144. u32 pm_port:4;
  145. u32 reserved_00:1;
  146. u32 direction:1;
  147. u32 irq:1;
  148. u32 auto_activate:1;
  149. u32 reserved_01:16;
  150. u32 dma_buffer_id_low; /* word 1 */
  151. u32 dma_buffer_id_high; /* word 2 */
  152. u32 reserved0; /* word 3 */
  153. u32 dma_buffer_offset; /* word 4 */
  154. u32 dma_transfer_count; /* word 5 */
  155. u32 reserved1; /* word 6 */
  156. };
  157. /**
  158. * struct sata_fis_bist_activate - SATA BIST Activate FIS
  159. *
  160. *
  161. */
  162. struct sata_fis_bist_activate {
  163. u32 fis_type:8; /* word 0 */
  164. u32 reserved0:8;
  165. u32 pattern_definition:8;
  166. u32 reserved1:8;
  167. u32 data1; /* word 1 */
  168. u32 data2; /* word 1 */
  169. };
  170. /*
  171. * SATA PIO Setup FIS
  172. */
  173. struct sata_fis_pio_setup {
  174. u32 fis_type:8; /* word 0 */
  175. u32 pm_port:4;
  176. u32 reserved_00:1;
  177. u32 direction:1;
  178. u32 irq:1;
  179. u32 reserved_01:1;
  180. u32 status:8;
  181. u32 error:8;
  182. u32 lba_low:8; /* word 1 */
  183. u32 lba_mid:8;
  184. u32 lba_high:8;
  185. u32 device:8;
  186. u32 lba_low_exp:8; /* word 2 */
  187. u32 lba_mid_exp:8;
  188. u32 lba_high_exp:8;
  189. u32 reserved:8;
  190. u32 sector_count:8; /* word 3 */
  191. u32 sector_count_exp:8;
  192. u32 reserved1:8;
  193. u32 ending_status:8;
  194. u32 transfter_count:16; /* word 4 */
  195. u32 reserved3:16;
  196. };
  197. /**
  198. * struct sata_fis_data - SATA Data FIS
  199. *
  200. *
  201. */
  202. struct sata_fis_data {
  203. u32 fis_type:8; /* word 0 */
  204. u32 pm_port:4;
  205. u32 reserved0:24;
  206. u8 data[4]; /* word 1 */
  207. };
  208. #endif /* _SATA_H_ */