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