Commit a661b99d authored by Tom Rini's avatar Tom Rini
Browse files

Merge branch 'master' of git://git.denx.de/u-boot-x86

parents a7e62be0 8f0278ea
......@@ -30,7 +30,7 @@ LIB = $(obj)lib$(CPU).o
START-y = start.o
START-$(CONFIG_X86_RESET_VECTOR) += resetvec.o start16.o
COBJS = interrupts.o cpu.o timer.o
COBJS = interrupts.o cpu.o
SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
......
......@@ -26,6 +26,7 @@
#include <asm/u-boot-x86.h>
#include <flash.h>
#include <netdev.h>
#include <ns16550.h>
#include <asm/msr.h>
#include <asm/cache.h>
#include <asm/io.h>
......@@ -90,6 +91,9 @@ void show_boot_progress(int val)
int last_stage_init(void)
{
if (gd->flags & GD_FLG_COLD_BOOT)
timestamp_add_to_bootstage();
return 0;
}
......@@ -135,3 +139,12 @@ int board_final_cleanup(void)
return 0;
}
void panic_puts(const char *str)
{
NS16550_t port = (NS16550_t)0x3f8;
NS16550_init(port, 1);
while (*str)
NS16550_putc(port, *str++);
}
......@@ -39,7 +39,9 @@ static struct timestamp_table *ts_table __attribute__((section(".data")));
void timestamp_init(void)
{
ts_table = lib_sysinfo.tstamp_table;
timer_set_tsc_base(ts_table->base_time);
#ifdef CONFIG_SYS_X86_TSC_TIMER
timer_set_base(ts_table->base_time);
#endif
timestamp_add_now(TS_U_BOOT_INITTED);
}
......@@ -59,3 +61,41 @@ void timestamp_add_now(enum timestamp_id id)
{
timestamp_add(id, rdtsc());
}
int timestamp_add_to_bootstage(void)
{
uint i;
if (!ts_table)
return -1;
for (i = 0; i < ts_table->num_entries; i++) {
struct timestamp_entry *tse = &ts_table->entries[i];
const char *name = NULL;
switch (tse->entry_id) {
case TS_START_ROMSTAGE:
name = "start-romstage";
break;
case TS_BEFORE_INITRAM:
name = "before-initram";
break;
case TS_DEVICE_INITIALIZE:
name = "device-initialize";
break;
case TS_DEVICE_DONE:
name = "device-done";
break;
case TS_SELFBOOT_JUMP:
name = "selfboot-jump";
break;
}
if (name) {
bootstage_add_record(0, name, BOOTSTAGEF_ALLOC,
tse->entry_stamp /
get_tbclk_mhz());
}
}
return 0;
}
......@@ -120,6 +120,11 @@ void setup_gdt(gd_t *id, u64 *gdt_addr)
int __weak x86_cleanup_before_linux(void)
{
#ifdef CONFIG_BOOTSTAGE_STASH
bootstage_stash((void *)CONFIG_BOOTSTAGE_STASH,
CONFIG_BOOTSTAGE_STASH_SIZE);
#endif
return 0;
}
......
......@@ -37,6 +37,8 @@
#include <asm/msr.h>
#include <asm/u-boot-x86.h>
DECLARE_GLOBAL_DATA_PTR;
#define DECLARE_INTERRUPT(x) \
".globl irq_"#x"\n" \
".hidden irq_"#x"\n" \
......
/*
* Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*/
#include <common.h>
unsigned long timer_get_us(void)
{
printf("timer_get_us used but not implemented.\n");
return 0;
}
......@@ -79,18 +79,6 @@ SECTIONS
/DISCARD/ : { *(.interp*) }
/DISCARD/ : { *(.gnu*) }
/* 16bit realmode trampoline code */
.realmode REALMODE_BASE : AT ( LOADADDR(.rel.dyn) + SIZEOF(.rel.dyn) ) { KEEP(*(.realmode)) }
__realmode_start = LOADADDR(.realmode);
__realmode_size = SIZEOF(.realmode);
/* 16bit BIOS emulation code (just enough to boot Linux) */
.bios 0 : AT ( LOADADDR(.realmode) + SIZEOF(.realmode) ) { KEEP(*(.bios)) }
__bios_start = LOADADDR(.bios);
__bios_size = SIZEOF(.bios);
#ifdef CONFIG_X86_RESET_VECTOR
/*
......
......@@ -49,4 +49,11 @@ void timestamp_init(void);
void timestamp_add(enum timestamp_id id, uint64_t ts_time);
void timestamp_add_now(enum timestamp_id id);
/**
* timestamp_add_to_bootstage - Add important coreboot timestamps to bootstage
*
* @return 0 if ok, -1 if no timestamps were found
*/
int timestamp_add_to_bootstage(void);
#endif
......@@ -24,19 +24,10 @@
#ifndef _INIT_HELPERS_H_
#define _INIT_HELPERS_H_
int display_banner(void);
int display_dram_config(void);
int init_baudrate_f(void);
int calculate_relocation_address(void);
int init_cache_f_r(void);
int set_reloc_flag_r(void);
int mem_malloc_init_r(void);
int init_bd_struct_r(void);
int flash_init_r(void);
int status_led_set_r(void);
int set_load_addr_r(void);
int init_func_spi(void);
int find_fdt(void);
int prepare_fdt(void);
......
/*
* (C) Copyright 2011
* Graeme Russ, <graeme.russ@gmail.com>
*
* See file CREDITS for list of people who contributed to this
* project.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
#ifndef _INIT_WRAPPERS_H_
#define _INIT_WRAPPERS_H_
int serial_initialize_r(void);
int env_relocate_r(void);
int pci_init_r(void);
int jumptable_init_r(void);
int pcmcia_init_r(void);
int kgdb_init_r(void);
int enable_interrupts_r(void);
int eth_initialize_r(void);
int reset_phy_r(void);
int ide_init_r(void);
int scsi_init_r(void);
int doc_init_r(void);
int bb_miiphy_init_r(void);
int post_run_r(void);
#endif /* !_INIT_WRAPPERS_H_ */
......@@ -30,8 +30,4 @@
const struct pci_device_id _table[]
void pci_setup_type1(struct pci_controller *hose);
int pci_enable_legacy_video_ports(struct pci_controller* hose);
int pci_shadow_rom(pci_dev_t dev, unsigned char *dest);
void pci_remove_rom_window(struct pci_controller* hose, u32 addr);
u32 pci_get_rom_window(struct pci_controller* hose, int size);
#endif
......@@ -33,11 +33,15 @@ void init_gd(gd_t *id, u64 *gdt_addr);
void setup_gdt(gd_t *id, u64 *gdt_addr);
int init_cache(void);
int cleanup_before_linux(void);
void panic_puts(const char *str);
/* cpu/.../timer.c */
void timer_isr(void *);
typedef void (timer_fnc_t) (void);
int register_timer_isr (timer_fnc_t *isr_func);
unsigned long get_tbclk_mhz(void);
void timer_set_base(uint64_t base);
int pcat_timer_init(void);
/* Architecture specific - can be in arch/x86/cpu/, arch/x86/lib/, or $(BOARD)/ */
int dram_init_f(void);
......
......@@ -36,40 +36,8 @@
#ifndef _U_BOOT_H_
#define _U_BOOT_H_ 1
#include <config.h>
#include <compiler.h>
#ifdef CONFIG_SYS_GENERIC_BOARD
/* Use the generic board which requires a unified bd_info */
#include <asm-generic/u-boot.h>
#else
#ifndef __ASSEMBLY__
typedef struct bd_info {
unsigned long bi_memstart; /* start of DRAM memory */
phys_size_t bi_memsize; /* size of DRAM memory in bytes */
unsigned long bi_flashstart; /* start of FLASH memory */
unsigned long bi_flashsize; /* size of FLASH memory */
unsigned long bi_flashoffset; /* reserved area for startup monitor */
unsigned long bi_sramstart; /* start of SRAM memory */
unsigned long bi_sramsize; /* size of SRAM memory */
unsigned long bi_bootflags; /* boot / reboot flag (for LynxOS) */
unsigned short bi_ethspeed; /* Ethernet speed in Mbps */
unsigned long bi_intfreq; /* Internal Freq, in MHz */
unsigned long bi_busfreq; /* Bus Freq, in MHz */
unsigned int bi_baudrate; /* Console Baudrate */
unsigned long bi_boot_params; /* where this board expects params */
struct /* RAM configuration */
{
ulong start;
ulong size;
}bi_dram[CONFIG_NR_DRAM_BANKS];
} bd_t;
#endif /* __ASSEMBLY__ */
#endif /* !CONFIG_SYS_GENERIC_BOARD */
/* For image.h:image_check_target_arch() */
#define IH_ARCH_DEFAULT IH_ARCH_I386
......
......@@ -25,24 +25,18 @@ include $(TOPDIR)/config.mk
LIB = $(obj)lib$(ARCH).o
ifeq ($(CONFIG_SYS_GENERIC_BOARD),)
COBJS-y += board.o
endif
COBJS-y += bootm.o
COBJS-y += cmd_boot.o
COBJS-y += gcc.o
COBJS-y += init_helpers.o
COBJS-y += init_wrappers.o
COBJS-y += interrupts.o
COBJS-$(CONFIG_SYS_PCAT_INTERRUPTS) += pcat_interrupts.o
COBJS-$(CONFIG_SYS_GENERIC_TIMER) += pcat_timer.o
COBJS-$(CONFIG_PCI) += pci.o
COBJS-$(CONFIG_SYS_PCAT_TIMER) += pcat_timer.o
COBJS-$(CONFIG_PCI) += pci_type1.o
COBJS-y += relocate.o
COBJS-y += physmem.o
COBJS-y += string.o
COBJS-$(CONFIG_SYS_X86_ISR_TIMER) += timer.o
COBJS-$(CONFIG_SYS_X86_TSC_TIMER) += tsc_timer.o
COBJS-$(CONFIG_VIDEO_VGA) += video.o
COBJS-$(CONFIG_CMD_ZBOOT) += zimage.o
......
/*
* (C) Copyright 2002
* Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
*
* See file CREDITS for list of people who contributed to this
* project.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
#ifndef _BIOS_H_
#define _BIOS_H_
#define OFFS_ES 0 /* 16bit */
#define OFFS_GS 2 /* 16bit */
#define OFFS_DS 4 /* 16bit */
#define OFFS_EDI 6 /* 32bit */
#define OFFS_DI 6 /* low 16 bits of EDI */
#define OFFS_ESI 10 /* 32bit */
#define OFFS_SI 10 /* low 16 bits of ESI */
#define OFFS_EBP 14 /* 32bit */
#define OFFS_BP 14 /* low 16 bits of EBP */
#define OFFS_ESP 18 /* 32bit */
#define OFFS_SP 18 /* low 16 bits of ESP */
#define OFFS_EBX 22 /* 32bit */
#define OFFS_BX 22 /* low 16 bits of EBX */
#define OFFS_BL 22 /* low 8 bits of BX */
#define OFFS_BH 23 /* high 8 bits of BX */
#define OFFS_EDX 26 /* 32bit */
#define OFFS_DX 26 /* low 16 bits of EBX */
#define OFFS_DL 26 /* low 8 bits of BX */
#define OFFS_DH 27 /* high 8 bits of BX */
#define OFFS_ECX 30 /* 32bit */
#define OFFS_CX 30 /* low 16 bits of EBX */
#define OFFS_CL 30 /* low 8 bits of BX */
#define OFFS_CH 31 /* high 8 bits of BX */
#define OFFS_EAX 34 /* 32bit */
#define OFFS_AX 34 /* low 16 bits of EBX */
#define OFFS_AL 34 /* low 8 bits of BX */
#define OFFS_AH 35 /* high 8 bits of BX */
#define OFFS_VECTOR 38 /* 16bit */
#define OFFS_IP 40 /* 16bit */
#define OFFS_CS 42 /* 16bit */
#define OFFS_FLAGS 44 /* 16bit */
/* stack at 0x40:0x800 -> 0x800 */
#define SEGMENT 0x40
#define STACK 0x800
/*
* save general registers
* save some segments
* save callers stack segment
* setup BIOS segments
* setup BIOS stackpointer
*/
#define MAKE_BIOS_STACK \
pushal; \
pushw %ds; \
pushw %gs; \
pushw %es; \
pushw %ss; \
popw %gs; \
movw $SEGMENT, %ax; \
movw %ax, %ds; \
movw %ax, %es; \
movw %ax, %ss; \
movw %sp, %bp; \
movw $STACK, %sp
/*
* restore callers stack segment
* restore some segments
* restore general registers
*/
#define RESTORE_CALLERS_STACK \
pushw %gs; \
popw %ss; \
movw %bp, %sp; \
popw %es; \
popw %gs; \
popw %ds; \
popal
#ifndef __ASSEMBLY__
#define BIOS_DATA ((char *)0x400)
#define BIOS_DATA_SIZE 256
#define BIOS_BASE ((char *)0xf0000)
#define BIOS_CS 0xf000
extern ulong __bios_start;
extern ulong __bios_size;
/* these are defined in a 16bit segment and needs
* to be accessed with the RELOC_16_xxxx() macros below
*/
extern u16 ram_in_64kb_chunks;
extern u16 bios_equipment;
extern u8 pci_last_bus;
extern void *rm_int00;
extern void *rm_int01;
extern void *rm_int02;
extern void *rm_int03;
extern void *rm_int04;
extern void *rm_int05;
extern void *rm_int06;
extern void *rm_int07;
extern void *rm_int08;
extern void *rm_int09;
extern void *rm_int0a;
extern void *rm_int0b;
extern void *rm_int0c;
extern void *rm_int0d;
extern void *rm_int0e;
extern void *rm_int0f;
extern void *rm_int10;
extern void *rm_int11;
extern void *rm_int12;
extern void *rm_int13;
extern void *rm_int14;
extern void *rm_int15;
extern void *rm_int16;
extern void *rm_int17;
extern void *rm_int18;
extern void *rm_int19;
extern void *rm_int1a;
extern void *rm_int1b;
extern void *rm_int1c;
extern void *rm_int1d;
extern void *rm_int1e;
extern void *rm_int1f;
extern void *rm_def_int;
#define RELOC_16_LONG(seg, off) (*(u32 *)(seg << 4 | (u32)&off))
#define RELOC_16_WORD(seg, off) (*(u16 *)(seg << 4 | (u32)&off))
#define RELOC_16_BYTE(seg, off) (*(u8 *)(seg << 4 | (u32)&off))
#ifdef PCI_BIOS_DEBUG
extern u32 num_pci_bios_present;
extern u32 num_pci_bios_find_device;
extern u32 num_pci_bios_find_class;
extern u32 num_pci_bios_generate_special_cycle;
extern u32 num_pci_bios_read_cfg_byte;
extern u32 num_pci_bios_read_cfg_word;
extern u32 num_pci_bios_read_cfg_dword;
extern u32 num_pci_bios_write_cfg_byte;
extern u32 num_pci_bios_write_cfg_word;
extern u32 num_pci_bios_write_cfg_dword;
extern u32 num_pci_bios_get_irq_routing;
extern u32 num_pci_bios_set_irq;
extern u32 num_pci_bios_unknown_function;
#endif
#endif
#endif
/*
* (C) Copyright 2008-2011
* Graeme Russ, <graeme.russ@gmail.com>
*
* (C) Copyright 2002
* Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
*
* (C) Copyright 2002
* Wolfgang Denk, DENX Software Engineering, <wd@denx.de>
*
* (C) Copyright 2002
* Sysgo Real-Time Solutions, GmbH <www.elinos.com>
* Marius Groeger <mgroeger@sysgo.de>
*
* See file CREDITS for list of people who contributed to this
* project.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
#include <common.h>
#include <fdtdec.h>
#include <watchdog.h>
#include <stdio_dev.h>
#include <asm/u-boot-x86.h>
#include <asm/relocate.h>
#include <asm/processor.h>
#include <asm/sections.h>
#include <asm/init_helpers.h>
#include <asm/init_wrappers.h>
/*
* Breath some life into the board...
*
* Getting the board up and running is a three-stage process:
* 1) Execute from Flash, SDRAM Uninitialised
* At this point, there is a limited amount of non-SDRAM memory
* (typically the CPU cache, but can also be SRAM or even a buffer of
* of some peripheral). This limited memory is used to hold:
* - The initial copy of the Global Data Structure
* - A temporary stack
* - A temporary x86 Global Descriptor Table
* - The pre-console buffer (if enabled)
*
* The following is performed during this phase of execution:
* - Core low-level CPU initialisation
* - Console initialisation
* - SDRAM initialisation
*
* 2) Execute from Flash, SDRAM Initialised
* At this point we copy Global Data from the initial non-SDRAM
* memory and set up the permanent stack in SDRAM. The CPU cache is no
* longer being used as temporary memory, so we can now fully enable
* it.
*
* The following is performed during this phase of execution:
* - Create final stack in SDRAM
* - Copy Global Data from temporary memory to SDRAM
* - Enabling of CPU cache(s),
* - Copying of U-Boot code and data from Flash to RAM
* - Clearing of the BSS
* - ELF relocation adjustments
*
* 3) Execute from SDRAM
* The following is performed during this phase of execution:
* - All remaining initialisation
*/
/*
* The requirements for any new initalization function is simple: it is
* a function with no parameters which returns an integer return code,
* where 0 means "continue" and != 0 means "fatal error, hang the system"
*/
typedef int (init_fnc_t) (void);
/*
* init_sequence_f is the list of init functions which are run when U-Boot
* is executing from Flash with a limited 'C' environment. The following
* limitations must be considered when implementing an '_f' function:
* - 'static' variables are read-only
* - Global Data (gd->xxx) is read/write
* - Stack space is limited
*
* The '_f' sequence must, as a minimum, initialise SDRAM. It _should_
* also initialise the console (to provide early debug output)
*/
init_fnc_t *init_sequence_f[] = {
cpu_init_f,
board_early_init_f,
#ifdef CONFIG_OF_CONTROL
find_fdt,
fdtdec_check_fdt,
#endif
env_init,
init_baudrate_f,
serial_init,
console_init_f,
#ifdef CONFIG_OF_CONTROL
prepare_fdt,
#endif
dram_init_f,
calculate_relocation_address,
NULL,
};
/*
* init_sequence_f_r is the list of init functions which are run when
* U-Boot is executing from Flash with a semi-limited 'C' environment.
* The following limitations must be considered when implementing an
* '_f_r' function:
* - 'static' variables are read-only
* - Global Data (gd->xxx) is read/write
*
* The '_f_r' sequence must, as a minimum, copy U-Boot to RAM (if
* supported). It _should_, if possible, copy global data to RAM and
* initialise the CPU caches (to speed up the relocation process)
*/
init_fnc_t *init_sequence_f_r[] = {
init_cache_f_r,
copy_uboot_to_ram,