diff options
| author | jdolecek <jdolecek@NetBSD.org> | 2017-10-20 07:06:05 +0000 |
|---|---|---|
| committer | jdolecek <jdolecek@NetBSD.org> | 2017-10-20 07:06:05 +0000 |
| commit | a1bf30e8664357bafc3ccae2f9fd0a82b80da38d (patch) | |
| tree | bbe67330ed63b1c91a85eaa6f8e1a5164678e218 /sys/dev/pci | |
| parent | ad78d490fdb1c20addcc0d39920b7609a2133ad9 (diff) | |
move ata_queue_alloc(1) and ata_queue_free() calls to ata_channel_init()
and ata_channel_destroy() respectively, to make attachment code simpler,
and to make it easier to spot special queue manipulation like cmdide(4)
on topic of PR kern/52606
Diffstat (limited to 'sys/dev/pci')
| -rw-r--r-- | sys/dev/pci/artsata.c | 12 | ||||
| -rw-r--r-- | sys/dev/pci/cmdide.c | 19 | ||||
| -rw-r--r-- | sys/dev/pci/cypide.c | 12 | ||||
| -rw-r--r-- | sys/dev/pci/pciide_common.c | 15 | ||||
| -rw-r--r-- | sys/dev/pci/pdcsata.c | 13 | ||||
| -rw-r--r-- | sys/dev/pci/satalink.c | 12 | ||||
| -rw-r--r-- | sys/dev/pci/viaide.c | 12 |
7 files changed, 21 insertions, 74 deletions
diff --git a/sys/dev/pci/artsata.c b/sys/dev/pci/artsata.c index b0e305f54f2..12dd6ca4aa6 100644 --- a/sys/dev/pci/artsata.c +++ b/sys/dev/pci/artsata.c @@ -1,4 +1,4 @@ -/* $NetBSD: artsata.c,v 1.27 2017/10/07 16:05:33 jdolecek Exp $ */ +/* $NetBSD: artsata.c,v 1.28 2017/10/20 07:06:08 jdolecek Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: artsata.c,v 1.27 2017/10/07 16:05:33 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: artsata.c,v 1.28 2017/10/20 07:06:08 jdolecek Exp $"); #include "opt_pciide.h" @@ -231,13 +231,7 @@ artisea_chansetup(struct pciide_softc *sc, int channel, cp->name = PCIIDE_CHANNEL_NAME(channel); cp->ata_channel.ch_channel = channel; cp->ata_channel.ch_atac = &sc->sc_wdcdev.sc_atac; - cp->ata_channel.ch_queue = ata_queue_alloc(1); - if (cp->ata_channel.ch_queue == NULL) { - aprint_error("%s %s channel: " - "can't allocate memory for command queue", - device_xname(sc->sc_wdcdev.sc_atac.atac_dev), cp->name); - return 0; - } + return 1; } diff --git a/sys/dev/pci/cmdide.c b/sys/dev/pci/cmdide.c index 508890a3fc8..e26808a7972 100644 --- a/sys/dev/pci/cmdide.c +++ b/sys/dev/pci/cmdide.c @@ -1,4 +1,4 @@ -/* $NetBSD: cmdide.c,v 1.40 2017/10/19 20:11:38 jdolecek Exp $ */ +/* $NetBSD: cmdide.c,v 1.41 2017/10/20 07:06:08 jdolecek Exp $ */ /* * Copyright (c) 1999, 2000, 2001 Manuel Bouyer. @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: cmdide.c,v 1.40 2017/10/19 20:11:38 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cmdide.c,v 1.41 2017/10/20 07:06:08 jdolecek Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -154,14 +154,9 @@ cmd_channel_map(const struct pci_attach_args *pa, struct pciide_softc *sc, cp->ata_channel.ch_queue = sc->pciide_channels[0].ata_channel.ch_queue; } else { + /* XXX */ cp->ata_channel.ch_queue = ata_queue_alloc(1); } - if (cp->ata_channel.ch_queue == NULL) { - aprint_error("%s %s channel: " - "can't allocate memory for command queue", - device_xname(sc->sc_wdcdev.sc_atac.atac_dev), cp->name); - return; - } aprint_normal_dev(sc->sc_wdcdev.sc_atac.atac_dev, "%s channel %s to %s mode%s\n", cp->name, @@ -510,14 +505,6 @@ cmd680_channel_map(const struct pci_attach_args *pa, struct pciide_softc *sc, cp->ata_channel.ch_channel = channel; cp->ata_channel.ch_atac = &sc->sc_wdcdev.sc_atac; - cp->ata_channel.ch_queue = ata_queue_alloc(1); - if (cp->ata_channel.ch_queue == NULL) { - aprint_error("%s %s channel: " - "can't allocate memory for command queue", - device_xname(sc->sc_wdcdev.sc_atac.atac_dev), cp->name); - return; - } - /* XXX */ reg = 0xa2 + channel * 16; for (i = 0; i < sizeof(init_val); i++) diff --git a/sys/dev/pci/cypide.c b/sys/dev/pci/cypide.c index 5f013e80866..b05df6d39c5 100644 --- a/sys/dev/pci/cypide.c +++ b/sys/dev/pci/cypide.c @@ -1,4 +1,4 @@ -/* $NetBSD: cypide.c,v 1.31 2017/10/07 16:05:33 jdolecek Exp $ */ +/* $NetBSD: cypide.c,v 1.32 2017/10/20 07:06:08 jdolecek Exp $ */ /* * Copyright (c) 1999, 2000, 2001 Manuel Bouyer. @@ -26,7 +26,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: cypide.c,v 1.31 2017/10/07 16:05:33 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cypide.c,v 1.32 2017/10/20 07:06:08 jdolecek Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -148,13 +148,7 @@ cy693_chip_map(struct pciide_softc *sc, const struct pci_attach_args *pa) cp->name = PCIIDE_CHANNEL_NAME(0); cp->ata_channel.ch_channel = 0; cp->ata_channel.ch_atac = &sc->sc_wdcdev.sc_atac; - cp->ata_channel.ch_queue = ata_queue_alloc(1); - if (cp->ata_channel.ch_queue == NULL) { - aprint_error("%s primary channel: " - "can't allocate memory for command queue", - device_xname(sc->sc_wdcdev.sc_atac.atac_dev)); - return; - } + aprint_normal_dev(sc->sc_wdcdev.sc_atac.atac_dev, "primary channel %s to ", (interface & PCIIDE_INTERFACE_SETTABLE(0)) ? diff --git a/sys/dev/pci/pciide_common.c b/sys/dev/pci/pciide_common.c index ab7a215d621..665d6ae238b 100644 --- a/sys/dev/pci/pciide_common.c +++ b/sys/dev/pci/pciide_common.c @@ -1,4 +1,4 @@ -/* $NetBSD: pciide_common.c,v 1.64 2017/10/17 18:52:50 jdolecek Exp $ */ +/* $NetBSD: pciide_common.c,v 1.65 2017/10/20 07:06:08 jdolecek Exp $ */ /* @@ -70,7 +70,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pciide_common.c,v 1.64 2017/10/17 18:52:50 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pciide_common.c,v 1.65 2017/10/20 07:06:08 jdolecek Exp $"); #include <sys/param.h> @@ -208,9 +208,6 @@ pciide_common_detach(struct pciide_softc *sc, int flags) pciide_dma_table_teardown(sc, channel, drive); #endif } - - ata_queue_free(cp->ata_channel.ch_queue); - cp->ata_channel.atabus = NULL; } #if NATA_DMA @@ -877,13 +874,7 @@ pciide_chansetup(struct pciide_softc *sc, int channel, pcireg_t interface) cp->name = PCIIDE_CHANNEL_NAME(channel); cp->ata_channel.ch_channel = channel; cp->ata_channel.ch_atac = &sc->sc_wdcdev.sc_atac; - cp->ata_channel.ch_queue = ata_queue_alloc(1); - if (cp->ata_channel.ch_queue == NULL) { - aprint_error("%s %s channel: " - "can't allocate memory for command queue", - device_xname(sc->sc_wdcdev.sc_atac.atac_dev), cp->name); - return 0; - } + aprint_verbose_dev(sc->sc_wdcdev.sc_atac.atac_dev, "%s channel %s to %s mode\n", cp->name, (interface & PCIIDE_INTERFACE_SETTABLE(channel)) ? diff --git a/sys/dev/pci/pdcsata.c b/sys/dev/pci/pdcsata.c index bda379dbe86..25c2dd3353b 100644 --- a/sys/dev/pci/pdcsata.c +++ b/sys/dev/pci/pdcsata.c @@ -1,4 +1,4 @@ -/* $NetBSD: pdcsata.c,v 1.28 2017/10/07 16:05:33 jdolecek Exp $ */ +/* $NetBSD: pdcsata.c,v 1.29 2017/10/20 07:06:08 jdolecek Exp $ */ /* * Copyright (c) 2004, Manuel Bouyer. @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pdcsata.c,v 1.28 2017/10/07 16:05:33 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pdcsata.c,v 1.29 2017/10/20 07:06:08 jdolecek Exp $"); #include <sys/types.h> #include <sys/param.h> @@ -374,14 +374,7 @@ pdcsata_chip_map(struct pciide_softc *sc, const struct pci_attach_args *pa) cp->name = NULL; cp->ata_channel.ch_channel = channel; cp->ata_channel.ch_atac = &sc->sc_wdcdev.sc_atac; - cp->ata_channel.ch_queue = ata_queue_alloc(1); - if (cp->ata_channel.ch_queue == NULL) { - aprint_error("%s channel %d: " - "can't allocate memory for command queue\n", - device_xname(sc->sc_wdcdev.sc_atac.atac_dev), - channel); - goto next_channel; - } + wdc_cp = &cp->ata_channel; wdr = CHAN_TO_WDC_REGS(wdc_cp); diff --git a/sys/dev/pci/satalink.c b/sys/dev/pci/satalink.c index c25a4aaa50d..7554c52cee1 100644 --- a/sys/dev/pci/satalink.c +++ b/sys/dev/pci/satalink.c @@ -1,4 +1,4 @@ -/* $NetBSD: satalink.c,v 1.54 2017/10/07 16:05:33 jdolecek Exp $ */ +/* $NetBSD: satalink.c,v 1.55 2017/10/20 07:06:08 jdolecek Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: satalink.c,v 1.54 2017/10/07 16:05:33 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: satalink.c,v 1.55 2017/10/20 07:06:08 jdolecek Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -600,13 +600,7 @@ sii3114_chansetup(struct pciide_softc *sc, int channel) cp->name = channel_names[channel]; cp->ata_channel.ch_channel = channel; cp->ata_channel.ch_atac = &sc->sc_wdcdev.sc_atac; - cp->ata_channel.ch_queue = ata_queue_alloc(1); - if (cp->ata_channel.ch_queue == NULL) { - aprint_error("%s %s channel: " - "can't allocate memory for command queue", - device_xname(sc->sc_wdcdev.sc_atac.atac_dev), cp->name); - return (0); - } + return (1); } diff --git a/sys/dev/pci/viaide.c b/sys/dev/pci/viaide.c index 036d21d8cc6..baba8a7cf18 100644 --- a/sys/dev/pci/viaide.c +++ b/sys/dev/pci/viaide.c @@ -1,4 +1,4 @@ -/* $NetBSD: viaide.c,v 1.85 2017/10/07 16:05:33 jdolecek Exp $ */ +/* $NetBSD: viaide.c,v 1.86 2017/10/20 07:06:08 jdolecek Exp $ */ /* * Copyright (c) 1999, 2000, 2001 Manuel Bouyer. @@ -26,7 +26,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: viaide.c,v 1.85 2017/10/07 16:05:33 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: viaide.c,v 1.86 2017/10/20 07:06:08 jdolecek Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -1070,13 +1070,7 @@ via_vt6421_chansetup(struct pciide_softc *sc, int channel) cp->ata_channel.ch_channel = channel; cp->ata_channel.ch_atac = &sc->sc_wdcdev.sc_atac; - cp->ata_channel.ch_queue = ata_queue_alloc(1); - if (cp->ata_channel.ch_queue == NULL) { - aprint_error("%s channel %d: " - "can't allocate memory for command queue", - device_xname(sc->sc_wdcdev.sc_atac.atac_dev), channel); - return 0; - } + return 1; } |
