summaryrefslogtreecommitdiff
path: root/sys/arch/macppc
diff options
context:
space:
mode:
authorMatthew Dempsky <matthew@cvs.openbsd.org>2011-05-09 22:33:55 +0000
committerMatthew Dempsky <matthew@cvs.openbsd.org>2011-05-09 22:33:55 +0000
commit15cd6a42ff78f176a0db39dfa7401274f1792bfc (patch)
tree69a950d47edcd44df04df75de2fe47d28c886f8c /sys/arch/macppc
parenta9b23f00f1cdf8ec5565371412b53af1247703da (diff)
Refactor queue allocation and initialization into a wdc_alloc_queue()
function, and let attachment code calls this rather than malloc(9). This prevents re-initialization of the queue in shared queue chipsets. Also, add wdc_free_queue() as a complementary function. Earlier version (without wdc_free_queue()) tested by sthen@ and Amit Kulkarni on various pciide(4) chips. ok dlg@
Diffstat (limited to 'sys/arch/macppc')
-rw-r--r--sys/arch/macppc/dev/wdc_obio.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/sys/arch/macppc/dev/wdc_obio.c b/sys/arch/macppc/dev/wdc_obio.c
index 4cffb247132..f289f35fbe6 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.28 2010/08/29 23:06:53 deraadt Exp $ */
+/* $OpenBSD: wdc_obio.c,v 1.29 2011/05/09 22:33:53 matthew Exp $ */
/* $NetBSD: wdc_obio.c,v 1.15 2001/07/25 20:26:33 bouyer Exp $ */
/*-
@@ -217,10 +217,9 @@ wdc_obio_attach(struct device *parent, struct device *self, void *aux)
chp->channel = 0;
chp->wdc = &sc->sc_wdcdev;
- chp->ch_queue = malloc(sizeof(struct channel_queue), M_DEVBUF,
- M_NOWAIT);
+ chp->ch_queue = wdc_alloc_queue();
if (chp->ch_queue == NULL) {
- printf("%s: can't allocate memory for command queue",
+ printf("%s: cannot allocate channel queue",
sc->sc_wdcdev.sc_dev.dv_xname);
return;
}
@@ -240,7 +239,7 @@ wdc_obio_detach(struct device *self, int flags)
if ((error = wdcdetach(chp, flags)) != 0)
return (error);
- free(chp->ch_queue, M_DEVBUF);
+ wdc_free_queue(chp->ch_queue);
if (sc->sc_use_dma) {
unmapiodev((void *)sc->sc_dmareg, sc->sc_dmasize);