Changeset 160 for trunk


Ignore:
Timestamp:
May 31, 2013, 2:03:41 AM (12 years ago)
Author:
David Azarewicz
Message:

fixed trap dump kernel exit, some work on suspend/resume routines

Location:
trunk/src/os2ahci
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/os2ahci/Makefile

    r159 r160  
    3030# Define default build version if not specified in environment
    3131BLD_MAJOR=1
    32 BLD_MINOR=27 # must be 2 digits
     32BLD_MINOR=28 # must be 2 digits
    3333BLD_REV=0 # not used at this time
    34 FIXPACK=
     34FIXPACK=Test Build
    3535
    3636!ifndef %WATCOM # if not defined in the environment
     
    9191AFLAGS = -q
    9292# In order to build the SMP safe version you must have the updated devhelp.h and define OS2AHCI_SMP.
    93 CFLAGS = -ei -6 -d0 -bt=os2 -ms -zu -wx -ecc -zp=1 -q -s -zgp -zfp -oi -DOS2AHCI_SMP
    94 CFLAGS_DEBUG = -ei -6 -d3 -hc -bt=os2 -ms -zu -ecc -zp=1 -q -s -zgp -zfp -od
     93CFLAGS= -ei -6 -d0 -bt=os2 -ms -zu -wx -ecc -zp1 -q -s -zgp -zfp -oi -DOS2AHCI_SMP
     94CFLAGS_DEBUG = -ei -6 -d3 -hc -bt=os2 -ms -zu -ecc -zp1 -q -s -zgp -zfp -od
    9595
    9696###############################################################################
  • trunk/src/os2ahci/README

    r158 r160  
    4444The *binary* delivery of OS2AHCI.ADD as obtained from ecomstation.nl,
    4545or as part of packaged eComStation releases, is licensed to run with
    46 eComStation, only.
     46eComStation only.
    4747
    4848The source code can be retrieved from http://svn.ecomstation.nl;
     
    382382==========
    383383
     384v.1.28 30-May-2013 - David Azarewicz
     385  Reworked trap dump kernel exit
     386  Removed unused IDC entry point.
     387  Some work on suspend/resume routines.
     388
    384389v.1.27 23-Apr-2013 - David Azarewicz
    385390  Added LVM aware disk geometry reporting.
  • trunk/src/os2ahci/ahci.c

    r157 r160  
    162162
    163163  /* print AHCI register debug information */
     164  #ifdef DEBUG
    164165  if (debug) {
    165     printf("AHCI global controller registers:\n");
     166    aprintf("AHCI global controller registers:\n");
    166167    for (i = 0; i <= HOST_CAP2 / sizeof(u32); i++) {
    167168      u32 val = ai->bios_config[i];
    168       printf(" %02x: %08lx", i, val);
     169      aprintf(" %02x: %08lx", i, val);
    169170
    170171      if (i == HOST_CAP) {
    171         printf_nts(" -");
    172         if (val & HOST_CAP_64)         printf_nts(" 64bit");
    173         if (val & HOST_CAP_NCQ)        printf_nts(" ncq");
    174         if (val & HOST_CAP_SNTF)       printf_nts(" sntf");
    175         if (val & HOST_CAP_MPS)        printf_nts(" mps");
    176         if (val & HOST_CAP_SSS)        printf_nts(" sss");
    177         if (val & HOST_CAP_ALPM)       printf_nts(" alpm");
    178         if (val & HOST_CAP_LED)        printf_nts(" led");
    179         if (val & HOST_CAP_CLO)        printf_nts(" clo");
    180         if (val & HOST_CAP_ONLY)       printf_nts(" ahci_only");
    181         if (val & HOST_CAP_PMP)        printf_nts(" pmp");
    182         if (val & HOST_CAP_FBS)        printf_nts(" fbs");
    183         if (val & HOST_CAP_PIO_MULTI)  printf_nts(" pio_multi");
    184         if (val & HOST_CAP_SSC)        printf_nts(" ssc");
    185         if (val & HOST_CAP_PART)       printf_nts(" part");
    186         if (val & HOST_CAP_CCC)        printf_nts(" ccc");
    187         if (val & HOST_CAP_EMS)        printf_nts(" ems");
    188         if (val & HOST_CAP_SXS)        printf_nts(" sxs");
    189         printf_nts(" cmd_slots:%d", (u16) ((val >> 8) & 0x1f) + 1);
    190         printf_nts(" ports:%d",     (u16) (val & 0x1f) + 1);
     172        ntprintf(" -");
     173        if (val & HOST_CAP_64)         ntprintf(" 64bit");
     174        if (val & HOST_CAP_NCQ)        ntprintf(" ncq");
     175        if (val & HOST_CAP_SNTF)       ntprintf(" sntf");
     176        if (val & HOST_CAP_MPS)        ntprintf(" mps");
     177        if (val & HOST_CAP_SSS)        ntprintf(" sss");
     178        if (val & HOST_CAP_ALPM)       ntprintf(" alpm");
     179        if (val & HOST_CAP_LED)        ntprintf(" led");
     180        if (val & HOST_CAP_CLO)        ntprintf(" clo");
     181        if (val & HOST_CAP_ONLY)       ntprintf(" ahci_only");
     182        if (val & HOST_CAP_PMP)        ntprintf(" pmp");
     183        if (val & HOST_CAP_FBS)        ntprintf(" fbs");
     184        if (val & HOST_CAP_PIO_MULTI)  ntprintf(" pio_multi");
     185        if (val & HOST_CAP_SSC)        ntprintf(" ssc");
     186        if (val & HOST_CAP_PART)       ntprintf(" part");
     187        if (val & HOST_CAP_CCC)        ntprintf(" ccc");
     188        if (val & HOST_CAP_EMS)        ntprintf(" ems");
     189        if (val & HOST_CAP_SXS)        ntprintf(" sxs");
     190        ntprintf(" cmd_slots:%d", (u16) ((val >> 8) & 0x1f) + 1);
     191        ntprintf(" ports:%d",     (u16) (val & 0x1f) + 1);
    191192
    192193      } else if (i == HOST_CTL) {
    193         printf_nts(" -");
    194         if (val & HOST_AHCI_EN)        printf_nts(" ahci_enabled");
    195         if (val & HOST_IRQ_EN)         printf_nts(" irq_enabled");
    196         if (val & HOST_RESET)          printf_nts(" resetting");
     194        ntprintf(" -");
     195        if (val & HOST_AHCI_EN)        ntprintf(" ahci_enabled");
     196        if (val & HOST_IRQ_EN)         ntprintf(" irq_enabled");
     197        if (val & HOST_RESET)          ntprintf(" resetting");
    197198
    198199      } else if (i == HOST_CAP2) {
    199         printf_nts(" -");
    200         if (val & HOST_CAP2_BOH)       printf_nts(" boh");
    201         if (val & HOST_CAP2_NVMHCI)    printf_nts(" nvmhci");
    202         if (val & HOST_CAP2_APST)      printf_nts(" apst");
     200        ntprintf(" -");
     201        if (val & HOST_CAP2_BOH)       ntprintf(" boh");
     202        if (val & HOST_CAP2_NVMHCI)    ntprintf(" nvmhci");
     203        if (val & HOST_CAP2_APST)      ntprintf(" apst");
    203204      }
    204       printf_nts("\n");
    205     }
    206   }
     205      ntprintf("\n");
     206    }
     207  }
     208  #endif
    207209
    208210  /* Save working copies of CAP, CAP2 and port_map and remove broken feature
     
    337339      }
    338340    }
    339 
    340     /* Wait some time to give the COMRESET a chance to complete (usually, at
    341      * least hard disks complete the reset within a few milliseonds)
    342      */
    343     msleep(20);
    344341  }
    345342
     
    456453}
    457454
    458 int ahci_reset_controller(AD_INFO *ai)
    459 {
    460     u32 tmp;
    461     TIMER Timer;
    462 
    463     dprintf("controller reset starting on adapter %d\n", ad_no(ai));
    464     /* we must be in AHCI mode, before using anything
    465      * AHCI-specific, such as HOST_RESET.
    466      */
    467     ahci_enable_ahci(ai);
    468 
    469     /* global controller reset */
    470     tmp = readl(ai->mmio + HOST_CTL);
    471     if ((tmp & HOST_RESET) == 0) {
    472         writel(ai->mmio + HOST_CTL, tmp | HOST_RESET);
    473         readl(ai->mmio + HOST_CTL); /* flush */
    474     }
    475 
    476     /*
    477      * to perform host reset, OS should set HOST_RESET
    478      * and poll until this bit is read to be "0".
    479      * reset must complete within 1 second, or
    480      * the hardware should be considered fried.
    481      */
    482     timer_init(&Timer, 1000);
    483     while (((tmp = readl(ai->mmio + HOST_CTL)) & HOST_RESET) != 0) {
    484       if (timer_check_and_block(&Timer)) {
    485         dprintf("controller reset failed (0x%lx)\n", tmp);
    486         return(-1);
    487       }
    488     }
    489 
    490     /* turn on AHCI mode */
    491     ahci_enable_ahci(ai);
    492 
    493     /* Some registers might be cleared on reset.  Restore
    494      * initial values.
    495      */
    496     ahci_restore_initial_config(ai);
    497 
    498     if (ai->pci->vendor == PCI_VENDOR_ID_INTEL) {
    499       u32 tmp16 = 0;
    500 
    501       ddprintf("ahci_reset_controller: intel detected\n");
    502       /* configure PCS */
    503       pci_read_conf(ai->bus, ai->dev_func, 0x92, sizeof(u16), &tmp16);
    504       if ((tmp16 & ai->port_map) != ai->port_map) {
    505         ddprintf("ahci_reset_controller: updating PCS %x/%x\n", (u16)tmp16, ai->port_map);
    506         tmp16 |= ai->port_map;
    507         pci_write_conf(ai->bus, ai->dev_func, 0x92, sizeof(u16), tmp16);
    508       }
    509     }
    510 
    511     return 0;
    512 }
    513 
    514455/******************************************************************************
    515456 * Scan all ports for connected devices and fill in the corresponding device
     
    547488    ahci_save_bios_config(ai);
    548489  }
    549 
    550   ahci_reset_controller(ai);
    551490
    552491  if (ahci_enable_ahci(ai)) {
     
    723662  dprintf("ahci_reset_port: resetting port %d.%d\n", ad_no(ai), p);
    724663  if (debug > 1) {
    725     printf(" PORT_CMD       = 0x%lx\n", readl(port_mmio + PORT_CMD));
    726     printf("ahci_reset_port: command engine status:\n");
    727     printf(" PORT_SCR_ACT   = 0x%lx\n", readl(port_mmio + PORT_SCR_ACT));
    728     printf(" PORT_CMD_ISSUE = 0x%lx\n", readl(port_mmio + PORT_CMD_ISSUE));
    729     printf("link/device status:\n");
    730     printf(" PORT_SCR_STAT  = 0x%lx\n", readl(port_mmio + PORT_SCR_STAT));
    731     printf(" PORT_SCR_CTL   = 0x%lx\n", readl(port_mmio + PORT_SCR_CTL));
    732     printf(" PORT_SCR_ERR   = 0x%lx\n", readl(port_mmio + PORT_SCR_ERR));
    733     printf(" PORT_TFDATA    = 0x%lx\n", readl(port_mmio + PORT_TFDATA));
    734     printf("interrupt status:\n");
    735     printf(" PORT_IRQ_STAT  = 0x%lx\n", readl(port_mmio + PORT_IRQ_STAT));
    736     printf(" PORT_IRQ_MASK  = 0x%lx\n", readl(port_mmio + PORT_IRQ_MASK));
    737     printf(" HOST_IRQ_STAT  = 0x%lx\n", readl(ai->mmio + HOST_IRQ_STAT));
     664    aprintf(" PORT_CMD       = 0x%lx\n", readl(port_mmio + PORT_CMD));
     665    aprintf("ahci_reset_port: command engine status:\n");
     666    aprintf(" PORT_SCR_ACT   = 0x%lx\n", readl(port_mmio + PORT_SCR_ACT));
     667    aprintf(" PORT_CMD_ISSUE = 0x%lx\n", readl(port_mmio + PORT_CMD_ISSUE));
     668    aprintf("link/device status:\n");
     669    aprintf(" PORT_SCR_STAT  = 0x%lx\n", readl(port_mmio + PORT_SCR_STAT));
     670    aprintf(" PORT_SCR_CTL   = 0x%lx\n", readl(port_mmio + PORT_SCR_CTL));
     671    aprintf(" PORT_SCR_ERR   = 0x%lx\n", readl(port_mmio + PORT_SCR_ERR));
     672    aprintf(" PORT_TFDATA    = 0x%lx\n", readl(port_mmio + PORT_TFDATA));
     673    aprintf("interrupt status:\n");
     674    aprintf(" PORT_IRQ_STAT  = 0x%lx\n", readl(port_mmio + PORT_IRQ_STAT));
     675    aprintf(" PORT_IRQ_MASK  = 0x%lx\n", readl(port_mmio + PORT_IRQ_MASK));
     676    aprintf(" HOST_IRQ_STAT  = 0x%lx\n", readl(ai->mmio + HOST_IRQ_STAT));
    738677  }
    739678
     
    15651504   */
    15661505  if (irq_stat & PORT_IRQ_UNK_FIS) {
     1506    #ifdef DEBUG
    15671507    u32 _far *unk = (u32 _far *) (port_dma_base(ai, p)->rx_fis + RX_FIS_UNK);
    1568     dprintf("warning: unknown FIS %08lx %08lx %08lx %08lx\n",
    1569             unk[0], unk[1], unk[2], unk[3]);
     1508    dprintf("warning: unknown FIS %08lx %08lx %08lx %08lx\n", unk[0], unk[1], unk[2], unk[3]);
     1509    #endif
    15701510    reset_port = 1;
    15711511  }
     
    16881628void ahci_execute_ata(IORBH _far *iorb)
    16891629{
     1630  #ifdef DEBUG
    16901631  int a = iorb_unit_adapter(iorb);
    16911632  int p = iorb_unit_port(iorb);
    16921633  int d = iorb_unit_device(iorb);
     1634  #endif
    16931635
    16941636  dphex(((IORB_ADAPTER_PASSTHRU _far *) iorb)->pControllerCmd,
  • trunk/src/os2ahci/apm.c

    r157 r160  
    7777    if (evt->ulParm2 >> 16 != APM_PWRSTATEREADY) {
    7878      /* we're suspending */
    79       apm_suspend();
     79      suspend();
    8080    }
    8181    break;
     
    8484  case APM_CRITRESUMEEVENT:
    8585    /* we're resuming */
    86     apm_resume();
     86    resume();
    8787    break;
    8888
     
    9696
    9797/******************************************************************************
    98  * APM suspend handler. In a nutshell, it'll turn of interrupts and flush all
     98 * Suspend handler. In a nutshell, it'll turn off interrupts and flush all
    9999 * write caches.
    100100 */
    101 void apm_suspend(void)
     101void suspend(void)
    102102{
    103103  int a;
     
    107107
    108108  if (suspended) return;
    109   dprintf("apm_suspend()\n");
     109  dprintf("suspend()\n");
    110110
    111111  /* restart all ports with interrupts disabled */
     
    132132      }
    133133    }
     134
     135    /* AHCI spec rev1.1 section 8.3.3:
     136     * Software must disable interrupts prior to requesting a transition of the HBA to D3 state.
     137     */
     138    writel(ai->mmio + HOST_CTL, readl(ai->mmio + HOST_CTL) & ~HOST_IRQ_EN);
     139    readl(ai->mmio + HOST_CTL); /* flush */
    134140  }
    135141
     
    137143  init_complete = 0;
    138144
     145#if 0
    139146  /* restore BIOS configuration for each adapter and release the adapter */
    140147  for (a = 0; a < ad_info_cnt; a++) {
    141148    ahci_restore_bios_config(ad_infos + a);
    142     unlock_adapter(ad_infos + a);
    143   }
     149  }
     150#endif
     151
     152  /* TODO: put the device into the D3 state */
    144153
    145154  suspended = 1;
    146   dprintf("apm_suspend() finished\n");
    147 }
    148 
    149 /******************************************************************************
    150  * APM resume handler. All ports are restarted with interrupts enabled using
     155  dprintf("suspend() finished\n");
     156}
     157
     158/******************************************************************************
     159 * Resume handler. All ports are restarted with interrupts enabled using
    151160 * the same function as the IOCM_COMPLETE_INIT handler does.
    152161 */
    153 void apm_resume(void)
     162void resume(void)
    154163{
    155164  int a;
    156165
    157166  if (!suspended) return;
    158   dprintf("apm_resume()\n");
     167  dprintf("resume()\n");
     168
     169  /* TODO: put the device into the D0 state */
    159170
    160171  for (a = 0; a < ad_info_cnt; a++) {
     
    165176     * done to get the adapter and its ports up and running.
    166177     */
    167     lock_adapter(ai);
    168178    ahci_complete_init(ai);
    169179  }
     
    178188
    179189  suspended = 0;
    180   dprintf("apm_resume() finished\n");
    181 }
     190  dprintf("resume() finished\n");
     191}
     192
     193/******************************************************************************
     194 * This is the kernel exit handler for panics and traps.
     195 * Assume the system is trashed and do the absolute minimum necessary
     196 * to put the adapters into a state so that the BIOS can operate the
     197 * adapters. We never need to recover from this as the system will be rebooted.
     198 */
     199void shutdown_driver(void)
     200{
     201  int a;
     202  int p;
     203  u16 i;
     204  u32 tmp;
     205  //int d;
     206
     207  dprintf("shutdown_driver() enter\n");
     208
     209  for (a = 0; a < ad_info_cnt; a++) {
     210    AD_INFO *ai = ad_infos + a;
     211
     212    /* Try to be nice. Wait 50ms for adapter to go not busy.
     213     * If it doesn't go not busy in that time, too bad. Stop it anyway.
     214     */
     215    for (i=0; i<50000 && ai->busy; i++) udelay(1000);
     216
     217    for (p = 0; p <= ai->port_max; p++) {
     218      u8 _far *port_mmio = port_base(ai, p);
     219
     220      /* Wait up to 50ms for port to go not busy. Again stop it
     221       * anyway if it doesn't go not busy in that time.
     222       */
     223      for (i=0; i<50000 && ahci_port_busy(ai, p); i++) udelay(1000);
     224
     225      /* stop port */
     226      writel(port_mmio + PORT_IRQ_MASK, 0); /* disable port interrupts */
     227      writel(port_mmio + PORT_CMD, readl(port_mmio + PORT_CMD) & ~PORT_CMD_FIS_RX); /* disable FIS reception */
     228      while (readl(port_mmio + PORT_CMD) & PORT_CMD_FIS_ON); /* wait for it to stop */
     229      writel(port_mmio + PORT_CMD, readl(port_mmio + PORT_CMD) & ~PORT_CMD_START); /* set port to idle */
     230      while (readl(port_mmio + PORT_CMD) & PORT_CMD_LIST_ON); /* wait for it to stop */
     231
     232      /* clear any pending port IRQs */
     233      tmp = readl(port_mmio + PORT_IRQ_STAT);
     234      if (tmp) writel(port_mmio + PORT_IRQ_STAT, tmp);
     235      writel(ai->mmio + HOST_IRQ_STAT, 1UL << p);
     236
     237      /* reset PxSACT register (tagged command queues, not reset by COMRESET) */
     238      writel(port_mmio + PORT_SCR_ACT, 0);
     239      readl(port_mmio + PORT_SCR_ACT);  /* flush */
     240
     241      #if 0
     242      ahci_start_port(ai, p, 0);
     243
     244      /* flush cache on all attached devices */
     245      for (d = 0; d <= ai->ports[p].dev_max; d++) {
     246        if (ai->ports[p].devs[d].present) {
     247          ahci_flush_cache(ai, p, d);
     248        }
     249      }
     250      #endif
     251    }
     252  }
     253
     254  init_complete = 0;
     255
     256  /* restore BIOS configuration for each adapter */
     257  for (a = 0; a < ad_info_cnt; a++) {
     258    ahci_restore_bios_config(ad_infos + a);
     259  }
     260
     261  dprintf("shutdown_driver() finished\n");
     262}
     263
  • trunk/src/os2ahci/ata.c

    r157 r160  
    277277
    278278  if (debug >= 2) {
    279     printf("ATA command for %d.%d.%d, slot %d:\n", ad_no(ai), p, d, slot);
     279    aprintf("ATA command for %d.%d.%d, slot %d:\n", ad_no(ai), p, d, slot);
    280280    phex(cmd_hdr, offsetof(AHCI_CMD_HDR, reserved), "cmd_hdr:   ");
    281281    phex(&ata_cmd, sizeof(ata_cmd), "ata_cmd:   ");
     
    480480{
    481481  GEOMETRY _far *geometry = ((IORB_GEOMETRY _far *) iorb)->pGeometry;
    482   AD_INFO *ai = ad_infos + iorb_unit_adapter(iorb);
    483   int p = iorb_unit_port(iorb);
    484   int d = iorb_unit_device(iorb);
    485482  ULONG sector;
    486483
     
    488485
    489486  if (use_lvm_info) {
     487    #ifdef DEBUG
     488    AD_INFO *ai = ad_infos + iorb_unit_adapter(iorb);
     489    int p = iorb_unit_port(iorb);
     490    int d = iorb_unit_device(iorb);
    490491    ddprintf("is_lvm_geometry (%d.%d.%d)\n", ad_no(ai), p, d);
     492    #endif
    491493
    492494    /* First check the sector reported by the hardware */
  • trunk/src/os2ahci/init.asm

    r157 r160  
    109109                EXTRN   _reset_ctxhook : NEAR     ; C reset context hook
    110110                EXTRN   _engine_ctxhook : NEAR    ; C engine context hook
    111                 EXTRN   _apm_suspend : NEAR       ; C routine for INT13 IO enable
     111                EXTRN   _shutdown_driver : NEAR   ; C routine for INT13 IO enable
    112112_TEXT           ENDS
    113113
     
    134134TGROUP          GROUP   _TEXT, CODE, LIBCODE, RMCode, _z_text
    135135
     136        .386
    136137
    137138; ----------------------------------------------------------------------------
     
    181182;  Kernel exit routine to enable INT13 I/O (called before a trap dump occurrs)
    182183_asm_krnl_exit  PROC    FAR
    183 
    184184                PUSH    ES
    185185                PUSH    DS
     
    189189
    190190                ;  call C routine
    191                 CALL    _apm_suspend
     191                CALL    _shutdown_driver
    192192
    193193                POP     DS
     
    469469__I4D           endp
    470470
    471                 .286
    472 
    473471_TEXT           ENDS
    474472
  • trunk/src/os2ahci/libc.c

    r159 r160  
    405405  if (debug) {
    406406    /* print the same message to COM1/trace as well */
    407     printf("%s", buf);
     407    aprintf("%s", buf);
    408408  }
    409409
     
    436436  /* print hex block */
    437437  while (len > 0) {
    438     printf_nts("%Fp ", buf);
     438    ntprintf("%Fp ", buf);
    439439
    440440    /* print hex block */
    441441    for (i = 0; i < 16; i++) {
    442442      if (i < len) {
    443         printf_nts("%c%02x", ((i == 8) ? '-' : ' '), buf[i]);
     443        ntprintf("%c%02x", ((i == 8) ? '-' : ' '), buf[i]);
    444444      } else {
    445         printf_nts("   ");
     445        ntprintf("   ");
    446446      }
    447447    }
    448448
    449449    /* print ASCII block */
    450     printf_nts("   ");
     450    ntprintf("   ");
    451451    for (i = 0; i < ((len > 16) ? 16 : len); i++) {
    452       printf_nts("%c", (buf[i] >= 32 && buf[i] < 128) ? buf[i] : '.');
    453     }
    454     printf_nts("\n");
     452      ntprintf("%c", (buf[i] >= 32 && buf[i] < 128) ? buf[i] : '.');
     453    }
     454    ntprintf("\n");
    455455
    456456    buf += 16;
  • trunk/src/os2ahci/os2ahci.c

    r157 r160  
    408408  }
    409409
    410   printf_nts("BldLevel: %s\n", BldLevel);
    411   printf_nts("CmdLine: %Fs\n", cmd_line);
     410  ntprintf("BldLevel: %s\n", BldLevel);
     411  ntprintf("CmdLine: %Fs\n", cmd_line);
    412412
    413413  /* scan PCI bus for supported devices */
     
    489489    break;
    490490
    491   case OS2AHCI_IDC_CATEGORY:
    492     switch (ioctl->Function) {
    493 
    494     case OS2AHCI_IDC_BIOSMODE:
    495       /* reconfigure adapters in BIOS/int13 mode; needed for generating
    496        * trap dumps on some machines. This was intended to be called by ACPI.PSD,
    497        * but that is never done. This is obslete. The kernel exit accomplishes
    498        * this instead.
    499        *
    500        * To enter BIOS mode, we flush all write caches, turn off interrupts
    501        * and restore the BIOS configuration. This is exactly what
    502        * apm_suspend() does.
    503        */
    504       apm_suspend();
    505       return(STDON);
    506 
    507     case OS2AHCI_IDC_BEEP:
    508       /* IOCTL for IDC testing - just beep */
    509       DevHelp_Beep(2000, 100);
    510       return(STDON);
    511     }
    512     break;
    513 
    514491  case DSKSP_CAT_GENERIC:
    515492    return(ioctl_gen_dsk(ioctl));
     
    552529  }
    553530
    554   apm_suspend();
     531  suspend();
    555532  return(STDON);
    556533}
     
    564541  dprintf("sr_drv(%d) called\n", func);
    565542
    566   if (func) apm_resume();
    567   else apm_suspend();
     543  if (func) resume();
     544  else suspend();
    568545
    569546  return(STDON);
     
    765742   * IORB.
    766743   */
     744  while (suspended) DevHelp_ProcBlock((ULONG)&send_iorb, 1, WAIT_IS_INTERRUPTABLE);
    767745  add_workspace(iorb)->processing = 1;
    768746  spin_unlock(drv_lock);
     
    12631241
    12641242    if (debug > min_debug) {
    1265       printf("IORB %Fp queued (cmd = %d/%d, queue = %Fp [%s], timeout = %ld)\n",
     1243      aprintf("IORB %Fp queued (cmd = %d/%d, queue = %Fp [%s], timeout = %ld)\n",
    12661244             iorb, iorb->CommandCode, iorb->CommandModifier, queue, queue_type,
    12671245             iorb->Timeout);
  • trunk/src/os2ahci/os2ahci.h

    r157 r160  
    3434 */
    3535
     36#define DEBUG
    3637#define INCL_NOPMAPI
    3738#define INCL_DOSINFOSEG
     
    104105
    105106/* debug output macros */
     107#ifdef DEBUG
    106108#define dprintf   if (debug > 0) printf
    107109#define dphex     if (debug > 0) phex
     
    110112#define dddprintf if (debug > 2) printf
    111113#define dddphex   if (debug > 2) phex
     114#define ntprintf printf_nts
     115#define aprintf printf
     116#else
     117#define dprintf(a,...)
     118#define dphex(a,b,c,...)
     119#define ddprintf(a,...)
     120#define ddphex(a,b,c,...)
     121#define dddprintf(a,...)
     122#define dddphex(a,b,c,...)
     123#define ntprintf(a,...)
     124#define aprintf(a,...)
     125#endif
    112126
    113127/* verbosity console print macros
     
    561575/* apm.c */
    562576extern void        apm_init           (void);
    563 extern void        apm_suspend        (void);
    564 extern void        apm_resume         (void);
     577extern void        suspend        (void);
     578extern void        resume         (void);
    565579
    566580/* ioctl.c */
  • trunk/src/os2ahci/trace.c

    r156 r160  
    235235    AD_INFO *ai = ad_infos + a;
    236236
    237     printf_nts("Adapter %d: %d:%d:%d irq=%d addr=0x%lx\n", a,
     237    ntprintf("Adapter %d: %d:%d:%d irq=%d addr=0x%lx\n", a,
    238238      ai->bus, ai->dev_func>>3, ai->dev_func&7,
    239239      ai->irq, ai->mmio_phys);
     
    242242      P_INFO *pi = &ai->ports[p];
    243243
    244       printf_nts("  Port %d:\n", p);
     244      ntprintf("  Port %d:\n", p);
    245245
    246246      for (d = 0; d <= pi->dev_max; d++) {
    247247        if (!pi->devs[d].present) continue;
    248         printf_nts("    Drive %d: atapi=%d, removable=%d\n", d, pi->devs[d].atapi, pi->devs[d].removable);
     248        ntprintf("    Drive %d: atapi=%d, removable=%d\n", d, pi->devs[d].atapi, pi->devs[d].removable);
    249249      }
    250250    }
Note: See TracChangeset for help on using the changeset viewer.