aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorqwx495460 <qwx495460@notesmail.huawei.com>2019-04-23 15:09:29 +0800
committerHaojian Zhuang <haojian.zhuang@linaro.org>2019-04-23 15:30:48 +0800
commit2b8913bcfe520e806c506a807f50be2c4d8ccb37 (patch)
tree3dd900b9a4b26baf7d07b54e0fa7029ba4deef40
parent339710e86ef2495d3ab72a3333e054b3f21afb3c (diff)
downloadOpenPlatformPkg-upstream-hikey-aosp.tar.gz
Drivers/DwUfsHcDxe: add memory barrierupstream-hikey-aosp
UFS device couldn't be initialized by UEFI on some HiKey960 platforms if it's built in release mode. Since UFS device is not initialized successfully, UEFI couldn't read any valuable data from UFS device. Then it hangs. After adding memory barrier, UFS device could be initialized successfully. So this issue may be related to instructions out of order by CPU optimization. Signed-off-by: qwx495460 <qwx495460@notesmail.huawei.com> Signed-off-by: Baopeng Feng <fengbaopeng2@hisilicon.com> Signed-off-by: Li Wei <liwei213@huawei.com> Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
-rw-r--r--Drivers/Block/DwUfsHcDxe/DwUfsHcDxe.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/Drivers/Block/DwUfsHcDxe/DwUfsHcDxe.c b/Drivers/Block/DwUfsHcDxe/DwUfsHcDxe.c
index 4334269..3f0ac6f 100644
--- a/Drivers/Block/DwUfsHcDxe/DwUfsHcDxe.c
+++ b/Drivers/Block/DwUfsHcDxe/DwUfsHcDxe.c
@@ -348,6 +348,8 @@ UfsHcMmioRead (
Private = UFS_HOST_CONTROLLER_PRIVATE_DATA_FROM_UFSHC (This);
+ MemoryFence ();
+
switch (Width) {
case EfiUfsHcWidthUint8:
for (Index = 0; Index < Count; Index++) {
@@ -373,6 +375,8 @@ UfsHcMmioRead (
return EFI_INVALID_PARAMETER;
}
+ MemoryFence ();
+
return EFI_SUCCESS;
}
@@ -410,6 +414,8 @@ UfsHcMmioWrite (
Private = UFS_HOST_CONTROLLER_PRIVATE_DATA_FROM_UFSHC (This);
+ MemoryFence ();
+
switch (Width) {
case EfiUfsHcWidthUint8:
for (Index = 0; Index < Count; Index++) {
@@ -435,6 +441,8 @@ UfsHcMmioWrite (
return EFI_INVALID_PARAMETER;
}
+ MemoryFence ();
+
return Status;
}