xref: /onnv-gate/usr/src/uts/common/sys/ib/ibtl/impl/ibtl_ibnex.h (revision 10094:cbc8983f4340)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
58082SRamaswamy.Tummala@Sun.COM  * Common Development and Distribution License (the "License").
68082SRamaswamy.Tummala@Sun.COM  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
229879SRamaswamy.Tummala@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #ifndef _SYS_IB_IBTL_IMPL_IBTL_IBNEX_H
270Sstevel@tonic-gate #define	_SYS_IB_IBTL_IMPL_IBTL_IBNEX_H
280Sstevel@tonic-gate 
290Sstevel@tonic-gate /*
300Sstevel@tonic-gate  * ibtl_ibnex.h
310Sstevel@tonic-gate  *
320Sstevel@tonic-gate  * All data structures and function prototypes that are specific to the
330Sstevel@tonic-gate  * IBTL<--->IB nexus private interface.
340Sstevel@tonic-gate  */
350Sstevel@tonic-gate 
360Sstevel@tonic-gate #ifdef __cplusplus
370Sstevel@tonic-gate extern "C" {
380Sstevel@tonic-gate #endif
390Sstevel@tonic-gate 
400Sstevel@tonic-gate /*
410Sstevel@tonic-gate  * Cfgadm restricts ap_id length to 30 bytes (See CFGA_LOG_EXT_LEN)
420Sstevel@tonic-gate  */
430Sstevel@tonic-gate #define	IBTL_IBNEX_APID_LEN	31
440Sstevel@tonic-gate #define	IBTL_IBNEX_STR_LEN	64
450Sstevel@tonic-gate 
460Sstevel@tonic-gate /*
470Sstevel@tonic-gate  * "ioc" and "ibport" child device names
480Sstevel@tonic-gate  */
490Sstevel@tonic-gate #define	IBNEX_IOC_CNAME		"ioc"
500Sstevel@tonic-gate #define	IBNEX_IBPORT_CNAME	"ibport"
510Sstevel@tonic-gate 
520Sstevel@tonic-gate /*
530Sstevel@tonic-gate  * These two defines are used by the function ibtl_ibnex_get_hca_info().
540Sstevel@tonic-gate  * If IBTL_IBNEX_LIST_CLNTS_FLAG is specified then an NVL packed list
550Sstevel@tonic-gate  * of only client names/ap_ids/alternate_HCA is returned.
560Sstevel@tonic-gate  * If IBTL_IBNEX_UNCFG_CLNTS_FLAG is specified then an NVL packed list
570Sstevel@tonic-gate  * of only client ap_ids/devpaths is returned.
580Sstevel@tonic-gate  */
590Sstevel@tonic-gate #define	IBTL_IBNEX_LIST_CLNTS_FLAG	0x1	/* -x list_clients option */
600Sstevel@tonic-gate #define	IBTL_IBNEX_UNCFG_CLNTS_FLAG	0x2	/* -x unconfig_clients option */
610Sstevel@tonic-gate 
620Sstevel@tonic-gate typedef struct ibtl_ibnex_cb_args_s {
630Sstevel@tonic-gate 	uint_t			cb_flag;
640Sstevel@tonic-gate 	dev_info_t		*cb_dip;
650Sstevel@tonic-gate 	struct modlinkage	*cb_modlp;
660Sstevel@tonic-gate 	ib_guid_t		cb_hca_guid;
670Sstevel@tonic-gate } ibtl_ibnex_cb_args_t;
680Sstevel@tonic-gate 
690Sstevel@tonic-gate /* Possible values for cb_flag */
700Sstevel@tonic-gate #define	IBTL_IBNEX_IBC_INIT		0x11
710Sstevel@tonic-gate #define	IBTL_IBNEX_IBC_FINI		0x22
720Sstevel@tonic-gate #define	IBTL_IBNEX_REPROBE_DEV_REQ	0x33
730Sstevel@tonic-gate 
740Sstevel@tonic-gate /*
750Sstevel@tonic-gate  * Function:
760Sstevel@tonic-gate  *	ibtl_ibnex_callback_t
770Sstevel@tonic-gate  * Inputs:
780Sstevel@tonic-gate  *	cb_args		- Arguments for the callback
790Sstevel@tonic-gate  * Returns:
800Sstevel@tonic-gate  *	IBT_SUCCESS/IBT_FAILURE
810Sstevel@tonic-gate  * Description:
820Sstevel@tonic-gate  *	Currently this routine provides function to check wheter
830Sstevel@tonic-gate  *	particular client has access to open HCA or not.
840Sstevel@tonic-gate  */
850Sstevel@tonic-gate typedef ibt_status_t (*ibtl_ibnex_callback_t)(ibtl_ibnex_cb_args_t *);
860Sstevel@tonic-gate 
870Sstevel@tonic-gate /*
880Sstevel@tonic-gate  * Function:
890Sstevel@tonic-gate  *	ibtl_ibnex_register_callback
900Sstevel@tonic-gate  * Inputs:
910Sstevel@tonic-gate  *	ibnex_ibtl_callback	- IBTL's IB nexus driver callback function
920Sstevel@tonic-gate  * Returns:
930Sstevel@tonic-gate  *	NONE
940Sstevel@tonic-gate  * Description:
950Sstevel@tonic-gate  *	Register a callback routine for IB nexus driver.
960Sstevel@tonic-gate  */
970Sstevel@tonic-gate void	ibtl_ibnex_register_callback(ibtl_ibnex_callback_t);
980Sstevel@tonic-gate 
990Sstevel@tonic-gate /*
1000Sstevel@tonic-gate  * Function:
1010Sstevel@tonic-gate  *	ibtl_ibnex_unregister_callback
1020Sstevel@tonic-gate  * Inputs:
1030Sstevel@tonic-gate  *	NONE
1040Sstevel@tonic-gate  * Returns:
1050Sstevel@tonic-gate  *	NONE
1060Sstevel@tonic-gate  * Description:
1070Sstevel@tonic-gate  *	Un-register the callback routine for IB nexus driver.
1080Sstevel@tonic-gate  */
1090Sstevel@tonic-gate void	ibtl_ibnex_unregister_callback();
1100Sstevel@tonic-gate 
1110Sstevel@tonic-gate /*
1120Sstevel@tonic-gate  * Function:
1130Sstevel@tonic-gate  *	ibtl_ibnex_get_hca_info
1140Sstevel@tonic-gate  * Input:
1150Sstevel@tonic-gate  *	hca_guid	- The HCA's node GUID.
1160Sstevel@tonic-gate  *	flag		- Tells what to do
1170Sstevel@tonic-gate  *			IBTL_IBNEX_LIST_CLNTS_FLAG - Build client names/ap_ids/
1180Sstevel@tonic-gate  *			    alternate_HCA database
1190Sstevel@tonic-gate  *			IBTL_IBNEX_UNCFG_CLNTS_FLAG - Build client devpaths/
1200Sstevel@tonic-gate  *			    ap_id database
1210Sstevel@tonic-gate  *	callback	- Callback function to get ap_id from ib(7d)
1220Sstevel@tonic-gate  * Output:
1230Sstevel@tonic-gate  *	buffer		- The information is returned in this buffer
1240Sstevel@tonic-gate  *      bufsiz		- The size of the information buffer
1250Sstevel@tonic-gate  * Returns:
1260Sstevel@tonic-gate  *	IBT_SUCCESS/IBT_HCA_INVALID/IBT_FAILURE
1270Sstevel@tonic-gate  * Description:
1280Sstevel@tonic-gate  *      For a given HCA node GUID it figures out the registered clients
1290Sstevel@tonic-gate  *	(ie. ones who called ibt_attach(9f) on this GUID) and creates
1300Sstevel@tonic-gate  *	a NVL packed buffer (of either names/ap_ids/alternate_HCA or
1310Sstevel@tonic-gate  *	devpaths/ap_ids) and returns it. If a valid flag is not specified
1320Sstevel@tonic-gate  *	then an error is returned.
1330Sstevel@tonic-gate  */
1340Sstevel@tonic-gate ibt_status_t	ibtl_ibnex_get_hca_info(ib_guid_t hca_guid, int flag,
1350Sstevel@tonic-gate 		    char **buffer, size_t *bufsiz,
1360Sstevel@tonic-gate 		    void (*callback)(dev_info_t *, char **));
1370Sstevel@tonic-gate 
1380Sstevel@tonic-gate /*
1390Sstevel@tonic-gate  * Function:
1400Sstevel@tonic-gate  *	ibtl_ibnex_hcadip2guid
1410Sstevel@tonic-gate  * Input:
1420Sstevel@tonic-gate  *	dev_info_t	- The "dip" of this HCA
1430Sstevel@tonic-gate  * Output:
1440Sstevel@tonic-gate  *	hca_guid	- The HCA's node GUID.
1450Sstevel@tonic-gate  * Description:
1460Sstevel@tonic-gate  *	For a given HCA dip it figures out the GUID
1470Sstevel@tonic-gate  *	and returns it. If not found, NULL is returned.
1480Sstevel@tonic-gate  */
1490Sstevel@tonic-gate ib_guid_t	ibtl_ibnex_hcadip2guid(dev_info_t *);
1500Sstevel@tonic-gate 
1510Sstevel@tonic-gate /*
1520Sstevel@tonic-gate  * Function:
1530Sstevel@tonic-gate  *	ibtl_ibnex_hcaguid2dip
1540Sstevel@tonic-gate  * Input:
1550Sstevel@tonic-gate  *	hca_guid	- The HCA's node GUID.
1560Sstevel@tonic-gate  * Output:
1570Sstevel@tonic-gate  *	dev_info_t	- The "dip" of this HCA
1580Sstevel@tonic-gate  * Returns:
1590Sstevel@tonic-gate  *	 "dip" on SUCCESS, NULL on FAILURE
1600Sstevel@tonic-gate  * Description:
1610Sstevel@tonic-gate  *	For a given HCA node GUID it figures out the "dip"
1620Sstevel@tonic-gate  *	and returns it. If not found, NULL is returned.
1630Sstevel@tonic-gate  */
1640Sstevel@tonic-gate dev_info_t	*ibtl_ibnex_hcaguid2dip(ib_guid_t);
1650Sstevel@tonic-gate 
1660Sstevel@tonic-gate /*
1670Sstevel@tonic-gate  * Function:
1680Sstevel@tonic-gate  *	ibtl_ibnex_get_hca_verbose_data
1690Sstevel@tonic-gate  * Input:
1700Sstevel@tonic-gate  *	hca_guid	- The HCA's node GUID.
1710Sstevel@tonic-gate  * Output:
1720Sstevel@tonic-gate  *	buffer		- The information is returned in this buffer
1730Sstevel@tonic-gate  *      bufsiz		- The size of the information buffer
1740Sstevel@tonic-gate  * Returns:
1750Sstevel@tonic-gate  *	IBT_SUCCESS/IBT_HCA_INVALID/IBT_FAILURE
1760Sstevel@tonic-gate  * Description:
1770Sstevel@tonic-gate  *      For a given HCA node GUID it figures out the verbose listing display.
1780Sstevel@tonic-gate  */
1790Sstevel@tonic-gate ibt_status_t	ibtl_ibnex_get_hca_verbose_data(ib_guid_t, char **, size_t *);
1800Sstevel@tonic-gate 
1810Sstevel@tonic-gate /*
1820Sstevel@tonic-gate  * Function:
1830Sstevel@tonic-gate  *	ibtl_ibnex_valid_hca_parent
1840Sstevel@tonic-gate  * Input:
1850Sstevel@tonic-gate  *	pdip		- The parent dip from client's child dev_info_t
1860Sstevel@tonic-gate  * Output:
1870Sstevel@tonic-gate  *	NONE
1880Sstevel@tonic-gate  * Returns:
1890Sstevel@tonic-gate  *	IBT_SUCCESS/IBT_NO_HCAS_AVAILABLE
1900Sstevel@tonic-gate  * Description:
1910Sstevel@tonic-gate  *	For a given pdip, of Port/VPPA devices, match it against all the
1920Sstevel@tonic-gate  *	registered HCAs's dip.  If match found return IBT_SUCCESS,
1930Sstevel@tonic-gate  *	else IBT_NO_HCAS_AVAILABLE.
1940Sstevel@tonic-gate  *	For IOC/Pseudo devices check if the given pdip is that of
1950Sstevel@tonic-gate  *	the ib(7d) nexus. If yes return IBT_SUCCESS,
1960Sstevel@tonic-gate  *	else IBT_NO_HCAS_AVAILABLE.
1970Sstevel@tonic-gate  */
1980Sstevel@tonic-gate ibt_status_t	ibtl_ibnex_valid_hca_parent(dev_info_t *);
1990Sstevel@tonic-gate 
2008082SRamaswamy.Tummala@Sun.COM /*
2018082SRamaswamy.Tummala@Sun.COM  * Function:
2028082SRamaswamy.Tummala@Sun.COM  *	ibtl_ibnex_phci_register
2038082SRamaswamy.Tummala@Sun.COM  * Input:
2048082SRamaswamy.Tummala@Sun.COM  *	hca_dip		- The HCA dip
2058082SRamaswamy.Tummala@Sun.COM  * Output:
2068082SRamaswamy.Tummala@Sun.COM  *	NONE
2078082SRamaswamy.Tummala@Sun.COM  * Returns:
2088082SRamaswamy.Tummala@Sun.COM  *	IBT_SUCCESS/IBT_FAILURE
2098082SRamaswamy.Tummala@Sun.COM  * Description:
2108082SRamaswamy.Tummala@Sun.COM  * 	Register the HCA dip as the MPxIO PCHI.
2118082SRamaswamy.Tummala@Sun.COM  */
2128082SRamaswamy.Tummala@Sun.COM ibt_status_t	ibtl_ibnex_phci_register(dev_info_t *hca_dip);
2138082SRamaswamy.Tummala@Sun.COM 
2148082SRamaswamy.Tummala@Sun.COM /*
2158082SRamaswamy.Tummala@Sun.COM  * Function:
2168082SRamaswamy.Tummala@Sun.COM  *	ibtl_ibnex_phci_unregister
2178082SRamaswamy.Tummala@Sun.COM  * Input:
2188082SRamaswamy.Tummala@Sun.COM  *	hca_dip		- The HCA dip
2198082SRamaswamy.Tummala@Sun.COM  * Output:
2208082SRamaswamy.Tummala@Sun.COM  *	NONE
2218082SRamaswamy.Tummala@Sun.COM  * Returns:
2228082SRamaswamy.Tummala@Sun.COM  *	IBT_SUCCESS/IBT_FAILURE
2238082SRamaswamy.Tummala@Sun.COM  * Description:
2248082SRamaswamy.Tummala@Sun.COM  * 	Free up any pending MPxIO Pathinfos and unregister the HCA dip as the
2258082SRamaswamy.Tummala@Sun.COM  * 	MPxIO PCHI.
2268082SRamaswamy.Tummala@Sun.COM  */
2278082SRamaswamy.Tummala@Sun.COM ibt_status_t	ibtl_ibnex_phci_unregister(dev_info_t *hca_dip);
2288082SRamaswamy.Tummala@Sun.COM 
2299879SRamaswamy.Tummala@Sun.COM /*
2309879SRamaswamy.Tummala@Sun.COM  * Function:
2319879SRamaswamy.Tummala@Sun.COM  *	ibtl_ibnex_query_hca_byguid
2329879SRamaswamy.Tummala@Sun.COM  * Input:
2339879SRamaswamy.Tummala@Sun.COM  *	hca_guid	- The HCA's node GUID.
2349879SRamaswamy.Tummala@Sun.COM  *	driver_name_size- size of the caller allocated driver_name buffer
2359879SRamaswamy.Tummala@Sun.COM  * Output:
2369879SRamaswamy.Tummala@Sun.COM  *	hca_attrs	- caller allocated buffer which will contain
2379879SRamaswamy.Tummala@Sun.COM  *			  HCA attributes upon success
2389879SRamaswamy.Tummala@Sun.COM  *	driver_name	- caller allocated buffer which will contain
2399879SRamaswamy.Tummala@Sun.COM  *			  HCA driver name upon success
2409879SRamaswamy.Tummala@Sun.COM  *	driver_instance - HCA driver instance
241*10094SRamaswamy.Tummala@Sun.COM  *	hca_device_path	- caller allocated buffer of size MAXPATHLEN which
242*10094SRamaswamy.Tummala@Sun.COM  *			  will contain hca device path upon success.
2439879SRamaswamy.Tummala@Sun.COM  * Returns:
2449879SRamaswamy.Tummala@Sun.COM  *	IBT_SUCCESS/IBT_FAILURE
2459879SRamaswamy.Tummala@Sun.COM  * Description:
2469879SRamaswamy.Tummala@Sun.COM  *	Get the HCA attributes, driver name and instance number of the
2479879SRamaswamy.Tummala@Sun.COM  *	specified HCA.
2489879SRamaswamy.Tummala@Sun.COM  */
2499879SRamaswamy.Tummala@Sun.COM ibt_status_t
250*10094SRamaswamy.Tummala@Sun.COM ibtl_ibnex_query_hca_byguid(ib_guid_t, ibt_hca_attr_t *, char *, size_t, int *,
251*10094SRamaswamy.Tummala@Sun.COM     char *);
2529879SRamaswamy.Tummala@Sun.COM 
2530Sstevel@tonic-gate #ifdef __cplusplus
2540Sstevel@tonic-gate }
2550Sstevel@tonic-gate #endif
2560Sstevel@tonic-gate 
2570Sstevel@tonic-gate #endif /* _SYS_IB_IBTL_IMPL_IBTL_IBNEX_H */
258