Subversion Repositories Kolibri OS

Rev

Rev 1498 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1498 Rev 2216
Line 7... Line 7...
7
 
7
 
8
/******************************************************************************
8
/******************************************************************************
9
 *
9
 *
10
 * 1. Copyright Notice
10
 * 1. Copyright Notice
11
 *
11
 *
12
 * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
12
 * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
13
 * All rights reserved.
13
 * All rights reserved.
14
 *
14
 *
15
 * 2. License
15
 * 2. License
16
 *
16
 *
Line 151... Line 151...
151
AcpiNsRepair_ALR (
151
AcpiNsRepair_ALR (
152
    ACPI_PREDEFINED_DATA    *Data,
152
    ACPI_PREDEFINED_DATA    *Data,
153
    ACPI_OPERAND_OBJECT     **ReturnObjectPtr);
153
    ACPI_OPERAND_OBJECT     **ReturnObjectPtr);
Line 154... Line 154...
154
 
154
 
-
 
155
static ACPI_STATUS
-
 
156
AcpiNsRepair_CID (
-
 
157
    ACPI_PREDEFINED_DATA    *Data,
-
 
158
    ACPI_OPERAND_OBJECT     **ReturnObjectPtr);
-
 
159
 
155
static ACPI_STATUS
160
static ACPI_STATUS
156
AcpiNsRepair_FDE (
161
AcpiNsRepair_FDE (
157
    ACPI_PREDEFINED_DATA    *Data,
162
    ACPI_PREDEFINED_DATA    *Data,
Line 158... Line 163...
158
    ACPI_OPERAND_OBJECT     **ReturnObjectPtr);
163
    ACPI_OPERAND_OBJECT     **ReturnObjectPtr);
-
 
164
 
-
 
165
static ACPI_STATUS
-
 
166
AcpiNsRepair_HID (
-
 
167
    ACPI_PREDEFINED_DATA    *Data,
-
 
168
    ACPI_OPERAND_OBJECT     **ReturnObjectPtr);
159
 
169
 
160
static ACPI_STATUS
170
static ACPI_STATUS
161
AcpiNsRepair_PSS (
171
AcpiNsRepair_PSS (
Line 162... Line 172...
162
    ACPI_PREDEFINED_DATA    *Data,
172
    ACPI_PREDEFINED_DATA    *Data,
Line 194... Line 204...
194
 * perform more complex repairs.
204
 * perform more complex repairs.
195
 *
205
 *
196
 * As necessary:
206
 * As necessary:
197
 *
207
 *
198
 * _ALR: Sort the list ascending by AmbientIlluminance
208
 * _ALR: Sort the list ascending by AmbientIlluminance
-
 
209
 * _CID: Strings: uppercase all, remove any leading asterisk
199
 * _FDE: Convert Buffer of BYTEs to a Buffer of DWORDs
210
 * _FDE: Convert Buffer of BYTEs to a Buffer of DWORDs
200
 * _GTM: Convert Buffer of BYTEs to a Buffer of DWORDs
211
 * _GTM: Convert Buffer of BYTEs to a Buffer of DWORDs
-
 
212
 * _HID: Strings: uppercase all, remove any leading asterisk
201
 * _PSS: Sort the list descending by Power
213
 * _PSS: Sort the list descending by Power
202
 * _TSS: Sort the list descending by Power
214
 * _TSS: Sort the list descending by Power
203
 *
215
 *
204
 * Names that must be packages, but cannot be sorted:
216
 * Names that must be packages, but cannot be sorted:
205
 *
217
 *
Line 209... Line 221...
209
 * it to a Package of integers.
221
 * it to a Package of integers.
210
 */
222
 */
211
static const ACPI_REPAIR_INFO       AcpiNsRepairableNames[] =
223
static const ACPI_REPAIR_INFO       AcpiNsRepairableNames[] =
212
{
224
{
213
    {"_ALR", AcpiNsRepair_ALR},
225
    {"_ALR", AcpiNsRepair_ALR},
-
 
226
    {"_CID", AcpiNsRepair_CID},
214
    {"_FDE", AcpiNsRepair_FDE},
227
    {"_FDE", AcpiNsRepair_FDE},
215
    {"_GTM", AcpiNsRepair_FDE},     /* _GTM has same repair as _FDE */
228
    {"_GTM", AcpiNsRepair_FDE},     /* _GTM has same repair as _FDE */
-
 
229
    {"_HID", AcpiNsRepair_HID},
216
    {"_PSS", AcpiNsRepair_PSS},
230
    {"_PSS", AcpiNsRepair_PSS},
217
    {"_TSS", AcpiNsRepair_TSS},
231
    {"_TSS", AcpiNsRepair_TSS},
218
    {{0,0,0,0}, NULL}               /* Table terminator */
232
    {{0,0,0,0}, NULL}               /* Table terminator */
219
};
233
};
Line 425... Line 439...
425
}
439
}
Line 426... Line 440...
426
 
