Subversion Repositories Kolibri OS

Rev

Rev 1498 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1498 Rev 2216
Line 6... Line 6...
6
 
6
 
7
/******************************************************************************
7
/******************************************************************************
8
 *
8
 *
9
 * 1. Copyright Notice
9
 * 1. Copyright Notice
10
 *
10
 *
11
 * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
11
 * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
12
 * All rights reserved.
12
 * All rights reserved.
13
 *
13
 *
14
 * 2. License
14
 * 2. License
15
 *
15
 *
Line 122... Line 122...
122
 
122
 
123
#define _COMPONENT          ACPI_CA_DISASSEMBLER
123
#define _COMPONENT          ACPI_CA_DISASSEMBLER
Line -... Line 124...
-
 
124
        ACPI_MODULE_NAME    ("dmtbdump")
-
 
125
 
-
 
126
 
-
 
127
static void
-
 
128
AcpiDmValidateFadtLength (
-
 
129
    UINT32                  Revision,
124
        ACPI_MODULE_NAME    ("dmtbdump")
130
    UINT32                  Length);
125
 
131
 
126
 
132
 
127
/*******************************************************************************
133
/*******************************************************************************
128
 *
134
 *
129
 * FUNCTION:    AcpiDmDumpRsdp
135
 * FUNCTION:    AcpiDmDumpRsdp
130
 *
136
 *
-
 
137
 * PARAMETERS:  Table               - A RSDP
131
 * PARAMETERS:  Table               - A RSDP
138
 *
132
 *
139
 * RETURN:      Length of the table (there is not always a length field,
133
 * RETURN:      Length of the table (there is no length field, use revision)
140
 *              use revision or length if available (ACPI 2.0+))
134
 *
141
 *
Line 135... Line 142...
135
 * DESCRIPTION: Format the contents of a RSDP
142
 * DESCRIPTION: Format the contents of a RSDP
136
 *
143
 *
137
 ******************************************************************************/
144
 ******************************************************************************/
138
 
145
 
-
 
146
UINT32
139
UINT32
147
AcpiDmDumpRsdp (
-
 
148
    ACPI_TABLE_HEADER       *Table)
Line 140... Line 149...
140
AcpiDmDumpRsdp (
149
{
Line 141... Line 150...
141
    ACPI_TABLE_HEADER       *Table)
150
    ACPI_TABLE_RSDP         *Rsdp = ACPI_CAST_PTR (ACPI_TABLE_RSDP, Table);
Line 142... Line 151...
142
{
151
    UINT32                  Length = sizeof (ACPI_RSDP_COMMON);
Line 143... Line 152...
143
    UINT32                  Length = ACPI_RSDP_REV0_SIZE;
152
    UINT8                   Checksum;
-
 
153
 
-
 
154
 
144
 
155
    /* Dump the common ACPI 1.0 portion */
-
 
156
 
-
 
157
    AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRsdp1);
-
 
158
 
-
 
159
    /* Validate the first checksum */
-
 
160
 
-
 
161
    Checksum = AcpiDmGenerateChecksum (Rsdp, sizeof (ACPI_RSDP_COMMON),
-
 
162
                Rsdp->Checksum);
-
 
163
    if (Checksum != Rsdp->Checksum)
145
 
164
    {
146
    /* Dump the common ACPI 1.0 portion */
165
        AcpiOsPrintf ("/* Incorrect Checksum above, should be 0x%2.2X */\n",
-
 
166
            Checksum);
-
 
167
    }
-
 
168
 
-
 
169
    /* The RSDP for ACPI 2.0+ contains more data and has a Length field */
-
 
170
 
-
 
171
    if (Rsdp->Revision > 0)
-
 
172
    {
-
 
173
        Length = Rsdp->Length;
-
 
174
        AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRsdp2);
-
 
175
 
-
 
176
        /* Validate the extended checksum over entire RSDP */
147
 
177
 
Line 148... Line 178...
148
    AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRsdp1);
