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.
32 #include "HBANPIVPort.h"
37 #include <hbaapi-sun.h>
40 * @memo Represents a single HBA port
43 class HBAPort
: public Lockable
{
47 bool operator==(HBAPort
&comp
);
48 virtual void validatePresent();
49 virtual std::string
getPath() = 0;
50 virtual uint64_t getNodeWWN() = 0;
51 virtual uint64_t getPortWWN() = 0;
52 virtual HBA_PORTATTRIBUTES
getPortAttributes(
53 uint64_t &stateChange
) = 0;
54 virtual HBA_PORTATTRIBUTES
getDiscoveredAttributes(
55 HBA_UINT32 discoveredport
,
56 uint64_t &stateChange
) = 0;
57 virtual HBA_PORTATTRIBUTES
getDiscoveredAttributes(
59 uint64_t &stateChange
) = 0;
60 virtual void getTargetMappings(
61 PHBA_FCPTARGETMAPPINGV2 userMappings
) = 0;
62 virtual void getRNIDMgmtInfo(PHBA_MGMTINFO info
) = 0;
63 virtual void sendCTPassThru(void *requestBuffer
,
64 HBA_UINT32 requestSize
,
66 HBA_UINT32
*responseSize
) = 0;
67 virtual void sendRLS(uint64_t destWWN
,
69 HBA_UINT32
*pRspBufferSize
) = 0;
70 virtual void sendRPL(uint64_t destWWN
,
71 HBA_UINT32 agent_domain
,
72 HBA_UINT32 port_index
,
74 HBA_UINT32
*pRspBufferSize
) = 0;
75 virtual void sendRPS(uint64_t agentWWN
,
76 HBA_UINT32 agentDomain
,
78 HBA_UINT32 objectPortNum
,
80 HBA_UINT32
*pRspBufferSize
) = 0;
81 virtual void sendSRL(uint64_t destWWN
,
82 HBA_UINT32 agent_domain
,
84 HBA_UINT32
*pRspBufferSize
) = 0;
85 virtual void sendLIRR(uint64_t destWWN
,
89 HBA_UINT32
*pRspBufferSize
) = 0;
90 virtual void sendReportLUNs(uint64_t wwn
,
91 void *responseBuffer
, HBA_UINT32
*responseSize
,
92 HBA_UINT8
*scsiStatus
,
93 void *senseBuffer
, HBA_UINT32
*senseSize
) = 0;
94 virtual void sendScsiInquiry(uint64_t wwn
, HBA_UINT64 fcLun
,
95 HBA_UINT8 cdb1
, HBA_UINT8 cdb2
,
96 void *responseBuffer
, HBA_UINT32
*responseSize
,
97 HBA_UINT8
*scsiStatus
, void *senseBuffer
,
98 HBA_UINT32
*senseSize
) = 0;
99 virtual void sendReadCapacity(uint64_t pwwn
,
100 HBA_UINT64 fcLun
, void *responseBuffer
,
101 HBA_UINT32
*responseSize
, HBA_UINT8
*scsiStatus
,
102 void *senseBuffer
, HBA_UINT32
*senseSize
) = 0;
104 static const int RNID_GENERAL_TOPOLOGY_DATA_FORMAT
;
105 virtual void sendRNID(uint64_t destwwn
, HBA_UINT32 destfcid
,
106 HBA_UINT32 nodeIdDataFormat
, void *pRspBuffer
,
107 HBA_UINT32
*RspBufferSize
) = 0;
108 virtual void setRNID(HBA_MGMTINFO info
) = 0;
110 static const uint8_t HBA_NPIV_PORT_MAX
;
111 void addPort(HBANPIVPort
* port
);
112 HBANPIVPort
* getPort(uint64_t wwn
);
113 HBANPIVPort
* getPortByIndex(int index
);
114 virtual HBA_PORTNPIVATTRIBUTES
getPortNPIVAttributes(
115 uint64_t &stateChange
) = 0;
116 virtual uint32_t createNPIVPort(
119 uint32_t vindex
) = 0;
120 virtual uint32_t deleteNPIVPort(
121 uint64_t vportwwn
) = 0;
123 void convertToShortNames(PHBA_FCPTARGETMAPPINGV2 mappings
);
124 std::string
lookupControllerPath(std::string path
);
125 std::map
<uint64_t, HBANPIVPort
*> npivportsByWWN
;
126 std::vector
<HBANPIVPort
*> npivportsByIndex
;
130 #endif /* _HBAPORT_H */