X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=IntelSiliconPkg%2FFeature%2FVTd%2FIntelVTdDxe%2FDmarAcpiTable.c;h=342830a01fb05135706b610c8225fac98ab5eb78;hp=2456b0c48ff19f93848a3965ae85e205948baada;hb=01bd1c98fa83ef4449798fcf206fbd40db97b2d6;hpb=9010459c9aaa985619e341ecc2789a06993b2310 diff --git a/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmarAcpiTable.c b/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmarAcpiTable.c index 2456b0c48f..342830a01f 100644 --- a/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmarAcpiTable.c +++ b/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmarAcpiTable.c @@ -1,6 +1,6 @@ /** @file - Copyright (c) 2017, Intel Corporation. All rights reserved.
+ Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -27,7 +27,7 @@ typedef struct { #pragma pack() -EFI_ACPI_DMAR_HEADER *mAcpiDmarTable; +EFI_ACPI_DMAR_HEADER *mAcpiDmarTable = NULL; /** Dump DMAR DeviceScopeEntry. @@ -889,7 +889,7 @@ ScanTableInRSDT ( EntryPtr = &Rsdt->Entry; for (Index = 0; Index < EntryCount; Index ++, EntryPtr ++) { Table = (EFI_ACPI_DESCRIPTION_HEADER*)((UINTN)(*EntryPtr)); - if (Table->Signature == Signature) { + if ((Table != NULL) && (Table->Signature == Signature)) { return Table; } } @@ -923,7 +923,7 @@ ScanTableInXSDT ( for (Index = 0; Index < EntryCount; Index ++) { CopyMem (&EntryPtr, (VOID *)(BasePtr + Index * sizeof(UINT64)), sizeof(UINT64)); Table = (EFI_ACPI_DESCRIPTION_HEADER*)((UINTN)(EntryPtr)); - if (Table->Signature == Signature) { + if ((Table != NULL) && (Table->Signature == Signature)) { return Table; } } @@ -978,8 +978,9 @@ FindAcpiPtr ( /** Get the DMAR ACPI table. - @retval EFI_SUCCESS The DMAR ACPI table is got. - @retval EFI_NOT_FOUND The DMAR ACPI table is not found. + @retval EFI_SUCCESS The DMAR ACPI table is got. + @retval EFI_ALREADY_STARTED The DMAR ACPI table has been got previously. + @retval EFI_NOT_FOUND The DMAR ACPI table is not found. **/ EFI_STATUS GetDmarAcpiTable ( @@ -989,6 +990,10 @@ GetDmarAcpiTable ( VOID *AcpiTable; EFI_STATUS Status; + if (mAcpiDmarTable != NULL) { + return EFI_ALREADY_STARTED; + } + AcpiTable = NULL; Status = EfiGetSystemConfigurationTable ( &gEfiAcpi20TableGuid, @@ -996,20 +1001,23 @@ GetDmarAcpiTable ( ); if (EFI_ERROR (Status)) { Status = EfiGetSystemConfigurationTable ( - &gEfiAcpiTableGuid, + &gEfiAcpi10TableGuid, &AcpiTable ); } + if (EFI_ERROR (Status)) { + return EFI_NOT_FOUND; + } ASSERT (AcpiTable != NULL); mAcpiDmarTable = FindAcpiPtr ( (EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER *)AcpiTable, EFI_ACPI_4_0_DMA_REMAPPING_TABLE_SIGNATURE ); - DEBUG ((DEBUG_INFO,"DMAR Table - 0x%08x\n", mAcpiDmarTable)); if (mAcpiDmarTable == NULL) { - return EFI_UNSUPPORTED; + return EFI_NOT_FOUND; } + DEBUG ((DEBUG_INFO,"DMAR Table - 0x%08x\n", mAcpiDmarTable)); VtdDumpDmarTable(); return EFI_SUCCESS;