CVS commit: src/external/gpl3/gcc/dist/gcc/config/arm

2021-04-28 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Apr 29 01:51:40 UTC 2021

Modified Files:
src/external/gpl3/gcc/dist/gcc/config/arm: arm.h bpabi.h netbsd-eabi.h
netbsd-elf.h

Log Message:
netbsd-eabi.h was never merged from the now present upstream version.
reduce diffs to upstream here and in other files in this subdir.

remove unused ARM_EABI_UNWIND_TABLES and __UNWIND_TABLES__.

clang defines __UNWIND_TABLES__, but doing this in GCC triggers the
need for more libgcc / libc unwind functionality to be added, and this
code has never been enabled for netbsd/earm.  (could potentially clean
up unused code in libc now, or, revive this once the full support has
been implemented..)


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/external/gpl3/gcc/dist/gcc/config/arm/arm.h
cvs rdiff -u -r1.12 -r1.13 src/external/gpl3/gcc/dist/gcc/config/arm/bpabi.h
cvs rdiff -u -r1.16 -r1.17 \
src/external/gpl3/gcc/dist/gcc/config/arm/netbsd-eabi.h
cvs rdiff -u -r1.17 -r1.18 \
src/external/gpl3/gcc/dist/gcc/config/arm/netbsd-elf.h

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

Modified files:

Index: src/external/gpl3/gcc/dist/gcc/config/arm/arm.h
diff -u src/external/gpl3/gcc/dist/gcc/config/arm/arm.h:1.22 src/external/gpl3/gcc/dist/gcc/config/arm/arm.h:1.23
--- src/external/gpl3/gcc/dist/gcc/config/arm/arm.h:1.22	Sun Apr 11 00:02:13 2021
+++ src/external/gpl3/gcc/dist/gcc/config/arm/arm.h	Thu Apr 29 01:51:39 2021
@@ -963,8 +963,8 @@ extern const int arm_arch_cde_coproc_bit
 /* ttype entries (the only interesting data references used)
use TARGET2 relocations.  */
 #define ASM_PREFERRED_EH_DATA_FORMAT(code, data) \
-(((code) == 0 && (data) == 1 && ARM_UNWIND_INFO) ? ARM_TARGET2_DWARF_FORMAT \
- : DW_EH_PE_absptr)
+  (((code) == 0 && (data) == 1 && ARM_UNWIND_INFO) ? ARM_TARGET2_DWARF_FORMAT \
+			   : DW_EH_PE_absptr)
 #endif
 
 /* The native (Norcroft) Pascal compiler for the ARM passes the static chain

Index: src/external/gpl3/gcc/dist/gcc/config/arm/bpabi.h
diff -u src/external/gpl3/gcc/dist/gcc/config/arm/bpabi.h:1.12 src/external/gpl3/gcc/dist/gcc/config/arm/bpabi.h:1.13
--- src/external/gpl3/gcc/dist/gcc/config/arm/bpabi.h:1.12	Sun Apr 11 00:02:13 2021
+++ src/external/gpl3/gcc/dist/gcc/config/arm/bpabi.h	Thu Apr 29 01:51:39 2021
@@ -28,12 +28,9 @@
 #define ARM_DEFAULT_ABI ARM_ABI_AAPCS
 
 /* Assume that AAPCS ABIs should adhere to the full BPABI.  */
-//#undef TARGET_BPABI
 #define TARGET_BPABI (TARGET_AAPCS_BASED)
 
 /* BPABI targets use EABI frame unwinding tables.  */
-#undef ARM_EABI_UNWIND_TABLES
-#define ARM_EABI_UNWIND_TABLES 1
 #undef ARM_UNWIND_INFO
 #define ARM_UNWIND_INFO 1
 

