]> git.proxmox.com Git - mirror_edk2.git/blame - StdLib/Include/Aarch64/machine/param.h
StdLib: Add support for AArch64
[mirror_edk2.git] / StdLib / Include / Aarch64 / machine / param.h
CommitLineData
1bbb83b5
HL
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 _AARCH64_PARAM_H_\r
36#define _AARCH64_PARAM_H_\r
37\r
38// TODO: These were based on the ARMv7 version. Verify that it is correct.\r
39\r
40/*\r
41 * Machine dependent constants for all ARM processors\r
42 */\r
43\r
44/*\r
45 * For KERNEL code:\r
46 * MACHINE must be defined by the individual port. This is so that\r
47 * uname returns the correct thing, etc.\r
48 *\r
49 * MACHINE_ARCH may be defined by individual ports as a temporary\r
50 * measure while we're finishing the conversion to ELF.\r
51 *\r
52 * For non-KERNEL code:\r
53 * If ELF, MACHINE and MACHINE_ARCH are forced to "arm/armeb".\r
54 */\r
55\r
56#if defined(_KERNEL)\r
57#undef _MACHINE\r
58#undef MACHINE\r
59#undef _MACHINE_ARCH\r
60#undef MACHINE_ARCH\r
61#define _MACHINE aarch64\r
62#define MACHINE "aarch64"\r
63#define _MACHINE_ARCH aarch64\r
64#define MACHINE_ARCH "aarch64"\r
65#endif /* !_KERNEL */\r
66\r
67#define MID_MACHINE MID_AARCH64\r
68\r
69/*\r
70 * Round p (pointer or byte index) up to a correctly-aligned value\r
71 * for all data types (int, long, ...). The result is u_int and\r
72 * must be cast to any desired pointer type.\r
73 *\r
74 * ALIGNED_POINTER is a boolean macro that checks whether an address\r
75 * is valid to fetch data elements of type t from on this architecture.\r
76 * This does not reflect the optimal alignment, just the possibility\r
77 * (within reasonable limits).\r
78 *\r
79 */\r
80#define ALIGNBYTES (sizeof(int) - 1)\r
81#define ALIGN(p) (((u_int)(p) + ALIGNBYTES) &~ ALIGNBYTES)\r
82#define ALIGNED_POINTER(p,t) ((((u_long)(p)) & (sizeof(t)-1)) == 0)\r
83/* ARM-specific macro to align a stack pointer (downwards). */\r
84#define STACKALIGNBYTES (8 - 1)\r
85#define STACKALIGN(p) ((u_int)(p) &~ STACKALIGNBYTES)\r
86\r
87#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */\r
88#define DEV_BSIZE (1 << DEV_BSHIFT)\r
89#define BLKDEV_IOSIZE 2048\r
90\r
91#ifndef MAXPHYS\r
92#define MAXPHYS 65536 /* max I/O transfer size */\r
93#endif\r
94\r
95/*\r
96 * Constants related to network buffer management.\r
97 * MCLBYTES must be no larger than NBPG (the software page size), and,\r
98 * on machines that exchange pages of input or output buffers with mbuf\r
99 * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple\r
100 * of the hardware page size.\r
101 */\r
102#define MSIZE 256 /* size of an mbuf */\r
103\r
104#ifndef MCLSHIFT\r
105#define MCLSHIFT 11 /* convert bytes to m_buf clusters */\r
106 /* 2K cluster can hold Ether frame */\r
107#endif /* MCLSHIFT */\r
108\r
109#define MCLBYTES (1 << MCLSHIFT) /* size of a m_buf cluster */\r
110\r
111#ifndef NMBCLUSTERS_MAX\r
112#define NMBCLUSTERS_MAX (0x2000000 / MCLBYTES) /* Limit to 64MB for clusters */\r
113#endif\r
114\r
115/*\r
116 * Compatibility /dev/zero mapping.\r
117 */\r
118#ifdef _KERNEL\r
119#ifdef COMPAT_16\r
120#define COMPAT_ZERODEV(x) (x == makedev(0, _DEV_ZERO_oARM))\r
121#endif\r
122#endif /* _KERNEL */\r
123\r
124#endif /* _AARCH64_PARAM_H_ */\r