| 1 | /* |
| 2 | * Copyright 2010-2017 Intel Corporation. |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License, version 2, |
| 6 | * as published by the Free Software Foundation. |
| 7 | * |
| 8 | * This program is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 11 | * General Public License for more details. |
| 12 | * |
| 13 | * Disclaimer: The codes contained in these modules may be specific to |
| 14 | * the Intel Software Development Platform codenamed Knights Ferry, |
| 15 | * and the Intel product codenamed Knights Corner, and are not backward |
| 16 | * compatible with other Intel products. Additionally, Intel will NOT |
| 17 | * support the codes or instruction set in future products. |
| 18 | * |
| 19 | * Intel offers no warranty of any kind regarding the code. This code is |
| 20 | * licensed on an "AS IS" basis and Intel is not obligated to provide |
| 21 | * any support, assistance, installation, training, or other services |
| 22 | * of any kind. Intel is also not obligated to provide any updates, |
| 23 | * enhancements or extensions. Intel specifically disclaims any warranty |
| 24 | * of merchantability, non-infringement, fitness for any particular |
| 25 | * purpose, and any other warranty. |
| 26 | * |
| 27 | * Further, Intel disclaims all liability of any kind, including but |
| 28 | * not limited to liability for infringement of any proprietary rights, |
| 29 | * relating to the use of the code, even if Intel is notified of the |
| 30 | * possibility of such liability. Except as expressly stated in an Intel |
| 31 | * license agreement provided with this code and agreed upon with Intel, |
| 32 | * no license, express or implied, by estoppel or otherwise, to any |
| 33 | * intellectual property rights is granted herein. |
| 34 | */ |
| 35 | |
| 36 | #ifndef MICINT_H |
| 37 | #define MICINT_H |
| 38 | |
| 39 | #include <linux/module.h> |
| 40 | #include <linux/kernel.h> |
| 41 | #include <linux/types.h> |
| 42 | #include <linux/init.h> |
| 43 | #include <linux/moduleparam.h> |
| 44 | #include <linux/fs.h> |
| 45 | #include <linux/major.h> |
| 46 | #include <linux/blkdev.h> |
| 47 | #include <linux/capability.h> |
| 48 | #include <linux/uio.h> |
| 49 | #include <linux/cdev.h> |
| 50 | #include <linux/device.h> |
| 51 | #include <linux/mutex.h> |
| 52 | #include <linux/spinlock.h> |
| 53 | #include <linux/pci.h> |
| 54 | #include <linux/version.h> |
| 55 | #include <asm/io.h> |
| 56 | #include <asm/ioctl.h> |
| 57 | #include <asm/uaccess.h> |
| 58 | #include <linux/netdevice.h> |
| 59 | #include <linux/etherdevice.h> |
| 60 | #include <linux/rtnetlink.h> |
| 61 | #include <net/rtnetlink.h> |
| 62 | #include <linux/pm.h> |
| 63 | #include <linux/notifier.h> |
| 64 | #include <linux/suspend.h> |
| 65 | #include <linux/ctype.h> |
| 66 | #include <linux/sysfs.h> |
| 67 | |
| 68 | #include "mic_common.h" |
| 69 | #include <mic/micscif.h> |
| 70 | |
| 71 | #define MAX_DLDR_MINORS 68 |
| 72 | typedef struct mic_lindata { |
| 73 | dev_t dd_dev; |
| 74 | struct cdev dd_cdev; |
| 75 | struct device *dd_hostdev; |
| 76 | struct device *dd_scifdev; |
| 77 | struct class *dd_class; |
| 78 | struct pci_driver dd_pcidriver; |
| 79 | }mic_lindata_t; |
| 80 | |
| 81 | typedef struct board_info { |
| 82 | struct device *bi_sysfsdev; |
| 83 | #ifdef CONFIG_PCI_MSI |
| 84 | struct msix_entry bi_msix_entries[MIC_NUM_MSIX_ENTRIES]; |
| 85 | #endif |
| 86 | #ifdef USE_VCONSOLE |
| 87 | micvcons_port_t *bi_port; |
| 88 | #endif |
| 89 | void *bi_virtio; /* for virtio */ |
| 90 | |
| 91 | struct list_head bi_list; |
| 92 | mic_ctx_t bi_ctx; |
| 93 | } bd_info_t; |
| 94 | |
| 95 | extern mic_lindata_t mic_lindata; |
| 96 | |
| 97 | #ifdef USE_VCONSOLE |
| 98 | int micvcons_create(int num_bds); |
| 99 | void micvcons_destroy(int num_bds); |
| 100 | #endif |
| 101 | |
| 102 | int micpm_suspend(struct device *pdev); |
| 103 | int micpm_resume(struct device *pdev); |
| 104 | int micpm_suspend_noirq(struct device *pdev); |
| 105 | int micpm_resume_noirq(struct device *pdev); |
| 106 | int micpm_notifier_block(struct notifier_block *nb, unsigned long event, void *dummy); |
| 107 | irqreturn_t mic_irq_isr(int irq, void *data); |
| 108 | |
| 109 | int mic_psmi_init(mic_ctx_t *mic_ctx); |
| 110 | void mic_psmi_uninit(mic_ctx_t *mic_ctx); |
| 111 | |
| 112 | void set_sysfs_entries(mic_ctx_t *mic_ctx); |
| 113 | void free_sysfs_entries(mic_ctx_t *mic_ctx); |
| 114 | #endif // MICINT_H |