sci_overview.h revision 331722
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 *
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.
51 *
52 * $FreeBSD: stable/11/sys/dev/isci/scil/sci_overview.h 331722 2018-03-29 02:50:57Z eadler $
53 */
54#ifndef _SCI_OVERVIEW_H_
55#define _SCI_OVERVIEW_H_
56
57/**
58@mainpage The Intel Storage Controller Interface (SCI)
59
60SCI provides a common interface across intel storage controller hardware.
61This includes abstracting differences between Physical PCI functions and
62Virtual PCI functions.  The SCI is comprised of four primary components:
63-# SCI Base classes
64-# SCI Core
65-# SCI Framework
66
67It is important to recognize that no component, object, or functionality in
68SCI directly allocates memory from the operating system.  It is expected that
69the SCI User (OS specific driver code) allocates and frees all memory from
70and to the operating system itself.
71
72The C language is utilized to implement SCI.  Although C is not an object
73oriented language the SCI driver components, methods, and structures are
74modeled and organized following object oriented principles.
75
76The Unified Modeling Language is utilized to present graphical depictions
77of the SCI classes and their relationships.
78
79The following figure denotes the meanings of the colors utilized in UML
80diagrams throughout this document.
81@image latex object_color_key.eps "Object Color Legend" width=8cm
82
83The following figure denotes the meanings for input and output arrows that
84are utilized to define parameters for methods defined in this specification.
85@image latex arrow_image.eps "Method Parameter Symbol Definition"
86
87@page abbreviations_section Abbreviations
88
89- ATA: Advanced Technology Attachment
90- IAF: Identify Address Frame
91- SAS: Serial Attached SCSI
92- SAT: SCSI to ATA Translation
93- SATA: Serial ATA
94- SCI: Storage Controller Interface
95- SCIC: SCI Core
96- SCIF: SCI Framework
97- SCU: Storage Controller Unit
98- SDS: SCU Driver Standard (i.e. non-virtualization)
99- SDV: SCU Driver Virtualized
100- SDVP: SDV Physical (PCI function)
101- SDVV: SDV Virtual (PCI function)
102- SGE: Scatter-Gather Element
103- SGL: Scatter-Gather List
104- SGPIO: Serial General Purpose Input/Output
105- SSC: Spread Spectrum Clocking
106
107@page definitions_section Definitions
108
109- <b>construct</b> - The term "construct" is utilized throughout the
110  interface to indicate when an object is being created.  Typically construct
111  methods perform pure memory initialization.  No "construct" method ever
112  performs memory allocation.  It is incumbent upon the SCI user to provide
113  the necessary memory.
114- <b>initialize</b> - The term "initialize" is utilized throughout the
115  interface to indicate when an object is performing actions on other objects
116  or on physical resources in an attempt to allow these resources to become
117  operational.
118- <b>protected</b> - The term "protected" is utilized to denote a method
119  defined in this standard that MUST NOT be invoked directly by operating
120  system specific driver code.
121- <b>SCI Component</b> - An SCI component is one of: SCI base classes, Core,
122  or Framework.
123- <b>SCI User</b> - The user callbacks for each SCI Component represent the
124  dependencies that the SCI component implementation has upon the operating
125  system/environment specific portion of the driver.  It is essentially a
126  set of functions or macro definitions that are specific to a particular
127  operating system.
128- <b>THIN</b> - A term utilized to describe an SCI Component implementation
129  that is built to conserve memory.
130
131@page inheritance SCI Inheritance Hierarchy
132
133This section describes the inheritance (i.e. "is-a") relationships between
134the various objects in SCI.  Due to various operating environment requirements
135the programming language employed for the SCI driver is C.  As a result, one
136might be curious how inheritance shall be applied in such an environment.
137The SCI driver source shall maintain generalization relationships by ensuring
138that child object structures shall contain an instance of their parent's
139structure as the very first member of their structure.  As a result, parent
140object methods can be invoked with a child structure parameter.  This works
141since casting of the child structure to the parent structure inside the parent
142method will yield correct access to the parent structure fields.
143
144Consider the following example:
145<pre>
146typedef struct SCI_OBJECT
147{
148   U32 object_type;
149};
150
151typedef struct SCI_CONTROLLER
152{
153   U32 state;
154
155} SCI_CONTROLLER_T;
156
157typedef struct SCIC_CONTROLLER
158{
159   SCI_CONTROLLER_T parent;
160   U32 type;
161
162} SCIC_CONTROLLER_T;
163</pre>
164
165With the above structure orientation, a user would be allowed to perform
166method invocations in a manner similar to the following:
167<pre>
168SCIC_CONTROLLER_T scic_controller;
169scic_controller_initialize((SCIC_CONTROLLER_T*) &scic_controller);
170
171// OR
172
173sci_object_get_association(&scic_controller);
174</pre>
175@note The actual interface will not require type casting.
176
177The following diagram graphically depicts the inheritance relationships
178between the various objects defined in the Storage Controller Interface.
179@image latex inheritance.eps "SCI Inheritance Hierarchy" width=16cm
180
181@page sci_classes SCI Classes
182
183This section depicts the common classes and utility functions across the
184entire set of SCI Components.  Descriptions about each of the specific
185objects will be found in the header file definition in the File Documentation
186section.
187
188The following is a list of features that can be found in the SCI base classes:
189-# Logging utility methods, constants, and type definitions
190-# Memory Descriptor object methods common to the core and framework.
191-# Controller object methods common to SCI derived controller objects.
192-# Library object methods common to SCI derived library objects.
193-# Storage standard (e.g. SAS, SATA) defined constants, structures, etc.
194-# Standard types utilized by SCI sub-components.
195-# The ability to associate/link SCI objects together or to user objects.
196
197SCI class methods can be overridden by sub-classes in the SCI Core,
198SCI Framework, etc.  SCI class methods that MUST NOT be invoked directly
199by operating system specific driver code shall be adorned with a
200<code>[protected]</code> keyword.  These <code>[protected]</code> API are still
201defined as part of the specification in order to demonstrate commonality across
202components as well as provide a common description of related methods.  If
203these methods are invoked directly by operating system specific code, the
204operation of the driver as a whole is not specified or supported.
205
206The following UML diagram graphically depicts the SCI base classes and their
207relationships to one another.
208@image latex sci_base_classes.eps "SCI Classes" width=4cm
209
210@page associations_section Associations
211The sci_object class provides functionality common to all SCI objects.
212An important feature provided by this base class is the means by which to
213associate one object to another.  An SCI object can be made to have an
214association to another SCI object.  Additionally, an SCI object can be
215made to have an association to a non-SCI based object.  For example, an SCI
216Framework library can have it's association set to an operating system
217specific adapter/device driver structre.
218
219Simply put, the association that an object has is a handle (i.e. a void pointer)
220to a user structure.  This enables the user of the SCI object to
221easily determine it's own associated structure. This association is useful
222because the user is now enabled to easily determine their pertinent information
223inside of their SCI user callback methods.
224
225Setting an association within an SCI object is generally optional.  The
226primary case in which an association is not optional is in the case of IO
227request objects.  These associations are necessary in order  to fill
228to fill in appropriate information for an IO request (i.e. CDB address, size,
229SGL information, etc.) in an efficient manner.
230
231In the case of other objects, the user is free to not create associations.
232When the user chooses not to create an association, the user is responsible for
233being able to determine their data structures based on the SCI object handles.
234Additionally, the user may be forced to invoke additional functionality in
235situations where the SCI Framework is employed.  If the user does not
236establish proper associations between objects (i.e. SCIC Library to SCIF Library), then the framework is unable to automate interactions.  Users should
237strongly consider establishing associations between SCI Framework objects and
238OS Driver related structures.
239
240Example Associations:
241- The user might set the scif_controller association to their adapter or
242controller object.
243- The user might set the scif_domain association to their SCSI bus object.
244
245If SCIF is being utilized, then the framework will set the associations
246in the core.  In this situation, the user should only set the associations
247in the framework objects, unless otherwise directed.
248*/
249
250#endif // _SCI_OVERVIEW_H_
251
252