Skip to contentSkip to conversation

i386 Full Relocation

RFC PATCH New Graeme Russ 2 participants 10 messages Sep 26, 2009

lore
Share & tools
lore
#0 lore raw

cover i386 Full Relocation

This patch series implements full relocation of the i386 port. The series itself needs a lot of tidying up. The "Fix-gcc-4.4.1-compiler-warning" patch, for example, needs to be submitted as a stand-alone patch.

In the meantime, I would appreciate any comments on this series

Thanks

G

#1 lore raw

RFC PATCH 1/8 Fix gcc 4.4.1 compiler warning

---
 common/Makefile |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
common/Makefile +4 -0
index 3781738..7ea6e93 100644
@@ -178,6 +178,10 @@ $(obj)env_embedded.o: $(src)env_embedded.c $(obj)../tools/envcrc
 		-DENV_CRC=$(shell $(obj)../tools/envcrc) \
 		-c -o $@ $(src)env_embedded.c
 
+$(obj)dlmalloc.o: $(src)dlmalloc.c $(obj)dlmalloc.o
+	$(CC) $(CFLAGS) -Wa,--no-warn -fno-strict-aliasing \
+		-c -o $@ $(src)dlmalloc.c
+
 $(obj)../tools/envcrc:
 	$(MAKE) -C ../tools
 
Signature · 1 line
1.6.4.1.174.g32f4c
#2 lore raw

RFC PATCH 1/8 Fix gcc 4.4.1 compiler warning

Quoted 9 lines · On Saturday 26 September 2009 08:57:31 Graeme Russ wrote:
---
 common/Makefile |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
common/Makefile +0 -0
index 3781738..7ea6e93 100644

common/Makefile $(obj)env_embedded.o: $(src)env_embedded.c · line 183

Quoted 6 lines
common/Makefile +3 -0
@@ -178,6 +178,10 @@ $(obj)env_embedded.o: $(src)env_embedded.c
 $(obj)../tools/envcrc -DENV_CRC=$(shell $(obj)../tools/envcrc) \
 		-c -o $@ $(src)env_embedded.c
 
+$(obj)dlmalloc.o: $(src)dlmalloc.c $(obj)dlmalloc.o
+	$(CC) $(CFLAGS) -Wa,--no-warn -fno-strict-aliasing \
+		-c -o $@ $(src)dlmalloc.c

there's already patches floating around to fix this at the source level

but if your only goal is to add custom compiler flags, please use the per- object CFLAGS support. this should work:
CFLAGS_dlmalloc.o += -Wa,--no-warn -fno-strict-aliasing
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090926/7a9a67b3/attachment.pgp

#3 lore raw

RFC PATCH 2/8 Add low-level progress indications

In reply to Graeme Russ
---
 board/eNET/eNET_start16.S   |   66 +++++++++++++++++++++++++++++++++++++++++-
 board/eNET/hardware.h       |   16 ++++++++++
 include/asm-i386/ic/sc520.h |    6 ++++
 3 files changed, 86 insertions(+), 2 deletions(-)
board/eNET/eNET_start16.S +64 -2
index 48e4d83..2d7929b 100644
@@ -27,8 +27,7 @@
  * that is used by U-boot to its final destination.
  */
 
-/* #include <asm/ic/sc520_defs.h> */
-
+#include <asm/ic/sc520.h>
 #include "hardware.h"
 
 .text
@@ -60,6 +59,69 @@ board_init16:
 	xorw    %ax, %ax
 	movb    %al, (%di)
 
