Linux MIPS Architecture development
 help / color / mirror / Atom feed
* Re: Troubles in r2300.c
  2001-06-07  1:39 Troubles in r2300.c Alexandr Andreev
@ 2001-06-06 18:34 ` Maciej W. Rozycki
  2001-06-06 19:55 ` Ralf Baechle
  1 sibling, 0 replies; 4+ messages in thread
From: Maciej W. Rozycki @ 2001-06-06 18:34 UTC (permalink / raw)
  To: Alexandr Andreev, Ralf Baechle; +Cc: linux-mips

On Wed, 6 Jun 2001, Alexandr Andreev wrote:

> In the r2300.c ,in some functions ( like the r3k_cache_size and so on ), 
> the
> CONFIG register is modified. To return this register to initial state, the
> save_and_cli(flags) and the restore_flags(flags) functions are used. The
> restore_flags do not modify whole STATUS register, but only the 
> Interrupt Enable
> bit. So we should use the read_32bit_cp0_register and the 
> write_32bit_cp0_register
> functions instead ( like it was in linux-2.4.1 ).

 Sh*t!  Why do people keep "fixing" things they did not break, especially
when no one is watching???  The functions were already discussed back in
January or so and I already explained why read/write functions are needed
instead of cli/restore!

 I think I'll cook up a patch with a few explicit comments so nobody
touches the code unless he know what he is doing.

 Ralf, please apply the patch ASAP.  Thanks.

  Maciej

-- 
+  Maciej W. Rozycki, Technical University of Gdansk, Poland   +
+--------------------------------------------------------------+
+        e-mail: macro@ds2.pg.gda.pl, PGP key available        +

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

* Re: Troubles in r2300.c
  2001-06-07  1:39 Troubles in r2300.c Alexandr Andreev
  2001-06-06 18:34 ` Maciej W. Rozycki
@ 2001-06-06 19:55 ` Ralf Baechle
  2001-06-07 23:11   ` Alexandr Andreev
  1 sibling, 1 reply; 4+ messages in thread
From: Ralf Baechle @ 2001-06-06 19:55 UTC (permalink / raw)
  To: Alexandr Andreev; +Cc: linux-mips

Alexandr,

your MUA has garbled your patch, so I was forced to apply it manually.
Mozilla is known to be evil in that respect like a few more mailers.
For future patches please use a mailer that doesn't change patches in
creative ways.  Thanks for your patch,

  Ralf

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

* Troubles in r2300.c
@ 2001-06-07  1:39 Alexandr Andreev
  2001-06-06 18:34 ` Maciej W. Rozycki
  2001-06-06 19:55 ` Ralf Baechle
  0 siblings, 2 replies; 4+ messages in thread
From: Alexandr Andreev @ 2001-06-07  1:39 UTC (permalink / raw)
  To: linux-mips

Hi.
In the r2300.c ,in some functions ( like the r3k_cache_size and so on ), 
the
CONFIG register is modified. To return this register to initial state, the
save_and_cli(flags) and the restore_flags(flags) functions are used. The
restore_flags do not modify whole STATUS register, but only the 
Interrupt Enable
bit. So we should use the read_32bit_cp0_register and the 
write_32bit_cp0_register
functions instead ( like it was in linux-2.4.1 ).
And also, this patch adds R3081E CPU support to the ld_mmu_r2300() function.

diff -u -r1.12 r2300.c
--- arch/mips/mm/r2300.c        2001/05/31 14:27:32     1.12
+++ arch/mips/mm/r2300.c        2001/06/06 17:10:47
@@ -125,7 +125,7 @@

       p = (volatile unsigned long *) KSEG0;

-       save_and_cli(flags);
+       flags = read_32bit_cp0_register(CP0_STATUS);

       /* isolate cache space */
       write_32bit_cp0_register(CP0_STATUS, (ca_flags|flags)&~ST0_IEC);
@@ -147,7 +147,7 @@
               if (size > 0x40000)
                       size = 0;
       }
-       restore_flags(flags);
+       write_32bit_cp0_register(CP0_STATUS, flags);

       return size * sizeof(*p);
}
@@ -170,7 +170,7 @@
       if (size > icache_size)
               size = icache_size;

-       save_and_cli(flags);
+       flags = read_32bit_cp0_register(CP0_STATUS);

       /* isolate cache space */
       write_32bit_cp0_register(CP0_STATUS, 
(ST0_ISC|ST0_SWC|flags)&~ST0_IEC);
@@ -212,7 +212,7 @@
               p += 0x080;
       }

-       restore_flags(flags);
+       write_32bit_cp0_register(CP0_STATUS,flags);
}

static void r3k_flush_dcache_range(unsigned long start, unsigned long end)
@@ -224,7 +224,7 @@
       if (size > dcache_size)
               size = dcache_size;

-       save_and_cli(flags);
+       flags = read_32bit_cp0_register(CP0_STATUS);

       /* isolate cache space */
       write_32bit_cp0_register(CP0_STATUS, (ST0_ISC|flags)&~ST0_IEC);
@@ -266,7 +266,7 @@
               p += 0x080;
       }

-       restore_flags(flags);
+       write_32bit_cp0_register(CP0_STATUS,flags);
}

static inline unsigned long get_phys_page (unsigned long addr,
@@ -714,6 +714,7 @@
               case CPU_R3000:
               case CPU_R3000A:
               case CPU_R3081:
+               case CPU_R3081E:

                       r3k_probe_cache();

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

* Re: Troubles in r2300.c
  2001-06-06 19:55 ` Ralf Baechle
