Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch Replace amdtempbus with amdnb_miscbus.
details: https://anonhg.NetBSD.org/src/rev/19b49bf6f5c6
branches: trunk
changeset: 778780:19b49bf6f5c6
user: cegger <cegger%NetBSD.org@localhost>
date: Fri Apr 13 13:11:16 2012 +0000
description:
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.
diffstat:
sys/arch/amd64/conf/GENERIC | 7 +-
sys/arch/amd64/conf/XEN3_DOM0 | 5 +-
sys/arch/i386/conf/ALL | 7 +-
sys/arch/i386/conf/GENERIC | 7 +-
sys/arch/i386/conf/XEN3_DOM0 | 5 +-
sys/arch/x86/pci/amdnb_misc.c | 104 ++++++++++++++++++++++++++++++++++++++++++
sys/arch/x86/pci/amdtemp.c | 20 +------
sys/arch/x86/pci/files.pci | 13 +++-
8 files changed, 135 insertions(+), 33 deletions(-)
diffs (truncated from 314 to 300 lines):
diff -r b57235cff8b2 -r 19b49bf6f5c6 sys/arch/amd64/conf/GENERIC
--- a/sys/arch/amd64/conf/GENERIC Fri Apr 13 12:31:19 2012 +0000
+++ b/sys/arch/amd64/conf/GENERIC Fri Apr 13 13:11:16 2012 +0000
@@ -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 @@
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 @@
# 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
diff -r b57235cff8b2 -r 19b49bf6f5c6 sys/arch/amd64/conf/XEN3_DOM0
--- a/sys/arch/amd64/conf/XEN3_DOM0 Fri Apr 13 12:31:19 2012 +0000
+++ b/sys/arch/amd64/conf/XEN3_DOM0 Fri Apr 13 13:11:16 2012 +0000
@@ -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 @@
# 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
diff -r b57235cff8b2 -r 19b49bf6f5c6 sys/arch/i386/conf/ALL
--- a/sys/arch/i386/conf/ALL Fri Apr 13 12:31:19 2012 +0000
+++ b/sys/arch/i386/conf/ALL Fri Apr 13 13:11:16 2012 +0000
@@ -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 @@
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 @@
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
diff -r b57235cff8b2 -r 19b49bf6f5c6 sys/arch/i386/conf/GENERIC
--- a/sys/arch/i386/conf/GENERIC Fri Apr 13 12:31:19 2012 +0000
+++ b/sys/arch/i386/conf/GENERIC Fri Apr 13 13:11:16 2012 +0000
@@ -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 @@
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 @@
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
diff -r b57235cff8b2 -r 19b49bf6f5c6 sys/arch/i386/conf/XEN3_DOM0
--- a/sys/arch/i386/conf/XEN3_DOM0 Fri Apr 13 12:31:19 2012 +0000
+++ b/sys/arch/i386/conf/XEN3_DOM0 Fri Apr 13 13:11:16 2012 +0000
@@ -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 @@
# 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
diff -r b57235cff8b2 -r 19b49bf6f5c6 sys/arch/x86/pci/amdnb_misc.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/x86/pci/amdnb_misc.c Fri Apr 13 13:11:16 2012 +0000
@@ -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;
+}
diff -r b57235cff8b2 -r 19b49bf6f5c6 sys/arch/x86/pci/amdtemp.c
--- a/sys/arch/x86/pci/amdtemp.c Fri Apr 13 12:31:19 2012 +0000
+++ b/sys/arch/x86/pci/amdtemp.c Fri Apr 13 13:11:16 2012 +0000
@@ -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 @@
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 @@
if (family > 0x15)
return 0;
- return 2; /* supercede pchb(4) */
+ return 1;
}
static void
diff -r b57235cff8b2 -r 19b49bf6f5c6 sys/arch/x86/pci/files.pci
--- a/sys/arch/x86/pci/files.pci Fri Apr 13 12:31:19 2012 +0000
+++ b/sys/arch/x86/pci/files.pci Fri Apr 13 13:11:16 2012 +0000
@@ -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/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
Home |
Main Index |
Thread Index |
Old Index