diff --git a/source/compiler/aslcompile.c b/source/compiler/aslcompile.c
index 90e90991b..d6cb8adc7 100644
--- a/source/compiler/aslcompile.c
+++ b/source/compiler/aslcompile.c
@@ -177,7 +177,8 @@ AslCompilerSignon (
{
Prefix = "; ";
}
- else if (Gbl_HexOutputFlag == HEX_OUTPUT_C)
+ else if ((Gbl_HexOutputFlag == HEX_OUTPUT_C) ||
+ (Gbl_HexOutputFlag == HEX_OUTPUT_ASL))
{
FlPrintFile (ASL_FILE_HEX_OUTPUT, "/*\n");
Prefix = " * ";
@@ -265,7 +266,8 @@ AslCompilerFileHeader (
{
Prefix = "; ";
}
- else if (Gbl_HexOutputFlag == HEX_OUTPUT_C)
+ else if ((Gbl_HexOutputFlag == HEX_OUTPUT_C) ||
+ (Gbl_HexOutputFlag == HEX_OUTPUT_ASL))
{
Prefix = " * ";
}
diff --git a/source/compiler/aslglobal.h b/source/compiler/aslglobal.h
index 01ab931e0..7599e5720 100644
--- a/source/compiler/aslglobal.h
+++ b/source/compiler/aslglobal.h
@@ -200,6 +200,8 @@ ASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_WarningLevel, ASL_WARNI
#define HEX_OUTPUT_NONE 0
#define HEX_OUTPUT_C 1
#define HEX_OUTPUT_ASM 2
+#define HEX_OUTPUT_ASL 3
+
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_HexOutputFlag, HEX_OUTPUT_NONE);
diff --git a/source/compiler/asllisting.c b/source/compiler/asllisting.c
index b02115289..93f83ad84 100644
--- a/source/compiler/asllisting.c
+++ b/source/compiler/asllisting.c
@@ -198,6 +198,10 @@ static void
LsDoHexOutputAsm (
void);
+static void
+LsDoHexOutputAsl (
+ void);
+
ACPI_STATUS
LsTreeWriteWalk (
ACPI_PARSE_OBJECT *Op,
@@ -1337,6 +1341,11 @@ LsDoHexOutput (
LsDoHexOutputAsm ();
break;
+ case HEX_OUTPUT_ASL:
+
+ LsDoHexOutputAsl ();
+ break;
+
default:
/* No other output types supported */
break;
@@ -1432,6 +1441,94 @@ LsDoHexOutputC (
}
+/*******************************************************************************
+ *
+ * FUNCTION: LsDoHexOutputAsl
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Create the hex output file. This is the same data as the AML
+ * output file, but formatted into hex/ascii bytes suitable for
+ * inclusion into a C source file.
+ *
+ ******************************************************************************/
+
+static void
+LsDoHexOutputAsl (
+ void)
+{
+ UINT8 FileData[HEX_TABLE_LINE_SIZE];
+ UINT32 LineLength;
+ UINT32 Offset = 0;
+ UINT32 AmlFileSize;
+ UINT32 i;
+
+
+ /* Get AML size, seek back to start */
+
+ AmlFileSize = FlGetFileSize (ASL_FILE_AML_OUTPUT);
+
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, " * ASL source code output\n");
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, " * AML code block contains 0x%X bytes\n *\n */\n",
+ AmlFileSize);
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, " Name (BUF1, Buffer()\n {\n");
+
+ while (Offset < AmlFileSize)
+ {
+ /* Read enough bytes needed for one output line */
+
+ LineLength = fread (FileData, 1, HEX_TABLE_LINE_SIZE,
+ Gbl_Files[ASL_FILE_AML_OUTPUT].Handle);
+ if (!LineLength)
+ {
+ break;
+ }
+
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, " ");
+
+ for (i = 0; i < LineLength; i++)
+ {
+ /*
+ * Print each hex byte.
+ * Add a comma until the very last byte of the AML file
+ * (Some C compilers complain about a trailing comma)
+ */
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, "0x%2.2X", FileData[i]);
+ if ((Offset + i + 1) < AmlFileSize)
+ {
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, ",");
+ }
+ else
+ {
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, " ");
+ }
+ }
+
+ /* Add fill spaces if needed for last line */
+
+ if (LineLength < HEX_TABLE_LINE_SIZE)
+ {
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, "%*s",
+ 5 * (HEX_TABLE_LINE_SIZE - LineLength), " ");
+ }
+
+ /* Emit the offset and ascii dump for the entire line */
+
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, " /* %8.8X", Offset);
+ LsDumpAsciiInComment (ASL_FILE_HEX_OUTPUT, LineLength, FileData);
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, "%*s*/\n",
+ HEX_TABLE_LINE_SIZE - LineLength + 1, " ");
+
+ Offset += LineLength;
+ }
+
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, " })\n");
+ FlCloseFile (ASL_FILE_HEX_OUTPUT);
+}
+
+
/*******************************************************************************
*
* FUNCTION: LsDoHexOutputAsm
diff --git a/source/compiler/aslmain.c b/source/compiler/aslmain.c
index 59b5880e7..b3f9835f5 100644
--- a/source/compiler/aslmain.c
+++ b/source/compiler/aslmain.c
@@ -203,7 +203,7 @@ Options (
printf ("\nAML Output Files:\n");
printf (" -s Create AML in assembler or C source file (*.asm or *.c)\n");
printf (" -i Create assembler or C include file (*.inc or *.h)\n");
- printf (" -t Create AML in assembler or C hex table (*.hex)\n");
+ printf (" -t Create AML in assembler, C, or ASL hex table (*.hex)\n");
printf ("\nAML Code Generation:\n");
printf (" -oa Disable all optimizations (compatibility mode)\n");
@@ -741,6 +741,10 @@ AslDoOptions (
Gbl_HexOutputFlag = HEX_OUTPUT_C;
break;
+ case 's':
+ Gbl_HexOutputFlag = HEX_OUTPUT_ASL;
+ break;
+
default:
printf ("Unknown option: -t%s\n", AcpiGbl_Optarg);
return (-1);