CVS commit: src/sys/arch/aarch64/aarch64

2022-09-22 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Sep 22 21:48:19 UTC 2022

Modified Files:
src/sys/arch/aarch64/aarch64: db_trace.c

Log Message:
oops, my previous commit is bad. revert previous.
 is a frame pointer, not a trapframe, and it worked correctly. 
(e.g., trace $x29)


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/aarch64/aarch64/db_trace.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/aarch64/aarch64/db_trace.c
diff -u src/sys/arch/aarch64/aarch64/db_trace.c:1.22 src/sys/arch/aarch64/aarch64/db_trace.c:1.23
--- src/sys/arch/aarch64/aarch64/db_trace.c:1.22	Thu Sep 22 21:00:46 2022
+++ src/sys/arch/aarch64/aarch64/db_trace.c	Thu Sep 22 21:48:18 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: db_trace.c,v 1.22 2022/09/22 21:00:46 ryo Exp $ */
+/* $NetBSD: db_trace.c,v 1.23 2022/09/22 21:48:18 ryo Exp $ */
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.22 2022/09/22 21:00:46 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.23 2022/09/22 21:48:18 ryo Exp $");
 
 #include 
 #include 
@@ -497,6 +497,15 @@ db_sp_trace(struct trapframe *tf, db_add
 	db_addr_t pc, sp, lr0;
 	bool allow_leaf_function = false;
 
+	if (tf == NULL) {
+		/*
+		 * In the case of "trace/s ",
+		 * the specified frame pointer address is considered
+		 * a trapframe (or a switchframe) address.
+		 */
+		tf = (struct trapframe *)fp;
+	}
+
 	pr_frame(tf, pr);
 
 	db_read_bytes((db_addr_t)tf, sizeof(tf_buf), (char *)_buf);
@@ -801,15 +810,6 @@ db_stack_trace_print(db_expr_t addr, boo
 	if (count > MAXBACKTRACE)
 		count = MAXBACKTRACE;
 
-	if (tf == NULL) {
-		/*
-		 * In the case of "trace ",
-		 * the specified frame pointer address is considered
-		 * a trapframe (or a switchframe) address.
-		 */
-		tf = (struct trapframe *)fp;
-	}
-
 	if (trace_sp) {
 		/* trace $lr pushed to sp */
 		db_sp_trace(tf, fp, count, flags, pr);



CVS commit: src/sys/arch/aarch64/aarch64

2022-09-22 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Sep 22 21:48:19 UTC 2022

Modified Files:
src/sys/arch/aarch64/aarch64: db_trace.c

Log Message:
oops, my previous commit is bad. revert previous.
 is a frame pointer, not a trapframe, and it worked correctly. 
(e.g., trace $x29)


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/aarch64/aarch64/db_trace.c

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



CVS commit: src/sbin/wdogctl

2022-09-22 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Thu Sep 22 21:40:42 UTC 2022

Modified Files:
src/sbin/wdogctl: wdogctl.8

Log Message:
wdogctl(8): fix -width in previous


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sbin/wdogctl/wdogctl.8

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

Modified files:

Index: src/sbin/wdogctl/wdogctl.8
diff -u src/sbin/wdogctl/wdogctl.8:1.26 src/sbin/wdogctl/wdogctl.8:1.27
--- src/sbin/wdogctl/wdogctl.8:1.26	Thu Sep 22 14:02:45 2022
+++ src/sbin/wdogctl/wdogctl.8	Thu Sep 22 21:40:42 2022
@@ -1,4 +1,4 @@
-.\"	$NetBSD: wdogctl.8,v 1.26 2022/09/22 14:02:45 riastradh Exp $
+.\"	$NetBSD: wdogctl.8,v 1.27 2022/09/22 21:40:42 uwe Exp $
 .\"
 .\" Copyright (c) 2000 Zembu Labs, Inc.
 .\" All rights reserved.
@@ -163,7 +163,7 @@ in a modified user tickle mode: closing 
 the timer.
 .El
 .Sh FILES
-.Bl -tag -width "Pa /dev/watchdog"
+.Bl -tag -width ".Pa /dev/watchdog"
 .It Pa /dev/watchdog
 the system monitor watchdog timer device
 .El



CVS commit: src/sbin/wdogctl

2022-09-22 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Thu Sep 22 21:40:42 UTC 2022

Modified Files:
src/sbin/wdogctl: wdogctl.8

Log Message:
wdogctl(8): fix -width in previous


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sbin/wdogctl/wdogctl.8

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



CVS commit: src/doc

2022-09-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Sep 22 21:24:10 UTC 2022

Modified Files:
src/doc: 3RDPARTY CHANGES

Log Message:
new libuv


To generate a diff of this commit:
cvs rdiff -u -r1.1875 -r1.1876 src/doc/3RDPARTY
cvs rdiff -u -r1.2907 -r1.2908 src/doc/CHANGES

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.1875 src/doc/3RDPARTY:1.1876
--- src/doc/3RDPARTY:1.1875	Wed Sep 21 06:51:14 2022
+++ src/doc/3RDPARTY	Thu Sep 22 17:24:10 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1875 2022/09/21 10:51:14 wiz Exp $
+#	$NetBSD: 3RDPARTY,v 1.1876 2022/09/22 21:24:10 christos Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -151,12 +151,12 @@ Location:	external/bsd/blocklist
 Notes:
 
 Package:	libuv
-Version:	1.38.0
-Current Vers:	1.38.0
+Version:	1.44.2
+Current Vers:	1.44.2
 Maintainer:	libuv
 Archive Site:	https://dist.libuv.org/dist/
 Home Page:	https://libuv.org
-Date:		2020-06-13
+Date:		2022-09-22
 Mailing List:	https://groups.google.com/forum/#!forum/libuv
 Responsible:	christos
 License:	mit

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2907 src/doc/CHANGES:1.2908
--- src/doc/CHANGES:1.2907	Tue Sep 20 03:37:29 2022
+++ src/doc/CHANGES	Thu Sep 22 17:24:10 2022
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2907 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2908 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -687,3 +687,4 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 		[kre 20220918]
 	netinet: Remove routes on an address removal if the routes
 		reference the address. [ozaki-r 20220920]
+	libuv: Import version 1.44.2. [christos 20220922]



CVS commit: src/doc

2022-09-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Sep 22 21:24:10 UTC 2022

Modified Files:
src/doc: 3RDPARTY CHANGES

Log Message:
new libuv


To generate a diff of this commit:
cvs rdiff -u -r1.1875 -r1.1876 src/doc/3RDPARTY
cvs rdiff -u -r1.2907 -r1.2908 src/doc/CHANGES

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



CVS commit: src/external/mit/libuv/lib

2022-09-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Sep 22 21:22:50 UTC 2022

Modified Files:
src/external/mit/libuv/lib: Makefile

Log Message:
new file for 1.44.2


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/mit/libuv/lib/Makefile

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

Modified files:

Index: src/external/mit/libuv/lib/Makefile
diff -u src/external/mit/libuv/lib/Makefile:1.5 src/external/mit/libuv/lib/Makefile:1.6
--- src/external/mit/libuv/lib/Makefile:1.5	Fri Jun 18 18:12:02 2021
+++ src/external/mit/libuv/lib/Makefile	Thu Sep 22 17:22:50 2022
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.5 2021/06/18 22:12:02 mrg Exp $
+# $NetBSD: Makefile,v 1.6 2022/09/22 21:22:50 christos Exp $
 
 LIBISPRIVATE=pic
 
@@ -33,6 +33,7 @@ process.c \
 random-devurandom.c \
 signal.c \
 stream.c \
+strtok.c \
 tcp.c \
 thread.c \
 tty.c \



CVS commit: src/external/mit/libuv/lib

2022-09-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Sep 22 21:22:50 UTC 2022

Modified Files:
src/external/mit/libuv/lib: Makefile

Log Message:
new file for 1.44.2


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/mit/libuv/lib/Makefile

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



CVS commit: src/external/mit/libuv/dist

2022-09-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Sep 22 21:22:36 UTC 2022

Removed Files:
src/external/mit/libuv/dist/.github/workflows: CI.yml
src/external/mit/libuv/dist/include/uv: android-ifaddrs.h
src/external/mit/libuv/dist/src/unix: android-ifaddrs.c
src/external/mit/libuv/dist/test: dns-server.c test-callback-order.c

Log Message:
merge libuv-1.38.0 -> libuv-1.44.2


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r0 \
src/external/mit/libuv/dist/.github/workflows/CI.yml
cvs rdiff -u -r1.1.1.1 -r0 \
src/external/mit/libuv/dist/include/uv/android-ifaddrs.h
cvs rdiff -u -r1.1.1.1 -r0 \
src/external/mit/libuv/dist/src/unix/android-ifaddrs.c
cvs rdiff -u -r1.1.1.1 -r0 src/external/mit/libuv/dist/test/dns-server.c \
src/external/mit/libuv/dist/test/test-callback-order.c

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



CVS commit: src/external/mit/libuv/dist

2022-09-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Sep 22 21:22:36 UTC 2022

Removed Files:
src/external/mit/libuv/dist/.github/workflows: CI.yml
src/external/mit/libuv/dist/include/uv: android-ifaddrs.h
src/external/mit/libuv/dist/src/unix: android-ifaddrs.c
src/external/mit/libuv/dist/test: dns-server.c test-callback-order.c

Log Message:
merge libuv-1.38.0 -> libuv-1.44.2


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r0 \
src/external/mit/libuv/dist/.github/workflows/CI.yml
cvs rdiff -u -r1.1.1.1 -r0 \
src/external/mit/libuv/dist/include/uv/android-ifaddrs.h
cvs rdiff -u -r1.1.1.1 -r0 \
src/external/mit/libuv/dist/src/unix/android-ifaddrs.c
cvs rdiff -u -r1.1.1.1 -r0 src/external/mit/libuv/dist/test/dns-server.c \
src/external/mit/libuv/dist/test/test-callback-order.c

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



CVS import: src/external/mit/libuv/dist

2022-09-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Sep 22 21:20:43 UTC 2022

Update of /cvsroot/src/external/mit/libuv/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv10780

Log Message:
Import libuv-1.44.2 (last imported version was 1.38.0)

2022.07.12, Version 1.44.2 (Stable)

Changes since version 1.44.1:

* Add SHA to ChangeLog (Jameson Nash)

* aix, ibmi: handle server hang when remote sends TCP RST (V-for-Vasili)

* build: make CI a bit noisier (Jameson Nash)

* process: reset the signal mask if the fork fails (Jameson Nash)

* zos: implement cmpxchgi() using assembly (Shuowang (Wayne) Zhang)

* build: AC_SUBST for AM_CFLAGS (Claes Nästén)

* ibmi: Implement UDP disconnect (V-for-Vasili)

* doc: update active maintainers list (Ben Noordhuis)

* build: fix kFreeBSD build (James McCoy)

* build: remove Windows 2016 workflows (Darshan Sen)

* Revert "win,errors: remap ERROR_ACCESS_DENIED to UV_EACCES" (Darshan Sen)

* unix: simplify getpwuid call (Jameson Nash)

* build: filter CI by paths and branches (Jameson Nash)

* build: add iOS to macos CI (Jameson Nash)

* build: re-enable CI for windows changes (Jameson Nash)

* process,iOS: fix build breakage in process.c (Denny C. Dai)

* test: remove unused declarations in tcp_rst test (V-for-Vasili)

* core: add thread-safe strtok implementation (Guilherme Íscaro)

* win: fix incompatible-types warning (twosee)

* test: fix flaky file watcher test (Ben Noordhuis)

* build: fix AIX xlc autotools build (V-for-Vasili)

* unix,win: fix UV_RUN_ONCE + uv_idle_stop loop hang (Ben Noordhuis)

* win: fix unexpected ECONNRESET error on TCP socket (twosee)

* doc: make sample cross-platform build (gengjiawen)

* test: separate some static variables by test cases (Hannah Shi)

* sunos: fs-event callback can be called after uv_close() (Andy Fiddaman)

* uv: re-register interest in a file after change (Shuowang (Wayne) Zhang)

* uv: register UV_RENAME event for _RFIM_UNLINK (Shuowang (Wayne) Zhang)

* uv: register __rfim_event 156 as UV_RENAME (Shuowang (Wayne) Zhang)

* doc: remove smartos from supported platforms (Ben Noordhuis)

* macos: avoid posix_spawnp() cwd bug (Jameson Nash)

* release: check versions of autogen scripts are newer (Jameson Nash)

* test: rewrite embed test (Ben Noordhuis)

* openbsd: use utimensat instead of lutimes (tuftedocelot)

* doc: fix link to uvwget example main() function (blogdaren)

* unix: use MSG_CMSG_CLOEXEC where supported (Ben Noordhuis)

* test: remove disabled callback_order test (Ben Noordhuis)

* win,pipe: fix bugs with pipe resource lifetime management (Jameson Nash)

* loop: better align order-of-events behavior between platforms (Jameson Nash)

* aix,test: uv_backend_fd is not supported by poll (V-for-Vasili)

* kqueue: skip EVFILT_PROC when invalidating fds (chucksilvers)

* darwin: fix atomic-ops.h ppc64 build (Sergey Fedorov)

* zos: don't err when killing a zombie process (Shuowang (Wayne) Zhang)

* zos: avoid fs event callbacks after uv_close() (Shuowang (Wayne) Zhang)

* zos: correctly format interface addresses names (Shuowang (Wayne) Zhang)

* zos: add uv_interface_addresses() netmask support (Shuowang (Wayne) Zhang)

* zos: improve memory management of ip addresses (Shuowang (Wayne) Zhang)

* tcp,pipe: fail `bind` or `listen` after `close` (theanarkh)

* zos: implement uv_available_parallelism() (Shuowang (Wayne) Zhang)

* udp,win: fix UDP compiler warning (Jameson Nash)

* zos: fix early exit of epoll_wait() (Shuowang (Wayne) Zhang)

* unix,tcp: fix errno handling in uv__tcp_bind() (Samuel Cabrero)

* shutdown,unix: reduce code duplication (Jameson Nash)

* unix: fix c99 comments (Ben Noordhuis)

* unix: retry tcgetattr/tcsetattr() on EINTR (Ben Noordhuis)

* docs: update introduction.rst (Ikko Ashimine)

* unix,stream: optimize uv_shutdown() codepath (Jameson Nash)

* zos: delay signal handling until after normal i/o (Shuowang (Wayne) Zhang)

* stream: uv__drain() always needs to stop POLLOUT (Jameson Nash)

* unix,tcp: allow EINVAL errno from setsockopt in uv_tcp_close_reset() (Stacey
  Marshall)

* win,shutdown: improve how shutdown is dispatched (Jameson Nash)


2022.03.09, Version 1.44.1 (Stable), e8b7eb6908a847ffbe6ab2eec7428e43a0aa53a2

Changes since version 1.44.0:

* process: simplify uv__write_int calls (Jameson Nash)

* macos: don't use thread-unsafe strtok() (Ben Noordhuis)

* process: fix hang after NOTE_EXIT (Jameson Nash)


2022.03.07, Version 1.44.0 (Stable), d2bff508457336d808ba7148b33088f6acbfe0a6

Changes since version 1.43.0:

* darwin: remove EPROTOTYPE error workaround (Ben Noordhuis)

* doc: fix v1.43.0 changelog entries (cjihrig)

* win: replace CRITICAL_SECTION+Semaphore with SRWLock (David Machaj)

* darwin: translate EPROTOTYPE to ECONNRESET (Ben Noordhuis)

* android: use libc getifaddrs() (Ben Noordhuis)

* unix: fix STATIC_ASSERT to check what it means to check (Jessica Clarke)

* unix: ensure struct msghdr is zeroed in recvmmsg (Ondřej Surý)

* test: test with 

CVS import: src/external/mit/libuv/dist

2022-09-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Sep 22 21:20:43 UTC 2022

Update of /cvsroot/src/external/mit/libuv/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv10780

Log Message:
Import libuv-1.44.2 (last imported version was 1.38.0)

2022.07.12, Version 1.44.2 (Stable)

Changes since version 1.44.1:

* Add SHA to ChangeLog (Jameson Nash)

* aix, ibmi: handle server hang when remote sends TCP RST (V-for-Vasili)

* build: make CI a bit noisier (Jameson Nash)

* process: reset the signal mask if the fork fails (Jameson Nash)

* zos: implement cmpxchgi() using assembly (Shuowang (Wayne) Zhang)

* build: AC_SUBST for AM_CFLAGS (Claes Nästén)

* ibmi: Implement UDP disconnect (V-for-Vasili)

* doc: update active maintainers list (Ben Noordhuis)

* build: fix kFreeBSD build (James McCoy)

* build: remove Windows 2016 workflows (Darshan Sen)

* Revert "win,errors: remap ERROR_ACCESS_DENIED to UV_EACCES" (Darshan Sen)

* unix: simplify getpwuid call (Jameson Nash)

* build: filter CI by paths and branches (Jameson Nash)

* build: add iOS to macos CI (Jameson Nash)

* build: re-enable CI for windows changes (Jameson Nash)

* process,iOS: fix build breakage in process.c (Denny C. Dai)

* test: remove unused declarations in tcp_rst test (V-for-Vasili)

* core: add thread-safe strtok implementation (Guilherme Íscaro)

* win: fix incompatible-types warning (twosee)

* test: fix flaky file watcher test (Ben Noordhuis)

* build: fix AIX xlc autotools build (V-for-Vasili)

* unix,win: fix UV_RUN_ONCE + uv_idle_stop loop hang (Ben Noordhuis)

* win: fix unexpected ECONNRESET error on TCP socket (twosee)

* doc: make sample cross-platform build (gengjiawen)

* test: separate some static variables by test cases (Hannah Shi)

* sunos: fs-event callback can be called after uv_close() (Andy Fiddaman)

* uv: re-register interest in a file after change (Shuowang (Wayne) Zhang)

* uv: register UV_RENAME event for _RFIM_UNLINK (Shuowang (Wayne) Zhang)

* uv: register __rfim_event 156 as UV_RENAME (Shuowang (Wayne) Zhang)

* doc: remove smartos from supported platforms (Ben Noordhuis)

* macos: avoid posix_spawnp() cwd bug (Jameson Nash)

* release: check versions of autogen scripts are newer (Jameson Nash)

* test: rewrite embed test (Ben Noordhuis)

* openbsd: use utimensat instead of lutimes (tuftedocelot)

* doc: fix link to uvwget example main() function (blogdaren)

* unix: use MSG_CMSG_CLOEXEC where supported (Ben Noordhuis)

* test: remove disabled callback_order test (Ben Noordhuis)

* win,pipe: fix bugs with pipe resource lifetime management (Jameson Nash)

* loop: better align order-of-events behavior between platforms (Jameson Nash)

* aix,test: uv_backend_fd is not supported by poll (V-for-Vasili)

* kqueue: skip EVFILT_PROC when invalidating fds (chucksilvers)

* darwin: fix atomic-ops.h ppc64 build (Sergey Fedorov)

* zos: don't err when killing a zombie process (Shuowang (Wayne) Zhang)

* zos: avoid fs event callbacks after uv_close() (Shuowang (Wayne) Zhang)

* zos: correctly format interface addresses names (Shuowang (Wayne) Zhang)

* zos: add uv_interface_addresses() netmask support (Shuowang (Wayne) Zhang)

* zos: improve memory management of ip addresses (Shuowang (Wayne) Zhang)

* tcp,pipe: fail `bind` or `listen` after `close` (theanarkh)

* zos: implement uv_available_parallelism() (Shuowang (Wayne) Zhang)

* udp,win: fix UDP compiler warning (Jameson Nash)

* zos: fix early exit of epoll_wait() (Shuowang (Wayne) Zhang)

* unix,tcp: fix errno handling in uv__tcp_bind() (Samuel Cabrero)

* shutdown,unix: reduce code duplication (Jameson Nash)

* unix: fix c99 comments (Ben Noordhuis)

* unix: retry tcgetattr/tcsetattr() on EINTR (Ben Noordhuis)

* docs: update introduction.rst (Ikko Ashimine)

* unix,stream: optimize uv_shutdown() codepath (Jameson Nash)

* zos: delay signal handling until after normal i/o (Shuowang (Wayne) Zhang)

* stream: uv__drain() always needs to stop POLLOUT (Jameson Nash)

* unix,tcp: allow EINVAL errno from setsockopt in uv_tcp_close_reset() (Stacey
  Marshall)

* win,shutdown: improve how shutdown is dispatched (Jameson Nash)


2022.03.09, Version 1.44.1 (Stable), e8b7eb6908a847ffbe6ab2eec7428e43a0aa53a2

Changes since version 1.44.0:

* process: simplify uv__write_int calls (Jameson Nash)

* macos: don't use thread-unsafe strtok() (Ben Noordhuis)

* process: fix hang after NOTE_EXIT (Jameson Nash)


2022.03.07, Version 1.44.0 (Stable), d2bff508457336d808ba7148b33088f6acbfe0a6

Changes since version 1.43.0:

* darwin: remove EPROTOTYPE error workaround (Ben Noordhuis)

* doc: fix v1.43.0 changelog entries (cjihrig)

* win: replace CRITICAL_SECTION+Semaphore with SRWLock (David Machaj)

* darwin: translate EPROTOTYPE to ECONNRESET (Ben Noordhuis)

* android: use libc getifaddrs() (Ben Noordhuis)

* unix: fix STATIC_ASSERT to check what it means to check (Jessica Clarke)

* unix: ensure struct msghdr is zeroed in recvmmsg (Ondřej Surý)

* test: test with 

CVS commit: src/sys/arch/aarch64/aarch64

2022-09-22 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Sep 22 21:00:46 UTC 2022

Modified Files:
src/sys/arch/aarch64/aarch64: db_trace.c

Log Message:
Specifying the frame address "trace " was not working.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/aarch64/aarch64/db_trace.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/aarch64/aarch64/db_trace.c
diff -u src/sys/arch/aarch64/aarch64/db_trace.c:1.21 src/sys/arch/aarch64/aarch64/db_trace.c:1.22
--- src/sys/arch/aarch64/aarch64/db_trace.c:1.21	Thu Sep 22 19:33:00 2022
+++ src/sys/arch/aarch64/aarch64/db_trace.c	Thu Sep 22 21:00:46 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: db_trace.c,v 1.21 2022/09/22 19:33:00 ryo Exp $ */
+/* $NetBSD: db_trace.c,v 1.22 2022/09/22 21:00:46 ryo Exp $ */
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.21 2022/09/22 19:33:00 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.22 2022/09/22 21:00:46 ryo Exp $");
 
 #include 
 #include 
@@ -497,15 +497,6 @@ db_sp_trace(struct trapframe *tf, db_add
 	db_addr_t pc, sp, lr0;
 	bool allow_leaf_function = false;
 
-	if (tf == NULL) {
-		/*
-		 * In the case of "trace/s ",
-		 * the specified frame pointer address is considered
-		 * a trapframe (or a switchframe) address.
-		 */
-		tf = (struct trapframe *)fp;
-	}
-
 	pr_frame(tf, pr);
 
 	db_read_bytes((db_addr_t)tf, sizeof(tf_buf), (char *)_buf);
@@ -810,6 +801,15 @@ db_stack_trace_print(db_expr_t addr, boo
 	if (count > MAXBACKTRACE)
 		count = MAXBACKTRACE;
 
+	if (tf == NULL) {
+		/*
+		 * In the case of "trace ",
+		 * the specified frame pointer address is considered
+		 * a trapframe (or a switchframe) address.
+		 */
+		tf = (struct trapframe *)fp;
+	}
+
 	if (trace_sp) {
 		/* trace $lr pushed to sp */
 		db_sp_trace(tf, fp, count, flags, pr);



CVS commit: src/sys/arch/aarch64/aarch64

2022-09-22 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Sep 22 21:00:46 UTC 2022

Modified Files:
src/sys/arch/aarch64/aarch64: db_trace.c

Log Message:
Specifying the frame address "trace " was not working.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/aarch64/aarch64/db_trace.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/aarch64/aarch64

2022-09-22 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Sep 22 19:33:00 UTC 2022

Modified Files:
src/sys/arch/aarch64/aarch64: db_trace.c

Log Message:
If there was a "bl " instruction at the end of a function block,
the stack analysis backtrace (bt/s) would fail because $lr would point
to the beginning of the next function.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/aarch64/aarch64/db_trace.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/aarch64/aarch64/db_trace.c
diff -u src/sys/arch/aarch64/aarch64/db_trace.c:1.20 src/sys/arch/aarch64/aarch64/db_trace.c:1.21
--- src/sys/arch/aarch64/aarch64/db_trace.c:1.20	Mon Sep 19 17:24:23 2022
+++ src/sys/arch/aarch64/aarch64/db_trace.c	Thu Sep 22 19:33:00 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: db_trace.c,v 1.20 2022/09/19 17:24:23 ryo Exp $ */
+/* $NetBSD: db_trace.c,v 1.21 2022/09/22 19:33:00 ryo Exp $ */
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.20 2022/09/19 17:24:23 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.21 2022/09/22 19:33:00 ryo Exp $");
 
 #include 
 #include 
@@ -512,7 +512,7 @@ db_sp_trace(struct trapframe *tf, db_add
 	if (tf_buf.tf_sp == 0) {
 		/* switchframe */
 		lr0 = 0;
-		pc = aarch64_strip_pac(tf_buf.tf_lr);
+		pc = aarch64_strip_pac(tf_buf.tf_lr) - 4;
 		sp = (uint64_t)(tf + 1);
 	} else {
 		/* trapframe */
@@ -527,10 +527,10 @@ db_sp_trace(struct trapframe *tf, db_add
 	TRACE_DEBUG("lr0=%016lx\n", lr0);
 
 	for (; (count > 0) && (sp != 0); count--) {
-		if (((pc - 4) == (db_addr_t)el0_trap) ||
-		((pc - 4) == (db_addr_t)el1_trap)) {
+		if ((pc == (db_addr_t)el0_trap) ||
+		(pc == (db_addr_t)el1_trap)) {
 
-			pr_traceaddr("tf", sp, pc - 4, flags, pr);
+			pr_traceaddr("tf", sp, pc, flags, pr);
 
 			db_read_bytes((db_addr_t)sp, sizeof(tf_buf),
 			(char *)_buf);
@@ -541,7 +541,7 @@ db_sp_trace(struct trapframe *tf, db_add
 			sp = tf_buf.tf_sp;
 			pc = tf_buf.tf_pc;
 			if (pc == 0)
-pc = aarch64_strip_pac(tf_buf.tf_lr);
+pc = aarch64_strip_pac(tf_buf.tf_lr) - 4;
 			if (pc == 0)
 break;
 			lr0 = aarch64_strip_pac(tf_buf.tf_lr);
@@ -593,7 +593,7 @@ db_sp_trace(struct trapframe *tf, db_add
 			}
 
 			sp += stacksize;
-			pc = lr;
+			pc = lr - 4;
 		}
 	}
 }



CVS commit: src/sys/arch/aarch64/aarch64

2022-09-22 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Sep 22 19:33:00 UTC 2022

Modified Files:
src/sys/arch/aarch64/aarch64: db_trace.c

Log Message:
If there was a "bl " instruction at the end of a function block,
the stack analysis backtrace (bt/s) would fail because $lr would point
to the beginning of the next function.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/aarch64/aarch64/db_trace.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/xen/xen

2022-09-22 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Thu Sep 22 16:21:34 UTC 2022

Modified Files:
src/sys/arch/xen/xen: xenevt.c

Log Message:
Fix fallout from previous: ci_ipending is in the low bytes of ci_istate,
so we should not left-shift by 8 the ci_ipending value we want to add there.
Should fix KASSERT in Xen's idle_block() reported by Frank Kardel in private
mail.


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/arch/xen/xen/xenevt.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/xen/xen

2022-09-22 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Thu Sep 22 16:21:34 UTC 2022

Modified Files:
src/sys/arch/xen/xen: xenevt.c

Log Message:
Fix fallout from previous: ci_ipending is in the low bytes of ci_istate,
so we should not left-shift by 8 the ci_ipending value we want to add there.
Should fix KASSERT in Xen's idle_block() reported by Frank Kardel in private
mail.


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/arch/xen/xen/xenevt.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/xen/xen/xenevt.c
diff -u src/sys/arch/xen/xen/xenevt.c:1.67 src/sys/arch/xen/xen/xenevt.c:1.68
--- src/sys/arch/xen/xen/xenevt.c:1.67	Wed Sep  7 00:40:19 2022
+++ src/sys/arch/xen/xen/xenevt.c	Thu Sep 22 16:21:34 2022
@@ -1,4 +1,4 @@
-/*  $NetBSD: xenevt.c,v 1.67 2022/09/07 00:40:19 knakahara Exp $  */
+/*  $NetBSD: xenevt.c,v 1.68 2022/09/22 16:21:34 bouyer Exp $  */
 
 /*
  * Copyright (c) 2005 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xenevt.c,v 1.67 2022/09/07 00:40:19 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xenevt.c,v 1.68 2022/09/22 16:21:34 bouyer Exp $");
 
 #include "opt_xen.h"
 #include 
@@ -210,7 +210,7 @@ xenevt_setipending(int l1, int l2)
 	KASSERT(xenevt_ih->ih_cpu->ci_ilevel >= IPL_HIGH);
 	atomic_or_ulong(_ev1, 1UL << l1);
 	atomic_or_ulong(_ev2[l1], 1UL << l2);
-	atomic_or_64(_ih->ih_cpu->ci_istate, (1ULL << SIR_XENIPL_HIGH) << 8);
+	atomic_or_64(_ih->ih_cpu->ci_istate, (1ULL << SIR_XENIPL_HIGH));
 	atomic_add_int(_ih->ih_pending, 1);
 	evtsource[xenevt_ev]->ev_evcnt.ev_count++;
 }



CVS commit: src/sys/dev/efi

2022-09-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Sep 22 14:46:38 UTC 2022

Modified Files:
src/sys/dev/efi: efi.h

Log Message:
efi(9): Set correct calling convention for EFI runtime services.

No functional change intended -- this only affects x86, which
currently doesn't support EFI runtime services.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/efi/efi.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/dev/efi/efi.h
diff -u src/sys/dev/efi/efi.h:1.1 src/sys/dev/efi/efi.h:1.2
--- src/sys/dev/efi/efi.h:1.1	Sat Aug 20 10:55:28 2022
+++ src/sys/dev/efi/efi.h	Thu Sep 22 14:46:37 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: efi.h,v 1.1 2022/08/20 10:55:28 riastradh Exp $	*/
+/*	$NetBSD: efi.h,v 1.2 2022/09/22 14:46:37 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2004 Marcel Moolenaar
@@ -38,6 +38,12 @@
  * https://uefi.org/sites/default/files/resources/UEFI_Spec_2_9_2021_03_18.pdf
  */
 
+#if defined(__i386__) || defined(__x86_64__)
+#define	EFIAPI	__attribute__((__ms_abi__))
+#else
+#define	EFIAPI	/* empty */
+#endif
+
 enum efi_reset {
 	EFI_RESET_COLD,
 	EFI_RESET_WARM,
@@ -121,22 +127,24 @@ struct efi_tblhdr {
 
 struct efi_rt {
 	struct efi_tblhdr rt_hdr;
-	efi_status	(*rt_gettime)(struct efi_tm *, struct efi_tmcap *);
-	efi_status	(*rt_settime)(struct efi_tm *);
+	efi_status	(*rt_gettime)(struct efi_tm *, struct efi_tmcap *)
+			EFIAPI;
+	efi_status	(*rt_settime)(struct efi_tm *) EFIAPI;
 	efi_status	(*rt_getwaketime)(uint8_t *, uint8_t *,
-	struct efi_tm *);
-	efi_status	(*rt_setwaketime)(uint8_t, struct efi_tm *);
+			struct efi_tm *) EFIAPI;
+	efi_status	(*rt_setwaketime)(uint8_t, struct efi_tm *) EFIAPI;
 	efi_status	(*rt_setvirtual)(u_long, u_long, uint32_t,
-	struct efi_md *);
-	efi_status	(*rt_cvtptr)(u_long, void **);
+			struct efi_md *) EFIAPI;
+	efi_status	(*rt_cvtptr)(u_long, void **) EFIAPI;
 	efi_status	(*rt_getvar)(efi_char *, struct uuid *, uint32_t *,
-	u_long *, void *);
-	efi_status	(*rt_scanvar)(u_long *, efi_char *, struct uuid *);
+			u_long *, void *) EFIAPI;
+	efi_status	(*rt_scanvar)(u_long *, efi_char *, struct uuid *)
+			EFIAPI;
 	efi_status	(*rt_setvar)(efi_char *, struct uuid *, uint32_t,
-	u_long, void *);
-	efi_status	(*rt_gethicnt)(uint32_t *);
+			u_long, void *) EFIAPI;
+	efi_status	(*rt_gethicnt)(uint32_t *) EFIAPI;
 	efi_status	(*rt_reset)(enum efi_reset, efi_status, u_long,
-	efi_char *);
+			efi_char *) EFIAPI;
 };
 
 struct efi_systbl {



CVS commit: src/sys/dev/efi

2022-09-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Sep 22 14:46:38 UTC 2022

Modified Files:
src/sys/dev/efi: efi.h

Log Message:
efi(9): Set correct calling convention for EFI runtime services.

No functional change intended -- this only affects x86, which
currently doesn't support EFI runtime services.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/efi/efi.h

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



CVS commit: src/sys/dev

2022-09-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Sep 22 14:45:33 UTC 2022

Modified Files:
src/sys/dev/ic: i82801lpcreg.h
src/sys/dev/pci: ichsmb.c

Log Message:
ichsmb(4): Remove confusing `lpcib_' prefix on register names.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/ic/i82801lpcreg.h
cvs rdiff -u -r1.80 -r1.81 src/sys/dev/pci/ichsmb.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/dev/ic/i82801lpcreg.h
diff -u src/sys/dev/ic/i82801lpcreg.h:1.15 src/sys/dev/ic/i82801lpcreg.h:1.16
--- src/sys/dev/ic/i82801lpcreg.h:1.15	Thu Sep 22 14:43:04 2022
+++ src/sys/dev/ic/i82801lpcreg.h	Thu Sep 22 14:45:33 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: i82801lpcreg.h,v 1.15 2022/09/22 14:43:04 riastradh Exp $	*/
+/*	$NetBSD: i82801lpcreg.h,v 1.16 2022/09/22 14:45:33 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -166,73 +166,73 @@
  */
 
 /* PCI configuration registers */
-#define LPCIB_SMB_BASE	0x20		/* SMBus base address */
-#define LPCIB_SMB_HOSTC	0x40		/* host configuration */
-#define LPCIB_SMB_HOSTC_HSTEN	(1 << 0)	/* enable host controller */
-#define LPCIB_SMB_HOSTC_SMIEN	(1 << 1)	/* generate SMI */
-#define LPCIB_SMB_HOSTC_I2CEN	(1 << 2)	/* enable I2C commands */
+#define SMB_BASE	0x20		/* SMBus base address */
+#define SMB_HOSTC	0x40		/* host configuration */
+#define SMB_HOSTC_HSTEN		(1 << 0)	/* enable host controller */
+#define SMB_HOSTC_SMIEN		(1 << 1)	/* generate SMI */
+#define SMB_HOSTC_I2CEN		(1 << 2)	/* enable I2C commands */
 
 /* SMBus I/O registers */
-#define LPCIB_SMB_HS	0x00		/* host status */
-#define LPCIB_SMB_HS_BUSY		(1 << 0)	/* running a command */
-#define LPCIB_SMB_HS_INTR		(1 << 1)	/* command completed */
-#define LPCIB_SMB_HS_DEVERR	(1 << 2)	/* command error */
-#define LPCIB_SMB_HS_BUSERR	(1 << 3)	/* transaction collision */
-#define LPCIB_SMB_HS_FAILED	(1 << 4)	/* failed bus transaction */
-#define LPCIB_SMB_HS_SMBAL	(1 << 5)	/* SMBALERT# asserted */
-#define LPCIB_SMB_HS_INUSE	(1 << 6)	/* bus semaphore */
-#define LPCIB_SMB_HS_BDONE	(1 << 7)	/* byte received/transmitted */
-#define LPCIB_SMB_HS_BITS		"\020\001BUSY\002INTR\003DEVERR\004BUSERR\005FAILED\006SMBAL\007INUSE\010BDONE"
-#define LPCIB_SMB_HC	0x02		/* host control */
-#define LPCIB_SMB_HC_INTREN	(1 << 0)	/* enable interrupts */
-#define LPCIB_SMB_HC_KILL		(1 << 1)	/* kill current transaction */
-#define LPCIB_SMB_HC_CMD_QUICK	(0 << 2)	/* QUICK command */
-#define LPCIB_SMB_HC_CMD_BYTE	(1 << 2)	/* BYTE command */
-#define LPCIB_SMB_HC_CMD_BDATA	(2 << 2)	/* BYTE DATA command */
-#define LPCIB_SMB_HC_CMD_WDATA	(3 << 2)	/* WORD DATA command */
-#define LPCIB_SMB_HC_CMD_PCALL	(4 << 2)	/* PROCESS CALL command */
-#define LPCIB_SMB_HC_CMD_BLOCK	(5 << 2)	/* BLOCK command */
-#define LPCIB_SMB_HC_CMD_I2CREAD	(6 << 2)	/* I2C READ command */
-#define LPCIB_SMB_HC_CMD_BLOCKP	(7 << 2)	/* BLOCK PROCESS command */
-#define LPCIB_SMB_HC_LASTB	(1 << 5)	/* last byte in block */
-#define LPCIB_SMB_HC_START	(1 << 6)	/* start transaction */
-#define LPCIB_SMB_HC_PECEN	(1 << 7)	/* enable PEC */
-#define LPCIB_SMB_HCMD	0x03		/* host command */
-#define LPCIB_SMB_TXSLVA	0x04		/* transmit slave address */
-#define LPCIB_SMB_TXSLVA_READ	(1 << 0)	/* read direction */
-#define LPCIB_SMB_TXSLVA_ADDR(x)	(((x) & 0x7f) << 1) /* 7-bit address */
-#define LPCIB_SMB_HD0	0x05		/* host data 0 */
-#define LPCIB_SMB_HD1	0x06		/* host data 1 */
-#define LPCIB_SMB_HBDB	0x07		/* host block data byte */
-#define LPCIB_SMB_PEC	0x08		/* PEC data */
-#define LPCIB_SMB_RXSLVA	0x09		/* receive slave address */
-#define LPCIB_SMB_SD	0x0a		/* receive slave data */
-#define LPCIB_SMB_SD_MSG0(x)	((x) & 0xff)	/* data message byte 0 */
-#define LPCIB_SMB_SD_MSG1(x)	((x) >> 8)	/* data message byte 1 */
-#define LPCIB_SMB_AS	0x0c		/* auxiliary status */
-#define LPCIB_SMB_AS_CRCE		(1 << 0)	/* CRC error */
-#define LPCIB_SMB_AS_TCO		(1 << 1)	/* advanced TCO mode */
-#define LPCIB_SMB_AC	0x0d		/* auxiliary control */
-#define LPCIB_SMB_AC_AAC		(1 << 0)	/* automatically append CRC */
-#define LPCIB_SMB_AC_E32B		(1 << 1)	/* enable 32-byte buffer */
-#define LPCIB_SMB_SMLPC	0x0e		/* SMLink pin control */
-#define LPCIB_SMB_SMLPC_LINK0	(1 << 0)	/* SMLINK0 pin state */
-#define LPCIB_SMB_SMLPC_LINK1	(1 << 1)	/* SMLINK1 pin state */
-#define LPCIB_SMB_SMLPC_CLKC	(1 << 2)	/* SMLINK0 pin is untouched */
-#define LPCIB_SMB_SMBPC	0x0f		/* SMBus pin control */
-#define LPCIB_SMB_SMBPC_CLK	(1 << 0)	/* SMBCLK pin state */
-#define LPCIB_SMB_SMBPC_DATA	(1 << 1)	/* SMBDATA pin state */
-#define LPCIB_SMB_SMBPC_CLKC	(1 << 2)	/* SMBCLK pin is untouched */
-#define LPCIB_SMB_SS	0x10		/* slave status */
-#define LPCIB_SMB_SS_HN		(1 << 0)	/* Host Notify command */
-#define LPCIB_SMB_SCMD	0x11		/* slave command */
-#define LPCIB_SMB_SCMD_INTREN	(1 << 0)	/* enable interrupts on HN */
-#define LPCIB_SMB_SCMD_WKEN	(1 << 1)	

CVS commit: src/sys/dev

2022-09-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Sep 22 14:45:33 UTC 2022

Modified Files:
src/sys/dev/ic: i82801lpcreg.h
src/sys/dev/pci: ichsmb.c

Log Message:
ichsmb(4): Remove confusing `lpcib_' prefix on register names.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/ic/i82801lpcreg.h
cvs rdiff -u -r1.80 -r1.81 src/sys/dev/pci/ichsmb.c

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



CVS commit: src/sys/dev/pci

2022-09-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Sep 22 14:45:18 UTC 2022

Modified Files:
src/sys/dev/pci: ichsmb.c

Log Message:
ichsmb(4): Only rescan i2cbus child if requested.

This will let us rescan tcoichbus later too on devices where the TCO
(Intel platform controller hub watchdog timer) hangs off ichsmb(4)
instead of ichlpcib(4).


To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.80 src/sys/dev/pci/ichsmb.c

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



CVS commit: src/sys/dev/pci

2022-09-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Sep 22 14:45:18 UTC 2022

Modified Files:
src/sys/dev/pci: ichsmb.c

Log Message:
ichsmb(4): Only rescan i2cbus child if requested.

This will let us rescan tcoichbus later too on devices where the TCO
(Intel platform controller hub watchdog timer) hangs off ichsmb(4)
instead of ichlpcib(4).


To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.80 src/sys/dev/pci/ichsmb.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/dev/pci/ichsmb.c
diff -u src/sys/dev/pci/ichsmb.c:1.79 src/sys/dev/pci/ichsmb.c:1.80
--- src/sys/dev/pci/ichsmb.c:1.79	Thu Sep 22 14:45:01 2022
+++ src/sys/dev/pci/ichsmb.c	Thu Sep 22 14:45:18 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ichsmb.c,v 1.79 2022/09/22 14:45:01 riastradh Exp $	*/
+/*	$NetBSD: ichsmb.c,v 1.80 2022/09/22 14:45:18 riastradh Exp $	*/
 /*	$OpenBSD: ichiic.c,v 1.44 2020/10/07 11:23:05 jsg Exp $	*/
 
 /*
@@ -22,7 +22,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ichsmb.c,v 1.79 2022/09/22 14:45:01 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ichsmb.c,v 1.80 2022/09/22 14:45:18 riastradh Exp $");
 
 #include 
 #include 
@@ -238,14 +238,15 @@ static int
 ichsmb_rescan(device_t self, const char *ifattr, const int *locators)
 {
 	struct ichsmb_softc *sc = device_private(self);
-	struct i2cbus_attach_args iba;
 
-	if (sc->sc_i2c_device != NULL)
-		return 0;
+	if (ifattr_match(ifattr, "i2cbus") && sc->sc_i2c_device == NULL) {
+		struct i2cbus_attach_args iba;
 
-	memset(, 0, sizeof(iba));
-	iba.iba_tag = >sc_i2c_tag;
-	sc->sc_i2c_device = config_found(self, , iicbus_print, CFARGS_NONE);
+		memset(, 0, sizeof(iba));
+		iba.iba_tag = >sc_i2c_tag;
+		sc->sc_i2c_device = config_found(self, , iicbus_print,
+		CFARGS_NONE);
+	}
 
 	return 0;
 }



CVS commit: src/sys/dev/pci

2022-09-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Sep 22 14:45:01 UTC 2022

Modified Files:
src/sys/dev/pci: ichsmb.c

Log Message:
ichsmb(4): Use config_detach_children to simplify.


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/sys/dev/pci/ichsmb.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/dev/pci/ichsmb.c
diff -u src/sys/dev/pci/ichsmb.c:1.78 src/sys/dev/pci/ichsmb.c:1.79
--- src/sys/dev/pci/ichsmb.c:1.78	Thu Sep 22 14:44:47 2022
+++ src/sys/dev/pci/ichsmb.c	Thu Sep 22 14:45:01 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ichsmb.c,v 1.78 2022/09/22 14:44:47 riastradh Exp $	*/
+/*	$NetBSD: ichsmb.c,v 1.79 2022/09/22 14:45:01 riastradh Exp $	*/
 /*	$OpenBSD: ichiic.c,v 1.44 2020/10/07 11:23:05 jsg Exp $	*/
 
 /*
@@ -22,7 +22,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ichsmb.c,v 1.78 2022/09/22 14:44:47 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ichsmb.c,v 1.79 2022/09/22 14:45:01 riastradh Exp $");
 
 #include 
 #include 
@@ -256,11 +256,9 @@ ichsmb_detach(device_t self, int flags)
 	struct ichsmb_softc *sc = device_private(self);
 	int error;
 
-	if (sc->sc_i2c_device) {
-		error = config_detach(sc->sc_i2c_device, flags);
-		if (error)
-			return error;
-	}
+	error = config_detach_children(self, flags);
+	if (error)
+		return error;
 
 	iic_tag_fini(>sc_i2c_tag);
 



CVS commit: src/sys/dev/pci

2022-09-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Sep 22 14:45:01 UTC 2022

Modified Files:
src/sys/dev/pci: ichsmb.c

Log Message:
ichsmb(4): Use config_detach_children to simplify.


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/sys/dev/pci/ichsmb.c

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



CVS commit: src/sys/dev/pci

2022-09-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Sep 22 14:44:47 UTC 2022

Modified Files:
src/sys/dev/pci: ichsmb.c

Log Message:
ichsmb(4): Attach i2c bus only once.

The child could be detached, e.g. with drvctl, and then the bus
rescanned, at which point it would reinitialize a mutex without
destroying it.


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/sys/dev/pci/ichsmb.c

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



CVS commit: src/sys/dev/pci

2022-09-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Sep 22 14:44:47 UTC 2022

Modified Files:
src/sys/dev/pci: ichsmb.c

Log Message:
ichsmb(4): Attach i2c bus only once.

The child could be detached, e.g. with drvctl, and then the bus
rescanned, at which point it would reinitialize a mutex without
destroying it.


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/sys/dev/pci/ichsmb.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/dev/pci/ichsmb.c
diff -u src/sys/dev/pci/ichsmb.c:1.77 src/sys/dev/pci/ichsmb.c:1.78
--- src/sys/dev/pci/ichsmb.c:1.77	Tue Sep 13 11:47:54 2022
+++ src/sys/dev/pci/ichsmb.c	Thu Sep 22 14:44:47 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ichsmb.c,v 1.77 2022/09/13 11:47:54 msaitoh Exp $	*/
+/*	$NetBSD: ichsmb.c,v 1.78 2022/09/22 14:44:47 riastradh Exp $	*/
 /*	$OpenBSD: ichiic.c,v 1.44 2020/10/07 11:23:05 jsg Exp $	*/
 
 /*
@@ -22,7 +22,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ichsmb.c,v 1.77 2022/09/13 11:47:54 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ichsmb.c,v 1.78 2022/09/22 14:44:47 riastradh Exp $");
 
 #include 
 #include 
@@ -222,6 +222,11 @@ ichsmb_attach(device_t parent, device_t 
 			aprint_normal_dev(self, "polling\n");
 	}
 
+	/* Attach I2C bus */
+	iic_tag_init(>sc_i2c_tag);
+	sc->sc_i2c_tag.ic_cookie = sc;
+	sc->sc_i2c_tag.ic_exec = ichsmb_i2c_exec;
+
 	sc->sc_i2c_device = NULL;
 	ichsmb_rescan(self, NULL, NULL);
 
@@ -238,11 +243,6 @@ ichsmb_rescan(device_t self, const char 
 	if (sc->sc_i2c_device != NULL)
 		return 0;
 
-	/* Attach I2C bus */
-	iic_tag_init(>sc_i2c_tag);
-	sc->sc_i2c_tag.ic_cookie = sc;
-	sc->sc_i2c_tag.ic_exec = ichsmb_i2c_exec;
-
 	memset(, 0, sizeof(iba));
 	iba.iba_tag = >sc_i2c_tag;
 	sc->sc_i2c_device = config_found(self, , iicbus_print, CFARGS_NONE);



CVS commit: src/sys

2022-09-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Sep 22 14:43:04 UTC 2022

Modified Files:
src/sys/arch/x86/pci: tco.c
src/sys/dev/ic: i82801lpcreg.h

Log Message:
tco(4): Nix PMC_TCO_BASE offset in TCO register definitions.

This just uses a subregion with PMC_TCO_BASE automatically applied.

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/x86/pci/tco.c
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/ic/i82801lpcreg.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/x86/pci/tco.c
diff -u src/sys/arch/x86/pci/tco.c:1.8 src/sys/arch/x86/pci/tco.c:1.9
--- src/sys/arch/x86/pci/tco.c:1.8	Thu Sep 22 14:42:47 2022
+++ src/sys/arch/x86/pci/tco.c	Thu Sep 22 14:43:04 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: tco.c,v 1.8 2022/09/22 14:42:47 riastradh Exp $	*/
+/*	$NetBSD: tco.c,v 1.9 2022/09/22 14:43:04 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tco.c,v 1.8 2022/09/22 14:42:47 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tco.c,v 1.9 2022/09/22 14:43:04 riastradh Exp $");
 
 #include 
 #include 
@@ -259,18 +259,18 @@ tcotimer_setmode(struct sysmon_wdog *smw
 		case TCO_VERSION_RCBA:
 			/* ICH6 or newer */
 			ich6period = bus_space_read_2(sc->sc_tcot, sc->sc_tcoh,
-			PMC_TCO_TMR2 - PMC_TCO_BASE);
+			TCO_TMR2);
 			ich6period &= 0xfc00;
 			bus_space_write_2(sc->sc_tcot, sc->sc_tcoh,
-			PMC_TCO_TMR2 - PMC_TCO_BASE, ich6period | period);
+			TCO_TMR2, ich6period | period);
 			break;
 		case TCO_VERSION_PCIB:
 			/* ICH5 or older */
 			ich5period = bus_space_read_1(sc->sc_tcot, sc->sc_tcoh,
-			PMC_TCO_TMR - PMC_TCO_BASE);
+			TCO_TMR);
 			ich5period &= 0xc0;
 			bus_space_write_1(sc->sc_tcot, sc->sc_tcoh,
-			PMC_TCO_TMR - PMC_TCO_BASE, ich5period | period);
+			TCO_TMR, ich5period | period);
 			break;
 		}
 
@@ -290,12 +290,10 @@ tcotimer_tickle(struct sysmon_wdog *smw)
 	/* any value is allowed */
 	switch (sc->sc_version) {
 	case TCO_VERSION_RCBA:
-		bus_space_write_2(sc->sc_tcot, sc->sc_tcoh,
-		PMC_TCO_RLD - PMC_TCO_BASE, 1);
+		bus_space_write_2(sc->sc_tcot, sc->sc_tcoh, TCO_RLD, 1);
 		break;
 	case TCO_VERSION_PCIB:
-		bus_space_write_1(sc->sc_tcot, sc->sc_tcoh,
-		PMC_TCO_RLD - PMC_TCO_BASE, 1);
+		bus_space_write_1(sc->sc_tcot, sc->sc_tcoh, TCO_RLD, 1);
 		break;
 	}
 
@@ -307,11 +305,9 @@ tcotimer_stop(struct tco_softc *sc)
 {
 	uint16_t ioreg;
 
-	ioreg = bus_space_read_2(sc->sc_tcot, sc->sc_tcoh,
-	PMC_TCO1_CNT - PMC_TCO_BASE);
-	ioreg |= PMC_TCO1_CNT_TCO_TMR_HLT;
-	bus_space_write_2(sc->sc_tcot, sc->sc_tcoh,
-	PMC_TCO1_CNT - PMC_TCO_BASE, ioreg);
+	ioreg = bus_space_read_2(sc->sc_tcot, sc->sc_tcoh, TCO1_CNT);
+	ioreg |= TCO1_CNT_TCO_TMR_HLT;
+	bus_space_write_2(sc->sc_tcot, sc->sc_tcoh, TCO1_CNT, ioreg);
 }
 
 static void
@@ -319,25 +315,20 @@ tcotimer_start(struct tco_softc *sc)
 {
 	uint16_t ioreg;
 
-	ioreg = bus_space_read_2(sc->sc_tcot, sc->sc_tcoh,
-	PMC_TCO1_CNT - PMC_TCO_BASE);
-	ioreg &= ~PMC_TCO1_CNT_TCO_TMR_HLT;
-	bus_space_write_2(sc->sc_tcot, sc->sc_tcoh,
-	PMC_TCO1_CNT - PMC_TCO_BASE, ioreg);
+	ioreg = bus_space_read_2(sc->sc_tcot, sc->sc_tcoh, TCO1_CNT);
+	ioreg &= ~TCO1_CNT_TCO_TMR_HLT;
+	bus_space_write_2(sc->sc_tcot, sc->sc_tcoh, TCO1_CNT, ioreg);
 }
 
 static void
 tcotimer_status_reset(struct tco_softc *sc)
 {
-	bus_space_write_2(sc->sc_tcot, sc->sc_tcoh,
-	PMC_TCO1_STS - PMC_TCO_BASE,
-	PMC_TCO1_STS_TIMEOUT);
-	bus_space_write_2(sc->sc_tcot, sc->sc_tcoh,
-	PMC_TCO2_STS - PMC_TCO_BASE,
-	PMC_TCO2_STS_BOOT_STS);
-	bus_space_write_2(sc->sc_tcot, sc->sc_tcoh,
-	PMC_TCO2_STS - PMC_TCO_BASE,
-	PMC_TCO2_STS_SECONDS_TO_STS);
+	bus_space_write_2(sc->sc_tcot, sc->sc_tcoh, TCO1_STS,
+	TCO1_STS_TIMEOUT);
+	bus_space_write_2(sc->sc_tcot, sc->sc_tcoh, TCO2_STS,
+	TCO2_STS_BOOT_STS);
+	bus_space_write_2(sc->sc_tcot, sc->sc_tcoh, TCO2_STS,
+	TCO2_STS_SECONDS_TO_STS);
 }
 
 /*

Index: src/sys/dev/ic/i82801lpcreg.h
diff -u src/sys/dev/ic/i82801lpcreg.h:1.14 src/sys/dev/ic/i82801lpcreg.h:1.15
--- src/sys/dev/ic/i82801lpcreg.h:1.14	Thu Sep 22 14:42:47 2022
+++ src/sys/dev/ic/i82801lpcreg.h	Thu Sep 22 14:43:04 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: i82801lpcreg.h,v 1.14 2022/09/22 14:42:47 riastradh Exp $	*/
+/*	$NetBSD: i82801lpcreg.h,v 1.15 2022/09/22 14:43:04 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -145,6 +145,7 @@
 #define PMC_BUS_CYC_TRACK	0x4e
 #define PMC_PM_SS_CNTL		0x50		/* SpeedStep control */
 # define PMC_PM_SS_CNTL_ARB_DIS		0x01	/* disable arbiter */
+#define PMC_TCO_BASE		0x60
 
 /*
  * General Purpose I/O Registers
@@ -253,31 +254,29 @@
 
 /*
  * System management TCO registers
- *  (offset from PMBASE)
  */
-#define PMC_TCO_BASE		0x60
-#define PMC_TCO_RLD		(PMC_TCO_BASE+0x00)

CVS commit: src/sys

2022-09-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Sep 22 14:43:04 UTC 2022

Modified Files:
src/sys/arch/x86/pci: tco.c
src/sys/dev/ic: i82801lpcreg.h

Log Message:
tco(4): Nix PMC_TCO_BASE offset in TCO register definitions.

This just uses a subregion with PMC_TCO_BASE automatically applied.

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/x86/pci/tco.c
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/ic/i82801lpcreg.h

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



CVS commit: src/sys

2022-09-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Sep 22 14:42:47 UTC 2022

Modified Files:
src/sys/arch/x86/pci: tco.c
src/sys/dev/ic: i82801lpcreg.h

Log Message:
tco(4): Use a subregion of the PMC registers for TCO registers.

This is an intermediate step that will let us decouple it from access
via PMBASE.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/x86/pci/tco.c
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/ic/i82801lpcreg.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/x86/pci/tco.c
diff -u src/sys/arch/x86/pci/tco.c:1.7 src/sys/arch/x86/pci/tco.c:1.8
--- src/sys/arch/x86/pci/tco.c:1.7	Thu Sep 22 14:42:29 2022
+++ src/sys/arch/x86/pci/tco.c	Thu Sep 22 14:42:47 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: tco.c,v 1.7 2022/09/22 14:42:29 riastradh Exp $	*/
+/*	$NetBSD: tco.c,v 1.8 2022/09/22 14:42:47 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tco.c,v 1.7 2022/09/22 14:42:29 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tco.c,v 1.8 2022/09/22 14:42:47 riastradh Exp $");
 
 #include 
 #include 
@@ -60,10 +60,13 @@ struct tco_softc {
 	bus_space_tag_t		sc_rcbat;
 	bus_space_handle_t	sc_rcbah;
 	struct pcib_softc *	sc_pcib;
+	bus_space_tag_t		sc_tcot;
+	bus_space_handle_t	sc_tcoh;
 	int			sc_armed;
 	unsigned int		sc_min_t;
 	unsigned int		sc_max_t;
 	int			sc_version;
+	bool			sc_attached;
 };
 
 static int tco_match(device_t, cfdata_t, void *);
@@ -122,6 +125,13 @@ tco_attach(device_t parent, device_t sel
 	aprint_normal(": TCO (watchdog) timer configured.\n");
 	aprint_naive("\n");
 
+	sc->sc_tcot = sc->sc_pmt;
+	if (bus_space_subregion(sc->sc_pmt, sc->sc_pmh, PMC_TCO_BASE,
+		TCO_REGSIZE, >sc_tcoh)) {
+		aprint_error_dev(self, "failed to map TCO registers\n");
+		return;
+	}
+
 	/* Explicitly stop the TCO timer. */
 	tcotimer_stop(sc);
 
@@ -183,6 +193,8 @@ tco_attach(device_t parent, device_t sel
 
 	if (!pmf_device_register(self, tco_suspend, NULL))
 		aprint_error_dev(self, "unable to register with pmf\n");
+
+	sc->sc_attached = true;
 }
 
 static int
@@ -191,6 +203,9 @@ tco_detach(device_t self, int flags)
 	struct tco_softc *sc = device_private(self);
 	int rc;
 
+	if (!sc->sc_attached)
+		return 0;
+
 	if ((rc = sysmon_wdog_unregister(>sc_smw)) != 0) {
 		if (rc == ERESTART)
 			rc = EINTR;
@@ -243,19 +258,19 @@ tcotimer_setmode(struct sysmon_wdog *smw
 		switch (sc->sc_version) {
 		case TCO_VERSION_RCBA:
 			/* ICH6 or newer */
-			ich6period = bus_space_read_2(sc->sc_pmt, sc->sc_pmh,
-			PMC_TCO_TMR2);
+			ich6period = bus_space_read_2(sc->sc_tcot, sc->sc_tcoh,
+			PMC_TCO_TMR2 - PMC_TCO_BASE);
 			ich6period &= 0xfc00;
-			bus_space_write_2(sc->sc_pmt, sc->sc_pmh,
-			PMC_TCO_TMR2, ich6period | period);
+			bus_space_write_2(sc->sc_tcot, sc->sc_tcoh,
+			PMC_TCO_TMR2 - PMC_TCO_BASE, ich6period | period);
 			break;
 		case TCO_VERSION_PCIB:
 			/* ICH5 or older */
-			ich5period = bus_space_read_1(sc->sc_pmt, sc->sc_pmh,
-			PMC_TCO_TMR);
+			ich5period = bus_space_read_1(sc->sc_tcot, sc->sc_tcoh,
+			PMC_TCO_TMR - PMC_TCO_BASE);
 			ich5period &= 0xc0;
-			bus_space_write_1(sc->sc_pmt, sc->sc_pmh,
-			PMC_TCO_TMR, ich5period | period);
+			bus_space_write_1(sc->sc_tcot, sc->sc_tcoh,
+			PMC_TCO_TMR - PMC_TCO_BASE, ich5period | period);
 			break;
 		}
 
@@ -275,10 +290,12 @@ tcotimer_tickle(struct sysmon_wdog *smw)
 	/* any value is allowed */
 	switch (sc->sc_version) {
 	case TCO_VERSION_RCBA:
-		bus_space_write_2(sc->sc_pmt, sc->sc_pmh, PMC_TCO_RLD, 1);
+		bus_space_write_2(sc->sc_tcot, sc->sc_tcoh,
+		PMC_TCO_RLD - PMC_TCO_BASE, 1);
 		break;
 	case TCO_VERSION_PCIB:
-		bus_space_write_1(sc->sc_pmt, sc->sc_pmh, PMC_TCO_RLD, 1);
+		bus_space_write_1(sc->sc_tcot, sc->sc_tcoh,
+		PMC_TCO_RLD - PMC_TCO_BASE, 1);
 		break;
 	}
 
@@ -290,9 +307,11 @@ tcotimer_stop(struct tco_softc *sc)
 {
 	uint16_t ioreg;
 
-	ioreg = bus_space_read_2(sc->sc_pmt, sc->sc_pmh, PMC_TCO1_CNT);
+	ioreg = bus_space_read_2(sc->sc_tcot, sc->sc_tcoh,
+	PMC_TCO1_CNT - PMC_TCO_BASE);
 	ioreg |= PMC_TCO1_CNT_TCO_TMR_HLT;
-	bus_space_write_2(sc->sc_pmt, sc->sc_pmh, PMC_TCO1_CNT, ioreg);
+	bus_space_write_2(sc->sc_tcot, sc->sc_tcoh,
+	PMC_TCO1_CNT - PMC_TCO_BASE, ioreg);
 }
 
 static void
@@ -300,19 +319,24 @@ tcotimer_start(struct tco_softc *sc)
 {
 	uint16_t ioreg;
 
-	ioreg = bus_space_read_2(sc->sc_pmt, sc->sc_pmh, PMC_TCO1_CNT);
+	ioreg = bus_space_read_2(sc->sc_tcot, sc->sc_tcoh,
+	PMC_TCO1_CNT - PMC_TCO_BASE);
 	ioreg &= ~PMC_TCO1_CNT_TCO_TMR_HLT;
-	bus_space_write_2(sc->sc_pmt, sc->sc_pmh, PMC_TCO1_CNT, ioreg);
+	bus_space_write_2(sc->sc_tcot, sc->sc_tcoh,
+	PMC_TCO1_CNT - PMC_TCO_BASE, ioreg);
 }
 
 static void
 tcotimer_status_reset(struct tco_softc *sc)
 {
-	bus_space_write_2(sc->sc_pmt, sc->sc_pmh, 

CVS commit: src/sys

2022-09-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Sep 22 14:42:47 UTC 2022

Modified Files:
src/sys/arch/x86/pci: tco.c
src/sys/dev/ic: i82801lpcreg.h

Log Message:
tco(4): Use a subregion of the PMC registers for TCO registers.

This is an intermediate step that will let us decouple it from access
via PMBASE.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/x86/pci/tco.c
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/ic/i82801lpcreg.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/x86/pci

2022-09-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Sep 22 14:42:29 UTC 2022

Modified Files:
src/sys/arch/x86/pci: ichlpcib.c tco.c tco.h

Log Message:
ichlpcib(4), tco(4): Rename iot -> pmt, ioh -> pmh.

Makes it clearer that this is specifically about the power management
controller (PMC) registers relative to PMBASE.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/x86/pci/ichlpcib.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/x86/pci/tco.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/x86/pci/tco.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/x86/pci

2022-09-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Sep 22 14:42:29 UTC 2022

Modified Files:
src/sys/arch/x86/pci: ichlpcib.c tco.c tco.h

Log Message:
ichlpcib(4), tco(4): Rename iot -> pmt, ioh -> pmh.

Makes it clearer that this is specifically about the power management
controller (PMC) registers relative to PMBASE.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/x86/pci/ichlpcib.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/x86/pci/tco.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/x86/pci/tco.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/x86/pci/ichlpcib.c
diff -u src/sys/arch/x86/pci/ichlpcib.c:1.57 src/sys/arch/x86/pci/ichlpcib.c:1.58
--- src/sys/arch/x86/pci/ichlpcib.c:1.57	Thu Sep 22 14:42:09 2022
+++ src/sys/arch/x86/pci/ichlpcib.c	Thu Sep 22 14:42:29 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ichlpcib.c,v 1.57 2022/09/22 14:42:09 riastradh Exp $	*/
+/*	$NetBSD: ichlpcib.c,v 1.58 2022/09/22 14:42:29 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ichlpcib.c,v 1.57 2022/09/22 14:42:09 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ichlpcib.c,v 1.58 2022/09/22 14:42:29 riastradh Exp $");
 
 #include 
 #include 
@@ -85,8 +85,8 @@ struct lpcib_softc {
 	pcireg_t		sc_rcba_reg;
 
 	/* Power management variables. */
-	bus_space_tag_t		sc_iot;
-	bus_space_handle_t	sc_ioh;
+	bus_space_tag_t		sc_pmt;
+	bus_space_handle_t	sc_pmh;
 	bus_size_t		sc_iosize;
 
 	/* HPET variables. */
@@ -339,10 +339,10 @@ lpcibattach(device_t parent, device_t se
 	 * than LPCIB_PCI_PM_SIZE. It makes impossible to use
 	 * pci_mapreg_submap() because the function does range check.
 	 */
-	sc->sc_iot = pa->pa_iot;
+	sc->sc_pmt = pa->pa_iot;
 	pmbase = pci_conf_read(pa->pa_pc, pa->pa_tag, LPCIB_PCI_PMBASE);
-	if (bus_space_map(sc->sc_iot, PCI_MAPREG_IO_ADDR(pmbase),
-	LPCIB_PCI_PM_SIZE, 0, >sc_ioh) != 0) {
+	if (bus_space_map(sc->sc_pmt, PCI_MAPREG_IO_ADDR(pmbase),
+	LPCIB_PCI_PM_SIZE, 0, >sc_pmh) != 0) {
 		aprint_error_dev(self,
 		"can't map power management i/o space\n");
 		return;
@@ -517,7 +517,7 @@ lpcibdetach(device_t self, int flags)
 	if (sc->sc_has_rcba)
 		bus_space_unmap(sc->sc_rcbat, sc->sc_rcbah, LPCIB_RCBA_SIZE);
 
-	bus_space_unmap(sc->sc_iot, sc->sc_ioh, sc->sc_iosize);
+	bus_space_unmap(sc->sc_pmt, sc->sc_pmh, sc->sc_iosize);
 
 	return pcibdetach(self, flags);
 }
@@ -606,7 +606,7 @@ pmtimer_configure(device_t self)
 	}
 
 	/* Attach our PM timer with the generic acpipmtimer function */
-	sc->sc_pmtimer = acpipmtimer_attach(self, sc->sc_iot, sc->sc_ioh,
+	sc->sc_pmtimer = acpipmtimer_attach(self, sc->sc_pmt, sc->sc_pmh,
 	PMC_PM1_TMR, 0);
 }
 
@@ -639,8 +639,8 @@ tcotimer_configure(device_t self)
 		arg.ta_version = TCO_VERSION_RCBA;
 	else
 		arg.ta_version = TCO_VERSION_PCIB;
-	arg.ta_iot = sc->sc_iot;
-	arg.ta_ioh = sc->sc_ioh;
+	arg.ta_pmt = sc->sc_pmt;
+	arg.ta_pmh = sc->sc_pmh;
 	arg.ta_rcbat = sc->sc_rcbat;
 	arg.ta_rcbah = sc->sc_rcbah;
 	arg.ta_pcib = >sc_pcib;
@@ -667,9 +667,9 @@ tcotimer_unconfigure(device_t self, int 
  * Intel ICH SpeedStep support.
  */
 #define SS_READ(sc, reg) \
-	bus_space_read_1((sc)->sc_iot, (sc)->sc_ioh, (reg))
+	bus_space_read_1((sc)->sc_pmt, (sc)->sc_pmh, (reg))
 #define SS_WRITE(sc, reg, val) \
-	bus_space_write_1((sc)->sc_iot, (sc)->sc_ioh, (reg), (val))
+	bus_space_write_1((sc)->sc_pmt, (sc)->sc_pmh, (reg), (val))
 
 /*
  * Linux driver says that SpeedStep on older chipsets cause

Index: src/sys/arch/x86/pci/tco.c
diff -u src/sys/arch/x86/pci/tco.c:1.6 src/sys/arch/x86/pci/tco.c:1.7
--- src/sys/arch/x86/pci/tco.c:1.6	Thu Sep 22 14:42:09 2022
+++ src/sys/arch/x86/pci/tco.c	Thu Sep 22 14:42:29 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: tco.c,v 1.6 2022/09/22 14:42:09 riastradh Exp $	*/
+/*	$NetBSD: tco.c,v 1.7 2022/09/22 14:42:29 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tco.c,v 1.6 2022/09/22 14:42:09 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tco.c,v 1.7 2022/09/22 14:42:29 riastradh Exp $");
 
 #include 
 #include 
@@ -55,8 +55,8 @@ __KERNEL_RCSID(0, "$NetBSD: tco.c,v 1.6 
 
 struct tco_softc {
 	struct sysmon_wdog	sc_smw;
-	bus_space_tag_t		sc_iot;
-	bus_space_handle_t	sc_ioh;
+	bus_space_tag_t		sc_pmt;
+	bus_space_handle_t	sc_pmh;
 	bus_space_tag_t		sc_rcbat;
 	bus_space_handle_t	sc_rcbah;
 	struct pcib_softc *	sc_pcib;
@@ -90,7 +90,7 @@ tco_match(device_t parent, cfdata_t matc
 {
 	struct tco_attach_args *ta = aux;
 
-	if (ta->ta_iot == 0)
+	if (ta->ta_pmt == 0)
 		return 0;
 
 	switch (ta->ta_version) {
@@ -113,8 +113,8 @@ tco_attach(device_t parent, device_t sel
 
 	/* Retrieve bus info shared with parent/siblings */
 	sc->sc_version = ta->ta_version;
-	sc->sc_iot = ta->ta_iot;
-	sc->sc_ioh = ta->ta_ioh;
+	sc->sc_pmt = 

CVS commit: src/sys

2022-09-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Sep 22 14:42:10 UTC 2022

Modified Files:
src/sys/arch/x86/pci: ichlpcib.c tco.c
src/sys/dev/ic: i82801lpcreg.h

Log Message:
ichlpcib(4), tco(4): Take `lpcib_' off various names.

For PMC-specific ones, change `lpcib_' to `pmc_'.  These are in a
separate PCI device in newer chipsets.

For TCO-specific ones, which may live in different places, whether at
their own base address or as an offset from PMBASE, just leave it as
`tco_' or `tcotimer'.

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/x86/pci/ichlpcib.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/x86/pci/tco.c
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/ic/i82801lpcreg.h

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



CVS commit: src/sys

2022-09-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Sep 22 14:42:10 UTC 2022

Modified Files:
src/sys/arch/x86/pci: ichlpcib.c tco.c
src/sys/dev/ic: i82801lpcreg.h

Log Message:
ichlpcib(4), tco(4): Take `lpcib_' off various names.

For PMC-specific ones, change `lpcib_' to `pmc_'.  These are in a
separate PCI device in newer chipsets.

For TCO-specific ones, which may live in different places, whether at
their own base address or as an offset from PMBASE, just leave it as
`tco_' or `tcotimer'.

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/x86/pci/ichlpcib.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/x86/pci/tco.c
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/ic/i82801lpcreg.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/x86/pci/ichlpcib.c
diff -u src/sys/arch/x86/pci/ichlpcib.c:1.56 src/sys/arch/x86/pci/ichlpcib.c:1.57
--- src/sys/arch/x86/pci/ichlpcib.c:1.56	Thu Sep 22 14:41:49 2022
+++ src/sys/arch/x86/pci/ichlpcib.c	Thu Sep 22 14:42:09 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ichlpcib.c,v 1.56 2022/09/22 14:41:49 riastradh Exp $	*/
+/*	$NetBSD: ichlpcib.c,v 1.57 2022/09/22 14:42:09 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ichlpcib.c,v 1.56 2022/09/22 14:41:49 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ichlpcib.c,v 1.57 2022/09/22 14:42:09 riastradh Exp $");
 
 #include 
 #include 
@@ -607,7 +607,7 @@ pmtimer_configure(device_t self)
 
 	/* Attach our PM timer with the generic acpipmtimer function */
 	sc->sc_pmtimer = acpipmtimer_attach(self, sc->sc_iot, sc->sc_ioh,
-	LPCIB_PM1_TMR, 0);
+	PMC_PM1_TMR, 0);
 }
 
 static int
@@ -765,9 +765,9 @@ speedstep_sysctl_helper(SYSCTLFN_ARGS)
 	 * sysctl_lookup() which can both copyin and copyout.
 	 */
 	s = splserial();
-	state = SS_READ(sc, LPCIB_PM_SS_CNTL);
+	state = SS_READ(sc, PMC_PM_SS_CNTL);
 	splx(s);
-	if ((state & LPCIB_PM_SS_STATE_LOW) == 0)
+	if ((state & PMC_PM_SS_STATE_LOW) == 0)
 		ostate = 1;
 	else
 		ostate = 0;
@@ -787,8 +787,8 @@ speedstep_sysctl_helper(SYSCTLFN_ARGS)
 	}
 
 	s = splserial();
-	state2 = SS_READ(sc, LPCIB_PM_SS_CNTL);
-	if ((state2 & LPCIB_PM_SS_STATE_LOW) == 0)
+	state2 = SS_READ(sc, PMC_PM_SS_CNTL);
+	if ((state2 & PMC_PM_SS_STATE_LOW) == 0)
 		ostate = 1;
 	else
 		ostate = 0;
@@ -797,17 +797,17 @@ speedstep_sysctl_helper(SYSCTLFN_ARGS)
 		uint8_t cntl;
 
 		if (nstate == 0)
-			state2 |= LPCIB_PM_SS_STATE_LOW;
+			state2 |= PMC_PM_SS_STATE_LOW;
 		else
-			state2 &= ~LPCIB_PM_SS_STATE_LOW;
+			state2 &= ~PMC_PM_SS_STATE_LOW;
 
 		/*
 		 * Must disable bus master arbitration during the change.
 		 */
-		cntl = SS_READ(sc, LPCIB_PM_CTRL);
-		SS_WRITE(sc, LPCIB_PM_CTRL, cntl | LPCIB_PM_SS_CNTL_ARB_DIS);
-		SS_WRITE(sc, LPCIB_PM_SS_CNTL, state2);
-		SS_WRITE(sc, LPCIB_PM_CTRL, cntl);
+		cntl = SS_READ(sc, PMC_PM_CTRL);
+		SS_WRITE(sc, PMC_PM_CTRL, cntl | PMC_PM_SS_CNTL_ARB_DIS);
+		SS_WRITE(sc, PMC_PM_SS_CNTL, state2);
+		SS_WRITE(sc, PMC_PM_CTRL, cntl);
 	}
 	splx(s);
 out:

Index: src/sys/arch/x86/pci/tco.c
diff -u src/sys/arch/x86/pci/tco.c:1.5 src/sys/arch/x86/pci/tco.c:1.6
--- src/sys/arch/x86/pci/tco.c:1.5	Thu Sep 22 14:41:49 2022
+++ src/sys/arch/x86/pci/tco.c	Thu Sep 22 14:42:09 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: tco.c,v 1.5 2022/09/22 14:41:49 riastradh Exp $	*/
+/*	$NetBSD: tco.c,v 1.6 2022/09/22 14:42:09 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tco.c,v 1.5 2022/09/22 14:41:49 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tco.c,v 1.6 2022/09/22 14:42:09 riastradh Exp $");
 
 #include 
 #include 
@@ -129,18 +129,18 @@ tco_attach(device_t parent, device_t sel
 	 * Enable TCO timeout SMI only if the hardware reset does not
 	 * work. We don't know what the SMBIOS does.
 	 */
-	ioreg = bus_space_read_4(sc->sc_iot, sc->sc_ioh, LPCIB_SMI_EN);
-	ioreg &= ~LPCIB_SMI_EN_TCO_EN;
+	ioreg = bus_space_read_4(sc->sc_iot, sc->sc_ioh, PMC_SMI_EN);
+	ioreg &= ~PMC_SMI_EN_TCO_EN;
 
 	/*
 	 * Clear the No Reboot (NR) bit. If this fails, enabling the TCO_EN bit
 	 * in the SMI_EN register is the last chance.
 	 */
 	if (tcotimer_disable_noreboot(self)) {
-		ioreg |= LPCIB_SMI_EN_TCO_EN;
+		ioreg |= PMC_SMI_EN_TCO_EN;
 	}
-	if ((ioreg & LPCIB_SMI_EN_GBL_SMI_EN) != 0) {
-		bus_space_write_4(sc->sc_iot, sc->sc_ioh, LPCIB_SMI_EN, ioreg);
+	if ((ioreg & PMC_SMI_EN_GBL_SMI_EN) != 0) {
+		bus_space_write_4(sc->sc_iot, sc->sc_ioh, PMC_SMI_EN, ioreg);
 	}
 
 	/* Reset the watchdog status registers. */
@@ -163,19 +163,19 @@ tco_attach(device_t parent, device_t sel
 	 */
 	switch (sc->sc_version) {
 	case TCO_VERSION_RCBA:
-		sc->sc_max_t = LPCIB_TCOTIMER2_MAX_TICK;
-		sc->sc_min_t = LPCIB_TCOTIMER2_MIN_TICK;
+		sc->sc_max_t = TCOTIMER2_MAX_TICK;
+		

CVS commit: src/sys/arch/x86/pci

2022-09-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Sep 22 14:41:49 UTC 2022

Modified Files:
src/sys/arch/x86/pci: ichlpcib.c tco.c tco.h

Log Message:
tco(4): Rename lpcib_tco_attach_args -> tco_attach_args.

No longer hangs off LPC bus, newer devices hang it off SMBus.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/x86/pci/ichlpcib.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/x86/pci/tco.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/x86/pci/tco.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/x86/pci

2022-09-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Sep 22 14:41:49 UTC 2022

Modified Files:
src/sys/arch/x86/pci: ichlpcib.c tco.c tco.h

Log Message:
tco(4): Rename lpcib_tco_attach_args -> tco_attach_args.

No longer hangs off LPC bus, newer devices hang it off SMBus.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/x86/pci/ichlpcib.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/x86/pci/tco.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/x86/pci/tco.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/x86/pci/ichlpcib.c
diff -u src/sys/arch/x86/pci/ichlpcib.c:1.55 src/sys/arch/x86/pci/ichlpcib.c:1.56
--- src/sys/arch/x86/pci/ichlpcib.c:1.55	Thu Sep 22 14:41:26 2022
+++ src/sys/arch/x86/pci/ichlpcib.c	Thu Sep 22 14:41:49 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ichlpcib.c,v 1.55 2022/09/22 14:41:26 riastradh Exp $	*/
+/*	$NetBSD: ichlpcib.c,v 1.56 2022/09/22 14:41:49 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ichlpcib.c,v 1.55 2022/09/22 14:41:26 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ichlpcib.c,v 1.56 2022/09/22 14:41:49 riastradh Exp $");
 
 #include 
 #include 
@@ -633,7 +633,7 @@ static void
 tcotimer_configure(device_t self)
 {
 	struct lpcib_softc *sc = device_private(self);
-	struct lpcib_tco_attach_args arg;
+	struct tco_attach_args arg;
 
 	if (sc->sc_has_rcba)
 		arg.ta_version = TCO_VERSION_RCBA;

Index: src/sys/arch/x86/pci/tco.c
diff -u src/sys/arch/x86/pci/tco.c:1.4 src/sys/arch/x86/pci/tco.c:1.5
--- src/sys/arch/x86/pci/tco.c:1.4	Thu Sep 22 14:41:26 2022
+++ src/sys/arch/x86/pci/tco.c	Thu Sep 22 14:41:49 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: tco.c,v 1.4 2022/09/22 14:41:26 riastradh Exp $	*/
+/*	$NetBSD: tco.c,v 1.5 2022/09/22 14:41:49 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tco.c,v 1.4 2022/09/22 14:41:26 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tco.c,v 1.5 2022/09/22 14:41:49 riastradh Exp $");
 
 #include 
 #include 
@@ -88,7 +88,7 @@ CFATTACH_DECL3_NEW(tco, sizeof(struct tc
 static int
 tco_match(device_t parent, cfdata_t match, void *aux)
 {
-	struct lpcib_tco_attach_args *ta = aux;
+	struct tco_attach_args *ta = aux;
 
 	if (ta->ta_iot == 0)
 		return 0;
@@ -108,7 +108,7 @@ static void
 tco_attach(device_t parent, device_t self, void *aux)
 {
 	struct tco_softc *sc = device_private(self);
-	struct lpcib_tco_attach_args *ta = aux;
+	struct tco_attach_args *ta = aux;
 	uint32_t ioreg;
 
 	/* Retrieve bus info shared with parent/siblings */

Index: src/sys/arch/x86/pci/tco.h
diff -u src/sys/arch/x86/pci/tco.h:1.2 src/sys/arch/x86/pci/tco.h:1.3
--- src/sys/arch/x86/pci/tco.h:1.2	Thu Sep 22 14:41:26 2022
+++ src/sys/arch/x86/pci/tco.h	Thu Sep 22 14:41:49 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: tco.h,v 1.2 2022/09/22 14:41:26 riastradh Exp $	*/
+/*	$NetBSD: tco.h,v 1.3 2022/09/22 14:41:49 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #ifndef _X86_PCI_TCO_H_
 #define _X86_PCI_TCO_H_
 
-struct lpcib_tco_attach_args {
+struct tco_attach_args {
 	enum {
 		TCO_VERSION_PCIB = 0,
 		TCO_VERSION_RCBA = 1,



CVS commit: src/sys/arch/x86/pci

2022-09-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Sep 22 14:41:26 UTC 2022

Modified Files:
src/sys/arch/x86/pci: ichlpcib.c tco.c tco.h

Log Message:
tco(4): Change has_rcba bit into version number.

Will be useful for newer Intel platform controller hubs.

No functional change intended.  Module ABI is unchanged, although older
modules will do something nonseneical when confronted with versions
above 1 -- that will require a revbump (but with any luck, it will make
life easier for versions above 2 easier once we do that).


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/x86/pci/ichlpcib.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/x86/pci/tco.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/x86/pci/tco.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/x86/pci/ichlpcib.c
diff -u src/sys/arch/x86/pci/ichlpcib.c:1.54 src/sys/arch/x86/pci/ichlpcib.c:1.55
--- src/sys/arch/x86/pci/ichlpcib.c:1.54	Sat Aug  7 16:19:07 2021
+++ src/sys/arch/x86/pci/ichlpcib.c	Thu Sep 22 14:41:26 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ichlpcib.c,v 1.54 2021/08/07 16:19:07 thorpej Exp $	*/
+/*	$NetBSD: ichlpcib.c,v 1.55 2022/09/22 14:41:26 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ichlpcib.c,v 1.54 2021/08/07 16:19:07 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ichlpcib.c,v 1.55 2022/09/22 14:41:26 riastradh Exp $");
 
 #include 
 #include 
@@ -635,12 +635,15 @@ tcotimer_configure(device_t self)
 	struct lpcib_softc *sc = device_private(self);
 	struct lpcib_tco_attach_args arg;
 
+	if (sc->sc_has_rcba)
+		arg.ta_version = TCO_VERSION_RCBA;
+	else
+		arg.ta_version = TCO_VERSION_PCIB;
 	arg.ta_iot = sc->sc_iot;
 	arg.ta_ioh = sc->sc_ioh;
 	arg.ta_rcbat = sc->sc_rcbat;
 	arg.ta_rcbah = sc->sc_rcbah;
-	arg.ta_has_rcba = sc->sc_has_rcba;
-	arg.ta_pcib = &(sc->sc_pcib);
+	arg.ta_pcib = >sc_pcib;
 
 	sc->sc_tco = config_found(self, , NULL,
 	CFARGS(.iattr = "tcoichbus"));

Index: src/sys/arch/x86/pci/tco.c
diff -u src/sys/arch/x86/pci/tco.c:1.3 src/sys/arch/x86/pci/tco.c:1.4
--- src/sys/arch/x86/pci/tco.c:1.3	Wed Sep 21 10:36:14 2022
+++ src/sys/arch/x86/pci/tco.c	Thu Sep 22 14:41:26 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: tco.c,v 1.3 2022/09/21 10:36:14 riastradh Exp $	*/
+/*	$NetBSD: tco.c,v 1.4 2022/09/22 14:41:26 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tco.c,v 1.3 2022/09/21 10:36:14 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tco.c,v 1.4 2022/09/22 14:41:26 riastradh Exp $");
 
 #include 
 #include 
@@ -63,7 +63,7 @@ struct tco_softc {
 	int			sc_armed;
 	unsigned int		sc_min_t;
 	unsigned int		sc_max_t;
-	int			sc_has_rcba;
+	int			sc_version;
 };
 
 static int tco_match(device_t, cfdata_t, void *);
@@ -90,10 +90,18 @@ tco_match(device_t parent, cfdata_t matc
 {
 	struct lpcib_tco_attach_args *ta = aux;
 
-	if (ta->ta_iot != 0)
-		return 1;
+	if (ta->ta_iot == 0)
+		return 0;
 
-	return 0;
+	switch (ta->ta_version) {
+	case TCO_VERSION_RCBA:
+	case TCO_VERSION_PCIB:
+		break;
+	default:
+		return 0;
+	}
+
+	return 1;
 }
 
 static void
@@ -104,13 +112,12 @@ tco_attach(device_t parent, device_t sel
 	uint32_t ioreg;
 
 	/* Retrieve bus info shared with parent/siblings */
-
+	sc->sc_version = ta->ta_version;
 	sc->sc_iot = ta->ta_iot;
 	sc->sc_ioh = ta->ta_ioh;
 	sc->sc_rcbat = ta->ta_rcbat;
 	sc->sc_rcbah = ta->ta_rcbah;
 	sc->sc_pcib = ta->ta_pcib;
-	sc->sc_has_rcba = ta->ta_has_rcba;
 
 	aprint_normal(": TCO (watchdog) timer configured.\n");
 	aprint_naive("\n");
@@ -154,12 +161,15 @@ tco_attach(device_t parent, device_t sel
 	 * ICH5 or older are limited to 4ticks min and 39ticks max.
 	 *  2secs  23secs
 	 */
-	if (sc->sc_has_rcba) {
+	switch (sc->sc_version) {
+	case TCO_VERSION_RCBA:
 		sc->sc_max_t = LPCIB_TCOTIMER2_MAX_TICK;
 		sc->sc_min_t = LPCIB_TCOTIMER2_MIN_TICK;
-	} else {
+		break;
+	case TCO_VERSION_PCIB:
 		sc->sc_max_t = LPCIB_TCOTIMER_MAX_TICK;
 		sc->sc_min_t = LPCIB_TCOTIMER_MIN_TICK;
+		break;
 	}
 	sc->sc_smw.smw_period = lpcib_tcotimer_tick_to_second(sc->sc_max_t);
 
@@ -230,20 +240,23 @@ tcotimer_setmode(struct sysmon_wdog *smw
 		tcotimer_stop(sc);
 
 		/* set the timeout, */
-		if (sc->sc_has_rcba) {
+		switch (sc->sc_version) {
+		case TCO_VERSION_RCBA:
 			/* ICH6 or newer */
 			ich6period = bus_space_read_2(sc->sc_iot, sc->sc_ioh,
 			LPCIB_TCO_TMR2);
 			ich6period &= 0xfc00;
 			bus_space_write_2(sc->sc_iot, sc->sc_ioh,
 			LPCIB_TCO_TMR2, ich6period | period);
-		} else {
+			break;
+		case TCO_VERSION_PCIB:
 			/* ICH5 or older */
 			ich5period = bus_space_read_1(sc->sc_iot, sc->sc_ioh,
 			LPCIB_TCO_TMR);
 			ich5period &= 0xc0;
 			bus_space_write_1(sc->sc_iot, sc->sc_ioh,
 			LPCIB_TCO_TMR, ich5period | 

CVS commit: src/sys/arch/x86/pci

2022-09-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Sep 22 14:41:26 UTC 2022

Modified Files:
src/sys/arch/x86/pci: ichlpcib.c tco.c tco.h

Log Message:
tco(4): Change has_rcba bit into version number.

Will be useful for newer Intel platform controller hubs.

No functional change intended.  Module ABI is unchanged, although older
modules will do something nonseneical when confronted with versions
above 1 -- that will require a revbump (but with any luck, it will make
life easier for versions above 2 easier once we do that).


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/x86/pci/ichlpcib.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/x86/pci/tco.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/x86/pci/tco.h

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



CVS commit: src/sys/kern

2022-09-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Sep 22 14:39:24 UTC 2022

Modified Files:
src/sys/kern: kern_crashme.c

Log Message:
crashme(9): Clarify description of kernel_lock_spinout.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/kern/kern_crashme.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/kern/kern_crashme.c
diff -u src/sys/kern/kern_crashme.c:1.9 src/sys/kern/kern_crashme.c:1.10
--- src/sys/kern/kern_crashme.c:1.9	Wed Sep 21 10:50:29 2022
+++ src/sys/kern/kern_crashme.c	Thu Sep 22 14:39:24 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_crashme.c,v 1.9 2022/09/21 10:50:29 riastradh Exp $	*/
+/*	$NetBSD: kern_crashme.c,v 1.10 2022/09/22 14:39:24 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2018, 2019 Matthew R. Green
@@ -83,7 +83,7 @@ static crashme_node nodes[] = {
 CMNODE("ddb", "enter ddb directly", crashme_ddb),
 #endif
 #ifdef LOCKDEBUG
-CMNODE("kernel_lock_spinout", "infinite kernel lock",
+CMNODE("kernel_lock_spinout", "infinite loop under kernel lock",
 	crashme_kernel_lock_spinout),
 #endif
 CMNODE("mutex_recursion", "enter the same mutex twice",



CVS commit: src/sys/kern

2022-09-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Sep 22 14:39:24 UTC 2022

Modified Files:
src/sys/kern: kern_crashme.c

Log Message:
crashme(9): Clarify description of kernel_lock_spinout.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/kern/kern_crashme.c

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



CVS commit: src/sys/external/bsd/drm2

2022-09-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Sep 22 14:37:38 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915: i915_drv.c i915_drv.h
src/sys/external/bsd/drm2/i915drm: i915_pci_autoconf.c

Log Message:
i915: Make sure to call i915_drm_prepare too on suspend.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.c \
src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.h
cvs rdiff -u -r1.12 -r1.13 \
src/sys/external/bsd/drm2/i915drm/i915_pci_autoconf.c

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



CVS commit: src/sys/external/bsd/drm2

2022-09-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Sep 22 14:37:38 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915: i915_drv.c i915_drv.h
src/sys/external/bsd/drm2/i915drm: i915_pci_autoconf.c

Log Message:
i915: Make sure to call i915_drm_prepare too on suspend.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.c \
src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.h
cvs rdiff -u -r1.12 -r1.13 \
src/sys/external/bsd/drm2/i915drm/i915_pci_autoconf.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/external/bsd/drm2/dist/drm/i915/i915_drv.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.c:1.47 src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.c:1.48
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.c:1.47	Tue Dec 21 11:44:18 2021
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.c	Thu Sep 22 14:37:38 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: i915_drv.c,v 1.47 2021/12/21 11:44:18 tnn Exp $	*/
+/*	$NetBSD: i915_drv.c,v 1.48 2022/09/22 14:37:38 riastradh Exp $	*/
 
 /* i915_drv.c -- i830,i845,i855,i865,i915 driver -*- linux-c -*-
  */
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i915_drv.c,v 1.47 2021/12/21 11:44:18 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_drv.c,v 1.48 2022/09/22 14:37:38 riastradh Exp $");
 
 #include 
 #include 
@@ -1747,8 +1747,7 @@ static bool suspend_to_idle(struct drm_i
 	return false;
 }
 
-#ifndef __NetBSD__		/* XXX runtime pm */
-static int i915_drm_prepare(struct drm_device *dev)
+int i915_drm_prepare(struct drm_device *dev)
 {
 	struct drm_i915_private *i915 = to_i915(dev);
 
@@ -1762,7 +1761,6 @@ static int i915_drm_prepare(struct drm_d
 
 	return 0;
 }
-#endif
 
 int i915_drm_suspend(struct drm_device *dev)
 {
Index: src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.h
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.h:1.47 src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.h:1.48
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.h:1.47	Sun Feb 27 14:22:29 2022
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.h	Thu Sep 22 14:37:38 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: i915_drv.h,v 1.47 2022/02/27 14:22:29 riastradh Exp $	*/
+/*	$NetBSD: i915_drv.h,v 1.48 2022/09/22 14:37:38 riastradh Exp $	*/
 
 /* i915_drv.h -- Private header for the I915 driver -*- linux-c -*-
  */
@@ -1826,6 +1826,7 @@ void i915_driver_remove(struct drm_i915_
 
 int i915_drm_resume(struct drm_device *);
 int i915_drm_resume_early(struct drm_device *);
+int i915_drm_prepare(struct drm_device *);
 int i915_drm_suspend(struct drm_device *);
 int i915_drm_suspend_late(struct drm_device *, bool);
 

Index: src/sys/external/bsd/drm2/i915drm/i915_pci_autoconf.c
diff -u src/sys/external/bsd/drm2/i915drm/i915_pci_autoconf.c:1.12 src/sys/external/bsd/drm2/i915drm/i915_pci_autoconf.c:1.13
--- src/sys/external/bsd/drm2/i915drm/i915_pci_autoconf.c:1.12	Mon Jul 18 23:34:02 2022
+++ src/sys/external/bsd/drm2/i915drm/i915_pci_autoconf.c	Thu Sep 22 14:37:38 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: i915_pci_autoconf.c,v 1.12 2022/07/18 23:34:02 riastradh Exp $	*/
+/*	$NetBSD: i915_pci_autoconf.c,v 1.13 2022/09/22 14:37:38 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i915_pci_autoconf.c,v 1.12 2022/07/18 23:34:02 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_pci_autoconf.c,v 1.13 2022/09/22 14:37:38 riastradh Exp $");
 
 #include 
 #include 
@@ -255,6 +255,9 @@ i915drmkms_suspend(device_t self, const 
 	struct drm_device *const dev = sc->sc_drm_dev;
 	int ret;
 
+	ret = i915_drm_prepare(dev);
+	if (ret)
+		return false;
 	ret = i915_drm_suspend(dev);
 	if (ret)
 		return false;



CVS commit: src/sys/dev/usb

2022-09-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Sep 22 14:27:52 UTC 2022

Modified Files:
src/sys/dev/usb: umass.c

Log Message:
umass(4): Reduce timeout for control xfers to standard USB timeout.

This should reduce the timeout for a failed sd@umass transfer from
n*(1min + 5sec) to 1min + n*5sec where n is the number of reset and
clear-stall steps.


To generate a diff of this commit:
cvs rdiff -u -r1.188 -r1.189 src/sys/dev/usb/umass.c

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



CVS commit: src/sys/dev/usb

2022-09-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Sep 22 14:27:52 UTC 2022

Modified Files:
src/sys/dev/usb: umass.c

Log Message:
umass(4): Reduce timeout for control xfers to standard USB timeout.

This should reduce the timeout for a failed sd@umass transfer from
n*(1min + 5sec) to 1min + n*5sec where n is the number of reset and
clear-stall steps.


To generate a diff of this commit:
cvs rdiff -u -r1.188 -r1.189 src/sys/dev/usb/umass.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/dev/usb/umass.c
diff -u src/sys/dev/usb/umass.c:1.188 src/sys/dev/usb/umass.c:1.189
--- src/sys/dev/usb/umass.c:1.188	Sun Mar 20 19:26:27 2022
+++ src/sys/dev/usb/umass.c	Thu Sep 22 14:27:52 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: umass.c,v 1.188 2022/03/20 19:26:27 andvar Exp $	*/
+/*	$NetBSD: umass.c,v 1.189 2022/09/22 14:27:52 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -124,7 +124,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: umass.c,v 1.188 2022/03/20 19:26:27 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umass.c,v 1.189 2022/09/22 14:27:52 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1012,8 +1012,8 @@ umass_setup_ctrl_transfer(struct umass_s
 
 	/* Initialise a USB control transfer and then schedule it */
 
-	usbd_setup_default_xfer(xfer, sc->sc_udev, (void *) sc, sc->timeout,
-		req, buffer, buflen, flags, sc->sc_methods->wire_state);
+	usbd_setup_default_xfer(xfer, sc->sc_udev, sc, USBD_DEFAULT_TIMEOUT,
+	req, buffer, buflen, flags, sc->sc_methods->wire_state);
 
 	err = usbd_transfer(xfer);
 	if (err && err != USBD_IN_PROGRESS) {



CVS commit: src/sys/arch/sandpoint/stand/altboot

2022-09-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Sep 22 14:27:02 UTC 2022

Modified Files:
src/sys/arch/sandpoint/stand/altboot: main.c

Log Message:
sandpoint: Teach altboot to handle 9.99.100 modules.

Not tested, but something here will be necessary to make it work, and
the same change does work in x86 efiboot.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/sandpoint/stand/altboot/main.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/sandpoint/stand/altboot/main.c
diff -u src/sys/arch/sandpoint/stand/altboot/main.c:1.33 src/sys/arch/sandpoint/stand/altboot/main.c:1.34
--- src/sys/arch/sandpoint/stand/altboot/main.c:1.33	Tue Mar 23 07:21:40 2021
+++ src/sys/arch/sandpoint/stand/altboot/main.c	Thu Sep 22 14:27:02 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.33 2021/03/23 07:21:40 rin Exp $ */
+/* $NetBSD: main.c,v 1.34 2022/09/22 14:27:02 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -516,7 +516,7 @@ module_load(const char *kernel_path)
 		"/stand/sandpoint/%d.%d.%d/modules",
 		netbsd_version / 1,
 		netbsd_version / 100 % 100,
-		netbsd_version / 100 % 100);
+		netbsd_version / 100 % 1);
 	}
 	 else if (netbsd_version != 0) {
 		/* release */



CVS commit: src/sys/arch/sandpoint/stand/altboot

2022-09-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Sep 22 14:27:02 UTC 2022

Modified Files:
src/sys/arch/sandpoint/stand/altboot: main.c

Log Message:
sandpoint: Teach altboot to handle 9.99.100 modules.

Not tested, but something here will be necessary to make it work, and
the same change does work in x86 efiboot.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/sandpoint/stand/altboot/main.c

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



CVS commit: src/sbin/wdogctl

2022-09-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Sep 22 14:02:45 UTC 2022

Modified Files:
src/sbin/wdogctl: wdogctl.8

Log Message:
wdogctl(8): Rework prose and markup in man page.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sbin/wdogctl/wdogctl.8

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



CVS commit: src/sbin/wdogctl

2022-09-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Sep 22 14:02:45 UTC 2022

Modified Files:
src/sbin/wdogctl: wdogctl.8

Log Message:
wdogctl(8): Rework prose and markup in man page.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sbin/wdogctl/wdogctl.8

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

Modified files:

Index: src/sbin/wdogctl/wdogctl.8
diff -u src/sbin/wdogctl/wdogctl.8:1.25 src/sbin/wdogctl/wdogctl.8:1.26
--- src/sbin/wdogctl/wdogctl.8:1.25	Sat Jul 11 12:51:21 2020
+++ src/sbin/wdogctl/wdogctl.8	Thu Sep 22 14:02:45 2022
@@ -1,4 +1,4 @@
-.\"	$NetBSD: wdogctl.8,v 1.25 2020/07/11 12:51:21 jruoho Exp $
+.\"	$NetBSD: wdogctl.8,v 1.26 2022/09/22 14:02:45 riastradh Exp $
 .\"
 .\" Copyright (c) 2000 Zembu Labs, Inc.
 .\" All rights reserved.
@@ -66,28 +66,30 @@
 .Sh DESCRIPTION
 .Nm
 is used to manipulate watchdog timers.
-Watchdog timers provide a means of ensuring that a system
-continues to make progress.
-This is accomplished by use of a timer, provided by either hardware or
-software; when the timer expires, the watchdog resets the system.
-In this case of a hardware watchdog timer, this is accomplished by
-asserting the system's hardware reset signal.
-In the case of a software watchdog timer,
-this is accomplished by calling the kernel's normal reboot path.
-In order to prevent the system from rebooting,
-something must refresh the timer to prevent it from expiring.
+A watchdog timer is a hardware or software timer that resets the system
+if it fails to make progress within a prescribed period.
+To prevent the system from being reset, something must refresh the
+timer to prevent it from expiring.
+.Pp
+A hardware watchdog timer asserts system's hardware reset signal when
+it expires.
+A software watchdog timer calls the kernel's s normal reboot path.
 .Pp
 The
 .Nx
-kernel provides three basic modes in which watchdog timers may
+kernel provides three modes in which watchdog timers may
 operate: kernel tickle mode, user tickle mode, and external tickle mode.
-In kernel tickle mode, a timer in the kernel refreshes the watchdog timer.
-In user tickle mode,
+.Bl -tag -width "external tickle mode"
+.It kernel tickle mode
+A timer in the kernel refreshes the watchdog timer.
+This ensures kernel threads can make progress within the period of the
+watchdog timer.
+.It user tickle mode
 .Nm
 runs in the background and refreshes the watchdog timer.
-In kernel tickle mode, progress of the kernel is ensured.
-In user tickle mode, the ability for user programs to run within a known
-period of time is ensured.
+This ensures user programs can make progress within the period of the
+watchdog timer.
+.Pp
 Note that user tickle mode must be used with caution;
 on a heavily loaded system, the timer may
 expire accidentally, even though user programs may be making
@@ -96,17 +98,19 @@ A user-mode timer is disarmed (if possib
 unless the timer is activated with the
 .Fl x
 option.
-.Pp
-External-mode watchdogs are similar to user-mode watchdogs, except
-that the tickle must be done explicitly by a separate invocation of
-the program with the
+.It external tickle mode
+Similar to user tickle mode, except that the tickle must be done
+explicitly by a separate invocation of the program with the
 .Fl t
 option.
+This allows users to determine the activity whose progress the watchdog
+timer checks.
+.El
 .Pp
-In the first two modes, an attempt is made to refresh the watchdog timer
-in one half the timer's configured period.
-That is, if the watchdog timer has a period of 30 seconds, a refresh attempt
-is made every 15 seconds.
+In kernel and user tickle modes, an attempt is made to refresh the
+watchdog timer in one half the timer's configured period.
+For example, if the watchdog timer has a period of 30 seconds, a
+refresh attempt is made every 15 seconds.
 .Pp
 If called without arguments,
 .Nm
@@ -120,7 +124,7 @@ to arm a timer when one is already armed
 will be displayed and no action will be taken.
 .Pp
 The options are as follows:
-.Bl -tag -offset indent -width XpXperiodXX
+.Bl -tag -width Fl
 .It Fl A
 When arming a timer, this flag indicates that an audible alarm is
 to sound when the watchdog timer expires and resets the system.
@@ -159,8 +163,10 @@ in a modified user tickle mode: closing 
 the timer.
 .El
 .Sh FILES
-.Pa /dev/watchdog
--- the system monitor watchdog timer device
+.Bl -tag -width "Pa /dev/watchdog"
+.It Pa /dev/watchdog
+the system monitor watchdog timer device
+.El
 .Sh SEE ALSO
 .Xr acpiwdrt 4 ,
 .Xr evbarm/iopwdog 4 ,



CVS commit: src/share/man/man9

2022-09-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Sep 22 14:02:24 UTC 2022

Modified Files:
src/share/man/man9: curproc.9

Log Message:
curproc(9): Rework man page.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/share/man/man9/curproc.9

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/man9/curproc.9
diff -u src/share/man/man9/curproc.9:1.5 src/share/man/man9/curproc.9:1.6
--- src/share/man/man9/curproc.9:1.5	Thu Jul  1 15:12:31 2010
+++ src/share/man/man9/curproc.9	Thu Sep 22 14:02:24 2022
@@ -1,4 +1,4 @@
-.\" $NetBSD: curproc.9,v 1.5 2010/07/01 15:12:31 wiz Exp $
+.\" $NetBSD: curproc.9,v 1.6 2022/09/22 14:02:24 riastradh Exp $
 .\"
 .\" Copyright (c) 2002 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -40,41 +40,68 @@
 .In sys/proc.h
 .Ft struct cpu_info *
 .Fn curcpu "void"
-.Ft struct proc *
-.Fn curproc "void"
-.Ft struct lwp *
-.Fn curlwp "void"
+.Vt struct proc *curproc ;
+.Vt struct lwp *curlwp ;
 .Sh DESCRIPTION
-The following macros can be used to retrieve
-the current processor, process, and light-weight process
-.Pq Tn LWP ,
+The following macros retrieve
+the current CPU, process, and thread
+.Pq lightweight process, or Tn LWP ,
 respectively:
-.Bl -enum -offset indent
-.It
-The machine-dependent
+.Bl -tag -width Dv
+.It Fn curcpu
+Returns a pointer to the
+.Vt "struct cpu_info"
+structure representing the CPU that the code calling it is running on.
+.Pp
+The value of
 .Fn curcpu
-macro returns a pointer to a
-.Em cpu_info
-structure containing information of the
-.Tn CPU
-that this thread is running on.
-.It
-The machine-independent
-.Fn curproc
-macro refers to a pointer to the process currently running on this
-.Tn CPU .
-.It
-The
-.Fn curlwp
-macro expands to a pointer to
-.Em lwp
-structure, containing information about the current
-.Tn LWP .
-This macro is machine-independent,
-but machine-dependent
-.In machine/cpu.h
-may redefine it.
+is unstable and may be stale as soon as it is read unless the caller
+prevents preemption by raising the IPL
+.Pq Xr spl 9 , Xr mutex 9 ,
+by disabling preemption
+.Pq Xr kpreempt_disable 9 ,
+or by binding the thread to its CPU
+.Pq Xr curlwp_bind 9 .
+.It Dv curproc
+Yields a pointer to the
+.Vt "struct proc"
+structure representing the currently running process.
+.Pp
+The value of
+.Dv curproc
+is stable and does not change during execution except in
+machine-dependent logic to perform context switches, so it works like a
+global constant, not like a stateful procedure.
+.It Dv curlwp
+Yields a pointer to the
+.Vt "struct lwp"
+structure representing the currently running thread.
+.Pp
+The value of
+.Dv curlwp
+is stable and does not change during execution except in
+machine-dependent logic to perform context switches, so it works like a
+global constant, not like a stateful procedure.
 .El
+.Sh SOURCE REFERENCES
+The
+.Fn curcpu
+macro is defined in the machine-independent
+.Pa machine/cpu.h .
+.Pp
+The
+.Dv curproc
+macro is defined in
+.Pa sys/lwp.h .
+.Pp
+The
+.Dv curlwp
+macro has a machine-independent definition in
+.Pa sys/lwp.h ,
+but it may be overridden by
+.Pa machine/cpu.h ,
+and must be overridden on architectures supporting multiprocessing and
+kernel preemption.
 .Sh SEE ALSO
 .Xr cpu_number 9 ,
 .Xr proc_find 9



CVS commit: src/share/man/man9

2022-09-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Sep 22 14:02:24 UTC 2022

Modified Files:
src/share/man/man9: curproc.9

Log Message:
curproc(9): Rework man page.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/share/man/man9/curproc.9

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



CVS commit: src/sys/dev/usb

2022-09-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Sep 22 07:02:21 UTC 2022

Modified Files:
src/sys/dev/usb: usbnet.c

Log Message:
usbnet(9): Omit needless miilock around uno_stop.

This time for real!


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/sys/dev/usb/usbnet.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/dev/usb/usbnet.c
diff -u src/sys/dev/usb/usbnet.c:1.112 src/sys/dev/usb/usbnet.c:1.113
--- src/sys/dev/usb/usbnet.c:1.112	Tue Sep 20 07:15:46 2022
+++ src/sys/dev/usb/usbnet.c	Thu Sep 22 07:02:21 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbnet.c,v 1.112 2022/09/20 07:15:46 mrg Exp $	*/
+/*	$NetBSD: usbnet.c,v 1.113 2022/09/22 07:02:21 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2019 Matthew R. Green
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.112 2022/09/20 07:15:46 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.113 2022/09/22 07:02:21 riastradh Exp $");
 
 #include 
 #include 
@@ -162,7 +162,6 @@ static void
 uno_stop(struct usbnet *un, struct ifnet *ifp, int disable)
 {
 	KASSERTMSG(IFNET_LOCKED(ifp), "%s", ifp->if_xname);
-	usbnet_isowned_mii(un);
 	if (un->un_ops->uno_stop)
 		(*un->un_ops->uno_stop)(ifp, disable);
 }
@@ -1175,11 +1174,8 @@ usbnet_stop(struct usbnet *un, struct if
 	 * it's been unplugged then there's no point in trying to touch
 	 * the registers.
 	 */
-	if (!usbnet_isdying(un)) {
-		mutex_enter(>unp_miilock);
+	if (!usbnet_isdying(un))
 		uno_stop(un, ifp, disable);
-		mutex_exit(>unp_miilock);
-	}
 
 	/* Free RX/TX resources. */
 	usbnet_rx_list_fini(un);



CVS commit: src/sys/dev/usb

2022-09-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Sep 22 07:02:21 UTC 2022

Modified Files:
src/sys/dev/usb: usbnet.c

Log Message:
usbnet(9): Omit needless miilock around uno_stop.

This time for real!


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/sys/dev/usb/usbnet.c

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



CVS commit: src/sys/dev/pci

2022-09-22 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Sep 22 06:04:26 UTC 2022

Modified Files:
src/sys/dev/pci: if_aq.c

Log Message:
Take and release IFNET_LOCK around aq_stop in aq_detach. Also, call with
the disable flag set so that interrupts and the callout are halted.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/pci/if_aq.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/dev/pci/if_aq.c
diff -u src/sys/dev/pci/if_aq.c:1.34 src/sys/dev/pci/if_aq.c:1.35
--- src/sys/dev/pci/if_aq.c:1.34	Thu Sep 22 05:50:52 2022
+++ src/sys/dev/pci/if_aq.c	Thu Sep 22 06:04:26 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_aq.c,v 1.34 2022/09/22 05:50:52 riastradh Exp $	*/
+/*	$NetBSD: if_aq.c,v 1.35 2022/09/22 06:04:26 skrll Exp $	*/
 
 /**
  * aQuantia Corporation Network Driver
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.34 2022/09/22 05:50:52 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.35 2022/09/22 06:04:26 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_if_aq.h"
@@ -1588,7 +1588,9 @@ aq_detach(device_t self, int flags __unu
 
 	if (sc->sc_iosize != 0) {
 		if (ifp->if_softc != NULL) {
-			aq_stop(ifp, 0);
+			IFNET_LOCK(ifp);
+			aq_stop(ifp, 1);
+			IFNET_UNLOCK(ifp);
 		}
 
 		for (i = 0; i < AQ_NINTR_MAX; i++) {
@@ -1616,8 +1618,6 @@ aq_detach(device_t self, int flags __unu
 		sc->sc_iosize = 0;
 	}
 
-	callout_stop(>sc_tick_ch);
-
 #if NSYSMON_ENVSYS > 0
 	if (sc->sc_sme != NULL) {
 		/* all sensors associated with this will also be detached */



CVS commit: src/sys/dev/pci

2022-09-22 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Sep 22 06:04:26 UTC 2022

Modified Files:
src/sys/dev/pci: if_aq.c

Log Message:
Take and release IFNET_LOCK around aq_stop in aq_detach. Also, call with
the disable flag set so that interrupts and the callout are halted.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/pci/if_aq.c

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