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 262... Line 262...
262
ACPI_STATUS
262
ACPI_STATUS
263
DtCompileRsdp (
263
DtCompileRsdp (
264
    DT_FIELD                **PFieldList)
264
    DT_FIELD                **PFieldList)
265
{
265
{
266
    DT_SUBTABLE             *Subtable;
266
    DT_SUBTABLE             *Subtable;
267
    ACPI_TABLE_RSDP         *Table;
267
    ACPI_TABLE_RSDP         *Rsdp;
-
 
268
    ACPI_RSDP_EXTENSION     *RsdpExtension;
268
    ACPI_STATUS             Status;
269
    ACPI_STATUS             Status;
Line -... Line 270...
-
 
270
 
-
 
271
 
269
 
272
    /* Compile the "common" RSDP (ACPI 1.0) */
270
 
273
 
271
    Status = DtCompileTable (PFieldList, AcpiDmTableInfoRsdp1,
274
    Status = DtCompileTable (PFieldList, AcpiDmTableInfoRsdp1,
272
                &Gbl_RootTable, TRUE);
275
                &Gbl_RootTable, TRUE);
273
    if (ACPI_FAILURE (Status))
276
    if (ACPI_FAILURE (Status))
274
    {
277
    {
Line 275... Line 278...
275
        return (Status);
278
        return (Status);
276
    }
279
    }
Line 277... Line 280...
277
 
280
 
278
    Table = ACPI_CAST_PTR (ACPI_TABLE_RSDP, Gbl_RootTable->Buffer);
281
    Rsdp = ACPI_CAST_PTR (ACPI_TABLE_RSDP, Gbl_RootTable->Buffer);
-
 
282
    DtSetTableChecksum (&Rsdp->Checksum);
-
 
283
 
279
    DtSetTableChecksum (&Table->Checksum);
284
    if (Rsdp->Revision > 0)
280
 
285
    {
281
    if (Table->Revision > 0)
286
        /* Compile the "extended" part of the RSDP as a subtable */
282
    {
287
 
283
        Status = DtCompileTable (PFieldList, AcpiDmTableInfoRsdp2,
288
        Status = DtCompileTable (PFieldList, AcpiDmTableInfoRsdp2,
284
                    &Subtable, TRUE);
289
                    &Subtable, TRUE);
Line 285... Line 290...
285
        if (ACPI_FAILURE (Status))
290
        if (ACPI_FAILURE (Status))
-
 
291
        {
-
 
292
            return (Status);
-
 
293
        }
-
 
294
 
-
 
295
        DtInsertSubtable (Gbl_RootTable, Subtable);
286
        {
296
 
287
            return (Status);
297
        /* Set length and extended checksum for entire RSDP */
Line 288... Line 298...
288
        }
298
 
289
 
299
        RsdpExtension = ACPI_CAST_PTR (ACPI_RSDP_EXTENSION, Subtable->Buffer);
Line 1194... Line 1204...
1194
}
1204
}
Line 1195... Line 1205...
1195
 
1205
 
1196
 
1206
 
-
 
1207
/******************************************************************************
-
 
1208
 *
-
 
1209
 * FUNCTION:    DtCompileSlic
-
 
1210
 *
-
 
1211
 * PARAMETERS:  List                - Current field list pointer
-
 
1212
 *
-
 
1213
 * RETURN:      Status
-
 
1214
 *
-
 
1215
 * DESCRIPTION: Compile SLIC.
-
 
1216
 *
-
 
1217
 *****************************************************************************/
-
 
1218
 
-
 
1219
ACPI_STATUS
-
 
1220
DtCompileSlic (
-
 
1221
    void                    **List)
-
 
1222
{
-
 
1223
    ACPI_STATUS             Status;
-
 
1224
    DT_SUBTABLE             *Subtable;
-
 
1225
    DT_SUBTABLE             *ParentTable;
-
 
1226
    DT_FIELD                **PFieldList = (DT_FIELD **) List;
-
 
1227
    DT_FIELD                *SubtableStart;
-
 
1228
    ACPI_SLIC_HEADER        *SlicHeader;
-
 
1229
    ACPI_DMTABLE_INFO       *InfoTable;
-
 
1230
 
-
 
1231
 
-
 
1232
    while (*PFieldList)
-
 
1233
    {
-
 
1234
        SubtableStart = *PFieldList;
-
 
1235
        Status = DtCompileTable (PFieldList, AcpiDmTableInfoSlicHdr,
-
 
1236
                    &Subtable, TRUE);
-
 
1237
        if (ACPI_FAILURE (Status))
-
 
1238
        {
-
 
1239
            return (Status);
-
 
1240
        }
-
 
1241
 
-
 
1242
        ParentTable = DtPeekSubtable ();
-
 
1243
        DtInsertSubtable (ParentTable, Subtable);
-
 
1244
        DtPushSubtable (Subtable);
-
 
1245
 
-
 
1246
        SlicHeader = ACPI_CAST_PTR (ACPI_SLIC_HEADER, Subtable->Buffer);
-
 
1247
 
-
 
1248
        switch (SlicHeader->Type)
-
 
1249
        {
-
 
1250
        case ACPI_SLIC_TYPE_PUBLIC_KEY:
-
 
1251
            InfoTable = AcpiDmTableInfoSlic0;
-
 
1252
            break;
-
 
1253
        case ACPI_SLIC_TYPE_WINDOWS_MARKER:
-
 
1254
            InfoTable = AcpiDmTableInfoSlic1;
-
 
1255
            break;
-
 
1256
        default:
-
 
1257
            DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "SLIC");
-
 
1258
            return (AE_ERROR);
-
 
1259
        }
-
 
1260
 
-
 
1261
        Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE);
-
 
1262
        if (ACPI_FAILURE (Status))
-
 
1263
        {
-
 
1264
            return (Status);
-
 
1265
        }
-
 
1266
 
-
 
1267
        ParentTable = DtPeekSubtable ();
-
 
1268
        DtInsertSubtable (ParentTable, Subtable);
-
 
1269
        DtPopSubtable ();
-
 
1270
    }
-
 
1271
 
-
 
1272
    return (AE_OK);
-
 
1273
}
-
 
