18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public 38c2ecf20Sopenharmony_ci * License. See the file "COPYING" in the main directory of this archive 48c2ecf20Sopenharmony_ci * for more details. 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * Copyright (C) 2004-2008 Cavium Networks 78c2ecf20Sopenharmony_ci */ 88c2ecf20Sopenharmony_ci#ifndef __ASM_OCTEON_OCTEON_H 98c2ecf20Sopenharmony_ci#define __ASM_OCTEON_OCTEON_H 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#include <asm/octeon/cvmx.h> 128c2ecf20Sopenharmony_ci#include <asm/bitfield.h> 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ciextern uint64_t octeon_bootmem_alloc_range_phys(uint64_t size, 158c2ecf20Sopenharmony_ci uint64_t alignment, 168c2ecf20Sopenharmony_ci uint64_t min_addr, 178c2ecf20Sopenharmony_ci uint64_t max_addr, 188c2ecf20Sopenharmony_ci int do_locking); 198c2ecf20Sopenharmony_ciextern void *octeon_bootmem_alloc(uint64_t size, uint64_t alignment, 208c2ecf20Sopenharmony_ci int do_locking); 218c2ecf20Sopenharmony_ciextern void *octeon_bootmem_alloc_range(uint64_t size, uint64_t alignment, 228c2ecf20Sopenharmony_ci uint64_t min_addr, uint64_t max_addr, 238c2ecf20Sopenharmony_ci int do_locking); 248c2ecf20Sopenharmony_ciextern void *octeon_bootmem_alloc_named(uint64_t size, uint64_t alignment, 258c2ecf20Sopenharmony_ci char *name); 268c2ecf20Sopenharmony_ciextern void *octeon_bootmem_alloc_named_range(uint64_t size, uint64_t min_addr, 278c2ecf20Sopenharmony_ci uint64_t max_addr, uint64_t align, 288c2ecf20Sopenharmony_ci char *name); 298c2ecf20Sopenharmony_ciextern void *octeon_bootmem_alloc_named_address(uint64_t size, uint64_t address, 308c2ecf20Sopenharmony_ci char *name); 318c2ecf20Sopenharmony_ciextern int octeon_bootmem_free_named(char *name); 328c2ecf20Sopenharmony_ciextern void octeon_bootmem_lock(void); 338c2ecf20Sopenharmony_ciextern void octeon_bootmem_unlock(void); 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ciextern int octeon_is_simulation(void); 368c2ecf20Sopenharmony_ciextern int octeon_is_pci_host(void); 378c2ecf20Sopenharmony_ciextern int octeon_usb_is_ref_clk(void); 388c2ecf20Sopenharmony_ciextern uint64_t octeon_get_clock_rate(void); 398c2ecf20Sopenharmony_ciextern u64 octeon_get_io_clock_rate(void); 408c2ecf20Sopenharmony_ciextern const char *octeon_board_type_string(void); 418c2ecf20Sopenharmony_ciextern const char *octeon_get_pci_interrupts(void); 428c2ecf20Sopenharmony_ciextern int octeon_get_southbridge_interrupt(void); 438c2ecf20Sopenharmony_ciextern int octeon_get_boot_coremask(void); 448c2ecf20Sopenharmony_ciextern int octeon_get_boot_num_arguments(void); 458c2ecf20Sopenharmony_ciextern const char *octeon_get_boot_argument(int arg); 468c2ecf20Sopenharmony_ciextern void octeon_hal_setup_reserved32(void); 478c2ecf20Sopenharmony_ciextern void octeon_user_io_init(void); 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ciextern void octeon_init_cvmcount(void); 508c2ecf20Sopenharmony_ciextern void octeon_setup_delays(void); 518c2ecf20Sopenharmony_ciextern void octeon_io_clk_delay(unsigned long); 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_ci#define OCTEON_ARGV_MAX_ARGS 64 548c2ecf20Sopenharmony_ci#define OCTEON_SERIAL_LEN 20 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_cistruct octeon_boot_descriptor { 578c2ecf20Sopenharmony_ci#ifdef __BIG_ENDIAN_BITFIELD 588c2ecf20Sopenharmony_ci /* Start of block referenced by assembly code - do not change! */ 598c2ecf20Sopenharmony_ci uint32_t desc_version; 608c2ecf20Sopenharmony_ci uint32_t desc_size; 618c2ecf20Sopenharmony_ci uint64_t stack_top; 628c2ecf20Sopenharmony_ci uint64_t heap_base; 638c2ecf20Sopenharmony_ci uint64_t heap_end; 648c2ecf20Sopenharmony_ci /* Only used by bootloader */ 658c2ecf20Sopenharmony_ci uint64_t entry_point; 668c2ecf20Sopenharmony_ci uint64_t desc_vaddr; 678c2ecf20Sopenharmony_ci /* End of This block referenced by assembly code - do not change! */ 688c2ecf20Sopenharmony_ci uint32_t exception_base_addr; 698c2ecf20Sopenharmony_ci uint32_t stack_size; 708c2ecf20Sopenharmony_ci uint32_t heap_size; 718c2ecf20Sopenharmony_ci /* Argc count for application. */ 728c2ecf20Sopenharmony_ci uint32_t argc; 738c2ecf20Sopenharmony_ci uint32_t argv[OCTEON_ARGV_MAX_ARGS]; 748c2ecf20Sopenharmony_ci 758c2ecf20Sopenharmony_ci#define BOOT_FLAG_INIT_CORE (1 << 0) 768c2ecf20Sopenharmony_ci#define OCTEON_BL_FLAG_DEBUG (1 << 1) 778c2ecf20Sopenharmony_ci#define OCTEON_BL_FLAG_NO_MAGIC (1 << 2) 788c2ecf20Sopenharmony_ci /* If set, use uart1 for console */ 798c2ecf20Sopenharmony_ci#define OCTEON_BL_FLAG_CONSOLE_UART1 (1 << 3) 808c2ecf20Sopenharmony_ci /* If set, use PCI console */ 818c2ecf20Sopenharmony_ci#define OCTEON_BL_FLAG_CONSOLE_PCI (1 << 4) 828c2ecf20Sopenharmony_ci /* Call exit on break on serial port */ 838c2ecf20Sopenharmony_ci#define OCTEON_BL_FLAG_BREAK (1 << 5) 848c2ecf20Sopenharmony_ci 858c2ecf20Sopenharmony_ci uint32_t flags; 868c2ecf20Sopenharmony_ci uint32_t core_mask; 878c2ecf20Sopenharmony_ci /* DRAM size in megabyes. */ 888c2ecf20Sopenharmony_ci uint32_t dram_size; 898c2ecf20Sopenharmony_ci /* physical address of free memory descriptor block. */ 908c2ecf20Sopenharmony_ci uint32_t phy_mem_desc_addr; 918c2ecf20Sopenharmony_ci /* used to pass flags from app to debugger. */ 928c2ecf20Sopenharmony_ci uint32_t debugger_flags_base_addr; 938c2ecf20Sopenharmony_ci /* CPU clock speed, in hz. */ 948c2ecf20Sopenharmony_ci uint32_t eclock_hz; 958c2ecf20Sopenharmony_ci /* DRAM clock speed, in hz. */ 968c2ecf20Sopenharmony_ci uint32_t dclock_hz; 978c2ecf20Sopenharmony_ci /* SPI4 clock in hz. */ 988c2ecf20Sopenharmony_ci uint32_t spi_clock_hz; 998c2ecf20Sopenharmony_ci uint16_t board_type; 1008c2ecf20Sopenharmony_ci uint8_t board_rev_major; 1018c2ecf20Sopenharmony_ci uint8_t board_rev_minor; 1028c2ecf20Sopenharmony_ci uint16_t chip_type; 1038c2ecf20Sopenharmony_ci uint8_t chip_rev_major; 1048c2ecf20Sopenharmony_ci uint8_t chip_rev_minor; 1058c2ecf20Sopenharmony_ci char board_serial_number[OCTEON_SERIAL_LEN]; 1068c2ecf20Sopenharmony_ci uint8_t mac_addr_base[6]; 1078c2ecf20Sopenharmony_ci uint8_t mac_addr_count; 1088c2ecf20Sopenharmony_ci uint64_t cvmx_desc_vaddr; 1098c2ecf20Sopenharmony_ci#else 1108c2ecf20Sopenharmony_ci uint32_t desc_size; 1118c2ecf20Sopenharmony_ci uint32_t desc_version; 1128c2ecf20Sopenharmony_ci uint64_t stack_top; 1138c2ecf20Sopenharmony_ci uint64_t heap_base; 1148c2ecf20Sopenharmony_ci uint64_t heap_end; 1158c2ecf20Sopenharmony_ci /* Only used by bootloader */ 1168c2ecf20Sopenharmony_ci uint64_t entry_point; 1178c2ecf20Sopenharmony_ci uint64_t desc_vaddr; 1188c2ecf20Sopenharmony_ci /* End of This block referenced by assembly code - do not change! */ 1198c2ecf20Sopenharmony_ci uint32_t stack_size; 1208c2ecf20Sopenharmony_ci uint32_t exception_base_addr; 1218c2ecf20Sopenharmony_ci uint32_t argc; 1228c2ecf20Sopenharmony_ci uint32_t heap_size; 1238c2ecf20Sopenharmony_ci /* 1248c2ecf20Sopenharmony_ci * Argc count for application. 1258c2ecf20Sopenharmony_ci * Warning low bit scrambled in little-endian. 1268c2ecf20Sopenharmony_ci */ 1278c2ecf20Sopenharmony_ci uint32_t argv[OCTEON_ARGV_MAX_ARGS]; 1288c2ecf20Sopenharmony_ci 1298c2ecf20Sopenharmony_ci#define BOOT_FLAG_INIT_CORE (1 << 0) 1308c2ecf20Sopenharmony_ci#define OCTEON_BL_FLAG_DEBUG (1 << 1) 1318c2ecf20Sopenharmony_ci#define OCTEON_BL_FLAG_NO_MAGIC (1 << 2) 1328c2ecf20Sopenharmony_ci /* If set, use uart1 for console */ 1338c2ecf20Sopenharmony_ci#define OCTEON_BL_FLAG_CONSOLE_UART1 (1 << 3) 1348c2ecf20Sopenharmony_ci /* If set, use PCI console */ 1358c2ecf20Sopenharmony_ci#define OCTEON_BL_FLAG_CONSOLE_PCI (1 << 4) 1368c2ecf20Sopenharmony_ci /* Call exit on break on serial port */ 1378c2ecf20Sopenharmony_ci#define OCTEON_BL_FLAG_BREAK (1 << 5) 1388c2ecf20Sopenharmony_ci 1398c2ecf20Sopenharmony_ci uint32_t core_mask; 1408c2ecf20Sopenharmony_ci uint32_t flags; 1418c2ecf20Sopenharmony_ci /* physical address of free memory descriptor block. */ 1428c2ecf20Sopenharmony_ci uint32_t phy_mem_desc_addr; 1438c2ecf20Sopenharmony_ci /* DRAM size in megabyes. */ 1448c2ecf20Sopenharmony_ci uint32_t dram_size; 1458c2ecf20Sopenharmony_ci /* CPU clock speed, in hz. */ 1468c2ecf20Sopenharmony_ci uint32_t eclock_hz; 1478c2ecf20Sopenharmony_ci /* used to pass flags from app to debugger. */ 1488c2ecf20Sopenharmony_ci uint32_t debugger_flags_base_addr; 1498c2ecf20Sopenharmony_ci /* SPI4 clock in hz. */ 1508c2ecf20Sopenharmony_ci uint32_t spi_clock_hz; 1518c2ecf20Sopenharmony_ci /* DRAM clock speed, in hz. */ 1528c2ecf20Sopenharmony_ci uint32_t dclock_hz; 1538c2ecf20Sopenharmony_ci uint8_t chip_rev_minor; 1548c2ecf20Sopenharmony_ci uint8_t chip_rev_major; 1558c2ecf20Sopenharmony_ci uint16_t chip_type; 1568c2ecf20Sopenharmony_ci uint8_t board_rev_minor; 1578c2ecf20Sopenharmony_ci uint8_t board_rev_major; 1588c2ecf20Sopenharmony_ci uint16_t board_type; 1598c2ecf20Sopenharmony_ci 1608c2ecf20Sopenharmony_ci uint64_t unused1[4]; /* Not even filled in by bootloader. */ 1618c2ecf20Sopenharmony_ci 1628c2ecf20Sopenharmony_ci uint64_t cvmx_desc_vaddr; 1638c2ecf20Sopenharmony_ci#endif 1648c2ecf20Sopenharmony_ci}; 1658c2ecf20Sopenharmony_ci 1668c2ecf20Sopenharmony_ciunion octeon_cvmemctl { 1678c2ecf20Sopenharmony_ci uint64_t u64; 1688c2ecf20Sopenharmony_ci struct { 1698c2ecf20Sopenharmony_ci /* RO 1 = BIST fail, 0 = BIST pass */ 1708c2ecf20Sopenharmony_ci __BITFIELD_FIELD(uint64_t tlbbist:1, 1718c2ecf20Sopenharmony_ci /* RO 1 = BIST fail, 0 = BIST pass */ 1728c2ecf20Sopenharmony_ci __BITFIELD_FIELD(uint64_t l1cbist:1, 1738c2ecf20Sopenharmony_ci /* RO 1 = BIST fail, 0 = BIST pass */ 1748c2ecf20Sopenharmony_ci __BITFIELD_FIELD(uint64_t l1dbist:1, 1758c2ecf20Sopenharmony_ci /* RO 1 = BIST fail, 0 = BIST pass */ 1768c2ecf20Sopenharmony_ci __BITFIELD_FIELD(uint64_t dcmbist:1, 1778c2ecf20Sopenharmony_ci /* RO 1 = BIST fail, 0 = BIST pass */ 1788c2ecf20Sopenharmony_ci __BITFIELD_FIELD(uint64_t ptgbist:1, 1798c2ecf20Sopenharmony_ci /* RO 1 = BIST fail, 0 = BIST pass */ 1808c2ecf20Sopenharmony_ci __BITFIELD_FIELD(uint64_t wbfbist:1, 1818c2ecf20Sopenharmony_ci /* Reserved */ 1828c2ecf20Sopenharmony_ci __BITFIELD_FIELD(uint64_t reserved:17, 1838c2ecf20Sopenharmony_ci /* OCTEON II - TLB replacement policy: 0 = bitmask LRU; 1 = NLU. 1848c2ecf20Sopenharmony_ci * This field selects between the TLB replacement policies: 1858c2ecf20Sopenharmony_ci * bitmask LRU or NLU. Bitmask LRU maintains a mask of 1868c2ecf20Sopenharmony_ci * recently used TLB entries and avoids them as new entries 1878c2ecf20Sopenharmony_ci * are allocated. NLU simply guarantees that the next 1888c2ecf20Sopenharmony_ci * allocation is not the last used TLB entry. */ 1898c2ecf20Sopenharmony_ci __BITFIELD_FIELD(uint64_t tlbnlu:1, 1908c2ecf20Sopenharmony_ci /* OCTEON II - Selects the bit in the counter used for 1918c2ecf20Sopenharmony_ci * releasing a PAUSE. This counter trips every 2(8+PAUSETIME) 1928c2ecf20Sopenharmony_ci * cycles. If not already released, the cnMIPS II core will 1938c2ecf20Sopenharmony_ci * always release a given PAUSE instruction within 1948c2ecf20Sopenharmony_ci * 2(8+PAUSETIME). If the counter trip happens to line up, 1958c2ecf20Sopenharmony_ci * the cnMIPS II core may release the PAUSE instantly. */ 1968c2ecf20Sopenharmony_ci __BITFIELD_FIELD(uint64_t pausetime:3, 1978c2ecf20Sopenharmony_ci /* OCTEON II - This field is an extension of 1988c2ecf20Sopenharmony_ci * CvmMemCtl[DIDTTO] */ 1998c2ecf20Sopenharmony_ci __BITFIELD_FIELD(uint64_t didtto2:1, 2008c2ecf20Sopenharmony_ci /* R/W If set, marked write-buffer entries time out 2018c2ecf20Sopenharmony_ci * the same as other entries; if clear, marked 2028c2ecf20Sopenharmony_ci * write-buffer entries use the maximum timeout. */ 2038c2ecf20Sopenharmony_ci __BITFIELD_FIELD(uint64_t dismarkwblongto:1, 2048c2ecf20Sopenharmony_ci /* R/W If set, a merged store does not clear the 2058c2ecf20Sopenharmony_ci * write-buffer entry timeout state. */ 2068c2ecf20Sopenharmony_ci __BITFIELD_FIELD(uint64_t dismrgclrwbto:1, 2078c2ecf20Sopenharmony_ci /* R/W Two bits that are the MSBs of the resultant 2088c2ecf20Sopenharmony_ci * CVMSEG LM word location for an IOBDMA. The other 8 2098c2ecf20Sopenharmony_ci * bits come from the SCRADDR field of the IOBDMA. */ 2108c2ecf20Sopenharmony_ci __BITFIELD_FIELD(uint64_t iobdmascrmsb:2, 2118c2ecf20Sopenharmony_ci /* R/W If set, SYNCWS and SYNCS only order marked 2128c2ecf20Sopenharmony_ci * stores; if clear, SYNCWS and SYNCS only order 2138c2ecf20Sopenharmony_ci * unmarked stores. SYNCWSMARKED has no effect when 2148c2ecf20Sopenharmony_ci * DISSYNCWS is set. */ 2158c2ecf20Sopenharmony_ci __BITFIELD_FIELD(uint64_t syncwsmarked:1, 2168c2ecf20Sopenharmony_ci /* R/W If set, SYNCWS acts as SYNCW and SYNCS acts as 2178c2ecf20Sopenharmony_ci * SYNC. */ 2188c2ecf20Sopenharmony_ci __BITFIELD_FIELD(uint64_t dissyncws:1, 2198c2ecf20Sopenharmony_ci /* R/W If set, no stall happens on write buffer 2208c2ecf20Sopenharmony_ci * full. */ 2218c2ecf20Sopenharmony_ci __BITFIELD_FIELD(uint64_t diswbfst:1, 2228c2ecf20Sopenharmony_ci /* R/W If set (and SX set), supervisor-level 2238c2ecf20Sopenharmony_ci * loads/stores can use XKPHYS addresses with 2248c2ecf20Sopenharmony_ci * VA<48>==0 */ 2258c2ecf20Sopenharmony_ci __BITFIELD_FIELD(uint64_t xkmemenas:1, 2268c2ecf20Sopenharmony_ci /* R/W If set (and UX set), user-level loads/stores 2278c2ecf20Sopenharmony_ci * can use XKPHYS addresses with VA<48>==0 */ 2288c2ecf20Sopenharmony_ci __BITFIELD_FIELD(uint64_t xkmemenau:1, 2298c2ecf20Sopenharmony_ci /* R/W If set (and SX set), supervisor-level 2308c2ecf20Sopenharmony_ci * loads/stores can use XKPHYS addresses with 2318c2ecf20Sopenharmony_ci * VA<48>==1 */ 2328c2ecf20Sopenharmony_ci __BITFIELD_FIELD(uint64_t xkioenas:1, 2338c2ecf20Sopenharmony_ci /* R/W If set (and UX set), user-level loads/stores 2348c2ecf20Sopenharmony_ci * can use XKPHYS addresses with VA<48>==1 */ 2358c2ecf20Sopenharmony_ci __BITFIELD_FIELD(uint64_t xkioenau:1, 2368c2ecf20Sopenharmony_ci /* R/W If set, all stores act as SYNCW (NOMERGE must 2378c2ecf20Sopenharmony_ci * be set when this is set) RW, reset to 0. */ 2388c2ecf20Sopenharmony_ci __BITFIELD_FIELD(uint64_t allsyncw:1, 2398c2ecf20Sopenharmony_ci /* R/W If set, no stores merge, and all stores reach 2408c2ecf20Sopenharmony_ci * the coherent bus in order. */ 2418c2ecf20Sopenharmony_ci __BITFIELD_FIELD(uint64_t nomerge:1, 2428c2ecf20Sopenharmony_ci /* R/W Selects the bit in the counter used for DID 2438c2ecf20Sopenharmony_ci * time-outs 0 = 231, 1 = 230, 2 = 229, 3 = 2448c2ecf20Sopenharmony_ci * 214. Actual time-out is between 1x and 2x this 2458c2ecf20Sopenharmony_ci * interval. For example, with DIDTTO=3, expiration 2468c2ecf20Sopenharmony_ci * interval is between 16K and 32K. */ 2478c2ecf20Sopenharmony_ci __BITFIELD_FIELD(uint64_t didtto:2, 2488c2ecf20Sopenharmony_ci /* R/W If set, the (mem) CSR clock never turns off. */ 2498c2ecf20Sopenharmony_ci __BITFIELD_FIELD(uint64_t csrckalwys:1, 2508c2ecf20Sopenharmony_ci /* R/W If set, mclk never turns off. */ 2518c2ecf20Sopenharmony_ci __BITFIELD_FIELD(uint64_t mclkalwys:1, 2528c2ecf20Sopenharmony_ci /* R/W Selects the bit in the counter used for write 2538c2ecf20Sopenharmony_ci * buffer flush time-outs (WBFLT+11) is the bit 2548c2ecf20Sopenharmony_ci * position in an internal counter used to determine 2558c2ecf20Sopenharmony_ci * expiration. The write buffer expires between 1x and 2568c2ecf20Sopenharmony_ci * 2x this interval. For example, with WBFLT = 0, a 2578c2ecf20Sopenharmony_ci * write buffer expires between 2K and 4K cycles after 2588c2ecf20Sopenharmony_ci * the write buffer entry is allocated. */ 2598c2ecf20Sopenharmony_ci __BITFIELD_FIELD(uint64_t wbfltime:3, 2608c2ecf20Sopenharmony_ci /* R/W If set, do not put Istream in the L2 cache. */ 2618c2ecf20Sopenharmony_ci __BITFIELD_FIELD(uint64_t istrnol2:1, 2628c2ecf20Sopenharmony_ci /* R/W The write buffer threshold. */ 2638c2ecf20Sopenharmony_ci __BITFIELD_FIELD(uint64_t wbthresh:4, 2648c2ecf20Sopenharmony_ci /* Reserved */ 2658c2ecf20Sopenharmony_ci __BITFIELD_FIELD(uint64_t reserved2:2, 2668c2ecf20Sopenharmony_ci /* R/W If set, CVMSEG is available for loads/stores in 2678c2ecf20Sopenharmony_ci * kernel/debug mode. */ 2688c2ecf20Sopenharmony_ci __BITFIELD_FIELD(uint64_t cvmsegenak:1, 2698c2ecf20Sopenharmony_ci /* R/W If set, CVMSEG is available for loads/stores in 2708c2ecf20Sopenharmony_ci * supervisor mode. */ 2718c2ecf20Sopenharmony_ci __BITFIELD_FIELD(uint64_t cvmsegenas:1, 2728c2ecf20Sopenharmony_ci /* R/W If set, CVMSEG is available for loads/stores in 2738c2ecf20Sopenharmony_ci * user mode. */ 2748c2ecf20Sopenharmony_ci __BITFIELD_FIELD(uint64_t cvmsegenau:1, 2758c2ecf20Sopenharmony_ci /* R/W Size of local memory in cache blocks, 54 (6912 2768c2ecf20Sopenharmony_ci * bytes) is max legal value. */ 2778c2ecf20Sopenharmony_ci __BITFIELD_FIELD(uint64_t lmemsz:6, 2788c2ecf20Sopenharmony_ci ;))))))))))))))))))))))))))))))))) 2798c2ecf20Sopenharmony_ci } s; 2808c2ecf20Sopenharmony_ci}; 2818c2ecf20Sopenharmony_ci 2828c2ecf20Sopenharmony_ciextern void octeon_check_cpu_bist(void); 2838c2ecf20Sopenharmony_ci 2848c2ecf20Sopenharmony_ciint octeon_prune_device_tree(void); 2858c2ecf20Sopenharmony_ciextern const char __appended_dtb; 2868c2ecf20Sopenharmony_ciextern const char __dtb_octeon_3xxx_begin; 2878c2ecf20Sopenharmony_ciextern const char __dtb_octeon_68xx_begin; 2888c2ecf20Sopenharmony_ci 2898c2ecf20Sopenharmony_ci/** 2908c2ecf20Sopenharmony_ci * Write a 32bit value to the Octeon NPI register space 2918c2ecf20Sopenharmony_ci * 2928c2ecf20Sopenharmony_ci * @address: Address to write to 2938c2ecf20Sopenharmony_ci * @val: Value to write 2948c2ecf20Sopenharmony_ci */ 2958c2ecf20Sopenharmony_cistatic inline void octeon_npi_write32(uint64_t address, uint32_t val) 2968c2ecf20Sopenharmony_ci{ 2978c2ecf20Sopenharmony_ci cvmx_write64_uint32(address ^ 4, val); 2988c2ecf20Sopenharmony_ci cvmx_read64_uint32(address ^ 4); 2998c2ecf20Sopenharmony_ci} 3008c2ecf20Sopenharmony_ci 3018c2ecf20Sopenharmony_ci#ifdef CONFIG_SMP 3028c2ecf20Sopenharmony_civoid octeon_setup_smp(void); 3038c2ecf20Sopenharmony_ci#else 3048c2ecf20Sopenharmony_cistatic inline void octeon_setup_smp(void) {} 3058c2ecf20Sopenharmony_ci#endif 3068c2ecf20Sopenharmony_ci 3078c2ecf20Sopenharmony_cistruct irq_domain; 3088c2ecf20Sopenharmony_cistruct device_node; 3098c2ecf20Sopenharmony_cistruct irq_data; 3108c2ecf20Sopenharmony_cistruct irq_chip; 3118c2ecf20Sopenharmony_civoid octeon_ciu3_mbox_send(int cpu, unsigned int mbox); 3128c2ecf20Sopenharmony_ciint octeon_irq_ciu3_xlat(struct irq_domain *d, 3138c2ecf20Sopenharmony_ci struct device_node *node, 3148c2ecf20Sopenharmony_ci const u32 *intspec, 3158c2ecf20Sopenharmony_ci unsigned int intsize, 3168c2ecf20Sopenharmony_ci unsigned long *out_hwirq, 3178c2ecf20Sopenharmony_ci unsigned int *out_type); 3188c2ecf20Sopenharmony_civoid octeon_irq_ciu3_enable(struct irq_data *data); 3198c2ecf20Sopenharmony_civoid octeon_irq_ciu3_disable(struct irq_data *data); 3208c2ecf20Sopenharmony_civoid octeon_irq_ciu3_ack(struct irq_data *data); 3218c2ecf20Sopenharmony_civoid octeon_irq_ciu3_mask(struct irq_data *data); 3228c2ecf20Sopenharmony_civoid octeon_irq_ciu3_mask_ack(struct irq_data *data); 3238c2ecf20Sopenharmony_ciint octeon_irq_ciu3_mapx(struct irq_domain *d, unsigned int virq, 3248c2ecf20Sopenharmony_ci irq_hw_number_t hw, struct irq_chip *chip); 3258c2ecf20Sopenharmony_ci 3268c2ecf20Sopenharmony_ci/* Octeon multiplier save/restore routines from octeon_switch.S */ 3278c2ecf20Sopenharmony_civoid octeon_mult_save(void); 3288c2ecf20Sopenharmony_civoid octeon_mult_restore(void); 3298c2ecf20Sopenharmony_civoid octeon_mult_save_end(void); 3308c2ecf20Sopenharmony_civoid octeon_mult_restore_end(void); 3318c2ecf20Sopenharmony_civoid octeon_mult_save3(void); 3328c2ecf20Sopenharmony_civoid octeon_mult_save3_end(void); 3338c2ecf20Sopenharmony_civoid octeon_mult_save2(void); 3348c2ecf20Sopenharmony_civoid octeon_mult_save2_end(void); 3358c2ecf20Sopenharmony_civoid octeon_mult_restore3(void); 3368c2ecf20Sopenharmony_civoid octeon_mult_restore3_end(void); 3378c2ecf20Sopenharmony_civoid octeon_mult_restore2(void); 3388c2ecf20Sopenharmony_civoid octeon_mult_restore2_end(void); 3398c2ecf20Sopenharmony_ci 3408c2ecf20Sopenharmony_ci/** 3418c2ecf20Sopenharmony_ci * Read a 32bit value from the Octeon NPI register space 3428c2ecf20Sopenharmony_ci * 3438c2ecf20Sopenharmony_ci * @address: Address to read 3448c2ecf20Sopenharmony_ci * Returns The result 3458c2ecf20Sopenharmony_ci */ 3468c2ecf20Sopenharmony_cistatic inline uint32_t octeon_npi_read32(uint64_t address) 3478c2ecf20Sopenharmony_ci{ 3488c2ecf20Sopenharmony_ci return cvmx_read64_uint32(address ^ 4); 3498c2ecf20Sopenharmony_ci} 3508c2ecf20Sopenharmony_ci 3518c2ecf20Sopenharmony_ciextern struct cvmx_bootinfo *octeon_bootinfo; 3528c2ecf20Sopenharmony_ci 3538c2ecf20Sopenharmony_ciextern uint64_t octeon_bootloader_entry_addr; 3548c2ecf20Sopenharmony_ci 3558c2ecf20Sopenharmony_ciextern void (*octeon_irq_setup_secondary)(void); 3568c2ecf20Sopenharmony_ci 3578c2ecf20Sopenharmony_citypedef void (*octeon_irq_ip4_handler_t)(void); 3588c2ecf20Sopenharmony_civoid octeon_irq_set_ip4_handler(octeon_irq_ip4_handler_t); 3598c2ecf20Sopenharmony_ci 3608c2ecf20Sopenharmony_ciextern void octeon_fixup_irqs(void); 3618c2ecf20Sopenharmony_ci 3628c2ecf20Sopenharmony_ciextern struct semaphore octeon_bootbus_sem; 3638c2ecf20Sopenharmony_ci 3648c2ecf20Sopenharmony_cistruct irq_domain *octeon_irq_get_block_domain(int node, uint8_t block); 3658c2ecf20Sopenharmony_ci 3668c2ecf20Sopenharmony_ci#endif /* __ASM_OCTEON_OCTEON_H */ 367