Blame view

drivers/acpi/internal.h 9.1 KB
2025cf9e1   Thomas Gleixner   treewide: Replace...
1
  /* SPDX-License-Identifier: GPL-2.0-only */
a192a9580   Len Brown   ACPI: Move defini...
2
3
4
5
6
  /*
   * acpi/internal.h
   * For use by Linux/ACPI infrastructure, not drivers
   *
   * Copyright (c) 2009, Intel Corporation.
a192a9580   Len Brown   ACPI: Move defini...
7
   */
1195a0981   Thomas Renninger   ACPI: Provide /sy...
8
9
  #ifndef _ACPI_INTERNAL_H_
  #define _ACPI_INTERNAL_H_
a192a9580   Len Brown   ACPI: Move defini...
10
  #define PREFIX "ACPI: "
e60cc7a6f   Bjorn Helgaas   ACPI: move privat...
11

e5f660ebe   Lv Zheng   ACPI / osi: Colle...
12
13
  int early_acpi_osi_init(void);
  int acpi_osi_init(void);
1129c92fa   Lv Zheng   ACPI: Cleanup spa...
14
  acpi_status acpi_os_initialize1(void);
e747f2749   Bjorn Helgaas   ACPI: call acpi_s...
15
  int acpi_scan_init(void);
5d32a6654   Sinan Kaya   PCI/ACPI: Allow A...
16
  #ifdef CONFIG_PCI
00c43b968   Rafael J. Wysocki   ACPI / PCI: Make ...
17
  void acpi_pci_root_init(void);
4daeaf683   Rafael J. Wysocki   ACPI / PCI: Make ...
18
  void acpi_pci_link_init(void);
5d32a6654   Sinan Kaya   PCI/ACPI: Allow A...
19
20
21
22
  #else
  static inline void acpi_pci_root_init(void) {}
  static inline void acpi_pci_link_init(void) {}
  #endif
ac212b698   Rafael J. Wysocki   ACPI / processor:...
23
  void acpi_processor_init(void);
141a297bd   Rafael J. Wysocki   ACPI / platform: ...
24
  void acpi_platform_init(void);
eec15edbb   Zhang Rui   ACPI / PNP: use d...
25
  void acpi_pnp_init(void);
3230bbfce   Zhang Rui   ACPI: introduce A...
26
  void acpi_int340x_thermal_init(void);
6ce2e188a   Graeme Gregory   ACPI / scan: AMBA...
27
28
29
30
31
  #ifdef CONFIG_ARM_AMBA
  void acpi_amba_init(void);
  #else
  static inline void acpi_amba_init(void) {}
  #endif
1c8fce27e   Zhang Rui   ACPI: introduce d...
32
  int acpi_sysfs_init(void);
9c4aa1eec   Lv Zheng   ACPI / sysfs: Pro...
33
  void acpi_gpe_apply_masked_gpes(void);
737f1a9f8   Rafael J. Wysocki   ACPI / scan: Make...
34
  void acpi_container_init(void);
cccd42085   Rafael J. Wysocki   ACPI / scan: alwa...
35
  void acpi_memory_hotplug_init(void);
c183619b6   Jiang Liu   x86/irq, ACPI: Im...
36
  #ifdef	CONFIG_ACPI_HOTPLUG_IOAPIC
f2ae5da72   Rui Wang   x86/ioapic: Split...
37
  void pci_ioapic_remove(struct acpi_pci_root *root);
c183619b6   Jiang Liu   x86/irq, ACPI: Im...
38
39
  int acpi_ioapic_remove(struct acpi_pci_root *root);
  #else
f2ae5da72   Rui Wang   x86/ioapic: Split...
40
  static inline void pci_ioapic_remove(struct acpi_pci_root *root) { return; }
c183619b6   Jiang Liu   x86/irq, ACPI: Im...
41
42
  static inline int acpi_ioapic_remove(struct acpi_pci_root *root) { return 0; }
  #endif
94add0f82   Jiang Liu   ACPI / dock: Init...
43
  #ifdef CONFIG_ACPI_DOCK
1e2380cd1   Rafael J. Wysocki   ACPI / dock: Disp...
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   Jiang Liu   ACPI / dock: Init...
48
  #else
1e2380cd1   Rafael J. Wysocki   ACPI / dock: Disp...
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   Jiang Liu   ACPI / dock: Init...
53
  #endif
2fa97feb4   Lan Tianyu   ACPI: Add CMOS RT...
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   Rafael J. Wysocki   ACPI / init: Make...
59
  int acpi_rev_override_setup(char *str);
