linux/include/linux/rio_regs.h

/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
 * RapidIO register definitions
 *
 * Copyright 2005 MontaVista Software, Inc.
 * Matt Porter <[email protected]>
 */

#ifndef LINUX_RIO_REGS_H
#define LINUX_RIO_REGS_H

/*
 * In RapidIO, each device has a 16MB configuration space that is
 * accessed via maintenance transactions.  Portions of configuration
 * space are standardized and/or reserved.
 */
#define RIO_MAINT_SPACE_SZ

#define RIO_DEV_ID_CAR
#define RIO_DEV_INFO_CAR
#define RIO_ASM_ID_CAR
#define RIO_ASM_ID_MASK
#define RIO_ASM_VEN_ID_MASK

#define RIO_ASM_INFO_CAR
#define RIO_ASM_REV_MASK
#define RIO_EXT_FTR_PTR_MASK

#define RIO_PEF_CAR
#define RIO_PEF_BRIDGE
#define RIO_PEF_MEMORY
#define RIO_PEF_PROCESSOR
#define RIO_PEF_SWITCH
#define RIO_PEF_MULTIPORT
#define RIO_PEF_INB_MBOX
#define RIO_PEF_INB_MBOX0
#define RIO_PEF_INB_MBOX1
#define RIO_PEF_INB_MBOX2
#define RIO_PEF_INB_MBOX3
#define RIO_PEF_INB_DOORBELL
#define RIO_PEF_DEV32
#define RIO_PEF_EXT_RT
#define RIO_PEF_STD_RT
#define RIO_PEF_CTLS
#define RIO_PEF_DEV16
#define RIO_PEF_EXT_FEATURES
#define RIO_PEF_ADDR_66
#define RIO_PEF_ADDR_50
#define RIO_PEF_ADDR_34

#define RIO_SWP_INFO_CAR
#define RIO_SWP_INFO_PORT_TOTAL_MASK
#define RIO_SWP_INFO_PORT_NUM_MASK
#define RIO_GET_TOTAL_PORTS(x)
#define RIO_GET_PORT_NUM(x)

#define RIO_SRC_OPS_CAR
#define RIO_SRC_OPS_READ
#define RIO_SRC_OPS_WRITE
#define RIO_SRC_OPS_STREAM_WRITE
#define RIO_SRC_OPS_WRITE_RESPONSE
#define RIO_SRC_OPS_DATA_MSG
#define RIO_SRC_OPS_DOORBELL
#define RIO_SRC_OPS_ATOMIC_TST_SWP
#define RIO_SRC_OPS_ATOMIC_INC
#define RIO_SRC_OPS_ATOMIC_DEC
#define RIO_SRC_OPS_ATOMIC_SET
#define RIO_SRC_OPS_ATOMIC_CLR
#define RIO_SRC_OPS_PORT_WRITE

#define RIO_DST_OPS_CAR
#define RIO_DST_OPS_READ
#define RIO_DST_OPS_WRITE
#define RIO_DST_OPS_STREAM_WRITE
#define RIO_DST_OPS_WRITE_RESPONSE
#define RIO_DST_OPS_DATA_MSG
#define RIO_DST_OPS_DOORBELL
#define RIO_DST_OPS_ATOMIC_TST_SWP
#define RIO_DST_OPS_ATOMIC_INC
#define RIO_DST_OPS_ATOMIC_DEC
#define RIO_DST_OPS_ATOMIC_SET
#define RIO_DST_OPS_ATOMIC_CLR
#define RIO_DST_OPS_PORT_WRITE

#define RIO_OPS_READ
#define RIO_OPS_WRITE
#define RIO_OPS_STREAM_WRITE
#define RIO_OPS_WRITE_RESPONSE
#define RIO_OPS_DATA_MSG
#define RIO_OPS_DOORBELL
#define RIO_OPS_ATOMIC_TST_SWP
#define RIO_OPS_ATOMIC_INC
#define RIO_OPS_ATOMIC_DEC
#define RIO_OPS_ATOMIC_SET
#define RIO_OPS_ATOMIC_CLR
#define RIO_OPS_PORT_WRITE

					/* 0x20-0x30 *//* Reserved */

#define RIO_SWITCH_RT_LIMIT
#define RIO_RT_MAX_DESTID

