From 6bd6dbbd3ae53a268a510270bebaab24fff382ca Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Fri, 25 Aug 2000 06:33:44 +0000 Subject: Merge with Linux 2.4.0-test6-pre10. --- include/asm-alpha/page.h | 3 +- include/asm-arm/arch-sa1100/mmzone.h | 2 + include/asm-arm/page.h | 2 + include/asm-i386/page.h | 5 +- include/asm-ia64/page.h | 9 +- include/asm-m68k/page.h | 2 + include/asm-mips/page.h | 3 +- include/asm-mips64/mmzone.h | 5 +- include/asm-mips64/page.h | 3 +- include/asm-ppc/page.h | 3 +- include/asm-s390/page.h | 4 +- include/asm-sh/bugs.h | 13 +- include/asm-sh/delay.h | 2 +- include/asm-sh/dma.h | 7 + include/asm-sh/hd64461.h | 45 ++-- include/asm-sh/ide.h | 39 +++- include/asm-sh/io.h | 388 +++++++++++++++++++++++++++++------ include/asm-sh/io_generic.h | 52 +++++ include/asm-sh/io_hd64461.h | 67 ++++++ include/asm-sh/io_od.h | 78 +++++++ include/asm-sh/io_se.h | 81 ++++++++ include/asm-sh/io_unknown.h | 86 ++++++++ include/asm-sh/irq.h | 65 +++++- include/asm-sh/keyboard.h | 13 +- include/asm-sh/machvec.h | 96 +++++++++ include/asm-sh/machvec_init.h | 52 +++++ include/asm-sh/mmu_context.h | 4 +- include/asm-sh/page.h | 3 +- include/asm-sh/pci.h | 21 +- include/asm-sh/pgtable.h | 5 + include/asm-sh/processor.h | 2 +- include/asm-sparc/page.h | 3 +- include/asm-sparc/pgtable.h | 5 +- include/asm-sparc64/mmu_context.h | 8 +- include/asm-sparc64/page.h | 3 +- include/asm-sparc64/pgtable.h | 5 +- include/asm-sparc64/processor.h | 2 +- include/linux/blk.h | 82 ++------ include/linux/blkdev.h | 3 +- include/linux/brlock.h | 12 +- include/linux/highmem.h | 12 +- include/linux/jffs.h | 42 ++-- include/linux/mm.h | 3 - include/linux/pci_ids.h | 18 +- include/video/fbcon.h | 38 ++-- 45 files changed, 1137 insertions(+), 259 deletions(-) create mode 100644 include/asm-sh/io_generic.h create mode 100644 include/asm-sh/io_hd64461.h create mode 100644 include/asm-sh/io_od.h create mode 100644 include/asm-sh/io_se.h create mode 100644 include/asm-sh/io_unknown.h create mode 100644 include/asm-sh/machvec.h create mode 100644 include/asm-sh/machvec_init.h (limited to 'include') diff --git a/include/asm-alpha/page.h b/include/asm-alpha/page.h index 62a72144f..41afdcbd8 100644 --- a/include/asm-alpha/page.h +++ b/include/asm-alpha/page.h @@ -140,7 +140,8 @@ extern __inline__ int get_order(unsigned long size) #define __pa(x) ((unsigned long) (x) - PAGE_OFFSET) #define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET)) -#define MAP_NR(addr) (__pa(addr) >> PAGE_SHIFT) +#define virt_to_page(kaddr) (mem_map + (__pa(kaddr) >> PAGE_SHIFT)) +#define VALID_PAGE(page) ((page - mem_map) < max_mapnr) #endif /* __KERNEL__ */ diff --git a/include/asm-arm/arch-sa1100/mmzone.h b/include/asm-arm/arch-sa1100/mmzone.h index b7abea6f7..c721a1d55 100644 --- a/include/asm-arm/arch-sa1100/mmzone.h +++ b/include/asm-arm/arch-sa1100/mmzone.h @@ -79,3 +79,5 @@ extern pg_data_t sa1100_node_data[]; (((unsigned long)ADDR_TO_MAPBASE((kaddr)) - PAGE_OFFSET) / \ sizeof(mem_map_t))) +#define virt_to_page(kaddr) (mem_map + MAP_NR(kaddr)) +#define VALID_PAGE(page) ((page - mem_map) < max_mapnr) diff --git a/include/asm-arm/page.h b/include/asm-arm/page.h index 10f470048..4f24702a2 100644 --- a/include/asm-arm/page.h +++ b/include/asm-arm/page.h @@ -92,6 +92,8 @@ extern __inline__ int get_order(unsigned long size) #ifndef CONFIG_DISCONTIGMEM #define MAP_NR(addr) ((__pa(addr) - PHYS_OFFSET) >> PAGE_SHIFT) +#define virt_to_page(kaddr) (mem_map + ((__pa(kaddr) - PHYS_OFFSET) >> PAGE_SHIFT)) +#define VALID_PAGE(page) ((page - mem_map) < max_mapnr) #endif #endif diff --git a/include/asm-i386/page.h b/include/asm-i386/page.h index 78d07c207..7a070fa53 100644 --- a/include/asm-i386/page.h +++ b/include/asm-i386/page.h @@ -116,8 +116,9 @@ extern __inline__ int get_order(unsigned long size) #define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET) #define __pa(x) ((unsigned long)(x)-PAGE_OFFSET) #define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET)) -#define MAP_NR(addr) (__pa(addr) >> PAGE_SHIFT) -#define PHYSMAP_NR(addr) ((unsigned long)(addr) >> PAGE_SHIFT) +#define virt_to_page(kaddr) (mem_map + (__pa(kaddr) >> PAGE_SHIFT)) +#define VALID_PAGE(page) ((page - mem_map) < max_mapnr) + #endif /* __KERNEL__ */ diff --git a/include/asm-ia64/page.h b/include/asm-ia64/page.h index 445e42376..f046dad86 100644 --- a/include/asm-ia64/page.h +++ b/include/asm-ia64/page.h @@ -82,7 +82,7 @@ typedef unsigned long pgprot_t; # endif /* !STRICT_MM_TYPECHECKS */ /* - * Note: the MAP_NR() macro can't use __pa() because MAP_NR(X) MUST + * Note: the MAP_NR_*() macro can't use __pa() because MAP_NR_*(X) MUST * map to something >= max_mapnr if X is outside the identity mapped * kernel space. */ @@ -100,12 +100,13 @@ typedef unsigned long pgprot_t; #define MAP_NR_SN1(addr) (((unsigned long) (addr) - PAGE_OFFSET) >> PAGE_SHIFT) #ifdef CONFIG_IA64_GENERIC -# define MAP_NR(addr) platform_map_nr(addr) +# define virt_to_page(kaddr) (mem_map + platform_map_nr(kaddr)) #elif defined (CONFIG_IA64_SN_SN1_SIM) -# define MAP_NR(addr) MAP_NR_SN1(addr) +# define virt_to_page(kaddr) (mem_map + MAP_NR_SN1(kaddr)) #else -# define MAP_NR(addr) MAP_NR_DENSE(addr) +# define virt_to_page(kaddr) (mem_map + MAP_NR_DENSE(kaddr)) #endif +#define VALID_PAGE(page) ((page - mem_map) < max_mapnr) # endif /* __KERNEL__ */ diff --git a/include/asm-m68k/page.h b/include/asm-m68k/page.h index 7cf002fb7..80e5269a2 100644 --- a/include/asm-m68k/page.h +++ b/include/asm-m68k/page.h @@ -160,6 +160,8 @@ static inline void *__va(unsigned long x) #endif /* CONFIG_SUN3 */ #define MAP_NR(addr) (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT) +#define virt_to_page(kaddr) (mem_map + (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT)) +#define VALID_PAGE(page) ((page - mem_map) < max_mapnr) #ifndef CONFIG_SUN3 #define BUG() do { \ diff --git a/include/asm-mips/page.h b/include/asm-mips/page.h index fd391fb85..124a6d142 100644 --- a/include/asm-mips/page.h +++ b/include/asm-mips/page.h @@ -75,7 +75,8 @@ extern __inline__ int get_order(unsigned long size) #define PAGE_OFFSET 0x80000000UL #define __pa(x) ((unsigned long) (x) - PAGE_OFFSET) #define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET)) -#define MAP_NR(addr) (__pa(addr) >> PAGE_SHIFT) +#define virt_to_page(kaddr) (mem_map + (__pa(kaddr) >> PAGE_SHIFT)) +#define VALID_PAGE(page) ((page - mem_map) < max_mapnr) #endif /* defined (__KERNEL__) */ diff --git a/include/asm-mips64/mmzone.h b/include/asm-mips64/mmzone.h index 2c6af1d75..7b06e7a91 100644 --- a/include/asm-mips64/mmzone.h +++ b/include/asm-mips64/mmzone.h @@ -73,7 +73,7 @@ extern plat_pg_data_t *plat_node_data[]; #define LOCAL_MAP_NR(kvaddr) \ (((unsigned long)(kvaddr)-LOCAL_BASE_ADDR((kvaddr))) >> PAGE_SHIFT) -#define MAP_NR(kaddr) (((unsigned long)(kaddr) > (unsigned long)high_memory)\ +#define MIPS64_NR(kaddr) (((unsigned long)(kaddr) > (unsigned long)high_memory)\ ? (max_mapnr + 1) : (LOCAL_MAP_NR((kaddr)) + \ (((unsigned long)ADDR_TO_MAPBASE((kaddr)) - PAGE_OFFSET) / \ sizeof(mem_map_t)))) @@ -82,6 +82,9 @@ extern plat_pg_data_t *plat_node_data[]; -1) ? 0 : (test_bit(LOCAL_MAP_NR((addr)), \ NODE_DATA(KVADDR_TO_NID((unsigned long)addr))->valid_addr_bitmap))) +#define virt_to_page(kaddr) (mem_map + MIPS64_NR(kaddr)) +#define VALID_PAGE(page) ((page - mem_map) < max_mapnr) + #endif /* CONFIG_DISCONTIGMEM */ #endif /* _ASM_MMZONE_H_ */ diff --git a/include/asm-mips64/page.h b/include/asm-mips64/page.h index 16c45aac5..47f7d7906 100644 --- a/include/asm-mips64/page.h +++ b/include/asm-mips64/page.h @@ -69,7 +69,8 @@ typedef struct { unsigned long pgprot; } pgprot_t; #define __pa(x) ((unsigned long) (x) - PAGE_OFFSET) #define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET)) #ifndef CONFIG_DISCONTIGMEM -#define MAP_NR(addr) (__pa(addr) >> PAGE_SHIFT) +#define virt_to_page(kaddr) (mem_map + (__pa(kaddr) >> PAGE_SHIFT)) +#define VALID_PAGE(page) ((page - mem_map) < max_mapnr) #endif #endif /* defined (__KERNEL__) */ diff --git a/include/asm-ppc/page.h b/include/asm-ppc/page.h index a4f6b0a4b..dee0ced3a 100644 --- a/include/asm-ppc/page.h +++ b/include/asm-ppc/page.h @@ -114,8 +114,9 @@ static inline void* ___va(unsigned long p) #define __pa(x) ___pa ((unsigned long)(x)) #define __va(x) ___va ((unsigned long)(x)) -#define MAP_NR(addr) (((unsigned long)addr-PAGE_OFFSET) >> PAGE_SHIFT) #define MAP_PAGE_RESERVED (1<<15) +#define virt_to_page(kaddr) (mem_map + (((unsigned long)kaddr-PAGE_OFFSET) >> PAGE_SHIFT)) +#define VALID_PAGE(page) ((page - mem_map) < max_mapnr) extern unsigned long get_zero_page_fast(void); diff --git a/include/asm-s390/page.h b/include/asm-s390/page.h index 49be624a9..e259b2bff 100644 --- a/include/asm-s390/page.h +++ b/include/asm-s390/page.h @@ -112,8 +112,8 @@ typedef unsigned long pgprot_t; #define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET) #define __pa(x) ((unsigned long)(x)-PAGE_OFFSET) #define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET)) -#define MAP_NR(addr) (__pa(addr) >> PAGE_SHIFT) -#define PHYSMAP_NR(addr) ((unsigned long)(addr) >> PAGE_SHIFT) +#define virt_to_page(kaddr) (mem_map + (__pa(kaddr) >> PAGE_SHIFT)) +#define VALID_PAGE(page) ((page - mem_map) < max_mapnr) #endif /* __KERNEL__ */ diff --git a/include/asm-sh/bugs.h b/include/asm-sh/bugs.h index 99728234a..ed5c57692 100644 --- a/include/asm-sh/bugs.h +++ b/include/asm-sh/bugs.h @@ -17,22 +17,33 @@ static void __init check_bugs(void) { extern unsigned long loops_per_sec; + char *p= &system_utsname.machine[2]; /* "sh" */ cpu_data->loops_per_sec = loops_per_sec; switch (cpu_data->type) { case CPU_SH7708: - printk("CPU: SH7708/SH7709\n"); + *p++ = '3'; + printk("CPU: SH7707/SH7708/SH7709\n"); break; case CPU_SH7729: + *p++ = '3'; printk("CPU: SH7709A/SH7729\n"); break; case CPU_SH7750: + *p++ = '4'; printk("CPU: SH7750\n"); break; default: printk("CPU: ??????\n"); break; } + +#ifndef __LITTLE_ENDIAN__ + /* 'eb' means 'Endian Big' */ + *p++ = 'e'; + *p++ = 'b'; +#endif + *p = '\0'; } #endif /* __ASM_SH_BUGS_H */ diff --git a/include/asm-sh/delay.h b/include/asm-sh/delay.h index f8cb1d0bc..7495d31c8 100644 --- a/include/asm-sh/delay.h +++ b/include/asm-sh/delay.h @@ -33,7 +33,7 @@ extern __inline__ void __udelay(unsigned long usecs, unsigned long lps) #ifdef CONFIG_SMP #define __udelay_val cpu_data[smp_processor_id()].udelay_val #else -#define __udelay_val loops_per_sec +#define __udelay_val (current_cpu_data.loops_per_sec) #endif #define udelay(usecs) __udelay((usecs),__udelay_val) diff --git a/include/asm-sh/dma.h b/include/asm-sh/dma.h index b5a7f0bea..f20096234 100644 --- a/include/asm-sh/dma.h +++ b/include/asm-sh/dma.h @@ -15,4 +15,11 @@ extern int request_dma(unsigned int dmanr, const char * device_id); /* reserve a DMA channel */ extern void free_dma(unsigned int dmanr); /* release it again */ +#ifdef CONFIG_PCI +extern int isa_dma_bridge_buggy; +#else +#define isa_dma_bridge_buggy (0) +#endif + + #endif /* __ASM_SH_DMA_H */ diff --git a/include/asm-sh/hd64461.h b/include/asm-sh/hd64461.h index 1f5851fcc..f4f49ff9c 100644 --- a/include/asm-sh/hd64461.h +++ b/include/asm-sh/hd64461.h @@ -7,31 +7,38 @@ */ #include -#define HD64461_CPTWAR 0x1030 -#define HD64461_CPTWDR 0x1032 -#define HD64461_CPTRAR 0x1034 -#define HD64461_CPTRDR 0x1036 +#define HD64461_STBCR 0x10000 +#define HD64461_SYSCR 0x10002 +#define HD64461_SCPUCR 0x10004 -#define HD64461_PCC0ISR 0x2000 -#define HD64461_PCC0GCR 0x2002 -#define HD64461_PCC0CSCR 0x2004 -#define HD64461_PCC0CSCIER 0x2006 -#define HD64461_PCC0SCR 0x2008 -#define HD64461_PCC1ISR 0x2010 -#define HD64461_PCC1GCR 0x2012 -#define HD64461_PCC1CSCR 0x2014 -#define HD64461_PCC1CSCIER 0x2016 -#define HD64461_PCC1SCR 0x2018 -#define HD64461_P0OCR 0x202a -#define HD64461_P1OCR 0x202c -#define HD64461_PGCR 0x202e +#define HD64461_CPTWAR 0x11030 +#define HD64461_CPTWDR 0x11032 +#define HD64461_CPTRAR 0x11034 +#define HD64461_CPTRDR 0x11036 -#define HD64461_NIRR 0x5000 -#define HD64461_NIMR 0x5002 +#define HD64461_PCC0ISR 0x12000 +#define HD64461_PCC0GCR 0x12002 +#define HD64461_PCC0CSCR 0x12004 +#define HD64461_PCC0CSCIER 0x12006 +#define HD64461_PCC0SCR 0x12008 +#define HD64461_PCC1ISR 0x12010 +#define HD64461_PCC1GCR 0x12012 +#define HD64461_PCC1CSCR 0x12014 +#define HD64461_PCC1CSCIER 0x12016 +#define HD64461_PCC1SCR 0x12018 +#define HD64461_P0OCR 0x1202a +#define HD64461_P1OCR 0x1202c +#define HD64461_PGCR 0x1202e + +#define HD64461_NIRR 0x15000 +#define HD64461_NIMR 0x15002 #ifndef CONFIG_HD64461_IOBASE #define CONFIG_HD64461_IOBASE 0xb0000000 #endif +#ifndef CONFIG_HD64461_IRQ +#define CONFIG_HD64461_IRQ 36 +#endif #define HD64461_IRQBASE 64 diff --git a/include/asm-sh/ide.h b/include/asm-sh/ide.h index 1112ea36c..25570cea2 100644 --- a/include/asm-sh/ide.h +++ b/include/asm-sh/ide.h @@ -15,6 +15,7 @@ #ifdef __KERNEL__ #include +#include #ifndef MAX_HWIFS #define MAX_HWIFS 1 @@ -22,35 +23,51 @@ #define ide__sti() __sti() +static __inline__ int ide_default_irq_hp600(ide_ioreg_t base) +{ + switch (base) { + case 0x01f0: return 77; + case 0x0170: return 77; + default: + return 0; + } +} + static __inline__ int ide_default_irq(ide_ioreg_t base) { + if (MACH_HP600) { + return ide_default_irq_hp600(base); + } switch (base) { -#ifdef CONFIG_SH_HP600 - case 0x201f0: return 77; - case 0x20170: return 77; -#else case 0x01f0: return 14; case 0x0170: return 15; -#endif default: return 0; } } -static __inline__ ide_ioreg_t ide_default_io_base(int index) +static __inline__ ide_ioreg_t ide_default_io_base_hp600(int index) { switch (index) { -#ifdef CONFIG_SH_HP600 case 0: - return 0x201f0; + return 0x01f0; case 1: - return 0x20170; -#else + return 0x0170; + default: + return 0; + } +} + +static __inline__ ide_ioreg_t ide_default_io_base(int index) +{ + if (MACH_HP600) { + return ide_default_io_base_hp600(index); + } + switch (index) { case 0: return 0x1f0; case 1: return 0x170; -#endif default: return 0; } diff --git a/include/asm-sh/io.h b/include/asm-sh/io.h index 0d516620c..8c7d7f269 100644 --- a/include/asm-sh/io.h +++ b/include/asm-sh/io.h @@ -6,85 +6,342 @@ * read{b,w,l}/write{b,w,l} are for PCI, * while in{b,w,l}/out{b,w,l} are for ISA * These may (will) be platform specific function. + * In addition we have 'pausing' versions: in{b,w,l}_p/out{b,w,l}_p + * and 'string' versions: ins{b,w,l}/outs{b,w,l} + * For read{b,w,l} and write{b,w,l} there are also __raw versions, which + * do not have a memory barrier after them. * * In addition, we have * ctrl_in{b,w,l}/ctrl_out{b,w,l} for SuperH specific I/O. * which are processor specific. */ +/* + * We follow the Alpha convention here: + * __inb expands to an inline function call (which either calls via the + * mach_vec if generic, or a machine specific implementation) + * _inb is a real function call (note ___raw fns are _ version of __raw) + * inb by default expands to _inb, but the machine specif code may + * define it to __inb if it chooses. + */ + #include +#include +#include -#define inw_p inw -#define outw_p outw +/* + * Depending on which platform we are running on, we need different + * I/O functions. + */ -#define virt_to_bus virt_to_phys -#define bus_to_virt phys_to_virt +#ifdef __KERNEL__ +#ifdef CONFIG_SH_GENERIC + +/* In a generic kernel, we always go through the machine vector. */ + +#include + +# define __inb(p) sh_mv.mv_inb((p)) +# define __inw(p) sh_mv.mv_inw((p)) +# define __inl(p) sh_mv.mv_inl((p)) +# define __outb(x,p) sh_mv.mv_outb((x),(p)) +# define __outw(x,p) sh_mv.mv_outw((x),(p)) +# define __outl(x,p) sh_mv.mv_outl((x),(p)) + +# define __inb_p(p) sh_mv.mv_inb_p((p)) +# define __inw_p(p) sh_mv.mv_inw_p((p)) +# define __inl_p(p) sh_mv.mv_inl_p((p)) +# define __outb_p(x,p) sh_mv.mv_outb_p((x),(p)) +# define __outw_p(x,p) sh_mv.mv_outw_p((x),(p)) +# define __outl_p(x,p) sh_mv.mv_outl_p((x),(p)) + +#define __insb(p,b,c) sh_mv.mv_insb((p), (b), (c)) +#define __insw(p,b,c) sh_mv.mv_insw((p), (b), (c)) +#define __insl(p,b,c) sh_mv.mv_insl((p), (b), (c)) +#define __outsb(p,b,c) sh_mv.mv_outsb((p), (b), (c)) +#define __outsw(p,b,c) sh_mv.mv_outsw((p), (b), (c)) +#define __outsl(p,b,c) sh_mv.mv_outsl((p), (b), (c)) + +# define __readb(a) sh_mv.mv_readb((a)) +# define __readw(a) sh_mv.mv_readw((a)) +# define __readl(a) sh_mv.mv_readl((a)) +# define __writeb(v,a) sh_mv.mv_writeb((v),(a)) +# define __writew(v,a) sh_mv.mv_writew((v),(a)) +# define __writel(v,a) sh_mv.mv_writel((v),(a)) + +# define __ioremap(a,s) sh_mv.mv_ioremap((a), (s)) +# define __ioremap_nocache(a,s) sh_mv.mv_ioremap_nocache((a), (s)) +# define __iounmap(a) sh_mv.mv_iounmap((a)) + +# define __isa_port2addr(a) sh_mv.mv_isa_port2addr(a) + +# define inb __inb +# define inw __inw +# define inl __inl +# define outb __outb +# define outw __outw +# define outl __outl + +# define inb_p __inb_p +# define inw_p __inw_p +# define inl_p __inl_p +# define outb_p __outb_p +# define outw_p __outw_p +# define outl_p __outl_p + +# define insb __insb +# define insw __insw +# define insl __insl +# define outsb __outsb +# define outsw __outsw +# define outsl __outsl + +# define __raw_readb __readb +# define __raw_readw __readw +# define __raw_readl __readl +# define __raw_writeb __writeb +# define __raw_writew __writew +# define __raw_writel __writel + +#else + +/* Control operations through platform specific headers */ +# define __WANT_IO_DEF + +# if defined(CONFIG_SH_HP600) +# include +# elif defined(CONFIG_SH_OVERDRIVE) +# include +# elif defined(CONFIG_SH_SOLUTION_ENGINE) +# include +# elif defined(CONFIG_SH_UNKNOWN) +# include +# else +# error "What system is this?" +#endif + +#undef __WANT_IO_DEF + +#endif /* GENERIC */ +#endif /* __KERNEL__ */ -extern __inline__ unsigned long readb(unsigned long addr) -{ - return *(volatile unsigned char*)addr; -} +/* These are always function calls, in both kernel and user space */ +extern unsigned int _inb (unsigned long port); +extern unsigned int _inw (unsigned long port); +extern unsigned int _inl (unsigned long port); +extern void _outb (unsigned char b,unsigned long port); +extern void _outw (unsigned short w,unsigned long port); +extern void _outl (unsigned int l,unsigned long port); +extern unsigned int _inb_p (unsigned long port); +extern unsigned int _inw_p (unsigned long port); +extern unsigned int _inl_p (unsigned long port); +extern void _outb_p (unsigned char b,unsigned long port); +extern void _outw_p (unsigned short w,unsigned long port); +extern void _outl_p (unsigned int l,unsigned long port); +extern void _insb (unsigned long port, void *dst, unsigned long count); +extern void _insw (unsigned long port, void *dst, unsigned long count); +extern void _insl (unsigned long port, void *dst, unsigned long count); +extern void _outsb (unsigned long port, const void *src, unsigned long count); +extern void _outsw (unsigned long port, const void *src, unsigned long count); +extern void _outsl (unsigned long port, const void *src, unsigned long count); +extern unsigned long _readb(unsigned long addr); +extern unsigned long _readw(unsigned long addr); +extern unsigned long _readl(unsigned long addr); +extern void _writeb(unsigned char b, unsigned long addr); +extern void _writew(unsigned short b, unsigned long addr); +extern void _writel(unsigned int b, unsigned long addr); -extern __inline__ unsigned long readw(unsigned long addr) -{ - return *(volatile unsigned short*)addr; -} +#ifdef __KERNEL__ +extern unsigned long ___raw_readb(unsigned long addr); +extern unsigned long ___raw_readw(unsigned long addr); +extern unsigned long ___raw_readl(unsigned long addr); +extern unsigned long ___raw_readq(unsigned long addr); +extern void ___raw_writeb(unsigned char b, unsigned long addr); +extern void ___raw_writew(unsigned short b, unsigned long addr); +extern void ___raw_writel(unsigned int b, unsigned long addr); +extern void ___raw_writeq(unsigned long b, unsigned long addr); +#endif -extern __inline__ unsigned long readl(unsigned long addr) -{ - return *(volatile unsigned long*)addr; -} +#ifdef __KERNEL__ +/* + * The platform header files may define some of these macros to use + * the inlined versions where appropriate. These macros may also be + * redefined by userlevel programs. + */ +#ifndef inb +# define inb(p) _inb(p) +#endif +#ifndef inw +# define inw(p) _inw(p) +#endif +#ifndef inl +# define inl(p) _inl(p) +#endif + +#ifndef outb +# define outb(b,p) _outb((b),(p)) +#endif +#ifndef outw +# define outw(w,p) _outw((w),(p)) +#endif +#ifndef outl +# define outl(l,p) _outl((l),(p)) +#endif + +#ifndef inb_p +# define inb_p _inb_p +#endif +#ifndef inw_p +# define inw_p _inw_p +#endif +#ifndef inl_p +# define inl_p _inl_p +#endif + +#ifndef outb_p +# define outb_p _outb_p +#endif +#ifndef outw_p +# define outw_p _outw_p +#endif +#ifndef outl_p +# define outl_p _outl_p +#endif + +#ifndef insb +# define insb(p,d,c) _insb((p),(d),(c)) +#endif +#ifndef insw +# define insw(p,d,c) _insw((p),(d),(c)) +#endif +#ifndef insl +# define insl(p,d,c) _insl((p),(d),(c)) +#endif +#ifndef outsb +# define outsb(p,s,c) _outsb((p),(s),(c)) +#endif +#ifndef outsw +# define outsw(p,s,c) _outsw((p),(s),(c)) +#endif +#ifndef outsl +# define outsl(p,s,c) _outsl((p),(s),(c)) +#endif + +#ifdef __raw_readb +# define readb(a) ({ unsigned long r_ = __raw_readb(a); mb(); r_; }) +#endif +#ifdef __raw_readw +# define readw(a) ({ unsigned long r_ = __raw_readw(a); mb(); r_; }) +#endif +#ifdef __raw_readl +# define readl(a) ({ unsigned long r_ = __raw_readl(a); mb(); r_; }) +#endif + +#ifdef __raw_writeb +# define writeb(v,a) ({ __raw_writeb((v),(a)); mb(); }) +#endif +#ifdef __raw_writew +# define writew(v,a) ({ __raw_writew((v),(a)); mb(); }) +#endif +#ifdef __raw_writel +# define writel(v,a) ({ __raw_writel((v),(a)); mb(); }) +#endif + +#ifndef __raw_readb +# define __raw_readb(a) ___raw_readb((unsigned long)(a)) +#endif +#ifndef __raw_readw +# define __raw_readw(a) ___raw_readw((unsigned long)(a)) +#endif +#ifndef __raw_readl +# define __raw_readl(a) ___raw_readl((unsigned long)(a)) +#endif + +#ifndef __raw_writeb +# define __raw_writeb(v,a) ___raw_writeb((v),(unsigned long)(a)) +#endif +#ifndef __raw_writew +# define __raw_writew(v,a) ___raw_writew((v),(unsigned long)(a)) +#endif +#ifndef __raw_writel +# define __raw_writel(v,a) ___raw_writel((v),(unsigned long)(a)) +#endif + +#ifndef readb +# define readb(a) _readb((unsigned long)(a)) +#endif +#ifndef readw +# define readw(a) _readw((unsigned long)(a)) +#endif +#ifndef readl +# define readl(a) _readl((unsigned long)(a)) +#endif + +#ifndef writeb +# define writeb(v,a) _writeb((v),(unsigned long)(a)) +#endif +#ifndef writew +# define writew(v,a) _writew((v),(unsigned long)(a)) +#endif +#ifndef writel +# define writel(v,a) _writel((v),(unsigned long)(a)) +#endif + +#else + +/* Userspace declarations. */ + +extern unsigned int inb(unsigned long port); +extern unsigned int inw(unsigned long port); +extern unsigned int inl(unsigned long port); +extern void outb(unsigned char b,unsigned long port); +extern void outw(unsigned short w,unsigned long port); +extern void outl(unsigned int l,unsigned long port); +extern void insb (unsigned long port, void *dst, unsigned long count); +extern void insw (unsigned long port, void *dst, unsigned long count); +extern void insl (unsigned long port, void *dst, unsigned long count); +extern void outsb (unsigned long port, const void *src, unsigned long count); +extern void outsw (unsigned long port, const void *src, unsigned long count); +extern void outsl (unsigned long port, const void *src, unsigned long count); +extern unsigned long readb(unsigned long addr); +extern unsigned long readw(unsigned long addr); +extern unsigned long readl(unsigned long addr); +extern void writeb(unsigned char b, unsigned long addr); +extern void writew(unsigned short b, unsigned long addr); +extern void writel(unsigned int b, unsigned long addr); -extern __inline__ void writeb(unsigned char b, unsigned long addr) -{ - *(volatile unsigned char*)addr = b; -} +#endif /* __KERNEL__ */ -extern __inline__ void writew(unsigned short b, unsigned long addr) -{ - *(volatile unsigned short*)addr = b; -} +#ifdef __KERNEL__ -extern __inline__ void writel(unsigned int b, unsigned long addr) +/* + * If the platform has PC-like I/O, this function converts the offset into + * an address. + */ +extern __inline__ unsigned long isa_port2addr(unsigned long offset) { - *(volatile unsigned long*)addr = b; + return __isa_port2addr(offset); } -extern unsigned long inb(unsigned int port); -extern unsigned long inb_p(unsigned int port); -extern unsigned long inw(unsigned int port); -extern unsigned long inl(unsigned int port); -extern void insb(unsigned int port, void *addr, unsigned long count); -extern void insw(unsigned int port, void *addr, unsigned long count); -extern void insl(unsigned int port, void *addr, unsigned long count); - -extern void outb(unsigned long value, unsigned int port); -extern void outb_p(unsigned long value, unsigned int port); -extern void outw(unsigned long value, unsigned int port); -extern void outl(unsigned long value, unsigned int port); -extern void outsb(unsigned int port, const void *addr, unsigned long count); -extern void outsw(unsigned int port, const void *addr, unsigned long count); -extern void outsl(unsigned int port, const void *addr, unsigned long count); - -/* - * If the platform has PC-like I/O, this function gives us the address - * from the offset. - */ -extern unsigned long sh_isa_slot(unsigned long offset); - -#define isa_readb(a) readb(sh_isa_slot(a)) -#define isa_readw(a) readw(sh_isa_slot(a)) -#define isa_readl(a) readl(sh_isa_slot(a)) -#define isa_writeb(b,a) writeb(b,sh_isa_slot(a)) -#define isa_writew(w,a) writew(w,sh_isa_slot(a)) -#define isa_writel(l,a) writel(l,sh_isa_slot(a)) +#define isa_readb(a) readb(isa_port2addr(a)) +#define isa_readw(a) readw(isa_port2addr(a)) +#define isa_readl(a) readl(isa_port2addr(a)) +#define isa_writeb(b,a) writeb(b,isa_port2addr(a)) +#define isa_writew(w,a) writew(w,isa_port2addr(a)) +#define isa_writel(l,a) writel(l,isa_port2addr(a)) #define isa_memset_io(a,b,c) \ - memset((void *)(sh_isa_slot((unsigned long)a)),(b),(c)) + memset((void *)(isa_port2addr((unsigned long)a)),(b),(c)) #define isa_memcpy_fromio(a,b,c) \ - memcpy((a),(void *)(sh_isa_slot((unsigned long)(b))),(c)) + memcpy((a),(void *)(isa_port2addr((unsigned long)(b))),(c)) #define isa_memcpy_toio(a,b,c) \ - memcpy((void *)(sh_isa_slot((unsigned long)(a))),(b),(c)) + memcpy((void *)(isa_port2addr((unsigned long)(a))),(b),(c)) +/* We really want to try and get these to memcpy etc */ +extern void memcpy_fromio(void *, unsigned long, unsigned long); +extern void memcpy_toio(unsigned long, const void *, unsigned long); +extern void memset_io(unsigned long, int, unsigned long); + +/* SuperH on-chip I/O functions */ extern __inline__ unsigned long ctrl_inb(unsigned long addr) { return *(volatile unsigned char*)addr; @@ -115,8 +372,6 @@ extern __inline__ void ctrl_outl(unsigned int b, unsigned long addr) *(volatile unsigned long*)addr = b; } -#ifdef __KERNEL__ - #define IO_SPACE_LIMIT 0xffffffff #include @@ -135,8 +390,8 @@ extern __inline__ void * phys_to_virt(unsigned long address) return (void *)P1SEGADDR(address); } -extern void * ioremap(unsigned long phys_addr, unsigned long size); -extern void iounmap(void *addr); +#define virt_to_bus virt_to_phys +#define bus_to_virt phys_to_virt /* * readX/writeX() are used to access memory mapped devices. On some @@ -152,9 +407,9 @@ extern void iounmap(void *addr); * We cheat a bit and always return uncachable areas until we've fixed * the drivers to handle caching properly. */ -extern __inline__ void * ioremap(unsigned long offset, unsigned long size) +static __inline__ void * ioremap(unsigned long offset, unsigned long size) { - return (void *) P2SEGADDR(offset); + return __ioremap(offset, size); } /* @@ -162,13 +417,14 @@ extern __inline__ void * ioremap(unsigned long offset, unsigned long size) * it's useful if some control registers are in such an area and write combining * or read caching is not desirable: */ -extern __inline__ void * ioremap_nocache (unsigned long offset, unsigned long size) +static __inline__ void * ioremap_nocache (unsigned long offset, unsigned long size) { - return (void *) P2SEGADDR(offset); + return __ioremap_nocache(offset, size); } -extern __inline__ void iounmap(void *addr) +static __inline__ void iounmap(void *addr) { + return __iounmap(addr); } static __inline__ int check_signature(unsigned long io_addr, diff --git a/include/asm-sh/io_generic.h b/include/asm-sh/io_generic.h new file mode 100644 index 000000000..92d9019b6 --- /dev/null +++ b/include/asm-sh/io_generic.h @@ -0,0 +1,52 @@ +/* + * include/asm-sh/io_generic.h + * + * Copyright 2000 Stuart Menefy (stuart.menefy@st.com) + * + * May be copied or modified under the terms of the GNU General Public + * License. See linux/COPYING for more information. + * + * Generic IO functions + */ + +#ifndef _ASM_SH_IO_GENERIC_H +#define _ASM_SH_IO_GENERIC_H + +extern unsigned long generic_io_base; + +extern unsigned long generic_inb(unsigned int port); +extern unsigned long generic_inw(unsigned int port); +extern unsigned long generic_inl(unsigned int port); + +extern void generic_outb(unsigned long value, unsigned int port); +extern void generic_outw(unsigned long value, unsigned int port); +extern void generic_outl(unsigned long value, unsigned int port); + +extern unsigned long generic_inb_p(unsigned int port); +extern unsigned long generic_inw_p(unsigned int port); +extern unsigned long generic_inl_p(unsigned int port); +extern void generic_outb_p(unsigned long value, unsigned int port); +extern void generic_outw_p(unsigned long value, unsigned int port); +extern void generic_outl_p(unsigned long value, unsigned int port); + +extern void generic_insb(unsigned int port, void *addr, unsigned long count); +extern void generic_insw(unsigned int port, void *addr, unsigned long count); +extern void generic_insl(unsigned int port, void *addr, unsigned long count); +extern void generic_outsb(unsigned int port, const void *addr, unsigned long count); +extern void generic_outsw(unsigned int port, const void *addr, unsigned long count); +extern void generic_outsl(unsigned int port, const void *addr, unsigned long count); + +extern unsigned long generic_readb(unsigned long addr); +extern unsigned long generic_readw(unsigned long addr); +extern unsigned long generic_readl(unsigned long addr); +extern void generic_writeb(unsigned char b, unsigned long addr); +extern void generic_writew(unsigned short b, unsigned long addr); +extern void generic_writel(unsigned int b, unsigned long addr); + +extern void *generic_ioremap(unsigned long offset, unsigned long size); +extern void *generic_ioremap_nocache (unsigned long offset, unsigned long size); +extern void generic_iounmap(void *addr); + +extern unsigned long generic_isa_port2addr(unsigned long offset); + +#endif /* _ASM_SH_IO_GENERIC_H */ diff --git a/include/asm-sh/io_hd64461.h b/include/asm-sh/io_hd64461.h new file mode 100644 index 000000000..2574a39ab --- /dev/null +++ b/include/asm-sh/io_hd64461.h @@ -0,0 +1,67 @@ +/* + * include/asm-sh/io_hd64461.h + * + * Copyright 2000 Stuart Menefy (stuart.menefy@st.com) + * + * May be copied or modified under the terms of the GNU General Public + * License. See linux/COPYING for more information. + * + * IO functions for an HD64461 + */ + +#ifndef _ASM_SH_IO_HD64461_H +#define _ASM_SH_IO_HD64461_H + +#include + +extern unsigned long hd64461_inb(unsigned int port); +extern unsigned long hd64461_inw(unsigned int port); +extern unsigned long hd64461_inl(unsigned int port); + +extern void hd64461_outb(unsigned long value, unsigned int port); +extern void hd64461_outw(unsigned long value, unsigned int port); +extern void hd64461_outl(unsigned long value, unsigned int port); + +extern unsigned long hd64461_inb_p(unsigned int port); +extern void hd64461_outb_p(unsigned long value, unsigned int port); + +extern void hd64461_insb(unsigned int port, void *addr, unsigned long count); +extern void hd64461_insw(unsigned int port, void *addr, unsigned long count); +extern void hd64461_insl(unsigned int port, void *addr, unsigned long count); +extern void hd64461_outsb(unsigned int port, const void *addr, unsigned long count); +extern void hd64461_outsw(unsigned int port, const void *addr, unsigned long count); +extern void hd64461_outsl(unsigned int port, const void *addr, unsigned long count); + +#ifdef __WANT_IO_DEF + +# define __inb hd64461_inb +# define __inw hd64461_inw +# define __inl hd64461_inl +# define __outb hd64461_outb +# define __outw hd64461_outw +# define __outl hd64461_outl + +# define __inb_p hd64461_inb_p +# define __inw_p hd64461_inw +# define __inl_p hd64461_inl +# define __outb_p hd64461_outb_p +# define __outw_p hd64461_outw +# define __outl_p hd64461_outl + +# define __insb hd64461_insb +# define __insw hd64461_insw +# define __insl hd64461_insl +# define __outsb hd64461_outsb +# define __outsw hd64461_outsw +# define __outsl hd64461_outsl + +# define __readb generic_readb +# define __readw generic_readw +# define __readl generic_readl +# define __writeb generic_writeb +# define __writew generic_writew +# define __writel generic_writel + +#endif + +#endif /* _ASM_SH_IO_HD64461_H */ diff --git a/include/asm-sh/io_od.h b/include/asm-sh/io_od.h new file mode 100644 index 000000000..3a7e477be --- /dev/null +++ b/include/asm-sh/io_od.h @@ -0,0 +1,78 @@ +/* + * include/asm-sh/io_od.h + * + * Copyright 2000 Stuart Menefy (stuart.menefy@st.com) + * + * May be copied or modified under the terms of the GNU General Public + * License. See linux/COPYING for more information. + * + * IO functions for an STMicroelectronics Overdrive + */ + +#ifndef _ASM_SH_IO_OD_H +#define _ASM_SH_IO_OD_H + +#include + +extern unsigned long od_inb(unsigned int port); +extern unsigned long od_inw(unsigned int port); +extern unsigned long od_inl(unsigned int port); + +extern void od_outb(unsigned long value, unsigned int port); +extern void od_outw(unsigned long value, unsigned int port); +extern void od_outl(unsigned long value, unsigned int port); + +extern unsigned long od_inb_p(unsigned int port); +extern unsigned long od_inw_p(unsigned int port); +extern unsigned long od_inl_p(unsigned int port); +extern void od_outb_p(unsigned long value, unsigned int port); +extern void od_outw_p(unsigned long value, unsigned int port); +extern void od_outl_p(unsigned long value, unsigned int port); + +extern void od_insb(unsigned int port, void *addr, unsigned long count); +extern void od_insw(unsigned int port, void *addr, unsigned long count); +extern void od_insl(unsigned int port, void *addr, unsigned long count); +extern void od_outsb(unsigned int port, const void *addr, unsigned long count); +extern void od_outsw(unsigned int port, const void *addr, unsigned long count); +extern void od_outsl(unsigned int port, const void *addr, unsigned long count); + +extern unsigned long od_isa_port2addr(unsigned long offset); + +#ifdef __WANT_IO_DEF + +# define __inb od_inb +# define __inw od_inw +# define __inl od_inl +# define __outb od_outb +# define __outw od_outw +# define __outl od_outl + +# define __inb_p od_inb_p +# define __inw_p od_inw_p +# define __inl_p od_inl_p +# define __outb_p od_outb_p +# define __outw_p od_outw_p +# define __outl_p od_outl_p + +# define __insb od_insb +# define __insw od_insw +# define __insl od_insl +# define __outsb od_outsb +# define __outsw od_outsw +# define __outsl od_outsl + +# define __readb generic_readb +# define __readw generic_readw +# define __readl generic_readl +# define __writeb generic_writeb +# define __writew generic_writew +# define __writel generic_writel + +# define __isa_port2addr od_isa_port2addr +# define __ioremap generic_ioremap +# define __ioremap_nocache generic_ioremap_nocache +# define __iounmap generic_iounmap + +#endif + +#endif /* _ASM_SH_IO_OD_H */ diff --git a/include/asm-sh/io_se.h b/include/asm-sh/io_se.h new file mode 100644 index 000000000..d97457d9e --- /dev/null +++ b/include/asm-sh/io_se.h @@ -0,0 +1,81 @@ +/* + * include/asm-sh/io_se.h + * + * Copyright 2000 Stuart Menefy (stuart.menefy@st.com) + * + * May be copied or modified under the terms of the GNU General Public + * License. See linux/COPYING for more information. + * + * IO functions for an Hitachi SolutionEngine + */ + +#ifndef _ASM_SH_IO_SE_H +#define _ASM_SH_IO_SE_H + +#include + +extern unsigned long se_inb(unsigned int port); +extern unsigned long se_inw(unsigned int port); +extern unsigned long se_inl(unsigned int port); + +extern void se_outb(unsigned long value, unsigned int port); +extern void se_outw(unsigned long value, unsigned int port); +extern void se_outl(unsigned long value, unsigned int port); + +extern unsigned long se_inb_p(unsigned int port); +extern void se_outb_p(unsigned long value, unsigned int port); + +extern void se_insb(unsigned int port, void *addr, unsigned long count); +extern void se_insw(unsigned int port, void *addr, unsigned long count); +extern void se_insl(unsigned int port, void *addr, unsigned long count); +extern void se_outsb(unsigned int port, const void *addr, unsigned long count); +extern void se_outsw(unsigned int port, const void *addr, unsigned long count); +extern void se_outsl(unsigned int port, const void *addr, unsigned long count); + +extern unsigned long se_readb(unsigned long addr); +extern unsigned long se_readw(unsigned long addr); +extern unsigned long se_readl(unsigned long addr); +extern void se_writeb(unsigned char b, unsigned long addr); +extern void se_writew(unsigned short b, unsigned long addr); +extern void se_writel(unsigned int b, unsigned long addr); + +extern unsigned long se_isa_port2addr(unsigned long offset); + +#ifdef __WANT_IO_DEF + +# define __inb se_inb +# define __inw se_inw +# define __inl se_inl +# define __outb se_outb +# define __outw se_outw +# define __outl se_outl + +# define __inb_p se_inb_p +# define __inw_p se_inw +# define __inl_p se_inl +# define __outb_p se_outb_p +# define __outw_p se_outw +# define __outl_p se_outl + +# define __insb se_insb +# define __insw se_insw +# define __insl se_insl +# define __outsb se_outsb +# define __outsw se_outsw +# define __outsl se_outsl + +# define __readb se_readb +# define __readw se_readw +# define __readl se_readl +# define __writeb se_writeb +# define __writew se_writew +# define __writel se_writel + +# define __isa_port2addr se_isa_port2addr +# define __ioremap generic_ioremap +# define __ioremap_nocache generic_ioremap_nocache +# define __iounmap generic_iounmap + +#endif + +#endif /* _ASM_SH_IO_SE_H */ diff --git a/include/asm-sh/io_unknown.h b/include/asm-sh/io_unknown.h new file mode 100644 index 000000000..b638f2b15 --- /dev/null +++ b/include/asm-sh/io_unknown.h @@ -0,0 +1,86 @@ +/* + * include/asm-sh/io_unknown.h + * + * Copyright 2000 Stuart Menefy (stuart.menefy@st.com) + * + * May be copied or modified under the terms of the GNU General Public + * License. See linux/COPYING for more information. + * + * IO functions for use when we don't know what machine we are on + */ + +#ifndef _ASM_SH_IO_UNKNOWN_H +#define _ASM_SH_IO_UNKNOWN_H + +extern unsigned long unknown_inb(unsigned int port); +extern unsigned long unknown_inw(unsigned int port); +extern unsigned long unknown_inl(unsigned int port); + +extern void unknown_outb(unsigned long value, unsigned int port); +extern void unknown_outw(unsigned long value, unsigned int port); +extern void unknown_outl(unsigned long value, unsigned int port); + +extern unsigned long unknown_inb_p(unsigned int port); +extern unsigned long unknown_inw_p(unsigned int port); +extern unsigned long unknown_inl_p(unsigned int port); +extern void unknown_outb_p(unsigned long value, unsigned int port); +extern void unknown_outw_p(unsigned long value, unsigned int port); +extern void unknown_outl_p(unsigned long value, unsigned int port); + +extern void unknown_insb(unsigned int port, void *addr, unsigned long count); +extern void unknown_insw(unsigned int port, void *addr, unsigned long count); +extern void unknown_insl(unsigned int port, void *addr, unsigned long count); +extern void unknown_outsb(unsigned int port, const void *addr, unsigned long count); +extern void unknown_outsw(unsigned int port, const void *addr, unsigned long count); +extern void unknown_outsl(unsigned int port, const void *addr, unsigned long count); + +extern unsigned long unknown_readb(unsigned long addr); +extern unsigned long unknown_readw(unsigned long addr); +extern unsigned long unknown_readl(unsigned long addr); +extern void unknown_writeb(unsigned char b, unsigned long addr); +extern void unknown_writew(unsigned short b, unsigned long addr); +extern void unknown_writel(unsigned int b, unsigned long addr); + +extern unsigned long unknown_isa_port2addr(unsigned long offset); +extern void * unknown_ioremap(unsigned long offset, unsigned long size); +extern void * unknown_ioremap_nocache (unsigned long offset, unsigned long size); +extern void unknown_iounmap(void *addr); + +#ifdef __WANT_IO_DEF + +# define __inb unknown_inb +# define __inw unknown_inw +# define __inl unknown_inl +# define __outb unknown_outb +# define __outw unknown_outw +# define __outl unknown_outl + +# define __inb_p unknown_inb_p +# define __inw_p unknown_inw_p +# define __inl_p unknown_inl_p +# define __outb_p unknown_outb_p +# define __outw_p unknown_outw_p +# define __outl_p unknown_outl_p + +# define __insb unknown_insb +# define __insw unknown_insw +# define __insl unknown_insl +# define __outsb unknown_outsb +# define __outsw unknown_outsw +# define __outsl unknown_outsl + +# define __readb unknown_readb +# define __readw unknown_readw +# define __readl unknown_readl +# define __writeb unknown_writeb +# define __writew unknown_writew +# define __writel unknown_writel + +# define __isa_port2addr unknown_isa_port2addr +# define __ioremap unknown_ioremap +# define __ioremap_nocache unknown_ioremap_nocache +# define __iounmap unknown_iounmap + +#endif + +#endif /* _ASM_SH_IO_UNKNOWN_H */ diff --git a/include/asm-sh/irq.h b/include/asm-sh/irq.h index 951ad2e9f..48016e3f9 100644 --- a/include/asm-sh/irq.h +++ b/include/asm-sh/irq.h @@ -11,6 +11,7 @@ */ #include +#include #if defined(__sh3__) #define INTC_IPRA 0xfffffee2UL @@ -31,6 +32,43 @@ #define RTC_IPR_POS 0 #define RTC_PRIORITY TIMER_PRIORITY +#define SCI_ERI_IRQ 23 +#define SCI_RXI_IRQ 24 +#define SCI_TXI_IRQ 25 +#define SCI_IPR_ADDR INTC_IPRB +#define SCI_IPR_POS 1 +#define SCI_PRIORITY 3 + +#if defined(CONFIG_CPU_SUBTYPE_SH7707) || defined(CONFIG_CPU_SUBTYPE_SH7709) +#define SCIF_ERI_IRQ 56 +#define SCIF_RXI_IRQ 57 +#define SCIF_TXI_IRQ 59 +#define SCIF_IPR_ADDR INTC_IPRE +#define SCIF_IPR_POS 1 +#define SCIF_PRIORITY 3 + +#define IRDA_ERI_IRQ 52 +#define IRDA_RXI_IRQ 53 +#define IRDA_TXI_IRQ 55 +#define IRDA_IPR_ADDR INTC_IPRE +#define IRDA_IPR_POS 2 +#define IRDA_PRIORITY 3 +#elif defined(CONFIG_CPU_SUBTYPE_SH7750) +#define SCIF_ERI_IRQ 40 +#define SCIF_RXI_IRQ 41 +#define SCIF_TXI_IRQ 43 +#define SCIF_IPR_ADDR INTC_IPRC +#define SCIF_IPR_POS 1 +#define SCIF_PRIORITY 3 +#endif + +#ifdef CONFIG_SH_GENERIC +/* In a generic kernel, NR_IRQS is an upper bound, and we should use + * ACTUAL_NR_IRQS (which uses the machine vector) to get the correct value. + */ +#define NR_IRQS 80 +#define ACTUAL_NR_IRQS (sh_mv.mv_nr_irqs) +#else #if defined(__SH4__) /* * 48 = 32+16 @@ -40,6 +78,8 @@ * */ #define NR_IRQS 48 +#elif defined(CONFIG_CPU_SUBTYPE_SH7707) +#define NR_IRQS 64 #elif defined(CONFIG_CPU_SUBTYPE_SH7708) #define NR_IRQS 32 #elif defined(CONFIG_CPU_SUBTYPE_SH7709) @@ -49,6 +89,8 @@ #define NR_IRQS 61 #endif #endif +#define ACTUAL_NR_IRQS NR_IRQS +#endif extern void disable_irq(unsigned int); extern void disable_irq_nosync(unsigned int); @@ -57,12 +99,11 @@ extern void enable_irq(unsigned int); /* * Function for "on chip support modules". */ -extern void set_ipr_data(unsigned int irq, unsigned int addr, +extern void make_ipr_irq(unsigned int irq, unsigned int addr, int pos, int priority); -extern void make_ipr_irq(unsigned int irq); extern void make_imask_irq(unsigned int irq); -#if defined(CONFIG_CPU_SUBTYPE_SH7709) +#if defined(CONFIG_CPU_SUBTYPE_SH7707) || defined(CONFIG_CPU_SUBTYPE_SH7709) #define INTC_IRR0 0xa4000004UL #define INTC_IRR1 0xa4000006UL #define INTC_IRR2 0xa4000008UL @@ -75,6 +116,9 @@ extern void make_imask_irq(unsigned int irq); #define INTC_IPRC 0xa4000016UL #define INTC_IPRD 0xa4000018UL #define INTC_IPRE 0xa400001aUL +#if defined(CONFIG_CPU_SUBTYPE_SH7707) +#define INTC_IPRF 0xa400001cUL +#endif #define IRQ0_IRQ 32 #define IRQ1_IRQ 33 @@ -105,4 +149,19 @@ extern void make_imask_irq(unsigned int irq); #define IRQ5_PRIORITY 1 #endif +extern int hd64461_irq_demux(int irq); + +#ifdef CONFIG_SH_GENERIC +extern __inline__ int irq_demux(int irq) { + if (sh_mv.mv_irq_demux) { + irq = sh_mv.mv_irq_demux(irq); + } + return irq; +} +#elif defined(CONFIG_HD64461) +#define irq_demux(irq) hd64461_irq_demux(irq) +#else +#define irq_demux(irq) irq +#endif + #endif /* __ASM_SH_IRQ_H */ diff --git a/include/asm-sh/keyboard.h b/include/asm-sh/keyboard.h index 9a64c5113..f1b8eb142 100644 --- a/include/asm-sh/keyboard.h +++ b/include/asm-sh/keyboard.h @@ -3,7 +3,8 @@ /* * $Id: keyboard.h,v 1.1 2000/06/10 21:45:48 yaegashi Exp $ */ -#include + +#include static __inline__ int kbd_setkeycode(unsigned int scancode, unsigned int keycode) @@ -32,13 +33,13 @@ static __inline__ void kbd_leds(unsigned char leds) { } -#ifdef CONFIG_SH_HP600 -void __init hp600_kbd_init_hw(void); -#define kbd_init_hw hp600_kbd_init_hw -#else +extern void hp600_kbd_init_hw(void); + static __inline__ void kbd_init_hw(void) { + if (MACH_HP600) { + hp600_kbd_init_hw(); + } } -#endif #endif diff --git a/include/asm-sh/machvec.h b/include/asm-sh/machvec.h new file mode 100644 index 000000000..918bf969b --- /dev/null +++ b/include/asm-sh/machvec.h @@ -0,0 +1,96 @@ +/* + * include/asm-sh/machvec.h + * + * Copyright 2000 Stuart Menefy (stuart.menefy@st.com) + * + * May be copied or modified under the terms of the GNU General Public + * License. See linux/COPYING for more information. + */ + +#ifndef _ASM_SH_MACHVEC_H +#define _ASM_SH_MACHVEC_H 1 + +#include +#include + +struct sh_machine_vector +{ + const char *mv_name; + + int mv_nr_irqs; + + unsigned long (*mv_inb)(unsigned int); + unsigned long (*mv_inw)(unsigned int); + unsigned long (*mv_inl)(unsigned int); + void (*mv_outb)(unsigned long, unsigned int); + void (*mv_outw)(unsigned long, unsigned int); + void (*mv_outl)(unsigned long, unsigned int); + + unsigned long (*mv_inb_p)(unsigned int); + unsigned long (*mv_inw_p)(unsigned int); + unsigned long (*mv_inl_p)(unsigned int); + void (*mv_outb_p)(unsigned long, unsigned int); + void (*mv_outw_p)(unsigned long, unsigned int); + void (*mv_outl_p)(unsigned long, unsigned int); + + void (*mv_insb)(unsigned int port, void *addr, unsigned long count); + void (*mv_insw)(unsigned int port, void *addr, unsigned long count); + void (*mv_insl)(unsigned int port, void *addr, unsigned long count); + void (*mv_outsb)(unsigned int port, const void *addr, unsigned long count); + void (*mv_outsw)(unsigned int port, const void *addr, unsigned long count); + void (*mv_outsl)(unsigned int port, const void *addr, unsigned long count); + + unsigned long (*mv_readb)(unsigned long); + unsigned long (*mv_readw)(unsigned long); + unsigned long (*mv_readl)(unsigned long); + void (*mv_writeb)(unsigned char, unsigned long); + void (*mv_writew)(unsigned short, unsigned long); + void (*mv_writel)(unsigned int, unsigned long); + + void* (*mv_ioremap)(unsigned long offset, unsigned long size); + void* (*mv_ioremap_nocache)(unsigned long offset, unsigned long size); + void (*mv_iounmap)(void *addr); + + unsigned long (*mv_port2addr)(unsigned long offset); + unsigned long (*mv_isa_port2addr)(unsigned long offset); + + int (*mv_irq_demux)(int irq); + + void (*mv_init_arch)(void); + void (*mv_init_irq)(void); + void (*mv_init_pci)(void); + void (*mv_kill_arch)(int); + + void (*mv_heartbeat)(void); + + unsigned int mv_hw_se : 1; + unsigned int mv_hw_hp600 : 1; + unsigned int mv_hw_hd64461 : 1; +}; + +extern struct sh_machine_vector sh_mv; + +/* Machine check macros */ +#ifdef CONFIG_SH_GENERIC +#define MACH_SE (sh_mv.mv_hw_se) +#define MACH_HP600 (sh_mv.mv_hw_hp600) +#define MACH_HD64461 (sh_mv.mv_hw_hd64461) +#else +# ifdef CONFIG_SH_SOLUTION_ENGINE +# define MACH_SE 1 +# else +# define MACH_SE 0 +# endif +# ifdef CONFIG_SH_HP600 +# define MACH_HP600 1 +# else +# define MACH_HP600 0 +# endif +# ifdef CONFIG_HD64461 +# define MACH_HD64461 1 +# else +# define MACH_HD64461 0 +# endif +#endif + +#endif /* _ASM_SH_MACHVEC_H */ diff --git a/include/asm-sh/machvec_init.h b/include/asm-sh/machvec_init.h new file mode 100644 index 000000000..3e82b3f62 --- /dev/null +++ b/include/asm-sh/machvec_init.h @@ -0,0 +1,52 @@ +/* + * include/asm-sh/machvec_init.h + * + * Copyright 2000 Stuart Menefy (stuart.menefy@st.com) + * + * May be copied or modified under the terms of the GNU General Public + * License. See linux/COPYING for more information. + * + * This file has goodies to help simplify instantiation of machine vectors. + */ + +#ifndef __SH_MACHVEC_INIT_H +#define __SH_MACHVEC_INIT_H + +/* + * In a GENERIC kernel, we have lots of these vectors floating about, + * all but one of which we want to go away. In a non-GENERIC kernel, + * we want only one, ever. + * + * Accomplish this in the GENERIC kernel by puting all of the vectors + * in the .init.data section where they'll go away. We'll copy the + * one we want to the real alpha_mv vector in setup_arch. + * + * Accomplish this in a non-GENERIC kernel by ifdef'ing out all but + * one of the vectors, which will not reside in .init.data. We then + * alias this one vector to alpha_mv, so no copy is needed. + * + * Upshot: set __initdata to nothing for non-GENERIC kernels. + * + * Note we do the same thing for the UNKNOWN kernel, as we need to write + * to the machine vector while setting it up. + */ + +#if defined(CONFIG_SH_GENERIC) || defined(CONFIG_SH_UNKNOWN) +#define __initmv __attribute__((unused,__section__ (".machvec.init"))) +#define ALIAS_MV(x) +#else +#define __initmv + +/* GCC actually has a syntax for defining aliases, but is under some + delusion that you shouldn't be able to declare it extern somewhere + else beforehand. Fine. We'll do it ourselves. */ +#if 0 +#define ALIAS_MV(system) \ + struct sh_machine_vector sh_mv __attribute__((alias("mv_"#system))); +#else +#define ALIAS_MV(system) \ + asm(".global sh_mv\nsh_mv = mv_"#system ); +#endif +#endif /* GENERIC */ + +#endif /* __SH_MACHVEC_INIT_H */ diff --git a/include/asm-sh/mmu_context.h b/include/asm-sh/mmu_context.h index 0f48339b2..82517a5af 100644 --- a/include/asm-sh/mmu_context.h +++ b/include/asm-sh/mmu_context.h @@ -164,15 +164,15 @@ extern __inline__ void switch_mm(struct mm_struct *prev, struct mm_struct *next, struct task_struct *tsk, unsigned int cpu) { - set_bit(cpu, &next->cpu_vm_mask); if (prev != next) { unsigned long __pgdir = (unsigned long)next->pgd; + clear_bit(cpu, &prev->cpu_vm_mask); + set_bit(cpu, &next->cpu_vm_mask); __asm__ __volatile__("mov.l %0, %1" : /* no output */ : "r" (__pgdir), "m" (__m(MMU_TTB))); activate_context(next); - clear_bit(cpu, &prev->cpu_vm_mask); } } diff --git a/include/asm-sh/page.h b/include/asm-sh/page.h index 1348466a9..dcac85fa6 100644 --- a/include/asm-sh/page.h +++ b/include/asm-sh/page.h @@ -65,7 +65,8 @@ typedef struct { unsigned long pgprot; } pgprot_t; #define PAGE_OFFSET (0x80000000) #define __pa(x) ((unsigned long)(x)-PAGE_OFFSET) #define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET)) -#define MAP_NR(addr) ((__pa(addr)-__MEMORY_START) >> PAGE_SHIFT) +#define virt_to_page(kaddr) (mem_map + ((__pa(kaddr)-__MEMORY_START) >> PAGE_SHIFT)) +#define VALID_PAGE(page) ((page - mem_map) < max_mapnr) #ifndef __ASSEMBLY__ diff --git a/include/asm-sh/pci.h b/include/asm-sh/pci.h index 34398480a..2c3ce9038 100644 --- a/include/asm-sh/pci.h +++ b/include/asm-sh/pci.h @@ -9,6 +9,15 @@ #define pcibios_assign_all_busses() 0 +/* These are currently the correct values for the STM overdrive board. + * We need some way of setting this on a board specific way, it will + * not be the same on other boards I think + */ +#if 1 /* def CONFIG_SH_OVERDRIVE */ +#define PCIBIOS_MIN_IO 0x2000 +#define PCIBIOS_MIN_MEM 0x10000000 +#endif + extern inline void pcibios_set_master(struct pci_dev *dev) { /* No special bus mastering setup handling */ @@ -59,7 +68,7 @@ extern void pci_free_consistent(struct pci_dev *hwdev, size_t size, * until either pci_unmap_single or pci_dma_sync_single is performed. */ extern inline dma_addr_t pci_map_single(struct pci_dev *hwdev, void *ptr, - size_t size) + size_t size,int directoin) { return virt_to_bus(ptr); } @@ -72,7 +81,7 @@ extern inline dma_addr_t pci_map_single(struct pci_dev *hwdev, void *ptr, * whatever the device wrote there. */ extern inline void pci_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr, - size_t size) + size_t size,int direction) { /* Nothing to do */ } @@ -93,7 +102,7 @@ extern inline void pci_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr, * the same here. */ extern inline int pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg, - int nents) + int nents,int direction) { return nents; } @@ -103,7 +112,7 @@ extern inline int pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg, * pci_unmap_single() above. */ extern inline void pci_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg, - int nents) + int nents,int direction) { /* Nothing to do */ } @@ -119,7 +128,7 @@ extern inline void pci_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg, */ extern inline void pci_dma_sync_single(struct pci_dev *hwdev, dma_addr_t dma_handle, - size_t size) + size_t size,int direction) { /* Nothing to do */ } @@ -132,7 +141,7 @@ extern inline void pci_dma_sync_single(struct pci_dev *hwdev, */ extern inline void pci_dma_sync_sg(struct pci_dev *hwdev, struct scatterlist *sg, - int nelems) + int nelems,int direction) { /* Nothing to do */ } diff --git a/include/asm-sh/pgtable.h b/include/asm-sh/pgtable.h index 867cf06ac..df3e8edf2 100644 --- a/include/asm-sh/pgtable.h +++ b/include/asm-sh/pgtable.h @@ -23,6 +23,7 @@ extern void paging_init(void); * - flush_cache_page(mm, vmaddr) flushes a single page * - flush_cache_range(mm, start, end) flushes a range of pages * + * - flush_dcache_page(pg) flushes(wback&invalidates) a page for dcache * - flush_page_to_ram(page) write back kernel page to ram * - flush_icache_range(start, end) flushes(invalidates) a range for icache * - flush_icache_page(vma, pg) flushes(invalidates) a page for icache @@ -48,6 +49,7 @@ extern void flush_cache_range(struct mm_struct *mm, unsigned long start, unsigned long end); extern void flush_cache_page(struct vm_area_struct *vma, unsigned long addr); extern void flush_page_to_ram(struct page *page); +extern void flush_dcache_page(struct page *pg); extern void flush_icache_range(unsigned long start, unsigned long end); extern void flush_icache_page(struct vm_area_struct *vma, struct page *pg); #endif @@ -99,6 +101,9 @@ extern unsigned long empty_zero_page[1024]; #define _PAGE_USER 0x040 /* PR1-bit : user space access allowed */ #define _PAGE_PROTNONE 0x080 /* software: if not present */ /* 0x100 V-bit : page is valid */ +/* 0x200 can be used as software flag */ +/* 0x400 can be used as software flag */ +/* 0x800 can be used as software flag */ #if defined(__sh3__) /* Mask which drop software flags */ diff --git a/include/asm-sh/processor.h b/include/asm-sh/processor.h index 77cbe9c1e..38d8dbe7c 100644 --- a/include/asm-sh/processor.h +++ b/include/asm-sh/processor.h @@ -21,7 +21,7 @@ * CPU type and hardware bug flags. Kept separately for each CPU. */ enum cpu_type { - CPU_SH7708, /* Represents 7708, 7708S, 7708R, 7709 */ + CPU_SH7708, /* Represents 7707, 7708, 7708S, 7708R, 7709 */ CPU_SH7729, /* Represents 7709A, 7729 */ CPU_SH7750, CPU_SH_NONE diff --git a/include/asm-sparc/page.h b/include/asm-sparc/page.h index c727c06d8..47022fbba 100644 --- a/include/asm-sparc/page.h +++ b/include/asm-sparc/page.h @@ -177,7 +177,8 @@ extern __inline__ int get_order(unsigned long size) #define PAGE_OFFSET 0xf0000000 #define __pa(x) ((unsigned long)(x) - PAGE_OFFSET) #define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET)) -#define MAP_NR(addr) (__pa(addr) >> PAGE_SHIFT) +#define virt_to_page(kaddr) (mem_map + (__pa(kaddr) >> PAGE_SHIFT)) +#define VALID_PAGE(page) ((page - mem_map) < max_mapnr) #endif /* __KERNEL__ */ diff --git a/include/asm-sparc/pgtable.h b/include/asm-sparc/pgtable.h index 5fc507132..2debbf084 100644 --- a/include/asm-sparc/pgtable.h +++ b/include/asm-sparc/pgtable.h @@ -1,4 +1,4 @@ -/* $Id: pgtable.h,v 1.99 2000/08/05 13:30:34 davem Exp $ */ +/* $Id: pgtable.h,v 1.101 2000/08/09 00:00:17 davem Exp $ */ #ifndef _SPARC_PGTABLE_H #define _SPARC_PGTABLE_H @@ -147,9 +147,6 @@ extern pte_t pg3[1024]; extern unsigned long ptr_in_current_pgd; -/* the no. of pointers that fit on a page: this will go away */ -#define PTRS_PER_PAGE (PAGE_SIZE/sizeof(void*)) - /* Here is a trick, since mmap.c need the initializer elements for * protection_map[] to be constant at compile time, I set the following * to all zeros. I set it to the real values after I link in the diff --git a/include/asm-sparc64/mmu_context.h b/include/asm-sparc64/mmu_context.h index d6ef977d9..ea7b83d5b 100644 --- a/include/asm-sparc64/mmu_context.h +++ b/include/asm-sparc64/mmu_context.h @@ -1,4 +1,4 @@ -/* $Id: mmu_context.h,v 1.42 2000/02/08 07:47:03 davem Exp $ */ +/* $Id: mmu_context.h,v 1.43 2000/08/09 08:04:45 davem Exp $ */ #ifndef __SPARC64_MMU_CONTEXT_H #define __SPARC64_MMU_CONTEXT_H @@ -29,11 +29,9 @@ extern void get_new_mmu_context(struct mm_struct *mm); /* Initialize a new mmu context. This is invoked when a new * address space instance (unique or shared) is instantiated. - * A fresh mm_struct is cleared out to zeros, so this need not - * do anything on Sparc64 since the only thing we care about - * is that mm->context is an invalid context (ie. zero). + * This just needs to set mm->context to an invalid context. */ -#define init_new_context(__tsk, __mm) do { } while(0) +#define init_new_context(__tsk, __mm) ((__mm)->context = 0UL) /* Destroy a dead context. This occurs when mmput drops the * mm_users count to zero, the mmaps have been released, and diff --git a/include/asm-sparc64/page.h b/include/asm-sparc64/page.h index 79f4d7448..86bd26402 100644 --- a/include/asm-sparc64/page.h +++ b/include/asm-sparc64/page.h @@ -105,7 +105,8 @@ register unsigned long PAGE_OFFSET asm("g4"); #define __pa(x) ((unsigned long)(x) - PAGE_OFFSET) #define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET)) -#define MAP_NR(addr) ((__pa(addr)-phys_base) >> PAGE_SHIFT) +#define virt_to_page(kaddr) (mem_map + ((__pa(kaddr)-phys_base) >> PAGE_SHIFT)) +#define VALID_PAGE(page) ((page - mem_map) < max_mapnr) #define virt_to_phys __pa #define phys_to_virt __va diff --git a/include/asm-sparc64/pgtable.h b/include/asm-sparc64/pgtable.h index 3318578f3..c47527736 100644 --- a/include/asm-sparc64/pgtable.h +++ b/include/asm-sparc64/pgtable.h @@ -1,4 +1,4 @@ -/* $Id: pgtable.h,v 1.128 2000/08/05 13:30:34 davem Exp $ +/* $Id: pgtable.h,v 1.130 2000/08/09 00:00:17 davem Exp $ * pgtable.h: SpitFire page table operations. * * Copyright 1996,1997 David S. Miller (davem@caip.rutgers.edu) @@ -57,9 +57,6 @@ #define PMD_TABLE_SIZE 0x2000 /* 2048 entries 4 bytes each */ #define PGD_TABLE_SIZE 0x1000 /* 1024 entries 4 bytes each */ -/* the no. of pointers that fit on a page */ -#define PTRS_PER_PAGE (1UL << (PAGE_SHIFT-3)) - /* NOTE: TLB miss handlers depend heavily upon where this is. */ #define VMALLOC_START 0x0000000140000000UL #define VMALLOC_VMADDR(x) ((unsigned long)(x)) diff --git a/include/asm-sparc64/processor.h b/include/asm-sparc64/processor.h index 37433eace..eae8b7bdb 100644 --- a/include/asm-sparc64/processor.h +++ b/include/asm-sparc64/processor.h @@ -1,4 +1,4 @@ -/* $Id: processor.h,v 1.64 2000/05/09 17:40:15 davem Exp $ +/* $Id: processor.h,v 1.65 2000/08/09 00:00:17 davem Exp $ * include/asm-sparc64/processor.h * * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) diff --git a/include/linux/blk.h b/include/linux/blk.h index ce00d0602..778617529 100644 --- a/include/linux/blk.h +++ b/include/linux/blk.h @@ -85,7 +85,7 @@ void initrd_init(void); * code duplication in drivers. */ -extern inline void blkdev_dequeue_request(struct request * req) +static inline void blkdev_dequeue_request(struct request * req) { if (req->e) { req->e->dequeue_fn(req); @@ -99,6 +99,9 @@ void end_that_request_last(struct request *req); #if defined(MAJOR_NR) || defined(IDE_DRIVER) +#undef DEVICE_ON +#undef DEVICE_OFF + /* * Add entries as needed. */ @@ -106,8 +109,6 @@ void end_that_request_last(struct request *req); #ifdef IDE_DRIVER #define DEVICE_NR(device) (MINOR(device) >> PARTN_BITS) -#define DEVICE_ON(device) /* nothing */ -#define DEVICE_OFF(device) /* nothing */ #define DEVICE_NAME "ide" #elif (MAJOR_NR == RAMDISK_MAJOR) @@ -116,8 +117,6 @@ void end_that_request_last(struct request *req); #define DEVICE_NAME "ramdisk" #define DEVICE_REQUEST rd_request #define DEVICE_NR(device) (MINOR(device)) -#define DEVICE_ON(device) -#define DEVICE_OFF(device) #define DEVICE_NO_RANDOM #elif (MAJOR_NR == Z2RAM_MAJOR) @@ -126,8 +125,6 @@ void end_that_request_last(struct request *req); #define DEVICE_NAME "Z2RAM" #define DEVICE_REQUEST do_z2_request #define DEVICE_NR(device) (MINOR(device)) -#define DEVICE_ON(device) -#define DEVICE_OFF(device) #elif (MAJOR_NR == FLOPPY_MAJOR) @@ -137,7 +134,6 @@ static void floppy_off(unsigned int nr); #define DEVICE_INTR do_floppy #define DEVICE_REQUEST do_fd_request #define DEVICE_NR(device) ( (MINOR(device) & 3) | ((MINOR(device) & 0x80 ) >> 5 )) -#define DEVICE_ON(device) #define DEVICE_OFF(device) floppy_off(DEVICE_NR(device)) #elif (MAJOR_NR == HD_MAJOR) @@ -148,16 +144,12 @@ static void floppy_off(unsigned int nr); #define TIMEOUT_VALUE (6*HZ) #define DEVICE_REQUEST do_hd_request #define DEVICE_NR(device) (MINOR(device)>>6) -#define DEVICE_ON(device) -#define DEVICE_OFF(device) #elif (SCSI_DISK_MAJOR(MAJOR_NR)) #define DEVICE_NAME "scsidisk" #define TIMEOUT_VALUE (2*HZ) #define DEVICE_NR(device) (((MAJOR(device) & SD_MAJOR_MASK) << (8 - 4)) + (MINOR(device) >> 4)) -#define DEVICE_ON(device) -#define DEVICE_OFF(device) /* Kludge to use the same number for both char and block major numbers */ #elif (MAJOR_NR == MD_MAJOR) && defined(MD_DRIVER) @@ -165,47 +157,35 @@ static void floppy_off(unsigned int nr); #define DEVICE_NAME "Multiple devices driver" #define DEVICE_REQUEST do_md_request #define DEVICE_NR(device) (MINOR(device)) -#define DEVICE_ON(device) -#define DEVICE_OFF(device) #elif (MAJOR_NR == SCSI_TAPE_MAJOR) #define DEVICE_NAME "scsitape" #define DEVICE_INTR do_st #define DEVICE_NR(device) (MINOR(device) & 0x7f) -#define DEVICE_ON(device) -#define DEVICE_OFF(device) #elif (MAJOR_NR == SCSI_CDROM_MAJOR) #define DEVICE_NAME "CD-ROM" #define DEVICE_NR(device) (MINOR(device)) -#define DEVICE_ON(device) -#define DEVICE_OFF(device) #elif (MAJOR_NR == XT_DISK_MAJOR) #define DEVICE_NAME "xt disk" #define DEVICE_REQUEST do_xd_request #define DEVICE_NR(device) (MINOR(device) >> 6) -#define DEVICE_ON(device) -#define DEVICE_OFF(device) #elif (MAJOR_NR == PS2ESDI_MAJOR) #define DEVICE_NAME "PS/2 ESDI" #define DEVICE_REQUEST do_ps2esdi_request #define DEVICE_NR(device) (MINOR(device) >> 6) -#define DEVICE_ON(device) -#define DEVICE_OFF(device) #elif (MAJOR_NR == CDU31A_CDROM_MAJOR) #define DEVICE_NAME "CDU31A" #define DEVICE_REQUEST do_cdu31a_request #define DEVICE_NR(device) (MINOR(device)) -#define DEVICE_ON(device) -#define DEVICE_OFF(device) #elif (MAJOR_NR == ACSI_MAJOR) && (defined(CONFIG_ATARI_ACSI) || defined(CONFIG_ATARI_ACSI_MODULE)) @@ -213,8 +193,6 @@ static void floppy_off(unsigned int nr); #define DEVICE_INTR do_acsi #define DEVICE_REQUEST do_acsi_request #define DEVICE_NR(device) (MINOR(device) >> 4) -#define DEVICE_ON(device) -#define DEVICE_OFF(device) #elif (MAJOR_NR == MITSUMI_CDROM_MAJOR) @@ -222,8 +200,6 @@ static void floppy_off(unsigned int nr); /* #define DEVICE_INTR do_mcd */ #define DEVICE_REQUEST do_mcd_request #define DEVICE_NR(device) (MINOR(device)) -#define DEVICE_ON(device) -#define DEVICE_OFF(device) #elif (MAJOR_NR == MITSUMI_X_CDROM_MAJOR) @@ -231,48 +207,36 @@ static void floppy_off(unsigned int nr); /* #define DEVICE_INTR do_mcdx */ #define DEVICE_REQUEST do_mcdx_request #define DEVICE_NR(device) (MINOR(device)) -#define DEVICE_ON(device) -#define DEVICE_OFF(device) #elif (MAJOR_NR == MATSUSHITA_CDROM_MAJOR) #define DEVICE_NAME "Matsushita CD-ROM controller #1" #define DEVICE_REQUEST do_sbpcd_request #define DEVICE_NR(device) (MINOR(device)) -#define DEVICE_ON(device) -#define DEVICE_OFF(device) #elif (MAJOR_NR == MATSUSHITA_CDROM2_MAJOR) #define DEVICE_NAME "Matsushita CD-ROM controller #2" #define DEVICE_REQUEST do_sbpcd2_request #define DEVICE_NR(device) (MINOR(device)) -#define DEVICE_ON(device) -#define DEVICE_OFF(device) #elif (MAJOR_NR == MATSUSHITA_CDROM3_MAJOR) #define DEVICE_NAME "Matsushita CD-ROM controller #3" #define DEVICE_REQUEST do_sbpcd3_request #define DEVICE_NR(device) (MINOR(device)) -#define DEVICE_ON(device) -#define DEVICE_OFF(device) #elif (MAJOR_NR == MATSUSHITA_CDROM4_MAJOR) #define DEVICE_NAME "Matsushita CD-ROM controller #4" #define DEVICE_REQUEST do_sbpcd4_request #define DEVICE_NR(device) (MINOR(device)) -#define DEVICE_ON(device) -#define DEVICE_OFF(device) #elif (MAJOR_NR == AZTECH_CDROM_MAJOR) #define DEVICE_NAME "Aztech CD-ROM" #define DEVICE_REQUEST do_aztcd_request #define DEVICE_NR(device) (MINOR(device)) -#define DEVICE_ON(device) -#define DEVICE_OFF(device) #elif (MAJOR_NR == CDU535_CDROM_MAJOR) @@ -280,55 +244,41 @@ static void floppy_off(unsigned int nr); #define DEVICE_INTR do_cdu535 #define DEVICE_REQUEST do_cdu535_request #define DEVICE_NR(device) (MINOR(device)) -#define DEVICE_ON(device) -#define DEVICE_OFF(device) #elif (MAJOR_NR == GOLDSTAR_CDROM_MAJOR) #define DEVICE_NAME "Goldstar R420" #define DEVICE_REQUEST do_gscd_request #define DEVICE_NR(device) (MINOR(device)) -#define DEVICE_ON(device) -#define DEVICE_OFF(device) #elif (MAJOR_NR == CM206_CDROM_MAJOR) #define DEVICE_NAME "Philips/LMS CD-ROM cm206" #define DEVICE_REQUEST do_cm206_request #define DEVICE_NR(device) (MINOR(device)) -#define DEVICE_ON(device) -#define DEVICE_OFF(device) #elif (MAJOR_NR == OPTICS_CDROM_MAJOR) #define DEVICE_NAME "DOLPHIN 8000AT CD-ROM" #define DEVICE_REQUEST do_optcd_request #define DEVICE_NR(device) (MINOR(device)) -#define DEVICE_ON(device) -#define DEVICE_OFF(device) #elif (MAJOR_NR == SANYO_CDROM_MAJOR) #define DEVICE_NAME "Sanyo H94A CD-ROM" #define DEVICE_REQUEST do_sjcd_request #define DEVICE_NR(device) (MINOR(device)) -#define DEVICE_ON(device) -#define DEVICE_OFF(device) #elif (MAJOR_NR == APBLOCK_MAJOR) #define DEVICE_NAME "apblock" #define DEVICE_REQUEST ap_request #define DEVICE_NR(device) (MINOR(device)) -#define DEVICE_ON(device) -#define DEVICE_OFF(device) #elif (MAJOR_NR == DDV_MAJOR) #define DEVICE_NAME "ddv" #define DEVICE_REQUEST ddv_request #define DEVICE_NR(device) (MINOR(device)>>PARTN_BITS) -#define DEVICE_ON(device) -#define DEVICE_OFF(device) #elif (MAJOR_NR == MFM_ACORN_MAJOR) @@ -336,41 +286,30 @@ static void floppy_off(unsigned int nr); #define DEVICE_INTR do_mfm #define DEVICE_REQUEST do_mfm_request #define DEVICE_NR(device) (MINOR(device) >> 6) -#define DEVICE_ON(device) -#define DEVICE_OFF(device) #elif (MAJOR_NR == NBD_MAJOR) #define DEVICE_NAME "nbd" #define DEVICE_REQUEST do_nbd_request #define DEVICE_NR(device) (MINOR(device)) -#define DEVICE_ON(device) -#define DEVICE_OFF(device) - #elif (MAJOR_NR == MDISK_MAJOR) #define DEVICE_NAME "mdisk" #define DEVICE_REQUEST mdisk_request #define DEVICE_NR(device) (MINOR(device)) -#define DEVICE_ON(device) -#define DEVICE_OFF(device) #elif (MAJOR_NR == DASD_MAJOR) #define DEVICE_NAME "dasd" #define DEVICE_REQUEST do_dasd_request #define DEVICE_NR(device) (MINOR(device) >> PARTN_BITS) -#define DEVICE_ON(device) -#define DEVICE_OFF(device) #elif (MAJOR_NR == I2O_MAJOR) #define DEVICE_NAME "I2O block" #define DEVICE_REQUEST do_i2ob_request #define DEVICE_NR(device) (MINOR(device)>>4) -#define DEVICE_ON(device) -#define DEVICE_OFF(device) #elif (MAJOR_NR == COMPAQ_SMART2_MAJOR) @@ -378,11 +317,18 @@ static void floppy_off(unsigned int nr); #define TIMEOUT_VALUE (25*HZ) #define DEVICE_REQUEST do_ida_request0 #define DEVICE_NR(device) (MINOR(device) >> 4) -#define DEVICE_ON(device) -#define DEVICE_OFF(device) #endif /* MAJOR_NR == whatever */ +/* provide DEVICE_xxx defaults, if not explicitly defined + * above in the MAJOR_NR==xxx if-elif tree */ +#ifndef DEVICE_ON +#define DEVICE_ON(device) do {} while (0) +#endif +#ifndef DEVICE_OFF +#define DEVICE_OFF(device) do {} while (0) +#endif + #if (MAJOR_NR != SCSI_TAPE_MAJOR) #if !defined(IDE_DRIVER) @@ -434,7 +380,7 @@ static void (DEVICE_REQUEST)(request_queue_t *); #if ! SCSI_BLK_MAJOR(MAJOR_NR) && (MAJOR_NR != COMPAQ_SMART2_MAJOR) -static void end_request(int uptodate) { +static inline void end_request(int uptodate) { struct request *req = CURRENT; if (end_that_request_first(req, uptodate, DEVICE_NAME)) diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 44853fbe7..851bf3c53 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -150,8 +150,7 @@ extern struct sec_size * blk_sec[MAX_BLKDEV]; extern struct blk_dev_struct blk_dev[MAX_BLKDEV]; extern void grok_partitions(struct gendisk *dev, int drive, unsigned minors, long size); extern void register_disk(struct gendisk *dev, kdev_t first, unsigned minors, struct block_device_operations *ops, long size); -extern void generic_make_request(request_queue_t *q, int rw, - struct buffer_head * bh); +extern void generic_make_request(int rw, struct buffer_head * bh); extern request_queue_t *blk_get_queue(kdev_t dev); extern void blkdev_release_request(struct request *); diff --git a/include/linux/brlock.h b/include/linux/brlock.h index e68940b0f..2fd39cac9 100644 --- a/include/linux/brlock.h +++ b/include/linux/brlock.h @@ -77,7 +77,7 @@ extern void __br_lock_usage_bug (void); #ifdef __BRLOCK_USE_ATOMICS -extern inline void br_read_lock (enum brlock_indices idx) +static inline void br_read_lock (enum brlock_indices idx) { /* * This causes a link-time bug message if an @@ -89,7 +89,7 @@ extern inline void br_read_lock (enum brlock_indices idx) read_lock(&__brlock_array[smp_processor_id()][idx]); } -extern inline void br_read_unlock (enum brlock_indices idx) +static inline void br_read_unlock (enum brlock_indices idx) { if (idx >= __BR_END) __br_lock_usage_bug(); @@ -98,7 +98,7 @@ extern inline void br_read_unlock (enum brlock_indices idx) } #else /* ! __BRLOCK_USE_ATOMICS */ -extern inline void br_read_lock (enum brlock_indices idx) +static inline void br_read_lock (enum brlock_indices idx) { unsigned int *ctr; spinlock_t *lock; @@ -124,7 +124,7 @@ again: } } -extern inline void br_read_unlock (enum brlock_indices idx) +static inline void br_read_unlock (enum brlock_indices idx) { unsigned int *ctr; @@ -143,14 +143,14 @@ extern inline void br_read_unlock (enum brlock_indices idx) extern void FASTCALL(__br_write_lock (enum brlock_indices idx)); extern void FASTCALL(__br_write_unlock (enum brlock_indices idx)); -extern inline void br_write_lock (enum brlock_indices idx) +static inline void br_write_lock (enum brlock_indices idx) { if (idx >= __BR_END) __br_lock_usage_bug(); __br_write_lock(idx); } -extern inline void br_write_unlock (enum brlock_indices idx) +static inline void br_write_unlock (enum brlock_indices idx) { if (idx >= __BR_END) __br_lock_usage_bug(); diff --git a/include/linux/highmem.h b/include/linux/highmem.h index bde781475..3cd0250ee 100644 --- a/include/linux/highmem.h +++ b/include/linux/highmem.h @@ -32,7 +32,7 @@ static __inline__ unsigned long kmap(struct page * page) { #endif /* CONFIG_HIGHMEM */ /* when CONFIG_HIGHMEM is not set these will be plain clear/copy_page */ -extern inline void clear_user_highpage(struct page *page, unsigned long vaddr) +static inline void clear_user_highpage(struct page *page, unsigned long vaddr) { unsigned long kaddr; @@ -41,7 +41,7 @@ extern inline void clear_user_highpage(struct page *page, unsigned long vaddr) kunmap(page); } -extern inline void clear_highpage(struct page *page) +static inline void clear_highpage(struct page *page) { unsigned long kaddr; @@ -50,7 +50,7 @@ extern inline void clear_highpage(struct page *page) kunmap(page); } -extern inline void memclear_highpage(struct page *page, unsigned int offset, unsigned int size) +static inline void memclear_highpage(struct page *page, unsigned int offset, unsigned int size) { unsigned long kaddr; @@ -64,7 +64,7 @@ extern inline void memclear_highpage(struct page *page, unsigned int offset, uns /* * Same but also flushes aliased cache contents to RAM. */ -extern inline void memclear_highpage_flush(struct page *page, unsigned int offset, unsigned int size) +static inline void memclear_highpage_flush(struct page *page, unsigned int offset, unsigned int size) { unsigned long kaddr; @@ -76,7 +76,7 @@ extern inline void memclear_highpage_flush(struct page *page, unsigned int offse kunmap(page); } -extern inline void copy_user_highpage(struct page *to, struct page *from, unsigned long vaddr) +static inline void copy_user_highpage(struct page *to, struct page *from, unsigned long vaddr) { unsigned long vfrom, vto; @@ -87,7 +87,7 @@ extern inline void copy_user_highpage(struct page *to, struct page *from, unsign kunmap(to); } -extern inline void copy_highpage(struct page *to, struct page *from) +static inline void copy_highpage(struct page *to, struct page *from) { unsigned long vfrom, vto; diff --git a/include/linux/jffs.h b/include/linux/jffs.h index 07621e2d5..61e7b66fe 100644 --- a/include/linux/jffs.h +++ b/include/linux/jffs.h @@ -1,14 +1,16 @@ /* * JFFS -- Journalling Flash File System, Linux implementation. * - * Copyright (C) 1999, 2000 Finn Hakansson, Axis Communications, Inc. + * Copyright (C) 1999, 2000 Axis Communications AB. + * + * Created by Finn Hakansson . * * This 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. * - * $Id: jffs.h,v 1.5 2000/06/13 14:22:48 alex Exp $ + * $Id: jffs.h,v 1.11 2000/08/04 12:46:34 dwmw2 Exp $ * * Ported to Linux 2.3.x and MTD: * Copyright (C) 2000 Alexander Larsson (alex@cendio.se), Cendio Systems AB @@ -59,9 +61,6 @@ #define JFFS_MODIFY_DATA 0x04 #define JFFS_MODIFY_EXIST 0x08 -/* Using the garbage collection mechanism. */ -#define USE_GC - struct jffs_control; /* The JFFS raw inode structure: Used for storage on physical media. */ @@ -87,7 +86,7 @@ struct jffs_raw_inode __u8 nsize; /* Name length. */ __u8 nlink; /* Number of links. */ __u8 spare : 6; /* For future use. */ - __u8 rename : 1; /* Is this a special rename? */ + __u8 rename : 1; /* Rename to a name of an already existing file? */ __u8 deleted : 1; /* Has this file been deleted? */ __u8 accurate; /* The inode is obsolete if accurate == 0. */ __u32 dchksum; /* Checksum for the data. */ @@ -161,17 +160,34 @@ struct jffs_file }; +/* This is just a definition of a simple list used for keeping track of + files deleted due to a rename. This list is only used during the + mounting of the file system and only if there have been rename operations + earlier. */ +struct jffs_delete_list +{ + __u32 ino; + struct jffs_delete_list *next; +}; + + /* A struct for the overall file system control. Pointers to jffs_control structs are named `c' in the source code. */ struct jffs_control { - struct super_block *sb; /* Reference to the VFS super block. */ - struct jffs_file *root; /* The root directory file. */ - struct list_head *hash; /* Hash table for finding files by ino. */ - struct jffs_fmcontrol *fmc; /* Flash memory control structure. */ - __u32 hash_len; /* The size of the hash table. */ - __u32 next_ino; /* Next inode number to use for new files. */ - __u16 building_fs; /* Is the file system being built right now? */ + struct super_block *sb; /* Reference to the VFS super block. */ + struct jffs_file *root; /* The root directory file. */ + struct list_head *hash; /* Hash table for finding files by ino. */ + struct jffs_fmcontrol *fmc; /* Flash memory control structure. */ + __u32 hash_len; /* The size of the hash table. */ + __u32 next_ino; /* Next inode number to use for new files. */ + __u16 building_fs; /* Is the file system being built right now? */ + struct jffs_delete_list *delete_list; /* Track deleted files. */ + pid_t thread_pid; /* GC thread's PID */ + struct task_struct *gc_task; /* GC task struct */ + struct semaphore gc_thread_sem; /* GC thread exit mutex */ + __u32 gc_minfree_threshold; /* GC trigger thresholds */ + __u32 gc_maxdirty_threshold; }; diff --git a/include/linux/mm.h b/include/linux/mm.h index 94e30f7c7..a248e939f 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -338,9 +338,6 @@ extern unsigned long FASTCALL(get_zeroed_page(int gfp_mask)); #define __get_dma_pages(gfp_mask, order) \ __get_free_pages((gfp_mask) | GFP_DMA,(order)) -#define virt_to_page(kaddr) (mem_map + MAP_NR(kaddr)) -#define VALID_PAGE(page) ((page - mem_map) < max_mapnr) - /* * The old interface name will be removed in 2.5: */ diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 9f445ec6a..f12c936d8 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -677,9 +677,9 @@ #define PCI_DEVICE_ID_TTI_HPT366 0x0004 #define PCI_VENDOR_ID_VIA 0x1106 +#define PCI_DEVICE_ID_VIA_8363_0 0x0305 #define PCI_DEVICE_ID_VIA_8371_0 0x0391 #define PCI_DEVICE_ID_VIA_8501_0 0x0501 -#define PCI_DEVICE_ID_VIA_8601_0 0x0601 #define PCI_DEVICE_ID_VIA_82C505 0x0505 #define PCI_DEVICE_ID_VIA_82C561 0x0561 #define PCI_DEVICE_ID_VIA_82C586_1 0x0571 @@ -690,25 +690,41 @@ #define PCI_DEVICE_ID_VIA_82C596 0x0596 #define PCI_DEVICE_ID_VIA_82C597_0 0x0597 #define PCI_DEVICE_ID_VIA_82C598_0 0x0598 +#define PCI_DEVICE_ID_VIA_8601_0 0x0601 +#define PCI_DEVICE_ID_VIA_8605_0 0x0605 #define PCI_DEVICE_ID_VIA_82C680 0x0680 #define PCI_DEVICE_ID_VIA_82C686 0x0686 #define PCI_DEVICE_ID_VIA_82C691 0x0691 #define PCI_DEVICE_ID_VIA_82C693 0x0693 +#define PCI_DEVICE_ID_VIA_82C693_1 0x0698 #define PCI_DEVICE_ID_VIA_82C926 0x0926 #define PCI_DEVICE_ID_VIA_82C416 0x1571 #define PCI_DEVICE_ID_VIA_82C595_97 0x1595 #define PCI_DEVICE_ID_VIA_82C586_2 0x3038 #define PCI_DEVICE_ID_VIA_82C586_3 0x3040 +#define PCI_DEVICE_ID_VIA_6305 0x3044 +#define PCI_DEVICE_ID_VIA_82C596_3 0x3050 +#define PCI_DEVICE_ID_VIA_82C596B_3 0x3051 #define PCI_DEVICE_ID_VIA_82C686_4 0x3057 #define PCI_DEVICE_ID_VIA_82C686_5 0x3058 +#define PCI_DEVICE_ID_VIA_8233_5 0x3059 +#define PCI_DEVICE_ID_VIA_8233_7 0x3065 #define PCI_DEVICE_ID_VIA_82C686_6 0x3068 +#define PCI_DEVICE_ID_VIA_8233_0 0x3074 +#define PCI_DEVICE_ID_VIA_8633_0 0x3091 +#define PCI_DEVICE_ID_VIA_8367_0 0x3099 #define PCI_DEVICE_ID_VIA_86C100A 0x6100 #define PCI_DEVICE_ID_VIA_8231 0x8231 +#define PCI_DEVICE_ID_VIA_8231_4 0x8235 +#define PCI_DEVICE_ID_VIA_8365_1 0x8305 #define PCI_DEVICE_ID_VIA_8371_1 0x8391 #define PCI_DEVICE_ID_VIA_8501_1 0x8501 #define PCI_DEVICE_ID_VIA_82C597_1 0x8597 #define PCI_DEVICE_ID_VIA_82C598_1 0x8598 #define PCI_DEVICE_ID_VIA_8601_1 0x8601 +#define PCI_DEVICE_ID_VIA_8505_1 0X8605 +#define PCI_DEVICE_ID_VIA_8633_1 0xB091 +#define PCI_DEVICE_ID_VIA_8367_1 0xB099 #define PCI_VENDOR_ID_SMC2 0x1113 #define PCI_DEVICE_ID_SMC2_1211TX 0x1211 diff --git a/include/video/fbcon.h b/include/video/fbcon.h index e5f26faa4..332cabf7e 100644 --- a/include/video/fbcon.h +++ b/include/video/fbcon.h @@ -681,32 +681,37 @@ static __inline__ void *fb_memmove(void *d, const void *s, size_t count) while (count--) fb_writeb(fb_readb(src++), dst++); } else { - dst = (unsigned long) d + count - 1; - src = (unsigned long) s + count - 1; + dst = (unsigned long) d + count; + src = (unsigned long) s + count; if ((count < 8) || ((dst ^ src) & 3)) goto restdown; if (dst & 1) { - fb_writeb(fb_readb(src--), dst--); + src--; + dst--; count--; + fb_writeb(fb_readb(src), dst); } if (dst & 2) { - fb_writew(fb_readw(src), dst); src -= 2; dst -= 2; count -= 2; + fb_writew(fb_readw(src), dst); } while (count > 3) { - fb_writel(fb_readl(src), dst); src -= 4; dst -= 4; count -= 4; + fb_writel(fb_readl(src), dst); } restdown: - while (count--) - fb_writeb(fb_readb(src--), dst--); + while (count--) { + src--; + dst--; + fb_writeb(fb_readb(src), dst); + } } return d; @@ -744,32 +749,37 @@ static __inline__ void fast_memmove(char *d, const char *s, size_t count) while (count--) fb_writeb(fb_readb(src++), dst++); } else { - dst = (unsigned long) d + count - 1; - src = (unsigned long) s + count - 1; + dst = (unsigned long) d + count; + src = (unsigned long) s + count; if ((count < 8) || ((dst ^ src) & 3)) goto restdown; if (dst & 1) { - fb_writeb(fb_readb(src--), dst--); + src--; + dst--; count--; + fb_writeb(fb_readb(src), dst); } if (dst & 2) { - fb_writew(fb_readw(src), dst); src -= 2; dst -= 2; count -= 2; + fb_writew(fb_readw(src), dst); } while (count > 3) { - fb_writel(fb_readl(src), dst); src -= 4; dst -= 4; count -= 4; + fb_writel(fb_readl(src), dst); } restdown: - while (count--) - fb_writeb(fb_readb(src--), dst--); + while (count--) { + src--; + dst--; + fb_writeb(fb_readb(src), dst); + } } } -- cgit v1.2.3