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