Project

General

Profile

Bug #557 » acpi-test-2.diff

qhwt+dfly, 02/24/2007 02:51 PM

View differences:

acpi_cpu.c 24 Feb 2007 11:07:43 -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];
......
196 201
	return (ENXIO);
197 202

  
198 203
    handle = acpi_get_handle(dev);
204
DEBUG_KNOB(1);
199 205
    if (cpu_softc == NULL)
200 206
	cpu_softc = kmalloc(sizeof(struct acpi_cpu_softc *) *
201 207
	    SMP_MAXCPU, M_TEMP /* XXX */, M_INTWAIT | M_ZERO);
202

  
208
DEBUG_KNOB(2);
203 209
    /* Get our Processor object. */
204 210
    buf.Pointer = NULL;
205 211
    buf.Length = ACPI_ALLOCATE_BUFFER;
206 212
    status = AcpiEvaluateObject(handle, NULL, NULL, &buf);
213
DEBUG_KNOB(3);
207 214
    if (ACPI_FAILURE(status)) {
208 215
	device_printf(dev, "probe failed to get Processor obj - %s\n",
209 216
		      AcpiFormatException(status));
......
221 228
     * ProcId as a key, however, some boxes do not have the same values
222 229
     * in their Processor object as the ProcId values in the MADT.
223 230
     */
224
    acpi_id = obj->Processor.ProcId;
231
    acpi_id = proc_id = obj->Processor.ProcId;
225 232
    AcpiOsFree(obj);
226
    if (acpi_pcpu_get_id(device_get_unit(dev), &acpi_id, &cpu_id) != 0)
233
DEBUG_KNOB(4);
234
    if (acpi_pcpu_get_id(device_get_unit(dev), &acpi_id, &cpu_id) != 0) {
235
	if (bootverbose)
236
	    device_printf(dev, "ProcId %d: can't find cpu_id\n", proc_id);
227 237
	return (ENXIO);
228

  
238
    }
239
    if (bootverbose) {
240
	device_printf(dev, "ProcId %d: acpi_id=%d, cpu_id=%d\n", proc_id,
241
		      acpi_id, cpu_id);
242
    }
229 243
    /*
230 244
     * Check if we already probed this processor.  We scan the bus twice
231 245
     * so it's possible we've already seen this one.
232 246
     */
233 247
    if (cpu_softc[cpu_id] != NULL)
234 248
	return (ENXIO);
235

  
249
DEBUG_KNOB(5);
236 250
    /* Get a count of Cx states for our device string. */
237 251
    cx_count = 0;
238 252
    buf.Pointer = NULL;
......
263 277

  
264 278
    return (0);
265 279
}
280
#undef DEBUG_KNOB
266 281

  
267 282
static int
268 283
acpi_cpu_attach(device_t dev)
(5-5/8)