Annotation of sys/arch/solbourne/include/param.h, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: param.h,v 1.6 2007/05/28 21:02:49 thib Exp $ */
2: /* OpenBSD: param.h,v 1.29 2004/08/06 22:31:31 mickey Exp */
3:
4: /*
5: * Copyright (c) 1992, 1993
6: * The Regents of the University of California. All rights reserved.
7: *
8: * This software was developed by the Computer Systems Engineering group
9: * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
10: * contributed to Berkeley.
11: *
12: * All advertising materials mentioning features or use of this software
13: * must display the following acknowledgement:
14: * This product includes software developed by the University of
15: * California, Lawrence Berkeley Laboratory.
16: *
17: * Redistribution and use in source and binary forms, with or without
18: * modification, are permitted provided that the following conditions
19: * are met:
20: * 1. Redistributions of source code must retain the above copyright
21: * notice, this list of conditions and the following disclaimer.
22: * 2. Redistributions in binary form must reproduce the above copyright
23: * notice, this list of conditions and the following disclaimer in the
24: * documentation and/or other materials provided with the distribution.
25: * 3. Neither the name of the University nor the names of its contributors
26: * may be used to endorse or promote products derived from this software
27: * without specific prior written permission.
28: *
29: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
30: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
31: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
32: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
33: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
35: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
38: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39: * SUCH DAMAGE.
40: *
41: * @(#)param.h 8.1 (Berkeley) 6/11/93
42: */
43:
44: #ifndef _SOLBOURNE_PARAM_H_
45: #define _SOLBOURNE_PARAM_H_
46:
47: #define _MACHINE solbourne
48: #define MACHINE "solbourne"
49: #define _MACHINE_ARCH sparc
50: #define MACHINE_ARCH "sparc"
51: #define MID_MACHINE MID_SPARC
52:
53: #ifdef _KERNEL /* XXX */
54: #ifndef _LOCORE /* XXX */
55: #include <machine/cpu.h> /* XXX */
56: #endif /* XXX */
57: #endif /* XXX */
58:
59: /*
60: * Round p (pointer or byte index) up to a correctly-aligned value for
61: * the machine's strictest data type. The result is u_int and must be
62: * cast to any desired pointer type.
63: *
64: * ALIGNED_POINTER is a boolean macro that checks whether an address
65: * is valid to fetch data elements of type t from on this architecture.
66: * This does not reflect the optimal alignment, just the possibility
67: * (within reasonable limits).
68: *
69: */
70: #define ALIGNBYTES 7
71: #define ALIGN(p) (((u_int)(p) + ALIGNBYTES) & ~ALIGNBYTES)
72: #define ALIGNED_POINTER(p,t) ((((u_long)(p)) & (sizeof(t)-1)) == 0)
73:
74: #define SUN4_PGSHIFT 13 /* for a sun4 machine */
75: #define SUN4CM_PGSHIFT 12 /* for a sun4c or sun4m machine */
76:
77: #define KERNBASE 0xfd080000
78: #define KERNTEXTOFF 0xfd084000 /* start of kernel text */
79:
80: #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
81: #define DEV_BSIZE (1 << DEV_BSHIFT)
82: #define BLKDEV_IOSIZE 2048
83: #define MAXPHYS (64 * 1024)
84:
85: #define USPACE 8192
86: #define USPACE_ALIGN (0) /* u-area alignment 0-none */
87:
88: /*
89: * Constants related to network buffer management.
90: */
91: #define NMBCLUSTERS 2048 /* map size, max cluster allocation */
92:
93: #define MSGBUFSIZE PAGE_SIZE /* larger than on sparc! */
94: #define MSGBUF_PA PTW1_TO_PHYS(KERNBASE) /* msgbuf physical address */
95:
96: /*
97: * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized
98: * logical pages.
99: */
100: #define NKMEMPAGES_MIN_DEFAULT ((4 * 1024 * 1024) >> PAGE_SHIFT)
101: #define NKMEMPAGES_MAX_DEFAULT ((64 * 1024 * 1024) >> PAGE_SHIFT)
102:
103: /* pages ("clicks") to disk blocks */
104: #define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT))
105: #define dtoc(x) ((x) >> (PGSHIFT - DEV_BSHIFT))
106:
107: /* pages to bytes */
108: #define ctob(x) ((x) << PGSHIFT)
109: #define btoc(x) (((x) + PGOFSET) >> PGSHIFT)
110:
111: /* bytes to disk blocks */
112: #define btodb(x) ((x) >> DEV_BSHIFT)
113: #define dbtob(x) ((x) << DEV_BSHIFT)
114:
115: /*
116: * dvmamap manages a range of DVMA addresses intended to create double
117: * mappings of physical memory. In a way, `dvmamap' is a submap of the
118: * VM map `phys_map'. The difference is the use of the `resource map'
119: * routines to manage page allocation, allowing DVMA addresses to be
120: * allocated and freed from within interrupt routines.
121: *
122: * Note that `phys_map' can still be used to allocate memory-backed pages
123: * in DVMA space.
124: */
125: #ifdef _KERNEL
126: #ifndef _LOCORE
127: extern vaddr_t dvma_base;
128: extern vaddr_t dvma_end;
129: extern struct extent *dvmamap_extent;
130:
131: extern caddr_t kdvma_mapin(caddr_t, int, int);
132: extern caddr_t dvma_malloc_space(size_t, void *, int, int);
133: extern void dvma_free(caddr_t, size_t, void *);
134: #define dvma_malloc(len,kaddr,flags) dvma_malloc_space(len,kaddr,flags,0)
135:
136: extern void delay(unsigned int);
137: #define DELAY(n) delay(n)
138:
139: extern int cputyp;
140: #if 0
141: extern int cpumod;
142: extern int mmumod;
143: #endif
144:
145: #endif /* _LOCORE */
146: #endif /* _KERNEL */
147:
148: /*
149: * Values for the cputyp variable.
150: */
151: #define CPU_KAP 5
152:
153: /*
154: * Shorthand CPU-type macros.
155: * Let compiler optimize away code conditional on constants.
156: */
157: #define CPU_ISSUN4M (0)
158: #define CPU_ISSUN4C (0)
159: #define CPU_ISSUN4 (0)
160: #define CPU_ISSUN4OR4C (0)
161: #define CPU_ISSUN4COR4M (0)
162: #define CPU_ISKAP (1)
163: #define NBPG 8192
164: #define PGOFSET (NBPG - 1)
165: #define PGSHIFT SUN4_PGSHIFT
166: #define PAGE_SIZE 8192
167: #define PAGE_MASK (PAGE_SIZE - 1)
168: #define PAGE_SHIFT SUN4_PGSHIFT
169:
170: #endif /* _SOLBOURNE_PARAM_H_ */
CVSweb