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     * Bug 177:
30     *
31     * SUMMARY: Exception BUFFER_LIMIT occurs instead of STRING_LIMIT one
32     */
33    Method (MF07, 0, Serialized)
34    {
35        Name (I000, 0x01)
36        OperationRegion (R000, SystemMemory, 0x00, I000)
37        Field (R000, ByteAcc, NoLock, Preserve)
38        {
39            F000,   8
40        }
41
42        Field (R000, ByteAcc, NoLock, Preserve)
43        {
44            F001,   9
45        }
46
47        Name (P000, Package (0x02)
48        {
49            0x00,
50            0x01
51        })
52        Name (B000, Buffer (0x03)
53        {
54             0x02, 0x03, 0x04                                 // ...
55        })
56        Name (S000, "5678")
57        Name (I001, 0x00)
58        OperationRegion (R001, SystemMemory, 0x0100, 0x0100)
59        Field (R001, ByteAcc, NoLock, Preserve)
60        {
61            BNK0,   2
62        }
63
64        BankField (R001, BNK0, 0x04, ByteAcc, NoLock, Preserve)
65        {
66            BKF0,   9
67        }
68
69        /* Named */
70
71        CH03 (__METHOD__, 0x00, __LINE__, 0x00, 0x00)
72        Store (P000 [0x02], Local1)
73        CH04 (__METHOD__, 0x01, 0x37, 0x00, __LINE__, 0x00, 0x00) /* AE_AML_PACKAGE_LIMIT */
74        CH03 (__METHOD__, 0x00, __LINE__, 0x00, 0x00)
75        Store (B000 [0x03], Local1)
76        CH04 (__METHOD__, 0x01, 0x36, 0x00, __LINE__, 0x00, 0x00) /* AE_AML_BUFFER_LIMIT */
77        CH03 (__METHOD__, 0x00, __LINE__, 0x00, 0x00)
78        Store (S000 [0x04], Local1)
79        CH04 (__METHOD__, 0x01, 0x3D, 0x00, __LINE__, 0x00, 0x00) /* AE_AML_STRING_LIMIT */
80        /* Immediate */
81
82        CH03 (__METHOD__, 0x00, __LINE__, 0x00, 0x00)
83        Store (Index (Package (0x02)
84                {
85                    0x00,
86                    0x01
87                }, 0x02), Local1)
88        If (Y900)
89        {
90            CH04 (__METHOD__, 0x01, 0x37, 0x00, __LINE__, 0x00, 0x00) /* AE_AML_PACKAGE_LIMIT */
91        }
92        Else
93        {
94            CH04 (__METHOD__, 0x00, 0x55, 0x00, __LINE__, 0x00, 0x00) /* AE_INDEX_TO_NOT_ATTACHED */
95        }
96
97        CH03 (__METHOD__, 0x00, __LINE__, 0x00, 0x00)
98        Store (Index (Buffer (0x03)
99                {
100                     0x02, 0x03, 0x04                                 // ...
101                }, 0x03), Local1)
102        If (Y900)
103        {
104            CH04 (__METHOD__, 0x01, 0x36, 0x00, __LINE__, 0x00, 0x00) /* AE_AML_BUFFER_LIMIT */
105        }
106        Else
107        {
108            CH04 (__METHOD__, 0x00, 0x55, 0x00, __LINE__, 0x00, 0x00) /* AE_INDEX_TO_NOT_ATTACHED */
109        }
110
111        CH03 (__METHOD__, 0x00, __LINE__, 0x00, 0x00)
112        Store (Index ("5678", 0x04), Local1)
113        If (Y900)
114        {
115            CH04 (__METHOD__, 0x01, 0x3D, 0x00, __LINE__, 0x00, 0x00) /* AE_AML_STRING_LIMIT */
116        }
117        Else
118        {
119            CH04 (__METHOD__, 0x00, 0x55, 0x00, __LINE__, 0x00, 0x00) /* AE_INDEX_TO_NOT_ATTACHED */
120        }
121
122        /* Fields */
123
124        CH03 (__METHOD__, 0x00, __LINE__, 0x00, 0x00)
125        Local0 = F000 /* \MF07.F000 */
126        CH03 (__METHOD__, 0x00, __LINE__, 0x00, 0x00)
127        CH03 (__METHOD__, 0x00, __LINE__, 0x00, 0x00)
128        Local0 = F001 /* \MF07.F001 */
129        If (Y263)
130        {
131            /*
132             * After the bug 263 fixed we started actually
133             * have there several exceptions:
134             * - on evaluation of f001 stage
135             * - and on Store-to-debug stage
136             * Check opcode of the last exception.
137             */
138            CH04 (__METHOD__, 0x02, 0x35, 0x00, __LINE__, 0x00, 0x00) /* AE_AML_REGION_LIMIT */
139        }
140        Else
141        {
142            CH04 (__METHOD__, 0x00, 0x35, 0x00, __LINE__, 0x00, 0x00) /* AE_AML_REGION_LIMIT */
143        }
144
145        CH03 (__METHOD__, 0x00, __LINE__, 0x00, 0x00)
146        Local0 = BKF0 /* \MF07.BKF0 */
147        If (Y263)
148        {
149            /* See comment to sub-test above */
150
151            CH04 (__METHOD__, 0x02, 0x44, 0x00, __LINE__, 0x00, 0x00) /* AE_AML_REGISTER_LIMIT */
152        }
153        Else
154        {
155            CH04 (__METHOD__, 0x00, 0x44, 0x00, __LINE__, 0x00, 0x00) /* AE_AML_REGISTER_LIMIT */
156        }
157    }
158