Skip to contentSkip to conversation

ata.c and sata disks

PATCH MarcoVega Trucillo 4 participants 8 messages May 3, 2008 – Aug 5, 2008

lore
Share & tools
lore
#0 lore raw

Hi to all,

I tried to modify ata.c simply add more ioaddress (I attach the diff file from 1.96 version), and it work and recognize
my four sata disk on different pc. If I try to change sata port, the name of device on grub change because it depend by index of ioaddress in grub_ata_io_address array.
There is some reason because ata.c currently report thar support "only two ide drives" ? the driver seems work well... I can read file for my partition, and then boot linux and even windows with chainloader. (i.e.:
chailoader (ata4,1)+1 and boot)

and forgive me if I write something of stupid...
bye
Marco

ata.c~ 2008-05-03 18:06:15.000000000 +0200 renamed from ata.c 2008-05-03 19:30:37.000000000 +0200 +0 -3
@@ -32,11 +32,9 @@
     GRUB_ATA_LBA48
   } grub_ata_addressing_t;
 
-
-/* try address of commons sata controller */
-static const int grub_ata_ioaddress[] = {0x1f0, 0x170

,0x9800,0x9000,0x8800,0x18f8,0x18f0};
-static const int grub_ata_ioaddress2[] = {0x3f6, 0x376,0x9402,0x8802,0x8402,0x18ce,0x18ca};
-
+/* At the moment, only two IDE ports are supported. */ +static const int grub_ata_ioaddress[] = { 0x1f0, 0x170 }; +static const int grub_ata_ioaddress2[] = { 0x3f6, 0x376 };

#define GRUB_CDROM_SECTOR_SIZE 2048

@@ -338,7 +336,7 @@
int port;
int device;

- for (port = 0; port <= 6; port++)
+ for (port = 0; port <= 1; port++)

     {
       for (device = 0; device <= 1; device++)
        {
#1 lore raw
Quoted 5 lines · Marco Vega Trucillo

Hi to all,

I tried to modify ata.c simply add more ioaddress (I attach the diff file from 1.96 version), and it work and recognize
my four sata disk on different pc.

I think it's generally considered unsafe to probe addresses above 0x3ff without making sure they belong to a compatible device. The device should be found on the PCI bus, and enabled if necessary.

Quoted 3 lines
ata.c~ 2008-05-03 18:06:15.000000000 +0200 renamed from ata.c 2008-05-03 19:30:37.000000000 +0200 +0 -2
-/* try address of commons sata controller */
-static const int grub_ata_ioaddress[] = {0x1f0, 0x170

,0x9800,0x9000,0x8800,0x18f8,0x18f0};

Your patch is reversed. Also, it would be better to make a patch against the current CVS version.

Review

Quoted 2 lines
(quoted diff) +1 -1
-  for (port = 0; port <= 6; port++)
+  for (port = 0; port <= 1; port++)

Using sizeof would be great here. Unless we switch to using a dynamic list of interface.

Signature · 2 lines
Regards,
Pavel Roskin
#2 lore raw
Quoted 10 lines · Pavel Roskin
Quoted 5 lines · Marco Vega Trucillo

Hi to all,

I tried to modify ata.c simply add more ioaddress (I attach the diff file from 1.96 version), and it work and recognize
my four sata disk on different pc.

I think it's generally considered unsafe to probe addresses above 0x3ff without making sure they belong to a compatible device. The device should be found on the PCI bus, and enabled if necessary.

Marco Gerards sent a patch to add PCI support to ata.c, but it had some bugs that nobody has looked into yet.

Marco (Vega), if you want to help us, you could look at his patch (it's in the list archives) and see what needs to be done with it?

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)
#3 lore raw
Quoted 1 line · Robert Millan

Marco Gerards sent a patch to add PCI support to ata.c, but it had some

bugs that nobody has looked into yet.

Just few hors ago I've made a patch that probes pci bus for ide/ada devices (I've calles the iterate function in pci.h/pci.c) and it seems work well... I will take a look to Marco Gerards's patch. :) Marco

#4 lore raw

Re: PCI+ATA

I've realised a similar patch there are some difference:

Marco Gerards check if this class and subclass ID matches that of a PCI IDE Controller.
I instead check only class so I recognize even my sata disk that have the same class of PCI IDE Controller but different subclass (for example 0x04 and 0x00).
Marco Gerards try to indentify devices only on address of 0x10 and 0x14 registers (BAR0 and BAR1)... I scan even 0x18 and 0x1c registers (BAR2 and BAR3).

The remaining code is very similar.
I read that someone had problems of hangs: neither I nor Gerars changed the access code to the device but only recognition. For now about my two hardware I did not have hangs (on both I have 3 drive, two in fake-raid and one single, and I recognize and access all of three).

forgive me again for my bad english.

#5 lore raw
In reply to MarcoVega Trucillo
Quoted 5 lines · Marco "Vega" Trucillo
Quoted 1 line · Robert Millan

Marco Gerards sent a patch to add PCI support to ata.c, but it had some

bugs that nobody has looked into yet.

I looked on Gerard's code and seems that if there is bug is it on original code of ata.c not in patch. However I've not tried yet Gerard's pach beacuse I can't now, I only looked his code and
compared with my. My code is still very disorganised
(http://62.123.21.220/ata.c). I think that
tomorrow I'll try to modify Gerard's code that is written well.

#6 lore raw
Quoted 8 lines · Marco "Vega" Trucillo
Quoted 5 lines · Marco "Vega" Trucillo
Quoted 1 line · Robert Millan

Marco Gerards sent a patch to add PCI support to ata.c, but it had some

bugs that nobody has looked into yet.

Quoted 6 lines

I looked on Gerard's code and seems that if there is bug is it on original code of ata.c not in patch. However I've not tried yet Gerard's pach beacuse I can't now, I only looked his code and
compared with my. My code is still very disorganised
(http://62.123.21.220/ata.c). I think that
tomorrow I'll try to modify Gerard's code that is written well.

How about this:

First I commit my patch. This might break some things, but OTOH, people can work on this. In the current state, it would be better to break ATA to make it right than leaving it as it currently is.

Any objections to this?

--
Marco

#7 lore raw
In reply to MarcoVega Trucillo

Hi Marco,

Quoted 5 lines · Marco "Vega" Trucillo
Quoted 3 lines · Marco "Vega" Trucillo
Quoted 1 line · Robert Millan

Marco Gerards sent a patch to add PCI support to ata.c, but it had some

Quoted 8 lines
Quoted 1 line

bugs that nobody has looked into yet.

I looked on Gerard's code and seems that if there is bug is it on original code of ata.c not in patch. However I've not tried yet Gerard's pach beacuse I can't now, I only looked his code and
compared with my. My code is still very disorganised
(http://62.123.21.220/ata.c). I think that
tomorrow I'll try to modify Gerard's code that is written well.

Did you find the time to have a look? :-)

I just committed my PCI+ATA code, so people can actually to continue to work on this.

Thanks,
Marco