Skip to content

Commit 52af99c

Browse files
committed
ACPI: processor: Get rid of ACPICA message printing
The ACPI_DEBUG_PRINT() and ACPI_EXCEPTION() macros are used for message printing in the ACPICA code and they should not be used elsewhere. Special configuration (either kernel command line or sysfs-based) is needed to see the messages printed by them and the format of those messages is also special and convoluted. For this reason, replace all of the ACPI_DEBUG_PRINT() and ACPI_EXCEPTION() instances in the ACPI processor driver with corresponding dev_*(), acpi_handle_*() and pr_*() calls depending on the context in which they appear. Also drop the ACPI_PROCESSOR_COMPONENT definition that is not going to be necessary any more. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Hanjun Guo <guohanjun@huawei.com>
1 parent 54e0519 commit 52af99c

9 files changed

Lines changed: 108 additions & 126 deletions

File tree

Documentation/firmware-guide/acpi/debug.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ shows the supported mask values, currently these::
5858
ACPI_CONTAINER_COMPONENT 0x01000000
5959
ACPI_SYSTEM_COMPONENT 0x02000000
6060
ACPI_MEMORY_DEVICE_COMPONENT 0x08000000
61-
ACPI_PROCESSOR_COMPONENT 0x20000000
6261

6362
debug_level
6463
===========

drivers/acpi/acpi_processor.c

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@
2222

2323
#include "internal.h"
2424

25-
#define _COMPONENT ACPI_PROCESSOR_COMPONENT
26-
27-
ACPI_MODULE_NAME("processor");
28-
2925
DEFINE_PER_CPU(struct acpi_processor *, processors);
3026
EXPORT_PER_CPU_SYMBOL(processors);
3127

@@ -51,19 +47,19 @@ static int acpi_processor_errata_piix4(struct pci_dev *dev)
5147

5248
switch (dev->revision) {
5349
case 0:
54-
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found PIIX4 A-step\n"));
50+
dev_dbg(&dev->dev, "Found PIIX4 A-step\n");
5551
break;
5652
case 1:
57-
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found PIIX4 B-step\n"));
53+
dev_dbg(&dev->dev, "Found PIIX4 B-step\n");
5854
break;
5955
case 2:
60-
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found PIIX4E\n"));
56+
dev_dbg(&dev->dev, "Found PIIX4E\n");
6157
break;
6258
case 3:
63-
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found PIIX4M\n"));
59+
dev_dbg(&dev->dev, "Found PIIX4M\n");
6460
break;
6561
default:
66-
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found unknown PIIX4\n"));
62+
dev_dbg(&dev->dev, "Found unknown PIIX4\n");
6763
break;
6864
}
6965

@@ -129,11 +125,9 @@ static int acpi_processor_errata_piix4(struct pci_dev *dev)
129125
}
130126

131127
if (errata.piix4.bmisx)
132-
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
133-
"Bus master activity detection (BM-IDE) erratum enabled\n"));
128+
dev_dbg(&dev->dev, "Bus master activity detection (BM-IDE) erratum enabled\n");
134129
if (errata.piix4.fdma)
135-
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
136-
"Type-F DMA livelock erratum (C3 disabled)\n"));
130+
dev_dbg(&dev->dev, "Type-F DMA livelock erratum (C3 disabled)\n");
137131

138132
return 0;
139133
}
@@ -244,11 +238,9 @@ static int acpi_processor_get_info(struct acpi_device *device)
244238
*/
245239
if (acpi_gbl_FADT.pm2_control_block && acpi_gbl_FADT.pm2_control_length) {
246240
pr->flags.bm_control = 1;
247-
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
248-
"Bus mastering arbitration control present\n"));
241+
dev_dbg(&device->dev, "Bus mastering arbitration control present\n");
249242
} else
250-
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
251-
"No bus mastering arbitration control\n"));
243+
dev_dbg(&device->dev, "No bus mastering arbitration control\n");
252244

