| 1 |
/* |
| 2 |
* Some or all of this work - Copyright (c) 2006 - 2021, Intel Corp. |
| 3 |
* All rights reserved. |
| 4 |
* |
| 5 |
* Redistribution and use in source and binary forms, with or without modification, |
| 6 |
* are permitted provided that the following conditions are met: |
| 7 |
* |
| 8 |
* Redistributions of source code must retain the above copyright notice, |
| 9 |
* this list of conditions and the following disclaimer. |
| 10 |
* Redistributions in binary form must reproduce the above copyright notice, |
| 11 |
* this list of conditions and the following disclaimer in the documentation |
| 12 |
* and/or other materials provided with the distribution. |
| 13 |
* Neither the name of Intel Corporation nor the names of its contributors |
| 14 |
* may be used to endorse or promote products derived from this software |
| 15 |
* without specific prior written permission. |
| 16 |
* |
| 17 |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 18 |
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 19 |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 20 |
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
| 21 |
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 22 |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 23 |
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 25 |
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
| 26 |
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 |
*/ |
| 28 |
|
| 29 |
/* |
| 30 |
* Module level execution under DefinitionBlock/Scope |
| 31 |
*/ |
| 32 |
|
| 33 |
/* |
| 34 |
* Verify if Type1Opcode (ex., If) and Type2Opcode (ex., Store) is allowed |
| 35 |
* under DefinitionBlock or Scope |
| 36 |
* |
| 37 |
* ASL spec state: |
| 38 |
* 1. DefinitionBlockTerm supports TermList for ACPI 1.0 ~ 6.0. |
| 39 |
* 2. ScopeTerm supports TermList for ACPI 1.0 and ObjectList for |
| 40 |
* ACPI 2.0 ~ 6.0. |
| 41 |
* |
| 42 |
* AML spec state: |
| 43 |
* 1. AMLCode supports TermList for ACPI 2.0 ~ 6.0. |
| 44 |
* 2. DefScope supports ObjectList for ACPI 1.0 and TermList for |
| 45 |
* ACPI 2.0 ~ 6.0. |
| 46 |
* |
| 47 |
* It appears the AML interpreter should support TermList for both |
| 48 |
* DefinitionBlock and Scope, but the ASL grammar is not compliant to the |
| 49 |
* AML grammar and the real world. |
| 50 |
*/ |
| 51 |
|
| 52 |
Name(z180, 180) |
| 53 |
|
| 54 |
/* Tests for Type1Opcode */ |
| 55 |
|
| 56 |
Name(ml00, 0) |
| 57 |
Name(ml01, 0) |
| 58 |
Name(ml02, 0) |
| 59 |
|
| 60 |
if (LEqual(ml00, 0)) { |
| 61 |
Store(2, ml00) |
| 62 |
} |
| 63 |
Scope(\) |
| 64 |
{ |
| 65 |
if (LEqual(ml01, 0)) { |
| 66 |
Store(2, ml01) |
| 67 |
} |
| 68 |
} |
| 69 |
Scope(\_SB) |
| 70 |
{ |
| 71 |
if (LEqual(ml02, 0)) { |
| 72 |
Store(2, ml02) |
| 73 |
} |
| 74 |
} |
| 75 |
|
| 76 |
Method(MLS0,, Serialized) |
| 77 |
{ |
| 78 |
Name(ts, "MLS0") |
| 79 |
|
| 80 |
Store("TEST: MLS0, Type1Opcode is executable under scopes", Debug) |
| 81 |
|
| 82 |
if (LNotEqual(ml00, 2)) { |
| 83 |
err(ts, z180, __LINE__, z180, 0, ml00, 2) |
| 84 |
} |
| 85 |
if (LNotEqual(ml01, 2)) { |
| 86 |
err(ts, z180, __LINE__, z180, 1, ml01, 2) |
| 87 |
} |
| 88 |
if (LNotEqual(ml02, 2)) { |
| 89 |
err(ts, z180, __LINE__, z180, 2, ml02, 2) |
| 90 |
} |
| 91 |
} |
| 92 |
|
| 93 |
/* Tests for Type2Opcode */ |
| 94 |
|
| 95 |
Name(ml03, 0) |
| 96 |
Name(ml04, 0) |
| 97 |
Name(ml05, 0) |
| 98 |
|
| 99 |
Store (1, ml03) |
| 100 |
if (LEqual(ml03, 1)) { |
| 101 |
Store(2, ml03) |
| 102 |
} |
| 103 |
Scope(\) |
| 104 |
{ |
| 105 |
Store (1, ml04) |
| 106 |
if (LEqual(ml04, 1)) { |
| 107 |
Store(2, ml04) |
| 108 |
} |
| 109 |
} |
| 110 |
Scope(\_SB) |
| 111 |
{ |
| 112 |
Store (1, ml05) |
| 113 |
if (LEqual(ml05, 1)) { |
| 114 |
Store(2, ml05) |
| 115 |
} |
| 116 |
} |
| 117 |
|
| 118 |
Method(MLS1,, Serialized) |
| 119 |
{ |
| 120 |
Name(ts, "MLS1") |
| 121 |
|
| 122 |
Store("TEST: MLS1, Type2Opcode is executable under scopes", Debug) |
| 123 |
|
| 124 |
if (LNotEqual(ml03, 2)) { |
| 125 |
err(ts, z180, __LINE__, z180, 3, ml03, 2) |
| 126 |
} |
| 127 |
if (LNotEqual(ml04, 2)) { |
| 128 |
err(ts, z180, __LINE__, z180, 4, ml04, 2) |
| 129 |
} |
| 130 |
if (LNotEqual(ml05, 2)) { |
| 131 |
err(ts, z180, __LINE__, z180, 5, ml05, 2) |
| 132 |
} |
| 133 |
} |