1 | /** @file
|
---|
2 | Internal include file for the SMM CPU I/O Protocol.
|
---|
3 |
|
---|
4 | Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
|
---|
5 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
6 |
|
---|
7 | **/
|
---|
8 |
|
---|
9 | #ifndef _CPU_IO2_SMM_H_
|
---|
10 | #define _CPU_IO2_SMM_H_
|
---|
11 |
|
---|
12 | #include <PiSmm.h>
|
---|
13 |
|
---|
14 | #include <Protocol/SmmCpuIo2.h>
|
---|
15 |
|
---|
16 | #include <Library/BaseLib.h>
|
---|
17 | #include <Library/DebugLib.h>
|
---|
18 | #include <Library/IoLib.h>
|
---|
19 | #include <Library/SmmServicesTableLib.h>
|
---|
20 | #include <Library/BaseMemoryLib.h>
|
---|
21 |
|
---|
22 | #define MAX_IO_PORT_ADDRESS 0xFFFF
|
---|
23 |
|
---|
24 | /**
|
---|
25 | Reads memory-mapped registers.
|
---|
26 |
|
---|
27 | The I/O operations are carried out exactly as requested. The caller is
|
---|
28 | responsible for any alignment and I/O width issues that the bus, device,
|
---|
29 | platform, or type of I/O might require.
|
---|
30 |
|
---|
31 | @param[in] This The EFI_SMM_CPU_IO2_PROTOCOL instance.
|
---|
32 | @param[in] Width Signifies the width of the I/O operations.
|
---|
33 | @param[in] Address The base address of the I/O operations. The caller is
|
---|
34 | responsible for aligning the Address if required.
|
---|
35 | @param[in] Count The number of I/O operations to perform.
|
---|
36 | @param[out] Buffer For read operations, the destination buffer to store
|
---|
37 | the results. For write operations, the source buffer
|
---|
38 | from which to write data.
|
---|
39 |
|
---|
40 | @retval EFI_SUCCESS The data was read from or written to the device.
|
---|
41 | @retval EFI_UNSUPPORTED The Address is not valid for this system.
|
---|
42 | @retval EFI_INVALID_PARAMETER Width or Count, or both, were invalid.
|
---|
43 | @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a
|
---|
44 | lack of resources
|
---|
45 |
|
---|
46 | **/
|
---|
47 | EFI_STATUS
|
---|
48 | EFIAPI
|
---|
49 | CpuMemoryServiceRead (
|
---|
50 | IN CONST EFI_SMM_CPU_IO2_PROTOCOL *This,
|
---|
51 | IN EFI_SMM_IO_WIDTH Width,
|
---|
52 | IN UINT64 Address,
|
---|
53 | IN UINTN Count,
|
---|
54 | OUT VOID *Buffer
|
---|
55 | );
|
---|
56 |
|
---|
57 | /**
|
---|
58 | Writes memory-mapped registers.
|
---|
59 |
|
---|
60 | The I/O operations are carried out exactly as requested. The caller is
|
---|
61 | responsible for any alignment and I/O width issues that the bus, device,
|
---|
62 | platform, or type of I/O might require.
|
---|
63 |
|
---|
64 | @param[in] This The EFI_SMM_CPU_IO2_PROTOCOL instance.
|
---|
65 | @param[in] Width Signifies the width of the I/O operations.
|
---|
66 | @param[in] Address The base address of the I/O operations. The caller is
|
---|
67 | responsible for aligning the Address if required.
|
---|
68 | @param[in] Count The number of I/O operations to perform.
|
---|
69 | @param[in] Buffer For read operations, the destination buffer to store
|
---|
70 | the results. For write operations, the source buffer
|
---|
71 | from which to write data.
|
---|
72 |
|
---|
73 | @retval EFI_SUCCESS The data was read from or written to the device.
|
---|
74 | @retval EFI_UNSUPPORTED The Address is not valid for this system.
|
---|
75 | @retval EFI_INVALID_PARAMETER Width or Count, or both, were invalid.
|
---|
76 | @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a
|
---|
77 | lack of resources
|
---|
78 |
|
---|
79 | **/
|
---|
80 | EFI_STATUS
|
---|
81 | EFIAPI
|
---|
82 | CpuMemoryServiceWrite (
|
---|
83 | IN CONST EFI_SMM_CPU_IO2_PROTOCOL *This,
|
---|
84 | IN EFI_SMM_IO_WIDTH Width,
|
---|
85 | IN UINT64 Address,
|
---|
86 | IN UINTN Count,
|
---|
87 | IN VOID *Buffer
|
---|
88 | );
|
---|
89 |
|
---|
90 | /**
|
---|
91 | Reads I/O registers.
|
---|
92 |
|
---|
93 | The I/O operations are carried out exactly as requested. The caller is
|
---|
94 | responsible for any alignment and I/O width issues that the bus, device,
|
---|
95 | platform, or type of I/O might require.
|
---|
96 |
|
---|
97 | @param[in] This The EFI_SMM_CPU_IO2_PROTOCOL instance.
|
---|
98 | @param[in] Width Signifies the width of the I/O operations.
|
---|
99 | @param[in] Address The base address of the I/O operations. The caller is
|
---|
100 | responsible for aligning the Address if required.
|
---|
101 | @param[in] Count The number of I/O operations to perform.
|
---|
102 | @param[out] Buffer For read operations, the destination buffer to store
|
---|
103 | the results. For write operations, the source buffer
|
---|
104 | from which to write data.
|
---|
105 |
|
---|
106 | @retval EFI_SUCCESS The data was read from or written to the device.
|
---|
107 | @retval EFI_UNSUPPORTED The Address is not valid for this system.
|
---|
108 | @retval EFI_INVALID_PARAMETER Width or Count, or both, were invalid.
|
---|
109 | @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a
|
---|
110 | lack of resources
|
---|
111 |
|
---|
112 | **/
|
---|
113 | EFI_STATUS
|
---|
114 | EFIAPI
|
---|
115 | CpuIoServiceRead (
|
---|
116 | IN CONST EFI_SMM_CPU_IO2_PROTOCOL *This,
|
---|
117 | IN EFI_SMM_IO_WIDTH Width,
|
---|
118 | IN UINT64 Address,
|
---|
119 | IN UINTN Count,
|
---|
120 | OUT VOID *Buffer
|
---|
121 | );
|
---|
122 |
|
---|
123 | /**
|
---|
124 | Write I/O registers.
|
---|
125 |
|
---|
126 | The I/O operations are carried out exactly as requested. The caller is
|
---|
127 | responsible for any alignment and I/O width issues that the bus, device,
|
---|
128 | platform, or type of I/O might require.
|
---|
129 |
|
---|
130 | @param[in] This The EFI_SMM_CPU_IO2_PROTOCOL instance.
|
---|
131 | @param[in] Width Signifies the width of the I/O operations.
|
---|
132 | @param[in] Address The base address of the I/O operations. The caller is
|
---|
133 | responsible for aligning the Address if required.
|
---|
134 | @param[in] Count The number of I/O operations to perform.
|
---|
135 | @param[in] Buffer For read operations, the destination buffer to store
|
---|
136 | the results. For write operations, the source buffer
|
---|
137 | from which to write data.
|
---|
138 |
|
---|
139 | @retval EFI_SUCCESS The data was read from or written to the device.
|
---|
140 | @retval EFI_UNSUPPORTED The Address is not valid for this system.
|
---|
141 | @retval EFI_INVALID_PARAMETER Width or Count, or both, were invalid.
|
---|
142 | @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a
|
---|
143 | lack of resources
|
---|
144 |
|
---|
145 | **/
|
---|
146 | EFI_STATUS
|
---|
147 | EFIAPI
|
---|
148 | CpuIoServiceWrite (
|
---|
149 | IN CONST EFI_SMM_CPU_IO2_PROTOCOL *This,
|
---|
150 | IN EFI_SMM_IO_WIDTH Width,
|
---|
151 | IN UINT64 Address,
|
---|
152 | IN UINTN Count,
|
---|
153 | IN VOID *Buffer
|
---|
154 | );
|
---|
155 |
|
---|
156 | #endif
|
---|