From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A8721C6FD1D for ; Thu, 30 Mar 2023 21:42:16 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2265C85F8B; Thu, 30 Mar 2023 23:39:52 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="Vpx7PRJb"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C013E85F77; Thu, 30 Mar 2023 23:36:59 +0200 (CEST) Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 5CD5785F92 for ; Thu, 30 Mar 2023 23:35:40 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-pl1-x631.google.com with SMTP id z19so19425387plo.2 for ; Thu, 30 Mar 2023 14:35:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1680212138; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zb3K95pB8Oge3ThEgxS0K20586pTUVZa9thkCBSxmyU=; b=Vpx7PRJbBtd+0bj7C7B4VhgF/iPNzzuEW0eWIyr9R5QoPJeiAfcnZolYysvkmVZHVy RXMr7XqXFHVODdrr0nWr6CBv4Mmg9ey/Ek5PEwdmveqFCbWVfpA34rpi+CjmLTTPuHpH SxBCODiHDeJIlPNSUqSHhH6XGN5FzVzRncH40= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680212138; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zb3K95pB8Oge3ThEgxS0K20586pTUVZa9thkCBSxmyU=; b=nGywvFjFFSr4SGVl74iFJcmPZFBj9oYv3mGjYEp+0SBHVRnt2ZzMWz9KppCGqRInjH 1tjuI7elsLu0s0VLz386snFe8rghHsytO2O36XnpFXZ5LTo9bQX3Zr4NNXKSJo6FerlS W5lBo7EH4/BTjSA+VlfS0oLmLNvkZCUN75EiIRQpXO1RtiwhtrX6RTopsXilXkNkk6Gk 0C07FdHfJ2DKzyjvGixJJ1WKpeuydq/B0tAfmqrRWCpOb67K/qz+KwUuH+mA7UKliuK9 wtEGQ61n0RuLKL0EB+MwitEJ2bb6qrReTu22x62lw0rmF+dqxumn5o+LyFkGcx5OnlR+ QZtA== X-Gm-Message-State: AAQBX9cfqFhIBcul7cnvpfAxSMioNjPjl2MQhZnaddx60oNFW6bcJ/xq 9aMJBMyVQPuJKgFK/FdgGvjb9zdRss8d1yowSAM= X-Google-Smtp-Source: AKy350Z6YD8E6YH2fDtsIgf0HCzdqekDmk5GWjQhAAQFwaWQcDTiE3QCD4yZ2dtbwt9pGs3+Iyykdw== X-Received: by 2002:a17:90b:38d1:b0:23f:7464:ae55 with SMTP id nn17-20020a17090b38d100b0023f7464ae55mr27357689pjb.0.1680212138588; Thu, 30 Mar 2023 14:35:38 -0700 (PDT) Received: from localhost.localdomain ([27.110.126.54]) by smtp.gmail.com with ESMTPSA id q6-20020a170902b10600b001a282714f97sm144413plr.275.2023.03.30.14.35.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Mar 2023 14:35:38 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Heinrich Schuchardt , Simon Glass , Ilias Apalodimas Subject: [PATCH 38/38] efi: Use the installed ACPI tables Date: Fri, 31 Mar 2023 10:32:27 +1300 Message-Id: <20230331103047.38.I86db03df16c50b2b03532f99064a26c14704056f@changeid> X-Mailer: git-send-email 2.40.0.348.gf938b09366-goog In-Reply-To: <20230330213227.2142353-1-sjg@chromium.org> References: <20230330213227.2142353-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean U-Boot sets up the ACPI tables during startup. Rather than creating a new set, install the existing ones. Create a memory-map record to cover the tables. Signed-off-by: Simon Glass --- lib/efi_loader/efi_acpi.c | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/lib/efi_loader/efi_acpi.c b/lib/efi_loader/efi_acpi.c index 2ddc3502b5df..f755af76f866 100644 --- a/lib/efi_loader/efi_acpi.c +++ b/lib/efi_loader/efi_acpi.c @@ -10,6 +10,9 @@ #include #include #include +#include + +DECLARE_GLOBAL_DATA_PTR; static const efi_guid_t acpi_guid = EFI_ACPI_TABLE_GUID; @@ -20,26 +23,28 @@ static const efi_guid_t acpi_guid = EFI_ACPI_TABLE_GUID; */ efi_status_t efi_acpi_register(void) { - /* Map within the low 32 bits, to allow for 32bit ACPI tables */ - u64 acpi = U32_MAX; + ulong addr, start, end; efi_status_t ret; - ulong addr; - /* Reserve 64kiB page for ACPI */ - ret = efi_allocate_pages(EFI_ALLOCATE_MAX_ADDRESS, - EFI_ACPI_RECLAIM_MEMORY, 16, &acpi); + /* Mark space used for tables */ + start = ALIGN_DOWN(gd->arch.table_start, EFI_PAGE_MASK); + end = ALIGN(gd->arch.table_end, EFI_PAGE_MASK); + ret = efi_add_memory_map(start, end - start, EFI_ACPI_RECLAIM_MEMORY); if (ret != EFI_SUCCESS) return ret; + if (gd->arch.table_start_high) { + start = ALIGN_DOWN(gd->arch.table_start_high, EFI_PAGE_MASK); + end = ALIGN(gd->arch.table_end_high, EFI_PAGE_MASK); + ret = efi_add_memory_map(start, end - start, + EFI_ACPI_RECLAIM_MEMORY); + if (ret != EFI_SUCCESS) + return ret; + } - /* - * Generate ACPI tables - we know that efi_allocate_pages() returns - * a 4k-aligned address, so it is safe to assume that - * write_acpi_tables() will write the table at that address. - */ - addr = map_to_sysmem((void *)(ulong)acpi); - write_acpi_tables(addr); + addr = gd_acpi_start(); + printf("EFI using ACPI tables at %lx\n", addr); /* And expose them to our EFI payload */ return efi_install_configuration_table(&acpi_guid, - (void *)(uintptr_t)acpi); + (void *)(ulong)addr); } -- 2.40.0.348.gf938b09366-goog