param.h revision 84178
1107572Sgrehan/*- 2107572Sgrehan * Copyright (c) 1990 The Regents of the University of California. 3107572Sgrehan * All rights reserved. 4107572Sgrehan * 5107572Sgrehan * This code is derived from software contributed to Berkeley by 6107572Sgrehan * William Jolitz. 7107572Sgrehan * 8107572Sgrehan * Redistribution and use in source and binary forms, with or without 9107572Sgrehan * modification, are permitted provided that the following conditions 10107572Sgrehan * are met: 11107572Sgrehan * 1. Redistributions of source code must retain the above copyright 12107572Sgrehan * notice, this list of conditions and the following disclaimer. 13107572Sgrehan * 2. Redistributions in binary form must reproduce the above copyright 14107572Sgrehan * notice, this list of conditions and the following disclaimer in the 15107572Sgrehan * documentation and/or other materials provided with the distribution. 16107572Sgrehan * 17107572Sgrehan * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 18107572Sgrehan * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19107572Sgrehan * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20107572Sgrehan * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 21107572Sgrehan * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22107572Sgrehan * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23107572Sgrehan * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24107572Sgrehan * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25107572Sgrehan * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26107572Sgrehan * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27107572Sgrehan * SUCH DAMAGE. 28107572Sgrehan * 29107572Sgrehan * from: @(#)param.h 5.8 (Berkeley) 6/28/91 30107572Sgrehan * $FreeBSD: head/sys/sparc64/include/param.h 84178 2001-09-30 18:48:37Z jake $ 31107572Sgrehan */ 32107572Sgrehan 33107572Sgrehan/* 34107572Sgrehan * Machine dependent constants for sparc64. 35107572Sgrehan */ 36107572Sgrehan 37107572Sgrehan#define TODO \ 38107572Sgrehan panic("implement " __func__) 39107572Sgrehan 40107572Sgrehan/* 41173745Sjb * Round p (pointer or byte index) up to a correctly-aligned value 42107572Sgrehan * for all data types (int, long, ...). The result is unsigned int 43107572Sgrehan * and must be cast to any desired pointer type. 44107572Sgrehan */ 45107572Sgrehan#ifndef _ALIGNBYTES 46209885Snwhitehorn#define _ALIGNBYTES 0xf 47209885Snwhitehorn#endif 48209885Snwhitehorn#ifndef _ALIGN 49209885Snwhitehorn#define _ALIGN(p) (((u_long)(p) + _ALIGNBYTES) & ~_ALIGNBYTES) 50209885Snwhitehorn#endif 51107572Sgrehan 52107572Sgrehan#ifndef _MACHINE 53107572Sgrehan#define _MACHINE sparc64 54107572Sgrehan#endif 55107572Sgrehan#ifndef _MACHINE_ARCH 56107572Sgrehan#define _MACHINE_ARCH sparc64 57107572Sgrehan#endif 58107572Sgrehan 59107572Sgrehan#ifndef _NO_NAMESPACE_POLLUTION 60107572Sgrehan 61115396Skan#ifndef _MACHINE_PARAM_H_ 62107572Sgrehan#define _MACHINE_PARAM_H_ 63107572Sgrehan 64115396Skan#ifndef MACHINE 65107572Sgrehan#define MACHINE "sparc64" 66115396Skan#endif 67107572Sgrehan#ifndef MACHINE_ARCH 68107572Sgrehan#define MACHINE_ARCH "sparc64" 69107572Sgrehan#endif 70107572Sgrehan#define MID_MACHINE MID_SPARC64 71107572Sgrehan 72107572Sgrehan/* 73107572Sgrehan * OBJFORMAT_NAMES is a comma-separated list of the object formats 74107572Sgrehan * that are supported on the architecture. 75216695Skib */ 76216695Skib#define OBJFORMAT_NAMES "elf" 77216695Skib#define OBJFORMAT_DEFAULT "elf" 78107572Sgrehan 79107572Sgrehan#ifdef SMP 80107572Sgrehan#define MAXCPU 16 81107572Sgrehan#else 82107572Sgrehan#define MAXCPU 1 83107572Sgrehan#endif /* SMP */ 84107572Sgrehan 85107572Sgrehan#define ALIGNBYTES _ALIGNBYTES 86107572Sgrehan#define ALIGN(p) _ALIGN(p) 87216695Skib 88216695Skib#define PAGE_SHIFT_8K 13 89115396Skan#define PAGE_SIZE_8K (1<<PAGE_SHIFT_8K) 90115396Skan#define PAGE_MASK_8K (PAGE_SIZE_8K-1) 91107572Sgrehan 92216695Skib#define PAGE_SHIFT_64K 16 93216695Skib#define PAGE_SIZE_64K (1<<PAGE_SHIFT_64K) 94216695Skib#define PAGE_MASK_64K (PAGE_SIZE_64K-1) 95216695Skib 96107572Sgrehan#define PAGE_SHIFT_512K 19 97107572Sgrehan#define PAGE_SIZE_512K (1<<PAGE_SHIFT_512K) 98107572Sgrehan#define PAGE_MASK_512K (PAGE_SIZE_512K-1) 99107572Sgrehan 100107572Sgrehan#define PAGE_SHIFT_4M 22 101107572Sgrehan#define PAGE_SIZE_4M (1<<PAGE_SHIFT_4M) 102107572Sgrehan#define PAGE_MASK_4M (PAGE_SIZE_4M-1) 103107572Sgrehan 104107572Sgrehan#define PAGE_SHIFT PAGE_SHIFT_8K /* LOG2(PAGE_SIZE) */ 105107572Sgrehan#define PAGE_SIZE PAGE_SIZE_8K /* bytes/page */ 106115396Skan#define PAGE_MASK PAGE_MASK_8K 107216695Skib 108115396Skan#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ 109209885Snwhitehorn#define DEV_BSIZE (1<<DEV_BSHIFT) 110107572Sgrehan 111115396Skan#ifndef BLKDEV_IOSIZE 112107572Sgrehan#define BLKDEV_IOSIZE PAGE_SIZE /* default block device I/O size */ 113107572Sgrehan#endif 114107572Sgrehan#define DFLTPHYS (64 * 1024) /* default max raw I/O transfer size */ 115107572Sgrehan#define MAXPHYS (128 * 1024) /* max raw I/O transfer size */ 116107572Sgrehan#define MAXDUMPPGS (DFLTPHYS/PAGE_SIZE) 117107572Sgrehan 118107572Sgrehan#define KSTACK_PAGES 4 /* pages of kernel stack (with pcb) */ 119107572Sgrehan#define UAREA_PAGES 1 /* pages of user area */ 120107572Sgrehan 121107572Sgrehan#define KSTACK_GUARD /* compile in kstack guard page */ 122107572Sgrehan#define KSTACK_GUARD_PAGES 1 123107572Sgrehan 124107572Sgrehan/* 125107572Sgrehan * Constants related to network buffer management. 126107572Sgrehan * MCLBYTES must be no larger than PAGE_SIZE. 127107572Sgrehan */ 128107572Sgrehan#ifndef MSIZE 129107572Sgrehan#define MSIZE 256 /* size of an mbuf */ 130107572Sgrehan#endif /* MSIZE */ 131107572Sgrehan 132107572Sgrehan#ifndef MCLSHIFT 133107572Sgrehan#define MCLSHIFT 11 /* convert bytes to mbuf clusters */ 134107572Sgrehan#endif /* MCLSHIFT */ 135107572Sgrehan#define MCLBYTES (1 << MCLSHIFT) /* size of an mbuf cluster */ 136107572Sgrehan 137107572Sgrehan/* 138107572Sgrehan * Some macros for units conversion 139107572Sgrehan */ 140107572Sgrehan 141115396Skan/* clicks to bytes */ 142107572Sgrehan#define ctob(x) ((unsigned long)(x)<<PAGE_SHIFT) 143107572Sgrehan 144107572Sgrehan/* bytes to clicks */ 145107572Sgrehan#define btoc(x) (((unsigned long)(x)+PAGE_MASK)>>PAGE_SHIFT) 146107572Sgrehan 147107572Sgrehan/* bytes to disk blocks */ 148107572Sgrehan#define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ 149107572Sgrehan (daddr_t)((unsigned long)(bytes) >> DEV_BSHIFT) 150107572Sgrehan 151107572Sgrehan/* disk blocks to bytes */ 152115396Skan#define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ 153107572Sgrehan (off_t)((unsigned long)(db) << DEV_BSHIFT) 154107572Sgrehan 155107572Sgrehan/* 156216695Skib * Mach derived conversion macros 157107572Sgrehan */ 158107572Sgrehan#define round_page(x) (((unsigned long)(x) + PAGE_MASK) & ~PAGE_MASK) 159107572Sgrehan#define trunc_page(x) ((unsigned long)(x) & ~PAGE_MASK) 160107572Sgrehan 161107572Sgrehan#define atop(x) ((unsigned long)(x) >> PAGE_SHIFT) 162107572Sgrehan#define ptoa(x) ((unsigned long)(x) << PAGE_SHIFT) 163107572Sgrehan 164115396Skan#define sparc64_btop(x) ((unsigned long)(x) >> PAGE_SHIFT) 165107572Sgrehan#define sparc64_ptob(x) ((unsigned long)(x) << PAGE_SHIFT) 166107572Sgrehan 167107572Sgrehan#define pgtok(x) ((unsigned long)(x) * (PAGE_SIZE / 1024)) 168216939Snwhitehorn 169216939Snwhitehorn#endif /* !_MACHINE_PARAM_H_ */ 170209885Snwhitehorn#endif /* !_NO_NAMESPACE_POLLUTION */ 171107572Sgrehan