Skip to contentSkip to conversation

Various x86 fixups

PATCH Superseded Graeme Russ 3 participants 28 messages Nov 5, 2011 – Nov 12, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Various x86 fixups

This is a series of (relatively) minor fixups for the x86 architecture designed to address a number of issues limiting the ability to cleanly implement new x86 sub arches and boards

Sent as v0 because I havn't checkpatch'd them yet :)

Graeme Russ (7):
x86: Punt cold- and warm-boot flags
sc520: Create arch asm-offsets
x86: Add multiboot header
x86: Provide more configuration granularity
x86: Ensure IDT and GDT remain 16-byte aligned post relocation
x86: Misc PCI touchups
x86: Misc cleanups

 arch/x86/cpu/interrupts.c               |    2 +-
 arch/x86/cpu/sc520/asm-offsets.c        |   45 +++++++++++++++++++++++++++++++
 arch/x86/cpu/sc520/sc520_car.S          |    3 +-
 arch/x86/cpu/sc520/sc520_pci.c          |    4 +--
 arch/x86/cpu/start.S                    |   30 +++++++++++++++++---
 arch/x86/cpu/start16.S                  |    3 --
 arch/x86/include/asm/arch-sc520/sc520.h |   26 ------------------
 arch/x86/include/asm/global_data.h      |   21 --------------
 arch/x86/include/asm/pci.h              |    2 +-
 arch/x86/lib/Makefile                   |   18 ++++++------
 arch/x86/lib/board.c                    |   26 ++++++++++++++---
 arch/x86/lib/bootm.c                    |    4 ++-
 arch/x86/lib/pci.c                      |   37 +++++++++++++++++++++++++
 arch/x86/lib/pci_type1.c                |   10 +++++--
 arch/x86/lib/video_bios.c               |   42 ----------------------------
 board/eNET/eNET_start16.S               |    5 ++-
 common/cmd_bdinfo.c                     |    3 +-
 drivers/pci/pci.c                       |    4 +-
 include/configs/eNET.h                  |    5 +++
 include/serial.h                        |    2 +-
 20 files changed, 165 insertions(+), 127 deletions(-)
 create mode 100644 arch/x86/cpu/sc520/asm-offsets.c

--
1.7.5.2.317.g391b14

#1 lore raw

PATCH 1/7 x86: Punt cold- and warm-boot flags

Nobody uses them anyway

---
 arch/x86/cpu/start.S               |    2 --
 arch/x86/cpu/start16.S             |    3 ---
 arch/x86/include/asm/global_data.h |    2 --
 3 files changed, 0 insertions(+), 7 deletions(-)
arch/x86/cpu/start.S +0 -2
index 306fb49..1634eb1 100644
@@ -53,8 +53,6 @@ _x86boot_start:
 	movl	%eax, %cr0
 	wbinvd
 
-	/* Tell 32-bit code it is being entered from an in-RAM copy */
-	movw	$GD_FLG_WARM_BOOT, %bx
 _start:
 	/* This is the 32-bit cold-reset entry point */
 
arch/x86/cpu/start16.S +0 -3
index 9dabff2..33e53cd 100644
@@ -37,9 +37,6 @@
 .code16
 .globl start16
 start16:
-	/* Set the Cold Boot / Hard Reset flag */
-	movl	$GD_FLG_COLD_BOOT, %ebx
-
 	/*
 	 * First we let the BSP do some early initialization
 	 * this code have to map the flash to its final position
arch/x86/include/asm/global_data.h +0 -2
index f177a4f..c736549 100644
@@ -91,8 +91,6 @@ extern gd_t *gd;
 #define	GD_FLG_LOGINIT		0x00020	/* Log Buffer has been initialized	*/
 #define GD_FLG_DISABLE_CONSOLE	0x00040	/* Disable console (in & out)		*/
 #define GD_FLG_ENV_READY	0x00080	/* Environment imported into hash table	*/
-#define GD_FLG_COLD_BOOT	0x00100	/* Cold Boot */
-#define GD_FLG_WARM_BOOT	0x00200	/* Warm Boot */
 
 #if 0
 #define DECLARE_GLOBAL_DATA_PTR
Signature · 1 line
1.7.5.2.317.g391b14
#2 lore raw

PATCH 1/7 x86: Punt cold- and warm-boot flags

Quoted 1 line · On Friday 04 November 2011 22:21:45 Graeme Russ wrote:

Nobody uses them anyway

thanks ! this was the only hold out i had with gd flag unification (hrm, did i forget to post that patch?).

-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/20111105/243a99cf/attachment.pgp

#3 lore raw

PATCH v2 6/12 x86: Punt cold- and warm-boot flags

In reply to Graeme Russ

Nobody uses them anyway

---
Changes for v1:
- None (skipped to set single version for consolidated series)
Changes for v2:
- Consolidated patch series

 arch/x86/cpu/start.S               |    2 --
 arch/x86/cpu/start16.S             |    3 ---
 arch/x86/include/asm/global_data.h |    2 --
 3 files changed, 0 insertions(+), 7 deletions(-)
arch/x86/cpu/start.S +0 -2
index 306fb49..1634eb1 100644
@@ -53,8 +53,6 @@ _x86boot_start:
 	movl	%eax, %cr0
 	wbinvd
 
-	/* Tell 32-bit code it is being entered from an in-RAM copy */
-	movw	$GD_FLG_WARM_BOOT, %bx
 _start:
 	/* This is the 32-bit cold-reset entry point */
 
arch/x86/cpu/start16.S +0 -3
index 9dabff2..33e53cd 100644
@@ -37,9 +37,6 @@
 .code16
 .globl start16
 start16:
-	/* Set the Cold Boot / Hard Reset flag */
-	movl	$GD_FLG_COLD_BOOT, %ebx
-
 	/*
 	 * First we let the BSP do some early initialization
 	 * this code have to map the flash to its final position
arch/x86/include/asm/global_data.h +0 -2
index f177a4f..c736549 100644
@@ -91,8 +91,6 @@ extern gd_t *gd;
 #define	GD_FLG_LOGINIT		0x00020	/* Log Buffer has been initialized	*/
 #define GD_FLG_DISABLE_CONSOLE	0x00040	/* Disable console (in & out)		*/
 #define GD_FLG_ENV_READY	0x00080	/* Environment imported into hash table	*/
-#define GD_FLG_COLD_BOOT	0x00100	/* Cold Boot */
-#define GD_FLG_WARM_BOOT	0x00200	/* Warm Boot */
 
 #if 0
 #define DECLARE_GLOBAL_DATA_PTR

--
1.7.5.2.317.g391b14

#5 lore raw

PATCH v2 6/12 x86: Punt cold- and warm-boot flags

In reply to Graeme Russ
Quoted 9 lines · Graeme Russ

Nobody uses them anyway

---
Changes for v1:
- None (skipped to set single version for consolidated series)
Changes for v2:
- Consolidated patch series

Quoted 4 lines
 arch/x86/cpu/start.S               |    2 --
 arch/x86/cpu/start16.S             |    3 ---
 arch/x86/include/asm/global_data.h |    2 --
 3 files changed, 0 insertions(+), 7 deletions(-)

Applied to u-boot-x86

Thanks,

Graeme

#6 lore raw

PATCH 2/7 sc520: Create arch asm-offsets

In reply to Graeme Russ
---
 arch/x86/cpu/sc520/asm-offsets.c        |   45 +++++++++++++++++++++++++++++++
 arch/x86/cpu/sc520/sc520_car.S          |    3 +-
 arch/x86/cpu/start.S                    |    3 +-
 arch/x86/include/asm/arch-sc520/sc520.h |   26 ------------------
 arch/x86/include/asm/global_data.h      |   19 -------------
 board/eNET/eNET_start16.S               |    5 ++-
 6 files changed, 52 insertions(+), 49 deletions(-)
 create mode 100644 arch/x86/cpu/sc520/asm-offsets.c
