From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io0-x232.google.com (mail-io0-x232.google.com [IPv6:2607:f8b0:4001:c06::232]) (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 EE42E803B1 for ; Wed, 22 Mar 2017 07:15:21 -0700 (PDT) Received: by mail-io0-x232.google.com with SMTP id b140so66267248iof.1 for ; Wed, 22 Mar 2017 07:15:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=27QV4uW4GzFkyzuj5zXAw2bosWa9ggMH+xa+lfpiCMk=; b=Ip2DIimI1NE06BkeqwTF/sDt8a5PzmEYUgnRVeWEHl3YpMc9JRlgiXLUjLOpTjTefP C8+nLyHGlAsmIJRKRg+NN8SB07oqbmm+JXtDDHdrWw7l7fVMqJJYp6BEFMS+/NcmmMDR J6ia23YZEGLCAJAlGx98Im0WyuxrAPi6ZulqU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=27QV4uW4GzFkyzuj5zXAw2bosWa9ggMH+xa+lfpiCMk=; b=b+L8wIiPOn+mChvYEfDzOBbXd41FkszqLOG1owELdQaS2gI6a2m2zrCQ91NJmdhwJF klhijO5h0xLRfKvh4cPXaj7DY4tRiKZr9y9honBodxyWPSK8vUUb87k5g9IUTWRQlvU6 8ke4XIu9/h4RTdyB58HQWCQv+96DKTfzlal0gCtYLdyeNfT7uzO8YOrEOYX2xKGcFl9E Xpq87OywE6XZRn3zXIPt6m0NHxhsPPxwNaGmn6ajsZ7/8TG4ig1WvDIJI5YnZLO2md8z lfclBxy18lKZ8UKn7P9IH+XpjCu+IAm/Ipdz7Tq+otWoWCHxzAeBUrEu6591w4FyjuB1 7sgA== X-Gm-Message-State: AFeK/H1sfXrT2dAWT6neo1MidQ3wOBGk8qvHk/gDs/tEzkITINklO8h34FAzwBJFe+6yXhNtxlaXY5FRnYl2cqW3 X-Received: by 10.107.168.21 with SMTP id r21mr34673176ioe.45.1490192121275; Wed, 22 Mar 2017 07:15:21 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.10.27 with HTTP; Wed, 22 Mar 2017 07:15:20 -0700 (PDT) In-Reply-To: <20170317204731.31488-9-lersek@redhat.com> References: <20170317204731.31488-1-lersek@redhat.com> <20170317204731.31488-9-lersek@redhat.com> From: Ard Biesheuvel Date: Wed, 22 Mar 2017 14:15:20 +0000 Message-ID: To: Laszlo Ersek Cc: edk2-devel-01 , Leif Lindholm Subject: Re: [PATCH v2 08/12] ArmVirtPkg: add XenPlatformHasAcpiDtDxe X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Mar 2017 14:15:22 -0000 Content-Type: text/plain; charset=UTF-8 On 17 March 2017 at 20:47, Laszlo Ersek wrote: > This driver produces the EDKII Platform Has ACPI and Platform Has Device > Tree protocols, exactly matching the current ACPI / DT exposure on Xen, > according to ARM vs. AARCH64. At this point it differs from the QEMU > driver PlatformHasAcpiDtDxe in that this one always installs the DT. > > Cc: Ard Biesheuvel > Cc: Leif Lindholm > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Laszlo Ersek Reviewed-by: Ard Biesheuvel > --- > ArmVirtPkg/XenPlatformHasAcpiDtDxe/XenPlatformHasAcpiDtDxe.inf | 43 ++++++++++++ > ArmVirtPkg/XenPlatformHasAcpiDtDxe/XenPlatformHasAcpiDtDxe.c | 72 ++++++++++++++++++++ > 2 files changed, 115 insertions(+) > > diff --git a/ArmVirtPkg/XenPlatformHasAcpiDtDxe/XenPlatformHasAcpiDtDxe.inf b/ArmVirtPkg/XenPlatformHasAcpiDtDxe/XenPlatformHasAcpiDtDxe.inf > new file mode 100644 > index 000000000000..e25207832c39 > --- /dev/null > +++ b/ArmVirtPkg/XenPlatformHasAcpiDtDxe/XenPlatformHasAcpiDtDxe.inf > @@ -0,0 +1,43 @@ > +## @file > +# Decide whether the firmware should expose an ACPI- and/or a Device Tree-based > +# hardware description to the operating system. > +# > +# Copyright (c) 2017, Red Hat, Inc. > +# > +# 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 = 1.25 > + BASE_NAME = XenPlatformHasAcpiDtDxe > + FILE_GUID = 6914c46f-d46e-48dc-9998-8a5f64f02553 > + MODULE_TYPE = DXE_DRIVER > + VERSION_STRING = 1.0 > + ENTRY_POINT = XenPlatformHasAcpiDt > + > +[Sources] > + XenPlatformHasAcpiDtDxe.c > + > +[Packages] > + ArmPkg/ArmPkg.dec > + ArmVirtPkg/ArmVirtPkg.dec > + MdePkg/MdePkg.dec > + > +[LibraryClasses] > + BaseLib > + DebugLib > + UefiBootServicesTableLib > + UefiDriverEntryPoint > + > +[Protocols] > + gEdkiiPlatformHasAcpiProtocolGuid ## SOMETIMES_PRODUCES > + gEdkiiPlatformHasDeviceTreeProtocolGuid ## PRODUCES > + > +[Depex] > + TRUE > diff --git a/ArmVirtPkg/XenPlatformHasAcpiDtDxe/XenPlatformHasAcpiDtDxe.c b/ArmVirtPkg/XenPlatformHasAcpiDtDxe/XenPlatformHasAcpiDtDxe.c > new file mode 100644 > index 000000000000..0c3b1f7c7893 > --- /dev/null > +++ b/ArmVirtPkg/XenPlatformHasAcpiDtDxe/XenPlatformHasAcpiDtDxe.c > @@ -0,0 +1,72 @@ > +/** @file > + Decide whether the firmware should expose an ACPI- and/or a Device Tree-based > + hardware description to the operating system. > + > + Copyright (c) 2017, Red Hat, Inc. > + > + 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 > + > +EFI_STATUS > +EFIAPI > +XenPlatformHasAcpiDt ( > + IN EFI_HANDLE ImageHandle, > + IN EFI_SYSTEM_TABLE *SystemTable > + ) > +{ > + EFI_STATUS Status; > + > + // > + // If we fail to install any of the necessary protocols below, the OS will be > + // unbootable anyway (due to lacking hardware description), so tolerate no > + // errors here. > + // > + // Always make ACPI available on 64-bit systems. > + // > + if (MAX_UINTN == MAX_UINT64) { > + Status = gBS->InstallProtocolInterface ( > + &ImageHandle, > + &gEdkiiPlatformHasAcpiProtocolGuid, > + EFI_NATIVE_INTERFACE, > + NULL > + ); > + if (EFI_ERROR (Status)) { > + goto Failed; > + } > + } > + > + // > + // Expose the Device Tree unconditionally. > + // > + Status = gBS->InstallProtocolInterface ( > + &ImageHandle, > + &gEdkiiPlatformHasDeviceTreeProtocolGuid, > + EFI_NATIVE_INTERFACE, > + NULL > + ); > + if (EFI_ERROR (Status)) { > + goto Failed; > + } > + > + return Status; > + > +Failed: > + ASSERT_EFI_ERROR (Status); > + CpuDeadLoop (); > + // > + // Keep compilers happy. > + // > + return Status; > +} > -- > 2.9.3 > >