152419Sjulian/*-
252419Sjulian * This file is provided under a dual BSD/GPLv2 license.  When using or
352419Sjulian * redistributing this file, you may do so under either license.
452419Sjulian *
552419Sjulian * GPL LICENSE SUMMARY
652419Sjulian *
752419Sjulian * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
852419Sjulian *
952419Sjulian * This program is free software; you can redistribute it and/or modify
1052419Sjulian * it under the terms of version 2 of the GNU General Public License as
1152419Sjulian * published by the Free Software Foundation.
1252419Sjulian *
1352419Sjulian * This program is distributed in the hope that it will be useful, but
1452419Sjulian * WITHOUT ANY WARRANTY; without even the implied warranty of
1552419Sjulian * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1652419Sjulian * General Public License for more details.
1752419Sjulian *
1852419Sjulian * You should have received a copy of the GNU General Public License
1952419Sjulian * along with this program; if not, write to the Free Software
2052419Sjulian * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
2152419Sjulian * The full GNU General Public License is included in this distribution
2252419Sjulian * in the file called LICENSE.GPL.
2352419Sjulian *
2452419Sjulian * BSD LICENSE
2552419Sjulian *
2652419Sjulian * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
2752419Sjulian * All rights reserved.
2852419Sjulian *
2952419Sjulian * Redistribution and use in source and binary forms, with or without
3052419Sjulian * modification, are permitted provided that the following conditions
3152419Sjulian * are met:
3252419Sjulian *
3352419Sjulian *   * Redistributions of source code must retain the above copyright
3452419Sjulian *     notice, this list of conditions and the following disclaimer.
3552419Sjulian *   * Redistributions in binary form must reproduce the above copyright
3652419Sjulian *     notice, this list of conditions and the following disclaimer in
3752419Sjulian *     the documentation and/or other materials provided with the
3852419Sjulian *     distribution.
3952419Sjulian *
4052419Sjulian * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4184215Sdillon * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
4284215Sdillon * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
4384215Sdillon * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
4452419Sjulian * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
4554100Sarchie * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
4654100Sarchie * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
4753913Sarchie * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
4852419Sjulian * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
4953913Sarchie * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
5053913Sarchie * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5153913Sarchie *
5254100Sarchie * $FreeBSD$
5353913Sarchie */
5452419Sjulian#ifndef _SCU_VIIT_DATA_HEADER_
5552419Sjulian#define _SCU_VIIT_DATA_HEADER_
5652419Sjulian
5752419Sjulian/**
5852419Sjulian * @file
5952419Sjulian *
6053913Sarchie * @brief This file contains the constants and structures for the SCU hardware
6153913Sarchie *        VIIT table entries.
62151677Sru */
6354100Sarchie
64151677Sru#ifdef __cplusplus
6552419Sjulianextern "C" {
66151677Sru#endif // __cplusplus
6753913Sarchie
68151677Sru#include <dev/isci/scil/sci_types.h>
69151677Sru
7053913Sarchie#define SCU_VIIT_ENTRY_ID_MASK         (0xC0000000UL)
71151677Sru#define SCU_VIIT_ENTRY_ID_SHIFT        (30UL)
7252419Sjulian
73151677Sru#define SCU_VIIT_ENTRY_FUNCTION_MASK   (0x0FF00000UL)
74151677Sru#define SCU_VIIT_ENTRY_FUNCTION_SHIFT  (20UL)
7553913Sarchie
76151677Sru#define SCU_VIIT_ENTRY_IPPTMODE_MASK   (0x0001F800UL)
7753913Sarchie#define SCU_VIIT_ENTRY_IPPTMODE_SHIFT  (12UL)
78151677Sru
79151677Sru#define SCU_VIIT_ENTRY_LPVIE_MASK      (0x00000F00UL)
8053913Sarchie#define SCU_VIIT_ENTRY_LPVIE_SHIFT     (8UL)
81151677Sru
8252419Sjulian#define SCU_VIIT_ENTRY_STATUS_MASK     (0x000000FFUL)
83151677Sru#define SCU_VIIT_ENTRY_STATUS_SHIFT    (0UL)
84151677Sru
85151677Sru#define SCU_VIIT_ENTRY_ID_INVALID   (0UL << SCU_VIIT_ENTRY_ID_SHIFT)
8653913Sarchie#define SCU_VIIT_ENTRY_ID_VIIT      (1UL << SCU_VIIT_ENTRY_ID_SHIFT)
8753913Sarchie#define SCU_VIIT_ENTRY_ID_IIT       (2UL << SCU_VIIT_ENTRY_ID_SHIFT)
88151677Sru#define SCU_VIIT_ENTRY_ID_VIRT_EXP  (3UL << SCU_VIIT_ENTRY_ID_SHIFT)
8953913Sarchie
9053913Sarchie#define SCU_VIIT_IPPT_SSP_INITIATOR (0x01UL << SCU_VIIT_ENTRY_IPPTMODE_SHIFT)
91151677Sru#define SCU_VIIT_IPPT_SMP_INITIATOR (0x02UL << SCU_VIIT_ENTRY_IPPTMODE_SHIFT)
92151677Sru#define SCU_VIIT_IPPT_STP_INITIATOR (0x04UL << SCU_VIIT_ENTRY_IPPTMODE_SHIFT)
93151677Sru#define SCU_VIIT_IPPT_INITIATOR     \
94151677Sru   (                                \
9553913Sarchie       SCU_VIIT_IPPT_SSP_INITIATOR  \
9652419Sjulian     | SCU_VIIT_IPPT_SMP_INITIATOR  \
9753913Sarchie     | SCU_VIIT_IPPT_STP_INITIATOR  \
98151677Sru   )
9953913Sarchie
10053913Sarchie#define SCU_VIIT_STATUS_RNC_VALID      (0x01UL << SCU_VIIT_ENTRY_STATUS_SHIFT)
10153913Sarchie#define SCU_VIIT_STATUS_ADDRESS_VALID  (0x02UL << SCU_VIIT_ENTRY_STATUS_SHIFT)
10253913Sarchie#define SCU_VIIT_STATUS_RNI_VALID      (0x04UL << SCU_VIIT_ENTRY_STATUS_SHIFT)
10353913Sarchie#define SCU_VIIT_STATUS_ALL_VALID      \
10453913Sarchie   (                                   \
10553913Sarchie       SCU_VIIT_STATUS_RNC_VALID       \
10653913Sarchie     | SCU_VIIT_STATUS_ADDRESS_VALID   \
10752419Sjulian     | SCU_VIIT_STATUS_RNI_VALID       \
10852419Sjulian   )
10952419Sjulian
11052419Sjulian#define SCU_VIIT_IPPT_SMP_TARGET    (0x10UL << SCU_VIIT_ENTRY_IPPTMODE_SHIFT)
11152419Sjulian
11252419Sjulian/**
11352419Sjulian * @struct SCU_VIIT_ENTRY
11452419Sjulian *
11552419Sjulian * @brief This is the SCU Virtual Initiator Table Entry
11652419Sjulian */
11752419Sjuliantypedef struct SCU_VIIT_ENTRY
11853913Sarchie{
11953913Sarchie   /**
12053913Sarchie    * This must be encoded as to the type of initiator that is being constructed
12153913Sarchie    * for this port.
12253913Sarchie    */
12353913Sarchie   U32  status;
12453913Sarchie
12553913Sarchie   /**
12653913Sarchie    * Virtual initiator high SAS Address
12753913Sarchie    */
12853913Sarchie   U32  initiator_sas_address_hi;
12953913Sarchie
130151677Sru   /**
13154098Sarchie    * Virtual initiator low SAS Address
132151677Sru    */
13353913Sarchie   U32  initiator_sas_address_lo;
134151677Sru
13553913Sarchie   /**
136151677Sru    * This must be 0
137151677Sru    */
13853913Sarchie   U32  reserved;
139151677Sru
14053913Sarchie} SCU_VIIT_ENTRY_T;
141151677Sru
142151677Sru
14353913Sarchie// IIT Status Defines
14453913Sarchie#define SCU_IIT_ENTRY_ID_MASK                (0xC0000000UL)
145151677Sru#define SCU_IIT_ENTRY_ID_SHIFT               (30UL)
14653913Sarchie
147151677Sru#define SCU_IIT_ENTRY_STATUS_UPDATE_MASK     (0x20000000UL)
148151677Sru#define SCU_IIT_ENTRY_STATUS_UPDATE_SHIFT    (29UL)
14953913Sarchie
150151677Sru#define SCU_IIT_ENTRY_LPI_MASK               (0x00000F00UL)
15153913Sarchie#define SCU_IIT_ENTRY_LPI_SHIFT              (8UL)
152151677Sru
153151677Sru#define SCU_IIT_ENTRY_STATUS_MASK            (0x000000FFUL)
154151677Sru#define SCU_IIT_ENTRY_STATUS_SHIFT           (0UL)
15553913Sarchie
15653913Sarchie// IIT Remote Initiator Defines
157151677Sru#define SCU_IIT_ENTRY_REMOTE_TAG_MASK  (0x0000FFFFUL)
15853913Sarchie#define SCU_IIT_ENTRY_REMOTE_TAG_SHIFT (0UL)
15953913Sarchie
160151677Sru#define SCU_IIT_ENTRY_REMOTE_RNC_MASK  (0x0FFF0000UL)
161151677Sru#define SCU_IIT_ENTRY_REMOTE_RNC_SHIFT (16UL)
162151677Sru
163151677Sru#define SCU_IIT_ENTRY_ID_INVALID   (0UL << SCU_IIT_ENTRY_ID_SHIFT)
16453913Sarchie#define SCU_IIT_ENTRY_ID_VIIT      (1UL << SCU_IIT_ENTRY_ID_SHIFT)
16553913Sarchie#define SCU_IIT_ENTRY_ID_IIT       (2UL << SCU_IIT_ENTRY_ID_SHIFT)
16653913Sarchie#define SCU_IIT_ENTRY_ID_VIRT_EXP  (3UL << SCU_IIT_ENTRY_ID_SHIFT)
167151677Sru
16853913Sarchie/**
16953913Sarchie * @struct SCU_IIT_ENTRY
17053913Sarchie *
17153913Sarchie * @brief This will be implemented later when we support virtual functions
17253913Sarchie */
17353913Sarchietypedef struct SCU_IIT_ENTRY
17453913Sarchie{
17553913Sarchie   U32  status;
17653913Sarchie   U32  remote_initiator_sas_address_hi;
17752419Sjulian   U32  remote_initiator_sas_address_lo;
17852419Sjulian   U32  remote_initiator;
17952419Sjulian
18052419Sjulian} SCU_IIT_ENTRY_T;
18152419Sjulian
18252419Sjulian#ifdef __cplusplus
18352419Sjulian}
18452419Sjulian#endif // __cplusplus
18552419Sjulian
18652419Sjulian#endif // _SCU_VIIT_DATA_HEADER_
18752419Sjulian