arch/x86/cpu/sc520/asm-offsets.c new file +45 -0
new file mode 100644
index 0000000..794f00c
@@ -0,0 +1,45 @@
+/*
+ * Adapted from Linux v2.6.36 kernel: arch/powerpc/kernel/asm-offsets.c
+ *
+ * This program is used to generate definitions needed by
+ * assembly language modules.
+ *
+ * We use the technique used in the OSF Mach kernel code:
+ * generate asm statements containing #defines,
+ * compile this file to assembler, and then extract the
+ * #defines from the assembly-language output.
+ *
+ * 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.
+ */
+
+#include <common.h>
+#include <asm/arch/sc520.h>
+
+#include <linux/kbuild.h>
+
+int main(void)
+{
+	DEFINE(GENERATED_GD_RELOC_OFF, offsetof(gd_t, reloc_off));
+
+	DEFINE(GENERATED_SC520_PAR0, offsetof(struct sc520_mmcr, par[0]));
+	DEFINE(GENERATED_SC520_PAR1, offsetof(struct sc520_mmcr, par[1]));
+	DEFINE(GENERATED_SC520_PAR2, offsetof(struct sc520_mmcr, par[2]));
+	DEFINE(GENERATED_SC520_PAR3, offsetof(struct sc520_mmcr, par[3]));
+	DEFINE(GENERATED_SC520_PAR4, offsetof(struct sc520_mmcr, par[4]));
+	DEFINE(GENERATED_SC520_PAR5, offsetof(struct sc520_mmcr, par[5]));
+	DEFINE(GENERATED_SC520_PAR6, offsetof(struct sc520_mmcr, par[6]));
+	DEFINE(GENERATED_SC520_PAR7, offsetof(struct sc520_mmcr, par[7]));
+	DEFINE(GENERATED_SC520_PAR8, offsetof(struct sc520_mmcr, par[8]));
+	DEFINE(GENERATED_SC520_PAR9, offsetof(struct sc520_mmcr, par[9]));
+	DEFINE(GENERATED_SC520_PAR10, offsetof(struct sc520_mmcr, par[10]));
+	DEFINE(GENERATED_SC520_PAR11, offsetof(struct sc520_mmcr, par[11]));
+	DEFINE(GENERATED_SC520_PAR12, offsetof(struct sc520_mmcr, par[12]));
+	DEFINE(GENERATED_SC520_PAR13, offsetof(struct sc520_mmcr, par[13]));
+	DEFINE(GENERATED_SC520_PAR14, offsetof(struct sc520_mmcr, par[14]));
+	DEFINE(GENERATED_SC520_PAR15, offsetof(struct sc520_mmcr, par[15]));
+
+	return 0;
+}
arch/x86/cpu/sc520/sc520_car.S +2 -1
index 7cac4d1..c04cc1f 100644
@@ -24,6 +24,7 @@
 #include <config.h>
 #include <asm/processor-flags.h>
 #include <asm/arch/sc520.h>
+#include <generated/asm-offsets.h>
 
 .section .text
 
@@ -55,7 +56,7 @@ car_init:
 
 	/* Configure Cache-As-RAM PAR */
 	movl	$CONFIG_SYS_SC520_CAR_PAR, %eax
-	movl	$SC520_PAR2, %edi
+	movl	$(SC520_MMCR_BASE + GENERATED_SC520_PAR2), %edi
 	movl	%eax, (%edi)
 
 	/* Trash the cache then turn it on */
arch/x86/cpu/start.S +2 -1
index 1634eb1..5adb387 100644
@@ -30,6 +30,7 @@
 #include <version.h>
 #include <asm/global_data.h>
 #include <asm/processor-flags.h>
+#include <generated/asm-offsets.h>
 
 .section .text
 .code32
@@ -112,7 +113,7 @@ relocate_code:
 
 	/* Setup call address of in-RAM copy of board_init_r() */
 	movl	$board_init_r, %ebp
-	addl	(GD_RELOC_OFF * 4)(%edx), %ebp
+	addl	(GENERATED_GD_RELOC_OFF)(%edx), %ebp
 
 	/* Setup parameters to board_init_r() */
 	movl	%edx, %eax
arch/x86/include/asm/arch-sc520/sc520.h +0 -26
index 5ac9bb8..9dc29d3 100644
@@ -259,32 +259,6 @@ extern sc520_mmcr_t *sc520_mmcr;
 /* Memory Mapped Control Registers (MMCR) Base Address */
 #define SC520_MMCR_BASE		0xfffef000
 
-/* MMCR Addresses (required for assembler code) */
-#define SC520_DRCCTL		(SC520_MMCR_BASE + 0x010)
-#define SC520_DRCTMCTL		(SC520_MMCR_BASE + 0x012)
-#define SC520_DRCCFG		(SC520_MMCR_BASE + 0x014)
-#define SC520_DRCBENDADR	(SC520_MMCR_BASE + 0x018)
-#define SC520_ECCCTL		(SC520_MMCR_BASE + 0x020)
-#define SC520_DBCTL		(SC520_MMCR_BASE + 0x040)
-#define SC520_ECCINT		(SC520_MMCR_BASE + 0xd18)
-
-#define SC520_PAR0		(SC520_MMCR_BASE + 0x088)
-#define SC520_PAR1		(SC520_PAR0 + (0x04 * 1))
-#define SC520_PAR2		(SC520_PAR0 + (0x04 * 2))
-#define SC520_PAR3		(SC520_PAR0 + (0x04 * 3))
-#define SC520_PAR4		(SC520_PAR0 + (0x04 * 4))
-#define SC520_PAR5		(SC520_PAR0 + (0x04 * 5))
-#define SC520_PAR6		(SC520_PAR0 + (0x04 * 6))
-#define SC520_PAR7		(SC520_PAR0 + (0x04 * 7))
-#define SC520_PAR8		(SC520_PAR0 + (0x04 * 8))
-#define SC520_PAR9		(SC520_PAR0 + (0x04 * 9))
-#define SC520_PAR10		(SC520_PAR0 + (0x04 * 10))
-#define SC520_PAR11		(SC520_PAR0 + (0x04 * 11))
-#define SC520_PAR12		(SC520_PAR0 + (0x04 * 12))
-#define SC520_PAR13		(SC520_PAR0 + (0x04 * 13))
-#define SC520_PAR14		(SC520_PAR0 + (0x04 * 14))
-#define SC520_PAR15		(SC520_PAR0 + (0x04 * 15))
-
 /*
  * PARs for maximum allowable 256MB of SDRAM @ 0x00000000
  * Two PARs are required due to maximum PAR size of 128MB
arch/x86/include/asm/global_data.h +0 -19
index c736549..05a2139 100644
@@ -61,25 +61,6 @@ extern gd_t *gd;
 
 #endif
 
-/* Word Offsets into Global Data - MUST match struct gd_t */
-#define GD_BD		0
-#define GD_FLAGS	1
-#define GD_BAUDRATE	2
-#define GD_HAVE_CONSOLE	3
-#define GD_RELOC_OFF	4
-#define GD_LOAD_OFF	5
-#define GD_ENV_ADDR	6
-#define GD_ENV_VALID	7
-#define GD_CPU_CLK	8
-#define GD_BUS_CLK	9
-#define GD_RELOC_ADDR	10
-#define GD_START_ADDR_SP	11
-#define GD_RAM_SIZE	12
-#define GD_RESET_STATUS	13
-#define GD_JT		14
-
-#define GD_SIZE		15
-
 /*
  * Global Data Flags
  */
board/eNET/eNET_start16.S +3 -2
index 4241f6e..5e3f44c 100644
@@ -30,6 +30,7 @@
 #include "config.h"
 #include "hardware.h"
 #include <asm/arch/sc520.h>
+#include <generated/asm-offsets.h>
 
 .text
 .section .start16, "ax"
@@ -46,12 +47,12 @@ board_init16:
 	movw	%ax, %ds
 
 	/* Map PAR for Boot Flash (BOOTCS, 512kB @ 0x380000000) */
-	movl    $(SC520_PAR14 - SC520_MMCR_BASE), %edi
+	movl    $GENERATED_SC520_PAR14, %edi
 	movl	$CONFIG_SYS_SC520_BOOTCS_PAR, %eax
 	movl	%eax, (%di)
 
 	/* Map PAR for LED, Hex Switches (GPCS6, 20 Bytes @ 0x1000) */
-	movl    $(SC520_PAR15 - SC520_MMCR_BASE), %edi
+	movl    $GENERATED_SC520_PAR15, %edi
 	movl	$CONFIG_SYS_SC520_LLIO_PAR, %eax
 	movl	%eax, (%di)
 
