Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/scsipi Move a check for the drive type to the right ...



details:   https://anonhg.NetBSD.org/src/rev/9a91e265075e
branches:  trunk
changeset: 780625:9a91e265075e
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Tue Jul 31 15:59:57 2012 +0000

description:
Move a check for the drive type to the right place. This bug would cause
ATA drives to not be detected when the PATA (or emulated PATA) bus is shared
with an ATAPI device.
Should fix the problem reported by various peoples.
Thanks to Onno van der Linden and vanoven%free.fr@localhost for pointing out the
code in error.

diffstat:

 sys/dev/scsipi/atapi_wdc.c |  18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diffs (46 lines):

diff -r 0126d048c4e4 -r 9a91e265075e sys/dev/scsipi/atapi_wdc.c
--- a/sys/dev/scsipi/atapi_wdc.c        Tue Jul 31 15:50:31 2012 +0000
+++ b/sys/dev/scsipi/atapi_wdc.c        Tue Jul 31 15:59:57 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atapi_wdc.c,v 1.118 2012/07/31 15:50:37 bouyer Exp $   */
+/*     $NetBSD: atapi_wdc.c,v 1.119 2012/07/31 15:59:57 bouyer Exp $   */
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: atapi_wdc.c,v 1.118 2012/07/31 15:50:37 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: atapi_wdc.c,v 1.119 2012/07/31 15:59:57 bouyer Exp $");
 
 #ifndef ATADEBUG
 #define ATADEBUG
@@ -198,13 +198,6 @@
        struct ata_channel *chp = atac->atac_channels[chan->chan_channel];
        struct ata_command ata_c;
 
-       /* if no ATAPI device detected at wdc attach time, skip */
-       if (chp->ch_drive[drive].drive_type != ATA_DRIVET_ATAPI) {
-               ATADEBUG_PRINT(("wdc_atapi_get_params: drive %d not present\n",
-                   drive), DEBUG_PROBE);
-               return -1;
-       }
-
        memset(&ata_c, 0, sizeof(struct ata_command));
        ata_c.r_command = ATAPI_SOFT_RESET;
        ata_c.r_st_bmask = 0;
@@ -259,6 +252,13 @@
        if (scsipi_lookup_periph(chan, target, 0) != NULL)
                return;
 
+       /* if no ATAPI device detected at wdc attach time, skip */
+       if (drvp->drive_type != ATA_DRIVET_ATAPI) {
+               ATADEBUG_PRINT(("wdc_atapi_probe_device: "
+                   "drive %d not present\n", target), DEBUG_PROBE);
+               return;
+       }
+
        if (wdc_atapi_get_params(chan, target, id) == 0) {
 #ifdef ATAPI_DEBUG_PROBE
                printf("%s drive %d: cmdsz 0x%x drqtype 0x%x\n",



Home | Main Index | Thread Index | Old Index