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 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 118... Line 118...
118
#define _COMPONENT          ACPI_TOOLS
118
#define _COMPONENT          ACPI_TOOLS
119
        ACPI_MODULE_NAME    ("aehandlers")
119
        ACPI_MODULE_NAME    ("aehandlers")
Line 120... Line 120...
120
 
120
 
Line 121... Line 121...
121
/* Local prototypes */
121
/* Local prototypes */
122
 
122
 
123
void
123
static void
124
AeNotifyHandler (
124
AeNotifyHandler (
125
    ACPI_HANDLE             Device,
125
    ACPI_HANDLE             Device,
Line 126... Line 126...
126
    UINT32                  Value,
126
    UINT32                  Value,
127
    void                    *Context);
127
    void                    *Context);
128
 
128
 
129
void
129
static void
130
AeDeviceNotifyHandler (
130
AeDeviceNotifyHandler (
Line 131... Line 131...
131
    ACPI_HANDLE             Device,
131
    ACPI_HANDLE             Device,
132
    UINT32                  Value,
132
    UINT32                  Value,
133
    void                    *Context);
133
    void                    *Context);
134
 
134
 
135
ACPI_STATUS
135
static ACPI_STATUS
136
AeExceptionHandler (
136
AeExceptionHandler (
137
    ACPI_STATUS             AmlStatus,
137
    ACPI_STATUS             AmlStatus,
Line 138... Line 138...
138
    ACPI_NAME               Name,
138
    ACPI_NAME               Name,
139
    UINT16                  Opcode,
139
    UINT16                  Opcode,
140
    UINT32                  AmlOffset,
140
    UINT32                  AmlOffset,
141
    void                    *Context);
141
    void                    *Context);
142
 
142
 
Line 143... Line 143...
143
ACPI_STATUS
143
static ACPI_STATUS
144
AeTableHandler (
144
AeTableHandler (
145
    UINT32                  Event,
145
    UINT32                  Event,
146
    void                    *Table,
146
    void                    *Table,
147
    void                    *Context);
147
    void                    *Context);
148
 
148
 
Line 149... Line 149...
149
ACPI_STATUS
149
static ACPI_STATUS
150
AeRegionInit (
150
AeRegionInit (
151
    ACPI_HANDLE             RegionHandle,
151
    ACPI_HANDLE             RegionHandle,
152
    UINT32                  Function,
152
    UINT32                  Function,
Line -... Line 153...
-
 
153
    void                    *HandlerContext,
-
 
154
    void                    **RegionContext);
-
 
155
 
-
 
156
static void
-
 
157
AeAttachedDataHandler (
-
 
158
    ACPI_HANDLE             Object,
-
 
159
    void                    *Data);
-
 
160
 
-
 
161
static UINT32
153
    void                    *HandlerContext,
162
AeInterfaceHandler (
154
    void                    **RegionContext);
163
    ACPI_STRING             InterfaceName,
-
 
164
    UINT32                  Supported);
-
 
165
 
-
 
166
static UINT32
-
 
167
AeEventHandler (
-
 
168
    void                    *Context);
-
 
169
 
-
 
170
static UINT32               SigintCount = 0;
-
 
171
static AE_DEBUG_REGIONS     AeRegions;
-
 
172
 
-
 
173
 
-
 
174
/*
-
 
175
 * We will override some of the default region handlers, especially the
-
 
176
 * SystemMemory handler, which must be implemented locally. Do not override
-
 
177
 * the PCI_Config handler since we would like to exercise the default handler
-
 
178
 * code. These handlers are installed "early" - before any _REG methods
-
 
179
 * are executed - since they are special in the sense that tha ACPI spec
-
 
180
 * declares that they must "always be available". Cannot override the
-
 
181
 * DataTable region handler either -- needed for test execution.
-
 
182
 */
-
 
183
static ACPI_ADR_SPACE_TYPE  DefaultSpaceIdList[] = {
-
 
184
    ACPI_ADR_SPACE_SYSTEM_MEMORY,
-
 
185
    ACPI_ADR_SPACE_SYSTEM_IO
-
 
186
};
-
 
187
 
-
 
188
/*
-
 
189
 * We will install handlers for some of the various address space IDs
-
 
190
 * Test one user-defined address space (used by aslts.)
-
 
191
 */
-
 
192
#define ACPI_ADR_SPACE_USER_DEFINED     0x80
-
 
