From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:4864:20::441; helo=mail-pf1-x441.google.com; envelope-from=ming.huang@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) (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 39CA5210C123B for ; Tue, 24 Jul 2018 00:24:35 -0700 (PDT) Received: by mail-pf1-x441.google.com with SMTP id q7-v6so639467pff.2 for ; Tue, 24 Jul 2018 00:24:35 -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=R2AjY+FOdGZZi2bYhpKDLZPTXQYv2dzyhRmXNodOHtE=; b=CU2NSsvt+W4yfd9Cblc1dmlcgSGrIsaQ/fHa9smcAUHeU6LGtVcQRBeH0K1cs4Twlu 8dSZqILgbHvMRvEFKszQZSK+Fcg9491+jKLLXgJ9kcfKMdxbQBDSxWQC3AJCxXC8WPeX X5VZlpTgDOYJ1eILeWVvDONhjGPdYdvjs8Lf8= 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=R2AjY+FOdGZZi2bYhpKDLZPTXQYv2dzyhRmXNodOHtE=; b=KQDtAWH1MidC9LnwvGYvmi6chG7FAG7Td0FQBvJGK+IGkN77y26QSLMTE+8zlE3WXB DFrJu/PacJwgCUw7BD4amrM1nYpMr1kFY+Hfalc0r0CESjXDoJlFNvw5fHMC8FMBix9Y +c/8/4trWkK5E/6F8R0fpJpy9VW/WoS6No/1sdUrYimvWjxrMjZI2gZYa2vpN0Ap7ggw eb2tS3pK1qt4UV2qC23Kv4xpy077X/ql1tw0IQcDB3/zApXNtwDhuXATASXGZy6XerwV JrOa+Khrdw6Xy8JTm2sENPA9C5acKIR700q0FMOXL6ePiYo9TrvYzJ9tcFE09xWctlcy dCqw== X-Gm-Message-State: AOUpUlHntC8PB2c0qs0OYhENjkBRhhUtKG62/sMTTDNVic97AdXhHoKQ zde8TBHSBH19ymgolquTyknSoQ== X-Google-Smtp-Source: AAOMgpevRg82fqnV+mGDx0qZFUR8GVPA6KKjZpWVBcF9069K3fIwHGOAxu/ItAdNIaBjd1wC8umtfg== X-Received: by 2002:a63:5204:: with SMTP id g4-v6mr15421759pgb.274.1532417074993; Tue, 24 Jul 2018 00:24:34 -0700 (PDT) Received: from localhost.localdomain ([120.31.149.194]) by smtp.gmail.com with ESMTPSA id t14-v6sm11449788pgu.0.2018.07.24.00.24.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 24 Jul 2018 00:24:34 -0700 (PDT) From: Ming Huang To: leif.lindholm@linaro.org, linaro-uefi@lists.linaro.org, edk2-devel@lists.01.org, graeme.gregory@linaro.org Cc: ard.biesheuvel@linaro.org, guoheyi@huawei.com, wanghuiqiang@huawei.com, huangming23@huawei.com, zhangjinsong2@huawei.com, huangdaode@hisilicon.com, john.garry@huawei.com, xinliang.liu@linaro.org, Ming Huang , Heyi Guo Date: Tue, 24 Jul 2018 15:09:19 +0800 Message-Id: <20180724070922.63362-36-ming.huang@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180724070922.63362-1-ming.huang@linaro.org> References: <20180724070922.63362-1-ming.huang@linaro.org> Subject: [PATCH edk2-platforms v1 35/38] Silicon/Hisilicon/Setup: Support SPCR table switch X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Jul 2018 07:24:35 -0000 If install SPCR table, KVM will not output while install or boot some OS, like ubuntu, so add SPCR switch setup item and set it disable by default. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ming Huang Signed-off-by: Heyi Guo --- Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf | 1 + Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/UpdateAcpiTable.c | 24 ++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf b/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf index e268a56bbd..c32fe42d60 100644 --- a/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf +++ b/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/AcpiPlatformDxe.inf @@ -51,6 +51,7 @@ [Guids] gHisiEfiMemoryMapGuid + gOemConfigGuid [Pcd] gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiTableStorageFile ## CONSUMES diff --git a/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/UpdateAcpiTable.c b/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/UpdateAcpiTable.c index 54f49977c3..32878ca4f9 100644 --- a/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/UpdateAcpiTable.c +++ b/Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/UpdateAcpiTable.c @@ -16,8 +16,10 @@ #include #include #include +#include #include #include +#include #include #define CORECOUNT(X) ((X) * CORE_NUM_PER_SOCKET) @@ -114,6 +116,25 @@ UpdateSlit ( return EFI_SUCCESS; } +STATIC +EFI_STATUS +IsNeedSpcr ( + IN OUT EFI_ACPI_DESCRIPTION_HEADER *Table + ) +{ + EFI_STATUS Status; + OEM_CONFIG_DATA SetupData; + UINTN DataSize = sizeof (OEM_CONFIG_DATA); + + Status = gRT->GetVariable (OEM_CONFIG_NAME, &gOemConfigGuid, NULL, &DataSize, &SetupData); + if (!EFI_ERROR (Status) && (SetupData.EnableSpcr == FALSE)) { + return EFI_ABORTED; + } + + return EFI_SUCCESS; +} + + EFI_STATUS UpdateAcpiTable ( IN OUT EFI_ACPI_DESCRIPTION_HEADER *TableHeader @@ -130,6 +151,9 @@ UpdateAcpiTable ( case EFI_ACPI_6_0_SYSTEM_LOCALITY_INFORMATION_TABLE_SIGNATURE: Status = UpdateSlit (TableHeader); break; + case EFI_ACPI_6_2_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE: + Status = IsNeedSpcr (TableHeader); + break; } return Status; } -- 2.17.0