diff options
Diffstat (limited to 'usr/src/uts/sun4v/io')
24 files changed, 375 insertions, 392 deletions
diff --git a/usr/src/uts/sun4v/io/dr_cpu.c b/usr/src/uts/sun4v/io/dr_cpu.c index f2cfbb5873..e980cb55de 100644 --- a/usr/src/uts/sun4v/io/dr_cpu.c +++ b/usr/src/uts/sun4v/io/dr_cpu.c @@ -583,7 +583,7 @@ dr_cpu_res_array_init(dr_cpu_hdr_t *req, drctl_rsrc_t *rsrc, int nrsrc) * on the memory allocated for the message buffer * itself. */ - if (rsrc[idx].offset != NULL) { + if (rsrc[idx].offset != 0) { err_str = (char *)rsrc + rsrc[idx].offset; err_len = strlen(err_str) + 1; diff --git a/usr/src/uts/sun4v/io/dr_mem.c b/usr/src/uts/sun4v/io/dr_mem.c index c9695e7c6f..2443f4d550 100644 --- a/usr/src/uts/sun4v/io/dr_mem.c +++ b/usr/src/uts/sun4v/io/dr_mem.c @@ -611,7 +611,7 @@ dr_mem_res_array_init(dr_mem_hdr_t *req, drctl_rsrc_t *rsrc, int nrsrc) * on the memory allocated for the message buffer * itself. */ - if (rsrc[idx].offset != NULL) { + if (rsrc[idx].offset != 0) { err_str = (char *)rsrc + rsrc[idx].offset; err_len = strlen(err_str) + 1; @@ -768,7 +768,7 @@ dr_mem_list_query(dr_mem_hdr_t *req, dr_mem_hdr_t **resp, int *resp_len) /* allocate a response message, should be freed by caller */ nml = 0; rlen = sizeof (dr_mem_hdr_t); - if (req_mblks->addr == NULL && req_mblks->size == 0) { + if (req_mblks->addr == 0 && req_mblks->size == 0) { /* * Request is for domain's full view of it's memory. * place a copy in phys_copy then release the memlist lock. @@ -926,8 +926,8 @@ dr_mem_unconfigure(dr_mem_blk_t *mbp, int *status) if (!MBLK_IS_VALID(mbp)) { DR_DBG_MEM("invalid mblk 0x%lx.0x%lx\n", mbp->addr, mbp->size); - *status = DR_MEM_STAT_CONFIGURED; - rv = DR_MEM_RES_EINVAL; + *status = DR_MEM_STAT_CONFIGURED; + rv = DR_MEM_RES_EINVAL; } else if (rv = mem_del(btop(mbp->addr), btop(mbp->size))) { *status = DR_MEM_STAT_CONFIGURED; } else { diff --git a/usr/src/uts/sun4v/io/ds_common.c b/usr/src/uts/sun4v/io/ds_common.c index 54876ac3bc..fad3014d2b 100644 --- a/usr/src/uts/sun4v/io/ds_common.c +++ b/usr/src/uts/sun4v/io/ds_common.c @@ -431,7 +431,7 @@ ds_ldc_fini(ds_port_t *port) } port->ldc.id = (uint64_t)-1; - port->ldc.hdl = NULL; + port->ldc.hdl = 0; port->ldc.state = 0; return (rv); @@ -2492,7 +2492,7 @@ ds_ucap_init(ds_capability_t *cap, ds_clnt_ops_t *ops, uint32_t flags, ds_vers_check_t status; ds_svc_t *svc; int rv = 0; - ds_svc_hdl_t lb_hdl, hdl; + ds_svc_hdl_t lb_hdl, hdl; int is_loopback; int is_client; diff --git a/usr/src/uts/sun4v/io/ds_drv.c b/usr/src/uts/sun4v/io/ds_drv.c index 2b2ba29e52..b812999005 100644 --- a/usr/src/uts/sun4v/io/ds_drv.c +++ b/usr/src/uts/sun4v/io/ds_drv.c @@ -493,8 +493,6 @@ static ds_log_entry_t ds_log_entry_pool[DS_LOG_NPOOL]; static void ds_log_init(void) { - ds_log_entry_t *new; - /* initialize global lock */ mutex_init(&ds_log.lock, NULL, MUTEX_DRIVER, NULL); @@ -506,9 +504,9 @@ ds_log_init(void) ds_log.nentry = 0; /* initialize the free list */ - for (new = ds_log_entry_pool; new < DS_LOG_POOL_END; new++) { - new->next = ds_log.freelist; - ds_log.freelist = new; + for (int i = 0; i < DS_LOG_NPOOL; i++) { + ds_log_entry_pool[i].next = ds_log.freelist; + ds_log.freelist = &ds_log_entry_pool[i]; } mutex_exit(&ds_log.lock); diff --git a/usr/src/uts/sun4v/io/glvc/glvc.c b/usr/src/uts/sun4v/io/glvc/glvc.c index 8c151416aa..77dd8c60f3 100644 --- a/usr/src/uts/sun4v/io/glvc/glvc.c +++ b/usr/src/uts/sun4v/io/glvc/glvc.c @@ -254,7 +254,7 @@ glvc_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) { int instance; int err; - glvc_soft_state_t *softsp; + glvc_soft_state_t *softsp; switch (cmd) { case DDI_ATTACH: @@ -338,7 +338,7 @@ glvc_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) va_to_pa((caddr_t)softsp->mb_send_buf); err = ddi_create_minor_node(dip, "glvc", S_IFCHR, - instance, DDI_PSEUDO, NULL); + instance, DDI_PSEUDO, 0); if (err != DDI_SUCCESS) { kmem_free(softsp->mb_recv_buf, softsp->mtu); kmem_free(softsp->mb_send_buf, softsp->mtu); @@ -412,7 +412,7 @@ glvc_detach(dev_info_t *dip, ddi_detach_cmd_t cmd) { int instance; int err; - glvc_soft_state_t *softsp; + glvc_soft_state_t *softsp; switch (cmd) { diff --git a/usr/src/uts/sun4v/io/iospc/iospc.c b/usr/src/uts/sun4v/io/iospc/iospc.c index 47efae480c..8ca72c2539 100644 --- a/usr/src/uts/sun4v/io/iospc/iospc.c +++ b/usr/src/uts/sun4v/io/iospc/iospc.c @@ -377,7 +377,7 @@ iospc_create_picN_kstat(char *mod_name, int pic, uint64_t ev_offset, (void) snprintf(pic_name, PIC_STR_LEN, "pic%1d", pic); if ((picN_ksp = kstat_create(mod_name, 0, pic_name, - "bus", KSTAT_TYPE_NAMED, num_ev, NULL)) == NULL) { + "bus", KSTAT_TYPE_NAMED, num_ev, 0)) == NULL) { return (NULL); } @@ -467,7 +467,7 @@ iospc_create_cntr_kstat(char *name, int dev_inst, */ static int iospc_perfcnt_program(iospc_t *iospc_p, iospc_grp_t *grp_p, - iospc_ksinfo_t *ksinfo_p, uint64_t new_events) + iospc_ksinfo_t *ksinfo_p, uint64_t new_events) { uint64_t old_events; int rval = SUCCESS; diff --git a/usr/src/uts/sun4v/io/ldc.c b/usr/src/uts/sun4v/io/ldc.c index 939c260834..0b2b94d173 100644 --- a/usr/src/uts/sun4v/io/ldc.c +++ b/usr/src/uts/sun4v/io/ldc.c @@ -288,18 +288,6 @@ ldc_inject_error(ldc_chan_t *ldcp, uint64_t error) return (B_TRUE); } -#define D1 \ -if (ldcdbg & 0x01) \ - ldcdebug - -#define D2 \ -if (ldcdbg & 0x02) \ - ldcdebug - -#define DWARN \ -if (ldcdbg & 0x04) \ - ldcdebug - #define DUMP_PAYLOAD(id, addr) \ { \ char buf[65*3]; \ @@ -321,10 +309,10 @@ if (ldcdbg & 0x04) \ (msg->env & LDC_FRAG_START) ? 'B' : ' ', \ (msg->env & LDC_FRAG_STOP) ? 'E' : ' ', \ (msg->env & LDC_LEN_MASK)); \ - } else { \ + } else { \ D2((c)->id, "%s: msg%d (/%x/%x/%x/,env=%x)", (s), \ mid, msg->type, msg->stype, msg->ctrl, msg->env); \ - } \ + } \ } #define LDC_INJECT_RESET(_ldcp) ldc_inject_error(_ldcp, LDC_ERR_RESET) @@ -337,10 +325,6 @@ extern void i_ldc_mem_inject_dring_clear(ldc_chan_t *ldcp); #define DBG_ALL_LDCS -1 -#define D1 -#define D2 -#define DWARN - #define DUMP_PAYLOAD(id, addr) #define DUMP_LDC_PKT(c, s, addr) @@ -461,10 +445,10 @@ _info(struct modinfo *modinfop) int _fini(void) { - int rv, status; - ldc_chan_t *tmp_ldcp, *ldcp; - ldc_dring_t *tmp_dringp, *dringp; - ldc_mem_info_t minfo; + int rv, status; + ldc_chan_t *tmp_ldcp, *ldcp; + ldc_dring_t *tmp_dringp, *dringp; + ldc_mem_info_t minfo; /* Unlink the driver module from the system */ status = mod_remove(&ml); @@ -564,7 +548,7 @@ i_ldc_h2v_error(int h_error) case H_ENOTSUPPORTED: return (ENOTSUP); - case H_ETOOMANY: + case H_ETOOMANY: return (ENOSPC); case H_ECHANNEL: @@ -809,8 +793,8 @@ i_ldc_clear_intr(ldc_chan_t *ldcp, cnex_intrtype_t itype) static int i_ldc_set_rx_head(ldc_chan_t *ldcp, uint64_t head) { - int rv; - int retries; + int rv; + int retries; ASSERT(MUTEX_HELD(&ldcp->lock)); for (retries = 0; retries < ldc_max_retries; retries++) { @@ -840,7 +824,7 @@ i_ldc_set_rx_head(ldc_chan_t *ldcp, uint64_t head) static void i_ldc_get_tx_head(ldc_chan_t *ldcp, uint64_t *head) { - ldc_msg_t *pkt; + ldc_msg_t *pkt; ASSERT(MUTEX_HELD(&ldcp->tx_lock)); @@ -876,8 +860,8 @@ i_ldc_get_tx_head(ldc_chan_t *ldcp, uint64_t *head) static int i_ldc_get_tx_tail(ldc_chan_t *ldcp, uint64_t *tail) { - int rv; - uint64_t current_head, new_tail; + int rv; + uint64_t current_head, new_tail; ASSERT(MUTEX_HELD(&ldcp->tx_lock)); /* Read the head and tail ptrs from HV */ @@ -924,7 +908,7 @@ static int i_ldc_set_tx_tail(ldc_chan_t *ldcp, uint64_t tail) { int rv, retval = EWOULDBLOCK; - int retries; + int retries; ASSERT(MUTEX_HELD(&ldcp->tx_lock)); for (retries = 0; retries < ldc_max_retries; retries++) { @@ -1131,7 +1115,7 @@ i_ldc_send_pkt(ldc_chan_t *ldcp, uint8_t pkttype, uint8_t subtype, uint8_t ctrlmsg) { int rv; - ldc_msg_t *pkt; + ldc_msg_t *pkt; uint64_t tx_tail; uint32_t curr_seqid; @@ -1236,8 +1220,8 @@ i_ldc_check_seqid(ldc_chan_t *ldcp, ldc_msg_t *msg) static int i_ldc_process_VER(ldc_chan_t *ldcp, ldc_msg_t *msg) { - int rv = 0, idx = ldcp->next_vidx; - ldc_msg_t *pkt; + int rv = 0, idx = ldcp->next_vidx; + ldc_msg_t *pkt; uint64_t tx_tail; ldc_ver_t *rcvd_ver; @@ -1533,8 +1517,8 @@ i_ldc_process_VER(ldc_chan_t *ldcp, ldc_msg_t *msg) static int i_ldc_process_RTS(ldc_chan_t *ldcp, ldc_msg_t *msg) { - int rv = 0; - ldc_msg_t *pkt; + int rv = 0; + ldc_msg_t *pkt; uint64_t tx_tail; boolean_t sent_NACK = B_FALSE; @@ -1660,7 +1644,7 @@ i_ldc_process_RTS(ldc_chan_t *ldcp, ldc_msg_t *msg) static int i_ldc_process_RTR(ldc_chan_t *ldcp, ldc_msg_t *msg) { - int rv = 0; + int rv = 0; boolean_t sent_NACK = B_FALSE; D2(ldcp->id, "i_ldc_process_RTR: (0x%llx) received RTR\n", ldcp->id); @@ -1824,7 +1808,7 @@ static int i_ldc_process_data_ACK(ldc_chan_t *ldcp, ldc_msg_t *msg) { int rv; - uint64_t tx_head; + uint64_t tx_head; ldc_msg_t *pkt; /* Obtain Tx lock */ @@ -1892,7 +1876,7 @@ i_ldc_process_data_ACK(ldc_chan_t *ldcp, ldc_msg_t *msg) static int i_ldc_ctrlmsg(ldc_chan_t *ldcp, ldc_msg_t *msg) { - int rv = 0; + int rv = 0; D1(ldcp->id, "i_ldc_ctrlmsg: (%llx) tstate = %lx, hstate = %lx\n", ldcp->id, ldcp->tstate, ldcp->hstate); @@ -2102,9 +2086,9 @@ i_ldc_tx_hdlr(caddr_t arg1, caddr_t arg2) { _NOTE(ARGUNUSED(arg2)) - int rv; - ldc_chan_t *ldcp; - boolean_t notify_client = B_FALSE; + int rv; + ldc_chan_t *ldcp; + boolean_t notify_client = B_FALSE; uint64_t notify_event = 0, link_state; /* Get the channel for which interrupt was received */ @@ -2227,8 +2211,8 @@ i_ldc_rx_process_hvq(ldc_chan_t *ldcp, boolean_t *notify_client, uint64_t *notify_event) { int rv; - uint64_t rx_head, rx_tail; - ldc_msg_t *msg; + uint64_t rx_head, rx_tail; + ldc_msg_t *msg; uint64_t link_state, first_fragment = 0; boolean_t trace_length = B_TRUE; @@ -2580,7 +2564,7 @@ i_ldc_rx_ackpeek(ldc_chan_t *ldcp, uint64_t rx_head, uint64_t rx_tail) int ldc_init(uint64_t id, ldc_attr_t *attr, ldc_handle_t *handle) { - ldc_chan_t *ldcp; + ldc_chan_t *ldcp; int rv, exit_val; uint64_t ra_base, nentries; uint64_t qlen; @@ -2728,7 +2712,7 @@ ldc_init(uint64_t id, ldc_attr_t *attr, ldc_handle_t *handle) /* Create a transmit queue */ ldcp->tx_q_va = (uint64_t) contig_mem_alloc(ldcp->tx_q_entries << LDC_PACKET_SHIFT); - if (ldcp->tx_q_va == NULL) { + if (ldcp->tx_q_va == 0) { cmn_err(CE_WARN, "ldc_init: (0x%lx) TX queue allocation failed\n", ldcp->id); @@ -2745,7 +2729,7 @@ ldc_init(uint64_t id, ldc_attr_t *attr, ldc_handle_t *handle) /* Create a receive queue */ ldcp->rx_q_va = (uint64_t) contig_mem_alloc(ldcp->rx_q_entries << LDC_PACKET_SHIFT); - if (ldcp->rx_q_va == NULL) { + if (ldcp->rx_q_va == 0) { cmn_err(CE_WARN, "ldc_init: (0x%lx) RX queue allocation failed\n", ldcp->id); @@ -2775,7 +2759,7 @@ ldc_init(uint64_t id, ldc_attr_t *attr, ldc_handle_t *handle) ldcp->rx_dq_va = (uint64_t) kmem_alloc(ldcp->rx_dq_entries << LDC_PACKET_SHIFT, KM_SLEEP); - if (ldcp->rx_dq_va == NULL) { + if (ldcp->rx_dq_va == 0) { cmn_err(CE_WARN, "ldc_init: (0x%lx) RX data queue " "allocation failed\n", ldcp->id); @@ -2831,8 +2815,7 @@ cleanup_on_exit: mutex_destroy(&ldcp->tx_lock); mutex_destroy(&ldcp->lock); - if (ldcp) - kmem_free(ldcp, sizeof (ldc_chan_t)); + kmem_free(ldcp, sizeof (ldc_chan_t)); return (exit_val); } @@ -2846,11 +2829,11 @@ cleanup_on_exit: int ldc_fini(ldc_handle_t handle) { - ldc_chan_t *ldcp; - ldc_chan_t *tmp_ldcp; - uint64_t id; + ldc_chan_t *ldcp; + ldc_chan_t *tmp_ldcp; + uint64_t id; - if (handle == NULL) { + if (handle == 0) { DWARN(DBG_ALL_LDCS, "ldc_fini: invalid channel handle\n"); return (EINVAL); } @@ -2895,7 +2878,7 @@ ldc_fini(ldc_handle_t handle) /* Free the map table for this channel */ if (ldcp->mtbl) { - (void) hv_ldc_set_map_table(ldcp->id, NULL, NULL); + (void) hv_ldc_set_map_table(ldcp->id, 0, 0); if (ldcp->mtbl->contigmem) contig_mem_free(ldcp->mtbl->table, ldcp->mtbl->size); else @@ -2951,10 +2934,10 @@ ldc_fini(ldc_handle_t handle) int ldc_open(ldc_handle_t handle) { - ldc_chan_t *ldcp; - int rv; + ldc_chan_t *ldcp; + int rv; - if (handle == NULL) { + if (handle == 0) { DWARN(DBG_ALL_LDCS, "ldc_open: invalid channel handle\n"); return (EINVAL); } @@ -2979,7 +2962,7 @@ ldc_open(ldc_handle_t handle) /* * Unregister/Register the tx queue with the hypervisor */ - rv = hv_ldc_tx_qconf(ldcp->id, NULL, NULL); + rv = hv_ldc_tx_qconf(ldcp->id, 0, 0); if (rv) { cmn_err(CE_WARN, "ldc_open: (0x%lx) channel tx queue unconf failed\n", @@ -3003,7 +2986,7 @@ ldc_open(ldc_handle_t handle) /* * Unregister/Register the rx queue with the hypervisor */ - rv = hv_ldc_rx_qconf(ldcp->id, NULL, NULL); + rv = hv_ldc_rx_qconf(ldcp->id, 0, 0); if (rv) { cmn_err(CE_WARN, "ldc_open: (0x%lx) channel rx queue unconf failed\n", @@ -3032,8 +3015,8 @@ ldc_open(ldc_handle_t handle) cmn_err(CE_WARN, "ldc_open: (0x%lx) channel register failed\n", ldcp->id); ldcp->tstate &= ~TS_QCONF_RDY; - (void) hv_ldc_tx_qconf(ldcp->id, NULL, NULL); - (void) hv_ldc_rx_qconf(ldcp->id, NULL, NULL); + (void) hv_ldc_tx_qconf(ldcp->id, 0, 0); + (void) hv_ldc_rx_qconf(ldcp->id, 0, 0); mutex_exit(&ldcp->lock); return (EIO); } @@ -3050,8 +3033,8 @@ ldc_open(ldc_handle_t handle) ldcp->id); (void) i_ldc_unregister_channel(ldcp); ldcp->tstate &= ~TS_QCONF_RDY; - (void) hv_ldc_tx_qconf(ldcp->id, NULL, NULL); - (void) hv_ldc_rx_qconf(ldcp->id, NULL, NULL); + (void) hv_ldc_tx_qconf(ldcp->id, 0, 0); + (void) hv_ldc_rx_qconf(ldcp->id, 0, 0); mutex_exit(&ldcp->lock); return (EIO); } @@ -3102,11 +3085,11 @@ ldc_open(ldc_handle_t handle) int ldc_close(ldc_handle_t handle) { - ldc_chan_t *ldcp; + ldc_chan_t *ldcp; int rv = 0, retries = 0; boolean_t chk_done = B_FALSE; - if (handle == NULL) { + if (handle == 0) { DWARN(DBG_ALL_LDCS, "ldc_close: invalid channel handle\n"); return (EINVAL); } @@ -3230,7 +3213,7 @@ ldc_close(ldc_handle_t handle) /* * Unregister queues */ - rv = hv_ldc_tx_qconf(ldcp->id, NULL, NULL); + rv = hv_ldc_tx_qconf(ldcp->id, 0, 0); if (rv) { cmn_err(CE_WARN, "ldc_close: (0x%lx) channel TX queue unconf failed\n", @@ -3239,7 +3222,7 @@ ldc_close(ldc_handle_t handle) mutex_exit(&ldcp->lock); return (EIO); } - rv = hv_ldc_rx_qconf(ldcp->id, NULL, NULL); + rv = hv_ldc_rx_qconf(ldcp->id, 0, 0); if (rv) { cmn_err(CE_WARN, "ldc_close: (0x%lx) channel RX queue unconf failed\n", @@ -3280,7 +3263,7 @@ ldc_reg_callback(ldc_handle_t handle, { ldc_chan_t *ldcp; - if (handle == NULL) { + if (handle == 0) { DWARN(DBG_ALL_LDCS, "ldc_reg_callback: invalid channel handle\n"); return (EINVAL); @@ -3327,7 +3310,7 @@ ldc_unreg_callback(ldc_handle_t handle) { ldc_chan_t *ldcp; - if (handle == NULL) { + if (handle == 0) { DWARN(DBG_ALL_LDCS, "ldc_unreg_callback: invalid channel handle\n"); return (EINVAL); @@ -3373,12 +3356,12 @@ ldc_unreg_callback(ldc_handle_t handle) int ldc_up(ldc_handle_t handle) { - int rv; - ldc_chan_t *ldcp; - ldc_msg_t *ldcmsg; - uint64_t tx_tail, tstate, link_state; + int rv; + ldc_chan_t *ldcp; + ldc_msg_t *ldcmsg; + uint64_t tx_tail, tstate, link_state; - if (handle == NULL) { + if (handle == 0) { DWARN(DBG_ALL_LDCS, "ldc_up: invalid channel handle\n"); return (EINVAL); } @@ -3515,9 +3498,9 @@ ldc_up(ldc_handle_t handle) int ldc_down(ldc_handle_t handle) { - ldc_chan_t *ldcp; + ldc_chan_t *ldcp; - if (handle == NULL) { + if (handle == 0) { DWARN(DBG_ALL_LDCS, "ldc_down: invalid channel handle\n"); return (EINVAL); } @@ -3539,7 +3522,7 @@ ldc_status(ldc_handle_t handle, ldc_status_t *status) { ldc_chan_t *ldcp; - if (handle == NULL || status == NULL) { + if (handle == 0 || status == NULL) { DWARN(DBG_ALL_LDCS, "ldc_status: invalid argument\n"); return (EINVAL); } @@ -3559,9 +3542,9 @@ ldc_status(ldc_handle_t handle, ldc_status_t *status) int ldc_set_cb_mode(ldc_handle_t handle, ldc_cb_mode_t cmode) { - ldc_chan_t *ldcp; + ldc_chan_t *ldcp; - if (handle == NULL) { + if (handle == 0) { DWARN(DBG_ALL_LDCS, "ldc_set_intr_mode: invalid channel handle\n"); return (EINVAL); @@ -3613,11 +3596,11 @@ ldc_set_cb_mode(ldc_handle_t handle, ldc_cb_mode_t cmode) int ldc_chkq(ldc_handle_t handle, boolean_t *hasdata) { - int rv; - uint64_t rx_head, rx_tail; - ldc_chan_t *ldcp; + int rv; + uint64_t rx_head, rx_tail; + ldc_chan_t *ldcp; - if (handle == NULL) { + if (handle == 0) { DWARN(DBG_ALL_LDCS, "ldc_chkq: invalid channel handle\n"); return (EINVAL); } @@ -3720,11 +3703,11 @@ ldc_chkq(ldc_handle_t handle, boolean_t *hasdata) int ldc_read(ldc_handle_t handle, caddr_t bufp, size_t *sizep) { - ldc_chan_t *ldcp; - uint64_t rx_head = 0, rx_tail = 0; + ldc_chan_t *ldcp; + uint64_t rx_head = 0, rx_tail = 0; int rv = 0, exit_val; - if (handle == NULL) { + if (handle == 0) { DWARN(DBG_ALL_LDCS, "ldc_read: invalid channel handle\n"); return (EINVAL); } @@ -3809,11 +3792,11 @@ ldc_read(ldc_handle_t handle, caddr_t bufp, size_t *sizep) static int i_ldc_read_raw(ldc_chan_t *ldcp, caddr_t target_bufp, size_t *sizep) { - uint64_t q_size_mask; - ldc_msg_t *msgp; + uint64_t q_size_mask; + ldc_msg_t *msgp; uint8_t *msgbufp; int rv = 0, space; - uint64_t rx_head, rx_tail; + uint64_t rx_head, rx_tail; space = *sizep; @@ -3885,13 +3868,13 @@ static int i_ldc_read_packet(ldc_chan_t *ldcp, caddr_t target_bufp, size_t *sizep) { int rv = 0; - uint64_t rx_head = 0, rx_tail = 0; - uint64_t curr_head = 0; - ldc_msg_t *msg; - caddr_t target; - size_t len = 0, bytes_read = 0; - int retries = 0; - uint64_t q_va, q_size_mask; + uint64_t rx_head = 0, rx_tail = 0; + uint64_t curr_head = 0; + ldc_msg_t *msg; + caddr_t target; + size_t len = 0, bytes_read = 0; + int retries = 0; + uint64_t q_va, q_size_mask; uint64_t first_fragment = 0; target = target_bufp; @@ -4286,7 +4269,7 @@ ldc_write(ldc_handle_t handle, caddr_t buf, size_t *sizep) ldc_chan_t *ldcp; int rv = 0; - if (handle == NULL) { + if (handle == 0) { DWARN(DBG_ALL_LDCS, "ldc_write: invalid channel handle\n"); return (EINVAL); } @@ -4332,8 +4315,8 @@ ldc_write(ldc_handle_t handle, caddr_t buf, size_t *sizep) static int i_ldc_write_raw(ldc_chan_t *ldcp, caddr_t buf, size_t *sizep) { - ldc_msg_t *ldcmsg; - uint64_t tx_head, tx_tail, new_tail; + ldc_msg_t *ldcmsg; + uint64_t tx_head, tx_tail, new_tail; int rv = 0; size_t size; @@ -4463,11 +4446,11 @@ i_ldc_write_raw(ldc_chan_t *ldcp, caddr_t buf, size_t *sizep) static int i_ldc_write_packet(ldc_chan_t *ldcp, caddr_t buf, size_t *size) { - ldc_msg_t *ldcmsg; - uint64_t tx_head, tx_tail, new_tail, start; + ldc_msg_t *ldcmsg; + uint64_t tx_head, tx_tail, new_tail, start; uint64_t txq_size_mask, numavail; - uint8_t *msgbuf, *source = (uint8_t *)buf; - size_t len, bytes_written = 0, remaining; + uint8_t *msgbuf, *source = (uint8_t *)buf; + size_t len, bytes_written = 0, remaining; int rv; uint32_t curr_seqid; @@ -4735,7 +4718,7 @@ ldc_info(ldc_handle_t handle, ldc_info_t *info) ldc_chan_t *ldcp; uint64_t avail; - if (handle == NULL || info == NULL) { + if (handle == 0 || info == NULL) { DWARN(DBG_ALL_LDCS, "ldc_get_info: invalid args\n"); return (EINVAL); } diff --git a/usr/src/uts/sun4v/io/ldc_shm.c b/usr/src/uts/sun4v/io/ldc_shm.c index f35bcdb7f0..f8edd4f845 100644 --- a/usr/src/uts/sun4v/io/ldc_shm.c +++ b/usr/src/uts/sun4v/io/ldc_shm.c @@ -191,10 +191,10 @@ i_ldc_init_mapin(ldc_soft_state_t *ldcssp, uint64_t major, uint64_t minor) int ldc_mem_alloc_handle(ldc_handle_t handle, ldc_mem_handle_t *mhandle) { - ldc_chan_t *ldcp; + ldc_chan_t *ldcp; ldc_mhdl_t *mhdl; - if (handle == NULL) { + if (handle == 0) { DWARN(DBG_ALL_LDCS, "ldc_mem_alloc_handle: invalid channel handle\n"); return (EINVAL); @@ -250,10 +250,10 @@ ldc_mem_alloc_handle(ldc_handle_t handle, ldc_mem_handle_t *mhandle) int ldc_mem_free_handle(ldc_mem_handle_t mhandle) { - ldc_mhdl_t *mhdl, *phdl; - ldc_chan_t *ldcp; + ldc_mhdl_t *mhdl, *phdl; + ldc_chan_t *ldcp; - if (mhandle == NULL) { + if (mhandle == 0) { DWARN(DBG_ALL_LDCS, "ldc_mem_free_handle: invalid memory handle\n"); return (EINVAL); @@ -346,7 +346,7 @@ i_ldc_mem_bind_handle(ldc_mem_handle_t mhandle, caddr_t vaddr, size_t len, uint8_t mtype, uint8_t perm, ldc_mem_cookie_t *cookie, uint32_t *ccount) { ldc_mhdl_t *mhdl; - ldc_chan_t *ldcp; + ldc_chan_t *ldcp; ldc_mtbl_t *mtbl; ldc_memseg_t *memseg; ldc_mte_t tmp_mte; @@ -357,9 +357,9 @@ i_ldc_mem_bind_handle(ldc_mem_handle_t mhandle, caddr_t vaddr, size_t len, uint64_t pg_shift, pg_size, pg_size_code, pg_mask; pgcnt_t npages; caddr_t v_align, addr; - int i, rv; + int i, rv; - if (mhandle == NULL) { + if (mhandle == 0) { DWARN(DBG_ALL_LDCS, "ldc_mem_bind_handle: invalid memory handle\n"); return (EINVAL); @@ -400,7 +400,7 @@ i_ldc_mem_bind_handle(ldc_mem_handle_t mhandle, caddr_t vaddr, size_t len, mtbl = kmem_zalloc(sizeof (ldc_mtbl_t), KM_SLEEP); mtbl->num_entries = mtbl->num_avail = ldc_maptable_entries; mtbl->size = ldc_maptable_entries * sizeof (ldc_mte_slot_t); - mtbl->next_entry = NULL; + mtbl->next_entry = 0; mtbl->contigmem = B_TRUE; /* Allocate the table itself */ @@ -671,10 +671,10 @@ int ldc_mem_nextcookie(ldc_mem_handle_t mhandle, ldc_mem_cookie_t *cookie) { ldc_mhdl_t *mhdl; - ldc_chan_t *ldcp; + ldc_chan_t *ldcp; ldc_memseg_t *memseg; - if (mhandle == NULL) { + if (mhandle == 0) { DWARN(DBG_ALL_LDCS, "ldc_mem_nextcookie: invalid memory handle\n"); return (EINVAL); @@ -727,14 +727,14 @@ int ldc_mem_unbind_handle(ldc_mem_handle_t mhandle) { ldc_mhdl_t *mhdl; - ldc_chan_t *ldcp; + ldc_chan_t *ldcp; ldc_mtbl_t *mtbl; ldc_memseg_t *memseg; uint64_t cookie_addr; uint64_t pg_shift, pg_size_code; int i, rv, retries; - if (mhandle == NULL) { + if (mhandle == 0) { DWARN(DBG_ALL_LDCS, "ldc_mem_unbind_handle: invalid memory handle\n"); return (EINVAL); @@ -827,7 +827,7 @@ ldc_mem_info(ldc_mem_handle_t mhandle, ldc_mem_info_t *minfo) { ldc_mhdl_t *mhdl; - if (mhandle == NULL) { + if (mhandle == 0) { DWARN(DBG_ALL_LDCS, "ldc_mem_info: invalid memory handle\n"); return (EINVAL); } @@ -862,20 +862,20 @@ int ldc_mem_copy(ldc_handle_t handle, caddr_t vaddr, uint64_t off, size_t *size, ldc_mem_cookie_t *cookies, uint32_t ccount, uint8_t direction) { - ldc_chan_t *ldcp; + ldc_chan_t *ldcp; uint64_t local_voff, local_valign; uint64_t cookie_addr, cookie_size; uint64_t pg_shift, pg_size, pg_size_code; - uint64_t export_caddr, export_poff, export_psize, export_size; + uint64_t export_caddr, export_poff, export_psize, export_size; uint64_t local_ra, local_poff, local_psize; uint64_t copy_size, copied_len = 0, total_bal = 0, idx = 0; pgcnt_t npages; size_t len = *size; - int i, rv = 0; + int i, rv = 0; uint64_t chid; - if (handle == NULL) { + if (handle == 0) { DWARN(DBG_ALL_LDCS, "ldc_mem_copy: invalid channel handle\n"); return (EINVAL); } @@ -984,7 +984,7 @@ ldc_mem_copy(ldc_handle_t handle, caddr_t vaddr, uint64_t off, size_t *size, copy_size, &copied_len); if (rv != 0) { - int error = EIO; + int error = EIO; uint64_t rx_hd, rx_tl; DWARN(chid, @@ -1088,17 +1088,17 @@ int ldc_mem_rdwr_cookie(ldc_handle_t handle, caddr_t vaddr, size_t *size, caddr_t paddr, uint8_t direction) { - ldc_chan_t *ldcp; + ldc_chan_t *ldcp; uint64_t local_voff, local_valign; uint64_t pg_shift, pg_size, pg_size_code; - uint64_t target_pa, target_poff, target_psize, target_size; + uint64_t target_pa, target_poff, target_psize, target_size; uint64_t local_ra, local_poff, local_psize; uint64_t copy_size, copied_len = 0; pgcnt_t npages; size_t len = *size; - int rv = 0; + int rv = 0; - if (handle == NULL) { + if (handle == 0) { DWARN(DBG_ALL_LDCS, "ldc_mem_rdwr_cookie: invalid channel handle\n"); return (EINVAL); @@ -1259,7 +1259,7 @@ i_ldc_mem_map(ldc_mem_handle_t mhandle, ldc_mem_cookie_t *cookie, { int i, j, idx, rv, retries; - ldc_chan_t *ldcp; + ldc_chan_t *ldcp; ldc_mhdl_t *mhdl; ldc_memseg_t *memseg; caddr_t tmpaddr; @@ -1269,7 +1269,7 @@ i_ldc_mem_map(ldc_mem_handle_t mhandle, ldc_mem_cookie_t *cookie, uint64_t cookie_addr, cookie_off, cookie_size; tte_t ldc_tte; - if (mhandle == NULL) { + if (mhandle == 0) { DWARN(DBG_ALL_LDCS, "ldc_mem_map: invalid memory handle\n"); return (EINVAL); } @@ -1519,7 +1519,7 @@ ldc_mem_unmap(ldc_mem_handle_t mhandle) { int i, rv; ldc_mhdl_t *mhdl = (ldc_mhdl_t *)mhandle; - ldc_chan_t *ldcp; + ldc_chan_t *ldcp; ldc_memseg_t *memseg; if (mhdl == 0 || mhdl->status != LDC_MAPPED) { @@ -1586,14 +1586,14 @@ static int i_ldc_mem_acquire_release(ldc_mem_handle_t mhandle, uint8_t direction, uint64_t offset, size_t size) { - int err; + int err; ldc_mhdl_t *mhdl; ldc_chan_t *ldcp; ldc_memseg_t *memseg; caddr_t local_vaddr; size_t copy_size; - if (mhandle == NULL) { + if (mhandle == 0) { DWARN(DBG_ALL_LDCS, "i_ldc_mem_acquire_release: invalid memory handle\n"); return (EINVAL); @@ -1691,7 +1691,7 @@ ldc_mem_dring_create(uint32_t len, uint32_t dsize, ldc_dring_handle_t *dhandle) D1(DBG_ALL_LDCS, "ldc_mem_dring_create: len=0x%x, size=0x%x\n", len, dsize); - if (dhandle == NULL) { + if (dhandle == 0) { DWARN(DBG_ALL_LDCS, "ldc_mem_dring_create: invalid dhandle\n"); return (EINVAL); } @@ -1754,7 +1754,7 @@ ldc_mem_dring_destroy(ldc_dring_handle_t dhandle) D1(DBG_ALL_LDCS, "ldc_mem_dring_destroy: entered\n"); - if (dhandle == NULL) { + if (dhandle == 0) { DWARN(DBG_ALL_LDCS, "ldc_mem_dring_destroy: invalid desc ring handle\n"); return (EINVAL); @@ -1822,19 +1822,19 @@ ldc_mem_dring_bind(ldc_handle_t handle, ldc_dring_handle_t dhandle, uint8_t mtype, uint8_t perm, ldc_mem_cookie_t *cookie, uint32_t *ccount) { int err; - ldc_chan_t *ldcp; + ldc_chan_t *ldcp; ldc_dring_t *dringp; ldc_mem_handle_t mhandle; /* check to see if channel is initalized */ - if (handle == NULL) { + if (handle == 0) { DWARN(DBG_ALL_LDCS, "ldc_mem_dring_bind: invalid channel handle\n"); return (EINVAL); } ldcp = (ldc_chan_t *)handle; - if (dhandle == NULL) { + if (dhandle == 0) { DWARN(DBG_ALL_LDCS, "ldc_mem_dring_bind: invalid desc ring handle\n"); return (EINVAL); @@ -1885,7 +1885,7 @@ ldc_mem_dring_bind(ldc_handle_t handle, ldc_dring_handle_t dhandle, /* create an memory handle */ err = ldc_mem_alloc_handle(handle, &mhandle); - if (err || mhandle == NULL) { + if (err || mhandle == 0) { DWARN(DBG_ALL_LDCS, "ldc_mem_dring_bind: (0x%llx) error allocating mhandle\n", ldcp->id); @@ -1914,7 +1914,7 @@ ldc_mem_dring_bind(ldc_handle_t handle, ldc_dring_handle_t dhandle, (void) ldc_mem_free_handle(mhandle); dringp->ldcp = NULL; - dringp->mhdl = NULL; + dringp->mhdl = 0; *ccount = 0; mutex_exit(&dringp->lock); @@ -1941,10 +1941,10 @@ int ldc_mem_dring_nextcookie(ldc_dring_handle_t dhandle, ldc_mem_cookie_t *cookie) { int rv = 0; - ldc_dring_t *dringp; + ldc_dring_t *dringp; ldc_chan_t *ldcp; - if (dhandle == NULL) { + if (dhandle == 0) { DWARN(DBG_ALL_LDCS, "ldc_mem_dring_nextcookie: invalid desc ring handle\n"); return (EINVAL); @@ -1982,11 +1982,11 @@ ldc_mem_dring_nextcookie(ldc_dring_handle_t dhandle, ldc_mem_cookie_t *cookie) int ldc_mem_dring_unbind(ldc_dring_handle_t dhandle) { - ldc_dring_t *dringp; + ldc_dring_t *dringp; ldc_dring_t *tmp_dringp; ldc_chan_t *ldcp; - if (dhandle == NULL) { + if (dhandle == 0) { DWARN(DBG_ALL_LDCS, "ldc_mem_dring_unbind: invalid desc ring handle\n"); return (EINVAL); @@ -2035,7 +2035,7 @@ ldc_mem_dring_unbind(ldc_dring_handle_t dhandle) (void) ldc_mem_free_handle((ldc_mem_handle_t)dringp->mhdl); dringp->ldcp = NULL; - dringp->mhdl = NULL; + dringp->mhdl = 0; dringp->status = LDC_UNBOUND; mutex_exit(&dringp->lock); @@ -2124,7 +2124,7 @@ ldc_mem_dring_info(ldc_dring_handle_t dhandle, ldc_mem_info_t *minfo) ldc_dring_t *dringp; int rv; - if (dhandle == NULL) { + if (dhandle == 0) { DWARN(DBG_ALL_LDCS, "ldc_mem_dring_info: invalid desc ring handle\n"); return (EINVAL); @@ -2143,7 +2143,7 @@ ldc_mem_dring_info(ldc_dring_handle_t dhandle, ldc_mem_info_t *minfo) } } else { minfo->vaddr = dringp->base; - minfo->raddr = NULL; + minfo->raddr = 0; minfo->status = dringp->status; } @@ -2164,19 +2164,19 @@ ldc_mem_dring_map(ldc_handle_t handle, ldc_mem_cookie_t *cookie, ldc_dring_handle_t *dhandle) { int err; - ldc_chan_t *ldcp = (ldc_chan_t *)handle; + ldc_chan_t *ldcp = (ldc_chan_t *)handle; ldc_mem_handle_t mhandle; ldc_dring_t *dringp; size_t dring_size; - if (dhandle == NULL) { + if (dhandle == 0) { DWARN(DBG_ALL_LDCS, "ldc_mem_dring_map: invalid dhandle\n"); return (EINVAL); } /* check to see if channel is initalized */ - if (handle == NULL) { + if (handle == 0) { DWARN(DBG_ALL_LDCS, "ldc_mem_dring_map: invalid channel handle\n"); return (EINVAL); @@ -2234,7 +2234,7 @@ ldc_mem_dring_map(ldc_handle_t handle, ldc_mem_cookie_t *cookie, /* create an memory handle */ err = ldc_mem_alloc_handle(handle, &mhandle); - if (err || mhandle == NULL) { + if (err || mhandle == 0) { DWARN(DBG_ALL_LDCS, "ldc_mem_dring_map: cannot alloc hdl err=%d\n", err); @@ -2278,11 +2278,11 @@ ldc_mem_dring_map(ldc_handle_t handle, ldc_mem_cookie_t *cookie, int ldc_mem_dring_unmap(ldc_dring_handle_t dhandle) { - ldc_dring_t *dringp; + ldc_dring_t *dringp; ldc_dring_t *tmp_dringp; ldc_chan_t *ldcp; - if (dhandle == NULL) { + if (dhandle == 0) { DWARN(DBG_ALL_LDCS, "ldc_mem_dring_unmap: invalid desc ring handle\n"); return (EINVAL); @@ -2356,14 +2356,14 @@ static int i_ldc_dring_acquire_release(ldc_dring_handle_t dhandle, uint8_t direction, uint64_t start, uint64_t end) { - int err; + int err; ldc_dring_t *dringp; ldc_chan_t *ldcp; ldc_mhdl_t *mhdl; uint64_t soff; size_t copy_size; - if (dhandle == NULL) { + if (dhandle == 0) { DWARN(DBG_ALL_LDCS, "i_ldc_dring_acquire_release: invalid desc ring handle\n"); return (EINVAL); diff --git a/usr/src/uts/sun4v/io/mdeg.c b/usr/src/uts/sun4v/io/mdeg.c index 18441c2e3c..687ace384b 100644 --- a/usr/src/uts/sun4v/io/mdeg.c +++ b/usr/src/uts/sun4v/io/mdeg.c @@ -67,7 +67,7 @@ typedef struct mdeg_clnt { * held when modifying any client information. */ static struct mdeg { - taskq_t *taskq; /* for internal processing */ + taskq_t *taskq; /* for internal processing */ boolean_t enabled; /* enable/disable taskq processing */ kmutex_t lock; /* synchronize MD updates */ md_t *md_prev; /* previous MD */ @@ -94,8 +94,8 @@ static void mdeg_dump_table(void); #else /* DEBUG */ #define MDEG_DBG _NOTE(CONSTCOND) if (0) printf -#define MDEG_DUMP_CLNT -#define MDEG_DUMP_TABLE() +#define MDEG_DUMP_CLNT(...) +#define MDEG_DUMP_TABLE(...) #endif /* DEBUG */ @@ -334,7 +334,7 @@ mdeg_notify_client_reg(mdeg_clnt_t *clnt) */ if (clnt->pspec == NULL) { /* call the client callback */ - (*clnt->cb)(clnt->cb_arg, NULL); + (void) (*clnt->cb)(clnt->cb_arg, NULL); goto done; } @@ -387,7 +387,7 @@ mdeg_notify_client_reg(mdeg_clnt_t *clnt) mdeg_res->added.nelem = nnodes; /* call the client callback */ - (*clnt->cb)(clnt->cb_arg, mdeg_res); + (void) (*clnt->cb)(clnt->cb_arg, mdeg_res); done: mutex_exit(&mdeg.lock); @@ -602,7 +602,7 @@ mdeg_notify_client(void *arg) */ if (clnt->pspec == NULL) { /* call the client callback */ - (*clnt->cb)(clnt->cb_arg, NULL); + (void) (*clnt->cb)(clnt->cb_arg, NULL); MDEG_DBG("MDEG client callback done\n"); goto cleanup; @@ -634,7 +634,7 @@ mdeg_notify_client(void *arg) mdeg_get_diff_results(mdd, &mdeg_res); /* call the client callback */ - (*clnt->cb)(clnt->cb_arg, &mdeg_res); + (void) (*clnt->cb)(clnt->cb_arg, &mdeg_res); MDEG_DBG("MDEG client callback done\n"); @@ -658,13 +658,13 @@ mdeg_find_start_node(md_t *md, mdeg_node_spec_t *nspec) nname = md_find_name(md, nspec->namep); aname = md_find_name(md, "fwd"); - nnodes = md_scan_dag(md, NULL, nname, aname, NULL); + nnodes = md_scan_dag(md, 0, nname, aname, NULL); if (nnodes == 0) return (MDE_INVAL_ELEM_COOKIE); nodesp = kmem_alloc(sizeof (mde_cookie_t) * nnodes, KM_SLEEP); - (void) md_scan_dag(md, NULL, nname, aname, nodesp); + (void) md_scan_dag(md, 0, nname, aname, nodesp); for (idx = 0; idx < nnodes; idx++) { diff --git a/usr/src/uts/sun4v/io/n2piupc/n2piupc.h b/usr/src/uts/sun4v/io/n2piupc/n2piupc.h index b9c224618f..689d0c5ef5 100644 --- a/usr/src/uts/sun4v/io/n2piupc/n2piupc.h +++ b/usr/src/uts/sun4v/io/n2piupc/n2piupc.h @@ -31,8 +31,6 @@ * Definitions which deal with things other than registers. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #ifdef __cplusplus extern "C" { #endif @@ -65,8 +63,8 @@ extern int n2piupc_debug; #define N2PIUPC_DBG1 if (n2piupc_debug >= 1) printf #define N2PIUPC_DBG2 if (n2piupc_debug >= 2) printf #else -#define N2PIUPC_DBG1 0 && -#define N2PIUPC_DBG2 0 && +#define N2PIUPC_DBG1(...) +#define N2PIUPC_DBG2(...) #endif /* DEBUG */ diff --git a/usr/src/uts/sun4v/io/n2piupc/n2piupc_kstats.c b/usr/src/uts/sun4v/io/n2piupc/n2piupc_kstats.c index 0b22142ea2..6881d58a20 100644 --- a/usr/src/uts/sun4v/io/n2piupc/n2piupc_kstats.c +++ b/usr/src/uts/sun4v/io/n2piupc/n2piupc_kstats.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/types.h> #include <sys/kstat.h> #include "n2piupc_acc.h" @@ -68,7 +66,7 @@ n2piupc_kstat_init() /* Create basic pic event-type pair. */ grp_p->name_kstats_pp = kmem_zalloc((grp_p->num_counters * - sizeof (kstat_t)), KM_SLEEP); + sizeof (kstat_t)), KM_SLEEP); if (n2piupc_create_name_kstat(grp_p) != DDI_SUCCESS) { n2piupc_kstat_fini(); N2PIUPC_DBG1("n2piupc: init: failure exit\n"); @@ -183,7 +181,7 @@ n2piupc_create_picN_kstat(char *mod_name, int pic, uint64_t ev_offset, (void) snprintf(pic_name, PIC_STR_LEN, "pic%1d", pic); if ((picN_ksp = kstat_create(mod_name, 0, pic_name, - "bus", KSTAT_TYPE_NAMED, num_ev, NULL)) == NULL) { + "bus", KSTAT_TYPE_NAMED, num_ev, 0)) == NULL) { cmn_err(CE_WARN, "%s %s : kstat create failed", mod_name, pic_name); return (NULL); diff --git a/usr/src/uts/sun4v/io/n2rng/n2rng.c b/usr/src/uts/sun4v/io/n2rng/n2rng.c index 2b8827fd49..144d60b880 100644 --- a/usr/src/uts/sun4v/io/n2rng/n2rng.c +++ b/usr/src/uts/sun4v/io/n2rng/n2rng.c @@ -944,7 +944,7 @@ n2rng_check_ctl_access(n2rng_t *n2rng) * Attempt to read control registers with invalid ID and data * just to see if we get an access error */ - rv = hv_rng_ctl_read_v2(NULL, N2RNG_INVALID_ID, + rv = hv_rng_ctl_read_v2(0, N2RNG_INVALID_ID, &unused_64, &unused_64, &unused_64, &unused_64); } else { rv = hv_rng_get_diag_control(); diff --git a/usr/src/uts/sun4v/io/n2rng/n2rng_kcf.c b/usr/src/uts/sun4v/io/n2rng/n2rng_kcf.c index 5e101472ee..afe6cd47fe 100644 --- a/usr/src/uts/sun4v/io/n2rng/n2rng_kcf.c +++ b/usr/src/uts/sun4v/io/n2rng/n2rng_kcf.c @@ -23,8 +23,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/types.h> #include <sys/uio.h> #include <sys/stream.h> @@ -72,7 +70,7 @@ static crypto_random_number_ops_t n2rng_rng_ops = { static crypto_provider_management_ops_t n2rng_extinfo_op = { ext_info, /* ext_info */ NULL, /* init_token */ - NULL, /* init_pin */ + NULL, /* init_pin */ NULL, /* set_pin */ }; @@ -207,7 +205,7 @@ n2rng_register_provider(n2rng_t *n2rng) } else { cmn_err(CE_WARN, "crypto_register_provider() failed (%d)", ret); - n2rng->n_prov = NULL; + n2rng->n_prov = 0; return (DDI_FAILURE); } } @@ -236,7 +234,7 @@ n2rng_unregister_provider(n2rng_t *n2rng) return (DDI_FAILURE); } } - n2rng->n_prov = NULL; + n2rng->n_prov = 0; n2rng_clrregistered(n2rng); return (DDI_SUCCESS); } @@ -408,8 +406,8 @@ n2rng_provider_status(crypto_provider_handle_t provider, uint_t *status) /*ARGSUSED*/ static int n2rng_random_number(crypto_provider_handle_t provider, - crypto_session_id_t sess, unsigned char *buf, size_t buflen, - crypto_req_handle_t cfreq) + crypto_session_id_t sess, unsigned char *buf, size_t buflen, + crypto_req_handle_t cfreq) { n2rng_t *n2rng = (n2rng_t *)provider; int rv; diff --git a/usr/src/uts/sun4v/io/niumx/niumx.c b/usr/src/uts/sun4v/io/niumx/niumx.c index b455d287e6..76b30a3804 100644 --- a/usr/src/uts/sun4v/io/niumx/niumx.c +++ b/usr/src/uts/sun4v/io/niumx/niumx.c @@ -97,19 +97,19 @@ static struct bus_ops niumx_bus_ops = { 0, niumx_ctlops, ddi_bus_prop_op, - 0, /* (*bus_get_eventcookie)(); */ + 0, /* (*bus_get_eventcookie)(); */ 0, /* (*bus_add_eventcall)(); */ - 0, /* (*bus_remove_eventcall)(); */ + 0, /* (*bus_remove_eventcall)(); */ 0, /* (*bus_post_event)(); */ 0, /* (*bus_intr_ctl)(); */ - 0, /* (*bus_config)(); */ - 0, /* (*bus_unconfig)(); */ - niumx_fm_init_child, /* (*bus_fm_init)(); */ - 0, /* (*bus_fm_fini)(); */ + 0, /* (*bus_config)(); */ + 0, /* (*bus_unconfig)(); */ + niumx_fm_init_child, /* (*bus_fm_init)(); */ + 0, /* (*bus_fm_fini)(); */ 0, /* (*bus_enter)() */ 0, /* (*bus_exit)() */ 0, /* (*bus_power)() */ - niumx_intr_ops /* (*bus_intr_op)(); */ + niumx_intr_ops /* (*bus_intr_op)(); */ }; extern struct cb_ops niumx_cb_ops; @@ -199,7 +199,7 @@ void niumx_intr_dist(void *arg) { niumx_devstate_t *niumxds_p = (niumx_devstate_t *)arg; - kmutex_t *lock_p = &niumxds_p->niumx_mutex; + kmutex_t *lock_p = &niumxds_p->niumx_mutex; int i; niumx_ih_t *ih_p = niumxds_p->niumx_ihtable; @@ -367,13 +367,13 @@ niumx_fm_init_child(dev_info_t *dip, dev_info_t *cdip, int cap, /*ARGSUSED*/ int niumx_map(dev_info_t *dip, dev_info_t *rdip, ddi_map_req_t *mp, - off_t offset, off_t len, caddr_t *vaddrp) + off_t offset, off_t len, caddr_t *vaddrp) { struct regspec p_regspec; ddi_map_req_t p_mapreq; - niu_regspec_t *reg_p; - int i, rn = mp->map_obj.rnumber, reglen, rnglen, rngnum, ret; - niumx_ranges_t *rng_p; + niu_regspec_t *reg_p; + int i, rn = mp->map_obj.rnumber, reglen, rnglen, rngnum, ret; + niumx_ranges_t *rng_p; uint32_t reg_begin, rng_begin; @@ -453,7 +453,7 @@ err: */ int niumx_ctlops(dev_info_t *dip, dev_info_t *rdip, - ddi_ctl_enum_t ctlop, void *arg, void *result) + ddi_ctl_enum_t ctlop, void *arg, void *result) { niu_regspec_t *reg_p; int reglen, totreg; @@ -644,7 +644,7 @@ niumx_removechild(dev_info_t *dip) /*ARGSUSED*/ int niumx_dma_allochdl(dev_info_t *dip, dev_info_t *rdip, ddi_dma_attr_t *attrp, - int (*waitfp)(caddr_t), caddr_t arg, ddi_dma_handle_t *handlep) + int (*waitfp)(caddr_t), caddr_t arg, ddi_dma_handle_t *handlep) { ddi_dma_impl_t *mp; int sleep = (waitfp == DDI_DMA_SLEEP) ? KM_SLEEP : KM_NOSLEEP; @@ -671,7 +671,7 @@ niumx_dma_allochdl(dev_info_t *dip, dev_info_t *rdip, ddi_dma_attr_t *attrp, mp->dmai_fault_check = NULL; mp->dmai_fault_notify = NULL; - mp->dmai_attr = *attrp; /* set requestors attr info */ + mp->dmai_attr = *attrp; /* set requestors attr info */ DBG(NIUMX_DBG_DMA_ALLOCH, dip, "mp=%p\n", mp); @@ -714,16 +714,16 @@ niumx_dma_freehdl(dev_info_t *dip, dev_info_t *rdip, ddi_dma_handle_t handle) * dma handle members affected (set on exit): * mp->dmai_object - dmareq->dmar_object * mp->dmai_rflags - dmareq->dmar_flags - * mp->dmai_pfn0 - 1st page pfn (if va/size pair and not shadow) - * mp->dmai_roffset - initialized to starting page offset + * mp->dmai_pfn0 - 1st page pfn (if va/size pair and not shadow) + * mp->dmai_roffset - initialized to starting page offset * mp->dmai_size - # of total pages of entire object * mp->dmai_cookie - new cookie alloc'd */ /*ARGSUSED*/ int niumx_dma_bindhdl(dev_info_t *dip, dev_info_t *rdip, - ddi_dma_handle_t handle, ddi_dma_req_t *dmareq, - ddi_dma_cookie_t *cookiep, uint_t *ccountp) + ddi_dma_handle_t handle, ddi_dma_req_t *dmareq, + ddi_dma_cookie_t *cookiep, uint_t *ccountp) { int (*waitfp)(caddr_t) = dmareq->dmar_fp; ddi_dma_impl_t *mp = (ddi_dma_impl_t *)handle; @@ -921,7 +921,7 @@ niumx_set_intr(dev_info_t *dip, dev_info_t *rdip, int ret = DDI_SUCCESS; uint64_t hvret; niumx_devstate_t *niumxds_p; /* devstate pointer */ - int instance = ddi_get_instance(dip); + int instance = ddi_get_instance(dip); niumxds_p = (niumx_devstate_t *)ddi_get_soft_state(niumx_state, instance); @@ -1142,7 +1142,7 @@ niumx_rem_intr(dev_info_t *dip, dev_info_t *rdip, niumx_ih_t *ih_p; int ret = DDI_SUCCESS, state; hrtime_t start; - niusysino_t sysino; + niusysino_t sysino; niumx_devstate_t *niumxds_p; /* devstate pointer */ int instance = ddi_get_instance(dip); @@ -1175,7 +1175,8 @@ niumx_rem_intr(dev_info_t *dip, dev_info_t *rdip, ih_p->ih_sysino = 0; hdlp->ih_vector = (uint32_t)sysino; - if (hdlp->ih_vector != NULL) i_ddi_rem_ivintr(hdlp); + if (hdlp->ih_vector != 0) + i_ddi_rem_ivintr(hdlp); fail: return (ret); diff --git a/usr/src/uts/sun4v/io/ntwdt.c b/usr/src/uts/sun4v/io/ntwdt.c index 5dcace595a..ac11471533 100644 --- a/usr/src/uts/sun4v/io/ntwdt.c +++ b/usr/src/uts/sun4v/io/ntwdt.c @@ -314,7 +314,7 @@ ntwdt_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) * is initialized. */ if (ddi_create_minor_node(dip, NTWDT_MINOR_NODE, S_IFCHR, 0, - DDI_PSEUDO, NULL) == DDI_FAILURE) { + DDI_PSEUDO, 0) == DDI_FAILURE) { cmn_err(CE_WARN, "failed to create Minor Node: %s", NTWDT_MINOR_NODE); goto err3; @@ -466,7 +466,7 @@ ntwdt_close(dev_t dev, int flag, int otyp, cred_t *credp) /*ARGSUSED*/ static int ntwdt_ioctl(dev_t dev, int cmd, intptr_t arg, int mode, cred_t *credp, - int *rvalp) + int *rvalp) { int instance = getminor(dev); int retval = 0; diff --git a/usr/src/uts/sun4v/io/vdc.c b/usr/src/uts/sun4v/io/vdc.c index ccea7403ea..6f55fcc6e6 100644 --- a/usr/src/uts/sun4v/io/vdc.c +++ b/usr/src/uts/sun4v/io/vdc.c @@ -173,14 +173,14 @@ static int vdc_process_data_msg(vdc_t *vdc, vio_msg_t *msg); static int vdc_handle_ver_msg(vdc_t *vdc, vio_ver_msg_t *ver_msg); static int vdc_handle_attr_msg(vdc_t *vdc, vd_attr_msg_t *attr_msg); static int vdc_handle_dring_reg_msg(vdc_t *vdc, vio_dring_reg_msg_t *msg); -static int vdc_send_request(vdc_t *vdcp, int operation, +static int vdc_send_request(vdc_t *vdcp, int operation, caddr_t addr, size_t nbytes, int slice, diskaddr_t offset, buf_t *bufp, vio_desc_direction_t dir, int flags); static int vdc_map_to_shared_dring(vdc_t *vdcp, int idx); -static int vdc_populate_descriptor(vdc_t *vdcp, int operation, +static int vdc_populate_descriptor(vdc_t *vdcp, int operation, caddr_t addr, size_t nbytes, int slice, diskaddr_t offset, buf_t *bufp, vio_desc_direction_t dir, int flags); -static int vdc_do_sync_op(vdc_t *vdcp, int operation, caddr_t addr, +static int vdc_do_sync_op(vdc_t *vdcp, int operation, caddr_t addr, size_t nbytes, int slice, diskaddr_t offset, vio_desc_direction_t dir, boolean_t); static int vdc_do_op(vdc_t *vdc, int op, caddr_t addr, size_t nbytes, @@ -224,7 +224,7 @@ static int vdc_get_efi_convert(vdc_t *vdc, void *from, void *to, static int vdc_set_efi_convert(vdc_t *vdc, void *from, void *to, int mode, int dir); -static void vdc_ownership_update(vdc_t *vdc, int ownership_flags); +static void vdc_ownership_update(vdc_t *vdc, int ownership_flags); static int vdc_access_set(vdc_t *vdc, uint64_t flags); static vdc_io_t *vdc_eio_queue(vdc_t *vdc, int index); static void vdc_eio_unqueue(vdc_t *vdc, clock_t deadline, @@ -284,7 +284,7 @@ static uint_t vdc_hattr_min = VDC_HATTR_MIN; * various operations */ static int vdc_timeout = 0; /* units: seconds */ -static int vdc_ldcup_timeout = 1; /* units: seconds */ +static int vdc_ldcup_timeout = 1; /* units: seconds */ static uint64_t vdc_hz_min_ldc_delay; static uint64_t vdc_min_timeout_ldc = 1 * MILLISEC; @@ -1074,7 +1074,7 @@ vdc_create_device_nodes_vtoc(vdc_t *vdc) * refers to a whole disk. Slices start at 'a' * * Parameters: - * vdc - soft state pointer + * vdc - soft state pointer * * Return Values * 0 - Success @@ -1192,7 +1192,7 @@ vdc_prop_op(dev_t dev, dev_info_t *dip, ddi_prop_op_t prop_op, int mod_flags, * currently opened. * * Parameters: - * vdc - soft state pointer + * vdc - soft state pointer * * Return Values * B_TRUE - at least one slice is opened. @@ -2576,7 +2576,7 @@ vdc_terminate_ldc(vdc_t *vdc, vdc_server_t *srvr) if (srvr->state & VDC_LDC_INIT) { DMSG(vdc, 0, "[%d] ldc_fini()\n", instance); (void) ldc_fini(srvr->ldc_handle); - srvr->ldc_handle = NULL; + srvr->ldc_handle = 0; } srvr->state &= ~(VDC_LDC_INIT | VDC_LDC_CB | VDC_LDC_OPEN); @@ -2682,7 +2682,7 @@ vdc_init_descriptor_ring(vdc_t *vdc) status = ldc_mem_dring_create(vdc->dring_len, vdc->dring_entry_size, &vdc->dring_hdl); - if ((vdc->dring_hdl == NULL) || (status != 0)) { + if ((vdc->dring_hdl == 0) || (status != 0)) { DMSG(vdc, 0, "[%d] Descriptor ring creation failed", vdc->instance); return (status); @@ -2773,7 +2773,7 @@ static void vdc_destroy_descriptor_ring(vdc_t *vdc) { vdc_local_desc_t *ldep = NULL; /* Local Dring Entry Pointer */ - ldc_mem_handle_t mhdl = NULL; + ldc_mem_handle_t mhdl = 0; ldc_mem_info_t minfo; int status = -1; int i; /* loop */ @@ -2790,7 +2790,7 @@ vdc_destroy_descriptor_ring(vdc_t *vdc) ldep = &vdc->local_dring[i]; mhdl = ldep->desc_mhdl; - if (mhdl == NULL) + if (mhdl == 0) continue; if ((status = ldc_mem_info(mhdl, &minfo)) != 0) { @@ -2803,7 +2803,7 @@ vdc_destroy_descriptor_ring(vdc_t *vdc) * is not valid. Clear it out so that * no one tries to use it. */ - ldep->desc_mhdl = NULL; + ldep->desc_mhdl = 0; continue; } @@ -2813,7 +2813,7 @@ vdc_destroy_descriptor_ring(vdc_t *vdc) (void) ldc_mem_free_handle(mhdl); - ldep->desc_mhdl = NULL; + ldep->desc_mhdl = 0; } vdc->initialized &= ~VDC_DRING_ENTRY; } @@ -2841,7 +2841,7 @@ vdc_destroy_descriptor_ring(vdc_t *vdc) DMSG(vdc, 0, "[%d] Destroying DRing\n", vdc->instance); status = ldc_mem_dring_destroy(vdc->dring_hdl); if (status == 0) { - vdc->dring_hdl = NULL; + vdc->dring_hdl = 0; bzero(&vdc->dring_mem_info, sizeof (ldc_mem_info_t)); vdc->initialized &= ~VDC_DRING_INIT; } else { @@ -3197,7 +3197,7 @@ loop: * vdc_do_op * * Description: - * Wrapper around vdc_submit_request(). Each request is associated with a + * Wrapper around vdc_submit_request(). Each request is associated with a * buf structure. If a buf structure is provided (bufp != NULL) then the * request will be submitted with that buf, and the caller can wait for * completion of the request with biowait(). If a buf structure is not @@ -3321,7 +3321,7 @@ done: * vdc_do_sync_op * * Description: - * Wrapper around vdc_do_op that serializes requests. + * Wrapper around vdc_do_op that serializes requests. * * Arguments: * vdcp - the soft state pointer @@ -3411,9 +3411,9 @@ vdc_do_sync_op(vdc_t *vdcp, int operation, caddr_t addr, size_t nbytes, * vdc_drain_response() * * Description: - * When a guest is panicking, the completion of requests needs to be - * handled differently because interrupts are disabled and vdc - * will not get messages. We have to poll for the messages instead. + * When a guest is panicking, the completion of requests needs to be + * handled differently because interrupts are disabled and vdc + * will not get messages. We have to poll for the messages instead. * * Note: since we are panicking we don't implement the io:::done * DTrace probe or update the I/O statistics kstats. @@ -3431,9 +3431,9 @@ vdc_do_sync_op(vdc_t *vdcp, int operation, caddr_t addr, size_t nbytes, static int vdc_drain_response(vdc_t *vdc, struct buf *buf) { - int rv, idx, retries; + int rv, idx, retries; size_t msglen; - vdc_local_desc_t *ldep = NULL; /* Local Dring Entry Pointer */ + vdc_local_desc_t *ldep = NULL; /* Local Dring Entry Pointer */ vio_dring_msg_t dmsg; struct buf *mbuf; boolean_t ack; @@ -3926,7 +3926,7 @@ vdc_wait_for_response(vdc_t *vdcp, vio_msg_t *msgp) * * Description: * Resubmit each descriptor in the backed up dring to - * vDisk server. The Dring was backed up during connection + * vDisk server. The Dring was backed up during connection * reset. * * Arguments: @@ -4030,7 +4030,7 @@ void vdc_cancel_backup_dring(vdc_t *vdcp) { vdc_local_desc_t *ldep; - struct buf *bufp; + struct buf *bufp; int count; int b_idx; int dring_size; @@ -4118,7 +4118,7 @@ vdc_cancel_backup_dring(vdc_t *vdcp) void vdc_connection_timeout(void *arg) { - vdc_t *vdcp = (vdc_t *)arg; + vdc_t *vdcp = (vdc_t *)arg; mutex_enter(&vdcp->lock); @@ -4213,7 +4213,7 @@ static void vdc_switch_server(vdc_t *vdcp) { int rv; - vdc_server_t *curr_server, *new_server; + vdc_server_t *curr_server, *new_server; ASSERT(MUTEX_HELD(&vdcp->lock)); @@ -4410,9 +4410,9 @@ vdc_handshake_retry(vdc_t *vdcp, int hshake_cnt, int hattr_cnt) * Description: * * Main VDC message processing thread. Each vDisk instance - * consists of a copy of this thread. This thread triggers - * all the handshakes and data exchange with the server. It - * also handles all channel resets + * consists of a copy of this thread. This thread triggers + * all the handshakes and data exchange with the server. It + * also handles all channel resets * * Arguments: * vdc - soft state pointer for this instance of the device driver. @@ -5516,7 +5516,7 @@ typedef struct vdc_dk_arg { /* * Function: - * vdc_dkio_flush_cb() + * vdc_dkio_flush_cb() * * Description: * This routine is a callback for DKIOCFLUSHWRITECACHE which can be called @@ -5572,7 +5572,7 @@ vdc_dkio_flush_cb(void *arg) /* * Function: - * vdc_dkio_gapart() + * vdc_dkio_gapart() * * Description: * This function implements the DKIOCGAPART ioctl. @@ -5638,7 +5638,7 @@ vdc_dkio_gapart(vdc_t *vdc, caddr_t arg, int flag) /* * Function: - * vdc_dkio_partition() + * vdc_dkio_partition() * * Description: * This function implements the DKIOCPARTITION ioctl. @@ -5691,7 +5691,7 @@ vdc_dkio_partition(vdc_t *vdc, caddr_t arg, int flag) /* * Function: - * vdc_dioctl_rwcmd() + * vdc_dioctl_rwcmd() * * Description: * This function implements the DIOCTL_RWCMD ioctl. This ioctl is used @@ -5934,15 +5934,15 @@ vdc_scsi_status(vdc_t *vdc, vd_scsi_t *vd_scsi, boolean_t log_error) static int vdc_uscsi_cmd(vdc_t *vdc, caddr_t arg, int mode) { - struct uscsi_cmd uscsi; + struct uscsi_cmd uscsi; struct uscsi_cmd32 uscsi32; - vd_scsi_t *vd_scsi; - int vd_scsi_len; + vd_scsi_t *vd_scsi; + int vd_scsi_len; union scsi_cdb *cdb; struct scsi_extended_sense *sense; - char *datain, *dataout; + char *datain, *dataout; size_t cdb_len, datain_len, dataout_len, sense_len; - int rv; + int rv; if (ddi_model_convert_from(mode & FMODELS) == DDI_MODEL_ILP32) { if (ddi_copyin(arg, &uscsi32, sizeof (struct uscsi_cmd32), @@ -7200,7 +7200,7 @@ static vdc_dk_ioctl_t dk_ioctl[] = { vdc_get_geom_convert}, {VD_OP_GET_DISKGEOM, DKIOCG_PHYGEOM, sizeof (vd_geom_t), vdc_get_geom_convert}, - {VD_OP_GET_DISKGEOM, DKIOCG_VIRTGEOM, sizeof (vd_geom_t), + {VD_OP_GET_DISKGEOM, DKIOCG_VIRTGEOM, sizeof (vd_geom_t), vdc_get_geom_convert}, {VD_OP_SET_DISKGEOM, DKIOCSGEOM, sizeof (vd_geom_t), vdc_set_geom_convert}, @@ -7222,7 +7222,7 @@ static vdc_dk_ioctl_t dk_ioctl[] = { {0, MHIOCGRP_INKEYS, 0, vdc_null_copy_func}, {0, MHIOCGRP_INRESV, 0, vdc_null_copy_func}, {0, MHIOCGRP_REGISTER, 0, vdc_null_copy_func}, - {0, MHIOCGRP_RESERVE, 0, vdc_null_copy_func}, + {0, MHIOCGRP_RESERVE, 0, vdc_null_copy_func}, {0, MHIOCGRP_PREEMPTANDABORT, 0, vdc_null_copy_func}, {0, MHIOCGRP_REGISTERANDIGNOREKEY, 0, vdc_null_copy_func}, @@ -7578,9 +7578,10 @@ vd_process_ioctl(dev_t dev, int cmd, caddr_t arg, int mode, int *rvalp) vdc->dkio_flush_pending--; mutex_exit(&vdc->lock); kmem_free(dkarg, sizeof (vdc_dk_arg_t)); + return (ENOMEM); } - return (rv == NULL ? ENOMEM : 0); + return (0); } } diff --git a/usr/src/uts/sun4v/io/vds.c b/usr/src/uts/sun4v/io/vds.c index 15d263a1b9..1c8ca84ff2 100644 --- a/usr/src/uts/sun4v/io/vds.c +++ b/usr/src/uts/sun4v/io/vds.c @@ -168,7 +168,7 @@ typedef struct vd_driver_type { * The list can be extended by adding a "driver-type-list" entry in vds.conf * with the following syntax: * - * driver-type-list="<driver>:<type>", ... ,"<driver>:<type>"; + * driver-type-list="<driver>:<type>", ... ,"<driver>:<type>"; * * Where: * <driver> is the name of a driver (limited to 64 characters) @@ -178,7 +178,7 @@ typedef struct vd_driver_type { * * For example, the following line in vds.conf: * - * driver-type-list="foo:disk","bar:volume"; + * driver-type-list="foo:disk","bar:volume"; * * defines that "foo" is a disk driver, and driver "bar" is a volume driver. * @@ -256,7 +256,7 @@ vd_driver_type_t vds_driver_types[] = { static mdeg_prop_spec_t vds_prop_template[] = { { MDET_PROP_STR, "name", VDS_NAME }, { MDET_PROP_VAL, "cfg-handle", NULL }, - { MDET_LIST_END, NULL, NULL } + { MDET_LIST_END, NULL, NULL } }; #define VDS_SET_MDEG_PROP_INST(specp, val) (specp)[1].ps_val = (val); @@ -290,7 +290,7 @@ typedef struct vd_option { vd_option_t vd_bdev_options[] = { { "ro", VD_OPT_RDONLY }, - { "slice", VD_OPT_SLICE }, + { "slice", VD_OPT_SLICE }, { "excl", VD_OPT_EXCLUSIVE } }; @@ -407,7 +407,7 @@ typedef struct vds { mdeg_node_spec_t *ispecp; /* mdeg node specification */ mdeg_handle_t mdeg; /* handle for MDEG operations */ vd_driver_type_t *driver_types; /* extra driver types (from vds.conf) */ - int num_drivers; /* num of extra driver types */ + int num_drivers; /* num of extra driver types */ } vds_t; /* @@ -595,7 +595,7 @@ static int vd_awflush = VD_AWFLUSH_IMMEDIATE | VD_AWFLUSH_GROUP; * the service domain to panic. In both cases, the reset of the service domain * should trigger a reset SCSI buses and hopefully clear any SCSI-2 reservation. */ -static int vd_reset_access_failure = 0; +static int vd_reset_access_failure = 0; /* * Tunable for backward compatibility. When this variable is set to B_TRUE, @@ -694,8 +694,8 @@ extern int is_pseudo_device(dev_info_t *); * vd_get_readable_size * * Description: - * Convert a given size in bytes to a human readable format in - * kilobytes, megabytes, gigabytes or terabytes. + * Convert a given size in bytes to a human readable format in + * kilobytes, megabytes, gigabytes or terabytes. * * Parameters: * full_size - the size to convert in bytes. @@ -729,7 +729,7 @@ vd_get_readable_size(size_t full_size, size_t *size, char *unit) * vd_dskimg_io_params * * Description: - * Convert virtual disk I/O parameters (slice, block, length) to + * Convert virtual disk I/O parameters (slice, block, length) to * (offset, length) relative to the disk image and according to * the virtual disk partitioning. * @@ -848,7 +848,7 @@ vd_dskimg_io_params(vd_t *vd, int slice, size_t *blkp, size_t *lenp) * vd_dskimg_rw * * Description: - * Read or write to a disk image. It handles the case where the disk + * Read or write to a disk image. It handles the case where the disk * image is a file or a volume exported as a full disk or a file * exported as single-slice disk. Read or write to volumes exported as * single slice disks are done by directly using the ldi interface. @@ -891,7 +891,7 @@ vd_dskimg_rw(vd_t *vd, int slice, int operation, caddr_t data, size_t offset, ((operation == VD_OP_BREAD)? B_READ : B_WRITE); buf.b_bcount = len; buf.b_lblkno = offset; - buf.b_edev = vd->dev[0]; + buf.b_edev = vd->dev[0]; buf.b_un.b_addr = data; /* @@ -986,9 +986,9 @@ vd_build_default_label(size_t disk_size, size_t bsize, struct dk_label *label) * * Other parameters are computed from these values: * - * pcyl = disk_size / (nhead * nsect * 512) - * acyl = (pcyl > 2)? 2 : 0 - * ncyl = pcyl - acyl + * pcyl = disk_size / (nhead * nsect * 512) + * acyl = (pcyl > 2)? 2 : 0 + * ncyl = pcyl - acyl * * The maximum number of cylinder is 65535 so this allows to define a * geometry for a disk size up to 65535 * 96 * 768 * 512 = 2.24 TB @@ -1358,7 +1358,7 @@ vd_dskimg_write_devid(vd_t *vd, ddi_devid_t devid) * vd_do_scsi_rdwr * * Description: - * Read or write to a SCSI disk using an absolute disk offset. + * Read or write to a SCSI disk using an absolute disk offset. * * Parameters: * vd - disk on which the operation is performed. @@ -1482,7 +1482,7 @@ vd_do_scsi_rdwr(vd_t *vd, int operation, caddr_t data, size_t blk, size_t len) * vd_scsi_rdwr * * Description: - * Wrapper function to read or write to a SCSI disk using an absolute + * Wrapper function to read or write to a SCSI disk using an absolute * disk offset. It checks the blocksize of the underlying device and, * if necessary, adjusts the buffers accordingly before calling * vd_do_scsi_rdwr() to do the actual read or write. @@ -1562,7 +1562,7 @@ vd_scsi_rdwr(vd_t *vd, int operation, caddr_t data, size_t vblk, size_t vlen) * ^ ^ * |<--------------------->| * | plen - * pblk + * pblk */ /* END CSTYLED */ pblk = (vblk * vd->vdisk_bsize) / vd->backend_bsize; @@ -1897,7 +1897,7 @@ vd_flush_write(vd_t *vd) status = VOP_FSYNC(vd->file_vnode, FSYNC, kcred, NULL); } else { status = ldi_ioctl(vd->ldi_handle[0], DKIOCFLUSHWRITECACHE, - NULL, vd->open_flags | FKIOCTL, kcred, &rval); + (intptr_t)NULL, vd->open_flags | FKIOCTL, kcred, &rval); } return (status); @@ -1973,7 +1973,7 @@ vd_start_bio(vd_task_t *task) vd_dring_payload_t *request = task->request; struct buf *buf = &task->buf; uint8_t mtype; - int slice; + int slice; char *bufaddr = 0; size_t buflen; size_t offset, length, nbytes; @@ -2116,7 +2116,7 @@ vd_start_bio(vd_task_t *task) buf->b_bcount = length; buf->b_lblkno = offset; buf->b_bufsize = buflen; - buf->b_edev = vd->dev[slice]; + buf->b_edev = vd->dev[slice]; buf->b_un.b_addr = bufaddr; buf->b_iodone = vd_biodone; @@ -2526,7 +2526,7 @@ vd_complete_bio(vd_task_t *task) * message to the client. * * Parameters: - * arg - opaque pointer to structure containing task to be completed + * arg - opaque pointer to structure containing task to be completed * * Return Values * None @@ -2569,7 +2569,7 @@ vd_notify(vd_task_t *task) * the vDisk client * * Parameters: - * task - structure containing the request sent from client + * task - structure containing the request sent from client * * Return Values * None @@ -2624,7 +2624,7 @@ vd_complete_notify(vd_task_t *task) * message to the client that the request is completed. * * Parameters: - * arg - opaque pointer to structure containing task to be completed + * arg - opaque pointer to structure containing task to be completed * * Return Values * None @@ -3578,7 +3578,7 @@ vd_do_ioctl(vd_t *vd, vd_dring_payload_t *request, void* buf, vd_ioctl_t *ioctl) * is passed in as a field in the task pointer. * * Parameters: - * arg - opaque pointer to structure containing task to be completed + * arg - opaque pointer to structure containing task to be completed * * Return Values * None @@ -3688,7 +3688,8 @@ vd_ioctl(vd_task_t *task) break; } } - ASSERT(i < nioctls); /* because "operation" already validated */ + + VERIFY(i < nioctls); /* because "operation" already validated */ if (!(vd->open_flags & FWRITE) && ioctl[i].write) { PR0("%s fails because backend is opened read-only", @@ -3890,7 +3891,7 @@ vd_get_access(vd_task_t *task) } request->status = ldi_ioctl(vd->ldi_handle[request->slice], MHIOCSTATUS, - NULL, (vd->open_flags | FKIOCTL), kcred, &rval); + (intptr_t)NULL, (vd->open_flags | FKIOCTL), kcred, &rval); if (request->status != 0) return (0); @@ -3935,8 +3936,8 @@ vd_set_access(vd_task_t *task) if (flags == VD_ACCESS_SET_CLEAR) { PR0("Performing VD_OP_SET_ACCESS (CLEAR)"); request->status = ldi_ioctl(vd->ldi_handle[request->slice], - MHIOCRELEASE, NULL, (vd->open_flags | FKIOCTL), kcred, - &rval); + MHIOCRELEASE, (intptr_t)NULL, (vd->open_flags | FKIOCTL), + kcred, &rval); if (request->status == 0) vd->ownership = B_FALSE; return (0); @@ -3962,7 +3963,8 @@ vd_set_access(vd_task_t *task) */ PR0("Performing VD_OP_SET_ACCESS (EXCLUSIVE|PREEMPT|PRESERVE)"); request->status = ldi_ioctl(vd->ldi_handle[request->slice], - MHIOCTKOWN, NULL, (vd->open_flags | FKIOCTL), kcred, &rval); + MHIOCTKOWN, (intptr_t)NULL, (vd->open_flags | FKIOCTL), + kcred, &rval); break; case VD_ACCESS_SET_PRESERVE: @@ -3977,12 +3979,13 @@ vd_set_access(vd_task_t *task) */ PR0("Performing VD_OP_SET_ACCESS (EXCLUSIVE|PRESERVE)"); request->status = ldi_ioctl(vd->ldi_handle[request->slice], - MHIOCQRESERVE, NULL, (vd->open_flags | FKIOCTL), kcred, - &rval); + MHIOCQRESERVE, (intptr_t)NULL, (vd->open_flags | FKIOCTL), + kcred, &rval); if (request->status != 0) break; request->status = ldi_ioctl(vd->ldi_handle[request->slice], - MHIOCTKOWN, NULL, (vd->open_flags | FKIOCTL), kcred, &rval); + MHIOCTKOWN, (intptr_t)NULL, (vd->open_flags | FKIOCTL), + kcred, &rval); break; case VD_ACCESS_SET_PREEMPT: @@ -3994,8 +3997,8 @@ vd_set_access(vd_task_t *task) */ PR0("Performing VD_OP_SET_ACCESS (EXCLUSIVE|PREEMPT)"); request->status = ldi_ioctl(vd->ldi_handle[request->slice], - MHIOCQRESERVE, NULL, (vd->open_flags | FKIOCTL), kcred, - &rval); + MHIOCQRESERVE, (intptr_t)NULL, (vd->open_flags | FKIOCTL), + kcred, &rval); if (request->status == 0) break; @@ -4004,16 +4007,16 @@ vd_set_access(vd_task_t *task) /* try again even if the reset has failed */ request->status = ldi_ioctl(vd->ldi_handle[request->slice], - MHIOCQRESERVE, NULL, (vd->open_flags | FKIOCTL), kcred, - &rval); + MHIOCQRESERVE, (intptr_t)NULL, (vd->open_flags | FKIOCTL), + kcred, &rval); break; case 0: /* Flag EXCLUSIVE only. Just issue a SCSI reservation */ PR0("Performing VD_OP_SET_ACCESS (EXCLUSIVE)"); request->status = ldi_ioctl(vd->ldi_handle[request->slice], - MHIOCQRESERVE, NULL, (vd->open_flags | FKIOCTL), kcred, - &rval); + MHIOCQRESERVE, (intptr_t)NULL, (vd->open_flags | FKIOCTL), + kcred, &rval); break; } @@ -4034,7 +4037,7 @@ vd_reset_access(vd_t *vd) return; PR0("Releasing disk ownership"); - status = ldi_ioctl(vd->ldi_handle[0], MHIOCRELEASE, NULL, + status = ldi_ioctl(vd->ldi_handle[0], MHIOCRELEASE, (intptr_t)NULL, (vd->open_flags | FKIOCTL), kcred, &rval); /* @@ -4059,7 +4062,7 @@ vd_reset_access(vd_t *vd) PR0("Fail to reset disk, error %d", status); /* whatever the result of the reset is, we try the release again */ - status = ldi_ioctl(vd->ldi_handle[0], MHIOCRELEASE, NULL, + status = ldi_ioctl(vd->ldi_handle[0], MHIOCRELEASE, (intptr_t)NULL, (vd->open_flags | FKIOCTL), kcred, &rval); if (status == 0 || status == EACCES) { @@ -4081,7 +4084,7 @@ vd_reset_access(vd_t *vd) if (vd_reset_access_failure == A_REBOOT) { cmn_err(CE_WARN, VD_RESET_ACCESS_FAILURE_MSG ", rebooting the system", vd->device_path); - (void) uadmin(A_SHUTDOWN, AD_BOOT, NULL); + (void) uadmin(A_SHUTDOWN, AD_BOOT, (uintptr_t)NULL); } else if (vd_reset_access_failure == A_DUMP) { panic(VD_RESET_ACCESS_FAILURE_MSG, vd->device_path); } @@ -4122,7 +4125,7 @@ static const size_t vds_noperations = * Process a task specifying a client I/O request * * Parameters: - * task - structure containing the request sent from client + * task - structure containing the request sent from client * * Return Value * 0 - success @@ -4196,7 +4199,7 @@ vd_do_process_task(vd_task_t *task) * by the completion handler. * * Parameters: - * task - structure containing the request sent from client + * task - structure containing the request sent from client * * Return Value * 0 - successful synchronous request. @@ -5415,7 +5418,7 @@ vds_detach(dev_info_t *dip, ddi_detach_cmd_t cmd) kmem_free(vds->ispecp->specp, sizeof (vds_prop_template)); kmem_free(vds->ispecp, sizeof (mdeg_node_spec_t)); vds->ispecp = NULL; - vds->mdeg = NULL; + vds->mdeg = 0; } vds_driver_types_free(vds); @@ -5884,7 +5887,7 @@ vd_setup_partition_efi(vd_t *vd) static int vd_setup_backend_vnode(vd_t *vd) { - int rval, status; + int rval, status; dev_t dev; char *file_path = vd->device_path; ldi_handle_t lhandle; @@ -6059,7 +6062,7 @@ vd_setup_disk_image(vd_t *vd) */ PR1("creating devid for %s", backend_path); - if (ddi_devid_init(vd->vds->dip, DEVID_FAB, NULL, 0, + if (ddi_devid_init(vd->vds->dip, DEVID_FAB, 0, 0, &vd->dskimg_devid) != DDI_SUCCESS) { PR0("fail to create devid for %s", backend_path); vd->dskimg_devid = NULL; @@ -6088,7 +6091,7 @@ vd_setup_disk_image(vd_t *vd) * Open a device using its device path (supplied by ldm(1m)) * * Parameters: - * vd - pointer to structure containing the vDisk info + * vd - pointer to structure containing the vDisk info * flags - open flags * * Return Value @@ -6491,7 +6494,7 @@ vd_backend_check_size(vd_t *vd) * a disk device or a volume device. * * Parameters: - * vd - pointer to structure containing the vDisk info + * vd - pointer to structure containing the vDisk info * dtype - return the driver type of the device * * Return Value @@ -6565,7 +6568,7 @@ vd_setup_vd(vd_t *vd) { int status, drv_type, pseudo; dev_info_t *dip; - vnode_t *vnp; + vnode_t *vnp; char *path = vd->device_path; char tq_name[TASKQ_NAMELEN]; @@ -7066,7 +7069,7 @@ vds_get_ldc_id(md_t *md, mde_cookie_t vd_node, uint64_t *ldc_id) * vds_get_options * * Description: - * Parse the options of a vds node. Options are defined as an array + * Parse the options of a vds node. Options are defined as an array * of strings in the vds-block-device-opts property of the vds node * in the machine description. Options are returned as a bitmask. The * mapping between the bitmask options and the options strings from the diff --git a/usr/src/uts/sun4v/io/vlds.c b/usr/src/uts/sun4v/io/vlds.c index a33978680e..e630328f0d 100644 --- a/usr/src/uts/sun4v/io/vlds.c +++ b/usr/src/uts/sun4v/io/vlds.c @@ -327,7 +327,7 @@ vlds_attach(dev_info_t *devi, ddi_attach_cmd_t cmd) } if (ddi_create_minor_node(devi, VLDS_NAME, S_IFCHR, - 0, DDI_PSEUDO, NULL) == DDI_FAILURE) { + 0, DDI_PSEUDO, 0) == DDI_FAILURE) { ddi_remove_minor_node(devi, NULL); return (DDI_FAILURE); } diff --git a/usr/src/uts/sun4v/io/vnet.c b/usr/src/uts/sun4v/io/vnet.c index 96fb04175d..8abeaf911b 100644 --- a/usr/src/uts/sun4v/io/vnet.c +++ b/usr/src/uts/sun4v/io/vnet.c @@ -2481,7 +2481,7 @@ vnet_rx_ring_stat(mac_ring_driver_t rdriver, uint_t stat, uint64_t *val) macp = &vresp->macreg; cbp = macp->m_callbacks; - cbp->mc_getstat(macp->m_driver, stat, val); + (void) cbp->mc_getstat(macp->m_driver, stat, val); return (0); } diff --git a/usr/src/uts/sun4v/io/vnet_gen.c b/usr/src/uts/sun4v/io/vnet_gen.c index c872b641c6..ae89f44a33 100644 --- a/usr/src/uts/sun4v/io/vnet_gen.c +++ b/usr/src/uts/sun4v/io/vnet_gen.c @@ -297,7 +297,7 @@ static char vgen_linkprop_propname[] = "linkprop"; * 1.3 VLAN and HybridIO support. * 1.4 Jumbo Frame support. * 1.5 Link State Notification support with optional support - * for Physical Link information. + * for Physical Link information. * 1.6 Support for RxDringData mode. */ static vgen_ver_t vgen_versions[VGEN_NUM_VER] = { {1, 6} }; @@ -697,7 +697,7 @@ vgen_tx(void *arg, mblk_t *mp) */ static mblk_t * vgen_vlan_frame_fixtag(vgen_port_t *portp, mblk_t *mp, boolean_t is_tagged, - uint16_t vid) + uint16_t vid) { vgen_t *vgenp; boolean_t dst_tagged; @@ -781,8 +781,8 @@ vgen_portsend(vgen_port_t *portp, mblk_t *mp) vgen_ldc_t *ldcp; int status; int rv = VGEN_SUCCESS; - vgen_t *vgenp = portp->vgenp; - vnet_t *vnetp = vgenp->vnetp; + vgen_t *vgenp; + vnet_t *vnetp; boolean_t is_tagged; boolean_t dec_refcnt = B_FALSE; uint16_t vlan_id; @@ -792,6 +792,9 @@ vgen_portsend(vgen_port_t *portp, mblk_t *mp) return (VGEN_FAILURE); } + vgenp = portp->vgenp; + vnetp = vgenp->vnetp; + if (portp->use_vsw_port) { (void) atomic_inc_32(&vgenp->vsw_port_refcnt); portp = portp->vgenp->vsw_portp; @@ -1396,8 +1399,8 @@ vgen_readmd_exit: */ static void vgen_vlan_read_ids(void *arg, int type, md_t *mdp, mde_cookie_t node, - uint16_t *pvidp, uint16_t **vidspp, uint16_t *nvidsp, - uint16_t *default_idp) + uint16_t *pvidp, uint16_t **vidspp, uint16_t *nvidsp, + uint16_t *default_idp) { vgen_t *vgenp; vnet_t *vnetp; @@ -1686,7 +1689,7 @@ vgen_mtu_read(vgen_t *vgenp, md_t *mdp, mde_cookie_t node, uint32_t *mtu) static void vgen_linkprop_read(vgen_t *vgenp, md_t *mdp, mde_cookie_t node, - boolean_t *pls) + boolean_t *pls) { int rv; uint64_t val; @@ -1714,8 +1717,8 @@ vgen_mdeg_reg(vgen_t *vgenp) mdeg_node_spec_t *parentp; uint_t templatesz; int rv; - mdeg_handle_t dev_hdl = NULL; - mdeg_handle_t port_hdl = NULL; + mdeg_handle_t dev_hdl = 0; + mdeg_handle_t port_hdl = 0; templatesz = sizeof (vgen_prop_template); pspecp = kmem_zalloc(templatesz, KM_NOSLEEP); @@ -1767,7 +1770,7 @@ vgen_mdeg_reg(vgen_t *vgenp) return (DDI_SUCCESS); mdeg_reg_fail: - if (dev_hdl != NULL) { + if (dev_hdl != 0) { (void) mdeg_unregister(dev_hdl); } KMEM_FREE(parentp); @@ -1780,13 +1783,13 @@ mdeg_reg_fail: static void vgen_mdeg_unreg(vgen_t *vgenp) { - if (vgenp->mdeg_dev_hdl != NULL) { + if (vgenp->mdeg_dev_hdl != 0) { (void) mdeg_unregister(vgenp->mdeg_dev_hdl); - vgenp->mdeg_dev_hdl = NULL; + vgenp->mdeg_dev_hdl = 0; } - if (vgenp->mdeg_port_hdl != NULL) { + if (vgenp->mdeg_port_hdl != 0) { (void) mdeg_unregister(vgenp->mdeg_port_hdl); - vgenp->mdeg_port_hdl = NULL; + vgenp->mdeg_port_hdl = 0; } if (vgenp->mdeg_parentp != NULL) { @@ -1803,7 +1806,7 @@ vgen_mdeg_port_cb(void *cb_argp, mdeg_result_t *resp) { int idx; int vsw_idx = -1; - uint64_t val; + uint64_t val; vgen_t *vgenp; if ((resp == NULL) || (cb_argp == NULL)) { @@ -2108,7 +2111,7 @@ vgen_add_port(vgen_t *vgenp, md_t *mdp, mde_cookie_t mdex) /* read properties of the port from its md node */ static int vgen_port_read_props(vgen_port_t *portp, vgen_t *vgenp, md_t *mdp, - mde_cookie_t mdex) + mde_cookie_t mdex) { uint64_t port_num; uint64_t *ldc_ids; @@ -2362,7 +2365,7 @@ vgen_port_detach_mdeg(vgen_port_t *portp) static int vgen_update_port(vgen_t *vgenp, md_t *curr_mdp, mde_cookie_t curr_mdex, - md_t *prev_mdp, mde_cookie_t prev_mdex) + md_t *prev_mdp, mde_cookie_t prev_mdex) { uint64_t cport_num; uint64_t pport_num; @@ -2454,10 +2457,10 @@ vgen_port_stat(vgen_port_t *portp, uint_t stat) static int vgen_ldc_attach(vgen_port_t *portp, uint64_t ldc_id) { - vgen_t *vgenp; - vgen_ldc_t *ldcp; - ldc_attr_t attr; - int status; + vgen_t *vgenp; + vgen_ldc_t *ldcp; + ldc_attr_t attr; + int status; ldc_status_t istatus; char kname[MAXNAMELEN]; int instance; @@ -2567,7 +2570,7 @@ static void vgen_ldc_detach(vgen_ldc_t *ldcp) { vgen_port_t *portp; - vgen_t *vgenp; + vgen_t *vgenp; ASSERT(ldcp != NULL); @@ -3000,7 +3003,7 @@ vgen_ldc_cb(uint64_t event, caddr_t arg) _NOTE(ARGUNUSED(event)) vgen_ldc_t *ldcp; vgen_t *vgenp; - ldc_status_t istatus; + ldc_status_t istatus; vgen_stats_t *statsp; uint_t ret = LDC_SUCCESS; @@ -3012,7 +3015,7 @@ vgen_ldc_cb(uint64_t event, caddr_t arg) mutex_enter(&ldcp->cblock); statsp->callbacks++; - if ((ldcp->ldc_status == LDC_INIT) || (ldcp->ldc_handle == NULL)) { + if ((ldcp->ldc_status == LDC_INIT) || (ldcp->ldc_handle == 0)) { DWARN(vgenp, ldcp, "status(%d) is LDC_INIT\n", ldcp->ldc_status); mutex_exit(&ldcp->cblock); @@ -3111,8 +3114,8 @@ vgen_handle_evt_read(vgen_ldc_t *ldcp, vgen_caller_t caller) size_t msglen; vgen_t *vgenp = LDC_TO_VGEN(ldcp); vio_msg_tag_t *tagp; - ldc_status_t istatus; - boolean_t has_data; + ldc_status_t istatus; + boolean_t has_data; DBG1(vgenp, ldcp, "enter\n"); @@ -4227,7 +4230,7 @@ vgen_handshake_done(vgen_ldc_t *ldcp) { vgen_t *vgenp = LDC_TO_VGEN(ldcp); uint32_t hphase = ldcp->hphase; - int status = 0; + int status = 0; switch (hphase) { @@ -5724,7 +5727,7 @@ vgen_check_sid(vgen_ldc_t *ldcp, vio_msg_tag_t *tagp) */ static void vgen_init_dring_reg_msg(vgen_ldc_t *ldcp, vio_dring_reg_msg_t *msg, - uint8_t option) + uint8_t option) { vio_msg_tag_t *tagp; diff --git a/usr/src/uts/sun4v/io/vsw.c b/usr/src/uts/sun4v/io/vsw.c index 6ec8f997bd..1c4738d3e6 100644 --- a/usr/src/uts/sun4v/io/vsw.c +++ b/usr/src/uts/sun4v/io/vsw.c @@ -747,7 +747,7 @@ static int vsw_detach(dev_info_t *dip, ddi_detach_cmd_t cmd) { vsw_t **vswpp, *vswp; - int instance; + int instance; instance = ddi_get_instance(dip); vswp = ddi_get_soft_state(vsw_state, instance); @@ -1435,8 +1435,8 @@ mdeg_reg_fail: kmem_free(pspecp, templatesz); kmem_free(inst_specp, sizeof (mdeg_node_spec_t)); - vswp->mdeg_hdl = NULL; - vswp->mdeg_port_hdl = NULL; + vswp->mdeg_hdl = 0; + vswp->mdeg_port_hdl = 0; return (1); } @@ -1446,10 +1446,10 @@ vsw_mdeg_unregister(vsw_t *vswp) { D1(vswp, "vsw_mdeg_unregister: enter"); - if (vswp->mdeg_hdl != NULL) + if (vswp->mdeg_hdl != 0) (void) mdeg_unregister(vswp->mdeg_hdl); - if (vswp->mdeg_port_hdl != NULL) + if (vswp->mdeg_port_hdl != 0) (void) mdeg_unregister(vswp->mdeg_port_hdl); if (vswp->inst_spec != NULL) { @@ -1812,8 +1812,8 @@ vsw_get_initial_md_properties(vsw_t *vswp, md_t *mdp, mde_cookie_t node) */ static void vsw_vlan_read_ids(void *arg, int type, md_t *mdp, mde_cookie_t node, - uint16_t *pvidp, vsw_vlanid_t **vidspp, uint16_t *nvidsp, - uint16_t *default_idp) + uint16_t *pvidp, vsw_vlanid_t **vidspp, uint16_t *nvidsp, + uint16_t *default_idp) { vsw_t *vswp; vsw_port_t *portp; @@ -2054,7 +2054,7 @@ vsw_mtu_update(vsw_t *vswp, uint32_t mtu) static void vsw_linkprop_read(vsw_t *vswp, md_t *mdp, mde_cookie_t node, - boolean_t *pls) + boolean_t *pls) { int rv; uint64_t val; @@ -2134,7 +2134,7 @@ vsw_update_md_prop(vsw_t *vswp, md_t *mdp, mde_cookie_t node) uint_t ddi_instance; uint8_t new_smode; int i; - uint64_t macaddr = 0; + uint64_t macaddr = 0; enum {MD_init = 0x1, MD_physname = 0x2, MD_macaddr = 0x4, @@ -2449,7 +2449,7 @@ fail_update: */ static int vsw_port_read_props(vsw_port_t *portp, vsw_t *vswp, - md_t *mdp, mde_cookie_t *node) + md_t *mdp, mde_cookie_t *node) { uint64_t ldc_id; uint8_t *addrp; @@ -2597,7 +2597,7 @@ vsw_port_add(vsw_t *vswp, md_t *mdp, mde_cookie_t *node) static int vsw_port_update(vsw_t *vswp, md_t *curr_mdp, mde_cookie_t curr_mdex, - md_t *prev_mdp, mde_cookie_t prev_mdex) + md_t *prev_mdp, mde_cookie_t prev_mdex) { uint64_t cport_num; uint64_t pport_num; diff --git a/usr/src/uts/sun4v/io/vsw_ldc.c b/usr/src/uts/sun4v/io/vsw_ldc.c index ee651e692b..099bb2b42d 100644 --- a/usr/src/uts/sun4v/io/vsw_ldc.c +++ b/usr/src/uts/sun4v/io/vsw_ldc.c @@ -279,7 +279,7 @@ extern uint32_t vsw_nrbufs_factor; * 1.3 VLAN and HybridIO support. * 1.4 Jumbo Frame support. * 1.5 Link State Notification support with optional support - * for Physical Link information. + * for Physical Link information. * 1.6 Support for RxDringData mode. */ static ver_sup_t vsw_versions[] = { {1, 6} }; @@ -471,7 +471,7 @@ vsw_port_detach(vsw_t *vswp, int p_instance) void vsw_detach_ports(vsw_t *vswp) { - vsw_port_list_t *plist = &vswp->plist; + vsw_port_list_t *plist = &vswp->plist; vsw_port_t *port = NULL; D1(vswp, "%s: enter", __func__); @@ -562,11 +562,11 @@ vsw_port_delete(vsw_port_t *port) static int vsw_ldc_attach(vsw_port_t *port, uint64_t ldc_id) { - vsw_t *vswp = port->p_vswp; - vsw_ldc_t *ldcp = NULL; - ldc_attr_t attr; + vsw_t *vswp = port->p_vswp; + vsw_ldc_t *ldcp = NULL; + ldc_attr_t attr; ldc_status_t istatus; - int status = DDI_FAILURE; + int status = DDI_FAILURE; char kname[MAXNAMELEN]; enum { PROG_init = 0x0, PROG_callback = 0x1, @@ -719,8 +719,8 @@ ldc_attach_fail: static void vsw_ldc_detach(vsw_ldc_t *ldcp) { - int rv; - vsw_t *vswp = ldcp->ldc_port->p_vswp; + int rv; + vsw_t *vswp = ldcp->ldc_port->p_vswp; int retries = 0; D2(vswp, "%s: detaching channel %lld", __func__, ldcp->ldc_id); @@ -773,7 +773,7 @@ vsw_ldc_detach(vsw_ldc_t *ldcp) (void) ldc_fini(ldcp->ldc_handle); ldcp->ldc_status = LDC_INIT; - ldcp->ldc_handle = NULL; + ldcp->ldc_handle = 0; ldcp->ldc_vswp = NULL; mutex_destroy(&ldcp->msg_thr_lock); @@ -800,7 +800,7 @@ vsw_ldc_detach(vsw_ldc_t *ldcp) static int vsw_ldc_init(vsw_ldc_t *ldcp) { - vsw_t *vswp = ldcp->ldc_vswp; + vsw_t *vswp = ldcp->ldc_vswp; ldc_status_t istatus = 0; int rv; @@ -1238,7 +1238,7 @@ static uint_t vsw_ldc_cb(uint64_t event, caddr_t arg) { vsw_ldc_t *ldcp = (vsw_ldc_t *)arg; - vsw_t *vswp = ldcp->ldc_vswp; + vsw_t *vswp = ldcp->ldc_vswp; D1(vswp, "%s: enter: ldcid (%lld)\n", __func__, ldcp->ldc_id); @@ -1246,7 +1246,7 @@ vsw_ldc_cb(uint64_t event, caddr_t arg) ldcp->ldc_stats.callbacks++; mutex_enter(&ldcp->status_lock); - if ((ldcp->ldc_status == LDC_INIT) || (ldcp->ldc_handle == NULL)) { + if ((ldcp->ldc_status == LDC_INIT) || (ldcp->ldc_handle == 0)) { mutex_exit(&ldcp->status_lock); mutex_exit(&ldcp->ldc_cblock); return (LDC_SUCCESS); @@ -2075,11 +2075,11 @@ void vsw_process_pkt(void *arg) { vsw_ldc_t *ldcp = (vsw_ldc_t *)arg; - vsw_t *vswp = ldcp->ldc_vswp; + vsw_t *vswp = ldcp->ldc_vswp; size_t msglen; vio_msg_tag_t *tagp; uint64_t *ldcmsg; - int rv = 0; + int rv = 0; D1(vswp, "%s enter: ldcid (%lld)\n", __func__, ldcp->ldc_id); @@ -2145,7 +2145,7 @@ vsw_process_pkt(void *arg) */ static void vsw_dispatch_ctrl_task(vsw_ldc_t *ldcp, void *cpkt, vio_msg_tag_t *tagp, - int msglen) + int msglen) { vsw_ctrl_task_t *ctaskp = NULL; vsw_port_t *port = ldcp->ldc_port; @@ -2221,7 +2221,7 @@ vsw_process_ctrl_pkt(void *arg) { vsw_ctrl_task_t *ctaskp = (vsw_ctrl_task_t *)arg; vsw_ldc_t *ldcp = ctaskp->ldcp; - vsw_t *vswp = ldcp->ldc_vswp; + vsw_t *vswp = ldcp->ldc_vswp; vio_msg_tag_t tag; uint16_t env; @@ -2305,7 +2305,7 @@ void vsw_process_ctrl_ver_pkt(vsw_ldc_t *ldcp, void *pkt) { vio_ver_msg_t *ver_pkt; - vsw_t *vswp = ldcp->ldc_vswp; + vsw_t *vswp = ldcp->ldc_vswp; D1(vswp, "%s(%lld): enter", __func__, ldcp->ldc_id); @@ -3362,7 +3362,7 @@ vsw_process_physlink_msg(vsw_ldc_t *ldcp, void *pkt) static void vsw_process_data_pkt(vsw_ldc_t *ldcp, void *dpkt, vio_msg_tag_t *tagp, - uint32_t msglen) + uint32_t msglen) { uint16_t env = tagp->vio_subtype_env; vsw_t *vswp = ldcp->ldc_vswp; @@ -3747,7 +3747,7 @@ vsw_portsend(vsw_port_t *port, mblk_t *mp) { mblk_t *mpt; int count; - vsw_ldc_t *ldcp = port->ldcp; + vsw_ldc_t *ldcp = port->ldcp; int status = 0; count = vsw_vlan_frame_untag(port, VSW_VNETPORT, &mp, &mpt); @@ -3763,7 +3763,7 @@ vsw_portsend(vsw_port_t *port, mblk_t *mp) * priority frames is also counted and returned. * * Params: - * vswp: pointer to the instance of vsw + * vswp: pointer to the instance of vsw * np: head of packet chain to be broken * npt: tail of packet chain to be broken * @@ -3775,7 +3775,7 @@ vsw_portsend(vsw_port_t *port, mblk_t *mp) */ static uint32_t vsw_get_pri_packets(vsw_t *vswp, mblk_t **np, mblk_t **npt, - mblk_t **hp, mblk_t **hpt) + mblk_t **hp, mblk_t **hpt) { mblk_t *tmp = NULL; mblk_t *smp = NULL; @@ -3840,7 +3840,7 @@ vsw_get_pri_packets(vsw_t *vswp, mblk_t **np, mblk_t **npt, static int vsw_ldctx_pri(void *arg, mblk_t *mp, mblk_t *mpt, uint32_t count) { - vsw_ldc_t *ldcp = (vsw_ldc_t *)arg; + vsw_ldc_t *ldcp = (vsw_ldc_t *)arg; mblk_t *tmp; mblk_t *smp; mblk_t *hmp; /* high prio pkts head */ @@ -3884,7 +3884,7 @@ vsw_ldctx_pri(void *arg, mblk_t *mp, mblk_t *mpt, uint32_t count) static int vsw_ldctx(void *arg, mblk_t *mp, mblk_t *mpt, uint32_t count) { - vsw_ldc_t *ldcp = (vsw_ldc_t *)arg; + vsw_ldc_t *ldcp = (vsw_ldc_t *)arg; mblk_t *tmp = NULL; ASSERT(count != 0); @@ -3952,7 +3952,7 @@ vsw_ldcsend_pkt(vsw_ldc_t *ldcp, mblk_t *mp) vgen_stats_t *statsp = &ldcp->ldc_stats; if ((!(ldcp->lane_out.lstate & VSW_LANE_ACTIVE)) || - (ldcp->ldc_status != LDC_UP) || (ldcp->ldc_handle == NULL)) { + (ldcp->ldc_status != LDC_UP) || (ldcp->ldc_handle == 0)) { (void) atomic_inc_32(&statsp->tx_pri_fail); DWARN(vswp, "%s(%lld) status(%d) lstate(0x%llx), dropping " "packet\n", __func__, ldcp->ldc_id, ldcp->ldc_status, @@ -4121,7 +4121,7 @@ vsw_descrsend(vsw_ldc_t *ldcp, mblk_t *mp) ASSERT(mp != NULL); if ((!(ldcp->lane_out.lstate & VSW_LANE_ACTIVE)) || - (ldcp->ldc_status != LDC_UP) || (ldcp->ldc_handle == NULL)) { + (ldcp->ldc_status != LDC_UP) || (ldcp->ldc_handle == 0)) { DERR(vswp, "%s(%lld) status(%d) state (0x%llx), dropping pkt", __func__, ldcp->ldc_id, ldcp->ldc_status, ldcp->lane_out.lstate); @@ -4566,7 +4566,7 @@ vsw_map_dring_cmn(vsw_ldc_t *ldcp, vio_dring_reg_msg_t *dring_pkt) return (dp); fail: - if (dp->dring_handle != NULL) { + if (dp->dring_handle != 0) { (void) ldc_mem_dring_unmap(dp->dring_handle); } kmem_free(dp, sizeof (*dp)); @@ -4836,9 +4836,9 @@ display_state(void) { vsw_t *vswp; vsw_port_list_t *plist; - vsw_port_t *port; - vsw_ldc_t *ldcp; - extern vsw_t *vsw_head; + vsw_port_t *port; + vsw_ldc_t *ldcp; + extern vsw_t *vsw_head; cmn_err(CE_NOTE, "***** system state *****"); diff --git a/usr/src/uts/sun4v/io/vsw_rxdring.c b/usr/src/uts/sun4v/io/vsw_rxdring.c index 5661a00bd8..adbed65efc 100644 --- a/usr/src/uts/sun4v/io/vsw_rxdring.c +++ b/usr/src/uts/sun4v/io/vsw_rxdring.c @@ -415,7 +415,7 @@ vsw_destroy_rx_dring(vsw_ldc_t *ldcp) } /* Finally, free the receive descriptor ring */ - if (dp->dring_handle != NULL) { + if (dp->dring_handle != 0) { (void) ldc_mem_dring_unbind(dp->dring_handle); (void) ldc_mem_dring_destroy(dp->dring_handle); } @@ -491,7 +491,7 @@ vsw_map_tx_dring(vsw_ldc_t *ldcp, void *pkt) return (dp); fail: - if (dp->dring_handle != NULL) { + if (dp->dring_handle != 0) { (void) ldc_mem_dring_unmap(dp->dring_handle); } kmem_free(dp, sizeof (*dp)); @@ -512,10 +512,10 @@ vsw_unmap_tx_dring(vsw_ldc_t *ldcp) } /* Unmap tx data area and free data handle */ - if (dp->data_handle != NULL) { + if (dp->data_handle != 0) { (void) ldc_mem_unmap(dp->data_handle); (void) ldc_mem_free_handle(dp->data_handle); - dp->data_handle = NULL; + dp->data_handle = 0; } /* Free tx data area cookies */ @@ -527,9 +527,9 @@ vsw_unmap_tx_dring(vsw_ldc_t *ldcp) } /* Unmap peer's dring */ - if (dp->dring_handle != NULL) { + if (dp->dring_handle != 0) { (void) ldc_mem_dring_unmap(dp->dring_handle); - dp->dring_handle = NULL; + dp->dring_handle = 0; } mutex_destroy(&dp->txlock); @@ -877,7 +877,7 @@ vsw_dringsend_shm(vsw_ldc_t *ldcp, mblk_t *mp) vsw_t *vswp = ldcp->ldc_vswp; if ((!(lane_in->lstate & VSW_LANE_ACTIVE)) || - (ldcp->ldc_status != LDC_UP) || (ldcp->ldc_handle == NULL)) { + (ldcp->ldc_status != LDC_UP) || (ldcp->ldc_handle == 0)) { DWARN(vswp, "%s(%lld) status(%d) lstate(0x%llx), dropping " "packet\n", __func__, ldcp->ldc_id, ldcp->ldc_status, lane_in->lstate); diff --git a/usr/src/uts/sun4v/io/vsw_txdring.c b/usr/src/uts/sun4v/io/vsw_txdring.c index afe0e5b6e5..26a9a401a9 100644 --- a/usr/src/uts/sun4v/io/vsw_txdring.c +++ b/usr/src/uts/sun4v/io/vsw_txdring.c @@ -394,7 +394,7 @@ vsw_destroy_tx_dring(vsw_ldc_t *ldcp) */ for (i = 0; i < vsw_num_descriptors; i++) { paddr = (vsw_private_desc_t *)dp->priv_addr + i; - if (paddr->memhandle != NULL) { + if (paddr->memhandle != 0) { if (paddr->bound == 1) { if (ldc_mem_unbind_handle( paddr->memhandle) != 0) { @@ -414,7 +414,7 @@ vsw_destroy_tx_dring(vsw_ldc_t *ldcp) "at pos %d", dp, i); continue; } - paddr->memhandle = NULL; + paddr->memhandle = 0; } mutex_destroy(&paddr->dstate_lock); } @@ -425,7 +425,7 @@ vsw_destroy_tx_dring(vsw_ldc_t *ldcp) /* * Now unbind and destroy the ring itself. */ - if (dp->dring_handle != NULL) { + if (dp->dring_handle != 0) { (void) ldc_mem_dring_unbind(dp->dring_handle); (void) ldc_mem_dring_destroy(dp->dring_handle); } @@ -505,7 +505,7 @@ vsw_unmap_rx_dring(vsw_ldc_t *ldcp) vsw_destroy_rxpools, fvmp, DDI_SLEEP); } - if (dp->dring_handle != NULL) { + if (dp->dring_handle != 0) { (void) ldc_mem_dring_unmap(dp->dring_handle); } kmem_free(dp, sizeof (dring_info_t)); @@ -800,7 +800,7 @@ vsw_dringsend(vsw_ldc_t *ldcp, mblk_t *mp) /* TODO: make test a macro */ if ((!(ldcp->lane_out.lstate & VSW_LANE_ACTIVE)) || - (ldcp->ldc_status != LDC_UP) || (ldcp->ldc_handle == NULL)) { + (ldcp->ldc_status != LDC_UP) || (ldcp->ldc_handle == 0)) { DWARN(vswp, "%s(%lld) status(%d) lstate(0x%llx), dropping " "packet\n", __func__, ldcp->ldc_id, ldcp->ldc_status, ldcp->lane_out.lstate); @@ -942,7 +942,7 @@ vsw_dringsend_free_exit: */ int vsw_dring_find_free_desc(dring_info_t *dringp, - vsw_private_desc_t **priv_p, int *idx) + vsw_private_desc_t **priv_p, int *idx) { vsw_private_desc_t *addr = NULL; int num = vsw_num_descriptors; |