2 * SPDX-License-Identifier: BSD-2-Clause OR GPL-2.0
4 * This file is provided under a dual BSD/GPLv2 license. When using or
5 * redistributing this file, you may do so under either license.
9 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of version 2 of the GNU General Public License as
13 * published by the Free Software Foundation.
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
23 * The full GNU General Public License is included in this distribution
24 * in the file called LICENSE.GPL.
28 * Copyright(c) 2008 - 2010 Intel Corporation. All rights reserved.
29 * All rights reserved.
31 * Redistribution and use in source and binary forms, with or without
32 * modification, are permitted provided that the following conditions
35 * * Redistributions of source code must retain the above copyright
36 * notice, this list of conditions and the following disclaimer.
37 * * Redistributions in binary form must reproduce the above copyright
38 * notice, this list of conditions and the following disclaimer in
39 * the documentation and/or other materials provided with the
42 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
43 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
44 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
45 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
46 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
47 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
48 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
49 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
50 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
51 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
52 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
59 #include <dev/isci/types.h>
64 * @brief This file defines all of the SATA releated constants, enumerations,
65 * and types. Please note that this file does not necessarily contain
66 * an exhaustive list of all contants and commands.
70 * @name SATA FIS Types
72 * These constants depict the various SATA FIS types devined in the serial ATA
76 #define SATA_FIS_TYPE_REGH2D 0x27
77 #define SATA_FIS_TYPE_REGD2H 0x34
78 #define SATA_FIS_TYPE_SETDEVBITS 0xA1
79 #define SATA_FIS_TYPE_DMA_ACTIVATE 0x39
80 #define SATA_FIS_TYPE_DMA_SETUP 0x41
81 #define SATA_FIS_TYPE_BIST_ACTIVATE 0x58
82 #define SATA_FIS_TYPE_PIO_SETUP 0x5F
83 #define SATA_FIS_TYPE_DATA 0x46
86 #define SATA_REGISTER_FIS_SIZE 0x20
89 * @struct SATA_FIS_HEADER
91 * @brief This is the common definition for a SATA FIS Header word. A
92 * different header word is defined for any FIS type that does not use
93 * the standard header.
95 typedef struct SATA_FIS_HEADER
97 U32 fis_type :8; // word 0
100 U32 direction_flag :1; // direction
101 U32 interrupt_flag :1;
102 U32 command_flag :1; // command, auto_activate, or notification
109 * @struct SATA_FIS_REG_H2D
111 * @brief This is the definition for a SATA Host to Device Register FIS.
113 typedef struct SATA_FIS_REG_H2D
115 U32 fis_type :8; // word 0
121 U32 lba_low :8; // word 1
125 U32 lba_low_exp :8; // word 2
129 U32 sector_count :8; // word 3
130 U32 sector_count_exp :8;
133 U32 reserved2; // word 4
134 } SATA_FIS_REG_H2D_T;
137 * @struct SATA_FIS_REG_D2H
139 * @brief SATA Device To Host FIS
141 typedef struct SATA_FIS_REG_D2H
143 U32 fis_type :8; // word 0
150 U8 lba_low; // word 1
154 U8 lba_low_exp; // word 2
158 U8 sector_count; // word 3
162 } SATA_FIS_REG_D2H_T;
165 * Status field bit definitions
167 #define SATA_FIS_STATUS_DEVBITS_MASK (0x77)
170 * @struct SATA_FIS_SET_DEV_BITS
172 * @brief SATA Set Device Bits FIS
174 typedef struct SATA_FIS_SET_DEV_BITS
176 U32 fis_type :8; // word 0
184 U32 s_active; // word 1
185 } SATA_FIS_SET_DEV_BITS_T;
188 * @struct SATA_FIS_DMA_ACTIVATE
190 * @brief SATA DMA Activate FIS
192 typedef struct SATA_FIS_DMA_ACTIVATE
194 U32 fis_type :8; // word 0
197 } SATA_FIS_DMA_ACTIVATE_T;
200 * The lower 5 bits in the DMA Buffer ID Low field of the DMA Setup
201 * are used to communicate the command tag.
203 #define SATA_DMA_SETUP_TAG_ENABLE 0x1F
205 #define SATA_DMA_SETUP_AUTO_ACT_ENABLE 0x80
208 * @struct SATA_FIS_DMA_SETUP
210 * @brief SATA DMA Setup FIS
212 typedef struct SATA_FIS_DMA_SETUP
214 U32 fis_type :8; // word 0
219 U32 auto_activate :1;
221 U32 dma_buffer_id_low; // word 1
222 U32 dma_buffer_id_high; // word 2
223 U32 reserved0; // word 3
224 U32 dma_buffer_offset; // word 4
225 U32 dma_transfer_count; // word 5
226 U32 reserved1; // word 6
227 } SATA_FIS_DMA_SETUP_T;
230 * @struct SATA_FIS_BIST_ACTIVATE
232 * @brief SATA BIST Activate FIS
234 typedef struct SATA_FIS_BIST_ACTIVATE
236 U32 fis_type :8; // word 0
238 U32 pattern_definition :8;
242 } SATA_FIS_BIST_ACTIVATE_T;
247 typedef struct SATA_FIS_PIO_SETUP
249 U32 fis_type :8; // word 0
257 U32 lba_low :8; // word 1
261 U32 lba_low_exp :8; // word 2
265 U32 sector_count :8; // word 3
266 U32 sector_count_exp :8;
268 U32 ending_status :8;
269 U32 transfter_count :16; // word 4
271 } SATA_FIS_PIO_SETUP_T;
274 * @struct SATA_FIS_DATA
276 * @brief SATA Data FIS
278 typedef struct SATA_FIS_DATA
280 U32 fis_type :8; // word 0
283 U8 data[4]; // word 1