]> git.proxmox.com Git - mirror_edk2.git/blob - ArmPkg/Library/BdsLib/BdsLinuxLoader.h
Sync up ArmPkg with patch from mailing list. Changed name of BdsLib.h to BdsUnixLib...
[mirror_edk2.git] / ArmPkg / Library / BdsLib / BdsLinuxLoader.h
1 /** @file
2 *
3 * Copyright (c) 2011, 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 ATAG_MAX_SIZE 0x4000
19 //PcdKernelParamsMaxMemorySize
20
21 /* ATAG : list of possible tags */
22 #define ATAG_NONE 0x00000000
23 #define ATAG_CORE 0x54410001
24 #define ATAG_MEM 0x54410002
25 #define ATAG_VIDEOTEXT 0x54410003
26 #define ATAG_RAMDISK 0x54410004
27 #define ATAG_INITRD2 0x54420005
28 #define ATAG_SERIAL 0x54410006
29 #define ATAG_REVISION 0x54410007
30 #define ATAG_VIDEOLFB 0x54410008
31 #define ATAG_CMDLINE 0x54410009
32 #define ATAG_ARM_MP_CORE 0x5441000A
33
34 // Some system addresses
35 // These should probably come from the platform header file or from pcd values
36 #define DRAM_BASE 0x10000000
37 #define ZIMAGE_LOAD_ADDRESS (DRAM_BASE + 0x8000)
38 #define INITRD_LOAD_ADDRESS (DRAM_BASE + 0x800000)
39
40 #define SIZE_1B 0x00000001
41 #define SIZE_2B 0x00000002
42 #define SIZE_4B 0x00000004
43 #define SIZE_8B 0x00000008
44 #define SIZE_16B 0x00000010
45 #define SIZE_32B 0x00000020
46 #define SIZE_64B 0x00000040
47 #define SIZE_128B 0x00000080
48 #define SIZE_256B 0x00000100
49 #define SIZE_512B 0x00000200
50 #define SIZE_1KB 0x00000400
51 #define SIZE_2KB 0x00000800
52 #define SIZE_4KB 0x00001000
53 #define SIZE_8KB 0x00002000
54 #define SIZE_16KB 0x00004000
55 #define SIZE_32KB 0x00008000
56 #define SIZE_64KB 0x00010000
57 #define SIZE_128KB 0x00020000
58 #define SIZE_256KB 0x00040000
59 #define SIZE_512KB 0x00080000
60 #define SIZE_1MB 0x00100000
61 #define SIZE_2MB 0x00200000
62 #define SIZE_4MB 0x00400000
63 #define SIZE_8MB 0x00800000
64 #define SIZE_16MB 0x01000000
65 #define SIZE_32MB 0x02000000
66 #define SIZE_64MB 0x04000000
67 #define SIZE_100MB 0x06400000
68 #define SIZE_128MB 0x08000000
69 #define SIZE_256MB 0x10000000
70 #define SIZE_512MB 0x20000000
71 #define SIZE_1GB 0x40000000
72 #define SIZE_2GB 0x80000000
73
74 /* structures for each atag */
75 struct atag_header {
76 UINT32 size; /* length of tag in words including this header */
77 UINT32 type; /* tag type */
78 };
79
80 struct atag_core {
81 UINT32 flags;
82 UINT32 pagesize;
83 UINT32 rootdev;
84 };
85
86 struct atag_mem {
87 UINT32 size;
88 UINTN start;
89 };
90
91 struct atag_videotext {
92 UINT8 x;
93 UINT8 y;
94 UINT16 video_page;
95 UINT8 video_mode;
96 UINT8 video_cols;
97 UINT16 video_ega_bx;
98 UINT8 video_lines;
99 UINT8 video_isvga;
100 UINT16 video_points;
101 };
102
103 struct atag_ramdisk {
104 UINT32 flags;
105 UINT32 size;
106 UINTN start;
107 };
108
109 struct atag_initrd2 {
110 UINT32 start;
111 UINT32 size;
112 };
113
114 struct atag_serialnr {
115 UINT32 low;
116 UINT32 high;
117 };
118
119 struct atag_revision {
120 UINT32 rev;
121 };
122
123 struct atag_videolfb {
124 UINT16 lfb_width;
125 UINT16 lfb_height;
126 UINT16 lfb_depth;
127 UINT16 lfb_linelength;
128 UINT32 lfb_base;
129 UINT32 lfb_size;
130 UINT8 red_size;
131 UINT8 red_pos;
132 UINT8 green_size;
133 UINT8 green_pos;
134 UINT8 blue_size;
135 UINT8 blue_pos;
136 UINT8 rsvd_size;
137 UINT8 rsvd_pos;
138 };
139
140 struct atag_cmdline {
141 CHAR8 cmdline[1];
142 };
143
144 struct atag {
145 struct atag_header header;
146 union {
147 struct atag_core core_tag;
148 struct atag_mem mem_tag;
149 struct atag_videotext videotext_tag;
150 struct atag_ramdisk ramdisk_tag;
151 struct atag_initrd2 initrd2_tag;
152 struct atag_serialnr serialnr_tag;
153 struct atag_revision revision_tag;
154 struct atag_videolfb videolfb_tag;
155 struct atag_cmdline cmdline_tag;
156 } body;
157 };
158
159 #define next_tag_address(t) ((struct atag *)((UINT32)(t) + (((t)->header.size) << 2) ))
160 #define tag_size(type) ((UINT32)((sizeof(struct atag_header) + sizeof(struct type)) >> 2))
161
162 STATIC struct atag *Params; /* used to point at the current tag */
163
164 #endif
165