Project

General

Profile

Bug #557 » acpi-test-4.diff

qhwt+dfly, 03/06/2007 12:42 PM

View differences:

acpi_cpu.c 4 Mar 2007 16:51:20 -0000
182 182
DRIVER_MODULE(cpu, acpi, acpi_cpu_driver, acpi_cpu_devclass, 0, 0);
183 183
MODULE_DEPEND(cpu, acpi, 1, 1, 1);
184 184

  
185
static int acpi_cpu_probe_debug_knob = 0;
186
TUNABLE_INT("debug.acpi.cpu.knob", &acpi_cpu_probe_debug_knob);
187
#define DEBUG_KNOB(n)	\
188
    if (acpi_cpu_probe_debug_knob == (n)) return(ENXIO)
189

  
185 190
static int
186 191
acpi_cpu_probe(device_t dev)
187 192
{
188
    int			   acpi_id, cpu_id, cx_count;
193
    int			   acpi_id, cpu_id, proc_id, cx_count;
189 194
    ACPI_BUFFER		   buf;
190 195
    ACPI_HANDLE		   handle;
191 196
    char		   msg[32];
......
221 226
     * ProcId as a key, however, some boxes do not have the same values
222 227
     * in their Processor object as the ProcId values in the MADT.
223 228
     */
224
    acpi_id = obj->Processor.ProcId;
229
    acpi_id = proc_id = obj->Processor.ProcId;
225 230
    AcpiOsFree(obj);
226
    if (acpi_pcpu_get_id(device_get_unit(dev), &acpi_id, &cpu_id) != 0)
231
    if (acpi_pcpu_get_id(device_get_unit(dev), &acpi_id, &cpu_id) != 0) {
232
	if (bootverbose)
233
	    device_printf(dev, "ProcId %d: can't find cpu_id\n", proc_id);
227 234
	return (ENXIO);
228

  
235
    }
236
    if (bootverbose) {
237
	device_printf(dev, "ProcId %d: acpi_id=%d, cpu_id=%d\n", proc_id,
238
		      acpi_id, cpu_id);
239
    }
229 240
    /*
230 241
     * Check if we already probed this processor.  We scan the bus twice
231 242
     * so it's possible we've already seen this one.
......
313 324
     * Probe for throttling and Cx state support.
314 325
     * If none of these is present, free up unused resources.
315 326
     */
327
DEBUG_KNOB(1);
316 328
    thr_ret = acpi_cpu_throttle_probe(sc);
329
DEBUG_KNOB(2);
317 330
    cx_ret = acpi_cpu_cx_probe(sc);
331
DEBUG_KNOB(3);
318 332
    if (thr_ret == 0 || cx_ret == 0) {
319 333
	status = AcpiInstallNotifyHandler(sc->cpu_handle, ACPI_DEVICE_NOTIFY,
320 334
					  acpi_cpu_notify, sc);
335
DEBUG_KNOB(4);
321 336
	if (device_get_unit(dev) == 0)
322 337
	    AcpiOsExecute(OSL_NOTIFY_HANDLER, acpi_cpu_startup, NULL);
323 338
    } else {
324 339
	sysctl_ctx_free(&acpi_cpu_sysctl_ctx);
325 340
    }
341
DEBUG_KNOB(5);
326 342

  
327 343
    return_VALUE (0);
328 344
}
345
#undef DEBUG_KNOB
329 346

  
330 347
/*
331 348
 * Find the nth present CPU and return its pc_cpuid as well as set the
(8-8/8)