1230557Sjimharris/*-
2230557Sjimharris * This file is provided under a dual BSD/GPLv2 license.  When using or
3230557Sjimharris * redistributing this file, you may do so under either license.
4230557Sjimharris *
5230557Sjimharris * GPL LICENSE SUMMARY
6230557Sjimharris *
7230557Sjimharris * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
8230557Sjimharris *
9230557Sjimharris * This program is free software; you can redistribute it and/or modify
10230557Sjimharris * it under the terms of version 2 of the GNU General Public License as
11230557Sjimharris * published by the Free Software Foundation.
12230557Sjimharris *
13230557Sjimharris * This program is distributed in the hope that it will be useful, but
14230557Sjimharris * WITHOUT ANY WARRANTY; without even the implied warranty of
15230557Sjimharris * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16230557Sjimharris * General Public License for more details.
17230557Sjimharris *
18230557Sjimharris * You should have received a copy of the GNU General Public License
19230557Sjimharris * along with this program; if not, write to the Free Software
20230557Sjimharris * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
21230557Sjimharris * The full GNU General Public License is included in this distribution
22230557Sjimharris * in the file called LICENSE.GPL.
23230557Sjimharris *
24230557Sjimharris * BSD LICENSE
25230557Sjimharris *
26230557Sjimharris * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
27230557Sjimharris * All rights reserved.
28230557Sjimharris *
29230557Sjimharris * Redistribution and use in source and binary forms, with or without
30230557Sjimharris * modification, are permitted provided that the following conditions
31230557Sjimharris * are met:
32230557Sjimharris *
33230557Sjimharris *   * Redistributions of source code must retain the above copyright
34230557Sjimharris *     notice, this list of conditions and the following disclaimer.
35230557Sjimharris *   * Redistributions in binary form must reproduce the above copyright
36230557Sjimharris *     notice, this list of conditions and the following disclaimer in
37230557Sjimharris *     the documentation and/or other materials provided with the
38230557Sjimharris *     distribution.
39230557Sjimharris *
40230557Sjimharris * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
41230557Sjimharris * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
42230557Sjimharris * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
43230557Sjimharris * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
44230557Sjimharris * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45230557Sjimharris * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
46230557Sjimharris * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
47230557Sjimharris * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
48230557Sjimharris * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
49230557Sjimharris * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
50230557Sjimharris * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
51230557Sjimharris *
52230557Sjimharris * $FreeBSD$
53230557Sjimharris */
54230557Sjimharris#ifndef _SATI_DEVICE_H_
55230557Sjimharris#define _SATI_DEVICE_H_
56230557Sjimharris
57230557Sjimharris/**
58230557Sjimharris * @file
59230557Sjimharris * @brief This file contains all of the defintions for the SATI remote
60230557Sjimharris *        device object.  Some translations require information to be
61230557Sjimharris *        remembered on a per device basis.  This information is stored
62230557Sjimharris *        in the object defined in this file.
63230557Sjimharris */
64230557Sjimharris
65230557Sjimharris#include <dev/isci/scil/sati_types.h>
66230557Sjimharris#include <dev/isci/scil/intel_ata.h>
67230557Sjimharris
68230557Sjimharris/**
69230557Sjimharris * @enum _SATI_DEVICE_STATE
70230557Sjimharris *
71230557Sjimharris * @brief This enumeration depicts the various states possible for the a
72230557Sjimharris *        translation remote device object.
73230557Sjimharris */
74230557Sjimharristypedef enum _SATI_DEVICE_STATE
75230557Sjimharris{
76230557Sjimharris   SATI_DEVICE_STATE_OPERATIONAL,
77230557Sjimharris   SATI_DEVICE_STATE_STOPPED,
78230557Sjimharris   SATI_DEVICE_STATE_STANDBY,
79230557Sjimharris   SATI_DEVICE_STATE_IDLE,
80230557Sjimharris   SATI_DEVICE_STATE_DEVICE_FAULT_OCCURRED,
81230557Sjimharris   SATI_DEVICE_STATE_FORMAT_UNIT_IN_PROGRESS,
82230557Sjimharris   SATI_DEVICE_STATE_SELF_TEST_IN_PROGRESS,
83230557Sjimharris   SATI_DEVICE_STATE_SEQUENCE_INCOMPLETE,
84230557Sjimharris   SATI_DEVICE_STATE_UNIT_ATTENTION_CONDITION
85230557Sjimharris
86230557Sjimharris} SATI_DEVICE_STATE;
87230557Sjimharris
88230557Sjimharris/**
89230557Sjimharris * @name SATI_DEVICE_CAPABILITIES
90230557Sjimharris *
91230557Sjimharris * These constants define the various capabilities that a remote device may
92230557Sjimharris * support for which there is an impact on translation.
93230557Sjimharris */
94230557Sjimharris/*@{*/
95230557Sjimharris#define SATI_DEVICE_CAP_UDMA_ENABLE          0x00000001
96230557Sjimharris#define SATI_DEVICE_CAP_NCQ_REQUESTED_ENABLE 0x00000002
97230557Sjimharris#define SATI_DEVICE_CAP_NCQ_SUPPORTED_ENABLE 0x00000004
98230557Sjimharris#define SATI_DEVICE_CAP_48BIT_ENABLE         0x00000008
99230557Sjimharris#define SATI_DEVICE_CAP_DMA_FUA_ENABLE       0x00000010
100230557Sjimharris#define SATI_DEVICE_CAP_SMART_SUPPORT        0x00000020
101230557Sjimharris#define SATI_DEVICE_CAP_REMOVABLE_MEDIA      0x00000040
102230557Sjimharris#define SATI_DEVICE_CAP_SMART_ENABLE         0x00000080
103230557Sjimharris#define SATI_DEVICE_CAP_WRITE_UNCORRECTABLE_ENABLE           0x00000100
104230557Sjimharris#define SATI_DEVICE_CAP_MULTIPLE_SECTORS_PER_PHYSCIAL_SECTOR 0x00000200
105230557Sjimharris#define SATI_DEVICE_CAP_SMART_SELF_TEST_SUPPORT              0x00000400
106230557Sjimharris#define SATI_DEVICE_CAP_SSD                                  0x00000800
107230557Sjimharris#define SATI_DEVICE_CAP_DSM_TRIM_SUPPORT                     0x00001000
108230557Sjimharris#define SATI_DEVICE_CAP_DETERMINISTIC_READ_AFTER_TRIM        0x00002000
109230557Sjimharris#define SATI_DEVICE_CAP_READ_ZERO_AFTER_TRIM                 0x00004000
110230557Sjimharris#define SATI_DEVICE_CAP_STANDBY_ENABLE                       0x00008000
111230557Sjimharris#define SATI_DEVICE_CAP_IGNORE_FUA                           0x00010000
112230557Sjimharris
113230557Sjimharris
114230557Sjimharris/*@}*/
115230557Sjimharris
116230557Sjimharris/**
117230557Sjimharris * @struct SATI_DEVICE
118230557Sjimharris *
119230557Sjimharris * @brief The SATI_DEVICE structure define the state of the remote device
120230557Sjimharris *        with respect to translation.
121230557Sjimharris */
122230557Sjimharristypedef struct SATI_DEVICE
123230557Sjimharris{
124230557Sjimharris   /**
125230557Sjimharris    * This field simply dictates the state of the SATI device.
126230557Sjimharris    */
127230557Sjimharris   SATI_DEVICE_STATE state;
128230557Sjimharris
129230557Sjimharris   /**
130230557Sjimharris    * This field indicates features supported by the remote device that
131230557Sjimharris    * impact translation execution.
132230557Sjimharris    */
133230557Sjimharris   U16 capabilities;
134230557Sjimharris
135230557Sjimharris   /**
136230557Sjimharris    * This field indicates the depth of the native command queue supported
137230557Sjimharris    * by the device.
138230557Sjimharris    */
139230557Sjimharris   U8 ncq_depth;
140230557Sjimharris
141230557Sjimharris   /**
142230557Sjimharris    * This field stores the additional sense code for a unit attention
143230557Sjimharris    * condition.
144230557Sjimharris    */
145230557Sjimharris   U8 unit_attention_asc;
146230557Sjimharris
147230557Sjimharris   /**
148230557Sjimharris    * This field indicates the additional sense code qualifier for a unit
149230557Sjimharris    * attention condition.
150230557Sjimharris    */
151230557Sjimharris   U8 unit_attention_ascq;
152230557Sjimharris
153230557Sjimharris   /**
154230557Sjimharris    * This field indicates the ATA standby timer value set throught the
155230557Sjimharris    * ATA IDLE and ATA Standby commands
156230557Sjimharris    */
157230557Sjimharris   U8 ata_standby_timer;
158230557Sjimharris
159230557Sjimharris   /**
160230557Sjimharris    * This field indicates the maximum number of data set management
161230557Sjimharris    * descriptor entries the device supports in blocks.
162230557Sjimharris    */
163230557Sjimharris   U16 max_lba_range_entry_blocks;
164230557Sjimharris
165230557Sjimharris   /**
166230557Sjimharris    * The field is the reported logical block size for the device
167230557Sjimharris    */
168230557Sjimharris   U32 logical_block_size;
169230557Sjimharris
170230557Sjimharris   /**
171230557Sjimharris    * This field is the maximum number of blocks per Download Microcode command
172230557Sjimharris    * for this device.
173230557Sjimharris    */
174230557Sjimharris   U16 max_blocks_per_microcode_command;
175230557Sjimharris
176230557Sjimharris   /**
177230557Sjimharris   * This field is the minimum number of blocks per Download Microcode command
178230557Sjimharris   * for this device.
179230557Sjimharris   */
180230557Sjimharris   U16 min_blocks_per_microcode_command;
181230557Sjimharris
182230557Sjimharris   /**
183230557Sjimharris    * This field indicates the type of constructed sense data if enabled descriptor
184230557Sjimharris    * sense data will be constructed
185230557Sjimharris    */
186230557Sjimharris   U8 descriptor_sense_enable;
187230557Sjimharris
188230557Sjimharris} SATI_DEVICE_T;
189230557Sjimharris
190230557Sjimharrisvoid sati_device_construct(
191230557Sjimharris   SATI_DEVICE_T * device,
192230557Sjimharris   BOOL            is_ncq_enabled,
193230557Sjimharris   U8              max_ncq_depth,
194230557Sjimharris   BOOL            ignore_fua
195230557Sjimharris);
196230557Sjimharris
197230557Sjimharrisvoid sati_device_update_capabilities(
198230557Sjimharris   SATI_DEVICE_T              * device,
199230557Sjimharris   ATA_IDENTIFY_DEVICE_DATA_T * identify
200230557Sjimharris);
201230557Sjimharris
202230557Sjimharris#endif // _SATI_TRANSLATOR_SEQUENCE_H_
203230557Sjimharris
204