#define NFP_CPP_NUM_TARGETS 16 /* Max size of area it should be safe to request */ #define NFP_CPP_SAFE_AREA_SIZE SZ_2M
/* NFP_MUTEX_WAIT_* are timeouts in seconds when waiting for a mutex */ #define NFP_MUTEX_WAIT_FIRST_WARN 15 #define NFP_MUTEX_WAIT_NEXT_WARN 5 #define NFP_MUTEX_WAIT_ERROR 60
/* Wildcard indicating a CPP read or write action * * The action used will be either read or write depending on whether a * read or write instruction/call is performed on the NFP_CPP_ID. It * is recomended that the RW action is used even if all actions to be * performed on a NFP_CPP_ID are known to be only reads or writes. * Doing so will in many cases save NFP CPP internal software * resources.
*/ #define NFP_CPP_ACTION_RW 32
/** * NFP_CPP_ID() - pack target, token, and action into a CPP ID. * @target: NFP CPP target id * @action: NFP CPP action id * @token: NFP CPP token id * * Create a 32-bit CPP identifier representing the access to be made. * These identifiers are used as parameters to other NFP CPP * functions. Some CPP devices may allow wildcard identifiers to be * specified. * * Return: NFP CPP ID
*/ #define NFP_CPP_ID(target, action, token) \
((((target) & 0x7f) << 24) | (((token) & 0xff) << 16) | \
(((action) & 0xff) << 8))
/** * NFP_CPP_ISLAND_ID() - pack target, token, action, and island into a CPP ID. * @target: NFP CPP target id * @action: NFP CPP action id * @token: NFP CPP token id * @island: NFP CPP island id * * Create a 32-bit CPP identifier representing the access to be made. * These identifiers are used as parameters to other NFP CPP * functions. Some CPP devices may allow wildcard identifiers to be * specified. * * Return: NFP CPP ID
*/ #define NFP_CPP_ISLAND_ID(target, action, token, island) \
((((target) & 0x7f) << 24) | (((token) & 0xff) << 16) | \
(((action) & 0xff) << 8) | (((island) & 0xff) << 0))
/** * NFP_CPP_ID_TARGET_of() - Return the NFP CPP target of a NFP CPP ID * @id: NFP CPP ID * * Return: NFP CPP target
*/ staticinline u8 NFP_CPP_ID_TARGET_of(u32 id)
{ return (id >> 24) & NFP_CPP_TARGET_ID_MASK;
}
/** * NFP_CPP_ID_TOKEN_of() - Return the NFP CPP token of a NFP CPP ID * @id: NFP CPP ID * Return: NFP CPP token
*/ staticinline u8 NFP_CPP_ID_TOKEN_of(u32 id)
{ return (id >> 16) & 0xff;
}
/** * NFP_CPP_ID_ACTION_of() - Return the NFP CPP action of a NFP CPP ID * @id: NFP CPP ID * * Return: NFP CPP action
*/ staticinline u8 NFP_CPP_ID_ACTION_of(u32 id)
{ return (id >> 8) & 0xff;
}
/** * NFP_CPP_ID_ISLAND_of() - Return the NFP CPP island of a NFP CPP ID * @id: NFP CPP ID * * Return: NFP CPP island
*/ staticinline u8 NFP_CPP_ID_ISLAND_of(u32 id)
{ return (id >> 0) & 0xff;
}
/* NFP Interface types - logical interface for this CPP connection * 4 bits are reserved for interface type.
*/ #define NFP_CPP_INTERFACE_TYPE_INVALID 0x0 #define NFP_CPP_INTERFACE_TYPE_PCI 0x1 #define NFP_CPP_INTERFACE_TYPE_ARM 0x2 #define NFP_CPP_INTERFACE_TYPE_RPC 0x3 #define NFP_CPP_INTERFACE_TYPE_ILA 0x4
/** * NFP_CPP_INTERFACE() - Construct a 16-bit NFP Interface ID * @type: NFP Interface Type * @unit: Unit identifier for the interface type * @channel: Channel identifier for the interface unit * * Interface IDs consists of 4 bits of interface type, * 4 bits of unit identifier, and 8 bits of channel identifier. * * The NFP Interface ID is used in the implementation of * NFP CPP API mutexes, which use the MU Atomic CompareAndWrite * operation - hence the limit to 16 bits to be able to * use the NFP Interface ID as a lock owner. * * Return: Interface ID
*/ #define NFP_CPP_INTERFACE(type, unit, channel) \
((((type) & 0xf) << 12) | \
(((unit) & 0xf) << 8) | \
(((channel) & 0xff) << 0))
/** * NFP_CPP_INTERFACE_TYPE_of() - Get the interface type * @interface: NFP Interface ID * Return: NFP Interface ID's type
*/ #define NFP_CPP_INTERFACE_TYPE_of(interface) (((interface) >> 12) & 0xf)
/** * NFP_CPP_INTERFACE_UNIT_of() - Get the interface unit * @interface: NFP Interface ID * Return: NFP Interface ID's unit
*/ #define NFP_CPP_INTERFACE_UNIT_of(interface) (((interface) >> 8) & 0xf)
/** * NFP_CPP_INTERFACE_CHANNEL_of() - Get the interface channel * @interface: NFP Interface ID * Return: NFP Interface ID's channel
*/ #define NFP_CPP_INTERFACE_CHANNEL_of(interface) (((interface) >> 0) & 0xff)
int nfp_cpp_mutex_init(struct nfp_cpp *cpp, int target, unsignedlonglong address, u32 key_id); struct nfp_cpp_mutex *nfp_cpp_mutex_alloc(struct nfp_cpp *cpp, int target, unsignedlonglong address,
u32 key_id); void nfp_cpp_mutex_free(struct nfp_cpp_mutex *mutex); int nfp_cpp_mutex_lock(struct nfp_cpp_mutex *mutex); int nfp_cpp_mutex_unlock(struct nfp_cpp_mutex *mutex); int nfp_cpp_mutex_trylock(struct nfp_cpp_mutex *mutex); int nfp_cpp_mutex_reclaim(struct nfp_cpp *cpp, int target, unsignedlonglong address);
/** * nfp_cppcore_pcie_unit() - Get PCI Unit of a CPP handle * @cpp: CPP handle * * Return: PCI unit for the NFP CPP handle
*/ staticinline u8 nfp_cppcore_pcie_unit(struct nfp_cpp *cpp)
{ return NFP_CPP_INTERFACE_UNIT_of(nfp_cpp_interface(cpp));
}
/** * struct nfp_cpp_operations - NFP CPP operations structure * @area_priv_size: Size of the nfp_cpp_area private data * @owner: Owner module * @init: Initialize the NFP CPP bus * @free: Free the bus * @read_serial: Read serial number to memory provided * @get_interface: Return CPP interface * @area_init: Initialize a new NFP CPP area (not serialized) * @area_cleanup: Clean up a NFP CPP area (not serialized) * @area_acquire: Acquire the NFP CPP area (serialized) * @area_release: Release area (serialized) * @area_resource: Get resource range of area (not serialized) * @area_phys: Get physical address of area (not serialized) * @area_iomem: Get iomem of area (not serialized) * @area_read: Perform a read from a NFP CPP area (serialized) * @area_write: Perform a write to a NFP CPP area (serialized) * @explicit_priv_size: Size of an explicit's private area * @explicit_acquire: Acquire an explicit area * @explicit_release: Release an explicit area * @explicit_put: Write data to send * @explicit_get: Read data received * @explicit_do: Perform the transaction
*/ struct nfp_cpp_operations {
size_t area_priv_size; struct module *owner;
int (*init)(struct nfp_cpp *cpp); void (*free)(struct nfp_cpp *cpp);
int (*read_serial)(struct device *dev, u8 *serial); int (*get_interface)(struct device *dev);
int nfp_cpp_area_cache_add(struct nfp_cpp *cpp, size_t size);
/* The following section contains extensions to the * NFP CPP API, to be used in a Linux kernel-space context.
*/
/* Use this channel ID for multiple virtual channel interfaces * (ie ARM and PCIe) when setting up the interface field.
*/ #define NFP_CPP_INTERFACE_CHANNEL_PEROPENER 255 struct device *nfp_cpp_device(struct nfp_cpp *cpp);
/* Return code masks for nfp_cpp_explicit_do()
*/ #define NFP_SIGNAL_MASK_A BIT(0) /* Signal A fired */ #define NFP_SIGNAL_MASK_B BIT(1) /* Signal B fired */
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.