Index: src/external/gpl3/gcc/dist/gcc/config/arm/netbsd-eabi.h
diff -u src/external/gpl3/gcc/dist/gcc/config/arm/netbsd-eabi.h:1.16 src/external/gpl3/gcc/dist/gcc/config/arm/netbsd-eabi.h:1.17
--- src/external/gpl3/gcc/dist/gcc/config/arm/netbsd-eabi.h:1.16	Tue Dec  1 02:39:08 2020
+++ src/external/gpl3/gcc/dist/gcc/config/arm/netbsd-eabi.h	Thu Apr 29 01:51:39 2021
@@ -1,5 +1,5 @@
 /* Definitions of target machine for GNU compiler, NetBSD/arm ELF version.
-   Copyright (C) 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2002-2020 Free Software Foundation, Inc.
Contributed by Wasabi Systems, Inc.
 
This file is part of GCC.
@@ -22,10 +22,16 @@
 #undef MULTILIB_DEFAULTS
 #define MULTILIB_DEFAULTS { "mabi=aapcs-linux" }
 
-#define TARGET_LINKER_EABI_SUFFIX \
-(TARGET_DEFAULT_FLOAT_ABI == ARM_FLOAT_ABI_SOFT \
- ? "%{!mabi=apcs-gnu:%{!mabi=atpcs:%{mfloat-abi=hard:_eabihf;:_eabi}}}" \
- : "%{!mabi=apcs-gnu:%{!mabi=atpcs:%{mfloat-abi=soft:_eabi;:_eabihf}}}")
+#define TARGET_LINKER_EABI_SUFFIX_SOFT \
+  "%{!mabi=apcs-gnu:%{!mabi=atpcs:%{mfloat-abi=hard:_eabihf;:_eabi}}}"
+#define TARGET_LINKER_EABI_SUFFIX_HARD \
+  "%{!mabi=apcs-gnu:%{!mabi=atpcs:%{mfloat-abi=soft:_eabi;:_eabihf}}}"
+
+#define TARGET_LINKER_EABI_SUFFIX			\
+  (TARGET_DEFAULT_FLOAT_ABI == ARM_FLOAT_ABI_SOFT	\
+   ? TARGET_LINKER_EABI_SUFFIX_SOFT			\
+   : TARGET_LINKER_EABI_SUFFIX_HARD)
+
 #define TARGET_LINKER_BIG_EMULATION "armelfb_nbsd%(linker_eabi_suffix)"
 #define TARGET_LINKER_LITTLE_EMULATION "armelf_nbsd%(linker_eabi_suffix)"
 
@@ -41,8 +47,6 @@
 #undef ARM_DEFAULT_ABI
 #define ARM_DEFAULT_ABI ARM_ABI_AAPCS_LINUX
 
-#undef ARM_EABI_UNWIND_TABLES
-#define ARM_EABI_UNWIND_TABLES 0
 #undef ARM_UNWIND_INFO
 #define ARM_UNWIND_INFO 0
 #undef ARM_DWARF_UNWIND_TABLES
@@ -57,8 +61,6 @@
   NETBSD_OS_CPP_BUILTINS_ELF();		\
   if (ARM_DWARF_UNWIND_TABLES)		\
 	builtin_define ("__ARM_DWARF_EH__");	\
-  if (ARM_EABI_UNWIND_TABLES)		\
-	builtin_define ("__UNWIND_TABLES__");	\
 }		\
   while (0)
 
@@ -73,13 +75,15 @@
 
 #undef SIZE_TYPE
 #define SIZE_TYPE "long unsigned int"
- 
+
 #undef PTRDIFF_TYPE
 #define PTRDIFF_TYPE "long int"
 
 #undef SUBTARGET_EXTRA_ASM_SPEC
-#define 

CVS commit: src

2021-04-28 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Wed Apr 28 16:57:05 UTC 2021

Modified Files:
src/share/man/man4/man4.evbarm: sun8icrypto.4
src/sys/arch/arm/sunxi: sun8i_crypto.c
src/sys/arch/evbarm/conf: GENERIC

Log Message:
enable sun8icrypto on Allwinner H3 too.

Allwinner H3 needs a slower mod clock according to the Linux driver.

tested on NanoPi R1.

thanks jmcneill@ and riastradh@ for advice.

XXX pullup-9


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/share/man/man4/man4.evbarm/sun8icrypto.4
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/arm/sunxi/sun8i_crypto.c
cvs rdiff -u -r1.95 -r1.96 src/sys/arch/evbarm/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/share/man/man4/man4.evbarm/sun8icrypto.4
diff -u src/share/man/man4/man4.evbarm/sun8icrypto.4:1.1 src/share/man/man4/man4.evbarm/sun8icrypto.4:1.2
--- src/share/man/man4/man4.evbarm/sun8icrypto.4:1.1	Tue Apr 27 21:13:38 2021
+++ src/share/man/man4/man4.evbarm/sun8icrypto.4	Wed Apr 28 16:57:05 2021
@@ -1,4 +1,4 @@
-.\" $NetBSD: sun8icrypto.4,v 1.1 2021/04/27 21:13:38 nia Exp $
+.\" $NetBSD: sun8icrypto.4,v 1.2 2021/04/28 16:57:05 bad Exp $
 .\"
 .\" Copyright (c) 2021 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -24,7 +24,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd April 25, 2021
+.Dd April 28, 2021
 .Dt SUN8ICRYPTO 4
 .Os
 .Sh NAME
@@ -36,7 +36,7 @@
 The
 .Nm
 driver provides support for the cryptographic processors on Allwinner
-A64 and H5 systems-on-a-chip.
+A64, H3 and H5 systems-on-a-chip.
 The Allwinner Crypto Engine is the successor to the earlier
 Allwinner Security System.
 .Pp

Index: src/sys/arch/arm/sunxi/sun8i_crypto.c
diff -u src/sys/arch/arm/sunxi/sun8i_crypto.c:1.24 src/sys/arch/arm/sunxi/sun8i_crypto.c:1.25
--- src/sys/arch/arm/sunxi/sun8i_crypto.c:1.24	Sat Apr 24 13:01:35 2021
+++ src/sys/arch/arm/sunxi/sun8i_crypto.c	Wed Apr 28 16:57:05 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: sun8i_crypto.c,v 1.24 2021/04/24 13:01:35 riastradh Exp $	*/
+/*	$NetBSD: sun8i_crypto.c,v 1.25 2021/04/28 16:57:05 bad Exp $	*/
 
 /*-
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -43,7 +43,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: sun8i_crypto.c,v 1.24 2021/04/24 13:01:35 riastradh Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sun8i_crypto.c,v 1.25 2021/04/28 16:57:05 bad Exp $");
 
 #include 
 #include 
@@ -72,6 +72,28 @@ __KERNEL_RCSID(1, "$NetBSD: sun8i_crypto
 #define	SUN8I_CRYPTO_RNGENTROPY	100 /* estimated bits per bit of entropy */
 #define	SUN8I_CRYPTO_RNGBYTES	PAGE_SIZE
 
