]> git.proxmox.com Git - mirror_edk2.git/blame - StdLib/Include/Arm/machine/param.h
EmbeddedPkg: Extend NvVarStoreFormattedLib LIBRARY_CLASS
[mirror_edk2.git] / StdLib / Include / Arm / machine / param.h
CommitLineData
c614ca50 1/* $NetBSD: param.h,v 1.13 2010/05/06 19:10:26 joerg Exp $ */\r
2\r
3/*\r
4 * Copyright (c) 1994,1995 Mark Brinicombe.\r
5 * All rights reserved.\r
6 *\r
7 * Redistribution and use in source and binary forms, with or without\r
8 * modification, are permitted provided that the following conditions\r
9 * are met:\r
10 * 1. Redistributions of source code must retain the above copyright\r
11 * notice, this list of conditions and the following disclaimer.\r
12 * 2. Redistributions in binary form must reproduce the above copyright\r
13 * notice, this list of conditions and the following disclaimer in the\r
14 * documentation and/or other materials provided with the distribution.\r
15 * 3. All advertising materials mentioning features or use of this software\r
16 * must display the following acknowledgement:\r
17 * This product includes software developed by the RiscBSD team.\r
18 * 4. The name "RiscBSD" nor the name of the author may be used to\r
19 * endorse or promote products derived from this software without specific\r
20 * prior written permission.\r
21 *\r
22 * THIS SOFTWARE IS PROVIDED BY RISCBSD ``AS IS'' AND ANY EXPRESS OR IMPLIED\r
23 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\r
24 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\r
25 * IN NO EVENT SHALL RISCBSD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\r
26 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\r
27 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\r
28 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
32 * SUCH DAMAGE.\r
33 */\r
34\r
35#ifndef _ARM_PARAM_H_\r
36#define _ARM_PARAM_H_\r
37\r
38/*\r
39 * Machine dependent constants for all ARM processors\r
40 */\r
41\r
42/*\r
43 * For KERNEL code:\r
44 * MACHINE must be defined by the individual port. This is so that\r
45 * uname returns the correct thing, etc.\r
46 *\r
47 * MACHINE_ARCH may be defined by individual ports as a temporary\r
48 * measure while we're finishing the conversion to ELF.\r
49 *\r
50 * For non-KERNEL code:\r
51 * If ELF, MACHINE and MACHINE_ARCH are forced to "arm/armeb".\r
52 */\r
53\r
54#if defined(_KERNEL)\r
55#ifndef MACHINE_ARCH /* XXX For now */\r
56#ifndef __ARMEB__\r
57#define _MACHINE_ARCH arm\r
58#define MACHINE_ARCH "arm"\r
59#else\r
60#define _MACHINE_ARCH armeb\r
61#define MACHINE_ARCH "armeb"\r
62#endif /* __ARMEB__ */\r
63#endif /* MACHINE_ARCH */\r
64#else\r
65#undef _MACHINE\r
66#undef MACHINE\r
67#undef _MACHINE_ARCH\r
68#undef MACHINE_ARCH\r
69#define _MACHINE arm\r
70#define MACHINE "arm"\r
71#ifndef __ARMEB__\r
72#define _MACHINE_ARCH arm\r
73#define MACHINE_ARCH "arm"\r
74#else\r
75#define _MACHINE_ARCH armeb\r
76#define MACHINE_ARCH "armeb"\r
77#endif /* __ARMEB__ */\r
78#endif /* !_KERNEL */\r
79\r
80#define MID_MACHINE MID_ARM6\r
81\r
82/*\r
83 * Round p (pointer or byte index) up to a correctly-aligned value\r
84 * for all data types (int, long, ...). The result is u_int and\r
85 * must be cast to any desired pointer type.\r
86 *\r
87 * ALIGNED_POINTER is a boolean macro that checks whether an address\r
88 * is valid to fetch data elements of type t from on this architecture.\r
89 * This does not reflect the optimal alignment, just the possibility\r
90 * (within reasonable limits).\r
91 *\r
92 */\r
93#define ALIGNBYTES (sizeof(int) - 1)\r
94#define ALIGN(p) (((u_int)(p) + ALIGNBYTES) &~ ALIGNBYTES)\r
95#define ALIGNED_POINTER(p,t) ((((u_long)(p)) & (sizeof(t)-1)) == 0)\r
96/* ARM-specific macro to align a stack pointer (downwards). */\r
97#define STACKALIGNBYTES (8 - 1)\r
98#define STACKALIGN(p) ((u_int)(p) &~ STACKALIGNBYTES)\r
99\r
100#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */\r
101#define DEV_BSIZE (1 << DEV_BSHIFT)\r
102#define BLKDEV_IOSIZE 2048\r
103\r
104#ifndef MAXPHYS\r
105#define MAXPHYS 65536 /* max I/O transfer size */\r
106#endif\r
107\r
108/*\r
109 * Constants related to network buffer management.\r
110 * MCLBYTES must be no larger than NBPG (the software page size), and,\r
111 * on machines that exchange pages of input or output buffers with mbuf\r
112 * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple\r
113 * of the hardware page size.\r
114 */\r
115#define MSIZE 256 /* size of an mbuf */\r
116\r
117#ifndef MCLSHIFT\r
118#define MCLSHIFT 11 /* convert bytes to m_buf clusters */\r
119 /* 2K cluster can hold Ether frame */\r
120#endif /* MCLSHIFT */\r
121\r
122#define MCLBYTES (1 << MCLSHIFT) /* size of a m_buf cluster */\r
123\r
124#ifndef NMBCLUSTERS_MAX\r
125#define NMBCLUSTERS_MAX (0x2000000 / MCLBYTES) /* Limit to 64MB for clusters */\r
126#endif\r
127\r
128/*\r
129 * Compatibility /dev/zero mapping.\r
130 */\r
131#ifdef _KERNEL\r
132#ifdef COMPAT_16\r
133#define COMPAT_ZERODEV(x) (x == makedev(0, _DEV_ZERO_oARM))\r
134#endif\r
135#endif /* _KERNEL */\r
136\r
137#endif /* _ARM_PARAM_H_ */\r