[haiku-commits] haiku: hrev48298 - in src/add-ons/kernel: partitioning_systems/session busses/scsi/ahci

  • From: pulkomandy@xxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 14 Nov 2014 16:01:41 +0100 (CET)

hrev48298 adds 2 changesets to branch 'master'
old head: 8068b64b5c33e0c8bd6d3fcabfd3ebac3a422d2b
new head: 3c3eb0976021c2ed1f4fd6c1c4b853c8d17888db
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=3c3eb09+%5E8068b64

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

b31d5cd: AHCI: make debug messages more compact
  
  Put more information on a single line. This makes it easier to keep
  track of things when debugging higher level parts of the disk stack
  (partitionning and file systems).

3c3eb09: Session: try harder to read the disc geometry.
  
  On some discs and drives, the command may not work the first time.
  Trying a second time succeeds more often.
  
  Fixes #11467.

                                 [ Adrien Destugues <pulkomandy@xxxxxxxxx> ]

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

3 files changed, 20 insertions(+), 21 deletions(-)
.../kernel/busses/scsi/ahci/ahci_port.cpp        |  8 +++---
.../kernel/busses/scsi/ahci/sata_request.cpp     |  6 ++---
.../kernel/partitioning_systems/session/Disc.cpp | 27 +++++++++++---------

############################################################################

Commit:      b31d5cd2b6ff9059eebb15b0e33bd8c4c8e3143a
URL:         http://cgit.haiku-os.org/haiku/commit/?id=b31d5cd
Author:      Adrien Destugues <pulkomandy@xxxxxxxxx>
Date:        Fri Nov 14 14:59:04 2014 UTC

AHCI: make debug messages more compact

Put more information on a single line. This makes it easier to keep
track of things when debugging higher level parts of the disk stack
(partitionning and file systems).

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

diff --git a/src/add-ons/kernel/busses/scsi/ahci/ahci_port.cpp 
b/src/add-ons/kernel/busses/scsi/ahci/ahci_port.cpp
index a83f4d6..a045771 100644
--- a/src/add-ons/kernel/busses/scsi/ahci/ahci_port.cpp
+++ b/src/add-ons/kernel/busses/scsi/ahci/ahci_port.cpp
@@ -239,7 +239,6 @@ AHCIPort::ResetDevice()
 }
 
 
-
 status_t
 AHCIPort::ResetPort(bool forceDeviceReset)
 {
@@ -366,10 +365,9 @@ AHCIPort::InterruptErrorHandler(uint32 is)
                        B_PRIx32 ", is 0x%08" B_PRIx32 ", ci 0x%08" B_PRIx32 
"\n", fIndex,
                        fCommandsActive, is, ci);
 
-               TRACE("ssts 0x%08" B_PRIx32 "\n", fRegs->ssts);
-               TRACE("sctl 0x%08" B_PRIx32 "\n", fRegs->sctl);
-               TRACE("serr 0x%08" B_PRIx32 "\n", fRegs->serr);
-               TRACE("sact 0x%08" B_PRIx32 "\n", fRegs->sact);
+               TRACE("ssts 0x%08" B_PRIx32 ", sctl 0x%08" B_PRIx32 ", serr 
0x%08"
+                       B_PRIx32 ", sact 0x%08" B_PRIx32 "\n",
+                       fRegs->ssts, fRegs->sctl, fRegs->serr, fRegs->sact);
        }
 
        // read and clear SError
diff --git a/src/add-ons/kernel/busses/scsi/ahci/sata_request.cpp 
b/src/add-ons/kernel/busses/scsi/ahci/sata_request.cpp
index 9114978..6a53fcf 100644
--- a/src/add-ons/kernel/busses/scsi/ahci/sata_request.cpp
+++ b/src/add-ons/kernel/busses/scsi/ahci/sata_request.cpp
@@ -126,10 +126,8 @@ sata_request::Finish(int tfd, size_t bytesTransfered)
                uint8 error = (tfd >> 8) & 0xff;
 
                if (!IsTestUnitReady()) {
-                       dprintf("ahci: sata_request::finish ATA command 0x%02x 
failed\n",
-                               fFis[2]);
-                       dprintf("ahci: sata_request::finish status 0x%02x, 
error 0x%02x\n",
-                               status, error);
+                       dprintf("ahci: sata_request::finish ATA command 0x%02x 
failed:"
+                               " status 0x%02x, error 0x%02x\n", fFis[2], 
status, error);
                }
        }
 

############################################################################

Revision:    hrev48298
Commit:      3c3eb0976021c2ed1f4fd6c1c4b853c8d17888db
URL:         http://cgit.haiku-os.org/haiku/commit/?id=3c3eb09
Author:      Adrien Destugues <pulkomandy@xxxxxxxxx>
Date:        Fri Nov 14 15:00:37 2014 UTC

Ticket:      https://dev.haiku-os.org/ticket/11467

Session: try harder to read the disc geometry.

On some discs and drives, the command may not work the first time.
Trying a second time succeeds more often.

Fixes #11467.

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

diff --git a/src/add-ons/kernel/partitioning_systems/session/Disc.cpp 
b/src/add-ons/kernel/partitioning_systems/session/Disc.cpp
index abf4912..a9311b6 100644
--- a/src/add-ons/kernel/partitioning_systems/session/Disc.cpp
+++ b/src/add-ons/kernel/partitioning_systems/session/Disc.cpp
@@ -275,23 +275,26 @@ read_table_of_contents(int deviceFD, uint32 
first_session, uchar* buffer,
        memset(raw_command.sense_data, 0, raw_command.sense_data_length);
        raw_command.timeout = kScsiTimeout;
 
-       if (ioctl(deviceFD, B_RAW_DEVICE_COMMAND, &raw_command) == 0) {
-               if (raw_command.scsi_status == 0 && raw_command.cam_status == 
1) {
-                       // SUCCESS!!!
-                       DBG(dump_full_table_of_contents(buffer, buffer_length));
+       // This does not always work on the first try, so do it twice just in 
case.
+       for (int attempt = 0; attempt < 2; attempt++) {
+               if (ioctl(deviceFD, B_RAW_DEVICE_COMMAND, &raw_command) == 0) {
+                       if (raw_command.scsi_status == 0 && 
raw_command.cam_status == 1) {
+                               // SUCCESS!!!
+                               DBG(dump_full_table_of_contents(buffer, 
buffer_length));
+                               return B_OK;
+                       } else {
+                               error = B_FILE_ERROR;
+                               TRACE(("%s: scsi ioctl succeeded, but scsi 
command failed\n",
+                                       kModuleDebugName));
+                       }
                } else {
-                       error = B_FILE_ERROR;
-                       TRACE(("%s: scsi ioctl succeeded, but scsi command 
failed\n",
-                               kModuleDebugName));
+                       error = errno;
+                       TRACE(("%s: scsi command failed with error 0x%" 
B_PRIx32 "\n",
+                               kModuleDebugName, error));
                }
-       } else {
-               error = errno;
-               TRACE(("%s: scsi command failed with error 0x%" B_PRIx32 "\n",
-                       kModuleDebugName, error));
        }
 
        return error;
-
 }
 
 


Other related posts:

  • » [haiku-commits] haiku: hrev48298 - in src/add-ons/kernel: partitioning_systems/session busses/scsi/ahci - pulkomandy