CVS commit: src/sys/arch/i386/conf

2024-05-13 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Mon May 13 21:50:47 UTC 2024

Modified Files:
src/sys/arch/i386/conf: LEGACY

Log Message:
also exclude DRM_LEGACY from the ISA kernel


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/i386/conf/LEGACY

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/conf/LEGACY
diff -u src/sys/arch/i386/conf/LEGACY:1.3 src/sys/arch/i386/conf/LEGACY:1.4
--- src/sys/arch/i386/conf/LEGACY:1.3	Sun Apr 28 08:12:44 2024
+++ src/sys/arch/i386/conf/LEGACY	Mon May 13 21:50:47 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: LEGACY,v 1.3 2024/04/28 08:12:44 nia Exp $
+#	$NetBSD: LEGACY,v 1.4 2024/05/13 21:50:47 nia Exp $
 
 # LEGACY kernel -- includes vga@isa and pcdisplay@isa for pre-PCI
 # systems, due to significant pain making them fail to attach when
@@ -24,3 +24,5 @@ no radeondrmkmsfb*	at radeonfbbus?  
 
 no nouveau*		at pci?
 no nouveaufb*		at nouveaufbbus?
+
+no options		DRM_LEGACY



CVS commit: src/sys/arch/i386/conf

2024-05-13 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Mon May 13 21:50:47 UTC 2024

Modified Files:
src/sys/arch/i386/conf: LEGACY

Log Message:
also exclude DRM_LEGACY from the ISA kernel


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/i386/conf/LEGACY

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/eisa

2024-05-01 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Wed May  1 16:28:33 UTC 2024

Modified Files:
src/sys/arch/i386/eisa: eisa_machdep.c

Log Message:
Make eisa_machdep build without NIOAPIC > 0 by extracting irq definition.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/i386/eisa/eisa_machdep.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/eisa/eisa_machdep.c
diff -u src/sys/arch/i386/eisa/eisa_machdep.c:1.41 src/sys/arch/i386/eisa/eisa_machdep.c:1.42
--- src/sys/arch/i386/eisa/eisa_machdep.c:1.41	Sat Jun 18 22:11:00 2022
+++ src/sys/arch/i386/eisa/eisa_machdep.c	Wed May  1 16:28:33 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: eisa_machdep.c,v 1.41 2022/06/18 22:11:00 andvar Exp $	*/
+/*	$NetBSD: eisa_machdep.c,v 1.42 2024/05/01 16:28:33 andvar Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: eisa_machdep.c,v 1.41 2022/06/18 22:11:00 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: eisa_machdep.c,v 1.42 2024/05/01 16:28:33 andvar Exp $");
 
 #include "ioapic.h"
 
@@ -160,7 +160,15 @@ const char *
 eisa_intr_string(eisa_chipset_tag_t ec, eisa_intr_handle_t ih, char *buf,
 size_t len)
 {
-	if (ih == 0 || APIC_IRQ_LEGACY_IRQ(ih) >= NUM_LEGACY_IRQS || ih == 2)
+	int irq; 
+	
+#if NIOAPIC > 0
+	irq = APIC_IRQ_LEGACY_IRQ(ih);
+#else
+	irq = (int) ih;
+#endif
+
+	if (ih == 0 || irq >= NUM_LEGACY_IRQS || ih == 2)
 		panic("eisa_intr_string: bogus handle 0x%" PRIx64, ih);
 
 #if NIOAPIC > 0
@@ -168,11 +176,11 @@ eisa_intr_string(eisa_chipset_tag_t ec, 
 		snprintf(buf, len, "apic %d int %d (irq %d)",
 		APIC_IRQ_APIC(ih),
 		APIC_IRQ_PIN(ih),
-		APIC_IRQ_LEGACY_IRQ(ih));
+		irq);
 	else
-		snprintf(buf, len, "irq %d",  APIC_IRQ_LEGACY_IRQ(ih));
+		snprintf(buf, len, "irq %d",  irq);
 #else
-	snprintf(buf, len, "irq %d", APIC_IRQ_LEGACY_IRQ(ih));
+	snprintf(buf, len, "irq %d", irq);
 #endif
 	return buf;
 }



CVS commit: src/sys/arch/i386/eisa

2024-05-01 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Wed May  1 16:28:33 UTC 2024

Modified Files:
src/sys/arch/i386/eisa: eisa_machdep.c

Log Message:
Make eisa_machdep build without NIOAPIC > 0 by extracting irq definition.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/i386/eisa/eisa_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/conf

2024-04-28 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Sun Apr 28 08:12:44 UTC 2024

Modified Files:
src/sys/arch/i386/conf: LEGACY

Log Message:
i386: disable DRMKMS drivers in LEGACY kernel (this is for ISA)


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/conf/LEGACY

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/conf

2024-04-28 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Sun Apr 28 08:12:44 UTC 2024

Modified Files:
src/sys/arch/i386/conf: LEGACY

Log Message:
i386: disable DRMKMS drivers in LEGACY kernel (this is for ISA)


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/conf/LEGACY

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/conf/LEGACY
diff -u src/sys/arch/i386/conf/LEGACY:1.2 src/sys/arch/i386/conf/LEGACY:1.3
--- src/sys/arch/i386/conf/LEGACY:1.2	Mon Jul 17 21:12:29 2023
+++ src/sys/arch/i386/conf/LEGACY	Sun Apr 28 08:12:44 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: LEGACY,v 1.2 2023/07/17 21:12:29 riastradh Exp $
+#	$NetBSD: LEGACY,v 1.3 2024/04/28 08:12:44 nia Exp $
 
 # LEGACY kernel -- includes vga@isa and pcdisplay@isa for pre-PCI
 # systems, due to significant pain making them fail to attach when
@@ -15,3 +15,12 @@ options 	ATA_DOWNGRADE_MODE
 
 # XXX we could turn off all sorts of other modern features in this
 # configuration, but that is left for future work.
+
+no i915drmkms*		at pci?
+no intelfb*		at intelfbbus?  
+
+no radeon*		at pci?
+no radeondrmkmsfb*	at radeonfbbus?
+
+no nouveau*		at pci?
+no nouveaufb*		at nouveaufbbus?



CVS commit: src/sys/arch/i386/i386

2024-04-22 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Mon Apr 22 22:47:00 UTC 2024

Modified Files:
src/sys/arch/i386/i386: i386_mainbus.c

Log Message:
Add (defined(MPBIOS) || NACPICA > 0) check around mp_pci_childdetached().
Fixes the build without MPBIOS or ACPI. Modified patch from Paolo Pisati in
current-users@.

While here:
Remove obsolete  include with its guard.
Add comments for multiple endifs for better readability.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/i386/i386/i386_mainbus.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/i386

2024-04-22 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Mon Apr 22 22:47:00 UTC 2024

Modified Files:
src/sys/arch/i386/i386: i386_mainbus.c

Log Message:
Add (defined(MPBIOS) || NACPICA > 0) check around mp_pci_childdetached().
Fixes the build without MPBIOS or ACPI. Modified patch from Paolo Pisati in
current-users@.

While here:
Remove obsolete  include with its guard.
Add comments for multiple endifs for better readability.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/i386/i386/i386_mainbus.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/i386/i386_mainbus.c
diff -u src/sys/arch/i386/i386/i386_mainbus.c:1.6 src/sys/arch/i386/i386/i386_mainbus.c:1.7
--- src/sys/arch/i386/i386/i386_mainbus.c:1.6	Sat Aug  7 16:18:55 2021
+++ src/sys/arch/i386/i386/i386_mainbus.c	Mon Apr 22 22:47:00 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: i386_mainbus.c,v 1.6 2021/08/07 16:18:55 thorpej Exp $	*/
+/*	$NetBSD: i386_mainbus.c,v 1.7 2024/04/22 22:47:00 andvar Exp $	*/
 /*	NetBSD: mainbus.c,v 1.104 2018/12/02 08:19:44 cherry Exp 	*/
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i386_mainbus.c,v 1.6 2021/08/07 16:18:55 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i386_mainbus.c,v 1.7 2024/04/22 22:47:00 andvar Exp $");
 
 #include 
 #include 
