1/* 2 * Some or all of this work - Copyright (c) 2006 - 2016, 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) is allowed under DefinitionBlock or 35 * 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 52Name(z180, 180) 53 54/* Tests for Type1Opcode */ 55 56Name(ml00, 0) 57Name(ml01, 0) 58Name(ml02, 0) 59 60if (LEqual(ml00, 0)) { 61 Store(2, ml00) 62} 63Scope(\) 64{ 65 if (LEqual(ml01, 0)) { 66 Store(2, ml01) 67 } 68} 69Scope(\_SB) 70{ 71 if (LEqual(ml02, 0)) { 72 Store(2, ml02) 73 } 74} 75 76Method(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, 0, z180, 0, ml00, 2) 84 } 85 if (LNotEqual(ml01, 2)) { 86 err(ts, z180, 1, z180, 1, ml01, 2) 87 } 88 if (LNotEqual(ml02, 2)) { 89 err(ts, z180, 2, z180, 2, ml02, 2) 90 } 91} 92