diff options
| author | Michael Brown | 2005-03-08 19:53:11 +0100 |
|---|---|---|
| committer | Michael Brown | 2005-03-08 19:53:11 +0100 |
| commit | 3d6123e69ab879c72ff489afc5bf93ef0b7a94ce (patch) | |
| tree | 9f3277569153a550fa8d81ebd61bd88f266eb8da /src/arch/ia64/include | |
| download | ipxe-3d6123e69ab879c72ff489afc5bf93ef0b7a94ce.tar.gz ipxe-3d6123e69ab879c72ff489afc5bf93ef0b7a94ce.tar.xz ipxe-3d6123e69ab879c72ff489afc5bf93ef0b7a94ce.zip | |
Initial revision
Diffstat (limited to 'src/arch/ia64/include')
| -rw-r--r-- | src/arch/ia64/include/bits/byteswap.h | 36 | ||||
| -rw-r--r-- | src/arch/ia64/include/bits/cpu.h | 6 | ||||
| -rw-r--r-- | src/arch/ia64/include/bits/elf.h | 11 | ||||
| -rw-r--r-- | src/arch/ia64/include/bits/endian.h | 6 | ||||
| -rw-r--r-- | src/arch/ia64/include/bits/string.h | 6 | ||||
| -rw-r--r-- | src/arch/ia64/include/hooks.h | 12 | ||||
| -rw-r--r-- | src/arch/ia64/include/io.h | 228 | ||||
| -rw-r--r-- | src/arch/ia64/include/latch.h | 11 | ||||
| -rw-r--r-- | src/arch/ia64/include/limits.h | 57 | ||||
| -rw-r--r-- | src/arch/ia64/include/pal.h | 11 | ||||
| -rw-r--r-- | src/arch/ia64/include/sal.h | 29 | ||||
| -rw-r--r-- | src/arch/ia64/include/setjmp.h | 13 | ||||
| -rw-r--r-- | src/arch/ia64/include/stdint.h | 16 |
13 files changed, 442 insertions, 0 deletions
diff --git a/src/arch/ia64/include/bits/byteswap.h b/src/arch/ia64/include/bits/byteswap.h new file mode 100644 index 000000000..a8a115850 --- /dev/null +++ b/src/arch/ia64/include/bits/byteswap.h @@ -0,0 +1,36 @@ +#ifndef ETHERBOOT_BITS_BYTESWAP_H +#define ETHERBOOT_BITS_BYTESWAP_H + +static inline uint64_t __ia64_bswap_64(uint64_t x) +{ + uint64_t result; + __asm__ volatile( + "mux1 %0=%1,@rev" : + "=r" (result) + : "r" (x)); + return result; +} + +#define __bswap_constant_16(x) \ + ((uint16_t)((((uint16_t)(x) & 0x00ff) << 8) | \ + (((uint16_t)(x) & 0xff00) >> 8))) + +#define __bswap_constant_32(x) \ + ((uint32_t)((((uint32_t)(x) & 0x000000ffU) << 24) | \ + (((uint32_t)(x) & 0x0000ff00U) << 8) | \ + (((uint32_t)(x) & 0x00ff0000U) >> 8) | \ + (((uint32_t)(x) & 0xff000000U) >> 24))) + +#define __bswap_16(x) \ + (__builtin_constant_p(x) ? \ + __bswap_constant_16(x) : \ + (__ia64_bswap_64(x) >> 48)) + + +#define __bswap_32(x) \ + (__builtin_constant_p(x) ? \ + __bswap_constant_32(x) : \ + (__ia64_bswap_64(x) >> 32)) + + +#endif /* ETHERBOOT_BITS_BYTESWAP_H */ diff --git a/src/arch/ia64/include/bits/cpu.h b/src/arch/ia64/include/bits/cpu.h new file mode 100644 index 000000000..d8fe1cbbe --- /dev/null +++ b/src/arch/ia64/include/bits/cpu.h @@ -0,0 +1,6 @@ +#ifndef IA64_BITS_CPU_H +#define IA64_BITS_CPU_H + +#define cpu_setup() do {} while(0) + +#endif /* IA64_BITS_CPU_H */ diff --git a/src/arch/ia64/include/bits/elf.h b/src/arch/ia64/include/bits/elf.h new file mode 100644 index 000000000..c68f8456f --- /dev/null +++ b/src/arch/ia64/include/bits/elf.h @@ -0,0 +1,11 @@ +#ifndef IA64_BITS_ELF_H +#define IA64_BITS_ELF_H + +/* ELF Defines for the current architecture */ +#define EM_CURRENT EM_IA_64 +#define ELFDATA_CURRENT ELFDATA2LSB + +#define ELF_CHECK_ARCH(x) \ + ((x).e_machine == EM_CURRENT) + +#endif /* IA64_BITS_ELF_H */ diff --git a/src/arch/ia64/include/bits/endian.h b/src/arch/ia64/include/bits/endian.h new file mode 100644 index 000000000..413e702db --- /dev/null +++ b/src/arch/ia64/include/bits/endian.h @@ -0,0 +1,6 @@ +#ifndef ETHERBOOT_BITS_ENDIAN_H +#define ETHERBOOT_BITS_ENDIAN_H + +#define __BYTE_ORDER __LITTLE_ENDIAN + +#endif /* ETHERBOOT_BITS_ENDIAN_H */ diff --git a/src/arch/ia64/include/bits/string.h b/src/arch/ia64/include/bits/string.h new file mode 100644 index 000000000..31e94b7d3 --- /dev/null +++ b/src/arch/ia64/include/bits/string.h @@ -0,0 +1,6 @@ +#ifndef ETHERBOOT_BITS_STRING_H +#define ETHERBOOT_BITS_STRING_H + +/* define inline optimized string functions here */ + +#endif /* ETHERBOOT_BITS_STRING_H */ diff --git a/src/arch/ia64/include/hooks.h b/src/arch/ia64/include/hooks.h new file mode 100644 index 000000000..d8f1f06a1 --- /dev/null +++ b/src/arch/ia64/include/hooks.h @@ -0,0 +1,12 @@ +#ifndef ETHERBOOT_IA64_HOOKS_H +#define ETHERBOOT_IA64_HOOKS_H + +#include <stdarg.h> + +void arch_main(in_call_data_t *data, va_list params); +void arch_on_exit(int status); +void arch_relocate_to(unsigned long addr); +#define arch_relocated_from(old_addr) do {} while(0) + + +#endif /* ETHERBOOT_IA64_HOOKS_H */ diff --git a/src/arch/ia64/include/io.h b/src/arch/ia64/include/io.h new file mode 100644 index 000000000..be5a5ce16 --- /dev/null +++ b/src/arch/ia64/include/io.h @@ -0,0 +1,228 @@ +#ifndef ETHERBOOT_IO_H +#define ETHERBOOT_IO_H + +/* Don't require identity mapped physical memory, + * osloader.c is the only valid user at the moment. + */ +static inline unsigned long virt_to_phys(volatile const void *virt_addr) +{ + return ((unsigned long)virt_addr); +} + +static inline void *phys_to_virt(unsigned long phys_addr) +{ + return (void *)(phys_addr); +} + +/* virt_to_bus converts an addresss inside of etherboot [_start, _end] + * into a memory address cards can use. + */ +#define virt_to_bus virt_to_phys + + +/* bus_to_virt reverses virt_to_bus, the address must be output + * from virt_to_bus to be valid. This function does not work on + * all bus addresses. + */ +#define bus_to_virt phys_to_virt + +/* ioremap converts a random 32bit bus address into something + * etherboot can access. + */ +static inline void *ioremap(unsigned long bus_addr, unsigned long length __unused) +{ + return bus_to_virt(bus_addr); +} + +/* iounmap cleans up anything ioremap had to setup */ +static inline void iounmap(void *virt_addr __unused) +{ + return; +} + +/* In physical mode the offset of uncached pages */ +#define PHYS_BASE (0x8000000000000000UL) + +/* Memory mapped IO primitives, we avoid the cache... */ +static inline uint8_t readb(unsigned long addr) +{ + return *((volatile uint8_t *)(PHYS_BASE | addr)); +} + +static inline uint16_t readw(unsigned long addr) +{ + return *((volatile uint16_t *)(PHYS_BASE | addr)); +} + +static inline uint32_t readl(unsigned long addr) +{ + return *((volatile uint32_t *)(PHYS_BASE | addr)); +} + +static inline uint64_t readq(unsigned long addr) +{ + return *((volatile uint64_t *)(PHYS_BASE | addr)); +} + + +static inline void writeb(uint8_t val, unsigned long addr) +{ + *((volatile uint8_t *)(PHYS_BASE | addr)) = val; +} + +static inline void writew(uint16_t val, unsigned long addr) +{ + *((volatile uint16_t *)(PHYS_BASE | addr)) = val; +} + +static inline void writel(uint32_t val, unsigned long addr) +{ + *((volatile uint32_t *)(PHYS_BASE | addr)) = val; +} + +static inline void writeq(uint64_t val, unsigned long addr) +{ + *((volatile uint64_t *)(PHYS_BASE | addr)) = val; +} + + +static inline void memcpy_fromio(void *dest, unsigned long src, size_t n) +{ + size_t i; + uint8_t *dp = dest; + for(i = 0; i < n; i++) { + *dp = readb(src); + dp++; + src++; + } +} + +static inline void memcpy_toio(unsigned long dest , const void *src, size_t n) +{ + size_t i; + const uint8_t *sp = src; + for(i = 0; i < n; i++) { + writeb(*sp, dest); + sp++; + dest++; + } +} + +/* IO space IO primitives, Itanium has a strange architectural mapping... */ +extern unsigned long io_base; +#define __ia64_mf_a() __asm__ __volatile__ ("mf.a" ::: "memory") +#define __ia64_io_addr(port) ((void *)(PHYS_BASE | io_base | (((port) >> 2) << 12) | ((port) & 0xfff))) + +static inline uint8_t inb(unsigned long port) +{ + uint8_t result; + + result = *((volatile uint8_t *)__ia64_io_addr(port)); + __ia64_mf_a(); + return result; +} + +static inline uint16_t inw(unsigned long port) +{ + uint8_t result; + result = *((volatile uint16_t *)__ia64_io_addr(port)); + __ia64_mf_a(); + return result; +} + +static inline uint32_t inl(unsigned long port) +{ + uint32_t result; + result = *((volatile uint32_t *)__ia64_io_addr(port)); + __ia64_mf_a(); + return result; +} + +static inline void outb(uint8_t val, unsigned long port) +{ + *((volatile uint8_t *)__ia64_io_addr(port)) = val; + __ia64_mf_a(); +} + +static inline void outw(uint16_t val, unsigned long port) +{ + *((volatile uint16_t *)__ia64_io_addr(port)) = val; + __ia64_mf_a(); +} + +static inline void outl(uint32_t val, unsigned long port) +{ + *((volatile uint32_t *)__ia64_io_addr(port)) = val; + __ia64_mf_a(); +} + + + +static inline void insb(unsigned long port, void *dst, unsigned long count) +{ + volatile uint8_t *addr = __ia64_io_addr(port); + uint8_t *dp = dst; + __ia64_mf_a(); + while(count--) + *dp++ = *addr; + __ia64_mf_a(); +} + +static inline void insw(unsigned long port, void *dst, unsigned long count) +{ + volatile uint16_t *addr = __ia64_io_addr(port); + uint16_t *dp = dst; + __ia64_mf_a(); + while(count--) + *dp++ = *addr; + __ia64_mf_a(); +} + +static inline void insl(unsigned long port, void *dst, unsigned long count) +{ + volatile uint32_t *addr = __ia64_io_addr(port); + uint32_t *dp = dst; + __ia64_mf_a(); + while(count--) + *dp++ = *addr; + __ia64_mf_a(); +} + +static inline void outsb(unsigned long port, void *src, unsigned long count) +{ + const uint8_t *sp = src; + volatile uint8_t *addr = __ia64_io_addr(port); + + while (count--) + *addr = *sp++; + __ia64_mf_a(); +} + +static inline void outsw(unsigned long port, void *src, unsigned long count) +{ + const uint16_t *sp = src; + volatile uint16_t *addr = __ia64_io_addr(port); + + while (count--) + *addr = *sp++; + __ia64_mf_a(); +} + +static inline void outsl(unsigned long port, void *src, unsigned long count) +{ + const uint32_t *sp = src; + volatile uint32_t *addr = __ia64_io_addr(port); + + while (count--) + *addr = *sp++; + __ia64_mf_a(); +} + +static inline unsigned long ia64_get_kr0(void) +{ + unsigned long r; + asm volatile ("mov %0=ar.k0" : "=r"(r)); + return r; +} + +#endif /* ETHERBOOT_IO_H */ diff --git a/src/arch/ia64/include/latch.h b/src/arch/ia64/include/latch.h new file mode 100644 index 000000000..87195b427 --- /dev/null +++ b/src/arch/ia64/include/latch.h @@ -0,0 +1,11 @@ +#ifndef LATCH_H +#define LATCH_H + +#define TICKS_PER_SEC (1000UL) + +/* Fixed timer interval used for calibrating a more precise timer */ +#define LATCHES_PER_SEC 10 + +void sleep_latch(void); + +#endif /* LATCH_H */ diff --git a/src/arch/ia64/include/limits.h b/src/arch/ia64/include/limits.h new file mode 100644 index 000000000..0c6f21f9e --- /dev/null +++ b/src/arch/ia64/include/limits.h @@ -0,0 +1,57 @@ +#ifndef LIMITS_H +#define LIMITS_H 1 + +/* Number of bits in a `char' */ +#define CHAR_BIT 8 + +/* Minimum and maximum values a `signed char' can hold */ +#define SCHAR_MIN (-128) +#define SCHAR_MAX 127 + +/* Maximum value an `unsigned char' can hold. (Minimum is 0.) */ +#define UCHAR_MAX 255 + +/* Minimum and maximum values a `char' can hold */ +#define CHAR_MIN SCHAR_MIN +#define CHAR_MAX SCHAR_MAX + +/* Minimum and maximum values a `signed short int' can hold */ +#define SHRT_MIN (-32768) +#define SHRT_MAX 32767 + +/* Maximum value an `unsigned short' can hold. (Minimum is 0.) */ +#define USHRT_MAX 65535 + + +/* Minimum and maximum values a `signed int' can hold */ +#define INT_MIN (-INT_MAX - 1) +#define INT_MAX 2147483647 + +/* Maximum value an `unsigned int' can hold. (Minimum is 0.) */ +#define UINT_MAX 4294967295U + + +/* Minimum and maximum values a `signed int' can hold */ +#define INT_MIN (-INT_MAX - 1) +#define INT_MAX 2147483647 + +/* Maximum value an `unsigned int' can hold. (Minimum is 0.) */ +#define UINT_MAX 4294967295U + +/* Minimum and maximum values a `signed long' can hold */ +#define LONG_MAX 9223372036854775807L +#define LONG_MIN (-LONG_MAX - 1L) + +/* Maximum value an `unsigned long' can hold. (Minimum is 0.) */ +#define ULONG_MAX 18446744073709551615UL + +/* Minimum and maximum values a `signed long long' can hold */ +#define LLONG_MAX 9223372036854775807LL +#define LLONG_MIN (-LONG_MAX - 1LL) + + +/* Maximum value an `unsigned long long' can hold. (Minimum is 0.) */ +#define ULLONG_MAX 18446744073709551615ULL + + +#endif /* LIMITS_H */ diff --git a/src/arch/ia64/include/pal.h b/src/arch/ia64/include/pal.h new file mode 100644 index 000000000..6cda19d18 --- /dev/null +++ b/src/arch/ia64/include/pal.h @@ -0,0 +1,11 @@ +#ifndef IA64_PAL_H +#define IA64_PAL_H + +struct pal_freq_ratio { + unsigned long den : 32, num : 32; /* numerator & denominator */ +}; +extern long pal_freq_ratios(struct pal_freq_ratio *proc_ratio, + struct pal_freq_ratio *bus_ratio, struct pal_freq_ratio *itc_ratio); + + +#endif /* IA64_PAL_H */ diff --git a/src/arch/ia64/include/sal.h b/src/arch/ia64/include/sal.h new file mode 100644 index 000000000..7a1b57ece --- /dev/null +++ b/src/arch/ia64/include/sal.h @@ -0,0 +1,29 @@ +#ifndef IA64_SAL_H +#define IA64_SAL_H + +struct fptr { + unsigned long entry; + unsigned long gp; +}; +extern struct fptr sal_entry; +extern struct fptr pal_entry; +extern int parse_sal_system_table(void *table); + +#define SAL_FREQ_BASE_PLATFORM 0 +#define SAL_FREQ_BASE_INTERVAL_TIMER 1 +#define SAL_FREQ_BASE_REALTIME_CLOCK 2 + +long sal_freq_base (unsigned long which, unsigned long *ticks_per_second, + unsigned long *drift_info); + +#define PCI_SAL_ADDRESS(seg, bus, dev, fn, reg) \ + ((unsigned long)(seg << 24) | (unsigned long)(bus << 16) | \ + (unsigned long)(dev << 11) | (unsigned long)(fn << 8) | \ + (unsigned long)(reg)) + +long sal_pci_config_read ( + unsigned long pci_config_addr, unsigned long size, unsigned long *value); +long sal_pci_config_write ( + unsigned long pci_config_addr, unsigned long size, unsigned long value); + +#endif /* IA64_SAL_H */ diff --git a/src/arch/ia64/include/setjmp.h b/src/arch/ia64/include/setjmp.h new file mode 100644 index 000000000..a1fac2dcb --- /dev/null +++ b/src/arch/ia64/include/setjmp.h @@ -0,0 +1,13 @@ +#ifndef ETHERBOOT_SETJMP_H +#define ETHERBOOT_SETJMP_H + + +/* Define a type for use by setjmp and longjmp */ +#define JBLEN 70 + +typedef long jmp_buf[JBLEN] __attribute__ ((aligned (16))); /* guarantees 128-bit alignment! */ + +extern int setjmp (jmp_buf env); +extern void longjmp (jmp_buf env, int val); + +#endif /* ETHERBOOT_SETJMP_H */ diff --git a/src/arch/ia64/include/stdint.h b/src/arch/ia64/include/stdint.h new file mode 100644 index 000000000..2f9c592c3 --- /dev/null +++ b/src/arch/ia64/include/stdint.h @@ -0,0 +1,16 @@ +#ifndef STDINT_H +#define STDINT_H + +typedef unsigned long size_t; + +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef unsigned int uint32_t; +typedef unsigned long uint64_t; + +typedef signed char int8_t; +typedef signed short int16_t; +typedef signed int int32_t; +typedef signed long int64_t; + +#endif /* STDINT_H */ |
