2017-09-01 10:30:46 +02:00
|
|
|
/** @file
|
|
|
|
The definition for DMA access Library.
|
|
|
|
|
|
|
|
Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
|
|
|
|
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
|
|
|
|
http://opensource.org/licenses/bsd-license.php.
|
|
|
|
|
|
|
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
|
|
|
|
|
|
**/
|
|
|
|
|
|
|
|
#ifndef __DMA_ACCESS_LIB_H__
|
|
|
|
#define __DMA_ACCESS_LIB_H__
|
|
|
|
|
2017-09-15 06:29:10 +02:00
|
|
|
typedef struct {
|
|
|
|
UINT8 HostAddressWidth;
|
|
|
|
UINTN VTdEngineCount;
|
|
|
|
UINT64 VTdEngineAddress[1];
|
|
|
|
} VTD_INFO;
|
|
|
|
|
2017-09-01 10:30:46 +02:00
|
|
|
/**
|
|
|
|
Set DMA protected region.
|
|
|
|
|
2017-09-15 06:29:10 +02:00
|
|
|
@param EngineMask The mask of the VTd engine to be accessed.
|
2017-09-01 10:30:46 +02:00
|
|
|
@param LowMemoryBase The protected low memory region base.
|
|
|
|
@param LowMemoryLength The protected low memory region length.
|
|
|
|
@param HighMemoryBase The protected high memory region base.
|
|
|
|
@param HighMemoryLength The protected high memory region length.
|
|
|
|
|
|
|
|
@retval EFI_SUCCESS The DMA protection is set.
|
|
|
|
@retval EFI_UNSUPPORTED The DMA protection is not set.
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
SetDmaProtectedRange (
|
2017-09-15 06:29:10 +02:00
|
|
|
IN UINT64 EngineMask,
|
2017-09-01 10:30:46 +02:00
|
|
|
IN UINT32 LowMemoryBase,
|
|
|
|
IN UINT32 LowMemoryLength,
|
|
|
|
IN UINT64 HighMemoryBase,
|
|
|
|
IN UINT64 HighMemoryLength
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Diable DMA protection.
|
|
|
|
|
2017-09-15 06:29:10 +02:00
|
|
|
@param EngineMask The mask of the VTd engine to be accessed.
|
|
|
|
|
2017-09-01 10:30:46 +02:00
|
|
|
@retval DMA protection is disabled.
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
DisableDmaProtection (
|
2017-09-15 06:29:10 +02:00
|
|
|
IN UINT64 EngineMask
|
2017-09-01 10:30:46 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Get protected low memory alignment.
|
|
|
|
|
2017-09-15 06:29:10 +02:00
|
|
|
@param EngineMask The mask of the VTd engine to be accessed.
|
|
|
|
|
2017-09-01 10:30:46 +02:00
|
|
|
@return protected low memory alignment.
|
|
|
|
**/
|
|
|
|
UINT32
|
|
|
|
GetLowMemoryAlignment (
|
2017-09-15 06:29:10 +02:00
|
|
|
IN UINT64 EngineMask
|
2017-09-01 10:30:46 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Get protected high memory alignment.
|
|
|
|
|
2017-09-15 06:29:10 +02:00
|
|
|
@param EngineMask The mask of the VTd engine to be accessed.
|
|
|
|
|
2017-09-01 10:30:46 +02:00
|
|
|
@return protected high memory alignment.
|
|
|
|
**/
|
|
|
|
UINT64
|
|
|
|
GetHighMemoryAlignment (
|
2017-09-15 06:29:10 +02:00
|
|
|
IN UINT64 EngineMask
|
2017-09-01 10:30:46 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|