isci: Convert SATA fis data structures to Linux native
[linux-2.6/x86.git] / drivers / scsi / isci / core / intel_sata.h
blob977354d7b8436a26c661b7b1c7b8bf63b4974af1
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.
5 * GPL LICENSE SUMMARY
7 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
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.
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.
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.
24 * BSD LICENSE
26 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
27 * All rights reserved.
29 * Redistribution and use in source and binary forms, with or without
30 * modification, are permitted provided that the following conditions
31 * are met:
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.
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.
56 #ifndef _SATA_H_
57 #define _SATA_H_
59 #include <linux/types.h>
61 /**
62 * This file defines all of the SATA releated constants, enumerations, and
63 * types. Please note that this file does not necessarily contain an
64 * exhaustive list of all contants and commands.
69 /**
72 * SATA FIS Types These constants depict the various SATA FIS types devined in
73 * the serial ATA specification.
75 #define SATA_FIS_TYPE_REGH2D 0x27
76 #define SATA_FIS_TYPE_REGD2H 0x34
77 #define SATA_FIS_TYPE_SETDEVBITS 0xA1
78 #define SATA_FIS_TYPE_DMA_ACTIVATE 0x39
79 #define SATA_FIS_TYPE_DMA_SETUP 0x41
80 #define SATA_FIS_TYPE_BIST_ACTIVATE 0x58
81 #define SATA_FIS_TYPE_PIO_SETUP 0x5F
82 #define SATA_FIS_TYPE_DATA 0x46
84 #define SATA_REGISTER_FIS_SIZE 0x20
86 /**
87 * struct sata_fis_header - This is the common definition for a SATA FIS Header
88 * word. A different header word is defined for any FIS type that does not
89 * use the standard header.
93 struct sata_fis_header {
94 u32 fis_type:8; /* word 0 */
95 u32 pm_port:4;
96 u32 reserved:1;
97 u32 direction_flag:1; /* direction */
98 u32 interrupt_flag:1;
99 u32 command_flag:1; /* command, auto_activate, or notification */
100 u32 status:8;
101 u32 error:8;
107 * Status field bit definitions
109 #define SATA_FIS_STATUS_DEVBITS_MASK (0x77)
112 * struct sata_fis_set_dev_bits - SATA Set Device Bits FIS
116 struct sata_fis_set_dev_bits {
117 u32 fis_type:8; /* word 0 */
118 u32 pm_port:4;
119 u32 reserved0:2;
120 u32 irq:1;
121 u32 notification:1;
122 u32 status_low:4;
123 u32 status_high:4;
124 u32 error:8;
125 u32 s_active; /* word 1 */
129 * struct sata_fis_dma_activate - SATA DMA Activate FIS
133 struct sata_fis_dma_activate {
134 u32 fis_type:8; /* word 0 */
135 u32 pm_port:4;
136 u32 reserved0:24;
142 * The lower 5 bits in the DMA Buffer ID Low field of the DMA Setup are used to
143 * communicate the command tag.
145 #define SATA_DMA_SETUP_TAG_ENABLE 0x1F
147 #define SATA_DMA_SETUP_AUTO_ACT_ENABLE 0x80
150 * struct sata_fis_dma_setup - SATA DMA Setup FIS
154 struct sata_fis_dma_setup {
155 u32 fis_type:8; /* word 0 */
156 u32 pm_port:4;
157 u32 reserved_00:1;
158 u32 direction:1;
159 u32 irq:1;
160 u32 auto_activate:1;
161 u32 reserved_01:16;
162 u32 dma_buffer_id_low; /* word 1 */
163 u32 dma_buffer_id_high; /* word 2 */
164 u32 reserved0; /* word 3 */
165 u32 dma_buffer_offset; /* word 4 */
166 u32 dma_transfer_count; /* word 5 */
167 u32 reserved1; /* word 6 */
171 * struct sata_fis_bist_activate - SATA BIST Activate FIS
175 struct sata_fis_bist_activate {
176 u32 fis_type:8; /* word 0 */
177 u32 reserved0:8;
178 u32 pattern_definition:8;
179 u32 reserved1:8;
180 u32 data1; /* word 1 */
181 u32 data2; /* word 1 */
185 * SATA PIO Setup FIS
187 struct sata_fis_pio_setup {
188 u32 fis_type:8; /* word 0 */
189 u32 pm_port:4;
190 u32 reserved_00:1;
191 u32 direction:1;
192 u32 irq:1;
193 u32 reserved_01:1;
194 u32 status:8;
195 u32 error:8;
196 u32 lba_low:8; /* word 1 */
197 u32 lba_mid:8;
198 u32 lba_high:8;
199 u32 device:8;
200 u32 lba_low_exp:8; /* word 2 */
201 u32 lba_mid_exp:8;
202 u32 lba_high_exp:8;
203 u32 reserved:8;
204 u32 sector_count:8; /* word 3 */
205 u32 sector_count_exp:8;
206 u32 reserved1:8;
207 u32 ending_status:8;
208 u32 transfter_count:16; /* word 4 */
209 u32 reserved3:16;
213 * struct sata_fis_data - SATA Data FIS
217 struct sata_fis_data {
218 u32 fis_type:8; /* word 0 */
219 u32 pm_port:4;
220 u32 reserved0:24;
221 u8 data[4]; /* word 1 */
224 #endif /* _SATA_H_ */