18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Historical copyright notices:
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright 2004 James Cleverdon, IBM.
68c2ecf20Sopenharmony_ci * (c) 1995 Alan Cox, Building #3 <alan@redhat.com>
78c2ecf20Sopenharmony_ci * (c) 1998-99, 2000 Ingo Molnar <mingo@redhat.com>
88c2ecf20Sopenharmony_ci * (c) 2002,2003 Andi Kleen, SuSE Labs.
98c2ecf20Sopenharmony_ci */
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#include <linux/jump_label.h>
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#include <asm/irq_vectors.h>
148c2ecf20Sopenharmony_ci#include <asm/apic.h>
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci/* APIC flat 64 */
178c2ecf20Sopenharmony_civoid flat_init_apic_ldr(void);
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci/* X2APIC */
208c2ecf20Sopenharmony_ciint x2apic_apic_id_valid(u32 apicid);
218c2ecf20Sopenharmony_ciint x2apic_apic_id_registered(void);
228c2ecf20Sopenharmony_civoid __x2apic_send_IPI_dest(unsigned int apicid, int vector, unsigned int dest);
238c2ecf20Sopenharmony_ciunsigned int x2apic_get_apic_id(unsigned long id);
248c2ecf20Sopenharmony_ciu32 x2apic_set_apic_id(unsigned int id);
258c2ecf20Sopenharmony_ciint x2apic_phys_pkg_id(int initial_apicid, int index_msb);
268c2ecf20Sopenharmony_civoid x2apic_send_IPI_self(int vector);
278c2ecf20Sopenharmony_civoid __x2apic_send_IPI_shorthand(int vector, u32 which);
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci/* IPI */
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ciDECLARE_STATIC_KEY_FALSE(apic_use_ipi_shorthand);
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_cistatic inline unsigned int __prepare_ICR(unsigned int shortcut, int vector,
348c2ecf20Sopenharmony_ci					 unsigned int dest)
358c2ecf20Sopenharmony_ci{
368c2ecf20Sopenharmony_ci	unsigned int icr = shortcut | dest;
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci	switch (vector) {
398c2ecf20Sopenharmony_ci	default:
408c2ecf20Sopenharmony_ci		icr |= APIC_DM_FIXED | vector;
418c2ecf20Sopenharmony_ci		break;
428c2ecf20Sopenharmony_ci	case NMI_VECTOR:
438c2ecf20Sopenharmony_ci		icr |= APIC_DM_NMI;
448c2ecf20Sopenharmony_ci		break;
458c2ecf20Sopenharmony_ci	}
468c2ecf20Sopenharmony_ci	return icr;
478c2ecf20Sopenharmony_ci}
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_civoid __default_send_IPI_shortcut(unsigned int shortcut, int vector);
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ci/*
528c2ecf20Sopenharmony_ci * This is used to send an IPI with no shorthand notation (the destination is
538c2ecf20Sopenharmony_ci * specified in bits 56 to 63 of the ICR).
548c2ecf20Sopenharmony_ci */
558c2ecf20Sopenharmony_civoid __default_send_IPI_dest_field(unsigned int mask, int vector, unsigned int dest);
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_civoid default_send_IPI_single(int cpu, int vector);
588c2ecf20Sopenharmony_civoid default_send_IPI_single_phys(int cpu, int vector);
598c2ecf20Sopenharmony_civoid default_send_IPI_mask_sequence_phys(const struct cpumask *mask, int vector);
608c2ecf20Sopenharmony_civoid default_send_IPI_mask_allbutself_phys(const struct cpumask *mask, int vector);
618c2ecf20Sopenharmony_civoid default_send_IPI_allbutself(int vector);
628c2ecf20Sopenharmony_civoid default_send_IPI_all(int vector);
638c2ecf20Sopenharmony_civoid default_send_IPI_self(int vector);
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ci#ifdef CONFIG_X86_32
668c2ecf20Sopenharmony_civoid default_send_IPI_mask_sequence_logical(const struct cpumask *mask, int vector);
678c2ecf20Sopenharmony_civoid default_send_IPI_mask_allbutself_logical(const struct cpumask *mask, int vector);
688c2ecf20Sopenharmony_civoid default_send_IPI_mask_logical(const struct cpumask *mask, int vector);
698c2ecf20Sopenharmony_ci#endif
70