]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Library/S3IoLib.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdePkg / Include / Library / S3IoLib.h
CommitLineData
fe69ac84 1/** @file\r
2 I/O and MMIO Library Services that do I/O and also enable the I/O operation\r
3 to be replayed during an S3 resume. This library class maps directly on top\r
9095d37b 4 of the IoLib class.\r
fe69ac84 5\r
9095d37b 6 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
fe69ac84 7\r
9344f092 8 SPDX-License-Identifier: BSD-2-Clause-Patent\r
fe69ac84 9\r
10**/\r
11\r
12#ifndef __S3_IO_LIB_H__\r
13#define __S3_IO_LIB_H__\r
14\r
15/**\r
16 Reads an 8-bit I/O port and saves the value in the S3 script to be replayed\r
17 on S3 resume.\r
18\r
19 Reads the 8-bit I/O port specified by Port. The 8-bit read value is returned.\r
20 This function must guarantee that all I/O read and write operations are\r
21 serialized.\r
22\r
23 If 8-bit I/O port operations are not supported, then ASSERT().\r
24\r
25 @param[in] Port The I/O port to read.\r
26\r
27 @return The value read.\r
28\r
29**/\r
30UINT8\r
31EFIAPI\r
32S3IoRead8 (\r
33 IN UINTN Port\r
34 );\r
35\r
36/**\r
37 Writes an 8-bit I/O port, and saves the value in the S3 script to be replayed\r
38 on S3 resume.\r
39\r
40 Writes the 8-bit I/O port specified by Port with the value specified by Value\r
41 and returns Value. This function must guarantee that all I/O read and write\r
42 operations are serialized.\r
43\r
44 If 8-bit I/O port operations are not supported, then ASSERT().\r
45\r
46 @param[in] Port The I/O port to write.\r
47 @param[in] Value The value to write to the I/O port.\r
48\r
49 @return The value written the I/O port.\r
50\r
51**/\r
52UINT8\r
53EFIAPI\r
54S3IoWrite8 (\r
55 IN UINTN Port,\r
56 IN UINT8 Value\r
57 );\r
58\r
59/**\r
60 Reads an 8-bit I/O port, performs a bitwise OR, writes the\r
61 result back to the 8-bit I/O port, and saves the value in the S3 script to be\r
62 replayed on S3 resume.\r
63\r
64 Reads the 8-bit I/O port specified by Port, performs a bitwise OR\r
65 between the read result and the value specified by OrData, and writes the\r
66 result to the 8-bit I/O port specified by Port. The value written to the I/O\r
67 port is returned. This function must guarantee that all I/O read and write\r
68 operations are serialized.\r
69\r
70 If 8-bit I/O port operations are not supported, then ASSERT().\r
71\r
72 @param[in] Port The I/O port to write.\r
73 @param[in] OrData The value to OR with the read value from the I/O port.\r
74\r
75 @return The value written back to the I/O port.\r
76\r
77**/\r
78UINT8\r
79EFIAPI\r
80S3IoOr8 (\r
81 IN UINTN Port,\r
82 IN UINT8 OrData\r
83 );\r
84\r
85/**\r
86 Reads an 8-bit I/O port, performs a bitwise AND, writes the result back\r
87 to the 8-bit I/O port, and saves the value in the S3 script to be replayed\r
88 on S3 resume.\r
89\r
90 Reads the 8-bit I/O port specified by Port, performs a bitwise AND between\r
91 the read result and the value specified by AndData, and writes the result to\r
92 the 8-bit I/O port specified by Port. The value written to the I/O port is\r
93 returned. This function must guarantee that all I/O read and write operations\r
94 are serialized.\r
95\r
96 If 8-bit I/O port operations are not supported, then ASSERT().\r
97\r
98 @param[in] Port The I/O port to write.\r
99 @param[in] AndData The value to AND with the read value from the I/O port.\r
100\r
101 @return The value written back to the I/O port.\r
102\r
103**/\r
104UINT8\r
105EFIAPI\r
106S3IoAnd8 (\r
107 IN UINTN Port,\r
108 IN UINT8 AndData\r
109 );\r
110\r
111/**\r
112 Reads an 8-bit I/O port, performs a bitwise AND followed by a bitwise\r
9095d37b 113 inclusive OR, writes the result back to the 8-bit I/O port, and saves\r
fe69ac84 114 the value in the S3 script to be replayed on S3 resume.\r
115\r
116 Reads the 8-bit I/O port specified by Port, performs a bitwise AND between\r
117 the read result and the value specified by AndData, performs a bitwise OR\r
118 between the result of the AND operation and the value specified by OrData,\r
119 and writes the result to the 8-bit I/O port specified by Port. The value\r
120 written to the I/O port is returned. This function must guarantee that all\r
121 I/O read and write operations are serialized.\r
122\r
123 If 8-bit I/O port operations are not supported, then ASSERT().\r
124\r
125 @param[in] Port The I/O port to write.\r
126 @param[in] AndData The value to AND with the read value from the I/O port.\r
127 @param[in] OrData The value to OR with the result of the AND operation.\r
128\r
129 @return The value written back to the I/O port.\r
130\r
131**/\r
132UINT8\r
133EFIAPI\r
134S3IoAndThenOr8 (\r
135 IN UINTN Port,\r
136 IN UINT8 AndData,\r
137 IN UINT8 OrData\r
138 );\r
139\r
140/**\r
141 Reads a bit field of an I/O register, and saves the value in the S3 script to\r
142 be replayed on S3 resume.\r
143\r
144 Reads the bit field in an 8-bit I/O register. The bit field is specified by\r
145 the StartBit and the EndBit. The value of the bit field is returned.\r
146\r
147 If 8-bit I/O port operations are not supported, then ASSERT().\r
148 If StartBit is greater than 7, then ASSERT().\r
149 If EndBit is greater than 7, then ASSERT().\r
150 If EndBit is less than StartBit, then ASSERT().\r
151\r
152 @param[in] Port The I/O port to read.\r
153 @param[in] StartBit The ordinal of the least significant bit in the bit field.\r
154 Range 0..7.\r
155 @param[in] EndBit The ordinal of the most significant bit in the bit field.\r
156 Range 0..7.\r
157\r
158 @return The value read.\r
159\r
160**/\r
161UINT8\r
162EFIAPI\r
163S3IoBitFieldRead8 (\r
164 IN UINTN Port,\r
165 IN UINTN StartBit,\r
166 IN UINTN EndBit\r
167 );\r
168\r
169/**\r
170 Writes a bit field to an I/O register and saves the value in the S3 script to\r
171 be replayed on S3 resume.\r
172\r
173 Writes Value to the bit field of the I/O register. The bit field is specified\r
174 by the StartBit and the EndBit. All other bits in the destination I/O\r
9095d37b 175 register are preserved. The value written to the I/O port is returned.\r
fe69ac84 176 Remaining bits in Value are stripped.\r
177\r
178 If 8-bit I/O port operations are not supported, then ASSERT().\r
179 If StartBit is greater than 7, then ASSERT().\r
180 If EndBit is greater than 7, then ASSERT().\r
181 If EndBit is less than StartBit, then ASSERT().\r
94952554 182 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
fe69ac84 183\r
184 @param[in] Port The I/O port to write.\r
185 @param[in] StartBit The ordinal of the least significant bit in the bit field.\r
186 Range 0..7.\r
187 @param[in] EndBit The ordinal of the most significant bit in the bit field.\r
188 Range 0..7.\r
189 @param[in] Value New value of the bit field.\r
190\r
191 @return The value written back to the I/O port.\r
192\r
193**/\r
194UINT8\r
195EFIAPI\r
196S3IoBitFieldWrite8 (\r
197 IN UINTN Port,\r
198 IN UINTN StartBit,\r
199 IN UINTN EndBit,\r
200 IN UINT8 Value\r
201 );\r
202\r
203/**\r
204 Reads a bit field in an 8-bit port, performs a bitwise OR, writes the\r
9095d37b 205 result back to the bit field in the 8-bit port, and saves the value in the\r
fe69ac84 206 S3 script to be replayed on S3 resume.\r
207\r
208 Reads the 8-bit I/O port specified by Port, performs a bitwise OR\r
209 between the read result and the value specified by OrData, and writes the\r
210 result to the 8-bit I/O port specified by Port. The value written to the I/O\r
211 port is returned. This function must guarantee that all I/O read and write\r
212 operations are serialized. Extra left bits in OrData are stripped.\r
213\r
214 If 8-bit I/O port operations are not supported, then ASSERT().\r
215 If StartBit is greater than 7, then ASSERT().\r
216 If EndBit is greater than 7, then ASSERT().\r
217 If EndBit is less than StartBit, then ASSERT().\r
94952554 218 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
fe69ac84 219\r
220 @param[in] Port The I/O port to write.\r
221 @param[in] StartBit The ordinal of the least significant bit in the bit field.\r
222 Range 0..7.\r
223 @param[in] EndBit The ordinal of the most significant bit in the bit field.\r
224 Range 0..7.\r
225 @param[in] OrData The value to OR with the read value from the I/O port.\r
226\r
227 @return The value written back to the I/O port.\r
228\r
229**/\r
230UINT8\r
231EFIAPI\r
232S3IoBitFieldOr8 (\r
233 IN UINTN Port,\r
234 IN UINTN StartBit,\r
235 IN UINTN EndBit,\r
236 IN UINT8 OrData\r
237 );\r
238\r
239/**\r
240 Reads a bit field in an 8-bit port, performs a bitwise AND, writes the\r
9095d37b 241 result back to the bit field in the 8-bit port, and saves the value in the\r
fe69ac84 242 S3 script to be replayed on S3 resume.\r
243\r
244 Reads the 8-bit I/O port specified by Port, performs a bitwise AND between\r
245 the read result and the value specified by AndData, and writes the result to\r
246 the 8-bit I/O port specified by Port. The value written to the I/O port is\r
247 returned. This function must guarantee that all I/O read and write operations\r
248 are serialized. Extra left bits in AndData are stripped.\r
249\r
250 If 8-bit I/O port operations are not supported, then ASSERT().\r
251 If StartBit is greater than 7, then ASSERT().\r
252 If EndBit is greater than 7, then ASSERT().\r
253 If EndBit is less than StartBit, then ASSERT().\r
94952554 254 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
fe69ac84 255\r
256 @param[in] Port The I/O port to write.\r
257 @param[in] StartBit The ordinal of the least significant bit in the bit field.\r
258 Range 0..7.\r
259 @param[in] EndBit The ordinal of the most significant bit in the bit field.\r
260 Range 0..7.\r
261 @param[in] AndData The value to AND with the read value from the I/O port.\r
262\r
263 @return The value written back to the I/O port.\r
264\r
265**/\r
266UINT8\r
267EFIAPI\r
268S3IoBitFieldAnd8 (\r
269 IN UINTN Port,\r
270 IN UINTN StartBit,\r
271 IN UINTN EndBit,\r
272 IN UINT8 AndData\r
273 );\r
274\r
275/**\r
276 Reads a bit field in an 8-bit port, performs a bitwise AND followed by a\r
277 bitwise OR, writes the result back to the bit field in the\r
278 8-bit port, and saves the value in the S3 script to be replayed on S3 resume.\r
279\r
280 Reads the 8-bit I/O port specified by Port, performs a bitwise AND followed\r
281 by a bitwise OR between the read result and the value specified by\r
282 AndData, and writes the result to the 8-bit I/O port specified by Port. The\r
283 value written to the I/O port is returned. This function must guarantee that\r
284 all I/O read and write operations are serialized. Extra left bits in both\r
285 AndData and OrData are stripped.\r
286\r
287 If 8-bit I/O port operations are not supported, then ASSERT().\r
288 If StartBit is greater than 7, then ASSERT().\r
289 If EndBit is greater than 7, then ASSERT().\r
290 If EndBit is less than StartBit, then ASSERT().\r
94952554
LG
291 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
292 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
fe69ac84 293\r
294 @param[in] Port The I/O port to write.\r
295 @param[in] StartBit The ordinal of the least significant bit in the bit field.\r
296 Range 0..7.\r
297 @param[in] EndBit The ordinal of the most significant bit in the bit field.\r
298 Range 0..7.\r
299 @param[in] AndData The value to AND with the read value from the I/O port.\r
300 @param[in] OrData The value to OR with the result of the AND operation.\r
301\r
302 @return The value written back to the I/O port.\r
303\r
304**/\r
305UINT8\r
306EFIAPI\r
307S3IoBitFieldAndThenOr8 (\r
308 IN UINTN Port,\r
309 IN UINTN StartBit,\r
310 IN UINTN EndBit,\r
311 IN UINT8 AndData,\r
312 IN UINT8 OrData\r
313 );\r
314\r
315/**\r
316 Reads a 16-bit I/O port, and saves the value in the S3 script to be replayed\r
317 on S3 resume.\r
318\r
319 Reads the 16-bit I/O port specified by Port. The 16-bit read value is returned.\r
320 This function must guarantee that all I/O read and write operations are\r
321 serialized.\r
322\r
323 If 16-bit I/O port operations are not supported, then ASSERT().\r
324\r
325 @param[in] Port The I/O port to read.\r
326\r
327 @return The value read.\r
328\r
329**/\r
330UINT16\r
331EFIAPI\r
332S3IoRead16 (\r
333 IN UINTN Port\r
334 );\r
335\r
336/**\r
337 Writes a 16-bit I/O port, and saves the value in the S3 script to be replayed\r
338 on S3 resume.\r
339\r
340 Writes the 16-bit I/O port specified by Port with the value specified by Value\r
341 and returns Value. This function must guarantee that all I/O read and write\r
342 operations are serialized.\r
343\r
344 If 16-bit I/O port operations are not supported, then ASSERT().\r
345\r
346 @param[in] Port The I/O port to write.\r
347 @param[in] Value The value to write to the I/O port.\r
348\r
349 @return The value written the I/O port.\r
350\r
351**/\r
352UINT16\r
353EFIAPI\r
354S3IoWrite16 (\r
355 IN UINTN Port,\r
356 IN UINT16 Value\r
357 );\r
358\r
359/**\r
360 Reads a 16-bit I/O port, performs a bitwise OR, writes the\r
9095d37b 361 result back to the 16-bit I/O port, and saves the value in the S3 script to\r
fe69ac84 362 be replayed on S3 resume.\r
363\r
364 Reads the 16-bit I/O port specified by Port, performs a bitwise OR\r
365 between the read result and the value specified by OrData, and writes the\r
366 result to the 16-bit I/O port specified by Port. The value written to the I/O\r
367 port is returned. This function must guarantee that all I/O read and write\r
368 operations are serialized.\r
369\r
370 If 16-bit I/O port operations are not supported, then ASSERT().\r
371\r
372 @param[in] Port The I/O port to write.\r
373 @param[in] OrData The value to OR with the read value from the I/O port.\r
374\r
375 @return The value written back to the I/O port.\r
376\r
377**/\r
378UINT16\r
379EFIAPI\r
380S3IoOr16 (\r
381 IN UINTN Port,\r
382 IN UINT16 OrData\r
383 );\r
384\r
385/**\r
386 Reads a 16-bit I/O port, performs a bitwise AND, writes the result back\r
387 to the 16-bit I/O port , and saves the value in the S3 script to be replayed\r
388 on S3 resume.\r
389\r
390 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between\r
391 the read result and the value specified by AndData, and writes the result to\r
392 the 16-bit I/O port specified by Port. The value written to the I/O port is\r
393 returned. This function must guarantee that all I/O read and write operations\r
394 are serialized.\r
395\r
396 If 16-bit I/O port operations are not supported, then ASSERT().\r
397\r
398 @param[in] Port The I/O port to write.\r
399 @param[in] AndData The value to AND with the read value from the I/O port.\r
400\r
401 @return The value written back to the I/O port.\r
402\r
403**/\r
404UINT16\r
405EFIAPI\r
406S3IoAnd16 (\r
407 IN UINTN Port,\r
408 IN UINT16 AndData\r
409 );\r
410\r
411/**\r
412 Reads a 16-bit I/O port, performs a bitwise AND followed by a bitwise\r
413 inclusive OR, writes the result back to the 16-bit I/O port, and saves\r
414 the value in the S3 script to be replayed on S3 resume.\r
415\r
416 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between\r
417 the read result and the value specified by AndData, performs a bitwise OR\r
418 between the result of the AND operation and the value specified by OrData,\r
419 and writes the result to the 16-bit I/O port specified by Port. The value\r
420 written to the I/O port is returned. This function must guarantee that all\r
421 I/O read and write operations are serialized.\r
422\r
423 If 16-bit I/O port operations are not supported, then ASSERT().\r
424\r
425 @param[in] Port The I/O port to write.\r
426 @param[in] AndData The value to AND with the read value from the I/O port.\r
427 @param[in] OrData The value to OR with the result of the AND operation.\r
428\r
429 @return The value written back to the I/O port.\r
430\r
431**/\r
432UINT16\r
433EFIAPI\r
434S3IoAndThenOr16 (\r
435 IN UINTN Port,\r
436 IN UINT16 AndData,\r
437 IN UINT16 OrData\r
438 );\r
439\r
440/**\r
441 Reads a bit field of an I/O register saves the value in the S3 script to be\r
442 replayed on S3 resume.\r
443\r
444 Reads the bit field in a 16-bit I/O register. The bit field is specified by\r
445 the StartBit and the EndBit. The value of the bit field is returned.\r
446\r
447 If 16-bit I/O port operations are not supported, then ASSERT().\r
448 If StartBit is greater than 15, then ASSERT().\r
449 If EndBit is greater than 15, then ASSERT().\r
450 If EndBit is less than StartBit, then ASSERT().\r
451\r
452 @param[in] Port The I/O port to read.\r
453 @param[in] StartBit The ordinal of the least significant bit in the bit field.\r
454 Range 0..15.\r
455 @param[in] EndBit The ordinal of the most significant bit in the bit field.\r
456 Range 0..15.\r
457\r
458 @return The value read.\r
459\r
460**/\r
461UINT16\r
462EFIAPI\r
463S3IoBitFieldRead16 (\r
464 IN UINTN Port,\r
465 IN UINTN StartBit,\r
466 IN UINTN EndBit\r
467 );\r
468\r
469/**\r
9095d37b 470 Writes a bit field to an I/O register, and saves the value in the S3 script\r
fe69ac84 471 to be replayed on S3 resume.\r
472\r
473 Writes Value to the bit field of the I/O register. The bit field is specified\r
474 by the StartBit and the EndBit. All other bits in the destination I/O\r
475 register are preserved. The value written to the I/O port is returned. Extra\r
476 left bits in Value are stripped.\r
477\r
478 If 16-bit I/O port operations are not supported, then ASSERT().\r
479 If StartBit is greater than 15, then ASSERT().\r
480 If EndBit is greater than 15, then ASSERT().\r
481 If EndBit is less than StartBit, then ASSERT().\r
94952554 482 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
fe69ac84 483\r
484 @param[in] Port The I/O port to write.\r
485 @param[in] StartBit The ordinal of the least significant bit in the bit field.\r
486 Range 0..15.\r
487 @param[in] EndBit The ordinal of the most significant bit in the bit field.\r
488 Range 0..15.\r
489 @param[in] Value New value of the bit field.\r
490\r
491 @return The value written back to the I/O port.\r
492\r
493**/\r
494UINT16\r
495EFIAPI\r
496S3IoBitFieldWrite16 (\r
497 IN UINTN Port,\r
498 IN UINTN StartBit,\r
499 IN UINTN EndBit,\r
500 IN UINT16 Value\r
501 );\r
502\r
503/**\r
504 Reads a bit field in a 16-bit port, performs a bitwise OR, writes the\r
9095d37b 505 result back to the bit field in the 16-bit port, and saves the value in the\r
fe69ac84 506 S3 script to be replayed on S3 resume.\r
507\r
508 Reads the 16-bit I/O port specified by Port, performs a bitwise OR\r
509 between the read result and the value specified by OrData, and writes the\r
510 result to the 16-bit I/O port specified by Port. The value written to the I/O\r
511 port is returned. This function must guarantee that all I/O read and write\r
512 operations are serialized. Extra left bits in OrData are stripped.\r
513\r
514 If 16-bit I/O port operations are not supported, then ASSERT().\r
515 If StartBit is greater than 15, then ASSERT().\r
516 If EndBit is greater than 15, then ASSERT().\r
517 If EndBit is less than StartBit, then ASSERT().\r
94952554 518 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
fe69ac84 519\r
520 @param[in] Port The I/O port to write.\r
521 @param[in] StartBit The ordinal of the least significant bit in the bit field.\r
522 Range 0..15.\r
523 @param[in] EndBit The ordinal of the most significant bit in the bit field.\r
524 Range 0..15.\r
525 @param[in] OrData The value to OR with the read value from the I/O port.\r
526\r
527 @return The value written back to the I/O port.\r
528\r
529**/\r
530UINT16\r
531EFIAPI\r
532S3IoBitFieldOr16 (\r
533 IN UINTN Port,\r
534 IN UINTN StartBit,\r
535 IN UINTN EndBit,\r
536 IN UINT16 OrData\r
537 );\r
538\r
539/**\r
540 Reads a bit field in a 16-bit port, performs a bitwise AND, writes the\r
9095d37b 541 result back to the bit field in the 16-bit port, and saves the value in the\r
fe69ac84 542 S3 script to be replayed on S3 resume.\r
543\r
544 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between\r
545 the read result and the value specified by AndData, and writes the result to\r
546 the 16-bit I/O port specified by Port. The value written to the I/O port is\r
547 returned. This function must guarantee that all I/O read and write operations\r
548 are serialized. Extra left bits in AndData are stripped.\r
549\r
550 If 16-bit I/O port operations are not supported, then ASSERT().\r
551 If StartBit is greater than 15, then ASSERT().\r
552 If EndBit is greater than 15, then ASSERT().\r
553 If EndBit is less than StartBit, then ASSERT().\r
94952554 554 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
fe69ac84 555\r
556 @param[in] Port The I/O port to write.\r
557 @param[in] StartBit The ordinal of the least significant bit in the bit field.\r
558 Range 0..15.\r
559 @param[in] EndBit The ordinal of the most significant bit in the bit field.\r
560 Range 0..15.\r
561 @param[in] AndData The value to AND with the read value from the I/O port.\r
562\r
563 @return The value written back to the I/O port.\r
564\r
565**/\r
566UINT16\r
567EFIAPI\r
568S3IoBitFieldAnd16 (\r
569 IN UINTN Port,\r
570 IN UINTN StartBit,\r
571 IN UINTN EndBit,\r
572 IN UINT16 AndData\r
573 );\r
574\r
575/**\r
576 Reads a bit field in a 16-bit port, performs a bitwise AND followed by a\r
577 bitwise OR, writes the result back to the bit field in the\r
9095d37b 578 16-bit port, and saves the value in the S3 script to be replayed on S3\r
fe69ac84 579 resume.\r
580\r
581 Reads the 16-bit I/O port specified by Port, performs a bitwise AND followed\r
582 by a bitwise OR between the read result and the value specified by\r
583 AndData, and writes the result to the 16-bit I/O port specified by Port. The\r
584 value written to the I/O port is returned. This function must guarantee that\r
585 all I/O read and write operations are serialized. Extra left bits in both\r
586 AndData and OrData are stripped.\r
587\r
588 If 16-bit I/O port operations are not supported, then ASSERT().\r
589 If StartBit is greater than 15, then ASSERT().\r
590 If EndBit is greater than 15, then ASSERT().\r
591 If EndBit is less than StartBit, then ASSERT().\r
94952554
LG
592 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
593 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
fe69ac84 594\r
595 @param[in] Port The I/O port to write.\r
596 @param[in] StartBit The ordinal of the least significant bit in the bit field.\r
597 Range 0..15.\r
598 @param[in] EndBit The ordinal of the most significant bit in the bit field.\r
599 Range 0..15.\r
600 @param[in] AndData The value to AND with the read value from the I/O port.\r
601 @param[in] OrData The value to OR with the result of the AND operation.\r
602\r
603 @return The value written back to the I/O port.\r
604\r
605**/\r
606UINT16\r
607EFIAPI\r
608S3IoBitFieldAndThenOr16 (\r
609 IN UINTN Port,\r
610 IN UINTN StartBit,\r
611 IN UINTN EndBit,\r
612 IN UINT16 AndData,\r
613 IN UINT16 OrData\r
614 );\r
615\r
616/**\r
617 Reads a 32-bit I/O port, and saves the value in the S3 script to be replayed\r
618 on S3 resume.\r
619\r
620 Reads the 32-bit I/O port specified by Port. The 32-bit read value is returned.\r
621 This function must guarantee that all I/O read and write operations are\r
622 serialized.\r
623\r
624 If 32-bit I/O port operations are not supported, then ASSERT().\r
625\r
626 @param[in] Port The I/O port to read.\r
627\r
628 @return The value read.\r
629\r
630**/\r
631UINT32\r
632EFIAPI\r
633S3IoRead32 (\r
634 IN UINTN Port\r
635 );\r
636\r
637/**\r
638 Writes a 32-bit I/O port, and saves the value in the S3 script to be replayed\r
639 on S3 resume.\r
640\r
641 Writes the 32-bit I/O port specified by Port with the value specified by Value\r
642 and returns Value. This function must guarantee that all I/O read and write\r
643 operations are serialized.\r
644\r
645 If 32-bit I/O port operations are not supported, then ASSERT().\r
646\r
647 @param[in] Port The I/O port to write.\r
648 @param[in] Value The value to write to the I/O port.\r
649\r
650 @return The value written the I/O port.\r
651\r
652**/\r
653UINT32\r
654EFIAPI\r
655S3IoWrite32 (\r
656 IN UINTN Port,\r
657 IN UINT32 Value\r
658 );\r
659\r
660/**\r
661 Reads a 32-bit I/O port, performs a bitwise OR, writes the\r
9095d37b 662 result back to the 32-bit I/O port, and saves the value in the S3 script to\r
fe69ac84 663 be replayed on S3 resume.\r
664\r
665 Reads the 32-bit I/O port specified by Port, performs a bitwise OR\r
666 between the read result and the value specified by OrData, and writes the\r
667 result to the 32-bit I/O port specified by Port. The value written to the I/O\r
668 port is returned. This function must guarantee that all I/O read and write\r
669 operations are serialized.\r
670\r
671 If 32-bit I/O port operations are not supported, then ASSERT().\r
672\r
673 @param[in] Port The I/O port to write.\r
674 @param[in] OrData The value to OR with the read value from the I/O port.\r
675\r
676 @return The value written back to the I/O port.\r
677\r
678**/\r
679UINT32\r
680EFIAPI\r
681S3IoOr32 (\r
682 IN UINTN Port,\r
683 IN UINT32 OrData\r
684 );\r
685\r
686/**\r
687 Reads a 32-bit I/O port, performs a bitwise AND, writes the result back\r
688 to the 32-bit I/O port, and saves the value in the S3 script to be replayed\r
689 on S3 resume.\r
690\r
691 Reads the 32-bit I/O port specified by Port, performs a bitwise AND between\r
692 the read result and the value specified by AndData, and writes the result to\r
693 the 32-bit I/O port specified by Port. The value written to the I/O port is\r
694 returned. This function must guarantee that all I/O read and write operations\r
695 are serialized.\r
696\r
697 If 32-bit I/O port operations are not supported, then ASSERT().\r
698\r
699 @param[in] Port The I/O port to write.\r
700 @param[in] AndData The value to AND with the read value from the I/O port.\r
701\r
702 @return The value written back to the I/O port.\r
703\r
704**/\r
705UINT32\r
706EFIAPI\r
707S3IoAnd32 (\r
708 IN UINTN Port,\r
709 IN UINT32 AndData\r
710 );\r
711\r
712/**\r
713 Reads a 32-bit I/O port, performs a bitwise AND followed by a bitwise\r
9095d37b 714 inclusive OR, writes the result back to the 32-bit I/O port, and saves\r
fe69ac84 715 the value in the S3 script to be replayed on S3 resume.\r
716\r
717 Reads the 32-bit I/O port specified by Port, performs a bitwise AND between\r
718 the read result and the value specified by AndData, performs a bitwise OR\r
719 between the result of the AND operation and the value specified by OrData,\r
720 and writes the result to the 32-bit I/O port specified by Port. The value\r
721 written to the I/O port is returned. This function must guarantee that all\r
722 I/O read and write operations are serialized.\r
723\r
724 If 32-bit I/O port operations are not supported, then ASSERT().\r
725\r
726 @param[in] Port The I/O port to write.\r
727 @param[in] AndData The value to AND with the read value from the I/O port.\r
728 @param[in] OrData The value to OR with the result of the AND operation.\r
729\r
730 @return The value written back to the I/O port.\r
731\r
732**/\r
733UINT32\r
734EFIAPI\r
735S3IoAndThenOr32 (\r
736 IN UINTN Port,\r
737 IN UINT32 AndData,\r
738 IN UINT32 OrData\r
739 );\r
740\r
741/**\r
742 Reads a bit field of an I/O register, and saves the value in the S3 script to\r
743 be replayed on S3 resume.\r
744\r
745 Reads the bit field in a 32-bit I/O register. The bit field is specified by\r
746 the StartBit and the EndBit. The value of the bit field is returned.\r
747\r
748 If 32-bit I/O port operations are not supported, then ASSERT().\r
749 If StartBit is greater than 31, then ASSERT().\r
750 If EndBit is greater than 31, then ASSERT().\r
751 If EndBit is less than StartBit, then ASSERT().\r
752\r
753 @param[in] Port The I/O port to read.\r
754 @param[in] StartBit The ordinal of the least significant bit in the bit field.\r
755 Range 0..31.\r
756 @param[in] EndBit The ordinal of the most significant bit in the bit field.\r
757 Range 0..31.\r
758\r
759 @return The value read.\r
760\r
761**/\r
762UINT32\r
763EFIAPI\r
764S3IoBitFieldRead32 (\r
765 IN UINTN Port,\r
766 IN UINTN StartBit,\r
767 IN UINTN EndBit\r
768 );\r
769\r
770/**\r
771 Writes a bit field to an I/O register, and saves the value in the S3 script to\r
772 be replayed on S3 resume.\r
773\r
774 Writes Value to the bit field of the I/O register. The bit field is specified\r
775 by the StartBit and the EndBit. All other bits in the destination I/O\r
776 register are preserved. The value written to the I/O port is returned. Extra\r
777 left bits in Value are stripped.\r
778\r
779 If 32-bit I/O port operations are not supported, then ASSERT().\r
780 If StartBit is greater than 31, then ASSERT().\r
781 If EndBit is greater than 31, then ASSERT().\r
782 If EndBit is less than StartBit, then ASSERT().\r
94952554 783 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
fe69ac84 784\r
785 @param[in] Port The I/O port to write.\r
786 @param[in] StartBit The ordinal of the least significant bit in the bit field.\r
787 Range 0..31.\r
788 @param[in] EndBit The ordinal of the most significant bit in the bit field.\r
789 Range 0..31.\r
790 @param[in] Value New value of the bit field.\r
791\r
792 @return The value written back to the I/O port.\r
793\r
794**/\r
795UINT32\r
796EFIAPI\r
797S3IoBitFieldWrite32 (\r
798 IN UINTN Port,\r
799 IN UINTN StartBit,\r
800 IN UINTN EndBit,\r
801 IN UINT32 Value\r
802 );\r
803\r
804/**\r
805 Reads a bit field in a 32-bit port, performs a bitwise OR, writes the\r
9095d37b 806 result back to the bit field in the 32-bit port, and saves the value in the\r
fe69ac84 807 S3 script to be replayed on S3 resume.\r
808\r
809 Reads the 32-bit I/O port specified by Port, performs a bitwise OR\r
810 between the read result and the value specified by OrData, and writes the\r
811 result to the 32-bit I/O port specified by Port. The value written to the I/O\r
812 port is returned. This function must guarantee that all I/O read and write\r
813 operations are serialized. Extra left bits in OrData are stripped.\r
814\r
815 If 32-bit I/O port operations are not supported, then ASSERT().\r
816 If StartBit is greater than 31, then ASSERT().\r
817 If EndBit is greater than 31, then ASSERT().\r
818 If EndBit is less than StartBit, then ASSERT().\r
94952554 819 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
fe69ac84 820\r
821 @param[in] Port The I/O port to write.\r
822 @param[in] StartBit The ordinal of the least significant bit in the bit field.\r
823 Range 0..31.\r
824 @param[in] EndBit The ordinal of the most significant bit in the bit field.\r
825 Range 0..31.\r
826 @param[in] OrData The value to OR with the read value from the I/O port.\r
827\r
828 @return The value written back to the I/O port.\r
829\r
830**/\r
831UINT32\r
832EFIAPI\r
833S3IoBitFieldOr32 (\r
834 IN UINTN Port,\r
835 IN UINTN StartBit,\r
836 IN UINTN EndBit,\r
837 IN UINT32 OrData\r
838 );\r
839\r
840/**\r
841 Reads a bit field in a 32-bit port, performs a bitwise AND, writes the\r
9095d37b 842 result back to the bit field in the 32-bit port, and saves the value in the\r
fe69ac84 843 S3 script to be replayed on S3 resume.\r
844\r
845 Reads the 32-bit I/O port specified by Port, performs a bitwise AND between\r
846 the read result and the value specified by AndData, and writes the result to\r
847 the 32-bit I/O port specified by Port. The value written to the I/O port is\r
848 returned. This function must guarantee that all I/O read and write operations\r
849 are serialized. Extra left bits in AndData are stripped.\r
850\r
851 If 32-bit I/O port operations are not supported, then ASSERT().\r
852 If StartBit is greater than 31, then ASSERT().\r
853 If EndBit is greater than 31, then ASSERT().\r
854 If EndBit is less than StartBit, then ASSERT().\r
94952554 855 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
fe69ac84 856\r
857 @param[in] Port The I/O port to write.\r
858 @param[in] StartBit The ordinal of the least significant bit in the bit field.\r
859 Range 0..31.\r
860 @param[in] EndBit The ordinal of the most significant bit in the bit field.\r
861 Range 0..31.\r
862 @param[in] AndData The value to AND with the read value from the I/O port.\r
863\r
864 @return The value written back to the I/O port.\r
865\r
866**/\r
867UINT32\r
868EFIAPI\r
869S3IoBitFieldAnd32 (\r
870 IN UINTN Port,\r
871 IN UINTN StartBit,\r
872 IN UINTN EndBit,\r
873 IN UINT32 AndData\r
874 );\r
875\r
876/**\r
877 Reads a bit field in a 32-bit port, performs a bitwise AND followed by a\r
878 bitwise OR, writes the result back to the bit field in the\r
9095d37b 879 32-bit port, and saves the value in the S3 script to be replayed on S3\r
fe69ac84 880 resume.\r
881\r
882 Reads the 32-bit I/O port specified by Port, performs a bitwise AND followed\r
883 by a bitwise OR between the read result and the value specified by\r
884 AndData, and writes the result to the 32-bit I/O port specified by Port. The\r
885 value written to the I/O port is returned. This function must guarantee that\r
886 all I/O read and write operations are serialized. Extra left bits in both\r
887 AndData and OrData are stripped.\r
888\r
889 If 32-bit I/O port operations are not supported, then ASSERT().\r
890 If StartBit is greater than 31, then ASSERT().\r
891 If EndBit is greater than 31, then ASSERT().\r
892 If EndBit is less than StartBit, then ASSERT().\r
94952554
LG
893 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
894 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
fe69ac84 895\r
896 @param[in] Port The I/O port to write.\r
897 @param[in] StartBit The ordinal of the least significant bit in the bit field.\r
898 Range 0..31.\r
899 @param[in] EndBit The ordinal of the most significant bit in the bit field.\r
900 Range 0..31.\r
901 @param[in] AndData The value to AND with the read value from the I/O port.\r
902 @param[in] OrData The value to OR with the result of the AND operation.\r
903\r
904 @return The value written back to the I/O port.\r
905\r
906**/\r
907UINT32\r
908EFIAPI\r
909S3IoBitFieldAndThenOr32 (\r
910 IN UINTN Port,\r
911 IN UINTN StartBit,\r
912 IN UINTN EndBit,\r
913 IN UINT32 AndData,\r
914 IN UINT32 OrData\r
915 );\r
916\r
917/**\r
918 Reads a 64-bit I/O port, and saves the value in the S3 script to be replayed\r
919 on S3 resume.\r
920\r
921 Reads the 64-bit I/O port specified by Port. The 64-bit read value is returned.\r
922 This function must guarantee that all I/O read and write operations are\r
923 serialized.\r
924\r
925 If 64-bit I/O port operations are not supported, then ASSERT().\r
926\r
927 @param[in] Port The I/O port to read.\r
928\r
929 @return The value read.\r
930\r
931**/\r
932UINT64\r
933EFIAPI\r
934S3IoRead64 (\r
935 IN UINTN Port\r
936 );\r
937\r
938/**\r
939 Writes a 64-bit I/O port, and saves the value in the S3 script to be replayed\r
940 on S3 resume.\r
941\r
942 Writes the 64-bit I/O port specified by Port with the value specified by Value\r
943 and returns Value. This function must guarantee that all I/O read and write\r
944 operations are serialized.\r
945\r
946 If 64-bit I/O port operations are not supported, then ASSERT().\r
947\r
948 @param[in] Port The I/O port to write.\r
949 @param[in] Value The value to write to the I/O port.\r
950\r
951 @return The value written to the I/O port.\r
952\r
953**/\r
954UINT64\r
955EFIAPI\r
956S3IoWrite64 (\r
957 IN UINTN Port,\r
958 IN UINT64 Value\r
959 );\r
960\r
961/**\r
962 Reads a 64-bit I/O port, performs a bitwise OR, writes the\r
9095d37b 963 result back to the 64-bit I/O port, and saves the value in the S3 script to\r
fe69ac84 964 be replayed on S3 resume.\r
965\r
966 Reads the 64-bit I/O port specified by Port, performs a bitwise OR\r
967 between the read result and the value specified by OrData, and writes the\r
968 result to the 64-bit I/O port specified by Port. The value written to the I/O\r
969 port is returned. This function must guarantee that all I/O read and write\r
970 operations are serialized.\r
971\r
972 If 64-bit I/O port operations are not supported, then ASSERT().\r
973\r
974 @param[in] Port The I/O port to write.\r
975 @param[in] OrData The value to OR with the read value from the I/O port.\r
976\r
977 @return The value written back to the I/O port.\r
978\r
979**/\r
980UINT64\r
981EFIAPI\r
982S3IoOr64 (\r
983 IN UINTN Port,\r
984 IN UINT64 OrData\r
985 );\r
986\r
987/**\r
988 Reads a 64-bit I/O port, performs a bitwise AND, writes the result back\r
989 to the 64-bit I/O port, and saves the value in the S3 script to be replayed\r
990 on S3 resume.\r
991\r
992 Reads the 64-bit I/O port specified by Port, performs a bitwise AND between\r
993 the read result and the value specified by AndData, and writes the result to\r
994 the 64-bit I/O port specified by Port. The value written to the I/O port is\r
995 returned. This function must guarantee that all I/O read and write operations\r
996 are serialized.\r
997\r
998 If 64-bit I/O port operations are not supported, then ASSERT().\r
999\r
1000 @param[in] Port The I/O port to write.\r
1001 @param[in] AndData The value to AND with the read value from the I/O port.\r
1002\r
1003 @return The value written back to the I/O port.\r
1004\r
1005**/\r
1006UINT64\r
1007EFIAPI\r
1008S3IoAnd64 (\r
1009 IN UINTN Port,\r
1010 IN UINT64 AndData\r
1011 );\r
1012\r
1013/**\r
1014 Reads a 64-bit I/O port, performs a bitwise AND followed by a bitwise\r
1015 inclusive OR, writes the result back to the 64-bit I/O port, and saves\r
1016 the value in the S3 script to be replayed on S3 resume.\r
1017\r
1018 Reads the 64-bit I/O port specified by Port, performs a bitwise AND between\r
1019 the read result and the value specified by AndData, performs a bitwise OR\r
1020 between the result of the AND operation and the value specified by OrData,\r
1021 and writes the result to the 64-bit I/O port specified by Port. The value\r
1022 written to the I/O port is returned. This function must guarantee that all\r
1023 I/O read and write operations are serialized.\r
1024\r
1025 If 64-bit I/O port operations are not supported, then ASSERT().\r
1026\r
1027 @param[in] Port The I/O port to write.\r
1028 @param[in] AndData The value to AND with the read value from the I/O port.\r
1029 @param[in] OrData The value to OR with the result of the AND operation.\r
1030\r
1031 @return The value written back to the I/O port.\r
1032\r
1033**/\r
1034UINT64\r
1035EFIAPI\r
1036S3IoAndThenOr64 (\r
1037 IN UINTN Port,\r
1038 IN UINT64 AndData,\r
1039 IN UINT64 OrData\r
1040 );\r
1041\r
1042/**\r
1043 Reads a bit field of an I/O register, and saves the value in the S3 script to\r
1044 be replayed on S3 resume.\r
1045\r
1046 Reads the bit field in a 64-bit I/O register. The bit field is specified by\r
1047 the StartBit and the EndBit. The value of the bit field is returned.\r
1048\r
1049 If 64-bit I/O port operations are not supported, then ASSERT().\r
1050 If StartBit is greater than 63, then ASSERT().\r
1051 If EndBit is greater than 63, then ASSERT().\r
1052 If EndBit is less than StartBit, then ASSERT().\r
1053\r
1054 @param[in] Port The I/O port to read.\r
1055 @param[in] StartBit The ordinal of the least significant bit in the bit field.\r
1056 Range 0..63.\r
1057 @param[in] EndBit The ordinal of the most significant bit in the bit field.\r
1058 Range 0..63.\r
1059\r
1060 @return The value read.\r
1061\r
1062**/\r
1063UINT64\r
1064EFIAPI\r
1065S3IoBitFieldRead64 (\r
1066 IN UINTN Port,\r
1067 IN UINTN StartBit,\r
1068 IN UINTN EndBit\r
1069 );\r
1070\r
1071/**\r
1072 Writes a bit field to an I/O register, and saves the value in the S3 script to\r
1073 be replayed on S3 resume.\r
1074\r
1075 Writes Value to the bit field of the I/O register. The bit field is specified\r
1076 by the StartBit and the EndBit. All other bits in the destination I/O\r
1077 register are preserved. The value written to the I/O port is returned. Extra\r
1078 left bits in Value are stripped.\r
1079\r
1080 If 64-bit I/O port operations are not supported, then ASSERT().\r
1081 If StartBit is greater than 63, then ASSERT().\r
1082 If EndBit is greater than 63, then ASSERT().\r
1083 If EndBit is less than StartBit, then ASSERT().\r
94952554 1084 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
fe69ac84 1085\r
1086 @param[in] Port The I/O port to write.\r
1087 @param[in] StartBit The ordinal of the least significant bit in the bit field.\r
1088 Range 0..63.\r
1089 @param[in] EndBit The ordinal of the most significant bit in the bit field.\r
1090 Range 0..63.\r
1091 @param[in] Value New value of the bit field.\r
1092\r
1093 @return The value written back to the I/O port.\r
1094\r
1095**/\r
1096UINT64\r
1097EFIAPI\r
1098S3IoBitFieldWrite64 (\r
1099 IN UINTN Port,\r
1100 IN UINTN StartBit,\r
1101 IN UINTN EndBit,\r
1102 IN UINT64 Value\r
1103 );\r
1104\r
1105/**\r
1106 Reads a bit field in a 64-bit port, performs a bitwise OR, writes the\r
9095d37b 1107 result back to the bit field in the 64-bit port, and saves the value in the\r
fe69ac84 1108 S3 script to be replayed on S3 resume.\r
1109\r
1110 Reads the 64-bit I/O port specified by Port, performs a bitwise OR\r
1111 between the read result and the value specified by OrData, and writes the\r
1112 result to the 64-bit I/O port specified by Port. The value written to the I/O\r
1113 port is returned. This function must guarantee that all I/O read and write\r
1114 operations are serialized. Extra left bits in OrData are stripped.\r
1115\r
1116 If 64-bit I/O port operations are not supported, then ASSERT().\r
1117 If StartBit is greater than 63, then ASSERT().\r
1118 If EndBit is greater than 63, then ASSERT().\r
1119 If EndBit is less than StartBit, then ASSERT().\r
94952554 1120 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
fe69ac84 1121\r
1122 @param[in] Port The I/O port to write.\r
1123 @param[in] StartBit The ordinal of the least significant bit in the bit field.\r
1124 Range 0..63.\r
1125 @param[in] EndBit The ordinal of the most significant bit in the bit field.\r
1126 Range 0..63.\r
1127 @param[in] OrData The value to OR with the read value from the I/O port.\r
1128\r
1129 @return The value written back to the I/O port.\r
1130\r
1131**/\r
1132UINT64\r
1133EFIAPI\r
1134S3IoBitFieldOr64 (\r
1135 IN UINTN Port,\r
1136 IN UINTN StartBit,\r
1137 IN UINTN EndBit,\r
1138 IN UINT64 OrData\r
1139 );\r
1140\r
1141/**\r
1142 Reads a bit field in a 64-bit port, performs a bitwise AND, writes the\r
9095d37b 1143 result back to the bit field in the 64-bit port, and saves the value in the\r
fe69ac84 1144 S3 script to be replayed on S3 resume.\r
1145\r
1146 Reads the 64-bit I/O port specified by Port, performs a bitwise AND between\r
1147 the read result and the value specified by AndData, and writes the result to\r
1148 the 64-bit I/O port specified by Port. The value written to the I/O port is\r
1149 returned. This function must guarantee that all I/O read and write operations\r
1150 are serialized. Extra left bits in AndData are stripped.\r
1151\r
1152 If 64-bit I/O port operations are not supported, then ASSERT().\r
1153 If StartBit is greater than 63, then ASSERT().\r
1154 If EndBit is greater than 63, then ASSERT().\r
1155 If EndBit is less than StartBit, then ASSERT().\r
94952554 1156 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
fe69ac84 1157\r
1158 @param[in] Port The I/O port to write.\r
1159 @param[in] StartBit The ordinal of the least significant bit in the bit field.\r
1160 Range 0..63.\r
1161 @param[in] EndBit The ordinal of the most significant bit in the bit field.\r
1162 Range 0..63.\r
1163 @param[in] AndData The value to AND with the read value from the I/O port.\r
1164\r
1165 @return The value written back to the I/O port.\r
1166\r
1167**/\r
1168UINT64\r
1169EFIAPI\r
1170S3IoBitFieldAnd64 (\r
1171 IN UINTN Port,\r
1172 IN UINTN StartBit,\r
1173 IN UINTN EndBit,\r
1174 IN UINT64 AndData\r
1175 );\r
1176\r
1177/**\r
1178 Reads a bit field in a 64-bit port, performs a bitwise AND followed by a\r
1179 bitwise OR, writes the result back to the bit field in the\r
9095d37b 1180 64-bit port, and saves the value in the S3 script to be replayed on S3\r
fe69ac84 1181 resume.\r
1182\r
1183 Reads the 64-bit I/O port specified by Port, performs a bitwise AND followed\r
1184 by a bitwise OR between the read result and the value specified by\r
1185 AndData, and writes the result to the 64-bit I/O port specified by Port. The\r
1186 value written to the I/O port is returned. This function must guarantee that\r
1187 all I/O read and write operations are serialized. Extra left bits in both\r
1188 AndData and OrData are stripped.\r
1189\r
1190 If 64-bit I/O port operations are not supported, then ASSERT().\r
1191 If StartBit is greater than 63, then ASSERT().\r
1192 If EndBit is greater than 63, then ASSERT().\r
1193 If EndBit is less than StartBit, then ASSERT().\r
94952554
LG
1194 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
1195 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
fe69ac84 1196\r
1197 @param[in] Port The I/O port to write.\r
1198 @param[in] StartBit The ordinal of the least significant bit in the bit field.\r
1199 Range 0..63.\r
1200 @param[in] EndBit The ordinal of the most significant bit in the bit field.\r
1201 Range 0..63.\r
1202 @param[in] AndData The value to AND with the read value from the I/O port.\r
1203 @param[in] OrData The value to OR with the result of the AND operation.\r
1204\r
1205 @return The value written back to the I/O port.\r
1206\r
1207**/\r
1208UINT64\r
1209EFIAPI\r
1210S3IoBitFieldAndThenOr64 (\r
1211 IN UINTN Port,\r
1212 IN UINTN StartBit,\r
1213 IN UINTN EndBit,\r
1214 IN UINT64 AndData,\r
1215 IN UINT64 OrData\r
1216 );\r
1217\r
1218/**\r
9095d37b 1219 Reads an 8-bit MMIO register, and saves the value in the S3 script to be\r
fe69ac84 1220 replayed on S3 resume.\r
1221\r
1222 Reads the 8-bit MMIO register specified by Address. The 8-bit read value is\r
1223 returned. This function must guarantee that all MMIO read and write\r
1224 operations are serialized.\r
1225\r
1226 If 8-bit MMIO register operations are not supported, then ASSERT().\r
1227\r
1228 @param[in] Address The MMIO register to read.\r
1229\r
1230 @return The value read.\r
1231\r
1232**/\r
1233UINT8\r
1234EFIAPI\r
1235S3MmioRead8 (\r
1236 IN UINTN Address\r
1237 );\r
1238\r
1239/**\r
9095d37b 1240 Writes an 8-bit MMIO register, and saves the value in the S3 script to be\r
fe69ac84 1241 replayed on S3 resume.\r
1242\r
1243 Writes the 8-bit MMIO register specified by Address with the value specified\r
1244 by Value and returns Value. This function must guarantee that all MMIO read\r
1245 and write operations are serialized.\r
1246\r
1247 If 8-bit MMIO register operations are not supported, then ASSERT().\r
1248\r
1249 @param[in] Address The MMIO register to write.\r
1250 @param[in] Value The value to write to the MMIO register.\r
1251\r
1252 @return The value written the MMIO register.\r
1253\r
1254**/\r
1255UINT8\r
1256EFIAPI\r
1257S3MmioWrite8 (\r
1258 IN UINTN Address,\r
1259 IN UINT8 Value\r
1260 );\r
1261\r
1262/**\r
1263 Reads an 8-bit MMIO register, performs a bitwise OR, writes the\r
9095d37b 1264 result back to the 8-bit MMIO register, and saves the value in the S3 script\r
fe69ac84 1265 to be replayed on S3 resume.\r
1266\r
1267 Reads the 8-bit MMIO register specified by Address, performs a bitwise\r
1268 inclusive OR between the read result and the value specified by OrData, and\r
1269 writes the result to the 8-bit MMIO register specified by Address. The value\r
1270 written to the MMIO register is returned. This function must guarantee that\r
1271 all MMIO read and write operations are serialized.\r
1272\r
1273 If 8-bit MMIO register operations are not supported, then ASSERT().\r
1274\r
1275 @param[in] Address The MMIO register to write.\r
1276 @param[in] OrData The value to OR with the read value from the MMIO register.\r
1277\r
1278 @return The value written back to the MMIO register.\r
1279\r
1280**/\r
1281UINT8\r
1282EFIAPI\r
1283S3MmioOr8 (\r
1284 IN UINTN Address,\r
1285 IN UINT8 OrData\r
1286 );\r
1287\r
1288/**\r
1289 Reads an 8-bit MMIO register, performs a bitwise AND, writes the result\r
9095d37b 1290 back to the 8-bit MMIO register, and saves the value in the S3 script to be\r
fe69ac84 1291 replayed on S3 resume.\r
1292\r
1293 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND\r
1294 between the read result and the value specified by AndData, and writes the\r
1295 result to the 8-bit MMIO register specified by Address. The value written to\r
1296 the MMIO register is returned. This function must guarantee that all MMIO\r
1297 read and write operations are serialized.\r
1298\r
1299 If 8-bit MMIO register operations are not supported, then ASSERT().\r
1300\r
1301 @param[in] Address The MMIO register to write.\r
1302 @param[in] AndData The value to AND with the read value from the MMIO register.\r
1303\r
1304 @return The value written back to the MMIO register.\r
1305\r
1306**/\r
1307UINT8\r
1308EFIAPI\r
1309S3MmioAnd8 (\r
1310 IN UINTN Address,\r
1311 IN UINT8 AndData\r
1312 );\r
1313\r
1314/**\r
1315 Reads an 8-bit MMIO register, performs a bitwise AND followed by a bitwise\r
9095d37b 1316 inclusive OR, writes the result back to the 8-bit MMIO register, and saves\r
fe69ac84 1317 the value in the S3 script to be replayed on S3 resume.\r
1318\r
1319 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND\r
1320 between the read result and the value specified by AndData, performs a\r
1321 bitwise OR between the result of the AND operation and the value specified by\r
1322 OrData, and writes the result to the 8-bit MMIO register specified by\r
1323 Address. The value written to the MMIO register is returned. This function\r
1324 must guarantee that all MMIO read and write operations are serialized.\r
1325\r
1326 If 8-bit MMIO register operations are not supported, then ASSERT().\r
1327\r
1328 @param[in] Address The MMIO register to write.\r
1329 @param[in] AndData The value to AND with the read value from the MMIO register.\r
1330 @param[in] OrData The value to OR with the result of the AND operation.\r
1331\r
1332 @return The value written back to the MMIO register.\r
1333\r
1334**/\r
1335UINT8\r
1336EFIAPI\r
1337S3MmioAndThenOr8 (\r
1338 IN UINTN Address,\r
1339 IN UINT8 AndData,\r
1340 IN UINT8 OrData\r
1341 );\r
1342\r
1343/**\r
1344 Reads a bit field of a MMIO register, and saves the value in the S3 script to\r
1345 be replayed on S3 resume.\r
1346\r
1347 Reads the bit field in an 8-bit MMIO register. The bit field is specified by\r
1348 the StartBit and the EndBit. The value of the bit field is returned.\r
1349\r
1350 If 8-bit MMIO register operations are not supported, then ASSERT().\r
1351 If StartBit is greater than 7, then ASSERT().\r
1352 If EndBit is greater than 7, then ASSERT().\r
1353 If EndBit is less than StartBit, then ASSERT().\r
1354\r
1355 @param[in] Address MMIO register to read.\r
1356 @param[in] StartBit The ordinal of the least significant bit in the bit field.\r
1357 Range 0..7.\r
1358 @param[in] EndBit The ordinal of the most significant bit in the bit field.\r
1359 Range 0..7.\r
1360\r
1361 @return The value read.\r
1362\r
1363**/\r
1364UINT8\r
1365EFIAPI\r
1366S3MmioBitFieldRead8 (\r
1367 IN UINTN Address,\r
1368 IN UINTN StartBit,\r
1369 IN UINTN EndBit\r
1370 );\r
1371\r
1372/**\r
1373 Writes a bit field to an MMIO register, and saves the value in the S3 script to\r
1374 be replayed on S3 resume.\r
1375\r
1376 Writes Value to the bit field of the MMIO register. The bit field is\r
1377 specified by the StartBit and the EndBit. All other bits in the destination\r
1378 MMIO register are preserved. The new value of the 8-bit register is returned.\r
1379\r
1380 If 8-bit MMIO register operations are not supported, then ASSERT().\r
1381 If StartBit is greater than 7, then ASSERT().\r
1382 If EndBit is greater than 7, then ASSERT().\r
1383 If EndBit is less than StartBit, then ASSERT().\r
94952554 1384 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
fe69ac84 1385\r
1386 @param[in] Address The MMIO register to write.\r
1387 @param[in] StartBit The ordinal of the least significant bit in the bit field.\r
1388 Range 0..7.\r
1389 @param[in] EndBit The ordinal of the most significant bit in the bit field.\r
1390 Range 0..7.\r
1391 @param[in] Value New value of the bit field.\r
1392\r
1393 @return The value written back to the MMIO register.\r
1394\r
1395**/\r
1396UINT8\r
1397EFIAPI\r
1398S3MmioBitFieldWrite8 (\r
1399 IN UINTN Address,\r
1400 IN UINTN StartBit,\r
1401 IN UINTN EndBit,\r
1402 IN UINT8 Value\r
1403 );\r
1404\r
1405/**\r
9095d37b 1406 Reads a bit field in an 8-bit MMIO register, performs a bitwise OR,\r
fe69ac84 1407 writes the result back to the bit field in the 8-bit MMIO register, and saves\r
1408 the value in the S3 script to be replayed on S3 resume.\r
1409\r
1410 Reads the 8-bit MMIO register specified by Address, performs a bitwise\r
1411 inclusive OR between the read result and the value specified by OrData, and\r
1412 writes the result to the 8-bit MMIO register specified by Address. The value\r
1413 written to the MMIO register is returned. This function must guarantee that\r
1414 all MMIO read and write operations are serialized. Extra left bits in OrData\r
1415 are stripped.\r
1416\r
1417 If 8-bit MMIO register operations are not supported, then ASSERT().\r
1418 If StartBit is greater than 7, then ASSERT().\r
1419 If EndBit is greater than 7, then ASSERT().\r
1420 If EndBit is less than StartBit, then ASSERT().\r
94952554 1421 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
fe69ac84 1422\r
1423 @param[in] Address The MMIO register to write.\r
1424 @param[in] StartBit The ordinal of the least significant bit in the bit field.\r
1425 Range 0..7.\r
1426 @param[in] EndBit The ordinal of the most significant bit in the bit field.\r
1427 Range 0..7.\r
1428 @param[in] OrData The value to OR with the read value from the MMIO register.\r
1429\r
1430 @return The value written back to the MMIO register.\r
1431\r
1432**/\r
1433UINT8\r
1434EFIAPI\r
1435S3MmioBitFieldOr8 (\r
1436 IN UINTN Address,\r
1437 IN UINTN StartBit,\r
1438 IN UINTN EndBit,\r
1439 IN UINT8 OrData\r
1440 );\r
1441\r
1442/**\r
1443 Reads a bit field in an 8-bit MMIO register, performs a bitwise AND, and\r
1444 writes the result back to the bit field in the 8-bit MMIO register, and saves\r
1445 the value in the S3 script to be replayed on S3 resume.\r
1446\r
1447 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND\r
1448 between the read result and the value specified by AndData, and writes the\r
1449 result to the 8-bit MMIO register specified by Address. The value written to\r
1450 the MMIO register is returned. This function must guarantee that all MMIO\r
1451 read and write operations are serialized. Extra left bits in AndData are\r
1452 stripped.\r
1453\r
1454 If 8-bit MMIO register operations are not supported, then ASSERT().\r
1455 If StartBit is greater than 7, then ASSERT().\r
1456 If EndBit is greater than 7, then ASSERT().\r
1457 If EndBit is less than StartBit, then ASSERT().\r
94952554 1458 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
fe69ac84 1459\r
1460 @param[in] Address The MMIO register to write.\r
1461 @param[in] StartBit The ordinal of the least significant bit in the bit field.\r
1462 Range 0..7.\r
1463 @param[in] EndBit The ordinal of the most significant bit in the bit field.\r
1464 Range 0..7.\r
1465 @param[in] AndData The value to AND with the read value from the MMIO register.\r
1466\r
1467 @return The value written back to the MMIO register.\r
1468\r
1469**/\r
1470UINT8\r
1471EFIAPI\r
1472S3MmioBitFieldAnd8 (\r
1473 IN UINTN Address,\r
1474 IN UINTN StartBit,\r
1475 IN UINTN EndBit,\r
1476 IN UINT8 AndData\r
1477 );\r
1478\r
1479/**\r
1480 Reads a bit field in an 8-bit MMIO register, performs a bitwise AND followed\r
1481 by a bitwise OR, writes the result back to the bit field in the\r
1482 8-bit MMIO register, and saves the value in the S3 script to be replayed\r
1483 on S3 resume.\r
1484\r
1485 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND\r
1486 followed by a bitwise OR between the read result and the value\r
1487 specified by AndData, and writes the result to the 8-bit MMIO register\r
1488 specified by Address. The value written to the MMIO register is returned.\r
1489 This function must guarantee that all MMIO read and write operations are\r
1490 serialized. Extra left bits in both AndData and OrData are stripped.\r
1491\r
1492 If 8-bit MMIO register operations are not supported, then ASSERT().\r
1493 If StartBit is greater than 7, then ASSERT().\r
1494 If EndBit is greater than 7, then ASSERT().\r
1495 If EndBit is less than StartBit, then ASSERT().\r
94952554
LG
1496 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
1497 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
fe69ac84 1498\r
1499 @param[in] Address The MMIO register to write.\r
1500 @param[in] StartBit The ordinal of the least significant bit in the bit field.\r
1501 Range 0..7.\r
1502 @param[in] EndBit The ordinal of the most significant bit in the bit field.\r
1503 Range 0..7.\r
1504 @param[in] AndData The value to AND with the read value from the MMIO register.\r
1505 @param[in] OrData The value to OR with the result of the AND operation.\r
1506\r
1507 @return The value written back to the MMIO register.\r
1508\r
1509**/\r
1510UINT8\r
1511EFIAPI\r
1512S3MmioBitFieldAndThenOr8 (\r
1513 IN UINTN Address,\r
1514 IN UINTN StartBit,\r
1515 IN UINTN EndBit,\r
1516 IN UINT8 AndData,\r
1517 IN UINT8 OrData\r
1518 );\r
1519\r
1520/**\r
1521 Reads a 16-bit MMIO register, and saves the value in the S3 script to be replayed\r
1522 on S3 resume.\r
1523\r
1524 Reads the 16-bit MMIO register specified by Address. The 16-bit read value is\r
1525 returned. This function must guarantee that all MMIO read and write\r
1526 operations are serialized.\r
1527\r
1528 If 16-bit MMIO register operations are not supported, then ASSERT().\r
1529\r
1530 @param[in] Address The MMIO register to read.\r
1531\r
1532 @return The value read.\r
1533\r
1534**/\r
1535UINT16\r
1536EFIAPI\r
1537S3MmioRead16 (\r
1538 IN UINTN Address\r
1539 );\r
1540\r
1541/**\r
1542 Writes a 16-bit MMIO register, and saves the value in the S3 script to be replayed\r
1543 on S3 resume.\r
1544\r
1545 Writes the 16-bit MMIO register specified by Address with the value specified\r
1546 by Value and returns Value. This function must guarantee that all MMIO read\r
1547 and write operations are serialized, and saves the value in the S3 script to be\r
1548 replayed on S3 resume.\r
1549\r
1550 If 16-bit MMIO register operations are not supported, then ASSERT().\r
1551\r
1552 @param[in] Address The MMIO register to write.\r
1553 @param[in] Value The value to write to the MMIO register.\r
1554\r
1555 @return The value written the MMIO register.\r
1556\r
1557**/\r
1558UINT16\r
1559EFIAPI\r
1560S3MmioWrite16 (\r
1561 IN UINTN Address,\r
1562 IN UINT16 Value\r
1563 );\r
1564\r
1565/**\r
1566 Reads a 16-bit MMIO register, performs a bitwise OR, writes the\r
9095d37b 1567 result back to the 16-bit MMIO register, and saves the value in the S3 script\r
fe69ac84 1568 to be replayed on S3 resume.\r
1569\r
1570 Reads the 16-bit MMIO register specified by Address, performs a bitwise\r
1571 inclusive OR between the read result and the value specified by OrData, and\r
1572 writes the result to the 16-bit MMIO register specified by Address. The value\r
1573 written to the MMIO register is returned. This function must guarantee that\r
1574 all MMIO read and write operations are serialized.\r
1575\r
1576 If 16-bit MMIO register operations are not supported, then ASSERT().\r
1577\r
1578 @param[in] Address The MMIO register to write.\r
1579 @param[in] OrData The value to OR with the read value from the MMIO register.\r
1580\r
1581 @return The value written back to the MMIO register.\r
1582\r
1583**/\r
1584UINT16\r
1585EFIAPI\r
1586S3MmioOr16 (\r
1587 IN UINTN Address,\r
1588 IN UINT16 OrData\r
1589 );\r
1590\r
1591/**\r
1592 Reads a 16-bit MMIO register, performs a bitwise AND, writes the result\r
9095d37b 1593 back to the 16-bit MMIO register, and saves the value in the S3 script to be\r
fe69ac84 1594 replayed on S3 resume.\r
1595\r
1596 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND\r
1597 between the read result and the value specified by AndData, and writes the\r
1598 result to the 16-bit MMIO register specified by Address. The value written to\r
1599 the MMIO register is returned. This function must guarantee that all MMIO\r
1600 read and write operations are serialized.\r
1601\r
1602 If 16-bit MMIO register operations are not supported, then ASSERT().\r
1603\r
1604 @param[in] Address The MMIO register to write.\r
1605 @param[in] AndData The value to AND with the read value from the MMIO register.\r
1606\r
1607 @return The value written back to the MMIO register.\r
1608\r
1609**/\r
1610UINT16\r
1611EFIAPI\r
1612S3MmioAnd16 (\r
1613 IN UINTN Address,\r
1614 IN UINT16 AndData\r
1615 );\r
1616\r
1617/**\r
1618 Reads a 16-bit MMIO register, performs a bitwise AND followed by a bitwise\r
9095d37b 1619 inclusive OR, writes the result back to the 16-bit MMIO register, and\r
fe69ac84 1620 saves the value in the S3 script to be replayed on S3 resume.\r
1621\r
1622 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND\r
1623 between the read result and the value specified by AndData, performs a\r
1624 bitwise OR between the result of the AND operation and the value specified by\r
1625 OrData, and writes the result to the 16-bit MMIO register specified by\r
1626 Address. The value written to the MMIO register is returned. This function\r
1627 must guarantee that all MMIO read and write operations are serialized.\r
1628\r
1629 If 16-bit MMIO register operations are not supported, then ASSERT().\r
1630\r
1631 @param[in] Address The MMIO register to write.\r
1632 @param[in] AndData The value to AND with the read value from the MMIO register.\r
1633 @param[in] OrData The value to OR with the result of the AND operation.\r
1634\r
1635 @return The value written back to the MMIO register.\r
1636\r
1637**/\r
1638UINT16\r
1639EFIAPI\r
1640S3MmioAndThenOr16 (\r
1641 IN UINTN Address,\r
1642 IN UINT16 AndData,\r
1643 IN UINT16 OrData\r
1644 );\r
1645\r
1646/**\r
1647 Reads a bit field of a MMIO register, and saves the value in the S3 script to\r
1648 be replayed on S3 resume.\r
1649\r
1650 Reads the bit field in a 16-bit MMIO register. The bit field is specified by\r
1651 the StartBit and the EndBit. The value of the bit field is returned.\r
1652\r
1653 If 16-bit MMIO register operations are not supported, then ASSERT().\r
1654 If StartBit is greater than 15, then ASSERT().\r
1655 If EndBit is greater than 15, then ASSERT().\r
1656 If EndBit is less than StartBit, then ASSERT().\r
1657\r
1658 @param[in] Address MMIO register to read.\r
1659 @param[in] StartBit The ordinal of the least significant bit in the bit field.\r
1660 Range 0..15.\r
1661 @param[in] EndBit The ordinal of the most significant bit in the bit field.\r
1662 Range 0..15.\r
1663\r
1664 @return The value read.\r
1665\r
1666**/\r
1667UINT16\r
1668EFIAPI\r
1669S3MmioBitFieldRead16 (\r
1670 IN UINTN Address,\r
1671 IN UINTN StartBit,\r
1672 IN UINTN EndBit\r
1673 );\r
1674\r
1675/**\r
1676 Writes a bit field to a MMIO register, and saves the value in the S3 script to\r
1677 be replayed on S3 resume.\r
1678\r
1679 Writes Value to the bit field of the MMIO register. The bit field is\r
1680 specified by the StartBit and the EndBit. All other bits in the destination\r
1681 MMIO register are preserved. The new value of the 16-bit register is returned.\r
1682\r
1683 If 16-bit MMIO register operations are not supported, then ASSERT().\r
1684 If StartBit is greater than 15, then ASSERT().\r
1685 If EndBit is greater than 15, then ASSERT().\r
1686 If EndBit is less than StartBit, then ASSERT().\r
94952554 1687 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
fe69ac84 1688\r
1689 @param[in] Address The MMIO register to write.\r
1690 @param[in] StartBit The ordinal of the least significant bit in the bit field.\r
1691 Range 0..15.\r
1692 @param[in] EndBit The ordinal of the most significant bit in the bit field.\r
1693 Range 0..15.\r
1694 @param[in] Value New value of the bit field.\r
1695\r
1696 @return The value written back to the MMIO register.\r
1697\r
1698**/\r
1699UINT16\r
1700EFIAPI\r
1701S3MmioBitFieldWrite16 (\r
1702 IN UINTN Address,\r
1703 IN UINTN StartBit,\r
1704 IN UINTN EndBit,\r
1705 IN UINT16 Value\r
1706 );\r
1707\r
1708/**\r
9095d37b
LG
1709 Reads a bit field in a 16-bit MMIO register, performs a bitwise OR,\r
1710 writes the result back to the bit field in the 16-bit MMIO register, and\r
fe69ac84 1711 saves the value in the S3 script to be replayed on S3 resume.\r
1712\r
1713 Reads the 16-bit MMIO register specified by Address, performs a bitwise\r
1714 inclusive OR between the read result and the value specified by OrData, and\r
1715 writes the result to the 16-bit MMIO register specified by Address. The value\r
1716 written to the MMIO register is returned. This function must guarantee that\r
1717 all MMIO read and write operations are serialized. Extra left bits in OrData\r
1718 are stripped.\r
1719\r
1720 If 16-bit MMIO register operations are not supported, then ASSERT().\r
1721 If StartBit is greater than 15, then ASSERT().\r
1722 If EndBit is greater than 15, then ASSERT().\r
1723 If EndBit is less than StartBit, then ASSERT().\r
94952554 1724 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
fe69ac84 1725\r
1726 @param[in] Address The MMIO register to write.\r
1727 @param[in] StartBit The ordinal of the least significant bit in the bit field.\r
1728 Range 0..15.\r
1729 @param[in] EndBit The ordinal of the most significant bit in the bit field.\r
1730 Range 0..15.\r
1731 @param[in] OrData The value to OR with the read value from the MMIO register.\r
1732\r
1733 @return The value written back to the MMIO register.\r
1734\r
1735**/\r
1736UINT16\r
1737EFIAPI\r
1738S3MmioBitFieldOr16 (\r
1739 IN UINTN Address,\r
1740 IN UINTN StartBit,\r
1741 IN UINTN EndBit,\r
1742 IN UINT16 OrData\r
1743 );\r
1744\r
1745/**\r
1746 Reads a bit field in a 16-bit MMIO register, performs a bitwise AND, and\r
9095d37b 1747 writes the result back to the bit field in the 16-bit MMIO register and\r
fe69ac84 1748 saves the value in the S3 script to be replayed on S3 resume.\r
1749\r
1750 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND\r
1751 between the read result and the value specified by AndData, and writes the\r
1752 result to the 16-bit MMIO register specified by Address. The value written to\r
1753 the MMIO register is returned. This function must guarantee that all MMIO\r
1754 read and write operations are serialized. Extra left bits in AndData are\r
1755 stripped.\r
1756\r
1757 If 16-bit MMIO register operations are not supported, then ASSERT().\r
1758 If StartBit is greater than 15, then ASSERT().\r
1759 If EndBit is greater than 15, then ASSERT().\r
1760 If EndBit is less than StartBit, then ASSERT().\r
94952554 1761 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
fe69ac84 1762\r
1763 @param[in] Address The MMIO register to write.\r
1764 @param[in] StartBit The ordinal of the least significant bit in the bit field.\r
1765 Range 0..15.\r
1766 @param[in] EndBit The ordinal of the most significant bit in the bit field.\r
1767 Range 0..15.\r
1768 @param[in] AndData The value to AND with the read value from the MMIO register.\r
1769\r
1770 @return The value written back to the MMIO register.\r
1771\r
1772**/\r
1773UINT16\r
1774EFIAPI\r
1775S3MmioBitFieldAnd16 (\r
1776 IN UINTN Address,\r
1777 IN UINTN StartBit,\r
1778 IN UINTN EndBit,\r
1779 IN UINT16 AndData\r
1780 );\r
1781\r
1782/**\r
1783 Reads a bit field in a 16-bit MMIO register, performs a bitwise AND followed\r
1784 by a bitwise OR, writes the result back to the bit field in the\r
1785 16-bit MMIO register, and saves the value in the S3 script to be replayed\r
1786 on S3 resume.\r
1787\r
1788 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND\r
1789 followed by a bitwise OR between the read result and the value\r
1790 specified by AndData, and writes the result to the 16-bit MMIO register\r
1791 specified by Address. The value written to the MMIO register is returned.\r
1792 This function must guarantee that all MMIO read and write operations are\r
1793 serialized. Extra left bits in both AndData and OrData are stripped.\r
1794\r
1795 If 16-bit MMIO register operations are not supported, then ASSERT().\r
1796 If StartBit is greater than 15, then ASSERT().\r
1797 If EndBit is greater than 15, then ASSERT().\r
1798 If EndBit is less than StartBit, then ASSERT().\r
94952554
LG
1799 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
1800 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
fe69ac84 1801\r
1802 @param[in] Address The MMIO register to write.\r
1803 @param[in] StartBit The ordinal of the least significant bit in the bit field.\r
1804 Range 0..15.\r
1805 @param[in] EndBit The ordinal of the most significant bit in the bit field.\r
1806 Range 0..15.\r
1807 @param[in] AndData The value to AND with the read value from the MMIO register.\r
1808 @param[in] OrData The value to OR with the result of the AND operation.\r
1809\r
1810 @return The value written back to the MMIO register.\r
1811\r
1812**/\r
1813UINT16\r
1814EFIAPI\r
1815S3MmioBitFieldAndThenOr16 (\r
1816 IN UINTN Address,\r
1817 IN UINTN StartBit,\r
1818 IN UINTN EndBit,\r
1819 IN UINT16 AndData,\r
1820 IN UINT16 OrData\r
1821 );\r
1822\r
1823/**\r
9095d37b 1824 Reads a 32-bit MMIO register saves the value in the S3 script to be\r
fe69ac84 1825 replayed on S3 resume.\r
1826\r
1827 Reads the 32-bit MMIO register specified by Address. The 32-bit read value is\r
1828 returned. This function must guarantee that all MMIO read and write\r
1829 operations are serialized.\r
1830\r
1831 If 32-bit MMIO register operations are not supported, then ASSERT().\r
1832\r
1833 @param[in] Address The MMIO register to read.\r
1834\r
1835 @return The value read.\r
1836\r
1837**/\r
1838UINT32\r
1839EFIAPI\r
1840S3MmioRead32 (\r
1841 IN UINTN Address\r
1842 );\r
1843\r
1844/**\r
9095d37b 1845 Writes a 32-bit MMIO register, and saves the value in the S3 script to be\r
fe69ac84 1846 replayed on S3 resume.\r
1847\r
1848 Writes the 32-bit MMIO register specified by Address with the value specified\r
1849 by Value and returns Value. This function must guarantee that all MMIO read\r
1850 and write operations are serialized.\r
1851\r
1852 If 32-bit MMIO register operations are not supported, then ASSERT().\r
1853\r
1854 @param[in] Address The MMIO register to write.\r
1855 @param[in] Value The value to write to the MMIO register.\r
1856\r
1857 @return The value written the MMIO register.\r
1858\r
1859**/\r
1860UINT32\r
1861EFIAPI\r
1862S3MmioWrite32 (\r
1863 IN UINTN Address,\r
1864 IN UINT32 Value\r
1865 );\r
1866\r
1867/**\r
1868 Reads a 32-bit MMIO register, performs a bitwise OR, writes the\r
9095d37b 1869 result back to the 32-bit MMIO register, and saves the value in the S3 script\r
fe69ac84 1870 to be replayed on S3 resume.\r
1871\r
1872 Reads the 32-bit MMIO register specified by Address, performs a bitwise\r
1873 inclusive OR between the read result and the value specified by OrData, and\r
1874 writes the result to the 32-bit MMIO register specified by Address. The value\r
1875 written to the MMIO register is returned. This function must guarantee that\r
1876 all MMIO read and write operations are serialized.\r
1877\r
1878 If 32-bit MMIO register operations are not supported, then ASSERT().\r
1879\r
1880 @param[in] Address The MMIO register to write.\r
1881 @param[in] OrData The value to OR with the read value from the MMIO register.\r
1882\r
1883 @return The value written back to the MMIO register.\r
1884\r
1885**/\r
1886UINT32\r
1887EFIAPI\r
1888S3MmioOr32 (\r
1889 IN UINTN Address,\r
1890 IN UINT32 OrData\r
1891 );\r
1892\r
1893/**\r
1894 Reads a 32-bit MMIO register, performs a bitwise AND, writes the result\r
9095d37b 1895 back to the 32-bit MMIO register, and saves the value in the S3 script to be\r
fe69ac84 1896 replayed on S3 resume.\r
1897\r
1898 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND\r
1899 between the read result and the value specified by AndData, and writes the\r
1900 result to the 32-bit MMIO register specified by Address. The value written to\r
1901 the MMIO register is returned. This function must guarantee that all MMIO\r
1902 read and write operations are serialized.\r
1903\r
1904 If 32-bit MMIO register operations are not supported, then ASSERT().\r
1905\r
1906 @param[in] Address The MMIO register to write.\r
1907 @param[in] AndData The value to AND with the read value from the MMIO register.\r
1908\r
1909 @return The value written back to the MMIO register.\r
1910\r
1911**/\r
1912UINT32\r
1913EFIAPI\r
1914S3MmioAnd32 (\r
1915 IN UINTN Address,\r
1916 IN UINT32 AndData\r
1917 );\r
1918\r
1919/**\r
1920 Reads a 32-bit MMIO register, performs a bitwise AND followed by a bitwise\r
9095d37b 1921 inclusive OR, writes the result back to the 32-bit MMIO register, and\r
fe69ac84 1922 saves the value in the S3 script to be replayed on S3 resume.\r
1923\r
1924 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND\r
1925 between the read result and the value specified by AndData, performs a\r
1926 bitwise OR between the result of the AND operation and the value specified by\r
1927 OrData, and writes the result to the 32-bit MMIO register specified by\r
1928 Address. The value written to the MMIO register is returned. This function\r
1929 must guarantee that all MMIO read and write operations are serialized.\r
1930\r
1931 If 32-bit MMIO register operations are not supported, then ASSERT().\r
1932\r
1933 @param[in] Address The MMIO register to write.\r
1934 @param[in] AndData The value to AND with the read value from the MMIO register.\r
1935 @param[in] OrData The value to OR with the result of the AND operation.\r
1936\r
1937 @return The value written back to the MMIO register.\r
1938\r
1939**/\r
1940UINT32\r
1941EFIAPI\r
1942S3MmioAndThenOr32 (\r
2f88bd3a
MK
1943 IN UINTN Address,\r
1944 IN UINT32 AndData,\r
1945 IN UINT32 OrData\r
fe69ac84 1946 );\r
1947\r
1948/**\r
9095d37b 1949 Reads a bit field of a MMIO register, and saves the value in the S3 script\r
fe69ac84 1950 to be replayed on S3 resume.\r
1951\r
1952 Reads the bit field in a 32-bit MMIO register. The bit field is specified by\r
1953 the StartBit and the EndBit. The value of the bit field is returned.\r
1954\r
1955 If 32-bit MMIO register operations are not supported, then ASSERT().\r
1956 If StartBit is greater than 31, then ASSERT().\r
1957 If EndBit is greater than 31, then ASSERT().\r
1958 If EndBit is less than StartBit, then ASSERT().\r
1959\r
1960 @param[in] Address MMIO register to read.\r
1961 @param[in] StartBit The ordinal of the least significant bit in the bit field.\r
1962 Range 0..31.\r
1963 @param[in] EndBit The ordinal of the most significant bit in the bit field.\r
1964 Range 0..31.\r
1965\r
1966 @return The value read.\r
1967\r
1968**/\r
1969UINT32\r
1970EFIAPI\r
1971S3MmioBitFieldRead32 (\r
1972 IN UINTN Address,\r
1973 IN UINTN StartBit,\r
1974 IN UINTN EndBit\r
1975 );\r
1976\r
1977/**\r
9095d37b 1978 Writes a bit field to a MMIO register, and saves the value in the S3 script\r
fe69ac84 1979 to be replayed on S3 resume.\r
1980\r
1981 Writes Value to the bit field of the MMIO register. The bit field is\r
1982 specified by the StartBit and the EndBit. All other bits in the destination\r
1983 MMIO register are preserved. The new value of the 32-bit register is returned.\r
1984\r
1985 If 32-bit MMIO register operations are not supported, then ASSERT().\r
1986 If StartBit is greater than 31, then ASSERT().\r
1987 If EndBit is greater than 31, then ASSERT().\r
1988 If EndBit is less than StartBit, then ASSERT().\r
94952554 1989 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
fe69ac84 1990\r
1991 @param[in] Address The MMIO register to write.\r
1992 @param[in] StartBit The ordinal of the least significant bit in the bit field.\r
1993 Range 0..31.\r
1994 @param[in] EndBit The ordinal of the most significant bit in the bit field.\r
1995 Range 0..31.\r
1996 @param[in] Value New value of the bit field.\r
1997\r
1998 @return The value written back to the MMIO register.\r
1999\r
2000**/\r
2001UINT32\r
2002EFIAPI\r
2003S3MmioBitFieldWrite32 (\r
2004 IN UINTN Address,\r
2005 IN UINTN StartBit,\r
2006 IN UINTN EndBit,\r
2007 IN UINT32 Value\r
2008 );\r
2009\r
2010/**\r
9095d37b
LG
2011 Reads a bit field in a 32-bit MMIO register, performs a bitwise OR,\r
2012 writes the result back to the bit field in the 32-bit MMIO register, and\r
fe69ac84 2013 saves the value in the S3 script to be replayed on S3 resume.\r
2014\r
2015 Reads the 32-bit MMIO register specified by Address, performs a bitwise\r
2016 inclusive OR between the read result and the value specified by OrData, and\r
2017 writes the result to the 32-bit MMIO register specified by Address. The value\r
2018 written to the MMIO register is returned. This function must guarantee that\r
2019 all MMIO read and write operations are serialized. Extra left bits in OrData\r
2020 are stripped.\r
2021\r
2022 If 32-bit MMIO register operations are not supported, then ASSERT().\r
2023 If StartBit is greater than 31, then ASSERT().\r
2024 If EndBit is greater than 31, then ASSERT().\r
2025 If EndBit is less than StartBit, then ASSERT().\r
94952554 2026 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
fe69ac84 2027\r
2028 @param[in] Address The MMIO register to write.\r
2029 @param[in] StartBit The ordinal of the least significant bit in the bit field.\r
2030 Range 0..31.\r
2031 @param[in] EndBit The ordinal of the most significant bit in the bit field.\r
2032 Range 0..31.\r
2033 @param[in] OrData The value to OR with the read value from the MMIO register.\r
2034\r
2035 @return The value written back to the MMIO register.\r
2036\r
2037**/\r
2038UINT32\r
2039EFIAPI\r
2040S3MmioBitFieldOr32 (\r
2041 IN UINTN Address,\r
2042 IN UINTN StartBit,\r
2043 IN UINTN EndBit,\r
2044 IN UINT32 OrData\r
2045 );\r
2046\r
2047/**\r
2048 Reads a bit field in a 32-bit MMIO register, performs a bitwise AND, and\r
9095d37b 2049 writes the result back to the bit field in the 32-bit MMIO register and\r
fe69ac84 2050 saves the value in the S3 script to be replayed on S3 resume.\r
2051\r
2052 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND\r
2053 between the read result and the value specified by AndData, and writes the\r
2054 result to the 32-bit MMIO register specified by Address. The value written to\r
2055 the MMIO register is returned. This function must guarantee that all MMIO\r
2056 read and write operations are serialized. Extra left bits in AndData are\r
2057 stripped.\r
2058\r
2059 If 32-bit MMIO register operations are not supported, then ASSERT().\r
2060 If StartBit is greater than 31, then ASSERT().\r
2061 If EndBit is greater than 31, then ASSERT().\r
2062 If EndBit is less than StartBit, then ASSERT().\r
94952554 2063 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
fe69ac84 2064\r
2065 @param[in] Address The MMIO register to write.\r
2066 @param[in] StartBit The ordinal of the least significant bit in the bit field.\r
2067 Range 0..31.\r
2068 @param[in] EndBit The ordinal of the most significant bit in the bit field.\r
2069 Range 0..31.\r
2070 @param[in] AndData The value to AND with the read value from the MMIO register.\r
2071\r
2072 @return The value written back to the MMIO register.\r
2073\r
2074**/\r
2075UINT32\r
2076EFIAPI\r
2077S3MmioBitFieldAnd32 (\r
2078 IN UINTN Address,\r
2079 IN UINTN StartBit,\r
2080 IN UINTN EndBit,\r
2081 IN UINT32 AndData\r
2082 );\r
2083\r
2084/**\r
2085 Reads a bit field in a 32-bit MMIO register, performs a bitwise AND followed\r
2086 by a bitwise OR, writes the result back to the bit field in the\r
2087 32-bit MMIO register, and saves the value in the S3 script to be replayed\r
2088 on S3 resume.\r
2089\r
2090 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND\r
2091 followed by a bitwise OR between the read result and the value\r
2092 specified by AndData, and writes the result to the 32-bit MMIO register\r
2093 specified by Address. The value written to the MMIO register is returned.\r
2094 This function must guarantee that all MMIO read and write operations are\r
2095 serialized. Extra left bits in both AndData and OrData are stripped.\r
2096\r
2097 If 32-bit MMIO register operations are not supported, then ASSERT().\r
2098 If StartBit is greater than 31, then ASSERT().\r
2099 If EndBit is greater than 31, then ASSERT().\r
2100 If EndBit is less than StartBit, then ASSERT().\r
94952554
LG
2101 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
2102 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
fe69ac84 2103\r
2104 @param[in] Address The MMIO register to write.\r
2105 @param[in] StartBit The ordinal of the least significant bit in the bit field.\r
2106 Range 0..31.\r
2107 @param[in] EndBit The ordinal of the most significant bit in the bit field.\r
2108 Range 0..31.\r
2109 @param[in] AndData The value to AND with the read value from the MMIO register.\r
2110 @param[in] OrData The value to OR with the result of the AND operation.\r
2111\r
2112 @return The value written back to the MMIO register.\r
2113\r
2114**/\r
2115UINT32\r
2116EFIAPI\r
2117S3MmioBitFieldAndThenOr32 (\r
2118 IN UINTN Address,\r
2119 IN UINTN StartBit,\r
2120 IN UINTN EndBit,\r
2121 IN UINT32 AndData,\r
2122 IN UINT32 OrData\r
2123 );\r
2124\r
2125/**\r
9095d37b 2126 Reads a 64-bit MMIO register, and saves the value in the S3 script to be\r
fe69ac84 2127 replayed on S3 resume.\r
2128\r
2129 Reads the 64-bit MMIO register specified by Address. The 64-bit read value is\r
2130 returned. This function must guarantee that all MMIO read and write\r
2131 operations are serialized.\r
2132\r
2133 If 64-bit MMIO register operations are not supported, then ASSERT().\r
2134\r
2135 @param[in] Address The MMIO register to read.\r
2136\r
2137 @return The value read.\r
2138\r
2139**/\r
2140UINT64\r
2141EFIAPI\r
2142S3MmioRead64 (\r
2143 IN UINTN Address\r
2144 );\r
2145\r
2146/**\r
9095d37b 2147 Writes a 64-bit MMIO register, and saves the value in the S3 script to be\r
fe69ac84 2148 replayed on S3 resume.\r
2149\r
2150 Writes the 64-bit MMIO register specified by Address with the value specified\r
2151 by Value and returns Value. This function must guarantee that all MMIO read\r
2152 and write operations are serialized.\r
2153\r
2154 If 64-bit MMIO register operations are not supported, then ASSERT().\r
2155\r
2156 @param[in] Address The MMIO register to write.\r
2157 @param[in] Value The value to write to the MMIO register.\r
2158\r
2159 @return The value written the MMIO register.\r
2160\r
2161**/\r
2162UINT64\r
2163EFIAPI\r
2164S3MmioWrite64 (\r
2165 IN UINTN Address,\r
2166 IN UINT64 Value\r
2167 );\r
2168\r
2169/**\r
2170 Reads a 64-bit MMIO register, performs a bitwise OR, writes the\r
9095d37b 2171 result back to the 64-bit MMIO register, and saves the value in the S3 script\r
fe69ac84 2172 to be replayed on S3 resume.\r
2173\r
2174 Reads the 64-bit MMIO register specified by Address, performs a bitwise\r
2175 inclusive OR between the read result and the value specified by OrData, and\r
2176 writes the result to the 64-bit MMIO register specified by Address. The value\r
2177 written to the MMIO register is returned. This function must guarantee that\r
2178 all MMIO read and write operations are serialized.\r
2179\r
2180 If 64-bit MMIO register operations are not supported, then ASSERT().\r
2181\r
2182 @param[in] Address The MMIO register to write.\r
2183 @param[in] OrData The value to OR with the read value from the MMIO register.\r
2184\r
2185 @return The value written back to the MMIO register.\r
2186\r
2187**/\r
2188UINT64\r
2189EFIAPI\r
2190S3MmioOr64 (\r
2191 IN UINTN Address,\r
2192 IN UINT64 OrData\r
2193 );\r
2194\r
2195/**\r
2196 Reads a 64-bit MMIO register, performs a bitwise AND, writes the result\r
9095d37b 2197 back to the 64-bit MMIO register, and saves the value in the S3 script to be\r
fe69ac84 2198 replayed on S3 resume.\r
2199\r
2200 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND\r
2201 between the read result and the value specified by AndData, and writes the\r
2202 result to the 64-bit MMIO register specified by Address. The value written to\r
2203 the MMIO register is returned. This function must guarantee that all MMIO\r
2204 read and write operations are serialized.\r
2205\r
2206 If 64-bit MMIO register operations are not supported, then ASSERT().\r
2207\r
2208 @param[in] Address The MMIO register to write.\r
2209 @param[in] AndData The value to AND with the read value from the MMIO register.\r
2210\r
2211 @return The value written back to the MMIO register.\r
2212\r
2213**/\r
2214UINT64\r
2215EFIAPI\r
2216S3MmioAnd64 (\r
2f88bd3a
MK
2217 IN UINTN Address,\r
2218 IN UINT64 AndData\r
fe69ac84 2219 );\r
2220\r
2221/**\r
2222 Reads a 64-bit MMIO register, performs a bitwise AND followed by a bitwise\r
9095d37b 2223 inclusive OR, writes the result back to the 64-bit MMIO register, and\r
fe69ac84 2224 saves the value in the S3 script to be replayed on S3 resume.\r
2225\r
2226 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND\r
2227 between the read result and the value specified by AndData, performs a\r
2228 bitwise OR between the result of the AND operation and the value specified by\r
2229 OrData, and writes the result to the 64-bit MMIO register specified by\r
2230 Address. The value written to the MMIO register is returned. This function\r
2231 must guarantee that all MMIO read and write operations are serialized.\r
2232\r
2233 If 64-bit MMIO register operations are not supported, then ASSERT().\r
2234\r
2235 @param[in] Address The MMIO register to write.\r
2236 @param[in] AndData The value to AND with the read value from the MMIO register.\r
2237 @param[in] OrData The value to OR with the result of the AND operation.\r
2238\r
2239 @return The value written back to the MMIO register.\r
2240\r
2241**/\r
2242UINT64\r
2243EFIAPI\r
2244S3MmioAndThenOr64 (\r
2245 IN UINTN Address,\r
2246 IN UINT64 AndData,\r
2247 IN UINT64 OrData\r
2248 );\r
2249\r
2250/**\r
2251 Reads a bit field of a MMIO register saves the value in the S3 script to\r
2252 be replayed on S3 resume.\r
2253\r
2254 Reads the bit field in a 64-bit MMIO register. The bit field is specified by\r
2255 the StartBit and the EndBit. The value of the bit field is returned.\r
2256\r
2257 If 64-bit MMIO register operations are not supported, then ASSERT().\r
2258 If StartBit is greater than 63, then ASSERT().\r
2259 If EndBit is greater than 63, then ASSERT().\r
2260 If EndBit is less than StartBit, then ASSERT().\r
2261\r
2262 @param[in] Address MMIO register to read.\r
2263 @param[in] StartBit The ordinal of the least significant bit in the bit field.\r
2264 Range 0..63.\r
2265 @param[in] EndBit The ordinal of the most significant bit in the bit field.\r
2266 Range 0..63.\r
2267\r
2268 @return The value read.\r
2269\r
2270**/\r
2271UINT64\r
2272EFIAPI\r
2273S3MmioBitFieldRead64 (\r
2274 IN UINTN Address,\r
2275 IN UINTN StartBit,\r
2276 IN UINTN EndBit\r
2277 );\r
2278\r
2279/**\r
2280 Writes a bit field to a MMIO register, and saves the value in the S3 script to\r
2281 be replayed on S3 resume.\r
2282\r
2283 Writes Value to the bit field of the MMIO register. The bit field is\r
2284 specified by the StartBit and the EndBit. All other bits in the destination\r
2285 MMIO register are preserved. The new value of the 64-bit register is returned.\r
2286\r
2287 If 64-bit MMIO register operations are not supported, then ASSERT().\r
2288 If StartBit is greater than 63, then ASSERT().\r
2289 If EndBit is greater than 63, then ASSERT().\r
2290 If EndBit is less than StartBit, then ASSERT().\r
94952554 2291 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
fe69ac84 2292\r
2293 @param[in] Address The MMIO register to write.\r
2294 @param[in] StartBit The ordinal of the least significant bit in the bit field.\r
2295 Range 0..63.\r
2296 @param[in] EndBit The ordinal of the most significant bit in the bit field.\r
2297 Range 0..63.\r
2298 @param[in] Value New value of the bit field.\r
2299\r
2300 @return The value written back to the MMIO register.\r
2301\r
2302**/\r
2303UINT64\r
2304EFIAPI\r
2305S3MmioBitFieldWrite64 (\r
2306 IN UINTN Address,\r
2307 IN UINTN StartBit,\r
2308 IN UINTN EndBit,\r
2309 IN UINT64 Value\r
2310 );\r
2311\r
2312/**\r
9095d37b
LG
2313 Reads a bit field in a 64-bit MMIO register, performs a bitwise OR,\r
2314 writes the result back to the bit field in the 64-bit MMIO register, and\r
fe69ac84 2315 saves the value in the S3 script to be replayed on S3 resume.\r
2316\r
2317 Reads the 64-bit MMIO register specified by Address, performs a bitwise\r
2318 inclusive OR between the read result and the value specified by OrData, and\r
2319 writes the result to the 64-bit MMIO register specified by Address. The value\r
2320 written to the MMIO register is returned. This function must guarantee that\r
2321 all MMIO read and write operations are serialized. Extra left bits in OrData\r
2322 are stripped.\r
2323\r
2324 If 64-bit MMIO register operations are not supported, then ASSERT().\r
2325 If StartBit is greater than 63, then ASSERT().\r
2326 If EndBit is greater than 63, then ASSERT().\r
2327 If EndBit is less than StartBit, then ASSERT().\r
94952554 2328 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
fe69ac84 2329\r
2330 @param[in] Address The MMIO register to write.\r
2331 @param[in] StartBit The ordinal of the least significant bit in the bit field.\r
2332 Range 0..63.\r
2333 @param[in] EndBit The ordinal of the most significant bit in the bit field.\r
2334 Range 0..63.\r
2335 @param[in] OrData The value to OR with the read value from the MMIO register.\r
2336\r
2337 @return The value written back to the MMIO register.\r
2338\r
2339**/\r
2340UINT64\r
2341EFIAPI\r
2342S3MmioBitFieldOr64 (\r
2343 IN UINTN Address,\r
2344 IN UINTN StartBit,\r
2345 IN UINTN EndBit,\r
2346 IN UINT64 OrData\r
2347 );\r
2348\r
2349/**\r
2350 Reads a bit field in a 64-bit MMIO register, performs a bitwise AND, and\r
2351 writes the result back to the bit field in the 64-bit MMIO register, and saves\r
2352 the value in the S3 script to be replayed on S3 resume.\r
2353\r
2354 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND\r
2355 between the read result and the value specified by AndData, and writes the\r
2356 result to the 64-bit MMIO register specified by Address. The value written to\r
2357 the MMIO register is returned. This function must guarantee that all MMIO\r
2358 read and write operations are serialized. Extra left bits in AndData are\r
2359 stripped.\r
2360\r
2361 If 64-bit MMIO register operations are not supported, then ASSERT().\r
2362 If StartBit is greater than 63, then ASSERT().\r
2363 If EndBit is greater than 63, then ASSERT().\r
2364 If EndBit is less than StartBit, then ASSERT().\r
94952554 2365 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
fe69ac84 2366\r
2367 @param[in] Address The MMIO register to write.\r
2368 @param[in] StartBit The ordinal of the least significant bit in the bit field.\r
2369 Range 0..63.\r
2370 @param[in] EndBit The ordinal of the most significant bit in the bit field.\r
2371 Range 0..63.\r
2372 @param[in] AndData The value to AND with the read value from the MMIO register.\r
2373\r
2374 @return The value written back to the MMIO register.\r
2375\r
2376**/\r
2377UINT64\r
2378EFIAPI\r
2379S3MmioBitFieldAnd64 (\r
2f88bd3a
MK
2380 IN UINTN Address,\r
2381 IN UINTN StartBit,\r
2382 IN UINTN EndBit,\r
2383 IN UINT64 AndData\r
fe69ac84 2384 );\r
2385\r
2386/**\r
2387 Reads a bit field in a 64-bit MMIO register, performs a bitwise AND followed\r
2388 by a bitwise OR, writes the result back to the bit field in the\r
2389 64-bit MMIO register, and saves the value in the S3 script to be replayed\r
2390 on S3 resume.\r
2391\r
2392 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND\r
2393 followed by a bitwise OR between the read result and the value\r
2394 specified by AndData, and writes the result to the 64-bit MMIO register\r
2395 specified by Address. The value written to the MMIO register is returned.\r
2396 This function must guarantee that all MMIO read and write operations are\r
2397 serialized. Extra left bits in both AndData and OrData are stripped.\r
2398\r
2399 If 64-bit MMIO register operations are not supported, then ASSERT().\r
2400 If StartBit is greater than 63, then ASSERT().\r
2401 If EndBit is greater than 63, then ASSERT().\r
2402 If EndBit is less than StartBit, then ASSERT().\r
94952554
LG
2403 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
2404 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
fe69ac84 2405\r
2406 @param[in] Address The MMIO register to write.\r
2407 @param[in] StartBit The ordinal of the least significant bit in the bit field.\r
2408 Range 0..63.\r
2409 @param[in] EndBit The ordinal of the most significant bit in the bit field.\r
2410 Range 0..63.\r
2411 @param[in] AndData The value to AND with the read value from the MMIO register.\r
2412 @param[in] OrData The value to OR with the result of the AND operation.\r
2413\r
2414 @return The value written back to the MMIO register.\r
2415\r
2416**/\r
2417UINT64\r
2418EFIAPI\r
2419S3MmioBitFieldAndThenOr64 (\r
2420 IN UINTN Address,\r
2421 IN UINTN StartBit,\r
2422 IN UINTN EndBit,\r
2423 IN UINT64 AndData,\r
2424 IN UINT64 OrData\r
2425 );\r
2426\r
2427/**\r
2428 Copies data from MMIO region to system memory by using 8-bit access,\r
2429 and saves the value in the S3 script to be replayed on S3 resume.\r
2430\r
9095d37b
LG
2431 Copy data from MMIO region specified by starting address StartAddress\r
2432 to system memory specified by Buffer by using 8-bit access. The total\r
fe69ac84 2433 number of bytes to be copied is specified by Length. Buffer is returned.\r
9095d37b
LG
2434\r
2435 If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().\r
fe69ac84 2436 If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
2437\r
2438\r
2439 @param[in] StartAddress Starting address for the MMIO region to be copied from.\r
2440 @param[in] Length Size in bytes of the copy.\r
2441 @param[out] Buffer Pointer to a system memory buffer receiving the data read.\r
2442\r
2443 @return Buffer.\r
2444\r
2445**/\r
2446UINT8 *\r
2447EFIAPI\r
2448S3MmioReadBuffer8 (\r
2449 IN UINTN StartAddress,\r
2450 IN UINTN Length,\r
2451 OUT UINT8 *Buffer\r
2452 );\r
2453\r
2454/**\r
2455 Copies data from MMIO region to system memory by using 16-bit access,\r
2456 and saves the value in the S3 script to be replayed on S3 resume.\r
2457\r
9095d37b
LG
2458 Copy data from MMIO region specified by starting address StartAddress\r
2459 to system memory specified by Buffer by using 16-bit access. The total\r
fe69ac84 2460 number of bytes to be copied is specified by Length. Buffer is returned.\r
9095d37b 2461\r
fe69ac84 2462 If StartAddress is not aligned on a 16-bit boundary, then ASSERT().\r
2463\r
9095d37b 2464 If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().\r
fe69ac84 2465 If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
2466\r
2467 If Length is not aligned on a 16-bit boundary, then ASSERT().\r
2468 If Buffer is not aligned on a 16-bit boundary, then ASSERT().\r
2469\r
2470 @param[in] StartAddress Starting address for the MMIO region to be copied from.\r
2471 @param[in] Length Size in bytes of the copy.\r
2472 @param[out] Buffer Pointer to a system memory buffer receiving the data read.\r
2473\r
2474 @return Buffer.\r
2475\r
2476**/\r
2477UINT16 *\r
2478EFIAPI\r
2479S3MmioReadBuffer16 (\r
2480 IN UINTN StartAddress,\r
2481 IN UINTN Length,\r
2482 OUT UINT16 *Buffer\r
2483 );\r
2484\r
2485/**\r
2486 Copies data from MMIO region to system memory by using 32-bit access,\r
2487 and saves the value in the S3 script to be replayed on S3 resume.\r
2488\r
9095d37b
LG
2489 Copy data from MMIO region specified by starting address StartAddress\r
2490 to system memory specified by Buffer by using 32-bit access. The total\r
fe69ac84 2491 number of byte to be copied is specified by Length. Buffer is returned.\r
9095d37b 2492\r
fe69ac84 2493 If StartAddress is not aligned on a 32-bit boundary, then ASSERT().\r
2494\r
9095d37b 2495 If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().\r
fe69ac84 2496 If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
2497\r
2498 If Length is not aligned on a 32-bit boundary, then ASSERT().\r
2499 If Buffer is not aligned on a 32-bit boundary, then ASSERT().\r
2500\r
2501 @param[in] StartAddress Starting address for the MMIO region to be copied from.\r
2502 @param[in] Length Size in bytes of the copy.\r
2503 @param[out] Buffer Pointer to a system memory buffer receiving the data read.\r
2504\r
2505 @return Buffer.\r
2506\r
2507**/\r
2508UINT32 *\r
2509EFIAPI\r
2510S3MmioReadBuffer32 (\r
2511 IN UINTN StartAddress,\r
2512 IN UINTN Length,\r
2513 OUT UINT32 *Buffer\r
2514 );\r
2515\r
2516/**\r
2517 Copies data from MMIO region to system memory by using 64-bit access,\r
2518 and saves the value in the S3 script to be replayed on S3 resume.\r
2519\r
9095d37b
LG
2520 Copy data from MMIO region specified by starting address StartAddress\r
2521 to system memory specified by Buffer by using 64-bit access. The total\r
fe69ac84 2522 number of byte to be copied is specified by Length. Buffer is returned.\r
9095d37b 2523\r
fe69ac84 2524 If StartAddress is not aligned on a 64-bit boundary, then ASSERT().\r
2525\r
9095d37b 2526 If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().\r
fe69ac84 2527 If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
2528\r
2529 If Length is not aligned on a 64-bit boundary, then ASSERT().\r
2530 If Buffer is not aligned on a 64-bit boundary, then ASSERT().\r
2531\r
2532 @param[in] StartAddress Starting address for the MMIO region to be copied from.\r
2533 @param[in] Length Size in bytes of the copy.\r
2534 @param[out] Buffer Pointer to a system memory buffer receiving the data read.\r
2535\r
2536 @return Buffer.\r
2537\r
2538**/\r
2539UINT64 *\r
2540EFIAPI\r
2541S3MmioReadBuffer64 (\r
2f88bd3a
MK
2542 IN UINTN StartAddress,\r
2543 IN UINTN Length,\r
2544 OUT UINT64 *Buffer\r
fe69ac84 2545 );\r
2546\r
2547/**\r
2548 Copies data from system memory to MMIO region by using 8-bit access,\r
2549 and saves the value in the S3 script to be replayed on S3 resume.\r
2550\r
9095d37b
LG
2551 Copy data from system memory specified by Buffer to MMIO region specified\r
2552 by starting address StartAddress by using 8-bit access. The total number\r
fe69ac84 2553 of byte to be copied is specified by Length. Buffer is returned.\r
9095d37b
LG
2554\r
2555 If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().\r
fe69ac84 2556 If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT().\r
2557\r
2558\r
2559 @param[in] StartAddress Starting address for the MMIO region to be copied to.\r
2560 @param[in] Length Size in bytes of the copy.\r
2561 @param[in] Buffer Pointer to a system memory buffer containing the data to write.\r
2562\r
2563 @return Buffer.\r
2564\r
2565**/\r
2566UINT8 *\r
2567EFIAPI\r
2568S3MmioWriteBuffer8 (\r
2f88bd3a
MK
2569 IN UINTN StartAddress,\r
2570 IN UINTN Length,\r
2571 IN CONST UINT8 *Buffer\r
fe69ac84 2572 );\r
2573\r
2574/**\r
2575 Copies data from system memory to MMIO region by using 16-bit access,\r
2576 and saves the value in the S3 script to be replayed on S3 resume.\r
2577\r
9095d37b
LG
2578 Copy data from system memory specified by Buffer to MMIO region specified\r
2579 by starting address StartAddress by using 16-bit access. The total number\r
fe69ac84 2580 of bytes to be copied is specified by Length. Buffer is returned.\r
9095d37b 2581\r
fe69ac84 2582 If StartAddress is not aligned on a 16-bit boundary, then ASSERT().\r
2583\r
9095d37b 2584 If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().\r
fe69ac84 2585 If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT().\r
2586\r
2587 If Length is not aligned on a 16-bit boundary, then ASSERT().\r
2588\r
2589 If Buffer is not aligned on a 16-bit boundary, then ASSERT().\r
2590\r
2591 @param[in] StartAddress Starting address for the MMIO region to be copied to.\r
2592 @param[in] Length Size in bytes of the copy.\r
2593 @param[in] Buffer Pointer to a system memory buffer containing the data to write.\r
2594\r
2595 @return Buffer.\r
2596\r
2597**/\r
2598UINT16 *\r
2599EFIAPI\r
2600S3MmioWriteBuffer16 (\r
2601 IN UINTN StartAddress,\r
2602 IN UINTN Length,\r
2603 IN CONST UINT16 *Buffer\r
2604 );\r
2605\r
2606/**\r
2607 Copies data from system memory to MMIO region by using 32-bit access,\r
2608 and saves the value in the S3 script to be replayed on S3 resume.\r
2609\r
9095d37b
LG
2610 Copy data from system memory specified by Buffer to MMIO region specified\r
2611 by starting address StartAddress by using 32-bit access. The total number\r
fe69ac84 2612 of bytes to be copied is specified by Length. Buffer is returned.\r
9095d37b 2613\r
fe69ac84 2614 If StartAddress is not aligned on a 32-bit boundary, then ASSERT().\r
2615\r
9095d37b 2616 If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().\r
fe69ac84 2617 If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT().\r
2618\r
2619 If Length is not aligned on a 32-bit boundary, then ASSERT().\r
2620\r
2621 If Buffer is not aligned on a 32-bit boundary, then ASSERT().\r
2622\r
2623 @param[in] StartAddress Starting address for the MMIO region to be copied to.\r
2624 @param[in] Length Size in bytes of the copy.\r
2625 @param[in] Buffer Pointer to a system memory buffer containing the data to write.\r
2626\r
2627 @return Buffer.\r
2628\r
2629**/\r
2630UINT32 *\r
2631EFIAPI\r
2632S3MmioWriteBuffer32 (\r
2633 IN UINTN StartAddress,\r
2634 IN UINTN Length,\r
2635 IN CONST UINT32 *Buffer\r
2636 );\r
2637\r
2638/**\r
9095d37b 2639 Copies data from system memory to MMIO region by using 64-bit access,\r
fe69ac84 2640 and saves the value in the S3 script to be replayed on S3 resume.\r
2641\r
9095d37b
LG
2642 Copy data from system memory specified by Buffer to MMIO region specified\r
2643 by starting address StartAddress by using 64-bit access. The total number\r
fe69ac84 2644 of bytes to be copied is specified by Length. Buffer is returned.\r
9095d37b 2645\r
fe69ac84 2646 If StartAddress is not aligned on a 64-bit boundary, then ASSERT().\r
2647\r
9095d37b 2648 If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().\r
fe69ac84 2649 If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT().\r
2650\r
2651 If Length is not aligned on a 64-bit boundary, then ASSERT().\r
2652\r
2653 If Buffer is not aligned on a 64-bit boundary, then ASSERT().\r
2654\r
2655 @param[in] StartAddress Starting address for the MMIO region to be copied to.\r
2656 @param[in] Length Size in bytes of the copy.\r
2657 @param[in] Buffer Pointer to a system memory buffer containing the data to write.\r
2658\r
2659 @return Buffer.\r
2660\r
2661**/\r
2662UINT64 *\r
2663EFIAPI\r
2664S3MmioWriteBuffer64 (\r
2665 IN UINTN StartAddress,\r
2666 IN UINTN Length,\r
2667 IN CONST UINT64 *Buffer\r
2668 );\r
2669\r
2670#endif\r