blob: f9f8f315ab637e234af4cd7dbd045b35e468982a [file] [log] [blame]
klu218b84852008-03-19 05:11:21 +00001/** @file
klu2ca162102007-12-21 08:48:38 +00002
lgao4db4d3fa2011-09-20 02:12:45 +00003Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
hhtianb1f700a2010-04-28 12:39:50 +00004This program and the accompanying materials
klu2ca162102007-12-21 08:48:38 +00005are licensed and made available under the terms and conditions of the BSD License
6which accompanies this distribution. The full text of the license may be found at
7http://opensource.org/licenses/bsd-license.php
8
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12Module Name:
13 HobGeneration.h
14
15Abstract:
16
17Revision History:
18
klu218b84852008-03-19 05:11:21 +000019**/
klu2ca162102007-12-21 08:48:38 +000020
21#ifndef _DXELDR_HOB_GENERATION_H_
22#define _DXELDR_HOB_GENERATION_H_
23
24#include "DxeIpl.h"
25
26#define EFI_MEMORY_BELOW_1MB_START 0x86000
27#define EFI_MEMORY_BELOW_1MB_END 0x9F800
28#define EFI_MEMORY_STACK_PAGE_NUM 0x20
eric_tiane843cdd2010-01-19 08:28:28 +000029#define CONSUMED_MEMORY 0x100000 * 80
klu2ca162102007-12-21 08:48:38 +000030
31#define NV_STORAGE_START 0x15000
32#define NV_STORAGE_STATE 0x19000
33
klu2ca162102007-12-21 08:48:38 +000034#pragma pack(1)
35
36typedef struct {
37 EFI_HOB_GUID_TYPE Hob;
38 EFI_MEMORY_TYPE_INFORMATION Info[10];
39} MEMORY_TYPE_INFORMATION_HOB;
40
41typedef struct {
42 EFI_HOB_GUID_TYPE Hob;
43 EFI_PHYSICAL_ADDRESS Table;
44} TABLE_HOB;
45
46typedef struct {
47 EFI_HOB_GUID_TYPE Hob;
niruiyud555d902010-02-25 03:28:18 +000048 EFI_PHYSICAL_ADDRESS Interface;
klu2ca162102007-12-21 08:48:38 +000049} PROTOCOL_HOB;
50
51typedef struct {
klu2ca162102007-12-21 08:48:38 +000052 EFI_HOB_GUID_TYPE Hob;
53 // Note: we get only one PCI Segment now.
54 EFI_PCI_EXPRESS_BASE_ADDRESS_INFORMATION PciExpressBaseAddressInfo;
55} PCI_EXPRESS_BASE_HOB;
56
57typedef struct {
58 EFI_HOB_GUID_TYPE Hob;
59 EFI_ACPI_DESCRIPTION AcpiDescription;
60} ACPI_DESCRIPTION_HOB;
61
62typedef struct {
63 EFI_HOB_GUID_TYPE Hob;
64 EFI_FLASH_MAP_FS_ENTRY_DATA FvbInfo;
65} FVB_HOB;
66
67typedef struct {
68 EFI_HOB_HANDOFF_INFO_TABLE Phit;
69 EFI_HOB_FIRMWARE_VOLUME Bfv;
70 EFI_HOB_RESOURCE_DESCRIPTOR BfvResource;
71 EFI_HOB_CPU Cpu;
72 EFI_HOB_MEMORY_ALLOCATION_STACK Stack;
73 EFI_HOB_MEMORY_ALLOCATION MemoryAllocation;
74 EFI_HOB_RESOURCE_DESCRIPTOR MemoryFreeUnder1MB;
75 EFI_HOB_RESOURCE_DESCRIPTOR MemoryAbove1MB;
76 EFI_HOB_RESOURCE_DESCRIPTOR MemoryAbove4GB;
77 EFI_HOB_MEMORY_ALLOCATION_MODULE DxeCore;
gikidyd569cbb2009-06-30 05:47:12 +000078 EFI_HOB_RESOURCE_DESCRIPTOR MemoryDxeCore;
klu2ca162102007-12-21 08:48:38 +000079 MEMORY_TYPE_INFORMATION_HOB MemoryTypeInfo;
80 TABLE_HOB Acpi;
81 TABLE_HOB Acpi20;
82 TABLE_HOB Smbios;
83 TABLE_HOB Mps;
84 /**
85 PROTOCOL_HOB FlushInstructionCache;
86 PROTOCOL_HOB TransferControl;
87 PROTOCOL_HOB PeCoffLoader;
88 PROTOCOL_HOB EfiDecompress;
89 PROTOCOL_HOB TianoDecompress;
90 **/
91 PROTOCOL_HOB SerialStatusCode;
92 MEMORY_DESC_HOB MemoryDescriptor;
93 PCI_EXPRESS_BASE_HOB PciExpress;
94 ACPI_DESCRIPTION_HOB AcpiInfo;
95
96 EFI_HOB_RESOURCE_DESCRIPTOR NvStorageFvResource;
97
98 FVB_HOB NvStorageFvb;
99 FVB_HOB NvStorage;
gikidyd569cbb2009-06-30 05:47:12 +0000100
101 EFI_HOB_RESOURCE_DESCRIPTOR NvFtwFvResource;
klu2ca162102007-12-21 08:48:38 +0000102 FVB_HOB NvFtwFvb;
103 FVB_HOB NvFtwWorking;
104 FVB_HOB NvFtwSpare;
105
106 EFI_HOB_GENERIC_HEADER EndOfHobList;
107} HOB_TEMPLATE;
108
109#pragma pack()
110
111extern HOB_TEMPLATE *gHob;
112
113VOID *
114PrepareHobStack (
115 IN VOID *StackTop
116 );
117
118VOID
119PrepareHobBfv (
120 VOID *Bfv,
121 UINTN BfvLength
122 );
123
124VOID *
125PrepareHobMemory (
126 IN UINTN NumberOfMemoryMapEntries,
127 IN EFI_MEMORY_DESCRIPTOR *EfiMemoryDescriptor
128 );
129
130VOID
131PrepareHobDxeCore (
132 VOID *DxeCoreEntryPoint,
133 EFI_PHYSICAL_ADDRESS DxeCoreImageBase,
134 UINT64 DxeCoreLength
135 );
136
137VOID *
138PreparePageTable (
139 VOID *PageNumberTop,
140 UINT8 SizeOfMemorySpace
141 );
142
143VOID *
144PrepareHobMemoryDescriptor (
145 VOID *MemoryDescriptorTop,
146 UINTN MemDescCount,
147 EFI_MEMORY_DESCRIPTOR *MemDesc
148 );
149
150VOID
151PrepareHobPhit (
152 VOID *MemoryTop,
153 VOID *FreeMemoryTop
154 );
155
156VOID *
157PrepareHobNvStorage (
158 VOID *NvStorageTop
159 );
160
161VOID
162PrepareHobCpu (
163 VOID
164 );
165
166VOID
167CompleteHobGeneration (
168 VOID
169 );
170
171#endif