From d43c36dc6b357fa1806800f18aa30123c747a6d1 Mon Sep 17 00:00:00 2001 From: Alexey Dobriyan Date: Wed, 7 Oct 2009 17:09:06 +0400 Subject: headers: remove sched.h from interrupt.h After m68k's task_thread_info() doesn't refer to current, it's possible to remove sched.h from interrupt.h and not break m68k! Many thanks to Heiko Carstens for allowing this. Signed-off-by: Alexey Dobriyan --- arch/m32r/kernel/smp.c | 1 + 1 file changed, 1 insertion(+) (limited to 'arch/m32r') diff --git a/arch/m32r/kernel/smp.c b/arch/m32r/kernel/smp.c index 1b7598e6f6e..8a88f1f0a3e 100644 --- a/arch/m32r/kernel/smp.c +++ b/arch/m32r/kernel/smp.c @@ -17,6 +17,7 @@ #include #include +#include #include #include #include -- cgit v1.2.3 From 560235857fb79da48d36e8f866a0ee3b10a232bf Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Sun, 2 Aug 2009 10:47:27 +0200 Subject: arch/m32r: Use DIV_ROUND_CLOSEST The kernel.h macro DIV_ROUND_CLOSEST performs the computation (x + d/2)/d but is perhaps more readable. The semantic patch that makes this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // @haskernel@ @@ @depends on haskernel@ expression x,__divisor; @@ - (((x) + ((__divisor) / 2)) / (__divisor)) + DIV_ROUND_CLOSEST(x,__divisor) // Signed-off-by: Julia Lawall Signed-off-by: Hirokazu Takata --- arch/m32r/kernel/time.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'arch/m32r') diff --git a/arch/m32r/kernel/time.c b/arch/m32r/kernel/time.c index e7fee0f198d..9cedcef1157 100644 --- a/arch/m32r/kernel/time.c +++ b/arch/m32r/kernel/time.c @@ -75,7 +75,7 @@ u32 arch_gettimeoffset(void) count = 0; count = (latch - count) * TICK_SIZE; - elapsed_time = (count + latch / 2) / latch; + elapsed_time = DIV_ROUND_CLOSEST(count, latch); /* NOTE: LATCH is equal to the "interval" value (= reload count). */ #else /* CONFIG_SMP */ @@ -93,7 +93,7 @@ u32 arch_gettimeoffset(void) p_count = count; count = (latch - count) * TICK_SIZE; - elapsed_time = (count + latch / 2) / latch; + elapsed_time = DIV_ROUND_CLOSEST(count, latch); /* NOTE: LATCH is equal to the "interval" value (= reload count). */ #endif /* CONFIG_SMP */ #elif defined(CONFIG_CHIP_M32310) @@ -211,7 +211,7 @@ void __init time_init(void) bus_clock = boot_cpu_data.bus_clock; divide = boot_cpu_data.timer_divide; - latch = (bus_clock/divide + HZ / 2) / HZ; + latch = DIV_ROUND_CLOSEST(bus_clock/divide, HZ); printk("Timer start : latch = %ld\n", latch); -- cgit v1.2.3 From e968b8d404ae8ab4ef218cd145f6dcb71e65154b Mon Sep 17 00:00:00 2001 From: Hirokazu Takata Date: Mon, 5 Oct 2009 00:10:55 +0900 Subject: m32r: add NOTES to vmlinux.lds.S to remove .note.gnu.build-id section Building with --build-id option, .note.gnu.build-id section is added to vmlinux.bin. But some old buggy binutils creates a huge vmlinux.bin, and a bootloader fails to boot its zImage as well. This patch adds a NOTES macro to a linker script vmlinux.ld.S to put .note.gnu.build-id section into .note section. Then, the .note section will be removed, because "-R .note" option is specified in OBJCOPYFLAGS to make a vmlinux.bin binary. Signed-off-by: Hirokazu Takata --- arch/m32r/kernel/vmlinux.lds.S | 2 ++ 1 file changed, 2 insertions(+) (limited to 'arch/m32r') diff --git a/arch/m32r/kernel/vmlinux.lds.S b/arch/m32r/kernel/vmlinux.lds.S index 8ceb6181d80..7da94eaa082 100644 --- a/arch/m32r/kernel/vmlinux.lds.S +++ b/arch/m32r/kernel/vmlinux.lds.S @@ -42,6 +42,8 @@ SECTIONS _etext = .; /* End of text section */ EXCEPTION_TABLE(16) + NOTES + RODATA RW_DATA_SECTION(32, PAGE_SIZE, THREAD_SIZE) _edata = .; /* End of data section */ -- cgit v1.2.3 From 337214e8c6b0c777713b2483749f9c03102a416c Mon Sep 17 00:00:00 2001 From: Hirokazu Takata Date: Thu, 15 Oct 2009 09:21:56 +0900 Subject: m32r: bzip2/lzma kernel compression support - Support bzip2 and lzma kernel compression for m32r. - Clean up arch/m32r/boot/compressed/misc.c. Signed-off-by: Hirokazu Takata --- arch/m32r/Kconfig | 3 + arch/m32r/boot/compressed/Makefile | 16 ++++- arch/m32r/boot/compressed/misc.c | 143 +++++++------------------------------ 3 files changed, 42 insertions(+), 120 deletions(-) (limited to 'arch/m32r') diff --git a/arch/m32r/Kconfig b/arch/m32r/Kconfig index c41234f1b82..3a9319f93e8 100644 --- a/arch/m32r/Kconfig +++ b/arch/m32r/Kconfig @@ -11,6 +11,9 @@ config M32R select HAVE_IDE select HAVE_OPROFILE select INIT_ALL_POSSIBLE + select HAVE_KERNEL_GZIP + select HAVE_KERNEL_BZIP2 + select HAVE_KERNEL_LZMA config SBUS bool diff --git a/arch/m32r/boot/compressed/Makefile b/arch/m32r/boot/compressed/Makefile index 560484ae35e..1003880d0df 100644 --- a/arch/m32r/boot/compressed/Makefile +++ b/arch/m32r/boot/compressed/Makefile @@ -4,8 +4,8 @@ # create a compressed vmlinux image from the original vmlinux # -targets := vmlinux vmlinux.bin vmlinux.bin.gz head.o misc.o \ - piggy.o vmlinux.lds +targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 \ + vmlinux.bin.lzma head.o misc.o piggy.o vmlinux.lds OBJECTS = $(obj)/head.o $(obj)/misc.o @@ -27,6 +27,12 @@ $(obj)/vmlinux.bin: vmlinux FORCE $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE $(call if_changed,gzip) +$(obj)/vmlinux.bin.bz2: $(obj)/vmlinux.bin FORCE + $(call if_changed,bzip2) + +$(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCE + $(call if_changed,lzma) + CFLAGS_misc.o += -fpic ifdef CONFIG_MMU @@ -37,5 +43,9 @@ endif OBJCOPYFLAGS += -R .empty_zero_page -$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.gz FORCE +suffix_$(CONFIG_KERNEL_GZIP) = gz +suffix_$(CONFIG_KERNEL_BZIP2) = bz2 +suffix_$(CONFIG_KERNEL_LZMA) = lzma + +$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.$(suffix_y) FORCE $(call if_changed,ld) diff --git a/arch/m32r/boot/compressed/misc.c b/arch/m32r/boot/compressed/misc.c index d394292498c..370d6088197 100644 --- a/arch/m32r/boot/compressed/misc.c +++ b/arch/m32r/boot/compressed/misc.c @@ -9,140 +9,49 @@ * Adapted for SH by Stuart Menefy, Aug 1999 * * 2003-02-12: Support M32R by Takeo Takahashi - * This is based on arch/sh/boot/compressed/misc.c. */ -#include - /* * gzip declarations */ - -#define OF(args) args #define STATIC static #undef memset #undef memcpy #define memzero(s, n) memset ((s), 0, (n)) -typedef unsigned char uch; -typedef unsigned short ush; -typedef unsigned long ulg; - -#define WSIZE 0x8000 /* Window size must be at least 32k, */ - /* and a power of two */ - -static uch *inbuf; /* input buffer */ -static uch window[WSIZE]; /* Sliding window buffer */ - -static unsigned insize = 0; /* valid bytes in inbuf */ -static unsigned inptr = 0; /* index of next byte to be processed in inbuf */ -static unsigned outcnt = 0; /* bytes in output buffer */ - -/* gzip flag byte */ -#define ASCII_FLAG 0x01 /* bit 0 set: file probably ASCII text */ -#define CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gzip file */ -#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */ -#define ORIG_NAME 0x08 /* bit 3 set: original file name present */ -#define COMMENT 0x10 /* bit 4 set: file comment present */ -#define ENCRYPTED 0x20 /* bit 5 set: file is encrypted */ -#define RESERVED 0xC0 /* bit 6,7: reserved */ - -#define get_byte() (inptr < insize ? inbuf[inptr++] : fill_inbuf()) - -/* Diagnostic functions */ -#ifdef DEBUG -# define Assert(cond,msg) {if(!(cond)) error(msg);} -# define Trace(x) fprintf x -# define Tracev(x) {if (verbose) fprintf x ;} -# define Tracevv(x) {if (verbose>1) fprintf x ;} -# define Tracec(c,x) {if (verbose && (c)) fprintf x ;} -# define Tracecv(c,x) {if (verbose>1 && (c)) fprintf x ;} -#else -# define Assert(cond,msg) -# define Trace(x) -# define Tracev(x) -# define Tracevv(x) -# define Tracec(c,x) -# define Tracecv(c,x) -#endif - -static int fill_inbuf(void); -static void flush_window(void); static void error(char *m); -static unsigned char *input_data; -static int input_len; - -static long bytes_out = 0; -static uch *output_data; -static unsigned long output_ptr = 0; - #include "m32r_sio.c" static unsigned long free_mem_ptr; static unsigned long free_mem_end_ptr; -#define HEAP_SIZE 0x10000 - -#include "../../../../lib/inflate.c" - -void* memset(void* s, int c, size_t n) +#ifdef CONFIG_KERNEL_BZIP2 +static void *memset(void *s, int c, size_t n) { - int i; - char *ss = (char*)s; + char *ss = s; - for (i=0;i> 8); - } - crc = c; - bytes_out += (ulg)outcnt; - output_ptr += (ulg)outcnt; - outcnt = 0; -} +#ifdef CONFIG_KERNEL_LZMA +#define BOOT_HEAP_SIZE 0x10000 +#include "../../../../lib/decompress_unlzma.c" +#endif static void error(char *x) { @@ -153,20 +62,20 @@ static void error(char *x) while(1); /* Halt */ } -/* return decompressed size */ void decompress_kernel(int mmu_on, unsigned char *zimage_data, unsigned int zimage_len, unsigned long heap) { + unsigned char *input_data = zimage_data; + int input_len = zimage_len; + unsigned char *output_data; + output_data = (unsigned char *)CONFIG_MEMORY_START + 0x2000 + (mmu_on ? 0x80000000 : 0); free_mem_ptr = heap; - free_mem_end_ptr = free_mem_ptr + HEAP_SIZE; - input_data = zimage_data; - input_len = zimage_len; + free_mem_end_ptr = free_mem_ptr + BOOT_HEAP_SIZE; - makecrc(); - puts("Uncompressing Linux... "); - gunzip(); - puts("Ok, booting the kernel.\n"); + puts("\nDecompressing Linux... "); + decompress(input_data, input_len, NULL, NULL, output_data, NULL, error); + puts("done.\nBooting the kernel.\n"); } -- cgit v1.2.3 From 45cdd473301aae36e1f10664b9fe7ef5aad3f182 Mon Sep 17 00:00:00 2001 From: Roel Kluin Date: Sun, 1 Nov 2009 15:33:06 +0100 Subject: m32r: Should index be positive? Index `ipi_num' is signed, test whether it is negative to make sure we don't get a negative array element. Signed-off-by: Roel Kluin Signed-off-by: Hirokazu Takata --- arch/m32r/kernel/smp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/m32r') diff --git a/arch/m32r/kernel/smp.c b/arch/m32r/kernel/smp.c index 8a88f1f0a3e..31cef20b299 100644 --- a/arch/m32r/kernel/smp.c +++ b/arch/m32r/kernel/smp.c @@ -806,7 +806,7 @@ unsigned long send_IPI_mask_phys(cpumask_t physid_mask, int ipi_num, if (mask & ~physids_coerce(phys_cpu_present_map)) BUG(); - if (ipi_num >= NR_IPIS) + if (ipi_num >= NR_IPIS || ipi_num < 0) BUG(); mask <<= IPI_SHIFT; -- cgit v1.2.3 From a556bec9955c8e47b40a87dbfeef6f24d3b2228f Mon Sep 17 00:00:00 2001 From: Hirokazu Takata Date: Mon, 9 Nov 2009 08:51:35 +0900 Subject: m32r: fix arch/m32r/boot/compressed/Makefile - Fix a comment string - Fix a typo of $(suffix-y) Signed-off-by: Hirokazu Takata --- arch/m32r/boot/compressed/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'arch/m32r') diff --git a/arch/m32r/boot/compressed/Makefile b/arch/m32r/boot/compressed/Makefile index 1003880d0df..177716b1d61 100644 --- a/arch/m32r/boot/compressed/Makefile +++ b/arch/m32r/boot/compressed/Makefile @@ -1,5 +1,5 @@ # -# linux/arch/sh/boot/compressed/Makefile +# linux/arch/m32r/boot/compressed/Makefile # # create a compressed vmlinux image from the original vmlinux # @@ -47,5 +47,5 @@ suffix_$(CONFIG_KERNEL_GZIP) = gz suffix_$(CONFIG_KERNEL_BZIP2) = bz2 suffix_$(CONFIG_KERNEL_LZMA) = lzma -$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.$(suffix_y) FORCE +$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.$(suffix-y) FORCE $(call if_changed,ld) -- cgit v1.2.3