# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1233750309 0
# Node ID 77e3b255381e02021d460d535e44b1040a180773
# Parent 25cc543a02e88c090d117ee362ad006d1930f47b
linux: remove xen specific member from pci_dev
Move msi related variable irq_old out of struct pci_dev. This is
logically more consistent and has the additional benefit that xen
kernel and vanilla kernel now have the same pci_dev layout
Signed-off-by: Qing He <qing.he@xxxxxxxxx>
---
drivers/pci/msi-xen.c | 24 ++++++++++++++++--------
include/linux/pci.h | 3 ---
2 files changed, 16 insertions(+), 11 deletions(-)
diff -r 25cc543a02e8 -r 77e3b255381e drivers/pci/msi-xen.c
--- a/drivers/pci/msi-xen.c Tue Feb 03 13:59:17 2009 +0000
+++ b/drivers/pci/msi-xen.c Wed Feb 04 12:25:09 2009 +0000
@@ -44,6 +44,8 @@ struct msi_dev_list {
struct list_head pirq_list_head;
/* Used for saving/restoring MSI-X tables */
void __iomem *mask_base;
+ /* Store default pre-assigned irq */
+ unsigned int default_irq;
};
struct msi_pirq_entry {
@@ -589,6 +591,7 @@ int pci_enable_msi(struct pci_dev* dev)
{
struct pci_bus *bus;
int pos, temp, status = -EINVAL;
+ struct msi_dev_list *msi_dev_entry = get_msi_dev_pirq_list(dev);
if (!pci_msi_enable || !dev)
return status;
@@ -615,7 +618,7 @@ int pci_enable_msi(struct pci_dev* dev)
return ret;
dev->irq = evtchn_map_pirq(-1, dev->irq);
- dev->irq_old = temp;
+ msi_dev_entry->default_irq = temp;
return ret;
}
@@ -638,8 +641,8 @@ int pci_enable_msi(struct pci_dev* dev)
status = msi_capability_init(dev);
if ( !status )
- dev->irq_old = temp;
- else
+ msi_dev_entry->default_irq = temp;
+ else
dev->irq = temp;
return status;
@@ -650,6 +653,7 @@ void pci_disable_msi(struct pci_dev* dev
{
int pos;
int pirq;
+ struct msi_dev_list *msi_dev_entry = get_msi_dev_pirq_list(dev);
if (!pci_msi_enable)
return;
@@ -660,7 +664,7 @@ void pci_disable_msi(struct pci_dev* dev
if (!is_initial_xendomain()) {
evtchn_map_pirq(dev->irq, 0);
pci_frontend_disable_msi(dev);
- dev->irq = dev->irq_old;
+ dev->irq = msi_dev_entry->default_irq;
return;
}
#endif
@@ -671,7 +675,7 @@ void pci_disable_msi(struct pci_dev* dev
pirq = dev->irq;
/* Restore dev->irq to its default pin-assertion vector */
- dev->irq = dev->irq_old;
+ dev->irq = msi_dev_entry->default_irq;
msi_unmap_pirq(dev, pirq);
/* Disable MSI mode */
@@ -701,6 +705,7 @@ int pci_enable_msix(struct pci_dev* dev,
int status, pos, nr_entries;
int i, j, temp;
u16 control;
+ struct msi_dev_list *msi_dev_entry = get_msi_dev_pirq_list(dev);
if (!pci_msi_enable || !dev || !entries)
return -EINVAL;
@@ -718,11 +723,13 @@ int pci_enable_msix(struct pci_dev* dev,
struct msi_pirq_entry *pirq_entry;
int ret, irq;
+ temp = dev->irq;
ret = pci_frontend_enable_msix(dev, entries, nvec);
if (ret) {
printk("get %x from pci_frontend_enable_msix\n", ret);
return ret;
}
+ msi_dev_entry->default_irq = temp;
msi_dev_entry = get_msi_dev_pirq_list(dev);
for (i = 0; i < nvec; i++) {
@@ -783,7 +790,7 @@ int pci_enable_msix(struct pci_dev* dev,
status = msix_capability_init(dev, entries, nvec);
if ( !status )
- dev->irq_old = temp;
+ msi_dev_entry->default_irq = temp;
else
dev->irq = temp;
@@ -795,6 +802,7 @@ void pci_disable_msix(struct pci_dev* de
{
int pos;
u16 control;
+ struct msi_dev_list *msi_dev_entry = get_msi_dev_pirq_list(dev);
if (!pci_msi_enable)
@@ -817,7 +825,7 @@ void pci_disable_msix(struct pci_dev* de
kfree(pirq_entry);
}
- dev->irq = dev->irq_old;
+ dev->irq = msi_dev_entry->default_irq;
return;
}
#endif
@@ -867,7 +875,7 @@ void msi_remove_pci_irq_vectors(struct p
spin_unlock_irqrestore(&msi_dev_entry->pirq_list_lock, flags);
iounmap(msi_dev_entry->mask_base);
msi_dev_entry->mask_base = NULL;
- dev->irq = dev->irq_old;
+ dev->irq = msi_dev_entry->default_irq;
}
void pci_no_msi(void)
diff -r 25cc543a02e8 -r 77e3b255381e include/linux/pci.h
--- a/include/linux/pci.h Tue Feb 03 13:59:17 2009 +0000
+++ b/include/linux/pci.h Wed Feb 04 12:25:09 2009 +0000
@@ -152,9 +152,6 @@ struct pci_dev {
* directly, use the values stored here. They might be different!
*/
unsigned int irq;
-#ifdef CONFIG_XEN
- unsigned int irq_old;
-#endif
struct resource resource[DEVICE_COUNT_RESOURCE]; /* I/O and memory
regions + expansion ROMs */
/* These fields are used by common fixups */
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|