Signature · 1 line
1.7.5.2.317.g391b14
#7 lore raw

PATCH v2 7/12 sc520: Create arch asm-offsets

---
Changes for v1:
- None (skipped to set single version for consolidated series)
Changes for v2:
- Consolidated patch series

 arch/x86/cpu/sc520/asm-offsets.c        |   45 +++++++++++++++++++++++++++++++
 arch/x86/cpu/sc520/sc520_car.S          |    3 +-
 arch/x86/cpu/start.S                    |    3 +-
 arch/x86/include/asm/arch-sc520/sc520.h |   26 ------------------
 arch/x86/include/asm/global_data.h      |   19 -------------
 board/eNET/eNET_start16.S               |    5 ++-
 6 files changed, 52 insertions(+), 49 deletions(-)
 create mode 100644 arch/x86/cpu/sc520/asm-offsets.c
arch/x86/cpu/sc520/asm-offsets.c new file +45 -0
new file mode 100644
index 0000000..794f00c
@@ -0,0 +1,45 @@
+/*
+ * Adapted from Linux v2.6.36 kernel: arch/powerpc/kernel/asm-offsets.c
+ *
+ * This program is used to generate definitions needed by
+ * assembly language modules.
+ *
+ * We use the technique used in the OSF Mach kernel code:
+ * generate asm statements containing #defines,
+ * compile this file to assembler, and then extract the
+ * #defines from the assembly-language output.
+ *
+ * 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.
+ */
+
+#include <common.h>
+#include <asm/arch/sc520.h>
+
+#include <linux/kbuild.h>
+
+int main(void)
+{
+	DEFINE(GENERATED_GD_RELOC_OFF, offsetof(gd_t, reloc_off));
+
+	DEFINE(GENERATED_SC520_PAR0, offsetof(struct sc520_mmcr, par[0]));
+	DEFINE(GENERATED_SC520_PAR1, offsetof(struct sc520_mmcr, par[1]));
+	DEFINE(GENERATED_SC520_PAR2, offsetof(struct sc520_mmcr, par[2]));
+	DEFINE(GENERATED_SC520_PAR3, offsetof(struct sc520_mmcr, par[3]));
+	DEFINE(GENERATED_SC520_PAR4, offsetof(struct sc520_mmcr, par[4]));
+	DEFINE(GENERATED_SC520_PAR5, offsetof(struct sc520_mmcr, par[5]));
+	DEFINE(GENERATED_SC520_PAR6, offsetof(struct sc520_mmcr, par[6]));
+	DEFINE(GENERATED_SC520_PAR7, offsetof(struct sc520_mmcr, par[7]));
+	DEFINE(GENERATED_SC520_PAR8, offsetof(struct sc520_mmcr, par[8]));
+	DEFINE(GENERATED_SC520_PAR9, offsetof(struct sc520_mmcr, par[9]));
+	DEFINE(GENERATED_SC520_PAR10, offsetof(struct sc520_mmcr, par[10]));
+	DEFINE(GENERATED_SC520_PAR11, offsetof(struct sc520_mmcr, par[11]));
+	DEFINE(GENERATED_SC520_PAR12, offsetof(struct sc520_mmcr, par[12]));
+	DEFINE(GENERATED_SC520_PAR13, offsetof(struct sc520_mmcr, par[13]));
+	DEFINE(GENERATED_SC520_PAR14, offsetof(struct sc520_mmcr, par[14]));
+	DEFINE(GENERATED_SC520_PAR15, offsetof(struct sc520_mmcr, par[15]));
+
+	return 0;
+}
arch/x86/cpu/sc520/sc520_car.S +2 -1
index 7cac4d1..c04cc1f 100644
@@ -24,6 +24,7 @@
 #include <config.h>
 #include <asm/processor-flags.h>
 #include <asm/arch/sc520.h>
+#include <generated/asm-offsets.h>
 
 .section .text
 
@@ -55,7 +56,7 @@ car_init:
 
 	/* Configure Cache-As-RAM PAR */
 	movl	$CONFIG_SYS_SC520_CAR_PAR, %eax
-	movl	$SC520_PAR2, %edi
+	movl	$(SC520_MMCR_BASE + GENERATED_SC520_PAR2), %edi
 	movl	%eax, (%edi)
 
 	/* Trash the cache then turn it on */
arch/x86/cpu/start.S +2 -1
index 1634eb1..5adb387 100644
@@ -30,6 +30,7 @@
 #include <version.h>
 #include <asm/global_data.h>
 #include <asm/processor-flags.h>
+#include <generated/asm-offsets.h>
 
 .section .text
 .code32
@@ -112,7 +113,7 @@ relocate_code:
 
 	/* Setup call address of in-RAM copy of board_init_r() */
 	movl	$board_init_r, %ebp
-	addl	(GD_RELOC_OFF * 4)(%edx), %ebp
+	addl	(GENERATED_GD_RELOC_OFF)(%edx), %ebp
 
 	/* Setup parameters to board_init_r() */
 	movl	%edx, %eax
arch/x86/include/asm/arch-sc520/sc520.h +0 -26
index 5ac9bb8..9dc29d3 100644
@@ -259,32 +259,6 @@ extern sc520_mmcr_t *sc520_mmcr;
 /* Memory Mapped Control Registers (MMCR) Base Address */
 #define SC520_MMCR_BASE		0xfffef000
 
-/* MMCR Addresses (required for assembler code) */
-#define SC520_DRCCTL		(SC520_MMCR_BASE + 0x010)
-#define SC520_DRCTMCTL		(SC520_MMCR_BASE + 0x012)
-#define SC520_DRCCFG		(SC520_MMCR_BASE + 0x014)
-#define SC520_DRCBENDADR	(SC520_MMCR_BASE + 0x018)
-#define SC520_ECCCTL		(SC520_MMCR_BASE + 0x020)
-#define SC520_DBCTL		(SC520_MMCR_BASE + 0x040)
-#define SC520_ECCINT		(SC520_MMCR_BASE + 0xd18)
-
-#define SC520_PAR0		(SC520_MMCR_BASE + 0x088)
-#define SC520_PAR1		(SC520_PAR0 + (0x04 * 1))
-#define SC520_PAR2		(SC520_PAR0 + (0x04 * 2))
-#define SC520_PAR3		(SC520_PAR0 + (0x04 * 3))
-#define SC520_PAR4		(SC520_PAR0 + (0x04 * 4))
-#define SC520_PAR5		(SC520_PAR0 + (0x04 * 5))
-#define SC520_PAR6		(SC520_PAR0 + (0x04 * 6))
-#define SC520_PAR7		(SC520_PAR0 + (0x04 * 7))
-#define SC520_PAR8		(SC520_PAR0 + (0x04 * 8))
-#define SC520_PAR9		(SC520_PAR0 + (0x04 * 9))
-#define SC520_PAR10		(SC520_PAR0 + (0x04 * 10))
-#define SC520_PAR11		(SC520_PAR0 + (0x04 * 11))
-#define SC520_PAR12		(SC520_PAR0 + (0x04 * 12))
-#define SC520_PAR13		(SC520_PAR0 + (0x04 * 13))
-#define SC520_PAR14		(SC520_PAR0 + (0x04 * 14))
-#define SC520_PAR15		(SC520_PAR0 + (0x04 * 15))
-
 /*
  * PARs for maximum allowable 256MB of SDRAM @ 0x00000000
  * Two PARs are required due to maximum PAR size of 128MB
arch/x86/include/asm/global_data.h +0 -19
index c736549..05a2139 100644
@@ -61,25 +61,6 @@ extern gd_t *gd;
 
 #endif
 
-/* Word Offsets into Global Data - MUST match struct gd_t */
-#define GD_BD		0
-#define GD_FLAGS	1
-#define GD_BAUDRATE	2
-#define GD_HAVE_CONSOLE	3
-#define GD_RELOC_OFF	4
-#define GD_LOAD_OFF	5
-#define GD_ENV_ADDR	6
-#define GD_ENV_VALID	7
-#define GD_CPU_CLK	8
-#define GD_BUS_CLK	9
-#define GD_RELOC_ADDR	10
-#define GD_START_ADDR_SP	11
-#define GD_RAM_SIZE	12
-#define GD_RESET_STATUS	13
-#define GD_JT		14
-
-#define GD_SIZE		15
-
 /*
  * Global Data Flags
  */
