summaryrefslogtreecommitdiff
path: root/arch/x86/include
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2012-02-17 23:47:29 +0100
committerWolfgang Denk <wd@denx.de>2012-02-17 23:47:29 +0100
commite390e8709149664ff96cf19384264c84573f3082 (patch)
treea14b00ce6732eedf0b9c20b2cb54f17f1ac14596 /arch/x86/include
parente9d44b35beb45869863f3ca6929089d9df4df3e5 (diff)
parentafd855d534de22aa625cb12aa9aa45e459f7de99 (diff)
downloadu-boot-imx-e390e8709149664ff96cf19384264c84573f3082.zip
u-boot-imx-e390e8709149664ff96cf19384264c84573f3082.tar.gz
u-boot-imx-e390e8709149664ff96cf19384264c84573f3082.tar.bz2
Merge branch 'master' of git://git.denx.de/u-boot-x86
* 'master' of git://git.denx.de/u-boot-x86: x86: Convert board_init_f_r to a processing loop x86: Split init functions out of board.c x86: Move relocation code out of board.c x86: Move setup_pcat_compatibility() out of board.c x86: Move do_go_exec() out of board.c CHECKPATCH: arch/x86/lib/* x86: Tweak IDT and GDT for alignment and readability x86: Allow cache before copy to RAM x86: Create weak init_cache() and default enable_caches() functions x86: Set GD_FLG_RELOC after entering in-RAM copy of U-Boot x86: Use fs for global data x86: Rework relocation calculations x86: Simplify Flash-to-RAM code execution transition x86: Rework Global Descriptor Table loading x86: Remove GDR related magic numbers x86: Speed up copy-to-RAM and clear BSS operations x86: Import glibc memcpy implementation
Diffstat (limited to 'arch/x86/include')
-rw-r--r--arch/x86/include/asm/global_data.h21
-rw-r--r--arch/x86/include/asm/init_helpers.h44
-rw-r--r--arch/x86/include/asm/init_wrappers.h42
-rw-r--r--arch/x86/include/asm/processor.h24
-rw-r--r--arch/x86/include/asm/relocate.h33
-rw-r--r--arch/x86/include/asm/string.h2
-rw-r--r--arch/x86/include/asm/u-boot-x86.h5
7 files changed, 159 insertions, 12 deletions
diff --git a/arch/x86/include/asm/global_data.h b/arch/x86/include/asm/global_data.h
index 05a2139..908a02c 100644
--- a/arch/x86/include/asm/global_data.h
+++ b/arch/x86/include/asm/global_data.h
@@ -36,6 +36,8 @@
#ifndef __ASSEMBLY__
typedef struct global_data {
+ /* NOTE: gd_addr MUST be first member of struct global_data! */
+ unsigned long gd_addr; /* Location of Global Data */
bd_t *bd;
unsigned long flags;
unsigned long baudrate;
@@ -51,13 +53,24 @@ typedef struct global_data {
unsigned long bus_clk;
unsigned long relocaddr; /* Start address of U-Boot in RAM */
unsigned long start_addr_sp; /* start_addr_stackpointer */
+ unsigned long gdt_addr; /* Location of GDT */
+ unsigned long new_gd_addr; /* New location of Global Data */
phys_size_t ram_size; /* RAM size */
unsigned long reset_status; /* reset status register at boot */
void **jt; /* jump table */
char env_buf[32]; /* buffer for getenv() before reloc. */
} gd_t;
-extern gd_t *gd;
+static inline gd_t *get_fs_gd_ptr(void)
+{
+ gd_t *gd_ptr;
+
+ asm volatile("fs movl 0, %0\n" : "=r" (gd_ptr));
+
+ return gd_ptr;
+}
+
+#define gd get_fs_gd_ptr()
#endif
@@ -73,12 +86,6 @@ extern gd_t *gd;
#define GD_FLG_DISABLE_CONSOLE 0x00040 /* Disable console (in & out) */
#define GD_FLG_ENV_READY 0x00080 /* Environment imported into hash table */
-#if 0
#define DECLARE_GLOBAL_DATA_PTR
-#else
-#define XTRN_DECLARE_GLOBAL_DATA_PTR extern
-#define DECLARE_GLOBAL_DATA_PTR XTRN_DECLARE_GLOBAL_DATA_PTR \
-gd_t *gd
-#endif
#endif /* __ASM_GBL_DATA_H */
diff --git a/arch/x86/include/asm/init_helpers.h b/arch/x86/include/asm/init_helpers.h
new file mode 100644
index 0000000..192f18e
--- /dev/null
+++ b/arch/x86/include/asm/init_helpers.h
@@ -0,0 +1,44 @@
+/*
+ * (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_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 copy_gd_to_ram_f_r(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 init_ip_address_r(void);
+int status_led_set_r(void);
+int set_bootfile_r(void);
+int set_load_addr_r(void);
+
+#endif /* !_INIT_HELPERS_H_ */
diff --git a/arch/x86/include/asm/init_wrappers.h b/arch/x86/include/asm/init_wrappers.h
new file mode 100644
index 0000000..899ffb1
--- /dev/null
+++ b/arch/x86/include/asm/init_wrappers.h
@@ -0,0 +1,42 @@
+/*
+ * (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_ */
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index 1e5dccd..6eb5180 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -24,9 +24,25 @@
#ifndef __ASM_PROCESSOR_H_
#define __ASM_PROCESSOR_H_ 1
-#define GDT_ENTRY_32BIT_CS 2
-#define GDT_ENTRY_32BIT_DS (GDT_ENTRY_32BIT_CS + 1)
-#define GDT_ENTRY_16BIT_CS (GDT_ENTRY_32BIT_DS + 1)
-#define GDT_ENTRY_16BIT_DS (GDT_ENTRY_16BIT_CS + 1)
+#define X86_GDT_ENTRY_SIZE 8
+
+#ifndef __ASSEMBLY__
+
+enum {
+ X86_GDT_ENTRY_NULL = 0,
+ X86_GDT_ENTRY_UNUSED,
+ X86_GDT_ENTRY_32BIT_CS,
+ X86_GDT_ENTRY_32BIT_DS,
+ X86_GDT_ENTRY_32BIT_FS,
+ X86_GDT_ENTRY_16BIT_CS,
+ X86_GDT_ENTRY_16BIT_DS,
+ X86_GDT_NUM_ENTRIES
+};
+#else
+/* NOTE: If the above enum is modified, this define must be checked */
+#define X86_GDT_ENTRY_32BIT_DS 3
+#endif
+
+#define X86_GDT_SIZE (X86_GDT_NUM_ENTRIES * X86_GDT_ENTRY_SIZE)
#endif
diff --git a/arch/x86/include/asm/relocate.h b/arch/x86/include/asm/relocate.h
new file mode 100644
index 0000000..33129ef
--- /dev/null
+++ b/arch/x86/include/asm/relocate.h
@@ -0,0 +1,33 @@
+/*
+ * (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 _RELOCATE_H_
+#define _RELOCATE_H_
+
+#include <common.h>
+
+int copy_uboot_to_ram(void);
+int clear_bss(void);
+int do_elf_reloc_fixups(void);
+
+#endif /* !_RELOCATE_H_ */
diff --git a/arch/x86/include/asm/string.h b/arch/x86/include/asm/string.h
index 3aa6c11..0ad612f 100644
--- a/arch/x86/include/asm/string.h
+++ b/arch/x86/include/asm/string.h
@@ -14,7 +14,7 @@ extern char * strrchr(const char * s, int c);
#undef __HAVE_ARCH_STRCHR
extern char * strchr(const char * s, int c);
-#undef __HAVE_ARCH_MEMCPY
+#define __HAVE_ARCH_MEMCPY
extern void * memcpy(void *, const void *, __kernel_size_t);
#undef __HAVE_ARCH_MEMMOVE
diff --git a/arch/x86/include/asm/u-boot-x86.h b/arch/x86/include/asm/u-boot-x86.h
index 755f88a..878a1ee 100644
--- a/arch/x86/include/asm/u-boot-x86.h
+++ b/arch/x86/include/asm/u-boot-x86.h
@@ -37,6 +37,9 @@ int x86_cpu_init_r(void);
int cpu_init_r(void);
int x86_cpu_init_f(void);
int cpu_init_f(void);
+void init_gd(gd_t *id, u64 *gdt_addr);
+void setup_gdt(gd_t *id, u64 *gdt_addr);
+int init_cache(void);
/* cpu/.../timer.c */
void timer_isr(void *);
@@ -61,5 +64,7 @@ u32 isa_map_rom(u32 bus_addr, int size);
int video_bios_init(void);
int video_init(void);
+void board_init_f_r_trampoline(ulong) __attribute__ ((noreturn));
+void board_init_f_r(void) __attribute__ ((noreturn));
#endif /* _U_BOOT_I386_H_ */