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

Jaeyoon Choi <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.src
Message-ID <6a7937f3.1e74a.592fd71__16096.2181094632$1786329157$gmane$org@gitrepo.freebsd.org>
The branch main has been updated by jaeyoon:

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

commit cf04a05424f1a79e55303de252e5873abeae7b88
Author:     Jaeyoon Choi <[email protected]>
AuthorDate: 2026-08-10 01:30:11 +0000
Commit:     Jaeyoon Choi <[email protected]>
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,
 };
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.