diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-alpha/bitops.h | 2 | ||||
-rw-r--r-- | include/asm-arm/unaligned.h | 22 | ||||
-rw-r--r-- | include/asm-m68k/raw_io.h | 8 | ||||
-rw-r--r-- | include/asm-m68knommu/hardirq.h | 2 | ||||
-rw-r--r-- | include/asm-m68knommu/machdep.h | 1 | ||||
-rw-r--r-- | include/asm-mips/edac.h | 35 | ||||
-rw-r--r-- | include/asm-powerpc/bug.h | 2 | ||||
-rw-r--r-- | include/asm-powerpc/page.h | 1 | ||||
-rw-r--r-- | include/asm-x86_64/uaccess.h | 4 | ||||
-rw-r--r-- | include/linux/compiler.h | 4 | ||||
-rw-r--r-- | include/linux/device.h | 3 | ||||
-rw-r--r-- | include/linux/lguest.h | 47 | ||||
-rw-r--r-- | include/linux/lguest_bus.h | 5 | ||||
-rw-r--r-- | include/linux/lguest_launcher.h | 60 | ||||
-rw-r--r-- | include/linux/mm.h | 2 | ||||
-rw-r--r-- | include/linux/netfilter/xt_connlimit.h | 4 | ||||
-rw-r--r-- | include/linux/pnp.h | 191 | ||||
-rw-r--r-- | include/linux/pnpbios.h | 60 | ||||
-rw-r--r-- | include/linux/preempt.h | 44 | ||||
-rw-r--r-- | include/linux/sched.h | 23 | ||||
-rw-r--r-- | include/linux/suspend.h | 3 | ||||
-rw-r--r-- | include/net/netfilter/nf_conntrack_tuple.h | 4 | ||||
-rw-r--r-- | include/xen/page.h | 1 |
23 files changed, 357 insertions, 171 deletions
diff --git a/include/asm-alpha/bitops.h b/include/asm-alpha/bitops.h index 3a0cbeb03fa..9e71201000d 100644 --- a/include/asm-alpha/bitops.h +++ b/include/asm-alpha/bitops.h @@ -324,7 +324,7 @@ static inline int fls64(unsigned long x) { unsigned long t, a, r; - t = __kernel_cmpbge (x, 0x0101010101010101); + t = __kernel_cmpbge (x, 0x0101010101010101UL); a = __flsm1_tab[t]; t = __kernel_extbl (x, a); r = a*8 + __flsm1_tab[t] + (x != 0); diff --git a/include/asm-arm/unaligned.h b/include/asm-arm/unaligned.h index 795b9e5b9e6..8431f6eed5c 100644 --- a/include/asm-arm/unaligned.h +++ b/include/asm-arm/unaligned.h @@ -60,24 +60,24 @@ extern int __bug_unaligned_x(const void *ptr); __get_unaligned_4_be((__p+4))) #define __get_unaligned_le(ptr) \ - ({ \ + ((__force typeof(*(ptr)))({ \ const __u8 *__p = (const __u8 *)(ptr); \ __builtin_choose_expr(sizeof(*(ptr)) == 1, *__p, \ __builtin_choose_expr(sizeof(*(ptr)) == 2, __get_unaligned_2_le(__p), \ __builtin_choose_expr(sizeof(*(ptr)) == 4, __get_unaligned_4_le(__p), \ __builtin_choose_expr(sizeof(*(ptr)) == 8, __get_unaligned_8_le(__p), \ (void)__bug_unaligned_x(__p))))); \ - }) + })) #define __get_unaligned_be(ptr) \ - ({ \ + ((__force typeof(*(ptr)))({ \ const __u8 *__p = (const __u8 *)(ptr); \ __builtin_choose_expr(sizeof(*(ptr)) == 1, *__p, \ __builtin_choose_expr(sizeof(*(ptr)) == 2, __get_unaligned_2_be(__p), \ __builtin_choose_expr(sizeof(*(ptr)) == 4, __get_unaligned_4_be(__p), \ __builtin_choose_expr(sizeof(*(ptr)) == 8, __get_unaligned_8_be(__p), \ (void)__bug_unaligned_x(__p))))); \ - }) + })) static inline void __put_unaligned_2_le(__u32 __v, register __u8 *__p) @@ -131,15 +131,16 @@ static inline void __put_unaligned_8_be(const unsigned long long __v, register _ */ #define __put_unaligned_le(val,ptr) \ ({ \ + (void)sizeof(*(ptr) = (val)); \ switch (sizeof(*(ptr))) { \ case 1: \ *(ptr) = (val); \ break; \ - case 2: __put_unaligned_2_le((val),(__u8 *)(ptr)); \ + case 2: __put_unaligned_2_le((__force u16)(val),(__u8 *)(ptr)); \ break; \ - case 4: __put_unaligned_4_le((val),(__u8 *)(ptr)); \ + case 4: __put_unaligned_4_le((__force u32)(val),(__u8 *)(ptr)); \ break; \ - case 8: __put_unaligned_8_le((val),(__u8 *)(ptr)); \ + case 8: __put_unaligned_8_le((__force u64)(val),(__u8 *)(ptr)); \ break; \ default: __bug_unaligned_x(ptr); \ break; \ @@ -149,15 +150,16 @@ static inline void __put_unaligned_8_be(const unsigned long long __v, register _ #define __put_unaligned_be(val,ptr) \ ({ \ + (void)sizeof(*(ptr) = (val)); \ switch (sizeof(*(ptr))) { \ case 1: \ *(ptr) = (val); \ break; \ - case 2: __put_unaligned_2_be((val),(__u8 *)(ptr)); \ + case 2: __put_unaligned_2_be((__force u16)(val),(__u8 *)(ptr)); \ break; \ - case 4: __put_unaligned_4_be((val),(__u8 *)(ptr)); \ + case 4: __put_unaligned_4_be((__force u32)(val),(__u8 *)(ptr)); \ break; \ - case 8: __put_unaligned_8_be((val),(__u8 *)(ptr)); \ + case 8: __put_unaligned_8_be((__force u64)(val),(__u8 *)(ptr)); \ break; \ default: __bug_unaligned_x(ptr); \ break; \ diff --git a/include/asm-m68k/raw_io.h b/include/asm-m68k/raw_io.h index 91c623f0994..d9eb9834ccc 100644 --- a/include/asm-m68k/raw_io.h +++ b/include/asm-m68k/raw_io.h @@ -36,15 +36,15 @@ extern void __iounmap(void *addr, unsigned long size); #define in_be32(addr) \ ({ u32 __v = (*(__force volatile u32 *) (addr)); __v; }) #define in_le16(addr) \ - ({ u16 __v = le16_to_cpu(*(__force volatile u16 *) (addr)); __v; }) + ({ u16 __v = le16_to_cpu(*(__force volatile __le16 *) (addr)); __v; }) #define in_le32(addr) \ - ({ u32 __v = le32_to_cpu(*(__force volatile u32 *) (addr)); __v; }) + ({ u32 __v = le32_to_cpu(*(__force volatile __le32 *) (addr)); __v; }) #define out_8(addr,b) (void)((*(__force volatile u8 *) (addr)) = (b)) #define out_be16(addr,w) (void)((*(__force volatile u16 *) (addr)) = (w)) #define out_be32(addr,l) (void)((*(__force volatile u32 *) (addr)) = (l)) -#define out_le16(addr,w) (void)((*(__force volatile u16 *) (addr)) = cpu_to_le16(w)) -#define out_le32(addr,l) (void)((*(__force volatile u32 *) (addr)) = cpu_to_le32(l)) +#define out_le16(addr,w) (void)((*(__force volatile __le16 *) (addr)) = cpu_to_le16(w)) +#define out_le32(addr,l) (void)((*(__force volatile __le32 *) (addr)) = cpu_to_le32(l)) #define raw_inb in_8 #define raw_inw in_be16 diff --git a/include/asm-m68knommu/hardirq.h b/include/asm-m68knommu/hardirq.h index 980075bab79..bfad28149a4 100644 --- a/include/asm-m68knommu/hardirq.h +++ b/include/asm-m68knommu/hardirq.h @@ -22,4 +22,6 @@ typedef struct { # error HARDIRQ_BITS is too low! #endif +void ack_bad_irq(unsigned int irq); + #endif /* __M68K_HARDIRQ_H */ diff --git a/include/asm-m68knommu/machdep.h b/include/asm-m68knommu/machdep.h index 6ce28f8e0ea..2b75a300df4 100644 --- a/include/asm-m68knommu/machdep.h +++ b/include/asm-m68knommu/machdep.h @@ -48,6 +48,5 @@ extern char *mach_sysrq_xlate; extern void config_BSP(char *command, int len); extern void (*mach_tick)(void); -extern void (*mach_trap_init)(void); #endif /* _M68KNOMMU_MACHDEP_H */ diff --git a/include/asm-mips/edac.h b/include/asm-mips/edac.h new file mode 100644 index 00000000000..83719eee2d1 --- /dev/null +++ b/include/asm-mips/edac.h @@ -0,0 +1,35 @@ +#ifndef ASM_EDAC_H +#define ASM_EDAC_H + +/* ECC atomic, DMA, SMP and interrupt safe scrub function */ + +static inline void atomic_scrub(void *va, u32 size) +{ + unsigned long *virt_addr = va; + unsigned long temp; + u32 i; + + for (i = 0; i < size / sizeof(unsigned long); i++, virt_addr++) { + + /* + * Very carefully read and write to memory atomically + * so we are interrupt, DMA and SMP safe. + * + * Intel: asm("lock; addl $0, %0"::"m"(*virt_addr)); + */ + + __asm__ __volatile__ ( + " .set mips3 \n" + "1: ll %0, %1 # atomic_add \n" + " ll %0, %1 # atomic_add \n" + " addu %0, $0 \n" + " sc %0, %1 \n" + " beqz %0, 1b \n" + " .set mips0 \n" + : "=&r" (temp), "=m" (*virt_addr) + : "m" (*virt_addr)); + + } +} + +#endif diff --git a/include/asm-powerpc/bug.h b/include/asm-powerpc/bug.h index f6fa3947484..a248b8bd4d7 100644 --- a/include/asm-powerpc/bug.h +++ b/include/asm-powerpc/bug.h @@ -79,7 +79,7 @@ _EMIT_BUG_ENTRY \ : : "i" (__FILE__), "i" (__LINE__), "i" (0), \ "i" (sizeof(struct bug_entry)), \ - "r" ((long)(x))); \ + "r" ((__force long)(x))); \ } \ } while (0) diff --git a/include/asm-powerpc/page.h b/include/asm-powerpc/page.h index 10c51f457d4..236a9210e5f 100644 --- a/include/asm-powerpc/page.h +++ b/include/asm-powerpc/page.h @@ -190,7 +190,6 @@ extern void copy_user_page(void *to, void *from, unsigned long vaddr, extern int page_is_ram(unsigned long pfn); struct vm_area_struct; -extern const char *arch_vma_name(struct vm_area_struct *vma); #include <asm-generic/memory_model.h> #endif /* __ASSEMBLY__ */ diff --git a/include/asm-x86_64/uaccess.h b/include/asm-x86_64/uaccess.h index 9df30b939c4..f4ce8768ad4 100644 --- a/include/asm-x86_64/uaccess.h +++ b/include/asm-x86_64/uaccess.h @@ -100,7 +100,7 @@ struct exception_table_entry case 8: __get_user_x(8,__ret_gu,__val_gu,ptr); break; \ default: __get_user_bad(); break; \ } \ - (x) = (typeof(*(ptr)))__val_gu; \ + (x) = (__force typeof(*(ptr)))__val_gu; \ __ret_gu; \ }) @@ -192,7 +192,7 @@ struct __large_struct { unsigned long buf[100]; }; int __gu_err; \ unsigned long __gu_val; \ __get_user_size(__gu_val,(ptr),(size),__gu_err); \ - (x) = (typeof(*(ptr)))__gu_val; \ + (x) = (__force typeof(*(ptr)))__gu_val; \ __gu_err; \ }) diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 12a1291855e..86f9a3a6137 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -15,8 +15,8 @@ # define __acquire(x) __context__(x,1) # define __release(x) __context__(x,-1) # define __cond_lock(x,c) ((c) ? ({ __acquire(x); 1; }) : 0) -extern void __chk_user_ptr(const void __user *); -extern void __chk_io_ptr(const void __iomem *); +extern void __chk_user_ptr(const volatile void __user *); +extern void __chk_io_ptr(const volatile void __iomem *); #else # define __user # define __kernel diff --git a/include/linux/device.h b/include/linux/device.h index d9f0a57f5a2..3a38d1f70cb 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -551,6 +551,9 @@ extern void put_device(struct device * dev); /* drivers/base/power/shutdown.c */ extern void device_shutdown(void); +/* drivers/base/sys.c */ +extern void sysdev_shutdown(void); + /* drivers/base/firmware.c */ extern int __must_check firmware_register(struct kset *); diff --git a/include/linux/lguest.h b/include/linux/lguest.h index 500aace21ca..e76c151c712 100644 --- a/include/linux/lguest.h +++ b/include/linux/lguest.h @@ -27,18 +27,38 @@ #define LG_CLOCK_MIN_DELTA 100UL #define LG_CLOCK_MAX_DELTA ULONG_MAX +/*G:031 First, how does our Guest contact the Host to ask for privileged + * operations? There are two ways: the direct way is to make a "hypercall", + * to make requests of the Host Itself. + * + * Our hypercall mechanism uses the highest unused trap code (traps 32 and + * above are used by real hardware interrupts). Seventeen hypercalls are + * available: the hypercall number is put in the %eax register, and the + * arguments (when required) are placed in %edx, %ebx and %ecx. If a return + * value makes sense, it's returned in %eax. + * + * Grossly invalid calls result in Sudden Death at the hands of the vengeful + * Host, rather than returning failure. This reflects Winston Churchill's + * definition of a gentleman: "someone who is only rude intentionally". */ #define LGUEST_TRAP_ENTRY 0x1F static inline unsigned long hcall(unsigned long call, unsigned long arg1, unsigned long arg2, unsigned long arg3) { + /* "int" is the Intel instruction to trigger a trap. */ asm volatile("int $" __stringify(LGUEST_TRAP_ENTRY) + /* The call is in %eax (aka "a"), and can be replaced */ : "=a"(call) + /* The other arguments are in %eax, %edx, %ebx & %ecx */ : "a"(call), "d"(arg1), "b"(arg2), "c"(arg3) + /* "memory" means this might write somewhere in memory. + * This isn't true for all calls, but it's safe to tell + * gcc that it might happen so it doesn't get clever. */ : "memory"); return call; } +/*:*/ void async_hcall(unsigned long call, unsigned long arg1, unsigned long arg2, unsigned long arg3); @@ -52,31 +72,40 @@ struct hcall_ring u32 eax, edx, ebx, ecx; }; -/* All the good stuff happens here: guest registers it with LGUEST_INIT */ +/*G:032 The second method of communicating with the Host is to via "struct + * lguest_data". The Guest's very first hypercall is to tell the Host where + * this is, and then the Guest and Host both publish information in it. :*/ struct lguest_data { -/* Fields which change during running: */ - /* 512 == enabled (same as eflags) */ + /* 512 == enabled (same as eflags in normal hardware). The Guest + * changes interrupts so often that a hypercall is too slow. */ unsigned int irq_enabled; - /* Interrupts blocked by guest. */ + /* Fine-grained interrupt disabling by the Guest */ DECLARE_BITMAP(blocked_interrupts, LGUEST_IRQS); - /* Virtual address of page fault. */ + /* The Host writes the virtual address of the last page fault here, + * which saves the Guest a hypercall. CR2 is the native register where + * this address would normally be found. */ unsigned long cr2; - /* Async hypercall ring. 0xFF == done, 0 == pending. */ + /* Async hypercall ring. Instead of directly making hypercalls, we can + * place them in here for processing the next time the Host wants. + * This batching can be quite efficient. */ + + /* 0xFF == done (set by Host), 0 == pending (set by Guest). */ u8 hcall_status[LHCALL_RING_SIZE]; + /* The actual registers for the hypercalls. */ struct hcall_ring hcalls[LHCALL_RING_SIZE]; -/* Fields initialized by the hypervisor at boot: */ +/* Fields initialized by the Host at boot: */ /* Memory not to try to access */ unsigned long reserve_mem; - /* ID of this guest (used by network driver to set ethernet address) */ + /* ID of this Guest (used by network driver to set ethernet address) */ u16 guestid; /* KHz for the TSC clock. */ u32 tsc_khz; -/* Fields initialized by the guest at boot: */ +/* Fields initialized by the Guest at boot: */ /* Instruction range to suppress interrupts even if enabled */ unsigned long noirq_start, noirq_end; }; diff --git a/include/linux/lguest_bus.h b/include/linux/lguest_bus.h index c9b4e05fee4..d27853ddc64 100644 --- a/include/linux/lguest_bus.h +++ b/include/linux/lguest_bus.h @@ -15,11 +15,14 @@ struct lguest_device { void *private; }; -/* By convention, each device can use irq index+1 if it wants to. */ +/*D:380 Since interrupt numbers are arbitrary, we use a convention: each device + * can use the interrupt number corresponding to its index. The +1 is because + * interrupt 0 is not usable (it's actually the timer interrupt). */ static inline int lgdev_irq(const struct lguest_device *dev) { return dev->index + 1; } +/*:*/ /* dma args must not be vmalloced! */ void lguest_send_dma(unsigned long key, struct lguest_dma *dma); diff --git a/include/linux/lguest_launcher.h b/include/linux/lguest_launcher.h index 0ba414a40c8..64167057944 100644 --- a/include/linux/lguest_launcher.h +++ b/include/linux/lguest_launcher.h @@ -9,14 +9,45 @@ /* How many devices? Assume each one wants up to two dma arrays per device. */ #define LGUEST_MAX_DEVICES (LGUEST_MAX_DMA/2) +/*D:200 + * Lguest I/O + * + * The lguest I/O mechanism is the only way Guests can talk to devices. There + * are two hypercalls involved: SEND_DMA for output and BIND_DMA for input. In + * each case, "struct lguest_dma" describes the buffer: this contains 16 + * addr/len pairs, and if there are fewer buffer elements the len array is + * terminated with a 0. + * + * I/O is organized by keys: BIND_DMA attaches buffers to a particular key, and + * SEND_DMA transfers to buffers bound to particular key. By convention, keys + * correspond to a physical address within the device's page. This means that + * devices will never accidentally end up with the same keys, and allows the + * Host use The Futex Trick (as we'll see later in our journey). + * + * SEND_DMA simply indicates a key to send to, and the physical address of the + * "struct lguest_dma" to send. The Host will write the number of bytes + * transferred into the "struct lguest_dma"'s used_len member. + * + * BIND_DMA indicates a key to bind to, a pointer to an array of "struct + * lguest_dma"s ready for receiving, the size of that array, and an interrupt + * to trigger when data is received. The Host will only allow transfers into + * buffers with a used_len of zero: it then sets used_len to the number of + * bytes transferred and triggers the interrupt for the Guest to process the + * new input. */ struct lguest_dma { - /* 0 if free to be used, filled by hypervisor. */ + /* 0 if free to be used, filled by the Host. */ u32 used_len; unsigned long addr[LGUEST_MAX_DMA_SECTIONS]; u16 len[LGUEST_MAX_DMA_SECTIONS]; }; +/*:*/ +/*D:460 This is the layout of a block device memory page. The Launcher sets up + * the num_sectors initially to tell the Guest the size of the disk. The Guest + * puts the type, sector and length of the request in the first three fields, + * then DMAs to the Host. The Host processes the request, sets up the result, + * then DMAs back to the Guest. */ struct lguest_block_page { /* 0 is a read, 1 is a write. */ @@ -28,27 +59,47 @@ struct lguest_block_page u32 num_sectors; /* Disk length = num_sectors * 512 */ }; -/* There is a shared page of these. */ +/*D:520 The network device is basically a memory page where all the Guests on + * the network publish their MAC (ethernet) addresses: it's an array of "struct + * lguest_net": */ struct lguest_net { /* Simply the mac address (with multicast bit meaning promisc). */ unsigned char mac[6]; }; +/*:*/ /* Where the Host expects the Guest to SEND_DMA console output to. */ #define LGUEST_CONSOLE_DMA_KEY 0 -/* We have a page of these descriptors in the lguest_device page. */ +/*D:010 + * Drivers + * + * The Guest needs devices to do anything useful. Since we don't let it touch + * real devices (think of the damage it could do!) we provide virtual devices. + * We could emulate a PCI bus with various devices on it, but that is a fairly + * complex burden for the Host and suboptimal for the Guest, so we have our own + * "lguest" bus and simple drivers. + * + * Devices are described by an array of LGUEST_MAX_DEVICES of these structs, + * placed by the Launcher just above the top of physical memory: + */ struct lguest_device_desc { + /* The device type: console, network, disk etc. */ u16 type; #define LGUEST_DEVICE_T_CONSOLE 1 #define LGUEST_DEVICE_T_NET 2 #define LGUEST_DEVICE_T_BLOCK 3 + /* The specific features of this device: these depends on device type + * except for LGUEST_DEVICE_F_RANDOMNESS. */ u16 features; #define LGUEST_NET_F_NOCSUM 0x4000 /* Don't bother checksumming */ #define LGUEST_DEVICE_F_RANDOMNESS 0x8000 /* IRQ is fairly random */ + /* This is how the Guest reports status of the device: the Host can set + * LGUEST_DEVICE_S_REMOVED to indicate removal, but the rest are only + * ever manipulated by the Guest, and only ever set. */ u16 status; /* 256 and above are device specific. */ #define LGUEST_DEVICE_S_ACKNOWLEDGE 1 /* We have seen device. */ @@ -58,9 +109,12 @@ struct lguest_device_desc { #define LGUEST_DEVICE_S_REMOVED_ACK 16 /* Driver has been told. */ #define LGUEST_DEVICE_S_FAILED 128 /* Something actually failed */ + /* Each device exists somewhere in Guest physical memory, over some + * number of pages. */ u16 num_pages; u32 pfn; }; +/*:*/ /* Write command first word is a request. */ enum lguest_req diff --git a/include/linux/mm.h b/include/linux/mm.h index c456c3a1c28..3e9e8fec5a4 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1246,7 +1246,7 @@ void drop_slab(void); extern int randomize_va_space; #endif -__attribute__((weak)) const char *arch_vma_name(struct vm_area_struct *vma); +const char * arch_vma_name(struct vm_area_struct *vma); #endif /* __KERNEL__ */ #endif /* _LINUX_MM_H */ diff --git a/include/linux/netfilter/xt_connlimit.h b/include/linux/netfilter/xt_connlimit.h index 90ae8b474cb..37e933c9987 100644 --- a/include/linux/netfilter/xt_connlimit.h +++ b/include/linux/netfilter/xt_connlimit.h @@ -5,8 +5,8 @@ struct xt_connlimit_data; struct xt_connlimit_info { union { - u_int32_t v4_mask; - u_int32_t v6_mask[4]; + __be32 v4_mask; + __be32 v6_mask[4]; }; unsigned int limit, inverse; diff --git a/include/linux/pnp.h b/include/linux/pnp.h index 66edb229318..16b46aace34 100644 --- a/include/linux/pnp.h +++ b/include/linux/pnp.h @@ -1,7 +1,6 @@ /* * Linux Plug and Play Support * Copyright by Adam Belay <ambx1@neo.rr.com> - * */ #ifndef _LINUX_PNP_H @@ -23,7 +22,6 @@ struct pnp_protocol; struct pnp_dev; - /* * Resource Management */ @@ -73,37 +71,37 @@ struct pnp_dev; #define PNP_PORT_FLAG_FIXED (1<<1) struct pnp_port { - unsigned short min; /* min base number */ - unsigned short max; /* max base number */ - unsigned char align; /* align boundary */ - unsigned char size; /* size of range */ - unsigned char flags; /* port flags */ - unsigned char pad; /* pad */ - struct pnp_port *next; /* next port */ + unsigned short min; /* min base number */ + unsigned short max; /* max base number */ + unsigned char align; /* align boundary */ + unsigned char size; /* size of range */ + unsigned char flags; /* port flags */ + unsigned char pad; /* pad */ + struct pnp_port *next; /* next port */ }; #define PNP_IRQ_NR 256 struct pnp_irq { - DECLARE_BITMAP(map, PNP_IRQ_NR); /* bitmaks for IRQ lines */ - unsigned char flags; /* IRQ flags */ - unsigned char pad; /* pad */ - struct pnp_irq *next; /* next IRQ */ + DECLARE_BITMAP(map, PNP_IRQ_NR); /* bitmask for IRQ lines */ + unsigned char flags; /* IRQ flags */ + unsigned char pad; /* pad */ + struct pnp_irq *next; /* next IRQ */ }; struct pnp_dma { - unsigned char map; /* bitmask for DMA channels */ - unsigned char flags; /* DMA flags */ - struct pnp_dma *next; /* next port */ + unsigned char map; /* bitmask for DMA channels */ + unsigned char flags; /* DMA flags */ + struct pnp_dma *next; /* next port */ }; struct pnp_mem { - unsigned int min; /* min base number */ - unsigned int max; /* max base number */ - unsigned int align; /* align boundary */ - unsigned int size; /* size of range */ - unsigned char flags; /* memory flags */ - unsigned char pad; /* pad */ - struct pnp_mem *next; /* next memory resource */ + unsigned int min; /* min base number */ + unsigned int max; /* max base number */ + unsigned int align; /* align boundary */ + unsigned int size; /* size of range */ + unsigned char flags; /* memory flags */ + unsigned char pad; /* pad */ + struct pnp_mem *next; /* next memory resource */ }; #define PNP_RES_PRIORITY_PREFERRED 0 @@ -127,7 +125,6 @@ struct pnp_resource_table { struct resource irq_resource[PNP_MAX_IRQ]; }; - /* * Device Managemnt */ @@ -139,14 +136,14 @@ struct pnp_card { struct list_head protocol_list; /* node in protocol's list of cards */ struct list_head devices; /* devices attached to the card */ - struct pnp_protocol * protocol; - struct pnp_id * id; /* contains supported EISA IDs*/ + struct pnp_protocol *protocol; + struct pnp_id *id; /* contains supported EISA IDs */ char name[PNP_NAME_LEN]; /* contains a human-readable name */ - unsigned char pnpver; /* Plug & Play version */ - unsigned char productver; /* product version */ - unsigned int serial; /* serial number */ - unsigned char checksum; /* if zero - checksum passed */ + unsigned char pnpver; /* Plug & Play version */ + unsigned char productver; /* product version */ + unsigned int serial; /* serial number */ + unsigned char checksum; /* if zero - checksum passed */ struct proc_dir_entry *procdir; /* directory entry in /proc/bus/isapnp */ }; @@ -159,18 +156,18 @@ struct pnp_card { (card) = global_to_pnp_card((card)->global_list.next)) struct pnp_card_link { - struct pnp_card * card; - struct pnp_card_driver * driver; - void * driver_data; + struct pnp_card *card; + struct pnp_card_driver *driver; + void *driver_data; pm_message_t pm_state; }; -static inline void *pnp_get_card_drvdata (struct pnp_card_link *pcard) +static inline void *pnp_get_card_drvdata(struct pnp_card_link *pcard) { return pcard->driver_data; } -static inline void pnp_set_card_drvdata (struct pnp_card_link *pcard, void *data) +static inline void pnp_set_card_drvdata(struct pnp_card_link *pcard, void *data) { pcard->driver_data = data; } @@ -186,22 +183,22 @@ struct pnp_dev { struct list_head card_list; /* node in card's list of devices */ struct list_head rdev_list; /* node in cards list of requested devices */ - struct pnp_protocol * protocol; - struct pnp_card * card; /* card the device is attached to, none if NULL */ - struct pnp_driver * driver; - struct pnp_card_link * card_link; + struct pnp_protocol *protocol; + struct pnp_card *card; /* card the device is attached to, none if NULL */ + struct pnp_driver *driver; + struct pnp_card_link *card_link; - struct pnp_id * id; /* supported EISA IDs*/ + struct pnp_id *id; /* supported EISA IDs */ int active; int capabilities; - struct pnp_option * independent; - struct pnp_option * dependent; + struct pnp_option *independent; + struct pnp_option *dependent; struct pnp_resource_table res; char name[PNP_NAME_LEN]; /* contains a human-readable name */ - unsigned short regs; /* ISAPnP: supported registers */ - int flags; /* used by protocols */ + unsigned short regs; /* ISAPnP: supported registers */ + int flags; /* used by protocols */ struct proc_dir_entry *procent; /* device entry in /proc/bus/isapnp */ void *data; }; @@ -220,19 +217,19 @@ struct pnp_dev { (dev) = card_to_pnp_dev((dev)->card_list.next)) #define pnp_dev_name(dev) (dev)->name -static inline void *pnp_get_drvdata (struct pnp_dev *pdev) +static inline void *pnp_get_drvdata(struct pnp_dev *pdev) { return dev_get_drvdata(&pdev->dev); } -static inline void pnp_set_drvdata (struct pnp_dev *pdev, void *data) +static inline void pnp_set_drvdata(struct pnp_dev *pdev, void *data) { dev_set_drvdata(&pdev->dev, data); } struct pnp_fixup { char id[7]; - void (*quirk_function)(struct pnp_dev *dev); /* fixup function */ + void (*quirk_function) (struct pnp_dev * dev); /* fixup function */ }; /* config parameters */ @@ -269,7 +266,6 @@ extern struct pnp_protocol pnpbios_protocol; #define pnp_device_is_pnpbios(dev) 0 #endif - /* status */ #define PNP_READY 0x0000 #define PNP_ATTACHED 0x0001 @@ -287,17 +283,17 @@ extern struct pnp_protocol pnpbios_protocol; struct pnp_id { char id[PNP_ID_LEN]; - struct pnp_id * next; + struct pnp_id *next; }; struct pnp_driver { - char * name; + char *name; const struct pnp_device_id *id_table; unsigned int flags; - int (*probe) (struct pnp_dev *dev, const struct pnp_device_id *dev_id); + int (*probe) (struct pnp_dev *dev, const struct pnp_device_id *dev_id); void (*remove) (struct pnp_dev *dev); - int (*suspend) (struct pnp_dev *dev, pm_message_t state); - int (*resume) (struct pnp_dev *dev); + int (*suspend) (struct pnp_dev *dev, pm_message_t state); + int (*resume) (struct pnp_dev *dev); struct device_driver driver; }; @@ -305,13 +301,14 @@ struct pnp_driver { struct pnp_card_driver { struct list_head global_list; - char * name; + char *name; const struct pnp_card_device_id *id_table; unsigned int flags; - int (*probe) (struct pnp_card_link *card, const struct pnp_card_device_id *card_id); + int (*probe) (struct pnp_card_link *card, + const struct pnp_card_device_id *card_id); void (*remove) (struct pnp_card_link *card); - int (*suspend) (struct pnp_card_link *card, pm_message_t state); - int (*resume) (struct pnp_card_link *card); + int (*suspend) (struct pnp_card_link *card, pm_message_t state); + int (*resume) (struct pnp_card_link *card); struct pnp_driver link; }; @@ -321,29 +318,28 @@ struct pnp_card_driver { #define PNP_DRIVER_RES_DO_NOT_CHANGE 0x0001 /* do not change the state of the device */ #define PNP_DRIVER_RES_DISABLE 0x0003 /* ensure the device is disabled */ - /* * Protocol Management */ struct pnp_protocol { - struct list_head protocol_list; - char * name; + struct list_head protocol_list; + char *name; /* resource control functions */ - int (*get)(struct pnp_dev *dev, struct pnp_resource_table *res); - int (*set)(struct pnp_dev *dev, struct pnp_resource_table *res); - int (*disable)(struct pnp_dev *dev); + int (*get) (struct pnp_dev *dev, struct pnp_resource_table *res); + int (*set) (struct pnp_dev *dev, struct pnp_resource_table *res); + int (*disable) (struct pnp_dev *dev); /* protocol specific suspend/resume */ - int (*suspend)(struct pnp_dev *dev, pm_message_t state); - int (*resume)(struct pnp_dev *dev); + int (*suspend) (struct pnp_dev * dev, pm_message_t state); + int (*resume) (struct pnp_dev * dev); /* used by pnp layer only (look but don't touch) */ - unsigned char number; /* protocol number*/ - struct device dev; /* link to driver model */ - struct list_head cards; - struct list_head devices; + unsigned char number; /* protocol number */ + struct device dev; /* link to driver model */ + struct list_head cards; + struct list_head devices; }; #define to_pnp_protocol(n) list_entry(n, struct pnp_protocol, protocol_list) @@ -356,7 +352,6 @@ struct pnp_protocol { (dev) != protocol_to_pnp_dev(&(protocol)->devices); \ (dev) = protocol_to_pnp_dev((dev)->protocol_list.next)) - extern struct bus_type pnp_bus_type; #if defined(CONFIG_PNP) @@ -376,21 +371,25 @@ void pnp_remove_card(struct pnp_card *card); int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev); void pnp_remove_card_device(struct pnp_dev *dev); int pnp_add_card_id(struct pnp_id *id, struct pnp_card *card); -struct pnp_dev * pnp_request_card_device(struct pnp_card_link *clink, const char * id, struct pnp_dev * from); -void pnp_release_card_device(struct pnp_dev * dev); -int pnp_register_card_driver(struct pnp_card_driver * drv); -void pnp_unregister_card_driver(struct pnp_card_driver * drv); +struct pnp_dev *pnp_request_card_device(struct pnp_card_link *clink, + const char *id, struct pnp_dev *from); +void pnp_release_card_device(struct pnp_dev *dev); +int pnp_register_card_driver(struct pnp_card_driver *drv); +void pnp_unregister_card_driver(struct pnp_card_driver *drv); extern struct list_head pnp_cards; /* resource management */ -struct pnp_option * pnp_register_independent_option(struct pnp_dev *dev); -struct pnp_option * pnp_register_dependent_option(struct pnp_dev *dev, int priority); +struct pnp_option *pnp_register_independent_option(struct pnp_dev *dev); +struct pnp_option *pnp_register_dependent_option(struct pnp_dev *dev, + int priority); int pnp_register_irq_resource(struct pnp_option *option, struct pnp_irq *data); int pnp_register_dma_resource(struct pnp_option *option, struct pnp_dma *data); -int pnp_register_port_resource(struct pnp_option *option, struct pnp_port *data); +int pnp_register_port_resource(struct pnp_option *option, + struct pnp_port *data); int pnp_register_mem_resource(struct pnp_option *option, struct pnp_mem *data); void pnp_init_resource_table(struct pnp_resource_table *table); -int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res, int mode); +int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res, + int mode); int pnp_auto_config_dev(struct pnp_dev *dev); int pnp_validate_config(struct pnp_dev *dev); int pnp_start_dev(struct pnp_dev *dev); @@ -398,11 +397,11 @@ int pnp_stop_dev(struct pnp_dev *dev); int pnp_activate_dev(struct pnp_dev *dev); int pnp_disable_dev(struct pnp_dev *dev); void pnp_resource_change(struct resource *resource, resource_size_t start, - resource_size_t size); + resource_size_t size); /* protocol helpers */ -int pnp_is_active(struct pnp_dev * dev); -int compare_pnp_id(struct pnp_id * pos, const char * id); +int pnp_is_active(struct pnp_dev *dev); +int compare_pnp_id(struct pnp_id *pos, const char *id); int pnp_add_id(struct pnp_id *id, struct pnp_dev *dev); int pnp_register_driver(struct pnp_driver *drv); void pnp_unregister_driver(struct pnp_driver *drv); @@ -415,23 +414,24 @@ static inline void pnp_unregister_protocol(struct pnp_protocol *protocol) { } static inline int pnp_init_device(struct pnp_dev *dev) { return -ENODEV; } static inline int pnp_add_device(struct pnp_dev *dev) { return -ENODEV; } static inline int pnp_device_attach(struct pnp_dev *pnp_dev) { return -ENODEV; } -static inline void pnp_device_detach(struct pnp_dev *pnp_dev) { ; } +static inline void pnp_device_detach(struct pnp_dev *pnp_dev) { } + #define pnp_platform_devices 0 /* multidevice card support */ static inline int pnp_add_card(struct pnp_card *card) { return -ENODEV; } -static inline void pnp_remove_card(struct pnp_card *card) { ; } +static inline void pnp_remove_card(struct pnp_card *card) { } static inline int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev) { return -ENODEV; } -static inline void pnp_remove_card_device(struct pnp_dev *dev) { ; } +static inline void pnp_remove_card_device(struct pnp_dev *dev) { } static inline int pnp_add_card_id(struct pnp_id *id, struct pnp_card *card) { return -ENODEV; } -static inline struct pnp_dev * pnp_request_card_device(struct pnp_card_link *clink, const char * id, struct pnp_dev * from) { return NULL; } -static inline void pnp_release_card_device(struct pnp_dev * dev) { ; } -static inline int pnp_register_card_driver(struct pnp_card_driver * drv) { return -ENODEV; } -static inline void pnp_unregister_card_driver(struct pnp_card_driver * drv) { ; } +static inline struct pnp_dev *pnp_request_card_device(struct pnp_card_link *clink, const char *id, struct pnp_dev *from) { return NULL; } +static inline void pnp_release_card_device(struct pnp_dev *dev) { } +static inline int pnp_register_card_driver(struct pnp_card_driver *drv) { return -ENODEV; } +static inline void pnp_unregister_card_driver(struct pnp_card_driver *drv) { } /* resource management */ -static inline struct pnp_option * pnp_register_independent_option(struct pnp_dev *dev) { return NULL; } -static inline struct pnp_option * pnp_register_dependent_option(struct pnp_dev *dev, int priority) { return NULL; } +static inline struct pnp_option *pnp_register_independent_option(struct pnp_dev *dev) { return NULL; } +static inline struct pnp_option *pnp_register_dependent_option(struct pnp_dev *dev, int priority) { return NULL; } static inline int pnp_register_irq_resource(struct pnp_option *option, struct pnp_irq *data) { return -ENODEV; } static inline int pnp_register_dma_resource(struct pnp_option *option, struct pnp_dma *data) { return -ENODEV; } static inline int pnp_register_port_resource(struct pnp_option *option, struct pnp_port *data) { return -ENODEV; } @@ -444,20 +444,17 @@ static inline int pnp_start_dev(struct pnp_dev *dev) { return -ENODEV; } static inline int pnp_stop_dev(struct pnp_dev *dev) { return -ENODEV; } static inline int pnp_activate_dev(struct pnp_dev *dev) { return -ENODEV; } static inline int pnp_disable_dev(struct pnp_dev *dev) { return -ENODEV; } -static inline void pnp_resource_change(struct resource *resource, - resource_size_t start, - resource_size_t size) { } +static inline void pnp_resource_change(struct resource *resource, resource_size_t start, resource_size_t size) { } /* protocol helpers */ -static inline int pnp_is_active(struct pnp_dev * dev) { return 0; } -static inline int compare_pnp_id(struct pnp_id * pos, const char * id) { return -ENODEV; } +static inline int pnp_is_active(struct pnp_dev *dev) { return 0; } +static inline int compare_pnp_id(struct pnp_id *pos, const char *id) { return -ENODEV; } static inline int pnp_add_id(struct pnp_id *id, struct pnp_dev *dev) { return -ENODEV; } static inline int pnp_register_driver(struct pnp_driver *drv) { return -ENODEV; } -static inline void pnp_unregister_driver(struct pnp_driver *drv) { ; } +static inline void pnp_unregister_driver(struct pnp_driver *drv) { } #endif /* CONFIG_PNP */ - #define pnp_err(format, arg...) printk(KERN_ERR "pnp: " format "\n" , ## arg) #define pnp_info(format, arg...) printk(KERN_INFO "pnp: " format "\n" , ## arg) #define pnp_warn(format, arg...) printk(KERN_WARNING "pnp: " format "\n" , ## arg) diff --git a/include/linux/pnpbios.h b/include/linux/pnpbios.h index 0a282ac1f6b..329192adc9d 100644 --- a/include/linux/pnpbios.h +++ b/include/linux/pnpbios.h @@ -99,32 +99,32 @@ #pragma pack(1) struct pnp_dev_node_info { - __u16 no_nodes; - __u16 max_node_size; + __u16 no_nodes; + __u16 max_node_size; }; struct pnp_docking_station_info { - __u32 location_id; - __u32 serial; - __u16 capabilities; + __u32 location_id; + __u32 serial; + __u16 capabilities; }; struct pnp_isa_config_struc { - __u8 revision; - __u8 no_csns; - __u16 isa_rd_data_port; - __u16 reserved; + __u8 revision; + __u8 no_csns; + __u16 isa_rd_data_port; + __u16 reserved; }; struct escd_info_struc { - __u16 min_escd_write_size; - __u16 escd_size; - __u32 nv_storage_base; + __u16 min_escd_write_size; + __u16 escd_size; + __u32 nv_storage_base; }; struct pnp_bios_node { - __u16 size; - __u8 handle; - __u32 eisa_id; - __u8 type_code[3]; - __u16 flags; - __u8 data[0]; + __u16 size; + __u8 handle; + __u32 eisa_id; + __u8 type_code[3]; + __u16 flags; + __u8 data[0]; }; #pragma pack() @@ -133,22 +133,16 @@ struct pnp_bios_node { /* non-exported */ extern struct pnp_dev_node_info node_info; -extern int pnp_bios_dev_node_info (struct pnp_dev_node_info *data); -extern int pnp_bios_get_dev_node (u8 *nodenum, char config, struct pnp_bios_node *data); -extern int pnp_bios_set_dev_node (u8 nodenum, char config, struct pnp_bios_node *data); -extern int pnp_bios_get_stat_res (char *info); -extern int pnp_bios_isapnp_config (struct pnp_isa_config_struc *data); -extern int pnp_bios_escd_info (struct escd_info_struc *data); -extern int pnp_bios_read_escd (char *data, u32 nvram_base); +extern int pnp_bios_dev_node_info(struct pnp_dev_node_info *data); +extern int pnp_bios_get_dev_node(u8 *nodenum, char config, + struct pnp_bios_node *data); +extern int pnp_bios_set_dev_node(u8 nodenum, char config, + struct pnp_bios_node *data); +extern int pnp_bios_get_stat_res(char *info); +extern int pnp_bios_isapnp_config(struct pnp_isa_config_struc *data); +extern int pnp_bios_escd_info(struct escd_info_struc *data); +extern int pnp_bios_read_escd(char *data, u32 nvram_base); extern int pnp_bios_dock_station_info(struct pnp_docking_station_info *data); -#define needed 0 -#if needed -extern int pnp_bios_get_event (u16 *message); -extern int pnp_bios_send_message (u16 message); -extern int pnp_bios_set_stat_res (char *info); -extern int pnp_bios_apm_id_table (char *table, u16 *size); -extern int pnp_bios_write_escd (char *data, u32 nvram_base); -#endif #endif /* CONFIG_PNPBIOS */ diff --git a/include/linux/preempt.h b/include/linux/preempt.h index d0926d63406..484988ed301 100644 --- a/include/linux/preempt.h +++ b/include/linux/preempt.h @@ -8,6 +8,7 @@ #include <linux/thread_info.h> #include <linux/linkage.h> +#include <linux/list.h> #ifdef CONFIG_DEBUG_PREEMPT extern void fastcall add_preempt_count(int val); @@ -60,4 +61,47 @@ do { \ #endif +#ifdef CONFIG_PREEMPT_NOTIFIERS + +struct preempt_notifier; + +/** + * preempt_ops - notifiers called when a task is preempted and rescheduled + * @sched_in: we're about to be rescheduled: + * notifier: struct preempt_notifier for the task being scheduled + * cpu: cpu we're scheduled on + * @sched_out: we've just been preempted + * notifier: struct preempt_notifier for the task being preempted + * next: the task that's kicking us out + */ +struct preempt_ops { + void (*sched_in)(struct preempt_notifier *notifier, int cpu); + void (*sched_out)(struct preempt_notifier *notifier, + struct task_struct *next); +}; + +/** + * preempt_notifier - key for installing preemption notifiers + * @link: internal use + * @ops: defines the notifier functions to be called + * + * Usually used in conjunction with container_of(). + */ +struct preempt_notifier { + struct hlist_node link; + struct preempt_ops *ops; +}; + +void preempt_notifier_register(struct preempt_notifier *notifier); +void preempt_notifier_unregister(struct preempt_notifier *notifier); + +static inline void preempt_notifier_init(struct preempt_notifier *notifier, + struct preempt_ops *ops) +{ + INIT_HLIST_NODE(¬ifier->link); + notifier->ops = ops; +} + +#endif + #endif /* __LINUX_PREEMPT_H */ diff --git a/include/linux/sched.h b/include/linux/sched.h index 33b9b4841ee..2e490271acf 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -681,7 +681,7 @@ enum cpu_idle_type { #define SCHED_LOAD_SHIFT 10 #define SCHED_LOAD_SCALE (1L << SCHED_LOAD_SHIFT) -#define SCHED_LOAD_SCALE_FUZZ (SCHED_LOAD_SCALE >> 5) +#define SCHED_LOAD_SCALE_FUZZ (SCHED_LOAD_SCALE >> 1) #ifdef CONFIG_SMP #define SD_LOAD_BALANCE 1 /* Do load balancing on this domain. */ @@ -786,6 +786,22 @@ extern int partition_sched_domains(cpumask_t *partition1, #endif /* CONFIG_SMP */ +/* + * A runqueue laden with a single nice 0 task scores a weighted_cpuload of + * SCHED_LOAD_SCALE. This function returns 1 if any cpu is laden with a + * task of nice 0 or enough lower priority tasks to bring up the + * weighted_cpuload + */ +static inline int above_background_load(void) +{ + unsigned long cpu; + + for_each_online_cpu(cpu) { + if (weighted_cpuload(cpu) >= SCHED_LOAD_SCALE) + return 1; + } + return 0; +} struct io_context; /* See blkdev.h */ struct cpuset; @@ -935,6 +951,11 @@ struct task_struct { struct sched_class *sched_class; struct sched_entity se; +#ifdef CONFIG_PREEMPT_NOTIFIERS + /* list of struct preempt_notifier: */ + struct hlist_head preempt_notifiers; +#endif + unsigned short ioprio; #ifdef CONFIG_BLK_DEV_IO_TRACE unsigned int btrace_seq; diff --git a/include/linux/suspend.h b/include/linux/suspend.h index e8e6da394c9..618f93c32b7 100644 --- a/include/linux/suspend.h +++ b/include/linux/suspend.h @@ -125,6 +125,9 @@ static inline int unregister_pm_notifier(struct notifier_block *nb) static inline void register_nosave_region(unsigned long b, unsigned long e) { } +static inline void register_nosave_region_late(unsigned long b, unsigned long e) +{ +} #endif #endif /* _LINUX_SWSUSP_H */ diff --git a/include/net/netfilter/nf_conntrack_tuple.h b/include/net/netfilter/nf_conntrack_tuple.h index 040dae5f0c9..c48e390f4b0 100644 --- a/include/net/netfilter/nf_conntrack_tuple.h +++ b/include/net/netfilter/nf_conntrack_tuple.h @@ -35,7 +35,7 @@ union nf_conntrack_address { union nf_conntrack_man_proto { /* Add other protocols here. */ - u_int16_t all; + __be16 all; struct { __be16 port; @@ -73,7 +73,7 @@ struct nf_conntrack_tuple union nf_conntrack_address u3; union { /* Add other protocols here. */ - u_int16_t all; + __be16 all; struct { __be16 port; diff --git a/include/xen/page.h b/include/xen/page.h index 1df6c193057..c0c8fcb2789 100644 --- a/include/xen/page.h +++ b/include/xen/page.h @@ -4,6 +4,7 @@ #include <linux/pfn.h> #include <asm/uaccess.h> +#include <asm/pgtable.h> #include <xen/features.h> |