U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Javier Martinez Canillas <javierm@redhat.com>
To: u-boot@lists.denx.de
Cc: eballetb@redhat.com, alexl@redhat.com,
	Javier Martinez Canillas <javierm@redhat.com>,
	Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Ilias Apalodimas <ilias.apalodimas@linaro.org>,
	Tom Rini <trini@konsulko.com>
Subject: [PATCH 5/5] efi_selftest: Enhance MBR test for PARTITION_INFO_PROTOCOL
Date: Tue, 20 Jan 2026 14:36:14 +0100	[thread overview]
Message-ID: <20260120133630.1695055-6-javierm@redhat.com> (raw)
In-Reply-To: <20260120133630.1695055-1-javierm@redhat.com>

The EFI_PARTITION_INFO_PROTOCOL test was added before the protocol fully
supported MBR partitions. As a result, it lacked specific checks for the
content of the raw MBR partition record.

Now that MBR support has been implemented, enhance the selftest to provide
coverage for the MBR entries too.

This verifies that the protocol correctly reads and exposes MBR partition
records and prevents this functionality to regress due future changes.

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---

 lib/efi_selftest/efi_selftest_block_device.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/lib/efi_selftest/efi_selftest_block_device.c b/lib/efi_selftest/efi_selftest_block_device.c
index f145e58a267a..50d1fb29e1ef 100644
--- a/lib/efi_selftest/efi_selftest_block_device.c
+++ b/lib/efi_selftest/efi_selftest_block_device.c
@@ -404,6 +404,18 @@ static int execute(void)
 			     part_info->system);
 		return EFI_ST_FAILURE;
 	}
+	/* The first partition starts at LBA 1 on the test image */
+	if (part_info->info.mbr.start_sect != 1) {
+		efi_st_error("MBR start sector %d, expected 1\n",
+			     part_info->info.mbr.start_sect);
+		return EFI_ST_FAILURE;
+	}
+	/* The partition type is FAT12 (0x01) in the test image */
+	if (part_info->info.mbr.sys_ind != 0x01) {
+		efi_st_error("MBR system indicator %d, expected 1\n",
+			     part_info->info.mbr.sys_ind);
+		return EFI_ST_FAILURE;
+	}
 
 	/* Open the simple file system protocol */
 	ret = boottime->open_protocol(handle_partition,
-- 
2.52.0


  parent reply	other threads:[~2026-01-20 13:37 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-20 13:36 [PATCH 0/5] efi_loader: disk: Add EFI_PARTITION_INFO_PROTOCOL support for MBR Javier Martinez Canillas
2026-01-20 13:36 ` [PATCH 1/5] disk: part_dos: Move header to the main include directory Javier Martinez Canillas
2026-01-20 14:34   ` Tom Rini
2026-01-20 13:36 ` [PATCH 2/5] disk: part_dos: Align dos_partition_t with struct partition Javier Martinez Canillas
2026-01-20 14:35   ` Tom Rini
2026-01-20 13:36 ` [PATCH 3/5] disk: part_efi: Remove redundant struct partition definition Javier Martinez Canillas
2026-01-20 14:37   ` Tom Rini
2026-01-20 13:36 ` [PATCH 4/5] efi_loader: disk: Extend EFI_PARTITION_INFO_PROTOCOL to support MBR Javier Martinez Canillas
2026-01-20 14:53   ` Heinrich Schuchardt
2026-01-21  9:25     ` Javier Martinez Canillas
2026-01-20 17:39   ` Jan Kiszka
2026-01-21  9:28     ` Javier Martinez Canillas
2026-01-22  8:54       ` Jan Kiszka
2026-01-20 13:36 ` Javier Martinez Canillas [this message]
2026-01-20 14:56   ` [PATCH 5/5] efi_selftest: Enhance MBR test for PARTITION_INFO_PROTOCOL Heinrich Schuchardt
2026-01-21  9:28     ` Javier Martinez Canillas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260120133630.1695055-6-javierm@redhat.com \
    --to=javierm@redhat.com \
    --cc=alexl@redhat.com \
    --cc=eballetb@redhat.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox