Subversion Repositories Kolibri OS

Rev

Rev 1498 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1498 serge 1
/******************************************************************************
2
 *
3
 * Module Name: aeexec - Support routines for AcpiExec utility
4
 *
5
 *****************************************************************************/
6
 
7
/******************************************************************************
8
 *
9
 * 1. Copyright Notice
10
 *
2216 Serge 11
 * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
1498 serge 12
 * All rights reserved.
13
 *
14
 * 2. License
15
 *
16
 * 2.1. This is your license from Intel Corp. under its intellectual property
17
 * rights.  You may have additional license terms from the party that provided
18
 * you this software, covering your right to use that party's intellectual
19
 * property rights.
20
 *
21
 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22
 * copy of the source code appearing in this file ("Covered Code") an
23
 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24
 * base code distributed originally by Intel ("Original Intel Code") to copy,
25
 * make derivatives, distribute, use and display any portion of the Covered
26
 * Code in any form, with the right to sublicense such rights; and
27
 *
28
 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29
 * license (with the right to sublicense), under only those claims of Intel
30
 * patents that are infringed by the Original Intel Code, to make, use, sell,
31
 * offer to sell, and import the Covered Code and derivative works thereof
32
 * solely to the minimum extent necessary to exercise the above copyright
33
 * license, and in no event shall the patent license extend to any additions
34
 * to or modifications of the Original Intel Code.  No other license or right
35
 * is granted directly or by implication, estoppel or otherwise;
36
 *
37
 * The above copyright and patent license is granted only if the following
38
 * conditions are met:
39
 *
40
 * 3. Conditions
41
 *
42
 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43
 * Redistribution of source code of any substantial portion of the Covered
44
 * Code or modification with rights to further distribute source must include
45
 * the above Copyright Notice, the above License, this list of Conditions,
46
 * and the following Disclaimer and Export Compliance provision.  In addition,
47
 * Licensee must cause all Covered Code to which Licensee contributes to
48
 * contain a file documenting the changes Licensee made to create that Covered
49
 * Code and the date of any change.  Licensee must include in that file the
50
 * documentation of any changes made by any predecessor Licensee.  Licensee
51
 * must include a prominent statement that the modification is derived,
52
 * directly or indirectly, from Original Intel Code.
53
 *
54
 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55
 * Redistribution of source code of any substantial portion of the Covered
56
 * Code or modification without rights to further distribute source must
57
 * include the following Disclaimer and Export Compliance provision in the
58
 * documentation and/or other materials provided with distribution.  In
59
 * addition, Licensee may not authorize further sublicense of source of any
60
 * portion of the Covered Code, and must include terms to the effect that the
61
 * license from Licensee to its licensee is limited to the intellectual
62
 * property embodied in the software Licensee provides to its licensee, and
63
 * not to intellectual property embodied in modifications its licensee may
64
 * make.
65
 *
66
 * 3.3. Redistribution of Executable. Redistribution in executable form of any
67
 * substantial portion of the Covered Code or modification must reproduce the
68
 * above Copyright Notice, and the following Disclaimer and Export Compliance
69
 * provision in the documentation and/or other materials provided with the
70
 * distribution.
71
 *
72
 * 3.4. Intel retains all right, title, and interest in and to the Original
73
 * Intel Code.
74
 *
75
 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76
 * Intel shall be used in advertising or otherwise to promote the sale, use or
77
 * other dealings in products derived from or relating to the Covered Code
78
 * without prior written authorization from Intel.
79
 *
80
 * 4. Disclaimer and Export Compliance
81
 *
82
 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83
 * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84
 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
85
 * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
86
 * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
87
 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
88
 * PARTICULAR PURPOSE.
89
 *
90
 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91
 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92
 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93
 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94
 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95
 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
96
 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
97
 * LIMITED REMEDY.
98
 *
99
 * 4.3. Licensee shall not export, either directly or indirectly, any of this
100
 * software or system incorporating such software without first obtaining any
101
 * required license or other approval from the U. S. Department of Commerce or
102
 * any other agency or department of the United States Government.  In the
103
 * event Licensee exports any such software from the United States or
104
 * re-exports any such software from a foreign destination, Licensee shall
105
 * ensure that the distribution and export/re-export of the software is in
106
 * compliance with all laws, regulations, orders, or other restrictions of the
107
 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108
 * any of its subsidiaries will export/re-export any technical data, process,
109
 * software, or service, directly or indirectly, to any country for which the
110
 * United States government or any agency thereof requires an export license,
111
 * other governmental approval, or letter of assurance, without first obtaining
112
 * such license, approval or letter.
113
 *
114
 *****************************************************************************/
