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 150: 30 * 31 * SUMMARY: No exception when Serialized Method is run after the higher level mutex acquiring 32 * 33 * EXAMPLES 34 * 35 * ROOT CAUSE 36 * 37 * SEE ALSO: 38 */ 39 /* 40 1. Acquire of the same mux several times without Releases 41 2. Acquire+Releases sequence of the same mux several times 42 3. Acquire mux level 7 then Release it and try Acquire mux level 6 43 4. Acquire mux level 7 then try Acquire mux level 6 44 5. Check all the specified features 45 */ 46 /* 47 * The proper sequence of several enclosed Acquire operations. 48 * 49 * Acquire N level mutex then acquire (N+k) level mutex. 50 */ 51 Method (MD8A, 0, Serialized) 52 { 53 Mutex (MX00, 0x00) 54 Mutex (MX01, 0x01) 55 Local0 = 0x00 56 Local1 = 0x00 57 If (Acquire (MX00, 0x0001)) 58 { 59 ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, 0x00, 0x00) 60 } 61 Else 62 { 63 Local0 = 0x01 64 If (Acquire (MX01, 0x0001)) 65 { 66 ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, 0x00, 0x00) 67 } 68 Else 69 { 70 Local1 = 0x01 71 } 72 } 73 74 If (Local1) 75 { 76 Release (MX01) 77 } 78 79 If (Local0) 80 { 81 Release (MX00) 82 } 83 } 84 85 /* 86 * Improper sequence of several enclosed Acquire operations. 87 * 88 * Acquire N level mutex then acquire (N-k) level mutex. 89 * Exception AE_AML_MUTEX_ORDER is expected in this case. 90 */ 91 Method (MD8B, 0, Serialized) 92 { 93 Mutex (MX00, 0x01) 94 Mutex (MX01, 0x00) 95 Local0 = 0x00 96 Local1 = 0x00 97 If (Acquire (MX00, 0x0001)) 98 { 99 ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, 0x00, 0x00) 100 } 101 Else 102 { 103 Local0 = 0x01 104 CH03 (__METHOD__, 0x00, __LINE__, 0x00, 0x00) 105 Acquire (MX01, 0x0001) 106 CH04 (__METHOD__, 0x00, 0x40, 0x00, __LINE__, 0x00, 0x00) /* AE_AML_MUTEX_ORDER */ 107 } 108 109 If (Local0) 110 { 111 Release (MX00) 112 } 113 } 114 115 /* 116 * The proper sequence of several enclosed operations. 117 * 118 * Acquire N level mutex then call to Serialized Method 119 * declared with (N+k) SyncLevel. 120 */ 121 Method (MD8C, 0, Serialized) 122 { 123 Mutex (MX00, 0x00) 124 Method (MX01, 0, Serialized, 1) 125 { 126 Debug = "Run Method mx01" 127 } 128 129 Local0 = 0x00 130 Local1 = 0x00 131 If (Acquire (MX00, 0x0001)) 132 { 133 ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, 0x00, 0x00) 134 } 135 Else 136 { 137 Local0 = 0x01 138 CH03 (__METHOD__, 0x00, __LINE__, 0x00, 0x00) 139 MX01 () 140 CH03 (__METHOD__, 0x00, __LINE__, 0x00, 0x00) 141 } 142 143 If (Local0) 144 { 145 Release (MX00) 146 } 147 } 148 149 /* 150 * Improper sequence of several enclosed operations. 151 * 152 * Acquire N level mutex then call to Serialized Method declared with (N-k) SyncLevel. 153 * Exception AE_AML_MUTEX_ORDER is expected in this case. 154 */ 155 Method (MD8D, 0, Serialized) 156 { 157 Mutex (MX00, 0x01) 158 Method (MX01, 0, Serialized) 159 { 160 Debug = "Run Method mx01" 161 } 162 163 Local0 = 0x00 164 Local1 = 0x00 165 If (Acquire (MX00, 0x0001)) 166 { 167 ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, 0x00, 0x00) 168 } 169 Else 170 { 171 Local0 = 0x01 172 CH03 (__METHOD__, 0x00, __LINE__, 0x00, 0x00) 173 MX01 () 174 CH04 (__METHOD__, 0x00, 0x40, 0x00, __LINE__, 0x00, 0x00) /* AE_AML_MUTEX_ORDER */ 175 } 176 177 If (Local0) 178 { 179 Release (MX00) 180 } 181 } 182 183 Method (MD8E, 0, NotSerialized) 184 { 185 MD8A () 186 MD8B () 187 MD8C () 188 MD8D () 189 } 190