253245
if (!strcmp(acpi_device_hid(device), ACPI_PROCESSOR_OBJECT_HID)) {
254246
/* Declared with "Processor" statement; match ProcessorID */
@@ -291,7 +283,7 @@ static int acpi_processor_get_info(struct acpi_device *device)
291283
pr->phys_id = acpi_get_phys_id(pr->handle, device_declaration,
292284
pr->acpi_id);
293285
if (invalid_phys_cpuid(pr->phys_id))
294-
acpi_handle_debug(pr->handle, "failed to get CPU physical ID.\n");
286+
dev_dbg(&device->dev, "Failed to get CPU physical ID.\n");
295287

296288
pr->id = acpi_map_cpuid(pr->phys_id, pr->acpi_id);
297289
if (!cpu0_initialized && !acpi_has_cpu_in_madt()) {
@@ -328,11 +320,10 @@ static int acpi_processor_get_info(struct acpi_device *device)
328320
* CPU+CPU ID.
329321
*/
330322
sprintf(acpi_device_bid(device), "CPU%X", pr->id);
331-
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Processor [%d:%d]\n", pr->id,
332-
pr->acpi_id));
323+
dev_dbg(&device->dev, "Processor [%d:%d]\n", pr->id, pr->acpi_id);
333324

334325
if (!object.processor.pblk_address)
335-
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No PBLK (NULL address)\n"));
326+
dev_dbg(&device->dev, "No PBLK (NULL address)\n");
336327
else if (object.processor.pblk_length != 6)
337328
dev_err(&device->dev, "Invalid PBLK length [%d]\n",
338329
object.processor.pblk_length);

drivers/acpi/processor_driver.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@
2828
#define ACPI_PROCESSOR_NOTIFY_POWER 0x81
2929
#define ACPI_PROCESSOR_NOTIFY_THROTTLING 0x82
3030

31-
#define _COMPONENT ACPI_PROCESSOR_COMPONENT
32-
ACPI_MODULE_NAME("processor_driver");
33-
3431
MODULE_AUTHOR("Paul Diefenbaugh");
3532
MODULE_DESCRIPTION("ACPI Processor Driver");
3633
MODULE_LICENSE("GPL");
@@ -87,8 +84,7 @@ static void acpi_processor_notify(acpi_handle handle, u32 event, void *data)
8784
dev_name(&device->dev), event, 0);
8885
break;
8986
default:
90-
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
91-
"Unsupported event [0x%x]\n", event));
87+
acpi_handle_debug(handle, "Unsupported event [0x%x]\n", event);
9288
break;
9389
}
9490

drivers/acpi/processor_idle.c

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@
3131
#include <asm/apic.h>
3232
#endif
3333

34-
#define _COMPONENT ACPI_PROCESSOR_COMPONENT
35-
ACPI_MODULE_NAME("processor_idle");
36-
3734
#define ACPI_IDLE_STATE_START (IS_ENABLED(CONFIG_ARCH_HAS_CPU_RELAX) ? 1 : 0)
3835

3936
static unsigned int max_cstate __read_mostly = ACPI_PROCESSOR_MAX_POWER;
@@ -239,8 +236,8 @@ static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr)
239236
* 100 microseconds.
240237
*/
241238
if (acpi_gbl_FADT.c2_latency > ACPI_PROCESSOR_MAX_C2_LATENCY) {
242-
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
243-
"C2 latency too large [%d]\n", acpi_gbl_FADT.c2_latency));
239+
acpi_handle_debug(pr->handle, "C2 latency too large [%d]\n",
240+
acpi_gbl_FADT.c2_latency);
244241
/* invalidate C2 */
245242
pr->power.states[ACPI_STATE_C2].address = 0;
246243
}
@@ -250,16 +247,15 @@ static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr)
250247
* 1000 microseconds.
251248
*/
252249
if (acpi_gbl_FADT.c3_latency > ACPI_PROCESSOR_MAX_C3_LATENCY) {
253-
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
254-
"C3 latency too large [%d]\n", acpi_gbl_FADT.c3_latency));
250+
acpi_handle_debug(pr->handle, "C3 latency too large [%d]\n",
251+
acpi_gbl_FADT.c3_latency);
255252
/* invalidate C3 */
256253
pr->power.states[ACPI_STATE_C3].address = 0;
257254
}
258255

259-
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
260-
"lvl2[0x%08x] lvl3[0x%08x]\n",
256+
acpi_handle_debug(pr->handle, "lvl2[0x%08x] lvl3[0x%08x]\n",
261257
pr->power.states[ACPI_STATE_C2].address,
262-
pr->power.states[ACPI_STATE_C3].address));
258+
pr->power.states[ACPI_STATE_C3].address);
263259

