/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
/*
* These routines tie the Device Manager into IBTL.
*
* ibt_reprobe_dev which can be called by IBTF clients.
* This results in calls to IBnexus callback.
*/
/*
* Globals.
*/
/*
* Function:
* ibtl_ibnex_get_hca_info
* Input:
* hca_guid - The HCA's node GUID.
* flag - Tells what to do
* IBTL_IBNEX_LIST_CLNTS_FLAG - Build a NVLIST containing
* client's names, their AP_IDs and
* alternate_HCA information.
* (-x list_clients option)
* IBTL_IBNEX_UNCFG_CLNTS_FLAG - Build a NVLIST containing
* clients' devpaths and their
* AP_IDs. (-x unconfig_clients)
* callback - Callback function to get ap_id from ib(7d)
* Output:
* buffer - The information is returned in this buffer
* bufsiz - The size of the information buffer
* Returns:
* Description:
* For a given HCA node GUID it figures out the registered clients
* (ie. ones who called ibt_open_hca(9f) on this GUID) and creates
* it. If flag is not specified, then an error is returned.
*/
{
char *node_name;
char *ret_apid;
*bufsiz = 0;
/* verify that valid "flag" is passed */
if (flag != IBTL_IBNEX_LIST_CLNTS_FLAG &&
return (IBT_INVALID_PARAM);
}
/*
* If we are here, then the requested HCA device is not
* present. Return the status as Invalid HCA GUID.
*/
"HCA Not Found, Invalid HCA GUID 0x%llX", hca_guid);
return (IBT_HCA_INVALID);
}
/* Walk the client list */
/* Allocate memory for ret_apid, instead of using stack */
if (flag == IBTL_IBNEX_LIST_CLNTS_FLAG) {
/*
* Always check, first, if this client exists
* under this HCA anymore? If not, continue.
*/
continue;
}
/* Check if this client has more than one HCAs */
else
continue;
}
/*
* All IB clients (IOC, VPPA, Port, Pseudo etc.)
* need to be looked at. The parent of IOC nodes
* should have HCA as parent and node-name is "ibport".
* HCA validity is checked by looking at parent's "dip"
* and the dip saved in the ibtl_hca_devinfo_t.
* NOTE: We only want to list this HCA's IB clients.
* All others clients are ignored.
*/
continue;
}
/*
* Callback is invoked to figure out the
* ap_id string.
*/
} else {
}
} else if (flag == IBTL_IBNEX_UNCFG_CLNTS_FLAG) {
"ibtl_ibnex_get_hca_info: No dip exists");
continue;
}
/*
* if the child has a alternate HCA then skip it
*/
"ibtl_ibnex_get_hca_info: Alt HCA exists");
continue;
}
/*
* See earlier comments on how to check if a client
* is IOC, VPPA, Port or a Pseudo node.
*/
"ibtl_ibnex_get_hca_info: no parent");
continue;
}
/*
* Callback is invoked to figure out the
* ap_id string.
*/
/*
* ddi_pathname() doesn't supply /devices,
* so we do
*/
"ibtl_ibnex_get_hca_info: "
"device path = %s", path);
"ibtl_ibnex_get_hca_info: "
"failed to fill in path %s", path);
return (ibt_get_module_failure(
IBT_FAILURE_IBTL, 0));
}
} /* end of if */
} /* end of while */
} /* End of while */
/* Pack all data into "buffer" */
"nvlist_pack failed");
return (ibt_get_module_failure(IBT_FAILURE_IBTL, 0));
}
*bufsiz);
return (IBT_SUCCESS);
}
/*
* Function:
* ibtl_ibnex_register_callback()
* Input:
* ibnex_cb - IB nexus driver callback routine
* Output:
* none
* Returns:
* none
* Description:
* Register a callback routine for IB nexus driver
*/
void
{
}
/*
* Function:
* ibtl_ibnex_unregister_callback()
* Input:
* none
* Output:
* none
* Returns:
* none
* Description:
* Un-register a callback routine for IB nexus driver
*/
void
{
}
/*
* Function:
* ibtl_ibnex_hcadip2guid
* Input:
* dev_info_t - The "dip" of this HCA
* Output:
* hca_guid - The HCA's node GUID.
* Returns:
* "HCA GUID" on SUCCESS, NULL on FAILURE
* Description:
* For a given HCA node GUID it figures out the HCA GUID
* and returns it. If not found, NULL is returned.
*/
{
while (hca_devp) {
break;
}
}
hca_guid);
return (hca_guid);
}
/*
* Function:
* ibtl_ibnex_hcaguid2dip
* Input:
* hca_guid - The HCA's node GUID.
* Output:
* dev_info_t - The "dip" of this HCA
* Returns:
* "dip" on SUCCESS, NULL on FAILURE
* Description:
* For a given HCA node GUID it figures out the "dip"
* and returns it. If not found, NULL is returned.
*/
{
while (hca_devp) {
break;
}
}
return (dip);
}
/*
* Function:
* ibtl_ibnex_get_hca_verbose_data
* Input:
* hca_guid - The HCA's node GUID.
* Output:
* buffer - The information is returned in this buffer
* bufsiz - The size of the information buffer
* Returns:
* Description:
* For a given HCA node GUID it figures out the verbose listing display.
*/
{
"HCA GUID 0x%llX", hca_guid);
*bufsiz = 0;
/*
* If we are here, then the requested HCA device is not
* present. Return the status as Invalid HCA GUID.
*/
"HCA Not Found, Invalid HCA GUID");
return (IBT_HCA_INVALID);
}
}
return (IBT_SUCCESS);
}
/*
* Function:
* ibt_reprobe_dev()
* Input:
* dev_info_t *dip
* Output:
* none
* Returns:
* Return value from IBnexus callback handler
* IBT_ILLEGAL_OP if IBnexus callback is not installed.
* Description:
* This function passes the IBTF client's "reprobe device
* properties" request to IBnexus. See ibt_reprobe_dev(9f)
* for details.
*/
{
return (IBT_NOT_SUPPORTED);
/*
* Restricting the reprobe request to the children of
* ibnexus. Note the IB_CONF_UPDATE_EVENT DDI event can
* be subscribed by any device on the IBnexus device tree.
*/
return (IBT_NOT_SUPPORTED);
/* Reprobe for IOC nodes only */
return (IBT_NOT_SUPPORTED);
if (ibtl_ibnex_callback_routine) {
return (rv);
}
/* Should -not- come here */
return (IBT_ILLEGAL_OP);
}
/*
* Function:
* ibtl_ibnex_valid_hca_parent
* Input:
* pdip - The parent dip from client's child dev_info_t
* Output:
* NONE
* Returns:
* Description:
* registered HCAs's dip. If match found return IBT_SUCCESS,
* else IBT_NO_HCAS_AVAILABLE.
*
* the ib(7d) nexus or that of the eoib(7d) nexus. If yes
* return IBT_SUCCESS, else IBT_NO_HCAS_AVAILABLE.
*/
{
pdip);
/* For Pseudo devices and IOCs */
return (IBT_SUCCESS);
} else {
/* For Port devices and VPPAs */
while (hca_devp) {
return (IBT_SUCCESS);
}
}
return (IBT_NO_HCAS_AVAILABLE);
}
}
/*
* Function:
* ibtl_ibnex_phci_register
* Input:
* hca_dip - The HCA dip
* Output:
* NONE
* Returns:
* Description:
* Register the HCA dip as the MPxIO PCHI.
*/
{
/* Register the with MPxIO as PHCI */
MDI_SUCCESS) {
return (IBT_FAILURE);
}
return (IBT_SUCCESS);
}
/*
* Function:
* ibtl_ibnex_phci_unregister
* Input:
* hca_dip - The HCA dip
* Output:
* NONE
* Returns:
* Description:
* Free up any pending MPxIO Pathinfos and unregister the HCA dip as the
* MPxIO PCHI.
*/
{
/*
* Should free all the Pathinfos associated with the HCA pdip before
* unregistering the PHCI.
*
* mdi_pi_free will call ib_vhci_pi_uninit() callbackfor each PI where
* the ibnex internal datastructures (ibnex_node_data) will have to be
* cleaned up if needed.
*/
continue;
}
"mdi_pi_free failed");
return (IBT_FAILURE);
}
"unregister failed");
return (IBT_FAILURE);
}
return (IBT_SUCCESS);
}
/*
* Function:
* ibtl_ibnex_query_hca_byguid
* Input:
* hca_guid - The HCA's node GUID.
* driver_name_size- size of the caller allocated driver_name buffer
* Output:
* hca_attrs - caller allocated buffer which will contain
* HCA attributes upon success
* driver_name - caller allocated buffer which will contain
* HCA driver name upon success
* driver_instance - HCA driver instance
* hca_device_path - caller allocated buffer of size MAXPATHLEN which
* will contain hca device path upon success.
* Returns:
* Description:
* Get the HCA attributes, driver name and instance number of the
* specified HCA.
*/
char *hca_device_path)
{
"hca_guid = 0x%llx, hca_attrs = 0x%p, driver_name = 0x%p, "
"driver_name_size = 0x%d, driver_instancep = 0x%p)", hca_guid,
return (IBT_HCA_INVALID);
}
if (strlcpy(driver_name,
return (IBT_INSUFF_KERNEL_RESOURCE);
}
return (IBT_SUCCESS);
}