Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Dec 2009 14:03:40 +0000 (UTC)
From:      Andriy Gapon <avg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r200773 - in stable/7/sys: conf i386/cpufreq modules/cpufreq
Message-ID:  <200912211403.nBLE3eWT029946@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: avg
Date: Mon Dec 21 14:03:40 2009
New Revision: 200773
URL: http://svn.freebsd.org/changeset/base/200773

Log:
  MFC r190501,190521,192029: Add support for Phenom (Family 10h) to cpufreq.
  
  This also has changes from r197070 (earlier partial MFC).

Added:
  stable/7/sys/i386/cpufreq/hwpstate.c
     - copied, changed from r190501, head/sys/i386/cpufreq/hwpstate.c
Modified:
  stable/7/sys/conf/files.amd64
  stable/7/sys/conf/files.i386
  stable/7/sys/modules/cpufreq/Makefile
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/conf/files.amd64
==============================================================================
--- stable/7/sys/conf/files.amd64	Mon Dec 21 13:53:33 2009	(r200772)
+++ stable/7/sys/conf/files.amd64	Mon Dec 21 14:03:40 2009	(r200773)
@@ -272,6 +272,7 @@ i386/bios/smbios.c		optional	smbios
 i386/bios/vpd.c			optional	vpd
 i386/cpufreq/powernow.c		optional	cpufreq
 i386/cpufreq/est.c		optional	cpufreq
+i386/cpufreq/hwpstate.c		optional	cpufreq
 i386/cpufreq/p4tcc.c		optional	cpufreq
 #
 libkern/memset.c		standard

Modified: stable/7/sys/conf/files.i386
==============================================================================
--- stable/7/sys/conf/files.i386	Mon Dec 21 13:53:33 2009	(r200772)
+++ stable/7/sys/conf/files.i386	Mon Dec 21 14:03:40 2009	(r200773)
@@ -251,6 +251,7 @@ i386/bios/smapi_bios.S		optional smapi
 i386/bios/smbios.c		optional smbios
 i386/bios/vpd.c			optional vpd
 i386/cpufreq/est.c		optional cpufreq
+i386/cpufreq/hwpstate.c		optional cpufreq
 i386/cpufreq/p4tcc.c		optional cpufreq
 i386/cpufreq/powernow.c		optional cpufreq
 i386/cpufreq/smist.c		optional cpufreq

Copied and modified: stable/7/sys/i386/cpufreq/hwpstate.c (from r190501, head/sys/i386/cpufreq/hwpstate.c)
==============================================================================
--- head/sys/i386/cpufreq/hwpstate.c	Sat Mar 28 08:54:47 2009	(r190501, copy source)
+++ stable/7/sys/i386/cpufreq/hwpstate.c	Mon Dec 21 14:03:40 2009	(r200773)
@@ -8,7 +8,7 @@
  * Copyright (c) 2008-2009 Gen Otsuji
  *
  * This code is depending on kern_cpu.c, est.c, powernow.c, p4tcc.c, smist.c
- * in various parts. The authors of these files are
+ * in various parts. The authors of these files are Nate Lawson,
  * Colin Percival, Bruno Durcot, and FUKUDA Nobuhiko.
  * This code contains patches by Michael Reifenberger and Norikatsu Shigemura.
  * Thank you.
@@ -82,12 +82,6 @@ __FBSDID("$FreeBSD$");
 #define	AMD_10H_11H_CUR_DID(msr)		(((msr) >> 6) & 0x07)
 #define	AMD_10H_11H_CUR_FID(msr)		((msr) & 0x3F)
 
-#if defined(__amd64__)
-#define CPU_FAMILY(id)	AMD64_CPU_FAMILY(id)
-#elif defined(__i386__)
-#define CPU_FAMILY(id)	I386_CPU_FAMILY(id)
-#endif
-
 #define	HWPSTATE_DEBUG(dev, msg...)			\
 	do{						\
 		if(hwpstate_verbose)			\
@@ -161,7 +155,6 @@ DRIVER_MODULE(hwpstate, cpu, hwpstate_dr
 static int
 hwpstate_goto_pstate(device_t dev, int pstate)
 {
-	struct hwpstate_softc *sc;
 	struct pcpu *pc;
 	int i;
 	uint64_t msr;
@@ -170,7 +163,6 @@ hwpstate_goto_pstate(device_t dev, int p
 	int id = pstate;
 	int error;
 	
-	sc = device_get_softc(dev);
 	/* get the current pstate limit */
 	msr = rdmsr(MSR_AMD_10H_11H_LIMIT);
 	limit = AMD_10H_11H_GET_PSTATE_LIMIT(msr);
@@ -299,12 +291,11 @@ hwpstate_type(device_t dev, int *type)
 static void
 hwpstate_identify(driver_t *driver, device_t parent)
 {
-	device_t child;
 
 	if (device_find_child(parent, "hwpstate", -1) != NULL)
 		return;
 
-	if (cpu_vendor_id != CPU_VENDOR_AMD || CPU_FAMILY(cpu_id) < 0x10)
+	if (cpu_vendor_id != CPU_VENDOR_AMD || CPUID_TO_FAMILY(cpu_id) < 0x10)
 		return;
 
 	/*
@@ -318,7 +309,7 @@ hwpstate_identify(driver_t *driver, devi
 	if (resource_disabled("hwpstate", 0))
 		return;
 
-	if ((child = BUS_ADD_CHILD(parent, 10, "hwpstate", -1)) == NULL)
+	if (BUS_ADD_CHILD(parent, 10, "hwpstate", -1) == NULL)
 		device_printf(parent, "hwpstate: add child failed\n");
 }
 
@@ -407,7 +398,7 @@ hwpstate_get_info_from_msr(device_t dev)
 	uint64_t msr;
 	int family, i, fid, did;
 
-	family = CPU_FAMILY(cpu_id);
+	family = CPUID_TO_FAMILY(cpu_id);
 	sc = device_get_softc(dev);
 	/* Get pstate count */
 	msr = rdmsr(MSR_AMD_10H_11H_LIMIT);

Modified: stable/7/sys/modules/cpufreq/Makefile
==============================================================================
--- stable/7/sys/modules/cpufreq/Makefile	Mon Dec 21 13:53:33 2009	(r200772)
+++ stable/7/sys/modules/cpufreq/Makefile	Mon Dec 21 14:03:40 2009	(r200773)
@@ -12,7 +12,7 @@ SRCS+=	bus_if.h cpufreq_if.h device_if.h
 CFLAGS+= -I${.CURDIR}/../../contrib/dev/acpica
 
 SRCS+=	acpi_if.h opt_acpi.h
-SRCS+=	est.c p4tcc.c powernow.c
+SRCS+=	est.c hwpstate.c p4tcc.c powernow.c
 .endif
 
 .if ${MACHINE} == "i386"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200912211403.nBLE3eWT029946>