Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F102933657
D24696.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D24696.id.diff
View Options
Index: head/sys/compat/linuxkpi/common/include/linux/pci.h
===================================================================
--- head/sys/compat/linuxkpi/common/include/linux/pci.h
+++ head/sys/compat/linuxkpi/common/include/linux/pci.h
@@ -222,6 +222,13 @@
#define __devexit_p(x) x
+struct pci_mmio_region {
+ TAILQ_ENTRY(pci_mmio_region) next;
+ struct resource *res;
+ int rid;
+ int type;
+};
+
struct pci_dev {
struct device dev;
struct list_head links;
@@ -236,6 +243,8 @@
uint32_t class;
uint8_t revision;
bool msi_enabled;
+
+ TAILQ_HEAD(, pci_mmio_region) mmio;
};
static inline struct resource_list_entry *
@@ -657,6 +666,41 @@
}
static inline void pci_disable_sriov(struct pci_dev *dev)
{
+}
+
+static inline void *
+pci_iomap(struct pci_dev *dev, int mmio_bar, int mmio_size __unused)
+{
+ struct pci_mmio_region *mmio;
+
+ mmio = malloc(sizeof(*mmio), M_DEVBUF, M_WAITOK | M_ZERO);
+ mmio->rid = PCIR_BAR(mmio_bar);
+ mmio->type = pci_resource_type(dev, mmio_bar);
+ mmio->res = bus_alloc_resource_any(dev->dev.bsddev, mmio->type,
+ &mmio->rid, RF_ACTIVE);
+ if (mmio->res == NULL) {
+ free(mmio, M_DEVBUF);
+ return (NULL);
+ }
+ TAILQ_INSERT_TAIL(&dev->mmio, mmio, next);
+
+ return ((void *)rman_get_bushandle(mmio->res));
+}
+
+static inline void
+pci_iounmap(struct pci_dev *dev, void *res)
+{
+ struct pci_mmio_region *mmio, *p;
+
+ TAILQ_FOREACH_SAFE(mmio, &dev->mmio, next, p) {
+ if (res != (void *)rman_get_bushandle(mmio->res))
+ continue;
+ bus_release_resource(dev->dev.bsddev,
+ mmio->type, mmio->rid, mmio->res);
+ TAILQ_REMOVE(&dev->mmio, mmio, next);
+ free(mmio, M_DEVBUF);
+ return;
+ }
}
#define DEFINE_PCI_DEVICE_TABLE(_table) \
Index: head/sys/compat/linuxkpi/common/src/linux_pci.c
===================================================================
--- head/sys/compat/linuxkpi/common/src/linux_pci.c
+++ head/sys/compat/linuxkpi/common/src/linux_pci.c
@@ -271,6 +271,7 @@
if (error)
goto out_dma_init;
+ TAILQ_INIT(&pdev->mmio);
pbus = malloc(sizeof(*pbus), M_DEVBUF, M_WAITOK | M_ZERO);
pbus->self = pdev;
pbus->number = pci_get_bus(dev);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Nov 19, 10:37 PM (4 h, 44 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14724718
Default Alt Text
D24696.id.diff (2 KB)
Attached To
Mode
D24696: linuxkpi: Add pci_iomap and pci_iounmap
Attached
Detach File
Event Timeline
Log In to Comment