115
 
116
#include "aecommon.h"
117
 
118
#define _COMPONENT          ACPI_TOOLS
119
        ACPI_MODULE_NAME    ("aeexec")
120
 
121
/* Local prototypes */
122
 
2216 Serge 123
static ACPI_STATUS
1498 serge 124
AeSetupConfiguration (
125
    void                    *RegionAddr);
126
 
2216 Serge 127
static void
1498 serge 128
AfInstallGpeBlock (
129
    void);
130
 
2216 Serge 131
static void
1498 serge 132
AeTestBufferArgument (
133
    void);
134
 
2216 Serge 135
static void
1498 serge 136
AeTestPackageArgument (
137
    void);
138
 
2216 Serge 139
static ACPI_STATUS
1498 serge 140
AeGetDevices (
141
    ACPI_HANDLE             ObjHandle,
142
    UINT32                  NestingLevel,
143
    void                    *Context,
144
    void                    **ReturnValue);
145
 
2216 Serge 146
static ACPI_STATUS
1498 serge 147
ExecuteOSI (
148
    char                    *OsiString,
149
    UINT32                  ExpectedResult);
150
 
2216 Serge 151
static void
1498 serge 152
AeHardwareInterfaces (
153
    void);
154
 
2216 Serge 155
static void
1498 serge 156
AeGenericRegisters (
157
    void);
158
 
159
extern unsigned char Ssdt3Code[];
160
 
161
 
162
/******************************************************************************
163
 *
164
 * FUNCTION:    AeSetupConfiguration
165
 *
166
 * PARAMETERS:  RegionAddr          - Address for an ACPI table to be loaded
167
 *                                    dynamically. Test purposes only.
168
 *
169
 * RETURN:      Status
170
 *
171
 * DESCRIPTION: Call AML _CFG configuration control method
172
 *
173
 *****************************************************************************/
174
 
2216 Serge 175
static ACPI_STATUS
1498 serge 176
AeSetupConfiguration (
177
    void                    *RegionAddr)
178
{
179
    ACPI_OBJECT_LIST        ArgList;
180
    ACPI_OBJECT             Arg[3];
181
 
182
 
183
    /*
184
     * Invoke _CFG method if present
185
     */
186
    ArgList.Count = 1;
187
    ArgList.Pointer = Arg;
188
 
189
    Arg[0].Type = ACPI_TYPE_INTEGER;
190
    Arg[0].Integer.Value = ACPI_TO_INTEGER (RegionAddr);
191
 
2216 Serge 192
    (void) AcpiEvaluateObject (NULL, "\\_CFG", &ArgList, NULL);
1498 serge 193
    return (AE_OK);
194
}
195
 
196
 
197
/******************************************************************************
198
 *
199
 * FUNCTION:    AfInstallGpeBlock
200
 *
201
 * PARAMETERS:  None
202
 *
203
 * RETURN:      None
204
 *
205
 * DESCRIPTION: Test GPE block device initialization. Requires test ASL with
206
 *              A \GPE2 device.
207
 *
208
 *****************************************************************************/
209
 
2216 Serge 210
static void
1498 serge 211
AfInstallGpeBlock (
212
    void)
