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 v3.16-rc3 134 lines 3.9 kB view raw
1/* 2 * Intel MIC Platform Software Stack (MPSS) 3 * 4 * Copyright(c) 2013 Intel Corporation. 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License, version 2, as 8 * published by the Free Software Foundation. 9 * 10 * This program is distributed in the hope that it will be useful, but 11 * WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * General Public License for more details. 14 * 15 * The full GNU General Public License is included in this distribution in 16 * the file called "COPYING". 17 * 18 * Disclaimer: The codes contained in these modules may be specific to 19 * the Intel Software Development Platform codenamed: Knights Ferry, and 20 * the Intel product codenamed: Knights Corner, and are not backward 21 * compatible with other Intel products. Additionally, Intel will NOT 22 * support the codes or instruction set in future products. 23 * 24 * Intel MIC Card driver. 25 * 26 */ 27#ifndef _MIC_CARD_DEVICE_H_ 28#define _MIC_CARD_DEVICE_H_ 29 30#include <linux/workqueue.h> 31#include <linux/io.h> 32#include <linux/irqreturn.h> 33 34/** 35 * struct mic_intr_info - Contains h/w specific interrupt sources info 36 * 37 * @num_intr: The number of irqs available 38 */ 39struct mic_intr_info { 40 u32 num_intr; 41}; 42 43/** 44 * struct mic_irq_info - OS specific irq information 45 * 46 * @irq_usage_count: usage count array tracking the number of sources 47 * assigned for each irq. 48 */ 49struct mic_irq_info { 50 int *irq_usage_count; 51}; 52 53/** 54 * struct mic_device - MIC device information. 55 * 56 * @mmio: MMIO bar information. 57 */ 58struct mic_device { 59 struct mic_mw mmio; 60}; 61 62/** 63 * struct mic_driver - MIC card driver information. 64 * 65 * @name: Name for MIC driver. 66 * @dbg_dir: debugfs directory of this MIC device. 67 * @dev: The device backing this MIC. 68 * @dp: The pointer to the virtio device page. 69 * @mdev: MIC device information for the host. 70 * @hotplug_work: Hot plug work for adding/removing virtio devices. 71 * @irq_info: The OS specific irq information 72 * @intr_info: H/W specific interrupt information. 73 */ 74struct mic_driver { 75 char name[20]; 76 struct dentry *dbg_dir; 77 struct device *dev; 78 void __iomem *dp; 79 struct mic_device mdev; 80 struct work_struct hotplug_work; 81 struct mic_irq_info irq_info; 82 struct mic_intr_info intr_info; 83}; 84 85/** 86 * struct mic_irq - opaque pointer used as cookie 87 */ 88struct mic_irq; 89 90/** 91 * mic_mmio_read - read from an MMIO register. 92 * @mw: MMIO register base virtual address. 93 * @offset: register offset. 94 * 95 * RETURNS: register value. 96 */ 97static inline u32 mic_mmio_read(struct mic_mw *mw, u32 offset) 98{ 99 return ioread32(mw->va + offset); 100} 101 102/** 103 * mic_mmio_write - write to an MMIO register. 104 * @mw: MMIO register base virtual address. 105 * @val: the data value to put into the register 106 * @offset: register offset. 107 * 108 * RETURNS: none. 109 */ 110static inline void 111mic_mmio_write(struct mic_mw *mw, u32 val, u32 offset) 112{ 113 iowrite32(val, mw->va + offset); 114} 115 116int mic_driver_init(struct mic_driver *mdrv); 117void mic_driver_uninit(struct mic_driver *mdrv); 118int mic_next_card_db(void); 119struct mic_irq *mic_request_card_irq(irqreturn_t (*func)(int irq, void *data), 120 const char *name, void *data, int intr_src); 121void mic_free_card_irq(struct mic_irq *cookie, void *data); 122u32 mic_read_spad(struct mic_device *mdev, unsigned int idx); 123void mic_send_intr(struct mic_device *mdev, int doorbell); 124int mic_db_to_irq(struct mic_driver *mdrv, int db); 125u32 mic_ack_interrupt(struct mic_device *mdev); 126void mic_hw_intr_init(struct mic_driver *mdrv); 127void __iomem * 128mic_card_map(struct mic_device *mdev, dma_addr_t addr, size_t size); 129void mic_card_unmap(struct mic_device *mdev, void __iomem *addr); 130void __init mic_create_card_debug_dir(struct mic_driver *mdrv); 131void mic_delete_card_debug_dir(struct mic_driver *mdrv); 132void __init mic_init_card_debugfs(void); 133void mic_exit_card_debugfs(void); 134#endif