VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BaseIoLibIntrinsic/IoLibFifoCc.c@ 105670

Last change on this file since 105670 was 105670, checked in by vboxsync, 4 months ago

Devices/EFI/FirmwareNew: Merge edk2-stable-202405 and make it build on aarch64, bugref:4643

  • Property svn:eol-style set to native
File size: 5.2 KB
Line 
1/** @file
2 IoFifo read/write routines.
3
4 Copyright (c) 2021 - 2023, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7**/
8
9#include "BaseIoLibIntrinsicInternal.h"
10#include "IoLibSev.h"
11#include "IoLibTdx.h"
12#include <Uefi/UefiBaseType.h>
13#include <Library/TdxLib.h>
14
15/**
16 Reads an 8-bit I/O port fifo into a block of memory.
17
18 Reads the 8-bit I/O fifo port specified by Port.
19 The port is read Count times, and the read data is
20 stored in the provided Buffer.
21
22 This function must guarantee that all I/O read and write operations are
23 serialized.
24
25 If 8-bit I/O port operations are not supported, then ASSERT().
26
27 In TDX a serial of TdIoRead8 is invoked to read the I/O port fifo.
28
29 @param Port The I/O port to read.
30 @param Count The number of times to read I/O port.
31 @param Buffer The buffer to store the read data into.
32
33**/
34VOID
35EFIAPI
36IoReadFifo8 (
37 IN UINTN Port,
38 IN UINTN Count,
39 OUT VOID *Buffer
40 )
41{
42 if (IsTdxGuest ()) {
43 TdIoReadFifo8 (Port, Count, Buffer);
44 } else {
45 SevIoReadFifo8 (Port, Count, Buffer);
46 }
47}
48
49/**
50 Writes a block of memory into an 8-bit I/O port fifo.
51
52 Writes the 8-bit I/O fifo port specified by Port.
53 The port is written Count times, and the write data is
54 retrieved from the provided Buffer.
55
56 This function must guarantee that all I/O write and write operations are
57 serialized.
58
59 If 8-bit I/O port operations are not supported, then ASSERT().
60
61 In TDX a serial of TdIoWrite8 is invoked to write data to the I/O port.
62
63 @param Port The I/O port to write.
64 @param Count The number of times to write I/O port.
65 @param Buffer The buffer to retrieve the write data from.
66
67**/
68VOID
69EFIAPI
70IoWriteFifo8 (
71 IN UINTN Port,
72 IN UINTN Count,
73 IN VOID *Buffer
74 )
75{
76 if (IsTdxGuest ()) {
77 TdIoWriteFifo8 (Port, Count, Buffer);
78 } else {
79 SevIoWriteFifo8 (Port, Count, Buffer);
80 }
81}
82
83/**
84 Reads a 16-bit I/O port fifo into a block of memory.
85
86 Reads the 16-bit I/O fifo port specified by Port.
87 The port is read Count times, and the read data is
88 stored in the provided Buffer.
89
90 This function must guarantee that all I/O read and write operations are
91 serialized.
92
93 If 16-bit I/O port operations are not supported, then ASSERT().
94
95 In TDX a serial of TdIoRead16 is invoked to read data from the I/O port.
96
97 @param Port The I/O port to read.
98 @param Count The number of times to read I/O port.
99 @param Buffer The buffer to store the read data into.
100
101**/
102VOID
103EFIAPI
104IoReadFifo16 (
105 IN UINTN Port,
106 IN UINTN Count,
107 OUT VOID *Buffer
108 )
109{
110 if (IsTdxGuest ()) {
111 TdIoReadFifo16 (Port, Count, Buffer);
112 } else {
113 SevIoReadFifo16 (Port, Count, Buffer);
114 }
115}
116
117/**
118 Writes a block of memory into a 16-bit I/O port fifo.
119
120 Writes the 16-bit I/O fifo port specified by Port.
121 The port is written Count times, and the write data is
122 retrieved from the provided Buffer.
123
124 This function must guarantee that all I/O write and write operations are
125 serialized.
126
127 If 16-bit I/O port operations are not supported, then ASSERT().
128
129 In TDX a serial of TdIoWrite16 is invoked to write data to the I/O port.
130
131 @param Port The I/O port to write.
132 @param Count The number of times to write I/O port.
133 @param Buffer The buffer to retrieve the write data from.
134
135**/
136VOID
137EFIAPI
138IoWriteFifo16 (
139 IN UINTN Port,
140 IN UINTN Count,
141 IN VOID *Buffer
142 )
143{
144 if (IsTdxGuest ()) {
145 TdIoWriteFifo16 (Port, Count, Buffer);
146 } else {
147 SevIoWriteFifo16 (Port, Count, Buffer);
148 }
149}
150
151/**
152 Reads a 32-bit I/O port fifo into a block of memory.
153
154 Reads the 32-bit I/O fifo port specified by Port.
155 The port is read Count times, and the read data is
156 stored in the provided Buffer.
157
158 This function must guarantee that all I/O read and write operations are
159 serialized.
160
161 If 32-bit I/O port operations are not supported, then ASSERT().
162
163 In TDX a serial of TdIoRead32 is invoked to read data from the I/O port.
164
165 @param Port The I/O port to read.
166 @param Count The number of times to read I/O port.
167 @param Buffer The buffer to store the read data into.
168
169**/
170VOID
171EFIAPI
172IoReadFifo32 (
173 IN UINTN Port,
174 IN UINTN Count,
175 OUT VOID *Buffer
176 )
177{
178 if (IsTdxGuest ()) {
179 TdIoReadFifo32 (Port, Count, Buffer);
180 } else {
181 SevIoReadFifo32 (Port, Count, Buffer);
182 }
183}
184
185/**
186 Writes a block of memory into a 32-bit I/O port fifo.
187
188 Writes the 32-bit I/O fifo port specified by Port.
189 The port is written Count times, and the write data is
190 retrieved from the provided Buffer.
191
192 This function must guarantee that all I/O write and write operations are
193 serialized.
194
195 If 32-bit I/O port operations are not supported, then ASSERT().
196
197 In TDX a serial of TdIoWrite32 is invoked to write data to the I/O port.
198
199 @param Port The I/O port to write.
200 @param Count The number of times to write I/O port.
201 @param Buffer The buffer to retrieve the write data from.
202
203**/
204VOID
205EFIAPI
206IoWriteFifo32 (
207 IN UINTN Port,
208 IN UINTN Count,
209 IN VOID *Buffer
210 )
211{
212 if (IsTdxGuest ()) {
213 TdIoWriteFifo32 (Port, Count, Buffer);
214 } else {
215 SevIoWriteFifo32 (Port, Count, Buffer);
216 }
217}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette