Blame view
drivers/acpi/internal.h
9.1 KB
2025cf9e1
|
1 |
/* SPDX-License-Identifier: GPL-2.0-only */ |
a192a9580
|
2 3 4 5 6 |
/* * acpi/internal.h * For use by Linux/ACPI infrastructure, not drivers * * Copyright (c) 2009, Intel Corporation. |
a192a9580
|
7 |
*/ |
1195a0981
|
8 9 |
#ifndef _ACPI_INTERNAL_H_ #define _ACPI_INTERNAL_H_ |
a192a9580
|
10 |
#define PREFIX "ACPI: " |
e60cc7a6f
|
11 |
|
e5f660ebe
|
12 13 |
int early_acpi_osi_init(void); int acpi_osi_init(void); |
1129c92fa
|
14 |
acpi_status acpi_os_initialize1(void); |
e747f2749
|
15 |
int acpi_scan_init(void); |
5d32a6654
|
16 |
#ifdef CONFIG_PCI |
00c43b968
|
17 |
void acpi_pci_root_init(void); |
4daeaf683
|
18 |
void acpi_pci_link_init(void); |
5d32a6654
|
19 20 21 22 |
#else static inline void acpi_pci_root_init(void) {} static inline void acpi_pci_link_init(void) {} #endif |
ac212b698
|
23 |
void acpi_processor_init(void); |
141a297bd
|
24 |
void acpi_platform_init(void); |
eec15edbb
|
25 |
void acpi_pnp_init(void); |
3230bbfce
|
26 |
void acpi_int340x_thermal_init(void); |
6ce2e188a
|
27 28 29 30 31 |
#ifdef CONFIG_ARM_AMBA void acpi_amba_init(void); #else static inline void acpi_amba_init(void) {} #endif |
1c8fce27e
|
32 |
int acpi_sysfs_init(void); |
9c4aa1eec
|
33 |
void acpi_gpe_apply_masked_gpes(void); |
737f1a9f8
|
34 |
void acpi_container_init(void); |
cccd42085
|
35 |
void acpi_memory_hotplug_init(void); |
c183619b6
|
36 |
#ifdef CONFIG_ACPI_HOTPLUG_IOAPIC |
f2ae5da72
|
37 |
void pci_ioapic_remove(struct acpi_pci_root *root); |
c183619b6
|
38 39 |
int acpi_ioapic_remove(struct acpi_pci_root *root); #else |
f2ae5da72
|
40 |
static inline void pci_ioapic_remove(struct acpi_pci_root *root) { return; } |
c183619b6
|
41 42 |
static inline int acpi_ioapic_remove(struct acpi_pci_root *root) { return 0; } #endif |
94add0f82
|
43 |
#ifdef CONFIG_ACPI_DOCK |
1e2380cd1
|
44 45 46 47 |
void register_dock_dependent_device(struct acpi_device *adev, acpi_handle dshandle); int dock_notify(struct acpi_device *adev, u32 event); void acpi_dock_add(struct acpi_device *adev); |
94add0f82
|
48 |
#else |
1e2380cd1
|
49 50 51 52 |
static inline void register_dock_dependent_device(struct acpi_device *adev, acpi_handle dshandle) {} static inline int dock_notify(struct acpi_device *adev, u32 event) { return -ENODEV; } static inline void acpi_dock_add(struct acpi_device *adev) {} |
94add0f82
|
53 |
#endif |
2fa97feb4
|
54 55 56 57 58 |
#ifdef CONFIG_X86 void acpi_cmos_rtc_init(void); #else static inline void acpi_cmos_rtc_init(void) {} #endif |
18d78b64f
|
59 |
int acpi_rev_override_setup(char *str); |
e747f2749
|
60 |
|
3f8055c35
|
61 62 63 64 65 |
void acpi_sysfs_add_hotplug_profile(struct acpi_hotplug_profile *hotplug, const char *name); int acpi_scan_add_handler_with_hotplug(struct acpi_scan_handler *handler, const char *hotplug_profile_name); void acpi_scan_hotplug_enabled(struct acpi_hotplug_profile *hotplug, bool val); |
a25ee9200
|
66 |
#ifdef CONFIG_DEBUG_FS |
aecad432f
|
67 |
extern struct dentry *acpi_debugfs_dir; |
10742619a
|
68 |
void acpi_debugfs_init(void); |
a25ee9200
|
69 |
#else |
aecad432f
|
70 |
static inline void acpi_debugfs_init(void) { return; } |
a25ee9200
|
71 |
#endif |
162274555
|
72 |
#ifdef CONFIG_PCI |
f58b082ae
|
73 |
void acpi_lpss_init(void); |
162274555
|
74 75 76 |
#else static inline void acpi_lpss_init(void) {} #endif |
a25ee9200
|
77 |
|
92082a888
|
78 |
void acpi_apd_init(void); |
1e3bcb596
|
79 |
acpi_status acpi_hotplug_schedule(struct acpi_device *adev, u32 src); |
d783156ea
|
80 |
bool acpi_queue_hotplug_work(struct work_struct *work); |
1e3bcb596
|
81 |
void acpi_device_hotplug(struct acpi_device *adev, u32 src); |
caa73ea15
|
82 |
bool acpi_scan_is_offline(struct acpi_device *adev, bool uevent); |
d783156ea
|
83 |
|
68bdb6773
|
84 85 |
acpi_status acpi_sysfs_table_handler(u32 event, void *table, void *context); void acpi_scan_table_handler(u32 event, void *table, void *context); |
e60cc7a6f
|
86 |
/* -------------------------------------------------------------------------- |
82c7d5efa
|
87 88 89 90 |
Device Node Initialization / Removal -------------------------------------------------------------------------- */ #define ACPI_STA_DEFAULT (ACPI_STA_DEVICE_PRESENT | ACPI_STA_DEVICE_ENABLED | \ ACPI_STA_DEVICE_UI | ACPI_STA_DEVICE_FUNCTIONING) |
2d12b6b38
|
91 |
extern struct list_head acpi_bus_id_list; |
edc345d88
|
92 |
struct acpi_device_bus_id { |
2d12b6b38
|
93 94 95 96 |
char bus_id[15]; unsigned int instance_no; struct list_head node; }; |
cf860be63
|
97 98 |
int acpi_device_add(struct acpi_device *device, void (*release)(struct device *)); |
82c7d5efa
|
99 100 |
void acpi_init_device_object(struct acpi_device *device, acpi_handle handle, int type, unsigned long long sta); |
c2efefb33
|
101 102 |
int acpi_device_setup_files(struct acpi_device *dev); void acpi_device_remove_files(struct acpi_device *dev); |
cf860be63
|
103 |
void acpi_device_add_finalize(struct acpi_device *device); |
c0af41757
|
104 |
void acpi_free_pnp_ids(struct acpi_device_pnp *pnp); |
cde1f95f4
|
105 |
bool acpi_device_is_present(const struct acpi_device *adev); |
b43109fa4
|
106 |
bool acpi_device_is_battery(struct acpi_device *adev); |
712e960f0
|
107 108 |
bool acpi_device_is_first_physical_node(struct acpi_device *adev, const struct device *dev); |
a64a62ce9
|
109 |
int acpi_bus_register_early_device(int type); |
82c7d5efa
|
110 111 |
/* -------------------------------------------------------------------------- |
c2efefb33
|
112 113 114 115 116 117 118 |
Device Matching and Notification -------------------------------------------------------------------------- */ struct acpi_device *acpi_companion_match(const struct device *dev); int __acpi_device_uevent_modalias(struct acpi_device *adev, struct kobj_uevent_env *env); /* -------------------------------------------------------------------------- |
e60cc7a6f
|
119 120 |
Power Resource -------------------------------------------------------------------------- */ |
44515374c
|
121 |
int acpi_power_init(void); |
0b2245273
|
122 |
void acpi_power_resources_list_free(struct list_head *list); |
e88c9c603
|
123 124 125 |
int acpi_extract_power_resources(union acpi_object *package, unsigned int start, struct list_head *list); int acpi_add_power_resource(acpi_handle handle); |
bc9b6407b
|
126 |
void acpi_power_add_remove_device(struct acpi_device *adev, bool add); |
b5d667eb3
|
127 |
int acpi_power_wakeup_list_init(struct list_head *list, int *system_level); |
e60cc7a6f
|
128 129 |
int acpi_device_sleep_wake(struct acpi_device *dev, int enable, int sleep_state, int dev_state); |
32a00d274
|
130 |
int acpi_power_get_inferred_state(struct acpi_device *device, int *state); |
30d3df41b
|
131 |
int acpi_power_on_resources(struct acpi_device *device, int state); |
e60cc7a6f
|
132 |
int acpi_power_transition(struct acpi_device *device, int state); |
e60cc7a6f
|
133 |
|
9ed411c06
|
134 135 136 137 |
/* -------------------------------------------------------------------------- Device Power Management -------------------------------------------------------------------------- */ int acpi_device_get_power(struct acpi_device *device, int *state); |
201b8c655
|
138 |
int acpi_wakeup_device_init(void); |
46ba51ea8
|
139 |
|
9ed411c06
|
140 141 142 |
/* -------------------------------------------------------------------------- Processor -------------------------------------------------------------------------- */ |
46ba51ea8
|
143 |
#ifdef CONFIG_ARCH_MIGHT_HAVE_ACPI_PDC |
78f169965
|
144 |
void acpi_early_processor_set_pdc(void); |
46ba51ea8
|
145 146 147 |
#else static inline void acpi_early_processor_set_pdc(void) {} #endif |
201b8c655
|
148 |
|
a21211672
|
149 150 151 152 153 |
#ifdef CONFIG_X86 void acpi_early_processor_osc(void); #else static inline void acpi_early_processor_osc(void) {} #endif |
e60cc7a6f
|
154 155 156 |
/* -------------------------------------------------------------------------- Embedded Controller -------------------------------------------------------------------------- */ |
1195a0981
|
157 158 |
struct acpi_ec { acpi_handle handle; |
3522f867c
|
159 |
u32 gpe; |
1195a0981
|
160 161 |
unsigned long command_addr; unsigned long data_addr; |
621a5f7ad
|
162 |
bool global_lock; |
1195a0981
|
163 |
unsigned long flags; |
9887d22ad
|
164 |
unsigned long reference_count; |
f351d027e
|
165 |
struct mutex mutex; |
1195a0981
|
166 167 168 |
wait_queue_head_t wait; struct list_head list; struct transaction *curr; |
f351d027e
|
169 |
spinlock_t lock; |
74443bbed
|
170 |
struct work_struct work; |
d8d031a60
|
171 |
unsigned long timestamp; |
9d8993be2
|
172 |
unsigned long nr_pending_queries; |
c3a696b6e
|
173 174 |
bool busy_polling; unsigned int polling_guard; |
1195a0981
|
175 176 177 |
}; extern struct acpi_ec *first_ec; |
b8a0b0d19
|
178 179 180 |
/* If we find an EC via the ECDT, we need to keep a ptr to its context */ /* External interfaces use first EC only, so remember */ typedef int (*acpi_ec_query_func) (void *data); |
a5f820feb
|
181 |
int acpi_ec_init(void); |
fdb3c1776
|
182 183 |
void acpi_ec_ecdt_probe(void); void acpi_ec_dsdt_probe(void); |
fe955682d
|
184 185 |
void acpi_ec_block_transactions(void); void acpi_ec_unblock_transactions(void); |
b8a0b0d19
|
186 187 188 189 |
int acpi_ec_add_query_handler(struct acpi_ec *ec, u8 query_bit, acpi_handle handle, acpi_ec_query_func func, void *data); void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit); |
880a66275
|
190 191 |
#ifdef CONFIG_PM_SLEEP void acpi_ec_flush_work(void); |
d75894049
|
192 |
bool acpi_ec_dispatch_gpe(void); |
880a66275
|
193 |
#endif |
e60cc7a6f
|
194 195 196 197 |
/*-------------------------------------------------------------------------- Suspend/Resume -------------------------------------------------------------------------- */ |
6e0a0ea12
|
198 |
#ifdef CONFIG_ACPI_SYSTEM_POWER_STATES_SUPPORT |
33e4f80ee
|
199 |
extern bool acpi_s2idle_wakeup(void); |
e60cc7a6f
|
200 |
extern int acpi_sleep_init(void); |
6e0a0ea12
|
201 |
#else |
33e4f80ee
|
202 |
static inline bool acpi_s2idle_wakeup(void) { return false; } |
6e0a0ea12
|
203 204 |
static inline int acpi_sleep_init(void) { return -ENXIO; } #endif |
9cee43e07
|
205 206 |
#ifdef CONFIG_ACPI_SLEEP |
f934c7450
|
207 |
void acpi_sleep_proc_init(void); |
976513dbf
|
208 209 210 211 |
int suspend_nvs_alloc(void); void suspend_nvs_free(void); int suspend_nvs_save(void); void suspend_nvs_restore(void); |
9cee43e07
|
212 |
#else |
f934c7450
|
213 |
static inline void acpi_sleep_proc_init(void) {} |
976513dbf
|
214 215 |
static inline int suspend_nvs_alloc(void) { return 0; } static inline void suspend_nvs_free(void) {} |
6fed05c9c
|
216 |
static inline int suspend_nvs_save(void) { return 0; } |
976513dbf
|
217 |
static inline void suspend_nvs_restore(void) {} |
9cee43e07
|
218 |
#endif |
1195a0981
|
219 |
|
91e568780
|
220 |
/*-------------------------------------------------------------------------- |
ffdcd955c
|
221 222 |
Device properties -------------------------------------------------------------------------- */ |
ee8920940
|
223 |
#define ACPI_DT_NAMESPACE_HID "PRP0001" |
ffdcd955c
|
224 225 |
void acpi_init_properties(struct acpi_device *adev); void acpi_free_properties(struct acpi_device *adev); |
899596e09
|
226 227 228 229 230 |
#ifdef CONFIG_X86 void acpi_extract_apple_properties(struct acpi_device *adev); #else static inline void acpi_extract_apple_properties(struct acpi_device *adev) {} #endif |
058dfc767
|
231 232 233 234 235 236 237 238 239 |
/*-------------------------------------------------------------------------- Watchdog -------------------------------------------------------------------------- */ #ifdef CONFIG_ACPI_WATCHDOG void acpi_watchdog_init(void); #else static inline void acpi_watchdog_init(void) {} #endif |
eeb2d80d5
|
240 241 242 243 244 |
#ifdef CONFIG_ACPI_LPIT void acpi_init_lpit(void); #else static inline void acpi_init_lpit(void) { } #endif |
1195a0981
|
245 |
#endif /* _ACPI_INTERNAL_H_ */ |