]>
Commit | Line | Data |
---|---|---|
3ca55ed4 | 1 | /** @file\r |
2 | Internal include file for the CPU I/O 2 Protocol implementation.\r | |
3 | \r | |
4 | Copyright (c) 2009, Intel Corporation\r | |
5 | All rights reserved. This program and the accompanying materials\r | |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | \r | |
13 | **/\r | |
14 | \r | |
15 | #ifndef _CPU_IO2_H_\r | |
16 | #define _CPU_IO2_H_\r | |
17 | \r | |
18 | #include <Protocol/CpuIo2.h>\r | |
19 | \r | |
20 | #include <Library/DebugLib.h>\r | |
21 | #include <Library/IoLib.h>\r | |
22 | #include <Library/UefiDriverEntryPoint.h>\r | |
23 | #include <Library/UefiBootServicesTableLib.h>\r | |
24 | \r | |
25 | #define IA32_MAX_IO_ADDRESS 0xFFFF\r | |
26 | \r | |
27 | typedef union {\r | |
28 | UINT8 volatile *Buf;\r | |
29 | UINT8 volatile *Ui8;\r | |
30 | UINT16 volatile *Ui16;\r | |
31 | UINT32 volatile *Ui32;\r | |
32 | UINT64 volatile *Ui64;\r | |
33 | UINTN volatile Ui;\r | |
34 | } PTR;\r | |
35 | \r | |
36 | /**\r | |
37 | Enables a driver to read memory-mapped registers in the PI System memory space.\r | |
38 | \r | |
39 | @param[in] This A pointer to the EFI_CPU_IO2_PROTOCOL instance.\r | |
40 | @param[in] Width Signifies the width of the memory operation.\r | |
41 | @param[in] Address The base address of the memory operation.\r | |
42 | @param[in] Count The number of memory operations to perform. The number of bytes moved\r | |
43 | is Width size * Count, starting at Address.\r | |
44 | @param[out] Buffer The destination buffer to store the results.\r | |
45 | \r | |
46 | @retval EFI_SUCCESS The data was read from or written to the EFI system.\r | |
47 | @retval EFI_INVALID_PARAMETER Width is invalid for this EFI system. Or Buffer is NULL.\r | |
48 | @retval EFI_UNSUPPORTED The Buffer is not aligned for the given Width.\r | |
49 | Or,The address range specified by Address, Width, and Count is not valid for this EFI system.\r | |
50 | \r | |
51 | **/\r | |
52 | EFI_STATUS\r | |
53 | EFIAPI\r | |
54 | CpuMemoryServiceRead (\r | |
55 | IN EFI_CPU_IO2_PROTOCOL *This,\r | |
56 | IN EFI_CPU_IO_PROTOCOL_WIDTH Width,\r | |
57 | IN UINT64 Address,\r | |
58 | IN UINTN Count,\r | |
59 | OUT VOID *Buffer\r | |
60 | );\r | |
61 | \r | |
62 | /**\r | |
63 | Enables a driver to write memory-mapped registers in the PI System memory space.\r | |
64 | \r | |
65 | @param[in] This A pointer to the EFI_CPU_IO2_PROTOCOL instance.\r | |
66 | @param[in] Width Signifies the width of the memory operation.\r | |
67 | @param[in] Address The base address of the memory operation.\r | |
68 | @param[in] Count The number of memory operations to perform. The number of bytes moved\r | |
69 | is Width size * Count, starting at Address.\r | |
70 | @param[in] Buffer The source buffer from which to write data.\r | |
71 | \r | |
72 | @retval EFI_SUCCESS The data was read from or written to the EFI system.\r | |
73 | @retval EFI_INVALID_PARAMETER Width is invalid for this EFI system. Or Buffer is NULL.\r | |
74 | @retval EFI_UNSUPPORTED The Buffer is not aligned for the given Width.\r | |
75 | Or,The address range specified by Address, Width, and Count is not valid for this EFI system.\r | |
76 | \r | |
77 | **/\r | |
78 | EFI_STATUS\r | |
79 | EFIAPI\r | |
80 | CpuMemoryServiceWrite (\r | |
81 | IN EFI_CPU_IO2_PROTOCOL *This,\r | |
82 | IN EFI_CPU_IO_PROTOCOL_WIDTH Width,\r | |
83 | IN UINT64 Address,\r | |
84 | IN UINTN Count,\r | |
85 | IN VOID *Buffer\r | |
86 | );\r | |
87 | \r | |
88 | /**\r | |
89 | Enables a driver to read registers in the PI CPU I/O space.\r | |
90 | \r | |
91 | @param[in] This A pointer to the EFI_CPU_IO2_PROTOCOL instance.\r | |
92 | @param[in] Width Signifies the width of the I/O operation.\r | |
93 | @param[in] UserAddress The base address of the I/O operation. The caller is responsible\r | |
94 | for aligning the Address if required. \r | |
95 | @param[in] Count The number of I/O operations to perform. The number of bytes moved\r | |
96 | is Width size * Count, starting at Address.\r | |
97 | @param[out] UserBuffer The destination buffer to store the results.\r | |
98 | \r | |
99 | @retval EFI_SUCCESS The data was read from or written to the EFI system.\r | |
100 | @retval EFI_INVALID_PARAMETER Width is invalid for this EFI system. Or Buffer is NULL.\r | |
101 | @retval EFI_UNSUPPORTED The Buffer is not aligned for the given Width.\r | |
102 | Or,The address range specified by Address, Width, and Count is not valid for this EFI system.\r | |
103 | \r | |
104 | **/\r | |
105 | EFI_STATUS\r | |
106 | EFIAPI\r | |
107 | CpuIoServiceRead (\r | |
108 | IN EFI_CPU_IO2_PROTOCOL *This,\r | |
109 | IN EFI_CPU_IO_PROTOCOL_WIDTH Width,\r | |
110 | IN UINT64 UserAddress,\r | |
111 | IN UINTN Count,\r | |
112 | OUT VOID *UserBuffer\r | |
113 | );\r | |
114 | \r | |
115 | /**\r | |
116 | Enables a driver to write registers in the PI CPU I/O space.\r | |
117 | \r | |
118 | @param[in] This A pointer to the EFI_CPU_IO2_PROTOCOL instance.\r | |
119 | @param[in] Width Signifies the width of the I/O operation.\r | |
120 | @param[in] UserAddress The base address of the I/O operation. The caller is responsible\r | |
121 | for aligning the Address if required. \r | |
122 | @param[in] Count The number of I/O operations to perform. The number of bytes moved\r | |
123 | is Width size * Count, starting at Address.\r | |
124 | @param[in] UserBuffer The source buffer from which to write data.\r | |
125 | \r | |
126 | @retval EFI_SUCCESS The data was read from or written to the EFI system.\r | |
127 | @retval EFI_INVALID_PARAMETER Width is invalid for this EFI system. Or Buffer is NULL.\r | |
128 | @retval EFI_UNSUPPORTED The Buffer is not aligned for the given Width.\r | |
129 | Or,The address range specified by Address, Width, and Count is not valid for this EFI system.\r | |
130 | \r | |
131 | **/\r | |
132 | EFI_STATUS\r | |
133 | EFIAPI\r | |
134 | CpuIoServiceWrite (\r | |
135 | IN EFI_CPU_IO2_PROTOCOL *This,\r | |
136 | IN EFI_CPU_IO_PROTOCOL_WIDTH Width,\r | |
137 | IN UINT64 UserAddress,\r | |
138 | IN UINTN Count,\r | |
139 | IN VOID *UserBuffer\r | |
140 | );\r | |
141 | \r | |
142 | #endif\r |