Kernel-Patches

Wolfram Kleff (kleff@athene.informatik.uni-bonn.de)
Fri, 2 May 1997 23:33:34 +0200 (MET DST)


Hello,

here is a little cleanup patch and support for AMD-K5 CPUs
for the linux kernel sources. (2.0.30)

They should be useful for 2.1.x, too.

The patch against drivers/isdn/isdn_audio.c is done with the HiSax 2.0 patched
kernel version.

Hope you like it,
Wolfram

diff -Nru linux-old/include/linux/blk.h linux-new/include/linux/blk.h
--- linux-old/include/linux/blk.h Tue Apr 29 22:36:54 1997
+++ linux-new/include/linux/blk.h Tue Apr 29 22:36:54 1997
@@ -39,37 +39,37 @@

#ifdef CONFIG_CDU31A
extern int cdu31a_init(void);
-#endif CONFIG_CDU31A
+#endif
#ifdef CONFIG_MCD
extern int mcd_init(void);
-#endif CONFIG_MCD
+#endif
#ifdef CONFIG_MCDX
extern int mcdx_init(void);
-#endif CONFIG_MCDX
+#endif
#ifdef CONFIG_SBPCD
extern int sbpcd_init(void);
-#endif CONFIG_SBPCD
+#endif
#ifdef CONFIG_AZTCD
extern int aztcd_init(void);
-#endif CONFIG_AZTCD
+#endif
#ifdef CONFIG_CDU535
extern int sony535_init(void);
-#endif CONFIG_CDU535
+#endif
#ifdef CONFIG_GSCD
extern int gscd_init(void);
-#endif CONFIG_GSCD
+#endif
#ifdef CONFIG_CM206
extern int cm206_init(void);
-#endif CONFIG_CM206
+#endif
#ifdef CONFIG_OPTCD
extern int optcd_init(void);
-#endif CONFIG_OPTCD
+#endif
#ifdef CONFIG_SJCD
extern int sjcd_init(void);
-#endif CONFIG_SJCD
+#endif
#ifdef CONFIG_CDI_INIT
extern int cdi_init(void);
-#endif CONFIG_CDI_INIT
+#endif
#ifdef CONFIG_BLK_DEV_HD
extern int hd_init(void);
#endif
@@ -84,7 +84,7 @@
#endif
#ifdef CONFIG_BLK_DEV_MD
extern int md_init(void);
-#endif CONFIG_BLK_DEV_MD
+#endif

extern void set_device_ro(kdev_t dev,int flag);
void add_blkdev_randomness(int major);
diff -Nru linux-old/include/asm-i386/segment.h linux-new/include/asm-i386/segment.h
--- linux-old/include/asm-i386/segment.h Tue Apr 29 22:36:54 1997
+++ linux-new/include/asm-i386/segment.h Tue Apr 29 22:36:54 1997
@@ -112,32 +112,32 @@
case 0:
return;
case 1:
- __put_user(*(const char *) from, (char *) to, 1);
+ __put_user(*(const unsigned char *) from, (char *) to, 1);
return;
case 2:
- __put_user(*(const short *) from, (short *) to, 2);
+ __put_user(*(const unsigned short *) from, (short *) to, 2);
return;
case 3:
- __put_user(*(const short *) from, (short *) to, 2);
- __put_user(*(2+(const char *) from), 2+(char *) to, 1);
+ __put_user(*(const unsigned short *) from, (short *) to, 2);
+ __put_user(*(2+(const unsigned char *) from), 2+(char *) to, 1);
return;
case 4:
- __put_user(*(const int *) from, (int *) to, 4);
+ __put_user(*(const unsigned int *) from, (int *) to, 4);
return;
case 8:
- __put_user(*(const int *) from, (int *) to, 4);
- __put_user(*(1+(const int *) from), 1+(int *) to, 4);
+ __put_user(*(const unsigned int *) from, (int *) to, 4);
+ __put_user(*(1+(const unsigned int *) from), 1+(int *) to, 4);
return;
case 12:
- __put_user(*(const int *) from, (int *) to, 4);
- __put_user(*(1+(const int *) from), 1+(int *) to, 4);
- __put_user(*(2+(const int *) from), 2+(int *) to, 4);
+ __put_user(*(const unsigned int *) from, (int *) to, 4);
+ __put_user(*(1+(const unsigned int *) from), 1+(int *) to, 4);
+ __put_user(*(2+(const unsigned int *) from), 2+(int *) to, 4);
return;
case 16:
- __put_user(*(const int *) from, (int *) to, 4);
- __put_user(*(1+(const int *) from), 1+(int *) to, 4);
- __put_user(*(2+(const int *) from), 2+(int *) to, 4);
- __put_user(*(3+(const int *) from), 3+(int *) to, 4);
+ __put_user(*(const unsigned int *) from, (int *) to, 4);
+ __put_user(*(1+(const unsigned int *) from), 1+(int *) to, 4);
+ __put_user(*(2+(const unsigned int *) from), 2+(int *) to, 4);
+ __put_user(*(3+(const unsigned int *) from), 3+(int *) to, 4);
return;
}
#define COMMON(x) \
@@ -149,7 +149,7 @@
x \
"pop %%es" \
: /* no outputs */ \
- :"c" (n/4),"D" ((long) to),"S" ((long) from) \
+ :"c" (n/4),"D" ((unsigned long) to),"S" ((long) from) \
:"cx","di","si")

