From owner-svn-src-stable@FreeBSD.ORG Mon Dec 21 14:03:41 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3694C1065670; Mon, 21 Dec 2009 14:03:41 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 246388FC12; Mon, 21 Dec 2009 14:03:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBLE3eAW029948; Mon, 21 Dec 2009 14:03:41 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBLE3eWT029946; Mon, 21 Dec 2009 14:03:40 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <200912211403.nBLE3eWT029946@svn.freebsd.org> From: Andriy Gapon Date: Mon, 21 Dec 2009 14:03:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200773 - in stable/7/sys: conf i386/cpufreq modules/cpufreq X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 14:03:41 -0000 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"