.. | .. |
---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
---|
1 | 2 | /* |
---|
2 | 3 | * acpi.h - ACPI Interface |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (C) 2001 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> |
---|
5 | | - * |
---|
6 | | - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
7 | | - * |
---|
8 | | - * This program is free software; you can redistribute it and/or modify |
---|
9 | | - * it under the terms of the GNU General Public License as published by |
---|
10 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
11 | | - * (at your option) any later version. |
---|
12 | | - * |
---|
13 | | - * This program is distributed in the hope that it will be useful, |
---|
14 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
16 | | - * GNU General Public License for more details. |
---|
17 | | - * |
---|
18 | | - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
19 | 6 | */ |
---|
20 | 7 | |
---|
21 | 8 | #ifndef _LINUX_ACPI_H |
---|
.. | .. |
---|
23 | 10 | |
---|
24 | 11 | #include <linux/errno.h> |
---|
25 | 12 | #include <linux/ioport.h> /* for struct resource */ |
---|
| 13 | +#include <linux/irqdomain.h> |
---|
26 | 14 | #include <linux/resource_ext.h> |
---|
27 | 15 | #include <linux/device.h> |
---|
28 | 16 | #include <linux/property.h> |
---|
.. | .. |
---|
67 | 55 | if (!fwnode) |
---|
68 | 56 | return NULL; |
---|
69 | 57 | |
---|
70 | | - fwnode->ops = &acpi_static_fwnode_ops; |
---|
| 58 | + fwnode_init(fwnode, &acpi_static_fwnode_ops); |
---|
71 | 59 | |
---|
72 | 60 | return fwnode; |
---|
73 | 61 | } |
---|
.. | .. |
---|
141 | 129 | |
---|
142 | 130 | |
---|
143 | 131 | /* Table Handlers */ |
---|
| 132 | +union acpi_subtable_headers { |
---|
| 133 | + struct acpi_subtable_header common; |
---|
| 134 | + struct acpi_hmat_structure hmat; |
---|
| 135 | +}; |
---|
144 | 136 | |
---|
145 | 137 | typedef int (*acpi_tbl_table_handler)(struct acpi_table_header *table); |
---|
146 | 138 | |
---|
147 | | -typedef int (*acpi_tbl_entry_handler)(struct acpi_subtable_header *header, |
---|
| 139 | +typedef int (*acpi_tbl_entry_handler)(union acpi_subtable_headers *header, |
---|
148 | 140 | const unsigned long end); |
---|
149 | 141 | |
---|
150 | 142 | /* Debugger support */ |
---|
.. | .. |
---|
291 | 283 | |
---|
292 | 284 | /* Validate the processor object's proc_id */ |
---|
293 | 285 | bool acpi_duplicate_processor_id(int proc_id); |
---|
| 286 | +/* Processor _CTS control */ |
---|
| 287 | +struct acpi_processor_power; |
---|
| 288 | + |
---|
| 289 | +#ifdef CONFIG_ACPI_PROCESSOR_CSTATE |
---|
| 290 | +bool acpi_processor_claim_cst_control(void); |
---|
| 291 | +int acpi_processor_evaluate_cst(acpi_handle handle, u32 cpu, |
---|
| 292 | + struct acpi_processor_power *info); |
---|
| 293 | +#else |
---|
| 294 | +static inline bool acpi_processor_claim_cst_control(void) { return false; } |
---|
| 295 | +static inline int acpi_processor_evaluate_cst(acpi_handle handle, u32 cpu, |
---|
| 296 | + struct acpi_processor_power *info) |
---|
| 297 | +{ |
---|
| 298 | + return -ENODEV; |
---|
| 299 | +} |
---|
| 300 | +#endif |
---|
294 | 301 | |
---|
295 | 302 | #ifdef CONFIG_ACPI_HOTPLUG_CPU |
---|
296 | 303 | /* Arch dependent functions for cpu hotplug support */ |
---|
.. | .. |
---|
327 | 334 | void acpi_set_irq_model(enum acpi_irq_model_id model, |
---|
328 | 335 | struct fwnode_handle *fwnode); |
---|
329 | 336 | |
---|
| 337 | +struct irq_domain *acpi_irq_create_hierarchy(unsigned int flags, |
---|
| 338 | + unsigned int size, |
---|
| 339 | + struct fwnode_handle *fwnode, |
---|
| 340 | + const struct irq_domain_ops *ops, |
---|
| 341 | + void *host_data); |
---|
| 342 | + |
---|
330 | 343 | #ifdef CONFIG_X86_IO_APIC |
---|
331 | 344 | extern int acpi_get_override_irq(u32 gsi, int *trigger, int *polarity); |
---|
332 | 345 | #else |
---|
.. | .. |
---|
347 | 360 | int acpi_pci_irq_enable (struct pci_dev *dev); |
---|
348 | 361 | void acpi_penalize_isa_irq(int irq, int active); |
---|
349 | 362 | bool acpi_isa_irq_available(int irq); |
---|
| 363 | +#ifdef CONFIG_PCI |
---|
350 | 364 | void acpi_penalize_sci_irq(int irq, int trigger, int polarity); |
---|
| 365 | +#else |
---|
| 366 | +static inline void acpi_penalize_sci_irq(int irq, int trigger, |
---|
| 367 | + int polarity) |
---|
| 368 | +{ |
---|
| 369 | +} |
---|
| 370 | +#endif |
---|
351 | 371 | void acpi_pci_irq_disable (struct pci_dev *dev); |
---|
352 | 372 | |
---|
353 | 373 | extern int ec_read(u8 addr, u8 *val); |
---|
.. | .. |
---|
376 | 396 | extern acpi_status wmi_remove_notify_handler(const char *guid); |
---|
377 | 397 | extern acpi_status wmi_get_event_data(u32 event, struct acpi_buffer *out); |
---|
378 | 398 | extern bool wmi_has_guid(const char *guid); |
---|
| 399 | +extern char *wmi_get_acpi_device_uid(const char *guid); |
---|
379 | 400 | |
---|
380 | 401 | #endif /* CONFIG_ACPI_WMI */ |
---|
381 | 402 | |
---|
.. | .. |
---|
399 | 420 | extern bool acpi_osi_is_win8(void); |
---|
400 | 421 | |
---|
401 | 422 | #ifdef CONFIG_ACPI_NUMA |
---|
402 | | -int acpi_map_pxm_to_online_node(int pxm); |
---|
| 423 | +int acpi_map_pxm_to_node(int pxm); |
---|
403 | 424 | int acpi_get_node(acpi_handle handle); |
---|
| 425 | + |
---|
| 426 | +/** |
---|
| 427 | + * pxm_to_online_node - Map proximity ID to online node |
---|
| 428 | + * @pxm: ACPI proximity ID |
---|
| 429 | + * |
---|
| 430 | + * This is similar to pxm_to_node(), but always returns an online |
---|
| 431 | + * node. When the mapped node from a given proximity ID is offline, it |
---|
| 432 | + * looks up the node distance table and returns the nearest online node. |
---|
| 433 | + * |
---|
| 434 | + * ACPI device drivers, which are called after the NUMA initialization has |
---|
| 435 | + * completed in the kernel, can call this interface to obtain their device |
---|
| 436 | + * NUMA topology from ACPI tables. Such drivers do not have to deal with |
---|
| 437 | + * offline nodes. A node may be offline when SRAT memory entry does not exist, |
---|
| 438 | + * or NUMA is disabled, ex. "numa=off" on x86. |
---|
| 439 | + */ |
---|
| 440 | +static inline int pxm_to_online_node(int pxm) |
---|
| 441 | +{ |
---|
| 442 | + int node = pxm_to_node(pxm); |
---|
| 443 | + |
---|
| 444 | + return numa_map_to_online_node(node); |
---|
| 445 | +} |
---|
404 | 446 | #else |
---|
405 | | -static inline int acpi_map_pxm_to_online_node(int pxm) |
---|
| 447 | +static inline int pxm_to_online_node(int pxm) |
---|
| 448 | +{ |
---|
| 449 | + return 0; |
---|
| 450 | +} |
---|
| 451 | +static inline int acpi_map_pxm_to_node(int pxm) |
---|
406 | 452 | { |
---|
407 | 453 | return 0; |
---|
408 | 454 | } |
---|
.. | .. |
---|
466 | 512 | void __init acpi_sleep_no_blacklist(void); |
---|
467 | 513 | #endif /* CONFIG_PM_SLEEP */ |
---|
468 | 514 | |
---|
| 515 | +int acpi_register_wakeup_handler( |
---|
| 516 | + int wake_irq, bool (*wakeup)(void *context), void *context); |
---|
| 517 | +void acpi_unregister_wakeup_handler( |
---|
| 518 | + bool (*wakeup)(void *context), void *context); |
---|
| 519 | + |
---|
469 | 520 | struct acpi_osc_context { |
---|
470 | 521 | char *uuid_str; /* UUID string */ |
---|
471 | 522 | int rev; |
---|
.. | .. |
---|
498 | 549 | #define OSC_SB_PCLPI_SUPPORT 0x00000080 |
---|
499 | 550 | #define OSC_SB_OSLPI_SUPPORT 0x00000100 |
---|
500 | 551 | #define OSC_SB_CPC_DIVERSE_HIGH_SUPPORT 0x00001000 |
---|
| 552 | +#define OSC_SB_GENERIC_INITIATOR_SUPPORT 0x00002000 |
---|
501 | 553 | |
---|
502 | 554 | extern bool osc_sb_apei_support_acked; |
---|
503 | 555 | extern bool osc_pc_lpi_support_confirmed; |
---|
.. | .. |
---|
508 | 560 | #define OSC_PCI_CLOCK_PM_SUPPORT 0x00000004 |
---|
509 | 561 | #define OSC_PCI_SEGMENT_GROUPS_SUPPORT 0x00000008 |
---|
510 | 562 | #define OSC_PCI_MSI_SUPPORT 0x00000010 |
---|
511 | | -#define OSC_PCI_SUPPORT_MASKS 0x0000001f |
---|
| 563 | +#define OSC_PCI_EDR_SUPPORT 0x00000080 |
---|
| 564 | +#define OSC_PCI_HPX_TYPE_3_SUPPORT 0x00000100 |
---|
| 565 | +#define OSC_PCI_SUPPORT_MASKS 0x0000019f |
---|
512 | 566 | |
---|
513 | 567 | /* PCI Host Bridge _OSC: Capabilities DWORD 3: Control Field */ |
---|
514 | 568 | #define OSC_PCI_EXPRESS_NATIVE_HP_CONTROL 0x00000001 |
---|
.. | .. |
---|
517 | 571 | #define OSC_PCI_EXPRESS_AER_CONTROL 0x00000008 |
---|
518 | 572 | #define OSC_PCI_EXPRESS_CAPABILITY_CONTROL 0x00000010 |
---|
519 | 573 | #define OSC_PCI_EXPRESS_LTR_CONTROL 0x00000020 |
---|
520 | | -#define OSC_PCI_CONTROL_MASKS 0x0000003f |
---|
| 574 | +#define OSC_PCI_EXPRESS_DPC_CONTROL 0x00000080 |
---|
| 575 | +#define OSC_PCI_CONTROL_MASKS 0x000000bf |
---|
521 | 576 | |
---|
522 | 577 | #define ACPI_GSB_ACCESS_ATTRIB_QUICK 0x00000002 |
---|
523 | 578 | #define ACPI_GSB_ACCESS_ATTRIB_SEND_RCV 0x00000004 |
---|
.. | .. |
---|
635 | 690 | int acpi_arch_timer_mem_init(struct arch_timer_mem *timer_mem, int *timer_count); |
---|
636 | 691 | #endif |
---|
637 | 692 | |
---|
| 693 | +#ifndef ACPI_HAVE_ARCH_SET_ROOT_POINTER |
---|
| 694 | +static inline void acpi_arch_set_root_pointer(u64 addr) |
---|
| 695 | +{ |
---|
| 696 | +} |
---|
| 697 | +#endif |
---|
| 698 | + |
---|
638 | 699 | #ifndef ACPI_HAVE_ARCH_GET_ROOT_POINTER |
---|
639 | 700 | static inline u64 acpi_arch_get_root_pointer(void) |
---|
640 | 701 | { |
---|
.. | .. |
---|
652 | 713 | #define ACPI_HANDLE_FWNODE(fwnode) (NULL) |
---|
653 | 714 | #define ACPI_DEVICE_CLASS(_cls, _msk) .cls = (0), .cls_msk = (0), |
---|
654 | 715 | |
---|
| 716 | +#include <acpi/acpi_numa.h> |
---|
| 717 | + |
---|
655 | 718 | struct fwnode_handle; |
---|
656 | 719 | |
---|
657 | 720 | static inline bool acpi_dev_found(const char *hid) |
---|
.. | .. |
---|
664 | 727 | return false; |
---|
665 | 728 | } |
---|
666 | 729 | |
---|
667 | | -static inline const char * |
---|
668 | | -acpi_dev_get_first_match_name(const char *hid, const char *uid, s64 hrv) |
---|
| 730 | +struct acpi_device; |
---|
| 731 | + |
---|
| 732 | +static inline bool |
---|
| 733 | +acpi_dev_hid_uid_match(struct acpi_device *adev, const char *hid2, const char *uid2) |
---|
| 734 | +{ |
---|
| 735 | + return false; |
---|
| 736 | +} |
---|
| 737 | + |
---|
| 738 | +static inline struct acpi_device * |
---|
| 739 | +acpi_dev_get_first_match_dev(const char *hid, const char *uid, s64 hrv) |
---|
669 | 740 | { |
---|
670 | 741 | return NULL; |
---|
671 | 742 | } |
---|
| 743 | + |
---|
| 744 | +static inline void acpi_dev_put(struct acpi_device *adev) {} |
---|
672 | 745 | |
---|
673 | 746 | static inline bool is_acpi_node(struct fwnode_handle *fwnode) |
---|
674 | 747 | { |
---|
.. | .. |
---|
801 | 874 | |
---|
802 | 875 | static inline union acpi_object *acpi_evaluate_dsm(acpi_handle handle, |
---|
803 | 876 | const guid_t *guid, |
---|
804 | | - int rev, int func, |
---|
| 877 | + u64 rev, u64 func, |
---|
805 | 878 | union acpi_object *argv4) |
---|
806 | 879 | { |
---|
807 | 880 | return NULL; |
---|
.. | .. |
---|
848 | 921 | return 0; |
---|
849 | 922 | } |
---|
850 | 923 | |
---|
851 | | -static inline void acpi_dma_deconfigure(struct device *dev) { } |
---|
| 924 | +static inline int acpi_dma_configure_id(struct device *dev, |
---|
| 925 | + enum dev_dma_attr attr, |
---|
| 926 | + const u32 *input_id) |
---|
| 927 | +{ |
---|
| 928 | + return 0; |
---|
| 929 | +} |
---|
852 | 930 | |
---|
853 | 931 | #define ACPI_PTR(_ptr) (NULL) |
---|
854 | 932 | |
---|
.. | .. |
---|
875 | 953 | return NULL; |
---|
876 | 954 | } |
---|
877 | 955 | |
---|
| 956 | +static inline int acpi_register_wakeup_handler(int wake_irq, |
---|
| 957 | + bool (*wakeup)(void *context), void *context) |
---|
| 958 | +{ |
---|
| 959 | + return -ENXIO; |
---|
| 960 | +} |
---|
| 961 | + |
---|
| 962 | +static inline void acpi_unregister_wakeup_handler( |
---|
| 963 | + bool (*wakeup)(void *context), void *context) { } |
---|
| 964 | + |
---|
878 | 965 | #endif /* !CONFIG_ACPI */ |
---|
879 | 966 | |
---|
880 | 967 | #ifdef CONFIG_ACPI_HOTPLUG_IOAPIC |
---|
.. | .. |
---|
896 | 983 | acpi_status acpi_os_prepare_extended_sleep(u8 sleep_state, |
---|
897 | 984 | u32 val_a, u32 val_b); |
---|
898 | 985 | |
---|
899 | | -#ifdef CONFIG_X86 |
---|
| 986 | +#ifndef CONFIG_IA64 |
---|
900 | 987 | void arch_reserve_mem_area(acpi_physical_address addr, size_t size); |
---|
901 | 988 | #else |
---|
902 | 989 | static inline void arch_reserve_mem_area(acpi_physical_address addr, |
---|
.. | .. |
---|
914 | 1001 | int acpi_subsys_runtime_suspend(struct device *dev); |
---|
915 | 1002 | int acpi_subsys_runtime_resume(struct device *dev); |
---|
916 | 1003 | int acpi_dev_pm_attach(struct device *dev, bool power_on); |
---|
| 1004 | +bool acpi_storage_d3(struct device *dev); |
---|
917 | 1005 | #else |
---|
918 | | -static inline int acpi_dev_runtime_suspend(struct device *dev) { return 0; } |
---|
919 | | -static inline int acpi_dev_runtime_resume(struct device *dev) { return 0; } |
---|
920 | 1006 | static inline int acpi_subsys_runtime_suspend(struct device *dev) { return 0; } |
---|
921 | 1007 | static inline int acpi_subsys_runtime_resume(struct device *dev) { return 0; } |
---|
922 | 1008 | static inline int acpi_dev_pm_attach(struct device *dev, bool power_on) |
---|
923 | 1009 | { |
---|
924 | 1010 | return 0; |
---|
925 | 1011 | } |
---|
| 1012 | +static inline bool acpi_storage_d3(struct device *dev) |
---|
| 1013 | +{ |
---|
| 1014 | + return false; |
---|
| 1015 | +} |
---|
926 | 1016 | #endif |
---|
927 | 1017 | |
---|
928 | 1018 | #if defined(CONFIG_ACPI) && defined(CONFIG_PM_SLEEP) |
---|
929 | | -int acpi_dev_suspend_late(struct device *dev); |
---|
930 | 1019 | int acpi_subsys_prepare(struct device *dev); |
---|
931 | 1020 | void acpi_subsys_complete(struct device *dev); |
---|
932 | 1021 | int acpi_subsys_suspend_late(struct device *dev); |
---|
.. | .. |
---|
934 | 1023 | int acpi_subsys_suspend(struct device *dev); |
---|
935 | 1024 | int acpi_subsys_freeze(struct device *dev); |
---|
936 | 1025 | int acpi_subsys_poweroff(struct device *dev); |
---|
| 1026 | +void acpi_ec_mark_gpe_for_wake(void); |
---|
| 1027 | +void acpi_ec_set_gpe_wake_mask(u8 action); |
---|
937 | 1028 | #else |
---|
938 | | -static inline int acpi_dev_resume_early(struct device *dev) { return 0; } |
---|
939 | 1029 | static inline int acpi_subsys_prepare(struct device *dev) { return 0; } |
---|
940 | 1030 | static inline void acpi_subsys_complete(struct device *dev) {} |
---|
941 | 1031 | static inline int acpi_subsys_suspend_late(struct device *dev) { return 0; } |
---|
.. | .. |
---|
943 | 1033 | static inline int acpi_subsys_suspend(struct device *dev) { return 0; } |
---|
944 | 1034 | static inline int acpi_subsys_freeze(struct device *dev) { return 0; } |
---|
945 | 1035 | static inline int acpi_subsys_poweroff(struct device *dev) { return 0; } |
---|
| 1036 | +static inline void acpi_ec_mark_gpe_for_wake(void) {} |
---|
| 1037 | +static inline void acpi_ec_set_gpe_wake_mask(u8 action) {} |
---|
946 | 1038 | #endif |
---|
947 | 1039 | |
---|
948 | 1040 | #ifdef CONFIG_ACPI |
---|
.. | .. |
---|
957 | 1049 | #if defined(CONFIG_ACPI) && defined(CONFIG_DYNAMIC_DEBUG) |
---|
958 | 1050 | __printf(3, 4) |
---|
959 | 1051 | void __acpi_handle_debug(struct _ddebug *descriptor, acpi_handle handle, const char *fmt, ...); |
---|
960 | | -#else |
---|
961 | | -#define __acpi_handle_debug(descriptor, handle, fmt, ...) \ |
---|
962 | | - acpi_handle_printk(KERN_DEBUG, handle, fmt, ##__VA_ARGS__); |
---|
963 | 1052 | #endif |
---|
964 | 1053 | |
---|
965 | 1054 | /* |
---|
.. | .. |
---|
989 | 1078 | #else |
---|
990 | 1079 | #if defined(CONFIG_DYNAMIC_DEBUG) |
---|
991 | 1080 | #define acpi_handle_debug(handle, fmt, ...) \ |
---|
992 | | -do { \ |
---|
993 | | - DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ |
---|
994 | | - if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) \ |
---|
995 | | - __acpi_handle_debug(&descriptor, handle, pr_fmt(fmt), \ |
---|
996 | | - ##__VA_ARGS__); \ |
---|
997 | | -} while (0) |
---|
| 1081 | + _dynamic_func_call(fmt, __acpi_handle_debug, \ |
---|
| 1082 | + handle, pr_fmt(fmt), ##__VA_ARGS__) |
---|
998 | 1083 | #else |
---|
999 | 1084 | #define acpi_handle_debug(handle, fmt, ...) \ |
---|
1000 | 1085 | ({ \ |
---|
.. | .. |
---|
1005 | 1090 | #endif |
---|
1006 | 1091 | #endif |
---|
1007 | 1092 | |
---|
1008 | | -struct acpi_gpio_params { |
---|
1009 | | - unsigned int crs_entry_index; |
---|
1010 | | - unsigned int line_index; |
---|
1011 | | - bool active_low; |
---|
1012 | | -}; |
---|
1013 | | - |
---|
1014 | | -struct acpi_gpio_mapping { |
---|
1015 | | - const char *name; |
---|
1016 | | - const struct acpi_gpio_params *data; |
---|
1017 | | - unsigned int size; |
---|
1018 | | - |
---|
1019 | | -/* Ignore IoRestriction field */ |
---|
1020 | | -#define ACPI_GPIO_QUIRK_NO_IO_RESTRICTION BIT(0) |
---|
1021 | | - |
---|
1022 | | - unsigned int quirks; |
---|
1023 | | -}; |
---|
1024 | | - |
---|
1025 | 1093 | #if defined(CONFIG_ACPI) && defined(CONFIG_GPIOLIB) |
---|
1026 | | -int acpi_dev_add_driver_gpios(struct acpi_device *adev, |
---|
1027 | | - const struct acpi_gpio_mapping *gpios); |
---|
1028 | | - |
---|
1029 | | -static inline void acpi_dev_remove_driver_gpios(struct acpi_device *adev) |
---|
1030 | | -{ |
---|
1031 | | - if (adev) |
---|
1032 | | - adev->driver_gpios = NULL; |
---|
1033 | | -} |
---|
1034 | | - |
---|
1035 | | -int devm_acpi_dev_add_driver_gpios(struct device *dev, |
---|
1036 | | - const struct acpi_gpio_mapping *gpios); |
---|
1037 | | -void devm_acpi_dev_remove_driver_gpios(struct device *dev); |
---|
1038 | | - |
---|
1039 | 1094 | bool acpi_gpio_get_irq_resource(struct acpi_resource *ares, |
---|
1040 | 1095 | struct acpi_resource_gpio **agpio); |
---|
1041 | | -int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index); |
---|
| 1096 | +int acpi_dev_gpio_irq_get_by(struct acpi_device *adev, const char *name, int index); |
---|
1042 | 1097 | #else |
---|
1043 | | -static inline int acpi_dev_add_driver_gpios(struct acpi_device *adev, |
---|
1044 | | - const struct acpi_gpio_mapping *gpios) |
---|
1045 | | -{ |
---|
1046 | | - return -ENXIO; |
---|
1047 | | -} |
---|
1048 | | -static inline void acpi_dev_remove_driver_gpios(struct acpi_device *adev) {} |
---|
1049 | | - |
---|
1050 | | -static inline int devm_acpi_dev_add_driver_gpios(struct device *dev, |
---|
1051 | | - const struct acpi_gpio_mapping *gpios) |
---|
1052 | | -{ |
---|
1053 | | - return -ENXIO; |
---|
1054 | | -} |
---|
1055 | | -static inline void devm_acpi_dev_remove_driver_gpios(struct device *dev) {} |
---|
1056 | | - |
---|
1057 | 1098 | static inline bool acpi_gpio_get_irq_resource(struct acpi_resource *ares, |
---|
1058 | 1099 | struct acpi_resource_gpio **agpio) |
---|
1059 | 1100 | { |
---|
1060 | 1101 | return false; |
---|
1061 | 1102 | } |
---|
1062 | | -static inline int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index) |
---|
| 1103 | +static inline int acpi_dev_gpio_irq_get_by(struct acpi_device *adev, |
---|
| 1104 | + const char *name, int index) |
---|
1063 | 1105 | { |
---|
1064 | 1106 | return -ENXIO; |
---|
1065 | 1107 | } |
---|
1066 | 1108 | #endif |
---|
| 1109 | + |
---|
| 1110 | +static inline int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index) |
---|
| 1111 | +{ |
---|
| 1112 | + return acpi_dev_gpio_irq_get_by(adev, NULL, index); |
---|
| 1113 | +} |
---|
1067 | 1114 | |
---|
1068 | 1115 | /* Device properties */ |
---|
1069 | 1116 | |
---|
.. | .. |
---|
1082 | 1129 | return __acpi_node_get_property_reference(fwnode, name, index, |
---|
1083 | 1130 | NR_FWNODE_REFERENCE_ARGS, args); |
---|
1084 | 1131 | } |
---|
| 1132 | + |
---|
| 1133 | +static inline bool acpi_dev_has_props(const struct acpi_device *adev) |
---|
| 1134 | +{ |
---|
| 1135 | + return !list_empty(&adev->data.properties); |
---|
| 1136 | +} |
---|
| 1137 | + |
---|
| 1138 | +struct acpi_device_properties * |
---|
| 1139 | +acpi_data_add_props(struct acpi_device_data *data, const guid_t *guid, |
---|
| 1140 | + const union acpi_object *properties); |
---|
1085 | 1141 | |
---|
1086 | 1142 | int acpi_node_prop_get(const struct fwnode_handle *fwnode, const char *propname, |
---|
1087 | 1143 | void **valptr); |
---|
.. | .. |
---|
1128 | 1184 | kernel_ulong_t driver_data; |
---|
1129 | 1185 | }; |
---|
1130 | 1186 | |
---|
1131 | | -#define ACPI_DECLARE_PROBE_ENTRY(table, name, table_id, subtable, valid, data, fn) \ |
---|
| 1187 | +#define ACPI_DECLARE_PROBE_ENTRY(table, name, table_id, subtable, \ |
---|
| 1188 | + valid, data, fn) \ |
---|
1132 | 1189 | static const struct acpi_probe_entry __acpi_probe_##name \ |
---|
1133 | | - __used __section(__##table##_acpi_probe_table) \ |
---|
1134 | | - = { \ |
---|
| 1190 | + __used __section("__" #table "_acpi_probe_table") = { \ |
---|
1135 | 1191 | .id = table_id, \ |
---|
1136 | 1192 | .type = subtable, \ |
---|
1137 | 1193 | .subtable_valid = valid, \ |
---|
1138 | | - .probe_table = (acpi_tbl_table_handler)fn, \ |
---|
1139 | | - .driver_data = data, \ |
---|
1140 | | - } |
---|
| 1194 | + .probe_table = fn, \ |
---|
| 1195 | + .driver_data = data, \ |
---|
| 1196 | + } |
---|
| 1197 | + |
---|
| 1198 | +#define ACPI_DECLARE_SUBTABLE_PROBE_ENTRY(table, name, table_id, \ |
---|
| 1199 | + subtable, valid, data, fn) \ |
---|
| 1200 | + static const struct acpi_probe_entry __acpi_probe_##name \ |
---|
| 1201 | + __used __section("__" #table "_acpi_probe_table") = { \ |
---|
| 1202 | + .id = table_id, \ |
---|
| 1203 | + .type = subtable, \ |
---|
| 1204 | + .subtable_valid = valid, \ |
---|
| 1205 | + .probe_subtbl = fn, \ |
---|
| 1206 | + .driver_data = data, \ |
---|
| 1207 | + } |
---|
1141 | 1208 | |
---|
1142 | 1209 | #define ACPI_PROBE_TABLE(name) __##name##_acpi_probe_table |
---|
1143 | 1210 | #define ACPI_PROBE_TABLE_END(name) __##name##_acpi_probe_table_end |
---|
.. | .. |
---|
1179 | 1246 | static inline int acpi_node_prop_get(const struct fwnode_handle *fwnode, |
---|
1180 | 1247 | const char *propname, |
---|
1181 | 1248 | void **valptr) |
---|
1182 | | -{ |
---|
1183 | | - return -ENXIO; |
---|
1184 | | -} |
---|
1185 | | - |
---|
1186 | | -static inline int acpi_dev_prop_get(const struct acpi_device *adev, |
---|
1187 | | - const char *propname, |
---|
1188 | | - void **valptr) |
---|
1189 | 1249 | { |
---|
1190 | 1250 | return -ENXIO; |
---|
1191 | 1251 | } |
---|
.. | .. |
---|
1300 | 1360 | int acpi_pptt_cpu_is_thread(unsigned int cpu); |
---|
1301 | 1361 | int find_acpi_cpu_topology(unsigned int cpu, int level); |
---|
1302 | 1362 | int find_acpi_cpu_topology_package(unsigned int cpu); |
---|
| 1363 | +int find_acpi_cpu_topology_hetero_id(unsigned int cpu); |
---|
1303 | 1364 | int find_acpi_cpu_cache_topology(unsigned int cpu, int level); |
---|
1304 | 1365 | #else |
---|
1305 | 1366 | static inline int acpi_pptt_cpu_is_thread(unsigned int cpu) |
---|
.. | .. |
---|
1314 | 1375 | { |
---|
1315 | 1376 | return -EINVAL; |
---|
1316 | 1377 | } |
---|
| 1378 | +static inline int find_acpi_cpu_topology_hetero_id(unsigned int cpu) |
---|
| 1379 | +{ |
---|
| 1380 | + return -EINVAL; |
---|
| 1381 | +} |
---|
1317 | 1382 | static inline int find_acpi_cpu_cache_topology(unsigned int cpu, int level) |
---|
1318 | 1383 | { |
---|
1319 | 1384 | return -EINVAL; |
---|
1320 | 1385 | } |
---|
1321 | 1386 | #endif |
---|
1322 | 1387 | |
---|
| 1388 | +#ifdef CONFIG_ACPI |
---|
| 1389 | +extern int acpi_platform_notify(struct device *dev, enum kobject_action action); |
---|
| 1390 | +#else |
---|
| 1391 | +static inline int |
---|
| 1392 | +acpi_platform_notify(struct device *dev, enum kobject_action action) |
---|
| 1393 | +{ |
---|
| 1394 | + return 0; |
---|
| 1395 | +} |
---|
| 1396 | +#endif |
---|
| 1397 | + |
---|
1323 | 1398 | #endif /*_LINUX_ACPI_H*/ |
---|