Ticket #4459: acpi_reboot.diff
File acpi_reboot.diff, 2.6 KB (added by , 15 years ago) |
---|
-
src/system/kernel/arch/x86/arch_cpu.cpp
103 103 104 104 105 105 static status_t 106 acpi_shutdown( void)106 acpi_shutdown(bool rebootSystem) 107 107 { 108 108 if (debug_debugger_running()) 109 109 return B_ERROR; … … 112 112 if (get_module(B_ACPI_MODULE_NAME, (module_info**)&acpi) != B_OK) 113 113 return B_NOT_SUPPORTED; 114 114 115 if (rebootSystem) 116 return acpi->reboot(); 117 115 118 status_t status = acpi->prepare_sleep_state(ACPI_POWER_STATE_OFF, NULL, 0); 116 119 if (status == B_OK) { 117 120 //cpu_status state = disable_interrupts(); … … 822 825 status_t 823 826 arch_cpu_shutdown(bool rebootSystem) 824 827 { 825 if (!rebootSystem) { 826 status_t status = acpi_shutdown(); 827 if (status != B_OK) 828 status = apm_shutdown(); 829 830 return status; 831 } 832 828 acpi_shutdown(rebootSystem); 829 830 if (!rebootSystem) 831 return apm_shutdown(); 832 833 833 cpu_status state = disable_interrupts(); 834 834 835 835 // try to reset the system using the keyboard controller -
src/add-ons/kernel/bus_managers/acpi/acpi_busman.c
1 1 /* 2 * Copyright 2009, Vincent Duvert, vincent.duvert@free.fr 2 3 * Copyright 2009, Clemens Zeidler, haiku@clemens-zeidler.de 3 4 * Copyright 2008, Axel Dörfler, axeld@pinc-software.de. 4 5 * Copyright 2006, Bryan Varner. All rights reserved. … … 533 534 } 534 535 535 536 537 static status_t 538 reboot(void) 539 { 540 ACPI_STATUS status; 541 542 TRACE("reboot\n"); 543 544 if (AcpiGbl_FADT.Flags & ACPI_FADT_RESET_REGISTER == 0) 545 return B_UNSUPPORTED; 546 547 status = AcpiHwLowLevelWrite(AcpiGbl_FADT.ResetRegister.BitWidth, 548 AcpiGbl_FADT.ResetValue, &AcpiGbl_FADT.ResetRegister); 549 550 if (status != AE_OK) { 551 ERROR("Reset failed, status = %d\n", status); 552 return B_ERROR; 553 } 554 555 snooze(1000000); 556 ERROR("Reset failed, timeout\n"); 557 return B_ERROR; 558 } 559 536 560 struct acpi_module_info gACPIModule = { 537 561 { 538 562 B_ACPI_MODULE_NAME, … … 566 590 evaluate_object, 567 591 evaluate_method, 568 592 prepare_sleep_state, 569 enter_sleep_state 593 enter_sleep_state, 594 reboot 570 595 }; -
headers/os/drivers/ACPI.h
224 224 status_t (*prepare_sleep_state)(uint8 state, void (*wakeFunc)(void), 225 225 size_t size); 226 226 status_t (*enter_sleep_state)(uint8 state); 227 status_t (*reboot)(void); 227 228 }; 228 229 229 230