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 * Tests applicable to both AcpiExec and MS-abbu utilities 31 */ 32DefinitionBlock("extra.aml", "DSDT", 0x1, "INTEL", "ABCDE", 0x1) 33{ 34 Scope(\_SB) 35 { 36 Device(ABBU) 37 { 38 Name(_HID, "ACPIABB0") 39 Method(ENBL) 40 { 41 Return(Zero) 42 } 43 44 Method(TEST) 45 { 46 Return(Zero) 47 } 48 49 Method(TST) 50 { 51 Return(TSTS) 52 } 53 54 /* Definitions of common use */ 55 56 /* 57 * AI00: 58 * 59 * The abbu utility provides some restricted amount of elements of POUT, 60 * it is not the constant number of elements of Package (!), not good interface, 61 * but looks like some restricted amount of memory. When that variable number of 62 * elements is exceeded, abbu returns FAILURE which we can't differentiate from 63 * the actual failure of MS being examined. So, don't use the big AI00 to be sure 64 * that returned FAILURE, if any, is not caused by the mentioned fact. 65 */ 66 Name (AI00, 17) // MAX 67 Name (POUT, Package(17) {}) 68 69 Name (AI01, 0) // current OUT 70 Name (AI02, 0) // counter of lost POUT messages 71 Name (AI07, 0) // print once only the end-message 72 Name (AI08, 0) // total number of messages 73 74 Method(OUUP, 2) 75 { 76 /* Last 6 lines are reserved for the test run summary and end-message */ 77 Subtract(AI00, 6, Local0) 78 79 if (LLess(AI01, Local0)) { 80 Store(arg0, Index(POUT, AI01)) 81 Increment(AI01) 82 } else { 83 /* Last 2 lines are reserved for the end-message */ 84 Subtract(AI00, 2, Local0) 85 if (LAnd(arg1, LLess(AI01, Local0))) { 86 Store(arg0, Index(POUT, AI01)) 87 Increment(AI01) 88 } else { 89 if (LNot(AI07)) { 90 Store(1, AI07) 91 Subtract(AI00, 2, Local0) 92 Store("******** POUT exceeded ********", Index(POUT, Local0)) 93 } 94 } 95 } 96 97 /* Last element of POUT is the total number of messages */ 98 99 Increment(AI08) 100 Subtract(AI00, 1, Local0) 101 Store(AI08, Index(POUT, Local0)) 102 } 103 104 Method(OUTP, 1) 105 { 106 OUUP(arg0, 0) 107 } 108 109 /* 110 * Reset POUT service to the initial state 111 */ 112 Method(RST9,, Serialized) 113 { 114 Name(lpN0, 0) 115 Name(lpC0, 0) 116 117 Store (0, AI01) 118 Store (0, AI02) 119 Store (0, AI07) 120 Store (0, AI08) 121 122 Store(AI00, lpN0) 123 Store(0, lpC0) 124 While (lpN0) { 125 Store(" ", Index(POUT, lpC0)) 126 Decrement(lpN0) 127 Increment(lpC0) 128 } 129 130 Subtract(AI00, 2, Local0) 131 Store("Total number of messages:", Index(POUT, Local0)) 132 Increment(Local0) 133 Store(0, Index(POUT, Local0)) 134 } 135 136// ====================================================== // 137// ====================================================== // 138// ====================================================== // 139 140/* Definitions relative to the subject */ 141 142Include("./DECL_ABBU.asl") 143 144// ====================================================== // 145// ====================================================== // 146// ====================================================== // 147 148 149 Name(TSTS, Package() 150 { 151 "ENBL", 152 "TEST", 153 "TST_", 154 "MAIN", 155 "IN00", 156 }) 157 } 158 } 159 Method(MAIN) 160 { 161 Return (\_SB_.ABBU.MAIN()) 162 } 163 Method(MN00) 164 { 165 Return (\_SB_.ABBU.MN00()) 166 } 167 Method(MN01) 168 { 169 Return (\_SB_.ABBU.MN01()) 170 } 171} 172