diff options
Diffstat (limited to 'sys/arch/sparc/include/param.h')
| -rw-r--r-- | sys/arch/sparc/include/param.h | 109 |
1 files changed, 56 insertions, 53 deletions
diff --git a/sys/arch/sparc/include/param.h b/sys/arch/sparc/include/param.h index 8754188b97c..34573d970f4 100644 --- a/sys/arch/sparc/include/param.h +++ b/sys/arch/sparc/include/param.h @@ -1,4 +1,5 @@ -/* $NetBSD: param.h,v 1.24 1996/05/15 02:13:48 mrg Exp $ */ +/* $OpenBSD: param.h,v 1.6 1997/08/08 08:26:36 downsj Exp $ */ +/* $NetBSD: param.h,v 1.29 1997/03/10 22:50:37 pk Exp $ */ /* * Copyright (c) 1992, 1993 @@ -64,41 +65,29 @@ * Round p (pointer or byte index) up to a correctly-aligned value for * the machine's strictest data type. The result is u_int and must be * cast to any desired pointer type. + * + * ALIGNED_POINTER is a boolean macro that checks whether an address + * is valid to fetch data elements of type t from on this architecture. + * This does not reflect the optimal alignment, just the possibility + * (within reasonable limits). + * */ -#define ALIGNBYTES 7 -#define ALIGN(p) (((u_int)(p) + ALIGNBYTES) & ~ALIGNBYTES) +#define ALIGNBYTES 7 +#define ALIGN(p) (((u_int)(p) + ALIGNBYTES) & ~ALIGNBYTES) +#define ALIGNED_POINTER(p,t) ((((u_long)(p)) & (sizeof(t)-1)) == 0) #define SUN4_PGSHIFT 13 /* for a sun4 machine */ #define SUN4CM_PGSHIFT 12 /* for a sun4c or sun4m machine */ /* - * Three possible cases: - * sun4 only 8192 bytes/page - * sun4c/sun4m only 4096 bytes/page - * sun4/sun4c/sun4m either of the above - * - * In the later case NBPG, PGOFSET, and PGSHIFT are encoded in variables - * initialized early in locore.s. Since they are variables, rather than - * simple constants, the kernel will not perform slighly worse. + * The following variables are always defined and initialized (in locore) + * so independently compiled modules (e.g. LKMs) can be used irrespective + * of the `options SUN4?' combination a particular kernel was configured with. + * See also the definitions of NBPG, PGOFSET and PGSHIFT below. */ -#if defined(SUN4) && !defined(SUN4C) && !defined(SUN4M) -#define NBPG 8192 /* bytes/page */ -#define PGOFSET (NBPG-1) /* byte offset into page */ -#define PGSHIFT SUN4_PGSHIFT /* log2(NBPG) */ -#endif -#if !defined(SUN4) && (defined(SUN4C) || defined(SUN4M)) -#define NBPG 4096 /* bytes/page */ -#define PGOFSET (NBPG-1) /* byte offset into page */ -#define PGSHIFT SUN4CM_PGSHIFT /* log2(NBPG) */ -#endif -#if defined(SUN4) && (defined(SUN4C) || defined(SUN4M)) #if defined(_KERNEL) && !defined(_LOCORE) extern int nbpg, pgofset, pgshift; #endif -#define NBPG nbpg /* bytes/page */ -#define PGOFSET pgofset /* byte offset into page */ -#define PGSHIFT pgshift /* log2(NBPG) */ -#endif #define KERNBASE 0xf8000000 /* start of kernel virtual space */ #define KERNTEXTOFF 0xf8004000 /* start of kernel text */ @@ -123,8 +112,8 @@ extern int nbpg, pgofset, pgshift; * of the hardware page size. */ #define MSIZE 128 /* size of an mbuf */ +#define MCLBYTES 2048 /* enough for whole Ethernet packet */ #define MCLSHIFT 11 /* log2(MCLBYTES) */ -#define MCLBYTES (1 << MCLSHIFT) /* enough for whole Ethernet packet */ #define MCLOFSET (MCLBYTES - 1) #ifndef NMBCLUSTERS @@ -192,8 +181,10 @@ extern void delay __P((unsigned int)); #define DELAY(n) delay(n) extern int cputyp; +#if 0 extern int cpumod; extern int mmumod; +#endif #endif /* _LOCORE */ #endif /* _KERNEL */ @@ -204,31 +195,19 @@ extern int mmumod; #define CPU_SUN4 0 #define CPU_SUN4C 1 #define CPU_SUN4M 2 -/* - * Values for cpumod (cpu model) variable. XXX currently valid only for sun4 - * or Sun4M - */ -#define SUN4_100 0x22 -#define SUN4_200 0x21 -#define SUN4_300 0x23 -#define SUN4_400 0x24 -#define SUN4M_MS 0x04 /* MicroSPARC-II */ -#define SUN4M_SS 0x40 /* Generic SuperSPARC */ -#define SUN4M_HS 0x10 /* Generic ROSS sparc product (HyperSPARC) */ -#define SUN4M_RT620 0x1f /* Ross HyperSPARC RT620 */ -#define SUN4M_STP1020N 0x41 /* TI SuperSPARC STP1020N */ -#define SUN4M_STP1020P 0x40 /* TI SuperSPARC STP1020P */ -#define SUN4M_STP1020A 0x40 /* TI SuperSPARC STP1020A */ - -/* Values for mmumod (mmu model) variable. Valid only for Sun4M */ -#define SUN4M_MMU_HS 0x1 /* ROSS HyperSparc */ -#define SUN4M_MMU_SS 0x0 /* TI SuperSPARC */ -#define SUN4M_MMU_MS1 0x4 /* MicroSPARC-I (??? XXX) */ -#define SUN4M_MMU_MS 0x0 /* MicroSPARC-II (ugh, conflicts w/SS) */ /* * 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. + * + * Note that whenever the macros defined below evaluate to expressions + * involving variables, the kernel will perform slighly worse due to the + * extra memory references they'll generate. */ #if defined(SUN4M) && defined(SUN4C) && defined(SUN4) # define CPU_ISSUN4M (cputyp == CPU_SUN4M) @@ -236,46 +215,70 @@ extern int mmumod; # define CPU_ISSUN4 (cputyp == CPU_SUN4) # define CPU_ISSUN4OR4C (cputyp == CPU_SUN4 || cputyp == CPU_SUN4C) # define CPU_ISSUN4COR4M (cputyp == CPU_SUN4C || cputyp == CPU_SUN4M) +# define NBPG nbpg +# define PGOFSET pgofset +# define PGSHIFT pgshift #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 #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) +# define NBPG nbpg +# define PGOFSET pgofset +# define PGSHIFT pgshift #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 #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) +# define NBPG nbpg +# define PGOFSET pgofset +# define PGSHIFT pgshift #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 #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 #elif !defined(SUN4M) && !defined(SUN4C) && !defined(SUN4) -# define CPU_ISSUN4M (0) -# define CPU_ISSUN4C (0) -# define CPU_ISSUN4 (0) -# define CPU_ISSUN4OR4C (0) -# define CPU_ISSUN4COR4M (0) +# 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) +# define NBPG nbpg +# define PGOFSET pgofset +# define PGSHIFT pgshift #endif |
