]>
Commit | Line | Data |
---|---|---|
d78fab6b | 1 | /** @file\r |
2 | Machine dependent constants for the Intel64 Architecture(X64).\r | |
2aa62f2b | 3 | \r |
d78fab6b | 4 | Copyright (c) 2010-2012, Intel Corporation. All rights reserved.<BR>\r |
5 | This program and the accompanying materials are licensed and made available under\r | |
6 | the terms and conditions of the BSD License that accompanies this distribution.\r | |
7 | The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | \r | |
13 | * $NetBSD: param.h,v 1.3 2006/08/28 13:43:35 yamt Exp\r | |
14 | **/\r | |
15 | #ifndef _X64_PARAM_H_\r | |
16 | #define _X64_PARAM_H_\r | |
17 | \r | |
18 | #define _MACHINE amd64\r | |
19 | #define MACHINE "amd64"\r | |
2aa62f2b | 20 | #define _MACHINE_ARCH x86_64\r |
21 | #define MACHINE_ARCH "x86_64"\r | |
d78fab6b | 22 | #define MID_MACHINE MID_X86_64\r |
2aa62f2b | 23 | \r |
24 | /*\r | |
25 | * Round p (pointer or byte index) up to a correctly-aligned value\r | |
26 | * for all data types (int, long, ...). The result is u_int and\r | |
27 | * must be cast to any desired pointer type.\r | |
28 | *\r | |
29 | * ALIGNED_POINTER is a boolean macro that checks whether an address\r | |
30 | * is valid to fetch data elements of type t from on this architecture.\r | |
31 | * This does not reflect the optimal alignment, just the possibility\r | |
32 | * (within reasonable limits).\r | |
33 | *\r | |
34 | */\r | |
d78fab6b | 35 | #define ALIGNBYTES (sizeof(INT64) - 1)\r |
36 | #define ALIGN(p) (((UINT64)(p) + ALIGNBYTES) &~ALIGNBYTES)\r | |
2aa62f2b | 37 | #define ALIGNED_POINTER(p,t) 1\r |
38 | \r | |
d78fab6b | 39 | #define ALIGNBYTES32 (sizeof(INT32) - 1)\r |
40 | #define ALIGN32(p) (((UINT64)(p) + ALIGNBYTES32) &~ALIGNBYTES32)\r | |
2aa62f2b | 41 | \r |
d78fab6b | 42 | #define PGSHIFT 12 /* LOG2(NBPG) */\r |
43 | #define NBPG (1 << PGSHIFT) /* bytes/page */\r | |
44 | #define PGOFSET (NBPG-1) /* byte offset into page */\r | |
45 | #define NPTEPG (NBPG/(sizeof (pt_entry_t)))\r | |
2aa62f2b | 46 | \r |
d78fab6b | 47 | #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */\r |
48 | #define DEV_BSIZE (1 << DEV_BSHIFT)\r | |
2aa62f2b | 49 | #define BLKDEV_IOSIZE 2048\r |
50 | #ifndef MAXPHYS\r | |
d78fab6b | 51 | #define MAXPHYS (64 * 1024) /* max raw I/O transfer size */\r |
2aa62f2b | 52 | #endif\r |
53 | \r | |
d78fab6b | 54 | #define SSIZE 1 /* initial stack size/NBPG */\r |
55 | #define SINCR 1 /* increment of stack/NBPG */\r | |
56 | #define UPAGES 5 /* pages of u-area */\r | |
57 | #define USPACE (UPAGES * NBPG) /* total size of u-area */\r | |
2aa62f2b | 58 | \r |
59 | #ifndef MSGBUFSIZE\r | |
d78fab6b | 60 | #define MSGBUFSIZE 4*NBPG /* default message buffer size */\r |
2aa62f2b | 61 | #endif\r |
62 | \r | |
63 | /*\r | |
64 | * Constants related to network buffer management.\r | |
65 | * MCLBYTES must be no larger than NBPG (the software page size), and,\r | |
66 | * on machines that exchange pages of input or output buffers with mbuf\r | |
67 | * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple\r | |
68 | * of the hardware page size.\r | |
69 | */\r | |
d78fab6b | 70 | #define MSIZE 512 /* size of an mbuf */\r |
2aa62f2b | 71 | \r |
72 | #ifndef MCLSHIFT\r | |
d78fab6b | 73 | #define MCLSHIFT 11 /* convert bytes to m_buf clusters */\r |
74 | /* 2K cluster can hold Ether frame */\r | |
2aa62f2b | 75 | #endif /* MCLSHIFT */\r |
76 | \r | |
d78fab6b | 77 | #define MCLBYTES (1 << MCLSHIFT) /* size of a m_buf cluster */\r |
2aa62f2b | 78 | \r |
79 | #ifndef NMBCLUSTERS\r | |
80 | #ifdef GATEWAY\r | |
81 | #define NMBCLUSTERS 4096 /* map size, max cluster allocation */\r | |
82 | #else\r | |
83 | #define NMBCLUSTERS 2048 /* map size, max cluster allocation */\r | |
84 | #endif\r | |
85 | #endif\r | |
86 | \r | |
87 | #ifndef NFS_RSIZE\r | |
d78fab6b | 88 | #define NFS_RSIZE 32768\r |
2aa62f2b | 89 | #endif\r |
90 | #ifndef NFS_WSIZE\r | |
d78fab6b | 91 | #define NFS_WSIZE 32768\r |
2aa62f2b | 92 | #endif\r |
93 | \r | |
d78fab6b | 94 | #define x86_round_page(x) ((((EFI_ULONG_T)(x)) + PGOFSET) & ~PGOFSET)\r |
95 | #define x86_trunc_page(x) ((EFI_ULONG_T)(x) & ~PGOFSET)\r | |
96 | #define x86_btop(x) ((EFI_ULONG_T)(x) >> PGSHIFT)\r | |
97 | #define x86_ptob(x) ((EFI_ULONG_T)(x) << PGSHIFT)\r | |
2aa62f2b | 98 | \r |
d78fab6b | 99 | #define btop(x) x86_btop(x)\r |
100 | #define ptob(x) x86_ptob(x)\r | |
2aa62f2b | 101 | #define round_pdr(x) x86_round_pdr(x)\r |
102 | \r | |
103 | #define mstohz(ms) ((ms + 0UL) * hz / 1000)\r | |
d78fab6b | 104 | \r |
105 | #endif /* _X64_PARAM_H_ */\r |