- Added volatile to asm statements in auto.c and failover.c
- Updated the romcc version in Config.lb - Fixed type sizes in romcc_io.h and io.h inl() returning a byte was nasty git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1583 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
parent
9008960339
commit
d67e76568a
|
@ -11,34 +11,34 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef __ROMCC__
|
#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);
|
__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);
|
__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);
|
__builtin_outl(value, port);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static unsigned char inb(unsigned short port)
|
static inline uint8_t inb(uint16_t port)
|
||||||
{
|
{
|
||||||
return __builtin_inb(port);
|
return __builtin_inb(port);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static unsigned char inw(unsigned short port)
|
static inline uint16_t inw(uint16_t port)
|
||||||
{
|
{
|
||||||
return __builtin_inw(port);
|
return __builtin_inw(port);
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned char inl(unsigned short port)
|
static inline uint32_t inl(uint16_t port)
|
||||||
{
|
{
|
||||||
return __builtin_inl(port);
|
return __builtin_inl(port);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,34 +3,66 @@
|
||||||
|
|
||||||
#include <stdint.h>
|
#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_div_t div_t;
|
||||||
typedef __builtin_ldiv_t ldiv_t;
|
typedef __builtin_ldiv_t ldiv_t;
|
||||||
typedef __builtin_udiv_t udiv_t;
|
typedef __builtin_udiv_t udiv_t;
|
||||||
typedef __builtin_uldiv_t uldiv_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);
|
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);
|
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);
|
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);
|
return __builtin_uldiv(numer, denom);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int log2(int value)
|
inline int log2(int value)
|
||||||
{
|
{
|
||||||
/* __builtin_bsr is a exactly equivalent to the x86 machine
|
/* __builtin_bsr is a exactly equivalent to the x86 machine
|
||||||
* instruction with the exception that it returns -1
|
* instruction with the exception that it returns -1
|
||||||
|
@ -60,7 +92,7 @@ int log2(int value)
|
||||||
|
|
||||||
typedef unsigned device_t;
|
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;
|
unsigned addr;
|
||||||
addr = dev | where;
|
addr = dev | where;
|
||||||
|
@ -68,7 +100,7 @@ static unsigned char pci_read_config8(device_t dev, unsigned where)
|
||||||
return inb(0xCFC + (addr & 3));
|
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;
|
unsigned addr;
|
||||||
addr = dev | where;
|
addr = dev | where;
|
||||||
|
@ -76,7 +108,7 @@ static unsigned short pci_read_config16(device_t dev, unsigned where)
|
||||||
return inw(0xCFC + (addr & 2));
|
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;
|
unsigned addr;
|
||||||
addr = dev | where;
|
addr = dev | where;
|
||||||
|
@ -84,7 +116,7 @@ static unsigned int pci_read_config32(device_t dev, unsigned where)
|
||||||
return inl(0xCFC);
|
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;
|
unsigned addr;
|
||||||
addr = dev | where;
|
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));
|
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;
|
unsigned addr;
|
||||||
addr = dev | where;
|
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));
|
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;
|
unsigned addr;
|
||||||
addr = dev | where;
|
addr = dev | where;
|
||||||
|
|
|
@ -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 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 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 CFLAGS := $(CPU_OPT) $(CPPFLAGS) -Os -nostdinc -nostdlib -fno-builtin -Wall
|
||||||
|
|
||||||
makedefine HOSTCFLAGS:= -Os -Wall
|
makedefine HOSTCFLAGS:= -Os -Wall
|
||||||
|
@ -116,7 +116,7 @@ end
|
||||||
|
|
||||||
makerule ./romcc
|
makerule ./romcc
|
||||||
depends "$(TOP)/util/romcc/romcc.c"
|
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
|
end
|
||||||
|
|
||||||
makerule build_opt_tbl
|
makerule build_opt_tbl
|
||||||
|
|
|
@ -159,7 +159,7 @@ static void main(void)
|
||||||
init_timer();
|
init_timer();
|
||||||
|
|
||||||
if (cpu_init_detected()) {
|
if (cpu_init_detected()) {
|
||||||
asm("jmp __cpu_reset");
|
asm volatile ("jmp __cpu_reset");
|
||||||
}
|
}
|
||||||
|
|
||||||
distinguish_cpu_resets();
|
distinguish_cpu_resets();
|
||||||
|
|
|
@ -60,13 +60,13 @@ static void main(void)
|
||||||
goto fallback_image;
|
goto fallback_image;
|
||||||
}
|
}
|
||||||
normal_image:
|
normal_image:
|
||||||
asm("jmp __normal_image"
|
asm volatile ("jmp __normal_image"
|
||||||
: /* outputs */
|
: /* outputs */
|
||||||
: "a" (bist) /* inputs */
|
: "a" (bist) /* inputs */
|
||||||
: /* clobbers */
|
: /* clobbers */
|
||||||
);
|
);
|
||||||
cpu_reset:
|
cpu_reset:
|
||||||
asm("jmp __cpu_reset"
|
asm volatile ("jmp __cpu_reset"
|
||||||
: /* outputs */
|
: /* outputs */
|
||||||
: "a"(bist) /* inputs */
|
: "a"(bist) /* inputs */
|
||||||
: /* clobbers */
|
: /* clobbers */
|
||||||
|
|
Loading…
Reference in New Issue