1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #ifndef _SYS_IB_IBTL_IMPL_IBTL_IBNEX_H 28 #define _SYS_IB_IBTL_IMPL_IBTL_IBNEX_H 29 30 #pragma ident "%Z%%M% %I% %E% SMI" 31 32 /* 33 * ibtl_ibnex.h 34 * 35 * All data structures and function prototypes that are specific to the 36 * IBTL<--->IB nexus private interface. 37 */ 38 39 #ifdef __cplusplus 40 extern "C" { 41 #endif 42 43 /* 44 * Cfgadm restricts ap_id length to 30 bytes (See CFGA_LOG_EXT_LEN) 45 */ 46 #define IBTL_IBNEX_APID_LEN 31 47 #define IBTL_IBNEX_STR_LEN 64 48 49 /* 50 * "ioc" and "ibport" child device names 51 */ 52 #define IBNEX_IOC_CNAME "ioc" 53 #define IBNEX_IBPORT_CNAME "ibport" 54 55 /* 56 * These two defines are used by the function ibtl_ibnex_get_hca_info(). 57 * If IBTL_IBNEX_LIST_CLNTS_FLAG is specified then an NVL packed list 58 * of only client names/ap_ids/alternate_HCA is returned. 59 * If IBTL_IBNEX_UNCFG_CLNTS_FLAG is specified then an NVL packed list 60 * of only client ap_ids/devpaths is returned. 61 */ 62 #define IBTL_IBNEX_LIST_CLNTS_FLAG 0x1 /* -x list_clients option */ 63 #define IBTL_IBNEX_UNCFG_CLNTS_FLAG 0x2 /* -x unconfig_clients option */ 64 65 typedef struct ibtl_ibnex_cb_args_s { 66 uint_t cb_flag; 67 dev_info_t *cb_dip; 68 struct modlinkage *cb_modlp; 69 ib_guid_t cb_hca_guid; 70 } ibtl_ibnex_cb_args_t; 71 72 /* Possible values for cb_flag */ 73 #define IBTL_IBNEX_IBC_INIT 0x11 74 #define IBTL_IBNEX_IBC_FINI 0x22 75 #define IBTL_IBNEX_REPROBE_DEV_REQ 0x33 76 77 /* 78 * Function: 79 * ibtl_ibnex_callback_t 80 * Inputs: 81 * cb_args - Arguments for the callback 82 * Returns: 83 * IBT_SUCCESS/IBT_FAILURE 84 * Description: 85 * Currently this routine provides function to check wheter 86 * particular client has access to open HCA or not. 87 */ 88 typedef ibt_status_t (*ibtl_ibnex_callback_t)(ibtl_ibnex_cb_args_t *); 89 90 /* 91 * Function: 92 * ibtl_ibnex_register_callback 93 * Inputs: 94 * ibnex_ibtl_callback - IBTL's IB nexus driver callback function 95 * Returns: 96 * NONE 97 * Description: 98 * Register a callback routine for IB nexus driver. 99 */ 100 void ibtl_ibnex_register_callback(ibtl_ibnex_callback_t); 101 102 /* 103 * Function: 104 * ibtl_ibnex_unregister_callback 105 * Inputs: 106 * NONE 107 * Returns: 108 * NONE 109 * Description: 110 * Un-register the callback routine for IB nexus driver. 111 */ 112 void ibtl_ibnex_unregister_callback(); 113 114 /* 115 * Function: 116 * ibtl_ibnex_get_hca_info 117 * Input: 118 * hca_guid - The HCA's node GUID. 119 * flag - Tells what to do 120 * IBTL_IBNEX_LIST_CLNTS_FLAG - Build client names/ap_ids/ 121 * alternate_HCA database 122 * IBTL_IBNEX_UNCFG_CLNTS_FLAG - Build client devpaths/ 123 * ap_id database 124 * callback - Callback function to get ap_id from ib(7d) 125 * Output: 126 * buffer - The information is returned in this buffer 127 * bufsiz - The size of the information buffer 128 * Returns: 129 * IBT_SUCCESS/IBT_HCA_INVALID/IBT_FAILURE 130 * Description: 131 * For a given HCA node GUID it figures out the registered clients 132 * (ie. ones who called ibt_attach(9f) on this GUID) and creates 133 * a NVL packed buffer (of either names/ap_ids/alternate_HCA or 134 * devpaths/ap_ids) and returns it. If a valid flag is not specified 135 * then an error is returned. 136 */ 137 ibt_status_t ibtl_ibnex_get_hca_info(ib_guid_t hca_guid, int flag, 138 char **buffer, size_t *bufsiz, 139 void (*callback)(dev_info_t *, char **)); 140 141 /* 142 * Function: 143 * ibtl_ibnex_hcadip2guid 144 * Input: 145 * dev_info_t - The "dip" of this HCA 146 * Output: 147 * hca_guid - The HCA's node GUID. 148 * Description: 149 * For a given HCA dip it figures out the GUID 150 * and returns it. If not found, NULL is returned. 151 */ 152 ib_guid_t ibtl_ibnex_hcadip2guid(dev_info_t *); 153 154 /* 155 * Function: 156 * ibtl_ibnex_hcaguid2dip 157 * Input: 158 * hca_guid - The HCA's node GUID. 159 * Output: 160 * dev_info_t - The "dip" of this HCA 161 * Returns: 162 * "dip" on SUCCESS, NULL on FAILURE 163 * Description: 164 * For a given HCA node GUID it figures out the "dip" 165 * and returns it. If not found, NULL is returned. 166 */ 167 dev_info_t *ibtl_ibnex_hcaguid2dip(ib_guid_t); 168 169 /* 170 * Function: 171 * ibtl_ibnex_get_hca_verbose_data 172 * Input: 173 * hca_guid - The HCA's node GUID. 174 * Output: 175 * buffer - The information is returned in this buffer 176 * bufsiz - The size of the information buffer 177 * Returns: 178 * IBT_SUCCESS/IBT_HCA_INVALID/IBT_FAILURE 179 * Description: 180 * For a given HCA node GUID it figures out the verbose listing display. 181 */ 182 ibt_status_t ibtl_ibnex_get_hca_verbose_data(ib_guid_t, char **, size_t *); 183 184 /* 185 * Function: 186 * ibtl_ibnex_valid_hca_parent 187 * Input: 188 * pdip - The parent dip from client's child dev_info_t 189 * Output: 190 * NONE 191 * Returns: 192 * IBT_SUCCESS/IBT_NO_HCAS_AVAILABLE 193 * Description: 194 * For a given pdip, of Port/VPPA devices, match it against all the 195 * registered HCAs's dip. If match found return IBT_SUCCESS, 196 * else IBT_NO_HCAS_AVAILABLE. 197 * For IOC/Pseudo devices check if the given pdip is that of 198 * the ib(7d) nexus. If yes return IBT_SUCCESS, 199 * else IBT_NO_HCAS_AVAILABLE. 200 */ 201 ibt_status_t ibtl_ibnex_valid_hca_parent(dev_info_t *); 202 203 #ifdef __cplusplus 204 } 205 #endif 206 207 #endif /* _SYS_IB_IBTL_IMPL_IBTL_IBNEX_H */ 208