Current-Users archive

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

Re: Ata & atapi bug



On 10/07/2012 08:44, David Laight wrote:
On Tue, Jul 10, 2012 at 01:47:43AM +0200, vanoven wrote:
Hi,
I got trouble booting with the last kernel on my old nc8000 laptop : my
ATA drive was not seen anymore while cdrom drive was.

after looking in source i found a problem in
/cvsroot/src/sys/dev/scsipi/atapi_wdc.c

with regard to this  diff

@@ -321,12 +321,12 @@ wdc_atapi_probe_device(struct atapibus_s
                         ata_probe_caps(drvp);
                 else {
                         s = splbio();
-                       drvp->drive_flags &= ~DRIVE_ATAPI;
+                       drvp->drive_type = DRIVET_NONE;
                         splx(s);
                 }
         } else {
                 s = splbio();
-               drvp->drive_flags &= ~DRIVE_ATAPI;
+               drvp->drive_type = DRIVET_NONE;
                 splx(s);
         }
  }

my harddrive is changed from DRIVET_ATA to DRIVET_NONE in the new version.
I add
     if ( drvp->drive_type == DRIVET_ATAPI )
             drvp->drive_type = DRIVET_NONE;
to fix that

Hope it can help.
Those two parts of the diff look like error paths - so shouldn't be relevant.
Exactly where did you add the code to set DRIVET_NONE?
Your CDROM will probably need DRIVET_ATAPI.

I applied a small change to the driver yesterday (patch from Manuel)
which fixes issues on a lot of other systems.
Does that one fix yours?

        David



I replace

drvp->drive_type = DRIVET_NONE;

in line 324 and 329 of atapi_wdc.c by

if ( drvp->drive_type == DRIVET_ATAPI )
            drvp->drive_type = DRIVET_NONE;


my ata drive and atapi cdrom go through wdc_atapi_probe_device() function
so my ide hard drive is changed to DRIVET_NONE by that error paths.


atapi devices are probed first in sys/dev/ata/ata.c

in function atabusconfig_thread(void *arg)

line 308: (*atac->atac_atapibus_attach)(atabus_sc);
 after that line my hdd get DRIVET_NONE

from
ch_drive : 0x0 , type = 0x1   (DRIVET_ATA)
ch_drive : 0x1 , type = 0x2   (DRIVET_ATAPI)
to
ch_drive : 0x0 , type = 0x0   (DRIVET_NONE)
ch_drive : 0x1 , type = 0x2   (DRIVET_ATAPI)


I guess that all devices in channel are probed by code in atapi_wdc.c ( 
config_found_ia() line 140 )

I tried the patch from Manuel to but it didn't work, i only have old ide drives 
in that laptop so i guess ahci stuff is not used here.








Home | Main Index | Thread Index | Old Index