From ac67c79a6c93f1df032a1f7613d694706d44fa2c Mon Sep 17 00:00:00 2001 From: mglocker Date: Wed, 5 Apr 2023 17:23:30 +0000 Subject: [PATCH] Enable Force Unit Access (FUA) for write commands. This seems to fix intermittent data corruptions which I faced. The documentation says about FUA for write commands: "The Device Server shall write the logical blocks to the medium, and shall not complete the command with GOOD status until all the logical blocks have been written on the medium without error." --- sys/dev/ic/ufshci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/ic/ufshci.c b/sys/dev/ic/ufshci.c index 56b679aa6bb..14cb889fc37 100644 --- a/sys/dev/ic/ufshci.c +++ b/sys/dev/ic/ufshci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ufshci.c,v 1.2 2023/04/02 08:53:01 anton Exp $ */ +/* $OpenBSD: ufshci.c,v 1.3 2023/04/05 17:23:30 mglocker Exp $ */ /* * Copyright (c) 2022 Marcus Glocker @@ -1227,7 +1227,7 @@ ufshci_utr_cmd_write(struct ufshci_softc *sc, struct ufshci_ccb *ccb, ucd->cmd.expected_xfer_len = htobe32(rsp_size); ucd->cmd.cdb[0] = WRITE_10; /* 0x2a */ - //ucd->cmd.cdb[1] = (1 << 3); /* FUA: Force Unit Access */ + ucd->cmd.cdb[1] = (1 << 3); /* FUA: Force Unit Access */ ucd->cmd.cdb[2] = (lba >> 24) & 0xff; ucd->cmd.cdb[3] = (lba >> 16) & 0xff; ucd->cmd.cdb[4] = (lba >> 8) & 0xff; -- 2.20.1