summaryrefslogtreecommitdiff
path: root/sys/arch/amd64
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/amd64
parent078f6f300e4b96bd08ea1bc819b3a12c334859cb (diff)
make efi_getdisklabel_cd9660() handle a block size of 512 and simplify
ok yasuoka@
Diffstat (limited to 'sys/arch/amd64')
-rw-r--r--sys/arch/amd64/stand/efiboot/efidev.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/sys/arch/amd64/stand/efiboot/efidev.c b/sys/arch/amd64/stand/efiboot/efidev.c
index 191113670bc..550ad12a0ae 100644
--- a/sys/arch/amd64/stand/efiboot/efidev.c
+++ b/sys/arch/amd64/stand/efiboot/efidev.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: efidev.c,v 1.41 2023/04/25 10:11:20 kn Exp $ */
+/* $OpenBSD: efidev.c,v 1.42 2023/10/26 14:08:48 jsg Exp $ */
/*
* Copyright (c) 1996 Michael Shalayeff
@@ -454,23 +454,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;