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/*
31 * Store Integer/String/Buffer/Package to Package
32 */
33
34// Integer
35
36Method(md2d,, Serialized)
37{
38	Name(i000, 0xe0385bcd)
39	Name(OOO2, Package(1){"Package"})
40
41	Store(i000, OOO2)
42	Store (0x61, OOO2)
43
44	Store(DeRefof(Refof(OOO2)), Local1)
45
46	if (LNotEqual(Local1, 0x61)) {
47		err("", zFFF, __LINE__, 0, 0, Local1, 0x61)
48	}
49	if (LNotEqual(i000, 0xe0385bcd)) {
50		err("", zFFF, __LINE__, 0, 0, i000, 0xe0385bcd)
51	}
52}
53
54// String
55
56Method(md2e,, Serialized)
57{
58	Name(s000, "String")
59	Name(OOO2, Package(1){"Package"})
60
61	Store(s000, OOO2)
62	Store (0x61, Index(OOO2, 3))
63
64	Store(Refof(OOO2), Local0)
65	Store(DeRefof(Local0), Local1)
66
67	if (LNotEqual(Local1, "Strang")) {
68		err("", zFFF, __LINE__, 0, 0, Local1, "Strang")
69	}
70	if (LNotEqual(s000, "String")) {
71		err("", zFFF, __LINE__, 0, 0, s000, "String")
72	}
73}
74
75// Buffer
76
77Method(md2f,, Serialized)
78{
79	Name(b000, Buffer() {1,2,3,4})
80	Name(OOO2, Package(1){Buffer() {5,6,7,8}})
81
82	Store(b000, OOO2)
83	Store (0x61, Index(OOO2, 3))
84
85	Store(Refof(OOO2), Local0)
86	Store(DeRefof(Local0), Local1)
87
88	if (LNotEqual(Local1, Buffer() {1,2,3,0x61})) {
89		err("", zFFF, __LINE__, 0, 0, Local1, Buffer() {1,2,3,0x61})
90	}
91	if (LNotEqual(b000, Buffer() {1,2,3,4})) {
92		err("", zFFF, __LINE__, 0, 0, b000, Buffer() {1,2,3,4})
93	}
94}
95
96// Package
97
98Method(md30,, Serialized)
99{
100	Name(pppp, Package(1){Buffer() {1,2,3,4}})
101	Name(OOO2, Package(1){Buffer() {5,6,7,8}})
102
103	Store(pppp, OOO2)
104	Store (0x61, Index(DerefOf(Index(OOO2, 0)), 3))
105
106	// OOO2
107
108	Store(DeRefof(Index(DerefOf(Index(OOO2, 0)), 0)), Local0)
109	if (LNotEqual(Local0, 1)) {
110		err("", zFFF, __LINE__, 0, 0, Local0, 1)
111	}
112	Store(DeRefof(Index(DerefOf(Index(OOO2, 0)), 1)), Local0)
113	if (LNotEqual(Local0, 2)) {
114		err("", zFFF, __LINE__, 0, 0, Local0, 2)
115	}
116	Store(DeRefof(Index(DerefOf(Index(OOO2, 0)), 2)), Local0)
117	if (LNotEqual(Local0, 3)) {
118		err("", zFFF, __LINE__, 0, 0, Local0, 3)
119	}
120	Store(DeRefof(Index(DerefOf(Index(OOO2, 0)), 3)), Local0)
121	if (LNotEqual(Local0, 0x61)) {
122		err("", zFFF, __LINE__, 0, 0, Local0, 0x61)
123	}
124
125	// pppp
126
127	Store(DeRefof(Index(DerefOf(Index(pppp, 0)), 0)), Local0)
128	if (LNotEqual(Local0, 1)) {
129		err("", zFFF, __LINE__, 0, 0, Local0, 1)
130	}
131	Store(DeRefof(Index(DerefOf(Index(pppp, 0)), 1)), Local0)
132	if (LNotEqual(Local0, 2)) {
133		err("", zFFF, __LINE__, 0, 0, Local0, 2)
134	}
135	Store(DeRefof(Index(DerefOf(Index(pppp, 0)), 2)), Local0)
136	if (LNotEqual(Local0, 3)) {
137		err("", zFFF, __LINE__, 0, 0, Local0, 3)
138	}
139	Store(DeRefof(Index(DerefOf(Index(pppp, 0)), 3)), Local0)
140	if (LNotEqual(Local0, 4)) {
141		err("", zFFF, __LINE__, 0, 0, Local0, 4)
142	}
143}
144
145Method(md31)
146{
147	CH03("", 0, 0xf10, __LINE__, 0)
148	md2d()
149	md2e()
150	md2f()
151	md30()
152	CH03("", 0, 0xf11, __LINE__, 0)
153}
154