178
        Checksum = AcpiDmGenerateChecksum (Rsdp, sizeof (ACPI_TABLE_RSDP),
149
 
179
                    Rsdp->ExtendedChecksum);
Line 247... Line 277...
247
 *
277
 *
248
 * RETURN:      None
278
 * RETURN:      None
249
 *
279
 *
250
 * DESCRIPTION: Format the contents of a FADT
280
 * DESCRIPTION: Format the contents of a FADT
251
 *
281
 *
-
 
282
 * NOTE:        We cannot depend on the FADT version to indicate the actual
-
 
283
 *              contents of the FADT because of BIOS bugs. The table length
-
 
284
 *              is the only reliable indicator.
-
 
285
 *
252
 ******************************************************************************/
286
 ******************************************************************************/
Line 253... Line 287...
253
 
287
 
254
void
288
void
255
AcpiDmDumpFadt (
289
AcpiDmDumpFadt (
256
    ACPI_TABLE_HEADER       *Table)
290
    ACPI_TABLE_HEADER       *Table)
Line 257... Line 291...
257
{
291
{
Line 258... Line 292...
258
 
292
 
Line 259... Line 293...
259
    /* Common ACPI 1.0 portion of FADT */
293
    /* Always dump the minimum FADT revision 1 fields (ACPI 1.0) */
Line 260... Line 294...
260
 
294
 
-
 
295
    AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt1);
261
    AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt1);
296
 
262
 
297
    /* Check for FADT revision 2 fields (ACPI 1.0B MS extensions) */
263
    /* Check for ACPI 1.0B MS extensions (FADT revision 2) */
298
 
Line 264... Line 299...
264
 
299
    if ((Table->Length > ACPI_FADT_V1_SIZE) &&
Line 265... Line 300...
265
    if (Table->Revision == 2)
300
        (Table->Length <= ACPI_FADT_V2_SIZE))
266
    {
301
    {
267
        AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt2);
302
        AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt2);
268
    }
303
    }
Line 269... Line 304...
269
 
304
 
Line 270... Line 305...
270
    /* Check for ACPI 2.0+ extended data (FADT revision 3+) */
305
    /* Check for FADT revision 3 fields and up (ACPI 2.0+ extended data) */
-
 
306
 
-
 
307
    else if (Table->Length > ACPI_FADT_V2_SIZE)
-
 
308
    {
-
 
309
        AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt3);
-
 
310
    }
-
 
311
 
-
 
312
    /* Validate various fields in the FADT, including length */
-
 
313
 
-
 
314
    AcpiTbCreateLocalFadt (Table, Table->Length);
-
 
315
 
-
 
316
    /* Validate FADT length against the revision */
-
 
317
 
-
 
318
    AcpiDmValidateFadtLength (Table->Revision, Table->Length);
-
 
319
}
-
 
320
 
-
 
321
 
-
 
322
/*******************************************************************************
-
 
323
 *
-
 
324
 * FUNCTION:    AcpiDmValidateFadtLength
-
 
325
 *
-
 
326
 * PARAMETERS:  Revision            - FADT revision (Header->Revision)
-
 
327
 *              Length              - FADT length (Header->Length
-
 
328
 *
-
 
329
 * RETURN:      None
-
 
330
 *
-
 
331
 * DESCRIPTION: Check the FADT revision against the expected table length for
-
 
332
 *              that revision. Issue a warning if the length is not what was
-
 
333
 *              expected. This seems to be such a common BIOS bug that the
-
 
334
 *              FADT revision has been rendered virtually meaningless.
-
 
335
 *
-
 
336
 ******************************************************************************/
-
 
337
 
-
 
338
static void
-
 
339
AcpiDmValidateFadtLength (
-
 
340
    UINT32                  Revision,
-
 
341
    UINT32                  Length)
-
 
