Module Name:    src
Committed By:   cegger
Date:           Fri Apr 13 13:11:17 UTC 2012

Modified Files:
        src/sys/arch/amd64/conf: GENERIC XEN3_DOM0
        src/sys/arch/i386/conf: ALL GENERIC XEN3_DOM0
        src/sys/arch/x86/pci: amdtemp.c files.pci
Added Files:
        src/sys/arch/x86/pci: amdnb_misc.c

Log Message:
Replace amdtempbus with amdnb_miscbus.
This allows us to have independent drivers on the same device (northbridge f3)
each coming with a certain functionality/feature.
This way we do not need to mess with amdtemp(4) to utilize other features.


To generate a diff of this commit:
cvs rdiff -u -r1.352 -r1.353 src/sys/arch/amd64/conf/GENERIC
cvs rdiff -u -r1.81 -r1.82 src/sys/arch/amd64/conf/XEN3_DOM0
cvs rdiff -u -r1.335 -r1.336 src/sys/arch/i386/conf/ALL
cvs rdiff -u -r1.1070 -r1.1071 src/sys/arch/i386/conf/GENERIC
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/i386/conf/XEN3_DOM0
cvs rdiff -u -r0 -r1.1 src/sys/arch/x86/pci/amdnb_misc.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/x86/pci/amdtemp.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/x86/pci/files.pci

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/amd64/conf/GENERIC
diff -u src/sys/arch/amd64/conf/GENERIC:1.352 src/sys/arch/amd64/conf/GENERIC:1.353
--- src/sys/arch/amd64/conf/GENERIC:1.352	Sat Apr  7 05:39:55 2012
+++ src/sys/arch/amd64/conf/GENERIC	Fri Apr 13 13:11:16 2012
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.352 2012/04/07 05:39:55 christos Exp $
+# $NetBSD: GENERIC,v 1.353 2012/04/13 13:11:16 cegger Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.352 $"
+#ident 		"GENERIC-$Revision: 1.353 $"
 
 maxusers	64		# estimated number of users
 
@@ -440,7 +440,8 @@ lpt1	at isa? port 0x278
 
 # Hardware monitors
 
-amdtemp* at pchb?			# AMD CPU Temperature sensors
+amdnb_misc* at pci?			# AMD NB Misc Configuration
+amdtemp* at amdnb_misc?			# AMD CPU Temperature sensors
 
 # Winbond LPC Super I/O
 #wbsio*	at isa? port 0x2e

Index: src/sys/arch/amd64/conf/XEN3_DOM0
diff -u src/sys/arch/amd64/conf/XEN3_DOM0:1.81 src/sys/arch/amd64/conf/XEN3_DOM0:1.82
--- src/sys/arch/amd64/conf/XEN3_DOM0:1.81	Sat Mar 10 21:51:48 2012
+++ src/sys/arch/amd64/conf/XEN3_DOM0	Fri Apr 13 13:11:16 2012
@@ -1,4 +1,4 @@
-# $NetBSD: XEN3_DOM0,v 1.81 2012/03/10 21:51:48 joerg Exp $
+# $NetBSD: XEN3_DOM0,v 1.82 2012/04/13 13:11:16 cegger Exp $
 
 include 	"arch/amd64/conf/std.xen"
 
@@ -296,7 +296,8 @@ lpt0	at isa? port 0x378 irq 7	# standard
 
 # Hardware monitors
 
-amdtemp* at pchb?			# AMD CPU Temperature sensors
+amdnb_misc* at pci?			# AMD NB Misc Configuration
+amdtemp* at amdnb_misc?			# AMD CPU Temperature sensors
 
 # AMD 768 and 8111 power/ACPI controllers
 amdpm*	at pci? dev ? function ?	# RNG and SMBus 1.0 interface

Index: src/sys/arch/i386/conf/ALL
diff -u src/sys/arch/i386/conf/ALL:1.335 src/sys/arch/i386/conf/ALL:1.336
--- src/sys/arch/i386/conf/ALL:1.335	Tue Apr 10 23:59:47 2012
+++ src/sys/arch/i386/conf/ALL	Fri Apr 13 13:11:16 2012
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.335 2012/04/10 23:59:47 christos Exp $
+# $NetBSD: ALL,v 1.336 2012/04/13 13:11:16 cegger Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"ALL-$Revision: 1.335 $"
+#ident 		"ALL-$Revision: 1.336 $"
 
 maxusers	64		# estimated number of users
 
@@ -470,7 +470,8 @@ elanpar*	at elansc?
 elanpex*	at elansc?
 
 # Temperatures
-amdtemp* at pchb?			# AMD CPU Temperature sensors
+amdnb_misc* at pci?			# AMD NB Misc Configuration
+amdtemp* at amdnb_misc?			# AMD CPU Temperature sensors
 
 # PCI bridges
 amdpcib* at pci? dev ? function ?	# AMD 8111 PCI-ISA w/ HPET

