diff options
author | Eric Biederman <ebiederm@xmission.com> | 2003-05-19 19:16:21 +0000 |
---|---|---|
committer | Eric Biederman <ebiederm@xmission.com> | 2003-05-19 19:16:21 +0000 |
commit | 526855741b6abb970024366316b941fb6b3d2cb6 (patch) | |
tree | 7da1560ec08c513a23b23704cae3637925e5bd68 /src/arch/i386/include | |
parent | 49cf5967ce31af37e61d59a00939f50bc4256761 (diff) | |
download | coreboot-526855741b6abb970024366316b941fb6b3d2cb6.tar.xz |
- Cleanups on the romcc side including a pci interface that uses
fewer registers, and is easier to hardcode.
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@838 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'src/arch/i386/include')
-rw-r--r-- | src/arch/i386/include/arch/romcc_io.h | 56 | ||||
-rw-r--r-- | src/arch/i386/include/stdint.h | 19 |
2 files changed, 50 insertions, 25 deletions
diff --git a/src/arch/i386/include/arch/romcc_io.h b/src/arch/i386/include/arch/romcc_io.h index 02cc272884..66e6dc07cd 100644 --- a/src/arch/i386/include/arch/romcc_io.h +++ b/src/arch/i386/include/arch/romcc_io.h @@ -35,50 +35,56 @@ static void hlt(void) __builtin_hlt(); } -static unsigned int config_cmd(unsigned char bus, unsigned devfn, unsigned where) +typedef __builtin_msr_t msr_t; + +static msr_t rdmsr(unsigned long index) { - return 0x80000000 | (bus << 16) | (devfn << 8) | (where & ~3); + return __builtin_rdmsr(index); } -static unsigned char pcibios_read_config_byte( - unsigned char bus, unsigned devfn, unsigned where) +static void wrmsr(unsigned long index, msr_t msr) { - outl(config_cmd(bus, devfn, where), 0xCF8); - return inb(0xCFC + (where & 3)); + __builtin_wrmsr(index, msr.lo, msr.hi); } -static unsigned short pcibios_read_config_word( - unsigned char bus, unsigned devfn, unsigned where) +#define PCI_ADDR(BUS, DEV, FN, WHERE) ( \ + (((BUS) & 0xFF) << 16) | \ + (((DEV) & 0x1f) << 11) | \ + (((FN) & 0x07) << 8) | \ + ((WHERE) & 0xFF)) + +static unsigned char pci_read_config8(unsigned addr) { - outl(config_cmd(bus, devfn, where), 0xCF8); - return inw(0xCFC + (where & 2)); + outl(0x80000000 | (addr & ~3), 0xCF8); + return inb(0xCFC + (addr & 3)); } -static unsigned int pcibios_read_config_dword( - unsigned char bus, unsigned devfn, unsigned where) +static unsigned short pci_read_config16(unsigned addr) { - outl(config_cmd(bus, devfn, where), 0xCF8); - return inl(0xCFC); + outl(0x80000000 | (addr & ~3), 0xCF8); + return inw(0xCFC + (addr & 2)); } +static unsigned int pci_read_config32(unsigned addr) +{ + outl(0x80000000 | (addr & ~3), 0xCF8); + return inl(0xCFC); +} -static void pcibios_write_config_byte( - unsigned char bus, unsigned devfn, unsigned where, unsigned char value) +static void pci_write_config8(unsigned addr, unsigned char value) { - outl(config_cmd(bus, devfn, where), 0xCF8); - outb(value, 0xCFC + (where & 3)); + outl(0x80000000 | (addr & ~3), 0xCF8); + outb(value, 0xCFC + (addr & 3)); } -static void pcibios_write_config_word( - unsigned char bus, unsigned devfn, unsigned where, unsigned short value) +static void pci_write_config16(unsigned addr, unsigned short value) { - outl(config_cmd(bus, devfn, where), 0xCF8); - outw(value, 0xCFC + (where & 2)); + outl(0x80000000 | (addr & ~3), 0xCF8); + outw(value, 0xCFC + (addr & 2)); } -static void pcibios_write_config_dword( - unsigned char bus, unsigned devfn, unsigned where, unsigned int value) +static void pci_write_config32(unsigned addr, unsigned int value) { - outl(config_cmd(bus, devfn, where), 0xCF8); + outl(0x80000000 | (addr & ~3), 0xCF8); outl(value, 0xCFC); } diff --git a/src/arch/i386/include/stdint.h b/src/arch/i386/include/stdint.h index 58d7519cde..0fc4346317 100644 --- a/src/arch/i386/include/stdint.h +++ b/src/arch/i386/include/stdint.h @@ -1,6 +1,12 @@ #ifndef I386_STDINT_H #define I386_STDINT_H +#if defined(__GNUC__) +#define __HAVE_LONG_LONG__ 1 +#else +#define __HAVE_LONG_LONG__ 0 +#endif + /* Exact integral types */ typedef unsigned char uint8_t; typedef signed char int8_t; @@ -11,8 +17,10 @@ typedef signed short int16_t; typedef unsigned int uint32_t; typedef signed int int32_t; +#if __HAVE_LONG_LONG__ typedef unsigned long long uint64_t; typedef signed long long int64_t; +#endif /* Small types */ typedef unsigned char uint_least8_t; @@ -24,8 +32,10 @@ typedef signed short int_least16_t; typedef unsigned int uint_least32_t; typedef signed int int_least32_t; +#if __HAVE_LONG_LONG__ typedef unsigned long long uint_least64_t; typedef signed long long int_least64_t; +#endif /* Fast Types */ typedef unsigned char uint_fast8_t; @@ -37,16 +47,25 @@ typedef signed int int_fast16_t; typedef unsigned int uint_fast32_t; typedef signed int int_fast32_t; +#if __HAVE_LONG_LONG__ typedef unsigned long long uint_fast64_t; typedef signed long long int_fast64_t; +#endif /* Types for `void *' pointers. */ typedef int intptr_t; typedef unsigned int uintptr_t; /* Largest integral types */ +#if __HAVE_LONG_LONG__ typedef long long int intmax_t; typedef unsigned long long uintmax_t; +#else +typedef long int intmax_t; +typedef unsigned long int uintmax_t; +#endif + +#undef __HAVE_LONG_LONG__ #endif /* I386_STDINT_H */ |