All of lore.kernel.org
 help / color / mirror / Atom feed
* [parisc-linux] [RFC] Patch to handle parisc-device quirks/bugs.
@ 2002-11-17 19:05 Ryan Bradetich
  2002-11-17 19:33 ` Grant Grundler
  2002-11-17 20:00 ` Matthew Wilcox
  0 siblings, 2 replies; 6+ messages in thread
From: Ryan Bradetich @ 2002-11-17 19:05 UTC (permalink / raw)
  To: parisc-linux

Hello parisc-linux hackers,

I have written a small patch to handle a case on the E35 where
the device is mis-reported.  Specifically, the upper port of the
HP-PB bus converter is reported as:

	U2-IOA BC GSC+ Port

This is obviously wrong since U2 connects runway to GSC and this
bus converer is attempting to connect GSC to HP-PB. The correct
bus converter is:

	Gecko BOA BC GSC+ Port

The following patch fixes this problem by adding a HP hardare
quirks table, and fixing up the device early on in the discovery
process so everything else just works.


My question about the patch is is the interface generic enough.
The one thing I do not like is depending upon the HPA of the
device to determine the quirk, but I could not think of a 
different/better way to handle this.

Thoughts?

- Ryan




Index: arch/parisc/kernel/drivers.c
===================================================================
RCS file: /var/cvs/linux-2.5/arch/parisc/kernel/drivers.c,v
retrieving revision 1.5
diff -u -p -r1.5 drivers.c
--- arch/parisc/kernel/drivers.c	16 Nov 2002 17:54:08 -0000	1.5
+++ arch/parisc/kernel/drivers.c	17 Nov 2002 18:54:37 -0000
@@ -416,6 +416,8 @@ alloc_pa_dev(unsigned long hpa, struct h
 	dev->id.sversion = ((iodc_data[4] & 0x0f) << 16) |
 			(iodc_data[5] << 8) | iodc_data[6];
 	dev->hpa = hpa;
+
+	parisc_hardware_quirks(dev);
 	name = parisc_hardware_description(&dev->id);
 	if (name) {
 		strncpy(dev->name, name, sizeof(dev->name)-1);
Index: arch/parisc/kernel/hardware.c
===================================================================
RCS file: /var/cvs/linux-2.5/arch/parisc/kernel/hardware.c,v
retrieving revision 1.4
diff -u -p -r1.4 hardware.c
--- arch/parisc/kernel/hardware.c	3 Nov 2002 01:52:48 -0000	1.4
+++ arch/parisc/kernel/hardware.c	17 Nov 2002 18:54:38 -0000
@@ -1289,6 +1289,21 @@ char *cpu_name_version[][2] = {
 	[pcxw2]	{ "PA8700 (PCX-W2)",	"2.0" }
 };
 
+static struct hp_hardware_quirk {
+	unsigned long hpa;
+	struct parisc_device_id quirk;
+	struct parisc_device_id real;
+} hp_hardware_quirk_list[] __initdata = {
+	/* E35 - Gecko BOA GSC Bus Converter is reported */
+	/* 	 as a U2 GSC Bus converter. */
+	{ 0xfffb8000,	{HPHW_BCPORT, 0, 0x501, 0x0000c },
+			{HPHW_BCPORT, 0, 0x500, 0x0000c }},
+
+	/* NULL terminated list */
+	{ 0x0,		{ HPHW_FAULTY, 0, 0x00, 0x0 },
+			{ HPHW_FAULTY, 0, 0x00, 0x0 }},
+};
+
 const char * __init
 parisc_hardware_description(struct parisc_device_id *id)
 {
@@ -1343,3 +1358,21 @@ parisc_get_cpu_type(unsigned long hversi
 	return pcx;	/* not reached: */
 }
 
+
+void __init parisc_hardware_quirks(struct parisc_device *dev)
+{
+	struct hp_hardware_quirk *list;
+
+	for(list = hp_hardware_quirk_list; list->hpa; list++) {
+		if((dev->hpa == list->hpa) && 
+			(dev->id.hw_type == list->quirk.hw_type) &&
+			(dev->id.hversion == list->quirk.hversion) &&
+			(dev->id.sversion == list->quirk.sversion)) 
+		{
+			dev->id.hw_type = list->real.hw_type;
+			dev->id.hversion = list->real.hversion;
+			dev->id.sversion = list->real.sversion;
+			return;
+		}
+	}
+}
Index: include/asm-parisc/hardware.h
===================================================================
RCS file: /var/cvs/linux-2.5/include/asm-parisc/hardware.h,v
retrieving revision 1.3
diff -u -p -r1.3 hardware.h
--- include/asm-parisc/hardware.h	20 Jul 2002 15:52:25 -0000	1.3
+++ include/asm-parisc/hardware.h	17 Nov 2002 18:54:38 -0000
@@ -131,6 +131,7 @@ struct bc_module {
 /* hardware.c: */
 extern const char *parisc_hardware_description(struct parisc_device_id *id);
 extern enum cpu_type parisc_get_cpu_type(unsigned long hversion);
+extern void parisc_hardware_quirks(struct parisc_device *dev);
 
 struct pci_dev;
 

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-11-17 20:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-17 19:05 [parisc-linux] [RFC] Patch to handle parisc-device quirks/bugs Ryan Bradetich
2002-11-17 19:33 ` Grant Grundler
2002-11-17 19:56   ` Ryan Bradetich
2002-11-17 20:00 ` Matthew Wilcox
2002-11-17 20:22   ` Ryan Bradetich
2002-11-17 20:48     ` Grant Grundler

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.