1 /** @file 2 Internal include file for the CPU I/O 2 Protocol thunk driver. 3 4 Copyright (c) 2009 - 2010, 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_ON_CPU_IO_H__ 16 #define __CPU_IO2_ON_CPU_IO_H__ 17 18 #include <Protocol/CpuIo2.h> 19 #include <Protocol/CpuIo.h> 20 21 #include <Library/DebugLib.h> 22 #include <Library/UefiBootServicesTableLib.h> 23 24 /** 25 Enables a driver to read memory-mapped registers in the PI System memory space. 26 27 @param[in] This A pointer to the EFI_CPU_IO2_PROTOCOL instance. 28 @param[in] Width Signifies the width of the memory operation. 29 @param[in] Address The base address of the memory operation. 30 @param[in] Count The number of memory operations to perform. The number of bytes moved 31 is Width size * Count, starting at Address. 32 @param[in, out] Buffer The destination buffer to store the results. 33 34 @retval EFI_SUCCESS The data was read from or written to the EFI system. 35 @retval EFI_INVALID_PARAMETER Width is invalid for this EFI system. Or Buffer is NULL. 36 @retval EFI_UNSUPPORTED The Buffer is not aligned for the given Width. 37 Or,The address range specified by Address, Width, and Count is not valid for this EFI system. 38 39 **/ 40 EFI_STATUS 41 EFIAPI 42 CpuMemoryServiceRead ( 43 IN EFI_CPU_IO2_PROTOCOL *This, 44 IN EFI_CPU_IO_PROTOCOL_WIDTH Width, 45 IN UINT64 Address, 46 IN UINTN Count, 47 IN OUT VOID *Buffer 48 ); 49 50 /** 51 Enables a driver to write memory-mapped registers in the PI System memory space. 52 53 @param[in] This A pointer to the EFI_CPU_IO2_PROTOCOL instance. 54 @param[in] Width Signifies the width of the memory operation. 55 @param[in] Address The base address of the memory operation. 56 @param[in] Count The number of memory operations to perform. The number of bytes moved 57 is Width size * Count, starting at Address. 58 @param[in, out] Buffer The source buffer from which to write data. 59 60 @retval EFI_SUCCESS The data was read from or written to the EFI system. 61 @retval EFI_INVALID_PARAMETER Width is invalid for this EFI system. Or Buffer is NULL. 62 @retval EFI_UNSUPPORTED The Buffer is not aligned for the given Width. 63 Or,The address range specified by Address, Width, and Count is not valid for this EFI system. 64 65 **/ 66 EFI_STATUS 67 EFIAPI 68 CpuMemoryServiceWrite ( 69 IN EFI_CPU_IO2_PROTOCOL *This, 70 IN EFI_CPU_IO_PROTOCOL_WIDTH Width, 71 IN UINT64 Address, 72 IN UINTN Count, 73 IN OUT VOID *Buffer 74 ); 75 76 /** 77 Enables a driver to read registers in the PI CPU I/O space. 78 79 @param[in] This A pointer to the EFI_CPU_IO2_PROTOCOL instance. 80 @param[in] Width Signifies the width of the I/O operation. 81 @param[in] Address The base address of the I/O operation. The caller is responsible 82 for aligning the Address if required. 83 @param[in] Count The number of I/O operations to perform. The number of bytes moved 84 is Width size * Count, starting at Address. 85 @param[in, out] Buffer The destination buffer to store the results. 86 87 @retval EFI_SUCCESS The data was read from or written to the EFI system. 88 @retval EFI_INVALID_PARAMETER Width is invalid for this EFI system. Or Buffer is NULL. 89 @retval EFI_UNSUPPORTED The Buffer is not aligned for the given Width. 90 Or,The address range specified by Address, Width, and Count is not valid for this EFI system. 91 92 **/ 93 EFI_STATUS 94 EFIAPI 95 CpuIoServiceRead ( 96 IN EFI_CPU_IO2_PROTOCOL *This, 97 IN EFI_CPU_IO_PROTOCOL_WIDTH Width, 98 IN UINT64 Address, 99 IN UINTN Count, 100 IN OUT VOID *Buffer 101 ); 102 103 /** 104 Enables a driver to write registers in the PI CPU I/O space. 105 106 @param[in] This A pointer to the EFI_CPU_IO2_PROTOCOL instance. 107 @param[in] Width Signifies the width of the I/O operation. 108 @param[in] Address The base address of the I/O operation. The caller is responsible 109 for aligning the Address if required. 110 @param[in] Count The number of I/O operations to perform. The number of bytes moved 111 is Width size * Count, starting at Address. 112 @param[in, out] Buffer The source buffer from which to write data. 113 114 @retval EFI_SUCCESS The data was read from or written to the EFI system. 115 @retval EFI_INVALID_PARAMETER Width is invalid for this EFI system. Or Buffer is NULL. 116 @retval EFI_UNSUPPORTED The Buffer is not aligned for the given Width. 117 Or,The address range specified by Address, Width, and Count is not valid for this EFI system. 118 119 **/ 120 EFI_STATUS 121 EFIAPI 122 CpuIoServiceWrite ( 123 IN EFI_CPU_IO2_PROTOCOL *This, 124 IN EFI_CPU_IO_PROTOCOL_WIDTH Width, 125 IN UINT64 Address, 126 IN UINTN Count, 127 IN OUT VOID *Buffer 128 ); 129 130 #endif 131