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
|
/** @file
*
* Copyright (c) 2011-2012, ARM Limited. All rights reserved.
*
* 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.
*
**/
#ifndef __BDSLINUXLOADER_H
#define __BDSLINUXLOADER_H
#define LINUX_UIMAGE_SIGNATURE 0x56190527
#define LINUX_KERNEL_MAX_OFFSET (PcdGet32(PcdSystemMemoryBase) + PcdGet32(PcdArmLinuxKernelMaxOffset))
#define LINUX_ATAG_MAX_OFFSET (PcdGet32(PcdSystemMemoryBase) + PcdGet32(PcdArmLinuxAtagMaxOffset))
#define LINUX_FDT_MAX_OFFSET (PcdGet32(PcdSystemMemoryBase) + PcdGet32(PcdArmLinuxFdtMaxOffset))
// Additional size that could be used for FDT entries added by the UEFI OS Loader
// Estimation based on: EDID (300bytes) + bootargs (200bytes) + initrd region (20bytes)
// + system memory region (20bytes) + mp_core entries (200 bytes)
#define FDT_ADDITIONAL_ENTRIES_SIZE 0x300
#define ARM_FDT_MACHINE_TYPE 0xFFFFFFFF
typedef VOID (*LINUX_KERNEL)(UINT32 Zero, UINT32 Arch, UINTN ParametersBase);
//
// ATAG Definitions
//
#define ATAG_MAX_SIZE 0x3000
/* ATAG : list of possible tags */
#define ATAG_NONE 0x00000000
#define ATAG_CORE 0x54410001
#define ATAG_MEM 0x54410002
#define ATAG_VIDEOTEXT 0x54410003
#define ATAG_RAMDISK 0x54410004
#define ATAG_INITRD2 0x54420005
#define ATAG_SERIAL 0x54410006
#define ATAG_REVISION 0x54410007
#define ATAG_VIDEOLFB 0x54410008
#define ATAG_CMDLINE 0x54410009
#define ATAG_ARM_MP_CORE 0x5441000A
#define next_tag_address(t) ((LINUX_ATAG*)((UINT32)(t) + (((t)->header.size) << 2) ))
#define tag_size(type) ((UINT32)((sizeof(LINUX_ATAG_HEADER) + sizeof(type)) >> 2))
typedef struct {
UINT32 size; /* length of tag in words including this header */
UINT32 type; /* tag type */
} LINUX_ATAG_HEADER;
typedef struct {
UINT32 flags;
UINT32 pagesize;
UINT32 rootdev;
} LINUX_ATAG_CORE;
typedef struct {
UINT32 size;
UINTN start;
} LINUX_ATAG_MEM;
typedef struct {
UINT8 x;
UINT8 y;
UINT16 video_page;
UINT8 video_mode;
UINT8 video_cols;
UINT16 video_ega_bx;
UINT8 video_lines;
UINT8 video_isvga;
UINT16 video_points;
} LINUX_ATAG_VIDEOTEXT;
typedef struct {
UINT32 flags;
UINT32 size;
UINTN start;
} LINUX_ATAG_RAMDISK;
typedef struct {
UINT32 start;
UINT32 size;
} LINUX_ATAG_INITRD2;
typedef struct {
UINT32 low;
UINT32 high;
} LINUX_ATAG_SERIALNR;
typedef struct {
UINT32 rev;
} LINUX_ATAG_REVISION;
typedef struct {
UINT16 lfb_width;
UINT16 lfb_height;
UINT16 lfb_depth;
UINT16 lfb_linelength;
UINT32 lfb_base;
UINT32 lfb_size;
UINT8 red_size;
UINT8 red_pos;
UINT8 green_size;
UINT8 green_pos;
UINT8 blue_size;
UINT8 blue_pos;
UINT8 rsvd_size;
UINT8 rsvd_pos;
} LINUX_ATAG_VIDEOLFB;
typedef struct {
CHAR8 cmdline[1];
} LINUX_ATAG_CMDLINE;
typedef struct {
LINUX_ATAG_HEADER header;
union {
LINUX_ATAG_CORE core_tag;
LINUX_ATAG_MEM mem_tag;
LINUX_ATAG_VIDEOTEXT videotext_tag;
LINUX_ATAG_RAMDISK ramdisk_tag;
LINUX_ATAG_INITRD2 initrd2_tag;
LINUX_ATAG_SERIALNR serialnr_tag;
LINUX_ATAG_REVISION revision_tag;
LINUX_ATAG_VIDEOLFB videolfb_tag;
LINUX_ATAG_CMDLINE cmdline_tag;
} body;
} LINUX_ATAG;
EFI_STATUS
PrepareAtagList (
IN CONST CHAR8* CommandLineString,
IN EFI_PHYSICAL_ADDRESS InitrdImage,
IN UINTN InitrdImageSize,
OUT EFI_PHYSICAL_ADDRESS *AtagBase,
OUT UINT32 *AtagSize
);
EFI_STATUS
PrepareFdt (
IN CONST CHAR8* CommandLineArguments,
IN EFI_PHYSICAL_ADDRESS InitrdImage,
IN UINTN InitrdImageSize,
IN OUT EFI_PHYSICAL_ADDRESS *FdtBlobBase,
IN OUT UINT32 *FdtBlobSize
);
#endif
|