1*7836SJohn.Forte@Sun.COM /* 2*7836SJohn.Forte@Sun.COM * CDDL HEADER START 3*7836SJohn.Forte@Sun.COM * 4*7836SJohn.Forte@Sun.COM * The contents of this file are subject to the terms of the 5*7836SJohn.Forte@Sun.COM * Common Development and Distribution License (the "License"). 6*7836SJohn.Forte@Sun.COM * You may not use this file except in compliance with the License. 7*7836SJohn.Forte@Sun.COM * 8*7836SJohn.Forte@Sun.COM * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*7836SJohn.Forte@Sun.COM * or http://www.opensolaris.org/os/licensing. 10*7836SJohn.Forte@Sun.COM * See the License for the specific language governing permissions 11*7836SJohn.Forte@Sun.COM * and limitations under the License. 12*7836SJohn.Forte@Sun.COM * 13*7836SJohn.Forte@Sun.COM * When distributing Covered Code, include this CDDL HEADER in each 14*7836SJohn.Forte@Sun.COM * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*7836SJohn.Forte@Sun.COM * If applicable, add the following below this CDDL HEADER, with the 16*7836SJohn.Forte@Sun.COM * fields enclosed by brackets "[]" replaced with your own identifying 17*7836SJohn.Forte@Sun.COM * information: Portions Copyright [yyyy] [name of copyright owner] 18*7836SJohn.Forte@Sun.COM * 19*7836SJohn.Forte@Sun.COM * CDDL HEADER END 20*7836SJohn.Forte@Sun.COM */ 21*7836SJohn.Forte@Sun.COM /* 22*7836SJohn.Forte@Sun.COM * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 23*7836SJohn.Forte@Sun.COM * Use is subject to license terms. 24*7836SJohn.Forte@Sun.COM */ 25*7836SJohn.Forte@Sun.COM 26*7836SJohn.Forte@Sun.COM #ifndef _HBAPORT_H 27*7836SJohn.Forte@Sun.COM #define _HBAPORT_H 28*7836SJohn.Forte@Sun.COM 29*7836SJohn.Forte@Sun.COM 30*7836SJohn.Forte@Sun.COM 31*7836SJohn.Forte@Sun.COM #include "Lockable.h" 32*7836SJohn.Forte@Sun.COM #include "HBANPIVPort.h" 33*7836SJohn.Forte@Sun.COM #include <string> 34*7836SJohn.Forte@Sun.COM #include <map> 35*7836SJohn.Forte@Sun.COM #include <vector> 36*7836SJohn.Forte@Sun.COM #include <hbaapi.h> 37*7836SJohn.Forte@Sun.COM #include <hbaapi-sun.h> 38*7836SJohn.Forte@Sun.COM 39*7836SJohn.Forte@Sun.COM /** 40*7836SJohn.Forte@Sun.COM * @memo Represents a single HBA port 41*7836SJohn.Forte@Sun.COM * 42*7836SJohn.Forte@Sun.COM */ 43*7836SJohn.Forte@Sun.COM class HBAPort : public Lockable { 44*7836SJohn.Forte@Sun.COM public: 45*7836SJohn.Forte@Sun.COM HBAPort(); ~HBAPort()46*7836SJohn.Forte@Sun.COM virtual ~HBAPort() {} 47*7836SJohn.Forte@Sun.COM bool operator==(HBAPort &comp); 48*7836SJohn.Forte@Sun.COM virtual void validatePresent(); 49*7836SJohn.Forte@Sun.COM virtual std::string getPath() = 0; 50*7836SJohn.Forte@Sun.COM virtual uint64_t getNodeWWN() = 0; 51*7836SJohn.Forte@Sun.COM virtual uint64_t getPortWWN() = 0; 52*7836SJohn.Forte@Sun.COM virtual HBA_PORTATTRIBUTES getPortAttributes( 53*7836SJohn.Forte@Sun.COM uint64_t &stateChange) = 0; 54*7836SJohn.Forte@Sun.COM virtual HBA_PORTATTRIBUTES getDiscoveredAttributes( 55*7836SJohn.Forte@Sun.COM HBA_UINT32 discoveredport, 56*7836SJohn.Forte@Sun.COM uint64_t &stateChange) = 0; 57*7836SJohn.Forte@Sun.COM virtual HBA_PORTATTRIBUTES getDiscoveredAttributes( 58*7836SJohn.Forte@Sun.COM uint64_t wwn, 59*7836SJohn.Forte@Sun.COM uint64_t &stateChange) = 0; 60*7836SJohn.Forte@Sun.COM virtual void getTargetMappings( 61*7836SJohn.Forte@Sun.COM PHBA_FCPTARGETMAPPINGV2 userMappings) = 0; 62*7836SJohn.Forte@Sun.COM virtual void getRNIDMgmtInfo(PHBA_MGMTINFO info) = 0; 63*7836SJohn.Forte@Sun.COM virtual void sendCTPassThru(void *requestBuffer, 64*7836SJohn.Forte@Sun.COM HBA_UINT32 requestSize, 65*7836SJohn.Forte@Sun.COM void *responseBuffer, 66*7836SJohn.Forte@Sun.COM HBA_UINT32 *responseSize) = 0; 67*7836SJohn.Forte@Sun.COM virtual void sendRLS(uint64_t destWWN, 68*7836SJohn.Forte@Sun.COM void *pRspBuffer, 69*7836SJohn.Forte@Sun.COM HBA_UINT32 *pRspBufferSize) = 0; 70*7836SJohn.Forte@Sun.COM virtual void sendRPL(uint64_t destWWN, 71*7836SJohn.Forte@Sun.COM HBA_UINT32 agent_domain, 72*7836SJohn.Forte@Sun.COM HBA_UINT32 port_index, 73*7836SJohn.Forte@Sun.COM void *pRspBuffer, 74*7836SJohn.Forte@Sun.COM HBA_UINT32 *pRspBufferSize) = 0; 75*7836SJohn.Forte@Sun.COM virtual void sendRPS(uint64_t agentWWN, 76*7836SJohn.Forte@Sun.COM HBA_UINT32 agentDomain, 77*7836SJohn.Forte@Sun.COM uint64_t objectWWN, 78*7836SJohn.Forte@Sun.COM HBA_UINT32 objectPortNum, 79*7836SJohn.Forte@Sun.COM void *pRspBuffer, 80*7836SJohn.Forte@Sun.COM HBA_UINT32 *pRspBufferSize) = 0; 81*7836SJohn.Forte@Sun.COM virtual void sendSRL(uint64_t destWWN, 82*7836SJohn.Forte@Sun.COM HBA_UINT32 agent_domain, 83*7836SJohn.Forte@Sun.COM void *pRspBuffer, 84*7836SJohn.Forte@Sun.COM HBA_UINT32 *pRspBufferSize) = 0; 85*7836SJohn.Forte@Sun.COM virtual void sendLIRR(uint64_t destWWN, 86*7836SJohn.Forte@Sun.COM HBA_UINT8 function, 87*7836SJohn.Forte@Sun.COM HBA_UINT8 type, 88*7836SJohn.Forte@Sun.COM void *pRspBuffer, 89*7836SJohn.Forte@Sun.COM HBA_UINT32 *pRspBufferSize) = 0; 90*7836SJohn.Forte@Sun.COM virtual void sendReportLUNs(uint64_t wwn, 91*7836SJohn.Forte@Sun.COM void *responseBuffer, HBA_UINT32 *responseSize, 92*7836SJohn.Forte@Sun.COM HBA_UINT8 *scsiStatus, 93*7836SJohn.Forte@Sun.COM void *senseBuffer, HBA_UINT32 *senseSize) = 0; 94*7836SJohn.Forte@Sun.COM virtual void sendScsiInquiry(uint64_t wwn, HBA_UINT64 fcLun, 95*7836SJohn.Forte@Sun.COM HBA_UINT8 cdb1, HBA_UINT8 cdb2, 96*7836SJohn.Forte@Sun.COM void *responseBuffer, HBA_UINT32 *responseSize, 97*7836SJohn.Forte@Sun.COM HBA_UINT8 *scsiStatus, void *senseBuffer, 98*7836SJohn.Forte@Sun.COM HBA_UINT32 *senseSize) = 0; 99*7836SJohn.Forte@Sun.COM virtual void sendReadCapacity(uint64_t pwwn, 100*7836SJohn.Forte@Sun.COM HBA_UINT64 fcLun, void *responseBuffer, 101*7836SJohn.Forte@Sun.COM HBA_UINT32 *responseSize, HBA_UINT8 *scsiStatus, 102*7836SJohn.Forte@Sun.COM void *senseBuffer, HBA_UINT32 *senseSize) = 0; 103*7836SJohn.Forte@Sun.COM 104*7836SJohn.Forte@Sun.COM static const int RNID_GENERAL_TOPOLOGY_DATA_FORMAT; 105*7836SJohn.Forte@Sun.COM virtual void sendRNID(uint64_t destwwn, HBA_UINT32 destfcid, 106*7836SJohn.Forte@Sun.COM HBA_UINT32 nodeIdDataFormat, void *pRspBuffer, 107*7836SJohn.Forte@Sun.COM HBA_UINT32 *RspBufferSize) = 0; 108*7836SJohn.Forte@Sun.COM virtual void setRNID(HBA_MGMTINFO info) = 0; 109*7836SJohn.Forte@Sun.COM 110*7836SJohn.Forte@Sun.COM static const uint8_t HBA_NPIV_PORT_MAX; 111*7836SJohn.Forte@Sun.COM void addPort(HBANPIVPort* port); 112*7836SJohn.Forte@Sun.COM HBANPIVPort* getPort(uint64_t wwn); 113*7836SJohn.Forte@Sun.COM HBANPIVPort* getPortByIndex(int index); 114*7836SJohn.Forte@Sun.COM virtual HBA_PORTNPIVATTRIBUTES getPortNPIVAttributes( 115*7836SJohn.Forte@Sun.COM uint64_t &stateChange) = 0; 116*7836SJohn.Forte@Sun.COM virtual uint32_t createNPIVPort( 117*7836SJohn.Forte@Sun.COM uint64_t vnodewwn, 118*7836SJohn.Forte@Sun.COM uint64_t vportwwn, 119*7836SJohn.Forte@Sun.COM uint32_t vindex) = 0; 120*7836SJohn.Forte@Sun.COM virtual uint32_t deleteNPIVPort( 121*7836SJohn.Forte@Sun.COM uint64_t vportwwn) = 0; 122*7836SJohn.Forte@Sun.COM protected: 123*7836SJohn.Forte@Sun.COM void convertToShortNames(PHBA_FCPTARGETMAPPINGV2 mappings); 124*7836SJohn.Forte@Sun.COM std::string lookupControllerPath(std::string path); 125*7836SJohn.Forte@Sun.COM std::map<uint64_t, HBANPIVPort*> npivportsByWWN; 126*7836SJohn.Forte@Sun.COM std::vector<HBANPIVPort*> npivportsByIndex; 127*7836SJohn.Forte@Sun.COM }; 128*7836SJohn.Forte@Sun.COM 129*7836SJohn.Forte@Sun.COM 130*7836SJohn.Forte@Sun.COM #endif /* _HBAPORT_H */ 131