linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [2.4] PCI chipset Opti Viper M/N+
@ 2003-10-24  9:56 Malware
  2003-10-24 10:12 ` Michael Mueller
       [not found] ` <md5:FBD343F3435F79857BDF1297AFE82D42>
  0 siblings, 2 replies; 3+ messages in thread
From: Malware @ 2003-10-24  9:56 UTC (permalink / raw)
  To: mj; +Cc: linux-kernel

Hi Martin and linux-kernel readers,

I had problems using CardBus cards in my laptop, they simply got no IRQ assigned. The kernel currently used is 2.4.22.

BIOS settings and telling the kernel to use the PCI BIOS provided no solution. The BIOS settings available are minimal and the PCI BIOS is buggy causing crashes when called from the kernel.

So finally I added support for the specific PCI chipset, Opti Viper M/N+, to the kernel PCI code. See the patch below which is relative to the 2.4.22 kernel. Now the CardBus cards get an interrupt assigned as excepted. It worked fine with a Xircom modem/ethernet card which I got access to for a short testing.


Michael


--- kernel-source-2.4.22-1/arch/i386/kernel/pci-irq.c.orig	2003-10-21 22:52:50.000000000 +0200
+++ kernel-source-2.4.22-1/arch/i386/kernel/pci-irq.c	2003-10-24 11:18:31.000000000 +0200
@@ -243,6 +243,44 @@
 }
 
 /*
+ * OPTI Viper-M/N+: Bit field with 3 bits per entry.
+ * Due to the lack of a specification the information about this chipset
+ * was taken from the NetBSD source code.
+ */
+static int pirq_viper_get(struct pci_dev *router, struct pci_dev *dev, int pirq)
+{
+	static const int viper_irq_decode[] = { 0, 5, 9, 10, 11, 12, 14, 15 };
+	u32 irq;
+
+	pci_read_config_dword(router, 0x40, &irq);
+	irq >>= (pirq-1)*3;
+	irq &= 7;
+
+	return viper_irq_decode[irq];
+}
+
+static int pirq_viper_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq)
+{
+	static const int viper_irq_map[] = { -1, -1, -1, -1, -1, 1, -1, -1, -1, 2, 3, 4, 5, -1, 6, 7 };
+	int newval = viper_irq_map[irq];
+	u32 val;
+	u32 mask = 7 << (3*(pirq-1));
+#if 0
+	mask |= 0x10000UL << (pirq-1);	/* edge triggered */
+#endif
+
+	if ( newval == -1 )
+		return 0;
+	
+	pci_read_config_dword(router, 0x40, &val);
+	val &= ~mask;
+	val |= newval << (3*(pirq*1));
+	pci_write_config_dword(router, 0x40, val);
+
+	return 1;
+}
+
+/*
  * Cyrix: nibble offset 0x5C
  */
 static int pirq_cyrix_get(struct pci_dev *router, struct pci_dev *dev, int pirq)
@@ -485,6 +523,7 @@
 	{ "VIA", PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686, pirq_via_get, pirq_via_set },
 
 	{ "OPTI", PCI_VENDOR_ID_OPTI, PCI_DEVICE_ID_OPTI_82C700, pirq_opti_get, pirq_opti_set },
+	{ "OPTI VIPER", PCI_VENDOR_ID_OPTI, PCI_DEVICE_ID_OPTI_82C558, pirq_viper_get, pirq_viper_set },
 
 	{ "NatSemi", PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5520, pirq_cyrix_get, pirq_cyrix_set },
 	{ "SIS", PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_503, pirq_sis_get, pirq_sis_set },

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

end of thread, other threads:[~2003-10-24 11:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-10-24  9:56 [2.4] PCI chipset Opti Viper M/N+ Malware
2003-10-24 10:12 ` Michael Mueller
     [not found] ` <md5:FBD343F3435F79857BDF1297AFE82D42>
2003-10-24 11:38   ` Michael Mueller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).