Index: src/sys/arch/i386/conf/GENERIC
diff -u src/sys/arch/i386/conf/GENERIC:1.1070 src/sys/arch/i386/conf/GENERIC:1.1071
--- src/sys/arch/i386/conf/GENERIC:1.1070	Sun Apr  8 20:49:29 2012
+++ src/sys/arch/i386/conf/GENERIC	Fri Apr 13 13:11:16 2012
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.1070 2012/04/08 20:49:29 christos Exp $
+# $NetBSD: GENERIC,v 1.1071 2012/04/13 13:11:16 cegger Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.1070 $"
+#ident 		"GENERIC-$Revision: 1.1071 $"
 
 maxusers	64		# estimated number of users
 
@@ -446,7 +446,8 @@ pci*	at elansc? bus ?
 elansc* at mainbus? bus ?		# AMD Elan SC520 System Controller
 
 # Temperatures
-amdtemp* at pchb?			# AMD CPU Temperature sensors
+amdnb_misc* at pci?			# AMD NB Misc Configuration
+amdtemp* at amdnb_misc?			# AMD CPU Temperature sensors
 
 # PCI bridges
 #amdpcib* at pci? dev ? function ?	# AMD 8111 PCI-ISA w/ HPET

Index: src/sys/arch/i386/conf/XEN3_DOM0
diff -u src/sys/arch/i386/conf/XEN3_DOM0:1.64 src/sys/arch/i386/conf/XEN3_DOM0:1.65
--- src/sys/arch/i386/conf/XEN3_DOM0:1.64	Sat Mar 10 21:51:53 2012
+++ src/sys/arch/i386/conf/XEN3_DOM0	Fri Apr 13 13:11:16 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: XEN3_DOM0,v 1.64 2012/03/10 21:51:53 joerg Exp $
+#	$NetBSD: XEN3_DOM0,v 1.65 2012/04/13 13:11:16 cegger Exp $
 #
 #	XEN3_0: Xen 3.0 domain0 kernel
 
@@ -273,7 +273,8 @@ lpt0	at isa? port 0x378 irq 7	# standard
 
 # Hardware monitors
 
-amdtemp* at pchb?			# AMD CPU Temperature sensors
+amdnb_misc* at pci?			# AMD NB Misc Configuration
+amdtemp* at amdnb_misc?			# AMD CPU Temperature sensors
 
 # AMD 768 and 8111 power/ACPI controllers
 amdpm*	at pci? dev ? function ?	# RNG and SMBus 1.0 interface

Index: src/sys/arch/x86/pci/amdtemp.c
diff -u src/sys/arch/x86/pci/amdtemp.c:1.14 src/sys/arch/x86/pci/amdtemp.c:1.15
--- src/sys/arch/x86/pci/amdtemp.c:1.14	Fri Apr 13 12:14:41 2012
+++ src/sys/arch/x86/pci/amdtemp.c	Fri Apr 13 13:11:17 2012
@@ -1,4 +1,4 @@
-/*      $NetBSD: amdtemp.c,v 1.14 2012/04/13 12:14:41 cegger Exp $ */
+/*      $NetBSD: amdtemp.c,v 1.15 2012/04/13 13:11:17 cegger Exp $ */
 /*      $OpenBSD: kate.c,v 1.2 2008/03/27 04:52:03 cnst Exp $   */
 
 /*
@@ -48,7 +48,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdtemp.c,v 1.14 2012/04/13 12:14:41 cegger Exp $ ");
+__KERNEL_RCSID(0, "$NetBSD: amdtemp.c,v 1.15 2012/04/13 13:11:17 cegger Exp $ ");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -189,19 +189,7 @@ amdtemp_match(device_t parent, cfdata_t 
 	pcireg_t cpu_signature;
 	uint32_t family;
 
-	if (PCI_VENDOR(pa->pa_id) != PCI_VENDOR_AMD)
-		return 0;
-
-	switch (PCI_PRODUCT(pa->pa_id)) {
-	case PCI_PRODUCT_AMD_AMD64_MISC:
-	case PCI_PRODUCT_AMD_AMD64_F10_MISC:
-	case PCI_PRODUCT_AMD_AMD64_F11_MISC:
-	case PCI_PRODUCT_AMD_F14_NB:	/* Family12h too */
-	case PCI_PRODUCT_AMD_F15_MISC:
-		break;
-	default:
-		return 0;
-	}
+	KASSERT(PCI_VENDOR(pa->pa_id) == PCI_VENDOR_AMD);
 
 	cpu_signature = pci_conf_read(pa->pa_pc,
 	    pa->pa_tag, CPUID_FAMILY_MODEL_R);
@@ -229,7 +217,7 @@ amdtemp_match(device_t parent, cfdata_t 
 	if (family > 0x15)
 		return 0;
 
-	return 2;	/* supercede pchb(4) */
+	return 1;
 }
 
 static void

