diff options
Diffstat (limited to 'arch/mips/cavium-octeon/setup.c')
-rw-r--r-- | arch/mips/cavium-octeon/setup.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/arch/mips/cavium-octeon/setup.c b/arch/mips/cavium-octeon/setup.c index 041326e34f4d..69197cb6c7ea 100644 --- a/arch/mips/cavium-octeon/setup.c +++ b/arch/mips/cavium-octeon/setup.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <asm/time.h> | 32 | #include <asm/time.h> |
33 | 33 | ||
34 | #include <asm/octeon/octeon.h> | 34 | #include <asm/octeon/octeon.h> |
35 | #include <asm/octeon/pci-octeon.h> | ||
35 | 36 | ||
36 | #ifdef CONFIG_CAVIUM_DECODE_RSL | 37 | #ifdef CONFIG_CAVIUM_DECODE_RSL |
37 | extern void cvmx_interrupt_rsl_decode(void); | 38 | extern void cvmx_interrupt_rsl_decode(void); |
@@ -609,6 +610,22 @@ void __init prom_init(void) | |||
609 | register_smp_ops(&octeon_smp_ops); | 610 | register_smp_ops(&octeon_smp_ops); |
610 | } | 611 | } |
611 | 612 | ||
613 | /* Exclude a single page from the regions obtained in plat_mem_setup. */ | ||
614 | static __init void memory_exclude_page(u64 addr, u64 *mem, u64 *size) | ||
615 | { | ||
616 | if (addr > *mem && addr < *mem + *size) { | ||
617 | u64 inc = addr - *mem; | ||
618 | add_memory_region(*mem, inc, BOOT_MEM_RAM); | ||
619 | *mem += inc; | ||
620 | *size -= inc; | ||
621 | } | ||
622 | |||
623 | if (addr == *mem && *size > PAGE_SIZE) { | ||
624 | *mem += PAGE_SIZE; | ||
625 | *size -= PAGE_SIZE; | ||
626 | } | ||
627 | } | ||
628 | |||
612 | void __init plat_mem_setup(void) | 629 | void __init plat_mem_setup(void) |
613 | { | 630 | { |
614 | uint64_t mem_alloc_size; | 631 | uint64_t mem_alloc_size; |
@@ -659,12 +676,27 @@ void __init plat_mem_setup(void) | |||
659 | CVMX_BOOTMEM_FLAG_NO_LOCKING); | 676 | CVMX_BOOTMEM_FLAG_NO_LOCKING); |
660 | #endif | 677 | #endif |
661 | if (memory >= 0) { | 678 | if (memory >= 0) { |
679 | u64 size = mem_alloc_size; | ||
680 | |||
681 | /* | ||
682 | * exclude a page at the beginning and end of | ||
683 | * the 256MB PCIe 'hole' so the kernel will not | ||
684 | * try to allocate multi-page buffers that | ||
685 | * span the discontinuity. | ||
686 | */ | ||
687 | memory_exclude_page(CVMX_PCIE_BAR1_PHYS_BASE, | ||
688 | &memory, &size); | ||
689 | memory_exclude_page(CVMX_PCIE_BAR1_PHYS_BASE + | ||
690 | CVMX_PCIE_BAR1_PHYS_SIZE, | ||
691 | &memory, &size); | ||
692 | |||
662 | /* | 693 | /* |
663 | * This function automatically merges address | 694 | * This function automatically merges address |
664 | * regions next to each other if they are | 695 | * regions next to each other if they are |
665 | * received in incrementing order. | 696 | * received in incrementing order. |
666 | */ | 697 | */ |
667 | add_memory_region(memory, mem_alloc_size, BOOT_MEM_RAM); | 698 | if (size) |
699 | add_memory_region(memory, size, BOOT_MEM_RAM); | ||
668 | total += mem_alloc_size; | 700 | total += mem_alloc_size; |
669 | } else { | 701 | } else { |
670 | break; | 702 | break; |