fis.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. /*
  2. * Copyright (C) 2008 Freescale Semiconductor, Inc.
  3. * Dave Liu <daveliu@freescale.com>
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation; either version 2 of
  8. * the License, or (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  18. * MA 02111-1307 USA
  19. *
  20. */
  21. #ifndef __FIS_H__
  22. #define __FIS_H__
  23. /*
  24. * Register - Host to Device FIS
  25. */
  26. typedef struct sata_fis_h2d {
  27. u8 fis_type;
  28. u8 pm_port_c;
  29. u8 command;
  30. u8 features;
  31. u8 lba_low;
  32. u8 lba_mid;
  33. u8 lba_high;
  34. u8 device;
  35. u8 lba_low_exp;
  36. u8 lba_mid_exp;
  37. u8 lba_high_exp;
  38. u8 features_exp;
  39. u8 sector_count;
  40. u8 sector_count_exp;
  41. u8 res1;
  42. u8 control;
  43. u8 res2[4];
  44. } __attribute__ ((packed)) sata_fis_h2d_t;
  45. /*
  46. * Register - Host to Device FIS for read/write FPDMA queued
  47. */
  48. typedef struct sata_fis_h2d_ncq {
  49. u8 fis_type;
  50. u8 pm_port_c;
  51. u8 command;
  52. u8 sector_count_low;
  53. u8 lba_low;
  54. u8 lba_mid;
  55. u8 lba_high;
  56. u8 device;
  57. u8 lba_low_exp;
  58. u8 lba_mid_exp;
  59. u8 lba_high_exp;
  60. u8 sector_count_high;
  61. u8 tag;
  62. u8 res1;
  63. u8 res2;
  64. u8 control;
  65. u8 res3[4];
  66. } __attribute__ ((packed)) sata_fis_h2d_ncq_t;
  67. /*
  68. * Register - Device to Host FIS
  69. */
  70. typedef struct sata_fis_d2h {
  71. u8 fis_type;
  72. u8 pm_port_i;
  73. u8 status;
  74. u8 error;
  75. u8 lba_low;
  76. u8 lba_mid;
  77. u8 lba_high;
  78. u8 device;
  79. u8 lba_low_exp;
  80. u8 lba_mid_exp;
  81. u8 lba_high_exp;
  82. u8 res1;
  83. u8 sector_count;
  84. u8 sector_count_exp;
  85. u8 res2[2];
  86. u8 res3[4];
  87. } __attribute__ ((packed)) sata_fis_d2h_t;
  88. /*
  89. * DMA Setup - Device to Host or Host to Device FIS
  90. */
  91. typedef struct sata_fis_dma_setup {
  92. u8 fis_type;
  93. u8 pm_port_dir_int_act;
  94. u8 res1;
  95. u8 res2;
  96. u32 dma_buffer_id_low;
  97. u32 dma_buffer_id_high;
  98. u32 res3;
  99. u32 dma_buffer_offset;
  100. u32 dma_transfer_count;
  101. u32 res4;
  102. } __attribute__ ((packed)) sata_fis_dma_setup_t;
  103. /*
  104. * PIO Setup - Device to Host FIS
  105. */
  106. typedef struct sata_fis_pio_setup {
  107. u8 fis_type;
  108. u8 pm_port_dir_int;
  109. u8 status;
  110. u8 error;
  111. u8 lba_low;
  112. u8 lba_mid;
  113. u8 lba_high;
  114. u8 res1;
  115. u8 lba_low_exp;
  116. u8 lba_mid_exp;
  117. u8 lba_high_exp;
  118. u8 res2;
  119. u8 sector_count;
  120. u8 sector_count_exp;
  121. u8 res3;
  122. u8 e_status;
  123. u16 transfer_count;
  124. u16 res4;
  125. } __attribute__ ((packed)) sata_fis_pio_setup_t;
  126. /*
  127. * Data - Host to Device or Device to Host FIS
  128. */
  129. typedef struct sata_fis_data {
  130. u8 fis_type;
  131. u8 pm_port;
  132. u8 res1;
  133. u8 res2;
  134. u32 data[2048];
  135. } __attribute__ ((packed)) sata_fis_data_t;
  136. /* fis_type - SATA FIS type
  137. */
  138. enum sata_fis_type {
  139. SATA_FIS_TYPE_REGISTER_H2D = 0x27,
  140. SATA_FIS_TYPE_REGISTER_D2H = 0x34,
  141. SATA_FIS_TYPE_DMA_ACT_D2H = 0x39,
  142. SATA_FIS_TYPE_DMA_SETUP_BI = 0x41,
  143. SATA_FIS_TYPE_DATA_BI = 0x46,
  144. SATA_FIS_TYPE_BIST_ACT_BI = 0x58,
  145. SATA_FIS_TYPE_PIO_SETUP_D2H = 0x5F,
  146. SATA_FIS_TYPE_SET_DEVICE_BITS_D2H = 0xA1,
  147. };
  148. #endif /* __FIS_H__ */