18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (C) 2002, Erich Focht, NEC
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * All rights reserved.
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci#ifndef _ASM_IA64_TOPOLOGY_H
88c2ecf20Sopenharmony_ci#define _ASM_IA64_TOPOLOGY_H
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#include <asm/acpi.h>
118c2ecf20Sopenharmony_ci#include <asm/numa.h>
128c2ecf20Sopenharmony_ci#include <asm/smp.h>
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#ifdef CONFIG_NUMA
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci/* Nodes w/o CPUs are preferred for memory allocations, see build_zonelists */
178c2ecf20Sopenharmony_ci#define PENALTY_FOR_NODE_WITH_CPUS 255
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci/*
208c2ecf20Sopenharmony_ci * Nodes within this distance are eligible for reclaim by zone_reclaim() when
218c2ecf20Sopenharmony_ci * zone_reclaim_mode is enabled.
228c2ecf20Sopenharmony_ci */
238c2ecf20Sopenharmony_ci#define RECLAIM_DISTANCE 15
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci/*
268c2ecf20Sopenharmony_ci * Returns a bitmask of CPUs on Node 'node'.
278c2ecf20Sopenharmony_ci */
288c2ecf20Sopenharmony_ci#define cpumask_of_node(node) ((node) == -1 ?				\
298c2ecf20Sopenharmony_ci			       cpu_all_mask :				\
308c2ecf20Sopenharmony_ci			       &node_to_cpu_mask[node])
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci/*
338c2ecf20Sopenharmony_ci * Determines the node for a given pci bus
348c2ecf20Sopenharmony_ci */
358c2ecf20Sopenharmony_ci#define pcibus_to_node(bus) PCI_CONTROLLER(bus)->node
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_civoid build_cpu_to_node_map(void);
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci#endif /* CONFIG_NUMA */
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci#ifdef CONFIG_SMP
428c2ecf20Sopenharmony_ci#define topology_physical_package_id(cpu)	(cpu_data(cpu)->socket_id)
438c2ecf20Sopenharmony_ci#define topology_core_id(cpu)			(cpu_data(cpu)->core_id)
448c2ecf20Sopenharmony_ci#define topology_core_cpumask(cpu)		(&cpu_core_map[cpu])
458c2ecf20Sopenharmony_ci#define topology_sibling_cpumask(cpu)		(&per_cpu(cpu_sibling_map, cpu))
468c2ecf20Sopenharmony_ci#endif
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ciextern void arch_fix_phys_package_id(int num, u32 slot);
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci#define cpumask_of_pcibus(bus)	(pcibus_to_node(bus) == -1 ?		\
518c2ecf20Sopenharmony_ci				 cpu_all_mask :				\
528c2ecf20Sopenharmony_ci				 cpumask_of_node(pcibus_to_node(bus)))
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci#include <asm-generic/topology.h>
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ci#endif /* _ASM_IA64_TOPOLOGY_H */
57