hxge_hw.c revision 3dec9fcdd56adf1b4a563137b4915c8f2d83b881
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff/*
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff * CDDL HEADER START
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff *
23d366e350386ec109bfa9b2cf91225729a1a26bduboff * The contents of this file are subject to the terms of the
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff * Common Development and Distribution License (the "License").
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff * You may not use this file except in compliance with the License.
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff *
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff * or http://www.opensolaris.org/os/licensing.
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff * See the License for the specific language governing permissions
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff * and limitations under the License.
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff *
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff * When distributing Covered Code, include this CDDL HEADER in each
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff * If applicable, add the following below this CDDL HEADER, with the
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff * fields enclosed by brackets "[]" replaced with your own identifying
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff * information: Portions Copyright [yyyy] [name of copyright owner]
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff *
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff * CDDL HEADER END
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff */
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff/*
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff * Use is subject to license terms.
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff */
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff#pragma ident "%Z%%M% %I% %E% SMI"
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff#include <hxge_impl.h>
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615dubofflb_property_t lb_normal = {normal, "normal", hxge_lb_normal};
f8919bdadda3ebb97bd55cc14a16e0271ed57615dubofflb_property_t lb_mac10g = {internal, "mac10g", hxge_lb_mac10g};
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboffuint32_t hxge_lb_dbg = 1;
193974072f41a843678abf5f61979c748687e66bSherry Moore
193974072f41a843678abf5f61979c748687e66bSherry Mooreextern uint32_t hxge_jumbo_mtu;
193974072f41a843678abf5f61979c748687e66bSherry Mooreextern boolean_t hxge_jumbo_enable;
193974072f41a843678abf5f61979c748687e66bSherry Moore
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboffstatic void hxge_rtrace_ioctl(p_hxge_t, queue_t *, mblk_t *, struct iocblk *);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboffvoid
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboffhxge_global_reset(p_hxge_t hxgep)
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff{
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_DEBUG_MSG((hxgep, DDI_CTL, "==> hxge_global_reset"));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff (void) hxge_intr_hw_disable(hxgep);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if (hxgep->suspended)
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff (void) hxge_link_init(hxgep);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff (void) hxge_vmac_init(hxgep);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff (void) hxge_intr_hw_enable(hxgep);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_DEBUG_MSG((hxgep, DDI_CTL, "<== hxge_global_reset"));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff}
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
193974072f41a843678abf5f61979c748687e66bSherry Moorevoid
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboffhxge_hw_id_init(p_hxge_t hxgep)
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff{
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_DEBUG_MSG((hxgep, DDI_CTL, "==> hxge_hw_id_init"));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff /*
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff * Set up initial hardware parameters required such as mac mtu size.
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff */
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff hxgep->vmac.is_jumbo = B_FALSE;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff /* 1518 + 4 + 16 */
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff hxgep->vmac.maxframesize = STD_FRAME_SIZE + TX_PKT_HEADER_SIZE;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if (hxgep->param_arr[param_accept_jumbo].value || hxge_jumbo_enable) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff hxgep->vmac.maxframesize = (uint16_t)hxge_jumbo_mtu;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff hxgep->vmac.is_jumbo = B_TRUE;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_DEBUG_MSG((hxgep, DDI_CTL, "==> hxge_hw_id_init: maxframesize %d",
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff hxgep->vmac.maxframesize));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_DEBUG_MSG((hxgep, DDI_CTL, "<== hxge_hw_id_init"));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff}
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboffvoid
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboffhxge_hw_init_niu_common(p_hxge_t hxgep)
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff{
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff p_hxge_hw_list_t hw_p;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_DEBUG_MSG((hxgep, DDI_CTL, "==> hxge_hw_init_niu_common"));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if ((hw_p = hxgep->hxge_hw_p) == NULL) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff return;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff MUTEX_ENTER(&hw_p->hxge_cfg_lock);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if (hw_p->flags & COMMON_INIT_DONE) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_DEBUG_MSG((hxgep, MOD_CTL, "hxge_hw_init_niu_common"
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff " already done for dip $%p exiting", hw_p->parent_devp));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff MUTEX_EXIT(&hw_p->hxge_cfg_lock);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff return;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff hw_p->flags = COMMON_INIT_START;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_DEBUG_MSG((hxgep, MOD_CTL,
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff "hxge_hw_init_niu_common Started for device id %x",
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff hw_p->parent_devp));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff (void) hxge_pfc_hw_reset(hxgep);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff hw_p->flags = COMMON_INIT_DONE;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff MUTEX_EXIT(&hw_p->hxge_cfg_lock);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_DEBUG_MSG((hxgep, MOD_CTL,
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff "hxge_hw_init_niu_common Done for device id %x",
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff hw_p->parent_devp));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_DEBUG_MSG((hxgep, DDI_CTL, "<== hxge_hw_init_niu_common"));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff}
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboffuint_t
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboffhxge_intr(caddr_t arg1, caddr_t arg2)
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff{
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff p_hxge_ldv_t ldvp = (p_hxge_ldv_t)arg1;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff p_hxge_t hxgep = (p_hxge_t)arg2;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff uint_t serviced = DDI_INTR_UNCLAIMED;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff uint8_t ldv;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff hpi_handle_t handle;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff p_hxge_ldgv_t ldgvp;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff p_hxge_ldg_t ldgp, t_ldgp;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff p_hxge_ldv_t t_ldvp;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff uint32_t vector0 = 0, vector1 = 0;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff int i, j, nldvs, nintrs = 1;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff hpi_status_t rs = HPI_SUCCESS;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff /*
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff * DDI interface returns second arg as NULL
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff */
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if ((arg2 == NULL) || ((void *) ldvp->hxgep != arg2)) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff hxgep = ldvp->hxgep;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_DEBUG_MSG((hxgep, INT_CTL, "==> hxge_intr"));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if (!(hxgep->drv_state & STATE_HW_INITIALIZED)) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_ERROR_MSG((hxgep, INT_CTL,
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff "<== hxge_intr: not initialized 0x%x", serviced));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff return (serviced);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff ldgvp = hxgep->ldgvp;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_DEBUG_MSG((hxgep, INT_CTL, "==> hxge_intr: ldgvp $%p", ldgvp));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
23d366e350386ec109bfa9b2cf91225729a1a26bduboff if (ldvp == NULL && ldgvp) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff t_ldvp = ldvp = ldgvp->ldvp;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if (ldvp) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff ldgp = t_ldgp = ldvp->ldgp;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_DEBUG_MSG((hxgep, INT_CTL, "==> hxge_intr: "
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff "ldgvp $%p ldvp $%p ldgp $%p", ldgvp, ldvp, ldgp));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if (ldgvp == NULL || ldvp == NULL || ldgp == NULL) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_ERROR_MSG((hxgep, INT_CTL, "==> hxge_intr: "
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff "ldgvp $%p ldvp $%p ldgp $%p", ldgvp, ldvp, ldgp));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_ERROR_MSG((hxgep, INT_CTL, "<== hxge_intr: not ready"));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff return (DDI_INTR_UNCLAIMED);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff /*
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff * This interrupt handler will have to go through
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff * all the logical devices to find out which
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff * logical device interrupts us and then call
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff * its handler to process the events.
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff */
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff handle = HXGE_DEV_HPI_HANDLE(hxgep);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff t_ldgp = ldgp;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff t_ldvp = ldgp->ldvp;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff nldvs = ldgp->nldvs;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_DEBUG_MSG((hxgep, INT_CTL, "==> hxge_intr: #ldvs %d #intrs %d",
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff nldvs, ldgvp->ldg_intrs));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff serviced = DDI_INTR_CLAIMED;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff for (i = 0; i < nintrs; i++, t_ldgp++) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_DEBUG_MSG((hxgep, INT_CTL, "==> hxge_intr(%d): #ldvs %d "
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff " #intrs %d", i, nldvs, nintrs));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff /* Get this group's flag bits. */
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff t_ldgp->interrupted = B_FALSE;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff rs = hpi_ldsv_ldfs_get(handle, t_ldgp->ldg, &vector0, &vector1);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if (rs) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff continue;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if (!vector0 && !vector1) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_DEBUG_MSG((hxgep, INT_CTL, "==> hxge_intr: "
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff "no interrupts on group %d", t_ldgp->ldg));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff continue;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_DEBUG_MSG((hxgep, INT_CTL, "==> hxge_intr: "
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff "vector0 0x%llx vector1 0x%llx", vector0, vector1));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff t_ldgp->interrupted = B_TRUE;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff nldvs = t_ldgp->nldvs;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff for (j = 0; j < nldvs; j++, t_ldvp++) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff /*
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff * Call device's handler if flag bits are on.
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff */
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff ldv = t_ldvp->ldv;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if ((LDV_ON(ldv, vector0) | (LDV_ON(ldv, vector1)))) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_DEBUG_MSG((hxgep, INT_CTL,
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff "==> hxge_intr: calling device %d"
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff " #ldvs %d #intrs %d", j, nldvs, nintrs));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff (void) (t_ldvp->ldv_intr_handler)(
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff (caddr_t)t_ldvp, arg2);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff t_ldgp = ldgp;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff for (i = 0; i < nintrs; i++, t_ldgp++) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff /* rearm group interrupts */
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if (t_ldgp->interrupted) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_DEBUG_MSG((hxgep, INT_CTL,
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff "==> hxge_intr: arm group %d", t_ldgp->ldg));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff (void) hpi_intr_ldg_mgmt_set(handle, t_ldgp->ldg,
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff t_ldgp->arm, t_ldgp->ldg_timer);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_DEBUG_MSG((hxgep, INT_CTL, "<== hxge_intr: serviced 0x%x",
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff serviced));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff return (serviced);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff}
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboffhxge_status_t
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboffhxge_peu_handle_sys_errors(p_hxge_t hxgep)
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff{
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff hpi_handle_t handle;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff p_hxge_peu_sys_stats_t statsp;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff peu_intr_stat_t stat;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff handle = hxgep->hpi_handle;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff statsp = (p_hxge_peu_sys_stats_t)&hxgep->statsp->peu_sys_stats;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_REG_RD64(handle, PEU_INTR_STAT, &stat.value);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff /*
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff * The PCIE errors are unrecoverrable and cannot be cleared.
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff * The only thing we can do here is to mask them off to prevent
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff * continued interrupts.
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff */
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_REG_WR64(handle, PEU_INTR_MASK, 0xffffffff);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if (stat.bits.spc_acc_err) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff statsp->spc_acc_err++;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_ERROR_MSG((hxgep, HXGE_ERR_CTL,
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff "==> hxge_peu_handle_sys_errors: spc_acc_err"));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if (stat.bits.tdc_pioacc_err) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff statsp->tdc_pioacc_err++;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_ERROR_MSG((hxgep, HXGE_ERR_CTL,
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff "==> hxge_peu_handle_sys_errors: tdc_pioacc_err"));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if (stat.bits.rdc_pioacc_err) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff statsp->rdc_pioacc_err++;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_ERROR_MSG((hxgep, HXGE_ERR_CTL,
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff "==> hxge_peu_handle_sys_errors: rdc_pioacc_err"));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if (stat.bits.pfc_pioacc_err) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff statsp->pfc_pioacc_err++;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_ERROR_MSG((hxgep, HXGE_ERR_CTL,
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff "==> hxge_peu_handle_sys_errors: pfc_pioacc_err"));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if (stat.bits.vmac_pioacc_err) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff statsp->vmac_pioacc_err++;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_ERROR_MSG((hxgep, HXGE_ERR_CTL,
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff "==> hxge_peu_handle_sys_errors: vmac_pioacc_err"));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if (stat.bits.cpl_hdrq_parerr) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff statsp->cpl_hdrq_parerr++;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_ERROR_MSG((hxgep, HXGE_ERR_CTL,
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff "==> hxge_peu_handle_sys_errors: cpl_hdrq_parerr"));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if (stat.bits.cpl_dataq_parerr) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff statsp->cpl_dataq_parerr++;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_ERROR_MSG((hxgep, HXGE_ERR_CTL,
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff "==> hxge_peu_handle_sys_errors: cpl_dataq_parerr"));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if (stat.bits.retryram_xdlh_parerr) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff statsp->retryram_xdlh_parerr++;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_ERROR_MSG((hxgep, HXGE_ERR_CTL,
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff "==> hxge_peu_handle_sys_errors: retryram_xdlh_parerr"));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if (stat.bits.retrysotram_xdlh_parerr) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff statsp->retrysotram_xdlh_parerr++;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_ERROR_MSG((hxgep, HXGE_ERR_CTL,
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff "==> hxge_peu_handle_sys_errors: retrysotram_xdlh_parerr"));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if (stat.bits.p_hdrq_parerr) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff statsp->p_hdrq_parerr++;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_ERROR_MSG((hxgep, HXGE_ERR_CTL,
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff "==> hxge_peu_handle_sys_errors: p_hdrq_parerr"));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if (stat.bits.p_dataq_parerr) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff statsp->p_dataq_parerr++;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_ERROR_MSG((hxgep, HXGE_ERR_CTL,
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff "==> hxge_peu_handle_sys_errors: p_dataq_parerr"));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if (stat.bits.np_hdrq_parerr) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff statsp->np_hdrq_parerr++;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_ERROR_MSG((hxgep, HXGE_ERR_CTL,
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff "==> hxge_peu_handle_sys_errors: np_hdrq_parerr"));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if (stat.bits.np_dataq_parerr) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff statsp->np_dataq_parerr++;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_ERROR_MSG((hxgep, HXGE_ERR_CTL,
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff "==> hxge_peu_handle_sys_errors: np_dataq_parerr"));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if (stat.bits.eic_msix_parerr) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff statsp->eic_msix_parerr++;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_ERROR_MSG((hxgep, HXGE_ERR_CTL,
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff "==> hxge_peu_handle_sys_errors: eic_msix_parerr"));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if (stat.bits.hcr_parerr) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff statsp->hcr_parerr++;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_ERROR_MSG((hxgep, HXGE_ERR_CTL,
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff "==> hxge_peu_handle_sys_errors: hcr_parerr"));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff return (HXGE_OK);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff}
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff/*ARGSUSED*/
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboffuint_t
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboffhxge_syserr_intr(caddr_t arg1, caddr_t arg2)
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff{
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff p_hxge_ldv_t ldvp = (p_hxge_ldv_t)arg1;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff p_hxge_t hxgep = (p_hxge_t)arg2;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff p_hxge_ldg_t ldgp = NULL;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff hpi_handle_t handle;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff dev_err_stat_t estat;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff uint_t serviced = DDI_INTR_UNCLAIMED;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if ((arg1 == NULL) && (arg2 == NULL)) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff return (serviced);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if ((arg2 == NULL) ||
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff ((ldvp != NULL) && ((void *)ldvp->hxgep != arg2))) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if (ldvp != NULL) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff hxgep = ldvp->hxgep;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_DEBUG_MSG((hxgep, SYSERR_CTL,
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff "==> hxge_syserr_intr: arg2 $%p arg1 $%p", hxgep, ldvp));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if (ldvp != NULL && ldvp->use_timer == B_FALSE) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff ldgp = ldvp->ldgp;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if (ldgp == NULL) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_ERROR_MSG((hxgep, SYSERR_CTL,
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff "<== hxge_syserrintr(no logical group): "
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff "arg2 $%p arg1 $%p", hxgep, ldvp));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff return (DDI_INTR_UNCLAIMED);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff /*
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff * Get the logical device state if the function uses interrupt.
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff */
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff /* This interrupt handler is for system error interrupts. */
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff handle = HXGE_DEV_HPI_HANDLE(hxgep);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff estat.value = 0;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff (void) hpi_fzc_sys_err_stat_get(handle, &estat);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_DEBUG_MSG((hxgep, SYSERR_CTL,
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff "==> hxge_syserr_intr: device error 0x%016llx", estat.value));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if (estat.bits.tdc_err0 || estat.bits.tdc_err1) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff /* TDMC */
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_ERROR_MSG((hxgep, HXGE_ERR_CTL,
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff "==> hxge_syserr_intr: device error - TDMC"));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff (void) hxge_txdma_handle_sys_errors(hxgep);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff } else if (estat.bits.rdc_err0 || estat.bits.rdc_err1) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff /* RDMC */
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_ERROR_MSG((hxgep, HXGE_ERR_CTL,
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff "==> hxge_syserr_intr: device error - RDMC"));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff (void) hxge_rxdma_handle_sys_errors(hxgep);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff } else if (estat.bits.vnm_pio_err1 || estat.bits.peu_err1) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff /* PCI-E */
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_ERROR_MSG((hxgep, HXGE_ERR_CTL,
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff "==> hxge_syserr_intr: device error - PCI-E"));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff /* kstats are updated here */
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff (void) hxge_peu_handle_sys_errors(hxgep);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if (estat.bits.peu_err1)
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_FM_REPORT_ERROR(hxgep, NULL,
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_FM_EREPORT_PEU_ERR);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if (estat.bits.vnm_pio_err1)
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_FM_REPORT_ERROR(hxgep, NULL,
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_FM_EREPORT_PEU_VNM_PIO_ERR);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff } else if (estat.value != 0) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_ERROR_MSG((hxgep, HXGE_ERR_CTL,
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff "==> hxge_syserr_intr: device error - unknown"));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff serviced = DDI_INTR_CLAIMED;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if ((ldgp != NULL) && (ldvp != NULL) &&
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff (ldgp->nldvs == 1) && !ldvp->use_timer) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff (void) hpi_intr_ldg_mgmt_set(handle, ldgp->ldg,
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff B_TRUE, ldgp->ldg_timer);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_DEBUG_MSG((hxgep, SYSERR_CTL, "<== hxge_syserr_intr"));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff return (serviced);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff}
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboffvoid
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboffhxge_intr_hw_enable(p_hxge_t hxgep)
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff{
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_DEBUG_MSG((hxgep, INT_CTL, "==> hxge_intr_hw_enable"));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff (void) hxge_intr_mask_mgmt_set(hxgep, B_TRUE);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_DEBUG_MSG((hxgep, INT_CTL, "<== hxge_intr_hw_enable"));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff}
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboffvoid
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboffhxge_intr_hw_disable(p_hxge_t hxgep)
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff{
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_DEBUG_MSG((hxgep, INT_CTL, "==> hxge_intr_hw_disable"));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff (void) hxge_intr_mask_mgmt_set(hxgep, B_FALSE);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_DEBUG_MSG((hxgep, INT_CTL, "<== hxge_intr_hw_disable"));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff}
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboffvoid
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboffhxge_rx_hw_blank(void *arg, time_t ticks, uint_t count)
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff{
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff p_hxge_t hxgep = (p_hxge_t)arg;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_DEBUG_MSG((hxgep, INT_CTL, "==> hxge_rx_hw_blank"));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff /*
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff * Replace current ticks and counts for later
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff * processing by the receive packet interrupt routines.
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff */
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff hxgep->intr_timeout = (uint16_t)ticks;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff hxgep->intr_threshold = (uint16_t)count;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_DEBUG_MSG((hxgep, INT_CTL, "<== hxge_rx_hw_blank"));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff}
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboffvoid
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboffhxge_hw_stop(p_hxge_t hxgep)
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff{
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_DEBUG_MSG((hxgep, DDI_CTL, "==> hxge_hw_stop"));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff (void) hxge_tx_vmac_disable(hxgep);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff (void) hxge_rx_vmac_disable(hxgep);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff (void) hxge_txdma_hw_mode(hxgep, HXGE_DMA_STOP);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff (void) hxge_rxdma_hw_mode(hxgep, HXGE_DMA_STOP);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_DEBUG_MSG((hxgep, DDI_CTL, "<== hxge_hw_stop"));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff}
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboffvoid
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboffhxge_hw_ioctl(p_hxge_t hxgep, queue_t *wq, mblk_t *mp, struct iocblk *iocp)
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff{
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff int cmd;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_DEBUG_MSG((hxgep, IOC_CTL, "==> hxge_hw_ioctl"));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if (hxgep == NULL) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff miocnak(wq, mp, 0, EINVAL);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff return;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff iocp->ioc_error = 0;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff cmd = iocp->ioc_cmd;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff switch (cmd) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff default:
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff miocnak(wq, mp, 0, EINVAL);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff return;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff case HXGE_GET64:
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff hxge_get64(hxgep, mp->b_cont);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff miocack(wq, mp, sizeof (uint32_t), 0);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff break;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff case HXGE_PUT64:
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff hxge_put64(hxgep, mp->b_cont);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff miocack(wq, mp, 0, 0);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff break;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff case HXGE_PUT_TCAM:
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff hxge_put_tcam(hxgep, mp->b_cont);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff miocack(wq, mp, 0, 0);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff break;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff case HXGE_GET_TCAM:
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff hxge_get_tcam(hxgep, mp->b_cont);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff miocack(wq, mp, 0, 0);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff break;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff case HXGE_RTRACE:
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff hxge_rtrace_ioctl(hxgep, wq, mp, iocp);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff break;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff}
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff/*
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff * 10G is the only loopback mode for Hydra.
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff */
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboffvoid
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboffhxge_loopback_ioctl(p_hxge_t hxgep, queue_t *wq, mblk_t *mp,
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff struct iocblk *iocp)
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff{
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff p_lb_property_t lb_props;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff size_t size;
23d366e350386ec109bfa9b2cf91225729a1a26bduboff int i;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if (mp->b_cont == NULL) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff miocnak(wq, mp, 0, EINVAL);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff switch (iocp->ioc_cmd) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff case LB_GET_MODE:
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_DEBUG_MSG((hxgep, IOC_CTL, "HXGE_GET_LB_MODE command"));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if (hxgep != NULL) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff *(lb_info_sz_t *)mp->b_cont->b_rptr =
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff hxgep->statsp->port_stats.lb_mode;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff miocack(wq, mp, sizeof (hxge_lb_t), 0);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff } else
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff miocnak(wq, mp, 0, EINVAL);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff break;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff case LB_SET_MODE:
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_DEBUG_MSG((hxgep, IOC_CTL, "HXGE_SET_LB_MODE command"));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if (iocp->ioc_count != sizeof (uint32_t)) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff miocack(wq, mp, 0, 0);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff break;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if ((hxgep != NULL) && hxge_set_lb(hxgep, wq, mp->b_cont)) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff miocack(wq, mp, 0, 0);
23d366e350386ec109bfa9b2cf91225729a1a26bduboff } else {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff miocnak(wq, mp, 0, EPROTO);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff break;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff case LB_GET_INFO_SIZE:
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_DEBUG_MSG((hxgep, IOC_CTL, "LB_GET_INFO_SIZE command"));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if (hxgep != NULL) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff size = sizeof (lb_normal) + sizeof (lb_mac10g);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff *(lb_info_sz_t *)mp->b_cont->b_rptr = size;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_DEBUG_MSG((hxgep, IOC_CTL,
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff "HXGE_GET_LB_INFO command: size %d", size));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff miocack(wq, mp, sizeof (lb_info_sz_t), 0);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff } else
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff miocnak(wq, mp, 0, EINVAL);
23d366e350386ec109bfa9b2cf91225729a1a26bduboff break;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff case LB_GET_INFO:
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_DEBUG_MSG((hxgep, IOC_CTL, "HXGE_GET_LB_INFO command"));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if (hxgep != NULL) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff size = sizeof (lb_normal) + sizeof (lb_mac10g);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_DEBUG_MSG((hxgep, IOC_CTL,
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff "HXGE_GET_LB_INFO command: size %d", size));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if (size == iocp->ioc_count) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff i = 0;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff lb_props = (p_lb_property_t)mp->b_cont->b_rptr;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff lb_props[i++] = lb_normal;
23d366e350386ec109bfa9b2cf91225729a1a26bduboff lb_props[i++] = lb_mac10g;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff miocack(wq, mp, size, 0);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff } else
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff miocnak(wq, mp, 0, EINVAL);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff } else {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff miocnak(wq, mp, 0, EINVAL);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff cmn_err(CE_NOTE, "hxge_hw_ioctl: invalid command 0x%x",
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff iocp->ioc_cmd);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff break;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff}
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff/*ARGSUSED*/
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboffboolean_t
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboffhxge_set_lb(p_hxge_t hxgep, queue_t *wq, p_mblk_t mp)
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff{
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff boolean_t status = B_TRUE;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff uint32_t lb_mode;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff lb_property_t *lb_info;
23d366e350386ec109bfa9b2cf91225729a1a26bduboff
23d366e350386ec109bfa9b2cf91225729a1a26bduboff HXGE_DEBUG_MSG((hxgep, IOC_CTL, "<== hxge_set_lb"));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff lb_mode = hxgep->statsp->port_stats.lb_mode;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if (lb_mode == *(uint32_t *)mp->b_rptr) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff cmn_err(CE_NOTE,
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff "hxge%d: Loopback mode already set (lb_mode %d).\n",
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff hxgep->instance, lb_mode);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff status = B_FALSE;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff goto hxge_set_lb_exit;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff lb_mode = *(uint32_t *)mp->b_rptr;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff lb_info = NULL;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff /* 10G is the only loopback mode for Hydra */
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if (lb_mode == lb_normal.value)
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff lb_info = &lb_normal;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff else if (lb_mode == lb_mac10g.value)
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff lb_info = &lb_mac10g;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff else {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff cmn_err(CE_NOTE,
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff "hxge%d: Loopback mode not supported(mode %d).\n",
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff hxgep->instance, lb_mode);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff status = B_FALSE;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff goto hxge_set_lb_exit;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if (lb_mode == hxge_lb_normal) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if (hxge_lb_dbg) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff cmn_err(CE_NOTE,
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff "!hxge%d: Returning to normal operation",
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff hxgep->instance);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff hxgep->statsp->port_stats.lb_mode = hxge_lb_normal;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff hxge_global_reset(hxgep);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff goto hxge_set_lb_exit;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff hxgep->statsp->port_stats.lb_mode = lb_mode;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if (hxge_lb_dbg)
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff cmn_err(CE_NOTE, "!hxge%d: Adapter now in %s loopback mode",
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff hxgep->instance, lb_info->key);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if (lb_info->lb_type == internal) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if ((hxgep->statsp->port_stats.lb_mode == hxge_lb_mac10g))
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff hxgep->statsp->mac_stats.link_speed = 10000;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff else {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff cmn_err(CE_NOTE,
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff "hxge%d: Loopback mode not supported(mode %d).\n",
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff hxgep->instance, lb_mode);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff status = B_FALSE;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff goto hxge_set_lb_exit;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff hxgep->statsp->mac_stats.link_duplex = 2;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff hxgep->statsp->mac_stats.link_up = 1;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff hxge_global_reset(hxgep);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboffhxge_set_lb_exit:
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_DEBUG_MSG((hxgep, DDI_CTL,
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff "<== hxge_set_lb status = 0x%08x", status));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff return (status);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff}
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboffvoid
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboffhxge_check_hw_state(p_hxge_t hxgep)
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff{
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff p_hxge_ldgv_t ldgvp;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff p_hxge_ldv_t t_ldvp;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_DEBUG_MSG((hxgep, SYSERR_CTL, "==> hxge_check_hw_state"));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff MUTEX_ENTER(hxgep->genlock);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff hxgep->hxge_timerid = 0;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if (!(hxgep->drv_state & STATE_HW_INITIALIZED)) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff goto hxge_check_hw_state_exit;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff hxge_check_tx_hang(hxgep);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff ldgvp = hxgep->ldgvp;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if (ldgvp == NULL || (ldgvp->ldvp_syserr == NULL)) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_ERROR_MSG((hxgep, SYSERR_CTL, "<== hxge_check_hw_state: "
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff "NULL ldgvp (interrupt not ready)."));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff goto hxge_check_hw_state_exit;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff t_ldvp = ldgvp->ldvp_syserr;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if (!t_ldvp->use_timer) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_DEBUG_MSG((hxgep, SYSERR_CTL, "<== hxge_check_hw_state: "
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff "ldgvp $%p t_ldvp $%p use_timer flag %d",
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff ldgvp, t_ldvp, t_ldvp->use_timer));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff goto hxge_check_hw_state_exit;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if (fm_check_acc_handle(hxgep->dev_regs->hxge_regh) != DDI_FM_OK) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_ERROR_MSG((hxgep, HXGE_ERR_CTL,
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff "Bad register acc handle"));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff (void) hxge_syserr_intr((caddr_t)t_ldvp, (caddr_t)hxgep);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff hxgep->hxge_timerid = hxge_start_timer(hxgep, hxge_check_hw_state,
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_CHECK_TIMER);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboffhxge_check_hw_state_exit:
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff MUTEX_EXIT(hxgep->genlock);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_DEBUG_MSG((hxgep, SYSERR_CTL, "<== hxge_check_hw_state"));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff}
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff/*ARGSUSED*/
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboffstatic void
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboffhxge_rtrace_ioctl(p_hxge_t hxgep, queue_t *wq, mblk_t *mp,
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff struct iocblk *iocp)
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff{
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff ssize_t size;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff rtrace_t *rtp;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff mblk_t *nmp;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff uint32_t i, j;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff uint32_t start_blk;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff uint32_t base_entry;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff uint32_t num_entries;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_DEBUG_MSG((hxgep, STR_CTL, "==> hxge_rtrace_ioctl"));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff size = 1024;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff if (mp->b_cont == NULL || MBLKL(mp->b_cont) < size) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_DEBUG_MSG((hxgep, STR_CTL,
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff "malformed M_IOCTL MBLKL = %d size = %d",
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff MBLKL(mp->b_cont), size));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff miocnak(wq, mp, 0, EINVAL);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff return;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff nmp = mp->b_cont;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff rtp = (rtrace_t *)nmp->b_rptr;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff start_blk = rtp->next_idx;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff num_entries = rtp->last_idx;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff base_entry = start_blk * MAX_RTRACE_IOC_ENTRIES;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_DEBUG_MSG((hxgep, STR_CTL, "start_blk = %d\n", start_blk));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_DEBUG_MSG((hxgep, STR_CTL, "num_entries = %d\n", num_entries));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_DEBUG_MSG((hxgep, STR_CTL, "base_entry = %d\n", base_entry));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff rtp->next_idx = hpi_rtracebuf.next_idx;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff rtp->last_idx = hpi_rtracebuf.last_idx;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff rtp->wrapped = hpi_rtracebuf.wrapped;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff for (i = 0, j = base_entry; i < num_entries; i++, j++) {
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff rtp->buf[i].ctl_addr = hpi_rtracebuf.buf[j].ctl_addr;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff rtp->buf[i].val_l32 = hpi_rtracebuf.buf[j].val_l32;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff rtp->buf[i].val_h32 = hpi_rtracebuf.buf[j].val_h32;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff }
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff nmp->b_wptr = nmp->b_rptr + size;
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff HXGE_DEBUG_MSG((hxgep, STR_CTL, "<== hxge_rtrace_ioctl"));
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff miocack(wq, mp, (int)size, 0);
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff}
f8919bdadda3ebb97bd55cc14a16e0271ed57615duboff