diff options
Diffstat (limited to 'include/asm-frv')
-rw-r--r-- | include/asm-frv/atomic.h | 96 | ||||
-rw-r--r-- | include/asm-frv/bug.h | 1 | ||||
-rw-r--r-- | include/asm-frv/dma-mapping.h | 2 | ||||
-rw-r--r-- | include/asm-frv/io.h | 123 | ||||
-rw-r--r-- | include/asm-frv/mb-regs.h | 4 | ||||
-rw-r--r-- | include/asm-frv/mc146818rtc.h | 16 | ||||
-rw-r--r-- | include/asm-frv/module.h | 16 | ||||
-rw-r--r-- | include/asm-frv/pci.h | 8 | ||||
-rw-r--r-- | include/asm-frv/pgtable.h | 5 | ||||
-rw-r--r-- | include/asm-frv/types.h | 1 | ||||
-rw-r--r-- | include/asm-frv/uaccess.h | 8 | ||||
-rw-r--r-- | include/asm-frv/unistd.h | 2 | ||||
-rw-r--r-- | include/asm-frv/vga.h | 17 | ||||
-rw-r--r-- | include/asm-frv/xor.h | 1 |
14 files changed, 198 insertions, 102 deletions
diff --git a/include/asm-frv/atomic.h b/include/asm-frv/atomic.h index 3f54fea2b05..9c9e9499cfd 100644 --- a/include/asm-frv/atomic.h +++ b/include/asm-frv/atomic.h @@ -218,51 +218,12 @@ extern unsigned long atomic_test_and_XOR_mask(unsigned long mask, volatile unsig __typeof__(*(ptr)) __xg_orig; \ \ switch (sizeof(__xg_orig)) { \ - case 1: \ - asm volatile( \ - "0: \n" \ - " orcc gr0,gr0,gr0,icc3 \n" \ - " ckeq icc3,cc7 \n" \ - " ldub.p %M0,%1 \n" \ - " orcr cc7,cc7,cc3 \n" \ - " cstb.p %2,%M0 ,cc3,#1 \n" \ - " corcc gr29,gr29,gr0 ,cc3,#1 \n" \ - " beq icc3,#0,0b \n" \ - : "+U"(*__xg_ptr), "=&r"(__xg_orig) \ - : "r"(x) \ - : "memory", "cc7", "cc3", "icc3" \ - ); \ - break; \ - \ - case 2: \ - asm volatile( \ - "0: \n" \ - " orcc gr0,gr0,gr0,icc3 \n" \ - " ckeq icc3,cc7 \n" \ - " lduh.p %M0,%1 \n" \ - " orcr cc7,cc7,cc3 \n" \ - " csth.p %2,%M0 ,cc3,#1 \n" \ - " corcc gr29,gr29,gr0 ,cc3,#1 \n" \ - " beq icc3,#0,0b \n" \ - : "+U"(*__xg_ptr), "=&r"(__xg_orig) \ - : "r"(x) \ - : "memory", "cc7", "cc3", "icc3" \ - ); \ - break; \ - \ case 4: \ asm volatile( \ - "0: \n" \ - " orcc gr0,gr0,gr0,icc3 \n" \ - " ckeq icc3,cc7 \n" \ - " ld.p %M0,%1 \n" \ - " orcr cc7,cc7,cc3 \n" \ - " cst.p %2,%M0 ,cc3,#1 \n" \ - " corcc gr29,gr29,gr0 ,cc3,#1 \n" \ - " beq icc3,#0,0b \n" \ - : "+U"(*__xg_ptr), "=&r"(__xg_orig) \ + "swap%I0 %2,%M0" \ + : "+m"(*__xg_ptr), "=&r"(__xg_orig) \ : "r"(x) \ - : "memory", "cc7", "cc3", "icc3" \ + : "memory" \ ); \ break; \ \ @@ -277,8 +238,6 @@ extern unsigned long atomic_test_and_XOR_mask(unsigned long mask, volatile unsig #else -extern uint8_t __xchg_8 (uint8_t i, volatile void *v); -extern uint16_t __xchg_16(uint16_t i, volatile void *v); extern uint32_t __xchg_32(uint32_t i, volatile void *v); #define xchg(ptr, x) \ @@ -287,8 +246,6 @@ extern uint32_t __xchg_32(uint32_t i, volatile void *v); __typeof__(*(ptr)) __xg_orig; \ \ switch (sizeof(__xg_orig)) { \ - case 1: __xg_orig = (__typeof__(*(ptr))) __xchg_8 ((uint8_t) x, __xg_ptr); break; \ - case 2: __xg_orig = (__typeof__(*(ptr))) __xchg_16((uint16_t) x, __xg_ptr); break; \ case 4: __xg_orig = (__typeof__(*(ptr))) __xchg_32((uint32_t) x, __xg_ptr); break; \ default: \ __xg_orig = 0; \ @@ -318,46 +275,6 @@ extern uint32_t __xchg_32(uint32_t i, volatile void *v); __typeof__(*(ptr)) __xg_new = (new); \ \ switch (sizeof(__xg_orig)) { \ - case 1: \ - asm volatile( \ - "0: \n" \ - " orcc gr0,gr0,gr0,icc3 \n" \ - " ckeq icc3,cc7 \n" \ - " ldub.p %M0,%1 \n" \ - " orcr cc7,cc7,cc3 \n" \ - " sub%I4 %1,%4,%2 \n" \ - " sllcc %2,#24,gr0,icc0 \n" \ - " bne icc0,#0,1f \n" \ - " cstb.p %3,%M0 ,cc3,#1 \n" \ - " corcc gr29,gr29,gr0 ,cc3,#1 \n" \ - " beq icc3,#0,0b \n" \ - "1: \n" \ - : "+U"(*__xg_ptr), "=&r"(__xg_orig), "=&r"(__xg_tmp) \ - : "r"(__xg_new), "NPr"(__xg_test) \ - : "memory", "cc7", "cc3", "icc3", "icc0" \ - ); \ - break; \ - \ - case 2: \ - asm volatile( \ - "0: \n" \ - " orcc gr0,gr0,gr0,icc3 \n" \ - " ckeq icc3,cc7 \n" \ - " lduh.p %M0,%1 \n" \ - " orcr cc7,cc7,cc3 \n" \ - " sub%I4 %1,%4,%2 \n" \ - " sllcc %2,#16,gr0,icc0 \n" \ - " bne icc0,#0,1f \n" \ - " csth.p %3,%M0 ,cc3,#1 \n" \ - " corcc gr29,gr29,gr0 ,cc3,#1 \n" \ - " beq icc3,#0,0b \n" \ - "1: \n" \ - : "+U"(*__xg_ptr), "=&r"(__xg_orig), "=&r"(__xg_tmp) \ - : "r"(__xg_new), "NPr"(__xg_test) \ - : "memory", "cc7", "cc3", "icc3", "icc0" \ - ); \ - break; \ - \ case 4: \ asm volatile( \ "0: \n" \ @@ -388,8 +305,6 @@ extern uint32_t __xchg_32(uint32_t i, volatile void *v); #else -extern uint8_t __cmpxchg_8 (uint8_t *v, uint8_t test, uint8_t new); -extern uint16_t __cmpxchg_16(uint16_t *v, uint16_t test, uint16_t new); extern uint32_t __cmpxchg_32(uint32_t *v, uint32_t test, uint32_t new); #define cmpxchg(ptr, test, new) \ @@ -400,8 +315,6 @@ extern uint32_t __cmpxchg_32(uint32_t *v, uint32_t test, uint32_t new); __typeof__(*(ptr)) __xg_new = (new); \ \ switch (sizeof(__xg_orig)) { \ - case 1: __xg_orig = __cmpxchg_8 (__xg_ptr, __xg_test, __xg_new); break; \ - case 2: __xg_orig = __cmpxchg_16(__xg_ptr, __xg_test, __xg_new); break; \ case 4: __xg_orig = __cmpxchg_32(__xg_ptr, __xg_test, __xg_new); break; \ default: \ __xg_orig = 0; \ @@ -414,7 +327,7 @@ extern uint32_t __cmpxchg_32(uint32_t *v, uint32_t test, uint32_t new); #endif -#define atomic_cmpxchg(v, old, new) ((int)cmpxchg(&((v)->counter), old, new)) +#define atomic_cmpxchg(v, old, new) (cmpxchg(&((v)->counter), old, new)) #define atomic_add_unless(v, a, u) \ ({ \ @@ -424,6 +337,7 @@ extern uint32_t __cmpxchg_32(uint32_t *v, uint32_t test, uint32_t new); c = old; \ c != (u); \ }) + #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) #include <asm-generic/atomic.h> diff --git a/include/asm-frv/bug.h b/include/asm-frv/bug.h index 074c0d5770e..451712cc306 100644 --- a/include/asm-frv/bug.h +++ b/include/asm-frv/bug.h @@ -12,6 +12,7 @@ #define _ASM_BUG_H #include <linux/config.h> +#include <linux/linkage.h> #ifdef CONFIG_BUG /* diff --git a/include/asm-frv/dma-mapping.h b/include/asm-frv/dma-mapping.h index 5003e017fd1..e9fc1d47797 100644 --- a/include/asm-frv/dma-mapping.h +++ b/include/asm-frv/dma-mapping.h @@ -23,7 +23,7 @@ void dma_free_coherent(struct device *dev, size_t size, void *vaddr, dma_addr_t * returns, or alternatively stop on the first sg_dma_len(sg) which * is 0. */ -#define sg_dma_address(sg) ((unsigned long) (page_to_phys((sg)->page) + (sg)->offset)) +#define sg_dma_address(sg) ((sg)->dma_address) #define sg_dma_len(sg) ((sg)->length) /* diff --git a/include/asm-frv/io.h b/include/asm-frv/io.h index 48829f72724..075369b1a34 100644 --- a/include/asm-frv/io.h +++ b/include/asm-frv/io.h @@ -18,6 +18,7 @@ #ifdef __KERNEL__ #include <linux/config.h> +#include <linux/types.h> #include <asm/virtconvert.h> #include <asm/string.h> #include <asm/mb-regs.h> @@ -104,6 +105,8 @@ static inline void __insl(unsigned long addr, void *buf, int len, int swap) __insl_sw(addr, buf, len); } +#define mmiowb() mb() + /* * make the short names macros so specific devices * can override them as required @@ -209,6 +212,10 @@ static inline uint32_t readl(const volatile void __iomem *addr) return ret; } +#define readb_relaxed readb +#define readw_relaxed readw +#define readl_relaxed readl + static inline void writeb(uint8_t datum, volatile void __iomem *addr) { __builtin_write8((volatile uint8_t __force *) addr, datum); @@ -268,11 +275,106 @@ static inline void __iomem *ioremap_fullcache(unsigned long physaddr, unsigned l extern void iounmap(void __iomem *addr); +static inline void __iomem *ioport_map(unsigned long port, unsigned int nr) +{ + return (void __iomem *) port; +} + +static inline void ioport_unmap(void __iomem *p) +{ +} + static inline void flush_write_buffers(void) { __asm__ __volatile__ ("membar" : : :"memory"); } +/* + * do appropriate I/O accesses for token type + */ +static inline unsigned int ioread8(void __iomem *p) +{ + return __builtin_read8(p); +} + +static inline unsigned int ioread16(void __iomem *p) +{ + uint16_t ret = __builtin_read16(p); + if (__is_PCI_addr(p)) + ret = _swapw(ret); + return ret; +} + +static inline unsigned int ioread32(void __iomem *p) +{ + uint32_t ret = __builtin_read32(p); + if (__is_PCI_addr(p)) + ret = _swapl(ret); + return ret; +} + +static inline void iowrite8(u8 val, void __iomem *p) +{ + __builtin_write8(p, val); + if (__is_PCI_MEM(p)) + __flush_PCI_writes(); +} + +static inline void iowrite16(u16 val, void __iomem *p) +{ + if (__is_PCI_addr(p)) + val = _swapw(val); + __builtin_write16(p, val); + if (__is_PCI_MEM(p)) + __flush_PCI_writes(); +} + +static inline void iowrite32(u32 val, void __iomem *p) +{ + if (__is_PCI_addr(p)) + val = _swapl(val); + __builtin_write32(p, val); + if (__is_PCI_MEM(p)) + __flush_PCI_writes(); +} + +static inline void ioread8_rep(void __iomem *p, void *dst, unsigned long count) +{ + io_insb((unsigned long) p, dst, count); +} + +static inline void ioread16_rep(void __iomem *p, void *dst, unsigned long count) +{ + io_insw((unsigned long) p, dst, count); +} + +static inline void ioread32_rep(void __iomem *p, void *dst, unsigned long count) +{ + __insl_ns((unsigned long) p, dst, count); +} + +static inline void iowrite8_rep(void __iomem *p, const void *src, unsigned long count) +{ + io_outsb((unsigned long) p, src, count); +} + +static inline void iowrite16_rep(void __iomem *p, const void *src, unsigned long count) +{ + io_outsw((unsigned long) p, src, count); +} + +static inline void iowrite32_rep(void __iomem *p, const void *src, unsigned long count) +{ + __outsl_ns((unsigned long) p, src, count); +} + +/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ +struct pci_dev; +extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max); +static inline void pci_iounmap(struct pci_dev *dev, void __iomem *p) +{ +} + /* * Convert a physical pointer to a virtual kernel pointer for /dev/mem @@ -285,6 +387,27 @@ static inline void flush_write_buffers(void) */ #define xlate_dev_kmem_ptr(p) p +/* + * Check BIOS signature + */ +static inline int check_signature(volatile void __iomem *io_addr, + const unsigned char *signature, int length) +{ + int retval = 0; + + do { + if (readb(io_addr) != *signature) + goto out; + io_addr++; + signature++; + length--; + } while (length); + + retval = 1; +out: + return retval; +} + #endif /* __KERNEL__ */ #endif /* _ASM_IO_H */ diff --git a/include/asm-frv/mb-regs.h b/include/asm-frv/mb-regs.h index c8f575fc42f..93fa732fb0c 100644 --- a/include/asm-frv/mb-regs.h +++ b/include/asm-frv/mb-regs.h @@ -68,6 +68,9 @@ do { \ #define __is_PCI_MEM(addr) \ ((unsigned long)(addr) - __region_PCI_MEM < 0x08000000UL) +#define __is_PCI_addr(addr) \ + ((unsigned long)(addr) - __region_PCI_IO < 0x0c000000UL) + #define __get_CLKSW() ({ *(volatile unsigned long *)(__region_CS2 + 0x0130000cUL) & 0xffUL; }) #define __get_CLKIN() (__get_CLKSW() * 125U * 100000U / 24U) @@ -149,6 +152,7 @@ do { \ #define __is_PCI_IO(addr) 0 /* no PCI */ #define __is_PCI_MEM(addr) 0 +#define __is_PCI_addr(addr) 0 #define __region_PCI_IO 0 #define __region_PCI_MEM 0 #define __flush_PCI_writes() do { } while(0) diff --git a/include/asm-frv/mc146818rtc.h b/include/asm-frv/mc146818rtc.h new file mode 100644 index 00000000000..90dfb7a633d --- /dev/null +++ b/include/asm-frv/mc146818rtc.h @@ -0,0 +1,16 @@ +/* mc146818rtc.h: RTC defs + * + * Copyright (C) 2005 Red Hat, Inc. All Rights Reserved. + * Written by David Howells (dhowells@redhat.com) + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ + +#ifndef _ASM_MC146818RTC_H +#define _ASM_MC146818RTC_H + + +#endif /* _ASM_MC146818RTC_H */ diff --git a/include/asm-frv/module.h b/include/asm-frv/module.h index 3223cfaef74..3d5c6360289 100644 --- a/include/asm-frv/module.h +++ b/include/asm-frv/module.h @@ -11,10 +11,18 @@ #ifndef _ASM_MODULE_H #define _ASM_MODULE_H -#define module_map(x) vmalloc(x) -#define module_unmap(x) vfree(x) -#define module_arch_init(x) (0) -#define arch_init_modules(x) do { } while (0) +struct mod_arch_specific +{ +}; + +#define Elf_Shdr Elf32_Shdr +#define Elf_Sym Elf32_Sym +#define Elf_Ehdr Elf32_Ehdr + +/* + * Include the architecture version. + */ +#define MODULE_ARCH_VERMAGIC __stringify(PROCESSOR_MODEL_NAME) " " #endif /* _ASM_MODULE_H */ diff --git a/include/asm-frv/pci.h b/include/asm-frv/pci.h index 1168451c275..598b0c6b695 100644 --- a/include/asm-frv/pci.h +++ b/include/asm-frv/pci.h @@ -57,6 +57,14 @@ extern void pci_free_consistent(struct pci_dev *hwdev, size_t size, */ #define PCI_DMA_BUS_IS_PHYS (1) +/* pci_unmap_{page,single} is a nop so... */ +#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) +#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) +#define pci_unmap_addr(PTR, ADDR_NAME) (0) +#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0) +#define pci_unmap_len(PTR, LEN_NAME) (0) +#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0) + #ifdef CONFIG_PCI static inline void pci_dma_burst_advice(struct pci_dev *pdev, enum pci_dma_burst_strategy *strat, diff --git a/include/asm-frv/pgtable.h b/include/asm-frv/pgtable.h index 844666377dc..d1c3b182c69 100644 --- a/include/asm-frv/pgtable.h +++ b/include/asm-frv/pgtable.h @@ -421,6 +421,11 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, } /* + * Macro to mark a page protection value as "uncacheable" + */ +#define pgprot_noncached(prot) (__pgprot(pgprot_val(prot) | _PAGE_NOCACHE)) + +/* * Conversion functions: convert a page and protection to a page entry, * and a page entry and page directory to the page they refer to. */ diff --git a/include/asm-frv/types.h b/include/asm-frv/types.h index 50605df6d8a..2560f596a75 100644 --- a/include/asm-frv/types.h +++ b/include/asm-frv/types.h @@ -59,7 +59,6 @@ typedef unsigned int u32; typedef signed long long s64; typedef unsigned long long u64; -typedef u64 u_quad_t; /* Dma addresses are 32-bits wide. */ diff --git a/include/asm-frv/uaccess.h b/include/asm-frv/uaccess.h index 991b50fbba2..b6bcbe01f6e 100644 --- a/include/asm-frv/uaccess.h +++ b/include/asm-frv/uaccess.h @@ -180,16 +180,16 @@ do { \ \ switch (sizeof(*(ptr))) { \ case 1: \ - __get_user_asm(__gu_err, __gu_val, ptr, "ub", "=r"); \ + __get_user_asm(__gu_err, *(u8*)&__gu_val, ptr, "ub", "=r"); \ break; \ case 2: \ - __get_user_asm(__gu_err, __gu_val, ptr, "uh", "=r"); \ + __get_user_asm(__gu_err, *(u16*)&__gu_val, ptr, "uh", "=r"); \ break; \ case 4: \ - __get_user_asm(__gu_err, __gu_val, ptr, "", "=r"); \ + __get_user_asm(__gu_err, *(u32*)&__gu_val, ptr, "", "=r"); \ break; \ case 8: \ - __get_user_asm(__gu_err, __gu_val, ptr, "d", "=e"); \ + __get_user_asm(__gu_err, *(u64*)&__gu_val, ptr, "d", "=e"); \ break; \ default: \ __gu_err = __get_user_bad(); \ diff --git a/include/asm-frv/unistd.h b/include/asm-frv/unistd.h index 5cf989b448d..cde376a7a85 100644 --- a/include/asm-frv/unistd.h +++ b/include/asm-frv/unistd.h @@ -313,7 +313,7 @@ do { \ unsigned long __sr2 = (res); \ if (__builtin_expect(__sr2 >= (unsigned long)(-4095), 0)) { \ errno = (-__sr2); \ - __sr2 = ULONG_MAX; \ + __sr2 = ~0UL; \ } \ return (type) __sr2; \ } while (0) diff --git a/include/asm-frv/vga.h b/include/asm-frv/vga.h new file mode 100644 index 00000000000..a702c800a22 --- /dev/null +++ b/include/asm-frv/vga.h @@ -0,0 +1,17 @@ +/* vga.h: VGA register stuff + * + * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved. + * Written by David Howells (dhowells@redhat.com) + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ + +#ifndef _ASM_VGA_H +#define _ASM_VGA_H + + + +#endif /* _ASM_VGA_H */ diff --git a/include/asm-frv/xor.h b/include/asm-frv/xor.h new file mode 100644 index 00000000000..c82eb12a5b1 --- /dev/null +++ b/include/asm-frv/xor.h @@ -0,0 +1 @@ +#include <asm-generic/xor.h> |