]>
Commit | Line | Data |
---|---|---|
79964ac8 | 1 | /** @file\r |
8411f1c0 | 2 | This code abstracts the CPU IO Protocol which installed by some platform or chipset-specific \r |
3 | PEIM that abstracts the processor-visible I/O operations.\r | |
79964ac8 | 4 | \r |
c7154234 | 5 | Copyright (c) 2007 - 2009, Intel Corporation\r |
79964ac8 | 6 | All rights reserved. This program and the accompanying materials\r |
7 | are licensed and made available under the terms and conditions of the BSD License\r | |
8 | which accompanies this distribution. The full text of the license may be found at\r | |
9 | http://opensource.org/licenses/bsd-license.php\r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
13 | \r | |
79964ac8 | 14 | @par Revision Reference:\r |
15 | CPU IO Protocol is defined in Framework of EFI CPU IO Protocol Spec\r | |
16 | Version 0.9\r | |
17 | \r | |
18 | **/\r | |
19 | \r | |
20 | #ifndef _CPUIO_H_\r | |
21 | #define _CPUIO_H_\r | |
22 | \r | |
b80fbe85 | 23 | #include <PiDxe.h>\r |
24 | \r | |
79964ac8 | 25 | #define EFI_CPU_IO_PROTOCOL_GUID \\r |
26 | { \\r | |
27 | 0xB0732526, 0x38C8, 0x4b40, {0x88, 0x77, 0x61, 0xC7, 0xB0, 0x6A, 0xAC, 0x45 } \\r | |
28 | }\r | |
29 | \r | |
30 | typedef struct _EFI_CPU_IO_PROTOCOL EFI_CPU_IO_PROTOCOL;\r | |
31 | \r | |
c7154234 | 32 | ///\r |
33 | /// Enumeration that defines the width of the I/O operation.\r | |
34 | ///\r | |
79964ac8 | 35 | typedef enum {\r |
36 | EfiCpuIoWidthUint8,\r | |
37 | EfiCpuIoWidthUint16,\r | |
38 | EfiCpuIoWidthUint32,\r | |
39 | EfiCpuIoWidthUint64,\r | |
40 | EfiCpuIoWidthFifoUint8,\r | |
41 | EfiCpuIoWidthFifoUint16,\r | |
42 | EfiCpuIoWidthFifoUint32,\r | |
43 | EfiCpuIoWidthFifoUint64,\r | |
44 | EfiCpuIoWidthFillUint8,\r | |
45 | EfiCpuIoWidthFillUint16,\r | |
46 | EfiCpuIoWidthFillUint32,\r | |
47 | EfiCpuIoWidthFillUint64,\r | |
48 | EfiCpuIoWidthMaximum\r | |
49 | } EFI_CPU_IO_PROTOCOL_WIDTH;\r | |
50 | \r | |
79964ac8 | 51 | /**\r |
52 | Enables a driver to access memory-mapped registers in the EFI system memory space.\r | |
53 | Or, Enables a driver to access registers in the EFI CPU I/O space.\r | |
54 | \r | |
e5fe626f | 55 | @param[in] This A pointer to the EFI_CPU_IO_PROTOCOL instance.\r |
56 | @param[in] Width Signifies the width of the I/O or Memory operation.\r | |
57 | @param[in] Address The base address of the I/O or Memoryoperation.\r | |
58 | @param[in] Count The number of I/O or Memory operations to perform.\r | |
79964ac8 | 59 | The number of bytes moved is Width size * Count, starting at Address.\r |
e5fe626f | 60 | @param[in, out] Buffer For read operations, the destination buffer to store the results.\r |
79964ac8 | 61 | For write operations, the source buffer from which to write data.\r |
62 | \r | |
63 | @retval EFI_SUCCESS The data was read from or written to the EFI system.\r | |
64 | @retval EFI_INVALID_PARAMETER Width is invalid for this EFI system.Or Buffer is NULL.\r | |
65 | @retval EFI_UNSUPPORTED The Buffer is not aligned for the given Width.\r | |
66 | Or,The address range specified by Address, Width, and Count is not valid for this EFI system.\r | |
67 | \r | |
68 | **/\r | |
69 | typedef\r | |
70 | EFI_STATUS\r | |
69686d56 | 71 | (EFIAPI *EFI_CPU_IO_PROTOCOL_IO_MEM)(\r |
6c23910c | 72 | IN EFI_CPU_IO_PROTOCOL *This,\r |
73 | IN EFI_CPU_IO_PROTOCOL_WIDTH Width,\r | |
74 | IN UINT64 Address,\r | |
75 | IN UINTN Count,\r | |
76 | IN OUT VOID *Buffer\r | |
79964ac8 | 77 | );\r |
78 | \r | |
c7154234 | 79 | ///\r |
80 | /// Servies for read and write accesses.\r | |
81 | ///\r | |
79964ac8 | 82 | typedef struct {\r |
c7154234 | 83 | ///\r |
84 | /// This service provides the various modalities of memory and I/O read.\r | |
85 | ///\r | |
79964ac8 | 86 | EFI_CPU_IO_PROTOCOL_IO_MEM Read;\r |
c7154234 | 87 | ///\r |
88 | /// This service provides the various modalities of memory and I/O write.\r | |
89 | ///\r | |
79964ac8 | 90 | EFI_CPU_IO_PROTOCOL_IO_MEM Write;\r |
91 | } EFI_CPU_IO_PROTOCOL_ACCESS;\r | |
92 | \r | |
c7154234 | 93 | ///\r |
94 | /// Provides the basic memory and I/O interfaces that are used to abstract\r | |
95 | /// accesses to devices in a system.\r | |
96 | ///\r | |
79964ac8 | 97 | struct _EFI_CPU_IO_PROTOCOL {\r |
c7154234 | 98 | ///\r |
99 | /// Enables a driver to access memory-mapped registers in the EFI system memory space.\r | |
100 | ///\r | |
79964ac8 | 101 | EFI_CPU_IO_PROTOCOL_ACCESS Mem;\r |
c7154234 | 102 | ///\r |
103 | /// Enables a driver to access registers in the EFI CPU I/O space.\r | |
104 | ///\r | |
79964ac8 | 105 | EFI_CPU_IO_PROTOCOL_ACCESS Io;\r |
106 | };\r | |
107 | \r | |
108 | extern EFI_GUID gEfiCpuIoProtocolGuid;\r | |
109 | \r | |
110 | #endif\r |