1 /*- 2 * Copyright (c) 2022, Netflix, Inc. 3 * 4 * SPDX-License-Identifier: BSD-2-Clause 5 */ 6 7 #ifndef KBOOT_H 8 #define KBOOT_H 9 10 #define DEVT_HOSTDISK 1234 11 12 struct memory_segments 13 { 14 uint64_t start; 15 uint64_t end; 16 uint64_t type; /* MD defined */ 17 }; 18 19 bool enumerate_memory_arch(void); 20 struct preloaded_file; 21 void bi_loadsmap(struct preloaded_file *kfp); 22 23 bool has_acpi(void); 24 vm_offset_t acpi_rsdp(void); 25 26 void do_init(void); 27 28 /* Per-platform fdt fixup */ 29 void fdt_arch_fixups(void *fdtp); 30 31 uint64_t kboot_get_phys_load_segment(void); 32 uint8_t kboot_get_kernel_machine_bits(void); 33 34 /* main.c */ 35 void kboot_kseg_get(int *nseg, void **ptr); 36 37 /* hostdisk.c */ 38 extern const char *hostfs_root; 39 const char *hostdisk_gen_probe(void); 40 void hostdisk_zfs_probe(void); 41 bool hostdisk_zfs_find_default(void); 42 43 /* seg.c */ 44 #define SYSTEM_RAM 1 45 void init_avail(void); 46 void need_avail(int n); 47 void add_avail(uint64_t start, uint64_t end, uint64_t type); 48 void remove_avail(uint64_t start, uint64_t end, uint64_t type); 49 uint64_t first_avail(uint64_t align, uint64_t min_size, uint64_t type); 50 void print_avail(void); 51 bool populate_avail_from_iomem(void); 52 uint64_t space_avail(uint64_t start); 53 54 /* util.c */ 55 bool file2str(const char *fn, char *buffer, size_t buflen); 56 bool file2u64(const char *fn, uint64_t *val); 57 58 #endif /* KBOOT_H */ 59