From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ard Biesheuvel Subject: [PATCH v3 26/27] ArmVirtualizationPkg/VirtFdtDxe: wire up XenBusDxe to "xen, xen" DT node Date: Tue, 3 Feb 2015 19:20:11 +0000 Message-ID: <1422991212-9257-27-git-send-email-ard.biesheuvel__29118.3484056548$1422991373$gmane$org@linaro.org> References: <1422991212-9257-1-git-send-email-ard.biesheuvel@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1422991212-9257-1-git-send-email-ard.biesheuvel@linaro.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: edk2-devel@lists.sourceforge.net, lersek@redhat.com, olivier.martin@arm.com, roy.franz@linaro.org, leif.lindholm@linaro.org, stefano.stabellini@eu.citrix.com, ian.campbell@citrix.com, anthony.perard@citrix.com, christoffer.dall@linaro.org, xen-devel@lists.xen.org, ilias.biris@linaro.org, julien.grall@linaro.org Cc: Ard Biesheuvel List-Id: xen-devel@lists.xenproject.org This patchs adds support to VirtFdtDxe for the Xen DT node which contains the base address of the Grant Table. This data is communicated to XenBusDxe using a XENIO_PROTOCOL instance. Contributed-under: TianoCore Contribution Agreement 1.0 Reviewed-by: Laszlo Ersek Signed-off-by: Ard Biesheuvel --- .../ArmVirtualizationPkg/ArmVirtualization.dsc.inc | 2 ++ .../ArmVirtualizationPkg/VirtFdtDxe/VirtFdtDxe.c | 23 ++++++++++++++++++++++ .../ArmVirtualizationPkg/VirtFdtDxe/VirtFdtDxe.inf | 1 + 3 files changed, 26 insertions(+) diff --git a/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualization.dsc.inc b/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualization.dsc.inc index f17cd2f5d876..e7a03cd13d3a 100644 --- a/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualization.dsc.inc +++ b/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualization.dsc.inc @@ -100,6 +100,8 @@ BdsLib|ArmPkg/Library/BdsLib/BdsLib.inf FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf + XenIoMmioLib|OvmfPkg/Library/XenIoMmioLib/XenIoMmioLib.inf + [LibraryClasses.common.SEC] PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf ArmPlatformSecExtraActionLib|ArmPlatformPkg/Library/DebugSecExtraActionLib/DebugSecExtraActionLib.inf diff --git a/ArmPlatformPkg/ArmVirtualizationPkg/VirtFdtDxe/VirtFdtDxe.c b/ArmPlatformPkg/ArmVirtualizationPkg/VirtFdtDxe/VirtFdtDxe.c index 3e8ca8da627e..0064b5e50171 100644 --- a/ArmPlatformPkg/ArmVirtualizationPkg/VirtFdtDxe/VirtFdtDxe.c +++ b/ArmPlatformPkg/ArmVirtualizationPkg/VirtFdtDxe/VirtFdtDxe.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -49,6 +50,7 @@ typedef enum { PropertyTypePsci, PropertyTypeFwCfg, PropertyTypeGicV3, + PropertyTypeXen, } PROPERTY_TYPE; typedef struct { @@ -66,6 +68,7 @@ STATIC CONST PROPERTY CompatibleProperties[] = { { PropertyTypePsci, "arm,psci-0.2" }, { PropertyTypeFwCfg, "qemu,fw-cfg-mmio" }, { PropertyTypeGicV3, "arm,gic-v3" }, + { PropertyTypeXen, "xen,xen" }, { PropertyTypeUnknown, "" } }; @@ -342,6 +345,26 @@ InitializeVirtFdtDxe ( } break; + case PropertyTypeXen: + ASSERT (Len == 16); + + // + // Retrieve the reg base from this node and wire it up to the + // MMIO flavor of the XenBus root device I/O protocol + // + RegBase = fdt64_to_cpu (((UINT64 *)RegProp)[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)); + break; + } + + DEBUG ((EFI_D_INFO, "Found Xen node with Grant table @ 0x%Lx\n", RegBase)); + + break; + default: break; } diff --git a/ArmPlatformPkg/ArmVirtualizationPkg/VirtFdtDxe/VirtFdtDxe.inf b/ArmPlatformPkg/ArmVirtualizationPkg/VirtFdtDxe/VirtFdtDxe.inf index 2768d7be8093..65eaef693d63 100644 --- a/ArmPlatformPkg/ArmVirtualizationPkg/VirtFdtDxe/VirtFdtDxe.inf +++ b/ArmPlatformPkg/ArmVirtualizationPkg/VirtFdtDxe/VirtFdtDxe.inf @@ -41,6 +41,7 @@ FdtLib VirtioMmioDeviceLib HobLib + XenIoMmioLib [Guids] gFdtTableGuid -- 1.8.3.2