VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseIoLibIntrinsic/IoLibFifo.c@ 107675

最後變更 在這個檔案從107675是 105670,由 vboxsync 提交於 8 月 前

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

  • 屬性 svn:eol-style 設為 native
檔案大小: 5.0 KB
 
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 <Uefi/UefiBaseType.h>
11
12/**
13 Reads an 8-bit I/O port fifo into a block of memory.
14
15 Reads the 8-bit I/O fifo port specified by Port.
16 The port is read Count times, and the read data is
17 stored in the provided Buffer.
18
19 This function must guarantee that all I/O read and write operations are
20 serialized.
21
22 If 8-bit I/O port operations are not supported, then ASSERT().
23
24 In TDX a serial of TdIoRead8 is invoked to read the I/O port fifo.
25
26 @param Port The I/O port to read.
27 @param Count The number of times to read I/O port.
28 @param Buffer The buffer to store the read data into.
29
30**/
31VOID
32EFIAPI
33IoReadFifo8 (
34 IN UINTN Port,
35 IN UINTN Count,
36 OUT VOID *Buffer
37 )
38{
39 UINT8 *Buffer8;
40
41 Buffer8 = (UINT8 *)Buffer;
42 while (Count-- > 0) {
43 *Buffer8++ = IoRead8 (Port);
44 }
45}
46
47/**
48 Writes a block of memory into an 8-bit I/O port fifo.
49
50 Writes the 8-bit I/O fifo port specified by Port.
51 The port is written Count times, and the write data is
52 retrieved from the provided Buffer.
53
54 This function must guarantee that all I/O write and write operations are
55 serialized.
56
57 If 8-bit I/O port operations are not supported, then ASSERT().
58
59 In TDX a serial of TdIoWrite8 is invoked to write data to the I/O port.
60
61 @param Port The I/O port to write.
62 @param Count The number of times to write I/O port.
63 @param Buffer The buffer to retrieve the write data from.
64
65**/
66VOID
67EFIAPI
68IoWriteFifo8 (
69 IN UINTN Port,
70 IN UINTN Count,
71 IN VOID *Buffer
72 )
73{
74 UINT8 *Buffer8;
75
76 Buffer8 = (UINT8 *)Buffer;
77 while (Count-- > 0) {
78 IoWrite8 (Port, *Buffer8++);
79 }
80}
81
82/**
83 Reads a 16-bit I/O port fifo into a block of memory.
84
85 Reads the 16-bit I/O fifo port specified by Port.
86 The port is read Count times, and the read data is
87 stored in the provided Buffer.
88
89 This function must guarantee that all I/O read and write operations are
90 serialized.
91
92 If 16-bit I/O port operations are not supported, then ASSERT().
93
94 In TDX a serial of TdIoRead16 is invoked to read data from the I/O port.
95
96 @param Port The I/O port to read.
97 @param Count The number of times to read I/O port.
98 @param Buffer The buffer to store the read data into.
99
100**/
101VOID
102EFIAPI
103IoReadFifo16 (
104 IN UINTN Port,
105 IN UINTN Count,
106 OUT VOID *Buffer
107 )
108{
109 UINT16 *Buffer16;
110
111 Buffer16 = (UINT16 *)Buffer;
112 while (Count-- > 0) {
113 *Buffer16++ = IoRead16 (Port);
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 UINT16 *Buffer16;
145
146 Buffer16 = (UINT16 *)Buffer;
147 while (Count-- > 0) {
148 IoWrite16 (Port, *Buffer16++);
149 }
150}
151
152/**
153 Reads a 32-bit I/O port fifo into a block of memory.
154
155 Reads the 32-bit I/O fifo port specified by Port.
156 The port is read Count times, and the read data is
157 stored in the provided Buffer.
158
159 This function must guarantee that all I/O read and write operations are
160 serialized.
161
162 If 32-bit I/O port operations are not supported, then ASSERT().
163
164 In TDX a serial of TdIoRead32 is invoked to read data from the I/O port.
165
166 @param Port The I/O port to read.
167 @param Count The number of times to read I/O port.
168 @param Buffer The buffer to store the read data into.
169
170**/
171VOID
172EFIAPI
173IoReadFifo32 (
174 IN UINTN Port,
175 IN UINTN Count,
176 OUT VOID *Buffer
177 )
178{
179 UINT32 *Buffer32;
180
181 Buffer32 = (UINT32 *)Buffer;
182 while (Count-- > 0) {
183 *Buffer32++ = IoRead32 (Port);
184 }
185}
186
187/**
188 Writes a block of memory into a 32-bit I/O port fifo.
189
190 Writes the 32-bit I/O fifo port specified by Port.
191 The port is written Count times, and the write data is
192 retrieved from the provided Buffer.
193
194 This function must guarantee that all I/O write and write operations are
195 serialized.
196
197 If 32-bit I/O port operations are not supported, then ASSERT().
198
199 In TDX a serial of TdIoWrite32 is invoked to write data to the I/O port.
200
201 @param Port The I/O port to write.
202 @param Count The number of times to write I/O port.
203 @param Buffer The buffer to retrieve the write data from.
204
205**/
206VOID
207EFIAPI
208IoWriteFifo32 (
209 IN UINTN Port,
210 IN UINTN Count,
211 IN VOID *Buffer
212 )
213{
214 UINT32 *Buffer32;
215
216 Buffer32 = (UINT32 *)Buffer;
217 while (Count-- > 0) {
218 IoWrite32 (Port, *Buffer32++);
219 }
220}
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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