From owner-p4-projects@FreeBSD.ORG Mon Jun 7 16:36:29 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id C984616A4D2; Mon, 7 Jun 2004 16:36:28 +0000 (GMT) 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 A136E16A4CE for ; Mon, 7 Jun 2004 16:36:28 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8638443D5C for ; Mon, 7 Jun 2004 16:36:28 +0000 (GMT) (envelope-from scottl@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.11/8.12.11) with ESMTP id i57GZgFu054989 for ; Mon, 7 Jun 2004 16:35:42 GMT (envelope-from scottl@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.11/8.12.11/Submit) id i57GZg9g054986 for perforce@freebsd.org; Mon, 7 Jun 2004 16:35:42 GMT (envelope-from scottl@freebsd.org) Date: Mon, 7 Jun 2004 16:35:42 GMT Message-Id: <200406071635.i57GZg9g054986@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to scottl@freebsd.org using -f From: Scott Long To: Perforce Change Reviews Subject: PERFORCE change 54323 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jun 2004 16:36:29 -0000 http://perforce.freebsd.org/chv.cgi?CH=54323 Change 54323 by scottl@scottl-esp-sparc64 on 2004/06/07 16:34:55 Start working on ncr53c9x_action() and the XPT_SCSI_IO and XPT_RESET_BUS ops. Affected files ... .. //depot/projects/scottl-esp/src/sys/dev/esp/ncr53c9x.c#8 edit Differences ... ==== //depot/projects/scottl-esp/src/sys/dev/esp/ncr53c9x.c#8 (text+ko) ==== @@ -805,25 +805,21 @@ void ncr53c9x_action(struct cam_sim *sim, union ccb *ccb) { - struct scsipi_xfer *xs; - struct scsipi_periph *periph; - struct ncr53c9x_softc *sc = (void *)chan->chan_adapter->adapt_dev; + struct ncr53c9x_softc *sc; struct ncr53c9x_ecb *ecb; int flags; NCR_TRACE(("[ncr53c9x_action] ")); + sc = cam_sim_softc(sim); mtx_lock(&sc->sc_lock); - switch (req) { - case ADAPTER_REQ_RUN_XFER: - xs = arg; - periph = xs->xs_periph; - flags = xs->xs_control; + switch (ccb->ccb_h.func_code) { + case XPT_SCSI_IO: + case XPT_RESET_BUS: + { + struct ccb_scsiio *csio; - NCR_CMDS(("[0x%x, %d]->%d ", (int)xs->cmd->opcode, xs->cmdlen, - periph->periph_target)); - /* Get an ECB to use. */ ecb = ncr53c9x_get_ecb(sc, xs->xs_control); /* @@ -831,27 +827,33 @@ * in the mid-layer. */ if (ecb == NULL) { - scsipi_printaddr(periph); + xpt_freeze_simq(sim, 1); + ccb->ccb_h.status = CAM_BUSY; printf("unable to allocate ecb\n"); - xs->error = XS_RESOURCE_SHORTAGE; mtx_unlock(&sc->sc_lock); - scsipi_done(xs); + xpt_done(ccb); return; } /* Initialize ecb */ - ecb->xs = xs; - ecb->timeout = xs->timeout; + ecb->ccb = ccb; + ecb->timeout = ccb->ccb_h.timeout; - if (flags & XS_CTL_RESET) { + if (ccb->ccb_h.func_code == XPT_RESET_BUS) { ecb->flags |= ECB_RESET; ecb->clen = 0; ecb->dleft = 0; } else { - memcpy(&ecb->cmd.cmd, xs->cmd, xs->cmdlen); - ecb->clen = xs->cmdlen; - ecb->daddr = xs->data; - ecb->dleft = xs->datalen; + csio = &ccb->csio; + if ((ccb->ccb_h.flags & CAM_CDB_POINTER) != 0) + bcopy(csio->cdb_io.cdb_ptr, &ecb->cmd.cmd, + csio->cdb_len); + else + bcopy(csio->cdb_io.cdb_bytes, &ecb->cmd.cmd, + csio->cdb_len); + ecb->clen = csio->cdb_len; + ecb->daddr = csio->data_ptr; + ecb->dleft = csio->dxfer_len; } ecb->stat = 0; @@ -860,10 +862,10 @@ if (sc->sc_state == NCR_IDLE) ncr53c9x_sched(sc); +#if 0 if ((flags & XS_CTL_POLL) == 0) break; -#if 0 /* Not allowed to use interrupts, use polling instead */ if (ncr53c9x_poll(sc, xs, ecb->timeout)) { ncr53c9x_timeout(ecb); @@ -872,13 +874,10 @@ } #endif break; + } - case ADAPTER_REQ_GROW_RESOURCES: - /* XXX Not supported. */ - break; - - case ADAPTER_REQ_SET_XFER_MODE: - { + case XPT_SET_TRAN_SETTINGS: + { struct ncr53c9x_tinfo *ti; struct scsipi_xfer_mode *xm = arg; @@ -919,6 +918,8 @@ ncr53c9x_update_xfer_mode(sc, xm->xm_target); } break; + default: + break; } mtx_unlock(&sc->sc_lock);