#define RIO_MBOX_CSR
#define RIO_MBOX0_AVAIL
#define RIO_MBOX0_FULL
#define RIO_MBOX0_EMPTY
#define RIO_MBOX0_BUSY
#define RIO_MBOX0_FAIL
#define RIO_MBOX0_ERROR
#define RIO_MBOX1_AVAIL
#define RIO_MBOX1_FULL
#define RIO_MBOX1_EMPTY
#define RIO_MBOX1_BUSY
#define RIO_MBOX1_FAIL
#define RIO_MBOX1_ERROR
#define RIO_MBOX2_AVAIL
#define RIO_MBOX2_FULL
#define RIO_MBOX2_EMPTY
#define RIO_MBOX2_BUSY
#define RIO_MBOX2_FAIL
#define RIO_MBOX2_ERROR
#define RIO_MBOX3_AVAIL
#define RIO_MBOX3_FULL
#define RIO_MBOX3_EMPTY
#define RIO_MBOX3_BUSY
#define RIO_MBOX3_FAIL
#define RIO_MBOX3_ERROR

#define RIO_WRITE_PORT_CSR
#define RIO_DOORBELL_CSR
#define RIO_DOORBELL_AVAIL
#define RIO_DOORBELL_FULL
#define RIO_DOORBELL_EMPTY
#define RIO_DOORBELL_BUSY
#define RIO_DOORBELL_FAILED
#define RIO_DOORBELL_ERROR
#define RIO_WRITE_PORT_AVAILABLE
#define RIO_WRITE_PORT_FULL
#define RIO_WRITE_PORT_EMPTY
#define RIO_WRITE_PORT_BUSY
#define RIO_WRITE_PORT_FAILED
#define RIO_WRITE_PORT_ERROR

					/* 0x48 *//* Reserved */

#define RIO_PELL_CTRL_CSR
#define RIO_PELL_ADDR_66
#define RIO_PELL_ADDR_50
#define RIO_PELL_ADDR_34

					/* 0x50-0x54 *//* Reserved */

#define RIO_LCSH_BA
#define RIO_LCSL_BA

#define RIO_DID_CSR

					/* 0x64 *//* Reserved */

#define RIO_HOST_DID_LOCK_CSR
#define RIO_COMPONENT_TAG_CSR

#define RIO_STD_RTE_CONF_DESTID_SEL_CSR
#define RIO_STD_RTE_CONF_EXTCFGEN
#define RIO_STD_RTE_CONF_PORT_SEL_CSR
#define RIO_STD_RTE_DEFAULT_PORT

					/* 0x7c-0xf8 *//* Reserved */
					/* 0x100-0xfff8 *//* [I] Extended Features Space */
					/* 0x10000-0xfffff8 *//* [I] Implementation-defined Space */

/*
 * Extended Features Space is a configuration space area where
 * functionality is mapped into extended feature blocks via a
 * singly linked list of extended feature pointers (EFT_PTR).
 *
 * Each extended feature block can be identified/located in
 * Extended Features Space by walking the extended feature
 * list starting with the Extended Feature Pointer located
 * in the Assembly Information CAR.
 *
 * Extended Feature Blocks (EFBs) are identified with an assigned
 * EFB ID. Extended feature block offsets in the definitions are
 * relative to the offset of the EFB within the  Extended Features
 * Space.
 */

/* Helper macros to parse the Extended Feature Block header */
#define RIO_EFB_PTR_MASK
#define RIO_EFB_ID_MASK
#define RIO_GET_BLOCK_PTR(x)
#define RIO_GET_BLOCK_ID(x)

/* Extended Feature Block IDs */
#define RIO_EFB_SER_EP_M1_ID
#define RIO_EFB_SER_EP_SW_M1_ID
#define RIO_EFB_SER_EPF_M1_ID
#define RIO_EFB_SER_EP_ID
#define RIO_EFB_SER_EP_REC_ID
#define RIO_EFB_SER_EP_FREE_ID
#define RIO_EFB_ERR_MGMNT
#define RIO_EFB_SER_EPF_SW_M1_ID
#define RIO_EFB_SW_ROUTING_TBL
#define RIO_EFB_SER_EP_M2_ID
#define RIO_EFB_SER_EP_SW_M2_ID
#define RIO_EFB_SER_EPF_M2_ID
#define RIO_EFB_ERR_MGMNT_HS
#define RIO_EFB_SER_EPF_SW_M2_ID

