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.
38 #include <sys/types.h>
39 #include <sys/scsi/scsi.h>
42 #include <netinet/in.h>
50 #define htonll(x) ((((unsigned long long)htonl(x)) << 32) + htonl(x >> 32))
51 #define ntohll(x) ((((unsigned long long)ntohl(x)) << 32) + ntohl(x >> 32))
55 #define DEFAULT_LUN_COUNT 1024
57 #define LUN_HEADER_SIZE 8
58 #define LUN_LENGTH LUN_SIZE + LUN_HEADER_SIZE
59 #define DEFAULT_LUN_LENGTH DEFAULT_LUN_COUNT * \
63 /* flags that are needed to be passed into porcessHBA */
64 #define PRINT_VERBOSE 0x00000001
65 #define PRINT_PHY 0x00000002 /* print phy addresses */
66 #define PRINT_PHY_LINKSTAT 0x00000004 /* print phy link statistics */
67 #define PRINT_TARGET_PORT 0x00000008 /* print target os deivce info */
68 #define PRINT_CHILD 0x00000010 /* print descendant nodes */
69 #define PRINT_TARGET_SCSI 0x00000020 /* print descendant nodes */
71 #define HBA_MAX_RETRIES 20
73 typedef struct _tgtPortWWNList
{
76 struct _tgtPortWWNList
*next
;
79 typedef struct _portList
{
80 char portName
[MAXPATHLEN
];
81 tgtPortWWNList
*tgtPortWWN
;
82 struct _portList
*next
;
85 /* Discovered LU structure */
86 typedef struct _discoveredDevice
{
87 boolean_t inquiryFailed
;
88 char OSDeviceName
[MAXPATHLEN
];
89 portList
*HBAPortList
;
93 struct _discoveredDevice
*next
;
96 typedef struct targetPortMappingData
{
97 boolean_t mappingExist
;
98 boolean_t inquiryFailed
;
100 SMHBA_SCSILUN reportLUN
;
101 char osDeviceName
[256];
105 struct targetPortMappingData
*next
;
106 } targetPortMappingData_t
;
108 typedef struct targetPortConfig
{
109 char hbaPortName
[256];
110 HBA_WWN expanderSASAddr
;
112 boolean_t reportLUNsFailed
;
113 struct targetPortMappingData
*map
;
114 struct targetPortConfig
*next
;
115 } targetPortConfig_t
;
117 typedef struct targetPortList
{
118 SMHBA_PORTATTRIBUTES targetattr
;
119 SMHBA_SAS_PORT sasattr
;
120 struct targetPortConfig
*configEntry
;
121 struct targetPortList
*next
;
124 int sas_util_list_hba(int hbaCount
, char **hba_argv
, cmdOptions_t
*options
);
125 int sas_util_list_hbaport(int wwnCount
, char **wwn_argv
, cmdOptions_t
*options
);
126 int sas_util_list_expander(int wwnCount
, char **wwn_argv
,
127 cmdOptions_t
*options
);
128 int sas_util_list_targetport(int tpCount
, char **tpArgv
, cmdOptions_t
*options
);
129 int sas_util_list_remoteport(int wwnCount
, char **wwn_argv
,
130 cmdOptions_t
*options
);
132 sas_util_list_logicalunit(int luCount
, char **luArgv
, cmdOptions_t
*options
);
138 #endif /* _SASINFO_H */