View | Details | Raw Unified | Return to bug 145718 | Differences between
and this patch

Collapse All | Expand All

(-)est.c (-3 / +13 lines)
Lines 1192-1197 Link Here
1192
	switch (bus) {
1192
	switch (bus) {
1193
	case 100:
1193
	case 100:
1194
	case 133:
1194
	case 133:
1195
	case 166:
1196
	case 267:
1195
	case 333:
1197
	case 333:
1196
		return (1);
1198
		return (1);
1197
	default:
1199
	default:
Lines 1217-1228 Link Here
1217
	/* Figure out the bus clock. */
1219
	/* Figure out the bus clock. */
1218
	freq = atomic_load_acq_64(&tsc_freq) / 1000000;
1220
	freq = atomic_load_acq_64(&tsc_freq) / 1000000;
1219
	id = msr >> 32;
1221
	id = msr >> 32;
1220
	bus = freq / (id >> 8);
1222
	bus = (freq + (id >> 9)) / (id >> 8);
1223
	if( id & 0x4000 )
1224
	  bus = 2 * freq / ( (id >> 7 & 0x7e) + 1 );
1221
	device_printf(dev, "Guessed bus clock (high) of %d MHz\n", bus);
1225
	device_printf(dev, "Guessed bus clock (high) of %d MHz\n", bus);
1222
	if (!bus_speed_ok(bus)) {
1226
	if (!bus_speed_ok(bus)) {
1223
		/* We may be running on the low frequency. */
1227
		/* We may be running on the low frequency. */
1224
		id = msr >> 48;
1228
		id = msr >> 48;
1225
		bus = freq / (id >> 8);
1229
		bus = freq / (id >> 8);
1230
		if( id & 0x4000 )
1231
		  bus = 2 * freq / ( (id >> 7 & 0x7e) + 1 );
1226
		device_printf(dev, "Guessed bus clock (low) of %d MHz\n", bus);
1232
		device_printf(dev, "Guessed bus clock (low) of %d MHz\n", bus);
1227
		if (!bus_speed_ok(bus))
1233
		if (!bus_speed_ok(bus))
1228
			return (EOPNOTSUPP);
1234
			return (EOPNOTSUPP);
Lines 1230-1235 Link Here
1230
		/* Calculate high frequency. */
1236
		/* Calculate high frequency. */
1231
		id = msr >> 32;
1237
		id = msr >> 32;
1232
		freq = ((id >> 8) & 0xff) * bus;
1238
		freq = ((id >> 8) & 0xff) * bus;
1239
		if( id & 0x4000 )
1240
		  freq =( (id >> 7 & 0x7e) + 1 ) * bus / 2;
1233
	}
1241
	}
1234
1242
1235
	/* Fill out a new freq table containing just the high and low freqs. */
1243
	/* Fill out a new freq table containing just the high and low freqs. */
Lines 1246-1257 Link Here
1246
	fp[0].volts = volts;
1254
	fp[0].volts = volts;
1247
	fp[0].id16 = id;
1255
	fp[0].id16 = id;
1248
	fp[0].power = CPUFREQ_VAL_UNKNOWN;
1256
	fp[0].power = CPUFREQ_VAL_UNKNOWN;
1249
	device_printf(dev, "Guessed high setting of %d MHz @ %d Mv\n", freq,
1257
	device_printf(dev, "Guessed high setting of %d MHz @ %d mV\n", freq,
1250
	    volts);
1258
	    volts);
1251
1259
1252
	/* Second, the low frequency. */
1260
	/* Second, the low frequency. */
1253
	id = msr >> 48;
1261
	id = msr >> 48;
1254
	freq = ((id >> 8) & 0xff) * bus;
1262
	freq = ((id >> 8) & 0xff) * bus;
1263
	if( id & 0x4000 )
1264
	  freq =( (id >> 7 & 0x7e) + 1 ) * bus / 2;
1255
	volts = id & 0xff;
1265
	volts = id & 0xff;
1256
	if (volts != 0) {
1266
	if (volts != 0) {
1257
		volts <<= 4;
1267
		volts <<= 4;
Lines 1261-1267 Link Here
1261
	fp[1].volts = volts;
1271
	fp[1].volts = volts;
1262
	fp[1].id16 = id;
1272
	fp[1].id16 = id;
1263
	fp[1].power = CPUFREQ_VAL_UNKNOWN;
1273
	fp[1].power = CPUFREQ_VAL_UNKNOWN;
1264
	device_printf(dev, "Guessed low setting of %d MHz @ %d Mv\n", freq,
1274
	device_printf(dev, "Guessed low setting of %d MHz @ %d mV\n", freq,
1265
	    volts);
1275
	    volts);
1266
1276
1267
	/* Table is already terminated due to M_ZERO. */
1277
	/* Table is already terminated due to M_ZERO. */

Return to bug 145718