Commit 388f7883 authored by Alexander Sverdlin's avatar Alexander Sverdlin Committed by Thomas Bogendoerfer

MIPS: octeon: Get rid of preprocessor directives around RESERVE32

Some of them were pointless because CONFIG_CAVIUM_RESERVE32 is now always
defined, some were not enough (Yu Zhao reported
"Failed to allocate CAVIUM_RESERVE32 memory area" error).

Removing the directives allows for compiler coverage of RESERVE32 code and
replacing one of [always-true] "ifdef" with a compiler conditional fixes
the [cosmetic] error message.

Fixes: 3e3114ac ("MIPS: Introduce CAVIUM_RESERVE32 Kconfig option")
Signed-off-by: default avatarAlexander Sverdlin <alexander.sverdlin@nokia.com>
Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
parent 35508d24
...@@ -57,14 +57,11 @@ EXPORT_SYMBOL_GPL(__cvmx_cmd_queue_state_ptr); ...@@ -57,14 +57,11 @@ EXPORT_SYMBOL_GPL(__cvmx_cmd_queue_state_ptr);
static cvmx_cmd_queue_result_t __cvmx_cmd_queue_init_state_ptr(void) static cvmx_cmd_queue_result_t __cvmx_cmd_queue_init_state_ptr(void)
{ {
char *alloc_name = "cvmx_cmd_queues"; char *alloc_name = "cvmx_cmd_queues";
#if defined(CONFIG_CAVIUM_RESERVE32) && CONFIG_CAVIUM_RESERVE32
extern uint64_t octeon_reserve32_memory; extern uint64_t octeon_reserve32_memory;
#endif
if (likely(__cvmx_cmd_queue_state_ptr)) if (likely(__cvmx_cmd_queue_state_ptr))
return CVMX_CMD_QUEUE_SUCCESS; return CVMX_CMD_QUEUE_SUCCESS;
#if defined(CONFIG_CAVIUM_RESERVE32) && CONFIG_CAVIUM_RESERVE32
if (octeon_reserve32_memory) if (octeon_reserve32_memory)
__cvmx_cmd_queue_state_ptr = __cvmx_cmd_queue_state_ptr =
cvmx_bootmem_alloc_named_range(sizeof(*__cvmx_cmd_queue_state_ptr), cvmx_bootmem_alloc_named_range(sizeof(*__cvmx_cmd_queue_state_ptr),
...@@ -73,7 +70,6 @@ static cvmx_cmd_queue_result_t __cvmx_cmd_queue_init_state_ptr(void) ...@@ -73,7 +70,6 @@ static cvmx_cmd_queue_result_t __cvmx_cmd_queue_init_state_ptr(void)
(CONFIG_CAVIUM_RESERVE32 << (CONFIG_CAVIUM_RESERVE32 <<
20) - 1, 128, alloc_name); 20) - 1, 128, alloc_name);
else else
#endif
__cvmx_cmd_queue_state_ptr = __cvmx_cmd_queue_state_ptr =
cvmx_bootmem_alloc_named(sizeof(*__cvmx_cmd_queue_state_ptr), cvmx_bootmem_alloc_named(sizeof(*__cvmx_cmd_queue_state_ptr),
128, 128,
......
...@@ -284,10 +284,8 @@ void octeon_crash_smp_send_stop(void) ...@@ -284,10 +284,8 @@ void octeon_crash_smp_send_stop(void)
#endif /* CONFIG_KEXEC */ #endif /* CONFIG_KEXEC */
#ifdef CONFIG_CAVIUM_RESERVE32
uint64_t octeon_reserve32_memory; uint64_t octeon_reserve32_memory;
EXPORT_SYMBOL(octeon_reserve32_memory); EXPORT_SYMBOL(octeon_reserve32_memory);
#endif
#ifdef CONFIG_KEXEC #ifdef CONFIG_KEXEC
/* crashkernel cmdline parameter is parsed _after_ memory setup /* crashkernel cmdline parameter is parsed _after_ memory setup
...@@ -666,9 +664,6 @@ void __init prom_init(void) ...@@ -666,9 +664,6 @@ void __init prom_init(void)
int i; int i;
u64 t; u64 t;
int argc; int argc;
#ifdef CONFIG_CAVIUM_RESERVE32
int64_t addr = -1;
#endif
/* /*
* The bootloader passes a pointer to the boot descriptor in * The bootloader passes a pointer to the boot descriptor in
* $a3, this is available as fw_arg3. * $a3, this is available as fw_arg3.
...@@ -783,7 +778,7 @@ void __init prom_init(void) ...@@ -783,7 +778,7 @@ void __init prom_init(void)
cvmx_write_csr(CVMX_LED_UDD_DATX(1), 0); cvmx_write_csr(CVMX_LED_UDD_DATX(1), 0);
cvmx_write_csr(CVMX_LED_EN, 1); cvmx_write_csr(CVMX_LED_EN, 1);
} }
#ifdef CONFIG_CAVIUM_RESERVE32
/* /*
* We need to temporarily allocate all memory in the reserve32 * We need to temporarily allocate all memory in the reserve32
* region. This makes sure the kernel doesn't allocate this * region. This makes sure the kernel doesn't allocate this
...@@ -794,14 +789,16 @@ void __init prom_init(void) ...@@ -794,14 +789,16 @@ void __init prom_init(void)
* Allocate memory for RESERVED32 aligned on 2MB boundary. This * Allocate memory for RESERVED32 aligned on 2MB boundary. This
* is in case we later use hugetlb entries with it. * is in case we later use hugetlb entries with it.
*/ */
addr = cvmx_bootmem_phy_named_block_alloc(CONFIG_CAVIUM_RESERVE32 << 20, if (CONFIG_CAVIUM_RESERVE32) {
0, 0, 2 << 20, int64_t addr =
"CAVIUM_RESERVE32", 0); cvmx_bootmem_phy_named_block_alloc(CONFIG_CAVIUM_RESERVE32 << 20,
if (addr < 0) 0, 0, 2 << 20,
pr_err("Failed to allocate CAVIUM_RESERVE32 memory area\n"); "CAVIUM_RESERVE32", 0);
else if (addr < 0)
octeon_reserve32_memory = addr; pr_err("Failed to allocate CAVIUM_RESERVE32 memory area\n");
#endif else
octeon_reserve32_memory = addr;
}
#ifdef CONFIG_CAVIUM_OCTEON_LOCK_L2 #ifdef CONFIG_CAVIUM_OCTEON_LOCK_L2
if (cvmx_read_csr(CVMX_L2D_FUS3) & (3ull << 34)) { if (cvmx_read_csr(CVMX_L2D_FUS3) & (3ull << 34)) {
...@@ -1079,7 +1076,6 @@ void __init plat_mem_setup(void) ...@@ -1079,7 +1076,6 @@ void __init plat_mem_setup(void)
cvmx_bootmem_unlock(); cvmx_bootmem_unlock();
#endif /* CONFIG_CRASH_DUMP */ #endif /* CONFIG_CRASH_DUMP */
#ifdef CONFIG_CAVIUM_RESERVE32
/* /*
* Now that we've allocated the kernel memory it is safe to * Now that we've allocated the kernel memory it is safe to
* free the reserved region. We free it here so that builtin * free the reserved region. We free it here so that builtin
...@@ -1087,7 +1083,6 @@ void __init plat_mem_setup(void) ...@@ -1087,7 +1083,6 @@ void __init plat_mem_setup(void)
*/ */
if (octeon_reserve32_memory) if (octeon_reserve32_memory)
cvmx_bootmem_free_named("CAVIUM_RESERVE32"); cvmx_bootmem_free_named("CAVIUM_RESERVE32");
#endif /* CONFIG_CAVIUM_RESERVE32 */
if (total == 0) if (total == 0)
panic("Unable to allocate memory from " panic("Unable to allocate memory from "
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment