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