448bf8594153765bb5fce82a8888e01e3f6c3badLida.Horn * CDDL HEADER START
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Horn * The contents of this file are subject to the terms of the
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Horn * Common Development and Distribution License (the "License").
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Horn * You may not use this file except in compliance with the License.
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Horn * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Horn * See the License for the specific language governing permissions
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Horn * and limitations under the License.
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Horn * When distributing Covered Code, include this CDDL HEADER in each
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Horn * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Horn * If applicable, add the following below this CDDL HEADER, with the
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Horn * fields enclosed by brackets "[]" replaced with your own identifying
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Horn * information: Portions Copyright [yyyy] [name of copyright owner]
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Horn * CDDL HEADER END
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Horn * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Horn * map between minor node #s and HCA indexes and Port #s. This leaves
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Horn * room for 16 boards with up to 16 ports each.
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Horn#define GET_UMAD_MINOR(node, port) ((node << 4) | port)
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Horn#define GET_ISSM_MINOR(node, port) ((node << 4) | port | 0x8000)
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Horn#define GET_NEW_UCTX_MINOR(minor, uctxnum) ((uctxnum << 8) | minor)
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Horn/* UMAD KA instance, only one instance allowed */
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Horn#define MAX_UCTX 16 /* Maximum number of contexts. */
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Horn * User context. One per open file descriptor.
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Horn llist_head_t uctx_agent_list; /* list of agents registered */
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Horn kmutex_t uctx_recv_lock; /* protects recv_list below */
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Horn genlist_t uctx_recv_list; /* Queue of received MADs */
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Horn kcondvar_t uctx_recv_cv; /* wait on for received data */
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Horn struct ib_user_mad_reg_req agent_req; /* Params given during */
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Horn /* registration */
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Horn struct ibmf_reg_info *agent_reg; /* IBMF information */
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Horn umad_uctx_t *agent_uctx; /* User context to which */
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Horn /* this agent belongs. */
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Horn int agent_outstanding_msgs; /* # of msgs waiting */
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Horn /* for a response */
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Horn kmutex_t agent_lock; /* protects this structure */
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Horn kcondvar_t agent_cv; /* used to wake up unregister */
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Horn const umad_hca_info_t *port_hca; /* backpointer to hca */
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Horn unsigned int port_minor_name; /* number in device name. */
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Horn dev_info_t *info_dip; /* back pointer to devinfo */
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Horn * A UMAD we send is linked to a user context.
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Horn struct umad_agent_s *send_agent; /* agent that sent the MAD */
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Horn/* Flags values for ibmf_flags above */
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Hornstatic inline int
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Horn return (1 & (((uint32_t *)addr)[nr >> 5] >> (nr & 31)));
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Hornstatic int umad_attach(dev_info_t *dip, ddi_attach_cmd_t cmd);
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Hornstatic int umad_detach(dev_info_t *dip, ddi_detach_cmd_t cmd);
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Hornstatic int umad_getinfo(dev_info_t *dip, ddi_info_cmd_t cmd, void *arg,
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Hornstatic int umad_prop_op(dev_t dev, dev_info_t *dip, ddi_prop_op_t prop_op,
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Hornstatic int umad_open(dev_t *devp, int flag, int otyp, cred_t *cred);
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Hornstatic int umad_close(dev_t dev, int flag, int otyp, cred_t *cred);
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Hornstatic int umad_read(dev_t dev, struct uio *uiop, cred_t *credp);
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Hornstatic int umad_write(dev_t dev, struct uio *uiop, cred_t *credp);
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Hornstatic int umad_poll(dev_t dev, short events, int anyyet,
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Hornstatic int umad_ioctl(dev_t dev, int cmd, intptr_t arg, int mode,
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Hornstatic void umad_async_handler(void *private, ibt_hca_hdl_t hca_hdl,
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Hornstatic int umad_register(struct ib_user_mad_reg_req *req,
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Hornstatic int umad_unregister(struct ib_user_mad_reg_req *agent,
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Hornstatic void umad_unsolicited_cb(ibmf_handle_t ibmf_handle,
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Horn#endif /* _SYS_IB_CLIENTS_OF_SOL_UMAD_SOL_UMAD_H */