summaryrefslogtreecommitdiff
path: root/sys/arch/armv7
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2023-10-26 14:08:49 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2023-10-26 14:08:49 +0000
commit7585f7c7763a24116db91a8ee53840501868ee76 (patch)
treefd778cd96a0ccb91d2a1135d8288f0593922ea61 /sys/arch/armv7
parent078f6f300e4b96bd08ea1bc819b3a12c334859cb (diff)
make efi_getdisklabel_cd9660() handle a block size of 512 and simplify
ok yasuoka@
Diffstat (limited to 'sys/arch/armv7')
-rw-r--r--sys/arch/armv7/stand/efiboot/efidev.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/sys/arch/armv7/stand/efiboot/efidev.c b/sys/arch/armv7/stand/efiboot/efidev.c
index ca1b7090026..137e6592910 100644
--- a/sys/arch/armv7/stand/efiboot/efidev.c
+++ b/sys/arch/armv7/stand/efiboot/efidev.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: efidev.c,v 1.10 2022/09/01 13:45:26 krw Exp $ */
+/* $OpenBSD: efidev.c,v 1.11 2023/10/26 14:08:48 jsg Exp $ */
/*
* Copyright (c) 2015 YASUOKA Masahiko <yasuoka@yasuoka.net>
@@ -444,23 +444,14 @@ efi_getdisklabel(efi_diskinfo_t ed, struct disklabel *label)
static int
efi_getdisklabel_cd9660(efi_diskinfo_t ed, struct disklabel *label)
{
- int off;
uint8_t buf[DEV_BSIZE];
EFI_STATUS status;
- for (off = 0; off < 100; off++) {
- status = efid_io(F_READ, ed,
- EFI_BLKSPERSEC(ed) * (16 + off), 1, buf);
- if (EFI_ERROR(status))
- return (-1);
- if (bcmp(buf + 1, ISO_STANDARD_ID, 5) != 0 ||
- buf[0] == ISO_VD_END)
- return (-1);
- if (buf[0] == ISO_VD_PRIMARY)
- break;
- }
- if (off >= 100)
- return (-1);
+ status = efid_io(F_READ, ed, 64, 1, buf);
+ if (EFI_ERROR(status))
+ return -1;
+ if (buf[0] != ISO_VD_PRIMARY || bcmp(buf + 1, ISO_STANDARD_ID, 5) != 0)
+ return -1;
/* Create an imaginary disk label */
label->d_secsize = 2048;