Hi,
this patch ports pcifont to ia64. pciback compiles without any change.
I had to make a few change because pcifront use its own structure
(struct pcifront_sd) for sysdata while ia64 wants it own (at least for
pcibios_fixup_bus). My solution is to reuse the ia64 sysdata structure
for pcifront, at the cost of a few ugly #ifdef.
Comments and ideas are welcome to improve this.
Also the patch fix a compile-time warning for xenbus.c.
Using this patch I was able to use an ethernet card in domU. This is
the good news.
Tristan.
# HG changeset patch
# User gingold@virtu10
# Node ID 1ffb1200700b08420a1656b817171798ff45bad4
# Parent 64fd80e1b24f94d2c9de520c5c113b9566997bd4
Pcifront for ia64.
Added in Kconfig.
Use ia64 sysdate instead of pcifront genuine one.
Fix a warning on xenbus.c
Signed-off-by: Tristan Gingold <tristan.gingold@bull.net>
diff -r 64fd80e1b24f -r 1ffb1200700b linux-2.6-xen-sparse/arch/ia64/Kconfig
--- a/linux-2.6-xen-sparse/arch/ia64/Kconfig Thu Jul 27 09:05:51 2006 +0200
+++ b/linux-2.6-xen-sparse/arch/ia64/Kconfig Thu Jul 27 09:46:31 2006 +0200
@@ -438,6 +438,21 @@ config PCI_DOMAINS
bool
default PCI
+config XEN_PCIDEV_FRONTEND
+ bool "Xen PCI Frontend"
+ depends on PCI && XEN
+ default y
+ help
+ The PCI device frontend driver allows the kernel to import arbitrary
+ PCI devices from a PCI backend to support PCI driver domains.
+
+config XEN_PCIDEV_FE_DEBUG
+ bool "Xen PCI Frontend Debugging"
+ depends on XEN_PCIDEV_FRONTEND
+ default n
+ help
+ Enables some debug statements within the PCI Frontend.
+
source "drivers/pci/Kconfig"
source "drivers/pci/hotplug/Kconfig"
diff -r 64fd80e1b24f -r 1ffb1200700b
linux-2.6-xen-sparse/drivers/xen/pcifront/pci_op.c
--- a/linux-2.6-xen-sparse/drivers/xen/pcifront/pci_op.c Thu Jul 27 09:05:51
2006 +0200
+++ b/linux-2.6-xen-sparse/drivers/xen/pcifront/pci_op.c Thu Jul 27 09:46:31
2006 +0200
@@ -105,7 +105,7 @@ static int pcifront_bus_read(struct pci_
.size = size,
};
struct pcifront_sd *sd = bus->sysdata;
- struct pcifront_device *pdev = sd->pdev;
+ struct pcifront_device *pdev = pcifront_get_pdev(sd);
if (verbose_request)
dev_info(&pdev->xdev->dev,
@@ -144,7 +144,7 @@ static int pcifront_bus_write(struct pci
.value = val,
};
struct pcifront_sd *sd = bus->sysdata;
- struct pcifront_device *pdev = sd->pdev;
+ struct pcifront_device *pdev = pcifront_get_pdev(sd);
if (verbose_request)
dev_info(&pdev->xdev->dev,
@@ -207,8 +207,17 @@ int pcifront_scan_root(struct pcifront_d
err = -ENOMEM;
goto err_out;
}
+#ifdef __ia64__
+ sd->segment = domain;
+ sd->acpi_handle = NULL;
+ sd->iommu = NULL;
+ sd->windows = 0;
+ sd->window = NULL;
+ sd->platform_data = pdev;
+#else
sd->domain = domain;
sd->pdev = pdev;
+#endif
b = pci_scan_bus_parented(&pdev->xdev->dev, bus,
&pcifront_bus_ops, sd);
if (!b) {
diff -r 64fd80e1b24f -r 1ffb1200700b
linux-2.6-xen-sparse/drivers/xen/pcifront/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/pcifront/xenbus.c Thu Jul 27 09:05:51
2006 +0200
+++ b/linux-2.6-xen-sparse/drivers/xen/pcifront/xenbus.c Thu Jul 27 09:46:31
2006 +0200
@@ -7,6 +7,7 @@
#include <linux/init.h>
#include <linux/mm.h>
#include <xen/xenbus.h>
+#include <xen/gnttab.h>
#include "pcifront.h"
#define INVALID_GRANT_REF (0)
diff -r 64fd80e1b24f -r 1ffb1200700b linux-2.6-xen-sparse/include/xen/pcifront.h
--- a/linux-2.6-xen-sparse/include/xen/pcifront.h Thu Jul 27 09:05:51 2006 +0200
+++ b/linux-2.6-xen-sparse/include/xen/pcifront.h Thu Jul 27 09:46:31 2006 +0200
@@ -11,6 +11,7 @@
#ifdef __KERNEL__
+#ifndef __ia64__
struct pcifront_device;
struct pcifront_sd {
@@ -20,7 +21,13 @@ struct pcifront_sd {
struct pci_bus;
-#ifdef CONFIG_PCI_DOMAINS
+static inline struct pcifront_device *
+pcifront_get_pdev (struct pcifront_sd *sd)
+{
+ return sd->pdev;
+}
+
+#if defined(CONFIG_PCI_DOMAINS)
static inline int pci_domain_nr(struct pci_bus *bus)
{
struct pcifront_sd *sd = bus->sysdata;
@@ -31,6 +38,17 @@ static inline int pci_proc_domain(struct
return pci_domain_nr(bus);
}
#endif /* CONFIG_PCI_DOMAINS */
+#else
+#include <asm/pci.h>
+#define pcifront_sd pci_controller
+
+static inline struct pcifront_device *
+pcifront_get_pdev (struct pcifront_sd *sd)
+{
+ return (struct pcifront_device *)sd->platform_data;
+}
+
+#endif /* __ia64__ */
extern spinlock_t pci_bus_lock;
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel