summaryrefslogtreecommitdiffstats
path: root/include/asm-sparc
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-sparc')
-rw-r--r--include/asm-sparc/hardirq.h41
-rw-r--r--include/asm-sparc/highmem.h149
-rw-r--r--include/asm-sparc/irq.h6
-rw-r--r--include/asm-sparc/kmap_types.h10
-rw-r--r--include/asm-sparc/pgalloc.h6
-rw-r--r--include/asm-sparc/softirq.h17
-rw-r--r--include/asm-sparc/stat.h2
-rw-r--r--include/asm-sparc/system.h2
-rw-r--r--include/asm-sparc/vaddrs.h16
9 files changed, 202 insertions, 47 deletions
diff --git a/include/asm-sparc/hardirq.h b/include/asm-sparc/hardirq.h
index 8b7b095ad..cfee071dc 100644
--- a/include/asm-sparc/hardirq.h
+++ b/include/asm-sparc/hardirq.h
@@ -10,26 +10,37 @@
#include <linux/config.h>
#include <linux/threads.h>
-#ifndef CONFIG_SMP
-extern unsigned int __local_irq_count;
-#define local_irq_count(cpu) __local_irq_count
+/* entry.S is sensitive to the offsets of these fields */
+typedef struct {
+ unsigned int __softirq_active;
+ unsigned int __softirq_mask;
+ unsigned int __local_irq_count;
+ unsigned int __local_bh_count;
+ unsigned int __syscall_count;
+} ____cacheline_aligned irq_cpustat_t;
+
+#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */
/*
* Are we in an interrupt context? Either doing bottom half
* or hardware interrupt processing?
*/
-#define in_interrupt() ((__local_irq_count + __local_bh_count) != 0)
+#define in_interrupt() ({ int __cpu = smp_processor_id(); \
+ (local_irq_count(__cpu) + local_bh_count(__cpu) != 0); })
+
+#define in_irq() ({ int __cpu = smp_processor_id(); \
+ (local_irq_count(__cpu) != 0); })
-#define hardirq_trylock(cpu) ((void)(cpu), __local_irq_count == 0)
+#ifndef CONFIG_SMP
+
+#define hardirq_trylock(cpu) (local_irq_count(cpu) == 0)
#define hardirq_endlock(cpu) do { (void)(cpu); } while (0)
-#define hardirq_enter(cpu) (__local_irq_count++)
-#define hardirq_exit(cpu) (__local_irq_count--)
+#define hardirq_enter(cpu) (++local_irq_count(cpu))
+#define hardirq_exit(cpu) (--local_irq_count(cpu))
#define synchronize_irq() barrier()
-#define in_irq() (__local_irq_count != 0)
-
#else
#include <asm/atomic.h>
@@ -37,22 +48,10 @@ extern unsigned int __local_irq_count;
#include <asm/system.h>
#include <asm/smp.h>
-extern unsigned int __local_irq_count[NR_CPUS];
-#define local_irq_count(cpu) __local_irq_count[cpu]
extern unsigned char global_irq_holder;
extern spinlock_t global_irq_lock;
extern atomic_t global_irq_count;
-/*
- * Are we in an interrupt context? Either doing bottom half
- * or hardware interrupt processing?
- */
-#define in_interrupt() ({ int __cpu = smp_processor_id(); \
- (local_irq_count(__cpu) + local_bh_count(__cpu) != 0); })
-
-#define in_irq() ({ int __cpu = smp_processor_id(); \
- (local_irq_count(__cpu) != 0); })
-
static inline void release_irqlock(int cpu)
{
/* if we didn't own the irq lock, just ignore.. */
diff --git a/include/asm-sparc/highmem.h b/include/asm-sparc/highmem.h
new file mode 100644
index 000000000..ede2167e1
--- /dev/null
+++ b/include/asm-sparc/highmem.h
@@ -0,0 +1,149 @@
+/*
+ * highmem.h: virtual kernel memory mappings for high memory
+ *
+ * Used in CONFIG_HIGHMEM systems for memory pages which
+ * are not addressable by direct kernel virtual adresses.
+ *
+ * Copyright (C) 1999 Gerhard Wichert, Siemens AG
+ * Gerhard.Wichert@pdb.siemens.de
+ *
+ *
+ * Redesigned the x86 32-bit VM architecture to deal with
+ * up to 16 Terrabyte physical memory. With current x86 CPUs
+ * we now support up to 64 Gigabytes physical RAM.
+ *
+ * Copyright (C) 1999 Ingo Molnar <mingo@redhat.com>
+ */
+
+#ifndef _ASM_HIGHMEM_H
+#define _ASM_HIGHMEM_H
+
+#ifdef __KERNEL__
+
+#include <linux/config.h>
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <asm/vaddrs.h>
+#include <asm/kmap_types.h>
+#include <asm/pgtable.h>
+
+/* undef for production */
+#define HIGHMEM_DEBUG 1
+
+/* declarations for highmem.c */
+extern unsigned long highstart_pfn, highend_pfn;
+
+extern pte_t *kmap_pte;
+extern pgprot_t kmap_prot;
+extern pte_t *pkmap_page_table;
+
+extern void kmap_init(void) __init;
+
+/*
+ * Right now we initialize only a single pte table. It can be extended
+ * easily, subsequent pte tables have to be allocated in one physical
+ * chunk of RAM.
+ */
+#define LAST_PKMAP 1024
+
+#define LAST_PKMAP_MASK (LAST_PKMAP-1)
+#define PKMAP_NR(virt) ((virt-PKMAP_BASE) >> PAGE_SHIFT)
+#define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT))
+
+extern unsigned long kmap_high(struct page *page);
+extern void kunmap_high(struct page *page);
+
+extern inline unsigned long kmap(struct page *page)
+{
+ if (in_interrupt())
+ BUG();
+ if (page < highmem_start_page)
+ return (unsigned long) page_address(page);
+ return kmap_high(page);
+}
+
+extern inline void kunmap(struct page *page)
+{
+ if (in_interrupt())
+ BUG();
+ if (page < highmem_start_page)
+ return;
+ kunmap_high(page);
+}
+
+/*
+ * The use of kmap_atomic/kunmap_atomic is discouraged - kmap/kunmap
+ * gives a more generic (and caching) interface. But kmap_atomic can
+ * be used in IRQ contexts, so in some (very limited) cases we need
+ * it.
+ */
+extern inline unsigned long kmap_atomic(struct page *page, enum km_type type)
+{
+ unsigned long idx;
+ unsigned long vaddr;
+
+ if (page < highmem_start_page)
+ return (unsigned long) page_address(page);
+
+ idx = type + KM_TYPE_NR*smp_processor_id();
+ vaddr = FIX_KMAP_BEGIN + idx * PAGE_SIZE;
+
+/* XXX Fix - Anton */
+#if 0
+ __flush_cache_one(vaddr);
+#else
+ flush_cache_all();
+#endif
+
+#if HIGHMEM_DEBUG
+ if (!pte_none(*(kmap_pte+idx)))
+ BUG();
+#endif
+ set_pte(kmap_pte+idx, mk_pte(page, kmap_prot));
+/* XXX Fix - Anton */
+#if 0
+ __flush_tlb_one(vaddr);
+#else
+ flush_tlb_all();
+#endif
+
+ return vaddr;
+}
+
+extern inline void kunmap_atomic(unsigned long vaddr, enum km_type type)
+{
+#if HIGHMEM_DEBUG
+ unsigned long idx = type + KM_TYPE_NR*smp_processor_id();
+
+#if 0
+ if (vaddr < FIXADDR_START) // FIXME
+ return;
+#endif
+
+ if (vaddr != FIX_KMAP_BEGIN + idx * PAGE_SIZE)
+ BUG();
+
+/* XXX Fix - Anton */
+#if 0
+ __flush_cache_one(vaddr);
+#else
+ flush_cache_all();
+#endif
+
+ /*
+ * force other mappings to Oops if they'll try to access
+ * this pte without first remap it
+ */
+ pte_clear(kmap_pte+idx);
+/* XXX Fix - Anton */
+#if 0
+ __flush_tlb_one(vaddr);
+#else
+ flush_tlb_all();
+#endif
+#endif
+}
+
+#endif /* __KERNEL__ */
+
+#endif /* _ASM_HIGHMEM_H */
diff --git a/include/asm-sparc/irq.h b/include/asm-sparc/irq.h
index 5859d82e9..4b6dd0dae 100644
--- a/include/asm-sparc/irq.h
+++ b/include/asm-sparc/irq.h
@@ -23,16 +23,14 @@ BTFIXUPDEF_CALL(char *, __irq_itoa, unsigned int)
/* IRQ handler dispatch entry and exit. */
#ifdef CONFIG_SMP
-extern unsigned int __local_irq_count[NR_CPUS];
#define irq_enter(cpu, irq) \
do { hardirq_enter(cpu); \
spin_unlock_wait(&global_irq_lock); \
} while(0)
#define irq_exit(cpu, irq) hardirq_exit(cpu)
#else
-extern unsigned int __local_irq_count;
-#define irq_enter(cpu, irq) (__local_irq_count++)
-#define irq_exit(cpu, irq) (__local_irq_count--)
+#define irq_enter(cpu, irq) (++local_irq_count(cpu))
+#define irq_exit(cpu, irq) (--local_irq_count(cpu))
#endif
/* Dave Redman (djhr@tadpole.co.uk)
diff --git a/include/asm-sparc/kmap_types.h b/include/asm-sparc/kmap_types.h
new file mode 100644
index 000000000..d92d81b20
--- /dev/null
+++ b/include/asm-sparc/kmap_types.h
@@ -0,0 +1,10 @@
+#ifndef _ASM_KMAP_TYPES_H
+#define _ASM_KMAP_TYPES_H
+
+enum km_type {
+ KM_BOUNCE_READ,
+ KM_BOUNCE_WRITE,
+ KM_TYPE_NR
+};
+
+#endif
diff --git a/include/asm-sparc/pgalloc.h b/include/asm-sparc/pgalloc.h
index 20e9d805e..180709c85 100644
--- a/include/asm-sparc/pgalloc.h
+++ b/include/asm-sparc/pgalloc.h
@@ -1,4 +1,4 @@
-/* $Id: pgalloc.h,v 1.6 2000/07/10 20:56:53 anton Exp $ */
+/* $Id: pgalloc.h,v 1.9 2000/08/01 04:53:58 anton Exp $ */
#ifndef _SPARC_PGALLOC_H
#define _SPARC_PGALLOC_H
@@ -85,7 +85,9 @@ BTFIXUPDEF_CALL(void, flush_sig_insns, struct mm_struct *, unsigned long)
#define __flush_page_to_ram(addr) BTFIXUP_CALL(__flush_page_to_ram)(addr)
#define flush_sig_insns(mm,insn_addr) BTFIXUP_CALL(flush_sig_insns)(mm,insn_addr)
-#define flush_page_to_ram(page) __flush_page_to_ram(page_address(page))
+extern void flush_page_to_ram(struct page *page);
+
+#define flush_dcache_page(page) do { } while (0)
extern struct pgtable_cache_struct {
unsigned long *pgd_cache;
diff --git a/include/asm-sparc/softirq.h b/include/asm-sparc/softirq.h
index f35407dc8..100f25a22 100644
--- a/include/asm-sparc/softirq.h
+++ b/include/asm-sparc/softirq.h
@@ -14,26 +14,9 @@
#include <asm/smp.h>
#include <asm/hardirq.h>
-
-#ifdef CONFIG_SMP
-extern unsigned int __local_bh_count[NR_CPUS];
-#define local_bh_count(cpu) __local_bh_count[cpu]
-
#define local_bh_disable() (local_bh_count(smp_processor_id())++)
#define local_bh_enable() (local_bh_count(smp_processor_id())--)
#define in_softirq() (local_bh_count(smp_processor_id()) != 0)
-#else
-
-extern unsigned int __local_bh_count;
-#define local_bh_count(cpu) __local_bh_count
-
-#define local_bh_disable() (__local_bh_count++)
-#define local_bh_enable() (__local_bh_count--)
-
-#define in_softirq() (__local_bh_count != 0)
-
-#endif /* SMP */
-
#endif /* __SPARC_SOFTIRQ_H */
diff --git a/include/asm-sparc/stat.h b/include/asm-sparc/stat.h
index a70d4df3c..7be8e7092 100644
--- a/include/asm-sparc/stat.h
+++ b/include/asm-sparc/stat.h
@@ -1,4 +1,4 @@
-/* $Id: stat.h,v 1.11 2000/01/16 15:22:53 jj Exp $ */
+/* $Id: stat.h,v 1.12 2000/08/04 05:35:55 davem Exp $ */
#ifndef _SPARC_STAT_H
#define _SPARC_STAT_H
diff --git a/include/asm-sparc/system.h b/include/asm-sparc/system.h
index 4174294ca..0a101cacd 100644
--- a/include/asm-sparc/system.h
+++ b/include/asm-sparc/system.h
@@ -1,4 +1,4 @@
-/* $Id: system.h,v 1.82 2000/05/09 17:40:15 davem Exp $ */
+/* $Id: system.h,v 1.83 2000/08/04 05:35:55 davem Exp $ */
#include <linux/config.h>
#ifndef __SPARC_SYSTEM_H
diff --git a/include/asm-sparc/vaddrs.h b/include/asm-sparc/vaddrs.h
index 5cbec8210..704f79003 100644
--- a/include/asm-sparc/vaddrs.h
+++ b/include/asm-sparc/vaddrs.h
@@ -1,4 +1,4 @@
-/* $Id: vaddrs.h,v 1.25 2000/06/05 06:08:46 anton Exp $ */
+/* $Id: vaddrs.h,v 1.26 2000/08/01 04:53:58 anton Exp $ */
#ifndef _SPARC_VADDRS_H
#define _SPARC_VADDRS_H
@@ -12,6 +12,20 @@
* Copyright (C) 2000 Anton Blanchard (anton@linuxcare.com)
*/
+#define SRMMU_MAXMEM 0x0c000000
+
+#define SRMMU_NOCACHE_VADDR 0xfc000000 /* KERNBASE + SRMMU_MAXMEM */
+/* XXX Make this dynamic based on ram size - Anton */
+#define SRMMU_NOCACHE_NPAGES 256
+#define SRMMU_NOCACHE_SIZE (SRMMU_NOCACHE_NPAGES * PAGE_SIZE)
+#define SRMMU_NOCACHE_END (SRMMU_NOCACHE_VADDR + SRMMU_NOCACHE_SIZE)
+
+#define FIX_KMAP_BEGIN 0xfc100000
+#define FIX_KMAP_END (FIX_KMAP_BEGIN + ((KM_TYPE_NR*NR_CPUS)-1)*PAGE_SIZE)
+
+#define PKMAP_BASE 0xfc140000
+#define PKMAP_BASE_END (PKMAP_BASE+LAST_PKMAP*PAGE_SIZE)
+
#define SUN4M_IOBASE_VADDR 0xfd000000 /* Base for mapping pages */
#define IOBASE_VADDR 0xfe000000
#define IOBASE_END 0xfe300000