aslhex.c revision 1.1.1.1.10.3 1 1.1.1.1.10.2 tls /******************************************************************************
2 1.1.1.1.10.2 tls *
3 1.1.1.1.10.2 tls * Module Name: aslhex - ASCII hex output file generation (C, ASM, and ASL)
4 1.1.1.1.10.2 tls *
5 1.1.1.1.10.2 tls *****************************************************************************/
6 1.1.1.1.10.2 tls
7 1.1.1.1.10.2 tls /*
8 1.1.1.1.10.3 jdolecek * Copyright (C) 2000 - 2017, Intel Corp.
9 1.1.1.1.10.2 tls * All rights reserved.
10 1.1.1.1.10.2 tls *
11 1.1.1.1.10.2 tls * Redistribution and use in source and binary forms, with or without
12 1.1.1.1.10.2 tls * modification, are permitted provided that the following conditions
13 1.1.1.1.10.2 tls * are met:
14 1.1.1.1.10.2 tls * 1. Redistributions of source code must retain the above copyright
15 1.1.1.1.10.2 tls * notice, this list of conditions, and the following disclaimer,
16 1.1.1.1.10.2 tls * without modification.
17 1.1.1.1.10.2 tls * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 1.1.1.1.10.2 tls * substantially similar to the "NO WARRANTY" disclaimer below
19 1.1.1.1.10.2 tls * ("Disclaimer") and any redistribution must be conditioned upon
20 1.1.1.1.10.2 tls * including a substantially similar Disclaimer requirement for further
21 1.1.1.1.10.2 tls * binary redistribution.
22 1.1.1.1.10.2 tls * 3. Neither the names of the above-listed copyright holders nor the names
23 1.1.1.1.10.2 tls * of any contributors may be used to endorse or promote products derived
24 1.1.1.1.10.2 tls * from this software without specific prior written permission.
25 1.1.1.1.10.2 tls *
26 1.1.1.1.10.2 tls * Alternatively, this software may be distributed under the terms of the
27 1.1.1.1.10.2 tls * GNU General Public License ("GPL") version 2 as published by the Free
28 1.1.1.1.10.2 tls * Software Foundation.
29 1.1.1.1.10.2 tls *
30 1.1.1.1.10.2 tls * NO WARRANTY
31 1.1.1.1.10.2 tls * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 1.1.1.1.10.2 tls * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 1.1.1.1.10.2 tls * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 1.1.1.1.10.2 tls * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 1.1.1.1.10.2 tls * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 1.1.1.1.10.2 tls * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 1.1.1.1.10.2 tls * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 1.1.1.1.10.2 tls * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 1.1.1.1.10.2 tls * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 1.1.1.1.10.2 tls * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 1.1.1.1.10.2 tls * POSSIBILITY OF SUCH DAMAGES.
42 1.1.1.1.10.2 tls */
43 1.1.1.1.10.2 tls
44 1.1.1.1.10.2 tls #include "aslcompiler.h"
45 1.1.1.1.10.2 tls
46 1.1.1.1.10.2 tls #define _COMPONENT ACPI_COMPILER
47 1.1.1.1.10.2 tls ACPI_MODULE_NAME ("ashex")
48 1.1.1.1.10.2 tls
49 1.1.1.1.10.2 tls /*
50 1.1.1.1.10.2 tls * This module emits ASCII hex output files in either C, ASM, or ASL format
51 1.1.1.1.10.2 tls */
52 1.1.1.1.10.2 tls
53 1.1.1.1.10.2 tls /* Local prototypes */
54 1.1.1.1.10.2 tls
55 1.1.1.1.10.2 tls static void
56 1.1.1.1.10.2 tls HxDoHexOutputC (
57 1.1.1.1.10.2 tls void);
58 1.1.1.1.10.2 tls
59 1.1.1.1.10.2 tls static void
60 1.1.1.1.10.2 tls HxDoHexOutputAsl (
61 1.1.1.1.10.2 tls void);
62 1.1.1.1.10.2 tls
63 1.1.1.1.10.2 tls static void
64 1.1.1.1.10.2 tls HxDoHexOutputAsm (
65 1.1.1.1.10.2 tls void);
66 1.1.1.1.10.2 tls
67 1.1.1.1.10.2 tls static UINT32
68 1.1.1.1.10.2 tls HxReadAmlOutputFile (
69 1.1.1.1.10.2 tls UINT8 *Buffer);
70 1.1.1.1.10.2 tls
71 1.1.1.1.10.2 tls
72 1.1.1.1.10.2 tls /*******************************************************************************
73 1.1.1.1.10.2 tls *
74 1.1.1.1.10.2 tls * FUNCTION: HxDoHexOutput
75 1.1.1.1.10.2 tls *
76 1.1.1.1.10.2 tls * PARAMETERS: None
77 1.1.1.1.10.2 tls *
78 1.1.1.1.10.2 tls * RETURN: None
79 1.1.1.1.10.2 tls *
80 1.1.1.1.10.2 tls * DESCRIPTION: Create the hex output file. Note: data is obtained by reading
81 1.1.1.1.10.2 tls * the entire AML output file that was previously generated.
82 1.1.1.1.10.2 tls *
83 1.1.1.1.10.2 tls ******************************************************************************/
84 1.1.1.1.10.2 tls
85 1.1.1.1.10.2 tls void
86 1.1.1.1.10.2 tls HxDoHexOutput (
87 1.1.1.1.10.2 tls void)
88 1.1.1.1.10.2 tls {
89 1.1.1.1.10.2 tls
90 1.1.1.1.10.2 tls switch (Gbl_HexOutputFlag)
91 1.1.1.1.10.2 tls {
92 1.1.1.1.10.2 tls case HEX_OUTPUT_C:
93 1.1.1.1.10.2 tls
94 1.1.1.1.10.2 tls HxDoHexOutputC ();
95 1.1.1.1.10.2 tls break;
96 1.1.1.1.10.2 tls
97 1.1.1.1.10.2 tls case HEX_OUTPUT_ASM:
98 1.1.1.1.10.2 tls
99 1.1.1.1.10.2 tls HxDoHexOutputAsm ();
100 1.1.1.1.10.2 tls break;
101 1.1.1.1.10.2 tls
102 1.1.1.1.10.2 tls case HEX_OUTPUT_ASL:
103 1.1.1.1.10.2 tls
104 1.1.1.1.10.2 tls HxDoHexOutputAsl ();
105 1.1.1.1.10.2 tls break;
106 1.1.1.1.10.2 tls
107 1.1.1.1.10.2 tls default:
108 1.1.1.1.10.2 tls
109 1.1.1.1.10.2 tls /* No other output types supported */
110 1.1.1.1.10.2 tls
111 1.1.1.1.10.2 tls break;
112 1.1.1.1.10.2 tls }
113 1.1.1.1.10.2 tls }
114 1.1.1.1.10.2 tls
115 1.1.1.1.10.2 tls
116 1.1.1.1.10.2 tls /*******************************************************************************
117 1.1.1.1.10.2 tls *
118 1.1.1.1.10.2 tls * FUNCTION: HxReadAmlOutputFile
119 1.1.1.1.10.2 tls *
120 1.1.1.1.10.2 tls * PARAMETERS: Buffer - Where to return data
121 1.1.1.1.10.2 tls *
122 1.1.1.1.10.2 tls * RETURN: None
123 1.1.1.1.10.2 tls *
124 1.1.1.1.10.2 tls * DESCRIPTION: Read a line of the AML output prior to formatting the data
125 1.1.1.1.10.2 tls *
126 1.1.1.1.10.2 tls ******************************************************************************/
127 1.1.1.1.10.2 tls
128 1.1.1.1.10.2 tls static UINT32
129 1.1.1.1.10.2 tls HxReadAmlOutputFile (
130 1.1.1.1.10.2 tls UINT8 *Buffer)
131 1.1.1.1.10.2 tls {
132 1.1.1.1.10.2 tls UINT32 Actual;
133 1.1.1.1.10.2 tls
134 1.1.1.1.10.2 tls
135 1.1.1.1.10.2 tls Actual = fread (Buffer, 1, HEX_TABLE_LINE_SIZE,
136 1.1.1.1.10.2 tls Gbl_Files[ASL_FILE_AML_OUTPUT].Handle);
137 1.1.1.1.10.2 tls
138 1.1.1.1.10.2 tls if (ferror (Gbl_Files[ASL_FILE_AML_OUTPUT].Handle))
139 1.1.1.1.10.2 tls {
140 1.1.1.1.10.2 tls FlFileError (ASL_FILE_AML_OUTPUT, ASL_MSG_READ);
141 1.1.1.1.10.2 tls AslAbort ();
142 1.1.1.1.10.2 tls }
143 1.1.1.1.10.2 tls
144 1.1.1.1.10.2 tls return (Actual);
145 1.1.1.1.10.2 tls }
146 1.1.1.1.10.2 tls
147 1.1.1.1.10.2 tls
148 1.1.1.1.10.2 tls /*******************************************************************************
149 1.1.1.1.10.2 tls *
150 1.1.1.1.10.2 tls * FUNCTION: HxDoHexOutputC
151 1.1.1.1.10.2 tls *
152 1.1.1.1.10.2 tls * PARAMETERS: None
153 1.1.1.1.10.2 tls *
154 1.1.1.1.10.2 tls * RETURN: None
155 1.1.1.1.10.2 tls *
156 1.1.1.1.10.2 tls * DESCRIPTION: Create the hex output file. This is the same data as the AML
157 1.1.1.1.10.2 tls * output file, but formatted into hex/ascii bytes suitable for
158 1.1.1.1.10.2 tls * inclusion into a C source file.
159 1.1.1.1.10.2 tls *
160 1.1.1.1.10.2 tls ******************************************************************************/
161 1.1.1.1.10.2 tls
162 1.1.1.1.10.2 tls static void
163 1.1.1.1.10.2 tls HxDoHexOutputC (
164 1.1.1.1.10.2 tls void)
165 1.1.1.1.10.2 tls {
166 1.1.1.1.10.2 tls UINT8 FileData[HEX_TABLE_LINE_SIZE];
167 1.1.1.1.10.2 tls UINT32 LineLength;
168 1.1.1.1.10.2 tls UINT32 Offset = 0;
169 1.1.1.1.10.2 tls UINT32 AmlFileSize;
170 1.1.1.1.10.2 tls UINT32 i;
171 1.1.1.1.10.2 tls
172 1.1.1.1.10.2 tls
173 1.1.1.1.10.2 tls /* Get AML size, seek back to start */
174 1.1.1.1.10.2 tls
175 1.1.1.1.10.2 tls AmlFileSize = FlGetFileSize (ASL_FILE_AML_OUTPUT);
176 1.1.1.1.10.2 tls FlSeekFile (ASL_FILE_AML_OUTPUT, 0);
177 1.1.1.1.10.2 tls
178 1.1.1.1.10.2 tls FlPrintFile (ASL_FILE_HEX_OUTPUT, " * C source code output\n");
179 1.1.1.1.10.2 tls FlPrintFile (ASL_FILE_HEX_OUTPUT, " * AML code block contains 0x%X bytes\n *\n */\n",
180 1.1.1.1.10.2 tls AmlFileSize);
181 1.1.1.1.10.2 tls FlPrintFile (ASL_FILE_HEX_OUTPUT, "unsigned char AmlCode[] =\n{\n");
182 1.1.1.1.10.2 tls
183 1.1.1.1.10.2 tls while (Offset < AmlFileSize)
184 1.1.1.1.10.2 tls {
185 1.1.1.1.10.2 tls /* Read enough bytes needed for one output line */
186 1.1.1.1.10.2 tls
187 1.1.1.1.10.2 tls LineLength = HxReadAmlOutputFile (FileData);
188 1.1.1.1.10.2 tls if (!LineLength)
189 1.1.1.1.10.2 tls {
190 1.1.1.1.10.2 tls break;
191 1.1.1.1.10.2 tls }
192 1.1.1.1.10.2 tls
193 1.1.1.1.10.2 tls FlPrintFile (ASL_FILE_HEX_OUTPUT, " ");
194 1.1.1.1.10.2 tls
195 1.1.1.1.10.2 tls for (i = 0; i < LineLength; i++)
196 1.1.1.1.10.2 tls {
197 1.1.1.1.10.2 tls /*
198 1.1.1.1.10.2 tls * Print each hex byte.
199 1.1.1.1.10.2 tls * Add a comma until the very last byte of the AML file
200 1.1.1.1.10.2 tls * (Some C compilers complain about a trailing comma)
201 1.1.1.1.10.2 tls */
202 1.1.1.1.10.2 tls FlPrintFile (ASL_FILE_HEX_OUTPUT, "0x%2.2X", FileData[i]);
203 1.1.1.1.10.2 tls if ((Offset + i + 1) < AmlFileSize)
204 1.1.1.1.10.2 tls {
205 1.1.1.1.10.2 tls FlPrintFile (ASL_FILE_HEX_OUTPUT, ",");
206 1.1.1.1.10.2 tls }
207 1.1.1.1.10.2 tls else
208 1.1.1.1.10.2 tls {
209 1.1.1.1.10.2 tls FlPrintFile (ASL_FILE_HEX_OUTPUT, " ");
210 1.1.1.1.10.2 tls }
211 1.1.1.1.10.2 tls }
212 1.1.1.1.10.2 tls
213 1.1.1.1.10.2 tls /* Add fill spaces if needed for last line */
214 1.1.1.1.10.2 tls
215 1.1.1.1.10.2 tls if (LineLength < HEX_TABLE_LINE_SIZE)
216 1.1.1.1.10.2 tls {
217 1.1.1.1.10.2 tls FlPrintFile (ASL_FILE_HEX_OUTPUT, "%*s",
218 1.1.1.1.10.2 tls 5 * (HEX_TABLE_LINE_SIZE - LineLength), " ");
219 1.1.1.1.10.2 tls }
220 1.1.1.1.10.2 tls
221 1.1.1.1.10.2 tls /* Emit the offset and ascii dump for the entire line */
222 1.1.1.1.10.2 tls
223 1.1.1.1.10.2 tls FlPrintFile (ASL_FILE_HEX_OUTPUT, " /* %8.8X", Offset);
224 1.1.1.1.10.2 tls LsDumpAsciiInComment (ASL_FILE_HEX_OUTPUT, LineLength, FileData);
225 1.1.1.1.10.3 jdolecek
226 1.1.1.1.10.2 tls FlPrintFile (ASL_FILE_HEX_OUTPUT, "%*s*/\n",
227 1.1.1.1.10.2 tls HEX_TABLE_LINE_SIZE - LineLength + 1, " ");
228 1.1.1.1.10.2 tls
229 1.1.1.1.10.2 tls Offset += LineLength;
230 1.1.1.1.10.2 tls }
231 1.1.1.1.10.2 tls
232 1.1.1.1.10.2 tls FlPrintFile (ASL_FILE_HEX_OUTPUT, "};\n");
233 1.1.1.1.10.2 tls }
234 1.1.1.1.10.2 tls
235 1.1.1.1.10.2 tls
236 1.1.1.1.10.2 tls /*******************************************************************************
237 1.1.1.1.10.2 tls *
238 1.1.1.1.10.2 tls * FUNCTION: HxDoHexOutputAsl
239 1.1.1.1.10.2 tls *
240 1.1.1.1.10.2 tls * PARAMETERS: None
241 1.1.1.1.10.2 tls *
242 1.1.1.1.10.2 tls * RETURN: None
243 1.1.1.1.10.2 tls *
244 1.1.1.1.10.2 tls * DESCRIPTION: Create the hex output file. This is the same data as the AML
245 1.1.1.1.10.2 tls * output file, but formatted into hex/ascii bytes suitable for
246 1.1.1.1.10.2 tls * inclusion into a C source file.
247 1.1.1.1.10.2 tls *
248 1.1.1.1.10.2 tls ******************************************************************************/
249 1.1.1.1.10.2 tls
250 1.1.1.1.10.2 tls static void
251 1.1.1.1.10.2 tls HxDoHexOutputAsl (
252 1.1.1.1.10.2 tls void)
253 1.1.1.1.10.2 tls {
254 1.1.1.1.10.2 tls UINT8 FileData[HEX_TABLE_LINE_SIZE];
255 1.1.1.1.10.2 tls UINT32 LineLength;
256 1.1.1.1.10.2 tls UINT32 Offset = 0;
257 1.1.1.1.10.2 tls UINT32 AmlFileSize;
258 1.1.1.1.10.2 tls UINT32 i;
259 1.1.1.1.10.2 tls
260 1.1.1.1.10.2 tls
261 1.1.1.1.10.2 tls /* Get AML size, seek back to start */
262 1.1.1.1.10.2 tls
263 1.1.1.1.10.2 tls AmlFileSize = FlGetFileSize (ASL_FILE_AML_OUTPUT);
264 1.1.1.1.10.2 tls FlSeekFile (ASL_FILE_AML_OUTPUT, 0);
265 1.1.1.1.10.2 tls
266 1.1.1.1.10.2 tls FlPrintFile (ASL_FILE_HEX_OUTPUT, " * ASL source code output\n");
267 1.1.1.1.10.2 tls FlPrintFile (ASL_FILE_HEX_OUTPUT, " * AML code block contains 0x%X bytes\n *\n */\n",
268 1.1.1.1.10.2 tls AmlFileSize);
269 1.1.1.1.10.2 tls FlPrintFile (ASL_FILE_HEX_OUTPUT, " Name (BUF1, Buffer()\n {\n");
270 1.1.1.1.10.2 tls
271 1.1.1.1.10.2 tls while (Offset < AmlFileSize)
272 1.1.1.1.10.2 tls {
273 1.1.1.1.10.2 tls /* Read enough bytes needed for one output line */
274 1.1.1.1.10.2 tls
275 1.1.1.1.10.2 tls LineLength = HxReadAmlOutputFile (FileData);
276 1.1.1.1.10.2 tls if (!LineLength)
277 1.1.1.1.10.2 tls {
278 1.1.1.1.10.2 tls break;
279 1.1.1.1.10.2 tls }
280 1.1.1.1.10.2 tls
281 1.1.1.1.10.2 tls FlPrintFile (ASL_FILE_HEX_OUTPUT, " ");
282 1.1.1.1.10.2 tls
283 1.1.1.1.10.2 tls for (i = 0; i < LineLength; i++)
284 1.1.1.1.10.2 tls {
285 1.1.1.1.10.2 tls /*
286 1.1.1.1.10.2 tls * Print each hex byte.
287 1.1.1.1.10.2 tls * Add a comma until the very last byte of the AML file
288 1.1.1.1.10.2 tls * (Some C compilers complain about a trailing comma)
289 1.1.1.1.10.2 tls */
290 1.1.1.1.10.2 tls FlPrintFile (ASL_FILE_HEX_OUTPUT, "0x%2.2X", FileData[i]);
291 1.1.1.1.10.2 tls if ((Offset + i + 1) < AmlFileSize)
292 1.1.1.1.10.2 tls {
293 1.1.1.1.10.2 tls FlPrintFile (ASL_FILE_HEX_OUTPUT, ",");
294 1.1.1.1.10.2 tls }
295 1.1.1.1.10.2 tls else
296 1.1.1.1.10.2 tls {
297 1.1.1.1.10.2 tls FlPrintFile (ASL_FILE_HEX_OUTPUT, " ");
298 1.1.1.1.10.2 tls }
299 1.1.1.1.10.2 tls }
300 1.1.1.1.10.2 tls
301 1.1.1.1.10.2 tls /* Add fill spaces if needed for last line */
302 1.1.1.1.10.2 tls
303 1.1.1.1.10.2 tls if (LineLength < HEX_TABLE_LINE_SIZE)
304 1.1.1.1.10.2 tls {
305 1.1.1.1.10.2 tls FlPrintFile (ASL_FILE_HEX_OUTPUT, "%*s",
306 1.1.1.1.10.2 tls 5 * (HEX_TABLE_LINE_SIZE - LineLength), " ");
307 1.1.1.1.10.2 tls }
308 1.1.1.1.10.2 tls
309 1.1.1.1.10.2 tls /* Emit the offset and ascii dump for the entire line */
310 1.1.1.1.10.2 tls
311 1.1.1.1.10.2 tls FlPrintFile (ASL_FILE_HEX_OUTPUT, " /* %8.8X", Offset);
312 1.1.1.1.10.2 tls LsDumpAsciiInComment (ASL_FILE_HEX_OUTPUT, LineLength, FileData);
313 1.1.1.1.10.3 jdolecek
314 1.1.1.1.10.2 tls FlPrintFile (ASL_FILE_HEX_OUTPUT, "%*s*/\n",
315 1.1.1.1.10.2 tls HEX_TABLE_LINE_SIZE - LineLength + 1, " ");
316 1.1.1.1.10.2 tls
317 1.1.1.1.10.2 tls Offset += LineLength;
318 1.1.1.1.10.2 tls }
319 1.1.1.1.10.2 tls
320 1.1.1.1.10.2 tls FlPrintFile (ASL_FILE_HEX_OUTPUT, " })\n");
321 1.1.1.1.10.2 tls }
322 1.1.1.1.10.2 tls
323 1.1.1.1.10.2 tls
324 1.1.1.1.10.2 tls /*******************************************************************************
325 1.1.1.1.10.2 tls *
326 1.1.1.1.10.2 tls * FUNCTION: HxDoHexOutputAsm
327 1.1.1.1.10.2 tls *
328 1.1.1.1.10.2 tls * PARAMETERS: None
329 1.1.1.1.10.2 tls *
330 1.1.1.1.10.2 tls * RETURN: None
331 1.1.1.1.10.2 tls *
332 1.1.1.1.10.2 tls * DESCRIPTION: Create the hex output file. This is the same data as the AML
333 1.1.1.1.10.2 tls * output file, but formatted into hex/ascii bytes suitable for
334 1.1.1.1.10.2 tls * inclusion into a ASM source file.
335 1.1.1.1.10.2 tls *
336 1.1.1.1.10.2 tls ******************************************************************************/
337 1.1.1.1.10.2 tls
338 1.1.1.1.10.2 tls static void
339 1.1.1.1.10.2 tls HxDoHexOutputAsm (
340 1.1.1.1.10.2 tls void)
341 1.1.1.1.10.2 tls {
342 1.1.1.1.10.2 tls UINT8 FileData[HEX_TABLE_LINE_SIZE];
343 1.1.1.1.10.2 tls UINT32 LineLength;
344 1.1.1.1.10.2 tls UINT32 Offset = 0;
345 1.1.1.1.10.2 tls UINT32 AmlFileSize;
346 1.1.1.1.10.2 tls UINT32 i;
347 1.1.1.1.10.2 tls
348 1.1.1.1.10.2 tls
349 1.1.1.1.10.2 tls /* Get AML size, seek back to start */
350 1.1.1.1.10.2 tls
351 1.1.1.1.10.2 tls AmlFileSize = FlGetFileSize (ASL_FILE_AML_OUTPUT);
352 1.1.1.1.10.2 tls FlSeekFile (ASL_FILE_AML_OUTPUT, 0);
353 1.1.1.1.10.2 tls
354 1.1.1.1.10.2 tls FlPrintFile (ASL_FILE_HEX_OUTPUT, "; Assembly code source output\n");
355 1.1.1.1.10.2 tls FlPrintFile (ASL_FILE_HEX_OUTPUT, "; AML code block contains 0x%X bytes\n;\n",
356 1.1.1.1.10.2 tls AmlFileSize);
357 1.1.1.1.10.2 tls
358 1.1.1.1.10.2 tls while (Offset < AmlFileSize)
359 1.1.1.1.10.2 tls {
360 1.1.1.1.10.2 tls /* Read enough bytes needed for one output line */
361 1.1.1.1.10.2 tls
362 1.1.1.1.10.2 tls LineLength = HxReadAmlOutputFile (FileData);
363 1.1.1.1.10.2 tls if (!LineLength)
364 1.1.1.1.10.2 tls {
365 1.1.1.1.10.2 tls break;
366 1.1.1.1.10.2 tls }
367 1.1.1.1.10.2 tls
368 1.1.1.1.10.2 tls FlPrintFile (ASL_FILE_HEX_OUTPUT, " db ");
369 1.1.1.1.10.2 tls
370 1.1.1.1.10.2 tls for (i = 0; i < LineLength; i++)
371 1.1.1.1.10.2 tls {
372 1.1.1.1.10.2 tls /*
373 1.1.1.1.10.2 tls * Print each hex byte.
374 1.1.1.1.10.2 tls * Add a comma until the last byte of the line
375 1.1.1.1.10.2 tls */
376 1.1.1.1.10.2 tls FlPrintFile (ASL_FILE_HEX_OUTPUT, "0%2.2Xh", FileData[i]);
377 1.1.1.1.10.2 tls if ((i + 1) < LineLength)
378 1.1.1.1.10.2 tls {
379 1.1.1.1.10.2 tls FlPrintFile (ASL_FILE_HEX_OUTPUT, ",");
380 1.1.1.1.10.2 tls }
381 1.1.1.1.10.2 tls }
382 1.1.1.1.10.2 tls
383 1.1.1.1.10.2 tls FlPrintFile (ASL_FILE_HEX_OUTPUT, " ");
384 1.1.1.1.10.2 tls
385 1.1.1.1.10.2 tls /* Add fill spaces if needed for last line */
386 1.1.1.1.10.2 tls
387 1.1.1.1.10.2 tls if (LineLength < HEX_TABLE_LINE_SIZE)
388 1.1.1.1.10.2 tls {
389 1.1.1.1.10.2 tls FlPrintFile (ASL_FILE_HEX_OUTPUT, "%*s",
390 1.1.1.1.10.2 tls 5 * (HEX_TABLE_LINE_SIZE - LineLength), " ");
391 1.1.1.1.10.2 tls }
392 1.1.1.1.10.2 tls
393 1.1.1.1.10.2 tls /* Emit the offset and ascii dump for the entire line */
394 1.1.1.1.10.2 tls
395 1.1.1.1.10.2 tls FlPrintFile (ASL_FILE_HEX_OUTPUT, " ; %8.8X", Offset);
396 1.1.1.1.10.2 tls LsDumpAsciiInComment (ASL_FILE_HEX_OUTPUT, LineLength, FileData);
397 1.1.1.1.10.3 jdolecek
398 1.1.1.1.10.2 tls FlPrintFile (ASL_FILE_HEX_OUTPUT, "\n");
399 1.1.1.1.10.2 tls
400 1.1.1.1.10.2 tls Offset += LineLength;
401 1.1.1.1.10.2 tls }
402 1.1.1.1.10.2 tls
403 1.1.1.1.10.2 tls FlPrintFile (ASL_FILE_HEX_OUTPUT, "\n");
404 1.1.1.1.10.2 tls }
405