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

2023-01-24 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jan 24 09:57:16 UTC 2023

Modified Files:
src/sys/arch/x86/isa: clock.c

Log Message:
x86/isa/clock.c: Nix trailing whitespace.

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/x86/isa/clock.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/x86/isa/clock.c
diff -u src/sys/arch/x86/isa/clock.c:1.39 src/sys/arch/x86/isa/clock.c:1.40
--- src/sys/arch/x86/isa/clock.c:1.39	Fri May 29 12:30:41 2020
+++ src/sys/arch/x86/isa/clock.c	Tue Jan 24 09:57:16 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: clock.c,v 1.39 2020/05/29 12:30:41 rin Exp $	*/
+/*	$NetBSD: clock.c,v 1.40 2023/01/24 09:57:16 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -69,28 +69,28 @@
  *
  *	@(#)clock.c	7.2 (Berkeley) 5/12/91
  */
-/* 
+/*
  * Mach Operating System
  * Copyright (c) 1991,1990,1989 Carnegie Mellon University
  * All Rights Reserved.
- * 
+ *
  * Permission to use, copy, modify and distribute this software and its
  * documentation is hereby granted, provided that both the copyright
  * notice and this permission notice appear in all copies of the
  * software, derivative works or modified versions, and any portions
  * thereof, and that both notices appear in supporting documentation.
- * 
+ *
  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- * 
+ *
  * Carnegie Mellon requests users of this software to return to
- * 
+ *
  *  Software Distribution Coordinator  or  software.distribut...@cs.cmu.edu
  *  School of Computer Science
  *  Carnegie Mellon University
  *  Pittsburgh PA 15213-3890
- * 
+ *
  * any improvements or extensions that they make and grant Carnegie Mellon
  * the rights to redistribute these changes.
  */
@@ -121,7 +121,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFT
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.39 2020/05/29 12:30:41 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.40 2023/01/24 09:57:16 riastradh Exp $");
 
 /* #define CLOCKDEBUG */
 /* #define CLOCK_PARANOIA */
@@ -150,7 +150,7 @@ __KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.
 #include 
 #include 
 #include 
-#include  
+#include 
 #include 
 
 #ifndef __x86_64__
@@ -346,7 +346,7 @@ startrtclock(void)
  * Must be called at splsched().
  */
 static void
