dmtbdump.c revision 1.1.1.17 1 1.1 jruoho /******************************************************************************
2 1.1 jruoho *
3 1.1 jruoho * Module Name: dmtbdump - Dump ACPI data tables that contain no AML code
4 1.1 jruoho *
5 1.1 jruoho *****************************************************************************/
6 1.1 jruoho
7 1.1.1.2 jruoho /*
8 1.1.1.17 christos * Copyright (C) 2000 - 2021, Intel Corp.
9 1.1 jruoho * All rights reserved.
10 1.1 jruoho *
11 1.1.1.2 jruoho * Redistribution and use in source and binary forms, with or without
12 1.1.1.2 jruoho * modification, are permitted provided that the following conditions
13 1.1.1.2 jruoho * are met:
14 1.1.1.2 jruoho * 1. Redistributions of source code must retain the above copyright
15 1.1.1.2 jruoho * notice, this list of conditions, and the following disclaimer,
16 1.1.1.2 jruoho * without modification.
17 1.1.1.2 jruoho * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 1.1.1.2 jruoho * substantially similar to the "NO WARRANTY" disclaimer below
19 1.1.1.2 jruoho * ("Disclaimer") and any redistribution must be conditioned upon
20 1.1.1.2 jruoho * including a substantially similar Disclaimer requirement for further
21 1.1.1.2 jruoho * binary redistribution.
22 1.1.1.2 jruoho * 3. Neither the names of the above-listed copyright holders nor the names
23 1.1.1.2 jruoho * of any contributors may be used to endorse or promote products derived
24 1.1.1.2 jruoho * from this software without specific prior written permission.
25 1.1.1.2 jruoho *
26 1.1.1.2 jruoho * Alternatively, this software may be distributed under the terms of the
27 1.1.1.2 jruoho * GNU General Public License ("GPL") version 2 as published by the Free
28 1.1.1.2 jruoho * Software Foundation.
29 1.1.1.2 jruoho *
30 1.1.1.2 jruoho * NO WARRANTY
31 1.1.1.2 jruoho * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 1.1.1.2 jruoho * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 1.1.1.17 christos * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
34 1.1.1.2 jruoho * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 1.1.1.2 jruoho * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 1.1.1.2 jruoho * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 1.1.1.2 jruoho * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 1.1.1.2 jruoho * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 1.1.1.2 jruoho * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 1.1.1.2 jruoho * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 1.1.1.2 jruoho * POSSIBILITY OF SUCH DAMAGES.
42 1.1.1.2 jruoho */
43 1.1 jruoho
44 1.1 jruoho #include "acpi.h"
45 1.1 jruoho #include "accommon.h"
46 1.1 jruoho #include "acdisasm.h"
47 1.1 jruoho #include "actables.h"
48 1.1 jruoho
49 1.1 jruoho /* This module used for application-level code only */
50 1.1 jruoho
51 1.1 jruoho #define _COMPONENT ACPI_CA_DISASSEMBLER
52 1.1 jruoho ACPI_MODULE_NAME ("dmtbdump")
53 1.1 jruoho
54 1.1 jruoho
55 1.1.1.11 christos /* Local prototypes */
56 1.1.1.4 christos
57 1.1.1.11 christos static void
58 1.1.1.11 christos AcpiDmValidateFadtLength (
59 1.1.1.11 christos UINT32 Revision,
60 1.1.1.11 christos UINT32 Length);
61 1.1.1.2 jruoho
62 1.1.1.4 christos
63 1.1.1.4 christos /*******************************************************************************
64 1.1.1.4 christos *
65 1.1.1.4 christos * FUNCTION: AcpiDmDumpBuffer
66 1.1.1.4 christos *
67 1.1.1.4 christos * PARAMETERS: Table - ACPI Table or subtable
68 1.1.1.4 christos * BufferOffset - Offset of buffer from Table above
69 1.1.1.4 christos * Length - Length of the buffer
70 1.1.1.4 christos * AbsoluteOffset - Offset of buffer in the main ACPI table
71 1.1.1.4 christos * Header - Name of the buffer field (printed on the
72 1.1.1.4 christos * first line only.)
73 1.1.1.4 christos *
74 1.1.1.4 christos * RETURN: None
75 1.1.1.4 christos *
76 1.1.1.4 christos * DESCRIPTION: Format the contents of an arbitrary length data buffer (in the
77 1.1.1.4 christos * disassembler output format.)
78 1.1.1.4 christos *
79 1.1.1.4 christos ******************************************************************************/
80 1.1.1.4 christos
81 1.1.1.6 christos void
82 1.1.1.4 christos AcpiDmDumpBuffer (
83 1.1.1.4 christos void *Table,
84 1.1.1.4 christos UINT32 BufferOffset,
85 1.1.1.4 christos UINT32 Length,
86 1.1.1.4 christos UINT32 AbsoluteOffset,
87 1.1.1.7 christos char *Header)
88 1.1.1.4 christos {
89 1.1.1.4 christos UINT8 *Buffer;
90 1.1.1.4 christos UINT32 i;
91 1.1.1.4 christos
92 1.1.1.4 christos
93 1.1.1.4 christos if (!Length)
94 1.1.1.4 christos {
95 1.1.1.4 christos return;
96 1.1.1.4 christos }
97 1.1.1.4 christos
98 1.1.1.4 christos Buffer = ACPI_CAST_PTR (UINT8, Table) + BufferOffset;
99 1.1.1.4 christos i = 0;
100 1.1.1.4 christos
101 1.1.1.4 christos while (i < Length)
102 1.1.1.4 christos {
103 1.1.1.4 christos if (!(i % 16))
104 1.1.1.4 christos {
105 1.1.1.7 christos /* Insert a backslash - line continuation character */
106 1.1.1.6 christos
107 1.1.1.7 christos if (Length > 16)
108 1.1.1.6 christos {
109 1.1.1.7 christos AcpiOsPrintf ("\\\n ");
110 1.1.1.6 christos }
111 1.1.1.4 christos }
112 1.1.1.4 christos
113 1.1.1.4 christos AcpiOsPrintf ("%.02X ", *Buffer);
114 1.1.1.4 christos i++;
115 1.1.1.4 christos Buffer++;
116 1.1.1.4 christos AbsoluteOffset++;
117 1.1.1.4 christos }
118 1.1.1.4 christos
119 1.1.1.4 christos AcpiOsPrintf ("\n");
120 1.1.1.4 christos }
121 1.1.1.4 christos
122 1.1.1.2 jruoho
123 1.1 jruoho /*******************************************************************************
124 1.1 jruoho *
125 1.1.1.7 christos * FUNCTION: AcpiDmDumpUnicode
126 1.1.1.7 christos *
127 1.1.1.7 christos * PARAMETERS: Table - ACPI Table or subtable
128 1.1.1.7 christos * BufferOffset - Offset of buffer from Table above
129 1.1.1.7 christos * ByteLength - Length of the buffer
130 1.1.1.7 christos *
131 1.1.1.7 christos * RETURN: None
132 1.1.1.7 christos *
133 1.1.1.7 christos * DESCRIPTION: Validate and dump the contents of a buffer that contains
134 1.1.1.7 christos * unicode data. The output is a standard ASCII string. If it
135 1.1.1.7 christos * appears that the data is not unicode, the buffer is dumped
136 1.1.1.7 christos * as hex characters.
137 1.1.1.7 christos *
138 1.1.1.7 christos ******************************************************************************/
139 1.1.1.7 christos
140 1.1.1.7 christos void
141 1.1.1.7 christos AcpiDmDumpUnicode (
142 1.1.1.7 christos void *Table,
143 1.1.1.7 christos UINT32 BufferOffset,
144 1.1.1.7 christos UINT32 ByteLength)
145 1.1.1.7 christos {
146 1.1.1.7 christos UINT8 *Buffer;
147 1.1.1.7 christos UINT32 Length;
148 1.1.1.7 christos UINT32 i;
149 1.1.1.7 christos
150 1.1.1.7 christos
151 1.1.1.7 christos Buffer = ((UINT8 *) Table) + BufferOffset;
152 1.1.1.7 christos Length = ByteLength - 2; /* Last two bytes are the null terminator */
153 1.1.1.7 christos
154 1.1.1.7 christos /* Ensure all low bytes are entirely printable ASCII */
155 1.1.1.7 christos
156 1.1.1.7 christos for (i = 0; i < Length; i += 2)
157 1.1.1.7 christos {
158 1.1.1.7 christos if (!isprint (Buffer[i]))
159 1.1.1.7 christos {
160 1.1.1.7 christos goto DumpRawBuffer;
161 1.1.1.7 christos }
162 1.1.1.7 christos }
163 1.1.1.7 christos
164 1.1.1.7 christos /* Ensure all high bytes are zero */
165 1.1.1.7 christos
166 1.1.1.7 christos for (i = 1; i < Length; i += 2)
167 1.1.1.7 christos {
168 1.1.1.7 christos if (Buffer[i])
169 1.1.1.7 christos {
170 1.1.1.7 christos goto DumpRawBuffer;
171 1.1.1.7 christos }
172 1.1.1.7 christos }
173 1.1.1.7 christos
174 1.1.1.7 christos /* Dump the buffer as a normal string */
175 1.1.1.7 christos
176 1.1.1.7 christos AcpiOsPrintf ("\"");
177 1.1.1.7 christos for (i = 0; i < Length; i += 2)
178 1.1.1.7 christos {
179 1.1.1.7 christos AcpiOsPrintf ("%c", Buffer[i]);
180 1.1.1.7 christos }
181 1.1.1.8 christos
182 1.1.1.7 christos AcpiOsPrintf ("\"\n");
183 1.1.1.7 christos return;
184 1.1.1.7 christos
185 1.1.1.7 christos DumpRawBuffer:
186 1.1.1.7 christos AcpiDmDumpBuffer (Table, BufferOffset, ByteLength,
187 1.1.1.7 christos BufferOffset, NULL);
188 1.1.1.7 christos AcpiOsPrintf ("\n");
189 1.1.1.7 christos }
190 1.1.1.7 christos
191 1.1.1.7 christos
192 1.1.1.7 christos /*******************************************************************************
193 1.1.1.7 christos *
194 1.1 jruoho * FUNCTION: AcpiDmDumpRsdp
195 1.1 jruoho *
196 1.1 jruoho * PARAMETERS: Table - A RSDP
197 1.1 jruoho *
198 1.1.1.2 jruoho * RETURN: Length of the table (there is not always a length field,
199 1.1.1.2 jruoho * use revision or length if available (ACPI 2.0+))
200 1.1 jruoho *
201 1.1 jruoho * DESCRIPTION: Format the contents of a RSDP
202 1.1 jruoho *
203 1.1 jruoho ******************************************************************************/
204 1.1 jruoho
205 1.1 jruoho UINT32
206 1.1 jruoho AcpiDmDumpRsdp (
207 1.1 jruoho ACPI_TABLE_HEADER *Table)
208 1.1 jruoho {
209 1.1.1.2 jruoho ACPI_TABLE_RSDP *Rsdp = ACPI_CAST_PTR (ACPI_TABLE_RSDP, Table);
210 1.1.1.2 jruoho UINT32 Length = sizeof (ACPI_RSDP_COMMON);
211 1.1.1.2 jruoho UINT8 Checksum;
212 1.1.1.7 christos ACPI_STATUS Status;
213 1.1 jruoho
214 1.1 jruoho
215 1.1 jruoho /* Dump the common ACPI 1.0 portion */
216 1.1 jruoho
217 1.1.1.7 christos Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRsdp1);
218 1.1.1.7 christos if (ACPI_FAILURE (Status))
219 1.1.1.7 christos {
220 1.1.1.7 christos return (Length);
221 1.1.1.7 christos }
222 1.1 jruoho
223 1.1.1.2 jruoho /* Validate the first checksum */
224 1.1 jruoho
225 1.1.1.2 jruoho Checksum = AcpiDmGenerateChecksum (Rsdp, sizeof (ACPI_RSDP_COMMON),
226 1.1.1.8 christos Rsdp->Checksum);
227 1.1.1.2 jruoho if (Checksum != Rsdp->Checksum)
228 1.1 jruoho {
229 1.1.1.2 jruoho AcpiOsPrintf ("/* Incorrect Checksum above, should be 0x%2.2X */\n",
230 1.1.1.2 jruoho Checksum);
231 1.1.1.2 jruoho }
232 1.1.1.2 jruoho
233 1.1.1.2 jruoho /* The RSDP for ACPI 2.0+ contains more data and has a Length field */
234 1.1.1.2 jruoho
235 1.1.1.2 jruoho if (Rsdp->Revision > 0)
236 1.1.1.2 jruoho {
237 1.1.1.2 jruoho Length = Rsdp->Length;
238 1.1.1.7 christos Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRsdp2);
239 1.1.1.7 christos if (ACPI_FAILURE (Status))
240 1.1.1.7 christos {
241 1.1.1.7 christos return (Length);
242 1.1.1.7 christos }
243 1.1.1.2 jruoho
244 1.1.1.2 jruoho /* Validate the extended checksum over entire RSDP */
245 1.1.1.2 jruoho
246 1.1.1.2 jruoho Checksum = AcpiDmGenerateChecksum (Rsdp, sizeof (ACPI_TABLE_RSDP),
247 1.1.1.8 christos Rsdp->ExtendedChecksum);
248 1.1.1.2 jruoho if (Checksum != Rsdp->ExtendedChecksum)
249 1.1.1.2 jruoho {
250 1.1.1.2 jruoho AcpiOsPrintf (
251 1.1.1.2 jruoho "/* Incorrect Extended Checksum above, should be 0x%2.2X */\n",
252 1.1.1.2 jruoho Checksum);
253 1.1.1.2 jruoho }
254 1.1 jruoho }
255 1.1 jruoho
256 1.1 jruoho return (Length);
257 1.1 jruoho }
258 1.1 jruoho
259 1.1 jruoho
260 1.1 jruoho /*******************************************************************************
261 1.1 jruoho *
262 1.1 jruoho * FUNCTION: AcpiDmDumpRsdt
263 1.1 jruoho *
264 1.1 jruoho * PARAMETERS: Table - A RSDT
265 1.1 jruoho *
266 1.1 jruoho * RETURN: None
267 1.1 jruoho *
268 1.1 jruoho * DESCRIPTION: Format the contents of a RSDT
269 1.1 jruoho *
270 1.1 jruoho ******************************************************************************/
271 1.1 jruoho
272 1.1 jruoho void
273 1.1 jruoho AcpiDmDumpRsdt (
274 1.1 jruoho ACPI_TABLE_HEADER *Table)
275 1.1 jruoho {
276 1.1 jruoho UINT32 *Array;
277 1.1 jruoho UINT32 Entries;
278 1.1 jruoho UINT32 Offset;
279 1.1 jruoho UINT32 i;
280 1.1 jruoho
281 1.1 jruoho
282 1.1 jruoho /* Point to start of table pointer array */
283 1.1 jruoho
284 1.1 jruoho Array = ACPI_CAST_PTR (ACPI_TABLE_RSDT, Table)->TableOffsetEntry;
285 1.1 jruoho Offset = sizeof (ACPI_TABLE_HEADER);
286 1.1 jruoho
287 1.1 jruoho /* RSDT uses 32-bit pointers */
288 1.1 jruoho
289 1.1 jruoho Entries = (Table->Length - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT32);
290 1.1 jruoho
291 1.1 jruoho for (i = 0; i < Entries; i++)
292 1.1 jruoho {
293 1.1 jruoho AcpiDmLineHeader2 (Offset, sizeof (UINT32), "ACPI Table Address", i);
294 1.1 jruoho AcpiOsPrintf ("%8.8X\n", Array[i]);
295 1.1 jruoho Offset += sizeof (UINT32);
296 1.1 jruoho }
297 1.1 jruoho }
298 1.1 jruoho
299 1.1 jruoho
300 1.1 jruoho /*******************************************************************************
301 1.1 jruoho *
302 1.1 jruoho * FUNCTION: AcpiDmDumpXsdt
303 1.1 jruoho *
304 1.1 jruoho * PARAMETERS: Table - A XSDT
305 1.1 jruoho *
306 1.1 jruoho * RETURN: None
307 1.1 jruoho *
308 1.1 jruoho * DESCRIPTION: Format the contents of a XSDT
309 1.1 jruoho *
310 1.1 jruoho ******************************************************************************/
311 1.1 jruoho
312 1.1 jruoho void
313 1.1 jruoho AcpiDmDumpXsdt (
314 1.1 jruoho ACPI_TABLE_HEADER *Table)
315 1.1 jruoho {
316 1.1 jruoho UINT64 *Array;
317 1.1 jruoho UINT32 Entries;
318 1.1 jruoho UINT32 Offset;
319 1.1 jruoho UINT32 i;
320 1.1 jruoho
321 1.1 jruoho
322 1.1 jruoho /* Point to start of table pointer array */
323 1.1 jruoho
324 1.1 jruoho Array = ACPI_CAST_PTR (ACPI_TABLE_XSDT, Table)->TableOffsetEntry;
325 1.1 jruoho Offset = sizeof (ACPI_TABLE_HEADER);
326 1.1 jruoho
327 1.1 jruoho /* XSDT uses 64-bit pointers */
328 1.1 jruoho
329 1.1 jruoho Entries = (Table->Length - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT64);
330 1.1 jruoho
331 1.1 jruoho for (i = 0; i < Entries; i++)
332 1.1 jruoho {
333 1.1 jruoho AcpiDmLineHeader2 (Offset, sizeof (UINT64), "ACPI Table Address", i);
334 1.1 jruoho AcpiOsPrintf ("%8.8X%8.8X\n", ACPI_FORMAT_UINT64 (Array[i]));
335 1.1 jruoho Offset += sizeof (UINT64);
336 1.1 jruoho }
337 1.1 jruoho }
338 1.1 jruoho
339 1.1 jruoho
340 1.1 jruoho /*******************************************************************************
341 1.1 jruoho *
342 1.1 jruoho * FUNCTION: AcpiDmDumpFadt
343 1.1 jruoho *
344 1.1 jruoho * PARAMETERS: Table - A FADT
345 1.1 jruoho *
346 1.1 jruoho * RETURN: None
347 1.1 jruoho *
348 1.1 jruoho * DESCRIPTION: Format the contents of a FADT
349 1.1 jruoho *
350 1.1.1.2 jruoho * NOTE: We cannot depend on the FADT version to indicate the actual
351 1.1.1.2 jruoho * contents of the FADT because of BIOS bugs. The table length
352 1.1.1.2 jruoho * is the only reliable indicator.
353 1.1.1.2 jruoho *
354 1.1 jruoho ******************************************************************************/
355 1.1 jruoho
356 1.1 jruoho void
357 1.1 jruoho AcpiDmDumpFadt (
358 1.1 jruoho ACPI_TABLE_HEADER *Table)
359 1.1 jruoho {
360 1.1.1.7 christos ACPI_STATUS Status;
361 1.1 jruoho
362 1.1 jruoho
363 1.1.1.11 christos /* Always dump the minimum FADT revision 1 fields (ACPI 1.0) */
364 1.1.1.10 christos
365 1.1.1.11 christos Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
366 1.1.1.11 christos AcpiDmTableInfoFadt1);
367 1.1.1.11 christos if (ACPI_FAILURE (Status))
368 1.1.1.7 christos {
369 1.1.1.7 christos return;
370 1.1.1.7 christos }
371 1.1 jruoho
372 1.1.1.11 christos /* Check for FADT revision 2 fields (ACPI 1.0B MS extensions) */
373 1.1.1.11 christos
374 1.1.1.11 christos if ((Table->Length > ACPI_FADT_V1_SIZE) &&
375 1.1.1.11 christos (Table->Length <= ACPI_FADT_V2_SIZE))
376 1.1.1.10 christos {
377 1.1.1.11 christos Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
378 1.1.1.11 christos AcpiDmTableInfoFadt2);
379 1.1.1.11 christos if (ACPI_FAILURE (Status))
380 1.1.1.7 christos {
381 1.1.1.11 christos return;
382 1.1.1.7 christos }
383 1.1 jruoho }
384 1.1 jruoho
385 1.1.1.11 christos /* Check for FADT revision 3/4 fields and up (ACPI 2.0+ extended data) */
386 1.1.1.11 christos
387 1.1.1.11 christos else if (Table->Length > ACPI_FADT_V2_SIZE)
388 1.1 jruoho {
389 1.1.1.11 christos Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
390 1.1.1.11 christos AcpiDmTableInfoFadt3);
391 1.1.1.11 christos if (ACPI_FAILURE (Status))
392 1.1.1.7 christos {
393 1.1.1.11 christos return;
394 1.1.1.7 christos }
395 1.1.1.4 christos
396 1.1.1.11 christos /* Check for FADT revision 5 fields and up (ACPI 5.0+) */
397 1.1.1.4 christos
398 1.1.1.11 christos if (Table->Length > ACPI_FADT_V3_SIZE)
399 1.1.1.4 christos {
400 1.1.1.11 christos Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
401 1.1.1.11 christos AcpiDmTableInfoFadt5);
402 1.1.1.11 christos if (ACPI_FAILURE (Status))
403 1.1.1.11 christos {
404 1.1.1.11 christos return;
405 1.1.1.11 christos }
406 1.1.1.7 christos }
407 1.1.1.7 christos
408 1.1.1.11 christos /* Check for FADT revision 6 fields and up (ACPI 6.0+) */
409 1.1.1.11 christos
410 1.1.1.11 christos if (Table->Length > ACPI_FADT_V3_SIZE)
411 1.1.1.7 christos {
412 1.1.1.11 christos Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
413 1.1.1.11 christos AcpiDmTableInfoFadt6);
414 1.1.1.11 christos if (ACPI_FAILURE (Status))
415 1.1.1.11 christos {
416 1.1.1.11 christos return;
417 1.1.1.11 christos }
418 1.1.1.4 christos }
419 1.1 jruoho }
420 1.1 jruoho
421 1.1.1.11 christos /* Validate various fields in the FADT, including length */
422 1.1 jruoho
423 1.1 jruoho AcpiTbCreateLocalFadt (Table, Table->Length);
424 1.1.1.11 christos
425 1.1.1.11 christos /* Validate FADT length against the revision */
426 1.1.1.11 christos
427 1.1.1.11 christos AcpiDmValidateFadtLength (Table->Revision, Table->Length);
428 1.1.1.11 christos }
429 1.1.1.11 christos
430 1.1.1.11 christos
431 1.1.1.11 christos /*******************************************************************************
432 1.1.1.11 christos *
433 1.1.1.11 christos * FUNCTION: AcpiDmValidateFadtLength
434 1.1.1.11 christos *
435 1.1.1.11 christos * PARAMETERS: Revision - FADT revision (Header->Revision)
436 1.1.1.11 christos * Length - FADT length (Header->Length
437 1.1.1.11 christos *
438 1.1.1.11 christos * RETURN: None
439 1.1.1.11 christos *
440 1.1.1.11 christos * DESCRIPTION: Check the FADT revision against the expected table length for
441 1.1.1.11 christos * that revision. Issue a warning if the length is not what was
442 1.1.1.11 christos * expected. This seems to be such a common BIOS bug that the
443 1.1.1.11 christos * FADT revision has been rendered virtually meaningless.
444 1.1.1.11 christos *
445 1.1.1.11 christos ******************************************************************************/
446 1.1.1.11 christos
447 1.1.1.11 christos static void
448 1.1.1.11 christos AcpiDmValidateFadtLength (
449 1.1.1.11 christos UINT32 Revision,
450 1.1.1.11 christos UINT32 Length)
451 1.1.1.11 christos {
452 1.1.1.11 christos UINT32 ExpectedLength;
453 1.1.1.11 christos
454 1.1.1.11 christos
455 1.1.1.11 christos switch (Revision)
456 1.1.1.11 christos {
457 1.1.1.11 christos case 0:
458 1.1.1.11 christos
459 1.1.1.11 christos AcpiOsPrintf ("// ACPI Warning: Invalid FADT revision: 0\n");
460 1.1.1.11 christos return;
461 1.1.1.11 christos
462 1.1.1.11 christos case 1:
463 1.1.1.11 christos
464 1.1.1.11 christos ExpectedLength = ACPI_FADT_V1_SIZE;
465 1.1.1.11 christos break;
466 1.1.1.11 christos
467 1.1.1.11 christos case 2:
468 1.1.1.11 christos
469 1.1.1.11 christos ExpectedLength = ACPI_FADT_V2_SIZE;
470 1.1.1.11 christos break;
471 1.1.1.11 christos
472 1.1.1.11 christos case 3:
473 1.1.1.11 christos case 4:
474 1.1.1.11 christos
475 1.1.1.11 christos ExpectedLength = ACPI_FADT_V3_SIZE;
476 1.1.1.11 christos break;
477 1.1.1.11 christos
478 1.1.1.11 christos case 5:
479 1.1.1.11 christos
480 1.1.1.11 christos ExpectedLength = ACPI_FADT_V5_SIZE;
481 1.1.1.11 christos break;
482 1.1.1.11 christos
483 1.1.1.11 christos default:
484 1.1.1.11 christos
485 1.1.1.11 christos return;
486 1.1.1.11 christos }
487 1.1.1.11 christos
488 1.1.1.11 christos if (Length == ExpectedLength)
489 1.1.1.11 christos {
490 1.1.1.11 christos return;
491 1.1.1.11 christos }
492 1.1.1.11 christos
493 1.1.1.11 christos AcpiOsPrintf (
494 1.1.1.11 christos "\n// ACPI Warning: FADT revision %X does not match length: "
495 1.1.1.11 christos "found %X expected %X\n",
496 1.1.1.11 christos Revision, Length, ExpectedLength);
497 1.1 jruoho }
498