diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/arch/i386/include/arch/io.h | 12 | ||||
-rw-r--r-- | src/arch/i386/include/arch/romcc_io.h | 54 | ||||
-rw-r--r-- | src/config/Config.lb | 4 | ||||
-rw-r--r-- | src/mainboard/arima/hdama/auto.c | 2 | ||||
-rw-r--r-- | src/mainboard/arima/hdama/failover.c | 4 |
5 files changed, 54 insertions, 22 deletions
diff --git a/src/arch/i386/include/arch/io.h b/src/arch/i386/include/arch/io.h index c1207b3182..411098128f 100644 --- a/src/arch/i386/include/arch/io.h +++ b/src/arch/i386/include/arch/io.h @@ -11,34 +11,34 @@ */ #ifdef __ROMCC__ -static void outb(unsigned char value, unsigned short port) +static inline void outb(uint8_t value, uint16_t port) { __builtin_outb(value, port); } -static void outw(unsigned short value, unsigned short port) +static inline void outw(uint16_t value, uint16_t port) { __builtin_outw(value, port); } -static void outl(unsigned int value, unsigned short port) +static inline void outl(uint32_t value, uint16_t port) { __builtin_outl(value, port); } -static unsigned char inb(unsigned short port) +static inline uint8_t inb(uint16_t port) { return __builtin_inb(port); } -static unsigned char inw(unsigned short port) +static inline uint16_t inw(uint16_t port) { return __builtin_inw(port); } -static unsigned char inl(unsigned short port) +static inline uint32_t inl(uint16_t port) { return __builtin_inl(port); } diff --git a/src/arch/i386/include/arch/romcc_io.h b/src/arch/i386/include/arch/romcc_io.h index c3a0ff76fa..0d5f071428 100644 --- a/src/arch/i386/include/arch/romcc_io.h +++ b/src/arch/i386/include/arch/romcc_io.h @@ -3,34 +3,66 @@ #include <stdint.h> + +static inline uint8_t read8(unsigned long addr) +{ + return *((volatile uint8_t *)(addr)); +} + +static inline uint16_t read16(unsigned long addr) +{ + return *((volatile uint16_t *)(addr)); +} + +static inline uint32_t read32(unsigned long addr) +{ + return *((volatile uint32_t *)(addr)); +} + +static inline void write8(unsigned long addr, uint8_t value) +{ + *((volatile uint8_t *)(addr)) = value; +} + +static inline void write16(unsigned long addr, uint16_t value) +{ + *((volatile uint16_t *)(addr)) = value; +} + +static inline void write32(unsigned long addr, uint32_t value) +{ + *((volatile uint32_t *)(addr)) = value; +} + + typedef __builtin_div_t div_t; typedef __builtin_ldiv_t ldiv_t; typedef __builtin_udiv_t udiv_t; typedef __builtin_uldiv_t uldiv_t; -static div_t div(int numer, int denom) +static inline div_t div(int numer, int denom) { return __builtin_div(numer, denom); } -static ldiv_t ldiv(long numer, long denom) +static inline ldiv_t ldiv(long numer, long denom) { return __builtin_ldiv(numer, denom); } -static udiv_t udiv(unsigned numer, unsigned denom) +static inline udiv_t udiv(unsigned numer, unsigned denom) { return __builtin_udiv(numer, denom); } -static uldiv_t uldiv(unsigned long numer, unsigned long denom) +static inline uldiv_t uldiv(unsigned long numer, unsigned long denom) { return __builtin_uldiv(numer, denom); } -int log2(int value) +inline int log2(int value) { /* __builtin_bsr is a exactly equivalent to the x86 machine * instruction with the exception that it returns -1 @@ -60,7 +92,7 @@ int log2(int value) typedef unsigned device_t; -static unsigned char pci_read_config8(device_t dev, unsigned where) +static inline uint8_t pci_read_config8(device_t dev, unsigned where) { unsigned addr; addr = dev | where; @@ -68,7 +100,7 @@ static unsigned char pci_read_config8(device_t dev, unsigned where) return inb(0xCFC + (addr & 3)); } -static unsigned short pci_read_config16(device_t dev, unsigned where) +static inline uint16_t pci_read_config16(device_t dev, unsigned where) { unsigned addr; addr = dev | where; @@ -76,7 +108,7 @@ static unsigned short pci_read_config16(device_t dev, unsigned where) return inw(0xCFC + (addr & 2)); } -static unsigned int pci_read_config32(device_t dev, unsigned where) +static inline uint32_t pci_read_config32(device_t dev, unsigned where) { unsigned addr; addr = dev | where; @@ -84,7 +116,7 @@ static unsigned int pci_read_config32(device_t dev, unsigned where) return inl(0xCFC); } -static void pci_write_config8(device_t dev, unsigned where, unsigned char value) +static inline void pci_write_config8(device_t dev, unsigned where, uint8_t value) { unsigned addr; addr = dev | where; @@ -92,7 +124,7 @@ static void pci_write_config8(device_t dev, unsigned where, unsigned char value) outb(value, 0xCFC + (addr & 3)); } -static void pci_write_config16(device_t dev, unsigned where, unsigned short value) +static inline void pci_write_config16(device_t dev, unsigned where, uint16_t value) { unsigned addr; addr = dev | where; @@ -100,7 +132,7 @@ static void pci_write_config16(device_t dev, unsigned where, unsigned short valu outw(value, 0xCFC + (addr & 2)); } -static void pci_write_config32(device_t dev, unsigned where, unsigned int value) +static inline void pci_write_config32(device_t dev, unsigned where, uint32_t value) { unsigned addr; addr = dev | where; diff --git a/src/config/Config.lb b/src/config/Config.lb index 636e5537c6..cf2c15527d 100644 --- a/src/config/Config.lb +++ b/src/config/Config.lb @@ -7,7 +7,7 @@ makedefine LIBGCC_FILE_NAME := $(shell $(CC) -print-libgcc-file-name) makedefine GCC_INC_DIR := $(shell $(CC) -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp") makedefine CPPFLAGS := -I$(TOP)/src/include -I$(TOP)/src/arch/$(ARCH)/include -I$(GCC_INC_DIR) $(CPUFLAGS) -makedefine ROMCCPPFLAGS := -D__ROMCC__=0 -D__ROMCC_MINOR__=38 +makedefine ROMCCPPFLAGS := -D__ROMCC__=0 -D__ROMCC_MINOR__=63 makedefine CFLAGS := $(CPU_OPT) $(CPPFLAGS) -Os -nostdinc -nostdlib -fno-builtin -Wall makedefine HOSTCFLAGS:= -Os -Wall @@ -116,7 +116,7 @@ end makerule ./romcc depends "$(TOP)/util/romcc/romcc.c" - action "$(HOSTCC) -g $(HOSTCFLAGS) -DVERSION='\"0.38\"' -DRELEASE_DATE='\"18 December 2003\"' $< -o $@" + action "$(HOSTCC) -g $(HOSTCFLAGS) $< -o $@" end makerule build_opt_tbl diff --git a/src/mainboard/arima/hdama/auto.c b/src/mainboard/arima/hdama/auto.c index 15b030d0e0..fd0f90ba07 100644 --- a/src/mainboard/arima/hdama/auto.c +++ b/src/mainboard/arima/hdama/auto.c @@ -159,7 +159,7 @@ static void main(void) init_timer(); if (cpu_init_detected()) { - asm("jmp __cpu_reset"); + asm volatile ("jmp __cpu_reset"); } distinguish_cpu_resets(); diff --git a/src/mainboard/arima/hdama/failover.c b/src/mainboard/arima/hdama/failover.c index b22abfea06..201bcb9203 100644 --- a/src/mainboard/arima/hdama/failover.c +++ b/src/mainboard/arima/hdama/failover.c @@ -60,13 +60,13 @@ static void main(void) goto fallback_image; } normal_image: - asm("jmp __normal_image" + asm volatile ("jmp __normal_image" : /* outputs */ : "a" (bist) /* inputs */ : /* clobbers */ ); cpu_reset: - asm("jmp __cpu_reset" + asm volatile ("jmp __cpu_reset" : /* outputs */ : "a"(bist) /* inputs */ : /* clobbers */ |