+	/* Enable UART 1 */
+	movl    $SC520_ADDDECCTL, %edi
+	movb    $0x02, %al
+	movb    %al, (%di)
+
+	/* Configure UART 1 - 9600 Baud 8N1 */
+	movl    $SC520_UART1CTL, %edi
+	movb    $0x07, %al
+	movb    %al, (%di)
+
+	/* Set DLAB bit */
+	movw    $(UART0_BASE + UART_LCR), %dx
+	movb    $0x80, %al
+	outb    %al, %dx
+
+	/* Set baudrate divisor (LSB) */
+	movw    $(UART0_BASE + UART_DLL), %dx
+	movb    $0x0c, %al
+	outb    %al, %dx
+
+	/* Set baudrate divisor (MSB) */
+	movw    $(UART0_BASE + UART_DLM), %dx
+	movb    $0x00, %al
+	outb    %al, %dx
+
+	/* clear DLAB; set 8 bits, no parity */
+	movw    $(UART0_BASE + UART_LCR), %dx
+	movb    $0x03, %al
+	outb    %al, %dx
+
+	/* enable FIFO */
+	movw    $(UART0_BASE + UART_FCR), %dx
+	movb    $0x01, %al
+	outb    %al, %dx
+
+	/* Set DTR and RTS active */
+	movw    $(UART0_BASE + UART_MCR), %dx
+	movb    $0x0b, %al
+	outb    %al, %dx
+
+	/* clear line status */
+	movw    $(UART0_BASE + UART_LSR), %dx
+	inb     %dx, %al
+
+	/* read receive buffer */
+	movw    $(UART0_BASE + UART_RBR), %dx
+	inb     %dx, %al
+
+	/* set scratchpad */
+	movw    $(UART0_BASE + UART_SCR), %dx
+	movb    $0x00, %al
+	outb    %al, %dx
+
+	/* Disable Interrupts */
+	movw    $(UART0_BASE + UART_IER), %dx
+	movb    $0x00, %al
+	outb    %al, %dx
+
+	/* wait for the UART clock to settle */
+	movl    $0x10000,%ecx
+uartdelay:
+	loop    uartdelay
+
 	/* Disabe MMCR alias */
 	movw	$0xfffc, %dx
 	movl	$0x000000cb, %eax
board/eNET/hardware.h +16 -0
index 42474a6..d85fde0 100644
@@ -32,4 +32,20 @@
 #define LED_TX_BITMASK		0x10
 #define LED_ERR_BITMASK		0x20
 
+/* Serial Port Definitions */
+#define UART0_BASE             0x3f8
+
+#define UART_RBR               0x00
+#define UART_THR               0x00
+#define UART_IER               0x01
+#define UART_IIR               0x02
+#define UART_FCR               0x02
+#define UART_LCR               0x03
+#define UART_MCR               0x04
+#define UART_LSR               0x05
+#define UART_MSR               0x06
+#define UART_SCR               0x07
+#define UART_DLL               0x00
+#define UART_DLM               0x01
+
 #endif /* HARDWARE_H_ */
include/asm-i386/ic/sc520.h +6 -0
index 57c9904..72e5d5d 100644
@@ -257,10 +257,16 @@ extern volatile sc520_mmcr_t *sc520_mmcr;
 
 /* MMCR Offsets (required for assembler code */
 #define SC520_DBCTL		0x0040	/* SDRAM Buffer Control Register */
+#define SC520_ADDDECCTL		0x0080
 #define SC520_PAR14		0x00c0	/* Programmable Address Region 14 Register */
 #define SC520_PAR15		0x00c4	/* Programmable Address Region 15 Register */
 #define SC520_SWTMRMILLI	0x0c60  /* Software Timer Millisecond Count */
 #define SC520_SWTMRMICRO	0x0c62  /* Software Timer Microsecond Count */
+#define SC520_UART1CTL		0x0cc0  /* UART 1 Control */
+
+ /* MMCR Register bits (not all of them :) ) */
+
+
 
 /* MMCR Register bits (not all of them :) ) */
 
Signature · 1 line
1.6.4.1.174.g32f4c
#4 lore raw

RFC PATCH 3/8 Fix i386 malloc initialisation

In reply to Graeme Russ
---
 board/eNET/u-boot.lds         |    5 ++++-
 common/dlmalloc.c             |    6 ------
 include/configs/eNET.h        |    2 +-
 include/configs/sc520_cdp.h   |    2 +-
 include/configs/sc520_spunk.h |    2 +-
 lib_i386/board.c              |   15 +++++++--------
 6 files changed, 14 insertions(+), 18 deletions(-)
board/eNET/u-boot.lds +4 -1
index 4ea424d..832d101 100644
@@ -32,12 +32,15 @@ SECTIONS
 
 	. = ALIGN(4);
 	.rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) }
+	
+	.eh_frame : { *(.eh_frame) }
 
 	_i386boot_text_size = SIZEOF(.text) + SIZEOF(.rodata);
 
 	. = 0x03FF0000;		/* Ram data segment to use */
 	_i386boot_romdata_dest = ABSOLUTE(.);
-	.data : AT ( LOADADDR(.rodata) + SIZEOF(.rodata) ) { *(.data) }
+	.data : AT ( LOADADDR(.eh_frame) + SIZEOF(.eh_frame) ) { *(.data) }
+/*	.data : { *(.data) } */
 	_i386boot_romdata_start = LOADADDR(.data);
 
 	. = ALIGN(4);
common/dlmalloc.c +0 -6
index 241db8c..f980430 100644
@@ -1520,11 +1520,6 @@ void *sbrk(ptrdiff_t increment)
 	return (void *)old;
 }
 
-#ifndef CONFIG_X86
-/*
- * x86 boards use a slightly different init sequence thus they implement
- * their own version of mem_malloc_init()
- */
 void mem_malloc_init(ulong start, ulong size)
 {
 	mem_malloc_start = start;
@@ -1533,7 +1528,6 @@ void mem_malloc_init(ulong start, ulong size)
 
 	memset((void *)mem_malloc_start, 0, size);
 }
-#endif
 
 /* field-extraction macros */
 
include/configs/eNET.h +1 -1
index 243a554..54c34fa 100644
@@ -61,7 +61,7 @@
 /*
  * Size of malloc() pool
  */
-#define CONFIG_MALLOC_SIZE	(CONFIG_SYS_ENV_SIZE + 128*1024)
+#define CONFIG_SYS_MALLOC_LEN	(CONFIG_ENV_SIZE + 128*1024)
 
 #define CONFIG_BAUDRATE		9600
 
include/configs/sc520_cdp.h +1 -1
index 214a9af..2f1dae7 100644
@@ -65,7 +65,7 @@
 /*
  * Size of malloc() pool
  */
-#define CONFIG_MALLOC_SIZE	(CONFIG_ENV_SIZE + 128*1024)
+#define CONFIG_SYS_MALLOC_LEN	(CONFIG_ENV_SIZE + 128*1024)
 
 #define CONFIG_BAUDRATE		9600
 
include/configs/sc520_spunk.h +1 -1
index f3fc960..cf5633c 100644
@@ -63,7 +63,7 @@
 /*
  * Size of malloc() pool
  */
-#define CONFIG_MALLOC_SIZE	(CONFIG_ENV_SIZE + 128*1024)
+#define CONFIG_SYS_MALLOC_LEN	(CONFIG_ENV_SIZE + 128*1024)
 
 
 #define CONFIG_BAUDRATE		9600
lib_i386/board.c +7 -8
index 0262b5e..39a3099 100644
@@ -73,17 +73,16 @@ ulong i386boot_bios_size     = (ulong)&_i386boot_bios_size;     /* size of BIOS
 const char version_string[] =
 	U_BOOT_VERSION" (" U_BOOT_DATE " - " U_BOOT_TIME ")";
 
-static int mem_malloc_init(void)
+static int heap_init(void)
 {
 	/* start malloc area right after the stack */
-	mem_malloc_start = i386boot_bss_start +
-		i386boot_bss_size + CONFIG_SYS_STACK_SIZE;
-	mem_malloc_start = (mem_malloc_start+3)&~3;
+	ulong start = i386boot_bss_start + i386boot_bss_size +
+			CONFIG_SYS_STACK_SIZE;
 
-	/* Use all available RAM for malloc() */
-	mem_malloc_end = gd->ram_size;
+	/* 4-byte aligned */
+	start = (start+3)&~3;
 
-	mem_malloc_brk = mem_malloc_start;
+	mem_malloc_init(start, CONFIG_SYS_MALLOC_LEN);
 
 	return 0;
 }
