]> git.proxmox.com Git - mirror_edk2.git/blob - ArmPkg/Library/BdsLib/BdsLinuxLoader.h
ArmPkg/ArmPkg.dec: Redefined PcdSystemMemory(Base|Size) as UINT64
[mirror_edk2.git] / ArmPkg / Library / BdsLib / BdsLinuxLoader.h
1 /** @file
2 *
3 * Copyright (c) 2011-2013, ARM Limited. All rights reserved.
4 *
5 * This program and the accompanying materials
6 * are licensed and made available under the terms and conditions of the BSD License
7 * which accompanies this distribution. The full text of the license may be found at
8 * http://opensource.org/licenses/bsd-license.php
9 *
10 * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 *
13 **/
14
15 #ifndef __BDSLINUXLOADER_H
16 #define __BDSLINUXLOADER_H
17
18 #define LINUX_UIMAGE_SIGNATURE 0x56190527
19 #define LINUX_KERNEL_MAX_OFFSET (PcdGet64 (PcdSystemMemoryBase) + PcdGet32(PcdArmLinuxKernelMaxOffset))
20 #define LINUX_ATAG_MAX_OFFSET (PcdGet64 (PcdSystemMemoryBase) + PcdGet32(PcdArmLinuxAtagMaxOffset))
21 #define LINUX_FDT_MAX_OFFSET (PcdGet64 (PcdSystemMemoryBase) + PcdGet32(PcdArmLinuxFdtMaxOffset))
22
23 // Additional size that could be used for FDT entries added by the UEFI OS Loader
24 // Estimation based on: EDID (300bytes) + bootargs (200bytes) + initrd region (20bytes)
25 // + system memory region (20bytes) + mp_core entries (200 bytes)
26 #define FDT_ADDITIONAL_ENTRIES_SIZE 0x300
27
28 #define ARM_FDT_MACHINE_TYPE 0xFFFFFFFF
29
30 typedef VOID (*LINUX_KERNEL)(UINT32 Zero, UINT32 Arch, UINTN ParametersBase);
31
32 //
33 // ATAG Definitions
34 //
35
36 #define ATAG_MAX_SIZE 0x3000
37
38 /* ATAG : list of possible tags */
39 #define ATAG_NONE 0x00000000
40 #define ATAG_CORE 0x54410001
41 #define ATAG_MEM 0x54410002
42 #define ATAG_VIDEOTEXT 0x54410003
43 #define ATAG_RAMDISK 0x54410004
44 #define ATAG_INITRD2 0x54420005
45 #define ATAG_SERIAL 0x54410006
46 #define ATAG_REVISION 0x54410007
47 #define ATAG_VIDEOLFB 0x54410008
48 #define ATAG_CMDLINE 0x54410009
49 #define ATAG_ARM_MP_CORE 0x5441000A
50
51 #define next_tag_address(t) ((LINUX_ATAG*)((UINT32)(t) + (((t)->header.size) << 2) ))
52 #define tag_size(type) ((UINT32)((sizeof(LINUX_ATAG_HEADER) + sizeof(type)) >> 2))
53
54 typedef struct {
55 UINT32 size; /* length of tag in words including this header */
56 UINT32 type; /* tag type */
57 } LINUX_ATAG_HEADER;
58
59 typedef struct {
60 UINT32 flags;
61 UINT32 pagesize;
62 UINT32 rootdev;
63 } LINUX_ATAG_CORE;
64
65 typedef struct {
66 UINT32 size;
67 UINTN start;
68 } LINUX_ATAG_MEM;
69
70 typedef struct {
71 UINT8 x;
72 UINT8 y;
73 UINT16 video_page;
74 UINT8 video_mode;
75 UINT8 video_cols;
76 UINT16 video_ega_bx;
77 UINT8 video_lines;
78 UINT8 video_isvga;
79 UINT16 video_points;
80 } LINUX_ATAG_VIDEOTEXT;
81
82 typedef struct {
83 UINT32 flags;
84 UINT32 size;
85 UINTN start;
86 } LINUX_ATAG_RAMDISK;
87
88 typedef struct {
89 UINT32 start;
90 UINT32 size;
91 } LINUX_ATAG_INITRD2;
92
93 typedef struct {
94 UINT32 low;
95 UINT32 high;
96 } LINUX_ATAG_SERIALNR;
97
98 typedef struct {
99 UINT32 rev;
100 } LINUX_ATAG_REVISION;
101
102 typedef struct {
103 UINT16 lfb_width;
104 UINT16 lfb_height;
105 UINT16 lfb_depth;
106 UINT16 lfb_linelength;
107 UINT32 lfb_base;
108 UINT32 lfb_size;
109 UINT8 red_size;
110 UINT8 red_pos;
111 UINT8 green_size;
112 UINT8 green_pos;
113 UINT8 blue_size;
114 UINT8 blue_pos;
115 UINT8 rsvd_size;
116 UINT8 rsvd_pos;
117 } LINUX_ATAG_VIDEOLFB;
118
119 typedef struct {
120 CHAR8 cmdline[1];
121 } LINUX_ATAG_CMDLINE;
122
123 typedef struct {
124 LINUX_ATAG_HEADER header;
125 union {
126 LINUX_ATAG_CORE core_tag;
127 LINUX_ATAG_MEM mem_tag;
128 LINUX_ATAG_VIDEOTEXT videotext_tag;
129 LINUX_ATAG_RAMDISK ramdisk_tag;
130 LINUX_ATAG_INITRD2 initrd2_tag;
131 LINUX_ATAG_SERIALNR serialnr_tag;
132 LINUX_ATAG_REVISION revision_tag;
133 LINUX_ATAG_VIDEOLFB videolfb_tag;
134 LINUX_ATAG_CMDLINE cmdline_tag;
135 } body;
136 } LINUX_ATAG;
137
138 EFI_STATUS
139 PrepareAtagList (
140 IN CONST CHAR8* CommandLineString,
141 IN EFI_PHYSICAL_ADDRESS InitrdImage,
142 IN UINTN InitrdImageSize,
143 OUT EFI_PHYSICAL_ADDRESS *AtagBase,
144 OUT UINT32 *AtagSize
145 );
146
147 EFI_STATUS
148 PrepareFdt (
149 IN CONST CHAR8* CommandLineArguments,
150 IN EFI_PHYSICAL_ADDRESS InitrdImage,
151 IN UINTN InitrdImageSize,
152 IN OUT EFI_PHYSICAL_ADDRESS *FdtBlobBase,
153 IN OUT UINTN *FdtBlobSize
154 );
155
156 #endif