/*
 * Physical LP-Serial Registers Definitions
 * Parameters in register macros:
 *    n - port number, m - Register Map Type (1 or 2)
 */
#define RIO_PORT_MNT_HEADER
#define RIO_PORT_REQ_CTL_CSR
#define RIO_PORT_RSP_CTL_CSR
#define RIO_PORT_LINKTO_CTL_CSR
#define RIO_PORT_RSPTO_CTL_CSR
#define RIO_PORT_GEN_CTL_CSR
#define RIO_PORT_GEN_HOST
#define RIO_PORT_GEN_MASTER
#define RIO_PORT_GEN_DISCOVERED
#define RIO_PORT_N_MNT_REQ_CSR(n, m)
#define RIO_MNT_REQ_CMD_RD
#define RIO_MNT_REQ_CMD_IS
#define RIO_PORT_N_MNT_RSP_CSR(n, m)
#define RIO_PORT_N_MNT_RSP_RVAL
#define RIO_PORT_N_MNT_RSP_ASTAT
#define RIO_PORT_N_MNT_RSP_LSTAT
#define RIO_PORT_N_ACK_STS_CSR(n)
#define RIO_PORT_N_ACK_CLEAR
#define RIO_PORT_N_ACK_INBOUND
#define RIO_PORT_N_ACK_OUTSTAND
#define RIO_PORT_N_ACK_OUTBOUND
#define RIO_PORT_N_CTL2_CSR(n, m)
#define RIO_PORT_N_CTL2_SEL_BAUD
#define RIO_PORT_N_ERR_STS_CSR(n, m)
#define RIO_PORT_N_ERR_STS_OUT_ES
#define RIO_PORT_N_ERR_STS_INP_ES
#define RIO_PORT_N_ERR_STS_PW_PEND
#define RIO_PORT_N_ERR_STS_PORT_UA
#define RIO_PORT_N_ERR_STS_PORT_ERR
#define RIO_PORT_N_ERR_STS_PORT_OK
#define RIO_PORT_N_ERR_STS_PORT_UNINIT
#define RIO_PORT_N_CTL_CSR(n, m)
#define RIO_PORT_N_CTL_PWIDTH
#define RIO_PORT_N_CTL_PWIDTH_1
#define RIO_PORT_N_CTL_PWIDTH_4
#define RIO_PORT_N_CTL_IPW
#define RIO_PORT_N_CTL_P_TYP_SER
#define RIO_PORT_N_CTL_LOCKOUT
#define RIO_PORT_N_CTL_EN_RX
#define RIO_PORT_N_CTL_EN_TX
#define RIO_PORT_N_OB_ACK_CSR(n)
#define RIO_PORT_N_OB_ACK_CLEAR
#define RIO_PORT_N_OB_ACK_OUTSTD
#define RIO_PORT_N_OB_ACK_OUTBND
#define RIO_PORT_N_IB_ACK_CSR(n)
#define RIO_PORT_N_IB_ACK_INBND

/*
 * Device-based helper macros for serial port register access.
 *   d - pointer to rapidio device object, n - port number
 */

#define RIO_DEV_PORT_N_MNT_REQ_CSR(d, n)

#define RIO_DEV_PORT_N_MNT_RSP_CSR(d, n)

#define RIO_DEV_PORT_N_ACK_STS_CSR(d, n)

#define RIO_DEV_PORT_N_CTL2_CSR(d, n)

#define RIO_DEV_PORT_N_ERR_STS_CSR(d, n)

#define RIO_DEV_PORT_N_CTL_CSR(d, n)

#define RIO_DEV_PORT_N_OB_ACK_CSR(d, n)

#define RIO_DEV_PORT_N_IB_ACK_CSR(d, n)

/*
 * Error Management Extensions (RapidIO 1.3+, Part 8)
 *
 * Extended Features Block ID=0x0007
 */

/* General EM Registers (Common for all Ports) */