board/eNET/eNET_start16.S +3 -2
index 4241f6e..5e3f44c 100644
@@ -30,6 +30,7 @@
 #include "config.h"
 #include "hardware.h"
 #include <asm/arch/sc520.h>
+#include <generated/asm-offsets.h>
 
 .text
 .section .start16, "ax"
@@ -46,12 +47,12 @@ board_init16:
 	movw	%ax, %ds
 
 	/* Map PAR for Boot Flash (BOOTCS, 512kB @ 0x380000000) */
-	movl    $(SC520_PAR14 - SC520_MMCR_BASE), %edi
+	movl    $GENERATED_SC520_PAR14, %edi
 	movl	$CONFIG_SYS_SC520_BOOTCS_PAR, %eax
 	movl	%eax, (%di)
 
 	/* Map PAR for LED, Hex Switches (GPCS6, 20 Bytes @ 0x1000) */
-	movl    $(SC520_PAR15 - SC520_MMCR_BASE), %edi
+	movl    $GENERATED_SC520_PAR15, %edi
 	movl	$CONFIG_SYS_SC520_LLIO_PAR, %eax
 	movl	%eax, (%di)
 

--
1.7.5.2.317.g391b14

#8 lore raw

PATCH v2 7/12 sc520: Create arch asm-offsets

Quoted 7 lines · Graeme Russ

---
Changes for v1:
- None (skipped to set single version for consolidated series)
Changes for v2:
- Consolidated patch series

Quoted 8 lines
 arch/x86/cpu/sc520/asm-offsets.c        |   45 +++++++++++++++++++++++++++++++
 arch/x86/cpu/sc520/sc520_car.S          |    3 +-
 arch/x86/cpu/start.S                    |    3 +-
 arch/x86/include/asm/arch-sc520/sc520.h |   26 ------------------
 arch/x86/include/asm/global_data.h      |   19 -------------
 board/eNET/eNET_start16.S               |    5 ++-
 6 files changed, 52 insertions(+), 49 deletions(-)
 create mode 100644 arch/x86/cpu/sc520/asm-offsets.c

Applied to u-boot-x86

Thanks,

Graeme

#9 lore raw

PATCH 3/7 x86: Add multiboot header

In reply to Graeme Russ

By adding a multiboot heade, U-Boot can be loaded by GRUB2. Using GRUB2 to bootstrap U-Boot is useful for using an existing BIOS to get an initial U-Boot port up and running before implementing the low-level reset vector code, SDRAM init, etc. and overwriting the BIOS

---
 arch/x86/cpu/start.S |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
arch/x86/cpu/start.S +20 -0
index 5adb387..d099fc9 100644
@@ -129,3 +129,23 @@ die:	hlt
 blank_idt_ptr:
 	.word	0		/* limit */
 	.long	0		/* base */
+
+	.p2align	2	/* force 4-byte alignment */
+
+multiboot_header:
+	/* magic */
+	.long	0x1BADB002
+	/* flags */
+	.long	(1 << 16)
+	/* checksum */
+	.long	-0x1BADB002 - (1 << 16)
+	/* header addr */
+	.long	multiboot_header - _x86boot_start + CONFIG_SYS_TEXT_BASE
+	/* load addr */
+	.long	CONFIG_SYS_TEXT_BASE
+	/* load end addr */
+	.long	0
+	/* bss end addr */
+	.long	0
+	/* entry addr */
+	.long	CONFIG_SYS_TEXT_BASE
Signature · 1 line
1.7.5.2.317.g391b14
#10 lore raw

PATCH 3/7 x86: Add multiboot header

Dear Graeme Russ,

Quoted 1 line · In message <[email protected]> you wrote:

By adding a multiboot heade, U-Boot can be loaded by GRUB2. Using GRUB2 to

----------------------------^ 'r' missing.

Best regards,

Wolfgang Denk

Signature · 7 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"Obviously, a major malfunction has occurred."
              -- Steve Nesbitt, voice of Mission Control, January 28,
                 1986, as the shuttle Challenger exploded within view
                 of the grandstands.
#11 lore raw

PATCH v2 8/12 x86: Add multiboot header

In reply to Graeme Russ

By adding a multiboot header, U-Boot can be loaded by GRUB2. Using GRUB2 to bootstrap U-Boot is useful for using an existing BIOS to get an initial U-Boot port up and running before implementing the low-level reset vector code, SDRAM init, etc. and overwriting the BIOS

---
Changes for v1:
- None (skipped to set single version for consolidated series)
Changes for v2:
- Consolidated patch series

 arch/x86/cpu/start.S |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
arch/x86/cpu/start.S +20 -0
index 5adb387..d099fc9 100644
@@ -129,3 +129,23 @@ die:	hlt
 blank_idt_ptr:
 	.word	0		/* limit */
 	.long	0		/* base */
+
+	.p2align	2	/* force 4-byte alignment */
+
+multiboot_header:
+	/* magic */
+	.long	0x1BADB002
+	/* flags */
+	.long	(1 << 16)
+	/* checksum */
+	.long	-0x1BADB002 - (1 << 16)
+	/* header addr */
+	.long	multiboot_header - _x86boot_start + CONFIG_SYS_TEXT_BASE
+	/* load addr */
+	.long	CONFIG_SYS_TEXT_BASE
+	/* load end addr */
+	.long	0
+	/* bss end addr */
+	.long	0
+	/* entry addr */
+	.long	CONFIG_SYS_TEXT_BASE

--
1.7.5.2.317.g391b14

#12 lore raw

PATCH v2 8/12 x86: Add multiboot header

Quoted 6 lines · Graeme Russ

By adding a multiboot header, U-Boot can be loaded by GRUB2. Using GRUB2 to bootstrap U-Boot is useful for using an existing BIOS to get an initial U-Boot port up and running before implementing the low-level reset vector code, SDRAM init, etc. and overwriting the BIOS

Quoted 8 lines

---
Changes for v1:
- None (skipped to set single version for consolidated series)
Changes for v2:
- Consolidated patch series

 arch/x86/cpu/start.S |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

Applied to u-boot-x86

Thanks,

Graeme

#13 lore raw

PATCH 4/7 x86: Provide more configuration granularity

In reply to Graeme Russ

Planned future ports requires more granularity for some options

---
 arch/x86/lib/Makefile     |   18 +++++++++---------
 arch/x86/lib/board.c      |    9 +++++++++
 arch/x86/lib/bootm.c      |    4 +++-
 arch/x86/lib/pci.c        |   37 +++++++++++++++++++++++++++++++++++++
 arch/x86/lib/video_bios.c |   42 ------------------------------------------
 common/cmd_bdinfo.c       |    3 ++-
 include/configs/eNET.h    |    5 +++++
 include/serial.h          |    2 +-
 8 files changed, 66 insertions(+), 54 deletions(-)
arch/x86/lib/Makefile +9 -9
index 71e94f7..eb5fa10 100644
@@ -25,11 +25,11 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)lib$(ARCH).o
 
-SOBJS-y	+= bios.o
-SOBJS-y	+= bios_pci.o
-SOBJS-y	+= realmode_switch.o
+SOBJS-$(CONFIG_SYS_PC_BIOS)	+= bios.o
+SOBJS-$(CONFIG_SYS_PCI_BIOS)	+= bios_pci.o
+SOBJS-$(CONFIG_SYS_X86_REALMODE)	+= realmode_switch.o
 
-COBJS-y	+= bios_setup.o
+COBJS-$(CONFIG_SYS_PC_BIOS)	+= bios_setup.o
 COBJS-y	+= board.o
 COBJS-y	+= bootm.o
 COBJS-y	+= interrupts.o
@@ -37,11 +37,11 @@ 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-$(CONFIG_SYS_X86_REALMODE)	+= realmode.o
+COBJS-$(CONFIG_SYS_X86_ISR_TIMER)	+= timer.o
+COBJS-$(CONFIG_VIDEO)	+= video_bios.o
+COBJS-$(CONFIG_VIDEO)	+= video.o
+COBJS-$(CONFIG_CMD_ZBOOT)	+= zimage.o
 
 SRCS	:= $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
 OBJS	:= $(addprefix $(obj),$(SOBJS-y) $(COBJS-y))
