CVS commit: src/sys/arch/hp300/stand/common

2024-05-09 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Thu May  9 15:11:11 UTC 2024

Modified Files:
src/sys/arch/hp300/stand/common: conf.c conf.h devopen.c scsi.c
scsireg.h scsivar.h sd.c

Log Message:
Add a preliminary CD boot support to uboot for preparation of PR/54455.

Briefly tested on mame, but not enalbed yet.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/hp300/stand/common/conf.c \
src/sys/arch/hp300/stand/common/devopen.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/hp300/stand/common/conf.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/hp300/stand/common/scsi.c \
src/sys/arch/hp300/stand/common/sd.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/hp300/stand/common/scsireg.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/hp300/stand/common/scsivar.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/hp300/stand/common/conf.c
diff -u src/sys/arch/hp300/stand/common/conf.c:1.14 src/sys/arch/hp300/stand/common/conf.c:1.15
--- src/sys/arch/hp300/stand/common/conf.c:1.14	Sun Dec 11 07:39:30 2022
+++ src/sys/arch/hp300/stand/common/conf.c	Thu May  9 15:11:11 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: conf.c,v 1.14 2022/12/11 07:39:30 tsutsui Exp $	*/
+/*	$NetBSD: conf.c,v 1.15 2024/05/09 15:11:11 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993
@@ -41,6 +41,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -138,13 +139,16 @@ int	npunit = __arraycount(punitsw);
  * Filesystem configuration
  */
 struct fs_ops file_system_rawfs[1] = { FS_OPS(rawfs) };
