All of lore.kernel.org
 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

* Re: [2.4] PCI chipset Opti Viper M/N+
  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>
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Mueller @ 2003-10-24 10:12 UTC (permalink / raw)
  To: mj; +Cc: linux-kernel

Hi Martin and linux-kernel readers,

receiving my previous mail myself did give me another view to it and now
I am curious why it did work that fine with following typo present:
> +       val |= newval << (3*(pirq*1));

it should read:
   val |= newval << (3*(pirq-1));

With this changed it still works with the PCMCIA card, but I still need
to gain access to a CardBus card to test it with.


Michael

-- 
Linux@TekXpress
http://www-users.rwth-aachen.de/Michael.Mueller4/tekxp/tekxp.html

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

* Re: [2.4] PCI chipset Opti Viper M/N+
       [not found] ` <md5:FBD343F3435F79857BDF1297AFE82D42>
@ 2003-10-24 11:38   ` Michael Mueller
  0 siblings, 0 replies; 3+ messages in thread
From: Michael Mueller @ 2003-10-24 11:38 UTC (permalink / raw)
  To: mj, linux-kernel

Hi Martin and linux-kernel readers,

I wrote:
> it should read:
>    val |= newval << (3*(pirq-1));
> 
> With this changed it still works with the PCMCIA card, but I still need
> to gain access to a CardBus card to test it with.

Ok, tested it with a LevelOne 10/100MBit CardBus card in a local
computer store. It works fine.


Michael

-- 
Linux@TekXpress
http://www-users.rwth-aachen.de/Michael.Mueller4/tekxp/tekxp.html

^ 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 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.