arch/x86/lib/board.c +9 -0
index 8963580..0938104 100644
@@ -110,11 +110,13 @@ static int display_dram_config (void)
 	return (0);
 }
 
+#ifndef CONFIG_SYS_NO_FLASH
 static void display_flash_config (ulong size)
 {
 	puts ("Flash: ");
 	print_size (size, "\n");
 }
+#endif
 
 /*
  * Breath some life into the board...
@@ -259,8 +261,12 @@ void board_init_f(ulong boot_flags)
 
 void board_init_r(gd_t *id, ulong dest_addr)
 {
+#if defined(CONFIG_CMD_NET)
 	char *s;
+#endif
+#ifndef CONFIG_SYS_NO_FLASH
 	ulong size;
+#endif
 	static bd_t bd_data;
 	static gd_t gd_data;
 	init_fnc_t **init_fnc_ptr;
@@ -292,10 +298,13 @@ void board_init_r(gd_t *id, ulong dest_addr)
 #ifdef CONFIG_SERIAL_MULTI
 	serial_initialize();
 #endif
+
+#ifndef CONFIG_SYS_NO_FLASH
 	/* configure available FLASH banks */
 	size = flash_init();
 	display_flash_config(size);
 	show_boot_progress(0x24);
+#endif
 
 	show_boot_progress(0x25);
 
arch/x86/lib/bootm.c +3 -1
index a21a21f..fc6a359 100644
@@ -34,7 +34,7 @@
 /*cmd_boot.c*/
 int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *images)
 {
-	void		*base_ptr;
+	void		*base_ptr = NULL;
 	ulong		os_data, os_len;
 	image_header_t	*hdr;
 
@@ -72,8 +72,10 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *ima
 		goto error;
 	}
 
+#ifdef CONFIG_CMD_ZBOOT
 	base_ptr = load_zimage ((void*)os_data, os_len,
 			images->rd_start, images->rd_end - images->rd_start, 0);
+#endif
 
 	if (NULL == base_ptr) {
 		printf ("## Kernel loading failed ...\n");
arch/x86/lib/pci.c +37 -0
index 593a7db..077a3f7 100644
@@ -148,3 +148,40 @@ int pci_shadow_rom(pci_dev_t dev, unsigned char *dest)
 
 	return res;
 }
+
+#ifdef PCI_BIOS_DEBUG
+#define RELOC_16(seg, off) *(u32*)(seg << 4 | (u32)&off)
+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;
+
+void print_bios_bios_stat(void)
+{
+	printf("16 bit functions:\n");
+	printf("pci_bios_present:                %d\n", RELOC_16(0xf000, num_pci_bios_present));
+	printf("pci_bios_find_device:            %d\n", RELOC_16(0xf000, num_pci_bios_find_device));
+	printf("pci_bios_find_class:             %d\n", RELOC_16(0xf000, num_pci_bios_find_class));
+	printf("pci_bios_generate_special_cycle: %d\n", RELOC_16(0xf000, num_pci_bios_generate_special_cycle));
+	printf("pci_bios_read_cfg_byte:          %d\n", RELOC_16(0xf000, num_pci_bios_read_cfg_byte));
+	printf("pci_bios_read_cfg_word:          %d\n", RELOC_16(0xf000, num_pci_bios_read_cfg_word));
+	printf("pci_bios_read_cfg_dword:         %d\n", RELOC_16(0xf000, num_pci_bios_read_cfg_dword));
+	printf("pci_bios_write_cfg_byte:         %d\n", RELOC_16(0xf000, num_pci_bios_write_cfg_byte));
+	printf("pci_bios_write_cfg_word:         %d\n", RELOC_16(0xf000, num_pci_bios_write_cfg_word));
+	printf("pci_bios_write_cfg_dword:        %d\n", RELOC_16(0xf000, num_pci_bios_write_cfg_dword));
+	printf("pci_bios_get_irq_routing:        %d\n", RELOC_16(0xf000, num_pci_bios_get_irq_routing));
+	printf("pci_bios_set_irq:                %d\n", RELOC_16(0xf000, num_pci_bios_set_irq));
+	printf("pci_bios_unknown_function:       %d\n", RELOC_16(0xf000, num_pci_bios_unknown_function));
+
+}
+#endif
+
arch/x86/lib/video_bios.c +0 -42

51 lines not on this page · raw message

common/cmd_bdinfo.c +2 -1
index 688b238..6c48594 100644
@@ -31,7 +31,8 @@ DECLARE_GLOBAL_DATA_PTR;
 
 static void print_num(const char *, ulong);
 
-#if !(defined(CONFIG_ARM) || defined(CONFIG_M68K) || defined(CONFIG_SANDBOX)) \
+#if !(defined(CONFIG_ARM) || defined(CONFIG_M68K) || \
+	defined(CONFIG_SANDBOX) || defined(CONFIG_X86)) \
 	|| defined(CONFIG_CMD_NET)
 #define HAVE_PRINT_ETH
 static void print_eth(int idx);
include/configs/eNET.h +5 -0
index 70c74f6..d5c9cad 100644
@@ -105,6 +105,7 @@
 #define CONFIG_CMD_SETGETDCR
 #define CONFIG_CMD_SOURCE
 #define CONFIG_CMD_XIMG
+#define CONFIG_CMD_ZBOOT
 
 #define CONFIG_BOOTDELAY			15
 #define CONFIG_BOOTARGS				"root=/dev/mtdblock0 console=ttyS0,9600"
@@ -153,6 +154,10 @@
 #undef  CONFIG_SYS_GENERIC_TIMER
 #define CONFIG_SYS_PCAT_INTERRUPTS
 #define CONFIG_SYS_NUM_IRQS			16
+#define CONFIG_SYS_PC_BIOS
+#define CONFIG_SYS_PCI_BIOS
+#define CONFIG_SYS_X86_REALMODE
+#define CONFIG_SYS_X86_ISR_TIMER
 
 /*-----------------------------------------------------------------------
  * Memory organization:
include/serial.h +1 -1
index 5926244..8396e61 100644
@@ -31,7 +31,7 @@ extern struct serial_device * default_serial_console (void);
     defined(CONFIG_MB86R0x) || defined(CONFIG_MPC5xxx) || \
     defined(CONFIG_MPC83xx) || defined(CONFIG_MPC85xx) || \
     defined(CONFIG_MPC86xx) || defined(CONFIG_SYS_SC520) || \
-    defined(CONFIG_TEGRA2)
+    defined(CONFIG_SYS_E660) || defined(CONFIG_TEGRA2)
 extern struct serial_device serial0_device;
 extern struct serial_device serial1_device;
 #if defined(CONFIG_SYS_NS16550_SERIAL)
Signature · 1 line
1.7.5.2.317.g391b14
#14 lore raw

PATCH 4/7 x86: Provide more configuration granularity

Dear Graeme Russ,

Quoted 1 line · In message <[email protected]> you wrote:

Planned future ports requires more granularity for some options

...

Quoted 6 lines
arch/x86/lib/board.c +4 -0
+#if defined(CONFIG_CMD_NET)
 	char *s;
+#endif
+#ifndef CONFIG_SYS_NO_FLASH
 	ulong size;
+#endif

...

arch/x86/lib/board.c void board_init_r(gd_t *id, ulong dest_addr) · line 307

Quoted 6 lines
arch/x86/lib/board.c +2 -0
+#ifndef CONFIG_SYS_NO_FLASH
 	/* configure available FLASH banks */
 	size = flash_init();
 	display_flash_config(size);
 	show_boot_progress(0x24);
+#endif

The more often I see this, the less I like it. In a number of recent cleanup patches I tried to avoid such multiple #ifdefs by using local blocks, like that:

#ifndef CONFIG_SYS_NO_FLASH
	{
		ulong size;

		/* configure available FLASH banks */
		size = flash_init();
		display_flash_config(size);
		show_boot_progress(0x24);
	}

#endif

This is not exactly nice either, but at least keeps the related declarations and code together, and reduces the number of #ifdef's.

Have a look at it and feel free to use this method if you like it, or just ignore it.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
They say a little knowledge is a dangerous thing,  but it is not  one
half so bad as a lot of ignorance.   - Terry Pratchett, _Equal Rites_
#15 lore raw

