summaryrefslogtreecommitdiff
path: root/arch/i386/lib
diff options
context:
space:
mode:
authorGraeme Russ <graeme.russ@gmail.com>2011-04-13 19:43:26 +1000
committerGraeme Russ <graeme.russ@gmail.com>2011-04-13 19:43:26 +1000
commitdbf7115a326fa70ac3e4ca87497c7e21c6642b45 (patch)
tree6af884cf4dbe8db63ffb7628487a1b4f7ea9db5e /arch/i386/lib
parente413554f9df28b383eeb8e8e5de35848b15d74aa (diff)
downloadu-boot-imx-dbf7115a326fa70ac3e4ca87497c7e21c6642b45.zip
u-boot-imx-dbf7115a326fa70ac3e4ca87497c7e21c6642b45.tar.gz
u-boot-imx-dbf7115a326fa70ac3e4ca87497c7e21c6642b45.tar.bz2
x86: Code cleanup
Make the copyright notices in the x86 files consistent and update them with proper attributions for recent updates Also fix a few comment style/accuracy and whitespace/blank line issues Signed-off-by: Graeme Russ <graeme.russ@gmail.com>
Diffstat (limited to 'arch/i386/lib')
-rw-r--r--arch/i386/lib/bios.S3
-rw-r--r--arch/i386/lib/bios.h44
-rw-r--r--arch/i386/lib/bios_setup.c3
-rw-r--r--arch/i386/lib/board.c21
-rw-r--r--arch/i386/lib/bootm.c15
-rw-r--r--arch/i386/lib/interrupts.c16
-rw-r--r--arch/i386/lib/pcat_interrupts.c4
-rw-r--r--arch/i386/lib/pcat_timer.c2
-rw-r--r--arch/i386/lib/pci.c18
-rw-r--r--arch/i386/lib/pci_type1.c27
-rw-r--r--arch/i386/lib/realmode.c10
-rw-r--r--arch/i386/lib/realmode_switch.S1
-rw-r--r--arch/i386/lib/timer.c5
-rw-r--r--arch/i386/lib/video.c48
-rw-r--r--arch/i386/lib/video_bios.c2
-rw-r--r--arch/i386/lib/zimage.c4
16 files changed, 110 insertions, 113 deletions
diff --git a/arch/i386/lib/bios.S b/arch/i386/lib/bios.S
index 48f1b81..660a244 100644
--- a/arch/i386/lib/bios.S
+++ b/arch/i386/lib/bios.S
@@ -1,6 +1,6 @@
/*
* (C) Copyright 2002
- * Daniel Engström, Omicron Ceti AB, daniel@omicron.se
+ * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
*
* See file CREDITS for list of people who contributed to this
* project.
@@ -42,7 +42,6 @@
* a general purpose replacement for a real BIOS !!
*/
-
.section .bios, "ax"
.code16
.org 0
diff --git a/arch/i386/lib/bios.h b/arch/i386/lib/bios.h
index 4901f89..3c8d61a 100644
--- a/arch/i386/lib/bios.h
+++ b/arch/i386/lib/bios.h
@@ -1,6 +1,6 @@
/*
* (C) Copyright 2002
- * Daniel Engström, Omicron Ceti AB, daniel@omicron.se
+ * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
*
* See file CREDITS for list of people who contributed to this
* project.
@@ -57,7 +57,7 @@
#define OFFS_FLAGS 44 /* 16bit */
#define SEGMENT 0x40
-#define STACK 0x800 /* stack at 0x40:0x800 -> 0x800 */
+#define STACK 0x800 /* stack at 0x40:0x800 -> 0x800 */
/* save general registers */
/* save some segments */
@@ -67,28 +67,26 @@
/* 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
+ 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
#define RESTORE_CALLERS_STACK \
- pushw %gs ; /* restore callers stack segment */ \
- popw %ss ; \
- movw %bp,%sp ; /* restore stackpointer */ \
- \
- popw %es ; /* restore segment selectors */ \
- popw %gs ; \
- popw %ds ; \
- \
- popal /* restore GP registers */
+ pushw %gs; /* restore callers stack segment */ \
+ popw %ss; \
+ movw %bp, %sp; /* restore stackpointer */ \
+ popw %es; /* restore segment selectors */ \
+ popw %gs; \
+ popw %ds; \
+ popal /* restore GP registers */
#endif
diff --git a/arch/i386/lib/bios_setup.c b/arch/i386/lib/bios_setup.c
index 75407c1..6949b35 100644
--- a/arch/i386/lib/bios_setup.c
+++ b/arch/i386/lib/bios_setup.c
@@ -1,6 +1,6 @@
/*
* (C) Copyright 2002
- * Daniel Engström, Omicron Ceti AB, daniel@omicron.se
+ * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
*
* See file CREDITS for list of people who contributed to this
* project.
@@ -21,7 +21,6 @@
* MA 02111-1307 USA
*/
-
/*
* Partly based on msbios.c from rolo 1.6:
*----------------------------------------------------------------------
diff --git a/arch/i386/lib/board.c b/arch/i386/lib/board.c
index e0f9803..6d947c6 100644
--- a/arch/i386/lib/board.c
+++ b/arch/i386/lib/board.c
@@ -1,9 +1,12 @@
/*
+ * (C) Copyright 2008-2011
+ * Graeme Russ, <graeme.russ@gmail.com>
+ *
* (C) Copyright 2002
- * Daniel Engström, Omicron Ceti AB, daniel@omicron.se
+ * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
*
* (C) Copyright 2002
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ * Wolfgang Denk, DENX Software Engineering, <wd@denx.de>
*
* (C) Copyright 2002
* Sysgo Real-Time Solutions, GmbH <www.elinos.com>
@@ -103,13 +106,6 @@ static int display_banner (void)
return (0);
}
-/*
- * WARNING: this code looks "cleaner" than the PowerPC version, but
- * has the disadvantage that you either get nothing, or everything.
- * On PowerPC, you might see "DRAM: " before the system hangs - which
- * gives a simple yet clear indication which part of the
- * initialization if failing.
- */
static int display_dram_config (void)
{
int i;
@@ -141,7 +137,6 @@ static void display_flash_config (ulong size)
* can relocate the monitor code to RAM.
*/
-
/*
* All attempts to come up with a "common" initialization sequence
* that works for all boards and architectures failed: some of the
@@ -251,13 +246,13 @@ static int do_elf_reloc_fixups(void)
return 0;
}
-/*
- * Load U-Boot into RAM, initialize BSS, perform relocation adjustments
- */
+/* Load U-Boot into RAM, initialize BSS, perform relocation adjustments */
void board_init_f(ulong boot_flags)
{
init_fnc_t **init_fnc_ptr;
+ gd->flags = boot_flags;
+
for (init_fnc_ptr = init_sequence_f; *init_fnc_ptr; ++init_fnc_ptr) {
if ((*init_fnc_ptr)() != 0)
hang();
diff --git a/arch/i386/lib/bootm.c b/arch/i386/lib/bootm.c
index b36e58d..a21a21f 100644
--- a/arch/i386/lib/bootm.c
+++ b/arch/i386/lib/bootm.c
@@ -5,10 +5,13 @@
*
* Copyright (C) 2001 Erik Mouw (J.A.K.Mouw@its.tudelft.nl)
*
- * 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.
+ * 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
@@ -17,8 +20,8 @@
*
* 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
- *
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
*/
#include <common.h>
diff --git a/arch/i386/lib/interrupts.c b/arch/i386/lib/interrupts.c
index 5a28278..a2c598f 100644
--- a/arch/i386/lib/interrupts.c
+++ b/arch/i386/lib/interrupts.c
@@ -1,21 +1,21 @@
/*
* (C) Copyright 2009
- * Graeme Russ, graeme.russ@gmail.com
+ * Graeme Russ, <graeme.russ@gmail.com>
*
* (C) Copyright 2007
- * Daniel Hellstrom, Gaisler Research, daniel@gaisler.com
+ * Daniel Hellstrom, Gaisler Research, <daniel@gaisler.com>
*
* (C) Copyright 2006
- * Detlev Zundel, DENX Software Engineering, dzu@denx.de
+ * Detlev Zundel, DENX Software Engineering, <dzu@denx.de>
*
* (C) Copyright -2003
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ * Wolfgang Denk, DENX Software Engineering, <wd@denx.de>
*
* (C) Copyright 2002
- * Daniel Engström, Omicron Ceti AB, daniel@omicron.se
+ * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
*
* (C) Copyright 2001
- * Josh Huber <huber@mclx.com>, Mission Critical Linux, Inc.
+ * Josh Huber, Mission Critical Linux, Inc, <huber@mclx.com>
*
* See file CREDITS for list of people who contributed to this
* project.
@@ -38,11 +38,11 @@
/*
* This file contains the high-level API for the interrupt sub-system
- * of the i386 port of U-Boot. Most of the functionality has been
+ * of the x86 port of U-Boot. Most of the functionality has been
* shamelessly stolen from the leon2 / leon3 ports of U-Boot.
* Daniel Hellstrom, Detlev Zundel, Wolfgang Denk and Josh Huber are
* credited for the corresponding work on those ports. The original
- * interrupt handling routines for the i386 port were written by
+ * interrupt handling routines for the x86 port were written by
* Daniel Engström
*/
diff --git a/arch/i386/lib/pcat_interrupts.c b/arch/i386/lib/pcat_interrupts.c
index 67e6e97..364c435 100644
--- a/arch/i386/lib/pcat_interrupts.c
+++ b/arch/i386/lib/pcat_interrupts.c
@@ -1,9 +1,9 @@
/*
* (C) Copyright 2009
- * Graeme Russ, graeme.russ@gmail.com
+ * Graeme Russ, <graeme.russ@gmail.com>
*
* (C) Copyright 2002
- * Daniel Engström, Omicron Ceti AB, daniel@omicron.se.
+ * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
*
* See file CREDITS for list of people who contributed to this
* project.
diff --git a/arch/i386/lib/pcat_timer.c b/arch/i386/lib/pcat_timer.c
index 1373fd1..1911c6c 100644
--- a/arch/i386/lib/pcat_timer.c
+++ b/arch/i386/lib/pcat_timer.c
@@ -1,6 +1,6 @@
/*
* (C) Copyright 2002
- * Daniel Engström, Omicron Ceti AB, daniel@omicron.se.
+ * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
*
* See file CREDITS for list of people who contributed to this
* project.
diff --git a/arch/i386/lib/pci.c b/arch/i386/lib/pci.c
index 9020e7c..e791e88 100644
--- a/arch/i386/lib/pci.c
+++ b/arch/i386/lib/pci.c
@@ -1,6 +1,6 @@
/*
* (C) Copyright 2002
- * Daniel Engström, Omicron Ceti AB, daniel@omicron.se
+ * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
*
* See file CREDITS for list of people who contributed to this
* project.
@@ -54,10 +54,9 @@ int pci_shadow_rom(pci_dev_t dev, unsigned char *dest)
class_code &= 0xffffff00;
class_code >>= 8;
-#if 0
- printf("PCI Header Vendor %04x device %04x class %06x\n",
+ debug("PCI Header Vendor %04x device %04x class %06x\n",
vendor, device, class_code);
-#endif
+
/* Enable the rom addess decoder */
pci_write_config_dword(dev, PCI_ROM_ADDRESS, (u32)PCI_ROM_ADDRESS_MASK);
pci_read_config_dword(dev, PCI_ROM_ADDRESS, &addr_reg);
@@ -70,13 +69,12 @@ int pci_shadow_rom(pci_dev_t dev, unsigned char *dest)
size = (~(addr_reg&PCI_ROM_ADDRESS_MASK))+1;
-#if 0
- printf("ROM is %d bytes\n", size);
-#endif
+ debug("ROM is %d bytes\n", size);
+
rom_addr = pci_get_rom_window(hose, size);
-#if 0
- printf("ROM mapped at %x \n", rom_addr);
-#endif
+
+ debug("ROM mapped at %x\n", rom_addr);
+
pci_write_config_dword(dev, PCI_ROM_ADDRESS,
pci_phys_to_mem(dev, rom_addr)
|PCI_ROM_ADDRESS_ENABLE);
diff --git a/arch/i386/lib/pci_type1.c b/arch/i386/lib/pci_type1.c
index 225ae4a..8ce5b33 100644
--- a/arch/i386/lib/pci_type1.c
+++ b/arch/i386/lib/pci_type1.c
@@ -1,15 +1,30 @@
/*
- * Support for type PCI configuration cycles.
- * based on pci_indirect.c
+ * (C) Copyright 2002
+ * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
*
- * Copyright (C) 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.
+ * 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
*/
+/*
+ * Support for type PCI configuration cycles.
+ * based on pci_indirect.c
+ */
#include <common.h>
#include <asm/io.h>
#include <pci.h>
diff --git a/arch/i386/lib/realmode.c b/arch/i386/lib/realmode.c
index 2dda95b..5be827c 100644
--- a/arch/i386/lib/realmode.c
+++ b/arch/i386/lib/realmode.c
@@ -1,6 +1,6 @@
/*
* (C) Copyright 2002
- * Daniel Engström, Omicron Ceti AB, daniel@omicron.se
+ * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
*
* See file CREDITS for list of people who contributed to this
* project.
@@ -26,10 +26,8 @@
#include <asm/ptrace.h>
#include <asm/realmode.h>
-
#define REALMODE_MAILBOX ((char*)0xe00)
-
extern ulong __realmode_start;
extern ulong __realmode_size;
extern char realmode_enter;
@@ -57,13 +55,11 @@ int enter_realmode(u16 seg, u16 off, struct pt_regs *in, struct pt_regs *out)
{
/* setup out thin bios emulation */
- if (bios_setup()) {
+ if (bios_setup())
return -1;
- }
- if (realmode_setup()) {
+ if (realmode_setup())
return -1;
- }
in->eip = off;
in->xcs = seg;
diff --git a/arch/i386/lib/realmode_switch.S b/arch/i386/lib/realmode_switch.S
index d6c74ec..fce4ecc 100644
--- a/arch/i386/lib/realmode_switch.S
+++ b/arch/i386/lib/realmode_switch.S
@@ -21,7 +21,6 @@
* MA 02111-1307 USA
*/
-
/* 32bit -> 16bit -> 32bit mode switch code */
/*
diff --git a/arch/i386/lib/timer.c b/arch/i386/lib/timer.c
index 5cb1f54..8fc68cd 100644
--- a/arch/i386/lib/timer.c
+++ b/arch/i386/lib/timer.c
@@ -1,6 +1,9 @@
/*
+ * (C) Copyright 2008,2009
+ * Graeme Russ, <graeme.russ@gmail.com>
+ *
* (C) Copyright 2002
- * Daniel Engström, Omicron Ceti AB, daniel@omicron.se.
+ * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
*
* See file CREDITS for list of people who contributed to this
* project.
diff --git a/arch/i386/lib/video.c b/arch/i386/lib/video.c
index c58ed10..b29075c 100644
--- a/arch/i386/lib/video.c
+++ b/arch/i386/lib/video.c
@@ -1,6 +1,6 @@
/*
* (C) Copyright 2002
- * Daniel Engström, Omicron Ceti AB, daniel@omicron.se
+ * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
*
* See file CREDITS for list of people who contributed to this
* project.
@@ -30,7 +30,6 @@
#include <asm/io.h>
#include <asm/pci.h>
-
/* basic textmode I/O from linux kernel */
static char *vidmem = (char *)0xb8000;
static int vidport;
@@ -42,9 +41,9 @@ static void beep(int dur)
int i;
outb_p(3, 0x61);
- for (i=0;i<10*dur;i++) {
+ for (i = 0; i < 10*dur; i++)
udelay(1000);
- }
+
outb_p(0, 0x61);
}
@@ -52,8 +51,8 @@ static void scroll(void)
{
int i;
- memcpy ( vidmem, vidmem + cols * 2, ( lines - 1 ) * cols * 2 );
- for ( i = ( lines - 1 ) * cols * 2; i < lines * cols * 2; i += 2 )
+ memcpy(vidmem, vidmem + cols * 2, (lines - 1) * cols * 2);
+ for (i = (lines - 1) * cols * 2; i < lines * cols * 2; i += 2)
vidmem[i] = ' ';
}
@@ -61,14 +60,14 @@ static void __video_putc(const char c, int *x, int *y)
{
if (c == '\n') {
(*x) = 0;
- if ( ++(*y) >= lines ) {
+ if (++(*y) >= lines) {
scroll();
(*y)--;
}
} else if (c == '\b') {
if ((*x) != 0) {
--(*x);
- vidmem [ ( (*x) + cols * (*y) ) * 2 ] = ' ';
+ vidmem[((*x) + cols * (*y)) * 2] = ' ';
}
} else if (c == '\r') {
(*x) = 0;
@@ -106,16 +105,15 @@ static void __video_putc(const char c, int *x, int *y)
}
} else if (c == '\f') {
int i;
- for (i=0;i<lines*cols*2;i+=2) {
+ for (i = 0; i < lines * cols * 2; i += 2)
vidmem[i] = 0;
- }
(*x) = 0;
(*y) = 0;
} else {
- vidmem [ ( (*x) + cols * (*y) ) * 2 ] = c;
- if ( ++(*x) >= cols ) {
+ vidmem[((*x) + cols * (*y)) * 2] = c;
+ if (++(*x) >= cols) {
(*x) = 0;
- if ( ++(*y) >= lines ) {
+ if (++(*y) >= lines) {
scroll();
(*y)--;
}
@@ -150,9 +148,8 @@ static void video_puts(const char *s)
x = orig_x;
y = orig_y;
- while ( ( c = *s++ ) != '\0' ) {
+ while ((c = *s++) != '\0')
__video_putc(c, &x, &y);
- }
orig_x = x;
orig_y = y;
@@ -189,10 +186,8 @@ int video_init(void)
#if 0
printf("pos %x %d %d\n", pos, orig_x, orig_y);
#endif
- if (orig_y > lines) {
+ if (orig_y > lines)
orig_x = orig_y =0;
- }
-
memset(&vga_dev, 0, sizeof(vga_dev));
strcpy(vga_dev.name, "vga");
@@ -203,13 +198,11 @@ int video_init(void)
vga_dev.tstc = NULL; /* 'tstc' function */
vga_dev.getc = NULL; /* 'getc' function */
- if (stdio_register(&vga_dev) == 0) {
- return 1;
- }
+ if (stdio_register(&vga_dev) == 0)
+ return 1;
- if (i8042_kbd_init()) {
+ if (i8042_kbd_init())
return 1;
- }
memset(&kbd_dev, 0, sizeof(kbd_dev));
strcpy(kbd_dev.name, "kbd");
@@ -220,18 +213,17 @@ int video_init(void)
kbd_dev.tstc = i8042_tstc; /* 'tstc' function */
kbd_dev.getc = i8042_getc; /* 'getc' function */
- if (stdio_register(&kbd_dev) == 0) {
- return 1;
- }
+ if (stdio_register(&kbd_dev) == 0)
+ return 1;
+
return 0;
}
int drv_video_init(void)
{
- if (video_bios_init()) {
+ if (video_bios_init())
return 1;
- }
return video_init();
}
diff --git a/arch/i386/lib/video_bios.c b/arch/i386/lib/video_bios.c
index c8060e6..6bc4335 100644
--- a/arch/i386/lib/video_bios.c
+++ b/arch/i386/lib/video_bios.c
@@ -1,6 +1,6 @@
/*
* (C) Copyright 2002
- * Daniel Engström, Omicron Ceti AB, daniel@omicron.se
+ * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
*
* See file CREDITS for list of people who contributed to this
* project.
diff --git a/arch/i386/lib/zimage.c b/arch/i386/lib/zimage.c
index 0c42072..cc4b40e 100644
--- a/arch/i386/lib/zimage.c
+++ b/arch/i386/lib/zimage.c
@@ -1,6 +1,6 @@
/*
* (C) Copyright 2002
- * Daniel Engström, Omicron Ceti AB, daniel@omicron.se
+ * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
*
* See file CREDITS for list of people who contributed to this
* project.
@@ -22,7 +22,7 @@
*/
/*
- * Linux i386 zImage and bzImage loading
+ * Linux x86 zImage and bzImage loading
*
* based on the procdure described in
* linux/Documentation/i386/boot.txt