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 D342694107D for ; Mon, 4 Dec 2023 05:18:40 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=eJdiNW4LGcL07NwRZ4DUX65YkB16TMK9kQJL/pFasKQ=; 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=1701667119; v=1; b=u4JYYWWM4CAVG1qebdlyHgD/n9d8YxdQKkhD9I6vsEDpRkvgQBgdyFwDAzfpFifgmJHKAjJe pv8hknrNSMgKmKwytO6IWYWkZTqn6+2/qXzNGh3WvxztfuTN18y3h/1FmJ7RCMx6AhI7yoDYXaH z4j3MngYG64M/MRBIkqwpZ0U= X-Received: by 127.0.0.2 with SMTP id FC8RYY7687511x8YnuOtm7SZ; Sun, 03 Dec 2023 21:18:39 -0800 X-Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179]) by mx.groups.io with SMTP id smtpd.web10.62981.1701667118809143844 for ; Sun, 03 Dec 2023 21:18:38 -0800 X-Received: by mail-pf1-f179.google.com with SMTP id d2e1a72fcca58-6cddc148285so4381069b3a.2 for ; Sun, 03 Dec 2023 21:18:38 -0800 (PST) X-Gm-Message-State: U8PB4EvlpP8M5Z6f7AVvbaxQx7686176AA= X-Google-Smtp-Source: AGHT+IFx6YP52EBbABWKwIuhkZaLsC99IzDEAeJ8m/B9JhZZ6UbSsRuHDvVTaS85OiI8hAouxdiuGw== X-Received: by 2002:aa7:9a45:0:b0:6cd:d639:b353 with SMTP id x5-20020aa79a45000000b006cdd639b353mr3801619pfj.18.1701667117981; Sun, 03 Dec 2023 21:18:37 -0800 (PST) X-Received: from dhaval.blr.rivosinc.com ([49.249.129.34]) by smtp.gmail.com with ESMTPSA id x31-20020a056a00189f00b006ce5c583c89sm186221pfh.15.2023.12.03.21.18.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Dec 2023 21:18:37 -0800 (PST) From: "Dhaval Sharma" To: devel@edk2.groups.io Cc: Liming Gao , Zhiguang Liu , Dandan Bi , chasel.chiu@intel.com Subject: [edk2-devel] [PATCH v4 1/1] MdeModulePkg/AcpiTableDxe: Prefer xDSDT over DSDT when installing tables Date: Mon, 4 Dec 2023 10:47:47 +0530 Message-Id: <20231204051747.63076-2-dhaval@rivosinc.com> In-Reply-To: <20231204051747.63076-1-dhaval@rivosinc.com> References: <20231204051747.63076-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=u4JYYWWM; 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 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 (#112003): https://edk2.groups.io/g/devel/message/112003 Mute This Topic: https://groups.io/mt/102965684/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-