From d7ac0204c65b576978354f3767e8a8f29211424d Mon Sep 17 00:00:00 2001 From: Marcin Chrzanowski Date: Fri, 18 May 2018 14:23:53 +0200 Subject: Define private surface data --- char.h | 1 + harddoomdev.c | 1 + pci.c | 1 + pci.h | 8 -------- private_data.h | 26 ++++++++++++++++++++++++++ surface.c | 1 + util.h | 1 - 7 files changed, 30 insertions(+), 9 deletions(-) create mode 100644 private_data.h diff --git a/char.h b/char.h index a708023..63152a1 100644 --- a/char.h +++ b/char.h @@ -4,6 +4,7 @@ #include #include "pci.h" +#include "private_data.h" int new_doomdev(struct pci_dev *dev); void destroy_doomdev(struct doom_data *doom_data); diff --git a/harddoomdev.c b/harddoomdev.c index f903b10..00ef6f7 100644 --- a/harddoomdev.c +++ b/harddoomdev.c @@ -3,6 +3,7 @@ #include "harddoom.h" #include "doomcode.h" #include "pci.h" +#include "private_data.h" void doomdev_write(void __iomem *iomem, size_t addr, uint32_t data) { diff --git a/pci.c b/pci.c index 833a72e..e4cfde6 100644 --- a/pci.c +++ b/pci.c @@ -7,6 +7,7 @@ #include "harddoom.h" #include "util.h" #include "harddoomdev.h" +#include "private_data.h" int init_pci(struct pci_dev *dev) { struct doom_data *doom_data; diff --git a/pci.h b/pci.h index 9386703..377530e 100644 --- a/pci.h +++ b/pci.h @@ -1,14 +1,6 @@ #ifndef PCI_H #define PCI_H -#include - -struct doom_data { - struct cdev *cdev; - struct device *device; - void __iomem *iomem; -}; - int pci_init(void); void pci_cleanup(void); diff --git a/private_data.h b/private_data.h new file mode 100644 index 0000000..38148bd --- /dev/null +++ b/private_data.h @@ -0,0 +1,26 @@ +#ifndef PRIVATE_DATA_H +#define PRIVATE_DATA_H + +#include +#include + +struct doom_data { + struct cdev cdev; + struct device *device; + struct device *pci_device; + void __iomem *iomem; +}; + +struct surface_data { + struct doom_data *doom_data; + + int surface_size; + int pages; + + uint8_t *surface_cpu; + uint32_t *page_table_cpu; + dma_addr_t surface_dev; + dma_addr_t page_table_dev; +}; + +#endif diff --git a/surface.c b/surface.c index 8400e3f..7dd4793 100644 --- a/surface.c +++ b/surface.c @@ -2,6 +2,7 @@ #include #include +#include "private_data.h" #include "surface.h" long surface_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) diff --git a/util.h b/util.h index 7a64462..8c56f67 100644 --- a/util.h +++ b/util.h @@ -16,6 +16,5 @@ goto label; \ } \ }) - #endif -- cgit v1.2.3