-tickle_tc(void) 
+tickle_tc(void)
 {
 #if defined(MULTIPROCESSOR)
 	struct cpu_info *ci = curcpu();
@@ -398,7 +398,7 @@ i8254_get_timecount(struct timecounter *
 	psl = x86_read_psl();
 	x86_disable_intr();
 	__cpu_simple_lock(&tmr_lock);
-	/* Select timer0 and latch counter value. */ 
+	/* Select timer0 and latch counter value. */
 	outb(IO_TIMER1 + TIMER_MODE, TIMER_SEL0 | TIMER_LATCH);
 	/* insb to make the read atomic */
 	rdval = inb(IO_TIMER1+TIMER_CNTR0);
@@ -422,7 +422,7 @@ gettick(void)
 {
 	uint16_t rdval;
 	u_long psl;
-	
+
 	if (clock_broken_latch)
 		return (gettick_broken_latch());
 



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

2023-01-24 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jan 24 09:57:16 UTC 2023

Modified Files:
src/sys/arch/x86/isa: clock.c

Log Message:
x86/isa/clock.c: Nix trailing whitespace.

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/x86/isa/clock.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/x86/isa

2022-12-30 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Fri Dec 30 21:40:20 UTC 2022

Modified Files:
src/sys/arch/x86/isa: rtc.c

Log Message:
Honor ACPI FADT Century byte; should fix many "unknown CMOS layout" messages.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/x86/isa/rtc.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/x86/isa/rtc.c
diff -u src/sys/arch/x86/isa/rtc.c:1.1 src/sys/arch/x86/isa/rtc.c:1.2
--- src/sys/arch/x86/isa/rtc.c:1.1	Tue Jun 16 21:05:34 2009
+++ src/sys/arch/x86/isa/rtc.c	Fri Dec 30 21:40:20 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtc.c,v 1.1 2009/06/16 21:05:34 bouyer Exp $	*/
+/*	$NetBSD: rtc.c,v 1.2 2022/12/30 21:40:20 jakllsch Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -121,7 +121,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFT
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rtc.c,v 1.1 2009/06/16 21:05:34 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtc.c,v 1.2 2022/12/30 21:40:20 jakllsch Exp $");
 
 #include 
 #include 
@@ -145,6 +145,11 @@ __KERNEL_RCSID(0, "$NetBSD: rtc.c,v 1.1 
 #include 	/* for MCA_system */
 #endif
 
+#include "acpica.h"
+#if NACPICA > 0
+#include 
+#endif
+
 static void	rtcinit(void);
 static int	rtcget(mc_todregs *);
 static void	rtcput(mc_todregs *);
@@ -269,6 +274,12 @@ clock_expandyear(int clockyear)
 		return (clockyear);
 
 	s = splclock();
+#if NACPICA > 0
+	if (acpi_active)
+		cmoscentury = mc146818_read(NULL,
+		(centb = AcpiGbl_FADT.Century));
+	else
+#endif
 	if (cmoscheck())
 		cmoscentury = mc146818_read(NULL, NVRAM_CENTURY);
 #if NMCA > 0



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

2022-12-30 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Fri Dec 30 21:40:20 UTC 2022

Modified Files:
src/sys/arch/x86/isa: rtc.c

Log Message:
Honor ACPI FADT Century byte; should fix many "unknown CMOS layout" messages.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/x86/isa/rtc.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/x86/isa

2022-04-15 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Apr 15 17:53:44 UTC 2022

Modified Files:
src/sys/arch/x86/isa: isa_machdep.c

Log Message:
Disable FADT LEGACY_DEVICES flag test.

This test had the unintended side-effect of blocking the lm(4) driver
from attaching on more than one system. Go back to (slow) probing of
ISA devices for now to restore existing functionality.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/x86/isa/isa_machdep.c

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

Modified files:

Index: src/sys/arch/x86/isa/isa_machdep.c
diff -u src/sys/arch/x86/isa/isa_machdep.c:1.51 src/sys/arch/x86/isa/isa_machdep.c:1.52
--- src/sys/arch/x86/isa/isa_machdep.c:1.51	Fri Dec 17 06:28:20 2021
+++ src/sys/arch/x86/isa/isa_machdep.c	Fri Apr 15 17:53:44 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: isa_machdep.c,v 1.51 2021/12/17 06:28:20 skrll Exp $	*/
+/*	$NetBSD: isa_machdep.c,v 1.52 2022/04/15 17:53:44 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: isa_machdep.c,v 1.51 2021/12/17 06:28:20 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isa_machdep.c,v 1.52 2022/04/15 17:53:44 jmcneill Exp $");
 
 #include 
 #include 
@@ -373,6 +373,13 @@ device_isa_register(device_t dev, void *
 		prop_dictionary_set_bool(device_properties(dev),
 		"no-legacy-devices", true);
 #if NACPICA > 0
+#if notyet
+	/*
+	 * The following code block is technically correct, but unfortunately
+	 * it breaks things like being able to use lm(4) on platforms that
+	 * have no other means of exposing temperature, fan, and voltage
+	 * sensors.
+	 */
 	if (device_is_a(dev, "isa") && acpi_active) {
 		/*
 		 * For FACP >= 2, the LEGACY_DEVICES flag indicates that
@@ -387,6 +394,8 @@ device_isa_register(device_t dev, void *
 			"no-legacy-devices", true);
 		}
 	}
+#endif
+
 	if (vm_guest == VM_GUEST_VMWARE &&
 	device_is_a(dev, "isa") && acpi_active) {
 		prop_dictionary_set_bool(device_properties(dev),



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

2022-04-15 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Apr 15 17:53:44 UTC 2022

Modified Files:
src/sys/arch/x86/isa: isa_machdep.c

Log Message:
Disable FADT LEGACY_DEVICES flag test.

This test had the unintended side-effect of blocking the lm(4) driver
from attaching on more than one system. Go back to (slow) probing of
ISA devices for now to restore existing functionality.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/x86/isa/isa_machdep.c

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



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

2021-10-16 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Oct 16 13:15:01 UTC 2021

Modified Files:
src/sys/arch/x86/isa: isa_machdep.c

Log Message:
Skip legacy device detection for VMware guests with ACPI enabled.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/x86/isa/isa_machdep.c

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



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

2021-10-16 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Oct 16 13:15:01 UTC 2021

Modified Files:
src/sys/arch/x86/isa: isa_machdep.c

Log Message:
Skip legacy device detection for VMware guests with ACPI enabled.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/x86/isa/isa_machdep.c

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

Modified files:

Index: src/sys/arch/x86/isa/isa_machdep.c
diff -u src/sys/arch/x86/isa/isa_machdep.c:1.48 src/sys/arch/x86/isa/isa_machdep.c:1.49
--- src/sys/arch/x86/isa/isa_machdep.c:1.48	Fri Oct 15 19:01:52 2021
+++ src/sys/arch/x86/isa/isa_machdep.c	Sat Oct 16 13:15:01 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: isa_machdep.c,v 1.48 2021/10/15 19:01:52 jmcneill Exp $	*/
+/*	$NetBSD: isa_machdep.c,v 1.49 2021/10/16 13:15:01 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: isa_machdep.c,v 1.48 2021/10/15 19:01:52 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isa_machdep.c,v 1.49 2021/10/16 13:15:01 jmcneill Exp $");
 
 #include 
 #include 
@@ -387,6 +387,11 @@ device_isa_register(device_t dev, void *
 			"no-legacy-devices", true);
 		}
 	}
+	if (vm_guest == VM_GUEST_VMWARE &&
+	device_is_a(dev, "isa") && acpi_active) {
+		prop_dictionary_set_bool(device_properties(dev),
+		"no-legacy-devices", true);
+	}
 #endif /* NACPICA > 0 */
 	return NULL;
 }



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

2021-10-15 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Oct 15 19:01:52 UTC 2021

Modified Files:
src/sys/arch/x86/isa: isa_machdep.c

Log Message:
Add missing acpi include


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/x86/isa/isa_machdep.c

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



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

2021-10-15 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Oct 15 19:01:52 UTC 2021

Modified Files:
src/sys/arch/x86/isa: isa_machdep.c

Log Message:
Add missing acpi include


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/x86/isa/isa_machdep.c

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

Modified files:

Index: src/sys/arch/x86/isa/isa_machdep.c
diff -u src/sys/arch/x86/isa/isa_machdep.c:1.47 src/sys/arch/x86/isa/isa_machdep.c:1.48
--- src/sys/arch/x86/isa/isa_machdep.c:1.47	Fri Oct 15 18:44:53 2021
+++ src/sys/arch/x86/isa/isa_machdep.c	Fri Oct 15 19:01:52 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: isa_machdep.c,v 1.47 2021/10/15 18:44:53 jmcneill Exp $	*/
+/*	$NetBSD: isa_machdep.c,v 1.48 2021/10/15 19:01:52 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: isa_machdep.c,v 1.47 2021/10/15 18:44:53 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isa_machdep.c,v 1.48 2021/10/15 19:01:52 jmcneill Exp $");
 
 #include 
 #include 
@@ -96,6 +96,10 @@ __KERNEL_RCSID(0, "$NetBSD: isa_machdep.
 #include 
 #endif
 
+#if NACPICA > 0
+#include 
+#endif
+
 static int _isa_dma_may_bounce(bus_dma_tag_t, bus_dmamap_t, int, int *);
 
 struct x86_bus_dma_tag isa_bus_dma_tag = {



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

2021-10-15 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Oct 15 18:44:53 UTC 2021

Modified Files:
src/sys/arch/x86/isa: isa_machdep.c

Log Message:
If ACPI indicates that there are no user visible devices on the LPC or ISA
bus, set the "no-legacy-devices" property on isa to bypass indirect
configuration of ISA devices.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/x86/isa/isa_machdep.c

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

Modified files:

Index: src/sys/arch/x86/isa/isa_machdep.c
diff -u src/sys/arch/x86/isa/isa_machdep.c:1.46 src/sys/arch/x86/isa/isa_machdep.c:1.47
--- src/sys/arch/x86/isa/isa_machdep.c:1.46	Sat May  2 16:44:35 2020
+++ src/sys/arch/x86/isa/isa_machdep.c	Fri Oct 15 18:44:53 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: isa_machdep.c,v 1.46 2020/05/02 16:44:35 bouyer Exp $	*/
+/*	$NetBSD: isa_machdep.c,v 1.47 2021/10/15 18:44:53 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: isa_machdep.c,v 1.46 2020/05/02 16:44:35 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isa_machdep.c,v 1.47 2021/10/15 18:44:53 jmcneill Exp $");
 
 #include 
 #include 
@@ -369,13 +369,20 @@ device_isa_register(device_t dev, void *
 		prop_dictionary_set_bool(device_properties(dev),
 		"no-legacy-devices", true);
 #if NACPICA > 0
-#if notyet
 	if (device_is_a(dev, "isa") && acpi_active) {
-		if (!(AcpiGbl_FADT.BootFlags & ACPI_FADT_LEGACY_DEVICES))
+		/*
+		 * For FACP >= 2, the LEGACY_DEVICES flag indicates that
+		 * the motherboard supports user-visible devices on the LPC
+		 * or ISA bus. If clear, assume that no such devices are
+		 * present and we can enumerate everything we need using
+		 * ACPI tables.
+		 */
+		if (AcpiGbl_FADT.Header.Revision >= 2 &&
+		!(AcpiGbl_FADT.BootFlags & ACPI_FADT_LEGACY_DEVICES)) {
 			prop_dictionary_set_bool(device_properties(dev),
 			"no-legacy-devices", true);
+		}
 	}
-#endif
 #endif /* NACPICA > 0 */
 	return NULL;
 }



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

2021-10-15 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Oct 15 18:44:53 UTC 2021

Modified Files:
src/sys/arch/x86/isa: isa_machdep.c

Log Message:
If ACPI indicates that there are no user visible devices on the LPC or ISA
bus, set the "no-legacy-devices" property on isa to bypass indirect
configuration of ISA devices.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/x86/isa/isa_machdep.c

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