aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/patch-kernel.sh
blob: c2b7e7204952f93946a6075d546cbeae32c2627f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#! /bin/sh
# A little script I whipped up to make it easy to
# patch source trees and have sane error handling
# -Erik
#
# (c) 2002 Erik Andersen <andersen@codepoet.org>

# Set directories from arguments, or use defaults.
targetdir=${1-.}
patchdir=${2-../kernel-patches}
patchpattern=${3-*}

if [ ! -d "${targetdir}" ] ; then
    echo "Aborting.  '${targetdir}' is not a directory."
    exit 1
fi
if [ ! -d "${patchdir}" ] ; then
    echo "Aborting.  '${patchdir}' is not a directory."
    exit 1
fi
    
for i in ${patchdir}/${patchpattern} ; do 
    case "$i" in
	*.gz)
	type="gzip"; uncomp="gunzip -dc"; ;; 
	*.bz)
	type="bzip"; uncomp="bunzip -dc"; ;; 
	*.bz2)
	type="bzip2"; uncomp="bunzip2 -dc"; ;; 
	*.zip)
	type="zip"; uncomp="unzip -d"; ;; 
	*.Z)
	type="compress"; uncomp="uncompress -c"; ;; 
	*)
	type="plaintext"; uncomp="cat"; ;; 
    esac
    [ -d "${i}" ] && echo "Ignoring subdirectory ${i}" && continue	
    echo ""
    echo "Applying ${i} using ${type}: " 
    ${uncomp} ${i} | ${PATCH:-patch} -f -p1 -d ${targetdir}
    if [ $? != 0 ] ; then
        echo "Patch failed!  Please fix $i!"
	exit 1
    fi
done

# Check for rejects...
if [ "`find $targetdir/ '(' -name '*.rej' -o -name '.*.rej' ')' -print`" ] ; then
    echo "Aborting.  Reject files found."
    exit 1
fi

# Remove backup files
find $targetdir/ '(' -name '*.orig' -o -name '.*.orig' ')' -exec rm -f {} \;
SK_SHIFT 16 #define IOSAPIC_MASK (1<<IOSAPIC_MASK_SHIFT) #ifndef __ASSEMBLY__ #ifdef CONFIG_IOSAPIC #define NR_IOSAPICS 256 #ifdef XEN struct iosapic { char __iomem *addr; /* base address of IOSAPIC */ unsigned int gsi_base; /* first GSI assigned to this IOSAPIC */ unsigned short num_rte; /* number of RTE in this IOSAPIC */ int rtes_inuse; /* # of RTEs in use on this IOSAPIC */ unsigned int id; /* APIC ID */ #ifdef CONFIG_NUMA unsigned short node; /* numa node association via pxm */ #endif }; extern struct iosapic iosapic_lists[NR_IOSAPICS]; static inline int find_iosapic_by_addr(unsigned long addr) { int i; for (i = 0; i < NR_IOSAPICS; i++) { if ((unsigned long)iosapic_lists[i].addr == addr) return i; } return -1; } #endif static inline unsigned int iosapic_read(char __iomem *iosapic, unsigned int reg) { #ifdef XEN if(iommu_enabled && (reg >= 10)){ int apic = find_iosapic_by_addr((unsigned long)iosapic); return io_apic_read_remap_rte(apic, reg); } #endif writel(reg, iosapic + IOSAPIC_REG_SELECT); return readl(iosapic + IOSAPIC_WINDOW); } static inline void iosapic_write(char __iomem *iosapic, unsigned int reg, u32 val) { #ifdef XEN if (iommu_enabled && (reg >= 10)){ int apic = find_iosapic_by_addr((unsigned long)iosapic); iommu_update_ire_from_apic(apic, reg, val); return; } #endif writel(reg, iosapic + IOSAPIC_REG_SELECT); writel(val, iosapic + IOSAPIC_WINDOW); } static inline void iosapic_eoi(char __iomem *iosapic, u32 vector) { writel(vector, iosapic + IOSAPIC_EOI); } extern void __init iosapic_system_init (int pcat_compat); #ifndef XEN extern int __devinit iosapic_init (unsigned long address, unsigned int gsi_base); #else extern int __devinit iosapic_init (unsigned long address, unsigned int gsi_base, unsigned int id); #endif #ifdef CONFIG_HOTPLUG extern int iosapic_remove (unsigned int gsi_base); #else #define iosapic_remove(gsi_base) (-EINVAL) #endif /* CONFIG_HOTPLUG */ extern int gsi_to_vector (unsigned int gsi); extern int gsi_to_irq (unsigned int gsi); extern int iosapic_register_intr (unsigned int gsi, unsigned long polarity, unsigned long trigger); extern void iosapic_unregister_intr (unsigned int irq); extern void __init iosapic_override_isa_irq (unsigned int isa_irq, unsigned int gsi, unsigned long polarity, unsigned long trigger); extern int __init iosapic_register_platform_intr (u32 int_type, unsigned int gsi, int pmi_vector, u16 eid, u16 id, unsigned long polarity, unsigned long trigger); extern unsigned int iosapic_version (char __iomem *addr); #ifdef CONFIG_NUMA extern void __devinit map_iosapic_to_node (unsigned int, int); #endif #else #define iosapic_system_init(pcat_compat) do { } while (0) #define iosapic_init(address,gsi_base) (-EINVAL) #define iosapic_remove(gsi_base) (-ENODEV) #define iosapic_register_intr(gsi,polarity,trigger) (gsi) #define iosapic_unregister_intr(irq) do { } while (0) #define iosapic_override_isa_irq(isa_irq,gsi,polarity,trigger) do { } while (0) #define iosapic_register_platform_intr(type,gsi,pmi,eid,id, \ polarity,trigger) (gsi) #endif #ifdef XEN #define move_irq(x) #ifdef nop #undef nop #endif struct rte_entry { union { struct { u32 vector : 8, delivery_mode : 3, dest_mode : 1, /* always 0 for iosapic */ delivery_status : 1, polarity : 1, __reserved0 : 1, trigger : 1, mask : 1, __reserved1 : 15; } lo; struct { u32 __reserved2 : 16, eid : 8, id : 8; } hi; u32 val; }; }; #define IOSAPIC_RTEINDEX(reg) (((reg) - 0x10) >> 1) extern unsigned long ia64_vector_mask[]; extern unsigned long ia64_xen_vector[]; int iosapic_get_nr_iosapics(void); int iosapic_get_nr_pins(int index); #endif /* XEN */ #define IO_APIC_BASE(idx) ((unsigned int *)iosapic_lists[idx].addr) #define IO_APIC_ID(idx) (iosapic_lists[idx].id) # endif /* !__ASSEMBLY__ */ #endif /* __ASM_IA64_IOSAPIC_H */