1*f11c7f63SJim Harris /*- 2*f11c7f63SJim Harris * This file is provided under a dual BSD/GPLv2 license. When using or 3*f11c7f63SJim Harris * redistributing this file, you may do so under either license. 4*f11c7f63SJim Harris * 5*f11c7f63SJim Harris * GPL LICENSE SUMMARY 6*f11c7f63SJim Harris * 7*f11c7f63SJim Harris * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 8*f11c7f63SJim Harris * 9*f11c7f63SJim Harris * This program is free software; you can redistribute it and/or modify 10*f11c7f63SJim Harris * it under the terms of version 2 of the GNU General Public License as 11*f11c7f63SJim Harris * published by the Free Software Foundation. 12*f11c7f63SJim Harris * 13*f11c7f63SJim Harris * This program is distributed in the hope that it will be useful, but 14*f11c7f63SJim Harris * WITHOUT ANY WARRANTY; without even the implied warranty of 15*f11c7f63SJim Harris * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16*f11c7f63SJim Harris * General Public License for more details. 17*f11c7f63SJim Harris * 18*f11c7f63SJim Harris * You should have received a copy of the GNU General Public License 19*f11c7f63SJim Harris * along with this program; if not, write to the Free Software 20*f11c7f63SJim Harris * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 21*f11c7f63SJim Harris * The full GNU General Public License is included in this distribution 22*f11c7f63SJim Harris * in the file called LICENSE.GPL. 23*f11c7f63SJim Harris * 24*f11c7f63SJim Harris * BSD LICENSE 25*f11c7f63SJim Harris * 26*f11c7f63SJim Harris * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 27*f11c7f63SJim Harris * All rights reserved. 28*f11c7f63SJim Harris * 29*f11c7f63SJim Harris * Redistribution and use in source and binary forms, with or without 30*f11c7f63SJim Harris * modification, are permitted provided that the following conditions 31*f11c7f63SJim Harris * are met: 32*f11c7f63SJim Harris * 33*f11c7f63SJim Harris * * Redistributions of source code must retain the above copyright 34*f11c7f63SJim Harris * notice, this list of conditions and the following disclaimer. 35*f11c7f63SJim Harris * * Redistributions in binary form must reproduce the above copyright 36*f11c7f63SJim Harris * notice, this list of conditions and the following disclaimer in 37*f11c7f63SJim Harris * the documentation and/or other materials provided with the 38*f11c7f63SJim Harris * distribution. 39*f11c7f63SJim Harris * 40*f11c7f63SJim Harris * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 41*f11c7f63SJim Harris * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 42*f11c7f63SJim Harris * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 43*f11c7f63SJim Harris * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 44*f11c7f63SJim Harris * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 45*f11c7f63SJim Harris * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 46*f11c7f63SJim Harris * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 47*f11c7f63SJim Harris * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 48*f11c7f63SJim Harris * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 49*f11c7f63SJim Harris * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 50*f11c7f63SJim Harris * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 51*f11c7f63SJim Harris * 52*f11c7f63SJim Harris * $FreeBSD$ 53*f11c7f63SJim Harris */ 54*f11c7f63SJim Harris #ifndef _SCI_OVERVIEW_H_ 55*f11c7f63SJim Harris #define _SCI_OVERVIEW_H_ 56*f11c7f63SJim Harris 57*f11c7f63SJim Harris /** 58*f11c7f63SJim Harris @mainpage The Intel Storage Controller Interface (SCI) 59*f11c7f63SJim Harris 60*f11c7f63SJim Harris SCI provides a common interface across intel storage controller hardware. 61*f11c7f63SJim Harris This includes abstracting differences between Physical PCI functions and 62*f11c7f63SJim Harris Virtual PCI functions. The SCI is comprised of four primary components: 63*f11c7f63SJim Harris -# SCI Base classes 64*f11c7f63SJim Harris -# SCI Core 65*f11c7f63SJim Harris -# SCI Framework 66*f11c7f63SJim Harris 67*f11c7f63SJim Harris It is important to recognize that no component, object, or functionality in 68*f11c7f63SJim Harris SCI directly allocates memory from the operating system. It is expected that 69*f11c7f63SJim Harris the SCI User (OS specific driver code) allocates and frees all memory from 70*f11c7f63SJim Harris and to the operating system itself. 71*f11c7f63SJim Harris 72*f11c7f63SJim Harris The C language is utilized to implement SCI. Although C is not an object 73*f11c7f63SJim Harris oriented language the SCI driver components, methods, and structures are 74*f11c7f63SJim Harris modeled and organized following object oriented principles. 75*f11c7f63SJim Harris 76*f11c7f63SJim Harris The Unified Modeling Language is utilized to present graphical depictions 77*f11c7f63SJim Harris of the SCI classes and their relationships. 78*f11c7f63SJim Harris 79*f11c7f63SJim Harris The following figure denotes the meanings of the colors utilized in UML 80*f11c7f63SJim Harris diagrams throughout this document. 81*f11c7f63SJim Harris @image latex object_color_key.eps "Object Color Legend" width=8cm 82*f11c7f63SJim Harris 83*f11c7f63SJim Harris The following figure denotes the meanings for input and output arrows that 84*f11c7f63SJim Harris are utilized to define parameters for methods defined in this specification. 85*f11c7f63SJim Harris @image latex arrow_image.eps "Method Parameter Symbol Definition" 86*f11c7f63SJim Harris 87*f11c7f63SJim Harris @page abbreviations_section Abbreviations 88*f11c7f63SJim Harris 89*f11c7f63SJim Harris - ATA: Advanced Technology Attachment 90*f11c7f63SJim Harris - IAF: Identify Address Frame 91*f11c7f63SJim Harris - SAS: Serial Attached SCSI 92*f11c7f63SJim Harris - SAT: SCSI to ATA Translation 93*f11c7f63SJim Harris - SATA: Serial ATA 94*f11c7f63SJim Harris - SCI: Storage Controller Interface 95*f11c7f63SJim Harris - SCIC: SCI Core 96*f11c7f63SJim Harris - SCIF: SCI Framework 97*f11c7f63SJim Harris - SCU: Storage Controller Unit 98*f11c7f63SJim Harris - SDS: SCU Driver Standard (i.e. non-virtualization) 99*f11c7f63SJim Harris - SDV: SCU Driver Virtualized 100*f11c7f63SJim Harris - SDVP: SDV Physical (PCI function) 101*f11c7f63SJim Harris - SDVV: SDV Virtual (PCI function) 102*f11c7f63SJim Harris - SGE: Scatter-Gather Element 103*f11c7f63SJim Harris - SGL: Scatter-Gather List 104*f11c7f63SJim Harris - SGPIO: Serial General Purpose Input/Output 105*f11c7f63SJim Harris - SSC: Spread Spectrum Clocking 106*f11c7f63SJim Harris 107*f11c7f63SJim Harris @page definitions_section Definitions 108*f11c7f63SJim Harris 109*f11c7f63SJim Harris - <b>construct</b> - The term "construct" is utilized throughout the 110*f11c7f63SJim Harris interface to indicate when an object is being created. Typically construct 111*f11c7f63SJim Harris methods perform pure memory initialization. No "construct" method ever 112*f11c7f63SJim Harris performs memory allocation. It is incumbent upon the SCI user to provide 113*f11c7f63SJim Harris the necessary memory. 114*f11c7f63SJim Harris - <b>initialize</b> - The term "initialize" is utilized throughout the 115*f11c7f63SJim Harris interface to indicate when an object is performing actions on other objects 116*f11c7f63SJim Harris or on physical resources in an attempt to allow these resources to become 117*f11c7f63SJim Harris operational. 118*f11c7f63SJim Harris - <b>protected</b> - The term "protected" is utilized to denote a method 119*f11c7f63SJim Harris defined in this standard that MUST NOT be invoked directly by operating 120*f11c7f63SJim Harris system specific driver code. 121*f11c7f63SJim Harris - <b>SCI Component</b> - An SCI component is one of: SCI base classes, Core, 122*f11c7f63SJim Harris or Framework. 123*f11c7f63SJim Harris - <b>SCI User</b> - The user callbacks for each SCI Component represent the 124*f11c7f63SJim Harris dependencies that the SCI component implementation has upon the operating 125*f11c7f63SJim Harris system/environment specific portion of the driver. It is essentially a 126*f11c7f63SJim Harris set of functions or macro definitions that are specific to a particular 127*f11c7f63SJim Harris operating system. 128*f11c7f63SJim Harris - <b>THIN</b> - A term utilized to describe an SCI Component implementation 129*f11c7f63SJim Harris that is built to conserve memory. 130*f11c7f63SJim Harris 131*f11c7f63SJim Harris @page inheritance SCI Inheritance Hierarchy 132*f11c7f63SJim Harris 133*f11c7f63SJim Harris This section describes the inheritance (i.e. "is-a") relationships between 134*f11c7f63SJim Harris the various objects in SCI. Due to various operating environment requirements 135*f11c7f63SJim Harris the programming language employed for the SCI driver is C. As a result, one 136*f11c7f63SJim Harris might be curious how inheritance shall be applied in such an environment. 137*f11c7f63SJim Harris The SCI driver source shall maintain generalization relationships by ensuring 138*f11c7f63SJim Harris that child object structures shall contain an instance of their parent's 139*f11c7f63SJim Harris structure as the very first member of their structure. As a result, parent 140*f11c7f63SJim Harris object methods can be invoked with a child structure parameter. This works 141*f11c7f63SJim Harris since casting of the child structure to the parent structure inside the parent 142*f11c7f63SJim Harris method will yield correct access to the parent structure fields. 143*f11c7f63SJim Harris 144*f11c7f63SJim Harris Consider the following example: 145*f11c7f63SJim Harris <pre> 146*f11c7f63SJim Harris typedef struct SCI_OBJECT 147*f11c7f63SJim Harris { 148*f11c7f63SJim Harris U32 object_type; 149*f11c7f63SJim Harris }; 150*f11c7f63SJim Harris 151*f11c7f63SJim Harris typedef struct SCI_CONTROLLER 152*f11c7f63SJim Harris { 153*f11c7f63SJim Harris U32 state; 154*f11c7f63SJim Harris 155*f11c7f63SJim Harris } SCI_CONTROLLER_T; 156*f11c7f63SJim Harris 157*f11c7f63SJim Harris typedef struct SCIC_CONTROLLER 158*f11c7f63SJim Harris { 159*f11c7f63SJim Harris SCI_CONTROLLER_T parent; 160*f11c7f63SJim Harris U32 type; 161*f11c7f63SJim Harris 162*f11c7f63SJim Harris } SCIC_CONTROLLER_T; 163*f11c7f63SJim Harris </pre> 164*f11c7f63SJim Harris 165*f11c7f63SJim Harris With the above structure orientation, a user would be allowed to perform 166*f11c7f63SJim Harris method invocations in a manner similar to the following: 167*f11c7f63SJim Harris <pre> 168*f11c7f63SJim Harris SCIC_CONTROLLER_T scic_controller; 169*f11c7f63SJim Harris scic_controller_initialize((SCIC_CONTROLLER_T*) &scic_controller); 170*f11c7f63SJim Harris 171*f11c7f63SJim Harris // OR 172*f11c7f63SJim Harris 173*f11c7f63SJim Harris sci_object_get_association(&scic_controller); 174*f11c7f63SJim Harris </pre> 175*f11c7f63SJim Harris @note The actual interface will not require type casting. 176*f11c7f63SJim Harris 177*f11c7f63SJim Harris The following diagram graphically depicts the inheritance relationships 178*f11c7f63SJim Harris between the various objects defined in the Storage Controller Interface. 179*f11c7f63SJim Harris @image latex inheritance.eps "SCI Inheritance Hierarchy" width=16cm 180*f11c7f63SJim Harris 181*f11c7f63SJim Harris @page sci_classes SCI Classes 182*f11c7f63SJim Harris 183*f11c7f63SJim Harris This section depicts the common classes and utility functions across the 184*f11c7f63SJim Harris entire set of SCI Components. Descriptions about each of the specific 185*f11c7f63SJim Harris objects will be found in the header file definition in the File Documentation 186*f11c7f63SJim Harris section. 187*f11c7f63SJim Harris 188*f11c7f63SJim Harris The following is a list of features that can be found in the SCI base classes: 189*f11c7f63SJim Harris -# Logging utility methods, constants, and type definitions 190*f11c7f63SJim Harris -# Memory Descriptor object methods common to the core and framework. 191*f11c7f63SJim Harris -# Controller object methods common to SCI derived controller objects. 192*f11c7f63SJim Harris -# Library object methods common to SCI derived library objects. 193*f11c7f63SJim Harris -# Storage standard (e.g. SAS, SATA) defined constants, structures, etc. 194*f11c7f63SJim Harris -# Standard types utilized by SCI sub-components. 195*f11c7f63SJim Harris -# The ability to associate/link SCI objects together or to user objects. 196*f11c7f63SJim Harris 197*f11c7f63SJim Harris SCI class methods can be overridden by sub-classes in the SCI Core, 198*f11c7f63SJim Harris SCI Framework, etc. SCI class methods that MUST NOT be invoked directly 199*f11c7f63SJim Harris by operating system specific driver code shall be adorned with a 200*f11c7f63SJim Harris <code>[protected]</code> keyword. These <code>[protected]</code> API are still 201*f11c7f63SJim Harris defined as part of the specification in order to demonstrate commonality across 202*f11c7f63SJim Harris components as well as provide a common description of related methods. If 203*f11c7f63SJim Harris these methods are invoked directly by operating system specific code, the 204*f11c7f63SJim Harris operation of the driver as a whole is not specified or supported. 205*f11c7f63SJim Harris 206*f11c7f63SJim Harris The following UML diagram graphically depicts the SCI base classes and their 207*f11c7f63SJim Harris relationships to one another. 208*f11c7f63SJim Harris @image latex sci_base_classes.eps "SCI Classes" width=4cm 209*f11c7f63SJim Harris 210*f11c7f63SJim Harris @page associations_section Associations 211*f11c7f63SJim Harris The sci_object class provides functionality common to all SCI objects. 212*f11c7f63SJim Harris An important feature provided by this base class is the means by which to 213*f11c7f63SJim Harris associate one object to another. An SCI object can be made to have an 214*f11c7f63SJim Harris association to another SCI object. Additionally, an SCI object can be 215*f11c7f63SJim Harris made to have an association to a non-SCI based object. For example, an SCI 216*f11c7f63SJim Harris Framework library can have it's association set to an operating system 217*f11c7f63SJim Harris specific adapter/device driver structre. 218*f11c7f63SJim Harris 219*f11c7f63SJim Harris Simply put, the association that an object has is a handle (i.e. a void pointer) 220*f11c7f63SJim Harris to a user structure. This enables the user of the SCI object to 221*f11c7f63SJim Harris easily determine it's own associated structure. This association is useful 222*f11c7f63SJim Harris because the user is now enabled to easily determine their pertinent information 223*f11c7f63SJim Harris inside of their SCI user callback methods. 224*f11c7f63SJim Harris 225*f11c7f63SJim Harris Setting an association within an SCI object is generally optional. The 226*f11c7f63SJim Harris primary case in which an association is not optional is in the case of IO 227*f11c7f63SJim Harris request objects. These associations are necessary in order to fill 228*f11c7f63SJim Harris to fill in appropriate information for an IO request (i.e. CDB address, size, 229*f11c7f63SJim Harris SGL information, etc.) in an efficient manner. 230*f11c7f63SJim Harris 231*f11c7f63SJim Harris In the case of other objects, the user is free to not create associations. 232*f11c7f63SJim Harris When the user chooses not to create an association, the user is responsible for 233*f11c7f63SJim Harris being able to determine their data structures based on the SCI object handles. 234*f11c7f63SJim Harris Additionally, the user may be forced to invoke additional functionality in 235*f11c7f63SJim Harris situations where the SCI Framework is employed. If the user does not 236*f11c7f63SJim Harris establish proper associations between objects (i.e. SCIC Library to SCIF Library), then the framework is unable to automate interactions. Users should 237*f11c7f63SJim Harris strongly consider establishing associations between SCI Framework objects and 238*f11c7f63SJim Harris OS Driver related structures. 239*f11c7f63SJim Harris 240*f11c7f63SJim Harris Example Associations: 241*f11c7f63SJim Harris - The user might set the scif_controller association to their adapter or 242*f11c7f63SJim Harris controller object. 243*f11c7f63SJim Harris - The user might set the scif_domain association to their SCSI bus object. 244*f11c7f63SJim Harris 245*f11c7f63SJim Harris If SCIF is being utilized, then the framework will set the associations 246*f11c7f63SJim Harris in the core. In this situation, the user should only set the associations 247*f11c7f63SJim Harris in the framework objects, unless otherwise directed. 248*f11c7f63SJim Harris */ 249*f11c7f63SJim Harris 250*f11c7f63SJim Harris #endif // _SCI_OVERVIEW_H_ 251*f11c7f63SJim Harris 252