1274
 
-
 
1275
 
1197
/******************************************************************************
1276
/******************************************************************************
1198
 *
1277
 *
1199
 * FUNCTION:    DtCompileSlit
1278
 * FUNCTION:    DtCompileSlit
1200
 *
1279
 *
1201
 * PARAMETERS:  List                - Current field list pointer
1280
 * PARAMETERS:  List                - Current field list pointer
Line 1215... Line 1294...
1215
    DT_SUBTABLE             *ParentTable;
1294
    DT_SUBTABLE             *ParentTable;
1216
    DT_FIELD                **PFieldList = (DT_FIELD **) List;
1295
    DT_FIELD                **PFieldList = (DT_FIELD **) List;
1217
    DT_FIELD                *FieldList;
1296
    DT_FIELD                *FieldList;
1218
    UINT32                  Localities;
1297
    UINT32                  Localities;
1219
    UINT8                   *LocalityBuffer;
1298
    UINT8                   *LocalityBuffer;
1220
    UINT32                  RemainingData;
-
 
Line 1221... Line 1299...
1221
 
1299
 
1222
 
1300
 
1223
    Status = DtCompileTable (PFieldList, AcpiDmTableInfoSlit,
1301
    Status = DtCompileTable (PFieldList, AcpiDmTableInfoSlit,
Line 1231... Line 1309...
1231
    DtInsertSubtable (ParentTable, Subtable);
1309
    DtInsertSubtable (ParentTable, Subtable);
Line 1232... Line 1310...
1232
 
1310
 
1233
    Localities = *ACPI_CAST_PTR (UINT32, Subtable->Buffer);
1311
    Localities = *ACPI_CAST_PTR (UINT32, Subtable->Buffer);
Line -... Line 1312...
-
 
1312
    LocalityBuffer = UtLocalCalloc (Localities);
-
 
1313
 
1234
    LocalityBuffer = UtLocalCalloc (Localities);
1314
    /* Compile each locality buffer */
1235
 
1315
 
1236
    FieldList = *PFieldList;
1316
    FieldList = *PFieldList;
1237
    while (FieldList)
-
 
