12 #include <linux/export.h>
15 #include <linux/serial.h>
17 #include <linux/types.h>
18 #include <linux/string.h>
19 #include <linux/tty.h>
20 #include <linux/time.h>
22 #include <linux/serial_core.h>
27 #include <asm/processor.h>
28 #include <asm/reboot.h>
29 #include <asm/smp-ops.h>
32 #include <asm/bootinfo.h>
33 #include <asm/sections.h>
40 #ifdef CONFIG_CAVIUM_DECODE_RSL
41 extern void cvmx_interrupt_rsl_decode(
void);
42 extern int __cvmx_interrupt_ecc_report_single_bit_errors;
43 extern void cvmx_interrupt_rsl_enable(
void);
49 extern void pci_console_init(
const char *
arg);
52 static unsigned long long MAX_MEMORY = 512ull << 20;
59 #ifdef CONFIG_CAVIUM_RESERVE32
64 static int octeon_uart;
108 static u64 octeon_io_clock_rate;
112 return octeon_io_clock_rate;
131 for (i = 0; i < 8; i++, s++) {
149 #ifdef CONFIG_CAVIUM_OCTEON_2ND_KERNEL
173 const int coreid = cvmx_get_core_num();
174 unsigned long long mask;
175 unsigned long long bist_val;
178 mask = 0x1f00000000ull;
181 pr_err(
"Core%d BIST Failure: CacheErr(icache) = 0x%llx\n",
186 pr_err(
"Core%d L1 Dcache parity error: "
187 "CacheErr(dcache) = 0x%llx\n",
190 mask = 0xfc00000000000000ull;
193 pr_err(
"Core%d BIST Failure: COP0_CVM_MEM_CTL = 0x%llx\n",
204 static void octeon_restart(
char *
command)
212 cvmx_write_csr(CVMX_CIU_WDOGX(cvmx_get_core_num()), 0);
226 static void octeon_kill_core(
void *
arg)
231 cvmx_write_csr(CVMX_CIU_WDOGX(cvmx_get_core_num()), 0);
233 asm volatile (
"sync\nbreak");
241 static void octeon_halt(
void)
256 octeon_kill_core(
NULL);
263 #ifdef CONFIG_CAVIUM_DECODE_RSL
266 cvmx_interrupt_rsl_decode();
278 static char name[80];
280 cvmx_board_type_to_string(octeon_bootinfo->
board_type),
299 cvmmemctl.
s.dismarkwblongto = 1;
302 cvmmemctl.
s.dismrgclrwbto = 0;
306 cvmmemctl.
s.iobdmascrmsb = 0;
311 cvmmemctl.
s.syncwsmarked = 0;
313 cvmmemctl.
s.dissyncws = 0;
316 cvmmemctl.
s.diswbfst = 1;
318 cvmmemctl.
s.diswbfst = 0;
321 cvmmemctl.
s.xkmemenas = 0;
325 cvmmemctl.
s.xkmemenau = 0;
329 cvmmemctl.
s.xkioenas = 0;
333 cvmmemctl.
s.xkioenau = 0;
337 cvmmemctl.
s.allsyncw = 0;
341 cvmmemctl.
s.nomerge = 0;
346 cvmmemctl.
s.didtto = 0;
348 cvmmemctl.
s.csrckalwys = 0;
350 cvmmemctl.
s.mclkalwys = 0;
357 cvmmemctl.
s.wbfltime = 0;
359 cvmmemctl.
s.istrnol2 = 0;
368 cvmmemctl.
s.wbthresh = 4;
370 cvmmemctl.
s.wbthresh = 10;
374 #if CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE > 0
375 cvmmemctl.
s.cvmsegenak = 1;
377 cvmmemctl.
s.cvmsegenak = 0;
381 cvmmemctl.
s.cvmsegenas = 0;
384 cvmmemctl.
s.cvmsegenau = 0;
387 cvmmemctl.
s.lmemsz = CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE;
392 pr_notice(
"CVMSEG size: %d cache lines (%d bytes)\n",
393 CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE,
394 CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE * 128);
398 fau_timeout.
s.tout_val = 0xfff;
400 fau_timeout.
s.tout_enb = 0;
420 #ifdef CONFIG_CAVIUM_RESERVE32
433 memset(sysinfo, 0,
sizeof(*sysinfo));
462 octeon_io_clock_rate = 50000000 * rst_boot.
s.pnr_mul;
483 #ifdef CONFIG_CAVIUM_RESERVE32
496 "CAVIUM_RESERVE32", 0);
498 pr_err(
"Failed to allocate CAVIUM_RESERVE32 memory area\n");
500 octeon_reserve32_memory =
addr;
503 #ifdef CONFIG_CAVIUM_OCTEON_LOCK_L2
505 pr_info(
"Skipping L2 locking due to reduced L2 cache size\n");
508 #ifdef CONFIG_CAVIUM_OCTEON_LOCK_L2_TLB
512 #ifdef CONFIG_CAVIUM_OCTEON_LOCK_L2_EXCEPTION
516 #ifdef CONFIG_CAVIUM_OCTEON_LOCK_L2_LOW_LEVEL_INTERRUPT
520 #ifdef CONFIG_CAVIUM_OCTEON_LOCK_L2_INTERRUPT
524 #ifdef CONFIG_CAVIUM_OCTEON_LOCK_L2_MEMCPY
540 #ifdef CONFIG_CAVIUM_GDB
567 MAX_MEMORY = 64ull << 20;
570 argc = octeon_boot_desc_ptr->
argc;
571 for (i = 0; i <
argc; i++) {
573 cvmx_phys_to_ptr(octeon_boot_desc_ptr->
argv[i]);
574 if ((
strncmp(arg,
"MEM=", 4) == 0) ||
575 (
strncmp(arg,
"mem=", 4) == 0)) {
576 sscanf(arg + 4,
"%llu", &MAX_MEMORY);
579 MAX_MEMORY = 32ull << 30;
580 }
else if (
strcmp(arg,
"ecc_verbose") == 0) {
581 #ifdef CONFIG_CAVIUM_REPORT_SINGLE_BIT_ECC
582 __cvmx_interrupt_ecc_report_single_bit_errors = 1;
583 pr_notice(
"Reporting of single bit ECC errors is "
594 #ifdef CONFIG_CAVIUM_OCTEON_2ND_KERNEL
597 if (octeon_uart == 1)
627 if (addr > *mem && addr < *mem + *size) {
655 mem_alloc_size = 4 << 20;
656 if (mem_alloc_size > MAX_MEMORY)
657 mem_alloc_size = MAX_MEMORY;
666 && (total < MAX_MEMORY)) {
667 #if defined(CONFIG_64BIT) || defined(CONFIG_64BIT_PHYS_ADDR)
672 #elif defined(CONFIG_HIGHMEM)
682 u64 size = mem_alloc_size;
703 total += mem_alloc_size;
710 #ifdef CONFIG_CAVIUM_RESERVE32
716 if (octeon_reserve32_memory)
721 panic(
"Unable to allocate memory from "
722 "cvmx_bootmem_phy_alloc\n");
736 }
while ((lsrval & 0x20) == 0);
753 asm volatile(
"# before" : : :
"memory");
760 "1:\tlw %0,-12($31)\n\t"
762 :
"=r" (
insn) : :
"$31",
"memory");
764 if ((insn >> 26) != 0x33)
765 panic(
"No PREF instruction at Core-14449 probe point.");
767 if (((insn >> 16) & 0x1f) != 28)
768 panic(
"Core-14449 WAR not in place (%04x).\n"
769 "Please build kernel with proper options (CONFIG_CAVIUM_CN63XXP1).", insn);
771 #ifdef CONFIG_CAVIUM_DECODE_RSL
772 cvmx_interrupt_rsl_enable();
776 "RML/RSL", octeon_rlm_interrupt)) {
777 panic(
"Unable to request_irq(OCTEON_IRQ_RML)");
797 panic(
"Corrupt Device Tree passed to kernel.");
802 dt_size = &__dtb_octeon_68xx_end - &__dtb_octeon_68xx_begin;
806 dt_size = &__dtb_octeon_3xxx_end - &__dtb_octeon_3xxx_begin;
813 panic(
"Could not allocate initial_boot_params\n");
818 pr_info(
"Using internal Device Tree.\n");
820 pr_info(
"Using passed Device Tree.\n");
822 unflatten_device_tree();