Skip to content

feat(power): introduced a power subsystem with shutdown and reboot support - #179

Merged
FlareCoding merged 3 commits into
masterfrom
pr/power
Aug 28, 2026
Merged

feat(power): introduced a power subsystem with shutdown and reboot support#179
FlareCoding merged 3 commits into
masterfrom
pr/power

Conversation

@FlareCoding

@FlareCoding FlareCoding commented Aug 28, 2026

Copy link
Copy Markdown
Owner

Note

High Risk
Changes privileged shutdown/reboot paths (ACPI PM1/AML, I/O ports, MMIO, PSCI) that can hang or misbehave on wrong firmware; bugs affect every platform build.

Overview
Introduces a shared power::shutdown() / power::reboot() API and arch-specific implementations that drive real hardware power transitions instead of only halting.

ACPI gains typed FADT / GAS layouts, acpi::get_fadt(), acpi::map_table() (for DSDT and other pointer-referenced tables), and shared map_sdt() mapping logic. Existing FACP users (RTC century, RPi4 detection, SMP) move off raw header hacks to these helpers.

On x86_64, shutdown walks ACPI S5: map DSDT, scan AML for \_S5_ sleep types, enable ACPI mode if needed, then program PM1a/PM1b with SLP_EN. Reboot tries FADT reset register, keyboard-controller pulse, 0xCF9, then triple-fault.

On aarch64, shutdown/reboot use PSCI SYSTEM_OFF / SYSTEM_RESET after psci::detect_conduit() (moved out of SMP). PSCI helpers and conduit detection are centralized in psci.

Call sites return ERR_UNSUPPORTED when a mechanism fails so upper layers can fall back.

Reviewed by Cursor Bugbot for commit 8230c57. Bugbot is set up for automated code reviews on this repo. Configure here.

@FlareCoding
FlareCoding merged commit f753f18 into master Aug 28, 2026
19 checks passed
@FlareCoding
FlareCoding deleted the pr/power branch August 28, 2026 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant