blob: 09b5f62ae3141553d7c5c28f7f0a9a44e41895d4 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
wdenke2211742002-11-02 23:30:20 +00002/*
Simon Glass1ed83ba2019-08-02 09:44:27 -06003 * Common header file for U-Boot
4 *
5 * This file still includes quite a bit of stuff that should be in separate
Simon Glassadaaa482019-11-14 12:57:43 -07006 * headers. Please think before adding more things.
Simon Glass495a5dc2019-11-14 12:57:30 -07007 * Patches to remove things are welcome.
Simon Glass1ed83ba2019-08-02 09:44:27 -06008 *
Wolfgang Denkf342f862009-05-16 10:47:45 +02009 * (C) Copyright 2000-2009
wdenke2211742002-11-02 23:30:20 +000010 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
wdenke2211742002-11-02 23:30:20 +000011 */
12
13#ifndef __COMMON_H_
Wolfgang Denkbcbd5212012-01-06 07:36:44 +010014#define __COMMON_H_ 1
wdenke2211742002-11-02 23:30:20 +000015
Wolfgang Denk66e8d442009-07-24 00:17:48 +020016#ifndef __ASSEMBLY__ /* put C only stuff in this section */
17
wdenke2211742002-11-02 23:30:20 +000018#include <config.h>
Joe Hershbergercbf1a932016-04-04 04:07:33 -050019#include <errno.h>
Masahiro Yamadaa4f0b8e2016-12-28 00:36:00 +090020#include <time.h>
Wolfgang Denk0191e472010-10-26 14:34:52 +020021#include <asm-offsets.h>
wdenke2211742002-11-02 23:30:20 +000022#include <linux/bitops.h>
Masahiro Yamada958f0f02017-09-16 14:10:45 +090023#include <linux/bug.h>
Masahiro Yamada29d2a622016-12-28 00:35:59 +090024#include <linux/delay.h>
wdenke2211742002-11-02 23:30:20 +000025#include <linux/types.h>
Masahiro Yamadabf9c2932017-09-16 14:10:40 +090026#include <linux/printk.h>
wdenke2211742002-11-02 23:30:20 +000027#include <linux/string.h>
Marek Vasuta3f16342012-09-27 17:08:15 +020028#include <linux/stringify.h>
wdenke2211742002-11-02 23:30:20 +000029#include <asm/ptrace.h>
30#include <stdarg.h>
Masahiro Yamada5e882e92017-09-16 14:10:39 +090031#include <stdio.h>
Masahiro Yamadabd426622014-11-07 03:03:28 +090032#include <linux/kernel.h>
Simon Glass76135792017-05-17 08:23:05 -060033
wdenke2211742002-11-02 23:30:20 +000034#include <part.h>
35#include <flash.h>
36#include <image.h>
37
York Sun6c480012014-02-26 17:03:19 -080038#ifdef __LP64__
39#define CONFIG_SYS_SUPPORT_64BIT_DATA
40#endif
41
Simon Glass9054a022017-12-04 13:48:20 -070042#include <log.h>
Simon Glass02aa9e62011-06-29 09:49:34 +000043
wdenk87249ba2004-01-06 22:38:14 +000044#include <asm/u-boot.h> /* boot information for Linux kernel */
wdenke2211742002-11-02 23:30:20 +000045#include <asm/global_data.h> /* global data used for startup functions */
46
Patrick Delaunaya0a2b212018-03-13 13:57:00 +010047/* startup functions, used in:
48 * common/board_f.c
Patrick Delaunay98c8bbc2018-03-13 13:57:01 +010049 * common/init/board_init.c
Patrick Delaunayb76e7cf2018-03-13 13:57:02 +010050 * common/board_r.c
Patrick Delaunayb1d23442018-03-13 13:57:03 +010051 * common/board_info.c
Patrick Delaunaya0a2b212018-03-13 13:57:00 +010052 */
Patrick Delaunayc6bfcd52018-03-09 18:28:12 +010053#include <init.h>
54
wdenk452cfd62002-11-19 11:04:11 +000055/*
wdenke2211742002-11-02 23:30:20 +000056 * Function Prototypes
57 */
wdenk87249ba2004-01-06 22:38:14 +000058void hang (void) __attribute__ ((noreturn));
wdenke2211742002-11-02 23:30:20 +000059
Simon Glass7da617c2015-04-28 20:25:07 -060060#include <display_options.h>
wdenke2211742002-11-02 23:30:20 +000061
Wolfgang Denk85c25df2009-04-01 23:34:12 +020062/* common/cmd_source.c */
63int source (ulong addr, const char *fit_uname);
wdenke2211742002-11-02 23:30:20 +000064
Simon Glass892265d2019-12-28 10:45:02 -070065extern ulong image_load_addr; /* Default Load Address */
66extern ulong image_save_addr; /* Default Save Address */
67extern ulong image_save_size; /* Default Save Size */
wdenke2211742002-11-02 23:30:20 +000068
wdenk87249ba2004-01-06 22:38:14 +000069/* common/memsize.c */
Albert ARIBAUDa9606732011-07-03 05:55:33 +000070long get_ram_size (long *, long);
York Sun863e8d82014-02-11 11:57:26 -080071phys_size_t get_effective_memsize(void);
wdenk87249ba2004-01-06 22:38:14 +000072
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +020073#if defined(CONFIG_SYS_DRAM_TEST)
wdenke2211742002-11-02 23:30:20 +000074int testdram(void);
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +020075#endif /* CONFIG_SYS_DRAM_TEST */
wdenke2211742002-11-02 23:30:20 +000076
Jason Hobbs6e39cce2011-08-23 11:06:56 +000077/* lib/uuid.c */
Przemyslaw Marczak0c813362014-04-02 10:20:03 +020078#include <uuid.h>
Jason Hobbs6e39cce2011-08-23 11:06:56 +000079
Peter Tyser685b7f52010-04-12 22:28:05 -050080/* lib/vsprintf.c */
Simon Glassf7ae68062011-11-02 09:52:07 +000081#include <vsprintf.h>
wdenke2211742002-11-02 23:30:20 +000082
Joe Hershberger05a377b2012-05-23 08:01:04 +000083/* lib/net_utils.c */
84#include <net.h>
Joe Hershberger05a377b2012-05-23 08:01:04 +000085
Simon Glass8445d002012-01-14 15:24:44 +000086#include <bootstage.h>
wdenke2211742002-11-02 23:30:20 +000087
Andre Przywara9fcee532017-01-02 11:48:30 +000088#else /* __ASSEMBLY__ */
89
Andre Przywara9fcee532017-01-02 11:48:30 +000090#endif /* __ASSEMBLY__ */
Wolfgang Denk66e8d442009-07-24 00:17:48 +020091
92/* Put only stuff here that the assembler can digest */
93
Anton Staaf07a036a2011-09-02 13:45:28 +000094#define ROUND(a,b) (((a) + (b) - 1) & ~((b) - 1))
Andy Fleming2ef5ed02008-06-16 13:58:53 -050095
Anton Staafcda2e482011-10-17 16:46:13 -070096/*
Simon Glassd61718b2015-06-23 15:38:31 -060097 * check_member() - Check the offset of a structure member
98 *
99 * @structure: Name of structure (e.g. global_data)
100 * @member: Name of member (e.g. baudrate)
101 * @offset: Expected offset in bytes
102 */
103#define check_member(structure, member, offset) _Static_assert( \
104 offsetof(struct structure, member) == offset, \
105 "`struct " #structure "` offset for `" #member "` is not " #offset)
106
Mike Frysinger63b8f122011-07-08 10:44:25 +0000107/* Pull in stuff for the build system */
108#ifdef DO_DEPS_ONLY
Simon Glass9d1f6192019-08-02 09:44:25 -0600109# include <env_internal.h>
Mike Frysinger63b8f122011-07-08 10:44:25 +0000110#endif
111
wdenke2211742002-11-02 23:30:20 +0000112#endif /* __COMMON_H_ */