Home | History | Annotate | Line # | Download | only in include
param.h revision 1.3
      1  1.3   matt /*	$NetBSD: param.h,v 1.3 2001/07/14 07:31:31 matt Exp $	*/
      2  1.1  bjh21 
      3  1.1  bjh21 /*
      4  1.1  bjh21  * Copyright (c) 1994,1995 Mark Brinicombe.
      5  1.1  bjh21  * All rights reserved.
      6  1.1  bjh21  *
      7  1.1  bjh21  * Redistribution and use in source and binary forms, with or without
      8  1.1  bjh21  * modification, are permitted provided that the following conditions
      9  1.1  bjh21  * are met:
     10  1.1  bjh21  * 1. Redistributions of source code must retain the above copyright
     11  1.1  bjh21  *    notice, this list of conditions and the following disclaimer.
     12  1.1  bjh21  * 2. Redistributions in binary form must reproduce the above copyright
     13  1.1  bjh21  *    notice, this list of conditions and the following disclaimer in the
     14  1.1  bjh21  *    documentation and/or other materials provided with the distribution.
     15  1.1  bjh21  * 3. All advertising materials mentioning features or use of this software
     16  1.1  bjh21  *    must display the following acknowledgement:
     17  1.1  bjh21  *	This product includes software developed by the RiscBSD team.
     18  1.1  bjh21  * 4. The name "RiscBSD" nor the name of the author may be used to
     19  1.1  bjh21  *    endorse or promote products derived from this software without specific
     20  1.1  bjh21  *    prior written permission.
     21  1.1  bjh21  *
     22  1.1  bjh21  * THIS SOFTWARE IS PROVIDED BY RISCBSD ``AS IS'' AND ANY EXPRESS OR IMPLIED
     23  1.1  bjh21  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
     24  1.1  bjh21  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     25  1.1  bjh21  * IN NO EVENT SHALL RISCBSD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
     26  1.1  bjh21  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
     27  1.1  bjh21  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
     28  1.1  bjh21  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     29  1.1  bjh21  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     30  1.1  bjh21  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     31  1.1  bjh21  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     32  1.1  bjh21  * SUCH DAMAGE.
     33  1.1  bjh21  */
     34  1.1  bjh21 
     35  1.1  bjh21 #ifndef	_ARM_PARAM_H_
     36  1.1  bjh21 #define	_ARM_PARAM_H_
     37  1.1  bjh21 
     38  1.1  bjh21 /*
     39  1.1  bjh21  * Machine dependent constants for all ARM processors
     40  1.1  bjh21  */
     41  1.1  bjh21 
     42  1.3   matt /*
     43  1.3   matt  * For KERNEL code:
     44  1.3   matt  *	MACHINE must be defined by the individual port.
     45  1.3   matt  *	MACHINE_ARCH may be defined by an individual port.
     46  1.3   matt  *
     47  1.3   matt  * For non-KERNEL code:
     48  1.3   matt  *	MACHINE && MACHINE_ARCH default to "arm"
     49  1.3   matt  */
     50  1.3   matt 
     51  1.3   matt #ifndef _KERNEL
     52  1.3   matt #ifndef MACHINE
     53  1.3   matt #define	MACHINE		"arm"
     54  1.3   matt #endif
     55  1.3   matt #endif /* !_KERNEL */
     56  1.3   matt 
     57  1.3   matt #ifndef MACHINE_ARCH
     58  1.3   matt #define	MACHINE_ARCH	"arm"
     59  1.3   matt #endif
     60  1.1  bjh21 
     61  1.1  bjh21 #define	MID_MACHINE	MID_ARM6
     62  1.1  bjh21 
     63  1.1  bjh21 /*
     64  1.1  bjh21  * Round p (pointer or byte index) up to a correctly-aligned value
     65  1.1  bjh21  * for all data types (int, long, ...).   The result is u_int and
     66  1.1  bjh21  * must be cast to any desired pointer type.
     67  1.1  bjh21  *
     68  1.1  bjh21  * ALIGNED_POINTER is a boolean macro that checks whether an address
     69  1.1  bjh21  * is valid to fetch data elements of type t from on this architecture.
     70  1.1  bjh21  * This does not reflect the optimal alignment, just the possibility
     71  1.1  bjh21  * (within reasonable limits).
     72  1.1  bjh21  *
     73  1.1  bjh21  */
     74  1.1  bjh21 #define ALIGNBYTES		(sizeof(int) - 1)
     75  1.1  bjh21 #define ALIGN(p)		(((u_int)(p) + ALIGNBYTES) &~ ALIGNBYTES)
     76  1.1  bjh21 #define ALIGNED_POINTER(p,t)	((((u_long)(p)) & (sizeof(t)-1)) == 0)
     77  1.1  bjh21 
     78  1.2   matt #define	DEV_BSHIFT	9		/* log2(DEV_BSIZE) */
     79  1.2   matt #define	DEV_BSIZE	(1 << DEV_BSHIFT)
     80  1.2   matt #define	BLKDEV_IOSIZE	2048
     81  1.2   matt 
     82  1.2   matt #ifndef MAXPHYS
     83  1.2   matt #define	MAXPHYS		65536		/* max I/O transfer size */
     84  1.2   matt #endif
     85  1.2   matt 
     86  1.1  bjh21 /* pages ("clicks") to disk blocks */
     87  1.1  bjh21 #define	ctod(x)	((x) << (PGSHIFT - DEV_BSHIFT))
     88  1.1  bjh21 #define	dtoc(x)	((x) >> (PGSHIFT - DEV_BSHIFT))
     89  1.1  bjh21 /*#define	dtob(x)	((x) << DEV_BSHIFT)*/
     90  1.1  bjh21 
     91  1.1  bjh21 #define	ctob(x)	((x) << PGSHIFT)
     92  1.1  bjh21 
     93  1.1  bjh21 /* bytes to pages */
     94  1.1  bjh21 #define	btoc(x)	(((x) + PGOFSET) >> PGSHIFT)
     95  1.1  bjh21 
     96  1.1  bjh21 #define	btodb(bytes)	 		/* calculates (bytes / DEV_BSIZE) */ \
     97  1.1  bjh21 	((bytes) >> DEV_BSHIFT)
     98  1.1  bjh21 #define	dbtob(db)			/* calculates (db * DEV_BSIZE) */ \
     99  1.1  bjh21 	((db) << DEV_BSHIFT)
    100  1.1  bjh21 
    101  1.1  bjh21 /*
    102  1.1  bjh21  * Map a ``block device block'' to a file system block.
    103  1.1  bjh21  * This should be device dependent, and should use the bsize
    104  1.1  bjh21  * field from the disk label.
    105  1.1  bjh21  * For now though just use DEV_BSIZE.
    106  1.1  bjh21  */
    107  1.1  bjh21 #define	bdbtofsb(bn)	((bn) / (BLKDEV_IOSIZE / DEV_BSIZE))
    108  1.2   matt 
    109  1.2   matt /*
    110  1.2   matt  * Constants related to network buffer management.
    111  1.2   matt  * MCLBYTES must be no larger than NBPG (the software page size), and,
    112  1.2   matt  * on machines that exchange pages of input or output buffers with mbuf
    113  1.2   matt  * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
    114  1.2   matt  * of the hardware page size.
    115  1.2   matt  */
    116  1.2   matt #define	MSIZE		256		/* size of an mbuf */
    117  1.2   matt #define	MCLSHIFT	11		/* convert bytes to m_buf clusters */
    118  1.2   matt #define	MCLBYTES	(1 << MCLSHIFT)	/* size of a m_buf cluster */
    119  1.2   matt #define	MCLOFSET	(MCLBYTES - 1)	/* offset within a m_buf cluster */
    120  1.1  bjh21 
    121  1.1  bjh21 #endif /* _ARM_PARAM_H_ */
    122