@@ -180,7 +179,7 @@ init_fnc_t *init_sequence[] = {
 	cpu_init,		/* basic cpu dependent setup */
 	board_init,		/* basic board dependent setup */
 	dram_init,		/* configure available RAM banks */
-	mem_malloc_init,        /* dependant on dram_init */
+	heap_init,		/* dependant on dram_init */
 	interrupt_init,		/* set up exceptions */
 	timer_init,
 	serial_init,
Signature · 1 line
1.6.4.1.174.g32f4c
#5 lore raw

RFC PATCH 4/8 Rearrange i386 Interupt Handling

In reply to Graeme Russ

In preperation for full relocation

---
 cpu/i386/Makefile              |    2 +-
 cpu/i386/cpu.c                 |    1 -
 cpu/i386/exceptions.c          |  229 ---------------------
 cpu/i386/interrupts.c          |  428 ++++++++++++++++++++++++++++++++++++++--
 include/asm-i386/interrupt.h   |   27 ---
 include/asm-i386/u-boot-i386.h |    3 -
 lib_i386/interrupts.c          |    4 +-
 lib_i386/pcat_interrupts.c     |   33 ---
 8 files changed, 417 insertions(+), 310 deletions(-)
 delete mode 100644 cpu/i386/exceptions.c
cpu/i386/Makefile +1 -1
index e98bd3d..c658c6e 100644
@@ -29,7 +29,7 @@ include $(TOPDIR)/config.mk
 LIB	= $(obj)lib$(CPU).a
 
 START	= start.o start16.o resetvec.o
-COBJS	= serial.o interrupts.o exceptions.o cpu.o
+COBJS	= serial.o interrupts.o cpu.o
 
 SRCS	:= $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS))
cpu/i386/cpu.c +0 -1
index d91e33b..8baf37d 100644
@@ -48,7 +48,6 @@ int cpu_init(void)
 
 	/* Initialize core interrupt and exception functionality of CPU */
 	cpu_init_interrupts ();
-	cpu_init_exceptions ();
 
 	return 0;
 }
cpu/i386/exceptions.c deleted +0 -229

229 lines not on this page · raw message

cpu/i386/interrupts.c +413 -15

472 lines not on this page · raw message

include/asm-i386/interrupt.h +0 -27
index 7f408cb..3e2674a 100644
@@ -43,31 +43,4 @@ extern char exception_stack[];
 
 #define __isr__ void __attribute__ ((regparm(0)))
 
-#define DECLARE_INTERRUPT(x) \
-	asm(".globl irq_"#x"\n" \
-		    "irq_"#x":\n" \
-		    "pusha \n" \
-		    "pushl $"#x"\n" \
-		    "pushl $irq_return\n" \
-		    "jmp   do_irq\n"); \
-	__isr__ irq_##x(void)
-
-#define DECLARE_EXCEPTION(x, f) \
-	asm(".globl exp_"#x"\n" \
-		    "exp_"#x":\n" \
-		    "pusha \n" \
-		    "movl     %esp, %ebx\n" \
-		    "movl     $exception_stack, %eax\n" \
-		    "movl     %eax, %esp \n" \
-		    "pushl    %ebx\n" \
-		    "movl     32(%esp), %ebx\n" \
-		    "xorl     %edx, %edx\n" \
-		    "movw     36(%esp), %dx\n" \
-		    "pushl    %edx\n" \
-		    "pushl    %ebx\n" \
-		    "pushl    $"#x"\n" \
-		    "pushl    $exp_return\n" \
-		    "jmp      "#f"\n"); \
-	__isr__ exp_##x(void)
-
 #endif
include/asm-i386/u-boot-i386.h +0 -3
index 3921e01..dfec307 100644
@@ -55,9 +55,6 @@ int timer_init(void);
 /* cpu/.../interrupts.c */
 int cpu_init_interrupts(void);
 
-/* cpu/.../exceptions.c */
-int cpu_init_exceptions(void);
-
 /* board/.../... */
 int board_init(void);
 int dram_init(void);
lib_i386/interrupts.c +3 -1
index 3f3613a..efbad72 100644
@@ -109,8 +109,10 @@ void irq_free_handler(int irq)
 	return;
 }
 
