150b1fa39SSimon Glass /* 250b1fa39SSimon Glass * Copyright (c) 2012 The Chromium OS Authors. 350b1fa39SSimon Glass * (C) Copyright 2002-2010 450b1fa39SSimon Glass * Wolfgang Denk, DENX Software Engineering, wd@denx.de. 550b1fa39SSimon Glass * 61a459660SWolfgang Denk * SPDX-License-Identifier: GPL-2.0+ 750b1fa39SSimon Glass */ 850b1fa39SSimon Glass 950b1fa39SSimon Glass #ifndef __ASM_GENERIC_GBL_DATA_H 1050b1fa39SSimon Glass #define __ASM_GENERIC_GBL_DATA_H 1150b1fa39SSimon Glass /* 1250b1fa39SSimon Glass * The following data structure is placed in some memory which is 1350b1fa39SSimon Glass * available very early after boot (like DPRAM on MPC8xx/MPC82xx, or 1450b1fa39SSimon Glass * some locked parts of the data cache) to allow for a minimum set of 1550b1fa39SSimon Glass * global variables during system initialization (until we have set 1650b1fa39SSimon Glass * up the memory controller so that we can use RAM). 1750b1fa39SSimon Glass * 1850b1fa39SSimon Glass * Keep it *SMALL* and remember to set GENERATED_GBL_DATA_SIZE > sizeof(gd_t) 1950b1fa39SSimon Glass * 2050b1fa39SSimon Glass * Each architecture has its own private fields. For now all are private 2150b1fa39SSimon Glass */ 2250b1fa39SSimon Glass 2350b1fa39SSimon Glass #ifndef __ASSEMBLY__ 249854a874SSimon Glass #include <membuff.h> 256494d708SSimon Glass #include <linux/list.h> 266494d708SSimon Glass 2750b1fa39SSimon Glass typedef struct global_data { 2850b1fa39SSimon Glass bd_t *bd; 2950b1fa39SSimon Glass unsigned long flags; 30b5bec884SSimon Glass unsigned int baudrate; 3150b1fa39SSimon Glass unsigned long cpu_clk; /* CPU clock in Hz! */ 3250b1fa39SSimon Glass unsigned long bus_clk; 3350b1fa39SSimon Glass /* We cannot bracket this with CONFIG_PCI due to mpc5xxx */ 3450b1fa39SSimon Glass unsigned long pci_clk; 3550b1fa39SSimon Glass unsigned long mem_clk; 3650b1fa39SSimon Glass #if defined(CONFIG_LCD) || defined(CONFIG_VIDEO) 3750b1fa39SSimon Glass unsigned long fb_base; /* Base address of framebuffer mem */ 3850b1fa39SSimon Glass #endif 3950b1fa39SSimon Glass #if defined(CONFIG_POST) || defined(CONFIG_LOGBUFFER) 4050b1fa39SSimon Glass unsigned long post_log_word; /* Record POST activities */ 4150b1fa39SSimon Glass unsigned long post_log_res; /* success of POST test */ 4250b1fa39SSimon Glass unsigned long post_init_f_time; /* When post_init_f started */ 4350b1fa39SSimon Glass #endif 4450b1fa39SSimon Glass #ifdef CONFIG_BOARD_TYPES 4550b1fa39SSimon Glass unsigned long board_type; 4650b1fa39SSimon Glass #endif 4750b1fa39SSimon Glass unsigned long have_console; /* serial_init() was called */ 4850b1fa39SSimon Glass #ifdef CONFIG_PRE_CONSOLE_BUFFER 4950b1fa39SSimon Glass unsigned long precon_buf_idx; /* Pre-Console buffer index */ 5050b1fa39SSimon Glass #endif 5150b1fa39SSimon Glass unsigned long env_addr; /* Address of Environment struct */ 5250b1fa39SSimon Glass unsigned long env_valid; /* Checksum of Environment valid? */ 5350b1fa39SSimon Glass 5450b1fa39SSimon Glass unsigned long ram_top; /* Top address of RAM used by U-Boot */ 5550b1fa39SSimon Glass 5650b1fa39SSimon Glass unsigned long relocaddr; /* Start address of U-Boot in RAM */ 5750b1fa39SSimon Glass phys_size_t ram_size; /* RAM size */ 58e8149522SYork Sun #ifdef CONFIG_SYS_MEM_RESERVE_SECURE 59e8149522SYork Sun #define MEM_RESERVE_SECURE_SECURED 0x1 60e8149522SYork Sun #define MEM_RESERVE_SECURE_MAINTAINED 0x2 61e8149522SYork Sun #define MEM_RESERVE_SECURE_ADDR_MASK (~0x3) 62e8149522SYork Sun /* 63e8149522SYork Sun * Secure memory addr 64e8149522SYork Sun * This variable needs maintenance if the RAM base is not zero, 65e8149522SYork Sun * or if RAM splits into non-consecutive banks. It also has a 66e8149522SYork Sun * flag indicating the secure memory is marked as secure by MMU. 67e8149522SYork Sun * Flags used: 0x1 secured 68e8149522SYork Sun * 0x2 maintained 69e8149522SYork Sun */ 70e8149522SYork Sun phys_addr_t secure_ram; 71e8149522SYork Sun #endif 7250b1fa39SSimon Glass unsigned long mon_len; /* monitor len */ 7350b1fa39SSimon Glass unsigned long irq_sp; /* irq stack pointer */ 7450b1fa39SSimon Glass unsigned long start_addr_sp; /* start_addr_stackpointer */ 7550b1fa39SSimon Glass unsigned long reloc_off; 7650b1fa39SSimon Glass struct global_data *new_gd; /* relocated global data */ 776494d708SSimon Glass 786494d708SSimon Glass #ifdef CONFIG_DM 7954c5d08aSHeiko Schocher struct udevice *dm_root; /* Root instance for Driver Model */ 80ab7cd627SSimon Glass struct udevice *dm_root_f; /* Pre-relocation root instance */ 816494d708SSimon Glass struct list_head uclass_root; /* Head of core tree */ 826494d708SSimon Glass #endif 83c8a7ba9eSThomas Chou #ifdef CONFIG_TIMER 84c8a7ba9eSThomas Chou struct udevice *timer; /* Timer instance for Driver Model */ 85c8a7ba9eSThomas Chou #endif 866494d708SSimon Glass 8750b1fa39SSimon Glass const void *fdt_blob; /* Our device tree, NULL if none */ 881938f4a5SSimon Glass void *new_fdt; /* Relocated FDT */ 891938f4a5SSimon Glass unsigned long fdt_size; /* Space reserved for relocated FDT */ 9049cad547SMartin Dorwig struct jt_funcs *jt; /* jump table */ 9150b1fa39SSimon Glass char env_buf[32]; /* buffer for getenv() before reloc. */ 9271c52dbaSSimon Glass #ifdef CONFIG_TRACE 9371c52dbaSSimon Glass void *trace_buff; /* The trace buffer */ 9471c52dbaSSimon Glass #endif 95385c9ef5SHeiko Schocher #if defined(CONFIG_SYS_I2C) 96385c9ef5SHeiko Schocher int cur_i2c_bus; /* current used i2c bus */ 97385c9ef5SHeiko Schocher #endif 98dec1861bSYork Sun #ifdef CONFIG_SYS_I2C_MXC 99dec1861bSYork Sun void *srdata[10]; 100dec1861bSYork Sun #endif 1018dfafddeSRob Herring unsigned long timebase_h; 1028dfafddeSRob Herring unsigned long timebase_l; 103d59476b6SSimon Glass #ifdef CONFIG_SYS_MALLOC_F_LEN 104d59476b6SSimon Glass unsigned long malloc_base; /* base address of early malloc() */ 105d59476b6SSimon Glass unsigned long malloc_limit; /* limit address */ 106d59476b6SSimon Glass unsigned long malloc_ptr; /* current address */ 107d59476b6SSimon Glass #endif 1088f9052fdSBin Meng #ifdef CONFIG_PCI 1098f9052fdSBin Meng struct pci_controller *hose; /* PCI hose for early use */ 110b9da5086SSimon Glass phys_addr_t pci_ram_top; /* top of region accessible to PCI */ 1118f9052fdSBin Meng #endif 1128f9052fdSBin Meng #ifdef CONFIG_PCI_BOOTDELAY 1138f9052fdSBin Meng int pcidelay_done; 1148f9052fdSBin Meng #endif 115469a579dSSimon Glass struct udevice *cur_serial_dev; /* current serial device */ 1162212e69bSSimon Glass struct arch_global_data arch; /* architecture-specific data */ 1179854a874SSimon Glass #ifdef CONFIG_CONSOLE_RECORD 1189854a874SSimon Glass struct membuff console_out; /* console output */ 1199854a874SSimon Glass struct membuff console_in; /* console input */ 1209854a874SSimon Glass #endif 1215a541945SSimon Glass #ifdef CONFIG_DM_VIDEO 1225a541945SSimon Glass ulong video_top; /* Top of video frame buffer area */ 1235a541945SSimon Glass ulong video_bottom; /* Bottom of video frame buffer area */ 1245a541945SSimon Glass #endif 12550b1fa39SSimon Glass } gd_t; 12650b1fa39SSimon Glass #endif 12750b1fa39SSimon Glass 12850b1fa39SSimon Glass /* 129b0b403d9SSimon Glass * Global Data Flags - the top 16 bits are reserved for arch-specific flags 13050b1fa39SSimon Glass */ 13150b1fa39SSimon Glass #define GD_FLG_RELOC 0x00001 /* Code was relocated to RAM */ 13250b1fa39SSimon Glass #define GD_FLG_DEVINIT 0x00002 /* Devices have been initialized */ 13350b1fa39SSimon Glass #define GD_FLG_SILENT 0x00004 /* Silent mode */ 13450b1fa39SSimon Glass #define GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed */ 13550b1fa39SSimon Glass #define GD_FLG_POSTSTOP 0x00010 /* POST seqeunce aborted */ 13650b1fa39SSimon Glass #define GD_FLG_LOGINIT 0x00020 /* Log Buffer has been initialized */ 13750b1fa39SSimon Glass #define GD_FLG_DISABLE_CONSOLE 0x00040 /* Disable console (in & out) */ 13850b1fa39SSimon Glass #define GD_FLG_ENV_READY 0x00080 /* Env. imported into hash table */ 139093f79abSSimon Glass #define GD_FLG_SERIAL_READY 0x00100 /* Pre-reloc serial console ready */ 140c9356be3SSimon Glass #define GD_FLG_FULL_MALLOC_INIT 0x00200 /* Full malloc() is ready */ 141070d00b8SSimon Glass #define GD_FLG_SPL_INIT 0x00400 /* spl_init() has been called */ 142f05ad9baSSimon Glass #define GD_FLG_SKIP_RELOC 0x00800 /* Don't relocate */ 1439854a874SSimon Glass #define GD_FLG_RECORD 0x01000 /* Record console */ 144*340b0e3bSMichal Simek #define GD_FLG_ENV_DEFAULT 0x02000 /* Default variable flag */ 14550b1fa39SSimon Glass 14650b1fa39SSimon Glass #endif /* __ASM_GENERIC_GBL_DATA_H */ 147