Module Name: src Committed By: tsutsui Date: Sat Aug 1 08:20:36 UTC 2009
Modified Files: src/sys/arch/pmax/tc: asc_ioasic.c Log Message: Micro optimization around ncr53c9x register accesses. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/arch/pmax/tc/asc_ioasic.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/pmax/tc/asc_ioasic.c diff -u src/sys/arch/pmax/tc/asc_ioasic.c:1.20 src/sys/arch/pmax/tc/asc_ioasic.c:1.21 --- src/sys/arch/pmax/tc/asc_ioasic.c:1.20 Mon Apr 28 20:23:31 2008 +++ src/sys/arch/pmax/tc/asc_ioasic.c Sat Aug 1 08:20:36 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: asc_ioasic.c,v 1.20 2008/04/28 20:23:31 martin Exp $ */ +/* $NetBSD: asc_ioasic.c,v 1.21 2009/08/01 08:20:36 tsutsui Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: asc_ioasic.c,v 1.20 2008/04/28 20:23:31 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: asc_ioasic.c,v 1.21 2009/08/01 08:20:36 tsutsui Exp $"); #include <sys/types.h> #include <sys/param.h> @@ -70,6 +70,13 @@ #define ASC_MAPLOADED 0x0004 }; +#define ASC_READ_REG(asc, reg) \ + bus_space_read_4((asc)->sc_bst, (asc)->sc_scsi_bsh, \ + (reg) * sizeof(uint32_t)) +#define ASC_WRITE_REG(asc, reg, val) \ + bus_space_write_4((asc)->sc_bst, (asc)->sc_scsi_bsh, \ + (reg) * sizeof(uint32_t), (val)) + static int asc_ioasic_match(device_t, cfdata_t, void *); static void asc_ioasic_attach(device_t, device_t, void *); @@ -333,8 +340,8 @@ if (asc->sc_dmasize == 0) { /* A "Transfer Pad" operation completed */ - tcl = NCR_READ_REG(sc, NCR_TCL); - tcm = NCR_READ_REG(sc, NCR_TCM); + tcl = ASC_READ_REG(asc, NCR_TCL); + tcm = ASC_READ_REG(asc, NCR_TCM); NCR_DMA(("ioasic_intr: discarded %d bytes (tcl=%d, tcm=%d)\n", tcl | (tcm << 8), tcl, tcm)); return 0; @@ -342,13 +349,13 @@ resid = 0; if ((asc->sc_flags & ASC_ISPULLUP) == 0 && - (resid = (NCR_READ_REG(sc, NCR_FFLAG) & NCRFIFO_FF)) != 0) { + (resid = (ASC_READ_REG(asc, NCR_FFLAG) & NCRFIFO_FF)) != 0) { NCR_DMA(("ioasic_intr: empty FIFO of %d ", resid)); DELAY(1); } - resid += (tcl = NCR_READ_REG(sc, NCR_TCL)); - resid += (tcm = NCR_READ_REG(sc, NCR_TCM)) << 8; + resid += (tcl = ASC_READ_REG(asc, NCR_TCL)); + resid += (tcm = ASC_READ_REG(asc, NCR_TCM)) << 8; trans = asc->sc_dmasize - resid; if (trans < 0) { /* transferred < 0 ? */ @@ -416,8 +423,7 @@ struct asc_softc *asc = (struct asc_softc *)sc; uint32_t v; - v = bus_space_read_4(asc->sc_bst, asc->sc_scsi_bsh, - reg * sizeof(uint32_t)); + v = ASC_READ_REG(asc, reg); return v & 0xff; } @@ -427,15 +433,15 @@ { struct asc_softc *asc = (struct asc_softc *)sc; - bus_space_write_4(asc->sc_bst, asc->sc_scsi_bsh, - reg * sizeof(uint32_t), val); + ASC_WRITE_REG(asc, reg, val); } static int asc_dma_isintr(struct ncr53c9x_softc *sc) { + struct asc_softc *asc = (struct asc_softc *)sc; - return (NCR_READ_REG(sc, NCR_STAT) & NCRSTAT_INT) != 0; + return (ASC_READ_REG(asc, NCR_STAT) & NCRSTAT_INT) != 0; } static int