switch (n % 4) {
diff -Nru linux-old/drivers/isdn/isdn_audio.c linux-new/drivers/isdn/isdn_audio.c
--- linux-old/drivers/isdn/isdn_audio.c Tue Apr 29 22:36:54 1997
+++ linux-new/drivers/isdn/isdn_audio.c Tue Apr 29 22:36:54 1997
@@ -250,7 +250,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 -Nru linux-old/include/asm-i386/pgtable.h linux-new/include/asm-i386/pgtable.h
--- linux-old/include/asm-i386/pgtable.h Tue Apr 29 22:36:54 1997
+++ linux-new/include/asm-i386/pgtable.h Tue Apr 29 22:36:54 1997
@@ -42,7 +42,7 @@
#define __flush_tlb() \
do { unsigned long tmpreg; __asm__ __volatile__("movl %%cr3,%0\n\tmovl %0,%%cr3":"=r" (tmpreg) : :"memory"); } while (0)

-#ifdef CONFIG_M386
+#if defined(CONFIG_M386) || defined(CONFIG_MK5)
#define __flush_tlb_one(addr) flush_tlb()
#else
#define __flush_tlb_one(addr) \
diff -Nru linux-old/arch/i386/config.in linux-new/arch/i386/config.in
--- linux-old/arch/i386/config.in Mon May 13 06:17:23 1996
+++ linux-new/arch/i386/config.in Thu Apr 29 22:36:54 1997
@@ -42,14 +42,13 @@
"386 CONFIG_M386 \
486 CONFIG_M486 \
Pentium CONFIG_M586 \
- PPro CONFIG_M686" Pentium
+ PPro CONFIG_M686 \
+ AMD-K5 CONFIG_MK5" 386
endmenu

source drivers/block/Config.in

-if [ "$CONFIG_NET" = "y" ]; then
- source net/Config.in
-fi

mainmenu_option next_comment
comment 'SCSI support'
@@ -62,6 +61,8 @@
endmenu

if [ "$CONFIG_NET" = "y" ]; then
+ source net/Config.in
+
mainmenu_option next_comment
comment 'Network device support'

diff -Nru linux-old/arch/i386/Makefile linux-new/arch/i386/Makefile
--- linux-old/arch/i386/Makefile Thu Jul 25 18:35:00 1996
+++ linux-new/arch/i386/Makefile Thu Apr 29 22:36:54 1997
@@ -77,6 +77,10 @@
CFLAGS := $(CFLAGS) -m486 -malign-loops=2 -malign-jumps=2 -malign-functions=2 -DCPU=686
endif

+ifdef CONFIG_MK5
+CFLAGS := $(CFLAGS) -m486 -malign-loops=2 -malign-jumps=2 -malign-functions=2 -DCPU=K5
+endif
+
ifdef SMP
CFLAGS := $(CFLAGS) -D__SMP__
endif
diff -Nru linux-old/include/asm-i386/bugs.h linux-new/include/asm-i386/bugs.h
--- linux-old/include/asm-i386/bugs.h Tue Jan 2 14:11:04 1996
+++ linux-new/include/asm-i386/bugs.h Thu Apr 29 22:36:54 1997
@@ -64,7 +64,7 @@
* So the irq13 will happen eventually, but the exception 16
* should get there first..
*/
- printk("Checking 386/387 coupling... ");
+ printk("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("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)