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]
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
33 #include <Exceptions.h>
36 #include <sys/param.h>
37 #include <sys/fibre-channel/fcio.h>
44 * Represents a single HBA port
46 class FCHBAPort
: public HBAPort
{
48 FCHBAPort(std::string path
);
49 virtual std::string
getPath()
51 virtual uint64_t getNodeWWN()
53 virtual uint64_t getPortWWN()
55 virtual HBA_PORTATTRIBUTES
getPortAttributes(
56 uint64_t &stateChange
);
57 virtual HBA_PORTNPIVATTRIBUTES
getPortNPIVAttributes(
58 uint64_t &stateChange
);
59 virtual uint32_t createNPIVPort(
63 virtual uint32_t deleteNPIVPort(
65 virtual HBA_PORTATTRIBUTES
getDiscoveredAttributes(
66 HBA_UINT32 discoveredport
,
67 uint64_t &stateChange
);
68 virtual HBA_PORTATTRIBUTES
getDiscoveredAttributes(
70 uint64_t &stateChange
);
71 virtual void getTargetMappings(
72 PHBA_FCPTARGETMAPPINGV2 userMappings
);
73 virtual void getRNIDMgmtInfo(PHBA_MGMTINFO info
);
74 virtual void sendCTPassThru(void *requestBuffer
,
75 HBA_UINT32 requestSize
,
77 HBA_UINT32
*responseSize
);
78 virtual void sendRLS(uint64_t destWWN
,
80 HBA_UINT32
*pRspBufferSize
);
81 virtual void sendRPL(uint64_t destWWN
,
82 HBA_UINT32 agent_domain
,
83 HBA_UINT32 port_index
,
85 HBA_UINT32
*pRspBufferSize
) {
86 throw NotSupportedException(); }
87 virtual void sendRPS(uint64_t agentWWN
,
88 HBA_UINT32 agentDomain
,
90 HBA_UINT32 objectPortNum
,
92 HBA_UINT32
*pRspBufferSize
) {
93 throw NotSupportedException(); }
94 virtual void sendSRL(uint64_t destWWN
,
95 HBA_UINT32 agent_domain
,
97 HBA_UINT32
*pRspBufferSize
) {
98 throw NotSupportedException(); }
99 virtual void sendLIRR(uint64_t destWWN
,
103 HBA_UINT32
*pRspBufferSize
) {
104 throw NotSupportedException(); }
105 virtual void sendReportLUNs(uint64_t wwn
,
106 void *responseBuffer
, HBA_UINT32
*responseSize
,
107 HBA_UINT8
*scsiStatus
,
108 void *senseBuffer
, HBA_UINT32
*senseSize
);
109 virtual void sendScsiInquiry(uint64_t wwn
, HBA_UINT64 fcLun
,
110 HBA_UINT8 cdb1
, HBA_UINT8 cdb2
,
111 void *responseBuffer
, HBA_UINT32
*responseSize
,
112 HBA_UINT8
*scsiStatus
, void *senseBuffer
,
113 HBA_UINT32
*senseSize
);
114 virtual void sendReadCapacity(uint64_t pwwn
,
115 HBA_UINT64 fcLun
, void *responseBuffer
,
116 HBA_UINT32
*responseSize
, HBA_UINT8
*scsiStatus
,
117 void *senseBuffer
, HBA_UINT32
*senseSize
);
118 virtual void sendRNID(uint64_t destwwn
, HBA_UINT32 destfcid
,
119 HBA_UINT32 nodeIdDataFormat
, void *pRspBuffer
,
120 HBA_UINT32
*RspBufferSize
);
121 virtual void setRNID(HBA_MGMTINFO info
);
128 uint32_t instanceNumber
;
129 int controllerNumber
;
130 void sendSCSIPassThru(struct fcp_scsi_cmd
*fscsi
,
131 HBA_UINT32
*responseSize
, HBA_UINT32
*senseSize
,
132 HBA_UINT8
*scsiStatus
);
133 static const std::string FCSM_DRIVER_PATH
;
134 static const int MAX_FCIO_MSG_LEN
;
135 static const std::string FCP_DRIVER_PATH
;
136 static void transportError(uint32_t fcio_errno
, char *message
);
138 // Wrapper routines to handle error cases
139 static void fp_ioctl(std::string path
, int cmd
, fcio_t
*arg
);
140 static void fp_ioctl(std::string path
, int cmd
, fcio_t
*arg
,
142 static void fcsm_ioctl(int cmd
, fcio_t
*arg
);
149 #endif /* _FCHBAPORT_H */