@ 2001-06-07 23:11   ` Alexandr Andreev
  0 siblings, 0 replies; 4+ messages in thread
From: Alexandr Andreev @ 2001-06-07 23:11 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: linux-mips

[-- Attachment #1: Type: text/plain, Size: 403 bytes --]

Ralf Baechle wrote:

> Alexandr,
>
> your MUA has garbled your patch, so I was forced to apply it manually.
> Mozilla is known to be evil in that respect like a few more mailers.
> For future patches please use a mailer that doesn't change patches in
> creative ways. Thanks for your patch,
>
> Ralf
>
Oh, I'm sorry, i forgot to substitute one save_and_cli() and restore ...
Please, apply new patch.




[-- Attachment #2: r2300_patch --]
[-- Type: text/plain, Size: 2108 bytes --]

Index: arch/mips/mm/r2300.c
===================================================================
RCS file: /share/cvs/root/linux/arch/mips/mm/r2300.c,v
retrieving revision 1.12
diff -u -r1.12 r2300.c
--- arch/mips/mm/r2300.c	2001/05/31 14:27:32	1.12
+++ arch/mips/mm/r2300.c	2001/06/07 14:28:29
@@ -125,7 +125,7 @@
 
 	p = (volatile unsigned long *) KSEG0;
 
-	save_and_cli(flags);
+	flags = read_32bit_cp0_register(CP0_STATUS);
 
 	/* isolate cache space */
 	write_32bit_cp0_register(CP0_STATUS, (ca_flags|flags)&~ST0_IEC);
@@ -147,7 +147,7 @@
 		if (size > 0x40000)
 			size = 0;
 	}
-	restore_flags(flags);
+	write_32bit_cp0_register(CP0_STATUS, flags);
 
 	return size * sizeof(*p);
 }
@@ -170,7 +170,7 @@
 	if (size > icache_size)
 		size = icache_size;
 
-	save_and_cli(flags);
+	flags = read_32bit_cp0_register(CP0_STATUS);
 
 	/* isolate cache space */
 	write_32bit_cp0_register(CP0_STATUS, (ST0_ISC|ST0_SWC|flags)&~ST0_IEC);
@@ -212,7 +212,7 @@
 		p += 0x080;
 	}
 
-	restore_flags(flags);
+	write_32bit_cp0_register(CP0_STATUS, flags);
 }
 
 static void r3k_flush_dcache_range(unsigned long start, unsigned long end)
@@ -224,7 +224,7 @@
 	if (size > dcache_size)
 		size = dcache_size;
 
-	save_and_cli(flags);
+	flags = read_32bit_cp0_register(CP0_STATUS);
 
 	/* isolate cache space */
 	write_32bit_cp0_register(CP0_STATUS, (ST0_ISC|flags)&~ST0_IEC);
@@ -266,7 +266,7 @@
 		p += 0x080;
 	}
 
-	restore_flags(flags);
+	write_32bit_cp0_register(CP0_STATUS, flags);
 }
 
 static inline unsigned long get_phys_page (unsigned long addr,
@@ -389,7 +389,7 @@
 	printk("csigtramp[%08lx]", addr);
 #endif
 
-	save_and_cli(flags);
+	flags = read_32bit_cp0_register(CP0_STATUS);
 
 	write_32bit_cp0_register(CP0_STATUS, (ST0_ISC|ST0_SWC|flags)&~ST0_IEC);
 
@@ -398,7 +398,7 @@
 		"sb\t$0,0x008(%0)\n\t"
 		: : "r" (addr) );
 
-	restore_flags(flags);
+	write_32bit_cp0_register(CP0_STATUS, flags);
 }
 
 static void r3k_dma_cache_wback_inv(unsigned long start, unsigned long size)
@@ -714,6 +714,7 @@
 		case CPU_R3000:
 		case CPU_R3000A:
 		case CPU_R3081:
+		case CPU_R3081E:
 
 			r3k_probe_cache();
 

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

end of thread, other threads:[~2001-06-07 15:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-06-07  1:39 Troubles in r2300.c Alexandr Andreev
2001-06-06 18:34 ` Maciej W. Rozycki
2001-06-06 19:55 ` Ralf Baechle
2001-06-07 23:11   ` Alexandr Andreev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox