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 CE259C001DE for ; Tue, 25 Jul 2023 21:38:47 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D8CE88686B; Tue, 25 Jul 2023 23:38:01 +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="b0TH6yJQ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0596F867D9; Tue, 25 Jul 2023 23:37:12 +0200 (CEST) Received: from mail-io1-xd2d.google.com (mail-io1-xd2d.google.com [IPv6:2607:f8b0:4864:20::d2d]) (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 F1179867EA for ; Tue, 25 Jul 2023 23:36:57 +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-io1-xd2d.google.com with SMTP id ca18e2360f4ac-77acb04309dso331195139f.2 for ; Tue, 25 Jul 2023 14:36:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1690321016; x=1690925816; 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=8XkZAHf8RBUtVHGhB6sV9s6OnfxYX3oGfVi2mCx24vA=; b=b0TH6yJQBoCP52wQpKIKpKaomCUaN++3rz00e6OVzIBLXiT+MnfUejZ1bkkEbRAWWT zFbBnOuVsq5obzb/VoBJdjMRq3xQWqQp9R6+jneJ6XUNAvt8zQWU4yftOCGb70dcN8Xr d4/IyPqBexXRlFCGI8+cQ911bWdDsFQ5lt91Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690321016; x=1690925816; 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=8XkZAHf8RBUtVHGhB6sV9s6OnfxYX3oGfVi2mCx24vA=; b=Em7/Upt+C69+jQsoTmtEgTo9UK+sJplNxeDLT95h32p0z+bwKVO2KcgOjlj+npBP2J 6fEzj9eqiPPFfIET70qkONkmDYDRnkMN4vepwI2xTUaWwUaaV4Egr4hJS5PDxhTl7Wqk +v72wIBffXQNZEMLXhUo9B4uXj3JBnG6ZbLlGx54JFd1+sJRiDsV6UrzSXWkC8t9wDMU nPXSEIsiaGgsSuvTBieRMjJNk6FVaPsDYXV4zike3KDJIZwATQUupy0IMXd6ltXuhr0m JIS9aBBGEWcyXvwQA71K+iIL2nPsJkqm1OQppEB+59+D1qVM/FdtYxfaCTGv6bM1RT5y mJlw== X-Gm-Message-State: ABy/qLZMJjPfPnBFG3EQOqe9hDGdFo+xmxRBHv+zwSASHaVh5k4oGWIl jO1hDJEQ+l4ebx1OW15N2+4AzCsLKw+WQEXvxgM= X-Google-Smtp-Source: APBJJlHjV1OdubY0X2uRwdA/3bTzYMIGjuHI1reNVkeRbIeVww8wqO8fVE2zCRvdqf9FVXFbJ+aoHg== X-Received: by 2002:a6b:a12:0:b0:780:c787:637b with SMTP id z18-20020a6b0a12000000b00780c787637bmr179023ioi.0.1690321016524; Tue, 25 Jul 2023 14:36:56 -0700 (PDT) Received: from kea.bld.corp.google.com ([2620:15c:183:200:ce78:3dad:1309:8d43]) by smtp.gmail.com with ESMTPSA id ep18-20020a0566384e1200b0042b2d43ee3fsm3891987jab.82.2023.07.25.14.36.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jul 2023 14:36:56 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Ilias Apalodimas , Tom Rini , Julius Werner , Dan Handley , Jose Marinho , Simon Glass , Bin Meng , Nikhil M Jain Subject: [PATCH 12/14] bloblist: Reduce bloblist header size Date: Tue, 25 Jul 2023 15:36:24 -0600 Message-ID: <20230725213634.255345-13-sjg@chromium.org> X-Mailer: git-send-email 2.41.0.487.g6d72f3e995-goog In-Reply-To: <20230725213634.255345-1-sjg@chromium.org> References: <20230725213634.255345-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 The v0.9 spec provides for a 16-byte header with fewer fields. Update the implementation to match this. This also adds an alignment field. Signed-off-by: Simon Glass --- include/bloblist.h | 26 +++++++++++++------------- test/bloblist.c | 6 +++--- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/include/bloblist.h b/include/bloblist.h index d1e52cf888f..13b619cd019 100644 --- a/include/bloblist.h +++ b/include/bloblist.h @@ -150,30 +150,30 @@ enum bloblist_tag_t { * from the last. * * @magic: BLOBLIST_MAGIC + * @chksum: checksum for the entire bloblist allocated area. Since any of the + * blobs can be altered after being created, this checksum is only valid + * when the bloblist is finalised before jumping to the next stage of boot. + * This is the value needed to make all chechksummed bytes sum to 0 * @version: BLOBLIST_VERSION * @hdr_size: Size of this header, normally sizeof(struct bloblist_hdr). The * first bloblist_rec starts at this offset from the start of the header - * @size: Total size of the bloblist (non-zero if valid) including this header. - * The bloblist extends for this many bytes from the start of this header. - * When adding new records, the bloblist can grow up to this size. + * @align_log2: Power of two of the maximum alignment required by this list * @alloced: Total size allocated so far for this bloblist. This starts out as * sizeof(bloblist_hdr) since we need at least that much space to store a * valid bloblist - * @chksum: checksum for the entire bloblist allocated area. Since any of the - * blobs can be altered after being created, this checksum is only valid - * when the bloblist is finalised before jumping to the next stage of boot. - * This is the value needed to make all checksummed bytes sum to 0 + * @size: Total size of the bloblist (non-zero if valid) including this header. + * The bloblist extends for this many bytes from the start of this header. + * When adding new records, the bloblist can grow up to this size. */ struct bloblist_hdr { u32 magic; - u32 version; - u32 hdr_size; - u32 _flags; + u8 chksum; + u8 version; + u8 hdr_size; + u8 align_log2; - u32 size; u32 alloced; - u32 _spare; - u32 chksum; + u32 size; }; /** diff --git a/test/bloblist.c b/test/bloblist.c index c1719c2e384..5801160621a 100644 --- a/test/bloblist.c +++ b/test/bloblist.c @@ -78,7 +78,7 @@ static int bloblist_test_init(struct unit_test_state *uts) ut_asserteq(-EPROTONOSUPPORT, bloblist_check(TEST_ADDR, TEST_BLOBLIST_SIZE)); - ut_asserteq(-ENOSPC, bloblist_new(TEST_ADDR, 0x10)); + ut_asserteq(-ENOSPC, bloblist_new(TEST_ADDR, 0xc)); ut_asserteq(-EFAULT, bloblist_new(1, TEST_BLOBLIST_SIZE)); ut_assertok(bloblist_new(TEST_ADDR, TEST_BLOBLIST_SIZE)); @@ -261,8 +261,8 @@ static int bloblist_test_cmd_info(struct unit_test_state *uts) run_command("bloblist info", 0); ut_assert_nextline("base: %lx", (ulong)map_to_sysmem(hdr)); ut_assert_nextline("size: 400 1 KiB"); - ut_assert_nextline("alloced: 58 88 Bytes"); - ut_assert_nextline("free: 3a8 936 Bytes"); + ut_assert_nextline("alloced: 48 72 Bytes"); + ut_assert_nextline("free: 3b8 952 Bytes"); ut_assert_console_end(); ut_unsilence_console(uts); -- 2.41.0.487.g6d72f3e995-goog