Commit 55490050df0f5d82ce070be11351c65f7696101c

Authored by Geert Uytterhoeven
1 parent 3c776a0791

m68k/atari: ARAnyM - Always use physical addresses in NatFeat calls

Pointers passed to ARAnyM NatFeat calls should be physical addresses,
not virtual addresses. This worked before because on Atari, physical and
virtual kernel addresses are the same, as long as normal kernel memory
is concerned.

Correct the few remaining places where virtual addresses were used.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>

Showing 4 changed files with 18 additions and 15 deletions Side-by-side Diff

arch/m68k/emu/natfeat.c
... ... @@ -18,11 +18,11 @@
18 18 #include <asm/machdep.h>
19 19 #include <asm/natfeat.h>
20 20  
21   -extern long nf_get_id2(const char *feature_name);
  21 +extern long nf_get_id_phys(unsigned long feature_name);
22 22  
23 23 asm("\n"
24   -" .global nf_get_id2,nf_call\n"
25   -"nf_get_id2:\n"
  24 +" .global nf_get_id_phys,nf_call\n"
  25 +"nf_get_id_phys:\n"
26 26 " .short 0x7300\n"
27 27 " rts\n"
28 28 "nf_call:\n"
... ... @@ -31,7 +31,7 @@
31 31 "1: moveq.l #0,%d0\n"
32 32 " rts\n"
33 33 " .section __ex_table,\"a\"\n"
34   -" .long nf_get_id2,1b\n"
  34 +" .long nf_get_id_phys,1b\n"
35 35 " .long nf_call,1b\n"
36 36 " .previous");
37 37 EXPORT_SYMBOL_GPL(nf_call);
... ... @@ -46,7 +46,7 @@
46 46 if (n >= sizeof(name_copy))
47 47 return 0;
48 48  
49   - return nf_get_id2(name_copy);
  49 + return nf_get_id_phys(virt_to_phys(name_copy));
50 50 }
51 51 EXPORT_SYMBOL_GPL(nf_get_id);
52 52  
... ... @@ -58,7 +58,7 @@
58 58  
59 59 va_start(ap, fmt);
60 60 n = vsnprintf(buf, 256, fmt, ap);
61   - nf_call(nf_get_id("NF_STDERR"), buf);
  61 + nf_call(nf_get_id("NF_STDERR"), virt_to_phys(buf));
62 62 va_end(ap);
63 63 }
64 64  
... ... @@ -83,7 +83,7 @@
83 83 id = nf_get_id("NF_NAME");
84 84 if (!id)
85 85 return;
86   - nf_call(id, buf, 256);
  86 + nf_call(id, virt_to_phys(buf), 256);
87 87 buf[255] = 0;
88 88  
89 89 pr_info("NatFeats found (%s, %lu.%lu)\n", buf, version >> 16,
arch/m68k/emu/nfblock.c
... ... @@ -41,8 +41,8 @@
41 41 static inline s32 nfhd_get_capacity(u32 major, u32 minor, u32 *blocks,
42 42 u32 *blocksize)
43 43 {
44   - return nf_call(nfhd_id + NFHD_GET_CAPACITY, major, minor, blocks,
45   - blocksize);
  44 + return nf_call(nfhd_id + NFHD_GET_CAPACITY, major, minor,
  45 + virt_to_phys(blocks), virt_to_phys(blocksize));
46 46 }
47 47  
48 48 static LIST_HEAD(nfhd_list);
arch/m68k/emu/nfcon.c
... ... @@ -15,6 +15,7 @@
15 15 #include <linux/slab.h>
16 16 #include <linux/err.h>
17 17 #include <linux/uaccess.h>
  18 +#include <linux/io.h>
18 19  
19 20 #include <asm/natfeat.h>
20 21  
21 22  
22 23  
... ... @@ -25,17 +26,18 @@
25 26 static void nfputs(const char *str, unsigned int count)
26 27 {
27 28 char buf[68];
  29 + unsigned long phys = virt_to_phys(buf);
28 30  
29 31 buf[64] = 0;
30 32 while (count > 64) {
31 33 memcpy(buf, str, 64);
32   - nf_call(stderr_id, buf);
  34 + nf_call(stderr_id, phys);
33 35 str += 64;
34 36 count -= 64;
35 37 }
36 38 memcpy(buf, str, count);
37 39 buf[count] = 0;
38   - nf_call(stderr_id, buf);
  40 + nf_call(stderr_id, phys);
39 41 }
40 42  
41 43 static void nfcon_write(struct console *con, const char *str,
... ... @@ -79,7 +81,7 @@
79 81 {
80 82 char temp[2] = { ch, 0 };
81 83  
82   - nf_call(stderr_id, temp);
  84 + nf_call(stderr_id, virt_to_phys(temp));
83 85 return 1;
84 86 }
85 87  
arch/m68k/emu/nfeth.c
... ... @@ -195,7 +195,8 @@
195 195 char mac[ETH_ALEN], host_ip[32], local_ip[32];
196 196 int err;
197 197  
198   - if (!nf_call(nfEtherID + XIF_GET_MAC, unit, mac, ETH_ALEN))
  198 + if (!nf_call(nfEtherID + XIF_GET_MAC, unit, virt_to_phys(mac),
  199 + ETH_ALEN))
199 200 return NULL;
200 201  
201 202 dev = alloc_etherdev(sizeof(struct nfeth_private));
202 203  
... ... @@ -217,9 +218,9 @@
217 218 }
218 219  
219 220 nf_call(nfEtherID + XIF_GET_IPHOST, unit,
220   - host_ip, sizeof(host_ip));
  221 + virt_to_phys(host_ip), sizeof(host_ip));
221 222 nf_call(nfEtherID + XIF_GET_IPATARI, unit,
222   - local_ip, sizeof(local_ip));
  223 + virt_to_phys(local_ip), sizeof(local_ip));
223 224  
224 225 netdev_info(dev, KBUILD_MODNAME " addr:%s (%s) HWaddr:%pM\n", host_ip,
225 226 local_ip, mac);