193
 
Line 155... Line 194...
155
 
194
static ACPI_ADR_SPACE_TYPE  SpaceIdList[] = {
156
void
195
    ACPI_ADR_SPACE_EC,
157
AeAttachedDataHandler (
196
    ACPI_ADR_SPACE_SMBUS,
Line 172... Line 211...
172
 *
211
 *
173
 * DESCRIPTION: Control-C handler.  Abort running control method if any.
212
 * DESCRIPTION: Control-C handler.  Abort running control method if any.
174
 *
213
 *
175
 *****************************************************************************/
214
 *****************************************************************************/
Line 176... Line 215...
176
 
215
 
177
void __cdecl
216
void ACPI_SYSTEM_XFACE
178
AeCtrlCHandler (
217
AeCtrlCHandler (
179
    int                     Sig)
218
    int                     Sig)
Line 180... Line 219...
180
{
219
{
Line 211... Line 250...
211
 *              test suite(s) to communicate errors and other information to
250
 *              test suite(s) to communicate errors and other information to
212
 *              this utility via the Notify() operator.
251
 *              this utility via the Notify() operator.
213
 *
252
 *
214
 *****************************************************************************/
253
 *****************************************************************************/
Line 215... Line 254...
215
 
254
 
216
void
255
static void
217
AeNotifyHandler (
256
AeNotifyHandler (
218
    ACPI_HANDLE                 Device,
257
    ACPI_HANDLE                 Device,
219
    UINT32                      Value,
258
    UINT32                      Value,
220
    void                        *Context)
259
    void                        *Context)
Line 261... Line 300...
261
        }
300
        }
Line 262... Line 301...
262
 
301
 
263
        (void) AcpiEvaluateObject (Device, "_NOT", NULL, NULL);
302
        (void) AcpiEvaluateObject (Device, "_NOT", NULL, NULL);
264
        break;
303
        break;
265
    }
-
 
266
 
304
    }
Line 267... Line 305...
267
}
305
}
268
 
306
 
Line 279... Line 317...
279
 *              test suite(s) to communicate errors and other information to
317
 *              test suite(s) to communicate errors and other information to
280
 *              this utility via the Notify() operator.
318
 *              this utility via the Notify() operator.
281
 *
319
 *
282
 *****************************************************************************/
320
 *****************************************************************************/
Line 283... Line 321...
283
 
321
 
284
void
322
static void
285
AeDeviceNotifyHandler (
323
AeDeviceNotifyHandler (
286
    ACPI_HANDLE                 Device,
324
    ACPI_HANDLE                 Device,
287
    UINT32                      Value,
325
    UINT32                      Value,
288
    void                        *Context)
326
    void                        *Context)
Line 310... Line 348...
310
 *
348
 *
311
 * DESCRIPTION: System exception handler for AcpiExec utility.
349
 * DESCRIPTION: System exception handler for AcpiExec utility.
312
 *
350
 *
313
 *****************************************************************************/
351
 *****************************************************************************/
Line 314... Line 352...
314
 
352
 
