[PATCH] New Patches for 2.1.41

Wolfram Kleff (kleff@informatik.uni-bonn.de)
Thu, 29 May 1997 13:21:21 +0200 (MET DST)


First of all thanks for all the reply, (especial everybody who
has made a CC to my email address ! - I'm thinking about re-subscribing
to the mailing list, because linux.dev.kernel seems to be really broken :-( )

Well, I try to summarize most reply I hope thats okay....

First, due to the various demand (you can't believe how many people still use
s/w displays nowadays :), here is a new version of the printk patch.
This time there is an option for color display, if you select no,
only bright and blink will be used for important messages.
(look into the patch for details)
So there should be _absolutely_ :-) no problem anymore - even for
color blind people......

Sorry Richard, the suggestion with CONFIG_COLOR_PRINTK came
too late, I have called it CONFIG_VT_CONSOLE_COLOR, in the hope
that other developers might use it, too. (I still think there are
really (too ?) many config options....)

> Even allow for modifcation of colors if you want..
Do you really like that ? Well, the main purpose for writing this
patch was, the catch important kernel messages while they scroll
at boot time... and not to make linux look like an old "colored" AMIBIOS ;-)
But if you have any good suggestions I might do that.

> Will French <wfrench@interport.net>:
> Bad idea; some colors won't show up on some black-and-white
> VGA monitors. For example, if the monitor only reads from the
> "green" pin, red messages won't show.

> Pawel S. Veselov <vps@beta.niimm.spb.su>:
> If monitor reads from only one pin it is broken. And there is no problem to
> make color mixer on video output by hand.

I think, like Pawel, that this is broken hardware.....
(just use 3 resistors....)
anyway it doesn't matter anymore....

> Will French <wfrench@interport.net>:
> No problem for you or me perhaps, but a big problem for Joe
> User, who may never have used a soldering iron.
Well, "Joe User" will never use a s/w display anymore.....

> Will French <wfrench@interport.net>:
> I can assure you that such "broken" monitors exist.
Really ? Very bad.... :-(

And Alan:
> alan@lxorguk.ukuu.org.uk (Alan Cox):
> > - misc. bugfixes like:
> > - "NE2000/NE1000 support" configuration belongs before "Other ISA cards"
> > because there IS a PCI version
>
> Possile good point - Tho if its PCI its not an NE2000 clone its something
> vaguely NE2000 like on a PCI bus.

Here is a quote from the Ethernet HOWTO, I hope that will be an answer:

> 5.26.2. NE2000-PCI (RealTek-8029)
>
> Status -- Supported
>
> Yes, believe it or not, people are making PCI cards based on the ten
> year old interface design of the ne2000. At the moment nearly all of
> these cards are based on the RealTek 8029 chip, and linux kernel v2.0
> has support to automatically detect these cards at boot and use them.
>
> If you have a NE2000 PCI card that is not based on the RealTek 8029
> chip, please contact the maintainer of the NE2000 driver as listed in
> /usr/src/linux/MAINTAINERS. That way the ID of your card can also be
> added to the driver.
>
> Note that you have to say `Y' to the `Other ISA cards' option when
> running make config as you are actually using the same NE2000 driver
> as the ISA cards use.

And I think exactly this will confuse many people....

There is another point - the AMD-K5 patch:
After a suggestion form Jaromir Koutek (thanks !) I have done some stability
tests, I must admit that there is really no problem with the invlpg command
anymore in 2.1.40 .....
So invlpg doesn't cause the pipeline bug (at least not alone) - but what else ?
But if I remarked it in 2.0.30 we get rid of the bug......
Well,..... does anybody knows why ??????? (Or any ideas that might help
fixing it in 2.0.30 ?)
So, I hope we can get rid of this patch in >=2.1.40 :-)

There are other little changes, like
- AMD-K5 detection
- an warning addition to the CFLAGS
(-Wpointer-arith -Wcast-align -Wwrite-strings -Winline)
- a little change in defconfig
(it should be generic now - what do you think about it ?)

