18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci *  linux/drivers/net/ethernet/ibm/ehea/ehea_phyp.h
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci *  eHEA ethernet device driver for IBM eServer System p
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci *  (C) Copyright IBM Corp. 2006
88c2ecf20Sopenharmony_ci *
98c2ecf20Sopenharmony_ci *  Authors:
108c2ecf20Sopenharmony_ci *       Christoph Raisch <raisch@de.ibm.com>
118c2ecf20Sopenharmony_ci *       Jan-Bernd Themann <themann@de.ibm.com>
128c2ecf20Sopenharmony_ci *       Thomas Klein <tklein@de.ibm.com>
138c2ecf20Sopenharmony_ci */
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci#ifndef __EHEA_PHYP_H__
168c2ecf20Sopenharmony_ci#define __EHEA_PHYP_H__
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci#include <linux/delay.h>
198c2ecf20Sopenharmony_ci#include <asm/hvcall.h>
208c2ecf20Sopenharmony_ci#include "ehea.h"
218c2ecf20Sopenharmony_ci#include "ehea_hw.h"
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci/* Some abbreviations used here:
248c2ecf20Sopenharmony_ci *
258c2ecf20Sopenharmony_ci * hcp_*  - structures, variables and functions releated to Hypervisor Calls
268c2ecf20Sopenharmony_ci */
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci/* Number of pages which can be registered at once by H_REGISTER_HEA_RPAGES */
298c2ecf20Sopenharmony_ci#define EHEA_MAX_RPAGE 512
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci/* Notification Event Queue (NEQ) Entry bit masks */
328c2ecf20Sopenharmony_ci#define NEQE_EVENT_CODE		EHEA_BMASK_IBM(2, 7)
338c2ecf20Sopenharmony_ci#define NEQE_PORTNUM  		EHEA_BMASK_IBM(32, 47)
348c2ecf20Sopenharmony_ci#define NEQE_PORT_UP		EHEA_BMASK_IBM(16, 16)
358c2ecf20Sopenharmony_ci#define NEQE_EXTSWITCH_PORT_UP	EHEA_BMASK_IBM(17, 17)
368c2ecf20Sopenharmony_ci#define NEQE_EXTSWITCH_PRIMARY	EHEA_BMASK_IBM(18, 18)
378c2ecf20Sopenharmony_ci#define NEQE_PLID		EHEA_BMASK_IBM(16, 47)
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci/* Notification Event Codes */
408c2ecf20Sopenharmony_ci#define EHEA_EC_PORTSTATE_CHG	0x30
418c2ecf20Sopenharmony_ci#define EHEA_EC_ADAPTER_MALFUNC	0x32
428c2ecf20Sopenharmony_ci#define EHEA_EC_PORT_MALFUNC	0x33
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci/* Notification Event Log Register (NELR) bit masks */
458c2ecf20Sopenharmony_ci#define NELR_PORT_MALFUNC	EHEA_BMASK_IBM(61, 61)
468c2ecf20Sopenharmony_ci#define NELR_ADAPTER_MALFUNC	EHEA_BMASK_IBM(62, 62)
478c2ecf20Sopenharmony_ci#define NELR_PORTSTATE_CHG	EHEA_BMASK_IBM(63, 63)
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_cistatic inline void hcp_epas_ctor(struct h_epas *epas, u64 paddr_kernel,
508c2ecf20Sopenharmony_ci				 u64 paddr_user)
518c2ecf20Sopenharmony_ci{
528c2ecf20Sopenharmony_ci	/* To support 64k pages we must round to 64k page boundary */
538c2ecf20Sopenharmony_ci	epas->kernel.addr = ioremap((paddr_kernel & PAGE_MASK), PAGE_SIZE) +
548c2ecf20Sopenharmony_ci			    (paddr_kernel & ~PAGE_MASK);
558c2ecf20Sopenharmony_ci	epas->user.addr = paddr_user;
568c2ecf20Sopenharmony_ci}
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_cistatic inline void hcp_epas_dtor(struct h_epas *epas)
598c2ecf20Sopenharmony_ci{
608c2ecf20Sopenharmony_ci	if (epas->kernel.addr)
618c2ecf20Sopenharmony_ci		iounmap((void __iomem *)((u64)epas->kernel.addr & PAGE_MASK));
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci	epas->user.addr = 0;
648c2ecf20Sopenharmony_ci	epas->kernel.addr = 0;
658c2ecf20Sopenharmony_ci}
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_cistruct hcp_modify_qp_cb0 {
688c2ecf20Sopenharmony_ci	u64 qp_ctl_reg;		/* 00 */
698c2ecf20Sopenharmony_ci	u32 max_swqe;		/* 02 */
708c2ecf20Sopenharmony_ci	u32 max_rwqe;		/* 03 */
718c2ecf20Sopenharmony_ci	u32 port_nb;		/* 04 */
728c2ecf20Sopenharmony_ci	u32 reserved0;		/* 05 */
738c2ecf20Sopenharmony_ci	u64 qp_aer;		/* 06 */
748c2ecf20Sopenharmony_ci	u64 qp_tenure;		/* 08 */
758c2ecf20Sopenharmony_ci};
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci/* Hcall Query/Modify Queue Pair Control Block 0 Selection Mask Bits */
788c2ecf20Sopenharmony_ci#define H_QPCB0_ALL             EHEA_BMASK_IBM(0, 5)
798c2ecf20Sopenharmony_ci#define H_QPCB0_QP_CTL_REG      EHEA_BMASK_IBM(0, 0)
808c2ecf20Sopenharmony_ci#define H_QPCB0_MAX_SWQE        EHEA_BMASK_IBM(1, 1)
818c2ecf20Sopenharmony_ci#define H_QPCB0_MAX_RWQE        EHEA_BMASK_IBM(2, 2)
828c2ecf20Sopenharmony_ci#define H_QPCB0_PORT_NB         EHEA_BMASK_IBM(3, 3)
838c2ecf20Sopenharmony_ci#define H_QPCB0_QP_AER          EHEA_BMASK_IBM(4, 4)
848c2ecf20Sopenharmony_ci#define H_QPCB0_QP_TENURE       EHEA_BMASK_IBM(5, 5)
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_ci/* Queue Pair Control Register Status Bits */
878c2ecf20Sopenharmony_ci#define H_QP_CR_ENABLED		    0x8000000000000000ULL /* QP enabled */
888c2ecf20Sopenharmony_ci							  /* QP States: */
898c2ecf20Sopenharmony_ci#define H_QP_CR_STATE_RESET	    0x0000010000000000ULL /*  Reset */
908c2ecf20Sopenharmony_ci#define H_QP_CR_STATE_INITIALIZED   0x0000020000000000ULL /*  Initialized */
918c2ecf20Sopenharmony_ci#define H_QP_CR_STATE_RDY2RCV	    0x0000030000000000ULL /*  Ready to recv */
928c2ecf20Sopenharmony_ci#define H_QP_CR_STATE_RDY2SND	    0x0000050000000000ULL /*  Ready to send */
938c2ecf20Sopenharmony_ci#define H_QP_CR_STATE_ERROR	    0x0000800000000000ULL /*  Error */
948c2ecf20Sopenharmony_ci#define H_QP_CR_RES_STATE 	    0x0000007F00000000ULL /* Resultant state */
958c2ecf20Sopenharmony_ci
968c2ecf20Sopenharmony_cistruct hcp_modify_qp_cb1 {
978c2ecf20Sopenharmony_ci	u32 qpn;		/* 00 */
988c2ecf20Sopenharmony_ci	u32 qp_asyn_ev_eq_nb;	/* 01 */
998c2ecf20Sopenharmony_ci	u64 sq_cq_handle;	/* 02 */
1008c2ecf20Sopenharmony_ci	u64 rq_cq_handle;	/* 04 */
1018c2ecf20Sopenharmony_ci	/* sgel = scatter gather element */
1028c2ecf20Sopenharmony_ci	u32 sgel_nb_sq;		/* 06 */
1038c2ecf20Sopenharmony_ci	u32 sgel_nb_rq1;	/* 07 */
1048c2ecf20Sopenharmony_ci	u32 sgel_nb_rq2;	/* 08 */
1058c2ecf20Sopenharmony_ci	u32 sgel_nb_rq3;	/* 09 */
1068c2ecf20Sopenharmony_ci};
1078c2ecf20Sopenharmony_ci
1088c2ecf20Sopenharmony_ci/* Hcall Query/Modify Queue Pair Control Block 1 Selection Mask Bits */
1098c2ecf20Sopenharmony_ci#define H_QPCB1_ALL             EHEA_BMASK_IBM(0, 7)
1108c2ecf20Sopenharmony_ci#define H_QPCB1_QPN             EHEA_BMASK_IBM(0, 0)
1118c2ecf20Sopenharmony_ci#define H_QPCB1_ASYN_EV_EQ_NB   EHEA_BMASK_IBM(1, 1)
1128c2ecf20Sopenharmony_ci#define H_QPCB1_SQ_CQ_HANDLE    EHEA_BMASK_IBM(2, 2)
1138c2ecf20Sopenharmony_ci#define H_QPCB1_RQ_CQ_HANDLE    EHEA_BMASK_IBM(3, 3)
1148c2ecf20Sopenharmony_ci#define H_QPCB1_SGEL_NB_SQ      EHEA_BMASK_IBM(4, 4)
1158c2ecf20Sopenharmony_ci#define H_QPCB1_SGEL_NB_RQ1     EHEA_BMASK_IBM(5, 5)
1168c2ecf20Sopenharmony_ci#define H_QPCB1_SGEL_NB_RQ2     EHEA_BMASK_IBM(6, 6)
1178c2ecf20Sopenharmony_ci#define H_QPCB1_SGEL_NB_RQ3     EHEA_BMASK_IBM(7, 7)
1188c2ecf20Sopenharmony_ci
1198c2ecf20Sopenharmony_cistruct hcp_query_ehea {
1208c2ecf20Sopenharmony_ci	u32 cur_num_qps;		/* 00 */
1218c2ecf20Sopenharmony_ci	u32 cur_num_cqs;		/* 01 */
1228c2ecf20Sopenharmony_ci	u32 cur_num_eqs;		/* 02 */
1238c2ecf20Sopenharmony_ci	u32 cur_num_mrs;		/* 03 */
1248c2ecf20Sopenharmony_ci	u32 auth_level;			/* 04 */
1258c2ecf20Sopenharmony_ci	u32 max_num_qps;		/* 05 */
1268c2ecf20Sopenharmony_ci	u32 max_num_cqs;		/* 06 */
1278c2ecf20Sopenharmony_ci	u32 max_num_eqs;		/* 07 */
1288c2ecf20Sopenharmony_ci	u32 max_num_mrs;		/* 08 */
1298c2ecf20Sopenharmony_ci	u32 reserved0;			/* 09 */
1308c2ecf20Sopenharmony_ci	u32 int_clock_freq;		/* 10 */
1318c2ecf20Sopenharmony_ci	u32 max_num_pds;		/* 11 */
1328c2ecf20Sopenharmony_ci	u32 max_num_addr_handles;	/* 12 */
1338c2ecf20Sopenharmony_ci	u32 max_num_cqes;		/* 13 */
1348c2ecf20Sopenharmony_ci	u32 max_num_wqes;		/* 14 */
1358c2ecf20Sopenharmony_ci	u32 max_num_sgel_rq1wqe;	/* 15 */
1368c2ecf20Sopenharmony_ci	u32 max_num_sgel_rq2wqe;	/* 16 */
1378c2ecf20Sopenharmony_ci	u32 max_num_sgel_rq3wqe;	/* 17 */
1388c2ecf20Sopenharmony_ci	u32 mr_page_size;		/* 18 */
1398c2ecf20Sopenharmony_ci	u32 reserved1;			/* 19 */
1408c2ecf20Sopenharmony_ci	u64 max_mr_size;		/* 20 */
1418c2ecf20Sopenharmony_ci	u64 reserved2;			/* 22 */
1428c2ecf20Sopenharmony_ci	u32 num_ports;			/* 24 */
1438c2ecf20Sopenharmony_ci	u32 reserved3;			/* 25 */
1448c2ecf20Sopenharmony_ci	u32 reserved4;			/* 26 */
1458c2ecf20Sopenharmony_ci	u32 reserved5;			/* 27 */
1468c2ecf20Sopenharmony_ci	u64 max_mc_mac;			/* 28 */
1478c2ecf20Sopenharmony_ci	u64 ehea_cap;			/* 30 */
1488c2ecf20Sopenharmony_ci	u32 max_isn_per_eq;		/* 32 */
1498c2ecf20Sopenharmony_ci	u32 max_num_neq;		/* 33 */
1508c2ecf20Sopenharmony_ci	u64 max_num_vlan_ids;		/* 34 */
1518c2ecf20Sopenharmony_ci	u32 max_num_port_group;		/* 36 */
1528c2ecf20Sopenharmony_ci	u32 max_num_phys_port;		/* 37 */
1538c2ecf20Sopenharmony_ci
1548c2ecf20Sopenharmony_ci};
1558c2ecf20Sopenharmony_ci
1568c2ecf20Sopenharmony_ci/* Hcall Query/Modify Port Control Block defines */
1578c2ecf20Sopenharmony_ci#define H_PORT_CB0	 0
1588c2ecf20Sopenharmony_ci#define H_PORT_CB1	 1
1598c2ecf20Sopenharmony_ci#define H_PORT_CB2	 2
1608c2ecf20Sopenharmony_ci#define H_PORT_CB3	 3
1618c2ecf20Sopenharmony_ci#define H_PORT_CB4	 4
1628c2ecf20Sopenharmony_ci#define H_PORT_CB5	 5
1638c2ecf20Sopenharmony_ci#define H_PORT_CB6	 6
1648c2ecf20Sopenharmony_ci#define H_PORT_CB7	 7
1658c2ecf20Sopenharmony_ci
1668c2ecf20Sopenharmony_cistruct hcp_ehea_port_cb0 {
1678c2ecf20Sopenharmony_ci	u64 port_mac_addr;
1688c2ecf20Sopenharmony_ci	u64 port_rc;
1698c2ecf20Sopenharmony_ci	u64 reserved0;
1708c2ecf20Sopenharmony_ci	u32 port_op_state;
1718c2ecf20Sopenharmony_ci	u32 port_speed;
1728c2ecf20Sopenharmony_ci	u32 ext_swport_op_state;
1738c2ecf20Sopenharmony_ci	u32 neg_tpf_prpf;
1748c2ecf20Sopenharmony_ci	u32 num_default_qps;
1758c2ecf20Sopenharmony_ci	u32 reserved1;
1768c2ecf20Sopenharmony_ci	u64 default_qpn_arr[16];
1778c2ecf20Sopenharmony_ci};
1788c2ecf20Sopenharmony_ci
1798c2ecf20Sopenharmony_ci/* Hcall Query/Modify Port Control Block 0 Selection Mask Bits */
1808c2ecf20Sopenharmony_ci#define H_PORT_CB0_ALL		EHEA_BMASK_IBM(0, 7)    /* Set all bits */
1818c2ecf20Sopenharmony_ci#define H_PORT_CB0_MAC		EHEA_BMASK_IBM(0, 0)    /* MAC address */
1828c2ecf20Sopenharmony_ci#define H_PORT_CB0_PRC		EHEA_BMASK_IBM(1, 1)    /* Port Recv Control */
1838c2ecf20Sopenharmony_ci#define H_PORT_CB0_DEFQPNARRAY	EHEA_BMASK_IBM(7, 7)    /* Default QPN Array */
1848c2ecf20Sopenharmony_ci
1858c2ecf20Sopenharmony_ci/*  Hcall Query Port: Returned port speed values */
1868c2ecf20Sopenharmony_ci#define H_SPEED_10M_H	1	/*  10 Mbps, Half Duplex */
1878c2ecf20Sopenharmony_ci#define H_SPEED_10M_F	2	/*  10 Mbps, Full Duplex */
1888c2ecf20Sopenharmony_ci#define H_SPEED_100M_H	3	/* 100 Mbps, Half Duplex */
1898c2ecf20Sopenharmony_ci#define H_SPEED_100M_F	4	/* 100 Mbps, Full Duplex */
1908c2ecf20Sopenharmony_ci#define H_SPEED_1G_F	6	/*   1 Gbps, Full Duplex */
1918c2ecf20Sopenharmony_ci#define H_SPEED_10G_F	8	/*  10 Gbps, Full Duplex */
1928c2ecf20Sopenharmony_ci
1938c2ecf20Sopenharmony_ci/* Port Receive Control Status Bits */
1948c2ecf20Sopenharmony_ci#define PXLY_RC_VALID           EHEA_BMASK_IBM(49, 49)
1958c2ecf20Sopenharmony_ci#define PXLY_RC_VLAN_XTRACT     EHEA_BMASK_IBM(50, 50)
1968c2ecf20Sopenharmony_ci#define PXLY_RC_TCP_6_TUPLE     EHEA_BMASK_IBM(51, 51)
1978c2ecf20Sopenharmony_ci#define PXLY_RC_UDP_6_TUPLE     EHEA_BMASK_IBM(52, 52)
1988c2ecf20Sopenharmony_ci#define PXLY_RC_TCP_3_TUPLE     EHEA_BMASK_IBM(53, 53)
1998c2ecf20Sopenharmony_ci#define PXLY_RC_TCP_2_TUPLE     EHEA_BMASK_IBM(54, 54)
2008c2ecf20Sopenharmony_ci#define PXLY_RC_LLC_SNAP        EHEA_BMASK_IBM(55, 55)
2018c2ecf20Sopenharmony_ci#define PXLY_RC_JUMBO_FRAME     EHEA_BMASK_IBM(56, 56)
2028c2ecf20Sopenharmony_ci#define PXLY_RC_FRAG_IP_PKT     EHEA_BMASK_IBM(57, 57)
2038c2ecf20Sopenharmony_ci#define PXLY_RC_TCP_UDP_CHKSUM  EHEA_BMASK_IBM(58, 58)
2048c2ecf20Sopenharmony_ci#define PXLY_RC_IP_CHKSUM       EHEA_BMASK_IBM(59, 59)
2058c2ecf20Sopenharmony_ci#define PXLY_RC_MAC_FILTER      EHEA_BMASK_IBM(60, 60)
2068c2ecf20Sopenharmony_ci#define PXLY_RC_UNTAG_FILTER    EHEA_BMASK_IBM(61, 61)
2078c2ecf20Sopenharmony_ci#define PXLY_RC_VLAN_TAG_FILTER EHEA_BMASK_IBM(62, 63)
2088c2ecf20Sopenharmony_ci
2098c2ecf20Sopenharmony_ci#define PXLY_RC_VLAN_FILTER     2
2108c2ecf20Sopenharmony_ci#define PXLY_RC_VLAN_PERM       0
2118c2ecf20Sopenharmony_ci
2128c2ecf20Sopenharmony_ci
2138c2ecf20Sopenharmony_ci#define H_PORT_CB1_ALL          0x8000000000000000ULL
2148c2ecf20Sopenharmony_ci
2158c2ecf20Sopenharmony_cistruct hcp_ehea_port_cb1 {
2168c2ecf20Sopenharmony_ci	u64 vlan_filter[64];
2178c2ecf20Sopenharmony_ci};
2188c2ecf20Sopenharmony_ci
2198c2ecf20Sopenharmony_ci#define H_PORT_CB2_ALL          0xFFE0000000000000ULL
2208c2ecf20Sopenharmony_ci
2218c2ecf20Sopenharmony_cistruct hcp_ehea_port_cb2 {
2228c2ecf20Sopenharmony_ci	u64 rxo;
2238c2ecf20Sopenharmony_ci	u64 rxucp;
2248c2ecf20Sopenharmony_ci	u64 rxufd;
2258c2ecf20Sopenharmony_ci	u64 rxuerr;
2268c2ecf20Sopenharmony_ci	u64 rxftl;
2278c2ecf20Sopenharmony_ci	u64 rxmcp;
2288c2ecf20Sopenharmony_ci	u64 rxbcp;
2298c2ecf20Sopenharmony_ci	u64 txo;
2308c2ecf20Sopenharmony_ci	u64 txucp;
2318c2ecf20Sopenharmony_ci	u64 txmcp;
2328c2ecf20Sopenharmony_ci	u64 txbcp;
2338c2ecf20Sopenharmony_ci};
2348c2ecf20Sopenharmony_ci
2358c2ecf20Sopenharmony_cistruct hcp_ehea_port_cb3 {
2368c2ecf20Sopenharmony_ci	u64 vlan_bc_filter[64];
2378c2ecf20Sopenharmony_ci	u64 vlan_mc_filter[64];
2388c2ecf20Sopenharmony_ci	u64 vlan_un_filter[64];
2398c2ecf20Sopenharmony_ci	u64 port_mac_hash_array[64];
2408c2ecf20Sopenharmony_ci};
2418c2ecf20Sopenharmony_ci
2428c2ecf20Sopenharmony_ci#define H_PORT_CB4_ALL          0xF000000000000000ULL
2438c2ecf20Sopenharmony_ci#define H_PORT_CB4_JUMBO        0x1000000000000000ULL
2448c2ecf20Sopenharmony_ci#define H_PORT_CB4_SPEED        0x8000000000000000ULL
2458c2ecf20Sopenharmony_ci
2468c2ecf20Sopenharmony_cistruct hcp_ehea_port_cb4 {
2478c2ecf20Sopenharmony_ci	u32 port_speed;
2488c2ecf20Sopenharmony_ci	u32 pause_frame;
2498c2ecf20Sopenharmony_ci	u32 ens_port_op_state;
2508c2ecf20Sopenharmony_ci	u32 jumbo_frame;
2518c2ecf20Sopenharmony_ci	u32 ens_port_wrap;
2528c2ecf20Sopenharmony_ci};
2538c2ecf20Sopenharmony_ci
2548c2ecf20Sopenharmony_ci/* Hcall Query/Modify Port Control Block 5 Selection Mask Bits */
2558c2ecf20Sopenharmony_ci#define H_PORT_CB5_RCU		0x0001000000000000ULL
2568c2ecf20Sopenharmony_ci#define PXS_RCU			EHEA_BMASK_IBM(61, 63)
2578c2ecf20Sopenharmony_ci
2588c2ecf20Sopenharmony_cistruct hcp_ehea_port_cb5 {
2598c2ecf20Sopenharmony_ci	u64 prc;	        /* 00 */
2608c2ecf20Sopenharmony_ci	u64 uaa;		/* 01 */
2618c2ecf20Sopenharmony_ci	u64 macvc;		/* 02 */
2628c2ecf20Sopenharmony_ci	u64 xpcsc;		/* 03 */
2638c2ecf20Sopenharmony_ci	u64 xpcsp;		/* 04 */
2648c2ecf20Sopenharmony_ci	u64 pcsid;		/* 05 */
2658c2ecf20Sopenharmony_ci	u64 xpcsst;		/* 06 */
2668c2ecf20Sopenharmony_ci	u64 pthlb;		/* 07 */
2678c2ecf20Sopenharmony_ci	u64 pthrb;		/* 08 */
2688c2ecf20Sopenharmony_ci	u64 pqu;		/* 09 */
2698c2ecf20Sopenharmony_ci	u64 pqd;		/* 10 */
2708c2ecf20Sopenharmony_ci	u64 prt;		/* 11 */
2718c2ecf20Sopenharmony_ci	u64 wsth;		/* 12 */
2728c2ecf20Sopenharmony_ci	u64 rcb;		/* 13 */
2738c2ecf20Sopenharmony_ci	u64 rcm;		/* 14 */
2748c2ecf20Sopenharmony_ci	u64 rcu;		/* 15 */
2758c2ecf20Sopenharmony_ci	u64 macc;		/* 16 */
2768c2ecf20Sopenharmony_ci	u64 pc;			/* 17 */
2778c2ecf20Sopenharmony_ci	u64 pst;		/* 18 */
2788c2ecf20Sopenharmony_ci	u64 ducqpn;		/* 19 */
2798c2ecf20Sopenharmony_ci	u64 mcqpn;		/* 20 */
2808c2ecf20Sopenharmony_ci	u64 mma;		/* 21 */
2818c2ecf20Sopenharmony_ci	u64 pmc0h;		/* 22 */
2828c2ecf20Sopenharmony_ci	u64 pmc0l;		/* 23 */
2838c2ecf20Sopenharmony_ci	u64 lbc;		/* 24 */
2848c2ecf20Sopenharmony_ci};
2858c2ecf20Sopenharmony_ci
2868c2ecf20Sopenharmony_ci#define H_PORT_CB6_ALL  0xFFFFFE7FFFFF8000ULL
2878c2ecf20Sopenharmony_ci
2888c2ecf20Sopenharmony_cistruct hcp_ehea_port_cb6 {
2898c2ecf20Sopenharmony_ci	u64 rxo;		/* 00 */
2908c2ecf20Sopenharmony_ci	u64 rx64;		/* 01 */
2918c2ecf20Sopenharmony_ci	u64 rx65;		/* 02 */
2928c2ecf20Sopenharmony_ci	u64 rx128;		/* 03 */
2938c2ecf20Sopenharmony_ci	u64 rx256;		/* 04 */
2948c2ecf20Sopenharmony_ci	u64 rx512;		/* 05 */
2958c2ecf20Sopenharmony_ci	u64 rx1024;		/* 06 */
2968c2ecf20Sopenharmony_ci	u64 rxbfcs;		/* 07 */
2978c2ecf20Sopenharmony_ci	u64 rxime;		/* 08 */
2988c2ecf20Sopenharmony_ci	u64 rxrle;		/* 09 */
2998c2ecf20Sopenharmony_ci	u64 rxorle;		/* 10 */
3008c2ecf20Sopenharmony_ci	u64 rxftl;		/* 11 */
3018c2ecf20Sopenharmony_ci	u64 rxjab;		/* 12 */
3028c2ecf20Sopenharmony_ci	u64 rxse;		/* 13 */
3038c2ecf20Sopenharmony_ci	u64 rxce;		/* 14 */
3048c2ecf20Sopenharmony_ci	u64 rxrf;		/* 15 */
3058c2ecf20Sopenharmony_ci	u64 rxfrag;		/* 16 */
3068c2ecf20Sopenharmony_ci	u64 rxuoc;		/* 17 */
3078c2ecf20Sopenharmony_ci	u64 rxcpf;		/* 18 */
3088c2ecf20Sopenharmony_ci	u64 rxsb;		/* 19 */
3098c2ecf20Sopenharmony_ci	u64 rxfd;		/* 20 */
3108c2ecf20Sopenharmony_ci	u64 rxoerr;		/* 21 */
3118c2ecf20Sopenharmony_ci	u64 rxaln;		/* 22 */
3128c2ecf20Sopenharmony_ci	u64 ducqpn;		/* 23 */
3138c2ecf20Sopenharmony_ci	u64 reserved0;		/* 24 */
3148c2ecf20Sopenharmony_ci	u64 rxmcp;		/* 25 */
3158c2ecf20Sopenharmony_ci	u64 rxbcp;		/* 26 */
3168c2ecf20Sopenharmony_ci	u64 txmcp;		/* 27 */
3178c2ecf20Sopenharmony_ci	u64 txbcp;		/* 28 */
3188c2ecf20Sopenharmony_ci	u64 txo;		/* 29 */
3198c2ecf20Sopenharmony_ci	u64 tx64;		/* 30 */
3208c2ecf20Sopenharmony_ci	u64 tx65;		/* 31 */
3218c2ecf20Sopenharmony_ci	u64 tx128;		/* 32 */
3228c2ecf20Sopenharmony_ci	u64 tx256;		/* 33 */
3238c2ecf20Sopenharmony_ci	u64 tx512;		/* 34 */
3248c2ecf20Sopenharmony_ci	u64 tx1024;		/* 35 */
3258c2ecf20Sopenharmony_ci	u64 txbfcs;		/* 36 */
3268c2ecf20Sopenharmony_ci	u64 txcpf;		/* 37 */
3278c2ecf20Sopenharmony_ci	u64 txlf;		/* 38 */
3288c2ecf20Sopenharmony_ci	u64 txrf;		/* 39 */
3298c2ecf20Sopenharmony_ci	u64 txime;		/* 40 */
3308c2ecf20Sopenharmony_ci	u64 txsc;		/* 41 */
3318c2ecf20Sopenharmony_ci	u64 txmc;		/* 42 */
3328c2ecf20Sopenharmony_ci	u64 txsqe;		/* 43 */
3338c2ecf20Sopenharmony_ci	u64 txdef;		/* 44 */
3348c2ecf20Sopenharmony_ci	u64 txlcol;		/* 45 */
3358c2ecf20Sopenharmony_ci	u64 txexcol;		/* 46 */
3368c2ecf20Sopenharmony_ci	u64 txcse;		/* 47 */
3378c2ecf20Sopenharmony_ci	u64 txbor;		/* 48 */
3388c2ecf20Sopenharmony_ci};
3398c2ecf20Sopenharmony_ci
3408c2ecf20Sopenharmony_ci#define H_PORT_CB7_DUCQPN 0x8000000000000000ULL
3418c2ecf20Sopenharmony_ci
3428c2ecf20Sopenharmony_cistruct hcp_ehea_port_cb7 {
3438c2ecf20Sopenharmony_ci	u64 def_uc_qpn;
3448c2ecf20Sopenharmony_ci};
3458c2ecf20Sopenharmony_ci
3468c2ecf20Sopenharmony_ciu64 ehea_h_query_ehea_qp(const u64 adapter_handle,
3478c2ecf20Sopenharmony_ci			 const u8 qp_category,
3488c2ecf20Sopenharmony_ci			 const u64 qp_handle, const u64 sel_mask,
3498c2ecf20Sopenharmony_ci			 void *cb_addr);
3508c2ecf20Sopenharmony_ci
3518c2ecf20Sopenharmony_ciu64 ehea_h_modify_ehea_qp(const u64 adapter_handle,
3528c2ecf20Sopenharmony_ci			  const u8 cat,
3538c2ecf20Sopenharmony_ci			  const u64 qp_handle,
3548c2ecf20Sopenharmony_ci			  const u64 sel_mask,
3558c2ecf20Sopenharmony_ci			  void *cb_addr,
3568c2ecf20Sopenharmony_ci			  u64 *inv_attr_id,
3578c2ecf20Sopenharmony_ci			  u64 *proc_mask, u16 *out_swr, u16 *out_rwr);
3588c2ecf20Sopenharmony_ci
3598c2ecf20Sopenharmony_ciu64 ehea_h_alloc_resource_eq(const u64 adapter_handle,
3608c2ecf20Sopenharmony_ci			     struct ehea_eq_attr *eq_attr, u64 *eq_handle);
3618c2ecf20Sopenharmony_ci
3628c2ecf20Sopenharmony_ciu64 ehea_h_alloc_resource_cq(const u64 adapter_handle,
3638c2ecf20Sopenharmony_ci			     struct ehea_cq_attr *cq_attr,
3648c2ecf20Sopenharmony_ci			     u64 *cq_handle, struct h_epas *epas);
3658c2ecf20Sopenharmony_ci
3668c2ecf20Sopenharmony_ciu64 ehea_h_alloc_resource_qp(const u64 adapter_handle,
3678c2ecf20Sopenharmony_ci			     struct ehea_qp_init_attr *init_attr,
3688c2ecf20Sopenharmony_ci			     const u32 pd,
3698c2ecf20Sopenharmony_ci			     u64 *qp_handle, struct h_epas *h_epas);
3708c2ecf20Sopenharmony_ci
3718c2ecf20Sopenharmony_ci#define H_REG_RPAGE_PAGE_SIZE          EHEA_BMASK_IBM(48, 55)
3728c2ecf20Sopenharmony_ci#define H_REG_RPAGE_QT                 EHEA_BMASK_IBM(62, 63)
3738c2ecf20Sopenharmony_ci
3748c2ecf20Sopenharmony_ciu64 ehea_h_register_rpage(const u64 adapter_handle,
3758c2ecf20Sopenharmony_ci			  const u8 pagesize,
3768c2ecf20Sopenharmony_ci			  const u8 queue_type,
3778c2ecf20Sopenharmony_ci			  const u64 resource_handle,
3788c2ecf20Sopenharmony_ci			  const u64 log_pageaddr, u64 count);
3798c2ecf20Sopenharmony_ci
3808c2ecf20Sopenharmony_ci#define H_DISABLE_GET_EHEA_WQE_P  1
3818c2ecf20Sopenharmony_ci#define H_DISABLE_GET_SQ_WQE_P    2
3828c2ecf20Sopenharmony_ci#define H_DISABLE_GET_RQC         3
3838c2ecf20Sopenharmony_ci
3848c2ecf20Sopenharmony_ciu64 ehea_h_disable_and_get_hea(const u64 adapter_handle, const u64 qp_handle);
3858c2ecf20Sopenharmony_ci
3868c2ecf20Sopenharmony_ci#define FORCE_FREE 1
3878c2ecf20Sopenharmony_ci#define NORMAL_FREE 0
3888c2ecf20Sopenharmony_ci
3898c2ecf20Sopenharmony_ciu64 ehea_h_free_resource(const u64 adapter_handle, const u64 res_handle,
3908c2ecf20Sopenharmony_ci			 u64 force_bit);
3918c2ecf20Sopenharmony_ci
3928c2ecf20Sopenharmony_ciu64 ehea_h_alloc_resource_mr(const u64 adapter_handle, const u64 vaddr,
3938c2ecf20Sopenharmony_ci			     const u64 length, const u32 access_ctrl,
3948c2ecf20Sopenharmony_ci			     const u32 pd, u64 *mr_handle, u32 *lkey);
3958c2ecf20Sopenharmony_ci
3968c2ecf20Sopenharmony_ciu64 ehea_h_register_rpage_mr(const u64 adapter_handle, const u64 mr_handle,
3978c2ecf20Sopenharmony_ci			     const u8 pagesize, const u8 queue_type,
3988c2ecf20Sopenharmony_ci			     const u64 log_pageaddr, const u64 count);
3998c2ecf20Sopenharmony_ci
4008c2ecf20Sopenharmony_ciu64 ehea_h_register_smr(const u64 adapter_handle, const u64 orig_mr_handle,
4018c2ecf20Sopenharmony_ci			const u64 vaddr_in, const u32 access_ctrl, const u32 pd,
4028c2ecf20Sopenharmony_ci			struct ehea_mr *mr);
4038c2ecf20Sopenharmony_ci
4048c2ecf20Sopenharmony_ciu64 ehea_h_query_ehea(const u64 adapter_handle, void *cb_addr);
4058c2ecf20Sopenharmony_ci
4068c2ecf20Sopenharmony_ci/* output param R5 */
4078c2ecf20Sopenharmony_ci#define H_MEHEAPORT_CAT		EHEA_BMASK_IBM(40, 47)
4088c2ecf20Sopenharmony_ci#define H_MEHEAPORT_PN		EHEA_BMASK_IBM(48, 63)
4098c2ecf20Sopenharmony_ci
4108c2ecf20Sopenharmony_ciu64 ehea_h_query_ehea_port(const u64 adapter_handle, const u16 port_num,
4118c2ecf20Sopenharmony_ci			   const u8 cb_cat, const u64 select_mask,
4128c2ecf20Sopenharmony_ci			   void *cb_addr);
4138c2ecf20Sopenharmony_ci
4148c2ecf20Sopenharmony_ciu64 ehea_h_modify_ehea_port(const u64 adapter_handle, const u16 port_num,
4158c2ecf20Sopenharmony_ci			    const u8 cb_cat, const u64 select_mask,
4168c2ecf20Sopenharmony_ci			    void *cb_addr);
4178c2ecf20Sopenharmony_ci
4188c2ecf20Sopenharmony_ci#define H_REGBCMC_PN            EHEA_BMASK_IBM(48, 63)
4198c2ecf20Sopenharmony_ci#define H_REGBCMC_REGTYPE       EHEA_BMASK_IBM(60, 63)
4208c2ecf20Sopenharmony_ci#define H_REGBCMC_MACADDR       EHEA_BMASK_IBM(16, 63)
4218c2ecf20Sopenharmony_ci#define H_REGBCMC_VLANID        EHEA_BMASK_IBM(52, 63)
4228c2ecf20Sopenharmony_ci
4238c2ecf20Sopenharmony_ciu64 ehea_h_reg_dereg_bcmc(const u64 adapter_handle, const u16 port_num,
4248c2ecf20Sopenharmony_ci			  const u8 reg_type, const u64 mc_mac_addr,
4258c2ecf20Sopenharmony_ci			  const u16 vlan_id, const u32 hcall_id);
4268c2ecf20Sopenharmony_ci
4278c2ecf20Sopenharmony_ciu64 ehea_h_reset_events(const u64 adapter_handle, const u64 neq_handle,
4288c2ecf20Sopenharmony_ci			const u64 event_mask);
4298c2ecf20Sopenharmony_ci
4308c2ecf20Sopenharmony_ciu64 ehea_h_error_data(const u64 adapter_handle, const u64 ressource_handle,
4318c2ecf20Sopenharmony_ci		      void *rblock);
4328c2ecf20Sopenharmony_ci
4338c2ecf20Sopenharmony_ci#endif	/* __EHEA_PHYP_H__ */
434