Merge git://git.denx.de/u-boot-x86
authorTom Rini <trini@ti.com>
Mon, 24 Nov 2014 17:00:00 +0000 (12:00 -0500)
committerTom Rini <trini@ti.com>
Mon, 24 Nov 2014 17:00:00 +0000 (12:00 -0500)
Conflicts:
arch/x86/cpu/Makefile

Signed-off-by: Tom Rini <trini@ti.com>
1  2 
Makefile
arch/x86/cpu/Makefile
arch/x86/cpu/coreboot/pci.c
arch/x86/cpu/coreboot/sdram.c
common/board_f.c

diff --combined Makefile
index 590fec88415911abb1867095dcfffab42d26491e,23590d91da8af8e2199a56847fcdfd4b8cdb03f5..db82dfe061ab767e62e5492fa5640376ee06ae48
+++ b/Makefile
@@@ -610,6 -610,9 +610,6 @@@ HAVE_VENDOR_COMMON_LIB = $(if $(wildcar
  libs-y += lib/
  libs-$(HAVE_VENDOR_COMMON_LIB) += board/$(VENDOR)/common/
  libs-y += $(CPUDIR)/
 -ifdef SOC
 -libs-y += $(CPUDIR)/$(SOC)/
 -endif
  libs-$(CONFIG_OF_EMBED) += dts/
  libs-y += arch/$(ARCH)/lib/
  libs-y += fs/
@@@ -746,6 -749,9 +746,9 @@@ ALL-$(CONFIG_SPL) += $(CONFIG_SPL_TARGE
  endif
  ALL-$(CONFIG_REMAKE_ELF) += u-boot.elf
  
+ # We can't do this yet due to the need for binary blobs
+ # ALL-$(CONFIG_X86_RESET_VECTOR) += u-boot.rom
  # enable combined SPL/u-boot/dtb rules for tegra
  ifneq ($(CONFIG_TEGRA),)
  ifeq ($(CONFIG_SPL),y)
@@@ -814,7 -820,8 +817,8 @@@ OBJCOPYFLAGS_u-boot.srec := -O sre
  u-boot.hex u-boot.srec: u-boot FORCE
        $(call if_changed,objcopy)
  
- OBJCOPYFLAGS_u-boot.bin := -O binary
+ OBJCOPYFLAGS_u-boot.bin := -O binary \
+               $(if $(CONFIG_X86_RESET_VECTOR),-R .start16 -R .resetvec)
  
  binary_size_check: u-boot.bin FORCE
        @file_size=$(shell wc -c u-boot.bin | awk '{print $$1}') ; \
@@@ -953,6 -960,36 +957,36 @@@ u-boot-nand.gph: u-boot.bin FORC
        $(call if_changed,mkimage)
        @dd if=/dev/zero bs=8 count=1 2>/dev/null >> $@
  
+ # x86 uses a large ROM. We fill it with 0xff, put the 16-bit stuff (including
+ # reset vector) at the top, Intel ME descriptor at the bottom, and U-Boot in
+ # the middle.
+ ifneq ($(CONFIG_X86_RESET_VECTOR),)
+ rom: u-boot.rom FORCE
+ u-boot.rom: u-boot-x86-16bit.bin u-boot-dtb.bin \
+               $(srctree)/board/$(BOARDDIR)/mrc.bin
+       $(objtree)/tools/ifdtool -c -r $(CONFIG_ROM_SIZE) u-boot.tmp
+       if [ -n "$(CONFIG_HAVE_INTEL_ME)" ]; then \
+               $(objtree)/tools/ifdtool -D \
+                       $(srctree)/board/$(BOARDDIR)/descriptor.bin u-boot.tmp; \
+               $(objtree)/tools/ifdtool \
+                       -i ME:$(srctree)/board/$(BOARDDIR)/me.bin u-boot.tmp; \
+       fi
+       $(objtree)/tools/ifdtool -w \
+               $(CONFIG_SYS_TEXT_BASE):$(objtree)/u-boot-dtb.bin u-boot.tmp
+       $(objtree)/tools/ifdtool -w \
+               $(CONFIG_X86_MRC_START):$(srctree)/board/$(BOARDDIR)/mrc.bin \
+               u-boot.tmp
+       $(objtree)/tools/ifdtool -w \
+               $(CONFIG_SYS_X86_START16):$(objtree)/u-boot-x86-16bit.bin \
+               u-boot.tmp
+       mv u-boot.tmp $@
+ OBJCOPYFLAGS_u-boot-x86-16bit.bin := -O binary -j .start16 -j .resetvec
+ u-boot-x86-16bit.bin: u-boot FORCE
+       $(call if_changed,objcopy)
+ endif
  ifneq ($(CONFIG_SUNXI),)
  OBJCOPYFLAGS_u-boot-sunxi-with-spl.bin = -I binary -O binary \
                                   --pad-to=$(CONFIG_SPL_PAD_TO) --gap-fill=0xff
diff --combined arch/x86/cpu/Makefile
index 8dd7b06c5dc72b2566b58958ee37ee06eb35687e,97f36d5d78b9f0ce3851c1ddfa207a67b82aea4d..2b9e9b9cf07f0996650f4c16b1c36aa13e579206
@@@ -11,5 -11,4 +11,6 @@@
  extra-y       = start.o
  obj-$(CONFIG_X86_RESET_VECTOR) += resetvec.o start16.o
  obj-y += interrupts.o cpu.o call64.o
 +
 +obj-$(CONFIG_SYS_COREBOOT) += coreboot/
+ obj-$(CONFIG_PCI) += pci.o
index b35d70cf1773ab9720ead0cad11aa76d704c1bc0,4778f71600bd9af7056c538e7b3073d996ef6751..6a3dd9391432017898e85c714100ee8e53232ce2
  #include <pci.h>
  #include <asm/pci.h>
  
- static struct pci_controller coreboot_hose;
  static void config_pci_bridge(struct pci_controller *hose, pci_dev_t dev,
                              struct pci_config_table *table)
  {
        u8 secondary;
        hose->read_byte(hose, dev, PCI_SECONDARY_BUS, &secondary);
 -      hose->last_busno = max(hose->last_busno, secondary);
 +      hose->last_busno = max(hose->last_busno, (int)secondary);
        pci_hose_scan_bus(hose, secondary);
  }
  
@@@ -31,19 -29,13 +29,13 @@@ static struct pci_config_table pci_core
        {}
  };
  
- void pci_init_board(void)
+ void board_pci_setup_hose(struct pci_controller *hose)
  {
-       coreboot_hose.config_table = pci_coreboot_config_table;
-       coreboot_hose.first_busno = 0;
-       coreboot_hose.last_busno = 0;
-       pci_set_region(coreboot_hose.regions + 0, 0x0, 0x0, 0xffffffff,
-               PCI_REGION_MEM);
-       coreboot_hose.region_count = 1;
-       pci_setup_type1(&coreboot_hose);
-       pci_register_hose(&coreboot_hose);
+       hose->config_table = pci_coreboot_config_table;
+       hose->first_busno = 0;
+       hose->last_busno = 0;
  
-       pci_hose_scan(&coreboot_hose);
+       pci_set_region(hose->regions + 0, 0x0, 0x0, 0xffffffff,
+                      PCI_REGION_MEM);
+       hose->region_count = 1;
  }
index 3140b6bb9108804ffea82795fd94e0602d2228aa,342ff300b85388d800ffbc89b56a8203949f9474..e98a2302e79d83c51ff63a43a74e206d507b861a
  #include <asm/e820.h>
  #include <asm/u-boot-x86.h>
  #include <asm/global_data.h>
+ #include <asm/init_helpers.h>
  #include <asm/processor.h>
  #include <asm/sections.h>
+ #include <asm/zimage.h>
  #include <asm/arch/sysinfo.h>
  #include <asm/arch/tables.h>
  
@@@ -22,7 -24,7 +24,7 @@@ unsigned install_e820_map(unsigned max_
  {
        int i;
  
 -      unsigned num_entries = min(lib_sysinfo.n_memranges, max_entries);
 +      unsigned num_entries = min((unsigned)lib_sysinfo.n_memranges, max_entries);
        if (num_entries < lib_sysinfo.n_memranges) {
                printf("Warning: Limiting e820 map to %d entries.\n",
                        num_entries);
@@@ -79,7 -81,7 +81,7 @@@ ulong board_get_usable_ram_top(ulong to
        return (ulong)dest_addr;
  }
  
- int dram_init_f(void)
+ int dram_init(void)
  {
        int i;
        phys_size_t ram_size = 0;
        gd->ram_size = ram_size;
        if (ram_size == 0)
                return -1;
-       return 0;
+       return calculate_relocation_address();
  }
  
int dram_init_banksize(void)
void dram_init_banksize(void)
  {
        int i, j;
  
                        }
                }
        }
-       return 0;
- }
- int dram_init(void)
- {
-       return dram_init_banksize();
  }
diff --combined common/board_f.c
index c6e38f3b117141987f666fafc1e051387d260482,6e6a1a2b98497ea935996bf179de04042196a09f..f8fd324d0d79741c0741f24d38645895c22a2fbb
@@@ -142,19 -142,17 +142,19 @@@ static int init_baud_rate(void
  static int display_text_info(void)
  {
  #ifndef CONFIG_SANDBOX
 -      ulong bss_start, bss_end;
 +      ulong bss_start, bss_end, text_base;
  
        bss_start = (ulong)&__bss_start;
        bss_end = (ulong)&__bss_end;
  
 -      debug("U-Boot code: %08X -> %08lX  BSS: -> %08lX\n",
  #ifdef CONFIG_SYS_TEXT_BASE
 -            CONFIG_SYS_TEXT_BASE, bss_start, bss_end);
 +      text_base = CONFIG_SYS_TEXT_BASE;
  #else
 -            CONFIG_SYS_MONITOR_BASE, bss_start, bss_end);
 +      text_base = CONFIG_SYS_MONITOR_BASE;
  #endif
 +
 +      debug("U-Boot code: %08lX -> %08lX  BSS: -> %08lX\n",
 +              text_base, bss_start, bss_end);
  #endif
  
  #ifdef CONFIG_MODEM_SUPPORT
@@@ -287,7 -285,7 +287,7 @@@ static int read_fdt_from_file(void
        struct sandbox_state *state = state_get_current();
        const char *fname = state->fdt_fname;
        void *blob;
 -      ssize_t size;
 +      loff_t size;
        int err;
        int fd;
  
                return -EINVAL;
        }
  
 -      size = os_get_filesize(fname);
 -      if (size < 0) {
 +      err = os_get_filesize(fname, &size);
 +      if (err < 0) {
                printf("Failed to file FDT file '%s'\n", fname);
 -              return -ENOENT;
 +              return err;
        }
        fd = os_open(fname, OS_O_RDONLY);
        if (fd < 0) {
@@@ -581,7 -579,7 +581,7 @@@ static int reserve_stacks(void
        gd->irq_sp = gd->start_addr_sp;
  # endif
  #else
 -# ifdef CONFIG_PPC
 +# if defined(CONFIG_PPC) || defined(CONFIG_MIPS)
        ulong *s;
  # endif
  
        s = (ulong *) gd->start_addr_sp;
        *s = 0; /* Terminate back chain */
        *++s = 0; /* NULL return address */
 +# elif defined(CONFIG_MIPS)
 +      /* Clear initial stack frame */
 +      s = (ulong *) gd->start_addr_sp;
 +      *s-- = 0;
 +      *s-- = 0;
 +      gd->start_addr_sp = (ulong) s;
  # endif /* Architecture specific code */
  
        return 0;
@@@ -820,22 -812,16 +820,16 @@@ static init_fnc_t init_sequence_f[] = 
        setup_mon_len,
        setup_fdt,
        trace_early_init,
+       initf_malloc,
  #if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)
        /* TODO: can this go into arch_cpu_init()? */
        probecpu,
  #endif
        arch_cpu_init,          /* basic arch cpu dependent setup */
- #ifdef CONFIG_X86
-       cpu_init_f,             /* TODO(sjg@chromium.org): remove */
- # ifdef CONFIG_OF_CONTROL
-       find_fdt,               /* TODO(sjg@chromium.org): remove */
- # endif
- #endif
        mark_bootstage,
  #ifdef CONFIG_OF_CONTROL
        fdtdec_check_fdt,
  #endif
-       initf_malloc,
        initf_dm,
  #if defined(CONFIG_BOARD_EARLY_INIT_F)
        board_early_init_f,
  #endif
  #if defined(CONFIG_HARD_SPI)
        init_func_spi,
- #endif
- #ifdef CONFIG_X86
-       dram_init_f,            /* configure available RAM banks */
-       calculate_relocation_address,
  #endif
        announce_dram_init,
        /* TODO: unify all these dram functions? */
- #ifdef CONFIG_ARM
+ #if defined(CONFIG_ARM) || defined(CONFIG_X86)
        dram_init,              /* configure available RAM banks */
  #endif
  #if defined(CONFIG_MIPS) || defined(CONFIG_PPC)