summaryrefslogtreecommitdiffstats
path: root/include/asm-sh
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-sh')
-rw-r--r--include/asm-sh/bugs.h13
-rw-r--r--include/asm-sh/delay.h2
-rw-r--r--include/asm-sh/dma.h7
-rw-r--r--include/asm-sh/hd64461.h45
-rw-r--r--include/asm-sh/ide.h39
-rw-r--r--include/asm-sh/io.h388
-rw-r--r--include/asm-sh/io_generic.h52
-rw-r--r--include/asm-sh/io_hd64461.h67
-rw-r--r--include/asm-sh/io_od.h78
-rw-r--r--include/asm-sh/io_se.h81
-rw-r--r--include/asm-sh/io_unknown.h86
-rw-r--r--include/asm-sh/irq.h65
-rw-r--r--include/asm-sh/keyboard.h13
-rw-r--r--include/asm-sh/machvec.h96
-rw-r--r--include/asm-sh/machvec_init.h52
-rw-r--r--include/asm-sh/mmu_context.h4
-rw-r--r--include/asm-sh/page.h3
-rw-r--r--include/asm-sh/pci.h21
-rw-r--r--include/asm-sh/pgtable.h5
-rw-r--r--include/asm-sh/processor.h2
20 files changed, 1002 insertions, 117 deletions
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 <linux/config.h>
-#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 <linux/config.h>
+#include <asm/machvec.h>
#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 <asm/cache.h>
+#include <asm/system.h>
+#include <linux/config.h>
-#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 <asm/machvec.h>
+
+# 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 <asm/io_hd64461.h>
+# elif defined(CONFIG_SH_OVERDRIVE)
+# include <asm/io_od.h>
+# elif defined(CONFIG_SH_SOLUTION_ENGINE)
+# include <asm/io_se.h>
+# elif defined(CONFIG_SH_UNKNOWN)
+# include <asm/io_unknown.h>
+# 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 <asm/addrspace.h>
@@ -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 <asm/io_generic.h>
+
+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 <asm/io_generic.h>
+
+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 <asm/io_generic.h>
+
+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 <linux/config.h>
+#include <asm/machvec.h>
#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 <linux/config.h>
+
+#include <asm/machvec.h>
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 <linux/config.h>
+#include <linux/types.h>
+
+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