forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 1f93a7dfd1f8d5ff7a5c53246c7534fe2332d6f4
kernel/arch/mips/fw/arc/promlib.c
....@@ -11,6 +11,21 @@
1111 #include <asm/bcache.h>
1212 #include <asm/setup.h>
1313
14
+#if defined(CONFIG_64BIT) && defined(CONFIG_FW_ARC32)
15
+/*
16
+ * For 64bit kernels working with a 32bit ARC PROM pointer arguments
17
+ * for ARC calls need to reside in CKEG0/1. But as soon as the kernel
18
+ * switches to it's first kernel thread stack is set to an address in
19
+ * XKPHYS, so anything on stack can't be used anymore. This is solved
20
+ * by using a * static declartion variables are put into BSS, which is
21
+ * linked to a CKSEG0 address. Since this is only used on UP platforms
22
+ * there is not spinlock needed
23
+ */
24
+#define O32_STATIC static
25
+#else
26
+#define O32_STATIC
27
+#endif
28
+
1429 /*
1530 * IP22 boardcache is not compatible with board caches. Thus we disable it
1631 * during romvec action. Since r4xx0.c is always compiled and linked with your
....@@ -23,8 +38,10 @@
2338
2439 void prom_putchar(char c)
2540 {
26
- ULONG cnt;
27
- CHAR it = c;
41
+ O32_STATIC ULONG cnt;
42
+ O32_STATIC CHAR it;
43
+
44
+ it = c;
2845
2946 bc_disable();
3047 ArcWrite(1, &it, 1, &cnt);
....@@ -33,8 +50,8 @@
3350
3451 char prom_getchar(void)
3552 {
36
- ULONG cnt;
37
- CHAR c;
53
+ O32_STATIC ULONG cnt;
54
+ O32_STATIC CHAR c;
3855
3956 bc_disable();
4057 ArcRead(0, &c, 1, &cnt);