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 22 #ifndef __FIS_H__ 23 #define __FIS_H__ 24 /* 25 * Register - Host to Device FIS 26 */ 27 typedef struct sata_fis_h2d { 28 u8 fis_type; 29 u8 pm_port_c; 30 u8 command; 31 u8 features; 32 u8 lba_low; 33 u8 lba_mid; 34 u8 lba_high; 35 u8 device; 36 u8 lba_low_exp; 37 u8 lba_mid_exp; 38 u8 lba_high_exp; 39 u8 features_exp; 40 u8 sector_count; 41 u8 sector_count_exp; 42 u8 res1; 43 u8 control; 44 u8 res2[4]; 45 } __attribute__ ((packed)) sata_fis_h2d_t; 46 47 /* 48 * Register - Host to Device FIS for read/write FPDMA queued 49 */ 50 typedef struct sata_fis_h2d_ncq { 51 u8 fis_type; 52 u8 pm_port_c; 53 u8 command; 54 u8 sector_count_low; 55 u8 lba_low; 56 u8 lba_mid; 57 u8 lba_high; 58 u8 device; 59 u8 lba_low_exp; 60 u8 lba_mid_exp; 61 u8 lba_high_exp; 62 u8 sector_count_high; 63 u8 tag; 64 u8 res1; 65 u8 res2; 66 u8 control; 67 u8 res3[4]; 68 } __attribute__ ((packed)) sata_fis_h2d_ncq_t; 69 70 /* 71 * Register - Device to Host FIS 72 */ 73 typedef struct sata_fis_d2h { 74 u8 fis_type; 75 u8 pm_port_i; 76 u8 status; 77 u8 error; 78 u8 lba_low; 79 u8 lba_mid; 80 u8 lba_high; 81 u8 device; 82 u8 lba_low_exp; 83 u8 lba_mid_exp; 84 u8 lba_high_exp; 85 u8 res1; 86 u8 sector_count; 87 u8 sector_count_exp; 88 u8 res2[2]; 89 u8 res3[4]; 90 } __attribute__ ((packed)) sata_fis_d2h_t; 91 92 /* 93 * DMA Setup - Device to Host or Host to Device FIS 94 */ 95 typedef struct sata_fis_dma_setup { 96 u8 fis_type; 97 u8 pm_port_dir_int_act; 98 u8 res1; 99 u8 res2; 100 u32 dma_buffer_id_low; 101 u32 dma_buffer_id_high; 102 u32 res3; 103 u32 dma_buffer_offset; 104 u32 dma_transfer_count; 105 u32 res4; 106 } __attribute__ ((packed)) sata_fis_dma_setup_t; 107 108 /* 109 * PIO Setup - Device to Host FIS 110 */ 111 typedef struct sata_fis_pio_setup { 112 u8 fis_type; 113 u8 pm_port_dir_int; 114 u8 status; 115 u8 error; 116 u8 lba_low; 117 u8 lba_mid; 118 u8 lba_high; 119 u8 res1; 120 u8 lba_low_exp; 121 u8 lba_mid_exp; 122 u8 lba_high_exp; 123 u8 res2; 124 u8 sector_count; 125 u8 sector_count_exp; 126 u8 res3; 127 u8 e_status; 128 u16 transfer_count; 129 u16 res4; 130 } __attribute__ ((packed)) sata_fis_pio_setup_t; 131 132 /* 133 * Data - Host to Device or Device to Host FIS 134 */ 135 typedef struct sata_fis_data { 136 u8 fis_type; 137 u8 pm_port; 138 u8 res1; 139 u8 res2; 140 u32 data[2048]; 141 } __attribute__ ((packed)) sata_fis_data_t; 142 143 /* fis_type - SATA FIS type 144 */ 145 enum sata_fis_type { 146 SATA_FIS_TYPE_REGISTER_H2D = 0x27, 147 SATA_FIS_TYPE_REGISTER_D2H = 0x34, 148 SATA_FIS_TYPE_DMA_ACT_D2H = 0x39, 149 SATA_FIS_TYPE_DMA_SETUP_BI = 0x41, 150 SATA_FIS_TYPE_DATA_BI = 0x46, 151 SATA_FIS_TYPE_BIST_ACT_BI = 0x58, 152 SATA_FIS_TYPE_PIO_SETUP_D2H = 0x5F, 153 SATA_FIS_TYPE_SET_DEVICE_BITS_D2H = 0xA1, 154 }; 155 156 #endif /* __FIS_H__ */ 157