Skip to contentSkip to conversation

PMI breakage in cell_defconfig

PATCH New Christian Krafft 1 participant 2 messages Jun 28, 2007 4 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): 20070627161545.468b03ba@localhost

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): 20070628115049.393e8a6d@localhost

#4 lore raw

Subject: cbe_cpufreq: fix build error

From: Christian Krafft <[email protected]>

The cbe_cpufreq driver should build without PMI
interface. The code that deals with PMI has been
#ifdef'ed out. This is not the optimal solution for now.
A later version of the cpufreq driver has been cleaned out
from all PMI code. Until that patch makes it into the kernel
use this patch to fix build issues when building cpufreq driver without PMI.

arch/powerpc/platforms/cell/cbe_cpufreq.c +10 -5
Index: linux/arch/powerpc/platforms/cell/cbe_cpufreq.c
===================================================================
@@ -74,6 +74,7 @@ static unsigned int pmi_frequency_limit 
 
 static struct of_device *pmi_dev;
 
+#ifdef CONFIG_PPC_PMI
 static int set_pmode_pmi(int cpu, unsigned int pmode)
 {
 	int ret;
@@ -102,7 +103,7 @@ static int set_pmode_pmi(int cpu, unsign
 #endif
 	return ret;
 }
-
+#endif
 
 static int get_pmode(int cpu)
 {
@@ -157,9 +158,11 @@ static int set_pmode_reg(int cpu, unsign
 }
 
 static int set_pmode(int cpu, unsigned int slow_mode) {
+#ifdef CONFIG_PPC_PMI
 	if (pmi_dev)
 		return set_pmode_pmi(cpu, slow_mode);
 	else
+#endif
 		return set_pmode_reg(cpu, slow_mode);
 }
 
@@ -323,26 +326,28 @@ static struct cpufreq_driver cbe_cpufreq
 
 static int __init cbe_cpufreq_init(void)
 {
+#ifdef CONFIG_PPC_PMI
 	struct device_node *np;
-
+#endif
 	if (!machine_is(cell))
 		return -ENODEV;
-
+#ifdef CONFIG_PPC_PMI
 	np = of_find_node_by_type(NULL, "ibm,pmi");
 
 	pmi_dev = of_find_device_by_node(np);
 
 	if (pmi_dev)
 		pmi_register_handler(pmi_dev, &cbe_pmi_handler);
-
+#endif
 	return cpufreq_register_driver(&cbe_cpufreq_driver);
 }
 
 static void __exit cbe_cpufreq_exit(void)
 {
+#ifdef CONFIG_PPC_PMI
 	if (pmi_dev)
 		pmi_unregister_handler(pmi_dev, &cbe_pmi_handler);
-
+#endif
 	cpufreq_unregister_driver(&cbe_cpufreq_driver);
 }
 
Signature · 13 lines
Mit freundlichen Gruessen,
kind regards,

Christian Krafft
IBM Systems & Technology Group,
Linux Kernel Development
IT Specialist


Vorsitzender des Aufsichtsrats:	Martin Jetter
Geschaeftsfuehrung:		Herbert Kircher
Sitz der Gesellschaft:		Boeblingen
Registriergericht:		Amtsgericht Stuttgart, HRB 243294
#5 lore raw

PATCH 1/1 cell: pmi remove support for mutiple devices.

From: Christian Krafft <[email protected]>

The pmi driver got simplified by removing support for multiple devices. As there is no more than one pmi device per maschine, there is no need to specify the device for listening and sending messages.

This way the caller (cbe_cpufreq) doesn't need to scan the device tree. When registering the handler on a board without a pmi interface, pmi.c will just return -ENODEV.

The patch that fixed the breakage of cell_defconfig has been broken out of the earlier version of this patch. So this is the version that applies cleanly on top of it.

arch/powerpc/platforms/cell/cbe_cpufreq.c +14 -22
Index: linux-2.6.22-rc5/arch/powerpc/platforms/cell/cbe_cpufreq.c
===================================================================
@@ -68,11 +68,12 @@ static u64 MIC_Slow_Next_Timer_table[] =
 };
 
 static unsigned int pmi_frequency_limit = 0;
+
 /*
  * hardware specific functions
  */
 
-static struct of_device *pmi_dev;
+static bool cbe_cpufreq_has_pmi;
 
 #ifdef CONFIG_PPC_PMI
 static int set_pmode_pmi(int cpu, unsigned int pmode)
@@ -91,7 +92,7 @@ static int set_pmode_pmi(int cpu, unsign
 	time = (u64) get_cycles();
 #endif
 
-	pmi_send_message(pmi_dev, pmi_msg);
+	pmi_send_message(pmi_msg);
 	ret = pmi_msg.data2;
 
 	pr_debug("PMI returned slow mode %d\n", ret);
@@ -157,16 +158,16 @@ static int set_pmode_reg(int cpu, unsign
 	return 0;
 }
 
-static int set_pmode(int cpu, unsigned int slow_mode) {
+static int set_pmode(int cpu, unsigned int slow_mode)
+{
 #ifdef CONFIG_PPC_PMI
-	if (pmi_dev)
+	if (cbe_cpufreq_has_pmi)
 		return set_pmode_pmi(cpu, slow_mode);
-	else
 #endif
-		return set_pmode_reg(cpu, slow_mode);
+	return set_pmode_reg(cpu, slow_mode);
 }
 
-static void cbe_cpufreq_handle_pmi(struct of_device *dev, pmi_message_t pmi_msg)
+static void cbe_cpufreq_handle_pmi(pmi_message_t pmi_msg)
 {
 	u8 cpu;
 	u8 cbe_pmode_new;
@@ -253,7 +254,7 @@ static int cbe_cpufreq_cpu_init(struct c
 
 	cpufreq_frequency_table_get_attr(cbe_freqs, policy->cpu);
 
-	if (pmi_dev) {
+	if (cbe_cpufreq_has_pmi) {
 		/* frequency might get limited later, initialize limit with max_freq */
 		pmi_frequency_limit = max_freq;
 		cpufreq_register_notifier(&pmi_notifier_block, CPUFREQ_POLICY_NOTIFIER);
@@ -265,7 +266,7 @@ static int cbe_cpufreq_cpu_init(struct c
 
 static int cbe_cpufreq_cpu_exit(struct cpufreq_policy *policy)
 {
-	if (pmi_dev)
+	if (cbe_cpufreq_has_pmi)
 		cpufreq_unregister_notifier(&pmi_notifier_block, CPUFREQ_POLICY_NOTIFIER);
 
 	cpufreq_frequency_table_put_attr(policy->cpu);
@@ -326,29 +327,20 @@ static struct cpufreq_driver cbe_cpufreq
 
 static int __init cbe_cpufreq_init(void)
 {
-#ifdef CONFIG_PPC_PMI
-	struct device_node *np;
-#endif
 	if (!machine_is(cell))
 		return -ENODEV;
-#ifdef CONFIG_PPC_PMI
-	np = of_find_node_by_type(NULL, "ibm,pmi");
 
-	pmi_dev = of_find_device_by_node(np);
+	cbe_cpufreq_has_pmi = pmi_register_handler(&cbe_pmi_handler) == 0;
 
-	if (pmi_dev)
-		pmi_register_handler(pmi_dev, &cbe_pmi_handler);
-#endif
 	return cpufreq_register_driver(&cbe_cpufreq_driver);
 }
 
 static void __exit cbe_cpufreq_exit(void)
 {
-#ifdef CONFIG_PPC_PMI
-	if (pmi_dev)
-		pmi_unregister_handler(pmi_dev, &cbe_pmi_handler);
-#endif
 	cpufreq_unregister_driver(&cbe_cpufreq_driver);
+
+	if (cbe_cpufreq_has_pmi)
+		pmi_unregister_handler(&cbe_pmi_handler);
 }
 
 module_init(cbe_cpufreq_init);
arch/powerpc/sysdev/pmi.c +22 -29

138 lines not on this page · raw message

include/asm-powerpc/pmi.h +4 -4
Index: linux-2.6.22-rc5/include/asm-powerpc/pmi.h
===================================================================
@@ -55,13 +55,13 @@ typedef struct {
 struct pmi_handler {
 	struct list_head node;
 	u8 type;
-	void (*handle_pmi_message) (struct of_device *, pmi_message_t);
+	void (*handle_pmi_message) (pmi_message_t);
 };
 
-void pmi_register_handler(struct of_device *, struct pmi_handler *);
-void pmi_unregister_handler(struct of_device *, struct pmi_handler *);
+int pmi_register_handler(struct pmi_handler *);
+void pmi_unregister_handler(struct pmi_handler *);
 
-void pmi_send_message(struct of_device *, pmi_message_t);
+int pmi_send_message(pmi_message_t);
 
 #endif /* __KERNEL__ */
 #endif /* _POWERPC_PMI_H */