Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/macppc/dev - only unmap / free dbdma stuff when we ...
details: https://anonhg.NetBSD.org/src/rev/b82e3f5a36be
branches: trunk
changeset: 346505:b82e3f5a36be
user: macallan <macallan%NetBSD.org@localhost>
date: Fri Jul 15 21:11:12 2016 +0000
description:
- only unmap / free dbdma stuff when we actually mapped / allocated it
- use dbdma_free
now wdc_obio_detach() actually works without crashing
diffstat:
sys/arch/macppc/dev/wdc_obio.c | 21 +++++++++++++--------
1 files changed, 13 insertions(+), 8 deletions(-)
diffs (71 lines):
diff -r 675cd16a67f1 -r b82e3f5a36be sys/arch/macppc/dev/wdc_obio.c
--- a/sys/arch/macppc/dev/wdc_obio.c Fri Jul 15 21:08:27 2016 +0000
+++ b/sys/arch/macppc/dev/wdc_obio.c Fri Jul 15 21:11:12 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wdc_obio.c,v 1.58 2012/07/31 15:50:33 bouyer Exp $ */
+/* $NetBSD: wdc_obio.c,v 1.59 2016/07/15 21:11:12 macallan Exp $ */
/*-
* Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -30,12 +30,12 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wdc_obio.c,v 1.58 2012/07/31 15:50:33 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wdc_obio.c,v 1.59 2016/07/15 21:11:12 macallan Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
#include <uvm/uvm_extern.h>
@@ -72,7 +72,7 @@
dbdma_regmap_t *sc_dmareg;
dbdma_command_t *sc_dmacmd;
u_int sc_dmaconf[2]; /* per target value of CONFIG_REG */
- void *sc_ih;
+ void *sc_ih, *sc_dma;
};
static int wdc_obio_match(device_t, cfdata_t, void *);
@@ -182,7 +182,8 @@
sc->sc_ih = intr_establish(intr, type, IPL_BIO, wdcintr, chp);
if (use_dma) {
- sc->sc_dmacmd = dbdma_alloc(sizeof(dbdma_command_t) * 20);
+ sc->sc_dmacmd = dbdma_alloc(sizeof(dbdma_command_t) * 20,
+ &sc->sc_dma);
/*
* XXX
* we don't use ca->ca_reg[3] for size here because at least
@@ -223,10 +224,11 @@
} else {
/* all non-DMA controllers can use adjust_timing */
sc->sc_wdcdev.sc_atac.atac_set_modes = adjust_timing;
+ sc->sc_dmacmd = NULL;
}
sc->sc_wdcdev.sc_atac.atac_pio_cap = 4;
- sc->sc_wdcdev.sc_atac.atac_cap |= ATAC_CAP_DATA16;
+ sc->sc_wdcdev.sc_atac.atac_cap |= ATAC_CAP_DATA16 /*| ATAC_CAP_DATA32*/;
sc->sc_chanptr = chp;
sc->sc_wdcdev.sc_atac.atac_channels = &sc->sc_chanptr;
sc->sc_wdcdev.sc_atac.atac_nchannels = 1;
@@ -453,9 +455,12 @@
sc->sc_wdcdev.regs->cmd_baseioh, WDC_REG_NPORTS << 4);
/* Unmap DMA registers. */
- bus_space_unmap(sc->sc_wdcdev.regs->cmd_iot, sc->sc_dmaregh, 0x100);
- free(sc->sc_dmacmd, M_DEVBUF);
+ if (sc->sc_dmacmd != NULL) {
+ bus_space_unmap(sc->sc_wdcdev.regs->cmd_iot,
+ sc->sc_dmaregh, 0x100);
+ dbdma_free(sc->sc_dma, sizeof(dbdma_command_t) * 20);
+ }
return 0;
}
Home |
Main Index |
Thread Index |
Old Index