Module Name: src
Committed By: martin
Date: Sun Jan 14 15:46:00 UTC 2024
Modified Files:
src/sys/arch/i386/stand/efiboot [netbsd-10]: efidisk.c efidisk.h
src/sys/arch/i386/stand/lib [netbsd-10]: biosdisk.c exec.c
Log Message:
Pull up following revision(s) (requested by mlelstv in ticket #548):
sys/arch/i386/stand/efiboot/efidisk.h: revision 1.4
sys/arch/i386/stand/lib/exec.c: revision 1.80
sys/arch/i386/stand/efiboot/efidisk.c: revision 1.11
sys/arch/i386/stand/lib/biosdisk.c: revision 1.61
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.9.26.1 -r1.9.26.2 src/sys/arch/i386/stand/efiboot/efidisk.c
cvs rdiff -u -r1.3 -r1.3.32.1 src/sys/arch/i386/stand/efiboot/efidisk.h
cvs rdiff -u -r1.58.4.1 -r1.58.4.2 src/sys/arch/i386/stand/lib/biosdisk.c
cvs rdiff -u -r1.78.4.1 -r1.78.4.2 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.9.26.1 src/sys/arch/i386/stand/efiboot/efidisk.c:1.9.26.2
--- src/sys/arch/i386/stand/efiboot/efidisk.c:1.9.26.1 Fri Nov 3 10:01:13 2023
+++ src/sys/arch/i386/stand/efiboot/efidisk.c Sun Jan 14 15:46:00 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: efidisk.c,v 1.9.26.1 2023/11/03 10:01:13 martin Exp $ */
+/* $NetBSD: efidisk.c,v 1.9.26.2 2024/01/14 15:46:00 martin Exp $ */
/*-
* Copyright (c) 2016 Kimihiro Nonaka <[email protected]>
@@ -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.3.32.1
--- 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 Sun Jan 14 15:46:00 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: efidisk.h,v 1.3 2018/04/02 09:44:18 nonaka Exp $ */
+/* $NetBSD: efidisk.h,v 1.3.32.1 2024/01/14 15:46:00 martin Exp $ */
/*-
* Copyright (c) 2016 Kimihiro Nonaka <[email protected]>
@@ -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.58.4.1 src/sys/arch/i386/stand/lib/biosdisk.c:1.58.4.2
--- src/sys/arch/i386/stand/lib/biosdisk.c:1.58.4.1 Wed Oct 18 11:44:22 2023
+++ src/sys/arch/i386/stand/lib/biosdisk.c Sun Jan 14 15:46:00 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: biosdisk.c,v 1.58.4.1 2023/10/18 11:44:22 martin Exp $ */
+/* $NetBSD: biosdisk.c,v 1.58.4.2 2024/01/14 15:46:00 martin 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.78.4.1 src/sys/arch/i386/stand/lib/exec.c:1.78.4.2
--- src/sys/arch/i386/stand/lib/exec.c:1.78.4.1 Sat May 13 13:26:57 2023
+++ src/sys/arch/i386/stand/lib/exec.c Sun Jan 14 15:46:00 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: exec.c,v 1.78.4.1 2023/05/13 13:26:57 martin Exp $ */
+/* $NetBSD: exec.c,v 1.78.4.2 2024/01/14 15:46:00 martin 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 */