docs/how-to-build.md: use proper markup for directory names
[unleashed/tickless.git] / include / sys / fctio.h
blob93e6128ccc07adcedcb4fa000219718cc6eb04b4
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
25 #ifndef _FCTIO_H
26 #define _FCTIO_H
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
32 #define FCT_IOCTL (((uint32_t)'F') << 24)
33 #define FCTIO_CMD (FCT_IOCTL | 2007)
34 #define FCTIO_SUB_CMD ('Z' << 8)
35 #define FCTIO_ADAPTER_LIST (FCTIO_SUB_CMD + 0x01)
36 #define FCTIO_GET_ADAPTER_ATTRIBUTES (FCTIO_SUB_CMD + 0x02)
37 #define FCTIO_GET_ADAPTER_PORT_ATTRIBUTES (FCTIO_SUB_CMD + 0x03)
38 #define FCTIO_GET_DISCOVERED_PORT_ATTRIBUTES (FCTIO_SUB_CMD + 0x04)
39 #define FCTIO_GET_PORT_ATTRIBUTES (FCTIO_SUB_CMD + 0x05)
40 #define FCTIO_GET_ADAPTER_PORT_STATS (FCTIO_SUB_CMD + 0x06)
41 #define FCTIO_GET_LINK_STATUS (FCTIO_SUB_CMD + 0x07)
42 #define FCTIO_FORCE_LIP (FCTIO_SUB_CMD + 0x08)
45 * fcio_xfer definitions
47 #define FCTIO_XFER_NONE 0x00
48 #define FCTIO_XFER_READ 0x01
49 #define FCTIO_XFER_WRITE 0x02
50 #define FCTIO_XFER_RW (FCTIO_XFER_READ | FCTIO_XFER_WRITE)
52 typedef struct fctio {
53 uint16_t fctio_xfer; /* direction */
54 uint16_t fctio_cmd; /* sub command */
55 uint16_t fctio_flags; /* flags */
56 uint16_t fctio_cmd_flags; /* command specific flags */
57 uint32_t fctio_ilen; /* Input buffer length */
58 uint32_t fctio_olen; /* Output buffer length */
59 uint32_t fctio_alen; /* Auxillary buffer length */
60 uint32_t fctio_errno; /* FC internal error code */
61 uint64_t fctio_ibuf; /* Input buffer */
62 uint64_t fctio_obuf; /* Output buffer */
63 uint64_t fctio_abuf; /* Auxillary buffer */
64 } fctio_t;
66 #define FCT_HBA_LIST_VERSION 1
67 typedef struct fc_tgt_hba_list {
68 uint32_t version;
69 uint32_t numPorts;
70 uint8_t port_wwn[1][8];
71 } fc_tgt_hba_list_t;
73 #define FCT_HBA_ADAPTER_ATTRIBUTES_VERSION 1
74 typedef struct fc_tgt_hba_adapter_attributes {
75 uint32_t version; /* Set to FC_HBA_ADAPTER_ATTRIBUTES_VERSION */
76 uint32_t reserved_1;
77 char Manufacturer[64];
78 char SerialNumber[64];
79 char Model[256];
80 char ModelDescription[256];
81 uint8_t NodeWWN[8];
82 char NodeSymbolicName[256];
83 char HardwareVersion[256];
84 char DriverVersion[256];
85 char OptionROMVersion[256];
86 char FirmwareVersion[256];
87 uint32_t VendorSpecificID;
88 uint32_t NumberOfPorts;
89 char DriverName[256];
90 uint64_t reserved_2;
91 } fc_tgt_hba_adapter_attributes_t;
93 #define FCT_HBA_PORT_ATTRIBUTES_VERSION 1
94 typedef struct fc_tgt_hba_port_attributes {
95 uint32_t version; /* FC_HBA_PORT_ATTRIBUTES_VERSION */
96 uint32_t reserved_1;
97 uint64_t lastChange;
98 uint8_t NodeWWN[8];
99 uint8_t PortWWN[8];
100 uint32_t PortFcId;
101 uint32_t PortType;
102 uint32_t PortState;
103 uint32_t PortSupportedClassofService;
104 uint8_t PortSupportedFc4Types[32];
105 uint8_t PortActiveFc4Types[32];
106 char PortSymbolicName[256];
107 uint32_t PortSupportedSpeed;
108 uint32_t PortSpeed;
109 uint32_t PortMaxFrameSize;
110 uint32_t NumberofDiscoveredPorts;
111 uint8_t FabricName[8];
112 uint64_t reserved_2;
113 } fc_tgt_hba_port_attributes_t;
115 #define FCT_HBA_ADAPTER_PORT_STATS_VERSION 1
116 typedef struct fc_tgt_hba_adapter_port_stats {
117 uint32_t version; /* FC_HBA_ADAPTER_PORT_STATS_VERSION */
118 uint32_t reserved_1;
119 uint64_t SecondsSinceLastReset;
120 uint64_t TxFrames;
121 uint64_t TxWords;
122 uint64_t RxFrames;
123 uint64_t RxWords;
124 uint64_t LIPCount;
125 uint64_t NOSCount;
126 uint64_t ErrorFrames;
127 uint64_t DumpedFrames;
128 uint64_t LinkFailureCount;
129 uint64_t LossOfSyncCount;
130 uint64_t LossOfSignalCount;
131 uint64_t PrimitiveSeqProtocolErrCount;
132 uint64_t InvalidTxWordCount;
133 uint64_t InvalidCRCCount;
134 uint64_t reserved_2;
135 } fc_tgt_hba_adapter_port_stats_t;
138 * Constant values derived from T11 FC-HBA
140 #define FC_HBA_PORTTYPE_UNKNOWN 1 /* Unknown */
141 #define FC_HBA_PORTTYPE_OTHER 2 /* Other */
142 #define FC_HBA_PORTTYPE_NOTPRESENT 3 /* Not present */
143 #define FC_HBA_PORTTYPE_NPORT 5 /* Fabric */
144 #define FC_HBA_PORTTYPE_NLPORT 6 /* Public Loop */
145 #define FC_HBA_PORTTYPE_FLPORT 7
146 #define FC_HBA_PORTTYPE_FPORT 8 /* Fabric Port */
147 #define FC_HBA_PORTTYPE_EPORT 9 /* Fabric expansion port */
148 #define FC_HBA_PORTTYPE_GPORT 10 /* Generic Fabric Port */
149 #define FC_HBA_PORTTYPE_LPORT 20 /* Private Loop */
150 #define FC_HBA_PORTTYPE_PTP 21 /* Point to Point */
152 #define FC_HBA_PORTSTATE_UNKNOWN 1 /* Unknown */
153 #define FC_HBA_PORTSTATE_ONLINE 2 /* Operational */
154 #define FC_HBA_PORTSTATE_OFFLINE 3 /* User Offline */
155 #define FC_HBA_PORTSTATE_BYPASSED 4 /* Bypassed */
156 #define FC_HBA_PORTSTATE_DIAGNOSTICS 5 /* In diagnostics mode */
157 #define FC_HBA_PORTSTATE_LINKDOWN 6 /* Link Down */
158 #define FC_HBA_PORTSTATE_ERROR 7 /* Port Error */
159 #define FC_HBA_PORTSTATE_LOOPBACK 8 /* Loopback */
162 * HBA/Port attributes tracked for the T11 FC-HBA specification
164 #define FC_HBA_PORTSPEED_UNKNOWN 0 /* Unknown - transceiver */
165 /* incable of reporting */
166 #define FC_HBA_PORTSPEED_1GBIT 1 /* 1 GBit/sec */
167 #define FC_HBA_PORTSPEED_2GBIT 2 /* 2 GBit/sec */
168 #define FC_HBA_PORTSPEED_10GBIT 4 /* 10 GBit/sec */
169 #define FC_HBA_PORTSPEED_4GBIT 8 /* 4 GBit/sec */
170 #define FC_HBA_PORTSPEED_8GBIT 16 /* 8 GBit/sec */
171 #define FC_HBA_PORTSPEED_16GBIT 32 /* 16 GBit/sec */
172 #define FC_HBA_PORTSPEED_NOT_NEGOTIATED (1<<15) /* Speed not established */
174 #define FCTIO_SUCCESS 0
175 #define FCTIO_FAILURE 1
176 #define FCTIO_BADWWN 2
177 #define FCTIO_MOREDATA 3
178 #define FCTIO_OUTOFBOUNDS 4
180 /* Sysevent defs */
181 #define EC_SUNFC "EC_sunfc"
182 #define ESC_SUNFC_PORT_ATTACH "ESC_sunfc_port_attach"
183 #define ESC_SUNFC_PORT_DETACH "ESC_sunfc_port_detach"
184 #define ESC_SUNFC_PORT_ONLINE "ESC_sunfc_port_online"
185 #define ESC_SUNFC_PORT_OFFLINE "ESC_sunfc_port_offline"
186 #define ESC_SUNFC_PORT_RSCN "ESC_sunfc_port_rscn"
187 #define ESC_SUNFC_TARGET_ADD "ESC_sunfc_target_add"
188 #define ESC_SUNFC_TARGET_REMOVE "ESC_sunfc_target_remove"
190 #ifdef __cplusplus
192 #endif
194 #endif /* _FCTIO_H */