git: cf04a05424f1 - main - ufshci: fix data direction encoding for read commands

From: Jaeyoon Choi <jaeyoon_at_FreeBSD.org>
Date: Mon, 10 Aug 2026 02:31:15 UTC
The branch main has been updated by jaeyoon:

URL: https://cgit.FreeBSD.org/src/commit/?id=cf04a05424f1a79e55303de252e5873abeae7b88

commit cf04a05424f1a79e55303de252e5873abeae7b88
Author:     Jaeyoon Choi <jaeyoon@FreeBSD.org>
AuthorDate: 2026-08-10 01:30:11 +0000
Commit:     Jaeyoon Choi <jaeyoon@FreeBSD.org>
CommitDate: 2026-08-10 02:28:46 +0000

    ufshci: fix data direction encoding for read commands
    
    The data_direction field in the UTP Transfer Request Descriptor is only
    2 bits wide ([26:25]). UFSHCI_DATA_DIRECTION_FROM_TGT_TO_SYS was defined
    as 0x10, which truncates to 0b00 (No data transfer) when stored into the
    2-bit field, so every read command was described to the controller as
    having no data phase. Only writes (0b01) happened to be encoded
    correctly.
    
    Define all values as 2-bit binary literals, matching the existing
    RESERVED = 0b11 entry, so read is encoded as 0b10 as required by the
    specification.
    
    Sponsored by:           Samsung Electronics
    Reviewed by:            imp (mentor)
    Differential Revision:  https://reviews.freebsd.org/D58652
---
 sys/dev/ufshci/ufshci.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sys/dev/ufshci/ufshci.h b/sys/dev/ufshci/ufshci.h
index 766d8de0535b..c2bef5c9a807 100644
--- a/sys/dev/ufshci/ufshci.h
+++ b/sys/dev/ufshci/ufshci.h
@@ -154,9 +154,9 @@ enum ufshci_command_type {
 };
 
 enum ufshci_data_direction {
-	UFSHCI_DATA_DIRECTION_NO_DATA_TRANSFER = 0x00,
-	UFSHCI_DATA_DIRECTION_FROM_SYS_TO_TGT = 0x01,
-	UFSHCI_DATA_DIRECTION_FROM_TGT_TO_SYS = 0x10,
+	UFSHCI_DATA_DIRECTION_NO_DATA_TRANSFER = 0b00,
+	UFSHCI_DATA_DIRECTION_FROM_SYS_TO_TGT = 0b01,
+	UFSHCI_DATA_DIRECTION_FROM_TGT_TO_SYS = 0b10,
 	UFSHCI_DATA_DIRECTION_RESERVED = 0b11,
 };