264260
snprintf(pr->power.states[ACPI_STATE_C2].desc,
265261
ACPI_CX_DESC_LEN, "ACPI P_LVL2 IOPORT 0x%x",
@@ -324,8 +320,8 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr,
324320
* devices thus we take the conservative approach.
325321
*/
326322
else if (errata.piix4.fdma) {
327-
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
328-
"C3 not supported on PIIX4 with Type-F DMA\n"));
323+
acpi_handle_debug(pr->handle,
324+
"C3 not supported on PIIX4 with Type-F DMA\n");
329325
return;
330326
}
331327

@@ -344,13 +340,13 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr,
344340
if (!pr->flags.bm_control) {
345341
if (pr->flags.has_cst != 1) {
346342
/* bus mastering control is necessary */
347-
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
348-
"C3 support requires BM control\n"));
343+
acpi_handle_debug(pr->handle,
344+
"C3 support requires BM control\n");
349345
return;
350346
} else {
351347
/* Here we enter C3 without bus mastering */
352-
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
353-
"C3 support without BM control\n"));
348+
acpi_handle_debug(pr->handle,
349+
"C3 support without BM control\n");
354350
}
355351
}
356352
} else {
@@ -359,9 +355,9 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr,
359355
* supported on when bm_check is not required.
360356
*/
361357
if (!(acpi_gbl_FADT.flags & ACPI_FADT_WBINVD)) {
362-
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
358+
acpi_handle_debug(pr->handle,
363359
"Cache invalidation should work properly"
364-
" for C3 to be enabled on SMP systems\n"));
360+
" for C3 to be enabled on SMP systems\n");
365361
return;
366362
}
367363
}
@@ -843,7 +839,7 @@ static int acpi_processor_evaluate_lpi(acpi_handle handle,
843839

844840
status = acpi_evaluate_object(handle, "_LPI", NULL, &buffer);
845841
if (ACPI_FAILURE(status)) {
846-
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No _LPI, giving up\n"));
842+
acpi_handle_debug(handle, "No _LPI, giving up\n");
847843
return -ENODEV;
848844
}
849845

drivers/acpi/processor_pdc.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@
1616

1717
#include "internal.h"
1818

19-
#define _COMPONENT ACPI_PROCESSOR_COMPONENT
20-
ACPI_MODULE_NAME("processor_pdc");
21-
2219
static bool __init processor_physically_present(acpi_handle handle)
2320
{
2421
int cpuid, type;
@@ -132,8 +129,8 @@ acpi_processor_eval_pdc(acpi_handle handle, struct acpi_object_list *pdc_in)
132129
status = acpi_evaluate_object(handle, "_PDC", pdc_in, NULL);
133130

134131
if (ACPI_FAILURE(status))
135-
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
136-
"Could not evaluate _PDC, using legacy perf. control.\n"));
132+
acpi_handle_debug(handle,
133+
"Could not evaluate _PDC, using legacy perf control\n");
137134

138135
return status;
139136
}

drivers/acpi/processor_perflib.c

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
#define PREFIX "ACPI: "
2424

2525
#define ACPI_PROCESSOR_FILE_PERFORMANCE "performance"
26-
#define _COMPONENT ACPI_PROCESSOR_COMPONENT
27-
ACPI_MODULE_NAME("processor_perflib");
2826

2927
static DEFINE_MUTEX(performance_mutex);
3028

@@ -70,7 +68,8 @@ static int acpi_processor_get_platform_limit(struct acpi_processor *pr)
7068
acpi_processor_ppc_in_use = true;
7169

7270
if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
73-
ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PPC"));
71+
acpi_handle_warn(pr->handle, "_PPC evaluation failed: %s\n",
72+
acpi_format_exception(status));
7473
return -ENODEV;
7574
}
7675

@@ -199,7 +198,8 @@ static int acpi_processor_get_performance_control(struct acpi_processor *pr)
199198

200199
status = acpi_evaluate_object(pr->handle, "_PCT", NULL, &buffer);
201200
if (ACPI_FAILURE(status)) {
202-
ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PCT"));
201+
acpi_handle_warn(pr->handle, "_PCT evaluation failed: %s\n",
202+
acpi_format_exception(status));
203203
return -ENODEV;
204204
}
205205

@@ -299,7 +299,8 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr)
299299

