* Divided enter_sleep_state() to have a prepare_sleep_state() that accepts a

wake vector (not tested at all).
* Removed disabling interrupts when entering the sleep state - looks like
  ACPI still needs memory then.
* Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27403 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2008-09-10 19:24:37 +00:00
parent 7adf6ce100
commit a181d013aa
5 changed files with 436 additions and 406 deletions
+69 -50
View File
@@ -1,57 +1,64 @@
/* ACPI Bus Manger Interface
* Copyright 2005, Haiku Inc. All Rights Reserved.
* Distributed under the terms of the MIT License
/*
* Copyright 2005-2008, Haiku Inc. All Rights Reserved.
* Distributed under the terms of the MIT License
*/
#ifndef _ACPI_H
#define _ACPI_H
#include <device_manager.h>
#include <bus_manager.h>
#include <KernelExport.h>
typedef struct acpi_module_info acpi_module_info;
typedef struct acpi_object_type acpi_object_type;
#define B_ACPI_MODULE_NAME "bus_managers/acpi/v1"
struct acpi_module_info {
bus_manager_info binfo;
module_info info;
/* Fixed Event Management */
void (*enable_fixed_event) (uint32 event);
void (*disable_fixed_event) (uint32 event);
uint32 (*fixed_event_status) (uint32 event);
/* Returns 1 if event set, 0 otherwise */
void (*reset_fixed_event) (uint32 event);
status_t (*install_fixed_event_handler) (uint32 event, interrupt_handler *handler, void *data);
status_t (*remove_fixed_event_handler) (uint32 event, interrupt_handler *handler);
void (*enable_fixed_event)(uint32 event);
void (*disable_fixed_event)(uint32 event);
uint32 (*fixed_event_status) (uint32 event);
/* Returns 1 if event set, 0 otherwise */
void (*reset_fixed_event) (uint32 event);
status_t (*install_fixed_event_handler)(uint32 event,
interrupt_handler *handler, void *data);
status_t (*remove_fixed_event_handler)(uint32 event,
interrupt_handler *handler);
/* Namespace Access */
status_t (*get_next_entry) (uint32 object_type, const char *base, char *result, size_t len, void **counter);
status_t (*get_device) (const char *hid, uint32 index, char *result);
status_t (*get_device_hid) (const char *path, char *hid);
uint32 (*get_object_type) (const char *path);
status_t (*get_object) (const char *path, acpi_object_type **return_value);
status_t (*get_object_typed) (const char *path, acpi_object_type **return_value, uint32 object_type);
status_t (*get_next_entry)(uint32 objectType, const char *base,
char *result, size_t length, void **_counter);
status_t (*get_device)(const char *hid, uint32 index, char *result,
size_t resultLength);
status_t (*get_device_hid)(const char *path, char *hid);
uint32 (*get_object_type)(const char *path);
status_t (*get_object)(const char *path,
acpi_object_type **_returnValue);
status_t (*get_object_typed)(const char *path,
acpi_object_type **_returnValue, uint32 objectType);
/* Control method execution and data acquisition */
status_t (*evaluate_object) (const char *object, acpi_object_type *return_value, size_t buf_len);
status_t (*evaluate_method) (const char *object, const char *method, acpi_object_type *return_value, size_t buf_len, acpi_object_type *args, int num_args);
status_t (*evaluate_object)(const char *object,
acpi_object_type *returnValue, size_t bufferLength);
status_t (*evaluate_method)(const char *object, const char *method,
acpi_object_type *returnValue, size_t bufferLength,
acpi_object_type *args, int numArgs);
/* Power state setting */
status_t (*enter_sleep_state) (uint8 state);
/* Sleep state values:
0: On (Working)
1: Sleep
2: Software Off
3: Mechanical Off
4: Hibernate
5: Software Off */
status_t (*prepare_sleep_state)(uint8 state, void (*wakeFunc)(void),
size_t size);
status_t (*enter_sleep_state)(uint8 state);
};
@@ -107,7 +114,7 @@ struct acpi_object_type {
} package;
struct {
uint32 cpu_id;
int pblk_address;
size_t pblk_length;
} processor;
@@ -118,13 +125,23 @@ struct acpi_object_type {
} data;
};
#endif
#endif // __ACTYPES_H__
#define B_ACPI_MODULE_NAME "bus_managers/acpi/v1"
/* Sleep states */
#define ACPI_DEVICE_HID_ITEM "acpi/hid"
#define ACPI_DEVICE_PATH_ITEM "acpi/path"
#define ACPI_DEVICE_TYPE_ITEM "acpi/type"
enum {
ACPI_POWER_STATE_ON = 0,
ACPI_POWER_STATE_SLEEP_S1,
ACPI_POWER_STATE_SLEEP_S2,
ACPI_POWER_STATE_SLEEP_S3,
ACPI_POWER_STATE_HIBERNATE,
ACPI_POWER_STATE_OFF
};
#define ACPI_DEVICE_HID_ITEM "acpi/hid"
#define ACPI_DEVICE_PATH_ITEM "acpi/path"
#define ACPI_DEVICE_TYPE_ITEM "acpi/type"
typedef struct acpi_device_info *acpi_device;
@@ -134,13 +151,15 @@ typedef struct acpi_device_module_info {
driver_module_info info;
/* Namespace Access */
uint32 (*get_object_type) (acpi_device device);
status_t (*get_object) (acpi_device device, const char *path, acpi_object_type **return_value);
uint32 (*get_object_type)(acpi_device device);
status_t (*get_object)(acpi_device device, const char *path,
acpi_object_type **_returnValue);
/* Control method execution and data acquisition */
status_t (*evaluate_method) (acpi_device device, const char *method, acpi_object_type *return_value, size_t buf_len, acpi_object_type *args, int num_args);
status_t (*evaluate_method)(acpi_device device, const char *method,
acpi_object_type *returnValue, size_t bufferLength,
acpi_object_type *args, int numArgs);
} acpi_device_module_info;
#endif /* _ACPI_H */
#endif /* _ACPI_H */