linux/arch/x86/kernel/acpi/boot.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *  boot.c - Architecture-Specific Low-Level ACPI Boot Support
 *
 *  Copyright (C) 2001, 2002 Paul Diefenbaugh <[email protected]>
 *  Copyright (C) 2001 Jun Nakajima <[email protected]>
 */
#define pr_fmt(fmt)

#include <linux/init.h>
#include <linux/acpi.h>
#include <linux/acpi_pmtmr.h>
#include <linux/efi.h>
#include <linux/cpumask.h>
#include <linux/export.h>
#include <linux/dmi.h>
#include <linux/irq.h>
#include <linux/slab.h>
#include <linux/memblock.h>
#include <linux/ioport.h>
#include <linux/pci.h>
#include <linux/efi-bgrt.h>
#include <linux/serial_core.h>
#include <linux/pgtable.h>

#include <asm/e820/api.h>
#include <asm/irqdomain.h>
#include <asm/pci_x86.h>
#include <asm/io_apic.h>
#include <asm/apic.h>
#include <asm/io.h>
#include <asm/mpspec.h>
#include <asm/smp.h>
#include <asm/i8259.h>
#include <asm/setup.h>

#include "sleep.h" /* To include x86_acpi_suspend_lowlevel */
static int __initdata acpi_force =;
int acpi_disabled;
EXPORT_SYMBOL();

#ifdef	CONFIG_X86_64
# include <asm/proto.h>
#endif				/* X86 */

int acpi_noirq;				/* skip ACPI IRQ initialization */
static int acpi_nobgrt;			/* skip ACPI BGRT */
int acpi_pci_disabled;		/* skip ACPI PCI scan and IRQ initialization */
EXPORT_SYMBOL();

int acpi_lapic;
int acpi_ioapic;
int acpi_strict;
int acpi_disable_cmcff;
bool acpi_int_src_ovr[NR_IRQS_LEGACY];

/* ACPI SCI override configuration */
u8 acpi_sci_flags __initdata;
u32 acpi_sci_override_gsi __initdata =;
int acpi_skip_timer_override __initdata;
int acpi_use_timer_override __initdata;
int acpi_fix_pin2_polarity __initdata;

#ifdef CONFIG_X86_LOCAL_APIC
static u64 acpi_lapic_addr __initdata =;
static bool has_lapic_cpus __initdata;
static bool acpi_support_online_capable;
#endif

#ifdef CONFIG_X86_IO_APIC
/*
 * Locks related to IOAPIC hotplug
 * Hotplug side:
 *	->device_hotplug_lock
 *		->acpi_ioapic_lock
 *			->ioapic_lock
 * Interrupt mapping side:
 *	->acpi_ioapic_lock
 *		->ioapic_mutex
 *			->ioapic_lock
 */
static DEFINE_MUTEX(acpi_ioapic_lock);
#endif

/* --------------------------------------------------------------------------
                              Boot-time Configuration
   -------------------------------------------------------------------------- */

/*
 * The default interrupt routing model is PIC (8259).  This gets
 * overridden if IOAPICs are enumerated (below).
 */
enum acpi_irq_model_id acpi_irq_model =;


/*
 * ISA irqs by default are the first 16 gsis but can be
 * any gsi as specified by an interrupt source override.
 */
static u32 isa_irq_to_gsi[NR_IRQS_LEGACY] __read_mostly =;

/*
 * This is just a simple wrapper around early_memremap(),
 * with sanity checks for phys == 0 and size == 0.
 */
void __init __iomem *__acpi_map_table(unsigned long phys, unsigned long size)
{}

void __init __acpi_unmap_table(void __iomem *map, unsigned long size)
{}

#ifdef CONFIG_X86_LOCAL_APIC
static int __init acpi_parse_madt(struct acpi_table_header *table)
{}

static bool __init acpi_is_processor_usable(u32 lapic_flags)
{}

static int __init
acpi_parse_x2apic(union acpi_subtable_headers *header, const unsigned long end)
{}

static int __init
acpi_parse_lapic(union acpi_subtable_headers * header, const unsigned long end)
{}

static int __init
acpi_parse_sapic(union acpi_subtable_headers *header, const unsigned long end)
{}

static int __init
acpi_parse_lapic_addr_ovr(union acpi_subtable_headers * header,
			  const unsigned long end)
{}

static int __init
acpi_parse_x2apic_nmi(union acpi_subtable_headers *header,
		      const unsigned long end)
{}

static int __init
acpi_parse_lapic_nmi(union acpi_subtable_headers * header, const unsigned long end)
{}
#endif /* CONFIG_X86_LOCAL_APIC */

#ifdef CONFIG_X86_IO_APIC
#define MP_ISA_BUS

static int __init mp_register_ioapic_irq(u8 bus_irq, u8 polarity,
						u8 trigger, u32 gsi);

static void __init mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger,
					  u32 gsi)
{}

static void mp_config_acpi_gsi(struct device *dev, u32 gsi, int trigger,
			int polarity)
{}

static int __init mp_register_ioapic_irq(u8 bus_irq, u8 polarity,
						u8 trigger, u32 gsi)
{}

static int __init
acpi_parse_ioapic(union acpi_subtable_headers * header, const unsigned long end)
{}

/*
 * Parse Interrupt Source Override for the ACPI SCI
 */
static void __init acpi_sci_ioapic_setup(u8 bus_irq, u16 polarity, u16 trigger, u32 gsi)
{}

static int __init
acpi_parse_int_src_ovr(union acpi_subtable_headers * header,
		       const unsigned long end)
{}

static int __init
acpi_parse_nmi_src(union acpi_subtable_headers * header, const unsigned long end)
{}

#endif				/* CONFIG_X86_IO_APIC */

/*
 * acpi_pic_sci_set_trigger()
 *
 * use ELCR to set PIC-mode trigger type for SCI
 *
 * If a PIC-mode SCI is not recognized or gives spurious IRQ7's
 * it may require Edge Trigger -- use "acpi_sci=edge"
 *
 * Port 0x4d0-4d1 are ELCR1 and ELCR2, the Edge/Level Control Registers
 * for the 8259 PIC.  bit[n] = 1 means irq[n] is Level, otherwise Edge.
 * ELCR1 is IRQs 0-7 (IRQ 0, 1, 2 must be 0)
 * ELCR2 is IRQs 8-15 (IRQ 8, 13 must be 0)
 */

void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger)
{}

int acpi_gsi_to_irq(u32 gsi, unsigned int *irqp)
{}
EXPORT_SYMBOL_GPL();

int acpi_isa_irq_to_gsi(unsigned isa_irq, u32 *gsi)
{}

static int acpi_register_gsi_pic(struct device *dev, u32 gsi,
				 int trigger, int polarity)
{}

#ifdef CONFIG_X86_LOCAL_APIC
static int acpi_register_gsi_ioapic(struct device *dev, u32 gsi,
				    int trigger, int polarity)
{}

static void acpi_unregister_gsi_ioapic(u32 gsi)
{}
#endif

int (*__acpi_register_gsi)(struct device *dev, u32 gsi,
			   int trigger, int polarity) =;
void (*__acpi_unregister_gsi)(u32 gsi) =;

#ifdef CONFIG_ACPI_SLEEP
int (*acpi_suspend_lowlevel)(void) =;
#else
int (*acpi_suspend_lowlevel)(void);
#endif

/*
 * success: return IRQ number (>=0)
 * failure: return < 0
 */
int acpi_register_gsi(struct device *dev, u32 gsi, int trigger, int polarity)
{}
EXPORT_SYMBOL_GPL();

void acpi_unregister_gsi(u32 gsi)
{}
EXPORT_SYMBOL_GPL();

#ifdef CONFIG_X86_LOCAL_APIC
static void __init acpi_set_irq_model_ioapic(void)
{}
#endif

/*
 *  ACPI based hotplug support for CPU
 */
#ifdef CONFIG_ACPI_HOTPLUG_CPU
#include <acpi/processor.h>

static int acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
{}

int acpi_map_cpu(acpi_handle handle, phys_cpuid_t physid, u32 acpi_id, int *pcpu)
{}
EXPORT_SYMBOL();

int acpi_unmap_cpu(int cpu)
{}
EXPORT_SYMBOL();
#endif	/* CONFIG_ACPI_HOTPLUG_CPU */

int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base)
{}
EXPORT_SYMBOL();

int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base)
{}
EXPORT_SYMBOL();

/**
 * acpi_ioapic_registered - Check whether IOAPIC associated with @gsi_base
 *			    has been registered
 * @handle:	ACPI handle of the IOAPIC device
 * @gsi_base:	GSI base associated with the IOAPIC
 *
 * Assume caller holds some type of lock to serialize acpi_ioapic_registered()
 * with acpi_register_ioapic()/acpi_unregister_ioapic().
 */
int acpi_ioapic_registered(acpi_handle handle, u32 gsi_base)
{}

