summaryrefslogtreecommitdiff
path: root/drivers/ata/libata.h
diff options
context:
space:
mode:
authorMarkus Probst <markus.probst@posteo.de>2025-11-04 14:24:34 +0000
committerMartin K. Petersen <martin.petersen@oracle.com>2025-11-08 13:24:56 -0500
commit8c59fc1c90df7ff29565d9743f0e61180e9ee00d (patch)
tree35a8a0d0332c76fc433b398da923400df9fbafcc /drivers/ata/libata.h
parentce6d26b5330c5de4f458143e9675984e367f6a40 (diff)
scsi: ata: Stop disk on restart if ACPI power resources are found
Some embedded devices have the ability to control whether power is provided to the disks via the SATA power connector or not. ACPI power resources are usually off by default, thus making it unclear if the specific power resource will retain its state after a restart. If power resources are defined on ATA ports / devices in ACPI, we should stop the disk on SYSTEM_RESTART, to ensure the disk will not lose power while active. Add a new function, ata_acpi_dev_manage_restart(), that will be used to determine if a disk should be stopped before restarting the system. If a usable ACPI power resource has been found, it is assumed that the disk will lose power after a restart and should be stopped to avoid unclean shutdown due to power loss. Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Signed-off-by: Markus Probst <markus.probst@posteo.de> Link: https://patch.msgid.link/20251104142413.322347-4-markus.probst@posteo.de Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/ata/libata.h')
-rw-r--r--drivers/ata/libata.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h
index 8cc7227f2d94..0e7ecac73680 100644
--- a/drivers/ata/libata.h
+++ b/drivers/ata/libata.h
@@ -131,6 +131,7 @@ extern void ata_acpi_set_state(struct ata_port *ap, pm_message_t state);
extern void ata_acpi_bind_port(struct ata_port *ap);
extern void ata_acpi_bind_dev(struct ata_device *dev);
extern void ata_acpi_port_power_on(struct ata_port *ap);
+extern bool ata_acpi_dev_manage_restart(struct ata_device *dev);
extern acpi_handle ata_dev_acpi_handle(struct ata_device *dev);
#else
static inline void ata_acpi_dissociate(struct ata_host *host) { }
@@ -142,6 +143,7 @@ static inline void ata_acpi_set_state(struct ata_port *ap,
static inline void ata_acpi_bind_port(struct ata_port *ap) {}
static inline void ata_acpi_bind_dev(struct ata_device *dev) {}
static inline void ata_acpi_port_power_on(struct ata_port *ap) {}
+static inline bool ata_acpi_dev_manage_restart(struct ata_device *dev) { return 0; }
#endif
/* libata-scsi.c */