audk/ArmVirtPkg/XenioFdtDxe/XenioFdtDxe.c
Michael D Kinney 9792fb0e65 ArmVirtPkg: Replace BSD License with BSD+Patent License
https://bugzilla.tianocore.org/show_bug.cgi?id=1373

Replace BSD 2-Clause License with BSD+Patent License.  This change is
based on the following emails:

  https://lists.01.org/pipermail/edk2-devel/2019-February/036260.html
  https://lists.01.org/pipermail/edk2-devel/2018-October/030385.html

RFCs with detailed process for the license change:

  V3: https://lists.01.org/pipermail/edk2-devel/2019-March/038116.html
  V2: https://lists.01.org/pipermail/edk2-devel/2019-March/037669.html
  V1: https://lists.01.org/pipermail/edk2-devel/2019-March/037500.html

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2019-04-09 09:10:21 -07:00

67 lines
1.9 KiB
C

/** @file
* Xenio FDT client protocol driver for xen,xen DT node
*
* Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
*
**/
#include <Library/BaseLib.h>
#include <Library/DebugLib.h>
#include <Library/UefiDriverEntryPoint.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/XenIoMmioLib.h>
#include <Protocol/FdtClient.h>
EFI_STATUS
EFIAPI
InitializeXenioFdtDxe (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
FDT_CLIENT_PROTOCOL *FdtClient;
CONST UINT64 *Reg;
UINT32 RegSize;
UINTN AddressCells, SizeCells;
EFI_HANDLE Handle;
UINT64 RegBase;
Status = gBS->LocateProtocol (&gFdtClientProtocolGuid, NULL,
(VOID **)&FdtClient);
ASSERT_EFI_ERROR (Status);
Status = FdtClient->FindCompatibleNodeReg (FdtClient, "xen,xen",
(CONST VOID **)&Reg, &AddressCells, &SizeCells,
&RegSize);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_WARN, "%a: No 'xen,xen' compatible DT node found\n",
__FUNCTION__));
return EFI_UNSUPPORTED;
}
ASSERT (AddressCells == 2);
ASSERT (SizeCells == 2);
ASSERT (RegSize == 2 * sizeof (UINT64));
//
// Retrieve the reg base from this node and wire it up to the
// MMIO flavor of the XenBus root device I/O protocol
//
RegBase = SwapBytes64 (Reg[0]);
Handle = NULL;
Status = XenIoMmioInstall (&Handle, RegBase);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "%a: XenIoMmioInstall () failed on a new handle "
"(Status == %r)\n", __FUNCTION__, Status));
return Status;
}
DEBUG ((EFI_D_INFO, "Found Xen node with Grant table @ 0x%Lx\n", RegBase));
return EFI_SUCCESS;
}