Hope you like it more, (I hope anybody is happy now ;-)
Wolfram

PS: What do I have to do to export a function label from the kernel to
a kernel module ?
The be more verbose: There is a function like

unsigned int I_want_to_be_exported(void)
{
return something;
}
EXPORT_SYMBOL(I_want_to_be_exported);

in the kernel.
Now I want to access this function from a module.
But insmod always returns "unresolved symbol I_want_to_be_exported".
Any help or ideas ?

diff -u --recursive --new-file linux-2.1.41/Documentation/Configure.help linux/Documentation/Configure.help
--- linux-2.1.41/Documentation/Configure.help Tue May 27 14:01:16 1997
+++ linux/Documentation/Configure.help Tue May 27 14:01:16 1997
@@ -4021,6 +4021,12 @@
visible on your display. You should say Y here if you have no other
console device.

+Console on color display
+CONFIG_VT_CONSOLE_COLOR
+ If you have a color monitor connected to your Computer say Y here.
+ (Yes, some people claim that they still don't use a color monitor for
+ their console.....)
+
Standard/generic serial support
CONFIG_SERIAL
This selects whether you want to include the driver for the standard
diff -u --recursive --new-file linux-2.1.41/Makefile linux/Makefile
--- linux-2.1.41/Makefile Tue May 27 14:01:16 1997
+++ linux/Makefile Tue May 27 14:01:16 1997
@@ -88,7 +88,7 @@
# standard CFLAGS
#

-CFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
+CFLAGS = -Wall -Wstrict-prototypes -Wpointer-arith -Wcast-align -Wwrite-strings -Winline -O2 -fomit-frame-pointer

ifdef CONFIG_CPP
CFLAGS := $(CFLAGS) -x c++
diff -u --recursive --new-file linux-2.1.41/arch/i386/defconfig linux/arch/i386/defconfig
--- linux-2.1.41/arch/i386/defconfig Tue May 27 14:01:16 1997
+++ linux/arch/i386/defconfig Tue May 27 14:01:16 1997
@@ -12,12 +12,12 @@
#
CONFIG_MODULES=y
# CONFIG_MODVERSIONS is not set
-# CONFIG_KERNELD is not set
+CONFIG_KERNELD=y

#
# General setup
#
-# CONFIG_MATH_EMULATION is not set
+CONFIG_MATH_EMULATION=y
CONFIG_NET=y
CONFIG_PCI=y
# CONFIG_MCA is not set
@@ -25,10 +25,7 @@
CONFIG_SYSCTL=y
CONFIG_BINFMT_AOUT=y
CONFIG_BINFMT_ELF=y
-# CONFIG_M386 is not set
-# CONFIG_M486 is not set
-# CONFIG_M586 is not set
-CONFIG_M686=y
+CONFIG_M386=y
# CONFIG_VIDEO_SELECT is not set
# CONFIG_PNP_PARPORT is not set

@@ -126,7 +123,7 @@
# CONFIG_SCSI_ADVANSYS is not set
# CONFIG_SCSI_IN2000 is not set
# CONFIG_SCSI_AM53C974 is not set
-CONFIG_SCSI_BUSLOGIC=y
+# CONFIG_SCSI_BUSLOGIC is not set
CONFIG_SCSI_OMIT_FLASHPOINT=y
# CONFIG_SCSI_DTC3280 is not set
# CONFIG_SCSI_EATA_DMA is not set
@@ -157,15 +154,9 @@
# CONFIG_NET_VENDOR_3COM is not set
# CONFIG_LANCE is not set
# CONFIG_NET_VENDOR_SMC is not set
+# CONFIG_NE2000 is not set
# CONFIG_NET_ISA is not set
-CONFIG_NET_EISA=y
-# CONFIG_PCNET32 is not set
-# CONFIG_APRICOT is not set
-# CONFIG_CS89x0 is not set
-# CONFIG_DE4X5 is not set
-# CONFIG_DEC_ELCP is not set
-# CONFIG_DGRS is not set
-CONFIG_EEXPRESS_PRO100=y
+# CONFIG_NET_EISA is not set
# CONFIG_NET_POCKET is not set
# CONFIG_FDDI is not set
# CONFIG_DLCI is not set
@@ -216,6 +207,7 @@
#
CONFIG_VT=y
CONFIG_VT_CONSOLE=y
+# CONFIG_VT_CONSOLE_COLOR is not set
CONFIG_SERIAL=y
# CONFIG_SERIAL_EXTENDED is not set
# CONFIG_SERIAL_NONSTANDARD is not set
diff -u --recursive --new-file linux-2.1.41/arch/i386/kernel/irq.c linux/arch/i386/kernel/irq.c
--- linux-2.1.41/arch/i386/kernel/irq.c Tue May 27 14:01:16 1997
+++ linux/arch/i386/kernel/irq.c Tue May 27 14:01:16 1997
@@ -222,7 +222,7 @@
math_error();
}

-static struct irqaction irq13 = { math_error_irq, 0, 0, "math error", NULL, NULL };
+static struct irqaction irq13 = { math_error_irq, 0, 0, "FPU math error", NULL, NULL };

/*
* IRQ2 is cascade interrupt to second interrupt controller
diff -u --recursive --new-file linux-2.1.41/arch/i386/kernel/setup.c linux/arch/i386/kernel/setup.c
--- linux-2.1.41/arch/i386/kernel/setup.c Tue May 27 14:01:16 1997
+++ linux/arch/i386/kernel/setup.c Tue May 27 14:01:16 1997
@@ -2,6 +2,8 @@
* linux/arch/i386/kernel/setup.c
*
* Copyright (C) 1995 Linus Torvalds
+ *
+ * correct AMD CPU detection 1997-05-26, Wolfram Kleff
*/

/*
@@ -233,14 +235,23 @@
return NULL;
}

-static const char * i586model(unsigned int nr)
+static const char * i586model(unsigned int nr, const char *vendor)
{
- static const char *model[] = {
+ static const char *intel_model[] = {
"0", "Pentium 60/66","Pentium 75+","OverDrive PODP5V83",
"Pentium MMX"
};
- if (nr < sizeof(model)/sizeof(char *))
- return model[nr];
+ static const char *amd_model[] = {
+ "AMD-K5-PR75/90/100", "AMD-K5-PR120/133","AMD-K5-PR166",
+ "AMD-K5-PR200"
+ };
+ if (vendor && strcmp(vendor,"AuthenticAMD")==0) {
+ if (nr < sizeof(amd_model)/sizeof(char *))
+ return amd_model[nr];
+ } else {
+ if (nr < sizeof(intel_model)/sizeof(char *))
+ return intel_model[nr];
+ }
return NULL;
}

@@ -254,7 +265,7 @@
return NULL;
}

-static const char * getmodel(int x86, int model)
+static const char * getmodel(int x86, int model, const char *vendor)
{
const char *p = NULL;
static char nbuf[12];
@@ -263,7 +274,7 @@
p = i486model(model);
break;
case 5:
- p = i586model(model);
+ p = i586model(model,vendor);
break;
case 6:
p = i686model(model);
@@ -311,7 +322,7 @@
CPUN,
CD(x86)+'0',
CD(have_cpuid) ?
- getmodel(CD(x86), CD(x86_model)) :
+ getmodel(CD(x86), CD(x86_model), CD(x86_vendor_id)) :
"unknown",
CD(x86_vendor_id));

diff -u --recursive --new-file linux-2.1.41/drivers/char/Config.in linux/drivers/char/Config.in
--- linux-2.1.41/drivers/char/Config.in Tue May 27 14:01:16 1997
+++ linux/drivers/char/Config.in Tue May 27 14:01:16 1997
@@ -7,6 +7,7 @@
bool 'Virtual terminal' CONFIG_VT
if [ "$CONFIG_VT" = "y" ]; then
bool 'Console on virtual terminal' CONFIG_VT_CONSOLE
+ bool 'Console on color display' CONFIG_VT_CONSOLE_COLOR
fi
tristate 'Standard/generic (dumb) serial support' CONFIG_SERIAL
bool 'Extended dumb serial driver options' CONFIG_SERIAL_EXTENDED
diff -u --recursive --new-file linux-2.1.41/drivers/char/rtc.c linux/drivers/char/rtc.c
--- linux-2.1.41/drivers/char/rtc.c Tue May 27 14:01:16 1997
+++ linux/drivers/char/rtc.c Tue May 27 14:01:16 1997
@@ -536,11 +536,11 @@
{
unsigned long flags;

- printk("Real Time Clock Driver v%s\n", RTC_VERSION);
- if(request_irq(RTC_IRQ, rtc_interrupt, SA_INTERRUPT, "rtc", NULL))
+ printk(KERN_INFO "Real Time Clock Driver v%s\n", RTC_VERSION);
+ if(request_irq(RTC_IRQ, rtc_interrupt, SA_INTERRUPT, "Real Time Clock", NULL))
{
/* Yeah right, seeing as irq 8 doesn't even hit the bus. */
- printk("rtc: IRQ %d is not free.\n", RTC_IRQ);
+ printk(KERN_ERR "rtc: IRQ %d is not free.\n", RTC_IRQ);
return -EIO;
}
misc_register(&rtc_dev);
@@ -802,4 +802,3 @@
rtc_irq_data = 0;
restore_flags(flags);
}
-
diff -u --recursive --new-file linux-2.1.41/drivers/isdn/isdn_audio.c linux/drivers/isdn/isdn_audio.c
--- linux-2.1.41/drivers/isdn/isdn_audio.c Tue May 27 14:01:16 1997
+++ linux/drivers/isdn/isdn_audio.c Tue May 27 14:01:16 1997
@@ -247,7 +247,7 @@
{'*', '0', '#', 'D'}
};

-#if ((CPU == 386) || (CPU == 486) || (CPU == 586))
+#ifdef __i386__
static inline void
isdn_audio_tlookup(const void *table, void *buff, unsigned long n)
{
diff -u --recursive --new-file linux-2.1.41/drivers/net/Config.in linux/drivers/net/Config.in
--- linux-2.1.41/drivers/net/Config.in Tue May 27 14:01:16 1997
+++ linux/drivers/net/Config.in Tue May 27 14:01:16 1997
@@ -40,6 +40,7 @@
fi
tristate 'SMC 9194 support' CONFIG_SMC9194
fi
+ tristate 'NE2000/NE1000 support' CONFIG_NE2000
bool 'Other ISA cards' CONFIG_NET_ISA
if [ "$CONFIG_NET_ISA" = "y" ]; then
if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
@@ -59,7 +60,6 @@
if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
tristate 'ICL EtherTeam 16i/32 support' CONFIG_ETH16I
fi
- tristate 'NE2000/NE1000 support' CONFIG_NE2000
tristate 'NI5210 support' CONFIG_NI52
tristate 'NI6510 support' CONFIG_NI65
if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
diff -u --recursive --new-file linux-2.1.41/include/asm-i386/bugs.h linux/include/asm-i386/bugs.h
--- linux-2.1.41/include/asm-i386/bugs.h Tue May 27 14:01:16 1997
+++ linux/include/asm-i386/bugs.h Tue May 27 14:01:16 1997
@@ -49,8 +49,8 @@

if (!hard_math) {
#ifndef CONFIG_MATH_EMULATION
- printk("No coprocessor found and no math emulation present.\n");
- printk("Giving up.\n");
+ printk(KERN_ERR "No coprocessor found and no math emulation present.\n");
+ printk(KERN_ERR "Giving up.\n");
for (;;) ;
#endif
return;
@@ -64,7 +64,7 @@
* So the irq13 will happen eventually, but the exception 16
* should get there first..
*/
- printk("Checking 386/387 coupling... ");
+ printk(KERN_INFO "Checking 386/387 coupling...");
timer_table[COPRO_TIMER].expires = jiffies+50;
timer_table[COPRO_TIMER].fn = copro_timeout;
timer_active |= 1<<COPRO_TIMER;
@@ -77,7 +77,7 @@
if (fpu_error)
return;
if (!ignore_irq13) {
- printk("Ok, fpu using old IRQ13 error reporting\n");
+ printk("OK, FPU using old IRQ13 error reporting\n");
return;
}
__asm__("fninit\n\t"
@@ -92,7 +92,7 @@
: "=m" (*&fdiv_bug)
: "m" (*&x), "m" (*&y));
if (!fdiv_bug) {
- printk("Ok, fpu using exception 16 error reporting.\n");
+ printk("OK, FPU using exception 16 error reporting.\n");
return;

}
@@ -101,13 +101,13 @@

static void check_hlt(void)
{
- printk("Checking 'hlt' instruction... ");
+ printk(KERN_INFO "Checking 'hlt' instruction...");
if (!hlt_works_ok) {
printk("disabled\n");
return;
}
__asm__ __volatile__("hlt ; hlt ; hlt ; hlt");
- printk("Ok.\n");
+ printk("OK\n");
}

static void check_tlb(void)
@@ -118,8 +118,8 @@
* They will fault when they hit an invlpg instruction.
*/
if (x86 == 3) {
- printk("CPU is a 386 and this kernel was compiled for 486 or better.\n");
- printk("Giving up.\n");
+ printk(KERN_EMERG "CPU is a 386 and this kernel was compiled for 486 or better.\n");
+ printk(KERN_EMERG "Giving up.\n");
for (;;) ;
}
#endif
diff -u --recursive --new-file linux-2.1.41/include/asm-i386/uaccess.h linux/include/asm-i386/uaccess.h
--- linux-2.1.41/include/asm-i386/uaccess.h Tue May 27 14:01:16 1997
+++ linux/include/asm-i386/uaccess.h Tue May 27 14:01:16 1997
@@ -6,6 +6,9 @@
*/
#include <linux/sched.h>
#include <asm/segment.h>
+#ifdef __KERNEL__
+#include <linux/config.h>
+#endif

#define VERIFY_READ 0
#define VERIFY_WRITE 1
@@ -43,7 +46,7 @@

extern int __verify_write(const void *, unsigned long);

-#if CPU > 386
+#ifndef CONFIG_M386
#define __access_ok(type,addr,size) \
(__kernel_ok || __user_ok(addr,size))
#else
diff -u --recursive --new-file linux-2.1.41/include/linux/config.h linux/include/linux/config.h
--- linux-2.1.41/include/linux/config.h Tue May 27 14:01:16 1997
+++ linux/include/linux/config.h Tue May 27 14:01:16 1997
@@ -1,7 +1,9 @@
#ifndef _LINUX_CONFIG_H
#define _LINUX_CONFIG_H

+#ifdef __KERNEL__
#include <linux/autoconf.h>
+#endif

/*
* Defines for what uname() should return
diff -u --recursive --new-file linux-2.1.41/init/main.c linux/init/main.c
--- linux-2.1.41/init/main.c Tue May 27 14:01:16 1997
+++ linux/init/main.c Tue May 27 14:01:16 1997
@@ -584,7 +584,7 @@

loops_per_sec = (1<<12);

- printk("Calibrating delay loop.. ");
+ printk(KERN_INFO "Calibrating delay loop: ");
while (loops_per_sec <<= 1) {
/* wait for "start of" clock tick */
ticks = jiffies;
@@ -615,7 +615,7 @@
/* finally, adjust loops per second in terms of seconds instead of clocks */
loops_per_sec *= HZ;
/* Round the value and print it */
- printk("ok - %lu.%02lu BogoMIPS\n",
+ printk("%lu.%02lu BogoMIPS\n",
(loops_per_sec+2500)/500000,
((loops_per_sec+2500)/5000) % 100);
}
diff -u --recursive --new-file linux-2.1.41/kernel/printk.c linux/kernel/printk.c
--- linux-2.1.41/kernel/printk.c Tue May 27 14:01:16 1997
+++ linux/kernel/printk.c Tue May 27 14:01:16 1997
@@ -10,6 +10,9 @@
* elsewhere, in preparation for a serial line console (someday).
* Ted Ts'o, 2/11/93.
* Modified for sysctl support, 1/8/97, Chris Horn.
+ *
+ * make printk message level visible on console 1997-05-22, Wolfram Kleff
+ *
*/

#include <stdarg.h>
@@ -26,9 +29,16 @@
#include <linux/smp_lock.h>
#include <linux/console.h>
#include <linux/init.h>
+#include <linux/config.h>

#include <asm/uaccess.h>

+#ifdef __i386__ /* test it on non x86 hardware and this will change */
+#ifdef CONFIG_VT_CONSOLE
+#include "../drivers/char/console_struct.h"
+#endif
+#endif
+
#define LOG_BUF_LEN 8192

static char buf[1024];
@@ -171,7 +181,6 @@
return error;
}

-
asmlinkage int printk(const char *fmt, ...)
{
va_list args;
@@ -181,6 +190,11 @@
static signed char msg_level = -1;
long flags;

+#ifdef CONFIG_VT_CONSOLE
+ unsigned char s_attr;
+ int currcons=0;
+#endif
+
__save_flags(flags);
__cli();
va_start(args, fmt);
@@ -221,11 +235,57 @@
}
if (msg_level < console_loglevel && console_drivers) {
struct console *c = console_drivers;
+
+#ifdef __i386__ /* test it on non x86 hardware and this will change */
+#ifdef CONFIG_VT_CONSOLE
+ s_attr = attr;
+ switch (msg_level) {
+#ifdef CONFIG_VT_CONSOLE_COLOR
+ case 0: /* system is unusable */
+ attr = 0x47 | 0x08 | 0x80; /* white on red, bright, blink */
+ break;
+ case 1: /* action must be taken immediately */
+ attr = 0x74 | 0x08 | 0x80; /* red on white, bright, blink */
+ break;
+ case 2: /* critical conditions */
+ attr = 0x74 | 0x08; /* red on white, bright */
+ break;
+ case 3: /* error conditions */
+ attr = 0x04 | 0x08; /* red on black, bright */
+ break;
+ case 4: /* warning conditions */
+ attr = 0x04; /* red on black */
+ break;
+ case 5: /* normal but significant condition */
+ attr |= 0x08; /* bright */
+ break;
+#else
+ case 0: /* system is unusable */
+ case 1: /* action must be taken immediately */
+ attr |= 0x08 | 0x80; /* bright, blink */
+ break;
+ case 2: /* critical conditions */
+ attr |= 0x80; /* blink */
+ break;
+ case 3: /* error conditions */
+ case 4: /* warning conditions */
+ case 5: /* normal but significant condition */
+ attr |= 0x08; /* bright */
+ break;
+#endif
+ }
+#endif
+#endif
while(c) {
if (c->write)
c->write(msg, p - msg + line_feed);
c = c->next;
}
+#ifdef __i386__ /* test it on non x86 hardware and this will change */
+#ifdef CONFIG_VT_CONSOLE
+ attr = s_attr;
+#endif
+#endif
}
if (line_feed)
msg_level = -1;