PATCH 4/7 x86: Provide more configuration granularity

In reply to Graeme Russ

Dear Graeme Russ,

Quoted 3 lines · In message <[email protected]> you wrote:

Planned future ports requires more granularity for some options

This has a large number of checkpatch problems:

total: 2 errors, 27 warnings, 210 lines checked

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"The best index to a person's character is a) how  he  treats  people
who can't do him any good and b) how he treats people who can't fight
back."                                            - Abigail Van Buren
#16 lore raw

PATCH v2 9/12 x86: Provide more configuration granularity

In reply to Graeme Russ

Planned future ports requires more granularity for some options

---
Changes for v1:
- None (skipped to set single version for consolidated series)
Changes for v2:
- Consolidated patch series
- Fixed checkpatch issues
- Removed non x86 modification to common/cmd_bdinfo.c

 arch/x86/lib/Makefile     |   18 +++++++++---------
 arch/x86/lib/board.c      |    9 +++++++++
 arch/x86/lib/bootm.c      |    4 +++-
 arch/x86/lib/pci.c        |   36 ++++++++++++++++++++++++++++++++++++
 arch/x86/lib/video_bios.c |   41 -----------------------------------------
 common/cmd_bdinfo.c       |    3 ++-
 include/configs/eNET.h    |    5 +++++
 7 files changed, 64 insertions(+), 52 deletions(-)
arch/x86/lib/Makefile +9 -9
index 71e94f7..eb5fa10 100644
@@ -25,11 +25,11 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)lib$(ARCH).o
 
-SOBJS-y	+= bios.o
-SOBJS-y	+= bios_pci.o
-SOBJS-y	+= realmode_switch.o
+SOBJS-$(CONFIG_SYS_PC_BIOS)	+= bios.o
+SOBJS-$(CONFIG_SYS_PCI_BIOS)	+= bios_pci.o
+SOBJS-$(CONFIG_SYS_X86_REALMODE)	+= realmode_switch.o
 
-COBJS-y	+= bios_setup.o
+COBJS-$(CONFIG_SYS_PC_BIOS)	+= bios_setup.o
 COBJS-y	+= board.o
 COBJS-y	+= bootm.o
 COBJS-y	+= interrupts.o
@@ -37,11 +37,11 @@ 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-$(CONFIG_SYS_X86_REALMODE)	+= realmode.o
+COBJS-$(CONFIG_SYS_X86_ISR_TIMER)	+= timer.o
+COBJS-$(CONFIG_VIDEO)	+= video_bios.o
+COBJS-$(CONFIG_VIDEO)	+= video.o
+COBJS-$(CONFIG_CMD_ZBOOT)	+= zimage.o
 
 SRCS	:= $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
 OBJS	:= $(addprefix $(obj),$(SOBJS-y) $(COBJS-y))
arch/x86/lib/board.c +9 -0
index e8227b1..b445179 100644
@@ -91,11 +91,13 @@ static int display_dram_config(void)
 	return 0;
 }
 
+#ifndef CONFIG_SYS_NO_FLASH
 static void display_flash_config(ulong size)
 {
 	puts("Flash: ");
 	print_size(size, "\n");
 }
+#endif
 
 /*
  * Breath some life into the board...
@@ -254,8 +256,12 @@ void board_init_f(ulong boot_flags)
 
 void board_init_r(gd_t *id, ulong dest_addr)
 {
+#if defined(CONFIG_CMD_NET)
 	char *s;
+#endif
+#ifndef CONFIG_SYS_NO_FLASH
 	ulong size;
+#endif
 	static bd_t bd_data;
 	static gd_t gd_data;
 	init_fnc_t **init_fnc_ptr;
@@ -287,10 +293,13 @@ void board_init_r(gd_t *id, ulong dest_addr)
 #ifdef CONFIG_SERIAL_MULTI
 	serial_initialize();
 #endif
+
+#ifndef CONFIG_SYS_NO_FLASH
 	/* configure available FLASH banks */
 	size = flash_init();
 	display_flash_config(size);
 	show_boot_progress(0x24);
+#endif
 
 	show_boot_progress(0x25);
 
arch/x86/lib/bootm.c +3 -1
index 836803c..bac7b4f 100644
@@ -35,7 +35,7 @@
 int do_bootm_linux(int flag, int argc, char * const argv[],
 		bootm_headers_t *images)
 {
-	void		*base_ptr;
+	void		*base_ptr = NULL;
 	ulong		os_data, os_len;
 	image_header_t	*hdr;
 
@@ -73,8 +73,10 @@ int do_bootm_linux(int flag, int argc, char * const argv[],
 		goto error;
 	}
 
+#ifdef CONFIG_CMD_ZBOOT
 	base_ptr = load_zimage((void *)os_data, os_len,
 			images->rd_start, images->rd_end - images->rd_start, 0);
+#endif
 
 	if (NULL == base_ptr) {
 		printf("## Kernel loading failed ...\n");
arch/x86/lib/pci.c +36 -0
index f3018b7..286029e 100644
@@ -151,3 +151,39 @@ int pci_shadow_rom(pci_dev_t dev, unsigned char *dest)
 
 	return res;
 }
+
+#ifdef PCI_BIOS_DEBUG
+
+void print_bios_bios_stat(void)
+{
+	printf("16 bit functions:\n");
+	printf("pci_bios_present:                %d\n",
+			RELOC_16_LONG(0xf000, num_pci_bios_present));
+	printf("pci_bios_find_device:            %d\n",
+			RELOC_16_LONG(0xf000, num_pci_bios_find_device));
+	printf("pci_bios_find_class:             %d\n",
+			RELOC_16_LONG(0xf000, num_pci_bios_find_class));
+	printf("pci_bios_generate_special_cycle: %d\n",
+			RELOC_16_LONG(0xf000,
+				      num_pci_bios_generate_special_cycle));
+	printf("pci_bios_read_cfg_byte:          %d\n",
+			RELOC_16_LONG(0xf000, num_pci_bios_read_cfg_byte));
+	printf("pci_bios_read_cfg_word:          %d\n",
+			RELOC_16_LONG(0xf000, num_pci_bios_read_cfg_word));
+	printf("pci_bios_read_cfg_dword:         %d\n",
+			RELOC_16_LONG(0xf000, num_pci_bios_read_cfg_dword));
+	printf("pci_bios_write_cfg_byte:         %d\n",
+			RELOC_16_LONG(0xf000, num_pci_bios_write_cfg_byte));
+	printf("pci_bios_write_cfg_word:         %d\n",
+			RELOC_16_LONG(0xf000, num_pci_bios_write_cfg_word));
+	printf("pci_bios_write_cfg_dword:        %d\n",
+			RELOC_16_LONG(0xf000, num_pci_bios_write_cfg_dword));
+	printf("pci_bios_get_irq_routing:        %d\n",
+			RELOC_16_LONG(0xf000, num_pci_bios_get_irq_routing));
+	printf("pci_bios_set_irq:                %d\n",
+			RELOC_16_LONG(0xf000, num_pci_bios_set_irq));
+	printf("pci_bios_unknown_function:       %d\n",
+			RELOC_16_LONG(0xf000, num_pci_bios_unknown_function));
+}
+#endif
+
arch/x86/lib/video_bios.c +0 -41

50 lines not on this page · raw message

common/cmd_bdinfo.c +2 -1
index 688b238..6c48594 100644
@@ -31,7 +31,8 @@ DECLARE_GLOBAL_DATA_PTR;
 
 static void print_num(const char *, ulong);
 
-#if !(defined(CONFIG_ARM) || defined(CONFIG_M68K) || defined(CONFIG_SANDBOX)) \
+#if !(defined(CONFIG_ARM) || defined(CONFIG_M68K) || \
+	defined(CONFIG_SANDBOX) || defined(CONFIG_X86)) \
 	|| defined(CONFIG_CMD_NET)
 #define HAVE_PRINT_ETH
 static void print_eth(int idx);
include/configs/eNET.h +5 -0
index 70c74f6..d5c9cad 100644
@@ -105,6 +105,7 @@
 #define CONFIG_CMD_SETGETDCR
 #define CONFIG_CMD_SOURCE
 #define CONFIG_CMD_XIMG
