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