xref: /openbmc/linux/arch/ia64/include/asm/numa.h (revision 95d002e0a34cb0f238abb39987f9980f325d8332)
17f30491cSTony Luck /*
27f30491cSTony Luck  * This file is subject to the terms and conditions of the GNU General Public
37f30491cSTony Luck  * License.  See the file "COPYING" in the main directory of this archive
47f30491cSTony Luck  * for more details.
57f30491cSTony Luck  *
67f30491cSTony Luck  * This file contains NUMA specific prototypes and definitions.
77f30491cSTony Luck  *
87f30491cSTony Luck  * 2002/08/05 Erich Focht <efocht@ess.nec.de>
97f30491cSTony Luck  *
107f30491cSTony Luck  */
117f30491cSTony Luck #ifndef _ASM_IA64_NUMA_H
127f30491cSTony Luck #define _ASM_IA64_NUMA_H
137f30491cSTony Luck 
147f30491cSTony Luck 
157f30491cSTony Luck #ifdef CONFIG_NUMA
167f30491cSTony Luck 
177f30491cSTony Luck #include <linux/cache.h>
187f30491cSTony Luck #include <linux/cpumask.h>
197f30491cSTony Luck #include <linux/numa.h>
207f30491cSTony Luck #include <linux/smp.h>
217f30491cSTony Luck #include <linux/threads.h>
227f30491cSTony Luck 
237f30491cSTony Luck #include <asm/mmzone.h>
247f30491cSTony Luck 
257f30491cSTony Luck extern u16 cpu_to_node_map[NR_CPUS] __cacheline_aligned;
267f30491cSTony Luck extern cpumask_t node_to_cpu_mask[MAX_NUMNODES] __cacheline_aligned;
277f30491cSTony Luck extern pg_data_t *pgdat_list[MAX_NUMNODES];
287f30491cSTony Luck 
297f30491cSTony Luck /* Stuff below this line could be architecture independent */
307f30491cSTony Luck 
317f30491cSTony Luck extern int num_node_memblks;		/* total number of memory chunks */
327f30491cSTony Luck 
337f30491cSTony Luck /*
347f30491cSTony Luck  * List of node memory chunks. Filled when parsing SRAT table to
357f30491cSTony Luck  * obtain information about memory nodes.
367f30491cSTony Luck */
377f30491cSTony Luck 
387f30491cSTony Luck struct node_memblk_s {
397f30491cSTony Luck 	unsigned long start_paddr;
407f30491cSTony Luck 	unsigned long size;
417f30491cSTony Luck 	int nid;		/* which logical node contains this chunk? */
427f30491cSTony Luck 	int bank;		/* which mem bank on this node */
437f30491cSTony Luck };
447f30491cSTony Luck 
457f30491cSTony Luck struct node_cpuid_s {
467f30491cSTony Luck 	u16	phys_id;	/* id << 8 | eid */
477f30491cSTony Luck 	int	nid;		/* logical node containing this CPU */
487f30491cSTony Luck };
497f30491cSTony Luck 
507f30491cSTony Luck extern struct node_memblk_s node_memblk[NR_NODE_MEMBLKS];
517f30491cSTony Luck extern struct node_cpuid_s node_cpuid[NR_CPUS];
527f30491cSTony Luck 
537f30491cSTony Luck /*
547f30491cSTony Luck  * ACPI 2.0 SLIT (System Locality Information Table)
557f30491cSTony Luck  * http://devresource.hp.com/devresource/Docs/TechPapers/IA64/slit.pdf
567f30491cSTony Luck  *
577f30491cSTony Luck  * This is a matrix with "distances" between nodes, they should be
587f30491cSTony Luck  * proportional to the memory access latency ratios.
597f30491cSTony Luck  */
607f30491cSTony Luck 
617f30491cSTony Luck extern u8 numa_slit[MAX_NUMNODES * MAX_NUMNODES];
62*ef78e5ecSMatias Bjørling #define slit_distance(from,to) (numa_slit[(from) * MAX_NUMNODES + (to)])
63*ef78e5ecSMatias Bjørling extern int __node_distance(int from, int to);
64*ef78e5ecSMatias Bjørling #define node_distance(from,to) __node_distance(from, to)
657f30491cSTony Luck 
667f30491cSTony Luck extern int paddr_to_nid(unsigned long paddr);
677f30491cSTony Luck 
687f30491cSTony Luck #define local_nodeid (cpu_to_node_map[smp_processor_id()])
697f30491cSTony Luck 
70aec03f89SBoris Ostrovsky #define numa_off     0
71aec03f89SBoris Ostrovsky 
727f30491cSTony Luck extern void map_cpu_to_node(int cpu, int nid);
737f30491cSTony Luck extern void unmap_cpu_from_node(int cpu, int nid);
74eee46b3dSYijing Wang extern void numa_clear_node(int cpu);
757f30491cSTony Luck 
767f30491cSTony Luck #else /* !CONFIG_NUMA */
777f30491cSTony Luck #define map_cpu_to_node(cpu, nid)	do{}while(0)
787f30491cSTony Luck #define unmap_cpu_from_node(cpu, nid)	do{}while(0)
797f30491cSTony Luck #define paddr_to_nid(addr)	0
80eee46b3dSYijing Wang #define numa_clear_node(cpu)	do { } while (0)
817f30491cSTony Luck #endif /* CONFIG_NUMA */
827f30491cSTony Luck 
837f30491cSTony Luck #endif /* _ASM_IA64_NUMA_H */
84