aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2007-10-13 09:58:23 -0400
committerDavid Woodhouse <dwmw2@infradead.org>2007-10-13 09:58:23 -0400
commitebf8889bd1fe3615991ff4494635d237280652a2 (patch)
tree10fb735717122bbb86474339eac07f26e7ccdf40 /include/linux
parentb160292cc216a50fd0cd386b0bda2cd48352c73b (diff)
parent752097cec53eea111d087c545179b421e2bde98a (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/arcdevice.h4
-rw-r--r--include/linux/ata.h116
-rw-r--r--include/linux/audit.h9
-rw-r--r--include/linux/backlight.h9
-rw-r--r--include/linux/bio.h6
-rw-r--r--include/linux/blkdev.h39
-rw-r--r--include/linux/blktrace_api.h7
-rw-r--r--include/linux/clockchips.h9
-rw-r--r--include/linux/connector.h2
-rw-r--r--include/linux/cpufreq.h39
-rw-r--r--include/linux/crypto.h214
-rw-r--r--include/linux/dccp.h22
-rw-r--r--include/linux/debugfs.h27
-rw-r--r--include/linux/device.h17
-rw-r--r--include/linux/dmi.h22
-rw-r--r--include/linux/eeprom_93cx6.h3
-rw-r--r--include/linux/elf.h14
-rw-r--r--include/linux/etherdevice.h20
-rw-r--r--include/linux/ethtool.h36
-rw-r--r--include/linux/fs_enet_pd.h6
-rw-r--r--include/linux/gfs2_ondisk.h30
-rw-r--r--include/linux/i2c-id.h2
-rw-r--r--include/linux/ide.h34
-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_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.h1
-rw-r--r--include/linux/init_task.h2
-rw-r--r--include/linux/input.h1
-rw-r--r--include/linux/ipv6.h21
-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/jiffies.h6
-rw-r--r--include/linux/kernel.h14
-rw-r--r--include/linux/kobject.h125
-rw-r--r--include/linux/ktime.h21
-rw-r--r--include/linux/libata.h320
-rw-r--r--include/linux/list.h14
-rw-r--r--include/linux/mdio-bitbang.h42
-rw-r--r--include/linux/mlx4/device.h27
-rw-r--r--include/linux/mmc/card.h32
-rw-r--r--include/linux/mmc/core.h63
-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/mod_devicetable.h26
-rw-r--r--include/linux/net.h3
-rw-r--r--include/linux/netdevice.h500
-rw-r--r--include/linux/netfilter/Kbuild1
-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_time.h25
-rw-r--r--include/linux/netlink.h24
-rw-r--r--include/linux/netpoll.h56
-rw-r--r--include/linux/nl80211.h97
-rw-r--r--include/linux/nsproxy.h1
-rw-r--r--include/linux/of.h1
-rw-r--r--include/linux/pci.h7
-rw-r--r--include/linux/pci_ids.h25
-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/proc_fs.h41
-rw-r--r--include/linux/rfkill.h40
-rw-r--r--include/linux/rtnetlink.h29
-rw-r--r--include/linux/sched.h1
-rw-r--r--include/linux/sctp.h109
-rw-r--r--include/linux/seq_file.h2
-rw-r--r--include/linux/snmp.h33
-rw-r--r--include/linux/spi/mmc_spi.h33
-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/swap.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/tty.h1
-rw-r--r--include/linux/umem.h138
-rw-r--r--include/linux/usb.h79
-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/video_output.h4
-rw-r--r--include/linux/videodev2.h7
-rw-r--r--include/linux/writeback.h1
-rw-r--r--include/linux/xilinxfb.h30
-rw-r--r--include/linux/zlib.h6
106 files changed, 4581 insertions, 973 deletions
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/ata.h b/include/linux/ata.h
index c043c1ccf1c5..a4f373f8b798 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -230,6 +230,12 @@ enum {
230 230
231 SETFEATURES_SPINUP = 0x07, /* Spin-up drive */ 231 SETFEATURES_SPINUP = 0x07, /* Spin-up drive */
232 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
233 /* ATAPI stuff */ 239 /* ATAPI stuff */
234 ATAPI_PKT_DMA = (1 << 0), 240 ATAPI_PKT_DMA = (1 << 0),
235 ATAPI_DMADIR = (1 << 2), /* ATAPI data dir: 241 ATAPI_DMADIR = (1 << 2), /* ATAPI data dir:
@@ -281,6 +287,15 @@ enum {
281 SERR_PROTOCOL = (1 << 10), /* protocol violation */ 287 SERR_PROTOCOL = (1 << 10), /* protocol violation */
282 SERR_INTERNAL = (1 << 11), /* host internal error */ 288 SERR_INTERNAL = (1 << 11), /* host internal error */
283 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 */
284 SERR_DEV_XCHG = (1 << 26), /* device exchanged */ 299 SERR_DEV_XCHG = (1 << 26), /* device exchanged */
285 300
286 /* struct ata_taskfile flags */ 301 /* struct ata_taskfile flags */
@@ -341,24 +356,17 @@ struct ata_taskfile {
341}; 356};
342 357
343#define ata_id_is_ata(id) (((id)[0] & (1 << 15)) == 0) 358#define ata_id_is_ata(id) (((id)[0] & (1 << 15)) == 0)
344#define ata_id_rahead_enabled(id) ((id)[85] & (1 << 6))
345#define ata_id_wcache_enabled(id) ((id)[85] & (1 << 5))
346#define ata_id_hpa_enabled(id) ((id)[85] & (1 << 10))
347#define ata_id_has_fua(id) ((id)[84] & (1 << 6))
348#define ata_id_has_flush(id) ((id)[83] & (1 << 12))
349#define ata_id_has_flush_ext(id) ((id)[83] & (1 << 13))
350#define ata_id_has_lba48(id) ((id)[83] & (1 << 10))
351#define ata_id_has_hpa(id) ((id)[82] & (1 << 10))
352#define ata_id_has_wcache(id) ((id)[82] & (1 << 5))
353#define ata_id_has_pm(id) ((id)[82] & (1 << 3))
354#define ata_id_has_lba(id) ((id)[49] & (1 << 9)) 359#define ata_id_has_lba(id) ((id)[49] & (1 << 9))
355#define ata_id_has_dma(id) ((id)[49] & (1 << 8)) 360#define ata_id_has_dma(id) ((id)[49] & (1 << 8))
356#define ata_id_has_ncq(id) ((id)[76] & (1 << 8)) 361#define ata_id_has_ncq(id) ((id)[76] & (1 << 8))
357#define ata_id_queue_depth(id) (((id)[75] & 0x1f) + 1) 362#define ata_id_queue_depth(id) (((id)[75] & 0x1f) + 1)
358#define ata_id_removeable(id) ((id)[0] & (1 << 7)) 363#define ata_id_removeable(id) ((id)[0] & (1 << 7))
359#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)) )
360#define ata_id_iordy_disable(id) ((id)[49] & (1 << 10)) 368#define ata_id_iordy_disable(id) ((id)[49] & (1 << 10))
361#define ata_id_has_iordy(id) ((id)[49] & (1 << 9)) 369#define ata_id_has_iordy(id) ((id)[49] & (1 << 11))
362#define ata_id_u32(id,n) \ 370#define ata_id_u32(id,n) \
363 (((u32) (id)[(n) + 1] << 16) | ((u32) (id)[(n)])) 371 (((u32) (id)[(n) + 1] << 16) | ((u32) (id)[(n)]))
364#define ata_id_u64(id,n) \ 372#define ata_id_u64(id,n) \
@@ -369,6 +377,90 @@ struct ata_taskfile {
369 377
370#define ata_id_cdb_intr(id) (((id)[0] & 0x60) == 0x20) 378#define ata_id_cdb_intr(id) (((id)[0] & 0x60) == 0x20)
371 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
372static inline unsigned int ata_id_major_version(const u16 *id) 464static inline unsigned int ata_id_major_version(const u16 *id)
373{ 465{
374 unsigned int mver; 466 unsigned int mver;
diff --git a/include/linux/audit.h b/include/linux/audit.h
index d6579df8dadf..9ae740936a65 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -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
diff --git a/include/linux/backlight.h b/include/linux/backlight.h
index c897c7b03858..1ee9488ca2e4 100644
--- a/include/linux/backlight.h
+++ b/include/linux/backlight.h
@@ -92,4 +92,13 @@ static inline void * bl_get_data(struct backlight_device *bl_dev)
92 return dev_get_drvdata(&bl_dev->dev); 92 return dev_get_drvdata(&bl_dev->dev);
93} 93}
94 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};
103
95#endif 104#endif
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 1ddef34f43c3..089a8bc55dd4 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -64,7 +64,7 @@ struct bio_vec {
64 64
65struct bio_set; 65struct bio_set;
66struct bio; 66struct bio;
67typedef int (bio_end_io_t) (struct bio *, unsigned int, int); 67typedef void (bio_end_io_t) (struct bio *, int);
68typedef void (bio_destructor_t) (struct bio *); 68typedef void (bio_destructor_t) (struct bio *);
69 69
70/* 70/*
@@ -226,7 +226,7 @@ struct bio {
226#define BIO_SEG_BOUNDARY(q, b1, b2) \ 226#define BIO_SEG_BOUNDARY(q, b1, b2) \
227 BIOVEC_SEG_BOUNDARY((q), __BVEC_END((b1)), __BVEC_START((b2))) 227 BIOVEC_SEG_BOUNDARY((q), __BVEC_END((b1)), __BVEC_START((b2)))
228 228
229#define bio_io_error(bio, bytes) bio_endio((bio), (bytes), -EIO) 229#define bio_io_error(bio) bio_endio((bio), -EIO)
230 230
231/* 231/*
232 * drivers should not use the __ version unless they _really_ want to 232 * drivers should not use the __ version unless they _really_ want to
@@ -286,7 +286,7 @@ extern struct bio *bio_alloc_bioset(gfp_t, int, struct bio_set *);
286extern void bio_put(struct bio *); 286extern void bio_put(struct bio *);
287extern void bio_free(struct bio *, struct bio_set *); 287extern void bio_free(struct bio *, struct bio_set *);
288 288
289extern void bio_endio(struct bio *, unsigned int, int); 289extern void bio_endio(struct bio *, int);
290struct request_queue; 290struct request_queue;
291extern int bio_phys_segments(struct request_queue *, struct bio *); 291extern int bio_phys_segments(struct request_queue *, struct bio *);
292extern int bio_hw_segments(struct request_queue *, struct bio *); 292extern int bio_hw_segments(struct request_queue *, struct bio *);
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index b126c6f68e27..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,22 +20,6 @@
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;
@@ -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
@@ -637,10 +622,23 @@ static inline void blk_queue_bounce(struct request_queue *q, struct bio **bio)
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);
@@ -662,8 +660,8 @@ 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(struct request_queue *, struct request *, 663extern int blk_rq_append_bio(struct request_queue *q, struct request *rq,
666 struct bio *); 664 struct bio *bio);
667 665
668/* 666/*
669 * 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
@@ -810,7 +808,6 @@ static inline struct request *blk_map_queue_find_tag(struct blk_queue_tag *bqt,
810 return bqt->tag_index[tag]; 808 return bqt->tag_index[tag];
811} 809}
812 810
813extern void blk_rq_bio_prep(struct request_queue *, struct request *, struct bio *);
814extern int blkdev_issue_flush(struct block_device *, sector_t *); 811extern int blkdev_issue_flush(struct block_device *, sector_t *);
815 812
816#define MAX_PHYS_SEGMENTS 128 813#define MAX_PHYS_SEGMENTS 128
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index 7b5d56b82b59..7e11d23ac36a 100644
--- a/include/linux/blktrace_api.h
+++ b/include/linux/blktrace_api.h
@@ -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(struct request_queue *); 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
@@ -286,6 +290,7 @@ static inline void blk_add_trace_remap(struct request_queue *q, struct bio *bio,
286#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)
287#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)
288#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)
289#endif /* CONFIG_BLK_DEV_IO_TRACE */ 294#endif /* CONFIG_BLK_DEV_IO_TRACE */
290 295#endif /* __KERNEL__ */
291#endif 296#endif
diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h
index def5a659b8a5..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>
@@ -126,11 +126,14 @@ extern int clockevents_register_notifier(struct notifier_block *nb);
126extern int clockevents_program_event(struct clock_event_device *dev, 126extern int clockevents_program_event(struct clock_event_device *dev,
127 ktime_t expires, ktime_t now); 127 ktime_t expires, ktime_t now);
128 128
129#ifdef CONFIG_GENERIC_CLOCKEVENTS
129extern void clockevents_notify(unsigned long reason, void *arg); 130extern void clockevents_notify(unsigned long reason, void *arg);
130
131#else 131#else
132# define clockevents_notify(reason, arg) do { } while (0)
133#endif
134
135#else /* CONFIG_GENERIC_CLOCKEVENTS_BUILD */
132 136
133static inline void clockevents_resume_events(void) { }
134#define clockevents_notify(reason, arg) do { } while (0) 137#define clockevents_notify(reason, arg) do { } while (0)
135 138
136#endif 139#endif
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/cpufreq.h b/include/linux/cpufreq.h
index 3ec6e7ff5fbd..23932d7741a9 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -32,12 +32,24 @@
32 * CPUFREQ NOTIFIER INTERFACE * 32 * CPUFREQ NOTIFIER INTERFACE *
33 *********************************************************************/ 33 *********************************************************************/
34 34
35int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list);
36int cpufreq_unregister_notifier(struct notifier_block *nb, unsigned int list);
37
38#define CPUFREQ_TRANSITION_NOTIFIER (0) 35#define CPUFREQ_TRANSITION_NOTIFIER (0)
39#define CPUFREQ_POLICY_NOTIFIER (1) 36#define CPUFREQ_POLICY_NOTIFIER (1)
40 37
38#ifdef CONFIG_CPU_FREQ
39int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list);
40int cpufreq_unregister_notifier(struct notifier_block *nb, unsigned int list);
41#else /* CONFIG_CPU_FREQ */
42static inline int cpufreq_register_notifier(struct notifier_block *nb,
43 unsigned int list)
44{
45 return 0;
46}
47static inline int cpufreq_unregister_notifier(struct notifier_block *nb,
48 unsigned int list)
49{
50 return 0;
51}
52#endif /* CONFIG_CPU_FREQ */
41 53
42/* if (cpufreq_driver->target) exists, the ->governor decides what frequency 54/* if (cpufreq_driver->target) exists, the ->governor decides what frequency
43 * within the limits is used. If (cpufreq_driver->setpolicy> exists, these 55 * within the limits is used. If (cpufreq_driver->setpolicy> exists, these
@@ -155,6 +167,9 @@ struct cpufreq_governor {
155 char name[CPUFREQ_NAME_LEN]; 167 char name[CPUFREQ_NAME_LEN];
156 int (*governor) (struct cpufreq_policy *policy, 168 int (*governor) (struct cpufreq_policy *policy,
157 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 */
158 struct list_head governor_list; 173 struct list_head governor_list;
159 struct module *owner; 174 struct module *owner;
160}; 175};
@@ -279,12 +294,24 @@ static inline unsigned int cpufreq_quick_get(unsigned int cpu)
279 *********************************************************************/ 294 *********************************************************************/
280 295
281 296
282#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
283extern struct cpufreq_governor cpufreq_gov_performance; 302extern struct cpufreq_governor cpufreq_gov_performance;
284#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)
285#elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE) 306#elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE)
286extern struct cpufreq_governor cpufreq_gov_userspace; 307extern struct cpufreq_governor cpufreq_gov_userspace;
287#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)
288#endif 315#endif
289 316
290 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/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 3a38d1f70cb7..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);
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/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/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/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 23ccea811297..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;
@@ -272,6 +287,8 @@ u32 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);
273u32 ethtool_op_get_ufo(struct net_device *dev); 288u32 ethtool_op_get_ufo(struct net_device *dev);
274int 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);
275 292
276/** 293/**
277 * &ethtool_ops - Alter and report network device settings 294 * &ethtool_ops - Alter and report network device settings
@@ -307,6 +324,8 @@ int ethtool_op_set_ufo(struct net_device *dev, u32 data);
307 * 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
308 * phys_id: Identify the device 325 * phys_id: Identify the device
309 * get_stats: Return statistics about the device 326 * get_stats: Return statistics about the device
327 * get_flags: get 32-bit flags bitmap
328 * set_flags: set 32-bit flags bitmap
310 * 329 *
311 * Description: 330 * Description:
312 * 331 *
@@ -359,16 +378,23 @@ struct ethtool_ops {
359 int (*set_sg)(struct net_device *, u32); 378 int (*set_sg)(struct net_device *, u32);
360 u32 (*get_tso)(struct net_device *); 379 u32 (*get_tso)(struct net_device *);
361 int (*set_tso)(struct net_device *, u32); 380 int (*set_tso)(struct net_device *, u32);
362 int (*self_test_count)(struct net_device *);
363 void (*self_test)(struct net_device *, struct ethtool_test *, u64 *); 381 void (*self_test)(struct net_device *, struct ethtool_test *, u64 *);
364 void (*get_strings)(struct net_device *, u32 stringset, u8 *); 382 void (*get_strings)(struct net_device *, u32 stringset, u8 *);
365 int (*phys_id)(struct net_device *, u32); 383 int (*phys_id)(struct net_device *, u32);
366 int (*get_stats_count)(struct net_device *);
367 void (*get_ethtool_stats)(struct net_device *, struct ethtool_stats *, u64 *); 384 void (*get_ethtool_stats)(struct net_device *, struct ethtool_stats *, u64 *);
368 int (*begin)(struct net_device *); 385 int (*begin)(struct net_device *);
369 void (*complete)(struct net_device *); 386 void (*complete)(struct net_device *);
370 u32 (*get_ufo)(struct net_device *); 387 u32 (*get_ufo)(struct net_device *);
371 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 */
372}; 398};
373#endif /* __KERNEL__ */ 399#endif /* __KERNEL__ */
374 400
@@ -410,6 +436,10 @@ struct ethtool_ops {
410#define ETHTOOL_SUFO 0x00000022 /* Set UFO enable (ethtool_value) */ 436#define ETHTOOL_SUFO 0x00000022 /* Set UFO enable (ethtool_value) */
411#define ETHTOOL_GGSO 0x00000023 /* Get GSO enable (ethtool_value) */ 437#define ETHTOOL_GGSO 0x00000023 /* Get GSO enable (ethtool_value) */
412#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 */
413 443
414/* compatibility with older code */ 444/* compatibility with older code */
415#define SPARC_ETH_GSET ETHTOOL_GSET 445#define SPARC_ETH_GSET ETHTOOL_GSET
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/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/i2c-id.h b/include/linux/i2c-id.h
index b69014865714..a271b67a8e2d 100644
--- a/include/linux/i2c-id.h
+++ b/include/linux/i2c-id.h
@@ -119,6 +119,7 @@
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 */ 121#define I2C_DRIVERID_LM4857 92 /* LM4857 Audio Amplifier */
122#define I2C_DRIVERID_VP27SMPX 93 /* Panasonic VP27s tuner internal MPX */
122 123
123#define I2C_DRIVERID_I2CDEV 900 124#define I2C_DRIVERID_I2CDEV 900
124#define I2C_DRIVERID_ARP 902 /* SMBus ARP Client */ 125#define I2C_DRIVERID_ARP 902 /* SMBus ARP Client */
@@ -196,6 +197,7 @@
196#define I2C_HW_B_EM28XX 0x01001f /* em28xx video capture cards */ 197#define I2C_HW_B_EM28XX 0x01001f /* em28xx video capture cards */
197#define I2C_HW_B_CX2341X 0x010020 /* Conexant CX2341X MPEG encoder cards */ 198#define I2C_HW_B_CX2341X 0x010020 /* Conexant CX2341X MPEG encoder cards */
198#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) */
199 201
200/* --- PCF 8584 based algorithms */ 202/* --- PCF 8584 based algorithms */
201#define I2C_HW_P_LP 0x020000 /* Parallel port interface */ 203#define I2C_HW_P_LP 0x020000 /* Parallel port interface */
diff --git a/include/linux/ide.h b/include/linux/ide.h
index b9f66c10caa0..85d448b4abec 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -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) */
@@ -702,10 +702,10 @@ typedef struct hwif_s {
702#if 0 702#if 0
703 ide_hwif_ops_t *hwifops; 703 ide_hwif_ops_t *hwifops;
704#else 704#else
705 /* routine to tune PIO mode for drives */ 705 /* routine to set PIO mode for drives */
706 void (*tuneproc)(ide_drive_t *, u8); 706 void (*set_pio_mode)(ide_drive_t *, const u8);
707 /* routine to retune DMA modes for drives */ 707 /* routine to retune DMA modes for drives */
708 int (*speedproc)(ide_drive_t *, u8); 708 int (*speedproc)(ide_drive_t *, const u8);
709 /* tweaks hardware to select drive */ 709 /* tweaks hardware to select drive */
710 void (*selectproc)(ide_drive_t *); 710 void (*selectproc)(ide_drive_t *);
711 /* chipset polling based on hba specifics */ 711 /* chipset polling based on hba specifics */
@@ -723,6 +723,7 @@ typedef struct hwif_s {
723 /* driver soft-power interface */ 723 /* driver soft-power interface */
724 int (*busproc)(ide_drive_t *, int); 724 int (*busproc)(ide_drive_t *, int);
725#endif 725#endif
726 u8 (*mdma_filter)(ide_drive_t *);
726 u8 (*udma_filter)(ide_drive_t *); 727 u8 (*udma_filter)(ide_drive_t *);
727 728
728 void (*ata_input_data)(ide_drive_t *, void *, u32); 729 void (*ata_input_data)(ide_drive_t *, void *, u32);
@@ -1255,6 +1256,12 @@ enum {
1255 IDE_HFLAG_PIO_NO_BLACKLIST = (1 << 2), 1256 IDE_HFLAG_PIO_NO_BLACKLIST = (1 << 2),
1256 /* don't use conservative PIO "downgrade" */ 1257 /* don't use conservative PIO "downgrade" */
1257 IDE_HFLAG_PIO_NO_DOWNGRADE = (1 << 3), 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),
1258}; 1265};
1259 1266
1260typedef struct ide_pci_device_s { 1267typedef struct ide_pci_device_s {
@@ -1295,7 +1302,14 @@ int ide_in_drive_list(struct hd_driveid *, const struct drive_list_entry *);
1295#ifdef CONFIG_BLK_DEV_IDEDMA 1302#ifdef CONFIG_BLK_DEV_IDEDMA
1296int __ide_dma_bad_drive(ide_drive_t *); 1303int __ide_dma_bad_drive(ide_drive_t *);
1297int __ide_dma_good_drive(ide_drive_t *); 1304int __ide_dma_good_drive(ide_drive_t *);
1298u8 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
1299int ide_tune_dma(ide_drive_t *); 1313int ide_tune_dma(ide_drive_t *);
1300void ide_dma_off(ide_drive_t *); 1314void ide_dma_off(ide_drive_t *);
1301void ide_dma_verbose(ide_drive_t *); 1315void ide_dma_verbose(ide_drive_t *);
@@ -1321,6 +1335,7 @@ extern void ide_dma_timeout(ide_drive_t *);
1321#endif /* CONFIG_BLK_DEV_IDEDMA_PCI */ 1335#endif /* CONFIG_BLK_DEV_IDEDMA_PCI */
1322 1336
1323#else 1337#else
1338static inline u8 ide_find_dma_mode(ide_drive_t *drive, u8 speed) { return 0; }
1324static 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; }
1325static inline int ide_tune_dma(ide_drive_t *drive) { return 0; } 1340static inline int ide_tune_dma(ide_drive_t *drive) { return 0; }
1326static inline void ide_dma_off(ide_drive_t *drive) { ; } 1341static inline void ide_dma_off(ide_drive_t *drive) { ; }
@@ -1337,11 +1352,13 @@ extern int ide_acpi_exec_tfs(ide_drive_t *drive);
1337extern void ide_acpi_get_timing(ide_hwif_t *hwif); 1352extern void ide_acpi_get_timing(ide_hwif_t *hwif);
1338extern void ide_acpi_push_timing(ide_hwif_t *hwif); 1353extern void ide_acpi_push_timing(ide_hwif_t *hwif);
1339extern 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);
1340#else 1356#else
1341static 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; }
1342static inline void ide_acpi_get_timing(ide_hwif_t *hwif) { ; } 1358static inline void ide_acpi_get_timing(ide_hwif_t *hwif) { ; }
1343static inline void ide_acpi_push_timing(ide_hwif_t *hwif) { ; } 1359static inline void ide_acpi_push_timing(ide_hwif_t *hwif) { ; }
1344static 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) {}
1345#endif 1362#endif
1346 1363
1347extern int ide_hwif_request_regions(ide_hwif_t *hwif); 1364extern int ide_hwif_request_regions(ide_hwif_t *hwif);
@@ -1367,7 +1384,6 @@ static inline void ide_set_hwifdata (ide_hwif_t * hwif, void *data)
1367} 1384}
1368 1385
1369/* ide-lib.c */ 1386/* ide-lib.c */
1370u8 ide_rate_filter(ide_drive_t *, u8);
1371extern char *ide_xfer_verbose(u8 xfer_rate); 1387extern char *ide_xfer_verbose(u8 xfer_rate);
1372extern void ide_toggle_bounce(ide_drive_t *drive, int on); 1388extern void ide_toggle_bounce(ide_drive_t *drive, int on);
1373extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate); 1389extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate);
@@ -1404,6 +1420,12 @@ unsigned int ide_pio_cycle_time(ide_drive_t *, u8);
1404u8 ide_get_best_pio_mode(ide_drive_t *, u8, u8); 1420u8 ide_get_best_pio_mode(ide_drive_t *, u8, u8);
1405extern const ide_pio_timings_t ide_pio_timings[6]; 1421extern const ide_pio_timings_t ide_pio_timings[6];
1406 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}
1407 1429
1408extern spinlock_t ide_lock; 1430extern spinlock_t ide_lock;
1409extern 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_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 74b1f43bf982..f8d9d0b5cffc 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -57,6 +57,7 @@
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"))) __cold 63#define __exit __attribute__ ((__section__(".exit.text"))) __cold
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index f8abfa349ef9..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}
diff --git a/include/linux/input.h b/include/linux/input.h
index 36e00aa6f03b..6eb3aead7f1d 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -360,6 +360,7 @@ 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
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 4ca60c3320fb..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 *
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/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/kernel.h b/include/linux/kernel.h
index 47160fe378c9..d9725a28a265 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -42,6 +42,20 @@ extern const char linux_proc_banner[];
42#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) 42#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
43#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) 43#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
44 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
45/** 59/**
46 * upper_32_bits - return bits 32-63 of a number 60 * upper_32_bits - return bits 32-63 of a number
47 * @n: the number we're accessing 61 * @n: the number we're accessing
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index 949706c33622..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[];
@@ -56,19 +60,14 @@ enum kobject_action {
56 KOBJ_MAX 60 KOBJ_MAX
57}; 61};
58 62
59/* The list of strings defining the valid kobject actions as specified above */
60extern const char *kobject_actions[];
61
62struct kobject { 63struct kobject {
63 const char * k_name; 64 const char * k_name;
64 char name[KOBJ_NAME_LEN];
65 struct kref kref; 65 struct kref kref;
66 struct list_head entry; 66 struct list_head entry;
67 struct kobject * parent; 67 struct kobject * parent;
68 struct kset * kset; 68 struct kset * kset;
69 struct kobj_type * ktype; 69 struct kobj_type * ktype;
70 struct sysfs_dirent * sd; 70 struct sysfs_dirent * sd;
71 wait_queue_head_t poll;
72}; 71};
73 72
74extern int kobject_set_name(struct kobject *, const char *, ...) 73extern int kobject_set_name(struct kobject *, const char *, ...)
@@ -83,14 +82,9 @@ extern void kobject_init(struct kobject *);
83extern void kobject_cleanup(struct kobject *); 82extern void kobject_cleanup(struct kobject *);
84 83
85extern int __must_check kobject_add(struct kobject *); 84extern int __must_check kobject_add(struct kobject *);
86extern int __must_check kobject_shadow_add(struct kobject *kobj,
87 struct sysfs_dirent *shadow_parent);
88extern void kobject_del(struct kobject *); 85extern void kobject_del(struct kobject *);
89 86
90extern int __must_check kobject_rename(struct kobject *, const char *new_name); 87extern int __must_check kobject_rename(struct kobject *, const char *new_name);
91extern int __must_check kobject_shadow_rename(struct kobject *kobj,
92 struct sysfs_dirent *new_parent,
93 const char *new_name);
94extern int __must_check kobject_move(struct kobject *, struct kobject *); 88extern int __must_check kobject_move(struct kobject *, struct kobject *);
95 89
96extern int __must_check kobject_register(struct kobject *); 90extern int __must_check kobject_register(struct kobject *);
@@ -111,36 +105,44 @@ struct kobj_type {
111 struct attribute ** default_attrs; 105 struct attribute ** default_attrs;
112}; 106};
113 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};
114
114struct kset_uevent_ops { 115struct kset_uevent_ops {
115 int (*filter)(struct kset *kset, struct kobject *kobj); 116 int (*filter)(struct kset *kset, struct kobject *kobj);
116 const char *(*name)(struct kset *kset, struct kobject *kobj); 117 const char *(*name)(struct kset *kset, struct kobject *kobj);
117 int (*uevent)(struct kset *kset, struct kobject *kobj, char **envp, 118 int (*uevent)(struct kset *kset, struct kobject *kobj,
118 int num_envp, char *buffer, int buffer_size); 119 struct kobj_uevent_env *env);
119}; 120};
120 121
121/* 122/**
122 * struct kset - a set of kobjects of a specific type, belonging 123 * struct kset - a set of kobjects of a specific type, belonging to a specific subsystem.
123 * to a specific subsystem.
124 *
125 * All kobjects of a kset should be embedded in an identical
126 * type. This type may have a descriptor, which the kset points
127 * to. This allows there to exist sets of objects of the same
128 * type in different subsystems.
129 * 124 *
130 * A subsystem does not have to be a list of only one type 125 * A kset defines a group of kobjects. They can be individually
131 * of object; multiple ksets can belong to one subsystem. All 126 * different "types" but overall these kobjects all want to be grouped
132 * ksets of a subsystem share the subsystem's lock. 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.
133 * 130 *
134 * Each kset can support specific event variables; it can 131 * @ktype: the struct kobj_type for this specific kset
135 * supress the event generation or add subsystem specific 132 * @list: the list of all kobjects for this kset
136 * variables carried with the event. 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.
137 */ 139 */
138struct kset { 140struct kset {
139 struct kobj_type * ktype; 141 struct kobj_type *ktype;
140 struct list_head list; 142 struct list_head list;
141 spinlock_t list_lock; 143 spinlock_t list_lock;
142 struct kobject kobj; 144 struct kobject kobj;
143 struct kset_uevent_ops * uevent_ops; 145 struct kset_uevent_ops *uevent_ops;
144}; 146};
145 147
146 148
@@ -179,18 +181,18 @@ extern struct kobject * kset_find_obj(struct kset *, const char *);
179 * Use this when initializing an embedded kset with no other 181 * Use this when initializing an embedded kset with no other
180 * fields to initialize. 182 * fields to initialize.
181 */ 183 */
182#define set_kset_name(str) .kset = { .kobj = { .name = str } } 184#define set_kset_name(str) .kset = { .kobj = { .k_name = str } }
183 185
184 186
185#define decl_subsys(_name,_type,_uevent_ops) \ 187#define decl_subsys(_name,_type,_uevent_ops) \
186struct kset _name##_subsys = { \ 188struct kset _name##_subsys = { \
187 .kobj = { .name = __stringify(_name) }, \ 189 .kobj = { .k_name = __stringify(_name) }, \
188 .ktype = _type, \ 190 .ktype = _type, \
189 .uevent_ops =_uevent_ops, \ 191 .uevent_ops =_uevent_ops, \
190} 192}
191#define decl_subsys_name(_varname,_name,_type,_uevent_ops) \ 193#define decl_subsys_name(_varname,_name,_type,_uevent_ops) \
192struct kset _varname##_subsys = { \ 194struct kset _varname##_subsys = { \
193 .kobj = { .name = __stringify(_name) }, \ 195 .kobj = { .k_name = __stringify(_name) }, \
194 .ktype = _type, \ 196 .ktype = _type, \
195 .uevent_ops =_uevent_ops, \ 197 .uevent_ops =_uevent_ops, \
196} 198}
@@ -218,49 +220,9 @@ extern struct kset hypervisor_subsys;
218#define kobj_set_kset_s(obj,subsys) \ 220#define kobj_set_kset_s(obj,subsys) \
219 (obj)->kobj.kset = &(subsys) 221 (obj)->kobj.kset = &(subsys)
220 222
221/**
222 * kset_set_kset_s(obj,subsys) - set kset for embedded kset.
223 * @obj: ptr to some object type.
224 * @subsys: a subsystem object (not a ptr).
225 *
226 * Can be used for any object type with an embedded ->kset.
227 * Sets the kset of @obj's embedded kobject (via its embedded
228 * kset) to @subsys.kset. This makes @obj a member of that
229 * kset.
230 */
231
232#define kset_set_kset_s(obj,subsys) \
233 (obj)->kset.kobj.kset = &(subsys)
234
235/**
236 * subsys_set_kset(obj,subsys) - set kset for subsystem
237 * @obj: ptr to some object type.
238 * @_subsys: a subsystem object (not a ptr).
239 *
240 * Can be used for any object type with an embedded ->subsys.
241 * Sets the kset of @obj's kobject to @subsys.kset. This makes
242 * the object a member of that kset.
243 */
244
245#define subsys_set_kset(obj,_subsys) \
246 (obj)->subsys.kobj.kset = &(_subsys)
247
248extern void subsystem_init(struct kset *);
249extern int __must_check subsystem_register(struct kset *); 223extern int __must_check subsystem_register(struct kset *);
250extern void subsystem_unregister(struct kset *); 224extern void subsystem_unregister(struct kset *);
251 225
252static inline struct kset *subsys_get(struct kset *s)
253{
254 if (s)
255 return kset_get(s);
256 return NULL;
257}
258
259static inline void subsys_put(struct kset *s)
260{
261 kset_put(s);
262}
263
264struct subsys_attribute { 226struct subsys_attribute {
265 struct attribute attr; 227 struct attribute attr;
266 ssize_t (*show)(struct kset *, char *); 228 ssize_t (*show)(struct kset *, char *);
@@ -275,10 +237,11 @@ int kobject_uevent(struct kobject *kobj, enum kobject_action action);
275int kobject_uevent_env(struct kobject *kobj, enum kobject_action action, 237int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
276 char *envp[]); 238 char *envp[]);
277 239
278int add_uevent_var(char **envp, int num_envp, int *cur_index, 240int add_uevent_var(struct kobj_uevent_env *env, const char *format, ...)
279 char *buffer, int buffer_size, int *cur_len, 241 __attribute__((format (printf, 2, 3)));
280 const char *format, ...) 242
281 __attribute__((format (printf, 7, 8))); 243int kobject_action_type(const char *buf, size_t count,
244 enum kobject_action *type);
282#else 245#else
283static inline int kobject_uevent(struct kobject *kobj, enum kobject_action action) 246static inline int kobject_uevent(struct kobject *kobj, enum kobject_action action)
284{ return 0; } 247{ return 0; }
@@ -287,10 +250,12 @@ static inline int kobject_uevent_env(struct kobject *kobj,
287 char *envp[]) 250 char *envp[])
288{ return 0; } 251{ return 0; }
289 252
290static 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, ...)
291 char *buffer, int buffer_size, int *cur_len,
292 const char *format, ...)
293{ 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; }
294#endif 259#endif
295 260
296#endif /* __KERNEL__ */ 261#endif /* __KERNEL__ */
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/libata.h b/include/linux/libata.h
index a67bb9075e9b..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 */
@@ -263,6 +273,10 @@ enum {
263 /* ering size */ 273 /* ering size */
264 ATA_ERING_SIZE = 32, 274 ATA_ERING_SIZE = 32,
265 275
276 /* return values for ->qc_defer */
277 ATA_DEFER_LINK = 1,
278 ATA_DEFER_PORT = 2,
279
266 /* desc_len for ata_eh_info and context */ 280 /* desc_len for ata_eh_info and context */
267 ATA_EH_DESC_LEN = 80, 281 ATA_EH_DESC_LEN = 80,
268 282
@@ -270,6 +284,7 @@ enum {
270 ATA_EH_REVALIDATE = (1 << 0), 284 ATA_EH_REVALIDATE = (1 << 0),
271 ATA_EH_SOFTRESET = (1 << 1), 285 ATA_EH_SOFTRESET = (1 << 1),
272 ATA_EH_HARDRESET = (1 << 2), 286 ATA_EH_HARDRESET = (1 << 2),
287 ATA_EH_ENABLE_LINK = (1 << 3),
273 288
274 ATA_EH_RESET_MASK = ATA_EH_SOFTRESET | ATA_EH_HARDRESET, 289 ATA_EH_RESET_MASK = ATA_EH_SOFTRESET | ATA_EH_HARDRESET,
275 ATA_EH_PERDEV_MASK = ATA_EH_REVALIDATE, 290 ATA_EH_PERDEV_MASK = ATA_EH_REVALIDATE,
@@ -289,12 +304,16 @@ enum {
289 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,
290 ATA_EHI_RESET_MODIFIER_MASK = ATA_EHI_RESUME_LINK, 305 ATA_EHI_RESET_MODIFIER_MASK = ATA_EHI_RESUME_LINK,
291 306
292 /* max repeat if error condition is still set after ->error_handler */ 307 /* max tries if error condition is still set after ->error_handler */
293 ATA_EH_MAX_REPEAT = 5, 308 ATA_EH_MAX_TRIES = 5,
294 309
295 /* how hard are we gonna try to probe/recover devices */ 310 /* how hard are we gonna try to probe/recover devices */
296 ATA_PROBE_MAX_TRIES = 3, 311 ATA_PROBE_MAX_TRIES = 3,
297 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,
298 317
299 /* Horkage types. May be set by libata or controller on drives 318 /* Horkage types. May be set by libata or controller on drives
300 (some horkage may be drive/controller pair dependant */ 319 (some horkage may be drive/controller pair dependant */
@@ -304,6 +323,14 @@ enum {
304 ATA_HORKAGE_NONCQ = (1 << 2), /* Don't use NCQ */ 323 ATA_HORKAGE_NONCQ = (1 << 2), /* Don't use NCQ */
305 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 */
306 ATA_HORKAGE_BROKEN_HPA = (1 << 4), /* Broken HPA */ 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 */
307}; 334};
308 335
309enum hsm_task_states { 336enum hsm_task_states {
@@ -333,14 +360,15 @@ enum ata_completion_errors {
333struct scsi_device; 360struct scsi_device;
334struct ata_port_operations; 361struct ata_port_operations;
335struct ata_port; 362struct ata_port;
363struct ata_link;
336struct ata_queued_cmd; 364struct ata_queued_cmd;
337 365
338/* typedefs */ 366/* typedefs */
339typedef void (*ata_qc_cb_t) (struct ata_queued_cmd *qc); 367typedef void (*ata_qc_cb_t) (struct ata_queued_cmd *qc);
340typedef 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);
341typedef 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,
342 unsigned long deadline); 370 unsigned long deadline);
343typedef 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);
344 372
345struct ata_ioports { 373struct ata_ioports {
346 void __iomem *cmd_addr; 374 void __iomem *cmd_addr;
@@ -363,8 +391,6 @@ struct ata_ioports {
363struct ata_host { 391struct ata_host {
364 spinlock_t lock; 392 spinlock_t lock;
365 struct device *dev; 393 struct device *dev;
366 unsigned long irq;
367 unsigned long irq2;
368 void __iomem * const *iomap; 394 void __iomem * const *iomap;
369 unsigned int n_ports; 395 unsigned int n_ports;
370 void *private_data; 396 void *private_data;
@@ -436,7 +462,7 @@ struct ata_ering {
436}; 462};
437 463
438struct ata_device { 464struct ata_device {
439 struct ata_port *ap; 465 struct ata_link *link;
440 unsigned int devno; /* 0 or 1 */ 466 unsigned int devno; /* 0 or 1 */
441 unsigned long flags; /* ATA_DFLAG_xxx */ 467 unsigned long flags; /* ATA_DFLAG_xxx */
442 unsigned int horkage; /* List of broken features */ 468 unsigned int horkage; /* List of broken features */
@@ -447,7 +473,12 @@ struct ata_device {
447 /* 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 */
448 u64 n_sectors; /* size of device, if ATA */ 474 u64 n_sectors; /* size of device, if ATA */
449 unsigned int class; /* ATA_DEV_xxx */ 475 unsigned int class; /* ATA_DEV_xxx */
450 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
451 u8 pio_mode; 482 u8 pio_mode;
452 u8 dma_mode; 483 u8 dma_mode;
453 u8 xfer_mode; 484 u8 xfer_mode;
@@ -510,6 +541,27 @@ struct ata_acpi_gtm {
510 u32 flags; 541 u32 flags;
511} __packed; 542} __packed;
512 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
513struct ata_port { 565struct ata_port {
514 struct Scsi_Host *scsi_host; /* our co-allocated scsi host */ 566 struct Scsi_Host *scsi_host; /* our co-allocated scsi host */
515 const struct ata_port_operations *ops; 567 const struct ata_port_operations *ops;
@@ -533,23 +585,17 @@ struct ata_port {
533 unsigned int mwdma_mask; 585 unsigned int mwdma_mask;
534 unsigned int udma_mask; 586 unsigned int udma_mask;
535 unsigned int cbl; /* cable type; ATA_CBL_xxx */ 587 unsigned int cbl; /* cable type; ATA_CBL_xxx */
536 unsigned int hw_sata_spd_limit;
537 unsigned int sata_spd_limit; /* SATA PHY speed limit */
538 unsigned int sata_spd; /* current SATA PHY speed */
539
540 /* record runtime error info, protected by host lock */
541 struct ata_eh_info eh_info;
542 /* EH context owned by EH */
543 struct ata_eh_context eh_context;
544
545 struct ata_device device[ATA_MAX_DEVICES];
546 588
547 struct ata_queued_cmd qcmd[ATA_MAX_QUEUE]; 589 struct ata_queued_cmd qcmd[ATA_MAX_QUEUE];
548 unsigned long qc_allocated; 590 unsigned long qc_allocated;
549 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 */
550 595
551 unsigned int active_tag; 596 int nr_pmp_links; /* nr of available PMP links */
552 u32 sactive; 597 struct ata_link *pmp_link; /* array of PMP links */
598 struct ata_link *excl_link; /* for PMP qc exclusion */
553 599
554 struct ata_port_stats stats; 600 struct ata_port_stats stats;
555 struct ata_host *host; 601 struct ata_host *host;
@@ -565,6 +611,7 @@ struct ata_port {
565 u32 msg_enable; 611 u32 msg_enable;
566 struct list_head eh_done_q; 612 struct list_head eh_done_q;
567 wait_queue_head_t eh_wait_q; 613 wait_queue_head_t eh_wait_q;
614 int eh_tries;
568 615
569 pm_message_t pm_mesg; 616 pm_message_t pm_mesg;
570 int *pm_result; 617 int *pm_result;
@@ -582,8 +629,6 @@ struct ata_port {
582}; 629};
583 630
584struct ata_port_operations { 631struct ata_port_operations {
585 void (*port_disable) (struct ata_port *);
586
587 void (*dev_config) (struct ata_device *); 632 void (*dev_config) (struct ata_device *);
588 633
589 void (*set_piomode) (struct ata_port *, struct ata_device *); 634 void (*set_piomode) (struct ata_port *, struct ata_device *);
@@ -599,7 +644,7 @@ struct ata_port_operations {
599 void (*dev_select)(struct ata_port *ap, unsigned int device); 644 void (*dev_select)(struct ata_port *ap, unsigned int device);
600 645
601 void (*phy_reset) (struct ata_port *ap); /* obsolete */ 646 void (*phy_reset) (struct ata_port *ap); /* obsolete */
602 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);
603 648
604 int (*cable_detect) (struct ata_port *ap); 649 int (*cable_detect) (struct ata_port *ap);
605 650
@@ -610,9 +655,14 @@ struct ata_port_operations {
610 655
611 void (*data_xfer) (struct ata_device *, unsigned char *, unsigned int, int); 656 void (*data_xfer) (struct ata_device *, unsigned char *, unsigned int, int);
612 657
658 int (*qc_defer) (struct ata_queued_cmd *qc);
613 void (*qc_prep) (struct ata_queued_cmd *qc); 659 void (*qc_prep) (struct ata_queued_cmd *qc);
614 unsigned int (*qc_issue) (struct ata_queued_cmd *qc); 660 unsigned int (*qc_issue) (struct ata_queued_cmd *qc);
615 661
662 /* port multiplier */
663 void (*pmp_attach) (struct ata_port *ap);
664 void (*pmp_detach) (struct ata_port *ap);
665
616 /* Error handlers. ->error_handler overrides ->eng_timeout and 666 /* Error handlers. ->error_handler overrides ->eng_timeout and
617 * indicates that new-style EH is in place. 667 * indicates that new-style EH is in place.
618 */ 668 */
@@ -626,7 +676,6 @@ struct ata_port_operations {
626 irq_handler_t irq_handler; 676 irq_handler_t irq_handler;
627 void (*irq_clear) (struct ata_port *); 677 void (*irq_clear) (struct ata_port *);
628 u8 (*irq_on) (struct ata_port *); 678 u8 (*irq_on) (struct ata_port *);
629 u8 (*irq_ack) (struct ata_port *ap, unsigned int chk_drq);
630 679
631 int (*scr_read) (struct ata_port *ap, unsigned int sc_reg, u32 *val); 680 int (*scr_read) (struct ata_port *ap, unsigned int sc_reg, u32 *val);
632 int (*scr_write) (struct ata_port *ap, unsigned int sc_reg, u32 val); 681 int (*scr_write) (struct ata_port *ap, unsigned int sc_reg, u32 val);
@@ -646,6 +695,7 @@ struct ata_port_operations {
646struct ata_port_info { 695struct ata_port_info {
647 struct scsi_host_template *sht; 696 struct scsi_host_template *sht;
648 unsigned long flags; 697 unsigned long flags;
698 unsigned long link_flags;
649 unsigned long pio_mask; 699 unsigned long pio_mask;
650 unsigned long mwdma_mask; 700 unsigned long mwdma_mask;
651 unsigned long udma_mask; 701 unsigned long udma_mask;
@@ -689,38 +739,27 @@ static inline int ata_port_is_dummy(struct ata_port *ap)
689 return ap->ops == &ata_dummy_port_ops; 739 return ap->ops == &ata_dummy_port_ops;
690} 740}
691 741
692extern void sata_print_link_status(struct ata_port *ap); 742extern void sata_print_link_status(struct ata_link *link);
693extern void ata_port_probe(struct ata_port *); 743extern void ata_port_probe(struct ata_port *);
694extern void __sata_phy_reset(struct ata_port *ap); 744extern void __sata_phy_reset(struct ata_port *ap);
695extern void sata_phy_reset(struct ata_port *ap); 745extern void sata_phy_reset(struct ata_port *ap);
696extern void ata_bus_reset(struct ata_port *ap); 746extern void ata_bus_reset(struct ata_port *ap);
697extern int sata_set_spd(struct ata_port *ap); 747extern int sata_set_spd(struct ata_link *link);
698extern int sata_phy_debounce(struct ata_port *ap, const unsigned long *param, 748extern int sata_link_debounce(struct ata_link *link,
699 unsigned long deadline); 749 const unsigned long *params, unsigned long deadline);
700extern 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,
701 unsigned long deadline); 751 unsigned long deadline);
702extern int ata_std_prereset(struct ata_port *ap, unsigned long deadline); 752extern int ata_std_prereset(struct ata_link *link, unsigned long deadline);
703extern int ata_std_softreset(struct ata_port *ap, unsigned int *classes, 753extern int ata_std_softreset(struct ata_link *link, unsigned int *classes,
704 unsigned long deadline); 754 unsigned long deadline);
705extern int sata_port_hardreset(struct ata_port *ap, const unsigned long *timing, 755extern int sata_link_hardreset(struct ata_link *link,
706 unsigned long deadline); 756 const unsigned long *timing, unsigned long deadline);
707extern int sata_std_hardreset(struct ata_port *ap, unsigned int *class, 757extern int sata_std_hardreset(struct ata_link *link, unsigned int *class,
708 unsigned long deadline); 758 unsigned long deadline);
709extern void ata_std_postreset(struct ata_port *ap, unsigned int *classes); 759extern void ata_std_postreset(struct ata_link *link, unsigned int *classes);
710extern void ata_port_disable(struct ata_port *); 760extern void ata_port_disable(struct ata_port *);
711extern void ata_std_ports(struct ata_ioports *ioaddr); 761extern void ata_std_ports(struct ata_ioports *ioaddr);
712#ifdef CONFIG_PCI 762
713extern int ata_pci_init_one (struct pci_dev *pdev,
714 const struct ata_port_info * const * ppi);
715extern void ata_pci_remove_one (struct pci_dev *pdev);
716#ifdef CONFIG_PM
717extern void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t mesg);
718extern int __must_check ata_pci_device_do_resume(struct pci_dev *pdev);
719extern int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg);
720extern int ata_pci_device_resume(struct pci_dev *pdev);
721#endif
722extern int ata_pci_clear_simplex(struct pci_dev *pdev);
723#endif /* CONFIG_PCI */
724extern 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);
725extern struct ata_host *ata_host_alloc_pinfo(struct device *dev, 764extern struct ata_host *ata_host_alloc_pinfo(struct device *dev,
726 const struct ata_port_info * const * ppi, int n_ports); 765 const struct ata_port_info * const * ppi, int n_ports);
@@ -746,12 +785,12 @@ extern int ata_sas_slave_configure(struct scsi_device *, struct ata_port *);
746extern 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 *),
747 struct ata_port *ap); 786 struct ata_port *ap);
748extern 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);
749extern int sata_scr_valid(struct ata_port *ap); 788extern int sata_scr_valid(struct ata_link *link);
750extern 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);
751extern 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);
752extern 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);
753extern int ata_port_online(struct ata_port *ap); 792extern int ata_link_online(struct ata_link *link);
754extern int ata_port_offline(struct ata_port *ap); 793extern int ata_link_offline(struct ata_link *link);
755#ifdef CONFIG_PM 794#ifdef CONFIG_PM
756extern 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);
757extern void ata_host_resume(struct ata_host *host); 796extern void ata_host_resume(struct ata_host *host);
@@ -765,7 +804,8 @@ extern void ata_port_queue_task(struct ata_port *ap, work_func_t fn,
765extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val, 804extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val,
766 unsigned long interval_msec, 805 unsigned long interval_msec,
767 unsigned long timeout_msec); 806 unsigned long timeout_msec);
768extern 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);
769 809
770/* 810/*
771 * Default driver ops implementations 811 * Default driver ops implementations
@@ -787,6 +827,7 @@ extern void ata_data_xfer(struct ata_device *adev, unsigned char *buf,
787 unsigned int buflen, int write_data); 827 unsigned int buflen, int write_data);
788extern 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,
789 unsigned int buflen, int write_data); 829 unsigned int buflen, int write_data);
830extern int ata_std_qc_defer(struct ata_queued_cmd *qc);
790extern void ata_dumb_qc_prep(struct ata_queued_cmd *qc); 831extern void ata_dumb_qc_prep(struct ata_queued_cmd *qc);
791extern void ata_qc_prep(struct ata_queued_cmd *qc); 832extern void ata_qc_prep(struct ata_queued_cmd *qc);
792extern void ata_noop_qc_prep(struct ata_queued_cmd *qc); 833extern void ata_noop_qc_prep(struct ata_queued_cmd *qc);
@@ -830,11 +871,8 @@ extern void ata_scsi_slave_destroy(struct scsi_device *sdev);
830extern int ata_scsi_change_queue_depth(struct scsi_device *sdev, 871extern int ata_scsi_change_queue_depth(struct scsi_device *sdev,
831 int queue_depth); 872 int queue_depth);
832extern struct ata_device *ata_dev_pair(struct ata_device *adev); 873extern struct ata_device *ata_dev_pair(struct ata_device *adev);
833extern 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);
834extern u8 ata_irq_on(struct ata_port *ap); 875extern u8 ata_irq_on(struct ata_port *ap);
835extern u8 ata_dummy_irq_on(struct ata_port *ap);
836extern u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq);
837extern u8 ata_dummy_irq_ack(struct ata_port *ap, unsigned int chk_drq);
838 876
839extern int ata_cable_40wire(struct ata_port *ap); 877extern int ata_cable_40wire(struct ata_port *ap);
840extern int ata_cable_80wire(struct ata_port *ap); 878extern int ata_cable_80wire(struct ata_port *ap);
@@ -869,8 +907,29 @@ enum {
869 ATA_TIMING_CYCLE | ATA_TIMING_UDMA, 907 ATA_TIMING_CYCLE | ATA_TIMING_UDMA,
870}; 908};
871 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
872 918
873#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
874struct pci_bits { 933struct pci_bits {
875 unsigned int reg; /* PCI config register to read */ 934 unsigned int reg; /* PCI config register to read */
876 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) */
@@ -888,13 +947,29 @@ extern unsigned long ata_pci_default_filter(struct ata_device *, unsigned long);
888#endif /* CONFIG_PCI */ 947#endif /* CONFIG_PCI */
889 948
890/* 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/*
891 * EH 964 * EH
892 */ 965 */
893extern void ata_eng_timeout(struct ata_port *ap); 966extern void ata_eng_timeout(struct ata_port *ap);
894 967
895extern 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);
896extern int ata_port_abort(struct ata_port *ap); 970extern int ata_port_abort(struct ata_port *ap);
897extern 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);
898 973
899extern void ata_eh_freeze_port(struct ata_port *ap); 974extern void ata_eh_freeze_port(struct ata_port *ap);
900extern void ata_eh_thaw_port(struct ata_port *ap); 975extern void ata_eh_thaw_port(struct ata_port *ap);
@@ -912,14 +987,25 @@ extern void ata_do_eh(struct ata_port *ap, ata_prereset_fn_t prereset,
912#define ata_port_printk(ap, lv, fmt, args...) \ 987#define ata_port_printk(ap, lv, fmt, args...) \
913 printk(lv"ata%u: "fmt, (ap)->print_id , ##args) 988 printk(lv"ata%u: "fmt, (ap)->print_id , ##args)
914 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
915#define ata_dev_printk(dev, lv, fmt, args...) \ 998#define ata_dev_printk(dev, lv, fmt, args...) \
916 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)
917 1001
918/* 1002/*
919 * ata_eh_info helpers 1003 * ata_eh_info helpers
920 */ 1004 */
921extern void __ata_ehi_push_desc(struct ata_eh_info *ehi, const char *fmt, ...); 1005extern void __ata_ehi_push_desc(struct ata_eh_info *ehi, const char *fmt, ...)
922extern void ata_ehi_push_desc(struct ata_eh_info *ehi, const char *fmt, ...); 1006 __attribute__ ((format (printf, 2, 3)));
1007extern void ata_ehi_push_desc(struct ata_eh_info *ehi, const char *fmt, ...)
1008 __attribute__ ((format (printf, 2, 3)));
923extern void ata_ehi_clear_desc(struct ata_eh_info *ehi); 1009extern void ata_ehi_clear_desc(struct ata_eh_info *ehi);
924 1010
925static inline void ata_ehi_schedule_probe(struct ata_eh_info *ehi) 1011static inline void ata_ehi_schedule_probe(struct ata_eh_info *ehi)
@@ -933,10 +1019,21 @@ static inline void ata_ehi_hotplugged(struct ata_eh_info *ehi)
933{ 1019{
934 ata_ehi_schedule_probe(ehi); 1020 ata_ehi_schedule_probe(ehi);
935 ehi->flags |= ATA_EHI_HOTPLUGGED; 1021 ehi->flags |= ATA_EHI_HOTPLUGGED;
1022 ehi->action |= ATA_EH_ENABLE_LINK;
936 ehi->err_mask |= AC_ERR_ATA_BUS; 1023 ehi->err_mask |= AC_ERR_ATA_BUS;
937} 1024}
938 1025
939/* 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/*
940 * qc helpers 1037 * qc helpers
941 */ 1038 */
942static inline int 1039static inline int
@@ -991,12 +1088,14 @@ static inline unsigned int ata_tag_internal(unsigned int tag)
991 */ 1088 */
992static inline unsigned int ata_class_enabled(unsigned int class) 1089static inline unsigned int ata_class_enabled(unsigned int class)
993{ 1090{
994 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;
995} 1093}
996 1094
997static inline unsigned int ata_class_disabled(unsigned int class) 1095static inline unsigned int ata_class_disabled(unsigned int class)
998{ 1096{
999 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;
1000} 1099}
1001 1100
1002static inline unsigned int ata_class_absent(unsigned int class) 1101static inline unsigned int ata_class_absent(unsigned int class)
@@ -1020,15 +1119,62 @@ static inline unsigned int ata_dev_absent(const struct ata_device *dev)
1020} 1119}
1021 1120
1022/* 1121/*
1023 * port helpers 1122 * link helpers
1024 */ 1123 */
1025static 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)
1026{ 1130{
1027 if (ap->flags & ATA_FLAG_SLAVE_POSS) 1131 if (ata_is_host_link(link) && link->ap->flags & ATA_FLAG_SLAVE_POSS)
1028 return 2; 1132 return 2;
1029 return 1; 1133 return 1;
1030} 1134}
1031 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)--)
1032 1178
1033static inline u8 ata_chk_status(struct ata_port *ap) 1179static inline u8 ata_chk_status(struct ata_port *ap)
1034{ 1180{
@@ -1110,9 +1256,11 @@ static inline u8 ata_wait_idle(struct ata_port *ap)
1110{ 1256{
1111 u8 status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000); 1257 u8 status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000);
1112 1258
1259#ifdef ATA_DEBUG
1113 if (status != 0xff && (status & (ATA_BUSY | ATA_DRQ))) 1260 if (status != 0xff && (status & (ATA_BUSY | ATA_DRQ)))
1114 DPRINTK("ATA: abnormal status 0x%X on port 0x%p\n", 1261 ata_port_printk(ap, KERN_DEBUG, "abnormal Status 0x%X\n",
1115 status, ap->ioaddr.status_addr); 1262 status);
1263#endif
1116 1264
1117 return status; 1265 return status;
1118} 1266}
@@ -1149,7 +1297,7 @@ static inline void ata_tf_init(struct ata_device *dev, struct ata_taskfile *tf)
1149{ 1297{
1150 memset(tf, 0, sizeof(*tf)); 1298 memset(tf, 0, sizeof(*tf));
1151 1299
1152 tf->ctl = dev->ap->ctl; 1300 tf->ctl = dev->link->ap->ctl;
1153 if (dev->devno == 0) 1301 if (dev->devno == 0)
1154 tf->device = ATA_DEVICE_OBS; 1302 tf->device = ATA_DEVICE_OBS;
1155 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/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/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/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 63a80ea61124..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
@@ -104,9 +134,20 @@ extern 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/mod_devicetable.h b/include/linux/mod_devicetable.h
index 4dc5fa8be781..74523d999f7a 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -340,4 +340,30 @@ struct parisc_device_id {
340#define PA_HVERSION_ANY_ID 0xffff 340#define PA_HVERSION_ANY_ID 0xffff
341#define PA_SVERSION_ANY_ID 0xffffffff 341#define PA_SVERSION_ANY_ID 0xffffffff
342 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
343#endif /* LINUX_MOD_DEVICETABLE_H */ 369#endif /* LINUX_MOD_DEVICETABLE_H */
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 e679b2751665..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 */
@@ -582,17 +703,39 @@ struct net_device
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);
@@ -1105,7 +1381,7 @@ extern void dev_set_allmulti(struct net_device *dev, int inc);
1105extern void netdev_state_change(struct net_device *dev); 1381extern void netdev_state_change(struct net_device *dev);
1106extern void netdev_features_change(struct net_device *dev); 1382extern void netdev_features_change(struct net_device *dev);
1107/* Load a device via the kmod */ 1383/* Load a device via the kmod */
1108extern void dev_load(const char *name); 1384extern void dev_load(struct net *net, const char *name);
1109extern void dev_mcast_init(void); 1385extern void dev_mcast_init(void);
1110extern int netdev_max_backlog; 1386extern int netdev_max_backlog;
1111extern int weight_p; 1387extern int weight_p;
diff --git a/include/linux/netfilter/Kbuild b/include/linux/netfilter/Kbuild
index ab57cb7d7c61..f2eaea2234ec 100644
--- a/include/linux/netfilter/Kbuild
+++ b/include/linux/netfilter/Kbuild
@@ -40,5 +40,6 @@ unifdef-y += nf_conntrack_common.h
40unifdef-y += nf_conntrack_ftp.h 40unifdef-y += nf_conntrack_ftp.h
41unifdef-y += nf_conntrack_tcp.h 41unifdef-y += nf_conntrack_tcp.h
42unifdef-y += nfnetlink.h 42unifdef-y += nfnetlink.h
43unifdef-y += nfnetlink_compat.h
43unifdef-y += x_tables.h 44unifdef-y += x_tables.h
44unifdef-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_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/netlink.h b/include/linux/netlink.h
index 83d8239f0cce..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,8 +173,9 @@ 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);
164extern int netlink_change_ngroups(struct sock *sk, unsigned int groups); 181extern int netlink_change_ngroups(struct sock *sk, unsigned int groups);
@@ -177,7 +194,7 @@ struct sock *netlink_getsockbyfilp(struct file *filp);
177int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock, 194int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock,
178 long timeo, struct sock *ssk); 195 long timeo, struct sock *ssk);
179void netlink_detachskb(struct sock *sk, struct sk_buff *skb); 196void netlink_detachskb(struct sock *sk, struct sk_buff *skb);
180int netlink_sendskb(struct sock *sk, struct sk_buff *skb, int protocol); 197int netlink_sendskb(struct sock *sk, struct sk_buff *skb);
181 198
182/* 199/*
183 * 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.
@@ -206,6 +223,7 @@ struct netlink_callback
206 223
207struct netlink_notify 224struct netlink_notify
208{ 225{
226 struct net *net;
209 int pid; 227 int pid;
210 int protocol; 228 int protocol;
211}; 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/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/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
index 47734ffd9745..6df80e985914 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -54,7 +54,6 @@ extern int of_device_is_compatible(const struct device_node *device,
54extern const void *of_get_property(const struct device_node *node, 54extern const void *of_get_property(const struct device_node *node,
55 const char *name, 55 const char *name,
56 int *lenp); 56 int *lenp);
57#define get_property(a, b, c) of_get_property((a), (b), (c))
58extern int of_n_addr_cells(struct device_node *np); 57extern int of_n_addr_cells(struct device_node *np);
59extern int of_n_size_cells(struct device_node *np); 58extern int of_n_size_cells(struct device_node *np);
60 59
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 038a0dc7273a..768b93359f90 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -685,13 +685,16 @@ extern void pci_unblock_user_cfg_access(struct pci_dev *dev);
685 * 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
686 * configuration space. 686 * configuration space.
687 */ 687 */
688#ifndef CONFIG_PCI_DOMAINS 688#ifdef CONFIG_PCI_DOMAINS
689extern int pci_domains_supported;
690#else
691enum { pci_domains_supported = 0 };
689static inline int pci_domain_nr(struct pci_bus *bus) { return 0; } 692static inline int pci_domain_nr(struct pci_bus *bus) { return 0; }
690static inline int pci_proc_domain(struct pci_bus *bus) 693static inline int pci_proc_domain(struct pci_bus *bus)
691{ 694{
692 return 0; 695 return 0;
693} 696}
694#endif 697#endif /* CONFIG_PCI_DOMAINS */
695 698
696#else /* CONFIG_PCI is not enabled */ 699#else /* CONFIG_PCI is not enabled */
697 700
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 55f307ffbf96..87439ad94685 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -829,6 +829,9 @@
829#define PCI_DEVICE_ID_UMC_UM8886BF 0x673a 829#define PCI_DEVICE_ID_UMC_UM8886BF 0x673a
830#define PCI_DEVICE_ID_UMC_UM8886A 0x886a 830#define PCI_DEVICE_ID_UMC_UM8886A 0x886a
831 831
832#define PCI_VENDOR_ID_PICOPOWER 0x1066
833#define PCI_DEVICE_ID_PICOPOWER_PT86C523 0x0002
834#define PCI_DEVICE_ID_PICOPOWER_PT86C523BBP 0x8002
832 835
833#define PCI_VENDOR_ID_MYLEX 0x1069 836#define PCI_VENDOR_ID_MYLEX 0x1069
834#define PCI_DEVICE_ID_MYLEX_DAC960_P 0x0001 837#define PCI_DEVICE_ID_MYLEX_DAC960_P 0x0001
@@ -1471,6 +1474,8 @@
1471#define PCI_DEVICE_ID_RICOH_RL5C476 0x0476 1474#define PCI_DEVICE_ID_RICOH_RL5C476 0x0476
1472#define PCI_DEVICE_ID_RICOH_RL5C478 0x0478 1475#define PCI_DEVICE_ID_RICOH_RL5C478 0x0478
1473#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
1474 1479
1475#define PCI_VENDOR_ID_DLINK 0x1186 1480#define PCI_VENDOR_ID_DLINK 0x1186
1476#define PCI_DEVICE_ID_DLINK_DGE510T 0x4c00 1481#define PCI_DEVICE_ID_DLINK_DGE510T 0x4c00
@@ -1736,6 +1741,11 @@
1736 1741
1737#define PCI_VENDOR_ID_RADISYS 0x1331 1742#define PCI_VENDOR_ID_RADISYS 0x1331
1738 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
1739#define PCI_VENDOR_ID_DOMEX 0x134a 1749#define PCI_VENDOR_ID_DOMEX 0x134a
1740#define PCI_DEVICE_ID_DOMEX_DMX3191D 0x0001 1750#define PCI_DEVICE_ID_DOMEX_DMX3191D 0x0001
1741 1751
@@ -1841,6 +1851,8 @@
1841#define PCI_VENDOR_ID_ABOCOM 0x13D1 1851#define PCI_VENDOR_ID_ABOCOM 0x13D1
1842#define PCI_DEVICE_ID_ABOCOM_2BD1 0x2BD1 1852#define PCI_DEVICE_ID_ABOCOM_2BD1 0x2BD1
1843 1853
1854#define PCI_VENDOR_ID_SUNDANCE 0x13f0
1855
1844#define PCI_VENDOR_ID_CMEDIA 0x13f6 1856#define PCI_VENDOR_ID_CMEDIA 0x13f6
1845#define PCI_DEVICE_ID_CMEDIA_CM8338A 0x0100 1857#define PCI_DEVICE_ID_CMEDIA_CM8338A 0x0100
1846#define PCI_DEVICE_ID_CMEDIA_CM8338B 0x0101 1858#define PCI_DEVICE_ID_CMEDIA_CM8338B 0x0101
@@ -1948,8 +1960,12 @@
1948#define PCI_DEVICE_ID_TIGON3_5751M 0x167d 1960#define PCI_DEVICE_ID_TIGON3_5751M 0x167d
1949#define PCI_DEVICE_ID_TIGON3_5751F 0x167e 1961#define PCI_DEVICE_ID_TIGON3_5751F 0x167e
1950#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
1951#define PCI_DEVICE_ID_TIGON3_5787M 0x1693 1966#define PCI_DEVICE_ID_TIGON3_5787M 0x1693
1952#define PCI_DEVICE_ID_TIGON3_5782 0x1696 1967#define PCI_DEVICE_ID_TIGON3_5782 0x1696
1968#define PCI_DEVICE_ID_TIGON3_5784 0x1698
1953#define PCI_DEVICE_ID_TIGON3_5786 0x169a 1969#define PCI_DEVICE_ID_TIGON3_5786 0x169a
1954#define PCI_DEVICE_ID_TIGON3_5787 0x169b 1970#define PCI_DEVICE_ID_TIGON3_5787 0x169b
1955#define PCI_DEVICE_ID_TIGON3_5788 0x169c 1971#define PCI_DEVICE_ID_TIGON3_5788 0x169c
@@ -2100,8 +2116,11 @@
2100#define PCI_DEVICE_ID_MPC8533 0x0031 2116#define PCI_DEVICE_ID_MPC8533 0x0031
2101#define PCI_DEVICE_ID_MPC8544E 0x0032 2117#define PCI_DEVICE_ID_MPC8544E 0x0032
2102#define PCI_DEVICE_ID_MPC8544 0x0033 2118#define PCI_DEVICE_ID_MPC8544 0x0033
2119#define PCI_DEVICE_ID_MPC8572E 0x0040
2120#define PCI_DEVICE_ID_MPC8572 0x0041
2103#define PCI_DEVICE_ID_MPC8641 0x7010 2121#define PCI_DEVICE_ID_MPC8641 0x7010
2104#define PCI_DEVICE_ID_MPC8641D 0x7011 2122#define PCI_DEVICE_ID_MPC8641D 0x7011
2123#define PCI_DEVICE_ID_MPC8610 0x7018
2105 2124
2106#define PCI_VENDOR_ID_PASEMI 0x1959 2125#define PCI_VENDOR_ID_PASEMI 0x1959
2107 2126
@@ -2123,6 +2142,11 @@
2123#define PCI_VENDOR_ID_TEKRAM 0x1de1 2142#define PCI_VENDOR_ID_TEKRAM 0x1de1
2124#define PCI_DEVICE_ID_TEKRAM_DC290 0xdc29 2143#define PCI_DEVICE_ID_TEKRAM_DC290 0xdc29
2125 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
2126#define PCI_VENDOR_ID_HINT 0x3388 2150#define PCI_VENDOR_ID_HINT 0x3388
2127#define PCI_DEVICE_ID_HINT_VXPROII_IDE 0x8013 2151#define PCI_DEVICE_ID_HINT_VXPROII_IDE 0x8013
2128 2152
@@ -2221,6 +2245,7 @@
2221#define PCI_DEVICE_ID_INTEL_82801EB_5 0x24d5 2245#define PCI_DEVICE_ID_INTEL_82801EB_5 0x24d5
2222#define PCI_DEVICE_ID_INTEL_82801EB_6 0x24d6 2246#define PCI_DEVICE_ID_INTEL_82801EB_6 0x24d6
2223#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
2224#define PCI_DEVICE_ID_INTEL_82801EB_13 0x24dd 2249#define PCI_DEVICE_ID_INTEL_82801EB_13 0x24dd
2225#define PCI_DEVICE_ID_INTEL_ESB_1 0x25a1 2250#define PCI_DEVICE_ID_INTEL_ESB_1 0x25a1
2226#define PCI_DEVICE_ID_INTEL_ESB_2 0x25a2 2251#define PCI_DEVICE_ID_INTEL_ESB_2 0x25a2
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/proc_fs.h b/include/linux/proc_fs.h
index cd13a78c5db8..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/*
@@ -97,8 +98,6 @@ struct vmcore {
97 98
98extern struct proc_dir_entry proc_root; 99extern struct proc_dir_entry proc_root;
99extern struct proc_dir_entry *proc_root_fs; 100extern struct proc_dir_entry *proc_root_fs;
100extern struct proc_dir_entry *proc_net;
101extern struct proc_dir_entry *proc_net_stat;
102extern struct proc_dir_entry *proc_bus; 101extern struct proc_dir_entry *proc_bus;
103extern struct proc_dir_entry *proc_root_driver; 102extern struct proc_dir_entry *proc_root_driver;
104extern struct proc_dir_entry *proc_root_kcore; 103extern struct proc_dir_entry *proc_root_kcore;
@@ -192,36 +191,21 @@ static inline struct proc_dir_entry *create_proc_info_entry(const char *name,
192 if (res) res->get_info=get_info; 191 if (res) res->get_info=get_info;
193 return res; 192 return res;
194} 193}
195
196static inline struct proc_dir_entry *proc_net_create(const char *name,
197 mode_t mode, get_info_t *get_info)
198{
199 return create_proc_info_entry(name,mode,proc_net,get_info);
200}
201 194
202static inline struct proc_dir_entry *proc_net_fops_create(const char *name, 195extern struct proc_dir_entry *proc_net_create(struct net *net,
203 mode_t mode, const struct file_operations *fops) 196 const char *name, mode_t mode, get_info_t *get_info);
204{ 197extern struct proc_dir_entry *proc_net_fops_create(struct net *net,
205 struct proc_dir_entry *res = create_proc_entry(name, mode, proc_net); 198 const char *name, mode_t mode, const struct file_operations *fops);
206 if (res) 199extern void proc_net_remove(struct net *net, const char *name);
207 res->proc_fops = fops;
208 return res;
209}
210
211static inline void proc_net_remove(const char *name)
212{
213 remove_proc_entry(name,proc_net);
214}
215 200
216#else 201#else
217 202
218#define proc_root_driver NULL 203#define proc_root_driver NULL
219#define proc_net NULL
220#define proc_bus NULL 204#define proc_bus NULL
221 205
222#define proc_net_fops_create(name, mode, fops) ({ (void)(mode), NULL; }) 206#define proc_net_fops_create(net, name, mode, fops) ({ (void)(mode), NULL; })
223#define proc_net_create(name, mode, info) ({ (void)(mode), NULL; }) 207#define proc_net_create(net, name, mode, info) ({ (void)(mode), NULL; })
224static inline void proc_net_remove(const char *name) {} 208static inline void proc_net_remove(struct net *net, const char *name) {}
225 209
226static inline void proc_flush_task(struct task_struct *task) { } 210static inline void proc_flush_task(struct task_struct *task) { }
227 211
@@ -281,6 +265,13 @@ static inline struct proc_dir_entry *PDE(const struct inode *inode)
281 return PROC_I(inode)->pde; 265 return PROC_I(inode)->pde;
282} 266}
283 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
284struct proc_maps_private { 275struct proc_maps_private {
285 struct pid *pid; 276 struct pid *pid;
286 struct task_struct *task; 277 struct task_struct *task;
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 dff3192374f8..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};
@@ -479,6 +482,30 @@ enum
479#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))))
480#define TCA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct tcmsg)) 483#define TCA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct tcmsg))
481 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
482#ifndef __KERNEL__ 509#ifndef __KERNEL__
483/* RTnetlink multicast groups - backwards compatibility for userspace */ 510/* RTnetlink multicast groups - backwards compatibility for userspace */
484#define RTMGRP_LINK 1 511#define RTMGRP_LINK 1
@@ -542,6 +569,8 @@ enum rtnetlink_groups {
542#define RTNLGRP_IPV6_PREFIX RTNLGRP_IPV6_PREFIX 569#define RTNLGRP_IPV6_PREFIX RTNLGRP_IPV6_PREFIX
543 RTNLGRP_IPV6_RULE, 570 RTNLGRP_IPV6_RULE,
544#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
545 __RTNLGRP_MAX 574 __RTNLGRP_MAX
546}; 575};
547#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 313c6b6e774f..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
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/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/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/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/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/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/tty.h b/include/linux/tty.h
index 6570719eafdf..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
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 4f33a58fa9d1..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 */
@@ -344,6 +346,11 @@ struct usb_tt;
344 * 346 *
345 * Usbcore drivers should not set usbdev->state directly. Instead use 347 * Usbcore drivers should not set usbdev->state directly. Instead use
346 * 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
347 */ 354 */
348struct usb_device { 355struct usb_device {
349 int devnum; /* Address on USB bus */ 356 int devnum; /* Address on USB bus */
@@ -376,8 +383,11 @@ struct usb_device {
376 u8 portnum; /* Parent port number (origin 1) */ 383 u8 portnum; /* Parent port number (origin 1) */
377 u8 level; /* Number of USB hub ancestors */ 384 u8 level; /* Number of USB hub ancestors */
378 385
386 unsigned can_submit:1; /* URBs may be submitted */
379 unsigned discon_suspended:1; /* Disconnected while suspended */ 387 unsigned discon_suspended:1; /* Disconnected while suspended */
380 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 */
381 int string_langid; /* language ID for strings */ 391 int string_langid; /* language ID for strings */
382 392
383 /* static strings from the device */ 393 /* static strings from the device */
@@ -405,6 +415,7 @@ struct usb_device {
405 415
406 int pm_usage_cnt; /* usage counter for autosuspend */ 416 int pm_usage_cnt; /* usage counter for autosuspend */
407 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 */
408 419
409#ifdef CONFIG_PM 420#ifdef CONFIG_PM
410 struct delayed_work autosuspend; /* for delayed autosuspends */ 421 struct delayed_work autosuspend; /* for delayed autosuspends */
@@ -419,6 +430,7 @@ struct usb_device {
419 unsigned persist_enabled:1; /* USB_PERSIST enabled for this dev */ 430 unsigned persist_enabled:1; /* USB_PERSIST enabled for this dev */
420 unsigned autosuspend_disabled:1; /* autosuspend and autoresume */ 431 unsigned autosuspend_disabled:1; /* autosuspend and autoresume */
421 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 */
422#endif 434#endif
423}; 435};
424#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)
@@ -555,6 +567,29 @@ static inline int usb_make_path (struct usb_device *dev, char *buf,
555/*-------------------------------------------------------------------------*/ 567/*-------------------------------------------------------------------------*/
556 568
557/** 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/**
558 * usb_endpoint_dir_in - check if the endpoint has IN direction 593 * usb_endpoint_dir_in - check if the endpoint has IN direction
559 * @epd: endpoint to be checked 594 * @epd: endpoint to be checked
560 * 595 *
@@ -996,6 +1031,8 @@ extern int usb_disabled(void);
996 1031
997/* 1032/*
998 * urb->transfer_flags: 1033 * urb->transfer_flags:
1034 *
1035 * Note: URB_DIR_IN/OUT is automatically set in usb_submit_urb().
999 */ 1036 */
1000#define URB_SHORT_NOT_OK 0x0001 /* report short reads as errors */ 1037#define URB_SHORT_NOT_OK 0x0001 /* report short reads as errors */
1001#define URB_ISO_ASAP 0x0002 /* iso-only, urb->start_frame 1038#define URB_ISO_ASAP 0x0002 /* iso-only, urb->start_frame
@@ -1008,6 +1045,10 @@ extern int usb_disabled(void);
1008 * needed */ 1045 * needed */
1009#define URB_FREE_BUFFER 0x0100 /* Free transfer buffer with the URB */ 1046#define URB_FREE_BUFFER 0x0100 /* Free transfer buffer with the URB */
1010 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
1011struct usb_iso_packet_descriptor { 1052struct usb_iso_packet_descriptor {
1012 unsigned int offset; 1053 unsigned int offset;
1013 unsigned int length; /* expected length */ 1054 unsigned int length; /* expected length */
@@ -1037,6 +1078,8 @@ typedef void (*usb_complete_t)(struct urb *);
1037 * @urb_list: For use by current owner of the URB. 1078 * @urb_list: For use by current owner of the URB.
1038 * @anchor_list: membership in the list of an anchor 1079 * @anchor_list: membership in the list of an anchor
1039 * @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.
1040 * @pipe: Holds endpoint number, direction, type, and more. 1083 * @pipe: Holds endpoint number, direction, type, and more.
1041 * Create these values with the eight macros available; 1084 * Create these values with the eight macros available;
1042 * usb_{snd,rcv}TYPEpipe(dev,endpoint), where the TYPE is "ctrl" 1085 * usb_{snd,rcv}TYPEpipe(dev,endpoint), where the TYPE is "ctrl"
@@ -1201,10 +1244,10 @@ struct urb
1201{ 1244{
1202 /* private: usb core and host controller only fields in the urb */ 1245 /* private: usb core and host controller only fields in the urb */
1203 struct kref kref; /* reference count of the URB */ 1246 struct kref kref; /* reference count of the URB */
1204 spinlock_t lock; /* lock for the URB */
1205 void *hcpriv; /* private data for host controller */ 1247 void *hcpriv; /* private data for host controller */
1206 atomic_t use_count; /* concurrent submissions counter */ 1248 atomic_t use_count; /* concurrent submissions counter */
1207 u8 reject; /* submissions will fail */ 1249 u8 reject; /* submissions will fail */
1250 int unlinked; /* unlink error code */
1208 1251
1209 /* 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 */
1210 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
@@ -1212,6 +1255,7 @@ struct urb
1212 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 */
1213 struct usb_anchor *anchor; 1256 struct usb_anchor *anchor;
1214 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 */
1215 unsigned int pipe; /* (in) pipe information */ 1259 unsigned int pipe; /* (in) pipe information */
1216 int status; /* (return) non-ISO status */ 1260 int status; /* (return) non-ISO status */
1217 unsigned int transfer_flags; /* (in) URB_SHORT_NOT_OK | ...*/ 1261 unsigned int transfer_flags; /* (in) URB_SHORT_NOT_OK | ...*/
@@ -1257,7 +1301,6 @@ static inline void usb_fill_control_urb (struct urb *urb,
1257 usb_complete_t complete_fn, 1301 usb_complete_t complete_fn,
1258 void *context) 1302 void *context)
1259{ 1303{
1260 spin_lock_init(&urb->lock);
1261 urb->dev = dev; 1304 urb->dev = dev;
1262 urb->pipe = pipe; 1305 urb->pipe = pipe;
1263 urb->setup_packet = setup_packet; 1306 urb->setup_packet = setup_packet;
@@ -1288,7 +1331,6 @@ static inline void usb_fill_bulk_urb (struct urb *urb,
1288 usb_complete_t complete_fn, 1331 usb_complete_t complete_fn,
1289 void *context) 1332 void *context)
1290{ 1333{
1291 spin_lock_init(&urb->lock);
1292 urb->dev = dev; 1334 urb->dev = dev;
1293 urb->pipe = pipe; 1335 urb->pipe = pipe;
1294 urb->transfer_buffer = transfer_buffer; 1336 urb->transfer_buffer = transfer_buffer;
@@ -1324,7 +1366,6 @@ static inline void usb_fill_int_urb (struct urb *urb,
1324 void *context, 1366 void *context,
1325 int interval) 1367 int interval)
1326{ 1368{
1327 spin_lock_init(&urb->lock);
1328 urb->dev = dev; 1369 urb->dev = dev;
1329 urb->pipe = pipe; 1370 urb->pipe = pipe;
1330 urb->transfer_buffer = transfer_buffer; 1371 urb->transfer_buffer = transfer_buffer;
@@ -1352,6 +1393,30 @@ extern void usb_unanchor_urb(struct urb *urb);
1352extern int usb_wait_anchor_empty_timeout(struct usb_anchor *anchor, 1393extern int usb_wait_anchor_empty_timeout(struct usb_anchor *anchor,
1353 unsigned int timeout); 1394 unsigned int timeout);
1354 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
1355void *usb_buffer_alloc (struct usb_device *dev, size_t size, 1420void *usb_buffer_alloc (struct usb_device *dev, size_t size,
1356 gfp_t mem_flags, dma_addr_t *dma); 1421 gfp_t mem_flags, dma_addr_t *dma);
1357void usb_buffer_free (struct usb_device *dev, size_t size, 1422void usb_buffer_free (struct usb_device *dev, size_t size,
@@ -1364,13 +1429,13 @@ void usb_buffer_unmap (struct urb *urb);
1364#endif 1429#endif
1365 1430
1366struct scatterlist; 1431struct scatterlist;
1367int usb_buffer_map_sg(const struct usb_device *dev, unsigned pipe, 1432int usb_buffer_map_sg(const struct usb_device *dev, int is_in,
1368 struct scatterlist *sg, int nents); 1433 struct scatterlist *sg, int nents);
1369#if 0 1434#if 0
1370void usb_buffer_dmasync_sg(const struct usb_device *dev, unsigned pipe, 1435void usb_buffer_dmasync_sg(const struct usb_device *dev, int is_in,
1371 struct scatterlist *sg, int n_hw_ents); 1436 struct scatterlist *sg, int n_hw_ents);
1372#endif 1437#endif
1373void usb_buffer_unmap_sg(const struct usb_device *dev, unsigned pipe, 1438void usb_buffer_unmap_sg(const struct usb_device *dev, int is_in,
1374 struct scatterlist *sg, int n_hw_ents); 1439 struct scatterlist *sg, int n_hw_ents);
1375 1440
1376/*-------------------------------------------------------------------* 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/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 ae9b24c12f6a..1f503e94eff1 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -271,6 +271,7 @@ struct v4l2_pix_format
271 271
272/* Pixel format FOURCC depth Description */ 272/* Pixel format FOURCC depth Description */
273#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 */
274#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 */
275#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 */
276#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 */
@@ -280,6 +281,7 @@ struct v4l2_pix_format
280#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 */
281#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 */
282#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 */
283#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 */
284#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 */
285#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 */
@@ -287,6 +289,10 @@ struct v4l2_pix_format
287#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 */
288#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 */
289#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 */
290 296
291/* two planes -- one Y, one Cr + Cb interleaved */ 297/* two planes -- one Y, one Cr + Cb interleaved */
292#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 */
@@ -298,7 +304,6 @@ struct v4l2_pix_format
298#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 */
299#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 */
300#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 */
301#define V4L2_PIX_FMT_RGB444 v4l2_fourcc('R','4','4','4') /* 16 xxxxrrrr ggggbbbb */
302 307
303/* see http://www.siliconimaging.com/RGB%20Bayer.htm */ 308/* see http://www.siliconimaging.com/RGB%20Bayer.htm */
304#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.. */
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index b4af6bcb7b7a..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
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 */