Subject: [patch] NONCOHERENT compile fix for r3k

From: Adrian Bunk <[email-masked]>
Date: Wed, 28 Nov 2001 13:36:48 +0100 (CET)

Hi,

I got the following erros while compiling a kernel for my 5000/240:

gcc -I /home/bunk/linux/include/asm/gcc -D__KERNEL__ -I/home/bunk/linux/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fomit-frame-pointer -fno-strict-aliasing -fno-common -G 0 -mno-abicalls -fno-pic -mcpu=r3000 -mips1 -pipe    -c -o c-r3k.o c-r3k.c
Assembler messages:
Warning: The -mcpu option is deprecated.  Please use -march and -mtune instead.
c-r3k.c: In function `ld_mmu_r23000':
c-r3k.c:334: `_dma_cache_wback_inv' undeclared (first use in this function)
     c-r3k.c:334: (Each undeclared identifier is reported only once
		   c-r3k.c:334: for each function it appears in.)
     c-r3k.c:317: warning: unused variable `config'
make[2]: *** [c-r3k.o] Error 1
make[2]: Leaving directory `/home/bunk/linux/arch/mips/mm'
make[1]: *** [first_rule] Error 2
make[1]: Leaving directory `/home/bunk/linux/arch/mips/mm'
make: *** [_dir_arch/mips/mm] Error 2

gcc -I /home/bunk/linux/include/asm/gcc -D__KERNEL__ -I/home/bunk/linux/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fomit-frame-pointer -fno-strict-aliasing -fno-common -G 0 -mno-abicalls -fno-pic -mcpu=r3000 -mips1 -pipe    -c -o c-tx39.o c-tx39.c
Assembler messages:
Warning: The -mcpu option is deprecated.  Please use -march and -mtune instead.
c-tx39.c: In function `ld_mmu_tx39':
c-tx39.c:298: `_dma_cache_wback_inv' undeclared (first use in this function)
     c-tx39.c:298: (Each undeclared identifier is reported only once
		    c-tx39.c:298: for each function it appears in.)
     c-tx39.c:320: `_dma_cache_wback' undeclared (first use in this function)
c-tx39.c:321: `_dma_cache_inv' undeclared (first use in this function)
     make[2]: *** [c-tx39.o] Error 1
make[2]: Leaving directory `/home/bunk/linux/arch/mips/mm'
make[1]: *** [first_rule] Error 2
make[1]: Leaving directory `/home/bunk/linux/arch/mips/mm'
make: *** [_dir_arch/mips/mm] Error 2

The following patches fix these compile errors:

--- arch/mips/mm/c-r3k.c.old	Wed Nov 28 11:30:01 2001
+++ arch/mips/mm/c-r3k.c	Wed Nov 28 11:38:07 2001
@@ -331,7 +331,11 @@
 	_flush_icache_page = r3k_flush_icache_page;
 	_flush_icache_range = r3k_flush_icache_range;

+#ifdef CONFIG_NONCOHERENT_IO
+
 	_dma_cache_wback_inv = r3k_dma_cache_wback_inv;
+
+#endif /* CONFIG_NONCOHERENT_IO */

 	printk("Primary instruction cache %dkb, linesize %d bytes\n",
 		(int) (icache_size >> 10), (int) icache_lsize);

--- arch/mips/mm/c-tx39.c.old	Wed Nov 28 12:08:37 2001
+++ arch/mips/mm/c-tx39.c	Wed Nov 28 12:56:28 2001
@@ -295,7 +295,12 @@
 		_flush_icache_page	= (void *) tx39h_flush_icache_all;
 		_flush_icache_range	= (void *) tx39h_flush_icache_all;

+#ifdef CONFIG_NONCOHERENT_IO
+
 		_dma_cache_wback_inv = tx39h_dma_cache_wback_inv;
+
+#endif /* CONFIG_NONCOHERENT_IO */
+
 		break;

 	case CPU_TX3922:
@@ -316,9 +321,13 @@
 		_flush_icache_page = tx39_flush_icache_page;
 		_flush_icache_range = tx39_flush_icache_range;

+#ifdef CONFIG_NONCOHERENT_IO
+
 		_dma_cache_wback_inv = tx39_dma_cache_wback_inv;
 		_dma_cache_wback = tx39_dma_cache_wback;
 		_dma_cache_inv = tx39_dma_cache_inv;
+
+#endif /* CONFIG_NONCOHERENT_IO */

 		break;
 	}

While booting the kernel I had the same problem Flo already reported:

scsi0 : ESP236 (NCR53C9x)
scsi: unknown type 16
  Vendor:  . ... .  Model:     à. .  *!      Rev: ,. .
  Type:   Unknown                            ANSI SCSI revision: 04
resize_dma_pool: unknown device type 16
resize_dma_pool: unknown device type 16

cu
Adrian