From patchwork Wed Apr 13 14:32:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 65734 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp45113qge; Wed, 13 Apr 2016 07:32:44 -0700 (PDT) X-Received: by 10.98.71.156 with SMTP id p28mr13277708pfi.139.1460557964677; Wed, 13 Apr 2016 07:32:44 -0700 (PDT) Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id dz3si1643454pad.113.2016.04.13.07.32.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Apr 2016 07:32:44 -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 18ABF1A222D; Wed, 13 Apr 2016 07:32:38 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received: from mail-wm0-x235.google.com (mail-wm0-x235.google.com [IPv6:2a00:1450:400c:c09::235]) (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 E5C101A21DF for ; Wed, 13 Apr 2016 07:32:36 -0700 (PDT) Received: by mail-wm0-x235.google.com with SMTP id u206so81741459wme.1 for ; Wed, 13 Apr 2016 07:32:36 -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=PDl3I2hHYPbUYw4MBY1Vevg5ZKHCW6m7Ohern1V0Nao=; b=O8wlDmpG6dG9dzS61hI4ORPj9isiUZ3SKN21KS1N3Hb4zht6w9+8q4bG6pRqgFICde 3Th5XUnq73xSPfT/KQrCZVFG2PTk0Sl8qSJO+5/RzszGRN6Z6JK12IjtTuwOxiVzh2ta QJuJr4KKgFqtLkb/xQc5PWNROPmPJJev0MyJ0= 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=PDl3I2hHYPbUYw4MBY1Vevg5ZKHCW6m7Ohern1V0Nao=; b=KQnbjUcIz1AICMkV94ix/tR1DXteVy07gZUDd5UPdpoVATl8tskkkJcPDlHMYRAVSV ks9zsfHH8BuphXnYZHs8oC9PajmgJ2dqblO36DsjofMLyJTZwEjn8UOAQ6AMLZCO8GCe VoHWjz3GuxpXE5NZWcovACCPK4HN9087iQZgpEfkoNAlE7PPN6ATq1VSy7OQ9IO3EK0R RwvNtpYJ96ZCLexxmXybAFW8BK3AryRUCJ8uWpOMRUlBr9QQ0sUzjx7qlcFoMHe/vEeP aFL/YYHgByySvjwlr92WPz8vm3jnZODqzecTvgAieDWH9vzbwKN1UV0XDEpU6yLiYVRQ QY3A== X-Gm-Message-State: AOPr4FUk5iZ7If8v2BY/5ISsvge2uV/3PQ9m/epdvuiZ9ogMlUyf9wUZ2bE9d4c/WaCiELUX X-Received: by 10.194.112.167 with SMTP id ir7mr9915217wjb.14.1460557955331; Wed, 13 Apr 2016 07:32:35 -0700 (PDT) Received: from localhost.localdomain ([195.55.142.58]) by smtp.gmail.com with ESMTPSA id 188sm1589444wmk.6.2016.04.13.07.32.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 13 Apr 2016 07:32:34 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org, lersek@redhat.com Date: Wed, 13 Apr 2016 16:32:12 +0200 Message-Id: <1460557933-23346-9-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1460557933-23346-1-git-send-email-ard.biesheuvel@linaro.org> References: <1460557933-23346-1-git-send-email-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH v4 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 Reviewed-by: Laszlo Ersek --- ArmVirtPkg/XenioFdtDxe/XenioFdtDxe.inf | 44 +++++++++++++ ArmVirtPkg/XenioFdtDxe/XenioFdtDxe.c | 68 ++++++++++++++++++++ ArmVirtPkg/ArmVirtXen.dsc | 2 +- ArmVirtPkg/ArmVirtXen.fdf | 2 +- 4 files changed, 114 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/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..4a88db32170c --- /dev/null +++ b/ArmVirtPkg/XenioFdtDxe/XenioFdtDxe.c @@ -0,0 +1,68 @@ +/** @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); + if (EFI_ERROR (Status)) { + DEBUG ((EFI_D_WARN, "%a: No 'xen,xen' compatible DT node found\n", + __FUNCTION__)); + return EFI_UNSUPPORTED; + } + + 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 #