diff options
author | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1999-08-05 00:12:10 +0000 |
---|---|---|
committer | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1999-08-05 00:12:10 +0000 |
commit | 1221573955242938639e9f35592683122de5f208 (patch) | |
tree | 44beaee27c809beda39a093847771d258ef0c0cb /sys/dev | |
parent | 62a3e8614928df4d912b63ccfb337bb715e1dcd3 (diff) |
Make IDE compile on alpha again:
use b* instead of mem* functions, adhere to NISADMA for DMA support.
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/ata/ata.c | 12 | ||||
-rw-r--r-- | sys/dev/ata/wd.c | 12 | ||||
-rw-r--r-- | sys/dev/ic/wdc.c | 10 | ||||
-rw-r--r-- | sys/dev/isa/wdc_isa.c | 22 |
4 files changed, 36 insertions, 20 deletions
diff --git a/sys/dev/ata/ata.c b/sys/dev/ata/ata.c index 08edbc41aa7..2594d801665 100644 --- a/sys/dev/ata/ata.c +++ b/sys/dev/ata/ata.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ata.c,v 1.1 1999/07/18 21:25:17 csapuntz Exp $ */ +/* $OpenBSD: ata.c,v 1.2 1999/08/05 00:12:09 niklas Exp $ */ /* $NetBSD: ata.c,v 1.9 1999/04/15 09:41:09 bouyer Exp $ */ /* * Copyright (c) 1998 Manuel Bouyer. All rights reserved. @@ -74,9 +74,9 @@ ata_get_params(drvp, flags, prms) WDCDEBUG_PRINT(("wdc_ata_get_parms\n"), DEBUG_FUNCS); - memset(tb, 0, DEV_BSIZE); - memset(prms, 0, sizeof(struct ataparams)); - memset(&wdc_c, 0, sizeof(struct wdc_command)); + bzero(tb, DEV_BSIZE); + bzero(prms, sizeof(struct ataparams)); + bzero(&wdc_c, sizeof(struct wdc_command)); if (drvp->drive_flags & DRIVE_ATA) { wdc_c.r_command = WDCC_IDENTIFY; @@ -107,7 +107,7 @@ ata_get_params(drvp, flags, prms) return CMD_ERR; } else { /* Read in parameter block. */ - memcpy(prms, tb, sizeof(struct ataparams)); + bcopy(tb, prms, sizeof(struct ataparams)); #if BYTE_ORDER == LITTLE_ENDIAN /* * Shuffle string byte order. @@ -146,7 +146,7 @@ ata_set_mode(drvp, mode, flags) struct wdc_command wdc_c; WDCDEBUG_PRINT(("wdc_ata_set_mode=0x%x\n", mode), DEBUG_FUNCS); - memset(&wdc_c, 0, sizeof(struct wdc_command)); + bzero(&wdc_c, sizeof(struct wdc_command)); wdc_c.r_command = SET_FEATURES; wdc_c.r_st_bmask = 0; diff --git a/sys/dev/ata/wd.c b/sys/dev/ata/wd.c index 0c845926f22..1c1c0e243ba 100644 --- a/sys/dev/ata/wd.c +++ b/sys/dev/ata/wd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wd.c,v 1.4 1999/07/22 04:36:47 deraadt Exp $ */ +/* $OpenBSD: wd.c,v 1.5 1999/08/05 00:12:09 niklas Exp $ */ /* $NetBSD: wd.c,v 1.193 1999/02/28 17:15:27 explorer Exp $ */ /* @@ -778,7 +778,7 @@ wdgetdefaultlabel(wd, lp) { WDCDEBUG_PRINT(("wdgetdefaultlabel\n"), DEBUG_FUNCS); - memset(lp, 0, sizeof(struct disklabel)); + bzero(lp, sizeof(struct disklabel)); lp->d_secsize = DEV_BSIZE; lp->d_ntracks = wd->sc_params.atap_heads; @@ -828,7 +828,7 @@ wdgetdisklabel(dev, wd, lp, clp, spoofonly) WDCDEBUG_PRINT(("wdgetdisklabel\n"), DEBUG_FUNCS); - memset(clp, 0, sizeof(struct cpu_disklabel)); + bzero(clp, sizeof(struct cpu_disklabel)); wdgetdefaultlabel(wd, lp); @@ -1293,7 +1293,7 @@ wd_flushcache(wd, flags) if (wd->drvp->ata_vers < 4) /* WDCC_FLUSHCACHE is here since ATA-4 */ return; - memset(&wdc_c, 0, sizeof(struct wdc_command)); + bzero(&wdc_c, sizeof(struct wdc_command)); wdc_c.r_command = WDCC_FLUSHCACHE; wdc_c.r_st_bmask = WDCS_DRDY; wdc_c.r_st_pmask = WDCS_DRDY; @@ -1337,7 +1337,7 @@ wi_get() int s; wi = malloc(sizeof(struct wd_ioctl), M_TEMP, M_WAITOK); - memset(wi, 0, sizeof (struct wd_ioctl)); + bzero(wi, sizeof (struct wd_ioctl)); s = splbio(); LIST_INSERT_HEAD(&wi_head, wi, wi_list); splx(s); @@ -1416,7 +1416,7 @@ wdioctlstrategy(bp) goto bad; } - memset(&wdc_c, 0, sizeof(wdc_c)); + bzero(&wdc_c, sizeof(wdc_c)); /* * Abort if physio broke up the transfer diff --git a/sys/dev/ic/wdc.c b/sys/dev/ic/wdc.c index 66d18d9f75b..73dd313768b 100644 --- a/sys/dev/ic/wdc.c +++ b/sys/dev/ic/wdc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wdc.c,v 1.7 1999/07/23 08:34:15 deraadt Exp $ */ +/* $OpenBSD: wdc.c,v 1.8 1999/08/05 00:12:09 niklas Exp $ */ /* $NetBSD: wdc.c,v 1.68 1999/06/23 19:00:17 bouyer Exp $ */ @@ -436,7 +436,7 @@ wdcattach(chp) * the config machinery will print * "atapibus at xxx not configured" */ - memset(&aa_link, 0, sizeof(struct ata_atapi_attach)); + bzero(&aa_link, sizeof(struct ata_atapi_attach)); aa_link.aa_type = T_ATAPI; aa_link.aa_channel = chp->channel; aa_link.aa_openings = 1; @@ -452,7 +452,7 @@ wdcattach(chp) (DRIVE_ATA | DRIVE_OLD)) == 0) { continue; } - memset(&aa_link, 0, sizeof(struct ata_atapi_attach)); + bzero(&aa_link, sizeof(struct ata_atapi_attach)); aa_link.aa_type = T_ATA; aa_link.aa_channel = chp->channel; aa_link.aa_openings = 1; @@ -822,7 +822,7 @@ wdc_probe_caps(drvp) */ drvp->drive_flags |= DRIVE_CAP32; ata_get_params(drvp, AT_POLL, ¶ms2); - if (memcmp(¶ms, ¶ms2, sizeof(struct ataparams)) != 0) { + if (bcmp(¶ms, ¶ms2, sizeof(struct ataparams)) != 0) { /* Not good. fall back to 16bits */ drvp->drive_flags &= ~DRIVE_CAP32; printf("16-bit"); @@ -1366,7 +1366,7 @@ wdc_get_xfer(flags) if ((xfer->c_flags & C_INUSE) != 0) panic("wdc_get_xfer: xfer already in use\n"); #endif - memset(xfer, 0, sizeof(struct wdc_xfer)); + bzero(xfer, sizeof(struct wdc_xfer)); xfer->c_flags = C_INUSE; return xfer; } diff --git a/sys/dev/isa/wdc_isa.c b/sys/dev/isa/wdc_isa.c index 3acb5e50113..f69d86e96a5 100644 --- a/sys/dev/isa/wdc_isa.c +++ b/sys/dev/isa/wdc_isa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wdc_isa.c,v 1.2 1999/07/22 04:32:38 csapuntz Exp $ */ +/* $OpenBSD: wdc_isa.c,v 1.3 1999/08/05 00:12:09 niklas Exp $ */ /* $NetBSD: wdc_isa.c,v 1.15 1999/05/19 14:41:25 bouyer Exp $ */ /*- @@ -52,6 +52,12 @@ #include <dev/ata/atavar.h> #include <dev/ic/wdcvar.h> +#ifdef __OpenBSD__ +#include "isadma.h" +#else +#define NISADMA 1 +#endif + #define WDC_ISA_REG_NPORTS 8 #define WDC_ISA_AUXREG_OFFSET 0x206 #define WDC_ISA_AUXREG_NPORTS 1 /* XXX "fdc" owns ports 0x3f7/0x377 */ @@ -82,10 +88,12 @@ struct cfattach wdc_isa_ca = { sizeof(struct wdc_isa_softc), wdc_isa_probe, wdc_isa_attach }; +#if NISADMA > 0 static void wdc_isa_dma_setup __P((struct wdc_isa_softc *)); static int wdc_isa_dma_init __P((void*, int, int, void *, size_t, int)); static void wdc_isa_dma_start __P((void*, int, int, int)); static int wdc_isa_dma_finish __P((void*, int, int, int)); +#endif /* NISADMA > 0 */ int wdc_isa_probe(parent, match, aux) @@ -97,10 +105,11 @@ wdc_isa_probe(parent, match, aux) #endif void *aux; { - struct channel_softc ch = { 0 }; + struct channel_softc ch; struct isa_attach_args *ia = aux; int result = 0; + bzero(&ch, sizeof ch); ch.cmd_iot = ia->ia_iot; if (bus_space_map(ch.cmd_iot, ia->ia_iobase, WDC_ISA_REG_NPORTS, 0, &ch.cmd_ioh)) @@ -157,6 +166,7 @@ wdc_isa_attach(parent, self, aux) IPL_BIO, wdcintr, &sc->wdc_channel); #endif if (ia->ia_drq != DRQUNK) { +#if NISADMA > 0 sc->sc_drq = ia->ia_drq; sc->sc_wdcdev.cap |= WDC_CAPABILITY_DMA; @@ -165,6 +175,10 @@ wdc_isa_attach(parent, self, aux) sc->sc_wdcdev.dma_start = wdc_isa_dma_start; sc->sc_wdcdev.dma_finish = wdc_isa_dma_finish; wdc_isa_dma_setup(sc); +#else /* NISADMA > 0 */ + printf("%s: ignoring drq, isa dma not supported", + sc->sc_wdcdev.sc_dev.dv_xname); +#endif /* NISADMA > 0 */ } sc->sc_wdcdev.cap |= WDC_CAPABILITY_DATA16 | WDC_CAPABILITY_PREATA; if (sc->sc_wdcdev.sc_dev.dv_cfdata->cf_flags & WDC_OPTIONS_32) @@ -179,13 +193,14 @@ wdc_isa_attach(parent, self, aux) M_DEVBUF, M_NOWAIT); if (sc->wdc_channel.ch_queue == NULL) { printf("%s: can't allocate memory for command queue", - sc->sc_wdcdev.sc_dev.dv_xname); + sc->sc_wdcdev.sc_dev.dv_xname); return; } wdcattach(&sc->wdc_channel); wdc_final_attach(&sc->wdc_channel); } +#if NISADMA > 0 static void wdc_isa_dma_setup(sc) struct wdc_isa_softc *sc; @@ -247,3 +262,4 @@ wdc_isa_dma_finish(v, channel, drive, read) #endif return 0; } +#endif /* NISADMA > 0 */ |