Skip to content
Permalink
Browse files

Fully deploy ACPI_PRINTF_LIKE macro

Macro was not being used across all "printf-like" functions.
Also, cleanup all calls to such functions now that they are
analyzed by the compiler (gcc). Both in 32-bit mode and 64-bit
mode.
  • Loading branch information...
acpibob committed Aug 14, 2019
1 parent 46a6574 commit d06def132a8852d02c9c7fee60f17b2011066e8e
@@ -871,7 +871,7 @@ AcpiDmDumpMcfg (
if (Offset + sizeof (ACPI_MCFG_ALLOCATION) > Table->Length)
{
AcpiOsPrintf ("Warning: there are %u invalid trailing bytes\n",
sizeof (ACPI_MCFG_ALLOCATION) - (Offset - Table->Length));
(UINT32) sizeof (ACPI_MCFG_ALLOCATION) - (Offset - Table->Length));
return;
}

@@ -421,7 +421,7 @@ UtDeleteLocalCaches (
DbgPrint (ASL_DEBUG_OUTPUT,
"%u ParseOps, Buffer size: %u ops (%u bytes), %u Buffers\n",
AslGbl_ParseOpCount, ASL_PARSEOP_CACHE_SIZE,
(sizeof (ACPI_PARSE_OBJECT) * ASL_PARSEOP_CACHE_SIZE), BufferCount);
((UINT32) sizeof (ACPI_PARSE_OBJECT) * ASL_PARSEOP_CACHE_SIZE), BufferCount);

/* Reset cache globals */

@@ -445,7 +445,7 @@ UtDeleteLocalCaches (
DbgPrint (ASL_DEBUG_OUTPUT,
"%u Fields, Buffer size: %u fields (%u bytes), %u Buffers\n",
AslGbl_FieldCount, ASL_FIELD_CACHE_SIZE,
(sizeof (DT_FIELD) * ASL_FIELD_CACHE_SIZE), BufferCount);
((UINT32) sizeof (DT_FIELD) * ASL_FIELD_CACHE_SIZE), BufferCount);

/* Reset cache globals */

@@ -468,7 +468,7 @@ UtDeleteLocalCaches (
DbgPrint (ASL_DEBUG_OUTPUT,
"%u Subtables, Buffer size: %u subtables (%u bytes), %u Buffers\n",
AslGbl_SubtableCount, ASL_SUBTABLE_CACHE_SIZE,
(sizeof (DT_SUBTABLE) * ASL_SUBTABLE_CACHE_SIZE), BufferCount);
((UINT32) sizeof (DT_SUBTABLE) * ASL_SUBTABLE_CACHE_SIZE), BufferCount);

/* Reset cache globals */

