From owner-p4-projects@FreeBSD.ORG Wed Oct 18 20:23:12 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 555E716A4A7; Wed, 18 Oct 2006 20:23:12 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1416816A415 for ; Wed, 18 Oct 2006 20:23:12 +0000 (UTC) (envelope-from mjacob@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id D9CA143D72 for ; Wed, 18 Oct 2006 20:23:01 +0000 (GMT) (envelope-from mjacob@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k9IKN1Fj099702 for ; Wed, 18 Oct 2006 20:23:01 GMT (envelope-from mjacob@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k9IKN1Zh099699 for perforce@freebsd.org; Wed, 18 Oct 2006 20:23:01 GMT (envelope-from mjacob@freebsd.org) Date: Wed, 18 Oct 2006 20:23:01 GMT Message-Id: <200610182023.k9IKN1Zh099699@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to mjacob@freebsd.org using -f From: Matt Jacob To: Perforce Change Reviews Cc: Subject: PERFORCE change 108060 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Oct 2006 20:23:12 -0000 http://perforce.freebsd.org/chv.cgi?CH=108060 Change 108060 by mjacob@newisp on 2006/10/18 20:22:46 Put ISR read arguments for mailbox and semaphore pointers back to pointers to shorts. Reinstate PTISP checking, only set a bit for them in sdparam. Move some items araound and add a reset0 point to turn intsok back to zero. Put in request queue debug printouts. Affected files ... .. //depot/projects/newisp/dev/isp/isp_sbus.c#6 edit Differences ... ==== //depot/projects/newisp/dev/isp/isp_sbus.c#6 (text+ko) ==== @@ -56,13 +56,14 @@ static void isp_sbus_wr_reg(ispsoftc_t *, int, uint32_t); static int -isp_sbus_rd_isr(ispsoftc_t *, uint32_t *, uint32_t *, uint32_t *); +isp_sbus_rd_isr(ispsoftc_t *, uint32_t *, uint16_t *, uint16_t *); static int isp_sbus_mbxdma(ispsoftc_t *); static int isp_sbus_dmasetup(ispsoftc_t *, XS_T *, ispreq_t *, uint32_t *, uint32_t); static void isp_sbus_dmateardown(ispsoftc_t *, XS_T *, uint32_t); +static void isp_sbus_reset0(ispsoftc_t *); static void isp_sbus_reset1(ispsoftc_t *); static void isp_sbus_dumpregs(ispsoftc_t *, const char *); @@ -73,7 +74,7 @@ isp_sbus_mbxdma, isp_sbus_dmasetup, isp_sbus_dmateardown, - NULL, + isp_sbus_reset0, isp_sbus_reset1, isp_sbus_dumpregs, NULL, @@ -151,6 +152,7 @@ struct isp_sbussoftc *sbs; ispsoftc_t *isp = NULL; int locksetup = 0; + int ints_setup = 0; /* * Figure out if we're supposed to skip this one. @@ -186,10 +188,8 @@ regs = NULL; iqd = 0; - rid = 0; - regs = - bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); + regs = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); if (regs == 0) { device_printf(dev, "unable to map registers\n"); goto bad; @@ -245,21 +245,19 @@ } /* - * Some early versions of the PTI SBus adapter - * would fail in trying to download (via poking) - * FW. We give up on them. + * We don't trust NVRAM on SBus cards + */ + isp->isp_confopts |= ISP_CFG_NONVRAM; + + /* + * Mark things if we're a PTI SBus adapter. */ if (strcmp("PTI,ptisp", ofw_bus_get_name(dev)) == 0 || strcmp("ptisp", ofw_bus_get_name(dev)) == 0) { - isp->isp_confopts |= ISP_CFG_NORELOAD; + SDPARAM(isp)->isp_ptisp = 1; } - /* - * We don't trust NVRAM on SBus cards - */ - isp->isp_confopts |= ISP_CFG_NONVRAM; - #if __FreeBSD_version >= 700000 isp->isp_osinfo.fw = firmware_get("isp_1000"); if (isp->isp_osinfo.fw) { @@ -279,14 +277,6 @@ } #endif - iqd = 0; - sbs->sbus_ires = bus_alloc_resource_any(dev, SYS_RES_IRQ, &iqd, - RF_ACTIVE | RF_SHAREABLE); - if (sbs->sbus_ires == NULL) { - device_printf(dev, "could not allocate interrupt\n"); - goto bad; - } - tval = 0; if (resource_int_value(device_get_name(dev), device_get_unit(dev), "fwload_disable", &tval) == 0 && tval != 0) { @@ -315,11 +305,20 @@ mtx_init(&isp->isp_osinfo.lock, "isp", NULL, MTX_DEF); locksetup++; + iqd = 0; + sbs->sbus_ires = bus_alloc_resource_any(dev, SYS_RES_IRQ, &iqd, + RF_ACTIVE | RF_SHAREABLE); + if (sbs->sbus_ires == NULL) { + device_printf(dev, "could not allocate interrupt\n"); + goto bad; + } + if (bus_setup_intr(dev, sbs->sbus_ires, ISP_IFLAGS, isp_sbus_intr, isp, &sbs->ih)) { device_printf(dev, "could not setup interrupt\n"); goto bad; } + ints_setup++; /* * Set up logging levels. @@ -329,8 +328,9 @@ } else { isp->isp_dblev = ISP_LOGWARN|ISP_LOGERR; } - if (bootverbose) + if (bootverbose) { isp->isp_dblev |= ISP_LOGCONFIG|ISP_LOGINFO; + } /* * Make sure we're in reset state. @@ -338,6 +338,7 @@ ISP_LOCK(isp); isp_reset(isp); if (isp->isp_state != ISP_RESETSTATE) { + isp_uninit(isp); ISP_UNLOCK(isp); goto bad; } @@ -353,42 +354,33 @@ ISP_UNLOCK(isp); goto bad; } - /* - * XXXX: Here is where we might unload the f/w module - * XXXX: (or decrease the reference count to it). - */ ISP_UNLOCK(isp); return (0); bad: - if (sbs && sbs->ih) { + if (sbs && ints_setup) { (void) bus_teardown_intr(dev, sbs->sbus_ires, sbs->ih); } - if (locksetup && isp) { - mtx_destroy(&isp->isp_osinfo.lock); - } - if (sbs && sbs->sbus_ires) { bus_release_resource(dev, SYS_RES_IRQ, iqd, sbs->sbus_ires); } + if (locksetup && isp) { + mtx_destroy(&isp->isp_osinfo.lock); + } if (regs) { (void) bus_release_resource(dev, 0, 0, regs); } if (sbs) { - if (sbs->sbus_isp.isp_param) + if (sbs->sbus_isp.isp_param) { free(sbs->sbus_isp.isp_param, M_DEVBUF); + } free(sbs, M_DEVBUF); } - - /* - * XXXX: Here is where we might unload the f/w module - * XXXX: (or decrease the reference count to it). - */ return (ENXIO); } @@ -396,7 +388,8 @@ isp_sbus_intr(void *arg) { ispsoftc_t *isp = arg; - uint32_t isr, sema, mbox; + uint32_t isr; + uint16_t sema, mbox; ISP_LOCK(isp); isp->isp_intcnt++; @@ -419,7 +412,7 @@ bus_space_read_2(sbc->sbus_st, sbc->sbus_sh, off) static int -isp_sbus_rd_isr(ispsoftc_t *isp, uint32_t *isrp, uint32_t *semap, uint32_t *mbp) +isp_sbus_rd_isr(ispsoftc_t *isp, uint32_t *isrp, uint16_t *semap, uint16_t *mbp) { struct isp_sbussoftc *sbc = (struct isp_sbussoftc *) isp; uint16_t isr, sema; @@ -810,6 +803,9 @@ return (retval); } mbxsync: + if (isp->isp_dblev & ISP_LOGDEBUG1) { + isp_print_bytes(isp, "Request Queue Entry", QENTRY_LEN, rq); + } switch (rq->req_header.rqs_entry_type) { case RQSTYPE_REQUEST: isp_put_request(isp, rq, qep); @@ -837,10 +833,16 @@ static void +isp_sbus_reset0(ispsoftc_t *isp) +{ + isp->isp_osinfo.intsok = 0; +} + +static void isp_sbus_reset1(ispsoftc_t *isp) { - /* enable interrupts */ - ENABLE_INTS(isp); +/* isp->isp_osinfo.intsok = 1; */ + ISP_ENABLE_INTS(isp); } static void