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 * Buffer Field 31 * 32 * (verify exceptions caused by the imprope use of Buffer Field type objects) 33 */ 34 35Name(z106, 106) 36 37Name(b700, Buffer(20) {}) 38CreateField(b700, 11, 31, bf20) 39CreateField(b700, 58, 65, bf21) 40 41Name(ii71, 0xabcd1234) 42Name(bi01, Buffer() {0xa4,0xa5,0xa6,0xa7,0xb8,0xb9,0xba,0xbb,0xbc}) 43 44// Expected exceptions: 45// 46// 47 - AE_AML_OPERAND_TYPE 47// See notes to m4b1 and m4b3 48// 49Method(m4be,, Serialized) 50{ 51 Name(ts, "m4be") 52 53 Name(bbf1, Buffer(20) {}) 54 CreateField(bbf1, 11, 31, bf02) 55 CreateField(bbf1, 58, 65, bf03) 56 57 // Local Named Object 58 Method(m000, 1, Serialized) 59 { 60 Name(bbf1, Buffer(20) {}) 61 CreateField(bbf1, 11, 31, bf02) 62 CreateField(bbf1, 58, 65, bf03) 63 64 Store(ii71, bf02) 65 Store(bi01, bf03) 66 67 // Like Integer behaviour 68 69 if (y083) { 70 Store (DerefOf(bf02), Local1) 71 CH06(arg0, 0, 47) 72 } 73 74 Store (Index(bf02, 0), Local1) 75 CH06(arg0, 1, 47) 76 77 // Like Buffer behaviour 78 79 if (y083) { 80 Store (DerefOf(bf03), Local1) 81 CH06(arg0, 2, 47) 82 } 83 84 Store (Index(bf03, 0), Local1) 85 if (y900) { 86 CH03(ts, z106, 0, 0, 0) 87 } else { 88 CH04(ts, 0, 85, z106, 0x123, 0, 0) // AE_INDEX_TO_NOT_ATTACHED 89 } 90 } 91 92 // Global Named Object 93 Method(m001, 1) 94 { 95 Store(ii71, bf20) 96 Store(bi01, bf21) 97 98 // Like Integer behaviour 99 100 if (y083) { 101 Store (DerefOf(bf20), Local1) 102 CH06(arg0, 3, 47) 103 } 104 105 Store (Index(bf20, 0), Local1) 106 CH06(arg0, 4, 47) 107 108 // Like Buffer behaviour 109 110 if (y083) { 111 Store (DerefOf(bf21), Local1) 112 CH06(arg0, 5, 47) 113 } 114 115 Store (Index(bf21, 0), Local1) 116 if (y900) { 117 CH03(ts, z106, 1, 0, 0) 118 } else { 119 CH04(ts, 0, 85, z106, 0x123, 0, 0) // AE_INDEX_TO_NOT_ATTACHED 120 } 121 122 } 123 124 // Reference to Object 125 Method(m002, 3) 126 { 127 Store(arg0, Debug) 128 Store(arg1, Debug) 129 130 Store(ObjectType(arg1), Local0) 131 if (LNotEqual(Local0, 14)) { 132 err(arg0, z106, 6, 0, 0, Local0, 14) 133 return (1) 134 } 135 136 Store (DerefOf(arg1), Local1) 137 CH03(ts, z106, 2, 0, 0) 138 139 Store (DerefOf(DerefOf(arg1)), Local1) 140 CH06(arg0, 7, 47) 141 142 Store (Index(DerefOf(arg1), 0), Local1) 143 144 if (arg2) { 145 // Like Buffer behaviour 146 if (y900) { 147 CH03(ts, z106, 3, 0, 0) 148 } else { 149 CH04(ts, 0, 85, z106, 0x123, 0, 0) // AE_INDEX_TO_NOT_ATTACHED 150 } 151 } else { 152 // Like Integer behaviour 153 CH06(arg0, 8, 47) 154 } 155 156 Store (Match(DerefOf(arg1), MTR, 0, MTR, 0, 0), Local1) 157 CH06(arg0, 9, 47) 158 159 return (0) 160 } 161 162 // Reference to Object as Result of Method invocation 163 Method(m003, 1, Serialized) 164 { 165 Name(bbf1, Buffer(20) {}) 166 CreateField(bbf1, 11, 31, bf02) 167 CreateField(bbf1, 58, 65, bf03) 168 169 Name(i000, 0) // Label to check m000 invocations 170 171 Method(m000, 2) 172 { 173 Store(arg0, i000) 174 if (LEqual(arg1, 0)) { 175 Store(Refof(bf20), Local0) 176 } elseif (LEqual(arg1, 1)) { 177 Store(Refof(bf21), Local0) 178 } elseif (LEqual(arg1, 2)) { 179 Store(Refof(bf02), Local0) 180 } elseif (LEqual(arg1, 3)) { 181 Store(Refof(bf03), Local0) 182 } 183 Return (Local0) 184 } 185 186 Method(CH00, 2) 187 { 188 if (LNotEqual(i000, arg1)) { 189 err(arg0, z106, 10, 0, 0, i000, arg1) 190 } 191 } 192 193 Name(lpN0, 4) 194 Name(lpC0, 0) 195 196 Store(ii71, bf20) 197 Store(bi01, bf21) 198 Store(ii71, bf02) 199 Store(bi01, bf03) 200 201 While (lpN0) { 202 Multiply(3, lpC0, Local0) 203 204 Store(0, i000) 205 206 Store (DerefOf(m000(1, lpC0)), Local1) 207 CH03(ts, z106, Add(4, lpC0), 0, 0) 208 CH00(arg0, 1) 209 210 211 Store (DerefOf(DerefOf(m000(2, lpC0))), Local1) 212 CH06(arg0, Add(11, Local0), 47) 213 CH00(arg0, 2) 214 215 Store (Index(DerefOf(m000(3, lpC0)), 0), Local1) 216 if (Mod(lpC0, 2)) { 217 // Like Buffer behaviour 218 if (y900) { 219 CH03(ts, z106, Add(8, lpC0), 0, 0) 220 } else { 221 CH04(ts, 0, 85, z106, 0x123, 0, 0) // AE_INDEX_TO_NOT_ATTACHED 222 } 223 } else { 224 // Like Integer behaviour 225 CH06(arg0, Add(12, Local0), 47) 226 } 227 CH00(arg0, 3) 228 229 Store (Match(DerefOf(m000(4, lpC0)), MTR, 0, MTR, 0, 0), Local1) 230 CH06(arg0, Add(13, Local0), 47) 231 CH00(arg0, 4) 232 233 Decrement(lpN0) 234 Increment(lpC0) 235 } 236 } 237 238 CH03(ts, z106, 12, 0, 0) 239 240 // Local Named Object 241 m000(ts) 242 243 // Global Named Object 244 m001(ts) 245 246 // Reference to Local Named Object 247 248 Store(ii71, bf02) 249 Store(bi01, bf03) 250 251 m002(Concatenate(ts, "-m002-RefLocNameI"), RefOf(bf02), 0) 252 253 Store(RefOf(bf02), Local0) 254 m002(Concatenate(ts, "-m002-RefLocName2I"), Local0, 0) 255 256 CondRefOf(bf02, Local0) 257 m002(Concatenate(ts, "-m002-CondRefLocNameI"), Local0, 0) 258 259 m002(Concatenate(ts, "-m002-RefLocNameB"), RefOf(bf03), 1) 260 261 Store(RefOf(bf03), Local0) 262 m002(Concatenate(ts, "-m002-RefLocName2B"), Local0, 1) 263 264 CondRefOf(bf03, Local0) 265 m002(Concatenate(ts, "-m002-CondRefLocNameB"), Local0, 1) 266 267 Store(ii71, bf20) 268 Store(bi01, bf21) 269 270 m002(Concatenate(ts, "-m002-RefGlobNameI"), RefOf(bf20), 0) 271 272 Store(RefOf(bf20), Local0) 273 m002(Concatenate(ts, "-m002-RefGlobName2I"), Local0, 0) 274 275 CondRefOf(bf20, Local0) 276 m002(Concatenate(ts, "-m002-CondRefGlobNameI"), Local0, 0) 277 278 m002(Concatenate(ts, "-m002-RefGlobNameB"), RefOf(bf21), 1) 279 280 Store(RefOf(bf21), Local0) 281 m002(Concatenate(ts, "-m002-RefGlobName2B"), Local0, 1) 282 283 CondRefOf(bf21, Local0) 284 m002(Concatenate(ts, "-m002-CondRefGlobNameB"), Local0, 1) 285 286 // Reference to Object as Result of Method invocation 287 m003(ts) 288} 289