@@ -87,12 +87,9 @@ __KERNEL_RCSID(0, "$NetBSD: i386_mainbus
 #include 
 #if defined(PCI_ADDR_FIXUP)
 #include 
-#endif
-#endif
-#ifdef __HAVE_PCI_MSI_MSIX
-#include 
-#endif /* __HAVE_PCI_MSI_MSIX */
-#endif
+#endif /* PCI_ADDR_FIXUP */
+#endif /* PCI_BUS_FIXUP */
+#endif /* NPCI > 0 */
 
 void	i386_mainbus_childdetached(device_t, device_t);
 int	i386_mainbus_match(device_t, cfdata_t, void *);
@@ -178,7 +175,7 @@ i386_mainbus_childdetached(device_t self
 	if (sc->sc_pci == child)
 		sc->sc_pci = NULL;
 
-#if NPCI > 0
+#if NPCI > 0 && (defined(MPBIOS) || NACPICA > 0)
 	mp_pci_childdetached(self, child);
 #endif
 }



CVS commit: src/sys/arch/i386/stand

2024-01-06 Thread Michael van Elst
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 
@@ -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, _disklist, list) {
+		if (edi->type == BIOSDISK_TYPE_HD) {
+			memset(>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 
@@ -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(_disk, BTINFO_BOOTDISK, sizeof(bi_disk));
 	BI_ADD(_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(_disk, BTINFO_BOOTDISK, sizeof(bi_disk));
+	BI_ADD(_wedge, BTINFO_BOOTWEDGE, sizeof(bi_wedge));
+	efidisk_getbiosgeom();
+
 	efi_load_start = marks[MARK_START];
 
 	/* adjust to the real load address */



CVS commit: src/sys/arch/i386/stand

2024-01-06 Thread Michael van Elst
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.



CVS commit: src/sys/arch/i386/stand/libsa

2023-12-14 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Thu Dec 14 08:06:23 UTC 2023

Modified Files:
src/sys/arch/i386/stand/libsa: nfs.c

Log Message:
Align again with libsa (NFS_NOSYMLINK fix).


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/i386/stand/libsa/nfs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/stand/libsa

2023-12-14 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Thu Dec 14 08:06:23 UTC 2023

Modified Files:
src/sys/arch/i386/stand/libsa: nfs.c

Log Message:
Align again with libsa (NFS_NOSYMLINK fix).


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/i386/stand/libsa/nfs.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/libsa/nfs.c
diff -u src/sys/arch/i386/stand/libsa/nfs.c:1.20 src/sys/arch/i386/stand/libsa/nfs.c:1.21
--- src/sys/arch/i386/stand/libsa/nfs.c:1.20	Tue Dec 12 09:16:17 2023
+++ src/sys/arch/i386/stand/libsa/nfs.c	Thu Dec 14 08:06:23 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: nfs.c,v 1.20 2023/12/12 09:16:17 mlelstv Exp $	*/
+/*	$NetBSD: nfs.c,v 1.21 2023/12/14 08:06:23 mlelstv Exp $	*/
 
 /*-
  *  Copyright (c) 1993 John Brezak
@@ -597,9 +597,9 @@ nfs_open(const char *path, struct open_f
 	char namebuf[NFS_MAXPATHLEN + 1];
 	char linkbuf[NFS_MAXPATHLEN + 1];
 	int nlinks = 0;
+	n_long fa_type;
 #endif
 	int error = 0;
-	n_long fa_type;
 
 #ifdef NFS_DEBUG
  	if (debug)



CVS commit: src/sys/arch/i386/stand/libsa

2023-12-12 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Tue Dec 12 09:16:17 UTC 2023

Modified Files:
src/sys/arch/i386/stand/libsa: nfs.c

Log Message:
Merge with generic libsa NFS code to minimize differences and to learn NFSv3.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/i386/stand/libsa/nfs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/stand/libsa

2023-12-12 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Tue Dec 12 09:16:17 UTC 2023

Modified Files:
src/sys/arch/i386/stand/libsa: nfs.c

Log Message:
Merge with generic libsa NFS code to minimize differences and to learn NFSv3.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/i386/stand/libsa/nfs.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/libsa/nfs.c
diff -u src/sys/arch/i386/stand/libsa/nfs.c:1.19 src/sys/arch/i386/stand/libsa/nfs.c:1.20
--- src/sys/arch/i386/stand/libsa/nfs.c:1.19	Sun Dec 25 06:09:09 2011
+++ src/sys/arch/i386/stand/libsa/nfs.c	Tue Dec 12 09:16:17 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: nfs.c,v 1.19 2011/12/25 06:09:09 tsutsui Exp $	*/
+/*	$NetBSD: nfs.c,v 1.20 2023/12/12 09:16:17 mlelstv Exp $	*/
 
 /*-
  *  Copyright (c) 1993 John Brezak
@@ -28,6 +28,16 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+/*
+ * XXX Does not currently implement:
+ * XXX
+ * XXX LIBSA_NO_FS_CLOSE
+ * XXX LIBSA_NO_FS_SEEK
+ * XXX LIBSA_NO_FS_WRITE
+ * XXX LIBSA_NO_FS_SYMLINK (does this even make sense?)
+ * XXX LIBSA_FS_SINGLECOMPONENT (does this even make sense?)
+ */
+
 #include 
 #include 
 #include 
@@ -43,6 +53,7 @@
 
 #include "rpcv2.h"
 #include "nfsv2.h"
+#include "nfsv3.h"
 
 #include 
 #include "net.h"
@@ -50,40 +61,11 @@
 #include "nfs.h"
 #include "rpc.h"
 
-/* Define our own NFS attributes. */
-struct nfsv2_fattrs {
-	n_long	fa_type;
-	n_long	fa_mode;
-	n_long	fa_nlink;
-	n_long	fa_uid;
-	n_long	fa_gid;
-	n_long	fa_size;
-	n_long	fa_blocksize;
-	n_long	fa_rdev;
-	n_long	fa_blocks;
-	n_long	fa_fsid;
-	n_long	fa_fileid;
-	struct nfsv2_time fa_atime;
-	struct nfsv2_time fa_mtime;
-	struct nfsv2_time fa_ctime;
-};
-
-
-struct nfs_read_args {
-	u_char	fh[NFS_FHSIZE];
-	n_long	off;
-	n_long	len;
-	n_long	xxx;			/* XXX what's this for? */
-};
+/* Storage for any filehandle (including length for V3) */
+#define NFS_FHSTORE (NFS_FHSIZE < NFS_V3FHSIZE ? NFS_V3FHSIZE + 4: NFS_FHSIZE)
 
 /* Data part of nfs rpc reply (also the largest thing we receive) */
 #define NFSREAD_SIZE 1024
-struct nfs_read_repl {
-	n_long	errno;
-	struct	nfsv2_fattrs fa;
-	n_long	count;
-	u_char	data[NFSREAD_SIZE];
-};
 
 #ifndef NFS_NOSYMLINK
 struct nfs_readlnk_repl {
@@ -93,36 +75,88 @@ struct nfs_readlnk_repl {
 };
 #endif
 
+static inline uint64_t
+getnquad(n_long x[2]) {
+	return (uint64_t)ntohl(x[0]) << 32 | ntohl(x[1]);
+}
+
+static inline void
+setnquad(n_long x[2], uint64_t v)
+{
+	x[0] = htonl((n_long)(v >> 32));
+	x[1] = htonl((n_long)(v & 0x));
+}
+
 struct nfs_iodesc {
 	struct	iodesc	*iodesc;
 	off_t	off;
-	u_char	fh[NFS_FHSIZE];
-	struct nfsv2_fattrs fa;	/* all in network order */
+	int	version;
+	u_char	fh[NFS_FHSTORE];
+	union {
+		/* all in network order */
+		struct nfsv2_fattr v2;
+		struct nfsv3_fattr v3;
+	} u_fa;
 };
 
-int	nfs_getrootfh(struct iodesc *, char *, u_char *);
+static inline size_t
+fhstore(int version, u_char *fh)
+{
+	size_t len;
+
+	switch (version) {
+	case NFS_VER2:
+		len = NFS_FHSIZE;
+		break;
+	case NFS_VER3:
+		len = fh[0] << 24 | fh[1] << 16 | fh[2] << 8 | fh[3];
+		if (len > NFS_V3FHSIZE)
+			len = NFS_V3FHSIZE;
+		len = 4 + roundup(len, 4);
+		break;
+	default:
+		len = 0;
+		break;
+	}
+
+	return len;
+}
+
+static inline size_t
+fhcopy(int version, u_char *src, u_char *dst)
+{
+	size_t len = fhstore(version, src);
+	memcpy(dst, src, len);
+	return len;
+}
+
+#define setfh(d, s) fhcopy((d)->version, (s), (d)->fh)
+#define getfh(d, s) fhcopy((d)->version, (d)->fh, (s))
+
+
+struct nfs_iodesc nfs_root_node;
+
+int	nfs_getrootfh(struct iodesc *, char *, u_char *, int *);
 int	nfs_lookupfh(struct nfs_iodesc *, const char *, int,
 	struct nfs_iodesc *);
-#ifndef NFS_NOSYMLINK
 int	nfs_readlink(struct nfs_iodesc *, char *);
-#endif
 ssize_t	nfs_readdata(struct nfs_iodesc *, off_t, void *, size_t);
 
 /*
  * Fetch the root file handle (call mount daemon)
- * Return zero or error number.
+ * On error, return non-zero and set errno.
  */
 int
-nfs_getrootfh(struct iodesc *d, char *path, u_char *fhp)
+nfs_getrootfh(struct iodesc *d, char *path, u_char *fhp, int *versionp)
 {
-	size_t len;
+	int len;
 	struct args {
 		n_long	len;
 		char	path[FNAME_SIZE];
 	} *args;
 	struct repl {
 		n_long	errno;
-		u_char	fh[NFS_FHSIZE];
+		u_char	fh[NFS_FHSTORE];
 	} *repl;
 	struct {
 		n_long	h[RPC_HEADER_WORDS];
@@ -136,32 +170,42 @@ nfs_getrootfh(struct iodesc *d, char *pa
 
 #ifdef NFS_DEBUG
 	if (debug)
-		printf("nfs_getrootfh: %s\n", path);
+		printf("%s: %s\n", __func__, path);
 #endif
 
 	args = 
 	repl = 
 
-	memset(args, 0, sizeof(*args));
+	(void)memset(args, 0, sizeof(*args));
 	len = strlen(path);
-	if (len > sizeof(args->path))
+	if ((size_t)len > sizeof(args->path))
 		len = sizeof(args->path);
 	args->len = htonl(len);
-	memcpy(args->path, path, len);
+	(void)memcpy(args->path, path, len);
 	len = 4 + roundup(len, 4);
 
-	cc = 

CVS commit: src/sys/arch/i386/stand/bootxx

2023-12-08 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Dec  8 16:29:04 UTC 2023

Modified Files:
src/sys/arch/i386/stand/bootxx: pbr.S

Log Message:
Replace several magic numbers with macro to describe GPT's hybrid MBR boot.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/i386/stand/bootxx/pbr.S

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/bootxx/pbr.S
diff -u src/sys/arch/i386/stand/bootxx/pbr.S:1.23 src/sys/arch/i386/stand/bootxx/pbr.S:1.24
--- src/sys/arch/i386/stand/bootxx/pbr.S:1.23	Wed May 11 14:58:00 2022
+++ src/sys/arch/i386/stand/bootxx/pbr.S	Fri Dec  8 16:29:04 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pbr.S,v 1.23 2022/05/11 14:58:00 andvar Exp $	*/
+/*	$NetBSD: pbr.S,v 1.24 2023/12/08 16:29:04 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2003,2004 The NetBSD Foundation, Inc.
@@ -71,6 +71,10 @@
 #define MBR_AFTERBPB	62		/* BPB size in floppy master BR */
 #endif
 
+#define GPT_MAGIC	0x54504721	/* '!GPT' magic on hybrid MBR boot */
+#define GPT_ENTRY_OFF	20		/* GPT part entry in handover struct */
+#define GPT_ENT_LBA_OFF	32		/* ent_lba_start in struct gpt_ent */
+
 #ifdef TERSE_ERROR
 /*
  * Error codes. Done this way to save space.
@@ -127,7 +131,7 @@ start0:
 	mov	%cx, %sp
 	mov	%cx, %es
 #ifndef BOOT_FROM_FAT
-	cmpl	$0x54504721, %eax	/* did a GPT hybrid MBR start us? */
+	cmpl	$GPT_MAGIC, %eax	/* did a GPT hybrid MBR start us? */
 	je	boot_gpt
 #endif
 	mov	%cx, %ds
@@ -366,8 +370,9 @@ chs_read:
 
 #ifndef BOOT_FROM_FAT
 boot_gpt:
-	movl	(20+32+0)(%si), %ebp
-	movl	(20+32+4)(%si), %edi
+	/* DS:SI has a pointer to the hybrid MBR handover structure */
+	movl	(GPT_ENTRY_OFF+GPT_ENT_LBA_OFF+0)(%si), %ebp
+	movl	(GPT_ENTRY_OFF+GPT_ENT_LBA_OFF+4)(%si), %edi
 	movw	%cx, %ds
 	movl	%ebp, lba_sector + 0
 	movl	%edi, lba_sector + 4



CVS commit: src/sys/arch/i386/stand/bootxx

2023-12-08 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Dec  8 16:29:04 UTC 2023

Modified Files:
src/sys/arch/i386/stand/bootxx: pbr.S

Log Message:
Replace several magic numbers with macro to describe GPT's hybrid MBR boot.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/i386/stand/bootxx/pbr.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/stand/dosboot

2023-11-05 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Nov  6 07:09:08 UTC 2023

Modified Files:
src/sys/arch/i386/stand/dosboot: Makefile

Log Message:
x86/dosboot: Drop no-longer-available -DSLOW for libz

It should be lost during merge from upstream.

We may introduce a similar hack again, if it is *really* required;
inflate_fast() may be dropped by using slow path unconditionally.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/i386/stand/dosboot/Makefile

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/dosboot/Makefile
diff -u src/sys/arch/i386/stand/dosboot/Makefile:1.35 src/sys/arch/i386/stand/dosboot/Makefile:1.36
--- src/sys/arch/i386/stand/dosboot/Makefile:1.35	Mon Nov  6 07:02:17 2023
+++ src/sys/arch/i386/stand/dosboot/Makefile	Mon Nov  6 07:09:08 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.35 2023/11/06 07:02:17 rin Exp $
+#	$NetBSD: Makefile,v 1.36 2023/11/06 07:09:08 rin Exp $
 
 S=	${.CURDIR}/../../../..
 
@@ -10,7 +10,7 @@ RELOC=		0x100
 
 SRCS= main.c devopen.c exec.c exec_multiboot1.c exec_multiboot2.c
 
-CPPFLAGS+= -DSLOW	# for libz
+#CPPFLAGS+= -DSLOW	# for libz; no longer available
 CPPFLAGS+= -DCOMPAT_386BSD_MBRPART
 CPPFLAGS+= -DXMS
 CPPFLAGS+= -DLIBSA_ENABLE_LS_OP



CVS commit: src/sys/arch/i386/stand/dosboot

2023-11-05 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Nov  6 07:09:08 UTC 2023

Modified Files:
src/sys/arch/i386/stand/dosboot: Makefile

Log Message:
x86/dosboot: Drop no-longer-available -DSLOW for libz

It should be lost during merge from upstream.

We may introduce a similar hack again, if it is *really* required;
inflate_fast() may be dropped by using slow path unconditionally.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/i386/stand/dosboot/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/stand/dosboot

2023-11-05 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Nov  6 07:02:17 UTC 2023

Modified Files:
src/sys/arch/i386/stand/dosboot: Makefile

Log Message:
x86/dosboot: Do not page-align data segment

4K alignment is too heavy burden for COM executable with 64K limit :)

Fix binary size overflow for clang/amd64.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/i386/stand/dosboot/Makefile

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/dosboot/Makefile
diff -u src/sys/arch/i386/stand/dosboot/Makefile:1.34 src/sys/arch/i386/stand/dosboot/Makefile:1.35
--- src/sys/arch/i386/stand/dosboot/Makefile:1.34	Mon Nov  6 06:53:52 2023
+++ src/sys/arch/i386/stand/dosboot/Makefile	Mon Nov  6 07:02:17 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.34 2023/11/06 06:53:52 rin Exp $
+#	$NetBSD: Makefile,v 1.35 2023/11/06 07:02:17 rin Exp $
 
 S=	${.CURDIR}/../../../..
 
@@ -34,6 +34,9 @@ I386MISCMAKEFLAGS= I386_INCLUDE_DOS=yes
 # DOS command line arguments are located at 0x.
 COPTS.doscommain.c+= -fno-delete-null-pointer-checks
 
+# Do not page-align data segment.
+LDFLAGS+= -Wl,-N
+
 VERSIONFILE= ${.CURDIR}/version
 
 .include 



CVS commit: src/sys/arch/i386/stand/dosboot

2023-11-05 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Nov  6 07:02:17 UTC 2023

Modified Files:
src/sys/arch/i386/stand/dosboot: Makefile

Log Message:
x86/dosboot: Do not page-align data segment

4K alignment is too heavy burden for COM executable with 64K limit :)

Fix binary size overflow for clang/amd64.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/i386/stand/dosboot/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/stand/dosboot

2023-11-05 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Nov  6 06:53:52 UTC 2023

Modified Files:
src/sys/arch/i386/stand/dosboot: Makefile

Log Message:
x86/dosboot: Allow NULL dereference to fetch command line arguments

DOS command line arguments are provided as struct psp at 0x;
see doscommain.c.

Recent versions of gcc and clang are clever enough to optimize code
block involving NULL dereference into ud2 insn.

Sprinkle -fno-delete-null-pointer-checks to doscommain.c to
prevent this behavior.

Note that dosboot.com for netbsd-9 and later was broken due to
this ``over optimization''. gcc 5.5.0 and clang 4.0.0 in netbsd-8
generate correct codes without this workaround.

XXX
Are there still use cases for dosboot.com? Does anyone want to
boot NetBSD from real-mode DOS in 2023?


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/i386/stand/dosboot/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/stand/dosboot

2023-11-05 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Nov  6 06:53:52 UTC 2023

Modified Files:
src/sys/arch/i386/stand/dosboot: Makefile

Log Message:
x86/dosboot: Allow NULL dereference to fetch command line arguments

DOS command line arguments are provided as struct psp at 0x;
see doscommain.c.

Recent versions of gcc and clang are clever enough to optimize code
block involving NULL dereference into ud2 insn.

Sprinkle -fno-delete-null-pointer-checks to doscommain.c to
prevent this behavior.

Note that dosboot.com for netbsd-9 and later was broken due to
this ``over optimization''. gcc 5.5.0 and clang 4.0.0 in netbsd-8
generate correct codes without this workaround.

XXX
Are there still use cases for dosboot.com? Does anyone want to
boot NetBSD from real-mode DOS in 2023?


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/i386/stand/dosboot/Makefile

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/dosboot/Makefile
diff -u src/sys/arch/i386/stand/dosboot/Makefile:1.33 src/sys/arch/i386/stand/dosboot/Makefile:1.34
--- src/sys/arch/i386/stand/dosboot/Makefile:1.33	Mon Sep 23 13:42:36 2019
+++ src/sys/arch/i386/stand/dosboot/Makefile	Mon Nov  6 06:53:52 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.33 2019/09/23 13:42:36 christos Exp $
+#	$NetBSD: Makefile,v 1.34 2023/11/06 06:53:52 rin Exp $
 
 S=	${.CURDIR}/../../../..
 
@@ -31,6 +31,9 @@ SAMISCCPPFLAGS+= -DHEAP_START=0x2 -D
 SAMISCMAKEFLAGS= SA_USE_CREAD=yes SA_INCLUDE_NET=no SA_ENABLE_LS_OP=yes
 I386MISCMAKEFLAGS= I386_INCLUDE_DOS=yes
 
+# DOS command line arguments are located at 0x.
+COPTS.doscommain.c+= -fno-delete-null-pointer-checks
+
 VERSIONFILE= ${.CURDIR}/version
 
 .include 



CVS commit: src/sys/arch/i386/stand/lib

2023-10-01 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Mon Oct  2 00:02:34 UTC 2023

Modified Files:
src/sys/arch/i386/stand/lib: biosdisk.c

Log Message:
Fix build with -DNO_GPT


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/i386/stand/lib/biosdisk.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/stand/lib

2023-10-01 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Mon Oct  2 00:02:34 UTC 2023

Modified Files:
src/sys/arch/i386/stand/lib: biosdisk.c

Log Message:
Fix build with -DNO_GPT


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/i386/stand/lib/biosdisk.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/lib/biosdisk.c
diff -u src/sys/arch/i386/stand/lib/biosdisk.c:1.59 src/sys/arch/i386/stand/lib/biosdisk.c:1.60
--- src/sys/arch/i386/stand/lib/biosdisk.c:1.59	Thu Sep 28 15:46:55 2023
+++ src/sys/arch/i386/stand/lib/biosdisk.c	Mon Oct  2 00:02:33 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: biosdisk.c,v 1.59 2023/09/28 15:46:55 manu Exp $	*/
+/*	$NetBSD: biosdisk.c,v 1.60 2023/10/02 00:02:33 manu Exp $	*/
 
 /*
  * Copyright (c) 1996, 1998
@@ -328,7 +328,6 @@ guid_is_equal(const struct uuid *a, cons
 	return (memcmp(a, b, sizeof(*a)) == 0 ? true : false);
 }
 
-#ifndef NO_GPT
 static void
 part_name_utf8(const uint16_t *utf16_src, size_t utf16_srclen,
 	   char *utf8_dst, size_t utf8_dstlen)
@@ -351,7 +350,6 @@ part_name_utf8(const uint16_t *utf16_src
 
 	return;
 }
-#endif
 
 static int
 check_gpt(struct biosdisk *d, daddr_t rf_offset, daddr_t sector)
@@ -1562,14 +1560,17 @@ next_disk:
 			if (d->part[part].fstype == FS_UNUSED)
 continue;
 
+#ifndef NO_GPT
 			if (first_bootme == -1 &&
 			d->part[part].attr & GPT_ENT_ATTR_BOOTME)
 first_bootme = part;
+#endif
 
 			if (first_ffs == -1 &&
 			(d->part[part].fstype == FS_BSDFFS ||
 			 d->part[part].fstype == FS_BSDLFS))
 first_ffs = part;
+
 			if (part == target_part) {
 *biosdev = raidframe[i].biosdev;
 *offset = raidframe[i].offset



CVS commit: src/sys/arch/i386/stand/lib

2023-09-28 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Thu Sep 28 15:46:55 UTC 2023

Modified Files:
src/sys/arch/i386/stand/lib: biosdisk.c

Log Message:
Align the behavior of different boot methods in RAIDframe

We enforce the documented and paritally implemented behavior when
looking for the kernel in RAID 1 sets without a partition name given.
We search for:
- A GPT partition with bootme attribute set
- A FFS or LFS patititon
- The first partition


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/i386/stand/lib/biosdisk.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/lib/biosdisk.c
diff -u src/sys/arch/i386/stand/lib/biosdisk.c:1.58 src/sys/arch/i386/stand/lib/biosdisk.c:1.59
--- src/sys/arch/i386/stand/lib/biosdisk.c:1.58	Tue May  3 10:09:40 2022
+++ src/sys/arch/i386/stand/lib/biosdisk.c	Thu Sep 28 15:46:55 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: biosdisk.c,v 1.58 2022/05/03 10:09:40 jmcneill Exp $	*/
+/*	$NetBSD: biosdisk.c,v 1.59 2023/09/28 15:46:55 manu Exp $	*/
 
 /*
  * Copyright (c) 1996, 1998
@@ -105,6 +105,7 @@
 struct biosdisk {
 	struct biosdisk_ll ll;
 	daddr_t boff;
+	daddr_t size;
 	charbuf[BIOSDISK_BUFSIZE];
 #if !defined(NO_DISKLABEL) || !defined(NO_GPT)
 	struct biosdisk_partition part[BIOSDISKNPART];
@@ -666,6 +667,7 @@ read_label(struct biosdisk *d, daddr_t o
 	dflt_lbl.d_npartitions = 8;
 
 	d->boff = 0;
+	d->size = 0;
 
 	if (d->ll.type != BIOSDISK_TYPE_HD)
 		/* No label on floppy and CD */
@@ -1208,7 +1210,7 @@ add_biosdisk_bootinfo(void)
 #endif
 
 #ifndef NO_GPT
-static daddr_t
+static void
 raidframe_part_offset(struct biosdisk *d, int part)
 {
 	struct biosdisk raidframe;
@@ -1221,8 +1223,10 @@ raidframe_part_offset(struct biosdisk *d
 
 	rf_offset = d->part[part].offset + RF_PROTECTED_SECTORS;
 	rf_size = d->part[part].size;
-	if (read_gpt(, rf_offset, rf_size) != 0)
-		return RF_PROTECTED_SECTORS;
+	if (read_gpt(, rf_offset, rf_size) != 0) {
+		d->boff += RF_PROTECTED_SECTORS;
+		return;
+	}
 
 	candidate = 0;
 	for (i = 0; i < BIOSDISKNPART; i++) {
@@ -1231,12 +1235,20 @@ raidframe_part_offset(struct biosdisk *d
 		if (raidframe.part[i].fstype == FS_UNUSED)
 			continue;
 #ifndef NO_GPT
-		if (raidframe.part[i].attr & GPT_ENT_ATTR_BOOTME)
+		if (raidframe.part[i].attr & GPT_ENT_ATTR_BOOTME) {
 			candidate = i;
+			break;
+		}
 #endif
+		if (raidframe.part[i].fstype == FS_BSDFFS ||
+		raidframe.part[i].fstype == FS_BSDLFS) {
+			if (candidate == 0)
+candidate = i;
+		}
 	}
 
-	return RF_PROTECTED_SECTORS + raidframe.part[candidate].offset;
+	d->boff += RF_PROTECTED_SECTORS + raidframe.part[candidate].offset;
+	d->size = raidframe.part[candidate].size;
 }
 #endif
 
@@ -1285,17 +1297,18 @@ biosdisk_open(struct open_file *f, ...)
 	}
 
 	d->boff = d->part[partition].offset;
+	d->size = d->part[partition].size;
 
 	if (d->part[partition].fstype == FS_RAID)
 #ifndef NO_GPT
-		d->boff += raidframe_part_offset(d, partition);
+		raidframe_part_offset(d, partition);
 #else
 		d->boff += RF_PROTECTED_SECTORS;
 #endif
 
 #ifdef _STANDALONE
-	bi_wedge.startblk = d->part[partition].offset;
-	bi_wedge.nblks = d->part[partition].size;
+	bi_wedge.startblk = d->boff;
+	bi_wedge.nblks = d->size;
 #endif
 
 nolabel:
@@ -1389,6 +1402,8 @@ next_disk:
 
 #ifndef NO_RAIDFRAME
 	for (i = 0; i < raidframe_count; i++) {
+		int first_bootme = -1;
+		int first_ffs = -1;
 		int candidate = -1;
 
 		if ((d = alloc_biosdisk(raidframe[i].biosdev)) == NULL) {
@@ -1402,12 +1417,20 @@ next_disk:
 			goto next_raidframe;
 
 		for (part = 0; part < BIOSDISKNPART; part++) {
-			bool bootme = d->part[part].attr & GPT_ENT_ATTR_BOOTME;
 			if (d->part[part].size == 0)
 continue;
 			if (d->part[part].fstype == FS_UNUSED)
 continue;
 
+			if (first_bootme == -1 && 
+			d->part[part].attr & GPT_ENT_ATTR_BOOTME)
+first_bootme = part;
+
+			if (first_ffs == -1 && 
+			(d->part[part].fstype == FS_BSDFFS ||
+			 d->part[part].fstype == FS_BSDLFS))
+first_ffs = part;
+
 			if (d->part[part].part_name != NULL &&
 			strcmp(d->part[part].part_name, name) == 0) {
 *biosdev = raidframe[i].biosdev;
@@ -1418,11 +1441,13 @@ next_disk:
 ret = 0;
 goto out;
 			}
-			if (strcmp(raidframe[i].parent_name, name) == 0) {
-if (candidate == -1 || bootme)
-	candidate = part;
-continue;
-			}
+		}
+
+		if (strcmp(raidframe[i].parent_name, name) == 0) {
+			if (first_bootme != -1)
+candidate = first_bootme;
+			else if (first_ffs != -1)
+candidate = first_ffs;
 		}
 
 		if (candidate != -1) {
@@ -1514,6 +1539,10 @@ next_disk:
 	}
 
 	for (i = 0; i < raidframe_count; i++) {
+		int first_bootme = -1;
+		int first_ffs = -1;
+		int candidate = -1;
+
 		if (raidframe[i].last_unit != target_unit)
 			continue;
 
@@ -1532,6 +1561,15 @@ next_disk:
 continue;
 			if (d->part[part].fstype == 

CVS commit: src/sys/arch/i386/stand/lib

2023-09-28 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Thu Sep 28 15:46:55 UTC 2023

Modified Files:
src/sys/arch/i386/stand/lib: biosdisk.c

Log Message:
Align the behavior of different boot methods in RAIDframe

We enforce the documented and paritally implemented behavior when
looking for the kernel in RAID 1 sets without a partition name given.
We search for:
- A GPT partition with bootme attribute set
- A FFS or LFS patititon
- The first partition


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/i386/stand/lib/biosdisk.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/stand/efiboot

2023-09-13 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Sep 14 03:05:15 UTC 2023

Modified Files:
src/sys/arch/i386/stand/efiboot: eficons.c

Log Message:
efiboot/x86: eficons.c: Explicitly include params.h for howmany()

NFC for -current and netbsd-10, but necessary for netbsd-[89] to
pull up raw IO serial port support (PR port-amd64/57523).


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/i386/stand/efiboot/eficons.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/stand/efiboot

2023-09-13 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Sep 14 03:05:15 UTC 2023

Modified Files:
src/sys/arch/i386/stand/efiboot: eficons.c

Log Message:
efiboot/x86: eficons.c: Explicitly include params.h for howmany()

NFC for -current and netbsd-10, but necessary for netbsd-[89] to
pull up raw IO serial port support (PR port-amd64/57523).


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/i386/stand/efiboot/eficons.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/eficons.c
diff -u src/sys/arch/i386/stand/efiboot/eficons.c:1.13 src/sys/arch/i386/stand/efiboot/eficons.c:1.14
--- src/sys/arch/i386/stand/efiboot/eficons.c:1.13	Mon Jul 24 01:56:59 2023
+++ src/sys/arch/i386/stand/efiboot/eficons.c	Thu Sep 14 03:05:15 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: eficons.c,v 1.13 2023/07/24 01:56:59 rin Exp $	*/
+/*	$NetBSD: eficons.c,v 1.14 2023/09/14 03:05:15 rin Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -26,6 +26,7 @@
  * SUCH DAMAGE.
  */
 
+#include 
 #include 
 #include 
 



CVS commit: src/sys/arch/i386/stand/bootxx

2023-08-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Aug 30 18:46:52 UTC 2023

Modified Files:
src/sys/arch/i386/stand/bootxx/bootxx_msdos: Makefile
src/sys/arch/i386/stand/bootxx/bootxx_ustarfs: Makefile

Log Message:
Override these two booters with -Oz for clang since it produces smaller code
here.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/i386/stand/bootxx/bootxx_msdos/Makefile
cvs rdiff -u -r1.3 -r1.4 \
src/sys/arch/i386/stand/bootxx/bootxx_ustarfs/Makefile

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/bootxx/bootxx_msdos/Makefile
diff -u src/sys/arch/i386/stand/bootxx/bootxx_msdos/Makefile:1.4 src/sys/arch/i386/stand/bootxx/bootxx_msdos/Makefile:1.5
--- src/sys/arch/i386/stand/bootxx/bootxx_msdos/Makefile:1.4	Wed Jan 22 01:13:18 2020
+++ src/sys/arch/i386/stand/bootxx/bootxx_msdos/Makefile	Wed Aug 30 14:46:51 2023
@@ -1,7 +1,11 @@
-# $NetBSD: Makefile,v 1.4 2020/01/22 06:13:18 martin Exp $
+# $NetBSD: Makefile,v 1.5 2023/08/30 18:46:51 christos Exp $
+
+NOMAN=yes
+.include 
 
 PROG=	bootxx_msdos
 FS=	dosfs
 CPPFLAGS=-DBOOT_FROM_FAT -DTERSE_ERROR -DSA_DOSFS_NO_BIG_PART_SUPPORT
 
 .include <../Makefile.bootxx>
+OPT_SIZE.clang += -Oz

Index: src/sys/arch/i386/stand/bootxx/bootxx_ustarfs/Makefile
diff -u src/sys/arch/i386/stand/bootxx/bootxx_ustarfs/Makefile:1.3 src/sys/arch/i386/stand/bootxx/bootxx_ustarfs/Makefile:1.4
--- src/sys/arch/i386/stand/bootxx/bootxx_ustarfs/Makefile:1.3	Wed Nov 18 16:02:16 2009
+++ src/sys/arch/i386/stand/bootxx/bootxx_ustarfs/Makefile	Wed Aug 30 14:46:52 2023
@@ -1,7 +1,11 @@
-# $NetBSD: Makefile,v 1.3 2009/11/18 21:02:16 dsl Exp $
+# $NetBSD: Makefile,v 1.4 2023/08/30 18:46:52 christos Exp $
+
+NOMAN=yes
+.include 
 
 FS=ustarfs
 
 BOOTXX_SECTORS=16
 
 .include <../Makefile.bootxx>
+OPT_SIZE.clang += -Oz



CVS commit: src/sys/arch/i386/stand/bootxx

2023-08-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Aug 30 18:46:52 UTC 2023

Modified Files:
src/sys/arch/i386/stand/bootxx/bootxx_msdos: Makefile
src/sys/arch/i386/stand/bootxx/bootxx_ustarfs: Makefile

Log Message:
Override these two booters with -Oz for clang since it produces smaller code
here.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/i386/stand/bootxx/bootxx_msdos/Makefile
cvs rdiff -u -r1.3 -r1.4 \
src/sys/arch/i386/stand/bootxx/bootxx_ustarfs/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/stand

2023-08-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Aug 30 18:45:46 UTC 2023

Modified Files:
src/sys/arch/i386/stand: Makefile.inc

Log Message:
Merge the OPT_SIZE flags. -Oz is not always producing smaller code that -Os,
so default to -Os for both, and we'll override where needed.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/i386/stand/Makefile.inc

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/Makefile.inc
diff -u src/sys/arch/i386/stand/Makefile.inc:1.18 src/sys/arch/i386/stand/Makefile.inc:1.19
--- src/sys/arch/i386/stand/Makefile.inc:1.18	Sat Jan 26 23:56:46 2019
+++ src/sys/arch/i386/stand/Makefile.inc	Wed Aug 30 14:45:46 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.18 2019/01/27 04:56:46 dholland Exp $
+#	$NetBSD: Makefile.inc,v 1.19 2023/08/30 18:45:46 christos Exp $
 
 NOLIBCSANITIZER=
 NOSANITIZER=
@@ -10,8 +10,6 @@ NOMAN=
 BINDIR=	/usr/mdec
 
 OPT_SIZE.gcc=	-Os -ffreestanding -fomit-frame-pointer -fno-unwind-tables \
-		-fno-asynchronous-unwind-tables -fno-exceptions -mno-sse
-OPT_SIZE.clang=	-Oz -ffreestanding -fomit-frame-pointer -DNDEBUG \
-		-fno-stack-protector -mno-sse \
-		-mstack-alignment=4 \
-		-fno-unwind-tables
+		-fno-asynchronous-unwind-tables -fno-exceptions -mno-sse \
+		-fno-stack-protector
+OPT_SIZE.clang=	${OPT_SIZE.gcc} -mstack-alignment=4  -DNDEBUG



CVS commit: src/sys/arch/i386/stand

2023-08-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Aug 30 18:45:46 UTC 2023

Modified Files:
src/sys/arch/i386/stand: Makefile.inc

Log Message:
Merge the OPT_SIZE flags. -Oz is not always producing smaller code that -Os,
so default to -Os for both, and we'll override where needed.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/i386/stand/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/stand/lib

2023-08-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Aug 30 18:44:48 UTC 2023

Modified Files:
src/sys/arch/i386/stand/lib: Makefile.inc

Log Message:
Explicitly pass COPTS


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/i386/stand/lib/Makefile.inc

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/lib/Makefile.inc
diff -u src/sys/arch/i386/stand/lib/Makefile.inc:1.19 src/sys/arch/i386/stand/lib/Makefile.inc:1.20
--- src/sys/arch/i386/stand/lib/Makefile.inc:1.19	Wed Jun 13 12:03:10 2018
+++ src/sys/arch/i386/stand/lib/Makefile.inc	Wed Aug 30 14:44:48 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.19 2018/06/13 16:03:10 christos Exp $
+#	$NetBSD: Makefile.inc,v 1.20 2023/08/30 18:44:48 christos Exp $
 #
 #	Configuration variables (default values are below):
 #
@@ -26,6 +26,7 @@ I386MAKE= \
 	MAKEOBJDIR=${I386DST} ${MAKE} \
 	CC=${CC:q} CFLAGS=${CFLAGS:q} \
 	AS=${AS:q} AFLAGS=${AFLAGS:q} \
+	COPTS=${COPTS:q} \
 	LD=${LD:q} STRIP=${STRIP:q} \
 	MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE_ARCH:q} \
 	I386CPPFLAGS=${CPPFLAGS:S@^-I.@-I../../.@g:q} \



CVS commit: src/sys/arch/i386/stand/lib

2023-08-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Aug 30 18:44:48 UTC 2023

Modified Files:
src/sys/arch/i386/stand/lib: Makefile.inc

Log Message:
Explicitly pass COPTS


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/i386/stand/lib/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/stand/lib

2023-08-04 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Aug  4 07:21:57 UTC 2023

Modified Files:
src/sys/arch/i386/stand/lib: exec_multiboot2.c

Log Message:
x86/multiboot2: Fix short read for 64-bit ELF headers

XXX document this
At the moment, this cannot affect NetBSD/amd64, as we have not
supported multiboot for kernel side.

Found by GCC12.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/i386/stand/lib/exec_multiboot2.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/lib/exec_multiboot2.c
diff -u src/sys/arch/i386/stand/lib/exec_multiboot2.c:1.5 src/sys/arch/i386/stand/lib/exec_multiboot2.c:1.6
--- src/sys/arch/i386/stand/lib/exec_multiboot2.c:1.5	Wed Jul 21 23:16:08 2021
+++ src/sys/arch/i386/stand/lib/exec_multiboot2.c	Fri Aug  4 07:21:57 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: exec_multiboot2.c,v 1.5 2021/07/21 23:16:08 jmcneill Exp $ */
+/* $NetBSD: exec_multiboot2.c,v 1.6 2023/08/04 07:21:57 rin Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -976,7 +976,10 @@ mbi_elf_sections(struct multiboot_packag
 {
 	size_t len = 0;
 	struct multiboot_tag_elf_sections *mbt = buf;
-	Elf_Ehdr ehdr;
+	union {
+		Elf32_Ehdr e32;
+		Elf64_Ehdr e64;
+	} ehdr;
 	int class;
 	Elf32_Ehdr *ehdr32 = NULL;
 	Elf64_Ehdr *ehdr64 = NULL;
@@ -991,21 +994,21 @@ mbi_elf_sections(struct multiboot_packag
 	/*
 	 * Check this is a ELF header
 	 */
-	if (memcmp(_ident, ELFMAG, SELFMAG) != 0)
+	if (memcmp(_ident, ELFMAG, SELFMAG) != 0)
 		goto out;
 
-	class = ehdr.e_ident[EI_CLASS];
+	class = ehdr.e32.e_ident[EI_CLASS];
 
 	switch (class) {
 	case ELFCLASS32:
-		ehdr32 = (Elf32_Ehdr *)
+		ehdr32 = 
 		shnum = ehdr32->e_shnum;
 		shentsize = ehdr32->e_shentsize;
 		shstrndx = ehdr32->e_shstrndx;
 		shoff = ehdr32->e_shoff;
 		break;
 	case ELFCLASS64:
-		ehdr64 = (Elf64_Ehdr *)
+		ehdr64 = 
 		shnum = ehdr64->e_shnum;
 		shentsize = ehdr64->e_shentsize;
 		shstrndx = ehdr64->e_shstrndx;



CVS commit: src/sys/arch/i386/stand/lib

2023-08-04 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Aug  4 07:21:57 UTC 2023

Modified Files:
src/sys/arch/i386/stand/lib: exec_multiboot2.c

Log Message:
x86/multiboot2: Fix short read for 64-bit ELF headers

XXX document this
At the moment, this cannot affect NetBSD/amd64, as we have not
supported multiboot for kernel side.

Found by GCC12.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/i386/stand/lib/exec_multiboot2.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



Re: CVS commit: src/sys/arch/i386/stand/efiboot

2023-07-24 Thread Rin Okuyama

On 2023/07/24 16:14, matthew green wrote:

"Rin Okuyama" writes:

Module Name:src
Committed By:   rin
Date:   Mon Jul 24 01:56:59 UTC 2023

Modified Files:
src/sys/arch/i386/stand/efiboot: Makefile.efiboot eficons.c
Added Files:
src/sys/arch/i386/stand/efiboot: eficpufunc.c eficpufunc.h

Log Message:
efiboot/x86: Add serial console support via raw I/O port access


thanks!  this makes efiboot capable of replacing bios on many
of my test systems that can use serial console (and often do.)


Thank you too for your feedback! I'm glad to hear that :)

rin


re: CVS commit: src/sys/arch/i386/stand/efiboot

2023-07-24 Thread matthew green
"Rin Okuyama" writes:
> Module Name:  src
> Committed By: rin
> Date: Mon Jul 24 01:56:59 UTC 2023
>
> Modified Files:
>   src/sys/arch/i386/stand/efiboot: Makefile.efiboot eficons.c
> Added Files:
>   src/sys/arch/i386/stand/efiboot: eficpufunc.c eficpufunc.h
>
> Log Message:
> efiboot/x86: Add serial console support via raw I/O port access

thanks!  this makes efiboot capable of replacing bios on many
of my test systems that can use serial console (and often do.)


.mrg.


CVS commit: src/sys/arch/i386/stand/efiboot

2023-07-23 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul 24 01:56:59 UTC 2023

Modified Files:
src/sys/arch/i386/stand/efiboot: Makefile.efiboot eficons.c
Added Files:
src/sys/arch/i386/stand/efiboot: eficpufunc.c eficpufunc.h

Log Message:
efiboot/x86: Add serial console support via raw I/O port access

Unfortunately, some (most?) UEFI implementations do not support
com ports by ``Serial I/O Protocol''.

``PNP0501-0'' and friends are not recognized also.

In this case, if user explicitly requires to switch to serial
console by ``consdev'' command, try to use raw I/O port access.

Ugly, but what FreeBSD does, at least.

Proposed as PR port-amd64/57523


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/i386/stand/efiboot/Makefile.efiboot
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/i386/stand/efiboot/eficons.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/i386/stand/efiboot/eficpufunc.c \
src/sys/arch/i386/stand/efiboot/eficpufunc.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/stand/efiboot

2023-07-23 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul 24 01:56:59 UTC 2023

Modified Files:
src/sys/arch/i386/stand/efiboot: Makefile.efiboot eficons.c
Added Files:
src/sys/arch/i386/stand/efiboot: eficpufunc.c eficpufunc.h

Log Message:
efiboot/x86: Add serial console support via raw I/O port access

Unfortunately, some (most?) UEFI implementations do not support
com ports by ``Serial I/O Protocol''.

``PNP0501-0'' and friends are not recognized also.

In this case, if user explicitly requires to switch to serial
console by ``consdev'' command, try to use raw I/O port access.

Ugly, but what FreeBSD does, at least.

Proposed as PR port-amd64/57523


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/i386/stand/efiboot/Makefile.efiboot
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/i386/stand/efiboot/eficons.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/i386/stand/efiboot/eficpufunc.c \
src/sys/arch/i386/stand/efiboot/eficpufunc.h

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/Makefile.efiboot
diff -u src/sys/arch/i386/stand/efiboot/Makefile.efiboot:1.21 src/sys/arch/i386/stand/efiboot/Makefile.efiboot:1.22
--- src/sys/arch/i386/stand/efiboot/Makefile.efiboot:1.21	Sat Jun  3 08:52:56 2023
+++ src/sys/arch/i386/stand/efiboot/Makefile.efiboot	Mon Jul 24 01:56:59 2023
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.efiboot,v 1.21 2023/06/03 08:52:56 lukem Exp $
+# $NetBSD: Makefile.efiboot,v 1.22 2023/07/24 01:56:59 rin Exp $
 
 S=		${.CURDIR}/../../../../..
 
@@ -14,9 +14,11 @@ AFLAGS.start.S= ${${ACTIVE_CC} == "clang
 
 SOURCES= start.S boot.c conf.c devopen.c dev_net.c self_reloc.c panic.c
 SOURCES+= efiboot.c efichar.c eficons.c efidelay.c efidev.c
+SOURCES+= eficpufunc.c
 SOURCES+= efidisk.c efidisk_ll.c efigetsecs.c efimemory.c
 SOURCES+= efinet.c efipxe.c
 LIBI386SRCS= biosdisk.c bootinfo.c bootinfo_biosgeom.c bootmenu.c
+LIBI386SRCS+= comio_direct.c
 LIBI386SRCS+= diskbuf.c exec.c menuutils.c parseutils.c pread.c
 LIBI386SRCS+= exec_multiboot1.c exec_multiboot2.c
 # use our own nfs implementation

Index: src/sys/arch/i386/stand/efiboot/eficons.c
diff -u src/sys/arch/i386/stand/efiboot/eficons.c:1.12 src/sys/arch/i386/stand/efiboot/eficons.c:1.13
--- src/sys/arch/i386/stand/efiboot/eficons.c:1.12	Thu Oct 28 06:13:13 2021
+++ src/sys/arch/i386/stand/efiboot/eficons.c	Mon Jul 24 01:56:59 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: eficons.c,v 1.12 2021/10/28 06:13:13 kim Exp $	*/
+/*	$NetBSD: eficons.c,v 1.13 2023/07/24 01:56:59 rin Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -29,6 +29,8 @@
 #include 
 #include 
 
+#include 
+
 #include "efiboot.h"
 
 #include "bootinfo.h"
@@ -60,6 +62,8 @@ static u_char serbuf[16];
 static int serbuf_read = 0;
 static int serbuf_write = 0;
 
+static int raw_com_addr = 0;
+
 static void eficons_init_video(void);
 static void efi_switch_video_to_text_mode(void);
 
@@ -76,6 +80,12 @@ static int efi_com_putc(int);
 static int efi_com_status(int);
 static int efi_com_waitforinputevent(uint64_t);
 
+static int raw_com_init(int, int);
+static int raw_com_getc(void);
+static int raw_com_putc(int);
+static int raw_com_status(int);
+static int raw_com_waitforinputevent(uint64_t);
+
 static int efi_find_gop_mode(char *);
 
 static int iodev;
@@ -134,11 +144,8 @@ ok:
 	case CONSDEV_COM3:
 		iodev = dev;
 		btinfo_console.addr = ioport;
-		if (btinfo_console.addr == 0) {
-			if (!efi_valid_com(iodev))
-goto nocom;
+		if (btinfo_console.addr == 0)
 			btinfo_console.addr = getcomaddr(iodev - CONSDEV_COM0);
-		}
 		if (speed != 0)
 			btinfo_console.speed = speed;
 		efi_com_init(btinfo_console.addr, btinfo_console.speed);
@@ -149,8 +156,6 @@ ok:
 	case CONSDEV_COM2KBD:
 	case CONSDEV_COM3KBD:
 		iodev = dev - CONSDEV_COM0KBD + CONSDEV_COM0;
-		if (!efi_valid_com(iodev))
-			goto nocom;
 		btinfo_console.addr = getcomaddr(iodev - CONSDEV_COM0);
 
 		efi_cons_putc('0' + iodev - CONSDEV_COM0);
@@ -869,7 +874,7 @@ efi_com_init(int addr, int speed)
 		return 0;
 
 	if (!efi_valid_com(iodev))
-		return 0;
+		return raw_com_init(addr, speed);
 
 	serio = serios[iodev - CONSDEV_COM0];
 
@@ -885,6 +890,7 @@ efi_com_init(int addr, int speed)
 		}
 	}
 
+	raw_com_addr = 0;
 	default_comspeed = speed;
 	internal_getchar = efi_com_getc;
 	internal_putchar = efi_com_putc;
@@ -1019,3 +1025,65 @@ efi_com_waitforinputevent(uint64_t timeo
 		return ETIMEDOUT;
 	return EINVAL;
 }
+
+static int
+raw_com_init(int addr, int speed)
+{
+
+	if (addr == 0 || speed <= 0)
+		return 0;
+
+	speed = cominit_d(addr, speed);
+
+	raw_com_addr = addr;
+	default_comspeed = speed;
+	internal_getchar = raw_com_getc;
+	internal_putchar = raw_com_putc;
+	internal_iskey = raw_com_status;
+	internal_waitforinputevent = raw_com_waitforinputevent;
+
+	return speed;
+}
+
+static int
+raw_com_getc(void)
+{
+
+	if (raw_com_addr == 0)
+		panic("%s: Invalid serial port", 

CVS commit: src/sys/arch/i386/conf

2023-07-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jul 22 15:19:18 UTC 2023

Modified Files:
src/sys/arch/i386/conf: XEN3PAE_DOMU

Log Message:
i386/XEN3PAE_DOMU: Pass -g to build debug data like GENERIC.

Needed for CTF data by dtrace when MKDEBUG=no MKDEBUGKERNEL=no.

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/i386/conf/XEN3PAE_DOMU

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/conf

2023-07-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jul 22 15:19:03 UTC 2023

Modified Files:
src/sys/arch/i386/conf: XEN3PAE_DOM0

Log Message:
i386/XEN3PAE_DOM0: Pass -g to build debug data like GENERIC.

Needed for CTF data by dtrace when MKDEBUG=no MKDEBUGKERNEL=no.

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/i386/conf/XEN3PAE_DOM0

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/conf

2023-07-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jul 22 15:19:03 UTC 2023

Modified Files:
src/sys/arch/i386/conf: XEN3PAE_DOM0

Log Message:
i386/XEN3PAE_DOM0: Pass -g to build debug data like GENERIC.

Needed for CTF data by dtrace when MKDEBUG=no MKDEBUGKERNEL=no.

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/i386/conf/XEN3PAE_DOM0

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/conf/XEN3PAE_DOM0
diff -u src/sys/arch/i386/conf/XEN3PAE_DOM0:1.38 src/sys/arch/i386/conf/XEN3PAE_DOM0:1.39
--- src/sys/arch/i386/conf/XEN3PAE_DOM0:1.38	Fri Jul 21 02:08:45 2023
+++ src/sys/arch/i386/conf/XEN3PAE_DOM0	Sat Jul 22 15:19:03 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: XEN3PAE_DOM0,v 1.38 2023/07/21 02:08:45 riastradh Exp $
+#	$NetBSD: XEN3PAE_DOM0,v 1.39 2023/07/22 15:19:03 riastradh Exp $
 #
 #	XEN3_0: Xen 3.0 domain0 kernel
 
@@ -74,7 +74,7 @@ options 	DDB_ONPANIC=1	# see also sysctl
 options 	DDB_HISTORY_SIZE=512	# enable history editing in DDB
 #options 	KGDB		# remote debugger
 #options 	KGDB_DEVNAME="\"com\"",KGDB_DEVADDR=0x2f8,KGDB_DEVRATE=57600
-#makeoptions	DEBUG="-g"	# compile full symbol table
+makeoptions	DEBUG="-g"	# compile full symbol table
 options DDB_COMMANDONENTER="show registers"
 options 	KDTRACE_HOOKS	# kernel DTrace hooks
 



CVS commit: src/sys/arch/i386/conf

2023-07-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jul 22 15:19:18 UTC 2023

Modified Files:
src/sys/arch/i386/conf: XEN3PAE_DOMU

Log Message:
i386/XEN3PAE_DOMU: Pass -g to build debug data like GENERIC.

Needed for CTF data by dtrace when MKDEBUG=no MKDEBUGKERNEL=no.

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/i386/conf/XEN3PAE_DOMU

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/conf/XEN3PAE_DOMU
diff -u src/sys/arch/i386/conf/XEN3PAE_DOMU:1.20 src/sys/arch/i386/conf/XEN3PAE_DOMU:1.21
--- src/sys/arch/i386/conf/XEN3PAE_DOMU:1.20	Fri Jul 21 02:10:37 2023
+++ src/sys/arch/i386/conf/XEN3PAE_DOMU	Sat Jul 22 15:19:17 2023
@@ -1,4 +1,4 @@
-# $NetBSD: XEN3PAE_DOMU,v 1.20 2023/07/21 02:10:37 riastradh Exp $
+# $NetBSD: XEN3PAE_DOMU,v 1.21 2023/07/22 15:19:17 riastradh Exp $
 
 include 	"arch/i386/conf/std.xen"
 
@@ -58,7 +58,7 @@ options 	DDB_ONPANIC=1	# see also sysctl
 options 	DDB_HISTORY_SIZE=512	# enable history editing in DDB
 #options 	KGDB		# remote debugger
 #options 	KGDB_DEVNAME="\"com\"",KGDB_DEVADDR=0x2f8,KGDB_DEVRATE=57600
-#makeoptions	DEBUG="-g"	# compile full symbol table
+makeoptions	DEBUG="-g"	# compile full symbol table
 options DDB_COMMANDONENTER="trace;show registers"
 options 	KDTRACE_HOOKS	# kernel DTrace hooks
 



CVS commit: src/sys/arch/i386/conf

2023-07-20 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Jul 21 02:10:37 UTC 2023

Modified Files:
src/sys/arch/i386/conf: XEN3PAE_DOMU

Log Message:
i386/XEN3PAE_DOMU: Enable KDTRACE_HOOKS.

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/i386/conf/XEN3PAE_DOMU

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/conf/XEN3PAE_DOMU
diff -u src/sys/arch/i386/conf/XEN3PAE_DOMU:1.19 src/sys/arch/i386/conf/XEN3PAE_DOMU:1.20
--- src/sys/arch/i386/conf/XEN3PAE_DOMU:1.19	Thu Feb  9 14:09:48 2023
+++ src/sys/arch/i386/conf/XEN3PAE_DOMU	Fri Jul 21 02:10:37 2023
@@ -1,4 +1,4 @@
-# $NetBSD: XEN3PAE_DOMU,v 1.19 2023/02/09 14:09:48 abs Exp $
+# $NetBSD: XEN3PAE_DOMU,v 1.20 2023/07/21 02:10:37 riastradh Exp $
 
 include 	"arch/i386/conf/std.xen"
 
@@ -60,6 +60,7 @@ options 	DDB_HISTORY_SIZE=512	# enable h
 #options 	KGDB_DEVNAME="\"com\"",KGDB_DEVADDR=0x2f8,KGDB_DEVRATE=57600
 #makeoptions	DEBUG="-g"	# compile full symbol table
 options DDB_COMMANDONENTER="trace;show registers"
+options 	KDTRACE_HOOKS	# kernel DTrace hooks
 
 # Compatibility options
 include 	"conf/compat_netbsd09.config"



CVS commit: src/sys/arch/i386/conf

2023-07-20 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Jul 21 02:10:37 UTC 2023

Modified Files:
src/sys/arch/i386/conf: XEN3PAE_DOMU

Log Message:
i386/XEN3PAE_DOMU: Enable KDTRACE_HOOKS.

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/i386/conf/XEN3PAE_DOMU

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/conf

2023-07-20 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Jul 21 02:08:45 UTC 2023

Modified Files:
src/sys/arch/i386/conf: XEN3PAE_DOM0

Log Message:
i386/XEN3PAE_DOM0: Enable KDTRACE_HOOKS.

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/i386/conf/XEN3PAE_DOM0

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/conf/XEN3PAE_DOM0
diff -u src/sys/arch/i386/conf/XEN3PAE_DOM0:1.37 src/sys/arch/i386/conf/XEN3PAE_DOM0:1.38
--- src/sys/arch/i386/conf/XEN3PAE_DOM0:1.37	Thu Feb  9 14:09:48 2023
+++ src/sys/arch/i386/conf/XEN3PAE_DOM0	Fri Jul 21 02:08:45 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: XEN3PAE_DOM0,v 1.37 2023/02/09 14:09:48 abs Exp $
+#	$NetBSD: XEN3PAE_DOM0,v 1.38 2023/07/21 02:08:45 riastradh Exp $
 #
 #	XEN3_0: Xen 3.0 domain0 kernel
 
@@ -76,6 +76,7 @@ options 	DDB_HISTORY_SIZE=512	# enable h
 #options 	KGDB_DEVNAME="\"com\"",KGDB_DEVADDR=0x2f8,KGDB_DEVRATE=57600
 #makeoptions	DEBUG="-g"	# compile full symbol table
 options DDB_COMMANDONENTER="show registers"
+options 	KDTRACE_HOOKS	# kernel DTrace hooks
 
 # Compatibility options
 include 	"conf/compat_netbsd09.config"



CVS commit: src/sys/arch/i386/conf

2023-07-20 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Jul 21 02:08:45 UTC 2023

Modified Files:
src/sys/arch/i386/conf: XEN3PAE_DOM0

Log Message:
i386/XEN3PAE_DOM0: Enable KDTRACE_HOOKS.

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/i386/conf/XEN3PAE_DOM0

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/conf

2023-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Jul 17 21:12:29 UTC 2023

Modified Files:
src/sys/arch/i386/conf: LEGACY

Log Message:
i386/LEGACY: Enable ATA_DOWNGRADE_MODE.

PR kern/57362


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/i386/conf/LEGACY

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/conf/LEGACY
diff -u src/sys/arch/i386/conf/LEGACY:1.1 src/sys/arch/i386/conf/LEGACY:1.2
--- src/sys/arch/i386/conf/LEGACY:1.1	Sat Mar  7 07:28:37 2015
+++ src/sys/arch/i386/conf/LEGACY	Mon Jul 17 21:12:29 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: LEGACY,v 1.1 2015/03/07 07:28:37 mrg Exp $
+#	$NetBSD: LEGACY,v 1.2 2023/07/17 21:12:29 riastradh Exp $
 
 # LEGACY kernel -- includes vga@isa and pcdisplay@isa for pre-PCI
 # systems, due to significant pain making them fail to attach when
@@ -10,5 +10,8 @@ vga0		at isa?
 pcdisplay0	at isa?			# CGA, MDA, EGA, HGA
 wsdisplay*	at pcdisplay? console ?
 
+# Enable DMA -> PIO downgrade after a certain number of DMA errors.
+options 	ATA_DOWNGRADE_MODE
+
 # XXX we could turn off all sorts of other modern features in this
 # configuration, but that is left for future work.



CVS commit: src/sys/arch/i386/conf

2023-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Jul 17 21:12:29 UTC 2023

Modified Files:
src/sys/arch/i386/conf: LEGACY

Log Message:
i386/LEGACY: Enable ATA_DOWNGRADE_MODE.

PR kern/57362


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/i386/conf/LEGACY

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/conf

2023-07-16 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 16 10:20:08 UTC 2023

Modified Files:
src/sys/arch/i386/conf: ALL GENERIC

Log Message:
i386: Re-enable HEARTBEAT.


To generate a diff of this commit:
cvs rdiff -u -r1.509 -r1.510 src/sys/arch/i386/conf/ALL
cvs rdiff -u -r1.1249 -r1.1250 src/sys/arch/i386/conf/GENERIC

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/conf

2023-07-16 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 16 10:20:08 UTC 2023

Modified Files:
src/sys/arch/i386/conf: ALL GENERIC

Log Message:
i386: Re-enable HEARTBEAT.


To generate a diff of this commit:
cvs rdiff -u -r1.509 -r1.510 src/sys/arch/i386/conf/ALL
cvs rdiff -u -r1.1249 -r1.1250 src/sys/arch/i386/conf/GENERIC

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/conf/ALL
diff -u src/sys/arch/i386/conf/ALL:1.509 src/sys/arch/i386/conf/ALL:1.510
--- src/sys/arch/i386/conf/ALL:1.509	Sun Jul 16 05:24:08 2023
+++ src/sys/arch/i386/conf/ALL	Sun Jul 16 10:20:07 2023
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.509 2023/07/16 05:24:08 mrg Exp $
+# $NetBSD: ALL,v 1.510 2023/07/16 10:20:07 riastradh Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"ALL-$Revision: 1.509 $"
+#ident		"ALL-$Revision: 1.510 $"
 
 maxusers	64		# estimated number of users
 
@@ -131,6 +131,10 @@ options 	BIOHIST		# kernhist for buff I/
 makeoptions	KCOV=1
 options		KCOV
 
+# Heartbeat checks
+options 	HEARTBEAT
+options 	HEARTBEAT_MAX_PERIOD_DEFAULT=15
+
 # Compatibility options
 include 	"conf/compat_netbsd09.config"
 options 	COMPAT_NOMID	# NetBSD 0.8, 386BSD, and BSDI

Index: src/sys/arch/i386/conf/GENERIC
diff -u src/sys/arch/i386/conf/GENERIC:1.1249 src/sys/arch/i386/conf/GENERIC:1.1250
--- src/sys/arch/i386/conf/GENERIC:1.1249	Sun Jul 16 05:24:08 2023
+++ src/sys/arch/i386/conf/GENERIC	Sun Jul 16 10:20:07 2023
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.1249 2023/07/16 05:24:08 mrg Exp $
+# $NetBSD: GENERIC,v 1.1250 2023/07/16 10:20:07 riastradh Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.1249 $"
+#ident		"GENERIC-$Revision: 1.1250 $"
 
 maxusers	64		# estimated number of users
 
@@ -140,6 +140,10 @@ options 	KDTRACE_HOOKS	# kernel DTrace h
 #makeoptions	KCOV=1
 #options 	KCOV
 
+# Heartbeat checks
+options 	HEARTBEAT
+options 	HEARTBEAT_MAX_PERIOD_DEFAULT=15
+
 # Compatibility options
 include 	"conf/compat_netbsd09.config"
 #options 	COMPAT_386BSD_MBRPART # recognize old partition ID



CVS commit: src/sys/arch/i386/conf

2023-07-15 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Jul 16 05:24:08 UTC 2023

Modified Files:
src/sys/arch/i386/conf: ALL GENERIC

Log Message:
revert previous change to enable HEARTBEAT.

the new code has a "needs 64-bit atomic ops" trigger:

ci->ci_heartbeat_uptime_cache = atomic_load_relaxed(_uptime);

but time_uptime is a 64-bit value, and this trips CTASSERT().


To generate a diff of this commit:
cvs rdiff -u -r1.508 -r1.509 src/sys/arch/i386/conf/ALL
cvs rdiff -u -r1.1248 -r1.1249 src/sys/arch/i386/conf/GENERIC

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/conf/ALL
diff -u src/sys/arch/i386/conf/ALL:1.508 src/sys/arch/i386/conf/ALL:1.509
--- src/sys/arch/i386/conf/ALL:1.508	Sat Jul 15 22:13:27 2023
+++ src/sys/arch/i386/conf/ALL	Sun Jul 16 05:24:08 2023
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.508 2023/07/15 22:13:27 riastradh Exp $
+# $NetBSD: ALL,v 1.509 2023/07/16 05:24:08 mrg Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"ALL-$Revision: 1.508 $"
+#ident		"ALL-$Revision: 1.509 $"
 
 maxusers	64		# estimated number of users
 
@@ -131,10 +131,6 @@ options 	BIOHIST		# kernhist for buff I/
 makeoptions	KCOV=1
 options		KCOV
 
-# Heartbeat checks
-options 	HEARTBEAT
-options 	HEARTBEAT_MAX_PERIOD_DEFAULT=15
-
 # Compatibility options
 include 	"conf/compat_netbsd09.config"
 options 	COMPAT_NOMID	# NetBSD 0.8, 386BSD, and BSDI

Index: src/sys/arch/i386/conf/GENERIC
diff -u src/sys/arch/i386/conf/GENERIC:1.1248 src/sys/arch/i386/conf/GENERIC:1.1249
--- src/sys/arch/i386/conf/GENERIC:1.1248	Sat Jul 15 22:14:39 2023
+++ src/sys/arch/i386/conf/GENERIC	Sun Jul 16 05:24:08 2023
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.1248 2023/07/15 22:14:39 riastradh Exp $
+# $NetBSD: GENERIC,v 1.1249 2023/07/16 05:24:08 mrg Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.1248 $"
+#ident		"GENERIC-$Revision: 1.1249 $"
 
 maxusers	64		# estimated number of users
 
@@ -140,10 +140,6 @@ options 	KDTRACE_HOOKS	# kernel DTrace h
 #makeoptions	KCOV=1
 #options 	KCOV
 
-# Heartbeat checks
-options 	HEARTBEAT
-options 	HEARTBEAT_MAX_PERIOD_DEFAULT=15
-
 # Compatibility options
 include 	"conf/compat_netbsd09.config"
 #options 	COMPAT_386BSD_MBRPART # recognize old partition ID



CVS commit: src/sys/arch/i386/conf

2023-07-15 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Jul 16 05:24:08 UTC 2023

Modified Files:
src/sys/arch/i386/conf: ALL GENERIC

Log Message:
revert previous change to enable HEARTBEAT.

the new code has a "needs 64-bit atomic ops" trigger:

ci->ci_heartbeat_uptime_cache = atomic_load_relaxed(_uptime);

but time_uptime is a 64-bit value, and this trips CTASSERT().


To generate a diff of this commit:
cvs rdiff -u -r1.508 -r1.509 src/sys/arch/i386/conf/ALL
cvs rdiff -u -r1.1248 -r1.1249 src/sys/arch/i386/conf/GENERIC

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/conf

2023-07-15 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jul 15 22:13:27 UTC 2023

Modified Files:
src/sys/arch/i386/conf: ALL

Log Message:
i386/ALL: Enable HEARTBEAT.


To generate a diff of this commit:
cvs rdiff -u -r1.507 -r1.508 src/sys/arch/i386/conf/ALL

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/conf

2023-07-15 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jul 15 22:13:27 UTC 2023

Modified Files:
src/sys/arch/i386/conf: ALL

Log Message:
i386/ALL: Enable HEARTBEAT.


To generate a diff of this commit:
cvs rdiff -u -r1.507 -r1.508 src/sys/arch/i386/conf/ALL

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/conf/ALL
diff -u src/sys/arch/i386/conf/ALL:1.507 src/sys/arch/i386/conf/ALL:1.508
--- src/sys/arch/i386/conf/ALL:1.507	Mon May 22 16:28:25 2023
+++ src/sys/arch/i386/conf/ALL	Sat Jul 15 22:13:27 2023
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.507 2023/05/22 16:28:25 riastradh Exp $
+# $NetBSD: ALL,v 1.508 2023/07/15 22:13:27 riastradh Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"ALL-$Revision: 1.507 $"
+#ident		"ALL-$Revision: 1.508 $"
 
 maxusers	64		# estimated number of users
 
@@ -131,6 +131,10 @@ options 	BIOHIST		# kernhist for buff I/
 makeoptions	KCOV=1
 options		KCOV
 
+# Heartbeat checks
+options 	HEARTBEAT
+options 	HEARTBEAT_MAX_PERIOD_DEFAULT=15
+
 # Compatibility options
 include 	"conf/compat_netbsd09.config"
 options 	COMPAT_NOMID	# NetBSD 0.8, 386BSD, and BSDI



Re: CVS commit: src/sys/arch/i386/stand/bootxx

2023-06-29 Thread Greg Troxel
Emmanuel Dreyfus  writes:

> On Thu, Jun 29, 2023 at 08:43:36PM -0400, Greg Troxel wrote:
>> > Primary bootstrap is now able to read a GPT inside RAIDframe.
>> did you also update documentation?
>
> We do not have any documentation specific to primary bootstrap. 
> x86/boot(8) domuent the behavior with no detail about primary
> and secondary bootstrap distinct roles.
>
> The change makes primary bootstrap behavior in line with secondary
> bootstrap and with what is already documented in x86/boot(8). Hence
> there is no documentation update, we could consider it as a bug fix, 
> since the previosu behavior did not match x86/boot(8) documentation.

Thank you for explaining.  That sounds fine then.


Re: CVS commit: src/sys/arch/i386/stand/bootxx

2023-06-29 Thread Emmanuel Dreyfus
On Thu, Jun 29, 2023 at 08:43:36PM -0400, Greg Troxel wrote:
> > Primary bootstrap is now able to read a GPT inside RAIDframe.
> did you also update documentation?

We do not have any documentation specific to primary bootstrap. 
x86/boot(8) domuent the behavior with no detail about primary
and secondary bootstrap distinct roles.

The change makes primary bootstrap behavior in line with secondary
bootstrap and with what is already documented in x86/boot(8). Hence
there is no documentation update, we could consider it as a bug fix, 
since the previosu behavior did not match x86/boot(8) documentation.

-- 
Emmanuel Dreyfus
m...@netbsd.org


Re: CVS commit: src/sys/arch/i386/stand/bootxx

2023-06-29 Thread Greg Troxel
"Emmanuel Dreyfus"  writes:

> Log Message:
> Primary bootstrap is now able to read a GPT inside RAIDframe.

did you also update documentation?


CVS commit: src/sys/arch/i386/stand/bootxx

2023-06-29 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Thu Jun 29 14:18:58 UTC 2023

Modified Files:
src/sys/arch/i386/stand/bootxx: boot1.c

Log Message:
Primary bootstrap is now able to read a GPT inside RAIDframe.

Previously, primary bootstrap was able to boot on RAID-1 RAIDframe set
with the limitation that the FFS filesystem had to start at bloc 0 in the
RAID. That allowed inner RAID partitionning with a disklabel, but not with
a GPT.

When booting on a RAID-1 RAIDframe, primary bootstrap now first try a
filesystem at bloc 0 of the RAID as before. On failure, it tries to
read a GPT and load secondary bootstrap from, by priority;
1) the first partition with the bootme attribute set
2) the first partition of type FFS, LFS, CCD or CGD
3) the first partition present in the GPT


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/i386/stand/bootxx/boot1.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/bootxx/boot1.c
diff -u src/sys/arch/i386/stand/bootxx/boot1.c:1.21 src/sys/arch/i386/stand/bootxx/boot1.c:1.22
--- src/sys/arch/i386/stand/bootxx/boot1.c:1.21	Thu Jun 24 01:23:16 2021
+++ src/sys/arch/i386/stand/bootxx/boot1.c	Thu Jun 29 14:18:58 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot1.c,v 1.21 2021/06/24 01:23:16 gutteridge Exp $	*/
+/*	$NetBSD: boot1.c,v 1.22 2023/06/29 14:18:58 manu Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -30,15 +30,17 @@
  */
 
 #include 
-__RCSID("$NetBSD: boot1.c,v 1.21 2021/06/24 01:23:16 gutteridge Exp $");
+__RCSID("$NetBSD: boot1.c,v 1.22 2023/06/29 14:18:58 manu Exp $");
 
 #include 
 #include 
 #include 
 
 #include 
+#include 
 #include 
 #include 
+#include 
 #include 	/* For RF_PROTECTED_SECTORS */
 
 #define XSTR(x) #x
@@ -49,6 +51,9 @@ static daddr_t bios_sector;
 static struct biosdisk_ll d;
 
 const char *boot1(uint32_t, uint64_t *);
+#ifndef NO_GPT
+static daddr_t gpt_lookup(daddr_t);
+#endif
 extern void putstr(const char *);
 
 extern struct disklabel ptn_disklabel;
@@ -90,6 +95,17 @@ boot1(uint32_t biosdev, uint64_t *sector
 	fd = ob();
 	if (fd != -1)
 		goto done;
+
+#ifndef NO_GPT
+	/*
+	 * Test for a GPT inside the RAID
+	 */
+	bios_sector += gpt_lookup(bios_sector);
+	fd = ob();
+	if (fd != -1)
+		goto done;
+#endif
+
 	/*
 	 * Nothing at the start of the MBR partition, fallback on
 	 * partition 'a' from the disklabel in this MBR partition.
@@ -144,3 +160,146 @@ blkdevstrategy(void *devdata, int flag, 
 
 	return 0;
 }
+
+#ifndef NO_GPT
+static int
+is_unused(struct gpt_ent *ent)
+{
+	const struct uuid unused = GPT_ENT_TYPE_UNUSED;
+
+	return (memcmp(ent->ent_type, , sizeof(unused)) == 0);
+}
+
+static int
+is_bootable(struct gpt_ent *ent)
+{
+	/* GPT_ENT_TYPE_NETBSD_RAID omitted as we are already in a RAID */
+	const struct uuid bootable[] = {
+		GPT_ENT_TYPE_NETBSD_FFS,
+		GPT_ENT_TYPE_NETBSD_LFS,
+		GPT_ENT_TYPE_NETBSD_CCD,
+		GPT_ENT_TYPE_NETBSD_CGD,
+	};
+	int i;
+
+	for (i = 0; i < sizeof(bootable) / sizeof(*bootable); i++) {
+		if (memcmp(ent->ent_type, [i],
+		sizeof(struct uuid)) == 0)
+			return 1;
+	}
+
+	return 0;
+}
+
+static daddr_t
+gpt_lookup(daddr_t sector)
+{
+	char buf[BIOSDISK_DEFAULT_SECSIZE];
+	struct mbr_sector *pmbr;	
+	const char gpt_hdr_sig[] = GPT_HDR_SIG;
+	struct gpt_hdr *hdr;
+	struct gpt_ent *ent;
+	uint32_t nents;
+	uint32_t entsz;
+	uint32_t entries_per_sector;
+	uint32_t sectors_per_entry;
+	uint64_t firstpart_lba = 0;
+	uint64_t bootable_lba = 0;
+	uint64_t bootme_lba = 0;
+	int i, j;
+
+	/*
+	 * Look for a PMBR
+	 */
+	if (readsects(, sector, 1, buf, 1) != 0)
+		return 0;
+
+	pmbr = (struct mbr_sector *)buf;
+
+	if (pmbr->mbr_magic != htole16(MBR_MAGIC))
+		return 0;
+
+	if (pmbr->mbr_parts[0].mbrp_type != MBR_PTYPE_PMBR)
+		return 0;
+
+	sector++; /* skip PMBR */
+
+	/*
+	 * Look for a GPT header
+	 * Space is scarce, we do not check CRC.
+	 */
+	if (readsects(, sector, 1, buf, 1) != 0)
+		return 0;
+
+	hdr = (struct gpt_hdr *)buf;
+
+	if (memcmp(gpt_hdr_sig, hdr->hdr_sig, sizeof(hdr->hdr_sig)) != 0)
+		return 0;
+
+	if (hdr->hdr_revision != htole32(GPT_HDR_REVISION))
+		return 0;
+
+	if (le32toh(hdr->hdr_size) > BIOSDISK_DEFAULT_SECSIZE)
+		return 0;
+
+	nents = le32toh(hdr->hdr_entries);
+	entsz = le32toh(hdr->hdr_entsz);
+
+	sector++; /* skip GPT header */
+
+	/*
+	 * Read partition table
+	 *
+	 * According to UEFI specification section 5.3.2, entries
+	 * are 128 * (2^n) bytes long. The most common scenario is
+	 * 128 bytes (n = 0) where there are 4 entries per sector.
+	 * If n > 2, then entries spans multiple sectors, but they
+	 * remain sector-aligned.
+	 */
+	entries_per_sector = BIOSDISK_DEFAULT_SECSIZE / entsz;
+	if (entries_per_sector == 0)
+		entries_per_sector = 1;
+
+	sectors_per_entry = entsz / BIOSDISK_DEFAULT_SECSIZE;
+	if (sectors_per_entry == 0)
+		sectors_per_entry = 1;
+
+	for (i = 0; i < nents; i += entries_per_sector) {
+	

CVS commit: src/sys/arch/i386/stand/bootxx

2023-06-29 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Thu Jun 29 14:18:58 UTC 2023

Modified Files:
src/sys/arch/i386/stand/bootxx: boot1.c

Log Message:
Primary bootstrap is now able to read a GPT inside RAIDframe.

Previously, primary bootstrap was able to boot on RAID-1 RAIDframe set
with the limitation that the FFS filesystem had to start at bloc 0 in the
RAID. That allowed inner RAID partitionning with a disklabel, but not with
a GPT.

When booting on a RAID-1 RAIDframe, primary bootstrap now first try a
filesystem at bloc 0 of the RAID as before. On failure, it tries to
read a GPT and load secondary bootstrap from, by priority;
1) the first partition with the bootme attribute set
2) the first partition of type FFS, LFS, CCD or CGD
3) the first partition present in the GPT


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/i386/stand/bootxx/boot1.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/stand/efiboot

2023-06-20 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Jun 20 07:46:03 UTC 2023

Modified Files:
src/sys/arch/i386/stand/efiboot: devopen.c

Log Message:
``int i'' is used only for SUPPORT_NFS || SUPPORT_TFTP.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/i386/stand/efiboot/devopen.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/stand/efiboot

2023-06-20 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Jun 20 07:46:03 UTC 2023

Modified Files:
src/sys/arch/i386/stand/efiboot: devopen.c

Log Message:
``int i'' is used only for SUPPORT_NFS || SUPPORT_TFTP.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/i386/stand/efiboot/devopen.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/devopen.c
diff -u src/sys/arch/i386/stand/efiboot/devopen.c:1.13 src/sys/arch/i386/stand/efiboot/devopen.c:1.14
--- src/sys/arch/i386/stand/efiboot/devopen.c:1.13	Mon Dec 27 12:19:27 2021
+++ src/sys/arch/i386/stand/efiboot/devopen.c	Tue Jun 20 07:46:03 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: devopen.c,v 1.13 2021/12/27 12:19:27 simonb Exp $	 */
+/*	$NetBSD: devopen.c,v 1.14 2023/06/20 07:46:03 rin Exp $	 */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -154,13 +154,13 @@ devopen(struct open_file *f, const char 
 	const char *xname = NULL;
 	int unit, partition;
 	int biosdev;
-	int i, error;
+	int error;
 #if defined(SUPPORT_NFS) || defined(SUPPORT_TFTP)
 	struct devdesc desc;
 	const struct netboot_fstab *nf;
 	char *filename;
 	size_t fsnamelen;
-	int n;
+	int i, n;
 #endif
 
 	error = parsebootfile(fname, , , , ,



CVS commit: src/sys/arch/i386/stand/efiboot/bootia32

2023-06-18 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jun 19 04:30:27 UTC 2023

Modified Files:
src/sys/arch/i386/stand/efiboot/bootia32: efibootia32.c

Log Message:
whitespace -> tab, blank line, no binary changes.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 \
src/sys/arch/i386/stand/efiboot/bootia32/efibootia32.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/bootia32/efibootia32.c
diff -u src/sys/arch/i386/stand/efiboot/bootia32/efibootia32.c:1.7 src/sys/arch/i386/stand/efiboot/bootia32/efibootia32.c:1.8
--- src/sys/arch/i386/stand/efiboot/bootia32/efibootia32.c:1.7	Sun May 14 09:07:54 2023
+++ src/sys/arch/i386/stand/efiboot/bootia32/efibootia32.c	Mon Jun 19 04:30:27 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: efibootia32.c,v 1.7 2023/05/14 09:07:54 riastradh Exp $	*/
+/*	$NetBSD: efibootia32.c,v 1.8 2023/06/19 04:30:27 rin Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -57,16 +57,15 @@ efi_md_init(void)
 	startprog32 = (void *)(u_long)addr;
 	CopyMem(startprog32, startprog32_start, startprog32_size);
 
-addr = EFI_ALLOCATE_MAX_ADDRESS;
-sz = EFI_SIZE_TO_PAGES(multiboot32_size);
-status = uefi_call_wrapper(BS->AllocatePages, 4, AllocateMaxAddress,
-EfiLoaderData, sz, );
-if (EFI_ERROR(status))
-panic("%s: AllocatePages() failed: %d page(s): %" PRIxMAX,
-__func__, sz, (uintmax_t)status);
-multiboot32 = (void *)(u_long)addr;
-CopyMem(multiboot32, multiboot32_start, multiboot32_size);
-
+	addr = EFI_ALLOCATE_MAX_ADDRESS;
+	sz = EFI_SIZE_TO_PAGES(multiboot32_size);
+	status = uefi_call_wrapper(BS->AllocatePages, 4, AllocateMaxAddress,
+	EfiLoaderData, sz, );
+	if (EFI_ERROR(status))
+		panic("%s: AllocatePages() failed: %d page(s): %" PRIxMAX,
+		__func__, sz, (uintmax_t)status);
+	multiboot32 = (void *)(u_long)addr;
+	CopyMem(multiboot32, multiboot32_start, multiboot32_size);
 }
 
 /* ARGSUSED */



CVS commit: src/sys/arch/i386/stand/efiboot/bootia32

2023-06-18 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jun 19 04:30:27 UTC 2023

Modified Files:
src/sys/arch/i386/stand/efiboot/bootia32: efibootia32.c

Log Message:
whitespace -> tab, blank line, no binary changes.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 \
src/sys/arch/i386/stand/efiboot/bootia32/efibootia32.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/conf

2023-05-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon May 22 16:28:34 UTC 2023

Modified Files:
src/sys/arch/i386/conf: GENERIC

Log Message:
i386/GENERIC: Enable EFI runtime support.

PR kern/57076

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.1246 -r1.1247 src/sys/arch/i386/conf/GENERIC

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/conf/GENERIC
diff -u src/sys/arch/i386/conf/GENERIC:1.1246 src/sys/arch/i386/conf/GENERIC:1.1247
--- src/sys/arch/i386/conf/GENERIC:1.1246	Thu Feb  9 14:09:48 2023
+++ src/sys/arch/i386/conf/GENERIC	Mon May 22 16:28:34 2023
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.1246 2023/02/09 14:09:48 abs Exp $
+# $NetBSD: GENERIC,v 1.1247 2023/05/22 16:28:34 riastradh Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.1246 $"
+#ident		"GENERIC-$Revision: 1.1247 $"
 
 maxusers	64		# estimated number of users
 
@@ -1504,9 +1504,9 @@ pseudo-device	cmos
 # userland interface to drivers, including autoconf and properties retrieval
 pseudo-device	drvctl
 
-# EFI runtime support -- not yet tested
-#options 	EFI_RUNTIME
-#pseudo-device 	efi			# /dev/efi
+# EFI runtime support
+options 	EFI_RUNTIME
+pseudo-device 	efi			# /dev/efi
 
 include "dev/veriexec.config"
 



CVS commit: src/sys/arch/i386/conf

2023-05-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon May 22 16:28:34 UTC 2023

Modified Files:
src/sys/arch/i386/conf: GENERIC

Log Message:
i386/GENERIC: Enable EFI runtime support.

PR kern/57076

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.1246 -r1.1247 src/sys/arch/i386/conf/GENERIC

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/conf

2023-05-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon May 22 16:28:25 UTC 2023

Modified Files:
src/sys/arch/i386/conf: ALL

Log Message:
i386/ALL: Enable EFI runtime support.

PR kern/57076

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.506 -r1.507 src/sys/arch/i386/conf/ALL

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/conf/ALL
diff -u src/sys/arch/i386/conf/ALL:1.506 src/sys/arch/i386/conf/ALL:1.507
--- src/sys/arch/i386/conf/ALL:1.506	Thu Feb  9 14:09:48 2023
+++ src/sys/arch/i386/conf/ALL	Mon May 22 16:28:25 2023
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.506 2023/02/09 14:09:48 abs Exp $
+# $NetBSD: ALL,v 1.507 2023/05/22 16:28:25 riastradh Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"ALL-$Revision: 1.506 $"
+#ident		"ALL-$Revision: 1.507 $"
 
 maxusers	64		# estimated number of users
 
@@ -1810,9 +1810,9 @@ pseudo-device	pad
 # userland interface to drivers, including autoconf and properties retrieval
 pseudo-device	drvctl
 
-# EFI runtime support -- doesn't build yet
-#options 	EFI_RUNTIME
-#pseudo-device 	efi			# /dev/efi
+# EFI runtime support
+options 	EFI_RUNTIME
+pseudo-device 	efi			# /dev/efi
 
 # Pass-to-Userspace Transporter
 pseudo-device	putter



CVS commit: src/sys/arch/i386/conf

2023-05-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon May 22 16:28:25 UTC 2023

Modified Files:
src/sys/arch/i386/conf: ALL

Log Message:
i386/ALL: Enable EFI runtime support.

PR kern/57076

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.506 -r1.507 src/sys/arch/i386/conf/ALL

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/stand/efiboot

2023-05-14 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun May 14 09:07:54 UTC 2023

Modified Files:
src/sys/arch/i386/stand/efiboot: boot.c efidisk.c efimemory.c
src/sys/arch/i386/stand/efiboot/bootia32: efibootia32.c

Log Message:
x86/efiboot: Nix trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/i386/stand/efiboot/boot.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/i386/stand/efiboot/efidisk.c \
src/sys/arch/i386/stand/efiboot/efimemory.c
cvs rdiff -u -r1.6 -r1.7 \
src/sys/arch/i386/stand/efiboot/bootia32/efibootia32.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/boot.c
diff -u src/sys/arch/i386/stand/efiboot/boot.c:1.22 src/sys/arch/i386/stand/efiboot/boot.c:1.23
--- src/sys/arch/i386/stand/efiboot/boot.c:1.22	Thu Apr 20 00:42:24 2023
+++ src/sys/arch/i386/stand/efiboot/boot.c	Sun May 14 09:07:54 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.c,v 1.22 2023/04/20 00:42:24 manu Exp $	*/
+/*	$NetBSD: boot.c,v 1.23 2023/05/14 09:07:54 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -483,7 +483,7 @@ command_dev(char *arg)
 	if (*arg == '\0') {
 		efi_disk_show();
 		efi_net_show();
-	
+
 		if (default_part_name != NULL)
 			printf("default NAME=%s\n", default_part_name);
 		else
@@ -647,7 +647,7 @@ void
 command_reloc(char *arg)
 {
 	char *ep;
-	
+
 	if (*arg == '\0') {
 		switch (efi_reloc_type) {
 		case RELOC_NONE:

Index: src/sys/arch/i386/stand/efiboot/efidisk.c
diff -u src/sys/arch/i386/stand/efiboot/efidisk.c:1.9 src/sys/arch/i386/stand/efiboot/efidisk.c:1.10
--- src/sys/arch/i386/stand/efiboot/efidisk.c:1.9	Tue Dec 17 01:37:52 2019
+++ src/sys/arch/i386/stand/efiboot/efidisk.c	Sun May 14 09:07:54 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: efidisk.c,v 1.9 2019/12/17 01:37:52 manu Exp $	*/
+/*	$NetBSD: efidisk.c,v 1.10 2023/05/14 09:07:54 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -70,9 +70,9 @@ dealloc_biosdisk_part(struct biosdisk_pa
 			part[i].part_name = NULL;
 		}
 	}
-	
+
 	dealloc(part, sizeof(*part) * nparts);
-	
+
 	return;
 }
 
@@ -194,7 +194,6 @@ efi_raidframe_probe(struct efi_raidframe
 	return;
 }
 
-
 void
 efi_disk_show(void)
 {
@@ -293,7 +292,7 @@ efi_disk_show(void)
 		raidframe[i].size,
 		, ))
 			continue;
-			
+
 		first = 1;
 		for (j = 0; j < nparts; j++) {
 			bool bootme = part[j].attr & GPT_ENT_ATTR_BOOTME;
Index: src/sys/arch/i386/stand/efiboot/efimemory.c
diff -u src/sys/arch/i386/stand/efiboot/efimemory.c:1.9 src/sys/arch/i386/stand/efiboot/efimemory.c:1.10
--- src/sys/arch/i386/stand/efiboot/efimemory.c:1.9	Fri Sep 13 02:19:45 2019
+++ src/sys/arch/i386/stand/efiboot/efimemory.c	Sun May 14 09:07:54 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: efimemory.c,v 1.9 2019/09/13 02:19:45 manu Exp $	*/
+/*	$NetBSD: efimemory.c,v 1.10 2023/05/14 09:07:54 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -221,7 +221,7 @@ efi_memory_get_memmap(struct bi_memmap_e
 
 		next = NextMemoryDescriptor(md, DescriptorSize);
 	}
-	
+
 	*memmapp = memmap;
 	*num = NoEntries;
 	return 0;

Index: src/sys/arch/i386/stand/efiboot/bootia32/efibootia32.c
diff -u src/sys/arch/i386/stand/efiboot/bootia32/efibootia32.c:1.6 src/sys/arch/i386/stand/efiboot/bootia32/efibootia32.c:1.7
--- src/sys/arch/i386/stand/efiboot/bootia32/efibootia32.c:1.6	Thu Apr 20 00:42:24 2023
+++ src/sys/arch/i386/stand/efiboot/bootia32/efibootia32.c	Sun May 14 09:07:54 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: efibootia32.c,v 1.6 2023/04/20 00:42:24 manu Exp $	*/
+/*	$NetBSD: efibootia32.c,v 1.7 2023/05/14 09:07:54 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -60,7 +60,7 @@ efi_md_init(void)
 addr = EFI_ALLOCATE_MAX_ADDRESS;
 sz = EFI_SIZE_TO_PAGES(multiboot32_size);
 status = uefi_call_wrapper(BS->AllocatePages, 4, AllocateMaxAddress,
-EfiLoaderData, sz, ); 
+EfiLoaderData, sz, );
 if (EFI_ERROR(status))
 panic("%s: AllocatePages() failed: %d page(s): %" PRIxMAX,
 __func__, sz, (uintmax_t)status);



CVS commit: src/sys/arch/i386/stand/efiboot

2023-05-14 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun May 14 09:07:54 UTC 2023

Modified Files:
src/sys/arch/i386/stand/efiboot: boot.c efidisk.c efimemory.c
src/sys/arch/i386/stand/efiboot/bootia32: efibootia32.c

Log Message:
x86/efiboot: Nix trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/i386/stand/efiboot/boot.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/i386/stand/efiboot/efidisk.c \
src/sys/arch/i386/stand/efiboot/efimemory.c
cvs rdiff -u -r1.6 -r1.7 \
src/sys/arch/i386/stand/efiboot/bootia32/efibootia32.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/stand/efiboot

2023-05-09 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Wed May 10 00:49:17 UTC 2023

Modified Files:
src/sys/arch/i386/stand/efiboot: version

Log Message:
Raise the version for new feature (here reloc command)
Suggested by Masanobu SAITOH


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/stand/efiboot/version

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/version
diff -u src/sys/arch/i386/stand/efiboot/version:1.2 src/sys/arch/i386/stand/efiboot/version:1.3
--- src/sys/arch/i386/stand/efiboot/version:1.2	Sat Aug  3 08:13:36 2019
+++ src/sys/arch/i386/stand/efiboot/version	Wed May 10 00:49:17 2023
@@ -1,4 +1,4 @@
-$NetBSD: version,v 1.2 2019/08/03 08:13:36 nonaka Exp $
+$NetBSD: version,v 1.3 2023/05/10 00:49:17 manu 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
@@ -6,3 +6,4 @@ is taken as the current.
 
 1.0:	Initial version.
 1.1:	Add CD/DVD-ROM, serial, PXE boot and UEFI memory map compaction support.
+1.2:	Add reloc command



CVS commit: src/sys/arch/i386/stand/efiboot

2023-05-09 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Wed May 10 00:49:17 UTC 2023

Modified Files:
src/sys/arch/i386/stand/efiboot: version

Log Message:
Raise the version for new feature (here reloc command)
Suggested by Masanobu SAITOH


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/stand/efiboot/version

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/include

2023-04-09 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Apr  9 08:18:03 UTC 2023

Modified Files:
src/sys/arch/i386/include: cpu.h

Log Message:
i386: Make curlwp and curcpu() flushable.

The only effect of the `volatile' qualifier on an asm block with
outputs is to force the instructions to appear in the generated code,
even if the outputs end up being unused.  Since these instructions
have no (architectural) side effects -- provided %fs is set
correctly, which must be the case here -- there's no need for the
volatile qualifier, so nix it.


To generate a diff of this commit:
cvs rdiff -u -r1.183 -r1.184 src/sys/arch/i386/include/cpu.h

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/include/cpu.h
diff -u src/sys/arch/i386/include/cpu.h:1.183 src/sys/arch/i386/include/cpu.h:1.184
--- src/sys/arch/i386/include/cpu.h:1.183	Tue Nov  2 11:26:04 2021
+++ src/sys/arch/i386/include/cpu.h	Sun Apr  9 08:18:03 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.183 2021/11/02 11:26:04 ryo Exp $	*/
+/*	$NetBSD: cpu.h,v 1.184 2023/04/09 08:18:03 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -50,7 +50,7 @@ x86_curcpu(void)
 {
 	struct cpu_info *ci;
 
-	__asm volatile("movl %%fs:%1, %0" :
+	__asm("movl %%fs:%1, %0" :
 	"=r" (ci) :
 	"m"
 	(*(struct cpu_info * const *)offsetof(struct cpu_info, ci_self)));
@@ -62,7 +62,7 @@ x86_curlwp(void)
 {
 	lwp_t *l;
 
-	__asm volatile("movl %%fs:%1, %0" :
+	__asm("movl %%fs:%1, %0" :
 	"=r" (l) :
 	"m"
 	(*(struct cpu_info * const *)offsetof(struct cpu_info, ci_curlwp)));



CVS commit: src/sys/arch/i386/include

2023-04-09 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Apr  9 08:18:03 UTC 2023

Modified Files:
src/sys/arch/i386/include: cpu.h

Log Message:
i386: Make curlwp and curcpu() flushable.

The only effect of the `volatile' qualifier on an asm block with
outputs is to force the instructions to appear in the generated code,
even if the outputs end up being unused.  Since these instructions
have no (architectural) side effects -- provided %fs is set
correctly, which must be the case here -- there's no need for the
volatile qualifier, so nix it.


To generate a diff of this commit:
cvs rdiff -u -r1.183 -r1.184 src/sys/arch/i386/include/cpu.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/i386

2023-03-03 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Mar  3 14:32:27 UTC 2023

Modified Files:
src/sys/arch/i386/i386: genassym.cf locore.S

Log Message:
Revert "x86: Add kthread_fpu_enter/exit support, take two -- forgot i386 bits."

kthread_fpu_enter/exit changes broke some hardware, unclear why, to
investigate before fixing and reapplying these changes.


To generate a diff of this commit:
cvs rdiff -u -r1.132 -r1.133 src/sys/arch/i386/i386/genassym.cf
cvs rdiff -u -r1.193 -r1.194 src/sys/arch/i386/i386/locore.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/i386

2023-03-03 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Mar  3 14:32:27 UTC 2023

Modified Files:
src/sys/arch/i386/i386: genassym.cf locore.S

Log Message:
Revert "x86: Add kthread_fpu_enter/exit support, take two -- forgot i386 bits."

kthread_fpu_enter/exit changes broke some hardware, unclear why, to
investigate before fixing and reapplying these changes.


To generate a diff of this commit:
cvs rdiff -u -r1.132 -r1.133 src/sys/arch/i386/i386/genassym.cf
cvs rdiff -u -r1.193 -r1.194 src/sys/arch/i386/i386/locore.S

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/i386/genassym.cf
diff -u src/sys/arch/i386/i386/genassym.cf:1.132 src/sys/arch/i386/i386/genassym.cf:1.133
--- src/sys/arch/i386/i386/genassym.cf:1.132	Sat Feb 25 18:35:54 2023
+++ src/sys/arch/i386/i386/genassym.cf	Fri Mar  3 14:32:27 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.132 2023/02/25 18:35:54 riastradh Exp $
+#	$NetBSD: genassym.cf,v 1.133 2023/03/03 14:32:27 riastradh Exp $
 
 #
 # Copyright (c) 1998, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -175,7 +175,6 @@ define	L_MD_FLAGS		offsetof(struct lwp, 
 define	L_MD_ASTPENDING		offsetof(struct lwp, l_md.md_astpending)
 
 define	LW_SYSTEM		LW_SYSTEM
-define	LW_SYSTEM_FPU		LW_SYSTEM_FPU
 define	MDL_FPU_IN_CPU		MDL_FPU_IN_CPU
 
 define	P_FLAG			offsetof(struct proc, p_flag)

Index: src/sys/arch/i386/i386/locore.S
diff -u src/sys/arch/i386/i386/locore.S:1.193 src/sys/arch/i386/i386/locore.S:1.194
--- src/sys/arch/i386/i386/locore.S:1.193	Wed Mar  1 08:38:50 2023
+++ src/sys/arch/i386/i386/locore.S	Fri Mar  3 14:32:27 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.193 2023/03/01 08:38:50 riastradh Exp $	*/
+/*	$NetBSD: locore.S,v 1.194 2023/03/03 14:32:27 riastradh Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -128,7 +128,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.193 2023/03/01 08:38:50 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.194 2023/03/03 14:32:27 riastradh Exp $");
 
 #include "opt_copy_symtab.h"
 #include "opt_ddb.h"
@@ -1471,7 +1471,7 @@ ENTRY(cpu_switchto)
 
 	/* Don't bother with the rest if switching to a system process. */
 	testl	$LW_SYSTEM,L_FLAG(%edi)
-	jnz	.Lswitch_system
+	jnz	switch_return
 
 #ifndef XENPV
 	/* Restore thread-private %fs/%gs descriptors. */
@@ -1525,21 +1525,6 @@ switch_return:
 	popl	%ebx
 	ret
 
-.Lswitch_system:
-	/*
-	 * If it has LWP_SYSTEM_FPU set, meaning it's running in
-	 * kthread_fpu_enter/exit, we need to restore the FPU state
-	 * and enable FPU instructions with fpu_handle_deferred.
-	 *
-	 * No need to test MDL_FPU_IN_CPU via HANDLE_DEFERRED_FPU --
-	 * fpu_switch guarantees it is clear, so we can just call
-	 * fpu_handle_deferred unconditionally.
-	 */
-	testl	$LW_SYSTEM_FPU,L_FLAG(%edi)
-	jz	switch_return
-	call	_C_LABEL(fpu_handle_deferred)
-	jmp	switch_return
-
 .Lcopy_iobitmap:
 	/* Copy I/O bitmap. */
 	incl	_C_LABEL(pmap_iobmp_evcnt)+EV_COUNT



CVS commit: src/sys/arch/i386/i386

2023-02-25 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Feb 25 18:35:54 UTC 2023

Modified Files:
src/sys/arch/i386/i386: genassym.cf locore.S

Log Message:
x86: Add kthread_fpu_enter/exit support, take two -- forgot i386 bits.


To generate a diff of this commit:
cvs rdiff -u -r1.131 -r1.132 src/sys/arch/i386/i386/genassym.cf
cvs rdiff -u -r1.191 -r1.192 src/sys/arch/i386/i386/locore.S

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/i386/genassym.cf
diff -u src/sys/arch/i386/i386/genassym.cf:1.131 src/sys/arch/i386/i386/genassym.cf:1.132
--- src/sys/arch/i386/i386/genassym.cf:1.131	Tue Dec 27 08:40:40 2022
+++ src/sys/arch/i386/i386/genassym.cf	Sat Feb 25 18:35:54 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.131 2022/12/27 08:40:40 msaitoh Exp $
+#	$NetBSD: genassym.cf,v 1.132 2023/02/25 18:35:54 riastradh Exp $
 
 #
 # Copyright (c) 1998, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -175,6 +175,7 @@ define	L_MD_FLAGS		offsetof(struct lwp, 
 define	L_MD_ASTPENDING		offsetof(struct lwp, l_md.md_astpending)
 
 define	LW_SYSTEM		LW_SYSTEM
+define	LW_SYSTEM_FPU		LW_SYSTEM_FPU
 define	MDL_FPU_IN_CPU		MDL_FPU_IN_CPU
 
 define	P_FLAG			offsetof(struct proc, p_flag)

Index: src/sys/arch/i386/i386/locore.S
diff -u src/sys/arch/i386/i386/locore.S:1.191 src/sys/arch/i386/i386/locore.S:1.192
--- src/sys/arch/i386/i386/locore.S:1.191	Fri Feb  3 09:21:58 2023
+++ src/sys/arch/i386/i386/locore.S	Sat Feb 25 18:35:54 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.191 2023/02/03 09:21:58 mlelstv Exp $	*/
+/*	$NetBSD: locore.S,v 1.192 2023/02/25 18:35:54 riastradh Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -128,7 +128,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.191 2023/02/03 09:21:58 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.192 2023/02/25 18:35:54 riastradh Exp $");
 
 #include "opt_copy_symtab.h"
 #include "opt_ddb.h"
@@ -1447,7 +1447,7 @@ ENTRY(cpu_switchto)
 
 	/* Don't bother with the rest if switching to a system process. */
 	testl	$LW_SYSTEM,L_FLAG(%edi)
-	jnz	switch_return
+	jnz	.Lswitch_system
 
 #ifndef XENPV
 	/* Restore thread-private %fs/%gs descriptors. */
@@ -1501,6 +1501,21 @@ switch_return:
 	popl	%ebx
 	ret
 
+.Lswitch_system:
+	/*
+	 * If it has LWP_SYSTEM_FPU set, meaning it's running in
+	 * kthread_fpu_enter/exit, we need to restore the FPU state
+	 * and enable FPU instructions with fpu_handle_deferred.
+	 *
+	 * No need to test MDL_FPU_IN_CPU via HANDLE_DEFERRED_FPU --
+	 * fpu_switch guarantees it is clear, so we can just call
+	 * fpu_handle_deferred unconditionally.
+	 */
+	testl	$LW_SYSTEM_FPU,L_FLAG(%edi)
+	jz	switch_return
+	call	_C_LABEL(fpu_handle_deferred)
+	jmp	switch_return
+
 .Lcopy_iobitmap:
 	/* Copy I/O bitmap. */
 	incl	_C_LABEL(pmap_iobmp_evcnt)+EV_COUNT



CVS commit: src/sys/arch/i386/i386

2023-02-25 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Feb 25 18:35:54 UTC 2023

Modified Files:
src/sys/arch/i386/i386: genassym.cf locore.S

Log Message:
x86: Add kthread_fpu_enter/exit support, take two -- forgot i386 bits.


To generate a diff of this commit:
cvs rdiff -u -r1.131 -r1.132 src/sys/arch/i386/i386/genassym.cf
cvs rdiff -u -r1.191 -r1.192 src/sys/arch/i386/i386/locore.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/i386

2023-02-25 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Feb 25 13:52:09 UTC 2023

Modified Files:
src/sys/arch/i386/i386: bioscall.S

Log Message:
i386/bioscall: Disable preemption while we load the kernel pmap.

Fixes crash on boot in new KASSERT(kpreempt_disabled()) in
cpu_load_pmap.

We could do KASSERT(kpreempt_disabled() || cold), but I don't know if
bioscall is ever reachable after warm boot; this way is safer.

XXX Would be nice if bioscall were a C function, not asm -- I don't
see any reason why we need it to be asm?


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/i386/i386/bioscall.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/i386

2023-02-25 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Feb 25 13:52:09 UTC 2023

Modified Files:
src/sys/arch/i386/i386: bioscall.S

Log Message:
i386/bioscall: Disable preemption while we load the kernel pmap.

Fixes crash on boot in new KASSERT(kpreempt_disabled()) in
cpu_load_pmap.

We could do KASSERT(kpreempt_disabled() || cold), but I don't know if
bioscall is ever reachable after warm boot; this way is safer.

XXX Would be nice if bioscall were a C function, not asm -- I don't
see any reason why we need it to be asm?


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/i386/i386/bioscall.S

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/i386/bioscall.S
diff -u src/sys/arch/i386/i386/bioscall.S:1.10 src/sys/arch/i386/i386/bioscall.S:1.11
--- src/sys/arch/i386/i386/bioscall.S:1.10	Sat Jul 14 14:29:40 2018
+++ src/sys/arch/i386/i386/bioscall.S	Sat Feb 25 13:52:09 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: bioscall.S,v 1.10 2018/07/14 14:29:40 maxv Exp $ */
+/*	$NetBSD: bioscall.S,v 1.11 2023/02/25 13:52:09 riastradh Exp $ */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bioscall.S,v 1.10 2018/07/14 14:29:40 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bioscall.S,v 1.11 2023/02/25 13:52:09 riastradh Exp $");
 
 #include 
 
@@ -67,6 +67,8 @@ ENTRY(bioscall)
 	pushl	%ebp
 	movl	%esp,%ebp		/* set up frame ptr */
 
+	call	_C_LABEL(kpreempt_disable)
+
 	/* install lwp0 pmap */
 	movl	_C_LABEL(kernel_pmap_ptr),%eax
 	pushl	%eax
@@ -85,5 +87,7 @@ ENTRY(bioscall)
 	call	_C_LABEL(cpu_load_pmap)
 	addl	$4,%esp
 
+	call	_C_LABEL(kpreempt_enable)
+
 	leave
 	ret



CVS commit: src/sys/arch/i386/i386

2023-02-03 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Fri Feb  3 09:21:58 UTC 2023

Modified Files:
src/sys/arch/i386/i386: locore.S

Log Message:
Make multiboot1 continue with common boot code and not skip CPU type
detection.

Fixes PR 57017 and PR 56935.


To generate a diff of this commit:
cvs rdiff -u -r1.190 -r1.191 src/sys/arch/i386/i386/locore.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/i386

2023-02-03 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Fri Feb  3 09:21:58 UTC 2023

Modified Files:
src/sys/arch/i386/i386: locore.S

Log Message:
Make multiboot1 continue with common boot code and not skip CPU type
detection.

Fixes PR 57017 and PR 56935.


To generate a diff of this commit:
cvs rdiff -u -r1.190 -r1.191 src/sys/arch/i386/i386/locore.S

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/i386/locore.S
diff -u src/sys/arch/i386/i386/locore.S:1.190 src/sys/arch/i386/i386/locore.S:1.191
--- src/sys/arch/i386/i386/locore.S:1.190	Wed Sep  7 00:40:18 2022
+++ src/sys/arch/i386/i386/locore.S	Fri Feb  3 09:21:58 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.190 2022/09/07 00:40:18 knakahara Exp $	*/
+/*	$NetBSD: locore.S,v 1.191 2023/02/03 09:21:58 mlelstv Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -128,7 +128,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.190 2022/09/07 00:40:18 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.191 2023/02/03 09:21:58 mlelstv Exp $");
 
 #include "opt_copy_symtab.h"
 #include "opt_ddb.h"
@@ -415,7 +415,7 @@ multiboot1_loader:
 	pushl	%ebx		/* Address of Multiboot information */
 	call	_C_LABEL(multiboot1_pre_reloc)
 	addl	$4,%esp
-	jmp	2f
+	jmp	.Lstart_common
 
 efi_multiboot2_loader:
 	/*



CVS commit: src/sys/arch/i386/stand

2023-01-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jan 18 12:28:55 UTC 2023

Modified Files:
src/sys/arch/i386/stand: Makefile.booters

Log Message:
Fix the clang build by setting -z noseparate-code


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/sys/arch/i386/stand/Makefile.booters

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/Makefile.booters
diff -u src/sys/arch/i386/stand/Makefile.booters:1.94 src/sys/arch/i386/stand/Makefile.booters:1.95
--- src/sys/arch/i386/stand/Makefile.booters:1.94	Sun Sep  6 03:20:28 2020
+++ src/sys/arch/i386/stand/Makefile.booters	Wed Jan 18 07:28:54 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.booters,v 1.94 2020/09/06 07:20:28 mrg Exp $
+#	$NetBSD: Makefile.booters,v 1.95 2023/01/18 12:28:54 christos Exp $
 
 NOLIBCSANITIZER=
 NOSANITIZER=
@@ -77,7 +77,7 @@ cleandir distclean: .WAIT cleanlibdir
 cleanlibdir:
 	-rm -rf lib
 
-LDFLAGS+=-Wl,-M -Wl,-e,start 	# -N does not work properly.
+LDFLAGS+=-Wl,-z,noseparate-code -Wl,-M -Wl,-e,start 	# -N does not work properly.
 
 LIBLIST=${LIBI386} ${LIBSA} ${LIBZ} ${LIBSA} ${LIBKERN} ${LIBI386} ${LIBSA}
 



CVS commit: src/sys/arch/i386/stand

2023-01-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jan 18 12:28:55 UTC 2023

Modified Files:
src/sys/arch/i386/stand: Makefile.booters

Log Message:
Fix the clang build by setting -z noseparate-code


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/sys/arch/i386/stand/Makefile.booters

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/i386

2022-12-26 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Dec 26 08:59:01 UTC 2022

Modified Files:
src/sys/arch/i386/i386: genassym.cf

Log Message:
Remove duplicated IPL_SCHED. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.127 src/sys/arch/i386/i386/genassym.cf

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/i386

2022-12-26 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Dec 26 08:59:01 UTC 2022

Modified Files:
src/sys/arch/i386/i386: genassym.cf

Log Message:
Remove duplicated IPL_SCHED. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.127 src/sys/arch/i386/i386/genassym.cf

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/i386/genassym.cf
diff -u src/sys/arch/i386/i386/genassym.cf:1.126 src/sys/arch/i386/i386/genassym.cf:1.127
--- src/sys/arch/i386/i386/genassym.cf:1.126	Wed Sep  7 00:40:18 2022
+++ src/sys/arch/i386/i386/genassym.cf	Mon Dec 26 08:59:01 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.126 2022/09/07 00:40:18 knakahara Exp $
+#	$NetBSD: genassym.cf,v 1.127 2022/12/26 08:59:01 msaitoh Exp $
 
 #
 # Copyright (c) 1998, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -321,7 +321,6 @@ define	IS_MASK_COUNT		offsetof(struct in
 define	IPL_NONE		IPL_NONE
 define	IPL_PREEMPT		IPL_PREEMPT
 define	IPL_NET			IPL_NET
-define	IPL_SCHED		IPL_SCHED
 define	IPL_CLOCK		IPL_CLOCK
 define	IPL_VM			IPL_VM
 define	IPL_SCHED		IPL_SCHED



CVS commit: src/sys/arch/i386/stand/efiboot

2022-12-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec 25 22:14:05 UTC 2022

Modified Files:
src/sys/arch/i386/stand/efiboot: Makefile.efiboot

Log Message:
Fix broken flag -nocombreloc, 2.34 did not complain for not understanding it,
but 2.39 wants -z nocombreloc. Is it really needed?


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/i386/stand/efiboot/Makefile.efiboot

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/stand/efiboot

2022-12-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec 25 22:14:05 UTC 2022

Modified Files:
src/sys/arch/i386/stand/efiboot: Makefile.efiboot

Log Message:
Fix broken flag -nocombreloc, 2.34 did not complain for not understanding it,
but 2.39 wants -z nocombreloc. Is it really needed?


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/i386/stand/efiboot/Makefile.efiboot

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/Makefile.efiboot
diff -u src/sys/arch/i386/stand/efiboot/Makefile.efiboot:1.19 src/sys/arch/i386/stand/efiboot/Makefile.efiboot:1.20
--- src/sys/arch/i386/stand/efiboot/Makefile.efiboot:1.19	Thu Nov 18 11:17:40 2021
+++ src/sys/arch/i386/stand/efiboot/Makefile.efiboot	Sun Dec 25 17:14:05 2022
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.efiboot,v 1.19 2021/11/18 16:17:40 manu Exp $
+# $NetBSD: Makefile.efiboot,v 1.20 2022/12/25 22:14:05 christos Exp $
 
 S=		${.CURDIR}/../../../../..
 
@@ -41,8 +41,8 @@ BINMODE=444
 .PATH:	${.CURDIR}/../../libsa
 
 LDSCRIPT?= ${.CURDIR}/ldscript
-LDFLAGS+= --no-dynamic-linker --noinhibit-exec
-LDFLAGS+= -nostdlib -T${LDSCRIPT} -Bsymbolic -shared -nocombreloc
+LDFLAGS+= --no-dynamic-linker --noinhibit-exec -z nocombreloc
+LDFLAGS+= -nostdlib -T${LDSCRIPT} -Bsymbolic -shared
 CPPFLAGS+= -I$S -I${.CURDIR} -I${.CURDIR}/.. -I$S/lib/libsa
 CPPFLAGS+= -I${.OBJDIR}
 CPPFLAGS+= -I${.CURDIR}/../../lib



CVS commit: src/sys/arch/i386/conf

2022-12-22 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Thu Dec 22 19:07:17 UTC 2022

Modified Files:
src/sys/arch/i386/conf: GENERIC

Log Message:
Add commented vio9p* to match amd64 GENERIC


To generate a diff of this commit:
cvs rdiff -u -r1.1243 -r1.1244 src/sys/arch/i386/conf/GENERIC

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/conf

2022-12-22 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Thu Dec 22 19:07:17 UTC 2022

Modified Files:
src/sys/arch/i386/conf: GENERIC

Log Message:
Add commented vio9p* to match amd64 GENERIC


To generate a diff of this commit:
cvs rdiff -u -r1.1243 -r1.1244 src/sys/arch/i386/conf/GENERIC

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/conf/GENERIC
diff -u src/sys/arch/i386/conf/GENERIC:1.1243 src/sys/arch/i386/conf/GENERIC:1.1244
--- src/sys/arch/i386/conf/GENERIC:1.1243	Sun Dec 11 04:20:52 2022
+++ src/sys/arch/i386/conf/GENERIC	Thu Dec 22 19:07:16 2022
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.1243 2022/12/11 04:20:52 tsutsui Exp $
+# $NetBSD: GENERIC,v 1.1244 2022/12/22 19:07:16 jakllsch Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.1243 $"
+#ident		"GENERIC-$Revision: 1.1244 $"
 
 maxusers	64		# estimated number of users
 
@@ -1406,6 +1406,7 @@ ld* at virtio?# Virtio disk device
 vioif* at virtio?			# Virtio network device
 viornd* at virtio?			# Virtio entropy device
 vioscsi* at virtio?			# Virtio SCSI device
+#vio9p*	at virtio?			# Virtio 9P device
 
 # Hyper-V devices
 vmbus*		at acpi?		# Hyper-V VMBus



CVS commit: src/sys/arch/i386/conf

2022-12-10 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Dec 11 04:20:52 UTC 2022

Modified Files:
src/sys/arch/i386/conf: GENERIC

Log Message:
Enable options DISKLABEL_EI by default as amd64.

No particular comment no port-i386@:
 https://mail-index.netbsd.org/port-i386/2022/12/02/msg004063.html


To generate a diff of this commit:
cvs rdiff -u -r1.1242 -r1.1243 src/sys/arch/i386/conf/GENERIC

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/conf

2022-12-10 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Dec 11 04:20:52 UTC 2022

Modified Files:
src/sys/arch/i386/conf: GENERIC

Log Message:
Enable options DISKLABEL_EI by default as amd64.

No particular comment no port-i386@:
 https://mail-index.netbsd.org/port-i386/2022/12/02/msg004063.html


To generate a diff of this commit:
cvs rdiff -u -r1.1242 -r1.1243 src/sys/arch/i386/conf/GENERIC

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/conf/GENERIC
diff -u src/sys/arch/i386/conf/GENERIC:1.1242 src/sys/arch/i386/conf/GENERIC:1.1243
--- src/sys/arch/i386/conf/GENERIC:1.1242	Thu Sep 29 10:10:07 2022
+++ src/sys/arch/i386/conf/GENERIC	Sun Dec 11 04:20:52 2022
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.1242 2022/09/29 10:10:07 riastradh Exp $
+# $NetBSD: GENERIC,v 1.1243 2022/12/11 04:20:52 tsutsui Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.1242 $"
+#ident		"GENERIC-$Revision: 1.1243 $"
 
 maxusers	64		# estimated number of users
 
@@ -166,7 +166,7 @@ options 	WAPBL		# File system journaling
 options 	LFS_DIRHASH	# LFS version of UFS_DIRHASH - experimental
 #options 	EXT2FS_SYSTEM_FLAGS # makes ext2fs file flags (append and
 # immutable) behave as system flags.
-#options 	DISKLABEL_EI	# disklabel Endian Independent support
+options 	DISKLABEL_EI	# disklabel Endian Independent support
 options 	NFSSERVER	# Network File System server
 #options 	V7FS_EI		# V7FS Endian Independent support
 



CVS commit: src/sys/arch/i386/stand/lib

2022-09-21 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Sep 21 14:29:45 UTC 2022

Modified Files:
src/sys/arch/i386/stand/lib: exec.c

Log Message:
i386/stand: Handle 9.99.100 by taking four, not two, digits.

We haven't used the revision part of __NetBSD_Version__ = MMmmrrpp00
in almos two decades so we're apparently reclaiming it as MMmm00.


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 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/lib/exec.c
diff -u src/sys/arch/i386/stand/lib/exec.c:1.77 src/sys/arch/i386/stand/lib/exec.c:1.78
--- src/sys/arch/i386/stand/lib/exec.c:1.77	Sun May 30 05:59:23 2021
+++ src/sys/arch/i386/stand/lib/exec.c	Wed Sep 21 14:29:45 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec.c,v 1.77 2021/05/30 05:59:23 mlelstv Exp $	 */
+/*	$NetBSD: exec.c,v 1.78 2022/09/21 14:29:45 riastradh Exp $	 */
 
 /*
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -684,7 +684,7 @@ module_base_path(char *buf, size_t bufsi
 		"/stand/%s/%d.%d.%d/modules", machine,
 		netbsd_version / 1,
 		netbsd_version / 100 % 100,
-		netbsd_version / 100 % 100);
+		netbsd_version / 100 % 1);
 	} else if (netbsd_version != 0) {
 		/* release */
 		snprintf(buf, bufsize,



CVS commit: src/sys/arch/i386/stand/lib

2022-09-21 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Sep 21 14:29:45 UTC 2022

Modified Files:
src/sys/arch/i386/stand/lib: exec.c

Log Message:
i386/stand: Handle 9.99.100 by taking four, not two, digits.

We haven't used the revision part of __NetBSD_Version__ = MMmmrrpp00
in almos two decades so we're apparently reclaiming it as MMmm00.


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 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.



CVS commit: src/sys/arch/i386/i386

2022-09-08 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Thu Sep  8 06:57:44 UTC 2022

Modified Files:
src/sys/arch/i386/i386: lock_stubs.S spl.S

Log Message:
Fix PR port-i386/57000 (boot failure on qemu).


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/i386/i386/lock_stubs.S
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/i386/i386/spl.S

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/i386/lock_stubs.S
diff -u src/sys/arch/i386/i386/lock_stubs.S:1.37 src/sys/arch/i386/i386/lock_stubs.S:1.38
--- src/sys/arch/i386/i386/lock_stubs.S:1.37	Wed Sep  7 00:40:18 2022
+++ src/sys/arch/i386/i386/lock_stubs.S	Thu Sep  8 06:57:44 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: lock_stubs.S,v 1.37 2022/09/07 00:40:18 knakahara Exp $	*/
+/*	$NetBSD: lock_stubs.S,v 1.38 2022/09/08 06:57:44 knakahara Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lock_stubs.S,v 1.37 2022/09/07 00:40:18 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lock_stubs.S,v 1.38 2022/09/08 06:57:44 knakahara Exp $");
 
 #include "opt_lockdebug.h"
 
@@ -255,10 +255,10 @@ END(mutex_spin_enter)
 
 #ifndef XENPV
 /*
- * Release a spin mutex and post a store fence. Must occupy 96 bytes.
+ * Release a spin mutex and post a store fence. Must occupy 128 bytes.
  */
 ENTRY(mutex_spin_exit)
-	HOTPATCH(HP_NAME_MUTEX_EXIT, 96)
+	HOTPATCH(HP_NAME_MUTEX_EXIT, 128)
 	movl	4(%esp), %edx
 	movl	CPUVAR(MTX_OLDSPL), %ecx
 	incl	CPUVAR(MTX_COUNT)
@@ -284,7 +284,7 @@ STRONG_ALIAS(mutex_spin_exit, i686_mutex
 
 /*
  * Patch for i686 CPUs where cli/sti is prohibitively expensive.
- * Must be the same size as mutex_spin_exit(), that is, 96 bytes.
+ * Must be the same size as mutex_spin_exit(), that is, 128 bytes.
  */
 ENTRY(i686_mutex_spin_exit)
 	mov	4(%esp),%edx

Index: src/sys/arch/i386/i386/spl.S
diff -u src/sys/arch/i386/i386/spl.S:1.56 src/sys/arch/i386/i386/spl.S:1.57
--- src/sys/arch/i386/i386/spl.S:1.56	Wed Sep  7 00:40:18 2022
+++ src/sys/arch/i386/i386/spl.S	Thu Sep  8 06:57:44 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: spl.S,v 1.56 2022/09/07 00:40:18 knakahara Exp $	*/
+/*	$NetBSD: spl.S,v 1.57 2022/09/08 06:57:44 knakahara Exp $	*/
 
 /*
  * Copyright (c) 1998, 2007, 2008, 2020 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spl.S,v 1.56 2022/09/07 00:40:18 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spl.S,v 1.57 2022/09/08 06:57:44 knakahara Exp $");
 
 #include "opt_ddb.h"
 #include "opt_spldebug.h"
@@ -72,11 +72,11 @@ END(splraise)
  * void spllower(int s);
  *
  * spllower() for i486 and Pentium. Must be the same size as cx8_spllower(),
- * that is, 64 bytes. This must use pushf/cli/popf as it is used early in boot
+ * that is, 96 bytes. This must use pushf/cli/popf as it is used early in boot
  * where interrupts are disabled via eflags/IE.
  */
 ENTRY(spllower)
-	HOTPATCH(HP_NAME_SPLLOWER, 64)
+	HOTPATCH(HP_NAME_SPLLOWER, 96)
 #ifdef SPLDEBUG
 	movl	4(%esp),%ecx
 	pushl	%ebp
@@ -115,7 +115,7 @@ STRONG_ALIAS(spllower, cx8_spllower)
  *
  * spllower() optimized for Pentium Pro and later, which have long pipelines
  * that will be stalled by pushf/cli/popf.  Must be the same size as
- * spllower(), ie 64 bytes.  Does not need to restore eflags/IE as is patched
+ * spllower(), ie 96 bytes.  Does not need to restore eflags/IE as is patched
  * in once autoconf is underway.
  *
  * For cmpxchg8b, edx/ecx are the high words and eax/ebx the low.



CVS commit: src/sys/arch/i386/i386

2022-09-08 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Thu Sep  8 06:57:44 UTC 2022

Modified Files:
src/sys/arch/i386/i386: lock_stubs.S spl.S

Log Message:
Fix PR port-i386/57000 (boot failure on qemu).


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/i386/i386/lock_stubs.S
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/i386/i386/spl.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/include

2022-08-21 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug 21 13:15:15 UTC 2022

Modified Files:
src/sys/arch/i386/include: vmparam.h

Log Message:
i386/vmparam.h: Need some constants from i386/pte.h.

These are used by VM_MIN/MAX_KERNEL_ADDRESS.  pte.h is small and
likely stable enough that it's not worthwhile to migrate them to
vmparam.h instead.


To generate a diff of this commit:
cvs rdiff -u -r1.87 -r1.88 src/sys/arch/i386/include/vmparam.h

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/include/vmparam.h
diff -u src/sys/arch/i386/include/vmparam.h:1.87 src/sys/arch/i386/include/vmparam.h:1.88
--- src/sys/arch/i386/include/vmparam.h:1.87	Sat Aug 20 23:48:50 2022
+++ src/sys/arch/i386/include/vmparam.h	Sun Aug 21 13:15:15 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.87 2022/08/20 23:48:50 riastradh Exp $	*/
+/*	$NetBSD: vmparam.h,v 1.88 2022/08/21 13:15:15 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -39,6 +39,8 @@
 
 #include 
 
+#include 
+
 /*
  * Machine dependent constants for 386.
  */



CVS commit: src/sys/arch/i386/include

2022-08-21 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug 21 13:15:15 UTC 2022

Modified Files:
src/sys/arch/i386/include: vmparam.h

Log Message:
i386/vmparam.h: Need some constants from i386/pte.h.

These are used by VM_MIN/MAX_KERNEL_ADDRESS.  pte.h is small and
likely stable enough that it's not worthwhile to migrate them to
vmparam.h instead.


To generate a diff of this commit:
cvs rdiff -u -r1.87 -r1.88 src/sys/arch/i386/include/vmparam.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/stand

2022-06-08 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Jun  8 21:43:45 UTC 2022

Modified Files:
src/sys/arch/i386/stand/boot: boot2.c
src/sys/arch/i386/stand/efiboot: boot.c

Log Message:
Do not use default entry's parameters for for plain "boot" command

Go back to the "menu" instead of you want that.

Patch from RVP in PR 56862, ok uwe@


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/sys/arch/i386/stand/boot/boot2.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/i386/stand/efiboot/boot.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/boot/boot2.c
diff -u src/sys/arch/i386/stand/boot/boot2.c:1.78 src/sys/arch/i386/stand/boot/boot2.c:1.79
--- src/sys/arch/i386/stand/boot/boot2.c:1.78	Tue Sep  7 11:41:31 2021
+++ src/sys/arch/i386/stand/boot/boot2.c	Wed Jun  8 21:43:45 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot2.c,v 1.78 2021/09/07 11:41:31 nia Exp $	*/
+/*	$NetBSD: boot2.c,v 1.79 2022/06/08 21:43:45 wiz Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -488,10 +488,6 @@ command_boot(char *arg)
 	} else {
 		int i;
 
-#ifndef SMALL
-		if (howto == 0)
-			bootdefault();
-#endif
 		for (i = 0; i < NUMNAMES; i++) {
 			bootit(names[i][0], howto);
 			bootit(names[i][1], howto);

Index: src/sys/arch/i386/stand/efiboot/boot.c
diff -u src/sys/arch/i386/stand/efiboot/boot.c:1.20 src/sys/arch/i386/stand/efiboot/boot.c:1.21
--- src/sys/arch/i386/stand/efiboot/boot.c:1.20	Tue Sep  7 11:41:31 2021
+++ src/sys/arch/i386/stand/efiboot/boot.c	Wed Jun  8 21:43:45 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.c,v 1.20 2021/09/07 11:41:31 nia Exp $	*/
+/*	$NetBSD: boot.c,v 1.21 2022/06/08 21:43:45 wiz Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -453,8 +453,6 @@ command_boot(char *arg)
 	} else {
 		int i;
 
-		if (howto == 0)
-			bootdefault();
 		for (i = 0; i < NUMNAMES; i++) {
 			bootit(names[i][0], howto);
 			bootit(names[i][1], howto);



  1   2   3   4   >