1 /* ACPI Bus Manger Interface 2 * Copyright 2005, Haiku Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License 4 */ 5 6 #ifndef _ACPI_H 7 #define _ACPI_H 8 9 #include <bus_manager.h> 10 #include <KernelExport.h> 11 12 typedef struct acpi_module_info acpi_module_info; 13 typedef struct acpi_object_type acpi_object_type; 14 15 struct acpi_module_info { 16 bus_manager_info binfo; 17 18 /* Fixed Event Management */ 19 20 void (*enable_fixed_event) (uint32 event); 21 void (*disable_fixed_event) (uint32 event); 22 23 uint32 (*fixed_event_status) (uint32 event); 24 /* Returns 1 if event set, 0 otherwise */ 25 void (*reset_fixed_event) (uint32 event); 26 27 status_t (*install_fixed_event_handler) (uint32 event, interrupt_handler *handler, void *data); 28 status_t (*remove_fixed_event_handler) (uint32 event, interrupt_handler *handler); 29 30 /* Namespace Access */ 31 32 status_t (*get_next_entry) (uint32 object_type, const char *base, char *result, size_t len, void **counter); 33 status_t (*get_device) (const char *hid, uint32 index, char *result); 34 35 status_t (*get_device_hid) (const char *path, char *hid); 36 uint32 (*get_object_type) (const char *path); 37 38 /* Control method execution and data acquisition */ 39 40 status_t (*evaluate_object) (const char *object, acpi_object_type *return_value, size_t buf_len); 41 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); 42 /* Power state setting */ 43 44 status_t (*enter_sleep_state) (uint8 state); 45 /* Sleep state values: 46 0: On (Working) 47 1: Sleep 48 2: Software Off 49 3: Mechanical Off 50 4: Hibernate 51 5: Software Off */ 52 }; 53 54 55 #ifndef __ACTYPES_H__ 56 57 /* ACPI fixed event types */ 58 59 enum { 60 ACPI_EVENT_PMTIMER = 0, 61 ACPI_EVENT_GLOBAL, 62 ACPI_EVENT_POWER_BUTTON, 63 ACPI_EVENT_SLEEP_BUTTON, 64 ACPI_EVENT_RTC 65 }; 66 67 /* ACPI Object Types */ 68 69 enum { 70 ACPI_TYPE_ANY = 0, 71 ACPI_TYPE_INTEGER, 72 ACPI_TYPE_STRING, 73 ACPI_TYPE_BUFFER, 74 ACPI_TYPE_PACKAGE, 75 ACPI_TYPE_FIELD_UNIT, 76 ACPI_TYPE_DEVICE, 77 ACPI_TYPE_EVENT, 78 ACPI_TYPE_METHOD, 79 ACPI_TYPE_MUTEX, 80 ACPI_TYPE_REGION, 81 ACPI_TYPE_POWER, 82 ACPI_TYPE_PROCESSOR, 83 ACPI_TYPE_THERMAL, 84 ACPI_TYPE_BUFFER_FIELD 85 }; 86 87 /* ACPI control method arg type */ 88 89 struct acpi_object_type { 90 uint32 object_type; 91 union { 92 uint32 integer; 93 struct { 94 uint32 len; 95 char *string; /* You have to allocate string space yourself */ 96 } string; 97 struct { 98 size_t length; 99 void *buffer; 100 } buffer; 101 struct { 102 uint32 count; 103 acpi_object_type *objects; 104 } package; 105 struct { 106 uint32 cpu_id; 107 108 int pblk_address; 109 size_t pblk_length; 110 } processor; 111 struct { 112 uint32 min_power_state; 113 uint32 resource_order; 114 } power_resource; 115 } data; 116 }; 117 118 #endif 119 120 #define B_ACPI_MODULE_NAME "bus_managers/acpi/v1" 121 122 #endif /* _ACPI_H */ 123