#define RIO_EM_EFB_HEADER
#define RIO_EM_EMHS_CAR
#define RIO_EM_LTL_ERR_DETECT
#define RIO_EM_LTL_ERR_EN
#define REM_LTL_ERR_ILLTRAN
#define REM_LTL_ERR_UNSOLR
#define REM_LTL_ERR_UNSUPTR
#define REM_LTL_ERR_IMPSPEC
#define RIO_EM_LTL_HIADDR_CAP
#define RIO_EM_LTL_ADDR_CAP
#define RIO_EM_LTL_DEVID_CAP
#define RIO_EM_LTL_CTRL_CAP
#define RIO_EM_LTL_DID32_CAP
#define RIO_EM_LTL_SID32_CAP
#define RIO_EM_PW_TGT_DEVID
#define RIO_EM_PW_TGT_DEVID_D16M
#define RIO_EM_PW_TGT_DEVID_D8
#define RIO_EM_PW_TGT_DEVID_DEV16
#define RIO_EM_PW_TGT_DEVID_DEV32
#define RIO_EM_PKT_TTL
#define RIO_EM_PKT_TTL_VAL
#define RIO_EM_PW_TGT32_DEVID
#define RIO_EM_PW_TX_CTRL
#define RIO_EM_PW_TX_CTRL_PW_DIS

/* Per-Port EM Registers */

#define RIO_EM_PN_ERR_DETECT(x)
#define REM_PED_IMPL_SPEC
#define REM_PED_LINK_OK2U
#define REM_PED_LINK_UPDA
#define REM_PED_LINK_U2OK
#define REM_PED_LINK_TO

#define RIO_EM_PN_ERRRATE_EN(x)
#define RIO_EM_PN_ERRRATE_EN_OK2U
#define RIO_EM_PN_ERRRATE_EN_UPDA
#define RIO_EM_PN_ERRRATE_EN_U2OK

#define RIO_EM_PN_ATTRIB_CAP(x)
#define RIO_EM_PN_PKT_CAP_0(x)
#define RIO_EM_PN_PKT_CAP_1(x)
#define RIO_EM_PN_PKT_CAP_2(x)
#define RIO_EM_PN_PKT_CAP_3(x)
#define RIO_EM_PN_ERRRATE(x)
#define RIO_EM_PN_ERRRATE_TR(x)
#define RIO_EM_PN_LINK_UDT(x)
#define RIO_EM_PN_LINK_UDT_TO

/*
 * Switch Routing Table Register Block ID=0x000E (RapidIO 3.0+, part 3)
 * Register offsets are defined from beginning of the block.
 */

/* Broadcast Routing Table Control CSR */
#define RIO_BC_RT_CTL_CSR
#define RIO_RT_CTL_THREE_LVL
#define RIO_RT_CTL_DEV32_RT_CTRL
#define RIO_RT_CTL_MC_MASK_SZ

/* Broadcast Level 0 Info CSR */
#define RIO_BC_RT_LVL0_INFO_CSR
#define RIO_RT_L0I_NUM_GR
#define RIO_RT_L0I_GR_PTR

/* Broadcast Level 1 Info CSR */
#define RIO_BC_RT_LVL1_INFO_CSR
#define RIO_RT_L1I_NUM_GR
#define RIO_RT_L1I_GR_PTR

/* Broadcast Level 2 Info CSR */
#define RIO_BC_RT_LVL2_INFO_CSR
#define RIO_RT_L2I_NUM_GR
#define RIO_RT_L2I_GR_PTR

/* Per-Port Routing Table registers.
 * Register fields defined in the broadcast section above are
 * applicable to the corresponding registers below.
 */
#define RIO_SPx_RT_CTL_CSR(x)
#define RIO_SPx_RT_LVL0_INFO_CSR(x)
#define RIO_SPx_RT_LVL1_INFO_CSR(x)
#define RIO_SPx_RT_LVL2_INFO_CSR(x)

/* Register Formats for Routing Table Group entry.
 * Register offsets are calculated using GR_PTR field in the corresponding
 * table Level_N and group/entry numbers (see RapidIO 3.0+ Part 3).
 */
#define RIO_RT_Ln_ENTRY_IMPL_DEF
#define RIO_RT_Ln_ENTRY_RTE_VAL
#define RIO_RT_ENTRY_DROP_PKT

#endif				/* LINUX_RIO_REGS_H */