[Kos-dev] ATA & LBA : new experimentations

Christophe kos-dev@enix.org
Sat, 16 Feb 2002 12:07:53 +0100


Dis Thomas, est-ce que tu as reçu mon dernier email ? je t'ai dit de mettre
des parenthèses pour l'opérateur "? :"

là où tu as :
  outb(ATA_D_IBM
       | (harddisk->device == MASTER) ? ATA_MASTER : ATA_SLAVE
       | head,
       ctrl->ioaddr + ATA_DRIVE);
fais comme ceci :
  outb(ATA_D_IBM
       | ((harddisk->device == MASTER) ? ATA_MASTER : ATA_SLAVE)
       | head,
       ctrl->ioaddr + ATA_DRIVE);

Car je soupçonne que tu n'es pas en LBA parce que tu fais en fait :
... ? (ATA_MASTER) : (ATA_SLAVE|head);

Or comme tu utilises le MASTER, ben 'head' n'ai jamais pris en compte, et
donc le mode LBA non plus puisqu'il est porté par 'head'.

----- Original Message -----
From: <thomas.petazzoni@enix.org>
To: <sos@freebsd.dk>; <kos-dev@enix.org>
Sent: Tuesday, February 12, 2002 12:04 PM
Subject: [Kos-dev] ATA & LBA : new experimentations


> Hi,
>
> I made some experimentations about my problem concerning the use of
> LBA.
>
> First experimentation :
> -----------------------
> Instead of reading sector 0, and then reading sector 64, I did the
> following :
>  * read sector 0
>  * identify drive (to make sure there is something else in the
> controller buffer)
>  * read sector 64
>
> But read sector 64 still returned the contents of sector 0.
>
> Second experimentation :
> ------------------------
>
> I tested if the Error bit was set BEFORE sending the command, and it
> was set. So I added a software reset BEFORE sending the command. I
> don't know why exactly I need to reset the device, but it works much
> more better now.
>
> Then, AFTER sending the command (for a LBA read, for any sector,
> including sector 0), the Error bit is set, and the Error register is
> set to 0x10, which means IDNF : Requested Sector ID Not Found.
>
> That's strange because I have
>  sector = 0;
>  cyl_lo = 0;
>  cyl_hi = 0;
>  drive_head = 0xA0     | 0x40 | 0      | 0
>               SETBITS    LBA    HEAD 0   MASTER
>
> And it returns an error.
>
> Do you have any idea ?
>
> Note that on an other computer, without doing the reset BEFORE sending
> the command, it perfectly works.
>
> Thanks a lot,
>
> Thomas
>
> (code included interesting function is still add_ide_op_polled_mode,
> and get_partition_table to see the tests I make)


----------------------------------------------------------------------------
----


>
> --
> PETAZZONI Thomas - thomas.petazzoni@enix.org - UIN : 34937744
> (Perso)      http://www.enix.org/~thomas/
> (KOS)        http://kos.enix.org/
> (Club LinUT) http://club-linut.enix.org
>