summaryrefslogtreecommitdiff
path: root/sys/include
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-06-10 23:29:17 -0400
committerIan Moffett <ian@osmora.org>2025-06-10 23:35:14 -0400
commitc3fe4c4c4dfb662e65299669147a904585eb5aca (patch)
tree9d3c49747877ab9795d54bdc19270db4a21ae398 /sys/include
parent031dc9ef078da2fcf6e804447f5782f12f70725e (diff)
kernel: ahci: Improve port reset logic
- Set PxCMD.SUD if the HBA supports staggered spin-up to ensure the device will be detectable. - Wait for the device link to be established - Detect and log SATA link speed Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/include')
-rw-r--r--sys/include/dev/ic/ahciregs.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/sys/include/dev/ic/ahciregs.h b/sys/include/dev/ic/ahciregs.h
index f959a1e..129ac76 100644
--- a/sys/include/dev/ic/ahciregs.h
+++ b/sys/include/dev/ic/ahciregs.h
@@ -88,6 +88,7 @@ struct hba_memspace {
*/
#define AHCI_PXSSTS_DET(SSTS) (SSTS & 0xF)
#define AHCI_PXSSTS_IPM(SSTS) ((SSTS >> 8) & 0xF)
+#define AHCI_PXSSTS_SPD(SSTS) ((SSTS >> 4) & 0xF)
/*
* Port SATA control bits
@@ -100,6 +101,7 @@ struct hba_memspace {
* See section 3.3.7 of the AHCI spec.
*/
#define AHCI_PXCMD_ST BIT(0) /* Start */
+#define AHCI_PXCMD_SUD BIT(1) /* Spin-up device */
#define AHCI_PXCMD_FRE BIT(4) /* FIS Receive Enable */
#define AHCI_PXCMD_FR BIT(14) /* FIS Receive Running */
#define AHCI_PXCMD_CR BIT(15) /* Command List Running */
@@ -137,6 +139,9 @@ struct hba_memspace {
#define AHCI_DET_PRESENT 1 /* Device present (no PHY comm) */
#define AHCI_DET_COMM 3 /* Device present and phy comm established */
#define AHCI_IPM_ACTIVE 1
+#define AHCI_SPD_GEN1 1 /* 1.5 Gb/s */
+#define AHCI_SPD_GEN2 2 /* 3 Gb/s */
+#define AHCI_SPD_GEN3 3 /* 6 Gb/s */
/*
* PxSERR bits