From patchwork Tue Feb 27 09:20:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 129750 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp1171991lja; Tue, 27 Feb 2018 01:20:44 -0800 (PST) X-Google-Smtp-Source: AH8x226gFk6dnNZLc8cFVm603giuQuR0jiM9ty6nBcdQLJw1dS9HQvXDPmUAwN+dP+xdDDkJlw/D X-Received: by 10.167.130.133 with SMTP id s5mr13355976pfm.238.1519723244550; Tue, 27 Feb 2018 01:20:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519723244; cv=none; d=google.com; s=arc-20160816; b=sKSzJ5Zwy5XxVKWCSN+wG6ZplEvAq9+549K2JE0iWGMbImdaWNHJDojpnGYKnn2MfV mHYowgbBJfHdR5Ylnu23/b2xT5z5RGZrCSSsxO8FndhuTpDHhDvz9lgZlz6dznqZpZTd hL5M9XbgvXCR3MHIc5TFgVUsjQjIajek37v4UpVTf6pwJ4BAvPxOVg0o8+sniqBgeiVj xWHXjyAKm252kEnwaPygQeeaVMSXdrrNljquvtQQWIueCmPN5VtZjBQDUgC+eiOcdnAe ladD74tgvMwwjBNBTM4DzjqX0joS2N87vC67qQfh2Sl/2CfEtwyXFy28bJpLr/WoxBez ztpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=n6Hdcl9lBfG/hZt5DT5OWHX2rDXv/TK4QIRWIBsclWY=; b=RyOpulRJKDJ95hbiDT57lH31DxD9f40f8t9FNiqONikgJV7diN/hsnI/9PzSI4TQUu Buco3xGooHrS4RRJau2HkjoO0pcNrP3l1GKkullTzMUO0tzi41YsjKdxSVeHEm0V3CDr OZfZ+eBdes5hS3ZdQzs41Rbla1cBLTw0q2K7pxLpowOZb9zMvacd7d6hXd4vridoUnMP 61ZuoAXT3CIxWnvNWJkmNg+k4oMKjD7T9sTxXvWZQkwIXHk7sIJ2wkr2AZMgnJdGTFZt XdHkgpvdqa1C0Vcrsc/yRdnpXHs/UYeUfK+gbFGbwuL7JiNyMuPpCzOcOfzjIegUorBd p2ZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=EO2X+STn; 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 sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id f20-v6si8354378plj.254.2018.02.27.01.20.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Feb 2018 01:20:44 -0800 (PST) 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 header.s=google header.b=EO2X+STn; 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 sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 32B63222630C7; Tue, 27 Feb 2018 01:14:36 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::244; helo=mail-wm0-x244.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm0-x244.google.com (mail-wm0-x244.google.com [IPv6:2a00:1450:400c:c09::244]) (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 7BC6220955F07 for ; Tue, 27 Feb 2018 01:14:32 -0800 (PST) Received: by mail-wm0-x244.google.com with SMTP id q83so22688097wme.5 for ; Tue, 27 Feb 2018 01:20:38 -0800 (PST) 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=zqzz0frqwz24WWcwrpeBqIXlEAaSYvDWCdVNNWdppC0=; b=EO2X+STnPWapneanbg6xlfKIur6q4k7jDGpMn0ExvgQ7FkhjJ//m+aCi2M1JMkL2uo fqfpFAbnE8/kKTkWE8lxaTXximpTqGXLxj6gnQuqdji8fBZjv+FW1SK6H2zqqAk2Ob0H 2cIisVt7hVRSUPhu7KndAlzFkfE+3QKs+nzRY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=zqzz0frqwz24WWcwrpeBqIXlEAaSYvDWCdVNNWdppC0=; b=iijSzeWfYG9bYkQcqyO45g9DiIK0+w32HrMbdIyRWl/awjjzX5K/f7KnUzAc/xQFXC 9A8vX81rpIpAN6AcwEYsOGs+K31O25GyHDprT/JOwmcOJqgFhCMT+xPVGTasOXpM2fWH mr1FPVeJBbnBaiXDdYL65cfX+m/g76MndVpVwnyW78NwwogTFIA61z1mwDjSNN/ukoyw ETqv0y5suuIUP2PxnH0O+LQdz9getcgFcKPxGSjqsVfYRVH1RJX8UTHV5MeokacNocQr 52jqDQoatvFEvE0UDCujUeIM7jwV/wAVCKxcWteHMv5okhF/inB5hs1AlqBH1a+jEQHq YmEg== X-Gm-Message-State: APf1xPCh2ncK93KTDa+LVEiX6C+upIRLT2S++DgQzs+W4azEBjkOTeXL taQjScdYXxPAbxxZTIaCTP3Mbp8peHQ= X-Received: by 10.28.230.147 with SMTP id e19mr7744753wmi.2.1519723236900; Tue, 27 Feb 2018 01:20:36 -0800 (PST) Received: from localhost.localdomain ([160.167.215.215]) by smtp.gmail.com with ESMTPSA id x190sm12549865wme.27.2018.02.27.01.20.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Feb 2018 01:20:36 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Tue, 27 Feb 2018 09:20:16 +0000 Message-Id: <20180227092017.23617-5-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180227092017.23617-1-ard.biesheuvel@linaro.org> References: <20180227092017.23617-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH edk2-platforms 4/5] Silicon/SynQuacer/PlatformDxe: add option to enable ACPI mode X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: masahisa.kojima@linaro.org, leif.lindholm@linaro.org, Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" Create a HII menu option to choose between device tree and ACPI platform descriptions. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c | 32 ++++++++++++++------ Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.inf | 1 + Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxeHii.uni | 8 ++++- Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxeHii.vfr | 10 +++++- Silicon/Socionext/SynQuacer/Include/Platform/VarStore.h | 8 +++-- 5 files changed, 46 insertions(+), 13 deletions(-) -- 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Leif Lindholm diff --git a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c index 8787aa6288a7..4ae1c5b0ff6f 100644 --- a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c +++ b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c @@ -277,15 +277,29 @@ PlatformDxeEntryPoint ( mHiiSettingsVal = PcdGet64 (PcdPlatformSettings); mHiiSettings = (SYNQUACER_PLATFORM_VARSTORE_DATA *)&mHiiSettingsVal; - Dtb = NULL; - Status = DtPlatformLoadDtb (&Dtb, &DtbSize); - if (!EFI_ERROR (Status)) { - Status = gBS->InstallConfigurationTable (&gFdtTableGuid, Dtb); - } - if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, - "%a: failed to install FDT configuration table - %r\n", __FUNCTION__, - Status)); + if (mHiiSettings->AcpiPref == ACPIPREF_DT) { + Dtb = NULL; + Status = DtPlatformLoadDtb (&Dtb, &DtbSize); + if (!EFI_ERROR (Status)) { + Status = gBS->InstallConfigurationTable (&gFdtTableGuid, Dtb); + } + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, + "%a: failed to install FDT configuration table - %r\n", __FUNCTION__, + Status)); + } + } else { + // + // ACPI was selected: install the gEdkiiPlatformHasAcpiGuid GUID as a + // NULL protocol to unlock dispatch of ACPI related drivers. + // + Status = gBS->InstallMultipleProtocolInterfaces (&ImageHandle, + &gEdkiiPlatformHasAcpiGuid, NULL, NULL); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, + "%a: failed to install gEdkiiPlatformHasAcpiGuid as a protocol\n", + __FUNCTION__)); + } } Handle = NULL; diff --git a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.inf b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.inf index fca66799ebcb..bef7feccd8b8 100644 --- a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.inf +++ b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.inf @@ -58,6 +58,7 @@ [LibraryClasses] [Guids] g96BoardsI2c0MasterGuid + gEdkiiPlatformHasAcpiGuid gEfiHiiPlatformSetupFormsetGuid gFdtTableGuid gNetsecNonDiscoverableDeviceGuid diff --git a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxeHii.uni b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxeHii.uni index 2eca8bbba8c3..836decc870f0 100644 --- a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxeHii.uni +++ b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxeHii.uni @@ -1,6 +1,6 @@ /** @file * -* Copyright (c) 2017, Linaro, Ltd. All rights reserved. +* Copyright (c) 2017 - 2018, 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 @@ -33,3 +33,9 @@ #string STR_EMMC_DISABLED #language en-US "Disabled" #string STR_EMMC_ENABLED #language en-US "Enabled" + +#string STR_DT_ACPI_SELECT_PROMPT #language en-US "O/S Hardware Description" +#string STR_DT_ACPI_SELECT_HELP #language en-US "Select the hardware description that will be exposed to the O/S." + +#string STR_DT_ACPI_SELECT_DT #language en-US "Device Tree" +#string STR_DT_ACPI_SELECT_ACPI #language en-US "ACPI" diff --git a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxeHii.vfr b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxeHii.vfr index ea35e902b2d7..8a395eac681b 100644 --- a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxeHii.vfr +++ b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxeHii.vfr @@ -1,6 +1,6 @@ /** @file * -* Copyright (c) 2017, Linaro, Ltd. All rights reserved. +* Copyright (c) 2017 - 2018, 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 @@ -70,6 +70,14 @@ formset option text = STRING_TOKEN(STR_EMMC_ENABLED), value = EMMC_ENABLED, flags = 0; endoneof; + oneof varid = SynQuacerPlatformSettings.AcpiPref, + prompt = STRING_TOKEN(STR_DT_ACPI_SELECT_PROMPT), + help = STRING_TOKEN(STR_DT_ACPI_SELECT_HELP), + flags = NUMERIC_SIZE_1 | INTERACTIVE | RESET_REQUIRED, + option text = STRING_TOKEN(STR_DT_ACPI_SELECT_DT), value = ACPIPREF_DT, flags = DEFAULT; + option text = STRING_TOKEN(STR_DT_ACPI_SELECT_ACPI), value = ACPIPREF_ACPI, flags = 0; + endoneof; + subtitle text = STRING_TOKEN(STR_NULL_STRING); endform; diff --git a/Silicon/Socionext/SynQuacer/Include/Platform/VarStore.h b/Silicon/Socionext/SynQuacer/Include/Platform/VarStore.h index fbbcbd7d3eec..bb0e476fc3f8 100644 --- a/Silicon/Socionext/SynQuacer/Include/Platform/VarStore.h +++ b/Silicon/Socionext/SynQuacer/Include/Platform/VarStore.h @@ -1,6 +1,6 @@ /** @file - Copyright (c) 2017, Linaro, Ltd. All rights reserved.
+ Copyright (c) 2017 - 2018, 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 @@ -22,12 +22,16 @@ #define PCIE_MAX_SPEED_UNLIMITED 0x0 #define PCIE_MAX_SPEED_GEN1 0x1 +#define ACPIPREF_DT 0x0 +#define ACPIPREF_ACPI 0x1 + typedef struct { UINT8 EnableEmmc; UINT8 PcieSlot0MaxSpeed; UINT8 PcieSlot1MaxSpeed; UINT8 PcieSlot2MaxSpeed; - UINT8 Reserved[4]; + UINT8 AcpiPref; + UINT8 Reserved[3]; } SYNQUACER_PLATFORM_VARSTORE_DATA; #endif