forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-09-20 a36159eec6ca17402b0e146b86efaf76568dc353
kernel/arch/mips/include/asm/maar.h
....@@ -1,11 +1,7 @@
1
+/* SPDX-License-Identifier: GPL-2.0-or-later */
12 /*
23 * Copyright (C) 2014 Imagination Technologies
34 * Author: Paul Burton <paul.burton@mips.com>
4
- *
5
- * This program is free software; you can redistribute it and/or modify it
6
- * under the terms of the GNU General Public License as published by the
7
- * Free Software Foundation; either version 2 of the License, or (at your
8
- * option) any later version.
95 */
106
117 #ifndef __MIPS_ASM_MIPS_MAAR_H__
....@@ -36,7 +32,7 @@
3632 * @upper: The highest address that the MAAR pair will affect. Must be
3733 * aligned to one byte before a 2^16 byte boundary.
3834 * @attrs: The accessibility attributes to program, eg. MIPS_MAAR_S. The
39
- * MIPS_MAAR_VL attribute will automatically be set.
35
+ * MIPS_MAAR_VL/MIPS_MAAR_VH attributes will automatically be set.
4036 *
4137 * Program the pair of MAAR registers specified by idx to apply the attributes
4238 * specified by attrs to the range of addresses from lower to higher.
....@@ -52,17 +48,30 @@
5248 /* Automatically set MIPS_MAAR_VL */
5349 attrs |= MIPS_MAAR_VL;
5450
55
- /* Write the upper address & attributes (only MIPS_MAAR_VL matters) */
51
+ /*
52
+ * Write the upper address & attributes (both MIPS_MAAR_VL and
53
+ * MIPS_MAAR_VH matter)
54
+ */
5655 write_c0_maari(idx << 1);
5756 back_to_back_c0_hazard();
5857 write_c0_maar(((upper >> 4) & MIPS_MAAR_ADDR) | attrs);
5958 back_to_back_c0_hazard();
59
+#ifdef CONFIG_XPA
60
+ upper >>= MIPS_MAARX_ADDR_SHIFT;
61
+ writex_c0_maar(((upper >> 4) & MIPS_MAARX_ADDR) | MIPS_MAARX_VH);
62
+ back_to_back_c0_hazard();
63
+#endif
6064
6165 /* Write the lower address & attributes */
6266 write_c0_maari((idx << 1) | 0x1);
6367 back_to_back_c0_hazard();
6468 write_c0_maar((lower >> 4) | attrs);
6569 back_to_back_c0_hazard();
70
+#ifdef CONFIG_XPA
71
+ lower >>= MIPS_MAARX_ADDR_SHIFT;
72
+ writex_c0_maar(((lower >> 4) & MIPS_MAARX_ADDR) | MIPS_MAARX_VH);
73
+ back_to_back_c0_hazard();
74
+#endif
6675 }
6776
6877 /**