Commit ba29c4ce authored by Jing Li's avatar Jing Li Committed by guzitao
Browse files

sw64: acpi: use early param to control whether ACPI is enabled

Sunway inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/IBDJNZ



--------------------------------

Using early param "acpi=on" to enable ACPI. If "acpi=on" is not
explicitly passed or "acpi=off" is passed, ACPI will be disabled.

Signed-off-by: default avatarJing Li <jingli@wxiat.com>
Reviewed-by: default avatarHe Sheng <hesheng@wxiat.com>
Signed-off-by: default avatarGu Zitao <guzitao@wxiat.com>
parent e52aabca
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ extern int acpi_pci_disabled;
					ACPI_PDC_C_C2C3_FFH)

#define ACPI_TABLE_UPGRADE_MAX_PHYS (max_low_pfn_mapped << PAGE_SHIFT)

static inline void disable_acpi(void)
{
	acpi_disabled = 1;
@@ -50,7 +51,18 @@ static inline void disable_acpi(void)
	acpi_noirq = 1;
}

static inline void acpi_noirq_set(void) { acpi_noirq = 1; }
static inline void enable_acpi(void)
{
	acpi_disabled = 0;
	acpi_pci_disabled = 0;
	acpi_noirq = 0;
}

static inline void acpi_noirq_set(void)
{
	acpi_noirq = 1;
}

static inline void acpi_disable_pci(void)
{
	acpi_pci_disabled = 1;
+24 −10
Original line number Diff line number Diff line
@@ -12,6 +12,10 @@ EXPORT_SYMBOL(acpi_disabled);
int acpi_noirq = 1;		/* skip ACPI IRQ initialization */
int acpi_pci_disabled = 1;	/* skip ACPI PCI scan and IRQ initialization */
EXPORT_SYMBOL(acpi_pci_disabled);

static bool param_acpi_on  __initdata;
static bool param_acpi_off __initdata;

int acpi_strict;
u64 arch_acpi_wakeup_start;
u64 acpi_saved_sp_s3;
@@ -116,13 +120,14 @@ static int __init parse_acpi(char *arg)
	if (!arg)
		return -EINVAL;

	/* "acpi=off" disables both ACPI table parsing and interpreter */
	if (strcmp(arg, "off") == 0) {
		disable_acpi();
	} else {
		/* Core will printk when we return error. */
		return -EINVAL;
	}
	/* disable both ACPI table parsing and interpreter */
	if (strcmp(arg, "off") == 0)
		param_acpi_off = true;
	else if (strcmp(arg, "on") == 0) /* prefer ACPI over device tree */
		param_acpi_on = true;
	else
		return -EINVAL; /* Core will printk when we return error. */

	return 0;
}
early_param("acpi", parse_acpi);
@@ -365,16 +370,25 @@ EXPORT_SYMBOL(acpi_unmap_cpu);
#endif /* CONFIG_ACPI_HOTPLUG_CPU */

void __init acpi_boot_table_init(void)

{
	/**
	 * ACPI is disabled by default.
	 * ACPI is only enabled when firmware passes ACPI table
	 * and sets boot parameter "acpi=on".
	 */
	if (param_acpi_on)
		enable_acpi();

	/*
	 * If acpi_disabled, bail out
	 */
	if (!acpi_disabled) {
		pr_warn("Currently, ACPI is an experimental feature!\n");
		if (acpi_table_init()) {
			pr_err("Failed to init ACPI tables\n");
			disable_acpi();
		}
		pr_info("Enable ACPI support\n");
		} else
			pr_info("Successfully parsed ACPI table\n");
	}
}