diff options
Diffstat (limited to 'include/boot')
-rw-r--r-- | include/boot/beoboot.h | 39 | ||||
-rw-r--r-- | include/boot/elf_boot.h | 104 | ||||
-rw-r--r-- | include/boot/linuxbios_tables.h | 82 |
3 files changed, 225 insertions, 0 deletions
diff --git a/include/boot/beoboot.h b/include/boot/beoboot.h new file mode 100644 index 0000000..d22fef1 --- /dev/null +++ b/include/boot/beoboot.h @@ -0,0 +1,39 @@ + +/*--- Boot image definitions ---------------------------------------*/ +struct beoboot_header { + char magic[4]; + uint8_t arch; + uint8_t flags; + uint16_t cmdline_size;/* length of command line (including null) */ + /* The alpha chunk is a backward compatibility hack. The original + * assumption was that integer sizes didn't matter because we + * would never mix architectures. x86_64 + i386 broke that + * assumption. It's fixed for that combination and the future. + * However, alpha needs a little hack now... */ +#ifdef __alpha__ + unsigned long kernel_size; + unsigned long initrd_size; +#else + uint32_t kernel_size; + uint32_t initrd_size; +#endif +}; +#define BEOBOOT_MAGIC "BeoB" +#define BEOBOOT_ARCH_I386 1 +#define BEOBOOT_ARCH_ALPHA 2 +#define BEOBOOT_ARCH_PPC 3 +#define BEOBOOT_ARCH_PPC64 4 +#if defined(__i386__) || defined(__x86_64__) +#define BEOBOOT_ARCH BEOBOOT_ARCH_I386 +#elif defined(__alpha__) +#define BEOBOOT_ARCH BEOBOOT_ARCH_ALPHA +#elif defined(powerpc) +#define BEOBOOT_ARCH BEOBOOT_ARCH_PPC +#elif defined(__powerpc64__) +#define BEOBOOT_ARCH BEOBOOT_ARCH_PPC64 +#else +#error Unsupported architecture. +#endif +#define BEOBOOT_INITRD_PRESENT 1 +/*------------------------------------------------------------------*/ + diff --git a/include/boot/elf_boot.h b/include/boot/elf_boot.h new file mode 100644 index 0000000..08f561e --- /dev/null +++ b/include/boot/elf_boot.h @@ -0,0 +1,104 @@ +#ifndef ELF_BOOT_H +#define ELF_BOOT_H + +/* This defines the structure of a table of parameters useful for ELF + * bootable images. These parameters are all passed and generated + * by the bootloader to the booted image. For simplicity and + * consistency the Elf Note format is reused. + * + * All of the information must be Position Independent Data. + * That is it must be safe to relocate the whole ELF boot parameter + * block without changing the meaning or correctnes of the data. + * Additionally it must be safe to permute the order of the ELF notes + * to any possible permutation without changing the meaning or correctness + * of the data. + * + */ + +#define ELF_BOOT_MAGIC 0x0E1FB007 + +#ifndef ASSEMBLY +#include <stdint.h> +typedef uint16_t Elf_Half; +typedef uint32_t Elf_Word; +typedef uint64_t Elf_Xword; + +/* + * Elf boot notes... + */ + +typedef struct Elf_Bhdr +{ + Elf_Word b_signature; /* "0x0E1FB007" */ + Elf_Word b_size; + Elf_Half b_checksum; + Elf_Half b_records; +} Elf_Bhdr; + +/* + * ELF Notes. + */ + +typedef struct Elf_Nhdr +{ + Elf_Word n_namesz; /* Length of the note's name. */ + Elf_Word n_descsz; /* Length of the note's descriptor. */ + Elf_Word n_type; /* Type of the note. */ +} Elf_Nhdr; + +#endif /* ASSEMBLY */ + + +/* Standardized Elf image notes for booting... The name for all of these is ELFBoot */ +#define ELF_NOTE_BOOT "ELFBoot" + +#define EIN_PROGRAM_NAME 0x00000001 +/* The program in this ELF file */ +#define EIN_PROGRAM_VERSION 0x00000002 +/* The version of the program in this ELF file */ +#define EIN_PROGRAM_CHECKSUM 0x00000003 +/* ip style checksum of the memory image. */ + + +/* Linux image notes for booting... The name for all of these is Linux */ + +#if 0 +#define LIN_COMMAND_LINE_PTR 0x00000006 +/* Pointer to the command line to pass to the loaded kernel. */ +#define LIN_INITRD_START_PTR 0x00000007 +/* Pointer to the start of the ramdisk in bytes */ +#define LIN_INITRD_SIZE_PTR 0x00000008 +/* Pointer to the size of the ramdisk in bytes */ +#define LIN_VID_MODE_PTR 0x00000009 +/* Pointer to the vid_mode parameter */ +#endif + +/* Etherboot specific notes */ +#define EB_PARAM_NOTE "Etherboot" +#define EB_IA64_SYSTAB 0x00000001 +#define EB_IA64_MEMMAP 0x00000002 +#define EB_IA64_FPSWA 0x00000003 +#define EB_IA64_CONINFO 0x00000004 +#define EB_BOOTP_DATA 0x00000005 +#define EB_HEADER 0x00000006 +#define EB_IA64_IMAGE_HANDLE 0x00000007 +#define EB_I386_MEMMAP 0x00000008 + +/* For standard notes n_namesz must be zero */ +/* All of the following standard note types provide a single null + * terminated string in the descriptor. + */ +#define EBN_FIRMWARE_TYPE 0x00000001 +/* On platforms that support multiple classes of firmware this field + * specifies the class of firmware you are loaded under. + */ +#define EBN_BOOTLOADER_NAME 0x00000002 +/* This specifies just the name of the bootloader for easy comparison */ +#define EBN_BOOTLOADER_VERSION 0x00000003 +/* This specifies the version of the bootlader */ +#define EBN_COMMAND_LINE 0x00000004 +/* This specifies a command line that can be set by user interaction, + * and is provided as a free form string to the loaded image. + */ + +#endif /* ELF_BOOT_H */ diff --git a/include/boot/linuxbios_tables.h b/include/boot/linuxbios_tables.h new file mode 100644 index 0000000..c324cf5 --- /dev/null +++ b/include/boot/linuxbios_tables.h @@ -0,0 +1,82 @@ +#ifndef LINUXBIOS_TABLES_H +#define LINUXBIOS_TABLES_H + +#include <stdint.h> + +/* The linuxbios table information is for conveying information + * from the firmware to the loaded OS image. Primarily this + * is expected to be information that cannot be discovered by + * other means, such as quering the hardware directly. + * + * All of the information should be Position Independent Data. + * That is it should be safe to relocated any of the information + * without it's meaning/correctnes changing. For table that + * can reasonably be used on multiple architectures the data + * size should be fixed. This should ease the transition between + * 32 bit and 64 bit architectures etc. + * + * The completeness test for the information in this table is: + * - Can all of the hardware be detected? + * - Are the per motherboard constants available? + * - Is there enough to allow a kernel to run that was written before + * a particular motherboard is constructed? (Assuming the kernel + * has drivers for all of the hardware but it does not have + * assumptions on how the hardware is connected together). + * + * With this test it should be straight forward to determine if a + * table entry is required or not. This should remove much of the + * long term compatibility burden as table entries which are + * irrelevant or have been replaced by better alternatives may be + * dropped. Of course it is polite and expidite to include extra + * table entries and be backwards compatible, but it is not required. + */ + + +struct lb_header +{ + uint8_t signature[4]; /* LBIO */ + uint32_t header_bytes; + uint32_t header_checksum; + uint32_t table_bytes; + uint32_t table_checksum; + uint32_t table_entries; +}; + +/* Every entry in the boot enviroment list will correspond to a boot + * info record. Encoding both type and size. The type is obviously + * so you can tell what it is. The size allows you to skip that + * boot enviroment record if you don't know what it easy. This allows + * forward compatibility with records not yet defined. + */ +struct lb_record { + uint32_t tag; /* tag ID */ + uint32_t size; /* size of record (in bytes) */ +}; + +#define LB_TAG_UNUSED 0x0000 + +#define LB_TAG_MEMORY 0x0001 + +struct lb_memory_range { + uint64_t start; + uint64_t size; + uint32_t type; +#define LB_MEM_RAM 1 +#define LB_MEM_RESERVED 2 + +}; + +struct lb_memory { + uint32_t tag; + uint32_t size; + struct lb_memory_range map[0]; +}; + +#define LB_TAG_HWRPB 0x0002 +struct lb_hwrpb { + uint32_t tag; + uint32_t size; + uint64_t hwrpb; +}; + +#endif /* LINUXBIOS_TABLES_H */ |