-__isr__ do_irq(int irq)
+void do_irq(int hw_irq)
 {
+	int irq = hw_irq - 0x20;
+
 	if (irq < 0 || irq >= CONFIG_SYS_NUM_IRQS) {
 		printf("do_irq: bad irq number %d\n", irq);
 		return;
lib_i386/pcat_interrupts.c +0 -33
index f01298e..67e6e97 100644
@@ -40,45 +40,12 @@
 #error "CONFIG_SYS_NUM_IRQS must equal 16 if CONFIG_SYS_NUM_IRQS is defined"
 #endif
 
-DECLARE_INTERRUPT(0);
-DECLARE_INTERRUPT(1);
-DECLARE_INTERRUPT(3);
-DECLARE_INTERRUPT(4);
-DECLARE_INTERRUPT(5);
-DECLARE_INTERRUPT(6);
-DECLARE_INTERRUPT(7);
-DECLARE_INTERRUPT(8);
-DECLARE_INTERRUPT(9);
-DECLARE_INTERRUPT(10);
-DECLARE_INTERRUPT(11);
-DECLARE_INTERRUPT(12);
-DECLARE_INTERRUPT(13);
-DECLARE_INTERRUPT(14);
-DECLARE_INTERRUPT(15);
-
 int interrupt_init(void)
 {
 	u8 i;
 
 	disable_interrupts();
 
-	/* Setup interrupts */
-	set_vector(0x20, irq_0);
-	set_vector(0x21, irq_1);
-	set_vector(0x23, irq_3);
-	set_vector(0x24, irq_4);
-	set_vector(0x25, irq_5);
-	set_vector(0x26, irq_6);
-	set_vector(0x27, irq_7);
-	set_vector(0x28, irq_8);
-	set_vector(0x29, irq_9);
-	set_vector(0x2a, irq_10);
-	set_vector(0x2b, irq_11);
-	set_vector(0x2c, irq_12);
-	set_vector(0x2d, irq_13);
-	set_vector(0x2e, irq_14);
-	set_vector(0x2f, irq_15);
-
 	/* Mask all interrupts */
 	outb(0xff, MASTER_PIC + IMR);
 	outb(0xff, SLAVE_PIC + IMR);
Signature · 1 line
1.6.4.1.174.g32f4c
#6 lore raw

RFC PATCH 5/8 Fix race condition when using SC520 timers

In reply to Graeme Russ
---
 cpu/i386/sc520/sc520_timer.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)
cpu/i386/sc520/sc520_timer.c +6 -5
index 23de14b..25c9a24 100644
@@ -35,6 +35,12 @@ void sc520_timer_isr(void)
 
 int timer_init(void)
 {
+	/* Register the SC520 specific timer interrupt handler */
+	register_timer_isr (sc520_timer_isr);
+
+	/* Install interrupt handler for GP Timer 1 */
+	irq_install_handler (0, timer_isr, NULL);
+
 	/* Map GP Timer 1 to Master PIC IR0  */
 	sc520_mmcr->gp_tmr_int_map[1] = 0x01;
 
@@ -54,11 +60,6 @@ int timer_init(void)
 	sc520_mmcr->gptmr1maxcmpa = 100;
 	sc520_mmcr->gptmr1ctl = 0xe009;
 
-	/* Register the SC520 specific timer interrupt handler */
-	register_timer_isr (sc520_timer_isr);
-
-	/* Install interrupt handler for GP Timer 1 */
-	irq_install_handler (0, timer_isr, NULL);
 	unmask_irq (0);
 
 	/* Clear the GP Timer 1 status register to get the show rolling*/
Signature · 1 line
1.6.4.1.174.g32f4c
#7 lore raw

RFC PATCH 6/8 Reorder source objects in lib_i386 Makefile

In reply to Graeme Russ
---
 lib_i386/Makefile |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
lib_i386/Makefile +4 -4
index bb9b330..9838506 100644
@@ -32,16 +32,16 @@ SOBJS-y	+= realmode_switch.o
 COBJS-y	+= bios_setup.o
 COBJS-y	+= board.o
 COBJS-y	+= bootm.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_PCI) += pci_type1.o
 COBJS-y	+= realmode.o
+COBJS-y	+= timer.o
 COBJS-y	+= video_bios.o
 COBJS-y	+= video.o
 COBJS-y	+= zimage.o
-COBJS-y	+= interrupts.o
-COBJS-y	+= timer.o
-COBJS-$(CONFIG_SYS_PCAT_INTERRUPTS) += pcat_interrupts.o
-COBJS-$(CONFIG_SYS_GENERIC_TIMER) += pcat_timer.o
 
 SRCS	:= $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
 OBJS	:= $(addprefix $(obj),$(SOBJS-y) $(COBJS-y))
Signature · 1 line
1.6.4.1.174.g32f4c
#8 lore raw

RFC PATCH 7/8 Fix global label in inline asm compile error

In reply to Graeme Russ
---
 include/configs/eNET.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
include/configs/eNET.h +2 -2
index 54c34fa..0a86550 100644
@@ -234,8 +234,8 @@
 #ifndef __ASSEMBLER__
 extern unsigned long ip;
 
-#define PRINTIP				asm ("call next_line\n" \
-					    "next_line:\n" \
+#define PRINTIP				asm ("call 0\n" \
+					    "0:\n" \
 					    "pop %%eax\n" \
 					    "movl %%eax, %0\n" \
 					    :"=r"(ip) \
Signature · 1 line
1.6.4.1.174.g32f4c
#9 lore raw

RFC PATCH 8/8 Final i386 Relocation

In reply to Graeme Russ
---
 board/eNET/config.mk           |    2 +
 board/eNET/eNET.c              |   17 ++++--
 board/eNET/u-boot.lds          |   49 +++++++++++----
 cpu/i386/cpu.c                 |   12 ++-
 cpu/i386/interrupts.c          |    4 +-
 cpu/i386/start.S               |  125 +++---------------------------------
 include/asm-i386/u-boot-i386.h |   10 +++-
 lib_i386/Makefile              |    1 +
 lib_i386/board.c               |  108 ++++++++++++++++---------------
 lib_i386/elf_reloc.c           |  139 ++++++++++++++++++++++++++++++++++++++++
 lib_i386/interrupts.c          |    4 +-
 lib_i386/realmode.c            |    4 +-
 lib_i386/timer.c               |    2 +-
 13 files changed, 279 insertions(+), 198 deletions(-)
 create mode 100644 lib_i386/elf_reloc.c
board/eNET/config.mk +2 -0
index a763841..cbec0a8 100644
@@ -22,3 +22,5 @@
 #
 
 TEXT_BASE = 0x38040000
+PLATFORM_RELFLAGS += -fpic
+PLATFORM_LDFLAGS += -pic
board/eNET/eNET.c +12 -5
index 29cf295..baf7c95 100644
@@ -47,7 +47,6 @@ void init_sc520_enet (void)
 {
 	/* Set CPU Speed to 100MHz */
 	sc520_mmcr->cpuctl = 0x01;
-	gd->cpu_clk = 100000000;
 
 	/* wait at least one millisecond */
 	asm("movl	$0x2000,%%ecx\n"
@@ -67,7 +66,7 @@ void init_sc520_enet (void)
 /*
  * Miscellaneous platform dependent initializations
  */
-int board_init(void)
+int board_early_init_f(void)
 {
 	init_sc520_enet();
 
@@ -117,12 +116,20 @@ int board_init(void)
 	sc520_mmcr->sysarbctl = 0x06;
 	sc520_mmcr->sysarbmenb = 0x0003;
 
-	/* Crystal is 33.000MHz */
-	gd->bus_clk = 33000000;
-
 	return 0;
 }
 
+int board_early_init_r(void)
+{
+	/* CPU Speed to 100MHz */
+	gd->cpu_clk = 100000000;
+
+ 	/* Crystal is 33.000MHz */
+ 	gd->bus_clk = 33000000;
+
+ 	return 0;
+}
+
 int dram_init(void)
 {
 	init_sc520_dram();
board/eNET/u-boot.lds +37 -12

76 lines not on this page · raw message

cpu/i386/cpu.c +8 -4
index 8baf37d..685f6c1 100644
@@ -37,7 +37,7 @@
 #include <command.h>
 #include <asm/interrupt.h>
 
-int cpu_init(void)
+int cpu_init_f(void)
 {
 	/* initialize FPU, reset EM, set MP and NE */
 	asm ("fninit\n" \
@@ -46,12 +46,16 @@ int cpu_init(void)
 	     "orl  $0x22, %eax\n" \
 	     "movl %eax, %cr0\n" );
 
-	/* Initialize core interrupt and exception functionality of CPU */
-	cpu_init_interrupts ();
-
 	return 0;
 }
 
+int cpu_init_r(void)
+{
+ 	/* Initialize core interrupt and exception functionality of CPU */
+ 	cpu_init_interrupts ();
+ 	return 0;
+}
+
 int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
 	printf ("resetting ...\n");
cpu/i386/interrupts.c +2 -2
index f4a297f..47bbdde 100644
@@ -58,8 +58,8 @@ static inline void load_idt(const struct desc_ptr *dtr)
 
 void set_vector(u8 intnum, void *routine)
 {
-	idt[intnum].base_high = (u16)((u32)(routine + gd->reloc_off) >> 16);
-	idt[intnum].base_low = (u16)((u32)(routine + gd->reloc_off) & 0xffff);
+	idt[intnum].base_high = (u16)((u32)(routine) >> 16);
+	idt[intnum].base_low = (u16)((u32)(routine) & 0xffff);
 }
 
 void irq_0(void);
cpu/i386/start.S +9 -116

153 lines not on this page · raw message

include/asm-i386/u-boot-i386.h +9 -1
index dfec307..823e5ce 100644
@@ -24,6 +24,8 @@
 #ifndef _U_BOOT_I386_H_
 #define _U_BOOT_I386_H_	1
 
+#include <elf.h>
+
 /* for the following variables, see start.S */
 extern ulong i386boot_start;	    /* code start (in flash) */
 extern ulong i386boot_end;	    /* code end (in flash) */
@@ -42,7 +44,8 @@ extern ulong i386boot_bios_size;    /* size of BIOS emulation code */
 
 
 /* cpu/.../cpu.c */
-int cpu_init(void);
+int cpu_init_r(void);
+int cpu_init_f(void);
 
 /* cpu/.../timer.c */
 void timer_isr(void *);
@@ -65,6 +68,11 @@ u32 isa_map_rom(u32 bus_addr, int size);
 /* lib_i386/... */
 int video_bios_init(void);
 int video_init(void);
+void elf_relocate(ulong rel_offset);
+void reloc_fixup_elf32_dyn (Elf32_Dyn *start, Elf32_Dyn *end, ulong offset);
+void reloc_fixup_elf32_sym (Elf32_Sym *start, Elf32_Sym *end, ulong offset);
+void reloc_fixup_elf32_rel (Elf32_Rel *start, Elf32_Rel *end, ulong offset);
+void reloc_fixup_elf32_rela (Elf32_Rela *start, Elf32_Rela *end, ulong offset);
 
 
 #endif	/* _U_BOOT_I386_H_ */
lib_i386/Makefile +1 -0
index 9838506..1532579 100644
@@ -32,6 +32,7 @@ SOBJS-y	+= realmode_switch.o
 COBJS-y	+= bios_setup.o
 COBJS-y	+= board.o
 COBJS-y	+= bootm.o
+COBJS-y	+= elf_reloc.o
 COBJS-y	+= interrupts.o
 COBJS-$(CONFIG_SYS_PCAT_INTERRUPTS) += pcat_interrupts.o
 COBJS-$(CONFIG_SYS_GENERIC_TIMER) += pcat_timer.o
lib_i386/board.c +55 -53

179 lines not on this page · raw message

lib_i386/elf_reloc.c new file +139 -0

139 lines not on this page · raw message

lib_i386/interrupts.c +2 -2
index efbad72..51def59 100644
@@ -70,12 +70,12 @@ void irq_install_handler(int irq, interrupt_handler_t *handler, void *arg)
 
 	if (irq_handlers[irq].handler != NULL)
 		printf("irq_install_handler: 0x%08lx replacing 0x%08lx\n",
-		       (ulong) handler + gd->reloc_off,
+		       (ulong) handler,
 		       (ulong) irq_handlers[irq].handler);
 
 	status = disable_interrupts ();
 
-	irq_handlers[irq].handler = handler + gd->reloc_off;
+	irq_handlers[irq].handler = handler;
 	irq_handlers[irq].arg = arg;
 	irq_handlers[irq].count = 0;
 
lib_i386/realmode.c +2 -2
index 6cf2738..726d1d3 100644
@@ -68,10 +68,10 @@ int enter_realmode(u16 seg, u16 off, struct pt_regs *in, struct pt_regs *out)
 
 	memcpy(REALMODE_MAILBOX, in, sizeof(struct pt_regs));
 	asm("wbinvd\n");
-
+/* TODO
 	__asm__ volatile (
 		 "lcall $0x20,%0\n"  : :  "i" (&realmode_enter) );
-
+*/
 	asm("wbinvd\n");
 	memcpy(out, REALMODE_MAILBOX, sizeof(struct pt_regs));
 
lib_i386/timer.c +1 -1
index 58a0212..5cb1f54 100644
@@ -51,7 +51,7 @@ int register_timer_isr (timer_fnc_t *isr_func)
 	if (new_func == NULL)
 		return 1;
 
-	new_func->isr_func = isr_func + gd->reloc_off;
+	new_func->isr_func = isr_func;
 	new_func->next = NULL;
 
 	/*
Signature · 1 line
1.6.4.1.174.g32f4c