+#define CONFIG_CMD_ZBOOT
 
 #define CONFIG_BOOTDELAY			15
 #define CONFIG_BOOTARGS				"root=/dev/mtdblock0 console=ttyS0,9600"
@@ -153,6 +154,10 @@
 #undef  CONFIG_SYS_GENERIC_TIMER
 #define CONFIG_SYS_PCAT_INTERRUPTS
 #define CONFIG_SYS_NUM_IRQS			16
+#define CONFIG_SYS_PC_BIOS
+#define CONFIG_SYS_PCI_BIOS
+#define CONFIG_SYS_X86_REALMODE
+#define CONFIG_SYS_X86_ISR_TIMER
 
 /*-----------------------------------------------------------------------
  * Memory organization:

--
1.7.5.2.317.g391b14

#17 lore raw

PATCH v2 9/12 x86: Provide more configuration granularity

Quoted 11 lines · Graeme Russ

Planned future ports requires more granularity for some options

---
Changes for v1:
- None (skipped to set single version for consolidated series)
Changes for v2:
- Consolidated patch series
- Fixed checkpatch issues
- Removed non x86 modification to common/cmd_bdinfo.c

Quoted 8 lines
 arch/x86/lib/Makefile     |   18 +++++++++---------
 arch/x86/lib/board.c      |    9 +++++++++
 arch/x86/lib/bootm.c      |    4 +++-
 arch/x86/lib/pci.c        |   36 ++++++++++++++++++++++++++++++++++++
 arch/x86/lib/video_bios.c |   41 -----------------------------------------
 common/cmd_bdinfo.c       |    3 ++-
 include/configs/eNET.h    |    5 +++++
 7 files changed, 64 insertions(+), 52 deletions(-)

Applied to u-boot-x86

Wolfgang: There is a modification to common/cmd_bdinfo.c that crept in - it is purely cosmetic. Sorry, but I only just noticed it after I pushed my local repo :(

Thanks,

Graeme

#18 lore raw

PATCH 5/7 x86: Ensure IDT and GDT remain 16-byte aligned post relocation

In reply to Graeme Russ

Some CPUs have strict alignment requirements for these tables

---
 arch/x86/cpu/interrupts.c |    2 +-
 arch/x86/lib/board.c      |   17 ++++++++++++-----
 2 files changed, 13 insertions(+), 6 deletions(-)
arch/x86/cpu/interrupts.c +1 -1
index c6e72ea..b501fed 100644
@@ -172,7 +172,7 @@ struct desc_ptr {
 	unsigned short segment;
 } __attribute__((packed));
 
-struct idt_entry idt[256];
+struct idt_entry idt[256] __attribute__((aligned(16)));
 
 struct desc_ptr idt_ptr;
 
arch/x86/lib/board.c +12 -5
index 0938104..c5a0b71 100644
@@ -180,19 +180,26 @@ gd_t *gd;
 
 static int calculate_relocation_address(void)
 {
-	void *text_start = &__text_start;
-	void *bss_end = &__bss_end;
-	void *dest_addr;
+	ulong text_start = (ulong)&__text_start;
+	ulong bss_end = (ulong)&__bss_end;
+	ulong dest_addr;
 	ulong rel_offset;
 
 	/* Calculate destination RAM Address and relocation offset */
-	dest_addr = (void *)gd->ram_size;
+	dest_addr = gd->ram_size;
 	dest_addr -= CONFIG_SYS_STACK_SIZE;
 	dest_addr -= (bss_end - text_start);
+
+	/*
+	 * Round destination address down to 16-byte boundary to keep
+	 * IDT and GDT 16-byte aligned
+	 */
+	dest_addr &= ~15;
+
 	rel_offset = dest_addr - text_start;
 
 	gd->start_addr_sp = gd->ram_size;
-	gd->relocaddr = (ulong)dest_addr;
+	gd->relocaddr = dest_addr;
 	gd->reloc_off = rel_offset;
 
 	return 0;
Signature · 1 line
1.7.5.2.317.g391b14
#19 lore raw

PATCH v2 10/12 x86: Ensure IDT and GDT remain 16-byte aligned post relocation

Some CPUs have strict alignment requirements for these tables

---
Changes for v1:
- None (skipped to set single version for consolidated series)
Changes for v2:
- Consolidated patch series

 arch/x86/cpu/interrupts.c |    2 +-
 arch/x86/lib/board.c      |   17 ++++++++++++-----
 2 files changed, 13 insertions(+), 6 deletions(-)
arch/x86/cpu/interrupts.c +1 -1
index e007511..e0958eb 100644
@@ -174,7 +174,7 @@ struct desc_ptr {
 	unsigned short segment;
 } __packed;
 
-struct idt_entry idt[256];
+struct idt_entry idt[256] __attribute__((aligned(16)));
 
 struct desc_ptr idt_ptr;
 
arch/x86/lib/board.c +12 -5
index b445179..244a021 100644
@@ -161,19 +161,26 @@ gd_t *gd;
 
 static int calculate_relocation_address(void)
 {
-	void *text_start = &__text_start;
-	void *bss_end = &__bss_end;
-	void *dest_addr;
+	ulong text_start = (ulong)&__text_start;
+	ulong bss_end = (ulong)&__bss_end;
+	ulong dest_addr;
 	ulong rel_offset;
 
 	/* Calculate destination RAM Address and relocation offset */
-	dest_addr = (void *)gd->ram_size;
+	dest_addr = gd->ram_size;
 	dest_addr -= CONFIG_SYS_STACK_SIZE;
 	dest_addr -= (bss_end - text_start);
+
+	/*
+	 * Round destination address down to 16-byte boundary to keep
+	 * IDT and GDT 16-byte aligned
+	 */
+	dest_addr &= ~15;
+
 	rel_offset = dest_addr - text_start;
 
 	gd->start_addr_sp = gd->ram_size;
-	gd->relocaddr = (ulong)dest_addr;
+	gd->relocaddr = dest_addr;
 	gd->reloc_off = rel_offset;
 
 	return 0;

--
1.7.5.2.317.g391b14

#20 lore raw

PATCH v2 10/12 x86: Ensure IDT and GDT remain 16-byte aligned post relocation

Quoted 9 lines · Graeme Russ

Some CPUs have strict alignment requirements for these tables

---
Changes for v1:
- None (skipped to set single version for consolidated series)
Changes for v2:
- Consolidated patch series

Quoted 3 lines
 arch/x86/cpu/interrupts.c |    2 +-
 arch/x86/lib/board.c      |   17 ++++++++++++-----
 2 files changed, 13 insertions(+), 6 deletions(-)

Applied to u-boot-x86

Thanks,

Graeme

#21 lore raw

PATCH 6/7 x86: Misc PCI touchups

In reply to Graeme Russ
---
 arch/x86/cpu/sc520/sc520_pci.c |    4 +---
 arch/x86/include/asm/pci.h     |    2 +-
 arch/x86/lib/pci_type1.c       |   10 +++++++---
 drivers/pci/pci.c              |    4 ++--
 4 files changed, 11 insertions(+), 9 deletions(-)
arch/x86/cpu/sc520/sc520_pci.c +1 -3
index e26793a..01b13e9 100644
@@ -126,9 +126,7 @@ void pci_sc520_init(struct pci_controller *hose)
 	hose->last_busno = 0xff;
 	hose->region_count = pci_set_regions(hose);
 
-	pci_setup_type1(hose,
-			SC520_REG_ADDR,
-			SC520_REG_DATA);
+	pci_setup_type1(hose);
 
 	pci_register_hose(hose);
 
arch/x86/include/asm/pci.h +1 -1
index 85f60d7..4acd76f 100644
@@ -26,7 +26,7 @@
 #ifndef _PCI_I386_H_
 #define _PCI_I386_H_	1
 
-void pci_setup_type1(struct pci_controller* hose, u32 cfg_addr, u32 cfg_data);
+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);
arch/x86/lib/pci_type1.c +7 -3
index da1d356..2df4bf8 100644
@@ -51,7 +51,11 @@ TYPE1_PCI_OP(write, byte, u8, outb, 3)
 TYPE1_PCI_OP(write, word, u16, outw, 2)
 TYPE1_PCI_OP(write, dword, u32, outl, 0)
 
