Deleted Added
full compact
est.c (219046) est.c (220433)
1/*-
2 * Copyright (c) 2004 Colin Percival
3 * Copyright (c) 2005 Nate Lawson
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted providing that the following conditions
8 * are met:

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

21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
23 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
24 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 * POSSIBILITY OF SUCH DAMAGE.
26 */
27
28#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2004 Colin Percival
3 * Copyright (c) 2005 Nate Lawson
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted providing that the following conditions
8 * are met:

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

21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
23 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
24 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 * POSSIBILITY OF SUCH DAMAGE.
26 */
27
28#include <sys/cdefs.h>
29__FBSDID("$FreeBSD: head/sys/x86/cpufreq/est.c 219046 2011-02-25 23:14:24Z jkim $");
29__FBSDID("$FreeBSD: head/sys/x86/cpufreq/est.c 220433 2011-04-07 23:28:28Z jkim $");
30
31#include <sys/param.h>
32#include <sys/bus.h>
33#include <sys/cpu.h>
34#include <sys/kernel.h>
35#include <sys/malloc.h>
36#include <sys/module.h>
37#include <sys/smp.h>

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

1210 freq_info *fp;
1211 int bus, freq, volts;
1212 uint16_t id;
1213
1214 if (!msr_info_enabled)
1215 return (EOPNOTSUPP);
1216
1217 /* Figure out the bus clock. */
30
31#include <sys/param.h>
32#include <sys/bus.h>
33#include <sys/cpu.h>
34#include <sys/kernel.h>
35#include <sys/malloc.h>
36#include <sys/module.h>
37#include <sys/smp.h>

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

1210 freq_info *fp;
1211 int bus, freq, volts;
1212 uint16_t id;
1213
1214 if (!msr_info_enabled)
1215 return (EOPNOTSUPP);
1216
1217 /* Figure out the bus clock. */
1218 freq = tsc_freq / 1000000;
1218 freq = atomic_load_acq_64(&tsc_freq) / 1000000;
1219 id = msr >> 32;
1220 bus = freq / (id >> 8);
1221 device_printf(dev, "Guessed bus clock (high) of %d MHz\n", bus);
1222 if (!bus_speed_ok(bus)) {
1223 /* We may be running on the low frequency. */
1224 id = msr >> 48;
1225 bus = freq / (id >> 8);
1226 device_printf(dev, "Guessed bus clock (low) of %d MHz\n", bus);

--- 176 unchanged lines hidden ---
1219 id = msr >> 32;
1220 bus = freq / (id >> 8);
1221 device_printf(dev, "Guessed bus clock (high) of %d MHz\n", bus);
1222 if (!bus_speed_ok(bus)) {
1223 /* We may be running on the low frequency. */
1224 id = msr >> 48;
1225 bus = freq / (id >> 8);
1226 device_printf(dev, "Guessed bus clock (low) of %d MHz\n", bus);

--- 176 unchanged lines hidden ---