summaryrefslogtreecommitdiff
path: root/usr/src/lib/hbaapi/common/hbaapi-sun.h
blob: 1a4dc0fe41eb8e9c71cb0b0ecc7dbd1c83848f9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
/*
 * *****************************************************************************
 *
 * Description
 *	hbaapi.h - header file for Sun extension for target mode adaptor
 * 		 support.
 *
 * License:
 *	The contents of this file are subject to the SNIA Public License
 *	Version 1.0 (the "License"); you may not use this file except in
 *	compliance with the License. You may obtain a copy of the License at
 *
 *	http://www.snia.org/English/Resources/Code/OpenSource.html
 *
 *	Software distributed under the License is distributed on an "AS IS"
 *	basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
 *	the License for the specific language governing rights and limitations
 *	under the License.
 *
 * *******************************************************************************
 */
/*
 * 	Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
 * 	Use is subject to license terms.
 */

#ifdef __cplusplus
extern "C" {
#endif


#ifndef _HBA_API_SUN_H
#define _HBA_API_SUN_H

#include    <hbaapi.h>

#define	HBA_CREATE_WWN_RANDOM		1
#define	HBA_CREATE_WWN_FACTORY		2

typedef struct HBA_NPIVPortList {
	uint32_t	numPorts;
	char		hbaPaths[1][1024];
} HBA_NPIVPORTLIST, *PHBA_NPIVPORTLIST;

typedef struct HBA_PortNPIVAttributes {
	HBA_INT32	npivflag;
	HBA_WWN		NodeWWN;
	HBA_WWN		PortWWN;
	HBA_UINT32	MaxNumberOfNPIVPorts;
	HBA_UINT32	NumberOfNPIVPorts;
} HBA_PORTNPIVATTRIBUTES, *PHBA_PORTNPIVATTRIBUTES;

typedef struct HBA_NPIVAttributes {
	HBA_WWN		NodeWWN;
	HBA_WWN		PortWWN;
} HBA_NPIVATTRIBUTES, *PHBA_NPIVATTRIBUTES;

typedef struct HBA_NPIVCreateEntry {
	HBA_WWN		VNodeWWN;
	HBA_WWN		VPortWWN;
	uint32_t	vindex;
} HBA_NPIVCREATEENTRY, *PHBA_NPIVCREATEENTRY;

/* Device Level Events */
#define	HBA_EVENT_DEVICE_UNKNOWN	0x600
#define	HBA_EVENT_DEVICE_OFFLINE	0x601
#define	HBA_EVENT_DEVICE_ONLINE		0x602

HBA_API HBA_UINT32 Sun_HBA_GetNumberOfTgtAdapters();

HBA_API HBA_STATUS Sun_HBA_GetTgtAdapterName(
    HBA_UINT32		adapterindex,
    char		*adaptername
    );

HBA_API HBA_HANDLE Sun_HBA_OpenTgtAdapter(
    char*		adaptername
    );

HBA_API HBA_STATUS Sun_HBA_OpenTgtAdapterByWWN(
    HBA_HANDLE		*handle,
    HBA_WWN		wwn
    );

HBA_API HBA_STATUS Sun_HBA_NPIVGetAdapterAttributes(
    HBA_HANDLE		handle,
    HBA_ADAPTERATTRIBUTES
			*hbaattributes
    );
HBA_API HBA_STATUS Sun_HBA_GetNPIVPortInfo(
    HBA_HANDLE		handle,
    HBA_UINT32		portindex,
    HBA_UINT32		vportindex,
    HBA_NPIVATTRIBUTES	*attributes
    );
HBA_API HBA_STATUS Sun_HBA_DeleteNPIVPort(
    HBA_HANDLE		handle,
    HBA_UINT32		portindex,
    HBA_WWN		vportWWN
    );
HBA_API HBA_STATUS Sun_HBA_CreateNPIVPort(
    HBA_HANDLE		handle,
    HBA_UINT32		portindex,
    HBA_WWN		vnodeWWN,
    HBA_WWN		vportWWN,
    HBA_UINT32		*npivportindex
    );
HBA_API HBA_STATUS Sun_HBA_GetPortNPIVAttributes(
    HBA_HANDLE		handle,
    HBA_UINT32		portindex,
    HBA_PORTNPIVATTRIBUTES	*portnpivattributes
    );

HBA_STATUS Sun_HBA_AdapterCreateWWN(
    HBA_HANDLE		handle,
    HBA_UINT32		portindex,
    HBA_WWN		*nwwn,
    HBA_WWN		*pwwn,
    HBA_WWN		*OUI,
    HBA_INT32		method
);

HBA_STATUS Sun_HBA_AdapterReturnWWN(
    HBA_HANDLE		handle,
    HBA_UINT32		portindex,
    HBA_WWN		*nwwn,
    HBA_WWN		*pwwn
);

HBA_API HBA_STATUS Sun_HBA_RegisterForAdapterDeviceEvents(
    void		(*callback)(
	void		*data,
	HBA_WWN		PortWWN,
	HBA_UINT32	eventType,
	HBA_UINT32	fabricPortID
	),
    void		*userData,
    HBA_HANDLE		handle,
    HBA_WWN		PortWWN,
    HBA_CALLBACKHANDLE	*callbackHandle
    );

HBA_API HBA_STATUS Sun_HBA_ForceLip(
    HBA_HANDLE handle,
    int *rval);

#endif /* HBA_API_SUN_H */

#ifdef __cplusplus
}
#endif /* _HBA_API_SUN_H */