diff options
Diffstat (limited to 'arch/ppc/boot/of1275')
-rw-r--r-- | arch/ppc/boot/of1275/Makefile | 6 | ||||
-rw-r--r-- | arch/ppc/boot/of1275/call_prom.c | 74 | ||||
-rw-r--r-- | arch/ppc/boot/of1275/claim.c | 92 | ||||
-rw-r--r-- | arch/ppc/boot/of1275/enter.c | 22 | ||||
-rw-r--r-- | arch/ppc/boot/of1275/exit.c | 24 | ||||
-rw-r--r-- | arch/ppc/boot/of1275/finddevice.c | 16 | ||||
-rw-r--r-- | arch/ppc/boot/of1275/getprop.c | 37 | ||||
-rw-r--r-- | arch/ppc/boot/of1275/map.c | 48 | ||||
-rw-r--r-- | arch/ppc/boot/of1275/ofinit.c | 27 | ||||
-rw-r--r-- | arch/ppc/boot/of1275/ofstdio.c | 32 | ||||
-rw-r--r-- | arch/ppc/boot/of1275/read.c | 35 | ||||
-rw-r--r-- | arch/ppc/boot/of1275/release.c | 30 | ||||
-rw-r--r-- | arch/ppc/boot/of1275/write.c | 35 |
13 files changed, 0 insertions, 478 deletions
diff --git a/arch/ppc/boot/of1275/Makefile b/arch/ppc/boot/of1275/Makefile deleted file mode 100644 index 0b979c004972..000000000000 --- a/arch/ppc/boot/of1275/Makefile +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | # | ||
2 | # Makefile of1275 stuff | ||
3 | # | ||
4 | |||
5 | lib-y := claim.o enter.o exit.o finddevice.o getprop.o ofinit.o \ | ||
6 | ofstdio.o read.o release.o write.o map.o call_prom.o | ||
diff --git a/arch/ppc/boot/of1275/call_prom.c b/arch/ppc/boot/of1275/call_prom.c deleted file mode 100644 index 9479a3a2b8c7..000000000000 --- a/arch/ppc/boot/of1275/call_prom.c +++ /dev/null | |||
@@ -1,74 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 1996-2005 Paul Mackerras. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation; either version | ||
7 | * 2 of the License, or (at your option) any later version. | ||
8 | */ | ||
9 | |||
10 | #include "of1275.h" | ||
11 | #include <stdarg.h> | ||
12 | |||
13 | int call_prom(const char *service, int nargs, int nret, ...) | ||
14 | { | ||
15 | int i; | ||
16 | struct prom_args { | ||
17 | const char *service; | ||
18 | int nargs; | ||
19 | int nret; | ||
20 | unsigned int args[12]; | ||
21 | } args; | ||
22 | va_list list; | ||
23 | |||
24 | args.service = service; | ||
25 | args.nargs = nargs; | ||
26 | args.nret = nret; | ||
27 | |||
28 | va_start(list, nret); | ||
29 | for (i = 0; i < nargs; i++) | ||
30 | args.args[i] = va_arg(list, unsigned int); | ||
31 | va_end(list); | ||
32 | |||
33 | for (i = 0; i < nret; i++) | ||
34 | args.args[nargs+i] = 0; | ||
35 | |||
36 | if (of_prom_entry(&args) < 0) | ||
37 | return -1; | ||
38 | |||
39 | return (nret > 0)? args.args[nargs]: 0; | ||
40 | } | ||
41 | |||
42 | int call_prom_ret(const char *service, int nargs, int nret, | ||
43 | unsigned int *rets, ...) | ||
44 | { | ||
45 | int i; | ||
46 | struct prom_args { | ||
47 | const char *service; | ||
48 | int nargs; | ||
49 | int nret; | ||
50 | unsigned int args[12]; | ||
51 | } args; | ||
52 | va_list list; | ||
53 | |||
54 | args.service = service; | ||
55 | args.nargs = nargs; | ||
56 | args.nret = nret; | ||
57 | |||
58 | va_start(list, rets); | ||
59 | for (i = 0; i < nargs; i++) | ||
60 | args.args[i] = va_arg(list, unsigned int); | ||
61 | va_end(list); | ||
62 | |||
63 | for (i = 0; i < nret; i++) | ||
64 | args.args[nargs+i] = 0; | ||
65 | |||
66 | if (of_prom_entry(&args) < 0) | ||
67 | return -1; | ||
68 | |||
69 | if (rets != (void *) 0) | ||
70 | for (i = 1; i < nret; ++i) | ||
71 | rets[i-1] = args.args[nargs+i]; | ||
72 | |||
73 | return (nret > 0)? args.args[nargs]: 0; | ||
74 | } | ||
diff --git a/arch/ppc/boot/of1275/claim.c b/arch/ppc/boot/of1275/claim.c deleted file mode 100644 index 1ed3aeeff8ae..000000000000 --- a/arch/ppc/boot/of1275/claim.c +++ /dev/null | |||
@@ -1,92 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) Paul Mackerras 1997. | ||
3 | * Copyright (C) Leigh Brown 2002. | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU General Public License | ||
7 | * as published by the Free Software Foundation; either version | ||
8 | * 2 of the License, or (at your option) any later version. | ||
9 | */ | ||
10 | |||
11 | #include "of1275.h" | ||
12 | #include "nonstdio.h" | ||
13 | |||
14 | /* | ||
15 | * Older OF's require that when claiming a specific range of addresses, | ||
16 | * we claim the physical space in the /memory node and the virtual | ||
17 | * space in the chosen mmu node, and then do a map operation to | ||
18 | * map virtual to physical. | ||
19 | */ | ||
20 | static int need_map = -1; | ||
21 | static ihandle chosen_mmu; | ||
22 | static phandle memory; | ||
23 | |||
24 | /* returns true if s2 is a prefix of s1 */ | ||
25 | static int string_match(const char *s1, const char *s2) | ||
26 | { | ||
27 | for (; *s2; ++s2) | ||
28 | if (*s1++ != *s2) | ||
29 | return 0; | ||
30 | return 1; | ||
31 | } | ||
32 | |||
33 | static int check_of_version(void) | ||
34 | { | ||
35 | phandle oprom, chosen; | ||
36 | char version[64]; | ||
37 | |||
38 | oprom = finddevice("/openprom"); | ||
39 | if (oprom == OF_INVALID_HANDLE) | ||
40 | return 0; | ||
41 | if (getprop(oprom, "model", version, sizeof(version)) <= 0) | ||
42 | return 0; | ||
43 | version[sizeof(version)-1] = 0; | ||
44 | printf("OF version = '%s'\n", version); | ||
45 | if (!string_match(version, "Open Firmware, 1.") | ||
46 | && !string_match(version, "FirmWorks,3.")) | ||
47 | return 0; | ||
48 | chosen = finddevice("/chosen"); | ||
49 | if (chosen == OF_INVALID_HANDLE) { | ||
50 | chosen = finddevice("/chosen@0"); | ||
51 | if (chosen == OF_INVALID_HANDLE) { | ||
52 | printf("no chosen\n"); | ||
53 | return 0; | ||
54 | } | ||
55 | } | ||
56 | if (getprop(chosen, "mmu", &chosen_mmu, sizeof(chosen_mmu)) <= 0) { | ||
57 | printf("no mmu\n"); | ||
58 | return 0; | ||
59 | } | ||
60 | memory = (ihandle) call_prom("open", 1, 1, "/memory"); | ||
61 | if (memory == OF_INVALID_HANDLE) { | ||
62 | memory = (ihandle) call_prom("open", 1, 1, "/memory@0"); | ||
63 | if (memory == OF_INVALID_HANDLE) { | ||
64 | printf("no memory node\n"); | ||
65 | return 0; | ||
66 | } | ||
67 | } | ||
68 | printf("old OF detected\n"); | ||
69 | return 1; | ||
70 | } | ||
71 | |||
72 | void *claim(unsigned int virt, unsigned int size, unsigned int align) | ||
73 | { | ||
74 | int ret; | ||
75 | unsigned int result; | ||
76 | |||
77 | if (need_map < 0) | ||
78 | need_map = check_of_version(); | ||
79 | if (align || !need_map) | ||
80 | return (void *) call_prom("claim", 3, 1, virt, size, align); | ||
81 | |||
82 | ret = call_prom_ret("call-method", 5, 2, &result, "claim", memory, | ||
83 | align, size, virt); | ||
84 | if (ret != 0 || result == -1) | ||
85 | return (void *) -1; | ||
86 | ret = call_prom_ret("call-method", 5, 2, &result, "claim", chosen_mmu, | ||
87 | align, size, virt); | ||
88 | /* 0x12 == coherent + read/write */ | ||
89 | ret = call_prom("call-method", 6, 1, "map", chosen_mmu, | ||
90 | 0x12, size, virt, virt); | ||
91 | return virt; | ||
92 | } | ||
diff --git a/arch/ppc/boot/of1275/enter.c b/arch/ppc/boot/of1275/enter.c deleted file mode 100644 index abe87a8fe2db..000000000000 --- a/arch/ppc/boot/of1275/enter.c +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) Paul Mackerras 1997. | ||
3 | * Copyright (C) Leigh Brown 2002. | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU General Public License | ||
7 | * as published by the Free Software Foundation; either version | ||
8 | * 2 of the License, or (at your option) any later version. | ||
9 | */ | ||
10 | |||
11 | #include "of1275.h" | ||
12 | |||
13 | void | ||
14 | enter(void) | ||
15 | { | ||
16 | struct prom_args { | ||
17 | char *service; | ||
18 | } args; | ||
19 | |||
20 | args.service = "enter"; | ||
21 | (*of_prom_entry)(&args); | ||
22 | } | ||
diff --git a/arch/ppc/boot/of1275/exit.c b/arch/ppc/boot/of1275/exit.c deleted file mode 100644 index b9f89b6a8b45..000000000000 --- a/arch/ppc/boot/of1275/exit.c +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) Paul Mackerras 1997. | ||
3 | * Copyright (C) Leigh Brown 2002. | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU General Public License | ||
7 | * as published by the Free Software Foundation; either version | ||
8 | * 2 of the License, or (at your option) any later version. | ||
9 | */ | ||
10 | |||
11 | #include "of1275.h" | ||
12 | |||
13 | void | ||
14 | exit(void) | ||
15 | { | ||
16 | struct prom_args { | ||
17 | char *service; | ||
18 | } args; | ||
19 | |||
20 | for (;;) { | ||
21 | args.service = "exit"; | ||
22 | (*of_prom_entry)(&args); | ||
23 | } | ||
24 | } | ||
diff --git a/arch/ppc/boot/of1275/finddevice.c b/arch/ppc/boot/of1275/finddevice.c deleted file mode 100644 index 0dcb1201b772..000000000000 --- a/arch/ppc/boot/of1275/finddevice.c +++ /dev/null | |||
@@ -1,16 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) Paul Mackerras 1997. | ||
3 | * Copyright (C) Leigh Brown 2002. | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU General Public License | ||
7 | * as published by the Free Software Foundation; either version | ||
8 | * 2 of the License, or (at your option) any later version. | ||
9 | */ | ||
10 | |||
11 | #include "of1275.h" | ||
12 | |||
13 | phandle finddevice(const char *name) | ||
14 | { | ||
15 | return (phandle) call_prom("finddevice", 1, 1, name); | ||
16 | } | ||
diff --git a/arch/ppc/boot/of1275/getprop.c b/arch/ppc/boot/of1275/getprop.c deleted file mode 100644 index 0cf75f035e4e..000000000000 --- a/arch/ppc/boot/of1275/getprop.c +++ /dev/null | |||
@@ -1,37 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) Paul Mackerras 1997. | ||
3 | * Copyright (C) Leigh Brown 2002. | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU General Public License | ||
7 | * as published by the Free Software Foundation; either version | ||
8 | * 2 of the License, or (at your option) any later version. | ||
9 | */ | ||
10 | |||
11 | #include "of1275.h" | ||
12 | |||
13 | int | ||
14 | getprop(phandle node, const char *name, void *buf, int buflen) | ||
15 | { | ||
16 | struct prom_args { | ||
17 | char *service; | ||
18 | int nargs; | ||
19 | int nret; | ||
20 | phandle node; | ||
21 | const char *name; | ||
22 | void *buf; | ||
23 | int buflen; | ||
24 | int size; | ||
25 | } args; | ||
26 | |||
27 | args.service = "getprop"; | ||
28 | args.nargs = 4; | ||
29 | args.nret = 1; | ||
30 | args.node = node; | ||
31 | args.name = name; | ||
32 | args.buf = buf; | ||
33 | args.buflen = buflen; | ||
34 | args.size = -1; | ||
35 | (*of_prom_entry)(&args); | ||
36 | return args.size; | ||
37 | } | ||
diff --git a/arch/ppc/boot/of1275/map.c b/arch/ppc/boot/of1275/map.c deleted file mode 100644 index 443256c6f6d6..000000000000 --- a/arch/ppc/boot/of1275/map.c +++ /dev/null | |||
@@ -1,48 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) Paul Mackerras 1997. | ||
3 | * Copyright (C) Leigh Brown 2002. | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU General Public License | ||
7 | * as published by the Free Software Foundation; either version | ||
8 | * 2 of the License, or (at your option) any later version. | ||
9 | */ | ||
10 | |||
11 | #include "of1275.h" | ||
12 | #include "nonstdio.h" | ||
13 | |||
14 | extern ihandle of_prom_mmu; | ||
15 | |||
16 | int | ||
17 | map(unsigned int phys, unsigned int virt, unsigned int size) | ||
18 | { | ||
19 | struct prom_args { | ||
20 | char *service; | ||
21 | int nargs; | ||
22 | int nret; | ||
23 | char *method; | ||
24 | ihandle mmu_ihandle; | ||
25 | int misc; | ||
26 | unsigned int size; | ||
27 | unsigned int virt; | ||
28 | unsigned int phys; | ||
29 | int ret0; | ||
30 | } args; | ||
31 | |||
32 | if (of_prom_mmu == 0) { | ||
33 | printf("map() called, no MMU found\n"); | ||
34 | return -1; | ||
35 | } | ||
36 | args.service = "call-method"; | ||
37 | args.nargs = 6; | ||
38 | args.nret = 1; | ||
39 | args.method = "map"; | ||
40 | args.mmu_ihandle = of_prom_mmu; | ||
41 | args.misc = 0; | ||
42 | args.phys = phys; | ||
43 | args.virt = virt; | ||
44 | args.size = size; | ||
45 | (*of_prom_entry)(&args); | ||
46 | |||
47 | return (int)args.ret0; | ||
48 | } | ||
diff --git a/arch/ppc/boot/of1275/ofinit.c b/arch/ppc/boot/of1275/ofinit.c deleted file mode 100644 index 0ee8af7639e9..000000000000 --- a/arch/ppc/boot/of1275/ofinit.c +++ /dev/null | |||
@@ -1,27 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) Paul Mackerras 1997. | ||
3 | * Copyright (C) Leigh Brown 2002. | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU General Public License | ||
7 | * as published by the Free Software Foundation; either version | ||
8 | * 2 of the License, or (at your option) any later version. | ||
9 | */ | ||
10 | |||
11 | #include "of1275.h" | ||
12 | |||
13 | prom_entry of_prom_entry; | ||
14 | ihandle of_prom_mmu; | ||
15 | |||
16 | void | ||
17 | ofinit(prom_entry prom_ptr) | ||
18 | { | ||
19 | phandle chosen; | ||
20 | |||
21 | of_prom_entry = prom_ptr; | ||
22 | |||
23 | if ((chosen = finddevice("/chosen")) == OF_INVALID_HANDLE) | ||
24 | return; | ||
25 | if (getprop(chosen, "mmu", &of_prom_mmu, sizeof(ihandle)) != 4) | ||
26 | return; | ||
27 | } | ||
diff --git a/arch/ppc/boot/of1275/ofstdio.c b/arch/ppc/boot/of1275/ofstdio.c deleted file mode 100644 index 10abbe32b31f..000000000000 --- a/arch/ppc/boot/of1275/ofstdio.c +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) Paul Mackerras 1997. | ||
3 | * Copyright (C) Leigh Brown 2002. | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU General Public License | ||
7 | * as published by the Free Software Foundation; either version | ||
8 | * 2 of the License, or (at your option) any later version. | ||
9 | */ | ||
10 | |||
11 | #include "of1275.h" | ||
12 | |||
13 | int | ||
14 | ofstdio(ihandle *stdin, ihandle *stdout, ihandle *stderr) | ||
15 | { | ||
16 | ihandle in, out; | ||
17 | phandle chosen; | ||
18 | |||
19 | if ((chosen = finddevice("/chosen")) == OF_INVALID_HANDLE) | ||
20 | goto err; | ||
21 | if (getprop(chosen, "stdout", &out, sizeof(out)) != 4) | ||
22 | goto err; | ||
23 | if (getprop(chosen, "stdin", &in, sizeof(in)) != 4) | ||
24 | goto err; | ||
25 | |||
26 | *stdin = in; | ||
27 | *stdout = out; | ||
28 | *stderr = out; | ||
29 | return 0; | ||
30 | err: | ||
31 | return -1; | ||
32 | } | ||
diff --git a/arch/ppc/boot/of1275/read.c b/arch/ppc/boot/of1275/read.c deleted file mode 100644 index 122813649fce..000000000000 --- a/arch/ppc/boot/of1275/read.c +++ /dev/null | |||
@@ -1,35 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) Paul Mackerras 1997. | ||
3 | * Copyright (C) Leigh Brown 2002. | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU General Public License | ||
7 | * as published by the Free Software Foundation; either version | ||
8 | * 2 of the License, or (at your option) any later version. | ||
9 | */ | ||
10 | |||
11 | #include "of1275.h" | ||
12 | |||
13 | int | ||
14 | read(ihandle instance, void *buf, int buflen) | ||
15 | { | ||
16 | struct prom_args { | ||
17 | char *service; | ||
18 | int nargs; | ||
19 | int nret; | ||
20 | ihandle instance; | ||
21 | void *buf; | ||
22 | int buflen; | ||
23 | int actual; | ||
24 | } args; | ||
25 | |||
26 | args.service = "read"; | ||
27 | args.nargs = 3; | ||
28 | args.nret = 1; | ||
29 | args.instance = instance; | ||
30 | args.buf = buf; | ||
31 | args.buflen = buflen; | ||
32 | args.actual = -1; | ||
33 | (*of_prom_entry)(&args); | ||
34 | return args.actual; | ||
35 | } | ||
diff --git a/arch/ppc/boot/of1275/release.c b/arch/ppc/boot/of1275/release.c deleted file mode 100644 index 28032d37145d..000000000000 --- a/arch/ppc/boot/of1275/release.c +++ /dev/null | |||
@@ -1,30 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) Paul Mackerras 1997. | ||
3 | * Copyright (C) Leigh Brown 2002. | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU General Public License | ||
7 | * as published by the Free Software Foundation; either version | ||
8 | * 2 of the License, or (at your option) any later version. | ||
9 | */ | ||
10 | |||
11 | #include "of1275.h" | ||
12 | |||
13 | void | ||
14 | release(void *virt, unsigned int size) | ||
15 | { | ||
16 | struct prom_args { | ||
17 | char *service; | ||
18 | int nargs; | ||
19 | int nret; | ||
20 | void *virt; | ||
21 | unsigned int size; | ||
22 | } args; | ||
23 | |||
24 | args.service = "release"; | ||
25 | args.nargs = 2; | ||
26 | args.nret = 0; | ||
27 | args.virt = virt; | ||
28 | args.size = size; | ||
29 | (*of_prom_entry)(&args); | ||
30 | } | ||
diff --git a/arch/ppc/boot/of1275/write.c b/arch/ppc/boot/of1275/write.c deleted file mode 100644 index 7361b9b2fca5..000000000000 --- a/arch/ppc/boot/of1275/write.c +++ /dev/null | |||
@@ -1,35 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) Paul Mackerras 1997. | ||
3 | * Copyright (C) Leigh Brown 2002. | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU General Public License | ||
7 | * as published by the Free Software Foundation; either version | ||
8 | * 2 of the License, or (at your option) any later version. | ||
9 | */ | ||
10 | |||
11 | #include "of1275.h" | ||
12 | |||
13 | int | ||
14 | write(ihandle instance, void *buf, int buflen) | ||
15 | { | ||
16 | struct prom_args { | ||
17 | char *service; | ||
18 | int nargs; | ||
19 | int nret; | ||
20 | ihandle instance; | ||
21 | void *buf; | ||
22 | int buflen; | ||
23 | int actual; | ||
24 | } args; | ||
25 | |||
26 | args.service = "write"; | ||
27 | args.nargs = 3; | ||
28 | args.nret = 1; | ||
29 | args.instance = instance; | ||
30 | args.buf = buf; | ||
31 | args.buflen = buflen; | ||
32 | args.actual = -1; | ||
33 | (*of_prom_entry)(&args); | ||
34 | return args.actual; | ||
35 | } | ||