diff options
| -rw-r--r-- | arch/mips/kernel/setup.c | 26 | ||||
| -rw-r--r-- | arch/mips/lib/mips-atomic.c | 8 | ||||
| -rw-r--r-- | lib/mpi/longlong.h | 19 |
3 files changed, 41 insertions, 12 deletions
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c index a53f8ec37aac..290dc6a1d7a3 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c | |||
| @@ -79,7 +79,7 @@ static struct resource data_resource = { .name = "Kernel data", }; | |||
| 79 | void __init add_memory_region(phys_t start, phys_t size, long type) | 79 | void __init add_memory_region(phys_t start, phys_t size, long type) |
| 80 | { | 80 | { |
| 81 | int x = boot_mem_map.nr_map; | 81 | int x = boot_mem_map.nr_map; |
| 82 | struct boot_mem_map_entry *prev = boot_mem_map.map + x - 1; | 82 | int i; |
| 83 | 83 | ||
| 84 | /* Sanity check */ | 84 | /* Sanity check */ |
| 85 | if (start + size < start) { | 85 | if (start + size < start) { |
| @@ -88,15 +88,29 @@ void __init add_memory_region(phys_t start, phys_t size, long type) | |||
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | /* | 90 | /* |
| 91 | * Try to merge with previous entry if any. This is far less than | 91 | * Try to merge with existing entry, if any. |
| 92 | * perfect but is sufficient for most real world cases. | ||
| 93 | */ | 92 | */ |
| 94 | if (x && prev->addr + prev->size == start && prev->type == type) { | 93 | for (i = 0; i < boot_mem_map.nr_map; i++) { |
| 95 | prev->size += size; | 94 | struct boot_mem_map_entry *entry = boot_mem_map.map + i; |
| 95 | unsigned long top; | ||
| 96 | |||
| 97 | if (entry->type != type) | ||
| 98 | continue; | ||
| 99 | |||
| 100 | if (start + size < entry->addr) | ||
| 101 | continue; /* no overlap */ | ||
| 102 | |||
| 103 | if (entry->addr + entry->size < start) | ||
| 104 | continue; /* no overlap */ | ||
| 105 | |||
| 106 | top = max(entry->addr + entry->size, start + size); | ||
| 107 | entry->addr = min(entry->addr, start); | ||
| 108 | entry->size = top - entry->addr; | ||
| 109 | |||
| 96 | return; | 110 | return; |
| 97 | } | 111 | } |
| 98 | 112 | ||
| 99 | if (x == BOOT_MEM_MAP_MAX) { | 113 | if (boot_mem_map.nr_map == BOOT_MEM_MAP_MAX) { |
| 100 | pr_err("Ooops! Too many entries in the memory map!\n"); | 114 | pr_err("Ooops! Too many entries in the memory map!\n"); |
| 101 | return; | 115 | return; |
| 102 | } | 116 | } |
diff --git a/arch/mips/lib/mips-atomic.c b/arch/mips/lib/mips-atomic.c index e091430dbeb1..cd160be3ce4d 100644 --- a/arch/mips/lib/mips-atomic.c +++ b/arch/mips/lib/mips-atomic.c | |||
| @@ -56,7 +56,7 @@ __asm__( | |||
| 56 | " .set pop \n" | 56 | " .set pop \n" |
| 57 | " .endm \n"); | 57 | " .endm \n"); |
| 58 | 58 | ||
| 59 | void arch_local_irq_disable(void) | 59 | notrace void arch_local_irq_disable(void) |
| 60 | { | 60 | { |
| 61 | preempt_disable(); | 61 | preempt_disable(); |
| 62 | __asm__ __volatile__( | 62 | __asm__ __volatile__( |
| @@ -93,7 +93,7 @@ __asm__( | |||
| 93 | " .set pop \n" | 93 | " .set pop \n" |
| 94 | " .endm \n"); | 94 | " .endm \n"); |
| 95 | 95 | ||
| 96 | unsigned long arch_local_irq_save(void) | 96 | notrace unsigned long arch_local_irq_save(void) |
| 97 | { | 97 | { |
| 98 | unsigned long flags; | 98 | unsigned long flags; |
| 99 | preempt_disable(); | 99 | preempt_disable(); |
| @@ -135,7 +135,7 @@ __asm__( | |||
| 135 | " .set pop \n" | 135 | " .set pop \n" |
| 136 | " .endm \n"); | 136 | " .endm \n"); |
| 137 | 137 | ||
| 138 | void arch_local_irq_restore(unsigned long flags) | 138 | notrace void arch_local_irq_restore(unsigned long flags) |
| 139 | { | 139 | { |
| 140 | unsigned long __tmp1; | 140 | unsigned long __tmp1; |
| 141 | 141 | ||
| @@ -159,7 +159,7 @@ void arch_local_irq_restore(unsigned long flags) | |||
| 159 | EXPORT_SYMBOL(arch_local_irq_restore); | 159 | EXPORT_SYMBOL(arch_local_irq_restore); |
| 160 | 160 | ||
| 161 | 161 | ||
| 162 | void __arch_local_irq_restore(unsigned long flags) | 162 | notrace void __arch_local_irq_restore(unsigned long flags) |
| 163 | { | 163 | { |
| 164 | unsigned long __tmp1; | 164 | unsigned long __tmp1; |
| 165 | 165 | ||
diff --git a/lib/mpi/longlong.h b/lib/mpi/longlong.h index 678ce4f1e124..095ab157a521 100644 --- a/lib/mpi/longlong.h +++ b/lib/mpi/longlong.h | |||
| @@ -641,7 +641,14 @@ do { \ | |||
| 641 | ************** MIPS ***************** | 641 | ************** MIPS ***************** |
| 642 | ***************************************/ | 642 | ***************************************/ |
| 643 | #if defined(__mips__) && W_TYPE_SIZE == 32 | 643 | #if defined(__mips__) && W_TYPE_SIZE == 32 |
| 644 | #if __GNUC__ > 2 || __GNUC_MINOR__ >= 7 | 644 | #if __GNUC__ >= 4 && __GNUC_MINOR__ >= 4 |
| 645 | #define umul_ppmm(w1, w0, u, v) \ | ||
| 646 | do { \ | ||
| 647 | UDItype __ll = (UDItype)(u) * (v); \ | ||
| 648 | w1 = __ll >> 32; \ | ||
| 649 | w0 = __ll; \ | ||
| 650 | } while (0) | ||
| 651 | #elif __GNUC__ > 2 || __GNUC_MINOR__ >= 7 | ||
| 645 | #define umul_ppmm(w1, w0, u, v) \ | 652 | #define umul_ppmm(w1, w0, u, v) \ |
| 646 | __asm__ ("multu %2,%3" \ | 653 | __asm__ ("multu %2,%3" \ |
| 647 | : "=l" ((USItype)(w0)), \ | 654 | : "=l" ((USItype)(w0)), \ |
| @@ -666,7 +673,15 @@ do { \ | |||
| 666 | ************** MIPS/64 ************** | 673 | ************** MIPS/64 ************** |
| 667 | ***************************************/ | 674 | ***************************************/ |
| 668 | #if (defined(__mips) && __mips >= 3) && W_TYPE_SIZE == 64 | 675 | #if (defined(__mips) && __mips >= 3) && W_TYPE_SIZE == 64 |
| 669 | #if __GNUC__ > 2 || __GNUC_MINOR__ >= 7 | 676 | #if __GNUC__ >= 4 && __GNUC_MINOR__ >= 4 |
| 677 | #define umul_ppmm(w1, w0, u, v) \ | ||
| 678 | do { \ | ||
| 679 | typedef unsigned int __ll_UTItype __attribute__((mode(TI))); \ | ||
| 680 | __ll_UTItype __ll = (__ll_UTItype)(u) * (v); \ | ||
| 681 | w1 = __ll >> 64; \ | ||
| 682 | w0 = __ll; \ | ||
| 683 | } while (0) | ||
| 684 | #elif __GNUC__ > 2 || __GNUC_MINOR__ >= 7 | ||
| 670 | #define umul_ppmm(w1, w0, u, v) \ | 685 | #define umul_ppmm(w1, w0, u, v) \ |
| 671 | __asm__ ("dmultu %2,%3" \ | 686 | __asm__ ("dmultu %2,%3" \ |
| 672 | : "=l" ((UDItype)(w0)), \ | 687 | : "=l" ((UDItype)(w0)), \ |
