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 * Checkings for simple one-level hierarchy of Packages.
31 *
32 * 0x5C Outstanding allocations because of
33 * AcpiExec doesn't run the unload of the table have been processed.
34 *
35 * Outstanding: 0x5C allocations after execution.
36 */
37
38Method(mfc5,, Serialized)
39{
40	Name(num0, 12)	// different types of packages Pkg0 and Pkg1
41	Name(num1, 19)	// opcodes of additional assignments of packages Pkg0 and Pkg1
42	Name(num2, 13)	// max opcode of additional assignments of References (0-12)
43	Name(cur0, 0)	// cur opcode of additional assignments of References (0-12)
44	Name(i000, 0)
45
46	Name(AR20, 0)
47
48	Name(lpN0, 0)
49	Name(lpC0, 0)
50
51	Name(lpN1, 0)
52	Name(lpC1, 0)
53
54	Name(loc0, Package(Multiply(id26, 2)) {})
55	Name(loc1, Package(Multiply(id26, 2)) {})
56
57
58	Store(num1, lpN1)
59	Store(0, lpC1)
60
61	SRMT("Simple-Pkg")
62
63	While (lpN1) {
64
65		Store(num0, lpN0)
66		Store(0, lpC0)
67
68		While (lpN0) {
69
70			Divide(i000, num2, cur0)
71			Increment(i000)
72
73			Store(mfc9(lpC1, lpC0, 0, 0, cur0), Local0)
74			mfc6(loc0, loc1, Local0,   0, 0,   0, 0)
75
76			Divide(i000, num2, cur0)
77			Increment(i000)
78
79			Store(mfc9(lpC1, lpC0, 0, 1, cur0), Local0)
80			mfc6(loc0, loc1, Local0,   0, 0,   0, 0)
81
82			Divide(i000, num2, cur0)
83			Increment(i000)
84
85			Store(mfc9(lpC1, lpC0, 1, 0, cur0), Local0)
86			mfc6(loc0, loc1, Local0,   0, 0,   0, 0)
87
88			Divide(i000, num2, cur0)
89			Increment(i000)
90
91			Store(mfc9(lpC1, lpC0, 1, 1, cur0), Local0)
92			mfc6(loc0, loc1, Local0,   0, 0,   0, 0)
93
94
95			Decrement(lpN0)
96			Increment(lpC0)
97		}
98
99		Decrement(lpN1)
100		Increment(lpC1)
101	}
102
103	/*
104	 * To eliminate the known outstanding allocations -
105	 * releasing of global data are not forces by AcpiExec -
106	 * no unload of the processed ACPI table is automatically
107	 * initiated by AcpiExec after completion the ex command.
108	 */
109	if (0) {
110		mfe8()
111	}
112}
113