runtime.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. /*++
  2. Copyright (c) 2014 Minoca Corp. All Rights Reserved
  3. Module Name:
  4. runtime.h
  5. Abstract:
  6. This header contains definitions for the EFI runtime architectural protocol.
  7. Author:
  8. Evan Green 4-Mar-2014
  9. --*/
  10. //
  11. // ------------------------------------------------------------------- Includes
  12. //
  13. //
  14. // ---------------------------------------------------------------- Definitions
  15. //
  16. #define EFI_RUNTIME_ARCH_PROTOCOL_GUID \
  17. { \
  18. 0xB7DFB4E1, 0x052F, 0x449F, \
  19. {0x87, 0xBE, 0x98, 0x18, 0xFC, 0x91, 0xB7, 0x33} \
  20. }
  21. //
  22. // ------------------------------------------------------ Data Type Definitions
  23. //
  24. /*++
  25. Structure Description:
  26. This structure stores runtime data about a loaded image.
  27. Members:
  28. ListEntry - Stores pointers to the next and previous runtime image entries.
  29. ImageBase - Stores a pointer to the start of the image loaded in memory. It
  30. is a pointer to either the DOS header or PE header of the image.
  31. ImageSize - Supplies the size in bytes of the image.
  32. RelocationData - Stores a pointer to the relocation information.
  33. Handle - Stores the image handle corresponding with this image.
  34. --*/
  35. typedef struct _EFI_RUNTIME_IMAGE_ENTRY {
  36. LIST_ENTRY ListEntry;
  37. VOID *ImageBase;
  38. UINT64 ImageSize;
  39. VOID *RelocationData;
  40. EFI_HANDLE Handle;
  41. } EFI_RUNTIME_IMAGE_ENTRY, *PEFI_RUNTIME_IMAGE_ENTRY;
  42. /*++
  43. Structure Description:
  44. This structure stores runtime data about an event.
  45. Members:
  46. ListEntry - Stores pointers to the next and previous runtime event entries.
  47. Type - Stores the type of event.
  48. NotifyTpl - Stores the task priority level of the event.
  49. NotifyFunction - Stores a pointer to a function called when the event fires.
  50. NotifyContext - Stores a pointer's worth of data passed to the notify
  51. function.
  52. Event - Stores a pointer to the parent event structure.
  53. --*/
  54. typedef struct _EFI_RUNTIME_EVENT_ENTRY {
  55. LIST_ENTRY ListEntry;
  56. UINT32 Type;
  57. EFI_TPL NotifyTpl;
  58. EFI_EVENT_NOTIFY NotifyFunction;
  59. VOID *NotifyContext;
  60. EFI_EVENT *Event;
  61. } EFI_RUNTIME_EVENT_ENTRY, *PEFI_RUNTIME_EVENT_ENTRY;
  62. /*++
  63. Structure Description:
  64. This structure stores the EFI runtime architectural protocol, providing the
  65. handoff between the core and runtime environments.
  66. Members:
  67. ImageListHead - Stores the head of the list of runtime image entries.
  68. EventListHead - Stores the head of the list of runtime events.
  69. MemoryDescriptorSize - Stores the size in bytes of a memory descriptor.
  70. MemoryDescriptorVersion - Stores the memory descriptor version number.
  71. MemoryMapSize - Stores the total size of the memory map in bytes.
  72. MemoryMapPhysical - Stores a physical pointer to the memory map.
  73. MemoryMapVirtual - Stores a virtual pointer to the memory map if the core
  74. has been virtualized.
  75. VirtualMode - Stores a boolean indicating if SetVirtualAddressMap has been
  76. called.
  77. AtRuntime - Stores a boolean indicating if ExitBootServices has been called.
  78. --*/
  79. typedef struct _EFI_RUNTIME_ARCH_PROTOCOL {
  80. LIST_ENTRY ImageListHead;
  81. LIST_ENTRY EventListHead;
  82. UINTN MemoryDescriptorSize;
  83. UINT32 MemoryDescriptorVersion;
  84. UINTN MemoryMapSize;
  85. EFI_MEMORY_DESCRIPTOR *MemoryMapPhysical;
  86. EFI_MEMORY_DESCRIPTOR *MemoryMapVirtual;
  87. BOOLEAN VirtualMode;
  88. BOOLEAN AtRuntime;
  89. } EFI_RUNTIME_ARCH_PROTOCOL, *PEFI_RUNTIME_ARCH_PROTOCOL;
  90. //
  91. // -------------------------------------------------------------------- Globals
  92. //
  93. //
  94. // -------------------------------------------------------- Function Prototypes
  95. //
  96. EFIAPI
  97. EFI_STATUS
  98. EfiCoreCalculateCrc32 (
  99. VOID *Data,
  100. UINTN DataSize,
  101. UINT32 *Crc32
  102. );
  103. /*++
  104. Routine Description:
  105. This routine computes the 32-bit CRC for a data buffer.
  106. Arguments:
  107. Data - Supplies a pointer to the buffer to compute the CRC on.
  108. DataSize - Supplies the size of the data buffer in bytes.
  109. Crc32 - Supplies a pointer where the 32-bit CRC will be returned.
  110. Return Value:
  111. EFI_SUCCESS on success.
  112. EFI_INVALID_PARAMETER if any parameter is NULL, or the data size is zero.
  113. --*/