Re: git: 1349a733cf28 - main - ufshci: Introduce the ufshci(4) driver
Date: Sun, 15 Jun 2025 09:28:38 UTC
On Sun, 15 Jun 2025, A FreeBSD User wrote:
> Am Tage des Herren Sun, 15 Jun 2025 06:09:39 GMT
> Warner Losh <imp@FreeBSD.org> schrieb:
>
>> The branch main has been updated by imp:
>>
>> URL: https://cgit.FreeBSD.org/src/commit/?id=1349a733cf2828e0040cabef89eeadc3ff00c40b
>>
>> commit 1349a733cf2828e0040cabef89eeadc3ff00c40b
>> Author: Jaeyoon Choi <j_yoon.choi@samsung.com>
>> AuthorDate: 2025-06-13 18:33:01 +0000
>> Commit: Warner Losh <imp@FreeBSD.org>
>> CommitDate: 2025-06-15 06:08:56 +0000
>>
>> ufshci: Introduce the ufshci(4) driver
>>
>> This commit adds a storage driver that supports the Universal Flash
>> Storage Host Controller Interface (UFSHCI) on FreeBSD.
>>
>> Universal Flash Storage (UFS) is a flash-based mobile storage device
>> that replaces eMMC, aiming for high performance with low power. The UFS
>> Host Controller Interface (UFSHCI) is the host side controller and
>> connects UFS device to a system bus, such as PCIe.
>>
>> The code targets the latest standards:
>> - UFS 4.1: https://www.jedec.org/standards-documents/docs/jesd220g
>> - UFSHCI 4.1: https://www.jedec.org/standards-documents/docs/jesd223f
>>
>> The ufshci(4) driver implements controller/device initialization,
>> interrupt, single-doorbell(SDB) queue based IO requests. Support for
>> multi-queue (MCQ) IO requests is planned for a later commit.
>>
>> Implemented features:
>> - PCIe bus support
>> - legacy(INTx) Interrupt Handling
>> - UIC command support
>> - UTP Transfer Request (UTR) support
>> - UTP Task Management Request (UTMR) support
>> - single doorbell queue (SDB) with multiple queue depth
>> - SCSI command set support
>> - sysctl
>>
>> Work in progress:
>> - multi-Circular Queue (per-CPU IO queues)
>> - MSI-X interrupt Support
>> - write booster
>> - write Protect
>> - Host Performance Booster (HPB)
>> - interrupt aggregation
>> - ARM based system bus support
>> - ufs-utils port
>>
>> Tests were performed on QEMU and an Intel-based laptop.
>> Since QEMU has an emulated UFS device, I tested on QEMU.
>>
>> How to test on QEMU:
>> 1. Run QEMU
>> $ qemu-system-x86_64 ... -device ufs -drive
>> file=blk1g.bin,format=raw,if=none,id=luimg -device ufs-lu,drive=luimg,lun=0 2.
>> Loading/unloading the ufshci module on QEMU $ kldload
>> /usr/obj/usr/src/amd64.amd64/sys/modules/ufshci/ufshci.ko $ kldunload ufshci
>>
>> Testing on real hardware:
>> - Samsung Galaxy Book S (Intel Lakefield) with UFS 3.0
>> - Lenovo duet 3 11ian8 (Intel N100) with UFS 2.1
>>
>> Sponsored by: Samsung Electronics
>> Reviewed by: imp
>> Differential Revision: https://reviews.freebsd.org/D50370
>> ---
>> sbin/camcontrol/camcontrol.c | 13 +
>
> It seems changes to sources breaks buildkernel (at least for me) on customized kernel config:
>
> [...]
> --- camcontrol.pieo ---
> /usr/src/sbin/camcontrol/camcontrol.c:5407:23: error: use of undeclared identifier
> 'CTS_UFSHCI_VALID_MODE' --- all_subdir_bin ---
> --- all_subdir_bin/sleep ---
> ===> bin/sleep (all)
> --- all_subdir_sbin ---
> 5407 | if (ufshci->valid & CTS_UFSHCI_VALID_MODE) {
> | ^
> [...]
>
> Kind regards,
I am running a test build just to be sure but I think this should do:
commit 78f12afc38eabea82fd247c157d340e289dceeb8
Author: Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: Sun Jun 15 09:25:56 2025 +0000
Commit: Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: Sun Jun 15 09:25:56 2025 +0000
ufshci: camcontrol: use correct define to fix the build
Fixes: 1349a733cf28
diff --git sbin/camcontrol/camcontrol.c sbin/camcontrol/camcontrol.c
index 19684c044ef5..15a5d42a2ba5 100644
--- sbin/camcontrol/camcontrol.c
+++ sbin/camcontrol/camcontrol.c
@@ -5404,7 +5404,7 @@ cts_print(struct cam_device *device, struct ccb_trans_settings *cts)
struct ccb_trans_settings_ufshci *ufshci =
&cts->xport_specific.ufshci;
- if (ufshci->valid & CTS_UFSHCI_VALID_MODE) {
+ if (ufshci->valid & CTS_UFSHCI_VALID_LINK) {
fprintf(stdout, "%sHigh Speed Gear: %d (%d max)\n",
pathstr, ufshci->hs_gear, ufshci->max_hs_gear);
fprintf(stdout, "%sUnipro TX lanes: %d (%d max)\n", pathstr,
--
Bjoern A. Zeeb r15:7