OSDN Git Service

isci: Intel(R) C600 Series Chipset Storage Control Unit Driver
[android-x86/kernel.git] / drivers / scsi / isci / core / sati_device.h
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.
4  *
5  * GPL LICENSE SUMMARY
6  *
7  * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
8  *
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.
12  *
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.
17  *
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.
23  *
24  * BSD LICENSE
25  *
26  * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
27  * All rights reserved.
28  *
29  * Redistribution and use in source and binary forms, with or without
30  * modification, are permitted provided that the following conditions
31  * are met:
32  *
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.
42  *
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.
54  */
55
56 #ifndef _SATI_DEVICE_H_
57 #define _SATI_DEVICE_H_
58
59 /**
60  * This file contains all of the defintions for the SATI remote device object.
61  *    Some translations require information to be remembered on a per device
62  *    basis.  This information is stored in the object defined in this file.
63  *
64  *
65  */
66
67 #include "sati_types.h"
68 #include "intel_ata.h"
69
70 /**
71  * enum _SATI_DEVICE_STATE - This enumeration depicts the various states
72  *    possible for the a translation remote device object.
73  *
74  *
75  */
76 enum sati_device_state {
77         SATI_DEVICE_STATE_OPERATIONAL,
78         SATI_DEVICE_STATE_STOPPED,
79         SATI_DEVICE_STATE_STANDBY,
80         SATI_DEVICE_STATE_IDLE,
81         SATI_DEVICE_STATE_DEVICE_FAULT_OCCURRED,
82         SATI_DEVICE_STATE_FORMAT_UNIT_IN_PROGRESS,
83         SATI_DEVICE_STATE_SELF_TEST_IN_PROGRESS,
84         SATI_DEVICE_STATE_SEQUENCE_INCOMPLETE,
85         SATI_DEVICE_STATE_UNIT_ATTENTION_CONDITION
86
87 };
88
89 /**
90  *
91  *
92  * SATI_DEVICE_CAPABILITIES These constants define the various capabilities
93  * that a remote device may support for which there is an impact on translation.
94  */
95 #define SATI_DEVICE_CAP_UDMA_ENABLE          0x00000001
96 #define SATI_DEVICE_CAP_NCQ_REQUESTED_ENABLE 0x00000002
97 #define SATI_DEVICE_CAP_NCQ_SUPPORTED_ENABLE 0x00000004
98 #define SATI_DEVICE_CAP_48BIT_ENABLE         0x00000008
99 #define SATI_DEVICE_CAP_DMA_FUA_ENABLE       0x00000010
100 #define SATI_DEVICE_CAP_SMART_SUPPORT        0x00000020
101 #define SATI_DEVICE_CAP_REMOVABLE_MEDIA      0x00000040
102 #define SATI_DEVICE_CAP_SMART_ENABLE         0x00000080
103 #define SATI_DEVICE_CAP_WRITE_UNCORRECTABLE_ENABLE           0x00000100
104 #define SATI_DEVICE_CAP_MULTIPLE_SECTORS_PER_PHYSCIAL_SECTOR 0x00000200
105 #define SATI_DEVICE_CAP_SMART_SELF_TEST_SUPPORT              0x00000400
106
107
108 /**
109  * struct sati_device - The SATI_DEVICE structure define the state of the
110  *    remote device with respect to translation.
111  *
112  *
113  */
114 struct sati_device {
115         /**
116          * This field simply dictates the state of the SATI device.
117          */
118         enum sati_device_state state;
119
120         /**
121          * This field indicates features supported by the remote device that
122          * impact translation execution.
123          */
124         u16 capabilities;
125
126         /**
127          * This field indicates the depth of the native command queue supported
128          * by the device.
129          */
130         u8 ncq_depth;
131
132         /**
133          * This field stores the additional sense code for a unit attention
134          * condition.
135          */
136         u8 unit_attention_asc;
137
138         /**
139          * This field indicates the additional sense code qualifier for a unit
140          * attention condition.
141          */
142         u8 unit_attention_ascq;
143
144 };
145
146 void sati_device_construct(
147         struct sati_device *device,
148         bool is_ncq_enabled,
149         u8 max_ncq_depth);
150
151 void sati_device_update_capabilities(
152         struct sati_device *device,
153         struct ata_identify_device_data *identify);
154
155 #endif /* _SATI_TRANSLATOR_SEQUENCE_H_ */
156