Changeset 121 for trunk


Ignore:
Timestamp:
Aug 31, 2011, 11:23:46 PM (14 years ago)
Author:
cjm
Message:

OS2AHCI Version 1.19
====================

  • Added retry counters to all commands (IORBs) in order to prevent infinite retry loops. This was necessary because Virtualbox 4.x doesn't seem to set the "current command index" in specific ATAPI error situations, causing the failing command to be retried indefinitely instead of asking for a sense buffer
  • Minor changes to debug logging
Location:
trunk/src/os2ahci
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/os2ahci/ahci.c

    r112 r121  
    11221122  if (func(iorb, 0) == 0) {
    11231123    /* successfully prepared cmd; issue cmd and wait for completion */
    1124     ddprintf("executing polled cmd...");
     1124    ddprintf("executing polled cmd on slot 0...");
    11251125    writel(port_mmio + PORT_CMD_ISSUE, 1);
    11261126    timeout /= 10;
  • trunk/src/os2ahci/ata.c

    r112 r121  
    278278
    279279  if (debug >= 2) {
    280     printf("ATA command for %d.%d.%d:\n", ad_no(ai), p, d);
     280    printf("ATA command for %d.%d.%d, slot %d:\n", ad_no(ai), p, d, slot);
    281281    phex(cmd_hdr, offsetof(AHCI_CMD_HDR, reserved), "cmd_hdr:   ");
    282282    phex(&ata_cmd, sizeof(ata_cmd), "ata_cmd:   ");
  • trunk/src/os2ahci/ctxhook.c

    r87 r121  
    128128        /* get "current command slot"; only valid if there are no NCQ cmds */
    129129        ccs = (int) ((readl(port_mmio + PORT_CMD) >> 8) & 0x0f);
     130        ddprintf(" PORT_CMD      = 0x%x\n", ccs);
    130131
    131132        for (iorb = ai->ports[p].iorb_queue.root; iorb != NULL; iorb = next) {
     
    143144              ai->ports[p].reg_cmds &= ~(1UL << aws->cmd_slot);
    144145              if (aws->cmd_slot == ccs) {
    145                 /* this is the non-NCQ comand that failed */
     146                /* this is the non-NCQ command that failed */
    146147                problem_iorb = iorb;
    147148              }
    148149            }
    149150            /* we can requeue all IORBs unconditionally (see function comment) */
    150             iorb_requeue(iorb);
     151            if (aws->retries++ < MAX_RETRIES) {
     152              iorb_requeue(iorb);
     153
     154            } else {
     155              /* retry count exceeded; consider IORB aborted */
     156              iorb_seterr(iorb, IOERR_CMD_ABORTED);
     157              iorb_queue_del(&ai->ports[p].iorb_queue, iorb);
     158              iorb_queue_add(&done_queue, iorb);
     159              if (iorb == problem_iorb) {
     160                /* no further analysis -- we're done with this one */
     161                problem_iorb = NULL;
     162              }
     163            }
    151164          }
    152165        }
     
    352365        /* retry or abort all remaining active commands on this port */
    353366        for (iorb = ai->ports[p].iorb_queue.root; iorb != NULL; iorb = next) {
     367          ADD_WORKSPACE _far *aws = add_workspace(iorb);
    354368          next = iorb->pNxtIORB;
    355           if (add_workspace(iorb)->queued_hw) {
     369
     370          if (aws->queued_hw) {
    356371            /* this IORB had already been queued to HW when we reset the port */
    357             if (add_workspace(iorb)->idempotent) {
    358               /* We can retry this IORB; just reset its status and it will be
    359                * picked up by subsequent trigger_engine() calls.
    360                */
     372            if (aws->idempotent && aws->retries++ < MAX_RETRIES) {
     373              /* we can retry this IORB */
    361374              iorb_requeue(iorb);
    362375
  • trunk/src/os2ahci/os2ahci.c

    r117 r121  
    12481248  u16 no_ncq = aws->no_ncq;
    12491249  u16 unaligned = aws->unaligned;
     1250  u16 retries = aws->retries;
    12501251
    12511252  aws_free(aws);
    12521253  memset(aws, 0x00, sizeof(*aws));
     1254
    12531255  aws->no_ncq = no_ncq;
    12541256  aws->unaligned = unaligned;
     1257  aws->retries = retries;
    12551258}
    12561259
  • trunk/src/os2ahci/os2ahci.h

    r112 r121  
    8282/* default command timeout (can be overwritten in the IORB) */
    8383#define DEFAULT_TIMEOUT  30000
     84
     85/* Maximum number of retries for commands in the restart/reset context hooks.
     86 *
     87 * Please note that the corresponding variable in the ADD workspace is a bit
     88 * field, thus increasing this value means increasing the size of the bit
     89 * field. At the time of writing this comment the 'retries' variable was 2
     90 * bits wide (i.e. a maximum number of 3 retries) and there was exactly one
     91 * bit left before the ADD workspace structure would become too large...
     92 */
     93#define MAX_RETRIES          3
    8494
    8595/* max/min macros */
     
    354364  unsigned      complete      : 1;     /* IORB has completed processing */
    355365  unsigned      unaligned     : 1;     /* unaligned S/G; need to use transfer buffer */
     366  unsigned      retries       : 2;     /* number of retries for this command */
    356367  unsigned      cmd_slot      : 5;     /* AHCI command slot for this IORB */
    357368} ADD_WORKSPACE;
  • trunk/src/os2ahci/version.h

    r116 r121  
    1414
    1515
    16 #define VERSION            118       /* driver version (2 implied decimals) */
     16#define VERSION            119       /* driver version (2 implied decimals) */
    1717
Note: See TracChangeset for help on using the changeset viewer.