315
ACPI_STATUS
353
static ACPI_STATUS
316
AeExceptionHandler (
354
AeExceptionHandler (
317
    ACPI_STATUS             AmlStatus,
355
    ACPI_STATUS             AmlStatus,
318
    ACPI_NAME               Name,
356
    ACPI_NAME               Name,
319
    UINT16                  Opcode,
357
    UINT16                  Opcode,
Line 354... Line 392...
354
    Arg[1].Type = ACPI_TYPE_STRING;
392
    Arg[1].Type = ACPI_TYPE_STRING;
355
    Arg[1].String.Pointer = ACPI_CAST_PTR (char, Exception);
393
    Arg[1].String.Pointer = ACPI_CAST_PTR (char, Exception);
356
    Arg[1].String.Length = ACPI_STRLEN (Exception);
394
    Arg[1].String.Length = ACPI_STRLEN (Exception);
Line 357... Line 395...
357
 
395
 
358
    Arg[2].Type = ACPI_TYPE_INTEGER;
396
    Arg[2].Type = ACPI_TYPE_INTEGER;
Line 359... Line 397...
359
    Arg[2].Integer.Value = ACPI_TO_INTEGER (AcpiOsGetThreadId());
397
    Arg[2].Integer.Value = AcpiOsGetThreadId();
Line 360... Line 398...
360
 
398
 
361
    /* Setup return buffer */
399
    /* Setup return buffer */
Line 409... Line 447...
409
 *
447
 *
410
 * DESCRIPTION: System table handler for AcpiExec utility.
448
 * DESCRIPTION: System table handler for AcpiExec utility.
411
 *
449
 *
412
 *****************************************************************************/
450
 *****************************************************************************/
Line 413... Line 451...
413
 
451
 
414
char                *TableEvents[] =
452
static char                *TableEvents[] =
415
{
453
{
416
    "LOAD",
454
    "LOAD",
417
    "UNLOAD",
455
    "UNLOAD",
418
    "UNKNOWN"
456
    "UNKNOWN"
Line 419... Line 457...
419
};
457
};
420
 
458
 
421
ACPI_STATUS
459
static ACPI_STATUS
422
AeTableHandler (
460
AeTableHandler (
423
    UINT32                  Event,
461
    UINT32                  Event,
424
    void                    *Table,
462
    void                    *Table,
-
 
463
    void                    *Context)
-
 
464
{
Line 425... Line 465...
425
    void                    *Context)
465
    ACPI_STATUS             Status;
426
{
466
 
427
 
467
 
428
    if (Event > ACPI_NUM_TABLE_EVENTS)
468
    if (Event > ACPI_NUM_TABLE_EVENTS)
Line 429... Line 469...
429
    {
469
    {
-
 
470
        Event = ACPI_NUM_TABLE_EVENTS;
-
 
471
    }
-
 
472
 
Line 430... Line 473...
430
        Event = ACPI_NUM_TABLE_EVENTS;
473
    /* Enable any GPEs associated with newly-loaded GPE methods */
431
    }
474
 
432
 
475
    Status = AcpiUpdateAllGpes ();
433
    /* TBD: could dump entire table header, need a header dump routine */
476
    AE_CHECK_OK (AcpiUpdateAllGpes, Status);
Line 440... Line 483...
440
 
483
 
441
/******************************************************************************
484
/******************************************************************************
442
 *
485
 *
443
 * FUNCTION:    AeGpeHandler
486
 * FUNCTION:    AeGpeHandler
444
 *
487
 *
445
 * DESCRIPTION: GPE handler for acpiexec
488
 * DESCRIPTION: Common GPE handler for acpiexec
446
 *
489
 *
Line 447... Line 490...
447
 *****************************************************************************/
490
 *****************************************************************************/
448
 
491
 
-
 
492
UINT32
-
 
493
AeGpeHandler (
449
UINT32
494
    ACPI_HANDLE             GpeDevice,
450
AeGpeHandler (
495
    UINT32                  GpeNumber,
-
 
496
    void                    *Context)
-
 
497
{
-
 
498
    ACPI_NAMESPACE_NODE     *DeviceNode = (ACPI_NAMESPACE_NODE *) GpeDevice;
451
    void                    *Context)
499
 
-
 
500
 
-
 
501
    AcpiOsPrintf ("[AcpiExec] GPE Handler received GPE%02X (GPE block %4.4s)\n",
-
 
502
        GpeNumber, GpeDevice ? DeviceNode->Name.Ascii : "FADT");
-
 
503
 
-
 
504
    return (ACPI_REENABLE_GPE);
-
 
505
}
-
 
506
 
-
 
507
 
-
 
508
/******************************************************************************
-
 
509
 *
-
 
510
 * FUNCTION:    AeGlobalEventHandler
-
 
511
 *
-
 
512
 * DESCRIPTION: Global GPE/Fixed event handler
-
 
513
 *
-
 
514
 *****************************************************************************/
-
 
515
 
-
 
516
void
-
 
517
AeGlobalEventHandler (
-
 
518
    UINT32                  Type,
-
 
519
    ACPI_HANDLE             Device,
-
 
520
    UINT32                  EventNumber,
-
 
521
    void                    *Context)
-
 
522
{
-
 
523
    char                    *TypeName;
-
 
524
 
-
 
525
 
-
 
526
    switch (Type)
-
 
527
    {
-
 
528
    case ACPI_EVENT_TYPE_GPE:
-
 
529
        TypeName = "GPE";
-
 
530
        break;
-
 
531
 
-
 
532
    case ACPI_EVENT_TYPE_FIXED:
-
 
533
        TypeName = "FixedEvent";
-
 
534
        break;
-
 
535
 
452
{
536
    default:
-
 
537
        TypeName = "UNKNOWN";
-
 
538
        break;
-
 
539
    }
-
 
540
 
453
    AcpiOsPrintf ("Received a GPE at handler\n");
541
    AcpiOsPrintf ("[AcpiExec] Global Event Handler received: Type %s Number %.2X Dev %p\n",
Line 454... Line 542...
454
    return (0);
542
        TypeName, EventNumber, Device);
455
}
543
}
Line 462... Line 550...
462
 * DESCRIPTION: Handler for deletion of nodes with attached data (attached via
550
 * DESCRIPTION: Handler for deletion of nodes with attached data (attached via
463
 *              AcpiAttachData)
551
 *              AcpiAttachData)
464
 *
552
 *
465
 *****************************************************************************/
553
 *****************************************************************************/
Line 466... Line 554...
466
 
554
 
467
void
555
static void
468
AeAttachedDataHandler (
556
AeAttachedDataHandler (
469
    ACPI_HANDLE             Object,
557
    ACPI_HANDLE             Object,
470
    void                    *Data)
558
    void                    *Data)
471
{
559
{
Line 477... Line 565...
477
}
565
}
Line 478... Line 566...
478
 
566
 
479
 
567
 
-
 
568
/******************************************************************************
-
 
569
 *
-
 
570
 * FUNCTION:    AeInterfaceHandler
-
 
571
 *
-
 
572
 * DESCRIPTION: Handler for _OSI invocations
-
 
573
 *
-
 
574
 *****************************************************************************/
-
 
575
 
-
 
576
static UINT32
-
 
577
AeInterfaceHandler (
-
 
578
    ACPI_STRING             InterfaceName,
-
 
579
    UINT32                  Supported)
-
 
580
{
-
 
581
    ACPI_FUNCTION_NAME (AeInterfaceHandler);
-
 
582
 
-
 
583
 
-
 
584
    ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-
 
585
        "Received _OSI (\"%s\"), is %ssupported\n",
-
 
586
        InterfaceName, Supported == 0 ? "not " : ""));
-
 
587
 
-
 
588
    return (Supported);
-
 
589
}
-
 
590
 
-
 
591
 
-
 
592
/******************************************************************************
-
 
593
 *
-
 
594
 * FUNCTION:    AeEventHandler
-
 
595
 *
-
 
596
 * DESCRIPTION: Handler for Fixed Events
-
 
597
 *
-
 
598
 *****************************************************************************/
-
 
599
 
-
 
600
static UINT32
-
 
601
AeEventHandler (
-
 
602
    void                    *Context)
-
 
603
{
-
 
604
    return (0);
-
 
605
}
-
 
606
 
-
 
607
 
480
/******************************************************************************
608
/******************************************************************************
481
 *
609
 *
482
 * FUNCTION:    AeRegionInit
610
 * FUNCTION:    AeRegionInit
483
 *
611
 *
484
 * PARAMETERS:  None
612
 * PARAMETERS:  None
485
 *
613
 *
486
 * RETURN:      Status
614
 * RETURN:      Status
487
 *
615
 *
488
 * DESCRIPTION: Opregion init function.
616
 * DESCRIPTION: Opregion init function.
Line 489... Line 617...
489
 *
617
 *
490
 *****************************************************************************/
618
 *****************************************************************************/
491
 
619
 
492
ACPI_STATUS
620
static ACPI_STATUS
493
AeRegionInit (
621
AeRegionInit (
494
    ACPI_HANDLE                 RegionHandle,
622
    ACPI_HANDLE                 RegionHandle,
Line 499... Line 627...
499
    /*
627
    /*
500
     * Real simple, set the RegionContext to the RegionHandle
628
     * Real simple, set the RegionContext to the RegionHandle
501
     */
629
     */
502
    *RegionContext = RegionHandle;
630
    *RegionContext = RegionHandle;
Line 503... Line 631...
503
 
631
 
504
    return AE_OK;
632
    return (AE_OK);
Line 505... Line 633...
505
}
633
}
506
 
634
 
507
 
635
 
508
/******************************************************************************
636
/******************************************************************************
509
 *
637
 *
510
 * FUNCTION:    AeInstallHandlers
638
 * FUNCTION:    AeInstallLateHandlers
511
 *
639
 *
512
 * PARAMETERS:  None
640
 * PARAMETERS:  None
513
 *
641
 *
514
 * RETURN:      Status
642
 * RETURN:      Status
515
 *
643
 *
Line -... Line 644...
-
 
644
 * DESCRIPTION: Install handlers for the AcpiExec utility.
-
 
645
 *
-
 
646
 *****************************************************************************/
-
 
647
 
-
 
648
ACPI_STATUS
-
 
649
AeInstallLateHandlers (
-
 
650
    void)
-
 
651
{
-
 
652
    ACPI_STATUS             Status;
-
 
653
    UINT32                  i;
-
 
654
 
-
 
655
 
-
 
656
    /* Install some fixed event handlers */
-
 
657
 
-
 
658
    Status = AcpiInstallFixedEventHandler (ACPI_EVENT_GLOBAL, AeEventHandler, NULL);
-
 
659
    AE_CHECK_OK (AcpiInstallFixedEventHandler, Status);
-
 
660
 
-
 
661
    Status = AcpiInstallFixedEventHandler (ACPI_EVENT_RTC, AeEventHandler, NULL);
-
 
662
    AE_CHECK_OK (AcpiInstallFixedEventHandler, Status);
-
 
663
 
-
 
664
    /*
-
 
665
     * Install handlers for some of the "device driver" address spaces
-
 
666
     * such as EC, SMBus, etc.
-
 
667
     */
-
 
668
    for (i = 0; i < ACPI_ARRAY_LENGTH (SpaceIdList); i++)
516
 * DESCRIPTION: Install handlers for the AcpiExec utility.
669
    {
517
 *
670
        /* Install handler at the root object */
-
 
671
 
-
 
672
        Status = AcpiInstallAddressSpaceHandler (AcpiGbl_RootNode,
-
 
673
                        SpaceIdList[i], AeRegionHandler, AeRegionInit, NULL);
-
 
674
        if (ACPI_FAILURE (Status))
-
 
675
        {
-
 
676
            ACPI_EXCEPTION ((AE_INFO, Status,
-
 
677
                "Could not install an OpRegion handler for %s space(%u)",
-
 
678
                AcpiUtGetRegionName((UINT8) SpaceIdList[i]), SpaceIdList[i]));
-
 
679
            return (Status);
-
 
680
        }
-
 
681
    }
-
 
682
 
-
 
683
    return (AE_OK);
-
 
684
}
-
 
685
 
-
 
686
 
-
 
687
/******************************************************************************
-
 
688
 *
-
 
689
 * FUNCTION:    AeInstallEarlyHandlers
-
 
690
 *
-
 
691
 * PARAMETERS:  None
-
 
692
 *
-
 
693
 * RETURN:      Status
-
 
694
 *
-
 
695
 * DESCRIPTION: Install handlers for the AcpiExec utility.
-
 
696
 *
Line 518... Line 697...
518
 *****************************************************************************/
697
 * Notes:       Don't install handler for PCI_Config, we want to use the
519
 
698
 *              default handler to exercise that code.
-
 
699
 *
520
ACPI_ADR_SPACE_TYPE         SpaceId[] = {0, 1, 2, 3, 4, 5, 6, 7, 0x80};
700
 *****************************************************************************/
521
#define AEXEC_NUM_REGIONS   9
701
 
522
 
702
ACPI_STATUS
523
ACPI_STATUS
703
AeInstallEarlyHandlers (
Line 524... Line 704...
524
AeInstallHandlers (void)
704
    void)
Line -... Line 705...
-
 
705
{
-
 
706
    ACPI_STATUS             Status;
-
 
707
    UINT32                  i;
-
 
708
    ACPI_HANDLE             Handle;
-
 
709
 
-
 
710
 
-
 
711
    ACPI_FUNCTION_ENTRY ();
525
{
712
 
526
    ACPI_STATUS             Status;
713
 
527
    UINT32                  i;
714
    Status = AcpiInstallInterfaceHandler (AeInterfaceHandler);
528
    ACPI_HANDLE             Handle;
715
    if (ACPI_FAILURE (Status))
529
 
716
    {
Line 582... Line 769...
582
                AcpiFormatException (Status));
769
                AcpiFormatException (Status));
583
        }
770
        }
Line 584... Line 771...
584
 
771
 
585
        Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY,
772
        Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY,
-
 
773
                                            AeNotifyHandler, NULL);
