param.h revision d78fab6b4e9be83b781212f6a9f3fde0c092e81d
1/** @file
2    Machine dependent constants for Intel Itanium Architecture(IPF).
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.2 2006/08/28 13:43:35 yamt Exp
45 */
46#ifndef _IA64_PARAM_H_
47#define _IA64_PARAM_H_
48
49#define _MACHINE  ia64
50#define MACHINE   "ia64"
51#define _MACHINE_ARCH ia64
52#define MACHINE_ARCH  "ia64"
53#define MID_MACHINE MID_IA64
54
55#ifdef SMP
56#define MAXCPU    512
57#else
58#define MAXCPU    1
59#endif
60
61#define DEV_BSHIFT  9   /* log2(DEV_BSIZE) */
62#define DEV_BSIZE (1<<DEV_BSHIFT)
63#define BLKDEV_IOSIZE 2048
64
65#ifndef MAXPHYS
66#define MAXPHYS   (64 * 1024) /* max raw I/O transfer size */
67#endif
68
69#define UPAGES    4
70#define USPACE    (UPAGES * NBPG) /* total size of u-area */
71
72#ifndef MSGBUFSIZE
73#define MSGBUFSIZE  NBPG    /* default message buffer size */
74#endif
75
76#ifndef KSTACK_PAGES
77#define KSTACK_PAGES  4   /* pages of kernel stack */
78#endif
79#define KSTACK_GUARD_PAGES 0    /* pages of kstack guard; 0 disables */
80
81/*
82 * Round p (pointer or byte index) up to a correctly-aligned value
83 * for all data types (int, long, ...).   The result is u_int and
84 * must be cast to any desired pointer type.
85 *
86 * ALIGNED_POINTER is a boolean macro that checks whether an address
87 * is valid to fetch data elements of type t from on this architecture.
88 * This does not reflect the optimal alignment, just the possibility
89 * (within reasonable limits).
90 *
91 */
92
93#define ALIGNBYTES              15
94#define ALIGN(p)                (((UINT64)(p) + ALIGNBYTES) &~ ALIGNBYTES)
95#define ALIGNED_POINTER(p,t)    ((((UINT64)(p)) & (sizeof(t)-1)) == 0)
96
97#define ALIGNBYTES32            (sizeof(INT32) - 1)
98#define ALIGN32(p)              (((UINT64)(p) + ALIGNBYTES32) &~ALIGNBYTES32)
99
100#define PGSHIFT       14    /* LOG2(NBPG) */
101#define NBPG          (1 << PGSHIFT)  /* bytes/page */
102#define PGOFSET       (NBPG-1)  /* byte offset into page */
103#define NPTEPG        (NBPG/(sizeof (pt_entry_t)))
104/*
105 * Constants related to network buffer management.
106 * MCLBYTES must be no larger than NBPG (the software page size), and,
107 * on machines that exchange pages of input or output buffers with mbuf
108 * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
109 * of the hardware page size.
110 */
111#define MSIZE         256   /* size of an mbuf */
112
113#ifndef MCLSHIFT
114  #define MCLSHIFT    11    /* convert bytes to m_buf clusters */
115            /* 2K cluster can hold Ether frame */
116#endif  /* MCLSHIFT */
117
118#define MCLBYTES      (1 << MCLSHIFT) /* size of a m_buf cluster */
119
120#ifdef GATEWAY
121  #define NMBCLUSTERS 2048    /* map size, max cluster allocation */
122#else
123  #define NMBCLUSTERS 1024    /* map size, max cluster allocation */
124#endif
125#endif
126
127/*
128 * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized
129 * logical pages.
130 */
131#define NKMEMPAGES_MIN_DEFAULT  ((12 * 1024 * 1024) >> PAGE_SHIFT)
132#define NKMEMPAGES_MAX_DEFAULT  ((128 * 1024 * 1024) >> PAGE_SHIFT)
133
134/*
135 * Mach derived conversion macros
136 */
137
138#define ia64_round_page(x)    ((((EFI_ULONG_T)(x)) + NBPG - 1) & ~(NBPG - 1))
139#define ia64_trunc_page(x)      ((EFI_ULONG_T)(x) & ~(NBPG - 1))
140
141#define ia64_btop(x)            ((EFI_ULONG_T)(x) >> PGSHIFT)
142#define ia64_ptob(x)            ((EFI_ULONG_T)(x) << PGSHIFT)
143
144#endif /* _IA64_PARAM_H_ */
145