1 /****************************************************************************
2  ****************************************************************************
3  ***
4  ***   This header was automatically generated from a Linux kernel header
5  ***   of the same name, to make information necessary for userspace to
6  ***   call into the kernel available to libc.  It contains only constants,
7  ***   structures, and macros generated from the original header, and thus,
8  ***   contains no copyrightable information.
9  ***
10  ***   To edit the content of this header, modify the corresponding
11  ***   source file (e.g. under external/kernel-headers/original/) then
12  ***   run bionic/libc/kernel/tools/update_all.py
13  ***
14  ***   Any manual change here will be lost the next time this script will
15  ***   be run. You've been warned!
16  ***
17  ****************************************************************************
18  ****************************************************************************/
19 #ifndef _ASM_SN_ADDRS_H
20 #define _ASM_SN_ADDRS_H
21 #ifndef __ASSEMBLY__
22 #include <linux/types.h>
23 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
24 #endif
25 #include <asm/addrspace.h>
26 #include <asm/sn/kldir.h>
27 #ifndef __ASSEMBLY__
28 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
29 #define PS_UINT_CAST (unsigned long)
30 #define UINT64_CAST (unsigned long)
31 #define HUBREG_CAST (volatile hubreg_t *)
32 #else
33 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
34 #define PS_UINT_CAST
35 #define UINT64_CAST
36 #define HUBREG_CAST
37 #endif
38 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
39 #define NASID_GET_META(_n) ((_n) >> NASID_LOCAL_BITS)
40 #define NASID_MAKE(_m, _l) (((_m) << NASID_LOCAL_BITS) | (_l))
41 #define NODE_ADDRSPACE_MASK (NODE_ADDRSPACE_SIZE - 1)
42 #define TO_NODE_ADDRSPACE(_pa) (UINT64_CAST (_pa) & NODE_ADDRSPACE_MASK)
43 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
44 #define CHANGE_ADDR_NASID(_pa, _nasid)   ((UINT64_CAST(_pa) & ~NASID_MASK) |   (UINT64_CAST(_nasid) << NASID_SHFT))
45 #define NODE_OFFSET(_n) (UINT64_CAST (_n) << NODE_SIZE_BITS)
46 #define NODE_CAC_BASE(_n) (CAC_BASE + NODE_OFFSET(_n))
47 #define NODE_HSPEC_BASE(_n) (HSPEC_BASE + NODE_OFFSET(_n))
48 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
49 #define NODE_IO_BASE(_n) (IO_BASE + NODE_OFFSET(_n))
50 #define NODE_MSPEC_BASE(_n) (MSPEC_BASE + NODE_OFFSET(_n))
51 #define NODE_UNCAC_BASE(_n) (UNCAC_BASE + NODE_OFFSET(_n))
52 #define TO_NODE(_n, _x) (NODE_OFFSET(_n) | ((_x) ))
53 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
54 #define TO_NODE_CAC(_n, _x) (NODE_CAC_BASE(_n) | ((_x) & TO_PHYS_MASK))
55 #define TO_NODE_UNCAC(_n, _x) (NODE_UNCAC_BASE(_n) | ((_x) & TO_PHYS_MASK))
56 #define TO_NODE_MSPEC(_n, _x) (NODE_MSPEC_BASE(_n) | ((_x) & TO_PHYS_MASK))
57 #define TO_NODE_HSPEC(_n, _x) (NODE_HSPEC_BASE(_n) | ((_x) & TO_PHYS_MASK))
58 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
59 #define RAW_NODE_SWIN_BASE(nasid, widget)   (NODE_IO_BASE(nasid) + (UINT64_CAST(widget) << SWIN_SIZE_BITS))
60 #define WIDGETID_GET(addr) ((unsigned char)((addr >> SWIN_SIZE_BITS) & 0xff))
61 #define SWIN_SIZE_BITS 24
62 #define SWIN_SIZE (UINT64_CAST 1 << 24)
63 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
64 #define SWIN_SIZEMASK (SWIN_SIZE - 1)
65 #define SWIN_WIDGET_MASK 0xF
66 #define SWIN_WIDGETADDR(addr) ((addr) & SWIN_SIZEMASK)
67 #define SWIN_WIDGETNUM(addr) (((addr) >> SWIN_SIZE_BITS) & SWIN_WIDGET_MASK)
68 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
69 #define NODE_SWIN_ADDR(nasid, addr)   (((addr) >= NODE_SWIN_BASE(nasid, 0)) &&   ((addr) < (NODE_SWIN_BASE(nasid, HUB_NUM_WIDGET) + SWIN_SIZE)  ))
70 #define UALIAS_BASE HSPEC_BASE
71 #define UALIAS_SIZE 0x10000000
72 #define UALIAS_LIMIT (UALIAS_BASE + UALIAS_SIZE)
73 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
74 #define HUB_REGISTER_WIDGET 1
75 #define IALIAS_BASE NODE_SWIN_BASE(0, HUB_REGISTER_WIDGET)
76 #define IALIAS_SIZE 0x800000
77 #define IS_IALIAS(_a) (((_a) >= IALIAS_BASE) &&   ((_a) < (IALIAS_BASE + IALIAS_SIZE)))
78 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
79 #define NODE_BDOOR_BASE(_n) (NODE_HSPEC_BASE(_n) + (NODE_ADDRSPACE_SIZE/2))
80 #define NODE_BDECC_BASE(_n) (NODE_BDOOR_BASE(_n))
81 #define NODE_BDDIR_BASE(_n) (NODE_BDOOR_BASE(_n) + (NODE_ADDRSPACE_SIZE/4))
82 #define LOCAL_HUB_ADDR(_x) (HUBREG_CAST (IALIAS_BASE + (_x)))
83 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
84 #define REMOTE_HUB_ADDR(_n, _x) (HUBREG_CAST (NODE_SWIN_BASE(_n, 1) +   0x800000 + (_x)))
85 #ifndef __ASSEMBLY__
86 #define HUB_L(_a) *(_a)
87 #define HUB_S(_a, _d) *(_a) = (_d)
88 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
89 #define LOCAL_HUB_L(_r) HUB_L(LOCAL_HUB_ADDR(_r))
90 #define LOCAL_HUB_S(_r, _d) HUB_S(LOCAL_HUB_ADDR(_r), (_d))
91 #define REMOTE_HUB_L(_n, _r) HUB_L(REMOTE_HUB_ADDR((_n), (_r)))
92 #define REMOTE_HUB_S(_n, _r, _d) HUB_S(REMOTE_HUB_ADDR((_n), (_r)), (_d))
93 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
94 #define REMOTE_HUB_PI_L(_n, _sn, _r) HUB_L(REMOTE_HUB_PI_ADDR((_n), (_sn), (_r)))
95 #define REMOTE_HUB_PI_S(_n, _sn, _r, _d) HUB_S(REMOTE_HUB_PI_ADDR((_n), (_sn), (_r)), (_d))
96 #endif
97 #define HUB_REG_PTR(_base, _off)   (HUBREG_CAST((__psunsigned_t)(_base) + (__psunsigned_t)(_off)))
98 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
99 #define HUB_REG_PTR_L(_base, _off)   HUB_L(HUB_REG_PTR((_base), (_off)))
100 #define HUB_REG_PTR_S(_base, _off, _data)   HUB_S(HUB_REG_PTR((_base), (_off)), (_data))
101 #define PHYS_RAMBASE 0x0
102 #define K0_RAMBASE PHYS_TO_K0(PHYS_RAMBASE)
103 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
104 #define EX_HANDLER_OFFSET(slice) ((slice) << 16)
105 #define EX_HANDLER_ADDR(nasid, slice)   PHYS_TO_K0(NODE_OFFSET(nasid) | EX_HANDLER_OFFSET(slice))
106 #define EX_HANDLER_SIZE 0x0400
107 #define EX_FRAME_OFFSET(slice) ((slice) << 16 | 0x400)
108 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
109 #define EX_FRAME_ADDR(nasid, slice)   PHYS_TO_K0(NODE_OFFSET(nasid) | EX_FRAME_OFFSET(slice))
110 #define EX_FRAME_SIZE 0x0c00
111 #define ARCS_SPB_OFFSET 0x1000
112 #define ARCS_SPB_ADDR(nasid)   PHYS_TO_K0(NODE_OFFSET(nasid) | ARCS_SPB_OFFSET)
113 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
114 #define ARCS_SPB_SIZE 0x0400
115 #define KLDIR_OFFSET 0x2000
116 #define KLDIR_ADDR(nasid)   TO_NODE_UNCAC((nasid), KLDIR_OFFSET)
117 #define KLDIR_SIZE 0x0400
118 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
119 #define KLI_LAUNCH 0
120 #define KLI_KLCONFIG 1
121 #define KLI_NMI 2
122 #define KLI_GDA 3
123 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
124 #define KLI_FREEMEM 4
125 #define KLI_SYMMON_STK 5
126 #define KLI_PI_ERROR 6
127 #define KLI_KERN_VARS 7
128 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
129 #define KLI_KERN_XP 8
130 #define KLI_KERN_PARTID 9
131 #ifndef __ASSEMBLY__
132 #define KLD_BASE(nasid) ((kldir_ent_t *) KLDIR_ADDR(nasid))
133 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
134 #define KLD_LAUNCH(nasid) (KLD_BASE(nasid) + KLI_LAUNCH)
135 #define KLD_NMI(nasid) (KLD_BASE(nasid) + KLI_NMI)
136 #define KLD_KLCONFIG(nasid) (KLD_BASE(nasid) + KLI_KLCONFIG)
137 #define KLD_PI_ERROR(nasid) (KLD_BASE(nasid) + KLI_PI_ERROR)
138 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
139 #define KLD_GDA(nasid) (KLD_BASE(nasid) + KLI_GDA)
140 #define KLD_SYMMON_STK(nasid) (KLD_BASE(nasid) + KLI_SYMMON_STK)
141 #define KLD_FREEMEM(nasid) (KLD_BASE(nasid) + KLI_FREEMEM)
142 #define KLD_KERN_VARS(nasid) (KLD_BASE(nasid) + KLI_KERN_VARS)
143 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
144 #define KLD_KERN_XP(nasid) (KLD_BASE(nasid) + KLI_KERN_XP)
145 #define KLD_KERN_PARTID(nasid) (KLD_BASE(nasid) + KLI_KERN_PARTID)
146 #define LAUNCH_OFFSET(nasid, slice)   (KLD_LAUNCH(nasid)->offset +   KLD_LAUNCH(nasid)->stride * (slice))
147 #define LAUNCH_ADDR(nasid, slice)   TO_NODE_UNCAC((nasid), LAUNCH_OFFSET(nasid, slice))
148 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
149 #define LAUNCH_SIZE(nasid) KLD_LAUNCH(nasid)->size
150 #define NMI_OFFSET(nasid, slice)   (KLD_NMI(nasid)->offset +   KLD_NMI(nasid)->stride * (slice))
151 #define NMI_ADDR(nasid, slice)   TO_NODE_UNCAC((nasid), NMI_OFFSET(nasid, slice))
152 #define NMI_SIZE(nasid) KLD_NMI(nasid)->size
153 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
154 #define KLCONFIG_OFFSET(nasid) KLD_KLCONFIG(nasid)->offset
155 #define KLCONFIG_ADDR(nasid)   TO_NODE_UNCAC((nasid), KLCONFIG_OFFSET(nasid))
156 #define KLCONFIG_SIZE(nasid) KLD_KLCONFIG(nasid)->size
157 #define GDA_ADDR(nasid) KLD_GDA(nasid)->pointer
158 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
159 #define GDA_SIZE(nasid) KLD_GDA(nasid)->size
160 #define SYMMON_STK_OFFSET(nasid, slice)   (KLD_SYMMON_STK(nasid)->offset +   KLD_SYMMON_STK(nasid)->stride * (slice))
161 #define SYMMON_STK_STRIDE(nasid) KLD_SYMMON_STK(nasid)->stride
162 #define SYMMON_STK_ADDR(nasid, slice)   TO_NODE_CAC((nasid), SYMMON_STK_OFFSET(nasid, slice))
163 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
164 #define SYMMON_STK_SIZE(nasid) KLD_SYMMON_STK(nasid)->stride
165 #define SYMMON_STK_END(nasid) (SYMMON_STK_ADDR(nasid, 0) + KLD_SYMMON_STK(nasid)->size)
166 #define UNIX_DEBUG_LOADADDR 0x300000
167 #define SYMMON_LOADADDR(nasid)   TO_NODE(nasid, PHYS_TO_K0(UNIX_DEBUG_LOADADDR - 0x1000))
168 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
169 #define FREEMEM_OFFSET(nasid) KLD_FREEMEM(nasid)->offset
170 #define FREEMEM_ADDR(nasid) SYMMON_STK_END(nasid)
171 #define FREEMEM_SIZE(nasid) KLD_FREEMEM(nasid)->size
172 #define PI_ERROR_OFFSET(nasid) KLD_PI_ERROR(nasid)->offset
173 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
174 #define PI_ERROR_ADDR(nasid)   TO_NODE_UNCAC((nasid), PI_ERROR_OFFSET(nasid))
175 #define PI_ERROR_SIZE(nasid) KLD_PI_ERROR(nasid)->size
176 #define NODE_OFFSET_TO_K0(_nasid, _off)   PHYS_TO_K0((NODE_OFFSET(_nasid) + (_off)) | CAC_BASE)
177 #define NODE_OFFSET_TO_K1(_nasid, _off)   TO_UNCAC((NODE_OFFSET(_nasid) + (_off)) | UNCAC_BASE)
178 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
179 #define K0_TO_NODE_OFFSET(_k0addr)   ((__psunsigned_t)(_k0addr) & NODE_ADDRSPACE_MASK)
180 #define KERN_VARS_ADDR(nasid) KLD_KERN_VARS(nasid)->pointer
181 #define KERN_VARS_SIZE(nasid) KLD_KERN_VARS(nasid)->size
182 #define KERN_XP_ADDR(nasid) KLD_KERN_XP(nasid)->pointer
183 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
184 #define KERN_XP_SIZE(nasid) KLD_KERN_XP(nasid)->size
185 #define GPDA_ADDR(nasid) TO_NODE_CAC(nasid, GPDA_OFFSET)
186 #endif
187 #endif
188 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
189