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

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

1.1       nbrk        1: /*     $OpenBSD: param.h,v 1.4 2007/05/28 21:02:49 thib Exp $  */
                      2: /*     $NetBSD: param.h,v 1.15 2006/08/28 13:43:35 yamt Exp $  */
                      3:
                      4: /*-
                      5:  * Copyright (c) 2002 The NetBSD Foundation, Inc. All rights reserved.
                      6:  * Copyright (c) 1990 The Regents of the University of California.
                      7:  * All rights reserved.
                      8:  *
                      9:  * This code is derived from software contributed to Berkeley by
                     10:  * William Jolitz.
                     11:  *
                     12:  * Redistribution and use in source and binary forms, with or without
                     13:  * modification, are permitted provided that the following conditions
                     14:  * are met:
                     15:  * 1. Redistributions of source code must retain the above copyright
                     16:  *    notice, this list of conditions and the following disclaimer.
                     17:  * 2. Redistributions in binary form must reproduce the above copyright
                     18:  *    notice, this list of conditions and the following disclaimer in the
                     19:  *    documentation and/or other materials provided with the distribution.
                     20:  * 3. Neither the name of the University nor the names of its contributors
                     21:  *    may be used to endorse or promote products derived from this software
                     22:  *    without specific prior written permission.
                     23:  *
                     24:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     25:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     26:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     27:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     28:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     29:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     30:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     31:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     32:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     33:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     34:  * SUCH DAMAGE.
                     35:  *
                     36:  *     @(#)param.h     5.8 (Berkeley) 6/28/91
                     37:  */
                     38:
                     39: /*
                     40:  * SuperH dependent constants.
                     41:  */
                     42:
                     43: #ifndef _SH_PARAM_H_
                     44: #define        _SH_PARAM_H_
                     45:
                     46: #define        _MACHINE_ARCH   sh
                     47: #define        MACHINE_ARCH    "sh"
                     48:
                     49: #ifndef        MID_MACHINE
                     50: #define        MID_MACHINE     MID_SH3
                     51: #endif
                     52:
                     53: #if defined(_KERNEL) && !defined(_LOCORE)
                     54: #include <sh/cpu.h>
                     55: #endif
                     56:
                     57: /*
                     58:  * We use 4K pages on the sh3/sh4.  Override the PAGE_* definitions
                     59:  * to be compile-time constants.
                     60:  */
                     61: #define        PAGE_SHIFT              12
                     62: #define        PAGE_SIZE               (1 << PAGE_SHIFT)
                     63: #define        PAGE_MASK               (PAGE_SIZE - 1)
                     64:
                     65: #define        PGSHIFT                 PAGE_SHIFT
                     66: #define        NBPG                    PAGE_SIZE
                     67: #define        PGOFSET                 PAGE_MASK
                     68:
                     69: /*
                     70:  * Round p (pointer or byte index) up to a correctly-aligned value
                     71:  * for all data types (int, long, ...).   The result is u_int and
                     72:  * must be cast to any desired pointer type.
                     73:  *
                     74:  * ALIGNED_POINTER is a boolean macro that checks whether an address
                     75:  * is valid to fetch data elements of type t from on this architecture.
                     76:  * This does not reflect the optimal alignment, just the possibility
                     77:  * (within reasonable limits).
                     78:  *
                     79:  */
                     80: #define        ALIGNBYTES              (sizeof(int) - 1)
                     81: #define        ALIGN(p)                (((u_int)(p) + ALIGNBYTES) & ~ALIGNBYTES)
                     82: #define        ALIGNED_POINTER(p, t)   ((((u_long)(p)) & (sizeof(t) - 1)) == 0)
                     83:
                     84: #define        DEV_BSHIFT      9               /* log2(DEV_BSIZE) */
                     85: #define        DEV_BSIZE       (1 << DEV_BSHIFT)
                     86: #define        BLKDEV_IOSIZE   2048
                     87: #define        MAXPHYS         (64 * 1024)     /* max raw I/O transfer size */
                     88:
                     89: /*
                     90:  * u-space.
                     91:  */
                     92: #define        UPAGES          3               /* pages of u-area */
                     93: #define        USPACE          (UPAGES * NBPG) /* total size of u-area */
                     94: #define        USPACE_ALIGN    (0)
                     95: #if UPAGES == 1
                     96: #error "too small u-area"
                     97: #elif UPAGES == 2
                     98: #define        P1_STACK        /* kernel stack is P1-area */
                     99: #else
                    100: #undef P1_STACK        /* kernel stack is P3-area */
                    101: #endif
                    102:
                    103: #ifndef MSGBUFSIZE
                    104: #define        MSGBUFSIZE      NBPG            /* default message buffer size */
                    105: #endif
                    106:
                    107: /* pages to bytes */
                    108: #define        btoc(x)         (((x) + PAGE_MASK) >> PAGE_SHIFT)
                    109: #define        ctob(x)         ((x) << PAGE_SHIFT)
                    110:
                    111: /* pages to disk blocks */
                    112: #define        ctod(x)         ((x) << (PAGE_SHIFT - DEV_BSHIFT))
                    113: #define        dtoc(x)         ((x) >> (PAGE_SHIFT - DEV_BSHIFT))
                    114:
                    115: /* bytes to disk blocks */
                    116: #define        btodb(x)        ((x) >> DEV_BSHIFT)
                    117: #define        dbtob(x)        ((x) << DEV_BSHIFT)
                    118:
                    119: /*
                    120:  * Constants related to network buffer management.
                    121:  */
                    122: #define        NMBCLUSTERS     4096            /* map size, max cluster allocation */
                    123:
                    124: /*
                    125:  * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized
                    126:  * logical pages.
                    127:  */
                    128: #define        NKMEMPAGES_MIN_DEFAULT  ((4 * 1024 * 1024) >> PAGE_SHIFT)
                    129: #define        NKMEMPAGES_MAX_DEFAULT  ((64 * 1024 * 1024) >> PAGE_SHIFT)
                    130:
                    131: #endif /* !_SH3_PARAM_H_ */

CVSweb