Index: src/sys/arch/x86/pci/files.pci
diff -u src/sys/arch/x86/pci/files.pci:1.13 src/sys/arch/x86/pci/files.pci:1.14
--- src/sys/arch/x86/pci/files.pci:1.13	Thu Aug 18 20:55:20 2011
+++ src/sys/arch/x86/pci/files.pci	Fri Apr 13 13:11:17 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: files.pci,v 1.13 2011/08/18 20:55:20 jakllsch Exp $
+#	$NetBSD: files.pci,v 1.14 2012/04/13 13:11:17 cegger Exp $
 
 device 	aapic
 attach 	aapic at pci
@@ -6,9 +6,10 @@ file 	arch/x86/pci/aapic.c		aapic
 
 file	arch/x86/pci/agp_machdep.c	agp
 
+define amdnb_miscbus {}
+
 # PCI-Host bridge chipsets
-define amdtempbus {}
-device	pchb:	pcibus, agpbus, amdtempbus,
+device	pchb:	pcibus, agpbus,
 		agp_ali, agp_amd, agp_amd64, agp_i810,
 		agp_intel, agp_sis, agp_via
 attach	pchb at pci
@@ -28,8 +29,12 @@ attach  hpet at amdpcib with amdpcib_hpe
 file    arch/x86/pci/amdpcib_hpet.c		amdpcib_hpet
 
 # AMD Processors -- Miscellaneous Control
+device	amdnb_misc: amdnb_miscbus
+attach	amdnb_misc at pci
+file	arch/x86/pci/amdnb_misc.c	amdnb_misc
+
 device	amdtemp: sysmon_envsys
-attach	amdtemp at amdtempbus
+attach	amdtemp at amdnb_miscbus
 file	arch/x86/pci/amdtemp.c		amdtemp
 
 # PCI-LPC bridges

Added files:

Index: src/sys/arch/x86/pci/amdnb_misc.c
diff -u /dev/null src/sys/arch/x86/pci/amdnb_misc.c:1.1
--- /dev/null	Fri Apr 13 13:11:17 2012
+++ src/sys/arch/x86/pci/amdnb_misc.c	Fri Apr 13 13:11:17 2012
@@ -0,0 +1,104 @@
+/*	$NetBSD: amdnb_misc.c,v 1.1 2012/04/13 13:11:17 cegger Exp $ */
+/*
+ * Copyright (c) 2012 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christoph Egger.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: amdnb_misc.c,v 1.1 2012/04/13 13:11:17 cegger Exp $");
+
+#include <sys/param.h>
+#include <sys/device.h>
+
+#include <dev/pci/pcireg.h>
+#include <dev/pci/pcivar.h>
+#include <dev/pci/pcidevs.h>
+
+static int amdnb_misc_match(device_t, cfdata_t match, void *);
+static void amdnb_misc_attach(device_t, device_t, void *);
+static int amdnb_misc_detach(device_t, int);
+
+CFATTACH_DECL_NEW(amdnb_misc, 0,
+    amdnb_misc_match, amdnb_misc_attach, amdnb_misc_detach, NULL);
+
+
+static int
+amdnb_misc_match(device_t parent, cfdata_t match, void *aux)
+{
+	struct pci_attach_args *pa = aux;
+
+	if (PCI_VENDOR(pa->pa_id) != PCI_VENDOR_AMD)
+		return 0;
+
+	switch (PCI_PRODUCT(pa->pa_id)) {
+	case PCI_PRODUCT_AMD_AMD64_MISC:
+	case PCI_PRODUCT_AMD_AMD64_F10_MISC:
+	case PCI_PRODUCT_AMD_AMD64_F11_MISC:
+	case PCI_PRODUCT_AMD_F14_NB:		/* Family 12h, too */
+	case PCI_PRODUCT_AMD_F15_MISC:
+		break;
+	default:
+		return 0;
+	}
+
+	return 2;	/* supercede pchb(4) */
+}
+
+static int
+amdnb_misc_search(device_t parent, cfdata_t cf, const int *locs, void *aux)
+{
+	if (config_match(parent, cf, aux))
+		config_attach_loc(parent, cf, locs, aux, NULL);
+
+	return 0;
+}
+
+static void
+amdnb_misc_attach(device_t parent, device_t self, void *aux)
+{
+	aprint_naive("\n");
+	aprint_normal(": AMD NB Misc Configuration\n");
+
+	if (!pmf_device_register(self, NULL, NULL))
+		aprint_error_dev(self, "couldn't establish power handler\n");
+
+	config_search_loc(amdnb_misc_search, self, "amdnb_miscbus", NULL, aux);
+	return;
+}
+
+static int
+amdnb_misc_detach(device_t self, int flags)
+{
+	int rv;
+
+	rv = config_detach_children(self, flags);
+	if (rv != 0)
+		return rv;
+
+	pmf_device_deregister(self);
+	return rv;
+}

Reply via email to