• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /** @file
2 
3   Copyright (c) 2011 - 2013, Intel Corporation. All rights reserved.<BR>
4   This program and the accompanying materials
5   are licensed and made available under the terms and conditions of the BSD License
6   which accompanies this distribution.  The full text of the license may be found at
7   http://opensource.org/licenses/bsd-license.php
8 
9   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11 
12 **/
13 
14 #ifndef __LINUX_BZIMAGE_H__
15 #define __LINUX_BZIMAGE_H__
16 
17 #define BOOTSIG			0x1FE
18 #define SETUP_HDR		0x53726448	/* 0x53726448 == "HdrS" */
19 
20 #define E820_RAM		1
21 #define E820_RESERVED		2
22 #define E820_ACPI		3
23 #define E820_NVS		4
24 #define E820_UNUSABLE		5
25 
26 #pragma pack(1)
27 
28 struct setup_header {
29 	UINT8 setup_secs;	/* Sectors for setup code */
30 	UINT16 root_flags;
31 	UINT32 sys_size;
32 	UINT16 ram_size;
33 	UINT16 video_mode;
34 	UINT16 root_dev;
35 	UINT16 signature;	/* Boot signature */
36 	UINT16 jump;
37 	UINT32 header;
38 	UINT16 version;
39 	UINT16 su_switch;
40 	UINT16 setup_seg;
41 	UINT16 start_sys;
42 	UINT16 kernel_ver;
43 	UINT8 loader_id;
44 	UINT8 load_flags;
45 	UINT16 movesize;
46 	UINT32 code32_start;	/* Start of code loaded high */
47 	UINT32 ramdisk_start;	/* Start of initial ramdisk */
48 	UINT32 ramdisk_len;	/* Length of initial ramdisk */
49 	UINT32 bootsect_kludge;
50 	UINT16 heap_end;
51 	UINT8 ext_loader_ver;  /* Extended boot loader version */
52 	UINT8 ext_loader_type; /* Extended boot loader ID */
53 	UINT32 cmd_line_ptr;   /* 32-bit pointer to the kernel command line */
54 	UINT32 ramdisk_max;    /* Highest legal initrd address */
55 	UINT32 kernel_alignment; /* Physical addr alignment required for kernel */
56 	UINT8 relocatable_kernel; /* Whether kernel is relocatable or not */
57 	UINT8 min_alignment;
58 	UINT16 xloadflags;
59 	UINT32 cmdline_size;
60 	UINT32 hardware_subarch;
61 	UINT64 hardware_subarch_data;
62 	UINT32 payload_offset;
63 	UINT32 payload_length;
64 	UINT64 setup_data;
65 	UINT64 pref_address;
66 	UINT32 init_size;
67 	UINT32 handover_offset;
68 };
69 
70 struct efi_info {
71 	UINT32 efi_loader_signature;
72 	UINT32 efi_systab;
73 	UINT32 efi_memdesc_size;
74 	UINT32 efi_memdesc_version;
75 	UINT32 efi_memmap;
76 	UINT32 efi_memmap_size;
77 	UINT32 efi_systab_hi;
78 	UINT32 efi_memmap_hi;
79 };
80 
81 struct e820_entry {
82 	UINT64 addr;		/* start of memory segment */
83 	UINT64 size;		/* size of memory segment */
84 	UINT32 type;		/* type of memory segment */
85 };
86 
87 struct screen_info {
88         UINT8  orig_x;           /* 0x00 */
89         UINT8  orig_y;           /* 0x01 */
90         UINT16 ext_mem_k;        /* 0x02 */
91         UINT16 orig_video_page;  /* 0x04 */
92         UINT8  orig_video_mode;  /* 0x06 */
93         UINT8  orig_video_cols;  /* 0x07 */
94         UINT8  flags;            /* 0x08 */
95         UINT8  unused2;          /* 0x09 */
96         UINT16 orig_video_ega_bx;/* 0x0a */
97         UINT16 unused3;          /* 0x0c */
98         UINT8  orig_video_lines; /* 0x0e */
99         UINT8  orig_video_isVGA; /* 0x0f */
100         UINT16 orig_video_points;/* 0x10 */
101 
102 	/* VESA graphic mode -- linear frame buffer */
103         UINT16 lfb_width;        /* 0x12 */
104         UINT16 lfb_height;       /* 0x14 */
105         UINT16 lfb_depth;        /* 0x16 */
106         UINT32 lfb_base;         /* 0x18 */
107         UINT32 lfb_size;         /* 0x1c */
108         UINT16 cl_magic, cl_offset; /* 0x20 */
109 	UINT16 lfb_linelength;   /* 0x24 */
110         UINT8  red_size;         /* 0x26 */
111         UINT8  red_pos;          /* 0x27 */
112         UINT8  green_size;       /* 0x28 */
113 	UINT8  green_pos;        /* 0x29 */
114         UINT8  blue_size;        /* 0x2a */
115 	UINT8  blue_pos;         /* 0x2b */
116         UINT8  rsvd_size;        /* 0x2c */
117         UINT8  rsvd_pos;         /* 0x2d */
118         UINT16 vesapm_seg;       /* 0x2e */
119 	UINT16 vesapm_off;       /* 0x30 */
120         UINT16 pages;            /* 0x32 */
121         UINT16 vesa_attributes;  /* 0x34 */
122         UINT32 capabilities;     /* 0x36 */
123         UINT8  _reserved[6];     /* 0x3a */
124 };
125 
126 struct boot_params {
127 	struct screen_info screen_info;
128 	UINT8 apm_bios_info[0x14];
129 	UINT8 _pad2[4];
130 	UINT64 tboot_addr;
131 	UINT8 ist_info[0x10];
132 	UINT8 _pad3[16];
133 	UINT8 hd0_info[16];
134 	UINT8 hd1_info[16];
135 	UINT8 sys_desc_table[0x10];
136 	UINT8 olpc_ofw_header[0x10];
137 	UINT8 _pad4[128];
138 	UINT8 edid_info[0x80];
139 	struct efi_info efi_info;
140 	UINT32 alt_mem_k;
141 	UINT32 scratch;
142 	UINT8 e820_entries;
143 	UINT8 eddbuf_entries;
144 	UINT8 edd_mbr_sig_buf_entries;
145 	UINT8 _pad6[6];
146 	struct setup_header hdr;
147 	UINT8 _pad7[0x290-0x1f1-sizeof(struct setup_header)];
148 	UINT32 edd_mbr_sig_buffer[16];
149 	struct e820_entry e820_map[128];
150 	UINT8 _pad8[48];
151 	UINT8 eddbuf[0x1ec];
152 	UINT8 _pad9[276];
153 };
154 
155 typedef struct {
156 	UINT16 limit;
157 	UINT64 *base;
158 } dt_addr_t;
159 
160 #pragma pack()
161 
162 extern EFI_STATUS setup_graphics(struct boot_params *buf);
163 
164 #endif /* __LINUX_BZIMAGE_H__ */
165