1238
    {
-
 
1239
        /* Handle multiple-line buffer */
1317
    while (FieldList)
1240
 
-
 
1241
        RemainingData = Localities;
-
 
1242
        while (RemainingData && FieldList)
-
 
1243
        {
-
 
1244
            RemainingData = DtCompileBuffer (
1318
    {
1245
                LocalityBuffer + (Localities - RemainingData),
-
 
1246
                FieldList->Value, FieldList, RemainingData);
-
 
Line 1247... Line 1319...
1247
            FieldList = FieldList->Next;
1319
        DtCompileBuffer (LocalityBuffer,
1248
        }
1320
            FieldList->Value, FieldList, Localities);
-
 
1321
 
1249
 
1322
        DtCreateSubtable (LocalityBuffer, Localities, &Subtable);
Line 1250... Line 1323...
1250
        DtCreateSubtable (LocalityBuffer, Localities, &Subtable);
1323
        DtInsertSubtable (ParentTable, Subtable);
1251
        DtInsertSubtable (ParentTable, Subtable);
1324
        FieldList = FieldList->Next;
1252
    }
1325
    }
Line 1338... Line 1411...
1338
}
1411
}
Line 1339... Line 1412...
1339
 
1412
 
1340
 
1413
 
-
 
1414
/******************************************************************************
-
 
1415
 *
-
 
1416
 * FUNCTION:    DtGetGenericTableInfo
-
 
1417
 *
-
 
1418
 * PARAMETERS:  Name                - Generic type name
-
 
1419
 *
-
 
1420
 * RETURN:      Info entry
-
 
1421
 *
-
 
1422
 * DESCRIPTION: Obtain table info for a generic name entry
-
 
1423
 *
-
 
1424
 *****************************************************************************/
-
 
1425
 
-
 
1426
ACPI_DMTABLE_INFO *
-
 
1427
DtGetGenericTableInfo (
-
 
1428
    char                    *Name)
-
 
1429
{
-
 
1430
    ACPI_DMTABLE_INFO       *Info;
-
 
1431
    UINT32                  i;
-
 
1432
 
-
 
1433
 
-
 
1434
    if (!Name)
-
 
1435
    {
-
 
1436
        return (NULL);
-
 
1437
    }
-
 
1438
 
-
 
1439
    /* Search info table for name match */
-
 
1440
 
-
 
1441
    for (i = 0; ; i++)
-
 
1442
    {
-
 
1443
        Info = AcpiDmTableInfoGeneric[i];
-
 
1444
        if (Info->Opcode == ACPI_DMT_EXIT)
-
 
1445
        {
-
 
1446
            Info = NULL;
-
 
1447
            break;
-
 
1448
        }
-
 
1449
 
-
 
1450
        if (!ACPI_STRCMP (Name, Info->Name))
-
 
1451
        {
-
 
1452
            break;
-
 
1453
        }
-
 
1454
    }
-
 
1455
 
-
 
1456
    return (Info);
-
 
1457
}
-
 
1458
 
-
 
1459
 
-
 
1460
/******************************************************************************
-
 
1461
 *
-
 
1462
 * FUNCTION:    DtCompileUefi
-
 
1463
 *
-
 
1464
 * PARAMETERS:  List                - Current field list pointer
-
 
1465
 *
-
 
1466
 * RETURN:      Status
-
 
1467
 *
-
 
1468
 * DESCRIPTION: Compile UEFI.
-
 
1469
 *
-
 
1470
 *****************************************************************************/
-
 
1471
 
-
 
1472
ACPI_STATUS
-
 
1473
DtCompileUefi (
-
 
1474
    void                    **List)
-
 
1475
{
-
 
1476
    ACPI_STATUS             Status;
-
 
1477
    DT_SUBTABLE             *Subtable;
-
 
1478
    DT_SUBTABLE             *ParentTable;
-
 
1479
    DT_FIELD                **PFieldList = (DT_FIELD **) List;
-
 
1480
    UINT16                  *DataOffset;
-
 
1481
 
-
 
1482
 
-
 
1483
    /* Compile the predefined portion of the UEFI table */
-
 
1484
 
-
 
1485
    Status = DtCompileTable (PFieldList, AcpiDmTableInfoUefi,
-
 
1486
                &Subtable, TRUE);
-
 
1487
    if (ACPI_FAILURE (Status))
-
 
1488
    {
-
 
1489
        return (Status);
-
 
1490
    }
-
 
1491
 
-
 
1492
    DataOffset = (UINT16 *) (Subtable->Buffer + 16);
-
 
1493
    *DataOffset = sizeof (ACPI_TABLE_UEFI);
-
 
1494
 
-
 
1495
    ParentTable = DtPeekSubtable ();
-
 
1496
    DtInsertSubtable (ParentTable, Subtable);
-
 
1497
 
-
 
1498
    /*
-
 
1499
     * Compile the "generic" portion of the UEFI table. This
-
 
1500
     * part of the table is not predefined and any of the generic
-
 
1501
     * operators may be used.
-
 
1502
     */
-
 
1503
 
-
 
1504
    DtCompileGeneric ((void **) PFieldList);
-
 
1505
 
-
 
1506
    return (AE_OK);
-
 
1507
}
-
 
