/*
* 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
*/
/*
*/
/*
* Infiniband Device Management Agent for IB storage.
*/
#include <sys/sysmacros.h>
/*
* NOTE: The IB Device Management Agent function, like other IB
* managers and agents is best implemented as a kernel misc.
* module.
* Eventually we could modify IBT_DM_AGENT so that we don't need to
* open each HCA to receive asynchronous events.
*/
extern struct mod_ops mod_miscops;
/*
* Misc. kernel module for now.
*/
};
};
NULL,
"ibdma"
};
/*
* Module global state allocated at init().
*/
/*
*/
static int ibdma_init();
static int ibdma_fini();
static int ibdma_ibt_init();
static void ibdma_ibt_fini();
/*
* DevMgmt Agent MAD attribute handlers prototypes.
*/
/*
* _init()
*/
int
_init(void)
{
int status;
status = ibdma_init();
if (status != DDI_SUCCESS) {
return (status);
}
if (status != DDI_SUCCESS) {
(void) ibdma_fini();
}
return (status);
}
/*
* _info()
*/
int
{
}
/*
* _fini()
*/
int
_fini(void)
{
int status;
int slot;
if (status != DDI_SUCCESS) {
return (status);
}
/*
* Sanity check to see if anyone is not cleaning
* up appropriately.
*/
}
}
}
(void) ibdma_fini();
return (status);
}
/*
* ibdma_init()
*
* Initialize I/O Unit structure, generate initial HCA list and register
* it port with the IBMF.
*/
static int
{
int status;
/*
* Global lock and I/O Unit initialization.
*/
/*
* Discover IB hardware and setup for device management agent
* support.
*/
status = ibdma_ibt_init();
if (status != DDI_SUCCESS) {
status);
return (status);
}
return (status);
}
/*
* ibdma_fini()
*
* Release resource if we are no longer in use.
*/
static int
{
return (DDI_SUCCESS);
}
/*
* ibdma_ibt_async_handler()
*/
/* ARGSUSED */
static void
{
switch (code) {
case IBT_EVENT_PORT_UP:
case IBT_ERROR_PORT_DOWN:
case IBT_PORT_CHANGE_EVENT:
case IBT_CLNT_REREG_EVENT:
break;
case IBT_HCA_ATTACH_EVENT:
(void *)hca->ih_ibt_hdl);
ibdma->ms_num_hcas++;
}
break;
case IBT_HCA_DETACH_EVENT:
}
break;
default:
#ifdef DEBUG
code);
#endif
break;
}
}
/*
* ibdma_ibt_init()
*/
static int
{
int status;
int hca_cnt;
int hca_ndx;
/*
* Attach to IBTF and get HCA list.
*/
if (status != DDI_SUCCESS) {
status);
return (status);
}
if (hca_cnt < 1) {
#ifdef DEBUG_IBDMA
#endif
/* not an error if no HCAs, but nothing more to do here */
return (DDI_SUCCESS);
}
#ifdef DEBUG_IBDMA
#endif
continue;
}
ibdma->ms_num_hcas++;
}
#ifdef DEBUG_IBDMA
ibdma->ms_num_hcas);
#endif
return (DDI_SUCCESS);
}
/*
* ibdma_ibt_fini()
*/
static void
{
#ifdef DEBUG_IBDMA
(void *)hca->ih_ibt_hdl);
#endif
}
ibdma->ms_num_hcas = 0;
}
/*
* ibdma_find_hca()
*/
static ibdma_hca_t *
{
break;
}
}
return (hca);
}
/*
* ibdma_hca_init()
*/
static ibdma_hca_t *
{
int ndx;
if (status != IBT_SUCCESS) {
status);
return (NULL);
}
#ifdef DEBUG_IBDMA
#endif
return (NULL);
}
/*
* It would be better to not open, but IBTL is setup to only allow
* certain managers to get async call backs if not open.
*/
if (status != IBT_SUCCESS) {
status);
return (NULL);
}
/*
* Register with the IB Management Framework and setup MAD call-back.
*/
if (status != IBMF_SUCCESS) {
status);
return (NULL);
}
if (status != IBMF_SUCCESS) {
status);
return (NULL);
}
if (status != IBT_SUCCESS) {
" error (%d)", status);
return (NULL);
}
}
return (hca);
}
/*
* ibdma_hca_fini()
*/
static void
{
int status;
int ndx;
/*
* All handles should have been de-registered, but release
* any that are outstanding.
*/
" exists");
}
/*
* Un-register with the IBMF.
*/
if (status != IBT_SUCCESS)
" error (%d)", status);
continue;
if (status != IBMF_SUCCESS)
" error (%d)", status);
if (status != IBMF_SUCCESS)
" error (%d)", status);
}
if (status != IBT_SUCCESS)
}
/* DM IBMF MAD handlers */
/*
* ibdma_create_resp_mad()
*/
static void
{
/*
* Allocate send buffer fix up hdr for response.
*/
/*
* We may want to support a GRH since this is a GMP; not
* required for current SRP device manager platforms.
*/
#if 0
}
#endif
}
/*
* ibdma_mad_send_cb()
*/
/* ARGSUSED */
static void
{
/*
* Just free the buffers and release the message.
*/
}
}
}
/*
* ibdma_mad_recv_cb()
*/
static void
{
int status;
goto drop;
}
#ifdef DEBUG_IBDMA
#endif
goto drop;
}
#ifdef DEBUG_IBDMA
" for set");
#endif
goto send_resp;
}
#ifdef DEBUG_IBDMA
" for set");
#endif
goto send_resp;
}
/*
* Process a GET method.
*/
case IB_DM_ATTR_CLASSPORTINFO:
break;
case IB_DM_ATTR_IO_UNITINFO:
break;
break;
break;
default:
break;
}
if (status != IBMF_SUCCESS) {
}
return;
drop:
if (status != IBMF_SUCCESS) {
status);
}
}
/*
* ibdma_get_class_portinfo()
*/
static void
{
}
/*
* ibdma_get_io_unitinfo()
*/
static void
{
}
/*
* ibdma_get_ioc_profile()
*/
static void
{
iocp = (ib_dm_ioc_ctrl_profile_t *)
return;
}
slot--;
sizeof (ib_dm_ioc_ctrl_profile_t));
} else {
}
}
/*
* ibdma_get_ioc_services()
*/
static void
{
return;
}
slot--;
return;
}
return;
}
return;
}
}
/*
* Client API internal helpers
*/
/*
* ibdma_hdl_to_ioc()
*/
{
return (NULL);
}
return (NULL);
}
break;
}
}
return (hdl_impl);
}
/*
* ibdma_set_ioc_state()
*
* slot should be 0 based (not DM 1 based slot).
*
* I/O Unit write lock should be held outside of this function.
*/
static void
{
if (slot & 1) {
} else {
}
id++;
#ifdef DEBUG_IBDMA
#endif
}
/*
* ibdma_get_ioc_state()
*
* slot should be 0 based (not DM 1 based slot).
*
* I/O Unit read lock should be held outside of this function.
*/
static ibdma_ioc_state_t
{
if (slot >= IBDMA_MAX_IOC)
return (0xFF);
return (cur);
}
/* CLIENT API Implementation */
/*
* ibdma_ioc_register()
*
*/
{
int svc_entries;
int slot;
return (NULL);
}
if (svc_entries == 0) {
return (NULL);
}
/*
* Find the associated I/O Unit.
*/
return (NULL);
}
if (free_slot == -1) {
}
continue;
}
#ifdef DEBUG_IBDMA
" registered");
#endif
return (NULL);
}
}
if (free_slot < 0) {
return (NULL);
}
#ifdef DEBUG_IBDMA
#endif
/*
* Allocate local copy of profile and services.
*/
sizeof (ib_dm_ioc_ctrl_profile_t));
sizeof (ib_dm_srv_t) * svc_entries);
/*
* Update the profile copy with the I/O controller slot assigned.
* field.
*/
return ((ibdma_hdl_t)hdl);
}
/*
* ibdma_ioc_unregister()
*
*/
{
int slot;
return (IBDMA_BAD_PARAM);
}
" not found");
return (IBDMA_BAD_PARAM);
}
break;
}
}
return (IBDMA_BAD_PARAM);
}
return (IBDMA_BAD_PARAM);
}
" slot in IOC");
return (IBDMA_BAD_PARAM);
}
return (IBDMA_BAD_PARAM);
}
return (IBDMA_SUCCESS);
}
/*
* ibdma_ioc_update()
*
*/
{
return (IBDMA_BAD_PARAM);
}
return (IBDMA_BAD_PARAM);
}
return (IBDMA_BAD_PARAM);
}
break;
}
}
return (IBDMA_BAD_PARAM);
}
return (IBDMA_BAD_PARAM);
}
(void *)hdl);
return (IBDMA_BAD_PARAM);
}
return (IBDMA_BAD_PARAM);
}
sizeof (ib_dm_srv_t));
sizeof (ib_dm_srv_t), KM_SLEEP);
/*
* Update the profile copy with the I/O controller slot assigned.
* field.
*/
return (IBDMA_SUCCESS);
}