]> git.proxmox.com Git - mirror_edk2.git/blobdiff - StdLib/Include/Aarch64/machine/param.h
StdLib: Add support for AArch64
[mirror_edk2.git] / StdLib / Include / Aarch64 / machine / param.h
diff --git a/StdLib/Include/Aarch64/machine/param.h b/StdLib/Include/Aarch64/machine/param.h
new file mode 100644 (file)
index 0000000..c7700b3
--- /dev/null
@@ -0,0 +1,124 @@
+/*      $NetBSD: param.h,v 1.13 2010/05/06 19:10:26 joerg Exp $ */\r
+\r
+/*\r
+ * Copyright (c) 1994,1995 Mark Brinicombe.\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ * 1. Redistributions of source code must retain the above copyright\r
+ *    notice, this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above copyright\r
+ *    notice, this list of conditions and the following disclaimer in the\r
+ *    documentation and/or other materials provided with the distribution.\r
+ * 3. All advertising materials mentioning features or use of this software\r
+ *    must display the following acknowledgement:\r
+ *      This product includes software developed by the RiscBSD team.\r
+ * 4. The name "RiscBSD" nor the name of the author may be used to\r
+ *    endorse or promote products derived from this software without specific\r
+ *    prior written permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY RISCBSD ``AS IS'' AND ANY EXPRESS OR IMPLIED\r
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\r
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\r
+ * IN NO EVENT SHALL RISCBSD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\r
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\r
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\r
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
+ * SUCH DAMAGE.\r
+ */\r
+\r
+#ifndef _AARCH64_PARAM_H_\r
+#define _AARCH64_PARAM_H_\r
+\r
+// TODO: These were based on the ARMv7 version. Verify that it is correct.\r
+\r
+/*\r
+ * Machine dependent constants for all ARM processors\r
+ */\r
+\r
+/*\r
+ * For KERNEL code:\r
+ *      MACHINE must be defined by the individual port.  This is so that\r
+ *      uname returns the correct thing, etc.\r
+ *\r
+ *      MACHINE_ARCH may be defined by individual ports as a temporary\r
+ *      measure while we're finishing the conversion to ELF.\r
+ *\r
+ * For non-KERNEL code:\r
+ *      If ELF, MACHINE and MACHINE_ARCH are forced to "arm/armeb".\r
+ */\r
+\r
+#if defined(_KERNEL)\r
+#undef _MACHINE\r
+#undef MACHINE\r
+#undef _MACHINE_ARCH\r
+#undef MACHINE_ARCH\r
+#define _MACHINE        aarch64\r
+#define MACHINE         "aarch64"\r
+#define _MACHINE_ARCH   aarch64\r
+#define MACHINE_ARCH    "aarch64"\r
+#endif /* !_KERNEL */\r
+\r
+#define MID_MACHINE     MID_AARCH64\r
+\r
+/*\r
+ * Round p (pointer or byte index) up to a correctly-aligned value\r
+ * for all data types (int, long, ...).   The result is u_int and\r
+ * must be cast to any desired pointer type.\r
+ *\r
+ * ALIGNED_POINTER is a boolean macro that checks whether an address\r
+ * is valid to fetch data elements of type t from on this architecture.\r
+ * This does not reflect the optimal alignment, just the possibility\r
+ * (within reasonable limits).\r
+ *\r
+ */\r
+#define ALIGNBYTES              (sizeof(int) - 1)\r
+#define ALIGN(p)                (((u_int)(p) + ALIGNBYTES) &~ ALIGNBYTES)\r
+#define ALIGNED_POINTER(p,t)    ((((u_long)(p)) & (sizeof(t)-1)) == 0)\r
+/* ARM-specific macro to align a stack pointer (downwards). */\r
+#define STACKALIGNBYTES         (8 - 1)\r
+#define STACKALIGN(p)           ((u_int)(p) &~ STACKALIGNBYTES)\r
+\r
+#define DEV_BSHIFT      9               /* log2(DEV_BSIZE) */\r
+#define DEV_BSIZE       (1 << DEV_BSHIFT)\r
+#define BLKDEV_IOSIZE   2048\r
+\r
+#ifndef MAXPHYS\r
+#define MAXPHYS         65536           /* max I/O transfer size */\r
+#endif\r
+\r
+/*\r
+ * Constants related to network buffer management.\r
+ * MCLBYTES must be no larger than NBPG (the software page size), and,\r
+ * on machines that exchange pages of input or output buffers with mbuf\r
+ * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple\r
+ * of the hardware page size.\r
+ */\r
+#define MSIZE           256             /* size of an mbuf */\r
+\r
+#ifndef MCLSHIFT\r
+#define MCLSHIFT        11              /* convert bytes to m_buf clusters */\r
+                                        /* 2K cluster can hold Ether frame */\r
+#endif  /* MCLSHIFT */\r
+\r
+#define MCLBYTES        (1 << MCLSHIFT) /* size of a m_buf cluster */\r
+\r
+#ifndef NMBCLUSTERS_MAX\r
+#define NMBCLUSTERS_MAX (0x2000000 / MCLBYTES)  /* Limit to 64MB for clusters */\r
+#endif\r
+\r
+/*\r
+ * Compatibility /dev/zero mapping.\r
+ */\r
+#ifdef _KERNEL\r
+#ifdef COMPAT_16\r
+#define COMPAT_ZERODEV(x)       (x == makedev(0, _DEV_ZERO_oARM))\r
+#endif\r
+#endif /* _KERNEL */\r
+\r
+#endif /* _AARCH64_PARAM_H_ */\r