1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Internal Shared Memory
5 * Definitions for the ISM module
7 * Copyright IBM Corp. 2022
12 #include <linux/workqueue.h>
25 /* Unless we gain unexpected popularity, this limit should hold for a while */
27 #define ISM_NR_DMBS 1920
30 spinlock_t lock; /* protects the ism device */
31 struct list_head list;
35 dma_addr_t sba_dma_addr;
36 DECLARE_BITMAP(sba_bitmap, ISM_NR_DMBS);
37 u8 *sba_client_arr; /* entries are indices into 'clients' array */
38 void *priv[MAX_CLIENTS];
41 dma_addr_t ieq_dma_addr;
47 atomic_t free_clients_cnt;
49 wait_queue_head_t waitq;
62 void (*add)(struct ism_dev *dev);
63 void (*remove)(struct ism_dev *dev);
64 void (*handle_event)(struct ism_dev *dev, struct ism_event *event);
65 /* Parameter dmbemask contains a bit vector with updated DMBEs, if sent
66 * via ism_move_data(). Callback function must handle all active bits
67 * indicated by dmbemask.
69 void (*handle_irq)(struct ism_dev *dev, unsigned int bit, u16 dmbemask);
70 /* Private area - don't touch! */
71 struct work_struct remove_work;
72 struct work_struct add_work;
73 struct ism_dev *tgt_ism;
77 int ism_register_client(struct ism_client *client);
78 int ism_unregister_client(struct ism_client *client);
79 static inline void *ism_get_priv(struct ism_dev *dev,
80 struct ism_client *client) {
81 return dev->priv[client->id];
84 static inline void ism_set_priv(struct ism_dev *dev, struct ism_client *client,
86 dev->priv[client->id] = priv;
89 int ism_register_dmb(struct ism_dev *dev, struct ism_dmb *dmb,
90 struct ism_client *client);
91 int ism_unregister_dmb(struct ism_dev *dev, struct ism_dmb *dmb);
92 int ism_move(struct ism_dev *dev, u64 dmb_tok, unsigned int idx, bool sf,
93 unsigned int offset, void *data, unsigned int size);
94 u8 *ism_get_seid(void);
96 const struct smcd_ops *ism_get_smcd_ops(void);