From patchwork Wed Apr 13 08:02:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 65689 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp2362782qge; Wed, 13 Apr 2016 01:02:49 -0700 (PDT) X-Received: by 10.98.68.145 with SMTP id m17mr10937615pfi.65.1460534569001; Wed, 13 Apr 2016 01:02:49 -0700 (PDT) Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id k12si15331197pag.197.2016.04.13.01.02.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Apr 2016 01:02:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; 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 198.145.21.10 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 B94161A2222; Wed, 13 Apr 2016 01:02:39 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received: from mail-wm0-x22e.google.com (mail-wm0-x22e.google.com [IPv6:2a00:1450:400c:c09::22e]) (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 EF8251A2200 for ; Wed, 13 Apr 2016 01:02:38 -0700 (PDT) Received: by mail-wm0-x22e.google.com with SMTP id u206so61941559wme.1 for ; Wed, 13 Apr 2016 01:02:38 -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=bnWoRxCa3119hE8VOHgvipgneR3Uad2UPJJEWD+9KgQ=; b=hwXmB2UNJ9f3JKsvTnPbwrvRAfaJmOEz1QY4vb7MzpE7ZB36kiZ+NLjz2FbdsAVKSO d6wWpNrPp2iI2oIJIswEvXWqX3VvSPZxmK3n43Iv0pRi3Jsp4hY+Ms4gnQXZamcsO0JX HFQ0mojZhbnVgjkLeHyApNcB6r+VSul6TYwJg= 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=bnWoRxCa3119hE8VOHgvipgneR3Uad2UPJJEWD+9KgQ=; b=bB9Ihx4EBPdrqVsU6IefmLpgHVEhPbKyfnQD5rUmIClYH7eNBRT0H5doOzLDzYG6AN Hk8G0wRclD9Y5CBLiZgqNUiR0xL5S5BEnJ7OAGo7DTzkWuGt/vpqfEfQ2E4jETxcg9W2 UUQJtl0yvShyme7tYq4ruJM8jA5l0vn04+2JMGFIZCH1kr+nh9Qry2qsphzYyYLChxRt o+lQy3CaMKSUa0hoIGkpKljW0YKRuKBMBMw0++zK4vZuqrY4Ij5neJW6JtWWv8eJ6e6I Qbjyc2n+sD9AuNRxSB4HgzOpwU9Mot6XRrbBu+lV/deub8BsIP8v55ULm1KbbEjwClpL 6RJg== X-Gm-Message-State: AD7BkJLA6oOLJXJi2VBuVoOoKLKMRCwJXmiluGDjI04BFpe5wfF8/LfF2tiqAVX8Cf5/2KDJ X-Received: by 10.28.58.77 with SMTP id h74mr29448957wma.82.1460534557596; Wed, 13 Apr 2016 01:02:37 -0700 (PDT) Received: from localhost.localdomain ([195.55.142.58]) by smtp.gmail.com with ESMTPSA id i206sm26686549wmf.1.2016.04.13.01.02.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 13 Apr 2016 01:02:36 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org, lersek@redhat.com Date: Wed, 13 Apr 2016 10:02:18 +0200 Message-Id: <1460534539-2169-9-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1460534539-2169-1-git-send-email-ard.biesheuvel@linaro.org> References: <1460534539-2169-1-git-send-email-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH v3 8/9] 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/XenioFdtDxe/XenioFdtDxe.inf | 44 ++++++++++++++ ArmVirtPkg/XenioFdtDxe/XenioFdtDxe.c | 63 ++++++++++++++++++++ ArmVirtPkg/ArmVirtXen.dsc | 2 +- ArmVirtPkg/ArmVirtXen.fdf | 2 +- 4 files changed, 109 insertions(+), 2 deletions(-) -- 2.5.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Laszlo Ersek diff --git a/ArmVirtPkg/XenioFdtDxe/XenioFdtDxe.inf b/ArmVirtPkg/XenioFdtDxe/XenioFdtDxe.inf new file mode 100644 index 000000000000..d75e4f45ae41 --- /dev/null +++ b/ArmVirtPkg/XenioFdtDxe/XenioFdtDxe.inf @@ -0,0 +1,44 @@ +## @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 + MdePkg/MdePkg.dec + OvmfPkg/OvmfPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + UefiBootServicesTableLib + UefiDriverEntryPoint + XenIoMmioLib + +[Protocols] + gFdtClientProtocolGuid ## CONSUMES + +[Depex] + gFdtClientProtocolGuid 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/ArmVirtXen.dsc b/ArmVirtPkg/ArmVirtXen.dsc index 112dc8ed33df..594ca6491b7a 100644 --- a/ArmVirtPkg/ArmVirtXen.dsc +++ b/ArmVirtPkg/ArmVirtXen.dsc @@ -195,7 +195,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 56182e719e06..13412f9e2455 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 #