X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=IntelSiliconPkg%2FFeature%2FVTd%2FIntelVTdDxe%2FBmDma.c;h=57e086a64dbc98b3c554fb85b6cbca76e860dac9;hp=7a5f3619a47d6c3e5403c44b4d58286a75bdcc82;hb=3a71670618dfa463b3377b752858df7964ad038c;hpb=9010459c9aaa985619e341ecc2789a06993b2310 diff --git a/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/BmDma.c b/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/BmDma.c index 7a5f3619a4..57e086a64d 100644 --- a/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/BmDma.c +++ b/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/BmDma.c @@ -1,7 +1,7 @@ /** @file BmDma related function - 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 @@ -12,15 +12,7 @@ **/ -#include - -#include - -#include -#include -#include -#include -#include +#include "DmaProtection.h" // TBD: May make it a policy #define DMA_MEMORY_TOP MAX_UINTN @@ -76,6 +68,7 @@ IoMmuMap ( MAP_INFO *MapInfo; EFI_PHYSICAL_ADDRESS DmaMemoryTop; BOOLEAN NeedRemap; + EFI_TPL OriginalTpl; if (NumberOfBytes == NULL || DeviceAddress == NULL || Mapping == NULL) { @@ -198,7 +191,9 @@ IoMmuMap ( MapInfo->DeviceAddress = MapInfo->HostAddress; } + OriginalTpl = gBS->RaiseTPL (VTD_TPL_LEVEL); InsertTailList (&gMaps, &MapInfo->Link); + gBS->RestoreTPL (OriginalTpl); // // The DeviceAddress is the address of the maped buffer below 4GB @@ -233,6 +228,7 @@ IoMmuUnmap ( { MAP_INFO *MapInfo; LIST_ENTRY *Link; + EFI_TPL OriginalTpl; DEBUG ((DEBUG_VERBOSE, "IoMmuUnmap: 0x%08x\n", Mapping)); @@ -241,6 +237,7 @@ IoMmuUnmap ( return EFI_INVALID_PARAMETER; } + OriginalTpl = gBS->RaiseTPL (VTD_TPL_LEVEL); MapInfo = NULL; for (Link = GetFirstNode (&gMaps) ; !IsNull (&gMaps, Link) @@ -255,10 +252,12 @@ IoMmuUnmap ( // Mapping is not a valid value returned by Map() // if (MapInfo != Mapping) { + gBS->RestoreTPL (OriginalTpl); DEBUG ((DEBUG_ERROR, "IoMmuUnmap: %r\n", EFI_INVALID_PARAMETER)); return EFI_INVALID_PARAMETER; } RemoveEntryList (&MapInfo->Link); + gBS->RestoreTPL (OriginalTpl); if (MapInfo->DeviceAddress != MapInfo->HostAddress) { // @@ -300,7 +299,7 @@ IoMmuUnmap ( @retval EFI_SUCCESS The requested memory pages were allocated. @retval EFI_UNSUPPORTED Attributes is unsupported. The only legal attribute bits are - MEMORY_WRITE_COMBINE and MEMORY_CACHED. + MEMORY_WRITE_COMBINE, MEMORY_CACHED and DUAL_ADDRESS_CYCLE. @retval EFI_INVALID_PARAMETER One or more parameters are invalid. @retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated.