ANyone with a MDA card on a SMP or even UP machione please test this
patch. This patch should fix any SMP deadlocks that could happen with
a MDA card. Thank you.
--- mdacon.c.orig Wed Oct 11 18:09:01 2000
+++ mdacon.c Wed Oct 11 18:14:18 2000
@@ -37,6 +37,7 @@
#include <linux/vt_kern.h>
#include <linux/vt_buffer.h>
#include <linux/selection.h>
+#include <linux/spinlock.h>
#include <linux/ioport.h>
#include <linux/delay.h>
#include <linux/init.h>
@@ -44,6 +45,7 @@
#include <asm/io.h>
#include <asm/vga.h>
+static spinlock_t mda_lock = SPIN_LOCK_UNLOCKED;
/* description of the hardware layout */
@@ -80,7 +82,6 @@
MODULE_PARM(mda_last_vc, "1-255i");
#endif
-
/* MDA register values
*/
@@ -110,23 +111,24 @@
{
unsigned long flags;
- save_flags(flags); cli();
+ spin_lock_irqsave(&mda_lock, flags);
outb_p(reg, mda_index_port);
outb_p(val, mda_value_port);
- restore_flags(flags);
+ spin_unlock_irqrestore(&mda_lock, flags);
}
static void write_mda_w(unsigned int val, unsigned char reg)
{
unsigned long flags;
- save_flags(flags); cli();
+ spin_lock_irqsave(&mda_lock, flags);
outb_p(reg, mda_index_port); outb_p(val >> 8, mda_value_port);
outb_p(reg+1, mda_index_port); outb_p(val & 0xff, mda_value_port);
+ spin_unlock_irqrestore(&mda_lock, flags);
restore_flags(flags);
}
@@ -134,15 +136,14 @@
{
unsigned long flags;
- save_flags(flags); cli();
+ spin_lock_irqsave(&mda_lock, flags);
outb_p(reg, mda_index_port);
outb (val, mda_value_port);
udelay(20); val = (inb_p(mda_value_port) == val);
- restore_flags(flags);
-
+ spin_unlock_irqrestore(&mda_lock, flags);
return val;
}