mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-27 11:45:01 +07:00
5299709d0a
Most dma_map_ops structures are never modified. Constify these structures such that these can be write-protected. This patch has been generated as follows: git grep -l 'struct dma_map_ops' | xargs -d\\n sed -i \ -e 's/struct dma_map_ops/const struct dma_map_ops/g' \ -e 's/const struct dma_map_ops {/struct dma_map_ops {/g' \ -e 's/^const struct dma_map_ops;$/struct dma_map_ops;/' \ -e 's/const const struct dma_map_ops /const struct dma_map_ops /g'; sed -i -e 's/const \(struct dma_map_ops intel_dma_ops\)/\1/' \ $(git grep -l 'struct dma_map_ops intel_dma_ops'); sed -i -e 's/const \(struct dma_map_ops dma_iommu_ops\)/\1/' \ $(git grep -l 'struct dma_map_ops' | grep ^arch/powerpc); sed -i -e '/^struct vmd_dev {$/,/^};$/ s/const \(struct dma_map_ops[[:blank:]]dma_ops;\)/\1/' \ -e '/^static void vmd_setup_dma_ops/,/^}$/ s/const \(struct dma_map_ops \*dest\)/\1/' \ -e 's/const \(struct dma_map_ops \*dest = \&vmd->dma_ops\)/\1/' \ drivers/pci/host/*.c sed -i -e '/^void __init pci_iommu_alloc(void)$/,/^}$/ s/dma_ops->/intel_dma_ops./' arch/ia64/kernel/pci-dma.c sed -i -e 's/static const struct dma_map_ops sn_dma_ops/static struct dma_map_ops sn_dma_ops/' arch/ia64/sn/pci/pci_dma.c sed -i -e 's/(const struct dma_map_ops \*)//' drivers/misc/mic/bus/vop_bus.c Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com> Cc: David Woodhouse <dwmw2@infradead.org> Cc: Juergen Gross <jgross@suse.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: linux-arch@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: Russell King <linux@armlinux.org.uk> Cc: x86@kernel.org Signed-off-by: Doug Ledford <dledford@redhat.com>
134 lines
4.4 KiB
C
134 lines
4.4 KiB
C
/*
|
|
* Intel MIC Platform Software Stack (MPSS)
|
|
*
|
|
* Copyright(c) 2014 Intel Corporation.
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License, version 2, as
|
|
* published by the Free Software Foundation.
|
|
*
|
|
* This program is distributed in the hope that it will be useful, but
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* General Public License for more details.
|
|
*
|
|
* Intel Symmetric Communications Interface Bus driver.
|
|
*/
|
|
#ifndef _SCIF_BUS_H_
|
|
#define _SCIF_BUS_H_
|
|
/*
|
|
* Everything a scif driver needs to work with any particular scif
|
|
* hardware abstraction layer.
|
|
*/
|
|
#include <linux/dma-mapping.h>
|
|
|
|
#include <linux/mic_common.h>
|
|
#include "../common/mic_dev.h"
|
|
|
|
struct scif_hw_dev_id {
|
|
u32 device;
|
|
u32 vendor;
|
|
};
|
|
|
|
#define MIC_SCIF_DEV 1
|
|
#define SCIF_DEV_ANY_ID 0xffffffff
|
|
|
|
/**
|
|
* scif_hw_dev - representation of a hardware device abstracted for scif
|
|
* @hw_ops: the hardware ops supported by this device
|
|
* @id: the device type identification (used to match it with a driver)
|
|
* @mmio: MMIO memory window
|
|
* @aper: Aperture memory window
|
|
* @dev: underlying device
|
|
* @dnode - The destination node which this device will communicate with.
|
|
* @snode - The source node for this device.
|
|
* @dp - Self device page
|
|
* @rdp - Remote device page
|
|
* @dma_ch - Array of DMA channels
|
|
* @num_dma_ch - Number of DMA channels available
|
|
* @card_rel_da - Set to true if DMA addresses programmed in the DMA engine
|
|
* are relative to the card point of view
|
|
*/
|
|
struct scif_hw_dev {
|
|
struct scif_hw_ops *hw_ops;
|
|
struct scif_hw_dev_id id;
|
|
struct mic_mw *mmio;
|
|
struct mic_mw *aper;
|
|
struct device dev;
|
|
u8 dnode;
|
|
u8 snode;
|
|
void *dp;
|
|
void __iomem *rdp;
|
|
struct dma_chan **dma_ch;
|
|
int num_dma_ch;
|
|
bool card_rel_da;
|
|
};
|
|
|
|
/**
|
|
* scif_driver - operations for a scif I/O driver
|
|
* @driver: underlying device driver (populate name and owner).
|
|
* @id_table: the ids serviced by this driver.
|
|
* @probe: the function to call when a device is found. Returns 0 or -errno.
|
|
* @remove: the function to call when a device is removed.
|
|
*/
|
|
struct scif_driver {
|
|
struct device_driver driver;
|
|
const struct scif_hw_dev_id *id_table;
|
|
int (*probe)(struct scif_hw_dev *dev);
|
|
void (*remove)(struct scif_hw_dev *dev);
|
|
};
|
|
|
|
/**
|
|
* scif_hw_ops - Hardware operations for accessing a SCIF device on the SCIF bus.
|
|
*
|
|
* @next_db: Obtain the next available doorbell.
|
|
* @request_irq: Request an interrupt on a particular doorbell.
|
|
* @free_irq: Free an interrupt requested previously.
|
|
* @ack_interrupt: acknowledge an interrupt in the ISR.
|
|
* @send_intr: Send an interrupt to the remote node on a specified doorbell.
|
|
* @send_p2p_intr: Send an interrupt to the peer node on a specified doorbell
|
|
* which is specifically targeted for a peer to peer node.
|
|
* @ioremap: Map a buffer with the specified physical address and length.
|
|
* @iounmap: Unmap a buffer previously mapped.
|
|
*/
|
|
struct scif_hw_ops {
|
|
int (*next_db)(struct scif_hw_dev *sdev);
|
|
struct mic_irq * (*request_irq)(struct scif_hw_dev *sdev,
|
|
irqreturn_t (*func)(int irq,
|
|
void *data),
|
|
const char *name, void *data,
|
|
int db);
|
|
void (*free_irq)(struct scif_hw_dev *sdev,
|
|
struct mic_irq *cookie, void *data);
|
|
void (*ack_interrupt)(struct scif_hw_dev *sdev, int num);
|
|
void (*send_intr)(struct scif_hw_dev *sdev, int db);
|
|
void (*send_p2p_intr)(struct scif_hw_dev *sdev, int db,
|
|
struct mic_mw *mw);
|
|
void __iomem * (*ioremap)(struct scif_hw_dev *sdev,
|
|
phys_addr_t pa, size_t len);
|
|
void (*iounmap)(struct scif_hw_dev *sdev, void __iomem *va);
|
|
};
|
|
|
|
int scif_register_driver(struct scif_driver *driver);
|
|
void scif_unregister_driver(struct scif_driver *driver);
|
|
struct scif_hw_dev *
|
|
scif_register_device(struct device *pdev, int id,
|
|
const struct dma_map_ops *dma_ops,
|
|
struct scif_hw_ops *hw_ops, u8 dnode, u8 snode,
|
|
struct mic_mw *mmio, struct mic_mw *aper,
|
|
void *dp, void __iomem *rdp,
|
|
struct dma_chan **chan, int num_chan,
|
|
bool card_rel_da);
|
|
void scif_unregister_device(struct scif_hw_dev *sdev);
|
|
|
|
static inline struct scif_hw_dev *dev_to_scif(struct device *dev)
|
|
{
|
|
return container_of(dev, struct scif_hw_dev, dev);
|
|
}
|
|
|
|
static inline struct scif_driver *drv_to_scif(struct device_driver *drv)
|
|
{
|
|
return container_of(drv, struct scif_driver, driver);
|
|
}
|
|
#endif /* _SCIF_BUS_H */
|