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.
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.
26 * Copyright(c) 2008 - 2010 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
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
40 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
41 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
42 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
43 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
44 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
46 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
47 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
48 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
49 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
50 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
57 #include <dev/isci/types.h>
62 * @brief This file defines all of the SATA releated constants, enumerations,
63 * and types. Please note that this file does not necessarily contain
64 * an exhaustive list of all contants and commands.
68 * @name SATA FIS Types
70 * These constants depict the various SATA FIS types devined in the serial ATA
74 #define SATA_FIS_TYPE_REGH2D 0x27
75 #define SATA_FIS_TYPE_REGD2H 0x34
76 #define SATA_FIS_TYPE_SETDEVBITS 0xA1
77 #define SATA_FIS_TYPE_DMA_ACTIVATE 0x39
78 #define SATA_FIS_TYPE_DMA_SETUP 0x41
79 #define SATA_FIS_TYPE_BIST_ACTIVATE 0x58
80 #define SATA_FIS_TYPE_PIO_SETUP 0x5F
81 #define SATA_FIS_TYPE_DATA 0x46
84 #define SATA_REGISTER_FIS_SIZE 0x20
87 * @struct SATA_FIS_HEADER
89 * @brief This is the common definition for a SATA FIS Header word. A
90 * different header word is defined for any FIS type that does not use
91 * the standard header.
93 typedef struct SATA_FIS_HEADER
95 U32 fis_type :8; // word 0
98 U32 direction_flag :1; // direction
99 U32 interrupt_flag :1;
100 U32 command_flag :1; // command, auto_activate, or notification
107 * @struct SATA_FIS_REG_H2D
109 * @brief This is the definition for a SATA Host to Device Register FIS.
111 typedef struct SATA_FIS_REG_H2D
113 U32 fis_type :8; // word 0
119 U32 lba_low :8; // word 1
123 U32 lba_low_exp :8; // word 2
127 U32 sector_count :8; // word 3
128 U32 sector_count_exp :8;
131 U32 reserved2; // word 4
132 } SATA_FIS_REG_H2D_T;
135 * @struct SATA_FIS_REG_D2H
137 * @brief SATA Device To Host FIS
139 typedef struct SATA_FIS_REG_D2H
141 U32 fis_type :8; // word 0
148 U8 lba_low; // word 1
152 U8 lba_low_exp; // word 2
156 U8 sector_count; // word 3
160 } SATA_FIS_REG_D2H_T;
163 * Status field bit definitions
165 #define SATA_FIS_STATUS_DEVBITS_MASK (0x77)
168 * @struct SATA_FIS_SET_DEV_BITS
170 * @brief SATA Set Device Bits FIS
172 typedef struct SATA_FIS_SET_DEV_BITS
174 U32 fis_type :8; // word 0
182 U32 s_active; // word 1
183 } SATA_FIS_SET_DEV_BITS_T;
186 * @struct SATA_FIS_DMA_ACTIVATE
188 * @brief SATA DMA Activate FIS
190 typedef struct SATA_FIS_DMA_ACTIVATE
192 U32 fis_type :8; // word 0
195 } SATA_FIS_DMA_ACTIVATE_T;
198 * The lower 5 bits in the DMA Buffer ID Low field of the DMA Setup
199 * are used to communicate the command tag.
201 #define SATA_DMA_SETUP_TAG_ENABLE 0x1F
203 #define SATA_DMA_SETUP_AUTO_ACT_ENABLE 0x80
206 * @struct SATA_FIS_DMA_SETUP
208 * @brief SATA DMA Setup FIS
210 typedef struct SATA_FIS_DMA_SETUP
212 U32 fis_type :8; // word 0
217 U32 auto_activate :1;
219 U32 dma_buffer_id_low; // word 1
220 U32 dma_buffer_id_high; // word 2
221 U32 reserved0; // word 3
222 U32 dma_buffer_offset; // word 4
223 U32 dma_transfer_count; // word 5
224 U32 reserved1; // word 6
225 } SATA_FIS_DMA_SETUP_T;
228 * @struct SATA_FIS_BIST_ACTIVATE
230 * @brief SATA BIST Activate FIS
232 typedef struct SATA_FIS_BIST_ACTIVATE
234 U32 fis_type :8; // word 0
236 U32 pattern_definition :8;
240 } SATA_FIS_BIST_ACTIVATE_T;
245 typedef struct SATA_FIS_PIO_SETUP
247 U32 fis_type :8; // word 0
255 U32 lba_low :8; // word 1
259 U32 lba_low_exp :8; // word 2
263 U32 sector_count :8; // word 3
264 U32 sector_count_exp :8;
266 U32 ending_status :8;
267 U32 transfter_count :16; // word 4
269 } SATA_FIS_PIO_SETUP_T;
272 * @struct SATA_FIS_DATA
274 * @brief SATA Data FIS
276 typedef struct SATA_FIS_DATA
278 U32 fis_type :8; // word 0
281 U8 data[4]; // word 1