| 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 242: |
| 30 |
* |
| 31 |
* SUMMARY: Releasing the mutex the first Acquired on the non-zero level makes Releasing the residuary mutexes of that level impossible |
| 32 |
*/ |
| 33 |
Method (M031, 0, Serialized) |
| 34 |
{ |
| 35 |
Mutex (T000, 0x00) |
| 36 |
Mutex (T001, 0x00) |
| 37 |
Mutex (T002, 0x00) |
| 38 |
Mutex (T003, 0x00) |
| 39 |
Mutex (T100, 0x01) |
| 40 |
Mutex (T101, 0x01) |
| 41 |
Mutex (T102, 0x01) |
| 42 |
Mutex (T103, 0x01) |
| 43 |
/* |
| 44 |
* Direct order for mutexes of level 0 |
| 45 |
* |
| 46 |
* STATUS: works correctly - no exceptions |
| 47 |
*/ |
| 48 |
Method (M000, 0, NotSerialized) |
| 49 |
{ |
| 50 |
Debug = "******** Test 0, for mutexes of level 0" |
| 51 |
Debug = "Acquiring mutexes of level 0:" |
| 52 |
Local0 = Acquire (T000, 0xFFFF) |
| 53 |
If (Local0) |
| 54 |
{ |
| 55 |
Debug = "ERROR: Acquire T000 (Level 0, index 0)" |
| 56 |
ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, 0x00, 0x00) |
| 57 |
} |
| 58 |
Else |
| 59 |
{ |
| 60 |
Debug = "Ok: Acquire T000 (Level 0, index 0)" |
| 61 |
} |
| 62 |
|
| 63 |
Local0 = Acquire (T001, 0xFFFF) |
| 64 |
If (Local0) |
| 65 |
{ |
| 66 |
Debug = "ERROR: Acquire T001 (Level 0, index 1)" |
| 67 |
ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, 0x00, 0x00) |
| 68 |
} |
| 69 |
Else |
| 70 |
{ |
| 71 |
Debug = "Ok: Acquire T001 (Level 0, index 1)" |
| 72 |
} |
| 73 |
|
| 74 |
Local0 = Acquire (T002, 0xFFFF) |
| 75 |
If (Local0) |
| 76 |
{ |
| 77 |
Debug = "ERROR: Acquire T002 (Level 0, index 2)" |
| 78 |
ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, 0x00, 0x00) |
| 79 |
} |
| 80 |
Else |
| 81 |
{ |
| 82 |
Debug = "Ok: Acquire T002 (Level 0, index 2)" |
| 83 |
} |
| 84 |
|
| 85 |
Local0 = Acquire (T003, 0xFFFF) |
| 86 |
If (Local0) |
| 87 |
{ |
| 88 |
Debug = "ERROR: Acquire T003 (Level 0, index 3)" |
| 89 |
ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, 0x00, 0x00) |
| 90 |
} |
| 91 |
Else |
| 92 |
{ |
| 93 |
Debug = "Ok: Acquire T003 (Level 0, index 3)" |
| 94 |
} |
| 95 |
|
| 96 |
Debug = "Releasing mutexes of level 0:" |
| 97 |
Debug = "Release T000 (Level 0, index 0)" |
| 98 |
CH03 (__METHOD__, 0x00, __LINE__, 0x00, 0x00) |
| 99 |
Release (T000) |
| 100 |
CH03 (__METHOD__, 0x00, __LINE__, 0x00, 0x00) |
| 101 |
Debug = "Release T001 (Level 0, index 1)" |
| 102 |
CH03 (__METHOD__, 0x00, __LINE__, 0x00, 0x00) |
| 103 |
Release (T001) |
| 104 |
CH03 (__METHOD__, 0x00, __LINE__, 0x00, 0x00) |
| 105 |
Debug = "Release T002 (Level 0, index 2)" |
| 106 |
CH03 (__METHOD__, 0x00, __LINE__, 0x00, 0x00) |
| 107 |
Release (T002) |
| 108 |
CH03 (__METHOD__, 0x00, __LINE__, 0x00, 0x00) |
| 109 |
Debug = "Release T003 (Level 0, index 3)" |
| 110 |
CH03 (__METHOD__, 0x00, __LINE__, 0x00, 0x00) |
| 111 |
Release (T003) |
| 112 |
CH03 (__METHOD__, 0x00, __LINE__, 0x00, 0x00) |
| 113 |
} |
| 114 |
|
| 115 |
/* |
| 116 |
* Direct order for mutexes of level 1 |
| 117 |
* |
| 118 |
* STATUS: works incorrectly - has exceptions |
| 119 |
*/ |
| 120 |
Method (M001, 0, NotSerialized) |
| 121 |
{ |
| 122 |
Debug = "******** Test 1, for mutexes of level 1" |
| 123 |
Debug = "Acquiring mutexes of level 1:" |
| 124 |
Local0 = Acquire (T100, 0xFFFF) |
| 125 |
If (Local0) |
| 126 |
{ |
| 127 |
Debug = "ERROR: Acquire T100 (Level 1, index 0)" |
| 128 |
ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, 0x00, 0x00) |
| 129 |
} |
| 130 |
Else |
| 131 |
{ |
| 132 |
Debug = "Ok: Acquire T100 (Level 1, index 0)" |
| 133 |
} |
| 134 |
|
| 135 |
Local0 = Acquire (T101, 0xFFFF) |
| 136 |
If (Local0) |
| 137 |
{ |
| 138 |
Debug = "ERROR: Acquire T101 (Level 1, index 1)" |
| 139 |
ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, 0x00, 0x00) |
| 140 |
} |
| 141 |
Else |
| 142 |
{ |
| 143 |
Debug = "Ok: Acquire T101 (Level 1, index 1)" |
| 144 |
} |
| 145 |
|
| 146 |
Local0 = Acquire (T102, 0xFFFF) |
| 147 |
If (Local0) |
| 148 |
{ |
| 149 |
Debug = "ERROR: Acquire T102 (Level 1, index 2)" |
| 150 |
ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, 0x00, 0x00) |
| 151 |
} |
| 152 |
Else |
| 153 |
{ |
| 154 |
Debug = "Ok: Acquire T102 (Level 1, index 2)" |
| 155 |
} |
| 156 |
|
| 157 |
Local0 = Acquire (T103, 0xFFFF) |
| 158 |
If (Local0) |
| 159 |
{ |
| 160 |
Debug = "ERROR: Acquire T103 (Level 1, index 3)" |
| 161 |
ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, 0x00, 0x00) |
| 162 |
} |
| 163 |
Else |
| 164 |
{ |
| 165 |
Debug = "Ok: Acquire T103 (Level 1, index 3)" |
| 166 |
} |
| 167 |
|
| 168 |
Debug = "Releasing mutexes of Level 1:" |
| 169 |
Debug = "Release T100 (Level 1, index 0)" |
| 170 |
CH03 (__METHOD__, 0x00, __LINE__, 0x00, 0x00) |
| 171 |
Release (T100) |
| 172 |
CH03 (__METHOD__, 0x00, __LINE__, 0x00, 0x00) |
| 173 |
Debug = "Release T101 (Level 1, index 1)" |
| 174 |
CH03 (__METHOD__, 0x00, __LINE__, 0x00, 0x00) |
| 175 |
Release (T101) |
| 176 |
CH03 (__METHOD__, 0x00, __LINE__, 0x00, 0x00) |
| 177 |
Debug = "Release T102 (Level 1, index 2)" |
| 178 |
CH03 (__METHOD__, 0x00, __LINE__, 0x00, 0x00) |
| 179 |
Release (T102) |
| 180 |
CH03 (__METHOD__, 0x00, __LINE__, 0x00, 0x00) |
| 181 |
Debug = "Release T103 (Level 1, index 3)" |
| 182 |
CH03 (__METHOD__, 0x00, __LINE__, 0x00, 0x00) |
| 183 |
Release (T103) |
| 184 |
CH03 (__METHOD__, 0x00, __LINE__, 0x00, 0x00) |
| 185 |
} |
| 186 |
|
| 187 |
/* |
| 188 |
* The test shows that no exception when the first |
| 189 |
* Acquired mutex is Released in the last turn. |
| 190 |
* |
| 191 |
* STATUS: works correctly - no exception |
| 192 |
*/ |
| 193 |
Method (M002, 0, NotSerialized) |
| 194 |
{ |
| 195 |
Debug = "******** Test 2, for mutexes of level 1" |
| 196 |
Debug = "Acquiring mutexes of level 1:" |
| 197 |
Local0 = Acquire (T100, 0xFFFF) |
| 198 |
If (Local0) |
| 199 |
{ |
| 200 |
Debug = "ERROR: Acquire T100 (Level 1, index 0)" |
| 201 |
ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, 0x00, 0x00) |
| 202 |
} |
| 203 |
Else |
| 204 |
{ |
| 205 |
Debug = "Ok: Acquire T100 (Level 1, index 0)" |
| 206 |
} |
| 207 |
|
| 208 |
Local0 = Acquire (T101, 0xFFFF) |
| 209 |
If (Local0) |
| 210 |
{ |
| 211 |
Debug = "ERROR: Acquire T101 (Level 1, index 1)" |
| 212 |
ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, 0x00, 0x00) |
| 213 |
} |
| 214 |
Else |
| 215 |
{ |
| 216 |
Debug = "Ok: Acquire T101 (Level 1, index 1)" |
| 217 |
} |
| 218 |
|
| 219 |
Local0 = Acquire (T102, 0xFFFF) |
| 220 |
If (Local0) |
| 221 |
{ |
| 222 |
Debug = "ERROR: Acquire T102 (Level 1, index 2)" |
| 223 |
ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, 0x00, 0x00) |
| 224 |
} |
| 225 |
Else |
| 226 |
{ |
| 227 |
Debug = "Ok: Acquire T102 (Level 1, index 2)" |
| 228 |
} |
| 229 |
|
| 230 |
Local0 = Acquire (T103, 0xFFFF) |
| 231 |
If (Local0) |
| 232 |
{ |
| 233 |
Debug = "ERROR: Acquire T103 (Level 1, index 3)" |
| 234 |
ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, 0x00, 0x00) |
| 235 |
} |
| 236 |
Else |
| 237 |
{ |
| 238 |
Debug = "Ok: Acquire T103 (Level 1, index 3)" |
| 239 |
} |
| 240 |
|
| 241 |
Debug = "Releasing mutexes of Level 1:" |
| 242 |
Debug = "Release T101 (Level 1, index 1)" |
| 243 |
CH03 (__METHOD__, 0x00, __LINE__, 0x00, 0x00) |
| 244 |
Release (T101) |
| 245 |
CH03 (__METHOD__, 0x00, __LINE__, 0x00, 0x00) |
| 246 |
Debug = "Release T102 (Level 1, index 2)" |
| 247 |
CH03 (__METHOD__, 0x00, __LINE__, 0x00, 0x00) |
| 248 |
Release (T102) |
| 249 |
CH03 (__METHOD__, 0x00, __LINE__, 0x00, 0x00) |
| 250 |
Debug = "Release T103 (Level 1, index 3)" |
| 251 |
CH03 (__METHOD__, 0x00, __LINE__, 0x00, 0x00) |
| 252 |
Release (T103) |
| 253 |
CH03 (__METHOD__, 0x00, __LINE__, 0x00, 0x00) |
| 254 |
Debug = "Release T100 (Level 1, index 0)" |
| 255 |
CH03 (__METHOD__, 0x00, __LINE__, 0x00, 0x00) |
| 256 |
Release (T100) |
| 257 |
CH03 (__METHOD__, 0x00, __LINE__, 0x00, 0x00) |
| 258 |
} |
| 259 |
|
| 260 |
Method (MM00, 0, NotSerialized) |
| 261 |
{ |
| 262 |
M000 () |
| 263 |
M001 () |
| 264 |
M002 () |
| 265 |
} |
| 266 |
|
| 267 |
CH03 (__METHOD__, 0x00, __LINE__, 0x00, 0x00) |
| 268 |
MM00 () |
| 269 |
CH03 (__METHOD__, 0x00, __LINE__, 0x00, 0x00) |
| 270 |
} |