e747f2749   Bjorn Helgaas   ACPI: call acpi_s...
60

3f8055c35   Rafael J. Wysocki   ACPI / hotplug: I...
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   Zhang Rui   ACPI: introduce d...
66
  #ifdef CONFIG_DEBUG_FS
aecad432f   Thomas Renninger   ACPI: Cleanup cus...
67
  extern struct dentry *acpi_debugfs_dir;
10742619a   Nicolas Iooss   ACPI: fix acpi_de...
68
  void acpi_debugfs_init(void);
a25ee9200   Zhang Rui   ACPI: introduce d...
69
  #else
aecad432f   Thomas Renninger   ACPI: Cleanup cus...
70
  static inline void acpi_debugfs_init(void) { return; }
a25ee9200   Zhang Rui   ACPI: introduce d...
71
  #endif
162274555   Sinan Kaya   ACPI / LPSS: Make...
72
  #ifdef CONFIG_PCI
f58b082ae   Rafael J. Wysocki   ACPI / scan: Add ...
73
  void acpi_lpss_init(void);
162274555   Sinan Kaya   ACPI / LPSS: Make...
74
75
76
  #else
  static inline void acpi_lpss_init(void) {}
  #endif
a25ee9200   Zhang Rui   ACPI: introduce d...
77

92082a888   Ken Xue   ACPI: add AMD ACP...
78
  void acpi_apd_init(void);
1e3bcb596   Rafael J. Wysocki   ACPI / hotplug: R...
79
  acpi_status acpi_hotplug_schedule(struct acpi_device *adev, u32 src);
d783156ea   Rafael J. Wysocki   ACPI / scan: Defi...
80
  bool acpi_queue_hotplug_work(struct work_struct *work);
1e3bcb596   Rafael J. Wysocki   ACPI / hotplug: R...
81
  void acpi_device_hotplug(struct acpi_device *adev, u32 src);
caa73ea15   Rafael J. Wysocki   ACPI / hotplug / ...
82
  bool acpi_scan_is_offline(struct acpi_device *adev, bool uevent);
d783156ea   Rafael J. Wysocki   ACPI / scan: Defi...
83

68bdb6773   Octavian Purdila   ACPI: add support...
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   Bjorn Helgaas   ACPI: move privat...
86
  /* --------------------------------------------------------------------------
82c7d5efa   Rafael J. Wysocki   ACPI / scan: Trea...
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   Lukas Wunner   ACPI / utils: Add...
91
  extern struct list_head acpi_bus_id_list;
edc345d88   Lukas Wunner   ACPI: Fix white s...
92
  struct acpi_device_bus_id {
2d12b6b38   Lukas Wunner   ACPI / utils: Add...
93
94
95
96
  	char bus_id[15];
  	unsigned int instance_no;
  	struct list_head node;
  };
cf860be63   Rafael J. Wysocki   ACPI / scan: Prev...
97
98
  int acpi_device_add(struct acpi_device *device,
  		    void (*release)(struct device *));
82c7d5efa   Rafael J. Wysocki   ACPI / scan: Trea...
99
100
  void acpi_init_device_object(struct acpi_device *device, acpi_handle handle,
  			     int type, unsigned long long sta);
c2efefb33   Rafael J. Wysocki   ACPI / scan: Move...
101
102
  int acpi_device_setup_files(struct acpi_device *dev);
  void acpi_device_remove_files(struct acpi_device *dev);
cf860be63   Rafael J. Wysocki   ACPI / scan: Prev...
103
  void acpi_device_add_finalize(struct acpi_device *device);
c0af41757   Toshi Kani   ACPI: Update PNPI...
104
  void acpi_free_pnp_ids(struct acpi_device_pnp *pnp);
cde1f95f4   Sakari Ailus   ACPI: Constify ar...
105
  bool acpi_device_is_present(const struct acpi_device *adev);
b43109fa4   Rafael J. Wysocki   ACPI / dock: Pass...
106
  bool acpi_device_is_battery(struct acpi_device *adev);
712e960f0   Mika Westerberg   ACPI / PM: Attach...
107
108
  bool acpi_device_is_first_physical_node(struct acpi_device *adev,
  					const struct device *dev);
a64a62ce9   Lv Zheng   ACPI / EC: Fix re...
109
  int acpi_bus_register_early_device(int type);
82c7d5efa   Rafael J. Wysocki   ACPI / scan: Trea...
110
111
  
  /* --------------------------------------------------------------------------
c2efefb33   Rafael J. Wysocki   ACPI / scan: Move...
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   Bjorn Helgaas   ACPI: move privat...
119
120
                                    Power Resource
     -------------------------------------------------------------------------- */