+struct sun8i_crypto_config {
+	u_int	mod_rate;	/* module clock rate */
+};
+
+/*
+ * The module clock is set to 50 MHz on H3, 300 MHz otherwise.
+ * From Linux drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c:
+ * Module clock is lower on H3 than other SoC due to some DMA
+ * timeout occurring with high value.
+ */
+static const struct sun8i_crypto_config sun50i_a64_crypto_config = {
+	.mod_rate = 300*1000*1000,
+};
+
+static const struct sun8i_crypto_config sun50i_h5_crypto_config = {
+	.mod_rate = 300*1000*1000,
+};
+
+static const struct sun8i_crypto_config sun8i_h3_crypto_config = {
+	.mod_rate = 50*1000*1000,
+};
+
 struct sun8i_crypto_task;
 
 struct sun8i_crypto_buf {
@@ -86,6 +108,9 @@ struct sun8i_crypto_softc {
 	bus_space_handle_t		sc_bsh;
 	bus_dma_tag_t			sc_dmat;
 	struct pool_cache		*sc_taskpool;
+
+	const struct sun8i_crypto_config *sc_cfg;
+
 	kmutex_t			sc_lock;
 	struct sun8i_crypto_chan {
 		struct sun8i_crypto_task	*cc_task;
@@ -319,8 +344,12 @@ CFATTACH_DECL_NEW(sun8i_crypto, sizeof(s
 sun8i_crypto_match, sun8i_crypto_attach, NULL, NULL);
 
 static const struct device_compatible_entry compat_data[] = {
-	{ .compat = "allwinner,sun50i-a64-crypto" },
-	{ .compat = "allwinner,sun50i-h5-crypto" },
+	{ .compat = "allwinner,sun50i-a64-crypto",
+	  .data = _a64_crypto_config },
+	{ .compat = "allwinner,sun50i-h5-crypto",
+	  .data = _h5_crypto_config },
+	{ .compat = "allwinner,sun8i-h3-crypto",
+	  .data = _h3_crypto_config },
 	DEVICE_COMPAT_EOL
 };
 
@@ -343,6 +372,7 @@ sun8i_crypto_attach(device_t parent, dev
 	char intrstr[128];
 	struct clk *clk;
 	struct fdtbus_reset *rst;
+	u_int mod_rate;
 
 	sc->sc_dev = self;
 	sc->sc_dmat = faa->faa_dmat;
@@ -350,6 +380,7 @@ sun8i_crypto_attach(device_t parent, dev
 	sc->sc_taskpool = pool_cache_init(sizeof(struct sun8i_crypto_task),
 	0, 0, 0, "sun8icry", NULL, IPL_VM,
 	_crypto_task_ctor, _crypto_task_dtor, sc);
+	sc->sc_cfg = of_compatible_lookup(phandle, compat_data)->data;
 	mutex_init(>sc_lock, MUTEX_DEFAULT, IPL_VM);
 	callout_init(>sc_timeout, CALLOUT_MPSAFE);
 	callout_setfunc(>sc_timeout, _crypto_timeout, sc);
@@ -388,14 +419,16 @@ sun8i_crypto_attach(device_t parent, dev
 		return;
 	}
 
-	/* Get the module clock and set it to 300 MHz.  */
+	/* 

CVS commit: [netbsd-9] src/doc

2021-04-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 28 09:59:33 UTC 2021

Modified Files:
src/doc [netbsd-9]: CHANGES-9.2

Log Message:
Tickets #1258 and #1259


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.73 -r1.1.2.74 src/doc/CHANGES-9.2

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

Modified files:

Index: src/doc/CHANGES-9.2
diff -u src/doc/CHANGES-9.2:1.1.2.73 src/doc/CHANGES-9.2:1.1.2.74
--- src/doc/CHANGES-9.2:1.1.2.73	Wed Apr 28 04:54:19 2021
+++ src/doc/CHANGES-9.2	Wed Apr 28 09:59:33 2021
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.2,v 1.1.2.73 2021/04/28 04:54:19 martin Exp $
+# $NetBSD: CHANGES-9.2,v 1.1.2.74 2021/04/28 09:59:33 martin Exp $
 
 A complete list of changes from the NetBSD 9.1 release to the NetBSD 9.2
 release:
@@ -3005,3 +3005,20 @@ xsrc/external/mit/xorg-server.old/dist/X
 
 	Fix CVE-2021-3472 (local privilege escalation).
 	[mrg, ticket #1257]
+
+sys/arch/mac68k/mac68k/machdep.c		1.361,1.362
+
+	mac68k: make mac68k_set_io_offsets() a little bit cleaner.
+	Fix sccA (serial console) address to match the adress used by
+	the ROM (hardware does not fully decode addresses).
+	[rin, ticket #1258]
+
+bin/sh/eval.c	1.182
+bin/sh/jobs.c	1.110
+bin/sh/jobs.h	1.24
+
+	sh(1): fix fallout related to PR 48875: avoid invalid
+	subshell-elimination optimization when there are pending
+	background jobs.
+	[kre, ticket #1259]
+



CVS commit: [netbsd-9] src/bin/sh

2021-04-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 28 09:58:43 UTC 2021

Modified Files:
src/bin/sh [netbsd-9]: eval.c jobs.c jobs.h

Log Message:
Pull up following revision(s) (requested by kre in ticket #1259):

bin/sh/jobs.h: revision 1.24
bin/sh/eval.c: revision 1.182
bin/sh/jobs.c: revision 1.110

Related to PR bin/48875

Correct an issue found by Oguz  and reported
in e-mail (on the bug-bash list initially!) with the code changed to deal
with PR bin/48875

With:
 sh -c 'echo start at $SECONDS;
(sleep 3 & (sleep 1& wait) );
echo end at $SECONDS'

The shell should say "start at 0\nend at 1\n", but instead (before
this fix, in -9 and HEAD, but not -8) does "start at 0\nend at 3\n"
(Not in -8 as the 48875 changes were never pulled up)>

There was an old problem, fixed years ago, which cause the same symptom,
related to the way the jobs table was cleared (or not) in subshells, and
it seemed like that might have resurfaced.

But not so, the issue here is the sub-shell elimination, which was part
of the 48875 "fix" (not really, it wasn't really a bug, just sub-optimal
and unexpected behaviour).

What the shell actually has been running in this case is:

 sh -c 'echo start at $SECONDS;
(sleep 3 & sleep 1& wait );
echo end at $SECONDS'

as the inner subshell was deemed unnecessary - all its parent would
do is wait for its exit status, and then exit with that status - we
may as well simply replace the current sub-shell with the new one,
let it do its thing, and we're done...

But not here, the running "sleep 3" will remain a child of that merged
sub-shell, and the "wait" will thus wait for it, along with the sleep 1
which is all it should be seeing.

For now, fix this by not eliminating a sub-shell if there are existing
unwaited upon children in the current one.  It might be possible to
simply disregard the old child for the purposes of wait (and "jobs", etc,
all cmds which look at the jobs table) but the bookkeeping required to
make that work reliably is likely to take some time to get correct...

Along with this fix comes a fix to DEBUG mode shells, which, in situations
like this, could dump core in the debug code if the relevant tracing was
enabled, and add a new trace for when the jobs table is cleared (which was
added predating the discovery of the actual cause of this issue, but seems
worth keeping.)   Neither of these changes have any effect on shells
compiled normally.

XXX pullup -9


To generate a diff of this commit:
cvs rdiff -u -r1.175.2.2 -r1.175.2.3 src/bin/sh/eval.c
cvs rdiff -u -r1.106.2.1 -r1.106.2.2 src/bin/sh/jobs.c
cvs rdiff -u -r1.23 -r1.23.2.1 src/bin/sh/jobs.h

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

Modified files:

Index: src/bin/sh/eval.c
diff -u src/bin/sh/eval.c:1.175.2.2 src/bin/sh/eval.c:1.175.2.3
--- src/bin/sh/eval.c:1.175.2.2	Thu Dec 26 20:16:47 2019
+++ src/bin/sh/eval.c	Wed Apr 28 09:58:42 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: eval.c,v 1.175.2.2 2019/12/26 20:16:47 martin Exp $	*/
+/*	$NetBSD: eval.c,v 1.175.2.3 2021/04/28 09:58:42 martin Exp $	*/
 
 /*-
  * Copyright (c) 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)eval.c	8.9 (Berkeley) 6/8/95";
 #else
-__RCSID("$NetBSD: eval.c,v 1.175.2.2 2019/12/26 20:16:47 martin Exp $");
+__RCSID("$NetBSD: eval.c,v 1.175.2.3 2021/04/28 09:58:42 martin Exp $");
 #endif
 #endif /* not lint */
 
@@ -548,7 +548,7 @@ evalsubshell(union node *n, int flags)
 		flushout(outx);
 	}
 	INTOFF;
-	if ((!backgnd && flags & EV_EXIT && !have_traps()) ||
+	if ((!backgnd && flags & EV_EXIT && !have_traps() && !anyjobs()) ||
 	forkshell(jp = makejob(n, 1), n, backgnd?FORK_BG:FORK_FG) == 0) {
 		if (backgnd)
 			flags &=~ EV_TESTED;

Index: src/bin/sh/jobs.c
diff -u src/bin/sh/jobs.c:1.106.2.1 src/bin/sh/jobs.c:1.106.2.2
--- src/bin/sh/jobs.c:1.106.2.1	Mon Feb 10 18:54:14 2020
+++ src/bin/sh/jobs.c	Wed Apr 28 09:58:42 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: jobs.c,v 1.106.2.1 2020/02/10 18:54:14 martin Exp $	*/
+/*	$NetBSD: jobs.c,v 1.106.2.2 2021/04/28 09:58:42 martin Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)jobs.c	8.5 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: jobs.c,v 1.106.2.1 2020/02/10 18:54:14 martin Exp $");
+__RCSID("$NetBSD: jobs.c,v 1.106.2.2 2021/04/28 09:58:42 martin Exp $");
 #endif
 #endif /* not lint */
 
@@ -768,7 +768,7 @@ waitcmd(int argc, char **argv)
 	VTRACE(DBG_WAIT, ("wait %s%s%sfound %d candidates (last %s)\n",
 	any ? "-n " : "", *argptr ? *argptr : "",
 	argptr[0] && argptr[1] ? "... " : " ", found,
-	job ? (job->ref ? job->ref : "") : "none"));
+	job && job->used ? (job->ref ? job->ref : "") : "none"));
 
 	/*
 	 * If we were given a list of jobnums:
@@ -1033,6 +1033,32 @@ getjob(const char *name, int noerror)
 }
 
 
+/*
+ * Find 

CVS commit: [netbsd-9] src/sys/arch/mac68k/mac68k

2021-04-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 28 09:46:39 UTC 2021

Modified Files:
src/sys/arch/mac68k/mac68k [netbsd-9]: machdep.c

Log Message:
Pull up following revision(s) (requested by rin in ticket #1258):

sys/arch/mac68k/mac68k/machdep.c: revision 1.361
sys/arch/mac68k/mac68k/machdep.c: revision 1.362

Make mac68k_set_io_offsets() a little bit cleaner:
- Via1Base is always ``base'' for all supported models.
- Set sccA and SCSIBase for each model of MACH_CLASSQ class.
- Some style fixes.

No functional changes intended.

Change sccA address for Quadra 800 from base + 0xc000 to 0xc020.

The H/W partially decodes its address, and sccA is available at
offsets 0xc000, 0xc020,  The functionality is same, but Mac
toolbox ROM routines use 0xc020, and QEMU for Quadra 800 only
supports this address.


To generate a diff of this commit:
cvs rdiff -u -r1.353.2.2 -r1.353.2.3 src/sys/arch/mac68k/mac68k/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/mac68k/mac68k/machdep.c
diff -u src/sys/arch/mac68k/mac68k/machdep.c:1.353.2.2 src/sys/arch/mac68k/mac68k/machdep.c:1.353.2.3
--- src/sys/arch/mac68k/mac68k/machdep.c:1.353.2.2	Tue Apr 27 10:31:17 2021
+++ src/sys/arch/mac68k/mac68k/machdep.c	Wed Apr 28 09:46:39 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.353.2.2 2021/04/27 10:31:17 martin Exp $	*/
+/*	$NetBSD: machdep.c,v 1.353.2.3 2021/04/28 09:46:39 martin Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -74,7 +74,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.353.2.2 2021/04/27 10:31:17 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.353.2.3 2021/04/28 09:46:39 martin Exp $");
 
 #include "opt_adb.h"
 #include "opt_copy_symtab.h"
@@ -2109,24 +2109,33 @@ void
 mac68k_set_io_offsets(vaddr_t base)
 {
 
+	Via1Base = (volatile u_char *)base;
+	Via2Base = Via1Base + 0x2000 * VIA2;
 	switch (current_mac_model->class) {
 	case MACH_CLASSQ:
-		Via1Base = (volatile u_char *)base;
-
-		/* The following two may be overridden. */
-		sccA = (volatile u_char *)base + 0xc000;
-		SCSIBase = base + 0xf000;
-
 		switch (current_mac_model->machineid) {
 		case MACH_MACQ900:
 		case MACH_MACQ950:
-			mac68k_machine.scsi96_2 = 1;
 			sccA = (volatile u_char *)base + 0xc020;
+			SCSIBase = base + 0xf000;
+			mac68k_machine.scsi96_2 = 1;
 			iop_init(0);	/* For console */
 			break;
+		case MACH_MACQ800:
+			/*
+			 * The H/W partially decode address for sccA; it is
+			 * available at offsets 0xc000, 0xc020,  Here,
+			 * we choose 0xc020, where Mac toolbox ROM uses.
+			 */
+			sccA = (volatile u_char *)base + 0xc020;
+			SCSIBase = base + 0x1;
+			break;
 		case MACH_MACQ700:
+			sccA = (volatile u_char *)base + 0xc000;
+			SCSIBase = base + 0xf000;
 			break;
 		default:
+			sccA = (volatile u_char *)base + 0xc000;
 			SCSIBase = base + 0x1;
 			break;
 		}
@@ -2137,7 +2146,6 @@ mac68k_set_io_offsets(vaddr_t base)
 		 * machines.  This seems to be common on many of the
 		 * Quadra-type machines.
 		 */
-		Via1Base = (volatile u_char *)base;
 		sccA = (volatile u_char *)base + 0xc020;
 		SCSIBase = base + 0x1;
 		break;
@@ -2146,12 +2154,10 @@ mac68k_set_io_offsets(vaddr_t base)
 		 * Here's a queer bird... it seems to be a cross between
 		 * the two different Quadra classes.
 		 */
-		Via1Base = (volatile u_char *) base;
-		sccA = (volatile u_char *) base + 0xc020;
+		sccA = (volatile u_char *)base + 0xc020;
 		SCSIBase = base;
 		break;
 	case MACH_CLASSAV:
-		Via1Base = (volatile u_char *)base;
 		sccA = (volatile u_char *)base + 0x4000;
 		SCSIBase = base + 0x18000;
 		PSCBase = (volatile u_char *)base + 0x31000;
@@ -2163,8 +2169,7 @@ mac68k_set_io_offsets(vaddr_t base)
 	case MACH_CLASSIIsi:
 	case MACH_CLASSIIvx:
 	case MACH_CLASSLC:
-		Via1Base = (volatile u_char *)base;
-		sccA = (volatile u_char *) base + 0x4000;
+		sccA = (volatile u_char *)base + 0x4000;
 		SCSIBase = base;
 		break;
 	case MACH_CLASSIIfx:
@@ -2173,7 +2178,6 @@ mac68k_set_io_offsets(vaddr_t base)
 		 * the serial port in `compatible' mode (set in
 		 * the Serial Switch control panel before booting).
 		 */
-		Via1Base = (volatile u_char *)base;
 		sccA = (volatile u_char *)base + 0x4020;
 		SCSIBase = base;
 		iop_init(0);	/* For console */
@@ -2184,7 +2188,6 @@ mac68k_set_io_offsets(vaddr_t base)
 		current_mac_model->class);
 		break;
 	}
-	Via2Base = Via1Base + 0x2000 * VIA2;
 }
 
 #if GRAYBARS



CVS commit: src/sys/net

2021-04-28 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Wed Apr 28 09:39:39 UTC 2021

Modified Files:
src/sys/net: if_spppsubr.c

Log Message:
Introduce a pointer to refer sp->scp[cp->protoidx]

There is no functional difference.


To generate a diff of this commit:
cvs rdiff -u -r1.227 -r1.228 src/sys/net/if_spppsubr.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/net/if_spppsubr.c
diff -u src/sys/net/if_spppsubr.c:1.227 src/sys/net/if_spppsubr.c:1.228
--- src/sys/net/if_spppsubr.c:1.227	Wed Apr 28 09:36:24 2021
+++ src/sys/net/if_spppsubr.c	Wed Apr 28 09:39:39 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_spppsubr.c,v 1.227 2021/04/28 09:36:24 yamaguchi Exp $	 */
+/*	$NetBSD: if_spppsubr.c,v 1.228 2021/04/28 09:39:39 yamaguchi Exp $	 */
 
 /*
  * Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.227 2021/04/28 09:36:24 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.228 2021/04/28 09:39:39 yamaguchi Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -1642,12 +1642,15 @@ sppp_cp_input(const struct cp *cp, struc
 {
 	STDDCL;
 	struct lcp_header *h;
+	struct sppp_cp *scp;
 	int printlen, len = m->m_pkthdr.len;
 	u_char *p;
 	uint32_t u32;
 
 	SPPP_LOCK(sp, RW_WRITER);
 
+	scp = >scp[cp->protoidx];
+
 	if (len < 4) {
 		if (debug)
 			log(LOG_DEBUG,
@@ -1661,7 +1664,7 @@ sppp_cp_input(const struct cp *cp, struc
 		log(LOG_DEBUG,
 		"%s: %s input(%s): <%s id=0x%x len=%d",
 		ifp->if_xname, cp->name,
-		sppp_state_name(sp->scp[cp->protoidx].state),
+		sppp_state_name(scp->state),
 		sppp_cp_type_name(h->type), h->ident, printlen);
 		if (len < printlen)
 			printlen = len;
@@ -1683,62 +1686,62 @@ sppp_cp_input(const struct cp *cp, struc
 			break;
 		}
 
-		sp->scp[cp->protoidx].rcr_type = CP_RCR_NONE;
-		sp->scp[cp->protoidx].rconfid = h->ident;
-		if (sp->scp[cp->protoidx].mbuf_confreq != NULL) {
-			m_freem(sp->scp[cp->protoidx].mbuf_confreq);
+		scp->rcr_type = CP_RCR_NONE;
+		scp->rconfid = h->ident;
+		if (scp->mbuf_confreq != NULL) {
+			m_freem(scp->mbuf_confreq);
 		}
-		sp->scp[cp->protoidx].mbuf_confreq = m;
+		scp->mbuf_confreq = m;
 		m = NULL;
-		sppp_wq_add(sp->wq_cp, >scp[cp->protoidx].work_rcr);
+		sppp_wq_add(sp->wq_cp, >work_rcr);
 		break;
 	case CONF_ACK:
-		if (h->ident != sp->scp[cp->protoidx].confid) {
+		if (h->ident != scp->confid) {
 			if (debug)
 addlog("%s: %s id mismatch 0x%x != 0x%x\n",
    ifp->if_xname, cp->name,
-   h->ident, sp->scp[cp->protoidx].confid);
+   h->ident, scp->confid);
 			if_statinc(ifp, if_ierrors);
 			break;
 		}
-		sppp_wq_add(sp->wq_cp, >scp[cp->protoidx].work_rca);
+		sppp_wq_add(sp->wq_cp, >work_rca);
 		break;
 	case CONF_NAK:
 	case CONF_REJ:
-		if (h->ident != sp->scp[cp->protoidx].confid) {
+		if (h->ident != scp->confid) {
 			if (debug)
 addlog("%s: %s id mismatch 0x%x != 0x%x\n",
    ifp->if_xname, cp->name,
-   h->ident, sp->scp[cp->protoidx].confid);
+   h->ident, scp->confid);
 			if_statinc(ifp, if_ierrors);
 			break;
 		}
 
-		if (sp->scp[cp->protoidx].mbuf_confnak) {
-			m_freem(sp->scp[cp->protoidx].mbuf_confnak);
+		if (scp->mbuf_confnak) {
+			m_freem(scp->mbuf_confnak);
 		}
-		sp->scp[cp->protoidx].mbuf_confnak = m;
+		scp->mbuf_confnak = m;
 		m = NULL;
-		sppp_wq_add(sp->wq_cp, >scp[cp->protoidx].work_rcn);
+		sppp_wq_add(sp->wq_cp, >work_rcn);
 		break;
 	case TERM_REQ:
-		sp->scp[cp->protoidx].rseq = h->ident;
-		sppp_wq_add(sp->wq_cp, >scp[cp->protoidx].work_rtr);
+		scp->rseq = h->ident;
+		sppp_wq_add(sp->wq_cp, >work_rtr);
 		break;
 	case TERM_ACK:
-		if (h->ident != sp->scp[cp->protoidx].confid &&
-		h->ident != sp->scp[cp->protoidx].seq) {
+		if (h->ident != scp->confid &&
+		h->ident != scp->seq) {
 			if (debug)
 addlog("%s: %s id mismatch "
 "0x%x != 0x%x and 0x%x != %0lx\n",
 ifp->if_xname, cp->name,
-h->ident, sp->scp[cp->protoidx].confid,
-h->ident, sp->scp[cp->protoidx].seq);
+h->ident, scp->confid,
+h->ident, scp->seq);
 			if_statinc(ifp, if_ierrors);
 			break;
 		}
 
-		sppp_wq_add(sp->wq_cp, >scp[cp->protoidx].work_rta);
+		sppp_wq_add(sp->wq_cp, >work_rta);
 		break;
 	case CODE_REJ:
 		/* XXX catastrophic rejects (RXJ-) aren't handled yet. */
@@ -1747,7 +1750,7 @@ sppp_cp_input(const struct cp *cp, struc
 		"danger will robinson\n",
 		ifp->if_xname, cp->name,
 		sppp_cp_type_name(h->type));
-		sppp_wq_add(sp->wq_cp, >scp[cp->protoidx].work_rxj);
+		sppp_wq_add(sp->wq_cp, >work_rxj);
 		break;
 	case PROTO_REJ:
 	{
@@ -1787,7 +1790,7 @@ sppp_cp_input(const struct cp *cp, struc
 break;
 			}
 		}
-		sppp_wq_add(sp->wq_cp, >scp[cp->protoidx].work_rxj);
+		sppp_wq_add(sp->wq_cp, >work_rxj);
 		break;
 	}
 	case DISC_REQ:
@@ -1798,7 +1801,7 @@ 

CVS commit: src/sys/net

2021-04-28 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Wed Apr 28 09:36:24 UTC 2021

Modified Files:
src/sys/net: if_spppsubr.c if_spppvar.h

Log Message:
Move paese of conf-req, conf-nak and conf-rej into workqueue
from softint context

When the pases were processed in softint, the state machine
in if_spppsubr.c had been broken by simultaneous events
on rare occasions.

Example:
 1. Do ifconfig pppoe* up
- lcp open event is enqueued to workqueue
 2. Receive conf-ack, and parse the packet
- save mru to sp->lcp.their_mru
- lcp RCR+ event is enqueued to workqueue
 3. Process lcp open event
- initialize data including sp->lcp.their_mru
 4. Process lcp RCR+ event
- Use sp->lcp.their_mru
- but it was initialized


To generate a diff of this commit:
cvs rdiff -u -r1.226 -r1.227 src/sys/net/if_spppsubr.c
cvs rdiff -u -r1.33 -r1.34 src/sys/net/if_spppvar.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/net/if_spppsubr.c
diff -u src/sys/net/if_spppsubr.c:1.226 src/sys/net/if_spppsubr.c:1.227
--- src/sys/net/if_spppsubr.c:1.226	Mon Apr 26 08:45:57 2021
+++ src/sys/net/if_spppsubr.c	Wed Apr 28 09:36:24 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_spppsubr.c,v 1.226 2021/04/26 08:45:57 yamaguchi Exp $	 */
+/*	$NetBSD: if_spppsubr.c,v 1.227 2021/04/28 09:36:24 yamaguchi Exp $	 */
 
 /*
  * Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.226 2021/04/26 08:45:57 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.227 2021/04/28 09:36:24 yamaguchi Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -258,7 +258,8 @@ struct cp {
 	void	(*tls)(const struct cp *, struct sppp *);
 	void	(*tlf)(const struct cp *, struct sppp *);
 	void	(*scr)(struct sppp *);
-	void	(*scan)(const struct cp *, struct sppp *);
+	void	(*screply)(const struct cp *, struct sppp *, u_char,
+		uint8_t, size_t, void *);
 
 	/* message parser */
 	enum cp_rcr_type
@@ -347,8 +348,8 @@ static void sppp_auth_send(const struct 
 			unsigned int, unsigned int, ...);
 static int sppp_auth_role(const struct cp *, struct sppp *);
 static void sppp_auth_to_event(struct sppp *, void *);
-static void sppp_auth_sca_scn(const struct cp *, struct sppp *);
-
+static void sppp_auth_screply(const struct cp *, struct sppp *,
+			u_char, uint8_t, size_t, void *);
 static void sppp_up_event(struct sppp *, void *);
 static void sppp_down_event(struct sppp *, void *);
 static void sppp_open_event(struct sppp *, void *);
@@ -364,7 +365,8 @@ static void sppp_rxj_event(struct sppp *
 static void sppp_null(struct sppp *);
 static void sppp_tls(const struct cp *, struct sppp *);
 static void sppp_tlf(const struct cp *, struct sppp *);
-static void sppp_sca_scn(const struct cp *, struct sppp *);
+static void sppp_screply(const struct cp *, struct sppp *,
+		u_char, uint8_t, size_t, void *);
 static void sppp_ifdown(struct sppp *, void *);
 
 static void sppp_lcp_init(struct sppp *);
@@ -466,7 +468,7 @@ static const struct cp lcp = {
 	sppp_lcp_up, sppp_lcp_down, sppp_lcp_open,
 	sppp_close_event, sppp_to_event,
 	sppp_lcp_tlu, sppp_lcp_tld, sppp_lcp_tls,
-	sppp_lcp_tlf, sppp_lcp_scr, sppp_sca_scn,
+	sppp_lcp_tlf, sppp_lcp_scr, sppp_screply,
 	sppp_lcp_confreq, sppp_lcp_confrej, sppp_lcp_confnak
 };
 
@@ -481,7 +483,7 @@ static const struct cp ipcp = {
 	sppp_up_event, sppp_down_event, sppp_ipcp_open,
 	sppp_ipcp_close, sppp_to_event,
 	sppp_ipcp_tlu, sppp_null, sppp_tls,
-	sppp_tlf, sppp_ipcp_scr, sppp_sca_scn,
+	sppp_tlf, sppp_ipcp_scr, sppp_screply,
 	sppp_ipcp_confreq, sppp_ipcp_confrej, sppp_ipcp_confnak,
 };
 
@@ -496,7 +498,7 @@ static const struct cp ipv6cp = {
 	sppp_up_event, sppp_down_event, sppp_ipv6cp_open,
 	sppp_close_event, sppp_to_event,
 	sppp_ipv6cp_tlu, sppp_null, sppp_tls,
-	sppp_tlf, sppp_ipv6cp_scr, sppp_sca_scn,
+	sppp_tlf, sppp_ipv6cp_scr, sppp_screply,
 	sppp_ipv6cp_confreq, sppp_ipv6cp_confrej, sppp_ipv6cp_confnak,
 };
 
@@ -505,7 +507,7 @@ static const struct cp pap = {
 	sppp_up_event, sppp_down_event, sppp_open_event,
 	sppp_close_event, sppp_to_event,
 	sppp_pap_tlu, sppp_null, sppp_tls, sppp_tlf,
-	sppp_pap_scr, sppp_auth_sca_scn,
+	sppp_pap_scr, sppp_auth_screply,
 	NULL, NULL, NULL
 };
 
@@ -514,7 +516,7 @@ static const struct cp chap = {
 	sppp_up_event, sppp_down_event, sppp_chap_open,
 	sppp_close_event, sppp_auth_to_event,
 	sppp_chap_tlu, sppp_null, sppp_tls, sppp_tlf,
-	sppp_chap_scr, sppp_auth_sca_scn,
+	sppp_chap_scr, sppp_auth_screply,
 	NULL, NULL, NULL
 };
 
@@ -680,7 +682,7 @@ sppp_input(struct ifnet *ifp, struct mbu
 	case PPP_LCP:
 		SPPP_UNLOCK(sp);
 		sppp_cp_input(, sp, m);
-		m_freem(m);
+		/* already m_freem(m) */
 		return;
 	case PPP_PAP:
 		SPPP_UNLOCK(sp);
@@ -701,8 +703,10 @@ sppp_input(struct ifnet *ifp, struct mbu
 		SPPP_UNLOCK(sp);
 		if (sp->pp_phase ==