Skip to content

Commit 5c62d5a

Browse files
chenhuacairafaeljw
authored andcommitted
ACPICA: Events: Support fixed PCIe wake event
ACPICA commit 32d875705c8ee8f99fd8b78dbed48633486a7640 Some chipsets (such as Loongson's LS7A) support fixed pcie wake event which is defined in the PM1 block(related description can be found in 4.8.4.1.1 PM1 Status Registers, 4.8.4.2.1 PM1 Control Registers and 5.2.9 Fixed ACPI Description Table (FADT)), so we add code to handle it. Link: https://uefi.org/specifications/ACPI/6.4/ Link: acpica/acpica@32d87570 Co-developed-by: Jianmin Lv <[email protected]> Signed-off-by: Jianmin Lv <[email protected]> Signed-off-by: Huacai Chen <[email protected]> Signed-off-by: Bob Moore <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 60f2096 commit 5c62d5a

File tree

4 files changed

+31
-1
lines changed

4 files changed

+31
-1
lines changed

drivers/acpi/acpica/evevent.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,9 @@ static acpi_status acpi_ev_fixed_event_initialize(void)
142142
status =
143143
acpi_write_bit_register(acpi_gbl_fixed_event_info
144144
[i].enable_register_id,
145+
(i ==
146+
ACPI_EVENT_PCIE_WAKE) ?
147+
ACPI_ENABLE_EVENT :
145148
ACPI_DISABLE_EVENT);
146149
if (ACPI_FAILURE(status)) {
147150
return (status);
@@ -185,6 +188,11 @@ u32 acpi_ev_fixed_event_detect(void)
185188
return (int_status);
186189
}
187190

191+
if (fixed_enable & ACPI_BITMASK_PCIEXP_WAKE_DISABLE)
192+
fixed_enable &= ~ACPI_BITMASK_PCIEXP_WAKE_DISABLE;
193+
else
194+
fixed_enable |= ACPI_BITMASK_PCIEXP_WAKE_DISABLE;
195+
188196
ACPI_DEBUG_PRINT((ACPI_DB_INTERRUPTS,
189197
"Fixed Event Block: Enable %08X Status %08X\n",
190198
fixed_enable, fixed_status));
@@ -250,6 +258,9 @@ static u32 acpi_ev_fixed_event_dispatch(u32 event)
250258
if (!acpi_gbl_fixed_event_handlers[event].handler) {
251259
(void)acpi_write_bit_register(acpi_gbl_fixed_event_info[event].
252260
enable_register_id,
261+
(event ==
262+
ACPI_EVENT_PCIE_WAKE) ?
263+
ACPI_ENABLE_EVENT :
253264
ACPI_DISABLE_EVENT);
254265

255266
ACPI_ERROR((AE_INFO,

drivers/acpi/acpica/hwsleep.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,20 @@ acpi_status acpi_hw_legacy_wake(u8 sleep_state)
311311
[ACPI_EVENT_SLEEP_BUTTON].
312312
status_register_id, ACPI_CLEAR_STATUS);
313313

314+
/* Enable pcie wake event if support */
315+
if ((acpi_gbl_FADT.flags & ACPI_FADT_PCI_EXPRESS_WAKE)) {
316+
(void)
317+
acpi_write_bit_register(acpi_gbl_fixed_event_info
318+
[ACPI_EVENT_PCIE_WAKE].
319+
enable_register_id,
320+
ACPI_DISABLE_EVENT);
321+
(void)
322+
acpi_write_bit_register(acpi_gbl_fixed_event_info
323+
[ACPI_EVENT_PCIE_WAKE].
324+
status_register_id,
325+
ACPI_CLEAR_STATUS);
326+
}
327+
314328
acpi_hw_execute_sleep_method(METHOD_PATHNAME__SST, ACPI_SST_WORKING);
315329
return_ACPI_STATUS(status);
316330
}

drivers/acpi/acpica/utglobal.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,10 @@ struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS] =
186186
ACPI_BITREG_RT_CLOCK_ENABLE,
187187
ACPI_BITMASK_RT_CLOCK_STATUS,
188188
ACPI_BITMASK_RT_CLOCK_ENABLE},
189+
/* ACPI_EVENT_PCIE_WAKE */ {ACPI_BITREG_PCIEXP_WAKE_STATUS,
190+
ACPI_BITREG_PCIEXP_WAKE_DISABLE,
191+
ACPI_BITMASK_PCIEXP_WAKE_STATUS,
192+
ACPI_BITMASK_PCIEXP_WAKE_DISABLE},
189193
};
190194
#endif /* !ACPI_REDUCED_HARDWARE */
191195

include/acpi/actypes.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,8 @@ typedef u32 acpi_event_type;
723723
#define ACPI_EVENT_POWER_BUTTON 2
724724
#define ACPI_EVENT_SLEEP_BUTTON 3
725725
#define ACPI_EVENT_RTC 4
726-
#define ACPI_EVENT_MAX 4
726+
#define ACPI_EVENT_PCIE_WAKE 5
727+
#define ACPI_EVENT_MAX 5
727728
#define ACPI_NUM_FIXED_EVENTS ACPI_EVENT_MAX + 1
728729

729730
/*

0 commit comments

Comments
 (0)