1 /** @file
2   SMM CPU I/O protocol as defined in the Intel Framework specification.
3 
4   This protocol provides CPU I/O and memory access within SMM.
5 
6 Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
7 This program and the accompanying materials are licensed and made available under
8 the terms and conditions of the BSD License that accompanies this distribution.
9 The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php.
11 
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14 
15 **/
16 
17 #ifndef _SMM_CPU_IO_H_
18 #define _SMM_CPU_IO_H_
19 
20 #include <Protocol/SmmCpuIo2.h>
21 
22 #define EFI_SMM_CPU_IO_GUID \
23   { \
24     0x5f439a0b, 0x45d8, 0x4682, {0xa4, 0xf4, 0xf0, 0x57, 0x6b, 0x51, 0x34, 0x41} \
25   }
26 
27 typedef struct _EFI_SMM_CPU_IO_INTERFACE EFI_SMM_CPU_IO_INTERFACE;
28 
29 /**
30   Provides the basic memory and I/O interfaces used to abstract accesses to devices.
31 
32   The I/O operations are carried out exactly as requested.  The caller is
33   responsible for any alignment and I/O width issues that the bus, device,
34   platform, or type of I/O might require.
35 
36   @param[in]      This     The EFI_SMM_CPU_IO_INTERFACE instance.
37   @param[in]      Width    Signifies the width of the I/O operations.
38   @param[in]      Address  The base address of the I/O operations.  The caller is
39                            responsible for aligning the Address, if required.
40   @param[in]      Count    The number of I/O operations to perform.
41   @param[in,out]  Buffer   For read operations, the destination buffer to store
42                            the results.  For write operations, the source buffer
43                            from which to write data.
44 
45   @retval EFI_SUCCESS            The data was read from or written to the device.
46   @retval EFI_UNSUPPORTED        The Address is not valid for this system.
47   @retval EFI_INVALID_PARAMETER  Width or Count, or both, were invalid.
48   @retval EFI_OUT_OF_RESOURCES   The request could not be completed due to a lack
49                                  of resources.
50 **/
51 typedef
52 EFI_STATUS
53 (EFIAPI *EFI_SMM_CPU_IO)(
54   IN     EFI_SMM_CPU_IO_INTERFACE       *This,
55   IN     EFI_SMM_IO_WIDTH               Width,
56   IN     UINT64                         Address,
57   IN     UINTN                          Count,
58   IN OUT VOID                           *Buffer
59   );
60 
61 typedef struct {
62   ///
63   /// This service provides the various modalities of memory and I/O read.
64   ///
65   EFI_SMM_CPU_IO  Read;
66   ///
67   /// This service provides the various modalities of memory and I/O write.
68   ///
69   EFI_SMM_CPU_IO  Write;
70 } EFI_SMM_IO_ACCESS;
71 
72 ///
73 /// SMM CPU I/O Protocol provides CPU I/O and memory access within SMM.
74 ///
75 struct _EFI_SMM_CPU_IO_INTERFACE {
76   ///
77   /// Allows reads and writes to memory-mapped I/O space.
78   ///
79   EFI_SMM_IO_ACCESS Mem;
80   ///
81   /// Allows reads and writes to I/O space.
82   ///
83   EFI_SMM_IO_ACCESS Io;
84 };
85 
86 extern EFI_GUID gEfiSmmCpuIoGuid;
87 
88 #endif
89