driver/fsl-mc: Add support of MC Flibs
Freescale's Layerscape Management Complex (MC) provide support various objects like DPRC, DPNI, DPBP and DPIO. Where: DPRC: Place holdes for other MC objectes like DPNI, DPBP, DPIO DPBP: Management of buffer pool DPIO: Used for used to QBMan portal DPNI: Represents standard network interface These objects are used for DPAA ethernet drivers. Signed-off-by: J. German Rivera <German.Rivera@freescale.com> Signed-off-by: Lijun Pan <Lijun.Pan@freescale.com> Signed-off-by: Stuart Yoder <stuart.yoder@freescale.com> Signed-off-by: Geoff Thorpe <Geoff.Thorpe@freescale.com> Signed-off-by: Haiying Wang <Haiying.Wang@freescale.com> Signed-off-by: Cristian Sovaiala <cristian.sovaiala@freescale.com> Signed-off-by: pankaj chauhan <pankaj.chauhan@freescale.com> Signed-off-by: Prabhakar Kushwaha <prabhakar@freescale.com> Reviewed-by: York Sun <yorksun@freescale.com>
This commit is contained in:
committed by
York Sun
parent
b7f57ac0d8
commit
a2a55e518f
121
include/fsl-mc/fsl_dpaa_fd.h
Normal file
121
include/fsl-mc/fsl_dpaa_fd.h
Normal file
@@ -0,0 +1,121 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Freescale Semiconductor
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
#ifndef __FSL_DPAA_FD_H
|
||||
#define __FSL_DPAA_FD_H
|
||||
|
||||
/* Place-holder for FDs, we represent it via the simplest form that we need for
|
||||
* now. Different overlays may be needed to support different options, etc. (It
|
||||
* is impractical to define One True Struct, because the resulting encoding
|
||||
* routines (lots of read-modify-writes) would be worst-case performance whether
|
||||
* or not circumstances required them.) */
|
||||
struct dpaa_fd {
|
||||
union {
|
||||
u32 words[8];
|
||||
struct dpaa_fd_simple {
|
||||
u32 addr_lo;
|
||||
u32 addr_hi;
|
||||
u32 len;
|
||||
/* offset in the MS 16 bits, BPID in the LS 16 bits */
|
||||
u32 bpid_offset;
|
||||
u32 frc; /* frame context */
|
||||
/* "err", "va", "cbmt", "asal", [...] */
|
||||
u32 ctrl;
|
||||
/* flow context */
|
||||
u32 flc_lo;
|
||||
u32 flc_hi;
|
||||
} simple;
|
||||
};
|
||||
};
|
||||
|
||||
enum dpaa_fd_format {
|
||||
dpaa_fd_single = 0,
|
||||
dpaa_fd_list,
|
||||
dpaa_fd_sg
|
||||
};
|
||||
|
||||
static inline u64 ldpaa_fd_get_addr(const struct dpaa_fd *fd)
|
||||
{
|
||||
return (u64)((((uint64_t)fd->simple.addr_hi) << 32)
|
||||
+ fd->simple.addr_lo);
|
||||
}
|
||||
|
||||
static inline void ldpaa_fd_set_addr(struct dpaa_fd *fd, u64 addr)
|
||||
{
|
||||
fd->simple.addr_hi = upper_32_bits(addr);
|
||||
fd->simple.addr_lo = lower_32_bits(addr);
|
||||
}
|
||||
|
||||
static inline u32 ldpaa_fd_get_len(const struct dpaa_fd *fd)
|
||||
{
|
||||
return fd->simple.len;
|
||||
}
|
||||
|
||||
static inline void ldpaa_fd_set_len(struct dpaa_fd *fd, u32 len)
|
||||
{
|
||||
fd->simple.len = len;
|
||||
}
|
||||
|
||||
static inline uint16_t ldpaa_fd_get_offset(const struct dpaa_fd *fd)
|
||||
{
|
||||
return (uint16_t)(fd->simple.bpid_offset >> 16) & 0x0FFF;
|
||||
}
|
||||
|
||||
static inline void ldpaa_fd_set_offset(struct dpaa_fd *fd, uint16_t offset)
|
||||
{
|
||||
fd->simple.bpid_offset &= 0xF000FFFF;
|
||||
fd->simple.bpid_offset |= (u32)offset << 16;
|
||||
}
|
||||
|
||||
static inline uint16_t ldpaa_fd_get_bpid(const struct dpaa_fd *fd)
|
||||
{
|
||||
return (uint16_t)(fd->simple.bpid_offset & 0xFFFF);
|
||||
}
|
||||
|
||||
static inline void ldpaa_fd_set_bpid(struct dpaa_fd *fd, uint16_t bpid)
|
||||
{
|
||||
fd->simple.bpid_offset &= 0xFFFF0000;
|
||||
fd->simple.bpid_offset |= (u32)bpid;
|
||||
}
|
||||
|
||||
/* When frames are dequeued, the FDs show up inside "dequeue" result structures
|
||||
* (if at all, not all dequeue results contain valid FDs). This structure type
|
||||
* is intentionally defined without internal detail, and the only reason it
|
||||
* isn't declared opaquely (without size) is to allow the user to provide
|
||||
* suitably-sized (and aligned) memory for these entries. */
|
||||
struct ldpaa_dq {
|
||||
uint32_t dont_manipulate_directly[16];
|
||||
};
|
||||
|
||||
/* Parsing frame dequeue results */
|
||||
#define LDPAA_DQ_STAT_FQEMPTY 0x80
|
||||
#define LDPAA_DQ_STAT_HELDACTIVE 0x40
|
||||
#define LDPAA_DQ_STAT_FORCEELIGIBLE 0x20
|
||||
#define LDPAA_DQ_STAT_VALIDFRAME 0x10
|
||||
#define LDPAA_DQ_STAT_ODPVALID 0x04
|
||||
#define LDPAA_DQ_STAT_VOLATILE 0x02
|
||||
#define LDPAA_DQ_STAT_EXPIRED 0x01
|
||||
uint32_t ldpaa_dq_flags(const struct ldpaa_dq *);
|
||||
static inline int ldpaa_dq_is_pull(const struct ldpaa_dq *dq)
|
||||
{
|
||||
return (int)(ldpaa_dq_flags(dq) & LDPAA_DQ_STAT_VOLATILE);
|
||||
}
|
||||
static inline int ldpaa_dq_is_pull_complete(
|
||||
const struct ldpaa_dq *dq)
|
||||
{
|
||||
return (int)(ldpaa_dq_flags(dq) & LDPAA_DQ_STAT_EXPIRED);
|
||||
}
|
||||
/* seqnum/odpid are valid only if VALIDFRAME and ODPVALID flags are TRUE */
|
||||
uint16_t ldpaa_dq_seqnum(const struct ldpaa_dq *);
|
||||
uint16_t ldpaa_dq_odpid(const struct ldpaa_dq *);
|
||||
uint32_t ldpaa_dq_fqid(const struct ldpaa_dq *);
|
||||
uint32_t ldpaa_dq_byte_count(const struct ldpaa_dq *);
|
||||
uint32_t ldpaa_dq_frame_count(const struct ldpaa_dq *);
|
||||
uint32_t ldpaa_dq_fqd_ctx_hi(const struct ldpaa_dq *);
|
||||
uint32_t ldpaa_dq_fqd_ctx_lo(const struct ldpaa_dq *);
|
||||
/* get the Frame Descriptor */
|
||||
const struct dpaa_fd *ldpaa_dq_fd(const struct ldpaa_dq *);
|
||||
|
||||
#endif /* __FSL_DPAA_FD_H */
|
||||
143
include/fsl-mc/fsl_dpbp.h
Normal file
143
include/fsl-mc/fsl_dpbp.h
Normal file
@@ -0,0 +1,143 @@
|
||||
/*
|
||||
* Freescale Layerscape MC I/O wrapper
|
||||
*
|
||||
* Copyright (C) 2013-2015 Freescale Semiconductor, Inc.
|
||||
* Author: German Rivera <German.Rivera@freescale.com>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
/*!
|
||||
* @file fsl_dpbp.h
|
||||
* @brief Data Path Buffer Pool API
|
||||
*/
|
||||
#ifndef __FSL_DPBP_H
|
||||
#define __FSL_DPBP_H
|
||||
|
||||
/* DPBP Version */
|
||||
#define DPBP_VER_MAJOR 2
|
||||
#define DPBP_VER_MINOR 0
|
||||
|
||||
/* Command IDs */
|
||||
#define DPBP_CMDID_CLOSE 0x800
|
||||
#define DPBP_CMDID_OPEN 0x804
|
||||
|
||||
#define DPBP_CMDID_ENABLE 0x002
|
||||
#define DPBP_CMDID_DISABLE 0x003
|
||||
#define DPBP_CMDID_GET_ATTR 0x004
|
||||
#define DPBP_CMDID_RESET 0x005
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPBP_CMD_OPEN(cmd, dpbp_id) \
|
||||
MC_CMD_OP(cmd, 0, 0, 32, int, dpbp_id)
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPBP_RSP_GET_ATTRIBUTES(cmd, attr) \
|
||||
do { \
|
||||
MC_RSP_OP(cmd, 0, 16, 16, uint16_t, attr->bpid); \
|
||||
MC_RSP_OP(cmd, 0, 32, 32, int, attr->id);\
|
||||
MC_RSP_OP(cmd, 1, 0, 16, uint16_t, attr->version.major);\
|
||||
MC_RSP_OP(cmd, 1, 16, 16, uint16_t, attr->version.minor);\
|
||||
} while (0)
|
||||
|
||||
/* Data Path Buffer Pool API
|
||||
* Contains initialization APIs and runtime control APIs for DPBP
|
||||
*/
|
||||
|
||||
struct fsl_mc_io;
|
||||
|
||||
/**
|
||||
* dpbp_open() - Open a control session for the specified object.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @dpbp_id: DPBP unique ID
|
||||
* @token: Returned token; use in subsequent API calls
|
||||
*
|
||||
* This function can be used to open a control session for an
|
||||
* already created object; an object may have been declared in
|
||||
* the DPL or by calling the dpbp_create function.
|
||||
* This function returns a unique authentication token,
|
||||
* associated with the specific object ID and the specific MC
|
||||
* portal; this token must be used in all subsequent commands for
|
||||
* this specific object
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpbp_open(struct fsl_mc_io *mc_io, int dpbp_id, uint16_t *token);
|
||||
|
||||
/**
|
||||
* dpbp_close() - Close the control session of the object
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @token: Token of DPBP object
|
||||
*
|
||||
* After this function is called, no further operations are
|
||||
* allowed on the object without opening a new control session.
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpbp_close(struct fsl_mc_io *mc_io, uint16_t token);
|
||||
|
||||
/**
|
||||
* dpbp_enable() - Enable the DPBP.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @token: Token of DPBP object
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
|
||||
int dpbp_enable(struct fsl_mc_io *mc_io, uint16_t token);
|
||||
|
||||
/**
|
||||
* dpbp_disable() - Disable the DPBP.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @token: Token of DPBP object
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpbp_disable(struct fsl_mc_io *mc_io, uint16_t token);
|
||||
|
||||
/**
|
||||
* dpbp_reset() - Reset the DPBP, returns the object to initial state.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @token: Token of DPBP object
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpbp_reset(struct fsl_mc_io *mc_io, uint16_t token);
|
||||
|
||||
/**
|
||||
* struct dpbp_attr - Structure representing DPBP attributes
|
||||
* @id: DPBP object ID
|
||||
* @version: DPBP version
|
||||
* @bpid: Hardware buffer pool ID; should be used as an argument in
|
||||
* acquire/release operations on buffers
|
||||
*/
|
||||
struct dpbp_attr {
|
||||
int id;
|
||||
/**
|
||||
* struct version - Structure representing DPBP version
|
||||
* @major: DPBP major version
|
||||
* @minor: DPBP minor version
|
||||
*/
|
||||
struct {
|
||||
uint16_t major;
|
||||
uint16_t minor;
|
||||
} version;
|
||||
uint16_t bpid;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* dpbp_get_attributes - Retrieve DPBP attributes.
|
||||
*
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @token: Token of DPBP object
|
||||
* @attr: Returned object's attributes
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpbp_get_attributes(struct fsl_mc_io *mc_io,
|
||||
uint16_t token,
|
||||
struct dpbp_attr *attr);
|
||||
|
||||
/** @} */
|
||||
|
||||
#endif /* __FSL_DPBP_H */
|
||||
163
include/fsl-mc/fsl_dpio.h
Normal file
163
include/fsl-mc/fsl_dpio.h
Normal file
@@ -0,0 +1,163 @@
|
||||
/*
|
||||
* Copyright (C) 2013-2015 Freescale Semiconductor
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#ifndef _FSL_DPIO_H
|
||||
#define _FSL_DPIO_H
|
||||
|
||||
/* DPIO Version */
|
||||
#define DPIO_VER_MAJOR 2
|
||||
#define DPIO_VER_MINOR 1
|
||||
|
||||
/* Command IDs */
|
||||
#define DPIO_CMDID_CLOSE 0x800
|
||||
#define DPIO_CMDID_OPEN 0x803
|
||||
|
||||
#define DPIO_CMDID_ENABLE 0x002
|
||||
#define DPIO_CMDID_DISABLE 0x003
|
||||
#define DPIO_CMDID_GET_ATTR 0x004
|
||||
#define DPIO_CMDID_RESET 0x005
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPIO_CMD_OPEN(cmd, dpio_id) \
|
||||
MC_CMD_OP(cmd, 0, 0, 32, int, dpio_id)
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPIO_RSP_GET_ATTR(cmd, attr) \
|
||||
do { \
|
||||
MC_RSP_OP(cmd, 0, 0, 32, int, attr->id);\
|
||||
MC_RSP_OP(cmd, 0, 32, 16, uint16_t, attr->qbman_portal_id);\
|
||||
MC_RSP_OP(cmd, 0, 48, 8, uint8_t, attr->num_priorities);\
|
||||
MC_RSP_OP(cmd, 0, 56, 4, enum dpio_channel_mode, attr->channel_mode);\
|
||||
MC_RSP_OP(cmd, 1, 0, 64, uint64_t, attr->qbman_portal_ce_paddr);\
|
||||
MC_RSP_OP(cmd, 2, 0, 64, uint64_t, attr->qbman_portal_ci_paddr);\
|
||||
MC_RSP_OP(cmd, 3, 0, 16, uint16_t, attr->version.major);\
|
||||
MC_RSP_OP(cmd, 3, 16, 16, uint16_t, attr->version.minor);\
|
||||
} while (0)
|
||||
|
||||
/* Data Path I/O Portal API
|
||||
* Contains initialization APIs and runtime control APIs for DPIO
|
||||
*/
|
||||
|
||||
struct fsl_mc_io;
|
||||
/**
|
||||
* dpio_open() - Open a control session for the specified object
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @dpio_id: DPIO unique ID
|
||||
* @token: Returned token; use in subsequent API calls
|
||||
*
|
||||
* This function can be used to open a control session for an
|
||||
* already created object; an object may have been declared in
|
||||
* the DPL or by calling the dpio_create() function.
|
||||
* This function returns a unique authentication token,
|
||||
* associated with the specific object ID and the specific MC
|
||||
* portal; this token must be used in all subsequent commands for
|
||||
* this specific object.
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpio_open(struct fsl_mc_io *mc_io, int dpio_id, uint16_t *token);
|
||||
|
||||
/**
|
||||
* dpio_open() - Open a control session for the specified object
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @dpio_id: DPIO unique ID
|
||||
* @token: Returned token; use in subsequent API calls
|
||||
*
|
||||
* This function can be used to open a control session for an
|
||||
* already created object; an object may have been declared in
|
||||
* the DPL or by calling the dpio_create() function.
|
||||
* This function returns a unique authentication token,
|
||||
* associated with the specific object ID and the specific MC
|
||||
* portal; this token must be used in all subsequent commands for
|
||||
* this specific object.
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpio_close(struct fsl_mc_io *mc_io, uint16_t token);
|
||||
|
||||
/**
|
||||
* enum dpio_channel_mode - DPIO notification channel mode
|
||||
* @DPIO_NO_CHANNEL: No support for notification channel
|
||||
* @DPIO_LOCAL_CHANNEL: Notifications on data availability can be received by a
|
||||
* dedicated channel in the DPIO; user should point the queue's
|
||||
* destination in the relevant interface to this DPIO
|
||||
*/
|
||||
enum dpio_channel_mode {
|
||||
DPIO_NO_CHANNEL = 0,
|
||||
DPIO_LOCAL_CHANNEL = 1,
|
||||
};
|
||||
|
||||
/**
|
||||
* dpio_enable() - Enable the DPIO, allow I/O portal operations.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @token: Token of DPIO object
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise
|
||||
*/
|
||||
int dpio_enable(struct fsl_mc_io *mc_io, uint16_t token);
|
||||
|
||||
/**
|
||||
* dpio_disable() - Disable the DPIO, stop any I/O portal operation.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @token: Token of DPIO object
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise
|
||||
*/
|
||||
int dpio_disable(struct fsl_mc_io *mc_io, uint16_t token);
|
||||
|
||||
/**
|
||||
* dpio_reset() - Reset the DPIO, returns the object to initial state.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @token: Token of DPIO object
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpio_reset(struct fsl_mc_io *mc_io, uint16_t token);
|
||||
|
||||
/**
|
||||
* struct dpio_attr - Structure representing DPIO attributes
|
||||
* @id: DPIO object ID
|
||||
* @version: DPIO version
|
||||
* @qbman_portal_ce_paddr: Physical address of the software portal
|
||||
* cache-enabled area
|
||||
* @qbman_portal_ci_paddr: Physical address of the software portal
|
||||
* cache-inhibited area
|
||||
* @qbman_portal_id: Software portal ID
|
||||
* @channel_mode: Notification channel mode
|
||||
* @num_priorities: Number of priorities for the notification channel (1-8);
|
||||
* relevant only if 'channel_mode = DPIO_LOCAL_CHANNEL'
|
||||
*/
|
||||
struct dpio_attr {
|
||||
int id;
|
||||
/**
|
||||
* struct version - DPIO version
|
||||
* @major: DPIO major version
|
||||
* @minor: DPIO minor version
|
||||
*/
|
||||
struct {
|
||||
uint16_t major;
|
||||
uint16_t minor;
|
||||
} version;
|
||||
uint64_t qbman_portal_ce_paddr;
|
||||
uint64_t qbman_portal_ci_paddr;
|
||||
uint16_t qbman_portal_id;
|
||||
enum dpio_channel_mode channel_mode;
|
||||
uint8_t num_priorities;
|
||||
};
|
||||
|
||||
/**
|
||||
* dpio_get_attributes() - Retrieve DPIO attributes
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @token: Token of DPIO object
|
||||
* @attr: Returned object's attributes
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise
|
||||
*/
|
||||
int dpio_get_attributes(struct fsl_mc_io *mc_io,
|
||||
uint16_t token,
|
||||
struct dpio_attr *attr);
|
||||
|
||||
#endif /* _FSL_DPIO_H */
|
||||
@@ -1,121 +1,44 @@
|
||||
/* Copyright 2014 Freescale Semiconductor Inc.
|
||||
/* Copyright 2013-2015 Freescale Semiconductor Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
/*!
|
||||
* @file fsl_dpmng.h
|
||||
* @brief Management Complex General API
|
||||
*/
|
||||
|
||||
#ifndef __FSL_DPMNG_H
|
||||
#define __FSL_DPMNG_H
|
||||
|
||||
/*!
|
||||
* @Group grp_dpmng Management Complex General API
|
||||
*
|
||||
* @brief Contains general API for the Management Complex firmware
|
||||
* @{
|
||||
/* Management Complex General API
|
||||
* Contains general API for the Management Complex firmware
|
||||
*/
|
||||
|
||||
struct fsl_mc_io;
|
||||
|
||||
/**
|
||||
* @brief Management Complex firmware version information
|
||||
* Management Complex firmware version information
|
||||
*/
|
||||
#define MC_VER_MAJOR 4
|
||||
#define MC_VER_MAJOR 6
|
||||
#define MC_VER_MINOR 0
|
||||
|
||||
/**
|
||||
* struct mc_versoin
|
||||
* @major: Major version number: incremented on API compatibility changes
|
||||
* @minor: Minor version number: incremented on API additions (that are
|
||||
* backward compatible); reset when major version is incremented
|
||||
* @revision: Internal revision number: incremented on implementation changes
|
||||
* and/or bug fixes that have no impact on API
|
||||
*/
|
||||
struct mc_version {
|
||||
uint32_t major;
|
||||
/*!< Major version number: incremented on API compatibility changes */
|
||||
uint32_t minor;
|
||||
/*!< Minor version number: incremented on API additions (that are
|
||||
* backward compatible); reset when major version is incremented
|
||||
*/
|
||||
uint32_t revision;
|
||||
/*!< Internal revision number: incremented on implementation changes
|
||||
* and/or bug fixes that have no impact on API
|
||||
*/
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Retrieves the Management Complex firmware version information
|
||||
* mc_get_version() - Retrieves the Management Complex firmware
|
||||
* version information
|
||||
* @mc_io: Pointer to opaque I/O object
|
||||
* @mc_ver_info: Returned version information structure
|
||||
*
|
||||
* @param[in] mc_io Pointer to opaque I/O object
|
||||
* @param[out] mc_ver_info Pointer to version information structure
|
||||
*
|
||||
* @returns '0' on Success; Error code otherwise.
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int mc_get_version(struct fsl_mc_io *mc_io, struct mc_version *mc_ver_info);
|
||||
|
||||
/**
|
||||
* @brief Resets an AIOP tile
|
||||
*
|
||||
* @param[in] mc_io Pointer to opaque I/O object
|
||||
* @param[in] container_id AIOP container ID
|
||||
* @param[in] aiop_tile_id AIOP tile ID to reset
|
||||
*
|
||||
* @returns '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpmng_reset_aiop(struct fsl_mc_io *mc_io,
|
||||
int container_id,
|
||||
int aiop_tile_id);
|
||||
|
||||
/**
|
||||
* @brief Loads an image to AIOP tile
|
||||
*
|
||||
* @param[in] mc_io Pointer to opaque I/O object
|
||||
* @param[in] container_id AIOP container ID
|
||||
* @param[in] aiop_tile_id AIOP tile ID to reset
|
||||
* @param[in] img_iova I/O virtual address of AIOP ELF image
|
||||
* @param[in] img_size Size of AIOP ELF image in memory (in bytes)
|
||||
*
|
||||
* @returns '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpmng_load_aiop(struct fsl_mc_io *mc_io,
|
||||
int container_id,
|
||||
int aiop_tile_id,
|
||||
uint64_t img_iova,
|
||||
uint32_t img_size);
|
||||
|
||||
/**
|
||||
* @brief AIOP run configuration
|
||||
*/
|
||||
struct dpmng_aiop_run_cfg {
|
||||
uint32_t cores_mask;
|
||||
/*!< Mask of AIOP cores to run (core 0 in most significant bit) */
|
||||
uint64_t options;
|
||||
/*!< Execution options (currently none defined) */
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Starts AIOP tile execution
|
||||
*
|
||||
* @param[in] mc_io Pointer to MC portal's I/O object
|
||||
* @param[in] container_id AIOP container ID
|
||||
* @param[in] aiop_tile_id AIOP tile ID to reset
|
||||
* @param[in] cfg AIOP run configuration
|
||||
*
|
||||
* @returns '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpmng_run_aiop(struct fsl_mc_io *mc_io,
|
||||
int container_id,
|
||||
int aiop_tile_id,
|
||||
const struct dpmng_aiop_run_cfg *cfg);
|
||||
|
||||
/**
|
||||
* @brief Resets MC portal
|
||||
*
|
||||
* This function closes all object handles (tokens) that are currently
|
||||
* open in the MC portal on which the command is submitted. This allows
|
||||
* cleanup of stale handles that belong to non-functional user processes.
|
||||
*
|
||||
* @param[in] mc_io Pointer to MC portal's I/O object
|
||||
*
|
||||
* @returns '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpmng_reset_mc_portal(struct fsl_mc_io *mc_io);
|
||||
|
||||
/** @} */
|
||||
|
||||
#endif /* __FSL_DPMNG_H */
|
||||
|
||||
1093
include/fsl-mc/fsl_dpni.h
Normal file
1093
include/fsl-mc/fsl_dpni.h
Normal file
File diff suppressed because it is too large
Load Diff
659
include/fsl-mc/fsl_dprc.h
Normal file
659
include/fsl-mc/fsl_dprc.h
Normal file
@@ -0,0 +1,659 @@
|
||||
/*
|
||||
* Freescale Layerscape MC I/O wrapper
|
||||
*
|
||||
* Copyright (C) 2013-2015 Freescale Semiconductor, Inc.
|
||||
* Author: German Rivera <German.Rivera@freescale.com>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
#ifndef _FSL_DPRC_H
|
||||
#define _FSL_DPRC_H
|
||||
|
||||
/* DPRC Version */
|
||||
#define DPRC_VER_MAJOR 2
|
||||
#define DPRC_VER_MINOR 0
|
||||
|
||||
/* Command IDs */
|
||||
#define DPRC_CMDID_CLOSE 0x800
|
||||
#define DPRC_CMDID_OPEN 0x805
|
||||
|
||||
#define DPRC_CMDID_GET_ATTR 0x004
|
||||
#define DPRC_CMDID_RESET_CONT 0x005
|
||||
|
||||
#define DPRC_CMDID_GET_CONT_ID 0x830
|
||||
#define DPRC_CMDID_GET_OBJ_COUNT 0x159
|
||||
#define DPRC_CMDID_GET_OBJ 0x15A
|
||||
#define DPRC_CMDID_GET_RES_COUNT 0x15B
|
||||
#define DPRC_CMDID_GET_RES_IDS 0x15C
|
||||
#define DPRC_CMDID_GET_OBJ_REG 0x15E
|
||||
|
||||
#define DPRC_CMDID_CONNECT 0x167
|
||||
#define DPRC_CMDID_DISCONNECT 0x168
|
||||
#define DPRC_CMDID_GET_CONNECTION 0x16C
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPRC_RSP_GET_CONTAINER_ID(cmd, container_id) \
|
||||
MC_RSP_OP(cmd, 0, 0, 32, int, container_id)
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPRC_CMD_OPEN(cmd, container_id) \
|
||||
MC_CMD_OP(cmd, 0, 0, 32, int, container_id)
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPRC_CMD_RESET_CONTAINER(cmd, child_container_id) \
|
||||
MC_CMD_OP(cmd, 0, 0, 32, int, child_container_id)
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPRC_RSP_GET_ATTRIBUTES(cmd, attr) \
|
||||
do { \
|
||||
MC_RSP_OP(cmd, 0, 0, 32, int, attr->container_id); \
|
||||
MC_RSP_OP(cmd, 0, 32, 16, uint16_t, attr->icid); \
|
||||
MC_RSP_OP(cmd, 1, 0, 32, uint32_t, attr->options);\
|
||||
MC_RSP_OP(cmd, 1, 32, 32, int, attr->portal_id); \
|
||||
MC_RSP_OP(cmd, 2, 0, 16, uint16_t, attr->version.major);\
|
||||
MC_RSP_OP(cmd, 2, 16, 16, uint16_t, attr->version.minor);\
|
||||
} while (0)
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPRC_RSP_GET_OBJ_COUNT(cmd, obj_count) \
|
||||
MC_RSP_OP(cmd, 0, 32, 32, int, obj_count)
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPRC_CMD_GET_OBJ(cmd, obj_index) \
|
||||
MC_CMD_OP(cmd, 0, 0, 32, int, obj_index)
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPRC_RSP_GET_OBJ(cmd, obj_desc) \
|
||||
do { \
|
||||
MC_RSP_OP(cmd, 0, 32, 32, int, obj_desc->id); \
|
||||
MC_RSP_OP(cmd, 1, 0, 16, uint16_t, obj_desc->vendor); \
|
||||
MC_RSP_OP(cmd, 1, 16, 8, uint8_t, obj_desc->irq_count); \
|
||||
MC_RSP_OP(cmd, 1, 24, 8, uint8_t, obj_desc->region_count); \
|
||||
MC_RSP_OP(cmd, 1, 32, 32, uint32_t, obj_desc->state);\
|
||||
MC_RSP_OP(cmd, 2, 0, 16, uint16_t, obj_desc->ver_major);\
|
||||
MC_RSP_OP(cmd, 2, 16, 16, uint16_t, obj_desc->ver_minor);\
|
||||
MC_RSP_OP(cmd, 3, 0, 8, char, obj_desc->type[0]);\
|
||||
MC_RSP_OP(cmd, 3, 8, 8, char, obj_desc->type[1]);\
|
||||
MC_RSP_OP(cmd, 3, 16, 8, char, obj_desc->type[2]);\
|
||||
MC_RSP_OP(cmd, 3, 24, 8, char, obj_desc->type[3]);\
|
||||
MC_RSP_OP(cmd, 3, 32, 8, char, obj_desc->type[4]);\
|
||||
MC_RSP_OP(cmd, 3, 40, 8, char, obj_desc->type[5]);\
|
||||
MC_RSP_OP(cmd, 3, 48, 8, char, obj_desc->type[6]);\
|
||||
MC_RSP_OP(cmd, 3, 56, 8, char, obj_desc->type[7]);\
|
||||
MC_RSP_OP(cmd, 4, 0, 8, char, obj_desc->type[8]);\
|
||||
MC_RSP_OP(cmd, 4, 8, 8, char, obj_desc->type[9]);\
|
||||
MC_RSP_OP(cmd, 4, 16, 8, char, obj_desc->type[10]);\
|
||||
MC_RSP_OP(cmd, 4, 24, 8, char, obj_desc->type[11]);\
|
||||
MC_RSP_OP(cmd, 4, 32, 8, char, obj_desc->type[12]);\
|
||||
MC_RSP_OP(cmd, 4, 40, 8, char, obj_desc->type[13]);\
|
||||
MC_RSP_OP(cmd, 4, 48, 8, char, obj_desc->type[14]);\
|
||||
MC_RSP_OP(cmd, 4, 56, 8, char, obj_desc->type[15]);\
|
||||
} while (0)
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPRC_CMD_GET_RES_COUNT(cmd, type) \
|
||||
do { \
|
||||
MC_CMD_OP(cmd, 1, 0, 8, char, type[0]);\
|
||||
MC_CMD_OP(cmd, 1, 8, 8, char, type[1]);\
|
||||
MC_CMD_OP(cmd, 1, 16, 8, char, type[2]);\
|
||||
MC_CMD_OP(cmd, 1, 24, 8, char, type[3]);\
|
||||
MC_CMD_OP(cmd, 1, 32, 8, char, type[4]);\
|
||||
MC_CMD_OP(cmd, 1, 40, 8, char, type[5]);\
|
||||
MC_CMD_OP(cmd, 1, 48, 8, char, type[6]);\
|
||||
MC_CMD_OP(cmd, 1, 56, 8, char, type[7]);\
|
||||
MC_CMD_OP(cmd, 2, 0, 8, char, type[8]);\
|
||||
MC_CMD_OP(cmd, 2, 8, 8, char, type[9]);\
|
||||
MC_CMD_OP(cmd, 2, 16, 8, char, type[10]);\
|
||||
MC_CMD_OP(cmd, 2, 24, 8, char, type[11]);\
|
||||
MC_CMD_OP(cmd, 2, 32, 8, char, type[12]);\
|
||||
MC_CMD_OP(cmd, 2, 40, 8, char, type[13]);\
|
||||
MC_CMD_OP(cmd, 2, 48, 8, char, type[14]);\
|
||||
MC_CMD_OP(cmd, 2, 56, 8, char, type[15]);\
|
||||
} while (0)
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPRC_RSP_GET_RES_COUNT(cmd, res_count) \
|
||||
MC_RSP_OP(cmd, 0, 0, 32, int, res_count)
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPRC_CMD_GET_RES_IDS(cmd, range_desc, type) \
|
||||
do { \
|
||||
MC_CMD_OP(cmd, 0, 42, 7, enum dprc_iter_status, \
|
||||
range_desc->iter_status); \
|
||||
MC_CMD_OP(cmd, 1, 0, 32, int, range_desc->base_id); \
|
||||
MC_CMD_OP(cmd, 1, 32, 32, int, range_desc->last_id);\
|
||||
MC_CMD_OP(cmd, 2, 0, 8, char, type[0]);\
|
||||
MC_CMD_OP(cmd, 2, 8, 8, char, type[1]);\
|
||||
MC_CMD_OP(cmd, 2, 16, 8, char, type[2]);\
|
||||
MC_CMD_OP(cmd, 2, 24, 8, char, type[3]);\
|
||||
MC_CMD_OP(cmd, 2, 32, 8, char, type[4]);\
|
||||
MC_CMD_OP(cmd, 2, 40, 8, char, type[5]);\
|
||||
MC_CMD_OP(cmd, 2, 48, 8, char, type[6]);\
|
||||
MC_CMD_OP(cmd, 2, 56, 8, char, type[7]);\
|
||||
MC_CMD_OP(cmd, 3, 0, 8, char, type[8]);\
|
||||
MC_CMD_OP(cmd, 3, 8, 8, char, type[9]);\
|
||||
MC_CMD_OP(cmd, 3, 16, 8, char, type[10]);\
|
||||
MC_CMD_OP(cmd, 3, 24, 8, char, type[11]);\
|
||||
MC_CMD_OP(cmd, 3, 32, 8, char, type[12]);\
|
||||
MC_CMD_OP(cmd, 3, 40, 8, char, type[13]);\
|
||||
MC_CMD_OP(cmd, 3, 48, 8, char, type[14]);\
|
||||
MC_CMD_OP(cmd, 3, 56, 8, char, type[15]);\
|
||||
} while (0)
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPRC_RSP_GET_RES_IDS(cmd, range_desc) \
|
||||
do { \
|
||||
MC_RSP_OP(cmd, 0, 42, 7, enum dprc_iter_status, \
|
||||
range_desc->iter_status);\
|
||||
MC_RSP_OP(cmd, 1, 0, 32, int, range_desc->base_id); \
|
||||
MC_RSP_OP(cmd, 1, 32, 32, int, range_desc->last_id);\
|
||||
} while (0)
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPRC_CMD_GET_OBJ_REGION(cmd, obj_type, obj_id, region_index) \
|
||||
do { \
|
||||
MC_CMD_OP(cmd, 0, 0, 32, int, obj_id); \
|
||||
MC_CMD_OP(cmd, 0, 48, 8, uint8_t, region_index);\
|
||||
MC_CMD_OP(cmd, 3, 0, 8, char, obj_type[0]);\
|
||||
MC_CMD_OP(cmd, 3, 8, 8, char, obj_type[1]);\
|
||||
MC_CMD_OP(cmd, 3, 16, 8, char, obj_type[2]);\
|
||||
MC_CMD_OP(cmd, 3, 24, 8, char, obj_type[3]);\
|
||||
MC_CMD_OP(cmd, 3, 32, 8, char, obj_type[4]);\
|
||||
MC_CMD_OP(cmd, 3, 40, 8, char, obj_type[5]);\
|
||||
MC_CMD_OP(cmd, 3, 48, 8, char, obj_type[6]);\
|
||||
MC_CMD_OP(cmd, 3, 56, 8, char, obj_type[7]);\
|
||||
MC_CMD_OP(cmd, 4, 0, 8, char, obj_type[8]);\
|
||||
MC_CMD_OP(cmd, 4, 8, 8, char, obj_type[9]);\
|
||||
MC_CMD_OP(cmd, 4, 16, 8, char, obj_type[10]);\
|
||||
MC_CMD_OP(cmd, 4, 24, 8, char, obj_type[11]);\
|
||||
MC_CMD_OP(cmd, 4, 32, 8, char, obj_type[12]);\
|
||||
MC_CMD_OP(cmd, 4, 40, 8, char, obj_type[13]);\
|
||||
MC_CMD_OP(cmd, 4, 48, 8, char, obj_type[14]);\
|
||||
MC_CMD_OP(cmd, 4, 56, 8, char, obj_type[15]);\
|
||||
} while (0)
|
||||
|
||||
/* param, offset, width, type, arg_name */
|
||||
#define DPRC_RSP_GET_OBJ_REGION(cmd, region_desc) \
|
||||
do { \
|
||||
MC_RSP_OP(cmd, 1, 0, 64, uint64_t, region_desc->base_paddr);\
|
||||
MC_RSP_OP(cmd, 2, 0, 32, uint32_t, region_desc->size); \
|
||||
} while (0)
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPRC_CMD_CONNECT(cmd, endpoint1, endpoint2) \
|
||||
do { \
|
||||
MC_CMD_OP(cmd, 0, 0, 32, int, endpoint1->id); \
|
||||
MC_CMD_OP(cmd, 0, 32, 32, int, endpoint1->interface_id); \
|
||||
MC_CMD_OP(cmd, 1, 0, 32, int, endpoint2->id); \
|
||||
MC_CMD_OP(cmd, 1, 32, 32, int, endpoint2->interface_id); \
|
||||
MC_CMD_OP(cmd, 2, 0, 8, char, endpoint1->type[0]); \
|
||||
MC_CMD_OP(cmd, 2, 8, 8, char, endpoint1->type[1]); \
|
||||
MC_CMD_OP(cmd, 2, 16, 8, char, endpoint1->type[2]); \
|
||||
MC_CMD_OP(cmd, 2, 24, 8, char, endpoint1->type[3]); \
|
||||
MC_CMD_OP(cmd, 2, 32, 8, char, endpoint1->type[4]); \
|
||||
MC_CMD_OP(cmd, 2, 40, 8, char, endpoint1->type[5]); \
|
||||
MC_CMD_OP(cmd, 2, 48, 8, char, endpoint1->type[6]); \
|
||||
MC_CMD_OP(cmd, 2, 56, 8, char, endpoint1->type[7]); \
|
||||
MC_CMD_OP(cmd, 3, 0, 8, char, endpoint1->type[8]); \
|
||||
MC_CMD_OP(cmd, 3, 8, 8, char, endpoint1->type[9]); \
|
||||
MC_CMD_OP(cmd, 3, 16, 8, char, endpoint1->type[10]); \
|
||||
MC_CMD_OP(cmd, 3, 24, 8, char, endpoint1->type[11]); \
|
||||
MC_CMD_OP(cmd, 3, 32, 8, char, endpoint1->type[12]); \
|
||||
MC_CMD_OP(cmd, 3, 40, 8, char, endpoint1->type[13]); \
|
||||
MC_CMD_OP(cmd, 3, 48, 8, char, endpoint1->type[14]); \
|
||||
MC_CMD_OP(cmd, 3, 56, 8, char, endpoint1->type[15]); \
|
||||
MC_CMD_OP(cmd, 5, 0, 8, char, endpoint2->type[0]); \
|
||||
MC_CMD_OP(cmd, 5, 8, 8, char, endpoint2->type[1]); \
|
||||
MC_CMD_OP(cmd, 5, 16, 8, char, endpoint2->type[2]); \
|
||||
MC_CMD_OP(cmd, 5, 24, 8, char, endpoint2->type[3]); \
|
||||
MC_CMD_OP(cmd, 5, 32, 8, char, endpoint2->type[4]); \
|
||||
MC_CMD_OP(cmd, 5, 40, 8, char, endpoint2->type[5]); \
|
||||
MC_CMD_OP(cmd, 5, 48, 8, char, endpoint2->type[6]); \
|
||||
MC_CMD_OP(cmd, 5, 56, 8, char, endpoint2->type[7]); \
|
||||
MC_CMD_OP(cmd, 6, 0, 8, char, endpoint2->type[8]); \
|
||||
MC_CMD_OP(cmd, 6, 8, 8, char, endpoint2->type[9]); \
|
||||
MC_CMD_OP(cmd, 6, 16, 8, char, endpoint2->type[10]); \
|
||||
MC_CMD_OP(cmd, 6, 24, 8, char, endpoint2->type[11]); \
|
||||
MC_CMD_OP(cmd, 6, 32, 8, char, endpoint2->type[12]); \
|
||||
MC_CMD_OP(cmd, 6, 40, 8, char, endpoint2->type[13]); \
|
||||
MC_CMD_OP(cmd, 6, 48, 8, char, endpoint2->type[14]); \
|
||||
MC_CMD_OP(cmd, 6, 56, 8, char, endpoint2->type[15]); \
|
||||
} while (0)
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPRC_CMD_DISCONNECT(cmd, endpoint) \
|
||||
do { \
|
||||
MC_CMD_OP(cmd, 0, 0, 32, int, endpoint->id); \
|
||||
MC_CMD_OP(cmd, 0, 32, 32, int, endpoint->interface_id); \
|
||||
MC_CMD_OP(cmd, 1, 0, 8, char, endpoint->type[0]); \
|
||||
MC_CMD_OP(cmd, 1, 8, 8, char, endpoint->type[1]); \
|
||||
MC_CMD_OP(cmd, 1, 16, 8, char, endpoint->type[2]); \
|
||||
MC_CMD_OP(cmd, 1, 24, 8, char, endpoint->type[3]); \
|
||||
MC_CMD_OP(cmd, 1, 32, 8, char, endpoint->type[4]); \
|
||||
MC_CMD_OP(cmd, 1, 40, 8, char, endpoint->type[5]); \
|
||||
MC_CMD_OP(cmd, 1, 48, 8, char, endpoint->type[6]); \
|
||||
MC_CMD_OP(cmd, 1, 56, 8, char, endpoint->type[7]); \
|
||||
MC_CMD_OP(cmd, 2, 0, 8, char, endpoint->type[8]); \
|
||||
MC_CMD_OP(cmd, 2, 8, 8, char, endpoint->type[9]); \
|
||||
MC_CMD_OP(cmd, 2, 16, 8, char, endpoint->type[10]); \
|
||||
MC_CMD_OP(cmd, 2, 24, 8, char, endpoint->type[11]); \
|
||||
MC_CMD_OP(cmd, 2, 32, 8, char, endpoint->type[12]); \
|
||||
MC_CMD_OP(cmd, 2, 40, 8, char, endpoint->type[13]); \
|
||||
MC_CMD_OP(cmd, 2, 48, 8, char, endpoint->type[14]); \
|
||||
MC_CMD_OP(cmd, 2, 56, 8, char, endpoint->type[15]); \
|
||||
} while (0)
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPRC_CMD_GET_CONNECTION(cmd, endpoint1) \
|
||||
do { \
|
||||
MC_CMD_OP(cmd, 0, 0, 32, int, endpoint1->id); \
|
||||
MC_CMD_OP(cmd, 0, 32, 32, int, endpoint1->interface_id); \
|
||||
MC_CMD_OP(cmd, 1, 0, 8, char, endpoint1->type[0]); \
|
||||
MC_CMD_OP(cmd, 1, 8, 8, char, endpoint1->type[1]); \
|
||||
MC_CMD_OP(cmd, 1, 16, 8, char, endpoint1->type[2]); \
|
||||
MC_CMD_OP(cmd, 1, 24, 8, char, endpoint1->type[3]); \
|
||||
MC_CMD_OP(cmd, 1, 32, 8, char, endpoint1->type[4]); \
|
||||
MC_CMD_OP(cmd, 1, 40, 8, char, endpoint1->type[5]); \
|
||||
MC_CMD_OP(cmd, 1, 48, 8, char, endpoint1->type[6]); \
|
||||
MC_CMD_OP(cmd, 1, 56, 8, char, endpoint1->type[7]); \
|
||||
MC_CMD_OP(cmd, 2, 0, 8, char, endpoint1->type[8]); \
|
||||
MC_CMD_OP(cmd, 2, 8, 8, char, endpoint1->type[9]); \
|
||||
MC_CMD_OP(cmd, 2, 16, 8, char, endpoint1->type[10]); \
|
||||
MC_CMD_OP(cmd, 2, 24, 8, char, endpoint1->type[11]); \
|
||||
MC_CMD_OP(cmd, 2, 32, 8, char, endpoint1->type[12]); \
|
||||
MC_CMD_OP(cmd, 2, 40, 8, char, endpoint1->type[13]); \
|
||||
MC_CMD_OP(cmd, 2, 48, 8, char, endpoint1->type[14]); \
|
||||
MC_CMD_OP(cmd, 2, 56, 8, char, endpoint1->type[15]); \
|
||||
} while (0)
|
||||
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPRC_RSP_GET_CONNECTION(cmd, endpoint2, state) \
|
||||
do { \
|
||||
MC_RSP_OP(cmd, 3, 0, 32, int, endpoint2->id); \
|
||||
MC_RSP_OP(cmd, 3, 32, 32, int, endpoint2->interface_id); \
|
||||
MC_RSP_OP(cmd, 4, 0, 8, char, endpoint2->type[0]); \
|
||||
MC_RSP_OP(cmd, 4, 8, 8, char, endpoint2->type[1]); \
|
||||
MC_RSP_OP(cmd, 4, 16, 8, char, endpoint2->type[2]); \
|
||||
MC_RSP_OP(cmd, 4, 24, 8, char, endpoint2->type[3]); \
|
||||
MC_RSP_OP(cmd, 4, 32, 8, char, endpoint2->type[4]); \
|
||||
MC_RSP_OP(cmd, 4, 40, 8, char, endpoint2->type[5]); \
|
||||
MC_RSP_OP(cmd, 4, 48, 8, char, endpoint2->type[6]); \
|
||||
MC_RSP_OP(cmd, 4, 56, 8, char, endpoint2->type[7]); \
|
||||
MC_RSP_OP(cmd, 5, 0, 8, char, endpoint2->type[8]); \
|
||||
MC_RSP_OP(cmd, 5, 8, 8, char, endpoint2->type[9]); \
|
||||
MC_RSP_OP(cmd, 5, 16, 8, char, endpoint2->type[10]); \
|
||||
MC_RSP_OP(cmd, 5, 24, 8, char, endpoint2->type[11]); \
|
||||
MC_RSP_OP(cmd, 5, 32, 8, char, endpoint2->type[12]); \
|
||||
MC_RSP_OP(cmd, 5, 40, 8, char, endpoint2->type[13]); \
|
||||
MC_RSP_OP(cmd, 5, 48, 8, char, endpoint2->type[14]); \
|
||||
MC_RSP_OP(cmd, 5, 56, 8, char, endpoint2->type[15]); \
|
||||
MC_RSP_OP(cmd, 6, 0, 32, int, state); \
|
||||
} while (0)
|
||||
|
||||
/* Data Path Resource Container API
|
||||
* Contains DPRC API for managing and querying DPAA resources
|
||||
*/
|
||||
struct fsl_mc_io;
|
||||
|
||||
/**
|
||||
* Set this value as the icid value in dprc_cfg structure when creating a
|
||||
* container, in case the ICID is not selected by the user and should be
|
||||
* allocated by the DPRC from the pool of ICIDs.
|
||||
*/
|
||||
#define DPRC_GET_ICID_FROM_POOL (uint16_t)(~(0))
|
||||
|
||||
/**
|
||||
* Set this value as the portal_id value in dprc_cfg structure when creating a
|
||||
* container, in case the portal ID is not specifically selected by the
|
||||
* user and should be allocated by the DPRC from the pool of portal ids.
|
||||
*/
|
||||
#define DPRC_GET_PORTAL_ID_FROM_POOL (int)(~(0))
|
||||
|
||||
/**
|
||||
* dprc_get_container_id() - Get container ID associated with a given portal.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @container_id: Requested container ID
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dprc_get_container_id(struct fsl_mc_io *mc_io, int *container_id);
|
||||
|
||||
/**
|
||||
* dprc_open() - Open DPRC object for use
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @container_id: Container ID to open
|
||||
* @token: Returned token of DPRC object
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*
|
||||
* @warning Required before any operation on the object.
|
||||
*/
|
||||
int dprc_open(struct fsl_mc_io *mc_io, int container_id, uint16_t *token);
|
||||
|
||||
/**
|
||||
* dprc_close() - Close the control session of the object
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @token: Token of DPRC object
|
||||
*
|
||||
* After this function is called, no further operations are
|
||||
* allowed on the object without opening a new control session.
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dprc_close(struct fsl_mc_io *mc_io, uint16_t token);
|
||||
|
||||
/**
|
||||
* Container general options
|
||||
*
|
||||
* These options may be selected at container creation by the container creator
|
||||
* and can be retrieved using dprc_get_attributes()
|
||||
*/
|
||||
|
||||
/* Spawn Policy Option allowed - Indicates that the new container is allowed
|
||||
* to spawn and have its own child containers.
|
||||
*/
|
||||
#define DPRC_CFG_OPT_SPAWN_ALLOWED 0x00000001
|
||||
|
||||
/* General Container allocation policy - Indicates that the new container is
|
||||
* allowed to allocate requested resources from its parent container; if not
|
||||
* set, the container is only allowed to use resources in its own pools; Note
|
||||
* that this is a container's global policy, but the parent container may
|
||||
* override it and set specific quota per resource type.
|
||||
*/
|
||||
#define DPRC_CFG_OPT_ALLOC_ALLOWED 0x00000002
|
||||
|
||||
/* Object initialization allowed - software context associated with this
|
||||
* container is allowed to invoke object initialization operations.
|
||||
*/
|
||||
#define DPRC_CFG_OPT_OBJ_CREATE_ALLOWED 0x00000004
|
||||
|
||||
/* Topology change allowed - software context associated with this
|
||||
* container is allowed to invoke topology operations, such as attach/detach
|
||||
* of network objects.
|
||||
*/
|
||||
#define DPRC_CFG_OPT_TOPOLOGY_CHANGES_ALLOWED 0x00000008
|
||||
|
||||
/* IOMMU bypass - indicates whether objects of this container are permitted
|
||||
* to bypass the IOMMU.
|
||||
*/
|
||||
#define DPRC_CFG_OPT_IOMMU_BYPASS 0x00000010
|
||||
|
||||
/* AIOP - Indicates that container belongs to AIOP. */
|
||||
#define DPRC_CFG_OPT_AIOP 0x00000020
|
||||
|
||||
/**
|
||||
* struct dprc_cfg - Container configuration options
|
||||
* @icid: Container's ICID; if set to 'DPRC_GET_ICID_FROM_POOL', a free
|
||||
* ICID value is allocated by the DPRC
|
||||
* @portal_id: Portal ID; if set to 'DPRC_GET_PORTAL_ID_FROM_POOL', a free
|
||||
* portal ID is allocated by the DPRC
|
||||
* @options: Combination of 'DPRC_CFG_OPT_<X>' options
|
||||
*/
|
||||
struct dprc_cfg {
|
||||
uint16_t icid;
|
||||
int portal_id;
|
||||
uint64_t options;
|
||||
};
|
||||
|
||||
/**
|
||||
* dprc_reset_container - Reset child container.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @token: Token of DPRC object
|
||||
* @child_container_id: ID of the container to reset
|
||||
*
|
||||
* In case a software context crashes or becomes non-responsive, the parent
|
||||
* may wish to reset its resources container before the software context is
|
||||
* restarted.
|
||||
*
|
||||
* This routine informs all objects assigned to the child container that the
|
||||
* container is being reset, so they may perform any cleanup operations that are
|
||||
* needed. All objects handles that were owned by the child container shall be
|
||||
* closed.
|
||||
*
|
||||
* Note that such request may be submitted even if the child software context
|
||||
* has not crashed, but the resulting object cleanup operations will not be
|
||||
* aware of that.
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dprc_reset_container(struct fsl_mc_io *mc_io,
|
||||
uint16_t token,
|
||||
int child_container_id);
|
||||
|
||||
/**
|
||||
* struct dprc_attributes - Container attributes
|
||||
* @container_id: Container's ID
|
||||
* @icid: Container's ICID
|
||||
* @portal_id: Container's portal ID
|
||||
* @options: Container's options as set at container's creation
|
||||
* @version: DPRC version
|
||||
*/
|
||||
struct dprc_attributes {
|
||||
int container_id;
|
||||
uint16_t icid;
|
||||
int portal_id;
|
||||
uint64_t options;
|
||||
/**
|
||||
* struct version - DPRC version
|
||||
* @major: DPRC major version
|
||||
* @minor: DPRC minor version
|
||||
*/
|
||||
struct {
|
||||
uint16_t major;
|
||||
uint16_t minor;
|
||||
} version;
|
||||
};
|
||||
|
||||
/**
|
||||
* dprc_get_attributes() - Obtains container attributes
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @token: Token of DPRC object
|
||||
* @attributes Returned container attributes
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dprc_get_attributes(struct fsl_mc_io *mc_io,
|
||||
uint16_t token,
|
||||
struct dprc_attributes *attributes);
|
||||
|
||||
/**
|
||||
* dprc_get_obj_count() - Obtains the number of objects in the DPRC
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @token: Token of DPRC object
|
||||
* @obj_count: Number of objects assigned to the DPRC
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dprc_get_obj_count(struct fsl_mc_io *mc_io, uint16_t token, int *obj_count);
|
||||
|
||||
/* Objects Attributes Flags */
|
||||
|
||||
/* Opened state - Indicates that an object is open by at least one owner */
|
||||
#define DPRC_OBJ_STATE_OPEN 0x00000001
|
||||
/* Plugged state - Indicates that the object is plugged */
|
||||
#define DPRC_OBJ_STATE_PLUGGED 0x00000002
|
||||
|
||||
/**
|
||||
* struct dprc_obj_desc - Object descriptor, returned from dprc_get_obj()
|
||||
* @type: Type of object: NULL terminated string
|
||||
* @id: ID of logical object resource
|
||||
* @vendor: Object vendor identifier
|
||||
* @ver_major: Major version number
|
||||
* @ver_minor: Minor version number
|
||||
* @irq_count: Number of interrupts supported by the object
|
||||
* @region_count: Number of mappable regions supported by the object
|
||||
* @state: Object state: combination of DPRC_OBJ_STATE_ states
|
||||
*/
|
||||
struct dprc_obj_desc {
|
||||
char type[16];
|
||||
int id;
|
||||
uint16_t vendor;
|
||||
uint16_t ver_major;
|
||||
uint16_t ver_minor;
|
||||
uint8_t irq_count;
|
||||
uint8_t region_count;
|
||||
uint32_t state;
|
||||
};
|
||||
|
||||
/**
|
||||
* dprc_get_obj() - Get general information on an object
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @token: Token of DPRC object
|
||||
* @obj_index: Index of the object to be queried (< obj_count)
|
||||
* @obj_desc: Returns the requested object descriptor
|
||||
*
|
||||
* The object descriptors are retrieved one by one by incrementing
|
||||
* obj_index up to (not including) the value of obj_count returned
|
||||
* from dprc_get_obj_count(). dprc_get_obj_count() must
|
||||
* be called prior to dprc_get_obj().
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dprc_get_obj(struct fsl_mc_io *mc_io,
|
||||
uint16_t token,
|
||||
int obj_index,
|
||||
struct dprc_obj_desc *obj_desc);
|
||||
|
||||
/**
|
||||
* dprc_get_res_count() - Obtains the number of free resources that are assigned
|
||||
* to this container, by pool type
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @token: Token of DPRC object
|
||||
* @type: pool type
|
||||
* @res_count: Returned number of free resources of the given
|
||||
* resource type that are assigned to this DPRC
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dprc_get_res_count(struct fsl_mc_io *mc_io,
|
||||
uint16_t token,
|
||||
char *type,
|
||||
int *res_count);
|
||||
|
||||
/**
|
||||
* enum dprc_iter_status - Iteration status
|
||||
* @DPRC_ITER_STATUS_FIRST: Perform first iteration
|
||||
* @DPRC_ITER_STATUS_MORE: Indicates more/next iteration is needed
|
||||
* @DPRC_ITER_STATUS_LAST: Indicates last iteration
|
||||
*/
|
||||
enum dprc_iter_status {
|
||||
DPRC_ITER_STATUS_FIRST = 0,
|
||||
DPRC_ITER_STATUS_MORE = 1,
|
||||
DPRC_ITER_STATUS_LAST = 2
|
||||
};
|
||||
|
||||
/**
|
||||
* struct dprc_res_ids_range_desc - Resource ID range descriptor
|
||||
* @base_id: Base resource ID of this range
|
||||
* @last_id: Last resource ID of this range
|
||||
* @iter_status: Iteration status - should be set to DPRC_ITER_STATUS_FIRST at
|
||||
* first iteration; while the returned marker is DPRC_ITER_STATUS_MORE,
|
||||
* additional iterations are needed, until the returned marker is
|
||||
* DPRC_ITER_STATUS_LAST
|
||||
*/
|
||||
struct dprc_res_ids_range_desc {
|
||||
int base_id;
|
||||
int last_id;
|
||||
enum dprc_iter_status iter_status;
|
||||
};
|
||||
|
||||
/**
|
||||
* dprc_get_res_ids() - Obtains IDs of free resources in the container
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @token: Token of DPRC object
|
||||
* @type: pool type
|
||||
* @range_desc: range descriptor
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dprc_get_res_ids(struct fsl_mc_io *mc_io,
|
||||
uint16_t token,
|
||||
char *type,
|
||||
struct dprc_res_ids_range_desc *range_desc);
|
||||
|
||||
/**
|
||||
* struct dprc_region_desc - Mappable region descriptor
|
||||
* @base_paddr: Region base physical address
|
||||
* @size: Region size (in bytes)
|
||||
*/
|
||||
struct dprc_region_desc {
|
||||
uint64_t base_paddr;
|
||||
uint32_t size;
|
||||
};
|
||||
|
||||
/**
|
||||
* dprc_get_obj_region() - Get region information for a specified object.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @token: Token of DPRC object
|
||||
* @obj_type; Object type as returned in dprc_get_obj()
|
||||
* @obj_id: Unique object instance as returned in dprc_get_obj()
|
||||
* @region_index: The specific region to query
|
||||
* @region_desc: Returns the requested region descriptor
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dprc_get_obj_region(struct fsl_mc_io *mc_io,
|
||||
uint16_t token,
|
||||
char *obj_type,
|
||||
int obj_id,
|
||||
uint8_t region_index,
|
||||
struct dprc_region_desc *region_desc);
|
||||
/**
|
||||
* struct dprc_endpoint - Endpoint description for link connect/disconnect
|
||||
* operations
|
||||
* @type: Endpoint object type: NULL terminated string
|
||||
* @id: Endpoint object ID
|
||||
* @interface_id: Interface ID; should be set for endpoints with multiple
|
||||
* interfaces ("dpsw", "dpdmux"); for others, always set to 0
|
||||
*/
|
||||
struct dprc_endpoint {
|
||||
char type[16];
|
||||
int id;
|
||||
int interface_id;
|
||||
};
|
||||
|
||||
/**
|
||||
* dprc_connect() - Connect two endpoints to create a network link between them
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @token: Token of DPRC object
|
||||
* @endpoint1: Endpoint 1 configuration parameters
|
||||
* @endpoint2: Endpoint 2 configuration parameters
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dprc_connect(struct fsl_mc_io *mc_io,
|
||||
uint16_t token,
|
||||
const struct dprc_endpoint *endpoint1,
|
||||
const struct dprc_endpoint *endpoint2);
|
||||
|
||||
/**
|
||||
* dprc_disconnect() - Disconnect one endpoint to remove its network connection
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @token: Token of DPRC object
|
||||
* @endpoint: Endpoint configuration parameters
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dprc_disconnect(struct fsl_mc_io *mc_io,
|
||||
uint16_t token,
|
||||
const struct dprc_endpoint *endpoint);
|
||||
|
||||
/**
|
||||
* dprc_get_connection() - Get connected endpoint and link status if connection
|
||||
* exists.
|
||||
* @mc_io Pointer to MC portal's I/O object
|
||||
* @token Token of DPRC object
|
||||
* @endpoint1 Endpoint 1 configuration parameters
|
||||
* @endpoint2 Returned endpoint 2 configuration parameters
|
||||
* @state: Returned link state: 1 - link is up, 0 - link is down
|
||||
*
|
||||
* Return: '0' on Success; -ENAVAIL if connection does not exist.
|
||||
*/
|
||||
int dprc_get_connection(struct fsl_mc_io *mc_io,
|
||||
uint16_t token,
|
||||
const struct dprc_endpoint *endpoint1,
|
||||
struct dprc_endpoint *endpoint2,
|
||||
int *state);
|
||||
|
||||
#endif /* _FSL_DPRC_H */
|
||||
@@ -53,8 +53,8 @@ struct mc_ccsr_registers {
|
||||
u32 reg_error[];
|
||||
};
|
||||
|
||||
int mc_init(bd_t *bis);
|
||||
|
||||
int get_mc_boot_status(void);
|
||||
unsigned long mc_get_dram_block_size(void);
|
||||
int fsl_mc_ldpaa_init(bd_t *bis);
|
||||
void fsl_mc_ldpaa_exit(bd_t *bis);
|
||||
#endif
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2014 Freescale Semiconductor Inc.
|
||||
/* Copyright 2013-2015 Freescale Semiconductor Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
@@ -41,9 +41,9 @@ enum mc_cmd_status {
|
||||
|
||||
#define MC_CMD_HDR_CMDID_O 52 /* Command ID field offset */
|
||||
#define MC_CMD_HDR_CMDID_S 12 /* Command ID field size */
|
||||
#define MC_CMD_HDR_AUTHID_O 38 /* Authentication ID field offset */
|
||||
#define MC_CMD_HDR_AUTHID_S 10 /* Authentication ID field size */
|
||||
#define MC_CMD_HDR_STATUS_O 16 /* Status field offset */
|
||||
#define MC_CMD_HDR_TOKEN_O 38 /* Token field offset */
|
||||
#define MC_CMD_HDR_TOKEN_S 10 /* Token field size */
|
||||
#define MC_CMD_HDR_STATUS_S 8 /* Status field size*/
|
||||
#define MC_CMD_HDR_PRI_O 15 /* Priority field offset */
|
||||
#define MC_CMD_HDR_PRI_S 1 /* Priority field size */
|
||||
@@ -52,12 +52,15 @@ enum mc_cmd_status {
|
||||
((enum mc_cmd_status)u64_dec((_hdr), \
|
||||
MC_CMD_HDR_STATUS_O, MC_CMD_HDR_STATUS_S))
|
||||
|
||||
#define MC_CMD_HDR_READ_AUTHID(_hdr) \
|
||||
((uint16_t)u64_dec((_hdr), MC_CMD_HDR_AUTHID_O, MC_CMD_HDR_AUTHID_S))
|
||||
#define MC_CMD_HDR_READ_TOKEN(_hdr) \
|
||||
((uint16_t)u64_dec((_hdr), MC_CMD_HDR_TOKEN_O, MC_CMD_HDR_TOKEN_S))
|
||||
|
||||
#define MC_CMD_PRI_LOW 0 /*!< Low Priority command indication */
|
||||
#define MC_CMD_PRI_HIGH 1 /*!< High Priority command indication */
|
||||
|
||||
#define MC_EXT_OP(_ext, _param, _offset, _width, _type, _arg) \
|
||||
((_ext)[_param] |= u64_enc((_offset), (_width), _arg))
|
||||
|
||||
#define MC_CMD_OP(_cmd, _param, _offset, _width, _type, _arg) \
|
||||
((_cmd).params[_param] |= u64_enc((_offset), (_width), _arg))
|
||||
|
||||
@@ -66,12 +69,12 @@ enum mc_cmd_status {
|
||||
|
||||
static inline uint64_t mc_encode_cmd_header(uint16_t cmd_id,
|
||||
uint8_t priority,
|
||||
uint16_t auth_id)
|
||||
uint16_t token)
|
||||
{
|
||||
uint64_t hdr;
|
||||
|
||||
hdr = u64_enc(MC_CMD_HDR_CMDID_O, MC_CMD_HDR_CMDID_S, cmd_id);
|
||||
hdr |= u64_enc(MC_CMD_HDR_AUTHID_O, MC_CMD_HDR_AUTHID_S, auth_id);
|
||||
hdr |= u64_enc(MC_CMD_HDR_TOKEN_O, MC_CMD_HDR_TOKEN_S, token);
|
||||
hdr |= u64_enc(MC_CMD_HDR_PRI_O, MC_CMD_HDR_PRI_S, priority);
|
||||
hdr |= u64_enc(MC_CMD_HDR_STATUS_O, MC_CMD_HDR_STATUS_S,
|
||||
MC_CMD_STATUS_READY);
|
||||
|
||||
48
include/fsl-mc/fsl_mc_private.h
Normal file
48
include/fsl-mc/fsl_mc_private.h
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Freescale Semiconductor
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#ifndef _FSL_MC_PRIVATE_H_
|
||||
#define _FSL_MC_PRIVATE_H_
|
||||
|
||||
#include <errno.h>
|
||||
#include <malloc.h>
|
||||
#include <asm/io.h>
|
||||
#include <linux/compat.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/stringify.h>
|
||||
|
||||
#include <fsl-mc/fsl_mc_sys.h>
|
||||
#include <fsl-mc/fsl_mc_cmd.h>
|
||||
#include <fsl-mc/fsl_dpbp.h>
|
||||
|
||||
extern struct fsl_mc_io *dflt_mc_io;
|
||||
|
||||
/**
|
||||
* struct dpbp_node - DPBP strucuture
|
||||
* @uint16_t handle: DPBP object handle
|
||||
* @int dpbp_id: DPBP id
|
||||
*/
|
||||
struct fsl_dpbp_obj {
|
||||
uint16_t dpbp_handle;
|
||||
struct dpbp_attr dpbp_attr;
|
||||
};
|
||||
|
||||
extern struct fsl_dpbp_obj *dflt_dpbp;
|
||||
|
||||
/**
|
||||
* struct fsl_dpio_obj - DPIO strucuture
|
||||
* @int dpio_id: DPIO id
|
||||
* @struct qbman_swp *sw_portal: SW portal object
|
||||
*/
|
||||
struct fsl_dpio_obj {
|
||||
int dpio_id;
|
||||
struct qbman_swp *sw_portal; /** SW portal object */
|
||||
};
|
||||
|
||||
extern struct fsl_dpio_obj *dflt_dpio;
|
||||
|
||||
int mc_init(void);
|
||||
#endif /* _FSL_MC_PRIVATE_H_ */
|
||||
87
include/fsl-mc/fsl_qbman_base.h
Normal file
87
include/fsl-mc/fsl_qbman_base.h
Normal file
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Freescale Semiconductor
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#ifndef _FSL_QBMAN_BASE_H
|
||||
#define _FSL_QBMAN_BASE_H
|
||||
|
||||
/* Descriptor for a QBMan instance on the SoC. On partitions/targets that do not
|
||||
* control this QBMan instance, these values may simply be place-holders. The
|
||||
* idea is simply that we be able to distinguish between them, eg. so that SWP
|
||||
* descriptors can identify which QBMan instance they belong to. */
|
||||
struct qbman_block_desc {
|
||||
void *ccsr_reg_bar; /* CCSR register map */
|
||||
int irq_rerr; /* Recoverable error interrupt line */
|
||||
int irq_nrerr; /* Non-recoverable error interrupt line */
|
||||
};
|
||||
|
||||
/* Descriptor for a QBMan software portal, expressed in terms that make sense to
|
||||
* the user context. Ie. on MC, this information is likely to be true-physical,
|
||||
* and instantiated statically at compile-time. On GPP, this information is
|
||||
* likely to be obtained via "discovery" over a partition's "layerscape bus"
|
||||
* (ie. in response to a MC portal command), and would take into account any
|
||||
* virtualisation of the GPP user's address space and/or interrupt numbering. */
|
||||
struct qbman_swp_desc {
|
||||
const struct qbman_block_desc *block; /* The QBMan instance */
|
||||
void *cena_bar; /* Cache-enabled portal register map */
|
||||
void *cinh_bar; /* Cache-inhibited portal register map */
|
||||
};
|
||||
|
||||
/* Driver object for managing a QBMan portal */
|
||||
struct qbman_swp;
|
||||
|
||||
/* Place-holder for FDs, we represent it via the simplest form that we need for
|
||||
* now. Different overlays may be needed to support different options, etc. (It
|
||||
* is impractical to define One True Struct, because the resulting encoding
|
||||
* routines (lots of read-modify-writes) would be worst-case performance whether
|
||||
* or not circumstances required them.)
|
||||
*
|
||||
* Note, as with all data-structures exchanged between software and hardware (be
|
||||
* they located in the portal register map or DMA'd to and from main-memory),
|
||||
* the driver ensures that the caller of the driver API sees the data-structures
|
||||
* in host-endianness. "struct qbman_fd" is no exception. The 32-bit words
|
||||
* contained within this structure are represented in host-endianness, even if
|
||||
* hardware always treats them as little-endian. As such, if any of these fields
|
||||
* are interpreted in a binary (rather than numerical) fashion by hardware
|
||||
* blocks (eg. accelerators), then the user should be careful. We illustrate
|
||||
* with an example;
|
||||
*
|
||||
* Suppose the desired behaviour of an accelerator is controlled by the "frc"
|
||||
* field of the FDs that are sent to it. Suppose also that the behaviour desired
|
||||
* by the user corresponds to an "frc" value which is expressed as the literal
|
||||
* sequence of bytes 0xfe, 0xed, 0xab, and 0xba. So "frc" should be the 32-bit
|
||||
* value in which 0xfe is the first byte and 0xba is the last byte, and as
|
||||
* hardware is little-endian, this amounts to a 32-bit "value" of 0xbaabedfe. If
|
||||
* the software is little-endian also, this can simply be achieved by setting
|
||||
* frc=0xbaabedfe. On the other hand, if software is big-endian, it should set
|
||||
* frc=0xfeedabba! The best away of avoiding trouble with this sort of thing is
|
||||
* to treat the 32-bit words as numerical values, in which the offset of a field
|
||||
* from the beginning of the first byte (as required or generated by hardware)
|
||||
* is numerically encoded by a left-shift (ie. by raising the field to a
|
||||
* corresponding power of 2). Ie. in the current example, software could set
|
||||
* "frc" in the following way, and it would work correctly on both little-endian
|
||||
* and big-endian operation;
|
||||
* fd.frc = (0xfe << 0) | (0xed << 8) | (0xab << 16) | (0xba << 24);
|
||||
*/
|
||||
struct qbman_fd {
|
||||
union {
|
||||
uint32_t words[8];
|
||||
struct qbman_fd_simple {
|
||||
uint32_t addr_lo;
|
||||
uint32_t addr_hi;
|
||||
uint32_t len;
|
||||
/* offset in the MS 16 bits, BPID in the LS 16 bits */
|
||||
uint32_t bpid_offset;
|
||||
uint32_t frc; /* frame context */
|
||||
/* "err", "va", "cbmt", "asal", [...] */
|
||||
uint32_t ctrl;
|
||||
/* flow context */
|
||||
uint32_t flc_lo;
|
||||
uint32_t flc_hi;
|
||||
} simple;
|
||||
};
|
||||
};
|
||||
|
||||
#endif /* !_FSL_QBMAN_BASE_H */
|
||||
175
include/fsl-mc/fsl_qbman_portal.h
Normal file
175
include/fsl-mc/fsl_qbman_portal.h
Normal file
@@ -0,0 +1,175 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Freescale Semiconductor
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#ifndef _FSL_QBMAN_PORTAL_H
|
||||
#define _FSL_QBMAN_PORTAL_H
|
||||
|
||||
#include <fsl-mc/fsl_qbman_base.h>
|
||||
|
||||
/* Create and destroy a functional object representing the given QBMan portal
|
||||
* descriptor. */
|
||||
struct qbman_swp *qbman_swp_init(const struct qbman_swp_desc *);
|
||||
|
||||
/************/
|
||||
/* Dequeues */
|
||||
/************/
|
||||
|
||||
/* See the QBMan driver API documentation for details on the enqueue
|
||||
* mechanisms. NB: the use of a 'ldpaa_' prefix for this type is because it is
|
||||
* primarily used by the "DPIO" layer that sits above (and hides) the QBMan
|
||||
* driver. The structure is defined in the DPIO interface, but to avoid circular
|
||||
* dependencies we just pre/re-declare it here opaquely. */
|
||||
struct ldpaa_dq;
|
||||
|
||||
|
||||
/* ------------------- */
|
||||
/* Pull-mode dequeuing */
|
||||
/* ------------------- */
|
||||
|
||||
struct qbman_pull_desc {
|
||||
uint32_t dont_manipulate_directly[6];
|
||||
};
|
||||
|
||||
/* Clear the contents of a descriptor to default/starting state. */
|
||||
void qbman_pull_desc_clear(struct qbman_pull_desc *);
|
||||
/* If not called, or if called with 'storage' as NULL, the result pull dequeues
|
||||
* will produce results to DQRR. If 'storage' is non-NULL, then results are
|
||||
* produced to the given memory location (using the physical/DMA address which
|
||||
* the caller provides in 'storage_phys'), and 'stash' controls whether or not
|
||||
* those writes to main-memory express a cache-warming attribute. */
|
||||
void qbman_pull_desc_set_storage(struct qbman_pull_desc *,
|
||||
struct ldpaa_dq *storage,
|
||||
dma_addr_t storage_phys,
|
||||
int stash);
|
||||
/* numframes must be between 1 and 16, inclusive */
|
||||
void qbman_pull_desc_set_numframes(struct qbman_pull_desc *, uint8_t numframes);
|
||||
/* token is the value that shows up in the dequeue results that can be used to
|
||||
* detect when the results have been published, and is not really used when
|
||||
* dequeue results go to DQRR. The easiest technique is to zero result "storage"
|
||||
* before issuing a pull dequeue, and use any non-zero 'token' value. */
|
||||
void qbman_pull_desc_set_token(struct qbman_pull_desc *, uint8_t token);
|
||||
/* Exactly one of the following descriptor "actions" should be set. (Calling any
|
||||
* one of these will replace the effect of any prior call to one of these.)
|
||||
* - pull dequeue from the given frame queue (FQ)
|
||||
* - pull dequeue from any FQ in the given work queue (WQ)
|
||||
* - pull dequeue from any FQ in any WQ in the given channel
|
||||
*/
|
||||
void qbman_pull_desc_set_fq(struct qbman_pull_desc *, uint32_t fqid);
|
||||
|
||||
/* Issue the pull dequeue command */
|
||||
int qbman_swp_pull(struct qbman_swp *, struct qbman_pull_desc *);
|
||||
|
||||
/* -------------------------------- */
|
||||
/* Polling DQRR for dequeue results */
|
||||
/* -------------------------------- */
|
||||
|
||||
/* NULL return if there are no unconsumed DQRR entries. Returns a DQRR entry
|
||||
* only once, so repeated calls can return a sequence of DQRR entries, without
|
||||
* requiring they be consumed immediately or in any particular order. */
|
||||
const struct ldpaa_dq *qbman_swp_dqrr_next(struct qbman_swp *);
|
||||
/* Consume DQRR entries previously returned from qbman_swp_dqrr_next(). */
|
||||
void qbman_swp_dqrr_consume(struct qbman_swp *, const struct ldpaa_dq *);
|
||||
|
||||
/* ------------------------------------------------- */
|
||||
/* Polling user-provided storage for dequeue results */
|
||||
/* ------------------------------------------------- */
|
||||
|
||||
/* Only used for user-provided storage of dequeue results, not DQRR. Prior to
|
||||
* being used, the storage must set "oldtoken", so that the driver notices when
|
||||
* hardware has filled it in with results using a "newtoken". NB, for efficiency
|
||||
* purposes, the driver will perform any required endianness conversion to
|
||||
* ensure that the user's dequeue result storage is in host-endian format
|
||||
* (whether or not that is the same as the little-endian format that hardware
|
||||
* DMA'd to the user's storage). As such, once the user has called
|
||||
* qbman_dq_entry_has_newtoken() and been returned a valid dequeue result, they
|
||||
* should not call it again on the same memory location (except of course if
|
||||
* another dequeue command has been executed to produce a new result to that
|
||||
* location).
|
||||
*/
|
||||
void qbman_dq_entry_set_oldtoken(struct ldpaa_dq *,
|
||||
unsigned int num_entries,
|
||||
uint8_t oldtoken);
|
||||
int qbman_dq_entry_has_newtoken(struct qbman_swp *,
|
||||
const struct ldpaa_dq *,
|
||||
uint8_t newtoken);
|
||||
|
||||
/* -------------------------------------------------------- */
|
||||
/* Parsing dequeue entries (DQRR and user-provided storage) */
|
||||
/* -------------------------------------------------------- */
|
||||
|
||||
/* DQRR entries may contain non-dequeue results, ie. notifications */
|
||||
int qbman_dq_entry_is_DQ(const struct ldpaa_dq *);
|
||||
|
||||
/************/
|
||||
/* Enqueues */
|
||||
/************/
|
||||
|
||||
struct qbman_eq_desc {
|
||||
uint32_t dont_manipulate_directly[8];
|
||||
};
|
||||
|
||||
|
||||
/* Clear the contents of a descriptor to default/starting state. */
|
||||
void qbman_eq_desc_clear(struct qbman_eq_desc *);
|
||||
/* Exactly one of the following descriptor "actions" should be set. (Calling
|
||||
* any one of these will replace the effect of any prior call to one of these.)
|
||||
* - enqueue without order-restoration
|
||||
* - enqueue with order-restoration
|
||||
* - fill a hole in the order-restoration sequence, without any enqueue
|
||||
* - advance NESN (Next Expected Sequence Number), without any enqueue
|
||||
* 'respond_success' indicates whether an enqueue response should be DMA'd
|
||||
* after success (otherwise a response is DMA'd only after failure).
|
||||
* 'incomplete' indicates that other fragments of the same 'seqnum' are yet to
|
||||
* be enqueued.
|
||||
*/
|
||||
void qbman_eq_desc_set_no_orp(struct qbman_eq_desc *, int respond_success);
|
||||
void qbman_eq_desc_set_response(struct qbman_eq_desc *,
|
||||
dma_addr_t storage_phys,
|
||||
int stash);
|
||||
/* token is the value that shows up in an enqueue response that can be used to
|
||||
* detect when the results have been published. The easiest technique is to zero
|
||||
* result "storage" before issuing an enqueue, and use any non-zero 'token'
|
||||
* value. */
|
||||
void qbman_eq_desc_set_token(struct qbman_eq_desc *, uint8_t token);
|
||||
/* Exactly one of the following descriptor "targets" should be set. (Calling any
|
||||
* one of these will replace the effect of any prior call to one of these.)
|
||||
* - enqueue to a frame queue
|
||||
* - enqueue to a queuing destination
|
||||
* Note, that none of these will have any affect if the "action" type has been
|
||||
* set to "orp_hole" or "orp_nesn".
|
||||
*/
|
||||
void qbman_eq_desc_set_fq(struct qbman_eq_desc *, uint32_t fqid);
|
||||
void qbman_eq_desc_set_qd(struct qbman_eq_desc *, uint32_t qdid,
|
||||
uint32_t qd_bin, uint32_t qd_prio);
|
||||
|
||||
/* Issue an enqueue command. ('fd' should only be NULL if the "action" of the
|
||||
* descriptor is "orp_hole" or "orp_nesn".) */
|
||||
int qbman_swp_enqueue(struct qbman_swp *, const struct qbman_eq_desc *,
|
||||
const struct qbman_fd *fd);
|
||||
|
||||
/*******************/
|
||||
/* Buffer releases */
|
||||
/*******************/
|
||||
|
||||
struct qbman_release_desc {
|
||||
uint32_t dont_manipulate_directly[1];
|
||||
};
|
||||
|
||||
/* Clear the contents of a descriptor to default/starting state. */
|
||||
void qbman_release_desc_clear(struct qbman_release_desc *);
|
||||
/* Set the ID of the buffer pool to release to */
|
||||
void qbman_release_desc_set_bpid(struct qbman_release_desc *, uint32_t bpid);
|
||||
/* Issue a release command. 'num_buffers' must be less than 8. */
|
||||
int qbman_swp_release(struct qbman_swp *, const struct qbman_release_desc *,
|
||||
const uint64_t *buffers, unsigned int num_buffers);
|
||||
|
||||
/*******************/
|
||||
/* Buffer acquires */
|
||||
/*******************/
|
||||
|
||||
int qbman_swp_acquire(struct qbman_swp *, uint32_t bpid, uint64_t *buffers,
|
||||
unsigned int num_buffers);
|
||||
#endif /* !_FSL_QBMAN_PORTAL_H */
|
||||
Reference in New Issue
Block a user