[BACK]Return to param.h CVS log [TXT][DIR] Up to [local] / sys / arch / arm / include

Annotation of sys/arch/arm/include/param.h, Revision 1.1.1.1

1.1       nbrk        1: /*     $OpenBSD: param.h,v 1.11 2007/05/28 21:02:49 thib Exp $ */
                      2: /*     $NetBSD: param.h,v 1.9 2002/03/24 03:37:23 thorpej Exp $        */
                      3:
                      4: /*
                      5:  * Copyright (c) 1994,1995 Mark Brinicombe.
                      6:  * All rights reserved.
                      7:  *
                      8:  * Redistribution and use in source and binary forms, with or without
                      9:  * modification, are permitted provided that the following conditions
                     10:  * are met:
                     11:  * 1. Redistributions of source code must retain the above copyright
                     12:  *    notice, this list of conditions and the following disclaimer.
                     13:  * 2. Redistributions in binary form must reproduce the above copyright
                     14:  *    notice, this list of conditions and the following disclaimer in the
                     15:  *    documentation and/or other materials provided with the distribution.
                     16:  * 3. All advertising materials mentioning features or use of this software
                     17:  *    must display the following acknowledgement:
                     18:  *     This product includes software developed by the RiscBSD team.
                     19:  * 4. The name "RiscBSD" nor the name of the author may be used to
                     20:  *    endorse or promote products derived from this software without specific
                     21:  *    prior written permission.
                     22:  *
                     23:  * THIS SOFTWARE IS PROVIDED BY RISCBSD ``AS IS'' AND ANY EXPRESS OR IMPLIED
                     24:  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
                     25:  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
                     26:  * IN NO EVENT SHALL RISCBSD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
                     27:  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
                     28:  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
                     29:  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     30:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     31:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     32:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     33:  * SUCH DAMAGE.
                     34:  */
                     35:
                     36: #ifndef        _ARM_PARAM_H_
                     37: #define        _ARM_PARAM_H_
                     38:
                     39: #define MACHINE_ARCH   "arm"
                     40: #define _MACHINE_ARCH  arm
                     41:
                     42: /*
                     43:  * Machine dependent constants for ARM6+ processors
                     44:  */
                     45: /* These are defined in the Port File before it includes
                     46:  * this file. */
                     47:
                     48: #define        PAGE_SHIFT      12              /* LOG2(NBPG) */
                     49: #define        PGSHIFT         12              /* LOG2(NBPG) */
                     50: #define        PAGE_SIZE       (1 << PAGE_SHIFT)       /* bytes/page */
                     51: #define        NBPG            (1 << PAGE_SHIFT)       /* bytes/page */
                     52: #define        PAGE_MASK       (PAGE_SIZE - 1)
                     53: #define PGOFSET                (PAGE_SIZE - 1)
                     54: #define        NPTEPG          (PAGE_SIZE/(sizeof (pt_entry_t)))
                     55:
                     56: #define UPAGES          2               /* pages of u-area */
                     57: #define USPACE          (UPAGES * PAGE_SIZE) /* total size of u-area */
                     58: #define        USPACE_ALIGN    (0)             /* u-area alignment 0-none */
                     59:
                     60: #ifndef MSGBUFSIZE
                     61: #define MSGBUFSIZE     PAGE_SIZE       /* default message buffer size */
                     62: #endif
                     63:
                     64: /*
                     65:  * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized
                     66:  * logical pages.
                     67:  */
                     68: #define        NKMEMPAGES_MIN_DEFAULT  ((4 * 1024 * 1024) >> PAGE_SHIFT)
                     69: #define        NKMEMPAGES_MAX_DEFAULT  ((64 * 1024 * 1024) >> PAGE_SHIFT)
                     70:
                     71: /* Constants used to divide the USPACE area */
                     72:
                     73: /*
                     74:  * The USPACE area contains :
                     75:  * 1. the user structure for the process
                     76:  * 2. the fp context for FP emulation
                     77:  * 3. the kernel (svc) stack
                     78:  * 4. the undefined instruction stack
                     79:  *
                     80:  * The layout of the area looks like this
                     81:  *
                     82:  * | user area | FP context | undefined stack | kernel stack |
                     83:  *
                     84:  * The size of the user area is known.
                     85:  * The size of the FP context is variable depending of the FP emulator
                     86:  * in use and whether there is hardware FP support. However we can put
                     87:  * an upper limit on it.
                     88:  * The undefined stack needs to be at least 512 bytes. This is a requirement
                     89:  * if the FP emulators
                     90:  * The kernel stack should be at least 4K is size.
                     91:  *
                     92:  * The stack top addresses are used to set the stack pointers. The stack bottom
                     93:  * addresses at the addresses monitored by the diagnostic code for stack overflows
                     94:  *
                     95:  */
                     96:
                     97: #define FPCONTEXTSIZE                  (0x100)
                     98: #define USPACE_SVC_STACK_TOP           (USPACE)
                     99: #define USPACE_SVC_STACK_BOTTOM                (USPACE_SVC_STACK_TOP - 0x1000)
                    100: #define        USPACE_UNDEF_STACK_TOP          (USPACE_SVC_STACK_BOTTOM - 0x10)
                    101: #define USPACE_UNDEF_STACK_BOTTOM      (sizeof(struct user) + FPCONTEXTSIZE + 10)
                    102:
                    103: #ifdef _KERNEL
                    104: #ifndef _LOCORE
                    105: void   delay (unsigned);
                    106: #define DELAY(x)       delay(x)
                    107: #endif
                    108: #endif
                    109:
                    110: /*
                    111:  * Machine dependent constants for all ARM processors
                    112:  */
                    113:
                    114: /*
                    115:  * For KERNEL code:
                    116:  *     MACHINE must be defined by the individual port.  This is so that
                    117:  *     uname returns the correct thing, etc.
                    118:  *
                    119:  *     MACHINE_ARCH may be defined by individual ports as a temporary
                    120:  *     measure while we're finishing the conversion to ELF.
                    121:  *
                    122:  * For non-KERNEL code:
                    123:  *     If ELF, MACHINE and MACHINE_ARCH are forced to "arm/armeb".
                    124:  */
                    125:
                    126:
                    127: #define        MID_MACHINE     MID_ARM6
                    128:
                    129: /*
                    130:  * Round p (pointer or byte index) up to a correctly-aligned value
                    131:  * for all data types (int, long, ...).   The result is u_int and
                    132:  * must be cast to any desired pointer type.
                    133:  *
                    134:  * ALIGNED_POINTER is a boolean macro that checks whether an address
                    135:  * is valid to fetch data elements of type t from on this architecture.
                    136:  * This does not reflect the optimal alignment, just the possibility
                    137:  * (within reasonable limits).
                    138:  *
                    139:  */
                    140: #define ALIGNBYTES             (sizeof(int) - 1)
                    141: #define ALIGN(p)               (((u_int)(p) + ALIGNBYTES) &~ ALIGNBYTES)
                    142: #define ALIGNED_POINTER(p,t)   ((((u_long)(p)) & (sizeof(t)-1)) == 0)
                    143: /* ARM-specific macro to align a stack pointer (downwards). */
                    144: #define STACKALIGNBYTES                (8 - 1)
                    145: #define STACKALIGN(p)          ((u_int)(p) &~ STACKALIGNBYTES)
                    146:
                    147: #define        DEV_BSHIFT      9               /* log2(DEV_BSIZE) */
                    148: #define        DEV_BSIZE       (1 << DEV_BSHIFT)
                    149: #define        BLKDEV_IOSIZE   2048
                    150:
                    151: #ifndef MAXPHYS
                    152: #define        MAXPHYS         65536           /* max I/O transfer size */
                    153: #endif
                    154:
                    155: /* pages ("clicks") to disk blocks */
                    156: #define        ctod(x) ((x) << (PAGE_SHIFT - DEV_BSHIFT))
                    157: #define        dtoc(x) ((x) >> (PAGE_SHIFT - DEV_BSHIFT))
                    158: /*#define      dtob(x) ((x) << DEV_BSHIFT)*/
                    159:
                    160: #define        ctob(x) ((x) << PAGE_SHIFT)
                    161:
                    162: /* bytes to pages */
                    163: #define        btoc(x) (((x) + PAGE_MASK) >> PAGE_SHIFT)
                    164:
                    165: #define        btodb(bytes)                    /* calculates (bytes / DEV_BSIZE) */ \
                    166:        ((bytes) >> DEV_BSHIFT)
                    167: #define        dbtob(db)                       /* calculates (db * DEV_BSIZE) */ \
                    168:        ((db) << DEV_BSHIFT)
                    169:
                    170: /*
                    171:  * Constants related to network buffer management.
                    172:  */
                    173: #define        NMBCLUSTERS     4096            /* map size, max cluster allocation */
                    174:
                    175: #define ovbcopy bcopy
                    176:
                    177: #ifdef _KERNEL
                    178: #ifdef _LOCORE
                    179: #include <machine/psl.h>
                    180: #else
                    181: #include <sys/param.h>
                    182: #include <machine/cpu.h>
                    183: #endif
                    184: #endif
                    185:
                    186: #endif /* _ARM_PARAM_H_ */

CVSweb