1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  * Copyright (C) 2010 Loongson Inc. & Lemote Inc. &
4  *                    Institute of Computing Technology
5  * Author:  Xiang Gao, gaoxiang@ict.ac.cn
6  *          Huacai Chen, chenhc@lemote.com
7  *          Xiaofu Meng, Shuangshuang Zhang
8  */
9 #ifndef _ASM_MACH_MMZONE_H
10 #define _ASM_MACH_MMZONE_H
11 
12 #include <boot_param.h>
13 #define NODE_ADDRSPACE_SHIFT 44
14 #define NODE0_ADDRSPACE_OFFSET 0x000000000000UL
15 #define NODE1_ADDRSPACE_OFFSET 0x100000000000UL
16 #define NODE2_ADDRSPACE_OFFSET 0x200000000000UL
17 #define NODE3_ADDRSPACE_OFFSET 0x300000000000UL
18 
19 #define pa_to_nid(addr)  (((addr) & 0xf00000000000) >> NODE_ADDRSPACE_SHIFT)
20 #define nid_to_addrbase(nid) ((nid) << NODE_ADDRSPACE_SHIFT)
21 
22 #define LEVELS_PER_SLICE 128
23 
24 struct slice_data {
25 	unsigned long irq_enable_mask[2];
26 	int level_to_irq[LEVELS_PER_SLICE];
27 };
28 
29 struct hub_data {
30 	cpumask_t	h_cpus;
31 	unsigned long slice_map;
32 	unsigned long irq_alloc_mask[2];
33 	struct slice_data slice[2];
34 };
35 
36 struct node_data {
37 	struct pglist_data pglist;
38 	struct hub_data hub;
39 	cpumask_t cpumask;
40 };
41 
42 extern struct node_data *__node_data[];
43 
44 #define NODE_DATA(n)		(&__node_data[(n)]->pglist)
45 #define hub_data(n)		(&__node_data[(n)]->hub)
46 
47 extern void setup_zero_pages(void);
48 extern void __init prom_init_numa_memory(void);
49 
50 #endif /* _ASM_MACH_MMZONE_H */
51