From e22738def91bffee104e7a45446a26746981cbd4 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Mon, 22 Jan 2007 17:10:27 +0000 Subject: [PV-on-HVM] Make PV drivers on HVM kernels work on older kernels after update to 2.6.18. Signed-off-by: Ian Campbell --- .../linux-2.6/compat-include/xen/platform-compat.h | 11 +++++++++++ unmodified_drivers/linux-2.6/platform-pci/platform-pci.c | 13 +++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) (limited to 'unmodified_drivers') diff --git a/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h b/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h index 4a5aa7f9f9..87db7bf3d0 100644 --- a/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h +++ b/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h @@ -40,6 +40,13 @@ #define gfp_t unsigned #endif +#if defined (_LINUX_NOTIFIER_H) && !defined ATOMIC_NOTIFIER_HEAD +#define ATOMIC_NOTIFIER_HEAD(name) struct notifier_block *name +#define atomic_notifier_chain_register(chain,nb) notifier_chain_register(chain,nb) +#define atomic_notifier_chain_unregister(chain,nb) notifier_chain_unregister(chain,nb) +#define atomic_notifier_call_chain(chain,val,v) notifier_call_chain(chain,val,v) +#endif + #if defined(_LINUX_FS_H) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9) #define nonseekable_open(inode, filp) /* Nothing to do */ #endif @@ -69,4 +76,8 @@ extern char *kasprintf(gfp_t gfp, const char *fmt, ...) __attribute__ ((format (printf, 2, 3))); #endif +#if defined(_I386_PAGE_H) && defined(CONFIG_X86_PAE) +#define __supported_pte_mask ~0ULL +#endif + #endif diff --git a/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c b/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c index 321a166d05..7973f86820 100644 --- a/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c +++ b/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c @@ -61,7 +61,7 @@ MODULE_LICENSE("GPL"); unsigned long *phys_to_machine_mapping; EXPORT_SYMBOL(phys_to_machine_mapping); -static int __init init_xen_info(void) +static int __devinit init_xen_info(void) { unsigned long shared_info_frame; struct xen_add_to_physmap xatp; @@ -194,14 +194,23 @@ static uint64_t get_callback_via(struct pci_dev *pdev) rid); return rid | IA64_CALLBACK_IRQ_RID; #else /* !__ia64__ */ + u8 pin; + if (pdev->irq < 16) return pdev->irq; /* ISA IRQ */ + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) + pin = pdev->pin; +#else + pci_read_config_byte(pdev, PCI_INTERRUPT_PIN, &pin); +#endif + /* We don't know the GSI. Specify the PCI INTx line instead. */ return (((uint64_t)0x01 << 56) | /* PCI INTx identifier */ ((uint64_t)pci_domain_nr(pdev->bus) << 32) | ((uint64_t)pdev->bus->number << 16) | ((uint64_t)(pdev->devfn & 0xff) << 8) | - ((uint64_t)(pdev->pin - 1) & 3)); + ((uint64_t)(pin - 1) & 3)); #endif } -- cgit v1.2.3