Changes for V4 ============== 1) Remove Unicode character from C source file 2) Move delete of QuarkSocPkg\QuarkNorthCluster\Binary\QuarkMicrocode from QuarkPlatformPkg commit to QuarkSocPkg commit Changes for V2 ============== 1) Sync with new APIs in SmmCpuFeaturesLib class 2) Use new generic PCI serial driver PciSioSerialDxe in MdeModulePkg 3) Remove PCI serial driver from QuarkSocPkg 4) Apply optimizations to MtrrLib from MtrrLib in UefiCpuPkg 5) Convert all UNI files to utf-8 6) Replace tabs with spaces and remove trailing spaces 7) Add License.txt Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Michael Kinney <michael.d.kinney@intel.com> Acked-by: Jordan Justen <jordan.l.justen@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19286 6f19259b-4bc3-4df7-8a09-765794883524
149 lines
3.9 KiB
C
149 lines
3.9 KiB
C
/** @file
|
|
Runtime Lib function for QNC internal network access.
|
|
|
|
Copyright (c) 2013-2015 Intel Corporation.
|
|
|
|
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.
|
|
|
|
**/
|
|
|
|
|
|
#include <PiDxe.h>
|
|
|
|
#include <Guid/EventGroup.h>
|
|
|
|
#include <Library/BaseLib.h>
|
|
#include <Library/DebugLib.h>
|
|
#include <Library/UefiBootServicesTableLib.h>
|
|
#include <Library/UefiRuntimeLib.h>
|
|
#include <Library/QNCAccessLib.h>
|
|
|
|
///
|
|
/// Set Virtual Address Map Event
|
|
///
|
|
EFI_EVENT mDxeRuntimeQncAccessLibVirtualNotifyEvent = NULL;
|
|
|
|
///
|
|
/// Module global that contains the base physical address of the PCI Express MMIO range.
|
|
///
|
|
UINTN mDxeRuntimeQncAccessLibPciExpressBaseAddress = 0;
|
|
|
|
/**
|
|
Convert the physical PCI Express MMIO address to a virtual address.
|
|
|
|
@param[in] Event The event that is being processed.
|
|
@param[in] Context The Event Context.
|
|
**/
|
|
VOID
|
|
EFIAPI
|
|
DxeRuntimeQncAccessLibVirtualNotify (
|
|
IN EFI_EVENT Event,
|
|
IN VOID *Context
|
|
)
|
|
{
|
|
EFI_STATUS Status;
|
|
|
|
//
|
|
// Convert the physical PCI Express MMIO address to a virtual address.
|
|
//
|
|
Status = EfiConvertPointer (0, (VOID **) &mDxeRuntimeQncAccessLibPciExpressBaseAddress);
|
|
|
|
ASSERT_EFI_ERROR (Status);
|
|
}
|
|
|
|
/**
|
|
The constructor function to setup globals and goto virtual mode notify.
|
|
|
|
@param ImageHandle The firmware allocated handle for the EFI image.
|
|
@param SystemTable A pointer to the EFI System Table.
|
|
|
|
@retval EFI_SUCCESS The constructor completed successfully.
|
|
@retval Other value The constructor did not complete successfully.
|
|
|
|
**/
|
|
EFI_STATUS
|
|
EFIAPI
|
|
DxeRuntimeQncAccessLibConstructor (
|
|
IN EFI_HANDLE ImageHandle,
|
|
IN EFI_SYSTEM_TABLE *SystemTable
|
|
)
|
|
{
|
|
EFI_STATUS Status;
|
|
|
|
//
|
|
// Cache the physical address of the PCI Express MMIO range into a module global variable
|
|
//
|
|
mDxeRuntimeQncAccessLibPciExpressBaseAddress = (UINTN) PcdGet64(PcdPciExpressBaseAddress);
|
|
|
|
//
|
|
// Register SetVirtualAddressMap () notify function
|
|
//
|
|
Status = gBS->CreateEventEx (
|
|
EVT_NOTIFY_SIGNAL,
|
|
TPL_NOTIFY,
|
|
DxeRuntimeQncAccessLibVirtualNotify,
|
|
NULL,
|
|
&gEfiEventVirtualAddressChangeGuid,
|
|
&mDxeRuntimeQncAccessLibVirtualNotifyEvent
|
|
);
|
|
ASSERT_EFI_ERROR (Status);
|
|
|
|
return Status;
|
|
}
|
|
|
|
/**
|
|
The destructor function frees any allocated buffers and closes the Set Virtual
|
|
Address Map event.
|
|
|
|
@param ImageHandle The firmware allocated handle for the EFI image.
|
|
@param SystemTable A pointer to the EFI System Table.
|
|
|
|
@retval EFI_SUCCESS The destructor completed successfully.
|
|
@retval Other value The destructor did not complete successfully.
|
|
|
|
**/
|
|
EFI_STATUS
|
|
EFIAPI
|
|
DxeRuntimeQncAccessLibDestructor (
|
|
IN EFI_HANDLE ImageHandle,
|
|
IN EFI_SYSTEM_TABLE *SystemTable
|
|
)
|
|
{
|
|
EFI_STATUS Status;
|
|
|
|
//
|
|
// Close the Set Virtual Address Map event
|
|
//
|
|
Status = gBS->CloseEvent (mDxeRuntimeQncAccessLibVirtualNotifyEvent);
|
|
ASSERT_EFI_ERROR (Status);
|
|
|
|
return Status;
|
|
}
|
|
|
|
/**
|
|
Gets the base address of PCI Express for Quark North Cluster.
|
|
|
|
@return The base address of PCI Express for Quark North Cluster.
|
|
|
|
**/
|
|
UINTN
|
|
EFIAPI
|
|
QncGetPciExpressBaseAddress (
|
|
VOID
|
|
)
|
|
{
|
|
//
|
|
// If system goes to virtual mode then virtual notify callback will update
|
|
// mDxeRuntimeQncAccessLibPciExpressBaseAddress with virtual address of
|
|
// PCIe memory base.
|
|
//
|
|
return mDxeRuntimeQncAccessLibPciExpressBaseAddress;
|
|
}
|
|
|