]> git.proxmox.com Git - mirror_edk2.git/blame - 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
CommitLineData
1bfda055 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
76d17c31 18#define LINUX_ATAG_MAX_OFFSET (PcdGet32(PcdSystemMemoryBase) + PcdGet32(PcdArmLinuxAtagMaxOffset))
19#define LINUX_KERNEL_MAX_OFFSET (PcdGet32(PcdSystemMemoryBase) + PcdGet32(PcdArmLinuxKernelMaxOffset))
20
a355a365 21#define ATAG_MAX_SIZE 0x3000
1bfda055 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
1bfda055 36/* structures for each atag */
a355a365 37typedef struct {
1bfda055 38 UINT32 size; /* length of tag in words including this header */
39 UINT32 type; /* tag type */
a355a365 40} LINUX_ATAG_HEADER;
1bfda055 41
a355a365 42typedef struct {
1bfda055 43 UINT32 flags;
44 UINT32 pagesize;
45 UINT32 rootdev;
a355a365 46} LINUX_ATAG_CORE;
1bfda055 47
a355a365 48typedef struct {
1bfda055 49 UINT32 size;
50 UINTN start;
a355a365 51} LINUX_ATAG_MEM;
1bfda055 52
a355a365 53typedef struct {
1bfda055 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;
a355a365 63} LINUX_ATAG_VIDEOTEXT;
1bfda055 64
a355a365 65typedef struct {
1bfda055 66 UINT32 flags;
67 UINT32 size;
68 UINTN start;
a355a365 69} LINUX_ATAG_RAMDISK;
1bfda055 70
a355a365 71typedef struct {
1bfda055 72 UINT32 start;
73 UINT32 size;
a355a365 74} LINUX_ATAG_INITRD2;
1bfda055 75
a355a365 76typedef struct {
1bfda055 77 UINT32 low;
78 UINT32 high;
a355a365 79} LINUX_ATAG_SERIALNR;
1bfda055 80
a355a365 81typedef struct {
1bfda055 82 UINT32 rev;
a355a365 83} LINUX_ATAG_REVISION;
1bfda055 84
a355a365 85typedef struct {
1bfda055 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;
a355a365 100} LINUX_ATAG_VIDEOLFB;
1bfda055 101
a355a365 102typedef struct {
1bfda055 103 CHAR8 cmdline[1];
a355a365 104} LINUX_ATAG_CMDLINE;
1bfda055 105
a355a365 106typedef struct {
107 LINUX_ATAG_HEADER header;
1bfda055 108 union {
a355a365 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;
1bfda055 118 } body;
a355a365 119} LINUX_ATAG;
1bfda055 120
a355a365 121typedef VOID (*LINUX_KERNEL)(UINT32 Zero, UINT32 Arch, UINTN ParametersBase);
1bfda055 122
a355a365 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))
1bfda055 125
126#endif