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 <lib/libkern/libkern.h>
 
 #include <lib/libsa/stand.h>
+#include <hp300/stand/common/conf.h>
 #include <hp300/stand/common/samachdep.h>
 
 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
+++ src/sys/arch/hp300/stand/common/samachdep.h	Sun Dec 11 07:39:30 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: samachdep.h,v 1.21 2022/12/11 06:20:07 tsutsui Exp $	*/
+/*	$NetBSD: samachdep.h,v 1.22 2022/12/11 07:39:30 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1982, 1990, 1993
@@ -105,6 +105,9 @@ void _transfer(char *, int, int, int, ch
 /* tget.c */
 int tgets(char *, size_t);
 
+/* vers.c (generated by sys/conf/newvers_stand.sh) */
+extern	char bootprog_name[], bootprog_rev[], bootprog_kernrev[];
+
 
 #define DELAY(n)							\
 do {									\
@@ -118,18 +121,3 @@ do {									\
 struct grfinfo {
 	int	grf_foo;
 };
-
-/*
- * 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[];
-extern	struct fs_ops file_system_ufs[];
-extern	struct fs_ops file_system_nfs[];
-
-extern	char bootprog_name[], bootprog_rev[], bootprog_kernrev[];

Reply via email to