xref: /rk3399_rockchip-uboot/include/asm-generic/global_data.h (revision 50b1fa399608652a47c1d2ae6d49754b86165ba8)
1*50b1fa39SSimon Glass /*
2*50b1fa39SSimon Glass  * Copyright (c) 2012 The Chromium OS Authors.
3*50b1fa39SSimon Glass  * (C) Copyright 2002-2010
4*50b1fa39SSimon Glass  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5*50b1fa39SSimon Glass  *
6*50b1fa39SSimon Glass  * See file CREDITS for list of people who contributed to this
7*50b1fa39SSimon Glass  * project.
8*50b1fa39SSimon Glass  *
9*50b1fa39SSimon Glass  * This program is free software; you can redistribute it and/or
10*50b1fa39SSimon Glass  * modify it under the terms of the GNU General Public License as
11*50b1fa39SSimon Glass  * published by the Free Software Foundation; either version 2 of
12*50b1fa39SSimon Glass  * the License, or (at your option) any later version.
13*50b1fa39SSimon Glass  *
14*50b1fa39SSimon Glass  * This program is distributed in the hope that it will be useful,
15*50b1fa39SSimon Glass  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16*50b1fa39SSimon Glass  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17*50b1fa39SSimon Glass  * GNU General Public License for more details.
18*50b1fa39SSimon Glass  *
19*50b1fa39SSimon Glass  * You should have received a copy of the GNU General Public License
20*50b1fa39SSimon Glass  * along with this program; if not, write to the Free Software
21*50b1fa39SSimon Glass  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
22*50b1fa39SSimon Glass  * MA 02111-1307 USA
23*50b1fa39SSimon Glass  */
24*50b1fa39SSimon Glass 
25*50b1fa39SSimon Glass #ifndef __ASM_GENERIC_GBL_DATA_H
26*50b1fa39SSimon Glass #define __ASM_GENERIC_GBL_DATA_H
27*50b1fa39SSimon Glass /*
28*50b1fa39SSimon Glass  * The following data structure is placed in some memory which is
29*50b1fa39SSimon Glass  * available very early after boot (like DPRAM on MPC8xx/MPC82xx, or
30*50b1fa39SSimon Glass  * some locked parts of the data cache) to allow for a minimum set of
31*50b1fa39SSimon Glass  * global variables during system initialization (until we have set
32*50b1fa39SSimon Glass  * up the memory controller so that we can use RAM).
33*50b1fa39SSimon Glass  *
34*50b1fa39SSimon Glass  * Keep it *SMALL* and remember to set GENERATED_GBL_DATA_SIZE > sizeof(gd_t)
35*50b1fa39SSimon Glass  *
36*50b1fa39SSimon Glass  * Each architecture has its own private fields. For now all are private
37*50b1fa39SSimon Glass  */
38*50b1fa39SSimon Glass 
39*50b1fa39SSimon Glass #ifndef __ASSEMBLY__
40*50b1fa39SSimon Glass typedef struct global_data {
41*50b1fa39SSimon Glass 	bd_t *bd;
42*50b1fa39SSimon Glass 	unsigned long flags;
43*50b1fa39SSimon Glass 	unsigned long baudrate;
44*50b1fa39SSimon Glass 	unsigned long cpu_clk;	/* CPU clock in Hz!		*/
45*50b1fa39SSimon Glass 	unsigned long bus_clk;
46*50b1fa39SSimon Glass 	/* We cannot bracket this with CONFIG_PCI due to mpc5xxx */
47*50b1fa39SSimon Glass 	unsigned long pci_clk;
48*50b1fa39SSimon Glass 	unsigned long mem_clk;
49*50b1fa39SSimon Glass #if defined(CONFIG_LCD) || defined(CONFIG_VIDEO)
50*50b1fa39SSimon Glass 	unsigned long fb_base;	/* Base address of framebuffer mem */
51*50b1fa39SSimon Glass #endif
52*50b1fa39SSimon Glass #if defined(CONFIG_POST) || defined(CONFIG_LOGBUFFER)
53*50b1fa39SSimon Glass 	unsigned long post_log_word;  /* Record POST activities */
54*50b1fa39SSimon Glass 	unsigned long post_log_res; /* success of POST test */
55*50b1fa39SSimon Glass 	unsigned long post_init_f_time;  /* When post_init_f started */
56*50b1fa39SSimon Glass #endif
57*50b1fa39SSimon Glass #ifdef CONFIG_BOARD_TYPES
58*50b1fa39SSimon Glass 	unsigned long board_type;
59*50b1fa39SSimon Glass #endif
60*50b1fa39SSimon Glass 	unsigned long have_console;	/* serial_init() was called */
61*50b1fa39SSimon Glass #ifdef CONFIG_PRE_CONSOLE_BUFFER
62*50b1fa39SSimon Glass 	unsigned long precon_buf_idx;	/* Pre-Console buffer index */
63*50b1fa39SSimon Glass #endif
64*50b1fa39SSimon Glass #ifdef CONFIG_MODEM_SUPPORT
65*50b1fa39SSimon Glass 	unsigned long do_mdm_init;
66*50b1fa39SSimon Glass 	unsigned long be_quiet;
67*50b1fa39SSimon Glass #endif
68*50b1fa39SSimon Glass 	unsigned long env_addr;	/* Address  of Environment struct */
69*50b1fa39SSimon Glass 	unsigned long env_valid;	/* Checksum of Environment valid? */
70*50b1fa39SSimon Glass 
71*50b1fa39SSimon Glass 	/* TODO: is this the same as relocaddr, or something else? */
72*50b1fa39SSimon Glass 	unsigned long dest_addr;	/* Post-relocation address of U-Boot */
73*50b1fa39SSimon Glass 	unsigned long dest_addr_sp;
74*50b1fa39SSimon Glass 	unsigned long ram_top;	/* Top address of RAM used by U-Boot */
75*50b1fa39SSimon Glass 
76*50b1fa39SSimon Glass 	unsigned long relocaddr;	/* Start address of U-Boot in RAM */
77*50b1fa39SSimon Glass 	phys_size_t ram_size;	/* RAM size */
78*50b1fa39SSimon Glass 	unsigned long mon_len;	/* monitor len */
79*50b1fa39SSimon Glass 	unsigned long irq_sp;		/* irq stack pointer */
80*50b1fa39SSimon Glass 	unsigned long start_addr_sp;	/* start_addr_stackpointer */
81*50b1fa39SSimon Glass 	unsigned long reloc_off;
82*50b1fa39SSimon Glass 	struct global_data *new_gd;	/* relocated global data */
83*50b1fa39SSimon Glass 	const void *fdt_blob;	/* Our device tree, NULL if none */
84*50b1fa39SSimon Glass 	void **jt;		/* jump table */
85*50b1fa39SSimon Glass 	char env_buf[32];	/* buffer for getenv() before reloc. */
86*50b1fa39SSimon Glass 	struct arch_global_data arch;	/* architecture-specific data */
87*50b1fa39SSimon Glass } gd_t;
88*50b1fa39SSimon Glass #endif
89*50b1fa39SSimon Glass 
90*50b1fa39SSimon Glass /*
91*50b1fa39SSimon Glass  * Global Data Flags
92*50b1fa39SSimon Glass  */
93*50b1fa39SSimon Glass #define GD_FLG_RELOC		0x00001	/* Code was relocated to RAM	   */
94*50b1fa39SSimon Glass #define GD_FLG_DEVINIT		0x00002	/* Devices have been initialized   */
95*50b1fa39SSimon Glass #define GD_FLG_SILENT		0x00004	/* Silent mode			   */
96*50b1fa39SSimon Glass #define GD_FLG_POSTFAIL		0x00008	/* Critical POST test failed	   */
97*50b1fa39SSimon Glass #define GD_FLG_POSTSTOP		0x00010	/* POST seqeunce aborted	   */
98*50b1fa39SSimon Glass #define GD_FLG_LOGINIT		0x00020	/* Log Buffer has been initialized */
99*50b1fa39SSimon Glass #define GD_FLG_DISABLE_CONSOLE	0x00040	/* Disable console (in & out)	   */
100*50b1fa39SSimon Glass #define GD_FLG_ENV_READY	0x00080	/* Env. imported into hash table   */
101*50b1fa39SSimon Glass 
102*50b1fa39SSimon Glass #endif /* __ASM_GENERIC_GBL_DATA_H */
103