From patchwork Fri Apr 8 09:45:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 65387 Delivered-To: patch@linaro.org Received: by 10.112.43.237 with SMTP id z13csp569564lbl; Fri, 8 Apr 2016 02:46:43 -0700 (PDT) X-Received: by 10.60.78.3 with SMTP id x3mr3737673oew.8.1460108788632; Fri, 08 Apr 2016 02:46:28 -0700 (PDT) Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id a90si4350621otc.206.2016.04.08.02.46.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Apr 2016 02:46:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 0E82D1A1FEA; Fri, 8 Apr 2016 02:45:57 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received: from mail-wm0-x22c.google.com (mail-wm0-x22c.google.com [IPv6:2a00:1450:400c:c09::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 86B2E1A1EDF for ; Fri, 8 Apr 2016 02:45:55 -0700 (PDT) Received: by mail-wm0-x22c.google.com with SMTP id 191so12583160wmq.0 for ; Fri, 08 Apr 2016 02:45:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=WuCnocQOi6FPZn2Qea0CR5mQh00KbX2i8qKSO/jFI/Y=; b=bq5CNxJwv+V1pAv/fihlFn2FBjZI8pSayIiISUvmWX8SLE0+QpDVh6D1OswKEJrogS nj0ObUzMLZ8mmFzzFmJEqmsL0Of/S7hfI8REaZppIMRx5y+y8fqZRHziy+XtPxuGEj6s S39cVHw2u3ZGfKKPTU8KRTiu55hd6eFOGKNZc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=WuCnocQOi6FPZn2Qea0CR5mQh00KbX2i8qKSO/jFI/Y=; b=SuejJHcMoolWESPAPty5WrhyTk17Ffrob4Ph0v4R9sqaK3kTwU6rJU5QSP0bzPzUOJ fRjCbKtSZrDpJp6ip1vmCwHC/MiaaIV21jpd5+dPQLr7NjEz+m0zTGYYT6duaNQHMogy b/8Fg6wynVhmkRLoOBmsQ4/Wh6WU9+aL96Y83HGobINCqSyN83remMD8Ag0H1Usq2+ab nTrzU2Ws/sQyKOSK6JQa3+2GnjVebQfRmvPK7gi9Oi/yKSOfLwfR9gW1hHxKevk1TOca 3/DnY1FbU1gXJwUBMZvK4NCqDTsf5/7NuR0oCdC0jRVed+KRA6YHSZCQcFEGJncVCVBW xTsQ== X-Gm-Message-State: AD7BkJLtkyfToUcsY723q4e9wJdl2RKlMnFr/WbU90jaCK1kT545KCNBGSyzrO8RAt6fm136 X-Received: by 10.28.8.139 with SMTP id 133mr2781578wmi.26.1460108754252; Fri, 08 Apr 2016 02:45:54 -0700 (PDT) Received: from localhost.localdomain ([195.55.142.58]) by smtp.gmail.com with ESMTPSA id s10sm9710681wjp.3.2016.04.08.02.45.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 08 Apr 2016 02:45:53 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org, lersek@redhat.com Date: Fri, 8 Apr 2016 11:45:10 +0200 Message-Id: <1460108711-12122-24-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1460108711-12122-1-git-send-email-ard.biesheuvel@linaro.org> References: <1460108711-12122-1-git-send-email-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH v2 23/24] ArmVirtPkg/ArmVirtXen: move from VirtFdtDxe to new XenioFdtDxe driver X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" Now that the only functionality that remains in VirtFdtDxe is enumerating the respective virtual I/O buses, it no longer makes sense to have a driver that is shared between Xen domU and QEMU. So move the Xen I/O DT node handling to a new driver, and update ArmVirtXen to switch to it. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- ArmVirtPkg/ArmVirtXen.dsc | 2 +- ArmVirtPkg/ArmVirtXen.fdf | 2 +- ArmVirtPkg/XenioFdtDxe/XenioFdtDxe.c | 63 ++++++++++++++++++++ ArmVirtPkg/XenioFdtDxe/XenioFdtDxe.inf | 45 ++++++++++++++ 4 files changed, 110 insertions(+), 2 deletions(-) -- 2.5.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/ArmVirtPkg/ArmVirtXen.dsc b/ArmVirtPkg/ArmVirtXen.dsc index 2677c1900c49..b43ae595d3fc 100644 --- a/ArmVirtPkg/ArmVirtXen.dsc +++ b/ArmVirtPkg/ArmVirtXen.dsc @@ -200,7 +200,7 @@ [Components.common] # # Platform Driver # - ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf + ArmVirtPkg/XenioFdtDxe/XenioFdtDxe.inf ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf # diff --git a/ArmVirtPkg/ArmVirtXen.fdf b/ArmVirtPkg/ArmVirtXen.fdf index 6b954dc4cba2..1d60610041ac 100644 --- a/ArmVirtPkg/ArmVirtXen.fdf +++ b/ArmVirtPkg/ArmVirtXen.fdf @@ -125,7 +125,7 @@ [FV.FvMain] INF MdeModulePkg/Core/Dxe/DxeMain.inf INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf - INF ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf + INF ArmVirtPkg/XenioFdtDxe/XenioFdtDxe.inf INF ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf # diff --git a/ArmVirtPkg/XenioFdtDxe/XenioFdtDxe.c b/ArmVirtPkg/XenioFdtDxe/XenioFdtDxe.c new file mode 100644 index 000000000000..64cb5c3bfd9e --- /dev/null +++ b/ArmVirtPkg/XenioFdtDxe/XenioFdtDxe.c @@ -0,0 +1,63 @@ +/** @file +* Xenio FDT client protocol driver for xen,xen DT node +* +* Copyright (c) 2016, Linaro Ltd. All rights reserved.
+* +* 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 +#include +#include +#include +#include + +#include + +EFI_STATUS +EFIAPI +InitializeXenioFdtDxe ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + FDT_CLIENT_PROTOCOL *FdtClient; + CONST UINT64 *Reg; + UINT32 RegElemSize, RegSize; + 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, &RegElemSize, &RegSize); + + ASSERT (RegSize == 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 = 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; +} diff --git a/ArmVirtPkg/XenioFdtDxe/XenioFdtDxe.inf b/ArmVirtPkg/XenioFdtDxe/XenioFdtDxe.inf new file mode 100644 index 000000000000..c8a1ba816435 --- /dev/null +++ b/ArmVirtPkg/XenioFdtDxe/XenioFdtDxe.inf @@ -0,0 +1,45 @@ +## @file +# Xenio FDT client protocol driver for xen,xen DT node +# +# Copyright (c) 2016, Linaro Ltd. All rights reserved.
+# +# 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. +# +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = XenioFdtDxe + FILE_GUID = 338695EA-CA84-4FA2-9DA8-5C4BB87905C6 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + + ENTRY_POINT = InitializeXenioFdtDxe + +[Sources] + XenioFdtDxe.c + +[Packages] + ArmVirtPkg/ArmVirtPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + OvmfPkg/OvmfPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + UefiBootServicesTableLib + UefiDriverEntryPoint + XenIoMmioLib + +[Protocols] + gFdtClientProtocolGuid ## CONSUMES + +[Depex] + gFdtClientProtocolGuid