From 69b26c9111e949f1e9bf574bbc3b5ec88e3285e8 Mon Sep 17 00:00:00 2001 From: weissms Date: Mon, 8 Aug 2011 08:51:57 +0000 Subject: [PATCH] Be sure diag is executed even if there is nothing on ab_Dev[0]. Needed for sam port. We can not rely on ab_Dev[] contents to determine if diag should be executed. Instead we now store the information if diag was executed inside of ata_ResetBus() and pass it on to ata_ReadSignature() were we can check if we need to execute it. git-svn-id: https://svn.aros.org/svn/aros/trunk/AROS@40590 fb15a70f-31f2-0310-bbcc-cdcc74a49acc --- rom/devs/ata/lowlevel.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/rom/devs/ata/lowlevel.c b/rom/devs/ata/lowlevel.c index a4a688fcc0..1045123c5b 100644 --- a/rom/devs/ata/lowlevel.c +++ b/rom/devs/ata/lowlevel.c @@ -2214,7 +2214,7 @@ ULONG atapi_RequestSense(struct ata_Unit* unit, UBYTE* sense, ULONG senselen) return ((sense[2]&0xf)<<16) | (sense[12]<<8) | (sense[13]); } -ULONG ata_ReadSignature(struct ata_Bus *bus, int unit) +ULONG ata_ReadSignature(struct ata_Bus *bus, int unit, BOOL *DiagExecuted) { ULONG port = bus->ab_Port; UBYTE tmp1, tmp2; @@ -2254,8 +2254,11 @@ ULONG ata_ReadSignature(struct ata_Bus *bus, int unit) if (0 == (ata_ReadStatus(bus) & 0xfe)) return DEV_NONE; /* ATA_EXECUTE_DIAG is executed by both devices, do it only once */ - if (bus->ab_Dev[0] == DEV_UNKNOWN || bus->ab_Dev[0] >= DEV_ATAPI) + if (!*DiagExecuted) + { BUS_OUT(ATA_EXECUTE_DIAG, ata_Command, port); + *DiagExecuted = TRUE; + } ata_WaitTO(bus->ab_Timer, 0, 2000, 0); while (ata_ReadStatus(bus) & ATAF_BUSY) @@ -2288,6 +2291,7 @@ void ata_ResetBus(struct ata_Bus *bus) ULONG alt = bus->ab_Alt; ULONG port = bus->ab_Port; ULONG TimeOut; + BOOL DiagExecuted = FALSE; /* Set and then reset the soft reset bit in the Device Control * register. This causes device 0 be selected */ @@ -2363,9 +2367,9 @@ void ata_ResetBus(struct ata_Bus *bus) } if (DEV_NONE != bus->ab_Dev[0]) - bus->ab_Dev[0] = ata_ReadSignature(bus, 0); + bus->ab_Dev[0] = ata_ReadSignature(bus, 0, &DiagExecuted); if (DEV_NONE != bus->ab_Dev[1]) - bus->ab_Dev[1] = ata_ReadSignature(bus, 1); + bus->ab_Dev[1] = ata_ReadSignature(bus, 1, &DiagExecuted); } void ata_InitBus(struct ata_Bus *bus) -- 2.11.4.GIT