Changeset 201 for trunk


Ignore:
Timestamp:
Aug 24, 2019, 6:36:37 PM (6 years ago)
Author:
David Azarewicz
Message:

Fixed trap in hardware failure recovery.

Location:
trunk/src/os2ahci
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/os2ahci/ReadMe.txt

    r198 r201  
    1 AHCI Driver for OS/2 v2.06
     1AHCI Driver for OS/2 v2.07
    22
    33Introduction
     
    173173  BASEDEV=OS2AHCI.ADD /A:0 /P:0 /I
    174174
    175 Means to ingore the disk plugged into port 0 on adapeter 0.
     175Means to ignore the disk plugged into port 0 on adapeter 0.
    176176
    177177
     
    184184to reorder I/O requests to minimize head movements, resulting in improved
    185185performance when executing random I/Os. In practice, this will be most
    186 noticable when multiple programs request I/O services to different parts
     186noticeable when multiple programs request I/O services to different parts
    187187of the disk -- a single program typically won't queue up I/O's but instead
    188188will wait for each I/O to complete (with the exception of programs like
     
    388388Change Log
    389389==========
     390v.2.07 19-May-2019 - David Azarewicz
     391  Fixed hardware failure recovery to arm ctx hook in watchdog timer.
    390392
    391393v.2.06 19-Sep-2018 - David Azarewicz
  • trunk/src/os2ahci/ahci.c

    r200 r201  
    274274  }
    275275
    276   DPRINTF(3,"ahci_save_bios_config: BIOS AHCI mode is %d\n", ai->bios_config[HOST_CTL / sizeof(u32)] & HOST_AHCI_EN);
     276  DPRINTF(3,__func__": BIOS AHCI mode is %d\n", ai->bios_config[HOST_CTL / sizeof(u32)] & HOST_AHCI_EN);
    277277
    278278  if ((ai->bios_config[HOST_CTL / sizeof(u32)] & HOST_AHCI_EN) == 0 && ai->pci_vendor == PCI_VENDOR_ID_INTEL)
     
    296296int ahci_restore_bios_config(AD_INFO *ai)
    297297{
    298   DPRINTF(3,"ahci_restore_bios_config: restoring AHCI BIOS configuration on adapter %d\n", ad_no(ai));
     298  DPRINTF(3,__func__": restoring AHCI BIOS configuration on adapter %d\n", ad_no(ai));
    299299
    300300  /* Restore saved BIOS configuration; please note that HOST_CTL is restored
     
    354354int ahci_restore_initial_config(AD_INFO *ai)
    355355{
    356   DPRINTF(3,"ahci_restore_initial_config: restoring initial configuration on adapter %d\n", ad_no(ai));
     356  DPRINTF(3,__func__": restoring initial configuration on adapter %d\n", ad_no(ai));
    357357
    358358  /* restore saved BIOS configuration */
     
    535535  int i;
    536536
    537   DPRINTF(1,"ahci_complete_init: completing initialization of adapter #%d\n", ad_no(ai));
     537  DPRINTF(1,__func__": completing initialization of adapter #%d\n", ad_no(ai));
    538538
    539539  if (!ai->int_set)
     
    592592      if (init_reset)
    593593      {
    594         DPRINTF(3,"ahci_complete_init: resetting port %d\n", p);
     594        DPRINTF(3,__func__": resetting port %d\n", p);
    595595        ahci_reset_port(ai, p, 1);
    596596      }
    597597      else
    598598      {
    599         DPRINTF(3,"ahci_complete_init: restarting port #%d\n", p);
     599        DPRINTF(3,__func__": restarting port #%d\n", p);
    600600        ahci_stop_port(ai, p);
    601601        ahci_start_port(ai, p, 1);
     
    615615  /* pci_enable_int(ai->bus, ai->dev_func); */
    616616
    617   DPRINTF(1,"ahci_complete_init: done\n");
     617  DPRINTF(1,__func__": done\n");
    618618  return(0);
    619619}
     
    918918  TIMER Timer;
    919919
    920   DPRINTF(2,"ahci_reset_port: resetting port %d.%d\n", ad_no(ai), p);
     920  DPRINTF(2,__func__": resetting port %d.%d\n", ad_no(ai), p);
    921921  DUMP_PORT_REGS(2,ai,p);
    922922
     
    935935
    936936  /* set link speed and power management options */
    937   DPRINTF(3,"ahci_reset_port: setting link speed and power management options\n");
     937  DPRINTF(3,__func__": setting link speed and power management options\n");
    938938  tmp = readl(port_mmio + PORT_SCR_CTL) & ~0x00000fffUL;
    939939  tmp |= (link_speed[ad_no(ai)][p] & 0x0f) << 4;
     
    942942
    943943  /* issue COMRESET on the port */
    944   DPRINTF(3,"ahci_reset_port: issuing COMRESET on port %d\n", p);
     944  DPRINTF(3,__func__": issuing COMRESET on port %d\n", p);
    945945  writel(port_mmio + PORT_SCR_CTL, tmp | 1);
    946946  readl(port_mmio + PORT_SCR_CTL);  /* flush */
     
    969969
    970970  /* start port so we can receive the COMRESET FIS */
    971   DPRINTF(2,"ahci_reset_port: starting port %d again\n", p);
     971  DPRINTF(2,__func__": starting port %d again\n", p);
    972972  ahci_start_port(ai, p, ei);
    973973
     
    983983    }
    984984  }
    985   DPRINTF(3,"ahci_reset_port: PORT_TFDATA = 0x%x\n", readl(port_mmio + PORT_TFDATA));
     985  DPRINTF(3,__func__": PORT_TFDATA = 0x%x\n", readl(port_mmio + PORT_TFDATA));
    986986
    987987  return(0);
     
    996996  u32 status;
    997997
    998   DPRINTF(3,"ahci_start_port %d.%d\n", ad_no(ai), p);
     998  DPRINTF(3,__func__": %d.%d\n", ad_no(ai), p);
    999999  /* check whether device presence is detected and link established */
    10001000
    10011001  status = readl(port_mmio + PORT_SCR_STAT);
    1002   DPRINTF(3,"ahci_start_port: PORT_SCR_STAT = 0x%x\n", status);
     1002  DPRINTF(3,__func__": PORT_SCR_STAT = 0x%x\n", status);
    10031003  if ((status & 0xf) != 3) return(-1);
    10041004
    10051005  /* clear SError, if any */
    10061006  status = readl(port_mmio + PORT_SCR_ERR);
    1007   DPRINTF(3,"ahci_start_port: PORT_SCR_ERR  = 0x%x\n", status);
     1007  DPRINTF(3,__func__": PORT_SCR_ERR  = 0x%x\n", status);
    10081008  writel(port_mmio + PORT_SCR_ERR, status);
    10091009
     
    10931093  int rc;
    10941094
    1095   DPRINTF(3,"ahci_stop_port %d.%d\n", ad_no(ai), p);
     1095  DPRINTF(3,__func__": %d.%d\n", ad_no(ai), p);
    10961096
    10971097  /* disable port interrupts */
     
    11011101  if ((rc = ahci_stop_fis_rx(ai, p)) != 0)
    11021102  {
    1103     dprintf(0,"error: failed to stop FIS receive (%d)\n", rc);
     1103    dprintf(0,__func__": failed to stop FIS receive (%d)\n", rc);
    11041104    return(rc);
    11051105  }
     
    11081108  if ((rc = ahci_stop_engine(ai, p)) != 0)
    11091109  {
    1110     dprintf(0,"error: failed to stop port HW engine (%d)\n", rc);
     1110    dprintf(0,__func__": failed to stop port HW engine (%d)\n", rc);
    11111111    return(rc);
    11121112  }
     
    12361236  }
    12371237
    1238   DPRINTF(7,"---------- ahci_exec_iorb: iorb=%x\n", vIorb);
     1238  DPRINTF(7,"---------- "__func__": iorb=%x\n", vIorb);
    12391239
    12401240  /* Enable AHCI mode; apparently, the AHCI mode may end up becoming
     
    12621262      cmd_max = ai->cmd_max;
    12631263    }
    1264     DPRINTF(8,"NCQ command; cmd_max = %d->%d\n", ai->cmd_max, cmd_max);
     1264    DPRINTF(8,__func__": NCQ command; cmd_max = %d->%d\n", ai->cmd_max, cmd_max);
    12651265  }
    12661266
     
    13151315        aws->cmd_slot = port->cmd_slot;
    13161316
    1317         DPRINTF(7,"Issuing command Slot=%d cmds=%x\n", port->cmd_slot, *cmds);
     1317        DPRINTF(7,__func__": Issuing command Slot=%d cmds=%x\n", port->cmd_slot, *cmds);
    13181318        if (aws->is_ncq)
    13191319        {
     
    14081408  {
    14091409    /* successfully prepared cmd; issue cmd and wait for completion */
    1410     DPRINTF(3,"---------- executing polled cmd on slot 0...");
     1410    DPRINTF(3,"---------- "__func__" executing polled cmd on slot 0...");
    14111411    writel(port_mmio + PORT_CMD_ISSUE, 1);
    14121412    TimerInit(&Timer, timeout);
     
    14791479  if (readl(port_mmio + PORT_CMD_ISSUE) & 1)
    14801480  {
    1481     DPRINTF(3,"port %d slot 0 is not idle; not executing polled cmd\n", p);
     1481    DPRINTF(3,__func__": port %d slot 0 is not idle; not executing polled cmd\n", p);
    14821482    return(-1);
    14831483  }
     
    14881488
    14891489  /* start command execution for slot 0 */
    1490   DPRINTF(3,"---------- executing polled cmd...");
     1490  DPRINTF(3,"---------- "__func__" executing polled cmd...");
    14911491  writel(port_mmio + PORT_CMD_ISSUE, 1);
    14921492
     
    15401540  if (!ai->ports[p].devs[d].atapi)
    15411541  {
    1542     DPRINTF(2,"flushing cache on %d.%d.%d\n", ad_no(ai), p, d);
     1542    DPRINTF(2,__func__": flushing cache on %d.%d.%d\n", ad_no(ai), p, d);
    15431543    return(ahci_exec_polled_cmd(ai, p, d, 30000,
    15441544           ai->ports[p].devs[d].lba48 ? ATA_CMD_FLUSH_EXT : ATA_CMD_FLUSH, AP_END));
     
    15571557int ahci_set_dev_idle(AD_INFO *ai, int p, int d, int idle)
    15581558{
    1559   DPRINTF(3,"sending IDLE=%d command to port %d\n", idle, p);
     1559  DPRINTF(3,__func__": sending IDLE=%d command to port %d\n", idle, p);
    15601560  return ahci_exec_polled_cmd(ai, p, d, 500, ATA_CMD_IDLE, AP_COUNT, idle ? 1 : 0, AP_END);
    15611561}
     
    16151615    if ((u32)&irq_stat < 0xf000)
    16161616    {
    1617       DPRINTF(0,"IRQ stack running low; arming engine context hook\n");
     1617      DPRINTF(0,__func__": IRQ stack running low; arming engine context hook\n");
    16181618      /* Rousseau:
    16191619       * A context hook cannot be re-armed before it has completed.
  • trunk/src/os2ahci/ctxhook.c

    r196 r201  
    342342  rearm_ctx_hook = 0;
    343343
    344   DPRINTF(8,"reset_ctxhook() started\n");
     344  //DPRINTF(8,"reset_ctxhook() started\n");
     345  dprintf(0, __func__": BEG\n");
    345346  memset(&done_queue, 0x00, sizeof(done_queue));
    346347
     
    473474  if (rearm_ctx_hook)
    474475  {
    475     msleep(250);
    476     KernArmHook(reset_ctxhook_h, 0, 0);
    477   }
    478 
     476    /* we cannot rearm ourself because we will execute immediately leaving
     477     * no time to process and clear the reason we need to rearm. Therefore
     478     * we set the timer again.
     479     */
     480    //msleep(250);
     481    //KernArmHook(reset_ctxhook_h, 0, 0);
     482    Timer_StartTimerMS(&th_reset_watchdog, 250, reset_watchdog, 0);
     483  }
     484
     485  dprintf(0,__func__": END\n");
    479486  KernThunkStackTo16();
    480487}
  • trunk/src/os2ahci/os2ahci.c

    r198 r201  
    16031603  /* reset watchdog timer */
    16041604  Timer_CancelTimer(timer_handle);
     1605  th_reset_watchdog = 0;
    16051606  dprintf(0,"reset watchdog invoked\n");
    16061607
     1608  /* You cannot call the reset_ctxhook directly because it does things
     1609   * that are illegal in an interrupt handler.
     1610   */
     1611
     1612  KernArmHook(reset_ctxhook_h, 0, 0);
     1613
    16071614  /* call context hook manually */
    1608   reset_ctxhook(0);
     1615  //reset_ctxhook(0);
    16091616}
    16101617
Note: See TracChangeset for help on using the changeset viewer.