@@ -618,8 +618,8 @@ CgWriteTableHeader (
Op->Asl.AmlSubtreeLength +=
strlen (AslGbl_ParseTreeRoot->Asl.Filename) + 3;

CvDbgPrint (" Length: %lu\n",
strlen (AslGbl_ParseTreeRoot->Asl.Filename) + 3);
CvDbgPrint (" Length: %u\n",
(UINT32) strlen (AslGbl_ParseTreeRoot->Asl.Filename) + 3);

if (Op->Asl.CommentList)
{
@@ -1052,6 +1052,7 @@ void
FlCloseFile (
UINT32 FileId);

ACPI_PRINTF_LIKE (2)
void
FlPrintFile (
UINT32 FileId,
@@ -1195,6 +1196,7 @@ OtXrefWalkPart1 (
/*
* aslutils - common compiler utilities
*/
ACPI_PRINTF_LIKE(2)
void
DbgPrint (
UINT32 Type,
@@ -1612,6 +1614,7 @@ DtCreateTemplates (
/*
* ASL/ASL+ converter debug
*/
ACPI_PRINTF_LIKE (1)
void
CvDbgPrint (
char *Fmt,
@@ -239,7 +239,7 @@ UtDumpIntegerOp (
case 8: /* Dword */

DbgPrint (ASL_TREE_OUTPUT,
"%*.*X", IntegerLength, IntegerLength, Op->Asl.Value.Integer);
"%*.*X", IntegerLength, IntegerLength, (UINT32) Op->Asl.Value.Integer);
break;

case 16: /* Qword and Integer */
@@ -290,7 +290,7 @@

#define ASL_PARSE_TREE_DEBUG2 \
" %08X %04X %04X %01X %04X %04X %05X %05X "\
"%08p %08p %08p %08p %08X %08X %04X %02d %5d %5d %5d %5d"
"%8p %8p %8p %8p %08X %08X %04X %02d %5d %5d %5d %5d"

/*
* Macros for ASL/ASL+ converter
@@ -241,7 +241,7 @@ LsDumpAsciiInComment (
{
/* Insert a space to break the sequence */

FlPrintFile (FileId, ".", BufChar);
FlPrintFile (FileId, " ");
}

FlPrintFile (FileId, "%c", BufChar);
@@ -276,7 +276,7 @@ NsDoOneNamespaceObject (

FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "%5u [%u] %*s %4.4s - %s",
AslGbl_NumNamespaceObjects, Level, (Level * 3), " ",
&Node->Name.Ascii, AcpiUtGetTypeName (Node->Type));
&Node->Name.Ascii[0], AcpiUtGetTypeName (Node->Type));

Op = Node->Op;
ObjDesc = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Node->Object);
@@ -531,7 +531,8 @@ NsDoOnePathname (
return (Status);
}

FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "%s\n", TargetPath.Pointer);
FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "%s\n",
ACPI_CAST_PTR (char, TargetPath.Pointer));
ACPI_FREE (TargetPath.Pointer);
return (AE_OK);
}
@@ -403,22 +403,22 @@ TrCreateValuedLeafOp (
{
case PARSEOP_STRING_LITERAL:

DbgPrint (ASL_PARSE_OUTPUT, "STRING->%s", Value);
DbgPrint (ASL_PARSE_OUTPUT, "STRING->%s", Op->Asl.Value.String);
break;

case PARSEOP_NAMESEG:

DbgPrint (ASL_PARSE_OUTPUT, "NAMESEG->%s", Value);
DbgPrint (ASL_PARSE_OUTPUT, "NAMESEG->%s", Op->Asl.Value.String);
break;

case PARSEOP_NAMESTRING:

DbgPrint (ASL_PARSE_OUTPUT, "NAMESTRING->%s", Value);
DbgPrint (ASL_PARSE_OUTPUT, "NAMESTRING->%s", Op->Asl.Value.String);
break;

case PARSEOP_EISAID:

DbgPrint (ASL_PARSE_OUTPUT, "EISAID->%s", Value);
DbgPrint (ASL_PARSE_OUTPUT, "EISAID->%s", Op->Asl.Value.String);
break;

case PARSEOP_METHOD:
@@ -799,7 +799,7 @@ OtXrefWalkPart3 (
else
{
FlPrintFile (ASL_FILE_XREF_OUTPUT,
" %u references to this object in this module\n",
" %u references to this object in this module [%s]\n",
XrefInfo->ThisObjectReferences, ParentPath);
}

@@ -1170,7 +1170,7 @@ DtDumpSubtableInfo (
{

DbgPrint (ASL_DEBUG_OUTPUT,
"[%.04X] %24s %.08X %.08X %.08X %.08X %.08X %p %p %p\n",
"[%.04X] %24s %.08X %.08X %.08X %.08X %p %p %p %p\n",
Subtable->Depth, Subtable->Name, Subtable->Length, Subtable->TotalLength,
Subtable->SizeOfLengthField, Subtable->Flags, Subtable,
Subtable->Parent, Subtable->Child, Subtable->Peer);
@@ -1184,7 +1184,7 @@ DtDumpSubtableTree (
{

DbgPrint (ASL_DEBUG_OUTPUT,
"[%.04X] %24s %*s%08X (%.02X) - (%.02X)\n",
"[%.04X] %24s %*s%p (%.02X) - (%.02X)\n",
Subtable->Depth, Subtable->Name, (4 * Subtable->Depth), " ",
Subtable, Subtable->Length, Subtable->TotalLength);
}
@@ -1278,7 +1278,7 @@ DtWriteFieldToListing (
if (strlen (Field->Value) > 64)
{
FlPrintFile (ASL_FILE_LISTING_OUTPUT, "...Additional data, length 0x%X\n",
strlen (Field->Value));
(UINT32) strlen (Field->Value));
}

FlPrintFile (ASL_FILE_LISTING_OUTPUT, "\n");
@@ -509,7 +509,7 @@ DtCreateOneTemplate (
AcpiUtStrlwr (DisasmFilename);
if (!UtQueryForOverwrite (DisasmFilename))
{
return (AE_ERROR);
return (AE_OK);
}

File = fopen (DisasmFilename, "w+");
@@ -223,7 +223,7 @@ PrAddDefine (
DefineInfo = PrMatchDefine (Identifier);
if (DefineInfo)
{
DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID,
DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID
"#define: name already exists: %s\n",
AslGbl_CurrentLineNumber, Identifier);

@@ -850,7 +850,7 @@ PrDoDirective (

DbgPrint (ASL_PARSE_OUTPUT, PR_PREFIX_ID
"Start #include file \"%s\"\n", AslGbl_CurrentLineNumber,
Token, AslGbl_CurrentLineNumber);
Token);

PrDoIncludeFile (Token);
break;
@@ -1060,10 +1060,10 @@ AcpiDbCommandDispatch (
if (ParamCount == 0)
{
AcpiOsPrintf (
"Current debug level for file output is: %8.8lX\n",
"Current debug level for file output is: %8.8X\n",
AcpiGbl_DbDebugLevel);
AcpiOsPrintf (
"Current debug level for console output is: %8.8lX\n",
"Current debug level for console output is: %8.8X\n",
AcpiGbl_DbConsoleDebugLevel);
}
else if (ParamCount == 2)
@@ -1072,15 +1072,15 @@ AcpiDbCommandDispatch (
AcpiGbl_DbConsoleDebugLevel =
strtoul (AcpiGbl_DbArgs[1], NULL, 16);
AcpiOsPrintf (
"Debug Level for console output was %8.8lX, now %8.8lX\n",
"Debug Level for console output was %8.8X, now %8.8X\n",
Temp, AcpiGbl_DbConsoleDebugLevel);
}
else
{
Temp = AcpiGbl_DbDebugLevel;
AcpiGbl_DbDebugLevel = strtoul (AcpiGbl_DbArgs[1], NULL, 16);
AcpiOsPrintf (
"Debug Level for file output was %8.8lX, now %8.8lX\n",
"Debug Level for file output was %8.8X, now %8.8X\n",
Temp, AcpiGbl_DbDebugLevel);
}
break;
@@ -544,14 +544,14 @@ AcpiDbDisplayStatistics (

for (i = 0; i < ACPI_TYPE_NS_NODE_MAX; i++)
{
AcpiOsPrintf ("%16.16s % 10u% 10u\n", AcpiUtGetTypeName (i),
AcpiOsPrintf ("%16.16s %10u %10u\n", AcpiUtGetTypeName (i),
AcpiGbl_NodeTypeCount [i], AcpiGbl_ObjTypeCount [i]);
}

AcpiOsPrintf ("%16.16s % 10u% 10u\n", "Misc/Unknown",
AcpiOsPrintf ("%16.16s %10u %10u\n", "Misc/Unknown",
AcpiGbl_NodeTypeCountMisc, AcpiGbl_ObjTypeCountMisc);

AcpiOsPrintf ("%16.16s % 10u% 10u\n", "TOTALS:",
AcpiOsPrintf ("%16.16s %10u %10u\n", "TOTALS:",
AcpiGbl_NumNodes, AcpiGbl_NumObjects);
break;

@@ -577,67 +577,67 @@ AcpiDbDisplayStatistics (
case CMD_STAT_MISC:

AcpiOsPrintf ("\nMiscellaneous Statistics:\n\n");
AcpiOsPrintf ("%-28s: %7lu\n", "Calls to AcpiPsFind",
(UINT64) AcpiGbl_PsFindCount);
AcpiOsPrintf ("%-28s: %7lu\n", "Calls to AcpiNsLookup",
(UINT64) AcpiGbl_NsLookupCount);
AcpiOsPrintf ("%-28s: %7u\n", "Calls to AcpiPsFind",
AcpiGbl_PsFindCount);
AcpiOsPrintf ("%-28s: %7u\n", "Calls to AcpiNsLookup",
AcpiGbl_NsLookupCount);

AcpiOsPrintf ("\nMutex usage:\n\n");
for (i = 0; i < ACPI_NUM_MUTEX; i++)
{
AcpiOsPrintf ("%-28s: %7lu\n",
AcpiUtGetMutexName (i), (UINT64) AcpiGbl_MutexInfo[i].UseCount);
AcpiOsPrintf ("%-28s: %7u\n",
AcpiUtGetMutexName (i), AcpiGbl_MutexInfo[i].UseCount);
}
break;

case CMD_STAT_SIZES:

AcpiOsPrintf ("\nInternal object sizes:\n\n");

AcpiOsPrintf ("Common %3d\n", sizeof (ACPI_OBJECT_COMMON));
AcpiOsPrintf ("Number %3d\n", sizeof (ACPI_OBJECT_INTEGER));
AcpiOsPrintf ("String %3d\n", sizeof (ACPI_OBJECT_STRING));
AcpiOsPrintf ("Buffer %3d\n", sizeof (ACPI_OBJECT_BUFFER));
AcpiOsPrintf ("Package %3d\n", sizeof (ACPI_OBJECT_PACKAGE));
AcpiOsPrintf ("BufferField %3d\n", sizeof (ACPI_OBJECT_BUFFER_FIELD));
AcpiOsPrintf ("Device %3d\n", sizeof (ACPI_OBJECT_DEVICE));
AcpiOsPrintf ("Event %3d\n", sizeof (ACPI_OBJECT_EVENT));
AcpiOsPrintf ("Method %3d\n", sizeof (ACPI_OBJECT_METHOD));
AcpiOsPrintf ("Mutex %3d\n", sizeof (ACPI_OBJECT_MUTEX));
AcpiOsPrintf ("Region %3d\n", sizeof (ACPI_OBJECT_REGION));
AcpiOsPrintf ("PowerResource %3d\n", sizeof (ACPI_OBJECT_POWER_RESOURCE));
AcpiOsPrintf ("Processor %3d\n", sizeof (ACPI_OBJECT_PROCESSOR));
AcpiOsPrintf ("ThermalZone %3d\n", sizeof (ACPI_OBJECT_THERMAL_ZONE));
AcpiOsPrintf ("RegionField %3d\n", sizeof (ACPI_OBJECT_REGION_FIELD));
AcpiOsPrintf ("BankField %3d\n", sizeof (ACPI_OBJECT_BANK_FIELD));
AcpiOsPrintf ("IndexField %3d\n", sizeof (ACPI_OBJECT_INDEX_FIELD));
AcpiOsPrintf ("Reference %3d\n", sizeof (ACPI_OBJECT_REFERENCE));
AcpiOsPrintf ("Notify %3d\n", sizeof (ACPI_OBJECT_NOTIFY_HANDLER));
AcpiOsPrintf ("AddressSpace %3d\n", sizeof (ACPI_OBJECT_ADDR_HANDLER));
AcpiOsPrintf ("Extra %3d\n", sizeof (ACPI_OBJECT_EXTRA));
AcpiOsPrintf ("Data %3d\n", sizeof (ACPI_OBJECT_DATA));
AcpiOsPrintf ("Common %3d\n", (UINT32) sizeof (ACPI_OBJECT_COMMON));
AcpiOsPrintf ("Number %3d\n", (UINT32) sizeof (ACPI_OBJECT_INTEGER));
AcpiOsPrintf ("String %3d\n", (UINT32) sizeof (ACPI_OBJECT_STRING));
AcpiOsPrintf ("Buffer %3d\n", (UINT32) sizeof (ACPI_OBJECT_BUFFER));
AcpiOsPrintf ("Package %3d\n", (UINT32) sizeof (ACPI_OBJECT_PACKAGE));
AcpiOsPrintf ("BufferField %3d\n", (UINT32) sizeof (ACPI_OBJECT_BUFFER_FIELD));
AcpiOsPrintf ("Device %3d\n", (UINT32) sizeof (ACPI_OBJECT_DEVICE));
AcpiOsPrintf ("Event %3d\n", (UINT32) sizeof (ACPI_OBJECT_EVENT));
AcpiOsPrintf ("Method %3d\n", (UINT32) sizeof (ACPI_OBJECT_METHOD));
AcpiOsPrintf ("Mutex %3d\n", (UINT32) sizeof (ACPI_OBJECT_MUTEX));
AcpiOsPrintf ("Region %3d\n", (UINT32) sizeof (ACPI_OBJECT_REGION));
AcpiOsPrintf ("PowerResource %3d\n", (UINT32) sizeof (ACPI_OBJECT_POWER_RESOURCE));
AcpiOsPrintf ("Processor %3d\n", (UINT32) sizeof (ACPI_OBJECT_PROCESSOR));
AcpiOsPrintf ("ThermalZone %3d\n", (UINT32) sizeof (ACPI_OBJECT_THERMAL_ZONE));
AcpiOsPrintf ("RegionField %3d\n", (UINT32) sizeof (ACPI_OBJECT_REGION_FIELD));
AcpiOsPrintf ("BankField %3d\n", (UINT32) sizeof (ACPI_OBJECT_BANK_FIELD));
AcpiOsPrintf ("IndexField %3d\n", (UINT32) sizeof (ACPI_OBJECT_INDEX_FIELD));
AcpiOsPrintf ("Reference %3d\n", (UINT32) sizeof (ACPI_OBJECT_REFERENCE));
AcpiOsPrintf ("Notify %3d\n", (UINT32) sizeof (ACPI_OBJECT_NOTIFY_HANDLER));
AcpiOsPrintf ("AddressSpace %3d\n", (UINT32) sizeof (ACPI_OBJECT_ADDR_HANDLER));
AcpiOsPrintf ("Extra %3d\n", (UINT32) sizeof (ACPI_OBJECT_EXTRA));
AcpiOsPrintf ("Data %3d\n", (UINT32) sizeof (ACPI_OBJECT_DATA));

AcpiOsPrintf ("\n");

AcpiOsPrintf ("ParseObject %3d\n", sizeof (ACPI_PARSE_OBJ_COMMON));
AcpiOsPrintf ("ParseObjectNamed %3d\n", sizeof (ACPI_PARSE_OBJ_NAMED));
AcpiOsPrintf ("ParseObjectAsl %3d\n", sizeof (ACPI_PARSE_OBJ_ASL));
AcpiOsPrintf ("OperandObject %3d\n", sizeof (ACPI_OPERAND_OBJECT));
AcpiOsPrintf ("NamespaceNode %3d\n", sizeof (ACPI_NAMESPACE_NODE));
AcpiOsPrintf ("AcpiObject %3d\n", sizeof (ACPI_OBJECT));
AcpiOsPrintf ("ParseObject %3d\n", (UINT32) sizeof (ACPI_PARSE_OBJ_COMMON));
AcpiOsPrintf ("ParseObjectNamed %3d\n", (UINT32) sizeof (ACPI_PARSE_OBJ_NAMED));
AcpiOsPrintf ("ParseObjectAsl %3d\n", (UINT32) sizeof (ACPI_PARSE_OBJ_ASL));
AcpiOsPrintf ("OperandObject %3d\n", (UINT32) sizeof (ACPI_OPERAND_OBJECT));
AcpiOsPrintf ("NamespaceNode %3d\n", (UINT32) sizeof (ACPI_NAMESPACE_NODE));
AcpiOsPrintf ("AcpiObject %3d\n", (UINT32) sizeof (ACPI_OBJECT));

AcpiOsPrintf ("\n");

AcpiOsPrintf ("Generic State %3d\n", sizeof (ACPI_GENERIC_STATE));
AcpiOsPrintf ("Common State %3d\n", sizeof (ACPI_COMMON_STATE));
AcpiOsPrintf ("Control State %3d\n", sizeof (ACPI_CONTROL_STATE));
AcpiOsPrintf ("Update State %3d\n", sizeof (ACPI_UPDATE_STATE));
AcpiOsPrintf ("Scope State %3d\n", sizeof (ACPI_SCOPE_STATE));
AcpiOsPrintf ("Parse Scope %3d\n", sizeof (ACPI_PSCOPE_STATE));
AcpiOsPrintf ("Package State %3d\n", sizeof (ACPI_PKG_STATE));
AcpiOsPrintf ("Thread State %3d\n", sizeof (ACPI_THREAD_STATE));
AcpiOsPrintf ("Result Values %3d\n", sizeof (ACPI_RESULT_VALUES));
AcpiOsPrintf ("Notify Info %3d\n", sizeof (ACPI_NOTIFY_INFO));
AcpiOsPrintf ("Generic State %3d\n", (UINT32) sizeof (ACPI_GENERIC_STATE));
AcpiOsPrintf ("Common State %3d\n", (UINT32) sizeof (ACPI_COMMON_STATE));
AcpiOsPrintf ("Control State %3d\n", (UINT32) sizeof (ACPI_CONTROL_STATE));
AcpiOsPrintf ("Update State %3d\n", (UINT32) sizeof (ACPI_UPDATE_STATE));
AcpiOsPrintf ("Scope State %3d\n", (UINT32) sizeof (ACPI_SCOPE_STATE));
AcpiOsPrintf ("Parse Scope %3d\n", (UINT32) sizeof (ACPI_PSCOPE_STATE));
AcpiOsPrintf ("Package State %3d\n", (UINT32) sizeof (ACPI_PKG_STATE));
AcpiOsPrintf ("Thread State %3d\n", (UINT32) sizeof (ACPI_THREAD_STATE));
AcpiOsPrintf ("Result Values %3d\n", (UINT32) sizeof (ACPI_RESULT_VALUES));
AcpiOsPrintf ("Notify Info %3d\n", (UINT32) sizeof (ACPI_NOTIFY_INFO));
break;

case CMD_STAT_STACK:
@@ -767,7 +767,7 @@ AcpiNsLookup (
if (Flags & ACPI_NS_PREFIX_MUST_EXIST)
{
AcpiOsPrintf (ACPI_MSG_BIOS_ERROR
"Object does not exist: %4.4s\n", &SimpleName);
"Object does not exist: %4.4s\n", (char *) &SimpleName);
}
#endif
/* Name not found in ACPI namespace */
@@ -322,7 +322,7 @@ AcpiDebugPrint (
* Display the module name, current line number, thread ID (if requested),
* current procedure nesting level, and the current procedure name
*/
AcpiOsPrintf ("%9s-%04ld ", ModuleName, LineNumber);
AcpiOsPrintf ("%9s-%04d ", ModuleName, LineNumber);

#ifdef ACPI_APPLICATION
/*
@@ -343,7 +343,7 @@ AcpiDebugPrint (
FillCount = 0;
}

AcpiOsPrintf ("[%02ld] %*s",
AcpiOsPrintf ("[%02d] %*s",
AcpiGbl_NestingLevel, AcpiGbl_NestingLevel + 1, " ");
AcpiOsPrintf ("%s%*s: ",
AcpiUtTrimFunctionName (FunctionName), FillCount, " ");

0 comments on commit d06def1

Please sign in to comment.
You can’t perform that action at this time.