I forget to attach patches

Le jeudi 24 octobre 2013 15:56:15 Alexandre Martins a écrit :
> Dear,
> 
> We have seen some issues with the VIA VX900 chipset. The main trouble is
> that some SATA hard drive are not seen by the kernel (BIOS and boot-loader
> are OK).
> 
> After investigations, it seems that during the initialisation of the
> controler, some reset commands are send via "ata_via_sata_reset" fonction.
> Into the chipset documentation, there is a warning about successive reset
> commands, and software must waiting the "BUSY" flag is clear, before send
> another reset. I have added a "DELAY(10000)" between the second call of
> "ata_sata_phy_reset" and the call of "ata_generic_reset" and the problem
> disapear.
> 
> I also made a more complex fix which check the "BUSY" flag.
> 
> Which fix of delai checking is the better one ?
> 
> Best Regards
-- 
Alexandre Martins
NETASQ -- We secure IT

--- dev/ata/chipsets/ata-via.c.orig	2013-10-24 09:32:45.000000000 +0000
+++ dev/ata/chipsets/ata-via.c	2013-10-24 09:39:51.000000000 +0000
@@ -459,6 +459,7 @@
 		devs = ata_sata_phy_reset(dev, 0, 0);
 		DELAY(10000);
 		devs += ata_sata_phy_reset(dev, 1, 0);
+		DELAY(10000);
 	} else
 		devs = 1;
 	if (devs)
--- dev/ata/chipsets/ata-via.c.orig	2013-10-24 13:39:17.000000000 +0000
+++ dev/ata/chipsets/ata-via.c	2013-10-24 09:24:04.000000000 +0000
@@ -456,11 +456,29 @@
 {
 	struct ata_channel *ch = device_get_softc(dev);
 	int devs;
+	u_int8_t status;
+	int count;
 
 	if (ch->unit == 0) {
 		devs = ata_sata_phy_reset(dev, 0, 0);
-		DELAY(10000);
+		count = 0;
+		do
+		{
+			ATA_IDX_OUTB(ch, ATA_DRIVE, ATA_D_IBM | ATA_D_LBA | ATA_DEV(ATA_MASTER));
+			DELAY(1000);
+			status = ATA_IDX_INB(ch, ATA_STATUS);
+			count++;
+		} while (status & ATA_S_BUSY && count < 100);
+
 		devs += ata_sata_phy_reset(dev, 1, 0);
+		count = 0;
+		do
+		{
+			ATA_IDX_OUTB(ch, ATA_DRIVE, ATA_D_IBM | ATA_D_LBA | ATA_DEV(ATA_SLAVE));
+			DELAY(1000);
+			status = ATA_IDX_INB(ch, ATA_STATUS);
+			count++;
+		} while (status & ATA_S_BUSY && count < 100);
 	} else
 		devs = 1;
 	if (devs)

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to