-
 
774
        AE_CHECK_OK (AcpiInstallNotifyHandler, Status);
586
                                            AeNotifyHandler, NULL);
775
 
587
        Status = AcpiRemoveNotifyHandler (Handle, ACPI_ALL_NOTIFY,
776
        Status = AcpiRemoveNotifyHandler (Handle, ACPI_ALL_NOTIFY,
-
 
777
                                            AeNotifyHandler);
-
 
778
        AE_CHECK_OK (AcpiRemoveNotifyHandler, Status);
588
                                            AeNotifyHandler);
779
 
589
        Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY,
780
        Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY,
590
                                            AeNotifyHandler, NULL);
781
                                            AeNotifyHandler, NULL);
591
        if (ACPI_FAILURE (Status))
782
        if (ACPI_FAILURE (Status))
592
        {
783
        {
593
            printf ("Could not install a notify handler, %s\n",
784
            printf ("Could not install a notify handler, %s\n",
594
                AcpiFormatException (Status));
785
                AcpiFormatException (Status));
Line 595... Line 786...
595
        }
786
        }
-
 
787
 
-
 
788
        Status = AcpiAttachData (Handle, AeAttachedDataHandler, Handle);
596
 
789
        AE_CHECK_OK (AcpiAttachData, Status);
-
 
