| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: siisata.c,v 1.30.4.35 2017/08/12 22:12:04 jdolecek Exp $ */ | | 1 | /* $NetBSD: siisata.c,v 1.30.4.36 2017/08/15 20:12:28 jakllsch Exp $ */ |
2 | | | 2 | |
3 | /* from ahcisata_core.c */ | | 3 | /* from ahcisata_core.c */ |
4 | | | 4 | |
5 | /* | | 5 | /* |
6 | * Copyright (c) 2006 Manuel Bouyer. | | 6 | * Copyright (c) 2006 Manuel Bouyer. |
7 | * | | 7 | * |
8 | * Redistribution and use in source and binary forms, with or without | | 8 | * Redistribution and use in source and binary forms, with or without |
9 | * modification, are permitted provided that the following conditions | | 9 | * modification, are permitted provided that the following conditions |
10 | * are met: | | 10 | * are met: |
11 | * 1. Redistributions of source code must retain the above copyright | | 11 | * 1. Redistributions of source code must retain the above copyright |
12 | * notice, this list of conditions and the following disclaimer. | | 12 | * notice, this list of conditions and the following disclaimer. |
13 | * 2. Redistributions in binary form must reproduce the above copyright | | 13 | * 2. Redistributions in binary form must reproduce the above copyright |
14 | * notice, this list of conditions and the following disclaimer in the | | 14 | * notice, this list of conditions and the following disclaimer in the |
| @@ -69,27 +69,27 @@ | | | @@ -69,27 +69,27 @@ |
69 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | | 69 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
70 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | | 70 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
71 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | | 71 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
72 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | | 72 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
73 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | | 73 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
74 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | | 74 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
75 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | | 75 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
76 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | | 76 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
77 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | | 77 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
78 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | 78 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
79 | */ | | 79 | */ |
80 | | | 80 | |
81 | #include <sys/cdefs.h> | | 81 | #include <sys/cdefs.h> |
82 | __KERNEL_RCSID(0, "$NetBSD: siisata.c,v 1.30.4.35 2017/08/12 22:12:04 jdolecek Exp $"); | | 82 | __KERNEL_RCSID(0, "$NetBSD: siisata.c,v 1.30.4.36 2017/08/15 20:12:28 jakllsch Exp $"); |
83 | | | 83 | |
84 | #include <sys/types.h> | | 84 | #include <sys/types.h> |
85 | #include <sys/param.h> | | 85 | #include <sys/param.h> |
86 | #include <sys/kernel.h> | | 86 | #include <sys/kernel.h> |
87 | #include <sys/malloc.h> | | 87 | #include <sys/malloc.h> |
88 | #include <sys/systm.h> | | 88 | #include <sys/systm.h> |
89 | #include <sys/syslog.h> | | 89 | #include <sys/syslog.h> |
90 | #include <sys/disklabel.h> | | 90 | #include <sys/disklabel.h> |
91 | #include <sys/buf.h> | | 91 | #include <sys/buf.h> |
92 | #include <sys/proc.h> | | 92 | #include <sys/proc.h> |
93 | | | 93 | |
94 | #include <dev/ata/atareg.h> | | 94 | #include <dev/ata/atareg.h> |
95 | #include <dev/ata/satavar.h> | | 95 | #include <dev/ata/satavar.h> |
| @@ -416,27 +416,28 @@ siisata_detach(struct siisata_softc *sc, | | | @@ -416,27 +416,28 @@ siisata_detach(struct siisata_softc *sc, |
416 | if ((error = config_detach(chp->atabus, flags)) != 0) | | 416 | if ((error = config_detach(chp->atabus, flags)) != 0) |
417 | return error; | | 417 | return error; |
418 | | | 418 | |
419 | for (j = 0; j < SIISATA_MAX_SLOTS; j++) | | 419 | for (j = 0; j < SIISATA_MAX_SLOTS; j++) |
420 | bus_dmamap_destroy(sc->sc_dmat, schp->sch_datad[j]); | | 420 | bus_dmamap_destroy(sc->sc_dmat, schp->sch_datad[j]); |
421 | | | 421 | |
422 | bus_dmamap_unload(sc->sc_dmat, schp->sch_prbd); | | 422 | bus_dmamap_unload(sc->sc_dmat, schp->sch_prbd); |
423 | bus_dmamap_destroy(sc->sc_dmat, schp->sch_prbd); | | 423 | bus_dmamap_destroy(sc->sc_dmat, schp->sch_prbd); |
424 | bus_dmamem_unmap(sc->sc_dmat, schp->sch_prb[0], | | 424 | bus_dmamem_unmap(sc->sc_dmat, schp->sch_prb[0], |
425 | SIISATA_CMD_SIZE * SIISATA_MAX_SLOTS); | | 425 | SIISATA_CMD_SIZE * SIISATA_MAX_SLOTS); |
426 | bus_dmamem_free(sc->sc_dmat, | | 426 | bus_dmamem_free(sc->sc_dmat, |
427 | &schp->sch_prb_seg, schp->sch_prb_nseg); | | 427 | &schp->sch_prb_seg, schp->sch_prb_nseg); |
428 | | | 428 | |
429 | free(chp->ch_queue, M_DEVBUF); | | 429 | ata_queue_free(chp->ch_queue); |
| | | 430 | chp->ch_queue = NULL; |
430 | chp->atabus = NULL; | | 431 | chp->atabus = NULL; |
431 | | | 432 | |
432 | ata_channel_detach(chp); | | 433 | ata_channel_detach(chp); |
433 | } | | 434 | } |
434 | | | 435 | |
435 | if (adapt->adapt_refcnt != 0) | | 436 | if (adapt->adapt_refcnt != 0) |
436 | return EBUSY; | | 437 | return EBUSY; |
437 | | | 438 | |
438 | /* leave the chip in reset */ | | 439 | /* leave the chip in reset */ |
439 | GRWRITE(sc, GR_GC, GR_GC_GLBLRST); | | 440 | GRWRITE(sc, GR_GC, GR_GC_GLBLRST); |
440 | | | 441 | |
441 | return 0; | | 442 | return 0; |
442 | } | | 443 | } |