summaryrefslogtreecommitdiff
path: root/src/arch
diff options
context:
space:
mode:
authorStefan Reinauer <stepan@openbios.org>2005-12-02 21:52:30 +0000
committerStefan Reinauer <stepan@openbios.org>2005-12-02 21:52:30 +0000
commit7ce8c54e2ba89059d28790550a8f74907b54b916 (patch)
treee89df947fbe9e3f85d6082af6926038e9fe8e61a /src/arch
parentc2455dc0ce210b3da2b14be8885803ff47a781eb (diff)
1201_ht_bus0_dev0_fidvid_core.diff
https://openbios.org/roundup/linuxbios/issue41 Lord have mercy upon us. git-svn-id: svn://svn.coreboot.org/coreboot/trunk@2118 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/i386/Config.lb22
-rw-r--r--src/arch/i386/include/arch/hlt.h2
-rw-r--r--src/arch/i386/include/arch/romcc_io.h32
-rw-r--r--src/arch/i386/include/arch/smp/atomic.h4
-rw-r--r--src/arch/i386/include/arch/smp/spinlock.h6
-rw-r--r--src/arch/i386/lib/c_start.S6
-rw-r--r--src/arch/i386/lib/console.c57
7 files changed, 41 insertions, 88 deletions
diff --git a/src/arch/i386/Config.lb b/src/arch/i386/Config.lb
index e9b426cc2d..ebb014f525 100644
--- a/src/arch/i386/Config.lb
+++ b/src/arch/i386/Config.lb
@@ -31,17 +31,17 @@ end
addaction clean "rm -f romimage payload.*"
if CONFIG_USE_INIT
-makerule init.o
- depends "$(INIT-OBJECTS)"
- action "$(LD) -melf_i386 -r -o init.pre.o $(INIT-OBJECTS)"
- action "$(OBJCOPY) --rename-section .text=.init.text --rename-section .data=.init.data --rename-section .rodata=.init.rodata --rename-section .rodata.str1.1=.init.rodata.str1.1 init.pre.o init.o"
-end
-
-makerule linuxbios
- depends "crt0.o init.o linuxbios_ram.rom ldscript.ld"
- action "$(CC) -nostdlib -nostartfiles -static -o $@ -T ldscript.ld crt0.o init.o"
- action "$(CROSS_COMPILE)nm -n linuxbios | sort > linuxbios.map"
-end
+ makerule init.o
+ depends "$(INIT-OBJECTS)"
+ action "$(LD) -melf_i386 -r -o init.pre.o $(INIT-OBJECTS)"
+ action "$(OBJCOPY) --rename-section .text=.init.text --rename-section .data=.init.data --rename-section .rodata=.init.rodata --rename-section .rodata.str1.1=.init.rodata.str1.1 init.pre.o init.o"
+ end
+
+ makerule linuxbios
+ depends "crt0.o init.o linuxbios_ram.rom ldscript.ld"
+ action "$(CC) -nostdlib -nostartfiles -static -o $@ -T ldscript.ld crt0.o init.o"
+ action "$(CROSS_COMPILE)nm -n linuxbios | sort > linuxbios.map"
+ end
end
diff --git a/src/arch/i386/include/arch/hlt.h b/src/arch/i386/include/arch/hlt.h
index 23ff1aa918..3b2acf1eef 100644
--- a/src/arch/i386/include/arch/hlt.h
+++ b/src/arch/i386/include/arch/hlt.h
@@ -7,7 +7,7 @@ static void hlt(void)
__builtin_hlt();
}
#else
-static inline void hlt(void)
+static inline __attribute__((always_inline)) void hlt(void)
{
asm("hlt");
}
diff --git a/src/arch/i386/include/arch/romcc_io.h b/src/arch/i386/include/arch/romcc_io.h
index 1d3e603ed0..c0c2250f98 100644
--- a/src/arch/i386/include/arch/romcc_io.h
+++ b/src/arch/i386/include/arch/romcc_io.h
@@ -117,7 +117,7 @@ static inline int log2f(int value)
typedef unsigned device_t;
-static inline uint8_t pci_read_config8(device_t dev, unsigned where)
+static inline __attribute__((always_inline)) uint8_t pci_read_config8(device_t dev, unsigned where)
{
unsigned addr;
addr = dev | where;
@@ -125,7 +125,7 @@ static inline uint8_t pci_read_config8(device_t dev, unsigned where)
return inb(0xCFC + (addr & 3));
}
-static inline uint16_t pci_read_config16(device_t dev, unsigned where)
+static inline __attribute__((always_inline)) uint16_t pci_read_config16(device_t dev, unsigned where)
{
unsigned addr;
addr = dev | where;
@@ -133,7 +133,7 @@ static inline uint16_t pci_read_config16(device_t dev, unsigned where)
return inw(0xCFC + (addr & 2));
}
-static inline uint32_t pci_read_config32(device_t dev, unsigned where)
+static inline __attribute__((always_inline)) uint32_t pci_read_config32(device_t dev, unsigned where)
{
unsigned addr;
addr = dev | where;
@@ -141,7 +141,7 @@ static inline uint32_t pci_read_config32(device_t dev, unsigned where)
return inl(0xCFC);
}
-static inline void pci_write_config8(device_t dev, unsigned where, uint8_t value)
+static inline __attribute__((always_inline)) void pci_write_config8(device_t dev, unsigned where, uint8_t value)
{
unsigned addr;
addr = dev | where;
@@ -149,7 +149,7 @@ static inline void pci_write_config8(device_t dev, unsigned where, uint8_t value
outb(value, 0xCFC + (addr & 3));
}
-static inline void pci_write_config16(device_t dev, unsigned where, uint16_t value)
+static inline __attribute__((always_inline)) void pci_write_config16(device_t dev, unsigned where, uint16_t value)
{
unsigned addr;
addr = dev | where;
@@ -157,7 +157,7 @@ static inline void pci_write_config16(device_t dev, unsigned where, uint16_t val
outw(value, 0xCFC + (addr & 2));
}
-static inline void pci_write_config32(device_t dev, unsigned where, uint32_t value)
+static inline __attribute__((always_inline)) void pci_write_config32(device_t dev, unsigned where, uint32_t value)
{
unsigned addr;
addr = dev | where;
@@ -180,53 +180,53 @@ static device_t pci_locate_device(unsigned pci_id, device_t dev)
/* Generic functions for pnp devices */
-static inline void pnp_write_config(device_t dev, uint8_t reg, uint8_t value)
+static inline __attribute__((always_inline)) void pnp_write_config(device_t dev, uint8_t reg, uint8_t value)
{
unsigned port = dev >> 8;
outb(reg, port );
outb(value, port +1);
}
-static inline uint8_t pnp_read_config(device_t dev, uint8_t reg)
+static inline __attribute__((always_inline)) uint8_t pnp_read_config(device_t dev, uint8_t reg)
{
unsigned port = dev >> 8;
outb(reg, port);
return inb(port +1);
}
-static inline void pnp_set_logical_device(device_t dev)
+static inline __attribute__((always_inline)) void pnp_set_logical_device(device_t dev)
{
unsigned device = dev & 0xff;
pnp_write_config(dev, 0x07, device);
}
-static inline void pnp_set_enable(device_t dev, int enable)
+static inline __attribute__((always_inline)) void pnp_set_enable(device_t dev, int enable)
{
pnp_write_config(dev, 0x30, enable?0x1:0x0);
}
-static inline int pnp_read_enable(device_t dev)
+static inline __attribute__((always_inline)) int pnp_read_enable(device_t dev)
{
return !!pnp_read_config(dev, 0x30);
}
-static inline void pnp_set_iobase(device_t dev, unsigned index, unsigned iobase)
+static inline __attribute__((always_inline)) void pnp_set_iobase(device_t dev, unsigned index, unsigned iobase)
{
pnp_write_config(dev, index + 0, (iobase >> 8) & 0xff);
pnp_write_config(dev, index + 1, iobase & 0xff);
}
-static inline uint16_t pnp_read_iobase(device_t dev, unsigned index)
+static inline __attribute__((always_inline)) uint16_t pnp_read_iobase(device_t dev, unsigned index)
{
- return (uint16_t)((pnp_read_config(dev, index) << 8) | pnp_read_config(dev, index + 1));
+ return ((uint16_t)(pnp_read_config(dev, index)) << 8) | pnp_read_config(dev, index + 1);
}
-static inline void pnp_set_irq(device_t dev, unsigned index, unsigned irq)
+static inline __attribute__((always_inline)) void pnp_set_irq(device_t dev, unsigned index, unsigned irq)
{
pnp_write_config(dev, index, irq);
}
-static inline void pnp_set_drq(device_t dev, unsigned index, unsigned drq)
+static inline __attribute__((always_inline)) void pnp_set_drq(device_t dev, unsigned index, unsigned drq)
{
pnp_write_config(dev, index, drq & 0xff);
}
diff --git a/src/arch/i386/include/arch/smp/atomic.h b/src/arch/i386/include/arch/smp/atomic.h
index 7b68377c22..7061461d33 100644
--- a/src/arch/i386/include/arch/smp/atomic.h
+++ b/src/arch/i386/include/arch/smp/atomic.h
@@ -41,7 +41,7 @@ typedef struct { volatile int counter; } atomic_t;
* Atomically increments @v by 1. Note that the guaranteed
* useful range of an atomic_t is only 24 bits.
*/
-static __inline__ void atomic_inc(atomic_t *v)
+static __inline__ __attribute__((always_inline)) void atomic_inc(atomic_t *v)
{
__asm__ __volatile__(
"lock ; incl %0"
@@ -56,7 +56,7 @@ static __inline__ void atomic_inc(atomic_t *v)
* Atomically decrements @v by 1. Note that the guaranteed
* useful range of an atomic_t is only 24 bits.
*/
-static __inline__ void atomic_dec(atomic_t *v)
+static __inline__ __attribute__((always_inline)) void atomic_dec(atomic_t *v)
{
__asm__ __volatile__(
"lock ; decl %0"
diff --git a/src/arch/i386/include/arch/smp/spinlock.h b/src/arch/i386/include/arch/smp/spinlock.h
index 65ad8d0673..71015452e8 100644
--- a/src/arch/i386/include/arch/smp/spinlock.h
+++ b/src/arch/i386/include/arch/smp/spinlock.h
@@ -40,14 +40,14 @@ typedef struct {
#define spin_unlock_string \
"movb $1,%0"
-static inline void spin_lock(spinlock_t *lock)
+static inline __attribute__((always_inline)) void spin_lock(spinlock_t *lock)
{
__asm__ __volatile__(
spin_lock_string
:"=m" (lock->lock) : : "memory");
}
-static inline void spin_unlock(spinlock_t *lock)
+static inline __attribute__((always_inline)) void spin_unlock(spinlock_t *lock)
{
__asm__ __volatile__(
spin_unlock_string
@@ -55,7 +55,7 @@ static inline void spin_unlock(spinlock_t *lock)
}
/* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */
-static inline void cpu_relax(void)
+static inline __attribute__((always_inline)) void cpu_relax(void)
{
__asm__ __volatile__("rep;nop": : :"memory");
}
diff --git a/src/arch/i386/lib/c_start.S b/src/arch/i386/lib/c_start.S
index ce13d150d7..04b5a68676 100644
--- a/src/arch/i386/lib/c_start.S
+++ b/src/arch/i386/lib/c_start.S
@@ -22,18 +22,20 @@ _start:
leal _stack, %edi
movl $_estack, %ecx
subl %edi, %ecx
+ shrl $2, %ecx /* it is 32 bit align, right? */
xorl %eax, %eax
rep
- stosb
+ stosl
/** clear bss */
leal _bss, %edi
movl $_ebss, %ecx
subl %edi, %ecx
jz .Lnobss
+ shrl $2, %ecx /* it is 32 bit align, right? */
xorl %eax, %eax
rep
- stosb
+ stosl
.Lnobss:
/* set new stack */
diff --git a/src/arch/i386/lib/console.c b/src/arch/i386/lib/console.c
index fd1b5d759e..a1f5d6f2a4 100644
--- a/src/arch/i386/lib/console.c
+++ b/src/arch/i386/lib/console.c
@@ -120,58 +120,8 @@ static void print_spew_hex16(unsigned short value){ __console_tx_hex16(BIOS_SPEW
static void print_spew_hex32(unsigned int value) { __console_tx_hex32(BIOS_SPEW, value); }
static void print_spew(const char *str) { __console_tx_string(BIOS_SPEW, str); }
-/* Non inline versions.... */
-#if 0
-static void print_alert_char_(unsigned char value) NOINLINE { print_alert_char(value); }
-static void print_alert_hex8_(unsigned char value) NOINLINE { print_alert_hex8(value); }
-static void print_alert_hex16_(unsigned short value) NOINLINE { print_alert_hex16(value); }
-static void print_alert_hex32_(unsigned int value) NOINLINE { print_alert_hex32(value); }
-static void print_alert_(const char *str) NOINLINE { print_alert(str); }
-
-static void print_crit_char_(unsigned char value) NOINLINE { print_crit_char(value); }
-static void print_crit_hex8_(unsigned char value) NOINLINE { print_crit_hex8(value); }
-static void print_crit_hex16_(unsigned short value) NOINLINE { print_crit_hex16(value); }
-static void print_crit_hex32_(unsigned int value) NOINLINE { print_crit_hex32(value); }
-static void print_crit_(const char *str) NOINLINE { print_crit(str); }
-
-static void print_err_char_(unsigned char value) NOINLINE { print_err_char(value); }
-static void print_err_hex8_(unsigned char value) NOINLINE { print_err_hex8(value); }
-static void print_err_hex16_(unsigned short value) NOINLINE { print_err_hex16(value); }
-static void print_err_hex32_(unsigned int value) NOINLINE { print_err_hex32(value); }
-static void print_err_(const char *str) NOINLINE { print_err(str); }
-
-static void print_warning_char_(unsigned char value) NOINLINE { print_warning_char(value); }
-static void print_warning_hex8_(unsigned char value) NOINLINE { print_warning_hex8(value); }
-static void print_warning_hex16_(unsigned short value) NOINLINE { print_warning_hex16(value); }
-static void print_warning_hex32_(unsigned int value) NOINLINE { print_warning_hex32(value); }
-static void print_warning_(const char *str) NOINLINE { print_warning(str); }
-
-static void print_notice_char_(unsigned char value) NOINLINE { print_notice_char(value); }
-static void print_notice_hex8_(unsigned char value) NOINLINE { print_notice_hex8(value); }
-static void print_notice_hex16_(unsigned short value) NOINLINE { print_notice_hex16(value); }
-static void print_notice_hex32_(unsigned int value) NOINLINE { print_notice_hex32(value); }
-static void print_notice_(const char *str) NOINLINE { print_notice(str); }
-
-static void print_info_char_(unsigned char value) NOINLINE { print_info_char(value); }
-static void print_info_hex8_(unsigned char value) NOINLINE { print_info_hex8(value); }
-static void print_info_hex16_(unsigned short value) NOINLINE { print_info_hex16(value); }
-static void print_info_hex32_(unsigned int value) NOINLINE { print_info_hex32(value); }
-static void print_info_(const char *str) NOINLINE { print_info(str); }
-
-static void print_debug_char_(unsigned char value) NOINLINE { print_debug_char(value); }
-static void print_debug_hex8_(unsigned char value) NOINLINE { print_debug_hex8(value); }
-static void print_debug_hex16_(unsigned short value) NOINLINE { print_debug_hex16(value); }
-static void print_debug_hex32_(unsigned int value) NOINLINE { print_debug_hex32(value); }
-static void print_debug_(const char *str) NOINLINE { print_debug(str); }
-
-static void print_spew_char_(unsigned char value) NOINLINE { print_spew_char(value); }
-static void print_spew_hex8_(unsigned char value) NOINLINE { print_spew_hex8(value); }
-static void print_spew_hex16_(unsigned short value) NOINLINE { print_spew_hex16(value); }
-static void print_spew_hex32_(unsigned int value) NOINLINE { print_spew_hex32(value); }
-static void print_spew_(const char *str) NOINLINE { print_spew(str); }
-#endif
-
-#else
+#else
+/* CONFIG_USE_INIT == 1 */
extern int do_printk(int msg_level, const char *fmt, ...);
@@ -273,12 +223,13 @@ extern int do_printk(int msg_level, const char *fmt, ...);
#define print_spew_hex32(HEX) printk_spew ("%08x", (HEX))
-#endif /* CONFIG_USE_INIT == 0 */
+#endif /* CONFIG_USE_INIT */
#ifndef LINUXBIOS_EXTRA_VERSION
#define LINUXBIOS_EXTRA_VERSION ""
#endif
+
static void console_init(void)
{
static const char console_test[] =