Deleted Added
full compact
powernow.c (204309) powernow.c (221102)
1/*-
2 * Copyright (c) 2004-2005 Bruno Ducrot
3 * Copyright (c) 2004 FUKUDA Nobuhiko <nfukuda@spa.is.uec.ac.jp>
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 15 unchanged lines hidden (view full) ---

24 */
25
26/*
27 * Many thanks to Nate Lawson for his helpful comments on this driver and
28 * to Jung-uk Kim for testing.
29 */
30
31#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2004-2005 Bruno Ducrot
3 * Copyright (c) 2004 FUKUDA Nobuhiko <nfukuda@spa.is.uec.ac.jp>
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 15 unchanged lines hidden (view full) ---

24 */
25
26/*
27 * Many thanks to Nate Lawson for his helpful comments on this driver and
28 * to Jung-uk Kim for testing.
29 */
30
31#include <sys/cdefs.h>
32__FBSDID("$FreeBSD: head/sys/x86/cpufreq/powernow.c 185349 2008-11-26 22:33:55Z jkim $");
32__FBSDID("$FreeBSD: head/sys/x86/cpufreq/powernow.c 221102 2011-04-27 00:32:35Z jkim $");
33
34#include <sys/param.h>
35#include <sys/bus.h>
36#include <sys/cpu.h>
37#include <sys/kernel.h>
38#include <sys/malloc.h>
39#include <sys/module.h>
40#include <sys/pcpu.h>

--- 755 unchanged lines hidden (view full) ---

796 ctrl = sets[i].spec[PX_SPEC_CONTROL];
797 switch (sc->pn_type) {
798 case PN7_TYPE:
799 state.fid = ACPI_PN7_CTRL_TO_FID(ctrl);
800 state.vid = ACPI_PN7_CTRL_TO_VID(ctrl);
801 if ((sc->errata & A0_ERRATA) &&
802 (pn7_fid_to_mult[state.fid] % 10) == 5)
803 continue;
33
34#include <sys/param.h>
35#include <sys/bus.h>
36#include <sys/cpu.h>
37#include <sys/kernel.h>
38#include <sys/malloc.h>
39#include <sys/module.h>
40#include <sys/pcpu.h>

--- 755 unchanged lines hidden (view full) ---

796 ctrl = sets[i].spec[PX_SPEC_CONTROL];
797 switch (sc->pn_type) {
798 case PN7_TYPE:
799 state.fid = ACPI_PN7_CTRL_TO_FID(ctrl);
800 state.vid = ACPI_PN7_CTRL_TO_VID(ctrl);
801 if ((sc->errata & A0_ERRATA) &&
802 (pn7_fid_to_mult[state.fid] % 10) == 5)
803 continue;
804 state.freq = 100 * pn7_fid_to_mult[state.fid] * sc->fsb;
805 break;
806 case PN8_TYPE:
807 state.fid = ACPI_PN8_CTRL_TO_FID(ctrl);
808 state.vid = ACPI_PN8_CTRL_TO_VID(ctrl);
804 break;
805 case PN8_TYPE:
806 state.fid = ACPI_PN8_CTRL_TO_FID(ctrl);
807 state.vid = ACPI_PN8_CTRL_TO_VID(ctrl);
809 state.freq = 100 * pn8_fid_to_mult[state.fid] * sc->fsb;
810 break;
811 }
808 break;
809 }
812
810 state.freq = sets[i].freq * 1000;
813 state.power = sets[i].power;
814
815 j = n;
816 while (j > 0 && sc->powernow_states[j - 1].freq < state.freq) {
817 memcpy(&sc->powernow_states[j],
818 &sc->powernow_states[j - 1],
819 sizeof(struct powernow_state));
820 --j;

--- 15 unchanged lines hidden (view full) ---

836 * This maybe indicates we have the wrong tables. Therefore,
837 * don't implement a quirk, but fallback to BIOS legacy
838 * tables instead.
839 */
840 if (PN7_STA_MFID(status) != state.fid) {
841 device_printf(dev, "ACPI MAX frequency not found\n");
842 return (EINVAL);
843 }
811 state.power = sets[i].power;
812
813 j = n;
814 while (j > 0 && sc->powernow_states[j - 1].freq < state.freq) {
815 memcpy(&sc->powernow_states[j],
816 &sc->powernow_states[j - 1],
817 sizeof(struct powernow_state));
818 --j;

--- 15 unchanged lines hidden (view full) ---

834 * This maybe indicates we have the wrong tables. Therefore,
835 * don't implement a quirk, but fallback to BIOS legacy
836 * tables instead.
837 */
838 if (PN7_STA_MFID(status) != state.fid) {
839 device_printf(dev, "ACPI MAX frequency not found\n");
840 return (EINVAL);
841 }
842 sc->fsb = state.freq / 100 / pn7_fid_to_mult[state.fid];
844 break;
845 case PN8_TYPE:
846 sc->vst = ACPI_PN8_CTRL_TO_VST(ctrl),
847 sc->mvs = ACPI_PN8_CTRL_TO_MVS(ctrl),
848 sc->pll = ACPI_PN8_CTRL_TO_PLL(ctrl),
849 sc->rvo = ACPI_PN8_CTRL_TO_RVO(ctrl),
850 sc->irt = ACPI_PN8_CTRL_TO_IRT(ctrl);
851 sc->low = 0; /* XXX */
852
853 /*
854 * powernow k8 supports only one low frequency.
855 */
856 if (sc->powernow_max_states >= 2 &&
857 (sc->powernow_states[sc->powernow_max_states - 2].fid < 8))
858 return (EINVAL);
843 break;
844 case PN8_TYPE:
845 sc->vst = ACPI_PN8_CTRL_TO_VST(ctrl),
846 sc->mvs = ACPI_PN8_CTRL_TO_MVS(ctrl),
847 sc->pll = ACPI_PN8_CTRL_TO_PLL(ctrl),
848 sc->rvo = ACPI_PN8_CTRL_TO_RVO(ctrl),
849 sc->irt = ACPI_PN8_CTRL_TO_IRT(ctrl);
850 sc->low = 0; /* XXX */
851
852 /*
853 * powernow k8 supports only one low frequency.
854 */
855 if (sc->powernow_max_states >= 2 &&
856 (sc->powernow_states[sc->powernow_max_states - 2].fid < 8))
857 return (EINVAL);
858 sc->fsb = state.freq / 100 / pn8_fid_to_mult[state.fid];
859 break;
860 }
861
862 return (0);
863}
864
865static void
866pn_identify(driver_t *driver, device_t parent)

--- 104 unchanged lines hidden ---
859 break;
860 }
861
862 return (0);
863}
864
865static void
866pn_identify(driver_t *driver, device_t parent)

--- 104 unchanged lines hidden ---