790
 
-
 
791
        Status = AcpiDetachData (Handle, AeAttachedDataHandler);
597
        Status = AcpiAttachData (Handle, AeAttachedDataHandler, Handle);
792
        AE_CHECK_OK (AcpiDetachData, Status);
-
 
793
 
598
        Status = AcpiDetachData (Handle, AeAttachedDataHandler);
794
        Status = AcpiAttachData (Handle, AeAttachedDataHandler, Handle);
599
        Status = AcpiAttachData (Handle, AeAttachedDataHandler, Handle);
795
        AE_CHECK_OK (AcpiAttachData, Status);
600
    }
796
    }
601
    else
797
    else
602
    {
798
    {
Line 603... Line -...
603
        printf ("No _SB_ found, %s\n", AcpiFormatException (Status));
-
 
Line -... Line 799...
-
 
799
        printf ("No _SB_ found, %s\n", AcpiFormatException (Status));
-
 
800
    }
-
 
801
 
-
 
802
 
604
    }
803
    /*
605
 
804
     * Install handlers that will override the default handlers for some of
606
    /* Set a handler for all supported operation regions */
-
 
607
 
805
     * the space IDs.
Line 608... Line -...
608
    for (i = 0; i < AEXEC_NUM_REGIONS; i++)
-
 
