2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
6 * Copyright (C) 2005-2008 Cavium Networks, Inc
8 #ifndef __ASM_MACH_CAVIUM_OCTEON_KERNEL_ENTRY_H
9 #define __ASM_MACH_CAVIUM_OCTEON_KERNEL_ENTRY_H
12 #define CP0_CYCLE_COUNTER $9, 6
13 #define CP0_CVMCTL_REG $9, 7
14 #define CP0_CVMMEMCTL_REG $11,7
15 #define CP0_PRID_REG $15, 0
16 #define CP0_PRID_OCTEON_PASS1 0x000d0000
17 #define CP0_PRID_OCTEON_CN30XX 0x000d0200
19 .macro kernel_entry_setup
20 # Registers set by bootloader:
21 # (only 32 bits set by bootloader, all addresses are physical
22 # addresses, and need to have the appropriate memory region set
25 # a1 = argv (kseg0 compat addr)
26 # a2 = 1 if init core, zero otherwise
27 # a3 = address of boot descriptor block
30 # Read the cavium mem control register
31 dmfc0 v0
, CP0_CVMMEMCTL_REG
32 # Clear the lower 6 bits, the CVMSEG size
34 ori v0
, CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE
35 dmtc0 v0
, CP0_CVMMEMCTL_REG
# Write the cavium mem control register
36 dmfc0 v0
, CP0_CVMCTL_REG
# Read the cavium control register
37 # Disable unaligned load/store support but leave HW fixup enabled
38 # Needed for octeon specific memcpy
41 # Read the processor ID register
43 # Disable instruction prefetching (Octeon Pass1 errata)
45 # Skip reenable of prefetching for Octeon Pass1
46 beq v1
, CP0_PRID_OCTEON_PASS1
, skip
48 # Reenable instruction prefetching, not on Pass1
50 # Strip off pass number off of processor id
53 # CN30XX needs some extra stuff turned off for better performance
54 bne v1
, CP0_PRID_OCTEON_CN30XX
, skip
56 # CN30XX Use random Icache replacement
58 # CN30XX Disable instruction prefetching
61 # First clear off CvmCtl[IPPCI] bit and move the performance
62 # counters interrupt to IRQ 6
66 # Write the cavium control register
67 dmtc0 v0
, CP0_CVMCTL_REG
69 # Flush dcache after config change
73 # Jump the master to kernel_entry
74 bne a2
, zero
, octeon_main_processor
80 # All cores other than the master need to wait here for SMP bootstrap
84 # This is the variable where the next core to boot os stored
85 PTR_LA t0
, octeon_processor_boot
86 octeon_spin_wait_boot
:
87 # Get the core id of the next to be booted
89 # Keep looping if it isn't me
90 bne t1, v0, octeon_spin_wait_boot
92 # Get my GP from the global variable
93 PTR_LA t0, octeon_processor_gp
95 # Get my SP from the global variable
96 PTR_LA t0, octeon_processor_sp
98 # Set the SP global variable to zero so the master knows we've started
106 # Jump to the normal Linux SMP entry point
109 #else /* CONFIG_SMP */
112 # Someone tried to boot SMP with a non SMP kernel. All extra cores
117 b octeon_wait_forever
120 #endif /* CONFIG_SMP */
121 octeon_main_processor
:
126 * Do SMP slave processor setup necessary before we can savely execute C code.
128 .macro smp_slave_setup
131 #endif /* __ASM_MACH_CAVIUM_OCTEON_KERNEL_ENTRY_H */