2 * Intel MIC Platform Software Stack (MPSS)
4 * Copyright(c) 2013 Intel Corporation.
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.
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.
15 * The full GNU General Public License is included in this distribution in
16 * the file called "COPYING".
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.
24 * Intel MIC Card driver.
27 #ifndef __MIC_CARD_VIRTIO_H
28 #define __MIC_CARD_VIRTIO_H
30 #include <linux/mic_common.h>
31 #include "mic_device.h"
37 #define ioread64 readq
40 #define iowrite64 writeq
43 static inline unsigned mic_desc_size(struct mic_device_desc __iomem
*desc
)
46 + ioread8(&desc
->num_vq
) * sizeof(struct mic_vqconfig
)
47 + ioread8(&desc
->feature_len
) * 2
48 + ioread8(&desc
->config_len
);
51 static inline struct mic_vqconfig __iomem
*
52 mic_vq_config(struct mic_device_desc __iomem
*desc
)
54 return (struct mic_vqconfig __iomem
*)(desc
+ 1);
57 static inline __u8 __iomem
*
58 mic_vq_features(struct mic_device_desc __iomem
*desc
)
60 return (__u8 __iomem
*)(mic_vq_config(desc
) + ioread8(&desc
->num_vq
));
63 static inline __u8 __iomem
*
64 mic_vq_configspace(struct mic_device_desc __iomem
*desc
)
66 return mic_vq_features(desc
) + ioread8(&desc
->feature_len
) * 2;
68 static inline unsigned mic_total_desc_size(struct mic_device_desc __iomem
*desc
)
70 return mic_aligned_desc_size(desc
) + sizeof(struct mic_device_ctrl
);
73 int mic_devices_init(struct mic_driver
*mdrv
);
74 void mic_devices_uninit(struct mic_driver
*mdrv
);