609
    {
-
 
610
        Status = AcpiRemoveAddressSpaceHandler (AcpiGbl_RootNode,
-
 
611
                        SpaceId[i], AeRegionHandler);
806
     */
612
 
807
    for (i = 0; i < ACPI_ARRAY_LENGTH (DefaultSpaceIdList); i++)
-
 
808
    {
613
        /* Install handler at the root object.
809
        /* Install handler at the root object */
614
         * TBD: all default handlers should be installed here!
810
 
615
         */
811
        Status = AcpiInstallAddressSpaceHandler (AcpiGbl_RootNode,
616
        Status = AcpiInstallAddressSpaceHandler (AcpiGbl_RootNode,
812
                    DefaultSpaceIdList[i], AeRegionHandler,
617
                        SpaceId[i], AeRegionHandler, AeRegionInit, NULL);
813
                    AeRegionInit, NULL);
-
 
814
        if (ACPI_FAILURE (Status))
618
        if (ACPI_FAILURE (Status))
815
        {
619
        {
816
            ACPI_EXCEPTION ((AE_INFO, Status,
620
            ACPI_EXCEPTION ((AE_INFO, Status,
817
                "Could not install a default OpRegion handler for %s space(%u)",
Line 621... Line 818...
621
                "Could not install an OpRegion handler for %s space(%u)",
818
                AcpiUtGetRegionName ((UINT8) DefaultSpaceIdList[i]),
622
                AcpiUtGetRegionName((UINT8) SpaceId[i]), SpaceId[i]));
819
                DefaultSpaceIdList[i]));
623
            return (Status);
820
            return (Status);
624
        }
821
        }
625
    }
822
    }
626
 
823
 
627
    /*
-
 
628
     * Initialize the global Region Handler space
824
    /*
629
     * MCW 3/23/00
825
     * Initialize the global Region Handler space
Line 630... Line 826...
630
     */
826
     * MCW 3/23/00
