diff options
author | Dale Rahn <drahn@cvs.openbsd.org> | 2003-10-18 16:26:07 +0000 |
---|---|---|
committer | Dale Rahn <drahn@cvs.openbsd.org> | 2003-10-18 16:26:07 +0000 |
commit | c608f265e4dc310823a27e7e368f2115f280ea6d (patch) | |
tree | b35a2199cdf539bbb9eabd5b73eb02b92491f162 /sys | |
parent | 9adf87ae5fcfb0bb4e02da572dc0c30b653f63de (diff) |
ANSI/KNF now that conflict has been resolved.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/macppc/dev/wdc_obio.c | 72 |
1 files changed, 24 insertions, 48 deletions
diff --git a/sys/arch/macppc/dev/wdc_obio.c b/sys/arch/macppc/dev/wdc_obio.c index 648eb20bbb5..e8baabac607 100644 --- a/sys/arch/macppc/dev/wdc_obio.c +++ b/sys/arch/macppc/dev/wdc_obio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wdc_obio.c,v 1.15 2003/10/17 08:14:09 grange Exp $ */ +/* $OpenBSD: wdc_obio.c,v 1.16 2003/10/18 16:26:06 drahn Exp $ */ /* $NetBSD: wdc_obio.c,v 1.15 2001/07/25 20:26:33 bouyer Exp $ */ /*- @@ -109,10 +109,7 @@ void wdc_obio_ata4_adjust_timing(struct channel_softc *); void wdc_obio_ata6_adjust_timing(struct channel_softc *); int -wdc_obio_probe(parent, match, aux) - struct device *parent; - void *match; - void *aux; +wdc_obio_probe(struct device *parent, void *match, void *aux) { struct confargs *ca = aux; char compat[32]; @@ -133,9 +130,7 @@ wdc_obio_probe(parent, match, aux) } void -wdc_obio_attach(parent, self, aux) - struct device *parent, *self; - void *aux; +wdc_obio_attach(struct device *parent, struct device *self, void *aux) { struct wdc_obio_softc *sc = (void *)self; struct confargs *ca = aux; @@ -179,8 +174,7 @@ wdc_obio_attach(parent, self, aux) if (bus_space_map(chp->cmd_iot, cmdbase, cmdsize, 0, &chp->cmd_ioh) || bus_space_subregion(chp->cmd_iot, chp->cmd_ioh, - /* WDC_AUXREG_OFFSET<<4 */ 0x160, 1, &chp->ctl_ioh)) - { + /* WDC_AUXREG_OFFSET<<4 */ 0x160, 1, &chp->ctl_ioh)) { printf("%s: couldn't map registers\n", sc->sc_wdcdev.sc_dev.dv_xname); return; @@ -189,7 +183,7 @@ wdc_obio_attach(parent, self, aux) chp->data32ioh = chp->cmd_ioh; mac_intr_establish(parent, intr, IST_LEVEL, IPL_BIO, wdcintr, chp, - "wdc_obio"); + "wdc_obio"); sc->sc_wdcdev.set_modes = wdc_obio_adjust_timing; if (use_dma) { @@ -226,7 +220,7 @@ wdc_obio_attach(parent, self, aux) chp->channel = 0; chp->wdc = &sc->sc_wdcdev; chp->ch_queue = malloc(sizeof(struct channel_queue), - M_DEVBUF, M_NOWAIT); + M_DEVBUF, M_NOWAIT); if (chp->ch_queue == NULL) { printf("%s: can't allocate memory for command queue", sc->sc_wdcdev.sc_dev.dv_xname); @@ -307,11 +301,8 @@ static u_int32_t kauai_udma_timing[] = { #define KAUAI_UDMA_MASK 0x0000ffff #define KAUAI_UDMA_EN 0x00000001 - - void -wdc_obio_adjust_timing(chp) - struct channel_softc *chp; +wdc_obio_adjust_timing(struct channel_softc *chp) { struct ata_drive_datas *drvp; u_int conf; @@ -320,17 +311,15 @@ wdc_obio_adjust_timing(chp) int min_cycle, min_active; int cycle_tick, act_tick, inact_tick, half_tick; - for (drive = 0; drive < 2; drive++) { drvp = &chp->ch_drive[drive]; if ((drvp->drive_flags & DRIVE) == 0) continue; if (piomode == -1 || piomode > drvp->PIO_mode) piomode = drvp->PIO_mode; - if (drvp->drive_flags & DRIVE_DMA) { + if (drvp->drive_flags & DRIVE_DMA) if (dmamode == -1 || dmamode > drvp->DMA_mode) dmamode = drvp->DMA_mode; - } } if (piomode == -1) return; /* No drive */ @@ -396,16 +385,14 @@ wdc_obio_ata4_adjust_timing(chp) continue; if (piomode == -1 || piomode > drvp->PIO_mode) piomode = drvp->PIO_mode; - if (drvp->drive_flags & DRIVE_DMA) { + if (drvp->drive_flags & DRIVE_DMA) if (dmamode == -1 || dmamode > drvp->DMA_mode) dmamode = drvp->DMA_mode; - } if (drvp->drive_flags & DRIVE_UDMA) { if (udmamode == -1 || udmamode > drvp->UDMA_mode) udmamode = drvp->UDMA_mode; - } else { + } else udmamode = -2; - } } if (piomode == -1) return; /* No drive */ @@ -416,11 +403,10 @@ wdc_obio_ata4_adjust_timing(chp) if (drvp->drive_flags & DRIVE_DMA) drvp->DMA_mode = dmamode; if (drvp->drive_flags & DRIVE_UDMA) { - if (udmamode == -2) { + if (udmamode == -2) drvp->drive_flags &= ~DRIVE_UDMA; - } else { + else drvp->UDMA_mode = udmamode; - } } } } @@ -486,9 +472,8 @@ wdc_obio_ata6_adjust_timing(struct channel_softc *chp) if (drvp->drive_flags & DRIVE_UDMA) { if (udmamode == -1 || udmamode > drvp->UDMA_mode) udmamode = drvp->UDMA_mode; - } else { + } else udmamode = -2; - } } if (piomode == -1) return; /* No drive */ @@ -499,11 +484,10 @@ wdc_obio_ata6_adjust_timing(struct channel_softc *chp) if (drvp->drive_flags & DRIVE_DMA) drvp->DMA_mode = dmamode; if (drvp->drive_flags & DRIVE_UDMA) { - if (udmamode == -2) { + if (udmamode == -2) drvp->drive_flags &= ~DRIVE_UDMA; - } else { + else drvp->UDMA_mode = udmamode; - } } } } @@ -520,13 +504,12 @@ wdc_obio_ata6_adjust_timing(struct channel_softc *chp) #endif conf = (conf & ~KAUAI_PIO_MASK) | kauai_pio_timing[piomode]; - if (dmamode != -1) { + if (dmamode != -1) conf = (conf & ~KAUAI_DMA_MASK) | kauai_dma_timing[dmamode]; - } - if (udmamode != -1) { + if (udmamode != -1) conf1 = (conf1 & ~KAUAI_UDMA_MASK) | kauai_udma_timing[udmamode] | KAUAI_UDMA_EN; - } else + else conf1 = conf1 & ~KAUAI_UDMA_EN; bus_space_write_4(chp->cmd_iot, chp->cmd_ioh, CONFIG_REG, conf); @@ -560,6 +543,7 @@ wdc_obio_dma_init(v, channel, drive, databuf, datalen, flags) if (i + 1 == sc->sc_dmamap->dm_nsegs) cmd = (flags & WDC_DMA_READ) ? DBDMA_CMD_IN_LAST : DBDMA_CMD_OUT_LAST; + DBDMA_BUILD(cmdp, cmd, 0, sc->sc_dmamap->dm_segs[i].ds_len, sc->sc_dmamap->dm_segs[i].ds_addr, DBDMA_INT_NEVER, DBDMA_WAIT_NEVER, DBDMA_BRANCH_NEVER); @@ -572,9 +556,7 @@ wdc_obio_dma_init(v, channel, drive, databuf, datalen, flags) } void -wdc_obio_dma_start(v, channel, drive) - void *v; - int channel, drive; +wdc_obio_dma_start(void *v, int channel, int drive) { struct wdc_obio_softc *sc = v; @@ -582,9 +564,7 @@ wdc_obio_dma_start(v, channel, drive) } int -wdc_obio_dma_finish(v, channel, drive, force) - void *v; - int channel, drive, force; +wdc_obio_dma_finish(void *v, int channel, int drive, int force) { struct wdc_obio_softc *sc = v; @@ -599,9 +579,8 @@ wdc_obio_dma_finish(v, channel, drive, force) */ u_int8_t -wdc_obio_read_reg(chp, reg) - struct channel_softc *chp; - enum wdc_regs reg; +wdc_obio_read_reg(struct channel_softc *chp, + enum wdc_regs reg) { #ifdef DIAGNOSTIC if (reg & _WDC_WRONLY) { @@ -619,10 +598,7 @@ wdc_obio_read_reg(chp, reg) void -wdc_obio_write_reg(chp, reg, val) - struct channel_softc *chp; - enum wdc_regs reg; - u_int8_t val; +wdc_obio_write_reg(struct channel_softc *chp, enum wdc_regs reg, u_int8_t val) { #ifdef DIAGNOSTIC if (reg & _WDC_RDONLY) { |