blob: b29ba436944ad5a29065c326c409aa3eedee916c [file] [log] [blame]
Erik Schmauss95857632018-03-14 16:13:07 -07001/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002/******************************************************************************
3 *
4 * Name: acevents.h - Event subcomponent prototypes and defines
5 *
Bob Moore4441e552021-01-15 10:48:25 -08006 * Copyright (C) 2000 - 2021, Intel Corp.
Linus Torvalds1da177e2005-04-16 15:20:36 -07007 *
Erik Schmauss95857632018-03-14 16:13:07 -07008 *****************************************************************************/
Linus Torvalds1da177e2005-04-16 15:20:36 -07009
10#ifndef __ACEVENTS_H__
11#define __ACEVENTS_H__
12
Robert Moore44f6c012005-04-18 22:49:35 -040013/*
Erik Schmauss87cd8262018-03-14 16:12:59 -070014 * Conditions to trigger post enabling GPE polling:
15 * It is not sufficient to trigger edge-triggered GPE with specific GPE
16 * chips, software need to poll once after enabling.
17 */
18#ifdef ACPI_USE_GPE_POLLING
19#define ACPI_GPE_IS_POLLING_NEEDED(__gpe__) \
20 ((__gpe__)->runtime_count == 1 && \
21 (__gpe__)->flags & ACPI_GPE_INITIALIZED && \
22 ((__gpe__)->flags & ACPI_GPE_XRUPT_TYPE_MASK) == ACPI_GPE_EDGE_TRIGGERED)
23#else
24#define ACPI_GPE_IS_POLLING_NEEDED(__gpe__) FALSE
25#endif
26
27/*
Robert Moore44f6c012005-04-18 22:49:35 -040028 * evevent
29 */
Len Brown4be44fc2005-08-05 00:44:28 -040030acpi_status acpi_ev_initialize_events(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -070031
Len Brown4be44fc2005-08-05 00:44:28 -040032acpi_status acpi_ev_install_xrupt_handlers(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -070033
Len Brown4be44fc2005-08-05 00:44:28 -040034u32 acpi_ev_fixed_event_detect(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -070035
36/*
Robert Moore44f6c012005-04-18 22:49:35 -040037 * evmisc
Linus Torvalds1da177e2005-04-16 15:20:36 -070038 */
Len Brown4be44fc2005-08-05 00:44:28 -040039u8 acpi_ev_is_notify_object(struct acpi_namespace_node *node);
40
Len Brown4be44fc2005-08-05 00:44:28 -040041u32 acpi_ev_get_gpe_number_index(u32 gpe_number);
Linus Torvalds1da177e2005-04-16 15:20:36 -070042
43acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -040044acpi_ev_queue_notify_request(struct acpi_namespace_node *node,
45 u32 notify_value);
Linus Torvalds1da177e2005-04-16 15:20:36 -070046
47/*
Bob Moore0f6896f2011-04-13 11:33:17 +080048 * evglock - Global Lock support
49 */
50acpi_status acpi_ev_init_global_lock_handler(void);
51
Bob Moore33620c52012-02-14 18:14:27 +080052ACPI_HW_DEPENDENT_RETURN_OK(acpi_status
53 acpi_ev_acquire_global_lock(u16 timeout))
Lv Zhengcd27d792013-10-29 09:30:22 +080054ACPI_HW_DEPENDENT_RETURN_OK(acpi_status acpi_ev_release_global_lock(void))
Lv Zhengf5c1e1c2016-05-05 12:57:53 +080055
Lv Zhenged606942014-01-08 13:44:56 +080056acpi_status acpi_ev_remove_global_lock_handler(void);
Bob Moore0f6896f2011-04-13 11:33:17 +080057
58/*
Bob Moore3fe50202010-04-27 11:41:19 +080059 * evgpe - Low-level GPE support
Linus Torvalds1da177e2005-04-16 15:20:36 -070060 */
Bob Moore3fe50202010-04-27 11:41:19 +080061u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info *gpe_xrupt_list);
62
Linus Torvalds1da177e2005-04-16 15:20:36 -070063acpi_status
Rafael J. Wysockia44061a2010-07-01 10:11:45 +080064acpi_ev_update_gpe_enable_mask(struct acpi_gpe_event_info *gpe_event_info);
Linus Torvalds1da177e2005-04-16 15:20:36 -070065
Rafael J. Wysocki3bd741b2010-07-01 11:01:12 +080066acpi_status acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info);
67
Lv Zheng1f86e8c2012-10-31 02:25:45 +000068acpi_status
Lv Zheng2af52c22016-08-04 16:43:39 +080069acpi_ev_mask_gpe(struct acpi_gpe_event_info *gpe_event_info, u8 is_masked);
70
71acpi_status
Rafael J. Wysocki44758ba2019-06-17 13:31:45 +020072acpi_ev_add_gpe_reference(struct acpi_gpe_event_info *gpe_event_info,
73 u8 clear_on_enable);
Rafael J. Wysocki28f4f8a2010-08-03 23:55:14 +020074
Lv Zheng1f86e8c2012-10-31 02:25:45 +000075acpi_status
76acpi_ev_remove_gpe_reference(struct acpi_gpe_event_info *gpe_event_info);
Rafael J. Wysocki28f4f8a2010-08-03 23:55:14 +020077
Len Brown4be44fc2005-08-05 00:44:28 -040078struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device,
79 u32 gpe_number);
Robert Moore44f6c012005-04-18 22:49:35 -040080
Lin Ming0f849d22010-04-06 14:52:37 +080081struct acpi_gpe_event_info *acpi_ev_low_get_gpe_info(u32 gpe_number,
82 struct acpi_gpe_block_info
83 *gpe_block);
84
Lin Mingbba63a22010-12-13 13:39:17 +080085acpi_status acpi_ev_finish_gpe(struct acpi_gpe_event_info *gpe_event_info);
86
Erik Schmauss8d593492018-03-14 16:12:58 -070087u32
88acpi_ev_detect_gpe(struct acpi_namespace_node *gpe_device,
89 struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number);
90
Robert Moore44f6c012005-04-18 22:49:35 -040091/*
Bob Moore3fe50202010-04-27 11:41:19 +080092 * evgpeblk - Upper-level GPE block support
Robert Moore44f6c012005-04-18 22:49:35 -040093 */
Robert Moore44f6c012005-04-18 22:49:35 -040094acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -040095acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device,
Bob Moore7505da42014-04-30 10:06:15 +080096 u64 address,
97 u8 space_id,
Len Brown4be44fc2005-08-05 00:44:28 -040098 u32 register_count,
Bob Moore7505da42014-04-30 10:06:15 +080099 u16 gpe_block_base_number,
Len Brown4be44fc2005-08-05 00:44:28 -0400100 u32 interrupt_number,
101 struct acpi_gpe_block_info **return_gpe_block);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700102
Bob Moore96db2552005-11-02 00:00:00 -0500103acpi_status
Rafael J. Wysockia2100802010-09-16 00:30:43 +0200104acpi_ev_initialize_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
105 struct acpi_gpe_block_info *gpe_block,
Lin Ming3a378982010-12-13 13:36:15 +0800106 void *context);
Bob Moore96db2552005-11-02 00:00:00 -0500107
Bob Moore33620c52012-02-14 18:14:27 +0800108ACPI_HW_DEPENDENT_RETURN_OK(acpi_status
109 acpi_ev_delete_gpe_block(struct acpi_gpe_block_info
110 *gpe_block))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700111
Linus Torvalds1da177e2005-04-16 15:20:36 -0700112u32
Lin Ming8b6cd8a2010-12-13 13:38:46 +0800113acpi_ev_gpe_dispatch(struct acpi_namespace_node *gpe_device,
114 struct acpi_gpe_event_info *gpe_event_info,
Len Brown4be44fc2005-08-05 00:44:28 -0400115 u32 gpe_number);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700116
Bob Moore3fe50202010-04-27 11:41:19 +0800117/*
118 * evgpeinit - GPE initialization and update
119 */
Len Brown4be44fc2005-08-05 00:44:28 -0400120acpi_status acpi_ev_gpe_initialize(void);
Robert Moore44f6c012005-04-18 22:49:35 -0400121
Bob Moore33620c52012-02-14 18:14:27 +0800122ACPI_HW_DEPENDENT_RETURN_VOID(void
123 acpi_ev_update_gpes(acpi_owner_id table_owner_id))
Bob Moore3fe50202010-04-27 11:41:19 +0800124
Lv Zhenged606942014-01-08 13:44:56 +0800125acpi_status
Bob Moore3fe50202010-04-27 11:41:19 +0800126acpi_ev_match_gpe_method(acpi_handle obj_handle,
127 u32 level, void *context, void **return_value);
128
Bob Moore3fe50202010-04-27 11:41:19 +0800129/*
130 * evgpeutil - GPE utilities
131 */
132acpi_status
133acpi_ev_walk_gpe_list(acpi_gpe_callback gpe_walk_callback, void *context);
134
Lin Ming3cfd53d2010-12-13 13:36:02 +0800135acpi_status
136acpi_ev_get_gpe_device(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
137 struct acpi_gpe_block_info *gpe_block, void *context);
138
Bob Moore4bec3d82014-01-08 13:44:10 +0800139acpi_status
140acpi_ev_get_gpe_xrupt_block(u32 interrupt_number,
141 struct acpi_gpe_xrupt_info **gpe_xrupt_block);
Bob Moore3fe50202010-04-27 11:41:19 +0800142
143acpi_status acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt);
144
145acpi_status
146acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
147 struct acpi_gpe_block_info *gpe_block,
148 void *context);
149
Robert Moore44f6c012005-04-18 22:49:35 -0400150/*
Bob Moore42f8fb72013-01-11 13:08:51 +0100151 * evhandler - Address space handling
Robert Moore44f6c012005-04-18 22:49:35 -0400152 */
Lv Zhengf31a99ce2015-12-29 14:02:00 +0800153union acpi_operand_object *acpi_ev_find_region_handler(acpi_adr_space_type
154 space_id,
155 union acpi_operand_object
156 *handler_obj);
157
Bob Moore42f8fb72013-01-11 13:08:51 +0100158u8
159acpi_ev_has_default_handler(struct acpi_namespace_node *node,
160 acpi_adr_space_type space_id);
161
Len Brown4be44fc2005-08-05 00:44:28 -0400162acpi_status acpi_ev_install_region_handlers(void);
163
Bob Moore42f8fb72013-01-11 13:08:51 +0100164acpi_status
165acpi_ev_install_space_handler(struct acpi_namespace_node *node,
166 acpi_adr_space_type space_id,
167 acpi_adr_space_handler handler,
168 acpi_adr_space_setup setup, void *context);
169
170/*
171 * evregion - Operation region support
172 */
Len Brown4be44fc2005-08-05 00:44:28 -0400173acpi_status acpi_ev_initialize_op_regions(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700174
175acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400176acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
Bob Moore9ce81782011-11-16 13:39:07 +0800177 union acpi_operand_object *field_obj,
Len Brown4be44fc2005-08-05 00:44:28 -0400178 u32 function,
Bob Moore5df7e6c2010-01-21 10:06:32 +0800179 u32 region_offset, u32 bit_width, u64 *value);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700180
181acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400182acpi_ev_attach_region(union acpi_operand_object *handler_obj,
183 union acpi_operand_object *region_obj,
184 u8 acpi_ns_is_locked);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700185
186void
Len Brown4be44fc2005-08-05 00:44:28 -0400187acpi_ev_detach_region(union acpi_operand_object *region_obj,
188 u8 acpi_ns_is_locked);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700189
Lv Zhengd8153462015-12-29 14:03:43 +0800190void
Len Brown4be44fc2005-08-05 00:44:28 -0400191acpi_ev_execute_reg_methods(struct acpi_namespace_node *node,
Lv Zhengd8153462015-12-29 14:03:43 +0800192 acpi_adr_space_type space_id, u32 function);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700193
194acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400195acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700196
197/*
Robert Moore44f6c012005-04-18 22:49:35 -0400198 * evregini - Region initialization and setup
Linus Torvalds1da177e2005-04-16 15:20:36 -0700199 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700200acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400201acpi_ev_system_memory_region_setup(acpi_handle handle,
202 u32 function,
203 void *handler_context,
204 void **region_context);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700205
206acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400207acpi_ev_io_space_region_setup(acpi_handle handle,
208 u32 function,
209 void *handler_context, void **region_context);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700210
211acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400212acpi_ev_pci_config_region_setup(acpi_handle handle,
213 u32 function,
214 void *handler_context, void **region_context);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700215
216acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400217acpi_ev_cmos_region_setup(acpi_handle handle,
218 u32 function,
219 void *handler_context, void **region_context);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700220
221acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400222acpi_ev_pci_bar_region_setup(acpi_handle handle,
223 u32 function,
224 void *handler_context, void **region_context);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700225
226acpi_status
Jessica Clarkeca25f92b2021-12-22 17:21:25 +0100227acpi_ev_data_table_region_setup(acpi_handle handle,
228 u32 function,
229 void *handler_context, void **region_context);
230
231acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400232acpi_ev_default_region_setup(acpi_handle handle,
233 u32 function,
234 void *handler_context, void **region_context);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700235
Lv Zheng760235c2016-11-30 15:21:12 +0800236acpi_status acpi_ev_initialize_region(union acpi_operand_object *region_obj);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700237
Bob Moore8b1cafd2018-10-03 11:45:38 -0700238u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node);
239
Linus Torvalds1da177e2005-04-16 15:20:36 -0700240/*
Robert Moore44f6c012005-04-18 22:49:35 -0400241 * evsci - SCI (System Control Interrupt) handling/dispatch
Linus Torvalds1da177e2005-04-16 15:20:36 -0700242 */
Len Brown4be44fc2005-08-05 00:44:28 -0400243u32 ACPI_SYSTEM_XFACE acpi_ev_gpe_xrupt_handler(void *context);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700244
Lv Zhenga2fd4b42013-09-23 09:52:05 +0800245u32 acpi_ev_sci_dispatch(void);
246
Len Brown4be44fc2005-08-05 00:44:28 -0400247u32 acpi_ev_install_sci_handler(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700248
Lv Zhenga2fd4b42013-09-23 09:52:05 +0800249acpi_status acpi_ev_remove_all_sci_handlers(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700250
Bob Moore33620c52012-02-14 18:14:27 +0800251ACPI_HW_DEPENDENT_RETURN_VOID(void acpi_ev_terminate(void))
Len Brown4be44fc2005-08-05 00:44:28 -0400252#endif /* __ACEVENTS_H__ */