162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public
362306a36Sopenharmony_ci * License.  See the file "COPYING" in the main directory of this archive
462306a36Sopenharmony_ci * for more details.
562306a36Sopenharmony_ci *
662306a36Sopenharmony_ci * Copyright (C) 2004-2008 Cavium Networks
762306a36Sopenharmony_ci */
862306a36Sopenharmony_ci#ifndef __ASM_OCTEON_OCTEON_H
962306a36Sopenharmony_ci#define __ASM_OCTEON_OCTEON_H
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci#include <asm/octeon/cvmx.h>
1262306a36Sopenharmony_ci#include <asm/bitfield.h>
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ciextern uint64_t octeon_bootmem_alloc_range_phys(uint64_t size,
1562306a36Sopenharmony_ci						uint64_t alignment,
1662306a36Sopenharmony_ci						uint64_t min_addr,
1762306a36Sopenharmony_ci						uint64_t max_addr,
1862306a36Sopenharmony_ci						int do_locking);
1962306a36Sopenharmony_ciextern void *octeon_bootmem_alloc(uint64_t size, uint64_t alignment,
2062306a36Sopenharmony_ci				  int do_locking);
2162306a36Sopenharmony_ciextern void *octeon_bootmem_alloc_range(uint64_t size, uint64_t alignment,
2262306a36Sopenharmony_ci					uint64_t min_addr, uint64_t max_addr,
2362306a36Sopenharmony_ci					int do_locking);
2462306a36Sopenharmony_ciextern void *octeon_bootmem_alloc_named(uint64_t size, uint64_t alignment,
2562306a36Sopenharmony_ci					char *name);
2662306a36Sopenharmony_ciextern void *octeon_bootmem_alloc_named_range(uint64_t size, uint64_t min_addr,
2762306a36Sopenharmony_ci					      uint64_t max_addr, uint64_t align,
2862306a36Sopenharmony_ci					      char *name);
2962306a36Sopenharmony_ciextern void *octeon_bootmem_alloc_named_address(uint64_t size, uint64_t address,
3062306a36Sopenharmony_ci						char *name);
3162306a36Sopenharmony_ciextern int octeon_bootmem_free_named(char *name);
3262306a36Sopenharmony_ciextern void octeon_bootmem_lock(void);
3362306a36Sopenharmony_ciextern void octeon_bootmem_unlock(void);
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ciextern int octeon_is_simulation(void);
3662306a36Sopenharmony_ciextern int octeon_is_pci_host(void);
3762306a36Sopenharmony_ciextern int octeon_usb_is_ref_clk(void);
3862306a36Sopenharmony_ciextern uint64_t octeon_get_clock_rate(void);
3962306a36Sopenharmony_ciextern u64 octeon_get_io_clock_rate(void);
4062306a36Sopenharmony_ciextern const char *octeon_board_type_string(void);
4162306a36Sopenharmony_ciextern const char *octeon_get_pci_interrupts(void);
4262306a36Sopenharmony_ciextern int octeon_get_southbridge_interrupt(void);
4362306a36Sopenharmony_ciextern int octeon_get_boot_coremask(void);
4462306a36Sopenharmony_ciextern int octeon_get_boot_num_arguments(void);
4562306a36Sopenharmony_ciextern const char *octeon_get_boot_argument(int arg);
4662306a36Sopenharmony_ciextern void octeon_user_io_init(void);
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_ciextern void octeon_init_cvmcount(void);
4962306a36Sopenharmony_ciextern void octeon_setup_delays(void);
5062306a36Sopenharmony_ciextern void octeon_io_clk_delay(unsigned long);
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ci#define OCTEON_ARGV_MAX_ARGS	64
5362306a36Sopenharmony_ci#define OCTEON_SERIAL_LEN	20
5462306a36Sopenharmony_ci
5562306a36Sopenharmony_cistruct octeon_boot_descriptor {
5662306a36Sopenharmony_ci#ifdef __BIG_ENDIAN_BITFIELD
5762306a36Sopenharmony_ci	/* Start of block referenced by assembly code - do not change! */
5862306a36Sopenharmony_ci	uint32_t desc_version;
5962306a36Sopenharmony_ci	uint32_t desc_size;
6062306a36Sopenharmony_ci	uint64_t stack_top;
6162306a36Sopenharmony_ci	uint64_t heap_base;
6262306a36Sopenharmony_ci	uint64_t heap_end;
6362306a36Sopenharmony_ci	/* Only used by bootloader */
6462306a36Sopenharmony_ci	uint64_t entry_point;
6562306a36Sopenharmony_ci	uint64_t desc_vaddr;
6662306a36Sopenharmony_ci	/* End of This block referenced by assembly code - do not change! */
6762306a36Sopenharmony_ci	uint32_t exception_base_addr;
6862306a36Sopenharmony_ci	uint32_t stack_size;
6962306a36Sopenharmony_ci	uint32_t heap_size;
7062306a36Sopenharmony_ci	/* Argc count for application. */
7162306a36Sopenharmony_ci	uint32_t argc;
7262306a36Sopenharmony_ci	uint32_t argv[OCTEON_ARGV_MAX_ARGS];
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_ci#define	 BOOT_FLAG_INIT_CORE		(1 << 0)
7562306a36Sopenharmony_ci#define	 OCTEON_BL_FLAG_DEBUG		(1 << 1)
7662306a36Sopenharmony_ci#define	 OCTEON_BL_FLAG_NO_MAGIC	(1 << 2)
7762306a36Sopenharmony_ci	/* If set, use uart1 for console */
7862306a36Sopenharmony_ci#define	 OCTEON_BL_FLAG_CONSOLE_UART1	(1 << 3)
7962306a36Sopenharmony_ci	/* If set, use PCI console */
8062306a36Sopenharmony_ci#define	 OCTEON_BL_FLAG_CONSOLE_PCI	(1 << 4)
8162306a36Sopenharmony_ci	/* Call exit on break on serial port */
8262306a36Sopenharmony_ci#define	 OCTEON_BL_FLAG_BREAK		(1 << 5)
8362306a36Sopenharmony_ci
8462306a36Sopenharmony_ci	uint32_t flags;
8562306a36Sopenharmony_ci	uint32_t core_mask;
8662306a36Sopenharmony_ci	/* DRAM size in megabyes. */
8762306a36Sopenharmony_ci	uint32_t dram_size;
8862306a36Sopenharmony_ci	/* physical address of free memory descriptor block. */
8962306a36Sopenharmony_ci	uint32_t phy_mem_desc_addr;
9062306a36Sopenharmony_ci	/* used to pass flags from app to debugger. */
9162306a36Sopenharmony_ci	uint32_t debugger_flags_base_addr;
9262306a36Sopenharmony_ci	/* CPU clock speed, in hz. */
9362306a36Sopenharmony_ci	uint32_t eclock_hz;
9462306a36Sopenharmony_ci	/* DRAM clock speed, in hz. */
9562306a36Sopenharmony_ci	uint32_t dclock_hz;
9662306a36Sopenharmony_ci	/* SPI4 clock in hz. */
9762306a36Sopenharmony_ci	uint32_t spi_clock_hz;
9862306a36Sopenharmony_ci	uint16_t board_type;
9962306a36Sopenharmony_ci	uint8_t board_rev_major;
10062306a36Sopenharmony_ci	uint8_t board_rev_minor;
10162306a36Sopenharmony_ci	uint16_t chip_type;
10262306a36Sopenharmony_ci	uint8_t chip_rev_major;
10362306a36Sopenharmony_ci	uint8_t chip_rev_minor;
10462306a36Sopenharmony_ci	char board_serial_number[OCTEON_SERIAL_LEN];
10562306a36Sopenharmony_ci	uint8_t mac_addr_base[6];
10662306a36Sopenharmony_ci	uint8_t mac_addr_count;
10762306a36Sopenharmony_ci	uint64_t cvmx_desc_vaddr;
10862306a36Sopenharmony_ci#else
10962306a36Sopenharmony_ci	uint32_t desc_size;
11062306a36Sopenharmony_ci	uint32_t desc_version;
11162306a36Sopenharmony_ci	uint64_t stack_top;
11262306a36Sopenharmony_ci	uint64_t heap_base;
11362306a36Sopenharmony_ci	uint64_t heap_end;
11462306a36Sopenharmony_ci	/* Only used by bootloader */
11562306a36Sopenharmony_ci	uint64_t entry_point;
11662306a36Sopenharmony_ci	uint64_t desc_vaddr;
11762306a36Sopenharmony_ci	/* End of This block referenced by assembly code - do not change! */
11862306a36Sopenharmony_ci	uint32_t stack_size;
11962306a36Sopenharmony_ci	uint32_t exception_base_addr;
12062306a36Sopenharmony_ci	uint32_t argc;
12162306a36Sopenharmony_ci	uint32_t heap_size;
12262306a36Sopenharmony_ci	/*
12362306a36Sopenharmony_ci	 * Argc count for application.
12462306a36Sopenharmony_ci	 * Warning low bit scrambled in little-endian.
12562306a36Sopenharmony_ci	 */
12662306a36Sopenharmony_ci	uint32_t argv[OCTEON_ARGV_MAX_ARGS];
12762306a36Sopenharmony_ci
12862306a36Sopenharmony_ci#define  BOOT_FLAG_INIT_CORE		(1 << 0)
12962306a36Sopenharmony_ci#define  OCTEON_BL_FLAG_DEBUG		(1 << 1)
13062306a36Sopenharmony_ci#define  OCTEON_BL_FLAG_NO_MAGIC	(1 << 2)
13162306a36Sopenharmony_ci	/* If set, use uart1 for console */
13262306a36Sopenharmony_ci#define  OCTEON_BL_FLAG_CONSOLE_UART1	(1 << 3)
13362306a36Sopenharmony_ci	/* If set, use PCI console */
13462306a36Sopenharmony_ci#define  OCTEON_BL_FLAG_CONSOLE_PCI	(1 << 4)
13562306a36Sopenharmony_ci	/* Call exit on break on serial port */
13662306a36Sopenharmony_ci#define  OCTEON_BL_FLAG_BREAK		(1 << 5)
13762306a36Sopenharmony_ci
13862306a36Sopenharmony_ci	uint32_t core_mask;
13962306a36Sopenharmony_ci	uint32_t flags;
14062306a36Sopenharmony_ci	/* physical address of free memory descriptor block. */
14162306a36Sopenharmony_ci	uint32_t phy_mem_desc_addr;
14262306a36Sopenharmony_ci	/* DRAM size in megabyes. */
14362306a36Sopenharmony_ci	uint32_t dram_size;
14462306a36Sopenharmony_ci	/* CPU clock speed, in hz. */
14562306a36Sopenharmony_ci	uint32_t eclock_hz;
14662306a36Sopenharmony_ci	/* used to pass flags from app to debugger. */
14762306a36Sopenharmony_ci	uint32_t debugger_flags_base_addr;
14862306a36Sopenharmony_ci	/* SPI4 clock in hz. */
14962306a36Sopenharmony_ci	uint32_t spi_clock_hz;
15062306a36Sopenharmony_ci	/* DRAM clock speed, in hz. */
15162306a36Sopenharmony_ci	uint32_t dclock_hz;
15262306a36Sopenharmony_ci	uint8_t chip_rev_minor;
15362306a36Sopenharmony_ci	uint8_t chip_rev_major;
15462306a36Sopenharmony_ci	uint16_t chip_type;
15562306a36Sopenharmony_ci	uint8_t board_rev_minor;
15662306a36Sopenharmony_ci	uint8_t board_rev_major;
15762306a36Sopenharmony_ci	uint16_t board_type;
15862306a36Sopenharmony_ci
15962306a36Sopenharmony_ci	uint64_t unused1[4]; /* Not even filled in by bootloader. */
16062306a36Sopenharmony_ci
16162306a36Sopenharmony_ci	uint64_t cvmx_desc_vaddr;
16262306a36Sopenharmony_ci#endif
16362306a36Sopenharmony_ci};
16462306a36Sopenharmony_ci
16562306a36Sopenharmony_ciunion octeon_cvmemctl {
16662306a36Sopenharmony_ci	uint64_t u64;
16762306a36Sopenharmony_ci	struct {
16862306a36Sopenharmony_ci		/* RO 1 = BIST fail, 0 = BIST pass */
16962306a36Sopenharmony_ci		__BITFIELD_FIELD(uint64_t tlbbist:1,
17062306a36Sopenharmony_ci		/* RO 1 = BIST fail, 0 = BIST pass */
17162306a36Sopenharmony_ci		__BITFIELD_FIELD(uint64_t l1cbist:1,
17262306a36Sopenharmony_ci		/* RO 1 = BIST fail, 0 = BIST pass */
17362306a36Sopenharmony_ci		__BITFIELD_FIELD(uint64_t l1dbist:1,
17462306a36Sopenharmony_ci		/* RO 1 = BIST fail, 0 = BIST pass */
17562306a36Sopenharmony_ci		__BITFIELD_FIELD(uint64_t dcmbist:1,
17662306a36Sopenharmony_ci		/* RO 1 = BIST fail, 0 = BIST pass */
17762306a36Sopenharmony_ci		__BITFIELD_FIELD(uint64_t ptgbist:1,
17862306a36Sopenharmony_ci		/* RO 1 = BIST fail, 0 = BIST pass */
17962306a36Sopenharmony_ci		__BITFIELD_FIELD(uint64_t wbfbist:1,
18062306a36Sopenharmony_ci		/* Reserved */
18162306a36Sopenharmony_ci		__BITFIELD_FIELD(uint64_t reserved:17,
18262306a36Sopenharmony_ci		/* OCTEON II - TLB replacement policy: 0 = bitmask LRU; 1 = NLU.
18362306a36Sopenharmony_ci		 * This field selects between the TLB replacement policies:
18462306a36Sopenharmony_ci		 * bitmask LRU or NLU. Bitmask LRU maintains a mask of
18562306a36Sopenharmony_ci		 * recently used TLB entries and avoids them as new entries
18662306a36Sopenharmony_ci		 * are allocated. NLU simply guarantees that the next
18762306a36Sopenharmony_ci		 * allocation is not the last used TLB entry. */
18862306a36Sopenharmony_ci		__BITFIELD_FIELD(uint64_t tlbnlu:1,
18962306a36Sopenharmony_ci		/* OCTEON II - Selects the bit in the counter used for
19062306a36Sopenharmony_ci		 * releasing a PAUSE. This counter trips every 2(8+PAUSETIME)
19162306a36Sopenharmony_ci		 * cycles. If not already released, the cnMIPS II core will
19262306a36Sopenharmony_ci		 * always release a given PAUSE instruction within
19362306a36Sopenharmony_ci		 * 2(8+PAUSETIME). If the counter trip happens to line up,
19462306a36Sopenharmony_ci		 * the cnMIPS II core may release the PAUSE instantly. */
19562306a36Sopenharmony_ci		__BITFIELD_FIELD(uint64_t pausetime:3,
19662306a36Sopenharmony_ci		/* OCTEON II - This field is an extension of
19762306a36Sopenharmony_ci		 * CvmMemCtl[DIDTTO] */
19862306a36Sopenharmony_ci		__BITFIELD_FIELD(uint64_t didtto2:1,
19962306a36Sopenharmony_ci		/* R/W If set, marked write-buffer entries time out
20062306a36Sopenharmony_ci		 * the same as other entries; if clear, marked
20162306a36Sopenharmony_ci		 * write-buffer entries use the maximum timeout. */
20262306a36Sopenharmony_ci		__BITFIELD_FIELD(uint64_t dismarkwblongto:1,
20362306a36Sopenharmony_ci		/* R/W If set, a merged store does not clear the
20462306a36Sopenharmony_ci		 * write-buffer entry timeout state. */
20562306a36Sopenharmony_ci		__BITFIELD_FIELD(uint64_t dismrgclrwbto:1,
20662306a36Sopenharmony_ci		/* R/W Two bits that are the MSBs of the resultant
20762306a36Sopenharmony_ci		 * CVMSEG LM word location for an IOBDMA. The other 8
20862306a36Sopenharmony_ci		 * bits come from the SCRADDR field of the IOBDMA. */
20962306a36Sopenharmony_ci		__BITFIELD_FIELD(uint64_t iobdmascrmsb:2,
21062306a36Sopenharmony_ci		/* R/W If set, SYNCWS and SYNCS only order marked
21162306a36Sopenharmony_ci		 * stores; if clear, SYNCWS and SYNCS only order
21262306a36Sopenharmony_ci		 * unmarked stores. SYNCWSMARKED has no effect when
21362306a36Sopenharmony_ci		 * DISSYNCWS is set. */
21462306a36Sopenharmony_ci		__BITFIELD_FIELD(uint64_t syncwsmarked:1,
21562306a36Sopenharmony_ci		/* R/W If set, SYNCWS acts as SYNCW and SYNCS acts as
21662306a36Sopenharmony_ci		 * SYNC. */
21762306a36Sopenharmony_ci		__BITFIELD_FIELD(uint64_t dissyncws:1,
21862306a36Sopenharmony_ci		/* R/W If set, no stall happens on write buffer
21962306a36Sopenharmony_ci		 * full. */
22062306a36Sopenharmony_ci		__BITFIELD_FIELD(uint64_t diswbfst:1,
22162306a36Sopenharmony_ci		/* R/W If set (and SX set), supervisor-level
22262306a36Sopenharmony_ci		 * loads/stores can use XKPHYS addresses with
22362306a36Sopenharmony_ci		 * VA<48>==0 */
22462306a36Sopenharmony_ci		__BITFIELD_FIELD(uint64_t xkmemenas:1,
22562306a36Sopenharmony_ci		/* R/W If set (and UX set), user-level loads/stores
22662306a36Sopenharmony_ci		 * can use XKPHYS addresses with VA<48>==0 */
22762306a36Sopenharmony_ci		__BITFIELD_FIELD(uint64_t xkmemenau:1,
22862306a36Sopenharmony_ci		/* R/W If set (and SX set), supervisor-level
22962306a36Sopenharmony_ci		 * loads/stores can use XKPHYS addresses with
23062306a36Sopenharmony_ci		 * VA<48>==1 */
23162306a36Sopenharmony_ci		__BITFIELD_FIELD(uint64_t xkioenas:1,
23262306a36Sopenharmony_ci		/* R/W If set (and UX set), user-level loads/stores
23362306a36Sopenharmony_ci		 * can use XKPHYS addresses with VA<48>==1 */
23462306a36Sopenharmony_ci		__BITFIELD_FIELD(uint64_t xkioenau:1,
23562306a36Sopenharmony_ci		/* R/W If set, all stores act as SYNCW (NOMERGE must
23662306a36Sopenharmony_ci		 * be set when this is set) RW, reset to 0. */
23762306a36Sopenharmony_ci		__BITFIELD_FIELD(uint64_t allsyncw:1,
23862306a36Sopenharmony_ci		/* R/W If set, no stores merge, and all stores reach
23962306a36Sopenharmony_ci		 * the coherent bus in order. */
24062306a36Sopenharmony_ci		__BITFIELD_FIELD(uint64_t nomerge:1,
24162306a36Sopenharmony_ci		/* R/W Selects the bit in the counter used for DID
24262306a36Sopenharmony_ci		 * time-outs 0 = 231, 1 = 230, 2 = 229, 3 =
24362306a36Sopenharmony_ci		 * 214. Actual time-out is between 1x and 2x this
24462306a36Sopenharmony_ci		 * interval. For example, with DIDTTO=3, expiration
24562306a36Sopenharmony_ci		 * interval is between 16K and 32K. */
24662306a36Sopenharmony_ci		__BITFIELD_FIELD(uint64_t didtto:2,
24762306a36Sopenharmony_ci		/* R/W If set, the (mem) CSR clock never turns off. */
24862306a36Sopenharmony_ci		__BITFIELD_FIELD(uint64_t csrckalwys:1,
24962306a36Sopenharmony_ci		/* R/W If set, mclk never turns off. */
25062306a36Sopenharmony_ci		__BITFIELD_FIELD(uint64_t mclkalwys:1,
25162306a36Sopenharmony_ci		/* R/W Selects the bit in the counter used for write
25262306a36Sopenharmony_ci		 * buffer flush time-outs (WBFLT+11) is the bit
25362306a36Sopenharmony_ci		 * position in an internal counter used to determine
25462306a36Sopenharmony_ci		 * expiration. The write buffer expires between 1x and
25562306a36Sopenharmony_ci		 * 2x this interval. For example, with WBFLT = 0, a
25662306a36Sopenharmony_ci		 * write buffer expires between 2K and 4K cycles after
25762306a36Sopenharmony_ci		 * the write buffer entry is allocated. */
25862306a36Sopenharmony_ci		__BITFIELD_FIELD(uint64_t wbfltime:3,
25962306a36Sopenharmony_ci		/* R/W If set, do not put Istream in the L2 cache. */
26062306a36Sopenharmony_ci		__BITFIELD_FIELD(uint64_t istrnol2:1,
26162306a36Sopenharmony_ci		/* R/W The write buffer threshold. */
26262306a36Sopenharmony_ci		__BITFIELD_FIELD(uint64_t wbthresh:4,
26362306a36Sopenharmony_ci		/* Reserved */
26462306a36Sopenharmony_ci		__BITFIELD_FIELD(uint64_t reserved2:2,
26562306a36Sopenharmony_ci		/* R/W If set, CVMSEG is available for loads/stores in
26662306a36Sopenharmony_ci		 * kernel/debug mode. */
26762306a36Sopenharmony_ci		__BITFIELD_FIELD(uint64_t cvmsegenak:1,
26862306a36Sopenharmony_ci		/* R/W If set, CVMSEG is available for loads/stores in
26962306a36Sopenharmony_ci		 * supervisor mode. */
27062306a36Sopenharmony_ci		__BITFIELD_FIELD(uint64_t cvmsegenas:1,
27162306a36Sopenharmony_ci		/* R/W If set, CVMSEG is available for loads/stores in
27262306a36Sopenharmony_ci		 * user mode. */
27362306a36Sopenharmony_ci		__BITFIELD_FIELD(uint64_t cvmsegenau:1,
27462306a36Sopenharmony_ci		/* R/W Size of local memory in cache blocks, 54 (6912
27562306a36Sopenharmony_ci		 * bytes) is max legal value. */
27662306a36Sopenharmony_ci		__BITFIELD_FIELD(uint64_t lmemsz:6,
27762306a36Sopenharmony_ci		;)))))))))))))))))))))))))))))))))
27862306a36Sopenharmony_ci	} s;
27962306a36Sopenharmony_ci};
28062306a36Sopenharmony_ci
28162306a36Sopenharmony_ciextern void octeon_check_cpu_bist(void);
28262306a36Sopenharmony_ci
28362306a36Sopenharmony_ciint octeon_prune_device_tree(void);
28462306a36Sopenharmony_ciextern const char __dtb_octeon_3xxx_begin;
28562306a36Sopenharmony_ciextern const char __dtb_octeon_68xx_begin;
28662306a36Sopenharmony_ci
28762306a36Sopenharmony_ci/**
28862306a36Sopenharmony_ci * Write a 32bit value to the Octeon NPI register space
28962306a36Sopenharmony_ci *
29062306a36Sopenharmony_ci * @address: Address to write to
29162306a36Sopenharmony_ci * @val:     Value to write
29262306a36Sopenharmony_ci */
29362306a36Sopenharmony_cistatic inline void octeon_npi_write32(uint64_t address, uint32_t val)
29462306a36Sopenharmony_ci{
29562306a36Sopenharmony_ci	cvmx_write64_uint32(address ^ 4, val);
29662306a36Sopenharmony_ci	cvmx_read64_uint32(address ^ 4);
29762306a36Sopenharmony_ci}
29862306a36Sopenharmony_ci
29962306a36Sopenharmony_ci#ifdef CONFIG_SMP
30062306a36Sopenharmony_civoid octeon_setup_smp(void);
30162306a36Sopenharmony_ci#else
30262306a36Sopenharmony_cistatic inline void octeon_setup_smp(void) {}
30362306a36Sopenharmony_ci#endif
30462306a36Sopenharmony_ci
30562306a36Sopenharmony_cistruct irq_domain;
30662306a36Sopenharmony_cistruct device_node;
30762306a36Sopenharmony_cistruct irq_data;
30862306a36Sopenharmony_cistruct irq_chip;
30962306a36Sopenharmony_civoid octeon_ciu3_mbox_send(int cpu, unsigned int mbox);
31062306a36Sopenharmony_ciint octeon_irq_ciu3_xlat(struct irq_domain *d,
31162306a36Sopenharmony_ci			 struct device_node *node,
31262306a36Sopenharmony_ci			 const u32 *intspec,
31362306a36Sopenharmony_ci			 unsigned int intsize,
31462306a36Sopenharmony_ci			 unsigned long *out_hwirq,
31562306a36Sopenharmony_ci			 unsigned int *out_type);
31662306a36Sopenharmony_civoid octeon_irq_ciu3_enable(struct irq_data *data);
31762306a36Sopenharmony_civoid octeon_irq_ciu3_disable(struct irq_data *data);
31862306a36Sopenharmony_civoid octeon_irq_ciu3_ack(struct irq_data *data);
31962306a36Sopenharmony_civoid octeon_irq_ciu3_mask(struct irq_data *data);
32062306a36Sopenharmony_civoid octeon_irq_ciu3_mask_ack(struct irq_data *data);
32162306a36Sopenharmony_ciint octeon_irq_ciu3_mapx(struct irq_domain *d, unsigned int virq,
32262306a36Sopenharmony_ci			 irq_hw_number_t hw, struct irq_chip *chip);
32362306a36Sopenharmony_ci
32462306a36Sopenharmony_ci/* Octeon multiplier save/restore routines from octeon_switch.S */
32562306a36Sopenharmony_civoid octeon_mult_save(void);
32662306a36Sopenharmony_civoid octeon_mult_restore(void);
32762306a36Sopenharmony_civoid octeon_mult_save_end(void);
32862306a36Sopenharmony_civoid octeon_mult_restore_end(void);
32962306a36Sopenharmony_civoid octeon_mult_save3(void);
33062306a36Sopenharmony_civoid octeon_mult_save3_end(void);
33162306a36Sopenharmony_civoid octeon_mult_save2(void);
33262306a36Sopenharmony_civoid octeon_mult_save2_end(void);
33362306a36Sopenharmony_civoid octeon_mult_restore3(void);
33462306a36Sopenharmony_civoid octeon_mult_restore3_end(void);
33562306a36Sopenharmony_civoid octeon_mult_restore2(void);
33662306a36Sopenharmony_civoid octeon_mult_restore2_end(void);
33762306a36Sopenharmony_ci
33862306a36Sopenharmony_ci/**
33962306a36Sopenharmony_ci * Read a 32bit value from the Octeon NPI register space
34062306a36Sopenharmony_ci *
34162306a36Sopenharmony_ci * @address: Address to read
34262306a36Sopenharmony_ci * Returns The result
34362306a36Sopenharmony_ci */
34462306a36Sopenharmony_cistatic inline uint32_t octeon_npi_read32(uint64_t address)
34562306a36Sopenharmony_ci{
34662306a36Sopenharmony_ci	return cvmx_read64_uint32(address ^ 4);
34762306a36Sopenharmony_ci}
34862306a36Sopenharmony_ci
34962306a36Sopenharmony_ciextern struct cvmx_bootinfo *octeon_bootinfo;
35062306a36Sopenharmony_ci
35162306a36Sopenharmony_ciextern uint64_t octeon_bootloader_entry_addr;
35262306a36Sopenharmony_ci
35362306a36Sopenharmony_ciextern void (*octeon_irq_setup_secondary)(void);
35462306a36Sopenharmony_ci
35562306a36Sopenharmony_citypedef void (*octeon_irq_ip4_handler_t)(void);
35662306a36Sopenharmony_civoid octeon_irq_set_ip4_handler(octeon_irq_ip4_handler_t);
35762306a36Sopenharmony_ci
35862306a36Sopenharmony_ciextern void octeon_fixup_irqs(void);
35962306a36Sopenharmony_ci
36062306a36Sopenharmony_ciextern struct semaphore octeon_bootbus_sem;
36162306a36Sopenharmony_ci
36262306a36Sopenharmony_cistruct irq_domain *octeon_irq_get_block_domain(int node, uint8_t block);
36362306a36Sopenharmony_ci
36462306a36Sopenharmony_ci#endif /* __ASM_OCTEON_OCTEON_H */
365