• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /** @file
2   Runtime Architectural Protocol as defined in PI Specification VOLUME 2 DXE
3 
4   Allows the runtime functionality of the DXE Foundation to be contained
5   in a separate driver. It also provides hooks for the DXE Foundation to
6   export information that is needed at runtime. As such, this protocol allows
7   services to the DXE Foundation to manage runtime drivers and events.
8   This protocol also implies that the runtime services required to transition
9   to virtual mode, SetVirtualAddressMap() and ConvertPointer(), have been
10   registered into the UEFI Runtime Table in the UEFI System Table. This protocol
11   must be produced by a runtime DXE driver and may only be consumed by the DXE Foundation.
12 
13   Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
14   This program and the accompanying materials
15   are licensed and made available under the terms and conditions of the BSD License
16   which accompanies this distribution.  The full text of the license may be found at
17   http://opensource.org/licenses/bsd-license.php
18 
19   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
20   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
21 
22 **/
23 
24 #ifndef __ARCH_PROTOCOL_RUNTIME_H__
25 #define __ARCH_PROTOCOL_RUNTIME_H__
26 
27 ///
28 /// Global ID for the Runtime Architectural Protocol
29 ///
30 #define EFI_RUNTIME_ARCH_PROTOCOL_GUID \
31   { 0xb7dfb4e1, 0x52f, 0x449f, {0x87, 0xbe, 0x98, 0x18, 0xfc, 0x91, 0xb7, 0x33 } }
32 
33 typedef struct _EFI_RUNTIME_ARCH_PROTOCOL  EFI_RUNTIME_ARCH_PROTOCOL;
34 
35 ///
36 /// LIST_ENTRY from BaseType
37 ///
38 typedef LIST_ENTRY EFI_LIST_ENTRY;
39 
40 typedef struct _EFI_RUNTIME_IMAGE_ENTRY  EFI_RUNTIME_IMAGE_ENTRY;
41 
42 ///
43 /// EFI_RUNTIME_IMAGE_ENTRY
44 ///
45 struct _EFI_RUNTIME_IMAGE_ENTRY {
46   ///
47   /// Start of image that has been loaded in memory. It is a pointer
48   /// to either the DOS header or PE header of the image.
49   ///
50   VOID                    *ImageBase;
51   ///
52   /// Size in bytes of the image represented by ImageBase.
53   ///
54   UINT64                  ImageSize;
55   ///
56   /// Information about the fix-ups that were performed on ImageBase when it was
57   /// loaded into memory.
58   ///
59   VOID                    *RelocationData;
60   ///
61   /// The ImageHandle passed into ImageBase when it was loaded.
62   ///
63   EFI_HANDLE              Handle;
64   ///
65   /// Entry for this node in the EFI_RUNTIME_ARCHITECTURE_PROTOCOL.ImageHead list.
66   ///
67   EFI_LIST_ENTRY          Link;
68 };
69 
70 typedef struct _EFI_RUNTIME_EVENT_ENTRY  EFI_RUNTIME_EVENT_ENTRY;
71 
72 ///
73 /// EFI_RUNTIME_EVENT_ENTRY
74 ///
75 struct _EFI_RUNTIME_EVENT_ENTRY {
76   ///
77   /// The same as Type passed into CreateEvent().
78   ///
79   UINT32                  Type;
80   ///
81   /// The same as NotifyTpl passed into CreateEvent().
82   ///
83   EFI_TPL                 NotifyTpl;
84   ///
85   /// The same as NotifyFunction passed into CreateEvent().
86   ///
87   EFI_EVENT_NOTIFY        NotifyFunction;
88   ///
89   /// The same as NotifyContext passed into CreateEvent().
90   ///
91   VOID                    *NotifyContext;
92   ///
93   /// The EFI_EVENT returned by CreateEvent(). Event must be in runtime memory.
94   ///
95   EFI_EVENT               *Event;
96   ///
97   /// Entry for this node in the
98   /// EFI_RUNTIME_ARCHITECTURE_PROTOCOL.EventHead list.
99   ///
100   EFI_LIST_ENTRY          Link;
101 };
102 
103 ///
104 /// Allows the runtime functionality of the DXE Foundation to be contained in a
105 /// separate driver. It also provides hooks for the DXE Foundation to export
106 /// information that is needed at runtime. As such, this protocol allows the DXE
107 /// Foundation to manage runtime drivers and events. This protocol also implies
108 /// that the runtime services required to transition to virtual mode,
109 /// SetVirtualAddressMap() and ConvertPointer(), have been registered into the
110 /// EFI Runtime Table in the EFI System Partition.  This protocol must be produced
111 /// by a runtime DXE driver and may only be consumed by the DXE Foundation.
112 ///
113 struct _EFI_RUNTIME_ARCH_PROTOCOL {
114   EFI_LIST_ENTRY          ImageHead;    ///< A list of type EFI_RUNTIME_IMAGE_ENTRY.
115   EFI_LIST_ENTRY          EventHead;    ///< A list of type EFI_RUNTIME_EVENT_ENTRY.
116   UINTN                   MemoryDescriptorSize;   ///< Size of a memory descriptor that is returned by GetMemoryMap().
117   UINT32                  MemoryDesciptorVersion; ///< Version of a memory descriptor that is returned by GetMemoryMap().
118   UINTN                   MemoryMapSize;///< Size of the memory map in bytes contained in MemoryMapPhysical and MemoryMapVirtual.
119   EFI_MEMORY_DESCRIPTOR   *MemoryMapPhysical;     ///< Pointer to a runtime buffer that contains a copy of
120                                                   ///< the memory map returned via GetMemoryMap().
121   EFI_MEMORY_DESCRIPTOR   *MemoryMapVirtual;      ///< Pointer to MemoryMapPhysical that is updated to virtual mode after SetVirtualAddressMap().
122   BOOLEAN                 VirtualMode;  ///< Boolean that is TRUE if SetVirtualAddressMap() has been called.
123   BOOLEAN                 AtRuntime;    ///< Boolean that is TRUE if ExitBootServices () has been called.
124 };
125 
126 extern EFI_GUID gEfiRuntimeArchProtocolGuid;
127 
128 #endif
129