summaryrefslogtreecommitdiff
path: root/DuetPkg/DxeIpl/HobGeneration.h
blob: fe0b9a933dd4cdf8616b0fc83e17fa191607bb91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
/** @file

Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials                          
are licensed and made available under the terms and conditions of the BSD License         
which accompanies this distribution.  The full text of the license may be found at        
http://opensource.org/licenses/bsd-license.php                                            
                                                                                          
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

Module Name:
  HobGeneration.h

Abstract:

Revision History:

**/

#ifndef _DXELDR_HOB_GENERATION_H_
#define _DXELDR_HOB_GENERATION_H_

#include "DxeIpl.h"

#define EFI_MEMORY_BELOW_1MB_START     0x86000
#define EFI_MEMORY_BELOW_1MB_END       0x9F800
#define EFI_MEMORY_STACK_PAGE_NUM      0x20
#define CONSUMED_MEMORY                0x100000 * 80

#define NV_STORAGE_START               0x15000
#define NV_STORAGE_STATE               0x19000

#define EFI_LDR_MEMORY_DESCRIPTOR_GUID \
  { 0x7701d7e5, 0x7d1d, 0x4432, {0xa4, 0x68, 0x67, 0x3d, 0xab, 0x8a, 0xde, 0x60}}

#pragma pack(1)

typedef struct {
  EFI_HOB_GUID_TYPE             Hob;
  EFI_MEMORY_TYPE_INFORMATION   Info[10];
} MEMORY_TYPE_INFORMATION_HOB;

typedef struct {
  EFI_HOB_GUID_TYPE             Hob;
  EFI_PHYSICAL_ADDRESS          Table;
} TABLE_HOB;

typedef struct {
  EFI_HOB_GUID_TYPE             Hob;
  EFI_PHYSICAL_ADDRESS          Interface;
} PROTOCOL_HOB;

typedef struct {
  EFI_HOB_GUID_TYPE             Hob;
  UINTN                         MemDescCount;
  EFI_MEMORY_DESCRIPTOR         *MemDesc;
} MEMORY_DESC_HOB;

typedef struct {
  EFI_HOB_GUID_TYPE                         Hob;
  // Note: we get only one PCI Segment now.
  EFI_PCI_EXPRESS_BASE_ADDRESS_INFORMATION  PciExpressBaseAddressInfo;
} PCI_EXPRESS_BASE_HOB;

typedef struct {
  EFI_HOB_GUID_TYPE             Hob;
  EFI_ACPI_DESCRIPTION          AcpiDescription;
} ACPI_DESCRIPTION_HOB;

typedef struct {
  EFI_HOB_GUID_TYPE             Hob;
  EFI_FLASH_MAP_FS_ENTRY_DATA   FvbInfo;
} FVB_HOB;

typedef struct {
  EFI_HOB_HANDOFF_INFO_TABLE        Phit;
  EFI_HOB_FIRMWARE_VOLUME           Bfv;
  EFI_HOB_RESOURCE_DESCRIPTOR       BfvResource;
  EFI_HOB_CPU                       Cpu;
  EFI_HOB_MEMORY_ALLOCATION_STACK   Stack;
  EFI_HOB_MEMORY_ALLOCATION         MemoryAllocation;
  EFI_HOB_RESOURCE_DESCRIPTOR       MemoryFreeUnder1MB;
  EFI_HOB_RESOURCE_DESCRIPTOR       MemoryAbove1MB;
  EFI_HOB_RESOURCE_DESCRIPTOR       MemoryAbove4GB;
  EFI_HOB_MEMORY_ALLOCATION_MODULE  DxeCore;
  EFI_HOB_RESOURCE_DESCRIPTOR       MemoryDxeCore;
  MEMORY_TYPE_INFORMATION_HOB       MemoryTypeInfo;
  TABLE_HOB                         Acpi;
  TABLE_HOB                         Acpi20;
  TABLE_HOB                         Smbios;
  TABLE_HOB                         Mps;
  /**
  PROTOCOL_HOB                      FlushInstructionCache;
  PROTOCOL_HOB                      TransferControl;
  PROTOCOL_HOB                      PeCoffLoader;
  PROTOCOL_HOB                      EfiDecompress;
  PROTOCOL_HOB                      TianoDecompress;
  **/
  PROTOCOL_HOB                      SerialStatusCode;
  MEMORY_DESC_HOB                   MemoryDescriptor;
  PCI_EXPRESS_BASE_HOB              PciExpress;
  ACPI_DESCRIPTION_HOB              AcpiInfo;
  
  EFI_HOB_RESOURCE_DESCRIPTOR       NvStorageFvResource;

  FVB_HOB                           NvStorageFvb;
  FVB_HOB                           NvStorage;
  
  EFI_HOB_RESOURCE_DESCRIPTOR       NvFtwFvResource;
  FVB_HOB                           NvFtwFvb;
  FVB_HOB                           NvFtwWorking;
  FVB_HOB                           NvFtwSpare;
  
  EFI_HOB_GENERIC_HEADER            EndOfHobList;
} HOB_TEMPLATE;

#pragma pack()

extern HOB_TEMPLATE  *gHob;

VOID *
PrepareHobStack (
  IN VOID *StackTop
  );

VOID
PrepareHobBfv (
  VOID  *Bfv,
  UINTN BfvLength
  );

VOID *
PrepareHobMemory (
  IN UINTN                    NumberOfMemoryMapEntries,
  IN EFI_MEMORY_DESCRIPTOR    *EfiMemoryDescriptor
  );

VOID
PrepareHobDxeCore (
  VOID                  *DxeCoreEntryPoint,
  EFI_PHYSICAL_ADDRESS  DxeCoreImageBase,
  UINT64                DxeCoreLength
  );

VOID *
PreparePageTable (
  VOID  *PageNumberTop,
  UINT8 SizeOfMemorySpace
  );

VOID *
PrepareHobMemoryDescriptor (
  VOID                          *MemoryDescriptorTop,
  UINTN                         MemDescCount,
  EFI_MEMORY_DESCRIPTOR         *MemDesc
  );

VOID
PrepareHobPhit (
  VOID *MemoryTop,
  VOID *FreeMemoryTop
  );

VOID *
PrepareHobNvStorage (
  VOID *NvStorageTop
  );

VOID
PrepareHobCpu (
  VOID
  );

VOID
CompleteHobGeneration (
  VOID
  );

#endif