Changeset 178 for trunk/src/os2ahci/apm.c
- Timestamp:
- Nov 29, 2016, 5:30:22 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/os2ahci/apm.c
r176 r178 4 4 * Copyright (c) 2011 thi.guten Software Development 5 5 * Copyright (c) 2011 Mensys B.V. 6 * Portions copyright (c) 2013-201 5David Azarewicz6 * Portions copyright (c) 2013-2016 David Azarewicz 7 7 * 8 8 * Authors: Christian Mueller, Markus Thielen … … 34 34 35 35 #include <apmcalls.h> 36 USHORT _ far _cdecl apm_event (APMEVENT _far*evt);36 USHORT _cdecl apm_event (APMEVENT *evt); 37 37 38 38 /****************************************************************************** … … 45 45 /* connect to APM driver */ 46 46 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); 48 48 return; 49 49 } … … 53 53 APM_NOTIFYNORMRESUME | 54 54 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); 56 56 return; 57 57 } … … 61 61 * APM event handler 62 62 */ 63 USHORT _ far _cdecl apm_event(APMEVENT _far*evt)63 USHORT _cdecl apm_event(APMEVENT *evt) 64 64 { 65 65 USHORT msg = (USHORT) evt->ulParm1; 66 66 67 dprintf("received APM event: 0x%lx/0x%lx\n");67 DPRINTF(2,"received APM event: 0x%x/0x%x\n"); 68 68 69 69 switch (msg) { … … 83 83 84 84 default: 85 dprintf("unknown APM event; ignoring...\n");85 DPRINTF(2,"unknown APM event; ignoring...\n"); 86 86 break; 87 87 } … … 103 103 104 104 if (suspended) return; 105 dprintf("suspend()\n");105 DPRINTF(2,"suspend()\n"); 106 106 107 107 /* restart all ports with interrupts disabled */ … … 112 112 for (p = 0; p <= ai->port_max; p++) { 113 113 /* wait until all active commands have completed on this port */ 114 timer_init(&Timer, 250);114 TimerInit(&Timer, 250); 115 115 while (ahci_port_busy(ai, p)) { 116 if ( timer_check_and_block(&Timer)) break;116 if (TimerCheckAndBlock(&Timer)) break; 117 117 } 118 118 … … 142 142 143 143 suspended = 1; 144 dprintf("suspend() finished\n");144 DPRINTF(2,"suspend() finished\n"); 145 145 } 146 146 … … 154 154 155 155 if (!suspended) return; 156 dprintf("resume()\n");156 DPRINTF(2,"resume()\n"); 157 157 158 158 for (a = 0; a < ad_info_cnt; a++) { … … 188 188 */ 189 189 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"); 193 193 } 194 194 … … 207 207 //int d; 208 208 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 { 212 213 AD_INFO *ai = ad_infos + a; 213 214 … … 217 218 for (i=0; i<50000 && ai->busy; i++) udelay(1000); 218 219 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); 221 223 222 224 /* Wait up to 50ms for port to go not busy. Again stop it … … 246 248 247 249 /* 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 { 250 254 ahci_flush_cache(ai, p, d); 251 255 } … … 258 262 259 263 /* 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 { 261 266 ahci_restore_bios_config(ad_infos + a); 262 267 } 263 268 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.