]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/DxeIoLibCpuIo2/DxeCpuIo2LibInternal.h
MdePkg: Apply uncrustify changes
[mirror_edk2.git] / MdePkg / Library / DxeIoLibCpuIo2 / DxeCpuIo2LibInternal.h
1 /** @file
2 Internal include file of DXE CPU IO2 Library.
3
4 Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
5 Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
6
7 SPDX-License-Identifier: BSD-2-Clause-Patent
8
9 **/
10
11 #ifndef _DXE_CPUIO2_LIB_INTERNAL_H_
12 #define _DXE_CPUIO2_LIB_INTERNAL_H_
13
14 #include <PiDxe.h>
15
16 #include <Protocol/CpuIo2.h>
17
18 #include <Library/IoLib.h>
19 #include <Library/UefiBootServicesTableLib.h>
20 #include <Library/DebugLib.h>
21 #include <Library/BaseLib.h>
22
23 /**
24 Reads registers in the EFI CPU I/O space.
25
26 Reads the I/O port specified by Port with registers width specified by Width.
27 The read value is returned.
28
29 This function must guarantee that all I/O read and write operations are serialized.
30 If such operations are not supported, then ASSERT().
31
32 @param Port The base address of the I/O operation.
33 The caller is responsible for aligning the Address if required.
34 @param Width The width of the I/O operation.
35
36 @return Data read from registers in the EFI CPU I/O space.
37
38 **/
39 UINT64
40 EFIAPI
41 IoReadWorker (
42 IN UINTN Port,
43 IN EFI_CPU_IO_PROTOCOL_WIDTH Width
44 );
45
46 /**
47 Writes registers in the EFI CPU I/O space.
48
49 Writes the I/O port specified by Port with registers width and value specified by Width
50 and Data respectively. Data is returned.
51
52 This function must guarantee that all I/O read and write operations are serialized.
53 If such operations are not supported, then ASSERT().
54
55 @param Port The base address of the I/O operation.
56 The caller is responsible for aligning the Address if required.
57 @param Width The width of the I/O operation.
58 @param Data The value to write to the I/O port.
59
60 @return The parameter of Data.
61
62 **/
63 UINT64
64 EFIAPI
65 IoWriteWorker (
66 IN UINTN Port,
67 IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
68 IN UINT64 Data
69 );
70
71 /**
72 Reads registers in the EFI CPU I/O space.
73
74 Reads the I/O port specified by Port with registers width specified by Width.
75 The port is read Count times, and the read data is stored in the provided Buffer.
76
77 This function must guarantee that all I/O read and write operations are serialized.
78 If such operations are not supported, then ASSERT().
79
80 @param Port The base address of the I/O operation.
81 The caller is responsible for aligning the Address if required.
82 @param Width The width of the I/O operation.
83 @param Count The number of times to read I/O port.
84 @param Buffer The buffer to store the read data into.
85
86 **/
87 VOID
88 EFIAPI
89 IoReadFifoWorker (
90 IN UINTN Port,
91 IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
92 IN UINTN Count,
93 IN VOID *Buffer
94 );
95
96 /**
97 Writes registers in the EFI CPU I/O space.
98
99 Writes the I/O port specified by Port with registers width specified by Width.
100 The port is written Count times, and the write data is retrieved from the provided Buffer.
101
102 This function must guarantee that all I/O read and write operations are serialized.
103 If such operations are not supported, then ASSERT().
104
105 @param Port The base address of the I/O operation.
106 The caller is responsible for aligning the Address if required.
107 @param Width The width of the I/O operation.
108 @param Count The number of times to write I/O port.
109 @param Buffer The buffer to store the read data into.
110
111 **/
112 VOID
113 EFIAPI
114 IoWriteFifoWorker (
115 IN UINTN Port,
116 IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
117 IN UINTN Count,
118 IN VOID *Buffer
119 );
120
121 /**
122 Reads memory-mapped registers in the EFI system memory space.
123
124 Reads the MMIO registers specified by Address with registers width specified by Width.
125 The read value is returned. If such operations are not supported, then ASSERT().
126 This function must guarantee that all MMIO read and write operations are serialized.
127
128 @param Address The MMIO register to read.
129 The caller is responsible for aligning the Address if required.
130 @param Width The width of the I/O operation.
131
132 @return Data read from registers in the EFI system memory space.
133
134 **/
135 UINT64
136 EFIAPI
137 MmioReadWorker (
138 IN UINTN Address,
139 IN EFI_CPU_IO_PROTOCOL_WIDTH Width
140 );
141
142 /**
143 Writes memory-mapped registers in the EFI system memory space.
144
145 Writes the MMIO registers specified by Address with registers width and value specified by Width
146 and Data respectively. Data is returned. If such operations are not supported, then ASSERT().
147 This function must guarantee that all MMIO read and write operations are serialized.
148
149 @param Address The MMIO register to read.
150 The caller is responsible for aligning the Address if required.
151 @param Width The width of the I/O operation.
152 @param Data The value to write to the I/O port.
153
154 @return Data read from registers in the EFI system memory space.
155
156 **/
157 UINT64
158 EFIAPI
159 MmioWriteWorker (
160 IN UINTN Address,
161 IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
162 IN UINT64 Data
163 );
164
165 #endif