Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Setup the right wbflush routine for the different DECstations.
0003  *
0004  * Created with information from:
0005  *  DECstation 3100 Desktop Workstation Functional Specification
0006  *  DECstation 5000/200 KN02 System Module Functional Specification
0007  *  mipsel-linux-objdump --disassemble vmunix | grep "wbflush" :-)
0008  *
0009  * This file is subject to the terms and conditions of the GNU General Public
0010  * License.  See the file "COPYING" in the main directory of this archive
0011  * for more details.
0012  *
0013  * Copyright (C) 1998 Harald Koerfgen
0014  * Copyright (C) 2002 Maciej W. Rozycki
0015  */
0016 
0017 #include <linux/export.h>
0018 #include <linux/init.h>
0019 
0020 #include <asm/bootinfo.h>
0021 #include <asm/wbflush.h>
0022 #include <asm/barrier.h>
0023 
0024 static void wbflush_kn01(void);
0025 static void wbflush_kn210(void);
0026 static void wbflush_mips(void);
0027 
0028 void (*__wbflush) (void);
0029 
0030 void __init wbflush_setup(void)
0031 {
0032     switch (mips_machtype) {
0033     case MACH_DS23100:
0034     case MACH_DS5000_200:   /* DS5000 3max */
0035         __wbflush = wbflush_kn01;
0036         break;
0037     case MACH_DS5100:   /* DS5100 MIPSMATE */
0038         __wbflush = wbflush_kn210;
0039         break;
0040     case MACH_DS5000_1XX:   /* DS5000/100 3min */
0041     case MACH_DS5000_XX:    /* Personal DS5000/2x */
0042     case MACH_DS5000_2X0:   /* DS5000/240 3max+ */
0043     case MACH_DS5900:   /* DS5900 bigmax */
0044     default:
0045         __wbflush = wbflush_mips;
0046         break;
0047     }
0048 }
0049 
0050 /*
0051  * For the DS3100 and DS5000/200 the R2020/R3220 writeback buffer functions
0052  * as part of Coprocessor 0.
0053  */
0054 static void wbflush_kn01(void)
0055 {
0056     asm(".set\tpush\n\t"
0057     ".set\tnoreorder\n\t"
0058     "1:\tbc0f\t1b\n\t"
0059     "nop\n\t"
0060     ".set\tpop");
0061 }
0062 
0063 /*
0064  * For the DS5100 the writeback buffer seems to be a part of Coprocessor 3.
0065  * But CP3 has to enabled first.
0066  */
0067 static void wbflush_kn210(void)
0068 {
0069     asm(".set\tpush\n\t"
0070     ".set\tnoreorder\n\t"
0071     "mfc0\t$2,$12\n\t"
0072     "lui\t$3,0x8000\n\t"
0073     "or\t$3,$2,$3\n\t"
0074     "mtc0\t$3,$12\n\t"
0075     "nop\n"
0076     "1:\tbc3f\t1b\n\t"
0077     "nop\n\t"
0078     "mtc0\t$2,$12\n\t"
0079     "nop\n\t"
0080     ".set\tpop"
0081     : : : "$2", "$3");
0082 }
0083 
0084 /*
0085  * I/O ASIC systems use a standard writeback buffer that gets flushed
0086  * upon an uncached read.
0087  */
0088 static void wbflush_mips(void)
0089 {
0090     __fast_iob();
0091 }
0092 EXPORT_SYMBOL(__wbflush);