From patchwork Mon Jan 27 05:06:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1229601 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=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=KBHNjfMH; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 485dY610hBz9sR1 for ; Mon, 27 Jan 2020 16:27:22 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5B0A181946; Mon, 27 Jan 2020 06:14:16 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (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=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="KBHNjfMH"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EF0AF817EC; Mon, 27 Jan 2020 06:10:35 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=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-io1-xd41.google.com (mail-io1-xd41.google.com [IPv6:2607:f8b0:4864:20::d41]) (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 224B88180B for ; Mon, 27 Jan 2020 06:09:45 +0100 (CET) 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-io1-xd41.google.com with SMTP id n11so8554231iom.9 for ; Sun, 26 Jan 2020 21:09:45 -0800 (PST) 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=oUAGBLrGd77h/osOkTR0xjkfvLcYkH4jVKBo/rCUlyc=; b=KBHNjfMHox451FcBu7zqGJXcOkqo8KPo29VHYJDrQhkv2L0cGBLGA8o9ExICx7she9 BawR8ihi9nhmJyfb8tHCQKpdtn+0w86d8E32GfMqCdbdlAnAlpY1Gw/qKwdnAvIeV3a1 wjNuQ9Yo7hYHJ40rrWtf9vM9UMSQKh97XxeGY= 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=oUAGBLrGd77h/osOkTR0xjkfvLcYkH4jVKBo/rCUlyc=; b=EtfA52xsP+9Pc8xd5YICdQJmzXK9btF0Hh38e4F7iyIlaOtt9yDv4KwXMkSARiMX+X JMk1Ck/9xpoq+z2qqdHe+hngX5PGcATncNFHPaJiIqJ9VRwE+sOvYH48R9iCknh0ICD3 wHTUgpdIjvLsuz2jAk4za7khcQTCCcN9o7zFA8IA8+6U4uMen/LxEN4p7RPh1W31GAnC 8g1Uz1fRMKCSBekYTA43BqJ9Wwv/pXWrZEuYvU10y3YZOkQcArNAIyJMyzNQ+YNRkgVR NVqh9dXGcbyTw5sRz5WOVElF4cKdT3HY/EMxxZ/Q8xwHcV7S+DojF96H8V0J0ptoYtMJ psxg== X-Gm-Message-State: APjAAAV03iD+WjqTdhpQX8GCEmU70OTWon8eMtHs8fnJNURNPZn9mo33 1A0c5kqPBSkIOH4Orsx2K/tFgfZptIo3gQ== X-Google-Smtp-Source: APXvYqxRkcCxWGHXTzr0kgbHEg5KKu8YkAVkPxFQorNSh/3amblEIsjww5bS2NsTFbIu5wBS25zE9w== X-Received: by 2002:a02:c942:: with SMTP id u2mr12219505jao.49.1580101783837; Sun, 26 Jan 2020 21:09:43 -0800 (PST) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id h23sm4313195ilf.57.2020.01.26.21.09.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Jan 2020 21:09:43 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Subject: [PATCH 100/108] x86: Add a way to add to the e820 memory table Date: Sun, 26 Jan 2020 22:06:47 -0700 Message-Id: <20200126220508.100.I76d2863227979dc3dd80af26759ff2ef51dc5553@changeid> X-Mailer: git-send-email 2.25.0.341.g760bfbb309-goog In-Reply-To: <20200127050655.170614-1-sjg@chromium.org> References: <20200127050655.170614-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.26 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.101.4 at phobos.denx.de X-Virus-Status: Clean Some boards want to reserve extra regions of memory. Add a 'chosen' property to support this. Signed-off-by: Simon Glass --- arch/x86/lib/fsp/fsp_dram.c | 16 ++++++++++++++++ doc/device-tree-bindings/chosen.txt | 18 ++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/arch/x86/lib/fsp/fsp_dram.c b/arch/x86/lib/fsp/fsp_dram.c index 15e82de2fe..ec391e29e7 100644 --- a/arch/x86/lib/fsp/fsp_dram.c +++ b/arch/x86/lib/fsp/fsp_dram.c @@ -11,6 +11,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -91,6 +92,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; @@ -127,6 +130,19 @@ unsigned int install_e820_map(unsigned int max_entries, entries[num_entries].type = E820_RESERVED; num_entries++; #endif + prop = ofnode_get_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 d4dfc05847..e5ba6720ce 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>; +};