common.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Common header file for U-Boot
  4. *
  5. * This file still includes quite a bit of stuff that should be in separate
  6. * headers. Please think before adding more things.
  7. * Patches to remove things are welcome.
  8. *
  9. * (C) Copyright 2000-2009
  10. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  11. */
  12. #ifndef __COMMON_H_
  13. #define __COMMON_H_ 1
  14. #ifndef __ASSEMBLY__ /* put C only stuff in this section */
  15. typedef volatile unsigned long vu_long;
  16. typedef volatile unsigned short vu_short;
  17. typedef volatile unsigned char vu_char;
  18. #include <config.h>
  19. #include <errno.h>
  20. #include <time.h>
  21. #include <asm-offsets.h>
  22. #include <linux/bitops.h>
  23. #include <linux/bug.h>
  24. #include <linux/delay.h>
  25. #include <linux/types.h>
  26. #include <linux/printk.h>
  27. #include <linux/string.h>
  28. #include <linux/stringify.h>
  29. #include <asm/ptrace.h>
  30. #include <stdarg.h>
  31. #include <stdio.h>
  32. #include <linux/kernel.h>
  33. #include <part.h>
  34. #include <flash.h>
  35. #include <image.h>
  36. #ifdef __LP64__
  37. #define CONFIG_SYS_SUPPORT_64BIT_DATA
  38. #endif
  39. #include <log.h>
  40. #include <asm/u-boot.h> /* boot information for Linux kernel */
  41. #include <asm/global_data.h> /* global data used for startup functions */
  42. /* startup functions, used in:
  43. * common/board_f.c
  44. * common/init/board_init.c
  45. * common/board_r.c
  46. * common/board_info.c
  47. */
  48. #include <init.h>
  49. /*
  50. * Function Prototypes
  51. */
  52. void hang (void) __attribute__ ((noreturn));
  53. #include <display_options.h>
  54. /**
  55. * arch_fixup_fdt() - Write arch-specific information to fdt
  56. *
  57. * Defined in arch/$(ARCH)/lib/bootm-fdt.c
  58. *
  59. * @blob: FDT blob to write to
  60. * @return 0 if ok, or -ve FDT_ERR_... on failure
  61. */
  62. int arch_fixup_fdt(void *blob);
  63. /* common/cmd_source.c */
  64. int source (ulong addr, const char *fit_uname);
  65. extern ulong load_addr; /* Default Load Address */
  66. extern ulong save_addr; /* Default Save Address */
  67. extern ulong save_size; /* Default Save Size */
  68. /* common/kallsysm.c */
  69. const char *symbol_lookup(unsigned long addr, unsigned long *caddr);
  70. /* common/memsize.c */
  71. long get_ram_size (long *, long);
  72. phys_size_t get_effective_memsize(void);
  73. #if defined(CONFIG_SYS_DRAM_TEST)
  74. int testdram(void);
  75. #endif /* CONFIG_SYS_DRAM_TEST */
  76. void s_init(void);
  77. void upmconfig (unsigned int, unsigned int *, unsigned int);
  78. ulong get_tbclk (void);
  79. void reset_misc (void);
  80. void reset_cpu (ulong addr);
  81. void ft_cpu_setup(void *blob, bd_t *bd);
  82. void ft_pci_setup(void *blob, bd_t *bd);
  83. /* $(CPU)/speed.c */
  84. int get_clocks (void);
  85. ulong get_bus_freq (ulong);
  86. int get_serial_clock(void);
  87. /* lib/uuid.c */
  88. #include <uuid.h>
  89. /* lib/vsprintf.c */
  90. #include <vsprintf.h>
  91. /* lib/net_utils.c */
  92. #include <net.h>
  93. #include <bootstage.h>
  94. #else /* __ASSEMBLY__ */
  95. #endif /* __ASSEMBLY__ */
  96. /* Put only stuff here that the assembler can digest */
  97. #ifdef CONFIG_POST
  98. #define CONFIG_HAS_POST
  99. #endif
  100. #define ROUND(a,b) (((a) + (b) - 1) & ~((b) - 1))
  101. /*
  102. * check_member() - Check the offset of a structure member
  103. *
  104. * @structure: Name of structure (e.g. global_data)
  105. * @member: Name of member (e.g. baudrate)
  106. * @offset: Expected offset in bytes
  107. */
  108. #define check_member(structure, member, offset) _Static_assert( \
  109. offsetof(struct structure, member) == offset, \
  110. "`struct " #structure "` offset for `" #member "` is not " #offset)
  111. /* Avoid using CONFIG_EFI_STUB directly as we may boot from other loaders */
  112. #ifdef CONFIG_EFI_STUB
  113. #define ll_boot_init() false
  114. #else
  115. #define ll_boot_init() true
  116. #endif
  117. /* Pull in stuff for the build system */
  118. #ifdef DO_DEPS_ONLY
  119. # include <env_internal.h>
  120. #endif
  121. #endif /* __COMMON_H_ */