• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright (C) 2016 Synopsys, Inc. (www.synopsys.com)
4  */
5 
6 #ifndef _ASM_ARC_MMZONE_H
7 #define _ASM_ARC_MMZONE_H
8 
9 #ifdef CONFIG_DISCONTIGMEM
10 
11 extern struct pglist_data node_data[];
12 #define NODE_DATA(nid) (&node_data[nid])
13 
pfn_to_nid(unsigned long pfn)14 static inline int pfn_to_nid(unsigned long pfn)
15 {
16 	int is_end_low = 1;
17 
18 	if (IS_ENABLED(CONFIG_ARC_HAS_PAE40))
19 		is_end_low = pfn <= virt_to_pfn(0xFFFFFFFFUL);
20 
21 	/*
22 	 * node 0: lowmem:             0x8000_0000   to 0xFFFF_FFFF
23 	 * node 1: HIGHMEM w/o  PAE40: 0x0           to 0x7FFF_FFFF
24 	 *         HIGHMEM with PAE40: 0x1_0000_0000 to ...
25 	 */
26 	if (pfn >= ARCH_PFN_OFFSET && is_end_low)
27 		return 0;
28 
29 	return 1;
30 }
31 
pfn_valid(unsigned long pfn)32 static inline int pfn_valid(unsigned long pfn)
33 {
34 	int nid = pfn_to_nid(pfn);
35 
36 	return (pfn <= node_end_pfn(nid));
37 }
38 #endif /* CONFIG_DISCONTIGMEM  */
39 
40 #endif
41