1/**
2 * \file
3 * \brief Struct definition for the boot param struct supplied by the
4 *        K1OM boot loader
5 */
6
7/*
8 * Copyright (c) 2013 ETH Zurich.
9 * All rights reserved.
10 *
11 * This file is distributed under the terms in the attached LICENSE file.
12 * If you do not find this file, copies can be found by writing to:
13 * ETH Zurich D-INFK, Universitaetstrasse 6, CH-8092 Zurich. Attn: Systems Group.
14 *
15 *
16 */
17
18#ifndef KERNEL_BOOT_PARAM_H
19#define KERNEL_BOOT_PARAM_H
20
21#include <kernel_boot_param/screen_info.h>
22#include <kernel_boot_param/apm_bios.h>
23#include <kernel_boot_param/ist_bios.h>
24#include <kernel_boot_param/edd.h>
25#include <kernel_boot_param/e820.h>
26
27struct edid_info
28{
29    unsigned char dummy[128];
30};
31
32/* setup data types */
33#define SETUP_NONE			0
34#define SETUP_E820_EXT			1
35
36/* extensible setup data list node */
37struct setup_data
38{
39    uint64_t next;
40    uint32_t type;
41    uint32_t len;
42    uint8_t data[0];
43};
44
45struct setup_header
46{
47    uint8_t setup_sects;
48    uint16_t root_flags;
49    uint32_t syssize;
50    uint16_t ram_size;
51#define RAMDISK_IMAGE_START_MASK	0x07FF
52#define RAMDISK_PROMPT_FLAG		0x8000
53#define RAMDISK_LOAD_FLAG		0x4000
54    uint16_t vid_mode;
55    uint16_t root_dev;
56    uint16_t boot_flag;
57    uint16_t jump;
58    uint32_t header;
59    uint16_t version;
60    uint32_t realmode_swtch;
61    uint16_t start_sys;
62    uint16_t kernel_version;
63    uint8_t type_of_loader;
64    uint8_t loadflags;
65#define LOADED_HIGH	(1<<0)
66#define QUIET_FLAG	(1<<5)
67#define KEEP_SEGMENTS	(1<<6)
68#define CAN_USE_HEAP	(1<<7)
69    uint16_t setup_move_size;
70    uint32_t code32_start;
71    uint32_t ramdisk_image;
72    uint32_t ramdisk_size;
73    uint32_t bootsect_kludge;
74    uint16_t heap_end_ptr;
75    uint8_t ext_loader_ver;
76    uint8_t ext_loader_type;
77    uint32_t cmd_line_ptr;
78    uint32_t initrd_addr_max;
79    uint32_t kernel_alignment;
80    uint8_t relocatable_kernel;
81    uint8_t _pad2[3];
82    uint32_t cmdline_size;
83    uint32_t hardware_subarch;
84    uint64_t hardware_subarch_data;
85    uint32_t payload_offset;
86    uint32_t payload_length;
87    uint64_t setup_data;
88}__attribute__((packed));
89
90struct sys_desc_table
91{
92    uint16_t length;
93    uint8_t table[14];
94};
95
96/* Gleaned from OFW's set-parameters in cpu/x86/pc/linux.fth */
97struct olpc_ofw_header
98{
99    uint32_t ofw_magic; /* OFW signature */
100    uint32_t ofw_version;
101    uint32_t cif_handler; /* callback into OFW */
102    uint32_t irq_desc_table;
103}__attribute__((packed));
104
105struct efi_info
106{
107    uint32_t efi_loader_signature;
108    uint32_t efi_systab;
109    uint32_t efi_memdesc_size;
110    uint32_t efi_memdesc_version;
111    uint32_t efi_memmap;
112    uint32_t efi_memmap_size;
113    uint32_t efi_systab_hi;
114    uint32_t efi_memmap_hi;
115};
116
117/* The so-called "zeropage" */
118struct boot_params
119{
120    struct screen_info screen_info; /* 0x000 */
121    struct apm_bios_info apm_bios_info; /* 0x040 */
122    uint8_t _pad2[4]; /* 0x054 */
123    uint64_t tboot_addr; /* 0x058 */
124    struct ist_info ist_info; /* 0x060 */
125    uint8_t _pad3[16]; /* 0x070 */
126    uint8_t hd0_info[16]; /* obsolete! *//* 0x080 */
127    uint8_t hd1_info[16]; /* obsolete! *//* 0x090 */
128    struct sys_desc_table sys_desc_table; /* 0x0a0 */
129    struct olpc_ofw_header olpc_ofw_header; /* 0x0b0 */
130    uint8_t _pad4[128]; /* 0x0c0 */
131    struct edid_info edid_info; /* 0x140 */
132    struct efi_info efi_info; /* 0x1c0 */
133    uint32_t alt_mem_k; /* 0x1e0 */
134    uint32_t scratch; /* Scratch field! *//* 0x1e4 */
135    uint8_t e820_entries; /* 0x1e8 */
136    uint8_t eddbuf_entries; /* 0x1e9 */
137    uint8_t edd_mbr_sig_buf_entries; /* 0x1ea */
138    uint8_t _pad6[6]; /* 0x1eb */
139    struct setup_header hdr; /* setup header *//* 0x1f1 */
140    uint8_t _pad7[0x290 - 0x1f1 - sizeof(struct setup_header)];
141    uint32_t edd_mbr_sig_buffer[EDD_MBR_SIG_MAX]; /* 0x290 */
142    struct e820entry e820_map[E820MAX]; /* 0x2d0 */
143    uint8_t _pad8[48]; /* 0xcd0 */
144    struct edd_info eddbuf[EDDMAXNR]; /* 0xd00 */
145    uint8_t _pad9[276]; /* 0xeec */
146}__attribute__((packed));
147
148enum
149{
150    X86_SUBARCH_PC = 0,
151    X86_SUBARCH_LGUEST,
152    X86_SUBARCH_XEN,
153    X86_SUBARCH_MRST,
154    X86_SUBARCH_CE4100,
155    X86_NR_SUBARCHS,
156};
157
158#endif /* KERNEL_BOOT_PARAM_H */
159