From a023241e6b1b3990c93f58e7d64fd4a7a054f310 Mon Sep 17 00:00:00 2001 From: vasilito Date: Fri, 24 Jul 2026 15:16:23 +0900 Subject: [PATCH] =?UTF-8?q?redox-driver-core:=20add=20PciErsResult=20?= =?UTF-8?q?=E2=80=94=20Linux=20pci=5Fers=5Fresult=206-state=20enum?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mirrors Linux 7.1's pci_ers_result (include/linux/pci.h:920-938): None/CanRecover/NeedReset/Disconnect/Recovered/NoAerDriver. This is the vocabulary Driver::error_detected will return when the AER recovery flow is wired to bound drivers. Currently the legacy RecoveryAction enum (Handled/ResetDevice/RescanBus/Fatal) coexists for the existing on_error callback — PciErsResult is the richer model that will replace it once the driver-manager → driver IPC channel exists for AER dispatch. --- .../redox-driver-core/source/src/driver.rs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/local/recipes/drivers/redox-driver-core/source/src/driver.rs b/local/recipes/drivers/redox-driver-core/source/src/driver.rs index eafb5d8995..b4fff86081 100644 --- a/local/recipes/drivers/redox-driver-core/source/src/driver.rs +++ b/local/recipes/drivers/redox-driver-core/source/src/driver.rs @@ -61,6 +61,26 @@ pub enum RecoveryAction { Fatal, } +/// The 6-state PCI error-recovery result, mirroring Linux's +/// `pci_ers_result` (include/linux/pci.h:920-938). Used by +/// `Driver::error_detected` to report whether the driver can recover, +/// needs a reset, or is dead. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum PciErsResult { + /// No action taken. + None, + /// Driver can recover without a device reset. + CanRecover, + /// Driver requests a slot reset before continuing. + NeedReset, + /// Device is permanently lost; disconnect. + Disconnect, + /// Recovery completed successfully. + Recovered, + /// No AER-capable driver is bound. + NoAerDriver, +} + /// A device driver that can bind to and manage devices. pub trait Driver: Send + Sync { /// Returns the unique driver name, such as `"nvmed"` or `"e1000d"`.