/* * Mediated virtual PCI serial host device driver * * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. * Author: Neo Jia <cjia@nvidia.com> * Kirti Wankhede <kwankhede@nvidia.com> * * 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. * * Sample driver that creates mdev device that simulates serial port over PCI * card. * */#include<linux/init.h>#include<linux/module.h>#include<linux/device.h>#include<linux/kernel.h>#include<linux/fs.h>#include<linux/poll.h>#include<linux/slab.h>#include<linux/cdev.h>#include<linux/sched.h>#include<linux/wait.h>#include<linux/uuid.h>#include<linux/vfio.h>#include<linux/iommu.h>#include<linux/sysfs.h>#include<linux/ctype.h>#include<linux/file.h>#include<linux/mdev.h>#include<linux/pci.h>#include<linux/serial.h>#include<uapi/linux/serial_reg.h>#include<linux/eventfd.h>/* * #defines */#define VERSION_STRING "0.1"#define DRIVER_AUTHOR "NVIDIA Corporation"#define MTTY_CLASS_NAME "mtty"#define MTTY_NAME "mtty"#define MTTY_STRING_LEN 16#define MTTY_CONFIG_SPACE_SIZE 0xff#define MTTY_IO_BAR_SIZE 0x8#define MTTY_MMIO_BAR_SIZE 0x100000