Michał Żygowski | 72f06ca | 2020-04-13 21:42:24 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
| 3 | #include <stdint.h> |
| 4 | #include <arch/io.h> |
Michał Żygowski | 72f06ca | 2020-04-13 21:42:24 +0200 | [diff] [blame] | 5 | #include <cpu/x86/smm.h> |
| 6 | #include <superio/smsc/sch5545/sch5545.h> |
| 7 | |
Michał Żygowski | 72f06ca | 2020-04-13 21:42:24 +0200 | [diff] [blame] | 8 | int mainboard_smi_apmc(u8 data) |
| 9 | { |
| 10 | u8 val; |
| 11 | switch (data) { |
| 12 | case APM_CNT_ACPI_ENABLE: |
Michał Żygowski | 72f06ca | 2020-04-13 21:42:24 +0200 | [diff] [blame] | 13 | /* Enable wake on PS2 */ |
| 14 | val = inb(SCH5545_RUNTIME_REG_BASE + SCH5545_RR_PME_EN1); |
| 15 | val |= (SCH5545_KBD_PME_EN | SCH5545_MOUSE_PME_EN); |
| 16 | outb(val, SCH5545_RUNTIME_REG_BASE + SCH5545_RR_PME_EN1); |
| 17 | /* Clear pending and enable PMEs */ |
| 18 | outb(SCH5545_GLOBAL_PME_STS, SCH5545_RUNTIME_REG_BASE + SCH5545_RR_PME_STS); |
| 19 | outb(SCH5545_GLOBAL_PME_EN, SCH5545_RUNTIME_REG_BASE + SCH5545_RR_PME_EN); |
| 20 | break; |
| 21 | case APM_CNT_ACPI_DISABLE: |
Michał Żygowski | 72f06ca | 2020-04-13 21:42:24 +0200 | [diff] [blame] | 22 | /* Disable wake on PS2 */ |
| 23 | val = inb(SCH5545_RUNTIME_REG_BASE + SCH5545_RR_PME_EN1); |
| 24 | val &= ~(SCH5545_KBD_PME_EN | SCH5545_MOUSE_PME_EN); |
| 25 | outb(val, SCH5545_RUNTIME_REG_BASE + SCH5545_RR_PME_EN1); |
| 26 | /* Clear pending and disable PMEs */ |
| 27 | outb(SCH5545_GLOBAL_PME_STS, SCH5545_RUNTIME_REG_BASE + SCH5545_RR_PME_STS); |
| 28 | outb(0, SCH5545_RUNTIME_REG_BASE + SCH5545_RR_PME_EN); |
| 29 | break; |
| 30 | default: |
| 31 | break; |
| 32 | } |
| 33 | return 0; |
| 34 | } |