diff options
Diffstat (limited to 'include/linux')
60 files changed, 2115 insertions, 1347 deletions
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index b46a5205ee7b..026c3c011dc0 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
| @@ -41,7 +41,7 @@ | |||
| 41 | #include <asm/acpi.h> | 41 | #include <asm/acpi.h> |
| 42 | 42 | ||
| 43 | 43 | ||
| 44 | #ifdef CONFIG_ACPI_BOOT | 44 | #ifdef CONFIG_ACPI |
| 45 | 45 | ||
| 46 | enum acpi_irq_model_id { | 46 | enum acpi_irq_model_id { |
| 47 | ACPI_IRQ_MODEL_PIC = 0, | 47 | ACPI_IRQ_MODEL_PIC = 0, |
| @@ -429,23 +429,13 @@ extern int pci_mmcfg_config_num; | |||
| 429 | 429 | ||
| 430 | extern int sbf_port ; | 430 | extern int sbf_port ; |
| 431 | 431 | ||
| 432 | #else /*!CONFIG_ACPI_BOOT*/ | 432 | #else /* !CONFIG_ACPI */ |
| 433 | 433 | ||
| 434 | #define acpi_mp_config 0 | 434 | #define acpi_mp_config 0 |
| 435 | 435 | ||
| 436 | static inline int acpi_boot_init(void) | 436 | #endif /* !CONFIG_ACPI */ |
| 437 | { | ||
| 438 | return 0; | ||
| 439 | } | ||
| 440 | |||
| 441 | static inline int acpi_boot_table_init(void) | ||
| 442 | { | ||
| 443 | return 0; | ||
| 444 | } | ||
| 445 | 437 | ||
| 446 | #endif /*!CONFIG_ACPI_BOOT*/ | 438 | int acpi_register_gsi (u32 gsi, int edge_level, int active_high_low); |
| 447 | |||
| 448 | unsigned int acpi_register_gsi (u32 gsi, int edge_level, int active_high_low); | ||
| 449 | int acpi_gsi_to_irq (u32 gsi, unsigned int *irq); | 439 | int acpi_gsi_to_irq (u32 gsi, unsigned int *irq); |
| 450 | 440 | ||
| 451 | /* | 441 | /* |
| @@ -455,7 +445,7 @@ int acpi_gsi_to_irq (u32 gsi, unsigned int *irq); | |||
| 455 | */ | 445 | */ |
| 456 | void acpi_unregister_gsi (u32 gsi); | 446 | void acpi_unregister_gsi (u32 gsi); |
| 457 | 447 | ||
| 458 | #ifdef CONFIG_ACPI_PCI | 448 | #ifdef CONFIG_ACPI |
| 459 | 449 | ||
| 460 | struct acpi_prt_entry { | 450 | struct acpi_prt_entry { |
| 461 | struct list_head node; | 451 | struct list_head node; |
| @@ -489,7 +479,7 @@ struct acpi_pci_driver { | |||
| 489 | int acpi_pci_register_driver(struct acpi_pci_driver *driver); | 479 | int acpi_pci_register_driver(struct acpi_pci_driver *driver); |
| 490 | void acpi_pci_unregister_driver(struct acpi_pci_driver *driver); | 480 | void acpi_pci_unregister_driver(struct acpi_pci_driver *driver); |
| 491 | 481 | ||
| 492 | #endif /*CONFIG_ACPI_PCI*/ | 482 | #endif /* CONFIG_ACPI */ |
| 493 | 483 | ||
| 494 | #ifdef CONFIG_ACPI_EC | 484 | #ifdef CONFIG_ACPI_EC |
| 495 | 485 | ||
| @@ -498,20 +488,9 @@ extern int ec_write(u8 addr, u8 val); | |||
| 498 | 488 | ||
| 499 | #endif /*CONFIG_ACPI_EC*/ | 489 | #endif /*CONFIG_ACPI_EC*/ |
| 500 | 490 | ||
| 501 | #ifdef CONFIG_ACPI_INTERPRETER | ||
| 502 | |||
| 503 | extern int acpi_blacklisted(void); | 491 | extern int acpi_blacklisted(void); |
| 504 | extern void acpi_bios_year(char *s); | 492 | extern void acpi_bios_year(char *s); |
| 505 | 493 | ||
| 506 | #else /*!CONFIG_ACPI_INTERPRETER*/ | ||
| 507 | |||
| 508 | static inline int acpi_blacklisted(void) | ||
| 509 | { | ||
| 510 | return 0; | ||
| 511 | } | ||
| 512 | |||
| 513 | #endif /*!CONFIG_ACPI_INTERPRETER*/ | ||
| 514 | |||
| 515 | #define ACPI_CSTATE_LIMIT_DEFINED /* for driver builds */ | 494 | #define ACPI_CSTATE_LIMIT_DEFINED /* for driver builds */ |
| 516 | #ifdef CONFIG_ACPI | 495 | #ifdef CONFIG_ACPI |
| 517 | 496 | ||
| @@ -549,5 +528,17 @@ static inline int acpi_get_pxm(acpi_handle handle) | |||
| 549 | 528 | ||
| 550 | extern int pnpacpi_disabled; | 529 | extern int pnpacpi_disabled; |
| 551 | 530 | ||
| 531 | #else /* CONFIG_ACPI */ | ||
| 532 | |||
| 533 | static inline int acpi_boot_init(void) | ||
| 534 | { | ||
| 535 | return 0; | ||
| 536 | } | ||
| 537 | |||
| 538 | static inline int acpi_boot_table_init(void) | ||
| 539 | { | ||
| 540 | return 0; | ||
| 541 | } | ||
| 542 | |||
| 552 | #endif /* CONFIG_ACPI */ | 543 | #endif /* CONFIG_ACPI */ |
| 553 | #endif /*_LINUX_ACPI_H*/ | 544 | #endif /*_LINUX_ACPI_H*/ |
diff --git a/include/linux/bfs_fs.h b/include/linux/bfs_fs.h index f7f0913cd110..c1237aa92e38 100644 --- a/include/linux/bfs_fs.h +++ b/include/linux/bfs_fs.h | |||
| @@ -14,8 +14,9 @@ | |||
| 14 | #define BFS_INODES_PER_BLOCK 8 | 14 | #define BFS_INODES_PER_BLOCK 8 |
| 15 | 15 | ||
| 16 | /* SVR4 vnode type values (bfs_inode->i_vtype) */ | 16 | /* SVR4 vnode type values (bfs_inode->i_vtype) */ |
| 17 | #define BFS_VDIR 2 | 17 | #define BFS_VDIR 2L |
| 18 | #define BFS_VREG 1 | 18 | #define BFS_VREG 1L |
| 19 | |||
| 19 | 20 | ||
| 20 | /* BFS inode layout on disk */ | 21 | /* BFS inode layout on disk */ |
| 21 | struct bfs_inode { | 22 | struct bfs_inode { |
| @@ -58,22 +59,22 @@ struct bfs_super_block { | |||
| 58 | __u32 s_padding[118]; | 59 | __u32 s_padding[118]; |
| 59 | }; | 60 | }; |
| 60 | 61 | ||
| 61 | #define BFS_NZFILESIZE(ip) \ | ||
| 62 | (((ip)->i_eoffset + 1) - (ip)->i_sblock * BFS_BSIZE) | ||
| 63 | |||
| 64 | #define BFS_FILESIZE(ip) \ | ||
| 65 | ((ip)->i_sblock == 0 ? 0 : BFS_NZFILESIZE(ip)) | ||
| 66 | |||
| 67 | #define BFS_FILEBLOCKS(ip) \ | ||
| 68 | ((ip)->i_sblock == 0 ? 0 : ((ip)->i_eblock + 1) - (ip)->i_sblock) | ||
| 69 | 62 | ||
| 70 | #define BFS_OFF2INO(offset) \ | 63 | #define BFS_OFF2INO(offset) \ |
| 71 | ((((offset) - BFS_BSIZE) / sizeof(struct bfs_inode)) + BFS_ROOT_INO) | 64 | ((((offset) - BFS_BSIZE) / sizeof(struct bfs_inode)) + BFS_ROOT_INO) |
| 72 | 65 | ||
| 73 | #define BFS_INO2OFF(ino) \ | 66 | #define BFS_INO2OFF(ino) \ |
| 74 | ((__u32)(((ino) - BFS_ROOT_INO) * sizeof(struct bfs_inode)) + BFS_BSIZE) | 67 | ((__u32)(((ino) - BFS_ROOT_INO) * sizeof(struct bfs_inode)) + BFS_BSIZE) |
| 68 | #define BFS_NZFILESIZE(ip) \ | ||
| 69 | ((cpu_to_le32((ip)->i_eoffset) + 1) - cpu_to_le32((ip)->i_sblock) * BFS_BSIZE) | ||
| 70 | |||
| 71 | #define BFS_FILESIZE(ip) \ | ||
| 72 | ((ip)->i_sblock == 0 ? 0 : BFS_NZFILESIZE(ip)) | ||
| 75 | 73 | ||
| 74 | #define BFS_FILEBLOCKS(ip) \ | ||
| 75 | ((ip)->i_sblock == 0 ? 0 : (cpu_to_le32((ip)->i_eblock) + 1) - cpu_to_le32((ip)->i_sblock)) | ||
| 76 | #define BFS_UNCLEAN(bfs_sb, sb) \ | 76 | #define BFS_UNCLEAN(bfs_sb, sb) \ |
| 77 | ((bfs_sb->s_from != -1) && (bfs_sb->s_to != -1) && !(sb->s_flags & MS_RDONLY)) | 77 | ((cpu_to_le32(bfs_sb->s_from) != -1) && (cpu_to_le32(bfs_sb->s_to) != -1) && !(sb->s_flags & MS_RDONLY)) |
| 78 | |||
| 78 | 79 | ||
| 79 | #endif /* _LINUX_BFS_FS_H */ | 80 | #endif /* _LINUX_BFS_FS_H */ |
diff --git a/include/linux/bio.h b/include/linux/bio.h index cdaf03a14a51..6e1c79c8b6bf 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h | |||
| @@ -314,9 +314,8 @@ void zero_fill_bio(struct bio *bio); | |||
| 314 | * bvec_kmap_irq and bvec_kunmap_irq!! | 314 | * bvec_kmap_irq and bvec_kunmap_irq!! |
| 315 | * | 315 | * |
| 316 | * This function MUST be inlined - it plays with the CPU interrupt flags. | 316 | * This function MUST be inlined - it plays with the CPU interrupt flags. |
| 317 | * Hence the `extern inline'. | ||
| 318 | */ | 317 | */ |
| 319 | extern inline char *bvec_kmap_irq(struct bio_vec *bvec, unsigned long *flags) | 318 | static inline char *bvec_kmap_irq(struct bio_vec *bvec, unsigned long *flags) |
| 320 | { | 319 | { |
| 321 | unsigned long addr; | 320 | unsigned long addr; |
| 322 | 321 | ||
| @@ -332,7 +331,7 @@ extern inline char *bvec_kmap_irq(struct bio_vec *bvec, unsigned long *flags) | |||
| 332 | return (char *) addr + bvec->bv_offset; | 331 | return (char *) addr + bvec->bv_offset; |
| 333 | } | 332 | } |
| 334 | 333 | ||
| 335 | extern inline void bvec_kunmap_irq(char *buffer, unsigned long *flags) | 334 | static inline void bvec_kunmap_irq(char *buffer, unsigned long *flags) |
| 336 | { | 335 | { |
| 337 | unsigned long ptr = (unsigned long) buffer & PAGE_MASK; | 336 | unsigned long ptr = (unsigned long) buffer & PAGE_MASK; |
| 338 | 337 | ||
| @@ -345,7 +344,7 @@ extern inline void bvec_kunmap_irq(char *buffer, unsigned long *flags) | |||
| 345 | #define bvec_kunmap_irq(buf, flags) do { *(flags) = 0; } while (0) | 344 | #define bvec_kunmap_irq(buf, flags) do { *(flags) = 0; } while (0) |
| 346 | #endif | 345 | #endif |
| 347 | 346 | ||
| 348 | extern inline char *__bio_kmap_irq(struct bio *bio, unsigned short idx, | 347 | static inline char *__bio_kmap_irq(struct bio *bio, unsigned short idx, |
| 349 | unsigned long *flags) | 348 | unsigned long *flags) |
| 350 | { | 349 | { |
| 351 | return bvec_kmap_irq(bio_iovec_idx(bio, idx), flags); | 350 | return bvec_kmap_irq(bio_iovec_idx(bio, idx), flags); |
diff --git a/include/linux/bit_spinlock.h b/include/linux/bit_spinlock.h new file mode 100644 index 000000000000..6b20af0bbb79 --- /dev/null +++ b/include/linux/bit_spinlock.h | |||
| @@ -0,0 +1,77 @@ | |||
| 1 | #ifndef __LINUX_BIT_SPINLOCK_H | ||
| 2 | #define __LINUX_BIT_SPINLOCK_H | ||
| 3 | |||
| 4 | /* | ||
| 5 | * bit-based spin_lock() | ||
| 6 | * | ||
| 7 | * Don't use this unless you really need to: spin_lock() and spin_unlock() | ||
| 8 | * are significantly faster. | ||
| 9 | */ | ||
| 10 | static inline void bit_spin_lock(int bitnum, unsigned long *addr) | ||
| 11 | { | ||
| 12 | /* | ||
| 13 | * Assuming the lock is uncontended, this never enters | ||
| 14 | * the body of the outer loop. If it is contended, then | ||
| 15 | * within the inner loop a non-atomic test is used to | ||
| 16 | * busywait with less bus contention for a good time to | ||
| 17 | * attempt to acquire the lock bit. | ||
| 18 | */ | ||
| 19 | preempt_disable(); | ||
| 20 | #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) | ||
| 21 | while (test_and_set_bit(bitnum, addr)) { | ||
| 22 | while (test_bit(bitnum, addr)) { | ||
| 23 | preempt_enable(); | ||
| 24 | cpu_relax(); | ||
| 25 | preempt_disable(); | ||
| 26 | } | ||
| 27 | } | ||
| 28 | #endif | ||
| 29 | __acquire(bitlock); | ||
| 30 | } | ||
| 31 | |||
| 32 | /* | ||
| 33 | * Return true if it was acquired | ||
| 34 | */ | ||
| 35 | static inline int bit_spin_trylock(int bitnum, unsigned long *addr) | ||
| 36 | { | ||
| 37 | preempt_disable(); | ||
| 38 | #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) | ||
| 39 | if (test_and_set_bit(bitnum, addr)) { | ||
| 40 | preempt_enable(); | ||
| 41 | return 0; | ||
| 42 | } | ||
| 43 | #endif | ||
| 44 | __acquire(bitlock); | ||
| 45 | return 1; | ||
| 46 | } | ||
| 47 | |||
| 48 | /* | ||
| 49 | * bit-based spin_unlock() | ||
| 50 | */ | ||
| 51 | static inline void bit_spin_unlock(int bitnum, unsigned long *addr) | ||
| 52 | { | ||
| 53 | #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) | ||
| 54 | BUG_ON(!test_bit(bitnum, addr)); | ||
| 55 | smp_mb__before_clear_bit(); | ||
| 56 | clear_bit(bitnum, addr); | ||
| 57 | #endif | ||
| 58 | preempt_enable(); | ||
| 59 | __release(bitlock); | ||
| 60 | } | ||
| 61 | |||
| 62 | /* | ||
| 63 | * Return true if the lock is held. | ||
| 64 | */ | ||
| 65 | static inline int bit_spin_is_locked(int bitnum, unsigned long *addr) | ||
| 66 | { | ||
| 67 | #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) | ||
| 68 | return test_bit(bitnum, addr); | ||
| 69 | #elif defined CONFIG_PREEMPT | ||
| 70 | return preempt_count(); | ||
| 71 | #else | ||
| 72 | return 1; | ||
| 73 | #endif | ||
| 74 | } | ||
| 75 | |||
| 76 | #endif /* __LINUX_BIT_SPINLOCK_H */ | ||
| 77 | |||
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index aefa26fbae8a..efdc9b5bc05c 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
| @@ -728,7 +728,7 @@ static inline unsigned int blksize_bits(unsigned int size) | |||
| 728 | return bits; | 728 | return bits; |
| 729 | } | 729 | } |
| 730 | 730 | ||
| 731 | extern inline unsigned int block_size(struct block_device *bdev) | 731 | static inline unsigned int block_size(struct block_device *bdev) |
| 732 | { | 732 | { |
| 733 | return bdev->bd_block_size; | 733 | return bdev->bd_block_size; |
| 734 | } | 734 | } |
diff --git a/include/linux/chio.h b/include/linux/chio.h index 63035ae67e63..a404c111c937 100644 --- a/include/linux/chio.h +++ b/include/linux/chio.h | |||
| @@ -96,7 +96,7 @@ struct changer_position { | |||
| 96 | */ | 96 | */ |
| 97 | struct changer_element_status { | 97 | struct changer_element_status { |
| 98 | int ces_type; | 98 | int ces_type; |
| 99 | unsigned char *ces_data; | 99 | unsigned char __user *ces_data; |
| 100 | }; | 100 | }; |
| 101 | #define CESTATUS_FULL 0x01 /* full */ | 101 | #define CESTATUS_FULL 0x01 /* full */ |
| 102 | #define CESTATUS_IMPEXP 0x02 /* media was imported (inserted by sysop) */ | 102 | #define CESTATUS_IMPEXP 0x02 /* media was imported (inserted by sysop) */ |
diff --git a/include/linux/connector.h b/include/linux/connector.h new file mode 100644 index 000000000000..96de26301f84 --- /dev/null +++ b/include/linux/connector.h | |||
| @@ -0,0 +1,158 @@ | |||
| 1 | /* | ||
| 2 | * connector.h | ||
| 3 | * | ||
| 4 | * 2004-2005 Copyright (c) Evgeniy Polyakov <johnpol@2ka.mipt.ru> | ||
| 5 | * All rights reserved. | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License as published by | ||
| 9 | * the Free Software Foundation; either version 2 of the License, or | ||
| 10 | * (at your option) any later version. | ||
| 11 | * | ||
| 12 | * This program is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | * GNU General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License | ||
| 18 | * along with this program; if not, write to the Free Software | ||
| 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 20 | */ | ||
| 21 | |||
| 22 | #ifndef __CONNECTOR_H | ||
| 23 | #define __CONNECTOR_H | ||
| 24 | |||
| 25 | #include <asm/types.h> | ||
| 26 | |||
| 27 | #define CN_IDX_CONNECTOR 0xffffffff | ||
| 28 | #define CN_VAL_CONNECTOR 0xffffffff | ||
| 29 | |||
| 30 | #define CN_NETLINK_USERS 1 | ||
| 31 | |||
| 32 | /* | ||
| 33 | * Maximum connector's message size. | ||
| 34 | */ | ||
| 35 | #define CONNECTOR_MAX_MSG_SIZE 1024 | ||
| 36 | |||
| 37 | /* | ||
| 38 | * idx and val are unique identifiers which | ||
| 39 | * are used for message routing and | ||
| 40 | * must be registered in connector.h for in-kernel usage. | ||
| 41 | */ | ||
| 42 | |||
| 43 | struct cb_id { | ||
| 44 | __u32 idx; | ||
| 45 | __u32 val; | ||
| 46 | }; | ||
| 47 | |||
| 48 | struct cn_msg { | ||
| 49 | struct cb_id id; | ||
| 50 | |||
| 51 | __u32 seq; | ||
| 52 | __u32 ack; | ||
| 53 | |||
| 54 | __u16 len; /* Length of the following data */ | ||
| 55 | __u16 flags; | ||
| 56 | __u8 data[0]; | ||
| 57 | }; | ||
| 58 | |||
| 59 | /* | ||
| 60 | * Notify structure - requests notification about | ||
| 61 | * registering/unregistering idx/val in range [first, first+range]. | ||
| 62 | */ | ||
| 63 | struct cn_notify_req { | ||
| 64 | __u32 first; | ||
| 65 | __u32 range; | ||
| 66 | }; | ||
| 67 | |||
| 68 | /* | ||
| 69 | * Main notification control message | ||
| 70 | * *_notify_num - number of appropriate cn_notify_req structures after | ||
| 71 | * this struct. | ||
| 72 | * group - notification receiver's idx. | ||
| 73 | * len - total length of the attached data. | ||
| 74 | */ | ||
| 75 | struct cn_ctl_msg { | ||
| 76 | __u32 idx_notify_num; | ||
| 77 | __u32 val_notify_num; | ||
| 78 | __u32 group; | ||
| 79 | __u32 len; | ||
| 80 | __u8 data[0]; | ||
| 81 | }; | ||
| 82 | |||
| 83 | #ifdef __KERNEL__ | ||
| 84 | |||
| 85 | #include <asm/atomic.h> | ||
| 86 | |||
| 87 | #include <linux/list.h> | ||
| 88 | #include <linux/workqueue.h> | ||
| 89 | |||
| 90 | #include <net/sock.h> | ||
| 91 | |||
| 92 | #define CN_CBQ_NAMELEN 32 | ||
| 93 | |||
| 94 | struct cn_queue_dev { | ||
| 95 | atomic_t refcnt; | ||
| 96 | unsigned char name[CN_CBQ_NAMELEN]; | ||
| 97 | |||
| 98 | struct workqueue_struct *cn_queue; | ||
| 99 | |||
| 100 | struct list_head queue_list; | ||
| 101 | spinlock_t queue_lock; | ||
| 102 | |||
| 103 | int netlink_groups; | ||
| 104 | struct sock *nls; | ||
| 105 | }; | ||
| 106 | |||
| 107 | struct cn_callback { | ||
| 108 | unsigned char name[CN_CBQ_NAMELEN]; | ||
| 109 | |||
| 110 | struct cb_id id; | ||
| 111 | void (*callback) (void *); | ||
| 112 | void *priv; | ||
| 113 | }; | ||
| 114 | |||
| 115 | struct cn_callback_entry { | ||
| 116 | struct list_head callback_entry; | ||
| 117 | struct cn_callback *cb; | ||
| 118 | struct work_struct work; | ||
| 119 | struct cn_queue_dev *pdev; | ||
| 120 | |||
| 121 | void (*destruct_data) (void *); | ||
| 122 | void *ddata; | ||
| 123 | |||
| 124 | int seq, group; | ||
| 125 | struct sock *nls; | ||
| 126 | }; | ||
| 127 | |||
| 128 | struct cn_ctl_entry { | ||
| 129 | struct list_head notify_entry; | ||
| 130 | struct cn_ctl_msg *msg; | ||
| 131 | }; | ||
| 132 | |||
| 133 | struct cn_dev { | ||
| 134 | struct cb_id id; | ||
| 135 | |||
| 136 | u32 seq, groups; | ||
| 137 | struct sock *nls; | ||
| 138 | void (*input) (struct sock * sk, int len); | ||
| 139 | |||
| 140 | struct cn_queue_dev *cbdev; | ||
| 141 | }; | ||
| 142 | |||
| 143 | int cn_add_callback(struct cb_id *, char *, void (*callback) (void *)); | ||
| 144 | void cn_del_callback(struct cb_id *); | ||
| 145 | int cn_netlink_send(struct cn_msg *, u32, int); | ||
| 146 | |||
| 147 | int cn_queue_add_callback(struct cn_queue_dev *dev, struct cn_callback *cb); | ||
| 148 | void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id); | ||
| 149 | |||
| 150 | struct cn_queue_dev *cn_queue_alloc_dev(char *name, struct sock *); | ||
| 151 | void cn_queue_free_dev(struct cn_queue_dev *dev); | ||
| 152 | |||
| 153 | int cn_cb_equal(struct cb_id *, struct cb_id *); | ||
| 154 | |||
| 155 | extern int cn_already_initialized; | ||
| 156 | |||
| 157 | #endif /* __KERNEL__ */ | ||
| 158 | #endif /* __CONNECTOR_H */ | ||
diff --git a/include/linux/crc16.h b/include/linux/crc16.h new file mode 100644 index 000000000000..9443c084f881 --- /dev/null +++ b/include/linux/crc16.h | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | /* | ||
| 2 | * crc16.h - CRC-16 routine | ||
| 3 | * | ||
| 4 | * Implements the standard CRC-16: | ||
| 5 | * Width 16 | ||
| 6 | * Poly 0x8005 (x^16 + x^15 + x^2 + 1) | ||
| 7 | * Init 0 | ||
| 8 | * | ||
| 9 | * Copyright (c) 2005 Ben Gardner <bgardner@wabtec.com> | ||
| 10 | * | ||
| 11 | * This source code is licensed under the GNU General Public License, | ||
| 12 | * Version 2. See the file COPYING for more details. | ||
| 13 | */ | ||
| 14 | |||
| 15 | #ifndef __CRC16_H | ||
| 16 | #define __CRC16_H | ||
| 17 | |||
| 18 | #include <linux/types.h> | ||
| 19 | |||
| 20 | extern u16 const crc16_table[256]; | ||
| 21 | |||
| 22 | extern u16 crc16(u16 crc, const u8 *buffer, size_t len); | ||
| 23 | |||
| 24 | static inline u16 crc16_byte(u16 crc, const u8 data) | ||
| 25 | { | ||
| 26 | return (crc >> 8) ^ crc16_table[(crc ^ data) & 0xff]; | ||
| 27 | } | ||
| 28 | |||
| 29 | #endif /* __CRC16_H */ | ||
| 30 | |||
diff --git a/include/linux/dccp.h b/include/linux/dccp.h index 007c290f74d4..8bf4bacb5051 100644 --- a/include/linux/dccp.h +++ b/include/linux/dccp.h | |||
| @@ -432,7 +432,10 @@ struct dccp_sock { | |||
| 432 | struct ccid *dccps_hc_rx_ccid; | 432 | struct ccid *dccps_hc_rx_ccid; |
| 433 | struct ccid *dccps_hc_tx_ccid; | 433 | struct ccid *dccps_hc_tx_ccid; |
| 434 | struct dccp_options_received dccps_options_received; | 434 | struct dccp_options_received dccps_options_received; |
| 435 | struct timeval dccps_epoch; | ||
| 435 | enum dccp_role dccps_role:2; | 436 | enum dccp_role dccps_role:2; |
| 437 | __u8 dccps_hc_rx_insert_options:1; | ||
| 438 | __u8 dccps_hc_tx_insert_options:1; | ||
| 436 | }; | 439 | }; |
| 437 | 440 | ||
| 438 | static inline struct dccp_sock *dccp_sk(const struct sock *sk) | 441 | static inline struct dccp_sock *dccp_sk(const struct sock *sk) |
diff --git a/include/linux/dmapool.h b/include/linux/dmapool.h index e60bfdac348d..4932ee5c77f0 100644 --- a/include/linux/dmapool.h +++ b/include/linux/dmapool.h | |||
| @@ -19,7 +19,8 @@ struct dma_pool *dma_pool_create(const char *name, struct device *dev, | |||
| 19 | 19 | ||
| 20 | void dma_pool_destroy(struct dma_pool *pool); | 20 | void dma_pool_destroy(struct dma_pool *pool); |
| 21 | 21 | ||
| 22 | void *dma_pool_alloc(struct dma_pool *pool, int mem_flags, dma_addr_t *handle); | 22 | void *dma_pool_alloc(struct dma_pool *pool, unsigned int __nocast mem_flags, |
| 23 | dma_addr_t *handle); | ||
| 23 | 24 | ||
| 24 | void dma_pool_free(struct dma_pool *pool, void *vaddr, dma_addr_t addr); | 25 | void dma_pool_free(struct dma_pool *pool, void *vaddr, dma_addr_t addr); |
| 25 | 26 | ||
diff --git a/include/linux/dmi.h b/include/linux/dmi.h index c30175e8dec6..a415f1d93e9a 100644 --- a/include/linux/dmi.h +++ b/include/linux/dmi.h | |||
| @@ -70,7 +70,7 @@ extern struct dmi_device * dmi_find_device(int type, const char *name, | |||
| 70 | 70 | ||
| 71 | static inline int dmi_check_system(struct dmi_system_id *list) { return 0; } | 71 | static inline int dmi_check_system(struct dmi_system_id *list) { return 0; } |
| 72 | static inline char * dmi_get_system_info(int field) { return NULL; } | 72 | static inline char * dmi_get_system_info(int field) { return NULL; } |
| 73 | static struct dmi_device * dmi_find_device(int type, const char *name, | 73 | static inline struct dmi_device * dmi_find_device(int type, const char *name, |
| 74 | struct dmi_device *from) { return NULL; } | 74 | struct dmi_device *from) { return NULL; } |
| 75 | 75 | ||
| 76 | #endif | 76 | #endif |
diff --git a/include/linux/fb.h b/include/linux/fb.h index bc24beeed971..82e39cd0c4fb 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h | |||
| @@ -107,6 +107,8 @@ | |||
| 107 | #define FB_ACCEL_NV_20 44 /* nVidia Arch 20 */ | 107 | #define FB_ACCEL_NV_20 44 /* nVidia Arch 20 */ |
| 108 | #define FB_ACCEL_NV_30 45 /* nVidia Arch 30 */ | 108 | #define FB_ACCEL_NV_30 45 /* nVidia Arch 30 */ |
| 109 | #define FB_ACCEL_NV_40 46 /* nVidia Arch 40 */ | 109 | #define FB_ACCEL_NV_40 46 /* nVidia Arch 40 */ |
| 110 | #define FB_ACCEL_XGI_VOLARI_V 47 /* XGI Volari V3XT, V5, V8 */ | ||
| 111 | #define FB_ACCEL_XGI_VOLARI_Z 48 /* XGI Volari Z7 */ | ||
| 110 | #define FB_ACCEL_NEOMAGIC_NM2070 90 /* NeoMagic NM2070 */ | 112 | #define FB_ACCEL_NEOMAGIC_NM2070 90 /* NeoMagic NM2070 */ |
| 111 | #define FB_ACCEL_NEOMAGIC_NM2090 91 /* NeoMagic NM2090 */ | 113 | #define FB_ACCEL_NEOMAGIC_NM2090 91 /* NeoMagic NM2090 */ |
| 112 | #define FB_ACCEL_NEOMAGIC_NM2093 92 /* NeoMagic NM2093 */ | 114 | #define FB_ACCEL_NEOMAGIC_NM2093 92 /* NeoMagic NM2093 */ |
| @@ -495,6 +497,9 @@ struct fb_cursor_user { | |||
| 495 | #define FB_EVENT_BLANK 0x08 | 497 | #define FB_EVENT_BLANK 0x08 |
| 496 | /* Private modelist is to be replaced */ | 498 | /* Private modelist is to be replaced */ |
| 497 | #define FB_EVENT_NEW_MODELIST 0x09 | 499 | #define FB_EVENT_NEW_MODELIST 0x09 |
| 500 | /* The resolution of the passed in fb_info about to change and | ||
| 501 | all vc's should be changed */ | ||
| 502 | #define FB_EVENT_MODE_CHANGE_ALL 0x0A | ||
| 498 | 503 | ||
| 499 | struct fb_event { | 504 | struct fb_event { |
| 500 | struct fb_info *info; | 505 | struct fb_info *info; |
| @@ -820,13 +825,29 @@ extern void fb_pad_unaligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 idx, | |||
| 820 | u32 height, u32 shift_high, u32 shift_low, u32 mod); | 825 | u32 height, u32 shift_high, u32 shift_low, u32 mod); |
| 821 | extern void fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch, u32 height); | 826 | extern void fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch, u32 height); |
| 822 | extern void fb_set_suspend(struct fb_info *info, int state); | 827 | extern void fb_set_suspend(struct fb_info *info, int state); |
| 823 | extern int fb_get_color_depth(struct fb_var_screeninfo *var); | 828 | extern int fb_get_color_depth(struct fb_var_screeninfo *var, |
| 829 | struct fb_fix_screeninfo *fix); | ||
| 824 | extern int fb_get_options(char *name, char **option); | 830 | extern int fb_get_options(char *name, char **option); |
| 825 | extern int fb_new_modelist(struct fb_info *info); | 831 | extern int fb_new_modelist(struct fb_info *info); |
| 826 | 832 | ||
| 827 | extern struct fb_info *registered_fb[FB_MAX]; | 833 | extern struct fb_info *registered_fb[FB_MAX]; |
| 828 | extern int num_registered_fb; | 834 | extern int num_registered_fb; |
| 829 | 835 | ||
| 836 | static inline void __fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, | ||
| 837 | u8 *src, u32 s_pitch, u32 height) | ||
| 838 | { | ||
| 839 | int i, j; | ||
| 840 | |||
| 841 | d_pitch -= s_pitch; | ||
| 842 | |||
| 843 | for (i = height; i--; ) { | ||
| 844 | /* s_pitch is a few bytes at the most, memcpy is suboptimal */ | ||
| 845 | for (j = 0; j < s_pitch; j++) | ||
| 846 | *dst++ = *src++; | ||
| 847 | dst += d_pitch; | ||
| 848 | } | ||
| 849 | } | ||
| 850 | |||
| 830 | /* drivers/video/fbsysfs.c */ | 851 | /* drivers/video/fbsysfs.c */ |
| 831 | extern struct fb_info *framebuffer_alloc(size_t size, struct device *dev); | 852 | extern struct fb_info *framebuffer_alloc(size_t size, struct device *dev); |
| 832 | extern void framebuffer_release(struct fb_info *info); | 853 | extern void framebuffer_release(struct fb_info *info); |
| @@ -856,8 +877,11 @@ extern int fb_get_mode(int flags, u32 val, struct fb_var_screeninfo *var, | |||
| 856 | extern int fb_validate_mode(const struct fb_var_screeninfo *var, | 877 | extern int fb_validate_mode(const struct fb_var_screeninfo *var, |
| 857 | struct fb_info *info); | 878 | struct fb_info *info); |
| 858 | extern int fb_parse_edid(unsigned char *edid, struct fb_var_screeninfo *var); | 879 | extern int fb_parse_edid(unsigned char *edid, struct fb_var_screeninfo *var); |
| 859 | extern void fb_edid_to_monspecs(unsigned char *edid, struct fb_monspecs *specs); | 880 | extern const unsigned char *fb_firmware_edid(struct device *device); |
| 881 | extern void fb_edid_to_monspecs(unsigned char *edid, | ||
| 882 | struct fb_monspecs *specs); | ||
| 860 | extern void fb_destroy_modedb(struct fb_videomode *modedb); | 883 | extern void fb_destroy_modedb(struct fb_videomode *modedb); |
| 884 | extern int fb_find_mode_cvt(struct fb_videomode *mode, int margins, int rb); | ||
| 861 | 885 | ||
| 862 | /* drivers/video/modedb.c */ | 886 | /* drivers/video/modedb.c */ |
| 863 | #define VESA_MODEDB_SIZE 34 | 887 | #define VESA_MODEDB_SIZE 34 |
diff --git a/include/linux/file.h b/include/linux/file.h index 5206beb9a80e..f5bbd4c508b3 100644 --- a/include/linux/file.h +++ b/include/linux/file.h | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | #include <linux/posix_types.h> | 9 | #include <linux/posix_types.h> |
| 10 | #include <linux/compiler.h> | 10 | #include <linux/compiler.h> |
| 11 | #include <linux/spinlock.h> | 11 | #include <linux/spinlock.h> |
| 12 | #include <linux/rcupdate.h> | ||
| 12 | 13 | ||
| 13 | /* | 14 | /* |
| 14 | * The default fd array needs to be at least BITS_PER_LONG, | 15 | * The default fd array needs to be at least BITS_PER_LONG, |
| @@ -16,23 +17,33 @@ | |||
| 16 | */ | 17 | */ |
| 17 | #define NR_OPEN_DEFAULT BITS_PER_LONG | 18 | #define NR_OPEN_DEFAULT BITS_PER_LONG |
| 18 | 19 | ||
| 20 | struct fdtable { | ||
| 21 | unsigned int max_fds; | ||
| 22 | int max_fdset; | ||
| 23 | int next_fd; | ||
| 24 | struct file ** fd; /* current fd array */ | ||
| 25 | fd_set *close_on_exec; | ||
| 26 | fd_set *open_fds; | ||
| 27 | struct rcu_head rcu; | ||
| 28 | struct files_struct *free_files; | ||
| 29 | struct fdtable *next; | ||
| 30 | }; | ||
| 31 | |||
| 19 | /* | 32 | /* |
| 20 | * Open file table structure | 33 | * Open file table structure |
| 21 | */ | 34 | */ |
| 22 | struct files_struct { | 35 | struct files_struct { |
| 23 | atomic_t count; | 36 | atomic_t count; |
| 24 | spinlock_t file_lock; /* Protects all the below members. Nests inside tsk->alloc_lock */ | 37 | spinlock_t file_lock; /* Protects all the below members. Nests inside tsk->alloc_lock */ |
| 25 | int max_fds; | 38 | struct fdtable *fdt; |
| 26 | int max_fdset; | 39 | struct fdtable fdtab; |
| 27 | int next_fd; | ||
| 28 | struct file ** fd; /* current fd array */ | ||
| 29 | fd_set *close_on_exec; | ||
| 30 | fd_set *open_fds; | ||
| 31 | fd_set close_on_exec_init; | 40 | fd_set close_on_exec_init; |
| 32 | fd_set open_fds_init; | 41 | fd_set open_fds_init; |
| 33 | struct file * fd_array[NR_OPEN_DEFAULT]; | 42 | struct file * fd_array[NR_OPEN_DEFAULT]; |
| 34 | }; | 43 | }; |
| 35 | 44 | ||
| 45 | #define files_fdtable(files) (rcu_dereference((files)->fdt)) | ||
| 46 | |||
| 36 | extern void FASTCALL(__fput(struct file *)); | 47 | extern void FASTCALL(__fput(struct file *)); |
| 37 | extern void FASTCALL(fput(struct file *)); | 48 | extern void FASTCALL(fput(struct file *)); |
| 38 | 49 | ||
| @@ -59,13 +70,16 @@ extern fd_set *alloc_fdset(int); | |||
| 59 | extern void free_fdset(fd_set *, int); | 70 | extern void free_fdset(fd_set *, int); |
| 60 | 71 | ||
| 61 | extern int expand_files(struct files_struct *, int nr); | 72 | extern int expand_files(struct files_struct *, int nr); |
| 73 | extern void free_fdtable(struct fdtable *fdt); | ||
| 74 | extern void __init files_defer_init(void); | ||
| 62 | 75 | ||
| 63 | static inline struct file * fcheck_files(struct files_struct *files, unsigned int fd) | 76 | static inline struct file * fcheck_files(struct files_struct *files, unsigned int fd) |
| 64 | { | 77 | { |
| 65 | struct file * file = NULL; | 78 | struct file * file = NULL; |
| 79 | struct fdtable *fdt = files_fdtable(files); | ||
| 66 | 80 | ||
| 67 | if (fd < files->max_fds) | 81 | if (fd < fdt->max_fds) |
| 68 | file = files->fd[fd]; | 82 | file = rcu_dereference(fdt->fd[fd]); |
| 69 | return file; | 83 | return file; |
| 70 | } | 84 | } |
| 71 | 85 | ||
diff --git a/include/linux/fs.h b/include/linux/fs.h index fd93ab7da905..e0b77c5af9a0 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | #include <linux/config.h> | 9 | #include <linux/config.h> |
| 10 | #include <linux/limits.h> | 10 | #include <linux/limits.h> |
| 11 | #include <linux/ioctl.h> | 11 | #include <linux/ioctl.h> |
| 12 | #include <linux/rcuref.h> | ||
| 12 | 13 | ||
| 13 | /* | 14 | /* |
| 14 | * It's silly to have NR_OPEN bigger than NR_FILE, but you can change | 15 | * It's silly to have NR_OPEN bigger than NR_FILE, but you can change |
| @@ -597,12 +598,13 @@ struct file { | |||
| 597 | spinlock_t f_ep_lock; | 598 | spinlock_t f_ep_lock; |
| 598 | #endif /* #ifdef CONFIG_EPOLL */ | 599 | #endif /* #ifdef CONFIG_EPOLL */ |
| 599 | struct address_space *f_mapping; | 600 | struct address_space *f_mapping; |
| 601 | struct rcu_head f_rcuhead; | ||
| 600 | }; | 602 | }; |
| 601 | extern spinlock_t files_lock; | 603 | extern spinlock_t files_lock; |
| 602 | #define file_list_lock() spin_lock(&files_lock); | 604 | #define file_list_lock() spin_lock(&files_lock); |
| 603 | #define file_list_unlock() spin_unlock(&files_lock); | 605 | #define file_list_unlock() spin_unlock(&files_lock); |
| 604 | 606 | ||
| 605 | #define get_file(x) atomic_inc(&(x)->f_count) | 607 | #define get_file(x) rcuref_inc(&(x)->f_count) |
| 606 | #define file_count(x) atomic_read(&(x)->f_count) | 608 | #define file_count(x) atomic_read(&(x)->f_count) |
| 607 | 609 | ||
| 608 | #define MAX_NON_LFS ((1UL<<31) - 1) | 610 | #define MAX_NON_LFS ((1UL<<31) - 1) |
| @@ -1507,8 +1509,6 @@ extern void do_generic_mapping_read(struct address_space *mapping, | |||
| 1507 | loff_t *, read_descriptor_t *, read_actor_t); | 1509 | loff_t *, read_descriptor_t *, read_actor_t); |
| 1508 | extern void | 1510 | extern void |
| 1509 | file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping); | 1511 | file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping); |
| 1510 | extern ssize_t generic_file_direct_IO(int rw, struct kiocb *iocb, | ||
| 1511 | const struct iovec *iov, loff_t offset, unsigned long nr_segs); | ||
| 1512 | extern ssize_t generic_file_readv(struct file *filp, const struct iovec *iov, | 1512 | extern ssize_t generic_file_readv(struct file *filp, const struct iovec *iov, |
| 1513 | unsigned long nr_segs, loff_t *ppos); | 1513 | unsigned long nr_segs, loff_t *ppos); |
| 1514 | ssize_t generic_file_writev(struct file *filp, const struct iovec *iov, | 1514 | ssize_t generic_file_writev(struct file *filp, const struct iovec *iov, |
diff --git a/include/linux/fuse.h b/include/linux/fuse.h new file mode 100644 index 000000000000..acbeb96a3353 --- /dev/null +++ b/include/linux/fuse.h | |||
| @@ -0,0 +1,259 @@ | |||
| 1 | /* | ||
| 2 | FUSE: Filesystem in Userspace | ||
| 3 | Copyright (C) 2001-2005 Miklos Szeredi <miklos@szeredi.hu> | ||
| 4 | |||
| 5 | This program can be distributed under the terms of the GNU GPL. | ||
| 6 | See the file COPYING. | ||
| 7 | */ | ||
| 8 | |||
| 9 | /* This file defines the kernel interface of FUSE */ | ||
| 10 | |||
| 11 | #include <asm/types.h> | ||
| 12 | |||
| 13 | /** Version number of this interface */ | ||
| 14 | #define FUSE_KERNEL_VERSION 7 | ||
| 15 | |||
| 16 | /** Minor version number of this interface */ | ||
| 17 | #define FUSE_KERNEL_MINOR_VERSION 2 | ||
| 18 | |||
| 19 | /** The node ID of the root inode */ | ||
| 20 | #define FUSE_ROOT_ID 1 | ||
| 21 | |||
| 22 | /** The major number of the fuse character device */ | ||
| 23 | #define FUSE_MAJOR 10 | ||
| 24 | |||
| 25 | /** The minor number of the fuse character device */ | ||
| 26 | #define FUSE_MINOR 229 | ||
| 27 | |||
| 28 | /* Make sure all structures are padded to 64bit boundary, so 32bit | ||
| 29 | userspace works under 64bit kernels */ | ||
| 30 | |||
| 31 | struct fuse_attr { | ||
| 32 | __u64 ino; | ||
| 33 | __u64 size; | ||
| 34 | __u64 blocks; | ||
| 35 | __u64 atime; | ||
| 36 | __u64 mtime; | ||
| 37 | __u64 ctime; | ||
| 38 | __u32 atimensec; | ||
| 39 | __u32 mtimensec; | ||
| 40 | __u32 ctimensec; | ||
| 41 | __u32 mode; | ||
| 42 | __u32 nlink; | ||
| 43 | __u32 uid; | ||
| 44 | __u32 gid; | ||
| 45 | __u32 rdev; | ||
| 46 | }; | ||
| 47 | |||
| 48 | struct fuse_kstatfs { | ||
| 49 | __u64 blocks; | ||
| 50 | __u64 bfree; | ||
| 51 | __u64 bavail; | ||
| 52 | __u64 files; | ||
| 53 | __u64 ffree; | ||
| 54 | __u32 bsize; | ||
| 55 | __u32 namelen; | ||
| 56 | }; | ||
| 57 | |||
| 58 | #define FATTR_MODE (1 << 0) | ||
| 59 | #define FATTR_UID (1 << 1) | ||
| 60 | #define FATTR_GID (1 << 2) | ||
| 61 | #define FATTR_SIZE (1 << 3) | ||
| 62 | #define FATTR_ATIME (1 << 4) | ||
| 63 | #define FATTR_MTIME (1 << 5) | ||
| 64 | #define FATTR_CTIME (1 << 6) | ||
| 65 | |||
| 66 | /** | ||
| 67 | * Flags returned by the OPEN request | ||
| 68 | * | ||
| 69 | * FOPEN_DIRECT_IO: bypass page cache for this open file | ||
| 70 | * FOPEN_KEEP_CACHE: don't invalidate the data cache on open | ||
| 71 | */ | ||
| 72 | #define FOPEN_DIRECT_IO (1 << 0) | ||
| 73 | #define FOPEN_KEEP_CACHE (1 << 1) | ||
| 74 | |||
| 75 | enum fuse_opcode { | ||
| 76 | FUSE_LOOKUP = 1, | ||
| 77 | FUSE_FORGET = 2, /* no reply */ | ||
| 78 | FUSE_GETATTR = 3, | ||
| 79 | FUSE_SETATTR = 4, | ||
| 80 | FUSE_READLINK = 5, | ||
| 81 | FUSE_SYMLINK = 6, | ||
| 82 | FUSE_MKNOD = 8, | ||
| 83 | FUSE_MKDIR = 9, | ||
| 84 | FUSE_UNLINK = 10, | ||
| 85 | FUSE_RMDIR = 11, | ||
| 86 | FUSE_RENAME = 12, | ||
| 87 | FUSE_LINK = 13, | ||
| 88 | FUSE_OPEN = 14, | ||
| 89 | FUSE_READ = 15, | ||
| 90 | FUSE_WRITE = 16, | ||
| 91 | FUSE_STATFS = 17, | ||
| 92 | FUSE_RELEASE = 18, | ||
| 93 | FUSE_FSYNC = 20, | ||
| 94 | FUSE_SETXATTR = 21, | ||
| 95 | FUSE_GETXATTR = 22, | ||
| 96 | FUSE_LISTXATTR = 23, | ||
| 97 | FUSE_REMOVEXATTR = 24, | ||
| 98 | FUSE_FLUSH = 25, | ||
| 99 | FUSE_INIT = 26, | ||
| 100 | FUSE_OPENDIR = 27, | ||
| 101 | FUSE_READDIR = 28, | ||
| 102 | FUSE_RELEASEDIR = 29, | ||
| 103 | FUSE_FSYNCDIR = 30 | ||
| 104 | }; | ||
| 105 | |||
| 106 | /* Conservative buffer size for the client */ | ||
| 107 | #define FUSE_MAX_IN 8192 | ||
| 108 | |||
| 109 | #define FUSE_NAME_MAX 1024 | ||
| 110 | #define FUSE_SYMLINK_MAX 4096 | ||
| 111 | #define FUSE_XATTR_SIZE_MAX 4096 | ||
| 112 | |||
| 113 | struct fuse_entry_out { | ||
| 114 | __u64 nodeid; /* Inode ID */ | ||
| 115 | __u64 generation; /* Inode generation: nodeid:gen must | ||
| 116 | be unique for the fs's lifetime */ | ||
| 117 | __u64 entry_valid; /* Cache timeout for the name */ | ||
| 118 | __u64 attr_valid; /* Cache timeout for the attributes */ | ||
| 119 | __u32 entry_valid_nsec; | ||
| 120 | __u32 attr_valid_nsec; | ||
| 121 | struct fuse_attr attr; | ||
| 122 | }; | ||
| 123 | |||
| 124 | struct fuse_forget_in { | ||
| 125 | __u64 nlookup; | ||
| 126 | }; | ||
| 127 | |||
| 128 | struct fuse_attr_out { | ||
| 129 | __u64 attr_valid; /* Cache timeout for the attributes */ | ||
| 130 | __u32 attr_valid_nsec; | ||
| 131 | __u32 dummy; | ||
| 132 | struct fuse_attr attr; | ||
| 133 | }; | ||
| 134 | |||
| 135 | struct fuse_mknod_in { | ||
| 136 | __u32 mode; | ||
| 137 | __u32 rdev; | ||
| 138 | }; | ||
| 139 | |||
| 140 | struct fuse_mkdir_in { | ||
| 141 | __u32 mode; | ||
| 142 | __u32 padding; | ||
| 143 | }; | ||
| 144 | |||
| 145 | struct fuse_rename_in { | ||
| 146 | __u64 newdir; | ||
| 147 | }; | ||
| 148 | |||
| 149 | struct fuse_link_in { | ||
| 150 | __u64 oldnodeid; | ||
| 151 | }; | ||
| 152 | |||
| 153 | struct fuse_setattr_in { | ||
| 154 | __u32 valid; | ||
| 155 | __u32 padding; | ||
| 156 | struct fuse_attr attr; | ||
| 157 | }; | ||
| 158 | |||
| 159 | struct fuse_open_in { | ||
| 160 | __u32 flags; | ||
| 161 | __u32 padding; | ||
| 162 | }; | ||
| 163 | |||
| 164 | struct fuse_open_out { | ||
| 165 | __u64 fh; | ||
| 166 | __u32 open_flags; | ||
| 167 | __u32 padding; | ||
| 168 | }; | ||
| 169 | |||
| 170 | struct fuse_release_in { | ||
| 171 | __u64 fh; | ||
| 172 | __u32 flags; | ||
| 173 | __u32 padding; | ||
| 174 | }; | ||
| 175 | |||
| 176 | struct fuse_flush_in { | ||
| 177 | __u64 fh; | ||
| 178 | __u32 flush_flags; | ||
| 179 | __u32 padding; | ||
| 180 | }; | ||
| 181 | |||
| 182 | struct fuse_read_in { | ||
| 183 | __u64 fh; | ||
| 184 | __u64 offset; | ||
| 185 | __u32 size; | ||
| 186 | __u32 padding; | ||
| 187 | }; | ||
| 188 | |||
| 189 | struct fuse_write_in { | ||
| 190 | __u64 fh; | ||
| 191 | __u64 offset; | ||
| 192 | __u32 size; | ||
| 193 | __u32 write_flags; | ||
| 194 | }; | ||
| 195 | |||
| 196 | struct fuse_write_out { | ||
| 197 | __u32 size; | ||
| 198 | __u32 padding; | ||
| 199 | }; | ||
| 200 | |||
| 201 | struct fuse_statfs_out { | ||
| 202 | struct fuse_kstatfs st; | ||
| 203 | }; | ||
| 204 | |||
| 205 | struct fuse_fsync_in { | ||
| 206 | __u64 fh; | ||
| 207 | __u32 fsync_flags; | ||
| 208 | __u32 padding; | ||
| 209 | }; | ||
| 210 | |||
| 211 | struct fuse_setxattr_in { | ||
| 212 | __u32 size; | ||
| 213 | __u32 flags; | ||
| 214 | }; | ||
| 215 | |||
| 216 | struct fuse_getxattr_in { | ||
| 217 | __u32 size; | ||
| 218 | __u32 padding; | ||
| 219 | }; | ||
| 220 | |||
| 221 | struct fuse_getxattr_out { | ||
| 222 | __u32 size; | ||
| 223 | __u32 padding; | ||
| 224 | }; | ||
| 225 | |||
| 226 | struct fuse_init_in_out { | ||
| 227 | __u32 major; | ||
| 228 | __u32 minor; | ||
| 229 | }; | ||
| 230 | |||
| 231 | struct fuse_in_header { | ||
| 232 | __u32 len; | ||
| 233 | __u32 opcode; | ||
| 234 | __u64 unique; | ||
| 235 | __u64 nodeid; | ||
| 236 | __u32 uid; | ||
| 237 | __u32 gid; | ||
| 238 | __u32 pid; | ||
| 239 | __u32 padding; | ||
| 240 | }; | ||
| 241 | |||
| 242 | struct fuse_out_header { | ||
| 243 | __u32 len; | ||
| 244 | __s32 error; | ||
| 245 | __u64 unique; | ||
| 246 | }; | ||
| 247 | |||
| 248 | struct fuse_dirent { | ||
| 249 | __u64 ino; | ||
| 250 | __u64 off; | ||
| 251 | __u32 namelen; | ||
| 252 | __u32 type; | ||
| 253 | char name[0]; | ||
| 254 | }; | ||
| 255 | |||
| 256 | #define FUSE_NAME_OFFSET ((unsigned) ((struct fuse_dirent *) 0)->name) | ||
| 257 | #define FUSE_DIRENT_ALIGN(x) (((x) + sizeof(__u64) - 1) & ~(sizeof(__u64) - 1)) | ||
| 258 | #define FUSE_DIRENT_SIZE(d) \ | ||
| 259 | FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen) | ||
diff --git a/include/linux/i2c-pxa.h b/include/linux/i2c-pxa.h new file mode 100644 index 000000000000..5f3eaf802223 --- /dev/null +++ b/include/linux/i2c-pxa.h | |||
| @@ -0,0 +1,48 @@ | |||
| 1 | #ifndef _LINUX_I2C_ALGO_PXA_H | ||
| 2 | #define _LINUX_I2C_ALGO_PXA_H | ||
| 3 | |||
| 4 | struct i2c_eeprom_emu_watcher { | ||
| 5 | void (*write)(void *, unsigned int addr, unsigned char newval); | ||
| 6 | }; | ||
| 7 | |||
| 8 | struct i2c_eeprom_emu_watch { | ||
| 9 | struct list_head node; | ||
| 10 | unsigned int start; | ||
| 11 | unsigned int end; | ||
| 12 | struct i2c_eeprom_emu_watcher *ops; | ||
| 13 | void *data; | ||
| 14 | }; | ||
| 15 | |||
| 16 | #define I2C_EEPROM_EMU_SIZE (256) | ||
| 17 | |||
| 18 | struct i2c_eeprom_emu { | ||
| 19 | unsigned int size; | ||
| 20 | unsigned int ptr; | ||
| 21 | unsigned int seen_start; | ||
| 22 | struct list_head watch; | ||
| 23 | |||
| 24 | unsigned char bytes[I2C_EEPROM_EMU_SIZE]; | ||
| 25 | }; | ||
| 26 | |||
| 27 | typedef enum i2c_slave_event_e { | ||
| 28 | I2C_SLAVE_EVENT_START_READ, | ||
| 29 | I2C_SLAVE_EVENT_START_WRITE, | ||
| 30 | I2C_SLAVE_EVENT_STOP | ||
| 31 | } i2c_slave_event_t; | ||
| 32 | |||
| 33 | struct i2c_slave_client { | ||
| 34 | void *data; | ||
| 35 | void (*event)(void *ptr, i2c_slave_event_t event); | ||
| 36 | int (*read) (void *ptr); | ||
| 37 | void (*write)(void *ptr, unsigned int val); | ||
| 38 | }; | ||
| 39 | |||
| 40 | extern int i2c_eeprom_emu_addwatcher(struct i2c_eeprom_emu *, void *data, | ||
| 41 | unsigned int addr, unsigned int size, | ||
| 42 | struct i2c_eeprom_emu_watcher *); | ||
| 43 | |||
| 44 | extern void i2c_eeprom_emu_delwatcher(struct i2c_eeprom_emu *, void *data, struct i2c_eeprom_emu_watcher *watcher); | ||
| 45 | |||
| 46 | extern struct i2c_eeprom_emu *i2c_pxa_get_eeprom(void); | ||
| 47 | |||
| 48 | #endif /* _LINUX_I2C_ALGO_PXA_H */ | ||
diff --git a/include/linux/in6.h b/include/linux/in6.h index dcf5720ffcbb..304aaedea305 100644 --- a/include/linux/in6.h +++ b/include/linux/in6.h | |||
| @@ -148,13 +148,13 @@ struct in6_flowlabel_req | |||
| 148 | */ | 148 | */ |
| 149 | 149 | ||
| 150 | #define IPV6_ADDRFORM 1 | 150 | #define IPV6_ADDRFORM 1 |
| 151 | #define IPV6_PKTINFO 2 | 151 | #define IPV6_2292PKTINFO 2 |
| 152 | #define IPV6_HOPOPTS 3 | 152 | #define IPV6_2292HOPOPTS 3 |
| 153 | #define IPV6_DSTOPTS 4 | 153 | #define IPV6_2292DSTOPTS 4 |
| 154 | #define IPV6_RTHDR 5 | 154 | #define IPV6_2292RTHDR 5 |
| 155 | #define IPV6_PKTOPTIONS 6 | 155 | #define IPV6_2292PKTOPTIONS 6 |
| 156 | #define IPV6_CHECKSUM 7 | 156 | #define IPV6_CHECKSUM 7 |
| 157 | #define IPV6_HOPLIMIT 8 | 157 | #define IPV6_2292HOPLIMIT 8 |
| 158 | #define IPV6_NEXTHOP 9 | 158 | #define IPV6_NEXTHOP 9 |
| 159 | #define IPV6_AUTHHDR 10 /* obsolete */ | 159 | #define IPV6_AUTHHDR 10 /* obsolete */ |
| 160 | #define IPV6_FLOWINFO 11 | 160 | #define IPV6_FLOWINFO 11 |
| @@ -198,4 +198,44 @@ struct in6_flowlabel_req | |||
| 198 | * MCAST_MSFILTER 48 | 198 | * MCAST_MSFILTER 48 |
| 199 | */ | 199 | */ |
| 200 | 200 | ||
| 201 | /* | ||
| 202 | * Advanced API (RFC3542) (1) | ||
| 203 | * | ||
| 204 | * Note: IPV6_RECVRTHDRDSTOPTS does not exist. see net/ipv6/datagram.c. | ||
| 205 | */ | ||
| 206 | |||
| 207 | #define IPV6_RECVPKTINFO 49 | ||
| 208 | #define IPV6_PKTINFO 50 | ||
| 209 | #define IPV6_RECVHOPLIMIT 51 | ||
| 210 | #define IPV6_HOPLIMIT 52 | ||
| 211 | #define IPV6_RECVHOPOPTS 53 | ||
| 212 | #define IPV6_HOPOPTS 54 | ||
| 213 | #define IPV6_RTHDRDSTOPTS 55 | ||
| 214 | #define IPV6_RECVRTHDR 56 | ||
| 215 | #define IPV6_RTHDR 57 | ||
| 216 | #define IPV6_RECVDSTOPTS 58 | ||
| 217 | #define IPV6_DSTOPTS 59 | ||
| 218 | #if 0 /* not yet */ | ||
| 219 | #define IPV6_RECVPATHMTU 60 | ||
| 220 | #define IPV6_PATHMTU 61 | ||
| 221 | #define IPV6_DONTFRAG 62 | ||
| 222 | #define IPV6_USE_MIN_MTU 63 | ||
| 223 | #endif | ||
| 224 | |||
| 225 | /* | ||
| 226 | * Netfilter | ||
| 227 | * | ||
| 228 | * Following socket options are used in ip6_tables; | ||
| 229 | * see include/linux/netfilter_ipv6/ip6_tables.h. | ||
| 230 | * | ||
| 231 | * IP6T_SO_SET_REPLACE / IP6T_SO_GET_INFO 64 | ||
| 232 | * IP6T_SO_SET_ADD_COUNTERS / IP6T_SO_GET_ENTRIES 65 | ||
| 233 | */ | ||
| 234 | |||
| 235 | /* | ||
| 236 | * Advanced API (RFC3542) (2) | ||
| 237 | */ | ||
| 238 | #define IPV6_RECVTCLASS 66 | ||
| 239 | #define IPV6_TCLASS 67 | ||
| 240 | |||
| 201 | #endif | 241 | #endif |
diff --git a/include/linux/init_task.h b/include/linux/init_task.h index c727c195a91a..68ab5f2ab9cd 100644 --- a/include/linux/init_task.h +++ b/include/linux/init_task.h | |||
| @@ -2,17 +2,27 @@ | |||
| 2 | #define _LINUX__INIT_TASK_H | 2 | #define _LINUX__INIT_TASK_H |
| 3 | 3 | ||
| 4 | #include <linux/file.h> | 4 | #include <linux/file.h> |
| 5 | #include <linux/rcupdate.h> | ||
| 5 | 6 | ||
| 6 | #define INIT_FILES \ | 7 | #define INIT_FDTABLE \ |
| 7 | { \ | 8 | { \ |
| 8 | .count = ATOMIC_INIT(1), \ | ||
| 9 | .file_lock = SPIN_LOCK_UNLOCKED, \ | ||
| 10 | .max_fds = NR_OPEN_DEFAULT, \ | 9 | .max_fds = NR_OPEN_DEFAULT, \ |
| 11 | .max_fdset = __FD_SETSIZE, \ | 10 | .max_fdset = __FD_SETSIZE, \ |
| 12 | .next_fd = 0, \ | 11 | .next_fd = 0, \ |
| 13 | .fd = &init_files.fd_array[0], \ | 12 | .fd = &init_files.fd_array[0], \ |
| 14 | .close_on_exec = &init_files.close_on_exec_init, \ | 13 | .close_on_exec = &init_files.close_on_exec_init, \ |
| 15 | .open_fds = &init_files.open_fds_init, \ | 14 | .open_fds = &init_files.open_fds_init, \ |
| 15 | .rcu = RCU_HEAD_INIT, \ | ||
| 16 | .free_files = NULL, \ | ||
| 17 | .next = NULL, \ | ||
| 18 | } | ||
| 19 | |||
| 20 | #define INIT_FILES \ | ||
| 21 | { \ | ||
| 22 | .count = ATOMIC_INIT(1), \ | ||
| 23 | .file_lock = SPIN_LOCK_UNLOCKED, \ | ||
| 24 | .fdt = &init_files.fdtab, \ | ||
| 25 | .fdtab = INIT_FDTABLE, \ | ||
| 16 | .close_on_exec_init = { { 0, } }, \ | 26 | .close_on_exec_init = { { 0, } }, \ |
| 17 | .open_fds_init = { { 0, } }, \ | 27 | .open_fds_init = { { 0, } }, \ |
| 18 | .fd_array = { NULL, } \ | 28 | .fd_array = { NULL, } \ |
diff --git a/include/linux/input.h b/include/linux/input.h index 4767e5429534..e8c296ff6257 100644 --- a/include/linux/input.h +++ b/include/linux/input.h | |||
| @@ -289,6 +289,8 @@ struct input_absinfo { | |||
| 289 | #define KEY_SCROLLDOWN 178 | 289 | #define KEY_SCROLLDOWN 178 |
| 290 | #define KEY_KPLEFTPAREN 179 | 290 | #define KEY_KPLEFTPAREN 179 |
| 291 | #define KEY_KPRIGHTPAREN 180 | 291 | #define KEY_KPRIGHTPAREN 180 |
| 292 | #define KEY_NEW 181 | ||
| 293 | #define KEY_REDO 182 | ||
| 292 | 294 | ||
| 293 | #define KEY_F13 183 | 295 | #define KEY_F13 183 |
| 294 | #define KEY_F14 184 | 296 | #define KEY_F14 184 |
| @@ -335,6 +337,12 @@ struct input_absinfo { | |||
| 335 | #define KEY_KBDILLUMDOWN 229 | 337 | #define KEY_KBDILLUMDOWN 229 |
| 336 | #define KEY_KBDILLUMUP 230 | 338 | #define KEY_KBDILLUMUP 230 |
| 337 | 339 | ||
| 340 | #define KEY_SEND 231 | ||
| 341 | #define KEY_REPLY 232 | ||
| 342 | #define KEY_FORWARDMAIL 233 | ||
| 343 | #define KEY_SAVE 234 | ||
| 344 | #define KEY_DOCUMENTS 235 | ||
| 345 | |||
| 338 | #define KEY_UNKNOWN 240 | 346 | #define KEY_UNKNOWN 240 |
| 339 | 347 | ||
| 340 | #define BTN_MISC 0x100 | 348 | #define BTN_MISC 0x100 |
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index d99e7aeb7d33..0a90205184b0 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h | |||
| @@ -57,6 +57,11 @@ extern void disable_irq(unsigned int irq); | |||
| 57 | extern void enable_irq(unsigned int irq); | 57 | extern void enable_irq(unsigned int irq); |
| 58 | #endif | 58 | #endif |
| 59 | 59 | ||
| 60 | #ifndef __ARCH_SET_SOFTIRQ_PENDING | ||
| 61 | #define set_softirq_pending(x) (local_softirq_pending() = (x)) | ||
| 62 | #define or_softirq_pending(x) (local_softirq_pending() |= (x)) | ||
| 63 | #endif | ||
| 64 | |||
| 60 | /* | 65 | /* |
| 61 | * Temporary defines for UP kernels, until all code gets fixed. | 66 | * Temporary defines for UP kernels, until all code gets fixed. |
| 62 | */ | 67 | */ |
| @@ -123,7 +128,7 @@ struct softirq_action | |||
| 123 | asmlinkage void do_softirq(void); | 128 | asmlinkage void do_softirq(void); |
| 124 | extern void open_softirq(int nr, void (*action)(struct softirq_action*), void *data); | 129 | extern void open_softirq(int nr, void (*action)(struct softirq_action*), void *data); |
| 125 | extern void softirq_init(void); | 130 | extern void softirq_init(void); |
| 126 | #define __raise_softirq_irqoff(nr) do { local_softirq_pending() |= 1UL << (nr); } while (0) | 131 | #define __raise_softirq_irqoff(nr) do { or_softirq_pending(1UL << (nr)); } while (0) |
| 127 | extern void FASTCALL(raise_softirq_irqoff(unsigned int nr)); | 132 | extern void FASTCALL(raise_softirq_irqoff(unsigned int nr)); |
| 128 | extern void FASTCALL(raise_softirq(unsigned int nr)); | 133 | extern void FASTCALL(raise_softirq(unsigned int nr)); |
| 129 | 134 | ||
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h index 3c7dbc6a0a70..bb6f88e14061 100644 --- a/include/linux/ipv6.h +++ b/include/linux/ipv6.h | |||
| @@ -68,7 +68,7 @@ struct ipv6_opt_hdr { | |||
| 68 | 68 | ||
| 69 | struct rt0_hdr { | 69 | struct rt0_hdr { |
| 70 | struct ipv6_rt_hdr rt_hdr; | 70 | struct ipv6_rt_hdr rt_hdr; |
| 71 | __u32 bitmap; /* strict/loose bit map */ | 71 | __u32 reserved; |
| 72 | struct in6_addr addr[0]; | 72 | struct in6_addr addr[0]; |
| 73 | 73 | ||
| 74 | #define rt0_type rt_hdr.type | 74 | #define rt0_type rt_hdr.type |
| @@ -189,6 +189,7 @@ struct inet6_skb_parm { | |||
| 189 | __u16 dst0; | 189 | __u16 dst0; |
| 190 | __u16 srcrt; | 190 | __u16 srcrt; |
| 191 | __u16 dst1; | 191 | __u16 dst1; |
| 192 | __u16 lastopt; | ||
| 192 | }; | 193 | }; |
| 193 | 194 | ||
| 194 | #define IP6CB(skb) ((struct inet6_skb_parm*)((skb)->cb)) | 195 | #define IP6CB(skb) ((struct inet6_skb_parm*)((skb)->cb)) |
| @@ -234,14 +235,20 @@ struct ipv6_pinfo { | |||
| 234 | /* pktoption flags */ | 235 | /* pktoption flags */ |
| 235 | union { | 236 | union { |
| 236 | struct { | 237 | struct { |
| 237 | __u8 srcrt:2, | 238 | __u16 srcrt:2, |
| 239 | osrcrt:2, | ||
| 238 | rxinfo:1, | 240 | rxinfo:1, |
| 241 | rxoinfo:1, | ||
| 239 | rxhlim:1, | 242 | rxhlim:1, |
| 243 | rxohlim:1, | ||
| 240 | hopopts:1, | 244 | hopopts:1, |
| 245 | ohopopts:1, | ||
| 241 | dstopts:1, | 246 | dstopts:1, |
| 242 | rxflow:1; | 247 | odstopts:1, |
| 248 | rxflow:1, | ||
| 249 | rxtclass:1; | ||
| 243 | } bits; | 250 | } bits; |
| 244 | __u8 all; | 251 | __u16 all; |
| 245 | } rxopt; | 252 | } rxopt; |
| 246 | 253 | ||
| 247 | /* sockopt flags */ | 254 | /* sockopt flags */ |
| @@ -250,6 +257,7 @@ struct ipv6_pinfo { | |||
| 250 | sndflow:1, | 257 | sndflow:1, |
| 251 | pmtudisc:2, | 258 | pmtudisc:2, |
| 252 | ipv6only:1; | 259 | ipv6only:1; |
| 260 | __u8 tclass; | ||
| 253 | 261 | ||
| 254 | __u32 dst_cookie; | 262 | __u32 dst_cookie; |
| 255 | 263 | ||
| @@ -263,6 +271,7 @@ struct ipv6_pinfo { | |||
| 263 | struct ipv6_txoptions *opt; | 271 | struct ipv6_txoptions *opt; |
| 264 | struct rt6_info *rt; | 272 | struct rt6_info *rt; |
| 265 | int hop_limit; | 273 | int hop_limit; |
| 274 | int tclass; | ||
| 266 | } cork; | 275 | } cork; |
| 267 | }; | 276 | }; |
| 268 | 277 | ||
diff --git a/include/linux/jbd.h b/include/linux/jbd.h index 84321a4cac93..de097269bd7f 100644 --- a/include/linux/jbd.h +++ b/include/linux/jbd.h | |||
| @@ -28,6 +28,7 @@ | |||
| 28 | #include <linux/buffer_head.h> | 28 | #include <linux/buffer_head.h> |
| 29 | #include <linux/journal-head.h> | 29 | #include <linux/journal-head.h> |
| 30 | #include <linux/stddef.h> | 30 | #include <linux/stddef.h> |
| 31 | #include <linux/bit_spinlock.h> | ||
| 31 | #include <asm/semaphore.h> | 32 | #include <asm/semaphore.h> |
| 32 | #endif | 33 | #endif |
| 33 | 34 | ||
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h index d7a2555a886c..6acfdbba734b 100644 --- a/include/linux/jiffies.h +++ b/include/linux/jiffies.h | |||
| @@ -254,23 +254,23 @@ static inline u64 get_jiffies_64(void) | |||
| 254 | */ | 254 | */ |
| 255 | static inline unsigned int jiffies_to_msecs(const unsigned long j) | 255 | static inline unsigned int jiffies_to_msecs(const unsigned long j) |
| 256 | { | 256 | { |
| 257 | #if HZ <= 1000 && !(1000 % HZ) | 257 | #if HZ <= MSEC_PER_SEC && !(MSEC_PER_SEC % HZ) |
| 258 | return (1000 / HZ) * j; | 258 | return (MSEC_PER_SEC / HZ) * j; |
| 259 | #elif HZ > 1000 && !(HZ % 1000) | 259 | #elif HZ > MSEC_PER_SEC && !(HZ % MSEC_PER_SEC) |
| 260 | return (j + (HZ / 1000) - 1)/(HZ / 1000); | 260 | return (j + (HZ / MSEC_PER_SEC) - 1)/(HZ / MSEC_PER_SEC); |
| 261 | #else | 261 | #else |
| 262 | return (j * 1000) / HZ; | 262 | return (j * MSEC_PER_SEC) / HZ; |
| 263 | #endif | 263 | #endif |
| 264 | } | 264 | } |
| 265 | 265 | ||
| 266 | static inline unsigned int jiffies_to_usecs(const unsigned long j) | 266 | static inline unsigned int jiffies_to_usecs(const unsigned long j) |
| 267 | { | 267 | { |
| 268 | #if HZ <= 1000000 && !(1000000 % HZ) | 268 | #if HZ <= USEC_PER_SEC && !(USEC_PER_SEC % HZ) |
| 269 | return (1000000 / HZ) * j; | 269 | return (USEC_PER_SEC / HZ) * j; |
| 270 | #elif HZ > 1000000 && !(HZ % 1000000) | 270 | #elif HZ > USEC_PER_SEC && !(HZ % USEC_PER_SEC) |
| 271 | return (j + (HZ / 1000000) - 1)/(HZ / 1000000); | 271 | return (j + (HZ / USEC_PER_SEC) - 1)/(HZ / USEC_PER_SEC); |
| 272 | #else | 272 | #else |
| 273 | return (j * 1000000) / HZ; | 273 | return (j * USEC_PER_SEC) / HZ; |
| 274 | #endif | 274 | #endif |
| 275 | } | 275 | } |
| 276 | 276 | ||
| @@ -278,12 +278,12 @@ static inline unsigned long msecs_to_jiffies(const unsigned int m) | |||
| 278 | { | 278 | { |
| 279 | if (m > jiffies_to_msecs(MAX_JIFFY_OFFSET)) | 279 | if (m > jiffies_to_msecs(MAX_JIFFY_OFFSET)) |
| 280 | return MAX_JIFFY_OFFSET; | 280 | return MAX_JIFFY_OFFSET; |
| 281 | #if HZ <= 1000 && !(1000 % HZ) | 281 | #if HZ <= MSEC_PER_SEC && !(MSEC_PER_SEC % HZ) |
| 282 | return (m + (1000 / HZ) - 1) / (1000 / HZ); | 282 | return (m + (MSEC_PER_SEC / HZ) - 1) / (MSEC_PER_SEC / HZ); |
| 283 | #elif HZ > 1000 && !(HZ % 1000) | 283 | #elif HZ > MSEC_PER_SEC && !(HZ % MSEC_PER_SEC) |
| 284 | return m * (HZ / 1000); | 284 | return m * (HZ / MSEC_PER_SEC); |
| 285 | #else | 285 | #else |
| 286 | return (m * HZ + 999) / 1000; | 286 | return (m * HZ + MSEC_PER_SEC - 1) / MSEC_PER_SEC; |
| 287 | #endif | 287 | #endif |
| 288 | } | 288 | } |
| 289 | 289 | ||
| @@ -291,12 +291,12 @@ static inline unsigned long usecs_to_jiffies(const unsigned int u) | |||
| 291 | { | 291 | { |
| 292 | if (u > jiffies_to_usecs(MAX_JIFFY_OFFSET)) | 292 | if (u > jiffies_to_usecs(MAX_JIFFY_OFFSET)) |
| 293 | return MAX_JIFFY_OFFSET; | 293 | return MAX_JIFFY_OFFSET; |
| 294 | #if HZ <= 1000000 && !(1000000 % HZ) | 294 | #if HZ <= USEC_PER_SEC && !(USEC_PER_SEC % HZ) |
| 295 | return (u + (1000000 / HZ) - 1) / (1000000 / HZ); | 295 | return (u + (USEC_PER_SEC / HZ) - 1) / (USEC_PER_SEC / HZ); |
| 296 | #elif HZ > 1000000 && !(HZ % 1000000) | 296 | #elif HZ > USEC_PER_SEC && !(HZ % USEC_PER_SEC) |
| 297 | return u * (HZ / 1000000); | 297 | return u * (HZ / USEC_PER_SEC); |
| 298 | #else | 298 | #else |
| 299 | return (u * HZ + 999999) / 1000000; | 299 | return (u * HZ + USEC_PER_SEC - 1) / USEC_PER_SEC; |
| 300 | #endif | 300 | #endif |
| 301 | } | 301 | } |
| 302 | 302 | ||
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h index 94a46f38c532..58385ee1c0ac 100644 --- a/include/linux/mempolicy.h +++ b/include/linux/mempolicy.h | |||
| @@ -155,6 +155,7 @@ struct mempolicy *get_vma_policy(struct task_struct *task, | |||
| 155 | 155 | ||
| 156 | extern void numa_default_policy(void); | 156 | extern void numa_default_policy(void); |
| 157 | extern void numa_policy_init(void); | 157 | extern void numa_policy_init(void); |
| 158 | extern struct mempolicy default_policy; | ||
| 158 | 159 | ||
| 159 | #else | 160 | #else |
| 160 | 161 | ||
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 6014160d9c06..c1f021eddffa 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h | |||
| @@ -109,6 +109,8 @@ struct mmc_host { | |||
| 109 | struct mmc_card *card_selected; /* the selected MMC card */ | 109 | struct mmc_card *card_selected; /* the selected MMC card */ |
| 110 | 110 | ||
| 111 | struct work_struct detect; | 111 | struct work_struct detect; |
| 112 | |||
| 113 | unsigned long private[0] ____cacheline_aligned; | ||
| 112 | }; | 114 | }; |
| 113 | 115 | ||
| 114 | extern struct mmc_host *mmc_alloc_host(int extra, struct device *); | 116 | extern struct mmc_host *mmc_alloc_host(int extra, struct device *); |
| @@ -116,14 +118,18 @@ extern int mmc_add_host(struct mmc_host *); | |||
| 116 | extern void mmc_remove_host(struct mmc_host *); | 118 | extern void mmc_remove_host(struct mmc_host *); |
| 117 | extern void mmc_free_host(struct mmc_host *); | 119 | extern void mmc_free_host(struct mmc_host *); |
| 118 | 120 | ||
| 119 | #define mmc_priv(x) ((void *)((x) + 1)) | 121 | static inline void *mmc_priv(struct mmc_host *host) |
| 122 | { | ||
| 123 | return (void *)host->private; | ||
| 124 | } | ||
| 125 | |||
| 120 | #define mmc_dev(x) ((x)->dev) | 126 | #define mmc_dev(x) ((x)->dev) |
| 121 | #define mmc_hostname(x) ((x)->class_dev.class_id) | 127 | #define mmc_hostname(x) ((x)->class_dev.class_id) |
| 122 | 128 | ||
| 123 | extern int mmc_suspend_host(struct mmc_host *, pm_message_t); | 129 | extern int mmc_suspend_host(struct mmc_host *, pm_message_t); |
| 124 | extern int mmc_resume_host(struct mmc_host *); | 130 | extern int mmc_resume_host(struct mmc_host *); |
| 125 | 131 | ||
| 126 | extern void mmc_detect_change(struct mmc_host *); | 132 | extern void mmc_detect_change(struct mmc_host *, unsigned long delay); |
| 127 | extern void mmc_request_done(struct mmc_host *, struct mmc_request *); | 133 | extern void mmc_request_done(struct mmc_host *, struct mmc_request *); |
| 128 | 134 | ||
| 129 | #endif | 135 | #endif |
diff --git a/include/linux/netlink.h b/include/linux/netlink.h index 167518668936..7bbd25970c9e 100644 --- a/include/linux/netlink.h +++ b/include/linux/netlink.h | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | #define NETLINK_ISCSI 8 /* Open-iSCSI */ | 15 | #define NETLINK_ISCSI 8 /* Open-iSCSI */ |
| 16 | #define NETLINK_AUDIT 9 /* auditing */ | 16 | #define NETLINK_AUDIT 9 /* auditing */ |
| 17 | #define NETLINK_FIB_LOOKUP 10 | 17 | #define NETLINK_FIB_LOOKUP 10 |
| 18 | #define NETLINK_CONNECTOR 11 | ||
| 18 | #define NETLINK_NETFILTER 12 /* netfilter subsystem */ | 19 | #define NETLINK_NETFILTER 12 /* netfilter subsystem */ |
| 19 | #define NETLINK_IP6_FW 13 | 20 | #define NETLINK_IP6_FW 13 |
| 20 | #define NETLINK_DNRTMSG 14 /* DECnet routing messages */ | 21 | #define NETLINK_DNRTMSG 14 /* DECnet routing messages */ |
diff --git a/include/linux/pci.h b/include/linux/pci.h index bc4c40000c0d..7349058ed778 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
| @@ -19,436 +19,10 @@ | |||
| 19 | 19 | ||
| 20 | #include <linux/mod_devicetable.h> | 20 | #include <linux/mod_devicetable.h> |
| 21 | 21 | ||
| 22 | /* | 22 | /* Include the pci register defines */ |
| 23 | * Under PCI, each device has 256 bytes of configuration address space, | 23 | #include <linux/pci_regs.h> |
| 24 | * of which the first 64 bytes are standardized as follows: | ||
| 25 | */ | ||
| 26 | #define PCI_VENDOR_ID 0x00 /* 16 bits */ | ||
| 27 | #define PCI_DEVICE_ID 0x02 /* 16 bits */ | ||
| 28 | #define PCI_COMMAND 0x04 /* 16 bits */ | ||
| 29 | #define PCI_COMMAND_IO 0x1 /* Enable response in I/O space */ | ||
| 30 | #define PCI_COMMAND_MEMORY 0x2 /* Enable response in Memory space */ | ||
| 31 | #define PCI_COMMAND_MASTER 0x4 /* Enable bus mastering */ | ||
| 32 | #define PCI_COMMAND_SPECIAL 0x8 /* Enable response to special cycles */ | ||
| 33 | #define PCI_COMMAND_INVALIDATE 0x10 /* Use memory write and invalidate */ | ||
| 34 | #define PCI_COMMAND_VGA_PALETTE 0x20 /* Enable palette snooping */ | ||
| 35 | #define PCI_COMMAND_PARITY 0x40 /* Enable parity checking */ | ||
| 36 | #define PCI_COMMAND_WAIT 0x80 /* Enable address/data stepping */ | ||
| 37 | #define PCI_COMMAND_SERR 0x100 /* Enable SERR */ | ||
| 38 | #define PCI_COMMAND_FAST_BACK 0x200 /* Enable back-to-back writes */ | ||
| 39 | #define PCI_COMMAND_INTX_DISABLE 0x400 /* INTx Emulation Disable */ | ||
| 40 | |||
| 41 | #define PCI_STATUS 0x06 /* 16 bits */ | ||
| 42 | #define PCI_STATUS_CAP_LIST 0x10 /* Support Capability List */ | ||
| 43 | #define PCI_STATUS_66MHZ 0x20 /* Support 66 Mhz PCI 2.1 bus */ | ||
| 44 | #define PCI_STATUS_UDF 0x40 /* Support User Definable Features [obsolete] */ | ||
| 45 | #define PCI_STATUS_FAST_BACK 0x80 /* Accept fast-back to back */ | ||
| 46 | #define PCI_STATUS_PARITY 0x100 /* Detected parity error */ | ||
| 47 | #define PCI_STATUS_DEVSEL_MASK 0x600 /* DEVSEL timing */ | ||
| 48 | #define PCI_STATUS_DEVSEL_FAST 0x000 | ||
| 49 | #define PCI_STATUS_DEVSEL_MEDIUM 0x200 | ||
| 50 | #define PCI_STATUS_DEVSEL_SLOW 0x400 | ||
| 51 | #define PCI_STATUS_SIG_TARGET_ABORT 0x800 /* Set on target abort */ | ||
| 52 | #define PCI_STATUS_REC_TARGET_ABORT 0x1000 /* Master ack of " */ | ||
| 53 | #define PCI_STATUS_REC_MASTER_ABORT 0x2000 /* Set on master abort */ | ||
| 54 | #define PCI_STATUS_SIG_SYSTEM_ERROR 0x4000 /* Set when we drive SERR */ | ||
| 55 | #define PCI_STATUS_DETECTED_PARITY 0x8000 /* Set on parity error */ | ||
| 56 | |||
| 57 | #define PCI_CLASS_REVISION 0x08 /* High 24 bits are class, low 8 | ||
| 58 | revision */ | ||
| 59 | #define PCI_REVISION_ID 0x08 /* Revision ID */ | ||
| 60 | #define PCI_CLASS_PROG 0x09 /* Reg. Level Programming Interface */ | ||
| 61 | #define PCI_CLASS_DEVICE 0x0a /* Device class */ | ||
| 62 | |||
| 63 | #define PCI_CACHE_LINE_SIZE 0x0c /* 8 bits */ | ||
| 64 | #define PCI_LATENCY_TIMER 0x0d /* 8 bits */ | ||
| 65 | #define PCI_HEADER_TYPE 0x0e /* 8 bits */ | ||
| 66 | #define PCI_HEADER_TYPE_NORMAL 0 | ||
| 67 | #define PCI_HEADER_TYPE_BRIDGE 1 | ||
| 68 | #define PCI_HEADER_TYPE_CARDBUS 2 | ||
| 69 | |||
| 70 | #define PCI_BIST 0x0f /* 8 bits */ | ||
| 71 | #define PCI_BIST_CODE_MASK 0x0f /* Return result */ | ||
| 72 | #define PCI_BIST_START 0x40 /* 1 to start BIST, 2 secs or less */ | ||
| 73 | #define PCI_BIST_CAPABLE 0x80 /* 1 if BIST capable */ | ||
| 74 | |||
| 75 | /* | ||
| 76 | * Base addresses specify locations in memory or I/O space. | ||
| 77 | * Decoded size can be determined by writing a value of | ||
| 78 | * 0xffffffff to the register, and reading it back. Only | ||
| 79 | * 1 bits are decoded. | ||
| 80 | */ | ||
| 81 | #define PCI_BASE_ADDRESS_0 0x10 /* 32 bits */ | ||
| 82 | #define PCI_BASE_ADDRESS_1 0x14 /* 32 bits [htype 0,1 only] */ | ||
| 83 | #define PCI_BASE_ADDRESS_2 0x18 /* 32 bits [htype 0 only] */ | ||
| 84 | #define PCI_BASE_ADDRESS_3 0x1c /* 32 bits */ | ||
| 85 | #define PCI_BASE_ADDRESS_4 0x20 /* 32 bits */ | ||
| 86 | #define PCI_BASE_ADDRESS_5 0x24 /* 32 bits */ | ||
| 87 | #define PCI_BASE_ADDRESS_SPACE 0x01 /* 0 = memory, 1 = I/O */ | ||
| 88 | #define PCI_BASE_ADDRESS_SPACE_IO 0x01 | ||
| 89 | #define PCI_BASE_ADDRESS_SPACE_MEMORY 0x00 | ||
| 90 | #define PCI_BASE_ADDRESS_MEM_TYPE_MASK 0x06 | ||
| 91 | #define PCI_BASE_ADDRESS_MEM_TYPE_32 0x00 /* 32 bit address */ | ||
| 92 | #define PCI_BASE_ADDRESS_MEM_TYPE_1M 0x02 /* Below 1M [obsolete] */ | ||
| 93 | #define PCI_BASE_ADDRESS_MEM_TYPE_64 0x04 /* 64 bit address */ | ||
| 94 | #define PCI_BASE_ADDRESS_MEM_PREFETCH 0x08 /* prefetchable? */ | ||
| 95 | #define PCI_BASE_ADDRESS_MEM_MASK (~0x0fUL) | ||
| 96 | #define PCI_BASE_ADDRESS_IO_MASK (~0x03UL) | ||
| 97 | /* bit 1 is reserved if address_space = 1 */ | ||
| 98 | |||
| 99 | /* Header type 0 (normal devices) */ | ||
| 100 | #define PCI_CARDBUS_CIS 0x28 | ||
| 101 | #define PCI_SUBSYSTEM_VENDOR_ID 0x2c | ||
| 102 | #define PCI_SUBSYSTEM_ID 0x2e | ||
| 103 | #define PCI_ROM_ADDRESS 0x30 /* Bits 31..11 are address, 10..1 reserved */ | ||
| 104 | #define PCI_ROM_ADDRESS_ENABLE 0x01 | ||
| 105 | #define PCI_ROM_ADDRESS_MASK (~0x7ffUL) | ||
| 106 | |||
| 107 | #define PCI_CAPABILITY_LIST 0x34 /* Offset of first capability list entry */ | ||
| 108 | |||
| 109 | /* 0x35-0x3b are reserved */ | ||
| 110 | #define PCI_INTERRUPT_LINE 0x3c /* 8 bits */ | ||
| 111 | #define PCI_INTERRUPT_PIN 0x3d /* 8 bits */ | ||
| 112 | #define PCI_MIN_GNT 0x3e /* 8 bits */ | ||
| 113 | #define PCI_MAX_LAT 0x3f /* 8 bits */ | ||
| 114 | |||
| 115 | /* Header type 1 (PCI-to-PCI bridges) */ | ||
| 116 | #define PCI_PRIMARY_BUS 0x18 /* Primary bus number */ | ||
| 117 | #define PCI_SECONDARY_BUS 0x19 /* Secondary bus number */ | ||
| 118 | #define PCI_SUBORDINATE_BUS 0x1a /* Highest bus number behind the bridge */ | ||
| 119 | #define PCI_SEC_LATENCY_TIMER 0x1b /* Latency timer for secondary interface */ | ||
| 120 | #define PCI_IO_BASE 0x1c /* I/O range behind the bridge */ | ||
| 121 | #define PCI_IO_LIMIT 0x1d | ||
| 122 | #define PCI_IO_RANGE_TYPE_MASK 0x0fUL /* I/O bridging type */ | ||
| 123 | #define PCI_IO_RANGE_TYPE_16 0x00 | ||
| 124 | #define PCI_IO_RANGE_TYPE_32 0x01 | ||
| 125 | #define PCI_IO_RANGE_MASK (~0x0fUL) | ||
| 126 | #define PCI_SEC_STATUS 0x1e /* Secondary status register, only bit 14 used */ | ||
| 127 | #define PCI_MEMORY_BASE 0x20 /* Memory range behind */ | ||
| 128 | #define PCI_MEMORY_LIMIT 0x22 | ||
| 129 | #define PCI_MEMORY_RANGE_TYPE_MASK 0x0fUL | ||
| 130 | #define PCI_MEMORY_RANGE_MASK (~0x0fUL) | ||
| 131 | #define PCI_PREF_MEMORY_BASE 0x24 /* Prefetchable memory range behind */ | ||
| 132 | #define PCI_PREF_MEMORY_LIMIT 0x26 | ||
| 133 | #define PCI_PREF_RANGE_TYPE_MASK 0x0fUL | ||
| 134 | #define PCI_PREF_RANGE_TYPE_32 0x00 | ||
| 135 | #define PCI_PREF_RANGE_TYPE_64 0x01 | ||
| 136 | #define PCI_PREF_RANGE_MASK (~0x0fUL) | ||
| 137 | #define PCI_PREF_BASE_UPPER32 0x28 /* Upper half of prefetchable memory range */ | ||
| 138 | #define PCI_PREF_LIMIT_UPPER32 0x2c | ||
| 139 | #define PCI_IO_BASE_UPPER16 0x30 /* Upper half of I/O addresses */ | ||
| 140 | #define PCI_IO_LIMIT_UPPER16 0x32 | ||
| 141 | /* 0x34 same as for htype 0 */ | ||
| 142 | /* 0x35-0x3b is reserved */ | ||
| 143 | #define PCI_ROM_ADDRESS1 0x38 /* Same as PCI_ROM_ADDRESS, but for htype 1 */ | ||
| 144 | /* 0x3c-0x3d are same as for htype 0 */ | ||
| 145 | #define PCI_BRIDGE_CONTROL 0x3e | ||
| 146 | #define PCI_BRIDGE_CTL_PARITY 0x01 /* Enable parity detection on secondary interface */ | ||
| 147 | #define PCI_BRIDGE_CTL_SERR 0x02 /* The same for SERR forwarding */ | ||
| 148 | #define PCI_BRIDGE_CTL_NO_ISA 0x04 /* Disable bridging of ISA ports */ | ||
| 149 | #define PCI_BRIDGE_CTL_VGA 0x08 /* Forward VGA addresses */ | ||
| 150 | #define PCI_BRIDGE_CTL_MASTER_ABORT 0x20 /* Report master aborts */ | ||
| 151 | #define PCI_BRIDGE_CTL_BUS_RESET 0x40 /* Secondary bus reset */ | ||
| 152 | #define PCI_BRIDGE_CTL_FAST_BACK 0x80 /* Fast Back2Back enabled on secondary interface */ | ||
| 153 | |||
| 154 | /* Header type 2 (CardBus bridges) */ | ||
| 155 | #define PCI_CB_CAPABILITY_LIST 0x14 | ||
| 156 | /* 0x15 reserved */ | ||
| 157 | #define PCI_CB_SEC_STATUS 0x16 /* Secondary status */ | ||
| 158 | #define PCI_CB_PRIMARY_BUS 0x18 /* PCI bus number */ | ||
| 159 | #define PCI_CB_CARD_BUS 0x19 /* CardBus bus number */ | ||
| 160 | #define PCI_CB_SUBORDINATE_BUS 0x1a /* Subordinate bus number */ | ||
| 161 | #define PCI_CB_LATENCY_TIMER 0x1b /* CardBus latency timer */ | ||
| 162 | #define PCI_CB_MEMORY_BASE_0 0x1c | ||
| 163 | #define PCI_CB_MEMORY_LIMIT_0 0x20 | ||
| 164 | #define PCI_CB_MEMORY_BASE_1 0x24 | ||
| 165 | #define PCI_CB_MEMORY_LIMIT_1 0x28 | ||
| 166 | #define PCI_CB_IO_BASE_0 0x2c | ||
| 167 | #define PCI_CB_IO_BASE_0_HI 0x2e | ||
| 168 | #define PCI_CB_IO_LIMIT_0 0x30 | ||
| 169 | #define PCI_CB_IO_LIMIT_0_HI 0x32 | ||
| 170 | #define PCI_CB_IO_BASE_1 0x34 | ||
| 171 | #define PCI_CB_IO_BASE_1_HI 0x36 | ||
| 172 | #define PCI_CB_IO_LIMIT_1 0x38 | ||
| 173 | #define PCI_CB_IO_LIMIT_1_HI 0x3a | ||
| 174 | #define PCI_CB_IO_RANGE_MASK (~0x03UL) | ||
| 175 | /* 0x3c-0x3d are same as for htype 0 */ | ||
| 176 | #define PCI_CB_BRIDGE_CONTROL 0x3e | ||
| 177 | #define PCI_CB_BRIDGE_CTL_PARITY 0x01 /* Similar to standard bridge control register */ | ||
| 178 | #define PCI_CB_BRIDGE_CTL_SERR 0x02 | ||
| 179 | #define PCI_CB_BRIDGE_CTL_ISA 0x04 | ||
| 180 | #define PCI_CB_BRIDGE_CTL_VGA 0x08 | ||
| 181 | #define PCI_CB_BRIDGE_CTL_MASTER_ABORT 0x20 | ||
| 182 | #define PCI_CB_BRIDGE_CTL_CB_RESET 0x40 /* CardBus reset */ | ||
| 183 | #define PCI_CB_BRIDGE_CTL_16BIT_INT 0x80 /* Enable interrupt for 16-bit cards */ | ||
| 184 | #define PCI_CB_BRIDGE_CTL_PREFETCH_MEM0 0x100 /* Prefetch enable for both memory regions */ | ||
| 185 | #define PCI_CB_BRIDGE_CTL_PREFETCH_MEM1 0x200 | ||
| 186 | #define PCI_CB_BRIDGE_CTL_POST_WRITES 0x400 | ||
| 187 | #define PCI_CB_SUBSYSTEM_VENDOR_ID 0x40 | ||
| 188 | #define PCI_CB_SUBSYSTEM_ID 0x42 | ||
| 189 | #define PCI_CB_LEGACY_MODE_BASE 0x44 /* 16-bit PC Card legacy mode base address (ExCa) */ | ||
| 190 | /* 0x48-0x7f reserved */ | ||
| 191 | |||
| 192 | /* Capability lists */ | ||
| 193 | |||
| 194 | #define PCI_CAP_LIST_ID 0 /* Capability ID */ | ||
| 195 | #define PCI_CAP_ID_PM 0x01 /* Power Management */ | ||
| 196 | #define PCI_CAP_ID_AGP 0x02 /* Accelerated Graphics Port */ | ||
| 197 | #define PCI_CAP_ID_VPD 0x03 /* Vital Product Data */ | ||
| 198 | #define PCI_CAP_ID_SLOTID 0x04 /* Slot Identification */ | ||
| 199 | #define PCI_CAP_ID_MSI 0x05 /* Message Signalled Interrupts */ | ||
| 200 | #define PCI_CAP_ID_CHSWP 0x06 /* CompactPCI HotSwap */ | ||
| 201 | #define PCI_CAP_ID_PCIX 0x07 /* PCI-X */ | ||
| 202 | #define PCI_CAP_ID_SHPC 0x0C /* PCI Standard Hot-Plug Controller */ | ||
| 203 | #define PCI_CAP_ID_EXP 0x10 /* PCI Express */ | ||
| 204 | #define PCI_CAP_ID_MSIX 0x11 /* MSI-X */ | ||
| 205 | #define PCI_CAP_LIST_NEXT 1 /* Next capability in the list */ | ||
| 206 | #define PCI_CAP_FLAGS 2 /* Capability defined flags (16 bits) */ | ||
| 207 | #define PCI_CAP_SIZEOF 4 | ||
| 208 | |||
| 209 | /* Power Management Registers */ | ||
| 210 | |||
| 211 | #define PCI_PM_PMC 2 /* PM Capabilities Register */ | ||
| 212 | #define PCI_PM_CAP_VER_MASK 0x0007 /* Version */ | ||
| 213 | #define PCI_PM_CAP_PME_CLOCK 0x0008 /* PME clock required */ | ||
| 214 | #define PCI_PM_CAP_RESERVED 0x0010 /* Reserved field */ | ||
| 215 | #define PCI_PM_CAP_DSI 0x0020 /* Device specific initialization */ | ||
| 216 | #define PCI_PM_CAP_AUX_POWER 0x01C0 /* Auxilliary power support mask */ | ||
| 217 | #define PCI_PM_CAP_D1 0x0200 /* D1 power state support */ | ||
| 218 | #define PCI_PM_CAP_D2 0x0400 /* D2 power state support */ | ||
| 219 | #define PCI_PM_CAP_PME 0x0800 /* PME pin supported */ | ||
| 220 | #define PCI_PM_CAP_PME_MASK 0xF800 /* PME Mask of all supported states */ | ||
| 221 | #define PCI_PM_CAP_PME_D0 0x0800 /* PME# from D0 */ | ||
| 222 | #define PCI_PM_CAP_PME_D1 0x1000 /* PME# from D1 */ | ||
| 223 | #define PCI_PM_CAP_PME_D2 0x2000 /* PME# from D2 */ | ||
| 224 | #define PCI_PM_CAP_PME_D3 0x4000 /* PME# from D3 (hot) */ | ||
| 225 | #define PCI_PM_CAP_PME_D3cold 0x8000 /* PME# from D3 (cold) */ | ||
| 226 | #define PCI_PM_CTRL 4 /* PM control and status register */ | ||
| 227 | #define PCI_PM_CTRL_STATE_MASK 0x0003 /* Current power state (D0 to D3) */ | ||
| 228 | #define PCI_PM_CTRL_PME_ENABLE 0x0100 /* PME pin enable */ | ||
| 229 | #define PCI_PM_CTRL_DATA_SEL_MASK 0x1e00 /* Data select (??) */ | ||
| 230 | #define PCI_PM_CTRL_DATA_SCALE_MASK 0x6000 /* Data scale (??) */ | ||
| 231 | #define PCI_PM_CTRL_PME_STATUS 0x8000 /* PME pin status */ | ||
| 232 | #define PCI_PM_PPB_EXTENSIONS 6 /* PPB support extensions (??) */ | ||
| 233 | #define PCI_PM_PPB_B2_B3 0x40 /* Stop clock when in D3hot (??) */ | ||
| 234 | #define PCI_PM_BPCC_ENABLE 0x80 /* Bus power/clock control enable (??) */ | ||
| 235 | #define PCI_PM_DATA_REGISTER 7 /* (??) */ | ||
| 236 | #define PCI_PM_SIZEOF 8 | ||
| 237 | |||
| 238 | /* AGP registers */ | ||
| 239 | |||
| 240 | #define PCI_AGP_VERSION 2 /* BCD version number */ | ||
| 241 | #define PCI_AGP_RFU 3 /* Rest of capability flags */ | ||
| 242 | #define PCI_AGP_STATUS 4 /* Status register */ | ||
| 243 | #define PCI_AGP_STATUS_RQ_MASK 0xff000000 /* Maximum number of requests - 1 */ | ||
| 244 | #define PCI_AGP_STATUS_SBA 0x0200 /* Sideband addressing supported */ | ||
| 245 | #define PCI_AGP_STATUS_64BIT 0x0020 /* 64-bit addressing supported */ | ||
| 246 | #define PCI_AGP_STATUS_FW 0x0010 /* FW transfers supported */ | ||
| 247 | #define PCI_AGP_STATUS_RATE4 0x0004 /* 4x transfer rate supported */ | ||
| 248 | #define PCI_AGP_STATUS_RATE2 0x0002 /* 2x transfer rate supported */ | ||
| 249 | #define PCI_AGP_STATUS_RATE1 0x0001 /* 1x transfer rate supported */ | ||
| 250 | #define PCI_AGP_COMMAND 8 /* Control register */ | ||
| 251 | #define PCI_AGP_COMMAND_RQ_MASK 0xff000000 /* Master: Maximum number of requests */ | ||
| 252 | #define PCI_AGP_COMMAND_SBA 0x0200 /* Sideband addressing enabled */ | ||
| 253 | #define PCI_AGP_COMMAND_AGP 0x0100 /* Allow processing of AGP transactions */ | ||
| 254 | #define PCI_AGP_COMMAND_64BIT 0x0020 /* Allow processing of 64-bit addresses */ | ||
| 255 | #define PCI_AGP_COMMAND_FW 0x0010 /* Force FW transfers */ | ||
| 256 | #define PCI_AGP_COMMAND_RATE4 0x0004 /* Use 4x rate */ | ||
| 257 | #define PCI_AGP_COMMAND_RATE2 0x0002 /* Use 2x rate */ | ||
| 258 | #define PCI_AGP_COMMAND_RATE1 0x0001 /* Use 1x rate */ | ||
| 259 | #define PCI_AGP_SIZEOF 12 | ||
| 260 | |||
| 261 | /* Vital Product Data */ | ||
| 262 | |||
| 263 | #define PCI_VPD_ADDR 2 /* Address to access (15 bits!) */ | ||
| 264 | #define PCI_VPD_ADDR_MASK 0x7fff /* Address mask */ | ||
| 265 | #define PCI_VPD_ADDR_F 0x8000 /* Write 0, 1 indicates completion */ | ||
| 266 | #define PCI_VPD_DATA 4 /* 32-bits of data returned here */ | ||
| 267 | |||
| 268 | /* Slot Identification */ | ||
| 269 | |||
| 270 | #define PCI_SID_ESR 2 /* Expansion Slot Register */ | ||
| 271 | #define PCI_SID_ESR_NSLOTS 0x1f /* Number of expansion slots available */ | ||
| 272 | #define PCI_SID_ESR_FIC 0x20 /* First In Chassis Flag */ | ||
| 273 | #define PCI_SID_CHASSIS_NR 3 /* Chassis Number */ | ||
| 274 | |||
| 275 | /* Message Signalled Interrupts registers */ | ||
| 276 | |||
| 277 | #define PCI_MSI_FLAGS 2 /* Various flags */ | ||
| 278 | #define PCI_MSI_FLAGS_64BIT 0x80 /* 64-bit addresses allowed */ | ||
| 279 | #define PCI_MSI_FLAGS_QSIZE 0x70 /* Message queue size configured */ | ||
| 280 | #define PCI_MSI_FLAGS_QMASK 0x0e /* Maximum queue size available */ | ||
| 281 | #define PCI_MSI_FLAGS_ENABLE 0x01 /* MSI feature enabled */ | ||
| 282 | #define PCI_MSI_FLAGS_MASKBIT 0x100 /* 64-bit mask bits allowed */ | ||
| 283 | #define PCI_MSI_RFU 3 /* Rest of capability flags */ | ||
| 284 | #define PCI_MSI_ADDRESS_LO 4 /* Lower 32 bits */ | ||
| 285 | #define PCI_MSI_ADDRESS_HI 8 /* Upper 32 bits (if PCI_MSI_FLAGS_64BIT set) */ | ||
| 286 | #define PCI_MSI_DATA_32 8 /* 16 bits of data for 32-bit devices */ | ||
| 287 | #define PCI_MSI_DATA_64 12 /* 16 bits of data for 64-bit devices */ | ||
| 288 | #define PCI_MSI_MASK_BIT 16 /* Mask bits register */ | ||
| 289 | |||
| 290 | /* CompactPCI Hotswap Register */ | ||
| 291 | |||
| 292 | #define PCI_CHSWP_CSR 2 /* Control and Status Register */ | ||
| 293 | #define PCI_CHSWP_DHA 0x01 /* Device Hiding Arm */ | ||
| 294 | #define PCI_CHSWP_EIM 0x02 /* ENUM# Signal Mask */ | ||
| 295 | #define PCI_CHSWP_PIE 0x04 /* Pending Insert or Extract */ | ||
| 296 | #define PCI_CHSWP_LOO 0x08 /* LED On / Off */ | ||
| 297 | #define PCI_CHSWP_PI 0x30 /* Programming Interface */ | ||
| 298 | #define PCI_CHSWP_EXT 0x40 /* ENUM# status - extraction */ | ||
| 299 | #define PCI_CHSWP_INS 0x80 /* ENUM# status - insertion */ | ||
| 300 | |||
| 301 | /* PCI-X registers */ | ||
| 302 | |||
| 303 | #define PCI_X_CMD 2 /* Modes & Features */ | ||
| 304 | #define PCI_X_CMD_DPERR_E 0x0001 /* Data Parity Error Recovery Enable */ | ||
| 305 | #define PCI_X_CMD_ERO 0x0002 /* Enable Relaxed Ordering */ | ||
| 306 | #define PCI_X_CMD_MAX_READ 0x000c /* Max Memory Read Byte Count */ | ||
| 307 | #define PCI_X_CMD_MAX_SPLIT 0x0070 /* Max Outstanding Split Transactions */ | ||
| 308 | #define PCI_X_CMD_VERSION(x) (((x) >> 12) & 3) /* Version */ | ||
| 309 | #define PCI_X_STATUS 4 /* PCI-X capabilities */ | ||
| 310 | #define PCI_X_STATUS_DEVFN 0x000000ff /* A copy of devfn */ | ||
| 311 | #define PCI_X_STATUS_BUS 0x0000ff00 /* A copy of bus nr */ | ||
| 312 | #define PCI_X_STATUS_64BIT 0x00010000 /* 64-bit device */ | ||
| 313 | #define PCI_X_STATUS_133MHZ 0x00020000 /* 133 MHz capable */ | ||
| 314 | #define PCI_X_STATUS_SPL_DISC 0x00040000 /* Split Completion Discarded */ | ||
| 315 | #define PCI_X_STATUS_UNX_SPL 0x00080000 /* Unexpected Split Completion */ | ||
| 316 | #define PCI_X_STATUS_COMPLEX 0x00100000 /* Device Complexity */ | ||
| 317 | #define PCI_X_STATUS_MAX_READ 0x00600000 /* Designed Max Memory Read Count */ | ||
| 318 | #define PCI_X_STATUS_MAX_SPLIT 0x03800000 /* Designed Max Outstanding Split Transactions */ | ||
| 319 | #define PCI_X_STATUS_MAX_CUM 0x1c000000 /* Designed Max Cumulative Read Size */ | ||
| 320 | #define PCI_X_STATUS_SPL_ERR 0x20000000 /* Rcvd Split Completion Error Msg */ | ||
| 321 | #define PCI_X_STATUS_266MHZ 0x40000000 /* 266 MHz capable */ | ||
| 322 | #define PCI_X_STATUS_533MHZ 0x80000000 /* 533 MHz capable */ | ||
| 323 | |||
| 324 | /* PCI Express capability registers */ | ||
| 325 | |||
| 326 | #define PCI_EXP_FLAGS 2 /* Capabilities register */ | ||
| 327 | #define PCI_EXP_FLAGS_VERS 0x000f /* Capability version */ | ||
| 328 | #define PCI_EXP_FLAGS_TYPE 0x00f0 /* Device/Port type */ | ||
| 329 | #define PCI_EXP_TYPE_ENDPOINT 0x0 /* Express Endpoint */ | ||
| 330 | #define PCI_EXP_TYPE_LEG_END 0x1 /* Legacy Endpoint */ | ||
| 331 | #define PCI_EXP_TYPE_ROOT_PORT 0x4 /* Root Port */ | ||
| 332 | #define PCI_EXP_TYPE_UPSTREAM 0x5 /* Upstream Port */ | ||
| 333 | #define PCI_EXP_TYPE_DOWNSTREAM 0x6 /* Downstream Port */ | ||
| 334 | #define PCI_EXP_TYPE_PCI_BRIDGE 0x7 /* PCI/PCI-X Bridge */ | ||
| 335 | #define PCI_EXP_FLAGS_SLOT 0x0100 /* Slot implemented */ | ||
| 336 | #define PCI_EXP_FLAGS_IRQ 0x3e00 /* Interrupt message number */ | ||
| 337 | #define PCI_EXP_DEVCAP 4 /* Device capabilities */ | ||
| 338 | #define PCI_EXP_DEVCAP_PAYLOAD 0x07 /* Max_Payload_Size */ | ||
| 339 | #define PCI_EXP_DEVCAP_PHANTOM 0x18 /* Phantom functions */ | ||
| 340 | #define PCI_EXP_DEVCAP_EXT_TAG 0x20 /* Extended tags */ | ||
| 341 | #define PCI_EXP_DEVCAP_L0S 0x1c0 /* L0s Acceptable Latency */ | ||
| 342 | #define PCI_EXP_DEVCAP_L1 0xe00 /* L1 Acceptable Latency */ | ||
| 343 | #define PCI_EXP_DEVCAP_ATN_BUT 0x1000 /* Attention Button Present */ | ||
| 344 | #define PCI_EXP_DEVCAP_ATN_IND 0x2000 /* Attention Indicator Present */ | ||
| 345 | #define PCI_EXP_DEVCAP_PWR_IND 0x4000 /* Power Indicator Present */ | ||
| 346 | #define PCI_EXP_DEVCAP_PWR_VAL 0x3fc0000 /* Slot Power Limit Value */ | ||
| 347 | #define PCI_EXP_DEVCAP_PWR_SCL 0xc000000 /* Slot Power Limit Scale */ | ||
| 348 | #define PCI_EXP_DEVCTL 8 /* Device Control */ | ||
| 349 | #define PCI_EXP_DEVCTL_CERE 0x0001 /* Correctable Error Reporting En. */ | ||
| 350 | #define PCI_EXP_DEVCTL_NFERE 0x0002 /* Non-Fatal Error Reporting Enable */ | ||
| 351 | #define PCI_EXP_DEVCTL_FERE 0x0004 /* Fatal Error Reporting Enable */ | ||
| 352 | #define PCI_EXP_DEVCTL_URRE 0x0008 /* Unsupported Request Reporting En. */ | ||
| 353 | #define PCI_EXP_DEVCTL_RELAX_EN 0x0010 /* Enable relaxed ordering */ | ||
| 354 | #define PCI_EXP_DEVCTL_PAYLOAD 0x00e0 /* Max_Payload_Size */ | ||
| 355 | #define PCI_EXP_DEVCTL_EXT_TAG 0x0100 /* Extended Tag Field Enable */ | ||
| 356 | #define PCI_EXP_DEVCTL_PHANTOM 0x0200 /* Phantom Functions Enable */ | ||
| 357 | #define PCI_EXP_DEVCTL_AUX_PME 0x0400 /* Auxiliary Power PM Enable */ | ||
| 358 | #define PCI_EXP_DEVCTL_NOSNOOP_EN 0x0800 /* Enable No Snoop */ | ||
| 359 | #define PCI_EXP_DEVCTL_READRQ 0x7000 /* Max_Read_Request_Size */ | ||
| 360 | #define PCI_EXP_DEVSTA 10 /* Device Status */ | ||
| 361 | #define PCI_EXP_DEVSTA_CED 0x01 /* Correctable Error Detected */ | ||
| 362 | #define PCI_EXP_DEVSTA_NFED 0x02 /* Non-Fatal Error Detected */ | ||
| 363 | #define PCI_EXP_DEVSTA_FED 0x04 /* Fatal Error Detected */ | ||
| 364 | #define PCI_EXP_DEVSTA_URD 0x08 /* Unsupported Request Detected */ | ||
| 365 | #define PCI_EXP_DEVSTA_AUXPD 0x10 /* AUX Power Detected */ | ||
| 366 | #define PCI_EXP_DEVSTA_TRPND 0x20 /* Transactions Pending */ | ||
| 367 | #define PCI_EXP_LNKCAP 12 /* Link Capabilities */ | ||
| 368 | #define PCI_EXP_LNKCTL 16 /* Link Control */ | ||
| 369 | #define PCI_EXP_LNKSTA 18 /* Link Status */ | ||
| 370 | #define PCI_EXP_SLTCAP 20 /* Slot Capabilities */ | ||
| 371 | #define PCI_EXP_SLTCTL 24 /* Slot Control */ | ||
| 372 | #define PCI_EXP_SLTSTA 26 /* Slot Status */ | ||
| 373 | #define PCI_EXP_RTCTL 28 /* Root Control */ | ||
| 374 | #define PCI_EXP_RTCTL_SECEE 0x01 /* System Error on Correctable Error */ | ||
| 375 | #define PCI_EXP_RTCTL_SENFEE 0x02 /* System Error on Non-Fatal Error */ | ||
| 376 | #define PCI_EXP_RTCTL_SEFEE 0x04 /* System Error on Fatal Error */ | ||
| 377 | #define PCI_EXP_RTCTL_PMEIE 0x08 /* PME Interrupt Enable */ | ||
| 378 | #define PCI_EXP_RTCTL_CRSSVE 0x10 /* CRS Software Visibility Enable */ | ||
| 379 | #define PCI_EXP_RTCAP 30 /* Root Capabilities */ | ||
| 380 | #define PCI_EXP_RTSTA 32 /* Root Status */ | ||
| 381 | |||
| 382 | /* Extended Capabilities (PCI-X 2.0 and Express) */ | ||
| 383 | #define PCI_EXT_CAP_ID(header) (header & 0x0000ffff) | ||
| 384 | #define PCI_EXT_CAP_VER(header) ((header >> 16) & 0xf) | ||
| 385 | #define PCI_EXT_CAP_NEXT(header) ((header >> 20) & 0xffc) | ||
| 386 | |||
| 387 | #define PCI_EXT_CAP_ID_ERR 1 | ||
| 388 | #define PCI_EXT_CAP_ID_VC 2 | ||
| 389 | #define PCI_EXT_CAP_ID_DSN 3 | ||
| 390 | #define PCI_EXT_CAP_ID_PWR 4 | ||
| 391 | |||
| 392 | /* Advanced Error Reporting */ | ||
| 393 | #define PCI_ERR_UNCOR_STATUS 4 /* Uncorrectable Error Status */ | ||
| 394 | #define PCI_ERR_UNC_TRAIN 0x00000001 /* Training */ | ||
| 395 | #define PCI_ERR_UNC_DLP 0x00000010 /* Data Link Protocol */ | ||
| 396 | #define PCI_ERR_UNC_POISON_TLP 0x00001000 /* Poisoned TLP */ | ||
| 397 | #define PCI_ERR_UNC_FCP 0x00002000 /* Flow Control Protocol */ | ||
| 398 | #define PCI_ERR_UNC_COMP_TIME 0x00004000 /* Completion Timeout */ | ||
| 399 | #define PCI_ERR_UNC_COMP_ABORT 0x00008000 /* Completer Abort */ | ||
| 400 | #define PCI_ERR_UNC_UNX_COMP 0x00010000 /* Unexpected Completion */ | ||
| 401 | #define PCI_ERR_UNC_RX_OVER 0x00020000 /* Receiver Overflow */ | ||
| 402 | #define PCI_ERR_UNC_MALF_TLP 0x00040000 /* Malformed TLP */ | ||
| 403 | #define PCI_ERR_UNC_ECRC 0x00080000 /* ECRC Error Status */ | ||
| 404 | #define PCI_ERR_UNC_UNSUP 0x00100000 /* Unsupported Request */ | ||
| 405 | #define PCI_ERR_UNCOR_MASK 8 /* Uncorrectable Error Mask */ | ||
| 406 | /* Same bits as above */ | ||
| 407 | #define PCI_ERR_UNCOR_SEVER 12 /* Uncorrectable Error Severity */ | ||
| 408 | /* Same bits as above */ | ||
| 409 | #define PCI_ERR_COR_STATUS 16 /* Correctable Error Status */ | ||
| 410 | #define PCI_ERR_COR_RCVR 0x00000001 /* Receiver Error Status */ | ||
| 411 | #define PCI_ERR_COR_BAD_TLP 0x00000040 /* Bad TLP Status */ | ||
| 412 | #define PCI_ERR_COR_BAD_DLLP 0x00000080 /* Bad DLLP Status */ | ||
| 413 | #define PCI_ERR_COR_REP_ROLL 0x00000100 /* REPLAY_NUM Rollover */ | ||
| 414 | #define PCI_ERR_COR_REP_TIMER 0x00001000 /* Replay Timer Timeout */ | ||
| 415 | #define PCI_ERR_COR_MASK 20 /* Correctable Error Mask */ | ||
| 416 | /* Same bits as above */ | ||
| 417 | #define PCI_ERR_CAP 24 /* Advanced Error Capabilities */ | ||
| 418 | #define PCI_ERR_CAP_FEP(x) ((x) & 31) /* First Error Pointer */ | ||
| 419 | #define PCI_ERR_CAP_ECRC_GENC 0x00000020 /* ECRC Generation Capable */ | ||
| 420 | #define PCI_ERR_CAP_ECRC_GENE 0x00000040 /* ECRC Generation Enable */ | ||
| 421 | #define PCI_ERR_CAP_ECRC_CHKC 0x00000080 /* ECRC Check Capable */ | ||
| 422 | #define PCI_ERR_CAP_ECRC_CHKE 0x00000100 /* ECRC Check Enable */ | ||
| 423 | #define PCI_ERR_HEADER_LOG 28 /* Header Log Register (16 bytes) */ | ||
| 424 | #define PCI_ERR_ROOT_COMMAND 44 /* Root Error Command */ | ||
| 425 | #define PCI_ERR_ROOT_STATUS 48 | ||
| 426 | #define PCI_ERR_ROOT_COR_SRC 52 | ||
| 427 | #define PCI_ERR_ROOT_SRC 54 | ||
| 428 | |||
| 429 | /* Virtual Channel */ | ||
| 430 | #define PCI_VC_PORT_REG1 4 | ||
| 431 | #define PCI_VC_PORT_REG2 8 | ||
| 432 | #define PCI_VC_PORT_CTRL 12 | ||
| 433 | #define PCI_VC_PORT_STATUS 14 | ||
| 434 | #define PCI_VC_RES_CAP 16 | ||
| 435 | #define PCI_VC_RES_CTRL 20 | ||
| 436 | #define PCI_VC_RES_STATUS 26 | ||
| 437 | |||
| 438 | /* Power Budgeting */ | ||
| 439 | #define PCI_PWR_DSR 4 /* Data Select Register */ | ||
| 440 | #define PCI_PWR_DATA 8 /* Data Register */ | ||
| 441 | #define PCI_PWR_DATA_BASE(x) ((x) & 0xff) /* Base Power */ | ||
| 442 | #define PCI_PWR_DATA_SCALE(x) (((x) >> 8) & 3) /* Data Scale */ | ||
| 443 | #define PCI_PWR_DATA_PM_SUB(x) (((x) >> 10) & 7) /* PM Sub State */ | ||
| 444 | #define PCI_PWR_DATA_PM_STATE(x) (((x) >> 13) & 3) /* PM State */ | ||
| 445 | #define PCI_PWR_DATA_TYPE(x) (((x) >> 15) & 7) /* Type */ | ||
| 446 | #define PCI_PWR_DATA_RAIL(x) (((x) >> 18) & 7) /* Power Rail */ | ||
| 447 | #define PCI_PWR_CAP 12 /* Capability */ | ||
| 448 | #define PCI_PWR_CAP_BUDGET(x) ((x) & 1) /* Included in system budget */ | ||
| 449 | 24 | ||
| 450 | /* Include the ID list */ | 25 | /* Include the ID list */ |
| 451 | |||
| 452 | #include <linux/pci_ids.h> | 26 | #include <linux/pci_ids.h> |
| 453 | 27 | ||
| 454 | /* | 28 | /* |
| @@ -496,11 +70,12 @@ enum pci_mmap_state { | |||
| 496 | 70 | ||
| 497 | typedef int __bitwise pci_power_t; | 71 | typedef int __bitwise pci_power_t; |
| 498 | 72 | ||
| 499 | #define PCI_D0 ((pci_power_t __force) 0) | 73 | #define PCI_D0 ((pci_power_t __force) 0) |
| 500 | #define PCI_D1 ((pci_power_t __force) 1) | 74 | #define PCI_D1 ((pci_power_t __force) 1) |
| 501 | #define PCI_D2 ((pci_power_t __force) 2) | 75 | #define PCI_D2 ((pci_power_t __force) 2) |
| 502 | #define PCI_D3hot ((pci_power_t __force) 3) | 76 | #define PCI_D3hot ((pci_power_t __force) 3) |
| 503 | #define PCI_D3cold ((pci_power_t __force) 4) | 77 | #define PCI_D3cold ((pci_power_t __force) 4) |
| 78 | #define PCI_UNKNOWN ((pci_power_t __force) 5) | ||
| 504 | #define PCI_POWER_ERROR ((pci_power_t __force) -1) | 79 | #define PCI_POWER_ERROR ((pci_power_t __force) -1) |
| 505 | 80 | ||
| 506 | /* | 81 | /* |
| @@ -562,11 +137,6 @@ struct pci_dev { | |||
| 562 | struct bin_attribute *rom_attr; /* attribute descriptor for sysfs ROM entry */ | 137 | struct bin_attribute *rom_attr; /* attribute descriptor for sysfs ROM entry */ |
| 563 | int rom_attr_enabled; /* has display of the rom attribute been enabled? */ | 138 | int rom_attr_enabled; /* has display of the rom attribute been enabled? */ |
| 564 | struct bin_attribute *res_attr[DEVICE_COUNT_RESOURCE]; /* sysfs file for resources */ | 139 | struct bin_attribute *res_attr[DEVICE_COUNT_RESOURCE]; /* sysfs file for resources */ |
| 565 | #ifdef CONFIG_PCI_NAMES | ||
| 566 | #define PCI_NAME_SIZE 255 | ||
| 567 | #define PCI_NAME_HALF __stringify(43) /* less than half to handle slop */ | ||
| 568 | char pretty_name[PCI_NAME_SIZE]; /* pretty name for users to see */ | ||
| 569 | #endif | ||
| 570 | }; | 140 | }; |
| 571 | 141 | ||
| 572 | #define pci_dev_g(n) list_entry(n, struct pci_dev, global_list) | 142 | #define pci_dev_g(n) list_entry(n, struct pci_dev, global_list) |
| @@ -582,15 +152,15 @@ struct pci_dev { | |||
| 582 | * 7-10 bridges: address space assigned to buses behind the bridge | 152 | * 7-10 bridges: address space assigned to buses behind the bridge |
| 583 | */ | 153 | */ |
| 584 | 154 | ||
| 585 | #define PCI_ROM_RESOURCE 6 | 155 | #define PCI_ROM_RESOURCE 6 |
| 586 | #define PCI_BRIDGE_RESOURCES 7 | 156 | #define PCI_BRIDGE_RESOURCES 7 |
| 587 | #define PCI_NUM_RESOURCES 11 | 157 | #define PCI_NUM_RESOURCES 11 |
| 588 | 158 | ||
| 589 | #ifndef PCI_BUS_NUM_RESOURCES | 159 | #ifndef PCI_BUS_NUM_RESOURCES |
| 590 | #define PCI_BUS_NUM_RESOURCES 8 | 160 | #define PCI_BUS_NUM_RESOURCES 8 |
| 591 | #endif | 161 | #endif |
| 592 | 162 | ||
| 593 | #define PCI_REGION_FLAG_MASK 0x0fU /* These bits of resource flags tell us the PCI region flags */ | 163 | #define PCI_REGION_FLAG_MASK 0x0fU /* These bits of resource flags tell us the PCI region flags */ |
| 594 | 164 | ||
| 595 | struct pci_bus { | 165 | struct pci_bus { |
| 596 | struct list_head node; /* node in list of buses */ | 166 | struct list_head node; /* node in list of buses */ |
| @@ -699,7 +269,7 @@ struct pci_driver { | |||
| 699 | * @dev_class_mask: the class mask for this device | 269 | * @dev_class_mask: the class mask for this device |
| 700 | * | 270 | * |
| 701 | * This macro is used to create a struct pci_device_id that matches a | 271 | * This macro is used to create a struct pci_device_id that matches a |
| 702 | * specific PCI class. The vendor, device, subvendor, and subdevice | 272 | * specific PCI class. The vendor, device, subvendor, and subdevice |
| 703 | * fields will be set to PCI_ANY_ID. | 273 | * fields will be set to PCI_ANY_ID. |
| 704 | */ | 274 | */ |
| 705 | #define PCI_DEVICE_CLASS(dev_class,dev_class_mask) \ | 275 | #define PCI_DEVICE_CLASS(dev_class,dev_class_mask) \ |
| @@ -707,7 +277,7 @@ struct pci_driver { | |||
| 707 | .vendor = PCI_ANY_ID, .device = PCI_ANY_ID, \ | 277 | .vendor = PCI_ANY_ID, .device = PCI_ANY_ID, \ |
| 708 | .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID | 278 | .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID |
| 709 | 279 | ||
| 710 | /* | 280 | /* |
| 711 | * pci_module_init is obsolete, this stays here till we fix up all usages of it | 281 | * pci_module_init is obsolete, this stays here till we fix up all usages of it |
| 712 | * in the tree. | 282 | * in the tree. |
| 713 | */ | 283 | */ |
| @@ -745,12 +315,13 @@ static inline struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *s | |||
| 745 | pci_bus_add_devices(root_bus); | 315 | pci_bus_add_devices(root_bus); |
| 746 | return root_bus; | 316 | return root_bus; |
| 747 | } | 317 | } |
| 318 | struct pci_bus *pci_create_bus(struct device *parent, int bus, struct pci_ops *ops, void *sysdata); | ||
| 319 | struct pci_bus * pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, int busnr); | ||
| 748 | int pci_scan_slot(struct pci_bus *bus, int devfn); | 320 | int pci_scan_slot(struct pci_bus *bus, int devfn); |
| 749 | struct pci_dev * pci_scan_single_device(struct pci_bus *bus, int devfn); | 321 | struct pci_dev * pci_scan_single_device(struct pci_bus *bus, int devfn); |
| 322 | void pci_device_add(struct pci_dev *dev, struct pci_bus *bus); | ||
| 750 | unsigned int pci_scan_child_bus(struct pci_bus *bus); | 323 | unsigned int pci_scan_child_bus(struct pci_bus *bus); |
| 751 | void pci_bus_add_device(struct pci_dev *dev); | 324 | void pci_bus_add_device(struct pci_dev *dev); |
| 752 | void pci_name_device(struct pci_dev *dev); | ||
| 753 | char *pci_class_name(u32 class); | ||
| 754 | void pci_read_bridge_bases(struct pci_bus *child); | 325 | void pci_read_bridge_bases(struct pci_bus *child); |
| 755 | struct resource *pci_find_parent_resource(const struct pci_dev *dev, struct resource *res); | 326 | struct resource *pci_find_parent_resource(const struct pci_dev *dev, struct resource *res); |
| 756 | int pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge); | 327 | int pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge); |
| @@ -758,6 +329,7 @@ extern struct pci_dev *pci_dev_get(struct pci_dev *dev); | |||
| 758 | extern void pci_dev_put(struct pci_dev *dev); | 329 | extern void pci_dev_put(struct pci_dev *dev); |
| 759 | extern void pci_remove_bus(struct pci_bus *b); | 330 | extern void pci_remove_bus(struct pci_bus *b); |
| 760 | extern void pci_remove_bus_device(struct pci_dev *dev); | 331 | extern void pci_remove_bus_device(struct pci_dev *dev); |
| 332 | void pci_setup_cardbus(struct pci_bus *bus); | ||
| 761 | 333 | ||
| 762 | /* Generic PCI functions exported to card drivers */ | 334 | /* Generic PCI functions exported to card drivers */ |
| 763 | 335 | ||
| @@ -815,13 +387,16 @@ void pci_set_master(struct pci_dev *dev); | |||
| 815 | #define HAVE_PCI_SET_MWI | 387 | #define HAVE_PCI_SET_MWI |
| 816 | int pci_set_mwi(struct pci_dev *dev); | 388 | int pci_set_mwi(struct pci_dev *dev); |
| 817 | void pci_clear_mwi(struct pci_dev *dev); | 389 | void pci_clear_mwi(struct pci_dev *dev); |
| 390 | void pci_intx(struct pci_dev *dev, int enable); | ||
| 818 | int pci_set_dma_mask(struct pci_dev *dev, u64 mask); | 391 | int pci_set_dma_mask(struct pci_dev *dev, u64 mask); |
| 819 | int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask); | 392 | int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask); |
| 393 | void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno); | ||
| 820 | int pci_assign_resource(struct pci_dev *dev, int i); | 394 | int pci_assign_resource(struct pci_dev *dev, int i); |
| 395 | void pci_restore_bars(struct pci_dev *dev); | ||
| 821 | 396 | ||
| 822 | /* ROM control related routines */ | 397 | /* ROM control related routines */ |
| 823 | void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size); | 398 | void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size); |
| 824 | void __iomem *pci_map_rom_copy(struct pci_dev *pdev, size_t *size); | 399 | void __iomem __must_check *pci_map_rom_copy(struct pci_dev *pdev, size_t *size); |
| 825 | void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom); | 400 | void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom); |
| 826 | void pci_remove_rom(struct pci_dev *pdev); | 401 | void pci_remove_rom(struct pci_dev *pdev); |
| 827 | 402 | ||
| @@ -865,6 +440,9 @@ const struct pci_device_id *pci_match_device(struct pci_driver *drv, struct pci_ | |||
| 865 | const struct pci_device_id *pci_match_id(const struct pci_device_id *ids, struct pci_dev *dev); | 440 | const struct pci_device_id *pci_match_id(const struct pci_device_id *ids, struct pci_dev *dev); |
| 866 | int pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max, int pass); | 441 | int pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max, int pass); |
| 867 | 442 | ||
| 443 | void pci_walk_bus(struct pci_bus *top, void (*cb)(struct pci_dev *, void *), | ||
| 444 | void *userdata); | ||
| 445 | |||
| 868 | /* kmem_cache style wrapper around pci_alloc_consistent() */ | 446 | /* kmem_cache style wrapper around pci_alloc_consistent() */ |
| 869 | 447 | ||
| 870 | #include <linux/dmapool.h> | 448 | #include <linux/dmapool.h> |
| @@ -912,18 +490,26 @@ extern void pci_disable_msix(struct pci_dev *dev); | |||
| 912 | extern void msi_remove_pci_irq_vectors(struct pci_dev *dev); | 490 | extern void msi_remove_pci_irq_vectors(struct pci_dev *dev); |
| 913 | #endif | 491 | #endif |
| 914 | 492 | ||
| 915 | #endif /* CONFIG_PCI */ | 493 | /* |
| 916 | 494 | * PCI domain support. Sometimes called PCI segment (eg by ACPI), | |
| 917 | /* Include architecture-dependent settings and functions */ | 495 | * a PCI domain is defined to be a set of PCI busses which share |
| 496 | * configuration space. | ||
| 497 | */ | ||
| 498 | #ifndef CONFIG_PCI_DOMAINS | ||
| 499 | static inline int pci_domain_nr(struct pci_bus *bus) { return 0; } | ||
| 500 | static inline int pci_proc_domain(struct pci_bus *bus) | ||
| 501 | { | ||
| 502 | return 0; | ||
| 503 | } | ||
| 504 | #endif | ||
| 918 | 505 | ||
| 919 | #include <asm/pci.h> | 506 | #else /* CONFIG_PCI is not enabled */ |
| 920 | 507 | ||
| 921 | /* | 508 | /* |
| 922 | * If the system does not have PCI, clearly these return errors. Define | 509 | * If the system does not have PCI, clearly these return errors. Define |
| 923 | * these as simple inline functions to avoid hair in drivers. | 510 | * these as simple inline functions to avoid hair in drivers. |
| 924 | */ | 511 | */ |
| 925 | 512 | ||
| 926 | #ifndef CONFIG_PCI | ||
| 927 | #define _PCI_NOP(o,s,t) \ | 513 | #define _PCI_NOP(o,s,t) \ |
| 928 | static inline int pci_##o##_config_##s (struct pci_dev *dev, int where, t val) \ | 514 | static inline int pci_##o##_config_##s (struct pci_dev *dev, int where, t val) \ |
| 929 | { return PCIBIOS_FUNC_NOT_SUPPORTED; } | 515 | { return PCIBIOS_FUNC_NOT_SUPPORTED; } |
| @@ -974,21 +560,11 @@ static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int en | |||
| 974 | 560 | ||
| 975 | #define pci_dma_burst_advice(pdev, strat, strategy_parameter) do { } while (0) | 561 | #define pci_dma_burst_advice(pdev, strat, strategy_parameter) do { } while (0) |
| 976 | 562 | ||
| 977 | #else | 563 | #endif /* CONFIG_PCI */ |
| 978 | 564 | ||
| 979 | /* | 565 | /* Include architecture-dependent settings and functions */ |
| 980 | * PCI domain support. Sometimes called PCI segment (eg by ACPI), | 566 | |
| 981 | * a PCI domain is defined to be a set of PCI busses which share | 567 | #include <asm/pci.h> |
| 982 | * configuration space. | ||
| 983 | */ | ||
| 984 | #ifndef CONFIG_PCI_DOMAINS | ||
| 985 | static inline int pci_domain_nr(struct pci_bus *bus) { return 0; } | ||
| 986 | static inline int pci_proc_domain(struct pci_bus *bus) | ||
| 987 | { | ||
| 988 | return 0; | ||
| 989 | } | ||
| 990 | #endif | ||
| 991 | #endif /* !CONFIG_PCI */ | ||
| 992 | 568 | ||
| 993 | /* these helpers provide future and backwards compatibility | 569 | /* these helpers provide future and backwards compatibility |
| 994 | * for accessing popular PCI BAR info */ | 570 | * for accessing popular PCI BAR info */ |
| @@ -1025,13 +601,6 @@ static inline char *pci_name(struct pci_dev *pdev) | |||
| 1025 | return pdev->dev.bus_id; | 601 | return pdev->dev.bus_id; |
| 1026 | } | 602 | } |
| 1027 | 603 | ||
| 1028 | /* Some archs want to see the pretty pci name, so use this macro */ | ||
| 1029 | #ifdef CONFIG_PCI_NAMES | ||
| 1030 | #define pci_pretty_name(dev) ((dev)->pretty_name) | ||
| 1031 | #else | ||
| 1032 | #define pci_pretty_name(dev) "" | ||
| 1033 | #endif | ||
| 1034 | |||
| 1035 | 604 | ||
| 1036 | /* Some archs don't want to expose struct resource to userland as-is | 605 | /* Some archs don't want to expose struct resource to userland as-is |
| 1037 | * in sysfs and /proc | 606 | * in sysfs and /proc |
| @@ -1067,7 +636,7 @@ enum pci_fixup_pass { | |||
| 1067 | 636 | ||
| 1068 | /* Anonymous variables would be nice... */ | 637 | /* Anonymous variables would be nice... */ |
| 1069 | #define DECLARE_PCI_FIXUP_SECTION(section, name, vendor, device, hook) \ | 638 | #define DECLARE_PCI_FIXUP_SECTION(section, name, vendor, device, hook) \ |
| 1070 | static struct pci_fixup __pci_fixup_##name __attribute_used__ \ | 639 | static const struct pci_fixup __pci_fixup_##name __attribute_used__ \ |
| 1071 | __attribute__((__section__(#section))) = { vendor, device, hook }; | 640 | __attribute__((__section__(#section))) = { vendor, device, hook }; |
| 1072 | #define DECLARE_PCI_FIXUP_EARLY(vendor, device, hook) \ | 641 | #define DECLARE_PCI_FIXUP_EARLY(vendor, device, hook) \ |
| 1073 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \ | 642 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \ |
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h new file mode 100644 index 000000000000..e2a089b051ed --- /dev/null +++ b/include/linux/pci_regs.h | |||
| @@ -0,0 +1,448 @@ | |||
| 1 | /* | ||
| 2 | * pci_regs.h | ||
| 3 | * | ||
| 4 | * PCI standard defines | ||
| 5 | * Copyright 1994, Drew Eckhardt | ||
| 6 | * Copyright 1997--1999 Martin Mares <mj@ucw.cz> | ||
| 7 | * | ||
| 8 | * For more information, please consult the following manuals (look at | ||
| 9 | * http://www.pcisig.com/ for how to get them): | ||
| 10 | * | ||
| 11 | * PCI BIOS Specification | ||
| 12 | * PCI Local Bus Specification | ||
| 13 | * PCI to PCI Bridge Specification | ||
| 14 | * PCI System Design Guide | ||
| 15 | */ | ||
| 16 | |||
| 17 | #ifndef LINUX_PCI_REGS_H | ||
| 18 | #define LINUX_PCI_REGS_H | ||
| 19 | |||
| 20 | /* | ||
| 21 | * Under PCI, each device has 256 bytes of configuration address space, | ||
| 22 | * of which the first 64 bytes are standardized as follows: | ||
| 23 | */ | ||
| 24 | #define PCI_VENDOR_ID 0x00 /* 16 bits */ | ||
| 25 | #define PCI_DEVICE_ID 0x02 /* 16 bits */ | ||
| 26 | #define PCI_COMMAND 0x04 /* 16 bits */ | ||
| 27 | #define PCI_COMMAND_IO 0x1 /* Enable response in I/O space */ | ||
| 28 | #define PCI_COMMAND_MEMORY 0x2 /* Enable response in Memory space */ | ||
| 29 | #define PCI_COMMAND_MASTER 0x4 /* Enable bus mastering */ | ||
| 30 | #define PCI_COMMAND_SPECIAL 0x8 /* Enable response to special cycles */ | ||
| 31 | #define PCI_COMMAND_INVALIDATE 0x10 /* Use memory write and invalidate */ | ||
| 32 | #define PCI_COMMAND_VGA_PALETTE 0x20 /* Enable palette snooping */ | ||
| 33 | #define PCI_COMMAND_PARITY 0x40 /* Enable parity checking */ | ||
| 34 | #define PCI_COMMAND_WAIT 0x80 /* Enable address/data stepping */ | ||
| 35 | #define PCI_COMMAND_SERR 0x100 /* Enable SERR */ | ||
| 36 | #define PCI_COMMAND_FAST_BACK 0x200 /* Enable back-to-back writes */ | ||
| 37 | #define PCI_COMMAND_INTX_DISABLE 0x400 /* INTx Emulation Disable */ | ||
| 38 | |||
| 39 | #define PCI_STATUS 0x06 /* 16 bits */ | ||
| 40 | #define PCI_STATUS_CAP_LIST 0x10 /* Support Capability List */ | ||
| 41 | #define PCI_STATUS_66MHZ 0x20 /* Support 66 Mhz PCI 2.1 bus */ | ||
| 42 | #define PCI_STATUS_UDF 0x40 /* Support User Definable Features [obsolete] */ | ||
| 43 | #define PCI_STATUS_FAST_BACK 0x80 /* Accept fast-back to back */ | ||
| 44 | #define PCI_STATUS_PARITY 0x100 /* Detected parity error */ | ||
| 45 | #define PCI_STATUS_DEVSEL_MASK 0x600 /* DEVSEL timing */ | ||
| 46 | #define PCI_STATUS_DEVSEL_FAST 0x000 | ||
| 47 | #define PCI_STATUS_DEVSEL_MEDIUM 0x200 | ||
| 48 | #define PCI_STATUS_DEVSEL_SLOW 0x400 | ||
| 49 | #define PCI_STATUS_SIG_TARGET_ABORT 0x800 /* Set on target abort */ | ||
| 50 | #define PCI_STATUS_REC_TARGET_ABORT 0x1000 /* Master ack of " */ | ||
| 51 | #define PCI_STATUS_REC_MASTER_ABORT 0x2000 /* Set on master abort */ | ||
| 52 | #define PCI_STATUS_SIG_SYSTEM_ERROR 0x4000 /* Set when we drive SERR */ | ||
| 53 | #define PCI_STATUS_DETECTED_PARITY 0x8000 /* Set on parity error */ | ||
| 54 | |||
| 55 | #define PCI_CLASS_REVISION 0x08 /* High 24 bits are class, low 8 revision */ | ||
| 56 | #define PCI_REVISION_ID 0x08 /* Revision ID */ | ||
| 57 | #define PCI_CLASS_PROG 0x09 /* Reg. Level Programming Interface */ | ||
| 58 | #define PCI_CLASS_DEVICE 0x0a /* Device class */ | ||
| 59 | |||
| 60 | #define PCI_CACHE_LINE_SIZE 0x0c /* 8 bits */ | ||
| 61 | #define PCI_LATENCY_TIMER 0x0d /* 8 bits */ | ||
| 62 | #define PCI_HEADER_TYPE 0x0e /* 8 bits */ | ||
| 63 | #define PCI_HEADER_TYPE_NORMAL 0 | ||
| 64 | #define PCI_HEADER_TYPE_BRIDGE 1 | ||
| 65 | #define PCI_HEADER_TYPE_CARDBUS 2 | ||
| 66 | |||
| 67 | #define PCI_BIST 0x0f /* 8 bits */ | ||
| 68 | #define PCI_BIST_CODE_MASK 0x0f /* Return result */ | ||
| 69 | #define PCI_BIST_START 0x40 /* 1 to start BIST, 2 secs or less */ | ||
| 70 | #define PCI_BIST_CAPABLE 0x80 /* 1 if BIST capable */ | ||
| 71 | |||
| 72 | /* | ||
| 73 | * Base addresses specify locations in memory or I/O space. | ||
| 74 | * Decoded size can be determined by writing a value of | ||
| 75 | * 0xffffffff to the register, and reading it back. Only | ||
| 76 | * 1 bits are decoded. | ||
| 77 | */ | ||
| 78 | #define PCI_BASE_ADDRESS_0 0x10 /* 32 bits */ | ||
| 79 | #define PCI_BASE_ADDRESS_1 0x14 /* 32 bits [htype 0,1 only] */ | ||
| 80 | #define PCI_BASE_ADDRESS_2 0x18 /* 32 bits [htype 0 only] */ | ||
| 81 | #define PCI_BASE_ADDRESS_3 0x1c /* 32 bits */ | ||
| 82 | #define PCI_BASE_ADDRESS_4 0x20 /* 32 bits */ | ||
| 83 | #define PCI_BASE_ADDRESS_5 0x24 /* 32 bits */ | ||
| 84 | #define PCI_BASE_ADDRESS_SPACE 0x01 /* 0 = memory, 1 = I/O */ | ||
| 85 | #define PCI_BASE_ADDRESS_SPACE_IO 0x01 | ||
| 86 | #define PCI_BASE_ADDRESS_SPACE_MEMORY 0x00 | ||
| 87 | #define PCI_BASE_ADDRESS_MEM_TYPE_MASK 0x06 | ||
| 88 | #define PCI_BASE_ADDRESS_MEM_TYPE_32 0x00 /* 32 bit address */ | ||
| 89 | #define PCI_BASE_ADDRESS_MEM_TYPE_1M 0x02 /* Below 1M [obsolete] */ | ||
| 90 | #define PCI_BASE_ADDRESS_MEM_TYPE_64 0x04 /* 64 bit address */ | ||
| 91 | #define PCI_BASE_ADDRESS_MEM_PREFETCH 0x08 /* prefetchable? */ | ||
| 92 | #define PCI_BASE_ADDRESS_MEM_MASK (~0x0fUL) | ||
| 93 | #define PCI_BASE_ADDRESS_IO_MASK (~0x03UL) | ||
| 94 | /* bit 1 is reserved if address_space = 1 */ | ||
| 95 | |||
| 96 | /* Header type 0 (normal devices) */ | ||
| 97 | #define PCI_CARDBUS_CIS 0x28 | ||
| 98 | #define PCI_SUBSYSTEM_VENDOR_ID 0x2c | ||
| 99 | #define PCI_SUBSYSTEM_ID 0x2e | ||
| 100 | #define PCI_ROM_ADDRESS 0x30 /* Bits 31..11 are address, 10..1 reserved */ | ||
| 101 | #define PCI_ROM_ADDRESS_ENABLE 0x01 | ||
| 102 | #define PCI_ROM_ADDRESS_MASK (~0x7ffUL) | ||
| 103 | |||
| 104 | #define PCI_CAPABILITY_LIST 0x34 /* Offset of first capability list entry */ | ||
| 105 | |||
| 106 | /* 0x35-0x3b are reserved */ | ||
| 107 | #define PCI_INTERRUPT_LINE 0x3c /* 8 bits */ | ||
| 108 | #define PCI_INTERRUPT_PIN 0x3d /* 8 bits */ | ||
| 109 | #define PCI_MIN_GNT 0x3e /* 8 bits */ | ||
| 110 | #define PCI_MAX_LAT 0x3f /* 8 bits */ | ||
| 111 | |||
| 112 | /* Header type 1 (PCI-to-PCI bridges) */ | ||
| 113 | #define PCI_PRIMARY_BUS 0x18 /* Primary bus number */ | ||
| 114 | #define PCI_SECONDARY_BUS 0x19 /* Secondary bus number */ | ||
| 115 | #define PCI_SUBORDINATE_BUS 0x1a /* Highest bus number behind the bridge */ | ||
| 116 | #define PCI_SEC_LATENCY_TIMER 0x1b /* Latency timer for secondary interface */ | ||
| 117 | #define PCI_IO_BASE 0x1c /* I/O range behind the bridge */ | ||
| 118 | #define PCI_IO_LIMIT 0x1d | ||
| 119 | #define PCI_IO_RANGE_TYPE_MASK 0x0fUL /* I/O bridging type */ | ||
| 120 | #define PCI_IO_RANGE_TYPE_16 0x00 | ||
| 121 | #define PCI_IO_RANGE_TYPE_32 0x01 | ||
| 122 | #define PCI_IO_RANGE_MASK (~0x0fUL) | ||
| 123 | #define PCI_SEC_STATUS 0x1e /* Secondary status register, only bit 14 used */ | ||
| 124 | #define PCI_MEMORY_BASE 0x20 /* Memory range behind */ | ||
| 125 | #define PCI_MEMORY_LIMIT 0x22 | ||
| 126 | #define PCI_MEMORY_RANGE_TYPE_MASK 0x0fUL | ||
| 127 | #define PCI_MEMORY_RANGE_MASK (~0x0fUL) | ||
| 128 | #define PCI_PREF_MEMORY_BASE 0x24 /* Prefetchable memory range behind */ | ||
| 129 | #define PCI_PREF_MEMORY_LIMIT 0x26 | ||
| 130 | #define PCI_PREF_RANGE_TYPE_MASK 0x0fUL | ||
| 131 | #define PCI_PREF_RANGE_TYPE_32 0x00 | ||
| 132 | #define PCI_PREF_RANGE_TYPE_64 0x01 | ||
| 133 | #define PCI_PREF_RANGE_MASK (~0x0fUL) | ||
| 134 | #define PCI_PREF_BASE_UPPER32 0x28 /* Upper half of prefetchable memory range */ | ||
| 135 | #define PCI_PREF_LIMIT_UPPER32 0x2c | ||
| 136 | #define PCI_IO_BASE_UPPER16 0x30 /* Upper half of I/O addresses */ | ||
| 137 | #define PCI_IO_LIMIT_UPPER16 0x32 | ||
| 138 | /* 0x34 same as for htype 0 */ | ||
| 139 | /* 0x35-0x3b is reserved */ | ||
| 140 | #define PCI_ROM_ADDRESS1 0x38 /* Same as PCI_ROM_ADDRESS, but for htype 1 */ | ||
| 141 | /* 0x3c-0x3d are same as for htype 0 */ | ||
| 142 | #define PCI_BRIDGE_CONTROL 0x3e | ||
| 143 | #define PCI_BRIDGE_CTL_PARITY 0x01 /* Enable parity detection on secondary interface */ | ||
| 144 | #define PCI_BRIDGE_CTL_SERR 0x02 /* The same for SERR forwarding */ | ||
| 145 | #define PCI_BRIDGE_CTL_NO_ISA 0x04 /* Disable bridging of ISA ports */ | ||
| 146 | #define PCI_BRIDGE_CTL_VGA 0x08 /* Forward VGA addresses */ | ||
| 147 | #define PCI_BRIDGE_CTL_MASTER_ABORT 0x20 /* Report master aborts */ | ||
| 148 | #define PCI_BRIDGE_CTL_BUS_RESET 0x40 /* Secondary bus reset */ | ||
| 149 | #define PCI_BRIDGE_CTL_FAST_BACK 0x80 /* Fast Back2Back enabled on secondary interface */ | ||
| 150 | |||
| 151 | /* Header type 2 (CardBus bridges) */ | ||
| 152 | #define PCI_CB_CAPABILITY_LIST 0x14 | ||
| 153 | /* 0x15 reserved */ | ||
| 154 | #define PCI_CB_SEC_STATUS 0x16 /* Secondary status */ | ||
| 155 | #define PCI_CB_PRIMARY_BUS 0x18 /* PCI bus number */ | ||
| 156 | #define PCI_CB_CARD_BUS 0x19 /* CardBus bus number */ | ||
| 157 | #define PCI_CB_SUBORDINATE_BUS 0x1a /* Subordinate bus number */ | ||
| 158 | #define PCI_CB_LATENCY_TIMER 0x1b /* CardBus latency timer */ | ||
| 159 | #define PCI_CB_MEMORY_BASE_0 0x1c | ||
| 160 | #define PCI_CB_MEMORY_LIMIT_0 0x20 | ||
| 161 | #define PCI_CB_MEMORY_BASE_1 0x24 | ||
| 162 | #define PCI_CB_MEMORY_LIMIT_1 0x28 | ||
| 163 | #define PCI_CB_IO_BASE_0 0x2c | ||
| 164 | #define PCI_CB_IO_BASE_0_HI 0x2e | ||
| 165 | #define PCI_CB_IO_LIMIT_0 0x30 | ||
| 166 | #define PCI_CB_IO_LIMIT_0_HI 0x32 | ||
| 167 | #define PCI_CB_IO_BASE_1 0x34 | ||
| 168 | #define PCI_CB_IO_BASE_1_HI 0x36 | ||
| 169 | #define PCI_CB_IO_LIMIT_1 0x38 | ||
| 170 | #define PCI_CB_IO_LIMIT_1_HI 0x3a | ||
| 171 | #define PCI_CB_IO_RANGE_MASK (~0x03UL) | ||
| 172 | /* 0x3c-0x3d are same as for htype 0 */ | ||
| 173 | #define PCI_CB_BRIDGE_CONTROL 0x3e | ||
| 174 | #define PCI_CB_BRIDGE_CTL_PARITY 0x01 /* Similar to standard bridge control register */ | ||
| 175 | #define PCI_CB_BRIDGE_CTL_SERR 0x02 | ||
| 176 | #define PCI_CB_BRIDGE_CTL_ISA 0x04 | ||
| 177 | #define PCI_CB_BRIDGE_CTL_VGA 0x08 | ||
| 178 | #define PCI_CB_BRIDGE_CTL_MASTER_ABORT 0x20 | ||
| 179 | #define PCI_CB_BRIDGE_CTL_CB_RESET 0x40 /* CardBus reset */ | ||
| 180 | #define PCI_CB_BRIDGE_CTL_16BIT_INT 0x80 /* Enable interrupt for 16-bit cards */ | ||
| 181 | #define PCI_CB_BRIDGE_CTL_PREFETCH_MEM0 0x100 /* Prefetch enable for both memory regions */ | ||
| 182 | #define PCI_CB_BRIDGE_CTL_PREFETCH_MEM1 0x200 | ||
| 183 | #define PCI_CB_BRIDGE_CTL_POST_WRITES 0x400 | ||
| 184 | #define PCI_CB_SUBSYSTEM_VENDOR_ID 0x40 | ||
| 185 | #define PCI_CB_SUBSYSTEM_ID 0x42 | ||
| 186 | #define PCI_CB_LEGACY_MODE_BASE 0x44 /* 16-bit PC Card legacy mode base address (ExCa) */ | ||
| 187 | /* 0x48-0x7f reserved */ | ||
| 188 | |||
| 189 | /* Capability lists */ | ||
| 190 | |||
| 191 | #define PCI_CAP_LIST_ID 0 /* Capability ID */ | ||
| 192 | #define PCI_CAP_ID_PM 0x01 /* Power Management */ | ||
| 193 | #define PCI_CAP_ID_AGP 0x02 /* Accelerated Graphics Port */ | ||
| 194 | #define PCI_CAP_ID_VPD 0x03 /* Vital Product Data */ | ||
| 195 | #define PCI_CAP_ID_SLOTID 0x04 /* Slot Identification */ | ||
| 196 | #define PCI_CAP_ID_MSI 0x05 /* Message Signalled Interrupts */ | ||
| 197 | #define PCI_CAP_ID_CHSWP 0x06 /* CompactPCI HotSwap */ | ||
| 198 | #define PCI_CAP_ID_PCIX 0x07 /* PCI-X */ | ||
| 199 | #define PCI_CAP_ID_SHPC 0x0C /* PCI Standard Hot-Plug Controller */ | ||
| 200 | #define PCI_CAP_ID_EXP 0x10 /* PCI Express */ | ||
| 201 | #define PCI_CAP_ID_MSIX 0x11 /* MSI-X */ | ||
| 202 | #define PCI_CAP_LIST_NEXT 1 /* Next capability in the list */ | ||
| 203 | #define PCI_CAP_FLAGS 2 /* Capability defined flags (16 bits) */ | ||
| 204 | #define PCI_CAP_SIZEOF 4 | ||
| 205 | |||
| 206 | /* Power Management Registers */ | ||
| 207 | |||
| 208 | #define PCI_PM_PMC 2 /* PM Capabilities Register */ | ||
| 209 | #define PCI_PM_CAP_VER_MASK 0x0007 /* Version */ | ||
| 210 | #define PCI_PM_CAP_PME_CLOCK 0x0008 /* PME clock required */ | ||
| 211 | #define PCI_PM_CAP_RESERVED 0x0010 /* Reserved field */ | ||
| 212 | #define PCI_PM_CAP_DSI 0x0020 /* Device specific initialization */ | ||
| 213 | #define PCI_PM_CAP_AUX_POWER 0x01C0 /* Auxilliary power support mask */ | ||
| 214 | #define PCI_PM_CAP_D1 0x0200 /* D1 power state support */ | ||
| 215 | #define PCI_PM_CAP_D2 0x0400 /* D2 power state support */ | ||
| 216 | #define PCI_PM_CAP_PME 0x0800 /* PME pin supported */ | ||
| 217 | #define PCI_PM_CAP_PME_MASK 0xF800 /* PME Mask of all supported states */ | ||
| 218 | #define PCI_PM_CAP_PME_D0 0x0800 /* PME# from D0 */ | ||
| 219 | #define PCI_PM_CAP_PME_D1 0x1000 /* PME# from D1 */ | ||
| 220 | #define PCI_PM_CAP_PME_D2 0x2000 /* PME# from D2 */ | ||
| 221 | #define PCI_PM_CAP_PME_D3 0x4000 /* PME# from D3 (hot) */ | ||
| 222 | #define PCI_PM_CAP_PME_D3cold 0x8000 /* PME# from D3 (cold) */ | ||
| 223 | #define PCI_PM_CTRL 4 /* PM control and status register */ | ||
| 224 | #define PCI_PM_CTRL_STATE_MASK 0x0003 /* Current power state (D0 to D3) */ | ||
| 225 | #define PCI_PM_CTRL_NO_SOFT_RESET 0x0004 /* No reset for D3hot->D0 */ | ||
| 226 | #define PCI_PM_CTRL_PME_ENABLE 0x0100 /* PME pin enable */ | ||
| 227 | #define PCI_PM_CTRL_DATA_SEL_MASK 0x1e00 /* Data select (??) */ | ||
| 228 | #define PCI_PM_CTRL_DATA_SCALE_MASK 0x6000 /* Data scale (??) */ | ||
| 229 | #define PCI_PM_CTRL_PME_STATUS 0x8000 /* PME pin status */ | ||
| 230 | #define PCI_PM_PPB_EXTENSIONS 6 /* PPB support extensions (??) */ | ||
| 231 | #define PCI_PM_PPB_B2_B3 0x40 /* Stop clock when in D3hot (??) */ | ||
| 232 | #define PCI_PM_BPCC_ENABLE 0x80 /* Bus power/clock control enable (??) */ | ||
| 233 | #define PCI_PM_DATA_REGISTER 7 /* (??) */ | ||
| 234 | #define PCI_PM_SIZEOF 8 | ||
| 235 | |||
| 236 | /* AGP registers */ | ||
| 237 | |||
| 238 | #define PCI_AGP_VERSION 2 /* BCD version number */ | ||
| 239 | #define PCI_AGP_RFU 3 /* Rest of capability flags */ | ||
| 240 | #define PCI_AGP_STATUS 4 /* Status register */ | ||
| 241 | #define PCI_AGP_STATUS_RQ_MASK 0xff000000 /* Maximum number of requests - 1 */ | ||
| 242 | #define PCI_AGP_STATUS_SBA 0x0200 /* Sideband addressing supported */ | ||
| 243 | #define PCI_AGP_STATUS_64BIT 0x0020 /* 64-bit addressing supported */ | ||
| 244 | #define PCI_AGP_STATUS_FW 0x0010 /* FW transfers supported */ | ||
| 245 | #define PCI_AGP_STATUS_RATE4 0x0004 /* 4x transfer rate supported */ | ||
| 246 | #define PCI_AGP_STATUS_RATE2 0x0002 /* 2x transfer rate supported */ | ||
| 247 | #define PCI_AGP_STATUS_RATE1 0x0001 /* 1x transfer rate supported */ | ||
| 248 | #define PCI_AGP_COMMAND 8 /* Control register */ | ||
| 249 | #define PCI_AGP_COMMAND_RQ_MASK 0xff000000 /* Master: Maximum number of requests */ | ||
| 250 | #define PCI_AGP_COMMAND_SBA 0x0200 /* Sideband addressing enabled */ | ||
| 251 | #define PCI_AGP_COMMAND_AGP 0x0100 /* Allow processing of AGP transactions */ | ||
| 252 | #define PCI_AGP_COMMAND_64BIT 0x0020 /* Allow processing of 64-bit addresses */ | ||
| 253 | #define PCI_AGP_COMMAND_FW 0x0010 /* Force FW transfers */ | ||
| 254 | #define PCI_AGP_COMMAND_RATE4 0x0004 /* Use 4x rate */ | ||
| 255 | #define PCI_AGP_COMMAND_RATE2 0x0002 /* Use 2x rate */ | ||
| 256 | #define PCI_AGP_COMMAND_RATE1 0x0001 /* Use 1x rate */ | ||
| 257 | #define PCI_AGP_SIZEOF 12 | ||
| 258 | |||
| 259 | /* Vital Product Data */ | ||
| 260 | |||
| 261 | #define PCI_VPD_ADDR 2 /* Address to access (15 bits!) */ | ||
| 262 | #define PCI_VPD_ADDR_MASK 0x7fff /* Address mask */ | ||
| 263 | #define PCI_VPD_ADDR_F 0x8000 /* Write 0, 1 indicates completion */ | ||
| 264 | #define PCI_VPD_DATA 4 /* 32-bits of data returned here */ | ||
| 265 | |||
| 266 | /* Slot Identification */ | ||
| 267 | |||
| 268 | #define PCI_SID_ESR 2 /* Expansion Slot Register */ | ||
| 269 | #define PCI_SID_ESR_NSLOTS 0x1f /* Number of expansion slots available */ | ||
| 270 | #define PCI_SID_ESR_FIC 0x20 /* First In Chassis Flag */ | ||
| 271 | #define PCI_SID_CHASSIS_NR 3 /* Chassis Number */ | ||
| 272 | |||
| 273 | /* Message Signalled Interrupts registers */ | ||
| 274 | |||
| 275 | #define PCI_MSI_FLAGS 2 /* Various flags */ | ||
| 276 | #define PCI_MSI_FLAGS_64BIT 0x80 /* 64-bit addresses allowed */ | ||
| 277 | #define PCI_MSI_FLAGS_QSIZE 0x70 /* Message queue size configured */ | ||
| 278 | #define PCI_MSI_FLAGS_QMASK 0x0e /* Maximum queue size available */ | ||
| 279 | #define PCI_MSI_FLAGS_ENABLE 0x01 /* MSI feature enabled */ | ||
| 280 | #define PCI_MSI_FLAGS_MASKBIT 0x100 /* 64-bit mask bits allowed */ | ||
| 281 | #define PCI_MSI_RFU 3 /* Rest of capability flags */ | ||
| 282 | #define PCI_MSI_ADDRESS_LO 4 /* Lower 32 bits */ | ||
| 283 | #define PCI_MSI_ADDRESS_HI 8 /* Upper 32 bits (if PCI_MSI_FLAGS_64BIT set) */ | ||
| 284 | #define PCI_MSI_DATA_32 8 /* 16 bits of data for 32-bit devices */ | ||
| 285 | #define PCI_MSI_DATA_64 12 /* 16 bits of data for 64-bit devices */ | ||
| 286 | #define PCI_MSI_MASK_BIT 16 /* Mask bits register */ | ||
| 287 | |||
| 288 | /* CompactPCI Hotswap Register */ | ||
| 289 | |||
| 290 | #define PCI_CHSWP_CSR 2 /* Control and Status Register */ | ||
| 291 | #define PCI_CHSWP_DHA 0x01 /* Device Hiding Arm */ | ||
| 292 | #define PCI_CHSWP_EIM 0x02 /* ENUM# Signal Mask */ | ||
| 293 | #define PCI_CHSWP_PIE 0x04 /* Pending Insert or Extract */ | ||
| 294 | #define PCI_CHSWP_LOO 0x08 /* LED On / Off */ | ||
| 295 | #define PCI_CHSWP_PI 0x30 /* Programming Interface */ | ||
| 296 | #define PCI_CHSWP_EXT 0x40 /* ENUM# status - extraction */ | ||
| 297 | #define PCI_CHSWP_INS 0x80 /* ENUM# status - insertion */ | ||
| 298 | |||
| 299 | /* PCI-X registers */ | ||
| 300 | |||
| 301 | #define PCI_X_CMD 2 /* Modes & Features */ | ||
| 302 | #define PCI_X_CMD_DPERR_E 0x0001 /* Data Parity Error Recovery Enable */ | ||
| 303 | #define PCI_X_CMD_ERO 0x0002 /* Enable Relaxed Ordering */ | ||
| 304 | #define PCI_X_CMD_MAX_READ 0x000c /* Max Memory Read Byte Count */ | ||
| 305 | #define PCI_X_CMD_MAX_SPLIT 0x0070 /* Max Outstanding Split Transactions */ | ||
| 306 | #define PCI_X_CMD_VERSION(x) (((x) >> 12) & 3) /* Version */ | ||
| 307 | #define PCI_X_STATUS 4 /* PCI-X capabilities */ | ||
| 308 | #define PCI_X_STATUS_DEVFN 0x000000ff /* A copy of devfn */ | ||
| 309 | #define PCI_X_STATUS_BUS 0x0000ff00 /* A copy of bus nr */ | ||
| 310 | #define PCI_X_STATUS_64BIT 0x00010000 /* 64-bit device */ | ||
| 311 | #define PCI_X_STATUS_133MHZ 0x00020000 /* 133 MHz capable */ | ||
| 312 | #define PCI_X_STATUS_SPL_DISC 0x00040000 /* Split Completion Discarded */ | ||
| 313 | #define PCI_X_STATUS_UNX_SPL 0x00080000 /* Unexpected Split Completion */ | ||
| 314 | #define PCI_X_STATUS_COMPLEX 0x00100000 /* Device Complexity */ | ||
| 315 | #define PCI_X_STATUS_MAX_READ 0x00600000 /* Designed Max Memory Read Count */ | ||
| 316 | #define PCI_X_STATUS_MAX_SPLIT 0x03800000 /* Designed Max Outstanding Split Transactions */ | ||
| 317 | #define PCI_X_STATUS_MAX_CUM 0x1c000000 /* Designed Max Cumulative Read Size */ | ||
| 318 | #define PCI_X_STATUS_SPL_ERR 0x20000000 /* Rcvd Split Completion Error Msg */ | ||
| 319 | #define PCI_X_STATUS_266MHZ 0x40000000 /* 266 MHz capable */ | ||
| 320 | #define PCI_X_STATUS_533MHZ 0x80000000 /* 533 MHz capable */ | ||
| 321 | |||
| 322 | /* PCI Express capability registers */ | ||
| 323 | |||
| 324 | #define PCI_EXP_FLAGS 2 /* Capabilities register */ | ||
| 325 | #define PCI_EXP_FLAGS_VERS 0x000f /* Capability version */ | ||
| 326 | #define PCI_EXP_FLAGS_TYPE 0x00f0 /* Device/Port type */ | ||
| 327 | #define PCI_EXP_TYPE_ENDPOINT 0x0 /* Express Endpoint */ | ||
| 328 | #define PCI_EXP_TYPE_LEG_END 0x1 /* Legacy Endpoint */ | ||
| 329 | #define PCI_EXP_TYPE_ROOT_PORT 0x4 /* Root Port */ | ||
| 330 | #define PCI_EXP_TYPE_UPSTREAM 0x5 /* Upstream Port */ | ||
| 331 | #define PCI_EXP_TYPE_DOWNSTREAM 0x6 /* Downstream Port */ | ||
| 332 | #define PCI_EXP_TYPE_PCI_BRIDGE 0x7 /* PCI/PCI-X Bridge */ | ||
| 333 | #define PCI_EXP_FLAGS_SLOT 0x0100 /* Slot implemented */ | ||
| 334 | #define PCI_EXP_FLAGS_IRQ 0x3e00 /* Interrupt message number */ | ||
| 335 | #define PCI_EXP_DEVCAP 4 /* Device capabilities */ | ||
| 336 | #define PCI_EXP_DEVCAP_PAYLOAD 0x07 /* Max_Payload_Size */ | ||
| 337 | #define PCI_EXP_DEVCAP_PHANTOM 0x18 /* Phantom functions */ | ||
| 338 | #define PCI_EXP_DEVCAP_EXT_TAG 0x20 /* Extended tags */ | ||
| 339 | #define PCI_EXP_DEVCAP_L0S 0x1c0 /* L0s Acceptable Latency */ | ||
| 340 | #define PCI_EXP_DEVCAP_L1 0xe00 /* L1 Acceptable Latency */ | ||
| 341 | #define PCI_EXP_DEVCAP_ATN_BUT 0x1000 /* Attention Button Present */ | ||
| 342 | #define PCI_EXP_DEVCAP_ATN_IND 0x2000 /* Attention Indicator Present */ | ||
| 343 | #define PCI_EXP_DEVCAP_PWR_IND 0x4000 /* Power Indicator Present */ | ||
| 344 | #define PCI_EXP_DEVCAP_PWR_VAL 0x3fc0000 /* Slot Power Limit Value */ | ||
| 345 | #define PCI_EXP_DEVCAP_PWR_SCL 0xc000000 /* Slot Power Limit Scale */ | ||
| 346 | #define PCI_EXP_DEVCTL 8 /* Device Control */ | ||
| 347 | #define PCI_EXP_DEVCTL_CERE 0x0001 /* Correctable Error Reporting En. */ | ||
| 348 | #define PCI_EXP_DEVCTL_NFERE 0x0002 /* Non-Fatal Error Reporting Enable */ | ||
| 349 | #define PCI_EXP_DEVCTL_FERE 0x0004 /* Fatal Error Reporting Enable */ | ||
| 350 | #define PCI_EXP_DEVCTL_URRE 0x0008 /* Unsupported Request Reporting En. */ | ||
| 351 | #define PCI_EXP_DEVCTL_RELAX_EN 0x0010 /* Enable relaxed ordering */ | ||
| 352 | #define PCI_EXP_DEVCTL_PAYLOAD 0x00e0 /* Max_Payload_Size */ | ||
| 353 | #define PCI_EXP_DEVCTL_EXT_TAG 0x0100 /* Extended Tag Field Enable */ | ||
| 354 | #define PCI_EXP_DEVCTL_PHANTOM 0x0200 /* Phantom Functions Enable */ | ||
| 355 | #define PCI_EXP_DEVCTL_AUX_PME 0x0400 /* Auxiliary Power PM Enable */ | ||
| 356 | #define PCI_EXP_DEVCTL_NOSNOOP_EN 0x0800 /* Enable No Snoop */ | ||
| 357 | #define PCI_EXP_DEVCTL_READRQ 0x7000 /* Max_Read_Request_Size */ | ||
| 358 | #define PCI_EXP_DEVSTA 10 /* Device Status */ | ||
| 359 | #define PCI_EXP_DEVSTA_CED 0x01 /* Correctable Error Detected */ | ||
| 360 | #define PCI_EXP_DEVSTA_NFED 0x02 /* Non-Fatal Error Detected */ | ||
| 361 | #define PCI_EXP_DEVSTA_FED 0x04 /* Fatal Error Detected */ | ||
| 362 | #define PCI_EXP_DEVSTA_URD 0x08 /* Unsupported Request Detected */ | ||
| 363 | #define PCI_EXP_DEVSTA_AUXPD 0x10 /* AUX Power Detected */ | ||
| 364 | #define PCI_EXP_DEVSTA_TRPND 0x20 /* Transactions Pending */ | ||
| 365 | #define PCI_EXP_LNKCAP 12 /* Link Capabilities */ | ||
| 366 | #define PCI_EXP_LNKCTL 16 /* Link Control */ | ||
| 367 | #define PCI_EXP_LNKSTA 18 /* Link Status */ | ||
| 368 | #define PCI_EXP_SLTCAP 20 /* Slot Capabilities */ | ||
| 369 | #define PCI_EXP_SLTCTL 24 /* Slot Control */ | ||
| 370 | #define PCI_EXP_SLTSTA 26 /* Slot Status */ | ||
| 371 | #define PCI_EXP_RTCTL 28 /* Root Control */ | ||
| 372 | #define PCI_EXP_RTCTL_SECEE 0x01 /* System Error on Correctable Error */ | ||
| 373 | #define PCI_EXP_RTCTL_SENFEE 0x02 /* System Error on Non-Fatal Error */ | ||
| 374 | #define PCI_EXP_RTCTL_SEFEE 0x04 /* System Error on Fatal Error */ | ||
| 375 | #define PCI_EXP_RTCTL_PMEIE 0x08 /* PME Interrupt Enable */ | ||
| 376 | #define PCI_EXP_RTCTL_CRSSVE 0x10 /* CRS Software Visibility Enable */ | ||
| 377 | #define PCI_EXP_RTCAP 30 /* Root Capabilities */ | ||
| 378 | #define PCI_EXP_RTSTA 32 /* Root Status */ | ||
| 379 | |||
| 380 | /* Extended Capabilities (PCI-X 2.0 and Express) */ | ||
| 381 | #define PCI_EXT_CAP_ID(header) (header & 0x0000ffff) | ||
| 382 | #define PCI_EXT_CAP_VER(header) ((header >> 16) & 0xf) | ||
| 383 | #define PCI_EXT_CAP_NEXT(header) ((header >> 20) & 0xffc) | ||
| 384 | |||
| 385 | #define PCI_EXT_CAP_ID_ERR 1 | ||
| 386 | #define PCI_EXT_CAP_ID_VC 2 | ||
| 387 | #define PCI_EXT_CAP_ID_DSN 3 | ||
| 388 | #define PCI_EXT_CAP_ID_PWR 4 | ||
| 389 | |||
| 390 | /* Advanced Error Reporting */ | ||
| 391 | #define PCI_ERR_UNCOR_STATUS 4 /* Uncorrectable Error Status */ | ||
| 392 | #define PCI_ERR_UNC_TRAIN 0x00000001 /* Training */ | ||
| 393 | #define PCI_ERR_UNC_DLP 0x00000010 /* Data Link Protocol */ | ||
| 394 | #define PCI_ERR_UNC_POISON_TLP 0x00001000 /* Poisoned TLP */ | ||
| 395 | #define PCI_ERR_UNC_FCP 0x00002000 /* Flow Control Protocol */ | ||
| 396 | #define PCI_ERR_UNC_COMP_TIME 0x00004000 /* Completion Timeout */ | ||
| 397 | #define PCI_ERR_UNC_COMP_ABORT 0x00008000 /* Completer Abort */ | ||
| 398 | #define PCI_ERR_UNC_UNX_COMP 0x00010000 /* Unexpected Completion */ | ||
| 399 | #define PCI_ERR_UNC_RX_OVER 0x00020000 /* Receiver Overflow */ | ||
| 400 | #define PCI_ERR_UNC_MALF_TLP 0x00040000 /* Malformed TLP */ | ||
| 401 | #define PCI_ERR_UNC_ECRC 0x00080000 /* ECRC Error Status */ | ||
| 402 | #define PCI_ERR_UNC_UNSUP 0x00100000 /* Unsupported Request */ | ||
| 403 | #define PCI_ERR_UNCOR_MASK 8 /* Uncorrectable Error Mask */ | ||
| 404 | /* Same bits as above */ | ||
| 405 | #define PCI_ERR_UNCOR_SEVER 12 /* Uncorrectable Error Severity */ | ||
| 406 | /* Same bits as above */ | ||
| 407 | #define PCI_ERR_COR_STATUS 16 /* Correctable Error Status */ | ||
| 408 | #define PCI_ERR_COR_RCVR 0x00000001 /* Receiver Error Status */ | ||
| 409 | #define PCI_ERR_COR_BAD_TLP 0x00000040 /* Bad TLP Status */ | ||
| 410 | #define PCI_ERR_COR_BAD_DLLP 0x00000080 /* Bad DLLP Status */ | ||
| 411 | #define PCI_ERR_COR_REP_ROLL 0x00000100 /* REPLAY_NUM Rollover */ | ||
| 412 | #define PCI_ERR_COR_REP_TIMER 0x00001000 /* Replay Timer Timeout */ | ||
| 413 | #define PCI_ERR_COR_MASK 20 /* Correctable Error Mask */ | ||
| 414 | /* Same bits as above */ | ||
| 415 | #define PCI_ERR_CAP 24 /* Advanced Error Capabilities */ | ||
| 416 | #define PCI_ERR_CAP_FEP(x) ((x) & 31) /* First Error Pointer */ | ||
| 417 | #define PCI_ERR_CAP_ECRC_GENC 0x00000020 /* ECRC Generation Capable */ | ||
| 418 | #define PCI_ERR_CAP_ECRC_GENE 0x00000040 /* ECRC Generation Enable */ | ||
| 419 | #define PCI_ERR_CAP_ECRC_CHKC 0x00000080 /* ECRC Check Capable */ | ||
| 420 | #define PCI_ERR_CAP_ECRC_CHKE 0x00000100 /* ECRC Check Enable */ | ||
| 421 | #define PCI_ERR_HEADER_LOG 28 /* Header Log Register (16 bytes) */ | ||
| 422 | #define PCI_ERR_ROOT_COMMAND 44 /* Root Error Command */ | ||
| 423 | #define PCI_ERR_ROOT_STATUS 48 | ||
| 424 | #define PCI_ERR_ROOT_COR_SRC 52 | ||
| 425 | #define PCI_ERR_ROOT_SRC 54 | ||
| 426 | |||
| 427 | /* Virtual Channel */ | ||
| 428 | #define PCI_VC_PORT_REG1 4 | ||
| 429 | #define PCI_VC_PORT_REG2 8 | ||
| 430 | #define PCI_VC_PORT_CTRL 12 | ||
| 431 | #define PCI_VC_PORT_STATUS 14 | ||
| 432 | #define PCI_VC_RES_CAP 16 | ||
| 433 | #define PCI_VC_RES_CTRL 20 | ||
| 434 | #define PCI_VC_RES_STATUS 26 | ||
| 435 | |||
| 436 | /* Power Budgeting */ | ||
| 437 | #define PCI_PWR_DSR 4 /* Data Select Register */ | ||
| 438 | #define PCI_PWR_DATA 8 /* Data Register */ | ||
| 439 | #define PCI_PWR_DATA_BASE(x) ((x) & 0xff) /* Base Power */ | ||
| 440 | #define PCI_PWR_DATA_SCALE(x) (((x) >> 8) & 3) /* Data Scale */ | ||
| 441 | #define PCI_PWR_DATA_PM_SUB(x) (((x) >> 10) & 7) /* PM Sub State */ | ||
| 442 | #define PCI_PWR_DATA_PM_STATE(x) (((x) >> 13) & 3) /* PM State */ | ||
| 443 | #define PCI_PWR_DATA_TYPE(x) (((x) >> 15) & 7) /* Type */ | ||
| 444 | #define PCI_PWR_DATA_RAIL(x) (((x) >> 18) & 7) /* Power Rail */ | ||
| 445 | #define PCI_PWR_CAP 12 /* Capability */ | ||
| 446 | #define PCI_PWR_CAP_BUDGET(x) ((x) & 1) /* Included in system budget */ | ||
| 447 | |||
| 448 | #endif /* LINUX_PCI_REGS_H */ | ||
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h index 8081a281fa5e..9c51917b1cce 100644 --- a/include/linux/radix-tree.h +++ b/include/linux/radix-tree.h | |||
| @@ -24,7 +24,7 @@ | |||
| 24 | 24 | ||
| 25 | struct radix_tree_root { | 25 | struct radix_tree_root { |
| 26 | unsigned int height; | 26 | unsigned int height; |
| 27 | int gfp_mask; | 27 | unsigned int gfp_mask; |
| 28 | struct radix_tree_node *rnode; | 28 | struct radix_tree_node *rnode; |
| 29 | }; | 29 | }; |
| 30 | 30 | ||
| @@ -50,7 +50,7 @@ void *radix_tree_delete(struct radix_tree_root *, unsigned long); | |||
| 50 | unsigned int | 50 | unsigned int |
| 51 | radix_tree_gang_lookup(struct radix_tree_root *root, void **results, | 51 | radix_tree_gang_lookup(struct radix_tree_root *root, void **results, |
| 52 | unsigned long first_index, unsigned int max_items); | 52 | unsigned long first_index, unsigned int max_items); |
| 53 | int radix_tree_preload(int gfp_mask); | 53 | int radix_tree_preload(unsigned int __nocast gfp_mask); |
| 54 | void radix_tree_init(void); | 54 | void radix_tree_init(void); |
| 55 | void *radix_tree_tag_set(struct radix_tree_root *root, | 55 | void *radix_tree_tag_set(struct radix_tree_root *root, |
| 56 | unsigned long index, int tag); | 56 | unsigned long index, int tag); |
diff --git a/include/linux/raid/bitmap.h b/include/linux/raid/bitmap.h index 4bf1659f8aa8..9de99198caf1 100644 --- a/include/linux/raid/bitmap.h +++ b/include/linux/raid/bitmap.h | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | #define BITMAP_H 1 | 7 | #define BITMAP_H 1 |
| 8 | 8 | ||
| 9 | #define BITMAP_MAJOR 3 | 9 | #define BITMAP_MAJOR 3 |
| 10 | #define BITMAP_MINOR 38 | 10 | #define BITMAP_MINOR 39 |
| 11 | 11 | ||
| 12 | /* | 12 | /* |
| 13 | * in-memory bitmap: | 13 | * in-memory bitmap: |
| @@ -147,8 +147,9 @@ typedef struct bitmap_super_s { | |||
| 147 | __u32 state; /* 48 bitmap state information */ | 147 | __u32 state; /* 48 bitmap state information */ |
| 148 | __u32 chunksize; /* 52 the bitmap chunk size in bytes */ | 148 | __u32 chunksize; /* 52 the bitmap chunk size in bytes */ |
| 149 | __u32 daemon_sleep; /* 56 seconds between disk flushes */ | 149 | __u32 daemon_sleep; /* 56 seconds between disk flushes */ |
| 150 | __u32 write_behind; /* 60 number of outstanding write-behind writes */ | ||
| 150 | 151 | ||
| 151 | __u8 pad[256 - 60]; /* set to zero */ | 152 | __u8 pad[256 - 64]; /* set to zero */ |
| 152 | } bitmap_super_t; | 153 | } bitmap_super_t; |
| 153 | 154 | ||
| 154 | /* notes: | 155 | /* notes: |
| @@ -226,6 +227,9 @@ struct bitmap { | |||
| 226 | 227 | ||
| 227 | unsigned long flags; | 228 | unsigned long flags; |
| 228 | 229 | ||
| 230 | unsigned long max_write_behind; /* write-behind mode */ | ||
| 231 | atomic_t behind_writes; | ||
| 232 | |||
| 229 | /* | 233 | /* |
| 230 | * the bitmap daemon - periodically wakes up and sweeps the bitmap | 234 | * the bitmap daemon - periodically wakes up and sweeps the bitmap |
| 231 | * file, cleaning up bits and flushing out pages to disk as necessary | 235 | * file, cleaning up bits and flushing out pages to disk as necessary |
| @@ -260,9 +264,10 @@ int bitmap_setallbits(struct bitmap *bitmap); | |||
| 260 | void bitmap_write_all(struct bitmap *bitmap); | 264 | void bitmap_write_all(struct bitmap *bitmap); |
| 261 | 265 | ||
| 262 | /* these are exported */ | 266 | /* these are exported */ |
| 263 | int bitmap_startwrite(struct bitmap *bitmap, sector_t offset, unsigned long sectors); | 267 | int bitmap_startwrite(struct bitmap *bitmap, sector_t offset, |
| 264 | void bitmap_endwrite(struct bitmap *bitmap, sector_t offset, unsigned long sectors, | 268 | unsigned long sectors, int behind); |
| 265 | int success); | 269 | void bitmap_endwrite(struct bitmap *bitmap, sector_t offset, |
| 270 | unsigned long sectors, int success, int behind); | ||
| 266 | int bitmap_start_sync(struct bitmap *bitmap, sector_t offset, int *blocks, int degraded); | 271 | int bitmap_start_sync(struct bitmap *bitmap, sector_t offset, int *blocks, int degraded); |
| 267 | void bitmap_end_sync(struct bitmap *bitmap, sector_t offset, int *blocks, int aborted); | 272 | void bitmap_end_sync(struct bitmap *bitmap, sector_t offset, int *blocks, int aborted); |
| 268 | void bitmap_close_sync(struct bitmap *bitmap); | 273 | void bitmap_close_sync(struct bitmap *bitmap); |
diff --git a/include/linux/raid/linear.h b/include/linux/raid/linear.h index e04c4fe45b53..7eaf290e10e7 100644 --- a/include/linux/raid/linear.h +++ b/include/linux/raid/linear.h | |||
| @@ -14,8 +14,8 @@ typedef struct dev_info dev_info_t; | |||
| 14 | struct linear_private_data | 14 | struct linear_private_data |
| 15 | { | 15 | { |
| 16 | dev_info_t **hash_table; | 16 | dev_info_t **hash_table; |
| 17 | dev_info_t *smallest; | 17 | sector_t hash_spacing; |
| 18 | int nr_zones; | 18 | int preshift; /* shift before dividing by hash_spacing */ |
| 19 | dev_info_t disks[0]; | 19 | dev_info_t disks[0]; |
| 20 | }; | 20 | }; |
| 21 | 21 | ||
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h index 8c14ba565a45..ebce949b1443 100644 --- a/include/linux/raid/md_k.h +++ b/include/linux/raid/md_k.h | |||
| @@ -86,70 +86,6 @@ typedef struct mdk_rdev_s mdk_rdev_t; | |||
| 86 | #define MAX_CHUNK_SIZE (4096*1024) | 86 | #define MAX_CHUNK_SIZE (4096*1024) |
| 87 | 87 | ||
| 88 | /* | 88 | /* |
| 89 | * default readahead | ||
| 90 | */ | ||
| 91 | |||
| 92 | static inline int disk_faulty(mdp_disk_t * d) | ||
| 93 | { | ||
| 94 | return d->state & (1 << MD_DISK_FAULTY); | ||
| 95 | } | ||
| 96 | |||
| 97 | static inline int disk_active(mdp_disk_t * d) | ||
| 98 | { | ||
| 99 | return d->state & (1 << MD_DISK_ACTIVE); | ||
| 100 | } | ||
| 101 | |||
| 102 | static inline int disk_sync(mdp_disk_t * d) | ||
| 103 | { | ||
| 104 | return d->state & (1 << MD_DISK_SYNC); | ||
| 105 | } | ||
| 106 | |||
| 107 | static inline int disk_spare(mdp_disk_t * d) | ||
| 108 | { | ||
| 109 | return !disk_sync(d) && !disk_active(d) && !disk_faulty(d); | ||
| 110 | } | ||
| 111 | |||
| 112 | static inline int disk_removed(mdp_disk_t * d) | ||
| 113 | { | ||
| 114 | return d->state & (1 << MD_DISK_REMOVED); | ||
| 115 | } | ||
| 116 | |||
| 117 | static inline void mark_disk_faulty(mdp_disk_t * d) | ||
| 118 | { | ||
| 119 | d->state |= (1 << MD_DISK_FAULTY); | ||
| 120 | } | ||
| 121 | |||
| 122 | static inline void mark_disk_active(mdp_disk_t * d) | ||
| 123 | { | ||
| 124 | d->state |= (1 << MD_DISK_ACTIVE); | ||
| 125 | } | ||
| 126 | |||
| 127 | static inline void mark_disk_sync(mdp_disk_t * d) | ||
| 128 | { | ||
| 129 | d->state |= (1 << MD_DISK_SYNC); | ||
| 130 | } | ||
| 131 | |||
| 132 | static inline void mark_disk_spare(mdp_disk_t * d) | ||
| 133 | { | ||
| 134 | d->state = 0; | ||
| 135 | } | ||
| 136 | |||
| 137 | static inline void mark_disk_removed(mdp_disk_t * d) | ||
| 138 | { | ||
| 139 | d->state = (1 << MD_DISK_FAULTY) | (1 << MD_DISK_REMOVED); | ||
| 140 | } | ||
| 141 | |||
| 142 | static inline void mark_disk_inactive(mdp_disk_t * d) | ||
| 143 | { | ||
| 144 | d->state &= ~(1 << MD_DISK_ACTIVE); | ||
| 145 | } | ||
| 146 | |||
| 147 | static inline void mark_disk_nonsync(mdp_disk_t * d) | ||
| 148 | { | ||
| 149 | d->state &= ~(1 << MD_DISK_SYNC); | ||
| 150 | } | ||
| 151 | |||
| 152 | /* | ||
| 153 | * MD's 'extended' device | 89 | * MD's 'extended' device |
| 154 | */ | 90 | */ |
| 155 | struct mdk_rdev_s | 91 | struct mdk_rdev_s |
| @@ -166,6 +102,7 @@ struct mdk_rdev_s | |||
| 166 | int sb_loaded; | 102 | int sb_loaded; |
| 167 | sector_t data_offset; /* start of data in array */ | 103 | sector_t data_offset; /* start of data in array */ |
| 168 | sector_t sb_offset; | 104 | sector_t sb_offset; |
| 105 | int sb_size; /* bytes in the superblock */ | ||
| 169 | int preferred_minor; /* autorun support */ | 106 | int preferred_minor; /* autorun support */ |
| 170 | 107 | ||
| 171 | /* A device can be in one of three states based on two flags: | 108 | /* A device can be in one of three states based on two flags: |
| @@ -181,6 +118,9 @@ struct mdk_rdev_s | |||
| 181 | int faulty; /* if faulty do not issue IO requests */ | 118 | int faulty; /* if faulty do not issue IO requests */ |
| 182 | int in_sync; /* device is a full member of the array */ | 119 | int in_sync; /* device is a full member of the array */ |
| 183 | 120 | ||
| 121 | unsigned long flags; /* Should include faulty and in_sync here. */ | ||
| 122 | #define WriteMostly 4 /* Avoid reading if at all possible */ | ||
| 123 | |||
| 184 | int desc_nr; /* descriptor index in the superblock */ | 124 | int desc_nr; /* descriptor index in the superblock */ |
| 185 | int raid_disk; /* role of device in array */ | 125 | int raid_disk; /* role of device in array */ |
| 186 | int saved_raid_disk; /* role that device used to have in the | 126 | int saved_raid_disk; /* role that device used to have in the |
| @@ -272,12 +212,19 @@ struct mddev_s | |||
| 272 | atomic_t writes_pending; | 212 | atomic_t writes_pending; |
| 273 | request_queue_t *queue; /* for plugging ... */ | 213 | request_queue_t *queue; /* for plugging ... */ |
| 274 | 214 | ||
| 215 | atomic_t write_behind; /* outstanding async IO */ | ||
| 216 | unsigned int max_write_behind; /* 0 = sync */ | ||
| 217 | |||
| 275 | struct bitmap *bitmap; /* the bitmap for the device */ | 218 | struct bitmap *bitmap; /* the bitmap for the device */ |
| 276 | struct file *bitmap_file; /* the bitmap file */ | 219 | struct file *bitmap_file; /* the bitmap file */ |
| 277 | long bitmap_offset; /* offset from superblock of | 220 | long bitmap_offset; /* offset from superblock of |
| 278 | * start of bitmap. May be | 221 | * start of bitmap. May be |
| 279 | * negative, but not '0' | 222 | * negative, but not '0' |
| 280 | */ | 223 | */ |
| 224 | long default_bitmap_offset; /* this is the offset to use when | ||
| 225 | * hot-adding a bitmap. It should | ||
| 226 | * eventually be settable by sysfs. | ||
| 227 | */ | ||
| 281 | 228 | ||
| 282 | struct list_head all_mddevs; | 229 | struct list_head all_mddevs; |
| 283 | }; | 230 | }; |
| @@ -314,6 +261,12 @@ struct mdk_personality_s | |||
| 314 | int (*resize) (mddev_t *mddev, sector_t sectors); | 261 | int (*resize) (mddev_t *mddev, sector_t sectors); |
| 315 | int (*reshape) (mddev_t *mddev, int raid_disks); | 262 | int (*reshape) (mddev_t *mddev, int raid_disks); |
| 316 | int (*reconfig) (mddev_t *mddev, int layout, int chunk_size); | 263 | int (*reconfig) (mddev_t *mddev, int layout, int chunk_size); |
| 264 | /* quiesce moves between quiescence states | ||
| 265 | * 0 - fully active | ||
| 266 | * 1 - no new requests allowed | ||
| 267 | * others - reserved | ||
| 268 | */ | ||
| 269 | void (*quiesce) (mddev_t *mddev, int state); | ||
| 317 | }; | 270 | }; |
| 318 | 271 | ||
| 319 | 272 | ||
diff --git a/include/linux/raid/md_p.h b/include/linux/raid/md_p.h index dc65cd435494..c100fa5d4bfa 100644 --- a/include/linux/raid/md_p.h +++ b/include/linux/raid/md_p.h | |||
| @@ -79,6 +79,11 @@ | |||
| 79 | #define MD_DISK_SYNC 2 /* disk is in sync with the raid set */ | 79 | #define MD_DISK_SYNC 2 /* disk is in sync with the raid set */ |
| 80 | #define MD_DISK_REMOVED 3 /* disk is in sync with the raid set */ | 80 | #define MD_DISK_REMOVED 3 /* disk is in sync with the raid set */ |
| 81 | 81 | ||
| 82 | #define MD_DISK_WRITEMOSTLY 9 /* disk is "write-mostly" is RAID1 config. | ||
| 83 | * read requests will only be sent here in | ||
| 84 | * dire need | ||
| 85 | */ | ||
| 86 | |||
| 82 | typedef struct mdp_device_descriptor_s { | 87 | typedef struct mdp_device_descriptor_s { |
| 83 | __u32 number; /* 0 Device number in the entire set */ | 88 | __u32 number; /* 0 Device number in the entire set */ |
| 84 | __u32 major; /* 1 Device major number */ | 89 | __u32 major; /* 1 Device major number */ |
| @@ -193,7 +198,7 @@ struct mdp_superblock_1 { | |||
| 193 | 198 | ||
| 194 | __u64 ctime; /* lo 40 bits are seconds, top 24 are microseconds or 0*/ | 199 | __u64 ctime; /* lo 40 bits are seconds, top 24 are microseconds or 0*/ |
| 195 | __u32 level; /* -4 (multipath), -1 (linear), 0,1,4,5 */ | 200 | __u32 level; /* -4 (multipath), -1 (linear), 0,1,4,5 */ |
| 196 | __u32 layout; /* only for raid5 currently */ | 201 | __u32 layout; /* only for raid5 and raid10 currently */ |
| 197 | __u64 size; /* used size of component devices, in 512byte sectors */ | 202 | __u64 size; /* used size of component devices, in 512byte sectors */ |
| 198 | 203 | ||
| 199 | __u32 chunksize; /* in 512byte sectors */ | 204 | __u32 chunksize; /* in 512byte sectors */ |
| @@ -212,7 +217,9 @@ struct mdp_superblock_1 { | |||
| 212 | __u32 dev_number; /* permanent identifier of this device - not role in raid */ | 217 | __u32 dev_number; /* permanent identifier of this device - not role in raid */ |
| 213 | __u32 cnt_corrected_read; /* number of read errors that were corrected by re-writing */ | 218 | __u32 cnt_corrected_read; /* number of read errors that were corrected by re-writing */ |
| 214 | __u8 device_uuid[16]; /* user-space setable, ignored by kernel */ | 219 | __u8 device_uuid[16]; /* user-space setable, ignored by kernel */ |
| 215 | __u8 pad2[64-56]; /* set to 0 when writing */ | 220 | __u8 devflags; /* per-device flags. Only one defined...*/ |
| 221 | #define WriteMostly1 1 /* mask for writemostly flag in above */ | ||
| 222 | __u8 pad2[64-57]; /* set to 0 when writing */ | ||
| 216 | 223 | ||
| 217 | /* array state information - 64 bytes */ | 224 | /* array state information - 64 bytes */ |
| 218 | __u64 utime; /* 40 bits second, 24 btes microseconds */ | 225 | __u64 utime; /* 40 bits second, 24 btes microseconds */ |
| @@ -231,5 +238,10 @@ struct mdp_superblock_1 { | |||
| 231 | __u16 dev_roles[0]; /* role in array, or 0xffff for a spare, or 0xfffe for faulty */ | 238 | __u16 dev_roles[0]; /* role in array, or 0xffff for a spare, or 0xfffe for faulty */ |
| 232 | }; | 239 | }; |
| 233 | 240 | ||
| 241 | /* feature_map bits */ | ||
| 242 | #define MD_FEATURE_BITMAP_OFFSET 1 | ||
| 243 | |||
| 244 | #define MD_FEATURE_ALL 1 | ||
| 245 | |||
| 234 | #endif | 246 | #endif |
| 235 | 247 | ||
diff --git a/include/linux/raid/raid1.h b/include/linux/raid/raid1.h index 9d93cf12e890..60e19b667548 100644 --- a/include/linux/raid/raid1.h +++ b/include/linux/raid/raid1.h | |||
| @@ -80,6 +80,9 @@ struct r1bio_s { | |||
| 80 | atomic_t remaining; /* 'have we finished' count, | 80 | atomic_t remaining; /* 'have we finished' count, |
| 81 | * used from IRQ handlers | 81 | * used from IRQ handlers |
| 82 | */ | 82 | */ |
| 83 | atomic_t behind_remaining; /* number of write-behind ios remaining | ||
| 84 | * in this BehindIO request | ||
| 85 | */ | ||
| 83 | sector_t sector; | 86 | sector_t sector; |
| 84 | int sectors; | 87 | int sectors; |
| 85 | unsigned long state; | 88 | unsigned long state; |
| @@ -107,4 +110,14 @@ struct r1bio_s { | |||
| 107 | #define R1BIO_Uptodate 0 | 110 | #define R1BIO_Uptodate 0 |
| 108 | #define R1BIO_IsSync 1 | 111 | #define R1BIO_IsSync 1 |
| 109 | #define R1BIO_Degraded 2 | 112 | #define R1BIO_Degraded 2 |
| 113 | #define R1BIO_BehindIO 3 | ||
| 114 | /* For write-behind requests, we call bi_end_io when | ||
| 115 | * the last non-write-behind device completes, providing | ||
| 116 | * any write was successful. Otherwise we call when | ||
| 117 | * any write-behind write succeeds, otherwise we call | ||
| 118 | * with failure when last write completes (and all failed). | ||
| 119 | * Record that bi_end_io was called with this flag... | ||
| 120 | */ | ||
| 121 | #define R1BIO_Returned 4 | ||
| 122 | |||
| 110 | #endif | 123 | #endif |
diff --git a/include/linux/raid/raid5.h b/include/linux/raid/raid5.h index d63ddcb4afad..176fc653c284 100644 --- a/include/linux/raid/raid5.h +++ b/include/linux/raid/raid5.h | |||
| @@ -134,6 +134,7 @@ struct stripe_head { | |||
| 134 | unsigned long state; /* state flags */ | 134 | unsigned long state; /* state flags */ |
| 135 | atomic_t count; /* nr of active thread/requests */ | 135 | atomic_t count; /* nr of active thread/requests */ |
| 136 | spinlock_t lock; | 136 | spinlock_t lock; |
| 137 | int bm_seq; /* sequence number for bitmap flushes */ | ||
| 137 | struct r5dev { | 138 | struct r5dev { |
| 138 | struct bio req; | 139 | struct bio req; |
| 139 | struct bio_vec vec; | 140 | struct bio_vec vec; |
| @@ -165,12 +166,13 @@ struct stripe_head { | |||
| 165 | /* | 166 | /* |
| 166 | * Stripe state | 167 | * Stripe state |
| 167 | */ | 168 | */ |
| 168 | #define STRIPE_ERROR 1 | ||
| 169 | #define STRIPE_HANDLE 2 | 169 | #define STRIPE_HANDLE 2 |
| 170 | #define STRIPE_SYNCING 3 | 170 | #define STRIPE_SYNCING 3 |
| 171 | #define STRIPE_INSYNC 4 | 171 | #define STRIPE_INSYNC 4 |
| 172 | #define STRIPE_PREREAD_ACTIVE 5 | 172 | #define STRIPE_PREREAD_ACTIVE 5 |
| 173 | #define STRIPE_DELAYED 6 | 173 | #define STRIPE_DELAYED 6 |
| 174 | #define STRIPE_DEGRADED 7 | ||
| 175 | #define STRIPE_BIT_DELAY 8 | ||
| 174 | 176 | ||
| 175 | /* | 177 | /* |
| 176 | * Plugging: | 178 | * Plugging: |
| @@ -210,10 +212,20 @@ struct raid5_private_data { | |||
| 210 | 212 | ||
| 211 | struct list_head handle_list; /* stripes needing handling */ | 213 | struct list_head handle_list; /* stripes needing handling */ |
| 212 | struct list_head delayed_list; /* stripes that have plugged requests */ | 214 | struct list_head delayed_list; /* stripes that have plugged requests */ |
| 215 | struct list_head bitmap_list; /* stripes delaying awaiting bitmap update */ | ||
| 213 | atomic_t preread_active_stripes; /* stripes with scheduled io */ | 216 | atomic_t preread_active_stripes; /* stripes with scheduled io */ |
| 214 | 217 | ||
| 215 | char cache_name[20]; | 218 | char cache_name[20]; |
| 216 | kmem_cache_t *slab_cache; /* for allocating stripes */ | 219 | kmem_cache_t *slab_cache; /* for allocating stripes */ |
| 220 | |||
| 221 | int seq_flush, seq_write; | ||
| 222 | int quiesce; | ||
| 223 | |||
| 224 | int fullsync; /* set to 1 if a full sync is needed, | ||
| 225 | * (fresh device added). | ||
| 226 | * Cleared when a sync completes. | ||
| 227 | */ | ||
| 228 | |||
| 217 | /* | 229 | /* |
| 218 | * Free stripes pool | 230 | * Free stripes pool |
| 219 | */ | 231 | */ |
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index fd276adf0fd5..4e65eb44adfd 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h | |||
| @@ -52,8 +52,8 @@ struct rcu_head { | |||
| 52 | void (*func)(struct rcu_head *head); | 52 | void (*func)(struct rcu_head *head); |
| 53 | }; | 53 | }; |
| 54 | 54 | ||
| 55 | #define RCU_HEAD_INIT(head) { .next = NULL, .func = NULL } | 55 | #define RCU_HEAD_INIT { .next = NULL, .func = NULL } |
| 56 | #define RCU_HEAD(head) struct rcu_head head = RCU_HEAD_INIT(head) | 56 | #define RCU_HEAD(head) struct rcu_head head = RCU_HEAD_INIT |
| 57 | #define INIT_RCU_HEAD(ptr) do { \ | 57 | #define INIT_RCU_HEAD(ptr) do { \ |
| 58 | (ptr)->next = NULL; (ptr)->func = NULL; \ | 58 | (ptr)->next = NULL; (ptr)->func = NULL; \ |
| 59 | } while (0) | 59 | } while (0) |
diff --git a/include/linux/rcuref.h b/include/linux/rcuref.h new file mode 100644 index 000000000000..e1adbba14b67 --- /dev/null +++ b/include/linux/rcuref.h | |||
| @@ -0,0 +1,220 @@ | |||
| 1 | /* | ||
| 2 | * rcuref.h | ||
| 3 | * | ||
| 4 | * Reference counting for elements of lists/arrays protected by | ||
| 5 | * RCU. | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License as published by | ||
| 9 | * the Free Software Foundation; either version 2 of the License, or | ||
| 10 | * (at your option) any later version. | ||
| 11 | * | ||
| 12 | * This program is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | * GNU General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License | ||
| 18 | * along with this program; if not, write to the Free Software | ||
| 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
| 20 | * | ||
| 21 | * Copyright (C) IBM Corporation, 2005 | ||
| 22 | * | ||
| 23 | * Author: Dipankar Sarma <dipankar@in.ibm.com> | ||
| 24 | * Ravikiran Thirumalai <kiran_th@gmail.com> | ||
| 25 | * | ||
| 26 | * See Documentation/RCU/rcuref.txt for detailed user guide. | ||
| 27 | * | ||
| 28 | */ | ||
| 29 | |||
| 30 | #ifndef _RCUREF_H_ | ||
| 31 | #define _RCUREF_H_ | ||
| 32 | |||
| 33 | #ifdef __KERNEL__ | ||
| 34 | |||
| 35 | #include <linux/types.h> | ||
| 36 | #include <linux/interrupt.h> | ||
| 37 | #include <linux/spinlock.h> | ||
| 38 | #include <asm/atomic.h> | ||
| 39 | |||
| 40 | /* | ||
| 41 | * These APIs work on traditional atomic_t counters used in the | ||
| 42 | * kernel for reference counting. Under special circumstances | ||
| 43 | * where a lock-free get() operation races with a put() operation | ||
| 44 | * these APIs can be used. See Documentation/RCU/rcuref.txt. | ||
| 45 | */ | ||
| 46 | |||
| 47 | #ifdef __HAVE_ARCH_CMPXCHG | ||
| 48 | |||
| 49 | /** | ||
| 50 | * rcuref_inc - increment refcount for object. | ||
| 51 | * @rcuref: reference counter in the object in question. | ||
| 52 | * | ||
| 53 | * This should be used only for objects where we use RCU and | ||
| 54 | * use the rcuref_inc_lf() api to acquire a reference | ||
| 55 | * in a lock-free reader-side critical section. | ||
| 56 | */ | ||
| 57 | static inline void rcuref_inc(atomic_t *rcuref) | ||
| 58 | { | ||
| 59 | atomic_inc(rcuref); | ||
| 60 | } | ||
| 61 | |||
| 62 | /** | ||
| 63 | * rcuref_dec - decrement refcount for object. | ||
| 64 | * @rcuref: reference counter in the object in question. | ||
| 65 | * | ||
| 66 | * This should be used only for objects where we use RCU and | ||
| 67 | * use the rcuref_inc_lf() api to acquire a reference | ||
| 68 | * in a lock-free reader-side critical section. | ||
| 69 | */ | ||
| 70 | static inline void rcuref_dec(atomic_t *rcuref) | ||
| 71 | { | ||
| 72 | atomic_dec(rcuref); | ||
| 73 | } | ||
| 74 | |||
| 75 | /** | ||
| 76 | * rcuref_dec_and_test - decrement refcount for object and test | ||
| 77 | * @rcuref: reference counter in the object. | ||
| 78 | * @release: pointer to the function that will clean up the object | ||
| 79 | * when the last reference to the object is released. | ||
| 80 | * This pointer is required. | ||
| 81 | * | ||
| 82 | * Decrement the refcount, and if 0, return 1. Else return 0. | ||
| 83 | * | ||
| 84 | * This should be used only for objects where we use RCU and | ||
| 85 | * use the rcuref_inc_lf() api to acquire a reference | ||
| 86 | * in a lock-free reader-side critical section. | ||
| 87 | */ | ||
| 88 | static inline int rcuref_dec_and_test(atomic_t *rcuref) | ||
| 89 | { | ||
| 90 | return atomic_dec_and_test(rcuref); | ||
| 91 | } | ||
| 92 | |||
| 93 | /* | ||
| 94 | * cmpxchg is needed on UP too, if deletions to the list/array can happen | ||
| 95 | * in interrupt context. | ||
| 96 | */ | ||
| 97 | |||
| 98 | /** | ||
| 99 | * rcuref_inc_lf - Take reference to an object in a read-side | ||
| 100 | * critical section protected by RCU. | ||
| 101 | * @rcuref: reference counter in the object in question. | ||
| 102 | * | ||
| 103 | * Try and increment the refcount by 1. The increment might fail if | ||
| 104 | * the reference counter has been through a 1 to 0 transition and | ||
| 105 | * is no longer part of the lock-free list. | ||
| 106 | * Returns non-zero on successful increment and zero otherwise. | ||
| 107 | */ | ||
| 108 | static inline int rcuref_inc_lf(atomic_t *rcuref) | ||
| 109 | { | ||
| 110 | int c, old; | ||
| 111 | c = atomic_read(rcuref); | ||
| 112 | while (c && (old = cmpxchg(&rcuref->counter, c, c + 1)) != c) | ||
| 113 | c = old; | ||
| 114 | return c; | ||
| 115 | } | ||
| 116 | |||
| 117 | #else /* !__HAVE_ARCH_CMPXCHG */ | ||
| 118 | |||
| 119 | extern spinlock_t __rcuref_hash[]; | ||
| 120 | |||
| 121 | /* | ||
| 122 | * Use a hash table of locks to protect the reference count | ||
| 123 | * since cmpxchg is not available in this arch. | ||
| 124 | */ | ||
| 125 | #ifdef CONFIG_SMP | ||
| 126 | #define RCUREF_HASH_SIZE 4 | ||
| 127 | #define RCUREF_HASH(k) \ | ||
| 128 | (&__rcuref_hash[(((unsigned long)k)>>8) & (RCUREF_HASH_SIZE-1)]) | ||
| 129 | #else | ||
| 130 | #define RCUREF_HASH_SIZE 1 | ||
| 131 | #define RCUREF_HASH(k) &__rcuref_hash[0] | ||
| 132 | #endif /* CONFIG_SMP */ | ||
| 133 | |||
| 134 | /** | ||
| 135 | * rcuref_inc - increment refcount for object. | ||
| 136 | * @rcuref: reference counter in the object in question. | ||
| 137 | * | ||
| 138 | * This should be used only for objects where we use RCU and | ||
| 139 | * use the rcuref_inc_lf() api to acquire a reference in a lock-free | ||
| 140 | * reader-side critical section. | ||
| 141 | */ | ||
| 142 | static inline void rcuref_inc(atomic_t *rcuref) | ||
| 143 | { | ||
| 144 | unsigned long flags; | ||
| 145 | spin_lock_irqsave(RCUREF_HASH(rcuref), flags); | ||
| 146 | rcuref->counter += 1; | ||
| 147 | spin_unlock_irqrestore(RCUREF_HASH(rcuref), flags); | ||
| 148 | } | ||
| 149 | |||
| 150 | /** | ||
| 151 | * rcuref_dec - decrement refcount for object. | ||
| 152 | * @rcuref: reference counter in the object in question. | ||
| 153 | * | ||
| 154 | * This should be used only for objects where we use RCU and | ||
| 155 | * use the rcuref_inc_lf() api to acquire a reference in a lock-free | ||
| 156 | * reader-side critical section. | ||
| 157 | */ | ||
| 158 | static inline void rcuref_dec(atomic_t *rcuref) | ||
| 159 | { | ||
| 160 | unsigned long flags; | ||
| 161 | spin_lock_irqsave(RCUREF_HASH(rcuref), flags); | ||
| 162 | rcuref->counter -= 1; | ||
| 163 | spin_unlock_irqrestore(RCUREF_HASH(rcuref), flags); | ||
| 164 | } | ||
| 165 | |||
| 166 | /** | ||
| 167 | * rcuref_dec_and_test - decrement refcount for object and test | ||
| 168 | * @rcuref: reference counter in the object. | ||
| 169 | * @release: pointer to the function that will clean up the object | ||
| 170 | * when the last reference to the object is released. | ||
| 171 | * This pointer is required. | ||
| 172 | * | ||
| 173 | * Decrement the refcount, and if 0, return 1. Else return 0. | ||
| 174 | * | ||
| 175 | * This should be used only for objects where we use RCU and | ||
| 176 | * use the rcuref_inc_lf() api to acquire a reference in a lock-free | ||
| 177 | * reader-side critical section. | ||
| 178 | */ | ||
| 179 | static inline int rcuref_dec_and_test(atomic_t *rcuref) | ||
| 180 | { | ||
| 181 | unsigned long flags; | ||
| 182 | spin_lock_irqsave(RCUREF_HASH(rcuref), flags); | ||
| 183 | rcuref->counter--; | ||
| 184 | if (!rcuref->counter) { | ||
| 185 | spin_unlock_irqrestore(RCUREF_HASH(rcuref), flags); | ||
| 186 | return 1; | ||
| 187 | } else { | ||
| 188 | spin_unlock_irqrestore(RCUREF_HASH(rcuref), flags); | ||
| 189 | return 0; | ||
| 190 | } | ||
| 191 | } | ||
| 192 | |||
| 193 | /** | ||
| 194 | * rcuref_inc_lf - Take reference to an object of a lock-free collection | ||
| 195 | * by traversing a lock-free list/array. | ||
| 196 | * @rcuref: reference counter in the object in question. | ||
| 197 | * | ||
| 198 | * Try and increment the refcount by 1. The increment might fail if | ||
| 199 | * the reference counter has been through a 1 to 0 transition and | ||
| 200 | * object is no longer part of the lock-free list. | ||
| 201 | * Returns non-zero on successful increment and zero otherwise. | ||
| 202 | */ | ||
| 203 | static inline int rcuref_inc_lf(atomic_t *rcuref) | ||
| 204 | { | ||
| 205 | int ret; | ||
| 206 | unsigned long flags; | ||
| 207 | spin_lock_irqsave(RCUREF_HASH(rcuref), flags); | ||
| 208 | if (rcuref->counter) | ||
| 209 | ret = rcuref->counter++; | ||
| 210 | else | ||
| 211 | ret = 0; | ||
| 212 | spin_unlock_irqrestore(RCUREF_HASH(rcuref), flags); | ||
| 213 | return ret; | ||
| 214 | } | ||
| 215 | |||
| 216 | |||
| 217 | #endif /* !__HAVE_ARCH_CMPXCHG */ | ||
| 218 | |||
| 219 | #endif /* __KERNEL__ */ | ||
| 220 | #endif /* _RCUREF_H_ */ | ||
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h index 17e458e17e2b..af00b10294cd 100644 --- a/include/linux/reiserfs_fs.h +++ b/include/linux/reiserfs_fs.h | |||
| @@ -2097,7 +2097,7 @@ void reiserfs_free_block(struct reiserfs_transaction_handle *th, struct inode *, | |||
| 2097 | b_blocknr_t, int for_unformatted); | 2097 | b_blocknr_t, int for_unformatted); |
| 2098 | int reiserfs_allocate_blocknrs(reiserfs_blocknr_hint_t *, b_blocknr_t *, int, | 2098 | int reiserfs_allocate_blocknrs(reiserfs_blocknr_hint_t *, b_blocknr_t *, int, |
| 2099 | int); | 2099 | int); |
| 2100 | extern inline int reiserfs_new_form_blocknrs(struct tree_balance *tb, | 2100 | static inline int reiserfs_new_form_blocknrs(struct tree_balance *tb, |
| 2101 | b_blocknr_t * new_blocknrs, | 2101 | b_blocknr_t * new_blocknrs, |
| 2102 | int amount_needed) | 2102 | int amount_needed) |
| 2103 | { | 2103 | { |
| @@ -2113,7 +2113,7 @@ extern inline int reiserfs_new_form_blocknrs(struct tree_balance *tb, | |||
| 2113 | 0); | 2113 | 0); |
| 2114 | } | 2114 | } |
| 2115 | 2115 | ||
| 2116 | extern inline int reiserfs_new_unf_blocknrs(struct reiserfs_transaction_handle | 2116 | static inline int reiserfs_new_unf_blocknrs(struct reiserfs_transaction_handle |
| 2117 | *th, struct inode *inode, | 2117 | *th, struct inode *inode, |
| 2118 | b_blocknr_t * new_blocknrs, | 2118 | b_blocknr_t * new_blocknrs, |
| 2119 | struct path *path, long block) | 2119 | struct path *path, long block) |
| @@ -2130,7 +2130,7 @@ extern inline int reiserfs_new_unf_blocknrs(struct reiserfs_transaction_handle | |||
| 2130 | } | 2130 | } |
| 2131 | 2131 | ||
| 2132 | #ifdef REISERFS_PREALLOCATE | 2132 | #ifdef REISERFS_PREALLOCATE |
| 2133 | extern inline int reiserfs_new_unf_blocknrs2(struct reiserfs_transaction_handle | 2133 | static inline int reiserfs_new_unf_blocknrs2(struct reiserfs_transaction_handle |
| 2134 | *th, struct inode *inode, | 2134 | *th, struct inode *inode, |
| 2135 | b_blocknr_t * new_blocknrs, | 2135 | b_blocknr_t * new_blocknrs, |
| 2136 | struct path *path, long block) | 2136 | struct path *path, long block) |
diff --git a/include/linux/sched.h b/include/linux/sched.h index ea1b5f32ec5c..38c8654aaa96 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
| @@ -114,6 +114,7 @@ extern unsigned long nr_iowait(void); | |||
| 114 | #define TASK_TRACED 8 | 114 | #define TASK_TRACED 8 |
| 115 | #define EXIT_ZOMBIE 16 | 115 | #define EXIT_ZOMBIE 16 |
| 116 | #define EXIT_DEAD 32 | 116 | #define EXIT_DEAD 32 |
| 117 | #define TASK_NONINTERACTIVE 64 | ||
| 117 | 118 | ||
| 118 | #define __set_task_state(tsk, state_value) \ | 119 | #define __set_task_state(tsk, state_value) \ |
| 119 | do { (tsk)->state = (state_value); } while (0) | 120 | do { (tsk)->state = (state_value); } while (0) |
| @@ -202,6 +203,8 @@ extern int in_sched_functions(unsigned long addr); | |||
| 202 | 203 | ||
| 203 | #define MAX_SCHEDULE_TIMEOUT LONG_MAX | 204 | #define MAX_SCHEDULE_TIMEOUT LONG_MAX |
| 204 | extern signed long FASTCALL(schedule_timeout(signed long timeout)); | 205 | extern signed long FASTCALL(schedule_timeout(signed long timeout)); |
| 206 | extern signed long schedule_timeout_interruptible(signed long timeout); | ||
| 207 | extern signed long schedule_timeout_uninterruptible(signed long timeout); | ||
| 205 | asmlinkage void schedule(void); | 208 | asmlinkage void schedule(void); |
| 206 | 209 | ||
| 207 | struct namespace; | 210 | struct namespace; |
| @@ -604,6 +607,11 @@ extern int groups_search(struct group_info *group_info, gid_t grp); | |||
| 604 | #define GROUP_AT(gi, i) \ | 607 | #define GROUP_AT(gi, i) \ |
| 605 | ((gi)->blocks[(i)/NGROUPS_PER_BLOCK][(i)%NGROUPS_PER_BLOCK]) | 608 | ((gi)->blocks[(i)/NGROUPS_PER_BLOCK][(i)%NGROUPS_PER_BLOCK]) |
| 606 | 609 | ||
| 610 | #ifdef ARCH_HAS_PREFETCH_SWITCH_STACK | ||
| 611 | extern void prefetch_stack(struct task_struct*); | ||
| 612 | #else | ||
| 613 | static inline void prefetch_stack(struct task_struct *t) { } | ||
| 614 | #endif | ||
| 607 | 615 | ||
| 608 | struct audit_context; /* See audit.c */ | 616 | struct audit_context; /* See audit.c */ |
| 609 | struct mempolicy; | 617 | struct mempolicy; |
| @@ -895,6 +903,8 @@ extern int task_curr(const task_t *p); | |||
| 895 | extern int idle_cpu(int cpu); | 903 | extern int idle_cpu(int cpu); |
| 896 | extern int sched_setscheduler(struct task_struct *, int, struct sched_param *); | 904 | extern int sched_setscheduler(struct task_struct *, int, struct sched_param *); |
| 897 | extern task_t *idle_task(int cpu); | 905 | extern task_t *idle_task(int cpu); |
| 906 | extern task_t *curr_task(int cpu); | ||
| 907 | extern void set_curr_task(int cpu, task_t *p); | ||
| 898 | 908 | ||
| 899 | void yield(void); | 909 | void yield(void); |
| 900 | 910 | ||
diff --git a/include/linux/security.h b/include/linux/security.h index 7aab6ab7c57f..55b02e1c73f4 100644 --- a/include/linux/security.h +++ b/include/linux/security.h | |||
| @@ -250,29 +250,37 @@ struct swap_info_struct; | |||
| 250 | * @inode contains the inode structure. | 250 | * @inode contains the inode structure. |
| 251 | * Deallocate the inode security structure and set @inode->i_security to | 251 | * Deallocate the inode security structure and set @inode->i_security to |
| 252 | * NULL. | 252 | * NULL. |
| 253 | * @inode_init_security: | ||
| 254 | * Obtain the security attribute name suffix and value to set on a newly | ||
| 255 | * created inode and set up the incore security field for the new inode. | ||
| 256 | * This hook is called by the fs code as part of the inode creation | ||
| 257 | * transaction and provides for atomic labeling of the inode, unlike | ||
| 258 | * the post_create/mkdir/... hooks called by the VFS. The hook function | ||
| 259 | * is expected to allocate the name and value via kmalloc, with the caller | ||
| 260 | * being responsible for calling kfree after using them. | ||
| 261 | * If the security module does not use security attributes or does | ||
| 262 | * not wish to put a security attribute on this particular inode, | ||
| 263 | * then it should return -EOPNOTSUPP to skip this processing. | ||
| 264 | * @inode contains the inode structure of the newly created inode. | ||
| 265 | * @dir contains the inode structure of the parent directory. | ||
| 266 | * @name will be set to the allocated name suffix (e.g. selinux). | ||
| 267 | * @value will be set to the allocated attribute value. | ||
| 268 | * @len will be set to the length of the value. | ||
| 269 | * Returns 0 if @name and @value have been successfully set, | ||
| 270 | * -EOPNOTSUPP if no security attribute is needed, or | ||
| 271 | * -ENOMEM on memory allocation failure. | ||
| 253 | * @inode_create: | 272 | * @inode_create: |
| 254 | * Check permission to create a regular file. | 273 | * Check permission to create a regular file. |
| 255 | * @dir contains inode structure of the parent of the new file. | 274 | * @dir contains inode structure of the parent of the new file. |
| 256 | * @dentry contains the dentry structure for the file to be created. | 275 | * @dentry contains the dentry structure for the file to be created. |
| 257 | * @mode contains the file mode of the file to be created. | 276 | * @mode contains the file mode of the file to be created. |
| 258 | * Return 0 if permission is granted. | 277 | * Return 0 if permission is granted. |
| 259 | * @inode_post_create: | ||
| 260 | * Set the security attributes on a newly created regular file. This hook | ||
| 261 | * is called after a file has been successfully created. | ||
| 262 | * @dir contains the inode structure of the parent directory of the new file. | ||
| 263 | * @dentry contains the the dentry structure for the newly created file. | ||
| 264 | * @mode contains the file mode. | ||
| 265 | * @inode_link: | 278 | * @inode_link: |
| 266 | * Check permission before creating a new hard link to a file. | 279 | * Check permission before creating a new hard link to a file. |
| 267 | * @old_dentry contains the dentry structure for an existing link to the file. | 280 | * @old_dentry contains the dentry structure for an existing link to the file. |
| 268 | * @dir contains the inode structure of the parent directory of the new link. | 281 | * @dir contains the inode structure of the parent directory of the new link. |
| 269 | * @new_dentry contains the dentry structure for the new link. | 282 | * @new_dentry contains the dentry structure for the new link. |
| 270 | * Return 0 if permission is granted. | 283 | * Return 0 if permission is granted. |
| 271 | * @inode_post_link: | ||
| 272 | * Set security attributes for a new hard link to a file. | ||
| 273 | * @old_dentry contains the dentry structure for the existing link. | ||
| 274 | * @dir contains the inode structure of the parent directory of the new file. | ||
| 275 | * @new_dentry contains the dentry structure for the new file link. | ||
| 276 | * @inode_unlink: | 284 | * @inode_unlink: |
| 277 | * Check the permission to remove a hard link to a file. | 285 | * Check the permission to remove a hard link to a file. |
| 278 | * @dir contains the inode structure of parent directory of the file. | 286 | * @dir contains the inode structure of parent directory of the file. |
| @@ -284,13 +292,6 @@ struct swap_info_struct; | |||
| 284 | * @dentry contains the dentry structure of the symbolic link. | 292 | * @dentry contains the dentry structure of the symbolic link. |
| 285 | * @old_name contains the pathname of file. | 293 | * @old_name contains the pathname of file. |
| 286 | * Return 0 if permission is granted. | 294 | * Return 0 if permission is granted. |
| 287 | * @inode_post_symlink: | ||
| 288 | * @dir contains the inode structure of the parent directory of the new link. | ||
| 289 | * @dentry contains the dentry structure of new symbolic link. | ||
| 290 | * @old_name contains the pathname of file. | ||
| 291 | * Set security attributes for a newly created symbolic link. Note that | ||
| 292 | * @dentry->d_inode may be NULL, since the filesystem might not | ||
| 293 | * instantiate the dentry (e.g. NFS). | ||
| 294 | * @inode_mkdir: | 295 | * @inode_mkdir: |
| 295 | * Check permissions to create a new directory in the existing directory | 296 | * Check permissions to create a new directory in the existing directory |
| 296 | * associated with inode strcture @dir. | 297 | * associated with inode strcture @dir. |
| @@ -298,11 +299,6 @@ struct swap_info_struct; | |||
| 298 | * @dentry contains the dentry structure of new directory. | 299 | * @dentry contains the dentry structure of new directory. |
| 299 | * @mode contains the mode of new directory. | 300 | * @mode contains the mode of new directory. |
| 300 | * Return 0 if permission is granted. | 301 | * Return 0 if permission is granted. |
| 301 | * @inode_post_mkdir: | ||
| 302 | * Set security attributes on a newly created directory. | ||
| 303 | * @dir contains the inode structure of parent of the directory to be created. | ||
| 304 | * @dentry contains the dentry structure of new directory. | ||
| 305 | * @mode contains the mode of new directory. | ||
| 306 | * @inode_rmdir: | 302 | * @inode_rmdir: |
| 307 | * Check the permission to remove a directory. | 303 | * Check the permission to remove a directory. |
| 308 | * @dir contains the inode structure of parent of the directory to be removed. | 304 | * @dir contains the inode structure of parent of the directory to be removed. |
| @@ -318,13 +314,6 @@ struct swap_info_struct; | |||
| 318 | * @mode contains the mode of the new file. | 314 | * @mode contains the mode of the new file. |
| 319 | * @dev contains the the device number. | 315 | * @dev contains the the device number. |
| 320 | * Return 0 if permission is granted. | 316 | * Return 0 if permission is granted. |
| 321 | * @inode_post_mknod: | ||
| 322 | * Set security attributes on a newly created special file (or socket or | ||
| 323 | * fifo file created via the mknod system call). | ||
| 324 | * @dir contains the inode structure of parent of the new node. | ||
| 325 | * @dentry contains the dentry structure of the new node. | ||
| 326 | * @mode contains the mode of the new node. | ||
| 327 | * @dev contains the the device number. | ||
| 328 | * @inode_rename: | 317 | * @inode_rename: |
| 329 | * Check for permission to rename a file or directory. | 318 | * Check for permission to rename a file or directory. |
| 330 | * @old_dir contains the inode structure for parent of the old link. | 319 | * @old_dir contains the inode structure for parent of the old link. |
| @@ -332,12 +321,6 @@ struct swap_info_struct; | |||
| 332 | * @new_dir contains the inode structure for parent of the new link. | 321 | * @new_dir contains the inode structure for parent of the new link. |
| 333 | * @new_dentry contains the dentry structure of the new link. | 322 | * @new_dentry contains the dentry structure of the new link. |
| 334 | * Return 0 if permission is granted. | 323 | * Return 0 if permission is granted. |
| 335 | * @inode_post_rename: | ||
| 336 | * Set security attributes on a renamed file or directory. | ||
| 337 | * @old_dir contains the inode structure for parent of the old link. | ||
| 338 | * @old_dentry contains the dentry structure of the old link. | ||
| 339 | * @new_dir contains the inode structure for parent of the new link. | ||
| 340 | * @new_dentry contains the dentry structure of the new link. | ||
| 341 | * @inode_readlink: | 324 | * @inode_readlink: |
| 342 | * Check the permission to read the symbolic link. | 325 | * Check the permission to read the symbolic link. |
| 343 | * @dentry contains the dentry structure for the file link. | 326 | * @dentry contains the dentry structure for the file link. |
| @@ -1080,34 +1063,21 @@ struct security_operations { | |||
| 1080 | 1063 | ||
| 1081 | int (*inode_alloc_security) (struct inode *inode); | 1064 | int (*inode_alloc_security) (struct inode *inode); |
| 1082 | void (*inode_free_security) (struct inode *inode); | 1065 | void (*inode_free_security) (struct inode *inode); |
| 1066 | int (*inode_init_security) (struct inode *inode, struct inode *dir, | ||
| 1067 | char **name, void **value, size_t *len); | ||
| 1083 | int (*inode_create) (struct inode *dir, | 1068 | int (*inode_create) (struct inode *dir, |
| 1084 | struct dentry *dentry, int mode); | 1069 | struct dentry *dentry, int mode); |
| 1085 | void (*inode_post_create) (struct inode *dir, | ||
| 1086 | struct dentry *dentry, int mode); | ||
| 1087 | int (*inode_link) (struct dentry *old_dentry, | 1070 | int (*inode_link) (struct dentry *old_dentry, |
| 1088 | struct inode *dir, struct dentry *new_dentry); | 1071 | struct inode *dir, struct dentry *new_dentry); |
| 1089 | void (*inode_post_link) (struct dentry *old_dentry, | ||
| 1090 | struct inode *dir, struct dentry *new_dentry); | ||
| 1091 | int (*inode_unlink) (struct inode *dir, struct dentry *dentry); | 1072 | int (*inode_unlink) (struct inode *dir, struct dentry *dentry); |
| 1092 | int (*inode_symlink) (struct inode *dir, | 1073 | int (*inode_symlink) (struct inode *dir, |
| 1093 | struct dentry *dentry, const char *old_name); | 1074 | struct dentry *dentry, const char *old_name); |
| 1094 | void (*inode_post_symlink) (struct inode *dir, | ||
| 1095 | struct dentry *dentry, | ||
| 1096 | const char *old_name); | ||
| 1097 | int (*inode_mkdir) (struct inode *dir, struct dentry *dentry, int mode); | 1075 | int (*inode_mkdir) (struct inode *dir, struct dentry *dentry, int mode); |
| 1098 | void (*inode_post_mkdir) (struct inode *dir, struct dentry *dentry, | ||
| 1099 | int mode); | ||
| 1100 | int (*inode_rmdir) (struct inode *dir, struct dentry *dentry); | 1076 | int (*inode_rmdir) (struct inode *dir, struct dentry *dentry); |
| 1101 | int (*inode_mknod) (struct inode *dir, struct dentry *dentry, | 1077 | int (*inode_mknod) (struct inode *dir, struct dentry *dentry, |
| 1102 | int mode, dev_t dev); | 1078 | int mode, dev_t dev); |
| 1103 | void (*inode_post_mknod) (struct inode *dir, struct dentry *dentry, | ||
| 1104 | int mode, dev_t dev); | ||
| 1105 | int (*inode_rename) (struct inode *old_dir, struct dentry *old_dentry, | 1079 | int (*inode_rename) (struct inode *old_dir, struct dentry *old_dentry, |
| 1106 | struct inode *new_dir, struct dentry *new_dentry); | 1080 | struct inode *new_dir, struct dentry *new_dentry); |
| 1107 | void (*inode_post_rename) (struct inode *old_dir, | ||
| 1108 | struct dentry *old_dentry, | ||
| 1109 | struct inode *new_dir, | ||
| 1110 | struct dentry *new_dentry); | ||
| 1111 | int (*inode_readlink) (struct dentry *dentry); | 1081 | int (*inode_readlink) (struct dentry *dentry); |
| 1112 | int (*inode_follow_link) (struct dentry *dentry, struct nameidata *nd); | 1082 | int (*inode_follow_link) (struct dentry *dentry, struct nameidata *nd); |
| 1113 | int (*inode_permission) (struct inode *inode, int mask, struct nameidata *nd); | 1083 | int (*inode_permission) (struct inode *inode, int mask, struct nameidata *nd); |
| @@ -1442,6 +1412,17 @@ static inline void security_inode_free (struct inode *inode) | |||
| 1442 | return; | 1412 | return; |
| 1443 | security_ops->inode_free_security (inode); | 1413 | security_ops->inode_free_security (inode); |
| 1444 | } | 1414 | } |
| 1415 | |||
| 1416 | static inline int security_inode_init_security (struct inode *inode, | ||
| 1417 | struct inode *dir, | ||
| 1418 | char **name, | ||
| 1419 | void **value, | ||
| 1420 | size_t *len) | ||
| 1421 | { | ||
| 1422 | if (unlikely (IS_PRIVATE (inode))) | ||
| 1423 | return -EOPNOTSUPP; | ||
| 1424 | return security_ops->inode_init_security (inode, dir, name, value, len); | ||
| 1425 | } | ||
| 1445 | 1426 | ||
| 1446 | static inline int security_inode_create (struct inode *dir, | 1427 | static inline int security_inode_create (struct inode *dir, |
| 1447 | struct dentry *dentry, | 1428 | struct dentry *dentry, |
| @@ -1452,15 +1433,6 @@ static inline int security_inode_create (struct inode *dir, | |||
| 1452 | return security_ops->inode_create (dir, dentry, mode); | 1433 | return security_ops->inode_create (dir, dentry, mode); |
| 1453 | } | 1434 | } |
| 1454 | 1435 | ||
| 1455 | static inline void security_inode_post_create (struct inode *dir, | ||
| 1456 | struct dentry *dentry, | ||
| 1457 | int mode) | ||
| 1458 | { | ||
| 1459 | if (dentry->d_inode && unlikely (IS_PRIVATE (dentry->d_inode))) | ||
| 1460 | return; | ||
| 1461 | security_ops->inode_post_create (dir, dentry, mode); | ||
| 1462 | } | ||
| 1463 | |||
| 1464 | static inline int security_inode_link (struct dentry *old_dentry, | 1436 | static inline int security_inode_link (struct dentry *old_dentry, |
| 1465 | struct inode *dir, | 1437 | struct inode *dir, |
| 1466 | struct dentry *new_dentry) | 1438 | struct dentry *new_dentry) |
| @@ -1470,15 +1442,6 @@ static inline int security_inode_link (struct dentry *old_dentry, | |||
| 1470 | return security_ops->inode_link (old_dentry, dir, new_dentry); | 1442 | return security_ops->inode_link (old_dentry, dir, new_dentry); |
| 1471 | } | 1443 | } |
| 1472 | 1444 | ||
| 1473 | static inline void security_inode_post_link (struct dentry *old_dentry, | ||
| 1474 | struct inode *dir, | ||
| 1475 | struct dentry *new_dentry) | ||
| 1476 | { | ||
| 1477 | if (new_dentry->d_inode && unlikely (IS_PRIVATE (new_dentry->d_inode))) | ||
| 1478 | return; | ||
| 1479 | security_ops->inode_post_link (old_dentry, dir, new_dentry); | ||
| 1480 | } | ||
| 1481 | |||
| 1482 | static inline int security_inode_unlink (struct inode *dir, | 1445 | static inline int security_inode_unlink (struct inode *dir, |
| 1483 | struct dentry *dentry) | 1446 | struct dentry *dentry) |
| 1484 | { | 1447 | { |
| @@ -1496,15 +1459,6 @@ static inline int security_inode_symlink (struct inode *dir, | |||
| 1496 | return security_ops->inode_symlink (dir, dentry, old_name); | 1459 | return security_ops->inode_symlink (dir, dentry, old_name); |
| 1497 | } | 1460 | } |
| 1498 | 1461 | ||
| 1499 | static inline void security_inode_post_symlink (struct inode *dir, | ||
| 1500 | struct dentry *dentry, | ||
| 1501 | const char *old_name) | ||
| 1502 | { | ||
| 1503 | if (dentry->d_inode && unlikely (IS_PRIVATE (dentry->d_inode))) | ||
| 1504 | return; | ||
| 1505 | security_ops->inode_post_symlink (dir, dentry, old_name); | ||
| 1506 | } | ||
| 1507 | |||
| 1508 | static inline int security_inode_mkdir (struct inode *dir, | 1462 | static inline int security_inode_mkdir (struct inode *dir, |
| 1509 | struct dentry *dentry, | 1463 | struct dentry *dentry, |
| 1510 | int mode) | 1464 | int mode) |
| @@ -1514,15 +1468,6 @@ static inline int security_inode_mkdir (struct inode *dir, | |||
| 1514 | return security_ops->inode_mkdir (dir, dentry, mode); | 1468 | return security_ops->inode_mkdir (dir, dentry, mode); |
| 1515 | } | 1469 | } |
| 1516 | 1470 | ||
| 1517 | static inline void security_inode_post_mkdir (struct inode *dir, | ||
| 1518 | struct dentry *dentry, | ||
| 1519 | int mode) | ||
| 1520 | { | ||
| 1521 | if (dentry->d_inode && unlikely (IS_PRIVATE (dentry->d_inode))) | ||
| 1522 | return; | ||
| 1523 | security_ops->inode_post_mkdir (dir, dentry, mode); | ||
| 1524 | } | ||
| 1525 | |||
| 1526 | static inline int security_inode_rmdir (struct inode *dir, | 1471 | static inline int security_inode_rmdir (struct inode *dir, |
| 1527 | struct dentry *dentry) | 1472 | struct dentry *dentry) |
| 1528 | { | 1473 | { |
| @@ -1540,15 +1485,6 @@ static inline int security_inode_mknod (struct inode *dir, | |||
| 1540 | return security_ops->inode_mknod (dir, dentry, mode, dev); | 1485 | return security_ops->inode_mknod (dir, dentry, mode, dev); |
| 1541 | } | 1486 | } |
| 1542 | 1487 | ||
| 1543 | static inline void security_inode_post_mknod (struct inode *dir, | ||
| 1544 | struct dentry *dentry, | ||
| 1545 | int mode, dev_t dev) | ||
| 1546 | { | ||
| 1547 | if (dentry->d_inode && unlikely (IS_PRIVATE (dentry->d_inode))) | ||
| 1548 | return; | ||
| 1549 | security_ops->inode_post_mknod (dir, dentry, mode, dev); | ||
| 1550 | } | ||
| 1551 | |||
| 1552 | static inline int security_inode_rename (struct inode *old_dir, | 1488 | static inline int security_inode_rename (struct inode *old_dir, |
| 1553 | struct dentry *old_dentry, | 1489 | struct dentry *old_dentry, |
| 1554 | struct inode *new_dir, | 1490 | struct inode *new_dir, |
| @@ -1561,18 +1497,6 @@ static inline int security_inode_rename (struct inode *old_dir, | |||
| 1561 | new_dir, new_dentry); | 1497 | new_dir, new_dentry); |
| 1562 | } | 1498 | } |
| 1563 | 1499 | ||
| 1564 | static inline void security_inode_post_rename (struct inode *old_dir, | ||
| 1565 | struct dentry *old_dentry, | ||
| 1566 | struct inode *new_dir, | ||
| 1567 | struct dentry *new_dentry) | ||
| 1568 | { | ||
| 1569 | if (unlikely (IS_PRIVATE (old_dentry->d_inode) || | ||
| 1570 | (new_dentry->d_inode && IS_PRIVATE (new_dentry->d_inode)))) | ||
| 1571 | return; | ||
| 1572 | security_ops->inode_post_rename (old_dir, old_dentry, | ||
| 1573 | new_dir, new_dentry); | ||
| 1574 | } | ||
| 1575 | |||
| 1576 | static inline int security_inode_readlink (struct dentry *dentry) | 1500 | static inline int security_inode_readlink (struct dentry *dentry) |
| 1577 | { | 1501 | { |
| 1578 | if (unlikely (IS_PRIVATE (dentry->d_inode))) | 1502 | if (unlikely (IS_PRIVATE (dentry->d_inode))) |
| @@ -2171,6 +2095,15 @@ static inline int security_inode_alloc (struct inode *inode) | |||
| 2171 | 2095 | ||
| 2172 | static inline void security_inode_free (struct inode *inode) | 2096 | static inline void security_inode_free (struct inode *inode) |
| 2173 | { } | 2097 | { } |
| 2098 | |||
| 2099 | static inline int security_inode_init_security (struct inode *inode, | ||
| 2100 | struct inode *dir, | ||
| 2101 | char **name, | ||
| 2102 | void **value, | ||
| 2103 | size_t *len) | ||
| 2104 | { | ||
| 2105 | return -EOPNOTSUPP; | ||
| 2106 | } | ||
| 2174 | 2107 | ||
| 2175 | static inline int security_inode_create (struct inode *dir, | 2108 | static inline int security_inode_create (struct inode *dir, |
| 2176 | struct dentry *dentry, | 2109 | struct dentry *dentry, |
| @@ -2179,11 +2112,6 @@ static inline int security_inode_create (struct inode *dir, | |||
| 2179 | return 0; | 2112 | return 0; |
| 2180 | } | 2113 | } |
| 2181 | 2114 | ||
| 2182 | static inline void security_inode_post_create (struct inode *dir, | ||
| 2183 | struct dentry *dentry, | ||
| 2184 | int mode) | ||
| 2185 | { } | ||
| 2186 | |||
| 2187 | static inline int security_inode_link (struct dentry *old_dentry, | 2115 | static inline int security_inode_link (struct dentry *old_dentry, |
| 2188 | struct inode *dir, | 2116 | struct inode *dir, |
| 2189 | struct dentry *new_dentry) | 2117 | struct dentry *new_dentry) |
| @@ -2191,11 +2119,6 @@ static inline int security_inode_link (struct dentry *old_dentry, | |||
| 2191 | return 0; | 2119 | return 0; |
| 2192 | } | 2120 | } |
| 2193 | 2121 | ||
| 2194 | static inline void security_inode_post_link (struct dentry *old_dentry, | ||
| 2195 | struct inode *dir, | ||
| 2196 | struct dentry *new_dentry) | ||
| 2197 | { } | ||
| 2198 | |||
| 2199 | static inline int security_inode_unlink (struct inode *dir, | 2122 | static inline int security_inode_unlink (struct inode *dir, |
| 2200 | struct dentry *dentry) | 2123 | struct dentry *dentry) |
| 2201 | { | 2124 | { |
| @@ -2209,11 +2132,6 @@ static inline int security_inode_symlink (struct inode *dir, | |||
| 2209 | return 0; | 2132 | return 0; |
| 2210 | } | 2133 | } |
| 2211 | 2134 | ||
| 2212 | static inline void security_inode_post_symlink (struct inode *dir, | ||
| 2213 | struct dentry *dentry, | ||
| 2214 | const char *old_name) | ||
| 2215 | { } | ||
| 2216 | |||
| 2217 | static inline int security_inode_mkdir (struct inode *dir, | 2135 | static inline int security_inode_mkdir (struct inode *dir, |
| 2218 | struct dentry *dentry, | 2136 | struct dentry *dentry, |
| 2219 | int mode) | 2137 | int mode) |
| @@ -2221,11 +2139,6 @@ static inline int security_inode_mkdir (struct inode *dir, | |||
| 2221 | return 0; | 2139 | return 0; |
| 2222 | } | 2140 | } |
| 2223 | 2141 | ||
| 2224 | static inline void security_inode_post_mkdir (struct inode *dir, | ||
| 2225 | struct dentry *dentry, | ||
| 2226 | int mode) | ||
| 2227 | { } | ||
| 2228 | |||
| 2229 | static inline int security_inode_rmdir (struct inode *dir, | 2142 | static inline int security_inode_rmdir (struct inode *dir, |
| 2230 | struct dentry *dentry) | 2143 | struct dentry *dentry) |
| 2231 | { | 2144 | { |
| @@ -2239,11 +2152,6 @@ static inline int security_inode_mknod (struct inode *dir, | |||
| 2239 | return 0; | 2152 | return 0; |
| 2240 | } | 2153 | } |
| 2241 | 2154 | ||
| 2242 | static inline void security_inode_post_mknod (struct inode *dir, | ||
| 2243 | struct dentry *dentry, | ||
| 2244 | int mode, dev_t dev) | ||
| 2245 | { } | ||
| 2246 | |||
| 2247 | static inline int security_inode_rename (struct inode *old_dir, | 2155 | static inline int security_inode_rename (struct inode *old_dir, |
| 2248 | struct dentry *old_dentry, | 2156 | struct dentry *old_dentry, |
| 2249 | struct inode *new_dir, | 2157 | struct inode *new_dir, |
| @@ -2252,12 +2160,6 @@ static inline int security_inode_rename (struct inode *old_dir, | |||
| 2252 | return 0; | 2160 | return 0; |
| 2253 | } | 2161 | } |
| 2254 | 2162 | ||
| 2255 | static inline void security_inode_post_rename (struct inode *old_dir, | ||
| 2256 | struct dentry *old_dentry, | ||
| 2257 | struct inode *new_dir, | ||
| 2258 | struct dentry *new_dentry) | ||
| 2259 | { } | ||
| 2260 | |||
| 2261 | static inline int security_inode_readlink (struct dentry *dentry) | 2163 | static inline int security_inode_readlink (struct dentry *dentry) |
| 2262 | { | 2164 | { |
| 2263 | return 0; | 2165 | return 0; |
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h index d8a023d804d4..317a979b24de 100644 --- a/include/linux/serial_8250.h +++ b/include/linux/serial_8250.h | |||
| @@ -30,6 +30,21 @@ struct plat_serial8250_port { | |||
| 30 | }; | 30 | }; |
| 31 | 31 | ||
| 32 | /* | 32 | /* |
| 33 | * Allocate 8250 platform device IDs. Nothing is implied by | ||
| 34 | * the numbering here, except for the legacy entry being -1. | ||
| 35 | */ | ||
| 36 | enum { | ||
| 37 | PLAT8250_DEV_LEGACY = -1, | ||
| 38 | PLAT8250_DEV_PLATFORM, | ||
| 39 | PLAT8250_DEV_PLATFORM1, | ||
| 40 | PLAT8250_DEV_FOURPORT, | ||
| 41 | PLAT8250_DEV_ACCENT, | ||
| 42 | PLAT8250_DEV_BOCA, | ||
| 43 | PLAT8250_DEV_HUB6, | ||
| 44 | PLAT8250_DEV_MCA, | ||
| 45 | }; | ||
| 46 | |||
| 47 | /* | ||
| 33 | * This should be used by drivers which want to register | 48 | * This should be used by drivers which want to register |
| 34 | * their own 8250 ports without registering their own | 49 | * their own 8250 ports without registering their own |
| 35 | * platform device. Using these will make your driver | 50 | * platform device. Using these will make your driver |
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index 9b12fe731612..27db8da43aa4 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h | |||
| @@ -401,6 +401,9 @@ uart_handle_sysrq_char(struct uart_port *port, unsigned int ch, | |||
| 401 | #endif | 401 | #endif |
| 402 | return 0; | 402 | return 0; |
| 403 | } | 403 | } |
| 404 | #ifndef SUPPORT_SYSRQ | ||
| 405 | #define uart_handle_sysrq_char(port,ch,regs) uart_handle_sysrq_char(port, 0, NULL) | ||
| 406 | #endif | ||
| 404 | 407 | ||
| 405 | /* | 408 | /* |
| 406 | * We do the SysRQ and SAK checking like this... | 409 | * We do the SysRQ and SAK checking like this... |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index da7da9c0ed1b..2741c0c55e83 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
| @@ -1167,7 +1167,7 @@ static inline void skb_postpull_rcsum(struct sk_buff *skb, | |||
| 1167 | 1167 | ||
| 1168 | static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len) | 1168 | static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len) |
| 1169 | { | 1169 | { |
| 1170 | if (len >= skb->len) | 1170 | if (likely(len >= skb->len)) |
| 1171 | return 0; | 1171 | return 0; |
| 1172 | if (skb->ip_summed == CHECKSUM_HW) | 1172 | if (skb->ip_summed == CHECKSUM_HW) |
| 1173 | skb->ip_summed = CHECKSUM_NONE; | 1173 | skb->ip_summed = CHECKSUM_NONE; |
diff --git a/include/linux/slab.h b/include/linux/slab.h index 42a6bea58af3..1f356f3bbc64 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h | |||
| @@ -118,7 +118,8 @@ extern void kfree(const void *); | |||
| 118 | extern unsigned int ksize(const void *); | 118 | extern unsigned int ksize(const void *); |
| 119 | 119 | ||
| 120 | #ifdef CONFIG_NUMA | 120 | #ifdef CONFIG_NUMA |
| 121 | extern void *kmem_cache_alloc_node(kmem_cache_t *, int flags, int node); | 121 | extern void *kmem_cache_alloc_node(kmem_cache_t *, |
| 122 | unsigned int __nocast flags, int node); | ||
| 122 | extern void *kmalloc_node(size_t size, unsigned int __nocast flags, int node); | 123 | extern void *kmalloc_node(size_t size, unsigned int __nocast flags, int node); |
| 123 | #else | 124 | #else |
| 124 | static inline void *kmem_cache_alloc_node(kmem_cache_t *cachep, int flags, int node) | 125 | static inline void *kmem_cache_alloc_node(kmem_cache_t *cachep, int flags, int node) |
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h index d6ba068719b6..cdc99a27840d 100644 --- a/include/linux/spinlock.h +++ b/include/linux/spinlock.h | |||
| @@ -2,7 +2,48 @@ | |||
| 2 | #define __LINUX_SPINLOCK_H | 2 | #define __LINUX_SPINLOCK_H |
| 3 | 3 | ||
| 4 | /* | 4 | /* |
| 5 | * include/linux/spinlock.h - generic locking declarations | 5 | * include/linux/spinlock.h - generic spinlock/rwlock declarations |
| 6 | * | ||
| 7 | * here's the role of the various spinlock/rwlock related include files: | ||
| 8 | * | ||
| 9 | * on SMP builds: | ||
| 10 | * | ||
| 11 | * asm/spinlock_types.h: contains the raw_spinlock_t/raw_rwlock_t and the | ||
| 12 | * initializers | ||
| 13 | * | ||
| 14 | * linux/spinlock_types.h: | ||
| 15 | * defines the generic type and initializers | ||
| 16 | * | ||
| 17 | * asm/spinlock.h: contains the __raw_spin_*()/etc. lowlevel | ||
| 18 | * implementations, mostly inline assembly code | ||
| 19 | * | ||
| 20 | * (also included on UP-debug builds:) | ||
| 21 | * | ||
| 22 | * linux/spinlock_api_smp.h: | ||
| 23 | * contains the prototypes for the _spin_*() APIs. | ||
| 24 | * | ||
| 25 | * linux/spinlock.h: builds the final spin_*() APIs. | ||
| 26 | * | ||
| 27 | * on UP builds: | ||
| 28 | * | ||
| 29 | * linux/spinlock_type_up.h: | ||
| 30 | * contains the generic, simplified UP spinlock type. | ||
| 31 | * (which is an empty structure on non-debug builds) | ||
| 32 | * | ||
| 33 | * linux/spinlock_types.h: | ||
| 34 | * defines the generic type and initializers | ||
| 35 | * | ||
| 36 | * linux/spinlock_up.h: | ||
| 37 | * contains the __raw_spin_*()/etc. version of UP | ||
| 38 | * builds. (which are NOPs on non-debug, non-preempt | ||
| 39 | * builds) | ||
| 40 | * | ||
| 41 | * (included on UP-non-debug builds:) | ||
| 42 | * | ||
| 43 | * linux/spinlock_api_up.h: | ||
| 44 | * builds the _spin_*() APIs. | ||
| 45 | * | ||
| 46 | * linux/spinlock.h: builds the final spin_*() APIs. | ||
| 6 | */ | 47 | */ |
| 7 | 48 | ||
| 8 | #include <linux/config.h> | 49 | #include <linux/config.h> |
| @@ -13,7 +54,6 @@ | |||
| 13 | #include <linux/kernel.h> | 54 | #include <linux/kernel.h> |
| 14 | #include <linux/stringify.h> | 55 | #include <linux/stringify.h> |
| 15 | 56 | ||
| 16 | #include <asm/processor.h> /* for cpu relax */ | ||
| 17 | #include <asm/system.h> | 57 | #include <asm/system.h> |
| 18 | 58 | ||
| 19 | /* | 59 | /* |
| @@ -35,423 +75,84 @@ | |||
| 35 | #define __lockfunc fastcall __attribute__((section(".spinlock.text"))) | 75 | #define __lockfunc fastcall __attribute__((section(".spinlock.text"))) |
| 36 | 76 | ||
| 37 | /* | 77 | /* |
| 38 | * If CONFIG_SMP is set, pull in the _raw_* definitions | 78 | * Pull the raw_spinlock_t and raw_rwlock_t definitions: |
| 39 | */ | 79 | */ |
| 40 | #ifdef CONFIG_SMP | 80 | #include <linux/spinlock_types.h> |
| 41 | |||
| 42 | #define assert_spin_locked(x) BUG_ON(!spin_is_locked(x)) | ||
| 43 | #include <asm/spinlock.h> | ||
| 44 | |||
| 45 | int __lockfunc _spin_trylock(spinlock_t *lock); | ||
| 46 | int __lockfunc _read_trylock(rwlock_t *lock); | ||
| 47 | int __lockfunc _write_trylock(rwlock_t *lock); | ||
| 48 | |||
| 49 | void __lockfunc _spin_lock(spinlock_t *lock) __acquires(spinlock_t); | ||
| 50 | void __lockfunc _read_lock(rwlock_t *lock) __acquires(rwlock_t); | ||
| 51 | void __lockfunc _write_lock(rwlock_t *lock) __acquires(rwlock_t); | ||
| 52 | |||
| 53 | void __lockfunc _spin_unlock(spinlock_t *lock) __releases(spinlock_t); | ||
| 54 | void __lockfunc _read_unlock(rwlock_t *lock) __releases(rwlock_t); | ||
| 55 | void __lockfunc _write_unlock(rwlock_t *lock) __releases(rwlock_t); | ||
| 56 | |||
| 57 | unsigned long __lockfunc _spin_lock_irqsave(spinlock_t *lock) __acquires(spinlock_t); | ||
| 58 | unsigned long __lockfunc _read_lock_irqsave(rwlock_t *lock) __acquires(rwlock_t); | ||
| 59 | unsigned long __lockfunc _write_lock_irqsave(rwlock_t *lock) __acquires(rwlock_t); | ||
| 60 | |||
| 61 | void __lockfunc _spin_lock_irq(spinlock_t *lock) __acquires(spinlock_t); | ||
| 62 | void __lockfunc _spin_lock_bh(spinlock_t *lock) __acquires(spinlock_t); | ||
| 63 | void __lockfunc _read_lock_irq(rwlock_t *lock) __acquires(rwlock_t); | ||
| 64 | void __lockfunc _read_lock_bh(rwlock_t *lock) __acquires(rwlock_t); | ||
| 65 | void __lockfunc _write_lock_irq(rwlock_t *lock) __acquires(rwlock_t); | ||
| 66 | void __lockfunc _write_lock_bh(rwlock_t *lock) __acquires(rwlock_t); | ||
| 67 | |||
| 68 | void __lockfunc _spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags) __releases(spinlock_t); | ||
| 69 | void __lockfunc _spin_unlock_irq(spinlock_t *lock) __releases(spinlock_t); | ||
| 70 | void __lockfunc _spin_unlock_bh(spinlock_t *lock) __releases(spinlock_t); | ||
| 71 | void __lockfunc _read_unlock_irqrestore(rwlock_t *lock, unsigned long flags) __releases(rwlock_t); | ||
| 72 | void __lockfunc _read_unlock_irq(rwlock_t *lock) __releases(rwlock_t); | ||
| 73 | void __lockfunc _read_unlock_bh(rwlock_t *lock) __releases(rwlock_t); | ||
| 74 | void __lockfunc _write_unlock_irqrestore(rwlock_t *lock, unsigned long flags) __releases(rwlock_t); | ||
| 75 | void __lockfunc _write_unlock_irq(rwlock_t *lock) __releases(rwlock_t); | ||
| 76 | void __lockfunc _write_unlock_bh(rwlock_t *lock) __releases(rwlock_t); | ||
| 77 | |||
| 78 | int __lockfunc _spin_trylock_bh(spinlock_t *lock); | ||
| 79 | int __lockfunc generic_raw_read_trylock(rwlock_t *lock); | ||
| 80 | int in_lock_functions(unsigned long addr); | ||
| 81 | |||
| 82 | #else | ||
| 83 | 81 | ||
| 84 | #define in_lock_functions(ADDR) 0 | 82 | extern int __lockfunc generic__raw_read_trylock(raw_rwlock_t *lock); |
| 85 | 83 | ||
| 86 | #if !defined(CONFIG_PREEMPT) && !defined(CONFIG_DEBUG_SPINLOCK) | ||
| 87 | # define _atomic_dec_and_lock(atomic,lock) atomic_dec_and_test(atomic) | ||
| 88 | # define ATOMIC_DEC_AND_LOCK | ||
| 89 | #endif | ||
| 90 | |||
| 91 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
| 92 | |||
| 93 | #define SPINLOCK_MAGIC 0x1D244B3C | ||
| 94 | typedef struct { | ||
| 95 | unsigned long magic; | ||
| 96 | volatile unsigned long lock; | ||
| 97 | volatile unsigned int babble; | ||
| 98 | const char *module; | ||
| 99 | char *owner; | ||
| 100 | int oline; | ||
| 101 | } spinlock_t; | ||
| 102 | #define SPIN_LOCK_UNLOCKED (spinlock_t) { SPINLOCK_MAGIC, 0, 10, __FILE__ , NULL, 0} | ||
| 103 | |||
| 104 | #define spin_lock_init(x) \ | ||
| 105 | do { \ | ||
| 106 | (x)->magic = SPINLOCK_MAGIC; \ | ||
| 107 | (x)->lock = 0; \ | ||
| 108 | (x)->babble = 5; \ | ||
| 109 | (x)->module = __FILE__; \ | ||
| 110 | (x)->owner = NULL; \ | ||
| 111 | (x)->oline = 0; \ | ||
| 112 | } while (0) | ||
| 113 | |||
| 114 | #define CHECK_LOCK(x) \ | ||
| 115 | do { \ | ||
| 116 | if ((x)->magic != SPINLOCK_MAGIC) { \ | ||
| 117 | printk(KERN_ERR "%s:%d: spin_is_locked on uninitialized spinlock %p.\n", \ | ||
| 118 | __FILE__, __LINE__, (x)); \ | ||
| 119 | } \ | ||
| 120 | } while(0) | ||
| 121 | |||
| 122 | #define _raw_spin_lock(x) \ | ||
| 123 | do { \ | ||
| 124 | CHECK_LOCK(x); \ | ||
| 125 | if ((x)->lock&&(x)->babble) { \ | ||
| 126 | (x)->babble--; \ | ||
| 127 | printk("%s:%d: spin_lock(%s:%p) already locked by %s/%d\n", \ | ||
| 128 | __FILE__,__LINE__, (x)->module, \ | ||
| 129 | (x), (x)->owner, (x)->oline); \ | ||
| 130 | } \ | ||
| 131 | (x)->lock = 1; \ | ||
| 132 | (x)->owner = __FILE__; \ | ||
| 133 | (x)->oline = __LINE__; \ | ||
| 134 | } while (0) | ||
| 135 | |||
| 136 | /* without debugging, spin_is_locked on UP always says | ||
| 137 | * FALSE. --> printk if already locked. */ | ||
| 138 | #define spin_is_locked(x) \ | ||
| 139 | ({ \ | ||
| 140 | CHECK_LOCK(x); \ | ||
| 141 | if ((x)->lock&&(x)->babble) { \ | ||
| 142 | (x)->babble--; \ | ||
| 143 | printk("%s:%d: spin_is_locked(%s:%p) already locked by %s/%d\n", \ | ||
| 144 | __FILE__,__LINE__, (x)->module, \ | ||
| 145 | (x), (x)->owner, (x)->oline); \ | ||
| 146 | } \ | ||
| 147 | 0; \ | ||
| 148 | }) | ||
| 149 | |||
| 150 | /* with debugging, assert_spin_locked() on UP does check | ||
| 151 | * the lock value properly */ | ||
| 152 | #define assert_spin_locked(x) \ | ||
| 153 | ({ \ | ||
| 154 | CHECK_LOCK(x); \ | ||
| 155 | BUG_ON(!(x)->lock); \ | ||
| 156 | }) | ||
| 157 | |||
| 158 | /* without debugging, spin_trylock on UP always says | ||
| 159 | * TRUE. --> printk if already locked. */ | ||
| 160 | #define _raw_spin_trylock(x) \ | ||
| 161 | ({ \ | ||
| 162 | CHECK_LOCK(x); \ | ||
| 163 | if ((x)->lock&&(x)->babble) { \ | ||
| 164 | (x)->babble--; \ | ||
| 165 | printk("%s:%d: spin_trylock(%s:%p) already locked by %s/%d\n", \ | ||
| 166 | __FILE__,__LINE__, (x)->module, \ | ||
| 167 | (x), (x)->owner, (x)->oline); \ | ||
| 168 | } \ | ||
| 169 | (x)->lock = 1; \ | ||
| 170 | (x)->owner = __FILE__; \ | ||
| 171 | (x)->oline = __LINE__; \ | ||
| 172 | 1; \ | ||
| 173 | }) | ||
| 174 | |||
| 175 | #define spin_unlock_wait(x) \ | ||
| 176 | do { \ | ||
| 177 | CHECK_LOCK(x); \ | ||
| 178 | if ((x)->lock&&(x)->babble) { \ | ||
| 179 | (x)->babble--; \ | ||
| 180 | printk("%s:%d: spin_unlock_wait(%s:%p) owned by %s/%d\n", \ | ||
| 181 | __FILE__,__LINE__, (x)->module, (x), \ | ||
| 182 | (x)->owner, (x)->oline); \ | ||
| 183 | }\ | ||
| 184 | } while (0) | ||
| 185 | |||
| 186 | #define _raw_spin_unlock(x) \ | ||
| 187 | do { \ | ||
| 188 | CHECK_LOCK(x); \ | ||
| 189 | if (!(x)->lock&&(x)->babble) { \ | ||
| 190 | (x)->babble--; \ | ||
| 191 | printk("%s:%d: spin_unlock(%s:%p) not locked\n", \ | ||
| 192 | __FILE__,__LINE__, (x)->module, (x));\ | ||
| 193 | } \ | ||
| 194 | (x)->lock = 0; \ | ||
| 195 | } while (0) | ||
| 196 | #else | ||
| 197 | /* | 84 | /* |
| 198 | * gcc versions before ~2.95 have a nasty bug with empty initializers. | 85 | * Pull the __raw*() functions/declarations (UP-nondebug doesnt need them): |
| 199 | */ | 86 | */ |
| 200 | #if (__GNUC__ > 2) | 87 | #if defined(CONFIG_SMP) |
| 201 | typedef struct { } spinlock_t; | 88 | # include <asm/spinlock.h> |
| 202 | #define SPIN_LOCK_UNLOCKED (spinlock_t) { } | ||
| 203 | #else | 89 | #else |
| 204 | typedef struct { int gcc_is_buggy; } spinlock_t; | 90 | # include <linux/spinlock_up.h> |
| 205 | #define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 } | ||
| 206 | #endif | 91 | #endif |
| 207 | 92 | ||
| 93 | #define spin_lock_init(lock) do { *(lock) = SPIN_LOCK_UNLOCKED; } while (0) | ||
| 94 | #define rwlock_init(lock) do { *(lock) = RW_LOCK_UNLOCKED; } while (0) | ||
| 95 | |||
| 96 | #define spin_is_locked(lock) __raw_spin_is_locked(&(lock)->raw_lock) | ||
| 97 | |||
| 98 | /** | ||
| 99 | * spin_unlock_wait - wait until the spinlock gets unlocked | ||
| 100 | * @lock: the spinlock in question. | ||
| 101 | */ | ||
| 102 | #define spin_unlock_wait(lock) __raw_spin_unlock_wait(&(lock)->raw_lock) | ||
| 103 | |||
| 208 | /* | 104 | /* |
| 209 | * If CONFIG_SMP is unset, declare the _raw_* definitions as nops | 105 | * Pull the _spin_*()/_read_*()/_write_*() functions/declarations: |
| 210 | */ | 106 | */ |
| 211 | #define spin_lock_init(lock) do { (void)(lock); } while(0) | 107 | #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) |
| 212 | #define _raw_spin_lock(lock) do { (void)(lock); } while(0) | 108 | # include <linux/spinlock_api_smp.h> |
| 213 | #define spin_is_locked(lock) ((void)(lock), 0) | ||
| 214 | #define assert_spin_locked(lock) do { (void)(lock); } while(0) | ||
| 215 | #define _raw_spin_trylock(lock) (((void)(lock), 1)) | ||
| 216 | #define spin_unlock_wait(lock) (void)(lock) | ||
| 217 | #define _raw_spin_unlock(lock) do { (void)(lock); } while(0) | ||
| 218 | #endif /* CONFIG_DEBUG_SPINLOCK */ | ||
| 219 | |||
| 220 | /* RW spinlocks: No debug version */ | ||
| 221 | |||
| 222 | #if (__GNUC__ > 2) | ||
| 223 | typedef struct { } rwlock_t; | ||
| 224 | #define RW_LOCK_UNLOCKED (rwlock_t) { } | ||
| 225 | #else | 109 | #else |
| 226 | typedef struct { int gcc_is_buggy; } rwlock_t; | 110 | # include <linux/spinlock_api_up.h> |
| 227 | #define RW_LOCK_UNLOCKED (rwlock_t) { 0 } | ||
| 228 | #endif | 111 | #endif |
| 229 | 112 | ||
| 230 | #define rwlock_init(lock) do { (void)(lock); } while(0) | 113 | #ifdef CONFIG_DEBUG_SPINLOCK |
| 231 | #define _raw_read_lock(lock) do { (void)(lock); } while(0) | 114 | extern void _raw_spin_lock(spinlock_t *lock); |
| 232 | #define _raw_read_unlock(lock) do { (void)(lock); } while(0) | 115 | #define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock) |
| 233 | #define _raw_write_lock(lock) do { (void)(lock); } while(0) | 116 | extern int _raw_spin_trylock(spinlock_t *lock); |
| 234 | #define _raw_write_unlock(lock) do { (void)(lock); } while(0) | 117 | extern void _raw_spin_unlock(spinlock_t *lock); |
| 235 | #define read_can_lock(lock) (((void)(lock), 1)) | 118 | |
| 236 | #define write_can_lock(lock) (((void)(lock), 1)) | 119 | extern void _raw_read_lock(rwlock_t *lock); |
| 237 | #define _raw_read_trylock(lock) ({ (void)(lock); (1); }) | 120 | extern int _raw_read_trylock(rwlock_t *lock); |
| 238 | #define _raw_write_trylock(lock) ({ (void)(lock); (1); }) | 121 | extern void _raw_read_unlock(rwlock_t *lock); |
| 239 | 122 | extern void _raw_write_lock(rwlock_t *lock); | |
| 240 | #define _spin_trylock(lock) ({preempt_disable(); _raw_spin_trylock(lock) ? \ | 123 | extern int _raw_write_trylock(rwlock_t *lock); |
| 241 | 1 : ({preempt_enable(); 0;});}) | 124 | extern void _raw_write_unlock(rwlock_t *lock); |
| 242 | 125 | #else | |
| 243 | #define _read_trylock(lock) ({preempt_disable();_raw_read_trylock(lock) ? \ | 126 | # define _raw_spin_unlock(lock) __raw_spin_unlock(&(lock)->raw_lock) |
| 244 | 1 : ({preempt_enable(); 0;});}) | 127 | # define _raw_spin_trylock(lock) __raw_spin_trylock(&(lock)->raw_lock) |
| 245 | 128 | # define _raw_spin_lock(lock) __raw_spin_lock(&(lock)->raw_lock) | |
| 246 | #define _write_trylock(lock) ({preempt_disable(); _raw_write_trylock(lock) ? \ | 129 | # define _raw_spin_lock_flags(lock, flags) \ |
| 247 | 1 : ({preempt_enable(); 0;});}) | 130 | __raw_spin_lock_flags(&(lock)->raw_lock, *(flags)) |
| 248 | 131 | # define _raw_read_lock(rwlock) __raw_read_lock(&(rwlock)->raw_lock) | |
| 249 | #define _spin_trylock_bh(lock) ({preempt_disable(); local_bh_disable(); \ | 132 | # define _raw_write_lock(rwlock) __raw_write_lock(&(rwlock)->raw_lock) |
| 250 | _raw_spin_trylock(lock) ? \ | 133 | # define _raw_read_unlock(rwlock) __raw_read_unlock(&(rwlock)->raw_lock) |
| 251 | 1 : ({preempt_enable_no_resched(); local_bh_enable(); 0;});}) | 134 | # define _raw_write_unlock(rwlock) __raw_write_unlock(&(rwlock)->raw_lock) |
| 252 | 135 | # define _raw_read_trylock(rwlock) __raw_read_trylock(&(rwlock)->raw_lock) | |
| 253 | #define _spin_lock(lock) \ | 136 | # define _raw_write_trylock(rwlock) __raw_write_trylock(&(rwlock)->raw_lock) |
| 254 | do { \ | 137 | #endif |
| 255 | preempt_disable(); \ | ||
| 256 | _raw_spin_lock(lock); \ | ||
| 257 | __acquire(lock); \ | ||
| 258 | } while(0) | ||
| 259 | |||
| 260 | #define _write_lock(lock) \ | ||
| 261 | do { \ | ||
| 262 | preempt_disable(); \ | ||
| 263 | _raw_write_lock(lock); \ | ||
| 264 | __acquire(lock); \ | ||
| 265 | } while(0) | ||
| 266 | |||
| 267 | #define _read_lock(lock) \ | ||
| 268 | do { \ | ||
| 269 | preempt_disable(); \ | ||
| 270 | _raw_read_lock(lock); \ | ||
| 271 | __acquire(lock); \ | ||
| 272 | } while(0) | ||
| 273 | |||
| 274 | #define _spin_unlock(lock) \ | ||
| 275 | do { \ | ||
| 276 | _raw_spin_unlock(lock); \ | ||
| 277 | preempt_enable(); \ | ||
| 278 | __release(lock); \ | ||
| 279 | } while (0) | ||
| 280 | |||
| 281 | #define _write_unlock(lock) \ | ||
| 282 | do { \ | ||
| 283 | _raw_write_unlock(lock); \ | ||
| 284 | preempt_enable(); \ | ||
| 285 | __release(lock); \ | ||
| 286 | } while(0) | ||
| 287 | |||
| 288 | #define _read_unlock(lock) \ | ||
| 289 | do { \ | ||
| 290 | _raw_read_unlock(lock); \ | ||
| 291 | preempt_enable(); \ | ||
| 292 | __release(lock); \ | ||
| 293 | } while(0) | ||
| 294 | |||
| 295 | #define _spin_lock_irqsave(lock, flags) \ | ||
| 296 | do { \ | ||
| 297 | local_irq_save(flags); \ | ||
| 298 | preempt_disable(); \ | ||
| 299 | _raw_spin_lock(lock); \ | ||
| 300 | __acquire(lock); \ | ||
| 301 | } while (0) | ||
| 302 | |||
| 303 | #define _spin_lock_irq(lock) \ | ||
| 304 | do { \ | ||
| 305 | local_irq_disable(); \ | ||
| 306 | preempt_disable(); \ | ||
| 307 | _raw_spin_lock(lock); \ | ||
| 308 | __acquire(lock); \ | ||
| 309 | } while (0) | ||
| 310 | |||
| 311 | #define _spin_lock_bh(lock) \ | ||
| 312 | do { \ | ||
| 313 | local_bh_disable(); \ | ||
| 314 | preempt_disable(); \ | ||
| 315 | _raw_spin_lock(lock); \ | ||
| 316 | __acquire(lock); \ | ||
| 317 | } while (0) | ||
| 318 | |||
| 319 | #define _read_lock_irqsave(lock, flags) \ | ||
| 320 | do { \ | ||
| 321 | local_irq_save(flags); \ | ||
| 322 | preempt_disable(); \ | ||
| 323 | _raw_read_lock(lock); \ | ||
| 324 | __acquire(lock); \ | ||
| 325 | } while (0) | ||
| 326 | |||
| 327 | #define _read_lock_irq(lock) \ | ||
| 328 | do { \ | ||
| 329 | local_irq_disable(); \ | ||
| 330 | preempt_disable(); \ | ||
| 331 | _raw_read_lock(lock); \ | ||
| 332 | __acquire(lock); \ | ||
| 333 | } while (0) | ||
| 334 | |||
| 335 | #define _read_lock_bh(lock) \ | ||
| 336 | do { \ | ||
| 337 | local_bh_disable(); \ | ||
| 338 | preempt_disable(); \ | ||
| 339 | _raw_read_lock(lock); \ | ||
| 340 | __acquire(lock); \ | ||
| 341 | } while (0) | ||
| 342 | |||
| 343 | #define _write_lock_irqsave(lock, flags) \ | ||
| 344 | do { \ | ||
| 345 | local_irq_save(flags); \ | ||
| 346 | preempt_disable(); \ | ||
| 347 | _raw_write_lock(lock); \ | ||
| 348 | __acquire(lock); \ | ||
| 349 | } while (0) | ||
| 350 | 138 | ||
| 351 | #define _write_lock_irq(lock) \ | 139 | #define read_can_lock(rwlock) __raw_read_can_lock(&(rwlock)->raw_lock) |
| 352 | do { \ | 140 | #define write_can_lock(rwlock) __raw_write_can_lock(&(rwlock)->raw_lock) |
| 353 | local_irq_disable(); \ | ||
| 354 | preempt_disable(); \ | ||
| 355 | _raw_write_lock(lock); \ | ||
| 356 | __acquire(lock); \ | ||
| 357 | } while (0) | ||
| 358 | |||
| 359 | #define _write_lock_bh(lock) \ | ||
| 360 | do { \ | ||
| 361 | local_bh_disable(); \ | ||
| 362 | preempt_disable(); \ | ||
| 363 | _raw_write_lock(lock); \ | ||
| 364 | __acquire(lock); \ | ||
| 365 | } while (0) | ||
| 366 | |||
| 367 | #define _spin_unlock_irqrestore(lock, flags) \ | ||
| 368 | do { \ | ||
| 369 | _raw_spin_unlock(lock); \ | ||
| 370 | local_irq_restore(flags); \ | ||
| 371 | preempt_enable(); \ | ||
| 372 | __release(lock); \ | ||
| 373 | } while (0) | ||
| 374 | |||
| 375 | #define _spin_unlock_irq(lock) \ | ||
| 376 | do { \ | ||
| 377 | _raw_spin_unlock(lock); \ | ||
| 378 | local_irq_enable(); \ | ||
| 379 | preempt_enable(); \ | ||
| 380 | __release(lock); \ | ||
| 381 | } while (0) | ||
| 382 | |||
| 383 | #define _spin_unlock_bh(lock) \ | ||
| 384 | do { \ | ||
| 385 | _raw_spin_unlock(lock); \ | ||
| 386 | preempt_enable_no_resched(); \ | ||
| 387 | local_bh_enable(); \ | ||
| 388 | __release(lock); \ | ||
| 389 | } while (0) | ||
| 390 | |||
| 391 | #define _write_unlock_bh(lock) \ | ||
| 392 | do { \ | ||
| 393 | _raw_write_unlock(lock); \ | ||
| 394 | preempt_enable_no_resched(); \ | ||
| 395 | local_bh_enable(); \ | ||
| 396 | __release(lock); \ | ||
| 397 | } while (0) | ||
| 398 | |||
| 399 | #define _read_unlock_irqrestore(lock, flags) \ | ||
| 400 | do { \ | ||
| 401 | _raw_read_unlock(lock); \ | ||
| 402 | local_irq_restore(flags); \ | ||
| 403 | preempt_enable(); \ | ||
| 404 | __release(lock); \ | ||
| 405 | } while (0) | ||
| 406 | |||
| 407 | #define _write_unlock_irqrestore(lock, flags) \ | ||
| 408 | do { \ | ||
| 409 | _raw_write_unlock(lock); \ | ||
| 410 | local_irq_restore(flags); \ | ||
| 411 | preempt_enable(); \ | ||
| 412 | __release(lock); \ | ||
| 413 | } while (0) | ||
| 414 | |||
| 415 | #define _read_unlock_irq(lock) \ | ||
| 416 | do { \ | ||
| 417 | _raw_read_unlock(lock); \ | ||
| 418 | local_irq_enable(); \ | ||
| 419 | preempt_enable(); \ | ||
| 420 | __release(lock); \ | ||
| 421 | } while (0) | ||
| 422 | |||
| 423 | #define _read_unlock_bh(lock) \ | ||
| 424 | do { \ | ||
| 425 | _raw_read_unlock(lock); \ | ||
| 426 | preempt_enable_no_resched(); \ | ||
| 427 | local_bh_enable(); \ | ||
| 428 | __release(lock); \ | ||
| 429 | } while (0) | ||
| 430 | |||
| 431 | #define _write_unlock_irq(lock) \ | ||
| 432 | do { \ | ||
| 433 | _raw_write_unlock(lock); \ | ||
| 434 | local_irq_enable(); \ | ||
| 435 | preempt_enable(); \ | ||
| 436 | __release(lock); \ | ||
| 437 | } while (0) | ||
| 438 | |||
| 439 | #endif /* !SMP */ | ||
| 440 | 141 | ||
| 441 | /* | 142 | /* |
| 442 | * Define the various spin_lock and rw_lock methods. Note we define these | 143 | * Define the various spin_lock and rw_lock methods. Note we define these |
| 443 | * regardless of whether CONFIG_SMP or CONFIG_PREEMPT are set. The various | 144 | * regardless of whether CONFIG_SMP or CONFIG_PREEMPT are set. The various |
| 444 | * methods are defined as nops in the case they are not required. | 145 | * methods are defined as nops in the case they are not required. |
| 445 | */ | 146 | */ |
| 446 | #define spin_trylock(lock) __cond_lock(_spin_trylock(lock)) | 147 | #define spin_trylock(lock) __cond_lock(_spin_trylock(lock)) |
| 447 | #define read_trylock(lock) __cond_lock(_read_trylock(lock)) | 148 | #define read_trylock(lock) __cond_lock(_read_trylock(lock)) |
| 448 | #define write_trylock(lock) __cond_lock(_write_trylock(lock)) | 149 | #define write_trylock(lock) __cond_lock(_write_trylock(lock)) |
| 449 | 150 | ||
| 450 | #define spin_lock(lock) _spin_lock(lock) | 151 | #define spin_lock(lock) _spin_lock(lock) |
| 451 | #define write_lock(lock) _write_lock(lock) | 152 | #define write_lock(lock) _write_lock(lock) |
| 452 | #define read_lock(lock) _read_lock(lock) | 153 | #define read_lock(lock) _read_lock(lock) |
| 453 | 154 | ||
| 454 | #ifdef CONFIG_SMP | 155 | #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) |
| 455 | #define spin_lock_irqsave(lock, flags) flags = _spin_lock_irqsave(lock) | 156 | #define spin_lock_irqsave(lock, flags) flags = _spin_lock_irqsave(lock) |
| 456 | #define read_lock_irqsave(lock, flags) flags = _read_lock_irqsave(lock) | 157 | #define read_lock_irqsave(lock, flags) flags = _read_lock_irqsave(lock) |
| 457 | #define write_lock_irqsave(lock, flags) flags = _write_lock_irqsave(lock) | 158 | #define write_lock_irqsave(lock, flags) flags = _write_lock_irqsave(lock) |
| @@ -470,137 +171,59 @@ do { \ | |||
| 470 | #define write_lock_irq(lock) _write_lock_irq(lock) | 171 | #define write_lock_irq(lock) _write_lock_irq(lock) |
| 471 | #define write_lock_bh(lock) _write_lock_bh(lock) | 172 | #define write_lock_bh(lock) _write_lock_bh(lock) |
| 472 | 173 | ||
| 473 | #define spin_unlock(lock) _spin_unlock(lock) | 174 | #define spin_unlock(lock) _spin_unlock(lock) |
| 474 | #define write_unlock(lock) _write_unlock(lock) | 175 | #define write_unlock(lock) _write_unlock(lock) |
| 475 | #define read_unlock(lock) _read_unlock(lock) | 176 | #define read_unlock(lock) _read_unlock(lock) |
| 476 | 177 | ||
| 477 | #define spin_unlock_irqrestore(lock, flags) _spin_unlock_irqrestore(lock, flags) | 178 | #define spin_unlock_irqrestore(lock, flags) \ |
| 179 | _spin_unlock_irqrestore(lock, flags) | ||
| 478 | #define spin_unlock_irq(lock) _spin_unlock_irq(lock) | 180 | #define spin_unlock_irq(lock) _spin_unlock_irq(lock) |
| 479 | #define spin_unlock_bh(lock) _spin_unlock_bh(lock) | 181 | #define spin_unlock_bh(lock) _spin_unlock_bh(lock) |
| 480 | 182 | ||
| 481 | #define read_unlock_irqrestore(lock, flags) _read_unlock_irqrestore(lock, flags) | 183 | #define read_unlock_irqrestore(lock, flags) \ |
| 482 | #define read_unlock_irq(lock) _read_unlock_irq(lock) | 184 | _read_unlock_irqrestore(lock, flags) |
| 483 | #define read_unlock_bh(lock) _read_unlock_bh(lock) | 185 | #define read_unlock_irq(lock) _read_unlock_irq(lock) |
| 186 | #define read_unlock_bh(lock) _read_unlock_bh(lock) | ||
| 484 | 187 | ||
| 485 | #define write_unlock_irqrestore(lock, flags) _write_unlock_irqrestore(lock, flags) | 188 | #define write_unlock_irqrestore(lock, flags) \ |
| 486 | #define write_unlock_irq(lock) _write_unlock_irq(lock) | 189 | _write_unlock_irqrestore(lock, flags) |
| 487 | #define write_unlock_bh(lock) _write_unlock_bh(lock) | 190 | #define write_unlock_irq(lock) _write_unlock_irq(lock) |
| 191 | #define write_unlock_bh(lock) _write_unlock_bh(lock) | ||
| 488 | 192 | ||
| 489 | #define spin_trylock_bh(lock) __cond_lock(_spin_trylock_bh(lock)) | 193 | #define spin_trylock_bh(lock) __cond_lock(_spin_trylock_bh(lock)) |
| 490 | 194 | ||
| 491 | #define spin_trylock_irq(lock) \ | 195 | #define spin_trylock_irq(lock) \ |
| 492 | ({ \ | 196 | ({ \ |
| 493 | local_irq_disable(); \ | 197 | local_irq_disable(); \ |
| 494 | _spin_trylock(lock) ? \ | 198 | _spin_trylock(lock) ? \ |
| 495 | 1 : ({local_irq_enable(); 0; }); \ | 199 | 1 : ({ local_irq_enable(); 0; }); \ |
| 496 | }) | 200 | }) |
| 497 | 201 | ||
| 498 | #define spin_trylock_irqsave(lock, flags) \ | 202 | #define spin_trylock_irqsave(lock, flags) \ |
| 499 | ({ \ | 203 | ({ \ |
| 500 | local_irq_save(flags); \ | 204 | local_irq_save(flags); \ |
| 501 | _spin_trylock(lock) ? \ | 205 | _spin_trylock(lock) ? \ |
| 502 | 1 : ({local_irq_restore(flags); 0;}); \ | 206 | 1 : ({ local_irq_restore(flags); 0; }); \ |
| 503 | }) | 207 | }) |
| 504 | 208 | ||
| 505 | #ifdef CONFIG_LOCKMETER | ||
| 506 | extern void _metered_spin_lock (spinlock_t *lock); | ||
| 507 | extern void _metered_spin_unlock (spinlock_t *lock); | ||
| 508 | extern int _metered_spin_trylock(spinlock_t *lock); | ||
| 509 | extern void _metered_read_lock (rwlock_t *lock); | ||
| 510 | extern void _metered_read_unlock (rwlock_t *lock); | ||
| 511 | extern void _metered_write_lock (rwlock_t *lock); | ||
| 512 | extern void _metered_write_unlock (rwlock_t *lock); | ||
| 513 | extern int _metered_read_trylock (rwlock_t *lock); | ||
| 514 | extern int _metered_write_trylock(rwlock_t *lock); | ||
| 515 | #endif | ||
| 516 | |||
| 517 | /* "lock on reference count zero" */ | ||
| 518 | #ifndef ATOMIC_DEC_AND_LOCK | ||
| 519 | #include <asm/atomic.h> | ||
| 520 | extern int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock); | ||
| 521 | #endif | ||
| 522 | |||
| 523 | #define atomic_dec_and_lock(atomic,lock) __cond_lock(_atomic_dec_and_lock(atomic,lock)) | ||
| 524 | |||
| 525 | /* | ||
| 526 | * bit-based spin_lock() | ||
| 527 | * | ||
| 528 | * Don't use this unless you really need to: spin_lock() and spin_unlock() | ||
| 529 | * are significantly faster. | ||
| 530 | */ | ||
| 531 | static inline void bit_spin_lock(int bitnum, unsigned long *addr) | ||
| 532 | { | ||
| 533 | /* | ||
| 534 | * Assuming the lock is uncontended, this never enters | ||
| 535 | * the body of the outer loop. If it is contended, then | ||
| 536 | * within the inner loop a non-atomic test is used to | ||
| 537 | * busywait with less bus contention for a good time to | ||
| 538 | * attempt to acquire the lock bit. | ||
| 539 | */ | ||
| 540 | preempt_disable(); | ||
| 541 | #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) | ||
| 542 | while (test_and_set_bit(bitnum, addr)) { | ||
| 543 | while (test_bit(bitnum, addr)) { | ||
| 544 | preempt_enable(); | ||
| 545 | cpu_relax(); | ||
| 546 | preempt_disable(); | ||
| 547 | } | ||
| 548 | } | ||
| 549 | #endif | ||
| 550 | __acquire(bitlock); | ||
| 551 | } | ||
| 552 | |||
| 553 | /* | 209 | /* |
| 554 | * Return true if it was acquired | 210 | * Pull the atomic_t declaration: |
| 211 | * (asm-mips/atomic.h needs above definitions) | ||
| 555 | */ | 212 | */ |
| 556 | static inline int bit_spin_trylock(int bitnum, unsigned long *addr) | 213 | #include <asm/atomic.h> |
| 557 | { | 214 | /** |
| 558 | preempt_disable(); | 215 | * atomic_dec_and_lock - lock on reaching reference count zero |
| 559 | #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) | 216 | * @atomic: the atomic counter |
| 560 | if (test_and_set_bit(bitnum, addr)) { | 217 | * @lock: the spinlock in question |
| 561 | preempt_enable(); | ||
| 562 | return 0; | ||
| 563 | } | ||
| 564 | #endif | ||
| 565 | __acquire(bitlock); | ||
| 566 | return 1; | ||
| 567 | } | ||
| 568 | |||
| 569 | /* | ||
| 570 | * bit-based spin_unlock() | ||
| 571 | */ | ||
| 572 | static inline void bit_spin_unlock(int bitnum, unsigned long *addr) | ||
| 573 | { | ||
| 574 | #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) | ||
| 575 | BUG_ON(!test_bit(bitnum, addr)); | ||
| 576 | smp_mb__before_clear_bit(); | ||
| 577 | clear_bit(bitnum, addr); | ||
| 578 | #endif | ||
| 579 | preempt_enable(); | ||
| 580 | __release(bitlock); | ||
| 581 | } | ||
| 582 | |||
| 583 | /* | ||
| 584 | * Return true if the lock is held. | ||
| 585 | */ | 218 | */ |
| 586 | static inline int bit_spin_is_locked(int bitnum, unsigned long *addr) | 219 | extern int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock); |
| 587 | { | 220 | #define atomic_dec_and_lock(atomic, lock) \ |
| 588 | #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) | 221 | __cond_lock(_atomic_dec_and_lock(atomic, lock)) |
| 589 | return test_bit(bitnum, addr); | ||
| 590 | #elif defined CONFIG_PREEMPT | ||
| 591 | return preempt_count(); | ||
| 592 | #else | ||
| 593 | return 1; | ||
| 594 | #endif | ||
| 595 | } | ||
| 596 | |||
| 597 | #define DEFINE_SPINLOCK(x) spinlock_t x = SPIN_LOCK_UNLOCKED | ||
| 598 | #define DEFINE_RWLOCK(x) rwlock_t x = RW_LOCK_UNLOCKED | ||
| 599 | 222 | ||
| 600 | /** | 223 | /** |
| 601 | * spin_can_lock - would spin_trylock() succeed? | 224 | * spin_can_lock - would spin_trylock() succeed? |
| 602 | * @lock: the spinlock in question. | 225 | * @lock: the spinlock in question. |
| 603 | */ | 226 | */ |
| 604 | #define spin_can_lock(lock) (!spin_is_locked(lock)) | 227 | #define spin_can_lock(lock) (!spin_is_locked(lock)) |
| 605 | 228 | ||
| 606 | #endif /* __LINUX_SPINLOCK_H */ | 229 | #endif /* __LINUX_SPINLOCK_H */ |
diff --git a/include/linux/spinlock_api_smp.h b/include/linux/spinlock_api_smp.h new file mode 100644 index 000000000000..78e6989ffb54 --- /dev/null +++ b/include/linux/spinlock_api_smp.h | |||
| @@ -0,0 +1,57 @@ | |||
| 1 | #ifndef __LINUX_SPINLOCK_API_SMP_H | ||
| 2 | #define __LINUX_SPINLOCK_API_SMP_H | ||
| 3 | |||
| 4 | #ifndef __LINUX_SPINLOCK_H | ||
| 5 | # error "please don't include this file directly" | ||
| 6 | #endif | ||
| 7 | |||
| 8 | /* | ||
| 9 | * include/linux/spinlock_api_smp.h | ||
| 10 | * | ||
| 11 | * spinlock API declarations on SMP (and debug) | ||
| 12 | * (implemented in kernel/spinlock.c) | ||
| 13 | * | ||
| 14 | * portions Copyright 2005, Red Hat, Inc., Ingo Molnar | ||
| 15 | * Released under the General Public License (GPL). | ||
| 16 | */ | ||
| 17 | |||
| 18 | int in_lock_functions(unsigned long addr); | ||
| 19 | |||
| 20 | #define assert_spin_locked(x) BUG_ON(!spin_is_locked(x)) | ||
| 21 | |||
| 22 | void __lockfunc _spin_lock(spinlock_t *lock) __acquires(spinlock_t); | ||
| 23 | void __lockfunc _read_lock(rwlock_t *lock) __acquires(rwlock_t); | ||
| 24 | void __lockfunc _write_lock(rwlock_t *lock) __acquires(rwlock_t); | ||
| 25 | void __lockfunc _spin_lock_bh(spinlock_t *lock) __acquires(spinlock_t); | ||
| 26 | void __lockfunc _read_lock_bh(rwlock_t *lock) __acquires(rwlock_t); | ||
| 27 | void __lockfunc _write_lock_bh(rwlock_t *lock) __acquires(rwlock_t); | ||
| 28 | void __lockfunc _spin_lock_irq(spinlock_t *lock) __acquires(spinlock_t); | ||
| 29 | void __lockfunc _read_lock_irq(rwlock_t *lock) __acquires(rwlock_t); | ||
| 30 | void __lockfunc _write_lock_irq(rwlock_t *lock) __acquires(rwlock_t); | ||
| 31 | unsigned long __lockfunc _spin_lock_irqsave(spinlock_t *lock) | ||
| 32 | __acquires(spinlock_t); | ||
| 33 | unsigned long __lockfunc _read_lock_irqsave(rwlock_t *lock) | ||
| 34 | __acquires(rwlock_t); | ||
| 35 | unsigned long __lockfunc _write_lock_irqsave(rwlock_t *lock) | ||
| 36 | __acquires(rwlock_t); | ||
| 37 | int __lockfunc _spin_trylock(spinlock_t *lock); | ||
| 38 | int __lockfunc _read_trylock(rwlock_t *lock); | ||
| 39 | int __lockfunc _write_trylock(rwlock_t *lock); | ||
| 40 | int __lockfunc _spin_trylock_bh(spinlock_t *lock); | ||
| 41 | void __lockfunc _spin_unlock(spinlock_t *lock) __releases(spinlock_t); | ||
| 42 | void __lockfunc _read_unlock(rwlock_t *lock) __releases(rwlock_t); | ||
| 43 | void __lockfunc _write_unlock(rwlock_t *lock) __releases(rwlock_t); | ||
| 44 | void __lockfunc _spin_unlock_bh(spinlock_t *lock) __releases(spinlock_t); | ||
| 45 | void __lockfunc _read_unlock_bh(rwlock_t *lock) __releases(rwlock_t); | ||
| 46 | void __lockfunc _write_unlock_bh(rwlock_t *lock) __releases(rwlock_t); | ||
| 47 | void __lockfunc _spin_unlock_irq(spinlock_t *lock) __releases(spinlock_t); | ||
| 48 | void __lockfunc _read_unlock_irq(rwlock_t *lock) __releases(rwlock_t); | ||
| 49 | void __lockfunc _write_unlock_irq(rwlock_t *lock) __releases(rwlock_t); | ||
| 50 | void __lockfunc _spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags) | ||
| 51 | __releases(spinlock_t); | ||
| 52 | void __lockfunc _read_unlock_irqrestore(rwlock_t *lock, unsigned long flags) | ||
| 53 | __releases(rwlock_t); | ||
| 54 | void __lockfunc _write_unlock_irqrestore(rwlock_t *lock, unsigned long flags) | ||
| 55 | __releases(rwlock_t); | ||
| 56 | |||
| 57 | #endif /* __LINUX_SPINLOCK_API_SMP_H */ | ||
diff --git a/include/linux/spinlock_api_up.h b/include/linux/spinlock_api_up.h new file mode 100644 index 000000000000..cd81cee566f4 --- /dev/null +++ b/include/linux/spinlock_api_up.h | |||
| @@ -0,0 +1,80 @@ | |||
| 1 | #ifndef __LINUX_SPINLOCK_API_UP_H | ||
| 2 | #define __LINUX_SPINLOCK_API_UP_H | ||
| 3 | |||
| 4 | #ifndef __LINUX_SPINLOCK_H | ||
| 5 | # error "please don't include this file directly" | ||
| 6 | #endif | ||
| 7 | |||
| 8 | /* | ||
| 9 | * include/linux/spinlock_api_up.h | ||
| 10 | * | ||
| 11 | * spinlock API implementation on UP-nondebug (inlined implementation) | ||
| 12 | * | ||
| 13 | * portions Copyright 2005, Red Hat, Inc., Ingo Molnar | ||
| 14 | * Released under the General Public License (GPL). | ||
| 15 | */ | ||
| 16 | |||
| 17 | #define in_lock_functions(ADDR) 0 | ||
| 18 | |||
| 19 | #define assert_spin_locked(lock) do { (void)(lock); } while (0) | ||
| 20 | |||
| 21 | /* | ||
| 22 | * In the UP-nondebug case there's no real locking going on, so the | ||
| 23 | * only thing we have to do is to keep the preempt counts and irq | ||
| 24 | * flags straight, to supress compiler warnings of unused lock | ||
| 25 | * variables, and to add the proper checker annotations: | ||
| 26 | */ | ||
| 27 | #define __LOCK(lock) \ | ||
| 28 | do { preempt_disable(); __acquire(lock); (void)(lock); } while (0) | ||
| 29 | |||
| 30 | #define __LOCK_BH(lock) \ | ||
| 31 | do { local_bh_disable(); __LOCK(lock); } while (0) | ||
| 32 | |||
| 33 | #define __LOCK_IRQ(lock) \ | ||
| 34 | do { local_irq_disable(); __LOCK(lock); } while (0) | ||
| 35 | |||
| 36 | #define __LOCK_IRQSAVE(lock, flags) \ | ||
| 37 | do { local_irq_save(flags); __LOCK(lock); } while (0) | ||
| 38 | |||
| 39 | #define __UNLOCK(lock) \ | ||
| 40 | do { preempt_enable(); __release(lock); (void)(lock); } while (0) | ||
| 41 | |||
| 42 | #define __UNLOCK_BH(lock) \ | ||
| 43 | do { preempt_enable_no_resched(); local_bh_enable(); __release(lock); (void)(lock); } while (0) | ||
| 44 | |||
| 45 | #define __UNLOCK_IRQ(lock) \ | ||
| 46 | do { local_irq_enable(); __UNLOCK(lock); } while (0) | ||
| 47 | |||
| 48 | #define __UNLOCK_IRQRESTORE(lock, flags) \ | ||
| 49 | do { local_irq_restore(flags); __UNLOCK(lock); } while (0) | ||
| 50 | |||
| 51 | #define _spin_lock(lock) __LOCK(lock) | ||
| 52 | #define _read_lock(lock) __LOCK(lock) | ||
| 53 | #define _write_lock(lock) __LOCK(lock) | ||
| 54 | #define _spin_lock_bh(lock) __LOCK_BH(lock) | ||
| 55 | #define _read_lock_bh(lock) __LOCK_BH(lock) | ||
| 56 | #define _write_lock_bh(lock) __LOCK_BH(lock) | ||
| 57 | #define _spin_lock_irq(lock) __LOCK_IRQ(lock) | ||
| 58 | #define _read_lock_irq(lock) __LOCK_IRQ(lock) | ||
| 59 | #define _write_lock_irq(lock) __LOCK_IRQ(lock) | ||
| 60 | #define _spin_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags) | ||
| 61 | #define _read_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags) | ||
| 62 | #define _write_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags) | ||
| 63 | #define _spin_trylock(lock) ({ __LOCK(lock); 1; }) | ||
| 64 | #define _read_trylock(lock) ({ __LOCK(lock); 1; }) | ||
| 65 | #define _write_trylock(lock) ({ __LOCK(lock); 1; }) | ||
| 66 | #define _spin_trylock_bh(lock) ({ __LOCK_BH(lock); 1; }) | ||
| 67 | #define _spin_unlock(lock) __UNLOCK(lock) | ||
| 68 | #define _read_unlock(lock) __UNLOCK(lock) | ||
| 69 | #define _write_unlock(lock) __UNLOCK(lock) | ||
| 70 | #define _spin_unlock_bh(lock) __UNLOCK_BH(lock) | ||
| 71 | #define _write_unlock_bh(lock) __UNLOCK_BH(lock) | ||
| 72 | #define _read_unlock_bh(lock) __UNLOCK_BH(lock) | ||
| 73 | #define _spin_unlock_irq(lock) __UNLOCK_IRQ(lock) | ||
| 74 | #define _read_unlock_irq(lock) __UNLOCK_IRQ(lock) | ||
| 75 | #define _write_unlock_irq(lock) __UNLOCK_IRQ(lock) | ||
| 76 | #define _spin_unlock_irqrestore(lock, flags) __UNLOCK_IRQRESTORE(lock, flags) | ||
| 77 | #define _read_unlock_irqrestore(lock, flags) __UNLOCK_IRQRESTORE(lock, flags) | ||
| 78 | #define _write_unlock_irqrestore(lock, flags) __UNLOCK_IRQRESTORE(lock, flags) | ||
| 79 | |||
| 80 | #endif /* __LINUX_SPINLOCK_API_UP_H */ | ||
diff --git a/include/linux/spinlock_types.h b/include/linux/spinlock_types.h new file mode 100644 index 000000000000..9cb51e070390 --- /dev/null +++ b/include/linux/spinlock_types.h | |||
| @@ -0,0 +1,67 @@ | |||
| 1 | #ifndef __LINUX_SPINLOCK_TYPES_H | ||
| 2 | #define __LINUX_SPINLOCK_TYPES_H | ||
| 3 | |||
| 4 | /* | ||
| 5 | * include/linux/spinlock_types.h - generic spinlock type definitions | ||
| 6 | * and initializers | ||
| 7 | * | ||
| 8 | * portions Copyright 2005, Red Hat, Inc., Ingo Molnar | ||
| 9 | * Released under the General Public License (GPL). | ||
| 10 | */ | ||
| 11 | |||
| 12 | #if defined(CONFIG_SMP) | ||
| 13 | # include <asm/spinlock_types.h> | ||
| 14 | #else | ||
| 15 | # include <linux/spinlock_types_up.h> | ||
| 16 | #endif | ||
| 17 | |||
| 18 | typedef struct { | ||
| 19 | raw_spinlock_t raw_lock; | ||
| 20 | #if defined(CONFIG_PREEMPT) && defined(CONFIG_SMP) | ||
| 21 | unsigned int break_lock; | ||
| 22 | #endif | ||
| 23 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
| 24 | unsigned int magic, owner_cpu; | ||
| 25 | void *owner; | ||
| 26 | #endif | ||
| 27 | } spinlock_t; | ||
| 28 | |||
| 29 | #define SPINLOCK_MAGIC 0xdead4ead | ||
| 30 | |||
| 31 | typedef struct { | ||
| 32 | raw_rwlock_t raw_lock; | ||
| 33 | #if defined(CONFIG_PREEMPT) && defined(CONFIG_SMP) | ||
| 34 | unsigned int break_lock; | ||
| 35 | #endif | ||
| 36 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
| 37 | unsigned int magic, owner_cpu; | ||
| 38 | void *owner; | ||
| 39 | #endif | ||
| 40 | } rwlock_t; | ||
| 41 | |||
| 42 | #define RWLOCK_MAGIC 0xdeaf1eed | ||
| 43 | |||
| 44 | #define SPINLOCK_OWNER_INIT ((void *)-1L) | ||
| 45 | |||
| 46 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
| 47 | # define SPIN_LOCK_UNLOCKED \ | ||
| 48 | (spinlock_t) { .raw_lock = __RAW_SPIN_LOCK_UNLOCKED, \ | ||
| 49 | .magic = SPINLOCK_MAGIC, \ | ||
| 50 | .owner = SPINLOCK_OWNER_INIT, \ | ||
| 51 | .owner_cpu = -1 } | ||
| 52 | #define RW_LOCK_UNLOCKED \ | ||
| 53 | (rwlock_t) { .raw_lock = __RAW_RW_LOCK_UNLOCKED, \ | ||
| 54 | .magic = RWLOCK_MAGIC, \ | ||
| 55 | .owner = SPINLOCK_OWNER_INIT, \ | ||
| 56 | .owner_cpu = -1 } | ||
| 57 | #else | ||
| 58 | # define SPIN_LOCK_UNLOCKED \ | ||
| 59 | (spinlock_t) { .raw_lock = __RAW_SPIN_LOCK_UNLOCKED } | ||
| 60 | #define RW_LOCK_UNLOCKED \ | ||
| 61 | (rwlock_t) { .raw_lock = __RAW_RW_LOCK_UNLOCKED } | ||
| 62 | #endif | ||
| 63 | |||
| 64 | #define DEFINE_SPINLOCK(x) spinlock_t x = SPIN_LOCK_UNLOCKED | ||
| 65 | #define DEFINE_RWLOCK(x) rwlock_t x = RW_LOCK_UNLOCKED | ||
| 66 | |||
| 67 | #endif /* __LINUX_SPINLOCK_TYPES_H */ | ||
diff --git a/include/linux/spinlock_types_up.h b/include/linux/spinlock_types_up.h new file mode 100644 index 000000000000..def2d173a8db --- /dev/null +++ b/include/linux/spinlock_types_up.h | |||
| @@ -0,0 +1,51 @@ | |||
| 1 | #ifndef __LINUX_SPINLOCK_TYPES_UP_H | ||
| 2 | #define __LINUX_SPINLOCK_TYPES_UP_H | ||
| 3 | |||
| 4 | #ifndef __LINUX_SPINLOCK_TYPES_H | ||
| 5 | # error "please don't include this file directly" | ||
| 6 | #endif | ||
| 7 | |||
| 8 | /* | ||
| 9 | * include/linux/spinlock_types_up.h - spinlock type definitions for UP | ||
| 10 | * | ||
| 11 | * portions Copyright 2005, Red Hat, Inc., Ingo Molnar | ||
| 12 | * Released under the General Public License (GPL). | ||
| 13 | */ | ||
| 14 | |||
| 15 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
| 16 | |||
| 17 | typedef struct { | ||
| 18 | volatile unsigned int slock; | ||
| 19 | } raw_spinlock_t; | ||
| 20 | |||
| 21 | #define __RAW_SPIN_LOCK_UNLOCKED { 1 } | ||
| 22 | |||
| 23 | #else | ||
| 24 | |||
| 25 | /* | ||
| 26 | * All gcc 2.95 versions and early versions of 2.96 have a nasty bug | ||
| 27 | * with empty initializers. | ||
| 28 | */ | ||
| 29 | #if (__GNUC__ > 2) | ||
| 30 | typedef struct { } raw_spinlock_t; | ||
| 31 | |||
| 32 | #define __RAW_SPIN_LOCK_UNLOCKED { } | ||
| 33 | #else | ||
| 34 | typedef struct { int gcc_is_buggy; } raw_spinlock_t; | ||
| 35 | #define __RAW_SPIN_LOCK_UNLOCKED (raw_spinlock_t) { 0 } | ||
| 36 | #endif | ||
| 37 | |||
| 38 | #endif | ||
| 39 | |||
| 40 | #if (__GNUC__ > 2) | ||
| 41 | typedef struct { | ||
| 42 | /* no debug version on UP */ | ||
| 43 | } raw_rwlock_t; | ||
| 44 | |||
| 45 | #define __RAW_RW_LOCK_UNLOCKED { } | ||
| 46 | #else | ||
| 47 | typedef struct { int gcc_is_buggy; } raw_rwlock_t; | ||
| 48 | #define __RAW_RW_LOCK_UNLOCKED (raw_rwlock_t) { 0 } | ||
| 49 | #endif | ||
| 50 | |||
| 51 | #endif /* __LINUX_SPINLOCK_TYPES_UP_H */ | ||
diff --git a/include/linux/spinlock_up.h b/include/linux/spinlock_up.h new file mode 100644 index 000000000000..31accf2f0b13 --- /dev/null +++ b/include/linux/spinlock_up.h | |||
| @@ -0,0 +1,74 @@ | |||
| 1 | #ifndef __LINUX_SPINLOCK_UP_H | ||
| 2 | #define __LINUX_SPINLOCK_UP_H | ||
| 3 | |||
| 4 | #ifndef __LINUX_SPINLOCK_H | ||
| 5 | # error "please don't include this file directly" | ||
| 6 | #endif | ||
| 7 | |||
| 8 | /* | ||
| 9 | * include/linux/spinlock_up.h - UP-debug version of spinlocks. | ||
| 10 | * | ||
| 11 | * portions Copyright 2005, Red Hat, Inc., Ingo Molnar | ||
| 12 | * Released under the General Public License (GPL). | ||
| 13 | * | ||
| 14 | * In the debug case, 1 means unlocked, 0 means locked. (the values | ||
| 15 | * are inverted, to catch initialization bugs) | ||
| 16 | * | ||
| 17 | * No atomicity anywhere, we are on UP. | ||
| 18 | */ | ||
| 19 | |||
| 20 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
| 21 | |||
| 22 | #define __raw_spin_is_locked(x) ((x)->slock == 0) | ||
| 23 | |||
| 24 | static inline void __raw_spin_lock(raw_spinlock_t *lock) | ||
| 25 | { | ||
| 26 | lock->slock = 0; | ||
| 27 | } | ||
| 28 | |||
| 29 | static inline void | ||
| 30 | __raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long flags) | ||
| 31 | { | ||
| 32 | local_irq_save(flags); | ||
| 33 | lock->slock = 0; | ||
| 34 | } | ||
| 35 | |||
| 36 | static inline int __raw_spin_trylock(raw_spinlock_t *lock) | ||
| 37 | { | ||
| 38 | char oldval = lock->slock; | ||
| 39 | |||
| 40 | lock->slock = 0; | ||
| 41 | |||
| 42 | return oldval > 0; | ||
| 43 | } | ||
| 44 | |||
| 45 | static inline void __raw_spin_unlock(raw_spinlock_t *lock) | ||
| 46 | { | ||
| 47 | lock->slock = 1; | ||
| 48 | } | ||
| 49 | |||
| 50 | /* | ||
| 51 | * Read-write spinlocks. No debug version. | ||
| 52 | */ | ||
| 53 | #define __raw_read_lock(lock) do { (void)(lock); } while (0) | ||
| 54 | #define __raw_write_lock(lock) do { (void)(lock); } while (0) | ||
| 55 | #define __raw_read_trylock(lock) ({ (void)(lock); 1; }) | ||
| 56 | #define __raw_write_trylock(lock) ({ (void)(lock); 1; }) | ||
| 57 | #define __raw_read_unlock(lock) do { (void)(lock); } while (0) | ||
| 58 | #define __raw_write_unlock(lock) do { (void)(lock); } while (0) | ||
| 59 | |||
| 60 | #else /* DEBUG_SPINLOCK */ | ||
| 61 | #define __raw_spin_is_locked(lock) ((void)(lock), 0) | ||
| 62 | /* for sched.c and kernel_lock.c: */ | ||
| 63 | # define __raw_spin_lock(lock) do { (void)(lock); } while (0) | ||
| 64 | # define __raw_spin_unlock(lock) do { (void)(lock); } while (0) | ||
| 65 | # define __raw_spin_trylock(lock) ({ (void)(lock); 1; }) | ||
| 66 | #endif /* DEBUG_SPINLOCK */ | ||
| 67 | |||
| 68 | #define __raw_read_can_lock(lock) (((void)(lock), 1)) | ||
| 69 | #define __raw_write_can_lock(lock) (((void)(lock), 1)) | ||
| 70 | |||
| 71 | #define __raw_spin_unlock_wait(lock) \ | ||
| 72 | do { cpu_relax(); } while (__raw_spin_is_locked(lock)) | ||
| 73 | |||
| 74 | #endif /* __LINUX_SPINLOCK_UP_H */ | ||
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index 532a6c5c24e9..3a29a9f9b451 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h | |||
| @@ -544,7 +544,8 @@ enum { | |||
| 544 | NET_NETROM_TRANSPORT_REQUESTED_WINDOW_SIZE=8, | 544 | NET_NETROM_TRANSPORT_REQUESTED_WINDOW_SIZE=8, |
| 545 | NET_NETROM_TRANSPORT_NO_ACTIVITY_TIMEOUT=9, | 545 | NET_NETROM_TRANSPORT_NO_ACTIVITY_TIMEOUT=9, |
| 546 | NET_NETROM_ROUTING_CONTROL=10, | 546 | NET_NETROM_ROUTING_CONTROL=10, |
| 547 | NET_NETROM_LINK_FAILS_COUNT=11 | 547 | NET_NETROM_LINK_FAILS_COUNT=11, |
| 548 | NET_NETROM_RESET=12 | ||
| 548 | }; | 549 | }; |
| 549 | 550 | ||
| 550 | /* /proc/sys/net/ax25 */ | 551 | /* /proc/sys/net/ax25 */ |
diff --git a/include/linux/time.h b/include/linux/time.h index c10d4c21c183..8e83f4e778bb 100644 --- a/include/linux/time.h +++ b/include/linux/time.h | |||
| @@ -28,17 +28,10 @@ struct timezone { | |||
| 28 | #ifdef __KERNEL__ | 28 | #ifdef __KERNEL__ |
| 29 | 29 | ||
| 30 | /* Parameters used to convert the timespec values */ | 30 | /* Parameters used to convert the timespec values */ |
| 31 | #ifndef USEC_PER_SEC | 31 | #define MSEC_PER_SEC (1000L) |
| 32 | #define USEC_PER_SEC (1000000L) | 32 | #define USEC_PER_SEC (1000000L) |
| 33 | #endif | ||
| 34 | |||
| 35 | #ifndef NSEC_PER_SEC | ||
| 36 | #define NSEC_PER_SEC (1000000000L) | 33 | #define NSEC_PER_SEC (1000000000L) |
| 37 | #endif | ||
| 38 | |||
| 39 | #ifndef NSEC_PER_USEC | ||
| 40 | #define NSEC_PER_USEC (1000L) | 34 | #define NSEC_PER_USEC (1000L) |
| 41 | #endif | ||
| 42 | 35 | ||
| 43 | static __inline__ int timespec_equal(struct timespec *a, struct timespec *b) | 36 | static __inline__ int timespec_equal(struct timespec *a, struct timespec *b) |
| 44 | { | 37 | { |
diff --git a/include/linux/timer.h b/include/linux/timer.h index 221f81ac2002..3340f3bd135d 100644 --- a/include/linux/timer.h +++ b/include/linux/timer.h | |||
| @@ -32,6 +32,10 @@ extern struct timer_base_s __init_timer_base; | |||
| 32 | .magic = TIMER_MAGIC, \ | 32 | .magic = TIMER_MAGIC, \ |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | #define DEFINE_TIMER(_name, _function, _expires, _data) \ | ||
| 36 | struct timer_list _name = \ | ||
| 37 | TIMER_INITIALIZER(_function, _expires, _data) | ||
| 38 | |||
| 35 | void fastcall init_timer(struct timer_list * timer); | 39 | void fastcall init_timer(struct timer_list * timer); |
| 36 | 40 | ||
| 37 | /*** | 41 | /*** |
diff --git a/include/linux/tty.h b/include/linux/tty.h index 59ff42c629ec..1267f88ece6e 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h | |||
| @@ -74,7 +74,8 @@ struct screen_info { | |||
| 74 | u16 vesapm_off; /* 0x30 */ | 74 | u16 vesapm_off; /* 0x30 */ |
| 75 | u16 pages; /* 0x32 */ | 75 | u16 pages; /* 0x32 */ |
| 76 | u16 vesa_attributes; /* 0x34 */ | 76 | u16 vesa_attributes; /* 0x34 */ |
| 77 | /* 0x36 -- 0x3f reserved for future expansion */ | 77 | u32 capabilities; /* 0x36 */ |
| 78 | /* 0x3a -- 0x3f reserved for future expansion */ | ||
| 78 | }; | 79 | }; |
| 79 | 80 | ||
| 80 | extern struct screen_info screen_info; | 81 | extern struct screen_info screen_info; |
diff --git a/include/linux/usb.h b/include/linux/usb.h index 724637792996..4dbe580f9335 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | #include <linux/usb_ch9.h> | 5 | #include <linux/usb_ch9.h> |
| 6 | 6 | ||
| 7 | #define USB_MAJOR 180 | 7 | #define USB_MAJOR 180 |
| 8 | #define USB_DEVICE_MAJOR 189 | ||
| 8 | 9 | ||
| 9 | 10 | ||
| 10 | #ifdef __KERNEL__ | 11 | #ifdef __KERNEL__ |
| @@ -349,6 +350,7 @@ struct usb_device { | |||
| 349 | char *manufacturer; | 350 | char *manufacturer; |
| 350 | char *serial; /* static strings from the device */ | 351 | char *serial; /* static strings from the device */ |
| 351 | struct list_head filelist; | 352 | struct list_head filelist; |
| 353 | struct class_device *class_dev; | ||
| 352 | struct dentry *usbfs_dentry; /* usbfs dentry entry for the device */ | 354 | struct dentry *usbfs_dentry; /* usbfs dentry entry for the device */ |
| 353 | 355 | ||
| 354 | /* | 356 | /* |
| @@ -614,7 +616,6 @@ extern int usb_disabled(void); | |||
| 614 | #define URB_ISO_ASAP 0x0002 /* iso-only, urb->start_frame ignored */ | 616 | #define URB_ISO_ASAP 0x0002 /* iso-only, urb->start_frame ignored */ |
| 615 | #define URB_NO_TRANSFER_DMA_MAP 0x0004 /* urb->transfer_dma valid on submit */ | 617 | #define URB_NO_TRANSFER_DMA_MAP 0x0004 /* urb->transfer_dma valid on submit */ |
| 616 | #define URB_NO_SETUP_DMA_MAP 0x0008 /* urb->setup_dma valid on submit */ | 618 | #define URB_NO_SETUP_DMA_MAP 0x0008 /* urb->setup_dma valid on submit */ |
| 617 | #define URB_ASYNC_UNLINK 0x0010 /* usb_unlink_urb() returns asap */ | ||
| 618 | #define URB_NO_FSBR 0x0020 /* UHCI-specific */ | 619 | #define URB_NO_FSBR 0x0020 /* UHCI-specific */ |
| 619 | #define URB_ZERO_PACKET 0x0040 /* Finish bulk OUTs with short packet */ | 620 | #define URB_ZERO_PACKET 0x0040 /* Finish bulk OUTs with short packet */ |
| 620 | #define URB_NO_INTERRUPT 0x0080 /* HINT: no non-error interrupt needed */ | 621 | #define URB_NO_INTERRUPT 0x0080 /* HINT: no non-error interrupt needed */ |
| @@ -722,13 +723,7 @@ typedef void (*usb_complete_t)(struct urb *, struct pt_regs *); | |||
| 722 | * Initialization: | 723 | * Initialization: |
| 723 | * | 724 | * |
| 724 | * All URBs submitted must initialize the dev, pipe, transfer_flags (may be | 725 | * All URBs submitted must initialize the dev, pipe, transfer_flags (may be |
| 725 | * zero), and complete fields. | 726 | * zero), and complete fields. All URBs must also initialize |
| 726 | * The URB_ASYNC_UNLINK transfer flag affects later invocations of | ||
| 727 | * the usb_unlink_urb() routine. Note: Failure to set URB_ASYNC_UNLINK | ||
| 728 | * with usb_unlink_urb() is deprecated. For synchronous unlinks use | ||
| 729 | * usb_kill_urb() instead. | ||
| 730 | * | ||
| 731 | * All URBs must also initialize | ||
| 732 | * transfer_buffer and transfer_buffer_length. They may provide the | 727 | * transfer_buffer and transfer_buffer_length. They may provide the |
| 733 | * URB_SHORT_NOT_OK transfer flag, indicating that short reads are | 728 | * URB_SHORT_NOT_OK transfer flag, indicating that short reads are |
| 734 | * to be treated as errors; that flag is invalid for write requests. | 729 | * to be treated as errors; that flag is invalid for write requests. |
diff --git a/include/linux/usb_isp116x.h b/include/linux/usb_isp116x.h index 5f5a9d9bd6c2..436dd8a2b64a 100644 --- a/include/linux/usb_isp116x.h +++ b/include/linux/usb_isp116x.h | |||
| @@ -7,36 +7,18 @@ | |||
| 7 | struct isp116x_platform_data { | 7 | struct isp116x_platform_data { |
| 8 | /* Enable internal resistors on downstream ports */ | 8 | /* Enable internal resistors on downstream ports */ |
| 9 | unsigned sel15Kres:1; | 9 | unsigned sel15Kres:1; |
| 10 | /* Chip's internal clock won't be stopped in suspended state. | 10 | /* On-chip overcurrent detection */ |
| 11 | Setting/unsetting this bit takes effect only if | ||
| 12 | 'remote_wakeup_enable' below is not set. */ | ||
| 13 | unsigned clknotstop:1; | ||
| 14 | /* On-chip overcurrent protection */ | ||
| 15 | unsigned oc_enable:1; | 11 | unsigned oc_enable:1; |
| 16 | /* INT output polarity */ | 12 | /* INT output polarity */ |
| 17 | unsigned int_act_high:1; | 13 | unsigned int_act_high:1; |
| 18 | /* INT edge or level triggered */ | 14 | /* INT edge or level triggered */ |
| 19 | unsigned int_edge_triggered:1; | 15 | unsigned int_edge_triggered:1; |
| 20 | /* WAKEUP pin connected - NOT SUPPORTED */ | 16 | /* Enable wakeup by devices on usb bus (e.g. wakeup |
| 21 | /* unsigned remote_wakeup_connected:1; */ | 17 | by attachment/detachment or by device activity |
| 22 | /* Wakeup by devices on usb bus enabled */ | 18 | such as moving a mouse). When chosen, this option |
| 19 | prevents stopping internal clock, increasing | ||
| 20 | thereby power consumption in suspended state. */ | ||
| 23 | unsigned remote_wakeup_enable:1; | 21 | unsigned remote_wakeup_enable:1; |
| 24 | /* Switch or not to switch (keep always powered) */ | ||
| 25 | unsigned no_power_switching:1; | ||
| 26 | /* Ganged port power switching (0) or individual port | ||
| 27 | power switching (1) */ | ||
| 28 | unsigned power_switching_mode:1; | ||
| 29 | /* Given port_power, msec/2 after power on till power good */ | ||
| 30 | u8 potpg; | ||
| 31 | /* Hardware reset set/clear. If implemented, this function must: | ||
| 32 | if set == 0, deassert chip's HW reset pin | ||
| 33 | otherwise, assert chip's HW reset pin */ | ||
| 34 | void (*reset) (struct device * dev, int set); | ||
| 35 | /* Hardware clock start/stop. If implemented, this function must: | ||
| 36 | if start == 0, stop the external clock | ||
| 37 | otherwise, start the external clock | ||
| 38 | */ | ||
| 39 | void (*clock) (struct device * dev, int start); | ||
| 40 | /* Inter-io delay (ns). The chip is picky about access timings; it | 22 | /* Inter-io delay (ns). The chip is picky about access timings; it |
| 41 | expects at least: | 23 | expects at least: |
| 42 | 150ns delay between consecutive accesses to DATA_REG, | 24 | 150ns delay between consecutive accesses to DATA_REG, |
diff --git a/include/linux/usbdevice_fs.h b/include/linux/usbdevice_fs.h index fb57c2217468..9facf733800c 100644 --- a/include/linux/usbdevice_fs.h +++ b/include/linux/usbdevice_fs.h | |||
| @@ -32,7 +32,6 @@ | |||
| 32 | #define _LINUX_USBDEVICE_FS_H | 32 | #define _LINUX_USBDEVICE_FS_H |
| 33 | 33 | ||
| 34 | #include <linux/types.h> | 34 | #include <linux/types.h> |
| 35 | #include <linux/compat.h> | ||
| 36 | 35 | ||
| 37 | /* --------------------------------------------------------------------- */ | 36 | /* --------------------------------------------------------------------- */ |
| 38 | 37 | ||
| @@ -125,6 +124,7 @@ struct usbdevfs_hub_portinfo { | |||
| 125 | }; | 124 | }; |
| 126 | 125 | ||
| 127 | #ifdef CONFIG_COMPAT | 126 | #ifdef CONFIG_COMPAT |
| 127 | #include <linux/compat.h> | ||
| 128 | struct usbdevfs_urb32 { | 128 | struct usbdevfs_urb32 { |
| 129 | unsigned char type; | 129 | unsigned char type; |
| 130 | unsigned char endpoint; | 130 | unsigned char endpoint; |
diff --git a/include/linux/videodev.h b/include/linux/videodev.h index 9d6fbde3d29c..1cc8c31b7988 100644 --- a/include/linux/videodev.h +++ b/include/linux/videodev.h | |||
| @@ -3,7 +3,6 @@ | |||
| 3 | 3 | ||
| 4 | #include <linux/compiler.h> | 4 | #include <linux/compiler.h> |
| 5 | #include <linux/types.h> | 5 | #include <linux/types.h> |
| 6 | #include <linux/version.h> | ||
| 7 | 6 | ||
| 8 | #define HAVE_V4L2 1 | 7 | #define HAVE_V4L2 1 |
| 9 | #include <linux/videodev2.h> | 8 | #include <linux/videodev2.h> |
| @@ -29,7 +28,6 @@ struct video_device | |||
| 29 | void (*release)(struct video_device *vfd); | 28 | void (*release)(struct video_device *vfd); |
| 30 | 29 | ||
| 31 | 30 | ||
| 32 | #if 1 /* to be removed in 2.7.x */ | ||
| 33 | /* obsolete -- fops->owner is used instead */ | 31 | /* obsolete -- fops->owner is used instead */ |
| 34 | struct module *owner; | 32 | struct module *owner; |
| 35 | /* dev->driver_data will be used instead some day. | 33 | /* dev->driver_data will be used instead some day. |
| @@ -37,7 +35,6 @@ struct video_device | |||
| 37 | * so the switch over will be transparent for you. | 35 | * so the switch over will be transparent for you. |
| 38 | * Or use {pci|usb}_{get|set}_drvdata() directly. */ | 36 | * Or use {pci|usb}_{get|set}_drvdata() directly. */ |
| 39 | void *priv; | 37 | void *priv; |
| 40 | #endif | ||
| 41 | 38 | ||
| 42 | /* for videodev.c intenal usage -- please don't touch */ | 39 | /* for videodev.c intenal usage -- please don't touch */ |
| 43 | int users; /* video_exclusive_{open|close} ... */ | 40 | int users; /* video_exclusive_{open|close} ... */ |
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index acbfc525576d..f623a33b9abe 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h | |||
| @@ -270,7 +270,6 @@ struct v4l2_timecode | |||
| 270 | /* The above is based on SMPTE timecodes */ | 270 | /* The above is based on SMPTE timecodes */ |
| 271 | 271 | ||
| 272 | 272 | ||
| 273 | #if 1 | ||
| 274 | /* | 273 | /* |
| 275 | * M P E G C O M P R E S S I O N P A R A M E T E R S | 274 | * M P E G C O M P R E S S I O N P A R A M E T E R S |
| 276 | * | 275 | * |
| @@ -357,7 +356,6 @@ struct v4l2_mpeg_compression { | |||
| 357 | /* I don't expect the above being perfect yet ;) */ | 356 | /* I don't expect the above being perfect yet ;) */ |
| 358 | __u32 reserved_5[8]; | 357 | __u32 reserved_5[8]; |
| 359 | }; | 358 | }; |
| 360 | #endif | ||
| 361 | 359 | ||
| 362 | struct v4l2_jpegcompression | 360 | struct v4l2_jpegcompression |
| 363 | { | 361 | { |
| @@ -871,10 +869,8 @@ struct v4l2_streamparm | |||
| 871 | #define VIDIOC_ENUM_FMT _IOWR ('V', 2, struct v4l2_fmtdesc) | 869 | #define VIDIOC_ENUM_FMT _IOWR ('V', 2, struct v4l2_fmtdesc) |
| 872 | #define VIDIOC_G_FMT _IOWR ('V', 4, struct v4l2_format) | 870 | #define VIDIOC_G_FMT _IOWR ('V', 4, struct v4l2_format) |
| 873 | #define VIDIOC_S_FMT _IOWR ('V', 5, struct v4l2_format) | 871 | #define VIDIOC_S_FMT _IOWR ('V', 5, struct v4l2_format) |
| 874 | #if 1 /* experimental */ | ||
| 875 | #define VIDIOC_G_MPEGCOMP _IOR ('V', 6, struct v4l2_mpeg_compression) | 872 | #define VIDIOC_G_MPEGCOMP _IOR ('V', 6, struct v4l2_mpeg_compression) |
| 876 | #define VIDIOC_S_MPEGCOMP _IOW ('V', 7, struct v4l2_mpeg_compression) | 873 | #define VIDIOC_S_MPEGCOMP _IOW ('V', 7, struct v4l2_mpeg_compression) |
| 877 | #endif | ||
| 878 | #define VIDIOC_REQBUFS _IOWR ('V', 8, struct v4l2_requestbuffers) | 874 | #define VIDIOC_REQBUFS _IOWR ('V', 8, struct v4l2_requestbuffers) |
| 879 | #define VIDIOC_QUERYBUF _IOWR ('V', 9, struct v4l2_buffer) | 875 | #define VIDIOC_QUERYBUF _IOWR ('V', 9, struct v4l2_buffer) |
| 880 | #define VIDIOC_G_FBUF _IOR ('V', 10, struct v4l2_framebuffer) | 876 | #define VIDIOC_G_FBUF _IOR ('V', 10, struct v4l2_framebuffer) |
diff --git a/include/linux/writeback.h b/include/linux/writeback.h index 542dbaee6512..343d883d69c5 100644 --- a/include/linux/writeback.h +++ b/include/linux/writeback.h | |||
| @@ -109,8 +109,6 @@ int pdflush_operation(void (*fn)(unsigned long), unsigned long arg0); | |||
| 109 | int do_writepages(struct address_space *mapping, struct writeback_control *wbc); | 109 | int do_writepages(struct address_space *mapping, struct writeback_control *wbc); |
| 110 | int sync_page_range(struct inode *inode, struct address_space *mapping, | 110 | int sync_page_range(struct inode *inode, struct address_space *mapping, |
| 111 | loff_t pos, size_t count); | 111 | loff_t pos, size_t count); |
| 112 | int sync_page_range_nolock(struct inode *inode, struct address_space | ||
| 113 | *mapping, loff_t pos, size_t count); | ||
| 114 | 112 | ||
| 115 | /* pdflush.c */ | 113 | /* pdflush.c */ |
| 116 | extern int nr_pdflush_threads; /* Global so it can be exported to sysctl | 114 | extern int nr_pdflush_threads; /* Global so it can be exported to sysctl |
