]>
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 | \r |
79964ac8 | 24 | #define EFI_CPU_IO_PROTOCOL_GUID \\r |
25 | { \\r | |
26 | 0xB0732526, 0x38C8, 0x4b40, {0x88, 0x77, 0x61, 0xC7, 0xB0, 0x6A, 0xAC, 0x45 } \\r | |
27 | }\r | |
28 | \r | |
29 | typedef struct _EFI_CPU_IO_PROTOCOL EFI_CPU_IO_PROTOCOL;\r | |
30 | \r | |
c7154234 | 31 | ///\r |
32 | /// Enumeration that defines the width of the I/O operation.\r | |
33 | ///\r | |
79964ac8 | 34 | typedef enum {\r |
35 | EfiCpuIoWidthUint8,\r | |
36 | EfiCpuIoWidthUint16,\r | |
37 | EfiCpuIoWidthUint32,\r | |
38 | EfiCpuIoWidthUint64,\r | |
39 | EfiCpuIoWidthFifoUint8,\r | |
40 | EfiCpuIoWidthFifoUint16,\r | |
41 | EfiCpuIoWidthFifoUint32,\r | |
42 | EfiCpuIoWidthFifoUint64,\r | |
43 | EfiCpuIoWidthFillUint8,\r | |
44 | EfiCpuIoWidthFillUint16,\r | |
45 | EfiCpuIoWidthFillUint32,\r | |
46 | EfiCpuIoWidthFillUint64,\r | |
47 | EfiCpuIoWidthMaximum\r | |
48 | } EFI_CPU_IO_PROTOCOL_WIDTH;\r | |
49 | \r | |
79964ac8 | 50 | /**\r |
51 | Enables a driver to access memory-mapped registers in the EFI system memory space.\r | |
5259c97d | 52 | Or, enables a driver to access registers in the EFI CPU I/O space.\r |
79964ac8 | 53 | \r |
e5fe626f | 54 | @param[in] This A pointer to the EFI_CPU_IO_PROTOCOL instance.\r |
55 | @param[in] Width Signifies the width of the I/O or Memory operation.\r | |
5259c97d | 56 | @param[in] Address The base address of the I/O or Memory operation.\r |
e5fe626f | 57 | @param[in] Count The number of I/O or Memory operations to perform.\r |
79964ac8 | 58 | The number of bytes moved is Width size * Count, starting at Address.\r |
e5fe626f | 59 | @param[in, out] Buffer For read operations, the destination buffer to store the results.\r |
79964ac8 | 60 | For write operations, the source buffer from which to write data.\r |
61 | \r | |
62 | @retval EFI_SUCCESS The data was read from or written to the EFI system.\r | |
5259c97d | 63 | @retval EFI_INVALID_PARAMETER Width is invalid for this EFI system. Or Buffer is NULL.\r |
79964ac8 | 64 | @retval EFI_UNSUPPORTED The Buffer is not aligned for the given Width.\r |
65 | Or,The address range specified by Address, Width, and Count is not valid for this EFI system.\r | |
66 | \r | |
67 | **/\r | |
68 | typedef\r | |
69 | EFI_STATUS\r | |
69686d56 | 70 | (EFIAPI *EFI_CPU_IO_PROTOCOL_IO_MEM)(\r |
6c23910c | 71 | IN EFI_CPU_IO_PROTOCOL *This,\r |
72 | IN EFI_CPU_IO_PROTOCOL_WIDTH Width,\r | |
73 | IN UINT64 Address,\r | |
74 | IN UINTN Count,\r | |
75 | IN OUT VOID *Buffer\r | |
79964ac8 | 76 | );\r |
77 | \r | |
c7154234 | 78 | ///\r |
5259c97d | 79 | /// Service for read and write accesses.\r |
c7154234 | 80 | ///\r |
79964ac8 | 81 | typedef struct {\r |
c7154234 | 82 | ///\r |
83 | /// This service provides the various modalities of memory and I/O read.\r | |
84 | ///\r | |
79964ac8 | 85 | EFI_CPU_IO_PROTOCOL_IO_MEM Read;\r |
c7154234 | 86 | ///\r |
87 | /// This service provides the various modalities of memory and I/O write.\r | |
88 | ///\r | |
79964ac8 | 89 | EFI_CPU_IO_PROTOCOL_IO_MEM Write;\r |
90 | } EFI_CPU_IO_PROTOCOL_ACCESS;\r | |
91 | \r | |
c7154234 | 92 | ///\r |
93 | /// Provides the basic memory and I/O interfaces that are used to abstract\r | |
94 | /// accesses to devices in a system.\r | |
95 | ///\r | |
79964ac8 | 96 | struct _EFI_CPU_IO_PROTOCOL {\r |
c7154234 | 97 | ///\r |
98 | /// Enables a driver to access memory-mapped registers in the EFI system memory space.\r | |
99 | ///\r | |
79964ac8 | 100 | EFI_CPU_IO_PROTOCOL_ACCESS Mem;\r |
c7154234 | 101 | ///\r |
102 | /// Enables a driver to access registers in the EFI CPU I/O space.\r | |
103 | ///\r | |
79964ac8 | 104 | EFI_CPU_IO_PROTOCOL_ACCESS Io;\r |
105 | };\r | |
106 | \r | |
107 | extern EFI_GUID gEfiCpuIoProtocolGuid;\r | |
108 | \r | |
109 | #endif\r |