631
    AeRegions.NumberOfRegions = 0;
827
     */
Line 676... Line 872...
676
    /*
872
    /*
677
     * If the object is not a region, simply return
873
     * If the object is not a region, simply return
678
     */
874
     */
679
    if (RegionObject->Region.Type != ACPI_TYPE_REGION)
875
    if (RegionObject->Region.Type != ACPI_TYPE_REGION)
680
    {
876
    {
681
        return AE_OK;
877
        return (AE_OK);
682
    }
878
    }
Line 683... Line 879...
683
 
879
 
684
    /*
880
    /*
685
     * Region support can be disabled with the -r option.
881
     * Region support can be disabled with the -r option.
Line 718... Line 914...
718
         */
914
         */
719
        switch (Function & ACPI_IO_MASK)
915
        switch (Function & ACPI_IO_MASK)
720
        {
916
        {
721
        case ACPI_READ:
917
        case ACPI_READ:
722
            Status = AcpiHwReadPort (Address, (UINT32 *) Value, BitWidth);
918
            Status = AcpiHwReadPort (Address, (UINT32 *) Value, BitWidth);
-
 
919
            AE_CHECK_OK (AcpiHwReadPort, Status);
723
            break;
920
            break;
Line 724... Line 921...
724
 
921
 
725
        case ACPI_WRITE:
922
        case ACPI_WRITE:
-
 
923
            Status = AcpiHwWritePort (Address, (UINT32) *Value, BitWidth);
726
            Status = AcpiHwWritePort (Address, (UINT32) *Value, BitWidth);
924
            AE_CHECK_OK (AcpiHwWritePort, Status);
Line 727... Line 925...
727
            break;
925
            break;
728
 
926
 
729
        default:
927
        default:
Line 865... Line 1063...
865
         * Do the memory allocations first
1063
         * Do the memory allocations first
866
         */
1064
         */
867
        RegionElement = AcpiOsAllocate (sizeof (AE_REGION));
1065
        RegionElement = AcpiOsAllocate (sizeof (AE_REGION));
868
        if (!RegionElement)
1066
        if (!RegionElement)
869
        {
1067
        {
870
            return AE_NO_MEMORY;
1068
            return (AE_NO_MEMORY);
871
        }
1069
        }
Line 872... Line 1070...
872
 
1070
 
873
        RegionElement->Buffer = AcpiOsAllocate (Length);
1071
        RegionElement->Buffer = AcpiOsAllocate (Length);
874
        if (!RegionElement->Buffer)
1072
        if (!RegionElement->Buffer)
875
        {
1073
        {
876
            AcpiOsFree (RegionElement);
1074
            AcpiOsFree (RegionElement);
877
            return AE_NO_MEMORY;
1075
            return (AE_NO_MEMORY);
Line 878... Line 1076...
878
        }
1076
        }
Line 879... Line 1077...
879
 
1077
 
Line 925... Line 1123...
925
            "Request on [%4.4s] is beyond region limit Req-0x%X+0x%X, Base=0x%X, Len-0x%X",
1123
            "Request on [%4.4s] is beyond region limit Req-0x%X+0x%X, Base=0x%X, Len-0x%X",
926
            (RegionObject->Region.Node)->Name.Ascii, (UINT32) Address,
1124
            (RegionObject->Region.Node)->Name.Ascii, (UINT32) Address,
927
            ByteWidth, (UINT32)(RegionElement->Address),
1125
            ByteWidth, (UINT32)(RegionElement->Address),
928
            RegionElement->Length));
1126
            RegionElement->Length));
Line 929... Line 1127...
929
 
1127
 
930
        return AE_AML_REGION_LIMIT;
1128
        return (AE_AML_REGION_LIMIT);
Line 931... Line 1129...
931
    }
1129
    }
932
 
1130
 
933
    /*
1131
    /*
Line 956... Line 1154...
956
         */
1154
         */
957
        ACPI_MEMCPY (BufferValue, Value, ByteWidth);
1155
        ACPI_MEMCPY (BufferValue, Value, ByteWidth);
958
        break;
1156
        break;
Line 959... Line 1157...
959
 
1157
 
960
    default:
1158
    default:
961
        return AE_BAD_PARAMETER;
1159
        return (AE_BAD_PARAMETER);
-
 
1160
    }
962
    }
1161
 
963
    return AE_OK;
1162
    return (AE_OK);