44515374c   Bjorn Helgaas   ACPI: call acpi_p...
121
  int acpi_power_init(void);
0b2245273   Rafael J. Wysocki   ACPI / PM: Take o...
122
  void acpi_power_resources_list_free(struct list_head *list);
e88c9c603   Rafael J. Wysocki   ACPI: Take power ...
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   Rafael J. Wysocki   ACPI / PM: Rework...
126
  void acpi_power_add_remove_device(struct acpi_device *adev, bool add);
b5d667eb3   Rafael J. Wysocki   ACPI / PM: Take u...
127
  int acpi_power_wakeup_list_init(struct list_head *list, int *system_level);
e60cc7a6f   Bjorn Helgaas   ACPI: move privat...
128
129
  int acpi_device_sleep_wake(struct acpi_device *dev,
                             int enable, int sleep_state, int dev_state);
32a00d274   Rafael J. Wysocki   ACPI / PM: Preven...
130
  int acpi_power_get_inferred_state(struct acpi_device *device, int *state);
30d3df41b   Rafael J. Wysocki   ACPI / PM: Introd...
131
  int acpi_power_on_resources(struct acpi_device *device, int state);
e60cc7a6f   Bjorn Helgaas   ACPI: move privat...
132
  int acpi_power_transition(struct acpi_device *device, int state);
e60cc7a6f   Bjorn Helgaas   ACPI: move privat...
133

9ed411c06   Rafael J. Wysocki   ACPI: PM: Unexpor...
134
135
136
137
  /* --------------------------------------------------------------------------
                                Device Power Management
     -------------------------------------------------------------------------- */
  int acpi_device_get_power(struct acpi_device *device, int *state);
201b8c655   Bjorn Helgaas   ACPI: call acpi_w...
138
  int acpi_wakeup_device_init(void);
46ba51ea8   Hanjun Guo   ACPI / processor:...
139

9ed411c06   Rafael J. Wysocki   ACPI: PM: Unexpor...
140
141
142
  /* --------------------------------------------------------------------------
                                    Processor
     -------------------------------------------------------------------------- */
46ba51ea8   Hanjun Guo   ACPI / processor:...
143
  #ifdef CONFIG_ARCH_MIGHT_HAVE_ACPI_PDC
78f169965   Alex Chiang   ACPI: processor: ...
144
  void acpi_early_processor_set_pdc(void);
46ba51ea8   Hanjun Guo   ACPI / processor:...
145
146
147
  #else
  static inline void acpi_early_processor_set_pdc(void) {}
  #endif
201b8c655   Bjorn Helgaas   ACPI: call acpi_w...
148

a21211672   Srinivas Pandruvada   ACPI / processor:...
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   Bjorn Helgaas   ACPI: move privat...
154
155
156
  /* --------------------------------------------------------------------------
                                    Embedded Controller
     -------------------------------------------------------------------------- */
1195a0981   Thomas Renninger   ACPI: Provide /sy...
157
158
  struct acpi_ec {
  	acpi_handle handle;
3522f867c   Geert Uytterhoeven   ACPI: EC: Fix deb...
159
  	u32 gpe;
1195a0981   Thomas Renninger   ACPI: Provide /sy...
160
161
  	unsigned long command_addr;
  	unsigned long data_addr;
621a5f7ad   Viresh Kumar   debugfs: Pass boo...
162
  	bool global_lock;
1195a0981   Thomas Renninger   ACPI: Provide /sy...
163
  	unsigned long flags;
9887d22ad   Lv Zheng   ACPI / EC: Add co...
164
  	unsigned long reference_count;
f351d027e   Feng Tang   ACPI / EC: Cleanu...
165
  	struct mutex mutex;
1195a0981   Thomas Renninger   ACPI: Provide /sy...
166
167
168
  	wait_queue_head_t wait;
  	struct list_head list;
  	struct transaction *curr;
f351d027e   Feng Tang   ACPI / EC: Cleanu...
169
  	spinlock_t lock;
74443bbed   Lv Zheng   ACPI / EC: Fix is...
170
  	struct work_struct work;
d8d031a60   Lv Zheng   ACPI / EC: Fix an...
171
  	unsigned long timestamp;
9d8993be2   Lv Zheng   ACPI / EC: Conver...
172
  	unsigned long nr_pending_queries;
c3a696b6e   Lv Zheng   ACPI / EC: Use bu...
173
174
  	bool busy_polling;
  	unsigned int polling_guard;
1195a0981   Thomas Renninger   ACPI: Provide /sy...
175
176
177
  };
  
  extern struct acpi_ec *first_ec;
