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