| 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 Device/Processor/ThermalZone/PowerResource |
| 31 |
*/ |
| 32 |
|
| 33 |
/* |
| 34 |
* Verify if Type1Opcode (ex., If) and Type2Opcode (ex., Store) is allowed |
| 35 |
* under Device, PowerResource, Processor, or ThermalZone |
| 36 |
* |
| 37 |
* ASL spec state: |
| 38 |
* 1. DeviceTerm supports ObjectList for ACPI 1.0 ~ ACPI 6.1. |
| 39 |
* 2. PwerResTerm supports ObjectList for ACPI 1.0 ~ ACPI 6.1. |
| 40 |
* 3. ProcessorTerm supports ObjectList for ACPI 1.0 ~ ACPI 6.1. |
| 41 |
* 4. ThermalZoneTerm supports ObjectList for ACPI 1.0 ~ ACPI 6.1. |
| 42 |
* |
| 43 |
* AML spec state: |
| 44 |
* 1. DefDevice supports ObjectList for ACPI 1.0 ~ ACPI 6.0. |
| 45 |
* 2. DefPowerRes supports ObjectList for ACPI 1.0 ~ ACPI 6.0. |
| 46 |
* 3. DefProcessor supports ObjectList for ACPI 1.0 ~ ACPI 6.0. |
| 47 |
* 4. DefThermalZone supports ObjectList for ACPI 1.0 ~ ACPI 6.0. |
| 48 |
* |
| 49 |
* It appears the AML interpreter shouldn't support TermList for these |
| 50 |
* objects as both the ASL grammar and AML grammar doesn't allow it. But |
| 51 |
* the real world appears not. |
| 52 |
*/ |
| 53 |
|
| 54 |
Name(z181, 181) |
| 55 |
|
| 56 |
/* Tests for Type1Opcode */ |
| 57 |
|
| 58 |
Name(ml10, 0) |
| 59 |
Name(ml11, 0) |
| 60 |
Name(ml12, 0) |
| 61 |
Name(ml13, 0) |
| 62 |
|
| 63 |
Scope(\_SB) |
| 64 |
{ |
| 65 |
Device(dev0) |
| 66 |
{ |
| 67 |
if (LEqual(ml10, 0)) { |
| 68 |
Store(2, ml10) |
| 69 |
} |
| 70 |
PowerResource(pr00, 1, 0) |
| 71 |
{ |
| 72 |
if (LEqual(ml13, 0)) { |
| 73 |
Store(2, ml13) |
| 74 |
} |
| 75 |
} |
| 76 |
} |
| 77 |
} |
| 78 |
Scope(\_PR) |
| 79 |
{ |
| 80 |
Processor(cpu0, 0, 0xFFFFFFFF, 0) |
| 81 |
{ |
| 82 |
if (LEqual(ml11, 0)) { |
| 83 |
Store(2, ml11) |
| 84 |
} |
| 85 |
} |
| 86 |
} |
| 87 |
Scope(\_TZ) |
| 88 |
{ |
| 89 |
ThermalZone(thz0) |
| 90 |
{ |
| 91 |
if (LEqual(ml12, 0)) { |
| 92 |
Store(2, ml12) |
| 93 |
} |
| 94 |
} |
| 95 |
} |
| 96 |
|
| 97 |
Method(MLO0,, Serialized) |
| 98 |
{ |
| 99 |
Name(ts, "MLO0") |
| 100 |
|
| 101 |
Store("TEST: MLO0, Type1Opcode is executable under objects", Debug) |
| 102 |
|
| 103 |
if (LNotEqual(ml10, 2)) { |
| 104 |
err(ts, z181, __LINE__, z181, 0, ml10, 2) |
| 105 |
} |
| 106 |
if (LNotEqual(ml11, 2)) { |
| 107 |
err(ts, z181, __LINE__, z181, 1, ml11, 2) |
| 108 |
} |
| 109 |
if (LNotEqual(ml12, 2)) { |
| 110 |
err(ts, z181, __LINE__, z181, 2, ml12, 2) |
| 111 |
} |
| 112 |
if (LNotEqual(ml13, 2)) { |
| 113 |
err(ts, z181, __LINE__, z181, 3, ml13, 2) |
| 114 |
} |
| 115 |
} |
| 116 |
|
| 117 |
/* Tests for Type2Opcode */ |
| 118 |
|
| 119 |
Name(ml14, 0) |
| 120 |
Name(ml15, 0) |
| 121 |
Name(ml16, 0) |
| 122 |
Name(ml17, 0) |
| 123 |
|
| 124 |
Scope(\_SB) |
| 125 |
{ |
| 126 |
Device(dev1) |
| 127 |
{ |
| 128 |
Store (1, ml14) |
| 129 |
if (LEqual(ml14, 1)) { |
| 130 |
Store(2, ml14) |
| 131 |
} |
| 132 |
PowerResource(pr01, 1, 0) |
| 133 |
{ |
| 134 |
Store (1, ml15) |
| 135 |
if (LEqual(ml15, 1)) { |
| 136 |
Store(2, ml15) |
| 137 |
} |
| 138 |
} |
| 139 |
} |
| 140 |
} |
| 141 |
Scope(\_PR) |
| 142 |
{ |
| 143 |
Processor(cpu1, 0, 0xFFFFFFFF, 0) |
| 144 |
{ |
| 145 |
Store (1, ml16) |
| 146 |
if (LEqual(ml16, 1)) { |
| 147 |
Store(2, ml16) |
| 148 |
} |
| 149 |
} |
| 150 |
} |
| 151 |
Scope(\_TZ) |
| 152 |
{ |
| 153 |
ThermalZone(thz1) |
| 154 |
{ |
| 155 |
Store (1, ml17) |
| 156 |
if (LEqual(ml17, 1)) { |
| 157 |
Store(2, ml17) |
| 158 |
} |
| 159 |
} |
| 160 |
} |
| 161 |
|
| 162 |
Method(MLO1,, Serialized) |
| 163 |
{ |
| 164 |
Name(ts, "MLO1") |
| 165 |
|
| 166 |
Store("TEST: MLO1 Type2Opcode is executable under objects", Debug) |
| 167 |
|
| 168 |
if (LNotEqual(ml14, 2)) { |
| 169 |
err(ts, z181, __LINE__, z181, 4, ml14, 2) |
| 170 |
} |
| 171 |
if (LNotEqual(ml15, 2)) { |
| 172 |
err(ts, z181, __LINE__, z181, 5, ml15, 2) |
| 173 |
} |
| 174 |
if (LNotEqual(ml16, 2)) { |
| 175 |
err(ts, z181, __LINE__, z181, 6, ml16, 2) |
| 176 |
} |
| 177 |
if (LNotEqual(ml17, 2)) { |
| 178 |
err(ts, z181, __LINE__, z181, 7, ml17, 2) |
| 179 |
} |
| 180 |
} |