void apm_suspend(int state) { extern int perflevel; int s; #if NWSDISPLAY > 0 wsdisplay_suspend(); #endif /* NWSDISPLAY > 0 */ bufq_quiesce(); config_suspend(TAILQ_FIRST(&alldevs), DVACT_QUIESCE); s = splhigh(); disable_intr(); config_suspend(TAILQ_FIRST(&alldevs), DVACT_SUSPEND); /* XXX * Flag to disk drivers that they should "power down" the disk * when we get to DVACT_POWERDOWN. */ boothowto |= RB_POWERDOWN; config_suspend(TAILQ_FIRST(&alldevs), DVACT_POWERDOWN); boothowto &= ~RB_POWERDOWN; /* Send machine to sleep */ apm_set_powstate(APM_DEV_ALLDEVS, state); /* Wake up */ /* They say that some machines may require reinitializing the clocks */ i8254_startclock(); if (initclock_func == i8254_initclocks) rtcstart(); /* in i8254 mode, rtc is profclock */ inittodr(time_second); config_suspend(TAILQ_FIRST(&alldevs), DVACT_RESUME); enable_intr(); splx(s); /* restore hw.setperf */ if (cpu_setperf != NULL) cpu_setperf(perflevel); bufq_restart(); config_suspend(TAILQ_FIRST(&alldevs), DVACT_WAKEUP); #if NWSDISPLAY > 0 wsdisplay_resume(); #endif /* NWSDISPLAY > 0 */ }
void apm_suspend(struct pxa2x0_apm_softc *sc) { int s; #if NWSDISPLAY > 0 wsdisplay_suspend(); #endif /* NWSDISPLAY > 0 */ resettodr(); if (sc->sc_suspend == NULL) pxa2x0_wakeup_config(PXA2X0_WAKEUP_ALL, 1); else sc->sc_suspend(sc); s = splhigh(); config_suspend(TAILQ_FIRST(&alldevs), DVACT_SUSPEND); splx(s); pxa2x0_apm_sleep(sc); }
void apm_resume(struct pxa2x0_apm_softc *sc) { int s; s = splhigh(); config_suspend(TAILQ_FIRST(&alldevs), DVACT_RESUME); splx(s); inittodr(0); /* * Clear the OTG Peripheral hold after running the pxaudc and pxaohci * ca_activate to re-enable their operation. See 3.8.1.2 */ /* XXX ifdef NPXAUDC > 0 */ bus_space_write_4(sc->sc_iot, sc->sc_pm_ioh, POWMAN_PSSR, PSSR_OTGPH); bufq_restart(); #if NWSDISPLAY > 0 wsdisplay_resume(); #endif /* NWSDISPLAY > 0 */ }
int scsi_activate_lun(struct scsibus_softc *sc, int target, int lun, int act) { struct scsi_link *link; struct device *dev; int rv = 0; link = scsi_get_link(sc, target, lun); if (link == NULL) return (0); dev = link->device_softc; switch (act) { case DVACT_DEACTIVATE: atomic_setbits_int(&link->state, SDEV_S_DYING); config_deactivate(dev); break; default: rv = config_suspend(dev, act); break; } return (rv); }
void boot(int howto) { struct device *mainbus; if (cold) { /* * If the system is cold, just halt, unless the user * explicitely asked for reboot. */ if ((howto & RB_USERREQ) == 0) howto |= RB_HALT; goto haltsys; } /* * If RB_NOSYNC was not specified sync the discs. * Note: Unless cold is set to 1 here, syslogd will die during the * unmount. It looks like syslogd is getting woken up only to find * that it cannot page part of the binary in as the filesystem has * been unmounted. */ if (!(howto & RB_NOSYNC)) bootsync(howto); if_downall(); uvm_shutdown(); /* Say NO to interrupts */ splhigh(); /* Do a dump if requested. */ if ((howto & (RB_DUMP | RB_HALT)) == RB_DUMP) dumpsys(); haltsys: doshutdownhooks(); mainbus = device_mainbus(); if (mainbus != NULL) config_suspend(mainbus, DVACT_POWERDOWN); /* Make sure IRQ's are disabled */ IRQdisable; if (howto & RB_HALT) { if (howto & RB_POWERDOWN) { board_powerdown(); printf("WARNING: powerdown failed!\n"); } printf("The operating system has halted.\n"); printf("Please press any key to reboot.\n\n"); cnpollc(1); cngetc(); cnpollc(0); } printf("rebooting...\n"); board_reset(); cpu_reset(); printf("reboot failed; spinning\n"); while(1); /*NOTREACHED*/ }
void boot(int howto) { struct device *mainbus; if (cold) { if ((howto & RB_USERREQ) == 0) howto |= RB_HALT; goto haltsys; } boothowto = howto; if ((howto & RB_NOSYNC) == 0) { vfs_shutdown(); /* * If we've been adjusting the clock, the todr * will be out of synch; adjust it now. */ if ((howto & RB_TIMEBAD) == 0) resettodr(); else printf("WARNING: not updating battery clock\n"); } if_downall(); uvm_shutdown(); splhigh(); /* Disable interrupts. */ /* Do a dump if requested. */ if (howto & RB_DUMP) dumpsys(); haltsys: doshutdownhooks(); mainbus = device_mainbus(); if (mainbus != NULL) config_suspend(mainbus, DVACT_POWERDOWN); if ((howto & RB_POWERDOWN) == RB_POWERDOWN) { _reg_write_1(LANDISK_PWRMNG, PWRMNG_POWEROFF); delay(1 * 1000 * 1000); printf("POWEROFF FAILED!\n"); howto |= RB_HALT; } if (howto & RB_HALT) { printf("\n"); printf("The operating system has halted.\n"); printf("Please press any key to reboot.\n\n"); cnpollc(1); cngetc(); cnpollc(0); } printf("rebooting...\n"); machine_reset(); /*NOTREACHED*/ for (;;) { continue; } }