From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 6C19A941CD3 for ; Mon, 8 Jan 2024 15:00:16 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=ibUKsHfSkSvi1zJhpZMVLB6HFfvQAxDpB+2MWy9UqpE=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1704726015; v=1; b=jaZ8jsAv17uLsTknYM5rRvvdxfZhR4IDRGK9XLe/TFvlPpR+atzn4hKKOIrvoq8AegptYkCu W2KEsrHJ9xTNFrXwduK45kVKe8XyFaovpZTyC4B4Wm5drEX6qIOfOnrzH6dgfHnUbV6mv9++H8i uILu1cqaRHGFrKOzvaOUcr/s= X-Received: by 127.0.0.2 with SMTP id a86cYY7687511xxZ8CijlcgI; Mon, 08 Jan 2024 07:00:15 -0800 X-Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) by mx.groups.io with SMTP id smtpd.web11.8831.1704726014520781854 for ; Mon, 08 Jan 2024 07:00:14 -0800 X-Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-6dad22e13dcso847695b3a.3 for ; Mon, 08 Jan 2024 07:00:14 -0800 (PST) X-Gm-Message-State: AhNukP2kwFWCQl3qtpp84q4sx7686176AA= X-Google-Smtp-Source: AGHT+IFSZg2k50trbGgW3Vreq20gVe7TEeVum6eAoTH/PipwCbxwbviSbHI2e1KTYayTTyIxbIbRaQ== X-Received: by 2002:aa7:8519:0:b0:6da:3f51:6d5 with SMTP id v25-20020aa78519000000b006da3f5106d5mr1431029pfn.41.1704726013683; Mon, 08 Jan 2024 07:00:13 -0800 (PST) X-Received: from dhaval.. ([171.76.80.114]) by smtp.gmail.com with ESMTPSA id o190-20020a62cdc7000000b006d9c65cc854sm6410071pfg.26.2024.01.08.07.00.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 07:00:13 -0800 (PST) From: "Dhaval Sharma" To: devel@edk2.groups.io Cc: Liming Gao , Zhiguang Liu , Dandan Bi , Pedro Falcato , chasel.chiu@intel.com Subject: [edk2-devel] [PATCH v4 1/1] MdeModulePkg/AcpiTableDxe: Prefer xDSDT over DSDT when installing tables Date: Mon, 8 Jan 2024 20:29:38 +0530 Message-Id: <20240108145938.16154-2-dhaval@rivosinc.com> In-Reply-To: <20240108145938.16154-1-dhaval@rivosinc.com> References: <20240108145938.16154-1-dhaval@rivosinc.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,dhaval@rivosinc.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=jaZ8jsAv; dmarc=none; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io As per ACPI Spec 6.5+ Table 5-9 if xDSDT is available, it should be used first. Handle required flow when xDSDT is absent or present. Test: Tested on RISCV64 Qemu platform with xDSDT and booted to linux kernel. Cc: Liming Gao Cc: Zhiguang Liu Cc: Dandan Bi Cc: Pedro Falcato Cc: devel@edk2.groups.io Signed-off-by: Dhaval Sharma Acked-by: Chasel Chiu --- Notes: v4: - Fix typos and commit message adding more clarity to patch subject v3: - Added description of ACPI spec clarification based on which this patc= h is created - Optimizing if-else flow v2: - Added proper indentation for else if MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c | 23 ++++++++= ++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c b= /MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c index e09bc9b704f5..61af6047a2a7 100644 --- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c +++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c @@ -1892,14 +1892,23 @@ InstallAcpiTableFromHob ( }=0D }=0D =0D - if (((EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)ChildTable)->Dsd= t !=3D 0) {=0D + //=0D + // First check if xDSDT is available, as that is preferred as per= =0D + // ACPI Spec 6.5+ Table 5-9 X_DSDT definition=0D + //=0D + if (((EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)ChildTable)->XDs= dt !=3D 0) {=0D + TableToInstall =3D (VOID *)(UINTN)((EFI_ACPI_3_0_FIXED_ACPI_DESC= RIPTION_TABLE *)ChildTable)->XDsdt;=0D + } else if (((EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)ChildTabl= e)->Dsdt !=3D 0) {=0D TableToInstall =3D (VOID *)(UINTN)((EFI_ACPI_3_0_FIXED_ACPI_DESC= RIPTION_TABLE *)ChildTable)->Dsdt;=0D - Status =3D AddTableToList (AcpiTableInstance, TableToIns= tall, TRUE, Version, TRUE, &TableKey);=0D - if (EFI_ERROR (Status)) {=0D - DEBUG ((DEBUG_ERROR, "InstallAcpiTableFromHob: Fail to add ACP= I table DSDT\n"));=0D - ASSERT_EFI_ERROR (Status);=0D - break;=0D - }=0D + } else {=0D + break;=0D + }=0D +=0D + Status =3D AddTableToList (AcpiTableInstance, TableToInstall, TRUE= , Version, TRUE, &TableKey);=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "InstallAcpiTableFromHob: Fail to add ACPI = table DSDT\n"));=0D + ASSERT_EFI_ERROR (Status);=0D + break;=0D }=0D }=0D }=0D --=20 2.39.2 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#113401): https://edk2.groups.io/g/devel/message/113401 Mute This Topic: https://groups.io/mt/103598583/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-