aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/Kbuild2
-rw-r--r--include/linux/acpi.h8
-rw-r--r--include/linux/aer.h25
-rw-r--r--include/linux/aio.h2
-rw-r--r--include/linux/apm_bios.h20
-rw-r--r--include/linux/arcdevice.h4
-rw-r--r--include/linux/async_tx.h6
-rw-r--r--include/linux/ata.h138
-rw-r--r--include/linux/audit.h45
-rw-r--r--include/linux/backlight.h20
-rw-r--r--include/linux/binfmts.h19
-rw-r--r--include/linux/bio.h9
-rw-r--r--include/linux/blkdev.h183
-rw-r--r--include/linux/blktrace_api.h12
-rw-r--r--include/linux/bsg.h25
-rw-r--r--include/linux/buffer_head.h2
-rw-r--r--include/linux/clockchips.h15
-rw-r--r--include/linux/clocksource.h6
-rw-r--r--include/linux/coda_linux.h4
-rw-r--r--include/linux/coda_proc.h76
-rw-r--r--include/linux/coda_psdev.h15
-rw-r--r--include/linux/compiler-gcc4.h18
-rw-r--r--include/linux/compiler.h13
-rw-r--r--include/linux/connector.h2
-rw-r--r--include/linux/cpu.h8
-rw-r--r--include/linux/cpufreq.h50
-rw-r--r--include/linux/crypto.h214
-rw-r--r--include/linux/dccp.h22
-rw-r--r--include/linux/dcookies.h1
-rw-r--r--include/linux/debugfs.h27
-rw-r--r--include/linux/device.h30
-rw-r--r--include/linux/dmi.h22
-rw-r--r--include/linux/dvb/video.h1
-rw-r--r--include/linux/edac.h29
-rw-r--r--include/linux/eeprom_93cx6.h3
-rw-r--r--include/linux/elevator.h76
-rw-r--r--include/linux/elf-em.h3
-rw-r--r--include/linux/elf.h14
-rw-r--r--include/linux/elfnote.h22
-rw-r--r--include/linux/etherdevice.h20
-rw-r--r--include/linux/ethtool.h40
-rw-r--r--include/linux/ext4_fs.h104
-rw-r--r--include/linux/ext4_fs_extents.h43
-rw-r--r--include/linux/ext4_fs_i.h5
-rw-r--r--include/linux/ext4_fs_sb.h3
-rw-r--r--include/linux/falloc.h6
-rw-r--r--include/linux/freezer.h15
-rw-r--r--include/linux/fs.h35
-rw-r--r--include/linux/fs_enet_pd.h6
-rw-r--r--include/linux/fsl_devices.h1
-rw-r--r--include/linux/genetlink.h13
-rw-r--r--include/linux/genhd.h2
-rw-r--r--include/linux/gfs2_ondisk.h30
-rw-r--r--include/linux/highmem.h15
-rw-r--r--include/linux/hugetlb.h12
-rw-r--r--include/linux/i2c-id.h9
-rw-r--r--include/linux/i2c-isa.h36
-rw-r--r--include/linux/i2c.h5
-rw-r--r--include/linux/i2o.h3
-rw-r--r--include/linux/ide.h86
-rw-r--r--include/linux/ieee80211.h61
-rw-r--r--include/linux/if_arcnet.h2
-rw-r--r--include/linux/if_bridge.h2
-rw-r--r--include/linux/if_eql.h1
-rw-r--r--include/linux/if_ether.h10
-rw-r--r--include/linux/if_link.h1
-rw-r--r--include/linux/if_pppol2tp.h4
-rw-r--r--include/linux/if_pppox.h14
-rw-r--r--include/linux/if_shaper.h12
-rw-r--r--include/linux/if_tun.h1
-rw-r--r--include/linux/if_vlan.h2
-rw-r--r--include/linux/inet_lro.h177
-rw-r--r--include/linux/init.h9
-rw-r--r--include/linux/init_task.h4
-rw-r--r--include/linux/input.h9
-rw-r--r--include/linux/interrupt.h6
-rw-r--r--include/linux/ioprio.h8
-rw-r--r--include/linux/ipv6.h26
-rw-r--r--include/linux/irda.h1
-rw-r--r--include/linux/irq.h1
-rw-r--r--include/linux/isa.h11
-rw-r--r--include/linux/isdn.h9
-rw-r--r--include/linux/ivtv.h72
-rw-r--r--include/linux/ivtvfb.h42
-rw-r--r--include/linux/jbd2.h6
-rw-r--r--include/linux/jiffies.h6
-rw-r--r--include/linux/kbd_kern.h3
-rw-r--r--include/linux/kdebug.h2
-rw-r--r--include/linux/kernel.h27
-rw-r--r--include/linux/keyboard.h4
-rw-r--r--include/linux/kmod.h52
-rw-r--r--include/linux/kobject.h156
-rw-r--r--include/linux/kprobes.h6
-rw-r--r--include/linux/ktime.h21
-rw-r--r--include/linux/lcd.h14
-rw-r--r--include/linux/leds.h18
-rw-r--r--include/linux/lguest.h116
-rw-r--r--include/linux/lguest_bus.h51
-rw-r--r--include/linux/lguest_launcher.h127
-rw-r--r--include/linux/libata.h353
-rw-r--r--include/linux/list.h14
-rw-r--r--include/linux/lockdep.h71
-rw-r--r--include/linux/loop.h2
-rw-r--r--include/linux/major.h2
-rw-r--r--include/linux/mdio-bitbang.h42
-rw-r--r--include/linux/mempolicy.h6
-rw-r--r--include/linux/mlx4/device.h27
-rw-r--r--include/linux/mm.h143
-rw-r--r--include/linux/mmc/card.h32
-rw-r--r--include/linux/mmc/core.h65
-rw-r--r--include/linux/mmc/host.h39
-rw-r--r--include/linux/mmc/mmc.h39
-rw-r--r--include/linux/mmc/sdio.h159
-rw-r--r--include/linux/mmc/sdio_func.h153
-rw-r--r--include/linux/mmc/sdio_ids.h23
-rw-r--r--include/linux/mmzone.h19
-rw-r--r--include/linux/mod_devicetable.h33
-rw-r--r--include/linux/mv643xx.h8
-rw-r--r--include/linux/namei.h4
-rw-r--r--include/linux/net.h3
-rw-r--r--include/linux/netdevice.h506
-rw-r--r--include/linux/netfilter.h5
-rw-r--r--include/linux/netfilter/Kbuild2
-rw-r--r--include/linux/netfilter/nfnetlink.h98
-rw-r--r--include/linux/netfilter/nfnetlink_compat.h61
-rw-r--r--include/linux/netfilter/nfnetlink_conntrack.h1
-rw-r--r--include/linux/netfilter/xt_connlimit.h4
-rw-r--r--include/linux/netfilter/xt_time.h25
-rw-r--r--include/linux/netfilter_ipv4/ipt_iprange.h2
-rw-r--r--include/linux/netlink.h26
-rw-r--r--include/linux/netpoll.h56
-rw-r--r--include/linux/nfs_fs.h7
-rw-r--r--include/linux/nfs_xdr.h32
-rw-r--r--include/linux/nfsd/export.h13
-rw-r--r--include/linux/nl80211.h97
-rw-r--r--include/linux/notifier.h19
-rw-r--r--include/linux/nsproxy.h1
-rw-r--r--include/linux/of.h60
-rw-r--r--include/linux/of_device.h26
-rw-r--r--include/linux/of_platform.h57
-rw-r--r--include/linux/oprofile.h35
-rw-r--r--include/linux/page-flags.h50
-rw-r--r--include/linux/pci.h12
-rw-r--r--include/linux/pci_ids.h68
-rw-r--r--include/linux/pci_regs.h21
-rw-r--r--include/linux/phy.h3
-rw-r--r--include/linux/phy_fixed.h38
-rw-r--r--include/linux/pkt_sched.h4
-rw-r--r--include/linux/platform_device.h7
-rw-r--r--include/linux/pm.h28
-rw-r--r--include/linux/pmu.h2
-rw-r--r--include/linux/pnp.h191
-rw-r--r--include/linux/pnpbios.h60
-rw-r--r--include/linux/poll.h2
-rw-r--r--include/linux/preempt.h44
-rw-r--r--include/linux/proc_fs.h42
-rw-r--r--include/linux/raid/md_k.h4
-rw-r--r--include/linux/rcupdate.h1
-rw-r--r--include/linux/reboot.h5
-rw-r--r--include/linux/reiserfs_fs.h8
-rw-r--r--include/linux/resume-trace.h19
-rw-r--r--include/linux/rfkill.h40
-rw-r--r--include/linux/rtnetlink.h31
-rw-r--r--include/linux/sched.h109
-rw-r--r--include/linux/sctp.h109
-rw-r--r--include/linux/security.h20
-rw-r--r--include/linux/selection.h2
-rw-r--r--include/linux/seq_file.h2
-rw-r--r--include/linux/serial_8250.h4
-rw-r--r--include/linux/serial_core.h7
-rw-r--r--include/linux/serial_reg.h1
-rw-r--r--include/linux/signal.h3
-rw-r--r--include/linux/signalfd.h40
-rw-r--r--include/linux/skbuff.h44
-rw-r--r--include/linux/slab.h5
-rw-r--r--include/linux/slub_def.h10
-rw-r--r--include/linux/snmp.h33
-rw-r--r--include/linux/spi/mmc_spi.h33
-rw-r--r--include/linux/spi/spi.h59
-rw-r--r--include/linux/spi/spidev.h4
-rw-r--r--include/linux/spinlock_types.h4
-rw-r--r--include/linux/spinlock_types_up.h9
-rw-r--r--include/linux/ssb/ssb.h424
-rw-r--r--include/linux/ssb/ssb_driver_chipcommon.h396
-rw-r--r--include/linux/ssb/ssb_driver_extif.h204
-rw-r--r--include/linux/ssb/ssb_driver_mips.h46
-rw-r--r--include/linux/ssb/ssb_driver_pci.h106
-rw-r--r--include/linux/ssb/ssb_regs.h292
-rw-r--r--include/linux/stacktrace.h2
-rw-r--r--include/linux/string.h4
-rw-r--r--include/linux/sunrpc/xdr.h16
-rw-r--r--include/linux/suspend.h57
-rw-r--r--include/linux/swap.h2
-rw-r--r--include/linux/syscalls.h3
-rw-r--r--include/linux/sysctl.h2
-rw-r--r--include/linux/sysfs.h147
-rw-r--r--include/linux/tc_act/tc_nat.h29
-rw-r--r--include/linux/tcp.h10
-rw-r--r--include/linux/time.h11
-rw-r--r--include/linux/timex.h60
-rw-r--r--include/linux/topology.h1
-rw-r--r--include/linux/tty.h3
-rw-r--r--include/linux/uio_driver.h91
-rw-r--r--include/linux/umem.h138
-rw-r--r--include/linux/usb.h81
-rw-r--r--include/linux/usb/gadget.h (renamed from include/linux/usb_gadget.h)97
-rw-r--r--include/linux/usb/quirks.h7
-rw-r--r--include/linux/usb/serial.h20
-rw-r--r--include/linux/usb_sl811.h26
-rw-r--r--include/linux/user_namespace.h4
-rw-r--r--include/linux/video_output.h4
-rw-r--r--include/linux/videodev2.h10
-rw-r--r--include/linux/vmalloc.h11
-rw-r--r--include/linux/writeback.h3
-rw-r--r--include/linux/xilinxfb.h30
-rw-r--r--include/linux/zlib.h6
216 files changed, 6732 insertions, 1933 deletions
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index bcf875e844fe..818cc3a50e6b 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -7,6 +7,7 @@ header-y += raid/
7header-y += spi/ 7header-y += spi/
8header-y += sunrpc/ 8header-y += sunrpc/
9header-y += tc_act/ 9header-y += tc_act/
10header-y += tc_ematch/
10header-y += netfilter/ 11header-y += netfilter/
11header-y += netfilter_arp/ 12header-y += netfilter_arp/
12header-y += netfilter_bridge/ 13header-y += netfilter_bridge/
@@ -137,6 +138,7 @@ header-y += radeonfb.h
137header-y += raw.h 138header-y += raw.h
138header-y += resource.h 139header-y += resource.h
139header-y += rose.h 140header-y += rose.h
141header-y += serial_reg.h
140header-y += smbno.h 142header-y += smbno.h
141header-y += snmp.h 143header-y += snmp.h
142header-y += sockios.h 144header-y += sockios.h
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index fccd8b548d93..bf5e0009de75 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -33,6 +33,7 @@
33#endif 33#endif
34 34
35#include <linux/list.h> 35#include <linux/list.h>
36#include <linux/mod_devicetable.h>
36 37
37#include <acpi/acpi.h> 38#include <acpi/acpi.h>
38#include <acpi/acpi_bus.h> 39#include <acpi/acpi_bus.h>
@@ -88,10 +89,8 @@ int acpi_table_parse (char *id, acpi_table_handler handler);
88int __init acpi_table_parse_entries(char *id, unsigned long table_size, 89int __init acpi_table_parse_entries(char *id, unsigned long table_size,
89 int entry_id, acpi_table_entry_handler handler, unsigned int max_entries); 90 int entry_id, acpi_table_entry_handler handler, unsigned int max_entries);
90int acpi_table_parse_madt (enum acpi_madt_type id, acpi_table_entry_handler handler, unsigned int max_entries); 91int acpi_table_parse_madt (enum acpi_madt_type id, acpi_table_entry_handler handler, unsigned int max_entries);
91int acpi_table_parse_srat (enum acpi_srat_type id, acpi_table_entry_handler handler, unsigned int max_entries);
92int acpi_parse_mcfg (struct acpi_table_header *header); 92int acpi_parse_mcfg (struct acpi_table_header *header);
93void acpi_table_print_madt_entry (struct acpi_subtable_header *madt); 93void acpi_table_print_madt_entry (struct acpi_subtable_header *madt);
94void acpi_table_print_srat_entry (struct acpi_subtable_header *srat);
95 94
96/* the following four functions are architecture-dependent */ 95/* the following four functions are architecture-dependent */
97#ifdef CONFIG_HAVE_ARCH_PARSE_SRAT 96#ifdef CONFIG_HAVE_ARCH_PARSE_SRAT
@@ -122,7 +121,7 @@ extern struct acpi_mcfg_allocation *pci_mmcfg_config;
122extern int pci_mmcfg_config_num; 121extern int pci_mmcfg_config_num;
123 122
124extern int sbf_port; 123extern int sbf_port;
125extern unsigned long acpi_video_flags; 124extern unsigned long acpi_realmode_flags;
126 125
127#else /* !CONFIG_ACPI */ 126#else /* !CONFIG_ACPI */
128 127
@@ -233,6 +232,9 @@ extern int acpi_paddr_to_node(u64 start_addr, u64 size);
233 232
234extern int pnpacpi_disabled; 233extern int pnpacpi_disabled;
235 234
235#define PXM_INVAL (-1)
236#define NID_INVAL (-1)
237
236#else /* CONFIG_ACPI */ 238#else /* CONFIG_ACPI */
237 239
238static inline int acpi_boot_init(void) 240static inline int acpi_boot_init(void)
diff --git a/include/linux/aer.h b/include/linux/aer.h
index 509656286e53..bcf236d825e8 100644
--- a/include/linux/aer.h
+++ b/include/linux/aer.h
@@ -15,11 +15,26 @@ extern int pci_disable_pcie_error_reporting(struct pci_dev *dev);
15extern int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev); 15extern int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev);
16extern int pci_cleanup_aer_correct_error_status(struct pci_dev *dev); 16extern int pci_cleanup_aer_correct_error_status(struct pci_dev *dev);
17#else 17#else
18#define pci_enable_pcie_error_reporting(dev) (-EINVAL) 18static inline int pci_enable_pcie_error_reporting(struct pci_dev *dev)
19#define pci_find_aer_capability(dev) (0) 19{
20#define pci_disable_pcie_error_reporting(dev) (-EINVAL) 20 return -EINVAL;
21#define pci_cleanup_aer_uncorrect_error_status(dev) (-EINVAL) 21}
22#define pci_cleanup_aer_correct_error_status(dev) (-EINVAL) 22static inline int pci_find_aer_capability(struct pci_dev *dev)
23{
24 return 0;
25}
26static inline int pci_disable_pcie_error_reporting(struct pci_dev *dev)
27{
28 return -EINVAL;
29}
30static inline int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev)
31{
32 return -EINVAL;
33}
34static inline int pci_cleanup_aer_correct_error_status(struct pci_dev *dev)
35{
36 return -EINVAL;
37}
23#endif 38#endif
24 39
25#endif //_AER_H_ 40#endif //_AER_H_
diff --git a/include/linux/aio.h b/include/linux/aio.h
index b903fc02bdb7..d10e608f232d 100644
--- a/include/linux/aio.h
+++ b/include/linux/aio.h
@@ -86,7 +86,7 @@ struct kioctx;
86 */ 86 */
87struct kiocb { 87struct kiocb {
88 struct list_head ki_run_list; 88 struct list_head ki_run_list;
89 long ki_flags; 89 unsigned long ki_flags;
90 int ki_users; 90 int ki_users;
91 unsigned ki_key; /* id of this request */ 91 unsigned ki_key; /* id of this request */
92 92
diff --git a/include/linux/apm_bios.h b/include/linux/apm_bios.h
index 290aef326812..5f921c84827a 100644
--- a/include/linux/apm_bios.h
+++ b/include/linux/apm_bios.h
@@ -21,20 +21,22 @@ typedef unsigned short apm_eventinfo_t;
21 21
22#ifdef __KERNEL__ 22#ifdef __KERNEL__
23 23
24#include <linux/types.h>
25
24#define APM_CS (GDT_ENTRY_APMBIOS_BASE * 8) 26#define APM_CS (GDT_ENTRY_APMBIOS_BASE * 8)
25#define APM_CS_16 (APM_CS + 8) 27#define APM_CS_16 (APM_CS + 8)
26#define APM_DS (APM_CS_16 + 8) 28#define APM_DS (APM_CS_16 + 8)
27 29
28struct apm_bios_info { 30struct apm_bios_info {
29 unsigned short version; 31 u16 version;
30 unsigned short cseg; 32 u16 cseg;
31 unsigned long offset; 33 u32 offset;
32 unsigned short cseg_16; 34 u16 cseg_16;
33 unsigned short dseg; 35 u16 dseg;
34 unsigned short flags; 36 u16 flags;
35 unsigned short cseg_len; 37 u16 cseg_len;
36 unsigned short cseg_16_len; 38 u16 cseg_16_len;
37 unsigned short dseg_len; 39 u16 dseg_len;
38}; 40};
39 41
40/* Results of APM Installation Check */ 42/* Results of APM Installation Check */
diff --git a/include/linux/arcdevice.h b/include/linux/arcdevice.h
index 2f85049cfb3d..fde675872c56 100644
--- a/include/linux/arcdevice.h
+++ b/include/linux/arcdevice.h
@@ -214,7 +214,7 @@ extern struct ArcProto *arc_proto_map[256], *arc_proto_default,
214 */ 214 */
215struct Incoming { 215struct Incoming {
216 struct sk_buff *skb; /* packet data buffer */ 216 struct sk_buff *skb; /* packet data buffer */
217 uint16_t sequence; /* sequence number of assembly */ 217 __be16 sequence; /* sequence number of assembly */
218 uint8_t lastpacket, /* number of last packet (from 1) */ 218 uint8_t lastpacket, /* number of last packet (from 1) */
219 numpackets; /* number of packets in split */ 219 numpackets; /* number of packets in split */
220}; 220};
@@ -292,7 +292,7 @@ struct arcnet_local {
292 292
293 struct { 293 struct {
294 uint16_t sequence; /* sequence number (incs with each packet) */ 294 uint16_t sequence; /* sequence number (incs with each packet) */
295 uint16_t aborted_seq; 295 __be16 aborted_seq;
296 296
297 struct Incoming incoming[256]; /* one from each address */ 297 struct Incoming incoming[256]; /* one from each address */
298 } rfc1201; 298 } rfc1201;
diff --git a/include/linux/async_tx.h b/include/linux/async_tx.h
index ff1255079fa1..bdca3f1b3213 100644
--- a/include/linux/async_tx.h
+++ b/include/linux/async_tx.h
@@ -51,10 +51,6 @@ struct dma_chan_ref {
51 * @ASYNC_TX_ACK: immediately ack the descriptor, precludes setting up a 51 * @ASYNC_TX_ACK: immediately ack the descriptor, precludes setting up a
52 * dependency chain 52 * dependency chain
53 * @ASYNC_TX_DEP_ACK: ack the dependency descriptor. Useful for chaining. 53 * @ASYNC_TX_DEP_ACK: ack the dependency descriptor. Useful for chaining.
54 * @ASYNC_TX_KMAP_SRC: if the transaction is to be performed synchronously
55 * take an atomic mapping (KM_USER0) on the source page(s)
56 * @ASYNC_TX_KMAP_DST: if the transaction is to be performed synchronously
57 * take an atomic mapping (KM_USER0) on the dest page(s)
58 */ 54 */
59enum async_tx_flags { 55enum async_tx_flags {
60 ASYNC_TX_XOR_ZERO_DST = (1 << 0), 56 ASYNC_TX_XOR_ZERO_DST = (1 << 0),
@@ -62,8 +58,6 @@ enum async_tx_flags {
62 ASYNC_TX_ASSUME_COHERENT = (1 << 2), 58 ASYNC_TX_ASSUME_COHERENT = (1 << 2),
63 ASYNC_TX_ACK = (1 << 3), 59 ASYNC_TX_ACK = (1 << 3),
64 ASYNC_TX_DEP_ACK = (1 << 4), 60 ASYNC_TX_DEP_ACK = (1 << 4),
65 ASYNC_TX_KMAP_SRC = (1 << 5),
66 ASYNC_TX_KMAP_DST = (1 << 6),
67}; 61};
68 62
69#ifdef CONFIG_DMA_ENGINE 63#ifdef CONFIG_DMA_ENGINE
diff --git a/include/linux/ata.h b/include/linux/ata.h
index b5a20162af32..a4f373f8b798 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -64,6 +64,28 @@ enum {
64 ATA_ID_PROD_LEN = 40, 64 ATA_ID_PROD_LEN = 40,
65 65
66 ATA_PCI_CTL_OFS = 2, 66 ATA_PCI_CTL_OFS = 2,
67
68 ATA_PIO0 = (1 << 0),
69 ATA_PIO1 = ATA_PIO0 | (1 << 1),
70 ATA_PIO2 = ATA_PIO1 | (1 << 2),
71 ATA_PIO3 = ATA_PIO2 | (1 << 3),
72 ATA_PIO4 = ATA_PIO3 | (1 << 4),
73 ATA_PIO5 = ATA_PIO4 | (1 << 5),
74 ATA_PIO6 = ATA_PIO5 | (1 << 6),
75
76 ATA_SWDMA0 = (1 << 0),
77 ATA_SWDMA1 = ATA_SWDMA0 | (1 << 1),
78 ATA_SWDMA2 = ATA_SWDMA1 | (1 << 2),
79
80 ATA_SWDMA2_ONLY = (1 << 2),
81
82 ATA_MWDMA0 = (1 << 0),
83 ATA_MWDMA1 = ATA_MWDMA0 | (1 << 1),
84 ATA_MWDMA2 = ATA_MWDMA1 | (1 << 2),
85
86 ATA_MWDMA12_ONLY = (1 << 1) | (1 << 2),
87 ATA_MWDMA2_ONLY = (1 << 2),
88
67 ATA_UDMA0 = (1 << 0), 89 ATA_UDMA0 = (1 << 0),
68 ATA_UDMA1 = ATA_UDMA0 | (1 << 1), 90 ATA_UDMA1 = ATA_UDMA0 | (1 << 1),
69 ATA_UDMA2 = ATA_UDMA1 | (1 << 2), 91 ATA_UDMA2 = ATA_UDMA1 | (1 << 2),
@@ -208,6 +230,12 @@ enum {
208 230
209 SETFEATURES_SPINUP = 0x07, /* Spin-up drive */ 231 SETFEATURES_SPINUP = 0x07, /* Spin-up drive */
210 232
233 SETFEATURES_SATA_ENABLE = 0x10, /* Enable use of SATA feature */
234 SETFEATURES_SATA_DISABLE = 0x90, /* Disable use of SATA feature */
235
236 /* SETFEATURE Sector counts for SATA features */
237 SATA_AN = 0x05, /* Asynchronous Notification */
238
211 /* ATAPI stuff */ 239 /* ATAPI stuff */
212 ATAPI_PKT_DMA = (1 << 0), 240 ATAPI_PKT_DMA = (1 << 0),
213 ATAPI_DMADIR = (1 << 2), /* ATAPI data dir: 241 ATAPI_DMADIR = (1 << 2), /* ATAPI data dir:
@@ -259,6 +287,15 @@ enum {
259 SERR_PROTOCOL = (1 << 10), /* protocol violation */ 287 SERR_PROTOCOL = (1 << 10), /* protocol violation */
260 SERR_INTERNAL = (1 << 11), /* host internal error */ 288 SERR_INTERNAL = (1 << 11), /* host internal error */
261 SERR_PHYRDY_CHG = (1 << 16), /* PHY RDY changed */ 289 SERR_PHYRDY_CHG = (1 << 16), /* PHY RDY changed */
290 SERR_PHY_INT_ERR = (1 << 17), /* PHY internal error */
291 SERR_COMM_WAKE = (1 << 18), /* Comm wake */
292 SERR_10B_8B_ERR = (1 << 19), /* 10b to 8b decode error */
293 SERR_DISPARITY = (1 << 20), /* Disparity */
294 SERR_CRC = (1 << 21), /* CRC error */
295 SERR_HANDSHAKE = (1 << 22), /* Handshake error */
296 SERR_LINK_SEQ_ERR = (1 << 23), /* Link sequence error */
297 SERR_TRANS_ST_ERROR = (1 << 24), /* Transport state trans. error */
298 SERR_UNRECOG_FIS = (1 << 25), /* Unrecognized FIS */
262 SERR_DEV_XCHG = (1 << 26), /* device exchanged */ 299 SERR_DEV_XCHG = (1 << 26), /* device exchanged */
263 300
264 /* struct ata_taskfile flags */ 301 /* struct ata_taskfile flags */
@@ -319,24 +356,17 @@ struct ata_taskfile {
319}; 356};
320 357
321#define ata_id_is_ata(id) (((id)[0] & (1 << 15)) == 0) 358#define ata_id_is_ata(id) (((id)[0] & (1 << 15)) == 0)
322#define ata_id_rahead_enabled(id) ((id)[85] & (1 << 6))
323#define ata_id_wcache_enabled(id) ((id)[85] & (1 << 5))
324#define ata_id_hpa_enabled(id) ((id)[85] & (1 << 10))
325#define ata_id_has_fua(id) ((id)[84] & (1 << 6))
326#define ata_id_has_flush(id) ((id)[83] & (1 << 12))
327#define ata_id_has_flush_ext(id) ((id)[83] & (1 << 13))
328#define ata_id_has_lba48(id) ((id)[83] & (1 << 10))
329#define ata_id_has_hpa(id) ((id)[82] & (1 << 10))
330#define ata_id_has_wcache(id) ((id)[82] & (1 << 5))
331#define ata_id_has_pm(id) ((id)[82] & (1 << 3))
332#define ata_id_has_lba(id) ((id)[49] & (1 << 9)) 359#define ata_id_has_lba(id) ((id)[49] & (1 << 9))
333#define ata_id_has_dma(id) ((id)[49] & (1 << 8)) 360#define ata_id_has_dma(id) ((id)[49] & (1 << 8))
334#define ata_id_has_ncq(id) ((id)[76] & (1 << 8)) 361#define ata_id_has_ncq(id) ((id)[76] & (1 << 8))
335#define ata_id_queue_depth(id) (((id)[75] & 0x1f) + 1) 362#define ata_id_queue_depth(id) (((id)[75] & 0x1f) + 1)
336#define ata_id_removeable(id) ((id)[0] & (1 << 7)) 363#define ata_id_removeable(id) ((id)[0] & (1 << 7))
337#define ata_id_has_dword_io(id) ((id)[50] & (1 << 0)) 364#define ata_id_has_dword_io(id) ((id)[48] & (1 << 0))
365#define ata_id_has_atapi_AN(id) \
366 ( (((id)[76] != 0x0000) && ((id)[76] != 0xffff)) && \
367 ((id)[78] & (1 << 5)) )
338#define ata_id_iordy_disable(id) ((id)[49] & (1 << 10)) 368#define ata_id_iordy_disable(id) ((id)[49] & (1 << 10))
339#define ata_id_has_iordy(id) ((id)[49] & (1 << 9)) 369#define ata_id_has_iordy(id) ((id)[49] & (1 << 11))
340#define ata_id_u32(id,n) \ 370#define ata_id_u32(id,n) \
341 (((u32) (id)[(n) + 1] << 16) | ((u32) (id)[(n)])) 371 (((u32) (id)[(n) + 1] << 16) | ((u32) (id)[(n)]))
342#define ata_id_u64(id,n) \ 372#define ata_id_u64(id,n) \
@@ -347,6 +377,90 @@ struct ata_taskfile {
347 377
348#define ata_id_cdb_intr(id) (((id)[0] & 0x60) == 0x20) 378#define ata_id_cdb_intr(id) (((id)[0] & 0x60) == 0x20)
349 379
380static inline int ata_id_has_fua(const u16 *id)
381{
382 if ((id[84] & 0xC000) != 0x4000)
383 return 0;
384 return id[84] & (1 << 6);
385}
386
387static inline int ata_id_has_flush(const u16 *id)
388{
389 if ((id[83] & 0xC000) != 0x4000)
390 return 0;
391 return id[83] & (1 << 12);
392}
393
394static inline int ata_id_has_flush_ext(const u16 *id)
395{
396 if ((id[83] & 0xC000) != 0x4000)
397 return 0;
398 return id[83] & (1 << 13);
399}
400
401static inline int ata_id_has_lba48(const u16 *id)
402{
403 if ((id[83] & 0xC000) != 0x4000)
404 return 0;
405 return id[83] & (1 << 10);
406}
407
408static inline int ata_id_hpa_enabled(const u16 *id)
409{
410 /* Yes children, word 83 valid bits cover word 82 data */
411 if ((id[83] & 0xC000) != 0x4000)
412 return 0;
413 /* And 87 covers 85-87 */
414 if ((id[87] & 0xC000) != 0x4000)
415 return 0;
416 /* Check command sets enabled as well as supported */
417 if ((id[85] & ( 1 << 10)) == 0)
418 return 0;
419 return id[82] & (1 << 10);
420}
421
422static inline int ata_id_has_wcache(const u16 *id)
423{
424 /* Yes children, word 83 valid bits cover word 82 data */
425 if ((id[83] & 0xC000) != 0x4000)
426 return 0;
427 return id[82] & (1 << 5);
428}
429
430static inline int ata_id_has_pm(const u16 *id)
431{
432 if ((id[83] & 0xC000) != 0x4000)
433 return 0;
434 return id[82] & (1 << 3);
435}
436
437static inline int ata_id_rahead_enabled(const u16 *id)
438{
439 if ((id[87] & 0xC000) != 0x4000)
440 return 0;
441 return id[85] & (1 << 6);
442}
443
444static inline int ata_id_wcache_enabled(const u16 *id)
445{
446 if ((id[87] & 0xC000) != 0x4000)
447 return 0;
448 return id[85] & (1 << 5);
449}
450
451/**
452 * ata_id_major_version - get ATA level of drive
453 * @id: Identify data
454 *
455 * Caveats:
456 * ATA-1 considers identify optional
457 * ATA-2 introduces mandatory identify
458 * ATA-3 introduces word 80 and accurate reporting
459 *
460 * The practical impact of this is that ata_id_major_version cannot
461 * reliably report on drives below ATA3.
462 */
463
350static inline unsigned int ata_id_major_version(const u16 *id) 464static inline unsigned int ata_id_major_version(const u16 *id)
351{ 465{
352 unsigned int mver; 466 unsigned int mver;
diff --git a/include/linux/audit.h b/include/linux/audit.h
index 8ca7ca0b47f0..9ae740936a65 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -63,8 +63,8 @@
63#define AUDIT_ADD_RULE 1011 /* Add syscall filtering rule */ 63#define AUDIT_ADD_RULE 1011 /* Add syscall filtering rule */
64#define AUDIT_DEL_RULE 1012 /* Delete syscall filtering rule */ 64#define AUDIT_DEL_RULE 1012 /* Delete syscall filtering rule */
65#define AUDIT_LIST_RULES 1013 /* List syscall filtering rules */ 65#define AUDIT_LIST_RULES 1013 /* List syscall filtering rules */
66#define AUDIT_TTY_GET 1014 /* Get TTY auditing status */ 66#define AUDIT_TTY_GET 1016 /* Get TTY auditing status */
67#define AUDIT_TTY_SET 1015 /* Set TTY auditing status */ 67#define AUDIT_TTY_SET 1017 /* Set TTY auditing status */
68 68
69#define AUDIT_FIRST_USER_MSG 1100 /* Userspace messages mostly uninteresting to kernel */ 69#define AUDIT_FIRST_USER_MSG 1100 /* Userspace messages mostly uninteresting to kernel */
70#define AUDIT_USER_AVC 1107 /* We filter this differently */ 70#define AUDIT_USER_AVC 1107 /* We filter this differently */
@@ -108,10 +108,11 @@
108#define AUDIT_MAC_CIPSOV4_DEL 1408 /* NetLabel: del CIPSOv4 DOI entry */ 108#define AUDIT_MAC_CIPSOV4_DEL 1408 /* NetLabel: del CIPSOv4 DOI entry */
109#define AUDIT_MAC_MAP_ADD 1409 /* NetLabel: add LSM domain mapping */ 109#define AUDIT_MAC_MAP_ADD 1409 /* NetLabel: add LSM domain mapping */
110#define AUDIT_MAC_MAP_DEL 1410 /* NetLabel: del LSM domain mapping */ 110#define AUDIT_MAC_MAP_DEL 1410 /* NetLabel: del LSM domain mapping */
111#define AUDIT_MAC_IPSEC_ADDSA 1411 /* Add a XFRM state */ 111#define AUDIT_MAC_IPSEC_ADDSA 1411 /* Not used */
112#define AUDIT_MAC_IPSEC_DELSA 1412 /* Delete a XFRM state */ 112#define AUDIT_MAC_IPSEC_DELSA 1412 /* Not used */
113#define AUDIT_MAC_IPSEC_ADDSPD 1413 /* Add a XFRM policy */ 113#define AUDIT_MAC_IPSEC_ADDSPD 1413 /* Not used */
114#define AUDIT_MAC_IPSEC_DELSPD 1414 /* Delete a XFRM policy */ 114#define AUDIT_MAC_IPSEC_DELSPD 1414 /* Not used */
115#define AUDIT_MAC_IPSEC_EVENT 1415 /* Audit an IPSec event */
115 116
116#define AUDIT_FIRST_KERN_ANOM_MSG 1700 117#define AUDIT_FIRST_KERN_ANOM_MSG 1700
117#define AUDIT_LAST_KERN_ANOM_MSG 1799 118#define AUDIT_LAST_KERN_ANOM_MSG 1799
@@ -161,7 +162,7 @@
161 * are currently used in an audit field constant understood by the kernel. 162 * are currently used in an audit field constant understood by the kernel.
162 * If you are adding a new #define AUDIT_<whatever>, please ensure that 163 * If you are adding a new #define AUDIT_<whatever>, please ensure that
163 * AUDIT_UNUSED_BITS is updated if need be. */ 164 * AUDIT_UNUSED_BITS is updated if need be. */
164#define AUDIT_UNUSED_BITS 0x0FFFFC00 165#define AUDIT_UNUSED_BITS 0x07FFFC00
165 166
166 167
167/* Rule fields */ 168/* Rule fields */
@@ -213,25 +214,29 @@
213#define AUDIT_NEGATE 0x80000000 214#define AUDIT_NEGATE 0x80000000
214 215
215/* These are the supported operators. 216/* These are the supported operators.
216 * 4 2 1 217 * 4 2 1 8
217 * = > < 218 * = > < ?
218 * ------- 219 * ----------
219 * 0 0 0 0 nonsense 220 * 0 0 0 0 00 nonsense
220 * 0 0 1 1 < 221 * 0 0 0 1 08 & bit mask
221 * 0 1 0 2 > 222 * 0 0 1 0 10 <
222 * 0 1 1 3 != 223 * 0 1 0 0 20 >
223 * 1 0 0 4 = 224 * 0 1 1 0 30 !=
224 * 1 0 1 5 <= 225 * 1 0 0 0 40 =
225 * 1 1 0 6 >= 226 * 1 0 0 1 48 &= bit test
226 * 1 1 1 7 all operators 227 * 1 0 1 0 50 <=
228 * 1 1 0 0 60 >=
229 * 1 1 1 1 78 all operators
227 */ 230 */
231#define AUDIT_BIT_MASK 0x08000000
228#define AUDIT_LESS_THAN 0x10000000 232#define AUDIT_LESS_THAN 0x10000000
229#define AUDIT_GREATER_THAN 0x20000000 233#define AUDIT_GREATER_THAN 0x20000000
230#define AUDIT_NOT_EQUAL 0x30000000 234#define AUDIT_NOT_EQUAL 0x30000000
231#define AUDIT_EQUAL 0x40000000 235#define AUDIT_EQUAL 0x40000000
236#define AUDIT_BIT_TEST (AUDIT_BIT_MASK|AUDIT_EQUAL)
232#define AUDIT_LESS_THAN_OR_EQUAL (AUDIT_LESS_THAN|AUDIT_EQUAL) 237#define AUDIT_LESS_THAN_OR_EQUAL (AUDIT_LESS_THAN|AUDIT_EQUAL)
233#define AUDIT_GREATER_THAN_OR_EQUAL (AUDIT_GREATER_THAN|AUDIT_EQUAL) 238#define AUDIT_GREATER_THAN_OR_EQUAL (AUDIT_GREATER_THAN|AUDIT_EQUAL)
234#define AUDIT_OPERATORS (AUDIT_EQUAL|AUDIT_NOT_EQUAL) 239#define AUDIT_OPERATORS (AUDIT_EQUAL|AUDIT_NOT_EQUAL|AUDIT_BIT_MASK)
235 240
236/* Status symbols */ 241/* Status symbols */
237 /* Mask values */ 242 /* Mask values */
@@ -407,7 +412,6 @@ extern int audit_bprm(struct linux_binprm *bprm);
407extern int audit_socketcall(int nargs, unsigned long *args); 412extern int audit_socketcall(int nargs, unsigned long *args);
408extern int audit_sockaddr(int len, void *addr); 413extern int audit_sockaddr(int len, void *addr);
409extern int __audit_fd_pair(int fd1, int fd2); 414extern int __audit_fd_pair(int fd1, int fd2);
410extern int audit_avc_path(struct dentry *dentry, struct vfsmount *mnt);
411extern int audit_set_macxattr(const char *name); 415extern int audit_set_macxattr(const char *name);
412extern int __audit_mq_open(int oflag, mode_t mode, struct mq_attr __user *u_attr); 416extern int __audit_mq_open(int oflag, mode_t mode, struct mq_attr __user *u_attr);
413extern int __audit_mq_timedsend(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec __user *u_abs_timeout); 417extern int __audit_mq_timedsend(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec __user *u_abs_timeout);
@@ -487,7 +491,6 @@ extern int audit_signals;
487#define audit_socketcall(n,a) ({ 0; }) 491#define audit_socketcall(n,a) ({ 0; })
488#define audit_fd_pair(n,a) ({ 0; }) 492#define audit_fd_pair(n,a) ({ 0; })
489#define audit_sockaddr(len, addr) ({ 0; }) 493#define audit_sockaddr(len, addr) ({ 0; })
490#define audit_avc_path(dentry, mnt) ({ 0; })
491#define audit_set_macxattr(n) do { ; } while (0) 494#define audit_set_macxattr(n) do { ; } while (0)
492#define audit_mq_open(o,m,a) ({ 0; }) 495#define audit_mq_open(o,m,a) ({ 0; })
493#define audit_mq_timedsend(d,l,p,t) ({ 0; }) 496#define audit_mq_timedsend(d,l,p,t) ({ 0; })
diff --git a/include/linux/backlight.h b/include/linux/backlight.h
index 1023ba0d6e55..1ee9488ca2e4 100644
--- a/include/linux/backlight.h
+++ b/include/linux/backlight.h
@@ -69,8 +69,8 @@ struct backlight_device {
69 69
70 /* The framebuffer notifier block */ 70 /* The framebuffer notifier block */
71 struct notifier_block fb_notif; 71 struct notifier_block fb_notif;
72 /* The class device structure */ 72
73 struct class_device class_dev; 73 struct device dev;
74}; 74};
75 75
76static inline void backlight_update_status(struct backlight_device *bd) 76static inline void backlight_update_status(struct backlight_device *bd)
@@ -85,6 +85,20 @@ extern struct backlight_device *backlight_device_register(const char *name,
85 struct device *dev, void *devdata, struct backlight_ops *ops); 85 struct device *dev, void *devdata, struct backlight_ops *ops);
86extern void backlight_device_unregister(struct backlight_device *bd); 86extern void backlight_device_unregister(struct backlight_device *bd);
87 87
88#define to_backlight_device(obj) container_of(obj, struct backlight_device, class_dev) 88#define to_backlight_device(obj) container_of(obj, struct backlight_device, dev)
89
90static inline void * bl_get_data(struct backlight_device *bl_dev)
91{
92 return dev_get_drvdata(&bl_dev->dev);
93}
94
95struct generic_bl_info {
96 const char *name;
97 int max_intensity;
98 int default_intensity;
99 int limit_mask;
100 void (*set_bl_intensity)(int intensity);
101 void (*kick_battery)(void);
102};
89 103
90#endif 104#endif
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index e1a708337be3..91c8c07fe8b7 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -6,11 +6,13 @@
6struct pt_regs; 6struct pt_regs;
7 7
8/* 8/*
9 * MAX_ARG_PAGES defines the number of pages allocated for arguments 9 * These are the maximum length and maximum number of strings passed to the
10 * and envelope for the new program. 32 should suffice, this gives 10 * execve() system call. MAX_ARG_STRLEN is essentially random but serves to
11 * a maximum env+arg of 128kB w/4KB pages! 11 * prevent the kernel from being unduly impacted by misaddressed pointers.
12 * MAX_ARG_STRINGS is chosen to fit in a signed 32-bit integer.
12 */ 13 */
13#define MAX_ARG_PAGES 32 14#define MAX_ARG_STRLEN (PAGE_SIZE * 32)
15#define MAX_ARG_STRINGS 0x7FFFFFFF
14 16
15/* sizeof(linux_binprm->buf) */ 17/* sizeof(linux_binprm->buf) */
16#define BINPRM_BUF_SIZE 128 18#define BINPRM_BUF_SIZE 128
@@ -24,7 +26,12 @@ struct pt_regs;
24 */ 26 */
25struct linux_binprm{ 27struct linux_binprm{
26 char buf[BINPRM_BUF_SIZE]; 28 char buf[BINPRM_BUF_SIZE];
29#ifdef CONFIG_MMU
30 struct vm_area_struct *vma;
31#else
32# define MAX_ARG_PAGES 32
27 struct page *page[MAX_ARG_PAGES]; 33 struct page *page[MAX_ARG_PAGES];
34#endif
28 struct mm_struct *mm; 35 struct mm_struct *mm;
29 unsigned long p; /* current top of mem */ 36 unsigned long p; /* current top of mem */
30 int sh_bang; 37 int sh_bang;
@@ -40,6 +47,7 @@ struct linux_binprm{
40 unsigned interp_flags; 47 unsigned interp_flags;
41 unsigned interp_data; 48 unsigned interp_data;
42 unsigned long loader, exec; 49 unsigned long loader, exec;
50 unsigned long argv_len;
43}; 51};
44 52
45#define BINPRM_FLAGS_ENFORCE_NONDUMP_BIT 0 53#define BINPRM_FLAGS_ENFORCE_NONDUMP_BIT 0
@@ -68,7 +76,7 @@ extern int register_binfmt(struct linux_binfmt *);
68extern int unregister_binfmt(struct linux_binfmt *); 76extern int unregister_binfmt(struct linux_binfmt *);
69 77
70extern int prepare_binprm(struct linux_binprm *); 78extern int prepare_binprm(struct linux_binprm *);
71extern void remove_arg_zero(struct linux_binprm *); 79extern int __must_check remove_arg_zero(struct linux_binprm *);
72extern int search_binary_handler(struct linux_binprm *,struct pt_regs *); 80extern int search_binary_handler(struct linux_binprm *,struct pt_regs *);
73extern int flush_old_exec(struct linux_binprm * bprm); 81extern int flush_old_exec(struct linux_binprm * bprm);
74 82
@@ -85,6 +93,7 @@ extern int suid_dumpable;
85extern int setup_arg_pages(struct linux_binprm * bprm, 93extern int setup_arg_pages(struct linux_binprm * bprm,
86 unsigned long stack_top, 94 unsigned long stack_top,
87 int executable_stack); 95 int executable_stack);
96extern int bprm_mm_init(struct linux_binprm *bprm);
88extern int copy_strings_kernel(int argc,char ** argv,struct linux_binprm *bprm); 97extern int copy_strings_kernel(int argc,char ** argv,struct linux_binprm *bprm);
89extern void compute_creds(struct linux_binprm *binprm); 98extern void compute_creds(struct linux_binprm *binprm);
90extern int do_coredump(long signr, int exit_code, struct pt_regs * regs); 99extern int do_coredump(long signr, int exit_code, struct pt_regs * regs);
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 4d85262b4fa4..089a8bc55dd4 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -24,6 +24,8 @@
24#include <linux/mempool.h> 24#include <linux/mempool.h>
25#include <linux/ioprio.h> 25#include <linux/ioprio.h>
26 26
27#ifdef CONFIG_BLOCK
28
27/* Platforms may set this to teach the BIO layer about IOMMU hardware. */ 29/* Platforms may set this to teach the BIO layer about IOMMU hardware. */
28#include <asm/io.h> 30#include <asm/io.h>
29 31
@@ -62,7 +64,7 @@ struct bio_vec {
62 64
63struct bio_set; 65struct bio_set;
64struct bio; 66struct bio;
65typedef int (bio_end_io_t) (struct bio *, unsigned int, int); 67typedef void (bio_end_io_t) (struct bio *, int);
66typedef void (bio_destructor_t) (struct bio *); 68typedef void (bio_destructor_t) (struct bio *);
67 69
68/* 70/*
@@ -224,7 +226,7 @@ struct bio {
224#define BIO_SEG_BOUNDARY(q, b1, b2) \ 226#define BIO_SEG_BOUNDARY(q, b1, b2) \
225 BIOVEC_SEG_BOUNDARY((q), __BVEC_END((b1)), __BVEC_START((b2))) 227 BIOVEC_SEG_BOUNDARY((q), __BVEC_END((b1)), __BVEC_START((b2)))
226 228
227#define bio_io_error(bio, bytes) bio_endio((bio), (bytes), -EIO) 229#define bio_io_error(bio) bio_endio((bio), -EIO)
228 230
229/* 231/*
230 * drivers should not use the __ version unless they _really_ want to 232 * drivers should not use the __ version unless they _really_ want to
@@ -284,7 +286,7 @@ extern struct bio *bio_alloc_bioset(gfp_t, int, struct bio_set *);
284extern void bio_put(struct bio *); 286extern void bio_put(struct bio *);
285extern void bio_free(struct bio *, struct bio_set *); 287extern void bio_free(struct bio *, struct bio_set *);
286 288
287extern void bio_endio(struct bio *, unsigned int, int); 289extern void bio_endio(struct bio *, int);
288struct request_queue; 290struct request_queue;
289extern int bio_phys_segments(struct request_queue *, struct bio *); 291extern int bio_phys_segments(struct request_queue *, struct bio *);
290extern int bio_hw_segments(struct request_queue *, struct bio *); 292extern int bio_hw_segments(struct request_queue *, struct bio *);
@@ -361,4 +363,5 @@ static inline char *__bio_kmap_irq(struct bio *bio, unsigned short idx,
361 __bio_kmap_irq((bio), (bio)->bi_idx, (flags)) 363 __bio_kmap_irq((bio), (bio)->bi_idx, (flags))
362#define bio_kunmap_irq(buf,flags) __bio_kunmap_irq(buf, flags) 364#define bio_kunmap_irq(buf,flags) __bio_kunmap_irq(buf, flags)
363 365
366#endif /* CONFIG_BLOCK */
364#endif /* __LINUX_BIO_H */ 367#endif /* __LINUX_BIO_H */
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index f78965fc6426..5ed888b04b29 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1,6 +1,8 @@
1#ifndef _LINUX_BLKDEV_H 1#ifndef _LINUX_BLKDEV_H
2#define _LINUX_BLKDEV_H 2#define _LINUX_BLKDEV_H
3 3
4#ifdef CONFIG_BLOCK
5
4#include <linux/sched.h> 6#include <linux/sched.h>
5#include <linux/major.h> 7#include <linux/major.h>
6#include <linux/genhd.h> 8#include <linux/genhd.h>
@@ -18,26 +20,10 @@
18 20
19#include <asm/scatterlist.h> 21#include <asm/scatterlist.h>
20 22
21#ifdef CONFIG_LBD
22# include <asm/div64.h>
23# define sector_div(a, b) do_div(a, b)
24#else
25# define sector_div(n, b)( \
26{ \
27 int _res; \
28 _res = (n) % (b); \
29 (n) /= (b); \
30 _res; \
31} \
32)
33#endif
34
35#ifdef CONFIG_BLOCK
36
37struct scsi_ioctl_command; 23struct scsi_ioctl_command;
38 24
39struct request_queue; 25struct request_queue;
40typedef struct request_queue request_queue_t; 26typedef struct request_queue request_queue_t __deprecated;
41struct elevator_queue; 27struct elevator_queue;
42typedef struct elevator_queue elevator_t; 28typedef struct elevator_queue elevator_t;
43struct request_pm_state; 29struct request_pm_state;
@@ -233,7 +219,7 @@ struct request {
233 struct list_head queuelist; 219 struct list_head queuelist;
234 struct list_head donelist; 220 struct list_head donelist;
235 221
236 request_queue_t *q; 222 struct request_queue *q;
237 223
238 unsigned int cmd_flags; 224 unsigned int cmd_flags;
239 enum rq_cmd_type_bits cmd_type; 225 enum rq_cmd_type_bits cmd_type;
@@ -337,15 +323,15 @@ struct request_pm_state
337 323
338#include <linux/elevator.h> 324#include <linux/elevator.h>
339 325
340typedef void (request_fn_proc) (request_queue_t *q); 326typedef void (request_fn_proc) (struct request_queue *q);
341typedef int (make_request_fn) (request_queue_t *q, struct bio *bio); 327typedef int (make_request_fn) (struct request_queue *q, struct bio *bio);
342typedef int (prep_rq_fn) (request_queue_t *, struct request *); 328typedef int (prep_rq_fn) (struct request_queue *, struct request *);
343typedef void (unplug_fn) (request_queue_t *); 329typedef void (unplug_fn) (struct request_queue *);
344 330
345struct bio_vec; 331struct bio_vec;
346typedef int (merge_bvec_fn) (request_queue_t *, struct bio *, struct bio_vec *); 332typedef int (merge_bvec_fn) (struct request_queue *, struct bio *, struct bio_vec *);
347typedef int (issue_flush_fn) (request_queue_t *, struct gendisk *, sector_t *); 333typedef int (issue_flush_fn) (struct request_queue *, struct gendisk *, sector_t *);
348typedef void (prepare_flush_fn) (request_queue_t *, struct request *); 334typedef void (prepare_flush_fn) (struct request_queue *, struct request *);
349typedef void (softirq_done_fn)(struct request *); 335typedef void (softirq_done_fn)(struct request *);
350 336
351enum blk_queue_state { 337enum blk_queue_state {
@@ -471,7 +457,6 @@ struct request_queue
471 int orderr, ordcolor; 457 int orderr, ordcolor;
472 struct request pre_flush_rq, bar_rq, post_flush_rq; 458 struct request pre_flush_rq, bar_rq, post_flush_rq;
473 struct request *orig_bar_rq; 459 struct request *orig_bar_rq;
474 unsigned int bi_size;
475 460
476 struct mutex sysfs_lock; 461 struct mutex sysfs_lock;
477 462
@@ -483,8 +468,8 @@ struct request_queue
483#define QUEUE_FLAG_CLUSTER 0 /* cluster several segments into 1 */ 468#define QUEUE_FLAG_CLUSTER 0 /* cluster several segments into 1 */
484#define QUEUE_FLAG_QUEUED 1 /* uses generic tag queueing */ 469#define QUEUE_FLAG_QUEUED 1 /* uses generic tag queueing */
485#define QUEUE_FLAG_STOPPED 2 /* queue is stopped */ 470#define QUEUE_FLAG_STOPPED 2 /* queue is stopped */
486#define QUEUE_FLAG_READFULL 3 /* write queue has been filled */ 471#define QUEUE_FLAG_READFULL 3 /* read queue has been filled */
487#define QUEUE_FLAG_WRITEFULL 4 /* read queue has been filled */ 472#define QUEUE_FLAG_WRITEFULL 4 /* write queue has been filled */
488#define QUEUE_FLAG_DEAD 5 /* queue being torn down */ 473#define QUEUE_FLAG_DEAD 5 /* queue being torn down */
489#define QUEUE_FLAG_REENTER 6 /* Re-entrancy avoidance */ 474#define QUEUE_FLAG_REENTER 6 /* Re-entrancy avoidance */
490#define QUEUE_FLAG_PLUGGED 7 /* queue is plugged */ 475#define QUEUE_FLAG_PLUGGED 7 /* queue is plugged */
@@ -626,34 +611,47 @@ extern unsigned long blk_max_low_pfn, blk_max_pfn;
626 611
627#ifdef CONFIG_BOUNCE 612#ifdef CONFIG_BOUNCE
628extern int init_emergency_isa_pool(void); 613extern int init_emergency_isa_pool(void);
629extern void blk_queue_bounce(request_queue_t *q, struct bio **bio); 614extern void blk_queue_bounce(struct request_queue *q, struct bio **bio);
630#else 615#else
631static inline int init_emergency_isa_pool(void) 616static inline int init_emergency_isa_pool(void)
632{ 617{
633 return 0; 618 return 0;
634} 619}
635static inline void blk_queue_bounce(request_queue_t *q, struct bio **bio) 620static inline void blk_queue_bounce(struct request_queue *q, struct bio **bio)
636{ 621{
637} 622}
638#endif /* CONFIG_MMU */ 623#endif /* CONFIG_MMU */
639 624
640#define rq_for_each_bio(_bio, rq) \ 625struct req_iterator {
626 int i;
627 struct bio *bio;
628};
629
630/* This should not be used directly - use rq_for_each_segment */
631#define __rq_for_each_bio(_bio, rq) \
641 if ((rq->bio)) \ 632 if ((rq->bio)) \
642 for (_bio = (rq)->bio; _bio; _bio = _bio->bi_next) 633 for (_bio = (rq)->bio; _bio; _bio = _bio->bi_next)
643 634
635#define rq_for_each_segment(bvl, _rq, _iter) \
636 __rq_for_each_bio(_iter.bio, _rq) \
637 bio_for_each_segment(bvl, _iter.bio, _iter.i)
638
639#define rq_iter_last(rq, _iter) \
640 (_iter.bio->bi_next == NULL && _iter.i == _iter.bio->bi_vcnt-1)
641
644extern int blk_register_queue(struct gendisk *disk); 642extern int blk_register_queue(struct gendisk *disk);
645extern void blk_unregister_queue(struct gendisk *disk); 643extern void blk_unregister_queue(struct gendisk *disk);
646extern void register_disk(struct gendisk *dev); 644extern void register_disk(struct gendisk *dev);
647extern void generic_make_request(struct bio *bio); 645extern void generic_make_request(struct bio *bio);
648extern void blk_put_request(struct request *); 646extern void blk_put_request(struct request *);
649extern void __blk_put_request(request_queue_t *, struct request *); 647extern void __blk_put_request(struct request_queue *, struct request *);
650extern void blk_end_sync_rq(struct request *rq, int error); 648extern void blk_end_sync_rq(struct request *rq, int error);
651extern struct request *blk_get_request(request_queue_t *, int, gfp_t); 649extern struct request *blk_get_request(struct request_queue *, int, gfp_t);
652extern void blk_insert_request(request_queue_t *, struct request *, int, void *); 650extern void blk_insert_request(struct request_queue *, struct request *, int, void *);
653extern void blk_requeue_request(request_queue_t *, struct request *); 651extern void blk_requeue_request(struct request_queue *, struct request *);
654extern void blk_plug_device(request_queue_t *); 652extern void blk_plug_device(struct request_queue *);
655extern int blk_remove_plug(request_queue_t *); 653extern int blk_remove_plug(struct request_queue *);
656extern void blk_recount_segments(request_queue_t *, struct bio *); 654extern void blk_recount_segments(struct request_queue *, struct bio *);
657extern int scsi_cmd_ioctl(struct file *, struct request_queue *, 655extern int scsi_cmd_ioctl(struct file *, struct request_queue *,
658 struct gendisk *, unsigned int, void __user *); 656 struct gendisk *, unsigned int, void __user *);
659extern int sg_scsi_ioctl(struct file *, struct request_queue *, 657extern int sg_scsi_ioctl(struct file *, struct request_queue *,
@@ -662,14 +660,15 @@ extern int sg_scsi_ioctl(struct file *, struct request_queue *,
662/* 660/*
663 * Temporary export, until SCSI gets fixed up. 661 * Temporary export, until SCSI gets fixed up.
664 */ 662 */
665extern int ll_back_merge_fn(request_queue_t *, struct request *, struct bio *); 663extern int blk_rq_append_bio(struct request_queue *q, struct request *rq,
664 struct bio *bio);
666 665
667/* 666/*
668 * A queue has just exitted congestion. Note this in the global counter of 667 * A queue has just exitted congestion. Note this in the global counter of
669 * congested queues, and wake up anyone who was waiting for requests to be 668 * congested queues, and wake up anyone who was waiting for requests to be
670 * put back. 669 * put back.
671 */ 670 */
672static inline void blk_clear_queue_congested(request_queue_t *q, int rw) 671static inline void blk_clear_queue_congested(struct request_queue *q, int rw)
673{ 672{
674 clear_bdi_congested(&q->backing_dev_info, rw); 673 clear_bdi_congested(&q->backing_dev_info, rw);
675} 674}
@@ -678,34 +677,29 @@ static inline void blk_clear_queue_congested(request_queue_t *q, int rw)
678 * A queue has just entered congestion. Flag that in the queue's VM-visible 677 * A queue has just entered congestion. Flag that in the queue's VM-visible
679 * state flags and increment the global gounter of congested queues. 678 * state flags and increment the global gounter of congested queues.
680 */ 679 */
681static inline void blk_set_queue_congested(request_queue_t *q, int rw) 680static inline void blk_set_queue_congested(struct request_queue *q, int rw)
682{ 681{
683 set_bdi_congested(&q->backing_dev_info, rw); 682 set_bdi_congested(&q->backing_dev_info, rw);
684} 683}
685 684
686extern void blk_start_queue(request_queue_t *q); 685extern void blk_start_queue(struct request_queue *q);
687extern void blk_stop_queue(request_queue_t *q); 686extern void blk_stop_queue(struct request_queue *q);
688extern void blk_sync_queue(struct request_queue *q); 687extern void blk_sync_queue(struct request_queue *q);
689extern void __blk_stop_queue(request_queue_t *q); 688extern void __blk_stop_queue(struct request_queue *q);
690extern void blk_run_queue(request_queue_t *); 689extern void blk_run_queue(struct request_queue *);
691extern void blk_start_queueing(request_queue_t *); 690extern void blk_start_queueing(struct request_queue *);
692extern int blk_rq_map_user(request_queue_t *, struct request *, void __user *, unsigned long); 691extern int blk_rq_map_user(struct request_queue *, struct request *, void __user *, unsigned long);
693extern int blk_rq_unmap_user(struct bio *); 692extern int blk_rq_unmap_user(struct bio *);
694extern int blk_rq_map_kern(request_queue_t *, struct request *, void *, unsigned int, gfp_t); 693extern int blk_rq_map_kern(struct request_queue *, struct request *, void *, unsigned int, gfp_t);
695extern int blk_rq_map_user_iov(request_queue_t *, struct request *, 694extern int blk_rq_map_user_iov(struct request_queue *, struct request *,
696 struct sg_iovec *, int, unsigned int); 695 struct sg_iovec *, int, unsigned int);
697extern int blk_execute_rq(request_queue_t *, struct gendisk *, 696extern int blk_execute_rq(struct request_queue *, struct gendisk *,
698 struct request *, int); 697 struct request *, int);
699extern void blk_execute_rq_nowait(request_queue_t *, struct gendisk *, 698extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *,
700 struct request *, int, rq_end_io_fn *); 699 struct request *, int, rq_end_io_fn *);
701extern int blk_fill_sghdr_rq(request_queue_t *, struct request *,
702 struct sg_io_hdr *, int);
703extern int blk_unmap_sghdr_rq(struct request *, struct sg_io_hdr *);
704extern int blk_complete_sghdr_rq(struct request *, struct sg_io_hdr *,
705 struct bio *);
706extern int blk_verify_command(unsigned char *, int); 700extern int blk_verify_command(unsigned char *, int);
707 701
708static inline request_queue_t *bdev_get_queue(struct block_device *bdev) 702static inline struct request_queue *bdev_get_queue(struct block_device *bdev)
709{ 703{
710 return bdev->bd_disk->queue; 704 return bdev->bd_disk->queue;
711} 705}
@@ -754,41 +748,41 @@ static inline void blkdev_dequeue_request(struct request *req)
754/* 748/*
755 * Access functions for manipulating queue properties 749 * Access functions for manipulating queue properties
756 */ 750 */
757extern request_queue_t *blk_init_queue_node(request_fn_proc *rfn, 751extern struct request_queue *blk_init_queue_node(request_fn_proc *rfn,
758 spinlock_t *lock, int node_id); 752 spinlock_t *lock, int node_id);
759extern request_queue_t *blk_init_queue(request_fn_proc *, spinlock_t *); 753extern struct request_queue *blk_init_queue(request_fn_proc *, spinlock_t *);
760extern void blk_cleanup_queue(request_queue_t *); 754extern void blk_cleanup_queue(struct request_queue *);
761extern void blk_queue_make_request(request_queue_t *, make_request_fn *); 755extern void blk_queue_make_request(struct request_queue *, make_request_fn *);
762extern void blk_queue_bounce_limit(request_queue_t *, u64); 756extern void blk_queue_bounce_limit(struct request_queue *, u64);
763extern void blk_queue_max_sectors(request_queue_t *, unsigned int); 757extern void blk_queue_max_sectors(struct request_queue *, unsigned int);
764extern void blk_queue_max_phys_segments(request_queue_t *, unsigned short); 758extern void blk_queue_max_phys_segments(struct request_queue *, unsigned short);
765extern void blk_queue_max_hw_segments(request_queue_t *, unsigned short); 759extern void blk_queue_max_hw_segments(struct request_queue *, unsigned short);
766extern void blk_queue_max_segment_size(request_queue_t *, unsigned int); 760extern void blk_queue_max_segment_size(struct request_queue *, unsigned int);
767extern void blk_queue_hardsect_size(request_queue_t *, unsigned short); 761extern void blk_queue_hardsect_size(struct request_queue *, unsigned short);
768extern void blk_queue_stack_limits(request_queue_t *t, request_queue_t *b); 762extern void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b);
769extern void blk_queue_segment_boundary(request_queue_t *, unsigned long); 763extern void blk_queue_segment_boundary(struct request_queue *, unsigned long);
770extern void blk_queue_prep_rq(request_queue_t *, prep_rq_fn *pfn); 764extern void blk_queue_prep_rq(struct request_queue *, prep_rq_fn *pfn);
771extern void blk_queue_merge_bvec(request_queue_t *, merge_bvec_fn *); 765extern void blk_queue_merge_bvec(struct request_queue *, merge_bvec_fn *);
772extern void blk_queue_dma_alignment(request_queue_t *, int); 766extern void blk_queue_dma_alignment(struct request_queue *, int);
773extern void blk_queue_softirq_done(request_queue_t *, softirq_done_fn *); 767extern void blk_queue_softirq_done(struct request_queue *, softirq_done_fn *);
774extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev); 768extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev);
775extern int blk_queue_ordered(request_queue_t *, unsigned, prepare_flush_fn *); 769extern int blk_queue_ordered(struct request_queue *, unsigned, prepare_flush_fn *);
776extern void blk_queue_issue_flush_fn(request_queue_t *, issue_flush_fn *); 770extern void blk_queue_issue_flush_fn(struct request_queue *, issue_flush_fn *);
777extern int blk_do_ordered(request_queue_t *, struct request **); 771extern int blk_do_ordered(struct request_queue *, struct request **);
778extern unsigned blk_ordered_cur_seq(request_queue_t *); 772extern unsigned blk_ordered_cur_seq(struct request_queue *);
779extern unsigned blk_ordered_req_seq(struct request *); 773extern unsigned blk_ordered_req_seq(struct request *);
780extern void blk_ordered_complete_seq(request_queue_t *, unsigned, int); 774extern void blk_ordered_complete_seq(struct request_queue *, unsigned, int);
781 775
782extern int blk_rq_map_sg(request_queue_t *, struct request *, struct scatterlist *); 776extern int blk_rq_map_sg(struct request_queue *, struct request *, struct scatterlist *);
783extern void blk_dump_rq_flags(struct request *, char *); 777extern void blk_dump_rq_flags(struct request *, char *);
784extern void generic_unplug_device(request_queue_t *); 778extern void generic_unplug_device(struct request_queue *);
785extern void __generic_unplug_device(request_queue_t *); 779extern void __generic_unplug_device(struct request_queue *);
786extern long nr_blockdev_pages(void); 780extern long nr_blockdev_pages(void);
787 781
788int blk_get_queue(request_queue_t *); 782int blk_get_queue(struct request_queue *);
789request_queue_t *blk_alloc_queue(gfp_t); 783struct request_queue *blk_alloc_queue(gfp_t);
790request_queue_t *blk_alloc_queue_node(gfp_t, int); 784struct request_queue *blk_alloc_queue_node(gfp_t, int);
791extern void blk_put_queue(request_queue_t *); 785extern void blk_put_queue(struct request_queue *);
792 786
793/* 787/*
794 * tag stuff 788 * tag stuff
@@ -796,13 +790,13 @@ extern void blk_put_queue(request_queue_t *);
796#define blk_queue_tag_depth(q) ((q)->queue_tags->busy) 790#define blk_queue_tag_depth(q) ((q)->queue_tags->busy)
797#define blk_queue_tag_queue(q) ((q)->queue_tags->busy < (q)->queue_tags->max_depth) 791#define blk_queue_tag_queue(q) ((q)->queue_tags->busy < (q)->queue_tags->max_depth)
798#define blk_rq_tagged(rq) ((rq)->cmd_flags & REQ_QUEUED) 792#define blk_rq_tagged(rq) ((rq)->cmd_flags & REQ_QUEUED)
799extern int blk_queue_start_tag(request_queue_t *, struct request *); 793extern int blk_queue_start_tag(struct request_queue *, struct request *);
800extern struct request *blk_queue_find_tag(request_queue_t *, int); 794extern struct request *blk_queue_find_tag(struct request_queue *, int);
801extern void blk_queue_end_tag(request_queue_t *, struct request *); 795extern void blk_queue_end_tag(struct request_queue *, struct request *);
802extern int blk_queue_init_tags(request_queue_t *, int, struct blk_queue_tag *); 796extern int blk_queue_init_tags(struct request_queue *, int, struct blk_queue_tag *);
803extern void blk_queue_free_tags(request_queue_t *); 797extern void blk_queue_free_tags(struct request_queue *);
804extern int blk_queue_resize_tags(request_queue_t *, int); 798extern int blk_queue_resize_tags(struct request_queue *, int);
805extern void blk_queue_invalidate_tags(request_queue_t *); 799extern void blk_queue_invalidate_tags(struct request_queue *);
806extern struct blk_queue_tag *blk_init_tags(int); 800extern struct blk_queue_tag *blk_init_tags(int);
807extern void blk_free_tags(struct blk_queue_tag *); 801extern void blk_free_tags(struct blk_queue_tag *);
808 802
@@ -814,7 +808,6 @@ static inline struct request *blk_map_queue_find_tag(struct blk_queue_tag *bqt,
814 return bqt->tag_index[tag]; 808 return bqt->tag_index[tag];
815} 809}
816 810
817extern void blk_rq_bio_prep(request_queue_t *, struct request *, struct bio *);
818extern int blkdev_issue_flush(struct block_device *, sector_t *); 811extern int blkdev_issue_flush(struct block_device *, sector_t *);
819 812
820#define MAX_PHYS_SEGMENTS 128 813#define MAX_PHYS_SEGMENTS 128
@@ -826,7 +819,7 @@ extern int blkdev_issue_flush(struct block_device *, sector_t *);
826 819
827#define blkdev_entry_to_request(entry) list_entry((entry), struct request, queuelist) 820#define blkdev_entry_to_request(entry) list_entry((entry), struct request, queuelist)
828 821
829static inline int queue_hardsect_size(request_queue_t *q) 822static inline int queue_hardsect_size(struct request_queue *q)
830{ 823{
831 int retval = 512; 824 int retval = 512;
832 825
@@ -841,7 +834,7 @@ static inline int bdev_hardsect_size(struct block_device *bdev)
841 return queue_hardsect_size(bdev_get_queue(bdev)); 834 return queue_hardsect_size(bdev_get_queue(bdev));
842} 835}
843 836
844static inline int queue_dma_alignment(request_queue_t *q) 837static inline int queue_dma_alignment(struct request_queue *q)
845{ 838{
846 int retval = 511; 839 int retval = 511;
847 840
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index 3680ff9a30ed..7e11d23ac36a 100644
--- a/include/linux/blktrace_api.h
+++ b/include/linux/blktrace_api.h
@@ -105,7 +105,7 @@ struct blk_io_trace {
105 */ 105 */
106struct blk_io_trace_remap { 106struct blk_io_trace_remap {
107 __be32 device; 107 __be32 device;
108 u32 __pad; 108 __be32 device_from;
109 __be64 sector; 109 __be64 sector;
110}; 110};
111 111
@@ -142,10 +142,14 @@ struct blk_user_trace_setup {
142 u32 pid; 142 u32 pid;
143}; 143};
144 144
145#ifdef __KERNEL__
145#if defined(CONFIG_BLK_DEV_IO_TRACE) 146#if defined(CONFIG_BLK_DEV_IO_TRACE)
146extern int blk_trace_ioctl(struct block_device *, unsigned, char __user *); 147extern int blk_trace_ioctl(struct block_device *, unsigned, char __user *);
147extern void blk_trace_shutdown(request_queue_t *); 148extern void blk_trace_shutdown(struct request_queue *);
148extern void __blk_add_trace(struct blk_trace *, sector_t, int, int, u32, int, int, void *); 149extern void __blk_add_trace(struct blk_trace *, sector_t, int, int, u32, int, int, void *);
150extern int do_blk_trace_setup(struct request_queue *q,
151 struct block_device *bdev, struct blk_user_trace_setup *buts);
152
149 153
150/** 154/**
151 * blk_add_trace_rq - Add a trace for a request oriented action 155 * blk_add_trace_rq - Add a trace for a request oriented action
@@ -272,6 +276,7 @@ static inline void blk_add_trace_remap(struct request_queue *q, struct bio *bio,
272 return; 276 return;
273 277
274 r.device = cpu_to_be32(dev); 278 r.device = cpu_to_be32(dev);
279 r.device_from = cpu_to_be32(bio->bi_bdev->bd_dev);
275 r.sector = cpu_to_be64(to); 280 r.sector = cpu_to_be64(to);
276 281
277 __blk_add_trace(bt, from, bio->bi_size, bio->bi_rw, BLK_TA_REMAP, !bio_flagged(bio, BIO_UPTODATE), sizeof(r), &r); 282 __blk_add_trace(bt, from, bio->bi_size, bio->bi_rw, BLK_TA_REMAP, !bio_flagged(bio, BIO_UPTODATE), sizeof(r), &r);
@@ -285,6 +290,7 @@ static inline void blk_add_trace_remap(struct request_queue *q, struct bio *bio,
285#define blk_add_trace_generic(q, rq, rw, what) do { } while (0) 290#define blk_add_trace_generic(q, rq, rw, what) do { } while (0)
286#define blk_add_trace_pdu_int(q, what, bio, pdu) do { } while (0) 291#define blk_add_trace_pdu_int(q, what, bio, pdu) do { } while (0)
287#define blk_add_trace_remap(q, bio, dev, f, t) do {} while (0) 292#define blk_add_trace_remap(q, bio, dev, f, t) do {} while (0)
293#define do_blk_trace_setup(q, bdev, buts) (-ENOTTY)
288#endif /* CONFIG_BLK_DEV_IO_TRACE */ 294#endif /* CONFIG_BLK_DEV_IO_TRACE */
289 295#endif /* __KERNEL__ */
290#endif 296#endif
diff --git a/include/linux/bsg.h b/include/linux/bsg.h
index 8547b10c388b..60e377b520f8 100644
--- a/include/linux/bsg.h
+++ b/include/linux/bsg.h
@@ -15,14 +15,18 @@ struct sg_io_v4 {
15 15
16 __u32 request_len; /* [i] in bytes */ 16 __u32 request_len; /* [i] in bytes */
17 __u64 request; /* [i], [*i] {SCSI: cdb} */ 17 __u64 request; /* [i], [*i] {SCSI: cdb} */
18 __u64 request_tag; /* [i] {SCSI: task tag (only if flagged)} */
18 __u32 request_attr; /* [i] {SCSI: task attribute} */ 19 __u32 request_attr; /* [i] {SCSI: task attribute} */
19 __u32 request_tag; /* [i] {SCSI: task tag (only if flagged)} */
20 __u32 request_priority; /* [i] {SCSI: task priority} */ 20 __u32 request_priority; /* [i] {SCSI: task priority} */
21 __u32 request_extra; /* [i] {spare, for padding} */
21 __u32 max_response_len; /* [i] in bytes */ 22 __u32 max_response_len; /* [i] in bytes */
22 __u64 response; /* [i], [*o] {SCSI: (auto)sense data} */ 23 __u64 response; /* [i], [*o] {SCSI: (auto)sense data} */
23 24
24 /* "din_" for data in (from device); "dout_" for data out (to device) */ 25 /* "dout_": data out (to device); "din_": data in (from device) */
26 __u32 dout_iovec_count; /* [i] 0 -> "flat" dout transfer else
27 dout_xfer points to array of iovec */
25 __u32 dout_xfer_len; /* [i] bytes to be transferred to device */ 28 __u32 dout_xfer_len; /* [i] bytes to be transferred to device */
29 __u32 din_iovec_count; /* [i] 0 -> "flat" din transfer */
26 __u32 din_xfer_len; /* [i] bytes to be transferred from device */ 30 __u32 din_xfer_len; /* [i] bytes to be transferred from device */
27 __u64 dout_xferp; /* [i], [*i] */ 31 __u64 dout_xferp; /* [i], [*i] */
28 __u64 din_xferp; /* [i], [*o] */ 32 __u64 din_xferp; /* [i], [*o] */
@@ -39,8 +43,9 @@ struct sg_io_v4 {
39 __u32 info; /* [o] additional information */ 43 __u32 info; /* [o] additional information */
40 __u32 duration; /* [o] time to complete, in milliseconds */ 44 __u32 duration; /* [o] time to complete, in milliseconds */
41 __u32 response_len; /* [o] bytes of response actually written */ 45 __u32 response_len; /* [o] bytes of response actually written */
42 __s32 din_resid; /* [o] actual_din_xfer_len - din_xfer_len */ 46 __s32 din_resid; /* [o] din_xfer_len - actual_din_xfer_len */
43 __u32 generated_tag; /* [o] {SCSI: task tag that transport chose} */ 47 __s32 dout_resid; /* [o] dout_xfer_len - actual_dout_xfer_len */
48 __u64 generated_tag; /* [o] {SCSI: transport generated task tag} */
44 __u32 spare_out; /* [o] */ 49 __u32 spare_out; /* [o] */
45 50
46 __u32 padding; 51 __u32 padding;
@@ -53,15 +58,19 @@ struct bsg_class_device {
53 struct class_device *class_dev; 58 struct class_device *class_dev;
54 struct device *dev; 59 struct device *dev;
55 int minor; 60 int minor;
56 struct list_head list;
57 struct request_queue *queue; 61 struct request_queue *queue;
58}; 62};
59 63
60extern int bsg_register_queue(struct request_queue *, const char *); 64extern int bsg_register_queue(struct request_queue *, struct device *, const char *);
61extern void bsg_unregister_queue(struct request_queue *); 65extern void bsg_unregister_queue(struct request_queue *);
62#else 66#else
63#define bsg_register_queue(disk, name) (0) 67static inline int bsg_register_queue(struct request_queue * rq, struct device *dev, const char *name)
64#define bsg_unregister_queue(disk) do { } while (0) 68{
69 return 0;
70}
71static inline void bsg_unregister_queue(struct request_queue *rq)
72{
73}
65#endif 74#endif
66 75
67#endif /* __KERNEL__ */ 76#endif /* __KERNEL__ */
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 5c6e12853a9b..35cadad84b14 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -209,6 +209,8 @@ int cont_prepare_write(struct page*, unsigned, unsigned, get_block_t*,
209int generic_cont_expand(struct inode *inode, loff_t size); 209int generic_cont_expand(struct inode *inode, loff_t size);
210int generic_cont_expand_simple(struct inode *inode, loff_t size); 210int generic_cont_expand_simple(struct inode *inode, loff_t size);
211int block_commit_write(struct page *page, unsigned from, unsigned to); 211int block_commit_write(struct page *page, unsigned from, unsigned to);
212int block_page_mkwrite(struct vm_area_struct *vma, struct page *page,
213 get_block_t get_block);
212void block_sync_page(struct page *); 214void block_sync_page(struct page *);
213sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *); 215sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *);
214int generic_commit_write(struct file *, struct page *, unsigned, unsigned); 216int generic_commit_write(struct file *, struct page *, unsigned, unsigned);
diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h
index 8486e78f7335..d2ddea926895 100644
--- a/include/linux/clockchips.h
+++ b/include/linux/clockchips.h
@@ -8,7 +8,7 @@
8#ifndef _LINUX_CLOCKCHIPS_H 8#ifndef _LINUX_CLOCKCHIPS_H
9#define _LINUX_CLOCKCHIPS_H 9#define _LINUX_CLOCKCHIPS_H
10 10
11#ifdef CONFIG_GENERIC_CLOCKEVENTS 11#ifdef CONFIG_GENERIC_CLOCKEVENTS_BUILD
12 12
13#include <linux/clocksource.h> 13#include <linux/clocksource.h>
14#include <linux/cpumask.h> 14#include <linux/cpumask.h>
@@ -23,6 +23,7 @@ enum clock_event_mode {
23 CLOCK_EVT_MODE_SHUTDOWN, 23 CLOCK_EVT_MODE_SHUTDOWN,
24 CLOCK_EVT_MODE_PERIODIC, 24 CLOCK_EVT_MODE_PERIODIC,
25 CLOCK_EVT_MODE_ONESHOT, 25 CLOCK_EVT_MODE_ONESHOT,
26 CLOCK_EVT_MODE_RESUME,
26}; 27};
27 28
28/* Clock event notification values */ 29/* Clock event notification values */
@@ -119,22 +120,20 @@ extern void clockevents_register_device(struct clock_event_device *dev);
119 120
120extern void clockevents_exchange_device(struct clock_event_device *old, 121extern void clockevents_exchange_device(struct clock_event_device *old,
121 struct clock_event_device *new); 122 struct clock_event_device *new);
122extern
123struct clock_event_device *clockevents_request_device(unsigned int features,
124 cpumask_t cpumask);
125extern void clockevents_release_device(struct clock_event_device *dev);
126extern void clockevents_set_mode(struct clock_event_device *dev, 123extern void clockevents_set_mode(struct clock_event_device *dev,
127 enum clock_event_mode mode); 124 enum clock_event_mode mode);
128extern int clockevents_register_notifier(struct notifier_block *nb); 125extern int clockevents_register_notifier(struct notifier_block *nb);
129extern void clockevents_unregister_notifier(struct notifier_block *nb);
130extern int clockevents_program_event(struct clock_event_device *dev, 126extern int clockevents_program_event(struct clock_event_device *dev,
131 ktime_t expires, ktime_t now); 127 ktime_t expires, ktime_t now);
132 128
129#ifdef CONFIG_GENERIC_CLOCKEVENTS
133extern void clockevents_notify(unsigned long reason, void *arg); 130extern void clockevents_notify(unsigned long reason, void *arg);
134
135#else 131#else
132# define clockevents_notify(reason, arg) do { } while (0)
133#endif
134
135#else /* CONFIG_GENERIC_CLOCKEVENTS_BUILD */
136 136
137static inline void clockevents_resume_events(void) { }
138#define clockevents_notify(reason, arg) do { } while (0) 137#define clockevents_notify(reason, arg) do { } while (0)
139 138
140#endif 139#endif
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index bf297b03a4e4..16ea3374dddf 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -67,6 +67,12 @@ struct clocksource {
67 unsigned long flags; 67 unsigned long flags;
68 cycle_t (*vread)(void); 68 cycle_t (*vread)(void);
69 void (*resume)(void); 69 void (*resume)(void);
70#ifdef CONFIG_IA64
71 void *fsys_mmio; /* used by fsyscall asm code */
72#define CLKSRC_FSYS_MMIO_SET(mmio, addr) ((mmio) = (addr))
73#else
74#define CLKSRC_FSYS_MMIO_SET(mmio, addr) do { } while (0)
75#endif
70 76
71 /* timekeeping specific data, ignore */ 77 /* timekeeping specific data, ignore */
72 cycle_t cycle_interval; 78 cycle_t cycle_interval;
diff --git a/include/linux/coda_linux.h b/include/linux/coda_linux.h
index e4ac016ad272..1c47a34aa794 100644
--- a/include/linux/coda_linux.h
+++ b/include/linux/coda_linux.h
@@ -36,16 +36,12 @@ extern const struct file_operations coda_ioctl_operations;
36 36
37/* operations shared over more than one file */ 37/* operations shared over more than one file */
38int coda_open(struct inode *i, struct file *f); 38int coda_open(struct inode *i, struct file *f);
39int coda_flush(struct file *f, fl_owner_t id);
40int coda_release(struct inode *i, struct file *f); 39int coda_release(struct inode *i, struct file *f);
41int coda_permission(struct inode *inode, int mask, struct nameidata *nd); 40int coda_permission(struct inode *inode, int mask, struct nameidata *nd);
42int coda_revalidate_inode(struct dentry *); 41int coda_revalidate_inode(struct dentry *);
43int coda_getattr(struct vfsmount *, struct dentry *, struct kstat *); 42int coda_getattr(struct vfsmount *, struct dentry *, struct kstat *);
44int coda_setattr(struct dentry *, struct iattr *); 43int coda_setattr(struct dentry *, struct iattr *);
45 44
46/* global variables */
47extern int coda_fake_statfs;
48
49/* this file: heloers */ 45/* this file: heloers */
50static __inline__ struct CodaFid *coda_i2f(struct inode *); 46static __inline__ struct CodaFid *coda_i2f(struct inode *);
51static __inline__ char *coda_i2s(struct inode *); 47static __inline__ char *coda_i2s(struct inode *);
diff --git a/include/linux/coda_proc.h b/include/linux/coda_proc.h
deleted file mode 100644
index 0dc1b0458e75..000000000000
--- a/include/linux/coda_proc.h
+++ /dev/null
@@ -1,76 +0,0 @@
1/*
2 * coda_statis.h
3 *
4 * CODA operation statistics
5 *
6 * (c) March, 1998
7 * by Michihiro Kuramochi, Zhenyu Xia and Zhanyong Wan
8 * zhanyong.wan@yale.edu
9 *
10 */
11
12#ifndef _CODA_PROC_H
13#define _CODA_PROC_H
14
15void coda_sysctl_init(void);
16void coda_sysctl_clean(void);
17
18#include <linux/sysctl.h>
19#include <linux/coda_fs_i.h>
20#include <linux/coda.h>
21
22/* these four files are presented to show the result of the statistics:
23 *
24 * /proc/fs/coda/vfs_stats
25 * cache_inv_stats
26 *
27 * these four files are presented to reset the statistics to 0:
28 *
29 * /proc/sys/coda/vfs_stats
30 * cache_inv_stats
31 */
32
33/* VFS operation statistics */
34struct coda_vfs_stats
35{
36 /* file operations */
37 int open;
38 int flush;
39 int release;
40 int fsync;
41
42 /* dir operations */
43 int readdir;
44
45 /* inode operations */
46 int create;
47 int lookup;
48 int link;
49 int unlink;
50 int symlink;
51 int mkdir;
52 int rmdir;
53 int rename;
54 int permission;
55
56 /* symlink operatoins*/
57 int follow_link;
58 int readlink;
59};
60
61/* cache invalidation statistics */
62struct coda_cache_inv_stats
63{
64 int flush;
65 int purge_user;
66 int zap_dir;
67 int zap_file;
68 int zap_vnode;
69 int purge_fid;
70 int replace;
71};
72
73/* these global variables hold the actual statistics data */
74extern struct coda_vfs_stats coda_vfs_stat;
75
76#endif /* _CODA_PROC_H */
diff --git a/include/linux/coda_psdev.h b/include/linux/coda_psdev.h
index b541bb3d1f4b..07ae8f846055 100644
--- a/include/linux/coda_psdev.h
+++ b/include/linux/coda_psdev.h
@@ -8,11 +8,6 @@
8 8
9struct kstatfs; 9struct kstatfs;
10 10
11struct coda_sb_info
12{
13 struct venus_comm *sbi_vcomm;
14};
15
16/* communication pending/processing queues */ 11/* communication pending/processing queues */
17struct venus_comm { 12struct venus_comm {
18 u_long vc_seq; 13 u_long vc_seq;
@@ -24,9 +19,9 @@ struct venus_comm {
24}; 19};
25 20
26 21
27static inline struct coda_sb_info *coda_sbp(struct super_block *sb) 22static inline struct venus_comm *coda_vcp(struct super_block *sb)
28{ 23{
29 return ((struct coda_sb_info *)((sb)->s_fs_info)); 24 return (struct venus_comm *)((sb)->s_fs_info);
30} 25}
31 26
32 27
@@ -38,9 +33,6 @@ int venus_setattr(struct super_block *, struct CodaFid *, struct coda_vattr *);
38int venus_lookup(struct super_block *sb, struct CodaFid *fid, 33int venus_lookup(struct super_block *sb, struct CodaFid *fid,
39 const char *name, int length, int *type, 34 const char *name, int length, int *type,
40 struct CodaFid *resfid); 35 struct CodaFid *resfid);
41int venus_store(struct super_block *sb, struct CodaFid *fid, int flags,
42 vuid_t uid);
43int venus_release(struct super_block *sb, struct CodaFid *fid, int flags);
44int venus_close(struct super_block *sb, struct CodaFid *fid, int flags, 36int venus_close(struct super_block *sb, struct CodaFid *fid, int flags,
45 vuid_t uid); 37 vuid_t uid);
46int venus_open(struct super_block *sb, struct CodaFid *fid, int flags, 38int venus_open(struct super_block *sb, struct CodaFid *fid, int flags,
@@ -74,8 +66,6 @@ int venus_statfs(struct dentry *dentry, struct kstatfs *sfs);
74 66
75 67
76/* messages between coda filesystem in kernel and Venus */ 68/* messages between coda filesystem in kernel and Venus */
77extern int coda_hard;
78extern unsigned long coda_timeout;
79struct upc_req { 69struct upc_req {
80 struct list_head uc_chain; 70 struct list_head uc_chain;
81 caddr_t uc_data; 71 caddr_t uc_data;
@@ -85,7 +75,6 @@ struct upc_req {
85 u_short uc_opcode; /* copied from data to save lookup */ 75 u_short uc_opcode; /* copied from data to save lookup */
86 int uc_unique; 76 int uc_unique;
87 wait_queue_head_t uc_sleep; /* process' wait queue */ 77 wait_queue_head_t uc_sleep; /* process' wait queue */
88 unsigned long uc_posttime;
89}; 78};
90 79
91#define REQ_ASYNC 0x1 80#define REQ_ASYNC 0x1
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h
index a03e9398a6c2..14f7494280f0 100644
--- a/include/linux/compiler-gcc4.h
+++ b/include/linux/compiler-gcc4.h
@@ -23,3 +23,21 @@
23 * code 23 * code
24 */ 24 */
25#define uninitialized_var(x) x = x 25#define uninitialized_var(x) x = x
26
27#if !(__GNUC__ == 4 && __GNUC_MINOR__ < 3)
28/* Mark functions as cold. gcc will assume any path leading to a call
29 to them will be unlikely. This means a lot of manual unlikely()s
30 are unnecessary now for any paths leading to the usual suspects
31 like BUG(), printk(), panic() etc. [but let's keep them for now for
32 older compilers]
33
34 Early snapshots of gcc 4.3 don't support this and we can't detect this
35 in the preprocessor, but we can live with this because they're unreleased.
36 Maketime probing would be overkill here.
37
38 gcc also has a __attribute__((__hot__)) to move hot functions into
39 a special section, but I don't see any sense in this right now in
40 the kernel context */
41#define __cold __attribute__((__cold__))
42
43#endif
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 8287a72bb6a9..86f9a3a6137d 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -15,8 +15,8 @@
15# define __acquire(x) __context__(x,1) 15# define __acquire(x) __context__(x,1)
16# define __release(x) __context__(x,-1) 16# define __release(x) __context__(x,-1)
17# define __cond_lock(x,c) ((c) ? ({ __acquire(x); 1; }) : 0) 17# define __cond_lock(x,c) ((c) ? ({ __acquire(x); 1; }) : 0)
18extern void __chk_user_ptr(const void __user *); 18extern void __chk_user_ptr(const volatile void __user *);
19extern void __chk_io_ptr(const void __iomem *); 19extern void __chk_io_ptr(const volatile void __iomem *);
20#else 20#else
21# define __user 21# define __user
22# define __kernel 22# define __kernel
@@ -174,4 +174,13 @@ extern void __chk_io_ptr(const void __iomem *);
174# define __attribute_const__ /* unimplemented */ 174# define __attribute_const__ /* unimplemented */
175#endif 175#endif
176 176
177/*
178 * Tell gcc if a function is cold. The compiler will assume any path
179 * directly leading to the call is unlikely.
180 */
181
182#ifndef __cold
183#define __cold
184#endif
185
177#endif /* __LINUX_COMPILER_H */ 186#endif /* __LINUX_COMPILER_H */
diff --git a/include/linux/connector.h b/include/linux/connector.h
index 10eb56b2940a..b62f823e90cf 100644
--- a/include/linux/connector.h
+++ b/include/linux/connector.h
@@ -153,7 +153,7 @@ struct cn_dev {
153 153
154 u32 seq, groups; 154 u32 seq, groups;
155 struct sock *nls; 155 struct sock *nls;
156 void (*input) (struct sock * sk, int len); 156 void (*input) (struct sk_buff *skb);
157 157
158 struct cn_queue_dev *cbdev; 158 struct cn_queue_dev *cbdev;
159}; 159};
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index c2236bbff412..0ad72c4cf312 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -41,8 +41,6 @@ extern void cpu_remove_sysdev_attr(struct sysdev_attribute *attr);
41extern int cpu_add_sysdev_attr_group(struct attribute_group *attrs); 41extern int cpu_add_sysdev_attr_group(struct attribute_group *attrs);
42extern void cpu_remove_sysdev_attr_group(struct attribute_group *attrs); 42extern void cpu_remove_sysdev_attr_group(struct attribute_group *attrs);
43 43
44extern struct sysdev_attribute attr_sched_mc_power_savings;
45extern struct sysdev_attribute attr_sched_smt_power_savings;
46extern int sched_create_sysfs_power_savings_entries(struct sysdev_class *cls); 44extern int sched_create_sysfs_power_savings_entries(struct sysdev_class *cls);
47 45
48#ifdef CONFIG_HOTPLUG_CPU 46#ifdef CONFIG_HOTPLUG_CPU
@@ -128,16 +126,16 @@ static inline void cpuhotplug_mutex_unlock(struct mutex *cpu_hp_mutex)
128static inline int cpu_is_offline(int cpu) { return 0; } 126static inline int cpu_is_offline(int cpu) { return 0; }
129#endif /* CONFIG_HOTPLUG_CPU */ 127#endif /* CONFIG_HOTPLUG_CPU */
130 128
131#ifdef CONFIG_SUSPEND_SMP 129#ifdef CONFIG_PM_SLEEP_SMP
132extern int suspend_cpu_hotplug; 130extern int suspend_cpu_hotplug;
133 131
134extern int disable_nonboot_cpus(void); 132extern int disable_nonboot_cpus(void);
135extern void enable_nonboot_cpus(void); 133extern void enable_nonboot_cpus(void);
136#else 134#else /* !CONFIG_PM_SLEEP_SMP */
137#define suspend_cpu_hotplug 0 135#define suspend_cpu_hotplug 0
138 136
139static inline int disable_nonboot_cpus(void) { return 0; } 137static inline int disable_nonboot_cpus(void) { return 0; }
140static inline void enable_nonboot_cpus(void) {} 138static inline void enable_nonboot_cpus(void) {}
141#endif 139#endif /* !CONFIG_PM_SLEEP_SMP */
142 140
143#endif /* _LINUX_CPU_H_ */ 141#endif /* _LINUX_CPU_H_ */
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 963051a967d6..23932d7741a9 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -32,20 +32,24 @@
32 * CPUFREQ NOTIFIER INTERFACE * 32 * CPUFREQ NOTIFIER INTERFACE *
33 *********************************************************************/ 33 *********************************************************************/
34 34
35#define CPUFREQ_TRANSITION_NOTIFIER (0)
36#define CPUFREQ_POLICY_NOTIFIER (1)
37
35#ifdef CONFIG_CPU_FREQ 38#ifdef CONFIG_CPU_FREQ
36int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list); 39int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list);
37#else 40int cpufreq_unregister_notifier(struct notifier_block *nb, unsigned int list);
41#else /* CONFIG_CPU_FREQ */
38static inline int cpufreq_register_notifier(struct notifier_block *nb, 42static inline int cpufreq_register_notifier(struct notifier_block *nb,
39 unsigned int list) 43 unsigned int list)
40{ 44{
41 return 0; 45 return 0;
42} 46}
43#endif 47static inline int cpufreq_unregister_notifier(struct notifier_block *nb,
44int cpufreq_unregister_notifier(struct notifier_block *nb, unsigned int list); 48 unsigned int list)
45 49{
46#define CPUFREQ_TRANSITION_NOTIFIER (0) 50 return 0;
47#define CPUFREQ_POLICY_NOTIFIER (1) 51}
48 52#endif /* CONFIG_CPU_FREQ */
49 53
50/* if (cpufreq_driver->target) exists, the ->governor decides what frequency 54/* if (cpufreq_driver->target) exists, the ->governor decides what frequency
51 * within the limits is used. If (cpufreq_driver->setpolicy> exists, these 55 * within the limits is used. If (cpufreq_driver->setpolicy> exists, these
@@ -163,6 +167,9 @@ struct cpufreq_governor {
163 char name[CPUFREQ_NAME_LEN]; 167 char name[CPUFREQ_NAME_LEN];
164 int (*governor) (struct cpufreq_policy *policy, 168 int (*governor) (struct cpufreq_policy *policy,
165 unsigned int event); 169 unsigned int event);
170 unsigned int max_transition_latency; /* HW must be able to switch to
171 next freq faster than this value in nano secs or we
172 will fallback to performance governor */
166 struct list_head governor_list; 173 struct list_head governor_list;
167 struct module *owner; 174 struct module *owner;
168}; 175};
@@ -268,22 +275,17 @@ struct freq_attr {
268int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu); 275int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu);
269int cpufreq_update_policy(unsigned int cpu); 276int cpufreq_update_policy(unsigned int cpu);
270 277
278/* query the current CPU frequency (in kHz). If zero, cpufreq couldn't detect it */
279unsigned int cpufreq_get(unsigned int cpu);
271 280
272/* 281/* query the last known CPU freq (in kHz). If zero, cpufreq couldn't detect it */
273 * query the last known CPU freq (in kHz). If zero, cpufreq couldn't detect it
274 */
275#ifdef CONFIG_CPU_FREQ 282#ifdef CONFIG_CPU_FREQ
276unsigned int cpufreq_quick_get(unsigned int cpu); 283unsigned int cpufreq_quick_get(unsigned int cpu);
277unsigned int cpufreq_get(unsigned int cpu);
278#else 284#else
279static inline unsigned int cpufreq_quick_get(unsigned int cpu) 285static inline unsigned int cpufreq_quick_get(unsigned int cpu)
280{ 286{
281 return 0; 287 return 0;
282} 288}
283static inline unsigned int cpufreq_get(unsigned int cpu)
284{
285 return 0;
286}
287#endif 289#endif
288 290
289 291
@@ -292,12 +294,24 @@ static inline unsigned int cpufreq_get(unsigned int cpu)
292 *********************************************************************/ 294 *********************************************************************/
293 295
294 296
295#ifdef CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE 297/*
298 Performance governor is fallback governor if any other gov failed to
299 auto load due latency restrictions
300*/
301#ifdef CONFIG_CPU_FREQ_GOV_PERFORMANCE
296extern struct cpufreq_governor cpufreq_gov_performance; 302extern struct cpufreq_governor cpufreq_gov_performance;
297#define CPUFREQ_DEFAULT_GOVERNOR &cpufreq_gov_performance 303#endif
304#ifdef CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE
305#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_performance)
298#elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE) 306#elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE)
299extern struct cpufreq_governor cpufreq_gov_userspace; 307extern struct cpufreq_governor cpufreq_gov_userspace;
300#define CPUFREQ_DEFAULT_GOVERNOR &cpufreq_gov_userspace 308#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_userspace)
309#elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND)
310extern struct cpufreq_governor cpufreq_gov_ondemand;
311#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_ondemand)
312#elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE)
313extern struct cpufreq_governor cpufreq_gov_conservative;
314#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_conservative)
301#endif 315#endif
302 316
303 317
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index 357e8cfedc37..fc32694287e2 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -34,6 +34,7 @@
34#define CRYPTO_ALG_TYPE_HASH 0x00000003 34#define CRYPTO_ALG_TYPE_HASH 0x00000003
35#define CRYPTO_ALG_TYPE_BLKCIPHER 0x00000004 35#define CRYPTO_ALG_TYPE_BLKCIPHER 0x00000004
36#define CRYPTO_ALG_TYPE_COMPRESS 0x00000005 36#define CRYPTO_ALG_TYPE_COMPRESS 0x00000005
37#define CRYPTO_ALG_TYPE_AEAD 0x00000006
37 38
38#define CRYPTO_ALG_TYPE_HASH_MASK 0x0000000e 39#define CRYPTO_ALG_TYPE_HASH_MASK 0x0000000e
39 40
@@ -91,9 +92,9 @@
91struct scatterlist; 92struct scatterlist;
92struct crypto_ablkcipher; 93struct crypto_ablkcipher;
93struct crypto_async_request; 94struct crypto_async_request;
95struct crypto_aead;
94struct crypto_blkcipher; 96struct crypto_blkcipher;
95struct crypto_hash; 97struct crypto_hash;
96struct crypto_queue;
97struct crypto_tfm; 98struct crypto_tfm;
98struct crypto_type; 99struct crypto_type;
99 100
@@ -121,6 +122,32 @@ struct ablkcipher_request {
121 void *__ctx[] CRYPTO_MINALIGN_ATTR; 122 void *__ctx[] CRYPTO_MINALIGN_ATTR;
122}; 123};
123 124
125/**
126 * struct aead_request - AEAD request
127 * @base: Common attributes for async crypto requests
128 * @assoclen: Length in bytes of associated data for authentication
129 * @cryptlen: Length of data to be encrypted or decrypted
130 * @iv: Initialisation vector
131 * @assoc: Associated data
132 * @src: Source data
133 * @dst: Destination data
134 * @__ctx: Start of private context data
135 */
136struct aead_request {
137 struct crypto_async_request base;
138
139 unsigned int assoclen;
140 unsigned int cryptlen;
141
142 u8 *iv;
143
144 struct scatterlist *assoc;
145 struct scatterlist *src;
146 struct scatterlist *dst;
147
148 void *__ctx[] CRYPTO_MINALIGN_ATTR;
149};
150
124struct blkcipher_desc { 151struct blkcipher_desc {
125 struct crypto_blkcipher *tfm; 152 struct crypto_blkcipher *tfm;
126 void *info; 153 void *info;
@@ -150,13 +177,21 @@ struct ablkcipher_alg {
150 int (*encrypt)(struct ablkcipher_request *req); 177 int (*encrypt)(struct ablkcipher_request *req);
151 int (*decrypt)(struct ablkcipher_request *req); 178 int (*decrypt)(struct ablkcipher_request *req);
152 179
153 struct crypto_queue *queue;
154
155 unsigned int min_keysize; 180 unsigned int min_keysize;
156 unsigned int max_keysize; 181 unsigned int max_keysize;
157 unsigned int ivsize; 182 unsigned int ivsize;
158}; 183};
159 184
185struct aead_alg {
186 int (*setkey)(struct crypto_aead *tfm, const u8 *key,
187 unsigned int keylen);
188 int (*encrypt)(struct aead_request *req);
189 int (*decrypt)(struct aead_request *req);
190
191 unsigned int ivsize;
192 unsigned int authsize;
193};
194
160struct blkcipher_alg { 195struct blkcipher_alg {
161 int (*setkey)(struct crypto_tfm *tfm, const u8 *key, 196 int (*setkey)(struct crypto_tfm *tfm, const u8 *key,
162 unsigned int keylen); 197 unsigned int keylen);
@@ -212,6 +247,7 @@ struct compress_alg {
212}; 247};
213 248
214#define cra_ablkcipher cra_u.ablkcipher 249#define cra_ablkcipher cra_u.ablkcipher
250#define cra_aead cra_u.aead
215#define cra_blkcipher cra_u.blkcipher 251#define cra_blkcipher cra_u.blkcipher
216#define cra_cipher cra_u.cipher 252#define cra_cipher cra_u.cipher
217#define cra_digest cra_u.digest 253#define cra_digest cra_u.digest
@@ -237,6 +273,7 @@ struct crypto_alg {
237 273
238 union { 274 union {
239 struct ablkcipher_alg ablkcipher; 275 struct ablkcipher_alg ablkcipher;
276 struct aead_alg aead;
240 struct blkcipher_alg blkcipher; 277 struct blkcipher_alg blkcipher;
241 struct cipher_alg cipher; 278 struct cipher_alg cipher;
242 struct digest_alg digest; 279 struct digest_alg digest;
@@ -284,6 +321,16 @@ struct ablkcipher_tfm {
284 unsigned int reqsize; 321 unsigned int reqsize;
285}; 322};
286 323
324struct aead_tfm {
325 int (*setkey)(struct crypto_aead *tfm, const u8 *key,
326 unsigned int keylen);
327 int (*encrypt)(struct aead_request *req);
328 int (*decrypt)(struct aead_request *req);
329 unsigned int ivsize;
330 unsigned int authsize;
331 unsigned int reqsize;
332};
333
287struct blkcipher_tfm { 334struct blkcipher_tfm {
288 void *iv; 335 void *iv;
289 int (*setkey)(struct crypto_tfm *tfm, const u8 *key, 336 int (*setkey)(struct crypto_tfm *tfm, const u8 *key,
@@ -323,6 +370,7 @@ struct compress_tfm {
323}; 370};
324 371
325#define crt_ablkcipher crt_u.ablkcipher 372#define crt_ablkcipher crt_u.ablkcipher
373#define crt_aead crt_u.aead
326#define crt_blkcipher crt_u.blkcipher 374#define crt_blkcipher crt_u.blkcipher
327#define crt_cipher crt_u.cipher 375#define crt_cipher crt_u.cipher
328#define crt_hash crt_u.hash 376#define crt_hash crt_u.hash
@@ -334,6 +382,7 @@ struct crypto_tfm {
334 382
335 union { 383 union {
336 struct ablkcipher_tfm ablkcipher; 384 struct ablkcipher_tfm ablkcipher;
385 struct aead_tfm aead;
337 struct blkcipher_tfm blkcipher; 386 struct blkcipher_tfm blkcipher;
338 struct cipher_tfm cipher; 387 struct cipher_tfm cipher;
339 struct hash_tfm hash; 388 struct hash_tfm hash;
@@ -349,6 +398,10 @@ struct crypto_ablkcipher {
349 struct crypto_tfm base; 398 struct crypto_tfm base;
350}; 399};
351 400
401struct crypto_aead {
402 struct crypto_tfm base;
403};
404
352struct crypto_blkcipher { 405struct crypto_blkcipher {
353 struct crypto_tfm base; 406 struct crypto_tfm base;
354}; 407};
@@ -369,11 +422,15 @@ enum {
369 CRYPTOA_UNSPEC, 422 CRYPTOA_UNSPEC,
370 CRYPTOA_ALG, 423 CRYPTOA_ALG,
371 CRYPTOA_TYPE, 424 CRYPTOA_TYPE,
425 CRYPTOA_U32,
372 __CRYPTOA_MAX, 426 __CRYPTOA_MAX,
373}; 427};
374 428
375#define CRYPTOA_MAX (__CRYPTOA_MAX - 1) 429#define CRYPTOA_MAX (__CRYPTOA_MAX - 1)
376 430
431/* Maximum number of (rtattr) parameters for each template. */
432#define CRYPTO_MAX_ATTRS 32
433
377struct crypto_attr_alg { 434struct crypto_attr_alg {
378 char name[CRYPTO_MAX_ALG_NAME]; 435 char name[CRYPTO_MAX_ALG_NAME];
379}; 436};
@@ -383,6 +440,10 @@ struct crypto_attr_type {
383 u32 mask; 440 u32 mask;
384}; 441};
385 442
443struct crypto_attr_u32 {
444 u32 num;
445};
446
386/* 447/*
387 * Transform user interface. 448 * Transform user interface.
388 */ 449 */
@@ -563,7 +624,8 @@ static inline int crypto_ablkcipher_decrypt(struct ablkcipher_request *req)
563 return crt->decrypt(req); 624 return crt->decrypt(req);
564} 625}
565 626
566static inline int crypto_ablkcipher_reqsize(struct crypto_ablkcipher *tfm) 627static inline unsigned int crypto_ablkcipher_reqsize(
628 struct crypto_ablkcipher *tfm)
567{ 629{
568 return crypto_ablkcipher_crt(tfm)->reqsize; 630 return crypto_ablkcipher_crt(tfm)->reqsize;
569} 631}
@@ -619,6 +681,150 @@ static inline void ablkcipher_request_set_crypt(
619 req->info = iv; 681 req->info = iv;
620} 682}
621 683
684static inline struct crypto_aead *__crypto_aead_cast(struct crypto_tfm *tfm)
685{
686 return (struct crypto_aead *)tfm;
687}
688
689static inline struct crypto_aead *crypto_alloc_aead(const char *alg_name,
690 u32 type, u32 mask)
691{
692 type &= ~CRYPTO_ALG_TYPE_MASK;
693 type |= CRYPTO_ALG_TYPE_AEAD;
694 mask |= CRYPTO_ALG_TYPE_MASK;
695
696 return __crypto_aead_cast(crypto_alloc_base(alg_name, type, mask));
697}
698
699static inline struct crypto_tfm *crypto_aead_tfm(struct crypto_aead *tfm)
700{
701 return &tfm->base;
702}
703
704static inline void crypto_free_aead(struct crypto_aead *tfm)
705{
706 crypto_free_tfm(crypto_aead_tfm(tfm));
707}
708
709static inline struct aead_tfm *crypto_aead_crt(struct crypto_aead *tfm)
710{
711 return &crypto_aead_tfm(tfm)->crt_aead;
712}
713
714static inline unsigned int crypto_aead_ivsize(struct crypto_aead *tfm)
715{
716 return crypto_aead_crt(tfm)->ivsize;
717}
718
719static inline unsigned int crypto_aead_authsize(struct crypto_aead *tfm)
720{
721 return crypto_aead_crt(tfm)->authsize;
722}
723
724static inline unsigned int crypto_aead_blocksize(struct crypto_aead *tfm)
725{
726 return crypto_tfm_alg_blocksize(crypto_aead_tfm(tfm));
727}
728
729static inline unsigned int crypto_aead_alignmask(struct crypto_aead *tfm)
730{
731 return crypto_tfm_alg_alignmask(crypto_aead_tfm(tfm));
732}
733
734static inline u32 crypto_aead_get_flags(struct crypto_aead *tfm)
735{
736 return crypto_tfm_get_flags(crypto_aead_tfm(tfm));
737}
738
739static inline void crypto_aead_set_flags(struct crypto_aead *tfm, u32 flags)
740{
741 crypto_tfm_set_flags(crypto_aead_tfm(tfm), flags);
742}
743
744static inline void crypto_aead_clear_flags(struct crypto_aead *tfm, u32 flags)
745{
746 crypto_tfm_clear_flags(crypto_aead_tfm(tfm), flags);
747}
748
749static inline int crypto_aead_setkey(struct crypto_aead *tfm, const u8 *key,
750 unsigned int keylen)
751{
752 return crypto_aead_crt(tfm)->setkey(tfm, key, keylen);
753}
754
755static inline struct crypto_aead *crypto_aead_reqtfm(struct aead_request *req)
756{
757 return __crypto_aead_cast(req->base.tfm);
758}
759
760static inline int crypto_aead_encrypt(struct aead_request *req)
761{
762 return crypto_aead_crt(crypto_aead_reqtfm(req))->encrypt(req);
763}
764
765static inline int crypto_aead_decrypt(struct aead_request *req)
766{
767 return crypto_aead_crt(crypto_aead_reqtfm(req))->decrypt(req);
768}
769
770static inline unsigned int crypto_aead_reqsize(struct crypto_aead *tfm)
771{
772 return crypto_aead_crt(tfm)->reqsize;
773}
774
775static inline void aead_request_set_tfm(struct aead_request *req,
776 struct crypto_aead *tfm)
777{
778 req->base.tfm = crypto_aead_tfm(tfm);
779}
780
781static inline struct aead_request *aead_request_alloc(struct crypto_aead *tfm,
782 gfp_t gfp)
783{
784 struct aead_request *req;
785
786 req = kmalloc(sizeof(*req) + crypto_aead_reqsize(tfm), gfp);
787
788 if (likely(req))
789 aead_request_set_tfm(req, tfm);
790
791 return req;
792}
793
794static inline void aead_request_free(struct aead_request *req)
795{
796 kfree(req);
797}
798
799static inline void aead_request_set_callback(struct aead_request *req,
800 u32 flags,
801 crypto_completion_t complete,
802 void *data)
803{
804 req->base.complete = complete;
805 req->base.data = data;
806 req->base.flags = flags;
807}
808
809static inline void aead_request_set_crypt(struct aead_request *req,
810 struct scatterlist *src,
811 struct scatterlist *dst,
812 unsigned int cryptlen, u8 *iv)
813{
814 req->src = src;
815 req->dst = dst;
816 req->cryptlen = cryptlen;
817 req->iv = iv;
818}
819
820static inline void aead_request_set_assoc(struct aead_request *req,
821 struct scatterlist *assoc,
822 unsigned int assoclen)
823{
824 req->assoc = assoc;
825 req->assoclen = assoclen;
826}
827
622static inline struct crypto_blkcipher *__crypto_blkcipher_cast( 828static inline struct crypto_blkcipher *__crypto_blkcipher_cast(
623 struct crypto_tfm *tfm) 829 struct crypto_tfm *tfm)
624{ 830{
diff --git a/include/linux/dccp.h b/include/linux/dccp.h
index fda2148d8c85..f3fc4392e93d 100644
--- a/include/linux/dccp.h
+++ b/include/linux/dccp.h
@@ -56,10 +56,9 @@ struct dccp_hdr_ext {
56}; 56};
57 57
58/** 58/**
59 * struct dccp_hdr_request - Conection initiation request header 59 * struct dccp_hdr_request - Connection initiation request header
60 * 60 *
61 * @dccph_req_service - Service to which the client app wants to connect 61 * @dccph_req_service - Service to which the client app wants to connect
62 * @dccph_req_options - list of options (must be a multiple of 32 bits
63 */ 62 */
64struct dccp_hdr_request { 63struct dccp_hdr_request {
65 __be32 dccph_req_service; 64 __be32 dccph_req_service;
@@ -76,12 +75,10 @@ struct dccp_hdr_ack_bits {
76 __be32 dccph_ack_nr_low; 75 __be32 dccph_ack_nr_low;
77}; 76};
78/** 77/**
79 * struct dccp_hdr_response - Conection initiation response header 78 * struct dccp_hdr_response - Connection initiation response header
80 * 79 *
81 * @dccph_resp_ack_nr_high - 48 bit ack number high order bits, contains GSR 80 * @dccph_resp_ack - 48 bit Acknowledgment Number Subheader (5.3)
82 * @dccph_resp_ack_nr_low - 48 bit ack number low order bits, contains GSR
83 * @dccph_resp_service - Echoes the Service Code on a received DCCP-Request 81 * @dccph_resp_service - Echoes the Service Code on a received DCCP-Request
84 * @dccph_resp_options - list of options (must be a multiple of 32 bits
85 */ 82 */
86struct dccp_hdr_response { 83struct dccp_hdr_response {
87 struct dccp_hdr_ack_bits dccph_resp_ack; 84 struct dccp_hdr_ack_bits dccph_resp_ack;
@@ -91,8 +88,9 @@ struct dccp_hdr_response {
91/** 88/**
92 * struct dccp_hdr_reset - Unconditionally shut down a connection 89 * struct dccp_hdr_reset - Unconditionally shut down a connection
93 * 90 *
94 * @dccph_reset_service - Echoes the Service Code on a received DCCP-Request 91 * @dccph_reset_ack - 48 bit Acknowledgment Number Subheader (5.6)
95 * @dccph_reset_options - list of options (must be a multiple of 32 bits 92 * @dccph_reset_code - one of %dccp_reset_codes
93 * @dccph_reset_data - the Data 1 ... Data 3 fields from 5.6
96 */ 94 */
97struct dccp_hdr_reset { 95struct dccp_hdr_reset {
98 struct dccp_hdr_ack_bits dccph_reset_ack; 96 struct dccp_hdr_ack_bits dccph_reset_ack;
@@ -204,6 +202,7 @@ struct dccp_so_feat {
204#define DCCP_SOCKOPT_SERVICE 2 202#define DCCP_SOCKOPT_SERVICE 2
205#define DCCP_SOCKOPT_CHANGE_L 3 203#define DCCP_SOCKOPT_CHANGE_L 3
206#define DCCP_SOCKOPT_CHANGE_R 4 204#define DCCP_SOCKOPT_CHANGE_R 4
205#define DCCP_SOCKOPT_GET_CUR_MPS 5
207#define DCCP_SOCKOPT_SEND_CSCOV 10 206#define DCCP_SOCKOPT_SEND_CSCOV 10
208#define DCCP_SOCKOPT_RECV_CSCOV 11 207#define DCCP_SOCKOPT_RECV_CSCOV 11
209#define DCCP_SOCKOPT_CCID_RX_INFO 128 208#define DCCP_SOCKOPT_CCID_RX_INFO 128
@@ -215,6 +214,7 @@ struct dccp_so_feat {
215#ifdef __KERNEL__ 214#ifdef __KERNEL__
216 215
217#include <linux/in.h> 216#include <linux/in.h>
217#include <linux/ktime.h>
218#include <linux/list.h> 218#include <linux/list.h>
219#include <linux/uio.h> 219#include <linux/uio.h>
220#include <linux/workqueue.h> 220#include <linux/workqueue.h>
@@ -391,7 +391,6 @@ struct dccp_opt_pend {
391 struct dccp_opt_conf *dccpop_sc; 391 struct dccp_opt_conf *dccpop_sc;
392}; 392};
393 393
394extern void __dccp_minisock_init(struct dccp_minisock *dmsk);
395extern void dccp_minisock_init(struct dccp_minisock *dmsk); 394extern void dccp_minisock_init(struct dccp_minisock *dmsk);
396 395
397extern int dccp_parse_options(struct sock *sk, struct sk_buff *skb); 396extern int dccp_parse_options(struct sock *sk, struct sk_buff *skb);
@@ -471,6 +470,7 @@ struct dccp_ackvec;
471 * @dccps_pcrlen - receiver partial checksum coverage (via sockopt) 470 * @dccps_pcrlen - receiver partial checksum coverage (via sockopt)
472 * @dccps_ndp_count - number of Non Data Packets since last data packet 471 * @dccps_ndp_count - number of Non Data Packets since last data packet
473 * @dccps_mss_cache - current value of MSS (path MTU minus header sizes) 472 * @dccps_mss_cache - current value of MSS (path MTU minus header sizes)
473 * @dccps_rate_last - timestamp for rate-limiting DCCP-Sync (RFC 4340, 7.5.4)
474 * @dccps_minisock - associated minisock (accessed via dccp_msk) 474 * @dccps_minisock - associated minisock (accessed via dccp_msk)
475 * @dccps_hc_rx_ackvec - rx half connection ack vector 475 * @dccps_hc_rx_ackvec - rx half connection ack vector
476 * @dccps_hc_rx_ccid - CCID used for the receiver (or receiving half-connection) 476 * @dccps_hc_rx_ccid - CCID used for the receiver (or receiving half-connection)
@@ -498,7 +498,7 @@ struct dccp_sock {
498 __u64 dccps_gar; 498 __u64 dccps_gar;
499 __be32 dccps_service; 499 __be32 dccps_service;
500 struct dccp_service_list *dccps_service_list; 500 struct dccp_service_list *dccps_service_list;
501 struct timeval dccps_timestamp_time; 501 ktime_t dccps_timestamp_time;
502 __u32 dccps_timestamp_echo; 502 __u32 dccps_timestamp_echo;
503 __u16 dccps_l_ack_ratio; 503 __u16 dccps_l_ack_ratio;
504 __u16 dccps_r_ack_ratio; 504 __u16 dccps_r_ack_ratio;
@@ -506,12 +506,12 @@ struct dccp_sock {
506 __u16 dccps_pcrlen; 506 __u16 dccps_pcrlen;
507 unsigned long dccps_ndp_count; 507 unsigned long dccps_ndp_count;
508 __u32 dccps_mss_cache; 508 __u32 dccps_mss_cache;
509 unsigned long dccps_rate_last;
509 struct dccp_minisock dccps_minisock; 510 struct dccp_minisock dccps_minisock;
510 struct dccp_ackvec *dccps_hc_rx_ackvec; 511 struct dccp_ackvec *dccps_hc_rx_ackvec;
511 struct ccid *dccps_hc_rx_ccid; 512 struct ccid *dccps_hc_rx_ccid;
512 struct ccid *dccps_hc_tx_ccid; 513 struct ccid *dccps_hc_tx_ccid;
513 struct dccp_options_received dccps_options_received; 514 struct dccp_options_received dccps_options_received;
514 struct timeval dccps_epoch;
515 enum dccp_role dccps_role:2; 515 enum dccp_role dccps_role:2;
516 __u8 dccps_hc_rx_insert_options:1; 516 __u8 dccps_hc_rx_insert_options:1;
517 __u8 dccps_hc_tx_insert_options:1; 517 __u8 dccps_hc_tx_insert_options:1;
diff --git a/include/linux/dcookies.h b/include/linux/dcookies.h
index 0fe7cdf326f7..98c69ab80c84 100644
--- a/include/linux/dcookies.h
+++ b/include/linux/dcookies.h
@@ -12,6 +12,7 @@
12 12
13#ifdef CONFIG_PROFILING 13#ifdef CONFIG_PROFILING
14 14
15#include <linux/dcache.h>
15#include <linux/types.h> 16#include <linux/types.h>
16 17
17struct dcookie_user; 18struct dcookie_user;
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h
index 104e51e20e14..f592d6de3b97 100644
--- a/include/linux/debugfs.h
+++ b/include/linux/debugfs.h
@@ -49,6 +49,12 @@ struct dentry *debugfs_create_u32(const char *name, mode_t mode,
49 struct dentry *parent, u32 *value); 49 struct dentry *parent, u32 *value);
50struct dentry *debugfs_create_u64(const char *name, mode_t mode, 50struct dentry *debugfs_create_u64(const char *name, mode_t mode,
51 struct dentry *parent, u64 *value); 51 struct dentry *parent, u64 *value);
52struct dentry *debugfs_create_x8(const char *name, mode_t mode,
53 struct dentry *parent, u8 *value);
54struct dentry *debugfs_create_x16(const char *name, mode_t mode,
55 struct dentry *parent, u16 *value);
56struct dentry *debugfs_create_x32(const char *name, mode_t mode,
57 struct dentry *parent, u32 *value);
52struct dentry *debugfs_create_bool(const char *name, mode_t mode, 58struct dentry *debugfs_create_bool(const char *name, mode_t mode,
53 struct dentry *parent, u32 *value); 59 struct dentry *parent, u32 *value);
54 60
@@ -122,6 +128,27 @@ static inline struct dentry *debugfs_create_u64(const char *name, mode_t mode,
122 return ERR_PTR(-ENODEV); 128 return ERR_PTR(-ENODEV);
123} 129}
124 130
131static inline struct dentry *debugfs_create_x8(const char *name, mode_t mode,
132 struct dentry *parent,
133 u8 *value)
134{
135 return ERR_PTR(-ENODEV);
136}
137
138static inline struct dentry *debugfs_create_x16(const char *name, mode_t mode,
139 struct dentry *parent,
140 u16 *value)
141{
142 return ERR_PTR(-ENODEV);
143}
144
145static inline struct dentry *debugfs_create_x32(const char *name, mode_t mode,
146 struct dentry *parent,
147 u32 *value)
148{
149 return ERR_PTR(-ENODEV);
150}
151
125static inline struct dentry *debugfs_create_bool(const char *name, mode_t mode, 152static inline struct dentry *debugfs_create_bool(const char *name, mode_t mode,
126 struct dentry *parent, 153 struct dentry *parent,
127 u32 *value) 154 u32 *value)
diff --git a/include/linux/device.h b/include/linux/device.h
index be2debed70d2..2e15822fe409 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -64,12 +64,9 @@ struct bus_type {
64 struct bus_attribute * bus_attrs; 64 struct bus_attribute * bus_attrs;
65 struct device_attribute * dev_attrs; 65 struct device_attribute * dev_attrs;
66 struct driver_attribute * drv_attrs; 66 struct driver_attribute * drv_attrs;
67 struct bus_attribute drivers_autoprobe_attr;
68 struct bus_attribute drivers_probe_attr;
69 67
70 int (*match)(struct device * dev, struct device_driver * drv); 68 int (*match)(struct device * dev, struct device_driver * drv);
71 int (*uevent)(struct device *dev, char **envp, 69 int (*uevent)(struct device *dev, struct kobj_uevent_env *env);
72 int num_envp, char *buffer, int buffer_size);
73 int (*probe)(struct device * dev); 70 int (*probe)(struct device * dev);
74 int (*remove)(struct device * dev); 71 int (*remove)(struct device * dev);
75 void (*shutdown)(struct device * dev); 72 void (*shutdown)(struct device * dev);
@@ -189,10 +186,8 @@ struct class {
189 struct class_device_attribute * class_dev_attrs; 186 struct class_device_attribute * class_dev_attrs;
190 struct device_attribute * dev_attrs; 187 struct device_attribute * dev_attrs;
191 188
192 int (*uevent)(struct class_device *dev, char **envp, 189 int (*uevent)(struct class_device *dev, struct kobj_uevent_env *env);
193 int num_envp, char *buffer, int buffer_size); 190 int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env);
194 int (*dev_uevent)(struct device *dev, char **envp, int num_envp,
195 char *buffer, int buffer_size);
196 191
197 void (*release)(struct class_device *dev); 192 void (*release)(struct class_device *dev);
198 void (*class_release)(struct class *class); 193 void (*class_release)(struct class *class);
@@ -268,8 +263,7 @@ struct class_device {
268 struct attribute_group ** groups; /* optional groups */ 263 struct attribute_group ** groups; /* optional groups */
269 264
270 void (*release)(struct class_device *dev); 265 void (*release)(struct class_device *dev);
271 int (*uevent)(struct class_device *dev, char **envp, 266 int (*uevent)(struct class_device *dev, struct kobj_uevent_env *env);
272 int num_envp, char *buffer, int buffer_size);
273 char class_id[BUS_ID_SIZE]; /* unique to this class */ 267 char class_id[BUS_ID_SIZE]; /* unique to this class */
274}; 268};
275 269
@@ -337,8 +331,7 @@ extern void class_device_destroy(struct class *cls, dev_t devt);
337struct device_type { 331struct device_type {
338 const char *name; 332 const char *name;
339 struct attribute_group **groups; 333 struct attribute_group **groups;
340 int (*uevent)(struct device *dev, char **envp, int num_envp, 334 int (*uevent)(struct device *dev, struct kobj_uevent_env *env);
341 char *buffer, int buffer_size);
342 void (*release)(struct device *dev); 335 void (*release)(struct device *dev);
343 int (*suspend)(struct device * dev, pm_message_t state); 336 int (*suspend)(struct device * dev, pm_message_t state);
344 int (*resume)(struct device * dev); 337 int (*resume)(struct device * dev);
@@ -551,6 +544,9 @@ extern void put_device(struct device * dev);
551/* drivers/base/power/shutdown.c */ 544/* drivers/base/power/shutdown.c */
552extern void device_shutdown(void); 545extern void device_shutdown(void);
553 546
547/* drivers/base/sys.c */
548extern void sysdev_shutdown(void);
549
554 550
555/* drivers/base/firmware.c */ 551/* drivers/base/firmware.c */
556extern int __must_check firmware_register(struct kset *); 552extern int __must_check firmware_register(struct kset *);
@@ -572,6 +568,16 @@ dev_dbg(struct device * dev, const char * fmt, ...)
572} 568}
573#endif 569#endif
574 570
571#ifdef VERBOSE_DEBUG
572#define dev_vdbg dev_dbg
573#else
574static inline int __attribute__ ((format (printf, 2, 3)))
575dev_vdbg(struct device * dev, const char * fmt, ...)
576{
577 return 0;
578}
579#endif
580
575#define dev_err(dev, format, arg...) \ 581#define dev_err(dev, format, arg...) \
576 dev_printk(KERN_ERR , dev , format , ## arg) 582 dev_printk(KERN_ERR , dev , format , ## arg)
577#define dev_info(dev, format, arg...) \ 583#define dev_info(dev, format, arg...) \
diff --git a/include/linux/dmi.h b/include/linux/dmi.h
index b8ac7b01c45e..00fc7a9c35ec 100644
--- a/include/linux/dmi.h
+++ b/include/linux/dmi.h
@@ -54,7 +54,7 @@ struct dmi_strmatch {
54}; 54};
55 55
56struct dmi_system_id { 56struct dmi_system_id {
57 int (*callback)(struct dmi_system_id *); 57 int (*callback)(const struct dmi_system_id *);
58 const char *ident; 58 const char *ident;
59 struct dmi_strmatch matches[4]; 59 struct dmi_strmatch matches[4];
60 void *driver_data; 60 void *driver_data;
@@ -71,22 +71,22 @@ struct dmi_device {
71 71
72#ifdef CONFIG_DMI 72#ifdef CONFIG_DMI
73 73
74extern int dmi_check_system(struct dmi_system_id *list); 74extern int dmi_check_system(const struct dmi_system_id *list);
75extern char * dmi_get_system_info(int field); 75extern const char * dmi_get_system_info(int field);
76extern struct dmi_device * dmi_find_device(int type, const char *name, 76extern const struct dmi_device * dmi_find_device(int type, const char *name,
77 struct dmi_device *from); 77 const struct dmi_device *from);
78extern void dmi_scan_machine(void); 78extern void dmi_scan_machine(void);
79extern int dmi_get_year(int field); 79extern int dmi_get_year(int field);
80extern int dmi_name_in_vendors(char *str); 80extern int dmi_name_in_vendors(const char *str);
81 81
82#else 82#else
83 83
84static inline int dmi_check_system(struct dmi_system_id *list) { return 0; } 84static inline int dmi_check_system(const struct dmi_system_id *list) { return 0; }
85static inline char * dmi_get_system_info(int field) { return NULL; } 85static inline const char * dmi_get_system_info(int field) { return NULL; }
86static inline struct dmi_device * dmi_find_device(int type, const char *name, 86static inline const struct dmi_device * dmi_find_device(int type, const char *name,
87 struct dmi_device *from) { return NULL; } 87 const struct dmi_device *from) { return NULL; }
88static inline int dmi_get_year(int year) { return 0; } 88static inline int dmi_get_year(int year) { return 0; }
89static inline int dmi_name_in_vendors(char *s) { return 0; } 89static inline int dmi_name_in_vendors(const char *s) { return 0; }
90 90
91#endif 91#endif
92 92
diff --git a/include/linux/dvb/video.h b/include/linux/dvb/video.h
index 93e4c3a6d190..50839fe9e39e 100644
--- a/include/linux/dvb/video.h
+++ b/include/linux/dvb/video.h
@@ -29,6 +29,7 @@
29#ifdef __KERNEL__ 29#ifdef __KERNEL__
30#include <linux/types.h> 30#include <linux/types.h>
31#else 31#else
32#include <asm/types.h>
32#include <stdint.h> 33#include <stdint.h>
33#include <time.h> 34#include <time.h>
34#endif 35#endif
diff --git a/include/linux/edac.h b/include/linux/edac.h
new file mode 100644
index 000000000000..eab451e69a91
--- /dev/null
+++ b/include/linux/edac.h
@@ -0,0 +1,29 @@
1/*
2 * Generic EDAC defs
3 *
4 * Author: Dave Jiang <djiang@mvista.com>
5 *
6 * 2006-2007 (c) MontaVista Software, Inc. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied.
10 *
11 */
12#ifndef _LINUX_EDAC_H_
13#define _LINUX_EDAC_H_
14
15#include <asm/atomic.h>
16
17#define EDAC_OPSTATE_INVAL -1
18#define EDAC_OPSTATE_POLL 0
19#define EDAC_OPSTATE_NMI 1
20#define EDAC_OPSTATE_INT 2
21
22extern int edac_op_state;
23extern int edac_err_assert;
24extern atomic_t edac_handlers;
25
26extern int edac_handler_set(void);
27extern void edac_atomic_assert_error(void);
28
29#endif
diff --git a/include/linux/eeprom_93cx6.h b/include/linux/eeprom_93cx6.h
index d774b7778c91..a55c873e8b66 100644
--- a/include/linux/eeprom_93cx6.h
+++ b/include/linux/eeprom_93cx6.h
@@ -21,13 +21,14 @@
21/* 21/*
22 Module: eeprom_93cx6 22 Module: eeprom_93cx6
23 Abstract: EEPROM reader datastructures for 93cx6 chipsets. 23 Abstract: EEPROM reader datastructures for 93cx6 chipsets.
24 Supported chipsets: 93c46 & 93c66. 24 Supported chipsets: 93c46, 93c56 and 93c66.
25 */ 25 */
26 26
27/* 27/*
28 * EEPROM operation defines. 28 * EEPROM operation defines.
29 */ 29 */
30#define PCI_EEPROM_WIDTH_93C46 6 30#define PCI_EEPROM_WIDTH_93C46 6
31#define PCI_EEPROM_WIDTH_93C56 8
31#define PCI_EEPROM_WIDTH_93C66 8 32#define PCI_EEPROM_WIDTH_93C66 8
32#define PCI_EEPROM_WIDTH_OPCODE 3 33#define PCI_EEPROM_WIDTH_OPCODE 3
33#define PCI_EEPROM_WRITE_OPCODE 0x05 34#define PCI_EEPROM_WRITE_OPCODE 0x05
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index e88fcbc77f8f..e8f42133a616 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -5,29 +5,29 @@
5 5
6#ifdef CONFIG_BLOCK 6#ifdef CONFIG_BLOCK
7 7
8typedef int (elevator_merge_fn) (request_queue_t *, struct request **, 8typedef int (elevator_merge_fn) (struct request_queue *, struct request **,
9 struct bio *); 9 struct bio *);
10 10
11typedef void (elevator_merge_req_fn) (request_queue_t *, struct request *, struct request *); 11typedef void (elevator_merge_req_fn) (struct request_queue *, struct request *, struct request *);
12 12
13typedef void (elevator_merged_fn) (request_queue_t *, struct request *, int); 13typedef void (elevator_merged_fn) (struct request_queue *, struct request *, int);
14 14
15typedef int (elevator_allow_merge_fn) (request_queue_t *, struct request *, struct bio *); 15typedef int (elevator_allow_merge_fn) (struct request_queue *, struct request *, struct bio *);
16 16
17typedef int (elevator_dispatch_fn) (request_queue_t *, int); 17typedef int (elevator_dispatch_fn) (struct request_queue *, int);
18 18
19typedef void (elevator_add_req_fn) (request_queue_t *, struct request *); 19typedef void (elevator_add_req_fn) (struct request_queue *, struct request *);
20typedef int (elevator_queue_empty_fn) (request_queue_t *); 20typedef int (elevator_queue_empty_fn) (struct request_queue *);
21typedef struct request *(elevator_request_list_fn) (request_queue_t *, struct request *); 21typedef struct request *(elevator_request_list_fn) (struct request_queue *, struct request *);
22typedef void (elevator_completed_req_fn) (request_queue_t *, struct request *); 22typedef void (elevator_completed_req_fn) (struct request_queue *, struct request *);
23typedef int (elevator_may_queue_fn) (request_queue_t *, int); 23typedef int (elevator_may_queue_fn) (struct request_queue *, int);
24 24
25typedef int (elevator_set_req_fn) (request_queue_t *, struct request *, gfp_t); 25typedef int (elevator_set_req_fn) (struct request_queue *, struct request *, gfp_t);
26typedef void (elevator_put_req_fn) (struct request *); 26typedef void (elevator_put_req_fn) (struct request *);
27typedef void (elevator_activate_req_fn) (request_queue_t *, struct request *); 27typedef void (elevator_activate_req_fn) (struct request_queue *, struct request *);
28typedef void (elevator_deactivate_req_fn) (request_queue_t *, struct request *); 28typedef void (elevator_deactivate_req_fn) (struct request_queue *, struct request *);
29 29
30typedef void *(elevator_init_fn) (request_queue_t *); 30typedef void *(elevator_init_fn) (struct request_queue *);
31typedef void (elevator_exit_fn) (elevator_t *); 31typedef void (elevator_exit_fn) (elevator_t *);
32 32
33struct elevator_ops 33struct elevator_ops
@@ -94,27 +94,27 @@ struct elevator_queue
94/* 94/*
95 * block elevator interface 95 * block elevator interface
96 */ 96 */
97extern void elv_dispatch_sort(request_queue_t *, struct request *); 97extern void elv_dispatch_sort(struct request_queue *, struct request *);
98extern void elv_dispatch_add_tail(request_queue_t *, struct request *); 98extern void elv_dispatch_add_tail(struct request_queue *, struct request *);
99extern void elv_add_request(request_queue_t *, struct request *, int, int); 99extern void elv_add_request(struct request_queue *, struct request *, int, int);
100extern void __elv_add_request(request_queue_t *, struct request *, int, int); 100extern void __elv_add_request(struct request_queue *, struct request *, int, int);
101extern void elv_insert(request_queue_t *, struct request *, int); 101extern void elv_insert(struct request_queue *, struct request *, int);
102extern int elv_merge(request_queue_t *, struct request **, struct bio *); 102extern int elv_merge(struct request_queue *, struct request **, struct bio *);
103extern void elv_merge_requests(request_queue_t *, struct request *, 103extern void elv_merge_requests(struct request_queue *, struct request *,
104 struct request *); 104 struct request *);
105extern void elv_merged_request(request_queue_t *, struct request *, int); 105extern void elv_merged_request(struct request_queue *, struct request *, int);
106extern void elv_dequeue_request(request_queue_t *, struct request *); 106extern void elv_dequeue_request(struct request_queue *, struct request *);
107extern void elv_requeue_request(request_queue_t *, struct request *); 107extern void elv_requeue_request(struct request_queue *, struct request *);
108extern int elv_queue_empty(request_queue_t *); 108extern int elv_queue_empty(struct request_queue *);
109extern struct request *elv_next_request(struct request_queue *q); 109extern struct request *elv_next_request(struct request_queue *q);
110extern struct request *elv_former_request(request_queue_t *, struct request *); 110extern struct request *elv_former_request(struct request_queue *, struct request *);
111extern struct request *elv_latter_request(request_queue_t *, struct request *); 111extern struct request *elv_latter_request(struct request_queue *, struct request *);
112extern int elv_register_queue(request_queue_t *q); 112extern int elv_register_queue(struct request_queue *q);
113extern void elv_unregister_queue(request_queue_t *q); 113extern void elv_unregister_queue(struct request_queue *q);
114extern int elv_may_queue(request_queue_t *, int); 114extern int elv_may_queue(struct request_queue *, int);
115extern void elv_completed_request(request_queue_t *, struct request *); 115extern void elv_completed_request(struct request_queue *, struct request *);
116extern int elv_set_request(request_queue_t *, struct request *, gfp_t); 116extern int elv_set_request(struct request_queue *, struct request *, gfp_t);
117extern void elv_put_request(request_queue_t *, struct request *); 117extern void elv_put_request(struct request_queue *, struct request *);
118 118
119/* 119/*
120 * io scheduler registration 120 * io scheduler registration
@@ -125,18 +125,18 @@ extern void elv_unregister(struct elevator_type *);
125/* 125/*
126 * io scheduler sysfs switching 126 * io scheduler sysfs switching
127 */ 127 */
128extern ssize_t elv_iosched_show(request_queue_t *, char *); 128extern ssize_t elv_iosched_show(struct request_queue *, char *);
129extern ssize_t elv_iosched_store(request_queue_t *, const char *, size_t); 129extern ssize_t elv_iosched_store(struct request_queue *, const char *, size_t);
130 130
131extern int elevator_init(request_queue_t *, char *); 131extern int elevator_init(struct request_queue *, char *);
132extern void elevator_exit(elevator_t *); 132extern void elevator_exit(elevator_t *);
133extern int elv_rq_merge_ok(struct request *, struct bio *); 133extern int elv_rq_merge_ok(struct request *, struct bio *);
134 134
135/* 135/*
136 * Helper functions. 136 * Helper functions.
137 */ 137 */
138extern struct request *elv_rb_former_request(request_queue_t *, struct request *); 138extern struct request *elv_rb_former_request(struct request_queue *, struct request *);
139extern struct request *elv_rb_latter_request(request_queue_t *, struct request *); 139extern struct request *elv_rb_latter_request(struct request_queue *, struct request *);
140 140
141/* 141/*
142 * rb support functions. 142 * rb support functions.
diff --git a/include/linux/elf-em.h b/include/linux/elf-em.h
index 0311bad838b1..5834e843a946 100644
--- a/include/linux/elf-em.h
+++ b/include/linux/elf-em.h
@@ -20,7 +20,8 @@
20#define EM_PARISC 15 /* HPPA */ 20#define EM_PARISC 15 /* HPPA */
21#define EM_SPARC32PLUS 18 /* Sun's "v8plus" */ 21#define EM_SPARC32PLUS 18 /* Sun's "v8plus" */
22#define EM_PPC 20 /* PowerPC */ 22#define EM_PPC 20 /* PowerPC */
23#define EM_PPC64 21 /* PowerPC64 */ 23#define EM_PPC64 21 /* PowerPC64 */
24#define EM_SPU 23 /* Cell BE SPU */
24#define EM_SH 42 /* SuperH */ 25#define EM_SH 42 /* SuperH */
25#define EM_SPARCV9 43 /* SPARC v9 64-bit */ 26#define EM_SPARCV9 43 /* SPARC v9 64-bit */
26#define EM_IA_64 50 /* HP/Intel IA-64 */ 27#define EM_IA_64 50 /* HP/Intel IA-64 */
diff --git a/include/linux/elf.h b/include/linux/elf.h
index 8b17ffe222c4..d2da84acf45d 100644
--- a/include/linux/elf.h
+++ b/include/linux/elf.h
@@ -389,12 +389,14 @@ extern Elf64_Dyn _DYNAMIC [];
389 389
390#endif 390#endif
391 391
392/* Optional callbacks to write extra ELF notes. */
392#ifndef ARCH_HAVE_EXTRA_ELF_NOTES 393#ifndef ARCH_HAVE_EXTRA_ELF_NOTES
393static inline int arch_notes_size(void) { return 0; } 394static inline int elf_coredump_extra_notes_size(void) { return 0; }
394static inline void arch_write_notes(struct file *file) { } 395static inline int elf_coredump_extra_notes_write(struct file *file,
395 396 loff_t *foffset) { return 0; }
396#define ELF_CORE_EXTRA_NOTES_SIZE arch_notes_size() 397#else
397#define ELF_CORE_WRITE_EXTRA_NOTES arch_write_notes(file) 398extern int elf_coredump_extra_notes_size(void);
398#endif /* ARCH_HAVE_EXTRA_ELF_NOTES */ 399extern int elf_coredump_extra_notes_write(struct file *file, loff_t *foffset);
400#endif
399 401
400#endif /* _LINUX_ELF_H */ 402#endif /* _LINUX_ELF_H */
diff --git a/include/linux/elfnote.h b/include/linux/elfnote.h
index 9a1e0674e56c..e831759b2fb5 100644
--- a/include/linux/elfnote.h
+++ b/include/linux/elfnote.h
@@ -38,17 +38,25 @@
38 * e.g. ELFNOTE(XYZCo, 42, .asciz, "forty-two") 38 * e.g. ELFNOTE(XYZCo, 42, .asciz, "forty-two")
39 * ELFNOTE(XYZCo, 12, .long, 0xdeadbeef) 39 * ELFNOTE(XYZCo, 12, .long, 0xdeadbeef)
40 */ 40 */
41#define ELFNOTE(name, type, desctype, descdata) \ 41#define ELFNOTE_START(name, type, flags) \
42.pushsection .note.name, "",@note ; \ 42.pushsection .note.name, flags,@note ; \
43 .align 4 ; \ 43 .balign 4 ; \
44 .long 2f - 1f /* namesz */ ; \ 44 .long 2f - 1f /* namesz */ ; \
45 .long 4f - 3f /* descsz */ ; \ 45 .long 4484f - 3f /* descsz */ ; \
46 .long type ; \ 46 .long type ; \
471:.asciz #name ; \ 471:.asciz #name ; \
482:.align 4 ; \ 482:.balign 4 ; \
493:desctype descdata ; \ 493:
504:.align 4 ; \ 50
51#define ELFNOTE_END \
524484:.balign 4 ; \
51.popsection ; 53.popsection ;
54
55#define ELFNOTE(name, type, desc) \
56 ELFNOTE_START(name, type, "") \
57 desc ; \
58 ELFNOTE_END
59
52#else /* !__ASSEMBLER__ */ 60#else /* !__ASSEMBLER__ */
53#include <linux/elf.h> 61#include <linux/elf.h>
54/* 62/*
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index 6cdb97365e47..b7558ec81ed5 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -29,15 +29,19 @@
29#include <linux/random.h> 29#include <linux/random.h>
30 30
31#ifdef __KERNEL__ 31#ifdef __KERNEL__
32extern int eth_header(struct sk_buff *skb, struct net_device *dev,
33 unsigned short type, void *daddr,
34 void *saddr, unsigned len);
35extern int eth_rebuild_header(struct sk_buff *skb);
36extern __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev); 32extern __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev);
37extern void eth_header_cache_update(struct hh_cache *hh, struct net_device *dev, 33extern const struct header_ops eth_header_ops;
38 unsigned char * haddr); 34
39extern int eth_header_cache(struct neighbour *neigh, 35extern int eth_header(struct sk_buff *skb, struct net_device *dev,
40 struct hh_cache *hh); 36 unsigned short type,
37 const void *daddr, const void *saddr, unsigned len);
38extern int eth_rebuild_header(struct sk_buff *skb);
39extern int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr);
40extern int eth_header_cache(const struct neighbour *neigh, struct hh_cache *hh);
41extern void eth_header_cache_update(struct hh_cache *hh,
42 const struct net_device *dev,
43 const unsigned char *haddr);
44
41 45
42extern struct net_device *alloc_etherdev_mq(int sizeof_priv, unsigned int queue_count); 46extern struct net_device *alloc_etherdev_mq(int sizeof_priv, unsigned int queue_count);
43#define alloc_etherdev(sizeof_priv) alloc_etherdev_mq(sizeof_priv, 1) 47#define alloc_etherdev(sizeof_priv) alloc_etherdev_mq(sizeof_priv, 1)
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 3a632244f31b..71d4ada6f315 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -39,7 +39,8 @@ struct ethtool_drvinfo {
39 char bus_info[ETHTOOL_BUSINFO_LEN]; /* Bus info for this IF. */ 39 char bus_info[ETHTOOL_BUSINFO_LEN]; /* Bus info for this IF. */
40 /* For PCI devices, use pci_name(pci_dev). */ 40 /* For PCI devices, use pci_name(pci_dev). */
41 char reserved1[32]; 41 char reserved1[32];
42 char reserved2[16]; 42 char reserved2[12];
43 __u32 n_priv_flags; /* number of flags valid in ETHTOOL_GPFLAGS */
43 __u32 n_stats; /* number of u64's from ETHTOOL_GSTATS */ 44 __u32 n_stats; /* number of u64's from ETHTOOL_GSTATS */
44 __u32 testinfo_len; 45 __u32 testinfo_len;
45 __u32 eedump_len; /* Size of data from ETHTOOL_GEEPROM (bytes) */ 46 __u32 eedump_len; /* Size of data from ETHTOOL_GEEPROM (bytes) */
@@ -219,6 +220,7 @@ struct ethtool_pauseparam {
219enum ethtool_stringset { 220enum ethtool_stringset {
220 ETH_SS_TEST = 0, 221 ETH_SS_TEST = 0,
221 ETH_SS_STATS, 222 ETH_SS_STATS,
223 ETH_SS_PRIV_FLAGS,
222}; 224};
223 225
224/* for passing string sets for data tagging */ 226/* for passing string sets for data tagging */
@@ -256,6 +258,19 @@ struct ethtool_perm_addr {
256 __u8 data[0]; 258 __u8 data[0];
257}; 259};
258 260
261/* boolean flags controlling per-interface behavior characteristics.
262 * When reading, the flag indicates whether or not a certain behavior
263 * is enabled/present. When writing, the flag indicates whether
264 * or not the driver should turn on (set) or off (clear) a behavior.
265 *
266 * Some behaviors may read-only (unconditionally absent or present).
267 * If such is the case, return EINVAL in the set-flags operation if the
268 * flag differs from the read-only value.
269 */
270enum ethtool_flags {
271 ETH_FLAG_LRO = (1 << 15), /* LRO is enabled */
272};
273
259#ifdef __KERNEL__ 274#ifdef __KERNEL__
260 275
261struct net_device; 276struct net_device;
@@ -270,10 +285,10 @@ u32 ethtool_op_get_sg(struct net_device *dev);
270int ethtool_op_set_sg(struct net_device *dev, u32 data); 285int ethtool_op_set_sg(struct net_device *dev, u32 data);
271u32 ethtool_op_get_tso(struct net_device *dev); 286u32 ethtool_op_get_tso(struct net_device *dev);
272int ethtool_op_set_tso(struct net_device *dev, u32 data); 287int ethtool_op_set_tso(struct net_device *dev, u32 data);
273int ethtool_op_get_perm_addr(struct net_device *dev,
274 struct ethtool_perm_addr *addr, u8 *data);
275u32 ethtool_op_get_ufo(struct net_device *dev); 288u32 ethtool_op_get_ufo(struct net_device *dev);
276int ethtool_op_set_ufo(struct net_device *dev, u32 data); 289int ethtool_op_set_ufo(struct net_device *dev, u32 data);
290u32 ethtool_op_get_flags(struct net_device *dev);
291int ethtool_op_set_flags(struct net_device *dev, u32 data);
277 292
278/** 293/**
279 * &ethtool_ops - Alter and report network device settings 294 * &ethtool_ops - Alter and report network device settings
@@ -309,7 +324,8 @@ int ethtool_op_set_ufo(struct net_device *dev, u32 data);
309 * get_strings: Return a set of strings that describe the requested objects 324 * get_strings: Return a set of strings that describe the requested objects
310 * phys_id: Identify the device 325 * phys_id: Identify the device
311 * get_stats: Return statistics about the device 326 * get_stats: Return statistics about the device
312 * get_perm_addr: Gets the permanent hardware address 327 * get_flags: get 32-bit flags bitmap
328 * set_flags: set 32-bit flags bitmap
313 * 329 *
314 * Description: 330 * Description:
315 * 331 *
@@ -362,17 +378,23 @@ struct ethtool_ops {
362 int (*set_sg)(struct net_device *, u32); 378 int (*set_sg)(struct net_device *, u32);
363 u32 (*get_tso)(struct net_device *); 379 u32 (*get_tso)(struct net_device *);
364 int (*set_tso)(struct net_device *, u32); 380 int (*set_tso)(struct net_device *, u32);
365 int (*self_test_count)(struct net_device *);
366 void (*self_test)(struct net_device *, struct ethtool_test *, u64 *); 381 void (*self_test)(struct net_device *, struct ethtool_test *, u64 *);
367 void (*get_strings)(struct net_device *, u32 stringset, u8 *); 382 void (*get_strings)(struct net_device *, u32 stringset, u8 *);
368 int (*phys_id)(struct net_device *, u32); 383 int (*phys_id)(struct net_device *, u32);
369 int (*get_stats_count)(struct net_device *);
370 void (*get_ethtool_stats)(struct net_device *, struct ethtool_stats *, u64 *); 384 void (*get_ethtool_stats)(struct net_device *, struct ethtool_stats *, u64 *);
371 int (*get_perm_addr)(struct net_device *, struct ethtool_perm_addr *, u8 *);
372 int (*begin)(struct net_device *); 385 int (*begin)(struct net_device *);
373 void (*complete)(struct net_device *); 386 void (*complete)(struct net_device *);
374 u32 (*get_ufo)(struct net_device *); 387 u32 (*get_ufo)(struct net_device *);
375 int (*set_ufo)(struct net_device *, u32); 388 int (*set_ufo)(struct net_device *, u32);
389 u32 (*get_flags)(struct net_device *);
390 int (*set_flags)(struct net_device *, u32);
391 u32 (*get_priv_flags)(struct net_device *);
392 int (*set_priv_flags)(struct net_device *, u32);
393 int (*get_sset_count)(struct net_device *, int);
394
395 /* the following hooks are obsolete */
396 int (*self_test_count)(struct net_device *);/* use get_sset_count */
397 int (*get_stats_count)(struct net_device *);/* use get_sset_count */
376}; 398};
377#endif /* __KERNEL__ */ 399#endif /* __KERNEL__ */
378 400
@@ -414,6 +436,10 @@ struct ethtool_ops {
414#define ETHTOOL_SUFO 0x00000022 /* Set UFO enable (ethtool_value) */ 436#define ETHTOOL_SUFO 0x00000022 /* Set UFO enable (ethtool_value) */
415#define ETHTOOL_GGSO 0x00000023 /* Get GSO enable (ethtool_value) */ 437#define ETHTOOL_GGSO 0x00000023 /* Get GSO enable (ethtool_value) */
416#define ETHTOOL_SGSO 0x00000024 /* Set GSO enable (ethtool_value) */ 438#define ETHTOOL_SGSO 0x00000024 /* Set GSO enable (ethtool_value) */
439#define ETHTOOL_GFLAGS 0x00000025 /* Get flags bitmap(ethtool_value) */
440#define ETHTOOL_SFLAGS 0x00000026 /* Set flags bitmap(ethtool_value) */
441#define ETHTOOL_GPFLAGS 0x00000027 /* Get driver-private flags bitmap */
442#define ETHTOOL_SPFLAGS 0x00000028 /* Set driver-private flags bitmap */
417 443
418/* compatibility with older code */ 444/* compatibility with older code */
419#define SPARC_ETH_GSET ETHTOOL_GSET 445#define SPARC_ETH_GSET ETHTOOL_GSET
diff --git a/include/linux/ext4_fs.h b/include/linux/ext4_fs.h
index de1f9f78625a..cdee7aaa57aa 100644
--- a/include/linux/ext4_fs.h
+++ b/include/linux/ext4_fs.h
@@ -71,7 +71,7 @@
71/* 71/*
72 * Maximal count of links to a file 72 * Maximal count of links to a file
73 */ 73 */
74#define EXT4_LINK_MAX 32000 74#define EXT4_LINK_MAX 65000
75 75
76/* 76/*
77 * Macro-instructions used to manage several block sizes 77 * Macro-instructions used to manage several block sizes
@@ -102,6 +102,7 @@
102 EXT4_GOOD_OLD_FIRST_INO : \ 102 EXT4_GOOD_OLD_FIRST_INO : \
103 (s)->s_first_ino) 103 (s)->s_first_ino)
104#endif 104#endif
105#define EXT4_BLOCK_ALIGN(size, blkbits) ALIGN((size), (1 << (blkbits)))
105 106
106/* 107/*
107 * Macro-instructions used to manage fragments 108 * Macro-instructions used to manage fragments
@@ -201,6 +202,7 @@ struct ext4_group_desc
201#define EXT4_STATE_JDATA 0x00000001 /* journaled data exists */ 202#define EXT4_STATE_JDATA 0x00000001 /* journaled data exists */
202#define EXT4_STATE_NEW 0x00000002 /* inode is newly created */ 203#define EXT4_STATE_NEW 0x00000002 /* inode is newly created */
203#define EXT4_STATE_XATTR 0x00000004 /* has in-inode xattrs */ 204#define EXT4_STATE_XATTR 0x00000004 /* has in-inode xattrs */
205#define EXT4_STATE_NO_EXPAND 0x00000008 /* No space for expansion */
204 206
205/* Used to pass group descriptor data when online resize is done */ 207/* Used to pass group descriptor data when online resize is done */
206struct ext4_new_group_input { 208struct ext4_new_group_input {
@@ -225,6 +227,11 @@ struct ext4_new_group_data {
225 __u32 free_blocks_count; 227 __u32 free_blocks_count;
226}; 228};
227 229
230/*
231 * Following is used by preallocation code to tell get_blocks() that we
232 * want uninitialzed extents.
233 */
234#define EXT4_CREATE_UNINITIALIZED_EXT 2
228 235
229/* 236/*
230 * ioctl commands 237 * ioctl commands
@@ -237,7 +244,7 @@ struct ext4_new_group_data {
237#define EXT4_IOC_GROUP_ADD _IOW('f', 8,struct ext4_new_group_input) 244#define EXT4_IOC_GROUP_ADD _IOW('f', 8,struct ext4_new_group_input)
238#define EXT4_IOC_GETVERSION_OLD FS_IOC_GETVERSION 245#define EXT4_IOC_GETVERSION_OLD FS_IOC_GETVERSION
239#define EXT4_IOC_SETVERSION_OLD FS_IOC_SETVERSION 246#define EXT4_IOC_SETVERSION_OLD FS_IOC_SETVERSION
240#ifdef CONFIG_JBD_DEBUG 247#ifdef CONFIG_JBD2_DEBUG
241#define EXT4_IOC_WAIT_FOR_READONLY _IOR('f', 99, long) 248#define EXT4_IOC_WAIT_FOR_READONLY _IOR('f', 99, long)
242#endif 249#endif
243#define EXT4_IOC_GETRSVSZ _IOR('f', 5, long) 250#define EXT4_IOC_GETRSVSZ _IOR('f', 5, long)
@@ -253,7 +260,7 @@ struct ext4_new_group_data {
253#define EXT4_IOC32_GETRSVSZ _IOR('f', 5, int) 260#define EXT4_IOC32_GETRSVSZ _IOR('f', 5, int)
254#define EXT4_IOC32_SETRSVSZ _IOW('f', 6, int) 261#define EXT4_IOC32_SETRSVSZ _IOW('f', 6, int)
255#define EXT4_IOC32_GROUP_EXTEND _IOW('f', 7, unsigned int) 262#define EXT4_IOC32_GROUP_EXTEND _IOW('f', 7, unsigned int)
256#ifdef CONFIG_JBD_DEBUG 263#ifdef CONFIG_JBD2_DEBUG
257#define EXT4_IOC32_WAIT_FOR_READONLY _IOR('f', 99, int) 264#define EXT4_IOC32_WAIT_FOR_READONLY _IOR('f', 99, int)
258#endif 265#endif
259#define EXT4_IOC32_GETVERSION_OLD FS_IOC32_GETVERSION 266#define EXT4_IOC32_GETVERSION_OLD FS_IOC32_GETVERSION
@@ -282,7 +289,7 @@ struct ext4_inode {
282 __le16 i_uid; /* Low 16 bits of Owner Uid */ 289 __le16 i_uid; /* Low 16 bits of Owner Uid */
283 __le32 i_size; /* Size in bytes */ 290 __le32 i_size; /* Size in bytes */
284 __le32 i_atime; /* Access time */ 291 __le32 i_atime; /* Access time */
285 __le32 i_ctime; /* Creation time */ 292 __le32 i_ctime; /* Inode Change time */
286 __le32 i_mtime; /* Modification time */ 293 __le32 i_mtime; /* Modification time */
287 __le32 i_dtime; /* Deletion Time */ 294 __le32 i_dtime; /* Deletion Time */
288 __le16 i_gid; /* Low 16 bits of Group Id */ 295 __le16 i_gid; /* Low 16 bits of Group Id */
@@ -331,10 +338,85 @@ struct ext4_inode {
331 } osd2; /* OS dependent 2 */ 338 } osd2; /* OS dependent 2 */
332 __le16 i_extra_isize; 339 __le16 i_extra_isize;
333 __le16 i_pad1; 340 __le16 i_pad1;
341 __le32 i_ctime_extra; /* extra Change time (nsec << 2 | epoch) */
342 __le32 i_mtime_extra; /* extra Modification time(nsec << 2 | epoch) */
343 __le32 i_atime_extra; /* extra Access time (nsec << 2 | epoch) */
344 __le32 i_crtime; /* File Creation time */
345 __le32 i_crtime_extra; /* extra FileCreationtime (nsec << 2 | epoch) */
334}; 346};
335 347
336#define i_size_high i_dir_acl 348#define i_size_high i_dir_acl
337 349
350#define EXT4_EPOCH_BITS 2
351#define EXT4_EPOCH_MASK ((1 << EXT4_EPOCH_BITS) - 1)
352#define EXT4_NSEC_MASK (~0UL << EXT4_EPOCH_BITS)
353
354/*
355 * Extended fields will fit into an inode if the filesystem was formatted
356 * with large inodes (-I 256 or larger) and there are not currently any EAs
357 * consuming all of the available space. For new inodes we always reserve
358 * enough space for the kernel's known extended fields, but for inodes
359 * created with an old kernel this might not have been the case. None of
360 * the extended inode fields is critical for correct filesystem operation.
361 * This macro checks if a certain field fits in the inode. Note that
362 * inode-size = GOOD_OLD_INODE_SIZE + i_extra_isize
363 */
364#define EXT4_FITS_IN_INODE(ext4_inode, einode, field) \
365 ((offsetof(typeof(*ext4_inode), field) + \
366 sizeof((ext4_inode)->field)) \
367 <= (EXT4_GOOD_OLD_INODE_SIZE + \
368 (einode)->i_extra_isize)) \
369
370static inline __le32 ext4_encode_extra_time(struct timespec *time)
371{
372 return cpu_to_le32((sizeof(time->tv_sec) > 4 ?
373 time->tv_sec >> 32 : 0) |
374 ((time->tv_nsec << 2) & EXT4_NSEC_MASK));
375}
376
377static inline void ext4_decode_extra_time(struct timespec *time, __le32 extra)
378{
379 if (sizeof(time->tv_sec) > 4)
380 time->tv_sec |= (__u64)(le32_to_cpu(extra) & EXT4_EPOCH_MASK)
381 << 32;
382 time->tv_nsec = (le32_to_cpu(extra) & EXT4_NSEC_MASK) >> 2;
383}
384
385#define EXT4_INODE_SET_XTIME(xtime, inode, raw_inode) \
386do { \
387 (raw_inode)->xtime = cpu_to_le32((inode)->xtime.tv_sec); \
388 if (EXT4_FITS_IN_INODE(raw_inode, EXT4_I(inode), xtime ## _extra)) \
389 (raw_inode)->xtime ## _extra = \
390 ext4_encode_extra_time(&(inode)->xtime); \
391} while (0)
392
393#define EXT4_EINODE_SET_XTIME(xtime, einode, raw_inode) \
394do { \
395 if (EXT4_FITS_IN_INODE(raw_inode, einode, xtime)) \
396 (raw_inode)->xtime = cpu_to_le32((einode)->xtime.tv_sec); \
397 if (EXT4_FITS_IN_INODE(raw_inode, einode, xtime ## _extra)) \
398 (raw_inode)->xtime ## _extra = \
399 ext4_encode_extra_time(&(einode)->xtime); \
400} while (0)
401
402#define EXT4_INODE_GET_XTIME(xtime, inode, raw_inode) \
403do { \
404 (inode)->xtime.tv_sec = (signed)le32_to_cpu((raw_inode)->xtime); \
405 if (EXT4_FITS_IN_INODE(raw_inode, EXT4_I(inode), xtime ## _extra)) \
406 ext4_decode_extra_time(&(inode)->xtime, \
407 raw_inode->xtime ## _extra); \
408} while (0)
409
410#define EXT4_EINODE_GET_XTIME(xtime, einode, raw_inode) \
411do { \
412 if (EXT4_FITS_IN_INODE(raw_inode, einode, xtime)) \
413 (einode)->xtime.tv_sec = \
414 (signed)le32_to_cpu((raw_inode)->xtime); \
415 if (EXT4_FITS_IN_INODE(raw_inode, einode, xtime ## _extra)) \
416 ext4_decode_extra_time(&(einode)->xtime, \
417 raw_inode->xtime ## _extra); \
418} while (0)
419
338#if defined(__KERNEL__) || defined(__linux__) 420#if defined(__KERNEL__) || defined(__linux__)
339#define i_reserved1 osd1.linux1.l_i_reserved1 421#define i_reserved1 osd1.linux1.l_i_reserved1
340#define i_frag osd2.linux2.l_i_frag 422#define i_frag osd2.linux2.l_i_frag
@@ -533,6 +615,13 @@ static inline struct ext4_inode_info *EXT4_I(struct inode *inode)
533 return container_of(inode, struct ext4_inode_info, vfs_inode); 615 return container_of(inode, struct ext4_inode_info, vfs_inode);
534} 616}
535 617
618static inline struct timespec ext4_current_time(struct inode *inode)
619{
620 return (inode->i_sb->s_time_gran < NSEC_PER_SEC) ?
621 current_fs_time(inode->i_sb) : CURRENT_TIME_SEC;
622}
623
624
536static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino) 625static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino)
537{ 626{
538 return ino == EXT4_ROOT_INO || 627 return ino == EXT4_ROOT_INO ||
@@ -603,6 +692,8 @@ static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino)
603#define EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001 692#define EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001
604#define EXT4_FEATURE_RO_COMPAT_LARGE_FILE 0x0002 693#define EXT4_FEATURE_RO_COMPAT_LARGE_FILE 0x0002
605#define EXT4_FEATURE_RO_COMPAT_BTREE_DIR 0x0004 694#define EXT4_FEATURE_RO_COMPAT_BTREE_DIR 0x0004
695#define EXT4_FEATURE_RO_COMPAT_DIR_NLINK 0x0020
696#define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE 0x0040
606 697
607#define EXT4_FEATURE_INCOMPAT_COMPRESSION 0x0001 698#define EXT4_FEATURE_INCOMPAT_COMPRESSION 0x0001
608#define EXT4_FEATURE_INCOMPAT_FILETYPE 0x0002 699#define EXT4_FEATURE_INCOMPAT_FILETYPE 0x0002
@@ -620,6 +711,8 @@ static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino)
620 EXT4_FEATURE_INCOMPAT_64BIT) 711 EXT4_FEATURE_INCOMPAT_64BIT)
621#define EXT4_FEATURE_RO_COMPAT_SUPP (EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER| \ 712#define EXT4_FEATURE_RO_COMPAT_SUPP (EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER| \
622 EXT4_FEATURE_RO_COMPAT_LARGE_FILE| \ 713 EXT4_FEATURE_RO_COMPAT_LARGE_FILE| \
714 EXT4_FEATURE_RO_COMPAT_DIR_NLINK | \
715 EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE | \
623 EXT4_FEATURE_RO_COMPAT_BTREE_DIR) 716 EXT4_FEATURE_RO_COMPAT_BTREE_DIR)
624 717
625/* 718/*
@@ -862,6 +955,7 @@ extern int ext4_change_inode_journal_flag(struct inode *, int);
862extern int ext4_get_inode_loc(struct inode *, struct ext4_iloc *); 955extern int ext4_get_inode_loc(struct inode *, struct ext4_iloc *);
863extern void ext4_truncate (struct inode *); 956extern void ext4_truncate (struct inode *);
864extern void ext4_set_inode_flags(struct inode *); 957extern void ext4_set_inode_flags(struct inode *);
958extern void ext4_get_inode_flags(struct ext4_inode_info *);
865extern void ext4_set_aops(struct inode *inode); 959extern void ext4_set_aops(struct inode *inode);
866extern int ext4_writepage_trans_blocks(struct inode *); 960extern int ext4_writepage_trans_blocks(struct inode *);
867extern int ext4_block_truncate_page(handle_t *handle, struct page *page, 961extern int ext4_block_truncate_page(handle_t *handle, struct page *page,
@@ -983,6 +1077,8 @@ extern int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,
983extern void ext4_ext_truncate(struct inode *, struct page *); 1077extern void ext4_ext_truncate(struct inode *, struct page *);
984extern void ext4_ext_init(struct super_block *); 1078extern void ext4_ext_init(struct super_block *);
985extern void ext4_ext_release(struct super_block *); 1079extern void ext4_ext_release(struct super_block *);
1080extern long ext4_fallocate(struct inode *inode, int mode, loff_t offset,
1081 loff_t len);
986static inline int 1082static inline int
987ext4_get_blocks_wrap(handle_t *handle, struct inode *inode, sector_t block, 1083ext4_get_blocks_wrap(handle_t *handle, struct inode *inode, sector_t block,
988 unsigned long max_blocks, struct buffer_head *bh, 1084 unsigned long max_blocks, struct buffer_head *bh,
diff --git a/include/linux/ext4_fs_extents.h b/include/linux/ext4_fs_extents.h
index acfe59740b03..81406f3655d4 100644
--- a/include/linux/ext4_fs_extents.h
+++ b/include/linux/ext4_fs_extents.h
@@ -141,7 +141,25 @@ typedef int (*ext_prepare_callback)(struct inode *, struct ext4_ext_path *,
141 141
142#define EXT_MAX_BLOCK 0xffffffff 142#define EXT_MAX_BLOCK 0xffffffff
143 143
144#define EXT_MAX_LEN ((1UL << 15) - 1) 144/*
145 * EXT_INIT_MAX_LEN is the maximum number of blocks we can have in an
146 * initialized extent. This is 2^15 and not (2^16 - 1), since we use the
147 * MSB of ee_len field in the extent datastructure to signify if this
148 * particular extent is an initialized extent or an uninitialized (i.e.
149 * preallocated).
150 * EXT_UNINIT_MAX_LEN is the maximum number of blocks we can have in an
151 * uninitialized extent.
152 * If ee_len is <= 0x8000, it is an initialized extent. Otherwise, it is an
153 * uninitialized one. In other words, if MSB of ee_len is set, it is an
154 * uninitialized extent with only one special scenario when ee_len = 0x8000.
155 * In this case we can not have an uninitialized extent of zero length and
156 * thus we make it as a special case of initialized extent with 0x8000 length.
157 * This way we get better extent-to-group alignment for initialized extents.
158 * Hence, the maximum number of blocks we can have in an *initialized*
159 * extent is 2^15 (32768) and in an *uninitialized* extent is 2^15-1 (32767).
160 */
161#define EXT_INIT_MAX_LEN (1UL << 15)
162#define EXT_UNINIT_MAX_LEN (EXT_INIT_MAX_LEN - 1)
145 163
146 164
147#define EXT_FIRST_EXTENT(__hdr__) \ 165#define EXT_FIRST_EXTENT(__hdr__) \
@@ -188,8 +206,31 @@ ext4_ext_invalidate_cache(struct inode *inode)
188 EXT4_I(inode)->i_cached_extent.ec_type = EXT4_EXT_CACHE_NO; 206 EXT4_I(inode)->i_cached_extent.ec_type = EXT4_EXT_CACHE_NO;
189} 207}
190 208
209static inline void ext4_ext_mark_uninitialized(struct ext4_extent *ext)
210{
211 /* We can not have an uninitialized extent of zero length! */
212 BUG_ON((le16_to_cpu(ext->ee_len) & ~EXT_INIT_MAX_LEN) == 0);
213 ext->ee_len |= cpu_to_le16(EXT_INIT_MAX_LEN);
214}
215
216static inline int ext4_ext_is_uninitialized(struct ext4_extent *ext)
217{
218 /* Extent with ee_len of 0x8000 is treated as an initialized extent */
219 return (le16_to_cpu(ext->ee_len) > EXT_INIT_MAX_LEN);
220}
221
222static inline int ext4_ext_get_actual_len(struct ext4_extent *ext)
223{
224 return (le16_to_cpu(ext->ee_len) <= EXT_INIT_MAX_LEN ?
225 le16_to_cpu(ext->ee_len) :
226 (le16_to_cpu(ext->ee_len) - EXT_INIT_MAX_LEN));
227}
228
191extern int ext4_extent_tree_init(handle_t *, struct inode *); 229extern int ext4_extent_tree_init(handle_t *, struct inode *);
192extern int ext4_ext_calc_credits_for_insert(struct inode *, struct ext4_ext_path *); 230extern int ext4_ext_calc_credits_for_insert(struct inode *, struct ext4_ext_path *);
231extern int ext4_ext_try_to_merge(struct inode *inode,
232 struct ext4_ext_path *path,
233 struct ext4_extent *);
193extern unsigned int ext4_ext_check_overlap(struct inode *, struct ext4_extent *, struct ext4_ext_path *); 234extern unsigned int ext4_ext_check_overlap(struct inode *, struct ext4_extent *, struct ext4_ext_path *);
194extern int ext4_ext_insert_extent(handle_t *, struct inode *, struct ext4_ext_path *, struct ext4_extent *); 235extern int ext4_ext_insert_extent(handle_t *, struct inode *, struct ext4_ext_path *, struct ext4_extent *);
195extern int ext4_ext_walk_space(struct inode *, unsigned long, unsigned long, ext_prepare_callback, void *); 236extern int ext4_ext_walk_space(struct inode *, unsigned long, unsigned long, ext_prepare_callback, void *);
diff --git a/include/linux/ext4_fs_i.h b/include/linux/ext4_fs_i.h
index 9de494406995..1a511e9905aa 100644
--- a/include/linux/ext4_fs_i.h
+++ b/include/linux/ext4_fs_i.h
@@ -153,6 +153,11 @@ struct ext4_inode_info {
153 153
154 unsigned long i_ext_generation; 154 unsigned long i_ext_generation;
155 struct ext4_ext_cache i_cached_extent; 155 struct ext4_ext_cache i_cached_extent;
156 /*
157 * File creation time. Its function is same as that of
158 * struct timespec i_{a,c,m}time in the generic inode.
159 */
160 struct timespec i_crtime;
156}; 161};
157 162
158#endif /* _LINUX_EXT4_FS_I */ 163#endif /* _LINUX_EXT4_FS_I */
diff --git a/include/linux/ext4_fs_sb.h b/include/linux/ext4_fs_sb.h
index 2347557a327a..1b2ffee12be9 100644
--- a/include/linux/ext4_fs_sb.h
+++ b/include/linux/ext4_fs_sb.h
@@ -73,7 +73,7 @@ struct ext4_sb_info {
73 struct list_head s_orphan; 73 struct list_head s_orphan;
74 unsigned long s_commit_interval; 74 unsigned long s_commit_interval;
75 struct block_device *journal_bdev; 75 struct block_device *journal_bdev;
76#ifdef CONFIG_JBD_DEBUG 76#ifdef CONFIG_JBD2_DEBUG
77 struct timer_list turn_ro_timer; /* For turning read-only (crash simulation) */ 77 struct timer_list turn_ro_timer; /* For turning read-only (crash simulation) */
78 wait_queue_head_t ro_wait_queue; /* For people waiting for the fs to go read-only */ 78 wait_queue_head_t ro_wait_queue; /* For people waiting for the fs to go read-only */
79#endif 79#endif
@@ -81,6 +81,7 @@ struct ext4_sb_info {
81 char *s_qf_names[MAXQUOTAS]; /* Names of quota files with journalled quota */ 81 char *s_qf_names[MAXQUOTAS]; /* Names of quota files with journalled quota */
82 int s_jquota_fmt; /* Format of quota to use */ 82 int s_jquota_fmt; /* Format of quota to use */
83#endif 83#endif
84 unsigned int s_want_extra_isize; /* New inodes should reserve # bytes */
84 85
85#ifdef EXTENTS_STATS 86#ifdef EXTENTS_STATS
86 /* ext4 extents stats */ 87 /* ext4 extents stats */
diff --git a/include/linux/falloc.h b/include/linux/falloc.h
new file mode 100644
index 000000000000..8e912ab6a072
--- /dev/null
+++ b/include/linux/falloc.h
@@ -0,0 +1,6 @@
1#ifndef _FALLOC_H_
2#define _FALLOC_H_
3
4#define FALLOC_FL_KEEP_SIZE 0x01 /* default is extend size */
5
6#endif /* _FALLOC_H_ */
diff --git a/include/linux/freezer.h b/include/linux/freezer.h
index 2d38b1a74662..efded00ad08c 100644
--- a/include/linux/freezer.h
+++ b/include/linux/freezer.h
@@ -5,7 +5,7 @@
5 5
6#include <linux/sched.h> 6#include <linux/sched.h>
7 7
8#ifdef CONFIG_PM 8#ifdef CONFIG_PM_SLEEP
9/* 9/*
10 * Check if a process has been frozen 10 * Check if a process has been frozen
11 */ 11 */
@@ -25,7 +25,7 @@ static inline int freezing(struct task_struct *p)
25/* 25/*
26 * Request that a process be frozen 26 * Request that a process be frozen
27 */ 27 */
28static inline void freeze(struct task_struct *p) 28static inline void set_freeze_flag(struct task_struct *p)
29{ 29{
30 set_tsk_thread_flag(p, TIF_FREEZE); 30 set_tsk_thread_flag(p, TIF_FREEZE);
31} 31}
@@ -33,7 +33,7 @@ static inline void freeze(struct task_struct *p)
33/* 33/*
34 * Sometimes we may need to cancel the previous 'freeze' request 34 * Sometimes we may need to cancel the previous 'freeze' request
35 */ 35 */
36static inline void do_not_freeze(struct task_struct *p) 36static inline void clear_freeze_flag(struct task_struct *p)
37{ 37{
38 clear_tsk_thread_flag(p, TIF_FREEZE); 38 clear_tsk_thread_flag(p, TIF_FREEZE);
39} 39}
@@ -56,7 +56,7 @@ static inline int thaw_process(struct task_struct *p)
56 wake_up_process(p); 56 wake_up_process(p);
57 return 1; 57 return 1;
58 } 58 }
59 clear_tsk_thread_flag(p, TIF_FREEZE); 59 clear_freeze_flag(p);
60 task_unlock(p); 60 task_unlock(p);
61 return 0; 61 return 0;
62} 62}
@@ -126,10 +126,11 @@ static inline void set_freezable(void)
126 current->flags &= ~PF_NOFREEZE; 126 current->flags &= ~PF_NOFREEZE;
127} 127}
128 128
129#else 129#else /* !CONFIG_PM_SLEEP */
130static inline int frozen(struct task_struct *p) { return 0; } 130static inline int frozen(struct task_struct *p) { return 0; }
131static inline int freezing(struct task_struct *p) { return 0; } 131static inline int freezing(struct task_struct *p) { return 0; }
132static inline void freeze(struct task_struct *p) { BUG(); } 132static inline void set_freeze_flag(struct task_struct *p) {}
133static inline void clear_freeze_flag(struct task_struct *p) {}
133static inline int thaw_process(struct task_struct *p) { return 1; } 134static inline int thaw_process(struct task_struct *p) { return 1; }
134 135
135static inline void refrigerator(void) {} 136static inline void refrigerator(void) {}
@@ -142,6 +143,6 @@ static inline void freezer_do_not_count(void) {}
142static inline void freezer_count(void) {} 143static inline void freezer_count(void) {}
143static inline int freezer_should_skip(struct task_struct *p) { return 0; } 144static inline int freezer_should_skip(struct task_struct *p) { return 0; }
144static inline void set_freezable(void) {} 145static inline void set_freezable(void) {}
145#endif 146#endif /* !CONFIG_PM_SLEEP */
146 147
147#endif /* FREEZER_H_INCLUDED */ 148#endif /* FREEZER_H_INCLUDED */
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 98205f680476..16421f662a7a 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -697,20 +697,26 @@ struct fown_struct {
697 * Track a single file's readahead state 697 * Track a single file's readahead state
698 */ 698 */
699struct file_ra_state { 699struct file_ra_state {
700 unsigned long start; /* Current window */ 700 pgoff_t start; /* where readahead started */
701 unsigned long size; 701 unsigned long size; /* # of readahead pages */
702 unsigned long flags; /* ra flags RA_FLAG_xxx*/ 702 unsigned long async_size; /* do asynchronous readahead when
703 unsigned long cache_hit; /* cache hit count*/ 703 there are only # of pages ahead */
704 unsigned long prev_index; /* Cache last read() position */ 704
705 unsigned long ahead_start; /* Ahead window */
706 unsigned long ahead_size;
707 unsigned long ra_pages; /* Maximum readahead window */ 705 unsigned long ra_pages; /* Maximum readahead window */
708 unsigned long mmap_hit; /* Cache hit stat for mmap accesses */ 706 unsigned long mmap_hit; /* Cache hit stat for mmap accesses */
709 unsigned long mmap_miss; /* Cache miss stat for mmap accesses */ 707 unsigned long mmap_miss; /* Cache miss stat for mmap accesses */
708 unsigned long prev_index; /* Cache last read() position */
710 unsigned int prev_offset; /* Offset where last read() ended in a page */ 709 unsigned int prev_offset; /* Offset where last read() ended in a page */
711}; 710};
712#define RA_FLAG_MISS 0x01 /* a cache miss occured against this file */ 711
713#define RA_FLAG_INCACHE 0x02 /* file is already in cache */ 712/*
713 * Check if @index falls in the readahead windows.
714 */
715static inline int ra_has_index(struct file_ra_state *ra, pgoff_t index)
716{
717 return (index >= ra->start &&
718 index < ra->start + ra->size);
719}
714 720
715struct file { 721struct file {
716 /* 722 /*
@@ -862,7 +868,7 @@ extern void locks_init_lock(struct file_lock *);
862extern void locks_copy_lock(struct file_lock *, struct file_lock *); 868extern void locks_copy_lock(struct file_lock *, struct file_lock *);
863extern void locks_remove_posix(struct file *, fl_owner_t); 869extern void locks_remove_posix(struct file *, fl_owner_t);
864extern void locks_remove_flock(struct file *); 870extern void locks_remove_flock(struct file *);
865extern int posix_test_lock(struct file *, struct file_lock *); 871extern void posix_test_lock(struct file *, struct file_lock *);
866extern int posix_lock_file(struct file *, struct file_lock *, struct file_lock *); 872extern int posix_lock_file(struct file *, struct file_lock *, struct file_lock *);
867extern int posix_lock_file_wait(struct file *, struct file_lock *); 873extern int posix_lock_file_wait(struct file *, struct file_lock *);
868extern int posix_unblock_lock(struct file *, struct file_lock *); 874extern int posix_unblock_lock(struct file *, struct file_lock *);
@@ -872,7 +878,8 @@ extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl);
872extern int flock_lock_file_wait(struct file *filp, struct file_lock *fl); 878extern int flock_lock_file_wait(struct file *filp, struct file_lock *fl);
873extern int __break_lease(struct inode *inode, unsigned int flags); 879extern int __break_lease(struct inode *inode, unsigned int flags);
874extern void lease_get_mtime(struct inode *, struct timespec *time); 880extern void lease_get_mtime(struct inode *, struct timespec *time);
875extern int setlease(struct file *, long, struct file_lock **); 881extern int generic_setlease(struct file *, long, struct file_lock **);
882extern int vfs_setlease(struct file *, long, struct file_lock **);
876extern int lease_modify(struct file_lock **, int); 883extern int lease_modify(struct file_lock **, int);
877extern int lock_may_read(struct inode *, loff_t start, unsigned long count); 884extern int lock_may_read(struct inode *, loff_t start, unsigned long count);
878extern int lock_may_write(struct inode *, loff_t start, unsigned long count); 885extern int lock_may_write(struct inode *, loff_t start, unsigned long count);
@@ -1122,6 +1129,7 @@ struct file_operations {
1122 int (*flock) (struct file *, int, struct file_lock *); 1129 int (*flock) (struct file *, int, struct file_lock *);
1123 ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int); 1130 ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int);
1124 ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int); 1131 ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int);
1132 int (*setlease)(struct file *, long, struct file_lock **);
1125}; 1133};
1126 1134
1127struct inode_operations { 1135struct inode_operations {
@@ -1147,6 +1155,8 @@ struct inode_operations {
1147 ssize_t (*listxattr) (struct dentry *, char *, size_t); 1155 ssize_t (*listxattr) (struct dentry *, char *, size_t);
1148 int (*removexattr) (struct dentry *, const char *); 1156 int (*removexattr) (struct dentry *, const char *);
1149 void (*truncate_range)(struct inode *, loff_t, loff_t); 1157 void (*truncate_range)(struct inode *, loff_t, loff_t);
1158 long (*fallocate)(struct inode *inode, int mode, loff_t offset,
1159 loff_t len);
1150}; 1160};
1151 1161
1152struct seq_file; 1162struct seq_file;
@@ -1459,7 +1469,7 @@ extern int alloc_chrdev_region(dev_t *, unsigned, unsigned, const char *);
1459extern int register_chrdev_region(dev_t, unsigned, const char *); 1469extern int register_chrdev_region(dev_t, unsigned, const char *);
1460extern int register_chrdev(unsigned int, const char *, 1470extern int register_chrdev(unsigned int, const char *,
1461 const struct file_operations *); 1471 const struct file_operations *);
1462extern int unregister_chrdev(unsigned int, const char *); 1472extern void unregister_chrdev(unsigned int, const char *);
1463extern void unregister_chrdev_region(dev_t, unsigned); 1473extern void unregister_chrdev_region(dev_t, unsigned);
1464extern int chrdev_open(struct inode *, struct file *); 1474extern int chrdev_open(struct inode *, struct file *);
1465extern void chrdev_show(struct seq_file *,off_t); 1475extern void chrdev_show(struct seq_file *,off_t);
@@ -1649,7 +1659,6 @@ extern int sb_min_blocksize(struct super_block *, int);
1649extern int generic_file_mmap(struct file *, struct vm_area_struct *); 1659extern int generic_file_mmap(struct file *, struct vm_area_struct *);
1650extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *); 1660extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *);
1651extern int file_read_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size); 1661extern int file_read_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size);
1652extern int file_send_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size);
1653int generic_write_checks(struct file *file, loff_t *pos, size_t *count, int isblk); 1662int generic_write_checks(struct file *file, loff_t *pos, size_t *count, int isblk);
1654extern ssize_t generic_file_aio_read(struct kiocb *, const struct iovec *, unsigned long, loff_t); 1663extern ssize_t generic_file_aio_read(struct kiocb *, const struct iovec *, unsigned long, loff_t);
1655extern ssize_t generic_file_aio_write(struct kiocb *, const struct iovec *, unsigned long, loff_t); 1664extern ssize_t generic_file_aio_write(struct kiocb *, const struct iovec *, unsigned long, loff_t);
diff --git a/include/linux/fs_enet_pd.h b/include/linux/fs_enet_pd.h
index 543cd3cd9e77..9bc045b8c478 100644
--- a/include/linux/fs_enet_pd.h
+++ b/include/linux/fs_enet_pd.h
@@ -16,6 +16,7 @@
16#ifndef FS_ENET_PD_H 16#ifndef FS_ENET_PD_H
17#define FS_ENET_PD_H 17#define FS_ENET_PD_H
18 18
19#include <linux/string.h>
19#include <asm/types.h> 20#include <asm/types.h>
20 21
21#define FS_ENET_NAME "fs_enet" 22#define FS_ENET_NAME "fs_enet"
@@ -119,6 +120,7 @@ struct fs_platform_info {
119 120
120 u32 cp_page; /* CPM page */ 121 u32 cp_page; /* CPM page */
121 u32 cp_block; /* CPM sblock */ 122 u32 cp_block; /* CPM sblock */
123 u32 cp_command; /* CPM page/sblock/mcn */
122 124
123 u32 clk_trx; /* some stuff for pins & mux configuration*/ 125 u32 clk_trx; /* some stuff for pins & mux configuration*/
124 u32 clk_rx; 126 u32 clk_rx;
@@ -133,7 +135,11 @@ struct fs_platform_info {
133 u32 device_flags; 135 u32 device_flags;
134 136
135 int phy_addr; /* the phy address (-1 no phy) */ 137 int phy_addr; /* the phy address (-1 no phy) */
138#ifdef CONFIG_PPC_CPM_NEW_BINDING
139 char bus_id[16];
140#else
136 const char* bus_id; 141 const char* bus_id;
142#endif
137 int phy_irq; /* the phy irq (if it exists) */ 143 int phy_irq; /* the phy irq (if it exists) */
138 144
139 const struct fs_mii_bus_info *bus_info; 145 const struct fs_mii_bus_info *bus_info;
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h
index 695741b0e420..1831b196c70a 100644
--- a/include/linux/fsl_devices.h
+++ b/include/linux/fsl_devices.h
@@ -53,6 +53,7 @@ struct gianfar_platform_data {
53 u32 bus_id; 53 u32 bus_id;
54 u32 phy_id; 54 u32 phy_id;
55 u8 mac_addr[6]; 55 u8 mac_addr[6];
56 phy_interface_t interface;
56}; 57};
57 58
58struct gianfar_mdio_data { 59struct gianfar_mdio_data {
diff --git a/include/linux/genetlink.h b/include/linux/genetlink.h
index f7a93770e1be..7da02c93002b 100644
--- a/include/linux/genetlink.h
+++ b/include/linux/genetlink.h
@@ -39,6 +39,9 @@ enum {
39 CTRL_CMD_NEWOPS, 39 CTRL_CMD_NEWOPS,
40 CTRL_CMD_DELOPS, 40 CTRL_CMD_DELOPS,
41 CTRL_CMD_GETOPS, 41 CTRL_CMD_GETOPS,
42 CTRL_CMD_NEWMCAST_GRP,
43 CTRL_CMD_DELMCAST_GRP,
44 CTRL_CMD_GETMCAST_GRP, /* unused */
42 __CTRL_CMD_MAX, 45 __CTRL_CMD_MAX,
43}; 46};
44 47
@@ -52,6 +55,7 @@ enum {
52 CTRL_ATTR_HDRSIZE, 55 CTRL_ATTR_HDRSIZE,
53 CTRL_ATTR_MAXATTR, 56 CTRL_ATTR_MAXATTR,
54 CTRL_ATTR_OPS, 57 CTRL_ATTR_OPS,
58 CTRL_ATTR_MCAST_GROUPS,
55 __CTRL_ATTR_MAX, 59 __CTRL_ATTR_MAX,
56}; 60};
57 61
@@ -66,4 +70,13 @@ enum {
66 70
67#define CTRL_ATTR_OP_MAX (__CTRL_ATTR_OP_MAX - 1) 71#define CTRL_ATTR_OP_MAX (__CTRL_ATTR_OP_MAX - 1)
68 72
73enum {
74 CTRL_ATTR_MCAST_GRP_UNSPEC,
75 CTRL_ATTR_MCAST_GRP_NAME,
76 CTRL_ATTR_MCAST_GRP_ID,
77 __CTRL_ATTR_MCAST_GRP_MAX,
78};
79
80#define CTRL_ATTR_MCAST_GRP_MAX (__CTRL_ATTR_MCAST_GRP_MAX - 1)
81
69#endif /* __LINUX_GENERIC_NETLINK_H */ 82#endif /* __LINUX_GENERIC_NETLINK_H */
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 9756fc102a83..a47b8025d399 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -264,7 +264,7 @@ static inline void set_capacity(struct gendisk *disk, sector_t size)
264 264
265#ifdef CONFIG_SOLARIS_X86_PARTITION 265#ifdef CONFIG_SOLARIS_X86_PARTITION
266 266
267#define SOLARIS_X86_NUMSLICE 8 267#define SOLARIS_X86_NUMSLICE 16
268#define SOLARIS_X86_VTOC_SANE (0x600DDEEEUL) 268#define SOLARIS_X86_VTOC_SANE (0x600DDEEEUL)
269 269
270struct solaris_x86_slice { 270struct solaris_x86_slice {
diff --git a/include/linux/gfs2_ondisk.h b/include/linux/gfs2_ondisk.h
index a44a6a078f0a..c3c19f926e6f 100644
--- a/include/linux/gfs2_ondisk.h
+++ b/include/linux/gfs2_ondisk.h
@@ -170,6 +170,33 @@ struct gfs2_rgrp {
170}; 170};
171 171
172/* 172/*
173 * quota linked list: user quotas and group quotas form two separate
174 * singly linked lists. ll_next stores uids or gids of next quotas in the
175 * linked list.
176
177Given the uid/gid, how to calculate the quota file offsets for the corresponding
178gfs2_quota structures on disk:
179
180for user quotas, given uid,
181offset = uid * sizeof(struct gfs2_quota);
182
183for group quotas, given gid,
184offset = (gid * sizeof(struct gfs2_quota)) + sizeof(struct gfs2_quota);
185
186
187 uid:0 gid:0 uid:12 gid:12 uid:17 gid:17 uid:5142 gid:5142
188+-------+-------+ +-------+-------+ +-------+- - - -+ +- - - -+-------+
189| valid | valid | :: | valid | valid | :: | valid | inval | :: | inval | valid |
190+-------+-------+ +-------+-------+ +-------+- - - -+ +- - - -+-------+
191next:12 next:12 next:17 next:5142 next:NULL next:NULL
192 | | | | |<-- user quota list |
193 \______|___________/ \______|___________/ group quota list -->|
194 | | |
195 \__________________/ \_______________________________________/
196
197*/
198
199/*
173 * quota structure 200 * quota structure
174 */ 201 */
175 202
@@ -177,7 +204,8 @@ struct gfs2_quota {
177 __be64 qu_limit; 204 __be64 qu_limit;
178 __be64 qu_warn; 205 __be64 qu_warn;
179 __be64 qu_value; 206 __be64 qu_value;
180 __u8 qu_reserved[64]; 207 __be32 qu_ll_next; /* location of next quota in list */
208 __u8 qu_reserved[60];
181}; 209};
182 210
183/* 211/*
diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index 12c5e4e3135a..1fcb0033179e 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -103,21 +103,6 @@ __alloc_zeroed_user_highpage(gfp_t movableflags,
103#endif 103#endif
104 104
105/** 105/**
106 * alloc_zeroed_user_highpage - Allocate a zeroed HIGHMEM page for a VMA
107 * @vma: The VMA the page is to be allocated for
108 * @vaddr: The virtual address the page will be inserted into
109 *
110 * This function will allocate a page for a VMA that the caller knows will
111 * not be able to move in the future using move_pages() or reclaim. If it
112 * is known that the page can move, use alloc_zeroed_user_highpage_movable
113 */
114static inline struct page *
115alloc_zeroed_user_highpage(struct vm_area_struct *vma, unsigned long vaddr)
116{
117 return __alloc_zeroed_user_highpage(0, vma, vaddr);
118}
119
120/**
121 * alloc_zeroed_user_highpage_movable - Allocate a zeroed HIGHMEM page for a VMA that the caller knows can move 106 * alloc_zeroed_user_highpage_movable - Allocate a zeroed HIGHMEM page for a VMA that the caller knows can move
122 * @vma: The VMA the page is to be allocated for 107 * @vma: The VMA the page is to be allocated for
123 * @vaddr: The virtual address the page will be inserted into 108 * @vaddr: The virtual address the page will be inserted into
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 49b7053043ad..3a19b032c0eb 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -1,6 +1,8 @@
1#ifndef _LINUX_HUGETLB_H 1#ifndef _LINUX_HUGETLB_H
2#define _LINUX_HUGETLB_H 2#define _LINUX_HUGETLB_H
3 3
4#include <linux/fs.h>
5
4#ifdef CONFIG_HUGETLB_PAGE 6#ifdef CONFIG_HUGETLB_PAGE
5 7
6#include <linux/mempolicy.h> 8#include <linux/mempolicy.h>
@@ -64,11 +66,8 @@ void hugetlb_free_pgd_range(struct mmu_gather **tlb, unsigned long addr,
64 * If the arch doesn't supply something else, assume that hugepage 66 * If the arch doesn't supply something else, assume that hugepage
65 * size aligned regions are ok without further preparation. 67 * size aligned regions are ok without further preparation.
66 */ 68 */
67static inline int prepare_hugepage_range(unsigned long addr, unsigned long len, 69static inline int prepare_hugepage_range(unsigned long addr, unsigned long len)
68 pgoff_t pgoff)
69{ 70{
70 if (pgoff & (~HPAGE_MASK >> PAGE_SHIFT))
71 return -EINVAL;
72 if (len & ~HPAGE_MASK) 71 if (len & ~HPAGE_MASK)
73 return -EINVAL; 72 return -EINVAL;
74 if (addr & ~HPAGE_MASK) 73 if (addr & ~HPAGE_MASK)
@@ -76,8 +75,7 @@ static inline int prepare_hugepage_range(unsigned long addr, unsigned long len,
76 return 0; 75 return 0;
77} 76}
78#else 77#else
79int prepare_hugepage_range(unsigned long addr, unsigned long len, 78int prepare_hugepage_range(unsigned long addr, unsigned long len);
80 pgoff_t pgoff);
81#endif 79#endif
82 80
83#ifndef ARCH_HAS_SETCLEAR_HUGE_PTE 81#ifndef ARCH_HAS_SETCLEAR_HUGE_PTE
@@ -115,7 +113,7 @@ static inline unsigned long hugetlb_total_pages(void)
115#define hugetlb_report_meminfo(buf) 0 113#define hugetlb_report_meminfo(buf) 0
116#define hugetlb_report_node_meminfo(n, buf) 0 114#define hugetlb_report_node_meminfo(n, buf) 0
117#define follow_huge_pmd(mm, addr, pmd, write) NULL 115#define follow_huge_pmd(mm, addr, pmd, write) NULL
118#define prepare_hugepage_range(addr,len,pgoff) (-EINVAL) 116#define prepare_hugepage_range(addr,len) (-EINVAL)
119#define pmd_huge(x) 0 117#define pmd_huge(x) 0
120#define is_hugepage_only_range(mm, addr, len) 0 118#define is_hugepage_only_range(mm, addr, len) 0
121#define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) ({BUG(); 0; }) 119#define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) ({BUG(); 0; })
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h
index aa83d4163096..a271b67a8e2d 100644
--- a/include/linux/i2c-id.h
+++ b/include/linux/i2c-id.h
@@ -115,9 +115,11 @@
115#define I2C_DRIVERID_KS0127 86 /* Samsung ks0127 video decoder */ 115#define I2C_DRIVERID_KS0127 86 /* Samsung ks0127 video decoder */
116#define I2C_DRIVERID_TLV320AIC23B 87 /* TI TLV320AIC23B audio codec */ 116#define I2C_DRIVERID_TLV320AIC23B 87 /* TI TLV320AIC23B audio codec */
117#define I2C_DRIVERID_ISL1208 88 /* Intersil ISL1208 RTC */ 117#define I2C_DRIVERID_ISL1208 88 /* Intersil ISL1208 RTC */
118#define I2C_DRIVERID_WM8731 89 /* Wolfson WM8731 audio codec */ 118#define I2C_DRIVERID_WM8731 89 /* Wolfson WM8731 audio codec */
119#define I2C_DRIVERID_WM8750 90 /* Wolfson WM8750 audio codec */ 119#define I2C_DRIVERID_WM8750 90 /* Wolfson WM8750 audio codec */
120#define I2C_DRIVERID_WM8753 91 /* Wolfson WM8753 audio codec */ 120#define I2C_DRIVERID_WM8753 91 /* Wolfson WM8753 audio codec */
121#define I2C_DRIVERID_LM4857 92 /* LM4857 Audio Amplifier */
122#define I2C_DRIVERID_VP27SMPX 93 /* Panasonic VP27s tuner internal MPX */
121 123
122#define I2C_DRIVERID_I2CDEV 900 124#define I2C_DRIVERID_I2CDEV 900
123#define I2C_DRIVERID_ARP 902 /* SMBus ARP Client */ 125#define I2C_DRIVERID_ARP 902 /* SMBus ARP Client */
@@ -195,6 +197,7 @@
195#define I2C_HW_B_EM28XX 0x01001f /* em28xx video capture cards */ 197#define I2C_HW_B_EM28XX 0x01001f /* em28xx video capture cards */
196#define I2C_HW_B_CX2341X 0x010020 /* Conexant CX2341X MPEG encoder cards */ 198#define I2C_HW_B_CX2341X 0x010020 /* Conexant CX2341X MPEG encoder cards */
197#define I2C_HW_B_INTELFB 0x010021 /* intel framebuffer driver */ 199#define I2C_HW_B_INTELFB 0x010021 /* intel framebuffer driver */
200#define I2C_HW_B_CX23885 0x010022 /* conexant 23885 based tv cards (bus1) */
198 201
199/* --- PCF 8584 based algorithms */ 202/* --- PCF 8584 based algorithms */
200#define I2C_HW_P_LP 0x020000 /* Parallel port interface */ 203#define I2C_HW_P_LP 0x020000 /* Parallel port interface */
diff --git a/include/linux/i2c-isa.h b/include/linux/i2c-isa.h
deleted file mode 100644
index 67e3598c4cec..000000000000
--- a/include/linux/i2c-isa.h
+++ /dev/null
@@ -1,36 +0,0 @@
1/*
2 * i2c-isa.h - definitions for the i2c-isa pseudo-i2c-adapter interface
3 *
4 * Copyright (C) 2005 Jean Delvare <khali@linux-fr.org>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21#ifndef _LINUX_I2C_ISA_H
22#define _LINUX_I2C_ISA_H
23
24#include <linux/i2c.h>
25
26extern int i2c_isa_add_driver(struct i2c_driver *driver);
27extern int i2c_isa_del_driver(struct i2c_driver *driver);
28
29/* Detect whether we are on the isa bus. This is only useful to hybrid
30 (i2c+isa) drivers. */
31#define i2c_is_isa_adapter(adapptr) \
32 ((adapptr)->id == I2C_HW_ISA)
33#define i2c_is_isa_client(clientptr) \
34 i2c_is_isa_adapter((clientptr)->adapter)
35
36#endif /* _LINUX_I2C_ISA_H */
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 2eaba21b9b1a..2a32f2fd940d 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -156,10 +156,14 @@ struct i2c_driver {
156 * @name: Indicates the type of the device, usually a chip name that's 156 * @name: Indicates the type of the device, usually a chip name that's
157 * generic enough to hide second-sourcing and compatible revisions. 157 * generic enough to hide second-sourcing and compatible revisions.
158 * @adapter: manages the bus segment hosting this I2C device 158 * @adapter: manages the bus segment hosting this I2C device
159 * @driver: device's driver, hence pointer to access routines
160 * @usage_count: counts current number of users of this client
159 * @dev: Driver model device node for the slave. 161 * @dev: Driver model device node for the slave.
160 * @irq: indicates the IRQ generated by this device (if any) 162 * @irq: indicates the IRQ generated by this device (if any)
161 * @driver_name: Identifies new-style driver used with this device; also 163 * @driver_name: Identifies new-style driver used with this device; also
162 * used as the module name for hotplug/coldplug modprobe support. 164 * used as the module name for hotplug/coldplug modprobe support.
165 * @list: list of active/busy clients
166 * @released: used to synchronize client releases & detaches and references
163 * 167 *
164 * An i2c_client identifies a single device (i.e. chip) connected to an 168 * An i2c_client identifies a single device (i.e. chip) connected to an
165 * i2c bus. The behaviour exposed to Linux is defined by the driver 169 * i2c bus. The behaviour exposed to Linux is defined by the driver
@@ -368,7 +372,6 @@ struct i2c_client_address_data {
368 372
369/* The numbers to use to set I2C bus address */ 373/* The numbers to use to set I2C bus address */
370#define ANY_I2C_BUS 0xffff 374#define ANY_I2C_BUS 0xffff
371#define ANY_I2C_ISA_BUS 9191
372 375
373 376
374/* ----- functions exported by i2c.o */ 377/* ----- functions exported by i2c.o */
diff --git a/include/linux/i2o.h b/include/linux/i2o.h
index 333a370a3bdc..9752307d16ba 100644
--- a/include/linux/i2o.h
+++ b/include/linux/i2o.h
@@ -946,8 +946,7 @@ static inline int i2o_pool_alloc(struct i2o_pool *pool, const char *name,
946 strcpy(pool->name, name); 946 strcpy(pool->name, name);
947 947
948 pool->slab = 948 pool->slab =
949 kmem_cache_create(pool->name, size, 0, SLAB_HWCACHE_ALIGN, NULL, 949 kmem_cache_create(pool->name, size, 0, SLAB_HWCACHE_ALIGN, NULL);
950 NULL);
951 if (!pool->slab) 950 if (!pool->slab)
952 goto free_name; 951 goto free_name;
953 952
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 19ab25804056..85d448b4abec 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -555,7 +555,7 @@ typedef struct ide_drive_s {
555 char name[4]; /* drive name, such as "hda" */ 555 char name[4]; /* drive name, such as "hda" */
556 char driver_req[10]; /* requests specific driver */ 556 char driver_req[10]; /* requests specific driver */
557 557
558 request_queue_t *queue; /* request queue */ 558 struct request_queue *queue; /* request queue */
559 559
560 struct request *rq; /* current request */ 560 struct request *rq; /* current request */
561 struct ide_drive_s *next; /* circular list of hwgroup drives */ 561 struct ide_drive_s *next; /* circular list of hwgroup drives */
@@ -634,7 +634,7 @@ typedef struct ide_drive_s {
634 634
635 unsigned int bios_cyl; /* BIOS/fdisk/LILO number of cyls */ 635 unsigned int bios_cyl; /* BIOS/fdisk/LILO number of cyls */
636 unsigned int cyl; /* "real" number of cyls */ 636 unsigned int cyl; /* "real" number of cyls */
637 unsigned int drive_data; /* use by tuneproc/selectproc */ 637 unsigned int drive_data; /* used by set_pio_mode/selectproc */
638 unsigned int failures; /* current failure count */ 638 unsigned int failures; /* current failure count */
639 unsigned int max_failures; /* maximum allowed failure count */ 639 unsigned int max_failures; /* maximum allowed failure count */
640 u64 probed_capacity;/* initial reported media capacity (ide-cd only currently) */ 640 u64 probed_capacity;/* initial reported media capacity (ide-cd only currently) */
@@ -681,6 +681,10 @@ typedef struct hwif_s {
681 u8 straight8; /* Alan's straight 8 check */ 681 u8 straight8; /* Alan's straight 8 check */
682 u8 bus_state; /* power state of the IDE bus */ 682 u8 bus_state; /* power state of the IDE bus */
683 683
684 u8 host_flags;
685
686 u8 pio_mask;
687
684 u8 atapi_dma; /* host supports atapi_dma */ 688 u8 atapi_dma; /* host supports atapi_dma */
685 u8 ultra_mask; 689 u8 ultra_mask;
686 u8 mwdma_mask; 690 u8 mwdma_mask;
@@ -698,10 +702,10 @@ typedef struct hwif_s {
698#if 0 702#if 0
699 ide_hwif_ops_t *hwifops; 703 ide_hwif_ops_t *hwifops;
700#else 704#else
701 /* routine to tune PIO mode for drives */ 705 /* routine to set PIO mode for drives */
702 void (*tuneproc)(ide_drive_t *, u8); 706 void (*set_pio_mode)(ide_drive_t *, const u8);
703 /* routine to retune DMA modes for drives */ 707 /* routine to retune DMA modes for drives */
704 int (*speedproc)(ide_drive_t *, u8); 708 int (*speedproc)(ide_drive_t *, const u8);
705 /* tweaks hardware to select drive */ 709 /* tweaks hardware to select drive */
706 void (*selectproc)(ide_drive_t *); 710 void (*selectproc)(ide_drive_t *);
707 /* chipset polling based on hba specifics */ 711 /* chipset polling based on hba specifics */
@@ -719,6 +723,7 @@ typedef struct hwif_s {
719 /* driver soft-power interface */ 723 /* driver soft-power interface */
720 int (*busproc)(ide_drive_t *, int); 724 int (*busproc)(ide_drive_t *, int);
721#endif 725#endif
726 u8 (*mdma_filter)(ide_drive_t *);
722 u8 (*udma_filter)(ide_drive_t *); 727 u8 (*udma_filter)(ide_drive_t *);
723 728
724 void (*ata_input_data)(ide_drive_t *, void *, u32); 729 void (*ata_input_data)(ide_drive_t *, void *, u32);
@@ -1202,7 +1207,7 @@ extern void ide_stall_queue(ide_drive_t *drive, unsigned long timeout);
1202extern int ide_spin_wait_hwgroup(ide_drive_t *); 1207extern int ide_spin_wait_hwgroup(ide_drive_t *);
1203extern void ide_timer_expiry(unsigned long); 1208extern void ide_timer_expiry(unsigned long);
1204extern irqreturn_t ide_intr(int irq, void *dev_id); 1209extern irqreturn_t ide_intr(int irq, void *dev_id);
1205extern void do_ide_request(request_queue_t *); 1210extern void do_ide_request(struct request_queue *);
1206 1211
1207void ide_init_disk(struct gendisk *, ide_drive_t *); 1212void ide_init_disk(struct gendisk *, ide_drive_t *);
1208 1213
@@ -1244,7 +1249,19 @@ typedef struct ide_pci_enablebit_s {
1244 1249
1245enum { 1250enum {
1246 /* Uses ISA control ports not PCI ones. */ 1251 /* Uses ISA control ports not PCI ones. */
1247 IDEPCI_FLAG_ISA_PORTS = (1 << 0), 1252 IDE_HFLAG_ISA_PORTS = (1 << 0),
1253 /* single port device */
1254 IDE_HFLAG_SINGLE = (1 << 1),
1255 /* don't use legacy PIO blacklist */
1256 IDE_HFLAG_PIO_NO_BLACKLIST = (1 << 2),
1257 /* don't use conservative PIO "downgrade" */
1258 IDE_HFLAG_PIO_NO_DOWNGRADE = (1 << 3),
1259 /* use PIO8/9 for prefetch off/on */
1260 IDE_HFLAG_ABUSE_PREFETCH = (1 << 4),
1261 /* use PIO6/7 for fast-devsel off/on */
1262 IDE_HFLAG_ABUSE_FAST_DEVSEL = (1 << 5),
1263 /* use 100-102 and 200-202 PIO values to set DMA modes */
1264 IDE_HFLAG_ABUSE_DMA_MODES = (1 << 6),
1248}; 1265};
1249 1266
1250typedef struct ide_pci_device_s { 1267typedef struct ide_pci_device_s {
@@ -1256,13 +1273,13 @@ typedef struct ide_pci_device_s {
1256 void (*init_hwif)(ide_hwif_t *); 1273 void (*init_hwif)(ide_hwif_t *);
1257 void (*init_dma)(ide_hwif_t *, unsigned long); 1274 void (*init_dma)(ide_hwif_t *, unsigned long);
1258 void (*fixup)(ide_hwif_t *); 1275 void (*fixup)(ide_hwif_t *);
1259 u8 channels;
1260 u8 autodma; 1276 u8 autodma;
1261 ide_pci_enablebit_t enablebits[2]; 1277 ide_pci_enablebit_t enablebits[2];
1262 u8 bootable; 1278 u8 bootable;
1263 unsigned int extra; 1279 unsigned int extra;
1264 struct ide_pci_device_s *next; 1280 struct ide_pci_device_s *next;
1265 u8 flags; 1281 u8 host_flags;
1282 u8 pio_mask;
1266 u8 udma_mask; 1283 u8 udma_mask;
1267} ide_pci_device_t; 1284} ide_pci_device_t;
1268 1285
@@ -1275,16 +1292,24 @@ void ide_init_sg_cmd(ide_drive_t *, struct request *);
1275#define BAD_DMA_DRIVE 0 1292#define BAD_DMA_DRIVE 0
1276#define GOOD_DMA_DRIVE 1 1293#define GOOD_DMA_DRIVE 1
1277 1294
1278#ifdef CONFIG_BLK_DEV_IDEDMA
1279struct drive_list_entry { 1295struct drive_list_entry {
1280 const char *id_model; 1296 const char *id_model;
1281 const char *id_firmware; 1297 const char *id_firmware;
1282}; 1298};
1283 1299
1284int ide_in_drive_list(struct hd_driveid *, const struct drive_list_entry *); 1300int ide_in_drive_list(struct hd_driveid *, const struct drive_list_entry *);
1301
1302#ifdef CONFIG_BLK_DEV_IDEDMA
1285int __ide_dma_bad_drive(ide_drive_t *); 1303int __ide_dma_bad_drive(ide_drive_t *);
1286int __ide_dma_good_drive(ide_drive_t *); 1304int __ide_dma_good_drive(ide_drive_t *);
1287u8 ide_max_dma_mode(ide_drive_t *); 1305
1306u8 ide_find_dma_mode(ide_drive_t *, u8);
1307
1308static inline u8 ide_max_dma_mode(ide_drive_t *drive)
1309{
1310 return ide_find_dma_mode(drive, XFER_UDMA_6);
1311}
1312
1288int ide_tune_dma(ide_drive_t *); 1313int ide_tune_dma(ide_drive_t *);
1289void ide_dma_off(ide_drive_t *); 1314void ide_dma_off(ide_drive_t *);
1290void ide_dma_verbose(ide_drive_t *); 1315void ide_dma_verbose(ide_drive_t *);
@@ -1302,7 +1327,6 @@ void ide_dma_host_off(ide_drive_t *);
1302void ide_dma_off_quietly(ide_drive_t *); 1327void ide_dma_off_quietly(ide_drive_t *);
1303void ide_dma_host_on(ide_drive_t *); 1328void ide_dma_host_on(ide_drive_t *);
1304extern int __ide_dma_on(ide_drive_t *); 1329extern int __ide_dma_on(ide_drive_t *);
1305extern int __ide_dma_check(ide_drive_t *);
1306extern int ide_dma_setup(ide_drive_t *); 1330extern int ide_dma_setup(ide_drive_t *);
1307extern void ide_dma_start(ide_drive_t *); 1331extern void ide_dma_start(ide_drive_t *);
1308extern int __ide_dma_end(ide_drive_t *); 1332extern int __ide_dma_end(ide_drive_t *);
@@ -1311,6 +1335,7 @@ extern void ide_dma_timeout(ide_drive_t *);
1311#endif /* CONFIG_BLK_DEV_IDEDMA_PCI */ 1335#endif /* CONFIG_BLK_DEV_IDEDMA_PCI */
1312 1336
1313#else 1337#else
1338static inline u8 ide_find_dma_mode(ide_drive_t *drive, u8 speed) { return 0; }
1314static inline u8 ide_max_dma_mode(ide_drive_t *drive) { return 0; } 1339static inline u8 ide_max_dma_mode(ide_drive_t *drive) { return 0; }
1315static inline int ide_tune_dma(ide_drive_t *drive) { return 0; } 1340static inline int ide_tune_dma(ide_drive_t *drive) { return 0; }
1316static inline void ide_dma_off(ide_drive_t *drive) { ; } 1341static inline void ide_dma_off(ide_drive_t *drive) { ; }
@@ -1327,11 +1352,13 @@ extern int ide_acpi_exec_tfs(ide_drive_t *drive);
1327extern void ide_acpi_get_timing(ide_hwif_t *hwif); 1352extern void ide_acpi_get_timing(ide_hwif_t *hwif);
1328extern void ide_acpi_push_timing(ide_hwif_t *hwif); 1353extern void ide_acpi_push_timing(ide_hwif_t *hwif);
1329extern void ide_acpi_init(ide_hwif_t *hwif); 1354extern void ide_acpi_init(ide_hwif_t *hwif);
1355extern void ide_acpi_set_state(ide_hwif_t *hwif, int on);
1330#else 1356#else
1331static inline int ide_acpi_exec_tfs(ide_drive_t *drive) { return 0; } 1357static inline int ide_acpi_exec_tfs(ide_drive_t *drive) { return 0; }
1332static inline void ide_acpi_get_timing(ide_hwif_t *hwif) { ; } 1358static inline void ide_acpi_get_timing(ide_hwif_t *hwif) { ; }
1333static inline void ide_acpi_push_timing(ide_hwif_t *hwif) { ; } 1359static inline void ide_acpi_push_timing(ide_hwif_t *hwif) { ; }
1334static inline void ide_acpi_init(ide_hwif_t *hwif) { ; } 1360static inline void ide_acpi_init(ide_hwif_t *hwif) { ; }
1361static inline void ide_acpi_set_state(ide_hwif_t *hwif, int on) {}
1335#endif 1362#endif
1336 1363
1337extern int ide_hwif_request_regions(ide_hwif_t *hwif); 1364extern int ide_hwif_request_regions(ide_hwif_t *hwif);
@@ -1357,12 +1384,29 @@ static inline void ide_set_hwifdata (ide_hwif_t * hwif, void *data)
1357} 1384}
1358 1385
1359/* ide-lib.c */ 1386/* ide-lib.c */
1360u8 ide_rate_filter(ide_drive_t *, u8);
1361extern char *ide_xfer_verbose(u8 xfer_rate); 1387extern char *ide_xfer_verbose(u8 xfer_rate);
1362extern void ide_toggle_bounce(ide_drive_t *drive, int on); 1388extern void ide_toggle_bounce(ide_drive_t *drive, int on);
1363extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate); 1389extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate);
1364int ide_use_fast_pio(ide_drive_t *); 1390int ide_use_fast_pio(ide_drive_t *);
1365 1391
1392static inline int ide_dev_has_iordy(struct hd_driveid *id)
1393{
1394 return ((id->field_valid & 2) && (id->capability & 8)) ? 1 : 0;
1395}
1396
1397static inline int ide_dev_is_sata(struct hd_driveid *id)
1398{
1399 /*
1400 * See if word 93 is 0 AND drive is at least ATA-5 compatible
1401 * verifying that word 80 by casting it to a signed type --
1402 * this trick allows us to filter out the reserved values of
1403 * 0x0000 and 0xffff along with the earlier ATA revisions...
1404 */
1405 if (id->hw_config == 0 && (short)id->major_rev_num >= 0x0020)
1406 return 1;
1407 return 0;
1408}
1409
1366u8 ide_dump_status(ide_drive_t *, const char *, u8); 1410u8 ide_dump_status(ide_drive_t *, const char *, u8);
1367 1411
1368typedef struct ide_pio_timings_s { 1412typedef struct ide_pio_timings_s {
@@ -1372,16 +1416,16 @@ typedef struct ide_pio_timings_s {
1372 /* active + recovery (+ setup for some chips) */ 1416 /* active + recovery (+ setup for some chips) */
1373} ide_pio_timings_t; 1417} ide_pio_timings_t;
1374 1418
1375typedef struct ide_pio_data_s { 1419unsigned int ide_pio_cycle_time(ide_drive_t *, u8);
1376 u8 pio_mode; 1420u8 ide_get_best_pio_mode(ide_drive_t *, u8, u8);
1377 u8 use_iordy;
1378 u8 overridden;
1379 unsigned int cycle_time;
1380} ide_pio_data_t;
1381
1382extern u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_pio_data_t *d);
1383extern const ide_pio_timings_t ide_pio_timings[6]; 1421extern const ide_pio_timings_t ide_pio_timings[6];
1384 1422
1423void ide_set_pio(ide_drive_t *, u8);
1424
1425static inline void ide_set_max_pio(ide_drive_t *drive)
1426{
1427 ide_set_pio(drive, 255);
1428}
1385 1429
1386extern spinlock_t ide_lock; 1430extern spinlock_t ide_lock;
1387extern struct mutex ide_cfg_mtx; 1431extern struct mutex ide_cfg_mtx;
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 272f8c8c90da..30621c27159f 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -16,6 +16,7 @@
16#define IEEE80211_H 16#define IEEE80211_H
17 17
18#include <linux/types.h> 18#include <linux/types.h>
19#include <asm/byteorder.h>
19 20
20#define FCS_LEN 4 21#define FCS_LEN 4
21 22
@@ -350,4 +351,64 @@ enum ieee80211_eid {
350 351
351#define WLAN_MAX_KEY_LEN 32 352#define WLAN_MAX_KEY_LEN 32
352 353
354/**
355 * ieee80211_get_SA - get pointer to SA
356 *
357 * Given an 802.11 frame, this function returns the offset
358 * to the source address (SA). It does not verify that the
359 * header is long enough to contain the address, and the
360 * header must be long enough to contain the frame control
361 * field.
362 *
363 * @hdr: the frame
364 */
365static inline u8 *ieee80211_get_SA(struct ieee80211_hdr *hdr)
366{
367 u8 *raw = (u8 *) hdr;
368 u8 tofrom = (*(raw+1)) & 3; /* get the TODS and FROMDS bits */
369
370 switch (tofrom) {
371 case 2:
372 return hdr->addr3;
373 case 3:
374 return hdr->addr4;
375 }
376 return hdr->addr2;
377}
378
379/**
380 * ieee80211_get_DA - get pointer to DA
381 *
382 * Given an 802.11 frame, this function returns the offset
383 * to the destination address (DA). It does not verify that
384 * the header is long enough to contain the address, and the
385 * header must be long enough to contain the frame control
386 * field.
387 *
388 * @hdr: the frame
389 */
390static inline u8 *ieee80211_get_DA(struct ieee80211_hdr *hdr)
391{
392 u8 *raw = (u8 *) hdr;
393 u8 to_ds = (*(raw+1)) & 1; /* get the TODS bit */
394
395 if (to_ds)
396 return hdr->addr3;
397 return hdr->addr1;
398}
399
400/**
401 * ieee80211_get_morefrag - determine whether the MOREFRAGS bit is set
402 *
403 * This function determines whether the "more fragments" bit is set
404 * in the frame.
405 *
406 * @hdr: the frame
407 */
408static inline int ieee80211_get_morefrag(struct ieee80211_hdr *hdr)
409{
410 return (le16_to_cpu(hdr->frame_control) &
411 IEEE80211_FCTL_MOREFRAGS) != 0;
412}
413
353#endif /* IEEE80211_H */ 414#endif /* IEEE80211_H */
diff --git a/include/linux/if_arcnet.h b/include/linux/if_arcnet.h
index af380cb876a0..27ea2ac445ad 100644
--- a/include/linux/if_arcnet.h
+++ b/include/linux/if_arcnet.h
@@ -59,7 +59,7 @@ struct arc_rfc1201
59{ 59{
60 uint8_t proto; /* protocol ID field - varies */ 60 uint8_t proto; /* protocol ID field - varies */
61 uint8_t split_flag; /* for use with split packets */ 61 uint8_t split_flag; /* for use with split packets */
62 uint16_t sequence; /* sequence number */ 62 __be16 sequence; /* sequence number */
63 uint8_t payload[0]; /* space remaining in packet (504 bytes)*/ 63 uint8_t payload[0]; /* space remaining in packet (504 bytes)*/
64}; 64};
65#define RFC1201_HDR_SIZE 4 65#define RFC1201_HDR_SIZE 4
diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h
index 4ff211d98769..99e3a1a00099 100644
--- a/include/linux/if_bridge.h
+++ b/include/linux/if_bridge.h
@@ -104,7 +104,7 @@ struct __fdb_entry
104 104
105#include <linux/netdevice.h> 105#include <linux/netdevice.h>
106 106
107extern void brioctl_set(int (*ioctl_hook)(unsigned int, void __user *)); 107extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __user *));
108extern struct sk_buff *(*br_handle_frame_hook)(struct net_bridge_port *p, 108extern struct sk_buff *(*br_handle_frame_hook)(struct net_bridge_port *p,
109 struct sk_buff *skb); 109 struct sk_buff *skb);
110extern int (*br_should_route_hook)(struct sk_buff **pskb); 110extern int (*br_should_route_hook)(struct sk_buff **pskb);
diff --git a/include/linux/if_eql.h b/include/linux/if_eql.h
index b68752fdc5c4..79c4f268410d 100644
--- a/include/linux/if_eql.h
+++ b/include/linux/if_eql.h
@@ -58,7 +58,6 @@ typedef struct equalizer {
58 slave_queue_t queue; 58 slave_queue_t queue;
59 int min_slaves; 59 int min_slaves;
60 int max_slaves; 60 int max_slaves;
61 struct net_device_stats stats;
62 struct timer_list timer; 61 struct timer_list timer;
63} equalizer_t; 62} equalizer_t;
64 63
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h
index 3213f6f4aa58..5f9297793661 100644
--- a/include/linux/if_ether.h
+++ b/include/linux/if_ether.h
@@ -117,9 +117,19 @@ static inline struct ethhdr *eth_hdr(const struct sk_buff *skb)
117 return (struct ethhdr *)skb_mac_header(skb); 117 return (struct ethhdr *)skb_mac_header(skb);
118} 118}
119 119
120int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr);
121
120#ifdef CONFIG_SYSCTL 122#ifdef CONFIG_SYSCTL
121extern struct ctl_table ether_table[]; 123extern struct ctl_table ether_table[];
122#endif 124#endif
125
126/*
127 * Display a 6 byte device address (MAC) in a readable format.
128 */
129#define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x"
130extern char *print_mac(char *buf, const u8 *addr);
131#define DECLARE_MAC_BUF(var) char var[18] __maybe_unused
132
123#endif 133#endif
124 134
125#endif /* _LINUX_IF_ETHER_H */ 135#endif /* _LINUX_IF_ETHER_H */
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index 422084d18ce1..84c3492ae5cb 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -78,6 +78,7 @@ enum
78 IFLA_LINKMODE, 78 IFLA_LINKMODE,
79 IFLA_LINKINFO, 79 IFLA_LINKINFO,
80#define IFLA_LINKINFO IFLA_LINKINFO 80#define IFLA_LINKINFO IFLA_LINKINFO
81 IFLA_NET_NS_PID,
81 __IFLA_MAX 82 __IFLA_MAX
82}; 83};
83 84
diff --git a/include/linux/if_pppol2tp.h b/include/linux/if_pppol2tp.h
index 516203b6fdeb..a7d6a2234b31 100644
--- a/include/linux/if_pppol2tp.h
+++ b/include/linux/if_pppol2tp.h
@@ -32,8 +32,8 @@ struct pppol2tp_addr
32 32
33 struct sockaddr_in addr; /* IP address and port to send to */ 33 struct sockaddr_in addr; /* IP address and port to send to */
34 34
35 __be16 s_tunnel, s_session; /* For matching incoming packets */ 35 __u16 s_tunnel, s_session; /* For matching incoming packets */
36 __be16 d_tunnel, d_session; /* For sending outgoing packets */ 36 __u16 d_tunnel, d_session; /* For sending outgoing packets */
37}; 37};
38 38
39/* Socket options: 39/* Socket options:
diff --git a/include/linux/if_pppox.h b/include/linux/if_pppox.h
index 25652545ba6e..40743e032845 100644
--- a/include/linux/if_pppox.h
+++ b/include/linux/if_pppox.h
@@ -40,7 +40,7 @@
40/************************************************************************ 40/************************************************************************
41 * PPPoE addressing definition 41 * PPPoE addressing definition
42 */ 42 */
43typedef __u16 sid_t; 43typedef __be16 sid_t;
44struct pppoe_addr{ 44struct pppoe_addr{
45 sid_t sid; /* Session identifier */ 45 sid_t sid; /* Session identifier */
46 unsigned char remote[ETH_ALEN]; /* Remote address */ 46 unsigned char remote[ETH_ALEN]; /* Remote address */
@@ -90,8 +90,8 @@ struct sockaddr_pppol2tp {
90#define PADS_CODE 0x65 90#define PADS_CODE 0x65
91#define PADT_CODE 0xa7 91#define PADT_CODE 0xa7
92struct pppoe_tag { 92struct pppoe_tag {
93 __u16 tag_type; 93 __be16 tag_type;
94 __u16 tag_len; 94 __be16 tag_len;
95 char tag_data[0]; 95 char tag_data[0];
96} __attribute ((packed)); 96} __attribute ((packed));
97 97
@@ -118,8 +118,8 @@ struct pppoe_hdr {
118#error "Please fix <asm/byteorder.h>" 118#error "Please fix <asm/byteorder.h>"
119#endif 119#endif
120 __u8 code; 120 __u8 code;
121 __u16 sid; 121 __be16 sid;
122 __u16 length; 122 __be16 length;
123 struct pppoe_tag tag[0]; 123 struct pppoe_tag tag[0];
124} __attribute__ ((packed)); 124} __attribute__ ((packed));
125 125
@@ -152,7 +152,7 @@ struct pppox_sock {
152 union { 152 union {
153 struct pppoe_opt pppoe; 153 struct pppoe_opt pppoe;
154 } proto; 154 } proto;
155 unsigned short num; 155 __be16 num;
156}; 156};
157#define pppoe_dev proto.pppoe.dev 157#define pppoe_dev proto.pppoe.dev
158#define pppoe_ifindex proto.pppoe.ifindex 158#define pppoe_ifindex proto.pppoe.ifindex
@@ -172,7 +172,7 @@ static inline struct sock *sk_pppox(struct pppox_sock *po)
172struct module; 172struct module;
173 173
174struct pppox_proto { 174struct pppox_proto {
175 int (*create)(struct socket *sock); 175 int (*create)(struct net *net, struct socket *sock);
176 int (*ioctl)(struct socket *sock, unsigned int cmd, 176 int (*ioctl)(struct socket *sock, unsigned int cmd,
177 unsigned long arg); 177 unsigned long arg);
178 struct module *owner; 178 struct module *owner;
diff --git a/include/linux/if_shaper.h b/include/linux/if_shaper.h
index 68c896a36a34..3b1b7ba19825 100644
--- a/include/linux/if_shaper.h
+++ b/include/linux/if_shaper.h
@@ -24,19 +24,7 @@ struct shaper
24 unsigned long recovery; /* Time we can next clock a packet out on 24 unsigned long recovery; /* Time we can next clock a packet out on
25 an empty queue */ 25 an empty queue */
26 spinlock_t lock; 26 spinlock_t lock;
27 struct net_device_stats stats;
28 struct net_device *dev; 27 struct net_device *dev;
29 int (*hard_start_xmit) (struct sk_buff *skb,
30 struct net_device *dev);
31 int (*hard_header) (struct sk_buff *skb,
32 struct net_device *dev,
33 unsigned short type,
34 void *daddr,
35 void *saddr,
36 unsigned len);
37 int (*rebuild_header)(struct sk_buff *skb);
38 int (*hard_header_cache)(struct neighbour *neigh, struct hh_cache *hh);
39 void (*header_cache_update)(struct hh_cache *hh, struct net_device *dev, unsigned char * haddr);
40 struct net_device_stats* (*get_stats)(struct net_device *dev); 28 struct net_device_stats* (*get_stats)(struct net_device *dev);
41 struct timer_list timer; 29 struct timer_list timer;
42}; 30};
diff --git a/include/linux/if_tun.h b/include/linux/if_tun.h
index 42eb6945b93e..33e489d5bb33 100644
--- a/include/linux/if_tun.h
+++ b/include/linux/if_tun.h
@@ -42,7 +42,6 @@ struct tun_struct {
42 struct sk_buff_head readq; 42 struct sk_buff_head readq;
43 43
44 struct net_device *dev; 44 struct net_device *dev;
45 struct net_device_stats stats;
46 45
47 struct fasync_struct *fasync; 46 struct fasync_struct *fasync;
48 47
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index f8443fdb124a..976d4b1067d1 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -62,7 +62,7 @@ struct vlan_hdr {
62#define VLAN_VID_MASK 0xfff 62#define VLAN_VID_MASK 0xfff
63 63
64/* found in socket.c */ 64/* found in socket.c */
65extern void vlan_ioctl_set(int (*hook)(void __user *)); 65extern void vlan_ioctl_set(int (*hook)(struct net *, void __user *));
66 66
67#define VLAN_NAME "vlan" 67#define VLAN_NAME "vlan"
68 68
diff --git a/include/linux/inet_lro.h b/include/linux/inet_lro.h
new file mode 100644
index 000000000000..e1fc1d16d3cd
--- /dev/null
+++ b/include/linux/inet_lro.h
@@ -0,0 +1,177 @@
1/*
2 * linux/include/linux/inet_lro.h
3 *
4 * Large Receive Offload (ipv4 / tcp)
5 *
6 * (C) Copyright IBM Corp. 2007
7 *
8 * Authors:
9 * Jan-Bernd Themann <themann@de.ibm.com>
10 * Christoph Raisch <raisch@de.ibm.com>
11 *
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2, or (at your option)
16 * any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 */
27
28#ifndef __INET_LRO_H_
29#define __INET_LRO_H_
30
31#include <net/ip.h>
32#include <net/tcp.h>
33
34/*
35 * LRO statistics
36 */
37
38struct net_lro_stats {
39 unsigned long aggregated;
40 unsigned long flushed;
41 unsigned long no_desc;
42};
43
44/*
45 * LRO descriptor for a tcp session
46 */
47struct net_lro_desc {
48 struct sk_buff *parent;
49 struct sk_buff *last_skb;
50 struct skb_frag_struct *next_frag;
51 struct iphdr *iph;
52 struct tcphdr *tcph;
53 struct vlan_group *vgrp;
54 __wsum data_csum;
55 u32 tcp_rcv_tsecr;
56 u32 tcp_rcv_tsval;
57 u32 tcp_ack;
58 u32 tcp_next_seq;
59 u32 skb_tot_frags_len;
60 u16 ip_tot_len;
61 u16 tcp_saw_tstamp; /* timestamps enabled */
62 u16 tcp_window;
63 u16 vlan_tag;
64 int pkt_aggr_cnt; /* counts aggregated packets */
65 int vlan_packet;
66 int mss;
67 int active;
68};
69
70/*
71 * Large Receive Offload (LRO) Manager
72 *
73 * Fields must be set by driver
74 */
75
76struct net_lro_mgr {
77 struct net_device *dev;
78 struct net_lro_stats stats;
79
80 /* LRO features */
81 unsigned long features;
82#define LRO_F_NAPI 1 /* Pass packets to stack via NAPI */
83#define LRO_F_EXTRACT_VLAN_ID 2 /* Set flag if VLAN IDs are extracted
84 from received packets and eth protocol
85 is still ETH_P_8021Q */
86
87 u32 ip_summed; /* Set in non generated SKBs in page mode */
88 u32 ip_summed_aggr; /* Set in aggregated SKBs: CHECKSUM_UNNECESSARY
89 * or CHECKSUM_NONE */
90
91 int max_desc; /* Max number of LRO descriptors */
92 int max_aggr; /* Max number of LRO packets to be aggregated */
93
94 struct net_lro_desc *lro_arr; /* Array of LRO descriptors */
95
96 /*
97 * Optimized driver functions
98 *
99 * get_skb_header: returns tcp and ip header for packet in SKB
100 */
101 int (*get_skb_header)(struct sk_buff *skb, void **ip_hdr,
102 void **tcpudp_hdr, u64 *hdr_flags, void *priv);
103
104 /* hdr_flags: */
105#define LRO_IPV4 1 /* ip_hdr is IPv4 header */
106#define LRO_TCP 2 /* tcpudp_hdr is TCP header */
107
108 /*
109 * get_frag_header: returns mac, tcp and ip header for packet in SKB
110 *
111 * @hdr_flags: Indicate what kind of LRO has to be done
112 * (IPv4/IPv6/TCP/UDP)
113 */
114 int (*get_frag_header)(struct skb_frag_struct *frag, void **mac_hdr,
115 void **ip_hdr, void **tcpudp_hdr, u64 *hdr_flags,
116 void *priv);
117};
118
119/*
120 * Processes a SKB
121 *
122 * @lro_mgr: LRO manager to use
123 * @skb: SKB to aggregate
124 * @priv: Private data that may be used by driver functions
125 * (for example get_tcp_ip_hdr)
126 */
127
128void lro_receive_skb(struct net_lro_mgr *lro_mgr,
129 struct sk_buff *skb,
130 void *priv);
131
132/*
133 * Processes a SKB with VLAN HW acceleration support
134 */
135
136void lro_vlan_hwaccel_receive_skb(struct net_lro_mgr *lro_mgr,
137 struct sk_buff *skb,
138 struct vlan_group *vgrp,
139 u16 vlan_tag,
140 void *priv);
141
142/*
143 * Processes a fragment list
144 *
145 * This functions aggregate fragments and generate SKBs do pass
146 * the packets to the stack.
147 *
148 * @lro_mgr: LRO manager to use
149 * @frags: Fragment to be processed. Must contain entire header in first
150 * element.
151 * @len: Length of received data
152 * @true_size: Actual size of memory the fragment is consuming
153 * @priv: Private data that may be used by driver functions
154 * (for example get_tcp_ip_hdr)
155 */
156
157void lro_receive_frags(struct net_lro_mgr *lro_mgr,
158 struct skb_frag_struct *frags,
159 int len, int true_size, void *priv, __wsum sum);
160
161void lro_vlan_hwaccel_receive_frags(struct net_lro_mgr *lro_mgr,
162 struct skb_frag_struct *frags,
163 int len, int true_size,
164 struct vlan_group *vgrp,
165 u16 vlan_tag,
166 void *priv, __wsum sum);
167
168/*
169 * Forward all aggregated SKBs held by lro_mgr to network stack
170 */
171
172void lro_flush_all(struct net_lro_mgr *lro_mgr);
173
174void lro_flush_pkt(struct net_lro_mgr *lro_mgr,
175 struct iphdr *iph, struct tcphdr *tcph);
176
177#endif
diff --git a/include/linux/init.h b/include/linux/init.h
index 5b5285316339..f8d9d0b5cffc 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -40,7 +40,7 @@
40 40
41/* These are for everybody (although not all archs will actually 41/* These are for everybody (although not all archs will actually
42 discard it in modules) */ 42 discard it in modules) */
43#define __init __attribute__ ((__section__ (".init.text"))) 43#define __init __attribute__ ((__section__ (".init.text"))) __cold
44#define __initdata __attribute__ ((__section__ (".init.data"))) 44#define __initdata __attribute__ ((__section__ (".init.data")))
45#define __exitdata __attribute__ ((__section__(".exit.data"))) 45#define __exitdata __attribute__ ((__section__(".exit.data")))
46#define __exit_call __attribute_used__ __attribute__ ((__section__ (".exitcall.exit"))) 46#define __exit_call __attribute_used__ __attribute__ ((__section__ (".exitcall.exit")))
@@ -57,11 +57,12 @@
57 * The markers follow same syntax rules as __init / __initdata. */ 57 * The markers follow same syntax rules as __init / __initdata. */
58#define __init_refok noinline __attribute__ ((__section__ (".text.init.refok"))) 58#define __init_refok noinline __attribute__ ((__section__ (".text.init.refok")))
59#define __initdata_refok __attribute__ ((__section__ (".data.init.refok"))) 59#define __initdata_refok __attribute__ ((__section__ (".data.init.refok")))
60#define __exit_refok noinline __attribute__ ((__section__ (".exit.text.refok")))
60 61
61#ifdef MODULE 62#ifdef MODULE
62#define __exit __attribute__ ((__section__(".exit.text"))) 63#define __exit __attribute__ ((__section__(".exit.text"))) __cold
63#else 64#else
64#define __exit __attribute_used__ __attribute__ ((__section__(".exit.text"))) 65#define __exit __attribute_used__ __attribute__ ((__section__(".exit.text"))) __cold
65#endif 66#endif
66 67
67/* For assembly routines */ 68/* For assembly routines */
@@ -114,7 +115,7 @@ void prepare_namespace(void);
114 * 115 *
115 * This only exists for built-in code, not for modules. 116 * This only exists for built-in code, not for modules.
116 */ 117 */
117#define pure_initcall(fn) __define_initcall("0",fn,1) 118#define pure_initcall(fn) __define_initcall("0",fn,0)
118 119
119#define core_initcall(fn) __define_initcall("1",fn,1) 120#define core_initcall(fn) __define_initcall("1",fn,1)
120#define core_initcall_sync(fn) __define_initcall("1s",fn,1s) 121#define core_initcall_sync(fn) __define_initcall("1s",fn,1s)
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index cab741c2d603..513bc3e489f0 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -9,6 +9,7 @@
9#include <linux/ipc.h> 9#include <linux/ipc.h>
10#include <linux/pid_namespace.h> 10#include <linux/pid_namespace.h>
11#include <linux/user_namespace.h> 11#include <linux/user_namespace.h>
12#include <net/net_namespace.h>
12 13
13#define INIT_FDTABLE \ 14#define INIT_FDTABLE \
14{ \ 15{ \
@@ -78,6 +79,7 @@ extern struct nsproxy init_nsproxy;
78 .nslock = __SPIN_LOCK_UNLOCKED(nsproxy.nslock), \ 79 .nslock = __SPIN_LOCK_UNLOCKED(nsproxy.nslock), \
79 .uts_ns = &init_uts_ns, \ 80 .uts_ns = &init_uts_ns, \
80 .mnt_ns = NULL, \ 81 .mnt_ns = NULL, \
82 INIT_NET_NS(net_ns) \
81 INIT_IPC_NS(ipc_ns) \ 83 INIT_IPC_NS(ipc_ns) \
82 .user_ns = &init_user_ns, \ 84 .user_ns = &init_user_ns, \
83} 85}
@@ -86,7 +88,7 @@ extern struct nsproxy init_nsproxy;
86 .count = ATOMIC_INIT(1), \ 88 .count = ATOMIC_INIT(1), \
87 .action = { { { .sa_handler = NULL, } }, }, \ 89 .action = { { { .sa_handler = NULL, } }, }, \
88 .siglock = __SPIN_LOCK_UNLOCKED(sighand.siglock), \ 90 .siglock = __SPIN_LOCK_UNLOCKED(sighand.siglock), \
89 .signalfd_list = LIST_HEAD_INIT(sighand.signalfd_list), \ 91 .signalfd_wqh = __WAIT_QUEUE_HEAD_INITIALIZER(sighand.signalfd_wqh), \
90} 92}
91 93
92extern struct group_info init_groups; 94extern struct group_info init_groups;
diff --git a/include/linux/input.h b/include/linux/input.h
index d09e5e8be325..125e925320fd 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -360,9 +360,16 @@ struct input_absinfo {
360 360
361#define KEY_BLUETOOTH 237 361#define KEY_BLUETOOTH 237
362#define KEY_WLAN 238 362#define KEY_WLAN 238
363#define KEY_UWB 239
363 364
364#define KEY_UNKNOWN 240 365#define KEY_UNKNOWN 240
365 366
367#define KEY_VIDEO_NEXT 241 /* drive next video source */
368#define KEY_VIDEO_PREV 242 /* drive previous video source */
369#define KEY_BRIGHTNESS_CYCLE 243 /* brightness up, after max is min */
370#define KEY_BRIGHTNESS_ZERO 244 /* brightness off, use ambient */
371#define KEY_DISPLAY_OFF 245 /* display device to off state */
372
366#define BTN_MISC 0x100 373#define BTN_MISC 0x100
367#define BTN_0 0x100 374#define BTN_0 0x100
368#define BTN_1 0x101 375#define BTN_1 0x101
@@ -552,6 +559,8 @@ struct input_absinfo {
552#define KEY_BRL_DOT6 0x1f6 559#define KEY_BRL_DOT6 0x1f6
553#define KEY_BRL_DOT7 0x1f7 560#define KEY_BRL_DOT7 0x1f7
554#define KEY_BRL_DOT8 0x1f8 561#define KEY_BRL_DOT8 0x1f8
562#define KEY_BRL_DOT9 0x1f9
563#define KEY_BRL_DOT10 0x1fa
555 564
556/* We avoid low common keys in module aliases so they don't get huge. */ 565/* We avoid low common keys in module aliases so they don't get huge. */
557#define KEY_MIN_INTERESTING KEY_MUTE 566#define KEY_MIN_INTERESTING KEY_MUTE
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 5323f6275854..5523f19d88d2 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -11,8 +11,6 @@
11#include <linux/hardirq.h> 11#include <linux/hardirq.h>
12#include <linux/sched.h> 12#include <linux/sched.h>
13#include <linux/irqflags.h> 13#include <linux/irqflags.h>
14#include <linux/bottom_half.h>
15#include <linux/device.h>
16#include <asm/atomic.h> 14#include <asm/atomic.h>
17#include <asm/ptrace.h> 15#include <asm/ptrace.h>
18#include <asm/system.h> 16#include <asm/system.h>
@@ -97,6 +95,8 @@ extern int __must_check request_irq(unsigned int, irq_handler_t handler,
97 unsigned long, const char *, void *); 95 unsigned long, const char *, void *);
98extern void free_irq(unsigned int, void *); 96extern void free_irq(unsigned int, void *);
99 97
98struct device;
99
100extern int __must_check devm_request_irq(struct device *dev, unsigned int irq, 100extern int __must_check devm_request_irq(struct device *dev, unsigned int irq,
101 irq_handler_t handler, unsigned long irqflags, 101 irq_handler_t handler, unsigned long irqflags,
102 const char *devname, void *dev_id); 102 const char *devname, void *dev_id);
@@ -120,11 +120,11 @@ extern void devm_free_irq(struct device *dev, unsigned int irq, void *dev_id);
120# define local_irq_enable_in_hardirq() local_irq_enable() 120# define local_irq_enable_in_hardirq() local_irq_enable()
121#endif 121#endif
122 122
123#ifdef CONFIG_GENERIC_HARDIRQS
124extern void disable_irq_nosync(unsigned int irq); 123extern void disable_irq_nosync(unsigned int irq);
125extern void disable_irq(unsigned int irq); 124extern void disable_irq(unsigned int irq);
126extern void enable_irq(unsigned int irq); 125extern void enable_irq(unsigned int irq);
127 126
127#ifdef CONFIG_GENERIC_HARDIRQS
128/* 128/*
129 * Special lockdep variants of irq disabling/enabling. 129 * Special lockdep variants of irq disabling/enabling.
130 * These should be used for locking constructs that 130 * These should be used for locking constructs that
diff --git a/include/linux/ioprio.h b/include/linux/ioprio.h
index 2eaa142cd061..baf29387cab4 100644
--- a/include/linux/ioprio.h
+++ b/include/linux/ioprio.h
@@ -53,6 +53,14 @@ static inline int task_ioprio(struct task_struct *task)
53 return IOPRIO_NORM; 53 return IOPRIO_NORM;
54} 54}
55 55
56static inline int task_ioprio_class(struct task_struct *task)
57{
58 if (ioprio_valid(task->ioprio))
59 return IOPRIO_PRIO_CLASS(task->ioprio);
60
61 return IOPRIO_CLASS_BE;
62}
63
56static inline int task_nice_ioprio(struct task_struct *task) 64static inline int task_nice_ioprio(struct task_struct *task)
57{ 65{
58 return (task_nice(task) + 20) / 5; 66 return (task_nice(task) + 20) / 5;
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 97983dc9df13..5d35a4cc3bff 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -96,27 +96,6 @@ struct ipv6_destopt_hao {
96 struct in6_addr addr; 96 struct in6_addr addr;
97} __attribute__ ((__packed__)); 97} __attribute__ ((__packed__));
98 98
99struct ipv6_auth_hdr {
100 __u8 nexthdr;
101 __u8 hdrlen; /* This one is measured in 32 bit units! */
102 __be16 reserved;
103 __be32 spi;
104 __be32 seq_no; /* Sequence number */
105 __u8 auth_data[0]; /* Length variable but >=4. Mind the 64 bit alignment! */
106};
107
108struct ipv6_esp_hdr {
109 __be32 spi;
110 __be32 seq_no; /* Sequence number */
111 __u8 enc_data[0]; /* Length variable but >=8. Mind the 64 bit alignment! */
112};
113
114struct ipv6_comp_hdr {
115 __u8 nexthdr;
116 __u8 flags;
117 __be16 cpi;
118};
119
120/* 99/*
121 * IPv6 fixed header 100 * IPv6 fixed header
122 * 101 *
@@ -219,7 +198,6 @@ enum {
219#include <linux/tcp.h> 198#include <linux/tcp.h>
220#include <linux/udp.h> 199#include <linux/udp.h>
221 200
222#include <net/if_inet6.h> /* struct ipv6_mc_socklist */
223#include <net/inet_sock.h> 201#include <net/inet_sock.h>
224 202
225static inline struct ipv6hdr *ipv6_hdr(const struct sk_buff *skb) 203static inline struct ipv6hdr *ipv6_hdr(const struct sk_buff *skb)
@@ -273,6 +251,10 @@ struct tcp6_request_sock {
273 struct inet6_request_sock tcp6rsk_inet6; 251 struct inet6_request_sock tcp6rsk_inet6;
274}; 252};
275 253
254struct ipv6_mc_socklist;
255struct ipv6_ac_socklist;
256struct ipv6_fl_socklist;
257
276/** 258/**
277 * struct ipv6_pinfo - ipv6 private area 259 * struct ipv6_pinfo - ipv6 private area
278 * 260 *
diff --git a/include/linux/irda.h b/include/linux/irda.h
index 8e3735714c1c..28f88ecba344 100644
--- a/include/linux/irda.h
+++ b/include/linux/irda.h
@@ -77,6 +77,7 @@ typedef enum {
77 IRDA_ACT200L_DONGLE = 10, 77 IRDA_ACT200L_DONGLE = 10,
78 IRDA_MA600_DONGLE = 11, 78 IRDA_MA600_DONGLE = 11,
79 IRDA_TOIM3232_DONGLE = 12, 79 IRDA_TOIM3232_DONGLE = 12,
80 IRDA_EP7211_DONGLE = 13,
80} IRDA_DONGLE; 81} IRDA_DONGLE;
81 82
82/* Protocol types to be used for SOCK_DGRAM */ 83/* Protocol types to be used for SOCK_DGRAM */
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 44657197fcb0..efc88538b2ba 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -140,6 +140,7 @@ struct irq_chip {
140 * @wake_depth: enable depth, for multiple set_irq_wake() callers 140 * @wake_depth: enable depth, for multiple set_irq_wake() callers
141 * @irq_count: stats field to detect stalled irqs 141 * @irq_count: stats field to detect stalled irqs
142 * @irqs_unhandled: stats field for spurious unhandled interrupts 142 * @irqs_unhandled: stats field for spurious unhandled interrupts
143 * @last_unhandled: aging timer for unhandled count
143 * @lock: locking for SMP 144 * @lock: locking for SMP
144 * @affinity: IRQ affinity on SMP 145 * @affinity: IRQ affinity on SMP
145 * @cpu: cpu index useful for balancing 146 * @cpu: cpu index useful for balancing
diff --git a/include/linux/isa.h b/include/linux/isa.h
index 1b855335cb11..b0270e3814c8 100644
--- a/include/linux/isa.h
+++ b/include/linux/isa.h
@@ -22,7 +22,18 @@ struct isa_driver {
22 22
23#define to_isa_driver(x) container_of((x), struct isa_driver, driver) 23#define to_isa_driver(x) container_of((x), struct isa_driver, driver)
24 24
25#ifdef CONFIG_ISA
25int isa_register_driver(struct isa_driver *, unsigned int); 26int isa_register_driver(struct isa_driver *, unsigned int);
26void isa_unregister_driver(struct isa_driver *); 27void isa_unregister_driver(struct isa_driver *);
28#else
29static inline int isa_register_driver(struct isa_driver *d, unsigned int i)
30{
31 return 0;
32}
33
34static inline void isa_unregister_driver(struct isa_driver *d)
35{
36}
37#endif
27 38
28#endif /* __LINUX_ISA_H */ 39#endif /* __LINUX_ISA_H */
diff --git a/include/linux/isdn.h b/include/linux/isdn.h
index 3c7875b7ab5b..ad09506554a3 100644
--- a/include/linux/isdn.h
+++ b/include/linux/isdn.h
@@ -353,13 +353,6 @@ typedef struct isdn_net_local_s {
353 /* a particular channel (including */ 353 /* a particular channel (including */
354 /* the frame_cnt */ 354 /* the frame_cnt */
355 355
356 int (*org_hhc)(
357 struct neighbour *neigh,
358 struct hh_cache *hh);
359 /* Ptr to orig. header_cache_update */
360 void (*org_hcu)(struct hh_cache *,
361 struct net_device *,
362 unsigned char *);
363 int pppbind; /* ippp device for bindings */ 356 int pppbind; /* ippp device for bindings */
364 int dialtimeout; /* How long shall we try on dialing? (jiffies) */ 357 int dialtimeout; /* How long shall we try on dialing? (jiffies) */
365 int dialwait; /* How long shall we wait after failed attempt? (jiffies) */ 358 int dialwait; /* How long shall we wait after failed attempt? (jiffies) */
@@ -389,7 +382,7 @@ typedef struct isdn_net_dev_s {
389 online */ 382 online */
390 spinlock_t queue_lock; /* lock to protect queue */ 383 spinlock_t queue_lock; /* lock to protect queue */
391 void *next; /* Pointer to next isdn-interface */ 384 void *next; /* Pointer to next isdn-interface */
392 struct net_device dev; /* interface to upper levels */ 385 struct net_device *dev; /* interface to upper levels */
393#ifdef CONFIG_ISDN_PPP 386#ifdef CONFIG_ISDN_PPP
394 ippp_bundle * pb; /* pointer to the common bundle structure 387 ippp_bundle * pb; /* pointer to the common bundle structure
395 * with the per-bundle data */ 388 * with the per-bundle data */
diff --git a/include/linux/ivtv.h b/include/linux/ivtv.h
new file mode 100644
index 000000000000..794b8daa9378
--- /dev/null
+++ b/include/linux/ivtv.h
@@ -0,0 +1,72 @@
1/*
2 Public ivtv API header
3 Copyright (C) 2003-2004 Kevin Thayer <nufan_wfk at yahoo.com>
4 Copyright (C) 2004-2007 Hans Verkuil <hverkuil@xs4all.nl>
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#ifndef __LINUX_IVTV_H__
22#define __LINUX_IVTV_H__
23
24#ifdef __KERNEL__
25#include <linux/compiler.h> /* need __user */
26#else
27#define __user
28#endif
29#include <linux/types.h>
30
31/* ivtv knows several distinct output modes: MPEG streaming,
32 YUV streaming, YUV updates through user DMA and the passthrough
33 mode.
34
35 In order to clearly tell the driver that we are in user DMA
36 YUV mode you need to call IVTV_IOC_DMA_FRAME with y_source == NULL
37 first (althrough if you don't then the first time
38 DMA_FRAME is called the mode switch is done automatically).
39
40 When you close the file handle the user DMA mode is exited again.
41
42 While in one mode, you cannot use another mode (EBUSY is returned).
43
44 All this means that if you want to change the YUV interlacing
45 for the user DMA YUV mode you first need to do call IVTV_IOC_DMA_FRAME
46 with y_source == NULL before you can set the correct format using
47 VIDIOC_S_FMT.
48
49 Eventually all this should be replaced with a proper V4L2 API,
50 but for now we have to do it this way. */
51
52struct ivtv_dma_frame {
53 enum v4l2_buf_type type; /* V4L2_BUF_TYPE_VIDEO_OUTPUT */
54 __u32 pixelformat; /* 0 == same as destination */
55 void __user *y_source; /* if NULL and type == V4L2_BUF_TYPE_VIDEO_OUTPUT,
56 then just switch to user DMA YUV output mode */
57 void __user *uv_source; /* Unused for RGB pixelformats */
58 struct v4l2_rect src;
59 struct v4l2_rect dst;
60 __u32 src_width;
61 __u32 src_height;
62};
63
64#define IVTV_IOC_DMA_FRAME _IOW ('V', BASE_VIDIOC_PRIVATE+0, struct ivtv_dma_frame)
65
66/* These are the VBI types as they appear in the embedded VBI private packets. */
67#define IVTV_SLICED_TYPE_TELETEXT_B (1)
68#define IVTV_SLICED_TYPE_CAPTION_525 (4)
69#define IVTV_SLICED_TYPE_WSS_625 (5)
70#define IVTV_SLICED_TYPE_VPS (7)
71
72#endif /* _LINUX_IVTV_H */
diff --git a/include/linux/ivtvfb.h b/include/linux/ivtvfb.h
new file mode 100644
index 000000000000..e980ba62ddcc
--- /dev/null
+++ b/include/linux/ivtvfb.h
@@ -0,0 +1,42 @@
1/*
2 On Screen Display cx23415 Framebuffer driver
3
4 Copyright (C) 2006, 2007 Ian Armstrong <ian@iarmst.demon.co.uk>
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#ifndef __LINUX_IVTVFB_H__
22#define __LINUX_IVTVFB_H__
23
24#ifdef __KERNEL__
25#include <linux/compiler.h> /* need __user */
26#else
27#define __user
28#endif
29#include <linux/types.h>
30
31/* Framebuffer external API */
32
33struct ivtvfb_dma_frame {
34 void __user *source;
35 unsigned long dest_offset;
36 int count;
37};
38
39#define IVTVFB_IOC_DMA_FRAME _IOW('V', BASE_VIDIOC_PRIVATE+0, struct ivtvfb_dma_frame)
40#define FBIO_WAITFORVSYNC _IOW('F', 0x20, u_int32_t)
41
42#endif
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 0e0fedd2039a..260d6d76c5f3 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -50,14 +50,14 @@
50 */ 50 */
51#define JBD_DEFAULT_MAX_COMMIT_AGE 5 51#define JBD_DEFAULT_MAX_COMMIT_AGE 5
52 52
53#ifdef CONFIG_JBD_DEBUG 53#ifdef CONFIG_JBD2_DEBUG
54/* 54/*
55 * Define JBD_EXPENSIVE_CHECKING to enable more expensive internal 55 * Define JBD_EXPENSIVE_CHECKING to enable more expensive internal
56 * consistency checks. By default we don't do this unless 56 * consistency checks. By default we don't do this unless
57 * CONFIG_JBD_DEBUG is on. 57 * CONFIG_JBD2_DEBUG is on.
58 */ 58 */
59#define JBD_EXPENSIVE_CHECKING 59#define JBD_EXPENSIVE_CHECKING
60extern int jbd2_journal_enable_debug; 60extern u8 jbd2_journal_enable_debug;
61 61
62#define jbd_debug(n, f, a...) \ 62#define jbd_debug(n, f, a...) \
63 do { \ 63 do { \
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index c080f61fb024..d7a5e034c3a2 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -36,8 +36,6 @@
36/* LATCH is used in the interval timer and ftape setup. */ 36/* LATCH is used in the interval timer and ftape setup. */
37#define LATCH ((CLOCK_TICK_RATE + HZ/2) / HZ) /* For divider */ 37#define LATCH ((CLOCK_TICK_RATE + HZ/2) / HZ) /* For divider */
38 38
39#define LATCH_HPET ((HPET_TICK_RATE + HZ/2) / HZ)
40
41/* Suppose we want to devide two numbers NOM and DEN: NOM/DEN, the we can 39/* Suppose we want to devide two numbers NOM and DEN: NOM/DEN, the we can
42 * improve accuracy by shifting LSH bits, hence calculating: 40 * improve accuracy by shifting LSH bits, hence calculating:
43 * (NOM << LSH) / DEN 41 * (NOM << LSH) / DEN
@@ -53,13 +51,9 @@
53/* HZ is the requested value. ACTHZ is actual HZ ("<< 8" is for accuracy) */ 51/* HZ is the requested value. ACTHZ is actual HZ ("<< 8" is for accuracy) */
54#define ACTHZ (SH_DIV (CLOCK_TICK_RATE, LATCH, 8)) 52#define ACTHZ (SH_DIV (CLOCK_TICK_RATE, LATCH, 8))
55 53
56#define ACTHZ_HPET (SH_DIV (HPET_TICK_RATE, LATCH_HPET, 8))
57
58/* TICK_NSEC is the time between ticks in nsec assuming real ACTHZ */ 54/* TICK_NSEC is the time between ticks in nsec assuming real ACTHZ */
59#define TICK_NSEC (SH_DIV (1000000UL * 1000, ACTHZ, 8)) 55#define TICK_NSEC (SH_DIV (1000000UL * 1000, ACTHZ, 8))
60 56
61#define TICK_NSEC_HPET (SH_DIV(1000000UL * 1000, ACTHZ_HPET, 8))
62
63/* TICK_USEC is the time between ticks in usec assuming fake USER_HZ */ 57/* TICK_USEC is the time between ticks in usec assuming fake USER_HZ */
64#define TICK_USEC ((1000000UL + USER_HZ/2) / USER_HZ) 58#define TICK_USEC ((1000000UL + USER_HZ/2) / USER_HZ)
65 59
diff --git a/include/linux/kbd_kern.h b/include/linux/kbd_kern.h
index 506ad20c18f8..8bdb16bfe5fb 100644
--- a/include/linux/kbd_kern.h
+++ b/include/linux/kbd_kern.h
@@ -161,4 +161,7 @@ static inline void con_schedule_flip(struct tty_struct *t)
161 schedule_delayed_work(&t->buf.work, 0); 161 schedule_delayed_work(&t->buf.work, 0);
162} 162}
163 163
164/* mac_hid.c */
165extern int mac_hid_mouse_emulate_buttons(int, unsigned int, int);
166
164#endif 167#endif
diff --git a/include/linux/kdebug.h b/include/linux/kdebug.h
index 5db38d6d8b92..ed815090b3bc 100644
--- a/include/linux/kdebug.h
+++ b/include/linux/kdebug.h
@@ -3,6 +3,8 @@
3 3
4#include <asm/kdebug.h> 4#include <asm/kdebug.h>
5 5
6struct notifier_block;
7
6struct die_args { 8struct die_args {
7 struct pt_regs *regs; 9 struct pt_regs *regs;
8 const char *str; 10 const char *str;
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 1eb9cde550c4..d9725a28a265 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -34,6 +34,7 @@ extern const char linux_proc_banner[];
34 34
35#define ALIGN(x,a) __ALIGN_MASK(x,(typeof(x))(a)-1) 35#define ALIGN(x,a) __ALIGN_MASK(x,(typeof(x))(a)-1)
36#define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask)) 36#define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask))
37#define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a)))
37 38
38#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) 39#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
39 40
@@ -41,6 +42,20 @@ extern const char linux_proc_banner[];
41#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) 42#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
42#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) 43#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
43 44
45#ifdef CONFIG_LBD
46# include <asm/div64.h>
47# define sector_div(a, b) do_div(a, b)
48#else
49# define sector_div(n, b)( \
50{ \
51 int _res; \
52 _res = (n) % (b); \
53 (n) /= (b); \
54 _res; \
55} \
56)
57#endif
58
44/** 59/**
45 * upper_32_bits - return bits 32-63 of a number 60 * upper_32_bits - return bits 32-63 of a number
46 * @n: the number we're accessing 61 * @n: the number we're accessing
@@ -106,7 +121,7 @@ extern int cond_resched(void);
106extern struct atomic_notifier_head panic_notifier_list; 121extern struct atomic_notifier_head panic_notifier_list;
107extern long (*panic_blink)(long time); 122extern long (*panic_blink)(long time);
108NORET_TYPE void panic(const char * fmt, ...) 123NORET_TYPE void panic(const char * fmt, ...)
109 __attribute__ ((NORET_AND format (printf, 1, 2))); 124 __attribute__ ((NORET_AND format (printf, 1, 2))) __cold;
110extern void oops_enter(void); 125extern void oops_enter(void);
111extern void oops_exit(void); 126extern void oops_exit(void);
112extern int oops_may_print(void); 127extern int oops_may_print(void);
@@ -155,14 +170,14 @@ extern void dump_thread(struct pt_regs *regs, struct user *dump);
155asmlinkage int vprintk(const char *fmt, va_list args) 170asmlinkage int vprintk(const char *fmt, va_list args)
156 __attribute__ ((format (printf, 1, 0))); 171 __attribute__ ((format (printf, 1, 0)));
157asmlinkage int printk(const char * fmt, ...) 172asmlinkage int printk(const char * fmt, ...)
158 __attribute__ ((format (printf, 1, 2))); 173 __attribute__ ((format (printf, 1, 2))) __cold;
159#else 174#else
160static inline int vprintk(const char *s, va_list args) 175static inline int vprintk(const char *s, va_list args)
161 __attribute__ ((format (printf, 1, 0))); 176 __attribute__ ((format (printf, 1, 0)));
162static inline int vprintk(const char *s, va_list args) { return 0; } 177static inline int vprintk(const char *s, va_list args) { return 0; }
163static inline int printk(const char *s, ...) 178static inline int printk(const char *s, ...)
164 __attribute__ ((format (printf, 1, 2))); 179 __attribute__ ((format (printf, 1, 2)));
165static inline int printk(const char *s, ...) { return 0; } 180static inline int __cold printk(const char *s, ...) { return 0; }
166#endif 181#endif
167 182
168unsigned long int_sqrt(unsigned long); 183unsigned long int_sqrt(unsigned long);
@@ -212,7 +227,7 @@ extern enum system_states {
212#define TAINT_USER (1<<6) 227#define TAINT_USER (1<<6)
213#define TAINT_DIE (1<<7) 228#define TAINT_DIE (1<<7)
214 229
215extern void dump_stack(void); 230extern void dump_stack(void) __cold;
216 231
217enum { 232enum {
218 DUMP_PREFIX_NONE, 233 DUMP_PREFIX_NONE,
@@ -224,9 +239,9 @@ extern void hex_dump_to_buffer(const void *buf, size_t len,
224 char *linebuf, size_t linebuflen, bool ascii); 239 char *linebuf, size_t linebuflen, bool ascii);
225extern void print_hex_dump(const char *level, const char *prefix_str, 240extern void print_hex_dump(const char *level, const char *prefix_str,
226 int prefix_type, int rowsize, int groupsize, 241 int prefix_type, int rowsize, int groupsize,
227 void *buf, size_t len, bool ascii); 242 const void *buf, size_t len, bool ascii);
228extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type, 243extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type,
229 void *buf, size_t len); 244 const void *buf, size_t len);
230#define hex_asc(x) "0123456789abcdef"[x] 245#define hex_asc(x) "0123456789abcdef"[x]
231 246
232#ifdef DEBUG 247#ifdef DEBUG
diff --git a/include/linux/keyboard.h b/include/linux/keyboard.h
index f892b272f3ff..33b5c2e325b9 100644
--- a/include/linux/keyboard.h
+++ b/include/linux/keyboard.h
@@ -439,8 +439,10 @@ extern unsigned short plain_map[NR_KEYS];
439#define K_BRL_DOT6 K(KT_BRL, 6) 439#define K_BRL_DOT6 K(KT_BRL, 6)
440#define K_BRL_DOT7 K(KT_BRL, 7) 440#define K_BRL_DOT7 K(KT_BRL, 7)
441#define K_BRL_DOT8 K(KT_BRL, 8) 441#define K_BRL_DOT8 K(KT_BRL, 8)
442#define K_BRL_DOT9 K(KT_BRL, 9)
443#define K_BRL_DOT10 K(KT_BRL, 10)
442 444
443#define NR_BRL 9 445#define NR_BRL 11
444 446
445#define MAX_DIACR 256 447#define MAX_DIACR 256
446#endif 448#endif
diff --git a/include/linux/kmod.h b/include/linux/kmod.h
index 10f505c8431d..5dc13848891b 100644
--- a/include/linux/kmod.h
+++ b/include/linux/kmod.h
@@ -36,13 +36,57 @@ static inline int request_module(const char * name, ...) { return -ENOSYS; }
36#define try_then_request_module(x, mod...) ((x) ?: (request_module(mod), (x))) 36#define try_then_request_module(x, mod...) ((x) ?: (request_module(mod), (x)))
37 37
38struct key; 38struct key;
39extern int call_usermodehelper_keys(char *path, char *argv[], char *envp[], 39struct file;
40 struct key *session_keyring, int wait); 40struct subprocess_info;
41
42/* Allocate a subprocess_info structure */
43struct subprocess_info *call_usermodehelper_setup(char *path,
44 char **argv, char **envp);
45
46/* Set various pieces of state into the subprocess_info structure */
47void call_usermodehelper_setkeys(struct subprocess_info *info,
48 struct key *session_keyring);
49int call_usermodehelper_stdinpipe(struct subprocess_info *sub_info,
50 struct file **filp);
51void call_usermodehelper_setcleanup(struct subprocess_info *info,
52 void (*cleanup)(char **argv, char **envp));
53
54enum umh_wait {
55 UMH_NO_WAIT = -1, /* don't wait at all */
56 UMH_WAIT_EXEC = 0, /* wait for the exec, but not the process */
57 UMH_WAIT_PROC = 1, /* wait for the process to complete */
58};
59
60/* Actually execute the sub-process */
61int call_usermodehelper_exec(struct subprocess_info *info, enum umh_wait wait);
62
63/* Free the subprocess_info. This is only needed if you're not going
64 to call call_usermodehelper_exec */
65void call_usermodehelper_freeinfo(struct subprocess_info *info);
41 66
42static inline int 67static inline int
43call_usermodehelper(char *path, char **argv, char **envp, int wait) 68call_usermodehelper(char *path, char **argv, char **envp, enum umh_wait wait)
44{ 69{
45 return call_usermodehelper_keys(path, argv, envp, NULL, wait); 70 struct subprocess_info *info;
71
72 info = call_usermodehelper_setup(path, argv, envp);
73 if (info == NULL)
74 return -ENOMEM;
75 return call_usermodehelper_exec(info, wait);
76}
77
78static inline int
79call_usermodehelper_keys(char *path, char **argv, char **envp,
80 struct key *session_keyring, enum umh_wait wait)
81{
82 struct subprocess_info *info;
83
84 info = call_usermodehelper_setup(path, argv, envp);
85 if (info == NULL)
86 return -ENOMEM;
87
88 call_usermodehelper_setkeys(info, session_keyring);
89 return call_usermodehelper_exec(info, wait);
46} 90}
47 91
48extern void usermodehelper_init(void); 92extern void usermodehelper_init(void);
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index 06cbf41d32d2..4a0d27f475d7 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -1,8 +1,10 @@
1/* 1/*
2 * kobject.h - generic kernel object infrastructure. 2 * kobject.h - generic kernel object infrastructure.
3 * 3 *
4 * Copyright (c) 2002-2003 Patrick Mochel 4 * Copyright (c) 2002-2003 Patrick Mochel
5 * Copyright (c) 2002-2003 Open Source Development Labs 5 * Copyright (c) 2002-2003 Open Source Development Labs
6 * Copyright (c) 2006-2007 Greg Kroah-Hartman <greg@kroah.com>
7 * Copyright (c) 2006-2007 Novell Inc.
6 * 8 *
7 * This file is released under the GPLv2. 9 * This file is released under the GPLv2.
8 * 10 *
@@ -29,6 +31,8 @@
29 31
30#define KOBJ_NAME_LEN 20 32#define KOBJ_NAME_LEN 20
31#define UEVENT_HELPER_PATH_LEN 256 33#define UEVENT_HELPER_PATH_LEN 256
34#define UEVENT_NUM_ENVP 32 /* number of env pointers */
35#define UEVENT_BUFFER_SIZE 2048 /* buffer for the variables */
32 36
33/* path to the userspace helper executed on an event */ 37/* path to the userspace helper executed on an event */
34extern char uevent_helper[]; 38extern char uevent_helper[];
@@ -36,27 +40,34 @@ extern char uevent_helper[];
36/* counter to tag the uevent, read only except for the kobject core */ 40/* counter to tag the uevent, read only except for the kobject core */
37extern u64 uevent_seqnum; 41extern u64 uevent_seqnum;
38 42
39/* the actions here must match the proper string in lib/kobject_uevent.c */ 43/*
40typedef int __bitwise kobject_action_t; 44 * The actions here must match the index to the string array
45 * in lib/kobject_uevent.c
46 *
47 * Do not add new actions here without checking with the driver-core
48 * maintainers. Action strings are not meant to express subsystem
49 * or device specific properties. In most cases you want to send a
50 * kobject_uevent_env(kobj, KOBJ_CHANGE, env) with additional event
51 * specific variables added to the event environment.
52 */
41enum kobject_action { 53enum kobject_action {
42 KOBJ_ADD = (__force kobject_action_t) 0x01, /* exclusive to core */ 54 KOBJ_ADD,
43 KOBJ_REMOVE = (__force kobject_action_t) 0x02, /* exclusive to core */ 55 KOBJ_REMOVE,
44 KOBJ_CHANGE = (__force kobject_action_t) 0x03, /* device state change */ 56 KOBJ_CHANGE,
45 KOBJ_OFFLINE = (__force kobject_action_t) 0x04, /* device offline */ 57 KOBJ_MOVE,
46 KOBJ_ONLINE = (__force kobject_action_t) 0x05, /* device online */ 58 KOBJ_ONLINE,
47 KOBJ_MOVE = (__force kobject_action_t) 0x06, /* device move */ 59 KOBJ_OFFLINE,
60 KOBJ_MAX
48}; 61};
49 62
50struct kobject { 63struct kobject {
51 const char * k_name; 64 const char * k_name;
52 char name[KOBJ_NAME_LEN];
53 struct kref kref; 65 struct kref kref;
54 struct list_head entry; 66 struct list_head entry;
55 struct kobject * parent; 67 struct kobject * parent;
56 struct kset * kset; 68 struct kset * kset;
57 struct kobj_type * ktype; 69 struct kobj_type * ktype;
58 struct sysfs_dirent * sd; 70 struct sysfs_dirent * sd;
59 wait_queue_head_t poll;
60}; 71};
61 72
62extern int kobject_set_name(struct kobject *, const char *, ...) 73extern int kobject_set_name(struct kobject *, const char *, ...)
@@ -71,14 +82,9 @@ extern void kobject_init(struct kobject *);
71extern void kobject_cleanup(struct kobject *); 82extern void kobject_cleanup(struct kobject *);
72 83
73extern int __must_check kobject_add(struct kobject *); 84extern int __must_check kobject_add(struct kobject *);
74extern int __must_check kobject_shadow_add(struct kobject *kobj,
75 struct sysfs_dirent *shadow_parent);
76extern void kobject_del(struct kobject *); 85extern void kobject_del(struct kobject *);
77 86
78extern int __must_check kobject_rename(struct kobject *, const char *new_name); 87extern int __must_check kobject_rename(struct kobject *, const char *new_name);
79extern int __must_check kobject_shadow_rename(struct kobject *kobj,
80 struct sysfs_dirent *new_parent,
81 const char *new_name);
82extern int __must_check kobject_move(struct kobject *, struct kobject *); 88extern int __must_check kobject_move(struct kobject *, struct kobject *);
83 89
84extern int __must_check kobject_register(struct kobject *); 90extern int __must_check kobject_register(struct kobject *);
@@ -99,37 +105,44 @@ struct kobj_type {
99 struct attribute ** default_attrs; 105 struct attribute ** default_attrs;
100}; 106};
101 107
108struct kobj_uevent_env {
109 char *envp[UEVENT_NUM_ENVP];
110 int envp_idx;
111 char buf[UEVENT_BUFFER_SIZE];
112 int buflen;
113};
102 114
103/**
104 * kset - a set of kobjects of a specific type, belonging
105 * to a specific subsystem.
106 *
107 * All kobjects of a kset should be embedded in an identical
108 * type. This type may have a descriptor, which the kset points
109 * to. This allows there to exist sets of objects of the same
110 * type in different subsystems.
111 *
112 * A subsystem does not have to be a list of only one type
113 * of object; multiple ksets can belong to one subsystem. All
114 * ksets of a subsystem share the subsystem's lock.
115 *
116 * Each kset can support specific event variables; it can
117 * supress the event generation or add subsystem specific
118 * variables carried with the event.
119 */
120struct kset_uevent_ops { 115struct kset_uevent_ops {
121 int (*filter)(struct kset *kset, struct kobject *kobj); 116 int (*filter)(struct kset *kset, struct kobject *kobj);
122 const char *(*name)(struct kset *kset, struct kobject *kobj); 117 const char *(*name)(struct kset *kset, struct kobject *kobj);
123 int (*uevent)(struct kset *kset, struct kobject *kobj, char **envp, 118 int (*uevent)(struct kset *kset, struct kobject *kobj,
124 int num_envp, char *buffer, int buffer_size); 119 struct kobj_uevent_env *env);
125}; 120};
126 121
122/**
123 * struct kset - a set of kobjects of a specific type, belonging to a specific subsystem.
124 *
125 * A kset defines a group of kobjects. They can be individually
126 * different "types" but overall these kobjects all want to be grouped
127 * together and operated on in the same manner. ksets are used to
128 * define the attribute callbacks and other common events that happen to
129 * a kobject.
130 *
131 * @ktype: the struct kobj_type for this specific kset
132 * @list: the list of all kobjects for this kset
133 * @list_lock: a lock for iterating over the kobjects
134 * @kobj: the embedded kobject for this kset (recursion, isn't it fun...)
135 * @uevent_ops: the set of uevent operations for this kset. These are
136 * called whenever a kobject has something happen to it so that the kset
137 * can add new environment variables, or filter out the uevents if so
138 * desired.
139 */
127struct kset { 140struct kset {
128 struct kobj_type * ktype; 141 struct kobj_type *ktype;
129 struct list_head list; 142 struct list_head list;
130 spinlock_t list_lock; 143 spinlock_t list_lock;
131 struct kobject kobj; 144 struct kobject kobj;
132 struct kset_uevent_ops * uevent_ops; 145 struct kset_uevent_ops *uevent_ops;
133}; 146};
134 147
135 148
@@ -164,22 +177,22 @@ static inline struct kobj_type * get_ktype(struct kobject * k)
164extern struct kobject * kset_find_obj(struct kset *, const char *); 177extern struct kobject * kset_find_obj(struct kset *, const char *);
165 178
166 179
167/** 180/*
168 * Use this when initializing an embedded kset with no other 181 * Use this when initializing an embedded kset with no other
169 * fields to initialize. 182 * fields to initialize.
170 */ 183 */
171#define set_kset_name(str) .kset = { .kobj = { .name = str } } 184#define set_kset_name(str) .kset = { .kobj = { .k_name = str } }
172 185
173 186
174#define decl_subsys(_name,_type,_uevent_ops) \ 187#define decl_subsys(_name,_type,_uevent_ops) \
175struct kset _name##_subsys = { \ 188struct kset _name##_subsys = { \
176 .kobj = { .name = __stringify(_name) }, \ 189 .kobj = { .k_name = __stringify(_name) }, \
177 .ktype = _type, \ 190 .ktype = _type, \
178 .uevent_ops =_uevent_ops, \ 191 .uevent_ops =_uevent_ops, \
179} 192}
180#define decl_subsys_name(_varname,_name,_type,_uevent_ops) \ 193#define decl_subsys_name(_varname,_name,_type,_uevent_ops) \
181struct kset _varname##_subsys = { \ 194struct kset _varname##_subsys = { \
182 .kobj = { .name = __stringify(_name) }, \ 195 .kobj = { .k_name = __stringify(_name) }, \
183 .ktype = _type, \ 196 .ktype = _type, \
184 .uevent_ops =_uevent_ops, \ 197 .uevent_ops =_uevent_ops, \
185} 198}
@@ -189,7 +202,7 @@ extern struct kset kernel_subsys;
189/* The global /sys/hypervisor/ subsystem */ 202/* The global /sys/hypervisor/ subsystem */
190extern struct kset hypervisor_subsys; 203extern struct kset hypervisor_subsys;
191 204
192/** 205/*
193 * Helpers for setting the kset of registered objects. 206 * Helpers for setting the kset of registered objects.
194 * Often, a registered object belongs to a kset embedded in a 207 * Often, a registered object belongs to a kset embedded in a
195 * subsystem. These do no magic, just make the resulting code 208 * subsystem. These do no magic, just make the resulting code
@@ -207,49 +220,9 @@ extern struct kset hypervisor_subsys;
207#define kobj_set_kset_s(obj,subsys) \ 220#define kobj_set_kset_s(obj,subsys) \
208 (obj)->kobj.kset = &(subsys) 221 (obj)->kobj.kset = &(subsys)
209 222
210/**
211 * kset_set_kset_s(obj,subsys) - set kset for embedded kset.
212 * @obj: ptr to some object type.
213 * @subsys: a subsystem object (not a ptr).
214 *
215 * Can be used for any object type with an embedded ->kset.
216 * Sets the kset of @obj's embedded kobject (via its embedded
217 * kset) to @subsys.kset. This makes @obj a member of that
218 * kset.
219 */
220
221#define kset_set_kset_s(obj,subsys) \
222 (obj)->kset.kobj.kset = &(subsys)
223
224/**
225 * subsys_set_kset(obj,subsys) - set kset for subsystem
226 * @obj: ptr to some object type.
227 * @subsys: a subsystem object (not a ptr).
228 *
229 * Can be used for any object type with an embedded ->subsys.
230 * Sets the kset of @obj's kobject to @subsys.kset. This makes
231 * the object a member of that kset.
232 */
233
234#define subsys_set_kset(obj,_subsys) \
235 (obj)->subsys.kobj.kset = &(_subsys)
236
237extern void subsystem_init(struct kset *);
238extern int __must_check subsystem_register(struct kset *); 223extern int __must_check subsystem_register(struct kset *);
239extern void subsystem_unregister(struct kset *); 224extern void subsystem_unregister(struct kset *);
240 225
241static inline struct kset *subsys_get(struct kset *s)
242{
243 if (s)
244 return kset_get(s);
245 return NULL;
246}
247
248static inline void subsys_put(struct kset *s)
249{
250 kset_put(s);
251}
252
253struct subsys_attribute { 226struct subsys_attribute {
254 struct attribute attr; 227 struct attribute attr;
255 ssize_t (*show)(struct kset *, char *); 228 ssize_t (*show)(struct kset *, char *);
@@ -264,10 +237,11 @@ int kobject_uevent(struct kobject *kobj, enum kobject_action action);
264int kobject_uevent_env(struct kobject *kobj, enum kobject_action action, 237int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
265 char *envp[]); 238 char *envp[]);
266 239
267int add_uevent_var(char **envp, int num_envp, int *cur_index, 240int add_uevent_var(struct kobj_uevent_env *env, const char *format, ...)
268 char *buffer, int buffer_size, int *cur_len, 241 __attribute__((format (printf, 2, 3)));
269 const char *format, ...) 242
270 __attribute__((format (printf, 7, 8))); 243int kobject_action_type(const char *buf, size_t count,
244 enum kobject_action *type);
271#else 245#else
272static inline int kobject_uevent(struct kobject *kobj, enum kobject_action action) 246static inline int kobject_uevent(struct kobject *kobj, enum kobject_action action)
273{ return 0; } 247{ return 0; }
@@ -276,10 +250,12 @@ static inline int kobject_uevent_env(struct kobject *kobj,
276 char *envp[]) 250 char *envp[])
277{ return 0; } 251{ return 0; }
278 252
279static inline int add_uevent_var(char **envp, int num_envp, int *cur_index, 253static inline int add_uevent_var(struct kobj_uevent_env *env, const char *format, ...)
280 char *buffer, int buffer_size, int *cur_len,
281 const char *format, ...)
282{ return 0; } 254{ return 0; }
255
256static inline int kobject_action_type(const char *buf, size_t count,
257 enum kobject_action *type)
258{ return -EINVAL; }
283#endif 259#endif
284 260
285#endif /* __KERNEL__ */ 261#endif /* __KERNEL__ */
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index 23adf6075ae4..51464d12a4e5 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -116,9 +116,12 @@ struct kprobe {
116 */ 116 */
117struct jprobe { 117struct jprobe {
118 struct kprobe kp; 118 struct kprobe kp;
119 kprobe_opcode_t *entry; /* probe handling code to jump to */ 119 void *entry; /* probe handling code to jump to */
120}; 120};
121 121
122/* For backward compatibility with old code using JPROBE_ENTRY() */
123#define JPROBE_ENTRY(handler) (handler)
124
122DECLARE_PER_CPU(struct kprobe *, current_kprobe); 125DECLARE_PER_CPU(struct kprobe *, current_kprobe);
123DECLARE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); 126DECLARE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
124 127
@@ -211,6 +214,7 @@ int longjmp_break_handler(struct kprobe *, struct pt_regs *);
211int register_jprobe(struct jprobe *p); 214int register_jprobe(struct jprobe *p);
212void unregister_jprobe(struct jprobe *p); 215void unregister_jprobe(struct jprobe *p);
213void jprobe_return(void); 216void jprobe_return(void);
217unsigned long arch_deref_entry_point(void *);
214 218
215int register_kretprobe(struct kretprobe *rp); 219int register_kretprobe(struct kretprobe *rp);
216void unregister_kretprobe(struct kretprobe *rp); 220void unregister_kretprobe(struct kretprobe *rp);
diff --git a/include/linux/ktime.h b/include/linux/ktime.h
index dae7143644fe..a6ddec141f96 100644
--- a/include/linux/ktime.h
+++ b/include/linux/ktime.h
@@ -102,6 +102,13 @@ static inline ktime_t ktime_set(const long secs, const unsigned long nsecs)
102#define ktime_add_ns(kt, nsval) \ 102#define ktime_add_ns(kt, nsval) \
103 ({ (ktime_t){ .tv64 = (kt).tv64 + (nsval) }; }) 103 ({ (ktime_t){ .tv64 = (kt).tv64 + (nsval) }; })
104 104
105/*
106 * Subtract a scalar nanosecod from a ktime_t variable
107 * res = kt - nsval:
108 */
109#define ktime_sub_ns(kt, nsval) \
110 ({ (ktime_t){ .tv64 = (kt).tv64 - (nsval) }; })
111
105/* convert a timespec to ktime_t format: */ 112/* convert a timespec to ktime_t format: */
106static inline ktime_t timespec_to_ktime(struct timespec ts) 113static inline ktime_t timespec_to_ktime(struct timespec ts)
107{ 114{
@@ -200,6 +207,15 @@ static inline ktime_t ktime_add(const ktime_t add1, const ktime_t add2)
200extern ktime_t ktime_add_ns(const ktime_t kt, u64 nsec); 207extern ktime_t ktime_add_ns(const ktime_t kt, u64 nsec);
201 208
202/** 209/**
210 * ktime_sub_ns - Subtract a scalar nanoseconds value from a ktime_t variable
211 * @kt: minuend
212 * @nsec: the scalar nsec value to subtract
213 *
214 * Returns the subtraction of @nsec from @kt in ktime_t format
215 */
216extern ktime_t ktime_sub_ns(const ktime_t kt, u64 nsec);
217
218/**
203 * timespec_to_ktime - convert a timespec to ktime_t format 219 * timespec_to_ktime - convert a timespec to ktime_t format
204 * @ts: the timespec variable to convert 220 * @ts: the timespec variable to convert
205 * 221 *
@@ -289,6 +305,11 @@ static inline ktime_t ktime_add_us(const ktime_t kt, const u64 usec)
289 return ktime_add_ns(kt, usec * 1000); 305 return ktime_add_ns(kt, usec * 1000);
290} 306}
291 307
308static inline ktime_t ktime_sub_us(const ktime_t kt, const u64 usec)
309{
310 return ktime_sub_ns(kt, usec * 1000);
311}
312
292/* 313/*
293 * The resolution of the clocks. The resolution value is returned in 314 * The resolution of the clocks. The resolution value is returned in
294 * the clock_getres() system call to give application programmers an 315 * the clock_getres() system call to give application programmers an
diff --git a/include/linux/lcd.h b/include/linux/lcd.h
index 598793c0745b..1d379787f2e7 100644
--- a/include/linux/lcd.h
+++ b/include/linux/lcd.h
@@ -62,8 +62,8 @@ struct lcd_device {
62 struct mutex update_lock; 62 struct mutex update_lock;
63 /* The framebuffer notifier block */ 63 /* The framebuffer notifier block */
64 struct notifier_block fb_notif; 64 struct notifier_block fb_notif;
65 /* The class device structure */ 65
66 struct class_device class_dev; 66 struct device dev;
67}; 67};
68 68
69static inline void lcd_set_power(struct lcd_device *ld, int power) 69static inline void lcd_set_power(struct lcd_device *ld, int power)
@@ -75,9 +75,15 @@ static inline void lcd_set_power(struct lcd_device *ld, int power)
75} 75}
76 76
77extern struct lcd_device *lcd_device_register(const char *name, 77extern struct lcd_device *lcd_device_register(const char *name,
78 void *devdata, struct lcd_ops *ops); 78 struct device *parent, void *devdata, struct lcd_ops *ops);
79extern void lcd_device_unregister(struct lcd_device *ld); 79extern void lcd_device_unregister(struct lcd_device *ld);
80 80
81#define to_lcd_device(obj) container_of(obj, struct lcd_device, class_dev) 81#define to_lcd_device(obj) container_of(obj, struct lcd_device, dev)
82
83static inline void * lcd_get_data(struct lcd_device *ld_dev)
84{
85 return dev_get_drvdata(&ld_dev->dev);
86}
87
82 88
83#endif 89#endif
diff --git a/include/linux/leds.h b/include/linux/leds.h
index 494bed7c2fc1..dc1178f6184b 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -13,9 +13,9 @@
13#define __LINUX_LEDS_H_INCLUDED 13#define __LINUX_LEDS_H_INCLUDED
14 14
15#include <linux/list.h> 15#include <linux/list.h>
16#include <linux/spinlock.h>
16 17
17struct device; 18struct device;
18struct class_device;
19/* 19/*
20 * LED Core 20 * LED Core
21 */ 21 */
@@ -37,7 +37,7 @@ struct led_classdev {
37 void (*brightness_set)(struct led_classdev *led_cdev, 37 void (*brightness_set)(struct led_classdev *led_cdev,
38 enum led_brightness brightness); 38 enum led_brightness brightness);
39 39
40 struct class_device *class_dev; 40 struct device *dev;
41 struct list_head node; /* LED Device list */ 41 struct list_head node; /* LED Device list */
42 char *default_trigger; /* Trigger to use */ 42 char *default_trigger; /* Trigger to use */
43 43
@@ -109,4 +109,18 @@ extern void ledtrig_ide_activity(void);
109#define ledtrig_ide_activity() do {} while(0) 109#define ledtrig_ide_activity() do {} while(0)
110#endif 110#endif
111 111
112/* For the leds-gpio driver */
113struct gpio_led {
114 const char *name;
115 char *default_trigger;
116 unsigned gpio;
117 u8 active_low;
118};
119
120struct gpio_led_platform_data {
121 int num_leds;
122 struct gpio_led *leds;
123};
124
125
112#endif /* __LINUX_LEDS_H_INCLUDED */ 126#endif /* __LINUX_LEDS_H_INCLUDED */
diff --git a/include/linux/lguest.h b/include/linux/lguest.h
new file mode 100644
index 000000000000..157ad64aa7ce
--- /dev/null
+++ b/include/linux/lguest.h
@@ -0,0 +1,116 @@
1/* Things the lguest guest needs to know. Note: like all lguest interfaces,
2 * this is subject to wild and random change between versions. */
3#ifndef _ASM_LGUEST_H
4#define _ASM_LGUEST_H
5
6#ifndef __ASSEMBLY__
7#include <asm/irq.h>
8
9#define LHCALL_FLUSH_ASYNC 0
10#define LHCALL_LGUEST_INIT 1
11#define LHCALL_CRASH 2
12#define LHCALL_LOAD_GDT 3
13#define LHCALL_NEW_PGTABLE 4
14#define LHCALL_FLUSH_TLB 5
15#define LHCALL_LOAD_IDT_ENTRY 6
16#define LHCALL_SET_STACK 7
17#define LHCALL_TS 8
18#define LHCALL_SET_CLOCKEVENT 9
19#define LHCALL_HALT 10
20#define LHCALL_BIND_DMA 12
21#define LHCALL_SEND_DMA 13
22#define LHCALL_SET_PTE 14
23#define LHCALL_SET_PMD 15
24#define LHCALL_LOAD_TLS 16
25
26#define LG_CLOCK_MIN_DELTA 100UL
27#define LG_CLOCK_MAX_DELTA ULONG_MAX
28
29/*G:031 First, how does our Guest contact the Host to ask for privileged
30 * operations? There are two ways: the direct way is to make a "hypercall",
31 * to make requests of the Host Itself.
32 *
33 * Our hypercall mechanism uses the highest unused trap code (traps 32 and
34 * above are used by real hardware interrupts). Seventeen hypercalls are
35 * available: the hypercall number is put in the %eax register, and the
36 * arguments (when required) are placed in %edx, %ebx and %ecx. If a return
37 * value makes sense, it's returned in %eax.
38 *
39 * Grossly invalid calls result in Sudden Death at the hands of the vengeful
40 * Host, rather than returning failure. This reflects Winston Churchill's
41 * definition of a gentleman: "someone who is only rude intentionally". */
42#define LGUEST_TRAP_ENTRY 0x1F
43
44static inline unsigned long
45hcall(unsigned long call,
46 unsigned long arg1, unsigned long arg2, unsigned long arg3)
47{
48 /* "int" is the Intel instruction to trigger a trap. */
49 asm volatile("int $" __stringify(LGUEST_TRAP_ENTRY)
50 /* The call is in %eax (aka "a"), and can be replaced */
51 : "=a"(call)
52 /* The other arguments are in %eax, %edx, %ebx & %ecx */
53 : "a"(call), "d"(arg1), "b"(arg2), "c"(arg3)
54 /* "memory" means this might write somewhere in memory.
55 * This isn't true for all calls, but it's safe to tell
56 * gcc that it might happen so it doesn't get clever. */
57 : "memory");
58 return call;
59}
60/*:*/
61
62void async_hcall(unsigned long call,
63 unsigned long arg1, unsigned long arg2, unsigned long arg3);
64
65/* Can't use our min() macro here: needs to be a constant */
66#define LGUEST_IRQS (NR_IRQS < 32 ? NR_IRQS: 32)
67
68#define LHCALL_RING_SIZE 64
69struct hcall_ring
70{
71 u32 eax, edx, ebx, ecx;
72};
73
74/*G:032 The second method of communicating with the Host is to via "struct
75 * lguest_data". The Guest's very first hypercall is to tell the Host where
76 * this is, and then the Guest and Host both publish information in it. :*/
77struct lguest_data
78{
79 /* 512 == enabled (same as eflags in normal hardware). The Guest
80 * changes interrupts so often that a hypercall is too slow. */
81 unsigned int irq_enabled;
82 /* Fine-grained interrupt disabling by the Guest */
83 DECLARE_BITMAP(blocked_interrupts, LGUEST_IRQS);
84
85 /* The Host writes the virtual address of the last page fault here,
86 * which saves the Guest a hypercall. CR2 is the native register where
87 * this address would normally be found. */
88 unsigned long cr2;
89
90 /* Wallclock time set by the Host. */
91 struct timespec time;
92
93 /* Async hypercall ring. Instead of directly making hypercalls, we can
94 * place them in here for processing the next time the Host wants.
95 * This batching can be quite efficient. */
96
97 /* 0xFF == done (set by Host), 0 == pending (set by Guest). */
98 u8 hcall_status[LHCALL_RING_SIZE];
99 /* The actual registers for the hypercalls. */
100 struct hcall_ring hcalls[LHCALL_RING_SIZE];
101
102/* Fields initialized by the Host at boot: */
103 /* Memory not to try to access */
104 unsigned long reserve_mem;
105 /* ID of this Guest (used by network driver to set ethernet address) */
106 u16 guestid;
107 /* KHz for the TSC clock. */
108 u32 tsc_khz;
109
110/* Fields initialized by the Guest at boot: */
111 /* Instruction range to suppress interrupts even if enabled */
112 unsigned long noirq_start, noirq_end;
113};
114extern struct lguest_data lguest_data;
115#endif /* __ASSEMBLY__ */
116#endif /* _ASM_LGUEST_H */
diff --git a/include/linux/lguest_bus.h b/include/linux/lguest_bus.h
new file mode 100644
index 000000000000..d27853ddc644
--- /dev/null
+++ b/include/linux/lguest_bus.h
@@ -0,0 +1,51 @@
1#ifndef _ASM_LGUEST_DEVICE_H
2#define _ASM_LGUEST_DEVICE_H
3/* Everything you need to know about lguest devices. */
4#include <linux/device.h>
5#include <linux/lguest.h>
6#include <linux/lguest_launcher.h>
7
8struct lguest_device {
9 /* Unique busid, and index into lguest_page->devices[] */
10 unsigned int index;
11
12 struct device dev;
13
14 /* Driver can hang data off here. */
15 void *private;
16};
17
18/*D:380 Since interrupt numbers are arbitrary, we use a convention: each device
19 * can use the interrupt number corresponding to its index. The +1 is because
20 * interrupt 0 is not usable (it's actually the timer interrupt). */
21static inline int lgdev_irq(const struct lguest_device *dev)
22{
23 return dev->index + 1;
24}
25/*:*/
26
27/* dma args must not be vmalloced! */
28void lguest_send_dma(unsigned long key, struct lguest_dma *dma);
29int lguest_bind_dma(unsigned long key, struct lguest_dma *dmas,
30 unsigned int num, u8 irq);
31void lguest_unbind_dma(unsigned long key, struct lguest_dma *dmas);
32
33/* Map the virtual device space */
34void *lguest_map(unsigned long phys_addr, unsigned long pages);
35void lguest_unmap(void *);
36
37struct lguest_driver {
38 const char *name;
39 struct module *owner;
40 u16 device_type;
41 int (*probe)(struct lguest_device *dev);
42 void (*remove)(struct lguest_device *dev);
43
44 struct device_driver drv;
45};
46
47extern int register_lguest_driver(struct lguest_driver *drv);
48extern void unregister_lguest_driver(struct lguest_driver *drv);
49
50extern struct lguest_device_desc *lguest_devices; /* Just past max_pfn */
51#endif /* _ASM_LGUEST_DEVICE_H */
diff --git a/include/linux/lguest_launcher.h b/include/linux/lguest_launcher.h
new file mode 100644
index 000000000000..641670579446
--- /dev/null
+++ b/include/linux/lguest_launcher.h
@@ -0,0 +1,127 @@
1#ifndef _ASM_LGUEST_USER
2#define _ASM_LGUEST_USER
3/* Everything the "lguest" userspace program needs to know. */
4/* They can register up to 32 arrays of lguest_dma. */
5#define LGUEST_MAX_DMA 32
6/* At most we can dma 16 lguest_dma in one op. */
7#define LGUEST_MAX_DMA_SECTIONS 16
8
9/* How many devices? Assume each one wants up to two dma arrays per device. */
10#define LGUEST_MAX_DEVICES (LGUEST_MAX_DMA/2)
11
12/*D:200
13 * Lguest I/O
14 *
15 * The lguest I/O mechanism is the only way Guests can talk to devices. There
16 * are two hypercalls involved: SEND_DMA for output and BIND_DMA for input. In
17 * each case, "struct lguest_dma" describes the buffer: this contains 16
18 * addr/len pairs, and if there are fewer buffer elements the len array is
19 * terminated with a 0.
20 *
21 * I/O is organized by keys: BIND_DMA attaches buffers to a particular key, and
22 * SEND_DMA transfers to buffers bound to particular key. By convention, keys
23 * correspond to a physical address within the device's page. This means that
24 * devices will never accidentally end up with the same keys, and allows the
25 * Host use The Futex Trick (as we'll see later in our journey).
26 *
27 * SEND_DMA simply indicates a key to send to, and the physical address of the
28 * "struct lguest_dma" to send. The Host will write the number of bytes
29 * transferred into the "struct lguest_dma"'s used_len member.
30 *
31 * BIND_DMA indicates a key to bind to, a pointer to an array of "struct
32 * lguest_dma"s ready for receiving, the size of that array, and an interrupt
33 * to trigger when data is received. The Host will only allow transfers into
34 * buffers with a used_len of zero: it then sets used_len to the number of
35 * bytes transferred and triggers the interrupt for the Guest to process the
36 * new input. */
37struct lguest_dma
38{
39 /* 0 if free to be used, filled by the Host. */
40 u32 used_len;
41 unsigned long addr[LGUEST_MAX_DMA_SECTIONS];
42 u16 len[LGUEST_MAX_DMA_SECTIONS];
43};
44/*:*/
45
46/*D:460 This is the layout of a block device memory page. The Launcher sets up
47 * the num_sectors initially to tell the Guest the size of the disk. The Guest
48 * puts the type, sector and length of the request in the first three fields,
49 * then DMAs to the Host. The Host processes the request, sets up the result,
50 * then DMAs back to the Guest. */
51struct lguest_block_page
52{
53 /* 0 is a read, 1 is a write. */
54 int type;
55 u32 sector; /* Offset in device = sector * 512. */
56 u32 bytes; /* Length expected to be read/written in bytes */
57 /* 0 = pending, 1 = done, 2 = done, error */
58 int result;
59 u32 num_sectors; /* Disk length = num_sectors * 512 */
60};
61
62/*D:520 The network device is basically a memory page where all the Guests on
63 * the network publish their MAC (ethernet) addresses: it's an array of "struct
64 * lguest_net": */
65struct lguest_net
66{
67 /* Simply the mac address (with multicast bit meaning promisc). */
68 unsigned char mac[6];
69};
70/*:*/
71
72/* Where the Host expects the Guest to SEND_DMA console output to. */
73#define LGUEST_CONSOLE_DMA_KEY 0
74
75/*D:010
76 * Drivers
77 *
78 * The Guest needs devices to do anything useful. Since we don't let it touch
79 * real devices (think of the damage it could do!) we provide virtual devices.
80 * We could emulate a PCI bus with various devices on it, but that is a fairly
81 * complex burden for the Host and suboptimal for the Guest, so we have our own
82 * "lguest" bus and simple drivers.
83 *
84 * Devices are described by an array of LGUEST_MAX_DEVICES of these structs,
85 * placed by the Launcher just above the top of physical memory:
86 */
87struct lguest_device_desc {
88 /* The device type: console, network, disk etc. */
89 u16 type;
90#define LGUEST_DEVICE_T_CONSOLE 1
91#define LGUEST_DEVICE_T_NET 2
92#define LGUEST_DEVICE_T_BLOCK 3
93
94 /* The specific features of this device: these depends on device type
95 * except for LGUEST_DEVICE_F_RANDOMNESS. */
96 u16 features;
97#define LGUEST_NET_F_NOCSUM 0x4000 /* Don't bother checksumming */
98#define LGUEST_DEVICE_F_RANDOMNESS 0x8000 /* IRQ is fairly random */
99
100 /* This is how the Guest reports status of the device: the Host can set
101 * LGUEST_DEVICE_S_REMOVED to indicate removal, but the rest are only
102 * ever manipulated by the Guest, and only ever set. */
103 u16 status;
104/* 256 and above are device specific. */
105#define LGUEST_DEVICE_S_ACKNOWLEDGE 1 /* We have seen device. */
106#define LGUEST_DEVICE_S_DRIVER 2 /* We have found a driver */
107#define LGUEST_DEVICE_S_DRIVER_OK 4 /* Driver says OK! */
108#define LGUEST_DEVICE_S_REMOVED 8 /* Device has gone away. */
109#define LGUEST_DEVICE_S_REMOVED_ACK 16 /* Driver has been told. */
110#define LGUEST_DEVICE_S_FAILED 128 /* Something actually failed */
111
112 /* Each device exists somewhere in Guest physical memory, over some
113 * number of pages. */
114 u16 num_pages;
115 u32 pfn;
116};
117/*:*/
118
119/* Write command first word is a request. */
120enum lguest_req
121{
122 LHREQ_INITIALIZE, /* + pfnlimit, pgdir, start, pageoffset */
123 LHREQ_GETDMA, /* + addr (returns &lguest_dma, irq in ->used_len) */
124 LHREQ_IRQ, /* + irq */
125 LHREQ_BREAK, /* + on/off flag (on blocks until someone does off) */
126};
127#endif /* _ASM_LGUEST_USER */
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 47cd2a1c5544..229a9ff9f924 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -28,7 +28,6 @@
28 28
29#include <linux/delay.h> 29#include <linux/delay.h>
30#include <linux/interrupt.h> 30#include <linux/interrupt.h>
31#include <linux/pci.h>
32#include <linux/dma-mapping.h> 31#include <linux/dma-mapping.h>
33#include <asm/scatterlist.h> 32#include <asm/scatterlist.h>
34#include <linux/io.h> 33#include <linux/io.h>
@@ -107,12 +106,6 @@ static inline u32 ata_msg_init(int dval, int default_msg_enable_bits)
107/* defines only for the constants which don't work well as enums */ 106/* defines only for the constants which don't work well as enums */
108#define ATA_TAG_POISON 0xfafbfcfdU 107#define ATA_TAG_POISON 0xfafbfcfdU
109 108
110/* move to PCI layer? */
111static inline struct device *pci_dev_to_dev(struct pci_dev *pdev)
112{
113 return &pdev->dev;
114}
115
116enum { 109enum {
117 /* various global constants */ 110 /* various global constants */
118 LIBATA_MAX_PRD = ATA_MAX_PRD / 2, 111 LIBATA_MAX_PRD = ATA_MAX_PRD / 2,
@@ -139,11 +132,12 @@ enum {
139 ATA_DFLAG_FLUSH_EXT = (1 << 4), /* do FLUSH_EXT instead of FLUSH */ 132 ATA_DFLAG_FLUSH_EXT = (1 << 4), /* do FLUSH_EXT instead of FLUSH */
140 ATA_DFLAG_ACPI_PENDING = (1 << 5), /* ACPI resume action pending */ 133 ATA_DFLAG_ACPI_PENDING = (1 << 5), /* ACPI resume action pending */
141 ATA_DFLAG_ACPI_FAILED = (1 << 6), /* ACPI on devcfg has failed */ 134 ATA_DFLAG_ACPI_FAILED = (1 << 6), /* ACPI on devcfg has failed */
142 ATA_DFLAG_CFG_MASK = (1 << 8) - 1, 135 ATA_DFLAG_AN = (1 << 7), /* AN configured */
136 ATA_DFLAG_CFG_MASK = (1 << 12) - 1,
143 137
144 ATA_DFLAG_PIO = (1 << 8), /* device limited to PIO mode */ 138 ATA_DFLAG_PIO = (1 << 12), /* device limited to PIO mode */
145 ATA_DFLAG_NCQ_OFF = (1 << 9), /* device limited to non-NCQ mode */ 139 ATA_DFLAG_NCQ_OFF = (1 << 13), /* device limited to non-NCQ mode */
146 ATA_DFLAG_SPUNDOWN = (1 << 10), /* XXX: for spindown_compat */ 140 ATA_DFLAG_SPUNDOWN = (1 << 14), /* XXX: for spindown_compat */
147 ATA_DFLAG_INIT_MASK = (1 << 16) - 1, 141 ATA_DFLAG_INIT_MASK = (1 << 16) - 1,
148 142
149 ATA_DFLAG_DETACH = (1 << 16), 143 ATA_DFLAG_DETACH = (1 << 16),
@@ -154,7 +148,22 @@ enum {
154 ATA_DEV_ATA_UNSUP = 2, /* ATA device (unsupported) */ 148 ATA_DEV_ATA_UNSUP = 2, /* ATA device (unsupported) */
155 ATA_DEV_ATAPI = 3, /* ATAPI device */ 149 ATA_DEV_ATAPI = 3, /* ATAPI device */
156 ATA_DEV_ATAPI_UNSUP = 4, /* ATAPI device (unsupported) */ 150 ATA_DEV_ATAPI_UNSUP = 4, /* ATAPI device (unsupported) */
157 ATA_DEV_NONE = 5, /* no device */ 151 ATA_DEV_PMP = 5, /* SATA port multiplier */
152 ATA_DEV_PMP_UNSUP = 6, /* SATA port multiplier (unsupported) */
153 ATA_DEV_SEMB = 7, /* SEMB */
154 ATA_DEV_SEMB_UNSUP = 8, /* SEMB (unsupported) */
155 ATA_DEV_NONE = 9, /* no device */
156
157 /* struct ata_link flags */
158 ATA_LFLAG_HRST_TO_RESUME = (1 << 0), /* hardreset to resume link */
159 ATA_LFLAG_SKIP_D2H_BSY = (1 << 1), /* can't wait for the first D2H
160 * Register FIS clearing BSY */
161 ATA_LFLAG_NO_SRST = (1 << 2), /* avoid softreset */
162 ATA_LFLAG_ASSUME_ATA = (1 << 3), /* assume ATA class */
163 ATA_LFLAG_ASSUME_SEMB = (1 << 4), /* assume SEMB class */
164 ATA_LFLAG_ASSUME_CLASS = ATA_LFLAG_ASSUME_ATA | ATA_LFLAG_ASSUME_SEMB,
165 ATA_LFLAG_NO_RETRY = (1 << 5), /* don't retry this link */
166 ATA_LFLAG_DISABLED = (1 << 6), /* link is disabled */
158 167
159 /* struct ata_port flags */ 168 /* struct ata_port flags */
160 ATA_FLAG_SLAVE_POSS = (1 << 0), /* host supports slave dev */ 169 ATA_FLAG_SLAVE_POSS = (1 << 0), /* host supports slave dev */
@@ -170,13 +179,12 @@ enum {
170 ATA_FLAG_PIO_POLLING = (1 << 9), /* use polling PIO if LLD 179 ATA_FLAG_PIO_POLLING = (1 << 9), /* use polling PIO if LLD
171 * doesn't handle PIO interrupts */ 180 * doesn't handle PIO interrupts */
172 ATA_FLAG_NCQ = (1 << 10), /* host supports NCQ */ 181 ATA_FLAG_NCQ = (1 << 10), /* host supports NCQ */
173 ATA_FLAG_HRST_TO_RESUME = (1 << 11), /* hardreset to resume phy */
174 ATA_FLAG_SKIP_D2H_BSY = (1 << 12), /* can't wait for the first D2H
175 * Register FIS clearing BSY */
176 ATA_FLAG_DEBUGMSG = (1 << 13), 182 ATA_FLAG_DEBUGMSG = (1 << 13),
177 ATA_FLAG_IGN_SIMPLEX = (1 << 15), /* ignore SIMPLEX */ 183 ATA_FLAG_IGN_SIMPLEX = (1 << 15), /* ignore SIMPLEX */
178 ATA_FLAG_NO_IORDY = (1 << 16), /* controller lacks iordy */ 184 ATA_FLAG_NO_IORDY = (1 << 16), /* controller lacks iordy */
179 ATA_FLAG_ACPI_SATA = (1 << 17), /* need native SATA ACPI layout */ 185 ATA_FLAG_ACPI_SATA = (1 << 17), /* need native SATA ACPI layout */
186 ATA_FLAG_AN = (1 << 18), /* controller supports AN */
187 ATA_FLAG_PMP = (1 << 19), /* controller supports PMP */
180 188
181 /* The following flag belongs to ap->pflags but is kept in 189 /* The following flag belongs to ap->pflags but is kept in
182 * ap->flags because it's referenced in many LLDs and will be 190 * ap->flags because it's referenced in many LLDs and will be
@@ -195,6 +203,7 @@ enum {
195 ATA_PFLAG_UNLOADING = (1 << 5), /* module is unloading */ 203 ATA_PFLAG_UNLOADING = (1 << 5), /* module is unloading */
196 ATA_PFLAG_SCSI_HOTPLUG = (1 << 6), /* SCSI hotplug scheduled */ 204 ATA_PFLAG_SCSI_HOTPLUG = (1 << 6), /* SCSI hotplug scheduled */
197 ATA_PFLAG_INITIALIZING = (1 << 7), /* being initialized, don't touch */ 205 ATA_PFLAG_INITIALIZING = (1 << 7), /* being initialized, don't touch */
206 ATA_PFLAG_RESETTING = (1 << 8), /* reset in progress */
198 207
199 ATA_PFLAG_SUSPENDED = (1 << 17), /* port is suspended (power) */ 208 ATA_PFLAG_SUSPENDED = (1 << 17), /* port is suspended (power) */
200 ATA_PFLAG_PM_PENDING = (1 << 18), /* PM operation pending */ 209 ATA_PFLAG_PM_PENDING = (1 << 18), /* PM operation pending */
@@ -207,6 +216,7 @@ enum {
207 ATA_QCFLAG_DMAMAP = ATA_QCFLAG_SG | ATA_QCFLAG_SINGLE, 216 ATA_QCFLAG_DMAMAP = ATA_QCFLAG_SG | ATA_QCFLAG_SINGLE,
208 ATA_QCFLAG_IO = (1 << 3), /* standard IO command */ 217 ATA_QCFLAG_IO = (1 << 3), /* standard IO command */
209 ATA_QCFLAG_RESULT_TF = (1 << 4), /* result TF requested */ 218 ATA_QCFLAG_RESULT_TF = (1 << 4), /* result TF requested */
219 ATA_QCFLAG_CLEAR_EXCL = (1 << 5), /* clear excl_link on completion */
210 220
211 ATA_QCFLAG_FAILED = (1 << 16), /* cmd failed and is owned by EH */ 221 ATA_QCFLAG_FAILED = (1 << 16), /* cmd failed and is owned by EH */
212 ATA_QCFLAG_SENSE_VALID = (1 << 17), /* sense data valid */ 222 ATA_QCFLAG_SENSE_VALID = (1 << 17), /* sense data valid */
@@ -216,6 +226,8 @@ enum {
216 ATA_HOST_SIMPLEX = (1 << 0), /* Host is simplex, one DMA channel per host only */ 226 ATA_HOST_SIMPLEX = (1 << 0), /* Host is simplex, one DMA channel per host only */
217 ATA_HOST_STARTED = (1 << 1), /* Host started */ 227 ATA_HOST_STARTED = (1 << 1), /* Host started */
218 228
229 /* bits 24:31 of host->flags are reserved for LLD specific flags */
230
219 /* various lengths of time */ 231 /* various lengths of time */
220 ATA_TMOUT_BOOT = 30 * HZ, /* heuristic */ 232 ATA_TMOUT_BOOT = 30 * HZ, /* heuristic */
221 ATA_TMOUT_BOOT_QUICK = 7 * HZ, /* heuristic */ 233 ATA_TMOUT_BOOT_QUICK = 7 * HZ, /* heuristic */
@@ -261,6 +273,10 @@ enum {
261 /* ering size */ 273 /* ering size */
262 ATA_ERING_SIZE = 32, 274 ATA_ERING_SIZE = 32,
263 275
276 /* return values for ->qc_defer */
277 ATA_DEFER_LINK = 1,
278 ATA_DEFER_PORT = 2,
279
264 /* desc_len for ata_eh_info and context */ 280 /* desc_len for ata_eh_info and context */
265 ATA_EH_DESC_LEN = 80, 281 ATA_EH_DESC_LEN = 80,
266 282
@@ -268,6 +284,7 @@ enum {
268 ATA_EH_REVALIDATE = (1 << 0), 284 ATA_EH_REVALIDATE = (1 << 0),
269 ATA_EH_SOFTRESET = (1 << 1), 285 ATA_EH_SOFTRESET = (1 << 1),
270 ATA_EH_HARDRESET = (1 << 2), 286 ATA_EH_HARDRESET = (1 << 2),
287 ATA_EH_ENABLE_LINK = (1 << 3),
271 288
272 ATA_EH_RESET_MASK = ATA_EH_SOFTRESET | ATA_EH_HARDRESET, 289 ATA_EH_RESET_MASK = ATA_EH_SOFTRESET | ATA_EH_HARDRESET,
273 ATA_EH_PERDEV_MASK = ATA_EH_REVALIDATE, 290 ATA_EH_PERDEV_MASK = ATA_EH_REVALIDATE,
@@ -287,12 +304,16 @@ enum {
287 ATA_EHI_DID_RESET = ATA_EHI_DID_SOFTRESET | ATA_EHI_DID_HARDRESET, 304 ATA_EHI_DID_RESET = ATA_EHI_DID_SOFTRESET | ATA_EHI_DID_HARDRESET,
288 ATA_EHI_RESET_MODIFIER_MASK = ATA_EHI_RESUME_LINK, 305 ATA_EHI_RESET_MODIFIER_MASK = ATA_EHI_RESUME_LINK,
289 306
290 /* max repeat if error condition is still set after ->error_handler */ 307 /* max tries if error condition is still set after ->error_handler */
291 ATA_EH_MAX_REPEAT = 5, 308 ATA_EH_MAX_TRIES = 5,
292 309
293 /* how hard are we gonna try to probe/recover devices */ 310 /* how hard are we gonna try to probe/recover devices */
294 ATA_PROBE_MAX_TRIES = 3, 311 ATA_PROBE_MAX_TRIES = 3,
295 ATA_EH_DEV_TRIES = 3, 312 ATA_EH_DEV_TRIES = 3,
313 ATA_EH_PMP_TRIES = 5,
314 ATA_EH_PMP_LINK_TRIES = 3,
315
316 SATA_PMP_SCR_TIMEOUT = 250,
296 317
297 /* Horkage types. May be set by libata or controller on drives 318 /* Horkage types. May be set by libata or controller on drives
298 (some horkage may be drive/controller pair dependant */ 319 (some horkage may be drive/controller pair dependant */
@@ -301,6 +322,15 @@ enum {
301 ATA_HORKAGE_NODMA = (1 << 1), /* DMA problems */ 322 ATA_HORKAGE_NODMA = (1 << 1), /* DMA problems */
302 ATA_HORKAGE_NONCQ = (1 << 2), /* Don't use NCQ */ 323 ATA_HORKAGE_NONCQ = (1 << 2), /* Don't use NCQ */
303 ATA_HORKAGE_MAX_SEC_128 = (1 << 3), /* Limit max sects to 128 */ 324 ATA_HORKAGE_MAX_SEC_128 = (1 << 3), /* Limit max sects to 128 */
325 ATA_HORKAGE_BROKEN_HPA = (1 << 4), /* Broken HPA */
326 ATA_HORKAGE_SKIP_PM = (1 << 5), /* Skip PM operations */
327 ATA_HORKAGE_HPA_SIZE = (1 << 6), /* native size off by one */
328
329 /* DMA mask for user DMA control: User visible values; DO NOT
330 renumber */
331 ATA_DMA_MASK_ATA = (1 << 0), /* DMA on ATA Disk */
332 ATA_DMA_MASK_ATAPI = (1 << 1), /* DMA on ATAPI */
333 ATA_DMA_MASK_CFA = (1 << 2), /* DMA on CF Card */
304}; 334};
305 335
306enum hsm_task_states { 336enum hsm_task_states {
@@ -323,20 +353,22 @@ enum ata_completion_errors {
323 AC_ERR_INVALID = (1 << 7), /* invalid argument */ 353 AC_ERR_INVALID = (1 << 7), /* invalid argument */
324 AC_ERR_OTHER = (1 << 8), /* unknown */ 354 AC_ERR_OTHER = (1 << 8), /* unknown */
325 AC_ERR_NODEV_HINT = (1 << 9), /* polling device detection hint */ 355 AC_ERR_NODEV_HINT = (1 << 9), /* polling device detection hint */
356 AC_ERR_NCQ = (1 << 10), /* marker for offending NCQ qc */
326}; 357};
327 358
328/* forward declarations */ 359/* forward declarations */
329struct scsi_device; 360struct scsi_device;
330struct ata_port_operations; 361struct ata_port_operations;
331struct ata_port; 362struct ata_port;
363struct ata_link;
332struct ata_queued_cmd; 364struct ata_queued_cmd;
333 365
334/* typedefs */ 366/* typedefs */
335typedef void (*ata_qc_cb_t) (struct ata_queued_cmd *qc); 367typedef void (*ata_qc_cb_t) (struct ata_queued_cmd *qc);
336typedef int (*ata_prereset_fn_t)(struct ata_port *ap, unsigned long deadline); 368typedef int (*ata_prereset_fn_t)(struct ata_link *link, unsigned long deadline);
337typedef int (*ata_reset_fn_t)(struct ata_port *ap, unsigned int *classes, 369typedef int (*ata_reset_fn_t)(struct ata_link *link, unsigned int *classes,
338 unsigned long deadline); 370 unsigned long deadline);
339typedef void (*ata_postreset_fn_t)(struct ata_port *ap, unsigned int *classes); 371typedef void (*ata_postreset_fn_t)(struct ata_link *link, unsigned int *classes);
340 372
341struct ata_ioports { 373struct ata_ioports {
342 void __iomem *cmd_addr; 374 void __iomem *cmd_addr;
@@ -359,8 +391,6 @@ struct ata_ioports {
359struct ata_host { 391struct ata_host {
360 spinlock_t lock; 392 spinlock_t lock;
361 struct device *dev; 393 struct device *dev;
362 unsigned long irq;
363 unsigned long irq2;
364 void __iomem * const *iomap; 394 void __iomem * const *iomap;
365 unsigned int n_ports; 395 unsigned int n_ports;
366 void *private_data; 396 void *private_data;
@@ -411,6 +441,7 @@ struct ata_queued_cmd {
411 ata_qc_cb_t complete_fn; 441 ata_qc_cb_t complete_fn;
412 442
413 void *private_data; 443 void *private_data;
444 void *lldd_task;
414}; 445};
415 446
416struct ata_port_stats { 447struct ata_port_stats {
@@ -431,7 +462,7 @@ struct ata_ering {
431}; 462};
432 463
433struct ata_device { 464struct ata_device {
434 struct ata_port *ap; 465 struct ata_link *link;
435 unsigned int devno; /* 0 or 1 */ 466 unsigned int devno; /* 0 or 1 */
436 unsigned long flags; /* ATA_DFLAG_xxx */ 467 unsigned long flags; /* ATA_DFLAG_xxx */
437 unsigned int horkage; /* List of broken features */ 468 unsigned int horkage; /* List of broken features */
@@ -442,7 +473,12 @@ struct ata_device {
442 /* n_sector is used as CLEAR_OFFSET, read comment above CLEAR_OFFSET */ 473 /* n_sector is used as CLEAR_OFFSET, read comment above CLEAR_OFFSET */
443 u64 n_sectors; /* size of device, if ATA */ 474 u64 n_sectors; /* size of device, if ATA */
444 unsigned int class; /* ATA_DEV_xxx */ 475 unsigned int class; /* ATA_DEV_xxx */
445 u16 id[ATA_ID_WORDS]; /* IDENTIFY xxx DEVICE data */ 476
477 union {
478 u16 id[ATA_ID_WORDS]; /* IDENTIFY xxx DEVICE data */
479 u32 gscr[SATA_PMP_GSCR_DWORDS]; /* PMP GSCR block */
480 };
481
446 u8 pio_mode; 482 u8 pio_mode;
447 u8 dma_mode; 483 u8 dma_mode;
448 u8 xfer_mode; 484 u8 xfer_mode;
@@ -505,6 +541,27 @@ struct ata_acpi_gtm {
505 u32 flags; 541 u32 flags;
506} __packed; 542} __packed;
507 543
544struct ata_link {
545 struct ata_port *ap;
546 int pmp; /* port multiplier port # */
547
548 unsigned int active_tag; /* active tag on this link */
549 u32 sactive; /* active NCQ commands */
550
551 unsigned int flags; /* ATA_LFLAG_xxx */
552
553 unsigned int hw_sata_spd_limit;
554 unsigned int sata_spd_limit;
555 unsigned int sata_spd; /* current SATA PHY speed */
556
557 /* record runtime error info, protected by host_set lock */
558 struct ata_eh_info eh_info;
559 /* EH context */
560 struct ata_eh_context eh_context;
561
562 struct ata_device device[ATA_MAX_DEVICES];
563};
564
508struct ata_port { 565struct ata_port {
509 struct Scsi_Host *scsi_host; /* our co-allocated scsi host */ 566 struct Scsi_Host *scsi_host; /* our co-allocated scsi host */
510 const struct ata_port_operations *ops; 567 const struct ata_port_operations *ops;
@@ -528,22 +585,17 @@ struct ata_port {
528 unsigned int mwdma_mask; 585 unsigned int mwdma_mask;
529 unsigned int udma_mask; 586 unsigned int udma_mask;
530 unsigned int cbl; /* cable type; ATA_CBL_xxx */ 587 unsigned int cbl; /* cable type; ATA_CBL_xxx */
531 unsigned int hw_sata_spd_limit;
532 unsigned int sata_spd_limit; /* SATA PHY speed limit */
533
534 /* record runtime error info, protected by host lock */
535 struct ata_eh_info eh_info;
536 /* EH context owned by EH */
537 struct ata_eh_context eh_context;
538
539 struct ata_device device[ATA_MAX_DEVICES];
540 588
541 struct ata_queued_cmd qcmd[ATA_MAX_QUEUE]; 589 struct ata_queued_cmd qcmd[ATA_MAX_QUEUE];
542 unsigned long qc_allocated; 590 unsigned long qc_allocated;
543 unsigned int qc_active; 591 unsigned int qc_active;
592 int nr_active_links; /* #links with active qcs */
593
594 struct ata_link link; /* host default link */
544 595
545 unsigned int active_tag; 596 int nr_pmp_links; /* nr of available PMP links */
546 u32 sactive; 597 struct ata_link *pmp_link; /* array of PMP links */
598 struct ata_link *excl_link; /* for PMP qc exclusion */
547 599
548 struct ata_port_stats stats; 600 struct ata_port_stats stats;
549 struct ata_host *host; 601 struct ata_host *host;
@@ -559,10 +611,14 @@ struct ata_port {
559 u32 msg_enable; 611 u32 msg_enable;
560 struct list_head eh_done_q; 612 struct list_head eh_done_q;
561 wait_queue_head_t eh_wait_q; 613 wait_queue_head_t eh_wait_q;
614 int eh_tries;
562 615
563 pm_message_t pm_mesg; 616 pm_message_t pm_mesg;
564 int *pm_result; 617 int *pm_result;
565 618
619 struct timer_list fastdrain_timer;
620 unsigned long fastdrain_cnt;
621
566 void *private_data; 622 void *private_data;
567 623
568#ifdef CONFIG_ATA_ACPI 624#ifdef CONFIG_ATA_ACPI
@@ -573,8 +629,6 @@ struct ata_port {
573}; 629};
574 630
575struct ata_port_operations { 631struct ata_port_operations {
576 void (*port_disable) (struct ata_port *);
577
578 void (*dev_config) (struct ata_device *); 632 void (*dev_config) (struct ata_device *);
579 633
580 void (*set_piomode) (struct ata_port *, struct ata_device *); 634 void (*set_piomode) (struct ata_port *, struct ata_device *);
@@ -590,7 +644,7 @@ struct ata_port_operations {
590 void (*dev_select)(struct ata_port *ap, unsigned int device); 644 void (*dev_select)(struct ata_port *ap, unsigned int device);
591 645
592 void (*phy_reset) (struct ata_port *ap); /* obsolete */ 646 void (*phy_reset) (struct ata_port *ap); /* obsolete */
593 int (*set_mode) (struct ata_port *ap, struct ata_device **r_failed_dev); 647 int (*set_mode) (struct ata_link *link, struct ata_device **r_failed_dev);
594 648
595 int (*cable_detect) (struct ata_port *ap); 649 int (*cable_detect) (struct ata_port *ap);
596 650
@@ -601,9 +655,14 @@ struct ata_port_operations {
601 655
602 void (*data_xfer) (struct ata_device *, unsigned char *, unsigned int, int); 656 void (*data_xfer) (struct ata_device *, unsigned char *, unsigned int, int);
603 657
658 int (*qc_defer) (struct ata_queued_cmd *qc);
604 void (*qc_prep) (struct ata_queued_cmd *qc); 659 void (*qc_prep) (struct ata_queued_cmd *qc);
605 unsigned int (*qc_issue) (struct ata_queued_cmd *qc); 660 unsigned int (*qc_issue) (struct ata_queued_cmd *qc);
606 661
662 /* port multiplier */
663 void (*pmp_attach) (struct ata_port *ap);
664 void (*pmp_detach) (struct ata_port *ap);
665
607 /* Error handlers. ->error_handler overrides ->eng_timeout and 666 /* Error handlers. ->error_handler overrides ->eng_timeout and
608 * indicates that new-style EH is in place. 667 * indicates that new-style EH is in place.
609 */ 668 */
@@ -617,11 +676,9 @@ struct ata_port_operations {
617 irq_handler_t irq_handler; 676 irq_handler_t irq_handler;
618 void (*irq_clear) (struct ata_port *); 677 void (*irq_clear) (struct ata_port *);
619 u8 (*irq_on) (struct ata_port *); 678 u8 (*irq_on) (struct ata_port *);
620 u8 (*irq_ack) (struct ata_port *ap, unsigned int chk_drq);
621 679
622 u32 (*scr_read) (struct ata_port *ap, unsigned int sc_reg); 680 int (*scr_read) (struct ata_port *ap, unsigned int sc_reg, u32 *val);
623 void (*scr_write) (struct ata_port *ap, unsigned int sc_reg, 681 int (*scr_write) (struct ata_port *ap, unsigned int sc_reg, u32 val);
624 u32 val);
625 682
626 int (*port_suspend) (struct ata_port *ap, pm_message_t mesg); 683 int (*port_suspend) (struct ata_port *ap, pm_message_t mesg);
627 int (*port_resume) (struct ata_port *ap); 684 int (*port_resume) (struct ata_port *ap);
@@ -638,6 +695,7 @@ struct ata_port_operations {
638struct ata_port_info { 695struct ata_port_info {
639 struct scsi_host_template *sht; 696 struct scsi_host_template *sht;
640 unsigned long flags; 697 unsigned long flags;
698 unsigned long link_flags;
641 unsigned long pio_mask; 699 unsigned long pio_mask;
642 unsigned long mwdma_mask; 700 unsigned long mwdma_mask;
643 unsigned long udma_mask; 701 unsigned long udma_mask;
@@ -681,38 +739,27 @@ static inline int ata_port_is_dummy(struct ata_port *ap)
681 return ap->ops == &ata_dummy_port_ops; 739 return ap->ops == &ata_dummy_port_ops;
682} 740}
683 741
684extern void sata_print_link_status(struct ata_port *ap); 742extern void sata_print_link_status(struct ata_link *link);
685extern void ata_port_probe(struct ata_port *); 743extern void ata_port_probe(struct ata_port *);
686extern void __sata_phy_reset(struct ata_port *ap); 744extern void __sata_phy_reset(struct ata_port *ap);
687extern void sata_phy_reset(struct ata_port *ap); 745extern void sata_phy_reset(struct ata_port *ap);
688extern void ata_bus_reset(struct ata_port *ap); 746extern void ata_bus_reset(struct ata_port *ap);
689extern int sata_set_spd(struct ata_port *ap); 747extern int sata_set_spd(struct ata_link *link);
690extern int sata_phy_debounce(struct ata_port *ap, const unsigned long *param, 748extern int sata_link_debounce(struct ata_link *link,
691 unsigned long deadline); 749 const unsigned long *params, unsigned long deadline);
692extern int sata_phy_resume(struct ata_port *ap, const unsigned long *param, 750extern int sata_link_resume(struct ata_link *link, const unsigned long *params,
693 unsigned long deadline); 751 unsigned long deadline);
694extern int ata_std_prereset(struct ata_port *ap, unsigned long deadline); 752extern int ata_std_prereset(struct ata_link *link, unsigned long deadline);
695extern int ata_std_softreset(struct ata_port *ap, unsigned int *classes, 753extern int ata_std_softreset(struct ata_link *link, unsigned int *classes,
696 unsigned long deadline); 754 unsigned long deadline);
697extern int sata_port_hardreset(struct ata_port *ap, const unsigned long *timing, 755extern int sata_link_hardreset(struct ata_link *link,
698 unsigned long deadline); 756 const unsigned long *timing, unsigned long deadline);
699extern int sata_std_hardreset(struct ata_port *ap, unsigned int *class, 757extern int sata_std_hardreset(struct ata_link *link, unsigned int *class,
700 unsigned long deadline); 758 unsigned long deadline);
701extern void ata_std_postreset(struct ata_port *ap, unsigned int *classes); 759extern void ata_std_postreset(struct ata_link *link, unsigned int *classes);
702extern void ata_port_disable(struct ata_port *); 760extern void ata_port_disable(struct ata_port *);
703extern void ata_std_ports(struct ata_ioports *ioaddr); 761extern void ata_std_ports(struct ata_ioports *ioaddr);
704#ifdef CONFIG_PCI 762
705extern int ata_pci_init_one (struct pci_dev *pdev,
706 const struct ata_port_info * const * ppi);
707extern void ata_pci_remove_one (struct pci_dev *pdev);
708#ifdef CONFIG_PM
709extern void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t mesg);
710extern int __must_check ata_pci_device_do_resume(struct pci_dev *pdev);
711extern int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg);
712extern int ata_pci_device_resume(struct pci_dev *pdev);
713#endif
714extern int ata_pci_clear_simplex(struct pci_dev *pdev);
715#endif /* CONFIG_PCI */
716extern struct ata_host *ata_host_alloc(struct device *dev, int max_ports); 763extern struct ata_host *ata_host_alloc(struct device *dev, int max_ports);
717extern struct ata_host *ata_host_alloc_pinfo(struct device *dev, 764extern struct ata_host *ata_host_alloc_pinfo(struct device *dev,
718 const struct ata_port_info * const * ppi, int n_ports); 765 const struct ata_port_info * const * ppi, int n_ports);
@@ -738,12 +785,12 @@ extern int ata_sas_slave_configure(struct scsi_device *, struct ata_port *);
738extern int ata_sas_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *), 785extern int ata_sas_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *),
739 struct ata_port *ap); 786 struct ata_port *ap);
740extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc); 787extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc);
741extern int sata_scr_valid(struct ata_port *ap); 788extern int sata_scr_valid(struct ata_link *link);
742extern int sata_scr_read(struct ata_port *ap, int reg, u32 *val); 789extern int sata_scr_read(struct ata_link *link, int reg, u32 *val);
743extern int sata_scr_write(struct ata_port *ap, int reg, u32 val); 790extern int sata_scr_write(struct ata_link *link, int reg, u32 val);
744extern int sata_scr_write_flush(struct ata_port *ap, int reg, u32 val); 791extern int sata_scr_write_flush(struct ata_link *link, int reg, u32 val);
745extern int ata_port_online(struct ata_port *ap); 792extern int ata_link_online(struct ata_link *link);
746extern int ata_port_offline(struct ata_port *ap); 793extern int ata_link_offline(struct ata_link *link);
747#ifdef CONFIG_PM 794#ifdef CONFIG_PM
748extern int ata_host_suspend(struct ata_host *host, pm_message_t mesg); 795extern int ata_host_suspend(struct ata_host *host, pm_message_t mesg);
749extern void ata_host_resume(struct ata_host *host); 796extern void ata_host_resume(struct ata_host *host);
@@ -757,14 +804,16 @@ extern void ata_port_queue_task(struct ata_port *ap, work_func_t fn,
757extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val, 804extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val,
758 unsigned long interval_msec, 805 unsigned long interval_msec,
759 unsigned long timeout_msec); 806 unsigned long timeout_msec);
760extern unsigned int ata_dev_try_classify(struct ata_port *, unsigned int, u8 *); 807extern unsigned int ata_dev_try_classify(struct ata_device *dev, int present,
808 u8 *r_err);
761 809
762/* 810/*
763 * Default driver ops implementations 811 * Default driver ops implementations
764 */ 812 */
765extern void ata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf); 813extern void ata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf);
766extern void ata_tf_read(struct ata_port *ap, struct ata_taskfile *tf); 814extern void ata_tf_read(struct ata_port *ap, struct ata_taskfile *tf);
767extern void ata_tf_to_fis(const struct ata_taskfile *tf, u8 *fis, u8 pmp); 815extern void ata_tf_to_fis(const struct ata_taskfile *tf,
816 u8 pmp, int is_cmd, u8 *fis);
768extern void ata_tf_from_fis(const u8 *fis, struct ata_taskfile *tf); 817extern void ata_tf_from_fis(const u8 *fis, struct ata_taskfile *tf);
769extern void ata_noop_dev_select (struct ata_port *ap, unsigned int device); 818extern void ata_noop_dev_select (struct ata_port *ap, unsigned int device);
770extern void ata_std_dev_select (struct ata_port *ap, unsigned int device); 819extern void ata_std_dev_select (struct ata_port *ap, unsigned int device);
@@ -778,6 +827,7 @@ extern void ata_data_xfer(struct ata_device *adev, unsigned char *buf,
778 unsigned int buflen, int write_data); 827 unsigned int buflen, int write_data);
779extern void ata_data_xfer_noirq(struct ata_device *adev, unsigned char *buf, 828extern void ata_data_xfer_noirq(struct ata_device *adev, unsigned char *buf,
780 unsigned int buflen, int write_data); 829 unsigned int buflen, int write_data);
830extern int ata_std_qc_defer(struct ata_queued_cmd *qc);
781extern void ata_dumb_qc_prep(struct ata_queued_cmd *qc); 831extern void ata_dumb_qc_prep(struct ata_queued_cmd *qc);
782extern void ata_qc_prep(struct ata_queued_cmd *qc); 832extern void ata_qc_prep(struct ata_queued_cmd *qc);
783extern void ata_noop_qc_prep(struct ata_queued_cmd *qc); 833extern void ata_noop_qc_prep(struct ata_queued_cmd *qc);
@@ -821,11 +871,8 @@ extern void ata_scsi_slave_destroy(struct scsi_device *sdev);
821extern int ata_scsi_change_queue_depth(struct scsi_device *sdev, 871extern int ata_scsi_change_queue_depth(struct scsi_device *sdev,
822 int queue_depth); 872 int queue_depth);
823extern struct ata_device *ata_dev_pair(struct ata_device *adev); 873extern struct ata_device *ata_dev_pair(struct ata_device *adev);
824extern int ata_do_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev); 874extern int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev);
825extern u8 ata_irq_on(struct ata_port *ap); 875extern u8 ata_irq_on(struct ata_port *ap);
826extern u8 ata_dummy_irq_on(struct ata_port *ap);
827extern u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq);
828extern u8 ata_dummy_irq_ack(struct ata_port *ap, unsigned int chk_drq);
829 876
830extern int ata_cable_40wire(struct ata_port *ap); 877extern int ata_cable_40wire(struct ata_port *ap);
831extern int ata_cable_80wire(struct ata_port *ap); 878extern int ata_cable_80wire(struct ata_port *ap);
@@ -860,8 +907,29 @@ enum {
860 ATA_TIMING_CYCLE | ATA_TIMING_UDMA, 907 ATA_TIMING_CYCLE | ATA_TIMING_UDMA,
861}; 908};
862 909
910/* libata-acpi.c */
911#ifdef CONFIG_ATA_ACPI
912extern int ata_acpi_cbl_80wire(struct ata_port *ap);
913int ata_acpi_stm(const struct ata_port *ap, struct ata_acpi_gtm *stm);
914int ata_acpi_gtm(const struct ata_port *ap, struct ata_acpi_gtm *stm);
915#else
916static inline int ata_acpi_cbl_80wire(struct ata_port *ap) { return 0; }
917#endif
863 918
864#ifdef CONFIG_PCI 919#ifdef CONFIG_PCI
920struct pci_dev;
921
922extern int ata_pci_init_one (struct pci_dev *pdev,
923 const struct ata_port_info * const * ppi);
924extern void ata_pci_remove_one (struct pci_dev *pdev);
925#ifdef CONFIG_PM
926extern void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t mesg);
927extern int __must_check ata_pci_device_do_resume(struct pci_dev *pdev);
928extern int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg);
929extern int ata_pci_device_resume(struct pci_dev *pdev);
930#endif
931extern int ata_pci_clear_simplex(struct pci_dev *pdev);
932
865struct pci_bits { 933struct pci_bits {
866 unsigned int reg; /* PCI config register to read */ 934 unsigned int reg; /* PCI config register to read */
867 unsigned int width; /* 1 (8 bit), 2 (16 bit), 4 (32 bit) */ 935 unsigned int width; /* 1 (8 bit), 2 (16 bit), 4 (32 bit) */
@@ -879,13 +947,29 @@ extern unsigned long ata_pci_default_filter(struct ata_device *, unsigned long);
879#endif /* CONFIG_PCI */ 947#endif /* CONFIG_PCI */
880 948
881/* 949/*
950 * PMP
951 */
952extern int sata_pmp_qc_defer_cmd_switch(struct ata_queued_cmd *qc);
953extern int sata_pmp_std_prereset(struct ata_link *link, unsigned long deadline);
954extern int sata_pmp_std_hardreset(struct ata_link *link, unsigned int *class,
955 unsigned long deadline);
956extern void sata_pmp_std_postreset(struct ata_link *link, unsigned int *class);
957extern void sata_pmp_do_eh(struct ata_port *ap,
958 ata_prereset_fn_t prereset, ata_reset_fn_t softreset,
959 ata_reset_fn_t hardreset, ata_postreset_fn_t postreset,
960 ata_prereset_fn_t pmp_prereset, ata_reset_fn_t pmp_softreset,
961 ata_reset_fn_t pmp_hardreset, ata_postreset_fn_t pmp_postreset);
962
963/*
882 * EH 964 * EH
883 */ 965 */
884extern void ata_eng_timeout(struct ata_port *ap); 966extern void ata_eng_timeout(struct ata_port *ap);
885 967
886extern void ata_port_schedule_eh(struct ata_port *ap); 968extern void ata_port_schedule_eh(struct ata_port *ap);
969extern int ata_link_abort(struct ata_link *link);
887extern int ata_port_abort(struct ata_port *ap); 970extern int ata_port_abort(struct ata_port *ap);
888extern int ata_port_freeze(struct ata_port *ap); 971extern int ata_port_freeze(struct ata_port *ap);
972extern int sata_async_notification(struct ata_port *ap);
889 973
890extern void ata_eh_freeze_port(struct ata_port *ap); 974extern void ata_eh_freeze_port(struct ata_port *ap);
891extern void ata_eh_thaw_port(struct ata_port *ap); 975extern void ata_eh_thaw_port(struct ata_port *ap);
@@ -903,37 +987,53 @@ extern void ata_do_eh(struct ata_port *ap, ata_prereset_fn_t prereset,
903#define ata_port_printk(ap, lv, fmt, args...) \ 987#define ata_port_printk(ap, lv, fmt, args...) \
904 printk(lv"ata%u: "fmt, (ap)->print_id , ##args) 988 printk(lv"ata%u: "fmt, (ap)->print_id , ##args)
905 989
990#define ata_link_printk(link, lv, fmt, args...) do { \
991 if ((link)->ap->nr_pmp_links) \
992 printk(lv"ata%u.%02u: "fmt, (link)->ap->print_id, \
993 (link)->pmp , ##args); \
994 else \
995 printk(lv"ata%u: "fmt, (link)->ap->print_id , ##args); \
996 } while(0)
997
906#define ata_dev_printk(dev, lv, fmt, args...) \ 998#define ata_dev_printk(dev, lv, fmt, args...) \
907 printk(lv"ata%u.%02u: "fmt, (dev)->ap->print_id, (dev)->devno , ##args) 999 printk(lv"ata%u.%02u: "fmt, (dev)->link->ap->print_id, \
1000 (dev)->link->pmp + (dev)->devno , ##args)
908 1001
909/* 1002/*
910 * ata_eh_info helpers 1003 * ata_eh_info helpers
911 */ 1004 */
912#define ata_ehi_push_desc(ehi, fmt, args...) do { \ 1005extern void __ata_ehi_push_desc(struct ata_eh_info *ehi, const char *fmt, ...)
913 (ehi)->desc_len += scnprintf((ehi)->desc + (ehi)->desc_len, \ 1006 __attribute__ ((format (printf, 2, 3)));
914 ATA_EH_DESC_LEN - (ehi)->desc_len, \ 1007extern void ata_ehi_push_desc(struct ata_eh_info *ehi, const char *fmt, ...)
915 fmt , ##args); \ 1008 __attribute__ ((format (printf, 2, 3)));
916} while (0) 1009extern void ata_ehi_clear_desc(struct ata_eh_info *ehi);
917 1010
918#define ata_ehi_clear_desc(ehi) do { \ 1011static inline void ata_ehi_schedule_probe(struct ata_eh_info *ehi)
919 (ehi)->desc[0] = '\0'; \
920 (ehi)->desc_len = 0; \
921} while (0)
922
923static inline void __ata_ehi_hotplugged(struct ata_eh_info *ehi)
924{ 1012{
925 ehi->flags |= ATA_EHI_HOTPLUGGED | ATA_EHI_RESUME_LINK; 1013 ehi->flags |= ATA_EHI_RESUME_LINK;
926 ehi->action |= ATA_EH_SOFTRESET; 1014 ehi->action |= ATA_EH_SOFTRESET;
927 ehi->probe_mask |= (1 << ATA_MAX_DEVICES) - 1; 1015 ehi->probe_mask |= (1 << ATA_MAX_DEVICES) - 1;
928} 1016}
929 1017
930static inline void ata_ehi_hotplugged(struct ata_eh_info *ehi) 1018static inline void ata_ehi_hotplugged(struct ata_eh_info *ehi)
931{ 1019{
932 __ata_ehi_hotplugged(ehi); 1020 ata_ehi_schedule_probe(ehi);
1021 ehi->flags |= ATA_EHI_HOTPLUGGED;
1022 ehi->action |= ATA_EH_ENABLE_LINK;
933 ehi->err_mask |= AC_ERR_ATA_BUS; 1023 ehi->err_mask |= AC_ERR_ATA_BUS;
934} 1024}
935 1025
936/* 1026/*
1027 * port description helpers
1028 */
1029extern void ata_port_desc(struct ata_port *ap, const char *fmt, ...)
1030 __attribute__ ((format (printf, 2, 3)));
1031#ifdef CONFIG_PCI
1032extern void ata_port_pbar_desc(struct ata_port *ap, int bar, ssize_t offset,
1033 const char *name);
1034#endif
1035
1036/*
937 * qc helpers 1037 * qc helpers
938 */ 1038 */
939static inline int 1039static inline int
@@ -988,12 +1088,14 @@ static inline unsigned int ata_tag_internal(unsigned int tag)
988 */ 1088 */
989static inline unsigned int ata_class_enabled(unsigned int class) 1089static inline unsigned int ata_class_enabled(unsigned int class)
990{ 1090{
991 return class == ATA_DEV_ATA || class == ATA_DEV_ATAPI; 1091 return class == ATA_DEV_ATA || class == ATA_DEV_ATAPI ||
1092 class == ATA_DEV_PMP || class == ATA_DEV_SEMB;
992} 1093}
993 1094
994static inline unsigned int ata_class_disabled(unsigned int class) 1095static inline unsigned int ata_class_disabled(unsigned int class)
995{ 1096{
996 return class == ATA_DEV_ATA_UNSUP || class == ATA_DEV_ATAPI_UNSUP; 1097 return class == ATA_DEV_ATA_UNSUP || class == ATA_DEV_ATAPI_UNSUP ||
1098 class == ATA_DEV_PMP_UNSUP || class == ATA_DEV_SEMB_UNSUP;
997} 1099}
998 1100
999static inline unsigned int ata_class_absent(unsigned int class) 1101static inline unsigned int ata_class_absent(unsigned int class)
@@ -1017,15 +1119,62 @@ static inline unsigned int ata_dev_absent(const struct ata_device *dev)
1017} 1119}
1018 1120
1019/* 1121/*
1020 * port helpers 1122 * link helpers
1021 */ 1123 */
1022static inline int ata_port_max_devices(const struct ata_port *ap) 1124static inline int ata_is_host_link(const struct ata_link *link)
1125{
1126 return link == &link->ap->link;
1127}
1128
1129static inline int ata_link_max_devices(const struct ata_link *link)
1023{ 1130{
1024 if (ap->flags & ATA_FLAG_SLAVE_POSS) 1131 if (ata_is_host_link(link) && link->ap->flags & ATA_FLAG_SLAVE_POSS)
1025 return 2; 1132 return 2;
1026 return 1; 1133 return 1;
1027} 1134}
1028 1135
1136static inline int ata_link_active(struct ata_link *link)
1137{
1138 return ata_tag_valid(link->active_tag) || link->sactive;
1139}
1140
1141static inline struct ata_link *ata_port_first_link(struct ata_port *ap)
1142{
1143 if (ap->nr_pmp_links)
1144 return ap->pmp_link;
1145 return &ap->link;
1146}
1147
1148static inline struct ata_link *ata_port_next_link(struct ata_link *link)
1149{
1150 struct ata_port *ap = link->ap;
1151
1152 if (link == &ap->link) {
1153 if (!ap->nr_pmp_links)
1154 return NULL;
1155 return ap->pmp_link;
1156 }
1157
1158 if (++link - ap->pmp_link < ap->nr_pmp_links)
1159 return link;
1160 return NULL;
1161}
1162
1163#define __ata_port_for_each_link(lk, ap) \
1164 for ((lk) = &(ap)->link; (lk); (lk) = ata_port_next_link(lk))
1165
1166#define ata_port_for_each_link(link, ap) \
1167 for ((link) = ata_port_first_link(ap); (link); \
1168 (link) = ata_port_next_link(link))
1169
1170#define ata_link_for_each_dev(dev, link) \
1171 for ((dev) = (link)->device; \
1172 (dev) < (link)->device + ata_link_max_devices(link) || ((dev) = NULL); \
1173 (dev)++)
1174
1175#define ata_link_for_each_dev_reverse(dev, link) \
1176 for ((dev) = (link)->device + ata_link_max_devices(link) - 1; \
1177 (dev) >= (link)->device || ((dev) = NULL); (dev)--)
1029 1178
1030static inline u8 ata_chk_status(struct ata_port *ap) 1179static inline u8 ata_chk_status(struct ata_port *ap)
1031{ 1180{
@@ -1107,9 +1256,11 @@ static inline u8 ata_wait_idle(struct ata_port *ap)
1107{ 1256{
1108 u8 status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000); 1257 u8 status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000);
1109 1258
1259#ifdef ATA_DEBUG
1110 if (status != 0xff && (status & (ATA_BUSY | ATA_DRQ))) 1260 if (status != 0xff && (status & (ATA_BUSY | ATA_DRQ)))
1111 DPRINTK("ATA: abnormal status 0x%X on port 0x%p\n", 1261 ata_port_printk(ap, KERN_DEBUG, "abnormal Status 0x%X\n",
1112 status, ap->ioaddr.status_addr); 1262 status);
1263#endif
1113 1264
1114 return status; 1265 return status;
1115} 1266}
@@ -1146,7 +1297,7 @@ static inline void ata_tf_init(struct ata_device *dev, struct ata_taskfile *tf)
1146{ 1297{
1147 memset(tf, 0, sizeof(*tf)); 1298 memset(tf, 0, sizeof(*tf));
1148 1299
1149 tf->ctl = dev->ap->ctl; 1300 tf->ctl = dev->link->ap->ctl;
1150 if (dev->devno == 0) 1301 if (dev->devno == 0)
1151 tf->device = ATA_DEVICE_OBS; 1302 tf->device = ATA_DEVICE_OBS;
1152 else 1303 else
diff --git a/include/linux/list.h b/include/linux/list.h
index f29fc9c1a964..ad9dcb9e3375 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -525,6 +525,20 @@ static inline void list_splice_init_rcu(struct list_head *list,
525 pos = list_entry(pos->member.next, typeof(*pos), member)) 525 pos = list_entry(pos->member.next, typeof(*pos), member))
526 526
527/** 527/**
528 * list_for_each_entry_continue_reverse - iterate backwards from the given point
529 * @pos: the type * to use as a loop cursor.
530 * @head: the head for your list.
531 * @member: the name of the list_struct within the struct.
532 *
533 * Start to iterate over list of given type backwards, continuing after
534 * the current position.
535 */
536#define list_for_each_entry_continue_reverse(pos, head, member) \
537 for (pos = list_entry(pos->member.prev, typeof(*pos), member); \
538 prefetch(pos->member.prev), &pos->member != (head); \
539 pos = list_entry(pos->member.prev, typeof(*pos), member))
540
541/**
528 * list_for_each_entry_from - iterate over list of given type from the current point 542 * list_for_each_entry_from - iterate over list of given type from the current point
529 * @pos: the type * to use as a loop cursor. 543 * @pos: the type * to use as a loop cursor.
530 * @head: the head for your list. 544 * @head: the head for your list.
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index 14c937d345cb..0e843bf65877 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -1,7 +1,8 @@
1/* 1/*
2 * Runtime locking correctness validator 2 * Runtime locking correctness validator
3 * 3 *
4 * Copyright (C) 2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com> 4 * Copyright (C) 2006,2007 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>
5 * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com>
5 * 6 *
6 * see Documentation/lockdep-design.txt for more details. 7 * see Documentation/lockdep-design.txt for more details.
7 */ 8 */
@@ -9,6 +10,7 @@
9#define __LINUX_LOCKDEP_H 10#define __LINUX_LOCKDEP_H
10 11
11struct task_struct; 12struct task_struct;
13struct lockdep_map;
12 14
13#ifdef CONFIG_LOCKDEP 15#ifdef CONFIG_LOCKDEP
14 16
@@ -114,8 +116,44 @@ struct lock_class {
114 116
115 const char *name; 117 const char *name;
116 int name_version; 118 int name_version;
119
120#ifdef CONFIG_LOCK_STAT
121 unsigned long contention_point[4];
122#endif
123};
124
125#ifdef CONFIG_LOCK_STAT
126struct lock_time {
127 s64 min;
128 s64 max;
129 s64 total;
130 unsigned long nr;
131};
132
133enum bounce_type {
134 bounce_acquired_write,
135 bounce_acquired_read,
136 bounce_contended_write,
137 bounce_contended_read,
138 nr_bounce_types,
139
140 bounce_acquired = bounce_acquired_write,
141 bounce_contended = bounce_contended_write,
117}; 142};
118 143
144struct lock_class_stats {
145 unsigned long contention_point[4];
146 struct lock_time read_waittime;
147 struct lock_time write_waittime;
148 struct lock_time read_holdtime;
149 struct lock_time write_holdtime;
150 unsigned long bounces[nr_bounce_types];
151};
152
153struct lock_class_stats lock_stats(struct lock_class *class);
154void clear_lock_stats(struct lock_class *class);
155#endif
156
119/* 157/*
120 * Map the lock object (the lock instance) to the lock-class object. 158 * Map the lock object (the lock instance) to the lock-class object.
121 * This is embedded into specific lock instances: 159 * This is embedded into specific lock instances:
@@ -124,6 +162,9 @@ struct lockdep_map {
124 struct lock_class_key *key; 162 struct lock_class_key *key;
125 struct lock_class *class_cache; 163 struct lock_class *class_cache;
126 const char *name; 164 const char *name;
165#ifdef CONFIG_LOCK_STAT
166 int cpu;
167#endif
127}; 168};
128 169
129/* 170/*
@@ -165,6 +206,10 @@ struct held_lock {
165 unsigned long acquire_ip; 206 unsigned long acquire_ip;
166 struct lockdep_map *instance; 207 struct lockdep_map *instance;
167 208
209#ifdef CONFIG_LOCK_STAT
210 u64 waittime_stamp;
211 u64 holdtime_stamp;
212#endif
168 /* 213 /*
169 * The lock-stack is unified in that the lock chains of interrupt 214 * The lock-stack is unified in that the lock chains of interrupt
170 * contexts nest ontop of process context chains, but we 'separate' 215 * contexts nest ontop of process context chains, but we 'separate'
@@ -281,6 +326,30 @@ struct lock_class_key { };
281 326
282#endif /* !LOCKDEP */ 327#endif /* !LOCKDEP */
283 328
329#ifdef CONFIG_LOCK_STAT
330
331extern void lock_contended(struct lockdep_map *lock, unsigned long ip);
332extern void lock_acquired(struct lockdep_map *lock);
333
334#define LOCK_CONTENDED(_lock, try, lock) \
335do { \
336 if (!try(_lock)) { \
337 lock_contended(&(_lock)->dep_map, _RET_IP_); \
338 lock(_lock); \
339 } \
340 lock_acquired(&(_lock)->dep_map); \
341} while (0)
342
343#else /* CONFIG_LOCK_STAT */
344
345#define lock_contended(lockdep_map, ip) do {} while (0)
346#define lock_acquired(lockdep_map) do {} while (0)
347
348#define LOCK_CONTENDED(_lock, try, lock) \
349 lock(_lock)
350
351#endif /* CONFIG_LOCK_STAT */
352
284#if defined(CONFIG_TRACE_IRQFLAGS) && defined(CONFIG_GENERIC_HARDIRQS) 353#if defined(CONFIG_TRACE_IRQFLAGS) && defined(CONFIG_GENERIC_HARDIRQS)
285extern void early_init_irq_lock_class(void); 354extern void early_init_irq_lock_class(void);
286#else 355#else
diff --git a/include/linux/loop.h b/include/linux/loop.h
index 0b99b31f017b..26a0a103898f 100644
--- a/include/linux/loop.h
+++ b/include/linux/loop.h
@@ -63,7 +63,7 @@ struct loop_device {
63 struct task_struct *lo_thread; 63 struct task_struct *lo_thread;
64 wait_queue_head_t lo_event; 64 wait_queue_head_t lo_event;
65 65
66 request_queue_t *lo_queue; 66 struct request_queue *lo_queue;
67 struct gendisk *lo_disk; 67 struct gendisk *lo_disk;
68 struct list_head lo_list; 68 struct list_head lo_list;
69}; 69};
diff --git a/include/linux/major.h b/include/linux/major.h
index 7e7c9093919a..0cb98053537a 100644
--- a/include/linux/major.h
+++ b/include/linux/major.h
@@ -158,6 +158,8 @@
158#define VXSPEC_MAJOR 200 /* VERITAS volume config driver */ 158#define VXSPEC_MAJOR 200 /* VERITAS volume config driver */
159#define VXDMP_MAJOR 201 /* VERITAS volume multipath driver */ 159#define VXDMP_MAJOR 201 /* VERITAS volume multipath driver */
160 160
161#define XENVBD_MAJOR 202 /* Xen virtual block device */
162
161#define MSR_MAJOR 202 163#define MSR_MAJOR 202
162#define CPUID_MAJOR 203 164#define CPUID_MAJOR 203
163 165
diff --git a/include/linux/mdio-bitbang.h b/include/linux/mdio-bitbang.h
new file mode 100644
index 000000000000..8ea9a42a4c02
--- /dev/null
+++ b/include/linux/mdio-bitbang.h
@@ -0,0 +1,42 @@
1#ifndef __LINUX_MDIO_BITBANG_H
2#define __LINUX_MDIO_BITBANG_H
3
4#include <linux/phy.h>
5#include <linux/module.h>
6
7struct mdiobb_ctrl;
8
9struct mdiobb_ops {
10 struct module *owner;
11
12 /* Set the Management Data Clock high if level is one,
13 * low if level is zero.
14 */
15 void (*set_mdc)(struct mdiobb_ctrl *ctrl, int level);
16
17 /* Configure the Management Data I/O pin as an input if
18 * "output" is zero, or an output if "output" is one.
19 */
20 void (*set_mdio_dir)(struct mdiobb_ctrl *ctrl, int output);
21
22 /* Set the Management Data I/O pin high if value is one,
23 * low if "value" is zero. This may only be called
24 * when the MDIO pin is configured as an output.
25 */
26 void (*set_mdio_data)(struct mdiobb_ctrl *ctrl, int value);
27
28 /* Retrieve the state Management Data I/O pin. */
29 int (*get_mdio_data)(struct mdiobb_ctrl *ctrl);
30};
31
32struct mdiobb_ctrl {
33 const struct mdiobb_ops *ops;
34};
35
36/* The returned bus is not yet registered with the phy layer. */
37struct mii_bus *alloc_mdio_bitbang(struct mdiobb_ctrl *ctrl);
38
39/* The bus must already have been unregistered. */
40void free_mdio_bitbang(struct mii_bus *bus);
41
42#endif
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index e147cf50529f..a020eb2d4e2a 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -159,14 +159,14 @@ extern void mpol_fix_fork_child_flag(struct task_struct *p);
159 159
160extern struct mempolicy default_policy; 160extern struct mempolicy default_policy;
161extern struct zonelist *huge_zonelist(struct vm_area_struct *vma, 161extern struct zonelist *huge_zonelist(struct vm_area_struct *vma,
162 unsigned long addr, gfp_t gfp_flags); 162 unsigned long addr, gfp_t gfp_flags, struct mempolicy **mpol);
163extern unsigned slab_node(struct mempolicy *policy); 163extern unsigned slab_node(struct mempolicy *policy);
164 164
165extern enum zone_type policy_zone; 165extern enum zone_type policy_zone;
166 166
167static inline void check_highest_zone(enum zone_type k) 167static inline void check_highest_zone(enum zone_type k)
168{ 168{
169 if (k > policy_zone) 169 if (k > policy_zone && k != ZONE_MOVABLE)
170 policy_zone = k; 170 policy_zone = k;
171} 171}
172 172
@@ -256,7 +256,7 @@ static inline void mpol_fix_fork_child_flag(struct task_struct *p)
256#define set_cpuset_being_rebound(x) do {} while (0) 256#define set_cpuset_being_rebound(x) do {} while (0)
257 257
258static inline struct zonelist *huge_zonelist(struct vm_area_struct *vma, 258static inline struct zonelist *huge_zonelist(struct vm_area_struct *vma,
259 unsigned long addr, gfp_t gfp_flags) 259 unsigned long addr, gfp_t gfp_flags, struct mempolicy **mpol)
260{ 260{
261 return NODE_DATA(0)->node_zonelists + gfp_zone(gfp_flags); 261 return NODE_DATA(0)->node_zonelists + gfp_zone(gfp_flags);
262} 262}
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index cfb78fb2c046..222815d91c40 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -49,6 +49,10 @@ enum {
49}; 49};
50 50
51enum { 51enum {
52 MLX4_BOARD_ID_LEN = 64
53};
54
55enum {
52 MLX4_DEV_CAP_FLAG_RC = 1 << 0, 56 MLX4_DEV_CAP_FLAG_RC = 1 << 0,
53 MLX4_DEV_CAP_FLAG_UC = 1 << 1, 57 MLX4_DEV_CAP_FLAG_UC = 1 << 1,
54 MLX4_DEV_CAP_FLAG_UD = 1 << 2, 58 MLX4_DEV_CAP_FLAG_UD = 1 << 2,
@@ -210,6 +214,17 @@ struct mlx4_mr {
210 int enabled; 214 int enabled;
211}; 215};
212 216
217struct mlx4_fmr {
218 struct mlx4_mr mr;
219 struct mlx4_mpt_entry *mpt;
220 __be64 *mtts;
221 dma_addr_t dma_handle;
222 int max_pages;
223 int max_maps;
224 int maps;
225 u8 page_shift;
226};
227
213struct mlx4_uar { 228struct mlx4_uar {
214 unsigned long pfn; 229 unsigned long pfn;
215 int index; 230 int index;
@@ -272,6 +287,8 @@ struct mlx4_dev {
272 unsigned long flags; 287 unsigned long flags;
273 struct mlx4_caps caps; 288 struct mlx4_caps caps;
274 struct radix_tree_root qp_table_tree; 289 struct radix_tree_root qp_table_tree;
290 u32 rev_id;
291 char board_id[MLX4_BOARD_ID_LEN];
275}; 292};
276 293
277struct mlx4_init_port_param { 294struct mlx4_init_port_param {
@@ -331,4 +348,14 @@ int mlx4_CLOSE_PORT(struct mlx4_dev *dev, int port);
331int mlx4_multicast_attach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16]); 348int mlx4_multicast_attach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16]);
332int mlx4_multicast_detach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16]); 349int mlx4_multicast_detach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16]);
333 350
351int mlx4_map_phys_fmr(struct mlx4_dev *dev, struct mlx4_fmr *fmr, u64 *page_list,
352 int npages, u64 iova, u32 *lkey, u32 *rkey);
353int mlx4_fmr_alloc(struct mlx4_dev *dev, u32 pd, u32 access, int max_pages,
354 int max_maps, u8 page_shift, struct mlx4_fmr *fmr);
355int mlx4_fmr_enable(struct mlx4_dev *dev, struct mlx4_fmr *fmr);
356void mlx4_fmr_unmap(struct mlx4_dev *dev, struct mlx4_fmr *fmr,
357 u32 *lkey, u32 *rkey);
358int mlx4_fmr_free(struct mlx4_dev *dev, struct mlx4_fmr *fmr);
359int mlx4_SYNC_TPT(struct mlx4_dev *dev);
360
334#endif /* MLX4_DEVICE_H */ 361#endif /* MLX4_DEVICE_H */
diff --git a/include/linux/mm.h b/include/linux/mm.h
index a5c451816fdc..1692dd6cb915 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -10,7 +10,6 @@
10#include <linux/mmzone.h> 10#include <linux/mmzone.h>
11#include <linux/rbtree.h> 11#include <linux/rbtree.h>
12#include <linux/prio_tree.h> 12#include <linux/prio_tree.h>
13#include <linux/fs.h>
14#include <linux/mutex.h> 13#include <linux/mutex.h>
15#include <linux/debug_locks.h> 14#include <linux/debug_locks.h>
16#include <linux/backing-dev.h> 15#include <linux/backing-dev.h>
@@ -18,7 +17,9 @@
18 17
19struct mempolicy; 18struct mempolicy;
20struct anon_vma; 19struct anon_vma;
20struct file_ra_state;
21struct user_struct; 21struct user_struct;
22struct writeback_control;
22 23
23#ifndef CONFIG_DISCONTIGMEM /* Don't use mapnrs, do it properly */ 24#ifndef CONFIG_DISCONTIGMEM /* Don't use mapnrs, do it properly */
24extern unsigned long max_mapnr; 25extern unsigned long max_mapnr;
@@ -168,6 +169,8 @@ extern unsigned int kobjsize(const void *objp);
168#define VM_INSERTPAGE 0x02000000 /* The vma has had "vm_insert_page()" done on it */ 169#define VM_INSERTPAGE 0x02000000 /* The vma has had "vm_insert_page()" done on it */
169#define VM_ALWAYSDUMP 0x04000000 /* Always include in core dumps */ 170#define VM_ALWAYSDUMP 0x04000000 /* Always include in core dumps */
170 171
172#define VM_CAN_NONLINEAR 0x08000000 /* Has ->fault & does nonlinear pages */
173
171#ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */ 174#ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */
172#define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS 175#define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS
173#endif 176#endif
@@ -190,6 +193,30 @@ extern unsigned int kobjsize(const void *objp);
190 */ 193 */
191extern pgprot_t protection_map[16]; 194extern pgprot_t protection_map[16];
192 195
196#define FAULT_FLAG_WRITE 0x01 /* Fault was a write access */
197#define FAULT_FLAG_NONLINEAR 0x02 /* Fault was via a nonlinear mapping */
198
199
200/*
201 * vm_fault is filled by the the pagefault handler and passed to the vma's
202 * ->fault function. The vma's ->fault is responsible for returning a bitmask
203 * of VM_FAULT_xxx flags that give details about how the fault was handled.
204 *
205 * pgoff should be used in favour of virtual_address, if possible. If pgoff
206 * is used, one may set VM_CAN_NONLINEAR in the vma->vm_flags to get nonlinear
207 * mapping support.
208 */
209struct vm_fault {
210 unsigned int flags; /* FAULT_FLAG_xxx flags */
211 pgoff_t pgoff; /* Logical page offset based on vma */
212 void __user *virtual_address; /* Faulting virtual address */
213
214 struct page *page; /* ->fault handlers should return a
215 * page here, unless VM_FAULT_NOPAGE
216 * is set (which is also implied by
217 * VM_FAULT_ERROR).
218 */
219};
193 220
194/* 221/*
195 * These are the virtual MM functions - opening of an area, closing and 222 * These are the virtual MM functions - opening of an area, closing and
@@ -199,9 +226,11 @@ extern pgprot_t protection_map[16];
199struct vm_operations_struct { 226struct vm_operations_struct {
200 void (*open)(struct vm_area_struct * area); 227 void (*open)(struct vm_area_struct * area);
201 void (*close)(struct vm_area_struct * area); 228 void (*close)(struct vm_area_struct * area);
202 struct page * (*nopage)(struct vm_area_struct * area, unsigned long address, int *type); 229 int (*fault)(struct vm_area_struct *vma, struct vm_fault *vmf);
203 unsigned long (*nopfn)(struct vm_area_struct * area, unsigned long address); 230 struct page *(*nopage)(struct vm_area_struct *area,
204 int (*populate)(struct vm_area_struct * area, unsigned long address, unsigned long len, pgprot_t prot, unsigned long pgoff, int nonblock); 231 unsigned long address, int *type);
232 unsigned long (*nopfn)(struct vm_area_struct *area,
233 unsigned long address);
205 234
206 /* notification that a previously read-only page is about to become 235 /* notification that a previously read-only page is about to become
207 * writable, if an error is returned it will cause a SIGBUS */ 236 * writable, if an error is returned it will cause a SIGBUS */
@@ -655,7 +684,6 @@ static inline int page_mapped(struct page *page)
655 */ 684 */
656#define NOPAGE_SIGBUS (NULL) 685#define NOPAGE_SIGBUS (NULL)
657#define NOPAGE_OOM ((struct page *) (-1)) 686#define NOPAGE_OOM ((struct page *) (-1))
658#define NOPAGE_REFAULT ((struct page *) (-2)) /* Return to userspace, rerun */
659 687
660/* 688/*
661 * Error return values for the *_nopfn functions 689 * Error return values for the *_nopfn functions
@@ -669,16 +697,18 @@ static inline int page_mapped(struct page *page)
669 * Used to decide whether a process gets delivered SIGBUS or 697 * Used to decide whether a process gets delivered SIGBUS or
670 * just gets major/minor fault counters bumped up. 698 * just gets major/minor fault counters bumped up.
671 */ 699 */
672#define VM_FAULT_OOM 0x00 700
673#define VM_FAULT_SIGBUS 0x01 701#define VM_FAULT_MINOR 0 /* For backwards compat. Remove me quickly. */
674#define VM_FAULT_MINOR 0x02 702
675#define VM_FAULT_MAJOR 0x03 703#define VM_FAULT_OOM 0x0001
676 704#define VM_FAULT_SIGBUS 0x0002
677/* 705#define VM_FAULT_MAJOR 0x0004
678 * Special case for get_user_pages. 706#define VM_FAULT_WRITE 0x0008 /* Special case for get_user_pages */
679 * Must be in a distinct bit from the above VM_FAULT_ flags. 707
680 */ 708#define VM_FAULT_NOPAGE 0x0100 /* ->fault installed the pte, not return page */
681#define VM_FAULT_WRITE 0x10 709#define VM_FAULT_LOCKED 0x0200 /* ->fault locked the returned page */
710
711#define VM_FAULT_ERROR (VM_FAULT_OOM | VM_FAULT_SIGBUS)
682 712
683#define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK) 713#define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK)
684 714
@@ -762,20 +792,10 @@ static inline void unmap_shared_mapping_range(struct address_space *mapping,
762 792
763extern int vmtruncate(struct inode * inode, loff_t offset); 793extern int vmtruncate(struct inode * inode, loff_t offset);
764extern int vmtruncate_range(struct inode * inode, loff_t offset, loff_t end); 794extern int vmtruncate_range(struct inode * inode, loff_t offset, loff_t end);
765extern int install_page(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, struct page *page, pgprot_t prot);
766extern int install_file_pte(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, unsigned long pgoff, pgprot_t prot);
767 795
768#ifdef CONFIG_MMU 796#ifdef CONFIG_MMU
769extern int __handle_mm_fault(struct mm_struct *mm,struct vm_area_struct *vma, 797extern int handle_mm_fault(struct mm_struct *mm, struct vm_area_struct *vma,
770 unsigned long address, int write_access); 798 unsigned long address, int write_access);
771
772static inline int handle_mm_fault(struct mm_struct *mm,
773 struct vm_area_struct *vma, unsigned long address,
774 int write_access)
775{
776 return __handle_mm_fault(mm, vma, address, write_access) &
777 (~VM_FAULT_WRITE);
778}
779#else 799#else
780static inline int handle_mm_fault(struct mm_struct *mm, 800static inline int handle_mm_fault(struct mm_struct *mm,
781 struct vm_area_struct *vma, unsigned long address, 801 struct vm_area_struct *vma, unsigned long address,
@@ -789,7 +809,6 @@ static inline int handle_mm_fault(struct mm_struct *mm,
789 809
790extern int make_pages_present(unsigned long addr, unsigned long end); 810extern int make_pages_present(unsigned long addr, unsigned long end);
791extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write); 811extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write);
792void install_arg_page(struct vm_area_struct *, struct page *, unsigned long);
793 812
794int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, unsigned long start, 813int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, unsigned long start,
795 int len, int write, int force, struct page **pages, struct vm_area_struct **vmas); 814 int len, int write, int force, struct page **pages, struct vm_area_struct **vmas);
@@ -806,9 +825,15 @@ int FASTCALL(set_page_dirty(struct page *page));
806int set_page_dirty_lock(struct page *page); 825int set_page_dirty_lock(struct page *page);
807int clear_page_dirty_for_io(struct page *page); 826int clear_page_dirty_for_io(struct page *page);
808 827
828extern unsigned long move_page_tables(struct vm_area_struct *vma,
829 unsigned long old_addr, struct vm_area_struct *new_vma,
830 unsigned long new_addr, unsigned long len);
809extern unsigned long do_mremap(unsigned long addr, 831extern unsigned long do_mremap(unsigned long addr,
810 unsigned long old_len, unsigned long new_len, 832 unsigned long old_len, unsigned long new_len,
811 unsigned long flags, unsigned long new_addr); 833 unsigned long flags, unsigned long new_addr);
834extern int mprotect_fixup(struct vm_area_struct *vma,
835 struct vm_area_struct **pprev, unsigned long start,
836 unsigned long end, unsigned long newflags);
812 837
813/* 838/*
814 * A callback you can register to apply pressure to ageable caches. 839 * A callback you can register to apply pressure to ageable caches.
@@ -837,38 +862,7 @@ struct shrinker {
837extern void register_shrinker(struct shrinker *); 862extern void register_shrinker(struct shrinker *);
838extern void unregister_shrinker(struct shrinker *); 863extern void unregister_shrinker(struct shrinker *);
839 864
840/* 865int vma_wants_writenotify(struct vm_area_struct *vma);
841 * Some shared mappigns will want the pages marked read-only
842 * to track write events. If so, we'll downgrade vm_page_prot
843 * to the private version (using protection_map[] without the
844 * VM_SHARED bit).
845 */
846static inline int vma_wants_writenotify(struct vm_area_struct *vma)
847{
848 unsigned int vm_flags = vma->vm_flags;
849
850 /* If it was private or non-writable, the write bit is already clear */
851 if ((vm_flags & (VM_WRITE|VM_SHARED)) != ((VM_WRITE|VM_SHARED)))
852 return 0;
853
854 /* The backer wishes to know when pages are first written to? */
855 if (vma->vm_ops && vma->vm_ops->page_mkwrite)
856 return 1;
857
858 /* The open routine did something to the protections already? */
859 if (pgprot_val(vma->vm_page_prot) !=
860 pgprot_val(protection_map[vm_flags &
861 (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]))
862 return 0;
863
864 /* Specialty mapping? */
865 if (vm_flags & (VM_PFNMAP|VM_INSERTPAGE))
866 return 0;
867
868 /* Can the mapping track the dirty pages? */
869 return vma->vm_file && vma->vm_file->f_mapping &&
870 mapping_cap_account_dirty(vma->vm_file->f_mapping);
871}
872 866
873extern pte_t *FASTCALL(get_locked_pte(struct mm_struct *mm, unsigned long addr, spinlock_t **ptl)); 867extern pte_t *FASTCALL(get_locked_pte(struct mm_struct *mm, unsigned long addr, spinlock_t **ptl));
874 868
@@ -1048,7 +1042,7 @@ static inline void vma_nonlinear_insert(struct vm_area_struct *vma,
1048} 1042}
1049 1043
1050/* mmap.c */ 1044/* mmap.c */
1051extern int __vm_enough_memory(long pages, int cap_sys_admin); 1045extern int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin);
1052extern void vma_adjust(struct vm_area_struct *vma, unsigned long start, 1046extern void vma_adjust(struct vm_area_struct *vma, unsigned long start,
1053 unsigned long end, pgoff_t pgoff, struct vm_area_struct *insert); 1047 unsigned long end, pgoff_t pgoff, struct vm_area_struct *insert);
1054extern struct vm_area_struct *vma_merge(struct mm_struct *, 1048extern struct vm_area_struct *vma_merge(struct mm_struct *,
@@ -1104,9 +1098,7 @@ extern void truncate_inode_pages_range(struct address_space *,
1104 loff_t lstart, loff_t lend); 1098 loff_t lstart, loff_t lend);
1105 1099
1106/* generic vm_area_ops exported for stackable file systems */ 1100/* generic vm_area_ops exported for stackable file systems */
1107extern struct page *filemap_nopage(struct vm_area_struct *, unsigned long, int *); 1101extern int filemap_fault(struct vm_area_struct *, struct vm_fault *);
1108extern int filemap_populate(struct vm_area_struct *, unsigned long,
1109 unsigned long, pgprot_t, unsigned long, int);
1110 1102
1111/* mm/page-writeback.c */ 1103/* mm/page-writeback.c */
1112int write_one_page(struct page *page, int wait); 1104int write_one_page(struct page *page, int wait);
@@ -1121,13 +1113,20 @@ int do_page_cache_readahead(struct address_space *mapping, struct file *filp,
1121 pgoff_t offset, unsigned long nr_to_read); 1113 pgoff_t offset, unsigned long nr_to_read);
1122int force_page_cache_readahead(struct address_space *mapping, struct file *filp, 1114int force_page_cache_readahead(struct address_space *mapping, struct file *filp,
1123 pgoff_t offset, unsigned long nr_to_read); 1115 pgoff_t offset, unsigned long nr_to_read);
1124unsigned long page_cache_readahead(struct address_space *mapping, 1116
1125 struct file_ra_state *ra, 1117void page_cache_sync_readahead(struct address_space *mapping,
1126 struct file *filp, 1118 struct file_ra_state *ra,
1127 pgoff_t offset, 1119 struct file *filp,
1128 unsigned long size); 1120 pgoff_t offset,
1129void handle_ra_miss(struct address_space *mapping, 1121 unsigned long size);
1130 struct file_ra_state *ra, pgoff_t offset); 1122
1123void page_cache_async_readahead(struct address_space *mapping,
1124 struct file_ra_state *ra,
1125 struct file *filp,
1126 struct page *pg,
1127 pgoff_t offset,
1128 unsigned long size);
1129
1131unsigned long max_sane_readahead(unsigned long nr); 1130unsigned long max_sane_readahead(unsigned long nr);
1132 1131
1133/* Do stack extension */ 1132/* Do stack extension */
@@ -1135,6 +1134,8 @@ extern int expand_stack(struct vm_area_struct *vma, unsigned long address);
1135#ifdef CONFIG_IA64 1134#ifdef CONFIG_IA64
1136extern int expand_upwards(struct vm_area_struct *vma, unsigned long address); 1135extern int expand_upwards(struct vm_area_struct *vma, unsigned long address);
1137#endif 1136#endif
1137extern int expand_stack_downwards(struct vm_area_struct *vma,
1138 unsigned long address);
1138 1139
1139/* Look up the first VMA which satisfies addr < vm_end, NULL if none. */ 1140/* Look up the first VMA which satisfies addr < vm_end, NULL if none. */
1140extern struct vm_area_struct * find_vma(struct mm_struct * mm, unsigned long addr); 1141extern struct vm_area_struct * find_vma(struct mm_struct * mm, unsigned long addr);
@@ -1215,7 +1216,7 @@ void drop_slab(void);
1215extern int randomize_va_space; 1216extern int randomize_va_space;
1216#endif 1217#endif
1217 1218
1218__attribute__((weak)) const char *arch_vma_name(struct vm_area_struct *vma); 1219const char * arch_vma_name(struct vm_area_struct *vma);
1219 1220
1220#endif /* __KERNEL__ */ 1221#endif /* __KERNEL__ */
1221#endif /* _LINUX_MM_H */ 1222#endif /* _LINUX_MM_H */
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index badf702fcff4..0d508ac17d64 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -55,7 +55,28 @@ struct sd_switch_caps {
55 unsigned int hs_max_dtr; 55 unsigned int hs_max_dtr;
56}; 56};
57 57
58struct sdio_cccr {
59 unsigned int sdio_vsn;
60 unsigned int sd_vsn;
61 unsigned int multi_block:1,
62 low_speed:1,
63 wide_bus:1,
64 high_power:1,
65 high_speed:1;
66};
67
68struct sdio_cis {
69 unsigned short vendor;
70 unsigned short device;
71 unsigned short blksize;
72 unsigned int max_dtr;
73};
74
58struct mmc_host; 75struct mmc_host;
76struct sdio_func;
77struct sdio_func_tuple;
78
79#define SDIO_MAX_FUNCS 7
59 80
60/* 81/*
61 * MMC device 82 * MMC device
@@ -67,11 +88,13 @@ struct mmc_card {
67 unsigned int type; /* card type */ 88 unsigned int type; /* card type */
68#define MMC_TYPE_MMC 0 /* MMC card */ 89#define MMC_TYPE_MMC 0 /* MMC card */
69#define MMC_TYPE_SD 1 /* SD card */ 90#define MMC_TYPE_SD 1 /* SD card */
91#define MMC_TYPE_SDIO 2 /* SDIO card */
70 unsigned int state; /* (our) card state */ 92 unsigned int state; /* (our) card state */
71#define MMC_STATE_PRESENT (1<<0) /* present in sysfs */ 93#define MMC_STATE_PRESENT (1<<0) /* present in sysfs */
72#define MMC_STATE_READONLY (1<<1) /* card is read-only */ 94#define MMC_STATE_READONLY (1<<1) /* card is read-only */
73#define MMC_STATE_HIGHSPEED (1<<2) /* card is in high speed mode */ 95#define MMC_STATE_HIGHSPEED (1<<2) /* card is in high speed mode */
74#define MMC_STATE_BLOCKADDR (1<<3) /* card uses block-addressing */ 96#define MMC_STATE_BLOCKADDR (1<<3) /* card uses block-addressing */
97
75 u32 raw_cid[4]; /* raw card CID */ 98 u32 raw_cid[4]; /* raw card CID */
76 u32 raw_csd[4]; /* raw card CSD */ 99 u32 raw_csd[4]; /* raw card CSD */
77 u32 raw_scr[2]; /* raw card SCR */ 100 u32 raw_scr[2]; /* raw card SCR */
@@ -80,10 +103,19 @@ struct mmc_card {
80 struct mmc_ext_csd ext_csd; /* mmc v4 extended card specific */ 103 struct mmc_ext_csd ext_csd; /* mmc v4 extended card specific */
81 struct sd_scr scr; /* extra SD information */ 104 struct sd_scr scr; /* extra SD information */
82 struct sd_switch_caps sw_caps; /* switch (CMD6) caps */ 105 struct sd_switch_caps sw_caps; /* switch (CMD6) caps */
106
107 unsigned int sdio_funcs; /* number of SDIO functions */
108 struct sdio_cccr cccr; /* common card info */
109 struct sdio_cis cis; /* common tuple info */
110 struct sdio_func *sdio_func[SDIO_MAX_FUNCS]; /* SDIO functions (devices) */
111 unsigned num_info; /* number of info strings */
112 const char **info; /* info strings */
113 struct sdio_func_tuple *tuples; /* unknown common tuples */
83}; 114};
84 115
85#define mmc_card_mmc(c) ((c)->type == MMC_TYPE_MMC) 116#define mmc_card_mmc(c) ((c)->type == MMC_TYPE_MMC)
86#define mmc_card_sd(c) ((c)->type == MMC_TYPE_SD) 117#define mmc_card_sd(c) ((c)->type == MMC_TYPE_SD)
118#define mmc_card_sdio(c) ((c)->type == MMC_TYPE_SDIO)
87 119
88#define mmc_card_present(c) ((c)->state & MMC_STATE_PRESENT) 120#define mmc_card_present(c) ((c)->state & MMC_STATE_PRESENT)
89#define mmc_card_readonly(c) ((c)->state & MMC_STATE_READONLY) 121#define mmc_card_readonly(c) ((c)->state & MMC_STATE_READONLY)
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index 04bbe12fae8d..d0c3abed74c2 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -25,14 +25,20 @@ struct mmc_command {
25#define MMC_RSP_CRC (1 << 2) /* expect valid crc */ 25#define MMC_RSP_CRC (1 << 2) /* expect valid crc */
26#define MMC_RSP_BUSY (1 << 3) /* card may send busy */ 26#define MMC_RSP_BUSY (1 << 3) /* card may send busy */
27#define MMC_RSP_OPCODE (1 << 4) /* response contains opcode */ 27#define MMC_RSP_OPCODE (1 << 4) /* response contains opcode */
28#define MMC_CMD_MASK (3 << 5) /* command type */ 28
29#define MMC_CMD_MASK (3 << 5) /* non-SPI command type */
29#define MMC_CMD_AC (0 << 5) 30#define MMC_CMD_AC (0 << 5)
30#define MMC_CMD_ADTC (1 << 5) 31#define MMC_CMD_ADTC (1 << 5)
31#define MMC_CMD_BC (2 << 5) 32#define MMC_CMD_BC (2 << 5)
32#define MMC_CMD_BCR (3 << 5) 33#define MMC_CMD_BCR (3 << 5)
33 34
35#define MMC_RSP_SPI_S1 (1 << 7) /* one status byte */
36#define MMC_RSP_SPI_S2 (1 << 8) /* second byte */
37#define MMC_RSP_SPI_B4 (1 << 9) /* four data bytes */
38#define MMC_RSP_SPI_BUSY (1 << 10) /* card may send busy */
39
34/* 40/*
35 * These are the response types, and correspond to valid bit 41 * These are the native response types, and correspond to valid bit
36 * patterns of the above flags. One additional valid pattern 42 * patterns of the above flags. One additional valid pattern
37 * is all zeros, which means we don't expect a response. 43 * is all zeros, which means we don't expect a response.
38 */ 44 */
@@ -41,12 +47,30 @@ struct mmc_command {
41#define MMC_RSP_R1B (MMC_RSP_PRESENT|MMC_RSP_CRC|MMC_RSP_OPCODE|MMC_RSP_BUSY) 47#define MMC_RSP_R1B (MMC_RSP_PRESENT|MMC_RSP_CRC|MMC_RSP_OPCODE|MMC_RSP_BUSY)
42#define MMC_RSP_R2 (MMC_RSP_PRESENT|MMC_RSP_136|MMC_RSP_CRC) 48#define MMC_RSP_R2 (MMC_RSP_PRESENT|MMC_RSP_136|MMC_RSP_CRC)
43#define MMC_RSP_R3 (MMC_RSP_PRESENT) 49#define MMC_RSP_R3 (MMC_RSP_PRESENT)
50#define MMC_RSP_R4 (MMC_RSP_PRESENT)
51#define MMC_RSP_R5 (MMC_RSP_PRESENT|MMC_RSP_CRC|MMC_RSP_OPCODE)
44#define MMC_RSP_R6 (MMC_RSP_PRESENT|MMC_RSP_CRC|MMC_RSP_OPCODE) 52#define MMC_RSP_R6 (MMC_RSP_PRESENT|MMC_RSP_CRC|MMC_RSP_OPCODE)
45#define MMC_RSP_R7 (MMC_RSP_PRESENT|MMC_RSP_CRC|MMC_RSP_OPCODE) 53#define MMC_RSP_R7 (MMC_RSP_PRESENT|MMC_RSP_CRC|MMC_RSP_OPCODE)
46 54
47#define mmc_resp_type(cmd) ((cmd)->flags & (MMC_RSP_PRESENT|MMC_RSP_136|MMC_RSP_CRC|MMC_RSP_BUSY|MMC_RSP_OPCODE)) 55#define mmc_resp_type(cmd) ((cmd)->flags & (MMC_RSP_PRESENT|MMC_RSP_136|MMC_RSP_CRC|MMC_RSP_BUSY|MMC_RSP_OPCODE))
48 56
49/* 57/*
58 * These are the SPI response types for MMC, SD, and SDIO cards.
59 * Commands return R1, with maybe more info. Zero is an error type;
60 * callers must always provide the appropriate MMC_RSP_SPI_Rx flags.
61 */
62#define MMC_RSP_SPI_R1 (MMC_RSP_SPI_S1)
63#define MMC_RSP_SPI_R1B (MMC_RSP_SPI_S1|MMC_RSP_SPI_BUSY)
64#define MMC_RSP_SPI_R2 (MMC_RSP_SPI_S1|MMC_RSP_SPI_S2)
65#define MMC_RSP_SPI_R3 (MMC_RSP_SPI_S1|MMC_RSP_SPI_B4)
66#define MMC_RSP_SPI_R4 (MMC_RSP_SPI_S1|MMC_RSP_SPI_B4)
67#define MMC_RSP_SPI_R5 (MMC_RSP_SPI_S1|MMC_RSP_SPI_S2)
68#define MMC_RSP_SPI_R7 (MMC_RSP_SPI_S1|MMC_RSP_SPI_B4)
69
70#define mmc_spi_resp_type(cmd) ((cmd)->flags & \
71 (MMC_RSP_SPI_S1|MMC_RSP_SPI_BUSY|MMC_RSP_SPI_S2|MMC_RSP_SPI_B4))
72
73/*
50 * These are the command types. 74 * These are the command types.
51 */ 75 */
52#define mmc_cmd_type(cmd) ((cmd)->flags & MMC_CMD_MASK) 76#define mmc_cmd_type(cmd) ((cmd)->flags & MMC_CMD_MASK)
@@ -54,12 +78,19 @@ struct mmc_command {
54 unsigned int retries; /* max number of retries */ 78 unsigned int retries; /* max number of retries */
55 unsigned int error; /* command error */ 79 unsigned int error; /* command error */
56 80
57#define MMC_ERR_NONE 0 81/*
58#define MMC_ERR_TIMEOUT 1 82 * Standard errno values are used for errors, but some have specific
59#define MMC_ERR_BADCRC 2 83 * meaning in the MMC layer:
60#define MMC_ERR_FIFO 3 84 *
61#define MMC_ERR_FAILED 4 85 * ETIMEDOUT Card took too long to respond
62#define MMC_ERR_INVALID 5 86 * EILSEQ Basic format problem with the received or sent data
87 * (e.g. CRC check failed, incorrect opcode in response
88 * or bad end bit)
89 * EINVAL Request cannot be performed because of restrictions
90 * in hardware and/or the driver
91 * ENOMEDIUM Host can determine that the slot is empty and is
92 * actively failing requests
93 */
63 94
64 struct mmc_data *data; /* data segment associated with cmd */ 95 struct mmc_data *data; /* data segment associated with cmd */
65 struct mmc_request *mrq; /* associated request */ 96 struct mmc_request *mrq; /* associated request */
@@ -76,7 +107,6 @@ struct mmc_data {
76#define MMC_DATA_WRITE (1 << 8) 107#define MMC_DATA_WRITE (1 << 8)
77#define MMC_DATA_READ (1 << 9) 108#define MMC_DATA_READ (1 << 9)
78#define MMC_DATA_STREAM (1 << 10) 109#define MMC_DATA_STREAM (1 << 10)
79#define MMC_DATA_MULTI (1 << 11)
80 110
81 unsigned int bytes_xfered; 111 unsigned int bytes_xfered;
82 112
@@ -99,14 +129,25 @@ struct mmc_request {
99struct mmc_host; 129struct mmc_host;
100struct mmc_card; 130struct mmc_card;
101 131
102extern int mmc_wait_for_req(struct mmc_host *, struct mmc_request *); 132extern void mmc_wait_for_req(struct mmc_host *, struct mmc_request *);
103extern int mmc_wait_for_cmd(struct mmc_host *, struct mmc_command *, int); 133extern int mmc_wait_for_cmd(struct mmc_host *, struct mmc_command *, int);
104extern int mmc_wait_for_app_cmd(struct mmc_host *, struct mmc_card *, 134extern int mmc_wait_for_app_cmd(struct mmc_host *, struct mmc_card *,
105 struct mmc_command *, int); 135 struct mmc_command *, int);
106 136
107extern void mmc_set_data_timeout(struct mmc_data *, const struct mmc_card *, int); 137extern void mmc_set_data_timeout(struct mmc_data *, const struct mmc_card *);
108 138
109extern void mmc_claim_host(struct mmc_host *host); 139extern int __mmc_claim_host(struct mmc_host *host, atomic_t *abort);
110extern void mmc_release_host(struct mmc_host *host); 140extern void mmc_release_host(struct mmc_host *host);
111 141
142/**
143 * mmc_claim_host - exclusively claim a host
144 * @host: mmc host to claim
145 *
146 * Claim a host for a set of operations.
147 */
148static inline void mmc_claim_host(struct mmc_host *host)
149{
150 __mmc_claim_host(host, NULL);
151}
152
112#endif 153#endif
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index b1350dfd3e91..125eee1407ff 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -10,6 +10,8 @@
10#ifndef LINUX_MMC_HOST_H 10#ifndef LINUX_MMC_HOST_H
11#define LINUX_MMC_HOST_H 11#define LINUX_MMC_HOST_H
12 12
13#include <linux/leds.h>
14
13#include <linux/mmc/core.h> 15#include <linux/mmc/core.h>
14 16
15struct mmc_ios { 17struct mmc_ios {
@@ -51,6 +53,7 @@ struct mmc_host_ops {
51 void (*request)(struct mmc_host *host, struct mmc_request *req); 53 void (*request)(struct mmc_host *host, struct mmc_request *req);
52 void (*set_ios)(struct mmc_host *host, struct mmc_ios *ios); 54 void (*set_ios)(struct mmc_host *host, struct mmc_ios *ios);
53 int (*get_ro)(struct mmc_host *host); 55 int (*get_ro)(struct mmc_host *host);
56 void (*enable_sdio_irq)(struct mmc_host *host, int enable);
54}; 57};
55 58
56struct mmc_card; 59struct mmc_card;
@@ -87,9 +90,10 @@ struct mmc_host {
87 90
88#define MMC_CAP_4_BIT_DATA (1 << 0) /* Can the host do 4 bit transfers */ 91#define MMC_CAP_4_BIT_DATA (1 << 0) /* Can the host do 4 bit transfers */
89#define MMC_CAP_MULTIWRITE (1 << 1) /* Can accurately report bytes sent to card on error */ 92#define MMC_CAP_MULTIWRITE (1 << 1) /* Can accurately report bytes sent to card on error */
90#define MMC_CAP_BYTEBLOCK (1 << 2) /* Can do non-log2 block sizes */ 93#define MMC_CAP_MMC_HIGHSPEED (1 << 2) /* Can do MMC high-speed timing */
91#define MMC_CAP_MMC_HIGHSPEED (1 << 3) /* Can do MMC high-speed timing */ 94#define MMC_CAP_SD_HIGHSPEED (1 << 3) /* Can do SD high-speed timing */
92#define MMC_CAP_SD_HIGHSPEED (1 << 4) /* Can do SD high-speed timing */ 95#define MMC_CAP_SDIO_IRQ (1 << 4) /* Can signal pending SDIO IRQs */
96#define MMC_CAP_SPI (1 << 5) /* Talks only SPI protocols */
93 97
94 /* host specific block data */ 98 /* host specific block data */
95 unsigned int max_seg_size; /* see blk_queue_max_segment_size */ 99 unsigned int max_seg_size; /* see blk_queue_max_segment_size */
@@ -106,6 +110,14 @@ struct mmc_host {
106 struct mmc_ios ios; /* current io bus settings */ 110 struct mmc_ios ios; /* current io bus settings */
107 u32 ocr; /* the current OCR setting */ 111 u32 ocr; /* the current OCR setting */
108 112
113 /* group bitfields together to minimize padding */
114 unsigned int use_spi_crc:1;
115 unsigned int claimed:1; /* host exclusively claimed */
116 unsigned int bus_dead:1; /* bus has been released */
117#ifdef CONFIG_MMC_DEBUG
118 unsigned int removed:1; /* host is being removed */
119#endif
120
109 unsigned int mode; /* current card mode of host */ 121 unsigned int mode; /* current card mode of host */
110#define MMC_MODE_MMC 0 122#define MMC_MODE_MMC 0
111#define MMC_MODE_SD 1 123#define MMC_MODE_SD 1
@@ -113,16 +125,19 @@ struct mmc_host {
113 struct mmc_card *card; /* device attached to this host */ 125 struct mmc_card *card; /* device attached to this host */
114 126
115 wait_queue_head_t wq; 127 wait_queue_head_t wq;
116 unsigned int claimed:1; /* host exclusively claimed */
117 128
118 struct delayed_work detect; 129 struct delayed_work detect;
119#ifdef CONFIG_MMC_DEBUG
120 unsigned int removed:1; /* host is being removed */
121#endif
122 130
123 const struct mmc_bus_ops *bus_ops; /* current bus driver */ 131 const struct mmc_bus_ops *bus_ops; /* current bus driver */
124 unsigned int bus_refs; /* reference counter */ 132 unsigned int bus_refs; /* reference counter */
125 unsigned int bus_dead:1; /* bus has been released */ 133
134 unsigned int sdio_irqs;
135 struct task_struct *sdio_irq_thread;
136 atomic_t sdio_irq_thread_abort;
137
138#ifdef CONFIG_LEDS_TRIGGERS
139 struct led_trigger *led; /* activity led */
140#endif
126 141
127 unsigned long private[0] ____cacheline_aligned; 142 unsigned long private[0] ____cacheline_aligned;
128}; 143};
@@ -137,6 +152,8 @@ static inline void *mmc_priv(struct mmc_host *host)
137 return (void *)host->private; 152 return (void *)host->private;
138} 153}
139 154
155#define mmc_host_is_spi(host) ((host)->caps & MMC_CAP_SPI)
156
140#define mmc_dev(x) ((x)->parent) 157#define mmc_dev(x) ((x)->parent)
141#define mmc_classdev(x) (&(x)->class_dev) 158#define mmc_classdev(x) (&(x)->class_dev)
142#define mmc_hostname(x) ((x)->class_dev.bus_id) 159#define mmc_hostname(x) ((x)->class_dev.bus_id)
@@ -147,5 +164,11 @@ extern int mmc_resume_host(struct mmc_host *);
147extern void mmc_detect_change(struct mmc_host *, unsigned long delay); 164extern void mmc_detect_change(struct mmc_host *, unsigned long delay);
148extern void mmc_request_done(struct mmc_host *, struct mmc_request *); 165extern void mmc_request_done(struct mmc_host *, struct mmc_request *);
149 166
167static inline void mmc_signal_sdio_irq(struct mmc_host *host)
168{
169 host->ops->enable_sdio_irq(host, 0);
170 wake_up_process(host->sdio_irq_thread);
171}
172
150#endif 173#endif
151 174
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index e3ed9b95040e..4236fbf0b6fb 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -27,7 +27,7 @@
27 27
28/* Standard MMC commands (4.1) type argument response */ 28/* Standard MMC commands (4.1) type argument response */
29 /* class 1 */ 29 /* class 1 */
30#define MMC_GO_IDLE_STATE 0 /* bc */ 30#define MMC_GO_IDLE_STATE 0 /* bc */
31#define MMC_SEND_OP_COND 1 /* bcr [31:0] OCR R3 */ 31#define MMC_SEND_OP_COND 1 /* bcr [31:0] OCR R3 */
32#define MMC_ALL_SEND_CID 2 /* bcr R2 */ 32#define MMC_ALL_SEND_CID 2 /* bcr R2 */
33#define MMC_SET_RELATIVE_ADDR 3 /* ac [31:16] RCA R1 */ 33#define MMC_SET_RELATIVE_ADDR 3 /* ac [31:16] RCA R1 */
@@ -39,8 +39,10 @@
39#define MMC_SEND_CID 10 /* ac [31:16] RCA R2 */ 39#define MMC_SEND_CID 10 /* ac [31:16] RCA R2 */
40#define MMC_READ_DAT_UNTIL_STOP 11 /* adtc [31:0] dadr R1 */ 40#define MMC_READ_DAT_UNTIL_STOP 11 /* adtc [31:0] dadr R1 */
41#define MMC_STOP_TRANSMISSION 12 /* ac R1b */ 41#define MMC_STOP_TRANSMISSION 12 /* ac R1b */
42#define MMC_SEND_STATUS 13 /* ac [31:16] RCA R1 */ 42#define MMC_SEND_STATUS 13 /* ac [31:16] RCA R1 */
43#define MMC_GO_INACTIVE_STATE 15 /* ac [31:16] RCA */ 43#define MMC_GO_INACTIVE_STATE 15 /* ac [31:16] RCA */
44#define MMC_SPI_READ_OCR 58 /* spi spi_R3 */
45#define MMC_SPI_CRC_ON_OFF 59 /* spi [0:0] flag spi_R1 */
44 46
45 /* class 2 */ 47 /* class 2 */
46#define MMC_SET_BLOCKLEN 16 /* ac [31:0] block len R1 */ 48#define MMC_SET_BLOCKLEN 16 /* ac [31:0] block len R1 */
@@ -90,15 +92,15 @@
90 */ 92 */
91 93
92/* 94/*
93 MMC status in R1 95 MMC status in R1, for native mode (SPI bits are different)
94 Type 96 Type
95 e : error bit 97 e : error bit
96 s : status bit 98 s : status bit
97 r : detected and set for the actual command response 99 r : detected and set for the actual command response
98 x : detected and set during command execution. the host must poll 100 x : detected and set during command execution. the host must poll
99 the card by sending status command in order to read these bits. 101 the card by sending status command in order to read these bits.
100 Clear condition 102 Clear condition
101 a : according to the card state 103 a : according to the card state
102 b : always related to the previous command. Reception of 104 b : always related to the previous command. Reception of
103 a valid command will clear it (with a delay of one command) 105 a valid command will clear it (with a delay of one command)
104 c : clear by read 106 c : clear by read
@@ -124,10 +126,33 @@
124#define R1_CARD_ECC_DISABLED (1 << 14) /* sx, a */ 126#define R1_CARD_ECC_DISABLED (1 << 14) /* sx, a */
125#define R1_ERASE_RESET (1 << 13) /* sr, c */ 127#define R1_ERASE_RESET (1 << 13) /* sr, c */
126#define R1_STATUS(x) (x & 0xFFFFE000) 128#define R1_STATUS(x) (x & 0xFFFFE000)
127#define R1_CURRENT_STATE(x) ((x & 0x00001E00) >> 9) /* sx, b (4 bits) */ 129#define R1_CURRENT_STATE(x) ((x & 0x00001E00) >> 9) /* sx, b (4 bits) */
128#define R1_READY_FOR_DATA (1 << 8) /* sx, a */ 130#define R1_READY_FOR_DATA (1 << 8) /* sx, a */
129#define R1_APP_CMD (1 << 5) /* sr, c */ 131#define R1_APP_CMD (1 << 5) /* sr, c */
130 132
133/*
134 * MMC/SD in SPI mode reports R1 status always, and R2 for SEND_STATUS
135 * R1 is the low order byte; R2 is the next highest byte, when present.
136 */
137#define R1_SPI_IDLE (1 << 0)
138#define R1_SPI_ERASE_RESET (1 << 1)
139#define R1_SPI_ILLEGAL_COMMAND (1 << 2)
140#define R1_SPI_COM_CRC (1 << 3)
141#define R1_SPI_ERASE_SEQ (1 << 4)
142#define R1_SPI_ADDRESS (1 << 5)
143#define R1_SPI_PARAMETER (1 << 6)
144/* R1 bit 7 is always zero */
145#define R2_SPI_CARD_LOCKED (1 << 8)
146#define R2_SPI_WP_ERASE_SKIP (1 << 9) /* or lock/unlock fail */
147#define R2_SPI_LOCK_UNLOCK_FAIL R2_SPI_WP_ERASE_SKIP
148#define R2_SPI_ERROR (1 << 10)
149#define R2_SPI_CC_ERROR (1 << 11)
150#define R2_SPI_CARD_ECC_ERROR (1 << 12)
151#define R2_SPI_WP_VIOLATION (1 << 13)
152#define R2_SPI_ERASE_PARAM (1 << 14)
153#define R2_SPI_OUT_OF_RANGE (1 << 15) /* or CSD overwrite */
154#define R2_SPI_CSD_OVERWRITE R2_SPI_OUT_OF_RANGE
155
131/* These are unpacked versions of the actual responses */ 156/* These are unpacked versions of the actual responses */
132 157
133struct _mmc_csd { 158struct _mmc_csd {
@@ -182,6 +207,7 @@ struct _mmc_csd {
182 */ 207 */
183#define CCC_BASIC (1<<0) /* (0) Basic protocol functions */ 208#define CCC_BASIC (1<<0) /* (0) Basic protocol functions */
184 /* (CMD0,1,2,3,4,7,9,10,12,13,15) */ 209 /* (CMD0,1,2,3,4,7,9,10,12,13,15) */
210 /* (and for SPI, CMD58,59) */
185#define CCC_STREAM_READ (1<<1) /* (1) Stream read commands */ 211#define CCC_STREAM_READ (1<<1) /* (1) Stream read commands */
186 /* (CMD11) */ 212 /* (CMD11) */
187#define CCC_BLOCK_READ (1<<2) /* (2) Block read commands */ 213#define CCC_BLOCK_READ (1<<2) /* (2) Block read commands */
@@ -227,6 +253,7 @@ struct _mmc_csd {
227#define EXT_CSD_BUS_WIDTH 183 /* R/W */ 253#define EXT_CSD_BUS_WIDTH 183 /* R/W */
228#define EXT_CSD_HS_TIMING 185 /* R/W */ 254#define EXT_CSD_HS_TIMING 185 /* R/W */
229#define EXT_CSD_CARD_TYPE 196 /* RO */ 255#define EXT_CSD_CARD_TYPE 196 /* RO */
256#define EXT_CSD_REV 192 /* RO */
230#define EXT_CSD_SEC_CNT 212 /* RO, 4 bytes */ 257#define EXT_CSD_SEC_CNT 212 /* RO, 4 bytes */
231 258
232/* 259/*
diff --git a/include/linux/mmc/sdio.h b/include/linux/mmc/sdio.h
new file mode 100644
index 000000000000..47ba464f5170
--- /dev/null
+++ b/include/linux/mmc/sdio.h
@@ -0,0 +1,159 @@
1/*
2 * include/linux/mmc/sdio.h
3 *
4 * Copyright 2006-2007 Pierre Ossman
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or (at
9 * your option) any later version.
10 */
11
12#ifndef MMC_SDIO_H
13#define MMC_SDIO_H
14
15/* SDIO commands type argument response */
16#define SD_IO_SEND_OP_COND 5 /* bcr [23:0] OCR R4 */
17#define SD_IO_RW_DIRECT 52 /* ac [31:0] See below R5 */
18#define SD_IO_RW_EXTENDED 53 /* adtc [31:0] See below R5 */
19
20/*
21 * SD_IO_RW_DIRECT argument format:
22 *
23 * [31] R/W flag
24 * [30:28] Function number
25 * [27] RAW flag
26 * [25:9] Register address
27 * [7:0] Data
28 */
29
30/*
31 * SD_IO_RW_EXTENDED argument format:
32 *
33 * [31] R/W flag
34 * [30:28] Function number
35 * [27] Block mode
36 * [26] Increment address
37 * [25:9] Register address
38 * [8:0] Byte/block count
39 */
40
41/*
42 SDIO status in R5
43 Type
44 e : error bit
45 s : status bit
46 r : detected and set for the actual command response
47 x : detected and set during command execution. the host must poll
48 the card by sending status command in order to read these bits.
49 Clear condition
50 a : according to the card state
51 b : always related to the previous command. Reception of
52 a valid command will clear it (with a delay of one command)
53 c : clear by read
54 */
55
56#define R5_COM_CRC_ERROR (1 << 15) /* er, b */
57#define R5_ILLEGAL_COMMAND (1 << 14) /* er, b */
58#define R5_ERROR (1 << 11) /* erx, c */
59#define R5_FUNCTION_NUMBER (1 << 9) /* er, c */
60#define R5_OUT_OF_RANGE (1 << 8) /* er, c */
61#define R5_STATUS(x) (x & 0xCB00)
62#define R5_IO_CURRENT_STATE(x) ((x & 0x3000) >> 12) /* s, b */
63
64/*
65 * Card Common Control Registers (CCCR)
66 */
67
68#define SDIO_CCCR_CCCR 0x00
69
70#define SDIO_CCCR_REV_1_00 0 /* CCCR/FBR Version 1.00 */
71#define SDIO_CCCR_REV_1_10 1 /* CCCR/FBR Version 1.10 */
72#define SDIO_CCCR_REV_1_20 2 /* CCCR/FBR Version 1.20 */
73
74#define SDIO_SDIO_REV_1_00 0 /* SDIO Spec Version 1.00 */
75#define SDIO_SDIO_REV_1_10 1 /* SDIO Spec Version 1.10 */
76#define SDIO_SDIO_REV_1_20 2 /* SDIO Spec Version 1.20 */
77#define SDIO_SDIO_REV_2_00 3 /* SDIO Spec Version 2.00 */
78
79#define SDIO_CCCR_SD 0x01
80
81#define SDIO_SD_REV_1_01 0 /* SD Physical Spec Version 1.01 */
82#define SDIO_SD_REV_1_10 1 /* SD Physical Spec Version 1.10 */
83#define SDIO_SD_REV_2_00 2 /* SD Physical Spec Version 2.00 */
84
85#define SDIO_CCCR_IOEx 0x02
86#define SDIO_CCCR_IORx 0x03
87
88#define SDIO_CCCR_IENx 0x04 /* Function/Master Interrupt Enable */
89#define SDIO_CCCR_INTx 0x05 /* Function Interrupt Pending */
90
91#define SDIO_CCCR_ABORT 0x06 /* function abort/card reset */
92
93#define SDIO_CCCR_IF 0x07 /* bus interface controls */
94
95#define SDIO_BUS_WIDTH_1BIT 0x00
96#define SDIO_BUS_WIDTH_4BIT 0x02
97
98#define SDIO_BUS_CD_DISABLE 0x80 /* disable pull-up on DAT3 (pin 1) */
99
100#define SDIO_CCCR_CAPS 0x08
101
102#define SDIO_CCCR_CAP_SDC 0x01 /* can do CMD52 while data transfer */
103#define SDIO_CCCR_CAP_SMB 0x02 /* can do multi-block xfers (CMD53) */
104#define SDIO_CCCR_CAP_SRW 0x04 /* supports read-wait protocol */
105#define SDIO_CCCR_CAP_SBS 0x08 /* supports suspend/resume */
106#define SDIO_CCCR_CAP_S4MI 0x10 /* interrupt during 4-bit CMD53 */
107#define SDIO_CCCR_CAP_E4MI 0x20 /* enable ints during 4-bit CMD53 */
108#define SDIO_CCCR_CAP_LSC 0x40 /* low speed card */
109#define SDIO_CCCR_CAP_4BLS 0x80 /* 4 bit low speed card */
110
111#define SDIO_CCCR_CIS 0x09 /* common CIS pointer (3 bytes) */
112
113/* Following 4 regs are valid only if SBS is set */
114#define SDIO_CCCR_SUSPEND 0x0c
115#define SDIO_CCCR_SELx 0x0d
116#define SDIO_CCCR_EXECx 0x0e
117#define SDIO_CCCR_READYx 0x0f
118
119#define SDIO_CCCR_BLKSIZE 0x10
120
121#define SDIO_CCCR_POWER 0x12
122
123#define SDIO_POWER_SMPC 0x01 /* Supports Master Power Control */
124#define SDIO_POWER_EMPC 0x02 /* Enable Master Power Control */
125
126#define SDIO_CCCR_SPEED 0x13
127
128#define SDIO_SPEED_SHS 0x01 /* Supports High-Speed mode */
129#define SDIO_SPEED_EHS 0x02 /* Enable High-Speed mode */
130
131/*
132 * Function Basic Registers (FBR)
133 */
134
135#define SDIO_FBR_BASE(f) ((f) * 0x100) /* base of function f's FBRs */
136
137#define SDIO_FBR_STD_IF 0x00
138
139#define SDIO_FBR_SUPPORTS_CSA 0x40 /* supports Code Storage Area */
140#define SDIO_FBR_ENABLE_CSA 0x80 /* enable Code Storage Area */
141
142#define SDIO_FBR_STD_IF_EXT 0x01
143
144#define SDIO_FBR_POWER 0x02
145
146#define SDIO_FBR_POWER_SPS 0x01 /* Supports Power Selection */
147#define SDIO_FBR_POWER_EPS 0x02 /* Enable (low) Power Selection */
148
149#define SDIO_FBR_CIS 0x09 /* CIS pointer (3 bytes) */
150
151
152#define SDIO_FBR_CSA 0x0C /* CSA pointer (3 bytes) */
153
154#define SDIO_FBR_CSA_DATA 0x0F
155
156#define SDIO_FBR_BLKSIZE 0x10 /* block size (2 bytes) */
157
158#endif
159
diff --git a/include/linux/mmc/sdio_func.h b/include/linux/mmc/sdio_func.h
new file mode 100644
index 000000000000..b050f4d7b41f
--- /dev/null
+++ b/include/linux/mmc/sdio_func.h
@@ -0,0 +1,153 @@
1/*
2 * include/linux/mmc/sdio_func.h
3 *
4 * Copyright 2007 Pierre Ossman
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or (at
9 * your option) any later version.
10 */
11
12#ifndef MMC_SDIO_FUNC_H
13#define MMC_SDIO_FUNC_H
14
15#include <linux/device.h>
16#include <linux/mod_devicetable.h>
17
18struct mmc_card;
19struct sdio_func;
20
21typedef void (sdio_irq_handler_t)(struct sdio_func *);
22
23/*
24 * SDIO function CIS tuple (unknown to the core)
25 */
26struct sdio_func_tuple {
27 struct sdio_func_tuple *next;
28 unsigned char code;
29 unsigned char size;
30 unsigned char data[0];
31};
32
33/*
34 * SDIO function devices
35 */
36struct sdio_func {
37 struct mmc_card *card; /* the card this device belongs to */
38 struct device dev; /* the device */
39 sdio_irq_handler_t *irq_handler; /* IRQ callback */
40 unsigned int num; /* function number */
41
42 unsigned char class; /* standard interface class */
43 unsigned short vendor; /* vendor id */
44 unsigned short device; /* device id */
45
46 unsigned max_blksize; /* maximum block size */
47 unsigned cur_blksize; /* current block size */
48
49 unsigned int state; /* function state */
50#define SDIO_STATE_PRESENT (1<<0) /* present in sysfs */
51
52 u8 tmpbuf[4]; /* DMA:able scratch buffer */
53
54 unsigned num_info; /* number of info strings */
55 const char **info; /* info strings */
56
57 struct sdio_func_tuple *tuples;
58};
59
60#define sdio_func_present(f) ((f)->state & SDIO_STATE_PRESENT)
61
62#define sdio_func_set_present(f) ((f)->state |= SDIO_STATE_PRESENT)
63
64#define sdio_func_id(f) ((f)->dev.bus_id)
65
66#define sdio_get_drvdata(f) dev_get_drvdata(&(f)->dev)
67#define sdio_set_drvdata(f,d) dev_set_drvdata(&(f)->dev, d)
68
69/*
70 * SDIO function device driver
71 */
72struct sdio_driver {
73 char *name;
74 const struct sdio_device_id *id_table;
75
76 int (*probe)(struct sdio_func *, const struct sdio_device_id *);
77 void (*remove)(struct sdio_func *);
78
79 struct device_driver drv;
80};
81
82/**
83 * SDIO_DEVICE - macro used to describe a specific SDIO device
84 * @vend: the 16 bit manufacturer code
85 * @dev: the 16 bit function id
86 *
87 * This macro is used to create a struct sdio_device_id that matches a
88 * specific device. The class field will be set to SDIO_ANY_ID.
89 */
90#define SDIO_DEVICE(vend,dev) \
91 .class = SDIO_ANY_ID, \
92 .vendor = (vend), .device = (dev)
93
94/**
95 * SDIO_DEVICE_CLASS - macro used to describe a specific SDIO device class
96 * @dev_class: the 8 bit standard interface code
97 *
98 * This macro is used to create a struct sdio_device_id that matches a
99 * specific standard SDIO function type. The vendor and device fields will
100 * be set to SDIO_ANY_ID.
101 */
102#define SDIO_DEVICE_CLASS(dev_class) \
103 .class = (dev_class), \
104 .vendor = SDIO_ANY_ID, .device = SDIO_ANY_ID
105
106extern int sdio_register_driver(struct sdio_driver *);
107extern void sdio_unregister_driver(struct sdio_driver *);
108
109/*
110 * SDIO I/O operations
111 */
112extern void sdio_claim_host(struct sdio_func *func);
113extern void sdio_release_host(struct sdio_func *func);
114
115extern int sdio_enable_func(struct sdio_func *func);
116extern int sdio_disable_func(struct sdio_func *func);
117
118extern int sdio_set_block_size(struct sdio_func *func, unsigned blksz);
119
120extern int sdio_claim_irq(struct sdio_func *func, sdio_irq_handler_t *handler);
121extern int sdio_release_irq(struct sdio_func *func);
122
123extern unsigned char sdio_readb(struct sdio_func *func,
124 unsigned int addr, int *err_ret);
125extern unsigned short sdio_readw(struct sdio_func *func,
126 unsigned int addr, int *err_ret);
127extern unsigned long sdio_readl(struct sdio_func *func,
128 unsigned int addr, int *err_ret);
129
130extern int sdio_memcpy_fromio(struct sdio_func *func, void *dst,
131 unsigned int addr, int count);
132extern int sdio_readsb(struct sdio_func *func, void *dst,
133 unsigned int addr, int count);
134
135extern void sdio_writeb(struct sdio_func *func, unsigned char b,
136 unsigned int addr, int *err_ret);
137extern void sdio_writew(struct sdio_func *func, unsigned short b,
138 unsigned int addr, int *err_ret);
139extern void sdio_writel(struct sdio_func *func, unsigned long b,
140 unsigned int addr, int *err_ret);
141
142extern int sdio_memcpy_toio(struct sdio_func *func, unsigned int addr,
143 void *src, int count);
144extern int sdio_writesb(struct sdio_func *func, unsigned int addr,
145 void *src, int count);
146
147extern unsigned char sdio_f0_readb(struct sdio_func *func,
148 unsigned int addr, int *err_ret);
149extern void sdio_f0_writeb(struct sdio_func *func, unsigned char b,
150 unsigned int addr, int *err_ret);
151
152#endif
153
diff --git a/include/linux/mmc/sdio_ids.h b/include/linux/mmc/sdio_ids.h
new file mode 100644
index 000000000000..09306d47ff5e
--- /dev/null
+++ b/include/linux/mmc/sdio_ids.h
@@ -0,0 +1,23 @@
1/*
2 * SDIO Classes, Interface Types, Manufacturer IDs, etc.
3 */
4
5#ifndef MMC_SDIO_IDS_H
6#define MMC_SDIO_IDS_H
7
8/*
9 * Standard SDIO Function Interfaces
10 */
11
12#define SDIO_CLASS_NONE 0x00 /* Not a SDIO standard interface */
13#define SDIO_CLASS_UART 0x01 /* standard UART interface */
14#define SDIO_CLASS_BT_A 0x02 /* Type-A BlueTooth std interface */
15#define SDIO_CLASS_BT_B 0x03 /* Type-B BlueTooth std interface */
16#define SDIO_CLASS_GPS 0x04 /* GPS standard interface */
17#define SDIO_CLASS_CAMERA 0x05 /* Camera standard interface */
18#define SDIO_CLASS_PHS 0x06 /* PHS standard interface */
19#define SDIO_CLASS_WLAN 0x07 /* WLAN interface */
20#define SDIO_CLASS_ATA 0x08 /* Embedded SDIO-ATA std interface */
21
22
23#endif
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index da8eb8ad9e9b..4e5627379b09 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -120,7 +120,6 @@ enum zone_type {
120 * --------------------------- 120 * ---------------------------
121 * parisc, ia64, sparc <4G 121 * parisc, ia64, sparc <4G
122 * s390 <2G 122 * s390 <2G
123 * arm26 <48M
124 * arm Various 123 * arm Various
125 * alpha Unlimited or 0-16MB. 124 * alpha Unlimited or 0-16MB.
126 * 125 *
@@ -411,6 +410,24 @@ struct zonelist {
411#endif 410#endif
412}; 411};
413 412
413#ifdef CONFIG_NUMA
414/*
415 * Only custom zonelists like MPOL_BIND need to be filtered as part of
416 * policies. As described in the comment for struct zonelist_cache, these
417 * zonelists will not have a zlcache so zlcache_ptr will not be set. Use
418 * that to determine if the zonelists needs to be filtered or not.
419 */
420static inline int alloc_should_filter_zonelist(struct zonelist *zonelist)
421{
422 return !zonelist->zlcache_ptr;
423}
424#else
425static inline int alloc_should_filter_zonelist(struct zonelist *zonelist)
426{
427 return 0;
428}
429#endif /* CONFIG_NUMA */
430
414#ifdef CONFIG_ARCH_POPULATES_NODE_MAP 431#ifdef CONFIG_ARCH_POPULATES_NODE_MAP
415struct node_active_region { 432struct node_active_region {
416 unsigned long start_pfn; 433 unsigned long start_pfn;
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index af04a555b52c..74523d999f7a 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -159,6 +159,13 @@ struct ap_device_id {
159 159
160#define AP_DEVICE_ID_MATCH_DEVICE_TYPE 0x01 160#define AP_DEVICE_ID_MATCH_DEVICE_TYPE 0x01
161 161
162#define ACPI_ID_LEN 16 /* only 9 bytes needed here, 16 bytes are used */
163 /* to workaround crosscompile issues */
164
165struct acpi_device_id {
166 __u8 id[ACPI_ID_LEN];
167 kernel_ulong_t driver_data;
168};
162 169
163#define PNP_ID_LEN 8 170#define PNP_ID_LEN 8
164#define PNP_MAX_DEVICES 8 171#define PNP_MAX_DEVICES 8
@@ -333,4 +340,30 @@ struct parisc_device_id {
333#define PA_HVERSION_ANY_ID 0xffff 340#define PA_HVERSION_ANY_ID 0xffff
334#define PA_SVERSION_ANY_ID 0xffffffff 341#define PA_SVERSION_ANY_ID 0xffffffff
335 342
343/* SDIO */
344
345#define SDIO_ANY_ID (~0)
346
347struct sdio_device_id {
348 __u8 class; /* Standard interface or SDIO_ANY_ID */
349 __u16 vendor; /* Vendor or SDIO_ANY_ID */
350 __u16 device; /* Device ID or SDIO_ANY_ID */
351 kernel_ulong_t driver_data; /* Data private to the driver */
352};
353
354/* SSB core, see drivers/ssb/ */
355struct ssb_device_id {
356 __u16 vendor;
357 __u16 coreid;
358 __u8 revision;
359};
360#define SSB_DEVICE(_vendor, _coreid, _revision) \
361 { .vendor = _vendor, .coreid = _coreid, .revision = _revision, }
362#define SSB_DEVTABLE_END \
363 { 0, },
364
365#define SSB_ANY_VENDOR 0xFFFF
366#define SSB_ANY_ID 0xFFFF
367#define SSB_ANY_REV 0xFF
368
336#endif /* LINUX_MOD_DEVICETABLE_H */ 369#endif /* LINUX_MOD_DEVICETABLE_H */
diff --git a/include/linux/mv643xx.h b/include/linux/mv643xx.h
index b021b3a2b65a..9c8049005052 100644
--- a/include/linux/mv643xx.h
+++ b/include/linux/mv643xx.h
@@ -1302,4 +1302,12 @@ struct mv643xx_eth_platform_data {
1302 u8 mac_addr[6]; /* mac address if non-zero*/ 1302 u8 mac_addr[6]; /* mac address if non-zero*/
1303}; 1303};
1304 1304
1305/* Watchdog Platform Device, Driver Data */
1306#define MV64x60_WDT_NAME "mv64x60_wdt"
1307
1308struct mv64x60_wdt_pdata {
1309 int timeout; /* watchdog expiry in seconds, default 10 */
1310 int bus_clk; /* bus clock in MHz, default 133 */
1311};
1312
1305#endif /* __ASM_MV643XX_H */ 1313#endif /* __ASM_MV643XX_H */
diff --git a/include/linux/namei.h b/include/linux/namei.h
index b7dd24917f0d..6c38efbd810f 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -69,8 +69,8 @@ extern int FASTCALL(__user_walk_fd(int dfd, const char __user *, unsigned, struc
69#define user_path_walk_link(name,nd) \ 69#define user_path_walk_link(name,nd) \
70 __user_walk_fd(AT_FDCWD, name, 0, nd) 70 __user_walk_fd(AT_FDCWD, name, 0, nd)
71extern int FASTCALL(path_lookup(const char *, unsigned, struct nameidata *)); 71extern int FASTCALL(path_lookup(const char *, unsigned, struct nameidata *));
72extern int FASTCALL(path_walk(const char *, struct nameidata *)); 72extern int vfs_path_lookup(struct dentry *, struct vfsmount *,
73extern int FASTCALL(link_path_walk(const char *, struct nameidata *)); 73 const char *, unsigned int, struct nameidata *);
74extern void path_release(struct nameidata *); 74extern void path_release(struct nameidata *);
75extern void path_release_on_umount(struct nameidata *); 75extern void path_release_on_umount(struct nameidata *);
76 76
diff --git a/include/linux/net.h b/include/linux/net.h
index efc45177b503..c136abce7ef6 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -23,6 +23,7 @@
23 23
24struct poll_table_struct; 24struct poll_table_struct;
25struct inode; 25struct inode;
26struct net;
26 27
27#define NPROTO 34 /* should be enough for now.. */ 28#define NPROTO 34 /* should be enough for now.. */
28 29
@@ -169,7 +170,7 @@ struct proto_ops {
169 170
170struct net_proto_family { 171struct net_proto_family {
171 int family; 172 int family;
172 int (*create)(struct socket *sock, int protocol); 173 int (*create)(struct net *net, struct socket *sock, int protocol);
173 struct module *owner; 174 struct module *owner;
174}; 175};
175 176
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index da7a13c97eb8..5a11f889e56a 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -31,6 +31,7 @@
31 31
32#ifdef __KERNEL__ 32#ifdef __KERNEL__
33#include <linux/timer.h> 33#include <linux/timer.h>
34#include <linux/delay.h>
34#include <asm/atomic.h> 35#include <asm/atomic.h>
35#include <asm/cache.h> 36#include <asm/cache.h>
36#include <asm/byteorder.h> 37#include <asm/byteorder.h>
@@ -38,6 +39,9 @@
38#include <linux/device.h> 39#include <linux/device.h>
39#include <linux/percpu.h> 40#include <linux/percpu.h>
40#include <linux/dmaengine.h> 41#include <linux/dmaengine.h>
42#include <linux/workqueue.h>
43
44#include <net/net_namespace.h>
41 45
42struct vlan_group; 46struct vlan_group;
43struct ethtool_ops; 47struct ethtool_ops;
@@ -246,6 +250,19 @@ struct hh_cache
246#define LL_RESERVED_SPACE_EXTRA(dev,extra) \ 250#define LL_RESERVED_SPACE_EXTRA(dev,extra) \
247 ((((dev)->hard_header_len+extra)&~(HH_DATA_MOD - 1)) + HH_DATA_MOD) 251 ((((dev)->hard_header_len+extra)&~(HH_DATA_MOD - 1)) + HH_DATA_MOD)
248 252
253struct header_ops {
254 int (*create) (struct sk_buff *skb, struct net_device *dev,
255 unsigned short type, const void *daddr,
256 const void *saddr, unsigned len);
257 int (*parse)(const struct sk_buff *skb, unsigned char *haddr);
258 int (*rebuild)(struct sk_buff *skb);
259#define HAVE_HEADER_CACHE
260 int (*cache)(const struct neighbour *neigh, struct hh_cache *hh);
261 void (*cache_update)(struct hh_cache *hh,
262 const struct net_device *dev,
263 const unsigned char *haddr);
264};
265
249/* These flag bits are private to the generic network queueing 266/* These flag bits are private to the generic network queueing
250 * layer, they may not be explicitly referenced by any other 267 * layer, they may not be explicitly referenced by any other
251 * code. 268 * code.
@@ -258,7 +275,6 @@ enum netdev_state_t
258 __LINK_STATE_PRESENT, 275 __LINK_STATE_PRESENT,
259 __LINK_STATE_SCHED, 276 __LINK_STATE_SCHED,
260 __LINK_STATE_NOCARRIER, 277 __LINK_STATE_NOCARRIER,
261 __LINK_STATE_RX_SCHED,
262 __LINK_STATE_LINKWATCH_PENDING, 278 __LINK_STATE_LINKWATCH_PENDING,
263 __LINK_STATE_DORMANT, 279 __LINK_STATE_DORMANT,
264 __LINK_STATE_QDISC_RUNNING, 280 __LINK_STATE_QDISC_RUNNING,
@@ -278,6 +294,120 @@ struct netdev_boot_setup {
278extern int __init netdev_boot_setup(char *str); 294extern int __init netdev_boot_setup(char *str);
279 295
280/* 296/*
297 * Structure for NAPI scheduling similar to tasklet but with weighting
298 */
299struct napi_struct {
300 /* The poll_list must only be managed by the entity which
301 * changes the state of the NAPI_STATE_SCHED bit. This means
302 * whoever atomically sets that bit can add this napi_struct
303 * to the per-cpu poll_list, and whoever clears that bit
304 * can remove from the list right before clearing the bit.
305 */
306 struct list_head poll_list;
307
308 unsigned long state;
309 int weight;
310 int (*poll)(struct napi_struct *, int);
311#ifdef CONFIG_NETPOLL
312 spinlock_t poll_lock;
313 int poll_owner;
314 struct net_device *dev;
315 struct list_head dev_list;
316#endif
317};
318
319enum
320{
321 NAPI_STATE_SCHED, /* Poll is scheduled */
322};
323
324extern void FASTCALL(__napi_schedule(struct napi_struct *n));
325
326/**
327 * napi_schedule_prep - check if napi can be scheduled
328 * @n: napi context
329 *
330 * Test if NAPI routine is already running, and if not mark
331 * it as running. This is used as a condition variable
332 * insure only one NAPI poll instance runs
333 */
334static inline int napi_schedule_prep(struct napi_struct *n)
335{
336 return !test_and_set_bit(NAPI_STATE_SCHED, &n->state);
337}
338
339/**
340 * napi_schedule - schedule NAPI poll
341 * @n: napi context
342 *
343 * Schedule NAPI poll routine to be called if it is not already
344 * running.
345 */
346static inline void napi_schedule(struct napi_struct *n)
347{
348 if (napi_schedule_prep(n))
349 __napi_schedule(n);
350}
351
352/* Try to reschedule poll. Called by dev->poll() after napi_complete(). */
353static inline int napi_reschedule(struct napi_struct *napi)
354{
355 if (napi_schedule_prep(napi)) {
356 __napi_schedule(napi);
357 return 1;
358 }
359 return 0;
360}
361
362/**
363 * napi_complete - NAPI processing complete
364 * @n: napi context
365 *
366 * Mark NAPI processing as complete.
367 */
368static inline void __napi_complete(struct napi_struct *n)
369{
370 BUG_ON(!test_bit(NAPI_STATE_SCHED, &n->state));
371 list_del(&n->poll_list);
372 smp_mb__before_clear_bit();
373 clear_bit(NAPI_STATE_SCHED, &n->state);
374}
375
376static inline void napi_complete(struct napi_struct *n)
377{
378 local_irq_disable();
379 __napi_complete(n);
380 local_irq_enable();
381}
382
383/**
384 * napi_disable - prevent NAPI from scheduling
385 * @n: napi context
386 *
387 * Stop NAPI from being scheduled on this context.
388 * Waits till any outstanding processing completes.
389 */
390static inline void napi_disable(struct napi_struct *n)
391{
392 while (test_and_set_bit(NAPI_STATE_SCHED, &n->state))
393 msleep_interruptible(1);
394}
395
396/**
397 * napi_enable - enable NAPI scheduling
398 * @n: napi context
399 *
400 * Resume NAPI from being scheduled on this context.
401 * Must be paired with napi_disable.
402 */
403static inline void napi_enable(struct napi_struct *n)
404{
405 BUG_ON(!test_bit(NAPI_STATE_SCHED, &n->state));
406 smp_mb__before_clear_bit();
407 clear_bit(NAPI_STATE_SCHED, &n->state);
408}
409
410/*
281 * The DEVICE structure. 411 * The DEVICE structure.
282 * Actually, this whole structure is a big mistake. It mixes I/O 412 * Actually, this whole structure is a big mistake. It mixes I/O
283 * data with strictly "high-level" data, and it has to know about 413 * data with strictly "high-level" data, and it has to know about
@@ -319,6 +449,9 @@ struct net_device
319 unsigned long state; 449 unsigned long state;
320 450
321 struct list_head dev_list; 451 struct list_head dev_list;
452#ifdef CONFIG_NETPOLL
453 struct list_head napi_list;
454#endif
322 455
323 /* The device initialization function. Called only once. */ 456 /* The device initialization function. Called only once. */
324 int (*init)(struct net_device *dev); 457 int (*init)(struct net_device *dev);
@@ -339,8 +472,11 @@ struct net_device
339#define NETIF_F_HW_VLAN_FILTER 512 /* Receive filtering on VLAN */ 472#define NETIF_F_HW_VLAN_FILTER 512 /* Receive filtering on VLAN */
340#define NETIF_F_VLAN_CHALLENGED 1024 /* Device cannot handle VLAN packets */ 473#define NETIF_F_VLAN_CHALLENGED 1024 /* Device cannot handle VLAN packets */
341#define NETIF_F_GSO 2048 /* Enable software GSO. */ 474#define NETIF_F_GSO 2048 /* Enable software GSO. */
342#define NETIF_F_LLTX 4096 /* LockLess TX */ 475#define NETIF_F_LLTX 4096 /* LockLess TX - deprecated. Please */
476 /* do not use LLTX in new drivers */
477#define NETIF_F_NETNS_LOCAL 8192 /* Does not change network namespaces */
343#define NETIF_F_MULTI_QUEUE 16384 /* Has multiple TX/RX queues */ 478#define NETIF_F_MULTI_QUEUE 16384 /* Has multiple TX/RX queues */
479#define NETIF_F_LRO 32768 /* large receive offload */
344 480
345 /* Segmentation offload features */ 481 /* Segmentation offload features */
346#define NETIF_F_GSO_SHIFT 16 482#define NETIF_F_GSO_SHIFT 16
@@ -379,6 +515,9 @@ struct net_device
379#endif 515#endif
380 const struct ethtool_ops *ethtool_ops; 516 const struct ethtool_ops *ethtool_ops;
381 517
518 /* Hardware header description */
519 const struct header_ops *header_ops;
520
382 /* 521 /*
383 * This marks the end of the "visible" part of the structure. All 522 * This marks the end of the "visible" part of the structure. All
384 * fields hereafter are internal to the system, and may change at 523 * fields hereafter are internal to the system, and may change at
@@ -430,12 +569,6 @@ struct net_device
430/* 569/*
431 * Cache line mostly used on receive path (including eth_type_trans()) 570 * Cache line mostly used on receive path (including eth_type_trans())
432 */ 571 */
433 struct list_head poll_list ____cacheline_aligned_in_smp;
434 /* Link to poll list */
435
436 int (*poll) (struct net_device *dev, int *quota);
437 int quota;
438 int weight;
439 unsigned long last_rx; /* Time of last Rx */ 572 unsigned long last_rx; /* Time of last Rx */
440 /* Interface address info used in eth_type_trans() */ 573 /* Interface address info used in eth_type_trans() */
441 unsigned char dev_addr[MAX_ADDR_LEN]; /* hw address, (before bcast 574 unsigned char dev_addr[MAX_ADDR_LEN]; /* hw address, (before bcast
@@ -508,13 +641,6 @@ struct net_device
508 int (*open)(struct net_device *dev); 641 int (*open)(struct net_device *dev);
509 int (*stop)(struct net_device *dev); 642 int (*stop)(struct net_device *dev);
510#define HAVE_NETDEV_POLL 643#define HAVE_NETDEV_POLL
511 int (*hard_header) (struct sk_buff *skb,
512 struct net_device *dev,
513 unsigned short type,
514 void *daddr,
515 void *saddr,
516 unsigned len);
517 int (*rebuild_header)(struct sk_buff *skb);
518#define HAVE_CHANGE_RX_FLAGS 644#define HAVE_CHANGE_RX_FLAGS
519 void (*change_rx_flags)(struct net_device *dev, 645 void (*change_rx_flags)(struct net_device *dev,
520 int flags); 646 int flags);
@@ -531,12 +657,6 @@ struct net_device
531#define HAVE_SET_CONFIG 657#define HAVE_SET_CONFIG
532 int (*set_config)(struct net_device *dev, 658 int (*set_config)(struct net_device *dev,
533 struct ifmap *map); 659 struct ifmap *map);
534#define HAVE_HEADER_CACHE
535 int (*hard_header_cache)(struct neighbour *neigh,
536 struct hh_cache *hh);
537 void (*header_cache_update)(struct hh_cache *hh,
538 struct net_device *dev,
539 unsigned char * haddr);
540#define HAVE_CHANGE_MTU 660#define HAVE_CHANGE_MTU
541 int (*change_mtu)(struct net_device *dev, int new_mtu); 661 int (*change_mtu)(struct net_device *dev, int new_mtu);
542 662
@@ -550,8 +670,6 @@ struct net_device
550 void (*vlan_rx_kill_vid)(struct net_device *dev, 670 void (*vlan_rx_kill_vid)(struct net_device *dev,
551 unsigned short vid); 671 unsigned short vid);
552 672
553 int (*hard_header_parse)(struct sk_buff *skb,
554 unsigned char *haddr);
555 int (*neigh_setup)(struct net_device *dev, struct neigh_parms *); 673 int (*neigh_setup)(struct net_device *dev, struct neigh_parms *);
556#ifdef CONFIG_NETPOLL 674#ifdef CONFIG_NETPOLL
557 struct netpoll_info *npinfo; 675 struct netpoll_info *npinfo;
@@ -560,6 +678,9 @@ struct net_device
560 void (*poll_controller)(struct net_device *dev); 678 void (*poll_controller)(struct net_device *dev);
561#endif 679#endif
562 680
681 /* Network namespace this network device is inside */
682 struct net *nd_net;
683
563 /* bridge stuff */ 684 /* bridge stuff */
564 struct net_bridge_port *br_port; 685 struct net_bridge_port *br_port;
565 /* macvlan */ 686 /* macvlan */
@@ -575,24 +696,46 @@ struct net_device
575 696
576 /* The TX queue control structures */ 697 /* The TX queue control structures */
577 unsigned int egress_subqueue_count; 698 unsigned int egress_subqueue_count;
578 struct net_device_subqueue egress_subqueue[0]; 699 struct net_device_subqueue egress_subqueue[1];
579}; 700};
580#define to_net_dev(d) container_of(d, struct net_device, dev) 701#define to_net_dev(d) container_of(d, struct net_device, dev)
581 702
582#define NETDEV_ALIGN 32 703#define NETDEV_ALIGN 32
583#define NETDEV_ALIGN_CONST (NETDEV_ALIGN - 1) 704#define NETDEV_ALIGN_CONST (NETDEV_ALIGN - 1)
584 705
706/**
707 * netdev_priv - access network device private data
708 * @dev: network device
709 *
710 * Get network device private data
711 */
585static inline void *netdev_priv(const struct net_device *dev) 712static inline void *netdev_priv(const struct net_device *dev)
586{ 713{
587 return dev->priv; 714 return dev->priv;
588} 715}
589 716
590#define SET_MODULE_OWNER(dev) do { } while (0)
591/* Set the sysfs physical device reference for the network logical device 717/* Set the sysfs physical device reference for the network logical device
592 * if set prior to registration will cause a symlink during initialization. 718 * if set prior to registration will cause a symlink during initialization.
593 */ 719 */
594#define SET_NETDEV_DEV(net, pdev) ((net)->dev.parent = (pdev)) 720#define SET_NETDEV_DEV(net, pdev) ((net)->dev.parent = (pdev))
595 721
722static inline void netif_napi_add(struct net_device *dev,
723 struct napi_struct *napi,
724 int (*poll)(struct napi_struct *, int),
725 int weight)
726{
727 INIT_LIST_HEAD(&napi->poll_list);
728 napi->poll = poll;
729 napi->weight = weight;
730#ifdef CONFIG_NETPOLL
731 napi->dev = dev;
732 list_add(&napi->dev_list, &dev->napi_list);
733 spin_lock_init(&napi->poll_lock);
734 napi->poll_owner = -1;
735#endif
736 set_bit(NAPI_STATE_SCHED, &napi->state);
737}
738
596struct packet_type { 739struct packet_type {
597 __be16 type; /* This is really htons(ether_type). */ 740 __be16 type; /* This is really htons(ether_type). */
598 struct net_device *dev; /* NULL is wildcarded here */ 741 struct net_device *dev; /* NULL is wildcarded here */
@@ -610,45 +753,46 @@ struct packet_type {
610#include <linux/interrupt.h> 753#include <linux/interrupt.h>
611#include <linux/notifier.h> 754#include <linux/notifier.h>
612 755
613extern struct net_device loopback_dev; /* The loopback */
614extern struct list_head dev_base_head; /* All devices */
615extern rwlock_t dev_base_lock; /* Device list lock */ 756extern rwlock_t dev_base_lock; /* Device list lock */
616 757
617#define for_each_netdev(d) \ 758
618 list_for_each_entry(d, &dev_base_head, dev_list) 759#define for_each_netdev(net, d) \
619#define for_each_netdev_safe(d, n) \ 760 list_for_each_entry(d, &(net)->dev_base_head, dev_list)
620 list_for_each_entry_safe(d, n, &dev_base_head, dev_list) 761#define for_each_netdev_safe(net, d, n) \
621#define for_each_netdev_continue(d) \ 762 list_for_each_entry_safe(d, n, &(net)->dev_base_head, dev_list)
622 list_for_each_entry_continue(d, &dev_base_head, dev_list) 763#define for_each_netdev_continue(net, d) \
764 list_for_each_entry_continue(d, &(net)->dev_base_head, dev_list)
623#define net_device_entry(lh) list_entry(lh, struct net_device, dev_list) 765#define net_device_entry(lh) list_entry(lh, struct net_device, dev_list)
624 766
625static inline struct net_device *next_net_device(struct net_device *dev) 767static inline struct net_device *next_net_device(struct net_device *dev)
626{ 768{
627 struct list_head *lh; 769 struct list_head *lh;
770 struct net *net;
628 771
772 net = dev->nd_net;
629 lh = dev->dev_list.next; 773 lh = dev->dev_list.next;
630 return lh == &dev_base_head ? NULL : net_device_entry(lh); 774 return lh == &net->dev_base_head ? NULL : net_device_entry(lh);
631} 775}
632 776
633static inline struct net_device *first_net_device(void) 777static inline struct net_device *first_net_device(struct net *net)
634{ 778{
635 return list_empty(&dev_base_head) ? NULL : 779 return list_empty(&net->dev_base_head) ? NULL :
636 net_device_entry(dev_base_head.next); 780 net_device_entry(net->dev_base_head.next);
637} 781}
638 782
639extern int netdev_boot_setup_check(struct net_device *dev); 783extern int netdev_boot_setup_check(struct net_device *dev);
640extern unsigned long netdev_boot_base(const char *prefix, int unit); 784extern unsigned long netdev_boot_base(const char *prefix, int unit);
641extern struct net_device *dev_getbyhwaddr(unsigned short type, char *hwaddr); 785extern struct net_device *dev_getbyhwaddr(struct net *net, unsigned short type, char *hwaddr);
642extern struct net_device *dev_getfirstbyhwtype(unsigned short type); 786extern struct net_device *dev_getfirstbyhwtype(struct net *net, unsigned short type);
643extern struct net_device *__dev_getfirstbyhwtype(unsigned short type); 787extern struct net_device *__dev_getfirstbyhwtype(struct net *net, unsigned short type);
644extern void dev_add_pack(struct packet_type *pt); 788extern void dev_add_pack(struct packet_type *pt);
645extern void dev_remove_pack(struct packet_type *pt); 789extern void dev_remove_pack(struct packet_type *pt);
646extern void __dev_remove_pack(struct packet_type *pt); 790extern void __dev_remove_pack(struct packet_type *pt);
647 791
648extern struct net_device *dev_get_by_flags(unsigned short flags, 792extern struct net_device *dev_get_by_flags(struct net *net, unsigned short flags,
649 unsigned short mask); 793 unsigned short mask);
650extern struct net_device *dev_get_by_name(const char *name); 794extern struct net_device *dev_get_by_name(struct net *net, const char *name);
651extern struct net_device *__dev_get_by_name(const char *name); 795extern struct net_device *__dev_get_by_name(struct net *net, const char *name);
652extern int dev_alloc_name(struct net_device *dev, const char *name); 796extern int dev_alloc_name(struct net_device *dev, const char *name);
653extern int dev_open(struct net_device *dev); 797extern int dev_open(struct net_device *dev);
654extern int dev_close(struct net_device *dev); 798extern int dev_close(struct net_device *dev);
@@ -659,14 +803,35 @@ extern void free_netdev(struct net_device *dev);
659extern void synchronize_net(void); 803extern void synchronize_net(void);
660extern int register_netdevice_notifier(struct notifier_block *nb); 804extern int register_netdevice_notifier(struct notifier_block *nb);
661extern int unregister_netdevice_notifier(struct notifier_block *nb); 805extern int unregister_netdevice_notifier(struct notifier_block *nb);
662extern int call_netdevice_notifiers(unsigned long val, void *v); 806extern int call_netdevice_notifiers(unsigned long val, struct net_device *dev);
663extern struct net_device *dev_get_by_index(int ifindex); 807extern struct net_device *dev_get_by_index(struct net *net, int ifindex);
664extern struct net_device *__dev_get_by_index(int ifindex); 808extern struct net_device *__dev_get_by_index(struct net *net, int ifindex);
665extern int dev_restart(struct net_device *dev); 809extern int dev_restart(struct net_device *dev);
666#ifdef CONFIG_NETPOLL_TRAP 810#ifdef CONFIG_NETPOLL_TRAP
667extern int netpoll_trap(void); 811extern int netpoll_trap(void);
668#endif 812#endif
669 813
814static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev,
815 unsigned short type,
816 const void *daddr, const void *saddr,
817 unsigned len)
818{
819 if (!dev->header_ops)
820 return 0;
821
822 return dev->header_ops->create(skb, dev, type, daddr, saddr, len);
823}
824
825static inline int dev_parse_header(const struct sk_buff *skb,
826 unsigned char *haddr)
827{
828 const struct net_device *dev = skb->dev;
829
830 if (!dev->header_ops->parse)
831 return 0;
832 return dev->header_ops->parse(skb, haddr);
833}
834
670typedef int gifconf_func_t(struct net_device * dev, char __user * bufptr, int len); 835typedef int gifconf_func_t(struct net_device * dev, char __user * bufptr, int len);
671extern int register_gifconf(unsigned int family, gifconf_func_t * gifconf); 836extern int register_gifconf(unsigned int family, gifconf_func_t * gifconf);
672static inline int unregister_gifconf(unsigned int family) 837static inline int unregister_gifconf(unsigned int family)
@@ -678,7 +843,6 @@ static inline int unregister_gifconf(unsigned int family)
678 * Incoming packets are placed on per-cpu queues so that 843 * Incoming packets are placed on per-cpu queues so that
679 * no locking is needed. 844 * no locking is needed.
680 */ 845 */
681
682struct softnet_data 846struct softnet_data
683{ 847{
684 struct net_device *output_queue; 848 struct net_device *output_queue;
@@ -686,7 +850,7 @@ struct softnet_data
686 struct list_head poll_list; 850 struct list_head poll_list;
687 struct sk_buff *completion_queue; 851 struct sk_buff *completion_queue;
688 852
689 struct net_device backlog_dev; /* Sorry. 8) */ 853 struct napi_struct backlog;
690#ifdef CONFIG_NET_DMA 854#ifdef CONFIG_NET_DMA
691 struct dma_chan *net_dma; 855 struct dma_chan *net_dma;
692#endif 856#endif
@@ -704,11 +868,24 @@ static inline void netif_schedule(struct net_device *dev)
704 __netif_schedule(dev); 868 __netif_schedule(dev);
705} 869}
706 870
871/**
872 * netif_start_queue - allow transmit
873 * @dev: network device
874 *
875 * Allow upper layers to call the device hard_start_xmit routine.
876 */
707static inline void netif_start_queue(struct net_device *dev) 877static inline void netif_start_queue(struct net_device *dev)
708{ 878{
709 clear_bit(__LINK_STATE_XOFF, &dev->state); 879 clear_bit(__LINK_STATE_XOFF, &dev->state);
710} 880}
711 881
882/**
883 * netif_wake_queue - restart transmit
884 * @dev: network device
885 *
886 * Allow upper layers to call the device hard_start_xmit routine.
887 * Used for flow control when transmit resources are available.
888 */
712static inline void netif_wake_queue(struct net_device *dev) 889static inline void netif_wake_queue(struct net_device *dev)
713{ 890{
714#ifdef CONFIG_NETPOLL_TRAP 891#ifdef CONFIG_NETPOLL_TRAP
@@ -721,16 +898,35 @@ static inline void netif_wake_queue(struct net_device *dev)
721 __netif_schedule(dev); 898 __netif_schedule(dev);
722} 899}
723 900
901/**
902 * netif_stop_queue - stop transmitted packets
903 * @dev: network device
904 *
905 * Stop upper layers calling the device hard_start_xmit routine.
906 * Used for flow control when transmit resources are unavailable.
907 */
724static inline void netif_stop_queue(struct net_device *dev) 908static inline void netif_stop_queue(struct net_device *dev)
725{ 909{
726 set_bit(__LINK_STATE_XOFF, &dev->state); 910 set_bit(__LINK_STATE_XOFF, &dev->state);
727} 911}
728 912
913/**
914 * netif_queue_stopped - test if transmit queue is flowblocked
915 * @dev: network device
916 *
917 * Test if transmit queue on device is currently unable to send.
918 */
729static inline int netif_queue_stopped(const struct net_device *dev) 919static inline int netif_queue_stopped(const struct net_device *dev)
730{ 920{
731 return test_bit(__LINK_STATE_XOFF, &dev->state); 921 return test_bit(__LINK_STATE_XOFF, &dev->state);
732} 922}
733 923
924/**
925 * netif_running - test if up
926 * @dev: network device
927 *
928 * Test if the device has been brought up.
929 */
734static inline int netif_running(const struct net_device *dev) 930static inline int netif_running(const struct net_device *dev)
735{ 931{
736 return test_bit(__LINK_STATE_START, &dev->state); 932 return test_bit(__LINK_STATE_START, &dev->state);
@@ -742,6 +938,14 @@ static inline int netif_running(const struct net_device *dev)
742 * done at the overall netdevice level. 938 * done at the overall netdevice level.
743 * Also test the device if we're multiqueue. 939 * Also test the device if we're multiqueue.
744 */ 940 */
941
942/**
943 * netif_start_subqueue - allow sending packets on subqueue
944 * @dev: network device
945 * @queue_index: sub queue index
946 *
947 * Start individual transmit queue of a device with multiple transmit queues.
948 */
745static inline void netif_start_subqueue(struct net_device *dev, u16 queue_index) 949static inline void netif_start_subqueue(struct net_device *dev, u16 queue_index)
746{ 950{
747#ifdef CONFIG_NETDEVICES_MULTIQUEUE 951#ifdef CONFIG_NETDEVICES_MULTIQUEUE
@@ -749,6 +953,13 @@ static inline void netif_start_subqueue(struct net_device *dev, u16 queue_index)
749#endif 953#endif
750} 954}
751 955
956/**
957 * netif_stop_subqueue - stop sending packets on subqueue
958 * @dev: network device
959 * @queue_index: sub queue index
960 *
961 * Stop individual transmit queue of a device with multiple transmit queues.
962 */
752static inline void netif_stop_subqueue(struct net_device *dev, u16 queue_index) 963static inline void netif_stop_subqueue(struct net_device *dev, u16 queue_index)
753{ 964{
754#ifdef CONFIG_NETDEVICES_MULTIQUEUE 965#ifdef CONFIG_NETDEVICES_MULTIQUEUE
@@ -760,6 +971,13 @@ static inline void netif_stop_subqueue(struct net_device *dev, u16 queue_index)
760#endif 971#endif
761} 972}
762 973
974/**
975 * netif_subqueue_stopped - test status of subqueue
976 * @dev: network device
977 * @queue_index: sub queue index
978 *
979 * Check individual transmit queue of a device with multiple transmit queues.
980 */
763static inline int netif_subqueue_stopped(const struct net_device *dev, 981static inline int netif_subqueue_stopped(const struct net_device *dev,
764 u16 queue_index) 982 u16 queue_index)
765{ 983{
@@ -771,6 +989,14 @@ static inline int netif_subqueue_stopped(const struct net_device *dev,
771#endif 989#endif
772} 990}
773 991
992
993/**
994 * netif_wake_subqueue - allow sending packets on subqueue
995 * @dev: network device
996 * @queue_index: sub queue index
997 *
998 * Resume individual transmit queue of a device with multiple transmit queues.
999 */
774static inline void netif_wake_subqueue(struct net_device *dev, u16 queue_index) 1000static inline void netif_wake_subqueue(struct net_device *dev, u16 queue_index)
775{ 1001{
776#ifdef CONFIG_NETDEVICES_MULTIQUEUE 1002#ifdef CONFIG_NETDEVICES_MULTIQUEUE
@@ -784,6 +1010,13 @@ static inline void netif_wake_subqueue(struct net_device *dev, u16 queue_index)
784#endif 1010#endif
785} 1011}
786 1012
1013/**
1014 * netif_is_multiqueue - test if device has multiple transmit queues
1015 * @dev: network device
1016 *
1017 * Check if device has multiple transmit queues
1018 * Always falls if NETDEVICE_MULTIQUEUE is not configured
1019 */
787static inline int netif_is_multiqueue(const struct net_device *dev) 1020static inline int netif_is_multiqueue(const struct net_device *dev)
788{ 1021{
789#ifdef CONFIG_NETDEVICES_MULTIQUEUE 1022#ifdef CONFIG_NETDEVICES_MULTIQUEUE
@@ -796,20 +1029,7 @@ static inline int netif_is_multiqueue(const struct net_device *dev)
796/* Use this variant when it is known for sure that it 1029/* Use this variant when it is known for sure that it
797 * is executing from interrupt context. 1030 * is executing from interrupt context.
798 */ 1031 */
799static inline void dev_kfree_skb_irq(struct sk_buff *skb) 1032extern void dev_kfree_skb_irq(struct sk_buff *skb);
800{
801 if (atomic_dec_and_test(&skb->users)) {
802 struct softnet_data *sd;
803 unsigned long flags;
804
805 local_irq_save(flags);
806 sd = &__get_cpu_var(softnet_data);
807 skb->next = sd->completion_queue;
808 sd->completion_queue = skb;
809 raise_softirq_irqoff(NET_TX_SOFTIRQ);
810 local_irq_restore(flags);
811 }
812}
813 1033
814/* Use this variant in places where it could be invoked 1034/* Use this variant in places where it could be invoked
815 * either from interrupt or non-interrupt context. 1035 * either from interrupt or non-interrupt context.
@@ -822,29 +1042,41 @@ extern int netif_rx_ni(struct sk_buff *skb);
822#define HAVE_NETIF_RECEIVE_SKB 1 1042#define HAVE_NETIF_RECEIVE_SKB 1
823extern int netif_receive_skb(struct sk_buff *skb); 1043extern int netif_receive_skb(struct sk_buff *skb);
824extern int dev_valid_name(const char *name); 1044extern int dev_valid_name(const char *name);
825extern int dev_ioctl(unsigned int cmd, void __user *); 1045extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *);
826extern int dev_ethtool(struct ifreq *); 1046extern int dev_ethtool(struct net *net, struct ifreq *);
827extern unsigned dev_get_flags(const struct net_device *); 1047extern unsigned dev_get_flags(const struct net_device *);
828extern int dev_change_flags(struct net_device *, unsigned); 1048extern int dev_change_flags(struct net_device *, unsigned);
829extern int dev_change_name(struct net_device *, char *); 1049extern int dev_change_name(struct net_device *, char *);
1050extern int dev_change_net_namespace(struct net_device *,
1051 struct net *, const char *);
830extern int dev_set_mtu(struct net_device *, int); 1052extern int dev_set_mtu(struct net_device *, int);
831extern int dev_set_mac_address(struct net_device *, 1053extern int dev_set_mac_address(struct net_device *,
832 struct sockaddr *); 1054 struct sockaddr *);
833extern int dev_hard_start_xmit(struct sk_buff *skb, 1055extern int dev_hard_start_xmit(struct sk_buff *skb,
834 struct net_device *dev); 1056 struct net_device *dev);
835 1057
836extern void dev_init(void);
837
838extern int netdev_budget; 1058extern int netdev_budget;
839 1059
840/* Called by rtnetlink.c:rtnl_unlock() */ 1060/* Called by rtnetlink.c:rtnl_unlock() */
841extern void netdev_run_todo(void); 1061extern void netdev_run_todo(void);
842 1062
1063/**
1064 * dev_put - release reference to device
1065 * @dev: network device
1066 *
1067 * Release reference to device to allow it to be freed.
1068 */
843static inline void dev_put(struct net_device *dev) 1069static inline void dev_put(struct net_device *dev)
844{ 1070{
845 atomic_dec(&dev->refcnt); 1071 atomic_dec(&dev->refcnt);
846} 1072}
847 1073
1074/**
1075 * dev_hold - get reference to device
1076 * @dev: network device
1077 *
1078 * Hold reference to device to keep it from being freed.
1079 */
848static inline void dev_hold(struct net_device *dev) 1080static inline void dev_hold(struct net_device *dev)
849{ 1081{
850 atomic_inc(&dev->refcnt); 1082 atomic_inc(&dev->refcnt);
@@ -861,6 +1093,12 @@ static inline void dev_hold(struct net_device *dev)
861 1093
862extern void linkwatch_fire_event(struct net_device *dev); 1094extern void linkwatch_fire_event(struct net_device *dev);
863 1095
1096/**
1097 * netif_carrier_ok - test if carrier present
1098 * @dev: network device
1099 *
1100 * Check if carrier is present on device
1101 */
864static inline int netif_carrier_ok(const struct net_device *dev) 1102static inline int netif_carrier_ok(const struct net_device *dev)
865{ 1103{
866 return !test_bit(__LINK_STATE_NOCARRIER, &dev->state); 1104 return !test_bit(__LINK_STATE_NOCARRIER, &dev->state);
@@ -872,30 +1110,66 @@ extern void netif_carrier_on(struct net_device *dev);
872 1110
873extern void netif_carrier_off(struct net_device *dev); 1111extern void netif_carrier_off(struct net_device *dev);
874 1112
1113/**
1114 * netif_dormant_on - mark device as dormant.
1115 * @dev: network device
1116 *
1117 * Mark device as dormant (as per RFC2863).
1118 *
1119 * The dormant state indicates that the relevant interface is not
1120 * actually in a condition to pass packets (i.e., it is not 'up') but is
1121 * in a "pending" state, waiting for some external event. For "on-
1122 * demand" interfaces, this new state identifies the situation where the
1123 * interface is waiting for events to place it in the up state.
1124 *
1125 */
875static inline void netif_dormant_on(struct net_device *dev) 1126static inline void netif_dormant_on(struct net_device *dev)
876{ 1127{
877 if (!test_and_set_bit(__LINK_STATE_DORMANT, &dev->state)) 1128 if (!test_and_set_bit(__LINK_STATE_DORMANT, &dev->state))
878 linkwatch_fire_event(dev); 1129 linkwatch_fire_event(dev);
879} 1130}
880 1131
1132/**
1133 * netif_dormant_off - set device as not dormant.
1134 * @dev: network device
1135 *
1136 * Device is not in dormant state.
1137 */
881static inline void netif_dormant_off(struct net_device *dev) 1138static inline void netif_dormant_off(struct net_device *dev)
882{ 1139{
883 if (test_and_clear_bit(__LINK_STATE_DORMANT, &dev->state)) 1140 if (test_and_clear_bit(__LINK_STATE_DORMANT, &dev->state))
884 linkwatch_fire_event(dev); 1141 linkwatch_fire_event(dev);
885} 1142}
886 1143
1144/**
1145 * netif_dormant - test if carrier present
1146 * @dev: network device
1147 *
1148 * Check if carrier is present on device
1149 */
887static inline int netif_dormant(const struct net_device *dev) 1150static inline int netif_dormant(const struct net_device *dev)
888{ 1151{
889 return test_bit(__LINK_STATE_DORMANT, &dev->state); 1152 return test_bit(__LINK_STATE_DORMANT, &dev->state);
890} 1153}
891 1154
892 1155
1156/**
1157 * netif_oper_up - test if device is operational
1158 * @dev: network device
1159 *
1160 * Check if carrier is operational
1161 */
893static inline int netif_oper_up(const struct net_device *dev) { 1162static inline int netif_oper_up(const struct net_device *dev) {
894 return (dev->operstate == IF_OPER_UP || 1163 return (dev->operstate == IF_OPER_UP ||
895 dev->operstate == IF_OPER_UNKNOWN /* backward compat */); 1164 dev->operstate == IF_OPER_UNKNOWN /* backward compat */);
896} 1165}
897 1166
898/* Hot-plugging. */ 1167/**
1168 * netif_device_present - is device available or removed
1169 * @dev: network device
1170 *
1171 * Check if device has not been removed from system.
1172 */
899static inline int netif_device_present(struct net_device *dev) 1173static inline int netif_device_present(struct net_device *dev)
900{ 1174{
901 return test_bit(__LINK_STATE_PRESENT, &dev->state); 1175 return test_bit(__LINK_STATE_PRESENT, &dev->state);
@@ -955,46 +1229,38 @@ static inline u32 netif_msg_init(int debug_value, int default_msg_enable_bits)
955 return (1 << debug_value) - 1; 1229 return (1 << debug_value) - 1;
956} 1230}
957 1231
958/* Test if receive needs to be scheduled */
959static inline int __netif_rx_schedule_prep(struct net_device *dev)
960{
961 return !test_and_set_bit(__LINK_STATE_RX_SCHED, &dev->state);
962}
963
964/* Test if receive needs to be scheduled but only if up */ 1232/* Test if receive needs to be scheduled but only if up */
965static inline int netif_rx_schedule_prep(struct net_device *dev) 1233static inline int netif_rx_schedule_prep(struct net_device *dev,
1234 struct napi_struct *napi)
966{ 1235{
967 return netif_running(dev) && __netif_rx_schedule_prep(dev); 1236 return netif_running(dev) && napi_schedule_prep(napi);
968} 1237}
969 1238
970/* Add interface to tail of rx poll list. This assumes that _prep has 1239/* Add interface to tail of rx poll list. This assumes that _prep has
971 * already been called and returned 1. 1240 * already been called and returned 1.
972 */ 1241 */
973 1242static inline void __netif_rx_schedule(struct net_device *dev,
974extern void __netif_rx_schedule(struct net_device *dev); 1243 struct napi_struct *napi)
1244{
1245 dev_hold(dev);
1246 __napi_schedule(napi);
1247}
975 1248
976/* Try to reschedule poll. Called by irq handler. */ 1249/* Try to reschedule poll. Called by irq handler. */
977 1250
978static inline void netif_rx_schedule(struct net_device *dev) 1251static inline void netif_rx_schedule(struct net_device *dev,
1252 struct napi_struct *napi)
979{ 1253{
980 if (netif_rx_schedule_prep(dev)) 1254 if (netif_rx_schedule_prep(dev, napi))
981 __netif_rx_schedule(dev); 1255 __netif_rx_schedule(dev, napi);
982} 1256}
983 1257
984/* Try to reschedule poll. Called by dev->poll() after netif_rx_complete(). 1258/* Try to reschedule poll. Called by dev->poll() after netif_rx_complete(). */
985 * Do not inline this? 1259static inline int netif_rx_reschedule(struct net_device *dev,
986 */ 1260 struct napi_struct *napi)
987static inline int netif_rx_reschedule(struct net_device *dev, int undo)
988{ 1261{
989 if (netif_rx_schedule_prep(dev)) { 1262 if (napi_schedule_prep(napi)) {
990 unsigned long flags; 1263 __netif_rx_schedule(dev, napi);
991
992 dev->quota += undo;
993
994 local_irq_save(flags);
995 list_add_tail(&dev->poll_list, &__get_cpu_var(softnet_data).poll_list);
996 __raise_softirq_irqoff(NET_RX_SOFTIRQ);
997 local_irq_restore(flags);
998 return 1; 1264 return 1;
999 } 1265 }
1000 return 0; 1266 return 0;
@@ -1003,12 +1269,11 @@ static inline int netif_rx_reschedule(struct net_device *dev, int undo)
1003/* same as netif_rx_complete, except that local_irq_save(flags) 1269/* same as netif_rx_complete, except that local_irq_save(flags)
1004 * has already been issued 1270 * has already been issued
1005 */ 1271 */
1006static inline void __netif_rx_complete(struct net_device *dev) 1272static inline void __netif_rx_complete(struct net_device *dev,
1273 struct napi_struct *napi)
1007{ 1274{
1008 BUG_ON(!test_bit(__LINK_STATE_RX_SCHED, &dev->state)); 1275 __napi_complete(napi);
1009 list_del(&dev->poll_list); 1276 dev_put(dev);
1010 smp_mb__before_clear_bit();
1011 clear_bit(__LINK_STATE_RX_SCHED, &dev->state);
1012} 1277}
1013 1278
1014/* Remove interface from poll list: it must be in the poll list 1279/* Remove interface from poll list: it must be in the poll list
@@ -1016,32 +1281,31 @@ static inline void __netif_rx_complete(struct net_device *dev)
1016 * it completes the work. The device cannot be out of poll list at this 1281 * it completes the work. The device cannot be out of poll list at this
1017 * moment, it is BUG(). 1282 * moment, it is BUG().
1018 */ 1283 */
1019static inline void netif_rx_complete(struct net_device *dev) 1284static inline void netif_rx_complete(struct net_device *dev,
1285 struct napi_struct *napi)
1020{ 1286{
1021 unsigned long flags; 1287 unsigned long flags;
1022 1288
1023 local_irq_save(flags); 1289 local_irq_save(flags);
1024 __netif_rx_complete(dev); 1290 __netif_rx_complete(dev, napi);
1025 local_irq_restore(flags); 1291 local_irq_restore(flags);
1026} 1292}
1027 1293
1028static inline void netif_poll_disable(struct net_device *dev) 1294/**
1029{ 1295 * netif_tx_lock - grab network device transmit lock
1030 while (test_and_set_bit(__LINK_STATE_RX_SCHED, &dev->state)) 1296 * @dev: network device
1031 /* No hurry. */ 1297 *
1032 schedule_timeout_interruptible(1); 1298 * Get network device transmit lock
1033} 1299 */
1034 1300static inline void __netif_tx_lock(struct net_device *dev, int cpu)
1035static inline void netif_poll_enable(struct net_device *dev)
1036{ 1301{
1037 smp_mb__before_clear_bit(); 1302 spin_lock(&dev->_xmit_lock);
1038 clear_bit(__LINK_STATE_RX_SCHED, &dev->state); 1303 dev->xmit_lock_owner = cpu;
1039} 1304}
1040 1305
1041static inline void netif_tx_lock(struct net_device *dev) 1306static inline void netif_tx_lock(struct net_device *dev)
1042{ 1307{
1043 spin_lock(&dev->_xmit_lock); 1308 __netif_tx_lock(dev, smp_processor_id());
1044 dev->xmit_lock_owner = smp_processor_id();
1045} 1309}
1046 1310
1047static inline void netif_tx_lock_bh(struct net_device *dev) 1311static inline void netif_tx_lock_bh(struct net_device *dev)
@@ -1070,6 +1334,18 @@ static inline void netif_tx_unlock_bh(struct net_device *dev)
1070 spin_unlock_bh(&dev->_xmit_lock); 1334 spin_unlock_bh(&dev->_xmit_lock);
1071} 1335}
1072 1336
1337#define HARD_TX_LOCK(dev, cpu) { \
1338 if ((dev->features & NETIF_F_LLTX) == 0) { \
1339 __netif_tx_lock(dev, cpu); \
1340 } \
1341}
1342
1343#define HARD_TX_UNLOCK(dev) { \
1344 if ((dev->features & NETIF_F_LLTX) == 0) { \
1345 netif_tx_unlock(dev); \
1346 } \
1347}
1348
1073static inline void netif_tx_disable(struct net_device *dev) 1349static inline void netif_tx_disable(struct net_device *dev)
1074{ 1350{
1075 netif_tx_lock_bh(dev); 1351 netif_tx_lock_bh(dev);
@@ -1098,16 +1374,14 @@ extern int dev_mc_delete(struct net_device *dev, void *addr, int alen, int all
1098extern int dev_mc_add(struct net_device *dev, void *addr, int alen, int newonly); 1374extern int dev_mc_add(struct net_device *dev, void *addr, int alen, int newonly);
1099extern int dev_mc_sync(struct net_device *to, struct net_device *from); 1375extern int dev_mc_sync(struct net_device *to, struct net_device *from);
1100extern void dev_mc_unsync(struct net_device *to, struct net_device *from); 1376extern void dev_mc_unsync(struct net_device *to, struct net_device *from);
1101extern void dev_mc_discard(struct net_device *dev);
1102extern int __dev_addr_delete(struct dev_addr_list **list, int *count, void *addr, int alen, int all); 1377extern int __dev_addr_delete(struct dev_addr_list **list, int *count, void *addr, int alen, int all);
1103extern int __dev_addr_add(struct dev_addr_list **list, int *count, void *addr, int alen, int newonly); 1378extern int __dev_addr_add(struct dev_addr_list **list, int *count, void *addr, int alen, int newonly);
1104extern void __dev_addr_discard(struct dev_addr_list **list);
1105extern void dev_set_promiscuity(struct net_device *dev, int inc); 1379extern void dev_set_promiscuity(struct net_device *dev, int inc);
1106extern void dev_set_allmulti(struct net_device *dev, int inc); 1380extern void dev_set_allmulti(struct net_device *dev, int inc);
1107extern void netdev_state_change(struct net_device *dev); 1381extern void netdev_state_change(struct net_device *dev);
1108extern void netdev_features_change(struct net_device *dev); 1382extern void netdev_features_change(struct net_device *dev);
1109/* Load a device via the kmod */ 1383/* Load a device via the kmod */
1110extern void dev_load(const char *name); 1384extern void dev_load(struct net *net, const char *name);
1111extern void dev_mcast_init(void); 1385extern void dev_mcast_init(void);
1112extern int netdev_max_backlog; 1386extern int netdev_max_backlog;
1113extern int weight_p; 1387extern int weight_p;
@@ -1133,6 +1407,8 @@ extern void dev_seq_stop(struct seq_file *seq, void *v);
1133 1407
1134extern void linkwatch_run_queue(void); 1408extern void linkwatch_run_queue(void);
1135 1409
1410extern int netdev_compute_features(unsigned long all, unsigned long one);
1411
1136static inline int net_gso_ok(int features, int gso_type) 1412static inline int net_gso_ok(int features, int gso_type)
1137{ 1413{
1138 int feature = gso_type << NETIF_F_GSO_SHIFT; 1414 int feature = gso_type << NETIF_F_GSO_SHIFT;
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 0eed0b7ab2df..1dd075eda595 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -88,9 +88,8 @@ struct nf_sockopt_ops
88 int (*compat_get)(struct sock *sk, int optval, 88 int (*compat_get)(struct sock *sk, int optval,
89 void __user *user, int *len); 89 void __user *user, int *len);
90 90
91 /* Number of users inside set() or get(). */ 91 /* Use the module struct to lock set/get code in place */
92 unsigned int use; 92 struct module *owner;
93 struct task_struct *cleanup_task;
94}; 93};
95 94
96/* Each queued (to userspace) skbuff has one of these. */ 95/* Each queued (to userspace) skbuff has one of these. */
diff --git a/include/linux/netfilter/Kbuild b/include/linux/netfilter/Kbuild
index 43397a414cd6..f2eaea2234ec 100644
--- a/include/linux/netfilter/Kbuild
+++ b/include/linux/netfilter/Kbuild
@@ -28,6 +28,7 @@ header-y += xt_policy.h
28header-y += xt_realm.h 28header-y += xt_realm.h
29header-y += xt_sctp.h 29header-y += xt_sctp.h
30header-y += xt_state.h 30header-y += xt_state.h
31header-y += xt_statistic.h
31header-y += xt_string.h 32header-y += xt_string.h
32header-y += xt_tcpmss.h 33header-y += xt_tcpmss.h
33header-y += xt_tcpudp.h 34header-y += xt_tcpudp.h
@@ -39,5 +40,6 @@ unifdef-y += nf_conntrack_common.h
39unifdef-y += nf_conntrack_ftp.h 40unifdef-y += nf_conntrack_ftp.h
40unifdef-y += nf_conntrack_tcp.h 41unifdef-y += nf_conntrack_tcp.h
41unifdef-y += nfnetlink.h 42unifdef-y += nfnetlink.h
43unifdef-y += nfnetlink_compat.h
42unifdef-y += x_tables.h 44unifdef-y += x_tables.h
43unifdef-y += xt_physdev.h 45unifdef-y += xt_physdev.h
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index 0f9311df1559..0d8424f76899 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -1,16 +1,7 @@
1#ifndef _NFNETLINK_H 1#ifndef _NFNETLINK_H
2#define _NFNETLINK_H 2#define _NFNETLINK_H
3#include <linux/types.h> 3#include <linux/types.h>
4 4#include <linux/netfilter/nfnetlink_compat.h>
5#ifndef __KERNEL__
6/* nfnetlink groups: Up to 32 maximum - backwards compatibility for userspace */
7#define NF_NETLINK_CONNTRACK_NEW 0x00000001
8#define NF_NETLINK_CONNTRACK_UPDATE 0x00000002
9#define NF_NETLINK_CONNTRACK_DESTROY 0x00000004
10#define NF_NETLINK_CONNTRACK_EXP_NEW 0x00000008
11#define NF_NETLINK_CONNTRACK_EXP_UPDATE 0x00000010
12#define NF_NETLINK_CONNTRACK_EXP_DESTROY 0x00000020
13#endif
14 5
15enum nfnetlink_groups { 6enum nfnetlink_groups {
16 NFNLGRP_NONE, 7 NFNLGRP_NONE,
@@ -31,48 +22,6 @@ enum nfnetlink_groups {
31}; 22};
32#define NFNLGRP_MAX (__NFNLGRP_MAX - 1) 23#define NFNLGRP_MAX (__NFNLGRP_MAX - 1)
33 24
34/* Generic structure for encapsulation optional netfilter information.
35 * It is reminiscent of sockaddr, but with sa_family replaced
36 * with attribute type.
37 * ! This should someday be put somewhere generic as now rtnetlink and
38 * ! nfnetlink use the same attributes methods. - J. Schulist.
39 */
40
41struct nfattr
42{
43 u_int16_t nfa_len;
44 u_int16_t nfa_type; /* we use 15 bits for the type, and the highest
45 * bit to indicate whether the payload is nested */
46};
47
48/* FIXME: Apart from NFNL_NFA_NESTED shamelessly copy and pasted from
49 * rtnetlink.h, it's time to put this in a generic file */
50
51#define NFNL_NFA_NEST 0x8000
52#define NFA_TYPE(attr) ((attr)->nfa_type & 0x7fff)
53
54#define NFA_ALIGNTO 4
55#define NFA_ALIGN(len) (((len) + NFA_ALIGNTO - 1) & ~(NFA_ALIGNTO - 1))
56#define NFA_OK(nfa,len) ((len) > 0 && (nfa)->nfa_len >= sizeof(struct nfattr) \
57 && (nfa)->nfa_len <= (len))
58#define NFA_NEXT(nfa,attrlen) ((attrlen) -= NFA_ALIGN((nfa)->nfa_len), \
59 (struct nfattr *)(((char *)(nfa)) + NFA_ALIGN((nfa)->nfa_len)))
60#define NFA_LENGTH(len) (NFA_ALIGN(sizeof(struct nfattr)) + (len))
61#define NFA_SPACE(len) NFA_ALIGN(NFA_LENGTH(len))
62#define NFA_DATA(nfa) ((void *)(((char *)(nfa)) + NFA_LENGTH(0)))
63#define NFA_PAYLOAD(nfa) ((int)((nfa)->nfa_len) - NFA_LENGTH(0))
64#define NFA_NEST(skb, type) \
65({ struct nfattr *__start = (struct nfattr *)skb_tail_pointer(skb); \
66 NFA_PUT(skb, (NFNL_NFA_NEST | type), 0, NULL); \
67 __start; })
68#define NFA_NEST_END(skb, start) \
69({ (start)->nfa_len = skb_tail_pointer(skb) - (unsigned char *)(start); \
70 (skb)->len; })
71#define NFA_NEST_CANCEL(skb, start) \
72({ if (start) \
73 skb_trim(skb, (unsigned char *) (start) - (skb)->data); \
74 -1; })
75
76/* General form of address family dependent message. 25/* General form of address family dependent message.
77 */ 26 */
78struct nfgenmsg { 27struct nfgenmsg {
@@ -83,10 +32,6 @@ struct nfgenmsg {
83 32
84#define NFNETLINK_V0 0 33#define NFNETLINK_V0 0
85 34
86#define NFM_NFA(n) ((struct nfattr *)(((char *)(n)) \
87 + NLMSG_ALIGN(sizeof(struct nfgenmsg))))
88#define NFM_PAYLOAD(n) NLMSG_PAYLOAD(n, sizeof(struct nfgenmsg))
89
90/* netfilter netlink message types are split in two pieces: 35/* netfilter netlink message types are split in two pieces:
91 * 8 bit subsystem, 8bit operation. 36 * 8 bit subsystem, 8bit operation.
92 */ 37 */
@@ -107,49 +52,26 @@ struct nfgenmsg {
107 52
108#include <linux/netlink.h> 53#include <linux/netlink.h>
109#include <linux/capability.h> 54#include <linux/capability.h>
55#include <net/netlink.h>
110 56
111struct nfnl_callback 57struct nfnl_callback
112{ 58{
113 int (*call)(struct sock *nl, struct sk_buff *skb, 59 int (*call)(struct sock *nl, struct sk_buff *skb,
114 struct nlmsghdr *nlh, struct nfattr *cda[]); 60 struct nlmsghdr *nlh, struct nlattr *cda[]);
115 u_int16_t attr_count; /* number of nfattr's */ 61 const struct nla_policy *policy; /* netlink attribute policy */
62 const u_int16_t attr_count; /* number of nlattr's */
116}; 63};
117 64
118struct nfnetlink_subsystem 65struct nfnetlink_subsystem
119{ 66{
120 const char *name; 67 const char *name;
121 __u8 subsys_id; /* nfnetlink subsystem ID */ 68 __u8 subsys_id; /* nfnetlink subsystem ID */
122 __u8 cb_count; /* number of callbacks */ 69 __u8 cb_count; /* number of callbacks */
123 struct nfnl_callback *cb; /* callback for individual types */ 70 const struct nfnl_callback *cb; /* callback for individual types */
124}; 71};
125 72
126extern void __nfa_fill(struct sk_buff *skb, int attrtype, 73extern int nfnetlink_subsys_register(const struct nfnetlink_subsystem *n);
127 int attrlen, const void *data); 74extern int nfnetlink_subsys_unregister(const struct nfnetlink_subsystem *n);
128#define NFA_PUT(skb, attrtype, attrlen, data) \
129({ if (skb_tailroom(skb) < (int)NFA_SPACE(attrlen)) goto nfattr_failure; \
130 __nfa_fill(skb, attrtype, attrlen, data); })
131
132extern int nfnetlink_subsys_register(struct nfnetlink_subsystem *n);
133extern int nfnetlink_subsys_unregister(struct nfnetlink_subsystem *n);
134
135extern void nfattr_parse(struct nfattr *tb[], int maxattr,
136 struct nfattr *nfa, int len);
137
138#define nfattr_parse_nested(tb, max, nfa) \
139 nfattr_parse((tb), (max), NFA_DATA((nfa)), NFA_PAYLOAD((nfa)))
140
141#define nfattr_bad_size(tb, max, cta_min) \
142({ int __i, __res = 0; \
143 for (__i=0; __i<max; __i++) { \
144 if (!cta_min[__i]) \
145 continue; \
146 if (tb[__i] && NFA_PAYLOAD(tb[__i]) < cta_min[__i]){ \
147 __res = 1; \
148 break; \
149 } \
150 } \
151 __res; \
152})
153 75
154extern int nfnetlink_has_listeners(unsigned int group); 76extern int nfnetlink_has_listeners(unsigned int group);
155extern int nfnetlink_send(struct sk_buff *skb, u32 pid, unsigned group, 77extern int nfnetlink_send(struct sk_buff *skb, u32 pid, unsigned group,
diff --git a/include/linux/netfilter/nfnetlink_compat.h b/include/linux/netfilter/nfnetlink_compat.h
new file mode 100644
index 000000000000..02a42d875cf7
--- /dev/null
+++ b/include/linux/netfilter/nfnetlink_compat.h
@@ -0,0 +1,61 @@
1#ifndef _NFNETLINK_COMPAT_H
2#define _NFNETLINK_COMPAT_H
3#ifndef __KERNEL
4/* Old nfnetlink macros for userspace */
5
6/* nfnetlink groups: Up to 32 maximum */
7#define NF_NETLINK_CONNTRACK_NEW 0x00000001
8#define NF_NETLINK_CONNTRACK_UPDATE 0x00000002
9#define NF_NETLINK_CONNTRACK_DESTROY 0x00000004
10#define NF_NETLINK_CONNTRACK_EXP_NEW 0x00000008
11#define NF_NETLINK_CONNTRACK_EXP_UPDATE 0x00000010
12#define NF_NETLINK_CONNTRACK_EXP_DESTROY 0x00000020
13
14/* Generic structure for encapsulation optional netfilter information.
15 * It is reminiscent of sockaddr, but with sa_family replaced
16 * with attribute type.
17 * ! This should someday be put somewhere generic as now rtnetlink and
18 * ! nfnetlink use the same attributes methods. - J. Schulist.
19 */
20
21struct nfattr
22{
23 u_int16_t nfa_len;
24 u_int16_t nfa_type; /* we use 15 bits for the type, and the highest
25 * bit to indicate whether the payload is nested */
26};
27
28/* FIXME: Apart from NFNL_NFA_NESTED shamelessly copy and pasted from
29 * rtnetlink.h, it's time to put this in a generic file */
30
31#define NFNL_NFA_NEST 0x8000
32#define NFA_TYPE(attr) ((attr)->nfa_type & 0x7fff)
33
34#define NFA_ALIGNTO 4
35#define NFA_ALIGN(len) (((len) + NFA_ALIGNTO - 1) & ~(NFA_ALIGNTO - 1))
36#define NFA_OK(nfa,len) ((len) > 0 && (nfa)->nfa_len >= sizeof(struct nfattr) \
37 && (nfa)->nfa_len <= (len))
38#define NFA_NEXT(nfa,attrlen) ((attrlen) -= NFA_ALIGN((nfa)->nfa_len), \
39 (struct nfattr *)(((char *)(nfa)) + NFA_ALIGN((nfa)->nfa_len)))
40#define NFA_LENGTH(len) (NFA_ALIGN(sizeof(struct nfattr)) + (len))
41#define NFA_SPACE(len) NFA_ALIGN(NFA_LENGTH(len))
42#define NFA_DATA(nfa) ((void *)(((char *)(nfa)) + NFA_LENGTH(0)))
43#define NFA_PAYLOAD(nfa) ((int)((nfa)->nfa_len) - NFA_LENGTH(0))
44#define NFA_NEST(skb, type) \
45({ struct nfattr *__start = (struct nfattr *)skb_tail_pointer(skb); \
46 NFA_PUT(skb, (NFNL_NFA_NEST | type), 0, NULL); \
47 __start; })
48#define NFA_NEST_END(skb, start) \
49({ (start)->nfa_len = skb_tail_pointer(skb) - (unsigned char *)(start); \
50 (skb)->len; })
51#define NFA_NEST_CANCEL(skb, start) \
52({ if (start) \
53 skb_trim(skb, (unsigned char *) (start) - (skb)->data); \
54 -1; })
55
56#define NFM_NFA(n) ((struct nfattr *)(((char *)(n)) \
57 + NLMSG_ALIGN(sizeof(struct nfgenmsg))))
58#define NFM_PAYLOAD(n) NLMSG_PAYLOAD(n, sizeof(struct nfgenmsg))
59
60#endif /* ! __KERNEL__ */
61#endif /* _NFNETLINK_COMPAT_H */
diff --git a/include/linux/netfilter/nfnetlink_conntrack.h b/include/linux/netfilter/nfnetlink_conntrack.h
index d7c35039721e..4affa3fe78e0 100644
--- a/include/linux/netfilter/nfnetlink_conntrack.h
+++ b/include/linux/netfilter/nfnetlink_conntrack.h
@@ -36,6 +36,7 @@ enum ctattr_type {
36 CTA_USE, 36 CTA_USE,
37 CTA_ID, 37 CTA_ID,
38 CTA_NAT_DST, 38 CTA_NAT_DST,
39 CTA_TUPLE_MASTER,
39 __CTA_MAX 40 __CTA_MAX
40}; 41};
41#define CTA_MAX (__CTA_MAX - 1) 42#define CTA_MAX (__CTA_MAX - 1)
diff --git a/include/linux/netfilter/xt_connlimit.h b/include/linux/netfilter/xt_connlimit.h
index 90ae8b474cb8..37e933c9987d 100644
--- a/include/linux/netfilter/xt_connlimit.h
+++ b/include/linux/netfilter/xt_connlimit.h
@@ -5,8 +5,8 @@ struct xt_connlimit_data;
5 5
6struct xt_connlimit_info { 6struct xt_connlimit_info {
7 union { 7 union {
8 u_int32_t v4_mask; 8 __be32 v4_mask;
9 u_int32_t v6_mask[4]; 9 __be32 v6_mask[4];
10 }; 10 };
11 unsigned int limit, inverse; 11 unsigned int limit, inverse;
12 12
diff --git a/include/linux/netfilter/xt_time.h b/include/linux/netfilter/xt_time.h
new file mode 100644
index 000000000000..14b6df412c9f
--- /dev/null
+++ b/include/linux/netfilter/xt_time.h
@@ -0,0 +1,25 @@
1#ifndef _XT_TIME_H
2#define _XT_TIME_H 1
3
4struct xt_time_info {
5 u_int32_t date_start;
6 u_int32_t date_stop;
7 u_int32_t daytime_start;
8 u_int32_t daytime_stop;
9 u_int32_t monthdays_match;
10 u_int8_t weekdays_match;
11 u_int8_t flags;
12};
13
14enum {
15 /* Match against local time (instead of UTC) */
16 XT_TIME_LOCAL_TZ = 1 << 0,
17
18 /* Shortcuts */
19 XT_TIME_ALL_MONTHDAYS = 0xFFFFFFFE,
20 XT_TIME_ALL_WEEKDAYS = 0xFE,
21 XT_TIME_MIN_DAYTIME = 0,
22 XT_TIME_MAX_DAYTIME = 24 * 60 * 60 - 1,
23};
24
25#endif /* _XT_TIME_H */
diff --git a/include/linux/netfilter_ipv4/ipt_iprange.h b/include/linux/netfilter_ipv4/ipt_iprange.h
index 34ab0fb736e2..a92fefc3c7ec 100644
--- a/include/linux/netfilter_ipv4/ipt_iprange.h
+++ b/include/linux/netfilter_ipv4/ipt_iprange.h
@@ -1,6 +1,8 @@
1#ifndef _IPT_IPRANGE_H 1#ifndef _IPT_IPRANGE_H
2#define _IPT_IPRANGE_H 2#define _IPT_IPRANGE_H
3 3
4#include <linux/types.h>
5
4#define IPRANGE_SRC 0x01 /* Match source IP address */ 6#define IPRANGE_SRC 0x01 /* Match source IP address */
5#define IPRANGE_DST 0x02 /* Match destination IP address */ 7#define IPRANGE_DST 0x02 /* Match destination IP address */
6#define IPRANGE_SRC_INV 0x10 /* Negate the condition */ 8#define IPRANGE_SRC_INV 0x10 /* Negate the condition */
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 2e23353c28a5..7c1f3b1d2ee5 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -27,6 +27,8 @@
27 27
28#define MAX_LINKS 32 28#define MAX_LINKS 32
29 29
30struct net;
31
30struct sockaddr_nl 32struct sockaddr_nl
31{ 33{
32 sa_family_t nl_family; /* AF_NETLINK */ 34 sa_family_t nl_family; /* AF_NETLINK */
@@ -129,6 +131,20 @@ struct nlattr
129 __u16 nla_type; 131 __u16 nla_type;
130}; 132};
131 133
134/*
135 * nla_type (16 bits)
136 * +---+---+-------------------------------+
137 * | N | O | Attribute Type |
138 * +---+---+-------------------------------+
139 * N := Carries nested attributes
140 * O := Payload stored in network byte order
141 *
142 * Note: The N and O flag are mutually exclusive.
143 */
144#define NLA_F_NESTED (1 << 15)
145#define NLA_F_NET_BYTEORDER (1 << 14)
146#define NLA_TYPE_MASK ~(NLA_F_NESTED | NLA_F_NET_BYTEORDER)
147
132#define NLA_ALIGNTO 4 148#define NLA_ALIGNTO 4
133#define NLA_ALIGN(len) (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1)) 149#define NLA_ALIGN(len) (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1))
134#define NLA_HDRLEN ((int) NLA_ALIGN(sizeof(struct nlattr))) 150#define NLA_HDRLEN ((int) NLA_ALIGN(sizeof(struct nlattr)))
@@ -157,10 +173,13 @@ struct netlink_skb_parms
157#define NETLINK_CREDS(skb) (&NETLINK_CB((skb)).creds) 173#define NETLINK_CREDS(skb) (&NETLINK_CB((skb)).creds)
158 174
159 175
160extern struct sock *netlink_kernel_create(int unit, unsigned int groups, 176extern struct sock *netlink_kernel_create(struct net *net,
161 void (*input)(struct sock *sk, int len), 177 int unit,unsigned int groups,
178 void (*input)(struct sk_buff *skb),
162 struct mutex *cb_mutex, 179 struct mutex *cb_mutex,
163 struct module *module); 180 struct module *module);
181extern int netlink_change_ngroups(struct sock *sk, unsigned int groups);
182extern void netlink_clear_multicast_users(struct sock *sk, unsigned int group);
164extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err); 183extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err);
165extern int netlink_has_listeners(struct sock *sk, unsigned int group); 184extern int netlink_has_listeners(struct sock *sk, unsigned int group);
166extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock); 185extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock);
@@ -175,7 +194,7 @@ struct sock *netlink_getsockbyfilp(struct file *filp);
175int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock, 194int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock,
176 long timeo, struct sock *ssk); 195 long timeo, struct sock *ssk);
177void netlink_detachskb(struct sock *sk, struct sk_buff *skb); 196void netlink_detachskb(struct sock *sk, struct sk_buff *skb);
178int netlink_sendskb(struct sock *sk, struct sk_buff *skb, int protocol); 197int netlink_sendskb(struct sock *sk, struct sk_buff *skb);
179 198
180/* 199/*
181 * skb should fit one page. This choice is good for headerless malloc. 200 * skb should fit one page. This choice is good for headerless malloc.
@@ -204,6 +223,7 @@ struct netlink_callback
204 223
205struct netlink_notify 224struct netlink_notify
206{ 225{
226 struct net *net;
207 int pid; 227 int pid;
208 int protocol; 228 int protocol;
209}; 229};
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h
index 29930b71a9aa..20250d963d72 100644
--- a/include/linux/netpoll.h
+++ b/include/linux/netpoll.h
@@ -25,8 +25,6 @@ struct netpoll {
25 25
26struct netpoll_info { 26struct netpoll_info {
27 atomic_t refcnt; 27 atomic_t refcnt;
28 spinlock_t poll_lock;
29 int poll_owner;
30 int rx_flags; 28 int rx_flags;
31 spinlock_t rx_lock; 29 spinlock_t rx_lock;
32 struct netpoll *rx_np; /* netpoll that registered an rx_hook */ 30 struct netpoll *rx_np; /* netpoll that registered an rx_hook */
@@ -37,6 +35,7 @@ struct netpoll_info {
37 35
38void netpoll_poll(struct netpoll *np); 36void netpoll_poll(struct netpoll *np);
39void netpoll_send_udp(struct netpoll *np, const char *msg, int len); 37void netpoll_send_udp(struct netpoll *np, const char *msg, int len);
38void netpoll_print_options(struct netpoll *np);
40int netpoll_parse_options(struct netpoll *np, char *opt); 39int netpoll_parse_options(struct netpoll *np, char *opt);
41int netpoll_setup(struct netpoll *np); 40int netpoll_setup(struct netpoll *np);
42int netpoll_trap(void); 41int netpoll_trap(void);
@@ -64,32 +63,61 @@ static inline int netpoll_rx(struct sk_buff *skb)
64 return ret; 63 return ret;
65} 64}
66 65
67static inline void *netpoll_poll_lock(struct net_device *dev) 66static inline int netpoll_receive_skb(struct sk_buff *skb)
68{ 67{
68 if (!list_empty(&skb->dev->napi_list))
69 return netpoll_rx(skb);
70 return 0;
71}
72
73static inline void *netpoll_poll_lock(struct napi_struct *napi)
74{
75 struct net_device *dev = napi->dev;
76
69 rcu_read_lock(); /* deal with race on ->npinfo */ 77 rcu_read_lock(); /* deal with race on ->npinfo */
70 if (dev->npinfo) { 78 if (dev && dev->npinfo) {
71 spin_lock(&dev->npinfo->poll_lock); 79 spin_lock(&napi->poll_lock);
72 dev->npinfo->poll_owner = smp_processor_id(); 80 napi->poll_owner = smp_processor_id();
73 return dev->npinfo; 81 return napi;
74 } 82 }
75 return NULL; 83 return NULL;
76} 84}
77 85
78static inline void netpoll_poll_unlock(void *have) 86static inline void netpoll_poll_unlock(void *have)
79{ 87{
80 struct netpoll_info *npi = have; 88 struct napi_struct *napi = have;
81 89
82 if (npi) { 90 if (napi) {
83 npi->poll_owner = -1; 91 napi->poll_owner = -1;
84 spin_unlock(&npi->poll_lock); 92 spin_unlock(&napi->poll_lock);
85 } 93 }
86 rcu_read_unlock(); 94 rcu_read_unlock();
87} 95}
88 96
97static inline void netpoll_netdev_init(struct net_device *dev)
98{
99 INIT_LIST_HEAD(&dev->napi_list);
100}
101
89#else 102#else
90#define netpoll_rx(a) 0 103static inline int netpoll_rx(struct sk_buff *skb)
91#define netpoll_poll_lock(a) NULL 104{
92#define netpoll_poll_unlock(a) 105 return 0;
106}
107static inline int netpoll_receive_skb(struct sk_buff *skb)
108{
109 return 0;
110}
111static inline void *netpoll_poll_lock(struct napi_struct *napi)
112{
113 return NULL;
114}
115static inline void netpoll_poll_unlock(void *have)
116{
117}
118static inline void netpoll_netdev_init(struct net_device *dev)
119{
120}
93#endif 121#endif
94 122
95#endif 123#endif
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index c098ae194f79..7250eeadd7b5 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -71,7 +71,7 @@ struct nfs_access_entry {
71 71
72struct nfs4_state; 72struct nfs4_state;
73struct nfs_open_context { 73struct nfs_open_context {
74 struct kref kref; 74 atomic_t count;
75 struct path path; 75 struct path path;
76 struct rpc_cred *cred; 76 struct rpc_cred *cred;
77 struct nfs4_state *state; 77 struct nfs4_state *state;
@@ -407,8 +407,8 @@ extern void nfs_release_automount_timer(void);
407/* 407/*
408 * linux/fs/nfs/unlink.c 408 * linux/fs/nfs/unlink.c
409 */ 409 */
410extern int nfs_async_unlink(struct dentry *); 410extern int nfs_async_unlink(struct inode *dir, struct dentry *dentry);
411extern void nfs_complete_unlink(struct dentry *); 411extern void nfs_complete_unlink(struct dentry *dentry, struct inode *);
412 412
413/* 413/*
414 * linux/fs/nfs/write.c 414 * linux/fs/nfs/write.c
@@ -431,6 +431,7 @@ extern int nfs_sync_mapping_range(struct address_space *, loff_t, loff_t, int);
431extern int nfs_wb_all(struct inode *inode); 431extern int nfs_wb_all(struct inode *inode);
432extern int nfs_wb_page(struct inode *inode, struct page* page); 432extern int nfs_wb_page(struct inode *inode, struct page* page);
433extern int nfs_wb_page_priority(struct inode *inode, struct page* page, int how); 433extern int nfs_wb_page_priority(struct inode *inode, struct page* page, int how);
434extern int nfs_wb_page_cancel(struct inode *inode, struct page* page);
434#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) 435#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)
435extern int nfs_commit_inode(struct inode *, int); 436extern int nfs_commit_inode(struct inode *, int);
436extern struct nfs_write_data *nfs_commit_alloc(void); 437extern struct nfs_write_data *nfs_commit_alloc(void);
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 38d77681cf27..cf74a4db84a5 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -278,6 +278,21 @@ struct nfs_writeres {
278}; 278};
279 279
280/* 280/*
281 * Common arguments to the unlink call
282 */
283struct nfs_removeargs {
284 const struct nfs_fh *fh;
285 struct qstr name;
286 const u32 * bitmask;
287};
288
289struct nfs_removeres {
290 const struct nfs_server *server;
291 struct nfs4_change_info cinfo;
292 struct nfs_fattr dir_attr;
293};
294
295/*
281 * Argument struct for decode_entry function 296 * Argument struct for decode_entry function
282 */ 297 */
283struct nfs_entry { 298struct nfs_entry {
@@ -631,18 +646,6 @@ struct nfs4_readlink {
631 struct page ** pages; /* zero-copy data */ 646 struct page ** pages; /* zero-copy data */
632}; 647};
633 648
634struct nfs4_remove_arg {
635 const struct nfs_fh * fh;
636 const struct qstr * name;
637 const u32 * bitmask;
638};
639
640struct nfs4_remove_res {
641 const struct nfs_server * server;
642 struct nfs4_change_info cinfo;
643 struct nfs_fattr * dir_attr;
644};
645
646struct nfs4_rename_arg { 649struct nfs4_rename_arg {
647 const struct nfs_fh * old_dir; 650 const struct nfs_fh * old_dir;
648 const struct nfs_fh * new_dir; 651 const struct nfs_fh * new_dir;
@@ -788,9 +791,8 @@ struct nfs_rpc_ops {
788 int (*create) (struct inode *, struct dentry *, 791 int (*create) (struct inode *, struct dentry *,
789 struct iattr *, int, struct nameidata *); 792 struct iattr *, int, struct nameidata *);
790 int (*remove) (struct inode *, struct qstr *); 793 int (*remove) (struct inode *, struct qstr *);
791 int (*unlink_setup) (struct rpc_message *, 794 void (*unlink_setup) (struct rpc_message *, struct inode *dir);
792 struct dentry *, struct qstr *); 795 int (*unlink_done) (struct rpc_task *, struct inode *);
793 int (*unlink_done) (struct dentry *, struct rpc_task *);
794 int (*rename) (struct inode *, struct qstr *, 796 int (*rename) (struct inode *, struct qstr *,
795 struct inode *, struct qstr *); 797 struct inode *, struct qstr *);
796 int (*link) (struct inode *, struct inode *, struct qstr *); 798 int (*link) (struct inode *, struct inode *, struct qstr *);
diff --git a/include/linux/nfsd/export.h b/include/linux/nfsd/export.h
index 78feb7beff75..5cd192469096 100644
--- a/include/linux/nfsd/export.h
+++ b/include/linux/nfsd/export.h
@@ -116,18 +116,7 @@ struct svc_expkey {
116#define EX_NOHIDE(exp) ((exp)->ex_flags & NFSEXP_NOHIDE) 116#define EX_NOHIDE(exp) ((exp)->ex_flags & NFSEXP_NOHIDE)
117#define EX_WGATHER(exp) ((exp)->ex_flags & NFSEXP_GATHERED_WRITES) 117#define EX_WGATHER(exp) ((exp)->ex_flags & NFSEXP_GATHERED_WRITES)
118 118
119static inline int EX_RDONLY(struct svc_export *exp, struct svc_rqst *rqstp) 119int nfsexp_flags(struct svc_rqst *rqstp, struct svc_export *exp);
120{
121 struct exp_flavor_info *f;
122 struct exp_flavor_info *end = exp->ex_flavors + exp->ex_nflavors;
123
124 for (f = exp->ex_flavors; f < end; f++) {
125 if (f->pseudoflavor == rqstp->rq_flavor)
126 return f->flags & NFSEXP_READONLY;
127 }
128 return exp->ex_flags & NFSEXP_READONLY;
129}
130
131__be32 check_nfsd_access(struct svc_export *exp, struct svc_rqst *rqstp); 120__be32 check_nfsd_access(struct svc_export *exp, struct svc_rqst *rqstp);
132 121
133/* 122/*
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index 9a30ba2ca75e..538ee1dd3d0a 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -7,7 +7,97 @@
7 */ 7 */
8 8
9/** 9/**
10 * enum nl80211_commands - supported nl80211 commands
11 *
12 * @NL80211_CMD_UNSPEC: unspecified command to catch errors
13 *
14 * @NL80211_CMD_GET_WIPHY: request information about a wiphy or dump request
15 * to get a list of all present wiphys.
16 * @NL80211_CMD_SET_WIPHY: set wiphy name, needs %NL80211_ATTR_WIPHY and
17 * %NL80211_ATTR_WIPHY_NAME.
18 * @NL80211_CMD_NEW_WIPHY: Newly created wiphy, response to get request
19 * or rename notification. Has attributes %NL80211_ATTR_WIPHY and
20 * %NL80211_ATTR_WIPHY_NAME.
21 * @NL80211_CMD_DEL_WIPHY: Wiphy deleted. Has attributes
22 * %NL80211_ATTR_WIPHY and %NL80211_ATTR_WIPHY_NAME.
23 *
24 * @NL80211_CMD_GET_INTERFACE: Request an interface's configuration;
25 * either a dump request on a %NL80211_ATTR_WIPHY or a specific get
26 * on an %NL80211_ATTR_IFINDEX is supported.
27 * @NL80211_CMD_SET_INTERFACE: Set type of a virtual interface, requires
28 * %NL80211_ATTR_IFINDEX and %NL80211_ATTR_IFTYPE.
29 * @NL80211_CMD_NEW_INTERFACE: Newly created virtual interface or response
30 * to %NL80211_CMD_GET_INTERFACE. Has %NL80211_ATTR_IFINDEX,
31 * %NL80211_ATTR_WIPHY and %NL80211_ATTR_IFTYPE attributes. Can also
32 * be sent from userspace to request creation of a new virtual interface,
33 * then requires attributes %NL80211_ATTR_WIPHY, %NL80211_ATTR_IFTYPE and
34 * %NL80211_ATTR_IFNAME.
35 * @NL80211_CMD_DEL_INTERFACE: Virtual interface was deleted, has attributes
36 * %NL80211_ATTR_IFINDEX and %NL80211_ATTR_WIPHY. Can also be sent from
37 * userspace to request deletion of a virtual interface, then requires
38 * attribute %NL80211_ATTR_IFINDEX.
39 *
40 * @NL80211_CMD_MAX: highest used command number
41 * @__NL80211_CMD_AFTER_LAST: internal use
42 */
43enum nl80211_commands {
44/* don't change the order or add anything inbetween, this is ABI! */
45 NL80211_CMD_UNSPEC,
46
47 NL80211_CMD_GET_WIPHY, /* can dump */
48 NL80211_CMD_SET_WIPHY,
49 NL80211_CMD_NEW_WIPHY,
50 NL80211_CMD_DEL_WIPHY,
51
52 NL80211_CMD_GET_INTERFACE, /* can dump */
53 NL80211_CMD_SET_INTERFACE,
54 NL80211_CMD_NEW_INTERFACE,
55 NL80211_CMD_DEL_INTERFACE,
56
57 /* add commands here */
58
59 /* used to define NL80211_CMD_MAX below */
60 __NL80211_CMD_AFTER_LAST,
61 NL80211_CMD_MAX = __NL80211_CMD_AFTER_LAST - 1
62};
63
64
65/**
66 * enum nl80211_attrs - nl80211 netlink attributes
67 *
68 * @NL80211_ATTR_UNSPEC: unspecified attribute to catch errors
69 *
70 * @NL80211_ATTR_WIPHY: index of wiphy to operate on, cf.
71 * /sys/class/ieee80211/<phyname>/index
72 * @NL80211_ATTR_WIPHY_NAME: wiphy name (used for renaming)
73 *
74 * @NL80211_ATTR_IFINDEX: network interface index of the device to operate on
75 * @NL80211_ATTR_IFNAME: network interface name
76 * @NL80211_ATTR_IFTYPE: type of virtual interface, see &enum nl80211_iftype
77 *
78 * @NL80211_ATTR_MAX: highest attribute number currently defined
79 * @__NL80211_ATTR_AFTER_LAST: internal use
80 */
81enum nl80211_attrs {
82/* don't change the order or add anything inbetween, this is ABI! */
83 NL80211_ATTR_UNSPEC,
84
85 NL80211_ATTR_WIPHY,
86 NL80211_ATTR_WIPHY_NAME,
87
88 NL80211_ATTR_IFINDEX,
89 NL80211_ATTR_IFNAME,
90 NL80211_ATTR_IFTYPE,
91
92 /* add attributes here, update the policy in nl80211.c */
93
94 __NL80211_ATTR_AFTER_LAST,
95 NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1
96};
97
98/**
10 * enum nl80211_iftype - (virtual) interface types 99 * enum nl80211_iftype - (virtual) interface types
100 *
11 * @NL80211_IFTYPE_UNSPECIFIED: unspecified type, driver decides 101 * @NL80211_IFTYPE_UNSPECIFIED: unspecified type, driver decides
12 * @NL80211_IFTYPE_ADHOC: independent BSS member 102 * @NL80211_IFTYPE_ADHOC: independent BSS member
13 * @NL80211_IFTYPE_STATION: managed BSS member 103 * @NL80211_IFTYPE_STATION: managed BSS member
@@ -15,9 +105,10 @@
15 * @NL80211_IFTYPE_AP_VLAN: VLAN interface for access points 105 * @NL80211_IFTYPE_AP_VLAN: VLAN interface for access points
16 * @NL80211_IFTYPE_WDS: wireless distribution interface 106 * @NL80211_IFTYPE_WDS: wireless distribution interface
17 * @NL80211_IFTYPE_MONITOR: monitor interface receiving all frames 107 * @NL80211_IFTYPE_MONITOR: monitor interface receiving all frames
108 * @NL80211_IFTYPE_MAX: highest interface type number currently defined
18 * @__NL80211_IFTYPE_AFTER_LAST: internal use 109 * @__NL80211_IFTYPE_AFTER_LAST: internal use
19 * 110 *
20 * These values are used with the NL80211_ATTR_IFTYPE 111 * These values are used with the %NL80211_ATTR_IFTYPE
21 * to set the type of an interface. 112 * to set the type of an interface.
22 * 113 *
23 */ 114 */
@@ -31,8 +122,8 @@ enum nl80211_iftype {
31 NL80211_IFTYPE_MONITOR, 122 NL80211_IFTYPE_MONITOR,
32 123
33 /* keep last */ 124 /* keep last */
34 __NL80211_IFTYPE_AFTER_LAST 125 __NL80211_IFTYPE_AFTER_LAST,
126 NL80211_IFTYPE_MAX = __NL80211_IFTYPE_AFTER_LAST - 1
35}; 127};
36#define NL80211_IFTYPE_MAX (__NL80211_IFTYPE_AFTER_LAST - 1)
37 128
38#endif /* __LINUX_NL80211_H */ 129#endif /* __LINUX_NL80211_H */
diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index 576f2bb34cc8..fad7ff17e468 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -157,6 +157,19 @@ extern int __srcu_notifier_call_chain(struct srcu_notifier_head *nh,
157 */ 157 */
158#define NOTIFY_STOP (NOTIFY_OK|NOTIFY_STOP_MASK) 158#define NOTIFY_STOP (NOTIFY_OK|NOTIFY_STOP_MASK)
159 159
160/* Encapsulate (negative) errno value (in particular, NOTIFY_BAD <=> EPERM). */
161static inline int notifier_from_errno(int err)
162{
163 return NOTIFY_STOP_MASK | (NOTIFY_OK - err);
164}
165
166/* Restore (negative) errno value from notify return value. */
167static inline int notifier_to_errno(int ret)
168{
169 ret &= ~NOTIFY_STOP_MASK;
170 return ret > NOTIFY_OK ? NOTIFY_OK - ret : 0;
171}
172
160/* 173/*
161 * Declared notifiers so far. I can imagine quite a few more chains 174 * Declared notifiers so far. I can imagine quite a few more chains
162 * over time (eg laptop power reset chains, reboot chain (to clean 175 * over time (eg laptop power reset chains, reboot chain (to clean
@@ -212,5 +225,11 @@ extern int __srcu_notifier_call_chain(struct srcu_notifier_head *nh,
212#define CPU_DEAD_FROZEN (CPU_DEAD | CPU_TASKS_FROZEN) 225#define CPU_DEAD_FROZEN (CPU_DEAD | CPU_TASKS_FROZEN)
213#define CPU_DYING_FROZEN (CPU_DYING | CPU_TASKS_FROZEN) 226#define CPU_DYING_FROZEN (CPU_DYING | CPU_TASKS_FROZEN)
214 227
228/* Hibernation and suspend events */
229#define PM_HIBERNATION_PREPARE 0x0001 /* Going to hibernate */
230#define PM_POST_HIBERNATION 0x0002 /* Hibernation finished */
231#define PM_SUSPEND_PREPARE 0x0003 /* Going to suspend the system */
232#define PM_POST_SUSPEND 0x0004 /* Suspend finished */
233
215#endif /* __KERNEL__ */ 234#endif /* __KERNEL__ */
216#endif /* _LINUX_NOTIFIER_H */ 235#endif /* _LINUX_NOTIFIER_H */
diff --git a/include/linux/nsproxy.h b/include/linux/nsproxy.h
index ce06188b7a56..bec4485e3d76 100644
--- a/include/linux/nsproxy.h
+++ b/include/linux/nsproxy.h
@@ -29,6 +29,7 @@ struct nsproxy {
29 struct mnt_namespace *mnt_ns; 29 struct mnt_namespace *mnt_ns;
30 struct pid_namespace *pid_ns; 30 struct pid_namespace *pid_ns;
31 struct user_namespace *user_ns; 31 struct user_namespace *user_ns;
32 struct net *net_ns;
32}; 33};
33extern struct nsproxy init_nsproxy; 34extern struct nsproxy init_nsproxy;
34 35
diff --git a/include/linux/of.h b/include/linux/of.h
new file mode 100644
index 000000000000..6df80e985914
--- /dev/null
+++ b/include/linux/of.h
@@ -0,0 +1,60 @@
1#ifndef _LINUX_OF_H
2#define _LINUX_OF_H
3/*
4 * Definitions for talking to the Open Firmware PROM on
5 * Power Macintosh and other computers.
6 *
7 * Copyright (C) 1996-2005 Paul Mackerras.
8 *
9 * Updates for PPC64 by Peter Bergner & David Engebretsen, IBM Corp.
10 * Updates for SPARC64 by David S. Miller
11 * Derived from PowerPC and Sparc prom.h files by Stephen Rothwell, IBM Corp.
12 *
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version
16 * 2 of the License, or (at your option) any later version.
17 */
18#include <linux/types.h>
19
20#include <asm/bitops.h>
21#include <asm/prom.h>
22
23/* flag descriptions */
24#define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */
25#define OF_DETACHED 2 /* node has been detached from the device tree */
26
27#define OF_BAD_ADDR ((u64)-1)
28
29extern struct device_node *of_find_node_by_name(struct device_node *from,
30 const char *name);
31#define for_each_node_by_name(dn, name) \
32 for (dn = of_find_node_by_name(NULL, name); dn; \
33 dn = of_find_node_by_name(dn, name))
34extern struct device_node *of_find_node_by_type(struct device_node *from,
35 const char *type);
36#define for_each_node_by_type(dn, type) \
37 for (dn = of_find_node_by_type(NULL, type); dn; \
38 dn = of_find_node_by_type(dn, type))
39extern struct device_node *of_find_compatible_node(struct device_node *from,
40 const char *type, const char *compat);
41#define for_each_compatible_node(dn, type, compatible) \
42 for (dn = of_find_compatible_node(NULL, type, compatible); dn; \
43 dn = of_find_compatible_node(dn, type, compatible))
44extern struct device_node *of_find_node_by_path(const char *path);
45extern struct device_node *of_find_node_by_phandle(phandle handle);
46extern struct device_node *of_get_parent(const struct device_node *node);
47extern struct device_node *of_get_next_child(const struct device_node *node,
48 struct device_node *prev);
49extern struct property *of_find_property(const struct device_node *np,
50 const char *name,
51 int *lenp);
52extern int of_device_is_compatible(const struct device_node *device,
53 const char *);
54extern const void *of_get_property(const struct device_node *node,
55 const char *name,
56 int *lenp);
57extern int of_n_addr_cells(struct device_node *np);
58extern int of_n_size_cells(struct device_node *np);
59
60#endif /* _LINUX_OF_H */
diff --git a/include/linux/of_device.h b/include/linux/of_device.h
new file mode 100644
index 000000000000..91bf84b9d144
--- /dev/null
+++ b/include/linux/of_device.h
@@ -0,0 +1,26 @@
1#ifndef _LINUX_OF_DEVICE_H
2#define _LINUX_OF_DEVICE_H
3#ifdef __KERNEL__
4
5#include <linux/device.h>
6#include <linux/of.h>
7#include <linux/mod_devicetable.h>
8
9#include <asm/of_device.h>
10
11#define to_of_device(d) container_of(d, struct of_device, dev)
12
13extern const struct of_device_id *of_match_node(
14 const struct of_device_id *matches, const struct device_node *node);
15extern const struct of_device_id *of_match_device(
16 const struct of_device_id *matches, const struct of_device *dev);
17
18extern struct of_device *of_dev_get(struct of_device *dev);
19extern void of_dev_put(struct of_device *dev);
20
21extern int of_device_register(struct of_device *ofdev);
22extern void of_device_unregister(struct of_device *ofdev);
23extern void of_release_dev(struct device *dev);
24
25#endif /* __KERNEL__ */
26#endif /* _LINUX_OF_DEVICE_H */
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
new file mode 100644
index 000000000000..448f70b30a0c
--- /dev/null
+++ b/include/linux/of_platform.h
@@ -0,0 +1,57 @@
1#ifndef _LINUX_OF_PLATFORM_H
2#define _LINUX_OF_PLATFORM_H
3/*
4 * Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corp.
5 * <benh@kernel.crashing.org>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 *
12 */
13
14#include <linux/module.h>
15#include <linux/device.h>
16#include <linux/mod_devicetable.h>
17#include <linux/pm.h>
18#include <linux/of_device.h>
19
20/*
21 * The of_platform_bus_type is a bus type used by drivers that do not
22 * attach to a macio or similar bus but still use OF probing
23 * mechanism
24 */
25extern struct bus_type of_platform_bus_type;
26
27/*
28 * An of_platform_driver driver is attached to a basic of_device on
29 * the "platform bus" (of_platform_bus_type) (or ISA, EBUS and SBUS
30 * busses on sparc).
31 */
32struct of_platform_driver
33{
34 const char *name;
35 const struct of_device_id *match_table;
36 struct module *owner;
37
38 int (*probe)(struct of_device* dev,
39 const struct of_device_id *match);
40 int (*remove)(struct of_device* dev);
41
42 int (*suspend)(struct of_device* dev, pm_message_t state);
43 int (*resume)(struct of_device* dev);
44 int (*shutdown)(struct of_device* dev);
45
46 struct device_driver driver;
47};
48#define to_of_platform_driver(drv) \
49 container_of(drv,struct of_platform_driver, driver)
50
51#include <asm/of_platform.h>
52
53extern struct of_device *of_find_device_by_node(struct device_node *np);
54
55extern int of_bus_type_init(struct bus_type *bus, const char *name);
56
57#endif /* _LINUX_OF_PLATFORM_H */
diff --git a/include/linux/oprofile.h b/include/linux/oprofile.h
index 0d514b252454..041bb31100f4 100644
--- a/include/linux/oprofile.h
+++ b/include/linux/oprofile.h
@@ -17,6 +17,26 @@
17#include <linux/spinlock.h> 17#include <linux/spinlock.h>
18#include <asm/atomic.h> 18#include <asm/atomic.h>
19 19
20/* Each escaped entry is prefixed by ESCAPE_CODE
21 * then one of the following codes, then the
22 * relevant data.
23 * These #defines live in this file so that arch-specific
24 * buffer sync'ing code can access them.
25 */
26#define ESCAPE_CODE ~0UL
27#define CTX_SWITCH_CODE 1
28#define CPU_SWITCH_CODE 2
29#define COOKIE_SWITCH_CODE 3
30#define KERNEL_ENTER_SWITCH_CODE 4
31#define KERNEL_EXIT_SWITCH_CODE 5
32#define MODULE_LOADED_CODE 6
33#define CTX_TGID_CODE 7
34#define TRACE_BEGIN_CODE 8
35#define TRACE_END_CODE 9
36#define XEN_ENTER_SWITCH_CODE 10
37#define SPU_PROFILING_CODE 11
38#define SPU_CTX_SWITCH_CODE 12
39
20struct super_block; 40struct super_block;
21struct dentry; 41struct dentry;
22struct file_operations; 42struct file_operations;
@@ -35,6 +55,14 @@ struct oprofile_operations {
35 int (*start)(void); 55 int (*start)(void);
36 /* Stop delivering interrupts. */ 56 /* Stop delivering interrupts. */
37 void (*stop)(void); 57 void (*stop)(void);
58 /* Arch-specific buffer sync functions.
59 * Return value = 0: Success
60 * Return value = -1: Failure
61 * Return value = 1: Run generic sync function
62 */
63 int (*sync_start)(void);
64 int (*sync_stop)(void);
65
38 /* Initiate a stack backtrace. Optional. */ 66 /* Initiate a stack backtrace. Optional. */
39 void (*backtrace)(struct pt_regs * const regs, unsigned int depth); 67 void (*backtrace)(struct pt_regs * const regs, unsigned int depth);
40 /* CPU identification string. */ 68 /* CPU identification string. */
@@ -56,6 +84,13 @@ int oprofile_arch_init(struct oprofile_operations * ops);
56void oprofile_arch_exit(void); 84void oprofile_arch_exit(void);
57 85
58/** 86/**
87 * Add data to the event buffer.
88 * The data passed is free-form, but typically consists of
89 * file offsets, dcookies, context information, and ESCAPE codes.
90 */
91void add_event_entry(unsigned long data);
92
93/**
59 * Add a sample. This may be called from any context. Pass 94 * Add a sample. This may be called from any context. Pass
60 * smp_processor_id() as cpu. 95 * smp_processor_id() as cpu.
61 */ 96 */
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index ae2d79f2107e..209d3a47f50f 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -90,8 +90,12 @@
90#define PG_reclaim 17 /* To be reclaimed asap */ 90#define PG_reclaim 17 /* To be reclaimed asap */
91#define PG_buddy 19 /* Page is free, on buddy lists */ 91#define PG_buddy 19 /* Page is free, on buddy lists */
92 92
93/* PG_readahead is only used for file reads; PG_reclaim is only for writes */
94#define PG_readahead PG_reclaim /* Reminder to do async read-ahead */
95
93/* PG_owner_priv_1 users should have descriptive aliases */ 96/* PG_owner_priv_1 users should have descriptive aliases */
94#define PG_checked PG_owner_priv_1 /* Used by some filesystems */ 97#define PG_checked PG_owner_priv_1 /* Used by some filesystems */
98#define PG_pinned PG_owner_priv_1 /* Xen pinned pagetable */
95 99
96#if (BITS_PER_LONG > 32) 100#if (BITS_PER_LONG > 32)
97/* 101/*
@@ -170,6 +174,10 @@ static inline void SetPageUptodate(struct page *page)
170#define SetPageChecked(page) set_bit(PG_checked, &(page)->flags) 174#define SetPageChecked(page) set_bit(PG_checked, &(page)->flags)
171#define ClearPageChecked(page) clear_bit(PG_checked, &(page)->flags) 175#define ClearPageChecked(page) clear_bit(PG_checked, &(page)->flags)
172 176
177#define PagePinned(page) test_bit(PG_pinned, &(page)->flags)
178#define SetPagePinned(page) set_bit(PG_pinned, &(page)->flags)
179#define ClearPagePinned(page) clear_bit(PG_pinned, &(page)->flags)
180
173#define PageReserved(page) test_bit(PG_reserved, &(page)->flags) 181#define PageReserved(page) test_bit(PG_reserved, &(page)->flags)
174#define SetPageReserved(page) set_bit(PG_reserved, &(page)->flags) 182#define SetPageReserved(page) set_bit(PG_reserved, &(page)->flags)
175#define ClearPageReserved(page) clear_bit(PG_reserved, &(page)->flags) 183#define ClearPageReserved(page) clear_bit(PG_reserved, &(page)->flags)
@@ -181,37 +189,15 @@ static inline void SetPageUptodate(struct page *page)
181#define __SetPagePrivate(page) __set_bit(PG_private, &(page)->flags) 189#define __SetPagePrivate(page) __set_bit(PG_private, &(page)->flags)
182#define __ClearPagePrivate(page) __clear_bit(PG_private, &(page)->flags) 190#define __ClearPagePrivate(page) __clear_bit(PG_private, &(page)->flags)
183 191
192/*
193 * Only test-and-set exist for PG_writeback. The unconditional operators are
194 * risky: they bypass page accounting.
195 */
184#define PageWriteback(page) test_bit(PG_writeback, &(page)->flags) 196#define PageWriteback(page) test_bit(PG_writeback, &(page)->flags)
185#define SetPageWriteback(page) \ 197#define TestSetPageWriteback(page) test_and_set_bit(PG_writeback, \
186 do { \ 198 &(page)->flags)
187 if (!test_and_set_bit(PG_writeback, \ 199#define TestClearPageWriteback(page) test_and_clear_bit(PG_writeback, \
188 &(page)->flags)) \ 200 &(page)->flags)
189 inc_zone_page_state(page, NR_WRITEBACK); \
190 } while (0)
191#define TestSetPageWriteback(page) \
192 ({ \
193 int ret; \
194 ret = test_and_set_bit(PG_writeback, \
195 &(page)->flags); \
196 if (!ret) \
197 inc_zone_page_state(page, NR_WRITEBACK); \
198 ret; \
199 })
200#define ClearPageWriteback(page) \
201 do { \
202 if (test_and_clear_bit(PG_writeback, \
203 &(page)->flags)) \
204 dec_zone_page_state(page, NR_WRITEBACK); \
205 } while (0)
206#define TestClearPageWriteback(page) \
207 ({ \
208 int ret; \
209 ret = test_and_clear_bit(PG_writeback, \
210 &(page)->flags); \
211 if (ret) \
212 dec_zone_page_state(page, NR_WRITEBACK); \
213 ret; \
214 })
215 201
216#define PageBuddy(page) test_bit(PG_buddy, &(page)->flags) 202#define PageBuddy(page) test_bit(PG_buddy, &(page)->flags)
217#define __SetPageBuddy(page) __set_bit(PG_buddy, &(page)->flags) 203#define __SetPageBuddy(page) __set_bit(PG_buddy, &(page)->flags)
@@ -221,6 +207,10 @@ static inline void SetPageUptodate(struct page *page)
221#define SetPageMappedToDisk(page) set_bit(PG_mappedtodisk, &(page)->flags) 207#define SetPageMappedToDisk(page) set_bit(PG_mappedtodisk, &(page)->flags)
222#define ClearPageMappedToDisk(page) clear_bit(PG_mappedtodisk, &(page)->flags) 208#define ClearPageMappedToDisk(page) clear_bit(PG_mappedtodisk, &(page)->flags)
223 209
210#define PageReadahead(page) test_bit(PG_readahead, &(page)->flags)
211#define SetPageReadahead(page) set_bit(PG_readahead, &(page)->flags)
212#define ClearPageReadahead(page) clear_bit(PG_readahead, &(page)->flags)
213
224#define PageReclaim(page) test_bit(PG_reclaim, &(page)->flags) 214#define PageReclaim(page) test_bit(PG_reclaim, &(page)->flags)
225#define SetPageReclaim(page) set_bit(PG_reclaim, &(page)->flags) 215#define SetPageReclaim(page) set_bit(PG_reclaim, &(page)->flags)
226#define ClearPageReclaim(page) clear_bit(PG_reclaim, &(page)->flags) 216#define ClearPageReclaim(page) clear_bit(PG_reclaim, &(page)->flags)
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 5e84f2e8d54c..768b93359f90 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -534,6 +534,7 @@ static inline int pci_write_config_dword(struct pci_dev *dev, int where, u32 val
534 534
535int __must_check pci_enable_device(struct pci_dev *dev); 535int __must_check pci_enable_device(struct pci_dev *dev);
536int __must_check pci_enable_device_bars(struct pci_dev *dev, int mask); 536int __must_check pci_enable_device_bars(struct pci_dev *dev, int mask);
537int __must_check pci_reenable_device(struct pci_dev *);
537int __must_check pcim_enable_device(struct pci_dev *pdev); 538int __must_check pcim_enable_device(struct pci_dev *pdev);
538void pcim_pin_device(struct pci_dev *pdev); 539void pcim_pin_device(struct pci_dev *pdev);
539 540
@@ -556,6 +557,7 @@ int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask);
556int pcix_get_max_mmrbc(struct pci_dev *dev); 557int pcix_get_max_mmrbc(struct pci_dev *dev);
557int pcix_get_mmrbc(struct pci_dev *dev); 558int pcix_get_mmrbc(struct pci_dev *dev);
558int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc); 559int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc);
560int pcie_get_readrq(struct pci_dev *dev);
559int pcie_set_readrq(struct pci_dev *dev, int rq); 561int pcie_set_readrq(struct pci_dev *dev, int rq);
560void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno); 562void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno);
561int __must_check pci_assign_resource(struct pci_dev *dev, int i); 563int __must_check pci_assign_resource(struct pci_dev *dev, int i);
@@ -577,6 +579,9 @@ int pci_set_power_state(struct pci_dev *dev, pci_power_t state);
577pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state); 579pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state);
578int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable); 580int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable);
579 581
582/* Functions for PCI Hotplug drivers to use */
583int pci_bus_find_capability (struct pci_bus *bus, unsigned int devfn, int cap);
584
580/* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */ 585/* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */
581void pci_bus_assign_resources(struct pci_bus *bus); 586void pci_bus_assign_resources(struct pci_bus *bus);
582void pci_bus_size_bridges(struct pci_bus *bus); 587void pci_bus_size_bridges(struct pci_bus *bus);
@@ -680,13 +685,16 @@ extern void pci_unblock_user_cfg_access(struct pci_dev *dev);
680 * a PCI domain is defined to be a set of PCI busses which share 685 * a PCI domain is defined to be a set of PCI busses which share
681 * configuration space. 686 * configuration space.
682 */ 687 */
683#ifndef CONFIG_PCI_DOMAINS 688#ifdef CONFIG_PCI_DOMAINS
689extern int pci_domains_supported;
690#else
691enum { pci_domains_supported = 0 };
684static inline int pci_domain_nr(struct pci_bus *bus) { return 0; } 692static inline int pci_domain_nr(struct pci_bus *bus) { return 0; }
685static inline int pci_proc_domain(struct pci_bus *bus) 693static inline int pci_proc_domain(struct pci_bus *bus)
686{ 694{
687 return 0; 695 return 0;
688} 696}
689#endif 697#endif /* CONFIG_PCI_DOMAINS */
690 698
691#else /* CONFIG_PCI is not enabled */ 699#else /* CONFIG_PCI is not enabled */
692 700
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 2c7add169539..87439ad94685 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -360,6 +360,9 @@
360#define PCI_DEVICE_ID_ATI_RS400_166 0x5a32 360#define PCI_DEVICE_ID_ATI_RS400_166 0x5a32
361#define PCI_DEVICE_ID_ATI_RS400_200 0x5a33 361#define PCI_DEVICE_ID_ATI_RS400_200 0x5a33
362#define PCI_DEVICE_ID_ATI_RS480 0x5950 362#define PCI_DEVICE_ID_ATI_RS480 0x5950
363#define PCI_DEVICE_ID_ATI_RD580 0x5952
364#define PCI_DEVICE_ID_ATI_RX790 0x5957
365#define PCI_DEVICE_ID_ATI_RS690 0x7910
363/* ATI IXP Chipset */ 366/* ATI IXP Chipset */
364#define PCI_DEVICE_ID_ATI_IXP200_IDE 0x4349 367#define PCI_DEVICE_ID_ATI_IXP200_IDE 0x4349
365#define PCI_DEVICE_ID_ATI_IXP200_SMBUS 0x4353 368#define PCI_DEVICE_ID_ATI_IXP200_SMBUS 0x4353
@@ -371,10 +374,9 @@
371#define PCI_DEVICE_ID_ATI_IXP400_SATA 0x4379 374#define PCI_DEVICE_ID_ATI_IXP400_SATA 0x4379
372#define PCI_DEVICE_ID_ATI_IXP400_SATA2 0x437a 375#define PCI_DEVICE_ID_ATI_IXP400_SATA2 0x437a
373#define PCI_DEVICE_ID_ATI_IXP600_SATA 0x4380 376#define PCI_DEVICE_ID_ATI_IXP600_SATA 0x4380
374#define PCI_DEVICE_ID_ATI_IXP600_SMBUS 0x4385 377#define PCI_DEVICE_ID_ATI_SBX00_SMBUS 0x4385
375#define PCI_DEVICE_ID_ATI_IXP600_IDE 0x438c 378#define PCI_DEVICE_ID_ATI_IXP600_IDE 0x438c
376#define PCI_DEVICE_ID_ATI_IXP700_SATA 0x4390 379#define PCI_DEVICE_ID_ATI_IXP700_SATA 0x4390
377#define PCI_DEVICE_ID_ATI_IXP700_SMBUS 0x4395
378#define PCI_DEVICE_ID_ATI_IXP700_IDE 0x439c 380#define PCI_DEVICE_ID_ATI_IXP700_IDE 0x439c
379 381
380#define PCI_VENDOR_ID_VLSI 0x1004 382#define PCI_VENDOR_ID_VLSI 0x1004
@@ -495,6 +497,8 @@
495 497
496#define PCI_VENDOR_ID_AMD 0x1022 498#define PCI_VENDOR_ID_AMD 0x1022
497#define PCI_DEVICE_ID_AMD_K8_NB 0x1100 499#define PCI_DEVICE_ID_AMD_K8_NB 0x1100
500#define PCI_DEVICE_ID_AMD_K8_NB_ADDRMAP 0x1101
501#define PCI_DEVICE_ID_AMD_K8_NB_MEMCTL 0x1102
498#define PCI_DEVICE_ID_AMD_K8_NB_MISC 0x1103 502#define PCI_DEVICE_ID_AMD_K8_NB_MISC 0x1103
499#define PCI_DEVICE_ID_AMD_LANCE 0x2000 503#define PCI_DEVICE_ID_AMD_LANCE 0x2000
500#define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001 504#define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001
@@ -609,7 +613,6 @@
609#define PCI_DEVICE_ID_NEC_CBUS_3 0x003b 613#define PCI_DEVICE_ID_NEC_CBUS_3 0x003b
610#define PCI_DEVICE_ID_NEC_NAPCCARD 0x003e 614#define PCI_DEVICE_ID_NEC_NAPCCARD 0x003e
611#define PCI_DEVICE_ID_NEC_PCX2 0x0046 /* PowerVR */ 615#define PCI_DEVICE_ID_NEC_PCX2 0x0046 /* PowerVR */
612#define PCI_DEVICE_ID_NEC_NILE4 0x005a
613#define PCI_DEVICE_ID_NEC_VRC5476 0x009b 616#define PCI_DEVICE_ID_NEC_VRC5476 0x009b
614#define PCI_DEVICE_ID_NEC_VRC4173 0x00a5 617#define PCI_DEVICE_ID_NEC_VRC4173 0x00a5
615#define PCI_DEVICE_ID_NEC_VRC5477_AC97 0x00a6 618#define PCI_DEVICE_ID_NEC_VRC5477_AC97 0x00a6
@@ -826,6 +829,9 @@
826#define PCI_DEVICE_ID_UMC_UM8886BF 0x673a 829#define PCI_DEVICE_ID_UMC_UM8886BF 0x673a
827#define PCI_DEVICE_ID_UMC_UM8886A 0x886a 830#define PCI_DEVICE_ID_UMC_UM8886A 0x886a
828 831
832#define PCI_VENDOR_ID_PICOPOWER 0x1066
833#define PCI_DEVICE_ID_PICOPOWER_PT86C523 0x0002
834#define PCI_DEVICE_ID_PICOPOWER_PT86C523BBP 0x8002
829 835
830#define PCI_VENDOR_ID_MYLEX 0x1069 836#define PCI_VENDOR_ID_MYLEX 0x1069
831#define PCI_DEVICE_ID_MYLEX_DAC960_P 0x0001 837#define PCI_DEVICE_ID_MYLEX_DAC960_P 0x0001
@@ -1223,6 +1229,10 @@
1223#define PCI_DEVICE_ID_NVIDIA_NVENET_25 0x054D 1229#define PCI_DEVICE_ID_NVIDIA_NVENET_25 0x054D
1224#define PCI_DEVICE_ID_NVIDIA_NVENET_26 0x054E 1230#define PCI_DEVICE_ID_NVIDIA_NVENET_26 0x054E
1225#define PCI_DEVICE_ID_NVIDIA_NVENET_27 0x054F 1231#define PCI_DEVICE_ID_NVIDIA_NVENET_27 0x054F
1232#define PCI_DEVICE_ID_NVIDIA_NVENET_28 0x07DC
1233#define PCI_DEVICE_ID_NVIDIA_NVENET_29 0x07DD
1234#define PCI_DEVICE_ID_NVIDIA_NVENET_30 0x07DE
1235#define PCI_DEVICE_ID_NVIDIA_NVENET_31 0x07DF
1226#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_IDE 0x0560 1236#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_IDE 0x0560
1227#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_IDE 0x056C 1237#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_IDE 0x056C
1228#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP77_IDE 0x0759 1238#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP77_IDE 0x0759
@@ -1282,6 +1292,7 @@
1282#define PCI_DEVICE_ID_VIA_VT3324 0x0324 1292#define PCI_DEVICE_ID_VIA_VT3324 0x0324
1283#define PCI_DEVICE_ID_VIA_VT3336 0x0336 1293#define PCI_DEVICE_ID_VIA_VT3336 0x0336
1284#define PCI_DEVICE_ID_VIA_VT3351 0x0351 1294#define PCI_DEVICE_ID_VIA_VT3351 0x0351
1295#define PCI_DEVICE_ID_VIA_VT3364 0x0364
1285#define PCI_DEVICE_ID_VIA_8371_0 0x0391 1296#define PCI_DEVICE_ID_VIA_8371_0 0x0391
1286#define PCI_DEVICE_ID_VIA_8501_0 0x0501 1297#define PCI_DEVICE_ID_VIA_8501_0 0x0501
1287#define PCI_DEVICE_ID_VIA_82C561 0x0561 1298#define PCI_DEVICE_ID_VIA_82C561 0x0561
@@ -1335,6 +1346,7 @@
1335#define PCI_DEVICE_ID_VIA_8231_4 0x8235 1346#define PCI_DEVICE_ID_VIA_8231_4 0x8235
1336#define PCI_DEVICE_ID_VIA_8365_1 0x8305 1347#define PCI_DEVICE_ID_VIA_8365_1 0x8305
1337#define PCI_DEVICE_ID_VIA_CX700 0x8324 1348#define PCI_DEVICE_ID_VIA_CX700 0x8324
1349#define PCI_DEVICE_ID_VIA_VX800 0x8353
1338#define PCI_DEVICE_ID_VIA_8371_1 0x8391 1350#define PCI_DEVICE_ID_VIA_8371_1 0x8391
1339#define PCI_DEVICE_ID_VIA_82C598_1 0x8598 1351#define PCI_DEVICE_ID_VIA_82C598_1 0x8598
1340#define PCI_DEVICE_ID_VIA_838X_1 0xB188 1352#define PCI_DEVICE_ID_VIA_838X_1 0xB188
@@ -1462,6 +1474,8 @@
1462#define PCI_DEVICE_ID_RICOH_RL5C476 0x0476 1474#define PCI_DEVICE_ID_RICOH_RL5C476 0x0476
1463#define PCI_DEVICE_ID_RICOH_RL5C478 0x0478 1475#define PCI_DEVICE_ID_RICOH_RL5C478 0x0478
1464#define PCI_DEVICE_ID_RICOH_R5C822 0x0822 1476#define PCI_DEVICE_ID_RICOH_R5C822 0x0822
1477#define PCI_DEVICE_ID_RICOH_R5C832 0x0832
1478#define PCI_DEVICE_ID_RICOH_R5C843 0x0843
1465 1479
1466#define PCI_VENDOR_ID_DLINK 0x1186 1480#define PCI_VENDOR_ID_DLINK 0x1186
1467#define PCI_DEVICE_ID_DLINK_DGE510T 0x4c00 1481#define PCI_DEVICE_ID_DLINK_DGE510T 0x4c00
@@ -1727,6 +1741,11 @@
1727 1741
1728#define PCI_VENDOR_ID_RADISYS 0x1331 1742#define PCI_VENDOR_ID_RADISYS 0x1331
1729 1743
1744#define PCI_VENDOR_ID_MICRO_MEMORY 0x1332
1745#define PCI_DEVICE_ID_MICRO_MEMORY_5415CN 0x5415
1746#define PCI_DEVICE_ID_MICRO_MEMORY_5425CN 0x5425
1747#define PCI_DEVICE_ID_MICRO_MEMORY_6155 0x6155
1748
1730#define PCI_VENDOR_ID_DOMEX 0x134a 1749#define PCI_VENDOR_ID_DOMEX 0x134a
1731#define PCI_DEVICE_ID_DOMEX_DMX3191D 0x0001 1750#define PCI_DEVICE_ID_DOMEX_DMX3191D 0x0001
1732 1751
@@ -1832,6 +1851,8 @@
1832#define PCI_VENDOR_ID_ABOCOM 0x13D1 1851#define PCI_VENDOR_ID_ABOCOM 0x13D1
1833#define PCI_DEVICE_ID_ABOCOM_2BD1 0x2BD1 1852#define PCI_DEVICE_ID_ABOCOM_2BD1 0x2BD1
1834 1853
1854#define PCI_VENDOR_ID_SUNDANCE 0x13f0
1855
1835#define PCI_VENDOR_ID_CMEDIA 0x13f6 1856#define PCI_VENDOR_ID_CMEDIA 0x13f6
1836#define PCI_DEVICE_ID_CMEDIA_CM8338A 0x0100 1857#define PCI_DEVICE_ID_CMEDIA_CM8338A 0x0100
1837#define PCI_DEVICE_ID_CMEDIA_CM8338B 0x0101 1858#define PCI_DEVICE_ID_CMEDIA_CM8338B 0x0101
@@ -1939,8 +1960,12 @@
1939#define PCI_DEVICE_ID_TIGON3_5751M 0x167d 1960#define PCI_DEVICE_ID_TIGON3_5751M 0x167d
1940#define PCI_DEVICE_ID_TIGON3_5751F 0x167e 1961#define PCI_DEVICE_ID_TIGON3_5751F 0x167e
1941#define PCI_DEVICE_ID_TIGON3_5787F 0x167f 1962#define PCI_DEVICE_ID_TIGON3_5787F 0x167f
1963#define PCI_DEVICE_ID_TIGON3_5761E 0x1680
1964#define PCI_DEVICE_ID_TIGON3_5761 0x1681
1965#define PCI_DEVICE_ID_TIGON3_5764 0x1684
1942#define PCI_DEVICE_ID_TIGON3_5787M 0x1693 1966#define PCI_DEVICE_ID_TIGON3_5787M 0x1693
1943#define PCI_DEVICE_ID_TIGON3_5782 0x1696 1967#define PCI_DEVICE_ID_TIGON3_5782 0x1696
1968#define PCI_DEVICE_ID_TIGON3_5784 0x1698
1944#define PCI_DEVICE_ID_TIGON3_5786 0x169a 1969#define PCI_DEVICE_ID_TIGON3_5786 0x169a
1945#define PCI_DEVICE_ID_TIGON3_5787 0x169b 1970#define PCI_DEVICE_ID_TIGON3_5787 0x169b
1946#define PCI_DEVICE_ID_TIGON3_5788 0x169c 1971#define PCI_DEVICE_ID_TIGON3_5788 0x169c
@@ -1970,6 +1995,8 @@
1970#define PCI_VENDOR_ID_ENE 0x1524 1995#define PCI_VENDOR_ID_ENE 0x1524
1971#define PCI_DEVICE_ID_ENE_CB712_SD 0x0550 1996#define PCI_DEVICE_ID_ENE_CB712_SD 0x0550
1972#define PCI_DEVICE_ID_ENE_CB712_SD_2 0x0551 1997#define PCI_DEVICE_ID_ENE_CB712_SD_2 0x0551
1998#define PCI_DEVICE_ID_ENE_CB714_SD 0x0750
1999#define PCI_DEVICE_ID_ENE_CB714_SD_2 0x0751
1973#define PCI_DEVICE_ID_ENE_1211 0x1211 2000#define PCI_DEVICE_ID_ENE_1211 0x1211
1974#define PCI_DEVICE_ID_ENE_1225 0x1225 2001#define PCI_DEVICE_ID_ENE_1225 0x1225
1975#define PCI_DEVICE_ID_ENE_1410 0x1410 2002#define PCI_DEVICE_ID_ENE_1410 0x1410
@@ -2017,6 +2044,8 @@
2017 2044
2018#define PCI_VENDOR_ID_ARIMA 0x161f 2045#define PCI_VENDOR_ID_ARIMA 0x161f
2019 2046
2047#define PCI_VENDOR_ID_BROCADE 0x1657
2048
2020#define PCI_VENDOR_ID_SIBYTE 0x166d 2049#define PCI_VENDOR_ID_SIBYTE 0x166d
2021#define PCI_DEVICE_ID_BCM1250_PCI 0x0001 2050#define PCI_DEVICE_ID_BCM1250_PCI 0x0001
2022#define PCI_DEVICE_ID_BCM1250_HT 0x0002 2051#define PCI_DEVICE_ID_BCM1250_HT 0x0002
@@ -2038,6 +2067,8 @@
2038#define PCI_DEVICE_ID_ALTIMA_AC9100 0x03ea 2067#define PCI_DEVICE_ID_ALTIMA_AC9100 0x03ea
2039#define PCI_DEVICE_ID_ALTIMA_AC1003 0x03eb 2068#define PCI_DEVICE_ID_ALTIMA_AC1003 0x03eb
2040 2069
2070#define PCI_VENDOR_ID_LENOVO 0x17aa
2071
2041#define PCI_VENDOR_ID_ARECA 0x17d3 2072#define PCI_VENDOR_ID_ARECA 0x17d3
2042#define PCI_DEVICE_ID_ARECA_1110 0x1110 2073#define PCI_DEVICE_ID_ARECA_1110 0x1110
2043#define PCI_DEVICE_ID_ARECA_1120 0x1120 2074#define PCI_DEVICE_ID_ARECA_1120 0x1120
@@ -2069,6 +2100,28 @@
2069#define PCI_VENDOR_ID_TDI 0x192E 2100#define PCI_VENDOR_ID_TDI 0x192E
2070#define PCI_DEVICE_ID_TDI_EHCI 0x0101 2101#define PCI_DEVICE_ID_TDI_EHCI 0x0101
2071 2102
2103#define PCI_VENDOR_ID_FREESCALE 0x1957
2104#define PCI_DEVICE_ID_MPC8548E 0x0012
2105#define PCI_DEVICE_ID_MPC8548 0x0013
2106#define PCI_DEVICE_ID_MPC8543E 0x0014
2107#define PCI_DEVICE_ID_MPC8543 0x0015
2108#define PCI_DEVICE_ID_MPC8547E 0x0018
2109#define PCI_DEVICE_ID_MPC8545E 0x0019
2110#define PCI_DEVICE_ID_MPC8545 0x001a
2111#define PCI_DEVICE_ID_MPC8568E 0x0020
2112#define PCI_DEVICE_ID_MPC8568 0x0021
2113#define PCI_DEVICE_ID_MPC8567E 0x0022
2114#define PCI_DEVICE_ID_MPC8567 0x0023
2115#define PCI_DEVICE_ID_MPC8533E 0x0030
2116#define PCI_DEVICE_ID_MPC8533 0x0031
2117#define PCI_DEVICE_ID_MPC8544E 0x0032
2118#define PCI_DEVICE_ID_MPC8544 0x0033
2119#define PCI_DEVICE_ID_MPC8572E 0x0040
2120#define PCI_DEVICE_ID_MPC8572 0x0041
2121#define PCI_DEVICE_ID_MPC8641 0x7010
2122#define PCI_DEVICE_ID_MPC8641D 0x7011
2123#define PCI_DEVICE_ID_MPC8610 0x7018
2124
2072#define PCI_VENDOR_ID_PASEMI 0x1959 2125#define PCI_VENDOR_ID_PASEMI 0x1959
2073 2126
2074#define PCI_VENDOR_ID_ATTANSIC 0x1969 2127#define PCI_VENDOR_ID_ATTANSIC 0x1969
@@ -2089,6 +2142,11 @@
2089#define PCI_VENDOR_ID_TEKRAM 0x1de1 2142#define PCI_VENDOR_ID_TEKRAM 0x1de1
2090#define PCI_DEVICE_ID_TEKRAM_DC290 0xdc29 2143#define PCI_DEVICE_ID_TEKRAM_DC290 0xdc29
2091 2144
2145#define PCI_VENDOR_ID_TEHUTI 0x1fc9
2146#define PCI_DEVICE_ID_TEHUTI_3009 0x3009
2147#define PCI_DEVICE_ID_TEHUTI_3010 0x3010
2148#define PCI_DEVICE_ID_TEHUTI_3014 0x3014
2149
2092#define PCI_VENDOR_ID_HINT 0x3388 2150#define PCI_VENDOR_ID_HINT 0x3388
2093#define PCI_DEVICE_ID_HINT_VXPROII_IDE 0x8013 2151#define PCI_DEVICE_ID_HINT_VXPROII_IDE 0x8013
2094 2152
@@ -2187,6 +2245,7 @@
2187#define PCI_DEVICE_ID_INTEL_82801EB_5 0x24d5 2245#define PCI_DEVICE_ID_INTEL_82801EB_5 0x24d5
2188#define PCI_DEVICE_ID_INTEL_82801EB_6 0x24d6 2246#define PCI_DEVICE_ID_INTEL_82801EB_6 0x24d6
2189#define PCI_DEVICE_ID_INTEL_82801EB_11 0x24db 2247#define PCI_DEVICE_ID_INTEL_82801EB_11 0x24db
2248#define PCI_DEVICE_ID_INTEL_82801EB_12 0x24dc
2190#define PCI_DEVICE_ID_INTEL_82801EB_13 0x24dd 2249#define PCI_DEVICE_ID_INTEL_82801EB_13 0x24dd
2191#define PCI_DEVICE_ID_INTEL_ESB_1 0x25a1 2250#define PCI_DEVICE_ID_INTEL_ESB_1 0x25a1
2192#define PCI_DEVICE_ID_INTEL_ESB_2 0x25a2 2251#define PCI_DEVICE_ID_INTEL_ESB_2 0x25a2
@@ -2209,6 +2268,7 @@
2209#define PCI_DEVICE_ID_INTEL_82915GM_IG 0x2592 2268#define PCI_DEVICE_ID_INTEL_82915GM_IG 0x2592
2210#define PCI_DEVICE_ID_INTEL_82945G_HB 0x2770 2269#define PCI_DEVICE_ID_INTEL_82945G_HB 0x2770
2211#define PCI_DEVICE_ID_INTEL_82945G_IG 0x2772 2270#define PCI_DEVICE_ID_INTEL_82945G_IG 0x2772
2271#define PCI_DEVICE_ID_INTEL_3000_HB 0x2778
2212#define PCI_DEVICE_ID_INTEL_82945GM_HB 0x27A0 2272#define PCI_DEVICE_ID_INTEL_82945GM_HB 0x27A0
2213#define PCI_DEVICE_ID_INTEL_82945GM_IG 0x27A2 2273#define PCI_DEVICE_ID_INTEL_82945GM_IG 0x27A2
2214#define PCI_DEVICE_ID_INTEL_ICH6_0 0x2640 2274#define PCI_DEVICE_ID_INTEL_ICH6_0 0x2640
@@ -2258,6 +2318,8 @@
2258#define PCI_DEVICE_ID_INTEL_MCH_PC 0x3599 2318#define PCI_DEVICE_ID_INTEL_MCH_PC 0x3599
2259#define PCI_DEVICE_ID_INTEL_MCH_PC1 0x359a 2319#define PCI_DEVICE_ID_INTEL_MCH_PC1 0x359a
2260#define PCI_DEVICE_ID_INTEL_E7525_MCH 0x359e 2320#define PCI_DEVICE_ID_INTEL_E7525_MCH 0x359e
2321#define PCI_DEVICE_ID_INTEL_TOLAPAI_0 0x5031
2322#define PCI_DEVICE_ID_INTEL_TOLAPAI_1 0x5032
2261#define PCI_DEVICE_ID_INTEL_82371SB_0 0x7000 2323#define PCI_DEVICE_ID_INTEL_82371SB_0 0x7000
2262#define PCI_DEVICE_ID_INTEL_82371SB_1 0x7010 2324#define PCI_DEVICE_ID_INTEL_82371SB_1 0x7010
2263#define PCI_DEVICE_ID_INTEL_82371SB_2 0x7020 2325#define PCI_DEVICE_ID_INTEL_82371SB_2 0x7020
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h
index 495d368390e0..c1914a8b94a9 100644
--- a/include/linux/pci_regs.h
+++ b/include/linux/pci_regs.h
@@ -147,7 +147,7 @@
147#define PCI_BRIDGE_CONTROL 0x3e 147#define PCI_BRIDGE_CONTROL 0x3e
148#define PCI_BRIDGE_CTL_PARITY 0x01 /* Enable parity detection on secondary interface */ 148#define PCI_BRIDGE_CTL_PARITY 0x01 /* Enable parity detection on secondary interface */
149#define PCI_BRIDGE_CTL_SERR 0x02 /* The same for SERR forwarding */ 149#define PCI_BRIDGE_CTL_SERR 0x02 /* The same for SERR forwarding */
150#define PCI_BRIDGE_CTL_NO_ISA 0x04 /* Disable bridging of ISA ports */ 150#define PCI_BRIDGE_CTL_ISA 0x04 /* Enable ISA mode */
151#define PCI_BRIDGE_CTL_VGA 0x08 /* Forward VGA addresses */ 151#define PCI_BRIDGE_CTL_VGA 0x08 /* Forward VGA addresses */
152#define PCI_BRIDGE_CTL_MASTER_ABORT 0x20 /* Report master aborts */ 152#define PCI_BRIDGE_CTL_MASTER_ABORT 0x20 /* Report master aborts */
153#define PCI_BRIDGE_CTL_BUS_RESET 0x40 /* Secondary bus reset */ 153#define PCI_BRIDGE_CTL_BUS_RESET 0x40 /* Secondary bus reset */
@@ -202,8 +202,12 @@
202#define PCI_CAP_ID_CHSWP 0x06 /* CompactPCI HotSwap */ 202#define PCI_CAP_ID_CHSWP 0x06 /* CompactPCI HotSwap */
203#define PCI_CAP_ID_PCIX 0x07 /* PCI-X */ 203#define PCI_CAP_ID_PCIX 0x07 /* PCI-X */
204#define PCI_CAP_ID_HT 0x08 /* HyperTransport */ 204#define PCI_CAP_ID_HT 0x08 /* HyperTransport */
205#define PCI_CAP_ID_VNDR 0x09 /* Vendor specific capability */ 205#define PCI_CAP_ID_VNDR 0x09 /* Vendor specific */
206#define PCI_CAP_ID_DBG 0x0A /* Debug port */
207#define PCI_CAP_ID_CCRC 0x0B /* CompactPCI Central Resource Control */
206#define PCI_CAP_ID_SHPC 0x0C /* PCI Standard Hot-Plug Controller */ 208#define PCI_CAP_ID_SHPC 0x0C /* PCI Standard Hot-Plug Controller */
209#define PCI_CAP_ID_SSVID 0x0D /* Bridge subsystem vendor/device ID */
210#define PCI_CAP_ID_AGP3 0x0E /* AGP Target PCI-PCI bridge */
207#define PCI_CAP_ID_EXP 0x10 /* PCI Express */ 211#define PCI_CAP_ID_EXP 0x10 /* PCI Express */
208#define PCI_CAP_ID_MSIX 0x11 /* MSI-X */ 212#define PCI_CAP_ID_MSIX 0x11 /* MSI-X */
209#define PCI_CAP_LIST_NEXT 1 /* Next capability in the list */ 213#define PCI_CAP_LIST_NEXT 1 /* Next capability in the list */
@@ -316,7 +320,20 @@
316#define PCI_X_CMD 2 /* Modes & Features */ 320#define PCI_X_CMD 2 /* Modes & Features */
317#define PCI_X_CMD_DPERR_E 0x0001 /* Data Parity Error Recovery Enable */ 321#define PCI_X_CMD_DPERR_E 0x0001 /* Data Parity Error Recovery Enable */
318#define PCI_X_CMD_ERO 0x0002 /* Enable Relaxed Ordering */ 322#define PCI_X_CMD_ERO 0x0002 /* Enable Relaxed Ordering */
323#define PCI_X_CMD_READ_512 0x0000 /* 512 byte maximum read byte count */
324#define PCI_X_CMD_READ_1K 0x0004 /* 1Kbyte maximum read byte count */
325#define PCI_X_CMD_READ_2K 0x0008 /* 2Kbyte maximum read byte count */
326#define PCI_X_CMD_READ_4K 0x000c /* 4Kbyte maximum read byte count */
319#define PCI_X_CMD_MAX_READ 0x000c /* Max Memory Read Byte Count */ 327#define PCI_X_CMD_MAX_READ 0x000c /* Max Memory Read Byte Count */
328 /* Max # of outstanding split transactions */
329#define PCI_X_CMD_SPLIT_1 0x0000 /* Max 1 */
330#define PCI_X_CMD_SPLIT_2 0x0010 /* Max 2 */
331#define PCI_X_CMD_SPLIT_3 0x0020 /* Max 3 */
332#define PCI_X_CMD_SPLIT_4 0x0030 /* Max 4 */
333#define PCI_X_CMD_SPLIT_8 0x0040 /* Max 8 */
334#define PCI_X_CMD_SPLIT_12 0x0050 /* Max 12 */
335#define PCI_X_CMD_SPLIT_16 0x0060 /* Max 16 */
336#define PCI_X_CMD_SPLIT_32 0x0070 /* Max 32 */
320#define PCI_X_CMD_MAX_SPLIT 0x0070 /* Max Outstanding Split Transactions */ 337#define PCI_X_CMD_MAX_SPLIT 0x0070 /* Max Outstanding Split Transactions */
321#define PCI_X_CMD_VERSION(x) (((x) >> 12) & 3) /* Version */ 338#define PCI_X_CMD_VERSION(x) (((x) >> 12) & 3) /* Version */
322#define PCI_X_STATUS 4 /* PCI-X capabilities */ 339#define PCI_X_STATUS 4 /* PCI-X capabilities */
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 2a659789f9ca..f0742b6aaa64 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -25,6 +25,8 @@
25#include <linux/timer.h> 25#include <linux/timer.h>
26#include <linux/workqueue.h> 26#include <linux/workqueue.h>
27 27
28#include <asm/atomic.h>
29
28#define PHY_BASIC_FEATURES (SUPPORTED_10baseT_Half | \ 30#define PHY_BASIC_FEATURES (SUPPORTED_10baseT_Half | \
29 SUPPORTED_10baseT_Full | \ 31 SUPPORTED_10baseT_Full | \
30 SUPPORTED_100baseT_Half | \ 32 SUPPORTED_100baseT_Half | \
@@ -281,6 +283,7 @@ struct phy_device {
281 /* Interrupt and Polling infrastructure */ 283 /* Interrupt and Polling infrastructure */
282 struct work_struct phy_queue; 284 struct work_struct phy_queue;
283 struct timer_list phy_timer; 285 struct timer_list phy_timer;
286 atomic_t irq_disable;
284 287
285 spinlock_t lock; 288 spinlock_t lock;
286 289
diff --git a/include/linux/phy_fixed.h b/include/linux/phy_fixed.h
new file mode 100644
index 000000000000..04ba70d49fb8
--- /dev/null
+++ b/include/linux/phy_fixed.h
@@ -0,0 +1,38 @@
1#ifndef __PHY_FIXED_H
2#define __PHY_FIXED_H
3
4#define MII_REGS_NUM 29
5
6/* max number of virtual phy stuff */
7#define MAX_PHY_AMNT 10
8/*
9 The idea is to emulate normal phy behavior by responding with
10 pre-defined values to mii BMCR read, so that read_status hook could
11 take all the needed info.
12*/
13
14struct fixed_phy_status {
15 u8 link;
16 u16 speed;
17 u8 duplex;
18};
19
20/*-----------------------------------------------------------------------------
21 * Private information hoder for mii_bus
22 *-----------------------------------------------------------------------------*/
23struct fixed_info {
24 u16 *regs;
25 u8 regs_num;
26 struct fixed_phy_status phy_status;
27 struct phy_device *phydev; /* pointer to the container */
28 /* link & speed cb */
29 int (*link_update) (struct net_device *, struct fixed_phy_status *);
30
31};
32
33
34int fixed_mdio_set_link_update(struct phy_device *,
35 int (*link_update) (struct net_device *, struct fixed_phy_status *));
36struct fixed_info *fixed_mdio_get_phydev (int phydev_ind);
37
38#endif /* __PHY_FIXED_H */
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h
index 268c51599eb8..919af93b7059 100644
--- a/include/linux/pkt_sched.h
+++ b/include/linux/pkt_sched.h
@@ -77,8 +77,8 @@ struct tc_ratespec
77{ 77{
78 unsigned char cell_log; 78 unsigned char cell_log;
79 unsigned char __reserved; 79 unsigned char __reserved;
80 unsigned short feature; 80 unsigned short overhead;
81 short addend; 81 short cell_align;
82 unsigned short mpu; 82 unsigned short mpu;
83 __u32 rate; 83 __u32 rate;
84}; 84};
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 8bbd459eafdc..e80804316cdb 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -15,7 +15,7 @@
15 15
16struct platform_device { 16struct platform_device {
17 const char * name; 17 const char * name;
18 u32 id; 18 int id;
19 struct device dev; 19 struct device dev;
20 u32 num_resources; 20 u32 num_resources;
21 struct resource * resource; 21 struct resource * resource;
@@ -35,9 +35,10 @@ extern struct resource *platform_get_resource_byname(struct platform_device *, u
35extern int platform_get_irq_byname(struct platform_device *, char *); 35extern int platform_get_irq_byname(struct platform_device *, char *);
36extern int platform_add_devices(struct platform_device **, int); 36extern int platform_add_devices(struct platform_device **, int);
37 37
38extern struct platform_device *platform_device_register_simple(char *, unsigned int, struct resource *, unsigned int); 38extern struct platform_device *platform_device_register_simple(char *, int id,
39 struct resource *, unsigned int);
39 40
40extern struct platform_device *platform_device_alloc(const char *name, unsigned int id); 41extern struct platform_device *platform_device_alloc(const char *name, int id);
41extern int platform_device_add_resources(struct platform_device *pdev, struct resource *res, unsigned int num); 42extern int platform_device_add_resources(struct platform_device *pdev, struct resource *res, unsigned int num);
42extern int platform_device_add_data(struct platform_device *pdev, const void *data, size_t size); 43extern int platform_device_add_data(struct platform_device *pdev, const void *data, size_t size);
43extern int platform_device_add(struct platform_device *pdev); 44extern int platform_device_add(struct platform_device *pdev);
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 273781c82e4d..48b71badfb4c 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -25,6 +25,7 @@
25 25
26#include <linux/list.h> 26#include <linux/list.h>
27#include <asm/atomic.h> 27#include <asm/atomic.h>
28#include <asm/errno.h>
28 29
29/* 30/*
30 * Power management requests... these are passed to pm_send_all() and friends. 31 * Power management requests... these are passed to pm_send_all() and friends.
@@ -101,6 +102,7 @@ struct pm_dev
101 */ 102 */
102extern void (*pm_idle)(void); 103extern void (*pm_idle)(void);
103extern void (*pm_power_off)(void); 104extern void (*pm_power_off)(void);
105extern void (*pm_power_off_prepare)(void);
104 106
105typedef int __bitwise suspend_state_t; 107typedef int __bitwise suspend_state_t;
106 108
@@ -164,6 +166,7 @@ struct pm_ops {
164 int (*finish)(suspend_state_t state); 166 int (*finish)(suspend_state_t state);
165}; 167};
166 168
169#ifdef CONFIG_SUSPEND
167extern struct pm_ops *pm_ops; 170extern struct pm_ops *pm_ops;
168 171
169/** 172/**
@@ -192,6 +195,12 @@ extern void arch_suspend_disable_irqs(void);
192extern void arch_suspend_enable_irqs(void); 195extern void arch_suspend_enable_irqs(void);
193 196
194extern int pm_suspend(suspend_state_t state); 197extern int pm_suspend(suspend_state_t state);
198#else /* !CONFIG_SUSPEND */
199#define suspend_valid_only_mem NULL
200
201static inline void pm_set_ops(struct pm_ops *pm_ops) {}
202static inline int pm_suspend(suspend_state_t state) { return -ENOSYS; }
203#endif /* !CONFIG_SUSPEND */
195 204
196/* 205/*
197 * Device power management 206 * Device power management
@@ -265,7 +274,7 @@ typedef struct pm_message {
265struct dev_pm_info { 274struct dev_pm_info {
266 pm_message_t power_state; 275 pm_message_t power_state;
267 unsigned can_wakeup:1; 276 unsigned can_wakeup:1;
268#ifdef CONFIG_PM 277#ifdef CONFIG_PM_SLEEP
269 unsigned should_wakeup:1; 278 unsigned should_wakeup:1;
270 struct list_head entry; 279 struct list_head entry;
271#endif 280#endif
@@ -275,7 +284,7 @@ extern int device_power_down(pm_message_t state);
275extern void device_power_up(void); 284extern void device_power_up(void);
276extern void device_resume(void); 285extern void device_resume(void);
277 286
278#ifdef CONFIG_PM 287#ifdef CONFIG_PM_SLEEP
279extern int device_suspend(pm_message_t state); 288extern int device_suspend(pm_message_t state);
280extern int device_prepare_suspend(pm_message_t state); 289extern int device_prepare_suspend(pm_message_t state);
281 290
@@ -284,8 +293,6 @@ extern int device_prepare_suspend(pm_message_t state);
284#define device_may_wakeup(dev) \ 293#define device_may_wakeup(dev) \
285 (device_can_wakeup(dev) && (dev)->power.should_wakeup) 294 (device_can_wakeup(dev) && (dev)->power.should_wakeup)
286 295
287extern int dpm_runtime_suspend(struct device *, pm_message_t);
288extern void dpm_runtime_resume(struct device *);
289extern void __suspend_report_result(const char *function, void *fn, int ret); 296extern void __suspend_report_result(const char *function, void *fn, int ret);
290 297
291#define suspend_report_result(fn, ret) \ 298#define suspend_report_result(fn, ret) \
@@ -307,7 +314,7 @@ static inline int call_platform_enable_wakeup(struct device *dev, int is_on)
307 return 0; 314 return 0;
308} 315}
309 316
310#else /* !CONFIG_PM */ 317#else /* !CONFIG_PM_SLEEP */
311 318
312static inline int device_suspend(pm_message_t state) 319static inline int device_suspend(pm_message_t state)
313{ 320{
@@ -317,15 +324,6 @@ static inline int device_suspend(pm_message_t state)
317#define device_set_wakeup_enable(dev,val) do{}while(0) 324#define device_set_wakeup_enable(dev,val) do{}while(0)
318#define device_may_wakeup(dev) (0) 325#define device_may_wakeup(dev) (0)
319 326
320static inline int dpm_runtime_suspend(struct device * dev, pm_message_t state)
321{
322 return 0;
323}
324
325static inline void dpm_runtime_resume(struct device * dev)
326{
327}
328
329#define suspend_report_result(fn, ret) do { } while (0) 327#define suspend_report_result(fn, ret) do { } while (0)
330 328
331static inline int call_platform_enable_wakeup(struct device *dev, int is_on) 329static inline int call_platform_enable_wakeup(struct device *dev, int is_on)
@@ -333,7 +331,7 @@ static inline int call_platform_enable_wakeup(struct device *dev, int is_on)
333 return 0; 331 return 0;
334} 332}
335 333
336#endif 334#endif /* !CONFIG_PM_SLEEP */
337 335
338/* changes to device_may_wakeup take effect on the next pm state change. 336/* changes to device_may_wakeup take effect on the next pm state change.
339 * by default, devices should wakeup if they can. 337 * by default, devices should wakeup if they can.
diff --git a/include/linux/pmu.h b/include/linux/pmu.h
index 5ad913ff02b2..b7824c215354 100644
--- a/include/linux/pmu.h
+++ b/include/linux/pmu.h
@@ -226,7 +226,7 @@ extern unsigned int pmu_power_flags;
226extern void pmu_backlight_init(void); 226extern void pmu_backlight_init(void);
227 227
228/* some code needs to know if the PMU was suspended for hibernation */ 228/* some code needs to know if the PMU was suspended for hibernation */
229#if defined(CONFIG_PM) && defined(CONFIG_PPC32) 229#if defined(CONFIG_PM_SLEEP) && defined(CONFIG_PPC32)
230extern int pmu_sys_suspended; 230extern int pmu_sys_suspended;
231#else 231#else
232/* if power management is not configured it can't be suspended */ 232/* if power management is not configured it can't be suspended */
diff --git a/include/linux/pnp.h b/include/linux/pnp.h
index 2a1897e6f937..16b46aace349 100644
--- a/include/linux/pnp.h
+++ b/include/linux/pnp.h
@@ -1,7 +1,6 @@
1/* 1/*
2 * Linux Plug and Play Support 2 * Linux Plug and Play Support
3 * Copyright by Adam Belay <ambx1@neo.rr.com> 3 * Copyright by Adam Belay <ambx1@neo.rr.com>
4 *
5 */ 4 */
6 5
7#ifndef _LINUX_PNP_H 6#ifndef _LINUX_PNP_H
@@ -23,7 +22,6 @@
23struct pnp_protocol; 22struct pnp_protocol;
24struct pnp_dev; 23struct pnp_dev;
25 24
26
27/* 25/*
28 * Resource Management 26 * Resource Management
29 */ 27 */
@@ -73,37 +71,37 @@ struct pnp_dev;
73#define PNP_PORT_FLAG_FIXED (1<<1) 71#define PNP_PORT_FLAG_FIXED (1<<1)
74 72
75struct pnp_port { 73struct pnp_port {
76 unsigned short min; /* min base number */ 74 unsigned short min; /* min base number */
77 unsigned short max; /* max base number */ 75 unsigned short max; /* max base number */
78 unsigned char align; /* align boundary */ 76 unsigned char align; /* align boundary */
79 unsigned char size; /* size of range */ 77 unsigned char size; /* size of range */
80 unsigned char flags; /* port flags */ 78 unsigned char flags; /* port flags */
81 unsigned char pad; /* pad */ 79 unsigned char pad; /* pad */
82 struct pnp_port *next; /* next port */ 80 struct pnp_port *next; /* next port */
83}; 81};
84 82
85#define PNP_IRQ_NR 256 83#define PNP_IRQ_NR 256
86struct pnp_irq { 84struct pnp_irq {
87 DECLARE_BITMAP(map, PNP_IRQ_NR); /* bitmaks for IRQ lines */ 85 DECLARE_BITMAP(map, PNP_IRQ_NR); /* bitmask for IRQ lines */
88 unsigned char flags; /* IRQ flags */ 86 unsigned char flags; /* IRQ flags */
89 unsigned char pad; /* pad */ 87 unsigned char pad; /* pad */
90 struct pnp_irq *next; /* next IRQ */ 88 struct pnp_irq *next; /* next IRQ */
91}; 89};
92 90
93struct pnp_dma { 91struct pnp_dma {
94 unsigned char map; /* bitmask for DMA channels */ 92 unsigned char map; /* bitmask for DMA channels */
95 unsigned char flags; /* DMA flags */ 93 unsigned char flags; /* DMA flags */
96 struct pnp_dma *next; /* next port */ 94 struct pnp_dma *next; /* next port */
97}; 95};
98 96
99struct pnp_mem { 97struct pnp_mem {
100 unsigned int min; /* min base number */ 98 unsigned int min; /* min base number */
101 unsigned int max; /* max base number */ 99 unsigned int max; /* max base number */
102 unsigned int align; /* align boundary */ 100 unsigned int align; /* align boundary */
103 unsigned int size; /* size of range */ 101 unsigned int size; /* size of range */
104 unsigned char flags; /* memory flags */ 102 unsigned char flags; /* memory flags */
105 unsigned char pad; /* pad */ 103 unsigned char pad; /* pad */
106 struct pnp_mem *next; /* next memory resource */ 104 struct pnp_mem *next; /* next memory resource */
107}; 105};
108 106
109#define PNP_RES_PRIORITY_PREFERRED 0 107#define PNP_RES_PRIORITY_PREFERRED 0
@@ -127,7 +125,6 @@ struct pnp_resource_table {
127 struct resource irq_resource[PNP_MAX_IRQ]; 125 struct resource irq_resource[PNP_MAX_IRQ];
128}; 126};
129 127
130
131/* 128/*
132 * Device Managemnt 129 * Device Managemnt
133 */ 130 */
@@ -139,14 +136,14 @@ struct pnp_card {
139 struct list_head protocol_list; /* node in protocol's list of cards */ 136 struct list_head protocol_list; /* node in protocol's list of cards */
140 struct list_head devices; /* devices attached to the card */ 137 struct list_head devices; /* devices attached to the card */
141 138
142 struct pnp_protocol * protocol; 139 struct pnp_protocol *protocol;
143 struct pnp_id * id; /* contains supported EISA IDs*/ 140 struct pnp_id *id; /* contains supported EISA IDs */
144 141
145 char name[PNP_NAME_LEN]; /* contains a human-readable name */ 142 char name[PNP_NAME_LEN]; /* contains a human-readable name */
146 unsigned char pnpver; /* Plug & Play version */ 143 unsigned char pnpver; /* Plug & Play version */
147 unsigned char productver; /* product version */ 144 unsigned char productver; /* product version */
148 unsigned int serial; /* serial number */ 145 unsigned int serial; /* serial number */
149 unsigned char checksum; /* if zero - checksum passed */ 146 unsigned char checksum; /* if zero - checksum passed */
150 struct proc_dir_entry *procdir; /* directory entry in /proc/bus/isapnp */ 147 struct proc_dir_entry *procdir; /* directory entry in /proc/bus/isapnp */
151}; 148};
152 149
@@ -159,18 +156,18 @@ struct pnp_card {
159 (card) = global_to_pnp_card((card)->global_list.next)) 156 (card) = global_to_pnp_card((card)->global_list.next))
160 157
161struct pnp_card_link { 158struct pnp_card_link {
162 struct pnp_card * card; 159 struct pnp_card *card;
163 struct pnp_card_driver * driver; 160 struct pnp_card_driver *driver;
164 void * driver_data; 161 void *driver_data;
165 pm_message_t pm_state; 162 pm_message_t pm_state;
166}; 163};
167 164
168static inline void *pnp_get_card_drvdata (struct pnp_card_link *pcard) 165static inline void *pnp_get_card_drvdata(struct pnp_card_link *pcard)
169{ 166{
170 return pcard->driver_data; 167 return pcard->driver_data;
171} 168}
172 169
173static inline void pnp_set_card_drvdata (struct pnp_card_link *pcard, void *data) 170static inline void pnp_set_card_drvdata(struct pnp_card_link *pcard, void *data)
174{ 171{
175 pcard->driver_data = data; 172 pcard->driver_data = data;
176} 173}
@@ -186,22 +183,22 @@ struct pnp_dev {
186 struct list_head card_list; /* node in card's list of devices */ 183 struct list_head card_list; /* node in card's list of devices */
187 struct list_head rdev_list; /* node in cards list of requested devices */ 184 struct list_head rdev_list; /* node in cards list of requested devices */
188 185
189 struct pnp_protocol * protocol; 186 struct pnp_protocol *protocol;
190 struct pnp_card * card; /* card the device is attached to, none if NULL */ 187 struct pnp_card *card; /* card the device is attached to, none if NULL */
191 struct pnp_driver * driver; 188 struct pnp_driver *driver;
192 struct pnp_card_link * card_link; 189 struct pnp_card_link *card_link;
193 190
194 struct pnp_id * id; /* supported EISA IDs*/ 191 struct pnp_id *id; /* supported EISA IDs */
195 192
196 int active; 193 int active;
197 int capabilities; 194 int capabilities;
198 struct pnp_option * independent; 195 struct pnp_option *independent;
199 struct pnp_option * dependent; 196 struct pnp_option *dependent;
200 struct pnp_resource_table res; 197 struct pnp_resource_table res;
201 198
202 char name[PNP_NAME_LEN]; /* contains a human-readable name */ 199 char name[PNP_NAME_LEN]; /* contains a human-readable name */
203 unsigned short regs; /* ISAPnP: supported registers */ 200 unsigned short regs; /* ISAPnP: supported registers */
204 int flags; /* used by protocols */ 201 int flags; /* used by protocols */
205 struct proc_dir_entry *procent; /* device entry in /proc/bus/isapnp */ 202 struct proc_dir_entry *procent; /* device entry in /proc/bus/isapnp */
206 void *data; 203 void *data;
207}; 204};
@@ -220,19 +217,19 @@ struct pnp_dev {
220 (dev) = card_to_pnp_dev((dev)->card_list.next)) 217 (dev) = card_to_pnp_dev((dev)->card_list.next))
221#define pnp_dev_name(dev) (dev)->name 218#define pnp_dev_name(dev) (dev)->name
222 219
223static inline void *pnp_get_drvdata (struct pnp_dev *pdev) 220static inline void *pnp_get_drvdata(struct pnp_dev *pdev)
224{ 221{
225 return dev_get_drvdata(&pdev->dev); 222 return dev_get_drvdata(&pdev->dev);
226} 223}
227 224
228static inline void pnp_set_drvdata (struct pnp_dev *pdev, void *data) 225static inline void pnp_set_drvdata(struct pnp_dev *pdev, void *data)
229{ 226{
230 dev_set_drvdata(&pdev->dev, data); 227 dev_set_drvdata(&pdev->dev, data);
231} 228}
232 229
233struct pnp_fixup { 230struct pnp_fixup {
234 char id[7]; 231 char id[7];
235 void (*quirk_function)(struct pnp_dev *dev); /* fixup function */ 232 void (*quirk_function) (struct pnp_dev * dev); /* fixup function */
236}; 233};
237 234
238/* config parameters */ 235/* config parameters */
@@ -269,7 +266,6 @@ extern struct pnp_protocol pnpbios_protocol;
269#define pnp_device_is_pnpbios(dev) 0 266#define pnp_device_is_pnpbios(dev) 0
270#endif 267#endif
271 268
272
273/* status */ 269/* status */
274#define PNP_READY 0x0000 270#define PNP_READY 0x0000
275#define PNP_ATTACHED 0x0001 271#define PNP_ATTACHED 0x0001
@@ -287,17 +283,17 @@ extern struct pnp_protocol pnpbios_protocol;
287 283
288struct pnp_id { 284struct pnp_id {
289 char id[PNP_ID_LEN]; 285 char id[PNP_ID_LEN];
290 struct pnp_id * next; 286 struct pnp_id *next;
291}; 287};
292 288
293struct pnp_driver { 289struct pnp_driver {
294 char * name; 290 char *name;
295 const struct pnp_device_id *id_table; 291 const struct pnp_device_id *id_table;
296 unsigned int flags; 292 unsigned int flags;
297 int (*probe) (struct pnp_dev *dev, const struct pnp_device_id *dev_id); 293 int (*probe) (struct pnp_dev *dev, const struct pnp_device_id *dev_id);
298 void (*remove) (struct pnp_dev *dev); 294 void (*remove) (struct pnp_dev *dev);
299 int (*suspend) (struct pnp_dev *dev, pm_message_t state); 295 int (*suspend) (struct pnp_dev *dev, pm_message_t state);
300 int (*resume) (struct pnp_dev *dev); 296 int (*resume) (struct pnp_dev *dev);
301 struct device_driver driver; 297 struct device_driver driver;
302}; 298};
303 299
@@ -305,13 +301,14 @@ struct pnp_driver {
305 301
306struct pnp_card_driver { 302struct pnp_card_driver {
307 struct list_head global_list; 303 struct list_head global_list;
308 char * name; 304 char *name;
309 const struct pnp_card_device_id *id_table; 305 const struct pnp_card_device_id *id_table;
310 unsigned int flags; 306 unsigned int flags;
311 int (*probe) (struct pnp_card_link *card, const struct pnp_card_device_id *card_id); 307 int (*probe) (struct pnp_card_link *card,
308 const struct pnp_card_device_id *card_id);
312 void (*remove) (struct pnp_card_link *card); 309 void (*remove) (struct pnp_card_link *card);
313 int (*suspend) (struct pnp_card_link *card, pm_message_t state); 310 int (*suspend) (struct pnp_card_link *card, pm_message_t state);
314 int (*resume) (struct pnp_card_link *card); 311 int (*resume) (struct pnp_card_link *card);
315 struct pnp_driver link; 312 struct pnp_driver link;
316}; 313};
317 314
@@ -321,25 +318,28 @@ struct pnp_card_driver {
321#define PNP_DRIVER_RES_DO_NOT_CHANGE 0x0001 /* do not change the state of the device */ 318#define PNP_DRIVER_RES_DO_NOT_CHANGE 0x0001 /* do not change the state of the device */
322#define PNP_DRIVER_RES_DISABLE 0x0003 /* ensure the device is disabled */ 319#define PNP_DRIVER_RES_DISABLE 0x0003 /* ensure the device is disabled */
323 320
324
325/* 321/*
326 * Protocol Management 322 * Protocol Management
327 */ 323 */
328 324
329struct pnp_protocol { 325struct pnp_protocol {
330 struct list_head protocol_list; 326 struct list_head protocol_list;
331 char * name; 327 char *name;
332 328
333 /* resource control functions */ 329 /* resource control functions */
334 int (*get)(struct pnp_dev *dev, struct pnp_resource_table *res); 330 int (*get) (struct pnp_dev *dev, struct pnp_resource_table *res);
335 int (*set)(struct pnp_dev *dev, struct pnp_resource_table *res); 331 int (*set) (struct pnp_dev *dev, struct pnp_resource_table *res);
336 int (*disable)(struct pnp_dev *dev); 332 int (*disable) (struct pnp_dev *dev);
333
334 /* protocol specific suspend/resume */
335 int (*suspend) (struct pnp_dev * dev, pm_message_t state);
336 int (*resume) (struct pnp_dev * dev);
337 337
338 /* used by pnp layer only (look but don't touch) */ 338 /* used by pnp layer only (look but don't touch) */
339 unsigned char number; /* protocol number*/ 339 unsigned char number; /* protocol number */
340 struct device dev; /* link to driver model */ 340 struct device dev; /* link to driver model */
341 struct list_head cards; 341 struct list_head cards;
342 struct list_head devices; 342 struct list_head devices;
343}; 343};
344 344
345#define to_pnp_protocol(n) list_entry(n, struct pnp_protocol, protocol_list) 345#define to_pnp_protocol(n) list_entry(n, struct pnp_protocol, protocol_list)
@@ -352,7 +352,6 @@ struct pnp_protocol {
352 (dev) != protocol_to_pnp_dev(&(protocol)->devices); \ 352 (dev) != protocol_to_pnp_dev(&(protocol)->devices); \
353 (dev) = protocol_to_pnp_dev((dev)->protocol_list.next)) 353 (dev) = protocol_to_pnp_dev((dev)->protocol_list.next))
354 354
355
356extern struct bus_type pnp_bus_type; 355extern struct bus_type pnp_bus_type;
357 356
358#if defined(CONFIG_PNP) 357#if defined(CONFIG_PNP)
@@ -372,21 +371,25 @@ void pnp_remove_card(struct pnp_card *card);
372int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev); 371int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev);
373void pnp_remove_card_device(struct pnp_dev *dev); 372void pnp_remove_card_device(struct pnp_dev *dev);
374int pnp_add_card_id(struct pnp_id *id, struct pnp_card *card); 373int pnp_add_card_id(struct pnp_id *id, struct pnp_card *card);
375struct pnp_dev * pnp_request_card_device(struct pnp_card_link *clink, const char * id, struct pnp_dev * from); 374struct pnp_dev *pnp_request_card_device(struct pnp_card_link *clink,
376void pnp_release_card_device(struct pnp_dev * dev); 375 const char *id, struct pnp_dev *from);
377int pnp_register_card_driver(struct pnp_card_driver * drv); 376void pnp_release_card_device(struct pnp_dev *dev);
378void pnp_unregister_card_driver(struct pnp_card_driver * drv); 377int pnp_register_card_driver(struct pnp_card_driver *drv);
378void pnp_unregister_card_driver(struct pnp_card_driver *drv);
379extern struct list_head pnp_cards; 379extern struct list_head pnp_cards;
380 380
381/* resource management */ 381/* resource management */
382struct pnp_option * pnp_register_independent_option(struct pnp_dev *dev); 382struct pnp_option *pnp_register_independent_option(struct pnp_dev *dev);
383struct pnp_option * pnp_register_dependent_option(struct pnp_dev *dev, int priority); 383struct pnp_option *pnp_register_dependent_option(struct pnp_dev *dev,
384 int priority);
384int pnp_register_irq_resource(struct pnp_option *option, struct pnp_irq *data); 385int pnp_register_irq_resource(struct pnp_option *option, struct pnp_irq *data);
385int pnp_register_dma_resource(struct pnp_option *option, struct pnp_dma *data); 386int pnp_register_dma_resource(struct pnp_option *option, struct pnp_dma *data);
386int pnp_register_port_resource(struct pnp_option *option, struct pnp_port *data); 387int pnp_register_port_resource(struct pnp_option *option,
388 struct pnp_port *data);
387int pnp_register_mem_resource(struct pnp_option *option, struct pnp_mem *data); 389int pnp_register_mem_resource(struct pnp_option *option, struct pnp_mem *data);
388void pnp_init_resource_table(struct pnp_resource_table *table); 390void pnp_init_resource_table(struct pnp_resource_table *table);
389int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res, int mode); 391int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res,
392 int mode);
390int pnp_auto_config_dev(struct pnp_dev *dev); 393int pnp_auto_config_dev(struct pnp_dev *dev);
391int pnp_validate_config(struct pnp_dev *dev); 394int pnp_validate_config(struct pnp_dev *dev);
392int pnp_start_dev(struct pnp_dev *dev); 395int pnp_start_dev(struct pnp_dev *dev);
@@ -394,11 +397,11 @@ int pnp_stop_dev(struct pnp_dev *dev);
394int pnp_activate_dev(struct pnp_dev *dev); 397int pnp_activate_dev(struct pnp_dev *dev);
395int pnp_disable_dev(struct pnp_dev *dev); 398int pnp_disable_dev(struct pnp_dev *dev);
396void pnp_resource_change(struct resource *resource, resource_size_t start, 399void pnp_resource_change(struct resource *resource, resource_size_t start,
397 resource_size_t size); 400 resource_size_t size);
398 401
399/* protocol helpers */ 402/* protocol helpers */
400int pnp_is_active(struct pnp_dev * dev); 403int pnp_is_active(struct pnp_dev *dev);
401int compare_pnp_id(struct pnp_id * pos, const char * id); 404int compare_pnp_id(struct pnp_id *pos, const char *id);
402int pnp_add_id(struct pnp_id *id, struct pnp_dev *dev); 405int pnp_add_id(struct pnp_id *id, struct pnp_dev *dev);
403int pnp_register_driver(struct pnp_driver *drv); 406int pnp_register_driver(struct pnp_driver *drv);
404void pnp_unregister_driver(struct pnp_driver *drv); 407void pnp_unregister_driver(struct pnp_driver *drv);
@@ -411,23 +414,24 @@ static inline void pnp_unregister_protocol(struct pnp_protocol *protocol) { }
411static inline int pnp_init_device(struct pnp_dev *dev) { return -ENODEV; } 414static inline int pnp_init_device(struct pnp_dev *dev) { return -ENODEV; }
412static inline int pnp_add_device(struct pnp_dev *dev) { return -ENODEV; } 415static inline int pnp_add_device(struct pnp_dev *dev) { return -ENODEV; }
413static inline int pnp_device_attach(struct pnp_dev *pnp_dev) { return -ENODEV; } 416static inline int pnp_device_attach(struct pnp_dev *pnp_dev) { return -ENODEV; }
414static inline void pnp_device_detach(struct pnp_dev *pnp_dev) { ; } 417static inline void pnp_device_detach(struct pnp_dev *pnp_dev) { }
418
415#define pnp_platform_devices 0 419#define pnp_platform_devices 0
416 420
417/* multidevice card support */ 421/* multidevice card support */
418static inline int pnp_add_card(struct pnp_card *card) { return -ENODEV; } 422static inline int pnp_add_card(struct pnp_card *card) { return -ENODEV; }
419static inline void pnp_remove_card(struct pnp_card *card) { ; } 423static inline void pnp_remove_card(struct pnp_card *card) { }
420static inline int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev) { return -ENODEV; } 424static inline int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev) { return -ENODEV; }
421static inline void pnp_remove_card_device(struct pnp_dev *dev) { ; } 425static inline void pnp_remove_card_device(struct pnp_dev *dev) { }
422static inline int pnp_add_card_id(struct pnp_id *id, struct pnp_card *card) { return -ENODEV; } 426static inline int pnp_add_card_id(struct pnp_id *id, struct pnp_card *card) { return -ENODEV; }
423static inline struct pnp_dev * pnp_request_card_device(struct pnp_card_link *clink, const char * id, struct pnp_dev * from) { return NULL; } 427static inline struct pnp_dev *pnp_request_card_device(struct pnp_card_link *clink, const char *id, struct pnp_dev *from) { return NULL; }
424static inline void pnp_release_card_device(struct pnp_dev * dev) { ; } 428static inline void pnp_release_card_device(struct pnp_dev *dev) { }
425static inline int pnp_register_card_driver(struct pnp_card_driver * drv) { return -ENODEV; } 429static inline int pnp_register_card_driver(struct pnp_card_driver *drv) { return -ENODEV; }
426static inline void pnp_unregister_card_driver(struct pnp_card_driver * drv) { ; } 430static inline void pnp_unregister_card_driver(struct pnp_card_driver *drv) { }
427 431
428/* resource management */ 432/* resource management */
429static inline struct pnp_option * pnp_register_independent_option(struct pnp_dev *dev) { return NULL; } 433static inline struct pnp_option *pnp_register_independent_option(struct pnp_dev *dev) { return NULL; }
430static inline struct pnp_option * pnp_register_dependent_option(struct pnp_dev *dev, int priority) { return NULL; } 434static inline struct pnp_option *pnp_register_dependent_option(struct pnp_dev *dev, int priority) { return NULL; }
431static inline int pnp_register_irq_resource(struct pnp_option *option, struct pnp_irq *data) { return -ENODEV; } 435static inline int pnp_register_irq_resource(struct pnp_option *option, struct pnp_irq *data) { return -ENODEV; }
432static inline int pnp_register_dma_resource(struct pnp_option *option, struct pnp_dma *data) { return -ENODEV; } 436static inline int pnp_register_dma_resource(struct pnp_option *option, struct pnp_dma *data) { return -ENODEV; }
433static inline int pnp_register_port_resource(struct pnp_option *option, struct pnp_port *data) { return -ENODEV; } 437static inline int pnp_register_port_resource(struct pnp_option *option, struct pnp_port *data) { return -ENODEV; }
@@ -440,20 +444,17 @@ static inline int pnp_start_dev(struct pnp_dev *dev) { return -ENODEV; }
440static inline int pnp_stop_dev(struct pnp_dev *dev) { return -ENODEV; } 444static inline int pnp_stop_dev(struct pnp_dev *dev) { return -ENODEV; }
441static inline int pnp_activate_dev(struct pnp_dev *dev) { return -ENODEV; } 445static inline int pnp_activate_dev(struct pnp_dev *dev) { return -ENODEV; }
442static inline int pnp_disable_dev(struct pnp_dev *dev) { return -ENODEV; } 446static inline int pnp_disable_dev(struct pnp_dev *dev) { return -ENODEV; }
443static inline void pnp_resource_change(struct resource *resource, 447static inline void pnp_resource_change(struct resource *resource, resource_size_t start, resource_size_t size) { }
444 resource_size_t start,
445 resource_size_t size) { }
446 448
447/* protocol helpers */ 449/* protocol helpers */
448static inline int pnp_is_active(struct pnp_dev * dev) { return 0; } 450static inline int pnp_is_active(struct pnp_dev *dev) { return 0; }
449static inline int compare_pnp_id(struct pnp_id * pos, const char * id) { return -ENODEV; } 451static inline int compare_pnp_id(struct pnp_id *pos, const char *id) { return -ENODEV; }
450static inline int pnp_add_id(struct pnp_id *id, struct pnp_dev *dev) { return -ENODEV; } 452static inline int pnp_add_id(struct pnp_id *id, struct pnp_dev *dev) { return -ENODEV; }
451static inline int pnp_register_driver(struct pnp_driver *drv) { return -ENODEV; } 453static inline int pnp_register_driver(struct pnp_driver *drv) { return -ENODEV; }
452static inline void pnp_unregister_driver(struct pnp_driver *drv) { ; } 454static inline void pnp_unregister_driver(struct pnp_driver *drv) { }
453 455
454#endif /* CONFIG_PNP */ 456#endif /* CONFIG_PNP */
455 457
456
457#define pnp_err(format, arg...) printk(KERN_ERR "pnp: " format "\n" , ## arg) 458#define pnp_err(format, arg...) printk(KERN_ERR "pnp: " format "\n" , ## arg)
458#define pnp_info(format, arg...) printk(KERN_INFO "pnp: " format "\n" , ## arg) 459#define pnp_info(format, arg...) printk(KERN_INFO "pnp: " format "\n" , ## arg)
459#define pnp_warn(format, arg...) printk(KERN_WARNING "pnp: " format "\n" , ## arg) 460#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 0a282ac1f6b2..329192adc9dd 100644
--- a/include/linux/pnpbios.h
+++ b/include/linux/pnpbios.h
@@ -99,32 +99,32 @@
99 99
100#pragma pack(1) 100#pragma pack(1)
101struct pnp_dev_node_info { 101struct pnp_dev_node_info {
102 __u16 no_nodes; 102 __u16 no_nodes;
103 __u16 max_node_size; 103 __u16 max_node_size;
104}; 104};
105struct pnp_docking_station_info { 105struct pnp_docking_station_info {
106 __u32 location_id; 106 __u32 location_id;
107 __u32 serial; 107 __u32 serial;
108 __u16 capabilities; 108 __u16 capabilities;
109}; 109};
110struct pnp_isa_config_struc { 110struct pnp_isa_config_struc {
111 __u8 revision; 111 __u8 revision;
112 __u8 no_csns; 112 __u8 no_csns;
113 __u16 isa_rd_data_port; 113 __u16 isa_rd_data_port;
114 __u16 reserved; 114 __u16 reserved;
115}; 115};
116struct escd_info_struc { 116struct escd_info_struc {
117 __u16 min_escd_write_size; 117 __u16 min_escd_write_size;
118 __u16 escd_size; 118 __u16 escd_size;
119 __u32 nv_storage_base; 119 __u32 nv_storage_base;
120}; 120};
121struct pnp_bios_node { 121struct pnp_bios_node {
122 __u16 size; 122 __u16 size;
123 __u8 handle; 123 __u8 handle;
124 __u32 eisa_id; 124 __u32 eisa_id;
125 __u8 type_code[3]; 125 __u8 type_code[3];
126 __u16 flags; 126 __u16 flags;
127 __u8 data[0]; 127 __u8 data[0];
128}; 128};
129#pragma pack() 129#pragma pack()
130 130
@@ -133,22 +133,16 @@ struct pnp_bios_node {
133/* non-exported */ 133/* non-exported */
134extern struct pnp_dev_node_info node_info; 134extern struct pnp_dev_node_info node_info;
135 135
136extern int pnp_bios_dev_node_info (struct pnp_dev_node_info *data); 136extern int pnp_bios_dev_node_info(struct pnp_dev_node_info *data);
137extern int pnp_bios_get_dev_node (u8 *nodenum, char config, struct pnp_bios_node *data); 137extern int pnp_bios_get_dev_node(u8 *nodenum, char config,
138extern int pnp_bios_set_dev_node (u8 nodenum, char config, struct pnp_bios_node *data); 138 struct pnp_bios_node *data);
139extern int pnp_bios_get_stat_res (char *info); 139extern int pnp_bios_set_dev_node(u8 nodenum, char config,
140extern int pnp_bios_isapnp_config (struct pnp_isa_config_struc *data); 140 struct pnp_bios_node *data);
141extern int pnp_bios_escd_info (struct escd_info_struc *data); 141extern int pnp_bios_get_stat_res(char *info);
142extern int pnp_bios_read_escd (char *data, u32 nvram_base); 142extern int pnp_bios_isapnp_config(struct pnp_isa_config_struc *data);
143extern int pnp_bios_escd_info(struct escd_info_struc *data);
144extern int pnp_bios_read_escd(char *data, u32 nvram_base);
143extern int pnp_bios_dock_station_info(struct pnp_docking_station_info *data); 145extern int pnp_bios_dock_station_info(struct pnp_docking_station_info *data);
144#define needed 0
145#if needed
146extern int pnp_bios_get_event (u16 *message);
147extern int pnp_bios_send_message (u16 message);
148extern int pnp_bios_set_stat_res (char *info);
149extern int pnp_bios_apm_id_table (char *table, u16 *size);
150extern int pnp_bios_write_escd (char *data, u32 nvram_base);
151#endif
152 146
153#endif /* CONFIG_PNPBIOS */ 147#endif /* CONFIG_PNPBIOS */
154 148
diff --git a/include/linux/poll.h b/include/linux/poll.h
index 27690798623f..16d813b364ef 100644
--- a/include/linux/poll.h
+++ b/include/linux/poll.h
@@ -21,6 +21,8 @@
21#define WQUEUES_STACK_ALLOC (MAX_STACK_ALLOC - FRONTEND_STACK_ALLOC) 21#define WQUEUES_STACK_ALLOC (MAX_STACK_ALLOC - FRONTEND_STACK_ALLOC)
22#define N_INLINE_POLL_ENTRIES (WQUEUES_STACK_ALLOC / sizeof(struct poll_table_entry)) 22#define N_INLINE_POLL_ENTRIES (WQUEUES_STACK_ALLOC / sizeof(struct poll_table_entry))
23 23
24#define DEFAULT_POLLMASK (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM)
25
24struct poll_table_struct; 26struct poll_table_struct;
25 27
26/* 28/*
diff --git a/include/linux/preempt.h b/include/linux/preempt.h
index d0926d63406c..484988ed301e 100644
--- a/include/linux/preempt.h
+++ b/include/linux/preempt.h
@@ -8,6 +8,7 @@
8 8
9#include <linux/thread_info.h> 9#include <linux/thread_info.h>
10#include <linux/linkage.h> 10#include <linux/linkage.h>
11#include <linux/list.h>
11 12
12#ifdef CONFIG_DEBUG_PREEMPT 13#ifdef CONFIG_DEBUG_PREEMPT
13 extern void fastcall add_preempt_count(int val); 14 extern void fastcall add_preempt_count(int val);
@@ -60,4 +61,47 @@ do { \
60 61
61#endif 62#endif
62 63
64#ifdef CONFIG_PREEMPT_NOTIFIERS
65
66struct preempt_notifier;
67
68/**
69 * preempt_ops - notifiers called when a task is preempted and rescheduled
70 * @sched_in: we're about to be rescheduled:
71 * notifier: struct preempt_notifier for the task being scheduled
72 * cpu: cpu we're scheduled on
73 * @sched_out: we've just been preempted
74 * notifier: struct preempt_notifier for the task being preempted
75 * next: the task that's kicking us out
76 */
77struct preempt_ops {
78 void (*sched_in)(struct preempt_notifier *notifier, int cpu);
79 void (*sched_out)(struct preempt_notifier *notifier,
80 struct task_struct *next);
81};
82
83/**
84 * preempt_notifier - key for installing preemption notifiers
85 * @link: internal use
86 * @ops: defines the notifier functions to be called
87 *
88 * Usually used in conjunction with container_of().
89 */
90struct preempt_notifier {
91 struct hlist_node link;
92 struct preempt_ops *ops;
93};
94
95void preempt_notifier_register(struct preempt_notifier *notifier);
96void preempt_notifier_unregister(struct preempt_notifier *notifier);
97
98static inline void preempt_notifier_init(struct preempt_notifier *notifier,
99 struct preempt_ops *ops)
100{
101 INIT_HLIST_NODE(&notifier->link);
102 notifier->ops = ops;
103}
104
105#endif
106
63#endif /* __LINUX_PREEMPT_H */ 107#endif /* __LINUX_PREEMPT_H */
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 28e3664fdf1b..20741f668f7b 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -7,6 +7,7 @@
7#include <linux/magic.h> 7#include <linux/magic.h>
8#include <asm/atomic.h> 8#include <asm/atomic.h>
9 9
10struct net;
10struct completion; 11struct completion;
11 12
12/* 13/*
@@ -75,7 +76,6 @@ struct proc_dir_entry {
75 write_proc_t *write_proc; 76 write_proc_t *write_proc;
76 atomic_t count; /* use count */ 77 atomic_t count; /* use count */
77 int deleted; /* delete flag */ 78 int deleted; /* delete flag */
78 void *set;
79 int pde_users; /* number of callers into module in progress */ 79 int pde_users; /* number of callers into module in progress */
80 spinlock_t pde_unload_lock; /* proc_fops checks and pde_users bumps */ 80 spinlock_t pde_unload_lock; /* proc_fops checks and pde_users bumps */
81 struct completion *pde_unload_completion; 81 struct completion *pde_unload_completion;
@@ -98,8 +98,6 @@ struct vmcore {
98 98
99extern struct proc_dir_entry proc_root; 99extern struct proc_dir_entry proc_root;
100extern struct proc_dir_entry *proc_root_fs; 100extern struct proc_dir_entry *proc_root_fs;
101extern struct proc_dir_entry *proc_net;
102extern struct proc_dir_entry *proc_net_stat;
103extern struct proc_dir_entry *proc_bus; 101extern struct proc_dir_entry *proc_bus;
104extern struct proc_dir_entry *proc_root_driver; 102extern struct proc_dir_entry *proc_root_driver;
105extern struct proc_dir_entry *proc_root_kcore; 103extern struct proc_dir_entry *proc_root_kcore;
@@ -193,36 +191,21 @@ static inline struct proc_dir_entry *create_proc_info_entry(const char *name,
193 if (res) res->get_info=get_info; 191 if (res) res->get_info=get_info;
194 return res; 192 return res;
195} 193}
196
197static inline struct proc_dir_entry *proc_net_create(const char *name,
198 mode_t mode, get_info_t *get_info)
199{
200 return create_proc_info_entry(name,mode,proc_net,get_info);
201}
202 194
203static inline struct proc_dir_entry *proc_net_fops_create(const char *name, 195extern struct proc_dir_entry *proc_net_create(struct net *net,
204 mode_t mode, const struct file_operations *fops) 196 const char *name, mode_t mode, get_info_t *get_info);
205{ 197extern struct proc_dir_entry *proc_net_fops_create(struct net *net,
206 struct proc_dir_entry *res = create_proc_entry(name, mode, proc_net); 198 const char *name, mode_t mode, const struct file_operations *fops);
207 if (res) 199extern void proc_net_remove(struct net *net, const char *name);
208 res->proc_fops = fops;
209 return res;
210}
211
212static inline void proc_net_remove(const char *name)
213{
214 remove_proc_entry(name,proc_net);
215}
216 200
217#else 201#else
218 202
219#define proc_root_driver NULL 203#define proc_root_driver NULL
220#define proc_net NULL
221#define proc_bus NULL 204#define proc_bus NULL
222 205
223#define proc_net_fops_create(name, mode, fops) ({ (void)(mode), NULL; }) 206#define proc_net_fops_create(net, name, mode, fops) ({ (void)(mode), NULL; })
224#define proc_net_create(name, mode, info) ({ (void)(mode), NULL; }) 207#define proc_net_create(net, name, mode, info) ({ (void)(mode), NULL; })
225static inline void proc_net_remove(const char *name) {} 208static inline void proc_net_remove(struct net *net, const char *name) {}
226 209
227static inline void proc_flush_task(struct task_struct *task) { } 210static inline void proc_flush_task(struct task_struct *task) { }
228 211
@@ -282,6 +265,13 @@ static inline struct proc_dir_entry *PDE(const struct inode *inode)
282 return PROC_I(inode)->pde; 265 return PROC_I(inode)->pde;
283} 266}
284 267
268static inline struct net *PDE_NET(struct proc_dir_entry *pde)
269{
270 return pde->parent->data;
271}
272
273struct net *get_proc_net(const struct inode *inode);
274
285struct proc_maps_private { 275struct proc_maps_private {
286 struct pid *pid; 276 struct pid *pid;
287 struct task_struct *task; 277 struct task_struct *task;
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h
index 28ac632b42dd..dcb729244f47 100644
--- a/include/linux/raid/md_k.h
+++ b/include/linux/raid/md_k.h
@@ -227,7 +227,7 @@ struct mddev_s
227 unsigned int safemode_delay; 227 unsigned int safemode_delay;
228 struct timer_list safemode_timer; 228 struct timer_list safemode_timer;
229 atomic_t writes_pending; 229 atomic_t writes_pending;
230 request_queue_t *queue; /* for plugging ... */ 230 struct request_queue *queue; /* for plugging ... */
231 231
232 atomic_t write_behind; /* outstanding async IO */ 232 atomic_t write_behind; /* outstanding async IO */
233 unsigned int max_write_behind; /* 0 = sync */ 233 unsigned int max_write_behind; /* 0 = sync */
@@ -265,7 +265,7 @@ struct mdk_personality
265 int level; 265 int level;
266 struct list_head list; 266 struct list_head list;
267 struct module *owner; 267 struct module *owner;
268 int (*make_request)(request_queue_t *q, struct bio *bio); 268 int (*make_request)(struct request_queue *q, struct bio *bio);
269 int (*run)(mddev_t *mddev); 269 int (*run)(mddev_t *mddev);
270 int (*stop)(mddev_t *mddev); 270 int (*stop)(mddev_t *mddev);
271 void (*status)(struct seq_file *seq, mddev_t *mddev); 271 void (*status)(struct seq_file *seq, mddev_t *mddev);
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index c6b7485eac7c..fe17d7d750c2 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -281,7 +281,6 @@ extern void FASTCALL(call_rcu(struct rcu_head *head,
281extern void FASTCALL(call_rcu_bh(struct rcu_head *head, 281extern void FASTCALL(call_rcu_bh(struct rcu_head *head,
282 void (*func)(struct rcu_head *head))); 282 void (*func)(struct rcu_head *head)));
283extern void synchronize_rcu(void); 283extern void synchronize_rcu(void);
284void synchronize_idle(void);
285extern void rcu_barrier(void); 284extern void rcu_barrier(void);
286 285
287#endif /* __KERNEL__ */ 286#endif /* __KERNEL__ */
diff --git a/include/linux/reboot.h b/include/linux/reboot.h
index 1dd1c707311f..85ea63f462af 100644
--- a/include/linux/reboot.h
+++ b/include/linux/reboot.h
@@ -67,6 +67,11 @@ extern void kernel_power_off(void);
67 67
68void ctrl_alt_del(void); 68void ctrl_alt_del(void);
69 69
70#define POWEROFF_CMD_PATH_LEN 256
71extern char poweroff_cmd[POWEROFF_CMD_PATH_LEN];
72
73extern int orderly_poweroff(bool force);
74
70/* 75/*
71 * Emergency restart, callable from an interrupt handler. 76 * Emergency restart, callable from an interrupt handler.
72 */ 77 */
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index 965d5b3ea9eb..180a9d832dde 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -81,14 +81,16 @@ void reiserfs_warning(struct super_block *s, const char *fmt, ...);
81/* assertions handling */ 81/* assertions handling */
82 82
83/** always check a condition and panic if it's false. */ 83/** always check a condition and panic if it's false. */
84#define RASSERT( cond, format, args... ) \ 84#define __RASSERT( cond, scond, format, args... ) \
85if( !( cond ) ) \ 85if( !( cond ) ) \
86 reiserfs_panic( NULL, "reiserfs[%i]: assertion " #cond " failed at " \ 86 reiserfs_panic( NULL, "reiserfs[%i]: assertion " scond " failed at " \
87 __FILE__ ":%i:%s: " format "\n", \ 87 __FILE__ ":%i:%s: " format "\n", \
88 in_interrupt() ? -1 : current -> pid, __LINE__ , __FUNCTION__ , ##args ) 88 in_interrupt() ? -1 : current -> pid, __LINE__ , __FUNCTION__ , ##args )
89 89
90#define RASSERT(cond, format, args...) __RASSERT(cond, #cond, format, ##args)
91
90#if defined( CONFIG_REISERFS_CHECK ) 92#if defined( CONFIG_REISERFS_CHECK )
91#define RFALSE( cond, format, args... ) RASSERT( !( cond ), format, ##args ) 93#define RFALSE(cond, format, args...) __RASSERT(!(cond), "!(" #cond ")", format, ##args)
92#else 94#else
93#define RFALSE( cond, format, args... ) do {;} while( 0 ) 95#define RFALSE( cond, format, args... ) do {;} while( 0 )
94#endif 96#endif
diff --git a/include/linux/resume-trace.h b/include/linux/resume-trace.h
index 81e9299ca148..f3f4f28c6960 100644
--- a/include/linux/resume-trace.h
+++ b/include/linux/resume-trace.h
@@ -2,6 +2,7 @@
2#define RESUME_TRACE_H 2#define RESUME_TRACE_H
3 3
4#ifdef CONFIG_PM_TRACE 4#ifdef CONFIG_PM_TRACE
5#include <asm/resume-trace.h>
5 6
6extern int pm_trace_enabled; 7extern int pm_trace_enabled;
7 8
@@ -9,20 +10,10 @@ struct device;
9extern void set_trace_device(struct device *); 10extern void set_trace_device(struct device *);
10extern void generate_resume_trace(void *tracedata, unsigned int user); 11extern void generate_resume_trace(void *tracedata, unsigned int user);
11 12
12#define TRACE_DEVICE(dev) set_trace_device(dev) 13#define TRACE_DEVICE(dev) do { \
13#define TRACE_RESUME(user) do { \ 14 if (pm_trace_enabled) \
14 if (pm_trace_enabled) { \ 15 set_trace_device(dev); \
15 void *tracedata; \ 16 } while(0)
16 asm volatile("movl $1f,%0\n" \
17 ".section .tracedata,\"a\"\n" \
18 "1:\t.word %c1\n" \
19 "\t.long %c2\n" \
20 ".previous" \
21 :"=r" (tracedata) \
22 : "i" (__LINE__), "i" (__FILE__)); \
23 generate_resume_trace(tracedata, user); \
24 } \
25} while (0)
26 17
27#else 18#else
28 19
diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h
index a8a6ea809da0..0ce5e0b52dbd 100644
--- a/include/linux/rfkill.h
+++ b/include/linux/rfkill.h
@@ -2,7 +2,7 @@
2#define __RFKILL_H 2#define __RFKILL_H
3 3
4/* 4/*
5 * Copyright (C) 2006 Ivo van Doorn 5 * Copyright (C) 2006 - 2007 Ivo van Doorn
6 * Copyright (C) 2007 Dmitry Torokhov 6 * Copyright (C) 2007 Dmitry Torokhov
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
@@ -26,18 +26,19 @@
26#include <linux/list.h> 26#include <linux/list.h>
27#include <linux/mutex.h> 27#include <linux/mutex.h>
28#include <linux/device.h> 28#include <linux/device.h>
29#include <linux/leds.h>
29 30
30/** 31/**
31 * enum rfkill_type - type of rfkill switch. 32 * enum rfkill_type - type of rfkill switch.
32 * RFKILL_TYPE_WLAN: switch is no a Wireless network devices. 33 * RFKILL_TYPE_WLAN: switch is on a 802.11 wireless network device.
33 * RFKILL_TYPE_BlUETOOTH: switch is on a bluetooth device. 34 * RFKILL_TYPE_BLUETOOTH: switch is on a bluetooth device.
34 * RFKILL_TYPE_IRDA: switch is on an infrared devices. 35 * RFKILL_TYPE_UWB: switch is on a ultra wideband device.
35 */ 36 */
36enum rfkill_type { 37enum rfkill_type {
37 RFKILL_TYPE_WLAN = 0, 38 RFKILL_TYPE_WLAN ,
38 RFKILL_TYPE_BLUETOOTH = 1, 39 RFKILL_TYPE_BLUETOOTH,
39 RFKILL_TYPE_IRDA = 2, 40 RFKILL_TYPE_UWB,
40 RFKILL_TYPE_MAX = 3, 41 RFKILL_TYPE_MAX,
41}; 42};
42 43
43enum rfkill_state { 44enum rfkill_state {
@@ -51,11 +52,14 @@ enum rfkill_state {
51 * @type: Radio type which the button controls, the value stored 52 * @type: Radio type which the button controls, the value stored
52 * here should be a value from enum rfkill_type. 53 * here should be a value from enum rfkill_type.
53 * @state: State of the switch (on/off). 54 * @state: State of the switch (on/off).
55 * @user_claim_unsupported: Whether the hardware supports exclusive
56 * RF-kill control by userspace. Set this before registering.
54 * @user_claim: Set when the switch is controlled exlusively by userspace. 57 * @user_claim: Set when the switch is controlled exlusively by userspace.
55 * @mutex: Guards switch state transitions 58 * @mutex: Guards switch state transitions
56 * @data: Pointer to the RF button drivers private data which will be 59 * @data: Pointer to the RF button drivers private data which will be
57 * passed along when toggling radio state. 60 * passed along when toggling radio state.
58 * @toggle_radio(): Mandatory handler to control state of the radio. 61 * @toggle_radio(): Mandatory handler to control state of the radio.
62 * @led_trigger: A LED trigger for this button's LED.
59 * @dev: Device structure integrating the switch into device tree. 63 * @dev: Device structure integrating the switch into device tree.
60 * @node: Used to place switch into list of all switches known to the 64 * @node: Used to place switch into list of all switches known to the
61 * the system. 65 * the system.
@@ -67,6 +71,7 @@ struct rfkill {
67 enum rfkill_type type; 71 enum rfkill_type type;
68 72
69 enum rfkill_state state; 73 enum rfkill_state state;
74 bool user_claim_unsupported;
70 bool user_claim; 75 bool user_claim;
71 76
72 struct mutex mutex; 77 struct mutex mutex;
@@ -74,6 +79,10 @@ struct rfkill {
74 void *data; 79 void *data;
75 int (*toggle_radio)(void *data, enum rfkill_state state); 80 int (*toggle_radio)(void *data, enum rfkill_state state);
76 81
82#ifdef CONFIG_RFKILL_LEDS
83 struct led_trigger led_trigger;
84#endif
85
77 struct device dev; 86 struct device dev;
78 struct list_head node; 87 struct list_head node;
79}; 88};
@@ -84,6 +93,19 @@ void rfkill_free(struct rfkill *rfkill);
84int rfkill_register(struct rfkill *rfkill); 93int rfkill_register(struct rfkill *rfkill);
85void rfkill_unregister(struct rfkill *rfkill); 94void rfkill_unregister(struct rfkill *rfkill);
86 95
87void rfkill_switch_all(enum rfkill_type type, enum rfkill_state state); 96/**
97 * rfkill_get_led_name - Get the LED trigger name for the button's LED.
98 * This function might return a NULL pointer if registering of the
99 * LED trigger failed.
100 * Use this as "default_trigger" for the LED.
101 */
102static inline char *rfkill_get_led_name(struct rfkill *rfkill)
103{
104#ifdef CONFIG_RFKILL_LEDS
105 return (char *)(rfkill->led_trigger.name);
106#else
107 return NULL;
108#endif
109}
88 110
89#endif /* RFKILL_H */ 111#endif /* RFKILL_H */
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index c91476ce314a..5bf618241ab9 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -97,6 +97,9 @@ enum {
97 RTM_SETNEIGHTBL, 97 RTM_SETNEIGHTBL,
98#define RTM_SETNEIGHTBL RTM_SETNEIGHTBL 98#define RTM_SETNEIGHTBL RTM_SETNEIGHTBL
99 99
100 RTM_NEWNDUSEROPT = 68,
101#define RTM_NEWNDUSEROPT RTM_NEWNDUSEROPT
102
100 __RTM_MAX, 103 __RTM_MAX,
101#define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1) 104#define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1)
102}; 105};
@@ -351,6 +354,8 @@ enum
351#define RTAX_INITCWND RTAX_INITCWND 354#define RTAX_INITCWND RTAX_INITCWND
352 RTAX_FEATURES, 355 RTAX_FEATURES,
353#define RTAX_FEATURES RTAX_FEATURES 356#define RTAX_FEATURES RTAX_FEATURES
357 RTAX_RTO_MIN,
358#define RTAX_RTO_MIN RTAX_RTO_MIN
354 __RTAX_MAX 359 __RTAX_MAX
355}; 360};
356 361
@@ -477,6 +482,30 @@ enum
477#define TCA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct tcmsg)))) 482#define TCA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct tcmsg))))
478#define TCA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct tcmsg)) 483#define TCA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct tcmsg))
479 484
485/********************************************************************
486 * Neighbor Discovery userland options
487 ****/
488
489struct nduseroptmsg
490{
491 unsigned char nduseropt_family;
492 unsigned char nduseropt_pad1;
493 unsigned short nduseropt_opts_len; /* Total length of options */
494 __u8 nduseropt_icmp_type;
495 __u8 nduseropt_icmp_code;
496 unsigned short nduseropt_pad2;
497 /* Followed by one or more ND options */
498};
499
500enum
501{
502 NDUSEROPT_UNSPEC,
503 NDUSEROPT_SRCADDR,
504 __NDUSEROPT_MAX
505};
506
507#define NDUSEROPT_MAX (__NDUSEROPT_MAX - 1)
508
480#ifndef __KERNEL__ 509#ifndef __KERNEL__
481/* RTnetlink multicast groups - backwards compatibility for userspace */ 510/* RTnetlink multicast groups - backwards compatibility for userspace */
482#define RTMGRP_LINK 1 511#define RTMGRP_LINK 1
@@ -540,6 +569,8 @@ enum rtnetlink_groups {
540#define RTNLGRP_IPV6_PREFIX RTNLGRP_IPV6_PREFIX 569#define RTNLGRP_IPV6_PREFIX RTNLGRP_IPV6_PREFIX
541 RTNLGRP_IPV6_RULE, 570 RTNLGRP_IPV6_RULE,
542#define RTNLGRP_IPV6_RULE RTNLGRP_IPV6_RULE 571#define RTNLGRP_IPV6_RULE RTNLGRP_IPV6_RULE
572 RTNLGRP_ND_USEROPT,
573#define RTNLGRP_ND_USEROPT RTNLGRP_ND_USEROPT
543 __RTNLGRP_MAX 574 __RTNLGRP_MAX
544}; 575};
545#define RTNLGRP_MAX (__RTNLGRP_MAX - 1) 576#define RTNLGRP_MAX (__RTNLGRP_MAX - 1)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 731edaca8ffd..833f7dc2b8de 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -27,6 +27,7 @@
27#define CLONE_NEWUTS 0x04000000 /* New utsname group? */ 27#define CLONE_NEWUTS 0x04000000 /* New utsname group? */
28#define CLONE_NEWIPC 0x08000000 /* New ipcs */ 28#define CLONE_NEWIPC 0x08000000 /* New ipcs */
29#define CLONE_NEWUSER 0x10000000 /* New user namespace */ 29#define CLONE_NEWUSER 0x10000000 /* New user namespace */
30#define CLONE_NEWNET 0x40000000 /* New network namespace */
30 31
31/* 32/*
32 * Scheduling policies 33 * Scheduling policies
@@ -113,7 +114,7 @@ extern unsigned long avenrun[]; /* Load averages */
113 114
114#define FSHIFT 11 /* nr of bits of precision */ 115#define FSHIFT 11 /* nr of bits of precision */
115#define FIXED_1 (1<<FSHIFT) /* 1.0 as fixed-point */ 116#define FIXED_1 (1<<FSHIFT) /* 1.0 as fixed-point */
116#define LOAD_FREQ (5*HZ) /* 5 sec intervals */ 117#define LOAD_FREQ (5*HZ+1) /* 5 sec intervals */
117#define EXP_1 1884 /* 1/exp(5sec/1min) as fixed-point */ 118#define EXP_1 1884 /* 1/exp(5sec/1min) as fixed-point */
118#define EXP_5 2014 /* 1/exp(5sec/5min) */ 119#define EXP_5 2014 /* 1/exp(5sec/5min) */
119#define EXP_15 2037 /* 1/exp(5sec/15min) */ 120#define EXP_15 2037 /* 1/exp(5sec/15min) */
@@ -139,7 +140,7 @@ struct cfs_rq;
139extern void proc_sched_show_task(struct task_struct *p, struct seq_file *m); 140extern void proc_sched_show_task(struct task_struct *p, struct seq_file *m);
140extern void proc_sched_set_task(struct task_struct *p); 141extern void proc_sched_set_task(struct task_struct *p);
141extern void 142extern void
142print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq, u64 now); 143print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq);
143#else 144#else
144static inline void 145static inline void
145proc_sched_show_task(struct task_struct *p, struct seq_file *m) 146proc_sched_show_task(struct task_struct *p, struct seq_file *m)
@@ -149,7 +150,7 @@ static inline void proc_sched_set_task(struct task_struct *p)
149{ 150{
150} 151}
151static inline void 152static inline void
152print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq, u64 now) 153print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
153{ 154{
154} 155}
155#endif 156#endif
@@ -345,6 +346,27 @@ typedef unsigned long mm_counter_t;
345 (mm)->hiwater_vm = (mm)->total_vm; \ 346 (mm)->hiwater_vm = (mm)->total_vm; \
346} while (0) 347} while (0)
347 348
349extern void set_dumpable(struct mm_struct *mm, int value);
350extern int get_dumpable(struct mm_struct *mm);
351
352/* mm flags */
353/* dumpable bits */
354#define MMF_DUMPABLE 0 /* core dump is permitted */
355#define MMF_DUMP_SECURELY 1 /* core file is readable only by root */
356#define MMF_DUMPABLE_BITS 2
357
358/* coredump filter bits */
359#define MMF_DUMP_ANON_PRIVATE 2
360#define MMF_DUMP_ANON_SHARED 3
361#define MMF_DUMP_MAPPED_PRIVATE 4
362#define MMF_DUMP_MAPPED_SHARED 5
363#define MMF_DUMP_FILTER_SHIFT MMF_DUMPABLE_BITS
364#define MMF_DUMP_FILTER_BITS 4
365#define MMF_DUMP_FILTER_MASK \
366 (((1 << MMF_DUMP_FILTER_BITS) - 1) << MMF_DUMP_FILTER_SHIFT)
367#define MMF_DUMP_FILTER_DEFAULT \
368 ((1 << MMF_DUMP_ANON_PRIVATE) | (1 << MMF_DUMP_ANON_SHARED))
369
348struct mm_struct { 370struct mm_struct {
349 struct vm_area_struct * mmap; /* list of VMAs */ 371 struct vm_area_struct * mmap; /* list of VMAs */
350 struct rb_root mm_rb; 372 struct rb_root mm_rb;
@@ -402,7 +424,7 @@ struct mm_struct {
402 unsigned int token_priority; 424 unsigned int token_priority;
403 unsigned int last_interval; 425 unsigned int last_interval;
404 426
405 unsigned char dumpable:2; 427 unsigned long flags; /* Must use atomic bitops to access the bits */
406 428
407 /* coredumping support */ 429 /* coredumping support */
408 int core_waiters; 430 int core_waiters;
@@ -417,7 +439,7 @@ struct sighand_struct {
417 atomic_t count; 439 atomic_t count;
418 struct k_sigaction action[_NSIG]; 440 struct k_sigaction action[_NSIG];
419 spinlock_t siglock; 441 spinlock_t siglock;
420 struct list_head signalfd_list; 442 wait_queue_head_t signalfd_wqh;
421}; 443};
422 444
423struct pacct_struct { 445struct pacct_struct {
@@ -572,7 +594,7 @@ struct user_struct {
572#endif 594#endif
573 595
574 /* Hash table maintenance information */ 596 /* Hash table maintenance information */
575 struct list_head uidhash_list; 597 struct hlist_node uidhash_node;
576 uid_t uid; 598 uid_t uid;
577}; 599};
578 600
@@ -660,7 +682,7 @@ enum cpu_idle_type {
660#define SCHED_LOAD_SHIFT 10 682#define SCHED_LOAD_SHIFT 10
661#define SCHED_LOAD_SCALE (1L << SCHED_LOAD_SHIFT) 683#define SCHED_LOAD_SCALE (1L << SCHED_LOAD_SHIFT)
662 684
663#define SCHED_LOAD_SCALE_FUZZ (SCHED_LOAD_SCALE >> 5) 685#define SCHED_LOAD_SCALE_FUZZ SCHED_LOAD_SCALE
664 686
665#ifdef CONFIG_SMP 687#ifdef CONFIG_SMP
666#define SD_LOAD_BALANCE 1 /* Do load balancing on this domain. */ 688#define SD_LOAD_BALANCE 1 /* Do load balancing on this domain. */
@@ -713,7 +735,6 @@ struct sched_domain {
713 unsigned long max_interval; /* Maximum balance interval ms */ 735 unsigned long max_interval; /* Maximum balance interval ms */
714 unsigned int busy_factor; /* less balancing by factor if busy */ 736 unsigned int busy_factor; /* less balancing by factor if busy */
715 unsigned int imbalance_pct; /* No balance until over watermark */ 737 unsigned int imbalance_pct; /* No balance until over watermark */
716 unsigned long long cache_hot_time; /* Task considered cache hot (ns) */
717 unsigned int cache_nice_tries; /* Leave cache hot tasks for # tries */ 738 unsigned int cache_nice_tries; /* Leave cache hot tasks for # tries */
718 unsigned int busy_idx; 739 unsigned int busy_idx;
719 unsigned int idle_idx; 740 unsigned int idle_idx;
@@ -765,6 +786,22 @@ extern int partition_sched_domains(cpumask_t *partition1,
765 786
766#endif /* CONFIG_SMP */ 787#endif /* CONFIG_SMP */
767 788
789/*
790 * A runqueue laden with a single nice 0 task scores a weighted_cpuload of
791 * SCHED_LOAD_SCALE. This function returns 1 if any cpu is laden with a
792 * task of nice 0 or enough lower priority tasks to bring up the
793 * weighted_cpuload
794 */
795static inline int above_background_load(void)
796{
797 unsigned long cpu;
798
799 for_each_online_cpu(cpu) {
800 if (weighted_cpuload(cpu) >= SCHED_LOAD_SCALE)
801 return 1;
802 }
803 return 0;
804}
768 805
769struct io_context; /* See blkdev.h */ 806struct io_context; /* See blkdev.h */
770struct cpuset; 807struct cpuset;
@@ -819,22 +856,20 @@ struct sched_domain;
819struct sched_class { 856struct sched_class {
820 struct sched_class *next; 857 struct sched_class *next;
821 858
822 void (*enqueue_task) (struct rq *rq, struct task_struct *p, 859 void (*enqueue_task) (struct rq *rq, struct task_struct *p, int wakeup);
823 int wakeup, u64 now); 860 void (*dequeue_task) (struct rq *rq, struct task_struct *p, int sleep);
824 void (*dequeue_task) (struct rq *rq, struct task_struct *p,
825 int sleep, u64 now);
826 void (*yield_task) (struct rq *rq, struct task_struct *p); 861 void (*yield_task) (struct rq *rq, struct task_struct *p);
827 862
828 void (*check_preempt_curr) (struct rq *rq, struct task_struct *p); 863 void (*check_preempt_curr) (struct rq *rq, struct task_struct *p);
829 864
830 struct task_struct * (*pick_next_task) (struct rq *rq, u64 now); 865 struct task_struct * (*pick_next_task) (struct rq *rq);
831 void (*put_prev_task) (struct rq *rq, struct task_struct *p, u64 now); 866 void (*put_prev_task) (struct rq *rq, struct task_struct *p);
832 867
833 int (*load_balance) (struct rq *this_rq, int this_cpu, 868 unsigned long (*load_balance) (struct rq *this_rq, int this_cpu,
834 struct rq *busiest, 869 struct rq *busiest,
835 unsigned long max_nr_move, unsigned long max_load_move, 870 unsigned long max_nr_move, unsigned long max_load_move,
836 struct sched_domain *sd, enum cpu_idle_type idle, 871 struct sched_domain *sd, enum cpu_idle_type idle,
837 int *all_pinned, unsigned long *total_load_moved); 872 int *all_pinned, int *this_best_prio);
838 873
839 void (*set_curr_task) (struct rq *rq); 874 void (*set_curr_task) (struct rq *rq);
840 void (*task_tick) (struct rq *rq, struct task_struct *p); 875 void (*task_tick) (struct rq *rq, struct task_struct *p);
@@ -868,23 +903,29 @@ struct sched_entity {
868 struct rb_node run_node; 903 struct rb_node run_node;
869 unsigned int on_rq; 904 unsigned int on_rq;
870 905
906 u64 exec_start;
907 u64 sum_exec_runtime;
908 u64 prev_sum_exec_runtime;
871 u64 wait_start_fair; 909 u64 wait_start_fair;
910 u64 sleep_start_fair;
911
912#ifdef CONFIG_SCHEDSTATS
872 u64 wait_start; 913 u64 wait_start;
873 u64 exec_start; 914 u64 wait_max;
915 s64 sum_wait_runtime;
916
874 u64 sleep_start; 917 u64 sleep_start;
875 u64 sleep_start_fair;
876 u64 block_start;
877 u64 sleep_max; 918 u64 sleep_max;
919 s64 sum_sleep_runtime;
920
921 u64 block_start;
878 u64 block_max; 922 u64 block_max;
879 u64 exec_max; 923 u64 exec_max;
880 u64 wait_max;
881 u64 last_ran;
882 924
883 u64 sum_exec_runtime;
884 s64 sum_wait_runtime;
885 s64 sum_sleep_runtime;
886 unsigned long wait_runtime_overruns; 925 unsigned long wait_runtime_overruns;
887 unsigned long wait_runtime_underruns; 926 unsigned long wait_runtime_underruns;
927#endif
928
888#ifdef CONFIG_FAIR_GROUP_SCHED 929#ifdef CONFIG_FAIR_GROUP_SCHED
889 struct sched_entity *parent; 930 struct sched_entity *parent;
890 /* rq on which this entity is (to be) queued: */ 931 /* rq on which this entity is (to be) queued: */
@@ -914,6 +955,11 @@ struct task_struct {
914 struct sched_class *sched_class; 955 struct sched_class *sched_class;
915 struct sched_entity se; 956 struct sched_entity se;
916 957
958#ifdef CONFIG_PREEMPT_NOTIFIERS
959 /* list of struct preempt_notifier: */
960 struct hlist_head preempt_notifiers;
961#endif
962
917 unsigned short ioprio; 963 unsigned short ioprio;
918#ifdef CONFIG_BLK_DEV_IO_TRACE 964#ifdef CONFIG_BLK_DEV_IO_TRACE
919 unsigned int btrace_seq; 965 unsigned int btrace_seq;
@@ -1327,6 +1373,13 @@ static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask)
1327#endif 1373#endif
1328 1374
1329extern unsigned long long sched_clock(void); 1375extern unsigned long long sched_clock(void);
1376
1377/*
1378 * For kernel-internal use: high-speed (but slightly incorrect) per-cpu
1379 * clock constructed from sched_clock():
1380 */
1381extern unsigned long long cpu_clock(int cpu);
1382
1330extern unsigned long long 1383extern unsigned long long
1331task_sched_runtime(struct task_struct *task); 1384task_sched_runtime(struct task_struct *task);
1332 1385
@@ -1337,7 +1390,8 @@ extern void sched_exec(void);
1337#define sched_exec() {} 1390#define sched_exec() {}
1338#endif 1391#endif
1339 1392
1340extern void sched_clock_unstable_event(void); 1393extern void sched_clock_idle_sleep_event(void);
1394extern void sched_clock_idle_wakeup_event(u64 delta_ns);
1341 1395
1342#ifdef CONFIG_HOTPLUG_CPU 1396#ifdef CONFIG_HOTPLUG_CPU
1343extern void idle_task_exit(void); 1397extern void idle_task_exit(void);
@@ -1347,11 +1401,13 @@ static inline void idle_task_exit(void) {}
1347 1401
1348extern void sched_idle_next(void); 1402extern void sched_idle_next(void);
1349 1403
1350extern unsigned int sysctl_sched_granularity; 1404extern unsigned int sysctl_sched_latency;
1405extern unsigned int sysctl_sched_min_granularity;
1351extern unsigned int sysctl_sched_wakeup_granularity; 1406extern unsigned int sysctl_sched_wakeup_granularity;
1352extern unsigned int sysctl_sched_batch_wakeup_granularity; 1407extern unsigned int sysctl_sched_batch_wakeup_granularity;
1353extern unsigned int sysctl_sched_stat_granularity; 1408extern unsigned int sysctl_sched_stat_granularity;
1354extern unsigned int sysctl_sched_runtime_limit; 1409extern unsigned int sysctl_sched_runtime_limit;
1410extern unsigned int sysctl_sched_compat_yield;
1355extern unsigned int sysctl_sched_child_runs_first; 1411extern unsigned int sysctl_sched_child_runs_first;
1356extern unsigned int sysctl_sched_features; 1412extern unsigned int sysctl_sched_features;
1357 1413
@@ -1418,6 +1474,7 @@ static inline struct user_struct *get_uid(struct user_struct *u)
1418} 1474}
1419extern void free_uid(struct user_struct *); 1475extern void free_uid(struct user_struct *);
1420extern void switch_uid(struct user_struct *); 1476extern void switch_uid(struct user_struct *);
1477extern void release_uids(struct user_namespace *ns);
1421 1478
1422#include <asm/current.h> 1479#include <asm/current.h>
1423 1480
diff --git a/include/linux/sctp.h b/include/linux/sctp.h
index d70df61a029f..5eb38cc0e5a4 100644
--- a/include/linux/sctp.h
+++ b/include/linux/sctp.h
@@ -102,6 +102,9 @@ typedef enum {
102 SCTP_CID_ECN_CWR = 13, 102 SCTP_CID_ECN_CWR = 13,
103 SCTP_CID_SHUTDOWN_COMPLETE = 14, 103 SCTP_CID_SHUTDOWN_COMPLETE = 14,
104 104
105 /* AUTH Extension Section 4.1 */
106 SCTP_CID_AUTH = 0x0F,
107
105 /* PR-SCTP Sec 3.2 */ 108 /* PR-SCTP Sec 3.2 */
106 SCTP_CID_FWD_TSN = 0xC0, 109 SCTP_CID_FWD_TSN = 0xC0,
107 110
@@ -180,6 +183,14 @@ typedef enum {
180 SCTP_PARAM_SUPPORTED_ADDRESS_TYPES = __constant_htons(12), 183 SCTP_PARAM_SUPPORTED_ADDRESS_TYPES = __constant_htons(12),
181 SCTP_PARAM_ECN_CAPABLE = __constant_htons(0x8000), 184 SCTP_PARAM_ECN_CAPABLE = __constant_htons(0x8000),
182 185
186 /* AUTH Extension Section 3 */
187 SCTP_PARAM_RANDOM = __constant_htons(0x8002),
188 SCTP_PARAM_CHUNKS = __constant_htons(0x8003),
189 SCTP_PARAM_HMAC_ALGO = __constant_htons(0x8004),
190
191 /* Add-IP: Supported Extensions, Section 4.2 */
192 SCTP_PARAM_SUPPORTED_EXT = __constant_htons(0x8008),
193
183 /* PR-SCTP Sec 3.1 */ 194 /* PR-SCTP Sec 3.1 */
184 SCTP_PARAM_FWD_TSN_SUPPORT = __constant_htons(0xc000), 195 SCTP_PARAM_FWD_TSN_SUPPORT = __constant_htons(0xc000),
185 196
@@ -296,6 +307,30 @@ typedef struct sctp_adaptation_ind_param {
296 __be32 adaptation_ind; 307 __be32 adaptation_ind;
297} __attribute__((packed)) sctp_adaptation_ind_param_t; 308} __attribute__((packed)) sctp_adaptation_ind_param_t;
298 309
310/* ADDIP Section 4.2.7 Supported Extensions Parameter */
311typedef struct sctp_supported_ext_param {
312 struct sctp_paramhdr param_hdr;
313 __u8 chunks[0];
314} __attribute__((packed)) sctp_supported_ext_param_t;
315
316/* AUTH Section 3.1 Random */
317typedef struct sctp_random_param {
318 sctp_paramhdr_t param_hdr;
319 __u8 random_val[0];
320} __attribute__((packed)) sctp_random_param_t;
321
322/* AUTH Section 3.2 Chunk List */
323typedef struct sctp_chunks_param {
324 sctp_paramhdr_t param_hdr;
325 __u8 chunks[0];
326} __attribute__((packed)) sctp_chunks_param_t;
327
328/* AUTH Section 3.3 HMAC Algorithm */
329typedef struct sctp_hmac_algo_param {
330 sctp_paramhdr_t param_hdr;
331 __be16 hmac_ids[0];
332} __attribute__((packed)) sctp_hmac_algo_param_t;
333
299/* RFC 2960. Section 3.3.3 Initiation Acknowledgement (INIT ACK) (2): 334/* RFC 2960. Section 3.3.3 Initiation Acknowledgement (INIT ACK) (2):
300 * The INIT ACK chunk is used to acknowledge the initiation of an SCTP 335 * The INIT ACK chunk is used to acknowledge the initiation of an SCTP
301 * association. 336 * association.
@@ -462,7 +497,19 @@ typedef enum {
462 SCTP_ERROR_RSRC_LOW = __constant_htons(0x0101), 497 SCTP_ERROR_RSRC_LOW = __constant_htons(0x0101),
463 SCTP_ERROR_DEL_SRC_IP = __constant_htons(0x0102), 498 SCTP_ERROR_DEL_SRC_IP = __constant_htons(0x0102),
464 SCTP_ERROR_ASCONF_ACK = __constant_htons(0x0103), 499 SCTP_ERROR_ASCONF_ACK = __constant_htons(0x0103),
465 SCTP_ERROR_REQ_REFUSED = __constant_htons(0x0104) 500 SCTP_ERROR_REQ_REFUSED = __constant_htons(0x0104),
501
502 /* AUTH Section 4. New Error Cause
503 *
504 * This section defines a new error cause that will be sent if an AUTH
505 * chunk is received with an unsupported HMAC identifier.
506 * illustrates the new error cause.
507 *
508 * Cause Code Error Cause Name
509 * --------------------------------------------------------------
510 * 0x0105 Unsupported HMAC Identifier
511 */
512 SCTP_ERROR_UNSUP_HMAC = __constant_htons(0x0105)
466} sctp_error_t; 513} sctp_error_t;
467 514
468 515
@@ -600,4 +647,64 @@ typedef struct sctp_addip_chunk {
600 sctp_addiphdr_t addip_hdr; 647 sctp_addiphdr_t addip_hdr;
601} __attribute__((packed)) sctp_addip_chunk_t; 648} __attribute__((packed)) sctp_addip_chunk_t;
602 649
650/* AUTH
651 * Section 4.1 Authentication Chunk (AUTH)
652 *
653 * This chunk is used to hold the result of the HMAC calculation.
654 *
655 * 0 1 2 3
656 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
657 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
658 * | Type = 0x0F | Flags=0 | Length |
659 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
660 * | Shared Key Identifier | HMAC Identifier |
661 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
662 * | |
663 * \ HMAC /
664 * / \
665 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
666 *
667 * Type: 1 byte (unsigned integer)
668 * This value MUST be set to 0x0F for all AUTH-chunks.
669 *
670 * Flags: 1 byte (unsigned integer)
671 * Set to zero on transmit and ignored on receipt.
672 *
673 * Length: 2 bytes (unsigned integer)
674 * This value holds the length of the HMAC in bytes plus 8.
675 *
676 * Shared Key Identifier: 2 bytes (unsigned integer)
677 * This value describes which endpoint pair shared key is used.
678 *
679 * HMAC Identifier: 2 bytes (unsigned integer)
680 * This value describes which message digest is being used. Table 2
681 * shows the currently defined values.
682 *
683 * The following Table 2 shows the currently defined values for HMAC
684 * identifiers.
685 *
686 * +-----------------+--------------------------+
687 * | HMAC Identifier | Message Digest Algorithm |
688 * +-----------------+--------------------------+
689 * | 0 | Reserved |
690 * | 1 | SHA-1 defined in [8] |
691 * | 2 | Reserved |
692 * | 3 | SHA-256 defined in [8] |
693 * +-----------------+--------------------------+
694 *
695 *
696 * HMAC: n bytes (unsigned integer) This hold the result of the HMAC
697 * calculation.
698 */
699typedef struct sctp_authhdr {
700 __be16 shkey_id;
701 __be16 hmac_id;
702 __u8 hmac[0];
703} __attribute__((packed)) sctp_authhdr_t;
704
705typedef struct sctp_auth_chunk {
706 sctp_chunkhdr_t chunk_hdr;
707 sctp_authhdr_t auth_hdr;
708} __attribute__((packed)) sctp_auth_chunk_t;
709
603#endif /* __LINUX_SCTP_H__ */ 710#endif /* __LINUX_SCTP_H__ */
diff --git a/include/linux/security.h b/include/linux/security.h
index c11dc8aa0351..1a15526e9f67 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -54,7 +54,7 @@ extern int cap_inode_removexattr(struct dentry *dentry, char *name);
54extern int cap_task_post_setuid (uid_t old_ruid, uid_t old_euid, uid_t old_suid, int flags); 54extern int cap_task_post_setuid (uid_t old_ruid, uid_t old_euid, uid_t old_suid, int flags);
55extern void cap_task_reparent_to_init (struct task_struct *p); 55extern void cap_task_reparent_to_init (struct task_struct *p);
56extern int cap_syslog (int type); 56extern int cap_syslog (int type);
57extern int cap_vm_enough_memory (long pages); 57extern int cap_vm_enough_memory (struct mm_struct *mm, long pages);
58 58
59struct msghdr; 59struct msghdr;
60struct sk_buff; 60struct sk_buff;
@@ -1125,6 +1125,7 @@ struct request_sock;
1125 * Return 0 if permission is granted. 1125 * Return 0 if permission is granted.
1126 * @vm_enough_memory: 1126 * @vm_enough_memory:
1127 * Check permissions for allocating a new virtual mapping. 1127 * Check permissions for allocating a new virtual mapping.
1128 * @mm contains the mm struct it is being added to.
1128 * @pages contains the number of pages. 1129 * @pages contains the number of pages.
1129 * Return 0 if permission is granted. 1130 * Return 0 if permission is granted.
1130 * 1131 *
@@ -1169,7 +1170,7 @@ struct security_operations {
1169 int (*quota_on) (struct dentry * dentry); 1170 int (*quota_on) (struct dentry * dentry);
1170 int (*syslog) (int type); 1171 int (*syslog) (int type);
1171 int (*settime) (struct timespec *ts, struct timezone *tz); 1172 int (*settime) (struct timespec *ts, struct timezone *tz);
1172 int (*vm_enough_memory) (long pages); 1173 int (*vm_enough_memory) (struct mm_struct *mm, long pages);
1173 1174
1174 int (*bprm_alloc_security) (struct linux_binprm * bprm); 1175 int (*bprm_alloc_security) (struct linux_binprm * bprm);
1175 void (*bprm_free_security) (struct linux_binprm * bprm); 1176 void (*bprm_free_security) (struct linux_binprm * bprm);
@@ -1469,10 +1470,14 @@ static inline int security_settime(struct timespec *ts, struct timezone *tz)
1469 return security_ops->settime(ts, tz); 1470 return security_ops->settime(ts, tz);
1470} 1471}
1471 1472
1472
1473static inline int security_vm_enough_memory(long pages) 1473static inline int security_vm_enough_memory(long pages)
1474{ 1474{
1475 return security_ops->vm_enough_memory(pages); 1475 return security_ops->vm_enough_memory(current->mm, pages);
1476}
1477
1478static inline int security_vm_enough_memory_mm(struct mm_struct *mm, long pages)
1479{
1480 return security_ops->vm_enough_memory(mm, pages);
1476} 1481}
1477 1482
1478static inline int security_bprm_alloc (struct linux_binprm *bprm) 1483static inline int security_bprm_alloc (struct linux_binprm *bprm)
@@ -2219,7 +2224,12 @@ static inline int security_settime(struct timespec *ts, struct timezone *tz)
2219 2224
2220static inline int security_vm_enough_memory(long pages) 2225static inline int security_vm_enough_memory(long pages)
2221{ 2226{
2222 return cap_vm_enough_memory(pages); 2227 return cap_vm_enough_memory(current->mm, pages);
2228}
2229
2230static inline int security_vm_enough_memory_mm(struct mm_struct *mm, long pages)
2231{
2232 return cap_vm_enough_memory(mm, pages);
2223} 2233}
2224 2234
2225static inline int security_bprm_alloc (struct linux_binprm *bprm) 2235static inline int security_bprm_alloc (struct linux_binprm *bprm)
diff --git a/include/linux/selection.h b/include/linux/selection.h
index ed3408b400f1..f9457861937c 100644
--- a/include/linux/selection.h
+++ b/include/linux/selection.h
@@ -10,6 +10,8 @@
10#include <linux/tiocl.h> 10#include <linux/tiocl.h>
11#include <linux/vt_buffer.h> 11#include <linux/vt_buffer.h>
12 12
13struct tty_struct;
14
13extern struct vc_data *sel_cons; 15extern struct vc_data *sel_cons;
14 16
15extern void clear_selection(void); 17extern void clear_selection(void);
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index 83783ab0f552..8bf1e05115b4 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -46,6 +46,8 @@ int seq_path(struct seq_file *, struct vfsmount *, struct dentry *, char *);
46 46
47int single_open(struct file *, int (*)(struct seq_file *, void *), void *); 47int single_open(struct file *, int (*)(struct seq_file *, void *), void *);
48int single_release(struct inode *, struct file *); 48int single_release(struct inode *, struct file *);
49void *__seq_open_private(struct file *, const struct seq_operations *, int);
50int seq_open_private(struct file *, const struct seq_operations *, int);
49int seq_release_private(struct inode *, struct file *); 51int seq_release_private(struct inode *, struct file *);
50 52
51#define SEQ_START_TOKEN ((void *)1) 53#define SEQ_START_TOKEN ((void *)1)
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
index 706ee9a4c80c..afe0f6d9b9bc 100644
--- a/include/linux/serial_8250.h
+++ b/include/linux/serial_8250.h
@@ -20,7 +20,7 @@
20struct plat_serial8250_port { 20struct plat_serial8250_port {
21 unsigned long iobase; /* io base address */ 21 unsigned long iobase; /* io base address */
22 void __iomem *membase; /* ioremap cookie or NULL */ 22 void __iomem *membase; /* ioremap cookie or NULL */
23 unsigned long mapbase; /* resource base */ 23 resource_size_t mapbase; /* resource base */
24 unsigned int irq; /* interrupt number */ 24 unsigned int irq; /* interrupt number */
25 unsigned int uartclk; /* UART clock rate */ 25 unsigned int uartclk; /* UART clock rate */
26 unsigned char regshift; /* register shift */ 26 unsigned char regshift; /* register shift */
@@ -60,6 +60,8 @@ void serial8250_unregister_port(int line);
60void serial8250_suspend_port(int line); 60void serial8250_suspend_port(int line);
61void serial8250_resume_port(int line); 61void serial8250_resume_port(int line);
62 62
63extern int early_serial_setup(struct uart_port *port);
64
63extern int serial8250_find_port(struct uart_port *p); 65extern int serial8250_find_port(struct uart_port *p);
64extern int serial8250_find_port_for_earlycon(void); 66extern int serial8250_find_port_for_earlycon(void);
65extern int setup_early_serial8250_console(char *cmdline); 67extern int setup_early_serial8250_console(char *cmdline);
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 9c721cd2c9d6..09d17b06bf02 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -62,8 +62,9 @@
62/* NEC v850. */ 62/* NEC v850. */
63#define PORT_V850E_UART 40 63#define PORT_V850E_UART 40
64 64
65/* DZ */ 65/* DEC */
66#define PORT_DZ 47 66#define PORT_DZ 46
67#define PORT_ZS 47
67 68
68/* Parisc type numbers. */ 69/* Parisc type numbers. */
69#define PORT_MUX 48 70#define PORT_MUX 48
@@ -287,7 +288,7 @@ struct uart_port {
287 const struct uart_ops *ops; 288 const struct uart_ops *ops;
288 unsigned int custom_divisor; 289 unsigned int custom_divisor;
289 unsigned int line; /* port index */ 290 unsigned int line; /* port index */
290 unsigned long mapbase; /* for ioremap */ 291 resource_size_t mapbase; /* for ioremap */
291 struct device *dev; /* parent device */ 292 struct device *dev; /* parent device */
292 unsigned char hub6; /* this should be in the 8250 driver */ 293 unsigned char hub6; /* this should be in the 8250 driver */
293 unsigned char unused[3]; 294 unsigned char unused[3];
diff --git a/include/linux/serial_reg.h b/include/linux/serial_reg.h
index 1c5ed7d92b0f..96c0d93fc2ca 100644
--- a/include/linux/serial_reg.h
+++ b/include/linux/serial_reg.h
@@ -118,6 +118,7 @@
118#define UART_LSR_PE 0x04 /* Parity error indicator */ 118#define UART_LSR_PE 0x04 /* Parity error indicator */
119#define UART_LSR_OE 0x02 /* Overrun error indicator */ 119#define UART_LSR_OE 0x02 /* Overrun error indicator */
120#define UART_LSR_DR 0x01 /* Receiver data ready */ 120#define UART_LSR_DR 0x01 /* Receiver data ready */
121#define UART_LSR_BRK_ERROR_BITS 0x1E /* BI, FE, PE, OE bits */
121 122
122#define UART_MSR 6 /* In: Modem Status Register */ 123#define UART_MSR 6 /* In: Modem Status Register */
123#define UART_MSR_DCD 0x80 /* Data Carrier Detect */ 124#define UART_MSR_DCD 0x80 /* Data Carrier Detect */
diff --git a/include/linux/signal.h b/include/linux/signal.h
index ea91abe740da..0ae338866240 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -237,12 +237,15 @@ extern int group_send_sig_info(int sig, struct siginfo *info, struct task_struct
237extern int __group_send_sig_info(int, struct siginfo *, struct task_struct *); 237extern int __group_send_sig_info(int, struct siginfo *, struct task_struct *);
238extern long do_sigpending(void __user *, unsigned long); 238extern long do_sigpending(void __user *, unsigned long);
239extern int sigprocmask(int, sigset_t *, sigset_t *); 239extern int sigprocmask(int, sigset_t *, sigset_t *);
240extern int show_unhandled_signals;
240 241
241struct pt_regs; 242struct pt_regs;
242extern int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, struct pt_regs *regs, void *cookie); 243extern int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, struct pt_regs *regs, void *cookie);
243 244
244extern struct kmem_cache *sighand_cachep; 245extern struct kmem_cache *sighand_cachep;
245 246
247int unhandled_signal(struct task_struct *tsk, int sig);
248
246/* 249/*
247 * In POSIX a signal is sent either to a specific thread (Linux task) 250 * In POSIX a signal is sent either to a specific thread (Linux task)
248 * or to the process as a whole (Linux thread group). How the signal 251 * or to the process as a whole (Linux thread group). How the signal
diff --git a/include/linux/signalfd.h b/include/linux/signalfd.h
index 510429495690..4c9ff0910ae0 100644
--- a/include/linux/signalfd.h
+++ b/include/linux/signalfd.h
@@ -45,49 +45,17 @@ struct signalfd_siginfo {
45#ifdef CONFIG_SIGNALFD 45#ifdef CONFIG_SIGNALFD
46 46
47/* 47/*
48 * Deliver the signal to listening signalfd. This must be called 48 * Deliver the signal to listening signalfd.
49 * with the sighand lock held. Same are the following that end up
50 * calling signalfd_deliver().
51 */
52void signalfd_deliver(struct task_struct *tsk, int sig);
53
54/*
55 * No need to fall inside signalfd_deliver() if no signal listeners
56 * are available.
57 */ 49 */
58static inline void signalfd_notify(struct task_struct *tsk, int sig) 50static inline void signalfd_notify(struct task_struct *tsk, int sig)
59{ 51{
60 if (unlikely(!list_empty(&tsk->sighand->signalfd_list))) 52 if (unlikely(waitqueue_active(&tsk->sighand->signalfd_wqh)))
61 signalfd_deliver(tsk, sig); 53 wake_up(&tsk->sighand->signalfd_wqh);
62}
63
64/*
65 * The signal -1 is used to notify the signalfd that the sighand
66 * is on its way to be detached.
67 */
68static inline void signalfd_detach_locked(struct task_struct *tsk)
69{
70 if (unlikely(!list_empty(&tsk->sighand->signalfd_list)))
71 signalfd_deliver(tsk, -1);
72}
73
74static inline void signalfd_detach(struct task_struct *tsk)
75{
76 struct sighand_struct *sighand = tsk->sighand;
77
78 if (unlikely(!list_empty(&sighand->signalfd_list))) {
79 spin_lock_irq(&sighand->siglock);
80 signalfd_deliver(tsk, -1);
81 spin_unlock_irq(&sighand->siglock);
82 }
83} 54}
84 55
85#else /* CONFIG_SIGNALFD */ 56#else /* CONFIG_SIGNALFD */
86 57
87#define signalfd_deliver(t, s) do { } while (0) 58static inline void signalfd_notify(struct task_struct *tsk, int sig) { }
88#define signalfd_notify(t, s) do { } while (0)
89#define signalfd_detach_locked(t) do { } while (0)
90#define signalfd_detach(t) do { } while (0)
91 59
92#endif /* CONFIG_SIGNALFD */ 60#endif /* CONFIG_SIGNALFD */
93 61
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index ce256438e619..a656cecd373c 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -134,8 +134,8 @@ typedef struct skb_frag_struct skb_frag_t;
134 134
135struct skb_frag_struct { 135struct skb_frag_struct {
136 struct page *page; 136 struct page *page;
137 __u16 page_offset; 137 __u32 page_offset;
138 __u16 size; 138 __u32 size;
139}; 139};
140 140
141/* This data is invariant across clones and lives at 141/* This data is invariant across clones and lives at
@@ -1352,6 +1352,22 @@ static inline int skb_clone_writable(struct sk_buff *skb, int len)
1352 skb_headroom(skb) + len <= skb->hdr_len; 1352 skb_headroom(skb) + len <= skb->hdr_len;
1353} 1353}
1354 1354
1355static inline int __skb_cow(struct sk_buff *skb, unsigned int headroom,
1356 int cloned)
1357{
1358 int delta = 0;
1359
1360 if (headroom < NET_SKB_PAD)
1361 headroom = NET_SKB_PAD;
1362 if (headroom > skb_headroom(skb))
1363 delta = headroom - skb_headroom(skb);
1364
1365 if (delta || cloned)
1366 return pskb_expand_head(skb, ALIGN(delta, NET_SKB_PAD), 0,
1367 GFP_ATOMIC);
1368 return 0;
1369}
1370
1355/** 1371/**
1356 * skb_cow - copy header of skb when it is required 1372 * skb_cow - copy header of skb when it is required
1357 * @skb: buffer to cow 1373 * @skb: buffer to cow
@@ -1366,16 +1382,22 @@ static inline int skb_clone_writable(struct sk_buff *skb, int len)
1366 */ 1382 */
1367static inline int skb_cow(struct sk_buff *skb, unsigned int headroom) 1383static inline int skb_cow(struct sk_buff *skb, unsigned int headroom)
1368{ 1384{
1369 int delta = (headroom > NET_SKB_PAD ? headroom : NET_SKB_PAD) - 1385 return __skb_cow(skb, headroom, skb_cloned(skb));
1370 skb_headroom(skb); 1386}
1371
1372 if (delta < 0)
1373 delta = 0;
1374 1387
1375 if (delta || skb_cloned(skb)) 1388/**
1376 return pskb_expand_head(skb, (delta + (NET_SKB_PAD-1)) & 1389 * skb_cow_head - skb_cow but only making the head writable
1377 ~(NET_SKB_PAD-1), 0, GFP_ATOMIC); 1390 * @skb: buffer to cow
1378 return 0; 1391 * @headroom: needed headroom
1392 *
1393 * This function is identical to skb_cow except that we replace the
1394 * skb_cloned check by skb_header_cloned. It should be used when
1395 * you only need to push on some header and do not need to modify
1396 * the data.
1397 */
1398static inline int skb_cow_head(struct sk_buff *skb, unsigned int headroom)
1399{
1400 return __skb_cow(skb, headroom, skb_header_cloned(skb));
1379} 1401}
1380 1402
1381/** 1403/**
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 0e1d0daef6a2..d859354b9e51 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -40,7 +40,7 @@
40 */ 40 */
41#define ZERO_SIZE_PTR ((void *)16) 41#define ZERO_SIZE_PTR ((void *)16)
42 42
43#define ZERO_OR_NULL_PTR(x) ((unsigned long)(x) < \ 43#define ZERO_OR_NULL_PTR(x) ((unsigned long)(x) <= \
44 (unsigned long)ZERO_SIZE_PTR) 44 (unsigned long)ZERO_SIZE_PTR)
45 45
46/* 46/*
@@ -51,7 +51,6 @@ int slab_is_available(void);
51 51
52struct kmem_cache *kmem_cache_create(const char *, size_t, size_t, 52struct kmem_cache *kmem_cache_create(const char *, size_t, size_t,
53 unsigned long, 53 unsigned long,
54 void (*)(void *, struct kmem_cache *, unsigned long),
55 void (*)(void *, struct kmem_cache *, unsigned long)); 54 void (*)(void *, struct kmem_cache *, unsigned long));
56void kmem_cache_destroy(struct kmem_cache *); 55void kmem_cache_destroy(struct kmem_cache *);
57int kmem_cache_shrink(struct kmem_cache *); 56int kmem_cache_shrink(struct kmem_cache *);
@@ -70,7 +69,7 @@ int kmem_ptr_validate(struct kmem_cache *cachep, const void *ptr);
70 */ 69 */
71#define KMEM_CACHE(__struct, __flags) kmem_cache_create(#__struct,\ 70#define KMEM_CACHE(__struct, __flags) kmem_cache_create(#__struct,\
72 sizeof(struct __struct), __alignof__(struct __struct),\ 71 sizeof(struct __struct), __alignof__(struct __struct),\
73 (__flags), NULL, NULL) 72 (__flags), NULL)
74 73
75/* 74/*
76 * The largest kmalloc size supported by the slab allocators is 75 * The largest kmalloc size supported by the slab allocators is
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index 07f7e4cbcee3..74962077f632 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -78,7 +78,7 @@ extern struct kmem_cache kmalloc_caches[KMALLOC_SHIFT_HIGH + 1];
78 * Sorry that the following has to be that ugly but some versions of GCC 78 * Sorry that the following has to be that ugly but some versions of GCC
79 * have trouble with constant propagation and loops. 79 * have trouble with constant propagation and loops.
80 */ 80 */
81static inline int kmalloc_index(size_t size) 81static __always_inline int kmalloc_index(size_t size)
82{ 82{
83 if (!size) 83 if (!size)
84 return 0; 84 return 0;
@@ -133,7 +133,7 @@ static inline int kmalloc_index(size_t size)
133 * This ought to end up with a global pointer to the right cache 133 * This ought to end up with a global pointer to the right cache
134 * in kmalloc_caches. 134 * in kmalloc_caches.
135 */ 135 */
136static inline struct kmem_cache *kmalloc_slab(size_t size) 136static __always_inline struct kmem_cache *kmalloc_slab(size_t size)
137{ 137{
138 int index = kmalloc_index(size); 138 int index = kmalloc_index(size);
139 139
@@ -160,13 +160,13 @@ static inline struct kmem_cache *kmalloc_slab(size_t size)
160#define SLUB_DMA __GFP_DMA 160#define SLUB_DMA __GFP_DMA
161#else 161#else
162/* Disable DMA functionality */ 162/* Disable DMA functionality */
163#define SLUB_DMA 0 163#define SLUB_DMA (__force gfp_t)0
164#endif 164#endif
165 165
166void *kmem_cache_alloc(struct kmem_cache *, gfp_t); 166void *kmem_cache_alloc(struct kmem_cache *, gfp_t);
167void *__kmalloc(size_t size, gfp_t flags); 167void *__kmalloc(size_t size, gfp_t flags);
168 168
169static inline void *kmalloc(size_t size, gfp_t flags) 169static __always_inline void *kmalloc(size_t size, gfp_t flags)
170{ 170{
171 if (__builtin_constant_p(size) && !(flags & SLUB_DMA)) { 171 if (__builtin_constant_p(size) && !(flags & SLUB_DMA)) {
172 struct kmem_cache *s = kmalloc_slab(size); 172 struct kmem_cache *s = kmalloc_slab(size);
@@ -183,7 +183,7 @@ static inline void *kmalloc(size_t size, gfp_t flags)
183void *__kmalloc_node(size_t size, gfp_t flags, int node); 183void *__kmalloc_node(size_t size, gfp_t flags, int node);
184void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node); 184void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node);
185 185
186static inline void *kmalloc_node(size_t size, gfp_t flags, int node) 186static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
187{ 187{
188 if (__builtin_constant_p(size) && !(flags & SLUB_DMA)) { 188 if (__builtin_constant_p(size) && !(flags & SLUB_DMA)) {
189 struct kmem_cache *s = kmalloc_slab(size); 189 struct kmem_cache *s = kmalloc_slab(size);
diff --git a/include/linux/snmp.h b/include/linux/snmp.h
index 802b3a38b041..89f0c2b5f405 100644
--- a/include/linux/snmp.h
+++ b/include/linux/snmp.h
@@ -82,6 +82,8 @@ enum
82 __ICMP_MIB_MAX 82 __ICMP_MIB_MAX
83}; 83};
84 84
85#define __ICMPMSG_MIB_MAX 512 /* Out+In for all 8-bit ICMP types */
86
85/* icmp6 mib definitions */ 87/* icmp6 mib definitions */
86/* 88/*
87 * RFC 2466: ICMPv6-MIB 89 * RFC 2466: ICMPv6-MIB
@@ -91,35 +93,12 @@ enum
91 ICMP6_MIB_NUM = 0, 93 ICMP6_MIB_NUM = 0,
92 ICMP6_MIB_INMSGS, /* InMsgs */ 94 ICMP6_MIB_INMSGS, /* InMsgs */
93 ICMP6_MIB_INERRORS, /* InErrors */ 95 ICMP6_MIB_INERRORS, /* InErrors */
94 ICMP6_MIB_INDESTUNREACHS, /* InDestUnreachs */
95 ICMP6_MIB_INPKTTOOBIGS, /* InPktTooBigs */
96 ICMP6_MIB_INTIMEEXCDS, /* InTimeExcds */
97 ICMP6_MIB_INPARMPROBLEMS, /* InParmProblems */
98 ICMP6_MIB_INECHOS, /* InEchos */
99 ICMP6_MIB_INECHOREPLIES, /* InEchoReplies */
100 ICMP6_MIB_INGROUPMEMBQUERIES, /* InGroupMembQueries */
101 ICMP6_MIB_INGROUPMEMBRESPONSES, /* InGroupMembResponses */
102 ICMP6_MIB_INGROUPMEMBREDUCTIONS, /* InGroupMembReductions */
103 ICMP6_MIB_INROUTERSOLICITS, /* InRouterSolicits */
104 ICMP6_MIB_INROUTERADVERTISEMENTS, /* InRouterAdvertisements */
105 ICMP6_MIB_INNEIGHBORSOLICITS, /* InNeighborSolicits */
106 ICMP6_MIB_INNEIGHBORADVERTISEMENTS, /* InNeighborAdvertisements */
107 ICMP6_MIB_INREDIRECTS, /* InRedirects */
108 ICMP6_MIB_OUTMSGS, /* OutMsgs */ 96 ICMP6_MIB_OUTMSGS, /* OutMsgs */
109 ICMP6_MIB_OUTDESTUNREACHS, /* OutDestUnreachs */
110 ICMP6_MIB_OUTPKTTOOBIGS, /* OutPktTooBigs */
111 ICMP6_MIB_OUTTIMEEXCDS, /* OutTimeExcds */
112 ICMP6_MIB_OUTPARMPROBLEMS, /* OutParmProblems */
113 ICMP6_MIB_OUTECHOREPLIES, /* OutEchoReplies */
114 ICMP6_MIB_OUTROUTERSOLICITS, /* OutRouterSolicits */
115 ICMP6_MIB_OUTNEIGHBORSOLICITS, /* OutNeighborSolicits */
116 ICMP6_MIB_OUTNEIGHBORADVERTISEMENTS, /* OutNeighborAdvertisements */
117 ICMP6_MIB_OUTREDIRECTS, /* OutRedirects */
118 ICMP6_MIB_OUTGROUPMEMBRESPONSES, /* OutGroupMembResponses */
119 ICMP6_MIB_OUTGROUPMEMBREDUCTIONS, /* OutGroupMembReductions */
120 __ICMP6_MIB_MAX 97 __ICMP6_MIB_MAX
121}; 98};
122 99
100#define __ICMP6MSG_MIB_MAX 512 /* Out+In for all 8-bit ICMPv6 types */
101
123/* tcp mib definitions */ 102/* tcp mib definitions */
124/* 103/*
125 * RFC 1213: MIB-II TCP group 104 * RFC 1213: MIB-II TCP group
@@ -231,6 +210,10 @@ enum
231 LINUX_MIB_TCPABORTONLINGER, /* TCPAbortOnLinger */ 210 LINUX_MIB_TCPABORTONLINGER, /* TCPAbortOnLinger */
232 LINUX_MIB_TCPABORTFAILED, /* TCPAbortFailed */ 211 LINUX_MIB_TCPABORTFAILED, /* TCPAbortFailed */
233 LINUX_MIB_TCPMEMORYPRESSURES, /* TCPMemoryPressures */ 212 LINUX_MIB_TCPMEMORYPRESSURES, /* TCPMemoryPressures */
213 LINUX_MIB_TCPSACKDISCARD, /* TCPSACKDiscard */
214 LINUX_MIB_TCPDSACKIGNOREDOLD, /* TCPSACKIgnoredOld */
215 LINUX_MIB_TCPDSACKIGNOREDNOUNDO, /* TCPSACKIgnoredNoUndo */
216 LINUX_MIB_TCPSPURIOUSRTOS, /* TCPSpuriousRTOs */
234 __LINUX_MIB_MAX 217 __LINUX_MIB_MAX
235}; 218};
236 219
diff --git a/include/linux/spi/mmc_spi.h b/include/linux/spi/mmc_spi.h
new file mode 100644
index 000000000000..e9bbe3ebd721
--- /dev/null
+++ b/include/linux/spi/mmc_spi.h
@@ -0,0 +1,33 @@
1#ifndef __LINUX_SPI_MMC_SPI_H
2#define __LINUX_SPI_MMC_SPI_H
3
4struct device;
5struct mmc_host;
6
7/* Put this in platform_data of a device being used to manage an MMC/SD
8 * card slot. (Modeled after PXA mmc glue; see that for usage examples.)
9 *
10 * REVISIT This is not a spi-specific notion. Any card slot should be
11 * able to handle it. If the MMC core doesn't adopt this kind of notion,
12 * switch the "struct device *" parameters over to "struct spi_device *".
13 */
14struct mmc_spi_platform_data {
15 /* driver activation and (optional) card detect irq hookup */
16 int (*init)(struct device *,
17 irqreturn_t (*)(int, void *),
18 void *);
19 void (*exit)(struct device *, void *);
20
21 /* sense switch on sd cards */
22 int (*get_ro)(struct device *);
23
24 /* how long to debounce card detect, in msecs */
25 u16 detect_delay;
26
27 /* power management */
28 u16 powerup_msecs; /* delay of up to 250 msec */
29 u32 ocr_mask; /* available voltages */
30 void (*setpower)(struct device *, unsigned int maskval);
31};
32
33#endif /* __LINUX_SPI_MMC_SPI_H */
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 302b81d1d117..002a3cddbdd5 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -77,6 +77,7 @@ struct spi_device {
77#define SPI_CS_HIGH 0x04 /* chipselect active high? */ 77#define SPI_CS_HIGH 0x04 /* chipselect active high? */
78#define SPI_LSB_FIRST 0x08 /* per-word bits-on-wire */ 78#define SPI_LSB_FIRST 0x08 /* per-word bits-on-wire */
79#define SPI_3WIRE 0x10 /* SI/SO signals shared */ 79#define SPI_3WIRE 0x10 /* SI/SO signals shared */
80#define SPI_LOOP 0x20 /* loopback mode */
80 u8 bits_per_word; 81 u8 bits_per_word;
81 int irq; 82 int irq;
82 void *controller_state; 83 void *controller_state;
@@ -138,6 +139,32 @@ struct spi_message;
138 139
139 140
140 141
142/**
143 * struct spi_driver - Host side "protocol" driver
144 * @probe: Binds this driver to the spi device. Drivers can verify
145 * that the device is actually present, and may need to configure
146 * characteristics (such as bits_per_word) which weren't needed for
147 * the initial configuration done during system setup.
148 * @remove: Unbinds this driver from the spi device
149 * @shutdown: Standard shutdown callback used during system state
150 * transitions such as powerdown/halt and kexec
151 * @suspend: Standard suspend callback used during system state transitions
152 * @resume: Standard resume callback used during system state transitions
153 * @driver: SPI device drivers should initialize the name and owner
154 * field of this structure.
155 *
156 * This represents the kind of device driver that uses SPI messages to
157 * interact with the hardware at the other end of a SPI link. It's called
158 * a "protocol" driver because it works through messages rather than talking
159 * directly to SPI hardware (which is what the underlying SPI controller
160 * driver does to pass those messages). These protocols are defined in the
161 * specification for the device(s) supported by the driver.
162 *
163 * As a rule, those device protocols represent the lowest level interface
164 * supported by a driver, and it will support upper level interfaces too.
165 * Examples of such upper levels include frameworks like MTD, networking,
166 * MMC, RTC, filesystem character device nodes, and hardware monitoring.
167 */
141struct spi_driver { 168struct spi_driver {
142 int (*probe)(struct spi_device *spi); 169 int (*probe)(struct spi_device *spi);
143 int (*remove)(struct spi_device *spi); 170 int (*remove)(struct spi_device *spi);
@@ -667,7 +694,37 @@ static inline ssize_t spi_w8r16(struct spi_device *spi, u8 cmd)
667 * parport adapters, or microcontrollers acting as USB-to-SPI bridges. 694 * parport adapters, or microcontrollers acting as USB-to-SPI bridges.
668 */ 695 */
669 696
670/* board-specific information about each SPI device */ 697/**
698 * struct spi_board_info - board-specific template for a SPI device
699 * @modalias: Initializes spi_device.modalias; identifies the driver.
700 * @platform_data: Initializes spi_device.platform_data; the particular
701 * data stored there is driver-specific.
702 * @controller_data: Initializes spi_device.controller_data; some
703 * controllers need hints about hardware setup, e.g. for DMA.
704 * @irq: Initializes spi_device.irq; depends on how the board is wired.
705 * @max_speed_hz: Initializes spi_device.max_speed_hz; based on limits
706 * from the chip datasheet and board-specific signal quality issues.
707 * @bus_num: Identifies which spi_master parents the spi_device; unused
708 * by spi_new_device(), and otherwise depends on board wiring.
709 * @chip_select: Initializes spi_device.chip_select; depends on how
710 * the board is wired.
711 * @mode: Initializes spi_device.mode; based on the chip datasheet, board
712 * wiring (some devices support both 3WIRE and standard modes), and
713 * possibly presence of an inverter in the chipselect path.
714 *
715 * When adding new SPI devices to the device tree, these structures serve
716 * as a partial device template. They hold information which can't always
717 * be determined by drivers. Information that probe() can establish (such
718 * as the default transfer wordsize) is not included here.
719 *
720 * These structures are used in two places. Their primary role is to
721 * be stored in tables of board-specific device descriptors, which are
722 * declared early in board initialization and then used (much later) to
723 * populate a controller's device tree after the that controller's driver
724 * initializes. A secondary (and atypical) role is as a parameter to
725 * spi_new_device() call, which happens after those controller drivers
726 * are active in some dynamic board configuration models.
727 */
671struct spi_board_info { 728struct spi_board_info {
672 /* the device name and module name are coupled, like platform_bus; 729 /* the device name and module name are coupled, like platform_bus;
673 * "modalias" is normally the driver name. 730 * "modalias" is normally the driver name.
diff --git a/include/linux/spi/spidev.h b/include/linux/spi/spidev.h
index 7d700be57490..c93ef9d42a01 100644
--- a/include/linux/spi/spidev.h
+++ b/include/linux/spi/spidev.h
@@ -35,6 +35,10 @@
35#define SPI_MODE_2 (SPI_CPOL|0) 35#define SPI_MODE_2 (SPI_CPOL|0)
36#define SPI_MODE_3 (SPI_CPOL|SPI_CPHA) 36#define SPI_MODE_3 (SPI_CPOL|SPI_CPHA)
37 37
38#define SPI_CS_HIGH 0x04
39#define SPI_LSB_FIRST 0x08
40#define SPI_3WIRE 0x10
41#define SPI_LOOP 0x20
38 42
39/*---------------------------------------------------------------------------*/ 43/*---------------------------------------------------------------------------*/
40 44
diff --git a/include/linux/spinlock_types.h b/include/linux/spinlock_types.h
index 210549ba4ef4..f6a3a951b79e 100644
--- a/include/linux/spinlock_types.h
+++ b/include/linux/spinlock_types.h
@@ -9,14 +9,14 @@
9 * Released under the General Public License (GPL). 9 * Released under the General Public License (GPL).
10 */ 10 */
11 11
12#include <linux/lockdep.h>
13
14#if defined(CONFIG_SMP) 12#if defined(CONFIG_SMP)
15# include <asm/spinlock_types.h> 13# include <asm/spinlock_types.h>
16#else 14#else
17# include <linux/spinlock_types_up.h> 15# include <linux/spinlock_types_up.h>
18#endif 16#endif
19 17
18#include <linux/lockdep.h>
19
20typedef struct { 20typedef struct {
21 raw_spinlock_t raw_lock; 21 raw_spinlock_t raw_lock;
22#if defined(CONFIG_PREEMPT) && defined(CONFIG_SMP) 22#if defined(CONFIG_PREEMPT) && defined(CONFIG_SMP)
diff --git a/include/linux/spinlock_types_up.h b/include/linux/spinlock_types_up.h
index 27644af20b7c..04135b0e198e 100644
--- a/include/linux/spinlock_types_up.h
+++ b/include/linux/spinlock_types_up.h
@@ -12,14 +12,10 @@
12 * Released under the General Public License (GPL). 12 * Released under the General Public License (GPL).
13 */ 13 */
14 14
15#if defined(CONFIG_DEBUG_SPINLOCK) || \ 15#ifdef CONFIG_DEBUG_SPINLOCK
16 defined(CONFIG_DEBUG_LOCK_ALLOC)
17 16
18typedef struct { 17typedef struct {
19 volatile unsigned int slock; 18 volatile unsigned int slock;
20#ifdef CONFIG_DEBUG_LOCK_ALLOC
21 struct lockdep_map dep_map;
22#endif
23} raw_spinlock_t; 19} raw_spinlock_t;
24 20
25#define __RAW_SPIN_LOCK_UNLOCKED { 1 } 21#define __RAW_SPIN_LOCK_UNLOCKED { 1 }
@@ -34,9 +30,6 @@ typedef struct { } raw_spinlock_t;
34 30
35typedef struct { 31typedef struct {
36 /* no debug version on UP */ 32 /* no debug version on UP */
37#ifdef CONFIG_DEBUG_LOCK_ALLOC
38 struct lockdep_map dep_map;
39#endif
40} raw_rwlock_t; 33} raw_rwlock_t;
41 34
42#define __RAW_RW_LOCK_UNLOCKED { } 35#define __RAW_RW_LOCK_UNLOCKED { }
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h
new file mode 100644
index 000000000000..2b5c312c4960
--- /dev/null
+++ b/include/linux/ssb/ssb.h
@@ -0,0 +1,424 @@
1#ifndef LINUX_SSB_H_
2#define LINUX_SSB_H_
3
4#include <linux/device.h>
5#include <linux/list.h>
6#include <linux/types.h>
7#include <linux/spinlock.h>
8#include <linux/pci.h>
9#include <linux/mod_devicetable.h>
10
11#include <linux/ssb/ssb_regs.h>
12
13
14struct pcmcia_device;
15struct ssb_bus;
16struct ssb_driver;
17
18
19struct ssb_sprom_r1 {
20 u16 pci_spid; /* Subsystem Product ID for PCI */
21 u16 pci_svid; /* Subsystem Vendor ID for PCI */
22 u16 pci_pid; /* Product ID for PCI */
23 u8 il0mac[6]; /* MAC address for 802.11b/g */
24 u8 et0mac[6]; /* MAC address for Ethernet */
25 u8 et1mac[6]; /* MAC address for 802.11a */
26 u8 et0phyaddr:5; /* MII address for enet0 */
27 u8 et1phyaddr:5; /* MII address for enet1 */
28 u8 et0mdcport:1; /* MDIO for enet0 */
29 u8 et1mdcport:1; /* MDIO for enet1 */
30 u8 board_rev; /* Board revision */
31 u8 country_code:4; /* Country Code */
32 u8 antenna_a:2; /* Antenna 0/1 available for A-PHY */
33 u8 antenna_bg:2; /* Antenna 0/1 available for B-PHY and G-PHY */
34 u16 pa0b0;
35 u16 pa0b1;
36 u16 pa0b2;
37 u16 pa1b0;
38 u16 pa1b1;
39 u16 pa1b2;
40 u8 gpio0; /* GPIO pin 0 */
41 u8 gpio1; /* GPIO pin 1 */
42 u8 gpio2; /* GPIO pin 2 */
43 u8 gpio3; /* GPIO pin 3 */
44 u16 maxpwr_a; /* A-PHY Power Amplifier Max Power (in dBm Q5.2) */
45 u16 maxpwr_bg; /* B/G-PHY Power Amplifier Max Power (in dBm Q5.2) */
46 u8 itssi_a; /* Idle TSSI Target for A-PHY */
47 u8 itssi_bg; /* Idle TSSI Target for B/G-PHY */
48 u16 boardflags_lo; /* Boardflags (low 16 bits) */
49 u8 antenna_gain_a; /* A-PHY Antenna gain (in dBm Q5.2) */
50 u8 antenna_gain_bg; /* B/G-PHY Antenna gain (in dBm Q5.2) */
51 u8 oem[8]; /* OEM string (rev 1 only) */
52};
53
54struct ssb_sprom_r2 {
55 u16 boardflags_hi; /* Boardflags (high 16 bits) */
56 u8 maxpwr_a_lo; /* A-PHY Max Power Low */
57 u8 maxpwr_a_hi; /* A-PHY Max Power High */
58 u16 pa1lob0; /* A-PHY PA Low Settings */
59 u16 pa1lob1; /* A-PHY PA Low Settings */
60 u16 pa1lob2; /* A-PHY PA Low Settings */
61 u16 pa1hib0; /* A-PHY PA High Settings */
62 u16 pa1hib1; /* A-PHY PA High Settings */
63 u16 pa1hib2; /* A-PHY PA High Settings */
64 u8 ofdm_pwr_off; /* OFDM Power Offset from CCK Level */
65 u8 country_str[2]; /* Two char Country Code */
66};
67
68struct ssb_sprom_r3 {
69 u32 ofdmapo; /* A-PHY OFDM Mid Power Offset */
70 u32 ofdmalpo; /* A-PHY OFDM Low Power Offset */
71 u32 ofdmahpo; /* A-PHY OFDM High Power Offset */
72 u8 gpioldc_on_cnt; /* GPIO LED Powersave Duty Cycle ON count */
73 u8 gpioldc_off_cnt; /* GPIO LED Powersave Duty Cycle OFF count */
74 u8 cckpo_1M:4; /* CCK Power Offset for Rate 1M */
75 u8 cckpo_2M:4; /* CCK Power Offset for Rate 2M */
76 u8 cckpo_55M:4; /* CCK Power Offset for Rate 5.5M */
77 u8 cckpo_11M:4; /* CCK Power Offset for Rate 11M */
78 u32 ofdmgpo; /* G-PHY OFDM Power Offset */
79};
80
81struct ssb_sprom_r4 {
82 /* TODO */
83};
84
85struct ssb_sprom {
86 u8 revision;
87 u8 crc;
88 /* The valid r# fields are selected by the "revision".
89 * Revision 3 and lower inherit from lower revisions.
90 */
91 union {
92 struct {
93 struct ssb_sprom_r1 r1;
94 struct ssb_sprom_r2 r2;
95 struct ssb_sprom_r3 r3;
96 };
97 struct ssb_sprom_r4 r4;
98 };
99};
100
101/* Information about the PCB the circuitry is soldered on. */
102struct ssb_boardinfo {
103 u16 vendor;
104 u16 type;
105 u16 rev;
106};
107
108
109struct ssb_device;
110/* Lowlevel read/write operations on the device MMIO.
111 * Internal, don't use that outside of ssb. */
112struct ssb_bus_ops {
113 u16 (*read16)(struct ssb_device *dev, u16 offset);
114 u32 (*read32)(struct ssb_device *dev, u16 offset);
115 void (*write16)(struct ssb_device *dev, u16 offset, u16 value);
116 void (*write32)(struct ssb_device *dev, u16 offset, u32 value);
117};
118
119
120/* Core-ID values. */
121#define SSB_DEV_CHIPCOMMON 0x800
122#define SSB_DEV_ILINE20 0x801
123#define SSB_DEV_SDRAM 0x803
124#define SSB_DEV_PCI 0x804
125#define SSB_DEV_MIPS 0x805
126#define SSB_DEV_ETHERNET 0x806
127#define SSB_DEV_V90 0x807
128#define SSB_DEV_USB11_HOSTDEV 0x808
129#define SSB_DEV_ADSL 0x809
130#define SSB_DEV_ILINE100 0x80A
131#define SSB_DEV_IPSEC 0x80B
132#define SSB_DEV_PCMCIA 0x80D
133#define SSB_DEV_INTERNAL_MEM 0x80E
134#define SSB_DEV_MEMC_SDRAM 0x80F
135#define SSB_DEV_EXTIF 0x811
136#define SSB_DEV_80211 0x812
137#define SSB_DEV_MIPS_3302 0x816
138#define SSB_DEV_USB11_HOST 0x817
139#define SSB_DEV_USB11_DEV 0x818
140#define SSB_DEV_USB20_HOST 0x819
141#define SSB_DEV_USB20_DEV 0x81A
142#define SSB_DEV_SDIO_HOST 0x81B
143#define SSB_DEV_ROBOSWITCH 0x81C
144#define SSB_DEV_PARA_ATA 0x81D
145#define SSB_DEV_SATA_XORDMA 0x81E
146#define SSB_DEV_ETHERNET_GBIT 0x81F
147#define SSB_DEV_PCIE 0x820
148#define SSB_DEV_MIMO_PHY 0x821
149#define SSB_DEV_SRAM_CTRLR 0x822
150#define SSB_DEV_MINI_MACPHY 0x823
151#define SSB_DEV_ARM_1176 0x824
152#define SSB_DEV_ARM_7TDMI 0x825
153
154/* Vendor-ID values */
155#define SSB_VENDOR_BROADCOM 0x4243
156
157/* Some kernel subsystems poke with dev->drvdata, so we must use the
158 * following ugly workaround to get from struct device to struct ssb_device */
159struct __ssb_dev_wrapper {
160 struct device dev;
161 struct ssb_device *sdev;
162};
163
164struct ssb_device {
165 /* Having a copy of the ops pointer in each dev struct
166 * is an optimization. */
167 const struct ssb_bus_ops *ops;
168
169 struct device *dev;
170 struct ssb_bus *bus;
171 struct ssb_device_id id;
172
173 u8 core_index;
174 unsigned int irq;
175
176 /* Internal-only stuff follows. */
177 void *drvdata; /* Per-device data */
178 void *devtypedata; /* Per-devicetype (eg 802.11) data */
179};
180
181/* Go from struct device to struct ssb_device. */
182static inline
183struct ssb_device * dev_to_ssb_dev(struct device *dev)
184{
185 struct __ssb_dev_wrapper *wrap;
186 wrap = container_of(dev, struct __ssb_dev_wrapper, dev);
187 return wrap->sdev;
188}
189
190/* Device specific user data */
191static inline
192void ssb_set_drvdata(struct ssb_device *dev, void *data)
193{
194 dev->drvdata = data;
195}
196static inline
197void * ssb_get_drvdata(struct ssb_device *dev)
198{
199 return dev->drvdata;
200}
201
202/* Devicetype specific user data. This is per device-type (not per device) */
203void ssb_set_devtypedata(struct ssb_device *dev, void *data);
204static inline
205void * ssb_get_devtypedata(struct ssb_device *dev)
206{
207 return dev->devtypedata;
208}
209
210
211struct ssb_driver {
212 const char *name;
213 const struct ssb_device_id *id_table;
214
215 int (*probe)(struct ssb_device *dev, const struct ssb_device_id *id);
216 void (*remove)(struct ssb_device *dev);
217 int (*suspend)(struct ssb_device *dev, pm_message_t state);
218 int (*resume)(struct ssb_device *dev);
219 void (*shutdown)(struct ssb_device *dev);
220
221 struct device_driver drv;
222};
223#define drv_to_ssb_drv(_drv) container_of(_drv, struct ssb_driver, drv)
224
225extern int __ssb_driver_register(struct ssb_driver *drv, struct module *owner);
226static inline int ssb_driver_register(struct ssb_driver *drv)
227{
228 return __ssb_driver_register(drv, THIS_MODULE);
229}
230extern void ssb_driver_unregister(struct ssb_driver *drv);
231
232
233
234
235enum ssb_bustype {
236 SSB_BUSTYPE_SSB, /* This SSB bus is the system bus */
237 SSB_BUSTYPE_PCI, /* SSB is connected to PCI bus */
238 SSB_BUSTYPE_PCMCIA, /* SSB is connected to PCMCIA bus */
239};
240
241/* board_vendor */
242#define SSB_BOARDVENDOR_BCM 0x14E4 /* Broadcom */
243#define SSB_BOARDVENDOR_DELL 0x1028 /* Dell */
244#define SSB_BOARDVENDOR_HP 0x0E11 /* HP */
245/* board_type */
246#define SSB_BOARD_BCM94306MP 0x0418
247#define SSB_BOARD_BCM4309G 0x0421
248#define SSB_BOARD_BCM4306CB 0x0417
249#define SSB_BOARD_BCM4309MP 0x040C
250#define SSB_BOARD_MP4318 0x044A
251#define SSB_BOARD_BU4306 0x0416
252#define SSB_BOARD_BU4309 0x040A
253/* chip_package */
254#define SSB_CHIPPACK_BCM4712S 1 /* Small 200pin 4712 */
255#define SSB_CHIPPACK_BCM4712M 2 /* Medium 225pin 4712 */
256#define SSB_CHIPPACK_BCM4712L 0 /* Large 340pin 4712 */
257
258#include <linux/ssb/ssb_driver_chipcommon.h>
259#include <linux/ssb/ssb_driver_mips.h>
260#include <linux/ssb/ssb_driver_extif.h>
261#include <linux/ssb/ssb_driver_pci.h>
262
263struct ssb_bus {
264 /* The MMIO area. */
265 void __iomem *mmio;
266
267 const struct ssb_bus_ops *ops;
268
269 /* The core in the basic address register window. (PCI bus only) */
270 struct ssb_device *mapped_device;
271 /* Currently mapped PCMCIA segment. (bustype == SSB_BUSTYPE_PCMCIA only) */
272 u8 mapped_pcmcia_seg;
273 /* Lock for core and segment switching. */
274 spinlock_t bar_lock;
275
276 /* The bus this backplane is running on. */
277 enum ssb_bustype bustype;
278 /* Pointer to the PCI bus (only valid if bustype == SSB_BUSTYPE_PCI). */
279 struct pci_dev *host_pci;
280 /* Pointer to the PCMCIA device (only if bustype == SSB_BUSTYPE_PCMCIA). */
281 struct pcmcia_device *host_pcmcia;
282
283#ifdef CONFIG_SSB_PCIHOST
284 /* Mutex to protect the SPROM writing. */
285 struct mutex pci_sprom_mutex;
286#endif
287
288 /* ID information about the Chip. */
289 u16 chip_id;
290 u16 chip_rev;
291 u8 chip_package;
292
293 /* List of devices (cores) on the backplane. */
294 struct ssb_device devices[SSB_MAX_NR_CORES];
295 u8 nr_devices;
296
297 /* Reference count. Number of suspended devices. */
298 u8 suspend_cnt;
299
300 /* Software ID number for this bus. */
301 unsigned int busnumber;
302
303 /* The ChipCommon device (if available). */
304 struct ssb_chipcommon chipco;
305 /* The PCI-core device (if available). */
306 struct ssb_pcicore pcicore;
307 /* The MIPS-core device (if available). */
308 struct ssb_mipscore mipscore;
309 /* The EXTif-core device (if available). */
310 struct ssb_extif extif;
311
312 /* The following structure elements are not available in early
313 * SSB initialization. Though, they are available for regular
314 * registered drivers at any stage. So be careful when
315 * using them in the ssb core code. */
316
317 /* ID information about the PCB. */
318 struct ssb_boardinfo boardinfo;
319 /* Contents of the SPROM. */
320 struct ssb_sprom sprom;
321
322 /* Internal-only stuff follows. Do not touch. */
323 struct list_head list;
324#ifdef CONFIG_SSB_DEBUG
325 /* Is the bus already powered up? */
326 bool powered_up;
327 int power_warn_count;
328#endif /* DEBUG */
329};
330
331/* The initialization-invariants. */
332struct ssb_init_invariants {
333 struct ssb_boardinfo boardinfo;
334 struct ssb_sprom sprom;
335};
336/* Type of function to fetch the invariants. */
337typedef int (*ssb_invariants_func_t)(struct ssb_bus *bus,
338 struct ssb_init_invariants *iv);
339
340/* Register a SSB system bus. get_invariants() is called after the
341 * basic system devices are initialized.
342 * The invariants are usually fetched from some NVRAM.
343 * Put the invariants into the struct pointed to by iv. */
344extern int ssb_bus_ssbbus_register(struct ssb_bus *bus,
345 unsigned long baseaddr,
346 ssb_invariants_func_t get_invariants);
347#ifdef CONFIG_SSB_PCIHOST
348extern int ssb_bus_pcibus_register(struct ssb_bus *bus,
349 struct pci_dev *host_pci);
350#endif /* CONFIG_SSB_PCIHOST */
351#ifdef CONFIG_SSB_PCMCIAHOST
352extern int ssb_bus_pcmciabus_register(struct ssb_bus *bus,
353 struct pcmcia_device *pcmcia_dev,
354 unsigned long baseaddr);
355#endif /* CONFIG_SSB_PCMCIAHOST */
356
357extern void ssb_bus_unregister(struct ssb_bus *bus);
358
359extern u32 ssb_clockspeed(struct ssb_bus *bus);
360
361/* Is the device enabled in hardware? */
362int ssb_device_is_enabled(struct ssb_device *dev);
363/* Enable a device and pass device-specific SSB_TMSLOW flags.
364 * If no device-specific flags are available, use 0. */
365void ssb_device_enable(struct ssb_device *dev, u32 core_specific_flags);
366/* Disable a device in hardware and pass SSB_TMSLOW flags (if any). */
367void ssb_device_disable(struct ssb_device *dev, u32 core_specific_flags);
368
369
370/* Device MMIO register read/write functions. */
371static inline u16 ssb_read16(struct ssb_device *dev, u16 offset)
372{
373 return dev->ops->read16(dev, offset);
374}
375static inline u32 ssb_read32(struct ssb_device *dev, u16 offset)
376{
377 return dev->ops->read32(dev, offset);
378}
379static inline void ssb_write16(struct ssb_device *dev, u16 offset, u16 value)
380{
381 dev->ops->write16(dev, offset, value);
382}
383static inline void ssb_write32(struct ssb_device *dev, u16 offset, u32 value)
384{
385 dev->ops->write32(dev, offset, value);
386}
387
388
389/* Translation (routing) bits that need to be ORed to DMA
390 * addresses before they are given to a device. */
391extern u32 ssb_dma_translation(struct ssb_device *dev);
392#define SSB_DMA_TRANSLATION_MASK 0xC0000000
393#define SSB_DMA_TRANSLATION_SHIFT 30
394
395extern int ssb_dma_set_mask(struct ssb_device *ssb_dev, u64 mask);
396
397
398#ifdef CONFIG_SSB_PCIHOST
399/* PCI-host wrapper driver */
400extern int ssb_pcihost_register(struct pci_driver *driver);
401static inline void ssb_pcihost_unregister(struct pci_driver *driver)
402{
403 pci_unregister_driver(driver);
404}
405#endif /* CONFIG_SSB_PCIHOST */
406
407
408/* If a driver is shutdown or suspended, call this to signal
409 * that the bus may be completely powered down. SSB will decide,
410 * if it's really time to power down the bus, based on if there
411 * are other devices that want to run. */
412extern int ssb_bus_may_powerdown(struct ssb_bus *bus);
413/* Before initializing and enabling a device, call this to power-up the bus.
414 * If you want to allow use of dynamic-power-control, pass the flag.
415 * Otherwise static always-on powercontrol will be used. */
416extern int ssb_bus_powerup(struct ssb_bus *bus, bool dynamic_pctl);
417
418
419/* Various helper functions */
420extern u32 ssb_admatch_base(u32 adm);
421extern u32 ssb_admatch_size(u32 adm);
422
423
424#endif /* LINUX_SSB_H_ */
diff --git a/include/linux/ssb/ssb_driver_chipcommon.h b/include/linux/ssb/ssb_driver_chipcommon.h
new file mode 100644
index 000000000000..4cb995494662
--- /dev/null
+++ b/include/linux/ssb/ssb_driver_chipcommon.h
@@ -0,0 +1,396 @@
1#ifndef LINUX_SSB_CHIPCO_H_
2#define LINUX_SSB_CHIPCO_H_
3
4/* SonicsSiliconBackplane CHIPCOMMON core hardware definitions
5 *
6 * The chipcommon core provides chip identification, SB control,
7 * jtag, 0/1/2 uarts, clock frequency control, a watchdog interrupt timer,
8 * gpio interface, extbus, and support for serial and parallel flashes.
9 *
10 * Copyright 2005, Broadcom Corporation
11 * Copyright 2006, Michael Buesch <mb@bu3sch.de>
12 *
13 * Licensed under the GPL version 2. See COPYING for details.
14 */
15
16/** ChipCommon core registers. **/
17
18#define SSB_CHIPCO_CHIPID 0x0000
19#define SSB_CHIPCO_IDMASK 0x0000FFFF
20#define SSB_CHIPCO_REVMASK 0x000F0000
21#define SSB_CHIPCO_REVSHIFT 16
22#define SSB_CHIPCO_PACKMASK 0x00F00000
23#define SSB_CHIPCO_PACKSHIFT 20
24#define SSB_CHIPCO_NRCORESMASK 0x0F000000
25#define SSB_CHIPCO_NRCORESSHIFT 24
26#define SSB_CHIPCO_CAP 0x0004 /* Capabilities */
27#define SSB_CHIPCO_CAP_NRUART 0x00000003 /* # of UARTs */
28#define SSB_CHIPCO_CAP_MIPSEB 0x00000004 /* MIPS in BigEndian Mode */
29#define SSB_CHIPCO_CAP_UARTCLK 0x00000018 /* UART clock select */
30#define SSB_CHIPCO_CAP_UARTCLK_INT 0x00000008 /* UARTs are driven by internal divided clock */
31#define SSB_CHIPCO_CAP_UARTGPIO 0x00000020 /* UARTs on GPIO 15-12 */
32#define SSB_CHIPCO_CAP_EXTBUS 0x000000C0 /* External buses present */
33#define SSB_CHIPCO_CAP_FLASHT 0x00000700 /* Flash Type */
34#define SSB_CHIPCO_FLASHT_NONE 0x00000000 /* No flash */
35#define SSB_CHIPCO_FLASHT_STSER 0x00000100 /* ST serial flash */
36#define SSB_CHIPCO_FLASHT_ATSER 0x00000200 /* Atmel serial flash */
37#define SSB_CHIPCO_FLASHT_PARA 0x00000700 /* Parallel flash */
38#define SSB_CHIPCO_CAP_PLLT 0x00038000 /* PLL Type */
39#define SSB_PLLTYPE_NONE 0x00000000
40#define SSB_PLLTYPE_1 0x00010000 /* 48Mhz base, 3 dividers */
41#define SSB_PLLTYPE_2 0x00020000 /* 48Mhz, 4 dividers */
42#define SSB_PLLTYPE_3 0x00030000 /* 25Mhz, 2 dividers */
43#define SSB_PLLTYPE_4 0x00008000 /* 48Mhz, 4 dividers */
44#define SSB_PLLTYPE_5 0x00018000 /* 25Mhz, 4 dividers */
45#define SSB_PLLTYPE_6 0x00028000 /* 100/200 or 120/240 only */
46#define SSB_PLLTYPE_7 0x00038000 /* 25Mhz, 4 dividers */
47#define SSB_CHIPCO_CAP_PCTL 0x00040000 /* Power Control */
48#define SSB_CHIPCO_CAP_OTPS 0x00380000 /* OTP size */
49#define SSB_CHIPCO_CAP_OTPS_SHIFT 19
50#define SSB_CHIPCO_CAP_OTPS_BASE 5
51#define SSB_CHIPCO_CAP_JTAGM 0x00400000 /* JTAG master present */
52#define SSB_CHIPCO_CAP_BROM 0x00800000 /* Internal boot ROM active */
53#define SSB_CHIPCO_CAP_64BIT 0x08000000 /* 64-bit Backplane */
54#define SSB_CHIPCO_CORECTL 0x0008
55#define SSB_CHIPCO_CORECTL_UARTCLK0 0x00000001 /* Drive UART with internal clock */
56#define SSB_CHIPCO_CORECTL_SE 0x00000002 /* sync clk out enable (corerev >= 3) */
57#define SSB_CHIPCO_BIST 0x000C
58#define SSB_CHIPCO_OTPS 0x0010 /* OTP status */
59#define SSB_CHIPCO_OTPS_PROGFAIL 0x80000000
60#define SSB_CHIPCO_OTPS_PROTECT 0x00000007
61#define SSB_CHIPCO_OTPS_HW_PROTECT 0x00000001
62#define SSB_CHIPCO_OTPS_SW_PROTECT 0x00000002
63#define SSB_CHIPCO_OTPS_CID_PROTECT 0x00000004
64#define SSB_CHIPCO_OTPC 0x0014 /* OTP control */
65#define SSB_CHIPCO_OTPC_RECWAIT 0xFF000000
66#define SSB_CHIPCO_OTPC_PROGWAIT 0x00FFFF00
67#define SSB_CHIPCO_OTPC_PRW_SHIFT 8
68#define SSB_CHIPCO_OTPC_MAXFAIL 0x00000038
69#define SSB_CHIPCO_OTPC_VSEL 0x00000006
70#define SSB_CHIPCO_OTPC_SELVL 0x00000001
71#define SSB_CHIPCO_OTPP 0x0018 /* OTP prog */
72#define SSB_CHIPCO_OTPP_COL 0x000000FF
73#define SSB_CHIPCO_OTPP_ROW 0x0000FF00
74#define SSB_CHIPCO_OTPP_ROW_SHIFT 8
75#define SSB_CHIPCO_OTPP_READERR 0x10000000
76#define SSB_CHIPCO_OTPP_VALUE 0x20000000
77#define SSB_CHIPCO_OTPP_READ 0x40000000
78#define SSB_CHIPCO_OTPP_START 0x80000000
79#define SSB_CHIPCO_OTPP_BUSY 0x80000000
80#define SSB_CHIPCO_IRQSTAT 0x0020
81#define SSB_CHIPCO_IRQMASK 0x0024
82#define SSB_CHIPCO_IRQ_GPIO 0x00000001 /* gpio intr */
83#define SSB_CHIPCO_IRQ_EXT 0x00000002 /* ro: ext intr pin (corerev >= 3) */
84#define SSB_CHIPCO_IRQ_WDRESET 0x80000000 /* watchdog reset occurred */
85#define SSB_CHIPCO_CHIPCTL 0x0028 /* Rev >= 11 only */
86#define SSB_CHIPCO_CHIPSTAT 0x002C /* Rev >= 11 only */
87#define SSB_CHIPCO_JCMD 0x0030 /* Rev >= 10 only */
88#define SSB_CHIPCO_JCMD_START 0x80000000
89#define SSB_CHIPCO_JCMD_BUSY 0x80000000
90#define SSB_CHIPCO_JCMD_PAUSE 0x40000000
91#define SSB_CHIPCO_JCMD0_ACC_MASK 0x0000F000
92#define SSB_CHIPCO_JCMD0_ACC_IRDR 0x00000000
93#define SSB_CHIPCO_JCMD0_ACC_DR 0x00001000
94#define SSB_CHIPCO_JCMD0_ACC_IR 0x00002000
95#define SSB_CHIPCO_JCMD0_ACC_RESET 0x00003000
96#define SSB_CHIPCO_JCMD0_ACC_IRPDR 0x00004000
97#define SSB_CHIPCO_JCMD0_ACC_PDR 0x00005000
98#define SSB_CHIPCO_JCMD0_IRW_MASK 0x00000F00
99#define SSB_CHIPCO_JCMD_ACC_MASK 0x000F0000 /* Changes for corerev 11 */
100#define SSB_CHIPCO_JCMD_ACC_IRDR 0x00000000
101#define SSB_CHIPCO_JCMD_ACC_DR 0x00010000
102#define SSB_CHIPCO_JCMD_ACC_IR 0x00020000
103#define SSB_CHIPCO_JCMD_ACC_RESET 0x00030000
104#define SSB_CHIPCO_JCMD_ACC_IRPDR 0x00040000
105#define SSB_CHIPCO_JCMD_ACC_PDR 0x00050000
106#define SSB_CHIPCO_JCMD_IRW_MASK 0x00001F00
107#define SSB_CHIPCO_JCMD_IRW_SHIFT 8
108#define SSB_CHIPCO_JCMD_DRW_MASK 0x0000003F
109#define SSB_CHIPCO_JIR 0x0034 /* Rev >= 10 only */
110#define SSB_CHIPCO_JDR 0x0038 /* Rev >= 10 only */
111#define SSB_CHIPCO_JCTL 0x003C /* Rev >= 10 only */
112#define SSB_CHIPCO_JCTL_FORCE_CLK 4 /* Force clock */
113#define SSB_CHIPCO_JCTL_EXT_EN 2 /* Enable external targets */
114#define SSB_CHIPCO_JCTL_EN 1 /* Enable Jtag master */
115#define SSB_CHIPCO_FLASHCTL 0x0040
116#define SSB_CHIPCO_FLASHCTL_START 0x80000000
117#define SSB_CHIPCO_FLASHCTL_BUSY SSB_CHIPCO_FLASHCTL_START
118#define SSB_CHIPCO_FLASHADDR 0x0044
119#define SSB_CHIPCO_FLASHDATA 0x0048
120#define SSB_CHIPCO_BCAST_ADDR 0x0050
121#define SSB_CHIPCO_BCAST_DATA 0x0054
122#define SSB_CHIPCO_GPIOIN 0x0060
123#define SSB_CHIPCO_GPIOOUT 0x0064
124#define SSB_CHIPCO_GPIOOUTEN 0x0068
125#define SSB_CHIPCO_GPIOCTL 0x006C
126#define SSB_CHIPCO_GPIOPOL 0x0070
127#define SSB_CHIPCO_GPIOIRQ 0x0074
128#define SSB_CHIPCO_WATCHDOG 0x0080
129#define SSB_CHIPCO_GPIOTIMER 0x0088 /* LED powersave (corerev >= 16) */
130#define SSB_CHIPCO_GPIOTIMER_ONTIME_SHIFT 16
131#define SSB_CHIPCO_GPIOTOUTM 0x008C /* LED powersave (corerev >= 16) */
132#define SSB_CHIPCO_CLOCK_N 0x0090
133#define SSB_CHIPCO_CLOCK_SB 0x0094
134#define SSB_CHIPCO_CLOCK_PCI 0x0098
135#define SSB_CHIPCO_CLOCK_M2 0x009C
136#define SSB_CHIPCO_CLOCK_MIPS 0x00A0
137#define SSB_CHIPCO_CLKDIV 0x00A4 /* Rev >= 3 only */
138#define SSB_CHIPCO_CLKDIV_SFLASH 0x0F000000
139#define SSB_CHIPCO_CLKDIV_SFLASH_SHIFT 24
140#define SSB_CHIPCO_CLKDIV_OTP 0x000F0000
141#define SSB_CHIPCO_CLKDIV_OTP_SHIFT 16
142#define SSB_CHIPCO_CLKDIV_JTAG 0x00000F00
143#define SSB_CHIPCO_CLKDIV_JTAG_SHIFT 8
144#define SSB_CHIPCO_CLKDIV_UART 0x000000FF
145#define SSB_CHIPCO_PLLONDELAY 0x00B0 /* Rev >= 4 only */
146#define SSB_CHIPCO_FREFSELDELAY 0x00B4 /* Rev >= 4 only */
147#define SSB_CHIPCO_SLOWCLKCTL 0x00B8 /* 6 <= Rev <= 9 only */
148#define SSB_CHIPCO_SLOWCLKCTL_SRC 0x00000007 /* slow clock source mask */
149#define SSB_CHIPCO_SLOWCLKCTL_SRC_LPO 0x00000000 /* source of slow clock is LPO */
150#define SSB_CHIPCO_SLOWCLKCTL_SRC_XTAL 0x00000001 /* source of slow clock is crystal */
151#define SSB_CHIPCO_SLOECLKCTL_SRC_PCI 0x00000002 /* source of slow clock is PCI */
152#define SSB_CHIPCO_SLOWCLKCTL_LPOFREQ 0x00000200 /* LPOFreqSel, 1: 160Khz, 0: 32KHz */
153#define SSB_CHIPCO_SLOWCLKCTL_LPOPD 0x00000400 /* LPOPowerDown, 1: LPO is disabled, 0: LPO is enabled */
154#define SSB_CHIPCO_SLOWCLKCTL_FSLOW 0x00000800 /* ForceSlowClk, 1: sb/cores running on slow clock, 0: power logic control */
155#define SSB_CHIPCO_SLOWCLKCTL_IPLL 0x00001000 /* IgnorePllOffReq, 1/0: power logic ignores/honors PLL clock disable requests from core */
156#define SSB_CHIPCO_SLOWCLKCTL_ENXTAL 0x00002000 /* XtalControlEn, 1/0: power logic does/doesn't disable crystal when appropriate */
157#define SSB_CHIPCO_SLOWCLKCTL_XTALPU 0x00004000 /* XtalPU (RO), 1/0: crystal running/disabled */
158#define SSB_CHIPCO_SLOWCLKCTL_CLKDIV 0xFFFF0000 /* ClockDivider (SlowClk = 1/(4+divisor)) */
159#define SSB_CHIPCO_SLOWCLKCTL_CLKDIV_SHIFT 16
160#define SSB_CHIPCO_SYSCLKCTL 0x00C0 /* Rev >= 3 only */
161#define SSB_CHIPCO_SYSCLKCTL_IDLPEN 0x00000001 /* ILPen: Enable Idle Low Power */
162#define SSB_CHIPCO_SYSCLKCTL_ALPEN 0x00000002 /* ALPen: Enable Active Low Power */
163#define SSB_CHIPCO_SYSCLKCTL_PLLEN 0x00000004 /* ForcePLLOn */
164#define SSB_CHIPCO_SYSCLKCTL_FORCEALP 0x00000008 /* Force ALP (or HT if ALPen is not set */
165#define SSB_CHIPCO_SYSCLKCTL_FORCEHT 0x00000010 /* Force HT */
166#define SSB_CHIPCO_SYSCLKCTL_CLKDIV 0xFFFF0000 /* ClkDiv (ILP = 1/(4+divisor)) */
167#define SSB_CHIPCO_SYSCLKCTL_CLKDIV_SHIFT 16
168#define SSB_CHIPCO_CLKSTSTR 0x00C4 /* Rev >= 3 only */
169#define SSB_CHIPCO_PCMCIA_CFG 0x0100
170#define SSB_CHIPCO_PCMCIA_MEMWAIT 0x0104
171#define SSB_CHIPCO_PCMCIA_ATTRWAIT 0x0108
172#define SSB_CHIPCO_PCMCIA_IOWAIT 0x010C
173#define SSB_CHIPCO_IDE_CFG 0x0110
174#define SSB_CHIPCO_IDE_MEMWAIT 0x0114
175#define SSB_CHIPCO_IDE_ATTRWAIT 0x0118
176#define SSB_CHIPCO_IDE_IOWAIT 0x011C
177#define SSB_CHIPCO_PROG_CFG 0x0120
178#define SSB_CHIPCO_PROG_WAITCNT 0x0124
179#define SSB_CHIPCO_FLASH_CFG 0x0128
180#define SSB_CHIPCO_FLASH_WAITCNT 0x012C
181#define SSB_CHIPCO_UART0_DATA 0x0300
182#define SSB_CHIPCO_UART0_IMR 0x0304
183#define SSB_CHIPCO_UART0_FCR 0x0308
184#define SSB_CHIPCO_UART0_LCR 0x030C
185#define SSB_CHIPCO_UART0_MCR 0x0310
186#define SSB_CHIPCO_UART0_LSR 0x0314
187#define SSB_CHIPCO_UART0_MSR 0x0318
188#define SSB_CHIPCO_UART0_SCRATCH 0x031C
189#define SSB_CHIPCO_UART1_DATA 0x0400
190#define SSB_CHIPCO_UART1_IMR 0x0404
191#define SSB_CHIPCO_UART1_FCR 0x0408
192#define SSB_CHIPCO_UART1_LCR 0x040C
193#define SSB_CHIPCO_UART1_MCR 0x0410
194#define SSB_CHIPCO_UART1_LSR 0x0414
195#define SSB_CHIPCO_UART1_MSR 0x0418
196#define SSB_CHIPCO_UART1_SCRATCH 0x041C
197
198
199
200/** Clockcontrol masks and values **/
201
202/* SSB_CHIPCO_CLOCK_N */
203#define SSB_CHIPCO_CLK_N1 0x0000003F /* n1 control */
204#define SSB_CHIPCO_CLK_N2 0x00003F00 /* n2 control */
205#define SSB_CHIPCO_CLK_N2_SHIFT 8
206#define SSB_CHIPCO_CLK_PLLC 0x000F0000 /* pll control */
207#define SSB_CHIPCO_CLK_PLLC_SHIFT 16
208
209/* SSB_CHIPCO_CLOCK_SB/PCI/UART */
210#define SSB_CHIPCO_CLK_M1 0x0000003F /* m1 control */
211#define SSB_CHIPCO_CLK_M2 0x00003F00 /* m2 control */
212#define SSB_CHIPCO_CLK_M2_SHIFT 8
213#define SSB_CHIPCO_CLK_M3 0x003F0000 /* m3 control */
214#define SSB_CHIPCO_CLK_M3_SHIFT 16
215#define SSB_CHIPCO_CLK_MC 0x1F000000 /* mux control */
216#define SSB_CHIPCO_CLK_MC_SHIFT 24
217
218/* N3M Clock control magic field values */
219#define SSB_CHIPCO_CLK_F6_2 0x02 /* A factor of 2 in */
220#define SSB_CHIPCO_CLK_F6_3 0x03 /* 6-bit fields like */
221#define SSB_CHIPCO_CLK_F6_4 0x05 /* N1, M1 or M3 */
222#define SSB_CHIPCO_CLK_F6_5 0x09
223#define SSB_CHIPCO_CLK_F6_6 0x11
224#define SSB_CHIPCO_CLK_F6_7 0x21
225
226#define SSB_CHIPCO_CLK_F5_BIAS 5 /* 5-bit fields get this added */
227
228#define SSB_CHIPCO_CLK_MC_BYPASS 0x08
229#define SSB_CHIPCO_CLK_MC_M1 0x04
230#define SSB_CHIPCO_CLK_MC_M1M2 0x02
231#define SSB_CHIPCO_CLK_MC_M1M2M3 0x01
232#define SSB_CHIPCO_CLK_MC_M1M3 0x11
233
234/* Type 2 Clock control magic field values */
235#define SSB_CHIPCO_CLK_T2_BIAS 2 /* n1, n2, m1 & m3 bias */
236#define SSB_CHIPCO_CLK_T2M2_BIAS 3 /* m2 bias */
237
238#define SSB_CHIPCO_CLK_T2MC_M1BYP 1
239#define SSB_CHIPCO_CLK_T2MC_M2BYP 2
240#define SSB_CHIPCO_CLK_T2MC_M3BYP 4
241
242/* Type 6 Clock control magic field values */
243#define SSB_CHIPCO_CLK_T6_MMASK 1 /* bits of interest in m */
244#define SSB_CHIPCO_CLK_T6_M0 120000000 /* sb clock for m = 0 */
245#define SSB_CHIPCO_CLK_T6_M1 100000000 /* sb clock for m = 1 */
246#define SSB_CHIPCO_CLK_SB2MIPS_T6(sb) (2 * (sb))
247
248/* Common clock base */
249#define SSB_CHIPCO_CLK_BASE1 24000000 /* Half the clock freq */
250#define SSB_CHIPCO_CLK_BASE2 12500000 /* Alternate crystal on some PLL's */
251
252/* Clock control values for 200Mhz in 5350 */
253#define SSB_CHIPCO_CLK_5350_N 0x0311
254#define SSB_CHIPCO_CLK_5350_M 0x04020009
255
256
257/** Bits in the config registers **/
258
259#define SSB_CHIPCO_CFG_EN 0x0001 /* Enable */
260#define SSB_CHIPCO_CFG_EXTM 0x000E /* Extif Mode */
261#define SSB_CHIPCO_CFG_EXTM_ASYNC 0x0002 /* Async/Parallel flash */
262#define SSB_CHIPCO_CFG_EXTM_SYNC 0x0004 /* Synchronous */
263#define SSB_CHIPCO_CFG_EXTM_PCMCIA 0x0008 /* PCMCIA */
264#define SSB_CHIPCO_CFG_EXTM_IDE 0x000A /* IDE */
265#define SSB_CHIPCO_CFG_DS16 0x0010 /* Data size, 0=8bit, 1=16bit */
266#define SSB_CHIPCO_CFG_CLKDIV 0x0060 /* Sync: Clock divisor */
267#define SSB_CHIPCO_CFG_CLKEN 0x0080 /* Sync: Clock enable */
268#define SSB_CHIPCO_CFG_BSTRO 0x0100 /* Sync: Size/Bytestrobe */
269
270
271/** Flash-specific control/status values */
272
273/* flashcontrol opcodes for ST flashes */
274#define SSB_CHIPCO_FLASHCTL_ST_WREN 0x0006 /* Write Enable */
275#define SSB_CHIPCO_FLASHCTL_ST_WRDIS 0x0004 /* Write Disable */
276#define SSB_CHIPCO_FLASHCTL_ST_RDSR 0x0105 /* Read Status Register */
277#define SSB_CHIPCO_FLASHCTL_ST_WRSR 0x0101 /* Write Status Register */
278#define SSB_CHIPCO_FLASHCTL_ST_READ 0x0303 /* Read Data Bytes */
279#define SSB_CHIPCO_FLASHCTL_ST_PP 0x0302 /* Page Program */
280#define SSB_CHIPCO_FLASHCTL_ST_SE 0x02D8 /* Sector Erase */
281#define SSB_CHIPCO_FLASHCTL_ST_BE 0x00C7 /* Bulk Erase */
282#define SSB_CHIPCO_FLASHCTL_ST_DP 0x00B9 /* Deep Power-down */
283#define SSB_CHIPCO_FLASHCTL_ST_RSIG 0x03AB /* Read Electronic Signature */
284
285/* Status register bits for ST flashes */
286#define SSB_CHIPCO_FLASHSTA_ST_WIP 0x01 /* Write In Progress */
287#define SSB_CHIPCO_FLASHSTA_ST_WEL 0x02 /* Write Enable Latch */
288#define SSB_CHIPCO_FLASHSTA_ST_BP 0x1C /* Block Protect */
289#define SSB_CHIPCO_FLASHSTA_ST_BP_SHIFT 2
290#define SSB_CHIPCO_FLASHSTA_ST_SRWD 0x80 /* Status Register Write Disable */
291
292/* flashcontrol opcodes for Atmel flashes */
293#define SSB_CHIPCO_FLASHCTL_AT_READ 0x07E8
294#define SSB_CHIPCO_FLASHCTL_AT_PAGE_READ 0x07D2
295#define SSB_CHIPCO_FLASHCTL_AT_BUF1_READ /* FIXME */
296#define SSB_CHIPCO_FLASHCTL_AT_BUF2_READ /* FIXME */
297#define SSB_CHIPCO_FLASHCTL_AT_STATUS 0x01D7
298#define SSB_CHIPCO_FLASHCTL_AT_BUF1_WRITE 0x0384
299#define SSB_CHIPCO_FLASHCTL_AT_BUF2_WRITE 0x0387
300#define SSB_CHIPCO_FLASHCTL_AT_BUF1_ERASE_PRGM 0x0283 /* Erase program */
301#define SSB_CHIPCO_FLASHCTL_AT_BUF2_ERASE_PRGM 0x0286 /* Erase program */
302#define SSB_CHIPCO_FLASHCTL_AT_BUF1_PROGRAM 0x0288
303#define SSB_CHIPCO_FLASHCTL_AT_BUF2_PROGRAM 0x0289
304#define SSB_CHIPCO_FLASHCTL_AT_PAGE_ERASE 0x0281
305#define SSB_CHIPCO_FLASHCTL_AT_BLOCK_ERASE 0x0250
306#define SSB_CHIPCO_FLASHCTL_AT_BUF1_WRER_PRGM 0x0382 /* Write erase program */
307#define SSB_CHIPCO_FLASHCTL_AT_BUF2_WRER_PRGM 0x0385 /* Write erase program */
308#define SSB_CHIPCO_FLASHCTL_AT_BUF1_LOAD 0x0253
309#define SSB_CHIPCO_FLASHCTL_AT_BUF2_LOAD 0x0255
310#define SSB_CHIPCO_FLASHCTL_AT_BUF1_COMPARE 0x0260
311#define SSB_CHIPCO_FLASHCTL_AT_BUF2_COMPARE 0x0261
312#define SSB_CHIPCO_FLASHCTL_AT_BUF1_REPROGRAM 0x0258
313#define SSB_CHIPCO_FLASHCTL_AT_BUF2_REPROGRAM 0x0259
314
315/* Status register bits for Atmel flashes */
316#define SSB_CHIPCO_FLASHSTA_AT_READY 0x80
317#define SSB_CHIPCO_FLASHSTA_AT_MISMATCH 0x40
318#define SSB_CHIPCO_FLASHSTA_AT_ID 0x38
319#define SSB_CHIPCO_FLASHSTA_AT_ID_SHIFT 3
320
321
322/** OTP **/
323
324/* OTP regions */
325#define SSB_CHIPCO_OTP_HW_REGION SSB_CHIPCO_OTPS_HW_PROTECT
326#define SSB_CHIPCO_OTP_SW_REGION SSB_CHIPCO_OTPS_SW_PROTECT
327#define SSB_CHIPCO_OTP_CID_REGION SSB_CHIPCO_OTPS_CID_PROTECT
328
329/* OTP regions (Byte offsets from otp size) */
330#define SSB_CHIPCO_OTP_SWLIM_OFF (-8)
331#define SSB_CHIPCO_OTP_CIDBASE_OFF 0
332#define SSB_CHIPCO_OTP_CIDLIM_OFF 8
333
334/* Predefined OTP words (Word offset from otp size) */
335#define SSB_CHIPCO_OTP_BOUNDARY_OFF (-4)
336#define SSB_CHIPCO_OTP_HWSIGN_OFF (-3)
337#define SSB_CHIPCO_OTP_SWSIGN_OFF (-2)
338#define SSB_CHIPCO_OTP_CIDSIGN_OFF (-1)
339
340#define SSB_CHIPCO_OTP_CID_OFF 0
341#define SSB_CHIPCO_OTP_PKG_OFF 1
342#define SSB_CHIPCO_OTP_FID_OFF 2
343#define SSB_CHIPCO_OTP_RSV_OFF 3
344#define SSB_CHIPCO_OTP_LIM_OFF 4
345
346#define SSB_CHIPCO_OTP_SIGNATURE 0x578A
347#define SSB_CHIPCO_OTP_MAGIC 0x4E56
348
349
350struct ssb_device;
351struct ssb_serial_port;
352
353struct ssb_chipcommon {
354 struct ssb_device *dev;
355 u32 capabilities;
356 /* Fast Powerup Delay constant */
357 u16 fast_pwrup_delay;
358};
359
360extern void ssb_chipcommon_init(struct ssb_chipcommon *cc);
361
362#include <linux/pm.h>
363extern void ssb_chipco_suspend(struct ssb_chipcommon *cc, pm_message_t state);
364extern void ssb_chipco_resume(struct ssb_chipcommon *cc);
365
366extern void ssb_chipco_get_clockcpu(struct ssb_chipcommon *cc,
367 u32 *plltype, u32 *n, u32 *m);
368extern void ssb_chipco_get_clockcontrol(struct ssb_chipcommon *cc,
369 u32 *plltype, u32 *n, u32 *m);
370extern void ssb_chipco_timing_init(struct ssb_chipcommon *cc,
371 unsigned long ns_per_cycle);
372
373enum ssb_clkmode {
374 SSB_CLKMODE_SLOW,
375 SSB_CLKMODE_FAST,
376 SSB_CLKMODE_DYNAMIC,
377};
378
379extern void ssb_chipco_set_clockmode(struct ssb_chipcommon *cc,
380 enum ssb_clkmode mode);
381
382extern void ssb_chipco_watchdog_timer_set(struct ssb_chipcommon *cc,
383 u32 ticks);
384
385u32 ssb_chipco_gpio_in(struct ssb_chipcommon *cc, u32 mask);
386
387void ssb_chipco_gpio_out(struct ssb_chipcommon *cc, u32 mask, u32 value);
388
389void ssb_chipco_gpio_outen(struct ssb_chipcommon *cc, u32 mask, u32 value);
390
391#ifdef CONFIG_SSB_SERIAL
392extern int ssb_chipco_serial_init(struct ssb_chipcommon *cc,
393 struct ssb_serial_port *ports);
394#endif /* CONFIG_SSB_SERIAL */
395
396#endif /* LINUX_SSB_CHIPCO_H_ */
diff --git a/include/linux/ssb/ssb_driver_extif.h b/include/linux/ssb/ssb_driver_extif.h
new file mode 100644
index 000000000000..a9164357b5ae
--- /dev/null
+++ b/include/linux/ssb/ssb_driver_extif.h
@@ -0,0 +1,204 @@
1/*
2 * Hardware-specific External Interface I/O core definitions
3 * for the BCM47xx family of SiliconBackplane-based chips.
4 *
5 * The External Interface core supports a total of three external chip selects
6 * supporting external interfaces. One of the external chip selects is
7 * used for Flash, one is used for PCMCIA, and the other may be
8 * programmed to support either a synchronous interface or an
9 * asynchronous interface. The asynchronous interface can be used to
10 * support external devices such as UARTs and the BCM2019 Bluetooth
11 * baseband processor.
12 * The external interface core also contains 2 on-chip 16550 UARTs, clock
13 * frequency control, a watchdog interrupt timer, and a GPIO interface.
14 *
15 * Copyright 2005, Broadcom Corporation
16 * Copyright 2006, Michael Buesch
17 *
18 * Licensed under the GPL version 2. See COPYING for details.
19 */
20#ifndef LINUX_SSB_EXTIFCORE_H_
21#define LINUX_SSB_EXTIFCORE_H_
22
23/* external interface address space */
24#define SSB_EXTIF_PCMCIA_MEMBASE(x) (x)
25#define SSB_EXTIF_PCMCIA_IOBASE(x) ((x) + 0x100000)
26#define SSB_EXTIF_PCMCIA_CFGBASE(x) ((x) + 0x200000)
27#define SSB_EXTIF_CFGIF_BASE(x) ((x) + 0x800000)
28#define SSB_EXTIF_FLASH_BASE(x) ((x) + 0xc00000)
29
30#define SSB_EXTIF_NR_GPIOOUT 5
31/* GPIO NOTE:
32 * The multiple instances of output and output enable registers
33 * are present to allow driver software for multiple cores to control
34 * gpio outputs without needing to share a single register pair.
35 * Use the following helper macro to get a register offset value.
36 */
37#define SSB_EXTIF_GPIO_OUT(index) ({ \
38 BUILD_BUG_ON(index >= SSB_EXTIF_NR_GPIOOUT); \
39 SSB_EXTIF_GPIO_OUT_BASE + ((index) * 8); \
40 })
41#define SSB_EXTIF_GPIO_OUTEN(index) ({ \
42 BUILD_BUG_ON(index >= SSB_EXTIF_NR_GPIOOUT); \
43 SSB_EXTIF_GPIO_OUTEN_BASE + ((index) * 8); \
44 })
45
46/** EXTIF core registers **/
47
48#define SSB_EXTIF_CTL 0x0000
49#define SSB_EXTIF_CTL_UARTEN (1 << 0) /* UART enable */
50#define SSB_EXTIF_EXTSTAT 0x0004
51#define SSB_EXTIF_EXTSTAT_EMODE (1 << 0) /* Endian mode (ro) */
52#define SSB_EXTIF_EXTSTAT_EIRQPIN (1 << 1) /* External interrupt pin (ro) */
53#define SSB_EXTIF_EXTSTAT_GPIOIRQPIN (1 << 2) /* GPIO interrupt pin (ro) */
54#define SSB_EXTIF_PCMCIA_CFG 0x0010
55#define SSB_EXTIF_PCMCIA_MEMWAIT 0x0014
56#define SSB_EXTIF_PCMCIA_ATTRWAIT 0x0018
57#define SSB_EXTIF_PCMCIA_IOWAIT 0x001C
58#define SSB_EXTIF_PROG_CFG 0x0020
59#define SSB_EXTIF_PROG_WAITCNT 0x0024
60#define SSB_EXTIF_FLASH_CFG 0x0028
61#define SSB_EXTIF_FLASH_WAITCNT 0x002C
62#define SSB_EXTIF_WATCHDOG 0x0040
63#define SSB_EXTIF_CLOCK_N 0x0044
64#define SSB_EXTIF_CLOCK_SB 0x0048
65#define SSB_EXTIF_CLOCK_PCI 0x004C
66#define SSB_EXTIF_CLOCK_MII 0x0050
67#define SSB_EXTIF_GPIO_IN 0x0060
68#define SSB_EXTIF_GPIO_OUT_BASE 0x0064
69#define SSB_EXTIF_GPIO_OUTEN_BASE 0x0068
70#define SSB_EXTIF_EJTAG_OUTEN 0x0090
71#define SSB_EXTIF_GPIO_INTPOL 0x0094
72#define SSB_EXTIF_GPIO_INTMASK 0x0098
73#define SSB_EXTIF_UART_DATA 0x0300
74#define SSB_EXTIF_UART_TIMER 0x0310
75#define SSB_EXTIF_UART_FCR 0x0320
76#define SSB_EXTIF_UART_LCR 0x0330
77#define SSB_EXTIF_UART_MCR 0x0340
78#define SSB_EXTIF_UART_LSR 0x0350
79#define SSB_EXTIF_UART_MSR 0x0360
80#define SSB_EXTIF_UART_SCRATCH 0x0370
81
82
83
84
85/* pcmcia/prog/flash_config */
86#define SSB_EXTCFG_EN (1 << 0) /* enable */
87#define SSB_EXTCFG_MODE 0xE /* mode */
88#define SSB_EXTCFG_MODE_SHIFT 1
89#define SSB_EXTCFG_MODE_FLASH 0x0 /* flash/asynchronous mode */
90#define SSB_EXTCFG_MODE_SYNC 0x2 /* synchronous mode */
91#define SSB_EXTCFG_MODE_PCMCIA 0x4 /* pcmcia mode */
92#define SSB_EXTCFG_DS16 (1 << 4) /* destsize: 0=8bit, 1=16bit */
93#define SSB_EXTCFG_BSWAP (1 << 5) /* byteswap */
94#define SSB_EXTCFG_CLKDIV 0xC0 /* clock divider */
95#define SSB_EXTCFG_CLKDIV_SHIFT 6
96#define SSB_EXTCFG_CLKDIV_2 0x0 /* backplane/2 */
97#define SSB_EXTCFG_CLKDIV_3 0x40 /* backplane/3 */
98#define SSB_EXTCFG_CLKDIV_4 0x80 /* backplane/4 */
99#define SSB_EXTCFG_CLKEN (1 << 8) /* clock enable */
100#define SSB_EXTCFG_STROBE (1 << 9) /* size/bytestrobe (synch only) */
101
102/* pcmcia_memwait */
103#define SSB_PCMCIA_MEMW_0 0x0000003F /* waitcount0 */
104#define SSB_PCMCIA_MEMW_1 0x00001F00 /* waitcount1 */
105#define SSB_PCMCIA_MEMW_1_SHIFT 8
106#define SSB_PCMCIA_MEMW_2 0x001F0000 /* waitcount2 */
107#define SSB_PCMCIA_MEMW_2_SHIFT 16
108#define SSB_PCMCIA_MEMW_3 0x1F000000 /* waitcount3 */
109#define SSB_PCMCIA_MEMW_3_SHIFT 24
110
111/* pcmcia_attrwait */
112#define SSB_PCMCIA_ATTW_0 0x0000003F /* waitcount0 */
113#define SSB_PCMCIA_ATTW_1 0x00001F00 /* waitcount1 */
114#define SSB_PCMCIA_ATTW_1_SHIFT 8
115#define SSB_PCMCIA_ATTW_2 0x001F0000 /* waitcount2 */
116#define SSB_PCMCIA_ATTW_2_SHIFT 16
117#define SSB_PCMCIA_ATTW_3 0x1F000000 /* waitcount3 */
118#define SSB_PCMCIA_ATTW_3_SHIFT 24
119
120/* pcmcia_iowait */
121#define SSB_PCMCIA_IOW_0 0x0000003F /* waitcount0 */
122#define SSB_PCMCIA_IOW_1 0x00001F00 /* waitcount1 */
123#define SSB_PCMCIA_IOW_1_SHIFT 8
124#define SSB_PCMCIA_IOW_2 0x001F0000 /* waitcount2 */
125#define SSB_PCMCIA_IOW_2_SHIFT 16
126#define SSB_PCMCIA_IOW_3 0x1F000000 /* waitcount3 */
127#define SSB_PCMCIA_IOW_3_SHIFT 24
128
129/* prog_waitcount */
130#define SSB_PROG_WCNT_0 0x0000001F /* waitcount0 */
131#define SSB_PROG_WCNT_1 0x00001F00 /* waitcount1 */
132#define SSB_PROG_WCNT_1_SHIFT 8
133#define SSB_PROG_WCNT_2 0x001F0000 /* waitcount2 */
134#define SSB_PROG_WCNT_2_SHIFT 16
135#define SSB_PROG_WCNT_3 0x1F000000 /* waitcount3 */
136#define SSB_PROG_WCNT_3_SHIFT 24
137
138#define SSB_PROG_W0 0x0000000C
139#define SSB_PROG_W1 0x00000A00
140#define SSB_PROG_W2 0x00020000
141#define SSB_PROG_W3 0x01000000
142
143/* flash_waitcount */
144#define SSB_FLASH_WCNT_0 0x0000001F /* waitcount0 */
145#define SSB_FLASH_WCNT_1 0x00001F00 /* waitcount1 */
146#define SSB_FLASH_WCNT_1_SHIFT 8
147#define SSB_FLASH_WCNT_2 0x001F0000 /* waitcount2 */
148#define SSB_FLASH_WCNT_2_SHIFT 16
149#define SSB_FLASH_WCNT_3 0x1F000000 /* waitcount3 */
150#define SSB_FLASH_WCNT_3_SHIFT 24
151
152/* watchdog */
153#define SSB_EXTIF_WATCHDOG_CLK 48000000 /* Hz */
154
155
156
157#ifdef CONFIG_SSB_DRIVER_EXTIF
158
159struct ssb_extif {
160 struct ssb_device *dev;
161};
162
163static inline bool ssb_extif_available(struct ssb_extif *extif)
164{
165 return (extif->dev != NULL);
166}
167
168extern void ssb_extif_get_clockcontrol(struct ssb_extif *extif,
169 u32 *plltype, u32 *n, u32 *m);
170
171extern void ssb_extif_timing_init(struct ssb_extif *extif,
172 unsigned long ns);
173
174u32 ssb_extif_gpio_in(struct ssb_extif *extif, u32 mask);
175
176void ssb_extif_gpio_out(struct ssb_extif *extif, u32 mask, u32 value);
177
178void ssb_extif_gpio_outen(struct ssb_extif *extif, u32 mask, u32 value);
179
180#ifdef CONFIG_SSB_SERIAL
181extern int ssb_extif_serial_init(struct ssb_extif *extif,
182 struct ssb_serial_port *ports);
183#endif /* CONFIG_SSB_SERIAL */
184
185
186#else /* CONFIG_SSB_DRIVER_EXTIF */
187/* extif disabled */
188
189struct ssb_extif {
190};
191
192static inline bool ssb_extif_available(struct ssb_extif *extif)
193{
194 return 0;
195}
196
197static inline
198void ssb_extif_get_clockcontrol(struct ssb_extif *extif,
199 u32 *plltype, u32 *n, u32 *m)
200{
201}
202
203#endif /* CONFIG_SSB_DRIVER_EXTIF */
204#endif /* LINUX_SSB_EXTIFCORE_H_ */
diff --git a/include/linux/ssb/ssb_driver_mips.h b/include/linux/ssb/ssb_driver_mips.h
new file mode 100644
index 000000000000..5f44e9740cd2
--- /dev/null
+++ b/include/linux/ssb/ssb_driver_mips.h
@@ -0,0 +1,46 @@
1#ifndef LINUX_SSB_MIPSCORE_H_
2#define LINUX_SSB_MIPSCORE_H_
3
4#ifdef CONFIG_SSB_DRIVER_MIPS
5
6struct ssb_device;
7
8struct ssb_serial_port {
9 void *regs;
10 unsigned long clockspeed;
11 unsigned int irq;
12 unsigned int baud_base;
13 unsigned int reg_shift;
14};
15
16
17struct ssb_mipscore {
18 struct ssb_device *dev;
19
20 int nr_serial_ports;
21 struct ssb_serial_port serial_ports[4];
22
23 u8 flash_buswidth;
24 u32 flash_window;
25 u32 flash_window_size;
26};
27
28extern void ssb_mipscore_init(struct ssb_mipscore *mcore);
29extern u32 ssb_cpu_clock(struct ssb_mipscore *mcore);
30
31extern unsigned int ssb_mips_irq(struct ssb_device *dev);
32
33
34#else /* CONFIG_SSB_DRIVER_MIPS */
35
36struct ssb_mipscore {
37};
38
39static inline
40void ssb_mipscore_init(struct ssb_mipscore *mcore)
41{
42}
43
44#endif /* CONFIG_SSB_DRIVER_MIPS */
45
46#endif /* LINUX_SSB_MIPSCORE_H_ */
diff --git a/include/linux/ssb/ssb_driver_pci.h b/include/linux/ssb/ssb_driver_pci.h
new file mode 100644
index 000000000000..9cfffb7b1a27
--- /dev/null
+++ b/include/linux/ssb/ssb_driver_pci.h
@@ -0,0 +1,106 @@
1#ifndef LINUX_SSB_PCICORE_H_
2#define LINUX_SSB_PCICORE_H_
3
4#ifdef CONFIG_SSB_DRIVER_PCICORE
5
6/* PCI core registers. */
7#define SSB_PCICORE_CTL 0x0000 /* PCI Control */
8#define SSB_PCICORE_CTL_RST_OE 0x00000001 /* PCI_RESET Output Enable */
9#define SSB_PCICORE_CTL_RST 0x00000002 /* PCI_RESET driven out to pin */
10#define SSB_PCICORE_CTL_CLK_OE 0x00000004 /* Clock gate Output Enable */
11#define SSB_PCICORE_CTL_CLK 0x00000008 /* Gate for clock driven out to pin */
12#define SSB_PCICORE_ARBCTL 0x0010 /* PCI Arbiter Control */
13#define SSB_PCICORE_ARBCTL_INTERN 0x00000001 /* Use internal arbiter */
14#define SSB_PCICORE_ARBCTL_EXTERN 0x00000002 /* Use external arbiter */
15#define SSB_PCICORE_ARBCTL_PARKID 0x00000006 /* Mask, selects which agent is parked on an idle bus */
16#define SSB_PCICORE_ARBCTL_PARKID_LAST 0x00000000 /* Last requestor */
17#define SSB_PCICORE_ARBCTL_PARKID_4710 0x00000002 /* 4710 */
18#define SSB_PCICORE_ARBCTL_PARKID_EXT0 0x00000004 /* External requestor 0 */
19#define SSB_PCICORE_ARBCTL_PARKID_EXT1 0x00000006 /* External requestor 1 */
20#define SSB_PCICORE_ISTAT 0x0020 /* Interrupt status */
21#define SSB_PCICORE_ISTAT_INTA 0x00000001 /* PCI INTA# */
22#define SSB_PCICORE_ISTAT_INTB 0x00000002 /* PCI INTB# */
23#define SSB_PCICORE_ISTAT_SERR 0x00000004 /* PCI SERR# (write to clear) */
24#define SSB_PCICORE_ISTAT_PERR 0x00000008 /* PCI PERR# (write to clear) */
25#define SSB_PCICORE_ISTAT_PME 0x00000010 /* PCI PME# */
26#define SSB_PCICORE_IMASK 0x0024 /* Interrupt mask */
27#define SSB_PCICORE_IMASK_INTA 0x00000001 /* PCI INTA# */
28#define SSB_PCICORE_IMASK_INTB 0x00000002 /* PCI INTB# */
29#define SSB_PCICORE_IMASK_SERR 0x00000004 /* PCI SERR# */
30#define SSB_PCICORE_IMASK_PERR 0x00000008 /* PCI PERR# */
31#define SSB_PCICORE_IMASK_PME 0x00000010 /* PCI PME# */
32#define SSB_PCICORE_MBOX 0x0028 /* Backplane to PCI Mailbox */
33#define SSB_PCICORE_MBOX_F0_0 0x00000100 /* PCI function 0, INT 0 */
34#define SSB_PCICORE_MBOX_F0_1 0x00000200 /* PCI function 0, INT 1 */
35#define SSB_PCICORE_MBOX_F1_0 0x00000400 /* PCI function 1, INT 0 */
36#define SSB_PCICORE_MBOX_F1_1 0x00000800 /* PCI function 1, INT 1 */
37#define SSB_PCICORE_MBOX_F2_0 0x00001000 /* PCI function 2, INT 0 */
38#define SSB_PCICORE_MBOX_F2_1 0x00002000 /* PCI function 2, INT 1 */
39#define SSB_PCICORE_MBOX_F3_0 0x00004000 /* PCI function 3, INT 0 */
40#define SSB_PCICORE_MBOX_F3_1 0x00008000 /* PCI function 3, INT 1 */
41#define SSB_PCICORE_BCAST_ADDR 0x0050 /* Backplane Broadcast Address */
42#define SSB_PCICORE_BCAST_ADDR_MASK 0x000000FF
43#define SSB_PCICORE_BCAST_DATA 0x0054 /* Backplane Broadcast Data */
44#define SSB_PCICORE_GPIO_IN 0x0060 /* rev >= 2 only */
45#define SSB_PCICORE_GPIO_OUT 0x0064 /* rev >= 2 only */
46#define SSB_PCICORE_GPIO_ENABLE 0x0068 /* rev >= 2 only */
47#define SSB_PCICORE_GPIO_CTL 0x006C /* rev >= 2 only */
48#define SSB_PCICORE_SBTOPCI0 0x0100 /* Backplane to PCI translation 0 (sbtopci0) */
49#define SSB_PCICORE_SBTOPCI0_MASK 0xFC000000
50#define SSB_PCICORE_SBTOPCI1 0x0104 /* Backplane to PCI translation 1 (sbtopci1) */
51#define SSB_PCICORE_SBTOPCI1_MASK 0xFC000000
52#define SSB_PCICORE_SBTOPCI2 0x0108 /* Backplane to PCI translation 2 (sbtopci2) */
53#define SSB_PCICORE_SBTOPCI2_MASK 0xC0000000
54
55/* SBtoPCIx */
56#define SSB_PCICORE_SBTOPCI_MEM 0x00000000
57#define SSB_PCICORE_SBTOPCI_IO 0x00000001
58#define SSB_PCICORE_SBTOPCI_CFG0 0x00000002
59#define SSB_PCICORE_SBTOPCI_CFG1 0x00000003
60#define SSB_PCICORE_SBTOPCI_PREF 0x00000004 /* Prefetch enable */
61#define SSB_PCICORE_SBTOPCI_BURST 0x00000008 /* Burst enable */
62#define SSB_PCICORE_SBTOPCI_MRM 0x00000020 /* Memory Read Multiple */
63#define SSB_PCICORE_SBTOPCI_RC 0x00000030 /* Read Command mask (rev >= 11) */
64#define SSB_PCICORE_SBTOPCI_RC_READ 0x00000000 /* Memory read */
65#define SSB_PCICORE_SBTOPCI_RC_READL 0x00000010 /* Memory read line */
66#define SSB_PCICORE_SBTOPCI_RC_READM 0x00000020 /* Memory read multiple */
67
68
69/* PCIcore specific boardflags */
70#define SSB_PCICORE_BFL_NOPCI 0x00000400 /* Board leaves PCI floating */
71
72
73struct ssb_pcicore {
74 struct ssb_device *dev;
75 u8 setup_done:1;
76 u8 hostmode:1;
77 u8 cardbusmode:1;
78};
79
80extern void ssb_pcicore_init(struct ssb_pcicore *pc);
81
82/* Enable IRQ routing for a specific device */
83extern int ssb_pcicore_dev_irqvecs_enable(struct ssb_pcicore *pc,
84 struct ssb_device *dev);
85
86
87#else /* CONFIG_SSB_DRIVER_PCICORE */
88
89
90struct ssb_pcicore {
91};
92
93static inline
94void ssb_pcicore_init(struct ssb_pcicore *pc)
95{
96}
97
98static inline
99int ssb_pcicore_dev_irqvecs_enable(struct ssb_pcicore *pc,
100 struct ssb_device *dev)
101{
102 return 0;
103}
104
105#endif /* CONFIG_SSB_DRIVER_PCICORE */
106#endif /* LINUX_SSB_PCICORE_H_ */
diff --git a/include/linux/ssb/ssb_regs.h b/include/linux/ssb/ssb_regs.h
new file mode 100644
index 000000000000..47c7c71a5acf
--- /dev/null
+++ b/include/linux/ssb/ssb_regs.h
@@ -0,0 +1,292 @@
1#ifndef LINUX_SSB_REGS_H_
2#define LINUX_SSB_REGS_H_
3
4
5/* SiliconBackplane Address Map.
6 * All regions may not exist on all chips.
7 */
8#define SSB_SDRAM_BASE 0x00000000U /* Physical SDRAM */
9#define SSB_PCI_MEM 0x08000000U /* Host Mode sb2pcitranslation0 (64 MB) */
10#define SSB_PCI_CFG 0x0c000000U /* Host Mode sb2pcitranslation1 (64 MB) */
11#define SSB_SDRAM_SWAPPED 0x10000000U /* Byteswapped Physical SDRAM */
12#define SSB_ENUM_BASE 0x18000000U /* Enumeration space base */
13#define SSB_ENUM_LIMIT 0x18010000U /* Enumeration space limit */
14
15#define SSB_FLASH2 0x1c000000U /* Flash Region 2 (region 1 shadowed here) */
16#define SSB_FLASH2_SZ 0x02000000U /* Size of Flash Region 2 */
17
18#define SSB_EXTIF_BASE 0x1f000000U /* External Interface region base address */
19#define SSB_FLASH1 0x1fc00000U /* Flash Region 1 */
20#define SSB_FLASH1_SZ 0x00400000U /* Size of Flash Region 1 */
21
22#define SSB_PCI_DMA 0x40000000U /* Client Mode sb2pcitranslation2 (1 GB) */
23#define SSB_PCI_DMA_SZ 0x40000000U /* Client Mode sb2pcitranslation2 size in bytes */
24#define SSB_PCIE_DMA_L32 0x00000000U /* PCIE Client Mode sb2pcitranslation2 (2 ZettaBytes), low 32 bits */
25#define SSB_PCIE_DMA_H32 0x80000000U /* PCIE Client Mode sb2pcitranslation2 (2 ZettaBytes), high 32 bits */
26#define SSB_EUART (SSB_EXTIF_BASE + 0x00800000)
27#define SSB_LED (SSB_EXTIF_BASE + 0x00900000)
28
29
30/* Enumeration space constants */
31#define SSB_CORE_SIZE 0x1000 /* Size of a core MMIO area */
32#define SSB_MAX_NR_CORES ((SSB_ENUM_LIMIT - SSB_ENUM_BASE) / SSB_CORE_SIZE)
33
34
35/* mips address */
36#define SSB_EJTAG 0xff200000 /* MIPS EJTAG space (2M) */
37
38
39/* SSB PCI config space registers. */
40#define SSB_PMCSR 0x44
41#define SSB_PE 0x100
42#define SSB_BAR0_WIN 0x80 /* Backplane address space 0 */
43#define SSB_BAR1_WIN 0x84 /* Backplane address space 1 */
44#define SSB_SPROMCTL 0x88 /* SPROM control */
45#define SSB_SPROMCTL_WE 0x10 /* SPROM write enable */
46#define SSB_BAR1_CONTROL 0x8c /* Address space 1 burst control */
47#define SSB_PCI_IRQS 0x90 /* PCI interrupts */
48#define SSB_PCI_IRQMASK 0x94 /* PCI IRQ control and mask (pcirev >= 6 only) */
49#define SSB_BACKPLANE_IRQS 0x98 /* Backplane Interrupts */
50#define SSB_GPIO_IN 0xB0 /* GPIO Input (pcirev >= 3 only) */
51#define SSB_GPIO_OUT 0xB4 /* GPIO Output (pcirev >= 3 only) */
52#define SSB_GPIO_OUT_ENABLE 0xB8 /* GPIO Output Enable/Disable (pcirev >= 3 only) */
53#define SSB_GPIO_SCS 0x10 /* PCI config space bit 4 for 4306c0 slow clock source */
54#define SSB_GPIO_HWRAD 0x20 /* PCI config space GPIO 13 for hw radio disable */
55#define SSB_GPIO_XTAL 0x40 /* PCI config space GPIO 14 for Xtal powerup */
56#define SSB_GPIO_PLL 0x80 /* PCI config space GPIO 15 for PLL powerdown */
57
58
59#define SSB_BAR0_MAX_RETRIES 50
60
61/* Silicon backplane configuration register definitions */
62#define SSB_IPSFLAG 0x0F08
63#define SSB_IPSFLAG_IRQ1 0x0000003F /* which sbflags get routed to mips interrupt 1 */
64#define SSB_IPSFLAG_IRQ1_SHIFT 0
65#define SSB_IPSFLAG_IRQ2 0x00003F00 /* which sbflags get routed to mips interrupt 2 */
66#define SSB_IPSFLAG_IRQ2_SHIFT 8
67#define SSB_IPSFLAG_IRQ3 0x003F0000 /* which sbflags get routed to mips interrupt 3 */
68#define SSB_IPSFLAG_IRQ3_SHIFT 16
69#define SSB_IPSFLAG_IRQ4 0x3F000000 /* which sbflags get routed to mips interrupt 4 */
70#define SSB_IPSFLAG_IRQ4_SHIFT 24
71#define SSB_TPSFLAG 0x0F18
72#define SSB_TPSFLAG_BPFLAG 0x0000003F /* Backplane flag # */
73#define SSB_TPSFLAG_ALWAYSIRQ 0x00000040 /* IRQ is always sent on the Backplane */
74#define SSB_TMERRLOGA 0x0F48
75#define SSB_TMERRLOG 0x0F50
76#define SSB_ADMATCH3 0x0F60
77#define SSB_ADMATCH2 0x0F68
78#define SSB_ADMATCH1 0x0F70
79#define SSB_IMSTATE 0x0F90 /* SB Initiator Agent State */
80#define SSB_IMSTATE_PC 0x0000000f /* Pipe Count */
81#define SSB_IMSTATE_AP_MASK 0x00000030 /* Arbitration Priority */
82#define SSB_IMSTATE_AP_BOTH 0x00000000 /* Use both timeslices and token */
83#define SSB_IMSTATE_AP_TS 0x00000010 /* Use timeslices only */
84#define SSB_IMSTATE_AP_TK 0x00000020 /* Use token only */
85#define SSB_IMSTATE_AP_RSV 0x00000030 /* Reserved */
86#define SSB_IMSTATE_IBE 0x00020000 /* In Band Error */
87#define SSB_IMSTATE_TO 0x00040000 /* Timeout */
88#define SSB_INTVEC 0x0F94 /* SB Interrupt Mask */
89#define SSB_INTVEC_PCI 0x00000001 /* Enable interrupts for PCI */
90#define SSB_INTVEC_ENET0 0x00000002 /* Enable interrupts for enet 0 */
91#define SSB_INTVEC_ILINE20 0x00000004 /* Enable interrupts for iline20 */
92#define SSB_INTVEC_CODEC 0x00000008 /* Enable interrupts for v90 codec */
93#define SSB_INTVEC_USB 0x00000010 /* Enable interrupts for usb */
94#define SSB_INTVEC_EXTIF 0x00000020 /* Enable interrupts for external i/f */
95#define SSB_INTVEC_ENET1 0x00000040 /* Enable interrupts for enet 1 */
96#define SSB_TMSLOW 0x0F98 /* SB Target State Low */
97#define SSB_TMSLOW_RESET 0x00000001 /* Reset */
98#define SSB_TMSLOW_REJECT_22 0x00000002 /* Reject (Backplane rev 2.2) */
99#define SSB_TMSLOW_REJECT_23 0x00000004 /* Reject (Backplane rev 2.3) */
100#define SSB_TMSLOW_CLOCK 0x00010000 /* Clock Enable */
101#define SSB_TMSLOW_FGC 0x00020000 /* Force Gated Clocks On */
102#define SSB_TMSLOW_PE 0x40000000 /* Power Management Enable */
103#define SSB_TMSLOW_BE 0x80000000 /* BIST Enable */
104#define SSB_TMSHIGH 0x0F9C /* SB Target State High */
105#define SSB_TMSHIGH_SERR 0x00000001 /* S-error */
106#define SSB_TMSHIGH_INT 0x00000002 /* Interrupt */
107#define SSB_TMSHIGH_BUSY 0x00000004 /* Busy */
108#define SSB_TMSHIGH_TO 0x00000020 /* Timeout. Backplane rev >= 2.3 only */
109#define SSB_TMSHIGH_COREFL 0x1FFF0000 /* Core specific flags */
110#define SSB_TMSHIGH_COREFL_SHIFT 16
111#define SSB_TMSHIGH_DMA64 0x10000000 /* 64bit DMA supported */
112#define SSB_TMSHIGH_GCR 0x20000000 /* Gated Clock Request */
113#define SSB_TMSHIGH_BISTF 0x40000000 /* BIST Failed */
114#define SSB_TMSHIGH_BISTD 0x80000000 /* BIST Done */
115#define SSB_BWA0 0x0FA0
116#define SSB_IMCFGLO 0x0FA8
117#define SSB_IMCFGLO_SERTO 0x00000007 /* Service timeout */
118#define SSB_IMCFGLO_REQTO 0x00000070 /* Request timeout */
119#define SSB_IMCFGLO_REQTO_SHIFT 4
120#define SSB_IMCFGLO_CONNID 0x00FF0000 /* Connection ID */
121#define SSB_IMCFGLO_CONNID_SHIFT 16
122#define SSB_IMCFGHI 0x0FAC
123#define SSB_ADMATCH0 0x0FB0
124#define SSB_TMCFGLO 0x0FB8
125#define SSB_TMCFGHI 0x0FBC
126#define SSB_BCONFIG 0x0FC0
127#define SSB_BSTATE 0x0FC8
128#define SSB_ACTCFG 0x0FD8
129#define SSB_FLAGST 0x0FE8
130#define SSB_IDLOW 0x0FF8
131#define SSB_IDLOW_CFGSP 0x00000003 /* Config Space */
132#define SSB_IDLOW_ADDRNGE 0x00000038 /* Address Ranges supported */
133#define SSB_IDLOW_ADDRNGE_SHIFT 3
134#define SSB_IDLOW_SYNC 0x00000040
135#define SSB_IDLOW_INITIATOR 0x00000080
136#define SSB_IDLOW_MIBL 0x00000F00 /* Minimum Backplane latency */
137#define SSB_IDLOW_MIBL_SHIFT 8
138#define SSB_IDLOW_MABL 0x0000F000 /* Maximum Backplane latency */
139#define SSB_IDLOW_MABL_SHIFT 12
140#define SSB_IDLOW_TIF 0x00010000 /* This Initiator is first */
141#define SSB_IDLOW_CCW 0x000C0000 /* Cycle counter width */
142#define SSB_IDLOW_CCW_SHIFT 18
143#define SSB_IDLOW_TPT 0x00F00000 /* Target ports */
144#define SSB_IDLOW_TPT_SHIFT 20
145#define SSB_IDLOW_INITP 0x0F000000 /* Initiator ports */
146#define SSB_IDLOW_INITP_SHIFT 24
147#define SSB_IDLOW_SSBREV 0xF0000000 /* Sonics Backplane Revision code */
148#define SSB_IDLOW_SSBREV_22 0x00000000 /* <= 2.2 */
149#define SSB_IDLOW_SSBREV_23 0x10000000 /* 2.3 */
150#define SSB_IDHIGH 0x0FFC /* SB Identification High */
151#define SSB_IDHIGH_RCLO 0x0000000F /* Revision Code (low part) */
152#define SSB_IDHIGH_CC 0x00008FF0 /* Core Code */
153#define SSB_IDHIGH_CC_SHIFT 4
154#define SSB_IDHIGH_RCHI 0x00007000 /* Revision Code (high part) */
155#define SSB_IDHIGH_RCHI_SHIFT 8 /* yes, shift 8 is right */
156#define SSB_IDHIGH_VC 0xFFFF0000 /* Vendor Code */
157#define SSB_IDHIGH_VC_SHIFT 16
158
159/* SPROM shadow area. If not otherwise noted, fields are
160 * two bytes wide. Note that the SPROM can _only_ be read
161 * in two-byte quantinies.
162 */
163#define SSB_SPROMSIZE_WORDS 64
164#define SSB_SPROMSIZE_BYTES (SSB_SPROMSIZE_WORDS * sizeof(u16))
165#define SSB_SPROM_BASE 0x1000
166#define SSB_SPROM_REVISION 0x107E
167#define SSB_SPROM_REVISION_REV 0x00FF /* SPROM Revision number */
168#define SSB_SPROM_REVISION_CRC 0xFF00 /* SPROM CRC8 value */
169#define SSB_SPROM_REVISION_CRC_SHIFT 8
170/* SPROM Revision 1 */
171#define SSB_SPROM1_SPID 0x1004 /* Subsystem Product ID for PCI */
172#define SSB_SPROM1_SVID 0x1006 /* Subsystem Vendor ID for PCI */
173#define SSB_SPROM1_PID 0x1008 /* Product ID for PCI */
174#define SSB_SPROM1_IL0MAC 0x1048 /* 6 bytes MAC address for 802.11b/g */
175#define SSB_SPROM1_ET0MAC 0x104E /* 6 bytes MAC address for Ethernet */
176#define SSB_SPROM1_ET1MAC 0x1054 /* 6 bytes MAC address for 802.11a */
177#define SSB_SPROM1_ETHPHY 0x105A /* Ethernet PHY settings */
178#define SSB_SPROM1_ETHPHY_ET0A 0x001F /* MII Address for enet0 */
179#define SSB_SPROM1_ETHPHY_ET1A 0x03E0 /* MII Address for enet1 */
180#define SSB_SPROM1_ETHPHY_ET1A_SHIFT 5
181#define SSB_SPROM1_ETHPHY_ET0M (1<<14) /* MDIO for enet0 */
182#define SSB_SPROM1_ETHPHY_ET1M (1<<15) /* MDIO for enet1 */
183#define SSB_SPROM1_BINF 0x105C /* Board info */
184#define SSB_SPROM1_BINF_BREV 0x00FF /* Board Revision */
185#define SSB_SPROM1_BINF_CCODE 0x0F00 /* Country Code */
186#define SSB_SPROM1_BINF_CCODE_SHIFT 8
187#define SSB_SPROM1_BINF_ANTA 0x3000 /* Available A-PHY antennas */
188#define SSB_SPROM1_BINF_ANTA_SHIFT 12
189#define SSB_SPROM1_BINF_ANTBG 0xC000 /* Available B-PHY antennas */
190#define SSB_SPROM1_BINF_ANTBG_SHIFT 14
191#define SSB_SPROM1_PA0B0 0x105E
192#define SSB_SPROM1_PA0B1 0x1060
193#define SSB_SPROM1_PA0B2 0x1062
194#define SSB_SPROM1_GPIOA 0x1064 /* General Purpose IO pins 0 and 1 */
195#define SSB_SPROM1_GPIOA_P0 0x00FF /* Pin 0 */
196#define SSB_SPROM1_GPIOA_P1 0xFF00 /* Pin 1 */
197#define SSB_SPROM1_GPIOA_P1_SHIFT 8
198#define SSB_SPROM1_GPIOB 0x1066 /* General Purpuse IO pins 2 and 3 */
199#define SSB_SPROM1_GPIOB_P2 0x00FF /* Pin 2 */
200#define SSB_SPROM1_GPIOB_P3 0xFF00 /* Pin 3 */
201#define SSB_SPROM1_GPIOB_P3_SHIFT 8
202#define SSB_SPROM1_MAXPWR 0x1068 /* Power Amplifier Max Power */
203#define SSB_SPROM1_MAXPWR_BG 0x00FF /* B-PHY and G-PHY (in dBm Q5.2) */
204#define SSB_SPROM1_MAXPWR_A 0xFF00 /* A-PHY (in dBm Q5.2) */
205#define SSB_SPROM1_MAXPWR_A_SHIFT 8
206#define SSB_SPROM1_PA1B0 0x106A
207#define SSB_SPROM1_PA1B1 0x106C
208#define SSB_SPROM1_PA1B2 0x106E
209#define SSB_SPROM1_ITSSI 0x1070 /* Idle TSSI Target */
210#define SSB_SPROM1_ITSSI_BG 0x00FF /* B-PHY and G-PHY*/
211#define SSB_SPROM1_ITSSI_A 0xFF00 /* A-PHY */
212#define SSB_SPROM1_ITSSI_A_SHIFT 8
213#define SSB_SPROM1_BFLLO 0x1072 /* Boardflags (low 16 bits) */
214#define SSB_SPROM1_AGAIN 0x1074 /* Antenna Gain (in dBm Q5.2) */
215#define SSB_SPROM1_AGAIN_A 0x00FF /* A-PHY */
216#define SSB_SPROM1_AGAIN_BG 0xFF00 /* B-PHY and G-PHY */
217#define SSB_SPROM1_AGAIN_BG_SHIFT 8
218#define SSB_SPROM1_OEM 0x1076 /* 8 bytes OEM string (rev 1 only) */
219/* SPROM Revision 2 (inherits from rev 1) */
220#define SSB_SPROM2_BFLHI 0x1038 /* Boardflags (high 16 bits) */
221#define SSB_SPROM2_MAXP_A 0x103A /* A-PHY Max Power */
222#define SSB_SPROM2_MAXP_A_HI 0x00FF /* Max Power High */
223#define SSB_SPROM2_MAXP_A_LO 0xFF00 /* Max Power Low */
224#define SSB_SPROM2_MAXP_A_LO_SHIFT 8
225#define SSB_SPROM2_PA1LOB0 0x103C /* A-PHY PowerAmplifier Low Settings */
226#define SSB_SPROM2_PA1LOB1 0x103E /* A-PHY PowerAmplifier Low Settings */
227#define SSB_SPROM2_PA1LOB2 0x1040 /* A-PHY PowerAmplifier Low Settings */
228#define SSB_SPROM2_PA1HIB0 0x1042 /* A-PHY PowerAmplifier High Settings */
229#define SSB_SPROM2_PA1HIB1 0x1044 /* A-PHY PowerAmplifier High Settings */
230#define SSB_SPROM2_PA1HIB2 0x1046 /* A-PHY PowerAmplifier High Settings */
231#define SSB_SPROM2_OPO 0x1078 /* OFDM Power Offset from CCK Level */
232#define SSB_SPROM2_OPO_VALUE 0x00FF
233#define SSB_SPROM2_OPO_UNUSED 0xFF00
234#define SSB_SPROM2_CCODE 0x107C /* Two char Country Code */
235/* SPROM Revision 3 (inherits from rev 2) */
236#define SSB_SPROM3_OFDMAPO 0x102C /* A-PHY OFDM Mid Power Offset (4 bytes, BigEndian) */
237#define SSB_SPROM3_OFDMALPO 0x1030 /* A-PHY OFDM Low Power Offset (4 bytes, BigEndian) */
238#define SSB_SPROM3_OFDMAHPO 0x1034 /* A-PHY OFDM High Power Offset (4 bytes, BigEndian) */
239#define SSB_SPROM3_GPIOLDC 0x1042 /* GPIO LED Powersave Duty Cycle (4 bytes, BigEndian) */
240#define SSB_SPROM3_GPIOLDC_OFF 0x0000FF00 /* Off Count */
241#define SSB_SPROM3_GPIOLDC_OFF_SHIFT 8
242#define SSB_SPROM3_GPIOLDC_ON 0x00FF0000 /* On Count */
243#define SSB_SPROM3_GPIOLDC_ON_SHIFT 16
244#define SSB_SPROM3_CCKPO 0x1078 /* CCK Power Offset */
245#define SSB_SPROM3_CCKPO_1M 0x000F /* 1M Rate PO */
246#define SSB_SPROM3_CCKPO_2M 0x00F0 /* 2M Rate PO */
247#define SSB_SPROM3_CCKPO_2M_SHIFT 4
248#define SSB_SPROM3_CCKPO_55M 0x0F00 /* 5.5M Rate PO */
249#define SSB_SPROM3_CCKPO_55M_SHIFT 8
250#define SSB_SPROM3_CCKPO_11M 0xF000 /* 11M Rate PO */
251#define SSB_SPROM3_CCKPO_11M_SHIFT 12
252#define SSB_SPROM3_OFDMGPO 0x107A /* G-PHY OFDM Power Offset (4 bytes, BigEndian) */
253
254/* Values for SSB_SPROM1_BINF_CCODE */
255enum {
256 SSB_SPROM1CCODE_WORLD = 0,
257 SSB_SPROM1CCODE_THAILAND,
258 SSB_SPROM1CCODE_ISRAEL,
259 SSB_SPROM1CCODE_JORDAN,
260 SSB_SPROM1CCODE_CHINA,
261 SSB_SPROM1CCODE_JAPAN,
262 SSB_SPROM1CCODE_USA_CANADA_ANZ,
263 SSB_SPROM1CCODE_EUROPE,
264 SSB_SPROM1CCODE_USA_LOW,
265 SSB_SPROM1CCODE_JAPAN_HIGH,
266 SSB_SPROM1CCODE_ALL,
267 SSB_SPROM1CCODE_NONE,
268};
269
270/* Address-Match values and masks (SSB_ADMATCHxxx) */
271#define SSB_ADM_TYPE 0x00000003 /* Address type */
272#define SSB_ADM_TYPE0 0
273#define SSB_ADM_TYPE1 1
274#define SSB_ADM_TYPE2 2
275#define SSB_ADM_AD64 0x00000004
276#define SSB_ADM_SZ0 0x000000F8 /* Type0 size */
277#define SSB_ADM_SZ0_SHIFT 3
278#define SSB_ADM_SZ1 0x000001F8 /* Type1 size */
279#define SSB_ADM_SZ1_SHIFT 3
280#define SSB_ADM_SZ2 0x000001F8 /* Type2 size */
281#define SSB_ADM_SZ2_SHIFT 3
282#define SSB_ADM_EN 0x00000400 /* Enable */
283#define SSB_ADM_NEG 0x00000800 /* Negative decode */
284#define SSB_ADM_BASE0 0xFFFFFF00 /* Type0 base address */
285#define SSB_ADM_BASE0_SHIFT 8
286#define SSB_ADM_BASE1 0xFFFFF000 /* Type1 base address for the core */
287#define SSB_ADM_BASE1_SHIFT 12
288#define SSB_ADM_BASE2 0xFFFF0000 /* Type2 base address for the core */
289#define SSB_ADM_BASE2_SHIFT 16
290
291
292#endif /* LINUX_SSB_REGS_H_ */
diff --git a/include/linux/stacktrace.h b/include/linux/stacktrace.h
index 1d2b084c0185..e7fa657d0c49 100644
--- a/include/linux/stacktrace.h
+++ b/include/linux/stacktrace.h
@@ -13,7 +13,7 @@ extern void save_stack_trace(struct stack_trace *trace);
13extern void print_stack_trace(struct stack_trace *trace, int spaces); 13extern void print_stack_trace(struct stack_trace *trace, int spaces);
14#else 14#else
15# define save_stack_trace(trace) do { } while (0) 15# define save_stack_trace(trace) do { } while (0)
16# define print_stack_trace(trace) do { } while (0) 16# define print_stack_trace(trace, spaces) do { } while (0)
17#endif 17#endif
18 18
19#endif 19#endif
diff --git a/include/linux/string.h b/include/linux/string.h
index 7f2eb6a477f9..836062b7582a 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -105,8 +105,12 @@ extern void * memchr(const void *,int,__kernel_size_t);
105#endif 105#endif
106 106
107extern char *kstrdup(const char *s, gfp_t gfp); 107extern char *kstrdup(const char *s, gfp_t gfp);
108extern char *kstrndup(const char *s, size_t len, gfp_t gfp);
108extern void *kmemdup(const void *src, size_t len, gfp_t gfp); 109extern void *kmemdup(const void *src, size_t len, gfp_t gfp);
109 110
111extern char **argv_split(gfp_t gfp, const char *str, int *argcp);
112extern void argv_free(char **argv);
113
110#ifdef __cplusplus 114#ifdef __cplusplus
111} 115}
112#endif 116#endif
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
index 9e340fa23c06..c6b53d181bfa 100644
--- a/include/linux/sunrpc/xdr.h
+++ b/include/linux/sunrpc/xdr.h
@@ -12,6 +12,7 @@
12#include <linux/uio.h> 12#include <linux/uio.h>
13#include <asm/byteorder.h> 13#include <asm/byteorder.h>
14#include <linux/scatterlist.h> 14#include <linux/scatterlist.h>
15#include <linux/smp_lock.h>
15 16
16/* 17/*
17 * Buffer adjustment 18 * Buffer adjustment
@@ -36,6 +37,21 @@ struct xdr_netobj {
36typedef int (*kxdrproc_t)(void *rqstp, __be32 *data, void *obj); 37typedef int (*kxdrproc_t)(void *rqstp, __be32 *data, void *obj);
37 38
38/* 39/*
40 * We're still requiring the BKL in the xdr code until it's been
41 * more carefully audited, at which point this wrapper will become
42 * unnecessary.
43 */
44static inline int rpc_call_xdrproc(kxdrproc_t xdrproc, void *rqstp, __be32 *data, void *obj)
45{
46 int ret;
47
48 lock_kernel();
49 ret = xdrproc(rqstp, data, obj);
50 unlock_kernel();
51 return ret;
52}
53
54/*
39 * Basic structure for transmission/reception of a client XDR message. 55 * Basic structure for transmission/reception of a client XDR message.
40 * Features a header (for a linear buffer containing RPC headers 56 * Features a header (for a linear buffer containing RPC headers
41 * and the data payload for short messages), and then an array of 57 * and the data payload for short messages), and then an array of
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 9c7cb6430666..388cace9751f 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -24,7 +24,7 @@ struct pbe {
24extern void drain_local_pages(void); 24extern void drain_local_pages(void);
25extern void mark_free_pages(struct zone *zone); 25extern void mark_free_pages(struct zone *zone);
26 26
27#if defined(CONFIG_PM) && defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE) 27#if defined(CONFIG_PM_SLEEP) && defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE)
28extern int pm_prepare_console(void); 28extern int pm_prepare_console(void);
29extern void pm_restore_console(void); 29extern void pm_restore_console(void);
30#else 30#else
@@ -43,14 +43,18 @@ static inline void pm_restore_console(void) {}
43 * @prepare: prepare system for hibernation 43 * @prepare: prepare system for hibernation
44 * @enter: shut down system after state has been saved to disk 44 * @enter: shut down system after state has been saved to disk
45 * @finish: finish/clean up after state has been reloaded 45 * @finish: finish/clean up after state has been reloaded
46 * @pre_restore: prepare system for the restoration from a hibernation image
47 * @restore_cleanup: clean up after a failing image restoration
46 */ 48 */
47struct hibernation_ops { 49struct hibernation_ops {
48 int (*prepare)(void); 50 int (*prepare)(void);
49 int (*enter)(void); 51 int (*enter)(void);
50 void (*finish)(void); 52 void (*finish)(void);
53 int (*pre_restore)(void);
54 void (*restore_cleanup)(void);
51}; 55};
52 56
53#if defined(CONFIG_PM) && defined(CONFIG_SOFTWARE_SUSPEND) 57#ifdef CONFIG_HIBERNATION
54/* kernel/power/snapshot.c */ 58/* kernel/power/snapshot.c */
55extern void __register_nosave_region(unsigned long b, unsigned long e, int km); 59extern void __register_nosave_region(unsigned long b, unsigned long e, int km);
56static inline void register_nosave_region(unsigned long b, unsigned long e) 60static inline void register_nosave_region(unsigned long b, unsigned long e)
@@ -68,21 +72,62 @@ extern unsigned long get_safe_page(gfp_t gfp_mask);
68 72
69extern void hibernation_set_ops(struct hibernation_ops *ops); 73extern void hibernation_set_ops(struct hibernation_ops *ops);
70extern int hibernate(void); 74extern int hibernate(void);
71#else 75#else /* CONFIG_HIBERNATION */
72static inline void register_nosave_region(unsigned long b, unsigned long e) {}
73static inline void register_nosave_region_late(unsigned long b, unsigned long e) {}
74static inline int swsusp_page_is_forbidden(struct page *p) { return 0; } 76static inline int swsusp_page_is_forbidden(struct page *p) { return 0; }
75static inline void swsusp_set_page_free(struct page *p) {} 77static inline void swsusp_set_page_free(struct page *p) {}
76static inline void swsusp_unset_page_free(struct page *p) {} 78static inline void swsusp_unset_page_free(struct page *p) {}
77 79
78static inline void hibernation_set_ops(struct hibernation_ops *ops) {} 80static inline void hibernation_set_ops(struct hibernation_ops *ops) {}
79static inline int hibernate(void) { return -ENOSYS; } 81static inline int hibernate(void) { return -ENOSYS; }
80#endif /* defined(CONFIG_PM) && defined(CONFIG_SOFTWARE_SUSPEND) */ 82#endif /* CONFIG_HIBERNATION */
81 83
84#ifdef CONFIG_PM_SLEEP
82void save_processor_state(void); 85void save_processor_state(void);
83void restore_processor_state(void); 86void restore_processor_state(void);
84struct saved_context; 87struct saved_context;
85void __save_processor_state(struct saved_context *ctxt); 88void __save_processor_state(struct saved_context *ctxt);
86void __restore_processor_state(struct saved_context *ctxt); 89void __restore_processor_state(struct saved_context *ctxt);
87 90
91/* kernel/power/main.c */
92extern struct blocking_notifier_head pm_chain_head;
93
94static inline int register_pm_notifier(struct notifier_block *nb)
95{
96 return blocking_notifier_chain_register(&pm_chain_head, nb);
97}
98
99static inline int unregister_pm_notifier(struct notifier_block *nb)
100{
101 return blocking_notifier_chain_unregister(&pm_chain_head, nb);
102}
103
104#define pm_notifier(fn, pri) { \
105 static struct notifier_block fn##_nb = \
106 { .notifier_call = fn, .priority = pri }; \
107 register_pm_notifier(&fn##_nb); \
108}
109#else /* !CONFIG_PM_SLEEP */
110
111static inline int register_pm_notifier(struct notifier_block *nb)
112{
113 return 0;
114}
115
116static inline int unregister_pm_notifier(struct notifier_block *nb)
117{
118 return 0;
119}
120
121#define pm_notifier(fn, pri) do { (void)(fn); } while (0)
122#endif /* !CONFIG_PM_SLEEP */
123
124#ifndef CONFIG_HIBERNATION
125static inline void register_nosave_region(unsigned long b, unsigned long e)
126{
127}
128static inline void register_nosave_region_late(unsigned long b, unsigned long e)
129{
130}
131#endif
132
88#endif /* _LINUX_SWSUSP_H */ 133#endif /* _LINUX_SWSUSP_H */
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 665f85f2a3af..edf681a7fd8f 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -221,7 +221,7 @@ extern void swap_unplug_io_fn(struct backing_dev_info *, struct page *);
221/* linux/mm/page_io.c */ 221/* linux/mm/page_io.c */
222extern int swap_readpage(struct file *, struct page *); 222extern int swap_readpage(struct file *, struct page *);
223extern int swap_writepage(struct page *page, struct writeback_control *wbc); 223extern int swap_writepage(struct page *page, struct writeback_control *wbc);
224extern int end_swap_bio_read(struct bio *bio, unsigned int bytes_done, int err); 224extern void end_swap_bio_read(struct bio *bio, int err);
225 225
226/* linux/mm/swap_state.c */ 226/* linux/mm/swap_state.c */
227extern struct address_space swapper_space; 227extern struct address_space swapper_space;
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 83d0ec11235e..61def7c8fbb3 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -549,7 +549,7 @@ asmlinkage long sys_inotify_rm_watch(int fd, u32 wd);
549asmlinkage long sys_spu_run(int fd, __u32 __user *unpc, 549asmlinkage long sys_spu_run(int fd, __u32 __user *unpc,
550 __u32 __user *ustatus); 550 __u32 __user *ustatus);
551asmlinkage long sys_spu_create(const char __user *name, 551asmlinkage long sys_spu_create(const char __user *name,
552 unsigned int flags, mode_t mode); 552 unsigned int flags, mode_t mode, int fd);
553 553
554asmlinkage long sys_mknodat(int dfd, const char __user * filename, int mode, 554asmlinkage long sys_mknodat(int dfd, const char __user * filename, int mode,
555 unsigned dev); 555 unsigned dev);
@@ -610,6 +610,7 @@ asmlinkage long sys_signalfd(int ufd, sigset_t __user *user_mask, size_t sizemas
610asmlinkage long sys_timerfd(int ufd, int clockid, int flags, 610asmlinkage long sys_timerfd(int ufd, int clockid, int flags,
611 const struct itimerspec __user *utmr); 611 const struct itimerspec __user *utmr);
612asmlinkage long sys_eventfd(unsigned int count); 612asmlinkage long sys_eventfd(unsigned int count);
613asmlinkage long sys_fallocate(int fd, int mode, loff_t offset, loff_t len);
613 614
614int kernel_execve(const char *filename, char *const argv[], char *const envp[]); 615int kernel_execve(const char *filename, char *const argv[], char *const envp[]);
615 616
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 47f1c53332ce..483050c924c3 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -62,7 +62,7 @@ enum
62 CTL_KERN=1, /* General kernel info and control */ 62 CTL_KERN=1, /* General kernel info and control */
63 CTL_VM=2, /* VM management */ 63 CTL_VM=2, /* VM management */
64 CTL_NET=3, /* Networking */ 64 CTL_NET=3, /* Networking */
65 /* was CTL_PROC */ 65 CTL_PROC=4, /* removal breaks strace(1) compilation */
66 CTL_FS=5, /* Filesystems */ 66 CTL_FS=5, /* Filesystems */
67 CTL_DEBUG=6, /* Debugging */ 67 CTL_DEBUG=6, /* Debugging */
68 CTL_DEV=7, /* Devices */ 68 CTL_DEV=7, /* Devices */
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index be8228e50a27..149ab62329e2 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -3,6 +3,8 @@
3 * 3 *
4 * Copyright (c) 2001,2002 Patrick Mochel 4 * Copyright (c) 2001,2002 Patrick Mochel
5 * Copyright (c) 2004 Silicon Graphics, Inc. 5 * Copyright (c) 2004 Silicon Graphics, Inc.
6 * Copyright (c) 2007 SUSE Linux Products GmbH
7 * Copyright (c) 2007 Tejun Heo <teheo@suse.de>
6 * 8 *
7 * Please see Documentation/filesystems/sysfs.txt for more information. 9 * Please see Documentation/filesystems/sysfs.txt for more information.
8 */ 10 */
@@ -17,23 +19,20 @@
17 19
18struct kobject; 20struct kobject;
19struct module; 21struct module;
20struct nameidata;
21struct dentry;
22struct sysfs_dirent;
23 22
24/* FIXME 23/* FIXME
25 * The *owner field is no longer used, but leave around 24 * The *owner field is no longer used, but leave around
26 * until the tree gets cleaned up fully. 25 * until the tree gets cleaned up fully.
27 */ 26 */
28struct attribute { 27struct attribute {
29 const char * name; 28 const char *name;
30 struct module * owner; 29 struct module *owner;
31 mode_t mode; 30 mode_t mode;
32}; 31};
33 32
34struct attribute_group { 33struct attribute_group {
35 const char * name; 34 const char *name;
36 struct attribute ** attrs; 35 struct attribute **attrs;
37}; 36};
38 37
39 38
@@ -77,72 +76,41 @@ struct sysfs_ops {
77 ssize_t (*store)(struct kobject *,struct attribute *,const char *, size_t); 76 ssize_t (*store)(struct kobject *,struct attribute *,const char *, size_t);
78}; 77};
79 78
80#define SYSFS_TYPE_MASK 0x00ff
81#define SYSFS_ROOT 0x0001
82#define SYSFS_DIR 0x0002
83#define SYSFS_KOBJ_ATTR 0x0004
84#define SYSFS_KOBJ_BIN_ATTR 0x0008
85#define SYSFS_KOBJ_LINK 0x0020
86#define SYSFS_COPY_NAME (SYSFS_DIR | SYSFS_KOBJ_LINK)
87
88#define SYSFS_FLAG_MASK ~SYSFS_TYPE_MASK
89#define SYSFS_FLAG_REMOVED 0x0100
90
91#ifdef CONFIG_SYSFS 79#ifdef CONFIG_SYSFS
92 80
93extern int sysfs_schedule_callback(struct kobject *kobj, 81int sysfs_schedule_callback(struct kobject *kobj, void (*func)(void *),
94 void (*func)(void *), void *data, struct module *owner); 82 void *data, struct module *owner);
95
96extern int __must_check
97sysfs_create_dir(struct kobject *kobj, struct sysfs_dirent *shadow_parent_sd);
98
99extern void
100sysfs_remove_dir(struct kobject *);
101
102extern int __must_check
103sysfs_rename_dir(struct kobject *kobj, struct sysfs_dirent *new_parent_sd,
104 const char *new_name);
105
106extern int __must_check
107sysfs_move_dir(struct kobject *, struct kobject *);
108
109extern int __must_check
110sysfs_create_file(struct kobject *, const struct attribute *);
111 83
112extern int __must_check 84int __must_check sysfs_create_dir(struct kobject *kobj);
113sysfs_update_file(struct kobject *, const struct attribute *); 85void sysfs_remove_dir(struct kobject *kobj);
86int __must_check sysfs_rename_dir(struct kobject *kobj, const char *new_name);
87int __must_check sysfs_move_dir(struct kobject *kobj,
88 struct kobject *new_parent_kobj);
114 89
115extern int __must_check 90int __must_check sysfs_create_file(struct kobject *kobj,
116sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, mode_t mode); 91 const struct attribute *attr);
117 92int __must_check sysfs_chmod_file(struct kobject *kobj, struct attribute *attr,
118extern void 93 mode_t mode);
119sysfs_remove_file(struct kobject *, const struct attribute *); 94void sysfs_remove_file(struct kobject *kobj, const struct attribute *attr);
120
121extern int __must_check
122sysfs_create_link(struct kobject * kobj, struct kobject * target, const char * name);
123
124extern void
125sysfs_remove_link(struct kobject *, const char * name);
126 95
127int __must_check sysfs_create_bin_file(struct kobject *kobj, 96int __must_check sysfs_create_bin_file(struct kobject *kobj,
128 struct bin_attribute *attr); 97 struct bin_attribute *attr);
129void sysfs_remove_bin_file(struct kobject *kobj, struct bin_attribute *attr); 98void sysfs_remove_bin_file(struct kobject *kobj, struct bin_attribute *attr);
130 99
131int __must_check sysfs_create_group(struct kobject *, 100int __must_check sysfs_create_link(struct kobject *kobj, struct kobject *target,
132 const struct attribute_group *); 101 const char *name);
133void sysfs_remove_group(struct kobject *, const struct attribute_group *); 102void sysfs_remove_link(struct kobject *kobj, const char *name);
103
104int __must_check sysfs_create_group(struct kobject *kobj,
105 const struct attribute_group *grp);
106void sysfs_remove_group(struct kobject *kobj,
107 const struct attribute_group *grp);
134int sysfs_add_file_to_group(struct kobject *kobj, 108int sysfs_add_file_to_group(struct kobject *kobj,
135 const struct attribute *attr, const char *group); 109 const struct attribute *attr, const char *group);
136void sysfs_remove_file_from_group(struct kobject *kobj, 110void sysfs_remove_file_from_group(struct kobject *kobj,
137 const struct attribute *attr, const char *group); 111 const struct attribute *attr, const char *group);
138
139void sysfs_notify(struct kobject * k, char *dir, char *attr);
140
141 112
142extern int sysfs_make_shadowed_dir(struct kobject *kobj, 113void sysfs_notify(struct kobject *kobj, char *dir, char *attr);
143 void * (*follow_link)(struct dentry *, struct nameidata *));
144extern struct sysfs_dirent *sysfs_create_shadow_dir(struct kobject *kobj);
145extern void sysfs_remove_shadow_dir(struct sysfs_dirent *shadow_sd);
146 114
147extern int __must_check sysfs_init(void); 115extern int __must_check sysfs_init(void);
148 116
@@ -154,75 +122,76 @@ static inline int sysfs_schedule_callback(struct kobject *kobj,
154 return -ENOSYS; 122 return -ENOSYS;
155} 123}
156 124
157static inline int sysfs_create_dir(struct kobject *kobj, 125static inline int sysfs_create_dir(struct kobject *kobj)
158 struct sysfs_dirent *shadow_parent_sd)
159{ 126{
160 return 0; 127 return 0;
161} 128}
162 129
163static inline void sysfs_remove_dir(struct kobject * k) 130static inline void sysfs_remove_dir(struct kobject *kobj)
164{ 131{
165 ; 132 ;
166} 133}
167 134
168static inline int sysfs_rename_dir(struct kobject *kobj, 135static inline int sysfs_rename_dir(struct kobject *kobj, const char *new_name)
169 struct sysfs_dirent *new_parent_sd,
170 const char *new_name)
171{ 136{
172 return 0; 137 return 0;
173} 138}
174 139
175static inline int sysfs_move_dir(struct kobject * k, struct kobject * new_parent) 140static inline int sysfs_move_dir(struct kobject *kobj,
141 struct kobject *new_parent_kobj)
176{ 142{
177 return 0; 143 return 0;
178} 144}
179 145
180static inline int sysfs_create_file(struct kobject * k, const struct attribute * a) 146static inline int sysfs_create_file(struct kobject *kobj,
147 const struct attribute *attr)
181{ 148{
182 return 0; 149 return 0;
183} 150}
184 151
185static inline int sysfs_update_file(struct kobject * k, const struct attribute * a) 152static inline int sysfs_chmod_file(struct kobject *kobj,
186{ 153 struct attribute *attr, mode_t mode)
187 return 0;
188}
189static inline int sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, mode_t mode)
190{ 154{
191 return 0; 155 return 0;
192} 156}
193 157
194static inline void sysfs_remove_file(struct kobject * k, const struct attribute * a) 158static inline void sysfs_remove_file(struct kobject *kobj,
159 const struct attribute *attr)
195{ 160{
196 ; 161 ;
197} 162}
198 163
199static inline int sysfs_create_link(struct kobject * k, struct kobject * t, const char * n) 164static inline int sysfs_create_bin_file(struct kobject *kobj,
165 struct bin_attribute *attr)
200{ 166{
201 return 0; 167 return 0;
202} 168}
203 169
204static inline void sysfs_remove_link(struct kobject * k, const char * name) 170static inline int sysfs_remove_bin_file(struct kobject *kobj,
171 struct bin_attribute *attr)
205{ 172{
206 ; 173 return 0;
207} 174}
208 175
209 176static inline int sysfs_create_link(struct kobject *kobj,
210static inline int sysfs_create_bin_file(struct kobject * k, struct bin_attribute * a) 177 struct kobject *target, const char *name)
211{ 178{
212 return 0; 179 return 0;
213} 180}
214 181
215static inline int sysfs_remove_bin_file(struct kobject * k, struct bin_attribute * a) 182static inline void sysfs_remove_link(struct kobject *kobj, const char *name)
216{ 183{
217 return 0; 184 ;
218} 185}
219 186
220static inline int sysfs_create_group(struct kobject * k, const struct attribute_group *g) 187static inline int sysfs_create_group(struct kobject *kobj,
188 const struct attribute_group *grp)
221{ 189{
222 return 0; 190 return 0;
223} 191}
224 192
225static inline void sysfs_remove_group(struct kobject * k, const struct attribute_group * g) 193static inline void sysfs_remove_group(struct kobject *kobj,
194 const struct attribute_group *grp)
226{ 195{
227 ; 196 ;
228} 197}
@@ -238,14 +207,8 @@ static inline void sysfs_remove_file_from_group(struct kobject *kobj,
238{ 207{
239} 208}
240 209
241static inline void sysfs_notify(struct kobject * k, char *dir, char *attr) 210static inline void sysfs_notify(struct kobject *kobj, char *dir, char *attr)
242{
243}
244
245static inline int sysfs_make_shadowed_dir(struct kobject *kobj,
246 void * (*follow_link)(struct dentry *, struct nameidata *))
247{ 211{
248 return 0;
249} 212}
250 213
251static inline int __must_check sysfs_init(void) 214static inline int __must_check sysfs_init(void)
diff --git a/include/linux/tc_act/tc_nat.h b/include/linux/tc_act/tc_nat.h
new file mode 100644
index 000000000000..e7cf31e8ba79
--- /dev/null
+++ b/include/linux/tc_act/tc_nat.h
@@ -0,0 +1,29 @@
1#ifndef __LINUX_TC_NAT_H
2#define __LINUX_TC_NAT_H
3
4#include <linux/pkt_cls.h>
5#include <linux/types.h>
6
7#define TCA_ACT_NAT 9
8
9enum
10{
11 TCA_NAT_UNSPEC,
12 TCA_NAT_PARMS,
13 TCA_NAT_TM,
14 __TCA_NAT_MAX
15};
16#define TCA_NAT_MAX (__TCA_NAT_MAX - 1)
17
18#define TCA_NAT_FLAG_EGRESS 1
19
20struct tc_nat
21{
22 tc_gen;
23 __be32 old_addr;
24 __be32 new_addr;
25 __be32 mask;
26 __u32 flags;
27};
28
29#endif
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index c6b9f92e8289..c5b94c1a5ee2 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -304,7 +304,6 @@ struct tcp_sock {
304 u32 rtt_seq; /* sequence number to update rttvar */ 304 u32 rtt_seq; /* sequence number to update rttvar */
305 305
306 u32 packets_out; /* Packets which are "in flight" */ 306 u32 packets_out; /* Packets which are "in flight" */
307 u32 left_out; /* Packets which leaved network */
308 u32 retrans_out; /* Retransmitted packets out */ 307 u32 retrans_out; /* Retransmitted packets out */
309/* 308/*
310 * Options received (usually on last packet, some only on SYN packets). 309 * Options received (usually on last packet, some only on SYN packets).
@@ -333,6 +332,9 @@ struct tcp_sock {
333 332
334 struct tcp_sack_block_wire recv_sack_cache[4]; 333 struct tcp_sack_block_wire recv_sack_cache[4];
335 334
335 u32 highest_sack; /* Start seq of globally highest revd SACK
336 * (validity guaranteed only if sacked_out > 0) */
337
336 /* from STCP, retrans queue hinting */ 338 /* from STCP, retrans queue hinting */
337 struct sk_buff* lost_skb_hint; 339 struct sk_buff* lost_skb_hint;
338 340
@@ -341,10 +343,12 @@ struct tcp_sock {
341 struct sk_buff *forward_skb_hint; 343 struct sk_buff *forward_skb_hint;
342 struct sk_buff *fastpath_skb_hint; 344 struct sk_buff *fastpath_skb_hint;
343 345
344 int fastpath_cnt_hint; 346 int fastpath_cnt_hint; /* Lags behind by current skb's pcount
347 * compared to respective fackets_out */
345 int lost_cnt_hint; 348 int lost_cnt_hint;
346 int retransmit_cnt_hint; 349 int retransmit_cnt_hint;
347 int forward_cnt_hint; 350
351 u32 lost_retrans_low; /* Sent seq after any rxmit (lowest) */
348 352
349 u16 advmss; /* Advertised MSS */ 353 u16 advmss; /* Advertised MSS */
350 u16 prior_ssthresh; /* ssthresh saved at recovery start */ 354 u16 prior_ssthresh; /* ssthresh saved at recovery start */
diff --git a/include/linux/time.h b/include/linux/time.h
index ec3b0ced0afe..6a5f503b4f1d 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -4,6 +4,7 @@
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6#ifdef __KERNEL__ 6#ifdef __KERNEL__
7# include <linux/cache.h>
7# include <linux/seqlock.h> 8# include <linux/seqlock.h>
8#endif 9#endif
9 10
@@ -94,17 +95,15 @@ extern struct timespec wall_to_monotonic;
94extern seqlock_t xtime_lock __attribute__((weak)); 95extern seqlock_t xtime_lock __attribute__((weak));
95 96
96extern unsigned long read_persistent_clock(void); 97extern unsigned long read_persistent_clock(void);
98extern int update_persistent_clock(struct timespec now);
99extern int no_sync_cmos_clock __read_mostly;
97void timekeeping_init(void); 100void timekeeping_init(void);
98 101
99static inline unsigned long get_seconds(void) 102unsigned long get_seconds(void);
100{
101 return xtime.tv_sec;
102}
103
104struct timespec current_kernel_time(void); 103struct timespec current_kernel_time(void);
105 104
106#define CURRENT_TIME (current_kernel_time()) 105#define CURRENT_TIME (current_kernel_time())
107#define CURRENT_TIME_SEC ((struct timespec) { xtime.tv_sec, 0 }) 106#define CURRENT_TIME_SEC ((struct timespec) { get_seconds(), 0 })
108 107
109extern void do_gettimeofday(struct timeval *tv); 108extern void do_gettimeofday(struct timeval *tv);
110extern int do_settimeofday(struct timespec *tv); 109extern int do_settimeofday(struct timespec *tv);
diff --git a/include/linux/timex.h b/include/linux/timex.h
index da929dbbea2a..37ac3ff90faf 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -224,66 +224,6 @@ static inline int ntp_synced(void)
224 __x < 0 ? -(-__x >> __s) : __x >> __s; \ 224 __x < 0 ? -(-__x >> __s) : __x >> __s; \
225}) 225})
226 226
227
228#ifdef CONFIG_TIME_INTERPOLATION
229
230#define TIME_SOURCE_CPU 0
231#define TIME_SOURCE_MMIO64 1
232#define TIME_SOURCE_MMIO32 2
233#define TIME_SOURCE_FUNCTION 3
234
235/* For proper operations time_interpolator clocks must run slightly slower
236 * than the standard clock since the interpolator may only correct by having
237 * time jump forward during a tick. A slower clock is usually a side effect
238 * of the integer divide of the nanoseconds in a second by the frequency.
239 * The accuracy of the division can be increased by specifying a shift.
240 * However, this may cause the clock not to be slow enough.
241 * The interpolator will self-tune the clock by slowing down if no
242 * resets occur or speeding up if the time jumps per analysis cycle
243 * become too high.
244 *
245 * Setting jitter compensates for a fluctuating timesource by comparing
246 * to the last value read from the timesource to insure that an earlier value
247 * is not returned by a later call. The price to pay
248 * for the compensation is that the timer routines are not as scalable anymore.
249 */
250
251struct time_interpolator {
252 u16 source; /* time source flags */
253 u8 shift; /* increases accuracy of multiply by shifting. */
254 /* Note that bits may be lost if shift is set too high */
255 u8 jitter; /* if set compensate for fluctuations */
256 u32 nsec_per_cyc; /* set by register_time_interpolator() */
257 void *addr; /* address of counter or function */
258 cycles_t mask; /* mask the valid bits of the counter */
259 unsigned long offset; /* nsec offset at last update of interpolator */
260 u64 last_counter; /* counter value in units of the counter at last update */
261 cycles_t last_cycle; /* Last timer value if TIME_SOURCE_JITTER is set */
262 u64 frequency; /* frequency in counts/second */
263 long drift; /* drift in parts-per-million (or -1) */
264 unsigned long skips; /* skips forward */
265 unsigned long ns_skipped; /* nanoseconds skipped */
266 struct time_interpolator *next;
267};
268
269extern void register_time_interpolator(struct time_interpolator *);
270extern void unregister_time_interpolator(struct time_interpolator *);
271extern void time_interpolator_reset(void);
272extern unsigned long time_interpolator_get_offset(void);
273extern void time_interpolator_update(long delta_nsec);
274
275#else /* !CONFIG_TIME_INTERPOLATION */
276
277static inline void time_interpolator_reset(void)
278{
279}
280
281static inline void time_interpolator_update(long delta_nsec)
282{
283}
284
285#endif /* !CONFIG_TIME_INTERPOLATION */
286
287#define TICK_LENGTH_SHIFT 32 227#define TICK_LENGTH_SHIFT 32
288 228
289#ifdef CONFIG_NO_HZ 229#ifdef CONFIG_NO_HZ
diff --git a/include/linux/topology.h b/include/linux/topology.h
index d0890a7e5bab..525d437b1253 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -185,7 +185,6 @@
185 .max_interval = 64*num_online_cpus(), \ 185 .max_interval = 64*num_online_cpus(), \
186 .busy_factor = 128, \ 186 .busy_factor = 128, \
187 .imbalance_pct = 133, \ 187 .imbalance_pct = 133, \
188 .cache_hot_time = (10*1000000), \
189 .cache_nice_tries = 1, \ 188 .cache_nice_tries = 1, \
190 .busy_idx = 3, \ 189 .busy_idx = 3, \
191 .idle_idx = 3, \ 190 .idle_idx = 3, \
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 691a1748d9d2..60478f6e5dc6 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -21,7 +21,6 @@
21 * (Note: the *_driver.minor_start values 1, 64, 128, 192 are 21 * (Note: the *_driver.minor_start values 1, 64, 128, 192 are
22 * hardcoded at present.) 22 * hardcoded at present.)
23 */ 23 */
24#define NR_PTYS CONFIG_LEGACY_PTY_COUNT /* Number of legacy ptys */
25#define NR_UNIX98_PTY_DEFAULT 4096 /* Default maximum for Unix98 ptys */ 24#define NR_UNIX98_PTY_DEFAULT 4096 /* Default maximum for Unix98 ptys */
26#define NR_UNIX98_PTY_MAX (1 << MINORBITS) /* Absolute limit */ 25#define NR_UNIX98_PTY_MAX (1 << MINORBITS) /* Absolute limit */
27#define NR_LDISCS 17 26#define NR_LDISCS 17
@@ -274,6 +273,8 @@ struct tty_struct {
274#define TTY_PTY_LOCK 16 /* pty private */ 273#define TTY_PTY_LOCK 16 /* pty private */
275#define TTY_NO_WRITE_SPLIT 17 /* Preserve write boundaries to driver */ 274#define TTY_NO_WRITE_SPLIT 17 /* Preserve write boundaries to driver */
276#define TTY_HUPPED 18 /* Post driver->hangup() */ 275#define TTY_HUPPED 18 /* Post driver->hangup() */
276#define TTY_FLUSHING 19 /* Flushing to ldisc in progress */
277#define TTY_FLUSHPENDING 20 /* Queued buffer flush pending */
277 278
278#define TTY_WRITE_FLUSH(tty) tty_write_flush((tty)) 279#define TTY_WRITE_FLUSH(tty) tty_write_flush((tty))
279 280
diff --git a/include/linux/uio_driver.h b/include/linux/uio_driver.h
new file mode 100644
index 000000000000..44c28e94df50
--- /dev/null
+++ b/include/linux/uio_driver.h
@@ -0,0 +1,91 @@
1/*
2 * include/linux/uio_driver.h
3 *
4 * Copyright(C) 2005, Benedikt Spranger <b.spranger@linutronix.de>
5 * Copyright(C) 2005, Thomas Gleixner <tglx@linutronix.de>
6 * Copyright(C) 2006, Hans J. Koch <hjk@linutronix.de>
7 * Copyright(C) 2006, Greg Kroah-Hartman <greg@kroah.com>
8 *
9 * Userspace IO driver.
10 *
11 * Licensed under the GPLv2 only.
12 */
13
14#ifndef _UIO_DRIVER_H_
15#define _UIO_DRIVER_H_
16
17#include <linux/module.h>
18#include <linux/fs.h>
19#include <linux/interrupt.h>
20
21/**
22 * struct uio_mem - description of a UIO memory region
23 * @kobj: kobject for this mapping
24 * @addr: address of the device's memory
25 * @size: size of IO
26 * @memtype: type of memory addr points to
27 * @internal_addr: ioremap-ped version of addr, for driver internal use
28 */
29struct uio_mem {
30 struct kobject kobj;
31 unsigned long addr;
32 unsigned long size;
33 int memtype;
34 void __iomem *internal_addr;
35};
36
37#define MAX_UIO_MAPS 5
38
39struct uio_device;
40
41/**
42 * struct uio_info - UIO device capabilities
43 * @uio_dev: the UIO device this info belongs to
44 * @name: device name
45 * @version: device driver version
46 * @mem: list of mappable memory regions, size==0 for end of list
47 * @irq: interrupt number or UIO_IRQ_CUSTOM
48 * @irq_flags: flags for request_irq()
49 * @priv: optional private data
50 * @handler: the device's irq handler
51 * @mmap: mmap operation for this uio device
52 * @open: open operation for this uio device
53 * @release: release operation for this uio device
54 */
55struct uio_info {
56 struct uio_device *uio_dev;
57 char *name;
58 char *version;
59 struct uio_mem mem[MAX_UIO_MAPS];
60 long irq;
61 unsigned long irq_flags;
62 void *priv;
63 irqreturn_t (*handler)(int irq, struct uio_info *dev_info);
64 int (*mmap)(struct uio_info *info, struct vm_area_struct *vma);
65 int (*open)(struct uio_info *info, struct inode *inode);
66 int (*release)(struct uio_info *info, struct inode *inode);
67};
68
69extern int __must_check
70 __uio_register_device(struct module *owner,
71 struct device *parent,
72 struct uio_info *info);
73static inline int __must_check
74 uio_register_device(struct device *parent, struct uio_info *info)
75{
76 return __uio_register_device(THIS_MODULE, parent, info);
77}
78extern void uio_unregister_device(struct uio_info *info);
79extern void uio_event_notify(struct uio_info *info);
80
81/* defines for uio_device->irq */
82#define UIO_IRQ_CUSTOM -1
83#define UIO_IRQ_NONE -2
84
85/* defines for uio_device->memtype */
86#define UIO_MEM_NONE 0
87#define UIO_MEM_PHYS 1
88#define UIO_MEM_LOGICAL 2
89#define UIO_MEM_VIRTUAL 3
90
91#endif /* _LINUX_UIO_DRIVER_H_ */
diff --git a/include/linux/umem.h b/include/linux/umem.h
deleted file mode 100644
index f36ebfc32bf6..000000000000
--- a/include/linux/umem.h
+++ /dev/null
@@ -1,138 +0,0 @@
1
2/*
3 * This file contains defines for the
4 * Micro Memory MM5415
5 * family PCI Memory Module with Battery Backup.
6 *
7 * Copyright Micro Memory INC 2001. All rights reserved.
8 * Release under the terms of the GNU GENERAL PUBLIC LICENSE version 2.
9 * See the file COPYING.
10 */
11
12#ifndef _DRIVERS_BLOCK_MM_H
13#define _DRIVERS_BLOCK_MM_H
14
15
16#define IRQ_TIMEOUT (1 * HZ)
17
18/* CSR register definition */
19#define MEMCTRLSTATUS_MAGIC 0x00
20#define MM_MAGIC_VALUE (unsigned char)0x59
21
22#define MEMCTRLSTATUS_BATTERY 0x04
23#define BATTERY_1_DISABLED 0x01
24#define BATTERY_1_FAILURE 0x02
25#define BATTERY_2_DISABLED 0x04
26#define BATTERY_2_FAILURE 0x08
27
28#define MEMCTRLSTATUS_MEMORY 0x07
29#define MEM_128_MB 0xfe
30#define MEM_256_MB 0xfc
31#define MEM_512_MB 0xf8
32#define MEM_1_GB 0xf0
33#define MEM_2_GB 0xe0
34
35#define MEMCTRLCMD_LEDCTRL 0x08
36#define LED_REMOVE 2
37#define LED_FAULT 4
38#define LED_POWER 6
39#define LED_FLIP 255
40#define LED_OFF 0x00
41#define LED_ON 0x01
42#define LED_FLASH_3_5 0x02
43#define LED_FLASH_7_0 0x03
44#define LED_POWER_ON 0x00
45#define LED_POWER_OFF 0x01
46#define USER_BIT1 0x01
47#define USER_BIT2 0x02
48
49#define MEMORY_INITIALIZED USER_BIT1
50
51#define MEMCTRLCMD_ERRCTRL 0x0C
52#define EDC_NONE_DEFAULT 0x00
53#define EDC_NONE 0x01
54#define EDC_STORE_READ 0x02
55#define EDC_STORE_CORRECT 0x03
56
57#define MEMCTRLCMD_ERRCNT 0x0D
58#define MEMCTRLCMD_ERRSTATUS 0x0E
59
60#define ERROR_DATA_LOG 0x20
61#define ERROR_ADDR_LOG 0x28
62#define ERROR_COUNT 0x3D
63#define ERROR_SYNDROME 0x3E
64#define ERROR_CHECK 0x3F
65
66#define DMA_PCI_ADDR 0x40
67#define DMA_LOCAL_ADDR 0x48
68#define DMA_TRANSFER_SIZE 0x50
69#define DMA_DESCRIPTOR_ADDR 0x58
70#define DMA_SEMAPHORE_ADDR 0x60
71#define DMA_STATUS_CTRL 0x68
72#define DMASCR_GO 0x00001
73#define DMASCR_TRANSFER_READ 0x00002
74#define DMASCR_CHAIN_EN 0x00004
75#define DMASCR_SEM_EN 0x00010
76#define DMASCR_DMA_COMP_EN 0x00020
77#define DMASCR_CHAIN_COMP_EN 0x00040
78#define DMASCR_ERR_INT_EN 0x00080
79#define DMASCR_PARITY_INT_EN 0x00100
80#define DMASCR_ANY_ERR 0x00800
81#define DMASCR_MBE_ERR 0x01000
82#define DMASCR_PARITY_ERR_REP 0x02000
83#define DMASCR_PARITY_ERR_DET 0x04000
84#define DMASCR_SYSTEM_ERR_SIG 0x08000
85#define DMASCR_TARGET_ABT 0x10000
86#define DMASCR_MASTER_ABT 0x20000
87#define DMASCR_DMA_COMPLETE 0x40000
88#define DMASCR_CHAIN_COMPLETE 0x80000
89
90/*
913.SOME PCs HAVE HOST BRIDGES WHICH APPARENTLY DO NOT CORRECTLY HANDLE
92READ-LINE (0xE) OR READ-MULTIPLE (0xC) PCI COMMAND CODES DURING DMA
93TRANSFERS. IN OTHER SYSTEMS THESE COMMAND CODES WILL CAUSE THE HOST BRIDGE
94TO ALLOW LONGER BURSTS DURING DMA READ OPERATIONS. THE UPPER FOUR BITS
95(31..28) OF THE DMA CSR HAVE BEEN MADE PROGRAMMABLE, SO THAT EITHER A 0x6,
96AN 0xE OR A 0xC CAN BE WRITTEN TO THEM TO SET THE COMMAND CODE USED DURING
97DMA READ OPERATIONS.
98*/
99#define DMASCR_READ 0x60000000
100#define DMASCR_READLINE 0xE0000000
101#define DMASCR_READMULTI 0xC0000000
102
103
104#define DMASCR_ERROR_MASK (DMASCR_MASTER_ABT | DMASCR_TARGET_ABT | DMASCR_SYSTEM_ERR_SIG | DMASCR_PARITY_ERR_DET | DMASCR_MBE_ERR | DMASCR_ANY_ERR)
105#define DMASCR_HARD_ERROR (DMASCR_MASTER_ABT | DMASCR_TARGET_ABT | DMASCR_SYSTEM_ERR_SIG | DMASCR_PARITY_ERR_DET | DMASCR_MBE_ERR)
106
107#define WINDOWMAP_WINNUM 0x7B
108
109#define DMA_READ_FROM_HOST 0
110#define DMA_WRITE_TO_HOST 1
111
112struct mm_dma_desc {
113 __le64 pci_addr;
114 __le64 local_addr;
115 __le32 transfer_size;
116 u32 zero1;
117 __le64 next_desc_addr;
118 __le64 sem_addr;
119 __le32 control_bits;
120 u32 zero2;
121
122 dma_addr_t data_dma_handle;
123
124 /* Copy of the bits */
125 __le64 sem_control_bits;
126} __attribute__((aligned(8)));
127
128#define PCI_VENDOR_ID_MICRO_MEMORY 0x1332
129#define PCI_DEVICE_ID_MICRO_MEMORY_5415CN 0x5415
130#define PCI_DEVICE_ID_MICRO_MEMORY_5425CN 0x5425
131#define PCI_DEVICE_ID_MICRO_MEMORY_6155 0x6155
132
133/* bits for card->flags */
134#define UM_FLAG_DMA_IN_REGS 1
135#define UM_FLAG_NO_BYTE_STATUS 2
136#define UM_FLAG_NO_BATTREG 4
137#define UM_FLAG_NO_BATT 8
138#endif
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 7a60946df3b6..c5c8f169d3cf 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -52,6 +52,7 @@ struct ep_device;
52 * @ep_dev: ep_device for sysfs info 52 * @ep_dev: ep_device for sysfs info
53 * @extra: descriptors following this endpoint in the configuration 53 * @extra: descriptors following this endpoint in the configuration
54 * @extralen: how many bytes of "extra" are valid 54 * @extralen: how many bytes of "extra" are valid
55 * @enabled: URBs may be submitted to this endpoint
55 * 56 *
56 * USB requests are always queued to a given endpoint, identified by a 57 * USB requests are always queued to a given endpoint, identified by a
57 * descriptor within an active interface in a given USB configuration. 58 * descriptor within an active interface in a given USB configuration.
@@ -64,6 +65,7 @@ struct usb_host_endpoint {
64 65
65 unsigned char *extra; /* Extra descriptors */ 66 unsigned char *extra; /* Extra descriptors */
66 int extralen; 67 int extralen;
68 int enabled;
67}; 69};
68 70
69/* host-side wrapper for one interface setting's parsed descriptors */ 71/* host-side wrapper for one interface setting's parsed descriptors */
@@ -94,6 +96,7 @@ enum usb_interface_condition {
94 * endpoint configurations. They will be in no particular order. 96 * endpoint configurations. They will be in no particular order.
95 * @num_altsetting: number of altsettings defined. 97 * @num_altsetting: number of altsettings defined.
96 * @cur_altsetting: the current altsetting. 98 * @cur_altsetting: the current altsetting.
99 * @intf_assoc: interface association descriptor
97 * @driver: the USB driver that is bound to this interface. 100 * @driver: the USB driver that is bound to this interface.
98 * @minor: the minor number assigned to this interface, if this 101 * @minor: the minor number assigned to this interface, if this
99 * interface is bound to a driver that uses the USB major number. 102 * interface is bound to a driver that uses the USB major number.
@@ -213,6 +216,7 @@ struct usb_interface_cache {
213 * @desc: the device's configuration descriptor. 216 * @desc: the device's configuration descriptor.
214 * @string: pointer to the cached version of the iConfiguration string, if 217 * @string: pointer to the cached version of the iConfiguration string, if
215 * present for this configuration. 218 * present for this configuration.
219 * @intf_assoc: list of any interface association descriptors in this config
216 * @interface: array of pointers to usb_interface structures, one for each 220 * @interface: array of pointers to usb_interface structures, one for each
217 * interface in the configuration. The number of interfaces is stored 221 * interface in the configuration. The number of interfaces is stored
218 * in desc.bNumInterfaces. These pointers are valid only while the 222 * in desc.bNumInterfaces. These pointers are valid only while the
@@ -342,6 +346,11 @@ struct usb_tt;
342 * 346 *
343 * Usbcore drivers should not set usbdev->state directly. Instead use 347 * Usbcore drivers should not set usbdev->state directly. Instead use
344 * usb_set_device_state(). 348 * usb_set_device_state().
349 *
350 * @authorized: (user space) policy determines if we authorize this
351 * device to be used or not. By default, wired USB
352 * devices are authorized. WUSB devices are not, until we
353 * authorize them from user space. FIXME -- complete doc
345 */ 354 */
346struct usb_device { 355struct usb_device {
347 int devnum; /* Address on USB bus */ 356 int devnum; /* Address on USB bus */
@@ -374,8 +383,11 @@ struct usb_device {
374 u8 portnum; /* Parent port number (origin 1) */ 383 u8 portnum; /* Parent port number (origin 1) */
375 u8 level; /* Number of USB hub ancestors */ 384 u8 level; /* Number of USB hub ancestors */
376 385
386 unsigned can_submit:1; /* URBs may be submitted */
377 unsigned discon_suspended:1; /* Disconnected while suspended */ 387 unsigned discon_suspended:1; /* Disconnected while suspended */
378 unsigned have_langid:1; /* whether string_langid is valid */ 388 unsigned have_langid:1; /* whether string_langid is valid */
389 unsigned authorized:1; /* Policy has determined we can use it */
390 unsigned wusb:1; /* Device is Wireless USB */
379 int string_langid; /* language ID for strings */ 391 int string_langid; /* language ID for strings */
380 392
381 /* static strings from the device */ 393 /* static strings from the device */
@@ -403,6 +415,7 @@ struct usb_device {
403 415
404 int pm_usage_cnt; /* usage counter for autosuspend */ 416 int pm_usage_cnt; /* usage counter for autosuspend */
405 u32 quirks; /* quirks of the whole device */ 417 u32 quirks; /* quirks of the whole device */
418 atomic_t urbnum; /* number of URBs submitted for the whole device */
406 419
407#ifdef CONFIG_PM 420#ifdef CONFIG_PM
408 struct delayed_work autosuspend; /* for delayed autosuspends */ 421 struct delayed_work autosuspend; /* for delayed autosuspends */
@@ -417,6 +430,7 @@ struct usb_device {
417 unsigned persist_enabled:1; /* USB_PERSIST enabled for this dev */ 430 unsigned persist_enabled:1; /* USB_PERSIST enabled for this dev */
418 unsigned autosuspend_disabled:1; /* autosuspend and autoresume */ 431 unsigned autosuspend_disabled:1; /* autosuspend and autoresume */
419 unsigned autoresume_disabled:1; /* disabled by the user */ 432 unsigned autoresume_disabled:1; /* disabled by the user */
433 unsigned skip_sys_resume:1; /* skip the next system resume */
420#endif 434#endif
421}; 435};
422#define to_usb_device(d) container_of(d, struct usb_device, dev) 436#define to_usb_device(d) container_of(d, struct usb_device, dev)
@@ -553,6 +567,29 @@ static inline int usb_make_path (struct usb_device *dev, char *buf,
553/*-------------------------------------------------------------------------*/ 567/*-------------------------------------------------------------------------*/
554 568
555/** 569/**
570 * usb_endpoint_num - get the endpoint's number
571 * @epd: endpoint to be checked
572 *
573 * Returns @epd's number: 0 to 15.
574 */
575static inline int usb_endpoint_num(const struct usb_endpoint_descriptor *epd)
576{
577 return epd->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
578}
579
580/**
581 * usb_endpoint_type - get the endpoint's transfer type
582 * @epd: endpoint to be checked
583 *
584 * Returns one of USB_ENDPOINT_XFER_{CONTROL, ISOC, BULK, INT} according
585 * to @epd's transfer type.
586 */
587static inline int usb_endpoint_type(const struct usb_endpoint_descriptor *epd)
588{
589 return epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK;
590}
591
592/**
556 * usb_endpoint_dir_in - check if the endpoint has IN direction 593 * usb_endpoint_dir_in - check if the endpoint has IN direction
557 * @epd: endpoint to be checked 594 * @epd: endpoint to be checked
558 * 595 *
@@ -994,6 +1031,8 @@ extern int usb_disabled(void);
994 1031
995/* 1032/*
996 * urb->transfer_flags: 1033 * urb->transfer_flags:
1034 *
1035 * Note: URB_DIR_IN/OUT is automatically set in usb_submit_urb().
997 */ 1036 */
998#define URB_SHORT_NOT_OK 0x0001 /* report short reads as errors */ 1037#define URB_SHORT_NOT_OK 0x0001 /* report short reads as errors */
999#define URB_ISO_ASAP 0x0002 /* iso-only, urb->start_frame 1038#define URB_ISO_ASAP 0x0002 /* iso-only, urb->start_frame
@@ -1006,6 +1045,10 @@ extern int usb_disabled(void);
1006 * needed */ 1045 * needed */
1007#define URB_FREE_BUFFER 0x0100 /* Free transfer buffer with the URB */ 1046#define URB_FREE_BUFFER 0x0100 /* Free transfer buffer with the URB */
1008 1047
1048#define URB_DIR_IN 0x0200 /* Transfer from device to host */
1049#define URB_DIR_OUT 0
1050#define URB_DIR_MASK URB_DIR_IN
1051
1009struct usb_iso_packet_descriptor { 1052struct usb_iso_packet_descriptor {
1010 unsigned int offset; 1053 unsigned int offset;
1011 unsigned int length; /* expected length */ 1054 unsigned int length; /* expected length */
@@ -1035,6 +1078,8 @@ typedef void (*usb_complete_t)(struct urb *);
1035 * @urb_list: For use by current owner of the URB. 1078 * @urb_list: For use by current owner of the URB.
1036 * @anchor_list: membership in the list of an anchor 1079 * @anchor_list: membership in the list of an anchor
1037 * @anchor: to anchor URBs to a common mooring 1080 * @anchor: to anchor URBs to a common mooring
1081 * @ep: Points to the endpoint's data structure. Will eventually
1082 * replace @pipe.
1038 * @pipe: Holds endpoint number, direction, type, and more. 1083 * @pipe: Holds endpoint number, direction, type, and more.
1039 * Create these values with the eight macros available; 1084 * Create these values with the eight macros available;
1040 * usb_{snd,rcv}TYPEpipe(dev,endpoint), where the TYPE is "ctrl" 1085 * usb_{snd,rcv}TYPEpipe(dev,endpoint), where the TYPE is "ctrl"
@@ -1199,10 +1244,10 @@ struct urb
1199{ 1244{
1200 /* private: usb core and host controller only fields in the urb */ 1245 /* private: usb core and host controller only fields in the urb */
1201 struct kref kref; /* reference count of the URB */ 1246 struct kref kref; /* reference count of the URB */
1202 spinlock_t lock; /* lock for the URB */
1203 void *hcpriv; /* private data for host controller */ 1247 void *hcpriv; /* private data for host controller */
1204 atomic_t use_count; /* concurrent submissions counter */ 1248 atomic_t use_count; /* concurrent submissions counter */
1205 u8 reject; /* submissions will fail */ 1249 u8 reject; /* submissions will fail */
1250 int unlinked; /* unlink error code */
1206 1251
1207 /* public: documented fields in the urb that can be used by drivers */ 1252 /* public: documented fields in the urb that can be used by drivers */
1208 struct list_head urb_list; /* list head for use by the urb's 1253 struct list_head urb_list; /* list head for use by the urb's
@@ -1210,6 +1255,7 @@ struct urb
1210 struct list_head anchor_list; /* the URB may be anchored by the driver */ 1255 struct list_head anchor_list; /* the URB may be anchored by the driver */
1211 struct usb_anchor *anchor; 1256 struct usb_anchor *anchor;
1212 struct usb_device *dev; /* (in) pointer to associated device */ 1257 struct usb_device *dev; /* (in) pointer to associated device */
1258 struct usb_host_endpoint *ep; /* (internal) pointer to endpoint struct */
1213 unsigned int pipe; /* (in) pipe information */ 1259 unsigned int pipe; /* (in) pipe information */
1214 int status; /* (return) non-ISO status */ 1260 int status; /* (return) non-ISO status */
1215 unsigned int transfer_flags; /* (in) URB_SHORT_NOT_OK | ...*/ 1261 unsigned int transfer_flags; /* (in) URB_SHORT_NOT_OK | ...*/
@@ -1255,7 +1301,6 @@ static inline void usb_fill_control_urb (struct urb *urb,
1255 usb_complete_t complete_fn, 1301 usb_complete_t complete_fn,
1256 void *context) 1302 void *context)
1257{ 1303{
1258 spin_lock_init(&urb->lock);
1259 urb->dev = dev; 1304 urb->dev = dev;
1260 urb->pipe = pipe; 1305 urb->pipe = pipe;
1261 urb->setup_packet = setup_packet; 1306 urb->setup_packet = setup_packet;
@@ -1286,7 +1331,6 @@ static inline void usb_fill_bulk_urb (struct urb *urb,
1286 usb_complete_t complete_fn, 1331 usb_complete_t complete_fn,
1287 void *context) 1332 void *context)
1288{ 1333{
1289 spin_lock_init(&urb->lock);
1290 urb->dev = dev; 1334 urb->dev = dev;
1291 urb->pipe = pipe; 1335 urb->pipe = pipe;
1292 urb->transfer_buffer = transfer_buffer; 1336 urb->transfer_buffer = transfer_buffer;
@@ -1322,7 +1366,6 @@ static inline void usb_fill_int_urb (struct urb *urb,
1322 void *context, 1366 void *context,
1323 int interval) 1367 int interval)
1324{ 1368{
1325 spin_lock_init(&urb->lock);
1326 urb->dev = dev; 1369 urb->dev = dev;
1327 urb->pipe = pipe; 1370 urb->pipe = pipe;
1328 urb->transfer_buffer = transfer_buffer; 1371 urb->transfer_buffer = transfer_buffer;
@@ -1350,6 +1393,30 @@ extern void usb_unanchor_urb(struct urb *urb);
1350extern int usb_wait_anchor_empty_timeout(struct usb_anchor *anchor, 1393extern int usb_wait_anchor_empty_timeout(struct usb_anchor *anchor,
1351 unsigned int timeout); 1394 unsigned int timeout);
1352 1395
1396/**
1397 * usb_urb_dir_in - check if an URB describes an IN transfer
1398 * @urb: URB to be checked
1399 *
1400 * Returns 1 if @urb describes an IN transfer (device-to-host),
1401 * otherwise 0.
1402 */
1403static inline int usb_urb_dir_in(struct urb *urb)
1404{
1405 return (urb->transfer_flags & URB_DIR_MASK) == URB_DIR_IN;
1406}
1407
1408/**
1409 * usb_urb_dir_out - check if an URB describes an OUT transfer
1410 * @urb: URB to be checked
1411 *
1412 * Returns 1 if @urb describes an OUT transfer (host-to-device),
1413 * otherwise 0.
1414 */
1415static inline int usb_urb_dir_out(struct urb *urb)
1416{
1417 return (urb->transfer_flags & URB_DIR_MASK) == URB_DIR_OUT;
1418}
1419
1353void *usb_buffer_alloc (struct usb_device *dev, size_t size, 1420void *usb_buffer_alloc (struct usb_device *dev, size_t size,
1354 gfp_t mem_flags, dma_addr_t *dma); 1421 gfp_t mem_flags, dma_addr_t *dma);
1355void usb_buffer_free (struct usb_device *dev, size_t size, 1422void usb_buffer_free (struct usb_device *dev, size_t size,
@@ -1362,13 +1429,13 @@ void usb_buffer_unmap (struct urb *urb);
1362#endif 1429#endif
1363 1430
1364struct scatterlist; 1431struct scatterlist;
1365int usb_buffer_map_sg(const struct usb_device *dev, unsigned pipe, 1432int usb_buffer_map_sg(const struct usb_device *dev, int is_in,
1366 struct scatterlist *sg, int nents); 1433 struct scatterlist *sg, int nents);
1367#if 0 1434#if 0
1368void usb_buffer_dmasync_sg(const struct usb_device *dev, unsigned pipe, 1435void usb_buffer_dmasync_sg(const struct usb_device *dev, int is_in,
1369 struct scatterlist *sg, int n_hw_ents); 1436 struct scatterlist *sg, int n_hw_ents);
1370#endif 1437#endif
1371void usb_buffer_unmap_sg(const struct usb_device *dev, unsigned pipe, 1438void usb_buffer_unmap_sg(const struct usb_device *dev, int is_in,
1372 struct scatterlist *sg, int n_hw_ents); 1439 struct scatterlist *sg, int n_hw_ents);
1373 1440
1374/*-------------------------------------------------------------------* 1441/*-------------------------------------------------------------------*
diff --git a/include/linux/usb_gadget.h b/include/linux/usb/gadget.h
index 4f59b2aa8a9e..46705e91573d 100644
--- a/include/linux/usb_gadget.h
+++ b/include/linux/usb/gadget.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * <linux/usb_gadget.h> 2 * <linux/usb/gadget.h>
3 * 3 *
4 * We call the USB code inside a Linux-based peripheral device a "gadget" 4 * We call the USB code inside a Linux-based peripheral device a "gadget"
5 * driver, except for the hardware-specific bus glue. One USB host can 5 * driver, except for the hardware-specific bus glue. One USB host can
@@ -22,10 +22,10 @@ struct usb_ep;
22/** 22/**
23 * struct usb_request - describes one i/o request 23 * struct usb_request - describes one i/o request
24 * @buf: Buffer used for data. Always provide this; some controllers 24 * @buf: Buffer used for data. Always provide this; some controllers
25 * only use PIO, or don't use DMA for some endpoints. 25 * only use PIO, or don't use DMA for some endpoints.
26 * @dma: DMA address corresponding to 'buf'. If you don't set this 26 * @dma: DMA address corresponding to 'buf'. If you don't set this
27 * field, and the usb controller needs one, it is responsible 27 * field, and the usb controller needs one, it is responsible
28 * for mapping and unmapping the buffer. 28 * for mapping and unmapping the buffer.
29 * @length: Length of that data 29 * @length: Length of that data
30 * @no_interrupt: If true, hints that no completion irq is needed. 30 * @no_interrupt: If true, hints that no completion irq is needed.
31 * Helpful sometimes with deep request queues that are handled 31 * Helpful sometimes with deep request queues that are handled
@@ -45,16 +45,16 @@ struct usb_ep;
45 * @context: For use by the completion callback 45 * @context: For use by the completion callback
46 * @list: For use by the gadget driver. 46 * @list: For use by the gadget driver.
47 * @status: Reports completion code, zero or a negative errno. 47 * @status: Reports completion code, zero or a negative errno.
48 * Normally, faults block the transfer queue from advancing until 48 * Normally, faults block the transfer queue from advancing until
49 * the completion callback returns. 49 * the completion callback returns.
50 * Code "-ESHUTDOWN" indicates completion caused by device disconnect, 50 * Code "-ESHUTDOWN" indicates completion caused by device disconnect,
51 * or when the driver disabled the endpoint. 51 * or when the driver disabled the endpoint.
52 * @actual: Reports bytes transferred to/from the buffer. For reads (OUT 52 * @actual: Reports bytes transferred to/from the buffer. For reads (OUT
53 * transfers) this may be less than the requested length. If the 53 * transfers) this may be less than the requested length. If the
54 * short_not_ok flag is set, short reads are treated as errors 54 * short_not_ok flag is set, short reads are treated as errors
55 * even when status otherwise indicates successful completion. 55 * even when status otherwise indicates successful completion.
56 * Note that for writes (IN transfers) some data bytes may still 56 * Note that for writes (IN transfers) some data bytes may still
57 * reside in a device-side FIFO when the request is reported as 57 * reside in a device-side FIFO when the request is reported as
58 * complete. 58 * complete.
59 * 59 *
60 * These are allocated/freed through the endpoint they're used with. The 60 * These are allocated/freed through the endpoint they're used with. The
@@ -128,7 +128,7 @@ struct usb_ep_ops {
128 * value can sometimes be reduced (hardware allowing), according to 128 * value can sometimes be reduced (hardware allowing), according to
129 * the endpoint descriptor used to configure the endpoint. 129 * the endpoint descriptor used to configure the endpoint.
130 * @driver_data:for use by the gadget driver. all other fields are 130 * @driver_data:for use by the gadget driver. all other fields are
131 * read-only to gadget drivers. 131 * read-only to gadget drivers.
132 * 132 *
133 * the bus controller driver lists all the general purpose endpoints in 133 * the bus controller driver lists all the general purpose endpoints in
134 * gadget->ep_list. the control endpoint (gadget->ep0) is not in that list, 134 * gadget->ep_list. the control endpoint (gadget->ep0) is not in that list,
@@ -148,10 +148,10 @@ struct usb_ep {
148/** 148/**
149 * usb_ep_enable - configure endpoint, making it usable 149 * usb_ep_enable - configure endpoint, making it usable
150 * @ep:the endpoint being configured. may not be the endpoint named "ep0". 150 * @ep:the endpoint being configured. may not be the endpoint named "ep0".
151 * drivers discover endpoints through the ep_list of a usb_gadget. 151 * drivers discover endpoints through the ep_list of a usb_gadget.
152 * @desc:descriptor for desired behavior. caller guarantees this pointer 152 * @desc:descriptor for desired behavior. caller guarantees this pointer
153 * remains valid until the endpoint is disabled; the data byte order 153 * remains valid until the endpoint is disabled; the data byte order
154 * is little-endian (usb-standard). 154 * is little-endian (usb-standard).
155 * 155 *
156 * when configurations are set, or when interface settings change, the driver 156 * when configurations are set, or when interface settings change, the driver
157 * will enable or disable the relevant endpoints. while it is enabled, an 157 * will enable or disable the relevant endpoints. while it is enabled, an
@@ -232,7 +232,7 @@ usb_ep_free_request (struct usb_ep *ep, struct usb_request *req)
232 * @ep:the endpoint associated with the request 232 * @ep:the endpoint associated with the request
233 * @req:the request being submitted 233 * @req:the request being submitted
234 * @gfp_flags: GFP_* flags to use in case the lower level driver couldn't 234 * @gfp_flags: GFP_* flags to use in case the lower level driver couldn't
235 * pre-allocate all necessary memory with the request. 235 * pre-allocate all necessary memory with the request.
236 * 236 *
237 * This tells the device controller to perform the specified request through 237 * This tells the device controller to perform the specified request through
238 * that endpoint (reading or writing a buffer). When the request completes, 238 * that endpoint (reading or writing a buffer). When the request completes,
@@ -415,7 +415,7 @@ struct usb_gadget_ops {
415 * struct usb_gadget - represents a usb slave device 415 * struct usb_gadget - represents a usb slave device
416 * @ops: Function pointers used to access hardware-specific operations. 416 * @ops: Function pointers used to access hardware-specific operations.
417 * @ep0: Endpoint zero, used when reading or writing responses to 417 * @ep0: Endpoint zero, used when reading or writing responses to
418 * driver setup() requests 418 * driver setup() requests
419 * @ep_list: List of other endpoints supported by the device. 419 * @ep_list: List of other endpoints supported by the device.
420 * @speed: Speed of current connection to USB host. 420 * @speed: Speed of current connection to USB host.
421 * @is_dualspeed: True if the controller supports both high and full speed 421 * @is_dualspeed: True if the controller supports both high and full speed
@@ -432,7 +432,7 @@ struct usb_gadget_ops {
432 * @b_hnp_enable: OTG device feature flag, indicating that the A-Host 432 * @b_hnp_enable: OTG device feature flag, indicating that the A-Host
433 * enabled HNP support. 433 * enabled HNP support.
434 * @name: Identifies the controller hardware type. Used in diagnostics 434 * @name: Identifies the controller hardware type. Used in diagnostics
435 * and sometimes configuration. 435 * and sometimes configuration.
436 * @dev: Driver model state for this abstract device. 436 * @dev: Driver model state for this abstract device.
437 * 437 *
438 * Gadgets have a mostly-portable "gadget driver" implementing device 438 * Gadgets have a mostly-portable "gadget driver" implementing device
@@ -480,6 +480,39 @@ static inline void *get_gadget_data (struct usb_gadget *gadget)
480 480
481 481
482/** 482/**
483 * gadget_is_dualspeed - return true iff the hardware handles high speed
484 * @gadget: controller that might support both high and full speeds
485 */
486static inline int gadget_is_dualspeed(struct usb_gadget *g)
487{
488#ifdef CONFIG_USB_GADGET_DUALSPEED
489 /* runtime test would check "g->is_dualspeed" ... that might be
490 * useful to work around hardware bugs, but is mostly pointless
491 */
492 return 1;
493#else
494 return 0;
495#endif
496}
497
498/**
499 * gadget_is_otg - return true iff the hardware is OTG-ready
500 * @gadget: controller that might have a Mini-AB connector
501 *
502 * This is a runtime test, since kernels with a USB-OTG stack sometimes
503 * run on boards which only have a Mini-B (or Mini-A) connector.
504 */
505static inline int gadget_is_otg(struct usb_gadget *g)
506{
507#ifdef CONFIG_USB_OTG
508 return g->is_otg;
509#else
510 return 0;
511#endif
512}
513
514
515/**
483 * usb_gadget_frame_number - returns the current frame number 516 * usb_gadget_frame_number - returns the current frame number
484 * @gadget: controller that reports the frame number 517 * @gadget: controller that reports the frame number
485 * 518 *
@@ -655,23 +688,23 @@ usb_gadget_disconnect (struct usb_gadget *gadget)
655 * @function: String describing the gadget's function 688 * @function: String describing the gadget's function
656 * @speed: Highest speed the driver handles. 689 * @speed: Highest speed the driver handles.
657 * @bind: Invoked when the driver is bound to a gadget, usually 690 * @bind: Invoked when the driver is bound to a gadget, usually
658 * after registering the driver. 691 * after registering the driver.
659 * At that point, ep0 is fully initialized, and ep_list holds 692 * At that point, ep0 is fully initialized, and ep_list holds
660 * the currently-available endpoints. 693 * the currently-available endpoints.
661 * Called in a context that permits sleeping. 694 * Called in a context that permits sleeping.
662 * @setup: Invoked for ep0 control requests that aren't handled by 695 * @setup: Invoked for ep0 control requests that aren't handled by
663 * the hardware level driver. Most calls must be handled by 696 * the hardware level driver. Most calls must be handled by
664 * the gadget driver, including descriptor and configuration 697 * the gadget driver, including descriptor and configuration
665 * management. The 16 bit members of the setup data are in 698 * management. The 16 bit members of the setup data are in
666 * USB byte order. Called in_interrupt; this may not sleep. Driver 699 * USB byte order. Called in_interrupt; this may not sleep. Driver
667 * queues a response to ep0, or returns negative to stall. 700 * queues a response to ep0, or returns negative to stall.
668 * @disconnect: Invoked after all transfers have been stopped, 701 * @disconnect: Invoked after all transfers have been stopped,
669 * when the host is disconnected. May be called in_interrupt; this 702 * when the host is disconnected. May be called in_interrupt; this
670 * may not sleep. Some devices can't detect disconnect, so this might 703 * may not sleep. Some devices can't detect disconnect, so this might
671 * not be called except as part of controller shutdown. 704 * not be called except as part of controller shutdown.
672 * @unbind: Invoked when the driver is unbound from a gadget, 705 * @unbind: Invoked when the driver is unbound from a gadget,
673 * usually from rmmod (after a disconnect is reported). 706 * usually from rmmod (after a disconnect is reported).
674 * Called in a context that permits sleeping. 707 * Called in a context that permits sleeping.
675 * @suspend: Invoked on USB suspend. May be called in_interrupt. 708 * @suspend: Invoked on USB suspend. May be called in_interrupt.
676 * @resume: Invoked on USB resume. May be called in_interrupt. 709 * @resume: Invoked on USB resume. May be called in_interrupt.
677 * @driver: Driver model state for this driver. 710 * @driver: Driver model state for this driver.
diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h
index 8da374caf582..2692ec9389ca 100644
--- a/include/linux/usb/quirks.h
+++ b/include/linux/usb/quirks.h
@@ -4,11 +4,8 @@
4 * belong here. 4 * belong here.
5 */ 5 */
6 6
7/* device must not be autosuspended */
8#define USB_QUIRK_NO_AUTOSUSPEND 0x00000001
9
10/* string descriptors must not be fetched using a 255-byte read */ 7/* string descriptors must not be fetched using a 255-byte read */
11#define USB_QUIRK_STRING_FETCH_255 0x00000002 8#define USB_QUIRK_STRING_FETCH_255 0x00000001
12 9
13/* device can't resume correctly so reset it instead */ 10/* device can't resume correctly so reset it instead */
14#define USB_QUIRK_RESET_RESUME 0x00000004 11#define USB_QUIRK_RESET_RESUME 0x00000002
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index e8b8928232c8..488ce128885c 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -141,7 +141,7 @@ struct usb_serial {
141}; 141};
142#define to_usb_serial(d) container_of(d, struct usb_serial, kref) 142#define to_usb_serial(d) container_of(d, struct usb_serial, kref)
143 143
144#define NUM_DONT_CARE (-1) 144#define NUM_DONT_CARE 99
145 145
146/* get and set the serial private data pointer helper functions */ 146/* get and set the serial private data pointer helper functions */
147static inline void *usb_get_serial_data (struct usb_serial *serial) 147static inline void *usb_get_serial_data (struct usb_serial *serial)
@@ -160,12 +160,18 @@ static inline void usb_set_serial_data (struct usb_serial *serial, void *data)
160 * in the syslog messages when a device is inserted or removed. 160 * in the syslog messages when a device is inserted or removed.
161 * @id_table: pointer to a list of usb_device_id structures that define all 161 * @id_table: pointer to a list of usb_device_id structures that define all
162 * of the devices this structure can support. 162 * of the devices this structure can support.
163 * @num_interrupt_in: the number of interrupt in endpoints this device will 163 * @num_interrupt_in: If a device doesn't have this many interrupt-in
164 * have. 164 * endpoints, it won't be sent to the driver's attach() method.
165 * @num_interrupt_out: the number of interrupt out endpoints this device will 165 * (But it might still be sent to the probe() method.)
166 * have. 166 * @num_interrupt_out: If a device doesn't have this many interrupt-out
167 * @num_bulk_in: the number of bulk in endpoints this device will have. 167 * endpoints, it won't be sent to the driver's attach() method.
168 * @num_bulk_out: the number of bulk out endpoints this device will have. 168 * (But it might still be sent to the probe() method.)
169 * @num_bulk_in: If a device doesn't have this many bulk-in
170 * endpoints, it won't be sent to the driver's attach() method.
171 * (But it might still be sent to the probe() method.)
172 * @num_bulk_out: If a device doesn't have this many bulk-out
173 * endpoints, it won't be sent to the driver's attach() method.
174 * (But it might still be sent to the probe() method.)
169 * @num_ports: the number of different ports this device will have. 175 * @num_ports: the number of different ports this device will have.
170 * @calc_num_ports: pointer to a function to determine how many ports this 176 * @calc_num_ports: pointer to a function to determine how many ports this
171 * device has dynamically. It will be called after the probe() 177 * device has dynamically. It will be called after the probe()
diff --git a/include/linux/usb_sl811.h b/include/linux/usb_sl811.h
deleted file mode 100644
index 4f2d012d7309..000000000000
--- a/include/linux/usb_sl811.h
+++ /dev/null
@@ -1,26 +0,0 @@
1
2/*
3 * board initialization should put one of these into dev->platform_data
4 * and place the sl811hs onto platform_bus named "sl811-hcd".
5 */
6
7struct sl811_platform_data {
8 unsigned can_wakeup:1;
9
10 /* given port_power, msec/2 after power on till power good */
11 u8 potpg;
12
13 /* mA/2 power supplied on this port (max = default = 250) */
14 u8 power;
15
16 /* sl811 relies on an external source of VBUS current */
17 void (*port_power)(struct device *dev, int is_on);
18
19 /* pulse sl811 nRST (probably with a GPIO) */
20 void (*reset)(struct device *dev);
21
22 // some boards need something like these:
23 // int (*check_overcurrent)(struct device *dev);
24 // void (*clock_enable)(struct device *dev, int is_on);
25};
26
diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h
index bb320573bb9e..b5f41d4c2eec 100644
--- a/include/linux/user_namespace.h
+++ b/include/linux/user_namespace.h
@@ -11,7 +11,7 @@
11 11
12struct user_namespace { 12struct user_namespace {
13 struct kref kref; 13 struct kref kref;
14 struct list_head uidhash_table[UIDHASH_SZ]; 14 struct hlist_head uidhash_table[UIDHASH_SZ];
15 struct user_struct *root_user; 15 struct user_struct *root_user;
16}; 16};
17 17
@@ -49,7 +49,7 @@ static inline struct user_namespace *copy_user_ns(int flags,
49 if (flags & CLONE_NEWUSER) 49 if (flags & CLONE_NEWUSER)
50 return ERR_PTR(-EINVAL); 50 return ERR_PTR(-EINVAL);
51 51
52 return NULL; 52 return old_ns;
53} 53}
54 54
55static inline void put_user_ns(struct user_namespace *ns) 55static inline void put_user_ns(struct user_namespace *ns)
diff --git a/include/linux/video_output.h b/include/linux/video_output.h
index e63e0c03ee0d..2fb46bc9340d 100644
--- a/include/linux/video_output.h
+++ b/include/linux/video_output.h
@@ -31,9 +31,9 @@ struct output_properties {
31struct output_device { 31struct output_device {
32 int request_state; 32 int request_state;
33 struct output_properties *props; 33 struct output_properties *props;
34 struct class_device class_dev; 34 struct device dev;
35}; 35};
36#define to_output_device(obj) container_of(obj, struct output_device, class_dev) 36#define to_output_device(obj) container_of(obj, struct output_device, dev)
37struct output_device *video_output_register(const char *name, 37struct output_device *video_output_register(const char *name,
38 struct device *dev, 38 struct device *dev,
39 void *devdata, 39 void *devdata,
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index d16a2b57dc81..1f503e94eff1 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -60,6 +60,7 @@
60#include <linux/compiler.h> /* need __user */ 60#include <linux/compiler.h> /* need __user */
61#else 61#else
62#define __user 62#define __user
63#include <sys/time.h>
63#endif 64#endif
64#include <linux/types.h> 65#include <linux/types.h>
65 66
@@ -270,6 +271,7 @@ struct v4l2_pix_format
270 271
271/* Pixel format FOURCC depth Description */ 272/* Pixel format FOURCC depth Description */
272#define V4L2_PIX_FMT_RGB332 v4l2_fourcc('R','G','B','1') /* 8 RGB-3-3-2 */ 273#define V4L2_PIX_FMT_RGB332 v4l2_fourcc('R','G','B','1') /* 8 RGB-3-3-2 */
274#define V4L2_PIX_FMT_RGB444 v4l2_fourcc('R','4','4','4') /* 16 xxxxrrrr ggggbbbb */
273#define V4L2_PIX_FMT_RGB555 v4l2_fourcc('R','G','B','O') /* 16 RGB-5-5-5 */ 275#define V4L2_PIX_FMT_RGB555 v4l2_fourcc('R','G','B','O') /* 16 RGB-5-5-5 */
274#define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R','G','B','P') /* 16 RGB-5-6-5 */ 276#define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R','G','B','P') /* 16 RGB-5-6-5 */
275#define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R','G','B','Q') /* 16 RGB-5-5-5 BE */ 277#define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R','G','B','Q') /* 16 RGB-5-5-5 BE */
@@ -279,6 +281,7 @@ struct v4l2_pix_format
279#define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B','G','R','4') /* 32 BGR-8-8-8-8 */ 281#define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B','G','R','4') /* 32 BGR-8-8-8-8 */
280#define V4L2_PIX_FMT_RGB32 v4l2_fourcc('R','G','B','4') /* 32 RGB-8-8-8-8 */ 282#define V4L2_PIX_FMT_RGB32 v4l2_fourcc('R','G','B','4') /* 32 RGB-8-8-8-8 */
281#define V4L2_PIX_FMT_GREY v4l2_fourcc('G','R','E','Y') /* 8 Greyscale */ 283#define V4L2_PIX_FMT_GREY v4l2_fourcc('G','R','E','Y') /* 8 Greyscale */
284#define V4L2_PIX_FMT_PAL8 v4l2_fourcc('P','A','L','8') /* 8 8-bit palette */
282#define V4L2_PIX_FMT_YVU410 v4l2_fourcc('Y','V','U','9') /* 9 YVU 4:1:0 */ 285#define V4L2_PIX_FMT_YVU410 v4l2_fourcc('Y','V','U','9') /* 9 YVU 4:1:0 */
283#define V4L2_PIX_FMT_YVU420 v4l2_fourcc('Y','V','1','2') /* 12 YVU 4:2:0 */ 286#define V4L2_PIX_FMT_YVU420 v4l2_fourcc('Y','V','1','2') /* 12 YVU 4:2:0 */
284#define V4L2_PIX_FMT_YUYV v4l2_fourcc('Y','U','Y','V') /* 16 YUV 4:2:2 */ 287#define V4L2_PIX_FMT_YUYV v4l2_fourcc('Y','U','Y','V') /* 16 YUV 4:2:2 */
@@ -286,6 +289,10 @@ struct v4l2_pix_format
286#define V4L2_PIX_FMT_YUV422P v4l2_fourcc('4','2','2','P') /* 16 YVU422 planar */ 289#define V4L2_PIX_FMT_YUV422P v4l2_fourcc('4','2','2','P') /* 16 YVU422 planar */
287#define V4L2_PIX_FMT_YUV411P v4l2_fourcc('4','1','1','P') /* 16 YVU411 planar */ 290#define V4L2_PIX_FMT_YUV411P v4l2_fourcc('4','1','1','P') /* 16 YVU411 planar */
288#define V4L2_PIX_FMT_Y41P v4l2_fourcc('Y','4','1','P') /* 12 YUV 4:1:1 */ 291#define V4L2_PIX_FMT_Y41P v4l2_fourcc('Y','4','1','P') /* 12 YUV 4:1:1 */
292#define V4L2_PIX_FMT_YUV444 v4l2_fourcc('Y','4','4','4') /* 16 xxxxyyyy uuuuvvvv */
293#define V4L2_PIX_FMT_YUV555 v4l2_fourcc('Y','U','V','O') /* 16 YUV-5-5-5 */
294#define V4L2_PIX_FMT_YUV565 v4l2_fourcc('Y','U','V','P') /* 16 YUV-5-6-5 */
295#define V4L2_PIX_FMT_YUV32 v4l2_fourcc('Y','U','V','4') /* 32 YUV-8-8-8-8 */
289 296
290/* two planes -- one Y, one Cr + Cb interleaved */ 297/* two planes -- one Y, one Cr + Cb interleaved */
291#define V4L2_PIX_FMT_NV12 v4l2_fourcc('N','V','1','2') /* 12 Y/CbCr 4:2:0 */ 298#define V4L2_PIX_FMT_NV12 v4l2_fourcc('N','V','1','2') /* 12 Y/CbCr 4:2:0 */
@@ -297,7 +304,6 @@ struct v4l2_pix_format
297#define V4L2_PIX_FMT_YYUV v4l2_fourcc('Y','Y','U','V') /* 16 YUV 4:2:2 */ 304#define V4L2_PIX_FMT_YYUV v4l2_fourcc('Y','Y','U','V') /* 16 YUV 4:2:2 */
298#define V4L2_PIX_FMT_HI240 v4l2_fourcc('H','I','2','4') /* 8 8-bit color */ 305#define V4L2_PIX_FMT_HI240 v4l2_fourcc('H','I','2','4') /* 8 8-bit color */
299#define V4L2_PIX_FMT_HM12 v4l2_fourcc('H','M','1','2') /* 8 YUV 4:2:0 16x16 macroblocks */ 306#define V4L2_PIX_FMT_HM12 v4l2_fourcc('H','M','1','2') /* 8 YUV 4:2:0 16x16 macroblocks */
300#define V4L2_PIX_FMT_RGB444 v4l2_fourcc('R','4','4','4') /* 16 xxxxrrrr ggggbbbb */
301 307
302/* see http://www.siliconimaging.com/RGB%20Bayer.htm */ 308/* see http://www.siliconimaging.com/RGB%20Bayer.htm */
303#define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B','A','8','1') /* 8 BGBG.. GRGR.. */ 309#define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B','A','8','1') /* 8 BGBG.. GRGR.. */
@@ -616,7 +622,6 @@ struct v4l2_framebuffer
616#define V4L2_FBUF_CAP_LOCAL_ALPHA 0x0010 622#define V4L2_FBUF_CAP_LOCAL_ALPHA 0x0010
617#define V4L2_FBUF_CAP_GLOBAL_ALPHA 0x0020 623#define V4L2_FBUF_CAP_GLOBAL_ALPHA 0x0020
618#define V4L2_FBUF_CAP_LOCAL_INV_ALPHA 0x0040 624#define V4L2_FBUF_CAP_LOCAL_INV_ALPHA 0x0040
619#define V4L2_FBUF_CAP_GLOBAL_INV_ALPHA 0x0080
620/* Flags for the 'flags' field. */ 625/* Flags for the 'flags' field. */
621#define V4L2_FBUF_FLAG_PRIMARY 0x0001 626#define V4L2_FBUF_FLAG_PRIMARY 0x0001
622#define V4L2_FBUF_FLAG_OVERLAY 0x0002 627#define V4L2_FBUF_FLAG_OVERLAY 0x0002
@@ -624,7 +629,6 @@ struct v4l2_framebuffer
624#define V4L2_FBUF_FLAG_LOCAL_ALPHA 0x0008 629#define V4L2_FBUF_FLAG_LOCAL_ALPHA 0x0008
625#define V4L2_FBUF_FLAG_GLOBAL_ALPHA 0x0010 630#define V4L2_FBUF_FLAG_GLOBAL_ALPHA 0x0010
626#define V4L2_FBUF_FLAG_LOCAL_INV_ALPHA 0x0020 631#define V4L2_FBUF_FLAG_LOCAL_INV_ALPHA 0x0020
627#define V4L2_FBUF_FLAG_GLOBAL_INV_ALPHA 0x0040
628 632
629struct v4l2_clip 633struct v4l2_clip
630{ 634{
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index 132b260aef1e..89338b468d0d 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -58,6 +58,13 @@ void vmalloc_sync_all(void);
58/* 58/*
59 * Lowlevel-APIs (not for driver use!) 59 * Lowlevel-APIs (not for driver use!)
60 */ 60 */
61
62static inline size_t get_vm_area_size(const struct vm_struct *area)
63{
64 /* return actual size without guard page */
65 return area->size - PAGE_SIZE;
66}
67
61extern struct vm_struct *get_vm_area(unsigned long size, unsigned long flags); 68extern struct vm_struct *get_vm_area(unsigned long size, unsigned long flags);
62extern struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags, 69extern struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags,
63 unsigned long start, unsigned long end); 70 unsigned long start, unsigned long end);
@@ -70,6 +77,10 @@ extern int map_vm_area(struct vm_struct *area, pgprot_t prot,
70 struct page ***pages); 77 struct page ***pages);
71extern void unmap_kernel_range(unsigned long addr, unsigned long size); 78extern void unmap_kernel_range(unsigned long addr, unsigned long size);
72 79
80/* Allocate/destroy a 'vmalloc' VM area. */
81extern struct vm_struct *alloc_vm_area(size_t size);
82extern void free_vm_area(struct vm_struct *area);
83
73/* 84/*
74 * Internals. Dont't use.. 85 * Internals. Dont't use..
75 */ 86 */
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 4ef4d22e5e43..c7c3337c3a88 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -5,6 +5,7 @@
5#define WRITEBACK_H 5#define WRITEBACK_H
6 6
7#include <linux/sched.h> 7#include <linux/sched.h>
8#include <linux/fs.h>
8 9
9struct backing_dev_info; 10struct backing_dev_info;
10 11
@@ -127,7 +128,7 @@ int sync_page_range(struct inode *inode, struct address_space *mapping,
127 loff_t pos, loff_t count); 128 loff_t pos, loff_t count);
128int sync_page_range_nolock(struct inode *inode, struct address_space *mapping, 129int sync_page_range_nolock(struct inode *inode, struct address_space *mapping,
129 loff_t pos, loff_t count); 130 loff_t pos, loff_t count);
130void set_page_dirty_balance(struct page *page); 131void set_page_dirty_balance(struct page *page, int page_mkwrite);
131void writeback_set_ratelimit(void); 132void writeback_set_ratelimit(void);
132 133
133/* pdflush.c */ 134/* pdflush.c */
diff --git a/include/linux/xilinxfb.h b/include/linux/xilinxfb.h
new file mode 100644
index 000000000000..f2463f559fb9
--- /dev/null
+++ b/include/linux/xilinxfb.h
@@ -0,0 +1,30 @@
1/*
2 * Platform device data for Xilinx Framebuffer device
3 *
4 * Copyright 2007 Secret Lab Technologies Ltd.
5 *
6 * This file is licensed under the terms of the GNU General Public License
7 * version 2. This program is licensed "as is" without any warranty of any
8 * kind, whether express or implied.
9 */
10
11#ifndef __XILINXFB_H__
12#define __XILINXFB_H__
13
14#include <linux/types.h>
15
16/* ML300/403 reference design framebuffer driver platform data struct */
17struct xilinxfb_platform_data {
18 u32 rotate_screen; /* Flag to rotate display 180 degrees */
19 u32 screen_height_mm; /* Physical dimentions of screen in mm */
20 u32 screen_width_mm;
21 u32 xres, yres; /* resolution of screen in pixels */
22 u32 xvirt, yvirt; /* resolution of memory buffer */
23
24 /* Physical address of framebuffer memory; If non-zero, driver
25 * will use provided memory address instead of allocating one from
26 * the consistent pool. */
27 u32 fb_phys;
28};
29
30#endif /* __XILINXFB_H__ */
diff --git a/include/linux/zlib.h b/include/linux/zlib.h
index 9e3192a7dc6f..40c49cb3eb51 100644
--- a/include/linux/zlib.h
+++ b/include/linux/zlib.h
@@ -82,7 +82,7 @@
82struct internal_state; 82struct internal_state;
83 83
84typedef struct z_stream_s { 84typedef struct z_stream_s {
85 Byte *next_in; /* next input byte */ 85 const Byte *next_in; /* next input byte */
86 uInt avail_in; /* number of bytes available at next_in */ 86 uInt avail_in; /* number of bytes available at next_in */
87 uLong total_in; /* total nb of input bytes read so far */ 87 uLong total_in; /* total nb of input bytes read so far */
88 88
@@ -699,4 +699,8 @@ extern int zlib_inflateInit2(z_streamp strm, int windowBits);
699 struct internal_state {int dummy;}; /* hack for buggy compilers */ 699 struct internal_state {int dummy;}; /* hack for buggy compilers */
700#endif 700#endif
701 701
702/* Utility function: initialize zlib, unpack binary blob, clean up zlib,
703 * return len or negative error code. */
704extern int zlib_inflate_blob(void *dst, unsigned dst_sz, const void *src, unsigned src_sz);
705
702#endif /* _ZLIB_H */ 706#endif /* _ZLIB_H */