213
{
214
    ACPI_STATUS                 Status;
215
    ACPI_HANDLE                 Handle;
216
    ACPI_HANDLE                 Handle2 = NULL;
217
    ACPI_HANDLE                 Handle3 = NULL;
218
    ACPI_GENERIC_ADDRESS        BlockAddress;
219
    ACPI_HANDLE                 GpeDevice;
220
 
221
 
222
    Status = AcpiGetHandle (NULL, "\\_GPE", &Handle);
223
    if (ACPI_FAILURE (Status))
224
    {
225
        return;
226
    }
227
 
228
    ACPI_MEMSET (&BlockAddress, 0, sizeof (ACPI_GENERIC_ADDRESS));
229
    BlockAddress.SpaceId = ACPI_ADR_SPACE_SYSTEM_MEMORY;
230
    BlockAddress.Address = 0x76540000;
231
 
232
    Status = AcpiGetHandle (NULL, "\\GPE2", &Handle2);
233
    if (ACPI_SUCCESS (Status))
234
    {
235
        Status = AcpiInstallGpeBlock (Handle2, &BlockAddress, 7, 8);
2216 Serge 236
        AE_CHECK_OK (AcpiInstallGpeBlock, Status);
1498 serge 237
 
2216 Serge 238
        Status = AcpiInstallGpeHandler (Handle2, 8,
239
            ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
240
        AE_CHECK_OK (AcpiInstallGpeHandler, Status);
1498 serge 241
 
2216 Serge 242
        Status = AcpiEnableGpe (Handle2, 8);
243
        AE_CHECK_OK (AcpiEnableGpe, Status);
244
 
1498 serge 245
        Status = AcpiGetGpeDevice (0x30, &GpeDevice);
2216 Serge 246
        AE_CHECK_OK (AcpiGetGpeDevice, Status);
247
 
1498 serge 248
        Status = AcpiGetGpeDevice (0x42, &GpeDevice);
2216 Serge 249
        AE_CHECK_OK (AcpiGetGpeDevice, Status);
250
 
1498 serge 251
        Status = AcpiGetGpeDevice (AcpiCurrentGpeCount-1, &GpeDevice);
2216 Serge 252
        AE_CHECK_OK (AcpiGetGpeDevice, Status);
253
 
1498 serge 254
        Status = AcpiGetGpeDevice (AcpiCurrentGpeCount, &GpeDevice);
2216 Serge 255
        AE_CHECK_STATUS (AcpiGetGpeDevice, Status, AE_NOT_EXIST);
1498 serge 256
 
2216 Serge 257
        Status = AcpiRemoveGpeHandler (Handle2, 8, AeGpeHandler);
258
        AE_CHECK_OK (AcpiRemoveGpeHandler, Status);
1498 serge 259
    }
260
 
261
    Status = AcpiGetHandle (NULL, "\\GPE3", &Handle3);
262
    if (ACPI_SUCCESS (Status))
263
    {
264
        Status = AcpiInstallGpeBlock (Handle3, &BlockAddress, 8, 11);
2216 Serge 265
        AE_CHECK_OK (AcpiInstallGpeBlock, Status);
1498 serge 266
    }
267
}
268
 
269
 
270
/* Test using a Buffer object as a method argument */
271
 
2216 Serge 272
static void
1498 serge 273
AeTestBufferArgument (
274
    void)
275
{
276
    ACPI_OBJECT_LIST        Params;
277
    ACPI_OBJECT             BufArg;
278
    UINT8                   Buffer[] = {
279
        0,0,0,0,
280
        4,0,0,0,
281
        1,2,3,4};
282
 
283
 
284
    BufArg.Type = ACPI_TYPE_BUFFER;
285
    BufArg.Buffer.Length = 12;
286
    BufArg.Buffer.Pointer = Buffer;
287
 
288
    Params.Count = 1;
289
    Params.Pointer = &BufArg;
290
 
2216 Serge 291
    (void) AcpiEvaluateObject (NULL, "\\BUF", &Params, NULL);
1498 serge 292
}
293
 
294
 
2216 Serge 295
static ACPI_OBJECT                 PkgArg;
296
static ACPI_OBJECT                 PkgElements[5];
297
static ACPI_OBJECT                 Pkg2Elements[5];
298
static ACPI_OBJECT_LIST            Params;
1498 serge 299
 
300
 
301
/*
302
 * Test using a Package object as an method argument
303
 */
2216 Serge 304
static void
1498 serge 305
AeTestPackageArgument (
306
    void)
307
{
308
 
309
    /* Main package */
310
 
311
    PkgArg.Type = ACPI_TYPE_PACKAGE;
312
    PkgArg.Package.Count = 4;
313
    PkgArg.Package.Elements = PkgElements;
314
 
315
    /* Main package elements */
316
 
317
    PkgElements[0].Type = ACPI_TYPE_INTEGER;
318
    PkgElements[0].Integer.Value = 0x22228888;
319
 
320
    PkgElements[1].Type = ACPI_TYPE_STRING;
321
    PkgElements[1].String.Length = sizeof ("Top-level package");
322
    PkgElements[1].String.Pointer = "Top-level package";
323
 
324
    PkgElements[2].Type = ACPI_TYPE_BUFFER;
325
    PkgElements[2].Buffer.Length = sizeof ("XXXX");
326
    PkgElements[2].Buffer.Pointer = (UINT8 *) "XXXX";
327
 
328
    PkgElements[3].Type = ACPI_TYPE_PACKAGE;
329
    PkgElements[3].Package.Count = 2;
330
    PkgElements[3].Package.Elements = Pkg2Elements;
331
 
332
    /* Sub-package elements */
333
 
334
    Pkg2Elements[0].Type = ACPI_TYPE_INTEGER;
335
    Pkg2Elements[0].Integer.Value = 0xAAAABBBB;
336
 
337
    Pkg2Elements[1].Type = ACPI_TYPE_STRING;
338
    Pkg2Elements[1].String.Length = sizeof ("Nested Package");
339
    Pkg2Elements[1].String.Pointer = "Nested Package";
340
 
341
    /* Parameter object */
342
 
343
    Params.Count = 1;
344
    Params.Pointer = &PkgArg;
345
 
2216 Serge 346
    (void) AcpiEvaluateObject (NULL, "\\_PKG", &Params, NULL);
1498 serge 347
}
348
 
349
 
2216 Serge 350
static ACPI_STATUS
1498 serge 351
AeGetDevices (
352
    ACPI_HANDLE                     ObjHandle,
353
    UINT32                          NestingLevel,
354
    void                            *Context,
355
    void                            **ReturnValue)
356
{
357
 
358
    return (AE_OK);
359
}
360
 
361
 
362
/******************************************************************************
363
 *
364
 * FUNCTION:    ExecuteOSI
365
 *
366
 * PARAMETERS:  OsiString           - String passed to _OSI method
367
 *              ExpectedResult      - 0 (FALSE) or 0xFFFFFFFF (TRUE)
368
 *
369
 * RETURN:      Status
370
 *
371
 * DESCRIPTION: Execute the internally implemented (in ACPICA) _OSI method.
372
 *
373
 *****************************************************************************/
374
 
2216 Serge 375
static ACPI_STATUS
1498 serge 376
ExecuteOSI (
377
    char                    *OsiString,
378
    UINT32                  ExpectedResult)
379
{
380
    ACPI_STATUS             Status;
381
    ACPI_OBJECT_LIST        ArgList;
382
    ACPI_OBJECT             Arg[1];
383
    ACPI_BUFFER             ReturnValue;
384
    ACPI_OBJECT             *Obj;
385
 
386
 
387
    /* Setup input argument */
388
 
389
    ArgList.Count = 1;
390
    ArgList.Pointer = Arg;
391
 
392
    Arg[0].Type = ACPI_TYPE_STRING;
393
    Arg[0].String.Pointer = OsiString;
394
    Arg[0].String.Length = strlen (Arg[0].String.Pointer);
395
 
396
    /* Ask ACPICA to allocate space for the return object */
397
 
398
    ReturnValue.Length = ACPI_ALLOCATE_BUFFER;
399
 
400
    Status = AcpiEvaluateObject (NULL, "\\_OSI", &ArgList, &ReturnValue);
401
 
402
    if (ACPI_FAILURE (Status))
403
    {
404
        AcpiOsPrintf ("Could not execute _OSI method, %s\n",
405
            AcpiFormatException (Status));
406
        return (Status);
407
    }
408
 
409
    if (ReturnValue.Length < sizeof (ACPI_OBJECT))
410
    {
411
        AcpiOsPrintf ("Return value from _OSI method too small, %.8X\n",
412
            ReturnValue.Length);
413
        return (AE_ERROR);
414
    }
415
 
416
    Obj = ReturnValue.Pointer;
417
    if (Obj->Type != ACPI_TYPE_INTEGER)
418
    {
419
        AcpiOsPrintf ("Invalid return type from _OSI method, %.2X\n", Obj->Type);
420
        return (AE_ERROR);
421
    }
422
 
423
    if (Obj->Integer.Value != ExpectedResult)
424
    {
425
        AcpiOsPrintf ("Invalid return value from _OSI, expected %.8X found %.8X\n",
426
            ExpectedResult, (UINT32) Obj->Integer.Value);
427
        return (AE_ERROR);
428
    }
429
 
430
    /* Reset the OSI data */
431
 
432
    AcpiGbl_OsiData = 0;
433
    return (AE_OK);
434
}
435
 
436
 
437
/******************************************************************************
438
 *
439
 * FUNCTION:    AeGenericRegisters
440
 *
441
 * DESCRIPTION: Call the AcpiRead/Write interfaces.
442
 *
443
 *****************************************************************************/
444
 
2216 Serge 445
static ACPI_GENERIC_ADDRESS       GenericRegister;
1498 serge 446
 
2216 Serge 447
static void
1498 serge 448
AeGenericRegisters (
449
    void)
450
{
451
    ACPI_STATUS             Status;
452
    UINT64                  Value;
453
 
454
 
455
    GenericRegister.Address = 0x1234;
456
    GenericRegister.BitWidth = 64;
457
    GenericRegister.BitOffset = 0;
458
    GenericRegister.SpaceId = ACPI_ADR_SPACE_SYSTEM_IO;
459
 
460
    Status = AcpiRead (&Value, &GenericRegister);
2216 Serge 461
    AE_CHECK_OK (AcpiRead, Status);
462
 
1498 serge 463
    Status = AcpiWrite (Value, &GenericRegister);
2216 Serge 464
    AE_CHECK_OK (AcpiWrite, Status);
1498 serge 465
 
466
    GenericRegister.Address = 0x12345678;
467
    GenericRegister.BitOffset = 0;
468
    GenericRegister.SpaceId = ACPI_ADR_SPACE_SYSTEM_MEMORY;
469
 
470
    Status = AcpiRead (&Value, &GenericRegister);
2216 Serge 471
    AE_CHECK_OK (AcpiRead, Status);
472
 
1498 serge 473
    Status = AcpiWrite (Value, &GenericRegister);
2216 Serge 474
    AE_CHECK_OK (AcpiWrite, Status);
1498 serge 475
}
476
 
477
 
478
/******************************************************************************
479
 *
480
 * FUNCTION:    AeHardwareInterfaces
481
 *
482
 * DESCRIPTION: Call various hardware support interfaces
483
 *
484
 *****************************************************************************/
485
 
2216 Serge 486
static void
1498 serge 487
AeHardwareInterfaces (
488
    void)
489
{
490
    ACPI_STATUS             Status;
491
    UINT32                  Value;
492
 
493
 
494
    Status = AcpiWriteBitRegister (ACPI_BITREG_WAKE_STATUS, 1);
2216 Serge 495
    AE_CHECK_OK (AcpiWriteBitRegister, Status);
496
 
1498 serge 497
    Status = AcpiWriteBitRegister (ACPI_BITREG_GLOBAL_LOCK_ENABLE, 1);
2216 Serge 498
    AE_CHECK_OK (AcpiWriteBitRegister, Status);
499
 
1498 serge 500
    Status = AcpiWriteBitRegister (ACPI_BITREG_SLEEP_ENABLE, 1);
2216 Serge 501
    AE_CHECK_OK (AcpiWriteBitRegister, Status);
502
 
1498 serge 503
    Status = AcpiWriteBitRegister (ACPI_BITREG_ARB_DISABLE, 1);
2216 Serge 504
    AE_CHECK_OK (AcpiWriteBitRegister, Status);
1498 serge 505
 
2216 Serge 506
 
1498 serge 507
    Status = AcpiReadBitRegister (ACPI_BITREG_WAKE_STATUS, &Value);
2216 Serge 508
    AE_CHECK_OK (AcpiReadBitRegister, Status);
509
 
1498 serge 510
    Status = AcpiReadBitRegister (ACPI_BITREG_GLOBAL_LOCK_ENABLE, &Value);
2216 Serge 511
    AE_CHECK_OK (AcpiReadBitRegister, Status);
512
 
1498 serge 513
    Status = AcpiReadBitRegister (ACPI_BITREG_SLEEP_ENABLE, &Value);
2216 Serge 514
    AE_CHECK_OK (AcpiReadBitRegister, Status);
515
 
1498 serge 516
    Status = AcpiReadBitRegister (ACPI_BITREG_ARB_DISABLE, &Value);
2216 Serge 517
    AE_CHECK_OK (AcpiReadBitRegister, Status);
1498 serge 518
}
519
 
520
 
521
/******************************************************************************
522
 *
523
 * FUNCTION:    AeMiscellaneousTests
524
 *
525
 * DESCRIPTION: Various ACPICA validation tests.
526
 *
527
 *****************************************************************************/
528
 
529
void
530
AeMiscellaneousTests (
531
    void)
532
{
533
    ACPI_HANDLE             Handle;
534
    ACPI_BUFFER             ReturnBuf;
535
    char                    Buffer[32];
536
    ACPI_VENDOR_UUID        Uuid = {0, {ACPI_INIT_UUID (0,0,0,0,0,0,0,0,0,0,0)}};
537
    ACPI_STATUS             Status;
538
    UINT32                  LockHandle1;
539
    UINT32                  LockHandle2;
540
    ACPI_STATISTICS         Stats;
541
 
542
 
543
    AeHardwareInterfaces ();
544
    AeGenericRegisters ();
545
    AeSetupConfiguration (Ssdt3Code);
546
 
547
    AeTestBufferArgument();
548
    AeTestPackageArgument ();
549
 
550
 
2216 Serge 551
    Status = AcpiInstallInterface ("");
552
    AE_CHECK_STATUS (AcpiInstallInterface, Status, AE_BAD_PARAMETER);
553
 
554
    Status = AcpiInstallInterface ("TestString");
555
    AE_CHECK_OK (AcpiInstallInterface, Status);
556
 
557
    Status = AcpiInstallInterface ("TestString");
558
    AE_CHECK_STATUS (AcpiInstallInterface, Status, AE_ALREADY_EXISTS);
559
 
560
    Status = AcpiRemoveInterface ("Windows 2006");
561
    AE_CHECK_OK (AcpiRemoveInterface, Status);
562
 
563
    Status = AcpiRemoveInterface ("TestString");
564
    AE_CHECK_OK (AcpiRemoveInterface, Status);
565
 
566
    Status = AcpiRemoveInterface ("XXXXXX");
567
    AE_CHECK_STATUS (AcpiRemoveInterface, Status, AE_NOT_EXIST);
568
 
569
    Status = AcpiInstallInterface ("AnotherTestString");
570
    AE_CHECK_OK (AcpiInstallInterface, Status);
571
 
572
 
573
    Status = ExecuteOSI ("Windows 2001", 0xFFFFFFFF);
574
    AE_CHECK_OK (ExecuteOSI, Status);
575
 
576
    Status = ExecuteOSI ("MichiganTerminalSystem", 0);
577
    AE_CHECK_OK (ExecuteOSI, Status);
578
 
579
 
1498 serge 580
    ReturnBuf.Length = 32;
581
    ReturnBuf.Pointer = Buffer;
582
 
2216 Serge 583
    Status = AcpiGetName (AcpiGbl_RootNode, ACPI_FULL_PATHNAME, &ReturnBuf);
584
    AE_CHECK_OK (AcpiGetName, Status);
1498 serge 585
 
2216 Serge 586
    Status = AcpiEnableEvent (ACPI_EVENT_GLOBAL, 0);
587
    AE_CHECK_OK (AcpiEnableEvent, Status);
588
 
589
    Status = AcpiInstallGlobalEventHandler (AeGlobalEventHandler, NULL);
590
    AE_CHECK_OK (AcpiInstallGlobalEventHandler, Status);
591
 
1498 serge 592
    /*
593
     * GPEs: Handlers, enable/disable, etc.
594
     */
2216 Serge 595
    Status = AcpiInstallGpeHandler (NULL, 0, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
596
    AE_CHECK_OK (AcpiInstallGpeHandler, Status);
1498 serge 597
 
2216 Serge 598
    Status = AcpiEnableGpe (NULL, 0);
599
    AE_CHECK_OK (AcpiEnableGpe, Status);
1498 serge 600
 
2216 Serge 601
    Status = AcpiRemoveGpeHandler (NULL, 0, AeGpeHandler);
602
    AE_CHECK_OK (AcpiRemoveGpeHandler, Status);
1498 serge 603
 
2216 Serge 604
    Status = AcpiInstallGpeHandler (NULL, 0, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
605
    AE_CHECK_OK (AcpiInstallGpeHandler, Status);
1498 serge 606
 
2216 Serge 607
    Status = AcpiEnableGpe (NULL, 0);
608
    AE_CHECK_OK (AcpiEnableGpe, Status);
1498 serge 609
 
2216 Serge 610
    Status = AcpiSetGpe (NULL, 0, ACPI_GPE_DISABLE);
611
    AE_CHECK_OK (AcpiSetGpe, Status);
1498 serge 612
 
2216 Serge 613
    Status = AcpiSetGpe (NULL, 0, ACPI_GPE_ENABLE);
614
    AE_CHECK_OK (AcpiSetGpe, Status);
1498 serge 615
 
2216 Serge 616
 
617
    Status = AcpiInstallGpeHandler (NULL, 1, ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
618
    AE_CHECK_OK (AcpiInstallGpeHandler, Status);
619
 
620
    Status = AcpiEnableGpe (NULL, 1);
621
    AE_CHECK_OK (AcpiEnableGpe, Status);
622
 
623
 
624
    Status = AcpiInstallGpeHandler (NULL, 2, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
625
    AE_CHECK_OK (AcpiInstallGpeHandler, Status);
626
 
627
    Status = AcpiEnableGpe (NULL, 2);
628
    AE_CHECK_OK (AcpiEnableGpe, Status);
629
 
630
 
631
    Status = AcpiInstallGpeHandler (NULL, 3, ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
632
    AE_CHECK_OK (AcpiInstallGpeHandler, Status);
633
 
634
    Status = AcpiInstallGpeHandler (NULL, 4, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
635
    AE_CHECK_OK (AcpiInstallGpeHandler, Status);
636
 
637
    Status = AcpiInstallGpeHandler (NULL, 5, ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
638
    AE_CHECK_OK (AcpiInstallGpeHandler, Status);
639
 
640
    Status = AcpiGetHandle (NULL, "\\_SB", &Handle);
641
    AE_CHECK_OK (AcpiGetHandle, Status);
642
 
643
    Status = AcpiSetupGpeForWake (Handle, NULL, 5);
644
    AE_CHECK_OK (AcpiSetupGpeForWake, Status);
645
 
646
    Status = AcpiSetGpeWakeMask (NULL, 5, ACPI_GPE_ENABLE);
647
    AE_CHECK_OK (AcpiGpeWakeup, Status);
648
 
649
    Status = AcpiSetupGpeForWake (Handle, NULL, 6);
650
    AE_CHECK_OK (AcpiSetupGpeForWake, Status);
651
 
652
    Status = AcpiSetupGpeForWake (Handle, NULL, 9);
653
    AE_CHECK_OK (AcpiSetupGpeForWake, Status);
654
 
655
    Status = AcpiInstallGpeHandler (NULL, 0x19, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
656
    AE_CHECK_OK (AcpiInstallGpeHandler, Status);
657
 
658
    Status = AcpiEnableGpe (NULL, 0x19);
659
    AE_CHECK_OK (AcpiEnableGpe, Status);
660
 
661
 
662
    Status = AcpiInstallGpeHandler (NULL, 0x62, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
663
    AE_CHECK_OK (AcpiInstallGpeHandler, Status);
664
 
665
    Status = AcpiEnableGpe (NULL, 0x62);
666
    AE_CHECK_OK (AcpiEnableGpe, Status);
667
 
668
    Status = AcpiDisableGpe (NULL, 0x62);
669
    AE_CHECK_OK (AcpiDisableGpe, Status);
670
 
1498 serge 671
    AfInstallGpeBlock ();
672
 
2216 Serge 673
    /* Here is where the GPEs are actually "enabled" */
1498 serge 674
 
2216 Serge 675
    Status = AcpiUpdateAllGpes ();
676
    AE_CHECK_OK (AcpiUpdateAllGpes, Status);
677
 
1498 serge 678
    Status = AcpiGetHandle (NULL, "RSRC", &Handle);
679
    if (ACPI_SUCCESS (Status))
680
    {
681
        ReturnBuf.Length = ACPI_ALLOCATE_BUFFER;
682
 
683
        Status = AcpiGetVendorResource (Handle, "_CRS", &Uuid, &ReturnBuf);
684
        if (ACPI_SUCCESS (Status))
685
        {
686
            AcpiOsFree (ReturnBuf.Pointer);
687
        }
688
    }
689
 
690
    /* Test global lock */
691
 
692
    Status = AcpiAcquireGlobalLock (0xFFFF, &LockHandle1);
2216 Serge 693
    AE_CHECK_OK (AcpiAcquireGlobalLock, Status);
1498 serge 694
 
695
    Status = AcpiAcquireGlobalLock (0x5, &LockHandle2);
2216 Serge 696
    AE_CHECK_OK (AcpiAcquireGlobalLock, Status);
1498 serge 697
 
698
    Status = AcpiReleaseGlobalLock (LockHandle1);
2216 Serge 699
    AE_CHECK_OK (AcpiReleaseGlobalLock, Status);
1498 serge 700
 
701
    Status = AcpiReleaseGlobalLock (LockHandle2);
2216 Serge 702
    AE_CHECK_OK (AcpiReleaseGlobalLock, Status);
1498 serge 703
 
704
    /* Get Devices */
705
 
706
    Status = AcpiGetDevices (NULL, AeGetDevices, NULL, NULL);
2216 Serge 707
    AE_CHECK_OK (AcpiGetDevices, Status);
1498 serge 708
 
709
    Status = AcpiGetStatistics (&Stats);
2216 Serge 710
    AE_CHECK_OK (AcpiGetStatistics, Status);
1498 serge 711
}
712