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 * Method execution control 31 * 32 * Switch, Case, Default operators 33 */ 34 35Name(z068, 68) 36 37Name(swi0, 0) 38Name(swi1, 0) 39 40 41/////////////// {if} 42 43Method(m0d0) 44{ 45 Store(2, Local0) 46 47 Switch (swi0) { 48 Case (0) { 49 Store(1, Local0) 50 Switch (swi1) { 51 Case (0) { 52 Store(0, Local0) 53 }} 54 }} 55 return (Local0) 56} 57 58Method(m0d1) 59{ 60 Store(3, Local0) 61 62 Switch (swi0) { 63 Case (0) { 64 Store(12345678, Local0) 65 Switch (swi1) { 66 Case (0) { 67 Store(0, Local0) 68 } 69 Case (1) { 70 Store(1, Local0) 71 } 72 Default { 73 Store(2, Local0) 74 }} 75 }} 76 return (Local0) 77} 78 79/////////////// {if,else} {if} 80 81Method(m0d2) 82{ 83 Store(12345678, Local0) 84 85 Switch (swi0) { 86 Case (0) { 87 Store(1, Local0) 88 Switch (swi1) { 89 Case (0) { 90 Store(0, Local0) 91 }} 92 } 93 Default { 94 Store(3, Local0) 95 Switch (swi1) { 96 Case (0) { 97 Store(2, Local0) 98 }} 99 }} 100 return (Local0) 101} 102 103/////////////// {if,else} {if,else} 104 105Method(m0d3) 106{ 107 Store(12345678, Local0) 108 109 Switch (swi0) { 110 Case (0) { 111 Store(12345678, Local0) 112 Switch (swi1) { 113 Case (0) { 114 Store(0, Local0) 115 } 116 Default { 117 Store(1, Local0) 118 }} 119 } 120 Default { 121 Store(12345678, Local0) 122 Switch (swi1) { 123 Case (0) { 124 Store(2, Local0) 125 } 126 Default { 127 Store(3, Local0) 128 }} 129 }} 130 return (Local0) 131} 132 133/////////////// {if,else} {if,elseif} 134 135Method(m0d4) 136{ 137 Store(12345678, Local0) 138 139 Switch (swi0) { 140 Case (0) { 141 Store(2, Local0) 142 Switch (swi1) { 143 Case (0) { 144 Store(0, Local0) 145 } 146 Case (1) { 147 Store(1, Local0) 148 }} 149 } 150 Default { 151 Store(5, Local0) 152 Switch (swi1) { 153 Case (0) { 154 Store(3, Local0) 155 } 156 Case (1) { 157 Store(4, Local0) 158 }} 159 }} 160 return (Local0) 161} 162 163/////////////// {if,else} {if,elseif,else} 164 165Method(m0d5) 166{ 167 Store(12345678, Local0) 168 169 Switch (swi0) { 170 Case (0) { 171 Store(12345678, Local0) 172 Switch (swi1) { 173 Case (0) { 174 Store(0, Local0) 175 } 176 Case (1) { 177 Store(1, Local0) 178 } 179 Default { 180 Store(2, Local0) 181 }} 182 } 183 Default { 184 Store(12345678, Local0) 185 Switch (swi1) { 186 Case (0) { 187 Store(3, Local0) 188 } 189 Case (1) { 190 Store(4, Local0) 191 } 192 Default { 193 Store(5, Local0) 194 }} 195 }} 196 return (Local0) 197} 198 199/////////////// {if,elseif} {if} 200 201Method(m0d6) 202{ 203 Store(4, Local0) 204 205 Switch (swi0) { 206 Case (0) { 207 Store(1, Local0) 208 Switch (swi1) { 209 Case (0) { 210 Store(0, Local0) 211 }} 212 } 213 Case (1) { 214 Store(3, Local0) 215 Switch (swi1) { 216 Case (0) { 217 Store(2, Local0) 218 }} 219 }} 220 return (Local0) 221} 222 223/////////////// {if,elseif} {if,else} 224 225Method(m0d7) 226{ 227 Store(4, Local0) 228 229 Switch (swi0) { 230 Case (0) { 231 Store(12345678, Local0) 232 Switch (swi1) { 233 Case (0) { 234 Store(0, Local0) 235 } 236 Default { 237 Store(1, Local0) 238 }} 239 } 240 Case (1) { 241 Store(12345678, Local0) 242 Switch (swi1) { 243 Case (0) { 244 Store(2, Local0) 245 } 246 Default { 247 Store(3, Local0) 248 }} 249 }} 250 return (Local0) 251} 252 253/////////////// {if,elseif} {if,elseif} 254 255Method(m0d8) 256{ 257 Store(6, Local0) 258 259 Switch (swi0) { 260 Case (0) { 261 Store(2, Local0) 262 Switch (swi1) { 263 Case (0) { 264 Store(0, Local0) 265 } 266 Case (1) { 267 Store(1, Local0) 268 }} 269 } 270 Case (1) { 271 Store(5, Local0) 272 Switch (swi1) { 273 Case (0) { 274 Store(3, Local0) 275 } 276 Case (1) { 277 Store(4, Local0) 278 }} 279 }} 280 return (Local0) 281} 282 283/////////////// {if,elseif} {if,elseif,else} 284 285Method(m0d9) 286{ 287 Store(6, Local0) 288 289 Switch (swi0) { 290 Case (0) { 291 Store(12345678, Local0) 292 Switch (swi1) { 293 Case (0) { 294 Store(0, Local0) 295 } 296 Case (1) { 297 Store(1, Local0) 298 } 299 Default { 300 Store(2, Local0) 301 }} 302 } 303 Case (1) { 304 Store(12345678, Local0) 305 Switch (swi1) { 306 Case (0) { 307 Store(3, Local0) 308 } 309 Case (1) { 310 Store(4, Local0) 311 } 312 Default { 313 Store(5, Local0) 314 }} 315 }} 316 return (Local0) 317} 318 319/////////////// {if,elseif,else} {if} (restricted) 320 321Method(m0da) 322{ 323 Store(12345678, Local0) 324 325 Switch (swi0) { 326 Case (0) { 327 Store(1, Local0) 328 Switch (swi1) { 329 Case (0) { 330 Store(0, Local0) 331 }} 332 } 333 Case (1) { 334 Store(3, Local0) 335 Switch (swi1) { 336 Case (0) { 337 Store(2, Local0) 338 }} 339 } 340 Default { 341 Store(5, Local0) 342 Switch (swi1) { 343 Case (0) { 344 Store(4, Local0) 345 }} 346 }} 347 return (Local0) 348} 349 350/////////////// {if,elseif,else} {if,else} (restricted) 351 352Method(m0db) 353{ 354 Store(12345678, Local0) 355 356 Switch (swi0) { 357 Case (0) { 358 Store(12345678, Local0) 359 Switch (swi1) { 360 Case (0) { 361 Store(0, Local0) 362 } 363 Default { 364 Store(1, Local0) 365 }} 366 } 367 Case (1) { 368 Store(12345678, Local0) 369 Switch (swi1) { 370 Case (0) { 371 Store(2, Local0) 372 } 373 Default { 374 Store(3, Local0) 375 }} 376 } 377 Default { 378 Store(12345678, Local0) 379 Switch (swi1) { 380 Case (0) { 381 Store(4, Local0) 382 } 383 Default { 384 Store(5, Local0) 385 }} 386 }} 387 return (Local0) 388} 389 390/////////////// {if,elseif,else} {if,elseif} (restricted) 391 392Method(m0dc) 393{ 394 Store(12345678, Local0) 395 396 Switch (swi0) { 397 Case (0) { 398 Store(2, Local0) 399 Switch (swi1) { 400 Case (0) { 401 Store(0, Local0) 402 } 403 Case (1) { 404 Store(1, Local0) 405 }} 406 } 407 Case (1) { 408 Store(5, Local0) 409 Switch (swi1) { 410 Case (0) { 411 Store(3, Local0) 412 } 413 Case (1) { 414 Store(4, Local0) 415 }} 416 } 417 Default { 418 Store(8, Local0) 419 Switch (swi1) { 420 Case (0) { 421 Store(6, Local0) 422 } 423 Case (1) { 424 Store(7, Local0) 425 }} 426 }} 427 return (Local0) 428} 429 430/////////////// {if,elseif,else} {if,elseif,else} (restricted) 431 432Method(m0dd) 433{ 434 Store(12345678, Local0) 435 436 Switch (swi0) { 437 Case (0) { 438 Store(12345678, Local0) 439 Switch (swi1) { 440 Case (0) { 441 Store(10, Local0) 442 } 443 Case (1) { 444 Store(11, Local0) 445 } 446 Default { 447 Store(12, Local0) 448 }} 449 } 450 Case (1) { 451 Store(12345678, Local0) 452 Switch (swi1) { 453 Case (0) { 454 Store(13, Local0) 455 } 456 Case (1) { 457 Store(14, Local0) 458 } 459 Default { 460 Store(15, Local0) 461 }} 462 } 463 Case (2) { 464 Store(12345678, Local0) 465 Switch (swi1) { 466 Case (0) { 467 Store(16, Local0) 468 } 469 Case (1) { 470 Store(17, Local0) 471 } 472 Default { 473 Store(18, Local0) 474 }} 475 } 476 Default { 477 Store(12345678, Local0) 478 Switch (swi1) { 479 Case (0) { 480 Store(19, Local0) 481 } 482 Case (1) { 483 Store(20, Local0) 484 } 485 Default { 486 Store(21, Local0) 487 }} 488 }} 489 return (Local0) 490} 491 492// Run the particular method 493// (till the time the passing of pointer to method 494// will be implemented) 495Method(m0c6, 1) 496{ 497 Store(0x12345678, Local0) 498 499 switch (arg0) { 500 case (0) { 501 Store(m0d0(), Local0) 502 } 503 case (1) { 504 Store(m0d1(), Local0) 505 } 506 case (2) { 507 Store(m0d2(), Local0) 508 } 509 case (3) { 510 Store(m0d3(), Local0) 511 } 512 case (4) { 513 Store(m0d4(), Local0) 514 } 515 case (5) { 516 Store(m0d5(), Local0) 517 } 518 case (6) { 519 Store(m0d6(), Local0) 520 } 521 case (7) { 522 Store(m0d7(), Local0) 523 } 524 case (8) { 525 Store(m0d8(), Local0) 526 } 527 case (9) { 528 Store(m0d9(), Local0) 529 } 530 case (10) { 531 Store(m0da(), Local0) 532 } 533 case (11) { 534 Store(m0db(), Local0) 535 } 536 case (12) { 537 Store(m0dc(), Local0) 538 } 539 case (13) { 540 Store(m0dd(), Local0) 541 } 542 } 543 544 return (Local0) 545} 546 547// Verivication of ????????????? 548Method(m0c7, 3, Serialized) 549{ 550 Name(bs00, 0) 551 Name(cnt0, 0) 552 Name(cnt1, 0) 553 Name(ind1, 0) 554 Name(ix00, 0) 555 556 Name(lpN0, 0) 557 Name(lpC0, 0) 558 Name(lpN1, 0) 559 Name(lpC1, 0) 560 561 Store(0, swi0) 562 563 Store(DeRefOf(Index(arg2, 0)), ix00) 564 Store(DeRefOf(Index(arg2, 1)), cnt0) 565 566 Store(2, ind1) 567 Store(cnt0, lpN0) 568 Store(0, lpC0) 569 While (lpN0) { 570 Store(0, swi1) 571 Store(DeRefOf(Index(arg2, ind1)), cnt1) 572 Store(cnt1, lpN1) 573 Store(0, lpC1) 574 While (lpN1) { 575 576 Store(m0c6(arg1), Local0) 577 578 if (0) { 579 Store("=============:", Debug) 580 Store(swi0, Debug) 581 Store(swi1, Debug) 582 Store(ix00, Debug) 583 Store(Local0, Debug) 584 Store("=============.", Debug) 585 } 586 587 if (LNotEqual(Local0, ix00)){ 588 err(arg0, z068, __LINE__, 0, 0, Local0, ix00) 589 } 590 Increment(ix00) 591 Increment(swi1) 592 Decrement(lpN1) 593 Increment(lpC1) 594 } 595 Increment(swi0) 596 Increment(ind1) 597 Decrement(lpN0) 598 Increment(lpC0) 599 } 600 601 return (0) 602} 603 604// Run-method 605Method(SW01,, Serialized) 606{ 607 Store("TEST: SW01, Switch, Case, Default operators", Debug) 608 609 Name(ts, "SW01") 610 611 m0c7(ts, 0, Buffer() {0, 2, 2, 1}) 612 m0c7(ts, 1, Buffer() {0, 2, 3, 1}) 613 m0c7(ts, 2, Buffer() {0, 2, 2, 2}) 614 m0c7(ts, 3, Buffer() {0, 2, 2, 2}) 615 m0c7(ts, 4, Buffer() {0, 2, 3, 3}) 616 m0c7(ts, 5, Buffer() {0, 2, 3, 3}) 617 m0c7(ts, 6, Buffer() {0, 3, 2, 2, 1}) 618 m0c7(ts, 7, Buffer() {0, 3, 2, 2, 1}) 619 m0c7(ts, 8, Buffer() {0, 3, 3, 3, 1}) 620 m0c7(ts, 9, Buffer() {0, 3, 3, 3, 1}) 621 m0c7(ts, 10, Buffer() {0, 3, 2, 2, 2}) 622 m0c7(ts, 11, Buffer() {0, 3, 2, 2, 2}) 623 m0c7(ts, 12, Buffer() {0, 3, 3, 3, 3}) 624 m0c7(ts, 13, Buffer() {10, 4, 3, 3, 3, 3}) 625 626 return (0) 627} 628