--- /dev/null
+/*++\r
+\r
+Copyright (c) 2004, Intel Corporation \r
+All rights reserved. This program and the accompanying materials \r
+are licensed and made available under the terms and conditions of the BSD License \r
+which accompanies this distribution. The full text of the license may be found at \r
+http://opensource.org/licenses/bsd-license.php \r
+ \r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
+\r
+Module Name:\r
+ CpuIo.h\r
+\r
+Abstract:\r
+ *.h file for the driver\r
+\r
+ Note: the EFIAPI on the CpuIo functions is used to glue MASM (assembler) code\r
+ into C code. By making the MASM functions EFIAPI it ensures that a standard\r
+ C calling convention is assumed by the compiler, reguardless of the compiler\r
+ flags.\r
+\r
+\r
+--*/\r
+\r
+#ifndef _CPU_IO_H\r
+#define _CPU_IO_H\r
+\r
+#include <PiDxe.h>\r
+\r
+#include <Protocol/CpuIo.h>\r
+\r
+#include <Library/BaseLib.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/IoLib.h>\r
+\r
+typedef union {\r
+ UINT8 volatile *buf;\r
+ UINT8 volatile *ui8;\r
+ UINT16 volatile *ui16;\r
+ UINT32 volatile *ui32;\r
+ UINT64 volatile *ui64;\r
+ UINTN volatile ui;\r
+} PTR;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+CpuIoInitialize (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ CpuIo driver entry point.\r
+\r
+Arguments:\r
+\r
+ ImageHandle - The firmware allocated handle for the EFI image.\r
+ SystemTable - A pointer to the EFI System Table.\r
+\r
+Returns:\r
+\r
+ EFI_SUCCESS - The driver was initialized.\r
+ EFI_OUT_OF_RESOURCES - The request could not be completed due to a lack of resources.\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+CpuMemoryServiceRead (\r
+ IN EFI_CPU_IO_PROTOCOL *This,\r
+ IN EFI_CPU_IO_PROTOCOL_WIDTH Width,\r
+ IN UINT64 Address,\r
+ IN UINTN Count,\r
+ OUT VOID *Buffer\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Perform the memory mapped I/O read service\r
+\r
+Arguments:\r
+\r
+ This - Pointer to an instance of the CPU I/O Protocol\r
+ Width - Width of the memory mapped I/O operation\r
+ Address - Base address of the memory mapped I/O operation\r
+ Count - Count of the number of accesses to perform\r
+ Buffer - Pointer to the destination buffer to store the results\r
+\r
+Returns:\r
+\r
+ EFI_SUCCESS - The data was read.\r
+ EFI_INVALID_PARAMETER - Width is invalid.\r
+ EFI_INVALID_PARAMETER - Buffer is NULL.\r
+ EFI_UNSUPPORTED - The Buffer is not aligned for the given Width.\r
+ EFI_UNSUPPORTED - The address range specified by Address, Width,\r
+ and Count is not valid.\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+CpuMemoryServiceWrite (\r
+ IN EFI_CPU_IO_PROTOCOL *This,\r
+ IN EFI_CPU_IO_PROTOCOL_WIDTH Width,\r
+ IN UINT64 Address,\r
+ IN UINTN Count,\r
+ IN VOID *Buffer\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Perform the memory mapped I/O write service\r
+\r
+Arguments:\r
+\r
+ This - Pointer to an instance of the CPU I/O Protocol\r
+ Width - Width of the memory mapped I/O operation\r
+ Address - Base address of the memory mapped I/O operation\r
+ Count - Count of the number of accesses to perform\r
+ Buffer - Pointer to the source buffer from which to write data\r
+\r
+Returns:\r
+\r
+ EFI_SUCCESS - The data was written.\r
+ EFI_INVALID_PARAMETER - Width is invalid.\r
+ EFI_INVALID_PARAMETER - Buffer is NULL.\r
+ EFI_UNSUPPORTED - The Buffer is not aligned for the given Width.\r
+ EFI_UNSUPPORTED - The address range specified by Address, Width,\r
+ and Count is not valid.\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+CpuIoServiceRead (\r
+ IN EFI_CPU_IO_PROTOCOL *This,\r
+ IN EFI_CPU_IO_PROTOCOL_WIDTH Width,\r
+ IN UINT64 UserAddress,\r
+ IN UINTN Count,\r
+ OUT VOID *UserBuffer\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Perform the port I/O read service\r
+\r
+Arguments:\r
+\r
+ This - Pointer to an instance of the CPU I/O Protocol\r
+ Width - Width of the port I/O operation\r
+ Address - Base address of the port I/O operation\r
+ Count - Count of the number of accesses to perform\r
+ Buffer - Pointer to the destination buffer to store the results\r
+\r
+Returns:\r
+\r
+ EFI_SUCCESS - The data was read.\r
+ EFI_INVALID_PARAMETER - Width is invalid.\r
+ EFI_INVALID_PARAMETER - Buffer is NULL.\r
+ EFI_UNSUPPORTED - The Buffer is not aligned for the given Width.\r
+ EFI_UNSUPPORTED - The address range specified by Address, Width,\r
+ and Count is not valid.\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+CpuIoServiceWrite (\r
+ IN EFI_CPU_IO_PROTOCOL *This,\r
+ IN EFI_CPU_IO_PROTOCOL_WIDTH Width,\r
+ IN UINT64 UserAddress,\r
+ IN UINTN Count,\r
+ IN VOID *UserBuffer\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Perform the port I/O write service\r
+\r
+Arguments:\r
+\r
+ This - Pointer to an instance of the CPU I/O Protocol\r
+ Width - Width of the port I/O operation\r
+ Address - Base address of the port I/O operation\r
+ Count - Count of the number of accesses to perform\r
+ Buffer - Pointer to the source buffer from which to write data\r
+\r
+Returns:\r
+\r
+ EFI_SUCCESS - The data was written.\r
+ EFI_INVALID_PARAMETER - Width is invalid.\r
+ EFI_INVALID_PARAMETER - Buffer is NULL.\r
+ EFI_UNSUPPORTED - The Buffer is not aligned for the given Width.\r
+ EFI_UNSUPPORTED - The address range specified by Address, Width,\r
+ and Count is not valid.\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+CpuIoCheckParameter (\r
+ IN EFI_CPU_IO_PROTOCOL_WIDTH Width,\r
+ IN UINT64 Address,\r
+ IN UINTN Count,\r
+ IN VOID *Buffer,\r
+ IN UINT64 Limit\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Check the validation of parameters for CPU I/O interface functions.\r
+\r
+Arguments:\r
+\r
+ Width - Width of the Memory Access\r
+ Address - Address of the Memory access\r
+ Count - Count of the number of accesses to perform\r
+ Buffer - Pointer to the buffer to read from memory\r
+ Buffer - Memory buffer for the I/O operation\r
+ Limit - Maximum address supported\r
+\r
+Returns:\r
+\r
+ EFI_INVALID_PARAMETER - Buffer is NULL\r
+ EFI_UNSUPPORTED - The address range specified by Width, Address and Count is invalid\r
+ EFI_UNSUPPORTED - The memory buffer is not aligned\r
+ EFI_SUCCESS - Parameters are OK\r
+\r
+--*/\r
+;\r
+\r
+#endif\r