]> git.proxmox.com Git - mirror_edk2.git/blob - UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.h
UefiCpuPkg: Clean up source files
[mirror_edk2.git] / UefiCpuPkg / CpuIo2Smm / CpuIo2Smm.h
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 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #ifndef _CPU_IO2_SMM_H_
16 #define _CPU_IO2_SMM_H_
17
18 #include <PiSmm.h>
19
20 #include <Protocol/SmmCpuIo2.h>
21
22 #include <Library/BaseLib.h>
23 #include <Library/DebugLib.h>
24 #include <Library/IoLib.h>
25 #include <Library/SmmServicesTableLib.h>
26 #include <Library/BaseMemoryLib.h>
27
28 #define MAX_IO_PORT_ADDRESS 0xFFFF
29
30 /**
31 Reads memory-mapped registers.
32
33 The I/O operations are carried out exactly as requested. The caller is
34 responsible for any alignment and I/O width issues that the bus, device,
35 platform, or type of I/O might require.
36
37 @param[in] This The EFI_SMM_CPU_IO2_PROTOCOL instance.
38 @param[in] Width Signifies the width of the I/O operations.
39 @param[in] Address The base address of the I/O operations. The caller is
40 responsible for aligning the Address if required.
41 @param[in] Count The number of I/O operations to perform.
42 @param[out] Buffer For read operations, the destination buffer to store
43 the results. For write operations, the source buffer
44 from which to write data.
45
46 @retval EFI_SUCCESS The data was read from or written to the device.
47 @retval EFI_UNSUPPORTED The Address is not valid for this system.
48 @retval EFI_INVALID_PARAMETER Width or Count, or both, were invalid.
49 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a
50 lack of resources
51
52 **/
53 EFI_STATUS
54 EFIAPI
55 CpuMemoryServiceRead (
56 IN CONST EFI_SMM_CPU_IO2_PROTOCOL *This,
57 IN EFI_SMM_IO_WIDTH Width,
58 IN UINT64 Address,
59 IN UINTN Count,
60 OUT VOID *Buffer
61 );
62
63 /**
64 Writes memory-mapped registers.
65
66 The I/O operations are carried out exactly as requested. The caller is
67 responsible for any alignment and I/O width issues that the bus, device,
68 platform, or type of I/O might require.
69
70 @param[in] This The EFI_SMM_CPU_IO2_PROTOCOL instance.
71 @param[in] Width Signifies the width of the I/O operations.
72 @param[in] Address The base address of the I/O operations. The caller is
73 responsible for aligning the Address if required.
74 @param[in] Count The number of I/O operations to perform.
75 @param[in] Buffer For read operations, the destination buffer to store
76 the results. For write operations, the source buffer
77 from which to write data.
78
79 @retval EFI_SUCCESS The data was read from or written to the device.
80 @retval EFI_UNSUPPORTED The Address is not valid for this system.
81 @retval EFI_INVALID_PARAMETER Width or Count, or both, were invalid.
82 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a
83 lack of resources
84
85 **/
86 EFI_STATUS
87 EFIAPI
88 CpuMemoryServiceWrite (
89 IN CONST EFI_SMM_CPU_IO2_PROTOCOL *This,
90 IN EFI_SMM_IO_WIDTH Width,
91 IN UINT64 Address,
92 IN UINTN Count,
93 IN VOID *Buffer
94 );
95
96 /**
97 Reads I/O registers.
98
99 The I/O operations are carried out exactly as requested. The caller is
100 responsible for any alignment and I/O width issues that the bus, device,
101 platform, or type of I/O might require.
102
103 @param[in] This The EFI_SMM_CPU_IO2_PROTOCOL instance.
104 @param[in] Width Signifies the width of the I/O operations.
105 @param[in] Address The base address of the I/O operations. The caller is
106 responsible for aligning the Address if required.
107 @param[in] Count The number of I/O operations to perform.
108 @param[out] Buffer For read operations, the destination buffer to store
109 the results. For write operations, the source buffer
110 from which to write data.
111
112 @retval EFI_SUCCESS The data was read from or written to the device.
113 @retval EFI_UNSUPPORTED The Address is not valid for this system.
114 @retval EFI_INVALID_PARAMETER Width or Count, or both, were invalid.
115 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a
116 lack of resources
117
118 **/
119 EFI_STATUS
120 EFIAPI
121 CpuIoServiceRead (
122 IN CONST EFI_SMM_CPU_IO2_PROTOCOL *This,
123 IN EFI_SMM_IO_WIDTH Width,
124 IN UINT64 Address,
125 IN UINTN Count,
126 OUT VOID *Buffer
127 );
128
129 /**
130 Write I/O registers.
131
132 The I/O operations are carried out exactly as requested. The caller is
133 responsible for any alignment and I/O width issues that the bus, device,
134 platform, or type of I/O might require.
135
136 @param[in] This The EFI_SMM_CPU_IO2_PROTOCOL instance.
137 @param[in] Width Signifies the width of the I/O operations.
138 @param[in] Address The base address of the I/O operations. The caller is
139 responsible for aligning the Address if required.
140 @param[in] Count The number of I/O operations to perform.
141 @param[in] Buffer For read operations, the destination buffer to store
142 the results. For write operations, the source buffer
143 from which to write data.
144
145 @retval EFI_SUCCESS The data was read from or written to the device.
146 @retval EFI_UNSUPPORTED The Address is not valid for this system.
147 @retval EFI_INVALID_PARAMETER Width or Count, or both, were invalid.
148 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a
149 lack of resources
150
151 **/
152 EFI_STATUS
153 EFIAPI
154 CpuIoServiceWrite (
155 IN CONST EFI_SMM_CPU_IO2_PROTOCOL *This,
156 IN EFI_SMM_IO_WIDTH Width,
157 IN UINT64 Address,
158 IN UINTN Count,
159 IN VOID *Buffer
160 );
161
162 #endif