From 012d883a848bf7af8b4859394bb32f8b2a45313f Mon Sep 17 00:00:00 2001 From: Jiewen Yao Date: Mon, 19 Jun 2017 10:54:34 +0800 Subject: Add KabylakeOpenBoardPkg reviewed-by: Jiewen Yao reviewed-by: Michael A Kubacki reviewed-by: Amy Chan reviewed-by: Rangasai V Chaganty reviewed-by: Chasel Chiu Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiewen Yao Signed-off-by: Chasel Chiu --- .../Policy/PolicyInitDxe/DxeSaPolicyUpdate.c | 71 ++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/Policy/PolicyInitDxe/DxeSaPolicyUpdate.c (limited to 'Platform/Intel/KabylakeOpenBoardPkg/Policy/PolicyInitDxe/DxeSaPolicyUpdate.c') diff --git a/Platform/Intel/KabylakeOpenBoardPkg/Policy/PolicyInitDxe/DxeSaPolicyUpdate.c b/Platform/Intel/KabylakeOpenBoardPkg/Policy/PolicyInitDxe/DxeSaPolicyUpdate.c new file mode 100644 index 0000000000..384b94ba54 --- /dev/null +++ b/Platform/Intel/KabylakeOpenBoardPkg/Policy/PolicyInitDxe/DxeSaPolicyUpdate.c @@ -0,0 +1,71 @@ +/** @file + This file is the library for SA DXE Policy initialization. + +Copyright (c) 2017, 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 that 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. + +**/ + +#include "SaPolicyInitDxe.h" + +#define SA_VTD_RMRR_USB_LENGTH 0x20000 + +GLOBAL_REMOVE_IF_UNREFERENCED EFI_PHYSICAL_ADDRESS mAddress; +GLOBAL_REMOVE_IF_UNREFERENCED UINTN mSize; + +/** + Update RMRR Base and Limit Address for USB. + +**/ +VOID +UpdateRmrrUsbAddress ( + IN OUT SA_POLICY_PROTOCOL *SaPolicy + ) +{ + EFI_STATUS Status; + MISC_DXE_CONFIG *MiscDxeConfig; + + Status = GetConfigBlock ((VOID *)SaPolicy, &gMiscDxeConfigGuid, (VOID *)&MiscDxeConfig); + ASSERT_EFI_ERROR (Status); + + if (1) { + mSize = EFI_SIZE_TO_PAGES(SA_VTD_RMRR_USB_LENGTH); + mAddress = SIZE_4GB; + + Status = (gBS->AllocatePages) ( + AllocateMaxAddress, + EfiReservedMemoryType, + mSize, + &mAddress + ); + ASSERT_EFI_ERROR (Status); + + MiscDxeConfig->RmrrUsbBaseAddress[0] = mAddress; + MiscDxeConfig->RmrrUsbBaseAddress[1] = mAddress + SA_VTD_RMRR_USB_LENGTH - 1; + } +} + +/** + Get data for platform policy from setup options. + + @param[in] SaPolicy The pointer to get SA Policy protocol instance + + @retval EFI_SUCCESS Operation success. + +**/ +EFI_STATUS +EFIAPI +UpdateDxeSaPolicy ( + IN OUT SA_POLICY_PROTOCOL *SaPolicy + ) +{ + UpdateRmrrUsbAddress (SaPolicy); + return EFI_SUCCESS; +} + -- cgit v1.2.3