ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

acpi_system_save_state - save OS specific state and power down devices : sleep state we're entering.

This handles saving all context to memory, and possibly disk. First, we call to the device driver layer to save device state. Once we have that, we save whatevery processor and kernel state we need to memory. If we're entering S4, we then write the memory image to disk.

Only then it is safe for us to power down devices, since we may need the disks and upstream buses to write to.

Definition at line 219 of file system.c.

{
    int         error = 0;

    /* Send notification to devices that they will be suspended.
     * If any device or driver cannot make the transition, either up
     * or down, we'll get an error back.
     */
    /*if (state > ACPI_STATE_S1) {
        error = pm_send_all(PM_SAVE_STATE, (void *)3);
        if (error)
            return AE_ERROR;
    }*/

    //if (state <= ACPI_STATE_S5) {
    //  /* Tell devices to stop I/O and actually save their state.
    //   * It is theoretically possible that something could fail,
    //   * so handle that gracefully..
    //   */
    //  if (state > ACPI_STATE_S1 && state != ACPI_STATE_S5) {
    //      error = pm_send_all(PM_SUSPEND, (void *)3);
    //      if (error) {
    //          /* Tell devices to restore state if they have
    //           * it saved and to start taking I/O requests.
    //           */
    //          pm_send_all(PM_RESUME, (void *)0);
    //          return error;
    //      }
    //  }
        
        /* flush caches */
        ACPI_FLUSH_CPU_CACHE();

        /* Do arch specific saving of state. */
        if (state > ACPI_STATE_S1) {
            error = 0;//acpi_save_state_mem();

            /* TBD: if no s4bios, write codes for
             * acpi_save_state_disk()...
             */
#if 0
            if (!error && (state == ACPI_STATE_S4))
                error = acpi_save_state_disk();
#endif
            /*if (error) {
                pm_send_all(PM_RESUME, (void *)0);
                return error;
            }*/
        }
    //}
    /* disable interrupts
     * Note that acpi_suspend -- our caller -- will do this once we return.
     * But, we want it done early, so we don't get any suprises during
     * the device suspend sequence.
     */
    //ACPI_DISABLE_IRQS();

    /* Unconditionally turn off devices.
     * Obvious if we enter a sleep state.
     * If entering S5 (soft off), this should put devices in a
     * quiescent state.
     */

    //if (state > ACPI_STATE_S1) {
    //  error = pm_send_all(PM_SUSPEND, (void *)3);

    //  /* We're pretty screwed if we got an error from this.
    //   * We try to recover by simply calling our own restore_state
    //   * function; see above for definition.
    //   *
    //   * If it's S5 though, go through with it anyway..
    //   */
    //  if (error && state != ACPI_STATE_S5)
    //      acpi_system_restore_state(state);
    //}
    return error ? AE_ERROR : AE_OK;
}

Generated on Sun May 27 2012 04:40:11 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.