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