^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Name: achware.h -- hardware specific interfaces
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Copyright (C) 2000 - 2020, Intel Corp.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) *****************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #ifndef __ACHWARE_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #define __ACHWARE_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) /* Values for the _SST predefined method */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #define ACPI_SST_INDICATOR_OFF 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #define ACPI_SST_WORKING 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #define ACPI_SST_WAKING 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #define ACPI_SST_SLEEPING 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #define ACPI_SST_SLEEP_CONTEXT 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) * hwacpi - high level functions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) acpi_status acpi_hw_set_mode(u32 mode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) u32 acpi_hw_get_mode(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) * hwregs - ACPI Register I/O
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) acpi_hw_validate_register(struct acpi_generic_address *reg,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) u8 max_bit_width, u64 *address);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) acpi_status acpi_hw_read(u64 *value, struct acpi_generic_address *reg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) acpi_status acpi_hw_write(u64 value, struct acpi_generic_address *reg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) acpi_status acpi_hw_write_pm1_control(u32 pm1a_control, u32 pm1b_control);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) acpi_status acpi_hw_register_read(u32 register_id, u32 *return_value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) acpi_status acpi_hw_register_write(u32 register_id, u32 value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) acpi_status acpi_hw_clear_acpi_status(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) * hwsleep - sleep/wake support (Legacy sleep registers)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) acpi_status acpi_hw_legacy_sleep(u8 sleep_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) acpi_status acpi_hw_legacy_wake_prep(u8 sleep_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) acpi_status acpi_hw_legacy_wake(u8 sleep_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) * hwesleep - sleep/wake support (Extended FADT-V5 sleep registers)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) void acpi_hw_execute_sleep_method(char *method_name, u32 integer_argument);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) acpi_status acpi_hw_extended_sleep(u8 sleep_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) acpi_status acpi_hw_extended_wake_prep(u8 sleep_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) acpi_status acpi_hw_extended_wake(u8 sleep_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) * hwvalid - Port I/O with validation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) acpi_status acpi_hw_read_port(acpi_io_address address, u32 *value, u32 width);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) acpi_status acpi_hw_write_port(acpi_io_address address, u32 value, u32 width);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) acpi_status acpi_hw_validate_io_block(u64 address, u32 bit_width, u32 count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) * hwgpe - GPE support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) acpi_status acpi_hw_gpe_read(u64 *value, struct acpi_gpe_address *reg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) acpi_status acpi_hw_gpe_write(u64 value, struct acpi_gpe_address *reg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) u32 acpi_hw_get_gpe_register_bit(struct acpi_gpe_event_info *gpe_event_info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) acpi_hw_low_set_gpe(struct acpi_gpe_event_info *gpe_event_info, u32 action);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) struct acpi_gpe_block_info *gpe_block, void *context);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) acpi_status acpi_hw_clear_gpe(struct acpi_gpe_event_info *gpe_event_info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) acpi_hw_clear_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) struct acpi_gpe_block_info *gpe_block, void *context);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) acpi_hw_get_gpe_status(struct acpi_gpe_event_info *gpe_event_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) acpi_event_status *event_status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) acpi_status acpi_hw_disable_all_gpes(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) acpi_status acpi_hw_enable_all_runtime_gpes(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) acpi_status acpi_hw_enable_all_wakeup_gpes(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) u8 acpi_hw_check_all_gpes(acpi_handle gpe_skip_device, u32 gpe_skip_number);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) struct acpi_gpe_block_info *gpe_block,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) void *context);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) #ifdef ACPI_PCI_CONFIGURED
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) * hwpci - PCI configuration support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) acpi_hw_derive_pci_id(struct acpi_pci_id *pci_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) acpi_handle root_pci_device, acpi_handle pci_region);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) static inline acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) acpi_hw_derive_pci_id(struct acpi_pci_id *pci_id, acpi_handle root_pci_device,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) acpi_handle pci_region)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) return AE_SUPPORT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) #endif /* __ACHWARE_H__ */