300300
status = acpi_evaluate_object(pr->handle, "_PSS", NULL, &buffer);
301301
if (ACPI_FAILURE(status)) {
302-
ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PSS"));
302+
acpi_handle_warn(pr->handle, "_PSS evaluation failed: %s\n",
303+
acpi_format_exception(status));
303304
return -ENODEV;
304305
}
305306

@@ -310,8 +311,8 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr)
310311
goto end;
311312
}
312313

313-
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d performance states\n",
314-
pss->package.count));
314+
acpi_handle_debug(pr->handle, "Found %d performance states\n",
315+
pss->package.count);
315316

316317
pr->performance->state_count = pss->package.count;
317318
pr->performance->states =
@@ -330,27 +331,28 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr)
330331
state.length = sizeof(struct acpi_processor_px);
331332
state.pointer = px;
332333

333-
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Extracting state %d\n", i));
334+
acpi_handle_debug(pr->handle, "Extracting state %d\n", i);
334335

335336
status = acpi_extract_package(&(pss->package.elements[i]),
336337
&format, &state);
337338
if (ACPI_FAILURE(status)) {
338-
ACPI_EXCEPTION((AE_INFO, status, "Invalid _PSS data"));
339+
acpi_handle_warn(pr->handle, "Invalid _PSS data: %s\n",
340+
acpi_format_exception(status));
339341
result = -EFAULT;
340342
kfree(pr->performance->states);
341343
goto end;
342344
}
343345

344346
amd_fixup_frequency(px, i);
345347

346-
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
348+
acpi_handle_debug(pr->handle,
347349
"State [%d]: core_frequency[%d] power[%d] transition_latency[%d] bus_master_latency[%d] control[0x%x] status[0x%x]\n",
348350
i,
349351
(u32) px->core_frequency,
350352
(u32) px->power,
351353
(u32) px->transition_latency,
352354
(u32) px->bus_master_latency,
353-
(u32) px->control, (u32) px->status));
355+
(u32) px->control, (u32) px->status);
354356

355357
/*
356358
* Check that ACPI's u64 MHz will be valid as u32 KHz in cpufreq
@@ -400,8 +402,8 @@ int acpi_processor_get_performance_info(struct acpi_processor *pr)
400402
return -EINVAL;
401403

402404
if (!acpi_has_method(pr->handle, "_PCT")) {
403-
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
404-
"ACPI-based processor performance control unavailable\n"));
405+
acpi_handle_debug(pr->handle,
406+
"ACPI-based processor performance control unavailable\n");
405407
return -ENODEV;
406408
}
407409

@@ -442,18 +444,17 @@ int acpi_processor_pstate_control(void)
442444
if (!acpi_gbl_FADT.smi_command || !acpi_gbl_FADT.pstate_control)
443445
return 0;
444446

445-
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
446-
"Writing pstate_control [0x%x] to smi_command [0x%x]\n",
447-
acpi_gbl_FADT.pstate_control, acpi_gbl_FADT.smi_command));
447+
pr_debug("Writing pstate_control [0x%x] to smi_command [0x%x]\n",
448+
acpi_gbl_FADT.pstate_control, acpi_gbl_FADT.smi_command);
448449

449450
status = acpi_os_write_port(acpi_gbl_FADT.smi_command,
450451
(u32)acpi_gbl_FADT.pstate_control, 8);
451452
if (ACPI_SUCCESS(status))
452453
return 1;
453454

454-
ACPI_EXCEPTION((AE_INFO, status,
455-
"Failed to write pstate_control [0x%x] to smi_command [0x%x]",
456-
acpi_gbl_FADT.pstate_control, acpi_gbl_FADT.smi_command));
455+
pr_warn("Failed to write pstate_control [0x%x] to smi_command [0x%x]: %s\n",
456+
acpi_gbl_FADT.pstate_control, acpi_gbl_FADT.smi_command,
457+
acpi_format_exception(status));
457458
return -EIO;
458459
}
459460

@@ -485,7 +486,7 @@ int acpi_processor_notify_smm(struct module *calling_module)
485486

486487
result = acpi_processor_pstate_control();
487488
if (!result) {
488-
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No SMI port or pstate_control\n"));
489+
pr_debug("No SMI port or pstate_control\n");
489490
module_put(calling_module);
490491
return 0;
491492
}

0 commit comments

Comments
 (0)