Ignore:
Timestamp:
Nov 29, 2016, 5:30:22 AM (9 years ago)
Author:
David Azarewicz
Message:

Major reorganization

File:
1 edited

Legend:

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

    r176 r178  
    44 * Copyright (c) 2011 thi.guten Software Development
    55 * Copyright (c) 2011 Mensys B.V.
    6  * Portions copyright (c) 2013-2015 David Azarewicz
     6 * Portions copyright (c) 2013-2016 David Azarewicz
    77 *
    88 * Authors: Christian Mueller, Markus Thielen
     
    3434
    3535#include <apmcalls.h>
    36 USHORT _far _cdecl apm_event    (APMEVENT _far *evt);
     36USHORT _cdecl apm_event    (APMEVENT *evt);
    3737
    3838/******************************************************************************
     
    4545  /* connect to APM driver */
    4646  if ((rc = APMAttach()) != 0) {
    47     dprintf("couldn't connect to APM driver (rc = %d)\n", rc);
     47    DPRINTF(2,"couldn't connect to APM driver (rc = %d)\n", rc);
    4848    return;
    4949  }
     
    5353                                   APM_NOTIFYNORMRESUME |
    5454                                   APM_NOTIFYCRITRESUME, 0)) != 0) {
    55     dprintf("couldn't register for power event notificatins (rc = %d)\n", rc);
     55    DPRINTF(2,"couldn't register for power event notificatins (rc = %d)\n", rc);
    5656    return;
    5757  }
     
    6161 * APM event handler
    6262 */
    63 USHORT _far _cdecl apm_event(APMEVENT _far *evt)
     63USHORT _cdecl apm_event(APMEVENT *evt)
    6464{
    6565  USHORT msg = (USHORT) evt->ulParm1;
    6666
    67   dprintf("received APM event: 0x%lx/0x%lx\n");
     67  DPRINTF(2,"received APM event: 0x%x/0x%x\n");
    6868
    6969  switch (msg) {
     
    8383
    8484  default:
    85     dprintf("unknown APM event; ignoring...\n");
     85    DPRINTF(2,"unknown APM event; ignoring...\n");
    8686    break;
    8787  }
     
    103103
    104104  if (suspended) return;
    105   dprintf("suspend()\n");
     105  DPRINTF(2,"suspend()\n");
    106106
    107107  /* restart all ports with interrupts disabled */
     
    112112    for (p = 0; p <= ai->port_max; p++) {
    113113      /* wait until all active commands have completed on this port */
    114       timer_init(&Timer, 250);
     114      TimerInit(&Timer, 250);
    115115      while (ahci_port_busy(ai, p)) {
    116         if (timer_check_and_block(&Timer)) break;
     116        if (TimerCheckAndBlock(&Timer)) break;
    117117      }
    118118
     
    142142
    143143  suspended = 1;
    144   dprintf("suspend() finished\n");
     144  DPRINTF(2,"suspend() finished\n");
    145145}
    146146
     
    154154
    155155  if (!suspended) return;
    156   dprintf("resume()\n");
     156  DPRINTF(2,"resume()\n");
    157157
    158158  for (a = 0; a < ad_info_cnt; a++) {
     
    188188   */
    189189  resume_sleep_flag = 5000;
    190   DevHelp_ArmCtxHook(0, engine_ctxhook_h);
    191 
    192   dprintf("resume() finished\n");
     190  KernArmHook(engine_ctxhook_h, 0, 0);
     191
     192  DPRINTF(2,"resume() finished\n");
    193193}
    194194
     
    207207  //int d;
    208208
    209   dprintf("shutdown_driver() enter\n");
    210 
    211   for (a = 0; a < ad_info_cnt; a++) {
     209  DPRINTF(1,"shutdown_driver() enter\n");
     210
     211  for (a = 0; a < ad_info_cnt; a++)
     212  {
    212213    AD_INFO *ai = ad_infos + a;
    213214
     
    217218    for (i=0; i<50000 && ai->busy; i++) udelay(1000);
    218219
    219     for (p = 0; p <= ai->port_max; p++) {
    220       u8 _far *port_mmio = port_base(ai, p);
     220    for (p = 0; p <= ai->port_max; p++)
     221    {
     222      u8 *port_mmio = port_base(ai, p);
    221223
    222224      /* Wait up to 50ms for port to go not busy. Again stop it
     
    246248
    247249      /* flush cache on all attached devices */
    248       for (d = 0; d <= ai->ports[p].dev_max; d++) {
    249         if (ai->ports[p].devs[d].present) {
     250      for (d = 0; d <= ai->ports[p].dev_max; d++)
     251      {
     252        if (ai->ports[p].devs[d].present)
     253        {
    250254          ahci_flush_cache(ai, p, d);
    251255        }
     
    258262
    259263  /* restore BIOS configuration for each adapter */
    260   for (a = 0; a < ad_info_cnt; a++) {
     264  for (a = 0; a < ad_info_cnt; a++)
     265  {
    261266    ahci_restore_bios_config(ad_infos + a);
    262267  }
    263268
    264   dprintf("shutdown_driver() finished\n");
    265 }
    266 
     269  DPRINTF(1,"shutdown_driver() finished\n");
     270}
     271
Note: See TracChangeset for help on using the changeset viewer.