Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/stand/efiboot add basic raidframe support to efiboot.
details: https://anonhg.NetBSD.org/src/rev/235f6a46c7a3
branches: trunk
changeset: 379286:235f6a46c7a3
user: mrg <mrg%NetBSD.org@localhost>
date: Wed May 26 09:42:36 2021 +0000
description:
add basic raidframe support to efiboot.
if raid disklabel or gpt is found, add this partition with
the offset/size adjusted by RF_PROTECTED_SECTORS. note
don't le32toh() the disklabel. if it was wrong-endian, then
getdisklabel() will have swapped it.
ok jmcneill thorpej.
diffstat:
sys/stand/efiboot/efiblock.c | 21 ++++++++++++++++++---
sys/stand/efiboot/version | 3 ++-
2 files changed, 20 insertions(+), 4 deletions(-)
diffs (77 lines):
diff -r 52a029047ed6 -r 235f6a46c7a3 sys/stand/efiboot/efiblock.c
--- a/sys/stand/efiboot/efiblock.c Wed May 26 08:23:18 2021 +0000
+++ b/sys/stand/efiboot/efiblock.c Wed May 26 09:42:36 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: efiblock.c,v 1.10 2020/11/28 15:24:05 jmcneill Exp $ */
+/* $NetBSD: efiblock.c,v 1.11 2021/05/26 09:42:36 mrg Exp $ */
/*-
* Copyright (c) 2016 Kimihiro Nonaka <nonaka%netbsd.org@localhost>
@@ -38,6 +38,13 @@
#include "efiboot.h"
#include "efiblock.h"
+/*
+ * The raidframe support is basic. Ideally, it should be expanded to
+ * consider raid volumes a first-class citizen like the x86 efiboot does,
+ * but for now, we simply assume each RAID is potentially bootable.
+ */
+#define RF_PROTECTED_SECTORS 64 /* XXX refer to <.../rf_optnames.h> */
+
static EFI_HANDLE *efi_block;
static UINTN efi_nblock;
static struct efi_block_part *efi_block_booted = NULL;
@@ -217,6 +224,10 @@ efi_block_find_partitions_disklabel(stru
case FS_MSDOS:
case FS_BSDLFS:
break;
+ case FS_RAID:
+ p->p_size -= RF_PROTECTED_SECTORS;
+ p->p_offset += RF_PROTECTED_SECTORS;
+ break;
default:
continue;
}
@@ -225,7 +236,7 @@ efi_block_find_partitions_disklabel(stru
bpart->index = n;
bpart->bdev = bdev;
bpart->type = EFI_BLOCK_PART_DISKLABEL;
- bpart->disklabel.secsize = le32toh(d.d_secsize);
+ bpart->disklabel.secsize = d.d_secsize;
bpart->disklabel.part = *p;
efi_block_generate_hash_mbr(bpart, mbr);
TAILQ_INSERT_TAIL(&bdev->partitions, bpart, entries);
@@ -310,6 +321,10 @@ efi_block_find_partitions_gpt_entry(stru
bpart->type = EFI_BLOCK_PART_GPT;
bpart->gpt.fstype = fstype;
bpart->gpt.ent = *ent;
+ if (fstype == FS_RAID) {
+ bpart->gpt.ent.ent_lba_start += RF_PROTECTED_SECTORS;
+ bpart->gpt.ent.ent_lba_end -= RF_PROTECTED_SECTORS;
+ }
memcpy(bpart->hash, ent->ent_guid, sizeof(bpart->hash));
TAILQ_INSERT_TAIL(&bdev->partitions, bpart, entries);
@@ -436,7 +451,7 @@ efi_block_probe(void)
fstype = FS_ISO9660;
break;
}
- if (fstype == FS_BSDFFS || fstype == FS_ISO9660) {
+ if (fstype == FS_BSDFFS || fstype == FS_ISO9660 || fstype == FS_RAID) {
char devname[9];
snprintf(devname, sizeof(devname), "hd%u%c", bdev->index, bpart->index + 'a');
set_default_device(devname);
diff -r 52a029047ed6 -r 235f6a46c7a3 sys/stand/efiboot/version
--- a/sys/stand/efiboot/version Wed May 26 08:23:18 2021 +0000
+++ b/sys/stand/efiboot/version Wed May 26 09:42:36 2021 +0000
@@ -1,4 +1,4 @@
-$NetBSD: version,v 1.23 2021/05/21 21:53:15 jmcneill Exp $
+$NetBSD: version,v 1.24 2021/05/26 09:42:36 mrg Exp $
NOTE ANY CHANGES YOU MAKE TO THE EFI BOOTLOADER HERE. The format of this
file is important - make sure the entries are appended on end, last item
@@ -27,3 +27,4 @@ 2.3: EFI RT and GOP support for devicetr
2.4: Add ISO9660 support.
2.5: Recognize the EFI system partion as fstype MSDOS.
2.6: Disable ACPI support when booting big endian kernels.
+2.7: Add basic support for booting from RAID1 volumes.
Home |
Main Index |
Thread Index |
Old Index