^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) * Setup the right wbflush routine for the different DECstations.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Created with information from:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * DECstation 3100 Desktop Workstation Functional Specification
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * DECstation 5000/200 KN02 System Module Functional Specification
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * mipsel-linux-objdump --disassemble vmunix | grep "wbflush" :-)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) * This file is subject to the terms and conditions of the GNU General Public
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) * License. See the file "COPYING" in the main directory of this archive
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) * for more details.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) * Copyright (C) 1998 Harald Koerfgen
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) * Copyright (C) 2002 Maciej W. Rozycki
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <linux/export.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include <asm/bootinfo.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #include <asm/wbflush.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #include <asm/barrier.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) static void wbflush_kn01(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) static void wbflush_kn210(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) static void wbflush_mips(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) void (*__wbflush) (void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) void __init wbflush_setup(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) switch (mips_machtype) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) case MACH_DS23100:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) case MACH_DS5000_200: /* DS5000 3max */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) __wbflush = wbflush_kn01;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) case MACH_DS5100: /* DS5100 MIPSMATE */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) __wbflush = wbflush_kn210;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) case MACH_DS5000_1XX: /* DS5000/100 3min */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) case MACH_DS5000_XX: /* Personal DS5000/2x */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) case MACH_DS5000_2X0: /* DS5000/240 3max+ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) case MACH_DS5900: /* DS5900 bigmax */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) __wbflush = wbflush_mips;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) * For the DS3100 and DS5000/200 the R2020/R3220 writeback buffer functions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) * as part of Coprocessor 0.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) static void wbflush_kn01(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) asm(".set\tpush\n\t"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) ".set\tnoreorder\n\t"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) "1:\tbc0f\t1b\n\t"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) "nop\n\t"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) ".set\tpop");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) * For the DS5100 the writeback buffer seems to be a part of Coprocessor 3.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) * But CP3 has to enabled first.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) static void wbflush_kn210(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) asm(".set\tpush\n\t"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) ".set\tnoreorder\n\t"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) "mfc0\t$2,$12\n\t"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) "lui\t$3,0x8000\n\t"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) "or\t$3,$2,$3\n\t"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) "mtc0\t$3,$12\n\t"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) "nop\n"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) "1:\tbc3f\t1b\n\t"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) "nop\n\t"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) "mtc0\t$2,$12\n\t"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) "nop\n\t"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) ".set\tpop"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) : : : "$2", "$3");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) * I/O ASIC systems use a standard writeback buffer that gets flushed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) * upon an uncached read.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) static void wbflush_mips(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) __fast_iob();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) EXPORT_SYMBOL(__wbflush);