1508
 
-
 
1509
 
1341
/******************************************************************************
1510
/******************************************************************************
1342
 *
1511
 *
1343
 * FUNCTION:    DtCompileWdat
1512
 * FUNCTION:    DtCompileWdat
1344
 *
1513
 *
1345
 * PARAMETERS:  List                - Current field list pointer
1514
 * PARAMETERS:  List                - Current field list pointer
Line 1395... Line 1564...
1395
        FieldList = FieldList->Next;
1564
        FieldList = FieldList->Next;
1396
    }
1565
    }
Line 1397... Line 1566...
1397
 
1566
 
1398
    return (AE_OK);
1567
    return (AE_OK);
-
 
1568
}
-
 
1569
 
-
 
1570
 
-
 
1571
/******************************************************************************
-
 
1572
 *
-
 
1573
 * FUNCTION:    DtCompileGeneric
-
 
1574
 *
-
 
1575
 * PARAMETERS:  List                - Current field list pointer
-
 
1576
 *
-
 
1577
 * RETURN:      Status
-
 
1578
 *
-
 
1579
 * DESCRIPTION: Compile generic unknown table.
-
 
1580
 *
-
 
1581
 *****************************************************************************/
-
 
1582
 
-
 
1583
ACPI_STATUS
-
 
1584
DtCompileGeneric (
-
 
1585
    void                    **List)
-
 
1586
{
-
 
1587
    ACPI_STATUS             Status;
-
 
1588
    DT_SUBTABLE             *Subtable;
-
 
1589
    DT_SUBTABLE             *ParentTable;
-
 
1590
    DT_FIELD                **PFieldList = (DT_FIELD **) List;
-
 
1591
    ACPI_DMTABLE_INFO       *Info;
-
 
1592
 
-
 
1593
 
-
 
1594
    ParentTable = DtPeekSubtable ();
-
 
1595
 
-
 
1596
    /*
-
 
1597
     * Compile the "generic" portion of the table. This
-
 
1598
     * part of the table is not predefined and any of the generic
-
 
1599
     * operators may be used.
-
 
1600
     */
-
 
1601
 
-
 
1602
    /* Find any and all labels in the entire generic portion */
-
 
1603
 
-
 
1604
    DtDetectAllLabels (*PFieldList);
-
 
1605
 
-
 
1606
    /* Now we can actually compile the parse tree */
-
 
1607
 
-
 
1608
    while (*PFieldList)
-
 
1609
    {
-
 
1610
        Info = DtGetGenericTableInfo ((*PFieldList)->Name);
-
 
1611
        if (!Info)
-
 
1612
        {
-
 
1613
            sprintf (MsgBuffer, "Generic data type \"%s\" not found",
-
 
1614
                (*PFieldList)->Name);
-
 
1615
            DtNameError (ASL_ERROR, ASL_MSG_INVALID_FIELD_NAME,
-
 
1616
                (*PFieldList), MsgBuffer);
-
 
1617
 
-
 
1618
            *PFieldList = (*PFieldList)->Next;
-
 
1619
            continue;
-
 
1620
        }
-
 
1621
 
-
 
1622
        Status = DtCompileTable (PFieldList, Info,
-
 
1623
                    &Subtable, TRUE);
-
 
1624
        if (ACPI_SUCCESS (Status))
-
 
1625
        {
-
 
1626
            DtInsertSubtable (ParentTable, Subtable);
-
 
1627
        }
-
 
1628
        else
-
 
1629
        {
-
 
1630
            *PFieldList = (*PFieldList)->Next;
-
 
1631
 
-
 
1632
            if (Status == AE_NOT_FOUND)
-
 
1633
            {
-
 
1634
                sprintf (MsgBuffer, "Generic data type \"%s\" not found",
-
 
1635
                    (*PFieldList)->Name);
-
 
1636
                DtNameError (ASL_ERROR, ASL_MSG_INVALID_FIELD_NAME,
-
 
1637
                    (*PFieldList), MsgBuffer);
-
 
1638
            }
-
 
1639
        }
-
 
1640
    }
-
 
1641
 
-
 
1642
    return (AE_OK);