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 2B28FC433F5 for ; Thu, 13 Jan 2022 02:28:21 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5D75A8354B; Thu, 13 Jan 2022 03:27:17 +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=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="OZrYNbfH"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E4996831E9; Thu, 13 Jan 2022 03:27:02 +0100 (CET) Received: from mail-il1-x12a.google.com (mail-il1-x12a.google.com [IPv6:2607:f8b0:4864:20::12a]) (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 8B68A83457 for ; Thu, 13 Jan 2022 03:26:57 +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-il1-x12a.google.com with SMTP id u5so25017ilq.9 for ; Wed, 12 Jan 2022 18:26:57 -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=2kzGvHEDzpkFfexVZMcP8tlBDKqCyxC7SOb/GH5a9wM=; b=OZrYNbfHxlHKHxjToiOGBUZAQ6OBVsQQAknOSPFkDnmv/EcZOROd0N1arGkTmVtaiP 1QnoiMuxCx48xO45XJx318g/3fgKPN22xUS2JSD1Q8aUcgBM3u+4HAz25/XYfWSn+iil vCgp3BSI3PQlvD+H/AJ/AHlkLqpKC7pAMKdNo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2kzGvHEDzpkFfexVZMcP8tlBDKqCyxC7SOb/GH5a9wM=; b=mS6nqIBEONxolAlB5Q82o9CB2O99e4PTCS1kO9xAmqndVzTGBzhpsFBFw66Vpsopwd e65knaLlXowcxSmP6WWtsGFCUhNkNfzpTedPivKZM7Tormw1vSQ+bqgjdBxHkj+5fN7b t0T9iMBf4LDEex2LLsHkXObUx+Qz2Lq0z0CXWwSoioXN9IlPjFERSlgv0qgBurmKpqW2 1JTkPA0TiiajSLCPUt28cewFrV4aXdxn4uZOSHKU0A5FKYMjRL0X0SzhsrUBmEDxByzk ERy8IOT2BHxflIZAw8ocU8+j8+dj+8rPNnIntDHjj7H1FiXiF8Zi5nVBtLsbyze6qIz8 6qng== X-Gm-Message-State: AOAM530eLNKoRy0lBLvr7jwvaKndisK+kG7C+rMkHvku+b8nyNHvXUsI P/b1i9iRObiJi5ILekcV/qBx+ysE1hmmIg== X-Google-Smtp-Source: ABdhPJzs1Xolqkb/OsaP3bYeQq9sKbi5NP8FCZKvb4vzOMosSFHVYKM6xx7k2BKHpcAbDJmQAZs5ew== X-Received: by 2002:a92:cd87:: with SMTP id r7mr1370713ilb.182.1642040816109; Wed, 12 Jan 2022 18:26:56 -0800 (PST) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id e17sm965634ili.37.2022.01.12.18.26.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jan 2022 18:26:55 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass Subject: [PATCH v2 10/12] bloblist: Add functions to obtain base address and size Date: Wed, 12 Jan 2022 19:26:23 -0700 Message-Id: <20220113022625.413990-11-sjg@chromium.org> X-Mailer: git-send-email 2.34.1.575.g55b058a8bb-goog In-Reply-To: <20220113022625.413990-1-sjg@chromium.org> References: <20220113022625.413990-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.2 at phobos.denx.de X-Virus-Status: Clean Add a few convenience functions to obtain useful information about the bloblist. Signed-off-by: Simon Glass --- (no changes since v1) common/bloblist.c | 12 ++++++++++++ include/bloblist.h | 14 ++++++++++++++ test/bloblist.c | 2 ++ 3 files changed, 28 insertions(+) diff --git a/common/bloblist.c b/common/bloblist.c index 0049bb9a395..1ed9172d897 100644 --- a/common/bloblist.c +++ b/common/bloblist.c @@ -367,6 +367,18 @@ int bloblist_finish(void) return 0; } +ulong bloblist_get_base(void) +{ + return map_to_sysmem(gd->bloblist); +} + +ulong bloblist_get_size(void) +{ + struct bloblist_hdr *hdr = gd->bloblist; + + return hdr->size; +} + void bloblist_get_stats(ulong *basep, ulong *sizep, ulong *allocedp) { struct bloblist_hdr *hdr = gd->bloblist; diff --git a/include/bloblist.h b/include/bloblist.h index 13f2b3f1009..d9e108d8618 100644 --- a/include/bloblist.h +++ b/include/bloblist.h @@ -302,6 +302,20 @@ int bloblist_finish(void); */ void bloblist_get_stats(ulong *basep, ulong *sizep, ulong *allocedp); +/** + * bloblist_get_base() - Get the base address of the bloblist + * + * @returns base address of bloblist + */ +ulong bloblist_get_base(void); + +/** + * bloblist_get_size() - Get the size of the bloblist + * + * @returns the size in bytes + */ +ulong bloblist_get_size(void); + /** * bloblist_show_stats() - Show information about the bloblist * diff --git a/test/bloblist.c b/test/bloblist.c index c5788d5cd82..720be7e244f 100644 --- a/test/bloblist.c +++ b/test/bloblist.c @@ -107,6 +107,8 @@ static int bloblist_test_blob(struct unit_test_state *uts) hdr = clear_bloblist(); ut_assertnull(bloblist_find(TEST_TAG, TEST_BLOBLIST_SIZE)); ut_assertok(bloblist_new(TEST_ADDR, TEST_BLOBLIST_SIZE, 0)); + ut_asserteq(TEST_BLOBLIST_SIZE, bloblist_get_size()); + ut_asserteq(TEST_ADDR, bloblist_get_base()); ut_asserteq(map_to_sysmem(hdr), TEST_ADDR); /* Add a record and check that we can find it */ -- 2.34.1.575.g55b058a8bb-goog