#include <linux/bitops.h>
#include <linux/debugfs.h>
#include <linux/dma-mapping.h>
#include <linux/dmaengine.h>
#include <linux/list.h>
#include <linux/mailbox_client.h>
#include <linux/mailbox/brcm-message.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/raid/pq.h>
#include "dmaengine.h"
#define SBA_TYPE_SHIFT …
#define SBA_TYPE_MASK …
#define SBA_TYPE_A …
#define SBA_TYPE_B …
#define SBA_TYPE_C …
#define SBA_USER_DEF_SHIFT …
#define SBA_USER_DEF_MASK …
#define SBA_R_MDATA_SHIFT …
#define SBA_R_MDATA_MASK …
#define SBA_C_MDATA_MS_SHIFT …
#define SBA_C_MDATA_MS_MASK …
#define SBA_INT_SHIFT …
#define SBA_INT_MASK …
#define SBA_RESP_SHIFT …
#define SBA_RESP_MASK …
#define SBA_C_MDATA_SHIFT …
#define SBA_C_MDATA_MASK …
#define SBA_C_MDATA_BNUMx_SHIFT(__bnum) …
#define SBA_C_MDATA_BNUMx_MASK …
#define SBA_C_MDATA_DNUM_SHIFT …
#define SBA_C_MDATA_DNUM_MASK …
#define SBA_C_MDATA_LS(__v) …
#define SBA_C_MDATA_MS(__v) …
#define SBA_CMD_SHIFT …
#define SBA_CMD_MASK …
#define SBA_CMD_ZERO_BUFFER …
#define SBA_CMD_ZERO_ALL_BUFFERS …
#define SBA_CMD_LOAD_BUFFER …
#define SBA_CMD_XOR …
#define SBA_CMD_GALOIS_XOR …
#define SBA_CMD_WRITE_BUFFER …
#define SBA_CMD_GALOIS …
#define SBA_MAX_REQ_PER_MBOX_CHANNEL …
#define SBA_MAX_MSG_SEND_PER_MBOX_CHANNEL …
#define to_sba_request(tx) …
#define to_sba_device(dchan) …
enum sba_request_flags { … };
struct sba_request { … };
enum sba_version { … };
struct sba_device { … };
static inline u64 __pure sba_cmd_enc(u64 cmd, u32 val, u32 shift, u32 mask)
{ … }
static inline u32 __pure sba_cmd_load_c_mdata(u32 b0)
{ … }
static inline u32 __pure sba_cmd_write_c_mdata(u32 b0)
{ … }
static inline u32 __pure sba_cmd_xor_c_mdata(u32 b1, u32 b0)
{ … }
static inline u32 __pure sba_cmd_pq_c_mdata(u32 d, u32 b1, u32 b0)
{ … }
static struct sba_request *sba_alloc_request(struct sba_device *sba)
{ … }
static void _sba_pending_request(struct sba_device *sba,
struct sba_request *req)
{ … }
static bool _sba_active_request(struct sba_device *sba,
struct sba_request *req)
{ … }
static void _sba_abort_request(struct sba_device *sba,
struct sba_request *req)
{ … }
static void _sba_free_request(struct sba_device *sba,
struct sba_request *req)
{ … }
static void sba_free_chained_requests(struct sba_request *req)
{ … }
static void sba_chain_request(struct sba_request *first,
struct sba_request *req)
{ … }
static void sba_cleanup_nonpending_requests(struct sba_device *sba)
{ … }
static void sba_cleanup_pending_requests(struct sba_device *sba)
{ … }
static int sba_send_mbox_request(struct sba_device *sba,
struct sba_request *req)
{ … }
static void _sba_process_pending_requests(struct sba_device *sba)
{ … }
static void sba_process_received_request(struct sba_device *sba,
struct sba_request *req)
{ … }
static void sba_write_stats_in_seqfile(struct sba_device *sba,
struct seq_file *file)
{ … }
static void sba_free_chan_resources(struct dma_chan *dchan)
{ … }
static int sba_device_terminate_all(struct dma_chan *dchan)
{ … }
static void sba_issue_pending(struct dma_chan *dchan)
{ … }
static dma_cookie_t sba_tx_submit(struct dma_async_tx_descriptor *tx)
{ … }
static enum dma_status sba_tx_status(struct dma_chan *dchan,
dma_cookie_t cookie,
struct dma_tx_state *txstate)
{ … }
static void sba_fillup_interrupt_msg(struct sba_request *req,
struct brcm_sba_command *cmds,
struct brcm_message *msg)
{ … }
static struct dma_async_tx_descriptor *
sba_prep_dma_interrupt(struct dma_chan *dchan, unsigned long flags)
{ … }
static void sba_fillup_memcpy_msg(struct sba_request *req,
struct brcm_sba_command *cmds,
struct brcm_message *msg,
dma_addr_t msg_offset, size_t msg_len,
dma_addr_t dst, dma_addr_t src)
{ … }
static struct sba_request *
sba_prep_dma_memcpy_req(struct sba_device *sba,
dma_addr_t off, dma_addr_t dst, dma_addr_t src,
size_t len, unsigned long flags)
{ … }
static struct dma_async_tx_descriptor *
sba_prep_dma_memcpy(struct dma_chan *dchan, dma_addr_t dst, dma_addr_t src,
size_t len, unsigned long flags)
{ … }
static void sba_fillup_xor_msg(struct sba_request *req,
struct brcm_sba_command *cmds,
struct brcm_message *msg,
dma_addr_t msg_offset, size_t msg_len,
dma_addr_t dst, dma_addr_t *src, u32 src_cnt)
{ … }
static struct sba_request *
sba_prep_dma_xor_req(struct sba_device *sba,
dma_addr_t off, dma_addr_t dst, dma_addr_t *src,
u32 src_cnt, size_t len, unsigned long flags)
{ … }
static struct dma_async_tx_descriptor *
sba_prep_dma_xor(struct dma_chan *dchan, dma_addr_t dst, dma_addr_t *src,
u32 src_cnt, size_t len, unsigned long flags)
{ … }
static void sba_fillup_pq_msg(struct sba_request *req,
bool pq_continue,
struct brcm_sba_command *cmds,
struct brcm_message *msg,
dma_addr_t msg_offset, size_t msg_len,
dma_addr_t *dst_p, dma_addr_t *dst_q,
const u8 *scf, dma_addr_t *src, u32 src_cnt)
{ … }
static struct sba_request *
sba_prep_dma_pq_req(struct sba_device *sba, dma_addr_t off,
dma_addr_t *dst_p, dma_addr_t *dst_q, dma_addr_t *src,
u32 src_cnt, const u8 *scf, size_t len, unsigned long flags)
{ … }
static void sba_fillup_pq_single_msg(struct sba_request *req,
bool pq_continue,
struct brcm_sba_command *cmds,
struct brcm_message *msg,
dma_addr_t msg_offset, size_t msg_len,
dma_addr_t *dst_p, dma_addr_t *dst_q,
dma_addr_t src, u8 scf)
{ … }
static struct sba_request *
sba_prep_dma_pq_single_req(struct sba_device *sba, dma_addr_t off,
dma_addr_t *dst_p, dma_addr_t *dst_q,
dma_addr_t src, u8 scf, size_t len,
unsigned long flags)
{ … }
static struct dma_async_tx_descriptor *
sba_prep_dma_pq(struct dma_chan *dchan, dma_addr_t *dst, dma_addr_t *src,
u32 src_cnt, const u8 *scf, size_t len, unsigned long flags)
{ … }
static void sba_receive_message(struct mbox_client *cl, void *msg)
{ … }
static int sba_debugfs_stats_show(struct seq_file *file, void *offset)
{ … }
static int sba_prealloc_channel_resources(struct sba_device *sba)
{ … }
static void sba_freeup_channel_resources(struct sba_device *sba)
{ … }
static int sba_async_register(struct sba_device *sba)
{ … }
static int sba_probe(struct platform_device *pdev)
{ … }
static void sba_remove(struct platform_device *pdev)
{ … }
static const struct of_device_id sba_of_match[] = …;
MODULE_DEVICE_TABLE(of, sba_of_match);
static struct platform_driver sba_driver = …;
module_platform_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;