440
 
427
 
441
 
-
 
442
/******************************************************************************
-
 
443
 *
-
 
444
 * FUNCTION:    AcpiNsRepair_CID
-
 
445
 *
-
 
446
 * PARAMETERS:  Data                - Pointer to validation data structure
-
 
447
 *              ReturnObjectPtr     - Pointer to the object returned from the
-
 
448
 *                                    evaluation of a method or object
-
 
449
 *
-
 
450
 * RETURN:      Status. AE_OK if object is OK or was repaired successfully
-
 
451
 *
-
 
452
 * DESCRIPTION: Repair for the _CID object. If a string, ensure that all
-
 
453
 *              letters are uppercase and that there is no leading asterisk.
-
 
454
 *              If a Package, ensure same for all string elements.
-
 
455
 *
-
 
456
 *****************************************************************************/
-
 
457
 
-
 
458
static ACPI_STATUS
-
 
459
AcpiNsRepair_CID (
-
 
460
    ACPI_PREDEFINED_DATA    *Data,
-
 
461
    ACPI_OPERAND_OBJECT     **ReturnObjectPtr)
-
 
462
{
-
 
463
    ACPI_STATUS             Status;
-
 
464
    ACPI_OPERAND_OBJECT     *ReturnObject = *ReturnObjectPtr;
-
 
465
    ACPI_OPERAND_OBJECT     **ElementPtr;
-
 
466
    ACPI_OPERAND_OBJECT     *OriginalElement;
-
 
467
    UINT16                  OriginalRefCount;
-
 
468
    UINT32                  i;
-
 
469
 
-
 
470
 
-
 
471
    /* Check for _CID as a simple string */
-
 
472
 
-
 
473
    if (ReturnObject->Common.Type == ACPI_TYPE_STRING)
-
 
474
    {
-
 
475
        Status = AcpiNsRepair_HID (Data, ReturnObjectPtr);
-
 
476
        return (Status);
-
 
477
    }
-
 
478
 
-
 
479
    /* Exit if not a Package */
-
 
480
 
-
 
481
    if (ReturnObject->Common.Type != ACPI_TYPE_PACKAGE)
-
 
482
    {
-
 
483
        return (AE_OK);
-
 
484
    }
-
 
485
 
-
 
486
    /* Examine each element of the _CID package */
-
 
487
 
-
 
488
    ElementPtr = ReturnObject->Package.Elements;
-
 
489
    for (i = 0; i < ReturnObject->Package.Count; i++)
-
 
490
    {
-
 
491
        OriginalElement = *ElementPtr;
-
 
492
        OriginalRefCount = OriginalElement->Common.ReferenceCount;
-
 
493
 
-
 
494
        Status = AcpiNsRepair_HID (Data, ElementPtr);
-
 
495
        if (ACPI_FAILURE (Status))
-
 
496
        {
-
 
497
            return (Status);
-
 
498
        }
-
 
499
 
-
 
500
        /* Take care with reference counts */
-
 
501
 
-
 
502
        if (OriginalElement != *ElementPtr)
-
 
503
        {
-
 
504
            /* Element was replaced */
-
 
505
 
-
 
506
            (*ElementPtr)->Common.ReferenceCount =
-
 
507
                OriginalRefCount;
-
 
508
 
-
 
509
            AcpiUtRemoveReference (OriginalElement);
-
 
510
        }
-
 
511
 
-
 
512
        ElementPtr++;
-
 
513
    }
-
 
514
 
-
 
515
    return (AE_OK);
-
 
516
}
-
 
517
 
-
 
518
 
-
 
519
/******************************************************************************
-
 
520
 *
-
 
521
 * FUNCTION:    AcpiNsRepair_HID
-
 
522
 *
-
 
523
 * PARAMETERS:  Data                - Pointer to validation data structure
-
 
524
 *              ReturnObjectPtr     - Pointer to the object returned from the
-
 
525
 *                                    evaluation of a method or object
-
 
526
 *
-
 
527
 * RETURN:      Status. AE_OK if object is OK or was repaired successfully
-
 
528
 *
-
 
529
 * DESCRIPTION: Repair for the _HID object. If a string, ensure that all
-
 
530
 *              letters are uppercase and that there is no leading asterisk.
-
 
531
 *
-
 
532
 *****************************************************************************/
-
 
533
 
-
 
534
static ACPI_STATUS
-
 
535
AcpiNsRepair_HID (
-
 
536
    ACPI_PREDEFINED_DATA    *Data,
-
 
537
    ACPI_OPERAND_OBJECT     **ReturnObjectPtr)
-
 
