1 /** @file 2 Machine dependent constants for Intel IA32 Architecture. 3 4 Copyright (c) 2010-2012, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials are licensed and made available under 6 the terms and conditions of the BSD License that accompanies this distribution. 7 The full text of the license may be found at 8 http://opensource.org/licenses/bsd-license. 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 13 * Copyright (c) 1990 The Regents of the University of California. 14 * All rights reserved. 15 * 16 * This code is derived from software contributed to Berkeley by 17 * William Jolitz. 18 * 19 * Redistribution and use in source and binary forms, with or without 20 * modification, are permitted provided that the following conditions 21 * are met: 22 * 1. Redistributions of source code must retain the above copyright 23 * notice, this list of conditions and the following disclaimer. 24 * 2. Redistributions in binary form must reproduce the above copyright 25 * notice, this list of conditions and the following disclaimer in the 26 * documentation and/or other materials provided with the distribution. 27 * 3. Neither the name of the University nor the names of its contributors 28 * may be used to endorse or promote products derived from this software 29 * without specific prior written permission. 30 * 31 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 32 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 33 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 34 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 35 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 39 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 40 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 41 * SUCH DAMAGE. 42 * 43 * @(#)param.h 5.8 (Berkeley) 6/28/91 44 * $NetBSD: param.h,v 1.61 2006/08/28 13:43:35 yamt Exp 45 */ 46 #ifndef _I386_PARAM_H_ 47 #define _I386_PARAM_H_ 48 49 #define _MACHINE i386 50 #define MACHINE "i386" 51 #define _MACHINE_ARCH i386 52 #define MACHINE_ARCH "i386" 53 #define MID_MACHINE MID_I386 54 55 /* 56 * Round p (pointer or byte index) up to a correctly-aligned value 57 * for all data types (int, long, ...). The result is u_int and 58 * must be cast to any desired pointer type. 59 * 60 * ALIGNED_POINTER is a boolean macro that checks whether an address 61 * is valid to fetch data elements of type t from on this architecture. 62 * This does not reflect the optimal alignment, just the possibility 63 * (within reasonable limits). 64 * 65 */ 66 #define ALIGNBYTES (sizeof(int) - 1) 67 #define ALIGN(p) (((EFI_ULONG_T)(p) + ALIGNBYTES) & ~ALIGNBYTES) 68 #define ALIGNED_POINTER(p,t) 1 69 70 #define PGSHIFT 12 /* LOG2(NBPG) */ 71 #define NBPG (1 << PGSHIFT) /* bytes/page */ 72 #define PGOFSET (NBPG-1) /* byte offset into page */ 73 #define NPTEPG (NBPG/(sizeof (pt_entry_t))) 74 75 #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ 76 #define DEV_BSIZE (1 << DEV_BSHIFT) 77 #define BLKDEV_IOSIZE 2048 78 #ifndef MAXPHYS 79 #define MAXPHYS (64 * 1024) /* max raw I/O transfer size */ 80 #endif 81 82 #define SSIZE 1 /* initial stack size/NBPG */ 83 #define SINCR 1 /* increment of stack/NBPG */ 84 85 #ifndef UPAGES 86 #ifdef NOREDZONE 87 #define UPAGES 2 /* pages of u-area */ 88 #else 89 #define UPAGES 3 90 #endif /*NOREDZONE */ 91 #endif /* !defined(UPAGES) */ 92 #define USPACE (UPAGES * NBPG) /* total size of u-area */ 93 94 #ifndef MSGBUFSIZE 95 #define MSGBUFSIZE 4*NBPG /* default message buffer size */ 96 #endif 97 98 /* 99 * Constants related to network buffer management. 100 * MCLBYTES must be no larger than NBPG (the software page size), and, 101 * on machines that exchange pages of input or output buffers with mbuf 102 * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple 103 * of the hardware page size. 104 */ 105 #define MSIZE 256 /* size of an mbuf */ 106 107 #ifndef MCLSHIFT 108 #define MCLSHIFT 11 /* convert bytes to m_buf clusters */ 109 /* 2K cluster can hold Ether frame */ 110 #endif /* MCLSHIFT */ 111 112 #define MCLBYTES (1 << MCLSHIFT) /* size of a m_buf cluster */ 113 114 #ifndef NMBCLUSTERS 115 #ifdef GATEWAY 116 #define NMBCLUSTERS 2048 /* map size, max cluster allocation */ 117 #else 118 #define NMBCLUSTERS 1024 /* map size, max cluster allocation */ 119 #endif 120 #endif 121 122 #ifndef NFS_RSIZE 123 #define NFS_RSIZE 32768 124 #endif 125 #ifndef NFS_WSIZE 126 #define NFS_WSIZE 32768 127 #endif 128 129 /* 130 * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized 131 * logical pages. 132 */ 133 #define NKMEMPAGES_MIN_DEFAULT ((8 * 1024 * 1024) >> PAGE_SHIFT) 134 #define NKMEMPAGES_MAX_DEFAULT ((128 * 1024 * 1024) >> PAGE_SHIFT) 135 136 /* 137 * Mach derived conversion macros 138 */ 139 #define x86_round_pdr(x) ((((EFI_ULONG_T)(x)) + PDOFSET) & ~PDOFSET) 140 #define x86_trunc_pdr(x) ((EFI_ULONG_T)(x) & ~PDOFSET) 141 #define x86_btod(x) ((EFI_ULONG_T)(x) >> PDSHIFT) 142 #define x86_dtob(x) ((EFI_ULONG_T)(x) << PDSHIFT) 143 #define x86_round_page(x) ((((EFI_ULONG_T)(x)) + PGOFSET) & ~PGOFSET) 144 #define x86_trunc_page(x) ((EFI_ULONG_T)(x) & ~PGOFSET) 145 #define x86_btop(x) ((EFI_ULONG_T)(x) >> PGSHIFT) 146 #define x86_ptob(x) ((EFI_ULONG_T)(x) << PGSHIFT) 147 148 #endif /* _I386_PARAM_H_ */ 149