Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v5.7-rc6 125 lines 4.1 kB view raw
1/* SPDX-License-Identifier: GPL-2.0-only */ 2/* 3 * Intel MIC Platform Software Stack (MPSS) 4 * 5 * Copyright(c) 2014 Intel Corporation. 6 * 7 * Intel Symmetric Communications Interface Bus driver. 8 */ 9#ifndef _SCIF_BUS_H_ 10#define _SCIF_BUS_H_ 11/* 12 * Everything a scif driver needs to work with any particular scif 13 * hardware abstraction layer. 14 */ 15#include <linux/dma-mapping.h> 16 17#include <linux/mic_common.h> 18#include "../common/mic_dev.h" 19 20struct scif_hw_dev_id { 21 u32 device; 22 u32 vendor; 23}; 24 25#define MIC_SCIF_DEV 1 26#define SCIF_DEV_ANY_ID 0xffffffff 27 28/** 29 * scif_hw_dev - representation of a hardware device abstracted for scif 30 * @hw_ops: the hardware ops supported by this device 31 * @id: the device type identification (used to match it with a driver) 32 * @mmio: MMIO memory window 33 * @aper: Aperture memory window 34 * @dev: underlying device 35 * @dnode - The destination node which this device will communicate with. 36 * @snode - The source node for this device. 37 * @dp - Self device page 38 * @rdp - Remote device page 39 * @dma_ch - Array of DMA channels 40 * @num_dma_ch - Number of DMA channels available 41 * @card_rel_da - Set to true if DMA addresses programmed in the DMA engine 42 * are relative to the card point of view 43 */ 44struct scif_hw_dev { 45 struct scif_hw_ops *hw_ops; 46 struct scif_hw_dev_id id; 47 struct mic_mw *mmio; 48 struct mic_mw *aper; 49 struct device dev; 50 u8 dnode; 51 u8 snode; 52 void *dp; 53 void __iomem *rdp; 54 struct dma_chan **dma_ch; 55 int num_dma_ch; 56 bool card_rel_da; 57}; 58 59/** 60 * scif_driver - operations for a scif I/O driver 61 * @driver: underlying device driver (populate name and owner). 62 * @id_table: the ids serviced by this driver. 63 * @probe: the function to call when a device is found. Returns 0 or -errno. 64 * @remove: the function to call when a device is removed. 65 */ 66struct scif_driver { 67 struct device_driver driver; 68 const struct scif_hw_dev_id *id_table; 69 int (*probe)(struct scif_hw_dev *dev); 70 void (*remove)(struct scif_hw_dev *dev); 71}; 72 73/** 74 * scif_hw_ops - Hardware operations for accessing a SCIF device on the SCIF bus. 75 * 76 * @next_db: Obtain the next available doorbell. 77 * @request_irq: Request an interrupt on a particular doorbell. 78 * @free_irq: Free an interrupt requested previously. 79 * @ack_interrupt: acknowledge an interrupt in the ISR. 80 * @send_intr: Send an interrupt to the remote node on a specified doorbell. 81 * @send_p2p_intr: Send an interrupt to the peer node on a specified doorbell 82 * which is specifically targeted for a peer to peer node. 83 * @remap: Map a buffer with the specified physical address and length. 84 * @unmap: Unmap a buffer previously mapped. 85 */ 86struct scif_hw_ops { 87 int (*next_db)(struct scif_hw_dev *sdev); 88 struct mic_irq * (*request_irq)(struct scif_hw_dev *sdev, 89 irqreturn_t (*func)(int irq, 90 void *data), 91 const char *name, void *data, 92 int db); 93 void (*free_irq)(struct scif_hw_dev *sdev, 94 struct mic_irq *cookie, void *data); 95 void (*ack_interrupt)(struct scif_hw_dev *sdev, int num); 96 void (*send_intr)(struct scif_hw_dev *sdev, int db); 97 void (*send_p2p_intr)(struct scif_hw_dev *sdev, int db, 98 struct mic_mw *mw); 99 void __iomem * (*remap)(struct scif_hw_dev *sdev, 100 phys_addr_t pa, size_t len); 101 void (*unmap)(struct scif_hw_dev *sdev, void __iomem *va); 102}; 103 104int scif_register_driver(struct scif_driver *driver); 105void scif_unregister_driver(struct scif_driver *driver); 106struct scif_hw_dev * 107scif_register_device(struct device *pdev, int id, 108 const struct dma_map_ops *dma_ops, 109 struct scif_hw_ops *hw_ops, u8 dnode, u8 snode, 110 struct mic_mw *mmio, struct mic_mw *aper, 111 void *dp, void __iomem *rdp, 112 struct dma_chan **chan, int num_chan, 113 bool card_rel_da); 114void scif_unregister_device(struct scif_hw_dev *sdev); 115 116static inline struct scif_hw_dev *dev_to_scif(struct device *dev) 117{ 118 return container_of(dev, struct scif_hw_dev, dev); 119} 120 121static inline struct scif_driver *drv_to_scif(struct device_driver *drv) 122{ 123 return container_of(drv, struct scif_driver, driver); 124} 125#endif /* _SCIF_BUS_H */