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