538
{
-
 
539
    ACPI_OPERAND_OBJECT     *ReturnObject = *ReturnObjectPtr;
-
 
540
    ACPI_OPERAND_OBJECT     *NewString;
-
 
541
    char                    *Source;
-
 
542
    char                    *Dest;
-
 
543
 
-
 
544
 
-
 
545
    ACPI_FUNCTION_NAME (NsRepair_HID);
-
 
546
 
-
 
547
 
-
 
548
    /* We only care about string _HID objects (not integers) */
-
 
549
 
-
 
550
    if (ReturnObject->Common.Type != ACPI_TYPE_STRING)
-
 
551
    {
-
 
552
        return (AE_OK);
-
 
553
    }
-
 
554
 
-
 
555
    if (ReturnObject->String.Length == 0)
-
 
556
    {
-
 
557
        ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags,
-
 
558
            "Invalid zero-length _HID or _CID string"));
-
 
559
 
-
 
560
        /* Return AE_OK anyway, let driver handle it */
-
 
561
 
-
 
562
        Data->Flags |= ACPI_OBJECT_REPAIRED;
-
 
563
        return (AE_OK);
-
 
564
    }
-
 
565
 
-
 
566
    /* It is simplest to always create a new string object */
-
 
567
 
-
 
568
    NewString = AcpiUtCreateStringObject (ReturnObject->String.Length);
-
 
569
    if (!NewString)
-
 
570
    {
-
 
571
        return (AE_NO_MEMORY);
-
 
572
    }
-
 
573
 
-
 
574
    /*
-
 
575
     * Remove a leading asterisk if present. For some unknown reason, there
-
 
576
     * are many machines in the field that contains IDs like this.
-
 
577
     *
-
 
578
     * Examples: "*PNP0C03", "*ACPI0003"
-
 
579
     */
-
 
580
    Source = ReturnObject->String.Pointer;
-
 
581
    if (*Source == '*')
-
 
582
    {
-
 
583
        Source++;
-
 
584
        NewString->String.Length--;
-
 
585
 
-
 
586
        ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR,
-
 
587
            "%s: Removed invalid leading asterisk\n", Data->Pathname));
-
 
588
    }
-
 
589
 
-
 
590
    /*
-
 
591
     * Copy and uppercase the string. From the ACPI specification:
-
 
592
     *
-
 
593
     * A valid PNP ID must be of the form "AAA####" where A is an uppercase
-
 
594
     * letter and # is a hex digit. A valid ACPI ID must be of the form
-
 
595
     * "ACPI####" where # is a hex digit.
-
 
596
     */
-
 
597
    for (Dest = NewString->String.Pointer; *Source; Dest++, Source++)
-
 
598
    {
-
 
599
        *Dest = (char) ACPI_TOUPPER (*Source);
-
 
600
    }
-
 
601
 
-
 
602
    AcpiUtRemoveReference (ReturnObject);
-
 
603
    *ReturnObjectPtr = NewString;
-
 
604
    return (AE_OK);
-
 
605
}
-
 
606
 
-
 
607
 
428
/******************************************************************************
608
/******************************************************************************
429
 *
609
 *
430
 * FUNCTION:    AcpiNsRepair_TSS
610
 * FUNCTION:    AcpiNsRepair_TSS
431
 *
611
 *
432
 * PARAMETERS:  Data                - Pointer to validation data structure
612
 * PARAMETERS:  Data                - Pointer to validation data structure
Line 445... Line 625...
445
    ACPI_PREDEFINED_DATA    *Data,
625
    ACPI_PREDEFINED_DATA    *Data,
446
    ACPI_OPERAND_OBJECT     **ReturnObjectPtr)
626
    ACPI_OPERAND_OBJECT     **ReturnObjectPtr)
447
{
627
{
448
    ACPI_OPERAND_OBJECT     *ReturnObject = *ReturnObjectPtr;
628
    ACPI_OPERAND_OBJECT     *ReturnObject = *ReturnObjectPtr;
449
    ACPI_STATUS             Status;
629
    ACPI_STATUS             Status;
-
 
630
    ACPI_NAMESPACE_NODE     *Node;
-
 
631
 
Line -... Line 632...
-
 
632
 
-
 
633
    /*
-
 
634
     * We can only sort the _TSS return package if there is no _PSS in the
-
 
635
     * same scope. This is because if _PSS is present, the ACPI specification
-
 
636
     * dictates that the _TSS Power Dissipation field is to be ignored, and
-
 
637
     * therefore some BIOSs leave garbage values in the _TSS Power field(s).
-
 
638
     * In this case, it is best to just return the _TSS package as-is.
-
 
639
     * (May, 2011)
-
 
640
     */
-
 
641
    Status = AcpiNsGetNode (Data->Node, "^_PSS", ACPI_NS_NO_UPSEARCH, &Node);
-
 
642
    if (ACPI_SUCCESS (Status))
-
 
643
    {
-
 
644
        return (AE_OK);
Line 450... Line 645...
450
 
645
    }
451
 
646
 
Line 452... Line 647...
452
    Status = AcpiNsCheckSortedList (Data, ReturnObject, 5, 1,
647
    Status = AcpiNsCheckSortedList (Data, ReturnObject, 5, 1,