diff --git a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.c b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.c index 5a1eda8e8d..dea14f1a44 100644 --- a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.c +++ b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.c @@ -137,8 +137,23 @@ EnumerateNvmeDevNamespace ( Device->Media.WriteCaching = FALSE; Device->Media.IoAlign = Private->PassThruMode.IoAlign; - Flbas = NamespaceData->Flbas; - LbaFmtIdx = Flbas & 0xF; + Flbas = NamespaceData->Flbas; + LbaFmtIdx = Flbas & 0xF; + + // + // Currently this NVME driver only suport Metadata Size == 0 + // + if (NamespaceData->LbaFormat[LbaFmtIdx].Ms != 0) { + DEBUG (( + DEBUG_ERROR, + "NVME IDENTIFY NAMESPACE [%d] Ms(%d) is not supported.\n", + NamespaceId, + NamespaceData->LbaFormat[LbaFmtIdx].Ms + )); + Status = EFI_UNSUPPORTED; + goto Exit; + } + Lbads = NamespaceData->LbaFormat[LbaFmtIdx].Lbads; Device->Media.BlockSize = (UINT32)1 << Lbads; diff --git a/MdeModulePkg/Bus/Pci/NvmExpressPei/NvmExpressPei.c b/MdeModulePkg/Bus/Pci/NvmExpressPei/NvmExpressPei.c index f73053fc3f..2d6a79028f 100644 --- a/MdeModulePkg/Bus/Pci/NvmExpressPei/NvmExpressPei.c +++ b/MdeModulePkg/Bus/Pci/NvmExpressPei/NvmExpressPei.c @@ -104,7 +104,22 @@ EnumerateNvmeDevNamespace ( // Flbas = NamespaceData->Flbas; LbaFmtIdx = Flbas & 0xF; - Lbads = NamespaceData->LbaFormat[LbaFmtIdx].Lbads; + + // + // Currently this NVME driver only suport Metadata Size == 0 + // + if (NamespaceData->LbaFormat[LbaFmtIdx].Ms != 0) { + DEBUG (( + DEBUG_ERROR, + "NVME IDENTIFY NAMESPACE [%d] Ms(%d) is not supported.\n", + NamespaceId, + NamespaceData->LbaFormat[LbaFmtIdx].Ms + )); + Status = EFI_UNSUPPORTED; + goto Exit; + } + + Lbads = NamespaceData->LbaFormat[LbaFmtIdx].Lbads; NamespaceInfo->Media.InterfaceType = MSG_NVME_NAMESPACE_DP; NamespaceInfo->Media.RemovableMedia = FALSE;