On 11/giu/2013, at 12:23, Graeme Gregory graeme.gregory@linaro.org wrote:
From: Al Stone al.stone@linaro.org
Some hacks that will allow compilation of drivers/acpi on arm. These will need to be replaced with proper solutions.
Signed-off-by: Al Stone al.stone@linaro.org Signed-off-by: Graeme Gregory graeme.gregory@linaro.org
drivers/acpi/acpi_pad.c | 15 +++++++++++++++ drivers/acpi/acpica/tbutils.c | 1 + drivers/acpi/bus.c | 11 +++++++---- drivers/acpi/osl.c | 14 ++++++++++++++ drivers/acpi/processor_core.c | 25 +++++++++++++++++++------ drivers/acpi/processor_driver.c | 9 +++++++++ drivers/acpi/processor_idle.c | 36 ++++++++++++++++++++++++++++++++++++ drivers/acpi/reboot.c | 11 +++++++++-- 8 files changed, 110 insertions(+), 12 deletions(-)
diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c index 31de104..a145e8b 100644 --- a/drivers/acpi/acpi_pad.c +++ b/drivers/acpi/acpi_pad.c @@ -30,7 +30,10 @@ #include <linux/slab.h> #include <acpi/acpi_bus.h> #include <acpi/acpi_drivers.h> +#ifdef CONFIG_X86
- /* BOZO: abstract out? */
#include <asm/mwait.h> +#endif
#define ACPI_PROCESSOR_AGGREGATOR_CLASS "acpi_pad" #define ACPI_PROCESSOR_AGGREGATOR_DEVICE_NAME "Processor Aggregator" @@ -47,6 +50,8 @@ static unsigned char lapic_marked_unstable;
static void power_saving_mwait_init(void) { +#ifdef CONFIG_X86
- /* BOZO: abstract out? */ unsigned int eax, ebx, ecx, edx; unsigned int highest_cstate = 0; unsigned int highest_subcstate = 0;
@@ -72,6 +77,7 @@ static void power_saving_mwait_init(void) } power_saving_mwait_eax = (highest_cstate << MWAIT_SUBSTATE_SIZE) | (highest_subcstate - 1); +#endif
#if defined(CONFIG_X86) switch (boot_cpu_data.x86_vendor) { @@ -173,8 +179,11 @@ static int power_saving_thread(void *data)
while (!need_resched()) { if (tsc_detected_unstable && !tsc_marked_unstable) {
+#ifdef CONFIG_X86
/* BOZO: abstract out? */ /* TSC could halt in idle, so notify users */ mark_tsc_unstable("TSC halts in idle");
+#endif tsc_marked_unstable = 1; } if (lapic_detected_unstable && !lapic_marked_unstable) { @@ -193,10 +202,16 @@ static int power_saving_thread(void *data) CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &cpu); stop_critical_timings();
+#ifdef CONFIG_X86
- /* BOZO: abstract out? */ __monitor((void *)¤t_thread_info()->flags, 0, 0);
+#endif smp_mb(); +#ifdef CONFIG_X86
- /* BOZO: abstract out? */ if (!need_resched()) __mwait(power_saving_mwait_eax, 1);
+#endif
start_critical_timings(); if (lapic_marked_unstable)
diff --git a/drivers/acpi/acpica/tbutils.c b/drivers/acpi/acpica/tbutils.c index ce3d5db..2b6d8dc 100644 --- a/drivers/acpi/acpica/tbutils.c +++ b/drivers/acpi/acpica/tbutils.c @@ -634,6 +634,7 @@ acpi_tb_parse_root_table(acpi_physical_address rsdp_address) acpi_status status;
ACPI_FUNCTION_TRACE(tb_parse_root_table);
printk(KERN_INFO "(I) entering acpi_tb_parse_root_table\n");
/*
- Map the entire RSDP and extract the address of the RSDT or XSDT
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 01708a1..303c4ac 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -79,10 +79,6 @@ static struct dmi_system_id dsdt_dmi_table[] __initdata = { }, {} }; -#else -static struct dmi_system_id dsdt_dmi_table[] __initdata = {
- {}
-}; #endif
/* -------------------------------------------------------------------------- @@ -618,6 +614,9 @@ static int __init acpi_bus_init_irq(void) case ACPI_IRQ_MODEL_PLATFORM: message = "platform specific model"; break;
- case ACPI_IRQ_MODEL_GIC:
message = "GIC";
default: printk(KERN_WARNING PREFIX "Unknown interrupt routing model\n"); return -ENODEV;break;
@@ -654,11 +653,15 @@ void __init acpi_early_init(void)
acpi_gbl_permanent_mmap = 1;
+#ifdef CONFIG_X86 /*
* NB: ARM does not use DMI; only older Intel products do.
*
*/
- If the machine falls into the DMI check table,
- DSDT will be copied to memory
there is activity ongoing to support SMBIOS DMI tables and DMI decode with Grant and Yi Li at Linaro... and I was actually wondering if such tables had to be passed via FDT (as being prototyped by Li, if I am not wrong) or if there is any ACPI table for this.
And you have actually highlighted it in your patch, wrapping the DMI init into the #ifdef x86.
Guess that Li can help you remove the #ifdef once his task is complete :-)
dmi_check_system(dsdt_dmi_table); +#endif
status = acpi_reallocate_root_table(); if (ACPI_FAILURE(status)) { diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 586e7e9..ab57f09 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -1030,9 +1030,18 @@ acpi_os_read_pci_configuration(struct acpi_pci_id * pci_id, u32 reg, return AE_ERROR; }
+#ifdef CONFIG_X86
- /*
* BOZO: probably should not call this function at all
* if there is no PCI...
result = raw_pci_read(pci_id->segment, pci_id->bus, PCI_DEVFN(pci_id->device, pci_id->function), reg, size, &value32);*/
+#else
- result = 0;
- value32 = 0;
+#endif *value = value32;
return (result ? AE_ERROR : AE_OK); @@ -1058,9 +1067,14 @@ acpi_os_write_pci_configuration(struct acpi_pci_id * pci_id, u32 reg, return AE_ERROR; }
+#ifdef CONFIG_X86
- /* BOZO: how do we handle not having PCI? */ result = raw_pci_write(pci_id->segment, pci_id->bus, PCI_DEVFN(pci_id->device, pci_id->function), reg, size, value);
+#else
- result = 0;
+#endif
return (result ? AE_ERROR : AE_OK); } diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index 164d495..09e5e4f 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c @@ -164,9 +164,6 @@ exit:
int acpi_get_cpuid(acpi_handle handle, int type, u32 acpi_id) { -#ifdef CONFIG_SMP
- int i;
-#endif int apic_id = -1;
apic_id = map_mat_entry(handle, type, acpi_id); @@ -199,16 +196,32 @@ int acpi_get_cpuid(acpi_handle handle, int type, u32 acpi_id) return apic_id; }
+#if defined(CONFIG_ARM) || defined(CONFIG_ARM64)
- /*
* BOZO: need to abstract this out to have it make sense --
* it's not that ARM has no equivalent, it's that apic_id is
* arch-specific
*/
+#else
#ifdef CONFIG_SMP
- for_each_possible_cpu(i) {
if (cpu_physical_id(i) == apic_id)
return i;
- {
int i;
for_each_possible_cpu(i) {
if (cpu_physical_id(i) == apic_id)
return i;
}}
#else /* In UP kernel, only processor 0 is valid */ if (apic_id == 0) return apic_id; #endif
+#endif /* defined(CONFIG_ARM) || defined(CONFIG_ARM64) */
- return -1;
} EXPORT_SYMBOL_GPL(acpi_get_cpuid); diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c index bec717f..de80f78 100644 --- a/drivers/acpi/processor_driver.c +++ b/drivers/acpi/processor_driver.c @@ -374,9 +374,12 @@ static int acpi_processor_get_info(struct acpi_device *device) * ensure we get the right value in the "physical id" field * of /proc/cpuinfo */ +#ifdef CONFIG_X86
- /* BOZO: abstract out? */ status = acpi_evaluate_object(pr->handle, "_SUN", NULL, &buffer); if (ACPI_SUCCESS(status)) arch_fix_phys_package_id(pr->id, object.integer.value);
+#endif
return 0; } @@ -838,10 +841,13 @@ static acpi_status acpi_processor_hotadd_init(struct acpi_processor *pr) if (acpi_map_lsapic(handle, &pr->id)) return AE_ERROR;
+#ifdef CONFIG_X86
- /* BOZO: abstract out? */ if (arch_register_cpu(pr->id)) { acpi_unmap_lsapic(pr->id); return AE_ERROR; }
+#endif
/* CPU got hot-plugged, but cpu_data is not initialized yet * Set flag to delay cpu_idle/throttling initialization @@ -875,7 +881,10 @@ static int acpi_processor_handle_eject(struct acpi_processor *pr) "brought the CPU back online\n", pr->id); return -EAGAIN; } +#ifdef CONFIG_X86
- /* BOZO: abstract out? */ arch_unregister_cpu(pr->id);
+#endif acpi_unmap_lsapic(pr->id); put_online_cpus(); return (0); diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index ee255c6..0b6132a 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -120,17 +120,26 @@ static struct dmi_system_id __cpuinitdata processor_power_dmi_table[] = { */ static void acpi_safe_halt(void) { +#ifdef CONFIG_X86
- /* BOZO: abstract out? */ current_thread_info()->status &= ~TS_POLLING;
+#endif /* * TS_POLLING-cleared state must be visible before we * test NEED_RESCHED: */ smp_mb(); if (!need_resched()) { +#ifdef CONFIG_X86
/* BOZO: abstract out? */ safe_halt();
+#endif local_irq_disable(); } +#ifdef CONFIG_X86
- /* BOZO: abstract out? */ current_thread_info()->status |= TS_POLLING;
+#endif }
#ifdef ARCH_APICTIMER_STOPS_ON_C3 @@ -752,6 +761,8 @@ static int acpi_idle_play_dead(struct cpuidle_device *dev, int index)
while (1) {
+#ifdef CONFIG_X86
/* BOZO: abstract out? */ if (cx->entry_method == ACPI_CSTATE_HALT) safe_halt(); else if (cx->entry_method == ACPI_CSTATE_SYSTEMIO) {
@@ -759,6 +770,7 @@ static int acpi_idle_play_dead(struct cpuidle_device *dev, int index) /* See comment in acpi_idle_do_entry() */ inl(acpi_gbl_FADT.xpm_timer_block.address); } else +#endif return -ENODEV; }
@@ -784,7 +796,10 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev, return -EINVAL;
if (cx->entry_method != ACPI_CSTATE_FFH) { +#ifdef CONFIG_X86
/* BOZO: abstract out? */ current_thread_info()->status &= ~TS_POLLING;
+#endif /* * TS_POLLING-cleared state must be visible before we test * NEED_RESCHED: @@ -792,7 +807,10 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev, smp_mb();
if (unlikely(need_resched())) {
+#ifdef CONFIG_X86
/* BOZO: abstract out? */ current_thread_info()->status |= TS_POLLING;
+#endif return -EINVAL; } } @@ -812,8 +830,11 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
sched_clock_idle_wakeup_event(0);
+#ifdef CONFIG_X86
- /* BOZO: abstract out? */ if (cx->entry_method != ACPI_CSTATE_FFH) current_thread_info()->status |= TS_POLLING;
+#endif
lapic_timer_state_broadcast(pr, cx, 0); return index; @@ -852,7 +873,10 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, }
if (cx->entry_method != ACPI_CSTATE_FFH) { +#ifdef CONFIG_X86
/* BOZO: abstract out? */ current_thread_info()->status &= ~TS_POLLING;
+#endif /* * TS_POLLING-cleared state must be visible before we test * NEED_RESCHED: @@ -860,12 +884,18 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, smp_mb();
if (unlikely(need_resched())) {
+#ifdef CONFIG_X86
/* BOZO: abstract out? */ current_thread_info()->status |= TS_POLLING;
+#endif return -EINVAL; } }
+#ifdef CONFIG_X86
- /* BOZO: abstract out? */ acpi_unlazy_tlb(smp_processor_id());
+#endif
/* Tell the scheduler that we are going deep-idle: */ sched_clock_idle_sleep_event(); @@ -908,8 +938,11 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
sched_clock_idle_wakeup_event(0);
+#ifdef CONFIG_X86
- /* BOZO: abstract out? */ if (cx->entry_method != ACPI_CSTATE_FFH) current_thread_info()->status |= TS_POLLING;
+#endif
lapic_timer_state_broadcast(pr, cx, 0); return index; @@ -1169,7 +1202,10 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr)
if (!first_run) { dmi_check_system(processor_power_dmi_table); +#ifdef CONFIG_X86
- /* BOZO: abstract out? */ max_cstate = acpi_processor_cstate_check(max_cstate);
+#endif if (max_cstate < ACPI_C_STATES_MAX) printk(KERN_NOTICE "ACPI: processor limited to max C-state %d\n", diff --git a/drivers/acpi/reboot.c b/drivers/acpi/reboot.c index a6c77e8b..410d0be 100644 --- a/drivers/acpi/reboot.c +++ b/drivers/acpi/reboot.c @@ -6,9 +6,7 @@ void acpi_reboot(void) { struct acpi_generic_address *rr;
struct pci_bus *bus0; u8 reset_value;
unsigned int devfn;
if (acpi_disabled) return;
@@ -31,7 +29,15 @@ void acpi_reboot(void) /* The reset register can only exist in I/O, Memory or PCI config space * on a device on bus 0. */ switch (rr->space_id) { +/*
- There are some rare cases in the ARM world with PCI is not one
- of the buses available to us, even though we use ACPI.
- */
+#ifdef CONFIG_PCI case ACPI_ADR_SPACE_PCI_CONFIG:
struct pci_bus *bus0;
unsigned int devfn;
/* The reset register can only live on bus 0. */ bus0 = pci_find_bus(0, 0); if (!bus0)
@@ -44,6 +50,7 @@ void acpi_reboot(void) pci_bus_write_config_byte(bus0, devfn, (rr->address & 0xffff), reset_value); break; +#endif
case ACPI_ADR_SPACE_SYSTEM_MEMORY: case ACPI_ADR_SPACE_SYSTEM_IO: -- 1.7.10.4
Linaro-acpi mailing list Linaro-acpi@lists.linaro.org http://lists.linaro.org/mailman/listinfo/linaro-acpi