Since some people disapprove of white space cleanups mixed in regular commits
[coreboot.git] / src / include / boot / elf_boot.h
1 #ifndef ELF_BOOT_H
2 #define ELF_BOOT_H
3
4 #include <stdint.h>
5
6 /* This defines the structure of a table of parameters useful for ELF
7  * bootable images.  These parameters are all passed and generated
8  * by the bootloader to the booted image.  For simplicity and
9  * consistency the Elf Note format is reused.
10  *
11  * All of the information must be Position Independent Data.
12  * That is it must be safe to relocate the whole ELF boot parameter
13  * block without changing the meaning or correctnes of the data.
14  * Additionally it must be safe to permute the order of the ELF notes
15  * to any possible permutation without changing the meaning or correctness
16  * of the data.
17  *
18  */
19
20 #define ELF_HEAD_SIZE           (8*1024)
21 #define ELF_BOOT_MAGIC          0x0E1FB007
22
23 typedef uint16_t Elf_Half;
24 typedef uint32_t Elf_Word;
25 typedef uint64_t Elf_Xword;
26
27 typedef struct
28 {
29         Elf_Word b_signature; /* "0x0E1FB007" */
30         Elf_Word b_size;
31         Elf_Half b_checksum;
32         Elf_Half b_records;
33 } Elf_Bhdr;
34
35 typedef struct
36 {
37         Elf_Word n_namesz;              /* Length of the note's name.  */
38         Elf_Word n_descsz;              /* Length of the note's descriptor.  */
39         Elf_Word n_type;                /* Type of the note.  */
40 } Elf_Nhdr;
41
42
43 /* For standard notes n_namesz must be zero */
44 /* All of the following standard note types provide a single null
45  * terminated string in the descriptor.
46  */
47 #define EBN_FIRMWARE_TYPE       0x00000001
48 /* On platforms that support multiple classes of firmware this field
49  * specifies the class of firmware you are loaded under.
50  */
51 #define EBN_BOOTLOADER_NAME     0x00000002
52 /* This specifies just the name of the bootloader for easy comparison */
53 #define EBN_BOOTLOADER_VERSION  0x00000003
54 /* This specifies the version of the bootlader */
55 #define EBN_COMMAND_LINE        0x00000004
56 /* This specifies a command line that can be set by user interaction,
57  * and is provided as a free form string to the loaded image.
58  */
59
60
61 /* Standardized Elf image notes for booting... The name for all of these is ELFBoot */
62
63 #define ELF_NOTE_BOOT           "ELFBoot"
64
65 #define EIN_PROGRAM_NAME        0x00000001
66 /* The program in this ELF file */
67 #define EIN_PROGRAM_VERSION     0x00000002
68 /* The version of the program in this ELF file */
69 #define EIN_PROGRAM_CHECKSUM    0x00000003
70 /* ip style checksum of the memory image. */
71
72
73 /* Linux image notes for booting... The name for all of these is Linux */
74
75 #define LINUX_NOTE_BOOT         "Linux"
76
77 #define LIN_COMMAND_LINE        0x00000001
78 /* The command line to pass to the loaded kernel. */
79 #define LIN_ROOT_DEV            0x00000002
80 /* The root dev to pass to the loaded kernel. */
81 #define LIN_RAMDISK_FLAGS       0x00000003
82 /* Various old ramdisk flags */
83 #define LIN_INITRD_START        0x00000004
84 /* Start of the ramdisk in bytes */
85 #define LIN_INITRD_SIZE         0x00000005
86 /* Size of the ramdisk in bytes */
87
88
89 #endif /* ELF_BOOT_H */