xref: /titanic_41/usr/src/lib/hbaapi/common/hbaapi-sun.h (revision a79493184c9332129c9c91500069322f6f3fafdd)
1fcf3ce44SJohn Forte /*
2fcf3ce44SJohn Forte  * *****************************************************************************
3fcf3ce44SJohn Forte  *
4fcf3ce44SJohn Forte  * Description
5fcf3ce44SJohn Forte  *	hbaapi.h - header file for Sun extension for target mode adaptor
6fcf3ce44SJohn Forte  * 		 support.
7fcf3ce44SJohn Forte  *
8fcf3ce44SJohn Forte  * License:
9fcf3ce44SJohn Forte  *	The contents of this file are subject to the SNIA Public License
10fcf3ce44SJohn Forte  *	Version 1.0 (the "License"); you may not use this file except in
11fcf3ce44SJohn Forte  *	compliance with the License. You may obtain a copy of the License at
12fcf3ce44SJohn Forte  *
13bff3dadcSduo liu - Sun Microsystems - Beijing China  *	http://www.snia.org/English/Resources/Code/OpenSource.html
14fcf3ce44SJohn Forte  *
15fcf3ce44SJohn Forte  *	Software distributed under the License is distributed on an "AS IS"
16fcf3ce44SJohn Forte  *	basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
17fcf3ce44SJohn Forte  *	the License for the specific language governing rights and limitations
18fcf3ce44SJohn Forte  *	under the License.
19fcf3ce44SJohn Forte  *
20bff3dadcSduo liu - Sun Microsystems - Beijing China  * *******************************************************************************
21bff3dadcSduo liu - Sun Microsystems - Beijing China  */
22bff3dadcSduo liu - Sun Microsystems - Beijing China /*
23*a7949318SReed  * 	Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24bff3dadcSduo liu - Sun Microsystems - Beijing China  * 	Use is subject to license terms.
25fcf3ce44SJohn Forte  */
26fcf3ce44SJohn Forte 
27fcf3ce44SJohn Forte #ifdef __cplusplus
28fcf3ce44SJohn Forte extern "C" {
29fcf3ce44SJohn Forte #endif
30fcf3ce44SJohn Forte 
31fcf3ce44SJohn Forte 
32fcf3ce44SJohn Forte #ifndef _HBA_API_SUN_H
33fcf3ce44SJohn Forte #define _HBA_API_SUN_H
34fcf3ce44SJohn Forte 
35fcf3ce44SJohn Forte #include    <hbaapi.h>
36fcf3ce44SJohn Forte 
37fcf3ce44SJohn Forte #define	HBA_CREATE_WWN_RANDOM		1
38fcf3ce44SJohn Forte #define	HBA_CREATE_WWN_FACTORY		2
39fcf3ce44SJohn Forte 
40fcf3ce44SJohn Forte typedef struct HBA_NPIVPortList {
41fcf3ce44SJohn Forte 	uint32_t	numPorts;
42fcf3ce44SJohn Forte 	char		hbaPaths[1][1024];
43fcf3ce44SJohn Forte } HBA_NPIVPORTLIST, *PHBA_NPIVPORTLIST;
44fcf3ce44SJohn Forte 
45fcf3ce44SJohn Forte typedef struct HBA_PortNPIVAttributes {
46fcf3ce44SJohn Forte 	HBA_INT32	npivflag;
47fcf3ce44SJohn Forte 	HBA_WWN		NodeWWN;
48fcf3ce44SJohn Forte 	HBA_WWN		PortWWN;
49fcf3ce44SJohn Forte 	HBA_UINT32	MaxNumberOfNPIVPorts;
50fcf3ce44SJohn Forte 	HBA_UINT32	NumberOfNPIVPorts;
51fcf3ce44SJohn Forte } HBA_PORTNPIVATTRIBUTES, *PHBA_PORTNPIVATTRIBUTES;
52fcf3ce44SJohn Forte 
53fcf3ce44SJohn Forte typedef struct HBA_NPIVAttributes {
54fcf3ce44SJohn Forte 	HBA_WWN		NodeWWN;
55fcf3ce44SJohn Forte 	HBA_WWN		PortWWN;
56fcf3ce44SJohn Forte } HBA_NPIVATTRIBUTES, *PHBA_NPIVATTRIBUTES;
57fcf3ce44SJohn Forte 
58fcf3ce44SJohn Forte typedef struct HBA_NPIVCreateEntry {
59fcf3ce44SJohn Forte 	HBA_WWN		VNodeWWN;
60fcf3ce44SJohn Forte 	HBA_WWN		VPortWWN;
61fcf3ce44SJohn Forte 	uint32_t	vindex;
62fcf3ce44SJohn Forte } HBA_NPIVCREATEENTRY, *PHBA_NPIVCREATEENTRY;
63fcf3ce44SJohn Forte 
64fcf3ce44SJohn Forte /* Device Level Events */
65fcf3ce44SJohn Forte #define	HBA_EVENT_DEVICE_UNKNOWN	0x600
66fcf3ce44SJohn Forte #define	HBA_EVENT_DEVICE_OFFLINE	0x601
67fcf3ce44SJohn Forte #define	HBA_EVENT_DEVICE_ONLINE		0x602
68fcf3ce44SJohn Forte 
69fcf3ce44SJohn Forte HBA_API HBA_UINT32 Sun_HBA_GetNumberOfTgtAdapters();
70fcf3ce44SJohn Forte 
71fcf3ce44SJohn Forte HBA_API HBA_STATUS Sun_HBA_GetTgtAdapterName(
72fcf3ce44SJohn Forte     HBA_UINT32		adapterindex,
73fcf3ce44SJohn Forte     char		*adaptername
74fcf3ce44SJohn Forte     );
75fcf3ce44SJohn Forte 
76fcf3ce44SJohn Forte HBA_API HBA_HANDLE Sun_HBA_OpenTgtAdapter(
77fcf3ce44SJohn Forte     char*		adaptername
78fcf3ce44SJohn Forte     );
79fcf3ce44SJohn Forte 
80fcf3ce44SJohn Forte HBA_API HBA_STATUS Sun_HBA_OpenTgtAdapterByWWN(
81fcf3ce44SJohn Forte     HBA_HANDLE		*handle,
82fcf3ce44SJohn Forte     HBA_WWN		wwn
83fcf3ce44SJohn Forte     );
84fcf3ce44SJohn Forte 
85fcf3ce44SJohn Forte HBA_API HBA_STATUS Sun_HBA_NPIVGetAdapterAttributes(
86fcf3ce44SJohn Forte     HBA_HANDLE		handle,
87fcf3ce44SJohn Forte     HBA_ADAPTERATTRIBUTES
88fcf3ce44SJohn Forte 			*hbaattributes
89fcf3ce44SJohn Forte     );
90fcf3ce44SJohn Forte HBA_API HBA_STATUS Sun_HBA_GetNPIVPortInfo(
91fcf3ce44SJohn Forte     HBA_HANDLE		handle,
92fcf3ce44SJohn Forte     HBA_UINT32		portindex,
93fcf3ce44SJohn Forte     HBA_UINT32		vportindex,
94fcf3ce44SJohn Forte     HBA_NPIVATTRIBUTES	*attributes
95fcf3ce44SJohn Forte     );
96fcf3ce44SJohn Forte HBA_API HBA_STATUS Sun_HBA_DeleteNPIVPort(
97fcf3ce44SJohn Forte     HBA_HANDLE		handle,
98fcf3ce44SJohn Forte     HBA_UINT32		portindex,
99fcf3ce44SJohn Forte     HBA_WWN		vportWWN
100fcf3ce44SJohn Forte     );
101fcf3ce44SJohn Forte HBA_API HBA_STATUS Sun_HBA_CreateNPIVPort(
102fcf3ce44SJohn Forte     HBA_HANDLE		handle,
103fcf3ce44SJohn Forte     HBA_UINT32		portindex,
104fcf3ce44SJohn Forte     HBA_WWN		vnodeWWN,
105fcf3ce44SJohn Forte     HBA_WWN		vportWWN,
106fcf3ce44SJohn Forte     HBA_UINT32		*npivportindex
107fcf3ce44SJohn Forte     );
108fcf3ce44SJohn Forte HBA_API HBA_STATUS Sun_HBA_GetPortNPIVAttributes(
109fcf3ce44SJohn Forte     HBA_HANDLE		handle,
110fcf3ce44SJohn Forte     HBA_UINT32		portindex,
111fcf3ce44SJohn Forte     HBA_PORTNPIVATTRIBUTES	*portnpivattributes
112fcf3ce44SJohn Forte     );
113fcf3ce44SJohn Forte 
114fcf3ce44SJohn Forte HBA_STATUS Sun_HBA_AdapterCreateWWN(
115fcf3ce44SJohn Forte     HBA_HANDLE		handle,
116fcf3ce44SJohn Forte     HBA_UINT32		portindex,
117fcf3ce44SJohn Forte     HBA_WWN		*nwwn,
118fcf3ce44SJohn Forte     HBA_WWN		*pwwn,
119fcf3ce44SJohn Forte     HBA_WWN		*OUI,
120fcf3ce44SJohn Forte     HBA_INT32		method
121fcf3ce44SJohn Forte );
122fcf3ce44SJohn Forte 
123fcf3ce44SJohn Forte HBA_STATUS Sun_HBA_AdapterReturnWWN(
124fcf3ce44SJohn Forte     HBA_HANDLE		handle,
125fcf3ce44SJohn Forte     HBA_UINT32		portindex,
126fcf3ce44SJohn Forte     HBA_WWN		*nwwn,
127fcf3ce44SJohn Forte     HBA_WWN		*pwwn
128fcf3ce44SJohn Forte );
129fcf3ce44SJohn Forte 
130fcf3ce44SJohn Forte HBA_API HBA_STATUS Sun_HBA_RegisterForAdapterDeviceEvents(
131fcf3ce44SJohn Forte     void		(*callback)(
132fcf3ce44SJohn Forte 	void		*data,
133fcf3ce44SJohn Forte 	HBA_WWN		PortWWN,
134fcf3ce44SJohn Forte 	HBA_UINT32	eventType,
135fcf3ce44SJohn Forte 	HBA_UINT32	fabricPortID
136fcf3ce44SJohn Forte 	),
137fcf3ce44SJohn Forte     void		*userData,
138fcf3ce44SJohn Forte     HBA_HANDLE		handle,
139fcf3ce44SJohn Forte     HBA_WWN		PortWWN,
140fcf3ce44SJohn Forte     HBA_CALLBACKHANDLE	*callbackHandle
141fcf3ce44SJohn Forte     );
142fcf3ce44SJohn Forte 
143*a7949318SReed HBA_API HBA_STATUS Sun_HBA_ForceLip(
144*a7949318SReed     HBA_HANDLE handle,
145*a7949318SReed     int *rval);
146fcf3ce44SJohn Forte 
147fcf3ce44SJohn Forte #endif /* HBA_API_SUN_H */
148fcf3ce44SJohn Forte 
149fcf3ce44SJohn Forte #ifdef __cplusplus
150fcf3ce44SJohn Forte }
151fcf3ce44SJohn Forte #endif /* _HBA_API_SUN_H */
152