2 # Copyright (c) 2011-2015, ARM Limited. All rights reserved.
3 # Copyright (c) 2014, Linaro Limited. All rights reserved.
4 # Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
6 # SPDX-License-Identifier: BSD-2-Clause-Patent
9 ################################################################################
12 # The [FD] Section is made up of the definition statements and a
13 # description of what goes into the Flash Device Image. Each FD section
14 # defines one flash "device" image. A flash device image may be one of
15 # the following: Removable media bootable image (like a boot floppy
16 # image,) an Option ROM image (that would be "flashed" into an add-in
17 # card,) a System "Flash" image (that would be burned into a system's
18 # flash) or an Update ("Capsule") image that will be used to update and
19 # existing system flash.
21 ################################################################################
24 !if $(FD_SIZE_IN_MB) == 2
25 DEFINE FVMAIN_COMPACT_SIZE = 0x1f8000
27 !if $(FD_SIZE_IN_MB) == 3
28 DEFINE FVMAIN_COMPACT_SIZE = 0x2f8000
32 BaseAddress = 0x00000000|gArmTokenSpaceGuid.PcdFdBaseAddress # QEMU assigns 0 - 0x8000000 for a BootROM
33 Size = $(FD_SIZE)|gArmTokenSpaceGuid.PcdFdSize # The size in bytes of the FLASH Device
36 # This one is tricky, it must be: BlockSize * NumBlocks = Size
37 BlockSize = 0x00001000
38 NumBlocks = $(FD_NUM_BLOCKS)
40 ################################################################################
42 # Following are lists of FD Region layout which correspond to the locations of different
43 # images within the flash device.
45 # Regions must be defined in ascending order and may not overlap.
47 # A Layout Region start with a eight digit hex offset (leading "0x" required) followed by
48 # the pipe "|" character, followed by the size of the region, also in hex with the leading
49 # "0x" characters. Like:
51 # PcdOffsetCName|PcdSizeCName
52 # RegionType <FV, DATA, or FILE>
54 ################################################################################
57 # Implement the Linux kernel header layout so that the loader will identify
58 # it as something bootable, and execute it with a FDT pointer in x0 or r2.
59 # This area will be reused to store a copy of the FDT so round it up to 32 KB.
63 !if $(ARCH) == AARCH64
64 0x01, 0x00, 0x00, 0x10, # code0: adr x1, .
65 0xff, 0x1f, 0x00, 0x14, # code1: b 0x8000
66 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, # text_offset: 512 KB
67 !if $(FD_SIZE_IN_MB) == 2
68 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, # image_size: 2 MB
70 !if $(FD_SIZE_IN_MB) == 3
71 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, # image_size: 3 MB
73 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # flags
74 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # res2
75 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # res3
76 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # res4
77 0x41, 0x52, 0x4d, 0x64, # magic: "ARM\x64"
78 0x00, 0x00, 0x00, 0x00 # res5
80 0x08, 0x10, 0x4f, 0xe2, # adr r1, .
81 0x02, 0x00, 0xa0, 0xe1, # mov r0, r2 (DTB)
82 0x00, 0x00, 0xa0, 0xe1, # nop
83 0x00, 0x00, 0xa0, 0xe1, # nop
84 0x00, 0x00, 0xa0, 0xe1, # nop
85 0x00, 0x00, 0xa0, 0xe1, # nop
86 0x00, 0x00, 0xa0, 0xe1, # nop
87 0x00, 0x00, 0xa0, 0xe1, # nop
89 0xf6, 0x1f, 0x00, 0xea, # b 0x8000
90 0x18, 0x28, 0x6f, 0x01, # magic
91 0x00, 0x00, 0x00, 0x00, # start
92 !if $(FD_SIZE_IN_MB) == 2
93 0x00, 0x00, 0x20, 0x00, # image size: 2 MB
95 !if $(FD_SIZE_IN_MB) == 3
96 0x00, 0x00, 0x30, 0x00, # image size: 3 MB
98 0x01, 0x02, 0x03, 0x04 # endiannness flag
102 0x00008000|$(FVMAIN_COMPACT_SIZE)
103 gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize
106 !include VarStore.fdf.inc
108 ################################################################################
112 # [FV] section is used to define what components or modules are placed within a flash
113 # device file. This section also defines order the components and modules are positioned
114 # within the image. The [FV] section consists of define statements, set statements and
117 ################################################################################
119 !include ArmVirtQemuFvMain.fdf.inc
128 WRITE_DISABLED_CAP = TRUE
129 WRITE_ENABLED_CAP = TRUE
131 WRITE_LOCK_CAP = TRUE
132 WRITE_LOCK_STATUS = TRUE
133 READ_DISABLED_CAP = TRUE
134 READ_ENABLED_CAP = TRUE
137 READ_LOCK_STATUS = TRUE
139 INF RuleOverride = SELF_RELOC ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf
141 FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 {
142 SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE {
143 SECTION FV_IMAGE = FVMAIN
147 !include ArmVirtRules.fdf.inc