[haiku-commits] r37202 - haiku/trunk/src/add-ons/kernel/bus_managers/acpi

  • From: ingo_weinhold@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 21 Jun 2010 19:15:52 +0200 (CEST)

Author: bonefish
Date: 2010-06-21 19:15:52 +0200 (Mon, 21 Jun 2010)
New Revision: 37202
Changeset: http://dev.haiku-os.org/changeset/37202/haiku

Modified:
   haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_busman.c
Log:
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.


Modified: haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_busman.c
===================================================================
--- haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_busman.c      
2010-06-21 16:47:29 UTC (rev 37201)
+++ haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_busman.c      
2010-06-21 17:15:52 UTC (rev 37202)
@@ -569,28 +569,36 @@
 static status_t
 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);
 
        if (state != ACPI_POWER_STATE_OFF) {
                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)
                        return status;
 
-               status = get_memory_map(&wakeFunc, size, &wakeVector, 1);
-               if (status != B_OK)
-                       return status;
-
-               status = AcpiSetFirmwareWakingVector(wakeVector.address);
-               if (status != AE_OK)
+#if ACPI_MACHINE_WIDTH == 32
+#      if B_HAIKU_PHYSICAL_BITS > 32
+               if (wakeVector.address >= 0x100000000LL) {
+                       ERROR("prepare_sleep_state(): ACPI_MACHINE_WIDTH == 32, 
but we "
+                               "have a physical address >= 4 GB\n");
+               }
+#      endif
+               acpiStatus = AcpiSetFirmwareWakingVector(wakeVector.address);
+#else
+               acpiStatus = AcpiSetFirmwareWakingVector64(wakeVector.address);
+#endif
+               if (acpiStatus != AE_OK)
                        return B_ERROR;
        }
 
-       status = AcpiEnterSleepStatePrep(state);
-       if (status != AE_OK)
+       acpiStatus = AcpiEnterSleepStatePrep(state);
+       if (acpiStatus != AE_OK)
                return B_ERROR;
 
        return B_OK;


Other related posts:

  • » [haiku-commits] r37202 - haiku/trunk/src/add-ons/kernel/bus_managers/acpi - ingo_weinhold