1 2 /****************************************************************************** 3 * 4 * Name: acpixf.h - External interfaces to the ACPI subsystem 5 * 6 *****************************************************************************/ 7 8 /* 9 * Copyright (C) 2000 - 2004, R. Byron Moore 10 * All rights reserved. 11 * 12 * Redistribution and use in source and binary forms, with or without 13 * modification, are permitted provided that the following conditions 14 * are met: 15 * 1. Redistributions of source code must retain the above copyright 16 * notice, this list of conditions, and the following disclaimer, 17 * without modification. 18 * 2. Redistributions in binary form must reproduce at minimum a disclaimer 19 * substantially similar to the "NO WARRANTY" disclaimer below 20 * ("Disclaimer") and any redistribution must be conditioned upon 21 * including a substantially similar Disclaimer requirement for further 22 * binary redistribution. 23 * 3. Neither the names of the above-listed copyright holders nor the names 24 * of any contributors may be used to endorse or promote products derived 25 * from this software without specific prior written permission. 26 * 27 * Alternatively, this software may be distributed under the terms of the 28 * GNU General Public License ("GPL") version 2 as published by the Free 29 * Software Foundation. 30 * 31 * NO WARRANTY 32 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 33 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 34 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 35 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 36 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 37 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 38 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 39 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 40 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 41 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 42 * POSSIBILITY OF SUCH DAMAGES. 43 */ 44 45 46 #ifndef __ACXFACE_H__ 47 #define __ACXFACE_H__ 48 49 #include "actypes.h" 50 #include "actbl.h" 51 52 53 /* 54 * Global interfaces 55 */ 56 57 acpi_status 58 acpi_initialize_subsystem ( 59 void); 60 61 acpi_status 62 acpi_enable_subsystem ( 63 u32 flags); 64 65 acpi_status 66 acpi_initialize_objects ( 67 u32 flags); 68 69 acpi_status 70 acpi_terminate ( 71 void); 72 73 acpi_status 74 acpi_subsystem_status ( 75 void); 76 77 acpi_status 78 acpi_enable ( 79 void); 80 81 acpi_status 82 acpi_disable ( 83 void); 84 85 acpi_status 86 acpi_get_system_info ( 87 struct acpi_buffer *ret_buffer); 88 89 const char * 90 acpi_format_exception ( 91 acpi_status exception); 92 93 acpi_status 94 acpi_purge_cached_objects ( 95 void); 96 97 acpi_status 98 acpi_install_initialization_handler ( 99 acpi_init_handler handler, 100 u32 function); 101 102 /* 103 * ACPI Memory manager 104 */ 105 106 void * 107 acpi_allocate ( 108 u32 size); 109 110 void * 111 acpi_callocate ( 112 u32 size); 113 114 void 115 acpi_free ( 116 void *address); 117 118 119 /* 120 * ACPI table manipulation interfaces 121 */ 122 123 acpi_status 124 acpi_find_root_pointer ( 125 u32 flags, 126 struct acpi_pointer *rsdp_address); 127 128 acpi_status 129 acpi_load_tables ( 130 void); 131 132 acpi_status 133 acpi_load_table ( 134 struct acpi_table_header *table_ptr); 135 136 acpi_status 137 acpi_unload_table ( 138 acpi_table_type table_type); 139 140 acpi_status 141 acpi_get_table_header ( 142 acpi_table_type table_type, 143 u32 instance, 144 struct acpi_table_header *out_table_header); 145 146 acpi_status 147 acpi_get_table ( 148 acpi_table_type table_type, 149 u32 instance, 150 struct acpi_buffer *ret_buffer); 151 152 acpi_status 153 acpi_get_firmware_table ( 154 acpi_string signature, 155 u32 instance, 156 u32 flags, 157 struct acpi_table_header **table_pointer); 158 159 160 /* 161 * Namespace and name interfaces 162 */ 163 164 acpi_status 165 acpi_walk_namespace ( 166 acpi_object_type type, 167 acpi_handle start_object, 168 u32 max_depth, 169 acpi_walk_callback user_function, 170 void *context, 171 void **return_value); 172 173 acpi_status 174 acpi_get_devices ( 175 char *HID, 176 acpi_walk_callback user_function, 177 void *context, 178 void **return_value); 179 180 acpi_status 181 acpi_get_name ( 182 acpi_handle handle, 183 u32 name_type, 184 struct acpi_buffer *ret_path_ptr); 185 186 acpi_status 187 acpi_get_handle ( 188 acpi_handle parent, 189 acpi_string pathname, 190 acpi_handle *ret_handle); 191 192 acpi_status 193 acpi_attach_data ( 194 acpi_handle obj_handle, 195 acpi_object_handler handler, 196 void *data); 197 198 acpi_status 199 acpi_detach_data ( 200 acpi_handle obj_handle, 201 acpi_object_handler handler); 202 203 acpi_status 204 acpi_get_data ( 205 acpi_handle obj_handle, 206 acpi_object_handler handler, 207 void **data); 208 209 210 /* 211 * Object manipulation and enumeration 212 */ 213 214 acpi_status 215 acpi_evaluate_object ( 216 acpi_handle object, 217 acpi_string pathname, 218 struct acpi_object_list *parameter_objects, 219 struct acpi_buffer *return_object_buffer); 220 221 acpi_status 222 acpi_evaluate_object_typed ( 223 acpi_handle object, 224 acpi_string pathname, 225 struct acpi_object_list *external_params, 226 struct acpi_buffer *return_buffer, 227 acpi_object_type return_type); 228 229 acpi_status 230 acpi_get_object_info ( 231 acpi_handle handle, 232 struct acpi_buffer *return_buffer); 233 234 acpi_status 235 acpi_get_next_object ( 236 acpi_object_type type, 237 acpi_handle parent, 238 acpi_handle child, 239 acpi_handle *out_handle); 240 241 acpi_status 242 acpi_get_type ( 243 acpi_handle object, 244 acpi_object_type *out_type); 245 246 acpi_status 247 acpi_get_parent ( 248 acpi_handle object, 249 acpi_handle *out_handle); 250 251 252 /* 253 * Event handler interfaces 254 */ 255 256 acpi_status 257 acpi_install_fixed_event_handler ( 258 u32 acpi_event, 259 acpi_event_handler handler, 260 void *context); 261 262 acpi_status 263 acpi_remove_fixed_event_handler ( 264 u32 acpi_event, 265 acpi_event_handler handler); 266 267 acpi_status 268 acpi_install_notify_handler ( 269 acpi_handle device, 270 u32 handler_type, 271 acpi_notify_handler handler, 272 void *context); 273 274 acpi_status 275 acpi_remove_notify_handler ( 276 acpi_handle device, 277 u32 handler_type, 278 acpi_notify_handler handler); 279 280 acpi_status 281 acpi_install_address_space_handler ( 282 acpi_handle device, 283 acpi_adr_space_type space_id, 284 acpi_adr_space_handler handler, 285 acpi_adr_space_setup setup, 286 void *context); 287 288 acpi_status 289 acpi_remove_address_space_handler ( 290 acpi_handle device, 291 acpi_adr_space_type space_id, 292 acpi_adr_space_handler handler); 293 294 acpi_status 295 acpi_install_gpe_handler ( 296 acpi_handle gpe_device, 297 u32 gpe_number, 298 u32 type, 299 acpi_gpe_handler handler, 300 void *context); 301 302 acpi_status 303 acpi_acquire_global_lock ( 304 u16 timeout, 305 u32 *handle); 306 307 acpi_status 308 acpi_release_global_lock ( 309 u32 handle); 310 311 acpi_status 312 acpi_remove_gpe_handler ( 313 acpi_handle gpe_device, 314 u32 gpe_number, 315 acpi_gpe_handler handler); 316 317 acpi_status 318 acpi_enable_event ( 319 u32 event, 320 u32 flags); 321 322 acpi_status 323 acpi_disable_event ( 324 u32 event, 325 u32 flags); 326 327 acpi_status 328 acpi_clear_event ( 329 u32 event); 330 331 acpi_status 332 acpi_get_event_status ( 333 u32 event, 334 acpi_event_status *event_status); 335 336 acpi_status 337 acpi_enable_gpe ( 338 acpi_handle gpe_device, 339 u32 gpe_number, 340 u32 flags); 341 342 acpi_status 343 acpi_disable_gpe ( 344 acpi_handle gpe_device, 345 u32 gpe_number, 346 u32 flags); 347 348 acpi_status 349 acpi_clear_gpe ( 350 acpi_handle gpe_device, 351 u32 gpe_number, 352 u32 flags); 353 354 acpi_status 355 acpi_get_gpe_status ( 356 acpi_handle gpe_device, 357 u32 gpe_number, 358 u32 flags, 359 acpi_event_status *event_status); 360 361 acpi_status 362 acpi_install_gpe_block ( 363 acpi_handle gpe_device, 364 struct acpi_generic_address *gpe_block_address, 365 u32 register_count, 366 u32 interrupt_level); 367 368 acpi_status 369 acpi_remove_gpe_block ( 370 acpi_handle gpe_device); 371 372 373 /* 374 * Resource interfaces 375 */ 376 377 typedef 378 acpi_status (*ACPI_WALK_RESOURCE_CALLBACK) ( 379 struct acpi_resource *resource, 380 void *context); 381 382 383 acpi_status 384 acpi_get_current_resources( 385 acpi_handle device_handle, 386 struct acpi_buffer *ret_buffer); 387 388 acpi_status 389 acpi_get_possible_resources( 390 acpi_handle device_handle, 391 struct acpi_buffer *ret_buffer); 392 393 acpi_status 394 acpi_walk_resources ( 395 acpi_handle device_handle, 396 char *path, 397 ACPI_WALK_RESOURCE_CALLBACK user_function, 398 void *context); 399 400 acpi_status 401 acpi_set_current_resources ( 402 acpi_handle device_handle, 403 struct acpi_buffer *in_buffer); 404 405 acpi_status 406 acpi_get_irq_routing_table ( 407 acpi_handle bus_device_handle, 408 struct acpi_buffer *ret_buffer); 409 410 acpi_status 411 acpi_resource_to_address64 ( 412 struct acpi_resource *resource, 413 struct acpi_resource_address64 *out); 414 415 /* 416 * Hardware (ACPI device) interfaces 417 */ 418 419 acpi_status 420 acpi_get_register ( 421 u32 register_id, 422 u32 *return_value, 423 u32 flags); 424 425 acpi_status 426 acpi_set_register ( 427 u32 register_id, 428 u32 value, 429 u32 flags); 430 431 acpi_status 432 acpi_set_firmware_waking_vector ( 433 acpi_physical_address physical_address); 434 435 acpi_status 436 acpi_get_firmware_waking_vector ( 437 acpi_physical_address *physical_address); 438 439 acpi_status 440 acpi_get_sleep_type_data ( 441 u8 sleep_state, 442 u8 *slp_typ_a, 443 u8 *slp_typ_b); 444 445 acpi_status 446 acpi_enter_sleep_state_prep ( 447 u8 sleep_state); 448 449 acpi_status 450 acpi_enter_sleep_state ( 451 u8 sleep_state); 452 453 acpi_status 454 acpi_enter_sleep_state_s4bios ( 455 void); 456 457 acpi_status 458 acpi_leave_sleep_state ( 459 u8 sleep_state); 460 461 462 #endif /* __ACXFACE_H__ */ 463