From: Vishwesh M Rudramuni <[email protected]> Date: Tue, 14 Dec 2010 16:30:42 +0530 Subject: [PATCH] pmu driver common code
This patch contains: - x86 specific code for allocating boot memory in < 1MB space, where the wake code will be copied for S0i3 entry/exit sequuence. - pci platform pm ops registration for Moorestown/Medfield MID. Signed-off-by: Vishwesh M Rudramuni <[email protected]> Signed-off-by: Rajeev D Muralidhar <[email protected]> --- arch/x86/kernel/setup.c | 3 +- arch/x86/kernel/smpboot.c | 6 ++++- drivers/pci/Makefile | 1 + drivers/pci/mid_pci.c | 53 +++++++++++++++++++++++++++++++++++++++++++++ drivers/pci/mid_pci.h | 30 +++++++++++++++++++++++++ include/linux/smp.h | 6 +++++ 6 files changed, 97 insertions(+), 2 deletions(-) create mode 100644 drivers/pci/mid_pci.c create mode 100644 drivers/pci/mid_pci.h diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 180103e..15bd297 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -67,6 +67,7 @@ #include <linux/percpu.h> #include <linux/crash_dump.h> #include <linux/tboot.h> +#include <linux/intel_mid.h> #include <video/edid.h> @@ -997,7 +998,7 @@ void __init setup_arch(char **cmdline_p) #ifndef CONFIG_NO_BOOTMEM early_res_to_bootmem(0, max_low_pfn<<PAGE_SHIFT); #endif - + intel_mid_reserve_bootmem(); dma32_reserve_bootmem(); #ifdef CONFIG_KVM_CLOCK diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 0bf2ece..81e477b 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c @@ -1371,7 +1371,11 @@ void native_cpu_die(unsigned int cpu) alternatives_smp_switch(0); return; } - msleep(100); + + if (!is_intel_pm_enabled()) + msleep(100); + else + schedule(); } pr_err("CPU %u didn't die...\n", cpu); } diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile index 0b51857..cb8ae45 100644 --- a/drivers/pci/Makefile +++ b/drivers/pci/Makefile @@ -49,6 +49,7 @@ obj-$(CONFIG_MIPS) += setup-bus.o setup-irq.o obj-$(CONFIG_X86_VISWS) += setup-irq.o obj-$(CONFIG_MN10300) += setup-bus.o obj-$(CONFIG_MICROBLAZE) += setup-bus.o +obj-$(CONFIG_INTEL_MID_POWER) += mid_pci.o # # ACPI Related PCI FW Functions diff --git a/drivers/pci/mid_pci.c b/drivers/pci/mid_pci.c new file mode 100644 index 0000000..6bf2126 --- /dev/null +++ b/drivers/pci/mid_pci.c @@ -0,0 +1,53 @@ +/* + * mid_pci.c + * Copyright (c) 2010, Intel Corporation. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + * + */ +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/init.h> +#include <linux/pci.h> +#include <linux/bootmem.h> +#include <linux/intel_mid.h> +#include "pci.h" +#include "mid_pci.h" + +static struct pci_platform_pm_ops pmu_pci_platform_pm = { + .is_manageable = pmu_pci_power_manageable, + .set_state = pmu_pci_set_power_state, + .choose_state = pmu_pci_choose_state, + .can_wakeup = pmu_pci_can_wakeup, + .sleep_wake = pmu_pci_sleep_wake, +}; + +/** + * mid_pci_init - It registers callback function for all the PCI devices + * for platform specific device power on/shutdown acticities. + */ +static int __init mid_pci_init(void) +{ + int ret = 0; + + pr_info("mid_pci_init is called\n"); + + /* register pmu driver call back function for platform specific + * set power state for pci devices + */ + pci_set_platform_pm(&pmu_pci_platform_pm); + + return ret; +} +arch_initcall(mid_pci_init); diff --git a/drivers/pci/mid_pci.h b/drivers/pci/mid_pci.h new file mode 100644 index 0000000..7bf5e49 --- /dev/null +++ b/drivers/pci/mid_pci.h @@ -0,0 +1,30 @@ +/* + * mid_pci.h + * Copyright (c) 2010, Intel Corporation. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + * + */ +#ifndef MID_PCI_H +#define MID_PCI_H + +extern void ppm_resume(void); +extern void ppm_resume_end(void); +extern int pmu_pci_set_power_state(struct pci_dev *pdev, pci_power_t state); +extern pci_power_t pmu_pci_choose_state(struct pci_dev *pdev); +extern bool pmu_pci_power_manageable(struct pci_dev *pdev); +extern bool pmu_pci_can_wakeup(struct pci_dev *pdev); +extern int pmu_pci_sleep_wake(struct pci_dev *pdev, bool enable); + +#endif /* define MID_PCI_H */ diff --git a/include/linux/smp.h b/include/linux/smp.h index cfa2d20..08b7fbc 100644 --- a/include/linux/smp.h +++ b/include/linux/smp.h @@ -151,6 +151,12 @@ smp_call_function_any(const struct cpumask *mask, void (*func)(void *info), #endif /* !SMP */ +#ifdef CONFIG_INTEL_MID_POWER +#define is_intel_pm_enabled() 1 +#else +#define is_intel_pm_enabled() 0 +#endif + /* * smp_processor_id(): get the current CPU ID. * -- 1.6.0.4
_______________________________________________ MeeGo-kernel mailing list [email protected] http://lists.meego.com/listinfo/meego-kernel
