prepare_sleep_state():
* Use the respective error types for OS and ACPICA functions. * Don't lock the memory. The caller must do that, since there's no balancing function that would unlock the memory again. * Get the memory map of the given function, not of the on-stack variable. * Added 64 bit support and a check for the PAE case. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37202 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -569,28 +569,36 @@ get_irq_routing_table(acpi_handle busDeviceHandle, acpi_data *retBuffer)
|
|||||||
static status_t
|
static status_t
|
||||||
prepare_sleep_state(uint8 state, void (*wakeFunc)(void), size_t size)
|
prepare_sleep_state(uint8 state, void (*wakeFunc)(void), size_t size)
|
||||||
{
|
{
|
||||||
ACPI_STATUS status;
|
ACPI_STATUS acpiStatus;
|
||||||
|
|
||||||
TRACE("prepare_sleep_state %d, %p, %ld\n", state, wakeFunc, size);
|
TRACE("prepare_sleep_state %d, %p, %ld\n", state, wakeFunc, size);
|
||||||
|
|
||||||
if (state != ACPI_POWER_STATE_OFF) {
|
if (state != ACPI_POWER_STATE_OFF) {
|
||||||
physical_entry wakeVector;
|
physical_entry wakeVector;
|
||||||
|
status_t status;
|
||||||
|
|
||||||
status = lock_memory(&wakeFunc, size, 0);
|
// Note: The supplied code must already be locked into memory.
|
||||||
|
status = get_memory_map(wakeFunc, size, &wakeVector, 1);
|
||||||
if (status != B_OK)
|
if (status != B_OK)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
status = get_memory_map(&wakeFunc, size, &wakeVector, 1);
|
#if ACPI_MACHINE_WIDTH == 32
|
||||||
if (status != B_OK)
|
# if B_HAIKU_PHYSICAL_BITS > 32
|
||||||
return status;
|
if (wakeVector.address >= 0x100000000LL) {
|
||||||
|
ERROR("prepare_sleep_state(): ACPI_MACHINE_WIDTH == 32, but we "
|
||||||
status = AcpiSetFirmwareWakingVector(wakeVector.address);
|
"have a physical address >= 4 GB\n");
|
||||||
if (status != AE_OK)
|
}
|
||||||
|
# endif
|
||||||
|
acpiStatus = AcpiSetFirmwareWakingVector(wakeVector.address);
|
||||||
|
#else
|
||||||
|
acpiStatus = AcpiSetFirmwareWakingVector64(wakeVector.address);
|
||||||
|
#endif
|
||||||
|
if (acpiStatus != AE_OK)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = AcpiEnterSleepStatePrep(state);
|
acpiStatus = AcpiEnterSleepStatePrep(state);
|
||||||
if (status != AE_OK)
|
if (acpiStatus != AE_OK)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|||||||
Reference in New Issue
Block a user