From patchwork Tue Sep 22 18:45:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1369225 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=Q+A/VKSk; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BwrC94b8Bz9sTS for ; Wed, 23 Sep 2020 04:57:09 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 905F4826CC; Tue, 22 Sep 2020 20:49:23 +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="Q+A/VKSk"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CBF6C823ED; Tue, 22 Sep 2020 20:47:33 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ot1-x341.google.com (mail-ot1-x341.google.com [IPv6:2607:f8b0:4864:20::341]) (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 A5A5B825B7 for ; Tue, 22 Sep 2020 20:47:19 +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-ot1-x341.google.com with SMTP id m13so12096084otl.9 for ; Tue, 22 Sep 2020 11:47:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=N6e2GaZcnH7HQC2Jm7p8hDt5rAcdjoVRE8MU6catTW4=; b=Q+A/VKSkDMCPM6HSXgfCCPeku47K6xgmvc7I6rVDiZrsmsvmRNa2jJLIm/FiyJYHbo E9WRvDcipkySy7hnoDY90btPZ2n5zyzzR5GOEO4vJ1xbGe0zllel7ybdCahVNDajDOOL IjKQ7BqQ7W6sUcAU1n4a3gVTGLThngORUGvOw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=N6e2GaZcnH7HQC2Jm7p8hDt5rAcdjoVRE8MU6catTW4=; b=eW7NajSyt1ESrcfMswR9HyLO/dw/fvYgtvKQiFegsjxyYU0Ggf+vBzB3Cu68eJns01 MJSx9UMqvdUhGSHj/SzS//+zte8rMMWpCQZ2YIsTCT/mXhxGsK7j3rYaivFlPbaeNLre PdRpeCRZgAbANsGVamNJYrFNcIBjLogcik8Dc9vN53baeFtkXzb2y3MZPXPgdB06hZR5 myHNBrVPihoVYQm5iVKWdYvfQaPio3CHhAK9PlB7FUeW8gFEL0wiwZCIGLwU3jcaaAvS 7u0hdWE9I2iQ9Z832PDVFQriWzcjM9RW4XpOzOgXbDFBhGvWykigPrw/25LDUUtm+1zZ RkRw== X-Gm-Message-State: AOAM532ajnPkt3Lg4dH/rXLWps3JZLVhGXo4dmkmv7a4MmwXThTMTAEz ndrsaJ+kaepJrWu4k26TJ5wym4RC8A4ncjrW X-Google-Smtp-Source: ABdhPJy+nvtGm4DSyStexaPRvd0o9NtI/DkOpP//tRngjToPk51nkjuj3KSWNGHzdYrQ/UKI5244Nw== X-Received: by 2002:a9d:1442:: with SMTP id h60mr3946925oth.35.1600800438310; Tue, 22 Sep 2020 11:47:18 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id q24sm7622663oij.19.2020.09.22.11.47.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Sep 2020 11:47:17 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Andy Shevchenko , Wolfgang Wallner , Bin Meng , Bernhard Messerklinger , Simon Glass Subject: [PATCH v4 55/59] x86: Add a way to add to the e820 memory table Date: Tue, 22 Sep 2020 12:45:40 -0600 Message-Id: <20200922124521.v4.55.I76d2863227979dc3dd80af26759ff2ef51dc5553@changeid> X-Mailer: git-send-email 2.28.0.681.g6f77f65b4e-goog In-Reply-To: <20200922184544.2920969-1-sjg@chromium.org> References: <20200922184544.2920969-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean Some boards want to reserve extra regions of memory. Add a 'chosen' property to support this. Reviewed-by: Bin Meng Signed-off-by: Simon Glass --- (no changes since v1) arch/x86/lib/fsp/fsp_dram.c | 17 +++++++++++++++++ doc/device-tree-bindings/chosen.txt | 18 ++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/arch/x86/lib/fsp/fsp_dram.c b/arch/x86/lib/fsp/fsp_dram.c index faa819fab4b..a76497d4e01 100644 --- a/arch/x86/lib/fsp/fsp_dram.c +++ b/arch/x86/lib/fsp/fsp_dram.c @@ -12,6 +12,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -92,6 +93,8 @@ unsigned int install_e820_map(unsigned int max_entries, unsigned int num_entries = 0; const struct hob_header *hdr; struct hob_res_desc *res_desc; + const fdt64_t *prop; + int size; hdr = gd->arch.hob_list; @@ -133,6 +136,20 @@ unsigned int install_e820_map(unsigned int max_entries, num_entries++; } + prop = ofnode_read_chosen_prop("e820-entries", &size); + if (prop) { + int count = size / (sizeof(u64) * 3); + int i; + + if (num_entries + count >= max_entries) + return -ENOSPC; + for (i = 0; i < count; i++, num_entries++, prop += 3) { + entries[num_entries].addr = fdt64_to_cpu(prop[0]); + entries[num_entries].size = fdt64_to_cpu(prop[1]); + entries[num_entries].type = fdt64_to_cpu(prop[2]); + } + } + return num_entries; } diff --git a/doc/device-tree-bindings/chosen.txt b/doc/device-tree-bindings/chosen.txt index d4dfc05847b..e5ba6720ce1 100644 --- a/doc/device-tree-bindings/chosen.txt +++ b/doc/device-tree-bindings/chosen.txt @@ -143,3 +143,21 @@ This provides the ordering to use when writing device data to the ACPI SSDT node to add. The ACPI information is written in this order. If the ordering does not include all nodes, an error is generated. + +e820-entries +------------ + +This provides a way to add entries to the e820 table which tells the OS about +the memory map. The property contains three sets of 64-bit values: + + address - Start address of region + size - Size of region + flags - Flags (E820_...) + +Example: + +chosen { + e820-entries = /bits/ 64 < + IOMAP_P2SB_BAR IOMAP P2SB_SIZE E820_RESERVED + MCH_BASE_ADDRESS MCH_SIZE E820_RESERVED>; +};