summaryrefslogtreecommitdiff
path: root/sys/arch/sparc/include
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2010-07-10 19:32:26 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2010-07-10 19:32:26 +0000
commit9a9eb00f7b2ba1a461a4f0e474e2d8431e727018 (patch)
tree9aced9ad7d9f9287739626262ea6f8bb85e23935 /sys/arch/sparc/include
parentab98f8b4b2be806732331cc202bf10bf268cac9f (diff)
sun4e (i.e. SPARCengine 1e) support. This platform is a mix between sun4 and
sun4c, as it has a sun4c OpenPROM but a sun4 8KB pagesize. VME devices are not supported yet. ok deraadt@
Diffstat (limited to 'sys/arch/sparc/include')
-rw-r--r--sys/arch/sparc/include/param.h180
-rw-r--r--sys/arch/sparc/include/pmap.h8
-rw-r--r--sys/arch/sparc/include/pte.h30
3 files changed, 114 insertions, 104 deletions
diff --git a/sys/arch/sparc/include/param.h b/sys/arch/sparc/include/param.h
index 71cc97bf954..dd5e29b0b39 100644
--- a/sys/arch/sparc/include/param.h
+++ b/sys/arch/sparc/include/param.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: param.h,v 1.41 2010/06/29 21:26:09 miod Exp $ */
+/* $OpenBSD: param.h,v 1.42 2010/07/10 19:32:24 miod Exp $ */
/* $NetBSD: param.h,v 1.29 1997/03/10 22:50:37 pk Exp $ */
/*
@@ -136,115 +136,125 @@ extern int mmumod;
#endif /* _KERNEL */
/*
- * Values for the cputyp variable.
+ * Values for the cputyp variable. Order is important!
*/
#define CPU_SUN4 0
-#define CPU_SUN4C 1
-#define CPU_SUN4M 2
+#define CPU_SUN4E 1
+#define CPU_SUN4C 2
+#define CPU_SUN4M 3
+#define CPU_SUN4D 4
/*
* Shorthand CPU-type macros. Enumerate all eight cases.
* Let compiler optimize away code conditional on constants.
*
- * On a sun4 machine, the page size is 8192, while on a sun4c and sun4m
- * it is 4096. Therefore, in the (SUN4 && (SUN4C || SUN4M)) cases below,
- * NBPG, PGOFSET and PGSHIFT are defined as variables which are initialized
- * early in locore.s after the machine type has been detected.
+ * On sun4 and sun4e machines, the page size is 8192, while on sun4c, sun4d
+ * and sun4m machines, it is 4096. Therefore, in the common case below, the
+ * various pagesize-related defines are defined as variables which are
+ * initialized early in locore.s after the machine type has been detected.
*
* Note that whenever the macros defined below evaluate to expressions
* involving variables, the kernel will perform slightly worse due to the
* extra memory references they'll generate.
*/
-#if defined(SUN4M) && defined(SUN4C) && defined(SUN4)
-# define CPU_ISSUN4M (cputyp == CPU_SUN4M)
-# define CPU_ISSUN4C (cputyp == CPU_SUN4C)
-# define CPU_ISSUN4 (cputyp == CPU_SUN4)
-# define CPU_ISSUN4OR4C (cputyp == CPU_SUN4 || cputyp == CPU_SUN4C)
-# define CPU_ISSUN4COR4M (cputyp == CPU_SUN4C || cputyp == CPU_SUN4M)
-#elif defined(SUN4M) && defined(SUN4C) && !defined(SUN4)
-# define CPU_ISSUN4M (cputyp == CPU_SUN4M)
-# define CPU_ISSUN4C (cputyp == CPU_SUN4C)
-# define CPU_ISSUN4 (0)
-# define CPU_ISSUN4OR4C (cputyp == CPU_SUN4C)
-# define CPU_ISSUN4COR4M (cputyp == CPU_SUN4C || cputyp == CPU_SUN4M)
-# define NBPG 4096
-# define PGOFSET (NBPG-1)
-# define PGSHIFT SUN4CM_PGSHIFT
-# define PAGE_SIZE 4096
-# define PAGE_MASK (PAGE_SIZE - 1)
-# define PAGE_SHIFT SUN4CM_PGSHIFT
-#elif defined(SUN4M) && !defined(SUN4C) && defined(SUN4)
-# define CPU_ISSUN4M (cputyp == CPU_SUN4M)
-# define CPU_ISSUN4C (0)
-# define CPU_ISSUN4 (cputyp == CPU_SUN4)
-# define CPU_ISSUN4OR4C (cputyp == CPU_SUN4)
-# define CPU_ISSUN4COR4M (cputyp == CPU_SUN4M)
-#elif defined(SUN4M) && !defined(SUN4C) && !defined(SUN4)
-# define CPU_ISSUN4M (1)
-# define CPU_ISSUN4C (0)
-# define CPU_ISSUN4 (0)
-# define CPU_ISSUN4OR4C (0)
-# define CPU_ISSUN4COR4M (1)
-# define NBPG 4096
-# define PGOFSET (NBPG-1)
-# define PGSHIFT SUN4CM_PGSHIFT
-# define PAGE_SIZE 4096
+#if (defined(SUN4) || defined(SUN4E)) && !(defined(SUN4C) || defined(SUN4D) || defined(SUN4M))
+# define PAGE_SIZE 8192
# define PAGE_MASK (PAGE_SIZE - 1)
-# define PAGE_SHIFT SUN4CM_PGSHIFT
-#elif !defined(SUN4M) && defined(SUN4C) && defined(SUN4)
-# define CPU_ISSUN4M (0)
-# define CPU_ISSUN4C (cputyp == CPU_SUN4C)
-# define CPU_ISSUN4 (cputyp == CPU_SUN4)
-# define CPU_ISSUN4OR4C (1)
-# define CPU_ISSUN4COR4M (cputyp == CPU_SUN4C)
-#elif !defined(SUN4M) && defined(SUN4C) && !defined(SUN4)
-# define CPU_ISSUN4M (0)
-# define CPU_ISSUN4C (1)
-# define CPU_ISSUN4 (0)
-# define CPU_ISSUN4OR4C (1)
-# define CPU_ISSUN4COR4M (1)
-# define NBPG 4096
-# define PGOFSET (NBPG-1)
-# define PGSHIFT SUN4CM_PGSHIFT
+# define PAGE_SHIFT SUN4_PGSHIFT
+#elif (defined(SUN4C) || defined(SUN4D) || defined(SUN4M)) && !(defined(SUN4) || defined(SUN4E))
# define PAGE_SIZE 4096
# define PAGE_MASK (PAGE_SIZE - 1)
# define PAGE_SHIFT SUN4CM_PGSHIFT
-#elif !defined(SUN4M) && !defined(SUN4C) && defined(SUN4)
-# define CPU_ISSUN4M (0)
-# define CPU_ISSUN4C (0)
-# define CPU_ISSUN4 (1)
-# define CPU_ISSUN4OR4C (1)
-# define CPU_ISSUN4COR4M (0)
-# define NBPG 8192
-# define PGOFSET (NBPG-1)
-# define PGSHIFT SUN4_PGSHIFT
-# define PAGE_SIZE 8192
-# define PAGE_MASK (PAGE_SIZE - 1)
-# define PAGE_SHIFT SUN4_PGSHIFT
-#elif !defined(SUN4M) && !defined(SUN4C) && !defined(SUN4)
-# define CPU_ISSUN4M (cputyp == CPU_SUN4M)
-# define CPU_ISSUN4C (cputyp == CPU_SUN4C)
-# define CPU_ISSUN4 (cputyp == CPU_SUN4)
-# define CPU_ISSUN4OR4C (cputyp == CPU_SUN4 || cputyp == CPU_SUN4C)
-# define CPU_ISSUN4COR4M (cputyp == CPU_SUN4C || cputyp == CPU_SUN4M)
-#endif
-
-#ifndef NBPG
+#else
#ifdef STANDALONE /* boot blocks */
-# define NBPG nbpg
-# define PGOFSET pgofset
-# define PGSHIFT pgshift
# define PAGE_SIZE nbpg
# define PAGE_MASK pgofset
# define PAGE_SHIFT pgshift
#else
-# define NBPG uvmexp.pagesize
-# define PGOFSET uvmexp.pagemask
-# define PGSHIFT uvmexp.pageshift
# define PAGE_SIZE uvmexp.pagesize
# define PAGE_MASK uvmexp.pagemask
# define PAGE_SHIFT uvmexp.pageshift
#endif
#endif
+# define NBPG PAGE_SIZE
+# define PGOFSET PAGE_MASK
+# define PGSHIFT PAGE_SHIFT
+
+#if defined(SUN4) && !(defined(SUN4C) || defined(SUN4D) || defined(SUN4E) || defined(SUN4M))
+# define CPU_ISSUN4 (1)
+#elif defined(SUN4C) && !(defined(SUN4) || defined(SUN4D) || defined(SUN4E) || defined(SUN4M))
+# define CPU_ISSUN4C (1)
+#elif defined(SUN4D) && !(defined(SUN4) || defined(SUN4C) || defined(SUN4E) || defined(SUN4M))
+# define CPU_ISSUN4D (1)
+#elif defined(SUN4E) && !(defined(SUN4) || defined(SUN4C) || defined(SUN4D) || defined(SUN4M))
+# define CPU_ISSUN4E (1)
+#elif defined(SUN4M) && !(defined(SUN4) || defined(SUN4C) || defined(SUN4D) || defined(SUN4E))
+# define CPU_ISSUN4M (1)
+#elif (defined(SUN4) || defined(SUN4C)) && !(defined(SUN4D) || defined(SUN4E) || defined(SUN4M))
+# define CPU_ISSUN4OR4C (1)
+#elif (defined(SUN4) || defined(SUN4C) || defined(SUN4E)) && !(defined(SUN4D) || defined(SUN4M))
+# define CPU_ISSUN4OR4COR4E (1)
+#elif (defined(SUN4) || defined(SUN4E)) && !(defined(SUN4C) || defined(SUN4D) || defined(SUN4M))
+# define CPU_ISSUN4OR4E (1)
+#elif (defined(SUN4C) || defined(SUN4M)) && !(defined(SUN4) || defined(SUN4D) || defined(SUN4E))
+# define CPU_ISSUN4COR4M (1)
+#elif (defined(SUN4D) || defined(SUN4M)) && !(defined(SUN4) || defined(SUN4C) || defined(SUN4E))
+# define CPU_ISSUN4DOR4M (1)
+#endif
+
+#if !defined(CPU_ISSUN4)
+#if defined(SUN4)
+# define CPU_ISSUN4 (cputyp == CPU_SUN4)
+#else
+# define CPU_ISSUN4 (0)
+#endif
+#endif
+#if !defined(CPU_ISSUN4C)
+#if defined(SUN4C)
+# define CPU_ISSUN4C (cputyp == CPU_SUN4C)
+#else
+# define CPU_ISSUN4C (0)
+#endif
+#endif
+#if !defined(CPU_ISSUN4D)
+#if defined(SUN4D)
+# define CPU_ISSUN4D (cputyp == CPU_SUN4D)
+#else
+# define CPU_ISSUN4D (0)
+#endif
+#endif
+#if !defined(CPU_ISSUN4E)
+#if defined(SUN4E)
+# define CPU_ISSUN4E (cputyp == CPU_SUN4E)
+#else
+# define CPU_ISSUN4E (0)
+#endif
+#endif
+#if !defined(CPU_ISSUN4M)
+#if defined(SUN4M)
+# define CPU_ISSUN4M (cputyp == CPU_SUN4M)
+#else
+# define CPU_ISSUN4M (0)
+#endif
+#endif
+
+#if !defined(CPU_ISSUN4OR4C)
+# define CPU_ISSUN4OR4C (CPU_ISSUN4 || CPU_ISSUN4C)
+#endif
+#if !defined(CPU_ISSUN4OR4E)
+# define CPU_ISSUN4OR4E (cputyp <= CPU_SUN4E)
+ /* (CPU_ISSUN4 || CPU_ISSUN4E) */
+#endif
+#if !defined(CPU_ISSUN4OR4COR4E)
+# define CPU_ISSUN4OR4COR4E (cputyp <= CPU_SUN4C)
+ /* (CPU_ISSUN4 || CPU_ISSUN4C || CPU_ISSUN4E) */
+#endif
+#if !defined(CPU_ISSUN4COR4M)
+# define CPU_ISSUN4COR4M (CPU_ISSUN4C || CPU_ISSUN4M)
+#endif
+#if !defined(CPU_ISSUN4DOR4M)
+# define CPU_ISSUN4DOR4M (cputyp >= CPU_SUN4D)
+ /* (CPU_ISSUN4D || CPU_ISSUN4M) */
+#endif
#endif /* _SPARC_PARAM_H_ */
diff --git a/sys/arch/sparc/include/pmap.h b/sys/arch/sparc/include/pmap.h
index e4c1c780dc8..d2727b93faa 100644
--- a/sys/arch/sparc/include/pmap.h
+++ b/sys/arch/sparc/include/pmap.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.h,v 1.47 2010/06/29 21:26:09 miod Exp $ */
+/* $OpenBSD: pmap.h,v 1.48 2010/07/10 19:32:24 miod Exp $ */
/* $NetBSD: pmap.h,v 1.30 1997/08/04 20:00:47 pk Exp $ */
/*
@@ -303,7 +303,7 @@ void pmap_writetext(unsigned char *, int);
/* SUN4/SUN4C SPECIFIC DECLARATIONS */
-#if defined(SUN4) || defined(SUN4C)
+#if defined(SUN4) || defined(SUN4C) || defined(SUN4E)
boolean_t pmap_clear_modify4_4c(struct vm_page *);
boolean_t pmap_clear_reference4_4c(struct vm_page *);
int pmap_enter4_4c(pmap_t, vaddr_t, paddr_t, vm_prot_t, int);
@@ -335,7 +335,7 @@ void pmap_zero_page4m(struct vm_page *);
void pmap_changeprot4m(pmap_t, vaddr_t, vm_prot_t, int);
#endif /* defined SUN4M */
-#if !defined(SUN4M) && (defined(SUN4) || defined(SUN4C))
+#if !(defined(SUN4D) || defined(SUN4M)) && (defined(SUN4) || defined(SUN4C) || defined(SUN4E))
#define pmap_clear_modify pmap_clear_modify4_4c
#define pmap_clear_reference pmap_clear_reference4_4c
@@ -350,7 +350,7 @@ void pmap_changeprot4m(pmap_t, vaddr_t, vm_prot_t, int);
#define pmap_zero_page pmap_zero_page4_4c
#define pmap_changeprot pmap_changeprot4_4c
-#elif defined(SUN4M) && !(defined(SUN4) || defined(SUN4C))
+#elif (defined(SUN4D) || defined(SUN4M)) && !(defined(SUN4) || defined(SUN4C) || defined(SUN4E))
#define pmap_clear_modify pmap_clear_modify4m
#define pmap_clear_reference pmap_clear_reference4m
diff --git a/sys/arch/sparc/include/pte.h b/sys/arch/sparc/include/pte.h
index 0be131b3a24..cd43462a1d2 100644
--- a/sys/arch/sparc/include/pte.h
+++ b/sys/arch/sparc/include/pte.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pte.h,v 1.7 2010/06/18 23:48:11 miod Exp $ */
+/* $OpenBSD: pte.h,v 1.8 2010/07/10 19:32:24 miod Exp $ */
/* $NetBSD: pte.h,v 1.19 1997/08/05 11:00:10 pk Exp $ */
/*
@@ -191,7 +191,7 @@ typedef u_char smeg_t; /* 8 bits needed per Sun-4 regmap entry */
#define SGOFSET (NBPSG - 1) /* mask for segment offset */
/* number of PTEs that map one segment (not number that fit in one segment!) */
-#if defined(SUN4) && (defined(SUN4C) || defined(SUN4M))
+#if (defined(SUN4) || defined(SUN4E)) && (defined(SUN4C) || defined(SUN4D) || defined(SUN4M))
extern int nptesg;
#define NPTESG nptesg /* (which someone will have to initialize) */
#else
@@ -237,28 +237,28 @@ extern int mmu_has_hole;
#define MMU_HOLE_START 0x20000000
#define MMU_HOLE_END 0xe0000000
-#if defined(SUN4M) /* Optimization: sun4m, sun4c have same page */
-#if defined(SUN4) /* size, so they're used interchangeably */
-#define VA_VPG(va) (cputyp==CPU_SUN4 ? VA_SUN4_VPG(va) : VA_SUN4C_VPG(va))
-#define VA_OFF(va) (cputyp==CPU_SUN4 ? VA_SUN4_OFF(va) : VA_SUN4C_OFF(va))
+#if defined(SUN4D) || defined(SUN4M) /* Optimization: sun4c/d/m have same */
+#if defined(SUN4) || defined(SUN4E) /* page size, so they're used interchangeably */
+#define VA_VPG(va) (CPU_ISSUN4OR4E ? VA_SUN4_VPG(va) : VA_SUN4C_VPG(va))
+#define VA_OFF(va) (CPU_ISSUN4OR4E ? VA_SUN4_OFF(va) : VA_SUN4C_OFF(va))
#else
#define VA_VPG(va) VA_SUN4M_VPG(va)
#define VA_OFF(va) VA_SUN4M_OFF(va)
-#endif /* defined SUN4 */
-#else /* 4m not defined */
-#if defined(SUN4) && defined(SUN4C)
-#define VA_VPG(va) (cputyp==CPU_SUN4C ? VA_SUN4C_VPG(va) : VA_SUN4_VPG(va))
-#define VA_OFF(va) (cputyp==CPU_SUN4C ? VA_SUN4C_OFF(va) : VA_SUN4_OFF(va))
+#endif /* defined SUN4 || defined SUN4E */
+#else /* 4d,4m not defined */
+#if (defined(SUN4) || defined(SUN4E)) && defined(SUN4C)
+#define VA_VPG(va) (CPU_ISSUN4C ? VA_SUN4C_VPG(va) : VA_SUN4_VPG(va))
+#define VA_OFF(va) (CPU_ISSUN4C ? VA_SUN4C_OFF(va) : VA_SUN4_OFF(va))
#endif
-#if defined(SUN4C) && !defined(SUN4)
+#if defined(SUN4C) && !(defined(SUN4) || defined(SUN4E))
#define VA_VPG(va) VA_SUN4C_VPG(va)
#define VA_OFF(va) VA_SUN4C_OFF(va)
#endif
-#if !defined(SUN4C) && defined(SUN4)
+#if !defined(SUN4C) && (defined(SUN4) || defined(SUN4E))
#define VA_VPG(va) VA_SUN4_VPG(va)
#define VA_OFF(va) VA_SUN4_OFF(va)
#endif
-#endif /* defined 4m */
+#endif /* defined 4d,4m */
/* there is no `struct pte'; we just use `int'; this is for non-4M only */
#define PG_V 0x80000000
@@ -272,7 +272,7 @@ extern int mmu_has_hole;
#define PG_OBIO 0x04000000 /* on board I/O (incl. SBus on 4c) */
#define PG_VME16 0x08000000 /* 16-bit-data VME space */
#define PG_VME32 0x0c000000 /* 32-bit-data VME space */
-#if defined(SUN4M)
+#if defined(SUN4D) || defined(SUN4M)
#define PG_SUN4M_OBMEM 0x0 /* No type bits=>obmem on 4m */
#define PG_SUN4M_OBIO 0xf /* obio maps to 0xf on 4M */
#define SRMMU_PGTYPE 0xf0000000 /* Top 4 bits of pte PPN give type */