342
{
-
 
343
    UINT32                  ExpectedLength;
-
 
344
 
-
 
345
 
-
 
346
    switch (Revision)
-
 
347
    {
-
 
348
    case 0:
-
 
349
        AcpiOsPrintf ("// ACPI Warning: Invalid FADT revision: 0\n");
-
 
350
        return;
-
 
351
 
-
 
352
    case 1:
-
 
353
        ExpectedLength = ACPI_FADT_V1_SIZE;
-
 
354
        break;
-
 
355
 
-
 
356
    case 2:
-
 
357
        ExpectedLength = ACPI_FADT_V2_SIZE;
-
 
358
        break;
-
 
359
 
-
 
360
    case 3:
-
 
361
    case 4:
-
 
362
        ExpectedLength = ACPI_FADT_V3_SIZE;
-
 
363
        break;
-
 
364
 
-
 
365
    default:
-
 
366
        return;
-
 
367
    }
271
 
368
 
Line 272... Line 369...
272
    else if (Table->Length >= sizeof (ACPI_TABLE_FADT))
369
    if (Length == ExpectedLength)
273
    {
370
    {
Line 593... Line 690...
593
                sizeof (ACPI_DMAR_DEVICE_SCOPE));
690
                sizeof (ACPI_DMAR_DEVICE_SCOPE));
Line 594... Line 691...
594
 
691
 
595
            while (PathOffset < ScopeTable->Length)
692
            while (PathOffset < ScopeTable->Length)
596
            {
693
            {
597
                AcpiDmLineHeader ((PathOffset + ScopeOffset + Offset), 2, "PCI Path");
694
                AcpiDmLineHeader ((PathOffset + ScopeOffset + Offset), 2, "PCI Path");
Line 598... Line 695...
598
                AcpiOsPrintf ("[%2.2X, %2.2X]\n", PciPath[0], PciPath[1]);
695
                AcpiOsPrintf ("%2.2X,%2.2X\n", PciPath[0], PciPath[1]);
Line 599... Line 696...
599
 
696
 
600
                /* Point to next PCI Path entry */
697
                /* Point to next PCI Path entry */
Line 707... Line 804...
707
    SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset);
804
    SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset);
708
    while (Offset < Table->Length)
805
    while (Offset < Table->Length)
709
    {
806
    {
710
        AcpiOsPrintf ("\n");
807
        AcpiOsPrintf ("\n");
711
        Status = AcpiDmDumpTable (Length, Offset, SubTable,
808
        Status = AcpiDmDumpTable (Length, Offset, SubTable,
712
                    sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoEinj0);
809
                    sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoErst0);
713
        if (ACPI_FAILURE (Status))
810
        if (ACPI_FAILURE (Status))
714
        {
811
        {
715
            return;
812
            return;
716
        }
813
        }
Line 1248... Line 1345...
1248
}
1345
}
Line 1249... Line 1346...
1249
 
1346
 
1250
 
1347
 
-
 
1348
/*******************************************************************************
-
 
1349
 *
-
 
1350
 * FUNCTION:    AcpiDmDumpSlic
-
 
1351
 *
-
 
1352
 * PARAMETERS:  Table               - A SLIC table
-
 
1353
 *
-
 
1354
 * RETURN:      None
-
 
1355
 *
-
 
1356
 * DESCRIPTION: Format the contents of a SLIC
-
 
1357
 *
-
 
1358
 ******************************************************************************/
-
 
1359
 
-
 
1360
void
-
 
1361
AcpiDmDumpSlic (
-
 
1362
    ACPI_TABLE_HEADER       *Table)
-
 
1363
{
-
 
1364
    ACPI_STATUS             Status;
-
 
1365
    UINT32                  Offset = sizeof (ACPI_TABLE_SLIC);
-
 
1366
    ACPI_SLIC_HEADER        *SubTable;
-
 
1367
    ACPI_DMTABLE_INFO       *InfoTable;
-
 
1368
 
-
 
1369
 
-
 
1370
    /* There is no main SLIC table, only subtables */
-
 
1371
 
-
 
1372
    SubTable = ACPI_ADD_PTR (ACPI_SLIC_HEADER, Table, Offset);
-
 
1373
    while (Offset < Table->Length)
-
 
1374
    {
-
 
1375
        /* Common sub-table header */
-
 
1376
 
-
 
1377
        AcpiOsPrintf ("\n");
-
 
1378
        Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
-
 
1379
                    SubTable->Length, AcpiDmTableInfoSlicHdr);
-
 
1380
        if (ACPI_FAILURE (Status))
-
 
1381
        {
-
 
1382
            return;
-
 
1383
        }
-
 
1384
 
-
 
1385
        switch (SubTable->Type)
-
 
1386
        {
-
 
1387
        case ACPI_SLIC_TYPE_PUBLIC_KEY:
-
 
1388
            InfoTable = AcpiDmTableInfoSlic0;
-
 
1389
            break;
-
 
1390
        case ACPI_SLIC_TYPE_WINDOWS_MARKER:
-
 
1391
            InfoTable = AcpiDmTableInfoSlic1;
-
 
1392
            break;
-
 
1393
        default:
-
 
1394
            AcpiOsPrintf ("\n**** Unknown SLIC sub-table type 0x%X\n", SubTable->Type);
-
 
1395
 
-
 
1396
            /* Attempt to continue */
-
 
1397
 
-
 
1398
            if (!SubTable->Length)
-
 
1399
            {
-
 
1400
                AcpiOsPrintf ("Invalid zero length subtable\n");
-
 
1401
                return;
-
 
1402
            }
-
 
1403
            goto NextSubTable;
-
 
1404
        }
-
 
1405
 
-
 
1406
        AcpiOsPrintf ("\n");
-
 
1407
        Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
-
 
1408
                    SubTable->Length, InfoTable);
-
 
1409
        if (ACPI_FAILURE (Status))
-
 
1410
        {
-
 
1411
            return;
-
 
1412
        }
-
 
1413
 
-
 
1414
NextSubTable:
-
 
1415
        /* Point to next sub-table */
-
 
1416
 
-
 
1417
        Offset += SubTable->Length;
-
 
1418
        SubTable = ACPI_ADD_PTR (ACPI_SLIC_HEADER, SubTable, SubTable->Length);
-
 
1419
    }
