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 | /**
|
---|
25 | Reads registers in the EFI CPU I/O space.
|
---|
26 |
|
---|
27 | Reads the I/O port specified by Port with registers width specified by Width.
|
---|
28 | The read value is returned.
|
---|
29 |
|
---|
30 | This function must guarantee that all I/O read and write operations are serialized.
|
---|
31 | If such operations are not supported, then ASSERT().
|
---|
32 |
|
---|
33 | @param Port The base address of the I/O operation.
|
---|
34 | The caller is responsible for aligning the Address if required.
|
---|
35 | @param Width The width of the I/O operation.
|
---|
36 |
|
---|
37 | @return Data read from registers in the EFI CPU I/O space.
|
---|
38 |
|
---|
39 | **/
|
---|
40 | UINT64
|
---|
41 | EFIAPI
|
---|
42 | IoReadWorker (
|
---|
43 | IN UINTN Port,
|
---|
44 | IN EFI_CPU_IO_PROTOCOL_WIDTH Width
|
---|
45 | );
|
---|
46 |
|
---|
47 | /**
|
---|
48 | Writes registers in the EFI CPU I/O space.
|
---|
49 |
|
---|
50 | Writes the I/O port specified by Port with registers width and value specified by Width
|
---|
51 | and Data respectively. Data is returned.
|
---|
52 |
|
---|
53 | This function must guarantee that all I/O read and write operations are serialized.
|
---|
54 | If such operations are not supported, then ASSERT().
|
---|
55 |
|
---|
56 | @param Port The base address of the I/O operation.
|
---|
57 | The caller is responsible for aligning the Address if required.
|
---|
58 | @param Width The width of the I/O operation.
|
---|
59 | @param Data The value to write to the I/O port.
|
---|
60 |
|
---|
61 | @return The parameter of Data.
|
---|
62 |
|
---|
63 | **/
|
---|
64 | UINT64
|
---|
65 | EFIAPI
|
---|
66 | IoWriteWorker (
|
---|
67 | IN UINTN Port,
|
---|
68 | IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
|
---|
69 | IN UINT64 Data
|
---|
70 | );
|
---|
71 |
|
---|
72 | /**
|
---|
73 | Reads registers in the EFI CPU I/O space.
|
---|
74 |
|
---|
75 | Reads the I/O port specified by Port with registers width specified by Width.
|
---|
76 | The port is read Count times, and the read data is stored in the provided Buffer.
|
---|
77 |
|
---|
78 | This function must guarantee that all I/O read and write operations are serialized.
|
---|
79 | If such operations are not supported, then ASSERT().
|
---|
80 |
|
---|
81 | @param Port The base address of the I/O operation.
|
---|
82 | The caller is responsible for aligning the Address if required.
|
---|
83 | @param Width The width of the I/O operation.
|
---|
84 | @param Count The number of times to read I/O port.
|
---|
85 | @param Buffer The buffer to store the read data into.
|
---|
86 |
|
---|
87 | **/
|
---|
88 | VOID
|
---|
89 | EFIAPI
|
---|
90 | IoReadFifoWorker (
|
---|
91 | IN UINTN Port,
|
---|
92 | IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
|
---|
93 | IN UINTN Count,
|
---|
94 | IN VOID *Buffer
|
---|
95 | );
|
---|
96 |
|
---|
97 | /**
|
---|
98 | Writes registers in the EFI CPU I/O space.
|
---|
99 |
|
---|
100 | Writes the I/O port specified by Port with registers width specified by Width.
|
---|
101 | The port is written Count times, and the write data is retrieved from the provided Buffer.
|
---|
102 |
|
---|
103 | This function must guarantee that all I/O read and write operations are serialized.
|
---|
104 | If such operations are not supported, then ASSERT().
|
---|
105 |
|
---|
106 | @param Port The base address of the I/O operation.
|
---|
107 | The caller is responsible for aligning the Address if required.
|
---|
108 | @param Width The width of the I/O operation.
|
---|
109 | @param Count The number of times to write I/O port.
|
---|
110 | @param Buffer The buffer to store the read data into.
|
---|
111 |
|
---|
112 | **/
|
---|
113 | VOID
|
---|
114 | EFIAPI
|
---|
115 | IoWriteFifoWorker (
|
---|
116 | IN UINTN Port,
|
---|
117 | IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
|
---|
118 | IN UINTN Count,
|
---|
119 | IN VOID *Buffer
|
---|
120 | );
|
---|
121 |
|
---|
122 | /**
|
---|
123 | Reads memory-mapped registers in the EFI system memory space.
|
---|
124 |
|
---|
125 | Reads the MMIO registers specified by Address with registers width specified by Width.
|
---|
126 | The read value is returned. If such operations are not supported, then ASSERT().
|
---|
127 | This function must guarantee that all MMIO read and write operations are serialized.
|
---|
128 |
|
---|
129 | @param Address The MMIO register to read.
|
---|
130 | The caller is responsible for aligning the Address if required.
|
---|
131 | @param Width The width of the I/O operation.
|
---|
132 |
|
---|
133 | @return Data read from registers in the EFI system memory space.
|
---|
134 |
|
---|
135 | **/
|
---|
136 | UINT64
|
---|
137 | EFIAPI
|
---|
138 | MmioReadWorker (
|
---|
139 | IN UINTN Address,
|
---|
140 | IN EFI_CPU_IO_PROTOCOL_WIDTH Width
|
---|
141 | );
|
---|
142 |
|
---|
143 | /**
|
---|
144 | Writes memory-mapped registers in the EFI system memory space.
|
---|
145 |
|
---|
146 | Writes the MMIO registers specified by Address with registers width and value specified by Width
|
---|
147 | and Data respectively. Data is returned. If such operations are not supported, then ASSERT().
|
---|
148 | This function must guarantee that all MMIO read and write operations are serialized.
|
---|
149 |
|
---|
150 | @param Address The MMIO register to read.
|
---|
151 | The caller is responsible for aligning the Address if required.
|
---|
152 | @param Width The width of the I/O operation.
|
---|
153 | @param Data The value to write to the I/O port.
|
---|
154 |
|
---|
155 | @return Data read from registers in the EFI system memory space.
|
---|
156 |
|
---|
157 | **/
|
---|
158 | UINT64
|
---|
159 | EFIAPI
|
---|
160 | MmioWriteWorker (
|
---|
161 | IN UINTN Address,
|
---|
162 | IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
|
---|
163 | IN UINT64 Data
|
---|
164 | );
|
---|
165 |
|
---|
166 | #endif
|
---|