param.h revision 80708
180708Sjake/*- 280708Sjake * Copyright (c) 1990 The Regents of the University of California. 380708Sjake * All rights reserved. 480708Sjake * 580708Sjake * This code is derived from software contributed to Berkeley by 680708Sjake * William Jolitz. 780708Sjake * 880708Sjake * Redistribution and use in source and binary forms, with or without 980708Sjake * modification, are permitted provided that the following conditions 1080708Sjake * are met: 1180708Sjake * 1. Redistributions of source code must retain the above copyright 1280708Sjake * notice, this list of conditions and the following disclaimer. 1380708Sjake * 2. Redistributions in binary form must reproduce the above copyright 1480708Sjake * notice, this list of conditions and the following disclaimer in the 1580708Sjake * documentation and/or other materials provided with the distribution. 1680708Sjake * 1780708Sjake * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 1880708Sjake * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1980708Sjake * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2080708Sjake * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2180708Sjake * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2280708Sjake * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2380708Sjake * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2480708Sjake * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2580708Sjake * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2680708Sjake * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2780708Sjake * SUCH DAMAGE. 2880708Sjake * 2980708Sjake * from: @(#)param.h 5.8 (Berkeley) 6/28/91 3080708Sjake * $FreeBSD: head/sys/sparc64/include/param.h 80708 2001-07-31 05:45:16Z jake $ 3180708Sjake */ 3280708Sjake 3380708Sjake/* 3480708Sjake * Machine dependent constants for sparc64. 3580708Sjake */ 3680708Sjake 3780708Sjake#define TODO \ 3880708Sjake panic("implement " __func__) 3980708Sjake 4080708Sjake/* 4180708Sjake * Round p (pointer or byte index) up to a correctly-aligned value 4280708Sjake * for all data types (int, long, ...). The result is unsigned int 4380708Sjake * and must be cast to any desired pointer type. 4480708Sjake */ 4580708Sjake#ifndef _ALIGNBYTES 4680708Sjake#define _ALIGNBYTES 0xf 4780708Sjake#endif 4880708Sjake#ifndef _ALIGN 4980708Sjake#define _ALIGN(p) (((u_long)(p) + _ALIGNBYTES) & ~_ALIGNBYTES) 5080708Sjake#endif 5180708Sjake 5280708Sjake#ifndef _MACHINE 5380708Sjake#define _MACHINE sparc64 5480708Sjake#endif 5580708Sjake#ifndef _MACHINE_ARCH 5680708Sjake#define _MACHINE_ARCH sparc64 5780708Sjake#endif 5880708Sjake 5980708Sjake#ifndef _NO_NAMESPACE_POLLUTION 6080708Sjake 6180708Sjake#ifndef _MACHINE_PARAM_H_ 6280708Sjake#define _MACHINE_PARAM_H_ 6380708Sjake 6480708Sjake#ifndef MACHINE 6580708Sjake#define MACHINE "sparc64" 6680708Sjake#endif 6780708Sjake#ifndef MACHINE_ARCH 6880708Sjake#define MACHINE_ARCH "sparc64" 6980708Sjake#endif 7080708Sjake#define MID_MACHINE MID_SPARC64 7180708Sjake 7280708Sjake/* 7380708Sjake * OBJFORMAT_NAMES is a comma-separated list of the object formats 7480708Sjake * that are supported on the architecture. 7580708Sjake */ 7680708Sjake#define OBJFORMAT_NAMES "elf" 7780708Sjake#define OBJFORMAT_DEFAULT "elf" 7880708Sjake 7980708Sjake#ifdef SMP 8080708Sjake#define MAXCPU 16 8180708Sjake#else 8280708Sjake#define MAXCPU 1 8380708Sjake#endif /* SMP */ 8480708Sjake 8580708Sjake#define ALIGNBYTES _ALIGNBYTES 8680708Sjake#define ALIGN(p) _ALIGN(p) 8780708Sjake 8880708Sjake#define PAGE_SHIFT 13 /* LOG2(PAGE_SIZE) */ 8980708Sjake#define PAGE_SIZE (1<<PAGE_SHIFT) /* bytes/page */ 9080708Sjake#define PAGE_MASK (PAGE_SIZE-1) 9180708Sjake#define NPTEPG (PAGE_SIZE/(sizeof (pt_entry_t))) 9280708Sjake 9380708Sjake#define NPDEPG (PAGE_SIZE/(sizeof (pd_entry_t))) 9480708Sjake#define PDRSHIFT 22 /* LOG2(NBPDR) */ 9580708Sjake#define NBPDR (1<<PDRSHIFT) /* bytes/page dir */ 9680708Sjake#define PDRMASK (NBPDR-1) 9780708Sjake 9880708Sjake#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ 9980708Sjake#define DEV_BSIZE (1<<DEV_BSHIFT) 10080708Sjake 10180708Sjake#ifndef BLKDEV_IOSIZE 10280708Sjake#define BLKDEV_IOSIZE PAGE_SIZE /* default block device I/O size */ 10380708Sjake#endif 10480708Sjake#define DFLTPHYS (64 * 1024) /* default max raw I/O transfer size */ 10580708Sjake#define MAXPHYS (128 * 1024) /* max raw I/O transfer size */ 10680708Sjake#define MAXDUMPPGS (DFLTPHYS/PAGE_SIZE) 10780708Sjake 10880708Sjake#define IOPAGES 2 /* pages of i/o permission bitmap */ 10980708Sjake#define UPAGES 2 /* pages of u-area */ 11080708Sjake 11180708Sjake/* 11280708Sjake * Constants related to network buffer management. 11380708Sjake * MCLBYTES must be no larger than PAGE_SIZE. 11480708Sjake */ 11580708Sjake#ifndef MSIZE 11680708Sjake#define MSIZE 256 /* size of an mbuf */ 11780708Sjake#endif /* MSIZE */ 11880708Sjake 11980708Sjake#ifndef MCLSHIFT 12080708Sjake#define MCLSHIFT 11 /* convert bytes to mbuf clusters */ 12180708Sjake#endif /* MCLSHIFT */ 12280708Sjake#define MCLBYTES (1 << MCLSHIFT) /* size of an mbuf cluster */ 12380708Sjake 12480708Sjake/* 12580708Sjake * Some macros for units conversion 12680708Sjake */ 12780708Sjake 12880708Sjake/* clicks to bytes */ 12980708Sjake#define ctob(x) ((x)<<PAGE_SHIFT) 13080708Sjake 13180708Sjake/* bytes to clicks */ 13280708Sjake#define btoc(x) (((unsigned)(x)+PAGE_MASK)>>PAGE_SHIFT) 13380708Sjake 13480708Sjake/* 13580708Sjake * btodb() is messy and perhaps slow because `bytes' may be an off_t. We 13680708Sjake * want to shift an unsigned type to avoid sign extension and we don't 13780708Sjake * want to widen `bytes' unnecessarily. Assume that the result fits in 13880708Sjake * a daddr_t. 13980708Sjake */ 14080708Sjake#define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ 14180708Sjake (sizeof (bytes) > sizeof(long) \ 14280708Sjake ? (daddr_t)((unsigned long long)(bytes) >> DEV_BSHIFT) \ 14380708Sjake : (daddr_t)((unsigned long)(bytes) >> DEV_BSHIFT)) 14480708Sjake 14580708Sjake#define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ 14680708Sjake ((off_t)(db) << DEV_BSHIFT) 14780708Sjake 14880708Sjake/* 14980708Sjake * Mach derived conversion macros 15080708Sjake */ 15180708Sjake#define trunc_page(x) ((unsigned long)(x) & ~PAGE_MASK) 15280708Sjake#define round_page(x) (((unsigned long)(x) + PAGE_MASK) & ~PAGE_MASK) 15380708Sjake#define trunc_4mpage(x) ((unsigned long)(x) & ~PDRMASK) 15480708Sjake#define round_4mpage(x) ((((unsigned long)(x)) + PDRMASK) & ~PDRMASK) 15580708Sjake 15680708Sjake#define atop(x) ((unsigned long)(x) >> PAGE_SHIFT) 15780708Sjake#define ptoa(x) ((unsigned long)(x) << PAGE_SHIFT) 15880708Sjake 15980708Sjake#define sparc64_btop(x) ((unsigned long)(x) >> PAGE_SHIFT) 16080708Sjake#define sparc64_ptob(x) ((unsigned long)(x) << PAGE_SHIFT) 16180708Sjake 16280708Sjake#define pgtok(x) ((unsigned long)(x) * (PAGE_SIZE / 1024)) 16380708Sjake 16480708Sjake#endif /* !_MACHINE_PARAM_H_ */ 16580708Sjake#endif /* !_NO_NAMESPACE_POLLUTION */ 166