From nobody Thu Dec 26 16:51:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+114655+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+114655+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1706449835; cv=none; d=zohomail.com; s=zohoarc; b=BQ1w/qibc38t9X+FfsJHHOUbh897G06FKEsUFlkVXVQYEMn9bL1fI8UCR0BpkD2US/eIYho9GeSVy8lDtZXdiZoSS3LzWZuVr7PsJVAPUnTG+bbpSWr2jy0IDFtUz80NpEiAhZWuRqWGL5ipTydwj+1PYB8wAJXXIM3Hlotbdno= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706449835; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=yKejxA7Qj5iI3RyA0PMUvVL3N+Jskej4rTEqomSTrCs=; b=JPnalhopyNqjlTDuBxxm3FBkompXGKyr/eUG2+Fue8rYV/1inU21jxWoKasZgH+hg+ThAkMTNv5TO1xdb8OrVs1O+d3Iu2M96JOqLLk5egiJNRKl2JTTccrE4EHI1wijC6T013uX37r4Qu/Ya+ozHPPjVX4KPVn2El4lHrYLQYk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+114655+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 17064498352629.50845906099039; Sun, 28 Jan 2024 05:50:35 -0800 (PST) Return-Path: DKIM-Signature: a=rsa-sha256; bh=+a2gume0xGyFxkYq93F7LwOGLTfRu6JMWIZxrMbaLGk=; 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=1706449834; v=1; b=Xh0U8JOv8OD8aXgpo6imiMMd33MohRSoN99h9wgUb7XkrEIctV/EIpgopILAvcsftSuGLWnU B8cES7TKq8p1UKJYezBFoUjTq73jJKsSvej6iX//REk1cjoMSXCJucCV1+PprkuysSdqjZWWXL9 +JQ2fwJuZ/Qo2LAMV1A+rImY= X-Received: by 127.0.0.2 with SMTP id xg1zYY1788612xxMtSBsRsjr; Sun, 28 Jan 2024 05:50:34 -0800 X-Received: from mail-oo1-f41.google.com (mail-oo1-f41.google.com [209.85.161.41]) by mx.groups.io with SMTP id smtpd.web11.37547.1706449834351346735 for ; Sun, 28 Jan 2024 05:50:34 -0800 X-Received: by mail-oo1-f41.google.com with SMTP id 006d021491bc7-59a0fb8a802so990902eaf.1 for ; Sun, 28 Jan 2024 05:50:34 -0800 (PST) X-Gm-Message-State: z2ZFgR2kGUZyDg7i8tYKQebhx1787277AA= X-Google-Smtp-Source: AGHT+IE7Sn3sucDH15H/90Dw+n2CFgswLpiYh5B27JAFlxJwATzChSEGRt+LVnskzJEIXXYHuIG7Mw== X-Received: by 2002:a05:6358:998d:b0:176:59c0:883f with SMTP id j13-20020a056358998d00b0017659c0883fmr4421665rwb.8.1706449833243; Sun, 28 Jan 2024 05:50:33 -0800 (PST) X-Received: from dhaval.. ([171.76.83.193]) by smtp.gmail.com with ESMTPSA id e17-20020aa79811000000b006da022d1bc8sm4145299pfl.25.2024.01.28.05.50.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jan 2024 05:50:32 -0800 (PST) From: "Dhaval Sharma" To: devel@edk2.groups.io Cc: gaoliming@byosoft.com.cn, zhiguang.liu@intel.com, dandan.bi@intel.com, pedro.falcato@gmail.com, chasel.chiu@intel.com Subject: [edk2-devel] [PATCH v5 1/1] MdeModulePkg/AcpiTableDxe: Prefer xDSDT over DSDT when installing tables Date: Sun, 28 Jan 2024 19:09:17 +0530 Message-Id: <20240128134816.236973-2-dhaval@rivosinc.com> In-Reply-To: <20240128134816.236973-1-dhaval@rivosinc.com> References: <20240128134816.236973-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-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1706449836581100001 Content-Type: text/plain; charset="utf-8" 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: v5: - If DSDT is not found, throw error and continue to build other tables 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 | 24 ++++++++= ++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c b= /MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c index e09bc9b704f5..3879e10b3349 100644 --- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c +++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c @@ -1892,14 +1892,24 @@ InstallAcpiTableFromHob ( } } =20 - if (((EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)ChildTable)->Dsd= t !=3D 0) { + // + // First check if xDSDT is available, as that is preferred as per + // ACPI Spec 6.5+ Table 5-9 X_DSDT definition + // + if (((EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)ChildTable)->XDs= dt !=3D 0) { + TableToInstall =3D (VOID *)(UINTN)((EFI_ACPI_3_0_FIXED_ACPI_DESC= RIPTION_TABLE *)ChildTable)->XDsdt; + } else if (((EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)ChildTabl= e)->Dsdt !=3D 0) { TableToInstall =3D (VOID *)(UINTN)((EFI_ACPI_3_0_FIXED_ACPI_DESC= RIPTION_TABLE *)ChildTable)->Dsdt; - Status =3D AddTableToList (AcpiTableInstance, TableToIns= tall, TRUE, Version, TRUE, &TableKey); - if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "InstallAcpiTableFromHob: Fail to add ACP= I table DSDT\n")); - ASSERT_EFI_ERROR (Status); - break; - } + } else { + DEBUG ((DEBUG_ERROR, "DSDT table not found\n")); + continue; + } + + Status =3D AddTableToList (AcpiTableInstance, TableToInstall, TRUE= , Version, TRUE, &TableKey); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "InstallAcpiTableFromHob: Fail to add ACPI = table DSDT\n")); + ASSERT_EFI_ERROR (Status); + break; } } } --=20 2.39.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#114655): https://edk2.groups.io/g/devel/message/114655 Mute This Topic: https://groups.io/mt/104011845/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-