Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/sgimips/hpc Some KNF and cosmetics.
details: https://anonhg.NetBSD.org/src/rev/045a64a2d4a0
branches: trunk
changeset: 761360:045a64a2d4a0
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Tue Jan 25 12:30:32 2011 +0000
description:
Some KNF and cosmetics.
diffstat:
sys/arch/sgimips/hpc/hpcdma.c | 35 ++++++++++---------
sys/arch/sgimips/hpc/wdsc.c | 74 ++++++++++++++++++++----------------------
2 files changed, 53 insertions(+), 56 deletions(-)
diffs (275 lines):
diff -r be5531cfe8e6 -r 045a64a2d4a0 sys/arch/sgimips/hpc/hpcdma.c
--- a/sys/arch/sgimips/hpc/hpcdma.c Tue Jan 25 12:25:43 2011 +0000
+++ b/sys/arch/sgimips/hpc/hpcdma.c Tue Jan 25 12:30:32 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hpcdma.c,v 1.19 2011/01/25 12:21:04 tsutsui Exp $ */
+/* $NetBSD: hpcdma.c,v 1.20 2011/01/25 12:30:32 tsutsui Exp $ */
/*
* Copyright (c) 2001 Wayne Knowles
@@ -44,7 +44,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hpcdma.c,v 1.19 2011/01/25 12:21:04 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hpcdma.c,v 1.20 2011/01/25 12:30:32 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -85,28 +85,27 @@
/*
* Allocate a block of memory for dma chaining pointers
*/
- if (bus_dmamem_alloc(sc->sc_dmat, allocsz, 0, 0,
- &seg, 1, &rseg, BUS_DMA_NOWAIT)) {
+ if (bus_dmamem_alloc(sc->sc_dmat, allocsz, 0, 0, &seg, 1, &rseg,
+ BUS_DMA_NOWAIT)) {
printf(": can't allocate sglist\n");
return;
}
/* Map pages into kernel memory */
if (bus_dmamem_map(sc->sc_dmat, &seg, rseg, allocsz,
- (void **)&sc->sc_desc_kva, BUS_DMA_NOWAIT)) {
+ (void **)&sc->sc_desc_kva, BUS_DMA_NOWAIT)) {
printf(": can't map sglist\n");
bus_dmamem_free(sc->sc_dmat, &seg, rseg);
return;
}
- if (bus_dmamap_create(sc->sc_dmat, allocsz, 1 /*seg*/,
- allocsz, 0, BUS_DMA_WAITOK,
- &sc->sc_dmamap) != 0) {
+ if (bus_dmamap_create(sc->sc_dmat, allocsz, 1 /*seg*/, allocsz, 0,
+ BUS_DMA_WAITOK, &sc->sc_dmamap) != 0) {
printf(": failed to create dmamap\n");
return;
}
- if (bus_dmamap_load(sc->sc_dmat, sc->sc_dmamap, sc->sc_desc_kva,
- allocsz, NULL, BUS_DMA_NOWAIT)) {
+ if (bus_dmamap_load(sc->sc_dmat, sc->sc_dmamap,
+ sc->sc_desc_kva, allocsz, NULL, BUS_DMA_NOWAIT)) {
printf(": can't load sglist\n");
return;
}
@@ -142,18 +141,20 @@
hva->hpc3_hdd_ctl = segp->ds_len;
hva->hdd_descptr = hpa;
} else /* HPC 1/1.5 */ {
- /* there doesn't seem to be any good way of doing this
- via an abstraction layer */
+ /*
+ * there doesn't seem to be any good way of doing this
+ * via an abstraction layer
+ */
hva->hpc1_hdd_bufptr = segp->ds_addr;
hva->hpc1_hdd_ctl = segp->ds_len;
hva->hdd_descptr = hpa;
}
- ++hva; ++segp;
+ ++hva;
+ ++segp;
}
/* Work around HPC3 DMA bug */
- if (sc->hpc->revision == 3)
- {
+ if (sc->hpc->revision == 3) {
hva->hpc3_hdd_bufptr = 0;
hva->hpc3_hdd_ctl = HPC3_HDD_CTL_EOCHAIN;
hva->hdd_descptr = 0;
@@ -199,8 +200,8 @@
uint32_t mode;
mode = bus_space_read_4(sc->sc_bst, sc->sc_bsh, sc->hpc->scsi0_ctl);
- bus_space_write_4(sc->sc_bst, sc->sc_bsh, sc->hpc->scsi0_ctl,
- mode | sc->hpc->scsi_dmactl_flush);
+ bus_space_write_4(sc->sc_bst, sc->sc_bsh,
+ sc->hpc->scsi0_ctl, mode | sc->hpc->scsi_dmactl_flush);
/* Wait for Active bit to drop */
while (bus_space_read_4(sc->sc_bst, sc->sc_bsh, sc->hpc->scsi0_ctl) &
diff -r be5531cfe8e6 -r 045a64a2d4a0 sys/arch/sgimips/hpc/wdsc.c
--- a/sys/arch/sgimips/hpc/wdsc.c Tue Jan 25 12:25:43 2011 +0000
+++ b/sys/arch/sgimips/hpc/wdsc.c Tue Jan 25 12:30:32 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wdsc.c,v 1.30 2011/01/25 12:14:02 tsutsui Exp $ */
+/* $NetBSD: wdsc.c,v 1.31 2011/01/25 12:30:32 tsutsui Exp $ */
/*
* Copyright (c) 2001 Wayne Knowles
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wdsc.c,v 1.30 2011/01/25 12:14:02 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wdsc.c,v 1.31 2011/01/25 12:30:32 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -77,19 +77,18 @@
};
-void wdsc_attach (device_t, device_t, void *);
-int wdsc_match (device_t, cfdata_t, void *);
+int wdsc_match(device_t, cfdata_t, void *);
+void wdsc_attach(device_t, device_t, void *);
CFATTACH_DECL_NEW(wdsc, sizeof(struct wdsc_softc),
wdsc_match, wdsc_attach, NULL, NULL);
-int wdsc_dmasetup (struct wd33c93_softc *, void ** ,size_t *,
- int, size_t *);
-int wdsc_dmago (struct wd33c93_softc *);
-void wdsc_dmastop (struct wd33c93_softc *);
-void wdsc_reset (struct wd33c93_softc *);
-int wdsc_dmaintr (void *);
-int wdsc_scsiintr (void *);
+int wdsc_dmasetup(struct wd33c93_softc *, void ** ,size_t *, int, size_t *);
+int wdsc_dmago(struct wd33c93_softc *);
+void wdsc_dmastop(struct wd33c93_softc *);
+void wdsc_reset(struct wd33c93_softc *);
+int wdsc_dmaintr(void *);
+int wdsc_scsiintr(void *);
/*
* Match for SCSI devices on the onboard and GIO32 adapter WD33C93 chips
@@ -110,26 +109,26 @@
asr = (asr + 3) & ~0x3;
if (platform.badaddr((void *)reset, sizeof(reset)))
- return (0);
+ return 0;
*(volatile uint32_t *)reset = haa->hpc_regs->scsi_dmactl_reset;
delay(1000);
*(volatile uint32_t *)reset = 0x0;
if (platform.badaddr((void *)asr, sizeof(asr)))
- return (0);
+ return 0;
reg = *(volatile uint32_t *)asr;
if (haa->hpc_regs->revision == 3) {
if ((reg & 0xff) == SBIC_ASR_INT)
- return (1);
+ return 1;
} else {
if (((reg >> 8) & 0xff) == SBIC_ASR_INT)
- return (1);
+ return 1;
}
}
- return (0);
+ return 0;
}
/*
@@ -161,13 +160,11 @@
return;
}
- if (bus_dmamap_create(wsc->sc_dmat,
- MAXPHYS,
- wsc->sc_hpcdma.hpc->scsi_dma_segs,
- wsc->sc_hpcdma.hpc->scsi_dma_segs_size,
- wsc->sc_hpcdma.hpc->scsi_dma_segs_size,
- BUS_DMA_WAITOK,
- &wsc->sc_dmamap) != 0) {
+ if (bus_dmamap_create(wsc->sc_dmat, MAXPHYS,
+ wsc->sc_hpcdma.hpc->scsi_dma_segs,
+ wsc->sc_hpcdma.hpc->scsi_dma_segs_size,
+ wsc->sc_hpcdma.hpc->scsi_dma_segs_size,
+ BUS_DMA_WAITOK, &wsc->sc_dmamap) != 0) {
printf(": failed to create dmamap\n");
return;
}
@@ -195,7 +192,6 @@
hpcdma_init(haa, &wsc->sc_hpcdma, wsc->sc_hpcdma.hpc->scsi_dma_segs);
wd33c93_attach(sc);
- return;
}
/*
@@ -204,7 +200,8 @@
* Requires splbio() interrupts to be disabled by the caller
*/
int
-wdsc_dmasetup(struct wd33c93_softc *sc, void **addr, size_t *len, int datain, size_t *dmasize)
+wdsc_dmasetup(struct wd33c93_softc *sc, void **addr, size_t *len, int datain,
+ size_t *dmasize)
{
struct wdsc_softc *wsc = (struct wdsc_softc *)sc;
struct hpc_dma_softc *dsc = &wsc->sc_hpcdma;
@@ -219,10 +216,9 @@
KASSERT((wsc->sc_flags & WDSC_DMA_MAPLOADED) == 0);
/* Build list of physical addresses for this transfer */
- if ((err=bus_dmamap_load(wsc->sc_dmat, wsc->sc_dmamap,
- vaddr, count,
- NULL /* kernel address */,
- BUS_DMA_NOWAIT)) != 0)
+ if ((err = bus_dmamap_load(wsc->sc_dmat, wsc->sc_dmamap,
+ vaddr, count, NULL /* kernel address */,
+ BUS_DMA_NOWAIT)) != 0)
panic("%s: bus_dmamap_load err=%d",
device_xname(sc->sc_dev), err);
@@ -239,7 +235,7 @@
dsc->sc_flags &= ~HPCDMA_READ;
}
}
- return(count);
+ return count;
}
/*
@@ -252,21 +248,21 @@
struct hpc_dma_softc *dsc = &wsc->sc_hpcdma;
if (dsc->sc_dlen == 0)
- return(0);
+ return 0;
KASSERT((wsc->sc_flags & WDSC_DMA_ACTIVE) == 0);
KASSERT((wsc->sc_flags & WDSC_DMA_MAPLOADED));
wsc->sc_flags |= WDSC_DMA_ACTIVE;
- bus_dmamap_sync(wsc->sc_dmat, wsc->sc_dmamap, 0,
- wsc->sc_dmamap->dm_mapsize,
- (dsc->sc_flags & HPCDMA_READ) ?
- BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE);
+ bus_dmamap_sync(wsc->sc_dmat, wsc->sc_dmamap,
+ 0, wsc->sc_dmamap->dm_mapsize,
+ (dsc->sc_flags & HPCDMA_READ) ?
+ BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE);
hpcdma_cntl(dsc, dsc->sc_dmacmd); /* Thunderbirds are go! */
- return(wsc->sc_dmamap->dm_mapsize);
+ return wsc->sc_dmamap->dm_mapsize;
}
/*
@@ -282,8 +278,8 @@
if (dsc->sc_flags & HPCDMA_READ)
hpcdma_flush(dsc);
hpcdma_cntl(dsc, 0); /* Stop DMA */
- bus_dmamap_sync(wsc->sc_dmat, wsc->sc_dmamap, 0,
- wsc->sc_dmamap->dm_mapsize,
+ bus_dmamap_sync(wsc->sc_dmat, wsc->sc_dmamap,
+ 0, wsc->sc_dmamap->dm_mapsize,
(dsc->sc_flags & HPCDMA_READ) ?
BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE);
}
@@ -317,5 +313,5 @@
found = wd33c93_intr(sc);
if (found)
wsc->sc_intrcnt.ev_count++;
- return(found);
+ return found;
}
Home |
Main Index |
Thread Index |
Old Index