-struct fs_ops file_system_ufs[NFSYS_UFS] = {
+struct fs_ops file_system_ufs[NFSYS_FS] = {
 	FS_OPS(ffsv1),
 #ifdef SUPPORT_UFS2
 	FS_OPS(ffsv2),
 #endif
+#ifdef SUPPORT_CD
+	FS_OPS(cd9660),
+#endif
 };
 struct fs_ops file_system_nfs[1] = { FS_OPS(nfs) };
 
-struct fs_ops file_system[NFSYS_UFS];
+struct fs_ops file_system[NFSYS_FS];
 int	nfsys = 1;		/* default value; should be overrieded */
Index: src/sys/arch/hp300/stand/common/devopen.c
diff -u src/sys/arch/hp300/stand/common/devopen.c:1.14 src/sys/arch/hp300/stand/common/devopen.c:1.15
--- src/sys/arch/hp300/stand/common/devopen.c:1.14	Sun Jan 15 06:19:46 2023
+++ src/sys/arch/hp300/stand/common/devopen.c	Thu May  9 15:11:11 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: devopen.c,v 1.14 2023/01/15 06:19:46 tsutsui Exp $	*/
+/*	$NetBSD: devopen.c,v 1.15 2024/05/09 15:11:11 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -105,7 +105,7 @@ devlookup(const char *d, int len)
 			case 4:	/* sd */
 memcpy(file_system, file_system_ufs,
 sizeof(file_system_ufs));
-nfsys = NFSYS_UFS;
+nfsys = NFSYS_FS;
 break;
 
 			case 6:	/* le */
@@ -263,7 +263,7 @@ devopen(struct open_file *f, const char 
 	case 4:		/* sd */
 		memcpy(file_system, file_system_ufs,
 		sizeof(file_system_ufs));
-		nfsys = NFSYS_UFS;
+		nfsys = NFSYS_FS;
 		break;
 
 	case 6:		/* le */

Index: src/sys/arch/hp300/stand/common/conf.h
diff -u src/sys/arch/hp300/stand/common/conf.h:1.3 src/sys/arch/hp300/stand/common/conf.h:1.4
--- src/sys/arch/hp300/stand/common/conf.h:1.3	Sun Dec 11 07:39:30 2022
+++ src/sys/arch/hp300/stand/common/conf.h	Thu May  9 15:11:11 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: conf.h,v 1.3 2022/12/11 07:39:30 tsutsui Exp $	*/
+/*	$NetBSD: conf.h,v 1.4 2024/05/09 15:11:11 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1982, 1990, 1993
@@ -53,10 +53,16 @@ int sdopen(struct open_file *, ...);
 int sdclose(struct open_file *);
 #endif
 #ifdef SUPPORT_UFS2
-#define NFSYS_UFS	2
+#define NFSYS_UFS2	1
 #else
-#define NFSYS_UFS	1
+#define NFSYS_UFS2	0
 #endif
+#ifdef SUPPORT_CD
+#define NFSYS_CD9660	1
+#else
+#define NFSYS_CD9660	0
+#endif
+#define NFSYS_FS	(1 + NFSYS_UFS2 + NFSYS_CD9660)
 
 #ifdef SUPPORT_ETHERNET
 extern struct netif_driver le_driver;
@@ -72,5 +78,5 @@ extern	struct punitsw punitsw[];
 extern	int npunit;
 
 extern	struct fs_ops file_system_rawfs[1];
-extern	struct fs_ops file_system_ufs[NFSYS_UFS];
+extern	struct fs_ops file_system_ufs[NFSYS_FS];
 extern	struct fs_ops file_system_nfs[1];

Index: src/sys/arch/hp300/stand/common/scsi.c
diff -u src/sys/arch/hp300/stand/common/scsi.c:1.12 src/sys/arch/hp300/stand/common/scsi.c:1.13
--- src/sys/arch/hp300/stand/common/scsi.c:1.12	Sun Jan 15 06:19:46 2023
+++ src/sys/arch/hp300/stand/common/scsi.c	Thu May  9 15:11:11 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: scsi.c,v 1.12 2023/01/15 06:19:46 tsutsui Exp $	*/
+/*	$NetBSD: scsi.c,v 1.13 2024/05/09 15:11:11 tsutsui Exp $	*/
 
 /*
  * This is reported to fix some odd failures when disklabeling
@@ -400,6 +400,19 @@ scsi_read_capacity(int ctlr, int slave, 
 	DATA_IN_PHASE);
 }
 
+#ifdef SUPPORT_CD
+int
+scsi_inquiry(int ctlr, int slave, uint8_t *buf, unsigned int len)
+{
+	struct scsi_softc *hs = _softc[ctlr];
+	static struct scsi_cdb6 cdb = { CMD_INQUIRY };
+
+	cdb.len = len;
+	return scsiicmd(hs, slave, (uint8_t *), sizeof(cdb), 

CVS commit: src/sys/arch/hp300/stand/common

2024-05-09 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Thu May  9 15:11:11 UTC 2024

Modified Files:
src/sys/arch/hp300/stand/common: conf.c conf.h devopen.c scsi.c
scsireg.h scsivar.h sd.c

Log Message:
Add a preliminary CD boot support to uboot for preparation of PR/54455.

Briefly tested on mame, but not enalbed yet.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/hp300/stand/common/conf.c \
src/sys/arch/hp300/stand/common/devopen.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/hp300/stand/common/conf.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/hp300/stand/common/scsi.c \
src/sys/arch/hp300/stand/common/sd.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/hp300/stand/common/scsireg.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/hp300/stand/common/scsivar.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/hp300/stand/mkboot

2024-05-07 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue May  7 19:55:14 UTC 2024

Modified Files:
src/sys/arch/hp300/stand/mkboot: mkboot.c volhdr.h

Log Message:
Use proper signedness for the LIF file system data structures.

Ancient 4.3BSD used short and int for location, file size, file type,
and addresses etc. but all of them should be unsigned.
Also rename several variables and add comments for readability.

The LIF file system info can be found in "The HPDir Project" page:
 https://www.hp9845.net/9845/projects/hpdir/

The same uboot.lif binaries are generated.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/hp300/stand/mkboot/mkboot.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/hp300/stand/mkboot/volhdr.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/hp300/stand/mkboot

2024-05-07 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue May  7 19:55:14 UTC 2024

Modified Files:
src/sys/arch/hp300/stand/mkboot: mkboot.c volhdr.h

Log Message:
Use proper signedness for the LIF file system data structures.

Ancient 4.3BSD used short and int for location, file size, file type,
and addresses etc. but all of them should be unsigned.
Also rename several variables and add comments for readability.

The LIF file system info can be found in "The HPDir Project" page:
 https://www.hp9845.net/9845/projects/hpdir/

The same uboot.lif binaries are generated.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/hp300/stand/mkboot/mkboot.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/hp300/stand/mkboot/volhdr.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/hp300/stand/mkboot/mkboot.c
diff -u src/sys/arch/hp300/stand/mkboot/mkboot.c:1.18 src/sys/arch/hp300/stand/mkboot/mkboot.c:1.19
--- src/sys/arch/hp300/stand/mkboot/mkboot.c:1.18	Mon May  6 18:08:49 2024
+++ src/sys/arch/hp300/stand/mkboot/mkboot.c	Tue May  7 19:55:14 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: mkboot.c,v 1.18 2024/05/06 18:08:49 tsutsui Exp $	*/
+/*	$NetBSD: mkboot.c,v 1.19 2024/05/07 19:55:14 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1990, 1993
@@ -46,7 +46,7 @@ The Regents of the University of Califor
 #ifdef notdef
 static char sccsid[] = "@(#)mkboot.c	7.2 (Berkeley) 12/16/90";
 #endif
-__RCSID("$NetBSD: mkboot.c,v 1.18 2024/05/06 18:08:49 tsutsui Exp $");
+__RCSID("$NetBSD: mkboot.c,v 1.19 2024/05/07 19:55:14 tsutsui Exp $");
 #endif /* not lint */
 
 #include 
@@ -90,7 +90,7 @@ int	 main(int, char **);
 
 static void	 bcddate(char *, char *);
 static char	*lifname(char *);
-static int	 putfile(char *, int);
+static size_t	 putfile(char *, int);
 static void	 usage(void);
 
 #ifndef __CTASSERT
@@ -120,9 +120,9 @@ memcpy((a), (b), (c))
 int
 main(int argc, char **argv)
 {
-	char *n1, *n2, *n3;
-	int n, to, ch;
-	int count;
+	char *name1, *name2, *name3;
+	int to, ch;
+	uint32_t count, nsec;
 
 	while ((ch = getopt(argc, argv, "l:t:")) != -1)
 		switch (ch) {
@@ -140,23 +140,23 @@ main(int argc, char **argv)
 	argv += optind;
 	if (loadpoint == ULONG_MAX || argc == 0)
 		usage();
-	n1 = argv[0];
+	name1 = argv[0];
 	argv++;
 	argc--;
 	if (argc == 0)
 		usage();
 	if (argc > 1) {
-		n2 = argv[0];
+		name2 = argv[0];
 		argv++;
 		argc--;
 		if (argc > 1) {
-			n3 = argv[0];
+			name3 = argv[0];
 			argv++;
 			argc--;
 		} else
-			n3 = NULL;
+			name3 = NULL;
 	} else
-		n2 = n3 = NULL;
+		name2 = name3 = NULL;
 
 	if ((to = open(argv[0], O_WRONLY | O_TRUNC | O_CREAT, 0644)) == -1)
 		err(1, "Can't open `%s'", argv[0]);
@@ -180,28 +180,28 @@ main(int argc, char **argv)
 
 	/* output bootfile one */
 	lseek(to, LIF_FILESTART, SEEK_SET);
-	count = putfile(n1, to);
-	n = btolifs(count);
-	strcpy(lifd[0].dir_name, lifname(n1));
+	count = putfile(name1, to);
+	nsec = btolifs(count);
+	strcpy(lifd[0].dir_name, lifname(name1));
 	lifd[0].dir_type = htobe16(DIR_TYPE);
 	lifd[0].dir_addr = htobe32(btolifs(LIF_FILESTART));
-	lifd[0].dir_length = htobe32(n);
-	bcddate(n1, lifd[0].dir_toc);
+	lifd[0].dir_length = htobe32(nsec);
+	bcddate(name1, lifd[0].dir_toc);
 	lifd[0].dir_flag = htobe16(DIR_FLAG);
 	lifd[0].dir_exec = htobe32(loadpoint);
 	lifv.vol_length = htobe32(be32toh(lifd[0].dir_addr) +
 	be32toh(lifd[0].dir_length));
 
 	/* if there is an optional second boot program, output it */
-	if (n2 != NULL) {
-		lseek(to, LIF_FILESTART + lifstob(n), SEEK_SET);
-		count = putfile(n2, to);
-		n = btolifs(count);
-		strcpy(lifd[1].dir_name, lifname(n2));
+	if (name2 != NULL) {
+		lseek(to, LIF_FILESTART + lifstob(nsec), SEEK_SET);
+		count = putfile(name2, to);
+		nsec = btolifs(count);
+		strcpy(lifd[1].dir_name, lifname(name2));
 		lifd[1].dir_type = htobe16(DIR_TYPE);
 		lifd[1].dir_addr = htobe32(lifv.vol_length);
-		lifd[1].dir_length = htobe32(n);
-		bcddate(n2, lifd[1].dir_toc);
+		lifd[1].dir_length = htobe32(nsec);
+		bcddate(name2, lifd[1].dir_toc);
 		lifd[1].dir_flag = htobe16(DIR_FLAG);
 		lifd[1].dir_exec = htobe32(loadpoint);
 		lifv.vol_length = htobe32(be32toh(lifd[1].dir_addr) +
@@ -209,16 +209,16 @@ main(int argc, char **argv)
 	}
 
 	/* ditto for three */
-	if (n3 != NULL) {
-		lseek(to, LIF_FILESTART + lifstob(lifd[0].dir_length + n),
+	if (name3 != NULL) {
+		lseek(to, LIF_FILESTART + lifstob(lifd[0].dir_length + nsec),
 		SEEK_SET);
-		count = putfile(n3, to);
-		n = btolifs(count);
-		strcpy(lifd[2].dir_name, lifname(n3));
+		count = putfile(name3, to);
+		nsec = btolifs(count);
+		strcpy(lifd[2].dir_name, lifname(name3));
 		lifd[2].dir_type = htobe16(DIR_TYPE);
 		lifd[2].dir_addr = htobe32(lifv.vol_length);
-		lifd[2].dir_length = htobe32(n);
-		bcddate(n3, lifd[2].dir_toc);
+		lifd[2].dir_length = htobe32(nsec);
+		bcddate(name3, lifd[2].dir_toc);
 		lifd[2].dir_flag = 

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

2024-05-07 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue May  7 19:24:33 UTC 2024

Modified Files:
src/sys/arch/hp300/stand: Makefile.buildboot
src/sys/arch/hp300/stand/inst: Makefile
src/sys/arch/hp300/stand/uboot: Makefile

Log Message:
Rename ${PROGAOUT} -> ${PROGELF} to reflect reality.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/hp300/stand/Makefile.buildboot
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/hp300/stand/inst/Makefile
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/hp300/stand/uboot/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/hp300/stand/Makefile.buildboot
diff -u src/sys/arch/hp300/stand/Makefile.buildboot:1.38 src/sys/arch/hp300/stand/Makefile.buildboot:1.39
--- src/sys/arch/hp300/stand/Makefile.buildboot:1.38	Thu Feb  8 18:10:34 2024
+++ src/sys/arch/hp300/stand/Makefile.buildboot	Tue May  7 19:24:32 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.buildboot,v 1.38 2024/02/08 18:10:34 christos Exp $
+#	$NetBSD: Makefile.buildboot,v 1.39 2024/05/07 19:24:32 tsutsui Exp $
 
 # RELOC=FFF0 allows for boot prog up to FF000 (1044480) bytes long
 RELOC=	FFF0
@@ -7,7 +7,7 @@ S=		${.CURDIR}/../../../..
 
 .PATH: ${.CURDIR}/../common
 
-PROG=		${PROGAOUT}.lif
+PROG=		${PROGELF}.lif
 WARNS?=		1
 
 SRCS=		${COMMONSOURCE} ${DRIVERSOURCE} ${PROGSOURCE}
@@ -15,7 +15,7 @@ NOMAN=		# defined
 STRIPFLAG=
 BINMODE=	444
 
-CLEANFILES+=	${PROGAOUT}
+CLEANFILES+=	${PROGELF}
 
 CPPFLAGS+=	-I${.CURDIR}/../../.. -I${.CURDIR}/../../../..  -I${.OBJDIR}
 CPPFLAGS+=	-Wno-main
@@ -33,10 +33,10 @@ LIBCRTEND=
 HP300MKBOOT_TIMESTAMP=-t "${MKREPRO_TIMESTAMP}"
 .endif
 
-${PROG}: ${PROGAOUT}
-	${OBJCOPY} --output-target=binary ${PROGAOUT} ${PROGAOUT}.bin
-	${TOOL_HP300MKBOOT} -l 0x${RELOC} ${HP300MKBOOT_TIMESTAMP} ${PROGAOUT}.bin ${PROG}
-	rm -f ${PROGAOUT}.bin
+${PROG}: ${PROGELF}
+	${OBJCOPY} --output-target=binary ${PROGELF} ${PROGELF}.bin
+	${TOOL_HP300MKBOOT} -l 0x${RELOC} ${HP300MKBOOT_TIMESTAMP} ${PROGELF}.bin ${PROG}
+	rm -f ${PROGELF}.bin
 
 .include "${S}/conf/newvers_stand.mk"
 
@@ -82,8 +82,8 @@ SAMISCMAKEFLAGS+="SA_USE_LOADFILE=yes"
 .include "${S}/lib/libsa/Makefile.inc"
 LIBSA=		${SALIB}
 
-${PROGAOUT}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
-	${LD} -N -Ttext ${RELOC} -e begin -o ${PROGAOUT} \
+${PROGELF}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
+	${LD} -N -Ttext ${RELOC} -e begin -o ${PROGELF} \
 	${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
-	@${SIZE} ${PROGAOUT}
-	@echo ${PROGAOUT} total size should not exceed 1044480 bytes
+	@${SIZE} ${PROGELF}
+	@echo ${PROGELF} total size should not exceed 1044480 bytes

Index: src/sys/arch/hp300/stand/inst/Makefile
diff -u src/sys/arch/hp300/stand/inst/Makefile:1.11 src/sys/arch/hp300/stand/inst/Makefile:1.12
--- src/sys/arch/hp300/stand/inst/Makefile:1.11	Mon Apr 29 07:13:42 2024
+++ src/sys/arch/hp300/stand/inst/Makefile	Tue May  7 19:24:33 2024
@@ -1,6 +1,6 @@
-#	$NetBSD: Makefile,v 1.11 2024/04/29 07:13:42 tsutsui Exp $
+#	$NetBSD: Makefile,v 1.12 2024/05/07 19:24:33 tsutsui Exp $
 
-PROGAOUT=	inst
+PROGELF=	inst
 PROGSOURCE=	inst.c
 NEWVERSWHAT=	"Miniroot Installer"
 

Index: src/sys/arch/hp300/stand/uboot/Makefile
diff -u src/sys/arch/hp300/stand/uboot/Makefile:1.11 src/sys/arch/hp300/stand/uboot/Makefile:1.12
--- src/sys/arch/hp300/stand/uboot/Makefile:1.11	Mon Apr 29 07:13:42 2024
+++ src/sys/arch/hp300/stand/uboot/Makefile	Tue May  7 19:24:33 2024
@@ -1,6 +1,6 @@
-#	$NetBSD: Makefile,v 1.11 2024/04/29 07:13:42 tsutsui Exp $
+#	$NetBSD: Makefile,v 1.12 2024/05/07 19:24:33 tsutsui Exp $
 
-PROGAOUT=	uboot
+PROGELF=	uboot
 PROGSOURCE=	uboot.c tgets.c
 NEWVERSWHAT=	"Primary Boot"
 



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

2024-05-07 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue May  7 19:24:33 UTC 2024

Modified Files:
src/sys/arch/hp300/stand: Makefile.buildboot
src/sys/arch/hp300/stand/inst: Makefile
src/sys/arch/hp300/stand/uboot: Makefile

Log Message:
Rename ${PROGAOUT} -> ${PROGELF} to reflect reality.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/hp300/stand/Makefile.buildboot
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/hp300/stand/inst/Makefile
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/hp300/stand/uboot/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/hp300/stand/mkboot

2024-05-06 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon May  6 18:08:49 UTC 2024

Modified Files:
src/sys/arch/hp300/stand/mkboot: mkboot.c

Log Message:
Misc cosmetic changes for mostly readability.

- KNF and add some newlines per blocks
- define and use proper bintobcd() macro
- make local functions and variables static

The same uboot.lif binaries are generated.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/hp300/stand/mkboot/mkboot.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/hp300/stand/mkboot

2024-05-06 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon May  6 18:08:49 UTC 2024

Modified Files:
src/sys/arch/hp300/stand/mkboot: mkboot.c

Log Message:
Misc cosmetic changes for mostly readability.

- KNF and add some newlines per blocks
- define and use proper bintobcd() macro
- make local functions and variables static

The same uboot.lif binaries are generated.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/hp300/stand/mkboot/mkboot.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/hp300/stand/mkboot/mkboot.c
diff -u src/sys/arch/hp300/stand/mkboot/mkboot.c:1.17 src/sys/arch/hp300/stand/mkboot/mkboot.c:1.18
--- src/sys/arch/hp300/stand/mkboot/mkboot.c:1.17	Sun May  5 07:36:37 2024
+++ src/sys/arch/hp300/stand/mkboot/mkboot.c	Mon May  6 18:08:49 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: mkboot.c,v 1.17 2024/05/05 07:36:37 tsutsui Exp $	*/
+/*	$NetBSD: mkboot.c,v 1.18 2024/05/06 18:08:49 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1990, 1993
@@ -46,7 +46,7 @@ The Regents of the University of Califor
 #ifdef notdef
 static char sccsid[] = "@(#)mkboot.c	7.2 (Berkeley) 12/16/90";
 #endif
-__RCSID("$NetBSD: mkboot.c,v 1.17 2024/05/05 07:36:37 tsutsui Exp $");
+__RCSID("$NetBSD: mkboot.c,v 1.18 2024/05/06 18:08:49 tsutsui Exp $");
 #endif /* not lint */
 
 #include 
@@ -78,17 +78,20 @@ __RCSID("$NetBSD: mkboot.c,v 1.17 2024/0
 #define btolifs(b)	(((b) + (SECTSIZE - 1)) / SECTSIZE)
 #define lifstob(s)	((s) * SECTSIZE)
 
-uint32_t loadpoint = ULONG_MAX;
-struct  load ld;
-struct	lifvol lifv;
-struct	lifdir lifd[LIF_NUMDIR];
-time_t repro_epoch = 0;
+#define bintobcd(bin)	bin) / 10) << 4) | ((bin) % 10))
+
+static uint32_t loadpoint = ULONG_MAX;
+static struct  load ld;
+static struct	lifvol lifv;
+static struct	lifdir lifd[LIF_NUMDIR];
+static time_t repro_epoch = 0;
 
 int	 main(int, char **);
-void	 bcddate(char *, char *);
-char	*lifname(char *);
-int	 putfile(char *, int);
-void	 usage(void);
+
+static void	 bcddate(char *, char *);
+static char	*lifname(char *);
+static int	 putfile(char *, int);
+static void	 usage(void);
 
 #ifndef __CTASSERT
 #define	__CTASSERT(X)
@@ -121,7 +124,6 @@ main(int argc, char **argv)
 	int n, to, ch;
 	int count;
 
-
 	while ((ch = getopt(argc, argv, "l:t:")) != -1)
 		switch (ch) {
 		case 'l':
@@ -158,14 +160,16 @@ main(int argc, char **argv)
 
 	if ((to = open(argv[0], O_WRONLY | O_TRUNC | O_CREAT, 0644)) == -1)
 		err(1, "Can't open `%s'", argv[0]);
+
 	/* clear possibly unused directory entries */
 	CLEAR(lifd[1].dir_name, "  ", sizeof(lifd[1].dir_name));
-	lifd[1].dir_type = htobe16(-1);
+	lifd[1].dir_type = htobe16(0x);
 	lifd[1].dir_addr = htobe32(0);
 	lifd[1].dir_length = htobe32(0);
-	lifd[1].dir_flag = htobe16(0xFF);
+	lifd[1].dir_flag = htobe16(0x00FF);
 	lifd[1].dir_exec = htobe32(0);
 	lifd[7] = lifd[6] = lifd[5] = lifd[4] = lifd[3] = lifd[2] = lifd[1];
+
 	/* record volume info */
 	lifv.vol_id = htobe16(VOL_ID);
 	CLEAR(lifv.vol_label, "BOOT43", sizeof(lifv.vol_label));
@@ -173,6 +177,7 @@ main(int argc, char **argv)
 	lifv.vol_oct = htobe16(VOL_OCT);
 	lifv.vol_dirsize = htobe32(btolifs(LIF_DIRSIZE));
 	lifv.vol_version = htobe16(1);
+
 	/* output bootfile one */
 	lseek(to, LIF_FILESTART, SEEK_SET);
 	count = putfile(n1, to);
@@ -185,10 +190,11 @@ main(int argc, char **argv)
 	lifd[0].dir_flag = htobe16(DIR_FLAG);
 	lifd[0].dir_exec = htobe32(loadpoint);
 	lifv.vol_length = htobe32(be32toh(lifd[0].dir_addr) +
-  be32toh(lifd[0].dir_length));
+	be32toh(lifd[0].dir_length));
+
 	/* if there is an optional second boot program, output it */
-	if (n2) {
-		lseek(to, LIF_FILESTART+lifstob(n), SEEK_SET);
+	if (n2 != NULL) {
+		lseek(to, LIF_FILESTART + lifstob(n), SEEK_SET);
 		count = putfile(n2, to);
 		n = btolifs(count);
 		strcpy(lifd[1].dir_name, lifname(n2));
@@ -199,12 +205,13 @@ main(int argc, char **argv)
 		lifd[1].dir_flag = htobe16(DIR_FLAG);
 		lifd[1].dir_exec = htobe32(loadpoint);
 		lifv.vol_length = htobe32(be32toh(lifd[1].dir_addr) +
-	  be32toh(lifd[1].dir_length));
+		be32toh(lifd[1].dir_length));
 	}
+
 	/* ditto for three */
-	if (n3) {
-		lseek(to, LIF_FILESTART+lifstob(lifd[0].dir_length+n),
-		  SEEK_SET);
+	if (n3 != NULL) {
+		lseek(to, LIF_FILESTART + lifstob(lifd[0].dir_length + n),
+		SEEK_SET);
 		count = putfile(n3, to);
 		n = btolifs(count);
 		strcpy(lifd[2].dir_name, lifname(n3));
@@ -215,17 +222,19 @@ main(int argc, char **argv)
 		lifd[2].dir_flag = htobe16(DIR_FLAG);
 		lifd[2].dir_exec = htobe32(loadpoint);
 		lifv.vol_length = htobe32(be32toh(lifd[2].dir_addr) +
-	  be32toh(lifd[2].dir_length));
+		be32toh(lifd[2].dir_length));
 	}
+
 	/* output volume/directory header info */
 	lseek(to, LIF_VOLSTART, SEEK_SET);
 	write(to, , LIF_VOLSIZE);
 	lseek(to, LIF_DIRSTART, SEEK_SET);
 	write(to, lifd, LIF_DIRSIZE);
+
 	return EXIT_SUCCESS;
 }
 

CVS commit: src/sys/arch/hp300/stand/mkboot

2024-05-05 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun May  5 07:36:38 UTC 2024

Modified Files:
src/sys/arch/hp300/stand/mkboot: mkboot.c

Log Message:
Fix integer overflow of strtol(3) for "loadpoint" address on ILP32 hosts.

This strtol(3) was introduced in rev 1.12 for PR/57909 after netbsd-10,
but it returns LONG_MAX (0x7FFF) for 0xFFF0 on ILP32 hosts and
the wrong loadpoint causes "NOT ENOUGH MEMORY" error by the BOOTROMs
on loading uboot.lif on (at least) my 9000/360 and 9000/425t.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/hp300/stand/mkboot/mkboot.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/hp300/stand/mkboot/mkboot.c
diff -u src/sys/arch/hp300/stand/mkboot/mkboot.c:1.16 src/sys/arch/hp300/stand/mkboot/mkboot.c:1.17
--- src/sys/arch/hp300/stand/mkboot/mkboot.c:1.16	Fri May  3 15:39:50 2024
+++ src/sys/arch/hp300/stand/mkboot/mkboot.c	Sun May  5 07:36:37 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: mkboot.c,v 1.16 2024/05/03 15:39:50 christos Exp $	*/
+/*	$NetBSD: mkboot.c,v 1.17 2024/05/05 07:36:37 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1990, 1993
@@ -46,7 +46,7 @@ The Regents of the University of Califor
 #ifdef notdef
 static char sccsid[] = "@(#)mkboot.c	7.2 (Berkeley) 12/16/90";
 #endif
-__RCSID("$NetBSD: mkboot.c,v 1.16 2024/05/03 15:39:50 christos Exp $");
+__RCSID("$NetBSD: mkboot.c,v 1.17 2024/05/05 07:36:37 tsutsui Exp $");
 #endif /* not lint */
 
 #include 
@@ -78,7 +78,7 @@ __RCSID("$NetBSD: mkboot.c,v 1.16 2024/0
 #define btolifs(b)	(((b) + (SECTSIZE - 1)) / SECTSIZE)
 #define lifstob(s)	((s) * SECTSIZE)
 
-int	loadpoint = -1;
+uint32_t loadpoint = ULONG_MAX;
 struct  load ld;
 struct	lifvol lifv;
 struct	lifdir lifd[LIF_NUMDIR];
@@ -125,7 +125,7 @@ main(int argc, char **argv)
 	while ((ch = getopt(argc, argv, "l:t:")) != -1)
 		switch (ch) {
 		case 'l':
-			loadpoint = strtol(optarg, NULL, 0);
+			loadpoint = strtoul(optarg, NULL, 0);
 			break;
 		case 't':
 			repro_epoch = (time_t)atoll(optarg);
@@ -136,7 +136,7 @@ main(int argc, char **argv)
 
 	argc -= optind;
 	argv += optind;
-	if (loadpoint == -1 || argc == 0)
+	if (loadpoint == ULONG_MAX || argc == 0)
 		usage();
 	n1 = argv[0];
 	argv++;



CVS commit: src/sys/arch/hp300/stand/mkboot

2024-05-05 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun May  5 07:36:38 UTC 2024

Modified Files:
src/sys/arch/hp300/stand/mkboot: mkboot.c

Log Message:
Fix integer overflow of strtol(3) for "loadpoint" address on ILP32 hosts.

This strtol(3) was introduced in rev 1.12 for PR/57909 after netbsd-10,
but it returns LONG_MAX (0x7FFF) for 0xFFF0 on ILP32 hosts and
the wrong loadpoint causes "NOT ENOUGH MEMORY" error by the BOOTROMs
on loading uboot.lif on (at least) my 9000/360 and 9000/425t.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/hp300/stand/mkboot/mkboot.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/hp300/stand/mkboot

2024-05-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri May  3 15:39:50 UTC 2024

Modified Files:
src/sys/arch/hp300/stand/mkboot: mkboot.c

Log Message:
Fix build as a tool (Jan-Benedict Glaw)


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/hp300/stand/mkboot/mkboot.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/hp300/stand/mkboot/mkboot.c
diff -u src/sys/arch/hp300/stand/mkboot/mkboot.c:1.15 src/sys/arch/hp300/stand/mkboot/mkboot.c:1.16
--- src/sys/arch/hp300/stand/mkboot/mkboot.c:1.15	Sat Feb 24 10:34:47 2024
+++ src/sys/arch/hp300/stand/mkboot/mkboot.c	Fri May  3 11:39:50 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: mkboot.c,v 1.15 2024/02/24 15:34:47 christos Exp $	*/
+/*	$NetBSD: mkboot.c,v 1.16 2024/05/03 15:39:50 christos Exp $	*/
 
 /*
  * Copyright (c) 1990, 1993
@@ -46,7 +46,7 @@ The Regents of the University of Califor
 #ifdef notdef
 static char sccsid[] = "@(#)mkboot.c	7.2 (Berkeley) 12/16/90";
 #endif
-__RCSID("$NetBSD: mkboot.c,v 1.15 2024/02/24 15:34:47 christos Exp $");
+__RCSID("$NetBSD: mkboot.c,v 1.16 2024/05/03 15:39:50 christos Exp $");
 #endif /* not lint */
 
 #include 
@@ -90,6 +90,10 @@ char	*lifname(char *);
 int	 putfile(char *, int);
 void	 usage(void);
 
+#ifndef __CTASSERT
+#define	__CTASSERT(X)
+#endif
+
 #define CLEAR(a, b, c)	\
 __CTASSERT(sizeof(b) - 1 == c); \
 memcpy((a), (b), (c))



CVS commit: src/sys/arch/hp300/stand/mkboot

2024-05-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri May  3 15:39:50 UTC 2024

Modified Files:
src/sys/arch/hp300/stand/mkboot: mkboot.c

Log Message:
Fix build as a tool (Jan-Benedict Glaw)


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/hp300/stand/mkboot/mkboot.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/hp300/stand/common

2024-04-29 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon Apr 29 14:42:07 UTC 2024

Modified Files:
src/sys/arch/hp300/stand/common: if_le.c

Log Message:
Don't panic as a fatal error on receiving packets with invalid length.

Such errors could happen on aged and fragile 10BASE-2 hub etc.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/hp300/stand/common/if_le.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/hp300/stand/common/if_le.c
diff -u src/sys/arch/hp300/stand/common/if_le.c:1.15 src/sys/arch/hp300/stand/common/if_le.c:1.16
--- src/sys/arch/hp300/stand/common/if_le.c:1.15	Fri Apr 21 22:43:11 2023
+++ src/sys/arch/hp300/stand/common/if_le.c	Mon Apr 29 14:42:07 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_le.c,v 1.15 2023/04/21 22:43:11 tsutsui Exp $	*/
+/*	$NetBSD: if_le.c,v 1.16 2024/04/29 14:42:07 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1993 Adam Glass
@@ -492,8 +492,9 @@ le_poll(struct iodesc *desc, void *pkt, 
 		printf("le_poll: length %d\n", length);
 #endif
 	if (length >= BUFSIZE) {
+		printf("le%d_poll: invalid length %d, status 0x%x\n",
+		unit, length, stat);
 		length = 0;
-		panic("csr0 when bad things happen: %x", stat);
 		goto cleanup;
 	}
 	if (!length)



CVS commit: src/sys/arch/hp300/stand/common

2024-04-29 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon Apr 29 14:42:07 UTC 2024

Modified Files:
src/sys/arch/hp300/stand/common: if_le.c

Log Message:
Don't panic as a fatal error on receiving packets with invalid length.

Such errors could happen on aged and fragile 10BASE-2 hub etc.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/hp300/stand/common/if_le.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/hp300/stand

2024-04-29 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon Apr 29 07:13:42 UTC 2024

Modified Files:
src/sys/arch/hp300/stand/inst: Makefile
src/sys/arch/hp300/stand/uboot: Makefile

Log Message:
Use LINKS to create hard links to generate proper METALOG files.

Also use the default ${PROG} variable and "install" target.

Fixes PR port-hp300/58211.
Should be pulled up to netbsd-10 and netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/hp300/stand/inst/Makefile
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/hp300/stand/uboot/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/hp300/stand/inst/Makefile
diff -u src/sys/arch/hp300/stand/inst/Makefile:1.10 src/sys/arch/hp300/stand/inst/Makefile:1.11
--- src/sys/arch/hp300/stand/inst/Makefile:1.10	Mon Sep 23 13:42:36 2019
+++ src/sys/arch/hp300/stand/inst/Makefile	Mon Apr 29 07:13:42 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.10 2019/09/23 13:42:36 christos Exp $
+#	$NetBSD: Makefile,v 1.11 2024/04/29 07:13:42 tsutsui Exp $
 
 PROGAOUT=	inst
 PROGSOURCE=	inst.c
@@ -6,16 +6,14 @@ NEWVERSWHAT=	"Miniroot Installer"
 
 CPPFLAGS+=	-DSUPPORT_ETHERNET -DSUPPORT_TAPE -DSUPPORT_DISK
 
+LINKS=	${BINDIR}/${PROG} ${BINDIR}/rbootd/SYS_INST
+
 .include "../Makefile.buildboot"
 
-install:
+beforeinstall:
 	${INSTALL} -d -m 755 -o ${BINOWN} -g ${BINGRP} ${INSTPRIV} \
 	${DESTDIR}${BINDIR}/rbootd
-	${INSTALL} ${COPY} -m 444 -o ${BINOWN} -g ${BINGRP} ${INSTPRIV} \
-	inst.lif ${DESTDIR}${BINDIR}/inst.lif
-	rm -f ${DESTDIR}${BINDIR}/rbootd/SYS_INST
-	ln ${DESTDIR}${BINDIR}/inst.lif ${DESTDIR}${BINDIR}/rbootd/SYS_INST
 
-release: check_RELEASEDIR .WAIT inst.lif
-	${HOST_INSTALL_FILE} -m ${NONBINMODE} inst.lif \
+release: check_RELEASEDIR .WAIT ${PROG}
+	${HOST_INSTALL_FILE} -m ${NONBINMODE} ${PROG} \
 	${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/misc/SYS_INST

Index: src/sys/arch/hp300/stand/uboot/Makefile
diff -u src/sys/arch/hp300/stand/uboot/Makefile:1.10 src/sys/arch/hp300/stand/uboot/Makefile:1.11
--- src/sys/arch/hp300/stand/uboot/Makefile:1.10	Sun Dec 11 07:41:37 2022
+++ src/sys/arch/hp300/stand/uboot/Makefile	Mon Apr 29 07:13:42 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.10 2022/12/11 07:41:37 tsutsui Exp $
+#	$NetBSD: Makefile,v 1.11 2024/04/29 07:13:42 tsutsui Exp $
 
 PROGAOUT=	uboot
 PROGSOURCE=	uboot.c tgets.c
@@ -7,28 +7,20 @@ NEWVERSWHAT=	"Primary Boot"
 CPPFLAGS+=	-DSUPPORT_ETHERNET -DSUPPORT_TAPE -DSUPPORT_DISK
 CPPFLAGS+=	-DSUPPORT_UFS2
 
+LINKS=	${BINDIR}/${PROG} ${BINDIR}/rdboot
+LINKS+=	${BINDIR}/${PROG} ${BINDIR}/bootrd
+LINKS+=	${BINDIR}/${PROG} ${BINDIR}/sdboot
+LINKS+=	${BINDIR}/${PROG} ${BINDIR}/bootsd
+LINKS+=	${BINDIR}/${PROG} ${BINDIR}/ctboot
+LINKS+=	${BINDIR}/${PROG} ${BINDIR}/bootct
+LINKS+=	${BINDIR}/${PROG} ${BINDIR}/rbootd/SYS_UBOOT
+
 .include "../Makefile.buildboot"
 
-install:
+beforeinstall:
 	${INSTALL_DIR} -o ${BINOWN} -g ${BINGRP} -m 755 \
 	${DESTDIR}${BINDIR}/rbootd
-	${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 444 \
-	uboot.lif ${DESTDIR}${BINDIR}/uboot.lif
-	rm -f ${DESTDIR}${BINDIR}/rdboot
-	ln ${DESTDIR}${BINDIR}/uboot.lif ${DESTDIR}${BINDIR}/rdboot
-	rm -f ${DESTDIR}${BINDIR}/bootrd
-	ln ${DESTDIR}${BINDIR}/uboot.lif ${DESTDIR}${BINDIR}/bootrd
-	rm -f ${DESTDIR}${BINDIR}/sdboot
-	ln ${DESTDIR}${BINDIR}/uboot.lif ${DESTDIR}${BINDIR}/sdboot
-	rm -f ${DESTDIR}${BINDIR}/bootsd
-	ln ${DESTDIR}${BINDIR}/uboot.lif ${DESTDIR}${BINDIR}/bootsd
-	rm -f ${DESTDIR}${BINDIR}/ctboot
-	ln ${DESTDIR}${BINDIR}/uboot.lif ${DESTDIR}${BINDIR}/ctboot
-	rm -f ${DESTDIR}${BINDIR}/bootct
-	ln ${DESTDIR}${BINDIR}/uboot.lif ${DESTDIR}${BINDIR}/bootct
-	rm -f ${DESTDIR}${BINDIR}/rbootd/SYS_UBOOT
-	ln ${DESTDIR}${BINDIR}/uboot.lif ${DESTDIR}${BINDIR}/rbootd/SYS_UBOOT
 
-release: check_RELEASEDIR .WAIT uboot.lif
-	${HOST_INSTALL_FILE} -m ${NONBINMODE} uboot.lif \
+release: check_RELEASEDIR .WAIT ${PROG}
+	${HOST_INSTALL_FILE} -m ${NONBINMODE} ${PROG} \
 	${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/misc/SYS_UBOOT



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

2024-04-29 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon Apr 29 07:13:42 UTC 2024

Modified Files:
src/sys/arch/hp300/stand/inst: Makefile
src/sys/arch/hp300/stand/uboot: Makefile

Log Message:
Use LINKS to create hard links to generate proper METALOG files.

Also use the default ${PROG} variable and "install" target.

Fixes PR port-hp300/58211.
Should be pulled up to netbsd-10 and netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/hp300/stand/inst/Makefile
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/hp300/stand/uboot/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/hp300/stand/mkboot

2024-02-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Feb 24 15:34:47 UTC 2024

Modified Files:
src/sys/arch/hp300/stand/mkboot: Makefile mkboot.c

Log Message:
avoid stringop truncation, fix copyright string to prevent assembler warnings.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/hp300/stand/mkboot/Makefile
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/hp300/stand/mkboot/mkboot.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/hp300/stand/mkboot

2024-02-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Feb 24 15:34:47 UTC 2024

Modified Files:
src/sys/arch/hp300/stand/mkboot: Makefile mkboot.c

Log Message:
avoid stringop truncation, fix copyright string to prevent assembler warnings.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/hp300/stand/mkboot/Makefile
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/hp300/stand/mkboot/mkboot.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/hp300/stand/mkboot/Makefile
diff -u src/sys/arch/hp300/stand/mkboot/Makefile:1.12 src/sys/arch/hp300/stand/mkboot/Makefile:1.13
--- src/sys/arch/hp300/stand/mkboot/Makefile:1.12	Tue Feb 20 11:53:22 2024
+++ src/sys/arch/hp300/stand/mkboot/Makefile	Sat Feb 24 10:34:47 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.12 2024/02/20 16:53:22 christos Exp $
+#	$NetBSD: Makefile,v 1.13 2024/02/24 15:34:47 christos Exp $
 
 WARNS=5
 NOMAN=		# defined
@@ -6,6 +6,4 @@ NOMAN=		# defined
 PROG=		mkboot
 SRCS=		mkboot.c
 
-COPTS.mkboot.c	+=	-Wno-error=stringop-truncation
-
 .include 

Index: src/sys/arch/hp300/stand/mkboot/mkboot.c
diff -u src/sys/arch/hp300/stand/mkboot/mkboot.c:1.14 src/sys/arch/hp300/stand/mkboot/mkboot.c:1.15
--- src/sys/arch/hp300/stand/mkboot/mkboot.c:1.14	Tue Feb 20 11:53:22 2024
+++ src/sys/arch/hp300/stand/mkboot/mkboot.c	Sat Feb 24 10:34:47 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: mkboot.c,v 1.14 2024/02/20 16:53:22 christos Exp $	*/
+/*	$NetBSD: mkboot.c,v 1.15 2024/02/24 15:34:47 christos Exp $	*/
 
 /*
  * Copyright (c) 1990, 1993
@@ -38,16 +38,15 @@
 #include 
 
 #ifndef lint
-__COPYRIGHT(
-"@(#) Copyright (c) 1990, 1993\n\
-	The Regents of the University of California.  All rights reserved.\n");
+__COPYRIGHT("@(#) Copyright (c) 1990, 1993\
+The Regents of the University of California.  All rights reserved.");
 #endif /* not lint */
 
 #ifndef lint
 #ifdef notdef
 static char sccsid[] = "@(#)mkboot.c	7.2 (Berkeley) 12/16/90";
 #endif
-__RCSID("$NetBSD: mkboot.c,v 1.14 2024/02/20 16:53:22 christos Exp $");
+__RCSID("$NetBSD: mkboot.c,v 1.15 2024/02/24 15:34:47 christos Exp $");
 #endif /* not lint */
 
 #include 
@@ -91,6 +90,10 @@ char	*lifname(char *);
 int	 putfile(char *, int);
 void	 usage(void);
 
+#define CLEAR(a, b, c)	\
+__CTASSERT(sizeof(b) - 1 == c); \
+memcpy((a), (b), (c))
+
 /*
  * Old Format:
  *	sector 0:	LIF volume header (40 bytes)
@@ -152,7 +155,7 @@ main(int argc, char **argv)
 	if ((to = open(argv[0], O_WRONLY | O_TRUNC | O_CREAT, 0644)) == -1)
 		err(1, "Can't open `%s'", argv[0]);
 	/* clear possibly unused directory entries */
-	strncpy(lifd[1].dir_name, "  ", sizeof(lifd[1].dir_name));
+	CLEAR(lifd[1].dir_name, "  ", sizeof(lifd[1].dir_name));
 	lifd[1].dir_type = htobe16(-1);
 	lifd[1].dir_addr = htobe32(0);
 	lifd[1].dir_length = htobe32(0);
@@ -161,7 +164,7 @@ main(int argc, char **argv)
 	lifd[7] = lifd[6] = lifd[5] = lifd[4] = lifd[3] = lifd[2] = lifd[1];
 	/* record volume info */
 	lifv.vol_id = htobe16(VOL_ID);
-	strncpy(lifv.vol_label, "BOOT43", sizeof(lifv.vol_label));
+	CLEAR(lifv.vol_label, "BOOT43", sizeof(lifv.vol_label));
 	lifv.vol_addr = htobe32(btolifs(LIF_DIRSTART));
 	lifv.vol_oct = htobe16(VOL_OCT);
 	lifv.vol_dirsize = htobe32(btolifs(LIF_DIRSIZE));



CVS commit: src/sys/arch/hp300/stand/mkboot

2024-02-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Feb 20 16:53:22 UTC 2024

Modified Files:
src/sys/arch/hp300/stand/mkboot: Makefile mkboot.c

Log Message:
add missing chunk for repro-build. fix gcc warnings.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/hp300/stand/mkboot/Makefile
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/hp300/stand/mkboot/mkboot.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/hp300/stand/mkboot

2024-02-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Feb 20 16:53:22 UTC 2024

Modified Files:
src/sys/arch/hp300/stand/mkboot: Makefile mkboot.c

Log Message:
add missing chunk for repro-build. fix gcc warnings.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/hp300/stand/mkboot/Makefile
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/hp300/stand/mkboot/mkboot.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/hp300/stand/mkboot/Makefile
diff -u src/sys/arch/hp300/stand/mkboot/Makefile:1.11 src/sys/arch/hp300/stand/mkboot/Makefile:1.12
--- src/sys/arch/hp300/stand/mkboot/Makefile:1.11	Sun Dec 11 07:17:23 2005
+++ src/sys/arch/hp300/stand/mkboot/Makefile	Tue Feb 20 11:53:22 2024
@@ -1,8 +1,11 @@
-#	$NetBSD: Makefile,v 1.11 2005/12/11 12:17:23 christos Exp $
+#	$NetBSD: Makefile,v 1.12 2024/02/20 16:53:22 christos Exp $
 
+WARNS=5
 NOMAN=		# defined
 
 PROG=		mkboot
 SRCS=		mkboot.c
 
+COPTS.mkboot.c	+=	-Wno-error=stringop-truncation
+
 .include 

Index: src/sys/arch/hp300/stand/mkboot/mkboot.c
diff -u src/sys/arch/hp300/stand/mkboot/mkboot.c:1.13 src/sys/arch/hp300/stand/mkboot/mkboot.c:1.14
--- src/sys/arch/hp300/stand/mkboot/mkboot.c:1.13	Fri Feb  9 11:18:12 2024
+++ src/sys/arch/hp300/stand/mkboot/mkboot.c	Tue Feb 20 11:53:22 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: mkboot.c,v 1.13 2024/02/09 16:18:12 christos Exp $	*/
+/*	$NetBSD: mkboot.c,v 1.14 2024/02/20 16:53:22 christos Exp $	*/
 
 /*
  * Copyright (c) 1990, 1993
@@ -47,7 +47,7 @@ __COPYRIGHT(
 #ifdef notdef
 static char sccsid[] = "@(#)mkboot.c	7.2 (Berkeley) 12/16/90";
 #endif
-__RCSID("$NetBSD: mkboot.c,v 1.13 2024/02/09 16:18:12 christos Exp $");
+__RCSID("$NetBSD: mkboot.c,v 1.14 2024/02/20 16:53:22 christos Exp $");
 #endif /* not lint */
 
 #include 
@@ -152,7 +152,7 @@ main(int argc, char **argv)
 	if ((to = open(argv[0], O_WRONLY | O_TRUNC | O_CREAT, 0644)) == -1)
 		err(1, "Can't open `%s'", argv[0]);
 	/* clear possibly unused directory entries */
-	strncpy(lifd[1].dir_name, "  ", 10);
+	strncpy(lifd[1].dir_name, "  ", sizeof(lifd[1].dir_name));
 	lifd[1].dir_type = htobe16(-1);
 	lifd[1].dir_addr = htobe32(0);
 	lifd[1].dir_length = htobe32(0);
@@ -161,7 +161,7 @@ main(int argc, char **argv)
 	lifd[7] = lifd[6] = lifd[5] = lifd[4] = lifd[3] = lifd[2] = lifd[1];
 	/* record volume info */
 	lifv.vol_id = htobe16(VOL_ID);
-	strncpy(lifv.vol_label, "BOOT43", 6);
+	strncpy(lifv.vol_label, "BOOT43", sizeof(lifv.vol_label));
 	lifv.vol_addr = htobe32(btolifs(LIF_DIRSTART));
 	lifv.vol_oct = htobe16(VOL_OCT);
 	lifv.vol_dirsize = htobe32(btolifs(LIF_DIRSIZE));
@@ -223,7 +223,6 @@ putfile(char *from, int to)
 {
 	int fd;
 	struct stat statb;
-	ssize_t nr;
 	void *bp;
 
 	if ((fd = open(from, 0)) < 0)
@@ -261,9 +260,9 @@ lifname(char *str)
 	if ((cp = strrchr(str, '/')) != NULL)
 		str = ++cp;
 	for (i = 4; i < 9; i++) {
-		if (islower(*str))
-			lname[i] = toupper(*str);
-		else if (isalnum(*str) || *str == '_')
+		if (islower((unsigned char)*str))
+			lname[i] = toupper((unsigned char)*str);
+		else if (isalnum((unsigned char)*str) || *str == '_')
 			lname[i] = *str;
 		else
 			break;
@@ -280,8 +279,12 @@ bcddate(char *name, char *toc)
 	struct stat statb;
 	struct tm *tm;
 
-	stat(name, );
-	tm = localtime(_ctime);
+	if (repro_epoch)
+		tm = gmtime(_epoch);
+	else {
+		stat(name, );
+		tm = localtime(_ctime);
+	}
 	*toc = ((tm->tm_mon+1) / 10) << 4;
 	*toc++ |= (tm->tm_mon+1) % 10;
 	*toc = (tm->tm_mday / 10) << 4;



CVS commit: src/sys/arch/hp300/stand/mkboot

2024-02-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb  9 16:18:12 UTC 2024

Modified Files:
src/sys/arch/hp300/stand/mkboot: mkboot.c

Log Message:
fix usage string, improve error handling.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/hp300/stand/mkboot/mkboot.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/hp300/stand/mkboot/mkboot.c
diff -u src/sys/arch/hp300/stand/mkboot/mkboot.c:1.12 src/sys/arch/hp300/stand/mkboot/mkboot.c:1.13
--- src/sys/arch/hp300/stand/mkboot/mkboot.c:1.12	Thu Feb  8 13:10:34 2024
+++ src/sys/arch/hp300/stand/mkboot/mkboot.c	Fri Feb  9 11:18:12 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: mkboot.c,v 1.12 2024/02/08 18:10:34 christos Exp $	*/
+/*	$NetBSD: mkboot.c,v 1.13 2024/02/09 16:18:12 christos Exp $	*/
 
 /*
  * Copyright (c) 1990, 1993
@@ -47,7 +47,7 @@ __COPYRIGHT(
 #ifdef notdef
 static char sccsid[] = "@(#)mkboot.c	7.2 (Berkeley) 12/16/90";
 #endif
-__RCSID("$NetBSD: mkboot.c,v 1.12 2024/02/08 18:10:34 christos Exp $");
+__RCSID("$NetBSD: mkboot.c,v 1.13 2024/02/09 16:18:12 christos Exp $");
 #endif /* not lint */
 
 #include 
@@ -215,7 +215,7 @@ main(int argc, char **argv)
 	write(to, , LIF_VOLSIZE);
 	lseek(to, LIF_DIRSTART, SEEK_SET);
 	write(to, lifd, LIF_DIRSIZE);
-	exit(0);
+	return EXIT_SUCCESS;
 }
 
 int
@@ -223,21 +223,18 @@ putfile(char *from, int to)
 {
 	int fd;
 	struct stat statb;
-	int nr;
+	ssize_t nr;
 	void *bp;
 
-	if ((fd = open(from, 0)) < 0) {
-		printf("error: unable to open file %s\n", from);
-		exit(1);
-	}
+	if ((fd = open(from, 0)) < 0)
+		err(EXIT_FAILURE, "Unable to open file `%s'", from);
 	fstat(fd, );
 	ld.address = htobe32(loadpoint);
 	ld.count = htobe32(statb.st_size);
-	bp = malloc(statb.st_size);
-	if ((nr = read(fd, bp, statb.st_size)) < 0) {
-		printf("error: reading from file %s\n", from);
-		exit(1);
-	}
+	if ((bp = malloc(statb.st_size)) == NULL)
+		err(EXIT_FAILURE, "Can't allocate buffer");
+	if (read(fd, bp, statb.st_size) < 0)
+		err(EXIT_FAILURE, "Error reading from file `%s'", from);
 	(void)close(fd);
 	write(to, , sizeof(ld));
 	write(to, bp, statb.st_size);
@@ -249,8 +246,9 @@ void
 usage(void)
 {
 
-	fprintf(stderr, "Usage:	%s -l ] prog1 [ prog2 ] outfile\n", getprogname());
-	exit(1);
+	fprintf(stderr, "Usage:	%s -l  [-t ] prog1 "
+	"[ prog2 ] outfile\n", getprogname());
+	exit(EXIT_FAILURE);
 }
 
 char *



CVS commit: src/sys/arch/hp300/stand/mkboot

2024-02-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb  9 16:18:12 UTC 2024

Modified Files:
src/sys/arch/hp300/stand/mkboot: mkboot.c

Log Message:
fix usage string, improve error handling.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/hp300/stand/mkboot/mkboot.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/hp300/stand

2024-02-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Feb  8 18:10:34 UTC 2024

Modified Files:
src/sys/arch/hp300/stand: Makefile.buildboot
src/sys/arch/hp300/stand/mkboot: mkboot.c

Log Message:
PR/57909: Jan-Benedict Glaw: Don't include (build) timestamp when doing a
reproducible build


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/hp300/stand/Makefile.buildboot
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/hp300/stand/mkboot/mkboot.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/hp300/stand/Makefile.buildboot
diff -u src/sys/arch/hp300/stand/Makefile.buildboot:1.37 src/sys/arch/hp300/stand/Makefile.buildboot:1.38
--- src/sys/arch/hp300/stand/Makefile.buildboot:1.37	Fri Jul  9 13:44:28 2021
+++ src/sys/arch/hp300/stand/Makefile.buildboot	Thu Feb  8 13:10:34 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.buildboot,v 1.37 2021/07/09 17:44:28 tsutsui Exp $
+#	$NetBSD: Makefile.buildboot,v 1.38 2024/02/08 18:10:34 christos Exp $
 
 # RELOC=FFF0 allows for boot prog up to FF000 (1044480) bytes long
 RELOC=	FFF0
@@ -29,9 +29,13 @@ LIBC=
 LIBCRTBEGIN=
 LIBCRTEND=
 
+.if ${MKREPRO_TIMESTAMP:Uno} != "no"
+HP300MKBOOT_TIMESTAMP=-t "${MKREPRO_TIMESTAMP}"
+.endif
+
 ${PROG}: ${PROGAOUT}
 	${OBJCOPY} --output-target=binary ${PROGAOUT} ${PROGAOUT}.bin
-	${TOOL_HP300MKBOOT} -l 0x${RELOC} ${PROGAOUT}.bin ${PROG}
+	${TOOL_HP300MKBOOT} -l 0x${RELOC} ${HP300MKBOOT_TIMESTAMP} ${PROGAOUT}.bin ${PROG}
 	rm -f ${PROGAOUT}.bin
 
 .include "${S}/conf/newvers_stand.mk"

Index: src/sys/arch/hp300/stand/mkboot/mkboot.c
diff -u src/sys/arch/hp300/stand/mkboot/mkboot.c:1.11 src/sys/arch/hp300/stand/mkboot/mkboot.c:1.12
--- src/sys/arch/hp300/stand/mkboot/mkboot.c:1.11	Sat Oct 11 01:33:25 2014
+++ src/sys/arch/hp300/stand/mkboot/mkboot.c	Thu Feb  8 13:10:34 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: mkboot.c,v 1.11 2014/10/11 05:33:25 dholland Exp $	*/
+/*	$NetBSD: mkboot.c,v 1.12 2024/02/08 18:10:34 christos Exp $	*/
 
 /*
  * Copyright (c) 1990, 1993
@@ -47,7 +47,7 @@ __COPYRIGHT(
 #ifdef notdef
 static char sccsid[] = "@(#)mkboot.c	7.2 (Berkeley) 12/16/90";
 #endif
-__RCSID("$NetBSD: mkboot.c,v 1.11 2014/10/11 05:33:25 dholland Exp $");
+__RCSID("$NetBSD: mkboot.c,v 1.12 2024/02/08 18:10:34 christos Exp $");
 #endif /* not lint */
 
 #include 
@@ -60,6 +60,7 @@ __RCSID("$NetBSD: mkboot.c,v 1.11 2014/1
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -78,11 +79,11 @@ __RCSID("$NetBSD: mkboot.c,v 1.11 2014/1
 #define btolifs(b)	(((b) + (SECTSIZE - 1)) / SECTSIZE)
 #define lifstob(s)	((s) * SECTSIZE)
 
-int	lpflag;
-int	loadpoint;
+int	loadpoint = -1;
 struct  load ld;
 struct	lifvol lifv;
 struct	lifdir lifd[LIF_NUMDIR];
+time_t repro_epoch = 0;
 
 int	 main(int, char **);
 void	 bcddate(char *, char *);
@@ -110,24 +111,25 @@ int
 main(int argc, char **argv)
 {
 	char *n1, *n2, *n3;
-	int n, to;
+	int n, to, ch;
 	int count;
 
-	--argc;
-	++argv;
-	if (argc == 0)
-		usage();
-	if (!strcmp(argv[0], "-l")) {
-		argv++;
-		argc--;
-		if (argc == 0)
+
+	while ((ch = getopt(argc, argv, "l:t:")) != -1)
+		switch (ch) {
+		case 'l':
+			loadpoint = strtol(optarg, NULL, 0);
+			break;
+		case 't':
+			repro_epoch = (time_t)atoll(optarg);
+			break;
+		default:
 			usage();
-		sscanf(argv[0], "0x%x", );
-		lpflag++;
-		argv++;
-		argc--;
-	}
-	if (!lpflag || argc == 0)
+		}
+
+	argc -= optind;
+	argv += optind;
+	if (loadpoint == -1 || argc == 0)
 		usage();
 	n1 = argv[0];
 	argv++;
@@ -147,11 +149,8 @@ main(int argc, char **argv)
 	} else
 		n2 = n3 = NULL;
 
-	to = open(argv[0], O_WRONLY | O_TRUNC | O_CREAT, 0644);
-	if (to < 0) {
-		perror("open");
-		exit(1);
-	}
+	if ((to = open(argv[0], O_WRONLY | O_TRUNC | O_CREAT, 0644)) == -1)
+		err(1, "Can't open `%s'", argv[0]);
 	/* clear possibly unused directory entries */
 	strncpy(lifd[1].dir_name, "  ", 10);
 	lifd[1].dir_type = htobe16(-1);
@@ -250,8 +249,7 @@ void
 usage(void)
 {
 
-	fprintf(stderr,
-		"usage:	 mkboot -l loadpoint prog1 [ prog2 ] outfile\n");
+	fprintf(stderr, "Usage:	%s -l ] prog1 [ prog2 ] outfile\n", getprogname());
 	exit(1);
 }
 



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

2024-02-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Feb  8 18:10:34 UTC 2024

Modified Files:
src/sys/arch/hp300/stand: Makefile.buildboot
src/sys/arch/hp300/stand/mkboot: mkboot.c

Log Message:
PR/57909: Jan-Benedict Glaw: Don't include (build) timestamp when doing a
reproducible build


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/hp300/stand/Makefile.buildboot
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/hp300/stand/mkboot/mkboot.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/hp300/stand/common

2023-04-21 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Apr 21 22:44:27 UTC 2023

Modified Files:
src/sys/arch/hp300/stand/common: apci.c dca.c dcm.c ite.c

Log Message:
Remove ancient /* ARGSUSED */ lint comments.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/hp300/stand/common/apci.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/hp300/stand/common/dca.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/hp300/stand/common/dcm.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/hp300/stand/common/ite.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/hp300/stand/common/apci.c
diff -u src/sys/arch/hp300/stand/common/apci.c:1.13 src/sys/arch/hp300/stand/common/apci.c:1.14
--- src/sys/arch/hp300/stand/common/apci.c:1.13	Thu Apr 17 12:35:24 2014
+++ src/sys/arch/hp300/stand/common/apci.c	Fri Apr 21 22:44:27 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: apci.c,v 1.13 2014/04/17 12:35:24 tsutsui Exp $	*/
+/*	$NetBSD: apci.c,v 1.14 2023/04/21 22:44:27 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1999 The NetBSD Foundation, Inc.
@@ -141,7 +141,6 @@ apciinit(struct consdev *cp)
 	apci->ap_mcr = MCR_DTR | MCR_RTS;
 }
 
-/* ARGSUSED */
 #ifndef SMALL
 int
 apcigetchar(dev_t dev)
@@ -164,7 +163,6 @@ apcigetchar(dev_t dev)
 }
 #endif
 
-/* ARGSUSED */
 void
 apciputchar(dev_t dev, int c)
 {

Index: src/sys/arch/hp300/stand/common/dca.c
diff -u src/sys/arch/hp300/stand/common/dca.c:1.7 src/sys/arch/hp300/stand/common/dca.c:1.8
--- src/sys/arch/hp300/stand/common/dca.c:1.7	Tue Feb  8 20:20:14 2011
+++ src/sys/arch/hp300/stand/common/dca.c	Fri Apr 21 22:44:27 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: dca.c,v 1.7 2011/02/08 20:20:14 rmind Exp $	*/
+/*	$NetBSD: dca.c,v 1.8 2023/04/21 22:44:27 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -103,7 +103,6 @@ dcainit(struct consdev *cp)
 	dca->dca_mcr = MCR_DTR | MCR_RTS;
 }
 
-/* ARGSUSED */
 #ifndef SMALL
 int
 dcagetchar(dev_t dev)
@@ -126,7 +125,6 @@ dcagetchar(dev_t dev)
 }
 #endif
 
-/* ARGSUSED */
 void
 dcaputchar(dev_t dev, int c)
 {

Index: src/sys/arch/hp300/stand/common/dcm.c
diff -u src/sys/arch/hp300/stand/common/dcm.c:1.9 src/sys/arch/hp300/stand/common/dcm.c:1.10
--- src/sys/arch/hp300/stand/common/dcm.c:1.9	Sat Jun 21 02:02:40 2014
+++ src/sys/arch/hp300/stand/common/dcm.c	Fri Apr 21 22:44:27 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: dcm.c,v 1.9 2014/06/21 02:02:40 tsutsui Exp $	*/
+/*	$NetBSD: dcm.c,v 1.10 2023/04/21 22:44:27 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -103,7 +103,6 @@ dcminit(struct consdev *cp)
 	DELAY(15000);
 }
 
-/* ARGSUSED */
 #ifndef SMALL
 int
 dcmgetchar(dev_t dev)
@@ -137,7 +136,6 @@ dcmgetchar(dev_t dev)
 }
 #endif
 
-/* ARGSUSED */
 void
 dcmputchar(dev_t dev, int c)
 {

Index: src/sys/arch/hp300/stand/common/ite.c
diff -u src/sys/arch/hp300/stand/common/ite.c:1.19 src/sys/arch/hp300/stand/common/ite.c:1.20
--- src/sys/arch/hp300/stand/common/ite.c:1.19	Mon Jul  5 13:41:08 2021
+++ src/sys/arch/hp300/stand/common/ite.c	Fri Apr 21 22:44:27 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: ite.c,v 1.19 2021/07/05 13:41:08 tsutsui Exp $	*/
+/*	$NetBSD: ite.c,v 1.20 2023/04/21 22:44:27 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -289,7 +289,6 @@ iteinit(struct consdev *cp)
 	kbdinit();
 }
 
-/* ARGSUSED */
 void
 iteputchar(dev_t dev, int c)
 {
@@ -354,7 +353,6 @@ ite_clrtoeol(struct ite_data *ip, struct
 	(*sp->ite_cursor)(ip, DRAW_CURSOR);
 }
 
-/* ARGSUSED */
 int
 itegetchar(dev_t dev)
 {



CVS commit: src/sys/arch/hp300/stand/common

2023-04-21 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Apr 21 22:44:27 UTC 2023

Modified Files:
src/sys/arch/hp300/stand/common: apci.c dca.c dcm.c ite.c

Log Message:
Remove ancient /* ARGSUSED */ lint comments.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/hp300/stand/common/apci.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/hp300/stand/common/dca.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/hp300/stand/common/dcm.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/hp300/stand/common/ite.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/hp300/stand/common

2023-04-21 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Apr 21 22:43:11 UTC 2023

Modified Files:
src/sys/arch/hp300/stand/common: if_le.c

Log Message:
Avoid an extern declaration in .c file.  Just declare it as static.

Suggested on tech-userlevel@.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/hp300/stand/common/if_le.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/hp300/stand/common/if_le.c
diff -u src/sys/arch/hp300/stand/common/if_le.c:1.14 src/sys/arch/hp300/stand/common/if_le.c:1.15
--- src/sys/arch/hp300/stand/common/if_le.c:1.14	Mon Nov 21 15:36:29 2022
+++ src/sys/arch/hp300/stand/common/if_le.c	Fri Apr 21 22:43:11 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_le.c,v 1.14 2022/11/21 15:36:29 tsutsui Exp $	*/
+/*	$NetBSD: if_le.c,v 1.15 2023/04/21 22:43:11 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1993 Adam Glass
@@ -98,7 +98,7 @@ static struct le_sel le0conf[] = {
 };
 #define NLE0CONF (sizeof(le0conf) / sizeof(le0conf[0]))
 
-extern struct netif_stats	le_stats[];
+static struct netif_stats	le_stats[];
 
 static struct netif_dif le_ifs[] = {
 /*	dif_unit	dif_nsel	dif_stats	dif_private	*/
@@ -106,7 +106,7 @@ static struct netif_dif le_ifs[] = {
 };
 #define NLE_IFS (sizeof(le_ifs) / sizeof(le_ifs[0]))
 
-struct netif_stats le_stats[NLE_IFS];
+static struct netif_stats le_stats[NLE_IFS];
 
 struct netif_driver le_driver = {
 	"le",			/* netif_bname */



CVS commit: src/sys/arch/hp300/stand/common

2023-04-21 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Apr 21 22:43:11 UTC 2023

Modified Files:
src/sys/arch/hp300/stand/common: if_le.c

Log Message:
Avoid an extern declaration in .c file.  Just declare it as static.

Suggested on tech-userlevel@.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/hp300/stand/common/if_le.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/hp300/stand/uboot

2022-12-10 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Dec 11 07:41:37 UTC 2022

Modified Files:
src/sys/arch/hp300/stand/uboot: Makefile

Log Message:
Enable UFS2 support.

Tested on 425t with HPDisk emulating 7958B using NetBSD 9.3 UFS2 image.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/hp300/stand/uboot/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/hp300/stand/uboot/Makefile
diff -u src/sys/arch/hp300/stand/uboot/Makefile:1.9 src/sys/arch/hp300/stand/uboot/Makefile:1.10
--- src/sys/arch/hp300/stand/uboot/Makefile:1.9	Mon Sep 23 13:42:36 2019
+++ src/sys/arch/hp300/stand/uboot/Makefile	Sun Dec 11 07:41:37 2022
@@ -1,10 +1,11 @@
-#	$NetBSD: Makefile,v 1.9 2019/09/23 13:42:36 christos Exp $
+#	$NetBSD: Makefile,v 1.10 2022/12/11 07:41:37 tsutsui Exp $
 
 PROGAOUT=	uboot
 PROGSOURCE=	uboot.c tgets.c
 NEWVERSWHAT=	"Primary Boot"
 
 CPPFLAGS+=	-DSUPPORT_ETHERNET -DSUPPORT_TAPE -DSUPPORT_DISK
+CPPFLAGS+=	-DSUPPORT_UFS2
 
 .include "../Makefile.buildboot"
 



CVS commit: src/sys/arch/hp300/stand/uboot

2022-12-10 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Dec 11 07:41:37 UTC 2022

Modified Files:
src/sys/arch/hp300/stand/uboot: Makefile

Log Message:
Enable UFS2 support.

Tested on 425t with HPDisk emulating 7958B using NetBSD 9.3 UFS2 image.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/hp300/stand/uboot/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/hp300/stand/common

2022-12-10 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Dec 11 07:39:30 UTC 2022

Modified Files:
src/sys/arch/hp300/stand/common: conf.c conf.h devopen.c samachdep.h

Log Message:
Make hp300 bootloaders UFS2 ready.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/hp300/stand/common/conf.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/hp300/stand/common/conf.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/hp300/stand/common/devopen.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/hp300/stand/common/samachdep.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/hp300/stand/common/conf.c
diff -u src/sys/arch/hp300/stand/common/conf.c:1.13 src/sys/arch/hp300/stand/common/conf.c:1.14
--- src/sys/arch/hp300/stand/common/conf.c:1.13	Sun Dec 11 06:27:35 2022
+++ src/sys/arch/hp300/stand/common/conf.c	Sun Dec 11 07:39:30 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: conf.c,v 1.13 2022/12/11 06:27:35 tsutsui Exp $	*/
+/*	$NetBSD: conf.c,v 1.14 2022/12/11 07:39:30 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993
@@ -137,9 +137,14 @@ int	npunit = __arraycount(punitsw);
 /*
  * Filesystem configuration
  */
-struct fs_ops file_system_rawfs[] = { FS_OPS(rawfs) };
-struct fs_ops file_system_ufs[] = { FS_OPS(ufs) };
-struct fs_ops file_system_nfs[] = { FS_OPS(nfs) };
+struct fs_ops file_system_rawfs[1] = { FS_OPS(rawfs) };
+struct fs_ops file_system_ufs[NFSYS_UFS] = {
+	FS_OPS(ffsv1),
+#ifdef SUPPORT_UFS2
+	FS_OPS(ffsv2),
+#endif
+};
+struct fs_ops file_system_nfs[1] = { FS_OPS(nfs) };
 
-struct fs_ops file_system[1];
-int	nfsys = 1;		/* we always know which one we want */
+struct fs_ops file_system[NFSYS_UFS];
+int	nfsys = 1;		/* default value; should be overrieded */

Index: src/sys/arch/hp300/stand/common/conf.h
diff -u src/sys/arch/hp300/stand/common/conf.h:1.2 src/sys/arch/hp300/stand/common/conf.h:1.3
--- src/sys/arch/hp300/stand/common/conf.h:1.2	Sun Dec 11 12:17:19 2005
+++ src/sys/arch/hp300/stand/common/conf.h	Sun Dec 11 07:39:30 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: conf.h,v 1.2 2005/12/11 12:17:19 christos Exp $	*/
+/*	$NetBSD: conf.h,v 1.3 2022/12/11 07:39:30 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1982, 1990, 1993
@@ -52,7 +52,25 @@ int sdstrategy(void *, int, daddr_t, siz
 int sdopen(struct open_file *, ...);
 int sdclose(struct open_file *);
 #endif
+#ifdef SUPPORT_UFS2
+#define NFSYS_UFS	2
+#else
+#define NFSYS_UFS	1
+#endif
 
 #ifdef SUPPORT_ETHERNET
 extern struct netif_driver le_driver;
 #endif
+
+/*
+ * Switch we use to set punit in devopen.
+ */
+struct punitsw {
+	int	(*p_punit)(int, int, int *);
+};
+extern	struct punitsw punitsw[];
+extern	int npunit;
+
+extern	struct fs_ops file_system_rawfs[1];
+extern	struct fs_ops file_system_ufs[NFSYS_UFS];
+extern	struct fs_ops file_system_nfs[1];

Index: src/sys/arch/hp300/stand/common/devopen.c
diff -u src/sys/arch/hp300/stand/common/devopen.c:1.12 src/sys/arch/hp300/stand/common/devopen.c:1.13
--- src/sys/arch/hp300/stand/common/devopen.c:1.12	Thu Mar  8 03:12:01 2018
+++ src/sys/arch/hp300/stand/common/devopen.c	Sun Dec 11 07:39:30 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: devopen.c,v 1.12 2018/03/08 03:12:01 mrg Exp $	*/
+/*	$NetBSD: devopen.c,v 1.13 2022/12/11 07:39:30 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -63,6 +63,7 @@
 #include 
 
 #include 
+#include 
 #include 
 
 u_int opendev;
@@ -96,18 +97,21 @@ devlookup(const char *d, int len)
 			switch (i) {
 			case 0:	/* ct */
 memcpy(file_system, file_system_rawfs,
-sizeof(struct fs_ops));
+sizeof(file_system_rawfs));
+nfsys = 1;
 break;
 
 			case 2:	/* rd */
 			case 4:	/* sd */
 memcpy(file_system, file_system_ufs,
-sizeof(struct fs_ops));
+sizeof(file_system_ufs));
+nfsys = NFSYS_UFS;
 break;
 
 			case 6:	/* le */
 memcpy(file_system, file_system_nfs,
-sizeof(struct fs_ops));
+sizeof(file_system_nfs));
+nfsys = 1;
 break;
 
 			default:
@@ -250,16 +254,22 @@ devopen(struct open_file *f, const char 
 	 */
 	switch (dev) {
 	case 0:		/* ct */
-		memcpy(file_system, file_system_rawfs, sizeof(struct fs_ops));
+		memcpy(file_system, file_system_rawfs,
+		sizeof(file_system_rawfs));
+		nfsys = 1;
 		break;
 
 	case 2:		/* rd */
 	case 4:		/* sd */
-		memcpy(file_system, file_system_ufs, sizeof(struct fs_ops));
+		memcpy(file_system, file_system_ufs,
+		sizeof(file_system_ufs));
+		nfsys = NFSYS_UFS;
 		break; 
 
 	case 6:		/* le */
-		memcpy(file_system, file_system_nfs, sizeof(struct fs_ops));
+		memcpy(file_system, file_system_nfs,
+		sizeof(file_system_nfs));
+		nfsys = 1;
 		break;
 
 	default:

Index: src/sys/arch/hp300/stand/common/samachdep.h
diff -u src/sys/arch/hp300/stand/common/samachdep.h:1.21 src/sys/arch/hp300/stand/common/samachdep.h:1.22
--- src/sys/arch/hp300/stand/common/samachdep.h:1.21	Sun Dec 11 06:20:07 2022
+++ 

CVS commit: src/sys/arch/hp300/stand/common

2022-12-10 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Dec 11 07:39:30 UTC 2022

Modified Files:
src/sys/arch/hp300/stand/common: conf.c conf.h devopen.c samachdep.h

Log Message:
Make hp300 bootloaders UFS2 ready.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/hp300/stand/common/conf.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/hp300/stand/common/conf.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/hp300/stand/common/devopen.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/hp300/stand/common/samachdep.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/hp300/stand/common

2022-12-10 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Dec 11 06:27:35 UTC 2022

Modified Files:
src/sys/arch/hp300/stand/common: conf.c

Log Message:
Remove a #if 0'ed out unused function.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/hp300/stand/common/conf.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/hp300/stand/common/conf.c
diff -u src/sys/arch/hp300/stand/common/conf.c:1.12 src/sys/arch/hp300/stand/common/conf.c:1.13
--- src/sys/arch/hp300/stand/common/conf.c:1.12	Sun Dec 23 03:11:32 2007
+++ src/sys/arch/hp300/stand/common/conf.c	Sun Dec 11 06:27:35 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: conf.c,v 1.12 2007/12/23 03:11:32 tsutsui Exp $	*/
+/*	$NetBSD: conf.c,v 1.13 2022/12/11 06:27:35 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993
@@ -143,21 +143,3 @@ struct fs_ops file_system_nfs[] = { FS_O
 
 struct fs_ops file_system[1];
 int	nfsys = 1;		/* we always know which one we want */
-
-#if 0
-/*
- * Inititalize controllers
- *
- * XXX this should be a table
- */
-void ctlrinit(void)
-{
-#ifdef SUPPORT_ETHERNET
-	leinit();
-#endif
-#if defined(SUPPORT_DISK) || defined(SUPPORT_TAPE)
-	hpibinit();
-	scsiinit();
-#endif
-}
-#endif



CVS commit: src/sys/arch/hp300/stand/common

2022-12-10 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Dec 11 06:27:35 UTC 2022

Modified Files:
src/sys/arch/hp300/stand/common: conf.c

Log Message:
Remove a #if 0'ed out unused function.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/hp300/stand/common/conf.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/hp300/stand

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

Modified Files:
src/sys/arch/hp300/stand/common: samachdep.h
src/sys/arch/hp300/stand/inst: inst.c
src/sys/arch/hp300/stand/uboot: uboot.c

Log Message:
Cleanup extern declarations.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/hp300/stand/common/samachdep.h
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/hp300/stand/inst/inst.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/hp300/stand/uboot/uboot.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/hp300/stand

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

Modified Files:
src/sys/arch/hp300/stand/common: samachdep.h
src/sys/arch/hp300/stand/inst: inst.c
src/sys/arch/hp300/stand/uboot: uboot.c

Log Message:
Cleanup extern declarations.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/hp300/stand/common/samachdep.h
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/hp300/stand/inst/inst.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/hp300/stand/uboot/uboot.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/hp300/stand/common/samachdep.h
diff -u src/sys/arch/hp300/stand/common/samachdep.h:1.20 src/sys/arch/hp300/stand/common/samachdep.h:1.21
--- src/sys/arch/hp300/stand/common/samachdep.h:1.20	Sat Jun 11 06:22:11 2016
+++ src/sys/arch/hp300/stand/common/samachdep.h	Sun Dec 11 06:20:07 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: samachdep.h,v 1.20 2016/06/11 06:22:11 dholland Exp $	*/
+/*	$NetBSD: samachdep.h,v 1.21 2022/12/11 06:20:07 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1982, 1990, 1993
@@ -68,6 +68,7 @@ int sctoaddr(int);
 
 /* cons.c */
 extern	int cons_scode;
+extern	int noconsole;
 void cninit(void);
 int cngetc(void);
 int cnputc(int);
@@ -85,6 +86,9 @@ void romputchar(int);
 void transfer(char *, int, int, int, char *, char *);
 int trap(struct trapframe *);
 
+/* netio.c */
+extern	int netio_ask;
+
 /* prf.c */
 int tgetchar(void);
 
@@ -92,6 +96,7 @@ int tgetchar(void);
 extern	u_int bootdev;
 extern	int machineid, mmuid;
 extern	int howto;
+extern	char *lowram;
 int badaddr(void *);
 void call_req_reboot(void);
 void romout(int, char *);

Index: src/sys/arch/hp300/stand/inst/inst.c
diff -u src/sys/arch/hp300/stand/inst/inst.c:1.23 src/sys/arch/hp300/stand/inst/inst.c:1.24
--- src/sys/arch/hp300/stand/inst/inst.c:1.23	Tue Sep  4 15:08:30 2018
+++ src/sys/arch/hp300/stand/inst/inst.c	Sun Dec 11 06:20:07 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: inst.c,v 1.23 2018/09/04 15:08:30 riastradh Exp $	*/
+/*	$NetBSD: inst.c,v 1.24 2022/12/11 06:20:07 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -78,11 +78,6 @@
 
 char line[100];
 
-extern	u_int opendev;
-extern	char *lowram;
-extern	int noconsole;
-extern	int netio_ask;
-
 char	*kernel_name = "/netbsd";
 
 void	main(void);

Index: src/sys/arch/hp300/stand/uboot/uboot.c
diff -u src/sys/arch/hp300/stand/uboot/uboot.c:1.17 src/sys/arch/hp300/stand/uboot/uboot.c:1.18
--- src/sys/arch/hp300/stand/uboot/uboot.c:1.17	Sat Jun 11 06:22:11 2016
+++ src/sys/arch/hp300/stand/uboot/uboot.c	Sun Dec 11 06:20:08 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: uboot.c,v 1.17 2016/06/11 06:22:11 dholland Exp $	*/
+/*	$NetBSD: uboot.c,v 1.18 2022/12/11 06:20:08 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1990, 1993
@@ -47,10 +47,6 @@
 
 char line[100];
 
-extern	u_int opendev;
-extern	char *lowram;
-extern	int noconsole;
-
 /*
  * XXX UFS accepts a /, NFS doesn't.
  */



CVS commit: src/sys/arch/hp300/stand/common

2022-11-25 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Nov 25 13:06:27 UTC 2022

Modified Files:
src/sys/arch/hp300/stand/common: rd.c

Log Message:
Sync with rdreg.h integer type changes.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/hp300/stand/common/rd.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/hp300/stand/common/rd.c
diff -u src/sys/arch/hp300/stand/common/rd.c:1.14 src/sys/arch/hp300/stand/common/rd.c:1.15
--- src/sys/arch/hp300/stand/common/rd.c:1.14	Mon Nov 21 16:22:37 2022
+++ src/sys/arch/hp300/stand/common/rd.c	Fri Nov 25 13:06:27 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rd.c,v 1.14 2022/11/21 16:22:37 tsutsui Exp $	*/
+/*	$NetBSD: rd.c,v 1.15 2022/11/25 13:06:27 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -370,7 +370,7 @@ rderror(int ctlr, int unit, int part)
 	printf("rd(%d,%d,0,%d) err: vu 0x%x",
 	   ctlr, unit, part, rd_stat.c_vu);
 	if ((rd_stat.c_aef & AEF_UD) || (rd_stat.c_ief & (IEF_MD|IEF_RD)))
-		printf(", block %ld", rd_stat.c_blk);
+		printf(", block %d", rd_stat.c_blk);
 	printf(", R0x%x F0x%x A0x%x I0x%x\n",
 	   rd_stat.c_ref, rd_stat.c_fef, rd_stat.c_aef, rd_stat.c_ief);
 	return 1;



CVS commit: src/sys/arch/hp300/stand/common

2022-11-25 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Nov 25 13:06:27 UTC 2022

Modified Files:
src/sys/arch/hp300/stand/common: rd.c

Log Message:
Sync with rdreg.h integer type changes.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/hp300/stand/common/rd.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/hp300/stand/common

2022-11-21 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon Nov 21 15:36:29 UTC 2022

Modified Files:
src/sys/arch/hp300/stand/common: if_le.c

Log Message:
Make local functions and variables static.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/hp300/stand/common/if_le.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/hp300/stand/common/if_le.c
diff -u src/sys/arch/hp300/stand/common/if_le.c:1.13 src/sys/arch/hp300/stand/common/if_le.c:1.14
--- src/sys/arch/hp300/stand/common/if_le.c:1.13	Sat Jun 21 02:02:40 2014
+++ src/sys/arch/hp300/stand/common/if_le.c	Mon Nov 21 15:36:29 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_le.c,v 1.13 2014/06/21 02:02:40 tsutsui Exp $	*/
+/*	$NetBSD: if_le.c,v 1.14 2022/11/21 15:36:29 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1993 Adam Glass
@@ -72,12 +72,12 @@ struct le_sel {
 	int	le_bonus;
 };
 
-int le_probe(struct netif *, void *);
-int le_match(struct netif *, void *);
-void le_init(struct iodesc *, void *);
-int le_get(struct iodesc *, void *, size_t, saseconds_t);
-int le_put(struct iodesc *, void *, size_t);
-void le_end(struct netif *);
+static int le_probe(struct netif *, void *);
+static int le_match(struct netif *, void *);
+static void le_init(struct iodesc *, void *);
+static int le_get(struct iodesc *, void *, size_t, saseconds_t);
+static int le_put(struct iodesc *, void *, size_t);
+static void le_end(struct netif *);
 
 static inline void lewrcsr(struct le_softc *, uint16_t, uint16_t);
 static inline uint16_t lerdcsr(struct le_softc *, uint16_t);
@@ -92,7 +92,7 @@ static int le_poll(struct iodesc *, void
 int le_debug = 0;
 #endif
 
-struct le_sel le0conf[] = {
+static struct le_sel le0conf[] = {
 /* offsets for:	   ID   REGS MEM   NVRAM	le_heat	le_bonus*/
 {		0,	0x4000, 0x8000, 0xC008,	1,	10   }
 };
@@ -100,7 +100,7 @@ struct le_sel le0conf[] = {
 
 extern struct netif_stats	le_stats[];
 
-struct netif_dif le_ifs[] = {
+static struct netif_dif le_ifs[] = {
 /*	dif_unit	dif_nsel	dif_stats	dif_private	*/
 {	0,		NLE0CONF,	_stats[0],	le0conf,	},
 };
@@ -120,7 +120,7 @@ struct netif_driver le_driver = {
 	NLE_IFS			/* netif_nifs */
 };
 
-struct le_softc le_softc[NLE];
+static struct le_softc le_softc[NLE];
 
 static inline void
 lewrcsr(struct le_softc *sc, uint16_t port, uint16_t val)
@@ -211,7 +211,7 @@ leinit(void)
 	}
 }
 
-int
+static int
 le_match(struct netif *nif, void *machdep_hint)
 {
 	struct le_sel *sels;
@@ -232,7 +232,7 @@ le_match(struct netif *nif, void *machde
 	return rv;
 }
 
-int
+static int
 le_probe(struct netif *nif, void *machdep_hint)
 {
 #if 0
@@ -307,7 +307,7 @@ le_mem_summary(int unit)
 #define le_mem_summary(u)
 #endif
 
-void
+static void
 le_error(int unit, char *str, uint16_t stat)
 {
 
@@ -328,7 +328,7 @@ le_error(int unit, char *str, uint16_t s
 	((u_long)(a) - (u_long)sc->sc_mem)
 
 /* LANCE initialization block set up. */
-void
+static void
 lememinit(struct le_softc *sc)
 {
 	int i;
@@ -388,7 +388,7 @@ lememinit(struct le_softc *sc)
 	}
 }
 
-void
+static void
 le_reset(int unit, u_char *myea)
 {
 	struct le_softc *sc = _softc[unit];
@@ -450,7 +450,7 @@ le_reset(int unit, u_char *myea)
 	le_mem_summary(unit);
 }
 
-int
+static int
 le_poll(struct iodesc *desc, void *pkt, int len)
 {
 	int unit = /*nif->nif_unit*/0;
@@ -525,7 +525,7 @@ cleanup:
 	return length;
 }
 
-int
+static int
 le_put(struct iodesc *desc, void *pkt, size_t len)
 {
 	int unit = /*nif->nif_unit*/0;
@@ -627,7 +627,7 @@ le_put(struct iodesc *desc, void *pkt, s
 }
 
 
-int
+static int
 le_get(struct iodesc *desc, void *pkt, size_t len, saseconds_t timeout)
 {
 	satime_t t;
@@ -640,7 +640,7 @@ le_get(struct iodesc *desc, void *pkt, s
 	return cc;
 }
 
-void
+static void
 le_init(struct iodesc *desc, void *machdep_hint)
 {
 	struct netif *nif = desc->io_netif;
@@ -658,7 +658,7 @@ le_init(struct iodesc *desc, void *machd
 	le_reset(unit, desc->myea);
 }
 
-void
+static void
 le_end(struct netif *nif)
 {
 	int unit = nif->nif_unit;



CVS commit: src/sys/arch/hp300/stand/common

2022-11-21 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon Nov 21 15:36:29 UTC 2022

Modified Files:
src/sys/arch/hp300/stand/common: if_le.c

Log Message:
Make local functions and variables static.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/hp300/stand/common/if_le.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/hp300/stand/common

2022-11-21 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon Nov 21 15:05:44 UTC 2022

Modified Files:
src/sys/arch/hp300/stand/common: rd.c

Log Message:
Make local variables static and read only ones const.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/hp300/stand/common/rd.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/hp300/stand/common/rd.c
diff -u src/sys/arch/hp300/stand/common/rd.c:1.12 src/sys/arch/hp300/stand/common/rd.c:1.13
--- src/sys/arch/hp300/stand/common/rd.c:1.12	Mon Nov 21 14:55:08 2022
+++ src/sys/arch/hp300/stand/common/rd.c	Mon Nov 21 15:05:44 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rd.c,v 1.12 2022/11/21 14:55:08 tsutsui Exp $	*/
+/*	$NetBSD: rd.c,v 1.13 2022/11/21 15:05:44 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -52,12 +52,12 @@
 #include 
 #include 
 
-struct	rd_iocmd rd_ioc;
-struct	rd_rscmd rd_rsc;
-struct	rd_stat rd_stat;
-struct	rd_ssmcmd rd_ssmc;
+static struct	rd_iocmd rd_ioc;
+static struct	rd_rscmd rd_rsc;
+static struct	rd_stat rd_stat;
+static struct	rd_ssmcmd rd_ssmc;
 
-struct	disklabel rdlabel;
+static struct	disklabel rdlabel;
 
 struct	rdminilabel {
 	u_short	npart;
@@ -88,9 +88,9 @@ static void rdreset(int, int);
 static int rdgetinfo(struct rd_softc *);
 static int rderror(int, int, int);
 
-struct rd_softc rd_softc[NHPIB][NRD];
+static struct rd_softc rd_softc[NHPIB][NRD];
 
-struct rdidentinfo rdidentinfo[] = {
+static const struct rdidentinfo rdidentinfo[] = {
 	[RD7945A]  = { RD7946AID,	0,	 108416 },
 	[RD9134D]  = { RD9134DID,	1,	  29088 },
 	[RD9122S]  = { RD9134LID,	1,	   1232 },
@@ -115,9 +115,9 @@ struct rdidentinfo rdidentinfo[] = {
 	[RD7911A]  = { RD7911AID,	0,	  54912 },
 	[RD7941A]  = { RD7946AID,	0,	  46464 }
 };
-int numrdidentinfo = sizeof(rdidentinfo) / sizeof(rdidentinfo[0]);
+static const int numrdidentinfo = sizeof(rdidentinfo) / sizeof(rdidentinfo[0]);
 
-int
+static int
 rdinit(int ctlr, int unit)
 {
 	struct rd_softc *rs = _softc[ctlr][unit];
@@ -210,7 +210,7 @@ rdident(int ctlr, int unit)
 	return id;
 }
 
-char io_buf[MAXBSIZE];
+static char io_buf[MAXBSIZE];
 
 static int
 rdgetinfo(struct rd_softc *rs)



CVS commit: src/sys/arch/hp300/stand/common

2022-11-21 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon Nov 21 15:05:44 UTC 2022

Modified Files:
src/sys/arch/hp300/stand/common: rd.c

Log Message:
Make local variables static and read only ones const.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/hp300/stand/common/rd.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/hp300/stand/common

2022-11-21 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon Nov 21 14:55:08 UTC 2022

Modified Files:
src/sys/arch/hp300/stand/common: rd.c

Log Message:
Sync a list of HP-IB disk IDs with kernel's one.

Now bootloader can boot from 2202A, 7908A, 7911A, and 7941A.
Tested on 425t and HPDisk.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/hp300/stand/common/rd.c

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