Module Name: src Committed By: mlelstv Date: Sat Jan 6 21:26:43 UTC 2024
Modified Files: src/sys/arch/i386/stand/efiboot: efidisk.c efidisk.h src/sys/arch/i386/stand/lib: biosdisk.c exec.c Log Message: In efiboot - create bootinfo information only once. - add fake biosgeom entries so that the kernel can distinguish between hard drives (with geom) and CD-ROM (without). To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/arch/i386/stand/efiboot/efidisk.c cvs rdiff -u -r1.3 -r1.4 src/sys/arch/i386/stand/efiboot/efidisk.h cvs rdiff -u -r1.60 -r1.61 src/sys/arch/i386/stand/lib/biosdisk.c cvs rdiff -u -r1.79 -r1.80 src/sys/arch/i386/stand/lib/exec.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/i386/stand/efiboot/efidisk.c diff -u src/sys/arch/i386/stand/efiboot/efidisk.c:1.10 src/sys/arch/i386/stand/efiboot/efidisk.c:1.11 --- src/sys/arch/i386/stand/efiboot/efidisk.c:1.10 Sun May 14 09:07:54 2023 +++ src/sys/arch/i386/stand/efiboot/efidisk.c Sat Jan 6 21:26:43 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: efidisk.c,v 1.10 2023/05/14 09:07:54 riastradh Exp $ */ +/* $NetBSD: efidisk.c,v 1.11 2024/01/06 21:26:43 mlelstv Exp $ */ /*- * Copyright (c) 2016 Kimihiro Nonaka <non...@netbsd.org> @@ -38,9 +38,12 @@ #include "biosdisk_ll.h" #include "devopen.h" #include "efidisk.h" +#include "bootinfo.h" static struct efidiskinfo_lh efi_disklist; static int nefidisks; +static struct btinfo_biosgeom *bibg; +static size_t bibg_len; #define MAXDEVNAME 39 /* "NAME=" + 34 char part_name */ @@ -158,6 +161,23 @@ next: if (edi->bootdev) boot_biosdev = edi->dev; } + + bibg_len = sizeof(*bibg) + nefidisks * sizeof(struct bi_biosgeom_entry); + bibg = alloc(bibg_len); + if (bibg == NULL) + return; + + bibg->num = nefidisks; + + i = 0; + TAILQ_FOREACH(edi, &efi_disklist, list) { + if (edi->type == BIOSDISK_TYPE_HD) { + memset(&bibg->disk[i], 0, sizeof(bibg->disk[i])); + bibg->disk[i].dev = edi->dev; + bibg->disk[i].flags = BI_GEOM_INVALID; + } + ++i; + } } static void @@ -383,3 +403,10 @@ efidisk_get_efi_system_partition(int dev *partition = i; return 0; } + +void +efidisk_getbiosgeom() +{ + BI_ADD(bibg, BTINFO_BIOSGEOM, bibg_len); +} + Index: src/sys/arch/i386/stand/efiboot/efidisk.h diff -u src/sys/arch/i386/stand/efiboot/efidisk.h:1.3 src/sys/arch/i386/stand/efiboot/efidisk.h:1.4 --- src/sys/arch/i386/stand/efiboot/efidisk.h:1.3 Mon Apr 2 09:44:18 2018 +++ src/sys/arch/i386/stand/efiboot/efidisk.h Sat Jan 6 21:26:43 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: efidisk.h,v 1.3 2018/04/02 09:44:18 nonaka Exp $ */ +/* $NetBSD: efidisk.h,v 1.4 2024/01/06 21:26:43 mlelstv Exp $ */ /*- * Copyright (c) 2016 Kimihiro Nonaka <non...@netbsd.org> @@ -41,3 +41,4 @@ TAILQ_HEAD(efidiskinfo_lh, efidiskinfo); const struct efidiskinfo *efidisk_getinfo(int); int efidisk_get_efi_system_partition(int, int *); +void efidisk_getbiosgeom(void); Index: src/sys/arch/i386/stand/lib/biosdisk.c diff -u src/sys/arch/i386/stand/lib/biosdisk.c:1.60 src/sys/arch/i386/stand/lib/biosdisk.c:1.61 --- src/sys/arch/i386/stand/lib/biosdisk.c:1.60 Mon Oct 2 00:02:33 2023 +++ src/sys/arch/i386/stand/lib/biosdisk.c Sat Jan 6 21:26:43 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: biosdisk.c,v 1.60 2023/10/02 00:02:33 manu Exp $ */ +/* $NetBSD: biosdisk.c,v 1.61 2024/01/06 21:26:43 mlelstv Exp $ */ /* * Copyright (c) 1996, 1998 @@ -1198,11 +1198,13 @@ out: static void add_biosdisk_bootinfo(void) { +#ifndef EFIBOOT if (bootinfo == NULL) { return; } BI_ADD(&bi_disk, BTINFO_BOOTDISK, sizeof(bi_disk)); BI_ADD(&bi_wedge, BTINFO_BOOTWEDGE, sizeof(bi_wedge)); +#endif return; } #endif Index: src/sys/arch/i386/stand/lib/exec.c diff -u src/sys/arch/i386/stand/lib/exec.c:1.79 src/sys/arch/i386/stand/lib/exec.c:1.80 --- src/sys/arch/i386/stand/lib/exec.c:1.79 Thu Apr 20 00:42:24 2023 +++ src/sys/arch/i386/stand/lib/exec.c Sat Jan 6 21:26:43 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: exec.c,v 1.79 2023/04/20 00:42:24 manu Exp $ */ +/* $NetBSD: exec.c,v 1.80 2024/01/06 21:26:43 mlelstv Exp $ */ /* * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -108,6 +108,8 @@ #endif #ifdef EFIBOOT #include "efiboot.h" +#include "biosdisk.h" +#include "efidisk.h" #undef DEBUG /* XXX */ #endif @@ -498,6 +500,10 @@ exec_netbsd(const char *file, physaddr_t goto out; } #ifdef EFIBOOT + BI_ADD(&bi_disk, BTINFO_BOOTDISK, sizeof(bi_disk)); + BI_ADD(&bi_wedge, BTINFO_BOOTWEDGE, sizeof(bi_wedge)); + efidisk_getbiosgeom(); + efi_load_start = marks[MARK_START]; /* adjust to the real load address */