diff options
Diffstat (limited to 'arch/ppc')
-rw-r--r-- | arch/ppc/Makefile | 11 | ||||
-rw-r--r-- | arch/ppc/boot/utils/addRamDisk.c | 203 | ||||
-rw-r--r-- | arch/ppc/kernel/signal.c | 11 | ||||
-rw-r--r-- | arch/ppc/syslib/m8xx_setup.c | 8 |
4 files changed, 19 insertions, 214 deletions
diff --git a/arch/ppc/Makefile b/arch/ppc/Makefile index f9b0d778dd82..d1b6e6dcb504 100644 --- a/arch/ppc/Makefile +++ b/arch/ppc/Makefile | |||
@@ -21,11 +21,13 @@ CC := $(CC) -m32 | |||
21 | endif | 21 | endif |
22 | 22 | ||
23 | LDFLAGS_vmlinux := -Ttext $(KERNELLOAD) -Bstatic | 23 | LDFLAGS_vmlinux := -Ttext $(KERNELLOAD) -Bstatic |
24 | CPPFLAGS += -Iarch/$(ARCH) | 24 | CPPFLAGS += -Iarch/$(ARCH) -Iinclude3 |
25 | AFLAGS += -Iarch/$(ARCH) | 25 | AFLAGS += -Iarch/$(ARCH) |
26 | CFLAGS += -Iarch/$(ARCH) -msoft-float -pipe \ | 26 | CFLAGS += -Iarch/$(ARCH) -msoft-float -pipe \ |
27 | -ffixed-r2 -mmultiple | 27 | -ffixed-r2 -mmultiple |
28 | CPP = $(CC) -E $(CFLAGS) | 28 | CPP = $(CC) -E $(CFLAGS) |
29 | # Temporary hack until we have migrated to asm-powerpc | ||
30 | LINUXINCLUDE += -Iinclude3 | ||
29 | 31 | ||
30 | CHECKFLAGS += -D__powerpc__ | 32 | CHECKFLAGS += -D__powerpc__ |
31 | 33 | ||
@@ -101,6 +103,7 @@ endef | |||
101 | 103 | ||
102 | archclean: | 104 | archclean: |
103 | $(Q)$(MAKE) $(clean)=arch/ppc/boot | 105 | $(Q)$(MAKE) $(clean)=arch/ppc/boot |
106 | $(Q)rm -rf include3 | ||
104 | 107 | ||
105 | prepare: include/asm-$(ARCH)/offsets.h checkbin | 108 | prepare: include/asm-$(ARCH)/offsets.h checkbin |
106 | 109 | ||
@@ -110,6 +113,12 @@ arch/$(ARCH)/kernel/asm-offsets.s: include/asm include/linux/version.h \ | |||
110 | include/asm-$(ARCH)/offsets.h: arch/$(ARCH)/kernel/asm-offsets.s | 113 | include/asm-$(ARCH)/offsets.h: arch/$(ARCH)/kernel/asm-offsets.s |
111 | $(call filechk,gen-asm-offsets) | 114 | $(call filechk,gen-asm-offsets) |
112 | 115 | ||
116 | # Temporary hack until we have migrated to asm-powerpc | ||
117 | include/asm: include3/asm | ||
118 | include3/asm: | ||
119 | $(Q)if [ ! -d include3 ]; then mkdir -p include3; fi | ||
120 | $(Q)ln -fsn $(srctree)/include/asm-powerpc include3/asm | ||
121 | |||
113 | # Use the file '.tmp_gas_check' for binutils tests, as gas won't output | 122 | # Use the file '.tmp_gas_check' for binutils tests, as gas won't output |
114 | # to stdout and these checks are run even on install targets. | 123 | # to stdout and these checks are run even on install targets. |
115 | TOUT := .tmp_gas_check | 124 | TOUT := .tmp_gas_check |
diff --git a/arch/ppc/boot/utils/addRamDisk.c b/arch/ppc/boot/utils/addRamDisk.c deleted file mode 100644 index 93400dfcce7f..000000000000 --- a/arch/ppc/boot/utils/addRamDisk.c +++ /dev/null | |||
@@ -1,203 +0,0 @@ | |||
1 | #include <stdio.h> | ||
2 | #include <stdlib.h> | ||
3 | #include <netinet/in.h> | ||
4 | #include <unistd.h> | ||
5 | #include <sys/types.h> | ||
6 | #include <sys/stat.h> | ||
7 | #include <string.h> | ||
8 | |||
9 | #define ElfHeaderSize (64 * 1024) | ||
10 | #define ElfPages (ElfHeaderSize / 4096) | ||
11 | #define KERNELBASE (0xc0000000) | ||
12 | |||
13 | void get4k(FILE *file, char *buf ) | ||
14 | { | ||
15 | unsigned j; | ||
16 | unsigned num = fread(buf, 1, 4096, file); | ||
17 | for ( j=num; j<4096; ++j ) | ||
18 | buf[j] = 0; | ||
19 | } | ||
20 | |||
21 | void put4k(FILE *file, char *buf ) | ||
22 | { | ||
23 | fwrite(buf, 1, 4096, file); | ||
24 | } | ||
25 | |||
26 | void death(const char *msg, FILE *fdesc, const char *fname) | ||
27 | { | ||
28 | printf(msg); | ||
29 | fclose(fdesc); | ||
30 | unlink(fname); | ||
31 | exit(1); | ||
32 | } | ||
33 | |||
34 | int main(int argc, char **argv) | ||
35 | { | ||
36 | char inbuf[4096]; | ||
37 | FILE *ramDisk = NULL; | ||
38 | FILE *inputVmlinux = NULL; | ||
39 | FILE *outputVmlinux = NULL; | ||
40 | unsigned i = 0; | ||
41 | u_int32_t ramFileLen = 0; | ||
42 | u_int32_t ramLen = 0; | ||
43 | u_int32_t roundR = 0; | ||
44 | u_int32_t kernelLen = 0; | ||
45 | u_int32_t actualKernelLen = 0; | ||
46 | u_int32_t round = 0; | ||
47 | u_int32_t roundedKernelLen = 0; | ||
48 | u_int32_t ramStartOffs = 0; | ||
49 | u_int32_t ramPages = 0; | ||
50 | u_int32_t roundedKernelPages = 0; | ||
51 | u_int32_t hvReleaseData = 0; | ||
52 | u_int32_t eyeCatcher = 0xc8a5d9c4; | ||
53 | u_int32_t naca = 0; | ||
54 | u_int32_t xRamDisk = 0; | ||
55 | u_int32_t xRamDiskSize = 0; | ||
56 | if ( argc < 2 ) { | ||
57 | printf("Name of RAM disk file missing.\n"); | ||
58 | exit(1); | ||
59 | } | ||
60 | |||
61 | if ( argc < 3 ) { | ||
62 | printf("Name of vmlinux file missing.\n"); | ||
63 | exit(1); | ||
64 | } | ||
65 | |||
66 | if ( argc < 4 ) { | ||
67 | printf("Name of vmlinux output file missing.\n"); | ||
68 | exit(1); | ||
69 | } | ||
70 | |||
71 | ramDisk = fopen(argv[1], "r"); | ||
72 | if ( ! ramDisk ) { | ||
73 | printf("RAM disk file \"%s\" failed to open.\n", argv[1]); | ||
74 | exit(1); | ||
75 | } | ||
76 | inputVmlinux = fopen(argv[2], "r"); | ||
77 | if ( ! inputVmlinux ) { | ||
78 | printf("vmlinux file \"%s\" failed to open.\n", argv[2]); | ||
79 | exit(1); | ||
80 | } | ||
81 | outputVmlinux = fopen(argv[3], "w+"); | ||
82 | if ( ! outputVmlinux ) { | ||
83 | printf("output vmlinux file \"%s\" failed to open.\n", argv[3]); | ||
84 | exit(1); | ||
85 | } | ||
86 | fseek(ramDisk, 0, SEEK_END); | ||
87 | ramFileLen = ftell(ramDisk); | ||
88 | fseek(ramDisk, 0, SEEK_SET); | ||
89 | printf("%s file size = %d\n", argv[1], ramFileLen); | ||
90 | |||
91 | ramLen = ramFileLen; | ||
92 | |||
93 | roundR = 4096 - (ramLen % 4096); | ||
94 | if ( roundR ) { | ||
95 | printf("Rounding RAM disk file up to a multiple of 4096, adding %d\n", roundR); | ||
96 | ramLen += roundR; | ||
97 | } | ||
98 | |||
99 | printf("Rounded RAM disk size is %d\n", ramLen); | ||
100 | fseek(inputVmlinux, 0, SEEK_END); | ||
101 | kernelLen = ftell(inputVmlinux); | ||
102 | fseek(inputVmlinux, 0, SEEK_SET); | ||
103 | printf("kernel file size = %d\n", kernelLen); | ||
104 | if ( kernelLen == 0 ) { | ||
105 | printf("You must have a linux kernel specified as argv[2]\n"); | ||
106 | exit(1); | ||
107 | } | ||
108 | |||
109 | actualKernelLen = kernelLen - ElfHeaderSize; | ||
110 | |||
111 | printf("actual kernel length (minus ELF header) = %d\n", actualKernelLen); | ||
112 | |||
113 | round = actualKernelLen % 4096; | ||
114 | roundedKernelLen = actualKernelLen; | ||
115 | if ( round ) | ||
116 | roundedKernelLen += (4096 - round); | ||
117 | |||
118 | printf("actual kernel length rounded up to a 4k multiple = %d\n", roundedKernelLen); | ||
119 | |||
120 | ramStartOffs = roundedKernelLen; | ||
121 | ramPages = ramLen / 4096; | ||
122 | |||
123 | printf("RAM disk pages to copy = %d\n", ramPages); | ||
124 | |||
125 | // Copy 64K ELF header | ||
126 | for (i=0; i<(ElfPages); ++i) { | ||
127 | get4k( inputVmlinux, inbuf ); | ||
128 | put4k( outputVmlinux, inbuf ); | ||
129 | } | ||
130 | |||
131 | roundedKernelPages = roundedKernelLen / 4096; | ||
132 | |||
133 | fseek(inputVmlinux, ElfHeaderSize, SEEK_SET); | ||
134 | |||
135 | for ( i=0; i<roundedKernelPages; ++i ) { | ||
136 | get4k( inputVmlinux, inbuf ); | ||
137 | put4k( outputVmlinux, inbuf ); | ||
138 | } | ||
139 | |||
140 | for ( i=0; i<ramPages; ++i ) { | ||
141 | get4k( ramDisk, inbuf ); | ||
142 | put4k( outputVmlinux, inbuf ); | ||
143 | } | ||
144 | |||
145 | /* Close the input files */ | ||
146 | fclose(ramDisk); | ||
147 | fclose(inputVmlinux); | ||
148 | /* And flush the written output file */ | ||
149 | fflush(outputVmlinux); | ||
150 | |||
151 | /* fseek to the hvReleaseData pointer */ | ||
152 | fseek(outputVmlinux, ElfHeaderSize + 0x24, SEEK_SET); | ||
153 | if (fread(&hvReleaseData, 4, 1, outputVmlinux) != 1) { | ||
154 | death("Could not read hvReleaseData pointer\n", outputVmlinux, argv[3]); | ||
155 | } | ||
156 | hvReleaseData = ntohl(hvReleaseData); /* Convert to native int */ | ||
157 | printf("hvReleaseData is at %08x\n", hvReleaseData); | ||
158 | |||
159 | /* fseek to the hvReleaseData */ | ||
160 | fseek(outputVmlinux, ElfHeaderSize + hvReleaseData, SEEK_SET); | ||
161 | if (fread(inbuf, 0x40, 1, outputVmlinux) != 1) { | ||
162 | death("Could not read hvReleaseData\n", outputVmlinux, argv[3]); | ||
163 | } | ||
164 | /* Check hvReleaseData sanity */ | ||
165 | if (memcmp(inbuf, &eyeCatcher, 4) != 0) { | ||
166 | death("hvReleaseData is invalid\n", outputVmlinux, argv[3]); | ||
167 | } | ||
168 | /* Get the naca pointer */ | ||
169 | naca = ntohl(*((u_int32_t *) &inbuf[0x0c])) - KERNELBASE; | ||
170 | printf("naca is at %08x\n", naca); | ||
171 | |||
172 | /* fseek to the naca */ | ||
173 | fseek(outputVmlinux, ElfHeaderSize + naca, SEEK_SET); | ||
174 | if (fread(inbuf, 0x18, 1, outputVmlinux) != 1) { | ||
175 | death("Could not read naca\n", outputVmlinux, argv[3]); | ||
176 | } | ||
177 | xRamDisk = ntohl(*((u_int32_t *) &inbuf[0x0c])); | ||
178 | xRamDiskSize = ntohl(*((u_int32_t *) &inbuf[0x14])); | ||
179 | /* Make sure a RAM disk isn't already present */ | ||
180 | if ((xRamDisk != 0) || (xRamDiskSize != 0)) { | ||
181 | death("RAM disk is already attached to this kernel\n", outputVmlinux, argv[3]); | ||
182 | } | ||
183 | /* Fill in the values */ | ||
184 | *((u_int32_t *) &inbuf[0x0c]) = htonl(ramStartOffs); | ||
185 | *((u_int32_t *) &inbuf[0x14]) = htonl(ramPages); | ||
186 | |||
187 | /* Write out the new naca */ | ||
188 | fflush(outputVmlinux); | ||
189 | fseek(outputVmlinux, ElfHeaderSize + naca, SEEK_SET); | ||
190 | if (fwrite(inbuf, 0x18, 1, outputVmlinux) != 1) { | ||
191 | death("Could not write naca\n", outputVmlinux, argv[3]); | ||
192 | } | ||
193 | printf("RAM Disk of 0x%x pages size is attached to the kernel at offset 0x%08x\n", | ||
194 | ramPages, ramStartOffs); | ||
195 | |||
196 | /* Done */ | ||
197 | fclose(outputVmlinux); | ||
198 | /* Set permission to executable */ | ||
199 | chmod(argv[3], S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH); | ||
200 | |||
201 | return 0; | ||
202 | } | ||
203 | |||
diff --git a/arch/ppc/kernel/signal.c b/arch/ppc/kernel/signal.c index 8aaeb6f4e750..2244bf91e593 100644 --- a/arch/ppc/kernel/signal.c +++ b/arch/ppc/kernel/signal.c | |||
@@ -759,13 +759,12 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs) | |||
759 | else | 759 | else |
760 | handle_signal(signr, &ka, &info, oldset, regs, newsp); | 760 | handle_signal(signr, &ka, &info, oldset, regs, newsp); |
761 | 761 | ||
762 | if (!(ka.sa.sa_flags & SA_NODEFER)) { | 762 | spin_lock_irq(¤t->sighand->siglock); |
763 | spin_lock_irq(¤t->sighand->siglock); | 763 | sigorsets(¤t->blocked,¤t->blocked,&ka.sa.sa_mask); |
764 | sigorsets(¤t->blocked,¤t->blocked,&ka.sa.sa_mask); | 764 | if (!(ka.sa.sa_flags & SA_NODEFER)) |
765 | sigaddset(¤t->blocked, signr); | 765 | sigaddset(¤t->blocked, signr); |
766 | recalc_sigpending(); | 766 | recalc_sigpending(); |
767 | spin_unlock_irq(¤t->sighand->siglock); | 767 | spin_unlock_irq(¤t->sighand->siglock); |
768 | } | ||
769 | 768 | ||
770 | return 1; | 769 | return 1; |
771 | } | 770 | } |
diff --git a/arch/ppc/syslib/m8xx_setup.c b/arch/ppc/syslib/m8xx_setup.c index 55a381af4e37..4c888da89b3c 100644 --- a/arch/ppc/syslib/m8xx_setup.c +++ b/arch/ppc/syslib/m8xx_setup.c | |||
@@ -57,7 +57,7 @@ unsigned char __res[sizeof(bd_t)]; | |||
57 | extern void m8xx_ide_init(void); | 57 | extern void m8xx_ide_init(void); |
58 | 58 | ||
59 | extern unsigned long find_available_memory(void); | 59 | extern unsigned long find_available_memory(void); |
60 | extern void m8xx_cpm_reset(); | 60 | extern void m8xx_cpm_reset(void); |
61 | extern void m8xx_wdt_handler_install(bd_t *bp); | 61 | extern void m8xx_wdt_handler_install(bd_t *bp); |
62 | extern void rpxfb_alloc_pages(void); | 62 | extern void rpxfb_alloc_pages(void); |
63 | extern void cpm_interrupt_init(void); | 63 | extern void cpm_interrupt_init(void); |
@@ -266,8 +266,8 @@ m8xx_show_percpuinfo(struct seq_file *m, int i) | |||
266 | 266 | ||
267 | bp = (bd_t *)__res; | 267 | bp = (bd_t *)__res; |
268 | 268 | ||
269 | seq_printf(m, "clock\t\t: %ldMHz\n" | 269 | seq_printf(m, "clock\t\t: %uMHz\n" |
270 | "bus clock\t: %ldMHz\n", | 270 | "bus clock\t: %uMHz\n", |
271 | bp->bi_intfreq / 1000000, | 271 | bp->bi_intfreq / 1000000, |
272 | bp->bi_busfreq / 1000000); | 272 | bp->bi_busfreq / 1000000); |
273 | 273 | ||
@@ -423,7 +423,7 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5, | |||
423 | ppc_md.find_end_of_memory = m8xx_find_end_of_memory; | 423 | ppc_md.find_end_of_memory = m8xx_find_end_of_memory; |
424 | ppc_md.setup_io_mappings = m8xx_map_io; | 424 | ppc_md.setup_io_mappings = m8xx_map_io; |
425 | 425 | ||
426 | #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) | 426 | #if defined(CONFIG_BLK_DEV_MPC8xx_IDE) |
427 | m8xx_ide_init(); | 427 | m8xx_ide_init(); |
428 | #endif | 428 | #endif |
429 | } | 429 | } |