-
 
1420
}
-
 
1421
 
-
 
1422
 
1251
/*******************************************************************************
1423
/*******************************************************************************
1252
 *
1424
 *
1253
 * FUNCTION:    AcpiDmDumpSlit
1425
 * FUNCTION:    AcpiDmDumpSlit
1254
 *
1426
 *
1255
 * PARAMETERS:  Table               - An SLIT
1427
 * PARAMETERS:  Table               - An SLIT
Line 1304... Line 1476...
1304
            AcpiOsPrintf ("%2.2X ", Row[j]);
1476
            AcpiOsPrintf ("%2.2X", Row[j]);
1305
            Offset++;
1477
            Offset++;
Line 1306... Line 1478...
1306
 
1478
 
Line 1307... Line 1479...
1307
            /* Display up to 16 bytes per output row */
1479
            /* Display up to 16 bytes per output row */
1308
 
1480
 
1309
            if (j && (((j+1) % 16) == 0) && ((j+1) < Localities))
1481
            if ((j+1) < Localities)
-
 
1482
            {
-
 
1483
                AcpiOsPrintf (" ");
-
 
1484
 
-
 
1485
                if (j && (((j+1) % 16) == 0))
1310
            {
1486
                {
-
 
1487
                    AcpiOsPrintf ("\\\n"); /* With line continuation char */
1311
                AcpiOsPrintf ("\n");
1488
                    AcpiDmLineHeader (Offset, 0, NULL);
1312
                AcpiDmLineHeader (Offset, 0, "");
1489
                }
Line 1313... Line 1490...
1313
            }
1490
            }