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 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
31 // Forward declarations
42 #include <hbaapi-sun.h>
46 * @memo Used to track an individual HBA
49 * @doc During discovery, as HBAs are found on the system,
50 * instances of this class will be created, and stored
51 * in the HBAList class.
53 class HBA
: public Lockable
{
57 bool operator == (HBA
&comp
);
58 static const uint8_t HBA_PORT_MAX
;
59 void addPort(HBAPort
* port
);
60 HBAPort
* getPort(uint64_t wwn
);
61 bool containsWWN(uint64_t wwn
);
63 virtual HBA_ADAPTERATTRIBUTES
getHBAAttributes() = 0;
64 virtual int doForceLip() = 0;
65 virtual HBA_ADAPTERATTRIBUTES
npivGetHBAAttributes() = 0;
66 void setRNID(HBA_MGMTINFO info
);
68 * Fetch the name, excluding the trailing "-" and index number
70 virtual std::string
getName() = 0;
72 void validatePresent();
74 HBAPort
* getPortByIndex(int index
);
75 uint8_t getNumberOfPorts();
77 // Utility routines: Could be moved elsewhere
78 // Each routine throws exceptions on error (and logs)
79 static int _open(std::string path
, int flag
);
80 static void _ioctl(int fd
, int type
, uchar_t
*arg
);
83 std::map
<uint64_t, HBAPort
*> portsByWWN
;
84 std::vector
<HBAPort
*> portsByIndex
;