[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] RFC: [PATCH 1/3] Enhance platform support for PCI



The platform APIs are enhanced to provide support for parsing pci device
tree nodes and storing the config-space address which is later used for
pci_read/pci_write config calls.
---
 xen/arch/arm/platform.c        | 27 +++++++++++++++++++++++++++
 xen/include/asm-arm/platform.h | 18 +++++++++++++++++-
 2 files changed, 44 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/platform.c b/xen/arch/arm/platform.c
index cb4cda8..25f07d2 100644
--- a/xen/arch/arm/platform.c
+++ b/xen/arch/arm/platform.c
@@ -128,6 +128,33 @@ int __init platform_smp_init(void)
 }
 #endif
+int platform_pci_dt_node_init(struct dt_device_node *node, const void *data)
+{
+    if(platform->pci_dt_node_init)
+        return platform->pci_dt_node_init(node, data);
+    return -1;
+}
+
+int platform_pci_write_config(unsigned int seg, unsigned int bus,
+                                    unsigned int dev, unsigned int func,
+                                    int reg, int size, uint32_t val)
+{
+    if(platform->pci_write_config)
+        return platform->pci_write_config(seg, bus, dev, func, reg, size, val);
+
+    return -1;
+}
+
+int platform_pci_read_config(unsigned int seg, unsigned int bus,
+                                    unsigned int dev, unsigned int func,
+                                    int reg, int size, uint32_t *val)
+{
+    if(platform->pci_read_config)
+        return platform->pci_read_config(seg, bus, dev, func, reg, size, val);
+
+    return -1;
+}
+
 void platform_reset(void)
 {
     if ( platform && platform->reset )
diff --git a/xen/include/asm-arm/platform.h b/xen/include/asm-arm/platform.h
index eefaca6..da3cc63 100644
--- a/xen/include/asm-arm/platform.h
+++ b/xen/include/asm-arm/platform.h
@@ -26,6 +26,16 @@ struct platform_desc {
     void (*reset)(void);
     /* Platform power-off */
     void (*poweroff)(void);
+    /* PCI callback when a pci device tree node is found */
+    int (*pci_dt_node_init)(struct dt_device_node *node, const void *data);
+    /* PCI configspace read and write */
+    int (*pci_read_config)(unsigned int seg, unsigned int bus,
+                            unsigned int dev, unsigned int func,
+                            int reg, int size, uint32_t *val);
+
+    int (*pci_write_config)(unsigned int seg, unsigned int bus,
+                            unsigned int dev, unsigned int func,
+                            int reg, int size, uint32_t val);
     /*
      * Platform quirks
      * Defined has a function because a platform can support multiple
@@ -73,7 +83,13 @@ bool_t platform_has_quirk(uint32_t quirk);
 bool_t platform_device_is_blacklisted(const struct dt_device_node *node);
 unsigned int platform_dom0_evtchn_ppi(void);
 void platform_dom0_gnttab(paddr_t *start, paddr_t *size);
-
+int platform_pci_dt_node_init(struct dt_device_node *node, const void *data);
+int platform_pci_write_config(unsigned int seg, unsigned int bus,
+                                    unsigned int dev, unsigned int func,
+                                    int reg, int size, uint32_t val);
+int platform_pci_read_config(unsigned int seg, unsigned int bus,
+                                    unsigned int dev, unsigned int func,
+                                    int reg, int size, uint32_t *val);
 #define PLATFORM_START(_name, _namestr)                         \
 static const struct platform_desc  __plat_desc_##_name __used   \
 __attribute__((__section__(".arch.info"))) = {                  \
--
1.9.1


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.