1 /* 2 * Copyright (c) 2019 Intel Corporation 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #ifndef ZEPHYR_INCLUDE_ARCH_X86_MULTIBOOT_H_ 8 #define ZEPHYR_INCLUDE_ARCH_X86_MULTIBOOT_H_ 9 10 #ifndef _ASMLANGUAGE 11 12 #include <stdint.h> 13 14 /* 15 * Multiboot (version 1) boot information structure. 16 * 17 * Only fields/values of interest to Zephyr are enumerated: at 18 * present, that means only those pertaining to the framebuffer. 19 */ 20 21 struct multiboot_info { 22 uint32_t flags; 23 uint32_t mem_lower; 24 uint32_t mem_upper; 25 uint32_t unused0[8]; 26 uint32_t mmap_length; 27 uint32_t mmap_addr; 28 uint32_t unused1[9]; 29 uint32_t fb_addr_lo; 30 uint32_t fb_addr_hi; 31 uint32_t fb_pitch; 32 uint32_t fb_width; 33 uint32_t fb_height; 34 uint8_t fb_bpp; 35 uint8_t fb_type; 36 uint8_t fb_color_info[6]; 37 }; 38 39 extern struct multiboot_info multiboot_info; 40 41 #ifdef CONFIG_MULTIBOOT_INFO 42 43 void z_multiboot_init(struct multiboot_info *info_pa); 44 45 #else 46 z_multiboot_init(struct multiboot_info * info_pa)47inline void z_multiboot_init(struct multiboot_info *info_pa) 48 { 49 ARG_UNUSED(info_pa); 50 } 51 52 #endif /* CONFIG_MULTIBOOT_INFO */ 53 54 /* 55 * the mmap_addr field points to a series of entries of the following form. 56 */ 57 58 struct multiboot_mmap { 59 uint32_t size; 60 uint64_t base; 61 uint64_t length; 62 uint32_t type; 63 } __packed; 64 65 #endif /* _ASMLANGUAGE */ 66 67 /* Boot type value (see prep_c.c) */ 68 #define MULTIBOOT_BOOT_TYPE 1 69 70 /* 71 * Possible values for multiboot_mmap.type field. 72 * Other values should be assumed to be unusable ranges. 73 */ 74 75 #define MULTIBOOT_MMAP_RAM 1 /* available RAM */ 76 #define MULTIBOOT_MMAP_ACPI 3 /* reserved for ACPI */ 77 #define MULTIBOOT_MMAP_NVS 4 /* ACPI non-volatile */ 78 #define MULTIBOOT_MMAP_DEFECTIVE 5 /* defective RAM module */ 79 80 /* 81 * Magic numbers: the kernel multiboot header (see crt0.S) begins with 82 * MULTIBOOT_HEADER_MAGIC to signal to the booter that it supports 83 * multiboot. On kernel entry, EAX is set to MULTIBOOT_EAX_MAGIC to 84 * signal that the boot loader is multiboot compliant. 85 */ 86 87 #define MULTIBOOT_HEADER_MAGIC 0x1BADB002 88 #define MULTIBOOT_EAX_MAGIC 0x2BADB002 89 90 /* 91 * Typically, we put no flags in the multiboot header, as it exists solely 92 * to reassure the loader that we're a valid binary. The exception to this 93 * is when we want the loader to configure the framebuffer for us. 94 */ 95 96 #define MULTIBOOT_HEADER_FLAG_MEM BIT(1) /* want mem_/mmap_* info */ 97 #define MULTIBOOT_HEADER_FLAG_FB BIT(2) /* want fb_* info */ 98 99 #ifdef CONFIG_INTEL_MULTIBOOTFB_DISPLAY 100 #define MULTIBOOT_HEADER_FLAGS \ 101 (MULTIBOOT_HEADER_FLAG_FB | MULTIBOOT_HEADER_FLAG_MEM) 102 #else 103 #define MULTIBOOT_HEADER_FLAGS MULTIBOOT_HEADER_FLAG_MEM 104 #endif 105 106 /* The flags in the boot info structure tell us which fields are valid. */ 107 108 #define MULTIBOOT_INFO_FLAGS_MEM (1 << 0) /* mem_* valid */ 109 #define MULTIBOOT_INFO_FLAGS_MMAP (1 << 6) /* mmap_* valid */ 110 #define MULTIBOOT_INFO_FLAGS_FB (1 << 12) /* fb_* valid */ 111 112 /* The only fb_type we support is RGB. No text modes and no color palettes. */ 113 114 #define MULTIBOOT_INFO_FB_TYPE_RGB 1 115 116 #endif /* ZEPHYR_INCLUDE_ARCH_X86_MULTIBOOT_H_ */ 117