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