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 39C0C740038 for ; Sun, 28 Jan 2024 13:50:36 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=fbsyq3Ehywrv41W3toDbnhxUge+vCfYKJaSyMzgZ2lc=; 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=BqeIp3u2M9oCHrVkuYV+A4xIvKCgUhubXkDwwWbKCCbuzZvckIaeFFrQ8LDcqrdrzzxYU+Ni 6NpNcCoPXEgOtkcuX+mgsLWAJAvbaY8FXTqAxv3PcsbVO90oKGHZry2W+eMVNZ1SPgXqOKqpJc7 2X7nF7Pc7eKI5YTqeVgDDt9U= X-Received: by 127.0.0.2 with SMTP id WR4jYY7687511xRlEcPHqQq7; 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: x45Y2Lu7ygp63OPycnXkuXCNx7686176AA= 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: 8bit X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=BqeIp3u2; 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: 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 patch 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 ( } } - if (((EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)ChildTable)->Dsdt != 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)->XDsdt != 0) { + TableToInstall = (VOID *)(UINTN)((EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)ChildTable)->XDsdt; + } else if (((EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)ChildTable)->Dsdt != 0) { TableToInstall = (VOID *)(UINTN)((EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)ChildTable)->Dsdt; - Status = 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; - } + } else { + DEBUG ((DEBUG_ERROR, "DSDT table not found\n")); + continue; + } + + Status = 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; } } } -- 2.39.2 -=-=-=-=-=-=-=-=-=-=-=- 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/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-