mips: octeon: Add serdes and device helper support incl. DM PCIe driver
PATCH 25/50 mips: octeon: Add cvmx-pow-defs.h header file
In reply to Stefan RoeseFrom: Aaron Williams <[email protected]>
Import cvmx-pow-defs.h header file from 2013 U-Boot. It will be used by the later added drivers to support PCIe and networking on the MIPS Octeon II / III platforms.
---
.../mach-octeon/include/mach/cvmx-pow-defs.h | 1135 +++++++++++++++++ 1 file changed, 1135 insertions(+) create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-pow-defs.h
arch/mips/mach-octeon/include/mach/cvmx-pow-defs.h new file +1135 -0
@@ -0,0 +1,1135 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2020 Marvell International Ltd. +* +* Configuration and status register (CSR) type definitions for +* Octeon pow. +*/ + +#ifndef __CVMX_POW_DEFS_H__ +#define __CVMX_POW_DEFS_H__ + +#define CVMX_POW_BIST_STAT (0x00016700000003F8ull) +#define CVMX_POW_DS_PC (0x0001670000000398ull) +#define CVMX_POW_ECC_ERR (0x0001670000000218ull) +#define CVMX_POW_IQ_CNTX (offset) (0x0001670000000340ull + ((offset) & 7) * 8) +#define CVMX_POW_IQ_COM_CNT (0x0001670000000388ull) +#define CVMX_POW_IQ_INT (0x0001670000000238ull) +#define CVMX_POW_IQ_INT_EN (0x0001670000000240ull) +#define CVMX_POW_IQ_THRX (offset) (0x00016700000003A0ull + ((offset) & 7) * 8) +#define CVMX_POW_NOS_CNT (0x0001670000000228ull) +#define CVMX_POW_NW_TIM (0x0001670000000210ull) +#define CVMX_POW_PF_RST_MSK (0x0001670000000230ull) +#define CVMX_POW_PP_GRP_MSKX (offset) (0x0001670000000000ull + ((offset) & 15) * 8) +#define CVMX_POW_QOS_RNDX (offset) (0x00016700000001C0ull + ((offset) & 7) * 8) +#define CVMX_POW_QOS_THRX (offset) (0x0001670000000180ull + ((offset) & 7) * 8) +#define CVMX_POW_TS_PC (0x0001670000000390ull) +#define CVMX_POW_WA_COM_PC (0x0001670000000380ull) +#define CVMX_POW_WA_PCX (offset) (0x0001670000000300ull + ((offset) & 7) * 8) +#define CVMX_POW_WQ_INT (0x0001670000000200ull) +#define CVMX_POW_WQ_INT_CNTX (offset) (0x0001670000000100ull + ((offset) & 15) * 8) +#define CVMX_POW_WQ_INT_PC (0x0001670000000208ull) +#define CVMX_POW_WQ_INT_THRX (offset) (0x0001670000000080ull + ((offset) & 15) * 8) +#define CVMX_POW_WS_PCX (offset) (0x0001670000000280ull + ((offset) & 15) * 8) + +/** +* cvmx_pow_bist_stat +* +* Contains the BIST status for the POW memories ('0' = pass, '1' = fail). +* +*/ +union cvmx_pow_bist_stat { +u64 u64; +struct cvmx_pow_bist_stat_s { +u64 reserved_32_63 :32 ; +u64 pp :16 ; +u64 reserved_0_15 :16 ; + } s; +struct cvmx_pow_bist_stat_cn30xx { +u64 reserved_17_63 :47 ; +u64 pp :1 ; +u64 reserved_9_15 :7 ; +u64 cam :1 ; +u64 nbt1 :1 ; +u64 nbt0 :1 ; +u64 index :1 ; +u64 fidx :1 ; +u64 nbr1 :1 ; +u64 nbr0 :1 ; +u64 pend :1 ; +u64 adr :1 ; + } cn30xx; +struct cvmx_pow_bist_stat_cn31xx { +u64 reserved_18_63 :46 ; +u64 pp :2 ; +u64 reserved_9_15 :7 ; +u64 cam :1 ; +u64 nbt1 :1 ; +u64 nbt0 :1 ; +u64 index :1 ; +u64 fidx :1 ; +u64 nbr1 :1 ; +u64 nbr0 :1 ; +u64 pend :1 ; +u64 adr :1 ; + } cn31xx; +struct cvmx_pow_bist_stat_cn38xx { +u64 reserved_32_63 :32 ; +u64 pp :16 ; +u64 reserved_10_15 :6 ; +u64 cam :1 ; +u64 nbt :1 ; +u64 index :1 ; +u64 fidx :1 ; +u64 nbr1 :1 ; +u64 nbr0 :1 ; +u64 pend1 :1 ; +u64 pend0 :1 ; +u64 adr1 :1 ; +u64 adr0 :1 ; + } cn38xx; +struct cvmx_pow_bist_stat_cn38xx cn38xxp2; +struct cvmx_pow_bist_stat_cn31xx cn50xx; +struct cvmx_pow_bist_stat_cn52xx { +u64 reserved_20_63 :44 ; +u64 pp :4 ; +u64 reserved_9_15 :7 ; +u64 cam :1 ; +u64 nbt1 :1 ; +u64 nbt0 :1 ; +u64 index :1 ; +u64 fidx :1 ; +u64 nbr1 :1 ; +u64 nbr0 :1 ; +u64 pend :1 ; +u64 adr :1 ; + } cn52xx; +struct cvmx_pow_bist_stat_cn52xx cn52xxp1; +struct cvmx_pow_bist_stat_cn56xx { +u64 reserved_28_63 :36 ; +u64 pp :12 ; +u64 reserved_10_15 :6 ; +u64 cam :1 ; +u64 nbt :1 ; +u64 index :1 ; +u64 fidx :1 ; +u64 nbr1 :1 ; +u64 nbr0 :1 ; +u64 pend1 :1 ; +u64 pend0 :1 ; +u64 adr1 :1 ; +u64 adr0 :1 ; + } cn56xx; +struct cvmx_pow_bist_stat_cn56xx cn56xxp1; +struct cvmx_pow_bist_stat_cn38xx cn58xx; +struct cvmx_pow_bist_stat_cn38xx cn58xxp1; +struct cvmx_pow_bist_stat_cn61xx { +u64 reserved_20_63 :44 ; +u64 pp :4 ; +u64 reserved_12_15 :4 ; +u64 cam :1 ; +u64 nbr :3 ; +u64 nbt :4 ; +u64 index :1 ; +u64 fidx :1 ; +u64 pend :1 ; +u64 adr :1 ; + } cn61xx; +struct cvmx_pow_bist_stat_cn63xx { +u64 reserved_22_63 :42 ; +u64 pp :6 ; +u64 reserved_12_15 :4 ; +u64 cam :1 ; +u64 nbr :3 ; +u64 nbt :4 ; +u64 index :1 ; +u64 fidx :1 ; +u64 pend :1 ; +u64 adr :1 ; + } cn63xx; +struct cvmx_pow_bist_stat_cn63xx cn63xxp1; +struct cvmx_pow_bist_stat_cn66xx { +u64 reserved_26_63 :38 ; +u64 pp :10 ; +u64 reserved_12_15 :4 ; +u64 cam :1 ; +u64 nbr :3 ; +u64 nbt :4 ; +u64 index :1 ; +u64 fidx :1 ; +u64 pend :1 ; +u64 adr :1 ; + } cn66xx; +struct cvmx_pow_bist_stat_cn70xx { +u64 reserved_12_63 :52 ; +u64 cam :1 ; +u64 reserved_10_10 :1 ; +u64 nbr :2 ; +u64 reserved_6_7 :2 ; +u64 nbt :2 ; +u64 index :1 ; +u64 fidx :1 ; +u64 pend :1 ; +u64 adr :1 ; + } cn70xx; +struct cvmx_pow_bist_stat_cn70xx cn70xxp1; +struct cvmx_pow_bist_stat_cn61xx cnf71xx; +}; + +typedef union cvmx_pow_bist_stat cvmx_pow_bist_stat_t ; + +/** +* cvmx_pow_ds_pc +* +* Counts the number of de-schedule requests. Write to clear. +* +*/ +union cvmx_pow_ds_pc { +u64 u64; +struct cvmx_pow_ds_pc_s { +u64 reserved_32_63 :32 ; +u64 ds_pc :32 ; + } s; +struct cvmx_pow_ds_pc_s cn30xx; +struct cvmx_pow_ds_pc_s cn31xx; +struct cvmx_pow_ds_pc_s cn38xx; +struct cvmx_pow_ds_pc_s cn38xxp2; +struct cvmx_pow_ds_pc_s cn50xx; +struct cvmx_pow_ds_pc_s cn52xx; +struct cvmx_pow_ds_pc_s cn52xxp1; +struct cvmx_pow_ds_pc_s cn56xx; +struct cvmx_pow_ds_pc_s cn56xxp1; +struct cvmx_pow_ds_pc_s cn58xx; +struct cvmx_pow_ds_pc_s cn58xxp1; +struct cvmx_pow_ds_pc_s cn61xx; +struct cvmx_pow_ds_pc_s cn63xx; +struct cvmx_pow_ds_pc_s cn63xxp1; +struct cvmx_pow_ds_pc_s cn66xx; +struct cvmx_pow_ds_pc_s cn70xx; +struct cvmx_pow_ds_pc_s cn70xxp1; +struct cvmx_pow_ds_pc_s cnf71xx; +}; + +typedef union cvmx_pow_ds_pc cvmx_pow_ds_pc_t ; + +/** +* cvmx_pow_ecc_err +* +* Contains the single and double error bits and the corresponding interrupt enables for the ECC- +* protected POW index memory. Also contains the syndrome value in the event of an ECC error. +* Also contains the remote pointer error bit and interrupt enable. RPE is set when the POW +* detected +* corruption on one or more of the input queue lists in L2/DRAM (POW's local copy of the tail +* pointer +* for the L2/DRAM input queue did not match the last entry on the the list). This is caused by +* L2/DRAM corruption, and is generally a fatal error because it likely caused POW to load bad +* work +* queue entries. +* This register also contains the illegal operation error bits and the corresponding interrupt +* enables as follows: +* <0> Received SWTAG/SWTAG_FULL/SWTAG_DESCH/DESCH/UPD_WQP from PP in NULL_NULL state +* <1> Received SWTAG/SWTAG_DESCH/DESCH/UPD_WQP from PP in NULL state +* <2> Received SWTAG/SWTAG_FULL/SWTAG_DESCH/GET_WORK from PP with pending tag switch to ORDERED +* or ATOMIC +* <3> Received SWTAG/SWTAG_FULL/SWTAG_DESCH from PP with tag specified as NULL_NULL +* <4> Received SWTAG_FULL/SWTAG_DESCH from PP with tag specified as NULL +* <5> Received SWTAG/SWTAG_FULL/SWTAG_DESCH/DESCH/UPD_WQP/GET_WORK/NULL_RD from PP with +* GET_WORK pending +* <6> Received SWTAG/SWTAG_FULL/SWTAG_DESCH/DESCH/UPD_WQP/GET_WORK/NULL_RD from PP with NULL_RD +* pending +* <7> Received CLR_NSCHED from PP with SWTAG_DESCH/DESCH/CLR_NSCHED pending +* <8> Received SWTAG/SWTAG_FULL/SWTAG_DESCH/DESCH/UPD_WQP/GET_WORK/NULL_RD from PP with +* CLR_NSCHED pending +* <9> Received illegal opcode +* <10> Received ADD_WORK with tag specified as NULL_NULL +* <11> Received DBG load from PP with DBG load pending +* <12> Received CSR load from PP with CSR load pending +*/ +union cvmx_pow_ecc_err { +u64 u64; +struct cvmx_pow_ecc_err_s { +u64 reserved_45_63 :19 ; +u64 iop_ie :13 ; +u64 reserved_29_31 :3 ; +u64 iop :13 ; +u64 reserved_14_15 :2 ; +u64 rpe_ie :1 ; +u64 rpe :1 ; +u64 reserved_9_11 :3 ; +u64 syn :5 ; +u64 dbe_ie :1 ; +u64 sbe_ie :1 ; +u64 dbe :1 ; +u64 sbe :1 ; + } s; +struct cvmx_pow_ecc_err_s cn30xx; +struct cvmx_pow_ecc_err_cn31xx { +u64 reserved_14_63 :50 ; +u64 rpe_ie :1 ; +u64 rpe :1 ; +u64 reserved_9_11 :3 ; +u64 syn :5 ; +u64 dbe_ie :1 ; +u64 sbe_ie :1 ; +u64 dbe :1 ; +u64 sbe :1 ; + } cn31xx; +struct cvmx_pow_ecc_err_s cn38xx; +struct cvmx_pow_ecc_err_cn31xx cn38xxp2; +struct cvmx_pow_ecc_err_s cn50xx; +struct cvmx_pow_ecc_err_s cn52xx; +struct cvmx_pow_ecc_err_s cn52xxp1; +struct cvmx_pow_ecc_err_s cn56xx; +struct cvmx_pow_ecc_err_s cn56xxp1; +struct cvmx_pow_ecc_err_s cn58xx; +struct cvmx_pow_ecc_err_s cn58xxp1; +struct cvmx_pow_ecc_err_s cn61xx; +struct cvmx_pow_ecc_err_s cn63xx; +struct cvmx_pow_ecc_err_s cn63xxp1; +struct cvmx_pow_ecc_err_s cn66xx; +struct cvmx_pow_ecc_err_s cn70xx; +struct cvmx_pow_ecc_err_s cn70xxp1; +struct cvmx_pow_ecc_err_s cnf71xx; +}; + +typedef union cvmx_pow_ecc_err cvmx_pow_ecc_err_t ; + +/** +* cvmx_pow_iq_cnt# +* +* Contains a read-only count of the number of work queue entries for each QOS level. +* +*/ +union cvmx_pow_iq_cntx { +u64 u64; +struct cvmx_pow_iq_cntx_s { +u64 reserved_32_63 :32 ; +u64 iq_cnt :32 ; + } s; +struct cvmx_pow_iq_cntx_s cn30xx; +struct cvmx_pow_iq_cntx_s cn31xx; +struct cvmx_pow_iq_cntx_s cn38xx; +struct cvmx_pow_iq_cntx_s cn38xxp2; +struct cvmx_pow_iq_cntx_s cn50xx; +struct cvmx_pow_iq_cntx_s cn52xx; +struct cvmx_pow_iq_cntx_s cn52xxp1; +struct cvmx_pow_iq_cntx_s cn56xx; +struct cvmx_pow_iq_cntx_s cn56xxp1; +struct cvmx_pow_iq_cntx_s cn58xx; +struct cvmx_pow_iq_cntx_s cn58xxp1; +struct cvmx_pow_iq_cntx_s cn61xx; +struct cvmx_pow_iq_cntx_s cn63xx; +struct cvmx_pow_iq_cntx_s cn63xxp1; +struct cvmx_pow_iq_cntx_s cn66xx; +struct cvmx_pow_iq_cntx_s cn70xx; +struct cvmx_pow_iq_cntx_s cn70xxp1; +struct cvmx_pow_iq_cntx_s cnf71xx; +}; + +typedef union cvmx_pow_iq_cntx cvmx_pow_iq_cntx_t ; + +/** +* cvmx_pow_iq_com_cnt +* +* Contains a read-only count of the total number of work queue entries in all QOS levels. +* +*/ +union cvmx_pow_iq_com_cnt { +u64 u64; +struct cvmx_pow_iq_com_cnt_s { +u64 reserved_32_63 :32 ; +u64 iq_cnt :32 ; + } s; +struct cvmx_pow_iq_com_cnt_s cn30xx; +struct cvmx_pow_iq_com_cnt_s cn31xx; +struct cvmx_pow_iq_com_cnt_s cn38xx; +struct cvmx_pow_iq_com_cnt_s cn38xxp2; +struct cvmx_pow_iq_com_cnt_s cn50xx; +struct cvmx_pow_iq_com_cnt_s cn52xx; +struct cvmx_pow_iq_com_cnt_s cn52xxp1; +struct cvmx_pow_iq_com_cnt_s cn56xx; +struct cvmx_pow_iq_com_cnt_s cn56xxp1; +struct cvmx_pow_iq_com_cnt_s cn58xx; +struct cvmx_pow_iq_com_cnt_s cn58xxp1; +struct cvmx_pow_iq_com_cnt_s cn61xx; +struct cvmx_pow_iq_com_cnt_s cn63xx; +struct cvmx_pow_iq_com_cnt_s cn63xxp1; +struct cvmx_pow_iq_com_cnt_s cn66xx; +struct cvmx_pow_iq_com_cnt_s cn70xx; +struct cvmx_pow_iq_com_cnt_s cn70xxp1; +struct cvmx_pow_iq_com_cnt_s cnf71xx; +}; + +typedef union cvmx_pow_iq_com_cnt cvmx_pow_iq_com_cnt_t ; + +/** +* cvmx_pow_iq_int +* +* "Contains the bits (1 per QOS level) that can trigger the input queue interrupt. An IQ_INT +* bit +* will be set if POW_IQ_CNT#QOS# changes and the resulting value is equal to POW_IQ_THR#QOS#." +*/ +union cvmx_pow_iq_int { +u64 u64; +struct cvmx_pow_iq_int_s { +u64 reserved_8_63 :56 ; +u64 iq_int :8 ; + } s; +struct cvmx_pow_iq_int_s cn52xx; +struct cvmx_pow_iq_int_s cn52xxp1; +struct cvmx_pow_iq_int_s cn56xx; +struct cvmx_pow_iq_int_s cn56xxp1; +struct cvmx_pow_iq_int_s cn61xx; +struct cvmx_pow_iq_int_s cn63xx; +struct cvmx_pow_iq_int_s cn63xxp1; +struct cvmx_pow_iq_int_s cn66xx; +struct cvmx_pow_iq_int_s cn70xx; +struct cvmx_pow_iq_int_s cn70xxp1; +struct cvmx_pow_iq_int_s cnf71xx; +}; + +typedef union cvmx_pow_iq_int cvmx_pow_iq_int_t ; + +/** +* cvmx_pow_iq_int_en +* +* Contains the bits (1 per QOS level) that enable the input queue interrupt. +* +*/ +union cvmx_pow_iq_int_en { +u64 u64; +struct cvmx_pow_iq_int_en_s { +u64 reserved_8_63 :56 ; +u64 int_en :8 ; + } s; +struct cvmx_pow_iq_int_en_s cn52xx; +struct cvmx_pow_iq_int_en_s cn52xxp1; +struct cvmx_pow_iq_int_en_s cn56xx; +struct cvmx_pow_iq_int_en_s cn56xxp1; +struct cvmx_pow_iq_int_en_s cn61xx; +struct cvmx_pow_iq_int_en_s cn63xx; +struct cvmx_pow_iq_int_en_s cn63xxp1; +struct cvmx_pow_iq_int_en_s cn66xx; +struct cvmx_pow_iq_int_en_s cn70xx; +struct cvmx_pow_iq_int_en_s cn70xxp1; +struct cvmx_pow_iq_int_en_s cnf71xx; +}; + +typedef union cvmx_pow_iq_int_en cvmx_pow_iq_int_en_t ; + +/** +* cvmx_pow_iq_thr# +* +* Threshold value for triggering input queue interrupts. +* +*/ +union cvmx_pow_iq_thrx { +u64 u64; +struct cvmx_pow_iq_thrx_s { +u64 reserved_32_63 :32 ; +u64 iq_thr :32 ; + } s; +struct cvmx_pow_iq_thrx_s cn52xx; +struct cvmx_pow_iq_thrx_s cn52xxp1; +struct cvmx_pow_iq_thrx_s cn56xx; +struct cvmx_pow_iq_thrx_s cn56xxp1; +struct cvmx_pow_iq_thrx_s cn61xx; +struct cvmx_pow_iq_thrx_s cn63xx; +struct cvmx_pow_iq_thrx_s cn63xxp1; +struct cvmx_pow_iq_thrx_s cn66xx; +struct cvmx_pow_iq_thrx_s cn70xx; +struct cvmx_pow_iq_thrx_s cn70xxp1; +struct cvmx_pow_iq_thrx_s cnf71xx; +}; + +typedef union cvmx_pow_iq_thrx cvmx_pow_iq_thrx_t ; + +/** +* cvmx_pow_nos_cnt +* +* Contains the number of work queue entries on the no-schedule list. +* +*/ +union cvmx_pow_nos_cnt { +u64 u64; +struct cvmx_pow_nos_cnt_s { +u64 reserved_12_63 :52 ; +u64 nos_cnt :12 ; + } s; +struct cvmx_pow_nos_cnt_cn30xx { +u64 reserved_7_63 :57 ; +u64 nos_cnt :7 ; + } cn30xx; +struct cvmx_pow_nos_cnt_cn31xx { +u64 reserved_9_63 :55 ; +u64 nos_cnt :9 ; + } cn31xx; +struct cvmx_pow_nos_cnt_s cn38xx; +struct cvmx_pow_nos_cnt_s cn38xxp2; +struct cvmx_pow_nos_cnt_cn31xx cn50xx; +struct cvmx_pow_nos_cnt_cn52xx { +u64 reserved_10_63 :54 ; +u64 nos_cnt :10 ; + } cn52xx; +struct cvmx_pow_nos_cnt_cn52xx cn52xxp1; +struct cvmx_pow_nos_cnt_s cn56xx; +struct cvmx_pow_nos_cnt_s cn56xxp1; +struct cvmx_pow_nos_cnt_s cn58xx; +struct cvmx_pow_nos_cnt_s cn58xxp1; +struct cvmx_pow_nos_cnt_cn52xx cn61xx; +struct cvmx_pow_nos_cnt_cn63xx { +u64 reserved_11_63 :53 ; +u64 nos_cnt :11 ; + } cn63xx; +struct cvmx_pow_nos_cnt_cn63xx cn63xxp1; +struct cvmx_pow_nos_cnt_cn63xx cn66xx; +struct cvmx_pow_nos_cnt_cn52xx cn70xx; +struct cvmx_pow_nos_cnt_cn52xx cn70xxp1; +struct cvmx_pow_nos_cnt_cn52xx cnf71xx; +}; + +typedef union cvmx_pow_nos_cnt cvmx_pow_nos_cnt_t ; + +/** +* cvmx_pow_nw_tim +* +* Sets the minimum period for a new work request timeout. Period is specified in n-1 notation +* where the increment value is 1024 clock cycles. Thus, a value of 0x0 in this register +* translates +* to 1024 cycles, 0x1 translates to 2048 cycles, 0x2 translates to 3072 cycles, etc... Note: +* the +* maximum period for a new work request timeout is 2 times the minimum period. Note: the new +* work +* request timeout counter is reset when this register is written. +* There are two new work request timeout cases: +* - WAIT bit clear. The new work request can timeout if the timer expires before the pre-fetch +* engine has reached the end of all work queues. This can occur if the executable work queue +* entry is deep in the queue and the pre-fetch engine is subject to many resets (i.e. high +* switch, +* de-schedule, or new work load from other PP's). Thus, it is possible for a PP to receive a +* work +* response with the NO_WORK bit set even though there was at least one executable entry in the +* work queues. The other (and typical) scenario for receiving a NO_WORK response with the +* WAIT +* bit clear is that the pre-fetch engine has reached the end of all work queues without +* finding +* executable work. +* - WAIT bit set. The new work request can timeout if the timer expires before the pre-fetch +* engine has found executable work. In this case, the only scenario where the PP will receive +* a +* work response with the NO_WORK bit set is if the timer expires. Note: it is still possible +* for +* a PP to receive a NO_WORK response even though there was at least one executable entry in +* the +* work queues. +* In either case, it's important to note that switches and de-schedules are higher priority +* operations that can cause the pre-fetch engine to reset. Thus in a system with many switches +* or +* de-schedules occurring, it's possible for the new work timer to expire (resulting in NO_WORK +* responses) before the pre-fetch engine is able to get very deep into the work queues. +*/ +union cvmx_pow_nw_tim { +u64 u64; +struct cvmx_pow_nw_tim_s { +u64 reserved_10_63 :54 ; +u64 nw_tim :10 ; + } s; +struct cvmx_pow_nw_tim_s cn30xx; +struct cvmx_pow_nw_tim_s cn31xx; +struct cvmx_pow_nw_tim_s cn38xx; +struct cvmx_pow_nw_tim_s cn38xxp2; +struct cvmx_pow_nw_tim_s cn50xx; +struct cvmx_pow_nw_tim_s cn52xx; +struct cvmx_pow_nw_tim_s cn52xxp1; +struct cvmx_pow_nw_tim_s cn56xx; +struct cvmx_pow_nw_tim_s cn56xxp1; +struct cvmx_pow_nw_tim_s cn58xx; +struct cvmx_pow_nw_tim_s cn58xxp1; +struct cvmx_pow_nw_tim_s cn61xx; +struct cvmx_pow_nw_tim_s cn63xx; +struct cvmx_pow_nw_tim_s cn63xxp1; +struct cvmx_pow_nw_tim_s cn66xx; +struct cvmx_pow_nw_tim_s cn70xx; +struct cvmx_pow_nw_tim_s cn70xxp1; +struct cvmx_pow_nw_tim_s cnf71xx; +}; + +typedef union cvmx_pow_nw_tim cvmx_pow_nw_tim_t ; + +/** +* cvmx_pow_pf_rst_msk +* +* Resets the work prefetch engine when work is stored in an internal buffer (either when the add +* work arrives or when the work is reloaded from an external buffer) for an enabled QOS level +* (1 bit per QOS level). +*/ +union cvmx_pow_pf_rst_msk { +u64 u64; +struct cvmx_pow_pf_rst_msk_s { +u64 reserved_8_63 :56 ; +u64 rst_msk :8 ; + } s; +struct cvmx_pow_pf_rst_msk_s cn50xx; +struct cvmx_pow_pf_rst_msk_s cn52xx; +struct cvmx_pow_pf_rst_msk_s cn52xxp1; +struct cvmx_pow_pf_rst_msk_s cn56xx; +struct cvmx_pow_pf_rst_msk_s cn56xxp1; +struct cvmx_pow_pf_rst_msk_s cn58xx; +struct cvmx_pow_pf_rst_msk_s cn58xxp1; +struct cvmx_pow_pf_rst_msk_s cn61xx; +struct cvmx_pow_pf_rst_msk_s cn63xx; +struct cvmx_pow_pf_rst_msk_s cn63xxp1; +struct cvmx_pow_pf_rst_msk_s cn66xx; +struct cvmx_pow_pf_rst_msk_s cn70xx; +struct cvmx_pow_pf_rst_msk_s cn70xxp1; +struct cvmx_pow_pf_rst_msk_s cnf71xx; +}; + +typedef union cvmx_pow_pf_rst_msk cvmx_pow_pf_rst_msk_t ; + +/** +* cvmx_pow_pp_grp_msk# +* +* Selects which group(s) a PP belongs to. A '1' in any bit position sets the PP's membership in +* the corresponding group. A value of 0x0 will prevent the PP from receiving new work. Note: +* disabled or non-existent PP's should have this field set to 0xffff (the reset value) in order +* to +* maximize POW performance. +* Also contains the QOS level priorities for each PP. 0x0 is highest priority, and 0x7 the +* lowest. +* Setting the priority to 0xf will prevent that PP from receiving work from that QOS level. +* Priority values 0x8 through 0xe are reserved and should not be used. For a given PP, +* priorities +* should begin at 0x0 and remain contiguous throughout the range. +*/ +union cvmx_pow_pp_grp_mskx { +u64 u64; +struct cvmx_pow_pp_grp_mskx_s { +u64 reserved_48_63 :16 ; +u64 qos7_pri :4 ; +u64 qos6_pri :4 ; +u64 qos5_pri :4 ; +u64 qos4_pri :4 ; +u64 qos3_pri :4 ; +u64 qos2_pri :4 ; +u64 qos1_pri :4 ; +u64 qos0_pri :4 ; +u64 grp_msk :16 ; + } s; +struct cvmx_pow_pp_grp_mskx_cn30xx { +u64 reserved_16_63 :48 ; +u64 grp_msk :16 ; + } cn30xx; +struct cvmx_pow_pp_grp_mskx_cn30xx cn31xx; +struct cvmx_pow_pp_grp_mskx_cn30xx cn38xx; +struct cvmx_pow_pp_grp_mskx_cn30xx cn38xxp2; +struct cvmx_pow_pp_grp_mskx_s cn50xx; +struct cvmx_pow_pp_grp_mskx_s cn52xx; +struct cvmx_pow_pp_grp_mskx_s cn52xxp1; +struct cvmx_pow_pp_grp_mskx_s cn56xx; +struct cvmx_pow_pp_grp_mskx_s cn56xxp1; +struct cvmx_pow_pp_grp_mskx_s cn58xx; +struct cvmx_pow_pp_grp_mskx_s cn58xxp1; +struct cvmx_pow_pp_grp_mskx_s cn61xx; +struct cvmx_pow_pp_grp_mskx_s cn63xx; +struct cvmx_pow_pp_grp_mskx_s cn63xxp1; +struct cvmx_pow_pp_grp_mskx_s cn66xx; +struct cvmx_pow_pp_grp_mskx_s cn70xx; +struct cvmx_pow_pp_grp_mskx_s cn70xxp1; +struct cvmx_pow_pp_grp_mskx_s cnf71xx; +}; + +typedef union cvmx_pow_pp_grp_mskx cvmx_pow_pp_grp_mskx_t ; + +/** +* cvmx_pow_qos_rnd# +* +* Contains the round definitions for issuing new work. Each round consists of 8 bits with each +* bit +* corresponding to a QOS level. There are 4 rounds contained in each register for a total of 32 +* rounds. The issue logic traverses through the rounds sequentially (lowest round to highest +* round) +* in an attempt to find new work for each PP. Within each round, the issue logic traverses +* through +* the QOS levels sequentially (highest QOS to lowest QOS) skipping over each QOS level with a +* clear +* bit in the round mask. Note: setting a QOS level to all zeroes in all issue round registers +* will +* prevent work from being issued from that QOS level. +*/ +union cvmx_pow_qos_rndx { +u64 u64; +struct cvmx_pow_qos_rndx_s { +u64 reserved_32_63 :32 ; +u64 rnd_p3 :8 ; +u64 rnd_p2 :8 ; +u64 rnd_p1 :8 ; +u64 rnd :8 ; + } s; +struct cvmx_pow_qos_rndx_s cn30xx; +struct cvmx_pow_qos_rndx_s cn31xx; +struct cvmx_pow_qos_rndx_s cn38xx; +struct cvmx_pow_qos_rndx_s cn38xxp2; +struct cvmx_pow_qos_rndx_s cn50xx; +struct cvmx_pow_qos_rndx_s cn52xx; +struct cvmx_pow_qos_rndx_s cn52xxp1; +struct cvmx_pow_qos_rndx_s cn56xx; +struct cvmx_pow_qos_rndx_s cn56xxp1; +struct cvmx_pow_qos_rndx_s cn58xx; +struct cvmx_pow_qos_rndx_s cn58xxp1; +struct cvmx_pow_qos_rndx_s cn61xx; +struct cvmx_pow_qos_rndx_s cn63xx; +struct cvmx_pow_qos_rndx_s cn63xxp1; +struct cvmx_pow_qos_rndx_s cn66xx; +struct cvmx_pow_qos_rndx_s cn70xx; +struct cvmx_pow_qos_rndx_s cn70xxp1; +struct cvmx_pow_qos_rndx_s cnf71xx; +}; + +typedef union cvmx_pow_qos_rndx cvmx_pow_qos_rndx_t ; + +/** +* cvmx_pow_qos_thr# +* +* Contains the thresholds for allocating POW internal storage buffers. If the number of +* remaining +* free buffers drops below the minimum threshold (MIN_THR) or the number of allocated buffers +* for +* this QOS level rises above the maximum threshold (MAX_THR), future incoming work queue entries +* will be buffered externally rather than internally. This register also contains a read-only +* count +* of the current number of free buffers (FREE_CNT), the number of internal buffers currently +* allocated to this QOS level (BUF_CNT), and the total number of buffers on the de-schedule list +* (DES_CNT) (which is not the same as the total number of de-scheduled buffers). +*/ +union cvmx_pow_qos_thrx { +u64 u64; +struct cvmx_pow_qos_thrx_s { +u64 reserved_60_63 :4 ; +u64 des_cnt :12 ; +u64 buf_cnt :12 ; +u64 free_cnt :12 ; +u64 reserved_23_23 :1 ; +u64 max_thr :11 ; +u64 reserved_11_11 :1 ; +u64 min_thr :11 ; + } s; +struct cvmx_pow_qos_thrx_cn30xx { +u64 reserved_55_63 :9 ; +u64 des_cnt :7 ; +u64 reserved_43_47 :5 ; +u64 buf_cnt :7 ; +u64 reserved_31_35 :5 ; +u64 free_cnt :7 ; +u64 reserved_18_23 :6 ; +u64 max_thr :6 ; +u64 reserved_6_11 :6 ; +u64 min_thr :6 ; + } cn30xx; +struct cvmx_pow_qos_thrx_cn31xx { +u64 reserved_57_63 :7 ; +u64 des_cnt :9 ; +u64 reserved_45_47 :3 ; +u64 buf_cnt :9 ; +u64 reserved_33_35 :3 ; +u64 free_cnt :9 ; +u64 reserved_20_23 :4 ; +u64 max_thr :8 ; +u64 reserved_8_11 :4 ; +u64 min_thr :8 ; + } cn31xx; +struct cvmx_pow_qos_thrx_s cn38xx; +struct cvmx_pow_qos_thrx_s cn38xxp2; +struct cvmx_pow_qos_thrx_cn31xx cn50xx; +struct cvmx_pow_qos_thrx_cn52xx { +u64 reserved_58_63 :6 ; +u64 des_cnt :10 ; +u64 reserved_46_47 :2 ; +u64 buf_cnt :10 ; +u64 reserved_34_35 :2 ; +u64 free_cnt :10 ; +u64 reserved_21_23 :3 ; +u64 max_thr :9 ; +u64 reserved_9_11 :3 ; +u64 min_thr :9 ; + } cn52xx; +struct cvmx_pow_qos_thrx_cn52xx cn52xxp1; +struct cvmx_pow_qos_thrx_s cn56xx; +struct cvmx_pow_qos_thrx_s cn56xxp1; +struct cvmx_pow_qos_thrx_s cn58xx; +struct cvmx_pow_qos_thrx_s cn58xxp1; +struct cvmx_pow_qos_thrx_cn52xx cn61xx; +struct cvmx_pow_qos_thrx_cn63xx { +u64 reserved_59_63 :5 ; +u64 des_cnt :11 ; +u64 reserved_47_47 :1 ; +u64 buf_cnt :11 ; +u64 reserved_35_35 :1 ; +u64 free_cnt :11 ; +u64 reserved_22_23 :2 ; +u64 max_thr :10 ; +u64 reserved_10_11 :2 ; +u64 min_thr :10 ; + } cn63xx; +struct cvmx_pow_qos_thrx_cn63xx cn63xxp1; +struct cvmx_pow_qos_thrx_cn63xx cn66xx; +struct cvmx_pow_qos_thrx_cn52xx cn70xx; +struct cvmx_pow_qos_thrx_cn52xx cn70xxp1; +struct cvmx_pow_qos_thrx_cn52xx cnf71xx; +}; + +typedef union cvmx_pow_qos_thrx cvmx_pow_qos_thrx_t ; + +/** +* cvmx_pow_ts_pc +* +* Counts the number of tag switch requests. Write to clear. +* +*/ +union cvmx_pow_ts_pc { +u64 u64; +struct cvmx_pow_ts_pc_s { +u64 reserved_32_63 :32 ; +u64 ts_pc :32 ; + } s; +struct cvmx_pow_ts_pc_s cn30xx; +struct cvmx_pow_ts_pc_s cn31xx; +struct cvmx_pow_ts_pc_s cn38xx; +struct cvmx_pow_ts_pc_s cn38xxp2; +struct cvmx_pow_ts_pc_s cn50xx; +struct cvmx_pow_ts_pc_s cn52xx; +struct cvmx_pow_ts_pc_s cn52xxp1; +struct cvmx_pow_ts_pc_s cn56xx; +struct cvmx_pow_ts_pc_s cn56xxp1; +struct cvmx_pow_ts_pc_s cn58xx; +struct cvmx_pow_ts_pc_s cn58xxp1; +struct cvmx_pow_ts_pc_s cn61xx; +struct cvmx_pow_ts_pc_s cn63xx; +struct cvmx_pow_ts_pc_s cn63xxp1; +struct cvmx_pow_ts_pc_s cn66xx; +struct cvmx_pow_ts_pc_s cn70xx; +struct cvmx_pow_ts_pc_s cn70xxp1; +struct cvmx_pow_ts_pc_s cnf71xx; +}; + +typedef union cvmx_pow_ts_pc cvmx_pow_ts_pc_t ; + +/** +* cvmx_pow_wa_com_pc +* +* Counts the number of add new work requests for all QOS levels. Write to clear. +* +*/ +union cvmx_pow_wa_com_pc { +u64 u64; +struct cvmx_pow_wa_com_pc_s { +u64 reserved_32_63 :32 ; +u64 wa_pc :32 ; + } s; +struct cvmx_pow_wa_com_pc_s cn30xx; +struct cvmx_pow_wa_com_pc_s cn31xx; +struct cvmx_pow_wa_com_pc_s cn38xx; +struct cvmx_pow_wa_com_pc_s cn38xxp2; +struct cvmx_pow_wa_com_pc_s cn50xx; +struct cvmx_pow_wa_com_pc_s cn52xx; +struct cvmx_pow_wa_com_pc_s cn52xxp1; +struct cvmx_pow_wa_com_pc_s cn56xx; +struct cvmx_pow_wa_com_pc_s cn56xxp1; +struct cvmx_pow_wa_com_pc_s cn58xx; +struct cvmx_pow_wa_com_pc_s cn58xxp1; +struct cvmx_pow_wa_com_pc_s cn61xx; +struct cvmx_pow_wa_com_pc_s cn63xx; +struct cvmx_pow_wa_com_pc_s cn63xxp1; +struct cvmx_pow_wa_com_pc_s cn66xx; +struct cvmx_pow_wa_com_pc_s cn70xx; +struct cvmx_pow_wa_com_pc_s cn70xxp1; +struct cvmx_pow_wa_com_pc_s cnf71xx; +}; + +typedef union cvmx_pow_wa_com_pc cvmx_pow_wa_com_pc_t ; + +/** +* cvmx_pow_wa_pc# +* +* Counts the number of add new work requests for each QOS level. Write to clear. +* +*/ +union cvmx_pow_wa_pcx { +u64 u64; +struct cvmx_pow_wa_pcx_s { +u64 reserved_32_63 :32 ; +u64 wa_pc :32 ; + } s; +struct cvmx_pow_wa_pcx_s cn30xx; +struct cvmx_pow_wa_pcx_s cn31xx; +struct cvmx_pow_wa_pcx_s cn38xx; +struct cvmx_pow_wa_pcx_s cn38xxp2; +struct cvmx_pow_wa_pcx_s cn50xx; +struct cvmx_pow_wa_pcx_s cn52xx; +struct cvmx_pow_wa_pcx_s cn52xxp1; +struct cvmx_pow_wa_pcx_s cn56xx; +struct cvmx_pow_wa_pcx_s cn56xxp1; +struct cvmx_pow_wa_pcx_s cn58xx; +struct cvmx_pow_wa_pcx_s cn58xxp1; +struct cvmx_pow_wa_pcx_s cn61xx; +struct cvmx_pow_wa_pcx_s cn63xx; +struct cvmx_pow_wa_pcx_s cn63xxp1; +struct cvmx_pow_wa_pcx_s cn66xx; +struct cvmx_pow_wa_pcx_s cn70xx; +struct cvmx_pow_wa_pcx_s cn70xxp1; +struct cvmx_pow_wa_pcx_s cnf71xx; +}; + +typedef union cvmx_pow_wa_pcx cvmx_pow_wa_pcx_t ; + +/** +* cvmx_pow_wq_int +* +* Contains the bits (1 per group) that set work queue interrupts and are used to clear these +* interrupts. Also contains the input queue interrupt temporary disable bits (1 per group). For +* more information regarding this register, see the interrupt section. +*/ +union cvmx_pow_wq_int { +u64 u64; +struct cvmx_pow_wq_int_s { +u64 reserved_32_63 :32 ; +u64 iq_dis :16 ; +u64 wq_int :16 ; + } s; +struct cvmx_pow_wq_int_s cn30xx; +struct cvmx_pow_wq_int_s cn31xx; +struct cvmx_pow_wq_int_s cn38xx; +struct cvmx_pow_wq_int_s cn38xxp2; +struct cvmx_pow_wq_int_s cn50xx; +struct cvmx_pow_wq_int_s cn52xx; +struct cvmx_pow_wq_int_s cn52xxp1; +struct cvmx_pow_wq_int_s cn56xx; +struct cvmx_pow_wq_int_s cn56xxp1; +struct cvmx_pow_wq_int_s cn58xx; +struct cvmx_pow_wq_int_s cn58xxp1; +struct cvmx_pow_wq_int_s cn61xx; +struct cvmx_pow_wq_int_s cn63xx; +struct cvmx_pow_wq_int_s cn63xxp1; +struct cvmx_pow_wq_int_s cn66xx; +struct cvmx_pow_wq_int_s cn70xx; +struct cvmx_pow_wq_int_s cn70xxp1; +struct cvmx_pow_wq_int_s cnf71xx; +}; + +typedef union cvmx_pow_wq_int cvmx_pow_wq_int_t ; + +/** +* cvmx_pow_wq_int_cnt# +* +* Contains a read-only copy of the counts used to trigger work queue interrupts. For more +* information regarding this register, see the interrupt section. +*/ +union cvmx_pow_wq_int_cntx { +u64 u64; +struct cvmx_pow_wq_int_cntx_s { +u64 reserved_28_63 :36 ; +u64 tc_cnt :4 ; +u64 ds_cnt :12 ; +u64 iq_cnt :12 ; + } s; +struct cvmx_pow_wq_int_cntx_cn30xx { +u64 reserved_28_63 :36 ; +u64 tc_cnt :4 ; +u64 reserved_19_23 :5 ; +u64 ds_cnt :7 ; +u64 reserved_7_11 :5 ; +u64 iq_cnt :7 ; + } cn30xx; +struct cvmx_pow_wq_int_cntx_cn31xx { +u64 reserved_28_63 :36 ; +u64 tc_cnt :4 ; +u64 reserved_21_23 :3 ; +u64 ds_cnt :9 ; +u64 reserved_9_11 :3 ; +u64 iq_cnt :9 ; + } cn31xx; +struct cvmx_pow_wq_int_cntx_s cn38xx; +struct cvmx_pow_wq_int_cntx_s cn38xxp2; +struct cvmx_pow_wq_int_cntx_cn31xx cn50xx; +struct cvmx_pow_wq_int_cntx_cn52xx { +u64 reserved_28_63 :36 ; +u64 tc_cnt :4 ; +u64 reserved_22_23 :2 ; +u64 ds_cnt :10 ; +u64 reserved_10_11 :2 ; +u64 iq_cnt :10 ; + } cn52xx; +struct cvmx_pow_wq_int_cntx_cn52xx cn52xxp1; +struct cvmx_pow_wq_int_cntx_s cn56xx; +struct cvmx_pow_wq_int_cntx_s cn56xxp1; +struct cvmx_pow_wq_int_cntx_s cn58xx; +struct cvmx_pow_wq_int_cntx_s cn58xxp1; +struct cvmx_pow_wq_int_cntx_cn52xx cn61xx; +struct cvmx_pow_wq_int_cntx_cn63xx { +u64 reserved_28_63 :36 ; +u64 tc_cnt :4 ; +u64 reserved_23_23 :1 ; +u64 ds_cnt :11 ; +u64 reserved_11_11 :1 ; +u64 iq_cnt :11 ; + } cn63xx; +struct cvmx_pow_wq_int_cntx_cn63xx cn63xxp1; +struct cvmx_pow_wq_int_cntx_cn63xx cn66xx; +struct cvmx_pow_wq_int_cntx_cn52xx cn70xx; +struct cvmx_pow_wq_int_cntx_cn52xx cn70xxp1; +struct cvmx_pow_wq_int_cntx_cn52xx cnf71xx; +}; + +typedef union cvmx_pow_wq_int_cntx cvmx_pow_wq_int_cntx_t ; + +/** +* cvmx_pow_wq_int_pc +* +* Contains the threshold value for the work queue interrupt periodic counter and also a read- +* only +* copy of the periodic counter. For more information regarding this register, see the interrupt +* section. +*/ +union cvmx_pow_wq_int_pc { +u64 u64; +struct cvmx_pow_wq_int_pc_s { +u64 reserved_60_63 :4 ; +u64 pc :28 ; +u64 reserved_28_31 :4 ; +u64 pc_thr :20 ; +u64 reserved_0_7 :8 ; + } s; +struct cvmx_pow_wq_int_pc_s cn30xx; +struct cvmx_pow_wq_int_pc_s cn31xx; +struct cvmx_pow_wq_int_pc_s cn38xx; +struct cvmx_pow_wq_int_pc_s cn38xxp2; +struct cvmx_pow_wq_int_pc_s cn50xx; +struct cvmx_pow_wq_int_pc_s cn52xx; +struct cvmx_pow_wq_int_pc_s cn52xxp1; +struct cvmx_pow_wq_int_pc_s cn56xx; +struct cvmx_pow_wq_int_pc_s cn56xxp1; +struct cvmx_pow_wq_int_pc_s cn58xx; +struct cvmx_pow_wq_int_pc_s cn58xxp1; +struct cvmx_pow_wq_int_pc_s cn61xx; +struct cvmx_pow_wq_int_pc_s cn63xx; +struct cvmx_pow_wq_int_pc_s cn63xxp1; +struct cvmx_pow_wq_int_pc_s cn66xx; +struct cvmx_pow_wq_int_pc_s cn70xx; +struct cvmx_pow_wq_int_pc_s cn70xxp1; +struct cvmx_pow_wq_int_pc_s cnf71xx; +}; + +typedef union cvmx_pow_wq_int_pc cvmx_pow_wq_int_pc_t ; + +/** +* cvmx_pow_wq_int_thr# +* +* Contains the thresholds for enabling and setting work queue interrupts. For more information +* regarding this register, see the interrupt section. +* Note: Up to 4 of the POW's internal storage buffers can be allocated for hardware use and are +* therefore not available for incoming work queue entries. Additionally, any PP that is not in +* the +* NULL_NULL state consumes a buffer. Thus in a 4 PP system, it is not advisable to set either +* IQ_THR or DS_THR to greater than 512 - 4 - 4 = 504. Doing so may prevent the interrupt from +* ever triggering. +*/ +union cvmx_pow_wq_int_thrx { +u64 u64; +struct cvmx_pow_wq_int_thrx_s { +u64 reserved_29_63 :35 ; +u64 tc_en :1 ; +u64 tc_thr :4 ; +u64 reserved_23_23 :1 ; +u64 ds_thr :11 ; +u64 reserved_11_11 :1 ; +u64 iq_thr :11 ; + } s; +struct cvmx_pow_wq_int_thrx_cn30xx { +u64 reserved_29_63 :35 ; +u64 tc_en :1 ; +u64 tc_thr :4 ; +u64 reserved_18_23 :6 ; +u64 ds_thr :6 ; +u64 reserved_6_11 :6 ; +u64 iq_thr :6 ; + } cn30xx; +struct cvmx_pow_wq_int_thrx_cn31xx { +u64 reserved_29_63 :35 ; +u64 tc_en :1 ; +u64 tc_thr :4 ; +u64 reserved_20_23 :4 ; +u64 ds_thr :8 ; +u64 reserved_8_11 :4 ; +u64 iq_thr :8 ; + } cn31xx; +struct cvmx_pow_wq_int_thrx_s cn38xx; +struct cvmx_pow_wq_int_thrx_s cn38xxp2; +struct cvmx_pow_wq_int_thrx_cn31xx cn50xx; +struct cvmx_pow_wq_int_thrx_cn52xx { +u64 reserved_29_63 :35 ; +u64 tc_en :1 ; +u64 tc_thr :4 ; +u64 reserved_21_23 :3 ; +u64 ds_thr :9 ; +u64 reserved_9_11 :3 ; +u64 iq_thr :9 ; + } cn52xx; +struct cvmx_pow_wq_int_thrx_cn52xx cn52xxp1; +struct cvmx_pow_wq_int_thrx_s cn56xx; +struct cvmx_pow_wq_int_thrx_s cn56xxp1; +struct cvmx_pow_wq_int_thrx_s cn58xx; +struct cvmx_pow_wq_int_thrx_s cn58xxp1; +struct cvmx_pow_wq_int_thrx_cn52xx cn61xx; +struct cvmx_pow_wq_int_thrx_cn63xx { +u64 reserved_29_63 :35 ; +u64 tc_en :1 ; +u64 tc_thr :4 ; +u64 reserved_22_23 :2 ; +u64 ds_thr :10 ; +u64 reserved_10_11 :2 ; +u64 iq_thr :10 ; + } cn63xx; +struct cvmx_pow_wq_int_thrx_cn63xx cn63xxp1; +struct cvmx_pow_wq_int_thrx_cn63xx cn66xx; +struct cvmx_pow_wq_int_thrx_cn52xx cn70xx; +struct cvmx_pow_wq_int_thrx_cn52xx cn70xxp1; +struct cvmx_pow_wq_int_thrx_cn52xx cnf71xx; +}; + +typedef union cvmx_pow_wq_int_thrx cvmx_pow_wq_int_thrx_t ; + +/** +* cvmx_pow_ws_pc# +* +* Counts the number of work schedules for each group. Write to clear. +* +*/ +union cvmx_pow_ws_pcx { +u64 u64; +struct cvmx_pow_ws_pcx_s { +u64 reserved_32_63 :32 ; +u64 ws_pc :32 ; + } s; +struct cvmx_pow_ws_pcx_s cn30xx; +struct cvmx_pow_ws_pcx_s cn31xx; +struct cvmx_pow_ws_pcx_s cn38xx; +struct cvmx_pow_ws_pcx_s cn38xxp2; +struct cvmx_pow_ws_pcx_s cn50xx; +struct cvmx_pow_ws_pcx_s cn52xx; +struct cvmx_pow_ws_pcx_s cn52xxp1; +struct cvmx_pow_ws_pcx_s cn56xx; +struct cvmx_pow_ws_pcx_s cn56xxp1; +struct cvmx_pow_ws_pcx_s cn58xx; +struct cvmx_pow_ws_pcx_s cn58xxp1; +struct cvmx_pow_ws_pcx_s cn61xx; +struct cvmx_pow_ws_pcx_s cn63xx; +struct cvmx_pow_ws_pcx_s cn63xxp1; +struct cvmx_pow_ws_pcx_s cn66xx; +struct cvmx_pow_ws_pcx_s cn70xx; +struct cvmx_pow_ws_pcx_s cn70xxp1; +struct cvmx_pow_ws_pcx_s cnf71xx; +}; + +typedef union cvmx_pow_ws_pcx cvmx_pow_ws_pcx_t ; + +#endif
Signature · 1 line
2.29.2
PATCH 26/50 mips: octeon: Add cvmx-rst-defs.h header file
In reply to Stefan RoeseFrom: Aaron Williams <[email protected]>
Import cvmx-rst-defs.h header file from 2013 U-Boot. It will be used by the later added drivers to support PCIe and networking on the MIPS Octeon II / III platforms.
---
.../mach-octeon/include/mach/cvmx-rst-defs.h | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-rst-defs.h
arch/mips/mach-octeon/include/mach/cvmx-rst-defs.h new file +77 -0
@@ -0,0 +1,77 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2020 Marvell International Ltd. +*/ + +#ifndef __CVMX_RST_DEFS_H__ +#define __CVMX_RST_DEFS_H__ + +#define CVMX_RST_CTLX (offset) (0x0001180006001640ull + ((offset) & 3) * 8) +#define CVMX_RST_SOFT_PRSTX (offset) (0x00011800060016C0ull + ((offset) & 3) * 8) + +/** +* cvmx_rst_ctl# +*/ +union cvmx_rst_ctlx { +u64 u64; +struct cvmx_rst_ctlx_s { +u64 reserved_10_63 :54 ; +u64 prst_link :1 ; +u64 rst_done :1 ; +u64 rst_link :1 ; +u64 host_mode :1 ; +u64 reserved_4_5 :2 ; +u64 rst_drv :1 ; +u64 rst_rcv :1 ; +u64 rst_chip :1 ; +u64 rst_val :1 ; + } s; +struct cvmx_rst_ctlx_s cn70xx; +struct cvmx_rst_ctlx_s cn70xxp1; +struct cvmx_rst_ctlx_s cn73xx; +struct cvmx_rst_ctlx_s cn78xx; +struct cvmx_rst_ctlx_s cn78xxp1; +struct cvmx_rst_ctlx_s cnf75xx; +}; + +typedef union cvmx_rst_ctlx cvmx_rst_ctlx_t ; + +/** +* cvmx_rst_soft_prst# +*/ +union cvmx_rst_soft_prstx { +u64 u64; +struct cvmx_rst_soft_prstx_s { +u64 reserved_1_63 :63 ; +u64 soft_prst :1 ; + } s; +struct cvmx_rst_soft_prstx_s cn70xx; +struct cvmx_rst_soft_prstx_s cn70xxp1; +struct cvmx_rst_soft_prstx_s cn73xx; +struct cvmx_rst_soft_prstx_s cn78xx; +struct cvmx_rst_soft_prstx_s cn78xxp1; +struct cvmx_rst_soft_prstx_s cnf75xx; +}; + +typedef union cvmx_rst_soft_prstx cvmx_rst_soft_prstx_t ; + +/** +* cvmx_rst_soft_rst +*/ +union cvmx_rst_soft_rst { +u64 u64; +struct cvmx_rst_soft_rst_s { +u64 reserved_1_63 :63 ; +u64 soft_rst :1 ; + } s; +struct cvmx_rst_soft_rst_s cn70xx; +struct cvmx_rst_soft_rst_s cn70xxp1; +struct cvmx_rst_soft_rst_s cn73xx; +struct cvmx_rst_soft_rst_s cn78xx; +struct cvmx_rst_soft_rst_s cn78xxp1; +struct cvmx_rst_soft_rst_s cnf75xx; +}; + +typedef union cvmx_rst_soft_rst cvmx_rst_soft_rst_t ; + +#endif
Signature · 1 line
2.29.2
PATCH 27/50 mips: octeon: Add cvmx-sata-defs.h header file
In reply to Stefan RoeseFrom: Aaron Williams <[email protected]>
Import cvmx-sata-defs.h header file from 2013 U-Boot. It will be used by the later added drivers to support PCIe and networking on the MIPS Octeon II / III platforms.
---
.../mach-octeon/include/mach/cvmx-sata-defs.h | 311 ++++++++++++++++++ 1 file changed, 311 insertions(+) create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-sata-defs.h
arch/mips/mach-octeon/include/mach/cvmx-sata-defs.h new file +311 -0
@@ -0,0 +1,311 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2020 Marvell International Ltd. +*/ + +#ifndef __CVMX_SATA_DEFS_H__ +#define __CVMX_SATA_DEFS_H__ + +#define CVMX_SATA_UCTL_CTL (0x000118006C000000ull) +#define CVMX_SATA_UCTL_SHIM_CFG (0x000118006C0000E8ull) +#define CVMX_SATA_UCTL_BIST_STATUS (0x000118006C000008ull) + +#define CVMX_SATA_UAHC_GBL_PI (0x00016C000000000Cull) +#define CVMX_SATA_UAHC_GBL_TIMER1MS (0x00016C00000000E0ull) +#define CVMX_SATA_UAHC_GBL_CAP (0x00016C0000000000ull) + +#define CVMX_SATA_UAHC_PX_CMD (offset) (0x00016C0000000118ull + ((offset) & 1) * 128) +#define CVMX_SATA_UAHC_PX_SCTL (offset) (0x00016C000000012Cull + ((offset) & 1) * 128) +#define CVMX_SATA_UAHC_PX_SERR (offset) (0x00016C0000000130ull + ((offset) & 1) * 128) +#define CVMX_SATA_UAHC_PX_IS (offset) (0x00016C0000000110ull + ((offset) & 1) * 128) +#define CVMX_SATA_UAHC_PX_SSTS (offset) (0x00016C0000000128ull + ((offset) & 1) * 128) +#define CVMX_SATA_UAHC_PX_TFD (offset) (0x00016C0000000120ull + ((offset) & 1) * 128) + +/** +* cvmx_sata_uctl_ctl +* +* This register controls clocks, resets, power, and BIST for the SATA. +* +* Accessible always. +* +* Reset by IOI reset. +*/ +union cvmx_sata_uctl_ctl { +u64 u64; +struct cvmx_sata_uctl_ctl_s { +u64 clear_bist :1 ; +u64 start_bist :1 ; +u64 reserved_31_61 :31 ; +u64 a_clk_en :1 ; +u64 a_clk_byp_sel :1 ; +u64 a_clkdiv_rst :1 ; +u64 reserved_27_27 :1 ; +u64 a_clkdiv_sel :3 ; +u64 reserved_5_23 :19 ; +u64 csclk_en :1 ; +u64 reserved_2_3 :2 ; +u64 sata_uahc_rst :1 ; +u64 sata_uctl_rst :1 ; + } s; +struct cvmx_sata_uctl_ctl_s cn70xx; +struct cvmx_sata_uctl_ctl_s cn70xxp1; +struct cvmx_sata_uctl_ctl_s cn73xx; +}; + +typedef union cvmx_sata_uctl_ctl cvmx_sata_uctl_ctl_t ; + +/** +* cvmx_sata_uctl_bist_status +* +* Results from BIST runs of SATA's memories. +* Wait for NDONE==0, then look at defect indication. +* +* Accessible always. +* +* Reset by IOI reset. +*/ +union cvmx_sata_uctl_bist_status { +u64 u64; +struct cvmx_sata_uctl_bist_status_s { +u64 reserved_42_63 :22 ; +u64 uctl_xm_r_bist_ndone :1 ; +u64 uctl_xm_w_bist_ndone :1 ; +u64 reserved_36_39 :4 ; +u64 uahc_p0_rxram_bist_ndone :1 ; +u64 uahc_p1_rxram_bist_ndone :1 ; +u64 uahc_p0_txram_bist_ndone :1 ; +u64 uahc_p1_txram_bist_ndone :1 ; +u64 reserved_10_31 :22 ; +u64 uctl_xm_r_bist_status :1 ; +u64 uctl_xm_w_bist_status :1 ; +u64 reserved_4_7 :4 ; +u64 uahc_p0_rxram_bist_status :1 ; +u64 uahc_p1_rxram_bist_status :1 ; +u64 uahc_p0_txram_bist_status :1 ; +u64 uahc_p1_txram_bist_status :1 ; + } s; +struct cvmx_sata_uctl_bist_status_s cn70xx; +struct cvmx_sata_uctl_bist_status_s cn70xxp1; +struct cvmx_sata_uctl_bist_status_s cn73xx; +}; + +typedef union cvmx_sata_uctl_bist_status cvmx_sata_uctl_bist_status_t ; + +/** +* cvmx_sata_uctl_shim_cfg +* +* This register allows configuration of various shim (UCTL) features. +* +* Fields XS_NCB_OOB_* are captured when there are no outstanding OOB errors indicated in INTSTAT +* and a new OOB error arrives. +* +* Fields XS_BAD_DMA_* are captured when there are no outstanding DMA errors indicated in INTSTAT +* and a new DMA error arrives. +* +* Accessible only when SATA_UCTL_CTL[A_CLK_EN]. +* +* Reset by IOI reset or SATA_UCTL_CTL[SATA_UCTL_RST]. +*/ +union cvmx_sata_uctl_shim_cfg { +u64 u64; +struct cvmx_sata_uctl_shim_cfg_s { +u64 xs_ncb_oob_wrn :1 ; +u64 reserved_60_62 :3 ; +u64 xs_ncb_oob_osrc :12 ; +u64 xm_bad_dma_wrn :1 ; +u64 reserved_44_46 :3 ; +u64 xm_bad_dma_type :4 ; +u64 reserved_14_39 :26 ; +u64 dma_read_cmd :2 ; +u64 reserved_11_11 :1 ; +u64 dma_write_cmd :1 ; +u64 dma_endian_mode :2 ; +u64 reserved_2_7 :6 ; +u64 csr_endian_mode :2 ; + } s; +struct cvmx_sata_uctl_shim_cfg_cn70xx { +u64 xs_ncb_oob_wrn :1 ; +u64 reserved_57_62 :6 ; +u64 xs_ncb_oob_osrc :9 ; +u64 xm_bad_dma_wrn :1 ; +u64 reserved_44_46 :3 ; +u64 xm_bad_dma_type :4 ; +u64 reserved_13_39 :27 ; +u64 dma_read_cmd :1 ; +u64 reserved_10_11 :2 ; +u64 dma_endian_mode :2 ; +u64 reserved_2_7 :6 ; +u64 csr_endian_mode :2 ; + } cn70xx; +struct cvmx_sata_uctl_shim_cfg_cn70xx cn70xxp1; +struct cvmx_sata_uctl_shim_cfg_s cn73xx; +}; + +typedef union cvmx_sata_uctl_shim_cfg cvmx_sata_uctl_shim_cfg_t ; + +/** +* cvmx_sata_uahc_gbl_cap +* +* See AHCI specification v1.3 section 3.1 +* +*/ +union cvmx_sata_uahc_gbl_cap { +u32 u32; +struct cvmx_sata_uahc_gbl_cap_s { +u32 s64a :1 ; +u32 sncq :1 ; +u32 ssntf :1 ; +u32 smps :1 ; +u32 sss :1 ; +u32 salp :1 ; +u32 sal :1 ; +u32 sclo :1 ; +u32 iss :4 ; +u32 snzo :1 ; +u32 sam :1 ; +u32 spm :1 ; +u32 fbss :1 ; +u32 pmd :1 ; +u32 ssc :1 ; +u32 psc :1 ; +u32 ncs :5 ; +u32 cccs :1 ; +u32 ems :1 ; +u32 sxs :1 ; +u32 np :5 ; + } s; +struct cvmx_sata_uahc_gbl_cap_s cn70xx; +struct cvmx_sata_uahc_gbl_cap_s cn70xxp1; +struct cvmx_sata_uahc_gbl_cap_s cn73xx; +}; + +typedef union cvmx_sata_uahc_gbl_cap cvmx_sata_uahc_gbl_cap_t ; + +/** +* cvmx_sata_uahc_p#_sctl +*/ +union cvmx_sata_uahc_px_sctl { +u32 u32; +struct cvmx_sata_uahc_px_sctl_s { +u32 reserved_10_31 :22 ; +u32 ipm :2 ; +u32 reserved_6_7 :2 ; +u32 spd :2 ; +u32 reserved_3_3 :1 ; +u32 det :3 ; + } s; +struct cvmx_sata_uahc_px_sctl_s cn70xx; +struct cvmx_sata_uahc_px_sctl_s cn70xxp1; +struct cvmx_sata_uahc_px_sctl_s cn73xx; +}; + +typedef union cvmx_sata_uahc_px_sctl cvmx_sata_uahc_px_sctl_t ; + +/** +* cvmx_sata_uahc_p#_cmd +*/ +union cvmx_sata_uahc_px_cmd { +u32 u32; +struct cvmx_sata_uahc_px_cmd_s { +u32 icc :4 ; +u32 asp :1 ; +u32 alpe :1 ; +u32 dlae :1 ; +u32 atapi :1 ; +u32 apste :1 ; +u32 fbscp :1 ; +u32 esp :1 ; +u32 cpd :1 ; +u32 mpsp :1 ; +u32 hpcp :1 ; +u32 pma :1 ; +u32 cps :1 ; +u32 cr :1 ; +u32 fr :1 ; +u32 mpss :1 ; +u32 ccs :5 ; +u32 reserved_5_7 :3 ; +u32 fre :1 ; +u32 clo :1 ; +u32 pod :1 ; +u32 sud :1 ; +u32 st :1 ; + } s; +struct cvmx_sata_uahc_px_cmd_s cn70xx; +struct cvmx_sata_uahc_px_cmd_s cn70xxp1; +struct cvmx_sata_uahc_px_cmd_s cn73xx; +}; + +typedef union cvmx_sata_uahc_px_cmd cvmx_sata_uahc_px_cmd_t ; + +/** +* cvmx_sata_uahc_gbl_pi +* +* See AHCI specification v1.3 section 3.1. +* +*/ +union cvmx_sata_uahc_gbl_pi { +u32 u32; +struct cvmx_sata_uahc_gbl_pi_s { +u32 reserved_2_31 :30 ; +u32 pi :2 ; + } s; +struct cvmx_sata_uahc_gbl_pi_s cn70xx; +struct cvmx_sata_uahc_gbl_pi_s cn70xxp1; +struct cvmx_sata_uahc_gbl_pi_s cn73xx; +}; + +typedef union cvmx_sata_uahc_gbl_pi cvmx_sata_uahc_gbl_pi_t ; + +/** +* cvmx_sata_uahc_p#_ssts +*/ +union cvmx_sata_uahc_px_ssts { +u32 u32; +struct cvmx_sata_uahc_px_ssts_s { +u32 reserved_12_31 :20 ; +u32 ipm :4 ; +u32 spd :4 ; +u32 det :4 ; + } s; +struct cvmx_sata_uahc_px_ssts_s cn70xx; +struct cvmx_sata_uahc_px_ssts_s cn70xxp1; +struct cvmx_sata_uahc_px_ssts_s cn73xx; +}; + +typedef union cvmx_sata_uahc_px_ssts cvmx_sata_uahc_px_ssts_t ; + +/** +* cvmx_sata_uahc_p#_tfd +*/ +union cvmx_sata_uahc_px_tfd { +u32 u32; +struct cvmx_sata_uahc_px_tfd_s { +u32 reserved_16_31 :16 ; +u32 tferr :8 ; +u32 sts :8 ; + } s; +struct cvmx_sata_uahc_px_tfd_s cn70xx; +struct cvmx_sata_uahc_px_tfd_s cn70xxp1; +struct cvmx_sata_uahc_px_tfd_s cn73xx; +}; + +typedef union cvmx_sata_uahc_px_tfd cvmx_sata_uahc_px_tfd_t ; + +/** +* cvmx_sata_uahc_gbl_timer1ms +*/ +union cvmx_sata_uahc_gbl_timer1ms { +u32 u32; +struct cvmx_sata_uahc_gbl_timer1ms_s { +u32 reserved_20_31 :12 ; +u32 timv :20 ; + } s; +struct cvmx_sata_uahc_gbl_timer1ms_s cn70xx; +struct cvmx_sata_uahc_gbl_timer1ms_s cn70xxp1; +struct cvmx_sata_uahc_gbl_timer1ms_s cn73xx; +}; + +typedef union cvmx_sata_uahc_gbl_timer1ms cvmx_sata_uahc_gbl_timer1ms_t ; + +#endif
Signature · 1 line
2.29.2
PATCH 28/50 mips: octeon: Add cvmx-sli-defs.h header file
In reply to Stefan RoeseFrom: Aaron Williams <[email protected]>
Import cvmx-sli-defs.h header file from 2013 U-Boot. It will be used by the later added drivers to support PCIe and networking on the MIPS Octeon II / III platforms.
---
.../mach-octeon/include/mach/cvmx-sli-defs.h | 6548 +++++++++++++++++ 1 file changed, 6548 insertions(+) create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-sli-defs.h
arch/mips/mach-octeon/include/mach/cvmx-sli-defs.h new file +6548 -0
@@ -0,0 +1,6548 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2020 Marvell International Ltd. +* +* Configuration and status register (CSR) type definitions for +* Octeon sli. +*/ + +#ifndef __CVMX_SLI_DEFS_H__ +#define __CVMX_SLI_DEFS_H__ + +#define CVMX_SLI_BIST_STATUS CVMX_SLI_BIST_STATUS_FUNC() +static inline u64 CVMX_SLI_BIST_STATUS_FUNC (void ) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CNF71XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x0000000000000580ull ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0000000000000580ull ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x0000000000028580ull ; +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x0000000000028580ull ; + } +return 0x0000000000028580ull ; +} + +#define CVMX_SLI_CIU_INT_ENB (0x00011F0000027110ull) +#define CVMX_SLI_CIU_INT_SUM (0x00011F0000027100ull) +static inline u64 CVMX_SLI_CTL_PORTX (unsigned long offset) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +case OCTEON_CNF71XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x0000000000000050ull + (offset) *16 ; +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +return 0x0000000000010050ull + (offset) *16 ; +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +return 0x0000000000000050ull + (offset) *16 ; + +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x00000000000006E0ull + (offset) *16 ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x00000000000286E0ull + (offset) *16 ; +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x00000000000286E0ull + (offset) *16 ; + } +return 0x00000000000286E0ull + (offset) *16 ; +} + +#define CVMX_SLI_CTL_STATUS CVMX_SLI_CTL_STATUS_FUNC() +static inline u64 CVMX_SLI_CTL_STATUS_FUNC (void ) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CNF71XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x0000000000000570ull ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0000000000000570ull ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x0000000000028570ull ; +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x0000000000028570ull ; + } +return 0x0000000000028570ull ; +} + +#define CVMX_SLI_DATA_OUT_CNT CVMX_SLI_DATA_OUT_CNT_FUNC() +static inline u64 CVMX_SLI_DATA_OUT_CNT_FUNC (void ) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CNF71XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x00000000000005F0ull ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x00000000000005F0ull ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x00000000000285F0ull ; +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x00000000000285F0ull ; + } +return 0x00000000000285F0ull ; +} + +#define CVMX_SLI_DBG_DATA (0x0000000000000310ull) +#define CVMX_SLI_DBG_SELECT (0x0000000000000300ull) +static inline u64 CVMX_SLI_DMAX_CNT (unsigned long offset) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CNF71XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x0000000000000400ull + (offset) *16 ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0000000000000400ull + (offset) *16 ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x0000000000028400ull + (offset) *16 ; +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x0000000000028400ull + (offset) *16 ; + } +return 0x0000000000028400ull + (offset) *16 ; +} + +static inline u64 CVMX_SLI_DMAX_INT_LEVEL (unsigned long offset) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CNF71XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x00000000000003E0ull + (offset) *16 ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x00000000000003E0ull + (offset) *16 ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x00000000000283E0ull + (offset) *16 ; +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x00000000000283E0ull + (offset) *16 ; + } +return 0x00000000000283E0ull + (offset) *16 ; +} + +static inline u64 CVMX_SLI_DMAX_TIM (unsigned long offset) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CNF71XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x0000000000000420ull + (offset) *16 ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0000000000000420ull + (offset) *16 ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x0000000000028420ull + (offset) *16 ; +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x0000000000028420ull + (offset) *16 ; + } +return 0x0000000000028420ull + (offset) *16 ; +} + +#define CVMX_SLI_INT_ENB_CIU (0x0000000000003CD0ull) +#define CVMX_SLI_INT_ENB_PORTX (offset) (0x0000000000000340ull + ((offset) & 3) * 16) +#define CVMX_SLI_INT_SUM (0x0000000000000330ull) +#define CVMX_SLI_LAST_WIN_RDATA0 (0x0000000000000600ull) +#define CVMX_SLI_LAST_WIN_RDATA1 (0x0000000000000610ull) +#define CVMX_SLI_LAST_WIN_RDATA2 (0x00000000000006C0ull) +#define CVMX_SLI_LAST_WIN_RDATA3 (0x00000000000006D0ull) +#define CVMX_SLI_MACX_PFX_DMA_VF_INT (offset, block_id) \ + (0x0000000000027280ull + (((offset) & 1) + ((block_id) & 3) * 0x2ull) * 16) +#define CVMX_SLI_MACX_PFX_DMA_VF_INT_ENB (offset, block_id) \ + (0x0000000000027500ull + (((offset) & 1) + ((block_id) & 3) * 0x2ull) * 16) +#define CVMX_SLI_MACX_PFX_FLR_VF_INT (offset, block_id) \ + (0x0000000000027400ull + (((offset) & 1) + ((block_id) & 3) * 0x2ull) * 16) +#define CVMX_SLI_MACX_PFX_INT_ENB (offset, block_id) \ + (0x0000000000027080ull + (((offset) & 1) + ((block_id) & 3) * 0x2ull) * 16) +#define CVMX_SLI_MACX_PFX_INT_SUM (offset, block_id) \ + (0x0000000000027000ull + (((offset) & 1) + ((block_id) & 3) * 0x2ull) * 16) +#define CVMX_SLI_MACX_PFX_MBOX_INT (offset, block_id) \ + (0x0000000000027380ull + (((offset) & 1) + ((block_id) & 3) * 0x2ull) * 16) +#define CVMX_SLI_MACX_PFX_PKT_VF_INT (offset, block_id) \ + (0x0000000000027300ull + (((offset) & 1) + ((block_id) & 3) * 0x2ull) * 16) +#define CVMX_SLI_MACX_PFX_PKT_VF_INT_ENB (offset, block_id) \ + (0x0000000000027580ull + (((offset) & 1) + ((block_id) & 3) * 0x2ull) * 16) +#define CVMX_SLI_MACX_PFX_PP_VF_INT (offset, block_id) \ + (0x0000000000027200ull + (((offset) & 1) + ((block_id) & 3) * 0x2ull) * 16) +#define CVMX_SLI_MACX_PFX_PP_VF_INT_ENB (offset, block_id) \ + (0x0000000000027480ull + (((offset) & 1) + ((block_id) & 3) * 0x2ull) * 16) +#define CVMX_SLI_MAC_CREDIT_CNT CVMX_SLI_MAC_CREDIT_CNT_FUNC() +static inline u64 CVMX_SLI_MAC_CREDIT_CNT_FUNC (void ) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CNF71XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x0000000000003D70ull ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0000000000003D70ull ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x0000000000023D70ull ; +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x0000000000023D70ull ; + } +return 0x0000000000023D70ull ; +} + +#define CVMX_SLI_MAC_CREDIT_CNT2 CVMX_SLI_MAC_CREDIT_CNT2_FUNC() +static inline u64 CVMX_SLI_MAC_CREDIT_CNT2_FUNC (void ) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CNF71XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +return 0x0000000000013E10ull ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0000000000003E10ull ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x0000000000023E10ull ; +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x0000000000023E10ull ; + } +return 0x0000000000023E10ull ; +} + +#define CVMX_SLI_MAC_NUMBER CVMX_SLI_MAC_NUMBER_FUNC() +static inline u64 CVMX_SLI_MAC_NUMBER_FUNC (void ) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CNF71XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x0000000000003E00ull ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0000000000003E00ull ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x0000000000020050ull ; +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x0000000000020050ull ; + } +return 0x0000000000020050ull ; +} + +#define CVMX_SLI_MEM_ACCESS_CTL CVMX_SLI_MEM_ACCESS_CTL_FUNC() +static inline u64 CVMX_SLI_MEM_ACCESS_CTL_FUNC (void ) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CNF71XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x00000000000002F0ull ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x00000000000002F0ull ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x00000000000282F0ull ; +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x00000000000282F0ull ; + } +return 0x00000000000282F0ull ; +} + +static inline u64 CVMX_SLI_MEM_ACCESS_SUBIDX (unsigned long offset) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CNF71XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x00000000000000E0ull + (offset) *16 -16 *12 ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x00000000000000E0ull + (offset) *16 -16 *12 ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x00000000000280E0ull + (offset) *16 -16 *12 ; +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x00000000000280E0ull + (offset) *16 -16 *12 ; + } +return 0x00000000000280E0ull + (offset) *16 -16 *12 ; +} + +#define CVMX_SLI_MEM_CTL CVMX_SLI_MEM_CTL_FUNC() +static inline u64 CVMX_SLI_MEM_CTL_FUNC (void ) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x00000000000005E0ull ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x00000000000285E0ull ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x00000000000285E0ull ; + } +return 0x00000000000285E0ull ; +} + +#define CVMX_SLI_MEM_INT_SUM CVMX_SLI_MEM_INT_SUM_FUNC() +static inline u64 CVMX_SLI_MEM_INT_SUM_FUNC (void ) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x00000000000005D0ull ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x00000000000285D0ull ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x00000000000285D0ull ; + } +return 0x00000000000285D0ull ; +} + +static inline u64 CVMX_SLI_MSIXX_TABLE_ADDR (unsigned long offset) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0000000000006000ull + (offset) *16 ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x0000000000000000ull + (offset) *16 ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x0000000000000000ull + (offset) *16 ; + } +return 0x0000000000000000ull + (offset) *16 ; +} + +static inline u64 CVMX_SLI_MSIXX_TABLE_DATA (unsigned long offset) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0000000000006008ull + (offset) *16 ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x0000000000000008ull + (offset) *16 ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x0000000000000008ull + (offset) *16 ; + } +return 0x0000000000000008ull + (offset) *16 ; +} + +#define CVMX_SLI_MSIX_MACX_PF_TABLE_ADDR (offset) (0x0000000000007C00ull + ((offset) & 3) * 16) +#define CVMX_SLI_MSIX_MACX_PF_TABLE_DATA (offset) (0x0000000000007C08ull + ((offset) & 3) * 16) +#define CVMX_SLI_MSIX_PBA0 CVMX_SLI_MSIX_PBA0_FUNC() +static inline u64 CVMX_SLI_MSIX_PBA0_FUNC (void ) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0000000000007000ull ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x0000000000001000ull ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x0000000000001000ull ; + } +return 0x0000000000001000ull ; +} + +#define CVMX_SLI_MSIX_PBA1 CVMX_SLI_MSIX_PBA1_FUNC() +static inline u64 CVMX_SLI_MSIX_PBA1_FUNC (void ) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0000000000007010ull ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x0000000000001008ull ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x0000000000001008ull ; + } +return 0x0000000000001008ull ; +} + +#define CVMX_SLI_MSI_ENB0 (0x0000000000003C50ull) +#define CVMX_SLI_MSI_ENB1 (0x0000000000003C60ull) +#define CVMX_SLI_MSI_ENB2 (0x0000000000003C70ull) +#define CVMX_SLI_MSI_ENB3 (0x0000000000003C80ull) +#define CVMX_SLI_MSI_RCV0 CVMX_SLI_MSI_RCV0_FUNC() +static inline u64 CVMX_SLI_MSI_RCV0_FUNC (void ) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CNF71XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x0000000000003C10ull ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0000000000003C10ull ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x0000000000023C10ull ; +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x0000000000023C10ull ; + } +return 0x0000000000023C10ull ; +} + +#define CVMX_SLI_MSI_RCV1 CVMX_SLI_MSI_RCV1_FUNC() +static inline u64 CVMX_SLI_MSI_RCV1_FUNC (void ) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CNF71XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x0000000000003C20ull ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0000000000003C20ull ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x0000000000023C20ull ; +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x0000000000023C20ull ; + } +return 0x0000000000023C20ull ; +} + +#define CVMX_SLI_MSI_RCV2 CVMX_SLI_MSI_RCV2_FUNC() +static inline u64 CVMX_SLI_MSI_RCV2_FUNC (void ) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CNF71XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x0000000000003C30ull ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0000000000003C30ull ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x0000000000023C30ull ; +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x0000000000023C30ull ; + } +return 0x0000000000023C30ull ; +} + +#define CVMX_SLI_MSI_RCV3 CVMX_SLI_MSI_RCV3_FUNC() +static inline u64 CVMX_SLI_MSI_RCV3_FUNC (void ) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CNF71XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x0000000000003C40ull ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0000000000003C40ull ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x0000000000023C40ull ; +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x0000000000023C40ull ; + } +return 0x0000000000023C40ull ; +} + +#define CVMX_SLI_MSI_RD_MAP CVMX_SLI_MSI_RD_MAP_FUNC() +static inline u64 CVMX_SLI_MSI_RD_MAP_FUNC (void ) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CNF71XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x0000000000003CA0ull ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0000000000003CA0ull ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x0000000000023CA0ull ; +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x0000000000023CA0ull ; + } +return 0x0000000000023CA0ull ; +} + +#define CVMX_SLI_MSI_W1C_ENB0 (0x0000000000003CF0ull) +#define CVMX_SLI_MSI_W1C_ENB1 (0x0000000000003D00ull) +#define CVMX_SLI_MSI_W1C_ENB2 (0x0000000000003D10ull) +#define CVMX_SLI_MSI_W1C_ENB3 (0x0000000000003D20ull) +#define CVMX_SLI_MSI_W1S_ENB0 (0x0000000000003D30ull) +#define CVMX_SLI_MSI_W1S_ENB1 (0x0000000000003D40ull) +#define CVMX_SLI_MSI_W1S_ENB2 (0x0000000000003D50ull) +#define CVMX_SLI_MSI_W1S_ENB3 (0x0000000000003D60ull) +#define CVMX_SLI_MSI_WR_MAP CVMX_SLI_MSI_WR_MAP_FUNC() +static inline u64 CVMX_SLI_MSI_WR_MAP_FUNC (void ) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CNF71XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x0000000000003C90ull ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0000000000003C90ull ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x0000000000023C90ull ; +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x0000000000023C90ull ; + } +return 0x0000000000023C90ull ; +} + +#define CVMX_SLI_NQM_RSP_ERR_SND_DBG (0x00011F0000028800ull) +#define CVMX_SLI_PCIE_MSI_RCV CVMX_SLI_PCIE_MSI_RCV_FUNC() +static inline u64 CVMX_SLI_PCIE_MSI_RCV_FUNC (void ) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CNF71XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x0000000000003CB0ull ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0000000000003CB0ull ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x0000000000023CB0ull ; +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x0000000000023CB0ull ; + } +return 0x0000000000023CB0ull ; +} + +#define CVMX_SLI_PCIE_MSI_RCV_B1 CVMX_SLI_PCIE_MSI_RCV_B1_FUNC() +static inline u64 CVMX_SLI_PCIE_MSI_RCV_B1_FUNC (void ) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CNF71XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x0000000000000650ull ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0000000000000650ull ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x0000000000028650ull ; +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x0000000000028650ull ; + } +return 0x0000000000028650ull ; +} + +#define CVMX_SLI_PCIE_MSI_RCV_B2 CVMX_SLI_PCIE_MSI_RCV_B2_FUNC() +static inline u64 CVMX_SLI_PCIE_MSI_RCV_B2_FUNC (void ) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CNF71XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x0000000000000660ull ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0000000000000660ull ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x0000000000028660ull ; +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x0000000000028660ull ; + } +return 0x0000000000028660ull ; +} + +#define CVMX_SLI_PCIE_MSI_RCV_B3 CVMX_SLI_PCIE_MSI_RCV_B3_FUNC() +static inline u64 CVMX_SLI_PCIE_MSI_RCV_B3_FUNC (void ) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CNF71XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x0000000000000670ull ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0000000000000670ull ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x0000000000028670ull ; +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x0000000000028670ull ; + } +return 0x0000000000028670ull ; +} + +static inline u64 CVMX_SLI_PKTX_CNTS (unsigned long offset) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CNF71XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x0000000000002400ull + (offset) *16 ; + +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0000000000002400ull + (offset) *16 ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x00000000000100B0ull + (offset) *0x20000ull ; +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x00000000000100B0ull + (offset) *0x20000ull ; + } +return 0x00000000000100B0ull + (offset) *0x20000ull ; +} + +#define CVMX_SLI_PKTX_ERROR_INFO (offset) (0x00000000000100C0ull + ((offset) & 63) * 0x20000ull) +static inline u64 CVMX_SLI_PKTX_INPUT_CONTROL (unsigned long offset) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0000000000004000ull + (offset) *16 ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x0000000000010000ull + (offset) *0x20000ull ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x0000000000010000ull + (offset) *0x20000ull ; + } +return 0x0000000000010000ull + (offset) *0x20000ull ; +} + +static inline u64 CVMX_SLI_PKTX_INSTR_BADDR (unsigned long offset) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CNF71XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x0000000000002800ull + (offset) *16 ; + +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0000000000002800ull + (offset) *16 ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x0000000000010010ull + (offset) *0x20000ull ; +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x0000000000010010ull + (offset) *0x20000ull ; + } +return 0x0000000000010010ull + (offset) *0x20000ull ; +} + +static inline u64 CVMX_SLI_PKTX_INSTR_BAOFF_DBELL (unsigned long offset) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CNF71XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x0000000000002C00ull + (offset) *16 ; + +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0000000000002C00ull + (offset) *16 ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x0000000000010020ull + (offset) *0x20000ull ; +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x0000000000010020ull + (offset) *0x20000ull ; + } +return 0x0000000000010020ull + (offset) *0x20000ull ; +} + +static inline u64 CVMX_SLI_PKTX_INSTR_FIFO_RSIZE (unsigned long offset) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CNF71XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x0000000000003000ull + (offset) *16 ; + +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0000000000003000ull + (offset) *16 ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x0000000000010030ull + (offset) *0x20000ull ; +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x0000000000010030ull + (offset) *0x20000ull ; + } +return 0x0000000000010030ull + (offset) *0x20000ull ; +} + +#define CVMX_SLI_PKTX_INSTR_HEADER (offset) (0x0000000000003400ull + ((offset) & 31) * 16) +static inline u64 CVMX_SLI_PKTX_INT_LEVELS (unsigned long offset) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0000000000004400ull + (offset) *16 ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x00000000000100A0ull + (offset) *0x20000ull ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x00000000000100A0ull + (offset) *0x20000ull ; + } +return 0x00000000000100A0ull + (offset) *0x20000ull ; +} + +#define CVMX_SLI_PKTX_IN_BP (offset) (0x0000000000003800ull + ((offset) & 31) * 16) +#define CVMX_SLI_PKTX_MBOX_INT (offset) (0x0000000000010210ull + ((offset) & 63) * 0x20000ull) +static inline u64 CVMX_SLI_PKTX_OUTPUT_CONTROL (unsigned long offset) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0000000000004800ull + (offset) *16 ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x0000000000010050ull + (offset) *0x20000ull ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x0000000000010050ull + (offset) *0x20000ull ; + } +return 0x0000000000010050ull + (offset) *0x20000ull ; +} + +static inline u64 CVMX_SLI_PKTX_OUT_SIZE (unsigned long offset) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CNF71XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x0000000000000C00ull + (offset) *16 ; + +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0000000000000C00ull + (offset) *16 ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x0000000000010060ull + (offset) *0x20000ull ; +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x0000000000010060ull + (offset) *0x20000ull ; + } +return 0x0000000000010060ull + (offset) *0x20000ull ; +} + +#define CVMX_SLI_PKTX_PF_VF_MBOX_SIGX (offset, block_id) \ + (0x0000000000010200ull + (((offset) & 1) + ((block_id) & 63) * 0x4000ull) * 8) +static inline u64 CVMX_SLI_PKTX_SLIST_BADDR (unsigned long offset) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CNF71XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x0000000000001400ull + (offset) *16 ; + +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0000000000001400ull + (offset) *16 ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x0000000000010070ull + (offset) *0x20000ull ; +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x0000000000010070ull + (offset) *0x20000ull ; + } +return 0x0000000000010070ull + (offset) *0x20000ull ; +} + +static inline u64 CVMX_SLI_PKTX_SLIST_BAOFF_DBELL (unsigned long offset) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CNF71XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x0000000000001800ull + (offset) *16 ; + +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0000000000001800ull + (offset) *16 ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x0000000000010080ull + (offset) *0x20000ull ; +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x0000000000010080ull + (offset) *0x20000ull ; + } +return 0x0000000000010080ull + (offset) *0x20000ull ; +} + +static inline u64 CVMX_SLI_PKTX_SLIST_FIFO_RSIZE (unsigned long offset) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CNF71XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x0000000000001C00ull + (offset) *16 ; + +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0000000000001C00ull + (offset) *16 ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x0000000000010090ull + (offset) *0x20000ull ; +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x0000000000010090ull + (offset) *0x20000ull ; + } +return 0x0000000000010090ull + (offset) *0x20000ull ; +} + +#define CVMX_SLI_PKTX_VF_INT_SUM (offset) (0x00000000000100D0ull + ((offset) & 63) * 0x20000ull) +#define CVMX_SLI_PKTX_VF_SIG (offset) (0x0000000000004C00ull + ((offset) & 63) * 16) +#define CVMX_SLI_PKT_BIST_STATUS (0x0000000000029220ull) +#define CVMX_SLI_PKT_CNT_INT CVMX_SLI_PKT_CNT_INT_FUNC() +static inline u64 CVMX_SLI_PKT_CNT_INT_FUNC (void ) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CNF71XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x0000000000001130ull ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0000000000001130ull ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x0000000000029130ull ; +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x0000000000029130ull ; + } +return 0x0000000000029130ull ; +} + +#define CVMX_SLI_PKT_CNT_INT_ENB (0x0000000000001150ull) +#define CVMX_SLI_PKT_CTL (0x0000000000001220ull) +#define CVMX_SLI_PKT_DATA_OUT_ES (0x00000000000010B0ull) +#define CVMX_SLI_PKT_DATA_OUT_NS (0x00000000000010A0ull) +#define CVMX_SLI_PKT_DATA_OUT_ROR (0x0000000000001090ull) +#define CVMX_SLI_PKT_DPADDR (0x0000000000001080ull) +#define CVMX_SLI_PKT_GBL_CONTROL (0x0000000000029210ull) +#define CVMX_SLI_PKT_INPUT_CONTROL (0x0000000000001170ull) +#define CVMX_SLI_PKT_INSTR_ENB (0x0000000000001000ull) +#define CVMX_SLI_PKT_INSTR_RD_SIZE (0x00000000000011A0ull) +#define CVMX_SLI_PKT_INSTR_SIZE (0x0000000000001020ull) +#define CVMX_SLI_PKT_INT CVMX_SLI_PKT_INT_FUNC() +static inline u64 CVMX_SLI_PKT_INT_FUNC (void ) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0000000000001160ull ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x0000000000029160ull ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x0000000000029160ull ; + } +return 0x0000000000029160ull ; +} + +#define CVMX_SLI_PKT_INT_LEVELS (0x0000000000001120ull) +#define CVMX_SLI_PKT_IN_BP (0x0000000000001210ull) +static inline u64 CVMX_SLI_PKT_IN_DONEX_CNTS (unsigned long offset) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CNF71XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x0000000000002000ull + (offset) *16 ; + +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0000000000002000ull + (offset) *16 ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x0000000000010040ull + (offset) *0x20000ull ; +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x0000000000010040ull + (offset) *0x20000ull ; + } +return 0x0000000000010040ull + (offset) *0x20000ull ; +} + +#define CVMX_SLI_PKT_IN_INSTR_COUNTS CVMX_SLI_PKT_IN_INSTR_COUNTS_FUNC() +static inline u64 CVMX_SLI_PKT_IN_INSTR_COUNTS_FUNC (void ) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CNF71XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x0000000000001200ull ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0000000000001200ull ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x0000000000029200ull ; +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x0000000000029200ull ; + } +return 0x0000000000029200ull ; +} + +#define CVMX_SLI_PKT_IN_INT CVMX_SLI_PKT_IN_INT_FUNC() +static inline u64 CVMX_SLI_PKT_IN_INT_FUNC (void ) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0000000000001150ull ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x0000000000029150ull ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x0000000000029150ull ; + } +return 0x0000000000029150ull ; +} + +#define CVMX_SLI_PKT_IN_JABBER (0x0000000000029170ull) +#define CVMX_SLI_PKT_IN_PCIE_PORT (0x00000000000011B0ull) +#define CVMX_SLI_PKT_IPTR (0x0000000000001070ull) +#define CVMX_SLI_PKT_MAC0_SIG0 (0x0000000000001300ull) +#define CVMX_SLI_PKT_MAC0_SIG1 (0x0000000000001310ull) +#define CVMX_SLI_PKT_MAC1_SIG0 (0x0000000000001320ull) +#define CVMX_SLI_PKT_MAC1_SIG1 (0x0000000000001330ull) +#define CVMX_SLI_PKT_MACX_PFX_RINFO (offset, block_id) \ + (0x0000000000029030ull + (((offset) & 1) + ((block_id) & 3) * 0x2ull) * 16) +#define CVMX_SLI_PKT_MACX_RINFO (offset) (0x0000000000001030ull + ((offset) & 3) * 16) +#define CVMX_SLI_PKT_MEM_CTL CVMX_SLI_PKT_MEM_CTL_FUNC() +static inline u64 CVMX_SLI_PKT_MEM_CTL_FUNC (void ) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0000000000001120ull ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x0000000000029120ull ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x0000000000029120ull ; + } +return 0x0000000000029120ull ; +} + +#define CVMX_SLI_PKT_OUTPUT_WMARK CVMX_SLI_PKT_OUTPUT_WMARK_FUNC() +static inline u64 CVMX_SLI_PKT_OUTPUT_WMARK_FUNC (void ) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CNF71XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x0000000000001180ull ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0000000000001180ull ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x0000000000029180ull ; +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x0000000000029180ull ; + } +return 0x0000000000029180ull ; +} + +#define CVMX_SLI_PKT_OUT_BMODE (0x00000000000010D0ull) +#define CVMX_SLI_PKT_OUT_BP_EN (0x0000000000001240ull) +#define CVMX_SLI_PKT_OUT_BP_EN2_W1C (0x0000000000029290ull) +#define CVMX_SLI_PKT_OUT_BP_EN2_W1S (0x0000000000029270ull) +#define CVMX_SLI_PKT_OUT_BP_EN_W1C (0x0000000000029280ull) +#define CVMX_SLI_PKT_OUT_BP_EN_W1S (0x0000000000029260ull) +#define CVMX_SLI_PKT_OUT_ENB (0x0000000000001010ull) +#define CVMX_SLI_PKT_PCIE_PORT (0x00000000000010E0ull) +#define CVMX_SLI_PKT_PKIND_VALID (0x0000000000029190ull) +#define CVMX_SLI_PKT_PORT_IN_RST (0x00000000000011F0ull) +#define CVMX_SLI_PKT_RING_RST CVMX_SLI_PKT_RING_RST_FUNC() +static inline u64 CVMX_SLI_PKT_RING_RST_FUNC (void ) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x00000000000011E0ull ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x00000000000291E0ull ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x00000000000291E0ull ; + } +return 0x00000000000291E0ull ; +} + +#define CVMX_SLI_PKT_SLIST_ES (0x0000000000001050ull) +#define CVMX_SLI_PKT_SLIST_NS (0x0000000000001040ull) +#define CVMX_SLI_PKT_SLIST_ROR (0x0000000000001030ull) +#define CVMX_SLI_PKT_TIME_INT CVMX_SLI_PKT_TIME_INT_FUNC() +static inline u64 CVMX_SLI_PKT_TIME_INT_FUNC (void ) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CNF71XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x0000000000001140ull ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0000000000001140ull ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x0000000000029140ull ; +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x0000000000029140ull ; + } +return 0x0000000000029140ull ; +} + +#define CVMX_SLI_PKT_TIME_INT_ENB (0x0000000000001160ull) +#define CVMX_SLI_PORTX_PKIND (offset) (0x0000000000000800ull + ((offset) & 31) * 16) +#define CVMX_SLI_PP_PKT_CSR_CONTROL (0x00011F00000282D0ull) +#define CVMX_SLI_S2C_END_MERGE CVMX_SLI_S2C_END_MERGE_FUNC() +static inline u64 CVMX_SLI_S2C_END_MERGE_FUNC (void ) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x00011F0000015000ull ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x00011F0000025000ull ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x00011F0000025000ull ; + } +return 0x00011F0000025000ull ; +} + +static inline u64 CVMX_SLI_S2M_PORTX_CTL (unsigned long offset) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +case OCTEON_CNF71XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x0000000000003D80ull + (offset) *16 ; +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +return 0x0000000000003D80ull + (offset) *16 ; +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +return 0x0000000000013D80ull + (offset) *16 ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0000000000003D80ull + (offset) *16 ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x0000000000023D80ull + (offset) *16 ; +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x0000000000023D80ull + (offset) *16 ; + } +return 0x0000000000023D80ull + (offset) *16 ; +} + +#define CVMX_SLI_SCRATCH_1 CVMX_SLI_SCRATCH_1_FUNC() +static inline u64 CVMX_SLI_SCRATCH_1_FUNC (void ) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CNF71XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x00000000000003C0ull ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x00000000000003C0ull ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x00000000000283C0ull ; +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x00000000000283C0ull ; + } +return 0x00000000000283C0ull ; +} + +#define CVMX_SLI_SCRATCH_2 CVMX_SLI_SCRATCH_2_FUNC() +static inline u64 CVMX_SLI_SCRATCH_2_FUNC (void ) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CNF71XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x00000000000003D0ull ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x00000000000003D0ull ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x00000000000283D0ull ; +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x00000000000283D0ull ; + } +return 0x00000000000283D0ull ; +} + +#define CVMX_SLI_STATE1 CVMX_SLI_STATE1_FUNC() +static inline u64 CVMX_SLI_STATE1_FUNC (void ) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CNF71XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x0000000000000620ull ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0000000000000620ull ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x0000000000028620ull ; +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x0000000000028620ull ; + } +return 0x0000000000028620ull ; +} + +#define CVMX_SLI_STATE2 CVMX_SLI_STATE2_FUNC() +static inline u64 CVMX_SLI_STATE2_FUNC (void ) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CNF71XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x0000000000000630ull ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0000000000000630ull ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x0000000000028630ull ; +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x0000000000028630ull ; + } +return 0x0000000000028630ull ; +} + +#define CVMX_SLI_STATE3 CVMX_SLI_STATE3_FUNC() +static inline u64 CVMX_SLI_STATE3_FUNC (void ) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CNF71XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x0000000000000640ull ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0000000000000640ull ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x0000000000028640ull ; +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x0000000000028640ull ; + } +return 0x0000000000028640ull ; +} + +#define CVMX_SLI_TX_PIPE (0x0000000000001230ull) +#define CVMX_SLI_WINDOW_CTL CVMX_SLI_WINDOW_CTL_FUNC() +static inline u64 CVMX_SLI_WINDOW_CTL_FUNC (void ) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CNF71XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x00000000000002E0ull ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x00000000000002E0ull ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x00000000000282E0ull ; +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x00000000000282E0ull ; + } +return 0x00000000000282E0ull ; +} + +#define CVMX_SLI_WIN_RD_ADDR CVMX_SLI_WIN_RD_ADDR_FUNC() +static inline u64 CVMX_SLI_WIN_RD_ADDR_FUNC (void ) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CNF71XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x0000000000000010ull ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0000000000000010ull ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x0000000000020010ull ; +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x0000000000020010ull ; + } +return 0x0000000000020010ull ; +} + +#define CVMX_SLI_WIN_RD_DATA CVMX_SLI_WIN_RD_DATA_FUNC() +static inline u64 CVMX_SLI_WIN_RD_DATA_FUNC (void ) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CNF71XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x0000000000000040ull ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0000000000000040ull ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x0000000000020040ull ; +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x0000000000020040ull ; + } +return 0x0000000000020040ull ; +} + +#define CVMX_SLI_WIN_WR_ADDR CVMX_SLI_WIN_WR_ADDR_FUNC() +static inline u64 CVMX_SLI_WIN_WR_ADDR_FUNC (void ) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CNF71XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x0000000000000000ull ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0000000000000000ull ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x0000000000020000ull ; +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x0000000000020000ull ; + } +return 0x0000000000020000ull ; +} + +#define CVMX_SLI_WIN_WR_DATA CVMX_SLI_WIN_WR_DATA_FUNC() +static inline u64 CVMX_SLI_WIN_WR_DATA_FUNC (void ) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CNF71XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x0000000000000020ull ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0000000000000020ull ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x0000000000020020ull ; +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x0000000000020020ull ; + } +return 0x0000000000020020ull ; +} + +#define CVMX_SLI_WIN_WR_MASK CVMX_SLI_WIN_WR_MASK_FUNC() +static inline u64 CVMX_SLI_WIN_WR_MASK_FUNC (void ) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CNF71XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x0000000000000030ull ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0000000000000030ull ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x0000000000020030ull ; +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x0000000000020030ull ; + } +return 0x0000000000020030ull ; +} + +/** +* cvmx_sli_bist_status +* +* This register contains results from BIST runs of MAC's memories: 0 = pass (or BIST in +* progress/never run), 1 = fail. +*/ +union cvmx_sli_bist_status { +u64 u64; +struct cvmx_sli_bist_status_s { +u64 reserved_32_63 :32 ; +u64 ncb_req :1 ; +u64 n2p0_c :1 ; +u64 n2p0_o :1 ; +u64 n2p1_c :1 ; +u64 n2p1_o :1 ; +u64 cpl_p0 :1 ; +u64 cpl_p1 :1 ; +u64 reserved_19_24 :6 ; +u64 p2n0_c0 :1 ; +u64 p2n0_c1 :1 ; +u64 p2n0_n :1 ; +u64 p2n0_p0 :1 ; +u64 p2n0_p1 :1 ; +u64 p2n1_c0 :1 ; +u64 p2n1_c1 :1 ; +u64 p2n1_n :1 ; +u64 p2n1_p0 :1 ; +u64 p2n1_p1 :1 ; +u64 reserved_6_8 :3 ; +u64 dsi1_1 :1 ; +u64 dsi1_0 :1 ; +u64 dsi0_1 :1 ; +u64 dsi0_0 :1 ; +u64 msi :1 ; +u64 ncb_cmd :1 ; + } s; +struct cvmx_sli_bist_status_cn61xx { +u64 reserved_31_63 :33 ; +u64 n2p0_c :1 ; +u64 n2p0_o :1 ; +u64 reserved_27_28 :2 ; +u64 cpl_p0 :1 ; +u64 cpl_p1 :1 ; +u64 reserved_19_24 :6 ; +u64 p2n0_c0 :1 ; +u64 p2n0_c1 :1 ; +u64 p2n0_n :1 ; +u64 p2n0_p0 :1 ; +u64 p2n0_p1 :1 ; +u64 p2n1_c0 :1 ; +u64 p2n1_c1 :1 ; +u64 p2n1_n :1 ; +u64 p2n1_p0 :1 ; +u64 p2n1_p1 :1 ; +u64 reserved_6_8 :3 ; +u64 dsi1_1 :1 ; +u64 dsi1_0 :1 ; +u64 dsi0_1 :1 ; +u64 dsi0_0 :1 ; +u64 msi :1 ; +u64 ncb_cmd :1 ; + } cn61xx; +struct cvmx_sli_bist_status_cn63xx { +u64 reserved_31_63 :33 ; +u64 n2p0_c :1 ; +u64 n2p0_o :1 ; +u64 n2p1_c :1 ; +u64 n2p1_o :1 ; +u64 cpl_p0 :1 ; +u64 cpl_p1 :1 ; +u64 reserved_19_24 :6 ; +u64 p2n0_c0 :1 ; +u64 p2n0_c1 :1 ; +u64 p2n0_n :1 ; +u64 p2n0_p0 :1 ; +u64 p2n0_p1 :1 ; +u64 p2n1_c0 :1 ; +u64 p2n1_c1 :1 ; +u64 p2n1_n :1 ; +u64 p2n1_p0 :1 ; +u64 p2n1_p1 :1 ; +u64 reserved_6_8 :3 ; +u64 dsi1_1 :1 ; +u64 dsi1_0 :1 ; +u64 dsi0_1 :1 ; +u64 dsi0_0 :1 ; +u64 msi :1 ; +u64 ncb_cmd :1 ; + } cn63xx; +struct cvmx_sli_bist_status_cn63xx cn63xxp1; +struct cvmx_sli_bist_status_cn61xx cn66xx; +struct cvmx_sli_bist_status_s cn68xx; +struct cvmx_sli_bist_status_s cn68xxp1; +struct cvmx_sli_bist_status_cn70xx { +u64 reserved_31_63 :33 ; +u64 n2p0_c :1 ; +u64 n2p0_o :1 ; +u64 reserved_27_28 :2 ; +u64 cpl_p0 :1 ; +u64 cpl_p1 :1 ; +u64 reserved_19_24 :6 ; +u64 p2n0_c0 :1 ; +u64 reserved_17_17 :1 ; +u64 p2n0_n :1 ; +u64 p2n0_p0 :1 ; +u64 reserved_14_14 :1 ; +u64 p2n1_c0 :1 ; +u64 reserved_12_12 :1 ; +u64 p2n1_n :1 ; +u64 p2n1_p0 :1 ; +u64 reserved_6_9 :4 ; +u64 dsi1_1 :1 ; +u64 dsi1_0 :1 ; +u64 dsi0_1 :1 ; +u64 dsi0_0 :1 ; +u64 msi :1 ; +u64 ncb_cmd :1 ; + } cn70xx; +struct cvmx_sli_bist_status_cn70xx cn70xxp1; +struct cvmx_sli_bist_status_s cn73xx; +struct cvmx_sli_bist_status_s cn78xx; +struct cvmx_sli_bist_status_s cn78xxp1; +struct cvmx_sli_bist_status_cn61xx cnf71xx; +struct cvmx_sli_bist_status_s cnf75xx; +}; + +typedef union cvmx_sli_bist_status cvmx_sli_bist_status_t ; + +/** +* cvmx_sli_ciu_int_enb +* +* Interrupt enable register for a given SLI_CIU_INT_SUM register. +* +*/ +union cvmx_sli_ciu_int_enb { +u64 u64; +struct cvmx_sli_ciu_int_enb_s { +u64 reserved_51_63 :13 ; +u64 m3_un_wi :1 ; +u64 m3_un_b0 :1 ; +u64 m3_up_wi :1 ; +u64 m3_up_b0 :1 ; +u64 m2_un_wi :1 ; +u64 m2_un_b0 :1 ; +u64 m2_up_wi :1 ; +u64 m2_up_b0 :1 ; +u64 m1_un_wi :1 ; +u64 m1_un_b0 :1 ; +u64 m1_up_wi :1 ; +u64 m1_up_b0 :1 ; +u64 m0_un_wi :1 ; +u64 m0_un_b0 :1 ; +u64 m0_up_wi :1 ; +u64 m0_up_b0 :1 ; +u64 m3p0_pppf_err :1 ; +u64 m3p0_pktpf_err :1 ; +u64 m3p0_dmapf_err :1 ; +u64 m2p0_pppf_err :1 ; +u64 m2p0_ppvf_err :1 ; +u64 m2p0_pktpf_err :1 ; +u64 m2p0_pktvf_err :1 ; +u64 m2p0_dmapf_err :1 ; +u64 m2p0_dmavf_err :1 ; +u64 m1p0_pppf_err :1 ; +u64 m1p0_pktpf_err :1 ; +u64 m1p0_dmapf_err :1 ; +u64 m0p1_pppf_err :1 ; +u64 m0p1_ppvf_err :1 ; +u64 m0p1_pktpf_err :1 ; +u64 m0p1_pktvf_err :1 ; +u64 m0p1_dmapf_err :1 ; +u64 m0p1_dmavf_err :1 ; +u64 m0p0_pppf_err :1 ; +u64 m0p0_ppvf_err :1 ; +u64 m0p0_pktpf_err :1 ; +u64 m0p0_pktvf_err :1 ; +u64 m0p0_dmapf_err :1 ; +u64 m0p0_dmavf_err :1 ; +u64 m2v0_flr :1 ; +u64 m2p0_flr :1 ; +u64 reserved_5_8 :4 ; +u64 m0v1_flr :1 ; +u64 m0p1_flr :1 ; +u64 m0v0_flr :1 ; +u64 m0p0_flr :1 ; +u64 rml_to :1 ; + } s; +struct cvmx_sli_ciu_int_enb_s cn73xx; +struct cvmx_sli_ciu_int_enb_s cn78xx; +struct cvmx_sli_ciu_int_enb_s cnf75xx; +}; + +typedef union cvmx_sli_ciu_int_enb cvmx_sli_ciu_int_enb_t ; + +/** +* cvmx_sli_ciu_int_sum +* +* The fields in this register are set when an interrupt condition occurs; write 1 to clear. +* A bit set in this register will send and interrupt to CIU +*/ +union cvmx_sli_ciu_int_sum { +u64 u64; +struct cvmx_sli_ciu_int_sum_s { +u64 reserved_51_63 :13 ; +u64 m3_un_wi :1 ; +u64 m3_un_b0 :1 ; +u64 m3_up_wi :1 ; +u64 m3_up_b0 :1 ; +u64 m2_un_wi :1 ; +u64 m2_un_b0 :1 ; +u64 m2_up_wi :1 ; +u64 m2_up_b0 :1 ; +u64 m1_un_wi :1 ; +u64 m1_un_b0 :1 ; +u64 m1_up_wi :1 ; +u64 m1_up_b0 :1 ; +u64 m0_un_wi :1 ; +u64 m0_un_b0 :1 ; +u64 m0_up_wi :1 ; +u64 m0_up_b0 :1 ; +u64 m3p0_pppf_err :1 ; +u64 m3p0_pktpf_err :1 ; +u64 m3p0_dmapf_err :1 ; +u64 m2p0_pppf_err :1 ; +u64 m2p0_ppvf_err :1 ; +u64 m2p0_pktpf_err :1 ; +u64 m2p0_pktvf_err :1 ; +u64 m2p0_dmapf_err :1 ; +u64 m2p0_dmavf_err :1 ; +u64 m1p0_pppf_err :1 ; +u64 m1p0_pktpf_err :1 ; +u64 m1p0_dmapf_err :1 ; +u64 m0p1_pppf_err :1 ; +u64 m0p1_ppvf_err :1 ; +u64 m0p1_pktpf_err :1 ; +u64 m0p1_pktvf_err :1 ; +u64 m0p1_dmapf_err :1 ; +u64 m0p1_dmavf_err :1 ; +u64 m0p0_pppf_err :1 ; +u64 m0p0_ppvf_err :1 ; +u64 m0p0_pktpf_err :1 ; +u64 m0p0_pktvf_err :1 ; +u64 m0p0_dmapf_err :1 ; +u64 m0p0_dmavf_err :1 ; +u64 m2v0_flr :1 ; +u64 m2p0_flr :1 ; +u64 reserved_5_8 :4 ; +u64 m0v1_flr :1 ; +u64 m0p1_flr :1 ; +u64 m0v0_flr :1 ; +u64 m0p0_flr :1 ; +u64 rml_to :1 ; + } s; +struct cvmx_sli_ciu_int_sum_s cn73xx; +struct cvmx_sli_ciu_int_sum_s cn78xx; +struct cvmx_sli_ciu_int_sum_s cnf75xx; +}; + +typedef union cvmx_sli_ciu_int_sum cvmx_sli_ciu_int_sum_t ; + +/** +* cvmx_sli_ctl_port# +* +* These registers contains control information for access to ports. Indexed by SLI_PORT_E. +* Note: SLI_CTL_PORT0 controls PF0. +*/ +union cvmx_sli_ctl_portx { +u64 u64; +struct cvmx_sli_ctl_portx_s { +u64 reserved_22_63 :42 ; +u64 intd :1 ; +u64 intc :1 ; +u64 intb :1 ; +u64 inta :1 ; +u64 dis_port :1 ; +u64 waitl_com :1 ; +u64 intd_map :2 ; +u64 intc_map :2 ; +u64 intb_map :2 ; +u64 inta_map :2 ; +u64 ctlp_ro :1 ; +u64 reserved_6_6 :1 ; +u64 ptlp_ro :1 ; +u64 reserved_1_4 :4 ; +u64 wait_com :1 ; + } s; +struct cvmx_sli_ctl_portx_s cn61xx; +struct cvmx_sli_ctl_portx_s cn63xx; +struct cvmx_sli_ctl_portx_s cn63xxp1; +struct cvmx_sli_ctl_portx_s cn66xx; +struct cvmx_sli_ctl_portx_s cn68xx; +struct cvmx_sli_ctl_portx_s cn68xxp1; +struct cvmx_sli_ctl_portx_cn70xx { +u64 reserved_22_63 :42 ; +u64 intd :1 ; +u64 intc :1 ; +u64 intb :1 ; +u64 inta :1 ; +u64 dis_port :1 ; +u64 waitl_com :1 ; +u64 intd_map :2 ; +u64 intc_map :2 ; +u64 intb_map :2 ; +u64 inta_map :2 ; +u64 ctlp_ro :1 ; +u64 reserved_6_6 :1 ; +u64 ptlp_ro :1 ; +u64 reserved_4_1 :4 ; +u64 wait_com :1 ; + } cn70xx; +struct cvmx_sli_ctl_portx_cn70xx cn70xxp1; +struct cvmx_sli_ctl_portx_cn73xx { +u64 reserved_18_63 :46 ; +u64 dis_port :1 ; +u64 waitl_com :1 ; +u64 reserved_8_15 :8 ; +u64 ctlp_ro :1 ; +u64 reserved_6_6 :1 ; +u64 ptlp_ro :1 ; +u64 reserved_1_4 :4 ; +u64 wait_com :1 ; + } cn73xx; +struct cvmx_sli_ctl_portx_cn73xx cn78xx; +struct cvmx_sli_ctl_portx_cn73xx cn78xxp1; +struct cvmx_sli_ctl_portx_s cnf71xx; +struct cvmx_sli_ctl_portx_cn73xx cnf75xx; +}; + +typedef union cvmx_sli_ctl_portx cvmx_sli_ctl_portx_t ; + +/** +* cvmx_sli_ctl_status +* +* This register contains control and status for SLI. Write operations to this register are not +* ordered with write/read operations to the MAC memory space. To ensure that a write has +* completed, software must read the register before making an access (i.e. MAC memory space) +* that requires the value of this register to be updated. +*/ +union cvmx_sli_ctl_status { +u64 u64; +struct cvmx_sli_ctl_status_s { +u64 reserved_32_63 :32 ; +u64 m2s1_ncbi :4 ; +u64 m2s0_ncbi :4 ; +u64 oci_id :4 ; +u64 p1_ntags :6 ; +u64 p0_ntags :6 ; +u64 chip_rev :8 ; + } s; +struct cvmx_sli_ctl_status_cn61xx { +u64 reserved_14_63 :50 ; +u64 p0_ntags :6 ; +u64 chip_rev :8 ; + } cn61xx; +struct cvmx_sli_ctl_status_cn63xx { +u64 reserved_20_63 :44 ; +u64 p1_ntags :6 ; +u64 p0_ntags :6 ; +u64 chip_rev :8 ; + } cn63xx; +struct cvmx_sli_ctl_status_cn63xx cn63xxp1; +struct cvmx_sli_ctl_status_cn61xx cn66xx; +struct cvmx_sli_ctl_status_cn63xx cn68xx; +struct cvmx_sli_ctl_status_cn63xx cn68xxp1; +struct cvmx_sli_ctl_status_cn63xx cn70xx; +struct cvmx_sli_ctl_status_cn63xx cn70xxp1; +struct cvmx_sli_ctl_status_cn73xx { +u64 reserved_32_63 :32 ; +u64 m2s1_ncbi :4 ; +u64 m2s0_ncbi :4 ; +u64 reserved_20_23 :4 ; +u64 p1_ntags :6 ; +u64 p0_ntags :6 ; +u64 chip_rev :8 ; + } cn73xx; +struct cvmx_sli_ctl_status_s cn78xx; +struct cvmx_sli_ctl_status_s cn78xxp1; +struct cvmx_sli_ctl_status_cn61xx cnf71xx; +struct cvmx_sli_ctl_status_cn73xx cnf75xx; +}; + +typedef union cvmx_sli_ctl_status cvmx_sli_ctl_status_t ; + +/** +* cvmx_sli_data_out_cnt +* +* This register contains the EXEC data out FIFO count and the data unload counter. +* +*/ +union cvmx_sli_data_out_cnt { +u64 u64; +struct cvmx_sli_data_out_cnt_s { +u64 reserved_44_63 :20 ; +u64 p1_ucnt :16 ; +u64 p1_fcnt :6 ; +u64 p0_ucnt :16 ; +u64 p0_fcnt :6 ; + } s; +struct cvmx_sli_data_out_cnt_s cn61xx; +struct cvmx_sli_data_out_cnt_s cn63xx; +struct cvmx_sli_data_out_cnt_s cn63xxp1; +struct cvmx_sli_data_out_cnt_s cn66xx; +struct cvmx_sli_data_out_cnt_s cn68xx; +struct cvmx_sli_data_out_cnt_s cn68xxp1; +struct cvmx_sli_data_out_cnt_s cn70xx; +struct cvmx_sli_data_out_cnt_s cn70xxp1; +struct cvmx_sli_data_out_cnt_s cn73xx; +struct cvmx_sli_data_out_cnt_s cn78xx; +struct cvmx_sli_data_out_cnt_s cn78xxp1; +struct cvmx_sli_data_out_cnt_s cnf71xx; +struct cvmx_sli_data_out_cnt_s cnf75xx; +}; + +typedef union cvmx_sli_data_out_cnt cvmx_sli_data_out_cnt_t ; + +/** +* cvmx_sli_dbg_data +* +* SLI_DBG_DATA = SLI Debug Data Register +* +* Value returned on the debug-data lines from the RSLs +*/ +union cvmx_sli_dbg_data { +u64 u64; +struct cvmx_sli_dbg_data_s { +u64 reserved_18_63 :46 ; +u64 dsel_ext :1 ; +u64 data :17 ; + } s; +struct cvmx_sli_dbg_data_s cn61xx; +struct cvmx_sli_dbg_data_s cn63xx; +struct cvmx_sli_dbg_data_s cn63xxp1; +struct cvmx_sli_dbg_data_s cn66xx; +struct cvmx_sli_dbg_data_s cn68xx; +struct cvmx_sli_dbg_data_s cn68xxp1; +struct cvmx_sli_dbg_data_s cnf71xx; +}; + +typedef union cvmx_sli_dbg_data cvmx_sli_dbg_data_t ; + +/** +* cvmx_sli_dbg_select +* +* SLI_DBG_SELECT = Debug Select Register +* +* Contains the debug select value last written to the RSLs. +*/ +union cvmx_sli_dbg_select { +u64 u64; +struct cvmx_sli_dbg_select_s { +u64 reserved_33_63 :31 ; +u64 adbg_sel :1 ; +u64 dbg_sel :32 ; + } s; +struct cvmx_sli_dbg_select_s cn61xx; +struct cvmx_sli_dbg_select_s cn63xx; +struct cvmx_sli_dbg_select_s cn63xxp1; +struct cvmx_sli_dbg_select_s cn66xx; +struct cvmx_sli_dbg_select_s cn68xx; +struct cvmx_sli_dbg_select_s cn68xxp1; +struct cvmx_sli_dbg_select_s cnf71xx; +}; + +typedef union cvmx_sli_dbg_select cvmx_sli_dbg_select_t ; + +/** +* cvmx_sli_dma#_cnt +* +* These registers contain the DMA count values. +* +*/ +union cvmx_sli_dmax_cnt { +u64 u64; +struct cvmx_sli_dmax_cnt_s { +u64 reserved_32_63 :32 ; +u64 cnt :32 ; + } s; +struct cvmx_sli_dmax_cnt_s cn61xx; +struct cvmx_sli_dmax_cnt_s cn63xx; +struct cvmx_sli_dmax_cnt_s cn63xxp1; +struct cvmx_sli_dmax_cnt_s cn66xx; +struct cvmx_sli_dmax_cnt_s cn68xx; +struct cvmx_sli_dmax_cnt_s cn68xxp1; +struct cvmx_sli_dmax_cnt_s cn70xx; +struct cvmx_sli_dmax_cnt_s cn70xxp1; +struct cvmx_sli_dmax_cnt_s cn73xx; +struct cvmx_sli_dmax_cnt_s cn78xx; +struct cvmx_sli_dmax_cnt_s cn78xxp1; +struct cvmx_sli_dmax_cnt_s cnf71xx; +struct cvmx_sli_dmax_cnt_s cnf75xx; +}; + +typedef union cvmx_sli_dmax_cnt cvmx_sli_dmax_cnt_t ; + +/** +* cvmx_sli_dma#_int_level +* +* These registers contain the thresholds for DMA count and timer interrupts. +* +*/ +union cvmx_sli_dmax_int_level { +u64 u64; +struct cvmx_sli_dmax_int_level_s { +u64 time :32 ; +u64 cnt :32 ; + } s; +struct cvmx_sli_dmax_int_level_s cn61xx; +struct cvmx_sli_dmax_int_level_s cn63xx; +struct cvmx_sli_dmax_int_level_s cn63xxp1; +struct cvmx_sli_dmax_int_level_s cn66xx; +struct cvmx_sli_dmax_int_level_s cn68xx; +struct cvmx_sli_dmax_int_level_s cn68xxp1; +struct cvmx_sli_dmax_int_level_s cn70xx; +struct cvmx_sli_dmax_int_level_s cn70xxp1; +struct cvmx_sli_dmax_int_level_s cn73xx; +struct cvmx_sli_dmax_int_level_s cn78xx; +struct cvmx_sli_dmax_int_level_s cn78xxp1; +struct cvmx_sli_dmax_int_level_s cnf71xx; +struct cvmx_sli_dmax_int_level_s cnf75xx; +}; + +typedef union cvmx_sli_dmax_int_level cvmx_sli_dmax_int_level_t ; + +/** +* cvmx_sli_dma#_tim +* +* These registers contain the DMA timer values. +* +*/ +union cvmx_sli_dmax_tim { +u64 u64; +struct cvmx_sli_dmax_tim_s { +u64 reserved_32_63 :32 ; +u64 tim :32 ; + } s; +struct cvmx_sli_dmax_tim_s cn61xx; +struct cvmx_sli_dmax_tim_s cn63xx; +struct cvmx_sli_dmax_tim_s cn63xxp1; +struct cvmx_sli_dmax_tim_s cn66xx; +struct cvmx_sli_dmax_tim_s cn68xx; +struct cvmx_sli_dmax_tim_s cn68xxp1; +struct cvmx_sli_dmax_tim_s cn70xx; +struct cvmx_sli_dmax_tim_s cn70xxp1; +struct cvmx_sli_dmax_tim_s cn73xx; +struct cvmx_sli_dmax_tim_s cn78xx; +struct cvmx_sli_dmax_tim_s cn78xxp1; +struct cvmx_sli_dmax_tim_s cnf71xx; +struct cvmx_sli_dmax_tim_s cnf75xx; +}; + +typedef union cvmx_sli_dmax_tim cvmx_sli_dmax_tim_t ; + +/** +* cvmx_sli_int_enb_ciu +* +* Used to enable the various interrupting conditions of SLI +* +*/ +union cvmx_sli_int_enb_ciu { +u64 u64; +struct cvmx_sli_int_enb_ciu_s { +u64 reserved_62_63 :2 ; +u64 pipe_err :1 ; +u64 ill_pad :1 ; +u64 sprt3_err :1 ; +u64 sprt2_err :1 ; +u64 sprt1_err :1 ; +u64 sprt0_err :1 ; +u64 pins_err :1 ; +u64 pop_err :1 ; +u64 pdi_err :1 ; +u64 pgl_err :1 ; +u64 pin_bp :1 ; +u64 pout_err :1 ; +u64 psldbof :1 ; +u64 pidbof :1 ; +u64 reserved_38_47 :10 ; +u64 dtime :2 ; +u64 dcnt :2 ; +u64 dmafi :2 ; +u64 reserved_29_31 :3 ; +u64 mio_int2 :1 ; +u64 m3_un_wi :1 ; +u64 m3_un_b0 :1 ; +u64 m3_up_wi :1 ; +u64 m3_up_b0 :1 ; +u64 m2_un_wi :1 ; +u64 m2_un_b0 :1 ; +u64 m2_up_wi :1 ; +u64 m2_up_b0 :1 ; +u64 reserved_18_19 :2 ; +u64 mio_int1 :1 ; +u64 mio_int0 :1 ; +u64 m1_un_wi :1 ; +u64 m1_un_b0 :1 ; +u64 m1_up_wi :1 ; +u64 m1_up_b0 :1 ; +u64 m0_un_wi :1 ; +u64 m0_un_b0 :1 ; +u64 m0_up_wi :1 ; +u64 m0_up_b0 :1 ; +u64 reserved_6_7 :2 ; +u64 ptime :1 ; +u64 pcnt :1 ; +u64 iob2big :1 ; +u64 bar0_to :1 ; +u64 reserved_1_1 :1 ; +u64 rml_to :1 ; + } s; +struct cvmx_sli_int_enb_ciu_cn61xx { +u64 reserved_61_63 :3 ; +u64 ill_pad :1 ; +u64 sprt3_err :1 ; +u64 sprt2_err :1 ; +u64 sprt1_err :1 ; +u64 sprt0_err :1 ; +u64 pins_err :1 ; +u64 pop_err :1 ; +u64 pdi_err :1 ; +u64 pgl_err :1 ; +u64 pin_bp :1 ; +u64 pout_err :1 ; +u64 psldbof :1 ; +u64 pidbof :1 ; +u64 reserved_38_47 :10 ; +u64 dtime :2 ; +u64 dcnt :2 ; +u64 dmafi :2 ; +u64 reserved_28_31 :4 ; +u64 m3_un_wi :1 ; +u64 m3_un_b0 :1 ; +u64 m3_up_wi :1 ; +u64 m3_up_b0 :1 ; +u64 m2_un_wi :1 ; +u64 m2_un_b0 :1 ; +u64 m2_up_wi :1 ; +u64 m2_up_b0 :1 ; +u64 reserved_18_19 :2 ; +u64 mio_int1 :1 ; +u64 mio_int0 :1 ; +u64 m1_un_wi :1 ; +u64 m1_un_b0 :1 ; +u64 m1_up_wi :1 ; +u64 m1_up_b0 :1 ; +u64 m0_un_wi :1 ; +u64 m0_un_b0 :1 ; +u64 m0_up_wi :1 ; +u64 m0_up_b0 :1 ; +u64 reserved_6_7 :2 ; +u64 ptime :1 ; +u64 pcnt :1 ; +u64 iob2big :1 ; +u64 bar0_to :1 ; +u64 reserved_1_1 :1 ; +u64 rml_to :1 ; + } cn61xx; +struct cvmx_sli_int_enb_ciu_cn63xx { +u64 reserved_61_63 :3 ; +u64 ill_pad :1 ; +u64 reserved_58_59 :2 ; +u64 sprt1_err :1 ; +u64 sprt0_err :1 ; +u64 pins_err :1 ; +u64 pop_err :1 ; +u64 pdi_err :1 ; +u64 pgl_err :1 ; +u64 pin_bp :1 ; +u64 pout_err :1 ; +u64 psldbof :1 ; +u64 pidbof :1 ; +u64 reserved_38_47 :10 ; +u64 dtime :2 ; +u64 dcnt :2 ; +u64 dmafi :2 ; +u64 reserved_18_31 :14 ; +u64 mio_int1 :1 ; +u64 mio_int0 :1 ; +u64 m1_un_wi :1 ; +u64 m1_un_b0 :1 ; +u64 m1_up_wi :1 ; +u64 m1_up_b0 :1 ; +u64 m0_un_wi :1 ; +u64 m0_un_b0 :1 ; +u64 m0_up_wi :1 ; +u64 m0_up_b0 :1 ; +u64 reserved_6_7 :2 ; +u64 ptime :1 ; +u64 pcnt :1 ; +u64 iob2big :1 ; +u64 bar0_to :1 ; +u64 reserved_1_1 :1 ; +u64 rml_to :1 ; + } cn63xx; +struct cvmx_sli_int_enb_ciu_cn63xx cn63xxp1; +struct cvmx_sli_int_enb_ciu_cn61xx cn66xx; +struct cvmx_sli_int_enb_ciu_cn68xx { +u64 reserved_62_63 :2 ; +u64 pipe_err :1 ; +u64 ill_pad :1 ; +u64 reserved_58_59 :2 ; +u64 sprt1_err :1 ; +u64 sprt0_err :1 ; +u64 pins_err :1 ; +u64 pop_err :1 ; +u64 pdi_err :1 ; +u64 pgl_err :1 ; +u64 reserved_51_51 :1 ; +u64 pout_err :1 ; +u64 psldbof :1 ; +u64 pidbof :1 ; +u64 reserved_38_47 :10 ; +u64 dtime :2 ; +u64 dcnt :2 ; +u64 dmafi :2 ; +u64 reserved_18_31 :14 ; +u64 mio_int1 :1 ; +u64 mio_int0 :1 ; +u64 m1_un_wi :1 ; +u64 m1_un_b0 :1 ; +u64 m1_up_wi :1 ; +u64 m1_up_b0 :1 ; +u64 m0_un_wi :1 ; +u64 m0_un_b0 :1 ; +u64 m0_up_wi :1 ; +u64 m0_up_b0 :1 ; +u64 reserved_6_7 :2 ; +u64 ptime :1 ; +u64 pcnt :1 ; +u64 iob2big :1 ; +u64 bar0_to :1 ; +u64 reserved_1_1 :1 ; +u64 rml_to :1 ; + } cn68xx; +struct cvmx_sli_int_enb_ciu_cn68xx cn68xxp1; +struct cvmx_sli_int_enb_ciu_cn70xx { +u64 reserved_63_61 :3 ; +u64 ill_pad :1 ; +u64 sprt3_err :1 ; +u64 sprt2_err :1 ; +u64 sprt1_err :1 ; +u64 sprt0_err :1 ; +u64 pins_err :1 ; +u64 pop_err :1 ; +u64 pdi_err :1 ; +u64 pgl_err :1 ; +u64 pin_bp :1 ; +u64 pout_err :1 ; +u64 psldbof :1 ; +u64 pidbof :1 ; +u64 reserved_47_38 :10 ; +u64 dtime :2 ; +u64 dcnt :2 ; +u64 dmafi :2 ; +u64 reserved_31_29 :3 ; +u64 mio_int2 :1 ; +u64 m3_un_wi :1 ; +u64 m3_un_b0 :1 ; +u64 m3_up_wi :1 ; +u64 m3_up_b0 :1 ; +u64 m2_un_wi :1 ; +u64 m2_un_b0 :1 ; +u64 m2_up_wi :1 ; +u64 m2_up_b0 :1 ; +u64 reserved_19_18 :2 ; +u64 mio_int1 :1 ; +u64 mio_int0 :1 ; +u64 m1_un_wi :1 ; +u64 m1_un_b0 :1 ; +u64 m1_up_wi :1 ; +u64 m1_up_b0 :1 ; +u64 m0_un_wi :1 ; +u64 m0_un_b0 :1 ; +u64 m0_up_wi :1 ; +u64 m0_up_b0 :1 ; +u64 reserved_7_6 :2 ; +u64 ptime :1 ; +u64 pcnt :1 ; +u64 iob2big :1 ; +u64 bar0_to :1 ; +u64 reserved_1_1 :1 ; +u64 rml_to :1 ; + } cn70xx; +struct cvmx_sli_int_enb_ciu_cn70xx cn70xxp1; +struct cvmx_sli_int_enb_ciu_cn61xx cnf71xx; +}; + +typedef union cvmx_sli_int_enb_ciu cvmx_sli_int_enb_ciu_t ; + +/** +* cvmx_sli_int_enb_port# +* +* When a field in this register is set, and a corresponding interrupt condition asserts in +* SLI_INT_SUM, an interrupt is generated. Interrupts can be sent to PCIe0 or PCIe1. +*/ +union cvmx_sli_int_enb_portx { +u64 u64; +struct cvmx_sli_int_enb_portx_s { +u64 reserved_62_63 :2 ; +u64 pipe_err :1 ; +u64 ill_pad :1 ; +u64 sprt3_err :1 ; +u64 sprt2_err :1 ; +u64 sprt1_err :1 ; +u64 sprt0_err :1 ; +u64 pins_err :1 ; +u64 pop_err :1 ; +u64 pdi_err :1 ; +u64 pgl_err :1 ; +u64 pin_bp :1 ; +u64 pout_err :1 ; +u64 psldbof :1 ; +u64 pidbof :1 ; +u64 reserved_38_47 :10 ; +u64 dtime :2 ; +u64 dcnt :2 ; +u64 dmafi :2 ; +u64 reserved_30_31 :2 ; +u64 mac2_int :1 ; +u64 reserved_28_28 :1 ; +u64 m3_un_wi :1 ; +u64 m3_un_b0 :1 ; +u64 m3_up_wi :1 ; +u64 m3_up_b0 :1 ; +u64 m2_un_wi :1 ; +u64 m2_un_b0 :1 ; +u64 m2_up_wi :1 ; +u64 m2_up_b0 :1 ; +u64 mac1_int :1 ; +u64 mac0_int :1 ; +u64 mio_int1 :1 ; +u64 mio_int0 :1 ; +u64 m1_un_wi :1 ; +u64 m1_un_b0 :1 ; +u64 m1_up_wi :1 ; +u64 m1_up_b0 :1 ; +u64 m0_un_wi :1 ; +u64 m0_un_b0 :1 ; +u64 m0_up_wi :1 ; +u64 m0_up_b0 :1 ; +u64 mio_int3 :1 ; +u64 reserved_6_6 :1 ; +u64 ptime :1 ; +u64 pcnt :1 ; +u64 iob2big :1 ; +u64 bar0_to :1 ; +u64 reserved_1_1 :1 ; +u64 rml_to :1 ; + } s; +struct cvmx_sli_int_enb_portx_cn61xx { +u64 reserved_61_63 :3 ; +u64 ill_pad :1 ; +u64 sprt3_err :1 ; +u64 sprt2_err :1 ; +u64 sprt1_err :1 ; +u64 sprt0_err :1 ; +u64 pins_err :1 ; +u64 pop_err :1 ; +u64 pdi_err :1 ; +u64 pgl_err :1 ; +u64 pin_bp :1 ; +u64 pout_err :1 ; +u64 psldbof :1 ; +u64 pidbof :1 ; +u64 reserved_38_47 :10 ; +u64 dtime :2 ; +u64 dcnt :2 ; +u64 dmafi :2 ; +u64 reserved_28_31 :4 ; +u64 m3_un_wi :1 ; +u64 m3_un_b0 :1 ; +u64 m3_up_wi :1 ; +u64 m3_up_b0 :1 ; +u64 m2_un_wi :1 ; +u64 m2_un_b0 :1 ; +u64 m2_up_wi :1 ; +u64 m2_up_b0 :1 ; +u64 mac1_int :1 ; +u64 mac0_int :1 ; +u64 mio_int1 :1 ; +u64 mio_int0 :1 ; +u64 m1_un_wi :1 ; +u64 m1_un_b0 :1 ; +u64 m1_up_wi :1 ; +u64 m1_up_b0 :1 ; +u64 m0_un_wi :1 ; +u64 m0_un_b0 :1 ; +u64 m0_up_wi :1 ; +u64 m0_up_b0 :1 ; +u64 reserved_6_7 :2 ; +u64 ptime :1 ; +u64 pcnt :1 ; +u64 iob2big :1 ; +u64 bar0_to :1 ; +u64 reserved_1_1 :1 ; +u64 rml_to :1 ; + } cn61xx; +struct cvmx_sli_int_enb_portx_cn63xx { +u64 reserved_61_63 :3 ; +u64 ill_pad :1 ; +u64 reserved_58_59 :2 ; +u64 sprt1_err :1 ; +u64 sprt0_err :1 ; +u64 pins_err :1 ; +u64 pop_err :1 ; +u64 pdi_err :1 ; +u64 pgl_err :1 ; +u64 pin_bp :1 ; +u64 pout_err :1 ; +u64 psldbof :1 ; +u64 pidbof :1 ; +u64 reserved_38_47 :10 ; +u64 dtime :2 ; +u64 dcnt :2 ; +u64 dmafi :2 ; +u64 reserved_20_31 :12 ; +u64 mac1_int :1 ; +u64 mac0_int :1 ; +u64 mio_int1 :1 ; +u64 mio_int0 :1 ; +u64 m1_un_wi :1 ; +u64 m1_un_b0 :1 ; +u64 m1_up_wi :1 ; +u64 m1_up_b0 :1 ; +u64 m0_un_wi :1 ; +u64 m0_un_b0 :1 ; +u64 m0_up_wi :1 ; +u64 m0_up_b0 :1 ; +u64 reserved_6_7 :2 ; +u64 ptime :1 ; +u64 pcnt :1 ; +u64 iob2big :1 ; +u64 bar0_to :1 ; +u64 reserved_1_1 :1 ; +u64 rml_to :1 ; + } cn63xx; +struct cvmx_sli_int_enb_portx_cn63xx cn63xxp1; +struct cvmx_sli_int_enb_portx_cn61xx cn66xx; +struct cvmx_sli_int_enb_portx_cn68xx { +u64 reserved_62_63 :2 ; +u64 pipe_err :1 ; +u64 ill_pad :1 ; +u64 reserved_58_59 :2 ; +u64 sprt1_err :1 ; +u64 sprt0_err :1 ; +u64 pins_err :1 ; +u64 pop_err :1 ; +u64 pdi_err :1 ; +u64 pgl_err :1 ; +u64 reserved_51_51 :1 ; +u64 pout_err :1 ; +u64 psldbof :1 ; +u64 pidbof :1 ; +u64 reserved_38_47 :10 ; +u64 dtime :2 ; +u64 dcnt :2 ; +u64 dmafi :2 ; +u64 reserved_20_31 :12 ; +u64 mac1_int :1 ; +u64 mac0_int :1 ; +u64 mio_int1 :1 ; +u64 mio_int0 :1 ; +u64 m1_un_wi :1 ; +u64 m1_un_b0 :1 ; +u64 m1_up_wi :1 ; +u64 m1_up_b0 :1 ; +u64 m0_un_wi :1 ; +u64 m0_un_b0 :1 ; +u64 m0_up_wi :1 ; +u64 m0_up_b0 :1 ; +u64 reserved_6_7 :2 ; +u64 ptime :1 ; +u64 pcnt :1 ; +u64 iob2big :1 ; +u64 bar0_to :1 ; +u64 reserved_1_1 :1 ; +u64 rml_to :1 ; + } cn68xx; +struct cvmx_sli_int_enb_portx_cn68xx cn68xxp1; +struct cvmx_sli_int_enb_portx_cn70xx { +u64 reserved_63_61 :3 ; +u64 ill_pad :1 ; +u64 sprt3_err :1 ; +u64 sprt2_err :1 ; +u64 sprt1_err :1 ; +u64 sprt0_err :1 ; +u64 pins_err :1 ; +u64 pop_err :1 ; +u64 pdi_err :1 ; +u64 pgl_err :1 ; +u64 pin_bp :1 ; +u64 pout_err :1 ; +u64 psldbof :1 ; +u64 pidbof :1 ; +u64 reserved_47_38 :10 ; +u64 dtime :2 ; +u64 dcnt :2 ; +u64 dmafi :2 ; +u64 reserved_31_30 :2 ; +u64 mac2_int :1 ; +u64 mio_int2 :1 ; +u64 m3_un_wi :1 ; +u64 m3_un_b0 :1 ; +u64 m3_up_wi :1 ; +u64 m3_up_b0 :1 ; +u64 m2_un_wi :1 ; +u64 m2_un_b0 :1 ; +u64 m2_up_wi :1 ; +u64 m2_up_b0 :1 ; +u64 mac1_int :1 ; +u64 mac0_int :1 ; +u64 mio_int1 :1 ; +u64 mio_int0 :1 ; +u64 m1_un_wi :1 ; +u64 m1_un_b0 :1 ; +u64 m1_up_wi :1 ; +u64 m1_up_b0 :1 ; +u64 m0_un_wi :1 ; +u64 m0_un_b0 :1 ; +u64 m0_up_wi :1 ; +u64 m0_up_b0 :1 ; +u64 reserved_7_6 :2 ; +u64 ptime :1 ; +u64 pcnt :1 ; +u64 iob2big :1 ; +u64 bar0_to :1 ; +u64 reserved_1_1 :1 ; +u64 rml_to :1 ; + } cn70xx; +struct cvmx_sli_int_enb_portx_cn70xx cn70xxp1; +struct cvmx_sli_int_enb_portx_cn78xxp1 { +u64 reserved_60_63 :4 ; +u64 sprt3_err :1 ; +u64 sprt2_err :1 ; +u64 sprt1_err :1 ; +u64 sprt0_err :1 ; +u64 pins_err :1 ; +u64 pop_err :1 ; +u64 pdi_err :1 ; +u64 pgl_err :1 ; +u64 reserved_50_51 :2 ; +u64 psldbof :1 ; +u64 pidbof :1 ; +u64 reserved_38_47 :10 ; +u64 dtime :2 ; +u64 dcnt :2 ; +u64 dmafi :2 ; +u64 reserved_29_31 :3 ; +u64 vf_err :1 ; +u64 m3_un_wi :1 ; +u64 m3_un_b0 :1 ; +u64 m3_up_wi :1 ; +u64 m3_up_b0 :1 ; +u64 m2_un_wi :1 ; +u64 m2_un_b0 :1 ; +u64 m2_up_wi :1 ; +u64 m2_up_b0 :1 ; +u64 reserved_18_19 :2 ; +u64 mio_int1 :1 ; +u64 mio_int0 :1 ; +u64 m1_un_wi :1 ; +u64 m1_un_b0 :1 ; +u64 m1_up_wi :1 ; +u64 m1_up_b0 :1 ; +u64 m0_un_wi :1 ; +u64 m0_un_b0 :1 ; +u64 m0_up_wi :1 ; +u64 m0_up_b0 :1 ; +u64 mio_int3 :1 ; +u64 mio_int2 :1 ; +u64 ptime :1 ; +u64 pcnt :1 ; +u64 reserved_1_3 :3 ; +u64 rml_to :1 ; + } cn78xxp1; +struct cvmx_sli_int_enb_portx_cn61xx cnf71xx; +}; + +typedef union cvmx_sli_int_enb_portx cvmx_sli_int_enb_portx_t ; + +/** +* cvmx_sli_int_sum +* +* The fields in this register are set when an interrupt condition occurs; write 1 to clear. All +* fields of the register are valid when a PF reads the register. Not available to VFs, and +* writes by the +* VF do not modify the register. +*/ +union cvmx_sli_int_sum { +u64 u64; +struct cvmx_sli_int_sum_s { +u64 reserved_62_63 :2 ; +u64 pipe_err :1 ; +u64 ill_pad :1 ; +u64 sprt3_err :1 ; +u64 sprt2_err :1 ; +u64 sprt1_err :1 ; +u64 sprt0_err :1 ; +u64 pins_err :1 ; +u64 pop_err :1 ; +u64 pdi_err :1 ; +u64 pgl_err :1 ; +u64 pin_bp :1 ; +u64 pout_err :1 ; +u64 psldbof :1 ; +u64 pidbof :1 ; +u64 reserved_38_47 :10 ; +u64 dtime :2 ; +u64 dcnt :2 ; +u64 dmafi :2 ; +u64 reserved_30_31 :2 ; +u64 mac2_int :1 ; +u64 reserved_28_28 :1 ; +u64 m3_un_wi :1 ; +u64 m3_un_b0 :1 ; +u64 m3_up_wi :1 ; +u64 m3_up_b0 :1 ; +u64 m2_un_wi :1 ; +u64 m2_un_b0 :1 ; +u64 m2_up_wi :1 ; +u64 m2_up_b0 :1 ; +u64 mac1_int :1 ; +u64 mac0_int :1 ; +u64 mio_int1 :1 ; +u64 mio_int0 :1 ; +u64 m1_un_wi :1 ; +u64 m1_un_b0 :1 ; +u64 m1_up_wi :1 ; +u64 m1_up_b0 :1 ; +u64 m0_un_wi :1 ; +u64 m0_un_b0 :1 ; +u64 m0_up_wi :1 ; +u64 m0_up_b0 :1 ; +u64 mio_int3 :1 ; +u64 reserved_6_6 :1 ; +u64 ptime :1 ; +u64 pcnt :1 ; +u64 iob2big :1 ; +u64 bar0_to :1 ; +u64 reserved_1_1 :1 ; +u64 rml_to :1 ; + } s; +struct cvmx_sli_int_sum_cn61xx { +u64 reserved_61_63 :3 ; +u64 ill_pad :1 ; +u64 sprt3_err :1 ; +u64 sprt2_err :1 ; +u64 sprt1_err :1 ; +u64 sprt0_err :1 ; +u64 pins_err :1 ; +u64 pop_err :1 ; +u64 pdi_err :1 ; +u64 pgl_err :1 ; +u64 pin_bp :1 ; +u64 pout_err :1 ; +u64 psldbof :1 ; +u64 pidbof :1 ; +u64 reserved_38_47 :10 ; +u64 dtime :2 ; +u64 dcnt :2 ; +u64 dmafi :2 ; +u64 reserved_28_31 :4 ; +u64 m3_un_wi :1 ; +u64 m3_un_b0 :1 ; +u64 m3_up_wi :1 ; +u64 m3_up_b0 :1 ; +u64 m2_un_wi :1 ; +u64 m2_un_b0 :1 ; +u64 m2_up_wi :1 ; +u64 m2_up_b0 :1 ; +u64 mac1_int :1 ; +u64 mac0_int :1 ; +u64 mio_int1 :1 ; +u64 mio_int0 :1 ; +u64 m1_un_wi :1 ; +u64 m1_un_b0 :1 ; +u64 m1_up_wi :1 ; +u64 m1_up_b0 :1 ; +u64 m0_un_wi :1 ; +u64 m0_un_b0 :1 ; +u64 m0_up_wi :1 ; +u64 m0_up_b0 :1 ; +u64 reserved_6_7 :2 ; +u64 ptime :1 ; +u64 pcnt :1 ; +u64 iob2big :1 ; +u64 bar0_to :1 ; +u64 reserved_1_1 :1 ; +u64 rml_to :1 ; + } cn61xx; +struct cvmx_sli_int_sum_cn63xx { +u64 reserved_61_63 :3 ; +u64 ill_pad :1 ; +u64 reserved_58_59 :2 ; +u64 sprt1_err :1 ; +u64 sprt0_err :1 ; +u64 pins_err :1 ; +u64 pop_err :1 ; +u64 pdi_err :1 ; +u64 pgl_err :1 ; +u64 pin_bp :1 ; +u64 pout_err :1 ; +u64 psldbof :1 ; +u64 pidbof :1 ; +u64 reserved_38_47 :10 ; +u64 dtime :2 ; +u64 dcnt :2 ; +u64 dmafi :2 ; +u64 reserved_20_31 :12 ; +u64 mac1_int :1 ; +u64 mac0_int :1 ; +u64 mio_int1 :1 ; +u64 mio_int0 :1 ; +u64 m1_un_wi :1 ; +u64 m1_un_b0 :1 ; +u64 m1_up_wi :1 ; +u64 m1_up_b0 :1 ; +u64 m0_un_wi :1 ; +u64 m0_un_b0 :1 ; +u64 m0_up_wi :1 ; +u64 m0_up_b0 :1 ; +u64 reserved_6_7 :2 ; +u64 ptime :1 ; +u64 pcnt :1 ; +u64 iob2big :1 ; +u64 bar0_to :1 ; +u64 reserved_1_1 :1 ; +u64 rml_to :1 ; + } cn63xx; +struct cvmx_sli_int_sum_cn63xx cn63xxp1; +struct cvmx_sli_int_sum_cn61xx cn66xx; +struct cvmx_sli_int_sum_cn68xx { +u64 reserved_62_63 :2 ; +u64 pipe_err :1 ; +u64 ill_pad :1 ; +u64 reserved_58_59 :2 ; +u64 sprt1_err :1 ; +u64 sprt0_err :1 ; +u64 pins_err :1 ; +u64 pop_err :1 ; +u64 pdi_err :1 ; +u64 pgl_err :1 ; +u64 reserved_51_51 :1 ; +u64 pout_err :1 ; +u64 psldbof :1 ; +u64 pidbof :1 ; +u64 reserved_38_47 :10 ; +u64 dtime :2 ; +u64 dcnt :2 ; +u64 dmafi :2 ; +u64 reserved_20_31 :12 ; +u64 mac1_int :1 ; +u64 mac0_int :1 ; +u64 mio_int1 :1 ; +u64 mio_int0 :1 ; +u64 m1_un_wi :1 ; +u64 m1_un_b0 :1 ; +u64 m1_up_wi :1 ; +u64 m1_up_b0 :1 ; +u64 m0_un_wi :1 ; +u64 m0_un_b0 :1 ; +u64 m0_up_wi :1 ; +u64 m0_up_b0 :1 ; +u64 reserved_6_7 :2 ; +u64 ptime :1 ; +u64 pcnt :1 ; +u64 iob2big :1 ; +u64 bar0_to :1 ; +u64 reserved_1_1 :1 ; +u64 rml_to :1 ; + } cn68xx; +struct cvmx_sli_int_sum_cn68xx cn68xxp1; +struct cvmx_sli_int_sum_cn70xx { +u64 reserved_61_63 :3 ; +u64 ill_pad :1 ; +u64 sprt3_err :1 ; +u64 sprt2_err :1 ; +u64 sprt1_err :1 ; +u64 sprt0_err :1 ; +u64 pins_err :1 ; +u64 pop_err :1 ; +u64 pdi_err :1 ; +u64 pgl_err :1 ; +u64 pin_bp :1 ; +u64 pout_err :1 ; +u64 psldbof :1 ; +u64 pidbof :1 ; +u64 reserved_38_47 :10 ; +u64 dtime :2 ; +u64 dcnt :2 ; +u64 dmafi :2 ; +u64 reserved_30_31 :2 ; +u64 mac2_int :1 ; +u64 mio_int2 :1 ; +u64 m3_un_wi :1 ; +u64 m3_un_b0 :1 ; +u64 m3_up_wi :1 ; +u64 m3_up_b0 :1 ; +u64 m2_un_wi :1 ; +u64 m2_un_b0 :1 ; +u64 m2_up_wi :1 ; +u64 m2_up_b0 :1 ; +u64 mac1_int :1 ; +u64 mac0_int :1 ; +u64 mio_int1 :1 ; +u64 mio_int0 :1 ; +u64 m1_un_wi :1 ; +u64 m1_un_b0 :1 ; +u64 m1_up_wi :1 ; +u64 m1_up_b0 :1 ; +u64 m0_un_wi :1 ; +u64 m0_un_b0 :1 ; +u64 m0_up_wi :1 ; +u64 m0_up_b0 :1 ; +u64 reserved_6_7 :2 ; +u64 ptime :1 ; +u64 pcnt :1 ; +u64 iob2big :1 ; +u64 bar0_to :1 ; +u64 reserved_1_1 :1 ; +u64 rml_to :1 ; + } cn70xx; +struct cvmx_sli_int_sum_cn70xx cn70xxp1; +struct cvmx_sli_int_sum_cn78xxp1 { +u64 reserved_60_63 :4 ; +u64 sprt3_err :1 ; +u64 sprt2_err :1 ; +u64 sprt1_err :1 ; +u64 sprt0_err :1 ; +u64 pins_err :1 ; +u64 pop_err :1 ; +u64 pdi_err :1 ; +u64 pgl_err :1 ; +u64 reserved_50_51 :2 ; +u64 psldbof :1 ; +u64 pidbof :1 ; +u64 reserved_38_47 :10 ; +u64 dtime :2 ; +u64 dcnt :2 ; +u64 dmafi :2 ; +u64 reserved_29_31 :3 ; +u64 vf_err :1 ; +u64 m3_un_wi :1 ; +u64 m3_un_b0 :1 ; +u64 m3_up_wi :1 ; +u64 m3_up_b0 :1 ; +u64 m2_un_wi :1 ; +u64 m2_un_b0 :1 ; +u64 m2_up_wi :1 ; +u64 m2_up_b0 :1 ; +u64 reserved_18_19 :2 ; +u64 mio_int1 :1 ; +u64 mio_int0 :1 ; +u64 m1_un_wi :1 ; +u64 m1_un_b0 :1 ; +u64 m1_up_wi :1 ; +u64 m1_up_b0 :1 ; +u64 m0_un_wi :1 ; +u64 m0_un_b0 :1 ; +u64 m0_up_wi :1 ; +u64 m0_up_b0 :1 ; +u64 mio_int3 :1 ; +u64 mio_int2 :1 ; +u64 ptime :1 ; +u64 pcnt :1 ; +u64 reserved_1_3 :3 ; +u64 rml_to :1 ; + } cn78xxp1; +struct cvmx_sli_int_sum_cn61xx cnf71xx; +}; + +typedef union cvmx_sli_int_sum cvmx_sli_int_sum_t ; + +/** +* cvmx_sli_last_win_rdata0 +* +* The data from the last initiated window read by MAC 0. +* +*/ +union cvmx_sli_last_win_rdata0 { +u64 u64; +struct cvmx_sli_last_win_rdata0_s { +u64 data :64 ; + } s; +struct cvmx_sli_last_win_rdata0_s cn61xx; +struct cvmx_sli_last_win_rdata0_s cn63xx; +struct cvmx_sli_last_win_rdata0_s cn63xxp1; +struct cvmx_sli_last_win_rdata0_s cn66xx; +struct cvmx_sli_last_win_rdata0_s cn68xx; +struct cvmx_sli_last_win_rdata0_s cn68xxp1; +struct cvmx_sli_last_win_rdata0_s cn70xx; +struct cvmx_sli_last_win_rdata0_s cn70xxp1; +struct cvmx_sli_last_win_rdata0_s cnf71xx; +}; + +typedef union cvmx_sli_last_win_rdata0 cvmx_sli_last_win_rdata0_t ; + +/** +* cvmx_sli_last_win_rdata1 +* +* The data from the last initiated window read by MAC 1. +* +*/ +union cvmx_sli_last_win_rdata1 { +u64 u64; +struct cvmx_sli_last_win_rdata1_s { +u64 data :64 ; + } s; +struct cvmx_sli_last_win_rdata1_s cn61xx; +struct cvmx_sli_last_win_rdata1_s cn63xx; +struct cvmx_sli_last_win_rdata1_s cn63xxp1; +struct cvmx_sli_last_win_rdata1_s cn66xx; +struct cvmx_sli_last_win_rdata1_s cn68xx; +struct cvmx_sli_last_win_rdata1_s cn68xxp1; +struct cvmx_sli_last_win_rdata1_s cn70xx; +struct cvmx_sli_last_win_rdata1_s cn70xxp1; +struct cvmx_sli_last_win_rdata1_s cnf71xx; +}; + +typedef union cvmx_sli_last_win_rdata1 cvmx_sli_last_win_rdata1_t ; + +/** +* cvmx_sli_last_win_rdata2 +* +* The data from the last initiated window read by MAC 2. +* +*/ +union cvmx_sli_last_win_rdata2 { +u64 u64; +struct cvmx_sli_last_win_rdata2_s { +u64 data :64 ; + } s; +struct cvmx_sli_last_win_rdata2_s cn61xx; +struct cvmx_sli_last_win_rdata2_s cn66xx; +struct cvmx_sli_last_win_rdata2_s cn70xx; +struct cvmx_sli_last_win_rdata2_s cn70xxp1; +struct cvmx_sli_last_win_rdata2_s cnf71xx; +}; + +typedef union cvmx_sli_last_win_rdata2 cvmx_sli_last_win_rdata2_t ; + +/** +* cvmx_sli_last_win_rdata3 +* +* The data from the last initiated window read by MAC 3. +* +*/ +union cvmx_sli_last_win_rdata3 { +u64 u64; +struct cvmx_sli_last_win_rdata3_s { +u64 data :64 ; + } s; +struct cvmx_sli_last_win_rdata3_s cn61xx; +struct cvmx_sli_last_win_rdata3_s cn66xx; +struct cvmx_sli_last_win_rdata3_s cn70xx; +struct cvmx_sli_last_win_rdata3_s cn70xxp1; +struct cvmx_sli_last_win_rdata3_s cnf71xx; +}; + +typedef union cvmx_sli_last_win_rdata3 cvmx_sli_last_win_rdata3_t ; + +/** +* cvmx_sli_mac#_pf#_dma_vf_int +* +* When an error response is received for a VF DMA transaction read, the appropriate VF indexed +* bit is set. The appropriate PF should read the appropriate register. +* Indexed by (MAC index) SLI_PORT_E. +* This CSR array is valid only for SLI_PORT_E::PEM0 PF0. +*/ +union cvmx_sli_macx_pfx_dma_vf_int { +u64 u64; +struct cvmx_sli_macx_pfx_dma_vf_int_s { +u64 vf_int :64 ; + } s; +struct cvmx_sli_macx_pfx_dma_vf_int_s cn73xx; +struct cvmx_sli_macx_pfx_dma_vf_int_s cn78xx; +struct cvmx_sli_macx_pfx_dma_vf_int_s cnf75xx; +}; + +typedef union cvmx_sli_macx_pfx_dma_vf_int cvmx_sli_macx_pfx_dma_vf_int_t ; + +/** +* cvmx_sli_mac#_pf#_dma_vf_int_enb +* +* Indexed by (MAC index) SLI_PORT_E. +* This CSR array is valid only for SLI_PORT_E::PEM0 PF0. +*/ +union cvmx_sli_macx_pfx_dma_vf_int_enb { +u64 u64; +struct cvmx_sli_macx_pfx_dma_vf_int_enb_s { +u64 vf_int_enb :64 ; + } s; +struct cvmx_sli_macx_pfx_dma_vf_int_enb_s cn73xx; +struct cvmx_sli_macx_pfx_dma_vf_int_enb_s cn78xx; +struct cvmx_sli_macx_pfx_dma_vf_int_enb_s cnf75xx; +}; + +typedef union cvmx_sli_macx_pfx_dma_vf_int_enb cvmx_sli_macx_pfx_dma_vf_int_enb_t ; + +/** +* cvmx_sli_mac#_pf#_flr_vf_int +* +* Indexed by (MAC index) SLI_PORT_E. +* This CSR array is valid only for SLI_PORT_E::PEM0 PF0. +*/ +union cvmx_sli_macx_pfx_flr_vf_int { +u64 u64; +struct cvmx_sli_macx_pfx_flr_vf_int_s { +u64 vf_int :64 ; + } s; +struct cvmx_sli_macx_pfx_flr_vf_int_s cn73xx; +struct cvmx_sli_macx_pfx_flr_vf_int_s cn78xx; +struct cvmx_sli_macx_pfx_flr_vf_int_s cnf75xx; +}; + +typedef union cvmx_sli_macx_pfx_flr_vf_int cvmx_sli_macx_pfx_flr_vf_int_t ; + +/** +* cvmx_sli_mac#_pf#_int_enb +* +* Interrupt enable register for a given PF SLI_MAC()_PF()_INT_SUM register. +* Indexed by (MAC index) SLI_PORT_E. +*/ +union cvmx_sli_macx_pfx_int_enb { +u64 u64; +struct cvmx_sli_macx_pfx_int_enb_s { +u64 pppf_err :1 ; +u64 ppvf_err :1 ; +u64 pktpf_err :1 ; +u64 pktvf_err :1 ; +u64 dmapf_err :1 ; +u64 dmavf_err :1 ; +u64 vf_mbox :1 ; +u64 reserved_38_56 :19 ; +u64 dtime :2 ; +u64 dcnt :2 ; +u64 dmafi :2 ; +u64 reserved_12_31 :20 ; +u64 un_wi :1 ; +u64 un_b0 :1 ; +u64 up_wi :1 ; +u64 up_b0 :1 ; +u64 reserved_6_7 :2 ; +u64 ptime :1 ; +u64 pcnt :1 ; +u64 reserved_2_3 :2 ; +u64 mio_int :1 ; +u64 rml_to :1 ; + } s; +struct cvmx_sli_macx_pfx_int_enb_s cn73xx; +struct cvmx_sli_macx_pfx_int_enb_s cn78xx; +struct cvmx_sli_macx_pfx_int_enb_s cnf75xx; +}; + +typedef union cvmx_sli_macx_pfx_int_enb cvmx_sli_macx_pfx_int_enb_t ; + +/** +* cvmx_sli_mac#_pf#_int_sum +* +* Interrupt summary register for a given PF. Indexed (MAC index) by SLI_PORT_E. +* The fields in this register are set when an interrupt condition occurs; write 1 to clear. +*/ +union cvmx_sli_macx_pfx_int_sum { +u64 u64; +struct cvmx_sli_macx_pfx_int_sum_s { +u64 pppf_err :1 ; +u64 ppvf_err :1 ; +u64 pktpf_err :1 ; +u64 pktvf_err :1 ; +u64 dmapf_err :1 ; +u64 dmavf_err :1 ; +u64 vf_mbox :1 ; +u64 reserved_38_56 :19 ; +u64 dtime :2 ; +u64 dcnt :2 ; +u64 dmafi :2 ; +u64 reserved_12_31 :20 ; +u64 un_wi :1 ; +u64 un_b0 :1 ; +u64 up_wi :1 ; +u64 up_b0 :1 ; +u64 reserved_6_7 :2 ; +u64 ptime :1 ; +u64 pcnt :1 ; +u64 reserved_2_3 :2 ; +u64 mio_int :1 ; +u64 rml_to :1 ; + } s; +struct cvmx_sli_macx_pfx_int_sum_s cn73xx; +struct cvmx_sli_macx_pfx_int_sum_s cn78xx; +struct cvmx_sli_macx_pfx_int_sum_s cnf75xx; +}; + +typedef union cvmx_sli_macx_pfx_int_sum cvmx_sli_macx_pfx_int_sum_t ; + +/** +* cvmx_sli_mac#_pf#_mbox_int +*
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.29.2
Part of the diff is not shown here. View the raw message.
PATCH 29/50 mips: octeon: Add cvmx-smix-defs.h header file
In reply to Stefan RoeseFrom: Aaron Williams <[email protected]>
Import cvmx-smix-defs.h header file from 2013 U-Boot. It will be used by the later added drivers to support PCIe and networking on the MIPS Octeon II / III platforms.
---
.../mach-octeon/include/mach/cvmx-smix-defs.h | 360 ++++++++++++++++++ 1 file changed, 360 insertions(+) create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-smix-defs.h
arch/mips/mach-octeon/include/mach/cvmx-smix-defs.h new file +360 -0
@@ -0,0 +1,360 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2020 Marvell International Ltd. +* +* Configuration and status register (CSR) type definitions for +* Octeon smix. +*/ + +#ifndef __CVMX_SMIX_DEFS_H__ +#define __CVMX_SMIX_DEFS_H__ + +static inline u64 CVMX_SMIX_CLK (unsigned long offset) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CNF71XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +return 0x0001180000001818ull + (offset) *256 ; +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0001180000003818ull + (offset) *128 ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x0001180000003818ull + (offset) *128 ; +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x0001180000003818ull + (offset) *128 ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x0001180000003818ull + (offset) *128 ; + } +return 0x0001180000003818ull + (offset) *128 ; +} + +static inline u64 CVMX_SMIX_CMD (unsigned long offset) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CNF71XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +return 0x0001180000001800ull + (offset) *256 ; +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0001180000003800ull + (offset) *128 ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x0001180000003800ull + (offset) *128 ; +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x0001180000003800ull + (offset) *128 ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x0001180000003800ull + (offset) *128 ; + } +return 0x0001180000003800ull + (offset) *128 ; +} + +static inline u64 CVMX_SMIX_EN (unsigned long offset) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CNF71XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +return 0x0001180000001820ull + (offset) *256 ; +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0001180000003820ull + (offset) *128 ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x0001180000003820ull + (offset) *128 ; +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x0001180000003820ull + (offset) *128 ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x0001180000003820ull + (offset) *128 ; + } +return 0x0001180000003820ull + (offset) *128 ; +} + +static inline u64 CVMX_SMIX_RD_DAT (unsigned long offset) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CNF71XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +return 0x0001180000001810ull + (offset) *256 ; +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0001180000003810ull + (offset) *128 ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x0001180000003810ull + (offset) *128 ; +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x0001180000003810ull + (offset) *128 ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x0001180000003810ull + (offset) *128 ; + } +return 0x0001180000003810ull + (offset) *128 ; +} + +static inline u64 CVMX_SMIX_WR_DAT (unsigned long offset) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CN70XX &OCTEON_FAMILY_MASK : +case OCTEON_CNF71XX &OCTEON_FAMILY_MASK : +case OCTEON_CN61XX &OCTEON_FAMILY_MASK : +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +return 0x0001180000001808ull + (offset) *256 ; +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x0001180000003808ull + (offset) *128 ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x0001180000003808ull + (offset) *128 ; +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x0001180000003808ull + (offset) *128 ; +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x0001180000003808ull + (offset) *128 ; + } +return 0x0001180000003808ull + (offset) *128 ; +} + +/** +* cvmx_smi#_clk +* +* This register determines the SMI timing characteristics. +* If software wants to change SMI CLK timing parameters ([SAMPLE]/[SAMPLE_HI]), software +* must delay the SMI_()_CLK CSR write by at least 512 coprocessor-clock cycles after the +* previous SMI operation is finished. +*/ +union cvmx_smix_clk { +u64 u64; +struct cvmx_smix_clk_s { +u64 reserved_25_63 :39 ; +u64 mode :1 ; +u64 reserved_21_23 :3 ; +u64 sample_hi :5 ; +u64 sample_mode :1 ; +u64 reserved_14_14 :1 ; +u64 clk_idle :1 ; +u64 preamble :1 ; +u64 sample :4 ; +u64 phase :8 ; + } s; +struct cvmx_smix_clk_cn30xx { +u64 reserved_21_63 :43 ; +u64 sample_hi :5 ; +u64 sample_mode :1 ; +u64 reserved_14_14 :1 ; +u64 clk_idle :1 ; +u64 preamble :1 ; +u64 sample :4 ; +u64 phase :8 ; + } cn30xx; +struct cvmx_smix_clk_cn30xx cn31xx; +struct cvmx_smix_clk_cn30xx cn38xx; +struct cvmx_smix_clk_cn30xx cn38xxp2; +struct cvmx_smix_clk_s cn50xx; +struct cvmx_smix_clk_s cn52xx; +struct cvmx_smix_clk_s cn52xxp1; +struct cvmx_smix_clk_s cn56xx; +struct cvmx_smix_clk_s cn56xxp1; +struct cvmx_smix_clk_cn30xx cn58xx; +struct cvmx_smix_clk_cn30xx cn58xxp1; +struct cvmx_smix_clk_s cn61xx; +struct cvmx_smix_clk_s cn63xx; +struct cvmx_smix_clk_s cn63xxp1; +struct cvmx_smix_clk_s cn66xx; +struct cvmx_smix_clk_s cn68xx; +struct cvmx_smix_clk_s cn68xxp1; +struct cvmx_smix_clk_s cn70xx; +struct cvmx_smix_clk_s cn70xxp1; +struct cvmx_smix_clk_s cn73xx; +struct cvmx_smix_clk_s cn78xx; +struct cvmx_smix_clk_s cn78xxp1; +struct cvmx_smix_clk_s cnf71xx; +struct cvmx_smix_clk_s cnf75xx; +}; + +typedef union cvmx_smix_clk cvmx_smix_clk_t ; + +/** +* cvmx_smi#_cmd +* +* This register forces a read or write command to the PHY. Write operations to this register +* create SMI transactions. Software will poll (depending on the transaction type). +*/ +union cvmx_smix_cmd { +u64 u64; +struct cvmx_smix_cmd_s { +u64 reserved_18_63 :46 ; +u64 phy_op :2 ; +u64 reserved_13_15 :3 ; +u64 phy_adr :5 ; +u64 reserved_5_7 :3 ; +u64 reg_adr :5 ; + } s; +struct cvmx_smix_cmd_cn30xx { +u64 reserved_17_63 :47 ; +u64 phy_op :1 ; +u64 reserved_13_15 :3 ; +u64 phy_adr :5 ; +u64 reserved_5_7 :3 ; +u64 reg_adr :5 ; + } cn30xx; +struct cvmx_smix_cmd_cn30xx cn31xx; +struct cvmx_smix_cmd_cn30xx cn38xx; +struct cvmx_smix_cmd_cn30xx cn38xxp2; +struct cvmx_smix_cmd_s cn50xx; +struct cvmx_smix_cmd_s cn52xx; +struct cvmx_smix_cmd_s cn52xxp1; +struct cvmx_smix_cmd_s cn56xx; +struct cvmx_smix_cmd_s cn56xxp1; +struct cvmx_smix_cmd_cn30xx cn58xx; +struct cvmx_smix_cmd_cn30xx cn58xxp1; +struct cvmx_smix_cmd_s cn61xx; +struct cvmx_smix_cmd_s cn63xx; +struct cvmx_smix_cmd_s cn63xxp1; +struct cvmx_smix_cmd_s cn66xx; +struct cvmx_smix_cmd_s cn68xx; +struct cvmx_smix_cmd_s cn68xxp1; +struct cvmx_smix_cmd_s cn70xx; +struct cvmx_smix_cmd_s cn70xxp1; +struct cvmx_smix_cmd_s cn73xx; +struct cvmx_smix_cmd_s cn78xx; +struct cvmx_smix_cmd_s cn78xxp1; +struct cvmx_smix_cmd_s cnf71xx; +struct cvmx_smix_cmd_s cnf75xx; +}; + +typedef union cvmx_smix_cmd cvmx_smix_cmd_t ; + +/** +* cvmx_smi#_en +* +* Enables the SMI interface. +* +*/ +union cvmx_smix_en { +u64 u64; +struct cvmx_smix_en_s { +u64 reserved_1_63 :63 ; +u64 en :1 ; + } s; +struct cvmx_smix_en_s cn30xx; +struct cvmx_smix_en_s cn31xx; +struct cvmx_smix_en_s cn38xx; +struct cvmx_smix_en_s cn38xxp2; +struct cvmx_smix_en_s cn50xx; +struct cvmx_smix_en_s cn52xx; +struct cvmx_smix_en_s cn52xxp1; +struct cvmx_smix_en_s cn56xx; +struct cvmx_smix_en_s cn56xxp1; +struct cvmx_smix_en_s cn58xx; +struct cvmx_smix_en_s cn58xxp1; +struct cvmx_smix_en_s cn61xx; +struct cvmx_smix_en_s cn63xx; +struct cvmx_smix_en_s cn63xxp1; +struct cvmx_smix_en_s cn66xx; +struct cvmx_smix_en_s cn68xx; +struct cvmx_smix_en_s cn68xxp1; +struct cvmx_smix_en_s cn70xx; +struct cvmx_smix_en_s cn70xxp1; +struct cvmx_smix_en_s cn73xx; +struct cvmx_smix_en_s cn78xx; +struct cvmx_smix_en_s cn78xxp1; +struct cvmx_smix_en_s cnf71xx; +struct cvmx_smix_en_s cnf75xx; +}; + +typedef union cvmx_smix_en cvmx_smix_en_t ; + +/** +* cvmx_smi#_rd_dat +* +* This register contains the data in a read operation. +* +*/ +union cvmx_smix_rd_dat { +u64 u64; +struct cvmx_smix_rd_dat_s { +u64 reserved_18_63 :46 ; +u64 pending :1 ; +u64 val :1 ; +u64 dat :16 ; + } s; +struct cvmx_smix_rd_dat_s cn30xx; +struct cvmx_smix_rd_dat_s cn31xx; +struct cvmx_smix_rd_dat_s cn38xx; +struct cvmx_smix_rd_dat_s cn38xxp2; +struct cvmx_smix_rd_dat_s cn50xx; +struct cvmx_smix_rd_dat_s cn52xx; +struct cvmx_smix_rd_dat_s cn52xxp1; +struct cvmx_smix_rd_dat_s cn56xx; +struct cvmx_smix_rd_dat_s cn56xxp1; +struct cvmx_smix_rd_dat_s cn58xx; +struct cvmx_smix_rd_dat_s cn58xxp1; +struct cvmx_smix_rd_dat_s cn61xx; +struct cvmx_smix_rd_dat_s cn63xx; +struct cvmx_smix_rd_dat_s cn63xxp1; +struct cvmx_smix_rd_dat_s cn66xx; +struct cvmx_smix_rd_dat_s cn68xx; +struct cvmx_smix_rd_dat_s cn68xxp1; +struct cvmx_smix_rd_dat_s cn70xx; +struct cvmx_smix_rd_dat_s cn70xxp1; +struct cvmx_smix_rd_dat_s cn73xx; +struct cvmx_smix_rd_dat_s cn78xx; +struct cvmx_smix_rd_dat_s cn78xxp1; +struct cvmx_smix_rd_dat_s cnf71xx; +struct cvmx_smix_rd_dat_s cnf75xx; +}; + +typedef union cvmx_smix_rd_dat cvmx_smix_rd_dat_t ; + +/** +* cvmx_smi#_wr_dat +* +* This register provides the data for a write operation. +* +*/ +union cvmx_smix_wr_dat { +u64 u64; +struct cvmx_smix_wr_dat_s { +u64 reserved_18_63 :46 ; +u64 pending :1 ; +u64 val :1 ; +u64 dat :16 ; + } s; +struct cvmx_smix_wr_dat_s cn30xx; +struct cvmx_smix_wr_dat_s cn31xx; +struct cvmx_smix_wr_dat_s cn38xx; +struct cvmx_smix_wr_dat_s cn38xxp2; +struct cvmx_smix_wr_dat_s cn50xx; +struct cvmx_smix_wr_dat_s cn52xx; +struct cvmx_smix_wr_dat_s cn52xxp1; +struct cvmx_smix_wr_dat_s cn56xx; +struct cvmx_smix_wr_dat_s cn56xxp1; +struct cvmx_smix_wr_dat_s cn58xx; +struct cvmx_smix_wr_dat_s cn58xxp1; +struct cvmx_smix_wr_dat_s cn61xx; +struct cvmx_smix_wr_dat_s cn63xx; +struct cvmx_smix_wr_dat_s cn63xxp1; +struct cvmx_smix_wr_dat_s cn66xx; +struct cvmx_smix_wr_dat_s cn68xx; +struct cvmx_smix_wr_dat_s cn68xxp1; +struct cvmx_smix_wr_dat_s cn70xx; +struct cvmx_smix_wr_dat_s cn70xxp1; +struct cvmx_smix_wr_dat_s cn73xx; +struct cvmx_smix_wr_dat_s cn78xx; +struct cvmx_smix_wr_dat_s cn78xxp1; +struct cvmx_smix_wr_dat_s cnf71xx; +struct cvmx_smix_wr_dat_s cnf75xx; +}; + +typedef union cvmx_smix_wr_dat cvmx_smix_wr_dat_t ; + +#endif
Signature · 1 line
2.29.2
PATCH 30/50 mips: octeon: Add cvmx-sriomaintx-defs.h header file
In reply to Stefan RoeseFrom: Aaron Williams <[email protected]>
Import cvmx-sriomaintx-defs.h header file from 2013 U-Boot. It will be used by the later added drivers to support PCIe and networking on the MIPS Octeon II / III platforms.
---
.../include/mach/cvmx-sriomaintx-defs.h | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-sriomaintx-defs.h
arch/mips/mach-octeon/include/mach/cvmx-sriomaintx-defs.h new file +61 -0
@@ -0,0 +1,61 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2020 Marvell International Ltd. +*/ + +#ifndef __CVMX_SRIOMAINTX_DEFS_H__ +#define __CVMX_SRIOMAINTX_DEFS_H__ + +static inline u64 CVMX_SRIOMAINTX_PORT_0_CTL2 (unsigned long offset) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +return 0x0000010000000154ull + (offset) *0x100000000ull ; +case OCTEON_CN66XX &OCTEON_FAMILY_MASK : +return 0x0000000000000154ull ; +case OCTEON_CN63XX &OCTEON_FAMILY_MASK : +return 0x0000000000000154ull + (offset) *0x100000000ull ; + } +return 0x0000010000000154ull + (offset) *0x100000000ull ; +} + +/** +* cvmx_sriomaint#_port_0_ctl2 +* +* These registers are accessed when a local processor or an external +* device wishes to examine the port baudrate information. The automatic +* baud rate feature is not available on this device. The SUP_* and ENB_* +* fields are set directly by the SRIO()_STATUS_REG[SPD] bits as a +* reference but otherwise have no effect. +* +* WARNING!! Writes to this register will reinitialize the SRIO link. +*/ +union cvmx_sriomaintx_port_0_ctl2 { +u32 u32; +struct cvmx_sriomaintx_port_0_ctl2_s { +u32 sel_baud :4 ; +u32 baud_sup :1 ; +u32 baud_enb :1 ; +u32 sup_125g :1 ; +u32 enb_125g :1 ; +u32 sup_250g :1 ; +u32 enb_250g :1 ; +u32 sup_312g :1 ; +u32 enb_312g :1 ; +u32 sub_500g :1 ; +u32 enb_500g :1 ; +u32 sup_625g :1 ; +u32 enb_625g :1 ; +u32 reserved_2_15 :14 ; +u32 tx_emph :1 ; +u32 emph_en :1 ; + } s; +struct cvmx_sriomaintx_port_0_ctl2_s cn63xx; +struct cvmx_sriomaintx_port_0_ctl2_s cn63xxp1; +struct cvmx_sriomaintx_port_0_ctl2_s cn66xx; +struct cvmx_sriomaintx_port_0_ctl2_s cnf75xx; +}; + +typedef union cvmx_sriomaintx_port_0_ctl2 cvmx_sriomaintx_port_0_ctl2_t ; + +#endif
Signature · 1 line
2.29.2
PATCH 31/50 mips: octeon: Add cvmx-sriox-defs.h header file
In reply to Stefan RoeseFrom: Aaron Williams <[email protected]>
Import cvmx-sriox-defs.h header file from 2013 U-Boot. It will be used by the later added drivers to support PCIe and networking on the MIPS Octeon II / III platforms.
---
.../include/mach/cvmx-sriox-defs.h | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-sriox-defs.h
arch/mips/mach-octeon/include/mach/cvmx-sriox-defs.h new file +44 -0
@@ -0,0 +1,44 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2020 Marvell International Ltd. +*/ + +#ifndef __CVMX_SRIOX_DEFS_H__ +#define __CVMX_SRIOX_DEFS_H__ + +#define CVMX_SRIOX_STATUS_REG (offset) (0x00011800C8000100ull + ((offset) & 3) * 0x1000000ull) + +/** +* cvmx_srio#_status_reg +* +* The SRIO field displays if the port has been configured for SRIO operation. This register +* can be read regardless of whether the SRIO is selected or being reset. Although some other +* registers can be accessed while the ACCESS bit is zero (see individual registers for details), +* the majority of SRIO registers and all the SRIOMAINT registers can be used only when the +* ACCESS bit is asserted. +* +* This register is reset by the coprocessor-clock reset. +*/ +union cvmx_sriox_status_reg { +u64 u64; +struct cvmx_sriox_status_reg_s { +u64 reserved_9_63 :55 ; +u64 host :1 ; +u64 spd :4 ; +u64 run_type :2 ; +u64 access :1 ; +u64 srio :1 ; + } s; +struct cvmx_sriox_status_reg_cn63xx { +u64 reserved_2_63 :62 ; +u64 access :1 ; +u64 srio :1 ; + } cn63xx; +struct cvmx_sriox_status_reg_cn63xx cn63xxp1; +struct cvmx_sriox_status_reg_cn63xx cn66xx; +struct cvmx_sriox_status_reg_s cnf75xx; +}; + +typedef union cvmx_sriox_status_reg cvmx_sriox_status_reg_t ; + +#endif
Signature · 1 line
2.29.2
PATCH 32/50 mips: octeon: Add cvmx-sso-defs.h header file
In reply to Stefan RoeseFrom: Aaron Williams <[email protected]>
Import cvmx-sso-defs.h header file from 2013 U-Boot. It will be used by the later added drivers to support PCIe and networking on the MIPS Octeon II / III platforms.
---
.../mach-octeon/include/mach/cvmx-sso-defs.h | 2904 +++++++++++++++++ 1 file changed, 2904 insertions(+) create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-sso-defs.h
arch/mips/mach-octeon/include/mach/cvmx-sso-defs.h new file +2904 -0
@@ -0,0 +1,2904 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2020 Marvell International Ltd. +* +* Configuration and status register (CSR) type definitions for +* Octeon sso. +*/ + +#ifndef __CVMX_SSO_DEFS_H__ +#define __CVMX_SSO_DEFS_H__ + +#define CVMX_SSO_ACTIVE_CYCLES (0x00016700000010E8ull) +#define CVMX_SSO_ACTIVE_CYCLESX (offset) (0x0001670000001100ull + ((offset) & 3) * 8) +#define CVMX_SSO_AW_ADD (0x0001670000002080ull) +#define CVMX_SSO_AW_CFG (0x00016700000010F0ull) +#define CVMX_SSO_AW_ECO (0x0001670000001030ull) +#define CVMX_SSO_AW_READ_ARB (0x0001670000002090ull) +#define CVMX_SSO_AW_STATUS (0x00016700000010E0ull) +#define CVMX_SSO_AW_TAG_LATENCY_PC (0x00016700000020A8ull) +#define CVMX_SSO_AW_TAG_REQ_PC (0x00016700000020A0ull) +#define CVMX_SSO_AW_WE (0x0001670000001080ull) +#define CVMX_SSO_BIST_STAT (0x0001670000001078ull) +#define CVMX_SSO_BIST_STATUS0 (0x0001670000001200ull) +#define CVMX_SSO_BIST_STATUS1 (0x0001670000001208ull) +#define CVMX_SSO_BIST_STATUS2 (0x0001670000001210ull) +#define CVMX_SSO_CFG (0x0001670000001088ull) +#define CVMX_SSO_DS_PC (0x0001670000001070ull) +#define CVMX_SSO_ECC_CTL0 (0x0001670000001280ull) +#define CVMX_SSO_ECC_CTL1 (0x0001670000001288ull) +#define CVMX_SSO_ECC_CTL2 (0x0001670000001290ull) +#define CVMX_SSO_ERR (0x0001670000001038ull) +#define CVMX_SSO_ERR0 (0x0001670000001240ull) +#define CVMX_SSO_ERR1 (0x0001670000001248ull) +#define CVMX_SSO_ERR2 (0x0001670000001250ull) +#define CVMX_SSO_ERR_ENB (0x0001670000001030ull) +#define CVMX_SSO_FIDX_ECC_CTL (0x00016700000010D0ull) +#define CVMX_SSO_FIDX_ECC_ST (0x00016700000010D8ull) +#define CVMX_SSO_FPAGE_CNT (0x0001670000001090ull) +#define CVMX_SSO_GRPX_AQ_CNT (offset) (0x0001670020000700ull + ((offset) & 255) * 0x10000ull) +#define CVMX_SSO_GRPX_AQ_THR (offset) (0x0001670020000800ull + ((offset) & 255) * 0x10000ull) +#define CVMX_SSO_GRPX_DS_PC (offset) (0x0001670020001400ull + ((offset) & 255) * 0x10000ull) +#define CVMX_SSO_GRPX_EXT_PC (offset) (0x0001670020001100ull + ((offset) & 255) * 0x10000ull) +#define CVMX_SSO_GRPX_IAQ_THR (offset) (0x0001670020000000ull + ((offset) & 255) * 0x10000ull) +#define CVMX_SSO_GRPX_INT (offset) (0x0001670020000400ull + ((offset) & 255) * 0x10000ull) +#define CVMX_SSO_GRPX_INT_CNT (offset) (0x0001670020000600ull + ((offset) & 255) * 0x10000ull) +#define CVMX_SSO_GRPX_INT_THR (offset) (0x0001670020000500ull + ((offset) & 255) * 0x10000ull) +#define CVMX_SSO_GRPX_PRI (offset) (0x0001670020000200ull + ((offset) & 255) * 0x10000ull) +#define CVMX_SSO_GRPX_TAQ_THR (offset) (0x0001670020000100ull + ((offset) & 255) * 0x10000ull) +#define CVMX_SSO_GRPX_TS_PC (offset) (0x0001670020001300ull + ((offset) & 255) * 0x10000ull) +#define CVMX_SSO_GRPX_WA_PC (offset) (0x0001670020001200ull + ((offset) & 255) * 0x10000ull) +#define CVMX_SSO_GRPX_WS_PC (offset) (0x0001670020001000ull + ((offset) & 255) * 0x10000ull) +#define CVMX_SSO_GWE_CFG (0x0001670000001098ull) +#define CVMX_SSO_GWE_RANDOM (0x00016700000010B0ull) +#define CVMX_SSO_GW_ECO (0x0001670000001038ull) +#define CVMX_SSO_IDX_ECC_CTL (0x00016700000010C0ull) +#define CVMX_SSO_IDX_ECC_ST (0x00016700000010C8ull) +#define CVMX_SSO_IENTX_LINKS (offset) (0x00016700A0060000ull + ((offset) & 4095) * 8) +#define CVMX_SSO_IENTX_PENDTAG (offset) (0x00016700A0040000ull + ((offset) & 4095) * 8) +#define CVMX_SSO_IENTX_QLINKS (offset) (0x00016700A0080000ull + ((offset) & 4095) * 8) +#define CVMX_SSO_IENTX_TAG (offset) (0x00016700A0000000ull + ((offset) & 4095) * 8) +#define CVMX_SSO_IENTX_WQPGRP (offset) (0x00016700A0020000ull + ((offset) & 4095) * 8) +#define CVMX_SSO_IPL_CONFX (offset) (0x0001670080080000ull + ((offset) & 255) * 8) +#define CVMX_SSO_IPL_DESCHEDX (offset) (0x0001670080060000ull + ((offset) & 255) * 8) +#define CVMX_SSO_IPL_FREEX (offset) (0x0001670080000000ull + ((offset) & 7) * 8) +#define CVMX_SSO_IPL_IAQX (offset) (0x0001670080040000ull + ((offset) & 255) * 8) +#define CVMX_SSO_IQ_CNTX (offset) (0x0001670000009000ull + ((offset) & 7) * 8) +#define CVMX_SSO_IQ_COM_CNT (0x0001670000001058ull) +#define CVMX_SSO_IQ_INT (0x0001670000001048ull) +#define CVMX_SSO_IQ_INT_EN (0x0001670000001050ull) +#define CVMX_SSO_IQ_THRX (offset) (0x000167000000A000ull + ((offset) & 7) * 8) +#define CVMX_SSO_NOS_CNT (0x0001670000001040ull) +#define CVMX_SSO_NW_TIM (0x0001670000001028ull) +#define CVMX_SSO_OTH_ECC_CTL (0x00016700000010B0ull) +#define CVMX_SSO_OTH_ECC_ST (0x00016700000010B8ull) +#define CVMX_SSO_PAGE_CNT (0x0001670000001090ull) +#define CVMX_SSO_PND_ECC_CTL (0x00016700000010A0ull) +#define CVMX_SSO_PND_ECC_ST (0x00016700000010A8ull) +#define CVMX_SSO_PPX_ARB (offset) (0x0001670040000000ull + ((offset) & 63) * 0x10000ull) +#define CVMX_SSO_PPX_GRP_MSK (offset) (0x0001670000006000ull + ((offset) & 31) * 8) +#define CVMX_SSO_PPX_QOS_PRI (offset) (0x0001670000003000ull + ((offset) & 31) * 8) +#define CVMX_SSO_PPX_SX_GRPMSKX (a, b, c) \ + (0x0001670040001000ull + ((a) << 16) + ((b) << 5) + ((c) << 3)) +#define CVMX_SSO_PP_STRICT (0x00016700000010E0ull) +#define CVMX_SSO_QOSX_RND (offset) (0x0001670000002000ull + ((offset) & 7) * 8) +#define CVMX_SSO_QOS_THRX (offset) (0x000167000000B000ull + ((offset) & 7) * 8) +#define CVMX_SSO_QOS_WE (0x0001670000001080ull) +#define CVMX_SSO_RESET CVMX_SSO_RESET_FUNC() +static inline u64 CVMX_SSO_RESET_FUNC (void ) +{ +switch (cvmx_get_octeon_family ()) { +case OCTEON_CNF75XX &OCTEON_FAMILY_MASK : +case OCTEON_CN78XX &OCTEON_FAMILY_MASK : +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) +return 0x00016700000010F8ull ; +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 0x00016700000010F8ull ; +case OCTEON_CN73XX &OCTEON_FAMILY_MASK : +return 0x00016700000010F8ull ; +case OCTEON_CN68XX &OCTEON_FAMILY_MASK : +return 0x00016700000010F0ull ; + } +return 0x00016700000010F8ull ; +} + +#define CVMX_SSO_RWQ_HEAD_PTRX (offset) (0x000167000000C000ull + ((offset) & 7) * 8) +#define CVMX_SSO_RWQ_POP_FPTR (0x000167000000C408ull) +#define CVMX_SSO_RWQ_PSH_FPTR (0x000167000000C400ull) +#define CVMX_SSO_RWQ_TAIL_PTRX (offset) (0x000167000000C200ull + ((offset) & 7) * 8) +#define CVMX_SSO_SL_PPX_LINKS (offset) (0x0001670060000040ull + ((offset) & 63) * 0x10000ull) +#define CVMX_SSO_SL_PPX_PENDTAG (offset) (0x0001670060000000ull + ((offset) & 63) * 0x10000ull) +#define CVMX_SSO_SL_PPX_PENDWQP (offset) (0x0001670060000010ull + ((offset) & 63) * 0x10000ull) +#define CVMX_SSO_SL_PPX_TAG (offset) (0x0001670060000020ull + ((offset) & 63) * 0x10000ull) +#define CVMX_SSO_SL_PPX_WQP (offset) (0x0001670060000030ull + ((offset) & 63) * 0x10000ull) +#define CVMX_SSO_TAQX_LINK (offset) (0x00016700C0000000ull + ((offset) & 2047) * 4096) +#define CVMX_SSO_TAQX_WAEX_TAG (offset, block_id) \ + (0x00016700D0000000ull + (((offset) & 15) + ((block_id) & 2047) * 0x100ull) * 16) +#define CVMX_SSO_TAQX_WAEX_WQP (offset, block_id) \ + (0x00016700D0000008ull + (((offset) & 15) + ((block_id) & 2047) * 0x100ull) * 16) +#define CVMX_SSO_TAQ_ADD (0x00016700000020E0ull) +#define CVMX_SSO_TAQ_CNT (0x00016700000020C0ull) +#define CVMX_SSO_TIAQX_STATUS (offset) (0x00016700000C0000ull + ((offset) & 255) * 8) +#define CVMX_SSO_TOAQX_STATUS (offset) (0x00016700000D0000ull + ((offset) & 255) * 8) +#define CVMX_SSO_TS_PC (0x0001670000001068ull) +#define CVMX_SSO_WA_COM_PC (0x0001670000001060ull) +#define CVMX_SSO_WA_PCX (offset) (0x0001670000005000ull + ((offset) & 7) * 8) +#define CVMX_SSO_WQ_INT (0x0001670000001000ull) +#define CVMX_SSO_WQ_INT_CNTX (offset) (0x0001670000008000ull + ((offset) & 63) * 8) +#define CVMX_SSO_WQ_INT_PC (0x0001670000001020ull) +#define CVMX_SSO_WQ_INT_THRX (offset) (0x0001670000007000ull + ((offset) & 63) * 8) +#define CVMX_SSO_WQ_IQ_DIS (0x0001670000001010ull) +#define CVMX_SSO_WS_CFG (0x0001670000001088ull) +#define CVMX_SSO_WS_ECO (0x0001670000001048ull) +#define CVMX_SSO_WS_PCX (offset) (0x0001670000004000ull + ((offset) & 63) * 8) +#define CVMX_SSO_XAQX_HEAD_NEXT (offset) (0x00016700000A0000ull + ((offset) & 255) * 8) +#define CVMX_SSO_XAQX_HEAD_PTR (offset) (0x0001670000080000ull + ((offset) & 255) * 8) +#define CVMX_SSO_XAQX_TAIL_NEXT (offset) (0x00016700000B0000ull + ((offset) & 255) * 8) +#define CVMX_SSO_XAQX_TAIL_PTR (offset) (0x0001670000090000ull + ((offset) & 255) * 8) +#define CVMX_SSO_XAQ_AURA (0x0001670000002100ull) +#define CVMX_SSO_XAQ_LATENCY_PC (0x00016700000020B8ull) +#define CVMX_SSO_XAQ_REQ_PC (0x00016700000020B0ull) + +/** +* cvmx_sso_active_cycles +* +* SSO_ACTIVE_CYCLES = SSO cycles SSO active +* +* This register counts every sclk cycle that the SSO clocks are active. +* **NOTE: Added in pass 2.0 +*/ +union cvmx_sso_active_cycles { +u64 u64; +struct cvmx_sso_active_cycles_s { +u64 act_cyc :64 ; + } s; +struct cvmx_sso_active_cycles_s cn68xx; +}; + +typedef union cvmx_sso_active_cycles cvmx_sso_active_cycles_t ; + +/** +* cvmx_sso_active_cycles# +* +* This register counts every coprocessor clock (SCLK) cycle that the SSO clocks are active. +* +*/ +union cvmx_sso_active_cyclesx { +u64 u64; +struct cvmx_sso_active_cyclesx_s { +u64 act_cyc :64 ; + } s; +struct cvmx_sso_active_cyclesx_s cn73xx; +struct cvmx_sso_active_cyclesx_s cn78xx; +struct cvmx_sso_active_cyclesx_s cn78xxp1; +struct cvmx_sso_active_cyclesx_s cnf75xx; +}; + +typedef union cvmx_sso_active_cyclesx cvmx_sso_active_cyclesx_t ; + +/** +* cvmx_sso_aw_add +*/ +union cvmx_sso_aw_add { +u64 u64; +struct cvmx_sso_aw_add_s { +u64 reserved_30_63 :34 ; +u64 rsvd_free :14 ; +u64 reserved_0_15 :16 ; + } s; +struct cvmx_sso_aw_add_s cn73xx; +struct cvmx_sso_aw_add_s cn78xx; +struct cvmx_sso_aw_add_s cn78xxp1; +struct cvmx_sso_aw_add_s cnf75xx; +}; + +typedef union cvmx_sso_aw_add cvmx_sso_aw_add_t ; + +/** +* cvmx_sso_aw_cfg +* +* This register controls the operation of the add-work block (AW). +* +*/ +union cvmx_sso_aw_cfg { +u64 u64; +struct cvmx_sso_aw_cfg_s { +u64 reserved_9_63 :55 ; +u64 ldt_short :1 ; +u64 lol :1 ; +u64 xaq_alloc_dis :1 ; +u64 ocla_bp :1 ; +u64 xaq_byp_dis :1 ; +u64 stt :1 ; +u64 ldt :1 ; +u64 ldwb :1 ; +u64 rwen :1 ; + } s; +struct cvmx_sso_aw_cfg_s cn73xx; +struct cvmx_sso_aw_cfg_s cn78xx; +struct cvmx_sso_aw_cfg_s cn78xxp1; +struct cvmx_sso_aw_cfg_s cnf75xx; +}; + +typedef union cvmx_sso_aw_cfg cvmx_sso_aw_cfg_t ; + +/** +* cvmx_sso_aw_eco +*/ +union cvmx_sso_aw_eco { +u64 u64; +struct cvmx_sso_aw_eco_s { +u64 reserved_8_63 :56 ; +u64 eco_rw :8 ; + } s; +struct cvmx_sso_aw_eco_s cn73xx; +struct cvmx_sso_aw_eco_s cnf75xx; +}; + +typedef union cvmx_sso_aw_eco cvmx_sso_aw_eco_t ; + +/** +* cvmx_sso_aw_read_arb +* +* This register fine tunes the AW read arbiter and is for diagnostic use. +* +*/ +union cvmx_sso_aw_read_arb { +u64 u64; +struct cvmx_sso_aw_read_arb_s { +u64 reserved_30_63 :34 ; +u64 xaq_lev :6 ; +u64 reserved_21_23 :3 ; +u64 xaq_min :5 ; +u64 reserved_14_15 :2 ; +u64 aw_tag_lev :6 ; +u64 reserved_5_7 :3 ; +u64 aw_tag_min :5 ; + } s; +struct cvmx_sso_aw_read_arb_s cn73xx; +struct cvmx_sso_aw_read_arb_s cn78xx; +struct cvmx_sso_aw_read_arb_s cn78xxp1; +struct cvmx_sso_aw_read_arb_s cnf75xx; +}; + +typedef union cvmx_sso_aw_read_arb cvmx_sso_aw_read_arb_t ; + +/** +* cvmx_sso_aw_status +* +* This register indicates the status of the add-work block (AW). +* +*/ +union cvmx_sso_aw_status { +u64 u64; +struct cvmx_sso_aw_status_s { +u64 reserved_6_63 :58 ; +u64 xaq_buf_cached :6 ; + } s; +struct cvmx_sso_aw_status_s cn73xx; +struct cvmx_sso_aw_status_s cn78xx; +struct cvmx_sso_aw_status_s cn78xxp1; +struct cvmx_sso_aw_status_s cnf75xx; +}; + +typedef union cvmx_sso_aw_status cvmx_sso_aw_status_t ; + +/** +* cvmx_sso_aw_tag_latency_pc +*/ +union cvmx_sso_aw_tag_latency_pc { +u64 u64; +struct cvmx_sso_aw_tag_latency_pc_s { +u64 count :64 ; + } s; +struct cvmx_sso_aw_tag_latency_pc_s cn73xx; +struct cvmx_sso_aw_tag_latency_pc_s cn78xx; +struct cvmx_sso_aw_tag_latency_pc_s cn78xxp1; +struct cvmx_sso_aw_tag_latency_pc_s cnf75xx; +}; + +typedef union cvmx_sso_aw_tag_latency_pc cvmx_sso_aw_tag_latency_pc_t ; + +/** +* cvmx_sso_aw_tag_req_pc +*/ +union cvmx_sso_aw_tag_req_pc { +u64 u64; +struct cvmx_sso_aw_tag_req_pc_s { +u64 count :64 ; + } s; +struct cvmx_sso_aw_tag_req_pc_s cn73xx; +struct cvmx_sso_aw_tag_req_pc_s cn78xx; +struct cvmx_sso_aw_tag_req_pc_s cn78xxp1; +struct cvmx_sso_aw_tag_req_pc_s cnf75xx; +}; + +typedef union cvmx_sso_aw_tag_req_pc cvmx_sso_aw_tag_req_pc_t ; + +/** +* cvmx_sso_aw_we +*/ +union cvmx_sso_aw_we { +u64 u64; +struct cvmx_sso_aw_we_s { +u64 reserved_29_63 :35 ; +u64 rsvd_free :13 ; +u64 reserved_13_15 :3 ; +u64 free_cnt :13 ; + } s; +struct cvmx_sso_aw_we_s cn73xx; +struct cvmx_sso_aw_we_s cn78xx; +struct cvmx_sso_aw_we_s cn78xxp1; +struct cvmx_sso_aw_we_s cnf75xx; +}; + +typedef union cvmx_sso_aw_we cvmx_sso_aw_we_t ; + +/** +* cvmx_sso_bist_stat +* +* SSO_BIST_STAT = SSO BIST Status Register +* +* Contains the BIST status for the SSO memories ('0' = pass, '1' = fail). +* Note that PP BIST status is not reported here as it was in previous designs. +* +* There may be more for DDR interface buffers. +* It's possible that a RAM will be used for SSO_PP_QOS_RND. +*/ +union cvmx_sso_bist_stat { +u64 u64; +struct cvmx_sso_bist_stat_s { +u64 reserved_62_63 :2 ; +u64 odu_pref :2 ; +u64 reserved_54_59 :6 ; +u64 fptr :2 ; +u64 reserved_45_51 :7 ; +u64 rwo_dat :1 ; +u64 rwo :2 ; +u64 reserved_35_41 :7 ; +u64 rwi_dat :1 ; +u64 reserved_32_33 :2 ; +u64 soc :1 ; +u64 reserved_28_30 :3 ; +u64 ncbo :4 ; +u64 reserved_21_23 :3 ; +u64 index :1 ; +u64 reserved_17_19 :3 ; +u64 fidx :1 ; +u64 reserved_10_15 :6 ; +u64 pend :2 ; +u64 reserved_2_7 :6 ; +u64 oth :2 ; + } s; +struct cvmx_sso_bist_stat_s cn68xx; +struct cvmx_sso_bist_stat_cn68xxp1 { +u64 reserved_54_63 :10 ; +u64 fptr :2 ; +u64 reserved_45_51 :7 ; +u64 rwo_dat :1 ; +u64 rwo :2 ; +u64 reserved_35_41 :7 ; +u64 rwi_dat :1 ; +u64 reserved_32_33 :2 ; +u64 soc :1 ; +u64 reserved_28_30 :3 ; +u64 ncbo :4 ; +u64 reserved_21_23 :3 ; +u64 index :1 ; +u64 reserved_17_19 :3 ; +u64 fidx :1 ; +u64 reserved_10_15 :6 ; +u64 pend :2 ; +u64 reserved_2_7 :6 ; +u64 oth :2 ; + } cn68xxp1; +}; + +typedef union cvmx_sso_bist_stat cvmx_sso_bist_stat_t ; + +/** +* cvmx_sso_bist_status0 +* +* Contains the BIST status for the SSO memories. +* +*/ +union cvmx_sso_bist_status0 { +u64 u64; +struct cvmx_sso_bist_status0_s { +u64 reserved_10_63 :54 ; +u64 bist :10 ; + } s; +struct cvmx_sso_bist_status0_s cn73xx; +struct cvmx_sso_bist_status0_s cn78xx; +struct cvmx_sso_bist_status0_s cn78xxp1; +struct cvmx_sso_bist_status0_s cnf75xx; +}; + +typedef union cvmx_sso_bist_status0 cvmx_sso_bist_status0_t ; + +/** +* cvmx_sso_bist_status1 +* +* Contains the BIST status for the SSO memories. +* +*/ +union cvmx_sso_bist_status1 { +u64 u64; +struct cvmx_sso_bist_status1_s { +u64 reserved_7_63 :57 ; +u64 bist :7 ; + } s; +struct cvmx_sso_bist_status1_s cn73xx; +struct cvmx_sso_bist_status1_s cn78xx; +struct cvmx_sso_bist_status1_s cn78xxp1; +struct cvmx_sso_bist_status1_s cnf75xx; +}; + +typedef union cvmx_sso_bist_status1 cvmx_sso_bist_status1_t ; + +/** +* cvmx_sso_bist_status2 +* +* Contains the BIST status for the SSO memories. +* +*/ +union cvmx_sso_bist_status2 { +u64 u64; +struct cvmx_sso_bist_status2_s { +u64 reserved_9_63 :55 ; +u64 bist :9 ; + } s; +struct cvmx_sso_bist_status2_s cn73xx; +struct cvmx_sso_bist_status2_s cn78xx; +struct cvmx_sso_bist_status2_s cn78xxp1; +struct cvmx_sso_bist_status2_s cnf75xx; +}; + +typedef union cvmx_sso_bist_status2 cvmx_sso_bist_status2_t ; + +/** +* cvmx_sso_cfg +* +* SSO_CFG = SSO Config +* +* This register is an assortment of various SSO configuration bits. +*/ +union cvmx_sso_cfg { +u64 u64; +struct cvmx_sso_cfg_s { +u64 reserved_16_63 :48 ; +u64 qck_gw_rsp_adj :3 ; +u64 qck_gw_rsp_dis :1 ; +u64 qck_sw_dis :1 ; +u64 rwq_alloc_dis :1 ; +u64 soc_ccam_dis :1 ; +u64 sso_cclk_dis :1 ; +u64 rwo_flush :1 ; +u64 wfe_thr :1 ; +u64 rwio_byp_dis :1 ; +u64 rwq_byp_dis :1 ; +u64 stt :1 ; +u64 ldt :1 ; +u64 dwb :1 ; +u64 rwen :1 ; + } s; +struct cvmx_sso_cfg_s cn68xx; +struct cvmx_sso_cfg_cn68xxp1 { +u64 reserved_8_63 :56 ; +u64 rwo_flush :1 ; +u64 wfe_thr :1 ; +u64 rwio_byp_dis :1 ; +u64 rwq_byp_dis :1 ; +u64 stt :1 ; +u64 ldt :1 ; +u64 dwb :1 ; +u64 rwen :1 ; + } cn68xxp1; +}; + +typedef union cvmx_sso_cfg cvmx_sso_cfg_t ; + +/** +* cvmx_sso_ds_pc +* +* SSO_DS_PC = SSO De-Schedule Performance Counter +* +* Counts the number of de-schedule requests. +* Counter rolls over through zero when max value exceeded. +*/ +union cvmx_sso_ds_pc { +u64 u64; +struct cvmx_sso_ds_pc_s { +u64 ds_pc :64 ; + } s; +struct cvmx_sso_ds_pc_s cn68xx; +struct cvmx_sso_ds_pc_s cn68xxp1; +}; + +typedef union cvmx_sso_ds_pc cvmx_sso_ds_pc_t ; + +/** +* cvmx_sso_ecc_ctl0 +*/ +union cvmx_sso_ecc_ctl0 { +u64 u64; +struct cvmx_sso_ecc_ctl0_s { +u64 reserved_30_63 :34 ; +u64 toaqt_flip :2 ; +u64 toaqt_cdis :1 ; +u64 toaqh_flip :2 ; +u64 toaqh_cdis :1 ; +u64 tiaqt_flip :2 ; +u64 tiaqt_cdis :1 ; +u64 tiaqh_flip :2 ; +u64 tiaqh_cdis :1 ; +u64 llm_flip :2 ; +u64 llm_cdis :1 ; +u64 inp_flip :2 ; +u64 inp_cdis :1 ; +u64 qtc_flip :2 ; +u64 qtc_cdis :1 ; +u64 xaq_flip :2 ; +u64 xaq_cdis :1 ; +u64 fff_flip :2 ; +u64 fff_cdis :1 ; +u64 wes_flip :2 ; +u64 wes_cdis :1 ; + } s; +struct cvmx_sso_ecc_ctl0_s cn73xx; +struct cvmx_sso_ecc_ctl0_s cn78xx; +struct cvmx_sso_ecc_ctl0_s cn78xxp1; +struct cvmx_sso_ecc_ctl0_s cnf75xx; +}; + +typedef union cvmx_sso_ecc_ctl0 cvmx_sso_ecc_ctl0_t ; + +/** +* cvmx_sso_ecc_ctl1 +*/ +union cvmx_sso_ecc_ctl1 { +u64 u64; +struct cvmx_sso_ecc_ctl1_s { +u64 reserved_21_63 :43 ; +u64 thrint_flip :2 ; +u64 thrint_cdis :1 ; +u64 mask_flip :2 ; +u64 mask_cdis :1 ; +u64 gdw_flip :2 ; +u64 gdw_cdis :1 ; +u64 qidx_flip :2 ; +u64 qidx_cdis :1 ; +u64 tptr_flip :2 ; +u64 tptr_cdis :1 ; +u64 hptr_flip :2 ; +u64 hptr_cdis :1 ; +u64 cntr_flip :2 ; +u64 cntr_cdis :1 ; + } s; +struct cvmx_sso_ecc_ctl1_s cn73xx; +struct cvmx_sso_ecc_ctl1_s cn78xx; +struct cvmx_sso_ecc_ctl1_s cn78xxp1; +struct cvmx_sso_ecc_ctl1_s cnf75xx; +}; + +typedef union cvmx_sso_ecc_ctl1 cvmx_sso_ecc_ctl1_t ; + +/** +* cvmx_sso_ecc_ctl2 +*/ +union cvmx_sso_ecc_ctl2 { +u64 u64; +struct cvmx_sso_ecc_ctl2_s { +u64 reserved_15_63 :49 ; +u64 ncbo_flip :2 ; +u64 ncbo_cdis :1 ; +u64 pnd_flip :2 ; +u64 pnd_cdis :1 ; +u64 oth_flip :2 ; +u64 oth_cdis :1 ; +u64 nidx_flip :2 ; +u64 nidx_cdis :1 ; +u64 pidx_flip :2 ; +u64 pidx_cdis :1 ; + } s; +struct cvmx_sso_ecc_ctl2_s cn73xx; +struct cvmx_sso_ecc_ctl2_s cn78xx; +struct cvmx_sso_ecc_ctl2_s cn78xxp1; +struct cvmx_sso_ecc_ctl2_s cnf75xx; +}; + +typedef union cvmx_sso_ecc_ctl2 cvmx_sso_ecc_ctl2_t ; + +/** +* cvmx_sso_err +* +* SSO_ERR = SSO Error Register +* +* Contains ECC and other misc error bits. +* +* <45> The free page error bit will assert when SSO_FPAGE_CNT <= 16 and +* SSO_CFG[RWEN] is 1. Software will want to disable the interrupt +* associated with this error when recovering SSO pointers from the +* FPA and SSO. +* +* This register also contains the illegal operation error bits: +* +* <42> Received ADDWQ with tag specified as EMPTY +* <41> Received illegal opcode +* <40> Received SWTAG/SWTAG_FULL/SWTAG_DESCH/DESCH/UPD_WQP/GET_WORK/ALLOC_WE +* from WS with CLR_NSCHED pending +* <39> Received CLR_NSCHED +* from WS with SWTAG_DESCH/DESCH/CLR_NSCHED pending +* <38> Received SWTAG/SWTAG_FULL/SWTAG_DESCH/DESCH/UPD_WQP/GET_WORK/ALLOC_WE +* from WS with ALLOC_WE pending +* <37> Received SWTAG/SWTAG_FULL/SWTAG_DESCH/DESCH/UPD_WQP/GET_WORK/ALLOC_WE/CLR_NSCHED +* from WS with GET_WORK pending +* <36> Received SWTAG_FULL/SWTAG_DESCH +* with tag specified as UNSCHEDULED +* <35> Received SWTAG/SWTAG_FULL/SWTAG_DESCH +* with tag specified as EMPTY +* <34> Received SWTAG/SWTAG_FULL/SWTAG_DESCH/GET_WORK +* from WS with pending tag switch to ORDERED or ATOMIC +* <33> Received SWTAG/SWTAG_DESCH/DESCH/UPD_WQP +* from WS in UNSCHEDULED state +* <32> Received SWTAG/SWTAG_FULL/SWTAG_DESCH/DESCH/UPD_WQP +* from WS in EMPTY state +*/ +union cvmx_sso_err { +u64 u64; +struct cvmx_sso_err_s { +u64 reserved_48_63 :16 ; +u64 bfp :1 ; +u64 awe :1 ; +u64 fpe :1 ; +u64 reserved_43_44 :2 ; +u64 iop :11 ; +u64 reserved_12_31 :20 ; +u64 pnd_dbe0 :1 ; +u64 pnd_sbe0 :1 ; +u64 pnd_dbe1 :1 ; +u64 pnd_sbe1 :1 ; +u64 oth_dbe0 :1 ; +u64 oth_sbe0 :1 ; +u64 oth_dbe1 :1 ; +u64 oth_sbe1 :1 ; +u64 idx_dbe :1 ; +u64 idx_sbe :1 ; +u64 fidx_dbe :1 ; +u64 fidx_sbe :1 ; + } s; +struct cvmx_sso_err_s cn68xx; +struct cvmx_sso_err_s cn68xxp1; +}; + +typedef union cvmx_sso_err cvmx_sso_err_t ; + +/** +* cvmx_sso_err0 +* +* This register contains ECC and other miscellaneous error bits. +* +*/ +union cvmx_sso_err0 { +u64 u64; +struct cvmx_sso_err0_s { +u64 reserved_52_63 :12 ; +u64 toaqt_dbe :1 ; +u64 toaqt_sbe :1 ; +u64 toaqh_dbe :1 ; +u64 toaqh_sbe :1 ; +u64 tiaqt_dbe :1 ; +u64 tiaqt_sbe :1 ; +u64 tiaqh_dbe :1 ; +u64 tiaqh_sbe :1 ; +u64 llm_dbe :1 ; +u64 llm_sbe :1 ; +u64 inp_dbe :1 ; +u64 inp_sbe :1 ; +u64 qtc_dbe :1 ; +u64 qtc_sbe :1 ; +u64 xaq_dbe :1 ; +u64 xaq_sbe :1 ; +u64 fff_dbe :1 ; +u64 fff_sbe :1 ; +u64 wes_dbe :1 ; +u64 wes_sbe :1 ; +u64 reserved_6_31 :26 ; +u64 addwq_dropped :1 ; +u64 awempty :1 ; +u64 grpdis :1 ; +u64 bfp :1 ; +u64 awe :1 ; +u64 fpe :1 ; + } s; +struct cvmx_sso_err0_s cn73xx; +struct cvmx_sso_err0_s cn78xx; +struct cvmx_sso_err0_s cn78xxp1; +struct cvmx_sso_err0_s cnf75xx; +}; + +typedef union cvmx_sso_err0 cvmx_sso_err0_t ; + +/** +* cvmx_sso_err1 +* +* This register contains ECC and other miscellaneous error bits. +* +*/ +union cvmx_sso_err1 { +u64 u64; +struct cvmx_sso_err1_s { +u64 reserved_14_63 :50 ; +u64 thrint_dbe :1 ; +u64 thrint_sbe :1 ; +u64 mask_dbe :1 ; +u64 mask_sbe :1 ; +u64 gdw_dbe :1 ; +u64 gdw_sbe :1 ; +u64 qidx_dbe :1 ; +u64 qidx_sbe :1 ; +u64 tptr_dbe :1 ; +u64 tptr_sbe :1 ; +u64 hptr_dbe :1 ; +u64 hptr_sbe :1 ; +u64 cntr_dbe :1 ; +u64 cntr_sbe :1 ; + } s; +struct cvmx_sso_err1_s cn73xx; +struct cvmx_sso_err1_s cn78xx; +struct cvmx_sso_err1_s cn78xxp1; +struct cvmx_sso_err1_s cnf75xx; +}; + +typedef union cvmx_sso_err1 cvmx_sso_err1_t ; + +/** +* cvmx_sso_err2 +* +* This register contains ECC and other miscellaneous error bits. +* +*/ +union cvmx_sso_err2 { +u64 u64; +struct cvmx_sso_err2_s { +u64 reserved_42_63 :22 ; +u64 ncbo_dbe :1 ; +u64 ncbo_sbe :1 ; +u64 pnd_dbe :1 ; +u64 pnd_sbe :1 ; +u64 oth_dbe :1 ; +u64 oth_sbe :1 ; +u64 nidx_dbe :1 ; +u64 nidx_sbe :1 ; +u64 pidx_dbe :1 ; +u64 pidx_sbe :1 ; +u64 reserved_13_31 :19 ; +u64 iop :13 ; + } s; +struct cvmx_sso_err2_s cn73xx; +struct cvmx_sso_err2_s cn78xx; +struct cvmx_sso_err2_s cn78xxp1; +struct cvmx_sso_err2_s cnf75xx; +}; + +typedef union cvmx_sso_err2 cvmx_sso_err2_t ; + +/** +* cvmx_sso_err_enb +* +* SSO_ERR_ENB = SSO Error Enable Register +* +* Contains the interrupt enables corresponding to SSO_ERR. +*/ +union cvmx_sso_err_enb { +u64 u64; +struct cvmx_sso_err_enb_s { +u64 reserved_48_63 :16 ; +u64 bfp_ie :1 ; +u64 awe_ie :1 ; +u64 fpe_ie :1 ; +u64 reserved_43_44 :2 ; +u64 iop_ie :11 ; +u64 reserved_12_31 :20 ; +u64 pnd_dbe0_ie :1 ; +u64 pnd_sbe0_ie :1 ; +u64 pnd_dbe1_ie :1 ; +u64 pnd_sbe1_ie :1 ; +u64 oth_dbe0_ie :1 ; +u64 oth_sbe0_ie :1 ; +u64 oth_dbe1_ie :1 ; +u64 oth_sbe1_ie :1 ; +u64 idx_dbe_ie :1 ; +u64 idx_sbe_ie :1 ; +u64 fidx_dbe_ie :1 ; +u64 fidx_sbe_ie :1 ; + } s; +struct cvmx_sso_err_enb_s cn68xx; +struct cvmx_sso_err_enb_s cn68xxp1; +}; + +typedef union cvmx_sso_err_enb cvmx_sso_err_enb_t ; + +/** +* cvmx_sso_fidx_ecc_ctl +* +* SSO_FIDX_ECC_CTL = SSO FIDX ECC Control +* +*/ +union cvmx_sso_fidx_ecc_ctl { +u64 u64; +struct cvmx_sso_fidx_ecc_ctl_s { +u64 reserved_3_63 :61 ; +u64 flip_synd :2 ; +u64 ecc_ena :1 ; + } s; +struct cvmx_sso_fidx_ecc_ctl_s cn68xx; +struct cvmx_sso_fidx_ecc_ctl_s cn68xxp1; +}; + +typedef union cvmx_sso_fidx_ecc_ctl cvmx_sso_fidx_ecc_ctl_t ; + +/** +* cvmx_sso_fidx_ecc_st +* +* SSO_FIDX_ECC_ST = SSO FIDX ECC Status +* +*/ +union cvmx_sso_fidx_ecc_st { +u64 u64; +struct cvmx_sso_fidx_ecc_st_s { +u64 reserved_27_63 :37 ; +u64 addr :11 ; +u64 reserved_9_15 :7 ; +u64 syndrom :5 ; +u64 reserved_0_3 :4 ; + } s; +struct cvmx_sso_fidx_ecc_st_s cn68xx; +struct cvmx_sso_fidx_ecc_st_s cn68xxp1; +}; + +typedef union cvmx_sso_fidx_ecc_st cvmx_sso_fidx_ecc_st_t ; + +/** +* cvmx_sso_fpage_cnt +* +* SSO_FPAGE_CNT = SSO Free Page Cnt +* +* This register keeps track of the number of free pages pointers available for use in external memory. +*/ +union cvmx_sso_fpage_cnt { +u64 u64; +struct cvmx_sso_fpage_cnt_s { +u64 reserved_32_63 :32 ; +u64 fpage_cnt :32 ; + } s; +struct cvmx_sso_fpage_cnt_s cn68xx; +struct cvmx_sso_fpage_cnt_s cn68xxp1; +}; + +typedef union cvmx_sso_fpage_cnt cvmx_sso_fpage_cnt_t ; + +/** +* cvmx_sso_grp#_aq_cnt +*/ +union cvmx_sso_grpx_aq_cnt { +u64 u64; +struct cvmx_sso_grpx_aq_cnt_s { +u64 reserved_33_63 :31 ; +u64 aq_cnt :33 ; + } s; +struct cvmx_sso_grpx_aq_cnt_s cn73xx; +struct cvmx_sso_grpx_aq_cnt_s cn78xx; +struct cvmx_sso_grpx_aq_cnt_s cn78xxp1; +struct cvmx_sso_grpx_aq_cnt_s cnf75xx; +}; + +typedef union cvmx_sso_grpx_aq_cnt cvmx_sso_grpx_aq_cnt_t ; + +/** +* cvmx_sso_grp#_aq_thr +*/ +union cvmx_sso_grpx_aq_thr { +u64 u64; +struct cvmx_sso_grpx_aq_thr_s { +u64 reserved_33_63 :31 ; +u64 aq_thr :33 ; + } s; +struct cvmx_sso_grpx_aq_thr_s cn73xx; +struct cvmx_sso_grpx_aq_thr_s cn78xx; +struct cvmx_sso_grpx_aq_thr_s cn78xxp1; +struct cvmx_sso_grpx_aq_thr_s cnf75xx; +}; + +typedef union cvmx_sso_grpx_aq_thr cvmx_sso_grpx_aq_thr_t ; + +/** +* cvmx_sso_grp#_ds_pc +* +* Counts the number of deschedule requests for each group. Counter rolls over through zero when +* max value exceeded. +*/ +union cvmx_sso_grpx_ds_pc { +u64 u64; +struct cvmx_sso_grpx_ds_pc_s { +u64 cnt :64 ; + } s; +struct cvmx_sso_grpx_ds_pc_s cn73xx; +struct cvmx_sso_grpx_ds_pc_s cn78xx; +struct cvmx_sso_grpx_ds_pc_s cn78xxp1; +struct cvmx_sso_grpx_ds_pc_s cnf75xx; +}; + +typedef union cvmx_sso_grpx_ds_pc cvmx_sso_grpx_ds_pc_t ; + +/** +* cvmx_sso_grp#_ext_pc +* +* Counts the number of cache lines of WAEs sent to L2/DDR. Counter rolls over through zero when +* max value exceeded. +*/ +union cvmx_sso_grpx_ext_pc { +u64 u64; +struct cvmx_sso_grpx_ext_pc_s { +u64 cnt :64 ; + } s; +struct cvmx_sso_grpx_ext_pc_s cn73xx; +struct cvmx_sso_grpx_ext_pc_s cn78xx; +struct cvmx_sso_grpx_ext_pc_s cn78xxp1; +struct cvmx_sso_grpx_ext_pc_s cnf75xx; +}; + +typedef union cvmx_sso_grpx_ext_pc cvmx_sso_grpx_ext_pc_t ; + +/** +* cvmx_sso_grp#_iaq_thr +* +* These registers contain the thresholds for allocating SSO in-unit admission queue entries, see +* In-Unit Thresholds. +*/ +union cvmx_sso_grpx_iaq_thr { +u64 u64; +struct cvmx_sso_grpx_iaq_thr_s { +u64 reserved_61_63 :3 ; +u64 grp_cnt :13 ; +u64 reserved_45_47 :3 ; +u64 max_thr :13 ; +u64 reserved_13_31 :19 ; +u64 rsvd_thr :13 ; + } s; +struct cvmx_sso_grpx_iaq_thr_s cn73xx; +struct cvmx_sso_grpx_iaq_thr_s cn78xx; +struct cvmx_sso_grpx_iaq_thr_s cn78xxp1; +struct cvmx_sso_grpx_iaq_thr_s cnf75xx; +}; + +typedef union cvmx_sso_grpx_iaq_thr cvmx_sso_grpx_iaq_thr_t ; + +/** +* cvmx_sso_grp#_int +* +* Contains the per-group interrupts and are used to clear these interrupts. For more information +* on this register, refer to Interrupts. +*/ +union cvmx_sso_grpx_int { +u64 u64; +struct cvmx_sso_grpx_int_s { +u64 exe_dis :1 ; +u64 reserved_2_62 :61 ; +u64 exe_int :1 ; +u64 aq_int :1 ; + } s; +struct cvmx_sso_grpx_int_s cn73xx; +struct cvmx_sso_grpx_int_s cn78xx; +struct cvmx_sso_grpx_int_s cn78xxp1; +struct cvmx_sso_grpx_int_s cnf75xx; +}; + +typedef union cvmx_sso_grpx_int cvmx_sso_grpx_int_t ; + +/** +* cvmx_sso_grp#_int_cnt +* +* These registers contain a read-only copy of the counts used to trigger work-queue interrupts +* (one per group). For more information on this register, refer to Interrupts. +*/ +union cvmx_sso_grpx_int_cnt { +u64 u64; +struct cvmx_sso_grpx_int_cnt_s { +u64 reserved_61_63 :3 ; +u64 tc_cnt :13 ; +u64 reserved_45_47 :3 ; +u64 cq_cnt :13 ; +u64 reserved_29_31 :3 ; +u64 ds_cnt :13 ; +u64 reserved_13_15 :3 ; +u64 iaq_cnt :13 ; + } s; +struct cvmx_sso_grpx_int_cnt_s cn73xx; +struct cvmx_sso_grpx_int_cnt_s cn78xx; +struct cvmx_sso_grpx_int_cnt_s cn78xxp1; +struct cvmx_sso_grpx_int_cnt_s cnf75xx; +}; + +typedef union cvmx_sso_grpx_int_cnt cvmx_sso_grpx_int_cnt_t ; + +/** +* cvmx_sso_grp#_int_thr +* +* These registers contain the thresholds for enabling and setting work-queue interrupts (one per +* group). For more information on this register, refer to Interrupts. +*/ +union cvmx_sso_grpx_int_thr { +u64 u64; +struct cvmx_sso_grpx_int_thr_s { +u64 tc_en :1 ; +u64 reserved_61_62 :2 ; +u64 tc_thr :13 ; +u64 reserved_45_47 :3 ; +u64 cq_thr :13 ; +u64 reserved_29_31 :3 ; +u64 ds_thr :13 ; +u64 reserved_13_15 :3 ; +u64 iaq_thr :13 ; + } s; +struct cvmx_sso_grpx_int_thr_s cn73xx; +struct cvmx_sso_grpx_int_thr_s cn78xx; +struct cvmx_sso_grpx_int_thr_s cn78xxp1; +struct cvmx_sso_grpx_int_thr_s cnf75xx; +}; + +typedef union cvmx_sso_grpx_int_thr cvmx_sso_grpx_int_thr_t ; + +/** +* cvmx_sso_grp#_pri +* +* Controls the priority and group affinity arbitration for each group. +* +*/ +union cvmx_sso_grpx_pri { +u64 u64; +struct cvmx_sso_grpx_pri_s { +u64 reserved_30_63 :34 ; +u64 wgt_left :6 ; +u64 reserved_22_23 :2 ; +u64 weight :6 ; +u64 reserved_12_15 :4 ; +u64 affinity :4 ; +u64 reserved_3_7 :5 ; +u64 pri :3 ; + } s; +struct cvmx_sso_grpx_pri_s cn73xx; +struct cvmx_sso_grpx_pri_s cn78xx; +struct cvmx_sso_grpx_pri_s cn78xxp1; +struct cvmx_sso_grpx_pri_s cnf75xx; +}; + +typedef union cvmx_sso_grpx_pri cvmx_sso_grpx_pri_t ; + +/** +* cvmx_sso_grp#_taq_thr +* +* These registers contain the thresholds for allocating SSO transitory admission queue storage +* buffers, see Transitory-Admission Thresholds. +*/ +union cvmx_sso_grpx_taq_thr { +u64 u64; +struct cvmx_sso_grpx_taq_thr_s { +u64 reserved_59_63 :5 ; +u64 grp_cnt :11 ; +u64 reserved_43_47 :5 ; +u64 max_thr :11 ; +u64 reserved_11_31 :21 ; +u64 rsvd_thr :11 ; + } s; +struct cvmx_sso_grpx_taq_thr_s cn73xx; +struct cvmx_sso_grpx_taq_thr_s cn78xx; +struct cvmx_sso_grpx_taq_thr_s cn78xxp1; +struct cvmx_sso_grpx_taq_thr_s cnf75xx; +}; + +typedef union cvmx_sso_grpx_taq_thr cvmx_sso_grpx_taq_thr_t ; + +/** +* cvmx_sso_grp#_ts_pc +* +* Counts the number of tag switch requests for each group being switched to. Counter rolls over +* through zero when max value exceeded. +*/ +union cvmx_sso_grpx_ts_pc { +u64 u64; +struct cvmx_sso_grpx_ts_pc_s { +u64 cnt :64 ; + } s; +struct cvmx_sso_grpx_ts_pc_s cn73xx; +struct cvmx_sso_grpx_ts_pc_s cn78xx; +struct cvmx_sso_grpx_ts_pc_s cn78xxp1; +struct cvmx_sso_grpx_ts_pc_s cnf75xx; +}; + +typedef union cvmx_sso_grpx_ts_pc cvmx_sso_grpx_ts_pc_t ; + +/** +* cvmx_sso_grp#_wa_pc +* +* Counts the number of add new work requests for each group. The counter rolls over through zero +* when the max value exceeded. +*/ +union cvmx_sso_grpx_wa_pc { +u64 u64; +struct cvmx_sso_grpx_wa_pc_s { +u64 cnt :64 ; + } s; +struct cvmx_sso_grpx_wa_pc_s cn73xx; +struct cvmx_sso_grpx_wa_pc_s cn78xx; +struct cvmx_sso_grpx_wa_pc_s cn78xxp1; +struct cvmx_sso_grpx_wa_pc_s cnf75xx; +}; + +typedef union cvmx_sso_grpx_wa_pc cvmx_sso_grpx_wa_pc_t ; + +/** +* cvmx_sso_grp#_ws_pc +* +* Counts the number of work schedules for each group. The counter rolls over through zero when +* the maximum value is exceeded. +*/ +union cvmx_sso_grpx_ws_pc { +u64 u64; +struct cvmx_sso_grpx_ws_pc_s { +u64 cnt :64 ; + } s; +struct cvmx_sso_grpx_ws_pc_s cn73xx; +struct cvmx_sso_grpx_ws_pc_s cn78xx; +struct cvmx_sso_grpx_ws_pc_s cn78xxp1; +struct cvmx_sso_grpx_ws_pc_s cnf75xx; +}; + +typedef union cvmx_sso_grpx_ws_pc cvmx_sso_grpx_ws_pc_t ; + +/** +* cvmx_sso_gw_eco +*/ +union cvmx_sso_gw_eco { +u64 u64; +struct cvmx_sso_gw_eco_s { +u64 reserved_8_63 :56 ; +u64 eco_rw :8 ; + } s; +struct cvmx_sso_gw_eco_s cn73xx; +struct cvmx_sso_gw_eco_s cnf75xx; +}; + +typedef union cvmx_sso_gw_eco cvmx_sso_gw_eco_t ; + +/** +* cvmx_sso_gwe_cfg +* +* This register controls the operation of the get-work examiner (GWE). +* +*/ +union cvmx_sso_gwe_cfg { +u64 u64; +struct cvmx_sso_gwe_cfg_s { +u64 reserved_12_63 :52 ; +u64 odu_ffpgw_dis :1 ; +u64 gwe_rfpgw_dis :1 ; +u64 odu_prf_dis :1 ; +u64 reserved_0_8 :9 ; + } s; +struct cvmx_sso_gwe_cfg_cn68xx { +u64 reserved_12_63 :52 ; +u64 odu_ffpgw_dis :1 ; +u64 gwe_rfpgw_dis :1 ; +u64 odu_prf_dis :1 ; +u64 odu_bmp_dis :1 ; +u64 reserved_5_7 :3 ; +u64 gwe_hvy_dis :1 ; +u64 gwe_poe :1 ; +u64 gwe_fpor :1 ; +u64 gwe_rah :1 ; +u64 gwe_dis :1 ; + } cn68xx; +struct cvmx_sso_gwe_cfg_cn68xxp1 { +u64 reserved_4_63 :60 ; +u64 gwe_poe :1 ; +u64 gwe_fpor :1 ; +u64 gwe_rah :1 ; +u64 gwe_dis :1 ; + } cn68xxp1; +struct cvmx_sso_gwe_cfg_cn73xx { +u64 reserved_9_63 :55 ; +u64 dis_wgt_credit :1 ; +u64 ws_retries :8 ; + } cn73xx; +struct cvmx_sso_gwe_cfg_cn73xx cn78xx; +struct cvmx_sso_gwe_cfg_cn73xx cn78xxp1; +struct cvmx_sso_gwe_cfg_cn73xx cnf75xx; +}; + +typedef union cvmx_sso_gwe_cfg cvmx_sso_gwe_cfg_t ; + +/** +* cvmx_sso_gwe_random +* +* This register contains the random search start position for the get-work examiner (GWE). +* +*/ +union cvmx_sso_gwe_random { +u64 u64; +struct cvmx_sso_gwe_random_s { +u64 reserved_16_63 :48 ; +u64 rnd :16 ; + } s; +struct cvmx_sso_gwe_random_s cn73xx; +struct cvmx_sso_gwe_random_s cn78xx; +struct cvmx_sso_gwe_random_s cn78xxp1; +struct cvmx_sso_gwe_random_s cnf75xx; +}; + +typedef union cvmx_sso_gwe_random cvmx_sso_gwe_random_t ; + +/** +* cvmx_sso_idx_ecc_ctl +* +* SSO_IDX_ECC_CTL = SSO IDX ECC Control +* +*/ +union cvmx_sso_idx_ecc_ctl { +u64 u64; +struct cvmx_sso_idx_ecc_ctl_s { +u64 reserved_3_63 :61 ; +u64 flip_synd :2 ; +u64 ecc_ena :1 ; + } s; +struct cvmx_sso_idx_ecc_ctl_s cn68xx; +struct cvmx_sso_idx_ecc_ctl_s cn68xxp1; +}; + +typedef union cvmx_sso_idx_ecc_ctl cvmx_sso_idx_ecc_ctl_t ; + +/** +* cvmx_sso_idx_ecc_st +* +* SSO_IDX_ECC_ST = SSO IDX ECC Status +* +*/ +union cvmx_sso_idx_ecc_st { +u64 u64; +struct cvmx_sso_idx_ecc_st_s { +u64 reserved_27_63 :37 ; +u64 addr :11 ; +u64 reserved_9_15 :7 ; +u64 syndrom :5 ; +u64 reserved_0_3 :4 ; + } s; +struct cvmx_sso_idx_ecc_st_s cn68xx; +struct cvmx_sso_idx_ecc_st_s cn68xxp1; +}; + +typedef union cvmx_sso_idx_ecc_st cvmx_sso_idx_ecc_st_t ; + +/** +* cvmx_sso_ient#_links +* +* Returns unit memory status for an index. +* +*/ +union cvmx_sso_ientx_links { +u64 u64; +struct cvmx_sso_ientx_links_s { +u64 reserved_28_63 :36 ; +u64 prev_index :12 ; +u64 reserved_0_15 :16 ; + } s; +struct cvmx_sso_ientx_links_cn73xx { +u64 reserved_26_63 :38 ; +u64 prev_index :10 ; +u64 reserved_11_15 :5 ; +u64 next_index_vld :1 ; +u64 next_index :10 ; + } cn73xx; +struct cvmx_sso_ientx_links_cn78xx { +u64 reserved_28_63 :36 ; +u64 prev_index :12 ; +u64 reserved_13_15 :3 ; +u64 next_index_vld :1 ; +u64 next_index :12 ; + } cn78xx; +struct cvmx_sso_ientx_links_cn78xx cn78xxp1; +struct cvmx_sso_ientx_links_cn73xx cnf75xx; +}; + +typedef union cvmx_sso_ientx_links cvmx_sso_ientx_links_t ; + +/** +* cvmx_sso_ient#_pendtag +* +* Returns unit memory status for an index. +* +*/ +union cvmx_sso_ientx_pendtag { +u64 u64; +struct cvmx_sso_ientx_pendtag_s { +u64 reserved_38_63 :26 ; +u64 pend_switch :1 ; +u64 reserved_34_36 :3 ; +u64 pend_tt :2 ; +u64 pend_tag :32 ; + } s; +struct cvmx_sso_ientx_pendtag_s cn73xx; +struct cvmx_sso_ientx_pendtag_s cn78xx; +struct cvmx_sso_ientx_pendtag_s cn78xxp1; +struct cvmx_sso_ientx_pendtag_s cnf75xx; +}; + +typedef union cvmx_sso_ientx_pendtag cvmx_sso_ientx_pendtag_t ; + +/** +* cvmx_sso_ient#_qlinks +* +* Returns unit memory status for an index. +* +*/ +union cvmx_sso_ientx_qlinks { +u64 u64; +struct cvmx_sso_ientx_qlinks_s { +u64 reserved_12_63 :52 ; +u64 next_index :12 ; + } s; +struct cvmx_sso_ientx_qlinks_s cn73xx; +struct cvmx_sso_ientx_qlinks_s cn78xx; +struct cvmx_sso_ientx_qlinks_s cn78xxp1; +struct cvmx_sso_ientx_qlinks_s cnf75xx; +}; + +typedef union cvmx_sso_ientx_qlinks cvmx_sso_ientx_qlinks_t ; + +/** +* cvmx_sso_ient#_tag +* +* Returns unit memory status for an index. +* +*/ +union cvmx_sso_ientx_tag { +u64 u64; +struct cvmx_sso_ientx_tag_s { +u64 reserved_39_63 :25 ; +u64 tailc :1 ; +u64 tail :1 ; +u64 reserved_34_36 :3 ; +u64 tt :2 ; +u64 tag :32 ; + } s; +struct cvmx_sso_ientx_tag_s cn73xx; +struct cvmx_sso_ientx_tag_s cn78xx; +struct cvmx_sso_ientx_tag_s cn78xxp1; +struct cvmx_sso_ientx_tag_s cnf75xx; +}; + +typedef union cvmx_sso_ientx_tag cvmx_sso_ientx_tag_t ; + +/** +* cvmx_sso_ient#_wqpgrp +* +* Returns unit memory status for an index. +* +*/ +union cvmx_sso_ientx_wqpgrp { +u64 u64; +struct cvmx_sso_ientx_wqpgrp_s { +u64 reserved_62_63 :2 ; +u64 head :1 ; +u64 nosched :1 ; +u64 reserved_58_59 :2 ; +u64 grp :10 ; +u64 reserved_42_47 :6 ; +u64 wqp :42 ; + } s; +struct cvmx_sso_ientx_wqpgrp_cn73xx { +u64 reserved_62_63 :2 ; +u64 head :1 ; +u64 nosched :1 ; +u64 reserved_56_59 :4 ; +u64 grp :8 ; +u64 reserved_42_47 :6 ; +u64 wqp :42 ; + } cn73xx; +struct cvmx_sso_ientx_wqpgrp_s cn78xx; +struct cvmx_sso_ientx_wqpgrp_s cn78xxp1; +struct cvmx_sso_ientx_wqpgrp_cn73xx cnf75xx; +}; + +typedef union cvmx_sso_ientx_wqpgrp cvmx_sso_ientx_wqpgrp_t ; + +/** +* cvmx_sso_ipl_conf# +* +* Returns list status for the conflicted list indexed by group. Register +* fields are identical to those in SSO_IPL_IAQ() above. +*/ +union cvmx_sso_ipl_confx { +u64 u64; +struct cvmx_sso_ipl_confx_s { +u64 reserved_28_63 :36 ; +u64 queue_val :1 ; +u64 queue_one :1 ; +u64 reserved_25_25 :1 ; +u64 queue_head :12 ; +u64 reserved_12_12 :1 ; +u64 queue_tail :12 ; + } s; +struct cvmx_sso_ipl_confx_s cn73xx; +struct cvmx_sso_ipl_confx_s cn78xx; +struct cvmx_sso_ipl_confx_s cn78xxp1; +struct cvmx_sso_ipl_confx_s cnf75xx; +}; + +typedef union cvmx_sso_ipl_confx cvmx_sso_ipl_confx_t ; + +/** +* cvmx_sso_ipl_desched# +* +* Returns list status for the deschedule list indexed by group. Register +* fields are identical to those in SSO_IPL_IAQ() above. +*/ +union cvmx_sso_ipl_deschedx { +u64 u64; +struct cvmx_sso_ipl_deschedx_s { +u64 reserved_28_63 :36 ; +u64 queue_val :1 ; +u64 queue_one :1 ; +u64 reserved_25_25 :1 ; +u64 queue_head :12 ; +u64 reserved_12_12 :1 ; +u64 queue_tail :12 ; + } s; +struct cvmx_sso_ipl_deschedx_s cn73xx; +struct cvmx_sso_ipl_deschedx_s cn78xx; +struct cvmx_sso_ipl_deschedx_s cn78xxp1; +struct cvmx_sso_ipl_deschedx_s cnf75xx; +}; + +typedef union cvmx_sso_ipl_deschedx cvmx_sso_ipl_deschedx_t ; + +/** +* cvmx_sso_ipl_free# +* +* Returns list status. +* +*/ +union cvmx_sso_ipl_freex { +u64 u64; +struct cvmx_sso_ipl_freex_s { +u64 reserved_62_63 :2 ; +u64 qnum_head :3 ; +u64 qnum_tail :3 ; +u64 reserved_28_55 :28 ; +u64 queue_val :1 ; +u64 reserved_25_26 :2 ; +u64 queue_head :12 ; +u64 reserved_12_12 :1 ; +u64 queue_tail :12 ; + } s; +struct cvmx_sso_ipl_freex_cn73xx { +u64 reserved_62_63 :2 ; +u64 qnum_head :3 ; +u64 qnum_tail :3 ; +u64 reserved_28_55 :28 ; +u64 queue_val :1 ; +u64 reserved_23_26 :4 ; +u64 queue_head :10 ; +u64 reserved_10_12 :3 ; +u64 queue_tail :10 ; + } cn73xx; +struct cvmx_sso_ipl_freex_s cn78xx; +struct cvmx_sso_ipl_freex_s cn78xxp1; +struct cvmx_sso_ipl_freex_cn73xx cnf75xx; +}; + +typedef union cvmx_sso_ipl_freex cvmx_sso_ipl_freex_t ; + +/** +* cvmx_sso_ipl_iaq# +* +* Returns list status for the internal admission queue indexed by group. +* +*/ +union cvmx_sso_ipl_iaqx { +u64 u64; +struct cvmx_sso_ipl_iaqx_s { +u64 reserved_28_63 :36 ; +u64 queue_val :1 ; +u64 queue_one :1 ; +u64 reserved_25_25 :1 ; +u64 queue_head :12 ; +u64 reserved_12_12 :1 ; +u64 queue_tail :12 ; + } s; +struct cvmx_sso_ipl_iaqx_s cn73xx; +struct cvmx_sso_ipl_iaqx_s cn78xx; +struct cvmx_sso_ipl_iaqx_s cn78xxp1; +struct cvmx_sso_ipl_iaqx_s cnf75xx; +}; + +typedef union cvmx_sso_ipl_iaqx cvmx_sso_ipl_iaqx_t ; + +/** +* cvmx_sso_iq_cnt# +* +* CSR reserved addresses: (64): 0x8200..0x83f8 +* CSR align addresses: =========================================================================================================== +* SSO_IQ_CNTX = SSO Input Queue Count Register +* (one per QOS level) +* +* Contains a read-only count of the number of work queue entries for each QOS +* level. Counts both in-unit and in-memory entries. +*/ +union cvmx_sso_iq_cntx { +u64 u64; +struct cvmx_sso_iq_cntx_s { +u64 reserved_32_63 :32 ; +u64 iq_cnt :32 ; + } s; +struct cvmx_sso_iq_cntx_s cn68xx; +struct cvmx_sso_iq_cntx_s cn68xxp1; +}; + +typedef union cvmx_sso_iq_cntx cvmx_sso_iq_cntx_t ; + +/** +* cvmx_sso_iq_com_cnt +* +* SSO_IQ_COM_CNT = SSO Input Queue Combined Count Register +* +* Contains a read-only count of the total number of work queue entries in all +* QOS levels. Counts both in-unit and in-memory entries. +*/ +union cvmx_sso_iq_com_cnt { +u64 u64; +struct cvmx_sso_iq_com_cnt_s { +u64 reserved_32_63 :32 ; +u64 iq_cnt :32 ; + } s; +struct cvmx_sso_iq_com_cnt_s cn68xx; +struct cvmx_sso_iq_com_cnt_s cn68xxp1; +}; + +typedef union cvmx_sso_iq_com_cnt cvmx_sso_iq_com_cnt_t ; + +/** +* cvmx_sso_iq_int +* +* SSO_IQ_INT = SSO Input Queue Interrupt Register +* +* Contains the bits (one per QOS level) that can trigger the input queue +* interrupt. An IQ_INT bit will be set if SSO_IQ_CNT#QOS# changes and the +* resulting value is equal to SSO_IQ_THR#QOS#. +*/ +union cvmx_sso_iq_int { +u64 u64; +struct cvmx_sso_iq_int_s { +u64 reserved_8_63 :56 ; +u64 iq_int :8 ; + } s; +struct cvmx_sso_iq_int_s cn68xx; +struct cvmx_sso_iq_int_s cn68xxp1; +}; + +typedef union cvmx_sso_iq_int cvmx_sso_iq_int_t ; + +/** +* cvmx_sso_iq_int_en +* +* SSO_IQ_INT_EN = SSO Input Queue Interrupt Enable Register +* +* Contains the bits (one per QOS level) that enable the input queue interrupt. +*/ +union cvmx_sso_iq_int_en { +u64 u64; +struct cvmx_sso_iq_int_en_s { +u64 reserved_8_63 :56 ; +u64 int_en :8 ; + } s; +struct cvmx_sso_iq_int_en_s cn68xx; +struct cvmx_sso_iq_int_en_s cn68xxp1; +}; + +typedef union cvmx_sso_iq_int_en cvmx_sso_iq_int_en_t ; + +/** +* cvmx_sso_iq_thr# +* +* CSR reserved addresses: (24): 0x9040..0x90f8 +* CSR align addresses: =========================================================================================================== +* SSO_IQ_THRX = SSO Input Queue Threshold Register +* (one per QOS level) +* +* Threshold value for triggering input queue interrupts. +*/ +union cvmx_sso_iq_thrx { +u64 u64; +struct cvmx_sso_iq_thrx_s { +u64 reserved_32_63 :32 ; +u64 iq_thr :32 ; + } s; +struct cvmx_sso_iq_thrx_s cn68xx; +struct cvmx_sso_iq_thrx_s cn68xxp1; +}; + +typedef union cvmx_sso_iq_thrx cvmx_sso_iq_thrx_t ; + +/** +* cvmx_sso_nos_cnt +* +* Contains the number of work-queue entries on the no-schedule list. +* +*/ +union cvmx_sso_nos_cnt { +u64 u64; +struct cvmx_sso_nos_cnt_s { +u64 reserved_13_63 :51 ; +u64 nos_cnt :13 ; + } s; +struct cvmx_sso_nos_cnt_cn68xx { +u64 reserved_12_63 :52 ; +u64 nos_cnt :12 ; + } cn68xx; +struct cvmx_sso_nos_cnt_cn68xx cn68xxp1; +struct cvmx_sso_nos_cnt_s cn73xx; +struct cvmx_sso_nos_cnt_s cn78xx; +struct cvmx_sso_nos_cnt_s cn78xxp1; +struct cvmx_sso_nos_cnt_s cnf75xx; +}; + +typedef union cvmx_sso_nos_cnt cvmx_sso_nos_cnt_t ; + +/** +* cvmx_sso_nw_tim +* +* Sets the minimum period for a new-work-request timeout. The period is specified in n-1 +* notation, with the increment value of 1024 clock cycles. Thus, a value of 0x0 in this register +* translates to 1024 cycles, 0x1 translates to 2048 cycles, 0x2 translates to 3072 cycles, etc. +*/ +union cvmx_sso_nw_tim { +u64 u64; +struct cvmx_sso_nw_tim_s { +u64 reserved_10_63 :54 ; +u64 nw_tim :10 ; + } s; +struct cvmx_sso_nw_tim_s cn68xx; +struct cvmx_sso_nw_tim_s cn68xxp1; +struct cvmx_sso_nw_tim_s cn73xx; +struct cvmx_sso_nw_tim_s cn78xx; +struct cvmx_sso_nw_tim_s cn78xxp1; +struct cvmx_sso_nw_tim_s cnf75xx; +}; + +typedef union cvmx_sso_nw_tim cvmx_sso_nw_tim_t ; + +/** +* cvmx_sso_oth_ecc_ctl +* +* SSO_OTH_ECC_CTL = SSO OTH ECC Control +* +*/ +union cvmx_sso_oth_ecc_ctl { +u64 u64; +struct cvmx_sso_oth_ecc_ctl_s { +u64 reserved_6_63 :58 ; +u64 flip_synd1 :2 ; +u64 ecc_ena1 :1 ; +u64 flip_synd0 :2 ; +u64 ecc_ena0 :1 ; + } s; +struct cvmx_sso_oth_ecc_ctl_s cn68xx; +struct cvmx_sso_oth_ecc_ctl_s cn68xxp1; +}; + +typedef union cvmx_sso_oth_ecc_ctl cvmx_sso_oth_ecc_ctl_t ; + +/** +* cvmx_sso_oth_ecc_st +* +* SSO_OTH_ECC_ST = SSO OTH ECC Status +* +*/ +union cvmx_sso_oth_ecc_st { +u64 u64; +struct cvmx_sso_oth_ecc_st_s { +u64 reserved_59_63 :5 ; +u64 addr1 :11 ; +u64 reserved_43_47 :5 ; +u64 syndrom1 :7 ; +u64 reserved_27_35 :9 ; +u64 addr0 :11 ; +u64 reserved_11_15 :5 ; +u64 syndrom0 :7 ; +u64 reserved_0_3 :4 ; + } s; +struct cvmx_sso_oth_ecc_st_s cn68xx; +struct cvmx_sso_oth_ecc_st_s cn68xxp1; +}; + +typedef union cvmx_sso_oth_ecc_st cvmx_sso_oth_ecc_st_t ; + +/** +* cvmx_sso_page_cnt +*/ +union cvmx_sso_page_cnt { +u64 u64; +struct cvmx_sso_page_cnt_s { +u64 reserved_32_63 :32 ; +u64 cnt :32 ; + } s; +struct cvmx_sso_page_cnt_s cn73xx; +struct cvmx_sso_page_cnt_s cn78xx; +struct cvmx_sso_page_cnt_s cn78xxp1; +struct cvmx_sso_page_cnt_s cnf75xx; +}; + +typedef union cvmx_sso_page_cnt cvmx_sso_page_cnt_t ; + +/** +* cvmx_sso_pnd_ecc_ctl +* +* SSO_PND_ECC_CTL = SSO PND ECC Control +* +*/ +union cvmx_sso_pnd_ecc_ctl { +u64 u64; +struct cvmx_sso_pnd_ecc_ctl_s { +u64 reserved_6_63 :58 ; +u64 flip_synd1 :2 ; +u64 ecc_ena1 :1 ; +u64 flip_synd0 :2 ; +u64 ecc_ena0 :1 ; + } s; +struct cvmx_sso_pnd_ecc_ctl_s cn68xx; +struct cvmx_sso_pnd_ecc_ctl_s cn68xxp1; +}; + +typedef union cvmx_sso_pnd_ecc_ctl cvmx_sso_pnd_ecc_ctl_t ; + +/** +* cvmx_sso_pnd_ecc_st +* +* SSO_PND_ECC_ST = SSO PND ECC Status +* +*/ +union cvmx_sso_pnd_ecc_st { +u64 u64; +struct cvmx_sso_pnd_ecc_st_s { +u64 reserved_59_63 :5 ; +u64 addr1 :11 ; +u64 reserved_43_47 :5 ; +u64 syndrom1 :7 ; +u64 reserved_27_35 :9 ; +u64 addr0 :11 ; +u64 reserved_11_15 :5 ; +u64 syndrom0 :7 ; +u64 reserved_0_3 :4 ; + } s; +struct cvmx_sso_pnd_ecc_st_s cn68xx; +struct cvmx_sso_pnd_ecc_st_s cn68xxp1; +}; + +typedef union cvmx_sso_pnd_ecc_st cvmx_sso_pnd_ecc_st_t ; + +/** +* cvmx_sso_pp#_arb +* +* For diagnostic use, returns the group affinity arbitration state for each core. +* +*/ +union cvmx_sso_ppx_arb { +u64 u64; +struct cvmx_sso_ppx_arb_s { +u64 reserved_20_63 :44 ; +u64 aff_left :4 ; +u64 reserved_8_15 :8 ; +u64 last_grp :8 ; + } s; +struct cvmx_sso_ppx_arb_s cn73xx; +struct cvmx_sso_ppx_arb_s cn78xx; +struct cvmx_sso_ppx_arb_s cn78xxp1; +struct cvmx_sso_ppx_arb_s cnf75xx; +}; + +typedef union cvmx_sso_ppx_arb cvmx_sso_ppx_arb_t ; + +/** +* cvmx_sso_pp#_grp_msk +* +* CSR reserved addresses: (24): 0x5040..0x50f8 +* CSR align addresses: =========================================================================================================== +* SSO_PPX_GRP_MSK = SSO PP Group Mask Register +* (one bit per group per PP) +* +* Selects which group(s) a PP belongs to. A '1' in any bit position sets the +* PP's membership in the corresponding group. A value of 0x0 will prevent the +* PP from receiving new work. +* +* Note that these do not contain QOS level priorities for each PP. This is a +* change from previous POW designs. +*/ +union cvmx_sso_ppx_grp_msk { +u64 u64; +struct cvmx_sso_ppx_grp_msk_s { +u64 grp_msk :64 ; + } s; +struct cvmx_sso_ppx_grp_msk_s cn68xx; +struct cvmx_sso_ppx_grp_msk_s cn68xxp1; +}; + +typedef union cvmx_sso_ppx_grp_msk cvmx_sso_ppx_grp_msk_t ; + +/** +* cvmx_sso_pp#_qos_pri +* +* CSR reserved addresses: (56): 0x2040..0x21f8 +* CSR align addresses: =========================================================================================================== +* SSO_PP(0..31)_QOS_PRI = SSO PP QOS Priority Register +* (one field per IQ per PP) +* +* Contains the QOS level priorities for each PP. +* 0x0 is the highest priority +* 0x7 is the lowest priority +* 0xf prevents the PP from receiving work from that QOS level +* 0x8-0xe Reserved +* +* For a given PP, priorities should begin at 0x0, and remain contiguous +* throughout the range. Failure to do so may result in severe +* performance degradation. +* +* +* Priorities for IQs 0..7 +*/ +union cvmx_sso_ppx_qos_pri { +u64 u64; +struct cvmx_sso_ppx_qos_pri_s { +u64 reserved_60_63 :4 ; +u64 qos7_pri :4 ; +u64 reserved_52_55 :4 ; +u64 qos6_pri :4 ; +u64 reserved_44_47 :4 ; +u64 qos5_pri :4 ; +u64 reserved_36_39 :4 ; +u64 qos4_pri :4 ; +u64 reserved_28_31 :4 ; +u64 qos3_pri :4 ; +u64 reserved_20_23 :4 ; +u64 qos2_pri :4 ; +u64 reserved_12_15 :4 ; +u64 qos1_pri :4 ; +u64 reserved_4_7 :4 ; +u64 qos0_pri :4 ; + } s; +struct cvmx_sso_ppx_qos_pri_s cn68xx; +struct cvmx_sso_ppx_qos_pri_s cn68xxp1; +}; + +typedef union cvmx_sso_ppx_qos_pri cvmx_sso_ppx_qos_pri_t ; + +/** +* cvmx_sso_pp#_s#_grpmsk# +* +* These registers select which group or groups a core belongs to. There are 2 sets of masks per +* core, each with 1 register corresponding to 64 groups. +*/ +union cvmx_sso_ppx_sx_grpmskx { +u64 u64; +struct cvmx_sso_ppx_sx_grpmskx_s { +u64 grp_msk :64 ; + } s; +struct cvmx_sso_ppx_sx_grpmskx_s cn73xx; +struct cvmx_sso_ppx_sx_grpmskx_s cn78xx; +struct cvmx_sso_ppx_sx_grpmskx_s cn78xxp1; +struct cvmx_sso_ppx_sx_grpmskx_s cnf75xx; +}; + +typedef union cvmx_sso_ppx_sx_grpmskx cvmx_sso_ppx_sx_grpmskx_t ; + +/** +* cvmx_sso_pp_strict +* +* SSO_PP_STRICT = SSO Strict Priority +* +* This register controls getting work from the input queues. If the bit +* corresponding to a PP is set, that PP will not take work off the input +* queues until it is known that there is no higher-priority work available. +* +* Setting SSO_PP_STRICT may incur a performance penalty if highest-priority +* work is not found early. +* +* It is possible to starve a PP of work with SSO_PP_STRICT. If the +* SSO_PPX_GRP_MSK for a PP masks-out much of the work added to the input +* queues that are higher-priority for that PP, and if there is a constant +* stream of work through one or more of those higher-priority input queues, +* then that PP may not accept work from lower-priority input queues. This can +* be alleviated by ensuring that most or all the work added to the +* higher-priority input queues for a PP with SSO_PP_STRICT set are in a group +* acceptable to that PP. +* +* It is also possible to neglect work in an input queue if SSO_PP_STRICT is +* used. If an input queue is a lower-priority queue for all PPs, and if all +* the PPs have their corresponding bit in SSO_PP_STRICT set, then work may +* never be taken (or be seldom taken) from that queue. This can be alleviated +* by ensuring that work in all input queues can be serviced by one or more PPs +* that do not have SSO_PP_STRICT set, or that the input queue is the +* highest-priority input queue for one or more PPs that do have SSO_PP_STRICT +* set. +*/ +union cvmx_sso_pp_strict { +u64 u64; +struct cvmx_sso_pp_strict_s { +u64 reserved_32_63 :32 ; +u64 pp_strict :32 ; + } s; +struct cvmx_sso_pp_strict_s cn68xx; +struct cvmx_sso_pp_strict_s cn68xxp1; +}; + +typedef union cvmx_sso_pp_strict cvmx_sso_pp_strict_t ; + +/** +* cvmx_sso_qos#_rnd +* +* CSR align addresses: =========================================================================================================== +* SSO_QOS(0..7)_RND = SSO QOS Issue Round Register +* (one per IQ) +* +* The number of arbitration rounds each QOS level participates in. +*/ +union cvmx_sso_qosx_rnd { +u64 u64; +struct cvmx_sso_qosx_rnd_s { +u64 reserved_8_63 :56 ; +u64 rnds_qos :8 ; + } s; +struct cvmx_sso_qosx_rnd_s cn68xx; +struct cvmx_sso_qosx_rnd_s cn68xxp1; +}; + +typedef union cvmx_sso_qosx_rnd cvmx_sso_qosx_rnd_t ; + +/** +* cvmx_sso_qos_thr# +* +* CSR reserved addresses: (24): 0xa040..0xa0f8 +* CSR align addresses: =========================================================================================================== +* SSO_QOS_THRX = SSO QOS Threshold Register +* (one per QOS level) +* +* Contains the thresholds for allocating SSO internal storage buffers. If the +* number of remaining free buffers drops below the minimum threshold (MIN_THR) +* or the number of allocated buffers for this QOS level rises above the +* maximum threshold (MAX_THR), future incoming work queue entries will be +* buffered externally rather than internally. This register also contains the +* number of internal buffers currently allocated to this QOS level (BUF_CNT). +*/ +union cvmx_sso_qos_thrx { +u64 u64; +struct cvmx_sso_qos_thrx_s { +u64 reserved_40_63 :24 ; +u64 buf_cnt :12 ; +u64 reserved_26_27 :2 ; +u64 max_thr :12 ; +u64 reserved_12_13 :2 ; +u64 min_thr :12 ; + } s; +struct cvmx_sso_qos_thrx_s cn68xx; +struct cvmx_sso_qos_thrx_s cn68xxp1; +}; + +typedef union cvmx_sso_qos_thrx cvmx_sso_qos_thrx_t ; + +/** +* cvmx_sso_qos_we +* +* SSO_QOS_WE = SSO WE Buffers +* +* This register contains a read-only count of the current number of free +* buffers (FREE_CNT) and the total number of tag chain heads on the de-schedule list +* (DES_CNT) (which is not the same as the total number of entries on all of the descheduled +* tag chains.) +*/ +union cvmx_sso_qos_we { +u64 u64; +struct cvmx_sso_qos_we_s { +u64 reserved_26_63 :38 ; +u64 des_cnt :12 ; +u64 reserved_12_13 :2 ; +u64 free_cnt :12 ; + } s; +struct cvmx_sso_qos_we_s cn68xx; +struct cvmx_sso_qos_we_s cn68xxp1; +}; + +typedef union cvmx_sso_qos_we cvmx_sso_qos_we_t ; + +/** +* cvmx_sso_reset +* +* Writing a 1 to SSO_RESET[RESET] resets the SSO. After receiving a store to this CSR, the SSO +* must not be sent any other operations for 2500 coprocessor (SCLK) cycles. Note that the +* contents of this register are reset along with the rest of the SSO. +*/ +union cvmx_sso_reset { +u64 u64; +struct cvmx_sso_reset_s { +u64 busy :1 ; +u64 reserved_1_62 :62 ; +u64 reset :1 ; + } s; +struct cvmx_sso_reset_cn68xx { +u64 reserved_1_63 :63 ; +u64 reset :1 ; + } cn68xx; +struct cvmx_sso_reset_s cn73xx; +struct cvmx_sso_reset_s cn78xx; +struct cvmx_sso_reset_s cn78xxp1; +struct cvmx_sso_reset_s cnf75xx; +}; + +typedef union cvmx_sso_reset cvmx_sso_reset_t ; + +/** +* cvmx_sso_rwq_head_ptr# +* +* CSR reserved addresses: (24): 0xb040..0xb0f8 +* CSR align addresses: =========================================================================================================== +* SSO_RWQ_HEAD_PTRX = SSO Remote Queue Head Register +* (one per QOS level) +* Contains the ptr to the first entry of the remote linked list(s) for a particular +* QoS level. SW should initialize the remote linked list(s) by programming +* SSO_RWQ_HEAD_PTRX and SSO_RWQ_TAIL_PTRX to identical values. +*/ +union cvmx_sso_rwq_head_ptrx { +u64 u64; +struct cvmx_sso_rwq_head_ptrx_s { +u64 reserved_38_63 :26 ; +u64 ptr :31 ; +u64 reserved_5_6 :2 ; +u64 rctr :5 ; + } s; +struct cvmx_sso_rwq_head_ptrx_s cn68xx; +struct cvmx_sso_rwq_head_ptrx_s cn68xxp1; +}; + +typedef union cvmx_sso_rwq_head_ptrx cvmx_sso_rwq_head_ptrx_t ; + +/** +* cvmx_sso_rwq_pop_fptr +* +* SSO_RWQ_POP_FPTR = SSO Pop Free Pointer +* +* This register is used by SW to remove pointers for buffer-reallocation and diagnostics, and +* should only be used when SSO is idle. +* +* To remove ALL pointers, software must insure that there are modulus 16 +* pointers in the FPA. To do this, SSO_CFG.RWQ_BYP_DIS must be set, the FPA +* pointer count read, and enough fake buffers pushed via SSO_RWQ_PSH_FPTR to +* bring the FPA pointer count up to mod 16. +*/ +union cvmx_sso_rwq_pop_fptr { +u64 u64; +struct cvmx_sso_rwq_pop_fptr_s { +u64 val :1 ; +u64 reserved_38_62 :25 ; +u64 fptr :31 ; +u64 reserved_0_6 :7 ; + } s; +struct cvmx_sso_rwq_pop_fptr_s cn68xx; +struct cvmx_sso_rwq_pop_fptr_s cn68xxp1; +}; + +typedef union cvmx_sso_rwq_pop_fptr cvmx_sso_rwq_pop_fptr_t ; + +/** +* cvmx_sso_rwq_psh_fptr +* +* CSR reserved addresses: (56): 0xc240..0xc3f8 +* SSO_RWQ_PSH_FPTR = SSO Free Pointer FIFO +* +* This register is used by SW to initialize the SSO with a pool of free +* pointers by writing the FPTR field whenever FULL = 0. Free pointers are +* fetched/released from/to the pool when accessing WQE entries stored remotely +* (in remote linked lists). Free pointers should be 128 byte aligned, each of +* 256 bytes. This register should only be used when SSO is idle. +* +* Software needs to set aside buffering for +* 8 + 48 + ROUNDUP(N/26) +* +* where as many as N DRAM work queue entries may be used. The first 8 buffers +* are used to setup the SSO_RWQ_HEAD_PTR and SSO_RWQ_TAIL_PTRs, and the +* remainder are pushed via this register. +* +* IMPLEMENTATION NOTES--NOT FOR SPEC: +* 48 avoids false out of buffer error due to (16) FPA and in-sso FPA buffering (32) +* 26 is number of WAE's per 256B buffer +*/ +union cvmx_sso_rwq_psh_fptr { +u64 u64; +struct cvmx_sso_rwq_psh_fptr_s { +u64 full :1 ; +u64 reserved_38_62 :25 ; +u64 fptr :31 ; +u64 reserved_0_6 :7 ; + } s; +struct cvmx_sso_rwq_psh_fptr_s cn68xx; +struct cvmx_sso_rwq_psh_fptr_s cn68xxp1; +}; + +typedef union cvmx_sso_rwq_psh_fptr cvmx_sso_rwq_psh_fptr_t ; + +/** +* cvmx_sso_rwq_tail_ptr# +* +* CSR reserved addresses: (56): 0xc040..0xc1f8 +* SSO_RWQ_TAIL_PTRX = SSO Remote Queue Tail Register +* (one per QOS level) +* Contains the ptr to the last entry of the remote linked list(s) for a particular +* QoS level. SW must initialize the remote linked list(s) by programming +* SSO_RWQ_HEAD_PTRX and SSO_RWQ_TAIL_PTRX to identical values. +*/ +union cvmx_sso_rwq_tail_ptrx { +u64 u64; +struct cvmx_sso_rwq_tail_ptrx_s { +u64 reserved_38_63 :26 ; +u64 ptr :31 ; +u64 reserved_5_6 :2 ; +u64 rctr :5 ; + } s; +struct cvmx_sso_rwq_tail_ptrx_s cn68xx; +struct cvmx_sso_rwq_tail_ptrx_s cn68xxp1; +}; + +typedef union cvmx_sso_rwq_tail_ptrx cvmx_sso_rwq_tail_ptrx_t ; + +/** +* cvmx_sso_sl_pp#_links +* +* Returns status of each core. +* +*/ +union cvmx_sso_sl_ppx_links { +u64 u64; +struct cvmx_sso_sl_ppx_links_s { +u64 tailc :1 ; +u64 reserved_60_62 :3 ; +u64 index :12 ; +u64 reserved_38_47 :10 ; +u64 grp :10 ; +u64 head :1 ; +u64 tail :1 ; +u64 reserved_0_25 :26 ; + } s; +struct cvmx_sso_sl_ppx_links_cn73xx { +u64 tailc :1 ; +u64 reserved_58_62 :5 ; +u64 index :10 ; +u64 reserved_36_47 :12 ; +u64 grp :8 ; +u64 head :1 ; +u64 tail :1 ; +u64 reserved_21_25 :5 ; +u64 revlink_index :10 ; +u64 link_index_vld :1 ; +u64 link_index :10 ; + } cn73xx; +struct cvmx_sso_sl_ppx_links_cn78xx { +u64 tailc :1 ; +u64 reserved_60_62 :3 ; +u64 index :12 ; +u64 reserved_38_47 :10 ; +u64 grp :10 ; +u64 head :1 ; +u64 tail :1 ; +u64 reserved_25_25 :1 ; +u64 revlink_index :12 ; +u64 link_index_vld :1 ; +u64 link_index :12 ; + } cn78xx; +struct cvmx_sso_sl_ppx_links_cn78xx cn78xxp1; +struct cvmx_sso_sl_ppx_links_cn73xx cnf75xx; +}; + +typedef union cvmx_sso_sl_ppx_links cvmx_sso_sl_ppx_links_t ; + +/** +* cvmx_sso_sl_pp#_pendtag +* +* Returns status of each core. +* +*/ +union cvmx_sso_sl_ppx_pendtag { +u64 u64; +struct cvmx_sso_sl_ppx_pendtag_s { +u64 pend_switch :1 ; +u64 pend_get_work :1 ; +u64 pend_get_work_wait :1 ; +u64 pend_nosched :1 ; +u64 pend_nosched_clr :1 ; +u64 pend_desched :1 ; +u64 pend_alloc_we :1 ; +u64 pend_gw_insert :1 ; +u64 reserved_34_55 :22 ; +u64 pend_tt :2 ; +u64 pend_tag :32 ; + } s; +struct cvmx_sso_sl_ppx_pendtag_s cn73xx; +struct cvmx_sso_sl_ppx_pendtag_s cn78xx; +struct cvmx_sso_sl_ppx_pendtag_s cn78xxp1; +struct cvmx_sso_sl_ppx_pendtag_s cnf75xx; +}; + +typedef union cvmx_sso_sl_ppx_pendtag cvmx_sso_sl_ppx_pendtag_t ; + +/** +* cvmx_sso_sl_pp#_pendwqp +* +* Returns status of each core. +* +*/ +union cvmx_sso_sl_ppx_pendwqp { +u64 u64; +struct cvmx_sso_sl_ppx_pendwqp_s { +u64 pend_switch :1 ; +u64 pend_get_work :1 ; +u64 pend_get_work_wait :1 ; +u64 pend_nosched :1 ; +u64 pend_nosched_clr :1 ; +u64 pend_desched :1 ; +u64 pend_alloc_we :1 ; +u64 reserved_56_56 :1 ; +u64 pend_index :12 ; +u64 reserved_42_43 :2 ; +u64 pend_wqp :42 ; + } s; +struct cvmx_sso_sl_ppx_pendwqp_cn73xx { +u64 pend_switch :1 ; +u64 pend_get_work :1 ; +u64 pend_get_work_wait :1 ; +u64 pend_nosched :1 ; +u64 pend_nosched_clr :1 ; +u64 pend_desched :1 ; +u64 pend_alloc_we :1 ; +u64 reserved_54_56 :3 ; +u64 pend_index :10 ; +u64 reserved_42_43 :2 ; +u64 pend_wqp :42 ; + } cn73xx; +struct cvmx_sso_sl_ppx_pendwqp_s cn78xx; +struct cvmx_sso_sl_ppx_pendwqp_s cn78xxp1; +struct cvmx_sso_sl_ppx_pendwqp_cn73xx cnf75xx; +}; + +typedef union cvmx_sso_sl_ppx_pendwqp cvmx_sso_sl_ppx_pendwqp_t ; + +/** +* cvmx_sso_sl_pp#_tag +* +* Returns status of each core. +* +*/ +union cvmx_sso_sl_ppx_tag { +u64 u64; +struct cvmx_sso_sl_ppx_tag_s { +u64 tailc :1 ; +u64 reserved_60_62 :3 ; +u64 index :12 ; +u64 reserved_46_47 :2 ; +u64 grp :10 ; +u64 head :1 ; +u64 tail :1 ; +u64 tt :2 ; +u64 tag :32 ; + } s; +struct cvmx_sso_sl_ppx_tag_cn73xx { +u64 tailc :1 ; +u64 reserved_58_62 :5 ; +u64 index :10 ; +u64 reserved_44_47 :4 ; +u64 grp :8 ; +u64 head :1 ; +u64 tail :1 ; +u64 tt :2 ; +u64 tag :32 ; + } cn73xx; +struct cvmx_sso_sl_ppx_tag_s cn78xx; +struct cvmx_sso_sl_ppx_tag_s cn78xxp1; +struct cvmx_sso_sl_ppx_tag_cn73xx cnf75xx; +}; + +typedef union cvmx_sso_sl_ppx_tag cvmx_sso_sl_ppx_tag_t ; + +/** +* cvmx_sso_sl_pp#_wqp +* +* Returns status of each core. +* +*/ +union cvmx_sso_sl_ppx_wqp { +u64 u64; +struct cvmx_sso_sl_ppx_wqp_s { +u64 reserved_58_63 :6 ; +u64 grp :10 ; +u64 reserved_42_47 :6 ; +u64 wqp :42 ; + } s; +struct cvmx_sso_sl_ppx_wqp_cn73xx { +u64 reserved_56_63 :8 ; +u64 grp :8 ; +u64 reserved_42_47 :6 ; +u64 wqp :42 ; + } cn73xx; +struct cvmx_sso_sl_ppx_wqp_s cn78xx; +struct cvmx_sso_sl_ppx_wqp_s cn78xxp1; +struct cvmx_sso_sl_ppx_wqp_cn73xx cnf75xx; +}; + +typedef union cvmx_sso_sl_ppx_wqp cvmx_sso_sl_ppx_wqp_t ; + +/** +* cvmx_sso_taq#_link +* +* Returns TAQ status for a given line. +* +*/ +union cvmx_sso_taqx_link { +u64 u64; +struct cvmx_sso_taqx_link_s { +u64 reserved_11_63 :53 ; +u64 next :11 ; + } s; +struct cvmx_sso_taqx_link_s cn73xx; +struct cvmx_sso_taqx_link_s cn78xx; +struct cvmx_sso_taqx_link_s cn78xxp1; +struct cvmx_sso_taqx_link_s cnf75xx; +}; + +typedef union cvmx_sso_taqx_link cvmx_sso_taqx_link_t ; + +/** +* cvmx_sso_taq#_wae#_tag +* +* Returns TAQ status for a given line and WAE within that line. +* +*/ +union cvmx_sso_taqx_waex_tag { +u64 u64; +struct cvmx_sso_taqx_waex_tag_s { +u64 reserved_34_63 :30 ; +u64 tt :2 ; +u64 tag :32 ; + } s; +struct cvmx_sso_taqx_waex_tag_s cn73xx; +struct cvmx_sso_taqx_waex_tag_s cn78xx; +struct cvmx_sso_taqx_waex_tag_s cn78xxp1; +struct cvmx_sso_taqx_waex_tag_s cnf75xx; +}; + +typedef union cvmx_sso_taqx_waex_tag cvmx_sso_taqx_waex_tag_t ; + +/** +* cvmx_sso_taq#_wae#_wqp +* +* Returns TAQ status for a given line and WAE within that line. +* +*/ +union cvmx_sso_taqx_waex_wqp { +u64 u64; +struct cvmx_sso_taqx_waex_wqp_s { +u64 reserved_42_63 :22 ; +u64 wqp :42 ; + } s; +struct cvmx_sso_taqx_waex_wqp_s cn73xx; +struct cvmx_sso_taqx_waex_wqp_s cn78xx; +struct cvmx_sso_taqx_waex_wqp_s cn78xxp1; +struct cvmx_sso_taqx_waex_wqp_s cnf75xx; +}; + +typedef union cvmx_sso_taqx_waex_wqp cvmx_sso_taqx_waex_wqp_t ; + +/** +* cvmx_sso_taq_add +*/ +union cvmx_sso_taq_add { +u64 u64; +struct cvmx_sso_taq_add_s { +u64 reserved_29_63 :35 ; +u64 rsvd_free :13 ; +u64 reserved_0_15 :16 ; + } s; +struct cvmx_sso_taq_add_s cn73xx; +struct cvmx_sso_taq_add_s cn78xx; +struct cvmx_sso_taq_add_s cn78xxp1; +struct cvmx_sso_taq_add_s cnf75xx; +}; + +typedef union cvmx_sso_taq_add cvmx_sso_taq_add_t ; + +/** +* cvmx_sso_taq_cnt +*/ +union cvmx_sso_taq_cnt { +u64 u64; +struct cvmx_sso_taq_cnt_s { +u64 reserved_27_63 :37 ; +u64 rsvd_free :11 ; +u64 reserved_11_15 :5 ; +u64 free_cnt :11 ; + } s; +struct cvmx_sso_taq_cnt_s cn73xx; +struct cvmx_sso_taq_cnt_s cn78xx; +struct cvmx_sso_taq_cnt_s cn78xxp1; +struct cvmx_sso_taq_cnt_s cnf75xx; +}; + +typedef union cvmx_sso_taq_cnt cvmx_sso_taq_cnt_t ; + +/** +* cvmx_sso_tiaq#_status +* +* Returns TAQ inbound status indexed by group. +* +*/ +union cvmx_sso_tiaqx_status { +u64 u64; +struct cvmx_sso_tiaqx_status_s { +u64 wae_head :4 ; +u64 wae_tail :4 ; +u64 reserved_47_55 :9 ; +u64 wae_used :15 ; +u64 reserved_23_31 :9 ; +u64 ent_head :11 ; +u64 reserved_11_11 :1 ; +u64 ent_tail :11 ; + } s; +struct cvmx_sso_tiaqx_status_s cn73xx; +struct cvmx_sso_tiaqx_status_s cn78xx; +struct cvmx_sso_tiaqx_status_s cn78xxp1; +struct cvmx_sso_tiaqx_status_s cnf75xx; +}; + +typedef union cvmx_sso_tiaqx_status cvmx_sso_tiaqx_status_t ; + +/** +* cvmx_sso_toaq#_status +* +* Returns TAQ outbound status indexed by group. +* +*/ +union cvmx_sso_toaqx_status { +u64 u64; +struct cvmx_sso_toaqx_status_s { +u64 reserved_62_63 :2 ; +u64 ext_vld :1 ; +u64 partial :1 ; +u64 wae_tail :4 ; +u64 reserved_43_55 :13 ; +u64 cl_used :11 ; +u64 reserved_23_31 :9 ; +u64 ent_head :11 ; +u64 reserved_11_11 :1 ; +u64 ent_tail :11 ; + } s; +struct cvmx_sso_toaqx_status_s cn73xx; +struct cvmx_sso_toaqx_status_s cn78xx; +struct cvmx_sso_toaqx_status_s cn78xxp1; +struct cvmx_sso_toaqx_status_s cnf75xx; +}; + +typedef union cvmx_sso_toaqx_status cvmx_sso_toaqx_status_t ; + +/** +* cvmx_sso_ts_pc +* +* SSO_TS_PC = SSO Tag Switch Performance Counter +* +* Counts the number of tag switch requests. +* Counter rolls over through zero when max value exceeded. +*/ +union cvmx_sso_ts_pc { +u64 u64; +struct cvmx_sso_ts_pc_s { +u64 ts_pc :64 ; + } s; +struct cvmx_sso_ts_pc_s cn68xx; +struct cvmx_sso_ts_pc_s cn68xxp1; +}; + +typedef union cvmx_sso_ts_pc cvmx_sso_ts_pc_t ; + +/** +* cvmx_sso_wa_com_pc +* +* SSO_WA_COM_PC = SSO Work Add Combined Performance Counter +* +* Counts the number of add new work requests for all QOS levels. +* Counter rolls over through zero when max value exceeded. +*/ +union cvmx_sso_wa_com_pc { +u64 u64; +struct cvmx_sso_wa_com_pc_s { +u64 wa_pc :64 ; + } s; +struct cvmx_sso_wa_com_pc_s cn68xx; +struct cvmx_sso_wa_com_pc_s cn68xxp1; +}; + +typedef union cvmx_sso_wa_com_pc cvmx_sso_wa_com_pc_t ; + +/** +* cvmx_sso_wa_pc# +* +* CSR reserved addresses: (64): 0x4200..0x43f8 +* CSR align addresses: =========================================================================================================== +* SSO_WA_PCX = SSO Work Add Performance Counter +* (one per QOS level) +* +* Counts the number of add new work requests for each QOS level. +* Counter rolls over through zero when max value exceeded. +*/ +union cvmx_sso_wa_pcx { +u64 u64; +struct cvmx_sso_wa_pcx_s { +u64 wa_pc :64 ; + } s; +struct cvmx_sso_wa_pcx_s cn68xx; +struct cvmx_sso_wa_pcx_s cn68xxp1; +}; + +typedef union cvmx_sso_wa_pcx cvmx_sso_wa_pcx_t ; + +/** +* cvmx_sso_wq_int +* +* Note, the old POW offsets ran from 0x0 to 0x3f8, leaving the next available slot at 0x400. +* To ensure no overlap, start on 4k boundary: 0x1000. +* SSO_WQ_INT = SSO Work Queue Interrupt Register +* +* Contains the bits (one per group) that set work queue interrupts and are +* used to clear these interrupts. For more information regarding this +* register, see the interrupt section of the SSO spec. +*/ +union cvmx_sso_wq_int { +u64 u64; +struct cvmx_sso_wq_int_s { +u64 wq_int :64 ; + } s; +struct cvmx_sso_wq_int_s cn68xx; +struct cvmx_sso_wq_int_s cn68xxp1; +}; + +typedef union cvmx_sso_wq_int cvmx_sso_wq_int_t ; + +/** +* cvmx_sso_wq_int_cnt# +* +* CSR reserved addresses: (64): 0x7200..0x73f8 +* CSR align addresses: =========================================================================================================== +* SSO_WQ_INT_CNTX = SSO Work Queue Interrupt Count Register +* (one per group) +* +* Contains a read-only copy of the counts used to trigger work queue +* interrupts. For more information regarding this register, see the interrupt +* section. +*/ +union cvmx_sso_wq_int_cntx { +u64 u64; +struct cvmx_sso_wq_int_cntx_s { +u64 reserved_32_63 :32 ; +u64 tc_cnt :4 ; +u64 reserved_26_27 :2 ; +u64 ds_cnt :12 ; +u64 reserved_12_13 :2 ; +u64 iq_cnt :12 ; + } s; +struct cvmx_sso_wq_int_cntx_s cn68xx; +struct cvmx_sso_wq_int_cntx_s cn68xxp1; +}; + +typedef union cvmx_sso_wq_int_cntx cvmx_sso_wq_int_cntx_t ; + +/** +* cvmx_sso_wq_int_pc +* +* Contains the threshold value for the work-executable interrupt periodic counter and also a +* read-only copy of the periodic counter. For more information on this register, refer to +* Interrupts. +*/ +union cvmx_sso_wq_int_pc { +u64 u64; +struct cvmx_sso_wq_int_pc_s { +u64 reserved_60_63 :4 ; +u64 pc :28 ; +u64 reserved_28_31 :4 ; +u64 pc_thr :20 ; +u64 reserved_0_7 :8 ; + } s; +struct cvmx_sso_wq_int_pc_s cn68xx; +struct cvmx_sso_wq_int_pc_s cn68xxp1; +struct cvmx_sso_wq_int_pc_s cn73xx; +struct cvmx_sso_wq_int_pc_s cn78xx; +struct cvmx_sso_wq_int_pc_s cn78xxp1; +struct cvmx_sso_wq_int_pc_s cnf75xx; +}; + +typedef union cvmx_sso_wq_int_pc cvmx_sso_wq_int_pc_t ; + +/** +* cvmx_sso_wq_int_thr# +* +* CSR reserved addresses: (96): 0x6100..0x63f8 +* CSR align addresses: =========================================================================================================== +* SSO_WQ_INT_THR(0..63) = SSO Work Queue Interrupt Threshold Registers +* (one per group) +* +* Contains the thresholds for enabling and setting work queue interrupts. For +* more information, see the interrupt section. +* +* Note: Up to 16 of the SSO's internal storage buffers can be allocated +* for hardware use and are therefore not available for incoming work queue +* entries. Additionally, any WS that is not in the EMPTY state consumes a +* buffer. Thus in a 32 PP system, it is not advisable to set either IQ_THR or +* DS_THR to greater than 2048 - 16 - 32*2 = 1968. Doing so may prevent the +* interrupt from ever triggering. +* +* Priorities for QOS levels 0..7 +*/ +union cvmx_sso_wq_int_thrx { +u64 u64; +struct cvmx_sso_wq_int_thrx_s { +u64 reserved_33_63 :31 ; +u64 tc_en :1 ; +u64 tc_thr :4 ; +u64 reserved_26_27 :2 ; +u64 ds_thr :12 ; +u64 reserved_12_13 :2 ; +u64 iq_thr :12 ; + } s; +struct cvmx_sso_wq_int_thrx_s cn68xx; +struct cvmx_sso_wq_int_thrx_s cn68xxp1; +}; + +typedef union cvmx_sso_wq_int_thrx cvmx_sso_wq_int_thrx_t ; + +/** +* cvmx_sso_wq_iq_dis +* +* CSR reserved addresses: (1): 0x1008..0x1008 +* SSO_WQ_IQ_DIS = SSO Input Queue Interrupt Temporary Disable Mask +* +* Contains the input queue interrupt temporary disable bits (one per group). +* For more information regarding this register, see the interrupt section. +*/ +union cvmx_sso_wq_iq_dis { +u64 u64; +struct cvmx_sso_wq_iq_dis_s { +u64 iq_dis :64 ; + } s; +struct cvmx_sso_wq_iq_dis_s cn68xx; +struct cvmx_sso_wq_iq_dis_s cn68xxp1; +}; + +typedef union cvmx_sso_wq_iq_dis cvmx_sso_wq_iq_dis_t ; + +/** +* cvmx_sso_ws_cfg +* +* This register contains various SSO work-slot configuration bits. +* +*/ +union cvmx_sso_ws_cfg { +u64 u64; +struct cvmx_sso_ws_cfg_s { +u64 reserved_56_63 :8 ; +u64 ocla_bp :8 ; +u64 reserved_7_47 :41 ; +u64 aw_clk_dis :1 ; +u64 gw_clk_dis :1 ; +u64 disable_pw :1 ; +u64 arbc_step_en :1 ; +u64 ncbo_step_en :1 ; +u64 soc_ccam_dis :1 ; +u64 sso_cclk_dis :1 ; + } s; +struct cvmx_sso_ws_cfg_s cn73xx; +struct cvmx_sso_ws_cfg_cn78xx { +u64 reserved_56_63 :8 ; +u64 ocla_bp :8 ; +u64 reserved_5_47 :43 ; +u64 disable_pw :1 ; +u64 arbc_step_en :1 ; +u64 ncbo_step_en :1 ; +u64 soc_ccam_dis :1 ; +u64 sso_cclk_dis :1 ; + } cn78xx; +struct cvmx_sso_ws_cfg_cn78xx cn78xxp1; +struct cvmx_sso_ws_cfg_s cnf75xx; +}; + +typedef union cvmx_sso_ws_cfg cvmx_sso_ws_cfg_t ; + +/** +* cvmx_sso_ws_eco +*/ +union cvmx_sso_ws_eco { +u64 u64; +struct cvmx_sso_ws_eco_s { +u64 reserved_8_63 :56 ; +u64 eco_rw :8 ; + } s; +struct cvmx_sso_ws_eco_s cn73xx; +struct cvmx_sso_ws_eco_s cnf75xx; +}; + +typedef union cvmx_sso_ws_eco cvmx_sso_ws_eco_t ; + +/** +* cvmx_sso_ws_pc# +* +* CSR reserved addresses: (225): 0x3100..0x3800 +* CSR align addresses: =========================================================================================================== +* SSO_WS_PCX = SSO Work Schedule Performance Counter +* (one per group) +* +* Counts the number of work schedules for each group. +* Counter rolls over through zero when max value exceeded. +*/ +union cvmx_sso_ws_pcx { +u64 u64; +struct cvmx_sso_ws_pcx_s { +u64 ws_pc :64 ; + } s; +struct cvmx_sso_ws_pcx_s cn68xx; +struct cvmx_sso_ws_pcx_s cn68xxp1; +}; + +typedef union cvmx_sso_ws_pcx cvmx_sso_ws_pcx_t ; + +/** +* cvmx_sso_xaq#_head_next +* +* These registers contain the pointer to the next buffer to become the head when the final cache +* line in this buffer is read. +*/ +union cvmx_sso_xaqx_head_next { +u64 u64; +struct cvmx_sso_xaqx_head_next_s { +u64 reserved_42_63 :22 ; +u64 ptr :35 ; +u64 reserved_0_6 :7 ; + } s; +struct cvmx_sso_xaqx_head_next_s cn73xx; +struct cvmx_sso_xaqx_head_next_s cn78xx; +struct cvmx_sso_xaqx_head_next_s cn78xxp1; +struct cvmx_sso_xaqx_head_next_s cnf75xx; +}; + +typedef union cvmx_sso_xaqx_head_next cvmx_sso_xaqx_head_next_t ; + +/** +* cvmx_sso_xaq#_head_ptr +* +* These registers contain the pointer to the first entry of the external linked list(s) for a +* particular group. Software must initialize the external linked list(s) by programming +* SSO_XAQ()_HEAD_PTR, SSO_XAQ()_HEAD_NEXT, SSO_XAQ()_TAIL_PTR and +* SSO_XAQ()_TAIL_NEXT to identical values. +*/ +union cvmx_sso_xaqx_head_ptr { +u64 u64; +struct cvmx_sso_xaqx_head_ptr_s { +u64 reserved_42_63 :22 ; +u64 ptr :35 ; +u64 reserved_5_6 :2 ; +u64 cl :5 ; + } s; +struct cvmx_sso_xaqx_head_ptr_s cn73xx; +struct cvmx_sso_xaqx_head_ptr_s cn78xx; +struct cvmx_sso_xaqx_head_ptr_s cn78xxp1; +struct cvmx_sso_xaqx_head_ptr_s cnf75xx; +}; + +typedef union cvmx_sso_xaqx_head_ptr cvmx_sso_xaqx_head_ptr_t ; + +/** +* cvmx_sso_xaq#_tail_next +* +* These registers contain the pointer to the next buffer to become the tail when the final cache +* line in this buffer is written. Register fields are identical to those in +* SSO_XAQ()_HEAD_NEXT above. +*/ +union cvmx_sso_xaqx_tail_next { +u64 u64; +struct cvmx_sso_xaqx_tail_next_s { +u64 reserved_42_63 :22 ; +u64 ptr :35 ; +u64 reserved_0_6 :7 ; + } s; +struct cvmx_sso_xaqx_tail_next_s cn73xx; +struct cvmx_sso_xaqx_tail_next_s cn78xx; +struct cvmx_sso_xaqx_tail_next_s cn78xxp1; +struct cvmx_sso_xaqx_tail_next_s cnf75xx; +}; + +typedef union cvmx_sso_xaqx_tail_next cvmx_sso_xaqx_tail_next_t ; + +/** +* cvmx_sso_xaq#_tail_ptr +* +* These registers contain the pointer to the last entry of the external linked list(s) for a +* particular group. Register fields are identical to those in SSO_XAQ()_HEAD_PTR above. +* Software must initialize the external linked list(s) by programming +* SSO_XAQ()_HEAD_PTR, SSO_XAQ()_HEAD_NEXT, SSO_XAQ()_TAIL_PTR and +* SSO_XAQ()_TAIL_NEXT to identical values. +*/ +union cvmx_sso_xaqx_tail_ptr { +u64 u64; +struct cvmx_sso_xaqx_tail_ptr_s { +u64 reserved_42_63 :22 ; +u64 ptr :35 ; +u64 reserved_5_6 :2 ; +u64 cl :5 ; + } s; +struct cvmx_sso_xaqx_tail_ptr_s cn73xx; +struct cvmx_sso_xaqx_tail_ptr_s cn78xx; +struct cvmx_sso_xaqx_tail_ptr_s cn78xxp1; +struct cvmx_sso_xaqx_tail_ptr_s cnf75xx; +}; + +typedef union cvmx_sso_xaqx_tail_ptr cvmx_sso_xaqx_tail_ptr_t ; + +/** +* cvmx_sso_xaq_aura +*/ +union cvmx_sso_xaq_aura { +u64 u64; +struct cvmx_sso_xaq_aura_s { +u64 reserved_12_63 :52 ; +u64 node :2 ; +u64 laura :10 ; + } s; +struct cvmx_sso_xaq_aura_s cn73xx; +struct cvmx_sso_xaq_aura_s cn78xx; +struct cvmx_sso_xaq_aura_s cn78xxp1; +struct cvmx_sso_xaq_aura_s cnf75xx; +}; + +typedef union cvmx_sso_xaq_aura cvmx_sso_xaq_aura_t ; + +/** +* cvmx_sso_xaq_latency_pc +*/ +union cvmx_sso_xaq_latency_pc { +u64 u64; +struct cvmx_sso_xaq_latency_pc_s { +u64 count :64 ; + } s; +struct cvmx_sso_xaq_latency_pc_s cn73xx; +struct cvmx_sso_xaq_latency_pc_s cn78xx; +struct cvmx_sso_xaq_latency_pc_s cn78xxp1; +struct cvmx_sso_xaq_latency_pc_s cnf75xx; +}; + +typedef union cvmx_sso_xaq_latency_pc cvmx_sso_xaq_latency_pc_t ; + +/** +* cvmx_sso_xaq_req_pc +*/ +union cvmx_sso_xaq_req_pc { +u64 u64; +struct cvmx_sso_xaq_req_pc_s { +u64 count :64 ; + } s; +struct cvmx_sso_xaq_req_pc_s cn73xx; +struct cvmx_sso_xaq_req_pc_s cn78xx; +struct cvmx_sso_xaq_req_pc_s cn78xxp1; +struct cvmx_sso_xaq_req_pc_s cnf75xx; +}; + +typedef union cvmx_sso_xaq_req_pc cvmx_sso_xaq_req_pc_t ; + +#endif
Signature · 1 line
2.29.2
PATCH 33/50 mips: octeon: Add misc remaining header files
In reply to Stefan RoeseFrom: Aaron Williams <[email protected]>
Import misc remaining header files from 2013 U-Boot. These will be used by the later added drivers to support PCIe and networking on the MIPS Octeon II / III platforms.
---
.../mach-octeon/include/mach/cvmx-address.h | 209 ++ .../mach-octeon/include/mach/cvmx-cmd-queue.h | 441 +++ .../mach-octeon/include/mach/cvmx-csr-enums.h | 87 + arch/mips/mach-octeon/include/mach/cvmx-csr.h | 78 + .../mach-octeon/include/mach/cvmx-error.h | 456 +++ arch/mips/mach-octeon/include/mach/cvmx-fpa.h | 217 ++ .../mips/mach-octeon/include/mach/cvmx-fpa1.h | 196 ++ .../mips/mach-octeon/include/mach/cvmx-fpa3.h | 566 ++++ .../include/mach/cvmx-global-resources.h | 213 ++ arch/mips/mach-octeon/include/mach/cvmx-gmx.h | 16 + .../mach-octeon/include/mach/cvmx-hwfau.h | 606 ++++ .../mach-octeon/include/mach/cvmx-hwpko.h | 570 ++++ arch/mips/mach-octeon/include/mach/cvmx-ilk.h | 154 + arch/mips/mach-octeon/include/mach/cvmx-ipd.h | 233 ++ .../mach-octeon/include/mach/cvmx-packet.h | 40 + .../mips/mach-octeon/include/mach/cvmx-pcie.h | 279 ++ arch/mips/mach-octeon/include/mach/cvmx-pip.h | 1080 ++++++ .../include/mach/cvmx-pki-resources.h | 157 + arch/mips/mach-octeon/include/mach/cvmx-pki.h | 970 ++++++ .../mach/cvmx-pko-internal-ports-range.h | 43 + .../include/mach/cvmx-pko3-queue.h | 175 + arch/mips/mach-octeon/include/mach/cvmx-pow.h | 2991 +++++++++++++++++ arch/mips/mach-octeon/include/mach/cvmx-qlm.h | 304 ++ .../mach-octeon/include/mach/cvmx-scratch.h | 113 + arch/mips/mach-octeon/include/mach/cvmx-wqe.h | 1462 ++++++++ 25 files changed, 11656 insertions(+) create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-address.h create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-cmd-queue.h create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-csr-enums.h create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-csr.h create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-error.h create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-fpa.h create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-fpa1.h create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-fpa3.h create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-global-resources.h create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-gmx.h create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-hwfau.h create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-hwpko.h create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-ilk.h create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-ipd.h create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-packet.h create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-pcie.h create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-pip.h create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-pki-resources.h create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-pki.h create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-pko-internal-ports-range.h create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-pko3-queue.h create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-pow.h create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-qlm.h create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-scratch.h create mode 100644 arch/mips/mach-octeon/include/mach/cvmx-wqe.h
arch/mips/mach-octeon/include/mach/cvmx-address.h new file +209 -0
@@ -0,0 +1,209 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2020 Marvell International Ltd. +* +* Typedefs and defines for working with Octeon physical addresses. +*/ + +#ifndef __CVMX_ADDRESS_H__ +#define __CVMX_ADDRESS_H__ + +typedef enum { +CVMX_MIPS_SPACE_XKSEG =3LL , +CVMX_MIPS_SPACE_XKPHYS =2LL , +CVMX_MIPS_SPACE_XSSEG =1LL , +CVMX_MIPS_SPACE_XUSEG =0LL +}cvmx_mips_space_t ; + +typedef enum { +CVMX_MIPS_XKSEG_SPACE_KSEG0 =0LL , +CVMX_MIPS_XKSEG_SPACE_KSEG1 =1LL , +CVMX_MIPS_XKSEG_SPACE_SSEG =2LL , +CVMX_MIPS_XKSEG_SPACE_KSEG3 =3LL +}cvmx_mips_xkseg_space_t ; + +/* decodes <14:13> of a kseg3 window address */ +typedef enum { +CVMX_ADD_WIN_SCR =0L , +CVMX_ADD_WIN_DMA =1L , +CVMX_ADD_WIN_UNUSED =2L , +CVMX_ADD_WIN_UNUSED2 =3L +}cvmx_add_win_dec_t ; + +/* decode within DMA space */ +typedef enum { +CVMX_ADD_WIN_DMA_ADD =0L , +CVMX_ADD_WIN_DMA_SENDMEM =1L , +/* store data must be normal DRAM memory space address in this case */ +CVMX_ADD_WIN_DMA_SENDDMA =2L , +/* see CVMX_ADD_WIN_DMA_SEND_DEC for data contents */ +CVMX_ADD_WIN_DMA_SENDIO =3L , +/* store data must be normal IO space address in this case */ +CVMX_ADD_WIN_DMA_SENDSINGLE =4L , +/* no write buffer data needed/used */ +}cvmx_add_win_dma_dec_t ; + +/** +* Physical Address Decode +* +* Octeon-I HW never interprets this X (<39:36> reserved +* for future expansion), software should set to 0. +* +* - 0x0 XXX0 0000 0000 to DRAM Cached +* - 0x0 XXX0 0FFF FFFF +* +* - 0x0 XXX0 1000 0000 to Boot Bus Uncached (Converted to 0x1 00X0 1000 0000 +* - 0x0 XXX0 1FFF FFFF + EJTAG to 0x1 00X0 1FFF FFFF) +* +* - 0x0 XXX0 2000 0000 to DRAM Cached +* - 0x0 XXXF FFFF FFFF +* +* - 0x1 00X0 0000 0000 to Boot Bus Uncached +* - 0x1 00XF FFFF FFFF +* +* - 0x1 01X0 0000 0000 to Other NCB Uncached +* - 0x1 FFXF FFFF FFFF devices +* +* Decode of all Octeon addresses +*/ +typedef union { +u64 u64; +struct { +cvmx_mips_space_t R :2 ; +u64 offset :62 ; + } sva; + +struct { +u64 zeroes :33 ; +u64 offset :31 ; + } suseg; + +struct { +u64 ones :33 ; +cvmx_mips_xkseg_space_t sp :2 ; +u64 offset :29 ; + } sxkseg; + +struct { +cvmx_mips_space_t R :2 ; +u64 cca :3 ; +u64 mbz :10 ; +u64 pa :49 ; + } sxkphys; + +struct { +u64 mbz :15 ; +u64 is_io :1 ; +u64 did :8 ; +u64 unaddr :4 ; +u64 offset :36 ; + } sphys; + +struct { +u64 zeroes :24 ; +u64 unaddr :4 ; +u64 offset :36 ; + } smem; + +struct { +u64 mem_region :2 ; +u64 mbz :13 ; +u64 is_io :1 ; +u64 did :8 ; +u64 unaddr :4 ; +u64 offset :36 ; + } sio; + +struct { +u64 ones :49 ; +cvmx_add_win_dec_t csrdec :2 ; +u64 addr :13 ; + } sscr; + +/* there should only be stores to IOBDMA space, no loads */ +struct { +u64 ones :49 ; +cvmx_add_win_dec_t csrdec :2 ; +u64 unused2 :3 ; +cvmx_add_win_dma_dec_t type :3 ; +u64 addr :7 ; + } sdma; + +struct { +u64 didspace :24 ; +u64 unused :40 ; + } sfilldidspace; +}cvmx_addr_t ; + +/* These macros for used by 32 bit applications */ + +#define CVMX_MIPS32_SPACE_KSEG0 1l +#define CVMX_ADD_SEG32 (segment, add) (((s32)segment << 31) | (s32)(add)) + +/* +* Currently all IOs are performed using XKPHYS addressing. Linux uses the +* CvmMemCtl register to enable XKPHYS addressing to IO space from user mode. +* Future OSes may need to change the upper bits of IO addresses. The +* following define controls the upper two bits for all IO addresses generated +* by the simple executive library +*/ +#define CVMX_IO_SEG CVMX_MIPS_SPACE_XKPHYS + +/* These macros simplify the process of creating common IO addresses */ +#define CVMX_ADD_SEG (segment, add) ((((u64)segment) << 62) | (add)) + +#define CVMX_ADD_IO_SEG (add) (add) + +#define CVMX_ADDR_DIDSPACE (did) (((CVMX_IO_SEG) << 22) | ((1ULL) << 8) | (did)) +#define CVMX_ADDR_DID (did) (CVMX_ADDR_DIDSPACE(did) << 40) +#define CVMX_FULL_DID (did, subdid) (((did) << 3) | (subdid)) + +/* from include/ncb_rsl_id.v */ +#define CVMX_OCT_DID_MIS 0ULL/* misc stuff */ +#define CVMX_OCT_DID_GMX0 1ULL +#define CVMX_OCT_DID_GMX1 2ULL +#define CVMX_OCT_DID_PCI 3ULL +#define CVMX_OCT_DID_KEY 4ULL +#define CVMX_OCT_DID_FPA 5ULL +#define CVMX_OCT_DID_DFA 6ULL +#define CVMX_OCT_DID_ZIP 7ULL +#define CVMX_OCT_DID_RNG 8ULL +#define CVMX_OCT_DID_IPD 9ULL +#define CVMX_OCT_DID_PKT 10ULL +#define CVMX_OCT_DID_TIM 11ULL +#define CVMX_OCT_DID_TAG 12ULL +/* the rest are not on the IO bus */ +#define CVMX_OCT_DID_L2C 16ULL +#define CVMX_OCT_DID_LMC 17ULL +#define CVMX_OCT_DID_SPX0 18ULL +#define CVMX_OCT_DID_SPX1 19ULL +#define CVMX_OCT_DID_PIP 20ULL +#define CVMX_OCT_DID_ASX0 22ULL +#define CVMX_OCT_DID_ASX1 23ULL +#define CVMX_OCT_DID_IOB 30ULL + +#define CVMX_OCT_DID_PKT_SEND CVMX_FULL_DID(CVMX_OCT_DID_PKT, 2ULL) +#define CVMX_OCT_DID_TAG_SWTAG CVMX_FULL_DID(CVMX_OCT_DID_TAG, 0ULL) +#define CVMX_OCT_DID_TAG_TAG1 CVMX_FULL_DID(CVMX_OCT_DID_TAG, 1ULL) +#define CVMX_OCT_DID_TAG_TAG2 CVMX_FULL_DID(CVMX_OCT_DID_TAG, 2ULL) +#define CVMX_OCT_DID_TAG_TAG3 CVMX_FULL_DID(CVMX_OCT_DID_TAG, 3ULL) +#define CVMX_OCT_DID_TAG_NULL_RD CVMX_FULL_DID(CVMX_OCT_DID_TAG, 4ULL) +#define CVMX_OCT_DID_TAG_TAG5 CVMX_FULL_DID(CVMX_OCT_DID_TAG, 5ULL) +#define CVMX_OCT_DID_TAG_CSR CVMX_FULL_DID(CVMX_OCT_DID_TAG, 7ULL) +#define CVMX_OCT_DID_FAU_FAI CVMX_FULL_DID(CVMX_OCT_DID_IOB, 0ULL) +#define CVMX_OCT_DID_TIM_CSR CVMX_FULL_DID(CVMX_OCT_DID_TIM, 0ULL) +#define CVMX_OCT_DID_KEY_RW CVMX_FULL_DID(CVMX_OCT_DID_KEY, 0ULL) +#define CVMX_OCT_DID_PCI_6 CVMX_FULL_DID(CVMX_OCT_DID_PCI, 6ULL) +#define CVMX_OCT_DID_MIS_BOO CVMX_FULL_DID(CVMX_OCT_DID_MIS, 0ULL) +#define CVMX_OCT_DID_PCI_RML CVMX_FULL_DID(CVMX_OCT_DID_PCI, 0ULL) +#define CVMX_OCT_DID_IPD_CSR CVMX_FULL_DID(CVMX_OCT_DID_IPD, 7ULL) +#define CVMX_OCT_DID_DFA_CSR CVMX_FULL_DID(CVMX_OCT_DID_DFA, 7ULL) +#define CVMX_OCT_DID_MIS_CSR CVMX_FULL_DID(CVMX_OCT_DID_MIS, 7ULL) +#define CVMX_OCT_DID_ZIP_CSR CVMX_FULL_DID(CVMX_OCT_DID_ZIP, 0ULL) + +/* Cast to unsigned long long, mainly for use in printfs. */ +#define CAST_ULL (v) ((unsigned long long)(v)) + +#define UNMAPPED_PTR (x) ((1ULL << 63) | (x)) + +#endif /* __CVMX_ADDRESS_H__ */
arch/mips/mach-octeon/include/mach/cvmx-cmd-queue.h new file +441 -0
441 lines not on this page · raw message
arch/mips/mach-octeon/include/mach/cvmx-csr-enums.h new file +87 -0
87 lines not on this page · raw message
arch/mips/mach-octeon/include/mach/cvmx-csr.h new file +78 -0
78 lines not on this page · raw message
arch/mips/mach-octeon/include/mach/cvmx-error.h new file +456 -0
456 lines not on this page · raw message
arch/mips/mach-octeon/include/mach/cvmx-fpa.h new file +217 -0
217 lines not on this page · raw message
arch/mips/mach-octeon/include/mach/cvmx-fpa1.h new file +196 -0
196 lines not on this page · raw message
arch/mips/mach-octeon/include/mach/cvmx-fpa3.h new file +566 -0
566 lines not on this page · raw message
arch/mips/mach-octeon/include/mach/cvmx-global-resources.h new file +213 -0
213 lines not on this page · raw message
arch/mips/mach-octeon/include/mach/cvmx-gmx.h new file +16 -0
@@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2020 Marvell International Ltd. +* +* Interface to the GMX hardware. +*/ + +#ifndef __CVMX_GMX_H__ +#define __CVMX_GMX_H__ + +/* CSR typedefs have been moved to cvmx-gmx-defs.h */ + +int cvmx_gmx_set_backpressure_override (u32 interface,u32 port_mask); +int cvmx_agl_set_backpressure_override (u32 interface,u32 port_mask); + +#endif
arch/mips/mach-octeon/include/mach/cvmx-hwfau.h new file +606 -0
521 lines not on this page · raw message
arch/mips/mach-octeon/include/mach/cvmx-hwpko.h new file +570 -0
570 lines not on this page · raw message
arch/mips/mach-octeon/include/mach/cvmx-ilk.h new file +154 -0
154 lines not on this page · raw message
arch/mips/mach-octeon/include/mach/cvmx-ipd.h new file +233 -0
233 lines not on this page · raw message
arch/mips/mach-octeon/include/mach/cvmx-packet.h new file +40 -0
Lines of this file are not shown. View the raw message.
arch/mips/mach-octeon/include/mach/cvmx-pcie.h new file +279 -0
279 lines not on this page · raw message
arch/mips/mach-octeon/include/mach/cvmx-pip.h new file +1080 -0
1,080 lines not on this page · raw message
arch/mips/mach-octeon/include/mach/cvmx-pki-resources.h new file +157 -0
157 lines not on this page · raw message
arch/mips/mach-octeon/include/mach/cvmx-pki.h new file +970 -0
970 lines not on this page · raw message
arch/mips/mach-octeon/include/mach/cvmx-pko-internal-ports-range.h new file +43 -0
43 lines not on this page · raw message
arch/mips/mach-octeon/include/mach/cvmx-pko3-queue.h new file +175 -0
175 lines not on this page · raw message
arch/mips/mach-octeon/include/mach/cvmx-pow.h new file +2991 -0
2,991 lines not on this page · raw message
arch/mips/mach-octeon/include/mach/cvmx-qlm.h new file +304 -0
304 lines not on this page · raw message
arch/mips/mach-octeon/include/mach/cvmx-scratch.h new file +113 -0
113 lines not on this page · raw message
arch/mips/mach-octeon/include/mach/cvmx-wqe.h new file +1462 -0
1,462 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.29.2
Part of the diff is not shown here. View the raw message.
PATCH 34/50 mips: octeon: Misc changes required because of the newly added headers
In reply to Stefan RoeseWith the newly added headers and their restructuring (which macro is defined where), some changes in the already existing Octeon files are necessary. This patch makes the necessary changes.
---
arch/mips/mach-octeon/bootoctlinux.c | 1 + arch/mips/mach-octeon/cvmx-bootmem.c | 6 - arch/mips/mach-octeon/cvmx-coremask.c | 1 + .../mips/mach-octeon/include/mach/cvmx-regs.h | 330 +++++++++++++++++- .../mach-octeon/include/mach/octeon-feature.h | 2 + .../mach-octeon/include/mach/octeon-model.h | 2 + .../mach-octeon/include/mach/octeon_ddr.h | 187 +--------- drivers/ram/octeon/octeon3_lmc.c | 28 +- drivers/ram/octeon/octeon_ddr.c | 22 +- 9 files changed, 343 insertions(+), 236 deletions(-)
arch/mips/mach-octeon/bootoctlinux.c +1 -0
@@ -24,6 +24,7 @@#include <mach/octeon-model.h> #include <mach/octeon-feature.h> #include <mach/bootoct_cmd.h> +#include <mach/cvmx-ciu-defs.h> DECLARE_GLOBAL_DATA_PTR ;
arch/mips/mach-octeon/cvmx-bootmem.c +0 -6
@@ -21,12 +21,6 @@DECLARE_GLOBAL_DATA_PTR ; -#define CVMX_MIPS32_SPACE_KSEG0 1L -#define CVMX_MIPS_SPACE_XKPHYS 2LL - -#define CVMX_ADD_SEG (seg, add) ((((u64)(seg)) << 62) | (add)) -#define CVMX_ADD_SEG32 (seg, add) (((u32)(seg) << 31) | (u32)(add)) -/** * This is the physical location of a struct cvmx_bootmem_desc * structure in Octeon's memory. Note that dues to addressing
arch/mips/mach-octeon/cvmx-coremask.c +1 -0
@@ -14,6 +14,7 @@#include <mach/cvmx-fuse.h> #include <mach/octeon-model.h> #include <mach/octeon-feature.h> +#include <mach/cvmx-ciu-defs.h> struct cvmx_coremask *get_coremask_override (struct cvmx_coremask *pcm) {
arch/mips/mach-octeon/include/mach/cvmx-regs.h +313 -17
414 lines not on this page · raw message
arch/mips/mach-octeon/include/mach/octeon-feature.h +2 -0
@@ -6,6 +6,8 @@#ifndef __OCTEON_FEATURE_H__#define __OCTEON_FEATURE_H__ +#include "cvmx-fuse.h" +/* * Octeon models are declared after the macros in octeon-model.h with the * suffix _FEATURE. The individual features are declared with the
arch/mips/mach-octeon/include/mach/octeon-model.h +2 -0
@@ -28,6 +28,8 @@* use only, and may change without notice. */ +#include <asm/mipsregs.h> +#define OCTEON_FAMILY_MASK 0x00ffff00#define OCTEON_PRID_MASK 0x00ffffff
arch/mips/mach-octeon/include/mach/octeon_ddr.h +2 -185
205 lines not on this page · raw message
drivers/ram/octeon/octeon3_lmc.c +11 -17
@@ -17,14 +17,8 @@/* Random number generator stuff */ -#define CVMX_RNM_CTL_STATUS 0x0001180040000000#define CVMX_OCT_DID_RNG 8ULL -static u64 cvmx_build_io_address (u64 major_did,u64 sub_did) -{ -return ((0x1ull <<48 ) | (major_did <<43 ) | (sub_did <<40 )); -} -static u64 cvmx_rng_get_random64 (void ) {return csr_rd (cvmx_build_io_address (CVMX_OCT_DID_RNG ,0 ));
@@ -285,10 +279,10 @@ static int test_dram_byte64(struct ddr_priv *priv, int lmc, u64 p,int node =0 ;// Force full cacheline write-backs to boost traffic - l2c_ctl.u64 =l2c_rd (priv,CVMX_L2C_CTL ); + l2c_ctl.u64 =l2c_rd (priv,CVMX_L2C_CTL_REL ); saved_dissblkdty = l2c_ctl.cn78xx.dissblkdty; l2c_ctl.cn78xx.dissblkdty =1 ; -l2c_wr (priv,CVMX_L2C_CTL , l2c_ctl.u64); +l2c_wr (priv,CVMX_L2C_CTL_REL , l2c_ctl.u64);if (octeon_is_cpuid (OCTEON_CN73XX ) ||octeon_is_cpuid (OCTEON_CNF75XX )) kbitno =18 ;
@@ -489,9 +483,9 @@ static int test_dram_byte64(struct ddr_priv *priv, int lmc, u64 p, }// Restore original setting that could enable partial cacheline writes - l2c_ctl.u64 =l2c_rd (priv,CVMX_L2C_CTL ); + l2c_ctl.u64 =l2c_rd (priv,CVMX_L2C_CTL_REL ); l2c_ctl.cn78xx.dissblkdty = saved_dissblkdty; -l2c_wr (priv,CVMX_L2C_CTL , l2c_ctl.u64); +l2c_wr (priv,CVMX_L2C_CTL_REL , l2c_ctl.u64);return errors; }
@@ -6315,17 +6309,17 @@ static void lmc_final(struct ddr_priv *priv)lmc_rd (priv,CVMX_LMCX_INT (if_num));for (tad =0 ; tad < num_tads; tad++) { -l2c_wr (priv,CVMX_L2C_TADX_INT (tad), -l2c_rd (priv,CVMX_L2C_TADX_INT (tad))); +l2c_wr (priv,CVMX_L2C_TADX_INT_REL (tad), +l2c_rd (priv,CVMX_L2C_TADX_INT_REL (tad)));debug ("%-45s : (%d) 0x%08llx\n" ,"CVMX_L2C_TAD_INT" , tad, -l2c_rd (priv,CVMX_L2C_TADX_INT (tad))); +l2c_rd (priv,CVMX_L2C_TADX_INT_REL (tad))); }for (mci =0 ; mci < num_mcis; mci++) { -l2c_wr (priv,CVMX_L2C_MCIX_INT (mci), -l2c_rd (priv,CVMX_L2C_MCIX_INT (mci))); +l2c_wr (priv,CVMX_L2C_MCIX_INT_REL (mci), +l2c_rd (priv,CVMX_L2C_MCIX_INT_REL (mci)));debug ("%-45s : (%d) 0x%08llx\n" ,"L2C_MCI_INT" , mci, -l2c_rd (priv,CVMX_L2C_MCIX_INT (mci))); +l2c_rd (priv,CVMX_L2C_MCIX_INT_REL (mci))); } debug("%-45s : 0x%08llx\n", "LMC_INT",
@@ -9827,7 +9821,7 @@ static void cvmx_dram_address_extract_info(struct ddr_priv *priv, u64 address, address -=ADDRESS_HOLE ;/* Determine the LMC controllers */ - l2c_ctl.u64 =l2c_rd (priv,CVMX_L2C_CTL ); + l2c_ctl.u64 =l2c_rd (priv,CVMX_L2C_CTL_REL );/* xbits depends on number of LMCs */ xbits =cvmx_dram_get_num_lmc (priv) >>1 ;// 4->2, 2->1, 1->0
drivers/ram/octeon/octeon_ddr.c +11 -11
@@ -144,7 +144,7 @@ static void cvmx_l2c_set_big_size(struct ddr_priv *priv, u64 mem_size, int mode) big_ctl.u64 =0 ; big_ctl.s.maxdram = bits -9 ; big_ctl.cn61xx.disable = mode; -l2c_wr (priv,CVMX_L2C_BIG_CTL , big_ctl.u64); +l2c_wr (priv,CVMX_L2C_BIG_CTL_REL , big_ctl.u64); } }
@@ -2273,15 +2273,15 @@ static int octeon_ddr_initialize(struct ddr_priv *priv, u32 cpu_hertz,printf ("Disabling L2 ECC based on disable_l2_ecc environment variable\n" );union cvmx_l2c_ctl l2c_val; - l2c_val.u64 =l2c_rd (priv,CVMX_L2C_CTL ); + l2c_val.u64 =l2c_rd (priv,CVMX_L2C_CTL_REL ); l2c_val.s.disecc =1 ; -l2c_wr (priv,CVMX_L2C_CTL , l2c_val.u64); +l2c_wr (priv,CVMX_L2C_CTL_REL , l2c_val.u64); }else {union cvmx_l2c_ctl l2c_val; - l2c_val.u64 =l2c_rd (priv,CVMX_L2C_CTL ); + l2c_val.u64 =l2c_rd (priv,CVMX_L2C_CTL_REL ); l2c_val.s.disecc =0 ; -l2c_wr (priv,CVMX_L2C_CTL , l2c_val.u64); +l2c_wr (priv,CVMX_L2C_CTL_REL , l2c_val.u64); }/*
@@ -2294,17 +2294,17 @@ static int octeon_ddr_initialize(struct ddr_priv *priv, u32 cpu_hertz,puts ("L2 index aliasing disabled.\n" ); - l2c_val.u64 =l2c_rd (priv,CVMX_L2C_CTL ); + l2c_val.u64 =l2c_rd (priv,CVMX_L2C_CTL_REL ); l2c_val.s.disidxalias =1 ; -l2c_wr (priv,CVMX_L2C_CTL , l2c_val.u64); +l2c_wr (priv,CVMX_L2C_CTL_REL , l2c_val.u64); }else {union cvmx_l2c_ctl l2c_val;/* Enable L2C index aliasing */ - l2c_val.u64 =l2c_rd (priv,CVMX_L2C_CTL ); + l2c_val.u64 =l2c_rd (priv,CVMX_L2C_CTL_REL ); l2c_val.s.disidxalias =0 ; -l2c_wr (priv,CVMX_L2C_CTL , l2c_val.u64); +l2c_wr (priv,CVMX_L2C_CTL_REL , l2c_val.u64); }if (OCTEON_IS_OCTEON3 ()) {
@@ -2320,7 +2320,7 @@ static int octeon_ddr_initialize(struct ddr_priv *priv, u32 cpu_hertz,u64 rdf_cnt;char *s; - l2c_ctl.u64 =l2c_rd (priv,CVMX_L2C_CTL ); + l2c_ctl.u64 =l2c_rd (priv,CVMX_L2C_CTL_REL );/* * It is more convenient to compute the ratio using clock
@@ -2337,7 +2337,7 @@ static int octeon_ddr_initialize(struct ddr_priv *priv, u32 cpu_hertz,debug ("%-45s : %d, cpu_hertz:%d, ddr_hertz:%d\n" ,"EARLY FILL COUNT " , l2c_ctl.cn78xx.rdf_cnt, cpu_hertz, ddr_hertz); -l2c_wr (priv,CVMX_L2C_CTL , l2c_ctl.u64); +l2c_wr (priv,CVMX_L2C_CTL_REL , l2c_ctl.u64); }/* Check for lower DIMM socket populated */
Signature · 1 line
2.29.2
PATCH 35/50 mips: octeon: Move cvmx-lmcx-defs.h from mach/cvmx to mach
In reply to Stefan RoeseTo match all other cvmx-* header, this patch moves the already existing cvmx-lmcx-defs.h header one directory up.
---
arch/mips/mach-octeon/include/mach/{cvmx => }/cvmx-lmcx-defs.h | 0
arch/mips/mach-octeon/include/mach/octeon_ddr.h | 2 +-
2 files changed, 1 insertion(+), 1 deletion(-)
rename arch/mips/mach-octeon/include/mach/{cvmx => }/cvmx-lmcx-defs.h (100%)arch/mips/mach-octeon/include/mach/cvmx-lmcx-defs.h renamed from arch/mips/mach-octeon/include/mach/cvmx/cvmx-lmcx-defs.h +0 -0
arch/mips/mach-octeon/include/mach/octeon_ddr.h +1 -1
@@ -11,7 +11,7 @@#include <linux/delay.h> #include <linux/io.h> #include <mach/octeon-model.h> -#include <mach/cvmx/cvmx-lmcx-defs.h> +#include <mach/cvmx-lmcx-defs.h> #include <mach/cvmx-regs.h> #include <mach/cvmx-l2c-defs.h>
Signature · 1 line
2.29.2
PATCH 36/50 mips: octeon: Add cvmx-helper-cfg.c
In reply to Stefan RoeseFrom: Aaron Williams <[email protected]>
Import cvmx-helper-cfg.c from 2013 U-Boot. It will be used by the later added drivers to support PCIe and networking on the MIPS Octeon II / III platforms.
---
arch/mips/mach-octeon/cvmx-helper-cfg.c | 1914 +++++++++++++++++++++++ 1 file changed, 1914 insertions(+) create mode 100644 arch/mips/mach-octeon/cvmx-helper-cfg.c
arch/mips/mach-octeon/cvmx-helper-cfg.c new file +1914 -0
@@ -0,0 +1,1914 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (C) 2020 Marvell International Ltd. +* +* Helper Functions for the Configuration Framework +*/ + +#include <log.h> +#include <linux/delay.h> + +#include <mach/cvmx-regs.h> +#include <mach/cvmx-csr.h> +#include <mach/cvmx-bootmem.h> +#include <mach/octeon-model.h> +#include <mach/cvmx-fuse.h> +#include <mach/octeon-feature.h> +#include <mach/cvmx-qlm.h> +#include <mach/octeon_qlm.h> +#include <mach/cvmx-pcie.h> +#include <mach/cvmx-coremask.h> + +#include <mach/cvmx-agl-defs.h> +#include <mach/cvmx-bgxx-defs.h> +#include <mach/cvmx-gmxx-defs.h> +#include <mach/cvmx-ipd-defs.h> +#include <mach/cvmx-pki-defs.h> + +#include <mach/cvmx-helper.h> +#include <mach/cvmx-helper-board.h> +#include <mach/cvmx-helper-fdt.h> +#include <mach/cvmx-helper-bgx.h> +#include <mach/cvmx-helper-cfg.h> +#include <mach/cvmx-helper-util.h> +#include <mach/cvmx-helper-pki.h> + +#include <mach/cvmx-global-resources.h> +#include <mach/cvmx-pko-internal-ports-range.h> +#include <mach/cvmx-ilk.h> +#include <mach/cvmx-pip.h> + +DECLARE_GLOBAL_DATA_PTR ; + +int cvmx_npi_max_pknds; +static bool port_cfg_data_initialized; + +struct cvmx_cfg_port_param cvmx_cfg_port[CVMX_MAX_NODES ][CVMX_HELPER_MAX_IFACE ] + [CVMX_HELPER_CFG_MAX_PORT_PER_IFACE ]; +/* +* Indexed by the pko_port number +*/ +static int __cvmx_cfg_pko_highest_queue; +struct cvmx_cfg_pko_port_param +cvmx_pko_queue_table[CVMX_HELPER_CFG_MAX_PKO_PORT ] = { + [0 ...CVMX_HELPER_CFG_MAX_PKO_PORT -1 ] = { +CVMX_HELPER_CFG_INVALID_VALUE , +CVMX_HELPER_CFG_INVALID_VALUE + } +}; + +cvmx_user_static_pko_queue_config_t +__cvmx_pko_queue_static_config[CVMX_MAX_NODES ]; + +struct cvmx_cfg_pko_port_map +cvmx_cfg_pko_port_map[CVMX_HELPER_CFG_MAX_PKO_PORT ] = { + [0 ...CVMX_HELPER_CFG_MAX_PKO_PORT -1 ] = { +CVMX_HELPER_CFG_INVALID_VALUE , +CVMX_HELPER_CFG_INVALID_VALUE , +CVMX_HELPER_CFG_INVALID_VALUE + } +}; + +/* +* This array assists translation from ipd_port to pko_port. +* The ``16'' is the rounded value for the 3rd 4-bit value of +* ipd_port, used to differentiate ``interfaces.'' +*/ +static struct cvmx_cfg_pko_port_pair +ipd2pko_port_cache[16 ][CVMX_HELPER_CFG_MAX_PORT_PER_IFACE ] = { + [0 ...15 ] = { + [0 ...CVMX_HELPER_CFG_MAX_PORT_PER_IFACE -1 ] = { +CVMX_HELPER_CFG_INVALID_VALUE , +CVMX_HELPER_CFG_INVALID_VALUE + } + } +}; + +/* +* Options +* +* Each array-elem's initial value is also the option's default value. +*/ +static u64 cvmx_cfg_opts[CVMX_HELPER_CFG_OPT_MAX ] = { + [0 ...CVMX_HELPER_CFG_OPT_MAX -1 ] =1 +}; + +/* +* MISC +*/ + +static int cvmx_cfg_max_pko_engines;/* # of PKO DMA engines allocated */ +static int cvmx_pko_queue_alloc (u64 port,int count); +static void cvmx_init_port_cfg (void ); +static const int dbg; + +int __cvmx_helper_cfg_pknd (int xiface,int index) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); +int pkind; + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); + +/* +* Only 8 PKNDs are assigned to ILK channels. The channels are wrapped +* if more than 8 channels are configured, fix the index accordingly. +*/ +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) { +if (cvmx_helper_interface_get_mode (xiface) == +CVMX_HELPER_INTERFACE_MODE_ILK ) + index %=8 ; + } + + pkind = cvmx_cfg_port[xi.node][xi.interface][index].ccpp_pknd; +return pkind; +} + +int __cvmx_helper_cfg_bpid (int xiface,int index) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); + +/* +* Only 8 BIDs are assigned to ILK channels. The channels are wrapped +* if more than 8 channels are configured, fix the index accordingly. +*/ +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) { +if (cvmx_helper_interface_get_mode (xiface) == +CVMX_HELPER_INTERFACE_MODE_ILK ) + index %=8 ; + } + +return cvmx_cfg_port[xi.node][xi.interface][index].ccpp_bpid; +} + +int __cvmx_helper_cfg_pko_port_base (int xiface,int index) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); + +return cvmx_cfg_port[xi.node][xi.interface][index].ccpp_pko_port_base; +} + +int __cvmx_helper_cfg_pko_port_num (int xiface,int index) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); + +return cvmx_cfg_port[xi.node][xi.interface][index].ccpp_pko_num_ports; +} + +int __cvmx_helper_cfg_pko_queue_num (int pko_port) +{ +return cvmx_pko_queue_table[pko_port].ccppp_num_queues; +} + +int __cvmx_helper_cfg_pko_queue_base (int pko_port) +{ +return cvmx_pko_queue_table[pko_port].ccppp_queue_base; +} + +int __cvmx_helper_cfg_pko_max_queue (void ) +{ +return __cvmx_cfg_pko_highest_queue; +} + +int __cvmx_helper_cfg_pko_max_engine (void ) +{ +return cvmx_cfg_max_pko_engines; +} + +int cvmx_helper_cfg_opt_set (cvmx_helper_cfg_option_t opt,uint64_t val) +{ +if (opt >=CVMX_HELPER_CFG_OPT_MAX ) +return -1 ; + + cvmx_cfg_opts[opt] = val; + +return 0 ; +} + +uint64_t cvmx_helper_cfg_opt_get (cvmx_helper_cfg_option_t opt) +{ +if (opt >=CVMX_HELPER_CFG_OPT_MAX ) +return (uint64_t )CVMX_HELPER_CFG_INVALID_VALUE ; + +return cvmx_cfg_opts[opt]; +} + +/* +* initialize the queue allocation list. the existing static allocation result +* is used as a starting point to ensure backward compatibility. +* +* @return 0 on success +* -1 on failure +*/ +int cvmx_pko_queue_grp_alloc (u64 start,uint64_t end,uint64_t count) +{ +u64 port; +int ret_val; + +for (port = start; port < end; port++) { + ret_val =cvmx_pko_queue_alloc (port, count); +if (ret_val ==-1 ) { +printf ("ERROR: %sL Failed to allocate queue for port=%d count=%d\n" , + __func__, (int )port, (int )count); +return ret_val; + } + } +return 0 ; +} + +int cvmx_pko_queue_init_from_cvmx_config_non_pknd (void ) +{ +int ret_val =-1 ; +u64 count, start, end; + + start =0 ; + end = __cvmx_pko_queue_static_config[0 ].non_pknd.pko_ports_per_interface[0 ]; + count = __cvmx_pko_queue_static_config[0 ].non_pknd.pko_queues_per_port_interface[0 ]; +cvmx_pko_queue_grp_alloc (start, end, count); + + start =16 ; + end = start + __cvmx_pko_queue_static_config[0 ].non_pknd.pko_ports_per_interface[1 ]; + count = __cvmx_pko_queue_static_config[0 ].non_pknd.pko_queues_per_port_interface[1 ]; + ret_val =cvmx_pko_queue_grp_alloc (start, end, count); +if (ret_val !=0 ) +return -1 ; + +if (OCTEON_IS_MODEL (OCTEON_CN70XX )) { +/* Interface 4: AGL, PKO port 24 only, DPI 32-35 */ + start =24 ; + end = start +1 ; + count = __cvmx_pko_queue_static_config[0 ].non_pknd.pko_queues_per_port_interface[4 ]; + ret_val =cvmx_pko_queue_grp_alloc (start, end, count); + +if (ret_val !=0 ) +return -1 ; + end =32 ;/* DPI first PKO poty */ + } + + start = end; + end =36 ; + count = __cvmx_pko_queue_static_config[0 ].non_pknd.pko_queues_per_port_pci; +cvmx_pko_queue_grp_alloc (start, end, count); +if (ret_val !=0 ) +return -1 ; + + start = end; + end =40 ; + count = __cvmx_pko_queue_static_config[0 ].non_pknd.pko_queues_per_port_loop; +cvmx_pko_queue_grp_alloc (start, end, count); +if (ret_val !=0 ) +return -1 ; + + start = end; + end =42 ; + count = __cvmx_pko_queue_static_config[0 ].non_pknd.pko_queues_per_port_srio[0 ]; +cvmx_pko_queue_grp_alloc (start, end, count); +if (ret_val !=0 ) +return -1 ; + + start = end; + end =44 ; + count = __cvmx_pko_queue_static_config[0 ].non_pknd.pko_queues_per_port_srio[1 ]; +cvmx_pko_queue_grp_alloc (start, end, count); +if (ret_val !=0 ) +return -1 ; + + start = end; + end =46 ; + count = __cvmx_pko_queue_static_config[0 ].non_pknd.pko_queues_per_port_srio[2 ]; +cvmx_pko_queue_grp_alloc (start, end, count); +if (ret_val !=0 ) +return -1 ; + + start = end; + end =48 ; + count = __cvmx_pko_queue_static_config[0 ].non_pknd.pko_queues_per_port_srio[3 ]; +cvmx_pko_queue_grp_alloc (start, end, count); +if (ret_val !=0 ) +return -1 ; +return 0 ; +} + +int cvmx_helper_pko_queue_config_get (int node,cvmx_user_static_pko_queue_config_t *cfg) +{ + *cfg = __cvmx_pko_queue_static_config[node]; +return 0 ; +} + +int cvmx_helper_pko_queue_config_set (int node,cvmx_user_static_pko_queue_config_t *cfg) +{ + __cvmx_pko_queue_static_config[node] = *cfg; +return 0 ; +} + +static int queue_range_init; + +int init_cvmx_pko_que_range (void ) +{ +int rv =0 ; + +if (queue_range_init) +return 0 ; + queue_range_init =1 ; + rv =cvmx_create_global_resource_range (CVMX_GR_TAG_PKO_QUEUES , +CVMX_HELPER_CFG_MAX_PKO_QUEUES ); +if (rv !=0 ) +printf ("ERROR: %s: Failed to initialize pko queues range\n" , __func__); + +return rv; +} + +/* +* get a block of "count" queues for "port" +* +* @param port the port for which the queues are requested +* @param count the number of queues requested +* +* @return 0 on success +* -1 on failure +*/ +static int cvmx_pko_queue_alloc (u64 port,int count) +{ +int ret_val =-1 ; +int highest_queue; + +init_cvmx_pko_que_range (); + +if (cvmx_pko_queue_table[port].ccppp_num_queues == count) +return cvmx_pko_queue_table[port].ccppp_queue_base; + +if (cvmx_pko_queue_table[port].ccppp_num_queues >0 ) { +printf ("WARNING: %s port=%d already %d queues\n" , + __func__, (int )port, + (int )cvmx_pko_queue_table[port].ccppp_num_queues); +return -1 ; + } + +if (port >=CVMX_HELPER_CFG_MAX_PKO_QUEUES ) { +printf ("ERROR: %s port=%d > %d\n" , __func__, (int )port, +CVMX_HELPER_CFG_MAX_PKO_QUEUES ); +return -1 ; + } + + ret_val =cvmx_allocate_global_resource_range (CVMX_GR_TAG_PKO_QUEUES , + port, count,1 ); + +debug ("%s: pko_e_port=%i q_base=%i q_count=%i\n" , + __func__, (int )port, ret_val, (int )count); + +if (ret_val ==-1 ) +return ret_val; + cvmx_pko_queue_table[port].ccppp_queue_base = ret_val; + cvmx_pko_queue_table[port].ccppp_num_queues = count; + + highest_queue = ret_val + count -1 ; +if (highest_queue > __cvmx_cfg_pko_highest_queue) + __cvmx_cfg_pko_highest_queue = highest_queue; +return 0 ; +} + +/* +* return the queues for "port" +* +* @param port the port for which the queues are returned +* +* @return 0 on success +* -1 on failure +*/ +int cvmx_pko_queue_free (uint64_t port) +{ +int ret_val =-1 ; + +init_cvmx_pko_que_range (); +if (port >=CVMX_HELPER_CFG_MAX_PKO_QUEUES ) { +debug ("ERROR: %s port=%d > %d" , __func__, (int )port, +CVMX_HELPER_CFG_MAX_PKO_QUEUES ); +return -1 ; + } + + ret_val =cvmx_free_global_resource_range_with_base ( +CVMX_GR_TAG_PKO_QUEUES , cvmx_pko_queue_table[port].ccppp_queue_base, + cvmx_pko_queue_table[port].ccppp_num_queues); +if (ret_val !=0 ) +return ret_val; + + cvmx_pko_queue_table[port].ccppp_num_queues =0 ; + cvmx_pko_queue_table[port].ccppp_queue_base =CVMX_HELPER_CFG_INVALID_VALUE ; + ret_val =0 ; +return ret_val; +} + +void cvmx_pko_queue_free_all (void ) +{ +int i; + +for (i =0 ; i <CVMX_HELPER_CFG_MAX_PKO_PORT ; i++) +if (cvmx_pko_queue_table[i].ccppp_queue_base != +CVMX_HELPER_CFG_INVALID_VALUE ) +cvmx_pko_queue_free (i); +} + +void cvmx_pko_queue_show (void ) +{ +int i; + +cvmx_show_global_resource_range (CVMX_GR_TAG_PKO_QUEUES ); +for (i =0 ; i <CVMX_HELPER_CFG_MAX_PKO_PORT ; i++) +if (cvmx_pko_queue_table[i].ccppp_queue_base != +CVMX_HELPER_CFG_INVALID_VALUE ) +debug ("port=%d que_base=%d que_num=%d\n" , i, + (int )cvmx_pko_queue_table[i].ccppp_queue_base, + (int )cvmx_pko_queue_table[i].ccppp_num_queues); +} + +void cvmx_helper_cfg_show_cfg (void ) +{ +int i, j; + +for (i =0 ; i <cvmx_helper_get_number_of_interfaces (); i++) { +debug ("%s: interface%d mode %10s nports%4d\n" , __func__, i, +cvmx_helper_interface_mode_to_string (cvmx_helper_interface_get_mode (i)), +cvmx_helper_interface_enumerate (i)); + +for (j =0 ; j <cvmx_helper_interface_enumerate (i); j++) { +debug ("\tpknd[%i][%d]%d" , i, j, +__cvmx_helper_cfg_pknd (i, j)); +debug (" pko_port_base[%i][%d]%d" , i, j, +__cvmx_helper_cfg_pko_port_base (i, j)); +debug (" pko_port_num[%i][%d]%d\n" , i, j, +__cvmx_helper_cfg_pko_port_num (i, j)); + } + } + +for (i =0 ; i <CVMX_HELPER_CFG_MAX_PKO_PORT ; i++) { +if (__cvmx_helper_cfg_pko_queue_base (i) != +CVMX_HELPER_CFG_INVALID_VALUE ) { +debug ("%s: pko_port%d qbase%d nqueues%d interface%d index%d\n" , + __func__, i,__cvmx_helper_cfg_pko_queue_base (i), +__cvmx_helper_cfg_pko_queue_num (i), +__cvmx_helper_cfg_pko_port_interface (i), +__cvmx_helper_cfg_pko_port_index (i)); + } + } +} + +/* +* initialize cvmx_cfg_pko_port_map +*/ +void cvmx_helper_cfg_init_pko_port_map (void ) +{ +int i, j, k; +int pko_eid; +int pko_port_base, pko_port_max; +cvmx_helper_interface_mode_t mode; + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); +/* +* one pko_eid is allocated to each port except for ILK, NPI, and +* LOOP. Each of the three has one eid. +*/ + pko_eid =0 ; +for (i =0 ; i <cvmx_helper_get_number_of_interfaces (); i++) { + mode =cvmx_helper_interface_get_mode (i); +for (j =0 ; j <cvmx_helper_interface_enumerate (i); j++) { + pko_port_base = cvmx_cfg_port[0 ][i][j].ccpp_pko_port_base; + pko_port_max = pko_port_base + cvmx_cfg_port[0 ][i][j].ccpp_pko_num_ports; +if (!octeon_has_feature (OCTEON_FEATURE_PKO3 )) { +cvmx_helper_cfg_assert (pko_port_base != +CVMX_HELPER_CFG_INVALID_VALUE ); +cvmx_helper_cfg_assert (pko_port_max >= pko_port_base); + } +for (k = pko_port_base; k < pko_port_max; k++) { + cvmx_cfg_pko_port_map[k].ccppl_interface = i; + cvmx_cfg_pko_port_map[k].ccppl_index = j; + cvmx_cfg_pko_port_map[k].ccppl_eid = pko_eid; + } + +if (!(mode ==CVMX_HELPER_INTERFACE_MODE_NPI || + mode ==CVMX_HELPER_INTERFACE_MODE_LOOP || + mode ==CVMX_HELPER_INTERFACE_MODE_ILK )) + pko_eid++; + } + +if (mode ==CVMX_HELPER_INTERFACE_MODE_NPI || + mode ==CVMX_HELPER_INTERFACE_MODE_LOOP || + mode ==CVMX_HELPER_INTERFACE_MODE_ILK ) + pko_eid++; + } + +/* +* Legal pko_eids [0, 0x13] should not be exhausted. +*/ +if (!octeon_has_feature (OCTEON_FEATURE_PKO3 )) +cvmx_helper_cfg_assert (pko_eid <=0x14 ); + + cvmx_cfg_max_pko_engines = pko_eid; +} + +void cvmx_helper_cfg_set_jabber_and_frame_max (void ) +{ +int interface, port; +/*Set the frame max size and jabber size to 65535. */ +const unsigned int max_frame =65535 ; + +// FIXME: should support node argument for remote node init +if (octeon_has_feature (OCTEON_FEATURE_BGX )) { +int ipd_port; +int node =cvmx_get_node_num (); + +for (interface =0 ; + interface <cvmx_helper_get_number_of_interfaces (); + interface++) { +int xiface =cvmx_helper_node_interface_to_xiface (node, interface); +cvmx_helper_interface_mode_t imode =cvmx_helper_interface_get_mode (xiface); +int num_ports =cvmx_helper_ports_on_interface (xiface); + +// FIXME: should be an easier way to determine +// that an interface is Ethernet/BGX +switch (imode) { +case CVMX_HELPER_INTERFACE_MODE_SGMII : +case CVMX_HELPER_INTERFACE_MODE_XAUI : +case CVMX_HELPER_INTERFACE_MODE_RXAUI : +case CVMX_HELPER_INTERFACE_MODE_XLAUI : +case CVMX_HELPER_INTERFACE_MODE_XFI : +case CVMX_HELPER_INTERFACE_MODE_10G_KR : +case CVMX_HELPER_INTERFACE_MODE_40G_KR4 : +for (port =0 ; port < num_ports; port++) { + ipd_port =cvmx_helper_get_ipd_port (xiface, port); +cvmx_pki_set_max_frm_len (ipd_port, max_frame); +cvmx_helper_bgx_set_jabber (xiface, port, max_frame); + } +break ; +default : +break ; + } + } + }else { +/*Set the frame max size and jabber size to 65535. */ +for (interface =0 ; interface <cvmx_helper_get_number_of_interfaces (); + interface++) { +int xiface =cvmx_helper_node_interface_to_xiface (cvmx_get_node_num (), + interface); +/* +* Set the frame max size and jabber size to 65535, as the defaults +* are too small. +*/ +cvmx_helper_interface_mode_t imode =cvmx_helper_interface_get_mode (xiface); +int num_ports =cvmx_helper_ports_on_interface (xiface); + +switch (imode) { +case CVMX_HELPER_INTERFACE_MODE_SGMII : +case CVMX_HELPER_INTERFACE_MODE_QSGMII : +case CVMX_HELPER_INTERFACE_MODE_XAUI : +case CVMX_HELPER_INTERFACE_MODE_RXAUI : +for (port =0 ; port < num_ports; port++) +csr_wr (CVMX_GMXX_RXX_JABBER (port, interface),65535 ); +/* Set max and min value for frame check */ +cvmx_pip_set_frame_check (interface,-1 ); +break ; + +case CVMX_HELPER_INTERFACE_MODE_RGMII : +case CVMX_HELPER_INTERFACE_MODE_GMII : +/* Set max and min value for frame check */ +cvmx_pip_set_frame_check (interface,-1 ); +for (port =0 ; port < num_ports; port++) { +csr_wr (CVMX_GMXX_RXX_FRM_MAX (port, interface),65535 ); +csr_wr (CVMX_GMXX_RXX_JABBER (port, interface),65535 ); + } +break ; +case CVMX_HELPER_INTERFACE_MODE_ILK : +/* Set max and min value for frame check */ +cvmx_pip_set_frame_check (interface,-1 ); +for (port =0 ; port < num_ports; port++) { +int ipd_port =cvmx_helper_get_ipd_port (interface, port); + +cvmx_ilk_enable_la_header (ipd_port,0 ); + } +break ; +case CVMX_HELPER_INTERFACE_MODE_SRIO : +/* Set max and min value for frame check */ +cvmx_pip_set_frame_check (interface,-1 ); +break ; +case CVMX_HELPER_INTERFACE_MODE_AGL : +/* Set max and min value for frame check */ +cvmx_pip_set_frame_check (interface,-1 ); +csr_wr (CVMX_AGL_GMX_RXX_FRM_MAX (0 ),65535 ); +csr_wr (CVMX_AGL_GMX_RXX_JABBER (0 ),65535 ); +break ; +default : +break ; + } + } + } +} + +/** +* Enable storing short packets only in the WQE +* unless NO_WPTR is set, which already has the same effect +*/ +void cvmx_helper_cfg_store_short_packets_in_wqe (void ) +{ +int interface, port; +cvmx_ipd_ctl_status_t ipd_ctl_status; +unsigned int dyn_rs =1 ; + +if (octeon_has_feature (OCTEON_FEATURE_PKI )) +return ; + +/* NO_WPTR combines WQE with 1st MBUF, RS is redundant */ + ipd_ctl_status.u64 =csr_rd (CVMX_IPD_CTL_STATUS ); +if (ipd_ctl_status.s.no_wptr) { + dyn_rs =0 ; +/* Note: consider also setting 'ignrs' wtn NO_WPTR is set */ + } + +for (interface =0 ; interface <cvmx_helper_get_number_of_interfaces (); interface++) { +int num_ports =cvmx_helper_ports_on_interface (interface); + +for (port =0 ; port < num_ports; port++) { +cvmx_pip_port_cfg_t port_cfg; +int pknd = port; + +if (octeon_has_feature (OCTEON_FEATURE_PKND )) + pknd =cvmx_helper_get_pknd (interface, port); +else + pknd =cvmx_helper_get_ipd_port (interface, port); + port_cfg.u64 =csr_rd (CVMX_PIP_PRT_CFGX (pknd)); + port_cfg.s.dyn_rs = dyn_rs; +csr_wr (CVMX_PIP_PRT_CFGX (pknd), port_cfg.u64); + } + } +} + +int __cvmx_helper_cfg_pko_port_interface (int pko_port) +{ +return cvmx_cfg_pko_port_map[pko_port].ccppl_interface; +} + +int __cvmx_helper_cfg_pko_port_index (int pko_port) +{ +return cvmx_cfg_pko_port_map[pko_port].ccppl_index; +} + +int __cvmx_helper_cfg_pko_port_eid (int pko_port) +{ +return cvmx_cfg_pko_port_map[pko_port].ccppl_eid; +} + +#define IPD2PKO_CACHE_Y (ipd_port) (ipd_port) >> 8 +#define IPD2PKO_CACHE_X (ipd_port) (ipd_port) & 0xff + +static inline int __cvmx_helper_cfg_ipd2pko_cachex (int ipd_port) +{ +int ipd_x =IPD2PKO_CACHE_X (ipd_port); + +if (ipd_port &0x800 ) + ipd_x = (ipd_x >>4 ) &3 ; +return ipd_x; +} + +/* +* ipd_port to pko_port translation cache +*/ +int __cvmx_helper_cfg_init_ipd2pko_cache (void ) +{ +int i, j, n; +int ipd_y, ipd_x, ipd_port; + +for (i =0 ; i <cvmx_helper_get_number_of_interfaces (); i++) { + n =cvmx_helper_interface_enumerate (i); + +for (j =0 ; j < n; j++) { + ipd_port =cvmx_helper_get_ipd_port (i, j); + ipd_y =IPD2PKO_CACHE_Y (ipd_port); + ipd_x =__cvmx_helper_cfg_ipd2pko_cachex (ipd_port); + ipd2pko_port_cache[ipd_y][ipd_x] = (struct cvmx_cfg_pko_port_pair ){ +__cvmx_helper_cfg_pko_port_base (i, j), +__cvmx_helper_cfg_pko_port_num (i, j) + }; + } + } + +return 0 ; +} + +int cvmx_helper_cfg_ipd2pko_port_base (int ipd_port) +{ +int ipd_y, ipd_x; + +/* Internal PKO ports are not present in PKO3 */ +if (octeon_has_feature (OCTEON_FEATURE_PKI )) +return ipd_port; + + ipd_y =IPD2PKO_CACHE_Y (ipd_port); + ipd_x =__cvmx_helper_cfg_ipd2pko_cachex (ipd_port); + +return ipd2pko_port_cache[ipd_y][ipd_x].ccppp_base_port; +} + +int cvmx_helper_cfg_ipd2pko_port_num (int ipd_port) +{ +int ipd_y, ipd_x; + + ipd_y =IPD2PKO_CACHE_Y (ipd_port); + ipd_x =__cvmx_helper_cfg_ipd2pko_cachex (ipd_port); + +return ipd2pko_port_cache[ipd_y][ipd_x].ccppp_nports; +} + +/** +* Return the number of queues to be assigned to this pko_port +* +* @param pko_port +* @return the number of queues for this pko_port +* +*/ +static int cvmx_helper_cfg_dft_nqueues (int pko_port) +{ +cvmx_helper_interface_mode_t mode; +int interface; +int n; +int ret; + + interface =__cvmx_helper_cfg_pko_port_interface (pko_port); + mode =cvmx_helper_interface_get_mode (interface); + + n =NUM_ELEMENTS (__cvmx_pko_queue_static_config[0 ].pknd.pko_cfg_iface); + +if (mode ==CVMX_HELPER_INTERFACE_MODE_LOOP ) { + ret = __cvmx_pko_queue_static_config[0 ].pknd.pko_cfg_loop.queues_per_port; + }else if (mode ==CVMX_HELPER_INTERFACE_MODE_NPI ) { + ret = __cvmx_pko_queue_static_config[0 ].pknd.pko_cfg_npi.queues_per_port; + } + +else if ((interface >=0 ) && (interface < n)) { + ret = __cvmx_pko_queue_static_config[0 ].pknd.pko_cfg_iface[interface].queues_per_port; + }else { +/* Should never be called */ + ret =1 ; + } +/* Override for sanity in case of empty static config table */ +if (ret ==0 ) + ret =1 ; +return ret; +} + +static int cvmx_helper_cfg_init_pko_iports_and_queues_using_static_config (void ) +{ +int pko_port_base =0 ; +int cvmx_cfg_default_pko_nports =1 ; +int i, j, n, k; +int rv =0 ; + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); + +/* When not using config file, each port is assigned one internal pko port*/ +for (i =0 ; i <cvmx_helper_get_number_of_interfaces (); i++) { + n =cvmx_helper_interface_enumerate (i); +for (j =0 ; j < n; j++) { + cvmx_cfg_port[0 ][i][j].ccpp_pko_port_base = pko_port_base; + cvmx_cfg_port[0 ][i][j].ccpp_pko_num_ports = cvmx_cfg_default_pko_nports; +/* +* Initialize interface early here so that the +* cvmx_helper_cfg_dft_nqueues() below +* can get the interface number corresponding to the +* pko port +*/ +for (k = pko_port_base; k < pko_port_base + cvmx_cfg_default_pko_nports; + k++) { + cvmx_cfg_pko_port_map[k].ccppl_interface = i; + } + pko_port_base += cvmx_cfg_default_pko_nports; + } + } +cvmx_helper_cfg_assert (pko_port_base <=CVMX_HELPER_CFG_MAX_PKO_PORT ); + +/* Assigning queues per pko */ +for (i =0 ; i < pko_port_base; i++) { +int base; + + n =cvmx_helper_cfg_dft_nqueues (i); + base =cvmx_pko_queue_alloc (i, n); +if (base ==-1 ) { +printf ("ERROR: %s: failed to alloc %d queues for pko port=%d\n" , __func__, + n, i); + rv =-1 ; + } + } +return rv; +} + +/** +* Returns if port is valid for a given interface +* +* @param xiface interface to check +* @param index port index in the interface +* +* @return status of the port present or not. +*/ +int cvmx_helper_is_port_valid (int xiface,int index) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); +return cvmx_cfg_port[xi.node][xi.interface][index].valid; +} + +void cvmx_helper_set_port_valid (int xiface,int index,bool valid) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); + cvmx_cfg_port[xi.node][xi.interface][index].valid = valid; +} + +void cvmx_helper_set_mac_phy_mode (int xiface,int index,bool valid) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); + cvmx_cfg_port[xi.node][xi.interface][index].sgmii_phy_mode = valid; +} + +bool cvmx_helper_get_mac_phy_mode (int xiface,int index) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); +return cvmx_cfg_port[xi.node][xi.interface][index].sgmii_phy_mode; +} + +void cvmx_helper_set_1000x_mode (int xiface,int index,bool valid) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); + cvmx_cfg_port[xi.node][xi.interface][index].sgmii_1000x_mode = valid; +} + +bool cvmx_helper_get_1000x_mode (int xiface,int index) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); +return cvmx_cfg_port[xi.node][xi.interface][index].sgmii_1000x_mode; +} + +void cvmx_helper_set_agl_rx_clock_delay_bypass (int xiface,int index,bool valid) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); + cvmx_cfg_port[xi.node][xi.interface][index].agl_rx_clk_delay_bypass = valid; +} + +bool cvmx_helper_get_agl_rx_clock_delay_bypass (int xiface,int index) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); +return cvmx_cfg_port[xi.node][xi.interface][index].agl_rx_clk_delay_bypass; +} + +void cvmx_helper_set_agl_rx_clock_skew (int xiface,int index,uint8_t value) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); + cvmx_cfg_port[xi.node][xi.interface][index].agl_rx_clk_skew = value; +} + +uint8_t cvmx_helper_get_agl_rx_clock_skew (int xiface,int index) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); +return cvmx_cfg_port[xi.node][xi.interface][index].agl_rx_clk_skew; +} + +void cvmx_helper_set_agl_refclk_sel (int xiface,int index,uint8_t value) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); + cvmx_cfg_port[xi.node][xi.interface][index].agl_refclk_sel = value; +} + +uint8_t cvmx_helper_get_agl_refclk_sel (int xiface,int index) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); +return cvmx_cfg_port[xi.node][xi.interface][index].agl_refclk_sel; +} + +void cvmx_helper_set_port_force_link_up (int xiface,int index,bool value) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); + cvmx_cfg_port[xi.node][xi.interface][index].force_link_up = value; +} + +bool cvmx_helper_get_port_force_link_up (int xiface,int index) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); +return cvmx_cfg_port[xi.node][xi.interface][index].force_link_up; +} + +void cvmx_helper_set_port_phy_present (int xiface,int index,bool value) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); + cvmx_cfg_port[xi.node][xi.interface][index].phy_present = value; +} + +bool cvmx_helper_get_port_phy_present (int xiface,int index) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); +return cvmx_cfg_port[xi.node][xi.interface][index].phy_present; +} + +int __cvmx_helper_init_port_valid (void ) +{ +int i, j, node; +bool valid; +static void *fdt_addr; +int rc; +struct cvmx_coremask pcm; + +octeon_get_available_coremask (&pcm); + +if (fdt_addr ==0 ) + fdt_addr =__cvmx_phys_addr_to_ptr ((u64 )gd->fdt_blob,128 *1024 ); + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); +if (octeon_has_feature (OCTEON_FEATURE_BGX )) { + rc =__cvmx_helper_parse_bgx_dt (fdt_addr); +if (!rc) + rc =__cvmx_fdt_parse_vsc7224 (fdt_addr); +if (!rc) + rc =__cvmx_fdt_parse_avsp5410 (fdt_addr); +if (!rc &&octeon_has_feature (OCTEON_FEATURE_BGX_XCV )) + rc =__cvmx_helper_parse_bgx_rgmii_dt (fdt_addr); + +/* Some ports are not in sequence, the device tree does not +* clear them. +* +* Also clear any ports that are not defined in the device tree. +* Apply this to each node. +*/ +for (node =0 ; node <CVMX_MAX_NODES ; node++) { +if (!cvmx_coremask_get64_node (&pcm, node)) +continue ; +for (i =0 ; i <CVMX_HELPER_MAX_GMX ; i++) { +int j; +int xiface =cvmx_helper_node_interface_to_xiface (node, i); + +for (j =0 ; j <cvmx_helper_interface_enumerate (i); j++) { +cvmx_bgxx_cmrx_config_t cmr_config; + + cmr_config.u64 = +csr_rd_node (node,CVMX_BGXX_CMRX_CONFIG (j, i)); +if ((cmr_config.s.lane_to_sds ==0xe4 && + cmr_config.s.lmac_type !=4 && + cmr_config.s.lmac_type !=1 && + cmr_config.s.lmac_type !=5 ) || + ((cvmx_helper_get_port_fdt_node_offset (xiface, j) == +CVMX_HELPER_CFG_INVALID_VALUE ))) +cvmx_helper_set_port_valid (xiface, j, false); + } + } + } +return rc; + } + +/* TODO: Update this to behave more like 78XX */ +for (i =0 ; i <cvmx_helper_get_number_of_interfaces (); i++) { +int n =cvmx_helper_interface_enumerate (i); + +for (j =0 ; j < n; j++) { +int ipd_port =cvmx_helper_get_ipd_port (i, j); + + valid = (__cvmx_helper_board_get_port_from_dt (fdt_addr, ipd_port) ==1 ); +cvmx_helper_set_port_valid (i, j, valid); + } + } +return 0 ; +} + +typedef int (*cvmx_import_config_t )(void ); +cvmx_import_config_t cvmx_import_app_config; + +int __cvmx_helper_init_port_config_data_local (void ) +{ +int rv =0 ; +int dbg =0 ; + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); + +if (octeon_has_feature (OCTEON_FEATURE_PKND )) { +if (cvmx_import_app_config) { + rv = (*cvmx_import_app_config)(); +if (rv !=0 ) { +debug ("failed to import config\n" ); +return -1 ; + } + } + +cvmx_helper_cfg_init_pko_port_map (); +__cvmx_helper_cfg_init_ipd2pko_cache (); + }else { +if (cvmx_import_app_config) { + rv = (*cvmx_import_app_config)(); +if (rv !=0 ) { +debug ("failed to import config\n" ); +return -1 ; + } + } + } +if (dbg) { +cvmx_helper_cfg_show_cfg (); +cvmx_pko_queue_show (); + } +return rv; +} + +/* +* This call is made from Linux octeon_ethernet driver +* to setup the PKO with a specific queue count and +* internal port count configuration. +*/ +int cvmx_pko_alloc_iport_and_queues (int interface,int port,int port_cnt,int queue_cnt) +{ +int rv, p, port_start, cnt; + +if (dbg) +debug ("%s: intf %d/%d pcnt %d qcnt %d\n" , __func__, interface, port, port_cnt, + queue_cnt); + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); +if (octeon_has_feature (OCTEON_FEATURE_PKND )) { + rv =cvmx_pko_internal_ports_alloc (interface, port, port_cnt); +if (rv <0 ) { +printf ("ERROR: %s: failed to allocate internal ports forinterface=%d port=%d cnt=%d\n" , + __func__, interface, port, port_cnt); +return -1 ; + } + port_start =__cvmx_helper_cfg_pko_port_base (interface, port); + cnt =__cvmx_helper_cfg_pko_port_num (interface, port); + }else { + port_start =cvmx_helper_get_ipd_port (interface, port); + cnt =1 ; + } + +for (p = port_start; p < port_start + cnt; p++) { + rv =cvmx_pko_queue_alloc (p, queue_cnt); +if (rv <0 ) { +printf ("ERROR: %s: failed to allocate queues for port=%d cnt=%d\n" , + __func__, p, queue_cnt); +return -1 ; + } + } +return 0 ; +} + +static void cvmx_init_port_cfg (void ) +{ +int node, i, j; + +if (port_cfg_data_initialized) +return ; + +for (node =0 ; node <CVMX_MAX_NODES ; node++) { +for (i =0 ; i <CVMX_HELPER_MAX_IFACE ; i++) { +for (j =0 ; j <CVMX_HELPER_CFG_MAX_PORT_PER_IFACE ; j++) { +struct cvmx_cfg_port_param *pcfg; +struct cvmx_srio_port_param *sr; + + pcfg = &cvmx_cfg_port[node][i][j]; +memset (pcfg,0 ,sizeof (*pcfg)); + + pcfg->port_fdt_node =CVMX_HELPER_CFG_INVALID_VALUE ; + pcfg->phy_fdt_node =CVMX_HELPER_CFG_INVALID_VALUE ; + pcfg->phy_info =NULL ; + pcfg->ccpp_pknd =CVMX_HELPER_CFG_INVALID_VALUE ; + pcfg->ccpp_bpid =CVMX_HELPER_CFG_INVALID_VALUE ; + pcfg->ccpp_pko_port_base =CVMX_HELPER_CFG_INVALID_VALUE ; + pcfg->ccpp_pko_num_ports =CVMX_HELPER_CFG_INVALID_VALUE ; + pcfg->agl_rx_clk_skew =0 ; + pcfg->valid = true; + pcfg->sgmii_phy_mode = false; + pcfg->sgmii_1000x_mode = false; + pcfg->agl_rx_clk_delay_bypass = false; + pcfg->force_link_up = false; + pcfg->disable_an = false; + pcfg->link_down_pwr_dn = false; + pcfg->phy_present = false; + pcfg->tx_clk_delay_bypass = false; + pcfg->rgmii_tx_clk_delay =0 ; + pcfg->enable_fec = false; + sr = &pcfg->srio_short; + sr->srio_rx_ctle_agc_override = false; + sr->srio_rx_ctle_zero =0x6 ; + sr->srio_rx_agc_pre_ctle =0x5 ; + sr->srio_rx_agc_post_ctle =0x4 ; + sr->srio_tx_swing_override = false; + sr->srio_tx_swing =0x7 ; + sr->srio_tx_premptap_override = false; + sr->srio_tx_premptap_pre =0 ; + sr->srio_tx_premptap_post =0xF ; + sr->srio_tx_gain_override = false; + sr->srio_tx_gain =0x3 ; + sr->srio_tx_vboost_override =0 ; + sr->srio_tx_vboost = true; + sr = &pcfg->srio_long; + sr->srio_rx_ctle_agc_override = false; + sr->srio_rx_ctle_zero =0x6 ; + sr->srio_rx_agc_pre_ctle =0x5 ; + sr->srio_rx_agc_post_ctle =0x4 ; + sr->srio_tx_swing_override = false; + sr->srio_tx_swing =0x7 ; + sr->srio_tx_premptap_override = false; + sr->srio_tx_premptap_pre =0 ; + sr->srio_tx_premptap_post =0xF ; + sr->srio_tx_gain_override = false; + sr->srio_tx_gain =0x3 ; + sr->srio_tx_vboost_override =0 ; + sr->srio_tx_vboost = true; + pcfg->agl_refclk_sel =0 ; + pcfg->sfp_of_offset =-1 ; + pcfg->vsc7224_chan =NULL ; + } + } + } + port_cfg_data_initialized = true; +} + +int __cvmx_helper_init_port_config_data (int node) +{ +int rv =0 ; +int i, j, n; +int num_interfaces, interface; +int pknd =0 , bpid =0 ; +const int use_static_config =1 ; + +if (dbg) +printf ("%s:\n" , __func__); + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); + +if (octeon_has_feature (OCTEON_FEATURE_CN78XX_WQE )) { +/* PKO3: only needs BPID, PKND to be setup, +* while the rest of PKO3 init is done in cvmx-helper-pko3.c +*/ + pknd =0 ; + bpid =0 ; +for (i =0 ; i <cvmx_helper_get_number_of_interfaces (); i++) { +int xiface =cvmx_helper_node_interface_to_xiface (node, i); + + n =cvmx_helper_interface_enumerate (xiface); +/* +* Assign 8 pknds to ILK interface, these pknds will be +* distributed among the channels configured +*/ +if (cvmx_helper_interface_get_mode (xiface) == +CVMX_HELPER_INTERFACE_MODE_ILK ) { +if (n >8 ) + n =8 ; + } +if (cvmx_helper_interface_get_mode (xiface) != +CVMX_HELPER_INTERFACE_MODE_NPI ) { +for (j =0 ; j < n; j++) { +struct cvmx_cfg_port_param *pcfg; + + pcfg = &cvmx_cfg_port[node][i][j]; + pcfg->ccpp_pknd = pknd++; + pcfg->ccpp_bpid = bpid++; + } + }else { +for (j =0 ; j < n; j++) { +if (j == n / cvmx_npi_max_pknds) { + pknd++; + bpid++; + } + cvmx_cfg_port[node][i][j].ccpp_pknd = pknd; + cvmx_cfg_port[node][i][j].ccpp_bpid = bpid; + } + pknd++; + bpid++; + } + }/* for i=0 */ +cvmx_helper_cfg_assert (pknd <=CVMX_HELPER_CFG_MAX_PIP_PKND ); +cvmx_helper_cfg_assert (bpid <=CVMX_HELPER_CFG_MAX_PIP_BPID ); + }else if (octeon_has_feature (OCTEON_FEATURE_PKND )) { +if (use_static_config) +cvmx_helper_cfg_init_pko_iports_and_queues_using_static_config (); + +/* Initialize pknd and bpid */ +for (i =0 ; i <cvmx_helper_get_number_of_interfaces (); i++) { + n =cvmx_helper_interface_enumerate (i); +for (j =0 ; j < n; j++) { + cvmx_cfg_port[0 ][i][j].ccpp_pknd = pknd++; + cvmx_cfg_port[0 ][i][j].ccpp_bpid = bpid++; + } + } +cvmx_helper_cfg_assert (pknd <=CVMX_HELPER_CFG_MAX_PIP_PKND ); +cvmx_helper_cfg_assert (bpid <=CVMX_HELPER_CFG_MAX_PIP_BPID ); + }else { +if (use_static_config) +cvmx_pko_queue_init_from_cvmx_config_non_pknd (); + } + +/* Remainder not used for PKO3 */ +if (octeon_has_feature (OCTEON_FEATURE_CN78XX_WQE )) +return 0 ; + +/* init ports, queues which are not initialized */ + num_interfaces =cvmx_helper_get_number_of_interfaces (); +for (interface =0 ; interface < num_interfaces; interface++) { +int num_ports =__cvmx_helper_early_ports_on_interface (interface); +int port, port_base, queue; + +for (port =0 ; port < num_ports; port++) { +bool init_req = false; + +if (octeon_has_feature (OCTEON_FEATURE_PKND )) { + port_base =__cvmx_helper_cfg_pko_port_base (interface, port); +if (port_base ==CVMX_HELPER_CFG_INVALID_VALUE ) + init_req = true; + }else { + port_base =cvmx_helper_get_ipd_port (interface, port); + queue =__cvmx_helper_cfg_pko_queue_base (port_base); +if (queue ==CVMX_HELPER_CFG_INVALID_VALUE ) + init_req = true; + } + +if (init_req) { + rv =cvmx_pko_alloc_iport_and_queues (interface, port,1 ,1 ); +if (rv <0 ) { +debug ("cvm_pko_alloc_iport_and_queues failed.\n" ); +return rv; + } + } + } + } + +if (octeon_has_feature (OCTEON_FEATURE_PKND )) { +cvmx_helper_cfg_init_pko_port_map (); +__cvmx_helper_cfg_init_ipd2pko_cache (); + } + +if (dbg) { +cvmx_helper_cfg_show_cfg (); +cvmx_pko_queue_show (); + } +return rv; +} + +/** +* @INTERNAL +* Store the FDT node offset in the device tree of a port +* +* @param xiface node and interface +* @param index port index +* @param node_offset node offset to store +*/ +void cvmx_helper_set_port_fdt_node_offset (int xiface,int index,int node_offset) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); + cvmx_cfg_port[xi.node][xi.interface][index].port_fdt_node = node_offset; +} + +/** +* @INTERNAL +* Return the FDT node offset in the device tree of a port +* +* @param xiface node and interface +* @param index port index +* @return node offset of port or -1 if invalid +*/ +int cvmx_helper_get_port_fdt_node_offset (int xiface,int index) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); +return cvmx_cfg_port[xi.node][xi.interface][index].port_fdt_node; +} + +/** +* Search for a port based on its FDT node offset +* +* @param of_offset Node offset of port to search for +* @param[out] xiface xinterface of match +* @param[out] index port index of match +* +* @return 0 if found, -1 if not found +*/ +int cvmx_helper_cfg_get_xiface_index_by_fdt_node_offset (int of_offset,int *xiface,int *index) +{ +int iface; +int i; +int node; +struct cvmx_cfg_port_param *pcfg =NULL ; + *xiface =-1 ; + *index =-1 ; + +for (node =0 ; node <CVMX_MAX_NODES ; node++) { +for (iface =0 ; iface <CVMX_HELPER_MAX_IFACE ; iface++) { +for (i =0 ; i <CVMX_HELPER_CFG_MAX_PORT_PER_IFACE ; i++) { + pcfg = &cvmx_cfg_port[node][iface][i]; +if (pcfg->valid && pcfg->port_fdt_node == of_offset) { + *xiface =cvmx_helper_node_interface_to_xiface (node, iface); + *index = i; +return 0 ; + } + } + } + } +return -1 ; +} + +/** +* @INTERNAL +* Store the FDT node offset in the device tree of a phy +* +* @param xiface node and interface +* @param index port index +* @param node_offset node offset to store +*/ +void cvmx_helper_set_phy_fdt_node_offset (int xiface,int index,int node_offset) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); + cvmx_cfg_port[xi.node][xi.interface][index].phy_fdt_node = node_offset; +} + +/** +* @INTERNAL +* Return the FDT node offset in the device tree of a phy +* +* @param xiface node and interface +* @param index port index +* @return node offset of phy or -1 if invalid +*/ +int cvmx_helper_get_phy_fdt_node_offset (int xiface,int index) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); +return cvmx_cfg_port[xi.node][xi.interface][index].phy_fdt_node; +} + +/** +* @INTERNAL +* Override default autonegotiation for a port +* +* @param xiface node and interface +* @param index port index +* @param enable true to enable autonegotiation, false to force full +* duplex, full speed. +*/ +void cvmx_helper_set_port_autonegotiation (int xiface,int index,bool enable) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); + cvmx_cfg_port[xi.node][xi.interface][index].disable_an = !enable; +} + +/** +* @INTERNAL +* Returns if autonegotiation is enabled or not. +* +* @param xiface node and interface +* @param index port index +* +* @return 0 if autonegotiation is disabled, 1 if enabled. +*/ +bool cvmx_helper_get_port_autonegotiation (int xiface,int index) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); +return !cvmx_cfg_port[xi.node][xi.interface][index].disable_an; +} + +/** +* @INTERNAL +* Override default forward error correction for a port +* +* @param xiface node and interface +* @param index port index +* @param enable true to enable fec, false to disable it +*/ +void cvmx_helper_set_port_fec (int xiface,int index,bool enable) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); + cvmx_cfg_port[xi.node][xi.interface][index].enable_fec = enable; +} + +/** +* @INTERNAL +* Returns if forward error correction is enabled or not. +* +* @param xiface node and interface +* @param index port index +* +* @return false if fec is disabled, true if enabled. +*/ +bool cvmx_helper_get_port_fec (int xiface,int index) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); +return cvmx_cfg_port[xi.node][xi.interface][index].enable_fec; +} + +/** +* @INTERNAL +* Configure the SRIO RX interface AGC settings for host mode +* +* @param xiface node and interface +* @param index lane +* @param long_run true for long run, false for short run +* @param agc_override true to put AGC in manual mode +* @param ctle_zero RX equalizer peaking control (default 0x6) +* @param agc_pre_ctle AGC pre-CTLE gain (default 0x5) +* @param agc_post_ctle AGC post-CTLE gain (default 0x4) +* +* NOTE: This must be called before SRIO is initialized to take effect +*/ +void cvmx_helper_set_srio_rx (int xiface,int index,bool long_run,bool ctle_zero_override, +u8 ctle_zero,bool agc_override,uint8_t agc_pre_ctle, +uint8_t agc_post_ctle) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); +struct cvmx_cfg_port_param *pcfg = &cvmx_cfg_port[xi.node][xi.interface][index]; +struct cvmx_srio_port_param *sr = long_run ? &pcfg->srio_long : &pcfg->srio_short; + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); + sr->srio_rx_ctle_zero_override = ctle_zero_override; + sr->srio_rx_ctle_zero = ctle_zero; + sr->srio_rx_ctle_agc_override = agc_override; + sr->srio_rx_agc_pre_ctle = agc_pre_ctle; + sr->srio_rx_agc_post_ctle = agc_post_ctle; +} + +/** +* @INTERNAL +* Get the SRIO RX interface AGC settings for host mode +* +* @param xiface node and interface +* @param index lane +* @param long_run true for long run, false for short run +* @param[out] agc_override true to put AGC in manual mode +* @param[out] ctle_zero RX equalizer peaking control (default 0x6) +* @param[out] agc_pre_ctle AGC pre-CTLE gain (default 0x5) +* @param[out] agc_post_ctle AGC post-CTLE gain (default 0x4) +*/ +void cvmx_helper_get_srio_rx (int xiface,int index,bool long_run,bool *ctle_zero_override, +u8 *ctle_zero,bool *agc_override,uint8_t *agc_pre_ctle, +uint8_t *agc_post_ctle) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); +struct cvmx_cfg_port_param *pcfg = &cvmx_cfg_port[xi.node][xi.interface][index]; +struct cvmx_srio_port_param *sr = long_run ? &pcfg->srio_long : &pcfg->srio_short; + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); +if (ctle_zero_override) + *ctle_zero_override = sr->srio_rx_ctle_zero_override; +if (ctle_zero) + *ctle_zero = sr->srio_rx_ctle_zero; +if (agc_override) + *agc_override = sr->srio_rx_ctle_agc_override; +if (agc_pre_ctle) + *agc_pre_ctle = sr->srio_rx_agc_pre_ctle; +if (agc_post_ctle) + *agc_post_ctle = sr->srio_rx_agc_post_ctle; +} + +/** +* @INTERNAL +* Configure the SRIO TX interface for host mode +* +* @param xiface node and interface +* @param index lane +* @param long_run true for long run, false for short run +* @param tx_swing tx swing value to use (default 0x7), -1 to not +* override. +* @param tx_gain PCS SDS TX gain (default 0x3), -1 to not +* override +* @param tx_premptap_override true to override preemphasis control +* @param tx_premptap_pre preemphasis pre tap value (default 0x0) +* @param tx_premptap_post preemphasis post tap value (default 0xF) +* @param tx_vboost vboost enable (1 = enable, -1 = don't override) +* hardware default is 1. +* +* NOTE: This must be called before SRIO is initialized to take effect +*/ +void cvmx_helper_set_srio_tx (int xiface,int index,bool long_run,int tx_swing,int tx_gain, +bool tx_premptap_override,uint8_t tx_premptap_pre, +u8 tx_premptap_post,int tx_vboost) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); +struct cvmx_cfg_port_param *pcfg = &cvmx_cfg_port[xi.node][xi.interface][index]; +struct cvmx_srio_port_param *sr = long_run ? &pcfg->srio_long : &pcfg->srio_short; + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); + + sr->srio_tx_swing_override = (tx_swing !=-1 ); + sr->srio_tx_swing = tx_swing !=-1 ? tx_swing :0x7 ; + sr->srio_tx_gain_override = (tx_gain !=-1 ); + sr->srio_tx_gain = tx_gain !=-1 ? tx_gain :0x3 ; + sr->srio_tx_premptap_override = tx_premptap_override; + sr->srio_tx_premptap_pre = tx_premptap_override ? tx_premptap_pre :0 ; + sr->srio_tx_premptap_post = tx_premptap_override ? tx_premptap_post :0xF ; + sr->srio_tx_vboost_override = tx_vboost !=-1 ; + sr->srio_tx_vboost = (tx_vboost !=-1 ) ? tx_vboost :1 ; +} + +/** +* @INTERNAL +* Get the SRIO TX interface settings for host mode +* +* @param xiface node and interface +* @param index lane +* @param long_run true for long run, false for short run +* @param[out] tx_swing_override true to override pcs_sds_txX_swing +* @param[out] tx_swing tx swing value to use (default 0x7) +* @param[out] tx_gain_override true to override default gain +* @param[out] tx_gain PCS SDS TX gain (default 0x3) +* @param[out] tx_premptap_override true to override preemphasis control +* @param[out] tx_premptap_pre preemphasis pre tap value (default 0x0) +* @param[out] tx_premptap_post preemphasis post tap value (default 0xF) +* @param[out] tx_vboost_override override vboost setting +* @param[out] tx_vboost vboost enable (default true) +*/ +void cvmx_helper_get_srio_tx (int xiface,int index,bool long_run,bool *tx_swing_override, +u8 *tx_swing,bool *tx_gain_override,uint8_t *tx_gain, +bool *tx_premptap_override,uint8_t *tx_premptap_pre, +u8 *tx_premptap_post,bool *tx_vboost_override,bool *tx_vboost) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); +struct cvmx_cfg_port_param *pcfg = &cvmx_cfg_port[xi.node][xi.interface][index]; +struct cvmx_srio_port_param *sr = long_run ? &pcfg->srio_long : &pcfg->srio_short; + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); + +if (tx_swing_override) + *tx_swing_override = sr->srio_tx_swing_override; +if (tx_swing) + *tx_swing = sr->srio_tx_swing; +if (tx_gain_override) + *tx_gain_override = sr->srio_tx_gain_override; +if (tx_gain) + *tx_gain = sr->srio_tx_gain; +if (tx_premptap_override) + *tx_premptap_override = sr->srio_tx_premptap_override; +if (tx_premptap_pre) + *tx_premptap_pre = sr->srio_tx_premptap_pre; +if (tx_premptap_post) + *tx_premptap_post = sr->srio_tx_premptap_post; +if (tx_vboost_override) + *tx_vboost_override = sr->srio_tx_vboost_override; +if (tx_vboost) + *tx_vboost = sr->srio_tx_vboost; +} + +/** +* @INTERNAL +* Sets the PHY info data structure +* +* @param xiface node and interface +* @param index port index +* @param[in] phy_info phy information data structure pointer +*/ +void cvmx_helper_set_port_phy_info (int xiface,int index,struct cvmx_phy_info *phy_info) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); + cvmx_cfg_port[xi.node][xi.interface][index].phy_info = phy_info; +} + +/** +* @INTERNAL +* Returns the PHY information data structure for a port +* +* @param xiface node and interface +* @param index port index +* +* @return pointer to PHY information data structure or NULL if not set +*/ +struct cvmx_phy_info *cvmx_helper_get_port_phy_info (int xiface,int index) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); +return cvmx_cfg_port[xi.node][xi.interface][index].phy_info; +} + +/** +* @INTERNAL +* Returns a pointer to the PHY LED configuration (if local GPIOs drive them) +* +* @param xiface node and interface +* @param index portindex +* +* @return pointer to the PHY LED information data structure or NULL if not +* present +*/ +struct cvmx_phy_gpio_leds *cvmx_helper_get_port_phy_leds (int xiface,int index) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); +return cvmx_cfg_port[xi.node][xi.interface][index].gpio_leds; +} + +/** +* @INTERNAL +* Sets a pointer to the PHY LED configuration (if local GPIOs drive them) +* +* @param xiface node and interface +* @param index portindex +* @param leds pointer to led data structure +*/ +void cvmx_helper_set_port_phy_leds (int xiface,int index,struct cvmx_phy_gpio_leds *leds) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); + cvmx_cfg_port[xi.node][xi.interface][index].gpio_leds = leds; +} + +/** +* @INTERNAL +* Disables RGMII TX clock bypass and sets delay value +* +* @param xiface node and interface +* @param index portindex +* @param bypass Set true to enable the clock bypass and false +* to sync clock and data synchronously. +* Default is false. +* @param clk_delay Delay value to skew TXC from TXD +*/ +void cvmx_helper_cfg_set_rgmii_tx_clk_delay (int xiface,int index,bool bypass,int clk_delay) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); + cvmx_cfg_port[xi.node][xi.interface][index].tx_clk_delay_bypass = bypass; + cvmx_cfg_port[xi.node][xi.interface][index].rgmii_tx_clk_delay = clk_delay; +} + +/** +* @INTERNAL +* Gets RGMII TX clock bypass and delay value +* +* @param xiface node and interface +* @param index portindex +* @param bypass Set true to enable the clock bypass and false +* to sync clock and data synchronously. +* Default is false. +* @param clk_delay Delay value to skew TXC from TXD, default is 0. +*/ +void cvmx_helper_cfg_get_rgmii_tx_clk_delay (int xiface,int index,bool *bypass,int *clk_delay) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); + *bypass = cvmx_cfg_port[xi.node][xi.interface][index].tx_clk_delay_bypass; + + *clk_delay = cvmx_cfg_port[xi.node][xi.interface][index].rgmii_tx_clk_delay; +} + +/** +* @INTERNAL +* Retrieve the SFP node offset in the device tree +* +* @param xiface node and interface +* @param index port index +* +* @return offset in device tree or -1 if error or not defined. +*/ +int cvmx_helper_cfg_get_sfp_fdt_offset (int xiface,int index) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); +return cvmx_cfg_port[xi.node][xi.interface][index].sfp_of_offset; +} + +/** +* @INTERNAL +* Sets the SFP node offset +* +* @param xiface node and interface +* @param index port index +* @param sfp_of_offset Offset of SFP node in device tree +*/ +void cvmx_helper_cfg_set_sfp_fdt_offset (int xiface,int index,int sfp_of_offset) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); + cvmx_cfg_port[xi.node][xi.interface][index].sfp_of_offset = sfp_of_offset; +} + +/** +* Get data structure defining the Microsemi VSC7224 channel info +* or NULL if not present +* +* @param xiface node and interface +* @param index port index +* +* @return pointer to vsc7224 data structure or NULL if not present +*/ +struct cvmx_vsc7224_chan *cvmx_helper_cfg_get_vsc7224_chan_info (int xiface,int index) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); +return cvmx_cfg_port[xi.node][xi.interface][index].vsc7224_chan; +} + +/** +* Sets the Microsemi VSC7224 channel info data structure +* +* @param xiface node and interface +* @param index port index +* @param[in] vsc7224_info Microsemi VSC7224 data structure +*/ +void cvmx_helper_cfg_set_vsc7224_chan_info (int xiface,int index, +struct cvmx_vsc7224_chan *vsc7224_chan_info) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); + cvmx_cfg_port[xi.node][xi.interface][index].vsc7224_chan = vsc7224_chan_info; +} + +/** +* Get data structure defining the Avago AVSP5410 phy info +* or NULL if not present +* +* @param xiface node and interface +* @param index port index +* +* @return pointer to avsp5410 data structure or NULL if not present +*/ +struct cvmx_avsp5410 *cvmx_helper_cfg_get_avsp5410_info (int xiface,int index) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); +return cvmx_cfg_port[xi.node][xi.interface][index].avsp5410; +} + +/** +* Sets the Avago AVSP5410 phy info data structure +* +* @param xiface node and interface +* @param index port index +* @param[in] avsp5410_info Avago AVSP5410 data structure +*/ +void cvmx_helper_cfg_set_avsp5410_info (int xiface,int index,struct cvmx_avsp5410 *avsp5410_info) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); + cvmx_cfg_port[xi.node][xi.interface][index].avsp5410 = avsp5410_info; +} + +/** +* Gets the SFP data associated with a port +* +* @param xiface node and interface +* @param index port index +* +* @return pointer to SFP data structure or NULL if none +*/ +struct cvmx_fdt_sfp_info *cvmx_helper_cfg_get_sfp_info (int xiface,int index) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); +return cvmx_cfg_port[xi.node][xi.interface][index].sfp_info; +} + +/** +* Sets the SFP data associated with a port +* +* @param xiface node and interface +* @param index port index +* @param[in] sfp_info port SFP data or NULL for none +*/ +void cvmx_helper_cfg_set_sfp_info (int xiface,int index,struct cvmx_fdt_sfp_info *sfp_info) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); + cvmx_cfg_port[xi.node][xi.interface][index].sfp_info = sfp_info; +} + +/** +* Returns a pointer to the phy device associated with a port +* +* @param xiface node and interface +* @param index port index +* +* return pointer to phy device or NULL if none +*/ +struct phy_device *cvmx_helper_cfg_get_phy_device (int xiface,int index) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); +return cvmx_cfg_port[xi.node][xi.interface][index].phydev; +} + +/** +* Sets the phy device associated with a port +* +* @param xiface node and interface +* @param index port index +* @param[in] phydev phy device to assiciate +*/ +void cvmx_helper_cfg_set_phy_device (int xiface,int index,struct phy_device *phydev) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + +if (!port_cfg_data_initialized) +cvmx_init_port_cfg (); + cvmx_cfg_port[xi.node][xi.interface][index].phydev = phydev; +}
Signature · 1 line
2.29.2
PATCH 37/50 mips: octeon: Add cvmx-helper-fdt.c
In reply to Stefan RoeseFrom: Aaron Williams <[email protected]>
Import cvmx-helper-fdt.c from 2013 U-Boot. It will be used by the later added drivers to support PCIe and networking on the MIPS Octeon II / III platforms.
---
arch/mips/mach-octeon/cvmx-helper-fdt.c | 970 ++++++++++++++++++++++++ 1 file changed, 970 insertions(+) create mode 100644 arch/mips/mach-octeon/cvmx-helper-fdt.c
arch/mips/mach-octeon/cvmx-helper-fdt.c new file +970 -0
@@ -0,0 +1,970 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (C) 2020 Marvell International Ltd. +* +* FDT Helper functions similar to those provided to U-Boot. +*/ + +#include <log.h> +#include <malloc.h> +#include <net.h> +#include <linux/delay.h> + +#include <mach/cvmx-regs.h> +#include <mach/cvmx-csr.h> +#include <mach/cvmx-bootmem.h> +#include <mach/octeon-model.h> +#include <mach/octeon_fdt.h> +#include <mach/cvmx-helper.h> +#include <mach/cvmx-helper-board.h> +#include <mach/cvmx-helper-cfg.h> +#include <mach/cvmx-helper-fdt.h> +#include <mach/cvmx-helper-gpio.h> + +/** Structure used to get type of GPIO from device tree */ +struct gpio_compat { +char *compatible;/** Compatible string */ +enum cvmx_gpio_type type;/** Type */ +int8_t size;/** (max) Number of pins */ +}; + +#define GPIO_REG_PCA953X_IN 0 +#define GPIO_REG_PCA953X_OUT 1 +#define GPIO_REG_PCA953X_INVERT 2 +#define GPIO_REG_PCA953X_DIR 3 + +#define GPIO_REG_PCA957X_IN 0 +#define GPIO_REG_PCA957X_INVERT 1 +#define GPIO_REG_PCA957X_CFG 4 +#define GPIO_REG_PCA957X_OUT 5 + +enum cvmx_i2c_mux_type {I2C_MUX ,I2C_SWITCH }; + +/** Structure used to get type of GPIO from device tree */ +struct mux_compat { +char *compatible;/** Compatible string */ +enum cvmx_i2c_bus_type type;/** Mux chip type */ +enum cvmx_i2c_mux_type mux_type;/** Type of mux */ +u8 enable;/** Enable bit for mux */ +u8 size;/** (max) Number of channels */ +}; + +/** +* Local allocator to handle both SE and U-Boot that also zeroes out memory +* +* @param size number of bytes to allocate +* +* @return pointer to allocated memory or NULL if out of memory. +* Alignment is set to 8-bytes. +*/ +void *__cvmx_fdt_alloc (size_t size) +{ +return calloc (size,1 ); +} + +/** +* Free allocated memory. +* +* @param ptr pointer to memory to free +* +* NOTE: This only works in U-Boot since SE does not really have a freeing +* mechanism. In SE the memory is zeroed out. +*/ +void __cvmx_fdt_free (void *ptr,size_t size) +{ +free (ptr); +} + +/** +* Look up a phandle and follow it to its node then return the offset of that +* node. +* +* @param[in] fdt_addr pointer to FDT blob +* @param node node to read phandle from +* @param[in] prop_name name of property to find +* @param[in,out] lenp Number of phandles, input max number +* @param[out] nodes Array of phandle nodes +* +* @return -ve error code on error or 0 for success +*/ +int cvmx_fdt_lookup_phandles (const void *fdt_addr,int node, +const char *prop_name,int *lenp, +int *nodes) +{ +const u32 *phandles; +int count; +int i; + + phandles =fdt_getprop (fdt_addr, node, prop_name, &count); +if (!phandles || count <0 ) +return -FDT_ERR_NOTFOUND ; + + count /=4 ; +if (count > *lenp) + count = *lenp; + +for (i =0 ; i < count; i++) + nodes[i] =fdt_node_offset_by_phandle (fdt_addr, +fdt32_to_cpu (phandles[i])); + *lenp = count; +return 0 ; +} + +/** +* Given a FDT node return the CPU node number +* +* @param[in] fdt_addr Address of FDT +* @param node FDT node number +* +* @return CPU node number or error if negative +*/ +int cvmx_fdt_get_cpu_node (const void *fdt_addr,int node) +{ +int parent = node; +const u32 *ranges; +int len =0 ; + +while (fdt_node_check_compatible (fdt_addr, parent,"simple-bus" ) !=0 ) { + parent =fdt_parent_offset (fdt_addr, parent); +if (parent <0 ) +return parent; + } + ranges =fdt_getprop (fdt_addr, parent,"ranges" , &len); +if (!ranges) +return len; + +if (len ==0 ) +return 0 ; + +if (len <24 ) +return -FDT_ERR_TRUNCATED ; + +return fdt32_to_cpu (ranges[2 ]) /0x10 ; +} + +/** +* Get the total size of the flat device tree +* +* @param[in] fdt_addr Address of FDT +* +* @return Size of flat device tree in bytes or error if negative. +*/ +int cvmx_fdt_get_fdt_size (const void *fdt_addr) +{ +int rc; + + rc =fdt_check_header (fdt_addr); +if (rc) +return rc; +return fdt_totalsize (fdt_addr); +} + +/** +* Returns if a node is compatible with one of the items in the string list +* +* @param[in] fdt_addr Pointer to flat device tree +* @param node Node offset to check +* @param[in] strlist Array of FDT device compatibility strings, +* must end with NULL or empty string. +* +* @return 0 if@least one item matches, 1 if no matches +*/ +int cvmx_fdt_node_check_compatible_list (const void *fdt_addr,int node,const char *const *strlist) +{ +while (*strlist && **strlist) { +if (!fdt_node_check_compatible (fdt_addr, node, *strlist)) +return 0 ; + strlist++; + } +return 1 ; +} + +/** +* Given a FDT node, return the next compatible node. +* +* @param[in] fdt_addr Pointer to flat device tree +* @param start_offset Starting node offset or -1 to find the first +* @param strlist Array of FDT device compatibility strings, must +* end with NULL or empty string. +* +* @return next matching node or -1 if no more matches. +*/ +int cvmx_fdt_node_offset_by_compatible_list (const void *fdt_addr,int startoffset, +const char *const *strlist) +{ +int offset; + +for (offset =fdt_next_node (fdt_addr, startoffset,NULL ); offset >=0 ; + offset =fdt_next_node (fdt_addr, offset,NULL )) { +if (!cvmx_fdt_node_check_compatible_list (fdt_addr, offset, strlist)) +return offset; + } +return -1 ; +} + +/** +* Attaches a PHY to a SFP or QSFP. +* +* @param sfp sfp to attach PHY to +* @param phy_info phy descriptor to attach or NULL to detach +*/ +void cvmx_sfp_attach_phy (struct cvmx_fdt_sfp_info *sfp,struct cvmx_phy_info *phy_info) +{ + sfp->phy_info = phy_info; +if (phy_info) + phy_info->sfp_info = sfp; +} + +/** +* Assigns an IPD port to a SFP slot +* +* @param sfp Handle to SFP data structure +* @param ipd_port Port to assign it to +* +* @return 0 for success, -1 on error +*/ +int cvmx_sfp_set_ipd_port (struct cvmx_fdt_sfp_info *sfp,int ipd_port) +{ +int i; + +if (sfp->is_qsfp) { +int xiface; +cvmx_helper_interface_mode_t mode; + + xiface =cvmx_helper_get_interface_num (ipd_port); + mode =cvmx_helper_interface_get_mode (xiface); + sfp->ipd_port[0 ] = ipd_port; + +switch (mode) { +case CVMX_HELPER_INTERFACE_MODE_SGMII : +case CVMX_HELPER_INTERFACE_MODE_XFI : +case CVMX_HELPER_INTERFACE_MODE_10G_KR : +for (i =1 ; i <4 ; i++) + sfp->ipd_port[i] =cvmx_helper_get_ipd_port (xiface, i); +break ; +case CVMX_HELPER_INTERFACE_MODE_XLAUI : +case CVMX_HELPER_INTERFACE_MODE_40G_KR4 : + sfp->ipd_port[0 ] = ipd_port; +for (i =1 ; i <4 ; i++) + sfp->ipd_port[i] =-1 ; +break ; +default : +debug ("%s: Interface mode %s for interface 0x%x, ipd_port %d not supported for QSFP\n" , + __func__,cvmx_helper_interface_mode_to_string (mode), xiface, + ipd_port); +return -1 ; + } + }else { + sfp->ipd_port[0 ] = ipd_port; +for (i =1 ; i <4 ; i++) + sfp->ipd_port[i] =-1 ; + } +return 0 ; +} + +/** +* Parses all of the channels assigned to a VSC7224 device +* +* @param[in] fdt_addr Address of flat device tree +* @param of_offset Offset of vsc7224 node +* @param[in,out] vsc7224 Data structure to hold the data +* +* @return 0 for success, -1 on error +*/ +static int cvmx_fdt_parse_vsc7224_channels (const void *fdt_addr,int of_offset, +struct cvmx_vsc7224 *vsc7224) +{ +int parent_offset = of_offset; +int err =0 ; +int reg; +int num_chan =0 ; +struct cvmx_vsc7224_chan *channel; +struct cvmx_fdt_sfp_info *sfp_info; +int len; +int num_taps; +int i; +const u32 *tap_values; +int of_mac; +int xiface, index; +bool is_tx; +bool is_qsfp; +const char *mac_str; + +debug ("%s(%p, %d, %s)\n" , __func__, fdt_addr, of_offset, vsc7224->name); +do { +/* Walk through all channels */ + of_offset =fdt_node_offset_by_compatible (fdt_addr, of_offset, +"vitesse,vsc7224-channel" ); +if (of_offset == -FDT_ERR_NOTFOUND ) { +break ; + }else if (of_offset <0 ) { +debug ("%s: Failed finding compatible channel\n" , + __func__); + err =-1 ; +break ; + } +if (fdt_parent_offset (fdt_addr, of_offset) != parent_offset) +break ; + reg =cvmx_fdt_get_int (fdt_addr, of_offset,"reg" ,-1 ); +if (reg <0 || reg >3 ) { +debug ("%s: channel reg is either not present or out of range\n" , + __func__); + err =-1 ; +break ; + } + is_tx =cvmx_fdt_get_bool (fdt_addr, of_offset,"direction-tx" ); + +debug ("%s(%s): Adding %cx channel %d\n" , + __func__, vsc7224->name, is_tx ?'t' :'r' , + reg); + tap_values = (const uint32_t *)fdt_getprop (fdt_addr, of_offset,"taps" , &len); +if (!tap_values) { +debug ("%s: Error: no taps defined for vsc7224 channel %d\n" , + __func__, reg); + err =-1 ; +break ; + } + +if (vsc7224->channel[reg]) { +debug ("%s: Error: channel %d already assigned at %p\n" , + __func__, reg, + vsc7224->channel[reg]); + err =-1 ; +break ; + } +if (len %16 ) { +debug ("%s: Error: tap format error for channel %d\n" , + __func__, reg); + err =-1 ; +break ; + } + num_taps = len /16 ; +debug ("%s: Adding %d taps\n" , __func__, num_taps); + + channel =__cvmx_fdt_alloc (sizeof (*channel) + + num_taps *sizeof (struct cvmx_vsc7224_tap )); +if (!channel) { +debug ("%s: Out of memory\n" , __func__); + err =-1 ; +break ; + } + vsc7224->channel[reg] = channel; + channel->num_taps = num_taps; + channel->lane = reg; + channel->of_offset = of_offset; + channel->is_tx = is_tx; + channel->pretap_disable =cvmx_fdt_get_bool (fdt_addr, of_offset,"pretap-disable" ); + channel->posttap_disable = +cvmx_fdt_get_bool (fdt_addr, of_offset,"posttap-disable" ); + channel->vsc7224 = vsc7224; +/* Read all the tap values */ +for (i =0 ; i < num_taps; i++) { + channel->taps[i].len =fdt32_to_cpu (tap_values[i *4 +0 ]); + channel->taps[i].main_tap =fdt32_to_cpu (tap_values[i *4 +1 ]); + channel->taps[i].pre_tap =fdt32_to_cpu (tap_values[i *4 +2 ]); + channel->taps[i].post_tap =fdt32_to_cpu (tap_values[i *4 +3 ]); +debug ("%s: tap %d: len: %d, main_tap: 0x%x, pre_tap: 0x%x, post_tap: 0x%x\n" , + __func__, i, channel->taps[i].len, channel->taps[i].main_tap, + channel->taps[i].pre_tap, channel->taps[i].post_tap); + } +/* Now find out which interface it's mapped to */ + channel->ipd_port =-1 ; + + mac_str ="sfp-mac" ; +if (fdt_getprop (fdt_addr, of_offset, mac_str,NULL )) { + is_qsfp = false; + }else if (fdt_getprop (fdt_addr, of_offset,"qsfp-mac" ,NULL )) { + is_qsfp = true; + mac_str ="qsfp-mac" ; + }else { +debug ("%s: Error: MAC not found for %s channel %d\n" , __func__, + vsc7224->name, reg); +return -1 ; + } + of_mac =cvmx_fdt_lookup_phandle (fdt_addr, of_offset, mac_str); +if (of_mac <0 ) { +debug ("%s: Error %d with MAC %s phandle for %s\n" , __func__, of_mac, + mac_str, vsc7224->name); +return -1 ; + } + +debug ("%s: Found mac at offset %d\n" , __func__, of_mac); + err =cvmx_helper_cfg_get_xiface_index_by_fdt_node_offset (of_mac, &xiface, &index); +if (!err) { + channel->xiface = xiface; + channel->index = index; + channel->ipd_port =cvmx_helper_get_ipd_port (xiface, index); + +debug ("%s: Found MAC, xiface: 0x%x, index: %d, ipd port: %d\n" , __func__, + xiface, index, channel->ipd_port); +if (channel->ipd_port >=0 ) { +cvmx_helper_cfg_set_vsc7224_chan_info (xiface, index, channel); +debug ("%s: Storing config channel for xiface 0x%x, index %d\n" , + __func__, xiface, index); + } + sfp_info =cvmx_helper_cfg_get_sfp_info (xiface, index); +if (!sfp_info) { +debug ("%s: Warning: no (Q)SFP+ slot found for xinterface 0x%x, index %d for channel %d\n" , + __func__, xiface, index, channel->lane); +continue ; + } + +/* Link it */ + channel->next = sfp_info->vsc7224_chan; +if (sfp_info->vsc7224_chan) + sfp_info->vsc7224_chan->prev = channel; + sfp_info->vsc7224_chan = channel; + sfp_info->is_vsc7224 = true; +debug ("%s: Registering VSC7224 %s channel %d with SFP %s\n" , __func__, + vsc7224->name, channel->lane, sfp_info->name); +if (!sfp_info->mod_abs_changed) { +debug ("%s: Registering cvmx_sfp_vsc7224_mod_abs_changed at %p for xinterface 0x%x, index %d\n" , + __func__, &cvmx_sfp_vsc7224_mod_abs_changed, xiface, index); +cvmx_sfp_register_mod_abs_changed ( + sfp_info, + &cvmx_sfp_vsc7224_mod_abs_changed, +NULL ); + } + } + }while (!err && num_chan <4 ); + +return err; +} + +/** +* @INTERNAL +* Parses all instances of the Vitesse VSC7224 reclocking chip +* +* @param[in] fdt_addr Address of flat device tree +* +* @return 0 for success, error otherwise +*/ +int __cvmx_fdt_parse_vsc7224 (const void *fdt_addr) +{ +int of_offset =-1 ; +struct cvmx_vsc7224 *vsc7224 =NULL ; +struct cvmx_fdt_gpio_info *gpio_info =NULL ; +int err =0 ; +int of_parent; +static bool parsed; + +debug ("%s(%p)\n" , __func__, fdt_addr); + +if (parsed) { +debug ("%s: Already parsed\n" , __func__); +return 0 ; + } +do { + of_offset =fdt_node_offset_by_compatible (fdt_addr, of_offset, +"vitesse,vsc7224" ); +debug ("%s: of_offset: %d\n" , __func__, of_offset); +if (of_offset == -FDT_ERR_NOTFOUND ) { +break ; + }else if (of_offset <0 ) { + err =-1 ; +debug ("%s: Error %d parsing FDT\n" , + __func__, of_offset); +break ; + } + + vsc7224 =__cvmx_fdt_alloc (sizeof (*vsc7224)); + +if (!vsc7224) { +debug ("%s: Out of memory!\n" , __func__); +return -1 ; + } + vsc7224->of_offset = of_offset; + vsc7224->i2c_addr =cvmx_fdt_get_int (fdt_addr, of_offset, +"reg" ,-1 ); + of_parent =fdt_parent_offset (fdt_addr, of_offset); + vsc7224->i2c_bus =cvmx_fdt_get_i2c_bus (fdt_addr, of_parent); +if (vsc7224->i2c_addr <0 ) { +debug ("%s: Error: reg field missing\n" , __func__); + err =-1 ; +break ; + } +if (!vsc7224->i2c_bus) { +debug ("%s: Error getting i2c bus\n" , __func__); + err =-1 ; +break ; + } + vsc7224->name =fdt_get_name (fdt_addr, of_offset,NULL ); +debug ("%s: Adding %s\n" , __func__, vsc7224->name); +if (fdt_getprop (fdt_addr, of_offset,"reset" ,NULL )) { + gpio_info =cvmx_fdt_gpio_get_info_phandle (fdt_addr, of_offset,"reset" ); + vsc7224->reset_gpio = gpio_info; + } +if (fdt_getprop (fdt_addr, of_offset,"los" ,NULL )) { + gpio_info =cvmx_fdt_gpio_get_info_phandle (fdt_addr, of_offset,"los" ); + vsc7224->los_gpio = gpio_info; + } +debug ("%s: Parsing channels\n" , __func__); + err =cvmx_fdt_parse_vsc7224_channels (fdt_addr, of_offset, vsc7224); +if (err) { +debug ("%s: Error parsing VSC7224 channels\n" , __func__); +break ; + } + }while (of_offset >0 ); + +if (err) { +debug ("%s(): Error\n" , __func__); +if (vsc7224) { +if (vsc7224->reset_gpio) +__cvmx_fdt_free (vsc7224->reset_gpio,sizeof (*vsc7224->reset_gpio)); +if (vsc7224->los_gpio) +__cvmx_fdt_free (vsc7224->los_gpio,sizeof (*vsc7224->los_gpio)); +if (vsc7224->i2c_bus) +cvmx_fdt_free_i2c_bus (vsc7224->i2c_bus); +__cvmx_fdt_free (vsc7224,sizeof (*vsc7224)); + } + } +if (!err) + parsed = true; + +return err; +} + +/** +* @INTERNAL +* Parses all instances of the Avago AVSP5410 gearbox phy +* +* @param[in] fdt_addr Address of flat device tree +* +* @return 0 for success, error otherwise +*/ +int __cvmx_fdt_parse_avsp5410 (const void *fdt_addr) +{ +int of_offset =-1 ; +struct cvmx_avsp5410 *avsp5410 =NULL ; +struct cvmx_fdt_sfp_info *sfp_info; +int err =0 ; +int of_parent; +static bool parsed; +int of_mac; +int xiface, index; +bool is_qsfp; +const char *mac_str; + +debug ("%s(%p)\n" , __func__, fdt_addr); + +if (parsed) { +debug ("%s: Already parsed\n" , __func__); +return 0 ; + } + +do { + of_offset =fdt_node_offset_by_compatible (fdt_addr, of_offset, +"avago,avsp-5410" ); +debug ("%s: of_offset: %d\n" , __func__, of_offset); +if (of_offset == -FDT_ERR_NOTFOUND ) { +break ; + }else if (of_offset <0 ) { + err =-1 ; +debug ("%s: Error %d parsing FDT\n" , __func__, of_offset); +break ; + } + + avsp5410 =__cvmx_fdt_alloc (sizeof (*avsp5410)); + +if (!avsp5410) { +debug ("%s: Out of memory!\n" , __func__); +return -1 ; + } + avsp5410->of_offset = of_offset; + avsp5410->i2c_addr =cvmx_fdt_get_int (fdt_addr, of_offset, +"reg" ,-1 ); + of_parent =fdt_parent_offset (fdt_addr, of_offset); + avsp5410->i2c_bus =cvmx_fdt_get_i2c_bus (fdt_addr, of_parent); +if (avsp5410->i2c_addr <0 ) { +debug ("%s: Error: reg field missing\n" , __func__); + err =-1 ; +break ; + } +if (!avsp5410->i2c_bus) { +debug ("%s: Error getting i2c bus\n" , __func__); + err =-1 ; +break ; + } + avsp5410->name =fdt_get_name (fdt_addr, of_offset,NULL ); +debug ("%s: Adding %s\n" , __func__, avsp5410->name); + +/* Now find out which interface it's mapped to */ + avsp5410->ipd_port =-1 ; + + mac_str ="sfp-mac" ; +if (fdt_getprop (fdt_addr, of_offset, mac_str,NULL )) { + is_qsfp = false; + }else if (fdt_getprop (fdt_addr, of_offset,"qsfp-mac" ,NULL )) { + is_qsfp = true; + mac_str ="qsfp-mac" ; + }else { +debug ("%s: Error: MAC not found for %s\n" , __func__, avsp5410->name); +return -1 ; + } + of_mac =cvmx_fdt_lookup_phandle (fdt_addr, of_offset, mac_str); +if (of_mac <0 ) { +debug ("%s: Error %d with MAC %s phandle for %s\n" , __func__, of_mac, + mac_str, avsp5410->name); +return -1 ; + } + +debug ("%s: Found mac at offset %d\n" , __func__, of_mac); + err =cvmx_helper_cfg_get_xiface_index_by_fdt_node_offset (of_mac, &xiface, &index); +if (!err) { + avsp5410->xiface = xiface; + avsp5410->index = index; + avsp5410->ipd_port =cvmx_helper_get_ipd_port (xiface, index); + +debug ("%s: Found MAC, xiface: 0x%x, index: %d, ipd port: %d\n" , __func__, + xiface, index, avsp5410->ipd_port); +if (avsp5410->ipd_port >=0 ) { +cvmx_helper_cfg_set_avsp5410_info (xiface, index, avsp5410); +debug ("%s: Storing config phy for xiface 0x%x, index %d\n" , + __func__, xiface, index); + } + sfp_info =cvmx_helper_cfg_get_sfp_info (xiface, index); +if (!sfp_info) { +debug ("%s: Warning: no (Q)SFP+ slot found for xinterface 0x%x, index %d\n" , + __func__, xiface, index); +continue ; + } + + sfp_info->is_avsp5410 = true; + sfp_info->avsp5410 = avsp5410; +debug ("%s: Registering AVSP5410 %s with SFP %s\n" , __func__, avsp5410->name, + sfp_info->name); +if (!sfp_info->mod_abs_changed) { +debug ("%s: Registering cvmx_sfp_avsp5410_mod_abs_changed at %p for xinterface 0x%x, index %d\n" , + __func__, &cvmx_sfp_avsp5410_mod_abs_changed, xiface, index); +cvmx_sfp_register_mod_abs_changed ( + sfp_info, + &cvmx_sfp_avsp5410_mod_abs_changed, +NULL ); + } + } + }while (of_offset >0 ); + +if (err) { +debug ("%s(): Error\n" , __func__); +if (avsp5410) { +if (avsp5410->i2c_bus) +cvmx_fdt_free_i2c_bus (avsp5410->i2c_bus); +__cvmx_fdt_free (avsp5410,sizeof (*avsp5410)); + } + } +if (!err) + parsed = true; + +return err; +} + +/** +* Parse QSFP GPIOs for SFP +* +* @param[in] fdt_addr Pointer to flat device tree +* @param of_offset Offset of QSFP node +* @param[out] sfp_info Pointer to sfp info to fill in +* +* @return 0 for success +*/ +static int cvmx_parse_qsfp (const void *fdt_addr,int of_offset,struct cvmx_fdt_sfp_info *sfp_info) +{ + sfp_info->select =cvmx_fdt_gpio_get_info_phandle (fdt_addr, of_offset,"select" ); + sfp_info->mod_abs =cvmx_fdt_gpio_get_info_phandle (fdt_addr, of_offset,"mod_prs" ); + sfp_info->reset =cvmx_fdt_gpio_get_info_phandle (fdt_addr, of_offset,"reset" ); + sfp_info->interrupt =cvmx_fdt_gpio_get_info_phandle (fdt_addr, of_offset,"interrupt" ); + sfp_info->lp_mode =cvmx_fdt_gpio_get_info_phandle (fdt_addr, of_offset,"lp_mode" ); +return 0 ; +} + +/** +* Parse SFP GPIOs for SFP +* +* @param[in] fdt_addr Pointer to flat device tree +* @param of_offset Offset of SFP node +* @param[out] sfp_info Pointer to sfp info to fill in +* +* @return 0 for success +*/ +static int cvmx_parse_sfp (const void *fdt_addr,int of_offset,struct cvmx_fdt_sfp_info *sfp_info) +{ + sfp_info->mod_abs =cvmx_fdt_gpio_get_info_phandle (fdt_addr, of_offset,"mod_abs" ); + sfp_info->rx_los =cvmx_fdt_gpio_get_info_phandle (fdt_addr, of_offset,"rx_los" ); + sfp_info->tx_disable =cvmx_fdt_gpio_get_info_phandle (fdt_addr, of_offset,"tx_disable" ); + sfp_info->tx_error =cvmx_fdt_gpio_get_info_phandle (fdt_addr, of_offset,"tx_error" ); +return 0 ; +} + +/** +* Parse SFP/QSFP EEPROM and diag +* +* @param[in] fdt_addr Pointer to flat device tree +* @param of_offset Offset of SFP node +* @param[out] sfp_info Pointer to sfp info to fill in +* +* @return 0 for success, -1 on error +*/ +static int cvmx_parse_sfp_eeprom (const void *fdt_addr,int of_offset, +struct cvmx_fdt_sfp_info *sfp_info) +{ +int of_eeprom; +int of_diag; + +debug ("%s(%p, %d, %s)\n" , __func__, fdt_addr, of_offset, sfp_info->name); + of_eeprom =cvmx_fdt_lookup_phandle (fdt_addr, of_offset,"eeprom" ); +if (of_eeprom <0 ) { +debug ("%s: Missing \"eeprom\" from device tree for %s\n" , __func__, sfp_info->name); +return -1 ; + } + + sfp_info->i2c_bus =cvmx_fdt_get_i2c_bus (fdt_addr,fdt_parent_offset (fdt_addr, of_eeprom)); + sfp_info->i2c_eeprom_addr =cvmx_fdt_get_int (fdt_addr, of_eeprom,"reg" ,0x50 ); + +debug ("%s(%p, %d, %s, %d)\n" , __func__, fdt_addr, of_offset, sfp_info->name, + sfp_info->i2c_eeprom_addr); + +if (!sfp_info->i2c_bus) { +debug ("%s: Error: could not determine i2c bus for eeprom for %s\n" , __func__, + sfp_info->name); +return -1 ; + } + of_diag =cvmx_fdt_lookup_phandle (fdt_addr, of_offset,"diag" ); +if (of_diag >=0 ) + sfp_info->i2c_diag_addr =cvmx_fdt_get_int (fdt_addr, of_diag,"reg" ,0x51 ); +else + sfp_info->i2c_diag_addr =0x51 ; +return 0 ; +} + +/** +* Parse SFP information from device tree +* +* @param[in] fdt_addr Address of flat device tree +* +* @return pointer to sfp info or NULL if error +*/ +struct cvmx_fdt_sfp_info *cvmx_helper_fdt_parse_sfp_info (const void *fdt_addr,int of_offset) +{ +struct cvmx_fdt_sfp_info *sfp_info =NULL ; +int err =-1 ; +bool is_qsfp; + +if (!fdt_node_check_compatible (fdt_addr, of_offset,"ethernet,sfp-slot" )) { + is_qsfp = false; + }else if (!fdt_node_check_compatible (fdt_addr, of_offset,"ethernet,qsfp-slot" )) { + is_qsfp = true; + }else { +debug ("%s: Error: incompatible sfp/qsfp slot, compatible=%s\n" , __func__, + (char *)fdt_getprop (fdt_addr, of_offset,"compatible" ,NULL )); + goto error_exit; + } + +debug ("%s: %ssfp module found at offset %d\n" , __func__, is_qsfp ?"q" :"" , of_offset); + sfp_info =__cvmx_fdt_alloc (sizeof (*sfp_info)); +if (!sfp_info) { +debug ("%s: Error: out of memory\n" , __func__); + goto error_exit; + } + sfp_info->name =fdt_get_name (fdt_addr, of_offset,NULL ); + sfp_info->of_offset = of_offset; + sfp_info->is_qsfp = is_qsfp; + sfp_info->last_mod_abs =-1 ; + sfp_info->last_rx_los =-1 ; + +if (is_qsfp) + err =cvmx_parse_qsfp (fdt_addr, of_offset, sfp_info); +else + err =cvmx_parse_sfp (fdt_addr, of_offset, sfp_info); +if (err) { +debug ("%s: Error in %s parsing %ssfp GPIO info\n" , __func__, sfp_info->name, + is_qsfp ?"q" :"" ); + goto error_exit; + } +debug ("%s: Parsing %ssfp module eeprom\n" , __func__, is_qsfp ?"q" :"" ); + err =cvmx_parse_sfp_eeprom (fdt_addr, of_offset, sfp_info); +if (err) { +debug ("%s: Error parsing eeprom info for %s\n" , __func__, sfp_info->name); + goto error_exit; + } + +/* Register default check for mod_abs changed */ +if (!err) +cvmx_sfp_register_check_mod_abs (sfp_info, cvmx_sfp_check_mod_abs,NULL ); + +error_exit: +/* Note: we don't free any data structures on error since it gets +* rather complicated with i2c buses and whatnot. +*/ +return err ?NULL : sfp_info; +} + +/** +* @INTERNAL +* Parse a slice of the Inphi/Cortina CS4343 in the device tree +* +* @param[in] fdt_addr Address of flat device tree +* @param of_offset fdt offset of slice +* @param phy_info phy_info data structure +* +* @return slice number if non-negative, otherwise error +*/ +static int cvmx_fdt_parse_cs4343_slice (const void *fdt_addr,int of_offset, +struct cvmx_phy_info *phy_info) +{ +struct cvmx_cs4343_slice_info *slice; +int reg; +int reg_offset; + + reg =cvmx_fdt_get_int (fdt_addr, of_offset,"reg" ,-1 ); + reg_offset =cvmx_fdt_get_int (fdt_addr, of_offset,"slice_offset" ,-1 ); + +if (reg <0 || reg >=4 ) { +debug ("%s(%p, %d, %p): Error: reg %d undefined or out of range\n" , __func__, + fdt_addr, of_offset, phy_info, reg); +return -1 ; + } +if (reg_offset %0x1000 || reg_offset >0x3000 || reg_offset <0 ) { +debug ("%s(%p, %d, %p): Error: reg_offset 0x%x undefined or out of range\n" , + __func__, fdt_addr, of_offset, phy_info, reg_offset); +return -1 ; + } +if (!phy_info->cs4343_info) { +debug ("%s: Error: phy info cs4343 datastructure is NULL\n" , __func__); +return -1 ; + } +debug ("%s(%p, %d, %p): %s, reg: %d, slice offset: 0x%x\n" , __func__, fdt_addr, of_offset, + phy_info,fdt_get_name (fdt_addr, of_offset,NULL ), reg, reg_offset); + slice = &phy_info->cs4343_info->slice[reg]; + slice->name =fdt_get_name (fdt_addr, of_offset,NULL ); + slice->mphy = phy_info->cs4343_info; + slice->phy_info = phy_info; + slice->of_offset = of_offset; + slice->slice_no = reg; + slice->reg_offset = reg_offset; +/* SR settings */ + slice->sr_stx_cmode_res =cvmx_fdt_get_int (fdt_addr, of_offset,"sr-stx-cmode-res" ,3 ); + slice->sr_stx_drv_lower_cm = +cvmx_fdt_get_int (fdt_addr, of_offset,"sr-stx-drv-lower-cm" ,8 ); + slice->sr_stx_level =cvmx_fdt_get_int (fdt_addr, of_offset,"sr-stx-level" ,0x1c ); + slice->sr_stx_pre_peak =cvmx_fdt_get_int (fdt_addr, of_offset,"sr-stx-pre-peak" ,1 ); + slice->sr_stx_muxsubrate_sel = +cvmx_fdt_get_int (fdt_addr, of_offset,"sr-stx-muxsubrate-sel" ,0 ); + slice->sr_stx_post_peak =cvmx_fdt_get_int (fdt_addr, of_offset,"sr-stx-post-peak" ,8 ); +/* CX settings */ + slice->cx_stx_cmode_res =cvmx_fdt_get_int (fdt_addr, of_offset,"cx-stx-cmode-res" ,3 ); + slice->cx_stx_drv_lower_cm = +cvmx_fdt_get_int (fdt_addr, of_offset,"cx-stx-drv-lower-cm" ,8 ); + slice->cx_stx_level =cvmx_fdt_get_int (fdt_addr, of_offset,"cx-stx-level" ,0x1c ); + slice->cx_stx_pre_peak =cvmx_fdt_get_int (fdt_addr, of_offset,"cx-stx-pre-peak" ,1 ); + slice->cx_stx_muxsubrate_sel = +cvmx_fdt_get_int (fdt_addr, of_offset,"cx-stx-muxsubrate-sel" ,0 ); + slice->cx_stx_post_peak =cvmx_fdt_get_int (fdt_addr, of_offset,"cx-stx-post-peak" ,0xC ); +/* 1000Base-X settings */ +/* CX settings */ + slice->basex_stx_cmode_res = +cvmx_fdt_get_int (fdt_addr, of_offset,"basex-stx-cmode-res" ,3 ); + slice->basex_stx_drv_lower_cm = +cvmx_fdt_get_int (fdt_addr, of_offset,"basex-stx-drv-lower-cm" ,8 ); + slice->basex_stx_level =cvmx_fdt_get_int (fdt_addr, of_offset, +"basex-stx-level" ,0x1c ); + slice->basex_stx_pre_peak =cvmx_fdt_get_int (fdt_addr, of_offset, +"basex-stx-pre-peak" ,1 ); + slice->basex_stx_muxsubrate_sel = +cvmx_fdt_get_int (fdt_addr, of_offset, +"basex-stx-muxsubrate-sel" ,0 ); + slice->basex_stx_post_peak = +cvmx_fdt_get_int (fdt_addr, of_offset,"basex-stx-post-peak" ,8 ); +/* Get the link LED gpio pin */ + slice->link_gpio =cvmx_fdt_get_int (fdt_addr, of_offset, +"link-led-gpio" ,-1 ); + slice->error_gpio =cvmx_fdt_get_int (fdt_addr, of_offset, +"error-led-gpio" ,-1 ); + slice->los_gpio =cvmx_fdt_get_int (fdt_addr, of_offset, +"los-input-gpio" ,-1 ); + slice->link_inverted =cvmx_fdt_get_bool (fdt_addr, of_offset, +"link-led-gpio-inverted" ); + slice->error_inverted =cvmx_fdt_get_bool (fdt_addr, of_offset, +"error-led-gpio-inverted" ); + slice->los_inverted =cvmx_fdt_get_bool (fdt_addr, of_offset, +"los-input-gpio-inverted" ); +/* Convert GPIOs to be die based if they're not already */ +if (slice->link_gpio >4 && slice->link_gpio <=8 ) + slice->link_gpio -=4 ; +if (slice->error_gpio >4 && slice->error_gpio <=8 ) + slice->error_gpio -=4 ; +if (slice->los_gpio >4 && slice->los_gpio <=8 ) + slice->los_gpio -=4 ; + +return reg; +} + +/** +* @INTERNAL +* Parses either a CS4343 phy or a slice of the phy from the device tree +* @param[in] fdt_addr Address of FDT +* @param of_offset offset of slice or phy in device tree +* @param phy_info phy_info data structure to fill in +* +* @return 0 for success, -1 on error +*/ +int cvmx_fdt_parse_cs4343 (const void *fdt_addr,int of_offset,struct cvmx_phy_info *phy_info) +{ +int of_slice =-1 ; +struct cvmx_cs4343_info *cs4343; +int err =-1 ; +int reg; + +debug ("%s(%p, %d, %p): %s (%s)\n" , __func__, + fdt_addr, of_offset, phy_info, +fdt_get_name (fdt_addr, of_offset,NULL ), + (const char *)fdt_getprop (fdt_addr, of_offset,"compatible" ,NULL )); + +if (!phy_info->cs4343_info) + phy_info->cs4343_info =__cvmx_fdt_alloc (sizeof (struct cvmx_cs4343_info )); +if (!phy_info->cs4343_info) { +debug ("%s: Error: out of memory!\n" , __func__); +return -1 ; + } + cs4343 = phy_info->cs4343_info; +/* If we're passed to a slice then process only that slice */ +if (!fdt_node_check_compatible (fdt_addr, of_offset,"cortina,cs4343-slice" )) { + err =0 ; + of_slice = of_offset; + of_offset =fdt_parent_offset (fdt_addr, of_offset); + reg =cvmx_fdt_parse_cs4343_slice (fdt_addr, of_slice, phy_info); +if (reg >=0 ) + phy_info->cs4343_slice_info = &cs4343->slice[reg]; +else + err = reg; + }else if (!fdt_node_check_compatible (fdt_addr, of_offset, +"cortina,cs4343" )) { +/* Walk through and process all of the slices */ + of_slice = +fdt_node_offset_by_compatible (fdt_addr, of_offset,"cortina,cs4343-slice" ); +while (of_slice >0 &&fdt_parent_offset (fdt_addr, of_slice) == + of_offset) { +debug ("%s: Parsing slice %s\n" , __func__, +fdt_get_name (fdt_addr, of_slice,NULL )); + err =cvmx_fdt_parse_cs4343_slice (fdt_addr, of_slice, + phy_info); +if (err <0 ) +break ; + of_slice =fdt_node_offset_by_compatible (fdt_addr, + of_slice, +"cortina,cs4343-slice" ); + } + }else { +debug ("%s: Error: unknown compatible string %s for %s\n" , __func__, + (const char *)fdt_getprop (fdt_addr, of_offset, +"compatible" ,NULL ), +fdt_get_name (fdt_addr, of_offset,NULL )); + } + +if (err >=0 ) { + cs4343->name =fdt_get_name (fdt_addr, of_offset,NULL ); + cs4343->phy_info = phy_info; + cs4343->of_offset = of_offset; + } + +return err <0 ?-1 :0 ; +}
Signature · 1 line
2.29.2
PATCH 38/50 mips: octeon: Add cvmx-helper-jtag.c
In reply to Stefan RoeseFrom: Aaron Williams <[email protected]>
Import cvmx-helper-jtag.c from 2013 U-Boot. It will be used by the later added drivers to support PCIe and networking on the MIPS Octeon II / III platforms.
---
arch/mips/mach-octeon/cvmx-helper-jtag.c | 172 +++++++++++++++++++++++ 1 file changed, 172 insertions(+) create mode 100644 arch/mips/mach-octeon/cvmx-helper-jtag.c
arch/mips/mach-octeon/cvmx-helper-jtag.c new file +172 -0
@@ -0,0 +1,172 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (C) 2020 Marvell International Ltd. +* +* Helper utilities for qlm_jtag. +*/ + +#include <log.h> +#include <asm/global_data.h> +#include <linux/delay.h> + +#include <mach/cvmx-regs.h> +#include <mach/octeon-model.h> +#include <mach/cvmx-fuse.h> +#include <mach/octeon-feature.h> +#include <mach/cvmx-qlm.h> +#include <mach/octeon_qlm.h> +#include <mach/cvmx-pcie.h> +#include <mach/cvmx-ciu-defs.h> + +DECLARE_GLOBAL_DATA_PTR ; + +/** +* Initialize the internal QLM JTAG logic to allow programming +* of the JTAG chain by the cvmx_helper_qlm_jtag_*() functions. +* These functions should only be used at the direction of Cavium +* Networks. Programming incorrect values into the JTAG chain +* can cause chip damage. +*/ +void cvmx_helper_qlm_jtag_init (void ) +{ +union cvmx_ciu_qlm_jtgc jtgc; +int clock_div =0 ; +int divisor; + + divisor = gd->bus_clk / (1000000 * (OCTEON_IS_MODEL (OCTEON_CN68XX ) ?10 :25 )); + + divisor = (divisor -1 ) >>2 ; +/* Convert the divisor into a power of 2 shift */ +while (divisor) { + clock_div++; + divisor >>=1 ; + } + +/* +* Clock divider for QLM JTAG operations. sclk is divided by +* 2^(CLK_DIV + 2) +*/ + jtgc.u64 =0 ; + jtgc.s.clk_div = clock_div; + jtgc.s.mux_sel =0 ; +if (OCTEON_IS_MODEL (OCTEON_CN63XX ) ||OCTEON_IS_MODEL (OCTEON_CN66XX )) + jtgc.s.bypass =0x7 ; +else + jtgc.s.bypass =0xf ; +if (OCTEON_IS_MODEL (OCTEON_CN68XX )) + jtgc.s.bypass_ext =1 ; +csr_wr (CVMX_CIU_QLM_JTGC , jtgc.u64); +csr_rd (CVMX_CIU_QLM_JTGC ); +} + +/** +* Write up to 32bits into the QLM jtag chain. Bits are shifted +* into the MSB and out the LSB, so you should shift in the low +* order bits followed by the high order bits. The JTAG chain for +* CN52XX and CN56XX is 4 * 268 bits long, or 1072. The JTAG chain +* for CN63XX is 4 * 300 bits long, or 1200. +* +* @param qlm QLM to shift value into +* @param bits Number of bits to shift in (1-32). +* @param data Data to shift in. Bit 0 enters the chain first, followed by +* bit 1, etc. +* +* @return The low order bits of the JTAG chain that shifted out of the +* circle. +*/ +uint32_t cvmx_helper_qlm_jtag_shift (int qlm,int bits,uint32_t data) +{ +union cvmx_ciu_qlm_jtgc jtgc; +union cvmx_ciu_qlm_jtgd jtgd; + + jtgc.u64 =csr_rd (CVMX_CIU_QLM_JTGC ); + jtgc.s.mux_sel = qlm; +csr_wr (CVMX_CIU_QLM_JTGC , jtgc.u64); +csr_rd (CVMX_CIU_QLM_JTGC ); + + jtgd.u64 =0 ; + jtgd.s.shift =1 ; + jtgd.s.shft_cnt = bits -1 ; + jtgd.s.shft_reg = data; + jtgd.s.select =1 << qlm; +csr_wr (CVMX_CIU_QLM_JTGD , jtgd.u64); +do { + jtgd.u64 =csr_rd (CVMX_CIU_QLM_JTGD ); + }while (jtgd.s.shift); +return jtgd.s.shft_reg >> (32 - bits); +} + +/** +* Shift long sequences of zeros into the QLM JTAG chain. It is +* common to need to shift more than 32 bits of zeros into the +* chain. This function is a convience wrapper around +* cvmx_helper_qlm_jtag_shift() to shift more than 32 bits of +* zeros at a time. +* +* @param qlm QLM to shift zeros into +* @param bits +*/ +void cvmx_helper_qlm_jtag_shift_zeros (int qlm,int bits) +{ +while (bits >0 ) { +int n = bits; + +if (n >32 ) + n =32 ; +cvmx_helper_qlm_jtag_shift (qlm, n,0 ); + bits -= n; + } +} + +/** +* Program the QLM JTAG chain into all lanes of the QLM. You must +* have already shifted in the proper number of bits into the +* JTAG chain. Updating invalid values can possibly cause chip damage. +* +* @param qlm QLM to program +*/ +void cvmx_helper_qlm_jtag_update (int qlm) +{ +union cvmx_ciu_qlm_jtgc jtgc; +union cvmx_ciu_qlm_jtgd jtgd; + + jtgc.u64 =csr_rd (CVMX_CIU_QLM_JTGC ); + jtgc.s.mux_sel = qlm; + +csr_wr (CVMX_CIU_QLM_JTGC , jtgc.u64); +csr_rd (CVMX_CIU_QLM_JTGC ); + +/* Update the new data */ + jtgd.u64 =0 ; + jtgd.s.update =1 ; + jtgd.s.select =1 << qlm; +csr_wr (CVMX_CIU_QLM_JTGD , jtgd.u64); +do { + jtgd.u64 =csr_rd (CVMX_CIU_QLM_JTGD ); + }while (jtgd.s.update); +} + +/** +* Load the QLM JTAG chain with data from all lanes of the QLM. +* +* @param qlm QLM to program +*/ +void cvmx_helper_qlm_jtag_capture (int qlm) +{ +union cvmx_ciu_qlm_jtgc jtgc; +union cvmx_ciu_qlm_jtgd jtgd; + + jtgc.u64 =csr_rd (CVMX_CIU_QLM_JTGC ); + jtgc.s.mux_sel = qlm; + +csr_wr (CVMX_CIU_QLM_JTGC , jtgc.u64); +csr_rd (CVMX_CIU_QLM_JTGC ); + + jtgd.u64 =0 ; + jtgd.s.capture =1 ; + jtgd.s.select =1 << qlm; +csr_wr (CVMX_CIU_QLM_JTGD , jtgd.u64); +do { + jtgd.u64 =csr_rd (CVMX_CIU_QLM_JTGD ); + }while (jtgd.s.capture); +}
Signature · 1 line
2.29.2
PATCH 39/50 mips: octeon: Add cvmx-helper-util.c
In reply to Stefan RoeseFrom: Aaron Williams <[email protected]>
Import cvmx-helper-util.c from 2013 U-Boot. It will be used by the later added drivers to support PCIe and networking on the MIPS Octeon II / III platforms.
---
arch/mips/mach-octeon/cvmx-helper-util.c | 1225 ++++++++++++++++++++++ 1 file changed, 1225 insertions(+) create mode 100644 arch/mips/mach-octeon/cvmx-helper-util.c
arch/mips/mach-octeon/cvmx-helper-util.c new file +1225 -0
@@ -0,0 +1,1225 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (C) 2020 Marvell International Ltd. +* +* Small helper utilities. +*/ + +#include <log.h> +#include <time.h> +#include <linux/delay.h> + +#include <mach/cvmx-regs.h> +#include <mach/cvmx-csr-enums.h> +#include <mach/octeon-model.h> +#include <mach/octeon-feature.h> +#include <mach/cvmx-gmxx-defs.h> +#include <mach/cvmx-ipd-defs.h> +#include <mach/cvmx-pko-defs.h> +#include <mach/cvmx-ipd.h> +#include <mach/cvmx-hwpko.h> +#include <mach/cvmx-pki.h> +#include <mach/cvmx-pip.h> +#include <mach/cvmx-helper.h> +#include <mach/cvmx-helper-util.h> +#include <mach/cvmx-helper-pki.h> + +/** +* @INTERNAL +* These are the interface types needed to convert interface numbers to ipd +* ports. +* +* @param GMII +* This type is used for sgmii, rgmii, xaui and rxaui interfaces. +* @param ILK +* This type is used for ilk interfaces. +* @param SRIO +* This type is used for serial-RapidIo interfaces. +* @param NPI +* This type is used for npi interfaces. +* @param LB +* This type is used for loopback interfaces. +* @param INVALID_IF_TYPE +* This type indicates the interface hasn't been configured. +*/ +enum port_map_if_type {INVALID_IF_TYPE =0 ,GMII ,ILK ,SRIO ,NPI ,LB }; + +/** +* @INTERNAL +* This structure is used to map interface numbers to ipd ports. +* +* @param type +* Interface type +* @param first_ipd_port +* First IPD port number assigned to this interface. +* @param last_ipd_port +* Last IPD port number assigned to this interface. +* @param ipd_port_adj +* Different octeon chips require different ipd ports for the +* same interface port/mode configuration. This value is used +* to account for that difference. +*/ +struct ipd_port_map { +enum port_map_if_type type; +int first_ipd_port; +int last_ipd_port; +int ipd_port_adj; +}; + +/** +* @INTERNAL +* Interface number to ipd port map for the octeon 68xx. +*/ +static const struct ipd_port_map ipd_port_map_68xx[CVMX_HELPER_MAX_IFACE ] = { + {GMII ,0x800 ,0x8ff ,0x40 },/* Interface 0 */ + {GMII ,0x900 ,0x9ff ,0x40 },/* Interface 1 */ + {GMII ,0xa00 ,0xaff ,0x40 },/* Interface 2 */ + {GMII ,0xb00 ,0xbff ,0x40 },/* Interface 3 */ + {GMII ,0xc00 ,0xcff ,0x40 },/* Interface 4 */ + {ILK ,0x400 ,0x4ff ,0x00 },/* Interface 5 */ + {ILK ,0x500 ,0x5ff ,0x00 },/* Interface 6 */ + {NPI ,0x100 ,0x120 ,0x00 },/* Interface 7 */ + {LB ,0x000 ,0x008 ,0x00 },/* Interface 8 */ +}; + +/** +* @INTERNAL +* Interface number to ipd port map for the octeon 78xx. +* +* This mapping corresponds to WQE(CHAN) enumeration in +* HRM Sections 11.15, PKI_CHAN_E, Section 11.6 +* +*/ +static const struct ipd_port_map ipd_port_map_78xx[CVMX_HELPER_MAX_IFACE ] = { + {GMII ,0x800 ,0x83f ,0x00 },/* Interface 0 - BGX0 */ + {GMII ,0x900 ,0x93f ,0x00 },/* Interface 1 -BGX1 */ + {GMII ,0xa00 ,0xa3f ,0x00 },/* Interface 2 -BGX2 */ + {GMII ,0xb00 ,0xb3f ,0x00 },/* Interface 3 - BGX3 */ + {GMII ,0xc00 ,0xc3f ,0x00 },/* Interface 4 - BGX4 */ + {GMII ,0xd00 ,0xd3f ,0x00 },/* Interface 5 - BGX5 */ + {ILK ,0x400 ,0x4ff ,0x00 },/* Interface 6 - ILK0 */ + {ILK ,0x500 ,0x5ff ,0x00 },/* Interface 7 - ILK1 */ + {NPI ,0x100 ,0x13f ,0x00 },/* Interface 8 - DPI */ + {LB ,0x000 ,0x03f ,0x00 },/* Interface 9 - LOOPBACK */ +}; + +/** +* @INTERNAL +* Interface number to ipd port map for the octeon 73xx. +*/ +static const struct ipd_port_map ipd_port_map_73xx[CVMX_HELPER_MAX_IFACE ] = { + {GMII ,0x800 ,0x83f ,0x00 },/* Interface 0 - BGX(0,0-3) */ + {GMII ,0x900 ,0x93f ,0x00 },/* Interface 1 -BGX(1,0-3) */ + {GMII ,0xa00 ,0xa3f ,0x00 },/* Interface 2 -BGX(2,0-3) */ + {NPI ,0x100 ,0x17f ,0x00 },/* Interface 3 - DPI */ + {LB ,0x000 ,0x03f ,0x00 },/* Interface 4 - LOOPBACK */ +}; + +/** +* @INTERNAL +* Interface number to ipd port map for the octeon 75xx. +*/ +static const struct ipd_port_map ipd_port_map_75xx[CVMX_HELPER_MAX_IFACE ] = { + {GMII ,0x800 ,0x83f ,0x00 },/* Interface 0 - BGX0 */ + {SRIO ,0x240 ,0x241 ,0x00 },/* Interface 1 - SRIO 0 */ + {SRIO ,0x242 ,0x243 ,0x00 },/* Interface 2 - SRIO 1 */ + {NPI ,0x100 ,0x13f ,0x00 },/* Interface 3 - DPI */ + {LB ,0x000 ,0x03f ,0x00 },/* Interface 4 - LOOPBACK */ +}; + +/** +* Convert a interface mode into a human readable string +* +* @param mode Mode to convert +* +* @return String +*/ +const char *cvmx_helper_interface_mode_to_string (cvmx_helper_interface_mode_t mode) +{ +switch (mode) { +case CVMX_HELPER_INTERFACE_MODE_DISABLED : +return "DISABLED" ; +case CVMX_HELPER_INTERFACE_MODE_RGMII : +return "RGMII" ; +case CVMX_HELPER_INTERFACE_MODE_GMII : +return "GMII" ; +case CVMX_HELPER_INTERFACE_MODE_SPI : +return "SPI" ; +case CVMX_HELPER_INTERFACE_MODE_PCIE : +return "PCIE" ; +case CVMX_HELPER_INTERFACE_MODE_XAUI : +return "XAUI" ; +case CVMX_HELPER_INTERFACE_MODE_RXAUI : +return "RXAUI" ; +case CVMX_HELPER_INTERFACE_MODE_SGMII : +return "SGMII" ; +case CVMX_HELPER_INTERFACE_MODE_QSGMII : +return "QSGMII" ; +case CVMX_HELPER_INTERFACE_MODE_PICMG : +return "PICMG" ; +case CVMX_HELPER_INTERFACE_MODE_NPI : +return "NPI" ; +case CVMX_HELPER_INTERFACE_MODE_LOOP : +return "LOOP" ; +case CVMX_HELPER_INTERFACE_MODE_SRIO : +return "SRIO" ; +case CVMX_HELPER_INTERFACE_MODE_ILK : +return "ILK" ; +case CVMX_HELPER_INTERFACE_MODE_AGL : +return "AGL" ; +case CVMX_HELPER_INTERFACE_MODE_XLAUI : +return "XLAUI" ; +case CVMX_HELPER_INTERFACE_MODE_XFI : +return "XFI" ; +case CVMX_HELPER_INTERFACE_MODE_40G_KR4 : +return "40G_KR4" ; +case CVMX_HELPER_INTERFACE_MODE_10G_KR : +return "10G_KR" ; +case CVMX_HELPER_INTERFACE_MODE_MIXED : +return "MIXED" ; + } +return "UNKNOWN" ; +} + +/** +* Debug routine to dump the packet structure to the console +* +* @param work Work queue entry containing the packet to dump +* @return +*/ +int cvmx_helper_dump_packet (cvmx_wqe_t *work) +{ +u64 count; +u64 remaining_bytes; +union cvmx_buf_ptr buffer_ptr; +cvmx_buf_ptr_pki_t bptr; +cvmx_wqe_78xx_t *wqe = (void *)work; +u64 start_of_buffer; +u8 *data_address; +u8 *end_of_data; + +if (octeon_has_feature (OCTEON_FEATURE_CN78XX_WQE )) { +cvmx_pki_dump_wqe (wqe); +cvmx_wqe_pki_errata_20776 (work); + }else { +debug ("WORD0 = %lx\n" , (unsigned long )work->word0.u64); +debug ("WORD1 = %lx\n" , (unsigned long )work->word1.u64); +debug ("WORD2 = %lx\n" , (unsigned long )work->word2.u64); +debug ("Packet Length: %u\n" ,cvmx_wqe_get_len (work)); +debug (" Input Port: %u\n" ,cvmx_wqe_get_port (work)); +debug (" QoS: %u\n" ,cvmx_wqe_get_qos (work)); +debug (" Buffers: %u\n" ,cvmx_wqe_get_bufs (work)); + } + +if (cvmx_wqe_get_bufs (work) ==0 ) { +int wqe_pool; + +if (octeon_has_feature (OCTEON_FEATURE_CN78XX_WQE )) { +debug ("%s: ERROR: Unexpected bufs==0 in WQE\n" , __func__); +return -1 ; + } + wqe_pool = (int )cvmx_fpa_get_wqe_pool (); + buffer_ptr.u64 =0 ; + buffer_ptr.s.pool = wqe_pool; + + buffer_ptr.s.size =128 ; + buffer_ptr.s.addr =cvmx_ptr_to_phys (work->packet_data); +if (cvmx_likely (!work->word2.s.not_IP)) { +union cvmx_pip_ip_offset pip_ip_offset; + + pip_ip_offset.u64 =csr_rd (CVMX_PIP_IP_OFFSET ); + buffer_ptr.s.addr += + (pip_ip_offset.s.offset <<3 ) - work->word2.s.ip_offset; + buffer_ptr.s.addr += (work->word2.s.is_v6 ^1 ) <<2 ; + }else { +/* +* WARNING: This code assume that the packet +* is not RAW. If it was, we would use +* PIP_GBL_CFG[RAW_SHF] instead of +* PIP_GBL_CFG[NIP_SHF]. +*/ +union cvmx_pip_gbl_cfg pip_gbl_cfg; + + pip_gbl_cfg.u64 =csr_rd (CVMX_PIP_GBL_CFG ); + buffer_ptr.s.addr += pip_gbl_cfg.s.nip_shf; + } + }else { + buffer_ptr = work->packet_ptr; + } + + remaining_bytes =cvmx_wqe_get_len (work); + +while (remaining_bytes) { +/* native cn78xx buffer format, unless legacy-translated */ +if (octeon_has_feature (OCTEON_FEATURE_CN78XX_WQE ) && !wqe->pki_wqe_translated) { + bptr.u64 = buffer_ptr.u64; +/* XXX- assumes cache-line aligned buffer */ + start_of_buffer = (bptr.addr >>7 ) <<7 ; +debug (" Buffer Start:%llx\n" , (unsigned long long )start_of_buffer); +debug (" Buffer Data: %llx\n" , (unsigned long long )bptr.addr); +debug (" Buffer Size: %u\n" , bptr.size); + data_address = (uint8_t *)cvmx_phys_to_ptr (bptr.addr); + end_of_data = data_address + bptr.size; + }else { + start_of_buffer = ((buffer_ptr.s.addr >>7 ) - buffer_ptr.s.back) <<7 ; +debug (" Buffer Start:%llx\n" , (unsigned long long )start_of_buffer); +debug (" Buffer I : %u\n" , buffer_ptr.s.i); +debug (" Buffer Back: %u\n" , buffer_ptr.s.back); +debug (" Buffer Pool: %u\n" , buffer_ptr.s.pool); +debug (" Buffer Data: %llx\n" , (unsigned long long )buffer_ptr.s.addr); +debug (" Buffer Size: %u\n" , buffer_ptr.s.size); + data_address = (uint8_t *)cvmx_phys_to_ptr (buffer_ptr.s.addr); + end_of_data = data_address + buffer_ptr.s.size; + } + +debug ("\t\t" ); + count =0 ; +while (data_address < end_of_data) { +if (remaining_bytes ==0 ) +break ; + + remaining_bytes--; +debug ("%02x" , (unsigned int )*data_address); + data_address++; +if (remaining_bytes && count ==7 ) { +debug ("\n\t\t" ); + count =0 ; + }else { + count++; + } + } +debug ("\n" ); + +if (remaining_bytes) { +if (octeon_has_feature (OCTEON_FEATURE_CN78XX_WQE ) && + !wqe->pki_wqe_translated) + buffer_ptr.u64 = *(uint64_t *)cvmx_phys_to_ptr (bptr.addr -8 ); +else + buffer_ptr.u64 = + *(uint64_t *)cvmx_phys_to_ptr (buffer_ptr.s.addr -8 ); + } + } +return 0 ; +} + +/** +* @INTERNAL +* +* Extract NO_WPTR mode from PIP/IPD register +*/ +static int __cvmx_ipd_mode_no_wptr (void ) +{ +if (octeon_has_feature (OCTEON_FEATURE_NO_WPTR )) { +cvmx_ipd_ctl_status_t ipd_ctl_status; + + ipd_ctl_status.u64 =csr_rd (CVMX_IPD_CTL_STATUS ); +return ipd_ctl_status.s.no_wptr; + } +return 0 ; +} + +static cvmx_buf_ptr_t __cvmx_packet_short_ptr[4 ]; +static int8_t __cvmx_wqe_pool =-1 ; + +/** +* @INTERNAL +* Prepare packet pointer templace for dynamic short +* packets. +*/ +static void cvmx_packet_short_ptr_calculate (void ) +{ +unsigned int i, off; +union cvmx_pip_gbl_cfg pip_gbl_cfg; +union cvmx_pip_ip_offset pip_ip_offset; + +/* Fill in the common values for all cases */ +for (i =0 ; i <4 ; i++) { +if (__cvmx_ipd_mode_no_wptr ()) +/* packet pool, set to 0 in hardware */ + __cvmx_wqe_pool =0 ; +else +/* WQE pool as configured */ + __cvmx_wqe_pool =csr_rd (CVMX_IPD_WQE_FPA_QUEUE ) &7 ; + + __cvmx_packet_short_ptr[i].s.pool = __cvmx_wqe_pool; + __cvmx_packet_short_ptr[i].s.size =cvmx_fpa_get_block_size (__cvmx_wqe_pool); + __cvmx_packet_short_ptr[i].s.size -=32 ; + __cvmx_packet_short_ptr[i].s.addr =32 ; + } + + pip_gbl_cfg.u64 =csr_rd (CVMX_PIP_GBL_CFG ); + pip_ip_offset.u64 =csr_rd (CVMX_PIP_IP_OFFSET ); + +/* RAW_FULL: index = 0 */ + i =0 ; + off = pip_gbl_cfg.s.raw_shf; + __cvmx_packet_short_ptr[i].s.addr += off; + __cvmx_packet_short_ptr[i].s.size -= off; + __cvmx_packet_short_ptr[i].s.back += off >>7 ; + +/* NON-IP: index = 1 */ + i =1 ; + off = pip_gbl_cfg.s.nip_shf; + __cvmx_packet_short_ptr[i].s.addr += off; + __cvmx_packet_short_ptr[i].s.size -= off; + __cvmx_packet_short_ptr[i].s.back += off >>7 ; + +/* IPv4: index = 2 */ + i =2 ; + off = (pip_ip_offset.s.offset <<3 ) +4 ; + __cvmx_packet_short_ptr[i].s.addr += off; + __cvmx_packet_short_ptr[i].s.size -= off; + __cvmx_packet_short_ptr[i].s.back += off >>7 ; + +/* IPv6: index = 3 */ + i =3 ; + off = (pip_ip_offset.s.offset <<3 ) +0 ; + __cvmx_packet_short_ptr[i].s.addr += off; + __cvmx_packet_short_ptr[i].s.size -= off; + __cvmx_packet_short_ptr[i].s.back += off >>7 ; + +/* For IPv4/IPv6: subtract work->word2.s.ip_offset +* to addr, if it is smaller than IP_OFFSET[OFFSET]*8 +* which is stored in __cvmx_packet_short_ptr[3].s.addr +*/ +} + +/** +* Extract packet data buffer pointer from work queue entry. +* +* Returns the legacy (Octeon1/Octeon2) buffer pointer structure +* for the linked buffer list. +* On CN78XX, the native buffer pointer structure is converted into +* the legacy format. +* The legacy buf_ptr is then stored in the WQE, and word0 reserved +* field is set to indicate that the buffer pointers were translated. +* If the packet data is only found inside the work queue entry, +* a standard buffer pointer structure is created for it. +*/ +cvmx_buf_ptr_t cvmx_wqe_get_packet_ptr (cvmx_wqe_t *work) +{ +if (octeon_has_feature (OCTEON_FEATURE_CN78XX_WQE )) { +cvmx_wqe_78xx_t *wqe = (void *)work; +cvmx_buf_ptr_t optr, lptr; +cvmx_buf_ptr_pki_t nptr; +unsigned int pool, bufs; +int node =cvmx_get_node_num (); + +/* In case of repeated calls of this function */ +if (wqe->pki_wqe_translated || wqe->word2.software) { + optr.u64 = wqe->packet_ptr.u64; +return optr; + } + + bufs = wqe->word0.bufs; + pool = wqe->word0.aura; + nptr.u64 = wqe->packet_ptr.u64; + + optr.u64 =0 ; + optr.s.pool = pool; + optr.s.addr = nptr.addr; +if (bufs ==1 ) { + optr.s.size = pki_dflt_pool[node].buffer_size - + pki_dflt_style[node].parm_cfg.first_skip -8 - + wqe->word0.apad; + }else { + optr.s.size = nptr.size; + } + +/* Calculate the "back" offset */ +if (!nptr.packet_outside_wqe) { + optr.s.back = (nptr.addr - +cvmx_ptr_to_phys (wqe)) >>7 ; + }else { + optr.s.back = + (pki_dflt_style[node].parm_cfg.first_skip + +8 + wqe->word0.apad) >>7 ; + } + lptr = optr; + +/* Follow pointer and convert all linked pointers */ +while (bufs >1 ) { +void *vptr; + + vptr =cvmx_phys_to_ptr (lptr.s.addr); + +memcpy (&nptr, vptr -8 ,8 ); +/* +* Errata (PKI-20776) PKI_BUFLINK_S's are endian-swapped +* CN78XX pass 1.x has a bug where the packet pointer +* in each segment is written in the opposite +* endianness of the configured mode. Fix these here +*/ +if (OCTEON_IS_MODEL (OCTEON_CN78XX_PASS1_X )) + nptr.u64 =__builtin_bswap64 (nptr.u64); + lptr.u64 =0 ; + lptr.s.pool = pool; + lptr.s.addr = nptr.addr; + lptr.s.size = nptr.size; + lptr.s.back = (pki_dflt_style[0 ].parm_cfg.later_skip +8 ) >> +7 ;/* TBD: not guaranteed !! */ + +memcpy (vptr -8 , &lptr,8 ); + bufs--; + } +/* Store translated bufptr in WQE, and set indicator */ + wqe->pki_wqe_translated =1 ; + wqe->packet_ptr.u64 = optr.u64; +return optr; + + }else { +unsigned int i; +unsigned int off =0 ; +cvmx_buf_ptr_t bptr; + +if (cvmx_likely (work->word2.s.bufs >0 )) +return work->packet_ptr; + +if (cvmx_unlikely (work->word2.s.software)) +return work->packet_ptr; + +/* first packet, precalculate packet_ptr templaces */ +if (cvmx_unlikely (__cvmx_packet_short_ptr[0 ].u64 ==0 )) +cvmx_packet_short_ptr_calculate (); + +/* calculate templace index */ + i = work->word2.s_cn38xx.not_IP | work->word2.s_cn38xx.rcv_error; + i =2 ^ (i <<1 ); + +/* IPv4/IPv6: Adjust IP offset */ +if (cvmx_likely (i &2 )) { + i |= work->word2.s.is_v6; + off = work->word2.s.ip_offset; + }else { +/* RAWFULL/RAWSCHED should be handled here */ + i =1 ;/* not-IP */ + off =0 ; + } + +/* Get the right templace */ + bptr = __cvmx_packet_short_ptr[i]; + bptr.s.addr -= off; + bptr.s.back = bptr.s.addr >>7 ; + +/* Add actual WQE paddr to the templace offset */ + bptr.s.addr +=cvmx_ptr_to_phys (work); + +/* Adjust word2.bufs so that _free_data() handles it +* in the same way as PKO +*/ + work->word2.s.bufs =1 ; + +/* Store the new buffer pointer back into WQE */ + work->packet_ptr = bptr; + +/* Returned the synthetic buffer_pointer */ +return bptr; + } +} + +void cvmx_wqe_free (cvmx_wqe_t *work) +{ +unsigned int bufs, ncl =1 ; +u64 paddr, paddr1; + +if (octeon_has_feature (OCTEON_FEATURE_CN78XX_WQE )) { +cvmx_wqe_78xx_t *wqe = (void *)work; +cvmx_fpa3_gaura_t aura; +cvmx_buf_ptr_pki_t bptr; + + bufs = wqe->word0.bufs; + +if (!wqe->pki_wqe_translated && bufs !=0 ) { +/* Handle cn78xx native untralsated WQE */ + + bptr = wqe->packet_ptr; + +/* Do nothing - first packet buffer shares WQE buffer */ +if (!bptr.packet_outside_wqe) +return ; + }else if (cvmx_likely (bufs !=0 )) { +/* Handle translated 78XX WQE */ + paddr = (work->packet_ptr.s.addr & (~0x7full )) - + (work->packet_ptr.s.back <<7 ); + paddr1 =cvmx_ptr_to_phys (work); + +/* do not free WQE if contains first data buffer */ +if (paddr == paddr1) +return ; + } + +/* WQE is separate from packet buffer, free it */ + aura =__cvmx_fpa3_gaura (wqe->word0.aura >>10 , wqe->word0.aura &0x3ff ); + +cvmx_fpa3_free (work, aura, ncl); + }else { +/* handle legacy WQE */ + bufs = work->word2.s_cn38xx.bufs; + +if (cvmx_likely (bufs !=0 )) { +/* Check if the first data buffer is inside WQE */ + paddr = (work->packet_ptr.s.addr & (~0x7full )) - + (work->packet_ptr.s.back <<7 ); + paddr1 =cvmx_ptr_to_phys (work); + +/* do not free WQE if contains first data buffer */ +if (paddr == paddr1) +return ; + } + +/* precalculate packet_ptr, WQE pool number */ +if (cvmx_unlikely (__cvmx_wqe_pool <0 )) +cvmx_packet_short_ptr_calculate (); +cvmx_fpa1_free (work, __cvmx_wqe_pool, ncl); + } +} + +/** +* Free the packet buffers contained in a work queue entry. +* The work queue entry is also freed if it contains packet data. +* If however the packet starts outside the WQE, the WQE will +* not be freed. The application should call cvmx_wqe_free() +* to free the WQE buffer that contains no packet data. +* +* @param work Work queue entry with packet to free +*/ +void cvmx_helper_free_packet_data (cvmx_wqe_t *work) +{ +u64 number_buffers; +u64 start_of_buffer; +u64 next_buffer_ptr; +cvmx_fpa3_gaura_t aura; +unsigned int ncl; +cvmx_buf_ptr_t buffer_ptr; +cvmx_buf_ptr_pki_t bptr; +cvmx_wqe_78xx_t *wqe = (void *)work; +int o3_pki_wqe =0 ; + + number_buffers =cvmx_wqe_get_bufs (work); + + buffer_ptr.u64 = work->packet_ptr.u64; + +/* Zero-out WQE WORD3 so that the WQE is freed by cvmx_wqe_free() */ + work->packet_ptr.u64 =0 ; + +if (number_buffers ==0 ) +return ; + +/* Interpret PKI-style bufptr unless it has been translated */ +if (octeon_has_feature (OCTEON_FEATURE_CN78XX_WQE ) && + !wqe->pki_wqe_translated) { + o3_pki_wqe =1 ; +cvmx_wqe_pki_errata_20776 (work); + aura =__cvmx_fpa3_gaura (wqe->word0.aura >>10 , + wqe->word0.aura &0x3ff ); + }else { + start_of_buffer = ((buffer_ptr.s.addr >>7 ) - + buffer_ptr.s.back) <<7 ; + next_buffer_ptr = + *(uint64_t *)cvmx_phys_to_ptr (buffer_ptr.s.addr -8 ); +/* +* Since the number of buffers is not zero, we know this is not +* a dynamic short packet. We need to check if it is a packet +* received with IPD_CTL_STATUS[NO_WPTR]. If this is true, +* we need to free all buffers except for the first one. +* The caller doesn't expect their WQE pointer to be freed +*/ +if (cvmx_ptr_to_phys (work) == start_of_buffer) { + buffer_ptr.u64 = next_buffer_ptr; + number_buffers--; + } + } +while (number_buffers--) { +if (o3_pki_wqe) { + bptr.u64 = buffer_ptr.u64; + + ncl = (bptr.size +CVMX_CACHE_LINE_SIZE -1 ) / +CVMX_CACHE_LINE_SIZE ; + +/* XXX- assumes the buffer is cache-line aligned */ + start_of_buffer = (bptr.addr >>7 ) <<7 ; + +/* +* Read pointer to next buffer before we free the +* current buffer. +*/ + next_buffer_ptr = *(uint64_t *)cvmx_phys_to_ptr (bptr.addr -8 ); +/* FPA AURA comes from WQE, includes node */ +cvmx_fpa3_free (cvmx_phys_to_ptr (start_of_buffer), + aura, ncl); + }else { + ncl = (buffer_ptr.s.size +CVMX_CACHE_LINE_SIZE -1 ) / +CVMX_CACHE_LINE_SIZE + + buffer_ptr.s.back; +/* +* Calculate buffer start using "back" offset, +* Remember the back pointer is in cache lines, +* not 64bit words +*/ + start_of_buffer = ((buffer_ptr.s.addr >>7 ) - + buffer_ptr.s.back) <<7 ; +/* +* Read pointer to next buffer before we free +* the current buffer. +*/ + next_buffer_ptr = + *(uint64_t *)cvmx_phys_to_ptr (buffer_ptr.s.addr -8 ); +/* FPA pool comes from buf_ptr itself */ +if (octeon_has_feature (OCTEON_FEATURE_CN78XX_WQE )) { + aura =cvmx_fpa1_pool_to_fpa3_aura (buffer_ptr.s.pool); +cvmx_fpa3_free (cvmx_phys_to_ptr (start_of_buffer), + aura, ncl); + }else { +cvmx_fpa1_free (cvmx_phys_to_ptr (start_of_buffer), + buffer_ptr.s.pool, ncl); + } + } + buffer_ptr.u64 = next_buffer_ptr; + } +} + +void cvmx_helper_setup_legacy_red (int pass_thresh,int drop_thresh) +{ +unsigned int node =cvmx_get_node_num (); +int aura, bpid; +int buf_cnt; +bool ena_red =0 , ena_drop =0 , ena_bp =0 ; + +#define FPA_RED_AVG_DLY 1 +#define FPA_RED_LVL_DLY 3 +#define FPA_QOS_AVRG 0 +/* Trying to make it backward compatible with older chips */ + +/* Setting up avg_dly and prb_dly, enable bits */ +if (octeon_has_feature (OCTEON_FEATURE_FPA3 )) { +cvmx_fpa3_config_red_params (node,FPA_QOS_AVRG , +FPA_RED_LVL_DLY ,FPA_RED_AVG_DLY ); + } + +/* Disable backpressure on queued buffers which is aura in 78xx*/ +/* +* Assumption is that all packets from all interface and ports goes +* in same poolx/aurax for backward compatibility +*/ + aura =cvmx_fpa_get_packet_pool (); + buf_cnt =cvmx_fpa_get_packet_pool_buffer_count (); + pass_thresh = buf_cnt - pass_thresh; + drop_thresh = buf_cnt - drop_thresh; +/* Map aura to bpid 0*/ + bpid =0 ; +cvmx_pki_write_aura_bpid (node, aura, bpid); +/* Don't enable back pressure */ + ena_bp =0 ; +/* enable RED */ + ena_red =1 ; +/* +* This will enable RED on all interfaces since +* they all have packet buffer coming from same aura +*/ +cvmx_helper_setup_aura_qos (node, aura, ena_red, ena_drop, pass_thresh, + drop_thresh, ena_bp,0 ); +} + +/** +* Setup Random Early Drop to automatically begin dropping packets. +* +* @param pass_thresh +* Packets will begin slowly dropping when there are less than +* this many packet buffers free in FPA 0. +* @param drop_thresh +* All incoming packets will be dropped when there are less +* than this many free packet buffers in FPA 0. +* @return Zero on success. Negative on failure +*/ +int cvmx_helper_setup_red (int pass_thresh,int drop_thresh) +{ +if (octeon_has_feature (OCTEON_FEATURE_PKI )) +cvmx_helper_setup_legacy_red (pass_thresh, drop_thresh); +else +cvmx_ipd_setup_red (pass_thresh, drop_thresh); +return 0 ; +} + +/** +* @INTERNAL +* Setup the common GMX settings that determine the number of +* ports. These setting apply to almost all configurations of all +* chips. +* +* @param xiface Interface to configure +* @param num_ports Number of ports on the interface +* +* @return Zero on success, negative on failure +*/ +int __cvmx_helper_setup_gmx (int xiface,int num_ports) +{ +union cvmx_gmxx_tx_prts gmx_tx_prts; +union cvmx_gmxx_rx_prts gmx_rx_prts; +union cvmx_pko_reg_gmx_port_mode pko_mode; +union cvmx_gmxx_txx_thresh gmx_tx_thresh; +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); +int index; + +/* +* The common BGX settings are already done in the appropriate +* enable functions, nothing to do here. +*/ +if (octeon_has_feature (OCTEON_FEATURE_BGX )) +return 0 ; + +/* Tell GMX the number of TX ports on this interface */ + gmx_tx_prts.u64 =csr_rd (CVMX_GMXX_TX_PRTS (xi.interface)); + gmx_tx_prts.s.prts = num_ports; +csr_wr (CVMX_GMXX_TX_PRTS (xi.interface), gmx_tx_prts.u64); + +/* +* Tell GMX the number of RX ports on this interface. This only applies +* to *GMII and XAUI ports. +*/ +switch (cvmx_helper_interface_get_mode (xiface)) { +case CVMX_HELPER_INTERFACE_MODE_RGMII : +case CVMX_HELPER_INTERFACE_MODE_SGMII : +case CVMX_HELPER_INTERFACE_MODE_QSGMII : +case CVMX_HELPER_INTERFACE_MODE_GMII : +case CVMX_HELPER_INTERFACE_MODE_XAUI : +case CVMX_HELPER_INTERFACE_MODE_RXAUI : +if (num_ports >4 ) { +debug ("%s: Illegal num_ports\n" , __func__); +return -1 ; + } + + gmx_rx_prts.u64 =csr_rd (CVMX_GMXX_RX_PRTS (xi.interface)); + gmx_rx_prts.s.prts = num_ports; +csr_wr (CVMX_GMXX_RX_PRTS (xi.interface), gmx_rx_prts.u64); +break ; + +default : +break ; + } + +/* +* Skip setting CVMX_PKO_REG_GMX_PORT_MODE on 30XX, 31XX, 50XX, +* and 68XX. +*/ +if (!OCTEON_IS_MODEL (OCTEON_CN68XX )) { +/* Tell PKO the number of ports on this interface */ + pko_mode.u64 =csr_rd (CVMX_PKO_REG_GMX_PORT_MODE ); +if (xi.interface ==0 ) { +if (num_ports ==1 ) + pko_mode.s.mode0 =4 ; +else if (num_ports ==2 ) + pko_mode.s.mode0 =3 ; +else if (num_ports <=4 ) + pko_mode.s.mode0 =2 ; +else if (num_ports <=8 ) + pko_mode.s.mode0 =1 ; +else + pko_mode.s.mode0 =0 ; + }else { +if (num_ports ==1 ) + pko_mode.s.mode1 =4 ; +else if (num_ports ==2 ) + pko_mode.s.mode1 =3 ; +else if (num_ports <=4 ) + pko_mode.s.mode1 =2 ; +else if (num_ports <=8 ) + pko_mode.s.mode1 =1 ; +else + pko_mode.s.mode1 =0 ; + } +csr_wr (CVMX_PKO_REG_GMX_PORT_MODE , pko_mode.u64); + } + +/* +* Set GMX to buffer as much data as possible before starting +* transmit. This reduces the chances that we have a TX under run +* due to memory contention. Any packet that fits entirely in the +* GMX FIFO can never have an under run regardless of memory load. +*/ + gmx_tx_thresh.u64 =csr_rd (CVMX_GMXX_TXX_THRESH (0 , xi.interface)); +/* ccn - common cnt numberator */ +int ccn =0x100 ; + +/* Choose the max value for the number of ports */ +if (num_ports <=1 ) + gmx_tx_thresh.s.cnt = ccn /1 ; +else if (num_ports ==2 ) + gmx_tx_thresh.s.cnt = ccn /2 ; +else + gmx_tx_thresh.s.cnt = ccn /4 ; + +/* +* SPI and XAUI can have lots of ports but the GMX hardware +* only ever has a max of 4 +*/ +if (num_ports >4 ) + num_ports =4 ; +for (index =0 ; index < num_ports; index++) +csr_wr (CVMX_GMXX_TXX_THRESH (index, xi.interface), gmx_tx_thresh.u64); + +/* +* For o68, we need to setup the pipes +*/ +if (OCTEON_IS_MODEL (OCTEON_CN68XX ) && xi.interface <CVMX_HELPER_MAX_GMX ) { +union cvmx_gmxx_txx_pipe config; + +for (index =0 ; index < num_ports; index++) { + config.u64 =0 ; + +if (__cvmx_helper_cfg_pko_port_base (xiface, index) >=0 ) { + config.u64 =csr_rd (CVMX_GMXX_TXX_PIPE (index, + xi.interface)); + config.s.nump =__cvmx_helper_cfg_pko_port_num (xiface, + index); + config.s.base =__cvmx_helper_cfg_pko_port_base (xiface, + index); +csr_wr (CVMX_GMXX_TXX_PIPE (index, xi.interface), + config.u64); + } + } + } + +return 0 ; +} + +int cvmx_helper_get_pko_port (int interface,int port) +{ +return cvmx_pko_get_base_pko_port (interface, port); +} + +int cvmx_helper_get_ipd_port (int xiface,int index) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + +if (octeon_has_feature (OCTEON_FEATURE_PKND )) { +const struct ipd_port_map *port_map; +int ipd_port; + +if (OCTEON_IS_MODEL (OCTEON_CN68XX )) { + port_map = ipd_port_map_68xx; + ipd_port =0 ; + }else if (OCTEON_IS_MODEL (OCTEON_CN78XX )) { + port_map = ipd_port_map_78xx; + ipd_port =cvmx_helper_node_to_ipd_port (xi.node,0 ); + }else if (OCTEON_IS_MODEL (OCTEON_CN73XX )) { + port_map = ipd_port_map_73xx; + ipd_port =0 ; + }else if (OCTEON_IS_MODEL (OCTEON_CNF75XX )) { + port_map = ipd_port_map_75xx; + ipd_port =0 ; + }else { +return -1 ; + } + + ipd_port += port_map[xi.interface].first_ipd_port; +if (port_map[xi.interface].type ==GMII ) { +cvmx_helper_interface_mode_t mode; + + mode =cvmx_helper_interface_get_mode (xiface); +if (mode ==CVMX_HELPER_INTERFACE_MODE_XAUI || + (mode ==CVMX_HELPER_INTERFACE_MODE_RXAUI && +OCTEON_IS_MODEL (OCTEON_CN68XX ))) { + ipd_port += port_map[xi.interface].ipd_port_adj; +return ipd_port; + }else { +return ipd_port + (index *16 ); + } + }else if (port_map[xi.interface].type ==ILK ) { +return ipd_port + index; + }else if (port_map[xi.interface].type ==NPI ) { +return ipd_port + index; + }else if (port_map[xi.interface].type ==SRIO ) { +return ipd_port + index; + }else if (port_map[xi.interface].type ==LB ) { +return ipd_port + index; + } + +debug ("ERROR: %s: interface %u:%u bad mode\n" , + __func__, xi.node, xi.interface); +return -1 ; + }else if (cvmx_helper_interface_get_mode (xiface) == +CVMX_HELPER_INTERFACE_MODE_AGL ) { +return 24 ; + } + +switch (xi.interface) { +case 0 : +return index; +case 1 : +return index +16 ; +case 2 : +return index +32 ; +case 3 : +return index +36 ; +case 4 : +return index +40 ; +case 5 : +return index +42 ; +case 6 : +return index +44 ; +case 7 : +return index +46 ; + } +return -1 ; +} + +int cvmx_helper_get_pknd (int xiface,int index) +{ +if (octeon_has_feature (OCTEON_FEATURE_PKND )) +return __cvmx_helper_cfg_pknd (xiface, index); + +return CVMX_INVALID_PKND ; +} + +int cvmx_helper_get_bpid (int interface,int port) +{ +if (octeon_has_feature (OCTEON_FEATURE_PKND )) +return __cvmx_helper_cfg_bpid (interface, port); + +return CVMX_INVALID_BPID ; +} + +/** +* Display interface statistics. +* +* @param port IPD/PKO port number +* +* @return none +*/ +void cvmx_helper_show_stats (int port) +{ +cvmx_pip_port_status_t status; +cvmx_pko_port_status_t pko_status; + +/* ILK stats */ +if (octeon_has_feature (OCTEON_FEATURE_ILK )) +__cvmx_helper_ilk_show_stats (); + +/* PIP stats */ +cvmx_pip_get_port_stats (port,0 , &status); +debug ("port %d: the number of packets - ipd: %d\n" , port, + (int )status.packets); + +/* PKO stats */ +cvmx_pko_get_port_status (port,0 , &pko_status); +debug ("port %d: the number of packets - pko: %d\n" , port, + (int )pko_status.packets); + +/* TODO: other stats */ +} + +/** +* Returns the interface number for an IPD/PKO port number. +* +* @param ipd_port IPD/PKO port number +* +* @return Interface number +*/ +int cvmx_helper_get_interface_num (int ipd_port) +{ +if (OCTEON_IS_MODEL (OCTEON_CN68XX )) { +const struct ipd_port_map *port_map; +int i; +struct cvmx_xport xp =cvmx_helper_ipd_port_to_xport (ipd_port); + + port_map = ipd_port_map_68xx; +for (i =0 ; i <CVMX_HELPER_MAX_IFACE ; i++) { +if (xp.port >= port_map[i].first_ipd_port && + xp.port <= port_map[i].last_ipd_port) +return i; + } +return -1 ; + }else if (OCTEON_IS_MODEL (OCTEON_CN78XX )) { +const struct ipd_port_map *port_map; +int i; +struct cvmx_xport xp =cvmx_helper_ipd_port_to_xport (ipd_port); + + port_map = ipd_port_map_78xx; +for (i =0 ; i <CVMX_HELPER_MAX_IFACE ; i++) { +if (xp.port >= port_map[i].first_ipd_port && + xp.port <= port_map[i].last_ipd_port) +return cvmx_helper_node_interface_to_xiface (xp.node, i); + } +return -1 ; + }else if (OCTEON_IS_MODEL (OCTEON_CN73XX )) { +const struct ipd_port_map *port_map; +int i; +struct cvmx_xport xp =cvmx_helper_ipd_port_to_xport (ipd_port); + + port_map = ipd_port_map_73xx; +for (i =0 ; i <CVMX_HELPER_MAX_IFACE ; i++) { +if (xp.port >= port_map[i].first_ipd_port && + xp.port <= port_map[i].last_ipd_port) +return i; + } +return -1 ; + }else if (OCTEON_IS_MODEL (OCTEON_CNF75XX )) { +const struct ipd_port_map *port_map; +int i; +struct cvmx_xport xp =cvmx_helper_ipd_port_to_xport (ipd_port); + + port_map = ipd_port_map_75xx; +for (i =0 ; i <CVMX_HELPER_MAX_IFACE ; i++) { +if (xp.port >= port_map[i].first_ipd_port && + xp.port <= port_map[i].last_ipd_port) +return i; + } +return -1 ; + }else if (OCTEON_IS_MODEL (OCTEON_CN70XX ) && ipd_port ==24 ) { +return 4 ; + } + +if (ipd_port <16 ) +return 0 ; +else if (ipd_port <32 ) +return 1 ; +else if (ipd_port <36 ) +return 2 ; +else if (ipd_port <40 ) +return 3 ; +else if (ipd_port <42 ) +return 4 ; +else if (ipd_port <44 ) +return 5 ; +else if (ipd_port <46 ) +return 6 ; +else if (ipd_port <48 ) +return 7 ; + +debug ("%s: Illegal IPD port number %d\n" , __func__, ipd_port); +return -1 ; +} + +/** +* Returns the interface index number for an IPD/PKO port +* number. +* +* @param ipd_port IPD/PKO port number +* +* @return Interface index number +*/ +int cvmx_helper_get_interface_index_num (int ipd_port) +{ +if (octeon_has_feature (OCTEON_FEATURE_PKND )) { +const struct ipd_port_map *port_map; +int port; +enum port_map_if_type type =INVALID_IF_TYPE ; +int i; +int num_interfaces; + +if (OCTEON_IS_MODEL (OCTEON_CN68XX )) { + port_map = ipd_port_map_68xx; + }else if (OCTEON_IS_MODEL (OCTEON_CN78XX )) { +struct cvmx_xport xp =cvmx_helper_ipd_port_to_xport (ipd_port); + + port_map = ipd_port_map_78xx; + ipd_port = xp.port; + }else if (OCTEON_IS_MODEL (OCTEON_CN73XX )) { +struct cvmx_xport xp =cvmx_helper_ipd_port_to_xport (ipd_port); + + port_map = ipd_port_map_73xx; + ipd_port = xp.port; + }else if (OCTEON_IS_MODEL (OCTEON_CNF75XX )) { +struct cvmx_xport xp =cvmx_helper_ipd_port_to_xport (ipd_port); + + port_map = ipd_port_map_75xx; + ipd_port = xp.port; + }else { +return -1 ; + } + + num_interfaces =cvmx_helper_get_number_of_interfaces (); + +/* Get the interface type of the ipd port */ +for (i =0 ; i < num_interfaces; i++) { +if (ipd_port >= port_map[i].first_ipd_port && + ipd_port <= port_map[i].last_ipd_port) { + type = port_map[i].type; +break ; + } + } + +/* Convert the ipd port to the interface port */ +switch (type) { +/* Ethernet interfaces have a channel in lower 4 bits +* that is does not discriminate traffic, and is ignored. +*/ +case GMII : + port = ipd_port - port_map[i].first_ipd_port; + +/* CN68XX adds 0x40 to IPD_PORT when in XAUI/RXAUI +* mode of operation, adjust for that case +*/ +if (port >= port_map[i].ipd_port_adj) + port -= port_map[i].ipd_port_adj; + + port >>=4 ; +return port; + +/* +* These interfaces do not have physical ports, +* but have logical channels instead that separate +* traffic into logical streams +*/ +case ILK : +case SRIO : +case NPI : +case LB : + port = ipd_port - port_map[i].first_ipd_port; +return port; + +default : +printf ("ERROR: %s: Illegal IPD port number %#x\n" , + __func__, ipd_port); +return -1 ; + } + } +if (OCTEON_IS_MODEL (OCTEON_CN70XX )) +return ipd_port &3 ; +if (ipd_port <32 ) +return ipd_port &15 ; +else if (ipd_port <40 ) +return ipd_port &3 ; +else if (ipd_port <48 ) +return ipd_port &1 ; + +debug ("%s: Illegal IPD port number\n" , __func__); + +return -1 ; +} + +/** +* Prints out a buffer with the address, hex bytes, and ASCII +* +* @param addr Start address to print on the left +* @param[in] buffer array of bytes to print +* @param count Number of bytes to print +*/ +void cvmx_print_buffer_u8 (unsigned int addr,const uint8_t *buffer, +size_t count) +{ +uint i; + +while (count) { +unsigned int linelen = count <16 ? count :16 ; + +debug ("%08x:" , addr); + +for (i =0 ; i < linelen; i++) +debug (" %0*x" ,2 , buffer[i]); + +while (i++ <17 ) +debug (" " ); + +for (i =0 ; i < linelen; i++) { +if (buffer[i] >=0x20 && buffer[i] <0x7f ) +debug ("%c" , buffer[i]); +else +debug ("." ); + } +debug ("\n" ); + addr += linelen; + buffer += linelen; + count -= linelen; + } +}
Signature · 1 line
2.29.2
PATCH 40/50 mips: octeon: Add cvmx-helper.c
In reply to Stefan RoeseFrom: Aaron Williams <[email protected]>
Import cvmx-helper.c from 2013 U-Boot. It will be used by the later added drivers to support PCIe and networking on the MIPS Octeon II / III platforms.
---
arch/mips/mach-octeon/cvmx-helper.c | 2611 +++++++++++++++++++++++++++ 1 file changed, 2611 insertions(+) create mode 100644 arch/mips/mach-octeon/cvmx-helper.c
arch/mips/mach-octeon/cvmx-helper.c new file +2611 -0
@@ -0,0 +1,2611 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (C) 2020 Marvell International Ltd. +* +* Helper functions for common, but complicated tasks. +*/ + +#include <log.h> +#include <linux/delay.h> + +#include <mach/cvmx-regs.h> +#include <mach/cvmx-csr.h> +#include <mach/cvmx-bootmem.h> +#include <mach/octeon-model.h> +#include <mach/cvmx-fuse.h> +#include <mach/octeon-feature.h> +#include <mach/cvmx-qlm.h> +#include <mach/octeon_qlm.h> +#include <mach/cvmx-pcie.h> +#include <mach/cvmx-coremask.h> + +#include <mach/cvmx-agl-defs.h> +#include <mach/cvmx-asxx-defs.h> +#include <mach/cvmx-bgxx-defs.h> +#include <mach/cvmx-dbg-defs.h> +#include <mach/cvmx-gmxx-defs.h> +#include <mach/cvmx-gserx-defs.h> +#include <mach/cvmx-ipd-defs.h> +#include <mach/cvmx-l2c-defs.h> +#include <mach/cvmx-npi-defs.h> +#include <mach/cvmx-pcsx-defs.h> +#include <mach/cvmx-pexp-defs.h> +#include <mach/cvmx-pki-defs.h> +#include <mach/cvmx-pko-defs.h> +#include <mach/cvmx-smix-defs.h> +#include <mach/cvmx-sriox-defs.h> +#include <mach/cvmx-helper.h> +#include <mach/cvmx-helper-board.h> +#include <mach/cvmx-helper-fdt.h> +#include <mach/cvmx-helper-bgx.h> +#include <mach/cvmx-helper-cfg.h> +#include <mach/cvmx-helper-ipd.h> +#include <mach/cvmx-helper-util.h> +#include <mach/cvmx-helper-pki.h> +#include <mach/cvmx-helper-pko.h> +#include <mach/cvmx-helper-pko3.h> +#include <mach/cvmx-global-resources.h> +#include <mach/cvmx-pko-internal-ports-range.h> +#include <mach/cvmx-pko3-queue.h> +#include <mach/cvmx-gmx.h> +#include <mach/cvmx-hwpko.h> +#include <mach/cvmx-ilk.h> +#include <mach/cvmx-ipd.h> +#include <mach/cvmx-pip.h> + +/** +* @INTERNAL +* This structure specifies the interface methods used by an interface. +* +* @param mode Interface mode. +* +* @param enumerate Method the get number of interface ports. +* +* @param probe Method to probe an interface to get the number of +* connected ports. +* +* @param enable Method to enable an interface +* +* @param link_get Method to get the state of an interface link. +* +* @param link_set Method to configure an interface link to the specified +* state. +* +* @param loopback Method to configure a port in loopback. +*/ +struct iface_ops { +cvmx_helper_interface_mode_t mode; +int (*enumerate)(int xiface); +int (*probe)(int xiface); +int (*enable)(int xiface); +cvmx_helper_link_info_t (*link_get)(int ipd_port); +int (*link_set)(int ipd_port,cvmx_helper_link_info_t link_info); +int (*loopback)(int ipd_port,int en_in,int en_ex); +}; + +/** +* @INTERNAL +* This structure is used by disabled interfaces. +*/ +static const struct iface_ops iface_ops_dis = { + .mode =CVMX_HELPER_INTERFACE_MODE_DISABLED , +}; + +/** +* @INTERNAL +* This structure specifies the interface methods used by interfaces +* configured as gmii. +*/ +static const struct iface_ops iface_ops_gmii = { + .mode =CVMX_HELPER_INTERFACE_MODE_GMII , + .enumerate = __cvmx_helper_rgmii_probe, + .probe = __cvmx_helper_rgmii_probe, + .enable = __cvmx_helper_rgmii_enable, + .link_get = __cvmx_helper_gmii_link_get, + .link_set = __cvmx_helper_rgmii_link_set, + .loopback = __cvmx_helper_rgmii_configure_loopback, +}; + +/** +* @INTERNAL +* This structure specifies the interface methods used by interfaces +* configured as rgmii. +*/ +static const struct iface_ops iface_ops_rgmii = { + .mode =CVMX_HELPER_INTERFACE_MODE_RGMII , + .enumerate = __cvmx_helper_rgmii_probe, + .probe = __cvmx_helper_rgmii_probe, + .enable = __cvmx_helper_rgmii_enable, + .link_get = __cvmx_helper_rgmii_link_get, + .link_set = __cvmx_helper_rgmii_link_set, + .loopback = __cvmx_helper_rgmii_configure_loopback, +}; + +/** +* @INTERNAL +* This structure specifies the interface methods used by interfaces +* configured as sgmii that use the gmx mac. +*/ +static const struct iface_ops iface_ops_sgmii = { + .mode =CVMX_HELPER_INTERFACE_MODE_SGMII , + .enumerate = __cvmx_helper_sgmii_enumerate, + .probe = __cvmx_helper_sgmii_probe, + .enable = __cvmx_helper_sgmii_enable, + .link_get = __cvmx_helper_sgmii_link_get, + .link_set = __cvmx_helper_sgmii_link_set, + .loopback = __cvmx_helper_sgmii_configure_loopback, +}; + +/** +* @INTERNAL +* This structure specifies the interface methods used by interfaces +* configured as sgmii that use the bgx mac. +*/ +static const struct iface_ops iface_ops_bgx_sgmii = { + .mode =CVMX_HELPER_INTERFACE_MODE_SGMII , + .enumerate = __cvmx_helper_bgx_enumerate, + .probe = __cvmx_helper_bgx_probe, + .enable = __cvmx_helper_bgx_sgmii_enable, + .link_get = __cvmx_helper_bgx_sgmii_link_get, + .link_set = __cvmx_helper_bgx_sgmii_link_set, + .loopback = __cvmx_helper_bgx_sgmii_configure_loopback, +}; + +/** +* @INTERNAL +* This structure specifies the interface methods used by interfaces +* configured as qsgmii. +*/ +static const struct iface_ops iface_ops_qsgmii = { + .mode =CVMX_HELPER_INTERFACE_MODE_QSGMII , + .enumerate = __cvmx_helper_sgmii_enumerate, + .probe = __cvmx_helper_sgmii_probe, + .enable = __cvmx_helper_sgmii_enable, + .link_get = __cvmx_helper_sgmii_link_get, + .link_set = __cvmx_helper_sgmii_link_set, + .loopback = __cvmx_helper_sgmii_configure_loopback, +}; + +/** +* @INTERNAL +* This structure specifies the interface methods used by interfaces +* configured as xaui using the gmx mac. +*/ +static const struct iface_ops iface_ops_xaui = { + .mode =CVMX_HELPER_INTERFACE_MODE_XAUI , + .enumerate = __cvmx_helper_xaui_enumerate, + .probe = __cvmx_helper_xaui_probe, + .enable = __cvmx_helper_xaui_enable, + .link_get = __cvmx_helper_xaui_link_get, + .link_set = __cvmx_helper_xaui_link_set, + .loopback = __cvmx_helper_xaui_configure_loopback, +}; + +/** +* @INTERNAL +* This structure specifies the interface methods used by interfaces +* configured as xaui using the gmx mac. +*/ +static const struct iface_ops iface_ops_bgx_xaui = { + .mode =CVMX_HELPER_INTERFACE_MODE_XAUI , + .enumerate = __cvmx_helper_bgx_enumerate, + .probe = __cvmx_helper_bgx_probe, + .enable = __cvmx_helper_bgx_xaui_enable, + .link_get = __cvmx_helper_bgx_xaui_link_get, + .link_set = __cvmx_helper_bgx_xaui_link_set, + .loopback = __cvmx_helper_bgx_xaui_configure_loopback, +}; + +/** +* @INTERNAL +* This structure specifies the interface methods used by interfaces +* configured as rxaui. +*/ +static const struct iface_ops iface_ops_rxaui = { + .mode =CVMX_HELPER_INTERFACE_MODE_RXAUI , + .enumerate = __cvmx_helper_xaui_enumerate, + .probe = __cvmx_helper_xaui_probe, + .enable = __cvmx_helper_xaui_enable, + .link_get = __cvmx_helper_xaui_link_get, + .link_set = __cvmx_helper_xaui_link_set, + .loopback = __cvmx_helper_xaui_configure_loopback, +}; + +/** +* @INTERNAL +* This structure specifies the interface methods used by interfaces +* configured as xaui using the gmx mac. +*/ +static const struct iface_ops iface_ops_bgx_rxaui = { + .mode =CVMX_HELPER_INTERFACE_MODE_RXAUI , + .enumerate = __cvmx_helper_bgx_enumerate, + .probe = __cvmx_helper_bgx_probe, + .enable = __cvmx_helper_bgx_xaui_enable, + .link_get = __cvmx_helper_bgx_xaui_link_get, + .link_set = __cvmx_helper_bgx_xaui_link_set, + .loopback = __cvmx_helper_bgx_xaui_configure_loopback, +}; + +/** +* @INTERNAL +* This structure specifies the interface methods used by interfaces +* configured as xlaui. +*/ +static const struct iface_ops iface_ops_bgx_xlaui = { + .mode =CVMX_HELPER_INTERFACE_MODE_XLAUI , + .enumerate = __cvmx_helper_bgx_enumerate, + .probe = __cvmx_helper_bgx_probe, + .enable = __cvmx_helper_bgx_xaui_enable, + .link_get = __cvmx_helper_bgx_xaui_link_get, + .link_set = __cvmx_helper_bgx_xaui_link_set, + .loopback = __cvmx_helper_bgx_xaui_configure_loopback, +}; + +/** +* @INTERNAL +* This structure specifies the interface methods used by interfaces +* configured as xfi. +*/ +static const struct iface_ops iface_ops_bgx_xfi = { + .mode =CVMX_HELPER_INTERFACE_MODE_XFI , + .enumerate = __cvmx_helper_bgx_enumerate, + .probe = __cvmx_helper_bgx_probe, + .enable = __cvmx_helper_bgx_xaui_enable, + .link_get = __cvmx_helper_bgx_xaui_link_get, + .link_set = __cvmx_helper_bgx_xaui_link_set, + .loopback = __cvmx_helper_bgx_xaui_configure_loopback, +}; + +static const struct iface_ops iface_ops_bgx_10G_KR = { + .mode =CVMX_HELPER_INTERFACE_MODE_10G_KR , + .enumerate = __cvmx_helper_bgx_enumerate, + .probe = __cvmx_helper_bgx_probe, + .enable = __cvmx_helper_bgx_xaui_enable, + .link_get = __cvmx_helper_bgx_xaui_link_get, + .link_set = __cvmx_helper_bgx_xaui_link_set, + .loopback = __cvmx_helper_bgx_xaui_configure_loopback, +}; + +static const struct iface_ops iface_ops_bgx_40G_KR4 = { + .mode =CVMX_HELPER_INTERFACE_MODE_40G_KR4 , + .enumerate = __cvmx_helper_bgx_enumerate, + .probe = __cvmx_helper_bgx_probe, + .enable = __cvmx_helper_bgx_xaui_enable, + .link_get = __cvmx_helper_bgx_xaui_link_get, + .link_set = __cvmx_helper_bgx_xaui_link_set, + .loopback = __cvmx_helper_bgx_xaui_configure_loopback, +}; + +/** +* @INTERNAL +* This structure specifies the interface methods used by interfaces +* configured as ilk. +*/ +static const struct iface_ops iface_ops_ilk = { + .mode =CVMX_HELPER_INTERFACE_MODE_ILK , + .enumerate = __cvmx_helper_ilk_enumerate, + .probe = __cvmx_helper_ilk_probe, + .enable = __cvmx_helper_ilk_enable, + .link_get = __cvmx_helper_ilk_link_get, + .link_set = __cvmx_helper_ilk_link_set, +}; + +/** +* @INTERNAL +* This structure specifies the interface methods used by interfaces +* configured as npi. +*/ +static const struct iface_ops iface_ops_npi = { + .mode =CVMX_HELPER_INTERFACE_MODE_NPI , + .enumerate = __cvmx_helper_npi_probe, + .probe = __cvmx_helper_npi_probe, + .enable = __cvmx_helper_npi_enable, +}; + +/** +* @INTERNAL +* This structure specifies the interface methods used by interfaces +* configured as srio. +*/ +static const struct iface_ops iface_ops_srio = { + .mode =CVMX_HELPER_INTERFACE_MODE_SRIO , + .enumerate = __cvmx_helper_srio_probe, + .probe = __cvmx_helper_srio_probe, + .enable = __cvmx_helper_srio_enable, + .link_get = __cvmx_helper_srio_link_get, + .link_set = __cvmx_helper_srio_link_set, +}; + +/** +* @INTERNAL +* This structure specifies the interface methods used by interfaces +* configured as agl. +*/ +static const struct iface_ops iface_ops_agl = { + .mode =CVMX_HELPER_INTERFACE_MODE_AGL , + .enumerate = __cvmx_helper_agl_enumerate, + .probe = __cvmx_helper_agl_probe, + .enable = __cvmx_helper_agl_enable, + .link_get = __cvmx_helper_agl_link_get, + .link_set = __cvmx_helper_agl_link_set, +}; + +/** +* @INTERNAL +* This structure specifies the interface methods used by interfaces +* configured as mixed mode, some ports are sgmii and some are xfi. +*/ +static const struct iface_ops iface_ops_bgx_mixed = { + .mode =CVMX_HELPER_INTERFACE_MODE_MIXED , + .enumerate = __cvmx_helper_bgx_enumerate, + .probe = __cvmx_helper_bgx_probe, + .enable = __cvmx_helper_bgx_mixed_enable, + .link_get = __cvmx_helper_bgx_mixed_link_get, + .link_set = __cvmx_helper_bgx_mixed_link_set, + .loopback = __cvmx_helper_bgx_mixed_configure_loopback, +}; + +/** +* @INTERNAL +* This structure specifies the interface methods used by interfaces +* configured as loop. +*/ +static const struct iface_ops iface_ops_loop = { + .mode =CVMX_HELPER_INTERFACE_MODE_LOOP , + .enumerate = __cvmx_helper_loop_enumerate, + .probe = __cvmx_helper_loop_probe, +}; + +const struct iface_ops *iface_node_ops[CVMX_MAX_NODES ][CVMX_HELPER_MAX_IFACE ]; +#define iface_ops iface_node_ops[0] + +struct cvmx_iface { +int cvif_ipd_nports; +int cvif_has_fcs;/* PKO fcs for this interface. */ +enum cvmx_pko_padding cvif_padding; +cvmx_helper_link_info_t *cvif_ipd_port_link_info; +}; + +/* +* This has to be static as u-boot expects to probe an interface and +* gets the number of its ports. +*/ +static struct cvmx_iface cvmx_interfaces[CVMX_MAX_NODES ][CVMX_HELPER_MAX_IFACE ]; + +int __cvmx_helper_get_num_ipd_ports (int xiface) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); +struct cvmx_iface *piface; + +if (xi.interface >=cvmx_helper_get_number_of_interfaces ()) +return -1 ; + + piface = &cvmx_interfaces[xi.node][xi.interface]; +return piface->cvif_ipd_nports; +} + +enum cvmx_pko_padding __cvmx_helper_get_pko_padding (int xiface) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); +struct cvmx_iface *piface; + +if (xi.interface >=cvmx_helper_get_number_of_interfaces ()) +return CVMX_PKO_PADDING_NONE ; + + piface = &cvmx_interfaces[xi.node][xi.interface]; +return piface->cvif_padding; +} + +int __cvmx_helper_init_interface (int xiface,int num_ipd_ports,int has_fcs, +enum cvmx_pko_padding pad) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); +struct cvmx_iface *piface; +cvmx_helper_link_info_t *p; +int i; +int sz; +u64 addr; +char name[32 ]; + +if (xi.interface >=cvmx_helper_get_number_of_interfaces ()) +return -1 ; + + piface = &cvmx_interfaces[xi.node][xi.interface]; + piface->cvif_ipd_nports = num_ipd_ports; + piface->cvif_padding = pad; + + piface->cvif_has_fcs = has_fcs; + +/* +* allocate the per-ipd_port link_info structure +*/ + sz = piface->cvif_ipd_nports *sizeof (cvmx_helper_link_info_t); +snprintf (name,sizeof (name),"__int_%d_link_info" , xi.interface); + addr =CAST64 (cvmx_bootmem_alloc_named_range_once (sz,0 ,0 , + __alignof(cvmx_helper_link_info_t ), + name,NULL )); + piface->cvif_ipd_port_link_info = + (cvmx_helper_link_info_t *)__cvmx_phys_addr_to_ptr (addr, sz); +if (!piface->cvif_ipd_port_link_info) { +if (sz !=0 ) +debug ("iface %d failed to alloc link info\n" , xi.interface); +return -1 ; + } + +/* Initialize them */ + p = piface->cvif_ipd_port_link_info; + +for (i =0 ; i < piface->cvif_ipd_nports; i++) { + (*p).u64 =0 ; + p++; + } +return 0 ; +} + +/* +* Shut down the interfaces; free the resources. +* @INTERNAL +*/ +void __cvmx_helper_shutdown_interfaces_node (unsigned int node) +{ +int i; +int nifaces;/* number of interfaces */ +struct cvmx_iface *piface; + + nifaces =cvmx_helper_get_number_of_interfaces (); +for (i =0 ; i < nifaces; i++) { + piface = &cvmx_interfaces[node][i]; + +/* +* For SE apps, bootmem was meant to be allocated and never +* freed. +*/ + piface->cvif_ipd_port_link_info =0 ; + } +} + +void __cvmx_helper_shutdown_interfaces (void ) +{ +unsigned int node =cvmx_get_node_num (); + +__cvmx_helper_shutdown_interfaces_node (node); +} + +int __cvmx_helper_set_link_info (int xiface,int index,cvmx_helper_link_info_t link_info) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); +struct cvmx_iface *piface; + +if (xi.interface >=cvmx_helper_get_number_of_interfaces ()) +return -1 ; + + piface = &cvmx_interfaces[xi.node][xi.interface]; + +if (piface->cvif_ipd_port_link_info) { + piface->cvif_ipd_port_link_info[index] = link_info; +return 0 ; + } + +return -1 ; +} + +cvmx_helper_link_info_t __cvmx_helper_get_link_info (int xiface,int port) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); +struct cvmx_iface *piface; +cvmx_helper_link_info_t err; + + err.u64 =0 ; + +if (xi.interface >=cvmx_helper_get_number_of_interfaces ()) +return err; + piface = &cvmx_interfaces[xi.node][xi.interface]; + +if (piface->cvif_ipd_port_link_info) +return piface->cvif_ipd_port_link_info[port]; + +return err; +} + +/** +* Returns if FCS is enabled for the specified interface and port +* +* @param xiface - interface to check +* +* @return zero if FCS is not used, otherwise FCS is used. +*/ +int __cvmx_helper_get_has_fcs (int xiface) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); +return cvmx_interfaces[xi.node][xi.interface].cvif_has_fcs; +} + +u64 cvmx_rgmii_backpressure_dis =1 ; + +typedef int (*cvmx_export_config_t )(void ); +cvmx_export_config_t cvmx_export_app_config; + +void cvmx_rgmii_set_back_pressure (uint64_t backpressure_dis) +{ + cvmx_rgmii_backpressure_dis = backpressure_dis; +} + +/* +* internal functions that are not exported in the .h file but must be +* declared to make gcc happy. +*/ +extern cvmx_helper_link_info_t __cvmx_helper_get_link_info (int interface,int port); + +/** +* cvmx_override_iface_phy_mode(int interface, int index) is a function pointer. +* It is meant to allow customization of interfaces which do not have a PHY. +* +* @returns 0 if MAC decides TX_CONFIG_REG or 1 if PHY decides TX_CONFIG_REG. +* +* If this function pointer is NULL then it defaults to the MAC. +*/ +int (*cvmx_override_iface_phy_mode)(int interface,int index); + +/** +* cvmx_override_ipd_port_setup(int ipd_port) is a function +* pointer. It is meant to allow customization of the IPD +* port/port kind setup before packet input/output comes online. +* It is called after cvmx-helper does the default IPD configuration, +* but before IPD is enabled. Users should set this pointer to a +* function before calling any cvmx-helper operations. +*/ +void (*cvmx_override_ipd_port_setup)(int ipd_port) =NULL ; + +/** +* Return the number of interfaces the chip has. Each interface +* may have multiple ports. Most chips support two interfaces, +* but the CNX0XX and CNX1XX are exceptions. These only support +* one interface. +* +* @return Number of interfaces on chip +*/ +int cvmx_helper_get_number_of_interfaces (void ) +{ +if (OCTEON_IS_MODEL (OCTEON_CN68XX )) +return 9 ; +else if (OCTEON_IS_MODEL (OCTEON_CN66XX )) +if (OCTEON_IS_MODEL (OCTEON_CN66XX_PASS1_0 )) +return 7 ; +else +return 8 ; +else if (OCTEON_IS_MODEL (OCTEON_CN63XX )) +return 6 ; +else if (OCTEON_IS_MODEL (OCTEON_CN61XX ) ||OCTEON_IS_MODEL (OCTEON_CNF71XX )) +return 4 ; +else if (OCTEON_IS_MODEL (OCTEON_CN70XX )) +return 5 ; +else if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return 10 ; +else if (OCTEON_IS_MODEL (OCTEON_CNF75XX )) +return 5 ; +else if (OCTEON_IS_MODEL (OCTEON_CN73XX )) +return 5 ; +else +return 3 ; +} + +int __cvmx_helper_early_ports_on_interface (int interface) +{ +int ports; + +if (octeon_has_feature (OCTEON_FEATURE_PKND )) +return cvmx_helper_interface_enumerate (interface); + + ports =cvmx_helper_interface_enumerate (interface); + ports =__cvmx_helper_board_interface_probe (interface, ports); + +return ports; +} + +/** +* Return the number of ports on an interface. Depending on the +* chip and configuration, this can be 1-16. A value of 0 +* specifies that the interface doesn't exist or isn't usable. +* +* @param xiface xiface to get the port count for +* +* @return Number of ports on interface. Can be Zero. +*/ +int cvmx_helper_ports_on_interface (int xiface) +{ +if (octeon_has_feature (OCTEON_FEATURE_PKND )) +return cvmx_helper_interface_enumerate (xiface); +else +return __cvmx_helper_get_num_ipd_ports (xiface); +} + +/** +* @INTERNAL +* Return interface mode for CN70XX. +*/ +static cvmx_helper_interface_mode_t __cvmx_get_mode_cn70xx (int interface) +{ +/* SGMII/RXAUI/QSGMII */ +if (interface <2 ) { +enum cvmx_qlm_mode qlm_mode = +cvmx_qlm_get_dlm_mode (0 , interface); + +if (qlm_mode ==CVMX_QLM_MODE_SGMII ) + iface_ops[interface] = &iface_ops_sgmii; +else if (qlm_mode ==CVMX_QLM_MODE_QSGMII ) + iface_ops[interface] = &iface_ops_qsgmii; +else if (qlm_mode ==CVMX_QLM_MODE_RXAUI ) + iface_ops[interface] = &iface_ops_rxaui; +else + iface_ops[interface] = &iface_ops_dis; + }else if (interface ==2 ) {/* DPI */ + iface_ops[interface] = &iface_ops_npi; + }else if (interface ==3 ) {/* LOOP */ + iface_ops[interface] = &iface_ops_loop; + }else if (interface ==4 ) {/* RGMII (AGL) */ +cvmx_agl_prtx_ctl_t prtx_ctl; + + prtx_ctl.u64 =csr_rd (CVMX_AGL_PRTX_CTL (0 )); +if (prtx_ctl.s.mode ==0 ) + iface_ops[interface] = &iface_ops_agl; +else + iface_ops[interface] = &iface_ops_dis; + }else { + iface_ops[interface] = &iface_ops_dis; + } + +return iface_ops[interface]->mode; +} + +/** +* @INTERNAL +* Return interface mode for CN78XX. +*/ +static cvmx_helper_interface_mode_t __cvmx_get_mode_cn78xx (int xiface) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); +/* SGMII/RXAUI/XAUI */ +if (xi.interface <6 ) { +int qlm =cvmx_qlm_lmac (xiface,0 ); +enum cvmx_qlm_mode qlm_mode; + +if (qlm ==-1 ) { + iface_node_ops[xi.node][xi.interface] = &iface_ops_dis; +return iface_node_ops[xi.node][xi.interface]->mode; + } + qlm_mode =cvmx_qlm_get_mode_cn78xx (xi.node, qlm); + +if (qlm_mode ==CVMX_QLM_MODE_SGMII ) + iface_node_ops[xi.node][xi.interface] = &iface_ops_bgx_sgmii; +else if (qlm_mode ==CVMX_QLM_MODE_XAUI ) + iface_node_ops[xi.node][xi.interface] = &iface_ops_bgx_xaui; +else if (qlm_mode ==CVMX_QLM_MODE_XLAUI ) + iface_node_ops[xi.node][xi.interface] = &iface_ops_bgx_xlaui; +else if (qlm_mode ==CVMX_QLM_MODE_XFI ) + iface_node_ops[xi.node][xi.interface] = &iface_ops_bgx_xfi; +else if (qlm_mode ==CVMX_QLM_MODE_RXAUI ) + iface_node_ops[xi.node][xi.interface] = &iface_ops_bgx_rxaui; +else + iface_node_ops[xi.node][xi.interface] = &iface_ops_dis; + }else if (xi.interface <8 ) { +enum cvmx_qlm_mode qlm_mode; +int found =0 ; +int i; +int intf, lane_mask; + +if (xi.interface ==6 ) { + intf =6 ; + lane_mask = cvmx_ilk_lane_mask[xi.node][0 ]; + }else { + intf =7 ; + lane_mask = cvmx_ilk_lane_mask[xi.node][1 ]; + } +switch (lane_mask) { +default : +case 0x0 : + iface_node_ops[xi.node][intf] = &iface_ops_dis; +break ; +case 0xf : + qlm_mode =cvmx_qlm_get_mode_cn78xx (xi.node,4 ); +if (qlm_mode ==CVMX_QLM_MODE_ILK ) + iface_node_ops[xi.node][intf] = &iface_ops_ilk; +else + iface_node_ops[xi.node][intf] = &iface_ops_dis; +break ; +case 0xff : + found =0 ; +for (i =4 ; i <6 ; i++) { + qlm_mode =cvmx_qlm_get_mode_cn78xx (xi.node, i); +if (qlm_mode ==CVMX_QLM_MODE_ILK ) + found++; + } +if (found ==2 ) + iface_node_ops[xi.node][intf] = &iface_ops_ilk; +else + iface_node_ops[xi.node][intf] = &iface_ops_dis; +break ; +case 0xfff : + found =0 ; +for (i =4 ; i <7 ; i++) { + qlm_mode =cvmx_qlm_get_mode_cn78xx (xi.node, i); +if (qlm_mode ==CVMX_QLM_MODE_ILK ) + found++; + } +if (found ==3 ) + iface_node_ops[xi.node][intf] = &iface_ops_ilk; +else + iface_node_ops[xi.node][intf] = &iface_ops_dis; +break ; +case 0xff00 : + found =0 ; +for (i =6 ; i <8 ; i++) { + qlm_mode =cvmx_qlm_get_mode_cn78xx (xi.node, i); +if (qlm_mode ==CVMX_QLM_MODE_ILK ) + found++; + } +if (found ==2 ) + iface_node_ops[xi.node][intf] = &iface_ops_ilk; +else + iface_node_ops[xi.node][intf] = &iface_ops_dis; +break ; +case 0xf0 : + qlm_mode =cvmx_qlm_get_mode_cn78xx (xi.node,5 ); +if (qlm_mode ==CVMX_QLM_MODE_ILK ) + iface_node_ops[xi.node][intf] = &iface_ops_ilk; +else + iface_node_ops[xi.node][intf] = &iface_ops_dis; +break ; +case 0xf00 : + qlm_mode =cvmx_qlm_get_mode_cn78xx (xi.node,6 ); +if (qlm_mode ==CVMX_QLM_MODE_ILK ) + iface_node_ops[xi.node][intf] = &iface_ops_ilk; +else + iface_node_ops[xi.node][intf] = &iface_ops_dis; +break ; +case 0xf000 : + qlm_mode =cvmx_qlm_get_mode_cn78xx (xi.node,7 ); +if (qlm_mode ==CVMX_QLM_MODE_ILK ) + iface_node_ops[xi.node][intf] = &iface_ops_ilk; +else + iface_node_ops[xi.node][intf] = &iface_ops_dis; +break ; +case 0xfff0 : + found =0 ; +for (i =5 ; i <8 ; i++) { + qlm_mode =cvmx_qlm_get_mode_cn78xx (xi.node, i); +if (qlm_mode ==CVMX_QLM_MODE_ILK ) + found++; + } +if (found ==3 ) + iface_node_ops[xi.node][intf] = &iface_ops_ilk; +else + iface_node_ops[xi.node][intf] = &iface_ops_dis; +break ; + } + }else if (xi.interface ==8 ) {/* DPI */ +int qlm =0 ; + +for (qlm =0 ; qlm <5 ; qlm++) { +/* if GSERX_CFG[pcie] == 1, then enable npi */ +if (csr_rd_node (xi.node,CVMX_GSERX_CFG (qlm)) &0x1 ) { + iface_node_ops[xi.node][xi.interface] = + &iface_ops_npi; +return iface_node_ops[xi.node][xi.interface]->mode; + } + } + iface_node_ops[xi.node][xi.interface] = &iface_ops_dis; + }else if (xi.interface ==9 ) {/* LOOP */ + iface_node_ops[xi.node][xi.interface] = &iface_ops_loop; + }else { + iface_node_ops[xi.node][xi.interface] = &iface_ops_dis; + } + +return iface_node_ops[xi.node][xi.interface]->mode; +} + +/** +* @INTERNAL +* Return interface mode for CN73XX. +*/ +static cvmx_helper_interface_mode_t __cvmx_get_mode_cn73xx (int xiface) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); +int interface = xi.interface; + +/* SGMII/XAUI/XLAUI/XFI */ +if (interface <3 ) { +int qlm =cvmx_qlm_lmac (xiface,0 ); +enum cvmx_qlm_mode qlm_mode; + +if (qlm ==-1 ) { + iface_ops[interface] = &iface_ops_dis; +return iface_ops[interface]->mode; + } + qlm_mode =cvmx_qlm_get_mode (qlm); + +switch (qlm_mode) { +case CVMX_QLM_MODE_SGMII : +case CVMX_QLM_MODE_SGMII_2X1 : +case CVMX_QLM_MODE_RGMII_SGMII : +case CVMX_QLM_MODE_RGMII_SGMII_1X1 : + iface_ops[interface] = &iface_ops_bgx_sgmii; +break ; +case CVMX_QLM_MODE_XAUI : +case CVMX_QLM_MODE_RGMII_XAUI : + iface_ops[interface] = &iface_ops_bgx_xaui; +break ; +case CVMX_QLM_MODE_RXAUI : +case CVMX_QLM_MODE_RXAUI_1X2 : +case CVMX_QLM_MODE_RGMII_RXAUI : + iface_ops[interface] = &iface_ops_bgx_rxaui; +break ; +case CVMX_QLM_MODE_XLAUI : +case CVMX_QLM_MODE_RGMII_XLAUI : + iface_ops[interface] = &iface_ops_bgx_xlaui; +break ; +case CVMX_QLM_MODE_XFI : +case CVMX_QLM_MODE_XFI_1X2 : +case CVMX_QLM_MODE_RGMII_XFI : + iface_ops[interface] = &iface_ops_bgx_xfi; +break ; +case CVMX_QLM_MODE_10G_KR : +case CVMX_QLM_MODE_10G_KR_1X2 : +case CVMX_QLM_MODE_RGMII_10G_KR : + iface_ops[interface] = &iface_ops_bgx_10G_KR; +break ; +case CVMX_QLM_MODE_40G_KR4 : +case CVMX_QLM_MODE_RGMII_40G_KR4 : + iface_ops[interface] = &iface_ops_bgx_40G_KR4; +break ; +case CVMX_QLM_MODE_MIXED : + iface_ops[interface] = &iface_ops_bgx_mixed; +break ; +default : + iface_ops[interface] = &iface_ops_dis; +break ; + } + }else if (interface ==3 ) {/* DPI */ + iface_ops[interface] = &iface_ops_npi; + }else if (interface ==4 ) {/* LOOP */ + iface_ops[interface] = &iface_ops_loop; + }else { + iface_ops[interface] = &iface_ops_dis; + } + +return iface_ops[interface]->mode; +} + +/** +* @INTERNAL +* Return interface mode for CNF75XX. +* +* CNF75XX has a single BGX block, which is attached to two DLMs, +* the first, GSER4 only supports SGMII mode, while the second, +* GSER5 supports 1G/10G single late modes, i.e. SGMII, XFI, 10G-KR. +* Each half-BGX is thus designated as a separate interface with two ports each. +*/ +static cvmx_helper_interface_mode_t __cvmx_get_mode_cnf75xx (int xiface) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); +int interface = xi.interface; + +/* BGX0: SGMII (DLM4/DLM5)/XFI(DLM5) */ +if (interface <1 ) { +enum cvmx_qlm_mode qlm_mode; +int qlm =cvmx_qlm_lmac (xiface,0 ); + +if (qlm ==-1 ) { + iface_ops[interface] = &iface_ops_dis; +return iface_ops[interface]->mode; + } + qlm_mode =cvmx_qlm_get_mode (qlm); + +switch (qlm_mode) { +case CVMX_QLM_MODE_SGMII : +case CVMX_QLM_MODE_SGMII_2X1 : + iface_ops[interface] = &iface_ops_bgx_sgmii; +break ; +case CVMX_QLM_MODE_XFI_1X2 : + iface_ops[interface] = &iface_ops_bgx_xfi; +break ; +case CVMX_QLM_MODE_10G_KR_1X2 : + iface_ops[interface] = &iface_ops_bgx_10G_KR; +break ; +case CVMX_QLM_MODE_MIXED : + iface_ops[interface] = &iface_ops_bgx_mixed; +break ; +default : + iface_ops[interface] = &iface_ops_dis; +break ; + } + }else if ((interface <3 ) &&OCTEON_IS_MODEL (OCTEON_CNF75XX )) { +cvmx_sriox_status_reg_t sriox_status_reg; +int srio_port = interface -1 ; + + sriox_status_reg.u64 =csr_rd (CVMX_SRIOX_STATUS_REG (srio_port)); + +if (sriox_status_reg.s.srio) + iface_ops[interface] = &iface_ops_srio; +else + iface_ops[interface] = &iface_ops_dis; + }else if (interface ==3 ) {/* DPI */ + iface_ops[interface] = &iface_ops_npi; + }else if (interface ==4 ) {/* LOOP */ + iface_ops[interface] = &iface_ops_loop; + }else { + iface_ops[interface] = &iface_ops_dis; + } + +return iface_ops[interface]->mode; +} + +/** +* @INTERNAL +* Return interface mode for CN68xx. +*/ +static cvmx_helper_interface_mode_t __cvmx_get_mode_cn68xx (int interface) +{ +union cvmx_mio_qlmx_cfg qlm_cfg; + +switch (interface) { +case 0 : + qlm_cfg.u64 =csr_rd (CVMX_MIO_QLMX_CFG (0 )); +/* QLM is disabled when QLM SPD is 15. */ +if (qlm_cfg.s.qlm_spd ==15 ) + iface_ops[interface] = &iface_ops_dis; +else if (qlm_cfg.s.qlm_cfg ==7 ) + iface_ops[interface] = &iface_ops_rxaui; +else if (qlm_cfg.s.qlm_cfg ==2 ) + iface_ops[interface] = &iface_ops_sgmii; +else if (qlm_cfg.s.qlm_cfg ==3 ) + iface_ops[interface] = &iface_ops_xaui; +else + iface_ops[interface] = &iface_ops_dis; +break ; + +case 1 : + qlm_cfg.u64 =csr_rd (CVMX_MIO_QLMX_CFG (0 )); +/* QLM is disabled when QLM SPD is 15. */ +if (qlm_cfg.s.qlm_spd ==15 ) + iface_ops[interface] = &iface_ops_dis; +else if (qlm_cfg.s.qlm_cfg ==7 ) + iface_ops[interface] = &iface_ops_rxaui; +else + iface_ops[interface] = &iface_ops_dis; +break ; + +case 2 : +case 3 : +case 4 : + qlm_cfg.u64 =csr_rd (CVMX_MIO_QLMX_CFG (interface)); +/* QLM is disabled when QLM SPD is 15. */ +if (qlm_cfg.s.qlm_spd ==15 ) + iface_ops[interface] = &iface_ops_dis; +else if (qlm_cfg.s.qlm_cfg ==2 ) + iface_ops[interface] = &iface_ops_sgmii; +else if (qlm_cfg.s.qlm_cfg ==3 ) + iface_ops[interface] = &iface_ops_xaui; +else + iface_ops[interface] = &iface_ops_dis; +break ; + +case 5 : +case 6 : + qlm_cfg.u64 =csr_rd (CVMX_MIO_QLMX_CFG (interface -4 )); +/* QLM is disabled when QLM SPD is 15. */ +if (qlm_cfg.s.qlm_spd ==15 ) + iface_ops[interface] = &iface_ops_dis; +else if (qlm_cfg.s.qlm_cfg ==1 ) + iface_ops[interface] = &iface_ops_ilk; +else + iface_ops[interface] = &iface_ops_dis; +break ; + +case 7 : { +union cvmx_mio_qlmx_cfg qlm_cfg1; +/* Check if PCIe0/PCIe1 is configured for PCIe */ + qlm_cfg.u64 =csr_rd (CVMX_MIO_QLMX_CFG (3 )); + qlm_cfg1.u64 =csr_rd (CVMX_MIO_QLMX_CFG (1 )); +/* QLM is disabled when QLM SPD is 15. */ +if ((qlm_cfg.s.qlm_spd !=15 && qlm_cfg.s.qlm_cfg ==0 ) || + (qlm_cfg1.s.qlm_spd !=15 && qlm_cfg1.s.qlm_cfg ==0 )) + iface_ops[interface] = &iface_ops_npi; +else + iface_ops[interface] = &iface_ops_dis; + }break ; + +case 8 : + iface_ops[interface] = &iface_ops_loop; +break ; + +default : + iface_ops[interface] = &iface_ops_dis; +break ; + } + +return iface_ops[interface]->mode; +} + +/** +* @INTERNAL +* Return interface mode for an Octeon II +*/ +static cvmx_helper_interface_mode_t __cvmx_get_mode_octeon2 (int interface) +{ +union cvmx_gmxx_inf_mode mode; + +if (OCTEON_IS_MODEL (OCTEON_CN68XX )) +return __cvmx_get_mode_cn68xx (interface); + +if (interface ==2 ) { + iface_ops[interface] = &iface_ops_npi; + }else if (interface ==3 ) { + iface_ops[interface] = &iface_ops_loop; + }else if ((OCTEON_IS_MODEL (OCTEON_CN63XX ) && + (interface ==4 || interface ==5 )) || + (OCTEON_IS_MODEL (OCTEON_CN66XX ) && interface >=4 && + interface <=7 )) { +/* Only present in CN63XX & CN66XX Octeon model */ +union cvmx_sriox_status_reg sriox_status_reg; + +/* cn66xx pass1.0 has only 2 SRIO interfaces. */ +if ((interface ==5 || interface ==7 ) && +OCTEON_IS_MODEL (OCTEON_CN66XX_PASS1_0 )) { + iface_ops[interface] = &iface_ops_dis; + }else if (interface ==5 &&OCTEON_IS_MODEL (OCTEON_CN66XX )) { +/* +* Later passes of cn66xx support SRIO0 - x4/x2/x1, +* SRIO2 - x2/x1, SRIO3 - x1 +*/ + iface_ops[interface] = &iface_ops_dis; + }else { + sriox_status_reg.u64 = +csr_rd (CVMX_SRIOX_STATUS_REG (interface -4 )); +if (sriox_status_reg.s.srio) + iface_ops[interface] = &iface_ops_srio; +else + iface_ops[interface] = &iface_ops_dis; + } + }else if (OCTEON_IS_MODEL (OCTEON_CN66XX )) { +union cvmx_mio_qlmx_cfg mio_qlm_cfg; + +/* QLM2 is SGMII0 and QLM1 is SGMII1 */ +if (interface ==0 ) { + mio_qlm_cfg.u64 =csr_rd (CVMX_MIO_QLMX_CFG (2 )); + }else if (interface ==1 ) { + mio_qlm_cfg.u64 =csr_rd (CVMX_MIO_QLMX_CFG (1 )); + }else { + iface_ops[interface] = &iface_ops_dis; +return iface_ops[interface]->mode; + } + +if (mio_qlm_cfg.s.qlm_spd ==15 ) + iface_ops[interface] = &iface_ops_dis; +else if (mio_qlm_cfg.s.qlm_cfg ==9 ) + iface_ops[interface] = &iface_ops_sgmii; +else if (mio_qlm_cfg.s.qlm_cfg ==11 ) + iface_ops[interface] = &iface_ops_xaui; +else + iface_ops[interface] = &iface_ops_dis; + }else if (OCTEON_IS_MODEL (OCTEON_CN61XX )) { +union cvmx_mio_qlmx_cfg qlm_cfg; + +if (interface ==0 ) { + qlm_cfg.u64 =csr_rd (CVMX_MIO_QLMX_CFG (2 )); + }else if (interface ==1 ) { + qlm_cfg.u64 =csr_rd (CVMX_MIO_QLMX_CFG (0 )); + }else { + iface_ops[interface] = &iface_ops_dis; +return iface_ops[interface]->mode; + } + +if (qlm_cfg.s.qlm_spd ==15 ) + iface_ops[interface] = &iface_ops_dis; +else if (qlm_cfg.s.qlm_cfg ==2 ) + iface_ops[interface] = &iface_ops_sgmii; +else if (qlm_cfg.s.qlm_cfg ==3 ) + iface_ops[interface] = &iface_ops_xaui; +else + iface_ops[interface] = &iface_ops_dis; + }else if (OCTEON_IS_MODEL (OCTEON_CNF71XX )) { +if (interface ==0 ) { +union cvmx_mio_qlmx_cfg qlm_cfg; + + qlm_cfg.u64 =csr_rd (CVMX_MIO_QLMX_CFG (0 )); +if (qlm_cfg.s.qlm_cfg ==2 ) + iface_ops[interface] = &iface_ops_sgmii; +else + iface_ops[interface] = &iface_ops_dis; + }else { + iface_ops[interface] = &iface_ops_dis; + } + }else if (interface ==1 &&OCTEON_IS_MODEL (OCTEON_CN63XX )) { + iface_ops[interface] = &iface_ops_dis; + }else { + mode.u64 =csr_rd (CVMX_GMXX_INF_MODE (interface)); + +if (OCTEON_IS_MODEL (OCTEON_CN63XX )) { +switch (mode.cn63xx.mode) { +case 0 : + iface_ops[interface] = &iface_ops_sgmii; +break ; + +case 1 : + iface_ops[interface] = &iface_ops_xaui; +break ; + +default : + iface_ops[interface] = &iface_ops_dis; +break ; + } + }else { +if (!mode.s.en) + iface_ops[interface] = &iface_ops_dis; +else if (mode.s.type) + iface_ops[interface] = &iface_ops_gmii; +else + iface_ops[interface] = &iface_ops_rgmii; + } + } + +return iface_ops[interface]->mode; +} + +/** +* Get the operating mode of an interface. Depending on the Octeon +* chip and configuration, this function returns an enumeration +* of the type of packet I/O supported by an interface. +* +* @param xiface Interface to probe +* +* @return Mode of the interface. Unknown or unsupported interfaces return +* DISABLED. +*/ +cvmx_helper_interface_mode_t cvmx_helper_interface_get_mode (int xiface) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + +if (xi.interface <0 || + xi.interface >=cvmx_helper_get_number_of_interfaces ()) +return CVMX_HELPER_INTERFACE_MODE_DISABLED ; + +/* +* Check if the interface mode has been already cached. If it has, +* simply return it. Otherwise, fall through the rest of the code to +* determine the interface mode and cache it in iface_ops. +*/ +if (iface_node_ops[xi.node][xi.interface]) { +cvmx_helper_interface_mode_t mode; + + mode = iface_node_ops[xi.node][xi.interface]->mode; +return mode; + } + +/* +* OCTEON III models +*/ +if (OCTEON_IS_MODEL (OCTEON_CN70XX )) +return __cvmx_get_mode_cn70xx (xi.interface); + +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) +return __cvmx_get_mode_cn78xx (xiface); + +if (OCTEON_IS_MODEL (OCTEON_CNF75XX )) { +cvmx_helper_interface_mode_t mode; + + mode =__cvmx_get_mode_cnf75xx (xiface); +return mode; + } + +if (OCTEON_IS_MODEL (OCTEON_CN73XX )) { +cvmx_helper_interface_mode_t mode; + + mode =__cvmx_get_mode_cn73xx (xiface); +return mode; + } + +/* +* Octeon II models +*/ +if (OCTEON_IS_OCTEON2 ()) +return __cvmx_get_mode_octeon2 (xi.interface); + +/* +* Octeon and Octeon Plus models +*/ +if (xi.interface ==2 ) { + iface_ops[xi.interface] = &iface_ops_npi; + }else if (xi.interface ==3 ) { + iface_ops[xi.interface] = &iface_ops_dis; + }else { +union cvmx_gmxx_inf_mode mode; + + mode.u64 =csr_rd (CVMX_GMXX_INF_MODE (xi.interface)); + +if (!mode.s.en) + iface_ops[xi.interface] = &iface_ops_dis; +else if (mode.s.type) + iface_ops[xi.interface] = &iface_ops_gmii; +else + iface_ops[xi.interface] = &iface_ops_rgmii; + } + +return iface_ops[xi.interface]->mode; +} + +/** +* Determine the actual number of hardware ports connected to an +* interface. It doesn't setup the ports or enable them. +* +* @param xiface Interface to enumerate +* +* @return The number of ports on the interface, negative on failure +*/ +int cvmx_helper_interface_enumerate (int xiface) +{ +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); +int result =0 ; + +cvmx_helper_interface_get_mode (xiface); +if (iface_node_ops[xi.node][xi.interface]->enumerate) + result = iface_node_ops[xi.node][xi.interface]->enumerate (xiface); + +return result; +} + +/** +* This function probes an interface to determine the actual number of +* hardware ports connected to it. It does some setup the ports but +* doesn't enable them. The main goal here is to set the global +* interface_port_count[interface] correctly. Final hardware setup of +* the ports will be performed later. +* +* @param xiface Interface to probe +* +* @return Zero on success, negative on failure +*/ +int cvmx_helper_interface_probe (int xiface) +{ +/* +* At this stage in the game we don't want packets to be +* moving yet. The following probe calls should perform +* hardware setup needed to determine port counts. Receive +* must still be disabled. +*/ +int nports; +int has_fcs; +enum cvmx_pko_padding padding =CVMX_PKO_PADDING_NONE ; +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + + nports =-1 ; + has_fcs =0 ; + +cvmx_helper_interface_get_mode (xiface); +if (iface_node_ops[xi.node][xi.interface]->probe) + nports = iface_node_ops[xi.node][xi.interface]->probe (xiface); + +switch (iface_node_ops[xi.node][xi.interface]->mode) { +/* These types don't support ports to IPD/PKO */ +case CVMX_HELPER_INTERFACE_MODE_DISABLED : +case CVMX_HELPER_INTERFACE_MODE_PCIE : + nports =0 ; +break ; +/* XAUI is a single high speed port */ +case CVMX_HELPER_INTERFACE_MODE_XAUI : +case CVMX_HELPER_INTERFACE_MODE_RXAUI : +case CVMX_HELPER_INTERFACE_MODE_XLAUI : +case CVMX_HELPER_INTERFACE_MODE_XFI : +case CVMX_HELPER_INTERFACE_MODE_10G_KR : +case CVMX_HELPER_INTERFACE_MODE_40G_KR4 : +case CVMX_HELPER_INTERFACE_MODE_MIXED : + has_fcs =1 ; + padding =CVMX_PKO_PADDING_60 ; +break ; +/* +* RGMII/GMII/MII are all treated about the same. Most +* functions refer to these ports as RGMII. +*/ +case CVMX_HELPER_INTERFACE_MODE_RGMII : +case CVMX_HELPER_INTERFACE_MODE_GMII : + padding =CVMX_PKO_PADDING_60 ; +break ; +/* +* SPI4 can have 1-16 ports depending on the device at +* the other end. +*/ +case CVMX_HELPER_INTERFACE_MODE_SPI : + padding =CVMX_PKO_PADDING_60 ; +break ; +/* +* SGMII can have 1-4 ports depending on how many are +* hooked up. +*/ +case CVMX_HELPER_INTERFACE_MODE_SGMII : +case CVMX_HELPER_INTERFACE_MODE_QSGMII : + padding =CVMX_PKO_PADDING_60 ; +case CVMX_HELPER_INTERFACE_MODE_PICMG : + has_fcs =1 ; +break ; +/* PCI target Network Packet Interface */ +case CVMX_HELPER_INTERFACE_MODE_NPI : +break ; +/* +* Special loopback only ports. These are not the same +* as other ports in loopback mode. +*/ +case CVMX_HELPER_INTERFACE_MODE_LOOP : +break ; +/* SRIO has 2^N ports, where N is number of interfaces */ +case CVMX_HELPER_INTERFACE_MODE_SRIO : +break ; +case CVMX_HELPER_INTERFACE_MODE_ILK : + padding =CVMX_PKO_PADDING_60 ; + has_fcs =1 ; +break ; +case CVMX_HELPER_INTERFACE_MODE_AGL : + has_fcs =1 ; +break ; + } + +if (nports ==-1 ) +return -1 ; + +if (!octeon_has_feature (OCTEON_FEATURE_PKND )) + has_fcs =0 ; + + nports =__cvmx_helper_board_interface_probe (xiface, nports); +__cvmx_helper_init_interface (xiface, nports, has_fcs, padding); +/* Make sure all global variables propagate to other cores */ +CVMX_SYNCWS ; + +return 0 ; +} + +/** +* @INTERNAL +* Setup backpressure. +* +* @return Zero on success, negative on failure +*/ +static int __cvmx_helper_global_setup_backpressure (int node) +{ +cvmx_qos_proto_t qos_proto; +cvmx_qos_pkt_mode_t qos_mode; +int port, xipdport; +unsigned int bpmask; +int interface, xiface, ports; +int num_interfaces =cvmx_helper_get_number_of_interfaces (); + +if (cvmx_rgmii_backpressure_dis) { + qos_proto =CVMX_QOS_PROTO_NONE ; + qos_mode =CVMX_QOS_PKT_MODE_DROP ; + }else { + qos_proto =CVMX_QOS_PROTO_PAUSE ; + qos_mode =CVMX_QOS_PKT_MODE_HWONLY ; + } + +for (interface =0 ; interface < num_interfaces; interface++) { + xiface =cvmx_helper_node_interface_to_xiface (node, interface); + ports =cvmx_helper_ports_on_interface (xiface); + +switch (cvmx_helper_interface_get_mode (xiface)) { +case CVMX_HELPER_INTERFACE_MODE_DISABLED : +case CVMX_HELPER_INTERFACE_MODE_PCIE : +case CVMX_HELPER_INTERFACE_MODE_SRIO : +case CVMX_HELPER_INTERFACE_MODE_ILK : +case CVMX_HELPER_INTERFACE_MODE_NPI : +case CVMX_HELPER_INTERFACE_MODE_PICMG : +break ; +case CVMX_HELPER_INTERFACE_MODE_LOOP : +case CVMX_HELPER_INTERFACE_MODE_XAUI : +case CVMX_HELPER_INTERFACE_MODE_RXAUI : +case CVMX_HELPER_INTERFACE_MODE_XLAUI : +case CVMX_HELPER_INTERFACE_MODE_XFI : +case CVMX_HELPER_INTERFACE_MODE_10G_KR : +case CVMX_HELPER_INTERFACE_MODE_40G_KR4 : + bpmask = (cvmx_rgmii_backpressure_dis) ?0xF :0 ; +if (octeon_has_feature (OCTEON_FEATURE_BGX )) { +for (port =0 ; port < ports; port++) { + xipdport =cvmx_helper_get_ipd_port (xiface, port); +cvmx_bgx_set_flowctl_mode (xipdport, qos_proto, qos_mode); + } +cvmx_bgx_set_backpressure_override (xiface, bpmask); + } +break ; +case CVMX_HELPER_INTERFACE_MODE_RGMII : +case CVMX_HELPER_INTERFACE_MODE_GMII : +case CVMX_HELPER_INTERFACE_MODE_SPI : +case CVMX_HELPER_INTERFACE_MODE_SGMII : +case CVMX_HELPER_INTERFACE_MODE_QSGMII : +case CVMX_HELPER_INTERFACE_MODE_MIXED : + bpmask = (cvmx_rgmii_backpressure_dis) ?0xF :0 ; +if (octeon_has_feature (OCTEON_FEATURE_BGX )) { +for (port =0 ; port < ports; port++) { + xipdport =cvmx_helper_get_ipd_port (xiface, port); +cvmx_bgx_set_flowctl_mode (xipdport, qos_proto, qos_mode); + } +cvmx_bgx_set_backpressure_override (xiface, bpmask); + }else { +cvmx_gmx_set_backpressure_override (interface, bpmask); + } +break ; +case CVMX_HELPER_INTERFACE_MODE_AGL : + bpmask = (cvmx_rgmii_backpressure_dis) ?0x1 :0 ; +cvmx_agl_set_backpressure_override (interface, bpmask); +break ; + } + } +return 0 ; +} + +/** +* @INTERNAL +* Verify the per port IPD backpressure is aligned properly. +* @return Zero if working, non zero if misaligned +*/ +int __cvmx_helper_backpressure_is_misaligned (void ) +{ +return 0 ; +} + +/** +* @INTERNAL +* Enable packet input/output from the hardware. This function is +* called after all internal setup is complete and IPD is enabled. +* After this function completes, packets will be accepted from the +* hardware ports. PKO should still be disabled to make sure packets +* aren't sent out partially setup hardware. +* +* @param xiface Interface to enable +* +* @return Zero on success, negative on failure +*/ +int __cvmx_helper_packet_hardware_enable (int xiface) +{ +int result =0 ; +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); + +if (iface_node_ops[xi.node][xi.interface]->enable) + result = iface_node_ops[xi.node][xi.interface]->enable (xiface); + result |=__cvmx_helper_board_hardware_enable (xiface); +return result; +} + +int cvmx_helper_ipd_and_packet_input_enable (void ) +{ +return cvmx_helper_ipd_and_packet_input_enable_node (cvmx_get_node_num ()); +} + +/** +* Called after all internal packet IO paths are setup. This +* function enables IPD/PIP and begins packet input and output. +* +* @return Zero on success, negative on failure +*/ +int cvmx_helper_ipd_and_packet_input_enable_node (int node) +{ +int num_interfaces; +int interface; +int num_ports; + +if (octeon_has_feature (OCTEON_FEATURE_PKI )) { +cvmx_helper_pki_enable (node); + }else { +/* Enable IPD */ +cvmx_ipd_enable (); + } + +/* +* Time to enable hardware ports packet input and output. Note +* that at this point IPD/PIP must be fully functional and PKO +* must be disabled . +*/ + num_interfaces =cvmx_helper_get_number_of_interfaces (); +for (interface =0 ; interface < num_interfaces; interface++) { +int xiface =cvmx_helper_node_interface_to_xiface (node, interface); + + num_ports =cvmx_helper_ports_on_interface (xiface); +if (num_ports >0 ) +__cvmx_helper_packet_hardware_enable (xiface); + } + +/* Finally enable PKO now that the entire path is up and running */ +/* enable pko */ +if (octeon_has_feature (OCTEON_FEATURE_CN78XX_WQE )) + ;// cvmx_pko_enable_78xx(0); already enabled +else +cvmx_pko_enable (); + +return 0 ; +} + +/** +* Initialize the PIP, IPD, and PKO hardware to support +* simple priority based queues for the ethernet ports. Each +* port is configured with a number of priority queues based +* on CVMX_PKO_QUEUES_PER_PORT_* where each queue is lower +* priority than the previous. +* +* @return Zero on success, non-zero on failure +*/ +int cvmx_helper_initialize_packet_io_node (unsigned int node) +{ +int result =0 ; +int interface; +int xiface; +union cvmx_l2c_cfg l2c_cfg; +union cvmx_smix_en smix_en; +const int num_interfaces =cvmx_helper_get_number_of_interfaces (); + +/* +* Tell L2 to give the IOB statically higher priority compared +* to the cores. This avoids conditions where IO blocks might +* be starved under very high L2 loads. +*/ +if (OCTEON_IS_OCTEON2 () ||OCTEON_IS_OCTEON3 ()) { +union cvmx_l2c_ctl l2c_ctl; + + l2c_ctl.u64 =csr_rd_node (node,CVMX_L2C_CTL ); + l2c_ctl.s.rsp_arb_mode =1 ; + l2c_ctl.s.xmc_arb_mode =0 ; +csr_wr_node (node,CVMX_L2C_CTL , l2c_ctl.u64); + }else { + l2c_cfg.u64 =csr_rd (CVMX_L2C_CFG ); + l2c_cfg.s.lrf_arb_mode =0 ; + l2c_cfg.s.rfb_arb_mode =0 ; +csr_wr (CVMX_L2C_CFG , l2c_cfg.u64); + } + +int smi_inf; +int i; + +/* Newer chips have more than one SMI/MDIO interface */ +if (OCTEON_IS_MODEL (OCTEON_CN68XX ) ||OCTEON_IS_MODEL (OCTEON_CN78XX )) + smi_inf =4 ; +else if (OCTEON_IS_MODEL (OCTEON_CN73XX ) ||OCTEON_IS_MODEL (OCTEON_CNF75XX )) + smi_inf =2 ; +else + smi_inf =2 ; + +for (i =0 ; i < smi_inf; i++) { +/* Make sure SMI/MDIO is enabled so we can query PHYs */ + smix_en.u64 =csr_rd_node (node,CVMX_SMIX_EN (i)); +if (!smix_en.s.en) { + smix_en.s.en =1 ; +csr_wr_node (node,CVMX_SMIX_EN (i), smix_en.u64); + } + } + +//vinita_to_do ask it need to be modify for multinode +__cvmx_helper_init_port_valid (); + +for (interface =0 ; interface < num_interfaces; interface++) { + xiface =cvmx_helper_node_interface_to_xiface (node, interface); + result |=cvmx_helper_interface_probe (xiface); + } + +/* PKO3 init precedes that of interfaces */ +if (octeon_has_feature (OCTEON_FEATURE_CN78XX_WQE )) { +__cvmx_helper_init_port_config_data (node); + result =cvmx_helper_pko3_init_global (node); + }else { + result =cvmx_helper_pko_init (); + } + +/* Errata SSO-29000, Disabling power saving SSO conditional clocking */ +if (octeon_has_feature (OCTEON_FEATURE_CN78XX_WQE )) { +cvmx_sso_ws_cfg_t cfg; + + cfg.u64 =csr_rd_node (node,CVMX_SSO_WS_CFG ); + cfg.s.sso_cclk_dis =1 ; +csr_wr_node (node,CVMX_SSO_WS_CFG , cfg.u64); + } + +if (result <0 ) +return result; + +for (interface =0 ; interface < num_interfaces; interface++) { + xiface =cvmx_helper_node_interface_to_xiface (node, interface); +/* Skip invalid/disabled interfaces */ +if (cvmx_helper_ports_on_interface (xiface) <=0 ) +continue ; +printf ("Node %d Interface %d has %d ports (%s)\n" , node, interface, +cvmx_helper_ports_on_interface (xiface), +cvmx_helper_interface_mode_to_string ( +cvmx_helper_interface_get_mode (xiface))); + + result |=__cvmx_helper_ipd_setup_interface (xiface); +if (octeon_has_feature (OCTEON_FEATURE_CN78XX_WQE )) + result |=cvmx_helper_pko3_init_interface (xiface); +else + result |=__cvmx_helper_interface_setup_pko (interface); + } + +if (octeon_has_feature (OCTEON_FEATURE_PKI )) + result |=__cvmx_helper_pki_global_setup (node); +else + result |=__cvmx_helper_ipd_global_setup (); + +/* Enable any flow control and backpressure */ + result |=__cvmx_helper_global_setup_backpressure (node); + +/* export app config if set */ +if (cvmx_export_app_config) + result |= (*cvmx_export_app_config)(); + +if (cvmx_ipd_cfg.ipd_enable && cvmx_pki_dflt_init[node]) + result |=cvmx_helper_ipd_and_packet_input_enable_node (node); +return result; +} + +/** +* Initialize the PIP, IPD, and PKO hardware to support +* simple priority based queues for the ethernet ports. Each +* port is configured with a number of priority queues based +* on CVMX_PKO_QUEUES_PER_PORT_* where each queue is lower +* priority than the previous. +* +* @return Zero on success, non-zero on failure +*/ +int cvmx_helper_initialize_packet_io_global (void ) +{ +unsigned int node =cvmx_get_node_num (); + +return cvmx_helper_initialize_packet_io_node (node); +} + +/** +* Does core local initialization for packet io +* +* @return Zero on success, non-zero on failure +*/ +int cvmx_helper_initialize_packet_io_local (void ) +{ +if (octeon_has_feature (OCTEON_FEATURE_CN78XX_WQE )) +__cvmx_pko3_dq_table_setup (); + +return 0 ; +} + +struct cvmx_buffer_list { +struct cvmx_buffer_list *next; +}; + +/** +* Disables the sending of flow control (pause) frames on the specified +* GMX port(s). +* +* @param interface Which interface (0 or 1) +* @param port_mask Mask (4bits) of which ports on the interface to disable +* backpressure on. +* 1 => disable backpressure +* 0 => enable backpressure +* +* @return 0 on success +* -1 on error +*/ +int cvmx_gmx_set_backpressure_override (u32 interface,uint32_t port_mask) +{ +union cvmx_gmxx_tx_ovr_bp gmxx_tx_ovr_bp; +/* Check for valid arguments */ +if (port_mask & ~0xf || interface & ~0x1 ) +return -1 ; +if (interface >=CVMX_HELPER_MAX_GMX ) +return -1 ; + + gmxx_tx_ovr_bp.u64 =0 ; + gmxx_tx_ovr_bp.s.en = port_mask;/* Per port Enable back pressure override */ + gmxx_tx_ovr_bp.s.ign_full = port_mask;/* Ignore the RX FIFO full when computing BP */ +csr_wr (CVMX_GMXX_TX_OVR_BP (interface), gmxx_tx_ovr_bp.u64); +return 0 ; +} + +/** +* Disables the sending of flow control (pause) frames on the specified +* AGL (RGMII) port(s). +* +* @param interface Which interface (0 or 1) +* @param port_mask Mask (4bits) of which ports on the interface to disable +* backpressure on. +* 1 => disable backpressure +* 0 => enable backpressure +* +* @return 0 on success +* -1 on error +*/ +int cvmx_agl_set_backpressure_override (u32 interface,uint32_t port_mask) +{ +union cvmx_agl_gmx_tx_ovr_bp agl_gmx_tx_ovr_bp; +int port =cvmx_helper_agl_get_port (interface); + +if (port ==-1 ) +return -1 ; +/* Check for valid arguments */ + agl_gmx_tx_ovr_bp.u64 =0 ; +/* Per port Enable back pressure override */ + agl_gmx_tx_ovr_bp.s.en = port_mask; +/* Ignore the RX FIFO full when computing BP */ + agl_gmx_tx_ovr_bp.s.ign_full = port_mask; +csr_wr (CVMX_GMXX_TX_OVR_BP (port), agl_gmx_tx_ovr_bp.u64); +return 0 ; +} + +/** +* Helper function for global packet IO shutdown +*/ +int cvmx_helper_shutdown_packet_io_global_cn78xx (int node) +{ +int num_interfaces =cvmx_helper_get_number_of_interfaces (); +cvmx_wqe_t *work; +int interface; +int result =0 ; + +/* Shut down all interfaces and disable TX and RX on all ports */ +for (interface =0 ; interface < num_interfaces; interface++) { +int xiface =cvmx_helper_node_interface_to_xiface (node, interface); +int index; +int num_ports =cvmx_helper_ports_on_interface (xiface); + +if (num_ports >4 ) + num_ports =4 ; + +cvmx_bgx_set_backpressure_override (xiface,0 ); +for (index =0 ; index < num_ports; index++) { +cvmx_helper_link_info_t link_info; + +if (!cvmx_helper_is_port_valid (xiface, index)) +continue ; + +cvmx_helper_bgx_shutdown_port (xiface, index); + +/* Turn off link LEDs */ + link_info.u64 =0 ; +cvmx_helper_update_link_led (xiface, index, link_info); + } + } + +/* Stop input first */ +cvmx_helper_pki_shutdown (node); + +/* Retrieve all packets from the SSO and free them */ + result =0 ; +while ((work =cvmx_pow_work_request_sync (CVMX_POW_WAIT ))) { +cvmx_helper_free_pki_pkt_data (work); +cvmx_wqe_pki_free (work); + result++; + } + +if (result >0 ) +debug ("%s: Purged %d packets from SSO\n" , __func__, result); + +/* +* No need to wait for PKO queues to drain, +* dq_close() drains the queues to NULL. +*/ + +/* Shutdown PKO interfaces */ +for (interface =0 ; interface < num_interfaces; interface++) { +int xiface =cvmx_helper_node_interface_to_xiface (node, interface); + +cvmx_helper_pko3_shut_interface (xiface); + } + +/* Disable MAC address filtering */ +for (interface =0 ; interface < num_interfaces; interface++) { +int xiface =cvmx_helper_node_interface_to_xiface (node, interface); + +switch (cvmx_helper_interface_get_mode (xiface)) { +case CVMX_HELPER_INTERFACE_MODE_XAUI : +case CVMX_HELPER_INTERFACE_MODE_RXAUI : +case CVMX_HELPER_INTERFACE_MODE_XLAUI : +case CVMX_HELPER_INTERFACE_MODE_XFI : +case CVMX_HELPER_INTERFACE_MODE_10G_KR : +case CVMX_HELPER_INTERFACE_MODE_40G_KR4 : +case CVMX_HELPER_INTERFACE_MODE_SGMII : +case CVMX_HELPER_INTERFACE_MODE_MIXED : { +int index; +int num_ports =cvmx_helper_ports_on_interface (xiface); + +for (index =0 ; index < num_ports; index++) { +if (!cvmx_helper_is_port_valid (xiface, index)) +continue ; + +/* Reset MAC filtering */ +cvmx_helper_bgx_rx_adr_ctl (node, interface, index,0 ,0 ,0 ); + } +break ; + } +default : +break ; + } + } + +for (interface =0 ; interface < num_interfaces; interface++) { +int index; +int xiface =cvmx_helper_node_interface_to_xiface (node, interface); +int num_ports =cvmx_helper_ports_on_interface (xiface); + +for (index =0 ; index < num_ports; index++) { +/* Doing this twice should clear it since no packets +* can be received. +*/ +cvmx_update_rx_activity_led (xiface, index, false); +cvmx_update_rx_activity_led (xiface, index, false); + } + } + +/* Shutdown the PKO unit */ + result =cvmx_helper_pko3_shutdown (node); + +/* Release interface structures */ +__cvmx_helper_shutdown_interfaces (); + +return result; +} + +/** +* Undo the initialization performed in +* cvmx_helper_initialize_packet_io_global(). After calling this routine and the +* local version on each core, packet IO for Octeon will be disabled and placed +* in the initial reset state. It will then be safe to call the initialize +* later on. Note that this routine does not empty the FPA pools. It frees all +* buffers used by the packet IO hardware to the FPA so a function emptying the +* FPA after shutdown should find all packet buffers in the FPA. +* +* @return Zero on success, negative on failure. +*/ +int cvmx_helper_shutdown_packet_io_global (void ) +{ +const int timeout =5 ;/* Wait up to 5 seconds for timeouts */ +int result =0 ; +int num_interfaces =cvmx_helper_get_number_of_interfaces (); +int interface; +int num_ports; +int index; +struct cvmx_buffer_list *pool0_buffers; +struct cvmx_buffer_list *pool0_buffers_tail; +cvmx_wqe_t *work; +union cvmx_ipd_ctl_status ipd_ctl_status; +int wqe_pool = (int )cvmx_fpa_get_wqe_pool (); +int node =cvmx_get_node_num (); +cvmx_pcsx_mrx_control_reg_t control_reg; + +if (octeon_has_feature (OCTEON_FEATURE_BGX )) +return cvmx_helper_shutdown_packet_io_global_cn78xx (node); + +/* Step 1: Disable all backpressure */ +for (interface =0 ; interface < num_interfaces; interface++) { +cvmx_helper_interface_mode_t mode = +cvmx_helper_interface_get_mode (interface); + +if (mode ==CVMX_HELPER_INTERFACE_MODE_AGL ) +cvmx_agl_set_backpressure_override (interface,0x1 ); +else if (mode !=CVMX_HELPER_INTERFACE_MODE_DISABLED ) +cvmx_gmx_set_backpressure_override (interface,0xf ); + } + +/* Step 2: Wait for the PKO queues to drain */ + result =__cvmx_helper_pko_drain (); +if (result <0 ) { +debug ("WARNING: %s: Failed to drain some PKO queues\n" , + __func__); + } + +/* Step 3: Disable TX and RX on all ports */ +for (interface =0 ; interface < num_interfaces; interface++) { +int xiface =cvmx_helper_node_interface_to_xiface (node, + interface); + +switch (cvmx_helper_interface_get_mode (interface)) { +case CVMX_HELPER_INTERFACE_MODE_DISABLED : +case CVMX_HELPER_INTERFACE_MODE_PCIE : +/* Not a packet interface */ +break ; +case CVMX_HELPER_INTERFACE_MODE_NPI : +case CVMX_HELPER_INTERFACE_MODE_SRIO : +case CVMX_HELPER_INTERFACE_MODE_ILK : +/* +* We don't handle the NPI/NPEI/SRIO packet +* engines. The caller must know these are +* idle. +*/ +break ; +case CVMX_HELPER_INTERFACE_MODE_LOOP : +/* +* Nothing needed. Once PKO is idle, the +* loopback devices must be idle. +*/ +break ; +case CVMX_HELPER_INTERFACE_MODE_SPI : +/* +* SPI cannot be disabled from Octeon. It is +* the responsibility of the caller to make +* sure SPI is idle before doing shutdown. +* +* Fall through and do the same processing as +* RGMII/GMII. +*/ + fallthrough; +case CVMX_HELPER_INTERFACE_MODE_GMII : +case CVMX_HELPER_INTERFACE_MODE_RGMII : +/* Disable outermost RX@the ASX block */ +csr_wr (CVMX_ASXX_RX_PRT_EN (interface),0 ); + num_ports =cvmx_helper_ports_on_interface (xiface); +if (num_ports >4 ) + num_ports =4 ; +for (index =0 ; index < num_ports; index++) { +union cvmx_gmxx_prtx_cfg gmx_cfg; + +if (!cvmx_helper_is_port_valid (interface, index)) +continue ; + gmx_cfg.u64 =csr_rd (CVMX_GMXX_PRTX_CFG (index, interface)); + gmx_cfg.s.en =0 ; +csr_wr (CVMX_GMXX_PRTX_CFG (index, interface), gmx_cfg.u64); +/* Poll the GMX state machine waiting for it to become idle */ +csr_wr (CVMX_NPI_DBG_SELECT , + interface *0x800 + index *0x100 +0x880 ); + if (CVMX_WAIT_FOR_FIELD64(CVMX_DBG_DATA, union cvmx_dbg_data, + data & 7, ==, 0, timeout * 1000000)) { +debug ("GMX RX path timeout waiting for idle\n" ); + result =-1 ; + } + if (CVMX_WAIT_FOR_FIELD64(CVMX_DBG_DATA, union cvmx_dbg_data, + data & 0xf, ==, 0, timeout * 1000000)) { +debug ("GMX TX path timeout waiting for idle\n" ); + result =-1 ; + } + } +/* Disable outermost TX@the ASX block */ +csr_wr (CVMX_ASXX_TX_PRT_EN (interface),0 ); +/* Disable interrupts for interface */ +csr_wr (CVMX_ASXX_INT_EN (interface),0 ); +csr_wr (CVMX_GMXX_TX_INT_EN (interface),0 ); +break ; +case CVMX_HELPER_INTERFACE_MODE_XAUI : +case CVMX_HELPER_INTERFACE_MODE_RXAUI : +case CVMX_HELPER_INTERFACE_MODE_SGMII : +case CVMX_HELPER_INTERFACE_MODE_QSGMII : +case CVMX_HELPER_INTERFACE_MODE_PICMG : + num_ports =cvmx_helper_ports_on_interface (xiface); +if (num_ports >4 ) + num_ports =4 ; +for (index =0 ; index < num_ports; index++) { +union cvmx_gmxx_prtx_cfg gmx_cfg; + +if (!cvmx_helper_is_port_valid (interface, index)) +continue ; + gmx_cfg.u64 =csr_rd (CVMX_GMXX_PRTX_CFG (index, interface)); + gmx_cfg.s.en =0 ; +csr_wr (CVMX_GMXX_PRTX_CFG (index, interface), gmx_cfg.u64); +if (CVMX_WAIT_FOR_FIELD64 (CVMX_GMXX_PRTX_CFG (index, interface), + union cvmx_gmxx_prtx_cfg, rx_idle, ==, 1, + timeout *1000000 )) { +debug ("GMX RX path timeout waiting for idle\n" ); + result =-1 ; + } +if (CVMX_WAIT_FOR_FIELD64 (CVMX_GMXX_PRTX_CFG (index, interface), + union cvmx_gmxx_prtx_cfg, tx_idle, ==, 1, + timeout *1000000 )) { +debug ("GMX TX path timeout waiting for idle\n" ); + result =-1 ; + } +/* For SGMII some PHYs require that the PCS +* interface be powered down and reset (i.e. +* Atheros/Qualcomm PHYs). +*/ +if (cvmx_helper_interface_get_mode (interface) == +CVMX_HELPER_INTERFACE_MODE_SGMII ) { +u64 reg; + + reg =CVMX_PCSX_MRX_CONTROL_REG (index, interface); +/* Power down the interface */ + control_reg.u64 =csr_rd (reg); + control_reg.s.pwr_dn =1 ; +csr_wr (reg, control_reg.u64); +csr_rd (reg); + } + } +break ; +case CVMX_HELPER_INTERFACE_MODE_AGL : { +int port =cvmx_helper_agl_get_port (interface); +union cvmx_agl_gmx_prtx_cfg agl_gmx_cfg; + + agl_gmx_cfg.u64 =csr_rd (CVMX_AGL_GMX_PRTX_CFG (port)); + agl_gmx_cfg.s.en =0 ; +csr_wr (CVMX_AGL_GMX_PRTX_CFG (port), agl_gmx_cfg.u64); +if (CVMX_WAIT_FOR_FIELD64 (CVMX_AGL_GMX_PRTX_CFG (port), + union cvmx_agl_gmx_prtx_cfg, rx_idle, ==, 1, + timeout *1000000 )) { +debug ("AGL RX path timeout waiting for idle\n" ); + result =-1 ; + } +if (CVMX_WAIT_FOR_FIELD64 (CVMX_AGL_GMX_PRTX_CFG (port), + union cvmx_agl_gmx_prtx_cfg, tx_idle, ==, 1, + timeout *1000000 )) { +debug ("AGL TX path timeout waiting for idle\n" ); + result =-1 ; + } + }break ; +default : +break ; + } + } + +/* Step 4: Retrieve all packets from the POW and free them */ +while ((work =cvmx_pow_work_request_sync (CVMX_POW_WAIT ))) { +cvmx_helper_free_packet_data (work); +cvmx_fpa1_free (work, wqe_pool,0 ); + } + +/* Step 5 */ +cvmx_ipd_disable (); + +/* +* Step 6: Drain all prefetched buffers from IPD/PIP. Note that IPD/PIP +* have not been reset yet +*/ +__cvmx_ipd_free_ptr (); + +/* Step 7: Free the PKO command buffers and put PKO in reset */ +cvmx_pko_shutdown (); + +/* Step 8: Disable MAC address filtering */ +for (interface =0 ; interface < num_interfaces; interface++) { +int xiface =cvmx_helper_node_interface_to_xiface (node, interface); + +switch (cvmx_helper_interface_get_mode (interface)) { +case CVMX_HELPER_INTERFACE_MODE_DISABLED : +case CVMX_HELPER_INTERFACE_MODE_PCIE : +case CVMX_HELPER_INTERFACE_MODE_SRIO : +case CVMX_HELPER_INTERFACE_MODE_ILK : +case CVMX_HELPER_INTERFACE_MODE_NPI : +case CVMX_HELPER_INTERFACE_MODE_LOOP : +break ; +case CVMX_HELPER_INTERFACE_MODE_XAUI : +case CVMX_HELPER_INTERFACE_MODE_RXAUI : +case CVMX_HELPER_INTERFACE_MODE_GMII : +case CVMX_HELPER_INTERFACE_MODE_RGMII : +case CVMX_HELPER_INTERFACE_MODE_SPI : +case CVMX_HELPER_INTERFACE_MODE_SGMII : +case CVMX_HELPER_INTERFACE_MODE_QSGMII : +case CVMX_HELPER_INTERFACE_MODE_PICMG : + num_ports =cvmx_helper_ports_on_interface (xiface); +if (num_ports >4 ) + num_ports =4 ; +for (index =0 ; index < num_ports; index++) { +if (!cvmx_helper_is_port_valid (interface, index)) +continue ; +csr_wr (CVMX_GMXX_RXX_ADR_CTL (index, interface),1 ); +csr_wr (CVMX_GMXX_RXX_ADR_CAM_EN (index, interface),0 ); +csr_wr (CVMX_GMXX_RXX_ADR_CAM0 (index, interface),0 ); +csr_wr (CVMX_GMXX_RXX_ADR_CAM1 (index, interface),0 ); +csr_wr (CVMX_GMXX_RXX_ADR_CAM2 (index, interface),0 ); +csr_wr (CVMX_GMXX_RXX_ADR_CAM3 (index, interface),0 ); +csr_wr (CVMX_GMXX_RXX_ADR_CAM4 (index, interface),0 ); +csr_wr (CVMX_GMXX_RXX_ADR_CAM5 (index, interface),0 ); + } +break ; +case CVMX_HELPER_INTERFACE_MODE_AGL : { +int port =cvmx_helper_agl_get_port (interface); + +csr_wr (CVMX_AGL_GMX_RXX_ADR_CTL (port),1 ); +csr_wr (CVMX_AGL_GMX_RXX_ADR_CAM_EN (port),0 ); +csr_wr (CVMX_AGL_GMX_RXX_ADR_CAM0 (port),0 ); +csr_wr (CVMX_AGL_GMX_RXX_ADR_CAM1 (port),0 ); +csr_wr (CVMX_AGL_GMX_RXX_ADR_CAM2 (port),0 ); +csr_wr (CVMX_AGL_GMX_RXX_ADR_CAM3 (port),0 ); +csr_wr (CVMX_AGL_GMX_RXX_ADR_CAM4 (port),0 ); +csr_wr (CVMX_AGL_GMX_RXX_ADR_CAM5 (port),0 ); + }break ; +default : +break ; + } + } + +/* +* Step 9: Drain all FPA buffers out of pool 0 before we reset +* IPD/PIP. This is needed to keep IPD_QUE0_FREE_PAGE_CNT in +* sync. We temporarily keep the buffers in the pool0_buffers +* list. +*/ + pool0_buffers =NULL ; + pool0_buffers_tail =NULL ; +while (1 ) { +struct cvmx_buffer_list *buffer =cvmx_fpa1_alloc (0 ); + +if (buffer) { + buffer->next =NULL ; + +if (!pool0_buffers) + pool0_buffers = buffer; +else + pool0_buffers_tail->next = buffer; + + pool0_buffers_tail = buffer; + }else { +break ; + } + } + +/* Step 10: Reset IPD and PIP */ + ipd_ctl_status.u64 =csr_rd (CVMX_IPD_CTL_STATUS ); + ipd_ctl_status.s.reset =1 ; +csr_wr (CVMX_IPD_CTL_STATUS , ipd_ctl_status.u64); + +/* Make sure IPD has finished reset. */ +if (OCTEON_IS_OCTEON2 () ||OCTEON_IS_MODEL (OCTEON_CN70XX )) { + if (CVMX_WAIT_FOR_FIELD64(CVMX_IPD_CTL_STATUS, union cvmx_ipd_ctl_status, rst_done, + ==, 0, 1000)) { +debug ("IPD reset timeout waiting for idle\n" ); + result =-1 ; + } + } + +/* Step 11: Restore the FPA buffers into pool 0 */ +while (pool0_buffers) { +struct cvmx_buffer_list *n = pool0_buffers->next; + +cvmx_fpa1_free (pool0_buffers,0 ,0 ); + pool0_buffers = n; + } + +/* Step 12: Release interface structures */ +__cvmx_helper_shutdown_interfaces (); + +return result; +} + +/** +* Does core local shutdown of packet io +* +* @return Zero on success, non-zero on failure +*/ +int cvmx_helper_shutdown_packet_io_local (void ) +{ +/* +* Currently there is nothing to do per core. This may change +* in the future. +*/ +return 0 ; +} + +/** +* Auto configure an IPD/PKO port link state and speed. This +* function basically does the equivalent of: +* cvmx_helper_link_set(ipd_port, cvmx_helper_link_get(ipd_port)); +* +* @param xipd_port IPD/PKO port to auto configure +* +* @return Link state after configure +*/ +cvmx_helper_link_info_t cvmx_helper_link_autoconf (int xipd_port) +{ +cvmx_helper_link_info_t link_info; +int xiface =cvmx_helper_get_interface_num (xipd_port); +int index =cvmx_helper_get_interface_index_num (xipd_port); +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); +int interface = xi.interface; + +if (interface ==-1 || index ==-1 || index >=cvmx_helper_ports_on_interface (xiface)) { + link_info.u64 =0 ; +return link_info; + } + + link_info =cvmx_helper_link_get (xipd_port); +if (link_info.u64 == (__cvmx_helper_get_link_info (xiface, index)).u64) +return link_info; + +if (!link_info.s.link_up) +cvmx_error_disable_group (CVMX_ERROR_GROUP_ETHERNET , xipd_port); + +/* If we fail to set the link speed, port_link_info will not change */ +cvmx_helper_link_set (xipd_port, link_info); + +if (link_info.s.link_up) +cvmx_error_enable_group (CVMX_ERROR_GROUP_ETHERNET , xipd_port); + +return link_info; +} + +/** +* Return the link state of an IPD/PKO port as returned by +* auto negotiation. The result of this function may not match +* Octeon's link config if auto negotiation has changed since +* the last call to cvmx_helper_link_set(). +* +* @param xipd_port IPD/PKO port to query +* +* @return Link state +*/ +cvmx_helper_link_info_t cvmx_helper_link_get (int xipd_port) +{ +cvmx_helper_link_info_t result; +int xiface =cvmx_helper_get_interface_num (xipd_port); +int index =cvmx_helper_get_interface_index_num (xipd_port); +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); +struct cvmx_fdt_sfp_info *sfp_info; + +/* +* The default result will be a down link unless the code +* below changes it. +*/ + result.u64 =0 ; + +if (__cvmx_helper_xiface_is_null (xiface) || index ==-1 || + index >=cvmx_helper_ports_on_interface (xiface)) { +return result; + } + +if (iface_node_ops[xi.node][xi.interface]->link_get) + result = iface_node_ops[xi.node][xi.interface]->link_get (xipd_port); + +if (xipd_port >=0 ) { +cvmx_helper_update_link_led (xiface, index, result); + + sfp_info =cvmx_helper_cfg_get_sfp_info (xiface, index); + +while (sfp_info) { +if ((!result.s.link_up || (result.s.link_up && sfp_info->last_mod_abs))) +cvmx_sfp_check_mod_abs (sfp_info, sfp_info->mod_abs_data); + sfp_info = sfp_info->next_iface_sfp; + } + } + +return result; +} + +/** +* Configure an IPD/PKO port for the specified link state. This +* function does not influence auto negotiation at the PHY level. +* The passed link state must always match the link state returned +* by cvmx_helper_link_get(). It is normally best to use +* cvmx_helper_link_autoconf() instead. +* +* @param xipd_port IPD/PKO port to configure +* @param link_info The new link state +* +* @return Zero on success, negative on failure +*/ +int cvmx_helper_link_set (int xipd_port,cvmx_helper_link_info_t link_info) +{ +int result =-1 ; +int xiface =cvmx_helper_get_interface_num (xipd_port); +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); +int index =cvmx_helper_get_interface_index_num (xipd_port); + +if (__cvmx_helper_xiface_is_null (xiface) || index ==-1 || + index >=cvmx_helper_ports_on_interface (xiface)) +return -1 ; + +if (iface_node_ops[xi.node][xi.interface]->link_set) + result = iface_node_ops[xi.node][xi.interface]->link_set (xipd_port, link_info); + +/* +* Set the port_link_info here so that the link status is +* updated no matter how cvmx_helper_link_set is called. We +* don't change the value if link_set failed. +*/ +if (result ==0 ) +__cvmx_helper_set_link_info (xiface, index, link_info); +return result; +} + +/** +* Configure a port for internal and/or external loopback. Internal loopback +* causes packets sent by the port to be received by Octeon. External loopback +* causes packets received from the wire to sent out again. +* +* @param xipd_port IPD/PKO port to loopback. +* @param enable_internal +* Non zero if you want internal loopback +* @param enable_external +* Non zero if you want external loopback +* +* @return Zero on success, negative on failure. +*/ +int cvmx_helper_configure_loopback (int xipd_port,int enable_internal,int enable_external) +{ +int result =-1 ; +int xiface =cvmx_helper_get_interface_num (xipd_port); +struct cvmx_xiface xi =cvmx_helper_xiface_to_node_interface (xiface); +int index =cvmx_helper_get_interface_index_num (xipd_port); + +if (index >=cvmx_helper_ports_on_interface (xiface)) +return -1 ; + +cvmx_helper_interface_get_mode (xiface); +if (iface_node_ops[xi.node][xi.interface]->loopback) + result = iface_node_ops[xi.node][xi.interface]->loopback (xipd_port, enable_internal, + enable_external); + +return result; +} + +void cvmx_helper_setup_simulator_io_buffer_counts (int node,int num_packet_buffers,int pko_buffers) +{ +if (octeon_has_feature (OCTEON_FEATURE_PKI )) { +cvmx_helper_pki_set_dflt_pool_buffer (node, num_packet_buffers); +cvmx_helper_pki_set_dflt_aura_buffer (node, num_packet_buffers); + + }else { +cvmx_ipd_set_packet_pool_buffer_count (num_packet_buffers); +cvmx_ipd_set_wqe_pool_buffer_count (num_packet_buffers); +cvmx_pko_set_cmd_queue_pool_buffer_count (pko_buffers); + } +} + +void *cvmx_helper_mem_alloc (int node,uint64_t alloc_size,uint64_t align) +{ +s64 paddr; + + paddr =cvmx_bootmem_phy_alloc_range (alloc_size, align,cvmx_addr_on_node (node,0ull ), +cvmx_addr_on_node (node,0xffffffffff )); +if (paddr <=0ll ) { +printf ("ERROR: %s failed size %u\n" , __func__, (unsigned int )alloc_size); +return NULL ; + } +return cvmx_phys_to_ptr (paddr); +} + +void cvmx_helper_mem_free (void *buffer,uint64_t size) +{ +__cvmx_bootmem_phy_free (cvmx_ptr_to_phys (buffer), size,0 ); +} + +int cvmx_helper_qos_config_init (cvmx_qos_proto_t qos_proto,cvmx_qos_config_t *qos_cfg) +{ +int i; + +memset (qos_cfg,0 ,sizeof (cvmx_qos_config_t)); + qos_cfg->pkt_mode =CVMX_QOS_PKT_MODE_HWONLY ;/* Process PAUSEs in hardware only.*/ + qos_cfg->pool_mode =CVMX_QOS_POOL_PER_PORT ;/* One Pool per BGX:LMAC.*/ + qos_cfg->pktbuf_size =2048 ;/* Fit WQE + MTU in one buffer.*/ + qos_cfg->aura_size =1024 ;/* 1K buffers typically enough for any application.*/ + qos_cfg->pko_pfc_en =1 ;/* Enable PKO layout for PFC feature. */ + qos_cfg->vlan_num =1 ;/* For Stacked VLAN, use 2nd VLAN in the QPG algorithm.*/ + qos_cfg->qos_proto = qos_proto;/* Use PFC flow-control protocol.*/ + qos_cfg->qpg_base =-1 ;/* QPG Table index is undefined.*/ + qos_cfg->p_time =0x60 ;/* PAUSE packets time window.*/ + qos_cfg->p_interval =0x10 ;/* PAUSE packets interval.*/ +for (i =0 ; i <CVMX_QOS_NUM ; i++) { + qos_cfg->groups[i] = i;/* SSO Groups = 0...7 */ + qos_cfg->group_prio[i] = i;/* SSO Group priority = QOS. */ + qos_cfg->drop_thresh[i] =99 ;/* 99% of the Aura size.*/ + qos_cfg->red_thresh[i] =90 ;/* 90% of the Aura size.*/ + qos_cfg->bp_thresh[i] =70 ;/* 70% of the Aura size.*/ + } +return 0 ; +} + +int cvmx_helper_qos_port_config_update (int xipdport,cvmx_qos_config_t *qos_cfg) +{ +cvmx_user_static_pko_queue_config_t pkocfg; +cvmx_xport_t xp =cvmx_helper_ipd_port_to_xport (xipdport); +int xiface =cvmx_helper_get_interface_num (xipdport); +cvmx_xiface_t xi =cvmx_helper_xiface_to_node_interface (xiface); + +/* Configure PKO port for PFC SQ layout: */ +cvmx_helper_pko_queue_config_get (xp.node, &pkocfg); + pkocfg.pknd.pko_cfg_iface[xi.interface].pfc_enable =1 ; +cvmx_helper_pko_queue_config_set (xp.node, &pkocfg); +return 0 ; +} + +int cvmx_helper_qos_port_setup (int xipdport,cvmx_qos_config_t *qos_cfg) +{ +const int channles =CVMX_QOS_NUM ; +int bufsize = qos_cfg->pktbuf_size; +int aura_size = qos_cfg->aura_size; +cvmx_xport_t xp =cvmx_helper_ipd_port_to_xport (xipdport); +int node = xp.node; +int ipdport = xp.port; +int port =cvmx_helper_get_interface_index_num (xp.port); +int xiface =cvmx_helper_get_interface_num (xipdport); +cvmx_xiface_t xi =cvmx_helper_xiface_to_node_interface (xiface); +cvmx_fpa3_pool_t gpool; +cvmx_fpa3_gaura_t gaura; +cvmx_bgxx_cmr_rx_ovr_bp_t ovrbp; +struct cvmx_pki_qpg_config qpgcfg; +struct cvmx_pki_style_config stcfg, stcfg_dflt; +struct cvmx_pki_pkind_config pkcfg; +int chan, bpid, group, qpg; +int bpen, reden, dropen, passthr, dropthr, bpthr; +int nbufs, pkind, style; +char name[32 ]; + +if (qos_cfg->pool_mode ==CVMX_QOS_POOL_PER_PORT ) { +/* Allocate and setup packet Pool: */ + nbufs = aura_size * channles; +sprintf (name,"QOS.P%d" , ipdport); + gpool =cvmx_fpa3_setup_fill_pool (node,-1 /*auto*/ , name, bufsize, nbufs,NULL ); +if (!__cvmx_fpa3_pool_valid (gpool)) { +printf ("%s: Failed to setup FPA Pool\n" , __func__); +return -1 ; + } +for (chan =0 ; chan < channles; chan++) + qos_cfg->gpools[chan] = gpool; + }else { +printf ("%s: Invalid pool_mode %d\n" , __func__, qos_cfg->pool_mode); +return -1 ; + } +/* Allocate QPG entries: */ + qos_cfg->qpg_base =cvmx_pki_qpg_entry_alloc (node,-1 /*auto*/ , channles); +if (qos_cfg->qpg_base <0 ) { +printf ("%s: Failed to allocate QPG entry\n" , __func__); +return -1 ; + } +for (chan =0 ; chan < channles; chan++) { +/* Allocate and setup Aura, setup BP threshold: */ + gpool = qos_cfg->gpools[chan]; +sprintf (name,"QOS.A%d" , ipdport + chan); + gaura =cvmx_fpa3_set_aura_for_pool (gpool,-1 /*auto*/ , name, bufsize, aura_size); +if (!__cvmx_fpa3_aura_valid (gaura)) { +printf ("%s: Failed to setup FPA Aura for Channel %d\n" , __func__, chan); +return -1 ; + } + qos_cfg->gauras[chan] = gaura; + bpen =1 ; + reden =1 ; + dropen =1 ; + dropthr = (qos_cfg->drop_thresh[chan] *10 * aura_size) /1000 ; + passthr = (qos_cfg->red_thresh[chan] *10 * aura_size) /1000 ; + bpthr = (qos_cfg->bp_thresh[chan] *10 * aura_size) /1000 ; +cvmx_fpa3_setup_aura_qos (gaura, reden, passthr, dropthr, bpen, bpthr); +cvmx_pki_enable_aura_qos (node, gaura.laura, reden, dropen, bpen); + +/* Allocate BPID, link Aura and Channel using BPID: */ + bpid =cvmx_pki_bpid_alloc (node,-1 /*auto*/ ); +if (bpid <0 ) { +printf ("%s: Failed to allocate BPID for channel %d\n" , + __func__, chan); +return -1 ; + } + qos_cfg->bpids[chan] = bpid; +cvmx_pki_write_aura_bpid (node, gaura.laura, bpid); +cvmx_pki_write_channel_bpid (node, ipdport + chan, bpid); + +/* Setup QPG entries: */ + group = qos_cfg->groups[chan]; + qpg = qos_cfg->qpg_base + chan; +cvmx_pki_read_qpg_entry (node, qpg, &qpgcfg); + qpgcfg.port_add = chan; + qpgcfg.aura_num = gaura.laura; + qpgcfg.grp_ok = (node <<CVMX_WQE_GRP_NODE_SHIFT ) | group; + qpgcfg.grp_bad = (node <<CVMX_WQE_GRP_NODE_SHIFT ) | group; + qpgcfg.grptag_ok = (node <<CVMX_WQE_GRP_NODE_SHIFT ) |0 ; + qpgcfg.grptag_bad = (node <<CVMX_WQE_GRP_NODE_SHIFT ) |0 ; +cvmx_pki_write_qpg_entry (node, qpg, &qpgcfg); + } +/* Allocate and setup STYLE: */ +cvmx_helper_pki_get_dflt_style (node, &stcfg_dflt); + style =cvmx_pki_style_alloc (node,-1 /*auto*/ ); +cvmx_pki_read_style_config (node, style,CVMX_PKI_CLUSTER_ALL , &stcfg); + stcfg.tag_cfg = stcfg_dflt.tag_cfg; + stcfg.parm_cfg.tag_type =CVMX_POW_TAG_TYPE_ORDERED ; + stcfg.parm_cfg.qpg_qos =CVMX_PKI_QPG_QOS_VLAN ; + stcfg.parm_cfg.qpg_base = qos_cfg->qpg_base; + stcfg.parm_cfg.qpg_port_msb =0 ; + stcfg.parm_cfg.qpg_port_sh =0 ; + stcfg.parm_cfg.qpg_dis_grptag =1 ; + stcfg.parm_cfg.fcs_strip =1 ; + stcfg.parm_cfg.mbuff_size = bufsize -64 ;/* Do not use 100% of the buffer. */ + stcfg.parm_cfg.force_drop =0 ; + stcfg.parm_cfg.nodrop =0 ; + stcfg.parm_cfg.rawdrp =0 ; + stcfg.parm_cfg.cache_mode =2 ;/* 1st buffer in L2 */ + stcfg.parm_cfg.wqe_vs = qos_cfg->vlan_num; +cvmx_pki_write_style_config (node, style,CVMX_PKI_CLUSTER_ALL , &stcfg); + +/* Setup PKIND: */ + pkind =cvmx_helper_get_pknd (xiface, port); +cvmx_pki_read_pkind_config (node, pkind, &pkcfg); + pkcfg.cluster_grp =0 ;/* OCTEON3 has only one cluster group = 0 */ + pkcfg.initial_style = style; + pkcfg.initial_parse_mode =CVMX_PKI_PARSE_LA_TO_LG ; +cvmx_pki_write_pkind_config (node, pkind, &pkcfg); + +/* Setup parameters of the QOS packet and enable QOS flow-control: */ +cvmx_bgx_set_pause_pkt_param (xipdport,0 ,0x0180c2000001 ,0x8808 , qos_cfg->p_time, + qos_cfg->p_interval); +cvmx_bgx_set_flowctl_mode (xipdport, qos_cfg->qos_proto, qos_cfg->pkt_mode); + +/* Enable PKI channel backpressure in the BGX: */ + ovrbp.u64 =csr_rd_node (node,CVMX_BGXX_CMR_RX_OVR_BP (xi.interface)); + ovrbp.s.en &= ~(1 << port); + ovrbp.s.ign_fifo_bp &= ~(1 << port); +csr_wr_node (node,CVMX_BGXX_CMR_RX_OVR_BP (xi.interface), ovrbp.u64); +return 0 ; +} + +int cvmx_helper_qos_sso_setup (int xipdport,cvmx_qos_config_t *qos_cfg) +{ +const int channels =CVMX_QOS_NUM ; +cvmx_sso_grpx_pri_t grppri; +int chan, qos, group; +cvmx_xport_t xp =cvmx_helper_ipd_port_to_xport (xipdport); +int node = xp.node; + +for (chan =0 ; chan < channels; chan++) { + qos =cvmx_helper_qos2prio (chan); + group = qos_cfg->groups[qos]; + grppri.u64 =csr_rd_node (node,CVMX_SSO_GRPX_PRI (group)); + grppri.s.pri = qos_cfg->group_prio[chan]; +csr_wr_node (node,CVMX_SSO_GRPX_PRI (group), grppri.u64); + } +return 0 ; +} + +int cvmx_helper_get_chan_e_name (int chan,char *namebuf,int buflen) +{ +int n, dpichans; + +if ((unsigned int )chan >=CVMX_PKO3_IPD_NUM_MAX ) { +printf ("%s: Channel %d is out of range (0..4095)\n" , __func__, chan); +return -1 ; + } +if (OCTEON_IS_MODEL (OCTEON_CN78XX )) + dpichans =64 ; +else + dpichans =128 ; + +if (chan >=0 && chan <64 ) + n =snprintf (namebuf, buflen,"LBK%d" , chan); +else if (chan >=0x100 && chan < (0x100 + dpichans)) + n =snprintf (namebuf, buflen,"DPI%d" , chan -0x100 ); +else if (chan ==0x200 ) + n =snprintf (namebuf, buflen,"NQM" ); +else if (chan >=0x240 && chan < (0x240 + (1 <<1 ) +2 )) + n =snprintf (namebuf, buflen,"SRIO%d:%d" , (chan -0x240 ) >>1 , + (chan -0x240 ) &0x1 ); +else if (chan >=0x400 && chan < (0x400 + (1 <<8 ) +256 )) + n =snprintf (namebuf, buflen,"ILK%d:%d" , (chan -0x400 ) >>8 , + (chan -0x400 ) &0xFF ); +else if (chan >=0x800 && chan < (0x800 + (5 <<8 ) + (3 <<4 ) +16 )) + n =snprintf (namebuf, buflen,"BGX%d:%d:%d" , (chan -0x800 ) >>8 , + ((chan -0x800 ) >>4 ) &0x3 , (chan -0x800 ) &0xF ); +else + n =snprintf (namebuf, buflen,"--" ); +return n; +} + +#ifdef CVMX_DUMP_DIAGNOSTICS +void cvmx_helper_dump_for_diagnostics (int node) +{ +if (!(OCTEON_IS_OCTEON3 () && !OCTEON_IS_MODEL (OCTEON_CN70XX ))) { +printf ("Diagnostics are not implemented for this model\n" ); +return ; + } +#ifdef CVMX_DUMP_GSER + { +int qlm, num_qlms; + + num_qlms =cvmx_qlm_get_num (); +for (qlm =0 ; qlm < num_qlms; qlm++) { +cvmx_dump_gser_config_node (node, qlm); +cvmx_dump_gser_status_node (node, qlm); + } + } +#endif +#ifdef CVMX_DUMP_BGX + { +int bgx; + +for (bgx =0 ; bgx <CVMX_HELPER_MAX_GMX ; bgx++) { +cvmx_dump_bgx_config_node (node, bgx); +cvmx_dump_bgx_status_node (node, bgx); + } + } +#endif +#ifdef CVMX_DUMP_PKI +cvmx_pki_config_dump (node); +cvmx_pki_stats_dump (node); +#endif +#ifdef CVMX_DUMP_PKO +cvmx_helper_pko3_config_dump (node); +cvmx_helper_pko3_stats_dump (node); +#endif +#ifdef CVMX_DUMO_SSO +cvmx_sso_config_dump (node); +#endif +} +#endif
Signature · 1 line
2.29.2