| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * acpi_bus.h - ACPI Bus Driver ($Revision: 22 $) |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> |
|---|
| 5 | 6 | * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> |
|---|
| 6 | | - * |
|---|
| 7 | | - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 8 | | - * |
|---|
| 9 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 10 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 11 | | - * the Free Software Foundation; either version 2 of the License, or (at |
|---|
| 12 | | - * your option) any later version. |
|---|
| 13 | | - * |
|---|
| 14 | | - * This program is distributed in the hope that it will be useful, but |
|---|
| 15 | | - * WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 16 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 17 | | - * General Public License for more details. |
|---|
| 18 | | - * |
|---|
| 19 | | - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 20 | 7 | */ |
|---|
| 21 | 8 | |
|---|
| 22 | 9 | #ifndef __ACPI_BUS_H__ |
|---|
| .. | .. |
|---|
| 57 | 44 | u64 arg); |
|---|
| 58 | 45 | acpi_status acpi_evaluate_ej0(acpi_handle handle); |
|---|
| 59 | 46 | acpi_status acpi_evaluate_lck(acpi_handle handle, int lock); |
|---|
| 47 | +acpi_status acpi_evaluate_reg(acpi_handle handle, u8 space_id, u32 function); |
|---|
| 60 | 48 | bool acpi_ata_match(acpi_handle handle); |
|---|
| 61 | 49 | bool acpi_bay_match(acpi_handle handle); |
|---|
| 62 | 50 | bool acpi_dock_match(acpi_handle handle); |
|---|
| .. | .. |
|---|
| 91 | 79 | bool acpi_dev_found(const char *hid); |
|---|
| 92 | 80 | bool acpi_dev_present(const char *hid, const char *uid, s64 hrv); |
|---|
| 93 | 81 | |
|---|
| 94 | | -const char * |
|---|
| 95 | | -acpi_dev_get_first_match_name(const char *hid, const char *uid, s64 hrv); |
|---|
| 96 | | - |
|---|
| 97 | 82 | #ifdef CONFIG_ACPI |
|---|
| 98 | 83 | |
|---|
| 99 | | -#include <linux/proc_fs.h> |
|---|
| 84 | +struct proc_dir_entry; |
|---|
| 100 | 85 | |
|---|
| 101 | 86 | #define ACPI_BUS_FILE_ROOT "acpi" |
|---|
| 102 | 87 | extern struct proc_dir_entry *acpi_root_dir; |
|---|
| .. | .. |
|---|
| 230 | 215 | /* Plug and Play */ |
|---|
| 231 | 216 | |
|---|
| 232 | 217 | typedef char acpi_bus_id[8]; |
|---|
| 233 | | -typedef unsigned long acpi_bus_address; |
|---|
| 218 | +typedef u64 acpi_bus_address; |
|---|
| 234 | 219 | typedef char acpi_device_name[40]; |
|---|
| 235 | 220 | typedef char acpi_device_class[20]; |
|---|
| 236 | 221 | |
|---|
| .. | .. |
|---|
| 347 | 332 | bool put_online:1; |
|---|
| 348 | 333 | }; |
|---|
| 349 | 334 | |
|---|
| 335 | +struct acpi_device_properties { |
|---|
| 336 | + const guid_t *guid; |
|---|
| 337 | + const union acpi_object *properties; |
|---|
| 338 | + struct list_head list; |
|---|
| 339 | +}; |
|---|
| 340 | + |
|---|
| 350 | 341 | /* ACPI Device Specific Data (_DSD) */ |
|---|
| 351 | 342 | struct acpi_device_data { |
|---|
| 352 | 343 | const union acpi_object *pointer; |
|---|
| 353 | | - const union acpi_object *properties; |
|---|
| 344 | + struct list_head properties; |
|---|
| 354 | 345 | const union acpi_object *of_compatible; |
|---|
| 355 | 346 | struct list_head subnodes; |
|---|
| 356 | 347 | }; |
|---|
| .. | .. |
|---|
| 514 | 505 | |
|---|
| 515 | 506 | int acpi_bus_set_power(acpi_handle handle, int state); |
|---|
| 516 | 507 | const char *acpi_power_state_string(int state); |
|---|
| 517 | | -int acpi_device_get_power(struct acpi_device *device, int *state); |
|---|
| 518 | 508 | int acpi_device_set_power(struct acpi_device *device, int state); |
|---|
| 519 | 509 | int acpi_bus_init_power(struct acpi_device *device); |
|---|
| 520 | 510 | int acpi_device_fix_up_power(struct acpi_device *device); |
|---|
| 521 | 511 | int acpi_bus_update_power(acpi_handle handle, int *state_p); |
|---|
| 522 | 512 | int acpi_device_update_power(struct acpi_device *device, int *state_p); |
|---|
| 523 | 513 | bool acpi_bus_power_manageable(acpi_handle handle); |
|---|
| 514 | +int acpi_device_power_add_dependent(struct acpi_device *adev, |
|---|
| 515 | + struct device *dev); |
|---|
| 516 | +void acpi_device_power_remove_dependent(struct acpi_device *adev, |
|---|
| 517 | + struct device *dev); |
|---|
| 524 | 518 | |
|---|
| 525 | 519 | #ifdef CONFIG_PM |
|---|
| 526 | 520 | bool acpi_bus_can_wakeup(acpi_handle handle); |
|---|
| .. | .. |
|---|
| 595 | 589 | enum dev_dma_attr acpi_get_dma_attr(struct acpi_device *adev); |
|---|
| 596 | 590 | int acpi_dma_get_range(struct device *dev, u64 *dma_addr, u64 *offset, |
|---|
| 597 | 591 | u64 *size); |
|---|
| 598 | | -int acpi_dma_configure(struct device *dev, enum dev_dma_attr attr); |
|---|
| 599 | | -void acpi_dma_deconfigure(struct device *dev); |
|---|
| 600 | | - |
|---|
| 592 | +int acpi_dma_configure_id(struct device *dev, enum dev_dma_attr attr, |
|---|
| 593 | + const u32 *input_id); |
|---|
| 594 | +static inline int acpi_dma_configure(struct device *dev, |
|---|
| 595 | + enum dev_dma_attr attr) |
|---|
| 596 | +{ |
|---|
| 597 | + return acpi_dma_configure_id(dev, attr, NULL); |
|---|
| 598 | +} |
|---|
| 601 | 599 | struct acpi_device *acpi_find_child_device(struct acpi_device *parent, |
|---|
| 602 | 600 | u64 address, bool check_children); |
|---|
| 603 | 601 | int acpi_is_root_bridge(acpi_handle); |
|---|
| .. | .. |
|---|
| 607 | 605 | int acpi_disable_wakeup_device_power(struct acpi_device *dev); |
|---|
| 608 | 606 | |
|---|
| 609 | 607 | #ifdef CONFIG_X86 |
|---|
| 610 | | -bool acpi_device_always_present(struct acpi_device *adev); |
|---|
| 608 | +bool acpi_device_override_status(struct acpi_device *adev, unsigned long long *status); |
|---|
| 611 | 609 | #else |
|---|
| 612 | | -static inline bool acpi_device_always_present(struct acpi_device *adev) |
|---|
| 610 | +static inline bool acpi_device_override_status(struct acpi_device *adev, |
|---|
| 611 | + unsigned long long *status) |
|---|
| 613 | 612 | { |
|---|
| 614 | 613 | return false; |
|---|
| 615 | 614 | } |
|---|
| .. | .. |
|---|
| 655 | 654 | } |
|---|
| 656 | 655 | #endif |
|---|
| 657 | 656 | |
|---|
| 657 | +#ifdef CONFIG_ACPI_SYSTEM_POWER_STATES_SUPPORT |
|---|
| 658 | +bool acpi_sleep_state_supported(u8 sleep_state); |
|---|
| 659 | +#else |
|---|
| 660 | +static inline bool acpi_sleep_state_supported(u8 sleep_state) { return false; } |
|---|
| 661 | +#endif |
|---|
| 662 | + |
|---|
| 658 | 663 | #ifdef CONFIG_ACPI_SLEEP |
|---|
| 659 | 664 | u32 acpi_target_system_state(void); |
|---|
| 660 | 665 | #else |
|---|
| .. | .. |
|---|
| 678 | 683 | adev->power.states[ACPI_STATE_D3_HOT].flags.explicit_set); |
|---|
| 679 | 684 | } |
|---|
| 680 | 685 | |
|---|
| 686 | +bool acpi_dev_hid_uid_match(struct acpi_device *adev, const char *hid2, const char *uid2); |
|---|
| 687 | + |
|---|
| 688 | +struct acpi_device * |
|---|
| 689 | +acpi_dev_get_first_match_dev(const char *hid, const char *uid, s64 hrv); |
|---|
| 690 | + |
|---|
| 691 | +static inline void acpi_dev_put(struct acpi_device *adev) |
|---|
| 692 | +{ |
|---|
| 693 | + if (adev) |
|---|
| 694 | + put_device(&adev->dev); |
|---|
| 695 | +} |
|---|
| 681 | 696 | #else /* CONFIG_ACPI */ |
|---|
| 682 | 697 | |
|---|
| 683 | 698 | static inline int register_acpi_bus_type(void *bus) { return 0; } |
|---|