Path: blob/master/arch/powerpc/include/asm/cell-regs.h
15117 views
/*1* cbe_regs.h2*3* This file is intended to hold the various register definitions for CBE4* on-chip system devices (memory controller, IO controller, etc...)5*6* (C) Copyright IBM Corporation 2001,20067*8* Authors: Maximino Aguilar ([email protected])9* David J. Erb ([email protected])10*11* (c) 2006 Benjamin Herrenschmidt <[email protected]>, IBM Corp.12*/1314#ifndef CBE_REGS_H15#define CBE_REGS_H1617#include <asm/cell-pmu.h>1819/*20*21* Some HID register definitions22*23*/2425/* CBE specific HID0 bits */26#define HID0_CBE_THERM_WAKEUP 0x0000020000000000ul27#define HID0_CBE_SYSERR_WAKEUP 0x0000008000000000ul28#define HID0_CBE_THERM_INT_EN 0x0000000400000000ul29#define HID0_CBE_SYSERR_INT_EN 0x0000000200000000ul3031#define MAX_CBE 23233/*34*35* Pervasive unit register definitions36*37*/3839union spe_reg {40u64 val;41u8 spe[8];42};4344union ppe_spe_reg {45u64 val;46struct {47u32 ppe;48u32 spe;49};50};515253struct cbe_pmd_regs {54/* Debug Bus Control */55u64 pad_0x0000; /* 0x0000 */5657u64 group_control; /* 0x0008 */5859u8 pad_0x0010_0x00a8 [0x00a8 - 0x0010]; /* 0x0010 */6061u64 debug_bus_control; /* 0x00a8 */6263u8 pad_0x00b0_0x0100 [0x0100 - 0x00b0]; /* 0x00b0 */6465u64 trace_aux_data; /* 0x0100 */66u64 trace_buffer_0_63; /* 0x0108 */67u64 trace_buffer_64_127; /* 0x0110 */68u64 trace_address; /* 0x0118 */69u64 ext_tr_timer; /* 0x0120 */7071u8 pad_0x0128_0x0400 [0x0400 - 0x0128]; /* 0x0128 */7273/* Performance Monitor */74u64 pm_status; /* 0x0400 */75u64 pm_control; /* 0x0408 */76u64 pm_interval; /* 0x0410 */77u64 pm_ctr[4]; /* 0x0418 */78u64 pm_start_stop; /* 0x0438 */79u64 pm07_control[8]; /* 0x0440 */8081u8 pad_0x0480_0x0800 [0x0800 - 0x0480]; /* 0x0480 */8283/* Thermal Sensor Registers */84union spe_reg ts_ctsr1; /* 0x0800 */85u64 ts_ctsr2; /* 0x0808 */86union spe_reg ts_mtsr1; /* 0x0810 */87u64 ts_mtsr2; /* 0x0818 */88union spe_reg ts_itr1; /* 0x0820 */89u64 ts_itr2; /* 0x0828 */90u64 ts_gitr; /* 0x0830 */91u64 ts_isr; /* 0x0838 */92u64 ts_imr; /* 0x0840 */93union spe_reg tm_cr1; /* 0x0848 */94u64 tm_cr2; /* 0x0850 */95u64 tm_simr; /* 0x0858 */96union ppe_spe_reg tm_tpr; /* 0x0860 */97union spe_reg tm_str1; /* 0x0868 */98u64 tm_str2; /* 0x0870 */99union ppe_spe_reg tm_tsr; /* 0x0878 */100101/* Power Management */102u64 pmcr; /* 0x0880 */103#define CBE_PMD_PAUSE_ZERO_CONTROL 0x10000104u64 pmsr; /* 0x0888 */105106/* Time Base Register */107u64 tbr; /* 0x0890 */108109u8 pad_0x0898_0x0c00 [0x0c00 - 0x0898]; /* 0x0898 */110111/* Fault Isolation Registers */112u64 checkstop_fir; /* 0x0c00 */113u64 recoverable_fir; /* 0x0c08 */114u64 spec_att_mchk_fir; /* 0x0c10 */115u32 fir_mode_reg; /* 0x0c18 */116u8 pad_0x0c1c_0x0c20 [4]; /* 0x0c1c */117#define CBE_PMD_FIR_MODE_M8 0x00800118u64 fir_enable_mask; /* 0x0c20 */119120u8 pad_0x0c28_0x0ca8 [0x0ca8 - 0x0c28]; /* 0x0c28 */121u64 ras_esc_0; /* 0x0ca8 */122u8 pad_0x0cb0_0x1000 [0x1000 - 0x0cb0]; /* 0x0cb0 */123};124125extern struct cbe_pmd_regs __iomem *cbe_get_pmd_regs(struct device_node *np);126extern struct cbe_pmd_regs __iomem *cbe_get_cpu_pmd_regs(int cpu);127128/*129* PMU shadow registers130*131* Many of the registers in the performance monitoring unit are write-only,132* so we need to save a copy of what we write to those registers.133*134* The actual data counters are read/write. However, writing to the counters135* only takes effect if the PMU is enabled. Otherwise the value is stored in136* a hardware latch until the next time the PMU is enabled. So we save a copy137* of the counter values if we need to read them back while the PMU is138* disabled. The counter_value_in_latch field is a bitmap indicating which139* counters currently have a value waiting to be written.140*/141142struct cbe_pmd_shadow_regs {143u32 group_control;144u32 debug_bus_control;145u32 trace_address;146u32 ext_tr_timer;147u32 pm_status;148u32 pm_control;149u32 pm_interval;150u32 pm_start_stop;151u32 pm07_control[NR_CTRS];152153u32 pm_ctr[NR_PHYS_CTRS];154u32 counter_value_in_latch;155};156157extern struct cbe_pmd_shadow_regs *cbe_get_pmd_shadow_regs(struct device_node *np);158extern struct cbe_pmd_shadow_regs *cbe_get_cpu_pmd_shadow_regs(int cpu);159160/*161*162* IIC unit register definitions163*164*/165166struct cbe_iic_pending_bits {167u32 data;168u8 flags;169u8 class;170u8 source;171u8 prio;172};173174#define CBE_IIC_IRQ_VALID 0x80175#define CBE_IIC_IRQ_IPI 0x40176177struct cbe_iic_thread_regs {178struct cbe_iic_pending_bits pending;179struct cbe_iic_pending_bits pending_destr;180u64 generate;181u64 prio;182};183184struct cbe_iic_regs {185u8 pad_0x0000_0x0400[0x0400 - 0x0000]; /* 0x0000 */186187/* IIC interrupt registers */188struct cbe_iic_thread_regs thread[2]; /* 0x0400 */189190u64 iic_ir; /* 0x0440 */191#define CBE_IIC_IR_PRIO(x) (((x) & 0xf) << 12)192#define CBE_IIC_IR_DEST_NODE(x) (((x) & 0xf) << 4)193#define CBE_IIC_IR_DEST_UNIT(x) ((x) & 0xf)194#define CBE_IIC_IR_IOC_0 0x0195#define CBE_IIC_IR_IOC_1S 0xb196#define CBE_IIC_IR_PT_0 0xe197#define CBE_IIC_IR_PT_1 0xf198199u64 iic_is; /* 0x0448 */200#define CBE_IIC_IS_PMI 0x2201202u8 pad_0x0450_0x0500[0x0500 - 0x0450]; /* 0x0450 */203204/* IOC FIR */205u64 ioc_fir_reset; /* 0x0500 */206u64 ioc_fir_set; /* 0x0508 */207u64 ioc_checkstop_enable; /* 0x0510 */208u64 ioc_fir_error_mask; /* 0x0518 */209u64 ioc_syserr_enable; /* 0x0520 */210u64 ioc_fir; /* 0x0528 */211212u8 pad_0x0530_0x1000[0x1000 - 0x0530]; /* 0x0530 */213};214215extern struct cbe_iic_regs __iomem *cbe_get_iic_regs(struct device_node *np);216extern struct cbe_iic_regs __iomem *cbe_get_cpu_iic_regs(int cpu);217218219struct cbe_mic_tm_regs {220u8 pad_0x0000_0x0040[0x0040 - 0x0000]; /* 0x0000 */221222u64 mic_ctl_cnfg2; /* 0x0040 */223#define CBE_MIC_ENABLE_AUX_TRC 0x8000000000000000LL224#define CBE_MIC_DISABLE_PWR_SAV_2 0x0200000000000000LL225#define CBE_MIC_DISABLE_AUX_TRC_WRAP 0x0100000000000000LL226#define CBE_MIC_ENABLE_AUX_TRC_INT 0x0080000000000000LL227228u64 pad_0x0048; /* 0x0048 */229230u64 mic_aux_trc_base; /* 0x0050 */231u64 mic_aux_trc_max_addr; /* 0x0058 */232u64 mic_aux_trc_cur_addr; /* 0x0060 */233u64 mic_aux_trc_grf_addr; /* 0x0068 */234u64 mic_aux_trc_grf_data; /* 0x0070 */235236u64 pad_0x0078; /* 0x0078 */237238u64 mic_ctl_cnfg_0; /* 0x0080 */239#define CBE_MIC_DISABLE_PWR_SAV_0 0x8000000000000000LL240241u64 pad_0x0088; /* 0x0088 */242243u64 slow_fast_timer_0; /* 0x0090 */244u64 slow_next_timer_0; /* 0x0098 */245246u8 pad_0x00a0_0x00f8[0x00f8 - 0x00a0]; /* 0x00a0 */247u64 mic_df_ecc_address_0; /* 0x00f8 */248249u8 pad_0x0100_0x01b8[0x01b8 - 0x0100]; /* 0x0100 */250u64 mic_df_ecc_address_1; /* 0x01b8 */251252u64 mic_ctl_cnfg_1; /* 0x01c0 */253#define CBE_MIC_DISABLE_PWR_SAV_1 0x8000000000000000LL254255u64 pad_0x01c8; /* 0x01c8 */256257u64 slow_fast_timer_1; /* 0x01d0 */258u64 slow_next_timer_1; /* 0x01d8 */259260u8 pad_0x01e0_0x0208[0x0208 - 0x01e0]; /* 0x01e0 */261u64 mic_exc; /* 0x0208 */262#define CBE_MIC_EXC_BLOCK_SCRUB 0x0800000000000000ULL263#define CBE_MIC_EXC_FAST_SCRUB 0x0100000000000000ULL264265u64 mic_mnt_cfg; /* 0x0210 */266#define CBE_MIC_MNT_CFG_CHAN_0_POP 0x0002000000000000ULL267#define CBE_MIC_MNT_CFG_CHAN_1_POP 0x0004000000000000ULL268269u64 mic_df_config; /* 0x0218 */270#define CBE_MIC_ECC_DISABLE_0 0x4000000000000000ULL271#define CBE_MIC_ECC_REP_SINGLE_0 0x2000000000000000ULL272#define CBE_MIC_ECC_DISABLE_1 0x0080000000000000ULL273#define CBE_MIC_ECC_REP_SINGLE_1 0x0040000000000000ULL274275u8 pad_0x0220_0x0230[0x0230 - 0x0220]; /* 0x0220 */276u64 mic_fir; /* 0x0230 */277#define CBE_MIC_FIR_ECC_SINGLE_0_ERR 0x0200000000000000ULL278#define CBE_MIC_FIR_ECC_MULTI_0_ERR 0x0100000000000000ULL279#define CBE_MIC_FIR_ECC_SINGLE_1_ERR 0x0080000000000000ULL280#define CBE_MIC_FIR_ECC_MULTI_1_ERR 0x0040000000000000ULL281#define CBE_MIC_FIR_ECC_ERR_MASK 0xffff000000000000ULL282#define CBE_MIC_FIR_ECC_SINGLE_0_CTE 0x0000020000000000ULL283#define CBE_MIC_FIR_ECC_MULTI_0_CTE 0x0000010000000000ULL284#define CBE_MIC_FIR_ECC_SINGLE_1_CTE 0x0000008000000000ULL285#define CBE_MIC_FIR_ECC_MULTI_1_CTE 0x0000004000000000ULL286#define CBE_MIC_FIR_ECC_CTE_MASK 0x0000ffff00000000ULL287#define CBE_MIC_FIR_ECC_SINGLE_0_RESET 0x0000000002000000ULL288#define CBE_MIC_FIR_ECC_MULTI_0_RESET 0x0000000001000000ULL289#define CBE_MIC_FIR_ECC_SINGLE_1_RESET 0x0000000000800000ULL290#define CBE_MIC_FIR_ECC_MULTI_1_RESET 0x0000000000400000ULL291#define CBE_MIC_FIR_ECC_RESET_MASK 0x00000000ffff0000ULL292#define CBE_MIC_FIR_ECC_SINGLE_0_SET 0x0000000000000200ULL293#define CBE_MIC_FIR_ECC_MULTI_0_SET 0x0000000000000100ULL294#define CBE_MIC_FIR_ECC_SINGLE_1_SET 0x0000000000000080ULL295#define CBE_MIC_FIR_ECC_MULTI_1_SET 0x0000000000000040ULL296#define CBE_MIC_FIR_ECC_SET_MASK 0x000000000000ffffULL297u64 mic_fir_debug; /* 0x0238 */298299u8 pad_0x0240_0x1000[0x1000 - 0x0240]; /* 0x0240 */300};301302extern struct cbe_mic_tm_regs __iomem *cbe_get_mic_tm_regs(struct device_node *np);303extern struct cbe_mic_tm_regs __iomem *cbe_get_cpu_mic_tm_regs(int cpu);304305306/* Cell page table entries */307#define CBE_IOPTE_PP_W 0x8000000000000000ul /* protection: write */308#define CBE_IOPTE_PP_R 0x4000000000000000ul /* protection: read */309#define CBE_IOPTE_M 0x2000000000000000ul /* coherency required */310#define CBE_IOPTE_SO_R 0x1000000000000000ul /* ordering: writes */311#define CBE_IOPTE_SO_RW 0x1800000000000000ul /* ordering: r & w */312#define CBE_IOPTE_RPN_Mask 0x07fffffffffff000ul /* RPN */313#define CBE_IOPTE_H 0x0000000000000800ul /* cache hint */314#define CBE_IOPTE_IOID_Mask 0x00000000000007fful /* ioid */315316/* some utility functions to deal with SMT */317extern u32 cbe_get_hw_thread_id(int cpu);318extern u32 cbe_cpu_to_node(int cpu);319extern u32 cbe_node_to_cpu(int node);320321/* Init this module early */322extern void cbe_regs_init(void);323324325#endif /* CBE_REGS_H */326327328