1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * Copyright 2004 James Cleverdon, IBM.
4 *
5 * Flat APIC subarch code.
6 *
7 * Hacked for x86-64 by James Cleverdon from i386 architecture code by
8 * Martin Bligh, Andi Kleen, James Bottomley, John Stultz, and
9 * James Cleverdon.
10 */
11 #include <linux/export.h>
12
13 #include <asm/apic.h>
14
15 #include "local.h"
16
physflat_get_apic_id(u32 x)17 static u32 physflat_get_apic_id(u32 x)
18 {
19 return (x >> 24) & 0xFF;
20 }
21
physflat_probe(void)22 static int physflat_probe(void)
23 {
24 return 1;
25 }
26
physflat_acpi_madt_oem_check(char * oem_id,char * oem_table_id)27 static int physflat_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
28 {
29 return 1;
30 }
31
32 static struct apic apic_physflat __ro_after_init = {
33
34 .name = "physical flat",
35 .probe = physflat_probe,
36 .acpi_madt_oem_check = physflat_acpi_madt_oem_check,
37
38 .dest_mode_logical = false,
39
40 .disable_esr = 0,
41
42 .cpu_present_to_apicid = default_cpu_present_to_apicid,
43
44 .max_apic_id = 0xFE,
45 .get_apic_id = physflat_get_apic_id,
46
47 .calc_dest_apicid = apic_default_calc_apicid,
48
49 .send_IPI = default_send_IPI_single_phys,
50 .send_IPI_mask = default_send_IPI_mask_sequence_phys,
51 .send_IPI_mask_allbutself = default_send_IPI_mask_allbutself_phys,
52 .send_IPI_allbutself = default_send_IPI_allbutself,
53 .send_IPI_all = default_send_IPI_all,
54 .send_IPI_self = default_send_IPI_self,
55 .nmi_to_offline_cpu = true,
56
57 .read = native_apic_mem_read,
58 .write = native_apic_mem_write,
59 .eoi = native_apic_mem_eoi,
60 .icr_read = native_apic_icr_read,
61 .icr_write = native_apic_icr_write,
62 .wait_icr_idle = apic_mem_wait_icr_idle,
63 .safe_wait_icr_idle = apic_mem_wait_icr_idle_timeout,
64 };
65 apic_driver(apic_physflat);
66
67 struct apic *apic __ro_after_init = &apic_physflat;
68 EXPORT_SYMBOL_GPL(apic);
69