Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) #ifndef BOOT_COMPRESSED_MISC_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) #define BOOT_COMPRESSED_MISC_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  * Special hack: we have to be careful, because no indirections are allowed here,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  * and paravirt_ops is a kind of one. As it will only run in baremetal anyway,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  * we just keep it from happening. (This list needs to be extended when new
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  * paravirt and debugging variants are added.)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #undef CONFIG_PARAVIRT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #undef CONFIG_PARAVIRT_XXL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #undef CONFIG_PARAVIRT_SPINLOCKS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #undef CONFIG_KASAN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #undef CONFIG_KASAN_GENERIC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) /* cpu_feature_enabled() cannot be used this early */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #define USE_EARLY_PGTABLE_L5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #include <linux/linkage.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) #include <linux/screen_info.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) #include <linux/elf.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) #include <linux/io.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) #include <asm/page.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) #include <asm/boot.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) #include <asm/bootparam.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) #include <asm/desc_defs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) #define BOOT_CTYPE_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) #include <linux/acpi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) #define BOOT_BOOT_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) #include "../ctype.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) #ifdef CONFIG_X86_64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) #define memptr long
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) #define memptr unsigned
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) /* boot/compressed/vmlinux start and end markers */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) extern char _head[], _end[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) /* misc.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) extern memptr free_mem_ptr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) extern memptr free_mem_end_ptr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) extern struct boot_params *boot_params;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) void __putstr(const char *s);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) void __puthex(unsigned long value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) #define error_putstr(__x)  __putstr(__x)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) #define error_puthex(__x)  __puthex(__x)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) #ifdef CONFIG_X86_VERBOSE_BOOTUP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) #define debug_putstr(__x)  __putstr(__x)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) #define debug_puthex(__x)  __puthex(__x)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) #define debug_putaddr(__x) { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 		debug_putstr(#__x ": 0x"); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 		debug_puthex((unsigned long)(__x)); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 		debug_putstr("\n"); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) static inline void debug_putstr(const char *s)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) { }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) static inline void debug_puthex(unsigned long value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) { }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) #define debug_putaddr(x) /* */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) /* cmdline.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) int cmdline_find_option(const char *option, char *buffer, int bufsize);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) int cmdline_find_option_bool(const char *option);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) struct mem_vector {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	u64 start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	u64 size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) #if CONFIG_RANDOMIZE_BASE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) /* kaslr.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) void choose_random_location(unsigned long input,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 			    unsigned long input_size,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 			    unsigned long *output,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 			    unsigned long output_size,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 			    unsigned long *virt_addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) static inline void choose_random_location(unsigned long input,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 					  unsigned long input_size,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 					  unsigned long *output,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 					  unsigned long output_size,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 					  unsigned long *virt_addr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) /* cpuflags.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) bool has_cpuflag(int flag);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) #ifdef CONFIG_X86_64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) extern int set_page_decrypted(unsigned long address);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) extern int set_page_encrypted(unsigned long address);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) extern int set_page_non_present(unsigned long address);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) extern unsigned char _pgtable[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) #ifdef CONFIG_EARLY_PRINTK
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) /* early_serial_console.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) extern int early_serial_base;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) void console_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) static const int early_serial_base;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) static inline void console_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) { }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) void set_sev_encryption_mask(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) #ifdef CONFIG_AMD_MEM_ENCRYPT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) void sev_es_shutdown_ghcb(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) extern bool sev_es_check_ghcb_fault(unsigned long address);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) static inline void sev_es_shutdown_ghcb(void) { }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) static inline bool sev_es_check_ghcb_fault(unsigned long address)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	return false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) /* acpi.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) #ifdef CONFIG_ACPI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) acpi_physical_address get_rsdp_addr(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) static inline acpi_physical_address get_rsdp_addr(void) { return 0; }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) #if defined(CONFIG_RANDOMIZE_BASE) && defined(CONFIG_MEMORY_HOTREMOVE) && defined(CONFIG_ACPI)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) extern struct mem_vector immovable_mem[MAX_NUMNODES*2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) int count_immovable_mem_regions(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) static inline int count_immovable_mem_regions(void) { return 0; }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) /* ident_map_64.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) #ifdef CONFIG_X86_5LEVEL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) extern unsigned int __pgtable_l5_enabled, pgdir_shift, ptrs_per_p4d;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) /* Used by PAGE_KERN* macros: */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) extern pteval_t __default_kernel_pte_mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) /* idt_64.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) extern gate_desc boot_idt[BOOT_IDT_ENTRIES];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) extern struct desc_ptr boot_idt_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) /* IDT Entry Points */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) void boot_page_fault(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) void boot_stage1_vc(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) void boot_stage2_vc(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) unsigned long sev_verify_cbit(unsigned long cr3);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) #endif /* BOOT_COMPRESSED_MISC_H */