From: Dave Airlie Date: Wed, 5 Mar 2008 00:37:02 +0000 (+1000) Subject: Merge remote branch 'origin/master' into modesetting-101 X-Git-Tag: submit/1.0/20121108.012404~642^2~234^2~20 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=43891ff2d0176f013796b3c2a340b7d379d703ee;p=profile%2Fivi%2Flibdrm.git Merge remote branch 'origin/master' into modesetting-101 Conflicts: linux-core/drm_compat.c --- 43891ff2d0176f013796b3c2a340b7d379d703ee diff --cc linux-core/drm_compat.c index e95269e,d4044cb..b7b8e39 --- a/linux-core/drm_compat.c +++ b/linux-core/drm_compat.c @@@ -730,52 -730,33 +730,81 @@@ void *idr_replace(struct idr *idp, voi EXPORT_SYMBOL(idr_replace); #endif +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) +static __inline__ unsigned long __round_jiffies(unsigned long j, int cpu) +{ + int rem; + unsigned long original = j; + + j += cpu * 3; + + rem = j % HZ; + + if (rem < HZ/4) /* round down */ + j = j - rem; + else /* round up */ + j = j - rem + HZ; + + /* now that we have rounded, subtract the extra skew again */ + j -= cpu * 3; + + if (j <= jiffies) /* rounding ate our timeout entirely; */ + return original; + return j; +} + +static __inline__ unsigned long __round_jiffies_relative(unsigned long j, int cpu) +{ + return __round_jiffies(j + jiffies, cpu) - jiffies; +} + +unsigned long round_jiffies_relative(unsigned long j) +{ + return __round_jiffies_relative(j, raw_smp_processor_id()); +} +EXPORT_SYMBOL(round_jiffies_relative); +#endif + +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) +struct pci_dev * pci_get_bus_and_slot(unsigned int bus, unsigned int devfn) +{ + struct pci_dev *dev = NULL; + + while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { + if (pci_domain_nr(dev->bus) == 0 && + (dev->bus->number == bus && dev->devfn == devfn)) + return dev; + } + return NULL; +} +EXPORT_SYMBOL(pci_get_bus_and_slot); +#endif ++ + #if defined(DRM_KMAP_ATOMIC_PROT_PFN) && defined(CONFIG_HIMEM) + #define drm_kmap_get_fixmap_pte(vaddr) \ + pte_offset_kernel(pmd_offset(pud_offset(pgd_offset_k(vaddr), vaddr), (vaddr)), (vaddr)) + + void *kmap_atomic_prot_pfn(unsigned long pfn, enum km_type type, + pgprot_t protection) + { + enum fixed_addresses idx; + unsigned long vaddr; + static pte_t *km_pte; + static int initialized = 0; + + if (unlikely(!initialized)) { + km_pte = drm_kmap_get_fixmap_pte(__fix_to_virt(FIX_KMAP_BEGIN)); + initialized = 1; + } + + pagefault_disable(); + idx = type + KM_TYPE_NR*smp_processor_id(); + vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx); + set_pte(km_pte-idx, pfn_pte(pfn, protection)); + + return (void*) vaddr; + } + + EXPORT_SYMBOL(kmap_atomic_prot_pfn); + -#endif - + diff --cc linux-core/drm_compat.h index f5f0601,136a729..86f1159 --- a/linux-core/drm_compat.h +++ b/linux-core/drm_compat.h @@@ -332,15 -325,12 +332,20 @@@ void *idr_replace(struct idr *idp, voi #endif #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) -typedef _Bool bool; +extern unsigned long round_jiffies_relative(unsigned long j); +#endif + +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) +extern struct pci_dev * pci_get_bus_and_slot(unsigned int bus, unsigned int devfn); +#endif + +#ifndef PM_EVENT_PRETHAW +#define PM_EVENT_PRETHAW 3 #endif + #if (defined(CONFIG_X86) && defined(CONFIG_X86_32) && defined(CONFIG_HIMEM)) + #define DRM_KMAP_ATOMIC_PROT_PFN + extern void *kmap_atomic_prot_pfn(unsigned long pfn, enum km_type type, + pgprot_t protection); + #endif #endif