b8a0b0d19   Rashika   ACPI / EC: Remove...
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   Bjorn Helgaas   ACPI: call acpi_e...
181
  int acpi_ec_init(void);
fdb3c1776   Rafael J. Wysocki   ACPI: EC: Clean u...
182
183
  void acpi_ec_ecdt_probe(void);
  void acpi_ec_dsdt_probe(void);
fe955682d   Rafael J. Wysocki   ACPI / EC / PM: F...
184
185
  void acpi_ec_block_transactions(void);
  void acpi_ec_unblock_transactions(void);
b8a0b0d19   Rashika   ACPI / EC: Remove...
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   Rafael J. Wysocki   ACPI / PM / EC: F...
190
191
  #ifdef CONFIG_PM_SLEEP
  void acpi_ec_flush_work(void);
d75894049   Rafael J. Wysocki   ACPI: EC: PM: Con...
192
  bool acpi_ec_dispatch_gpe(void);
880a66275   Rafael J. Wysocki   ACPI / PM / EC: F...
193
  #endif
e60cc7a6f   Bjorn Helgaas   ACPI: move privat...
194
195
196
197
  
  /*--------------------------------------------------------------------------
                                    Suspend/Resume
    -------------------------------------------------------------------------- */
6e0a0ea12   Graeme Gregory   ACPI / sleep: Int...
198
  #ifdef CONFIG_ACPI_SYSTEM_POWER_STATES_SUPPORT
33e4f80ee   Rafael J. Wysocki   ACPI / PM: Ignore...
199
  extern bool acpi_s2idle_wakeup(void);
e60cc7a6f   Bjorn Helgaas   ACPI: move privat...
200
  extern int acpi_sleep_init(void);
6e0a0ea12   Graeme Gregory   ACPI / sleep: Int...
201
  #else
33e4f80ee   Rafael J. Wysocki   ACPI / PM: Ignore...
202
  static inline bool acpi_s2idle_wakeup(void) { return false; }
6e0a0ea12   Graeme Gregory   ACPI / sleep: Int...
203
204
  static inline int acpi_sleep_init(void) { return -ENXIO; }
  #endif
9cee43e07   Bjorn Helgaas   ACPI: call acpi_s...
205
206
  
  #ifdef CONFIG_ACPI_SLEEP
f934c7450   Rami Rosen   ACPI: change acpi...
207
  void acpi_sleep_proc_init(void);
976513dbf   Rafael J. Wysocki   PM / ACPI: Move N...
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   Bjorn Helgaas   ACPI: call acpi_s...
212
  #else
f934c7450   Rami Rosen   ACPI: change acpi...
213
  static inline void acpi_sleep_proc_init(void) {}
976513dbf   Rafael J. Wysocki   PM / ACPI: Move N...
214
215
  static inline int suspend_nvs_alloc(void) { return 0; }
  static inline void suspend_nvs_free(void) {}
6fed05c9c   Rafael J. Wysocki   ACPI / PM: Fix bu...
216
  static inline int suspend_nvs_save(void) { return 0; }
976513dbf   Rafael J. Wysocki   PM / ACPI: Move N...
217
  static inline void suspend_nvs_restore(void) {}
9cee43e07   Bjorn Helgaas   ACPI: call acpi_s...
218
  #endif
1195a0981   Thomas Renninger   ACPI: Provide /sy...
219

91e568780   Mika Westerberg   ACPI: Add support...
220
  /*--------------------------------------------------------------------------
ffdcd955c   Mika Westerberg   ACPI: Add support...
221
222
  				Device properties
    -------------------------------------------------------------------------- */
ee8920940   Rafael J. Wysocki   ACPI / property: ...
223
  #define ACPI_DT_NAMESPACE_HID	"PRP0001"
ffdcd955c   Mika Westerberg   ACPI: Add support...
224
225
  void acpi_init_properties(struct acpi_device *adev);
  void acpi_free_properties(struct acpi_device *adev);
899596e09   Lukas Wunner   ACPI / property: ...
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   Mika Westerberg   ACPI / watchdog: ...
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   Srinivas Pandruvada   ACPI / LPIT: Add ...
240
241
242
243
244
  #ifdef CONFIG_ACPI_LPIT
  void acpi_init_lpit(void);
  #else
  static inline void acpi_init_lpit(void) { }
  #endif
1195a0981   Thomas Renninger   ACPI: Provide /sy...
245
  #endif /* _ACPI_INTERNAL_H_ */