18c2ecf20Sopenharmony_ci/***********************license start***************
28c2ecf20Sopenharmony_ci * Author: Cavium Networks
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Contact: support@caviumnetworks.com
58c2ecf20Sopenharmony_ci * This file is part of the OCTEON SDK
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * Copyright (c) 2003-2017 Cavium, Inc.
88c2ecf20Sopenharmony_ci *
98c2ecf20Sopenharmony_ci * This file is free software; you can redistribute it and/or modify
108c2ecf20Sopenharmony_ci * it under the terms of the GNU General Public License, Version 2, as
118c2ecf20Sopenharmony_ci * published by the Free Software Foundation.
128c2ecf20Sopenharmony_ci *
138c2ecf20Sopenharmony_ci * This file is distributed in the hope that it will be useful, but
148c2ecf20Sopenharmony_ci * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
158c2ecf20Sopenharmony_ci * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
168c2ecf20Sopenharmony_ci * NONINFRINGEMENT.  See the GNU General Public License for more
178c2ecf20Sopenharmony_ci * details.
188c2ecf20Sopenharmony_ci *
198c2ecf20Sopenharmony_ci * You should have received a copy of the GNU General Public License
208c2ecf20Sopenharmony_ci * along with this file; if not, write to the Free Software
218c2ecf20Sopenharmony_ci * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
228c2ecf20Sopenharmony_ci * or visit http://www.gnu.org/licenses/.
238c2ecf20Sopenharmony_ci *
248c2ecf20Sopenharmony_ci * This file may also be available under a different license from Cavium.
258c2ecf20Sopenharmony_ci * Contact Cavium Networks for more information
268c2ecf20Sopenharmony_ci ***********************license end**************************************/
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci#ifndef __CVMX_SLI_DEFS_H__
298c2ecf20Sopenharmony_ci#define __CVMX_SLI_DEFS_H__
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci#include <uapi/asm/bitfield.h>
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci#define CVMX_SLI_PCIE_MSI_RCV CVMX_SLI_PCIE_MSI_RCV_FUNC()
348c2ecf20Sopenharmony_cistatic inline uint64_t CVMX_SLI_PCIE_MSI_RCV_FUNC(void)
358c2ecf20Sopenharmony_ci{
368c2ecf20Sopenharmony_ci	switch (cvmx_get_octeon_family()) {
378c2ecf20Sopenharmony_ci	case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
388c2ecf20Sopenharmony_ci	case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
398c2ecf20Sopenharmony_ci	case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
408c2ecf20Sopenharmony_ci	case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
418c2ecf20Sopenharmony_ci	case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
428c2ecf20Sopenharmony_ci	case OCTEON_CN70XX & OCTEON_FAMILY_MASK:
438c2ecf20Sopenharmony_ci		return 0x0000000000003CB0ull;
448c2ecf20Sopenharmony_ci	case OCTEON_CNF75XX & OCTEON_FAMILY_MASK:
458c2ecf20Sopenharmony_ci	case OCTEON_CN73XX & OCTEON_FAMILY_MASK:
468c2ecf20Sopenharmony_ci	case OCTEON_CN78XX & OCTEON_FAMILY_MASK:
478c2ecf20Sopenharmony_ci		if (OCTEON_IS_MODEL(OCTEON_CN78XX_PASS1_X))
488c2ecf20Sopenharmony_ci			return 0x0000000000003CB0ull;
498c2ecf20Sopenharmony_ci		fallthrough;
508c2ecf20Sopenharmony_ci	default:
518c2ecf20Sopenharmony_ci		return 0x0000000000023CB0ull;
528c2ecf20Sopenharmony_ci	}
538c2ecf20Sopenharmony_ci}
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ciunion cvmx_sli_ctl_portx {
578c2ecf20Sopenharmony_ci	uint64_t u64;
588c2ecf20Sopenharmony_ci	struct cvmx_sli_ctl_portx_s {
598c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t reserved_22_63:42,
608c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t intd:1,
618c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t intc:1,
628c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t intb:1,
638c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t inta:1,
648c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t dis_port:1,
658c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t waitl_com:1,
668c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t intd_map:2,
678c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t intc_map:2,
688c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t intb_map:2,
698c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t inta_map:2,
708c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t ctlp_ro:1,
718c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t reserved_6_6:1,
728c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t ptlp_ro:1,
738c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t reserved_1_4:4,
748c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t wait_com:1,
758c2ecf20Sopenharmony_ci		;))))))))))))))))
768c2ecf20Sopenharmony_ci	} s;
778c2ecf20Sopenharmony_ci};
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ciunion cvmx_sli_mem_access_ctl {
808c2ecf20Sopenharmony_ci	uint64_t u64;
818c2ecf20Sopenharmony_ci	struct cvmx_sli_mem_access_ctl_s {
828c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t reserved_14_63:50,
838c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t max_word:4,
848c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t timer:10,
858c2ecf20Sopenharmony_ci		;)))
868c2ecf20Sopenharmony_ci	} s;
878c2ecf20Sopenharmony_ci};
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ciunion cvmx_sli_s2m_portx_ctl {
908c2ecf20Sopenharmony_ci	uint64_t u64;
918c2ecf20Sopenharmony_ci	struct cvmx_sli_s2m_portx_ctl_s {
928c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t reserved_5_63:59,
938c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t wind_d:1,
948c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t bar0_d:1,
958c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t mrrs:3,
968c2ecf20Sopenharmony_ci		;))))
978c2ecf20Sopenharmony_ci	} s;
988c2ecf20Sopenharmony_ci};
998c2ecf20Sopenharmony_ci
1008c2ecf20Sopenharmony_ciunion cvmx_sli_mem_access_subidx {
1018c2ecf20Sopenharmony_ci	uint64_t u64;
1028c2ecf20Sopenharmony_ci	struct cvmx_sli_mem_access_subidx_s {
1038c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t reserved_43_63:21,
1048c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t zero:1,
1058c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t port:3,
1068c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t nmerge:1,
1078c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t esr:2,
1088c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t esw:2,
1098c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t wtype:2,
1108c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t rtype:2,
1118c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t ba:30,
1128c2ecf20Sopenharmony_ci		;)))))))))
1138c2ecf20Sopenharmony_ci	} s;
1148c2ecf20Sopenharmony_ci	struct cvmx_sli_mem_access_subidx_cn68xx {
1158c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t reserved_43_63:21,
1168c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t zero:1,
1178c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t port:3,
1188c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t nmerge:1,
1198c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t esr:2,
1208c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t esw:2,
1218c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t wtype:2,
1228c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t rtype:2,
1238c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t ba:28,
1248c2ecf20Sopenharmony_ci		__BITFIELD_FIELD(uint64_t reserved_0_1:2,
1258c2ecf20Sopenharmony_ci		;))))))))))
1268c2ecf20Sopenharmony_ci	} cn68xx;
1278c2ecf20Sopenharmony_ci};
1288c2ecf20Sopenharmony_ci
1298c2ecf20Sopenharmony_ci#endif
130