static int __init acpi_parse_sbf(struct acpi_table_header *table)
{}

#ifdef CONFIG_HPET_TIMER
#include <asm/hpet.h>

static struct resource *hpet_res __initdata;

static int __init acpi_parse_hpet(struct acpi_table_header *table)
{}

/*
 * hpet_insert_resource inserts the HPET resources used into the resource
 * tree.
 */
static __init int hpet_insert_resource(void)
{}

late_initcall(hpet_insert_resource);

#else
#define acpi_parse_hpet
#endif

static int __init acpi_parse_fadt(struct acpi_table_header *table)
{}

#ifdef	CONFIG_X86_LOCAL_APIC
/*
 * Parse LAPIC entries in MADT
 * returns 0 on success, < 0 on error
 */

static int __init early_acpi_parse_madt_lapic_addr_ovr(void)
{}

static int __init acpi_parse_madt_lapic_entries(void)
{}
#endif				/* CONFIG_X86_LOCAL_APIC */

#ifdef	CONFIG_X86_IO_APIC
static void __init mp_config_acpi_legacy_irqs(void)
{}

/*
 * Parse IOAPIC related entries in MADT
 * returns 0 on success, < 0 on error
 */
static int __init acpi_parse_madt_ioapic_entries(void)
{}
#else
static inline int acpi_parse_madt_ioapic_entries(void)
{
	return -1;
}
#endif	/* !CONFIG_X86_IO_APIC */

static void __init early_acpi_process_madt(void)
{}

static void __init acpi_process_madt(void)
{}

static int __init disable_acpi_irq(const struct dmi_system_id *d)
{}

static int __init disable_acpi_pci(const struct dmi_system_id *d)
{}

static int __init disable_acpi_xsdt(const struct dmi_system_id *d)
{}

static int __init dmi_disable_acpi(const struct dmi_system_id *d)
{}

/*
 * Force ignoring BIOS IRQ0 override
 */
static int __init dmi_ignore_irq0_timer_override(const struct dmi_system_id *d)
{}

/*
 * ACPI offers an alternative platform interface model that removes
 * ACPI hardware requirements for platforms that do not implement
 * the PC Architecture.
 *
 * We initialize the Hardware-reduced ACPI model here:
 */
void __init acpi_generic_reduced_hw_init(void)
{}

static void __init acpi_reduced_hw_init(void)
{}

/*
 * If your system is blacklisted here, but you find that acpi=force
 * works for you, please contact [email protected]
 */
static const struct dmi_system_id acpi_dmi_table[] __initconst =;

/* second table for DMI checks that should run after early-quirks */
static const struct dmi_system_id acpi_dmi_table_late[] __initconst =;

/*
 * acpi_boot_table_init() and acpi_boot_init()
 *  called from setup_arch(), always.
 *	1. checksums all tables
 *	2. enumerates lapics
 *	3. enumerates io-apics
 *
 * acpi_table_init() is separate to allow reading SRAT without
 * other side effects.
 *
 * side effects of acpi_boot_init:
 *	acpi_lapic = 1 if LAPIC found
 *	acpi_ioapic = 1 if IOAPIC found
 *	if (acpi_lapic && acpi_ioapic) smp_found_config = 1;
 *	if acpi_blacklisted() acpi_disabled = 1;
 *	acpi_irq_model=...
 *	...
 */

void __init acpi_boot_table_init(void)
{}

int __init early_acpi_boot_init(void)
{}

int __init acpi_boot_init(void)
{}

static int __init parse_acpi(char *arg)
{}
early_param();

static int __init parse_acpi_bgrt(char *arg)
{}
early_param();

/* FIXME: Using pci= for an ACPI parameter is a travesty. */
static int __init parse_pci(char *arg)
{}
early_param();

int __init acpi_mps_check(void)
{}

#ifdef CONFIG_X86_IO_APIC
static int __init parse_acpi_skip_timer_override(char *arg)
{}
early_param();

static int __init parse_acpi_use_timer_override(char *arg)
{}
early_param();
#endif /* CONFIG_X86_IO_APIC */

static int __init setup_acpi_sci(char *s)
{}
early_param();

int __acpi_acquire_global_lock(unsigned int *lock)
{}

int __acpi_release_global_lock(unsigned int *lock)
{}

void __init arch_reserve_mem_area(acpi_physical_address addr, size_t size)
{}

void x86_default_set_root_pointer(u64 addr)
{}

u64 x86_default_get_root_pointer(void)
{}