]> git.proxmox.com Git - mirror_edk2.git/blob - ArmPkg/Library/BdsLib/BdsLinuxLoader.h
8d58ce103a1a829eafdc26849ba8d3b012fcdb27
[mirror_edk2.git] / ArmPkg / Library / BdsLib / BdsLinuxLoader.h
1 /** @file
2 *
3 * Copyright (c) 2011-2012, 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
20 #define LINUX_ATAG_MAX_OFFSET (PcdGet32(PcdSystemMemoryBase) + PcdGet32(PcdArmLinuxAtagMaxOffset))
21 #define LINUX_KERNEL_MAX_OFFSET (PcdGet32(PcdSystemMemoryBase) + PcdGet32(PcdArmLinuxKernelMaxOffset))
22
23 #define ATAG_MAX_SIZE 0x3000
24
25 /* ATAG : list of possible tags */
26 #define ATAG_NONE 0x00000000
27 #define ATAG_CORE 0x54410001
28 #define ATAG_MEM 0x54410002
29 #define ATAG_VIDEOTEXT 0x54410003
30 #define ATAG_RAMDISK 0x54410004
31 #define ATAG_INITRD2 0x54420005
32 #define ATAG_SERIAL 0x54410006
33 #define ATAG_REVISION 0x54410007
34 #define ATAG_VIDEOLFB 0x54410008
35 #define ATAG_CMDLINE 0x54410009
36 #define ATAG_ARM_MP_CORE 0x5441000A
37
38 /* structures for each atag */
39 typedef struct {
40 UINT32 size; /* length of tag in words including this header */
41 UINT32 type; /* tag type */
42 } LINUX_ATAG_HEADER;
43
44 typedef struct {
45 UINT32 flags;
46 UINT32 pagesize;
47 UINT32 rootdev;
48 } LINUX_ATAG_CORE;
49
50 typedef struct {
51 UINT32 size;
52 UINTN start;
53 } LINUX_ATAG_MEM;
54
55 typedef struct {
56 UINT8 x;
57 UINT8 y;
58 UINT16 video_page;
59 UINT8 video_mode;
60 UINT8 video_cols;
61 UINT16 video_ega_bx;
62 UINT8 video_lines;
63 UINT8 video_isvga;
64 UINT16 video_points;
65 } LINUX_ATAG_VIDEOTEXT;
66
67 typedef struct {
68 UINT32 flags;
69 UINT32 size;
70 UINTN start;
71 } LINUX_ATAG_RAMDISK;
72
73 typedef struct {
74 UINT32 start;
75 UINT32 size;
76 } LINUX_ATAG_INITRD2;
77
78 typedef struct {
79 UINT32 low;
80 UINT32 high;
81 } LINUX_ATAG_SERIALNR;
82
83 typedef struct {
84 UINT32 rev;
85 } LINUX_ATAG_REVISION;
86
87 typedef struct {
88 UINT16 lfb_width;
89 UINT16 lfb_height;
90 UINT16 lfb_depth;
91 UINT16 lfb_linelength;
92 UINT32 lfb_base;
93 UINT32 lfb_size;
94 UINT8 red_size;
95 UINT8 red_pos;
96 UINT8 green_size;
97 UINT8 green_pos;
98 UINT8 blue_size;
99 UINT8 blue_pos;
100 UINT8 rsvd_size;
101 UINT8 rsvd_pos;
102 } LINUX_ATAG_VIDEOLFB;
103
104 typedef struct {
105 CHAR8 cmdline[1];
106 } LINUX_ATAG_CMDLINE;
107
108 typedef struct {
109 LINUX_ATAG_HEADER header;
110 union {
111 LINUX_ATAG_CORE core_tag;
112 LINUX_ATAG_MEM mem_tag;
113 LINUX_ATAG_VIDEOTEXT videotext_tag;
114 LINUX_ATAG_RAMDISK ramdisk_tag;
115 LINUX_ATAG_INITRD2 initrd2_tag;
116 LINUX_ATAG_SERIALNR serialnr_tag;
117 LINUX_ATAG_REVISION revision_tag;
118 LINUX_ATAG_VIDEOLFB videolfb_tag;
119 LINUX_ATAG_CMDLINE cmdline_tag;
120 } body;
121 } LINUX_ATAG;
122
123 typedef VOID (*LINUX_KERNEL)(UINT32 Zero, UINT32 Arch, UINTN ParametersBase);
124
125 #define next_tag_address(t) ((LINUX_ATAG*)((UINT32)(t) + (((t)->header.size) << 2) ))
126 #define tag_size(type) ((UINT32)((sizeof(LINUX_ATAG_HEADER) + sizeof(type)) >> 2))
127
128 #endif