sati_device.h revision 256281
140123Sdes/*-
249451Speter * This file is provided under a dual BSD/GPLv2 license.  When using or
3709Swollman * redistributing this file, you may do so under either license.
437Srgrimes *
537Srgrimes * GPL LICENSE SUMMARY
637Srgrimes *
737Srgrimes * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
837Srgrimes *
937Srgrimes * This program is free software; you can redistribute it and/or modify
108460Sjkh * it under the terms of version 2 of the GNU General Public License as
1143951Sjkh * published by the Free Software Foundation.
128460Sjkh *
138460Sjkh * This program is distributed in the hope that it will be useful, but
1437Srgrimes * WITHOUT ANY WARRANTY; without even the implied warranty of
1537Srgrimes * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1637Srgrimes * General Public License for more details.
1737Srgrimes *
1837Srgrimes * You should have received a copy of the GNU General Public License
1937Srgrimes * along with this program; if not, write to the Free Software
2037Srgrimes * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
2137Srgrimes * The full GNU General Public License is included in this distribution
2220684Sjoerg * in the file called LICENSE.GPL.
2337Srgrimes *
2437Srgrimes * BSD LICENSE
2543179Sdillon *
2643803Sdillon * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
2743179Sdillon * All rights reserved.
2843803Sdillon *
2943375Sdillon * Redistribution and use in source and binary forms, with or without
3043375Sdillon * modification, are permitted provided that the following conditions
3143803Sdillon * are met:
3243179Sdillon *
3343179Sdillon *   * Redistributions of source code must retain the above copyright
3443179Sdillon *     notice, this list of conditions and the following disclaimer.
3543219Speter *   * Redistributions in binary form must reproduce the above copyright
3643219Speter *     notice, this list of conditions and the following disclaimer in
3743849Sjkh *     the documentation and/or other materials provided with the
3843849Sjkh *     distribution.
3943849Sjkh *
4043219Speter * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4143219Speter * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
4243219Speter * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
4315568Sasami * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
4443803Sdillon * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
4515568Sasami * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
4615568Sasami * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
4715568Sasami * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
4845239Sgrog * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
4945239Sgrog * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
5045239Sgrog * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5143454Sgrog *
5242741Sgrog * $FreeBSD: stable/10/sys/dev/isci/scil/sati_device.h 231136 2012-02-07 17:43:58Z jimharris $
5342741Sgrog */
5443803Sdillon#ifndef _SATI_DEVICE_H_
553843Sdg#define _SATI_DEVICE_H_
5643803Sdillon
5737Srgrimes/**
5837Srgrimes * @file
5937Srgrimes * @brief This file contains all of the defintions for the SATI remote
6037Srgrimes *        device object.  Some translations require information to be
6137Srgrimes *        remembered on a per device basis.  This information is stored
6237Srgrimes *        in the object defined in this file.
6337Srgrimes */
6437Srgrimes
6537Srgrimes#include <dev/isci/scil/sati_types.h>
6637Srgrimes#include <dev/isci/scil/intel_ata.h>
6737Srgrimes
6837Srgrimes/**
6937Srgrimes * @enum _SATI_DEVICE_STATE
7037Srgrimes *
7137Srgrimes * @brief This enumeration depicts the various states possible for the a
7237Srgrimes *        translation remote device object.
7337Srgrimes */
7437Srgrimestypedef enum _SATI_DEVICE_STATE
7537Srgrimes{
7637Srgrimes   SATI_DEVICE_STATE_OPERATIONAL,
7737Srgrimes   SATI_DEVICE_STATE_STOPPED,
7837Srgrimes   SATI_DEVICE_STATE_STANDBY,
7937Srgrimes   SATI_DEVICE_STATE_IDLE,
8037Srgrimes   SATI_DEVICE_STATE_DEVICE_FAULT_OCCURRED,
8137Srgrimes   SATI_DEVICE_STATE_FORMAT_UNIT_IN_PROGRESS,
8237Srgrimes   SATI_DEVICE_STATE_SELF_TEST_IN_PROGRESS,
8337Srgrimes   SATI_DEVICE_STATE_SEQUENCE_INCOMPLETE,
8437Srgrimes   SATI_DEVICE_STATE_UNIT_ATTENTION_CONDITION
8537Srgrimes
8637Srgrimes} SATI_DEVICE_STATE;
872164Sdg
882164Sdg/**
8937Srgrimes * @name SATI_DEVICE_CAPABILITIES
9037Srgrimes *
9145222Scracauer * These constants define the various capabilities that a remote device may
9237Srgrimes * support for which there is an impact on translation.
9337Srgrimes */
9443197Sdillon/*@{*/
9543197Sdillon#define SATI_DEVICE_CAP_UDMA_ENABLE          0x00000001
9643197Sdillon#define SATI_DEVICE_CAP_NCQ_REQUESTED_ENABLE 0x00000002
971692Sphk#define SATI_DEVICE_CAP_NCQ_SUPPORTED_ENABLE 0x00000004
9843803Sdillon#define SATI_DEVICE_CAP_48BIT_ENABLE         0x00000008
9943197Sdillon#define SATI_DEVICE_CAP_DMA_FUA_ENABLE       0x00000010
10043803Sdillon#define SATI_DEVICE_CAP_SMART_SUPPORT        0x00000020
1018530Sdg#define SATI_DEVICE_CAP_REMOVABLE_MEDIA      0x00000040
10243803Sdillon#define SATI_DEVICE_CAP_SMART_ENABLE         0x00000080
10343803Sdillon#define SATI_DEVICE_CAP_WRITE_UNCORRECTABLE_ENABLE           0x00000100
10443803Sdillon#define SATI_DEVICE_CAP_MULTIPLE_SECTORS_PER_PHYSCIAL_SECTOR 0x00000200
10543803Sdillon#define SATI_DEVICE_CAP_SMART_SELF_TEST_SUPPORT              0x00000400
10643197Sdillon#define SATI_DEVICE_CAP_SSD                                  0x00000800
10743803Sdillon#define SATI_DEVICE_CAP_DSM_TRIM_SUPPORT                     0x00001000
10843197Sdillon#define SATI_DEVICE_CAP_DETERMINISTIC_READ_AFTER_TRIM        0x00002000
10943803Sdillon#define SATI_DEVICE_CAP_READ_ZERO_AFTER_TRIM                 0x00004000
11043197Sdillon#define SATI_DEVICE_CAP_STANDBY_ENABLE                       0x00008000
11143803Sdillon#define SATI_DEVICE_CAP_IGNORE_FUA                           0x00010000
11243803Sdillon
1138530Sdg
11443803Sdillon/*@}*/
11543803Sdillon
11643803Sdillon/**
11743803Sdillon * @struct SATI_DEVICE
11837Srgrimes *
11943197Sdillon * @brief The SATI_DEVICE structure define the state of the remote device
12043197Sdillon *        with respect to translation.
12143197Sdillon */
12243803Sdillontypedef struct SATI_DEVICE
12343803Sdillon{
12443803Sdillon   /**
12543803Sdillon    * This field simply dictates the state of the SATI device.
12643197Sdillon    */
12743197Sdillon   SATI_DEVICE_STATE state;
1284091Sache
129872Sache   /**
13038237Sbrian    * This field indicates features supported by the remote device that
13139384Sbrian    * impact translation execution.
13239384Sbrian    */
13339384Sbrian   U16 capabilities;
13439384Sbrian
13539384Sbrian   /**
13639384Sbrian    * This field indicates the depth of the native command queue supported
13739384Sbrian    * by the device.
13839384Sbrian    */
13939384Sbrian   U8 ncq_depth;
14039384Sbrian
14138237Sbrian   /**
14226450Sache    * This field stores the additional sense code for a unit attention
14338237Sbrian    * condition.
14439384Sbrian    */
14539384Sbrian   U8 unit_attention_asc;
14639384Sbrian
14739384Sbrian   /**
14838237Sbrian    * This field indicates the additional sense code qualifier for a unit
14921197Sphk    * attention condition.
15017767Sjkh    */
15119363Sjoerg   U8 unit_attention_ascq;
15217767Sjkh
15325184Sjkh   /**
15417767Sjkh    * This field indicates the ATA standby timer value set throught the
15517767Sjkh    * ATA IDLE and ATA Standby commands
15645096Simp    */
15745096Simp   U8 ata_standby_timer;
15845096Simp
15945096Simp   /**
16045096Simp    * This field indicates the maximum number of data set management
1611675Sache    * descriptor entries the device supports in blocks.
1627219Sjkh    */
1637293Sjkh   U16 max_lba_range_entry_blocks;
1641675Sache
1651675Sache   /**
16614596Snate    * The field is the reported logical block size for the device
16714624Snate    */
16814624Snate   U32 logical_block_size;
16914596Snate
17014596Snate   /**
17125184Sjkh    * This field is the maximum number of blocks per Download Microcode command
17225184Sjkh    * for this device.
17325184Sjkh    */
17425184Sjkh   U16 max_blocks_per_microcode_command;
1757460Sjkh
1767460Sjkh   /**
17738456Sphk   * This field is the minimum number of blocks per Download Microcode command
17829319Sbrian   * for this device.
17938456Sphk   */
1807487Srgrimes   U16 min_blocks_per_microcode_command;
1817487Srgrimes
18249366Simp   /**
18320828Sjoerg    * This field indicates the type of constructed sense data if enabled descriptor
18444752Sdes    * sense data will be constructed
1857487Srgrimes    */
1867487Srgrimes   U8 descriptor_sense_enable;
18738237Sbrian
18838237Sbrian} SATI_DEVICE_T;
18938237Sbrian
19031192Sstevevoid sati_device_construct(
19131192Ssteve   SATI_DEVICE_T * device,
19231192Ssteve   BOOL            is_ncq_enabled,
19331192Ssteve   U8              max_ncq_depth,
19431192Ssteve   BOOL            ignore_fua
19531192Ssteve);
19631192Ssteve
19731192Sstevevoid sati_device_update_capabilities(
19831192Ssteve   SATI_DEVICE_T              * device,
19931192Ssteve   ATA_IDENTIFY_DEVICE_DATA_T * identify
20031192Ssteve);
20131192Ssteve
20231192Ssteve#endif // _SATI_TRANSLATOR_SEQUENCE_H_
20331192Ssteve
20447661Sbrian