-void pci_setup_type1(struct pci_controller* hose, u32 cfg_addr, u32 cfg_data)
+/* bus mapping constants (used for PCI core initialization) */																																																 /* bus mapping constants */
+#define PCI_REG_ADDR		0x00000cf8
+#define PCI_REG_DATA		0x00000cfc
+
+void pci_setup_type1(struct pci_controller* hose)
 {
 	pci_set_ops(hose,
 		    type1_read_config_byte,
@@ -61,6 +65,6 @@ void pci_setup_type1(struct pci_controller* hose, u32 cfg_addr, u32 cfg_data)
 		    type1_write_config_word,
 		    type1_write_config_dword);
 
-	hose->cfg_addr = (unsigned int *) cfg_addr;
-	hose->cfg_data = (unsigned char *) cfg_data;
+	hose->cfg_addr = (unsigned int *)PCI_REG_ADDR;
+	hose->cfg_data = (unsigned char *)PCI_REG_DATA;
 }
drivers/pci/pci.c +2 -2
index 5f1f128..7adb0c9 100644
@@ -280,7 +280,7 @@ int __pci_hose_phys_to_bus (struct pci_controller *hose,
 		bus_addr = phys_addr - res->phys_start + res->bus_start;
 
 		if (bus_addr >= res->bus_start &&
-			bus_addr < res->bus_start + res->size) {
+			bus_addr < (res->bus_start + res->size - 1)) {
 			*ba = bus_addr;
 			return 0;
 		}
@@ -337,7 +337,7 @@ int __pci_hose_bus_to_phys (struct pci_controller *hose,
 			continue;
 
 		if (bus_addr >= res->bus_start &&
-			bus_addr < res->bus_start + res->size) {
+			bus_addr < (res->bus_start + res->size - 1)) {
 			*pa = (bus_addr - res->bus_start + res->phys_start);
 			return 0;
 		}
Signature · 1 line
1.7.5.2.317.g391b14
#22 lore raw

PATCH 6/7 x86: Misc PCI touchups

Dear Graeme Russ,

Quoted 1 line · In message <[email protected]> you wrote:

This is not checkpatch clean:

ERROR: "foo* bar" should be "foo *bar" #123: FILE: arch/x86/include/asm/pci.h:29:
+void pci_setup_type1(struct pci_controller* hose);

WARNING: line over 80 characters
#136: FILE: arch/x86/lib/pci_type1.c:54:
+/* bus mapping constants (used for PCI core initialization) */ /* bus mapping constants */

ERROR: "foo* bar" should be "foo *bar" #140: FILE: arch/x86/lib/pci_type1.c:58:
+void pci_setup_type1(struct pci_controller* hose)

total: 2 errors, 1 warnings, 54 lines checked

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The sooner our happiness together begins, the longer it will last.
	-- Miramanee, "The Paradise Syndrome", stardate 4842.6
#23 lore raw

PATCH v2 11/12 x86: Misc PCI touchups

In reply to Graeme Russ

---
Changes for v1:
- None (skipped to set single version for consolidated series)
Changes for v2:
- Consolidated patch series
- Removed non x86 modification to drivers/pci/pci.c

 arch/x86/cpu/sc520/sc520_pci.c |    4 +---
 arch/x86/include/asm/pci.h     |    2 +-
 arch/x86/lib/pci_type1.c       |   10 +++++++---
 3 files changed, 9 insertions(+), 7 deletions(-)
arch/x86/cpu/sc520/sc520_pci.c +1 -3
index a13798f..52d07c1 100644
@@ -130,9 +130,7 @@ void pci_sc520_init(struct pci_controller *hose)
 	hose->last_busno = 0xff;
 	hose->region_count = pci_set_regions(hose);
 
-	pci_setup_type1(hose,
-			SC520_REG_ADDR,
-			SC520_REG_DATA);
+	pci_setup_type1(hose);
 
 	pci_register_hose(hose);
 
arch/x86/include/asm/pci.h +1 -1
index c09078e..37cc7e3 100644
@@ -29,7 +29,7 @@
 #define DEFINE_PCI_DEVICE_TABLE(_table) \
 	const struct pci_device_id _table[]
 
-void pci_setup_type1(struct pci_controller* hose, u32 cfg_addr, u32 cfg_data);
+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);
arch/x86/lib/pci_type1.c +7 -3
index 6fc4df4..a25fa05 100644
@@ -50,7 +50,11 @@ TYPE1_PCI_OP(write, byte, u8, outb, 3)
 TYPE1_PCI_OP(write, word, u16, outw, 2)
 TYPE1_PCI_OP(write, dword, u32, outl, 0)
 
-void pci_setup_type1(struct pci_controller *hose, u32 cfg_addr, u32 cfg_data)
+/* bus mapping constants (used for PCI core initialization) */
+#define PCI_REG_ADDR		0x00000cf8
+#define PCI_REG_DATA		0x00000cfc
+
+void pci_setup_type1(struct pci_controller *hose)
 {
 	pci_set_ops(hose,
 		    type1_read_config_byte,
@@ -60,6 +64,6 @@ void pci_setup_type1(struct pci_controller *hose, u32 cfg_addr, u32 cfg_data)
 		    type1_write_config_word,
 		    type1_write_config_dword);
 
-	hose->cfg_addr = (unsigned int *)cfg_addr;
-	hose->cfg_data = (unsigned char *)cfg_data;
+	hose->cfg_addr = (unsigned int *)PCI_REG_ADDR;
+	hose->cfg_data = (unsigned char *)PCI_REG_DATA;
 }

--
1.7.5.2.317.g391b14

#24 lore raw

PATCH v2 11/12 x86: Misc PCI touchups

Quoted 8 lines · Graeme Russ

---
Changes for v1:
- None (skipped to set single version for consolidated series)
Changes for v2:
- Consolidated patch series
- Removed non x86 modification to drivers/pci/pci.c

Quoted 4 lines
 arch/x86/cpu/sc520/sc520_pci.c |    4 +---
 arch/x86/include/asm/pci.h     |    2 +-
 arch/x86/lib/pci_type1.c       |   10 +++++++---
 3 files changed, 9 insertions(+), 7 deletions(-)

Applied to u-boot-x86

Thanks,

Graeme

#25 lore raw

PATCH 7/7 x86: Misc cleanups

In reply to Graeme Russ
---
 arch/x86/cpu/start.S |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
arch/x86/cpu/start.S +3 -2
index d099fc9..f87633b 100644
@@ -48,7 +48,7 @@ _x86boot_start:
 	cli
 	cld
 
-	/* Turn of cache (this might require a 486-class CPU) */
+	/* Turn off cache (this might require a 486-class CPU) */
 	movl	%cr0, %eax
 	orl	$(X86_CR0_NW | X86_CR0_CD), %eax
 	movl	%eax, %cr0
@@ -122,7 +122,8 @@ relocate_code:
 	/* Jump to in-RAM copy of board_init_r() */
 	call	*%ebp
 
-die:	hlt
+die:
+	hlt
 	jmp	die
 	hlt
 
Signature · 1 line
1.7.5.2.317.g391b14
#26 lore raw

PATCH v2 12/12 x86: Misc cleanups

---
Changes for v1:
- None (skipped to set single version for consolidated series)
Changes for v2:
- Consolidated patch series

 arch/x86/cpu/start.S |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
arch/x86/cpu/start.S +3 -2
index d099fc9..f87633b 100644
@@ -48,7 +48,7 @@ _x86boot_start:
 	cli
 	cld
 
-	/* Turn of cache (this might require a 486-class CPU) */
+	/* Turn off cache (this might require a 486-class CPU) */
 	movl	%cr0, %eax
 	orl	$(X86_CR0_NW | X86_CR0_CD), %eax
 	movl	%eax, %cr0
@@ -122,7 +122,8 @@ relocate_code:
 	/* Jump to in-RAM copy of board_init_r() */
 	call	*%ebp
 
-die:	hlt
+die:
+	hlt
 	jmp	die
 	hlt
 

--
1.7.5.2.317.g391b14

#27 lore raw

PATCH v2 12/12 x86: Misc cleanups

Quoted 9 lines · Graeme Russ

---
Changes for v1:
- None (skipped to set single version for consolidated series)
Changes for v2:
- Consolidated patch series

 arch/x86/cpu/start.S |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

Applied to u-boot-x86

Thanks,

Graeme