1fcf3ce44SJohn Forte /* 2fcf3ce44SJohn Forte * CDDL HEADER START 3fcf3ce44SJohn Forte * 4fcf3ce44SJohn Forte * The contents of this file are subject to the terms of the 5fcf3ce44SJohn Forte * Common Development and Distribution License (the "License"). 6fcf3ce44SJohn Forte * You may not use this file except in compliance with the License. 7fcf3ce44SJohn Forte * 8fcf3ce44SJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9fcf3ce44SJohn Forte * or http://www.opensolaris.org/os/licensing. 10fcf3ce44SJohn Forte * See the License for the specific language governing permissions 11fcf3ce44SJohn Forte * and limitations under the License. 12fcf3ce44SJohn Forte * 13fcf3ce44SJohn Forte * When distributing Covered Code, include this CDDL HEADER in each 14fcf3ce44SJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15fcf3ce44SJohn Forte * If applicable, add the following below this CDDL HEADER, with the 16fcf3ce44SJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying 17fcf3ce44SJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner] 18fcf3ce44SJohn Forte * 19fcf3ce44SJohn Forte * CDDL HEADER END 20fcf3ce44SJohn Forte */ 21fcf3ce44SJohn Forte /* 22*a7949318SReed * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 23fcf3ce44SJohn Forte * Use is subject to license terms. 24fcf3ce44SJohn Forte */ 25fcf3ce44SJohn Forte 26fcf3ce44SJohn Forte #ifndef _HBA_H 27fcf3ce44SJohn Forte #define _HBA_H 28fcf3ce44SJohn Forte 29fcf3ce44SJohn Forte 30fcf3ce44SJohn Forte 31fcf3ce44SJohn Forte // Forward declarations 32fcf3ce44SJohn Forte class HBA; 33fcf3ce44SJohn Forte class HBAPort; 34fcf3ce44SJohn Forte 35fcf3ce44SJohn Forte #include "Lockable.h" 36fcf3ce44SJohn Forte #include "HBAPort.h" 37fcf3ce44SJohn Forte #include <map> 38fcf3ce44SJohn Forte #include <string> 39fcf3ce44SJohn Forte #include <vector> 40fcf3ce44SJohn Forte #include <map> 41fcf3ce44SJohn Forte #include <hbaapi.h> 42fcf3ce44SJohn Forte #include <hbaapi-sun.h> 43fcf3ce44SJohn Forte 44fcf3ce44SJohn Forte 45fcf3ce44SJohn Forte /* 46fcf3ce44SJohn Forte * @memo Used to track an individual HBA 47fcf3ce44SJohn Forte * @see HBAList 48fcf3ce44SJohn Forte * 49fcf3ce44SJohn Forte * @doc During discovery, as HBAs are found on the system, 50fcf3ce44SJohn Forte * instances of this class will be created, and stored 51fcf3ce44SJohn Forte * in the HBAList class. 52fcf3ce44SJohn Forte */ 53fcf3ce44SJohn Forte class HBA : public Lockable { 54fcf3ce44SJohn Forte public: 55fcf3ce44SJohn Forte HBA() {} 56fcf3ce44SJohn Forte virtual ~HBA(); 57fcf3ce44SJohn Forte bool operator == (HBA &comp); 58fcf3ce44SJohn Forte static const uint8_t HBA_PORT_MAX; 59fcf3ce44SJohn Forte void addPort(HBAPort* port); 60fcf3ce44SJohn Forte HBAPort* getPort(uint64_t wwn); 61fcf3ce44SJohn Forte bool containsWWN(uint64_t wwn); 62fcf3ce44SJohn Forte 63fcf3ce44SJohn Forte virtual HBA_ADAPTERATTRIBUTES getHBAAttributes() = 0; 64*a7949318SReed virtual int doForceLip() = 0; 65fcf3ce44SJohn Forte virtual HBA_ADAPTERATTRIBUTES npivGetHBAAttributes() = 0; 66fcf3ce44SJohn Forte void setRNID(HBA_MGMTINFO info); 67fcf3ce44SJohn Forte /* 68fcf3ce44SJohn Forte * Fetch the name, excluding the trailing "-" and index number 69fcf3ce44SJohn Forte */ 70fcf3ce44SJohn Forte virtual std::string getName() = 0; 71fcf3ce44SJohn Forte 72fcf3ce44SJohn Forte void validatePresent(); 73fcf3ce44SJohn Forte 74fcf3ce44SJohn Forte HBAPort* getPortByIndex(int index); 75fcf3ce44SJohn Forte uint8_t getNumberOfPorts(); 76fcf3ce44SJohn Forte 77fcf3ce44SJohn Forte // Utility routines: Could be moved elsewhere 78fcf3ce44SJohn Forte // Each routine throws exceptions on error (and logs) 79fcf3ce44SJohn Forte static int _open(std::string path, int flag); 80fcf3ce44SJohn Forte static void _ioctl(int fd, int type, uchar_t *arg); 81fcf3ce44SJohn Forte 82fcf3ce44SJohn Forte private: 83fcf3ce44SJohn Forte std::map<uint64_t, HBAPort *> portsByWWN; 84fcf3ce44SJohn Forte std::vector<HBAPort*> portsByIndex; 85fcf3ce44SJohn Forte }; 86fcf3ce44SJohn Forte 87fcf3ce44SJohn Forte 88fcf3ce44SJohn Forte #endif /* _HBA_H */ 89