diff options
| author | Ingo Molnar <mingo@elte.hu> | 2008-10-27 05:50:54 -0400 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2008-10-27 05:50:54 -0400 |
| commit | 4944dd62de21230af039eda7cd218e9a09021d11 (patch) | |
| tree | bac70f7bab8506c7e1b0408bacbdb0b1d77262e9 /include/linux | |
| parent | f17845e5d97ead8fbdadfd40039e058ec7cf4a42 (diff) | |
| parent | 0173a3265b228da319ceb9c1ec6a5682fd1b2d92 (diff) | |
Merge commit 'v2.6.28-rc2' into tracing/urgent
Diffstat (limited to 'include/linux')
64 files changed, 4014 insertions, 273 deletions
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 702f79dad16a..fd6a452b0ceb 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
| @@ -94,18 +94,10 @@ int acpi_parse_mcfg (struct acpi_table_header *header); | |||
| 94 | void acpi_table_print_madt_entry (struct acpi_subtable_header *madt); | 94 | void acpi_table_print_madt_entry (struct acpi_subtable_header *madt); |
| 95 | 95 | ||
| 96 | /* the following four functions are architecture-dependent */ | 96 | /* the following four functions are architecture-dependent */ |
| 97 | #ifdef CONFIG_HAVE_ARCH_PARSE_SRAT | ||
| 98 | #define NR_NODE_MEMBLKS MAX_NUMNODES | ||
| 99 | #define acpi_numa_slit_init(slit) do {} while (0) | ||
| 100 | #define acpi_numa_processor_affinity_init(pa) do {} while (0) | ||
| 101 | #define acpi_numa_memory_affinity_init(ma) do {} while (0) | ||
| 102 | #define acpi_numa_arch_fixup() do {} while (0) | ||
| 103 | #else | ||
| 104 | void acpi_numa_slit_init (struct acpi_table_slit *slit); | 97 | void acpi_numa_slit_init (struct acpi_table_slit *slit); |
| 105 | void acpi_numa_processor_affinity_init (struct acpi_srat_cpu_affinity *pa); | 98 | void acpi_numa_processor_affinity_init (struct acpi_srat_cpu_affinity *pa); |
| 106 | void acpi_numa_memory_affinity_init (struct acpi_srat_mem_affinity *ma); | 99 | void acpi_numa_memory_affinity_init (struct acpi_srat_mem_affinity *ma); |
| 107 | void acpi_numa_arch_fixup(void); | 100 | void acpi_numa_arch_fixup(void); |
| 108 | #endif | ||
| 109 | 101 | ||
| 110 | #ifdef CONFIG_ACPI_HOTPLUG_CPU | 102 | #ifdef CONFIG_ACPI_HOTPLUG_CPU |
| 111 | /* Arch dependent functions for cpu hotplug support */ | 103 | /* Arch dependent functions for cpu hotplug support */ |
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h index 1abfe664c444..a08c33a26ca9 100644 --- a/include/linux/bitmap.h +++ b/include/linux/bitmap.h | |||
| @@ -129,6 +129,7 @@ extern void bitmap_fold(unsigned long *dst, const unsigned long *orig, | |||
| 129 | extern int bitmap_find_free_region(unsigned long *bitmap, int bits, int order); | 129 | extern int bitmap_find_free_region(unsigned long *bitmap, int bits, int order); |
| 130 | extern void bitmap_release_region(unsigned long *bitmap, int pos, int order); | 130 | extern void bitmap_release_region(unsigned long *bitmap, int pos, int order); |
| 131 | extern int bitmap_allocate_region(unsigned long *bitmap, int pos, int order); | 131 | extern int bitmap_allocate_region(unsigned long *bitmap, int pos, int order); |
| 132 | extern void bitmap_copy_le(void *dst, const unsigned long *src, int nbits); | ||
| 132 | 133 | ||
| 133 | #define BITMAP_LAST_WORD_MASK(nbits) \ | 134 | #define BITMAP_LAST_WORD_MASK(nbits) \ |
| 134 | ( \ | 135 | ( \ |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index b4fe68fe3a57..a135256b272c 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
| @@ -717,10 +717,10 @@ extern void blk_plug_device(struct request_queue *); | |||
| 717 | extern void blk_plug_device_unlocked(struct request_queue *); | 717 | extern void blk_plug_device_unlocked(struct request_queue *); |
| 718 | extern int blk_remove_plug(struct request_queue *); | 718 | extern int blk_remove_plug(struct request_queue *); |
| 719 | extern void blk_recount_segments(struct request_queue *, struct bio *); | 719 | extern void blk_recount_segments(struct request_queue *, struct bio *); |
| 720 | extern int scsi_cmd_ioctl(struct file *, struct request_queue *, | 720 | extern int scsi_cmd_ioctl(struct request_queue *, struct gendisk *, fmode_t, |
| 721 | struct gendisk *, unsigned int, void __user *); | 721 | unsigned int, void __user *); |
| 722 | extern int sg_scsi_ioctl(struct file *, struct request_queue *, | 722 | extern int sg_scsi_ioctl(struct request_queue *, struct gendisk *, fmode_t, |
| 723 | struct gendisk *, struct scsi_ioctl_command __user *); | 723 | struct scsi_ioctl_command __user *); |
| 724 | 724 | ||
| 725 | /* | 725 | /* |
| 726 | * Temporary export, until SCSI gets fixed up. | 726 | * Temporary export, until SCSI gets fixed up. |
| @@ -910,7 +910,8 @@ static inline int sb_issue_discard(struct super_block *sb, | |||
| 910 | * command filter functions | 910 | * command filter functions |
| 911 | */ | 911 | */ |
| 912 | extern int blk_verify_command(struct blk_cmd_filter *filter, | 912 | extern int blk_verify_command(struct blk_cmd_filter *filter, |
| 913 | unsigned char *cmd, int has_write_perm); | 913 | unsigned char *cmd, fmode_t has_write_perm); |
| 914 | extern void blk_unregister_filter(struct gendisk *disk); | ||
| 914 | extern void blk_set_cmd_filter_defaults(struct blk_cmd_filter *filter); | 915 | extern void blk_set_cmd_filter_defaults(struct blk_cmd_filter *filter); |
| 915 | 916 | ||
| 916 | #define MAX_PHYS_SEGMENTS 128 | 917 | #define MAX_PHYS_SEGMENTS 128 |
| @@ -1056,6 +1057,22 @@ static inline int blk_integrity_rq(struct request *rq) | |||
| 1056 | 1057 | ||
| 1057 | #endif /* CONFIG_BLK_DEV_INTEGRITY */ | 1058 | #endif /* CONFIG_BLK_DEV_INTEGRITY */ |
| 1058 | 1059 | ||
| 1060 | struct block_device_operations { | ||
| 1061 | int (*open) (struct block_device *, fmode_t); | ||
| 1062 | int (*release) (struct gendisk *, fmode_t); | ||
| 1063 | int (*locked_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); | ||
| 1064 | int (*ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); | ||
| 1065 | int (*compat_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); | ||
| 1066 | int (*direct_access) (struct block_device *, sector_t, | ||
| 1067 | void **, unsigned long *); | ||
| 1068 | int (*media_changed) (struct gendisk *); | ||
| 1069 | int (*revalidate_disk) (struct gendisk *); | ||
| 1070 | int (*getgeo)(struct block_device *, struct hd_geometry *); | ||
| 1071 | struct module *owner; | ||
| 1072 | }; | ||
| 1073 | |||
| 1074 | extern int __blkdev_driver_ioctl(struct block_device *, fmode_t, unsigned int, | ||
| 1075 | unsigned long); | ||
| 1059 | #else /* CONFIG_BLOCK */ | 1076 | #else /* CONFIG_BLOCK */ |
| 1060 | /* | 1077 | /* |
| 1061 | * stubs for when the block layer is configured out | 1078 | * stubs for when the block layer is configured out |
diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h index 5db265ea60f6..0b49e08d3cb0 100644 --- a/include/linux/cdrom.h +++ b/include/linux/cdrom.h | |||
| @@ -987,11 +987,11 @@ struct cdrom_device_ops { | |||
| 987 | }; | 987 | }; |
| 988 | 988 | ||
| 989 | /* the general block_device operations structure: */ | 989 | /* the general block_device operations structure: */ |
| 990 | extern int cdrom_open(struct cdrom_device_info *cdi, struct inode *ip, | 990 | extern int cdrom_open(struct cdrom_device_info *cdi, struct block_device *bdev, |
| 991 | struct file *fp); | 991 | fmode_t mode); |
| 992 | extern int cdrom_release(struct cdrom_device_info *cdi, struct file *fp); | 992 | extern void cdrom_release(struct cdrom_device_info *cdi, fmode_t mode); |
| 993 | extern int cdrom_ioctl(struct file *file, struct cdrom_device_info *cdi, | 993 | extern int cdrom_ioctl(struct cdrom_device_info *cdi, struct block_device *bdev, |
| 994 | struct inode *ip, unsigned int cmd, unsigned long arg); | 994 | fmode_t mode, unsigned int cmd, unsigned long arg); |
| 995 | extern int cdrom_media_changed(struct cdrom_device_info *); | 995 | extern int cdrom_media_changed(struct cdrom_device_info *); |
| 996 | 996 | ||
| 997 | extern int register_cdrom(struct cdrom_device_info *cdi); | 997 | extern int register_cdrom(struct cdrom_device_info *cdi); |
diff --git a/include/linux/crash_dump.h b/include/linux/crash_dump.h index 0acf3b737e2e..2dac064d8359 100644 --- a/include/linux/crash_dump.h +++ b/include/linux/crash_dump.h | |||
| @@ -14,8 +14,6 @@ extern unsigned long long elfcorehdr_addr; | |||
| 14 | 14 | ||
| 15 | extern ssize_t copy_oldmem_page(unsigned long, char *, size_t, | 15 | extern ssize_t copy_oldmem_page(unsigned long, char *, size_t, |
| 16 | unsigned long, int); | 16 | unsigned long, int); |
| 17 | extern const struct file_operations proc_vmcore_operations; | ||
| 18 | extern struct proc_dir_entry *proc_vmcore; | ||
| 19 | 17 | ||
| 20 | /* Architecture code defines this if there are other possible ELF | 18 | /* Architecture code defines this if there are other possible ELF |
| 21 | * machine types, e.g. on bi-arch capable hardware. */ | 19 | * machine types, e.g. on bi-arch capable hardware. */ |
diff --git a/include/linux/dcache.h b/include/linux/dcache.h index efba1de629ac..a37359d0bad1 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h | |||
| @@ -228,9 +228,9 @@ extern void d_delete(struct dentry *); | |||
| 228 | 228 | ||
| 229 | /* allocate/de-allocate */ | 229 | /* allocate/de-allocate */ |
| 230 | extern struct dentry * d_alloc(struct dentry *, const struct qstr *); | 230 | extern struct dentry * d_alloc(struct dentry *, const struct qstr *); |
| 231 | extern struct dentry * d_alloc_anon(struct inode *); | ||
| 232 | extern struct dentry * d_splice_alias(struct inode *, struct dentry *); | 231 | extern struct dentry * d_splice_alias(struct inode *, struct dentry *); |
| 233 | extern struct dentry * d_add_ci(struct dentry *, struct inode *, struct qstr *); | 232 | extern struct dentry * d_add_ci(struct dentry *, struct inode *, struct qstr *); |
| 233 | extern struct dentry * d_obtain_alias(struct inode *); | ||
| 234 | extern void shrink_dcache_sb(struct super_block *); | 234 | extern void shrink_dcache_sb(struct super_block *); |
| 235 | extern void shrink_dcache_parent(struct dentry *); | 235 | extern void shrink_dcache_parent(struct dentry *); |
| 236 | extern void shrink_dcache_for_umount(struct super_block *); | 236 | extern void shrink_dcache_for_umount(struct super_block *); |
| @@ -287,6 +287,7 @@ static inline struct dentry *d_add_unique(struct dentry *entry, struct inode *in | |||
| 287 | 287 | ||
| 288 | /* used for rename() and baskets */ | 288 | /* used for rename() and baskets */ |
| 289 | extern void d_move(struct dentry *, struct dentry *); | 289 | extern void d_move(struct dentry *, struct dentry *); |
| 290 | extern struct dentry *d_ancestor(struct dentry *, struct dentry *); | ||
| 290 | 291 | ||
| 291 | /* appendix may either be NULL or be used for transname suffixes */ | 292 | /* appendix may either be NULL or be used for transname suffixes */ |
| 292 | extern struct dentry * d_lookup(struct dentry *, struct qstr *); | 293 | extern struct dentry * d_lookup(struct dentry *, struct qstr *); |
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h index 08d783592b73..c17fd334e574 100644 --- a/include/linux/device-mapper.h +++ b/include/linux/device-mapper.h | |||
| @@ -69,8 +69,7 @@ typedef int (*dm_status_fn) (struct dm_target *ti, status_type_t status_type, | |||
| 69 | 69 | ||
| 70 | typedef int (*dm_message_fn) (struct dm_target *ti, unsigned argc, char **argv); | 70 | typedef int (*dm_message_fn) (struct dm_target *ti, unsigned argc, char **argv); |
| 71 | 71 | ||
| 72 | typedef int (*dm_ioctl_fn) (struct dm_target *ti, struct inode *inode, | 72 | typedef int (*dm_ioctl_fn) (struct dm_target *ti, unsigned int cmd, |
| 73 | struct file *filp, unsigned int cmd, | ||
| 74 | unsigned long arg); | 73 | unsigned long arg); |
| 75 | 74 | ||
| 76 | typedef int (*dm_merge_fn) (struct dm_target *ti, struct bvec_merge_data *bvm, | 75 | typedef int (*dm_merge_fn) (struct dm_target *ti, struct bvec_merge_data *bvm, |
| @@ -85,7 +84,7 @@ void dm_set_device_limits(struct dm_target *ti, struct block_device *bdev); | |||
| 85 | 84 | ||
| 86 | struct dm_dev { | 85 | struct dm_dev { |
| 87 | struct block_device *bdev; | 86 | struct block_device *bdev; |
| 88 | int mode; | 87 | fmode_t mode; |
| 89 | char name[16]; | 88 | char name[16]; |
| 90 | }; | 89 | }; |
| 91 | 90 | ||
| @@ -95,7 +94,7 @@ struct dm_dev { | |||
| 95 | * FIXME: too many arguments. | 94 | * FIXME: too many arguments. |
| 96 | */ | 95 | */ |
| 97 | int dm_get_device(struct dm_target *ti, const char *path, sector_t start, | 96 | int dm_get_device(struct dm_target *ti, const char *path, sector_t start, |
| 98 | sector_t len, int mode, struct dm_dev **result); | 97 | sector_t len, fmode_t mode, struct dm_dev **result); |
| 99 | void dm_put_device(struct dm_target *ti, struct dm_dev *d); | 98 | void dm_put_device(struct dm_target *ti, struct dm_dev *d); |
| 100 | 99 | ||
| 101 | /* | 100 | /* |
| @@ -223,7 +222,7 @@ int dm_set_geometry(struct mapped_device *md, struct hd_geometry *geo); | |||
| 223 | /* | 222 | /* |
| 224 | * First create an empty table. | 223 | * First create an empty table. |
| 225 | */ | 224 | */ |
| 226 | int dm_table_create(struct dm_table **result, int mode, | 225 | int dm_table_create(struct dm_table **result, fmode_t mode, |
| 227 | unsigned num_targets, struct mapped_device *md); | 226 | unsigned num_targets, struct mapped_device *md); |
| 228 | 227 | ||
| 229 | /* | 228 | /* |
| @@ -254,7 +253,7 @@ void dm_table_put(struct dm_table *t); | |||
| 254 | */ | 253 | */ |
| 255 | sector_t dm_table_get_size(struct dm_table *t); | 254 | sector_t dm_table_get_size(struct dm_table *t); |
| 256 | unsigned int dm_table_get_num_targets(struct dm_table *t); | 255 | unsigned int dm_table_get_num_targets(struct dm_table *t); |
| 257 | int dm_table_get_mode(struct dm_table *t); | 256 | fmode_t dm_table_get_mode(struct dm_table *t); |
| 258 | struct mapped_device *dm_table_get_md(struct dm_table *t); | 257 | struct mapped_device *dm_table_get_md(struct dm_table *t); |
| 259 | 258 | ||
| 260 | /* | 259 | /* |
| @@ -354,6 +353,9 @@ void *dm_vcalloc(unsigned long nmemb, unsigned long elem_size); | |||
| 354 | */ | 353 | */ |
| 355 | #define dm_round_up(n, sz) (dm_div_up((n), (sz)) * (sz)) | 354 | #define dm_round_up(n, sz) (dm_div_up((n), (sz)) * (sz)) |
| 356 | 355 | ||
| 356 | #define dm_array_too_big(fixed, obj, num) \ | ||
| 357 | ((num) > (UINT_MAX - (fixed)) / (obj)) | ||
| 358 | |||
| 357 | static inline sector_t to_sector(unsigned long n) | 359 | static inline sector_t to_sector(unsigned long n) |
| 358 | { | 360 | { |
| 359 | return (n >> SECTOR_SHIFT); | 361 | return (n >> SECTOR_SHIFT); |
diff --git a/include/linux/device.h b/include/linux/device.h index 987f5912720a..1a3686d15f98 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
| @@ -450,7 +450,7 @@ static inline void set_dev_node(struct device *dev, int node) | |||
| 450 | } | 450 | } |
| 451 | #endif | 451 | #endif |
| 452 | 452 | ||
| 453 | static inline void *dev_get_drvdata(struct device *dev) | 453 | static inline void *dev_get_drvdata(const struct device *dev) |
| 454 | { | 454 | { |
| 455 | return dev->driver_data; | 455 | return dev->driver_data; |
| 456 | } | 456 | } |
diff --git a/include/linux/dm-region-hash.h b/include/linux/dm-region-hash.h new file mode 100644 index 000000000000..a9e652a41373 --- /dev/null +++ b/include/linux/dm-region-hash.h | |||
| @@ -0,0 +1,104 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2003 Sistina Software Limited. | ||
| 3 | * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. | ||
| 4 | * | ||
| 5 | * Device-Mapper dirty region hash interface. | ||
| 6 | * | ||
| 7 | * This file is released under the GPL. | ||
| 8 | */ | ||
| 9 | |||
| 10 | #ifndef DM_REGION_HASH_H | ||
| 11 | #define DM_REGION_HASH_H | ||
| 12 | |||
| 13 | #include <linux/dm-dirty-log.h> | ||
| 14 | |||
| 15 | /*----------------------------------------------------------------- | ||
| 16 | * Region hash | ||
| 17 | *----------------------------------------------------------------*/ | ||
| 18 | struct dm_region_hash; | ||
| 19 | struct dm_region; | ||
| 20 | |||
| 21 | /* | ||
| 22 | * States a region can have. | ||
| 23 | */ | ||
| 24 | enum dm_rh_region_states { | ||
| 25 | DM_RH_CLEAN = 0x01, /* No writes in flight. */ | ||
| 26 | DM_RH_DIRTY = 0x02, /* Writes in flight. */ | ||
| 27 | DM_RH_NOSYNC = 0x04, /* Out of sync. */ | ||
| 28 | DM_RH_RECOVERING = 0x08, /* Under resynchronization. */ | ||
| 29 | }; | ||
| 30 | |||
| 31 | /* | ||
| 32 | * Region hash create/destroy. | ||
| 33 | */ | ||
| 34 | struct bio_list; | ||
| 35 | struct dm_region_hash *dm_region_hash_create( | ||
| 36 | void *context, void (*dispatch_bios)(void *context, | ||
| 37 | struct bio_list *bios), | ||
| 38 | void (*wakeup_workers)(void *context), | ||
| 39 | void (*wakeup_all_recovery_waiters)(void *context), | ||
| 40 | sector_t target_begin, unsigned max_recovery, | ||
| 41 | struct dm_dirty_log *log, uint32_t region_size, | ||
| 42 | region_t nr_regions); | ||
| 43 | void dm_region_hash_destroy(struct dm_region_hash *rh); | ||
| 44 | |||
| 45 | struct dm_dirty_log *dm_rh_dirty_log(struct dm_region_hash *rh); | ||
| 46 | |||
| 47 | /* | ||
| 48 | * Conversion functions. | ||
| 49 | */ | ||
| 50 | region_t dm_rh_bio_to_region(struct dm_region_hash *rh, struct bio *bio); | ||
| 51 | sector_t dm_rh_region_to_sector(struct dm_region_hash *rh, region_t region); | ||
| 52 | void *dm_rh_region_context(struct dm_region *reg); | ||
| 53 | |||
| 54 | /* | ||
| 55 | * Get region size and key (ie. number of the region). | ||
| 56 | */ | ||
| 57 | sector_t dm_rh_get_region_size(struct dm_region_hash *rh); | ||
| 58 | region_t dm_rh_get_region_key(struct dm_region *reg); | ||
| 59 | |||
| 60 | /* | ||
| 61 | * Get/set/update region state (and dirty log). | ||
| 62 | * | ||
| 63 | */ | ||
| 64 | int dm_rh_get_state(struct dm_region_hash *rh, region_t region, int may_block); | ||
| 65 | void dm_rh_set_state(struct dm_region_hash *rh, region_t region, | ||
| 66 | enum dm_rh_region_states state, int may_block); | ||
| 67 | |||
| 68 | /* Non-zero errors_handled leaves the state of the region NOSYNC */ | ||
| 69 | void dm_rh_update_states(struct dm_region_hash *rh, int errors_handled); | ||
| 70 | |||
| 71 | /* Flush the region hash and dirty log. */ | ||
| 72 | int dm_rh_flush(struct dm_region_hash *rh); | ||
| 73 | |||
| 74 | /* Inc/dec pending count on regions. */ | ||
| 75 | void dm_rh_inc_pending(struct dm_region_hash *rh, struct bio_list *bios); | ||
| 76 | void dm_rh_dec(struct dm_region_hash *rh, region_t region); | ||
| 77 | |||
| 78 | /* Delay bios on regions. */ | ||
| 79 | void dm_rh_delay(struct dm_region_hash *rh, struct bio *bio); | ||
| 80 | |||
| 81 | void dm_rh_mark_nosync(struct dm_region_hash *rh, | ||
| 82 | struct bio *bio, unsigned done, int error); | ||
| 83 | |||
| 84 | /* | ||
| 85 | * Region recovery control. | ||
| 86 | */ | ||
| 87 | |||
| 88 | /* Prepare some regions for recovery by starting to quiesce them. */ | ||
| 89 | void dm_rh_recovery_prepare(struct dm_region_hash *rh); | ||
| 90 | |||
| 91 | /* Try fetching a quiesced region for recovery. */ | ||
| 92 | struct dm_region *dm_rh_recovery_start(struct dm_region_hash *rh); | ||
| 93 | |||
| 94 | /* Report recovery end on a region. */ | ||
| 95 | void dm_rh_recovery_end(struct dm_region *reg, int error); | ||
| 96 | |||
| 97 | /* Returns number of regions with recovery work outstanding. */ | ||
| 98 | int dm_rh_recovery_in_flight(struct dm_region_hash *rh); | ||
| 99 | |||
| 100 | /* Start/stop recovery. */ | ||
| 101 | void dm_rh_start_recovery(struct dm_region_hash *rh); | ||
| 102 | void dm_rh_stop_recovery(struct dm_region_hash *rh); | ||
| 103 | |||
| 104 | #endif /* DM_REGION_HASH_H */ | ||
diff --git a/include/linux/dma_remapping.h b/include/linux/dma_remapping.h index bff5c65f81dc..952df39c989d 100644 --- a/include/linux/dma_remapping.h +++ b/include/linux/dma_remapping.h | |||
| @@ -2,15 +2,14 @@ | |||
| 2 | #define _DMA_REMAPPING_H | 2 | #define _DMA_REMAPPING_H |
| 3 | 3 | ||
| 4 | /* | 4 | /* |
| 5 | * We need a fixed PAGE_SIZE of 4K irrespective of | 5 | * VT-d hardware uses 4KiB page size regardless of host page size. |
| 6 | * arch PAGE_SIZE for IOMMU page tables. | ||
| 7 | */ | 6 | */ |
| 8 | #define PAGE_SHIFT_4K (12) | 7 | #define VTD_PAGE_SHIFT (12) |
| 9 | #define PAGE_SIZE_4K (1UL << PAGE_SHIFT_4K) | 8 | #define VTD_PAGE_SIZE (1UL << VTD_PAGE_SHIFT) |
| 10 | #define PAGE_MASK_4K (((u64)-1) << PAGE_SHIFT_4K) | 9 | #define VTD_PAGE_MASK (((u64)-1) << VTD_PAGE_SHIFT) |
| 11 | #define PAGE_ALIGN_4K(addr) (((addr) + PAGE_SIZE_4K - 1) & PAGE_MASK_4K) | 10 | #define VTD_PAGE_ALIGN(addr) (((addr) + VTD_PAGE_SIZE - 1) & VTD_PAGE_MASK) |
| 12 | 11 | ||
| 13 | #define IOVA_PFN(addr) ((addr) >> PAGE_SHIFT_4K) | 12 | #define IOVA_PFN(addr) ((addr) >> PAGE_SHIFT) |
| 14 | #define DMA_32BIT_PFN IOVA_PFN(DMA_32BIT_MASK) | 13 | #define DMA_32BIT_PFN IOVA_PFN(DMA_32BIT_MASK) |
| 15 | #define DMA_64BIT_PFN IOVA_PFN(DMA_64BIT_MASK) | 14 | #define DMA_64BIT_PFN IOVA_PFN(DMA_64BIT_MASK) |
| 16 | 15 | ||
| @@ -25,7 +24,7 @@ struct root_entry { | |||
| 25 | u64 val; | 24 | u64 val; |
| 26 | u64 rsvd1; | 25 | u64 rsvd1; |
| 27 | }; | 26 | }; |
| 28 | #define ROOT_ENTRY_NR (PAGE_SIZE_4K/sizeof(struct root_entry)) | 27 | #define ROOT_ENTRY_NR (VTD_PAGE_SIZE/sizeof(struct root_entry)) |
| 29 | static inline bool root_present(struct root_entry *root) | 28 | static inline bool root_present(struct root_entry *root) |
| 30 | { | 29 | { |
| 31 | return (root->val & 1); | 30 | return (root->val & 1); |
| @@ -36,7 +35,7 @@ static inline void set_root_present(struct root_entry *root) | |||
| 36 | } | 35 | } |
| 37 | static inline void set_root_value(struct root_entry *root, unsigned long value) | 36 | static inline void set_root_value(struct root_entry *root, unsigned long value) |
| 38 | { | 37 | { |
| 39 | root->val |= value & PAGE_MASK_4K; | 38 | root->val |= value & VTD_PAGE_MASK; |
| 40 | } | 39 | } |
| 41 | 40 | ||
| 42 | struct context_entry; | 41 | struct context_entry; |
| @@ -45,7 +44,7 @@ get_context_addr_from_root(struct root_entry *root) | |||
| 45 | { | 44 | { |
| 46 | return (struct context_entry *) | 45 | return (struct context_entry *) |
| 47 | (root_present(root)?phys_to_virt( | 46 | (root_present(root)?phys_to_virt( |
| 48 | root->val & PAGE_MASK_4K): | 47 | root->val & VTD_PAGE_MASK) : |
| 49 | NULL); | 48 | NULL); |
| 50 | } | 49 | } |
| 51 | 50 | ||
| @@ -67,7 +66,7 @@ struct context_entry { | |||
| 67 | #define context_present(c) ((c).lo & 1) | 66 | #define context_present(c) ((c).lo & 1) |
| 68 | #define context_fault_disable(c) (((c).lo >> 1) & 1) | 67 | #define context_fault_disable(c) (((c).lo >> 1) & 1) |
| 69 | #define context_translation_type(c) (((c).lo >> 2) & 3) | 68 | #define context_translation_type(c) (((c).lo >> 2) & 3) |
| 70 | #define context_address_root(c) ((c).lo & PAGE_MASK_4K) | 69 | #define context_address_root(c) ((c).lo & VTD_PAGE_MASK) |
| 71 | #define context_address_width(c) ((c).hi & 7) | 70 | #define context_address_width(c) ((c).hi & 7) |
| 72 | #define context_domain_id(c) (((c).hi >> 8) & ((1 << 16) - 1)) | 71 | #define context_domain_id(c) (((c).hi >> 8) & ((1 << 16) - 1)) |
| 73 | 72 | ||
| @@ -81,7 +80,7 @@ struct context_entry { | |||
| 81 | } while (0) | 80 | } while (0) |
| 82 | #define CONTEXT_TT_MULTI_LEVEL 0 | 81 | #define CONTEXT_TT_MULTI_LEVEL 0 |
| 83 | #define context_set_address_root(c, val) \ | 82 | #define context_set_address_root(c, val) \ |
| 84 | do {(c).lo |= (val) & PAGE_MASK_4K;} while (0) | 83 | do {(c).lo |= (val) & VTD_PAGE_MASK; } while (0) |
| 85 | #define context_set_address_width(c, val) do {(c).hi |= (val) & 7;} while (0) | 84 | #define context_set_address_width(c, val) do {(c).hi |= (val) & 7;} while (0) |
| 86 | #define context_set_domain_id(c, val) \ | 85 | #define context_set_domain_id(c, val) \ |
| 87 | do {(c).hi |= ((val) & ((1 << 16) - 1)) << 8;} while (0) | 86 | do {(c).hi |= ((val) & ((1 << 16) - 1)) << 8;} while (0) |
| @@ -107,9 +106,9 @@ struct dma_pte { | |||
| 107 | #define dma_set_pte_writable(p) do {(p).val |= DMA_PTE_WRITE;} while (0) | 106 | #define dma_set_pte_writable(p) do {(p).val |= DMA_PTE_WRITE;} while (0) |
| 108 | #define dma_set_pte_prot(p, prot) \ | 107 | #define dma_set_pte_prot(p, prot) \ |
| 109 | do {(p).val = ((p).val & ~3) | ((prot) & 3); } while (0) | 108 | do {(p).val = ((p).val & ~3) | ((prot) & 3); } while (0) |
| 110 | #define dma_pte_addr(p) ((p).val & PAGE_MASK_4K) | 109 | #define dma_pte_addr(p) ((p).val & VTD_PAGE_MASK) |
| 111 | #define dma_set_pte_addr(p, addr) do {\ | 110 | #define dma_set_pte_addr(p, addr) do {\ |
| 112 | (p).val |= ((addr) & PAGE_MASK_4K); } while (0) | 111 | (p).val |= ((addr) & VTD_PAGE_MASK); } while (0) |
| 113 | #define dma_pte_present(p) (((p).val & 3) != 0) | 112 | #define dma_pte_present(p) (((p).val & 3) != 0) |
| 114 | 113 | ||
| 115 | struct intel_iommu; | 114 | struct intel_iommu; |
diff --git a/include/linux/file.h b/include/linux/file.h index a20259e248a5..335a0a5c316e 100644 --- a/include/linux/file.h +++ b/include/linux/file.h | |||
| @@ -19,10 +19,10 @@ struct file_operations; | |||
| 19 | struct vfsmount; | 19 | struct vfsmount; |
| 20 | struct dentry; | 20 | struct dentry; |
| 21 | extern int init_file(struct file *, struct vfsmount *mnt, | 21 | extern int init_file(struct file *, struct vfsmount *mnt, |
| 22 | struct dentry *dentry, mode_t mode, | 22 | struct dentry *dentry, fmode_t mode, |
| 23 | const struct file_operations *fop); | 23 | const struct file_operations *fop); |
| 24 | extern struct file *alloc_file(struct vfsmount *, struct dentry *dentry, | 24 | extern struct file *alloc_file(struct vfsmount *, struct dentry *dentry, |
| 25 | mode_t mode, const struct file_operations *fop); | 25 | fmode_t mode, const struct file_operations *fop); |
| 26 | 26 | ||
| 27 | static inline void fput_light(struct file *file, int fput_needed) | 27 | static inline void fput_light(struct file *file, int fput_needed) |
| 28 | { | 28 | { |
diff --git a/include/linux/fs.h b/include/linux/fs.h index a6a625be13fc..5b248d61430c 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
| @@ -63,18 +63,23 @@ extern int dir_notify_enable; | |||
| 63 | #define MAY_ACCESS 16 | 63 | #define MAY_ACCESS 16 |
| 64 | #define MAY_OPEN 32 | 64 | #define MAY_OPEN 32 |
| 65 | 65 | ||
| 66 | #define FMODE_READ 1 | 66 | #define FMODE_READ ((__force fmode_t)1) |
| 67 | #define FMODE_WRITE 2 | 67 | #define FMODE_WRITE ((__force fmode_t)2) |
| 68 | 68 | ||
| 69 | /* Internal kernel extensions */ | 69 | /* Internal kernel extensions */ |
| 70 | #define FMODE_LSEEK 4 | 70 | #define FMODE_LSEEK ((__force fmode_t)4) |
| 71 | #define FMODE_PREAD 8 | 71 | #define FMODE_PREAD ((__force fmode_t)8) |
| 72 | #define FMODE_PWRITE FMODE_PREAD /* These go hand in hand */ | 72 | #define FMODE_PWRITE FMODE_PREAD /* These go hand in hand */ |
| 73 | 73 | ||
| 74 | /* File is being opened for execution. Primary users of this flag are | 74 | /* File is being opened for execution. Primary users of this flag are |
| 75 | distributed filesystems that can use it to achieve correct ETXTBUSY | 75 | distributed filesystems that can use it to achieve correct ETXTBUSY |
| 76 | behavior for cross-node execution/opening_for_writing of files */ | 76 | behavior for cross-node execution/opening_for_writing of files */ |
| 77 | #define FMODE_EXEC 16 | 77 | #define FMODE_EXEC ((__force fmode_t)16) |
| 78 | |||
| 79 | #define FMODE_NDELAY ((__force fmode_t)32) | ||
| 80 | #define FMODE_EXCL ((__force fmode_t)64) | ||
| 81 | #define FMODE_WRITE_IOCTL ((__force fmode_t)128) | ||
| 82 | #define FMODE_NDELAY_NOW ((__force fmode_t)256) | ||
| 78 | 83 | ||
| 79 | #define RW_MASK 1 | 84 | #define RW_MASK 1 |
| 80 | #define RWA_MASK 2 | 85 | #define RWA_MASK 2 |
| @@ -136,7 +141,7 @@ extern int dir_notify_enable; | |||
| 136 | /* | 141 | /* |
| 137 | * Superblock flags that can be altered by MS_REMOUNT | 142 | * Superblock flags that can be altered by MS_REMOUNT |
| 138 | */ | 143 | */ |
| 139 | #define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK) | 144 | #define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_I_VERSION) |
| 140 | 145 | ||
| 141 | /* | 146 | /* |
| 142 | * Old magic mount flag and mask | 147 | * Old magic mount flag and mask |
| @@ -825,7 +830,7 @@ struct file { | |||
| 825 | const struct file_operations *f_op; | 830 | const struct file_operations *f_op; |
| 826 | atomic_long_t f_count; | 831 | atomic_long_t f_count; |
| 827 | unsigned int f_flags; | 832 | unsigned int f_flags; |
| 828 | mode_t f_mode; | 833 | fmode_t f_mode; |
| 829 | loff_t f_pos; | 834 | loff_t f_pos; |
| 830 | struct fown_struct f_owner; | 835 | struct fown_struct f_owner; |
| 831 | unsigned int f_uid, f_gid; | 836 | unsigned int f_uid, f_gid; |
| @@ -1037,7 +1042,6 @@ extern int vfs_setlease(struct file *, long, struct file_lock **); | |||
| 1037 | extern int lease_modify(struct file_lock **, int); | 1042 | extern int lease_modify(struct file_lock **, int); |
| 1038 | extern int lock_may_read(struct inode *, loff_t start, unsigned long count); | 1043 | extern int lock_may_read(struct inode *, loff_t start, unsigned long count); |
| 1039 | extern int lock_may_write(struct inode *, loff_t start, unsigned long count); | 1044 | extern int lock_may_write(struct inode *, loff_t start, unsigned long count); |
| 1040 | extern struct seq_operations locks_seq_operations; | ||
| 1041 | #else /* !CONFIG_FILE_LOCKING */ | 1045 | #else /* !CONFIG_FILE_LOCKING */ |
| 1042 | #define fcntl_getlk(a, b) ({ -EINVAL; }) | 1046 | #define fcntl_getlk(a, b) ({ -EINVAL; }) |
| 1043 | #define fcntl_setlk(a, b, c, d) ({ -EACCES; }) | 1047 | #define fcntl_setlk(a, b, c, d) ({ -EACCES; }) |
| @@ -1152,6 +1156,7 @@ struct super_block { | |||
| 1152 | char s_id[32]; /* Informational name */ | 1156 | char s_id[32]; /* Informational name */ |
| 1153 | 1157 | ||
| 1154 | void *s_fs_info; /* Filesystem private info */ | 1158 | void *s_fs_info; /* Filesystem private info */ |
| 1159 | fmode_t s_mode; | ||
| 1155 | 1160 | ||
| 1156 | /* | 1161 | /* |
| 1157 | * The next field is for VFS *only*. No filesystems have any business | 1162 | * The next field is for VFS *only*. No filesystems have any business |
| @@ -1266,20 +1271,7 @@ int generic_osync_inode(struct inode *, struct address_space *, int); | |||
| 1266 | * to have different dirent layouts depending on the binary type. | 1271 | * to have different dirent layouts depending on the binary type. |
| 1267 | */ | 1272 | */ |
| 1268 | typedef int (*filldir_t)(void *, const char *, int, loff_t, u64, unsigned); | 1273 | typedef int (*filldir_t)(void *, const char *, int, loff_t, u64, unsigned); |
| 1269 | 1274 | struct block_device_operations; | |
| 1270 | struct block_device_operations { | ||
| 1271 | int (*open) (struct inode *, struct file *); | ||
| 1272 | int (*release) (struct inode *, struct file *); | ||
| 1273 | int (*ioctl) (struct inode *, struct file *, unsigned, unsigned long); | ||
| 1274 | long (*unlocked_ioctl) (struct file *, unsigned, unsigned long); | ||
| 1275 | long (*compat_ioctl) (struct file *, unsigned, unsigned long); | ||
| 1276 | int (*direct_access) (struct block_device *, sector_t, | ||
| 1277 | void **, unsigned long *); | ||
| 1278 | int (*media_changed) (struct gendisk *); | ||
| 1279 | int (*revalidate_disk) (struct gendisk *); | ||
| 1280 | int (*getgeo)(struct block_device *, struct hd_geometry *); | ||
| 1281 | struct module *owner; | ||
| 1282 | }; | ||
| 1283 | 1275 | ||
| 1284 | /* These macros are for out of kernel modules to test that | 1276 | /* These macros are for out of kernel modules to test that |
| 1285 | * the kernel supports the unlocked_ioctl and compat_ioctl | 1277 | * the kernel supports the unlocked_ioctl and compat_ioctl |
| @@ -1593,7 +1585,6 @@ extern int get_sb_pseudo(struct file_system_type *, char *, | |||
| 1593 | struct vfsmount *mnt); | 1585 | struct vfsmount *mnt); |
| 1594 | extern int simple_set_mnt(struct vfsmount *mnt, struct super_block *sb); | 1586 | extern int simple_set_mnt(struct vfsmount *mnt, struct super_block *sb); |
| 1595 | int __put_super_and_need_restart(struct super_block *sb); | 1587 | int __put_super_and_need_restart(struct super_block *sb); |
| 1596 | void unnamed_dev_init(void); | ||
| 1597 | 1588 | ||
| 1598 | /* Alas, no aliases. Too much hassle with bringing module.h everywhere */ | 1589 | /* Alas, no aliases. Too much hassle with bringing module.h everywhere */ |
| 1599 | #define fops_get(fops) \ | 1590 | #define fops_get(fops) \ |
| @@ -1714,7 +1705,7 @@ extern struct block_device *bdget(dev_t); | |||
| 1714 | extern void bd_set_size(struct block_device *, loff_t size); | 1705 | extern void bd_set_size(struct block_device *, loff_t size); |
| 1715 | extern void bd_forget(struct inode *inode); | 1706 | extern void bd_forget(struct inode *inode); |
| 1716 | extern void bdput(struct block_device *); | 1707 | extern void bdput(struct block_device *); |
| 1717 | extern struct block_device *open_by_devnum(dev_t, unsigned); | 1708 | extern struct block_device *open_by_devnum(dev_t, fmode_t); |
| 1718 | #else | 1709 | #else |
| 1719 | static inline void bd_forget(struct inode *inode) {} | 1710 | static inline void bd_forget(struct inode *inode) {} |
| 1720 | #endif | 1711 | #endif |
| @@ -1724,13 +1715,10 @@ extern const struct file_operations bad_sock_fops; | |||
| 1724 | extern const struct file_operations def_fifo_fops; | 1715 | extern const struct file_operations def_fifo_fops; |
| 1725 | #ifdef CONFIG_BLOCK | 1716 | #ifdef CONFIG_BLOCK |
| 1726 | extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long); | 1717 | extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long); |
| 1727 | extern int blkdev_ioctl(struct inode *, struct file *, unsigned, unsigned long); | 1718 | extern int blkdev_ioctl(struct block_device *, fmode_t, unsigned, unsigned long); |
| 1728 | extern int blkdev_driver_ioctl(struct inode *inode, struct file *file, | ||
| 1729 | struct gendisk *disk, unsigned cmd, | ||
| 1730 | unsigned long arg); | ||
| 1731 | extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long); | 1719 | extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long); |
| 1732 | extern int blkdev_get(struct block_device *, mode_t, unsigned); | 1720 | extern int blkdev_get(struct block_device *, fmode_t); |
| 1733 | extern int blkdev_put(struct block_device *); | 1721 | extern int blkdev_put(struct block_device *, fmode_t); |
| 1734 | extern int bd_claim(struct block_device *, void *); | 1722 | extern int bd_claim(struct block_device *, void *); |
| 1735 | extern void bd_release(struct block_device *); | 1723 | extern void bd_release(struct block_device *); |
| 1736 | #ifdef CONFIG_SYSFS | 1724 | #ifdef CONFIG_SYSFS |
| @@ -1761,9 +1749,10 @@ extern void chrdev_show(struct seq_file *,off_t); | |||
| 1761 | extern const char *__bdevname(dev_t, char *buffer); | 1749 | extern const char *__bdevname(dev_t, char *buffer); |
| 1762 | extern const char *bdevname(struct block_device *bdev, char *buffer); | 1750 | extern const char *bdevname(struct block_device *bdev, char *buffer); |
| 1763 | extern struct block_device *lookup_bdev(const char *); | 1751 | extern struct block_device *lookup_bdev(const char *); |
| 1764 | extern struct block_device *open_bdev_excl(const char *, int, void *); | 1752 | extern struct block_device *open_bdev_exclusive(const char *, fmode_t, void *); |
| 1765 | extern void close_bdev_excl(struct block_device *); | 1753 | extern void close_bdev_exclusive(struct block_device *, fmode_t); |
| 1766 | extern void blkdev_show(struct seq_file *,off_t); | 1754 | extern void blkdev_show(struct seq_file *,off_t); |
| 1755 | |||
| 1767 | #else | 1756 | #else |
| 1768 | #define BLKDEV_MAJOR_HASH_SIZE 0 | 1757 | #define BLKDEV_MAJOR_HASH_SIZE 0 |
| 1769 | #endif | 1758 | #endif |
| @@ -1852,6 +1841,11 @@ extern int inode_permission(struct inode *, int); | |||
| 1852 | extern int generic_permission(struct inode *, int, | 1841 | extern int generic_permission(struct inode *, int, |
| 1853 | int (*check_acl)(struct inode *, int)); | 1842 | int (*check_acl)(struct inode *, int)); |
| 1854 | 1843 | ||
| 1844 | static inline bool execute_ok(struct inode *inode) | ||
| 1845 | { | ||
| 1846 | return (inode->i_mode & S_IXUGO) || S_ISDIR(inode->i_mode); | ||
| 1847 | } | ||
| 1848 | |||
| 1855 | extern int get_write_access(struct inode *); | 1849 | extern int get_write_access(struct inode *); |
| 1856 | extern int deny_write_access(struct file *); | 1850 | extern int deny_write_access(struct file *); |
| 1857 | static inline void put_write_access(struct inode * inode) | 1851 | static inline void put_write_access(struct inode * inode) |
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h index a89513188ce7..00fbd5b245c9 100644 --- a/include/linux/fsnotify.h +++ b/include/linux/fsnotify.h | |||
| @@ -188,7 +188,7 @@ static inline void fsnotify_close(struct file *file) | |||
| 188 | struct dentry *dentry = file->f_path.dentry; | 188 | struct dentry *dentry = file->f_path.dentry; |
| 189 | struct inode *inode = dentry->d_inode; | 189 | struct inode *inode = dentry->d_inode; |
| 190 | const char *name = dentry->d_name.name; | 190 | const char *name = dentry->d_name.name; |
| 191 | mode_t mode = file->f_mode; | 191 | fmode_t mode = file->f_mode; |
| 192 | u32 mask = (mode & FMODE_WRITE) ? IN_CLOSE_WRITE : IN_CLOSE_NOWRITE; | 192 | u32 mask = (mode & FMODE_WRITE) ? IN_CLOSE_WRITE : IN_CLOSE_NOWRITE; |
| 193 | 193 | ||
| 194 | if (S_ISDIR(inode->i_mode)) | 194 | if (S_ISDIR(inode->i_mode)) |
diff --git a/include/linux/genhd.h b/include/linux/genhd.h index 206cdf96c3a7..e439e6aed832 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h | |||
| @@ -25,9 +25,6 @@ extern struct device_type part_type; | |||
| 25 | extern struct kobject *block_depr; | 25 | extern struct kobject *block_depr; |
| 26 | extern struct class block_class; | 26 | extern struct class block_class; |
| 27 | 27 | ||
| 28 | extern const struct seq_operations partitions_op; | ||
| 29 | extern const struct seq_operations diskstats_op; | ||
| 30 | |||
| 31 | enum { | 28 | enum { |
| 32 | /* These three have identical behaviour; use the second one if DOS FDISK gets | 29 | /* These three have identical behaviour; use the second one if DOS FDISK gets |
| 33 | confused about extended/logical partitions starting past cylinder 1023. */ | 30 | confused about extended/logical partitions starting past cylinder 1023. */ |
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index 9a4e35cd5f79..2b3645b1acf4 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h | |||
| @@ -20,6 +20,8 @@ | |||
| 20 | #include <linux/init.h> | 20 | #include <linux/init.h> |
| 21 | #include <linux/list.h> | 21 | #include <linux/list.h> |
| 22 | #include <linux/wait.h> | 22 | #include <linux/wait.h> |
| 23 | #include <linux/percpu.h> | ||
| 24 | |||
| 23 | 25 | ||
| 24 | struct hrtimer_clock_base; | 26 | struct hrtimer_clock_base; |
| 25 | struct hrtimer_cpu_base; | 27 | struct hrtimer_cpu_base; |
| @@ -101,9 +103,14 @@ enum hrtimer_cb_mode { | |||
| 101 | /** | 103 | /** |
| 102 | * struct hrtimer - the basic hrtimer structure | 104 | * struct hrtimer - the basic hrtimer structure |
| 103 | * @node: red black tree node for time ordered insertion | 105 | * @node: red black tree node for time ordered insertion |
| 104 | * @expires: the absolute expiry time in the hrtimers internal | 106 | * @_expires: the absolute expiry time in the hrtimers internal |
| 105 | * representation. The time is related to the clock on | 107 | * representation. The time is related to the clock on |
| 106 | * which the timer is based. | 108 | * which the timer is based. Is setup by adding |
| 109 | * slack to the _softexpires value. For non range timers | ||
| 110 | * identical to _softexpires. | ||
| 111 | * @_softexpires: the absolute earliest expiry time of the hrtimer. | ||
| 112 | * The time which was given as expiry time when the timer | ||
| 113 | * was armed. | ||
| 107 | * @function: timer expiry callback function | 114 | * @function: timer expiry callback function |
| 108 | * @base: pointer to the timer base (per cpu and per clock) | 115 | * @base: pointer to the timer base (per cpu and per clock) |
| 109 | * @state: state information (See bit values above) | 116 | * @state: state information (See bit values above) |
| @@ -121,7 +128,8 @@ enum hrtimer_cb_mode { | |||
| 121 | */ | 128 | */ |
| 122 | struct hrtimer { | 129 | struct hrtimer { |
| 123 | struct rb_node node; | 130 | struct rb_node node; |
| 124 | ktime_t expires; | 131 | ktime_t _expires; |
| 132 | ktime_t _softexpires; | ||
| 125 | enum hrtimer_restart (*function)(struct hrtimer *); | 133 | enum hrtimer_restart (*function)(struct hrtimer *); |
| 126 | struct hrtimer_clock_base *base; | 134 | struct hrtimer_clock_base *base; |
| 127 | unsigned long state; | 135 | unsigned long state; |
| @@ -201,6 +209,71 @@ struct hrtimer_cpu_base { | |||
| 201 | #endif | 209 | #endif |
| 202 | }; | 210 | }; |
| 203 | 211 | ||
| 212 | static inline void hrtimer_set_expires(struct hrtimer *timer, ktime_t time) | ||
| 213 | { | ||
| 214 | timer->_expires = time; | ||
| 215 | timer->_softexpires = time; | ||
| 216 | } | ||
| 217 | |||
| 218 | static inline void hrtimer_set_expires_range(struct hrtimer *timer, ktime_t time, ktime_t delta) | ||
| 219 | { | ||
| 220 | timer->_softexpires = time; | ||
| 221 | timer->_expires = ktime_add_safe(time, delta); | ||
| 222 | } | ||
| 223 | |||
| 224 | static inline void hrtimer_set_expires_range_ns(struct hrtimer *timer, ktime_t time, unsigned long delta) | ||
| 225 | { | ||
| 226 | timer->_softexpires = time; | ||
| 227 | timer->_expires = ktime_add_safe(time, ns_to_ktime(delta)); | ||
| 228 | } | ||
| 229 | |||
| 230 | static inline void hrtimer_set_expires_tv64(struct hrtimer *timer, s64 tv64) | ||
| 231 | { | ||
| 232 | timer->_expires.tv64 = tv64; | ||
| 233 | timer->_softexpires.tv64 = tv64; | ||
| 234 | } | ||
| 235 | |||
| 236 | static inline void hrtimer_add_expires(struct hrtimer *timer, ktime_t time) | ||
| 237 | { | ||
| 238 | timer->_expires = ktime_add_safe(timer->_expires, time); | ||
| 239 | timer->_softexpires = ktime_add_safe(timer->_softexpires, time); | ||
| 240 | } | ||
| 241 | |||
| 242 | static inline void hrtimer_add_expires_ns(struct hrtimer *timer, unsigned long ns) | ||
| 243 | { | ||
| 244 | timer->_expires = ktime_add_ns(timer->_expires, ns); | ||
| 245 | timer->_softexpires = ktime_add_ns(timer->_softexpires, ns); | ||
| 246 | } | ||
| 247 | |||
| 248 | static inline ktime_t hrtimer_get_expires(const struct hrtimer *timer) | ||
| 249 | { | ||
| 250 | return timer->_expires; | ||
| 251 | } | ||
| 252 | |||
| 253 | static inline ktime_t hrtimer_get_softexpires(const struct hrtimer *timer) | ||
| 254 | { | ||
| 255 | return timer->_softexpires; | ||
| 256 | } | ||
| 257 | |||
| 258 | static inline s64 hrtimer_get_expires_tv64(const struct hrtimer *timer) | ||
| 259 | { | ||
| 260 | return timer->_expires.tv64; | ||
| 261 | } | ||
| 262 | static inline s64 hrtimer_get_softexpires_tv64(const struct hrtimer *timer) | ||
| 263 | { | ||
| 264 | return timer->_softexpires.tv64; | ||
| 265 | } | ||
| 266 | |||
| 267 | static inline s64 hrtimer_get_expires_ns(const struct hrtimer *timer) | ||
| 268 | { | ||
| 269 | return ktime_to_ns(timer->_expires); | ||
| 270 | } | ||
| 271 | |||
| 272 | static inline ktime_t hrtimer_expires_remaining(const struct hrtimer *timer) | ||
| 273 | { | ||
| 274 | return ktime_sub(timer->_expires, timer->base->get_time()); | ||
| 275 | } | ||
| 276 | |||
| 204 | #ifdef CONFIG_HIGH_RES_TIMERS | 277 | #ifdef CONFIG_HIGH_RES_TIMERS |
| 205 | struct clock_event_device; | 278 | struct clock_event_device; |
| 206 | 279 | ||
| @@ -221,6 +294,8 @@ static inline int hrtimer_is_hres_active(struct hrtimer *timer) | |||
| 221 | return timer->base->cpu_base->hres_active; | 294 | return timer->base->cpu_base->hres_active; |
| 222 | } | 295 | } |
| 223 | 296 | ||
| 297 | extern void hrtimer_peek_ahead_timers(void); | ||
| 298 | |||
| 224 | /* | 299 | /* |
| 225 | * The resolution of the clocks. The resolution value is returned in | 300 | * The resolution of the clocks. The resolution value is returned in |
| 226 | * the clock_getres() system call to give application programmers an | 301 | * the clock_getres() system call to give application programmers an |
| @@ -243,6 +318,7 @@ static inline int hrtimer_is_hres_active(struct hrtimer *timer) | |||
| 243 | * is expired in the next softirq when the clock was advanced. | 318 | * is expired in the next softirq when the clock was advanced. |
| 244 | */ | 319 | */ |
| 245 | static inline void clock_was_set(void) { } | 320 | static inline void clock_was_set(void) { } |
| 321 | static inline void hrtimer_peek_ahead_timers(void) { } | ||
| 246 | 322 | ||
| 247 | static inline void hres_timers_resume(void) { } | 323 | static inline void hres_timers_resume(void) { } |
| 248 | 324 | ||
| @@ -264,6 +340,10 @@ static inline int hrtimer_is_hres_active(struct hrtimer *timer) | |||
| 264 | extern ktime_t ktime_get(void); | 340 | extern ktime_t ktime_get(void); |
| 265 | extern ktime_t ktime_get_real(void); | 341 | extern ktime_t ktime_get_real(void); |
| 266 | 342 | ||
| 343 | |||
| 344 | DECLARE_PER_CPU(struct tick_device, tick_cpu_device); | ||
| 345 | |||
| 346 | |||
| 267 | /* Exported timer functions: */ | 347 | /* Exported timer functions: */ |
| 268 | 348 | ||
| 269 | /* Initialize timers: */ | 349 | /* Initialize timers: */ |
| @@ -288,12 +368,25 @@ static inline void destroy_hrtimer_on_stack(struct hrtimer *timer) { } | |||
| 288 | /* Basic timer operations: */ | 368 | /* Basic timer operations: */ |
| 289 | extern int hrtimer_start(struct hrtimer *timer, ktime_t tim, | 369 | extern int hrtimer_start(struct hrtimer *timer, ktime_t tim, |
| 290 | const enum hrtimer_mode mode); | 370 | const enum hrtimer_mode mode); |
| 371 | extern int hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim, | ||
| 372 | unsigned long range_ns, const enum hrtimer_mode mode); | ||
| 291 | extern int hrtimer_cancel(struct hrtimer *timer); | 373 | extern int hrtimer_cancel(struct hrtimer *timer); |
| 292 | extern int hrtimer_try_to_cancel(struct hrtimer *timer); | 374 | extern int hrtimer_try_to_cancel(struct hrtimer *timer); |
| 293 | 375 | ||
| 376 | static inline int hrtimer_start_expires(struct hrtimer *timer, | ||
| 377 | enum hrtimer_mode mode) | ||
| 378 | { | ||
| 379 | unsigned long delta; | ||
| 380 | ktime_t soft, hard; | ||
| 381 | soft = hrtimer_get_softexpires(timer); | ||
| 382 | hard = hrtimer_get_expires(timer); | ||
| 383 | delta = ktime_to_ns(ktime_sub(hard, soft)); | ||
| 384 | return hrtimer_start_range_ns(timer, soft, delta, mode); | ||
| 385 | } | ||
| 386 | |||
| 294 | static inline int hrtimer_restart(struct hrtimer *timer) | 387 | static inline int hrtimer_restart(struct hrtimer *timer) |
| 295 | { | 388 | { |
| 296 | return hrtimer_start(timer, timer->expires, HRTIMER_MODE_ABS); | 389 | return hrtimer_start_expires(timer, HRTIMER_MODE_ABS); |
| 297 | } | 390 | } |
| 298 | 391 | ||
| 299 | /* Query timers: */ | 392 | /* Query timers: */ |
| @@ -350,6 +443,10 @@ extern long hrtimer_nanosleep_restart(struct restart_block *restart_block); | |||
| 350 | extern void hrtimer_init_sleeper(struct hrtimer_sleeper *sl, | 443 | extern void hrtimer_init_sleeper(struct hrtimer_sleeper *sl, |
| 351 | struct task_struct *tsk); | 444 | struct task_struct *tsk); |
| 352 | 445 | ||
| 446 | extern int schedule_hrtimeout_range(ktime_t *expires, unsigned long delta, | ||
| 447 | const enum hrtimer_mode mode); | ||
| 448 | extern int schedule_hrtimeout(ktime_t *expires, const enum hrtimer_mode mode); | ||
| 449 | |||
| 353 | /* Soft interrupt function to run the hrtimer queues: */ | 450 | /* Soft interrupt function to run the hrtimer queues: */ |
| 354 | extern void hrtimer_run_queues(void); | 451 | extern void hrtimer_run_queues(void); |
| 355 | extern void hrtimer_run_pending(void); | 452 | extern void hrtimer_run_pending(void); |
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 32e0ef0f6e1f..e1c8afc002c0 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h | |||
| @@ -27,7 +27,7 @@ void unmap_hugepage_range(struct vm_area_struct *, | |||
| 27 | void __unmap_hugepage_range(struct vm_area_struct *, | 27 | void __unmap_hugepage_range(struct vm_area_struct *, |
| 28 | unsigned long, unsigned long, struct page *); | 28 | unsigned long, unsigned long, struct page *); |
| 29 | int hugetlb_prefault(struct address_space *, struct vm_area_struct *); | 29 | int hugetlb_prefault(struct address_space *, struct vm_area_struct *); |
| 30 | int hugetlb_report_meminfo(char *); | 30 | void hugetlb_report_meminfo(struct seq_file *); |
| 31 | int hugetlb_report_node_meminfo(int, char *); | 31 | int hugetlb_report_node_meminfo(int, char *); |
| 32 | unsigned long hugetlb_total_pages(void); | 32 | unsigned long hugetlb_total_pages(void); |
| 33 | int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, | 33 | int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, |
| @@ -79,7 +79,9 @@ static inline unsigned long hugetlb_total_pages(void) | |||
| 79 | #define copy_hugetlb_page_range(src, dst, vma) ({ BUG(); 0; }) | 79 | #define copy_hugetlb_page_range(src, dst, vma) ({ BUG(); 0; }) |
| 80 | #define hugetlb_prefault(mapping, vma) ({ BUG(); 0; }) | 80 | #define hugetlb_prefault(mapping, vma) ({ BUG(); 0; }) |
| 81 | #define unmap_hugepage_range(vma, start, end, page) BUG() | 81 | #define unmap_hugepage_range(vma, start, end, page) BUG() |
| 82 | #define hugetlb_report_meminfo(buf) 0 | 82 | static inline void hugetlb_report_meminfo(struct seq_file *m) |
| 83 | { | ||
| 84 | } | ||
| 83 | #define hugetlb_report_node_meminfo(n, buf) 0 | 85 | #define hugetlb_report_node_meminfo(n, buf) 0 |
| 84 | #define follow_huge_pmd(mm, addr, pmd, write) NULL | 86 | #define follow_huge_pmd(mm, addr, pmd, write) NULL |
| 85 | #define follow_huge_pud(mm, addr, pud, write) NULL | 87 | #define follow_huge_pud(mm, addr, pud, write) NULL |
diff --git a/include/linux/i2c-algo-pcf.h b/include/linux/i2c-algo-pcf.h index 0177d280f733..0f91a957a690 100644 --- a/include/linux/i2c-algo-pcf.h +++ b/include/linux/i2c-algo-pcf.h | |||
| @@ -31,7 +31,10 @@ struct i2c_algo_pcf_data { | |||
| 31 | int (*getpcf) (void *data, int ctl); | 31 | int (*getpcf) (void *data, int ctl); |
| 32 | int (*getown) (void *data); | 32 | int (*getown) (void *data); |
| 33 | int (*getclock) (void *data); | 33 | int (*getclock) (void *data); |
| 34 | void (*waitforpin) (void); | 34 | void (*waitforpin) (void *data); |
| 35 | |||
| 36 | void (*xfer_begin) (void *data); | ||
| 37 | void (*xfer_end) (void *data); | ||
| 35 | 38 | ||
| 36 | /* Multi-master lost arbitration back-off delay (msecs) | 39 | /* Multi-master lost arbitration back-off delay (msecs) |
| 37 | * This should be set by the bus adapter or knowledgable client | 40 | * This should be set by the bus adapter or knowledgable client |
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 06115128047f..33a5992d4936 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h | |||
| @@ -53,45 +53,44 @@ struct i2c_board_info; | |||
| 53 | * transmit one message at a time, a more complex version can be used to | 53 | * transmit one message at a time, a more complex version can be used to |
| 54 | * transmit an arbitrary number of messages without interruption. | 54 | * transmit an arbitrary number of messages without interruption. |
| 55 | */ | 55 | */ |
| 56 | extern int i2c_master_send(struct i2c_client *,const char* ,int); | 56 | extern int i2c_master_send(struct i2c_client *client, const char *buf, |
| 57 | extern int i2c_master_recv(struct i2c_client *,char* ,int); | 57 | int count); |
| 58 | extern int i2c_master_recv(struct i2c_client *client, char *buf, int count); | ||
| 58 | 59 | ||
| 59 | /* Transfer num messages. | 60 | /* Transfer num messages. |
| 60 | */ | 61 | */ |
| 61 | extern int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num); | 62 | extern int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, |
| 62 | 63 | int num); | |
| 63 | 64 | ||
| 64 | /* This is the very generalized SMBus access routine. You probably do not | 65 | /* This is the very generalized SMBus access routine. You probably do not |
| 65 | want to use this, though; one of the functions below may be much easier, | 66 | want to use this, though; one of the functions below may be much easier, |
| 66 | and probably just as fast. | 67 | and probably just as fast. |
| 67 | Note that we use i2c_adapter here, because you do not need a specific | 68 | Note that we use i2c_adapter here, because you do not need a specific |
| 68 | smbus adapter to call this function. */ | 69 | smbus adapter to call this function. */ |
| 69 | extern s32 i2c_smbus_xfer (struct i2c_adapter * adapter, u16 addr, | 70 | extern s32 i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr, |
| 70 | unsigned short flags, | 71 | unsigned short flags, char read_write, u8 command, |
| 71 | char read_write, u8 command, int size, | 72 | int size, union i2c_smbus_data *data); |
| 72 | union i2c_smbus_data * data); | ||
| 73 | 73 | ||
| 74 | /* Now follow the 'nice' access routines. These also document the calling | 74 | /* Now follow the 'nice' access routines. These also document the calling |
| 75 | conventions of i2c_smbus_xfer. */ | 75 | conventions of i2c_smbus_xfer. */ |
| 76 | 76 | ||
| 77 | extern s32 i2c_smbus_read_byte(struct i2c_client * client); | 77 | extern s32 i2c_smbus_read_byte(struct i2c_client *client); |
| 78 | extern s32 i2c_smbus_write_byte(struct i2c_client * client, u8 value); | 78 | extern s32 i2c_smbus_write_byte(struct i2c_client *client, u8 value); |
| 79 | extern s32 i2c_smbus_read_byte_data(struct i2c_client * client, u8 command); | 79 | extern s32 i2c_smbus_read_byte_data(struct i2c_client *client, u8 command); |
| 80 | extern s32 i2c_smbus_write_byte_data(struct i2c_client * client, | 80 | extern s32 i2c_smbus_write_byte_data(struct i2c_client *client, |
| 81 | u8 command, u8 value); | 81 | u8 command, u8 value); |
| 82 | extern s32 i2c_smbus_read_word_data(struct i2c_client * client, u8 command); | 82 | extern s32 i2c_smbus_read_word_data(struct i2c_client *client, u8 command); |
| 83 | extern s32 i2c_smbus_write_word_data(struct i2c_client * client, | 83 | extern s32 i2c_smbus_write_word_data(struct i2c_client *client, |
| 84 | u8 command, u16 value); | 84 | u8 command, u16 value); |
| 85 | /* Returns the number of read bytes */ | 85 | /* Returns the number of read bytes */ |
| 86 | extern s32 i2c_smbus_read_block_data(struct i2c_client *client, | 86 | extern s32 i2c_smbus_read_block_data(struct i2c_client *client, |
| 87 | u8 command, u8 *values); | 87 | u8 command, u8 *values); |
| 88 | extern s32 i2c_smbus_write_block_data(struct i2c_client * client, | 88 | extern s32 i2c_smbus_write_block_data(struct i2c_client *client, |
| 89 | u8 command, u8 length, | 89 | u8 command, u8 length, const u8 *values); |
| 90 | const u8 *values); | ||
| 91 | /* Returns the number of read bytes */ | 90 | /* Returns the number of read bytes */ |
| 92 | extern s32 i2c_smbus_read_i2c_block_data(struct i2c_client * client, | 91 | extern s32 i2c_smbus_read_i2c_block_data(struct i2c_client *client, |
| 93 | u8 command, u8 length, u8 *values); | 92 | u8 command, u8 length, u8 *values); |
| 94 | extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client * client, | 93 | extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client *client, |
| 95 | u8 command, u8 length, | 94 | u8 command, u8 length, |
| 96 | const u8 *values); | 95 | const u8 *values); |
| 97 | 96 | ||
| @@ -169,7 +168,7 @@ struct i2c_driver { | |||
| 169 | /* a ioctl like command that can be used to perform specific functions | 168 | /* a ioctl like command that can be used to perform specific functions |
| 170 | * with the device. | 169 | * with the device. |
| 171 | */ | 170 | */ |
| 172 | int (*command)(struct i2c_client *client,unsigned int cmd, void *arg); | 171 | int (*command)(struct i2c_client *client, unsigned int cmd, void *arg); |
| 173 | 172 | ||
| 174 | struct device_driver driver; | 173 | struct device_driver driver; |
| 175 | const struct i2c_device_id *id_table; | 174 | const struct i2c_device_id *id_table; |
| @@ -224,14 +223,14 @@ static inline struct i2c_client *kobj_to_i2c_client(struct kobject *kobj) | |||
| 224 | return to_i2c_client(dev); | 223 | return to_i2c_client(dev); |
| 225 | } | 224 | } |
| 226 | 225 | ||
| 227 | static inline void *i2c_get_clientdata (struct i2c_client *dev) | 226 | static inline void *i2c_get_clientdata(const struct i2c_client *dev) |
| 228 | { | 227 | { |
| 229 | return dev_get_drvdata (&dev->dev); | 228 | return dev_get_drvdata(&dev->dev); |
| 230 | } | 229 | } |
| 231 | 230 | ||
| 232 | static inline void i2c_set_clientdata (struct i2c_client *dev, void *data) | 231 | static inline void i2c_set_clientdata(struct i2c_client *dev, void *data) |
| 233 | { | 232 | { |
| 234 | dev_set_drvdata (&dev->dev, data); | 233 | dev_set_drvdata(&dev->dev, data); |
| 235 | } | 234 | } |
| 236 | 235 | ||
| 237 | /** | 236 | /** |
| @@ -240,6 +239,7 @@ static inline void i2c_set_clientdata (struct i2c_client *dev, void *data) | |||
| 240 | * @flags: to initialize i2c_client.flags | 239 | * @flags: to initialize i2c_client.flags |
| 241 | * @addr: stored in i2c_client.addr | 240 | * @addr: stored in i2c_client.addr |
| 242 | * @platform_data: stored in i2c_client.dev.platform_data | 241 | * @platform_data: stored in i2c_client.dev.platform_data |
| 242 | * @archdata: copied into i2c_client.dev.archdata | ||
| 243 | * @irq: stored in i2c_client.irq | 243 | * @irq: stored in i2c_client.irq |
| 244 | * | 244 | * |
| 245 | * I2C doesn't actually support hardware probing, although controllers and | 245 | * I2C doesn't actually support hardware probing, although controllers and |
| @@ -259,6 +259,7 @@ struct i2c_board_info { | |||
| 259 | unsigned short flags; | 259 | unsigned short flags; |
| 260 | unsigned short addr; | 260 | unsigned short addr; |
| 261 | void *platform_data; | 261 | void *platform_data; |
| 262 | struct dev_archdata *archdata; | ||
| 262 | int irq; | 263 | int irq; |
| 263 | }; | 264 | }; |
| 264 | 265 | ||
| @@ -272,7 +273,7 @@ struct i2c_board_info { | |||
| 272 | * fields (such as associated irq, or device-specific platform_data) | 273 | * fields (such as associated irq, or device-specific platform_data) |
| 273 | * are provided using conventional syntax. | 274 | * are provided using conventional syntax. |
| 274 | */ | 275 | */ |
| 275 | #define I2C_BOARD_INFO(dev_type,dev_addr) \ | 276 | #define I2C_BOARD_INFO(dev_type, dev_addr) \ |
| 276 | .type = (dev_type), .addr = (dev_addr) | 277 | .type = (dev_type), .addr = (dev_addr) |
| 277 | 278 | ||
| 278 | 279 | ||
| @@ -306,10 +307,12 @@ extern void i2c_unregister_device(struct i2c_client *); | |||
| 306 | */ | 307 | */ |
| 307 | #ifdef CONFIG_I2C_BOARDINFO | 308 | #ifdef CONFIG_I2C_BOARDINFO |
| 308 | extern int | 309 | extern int |
| 309 | i2c_register_board_info(int busnum, struct i2c_board_info const *info, unsigned n); | 310 | i2c_register_board_info(int busnum, struct i2c_board_info const *info, |
| 311 | unsigned n); | ||
| 310 | #else | 312 | #else |
| 311 | static inline int | 313 | static inline int |
| 312 | i2c_register_board_info(int busnum, struct i2c_board_info const *info, unsigned n) | 314 | i2c_register_board_info(int busnum, struct i2c_board_info const *info, |
| 315 | unsigned n) | ||
| 313 | { | 316 | { |
| 314 | return 0; | 317 | return 0; |
| 315 | } | 318 | } |
| @@ -328,11 +331,11 @@ struct i2c_algorithm { | |||
| 328 | using common I2C messages */ | 331 | using common I2C messages */ |
| 329 | /* master_xfer should return the number of messages successfully | 332 | /* master_xfer should return the number of messages successfully |
| 330 | processed, or a negative value on error */ | 333 | processed, or a negative value on error */ |
| 331 | int (*master_xfer)(struct i2c_adapter *adap,struct i2c_msg *msgs, | 334 | int (*master_xfer)(struct i2c_adapter *adap, struct i2c_msg *msgs, |
| 332 | int num); | 335 | int num); |
| 333 | int (*smbus_xfer) (struct i2c_adapter *adap, u16 addr, | 336 | int (*smbus_xfer) (struct i2c_adapter *adap, u16 addr, |
| 334 | unsigned short flags, char read_write, | 337 | unsigned short flags, char read_write, |
| 335 | u8 command, int size, union i2c_smbus_data * data); | 338 | u8 command, int size, union i2c_smbus_data *data); |
| 336 | 339 | ||
| 337 | /* To determine what the adapter supports */ | 340 | /* To determine what the adapter supports */ |
| 338 | u32 (*functionality) (struct i2c_adapter *); | 341 | u32 (*functionality) (struct i2c_adapter *); |
| @@ -345,7 +348,7 @@ struct i2c_algorithm { | |||
| 345 | struct i2c_adapter { | 348 | struct i2c_adapter { |
| 346 | struct module *owner; | 349 | struct module *owner; |
| 347 | unsigned int id; | 350 | unsigned int id; |
| 348 | unsigned int class; | 351 | unsigned int class; /* classes to allow probing for */ |
| 349 | const struct i2c_algorithm *algo; /* the algorithm to access the bus */ | 352 | const struct i2c_algorithm *algo; /* the algorithm to access the bus */ |
| 350 | void *algo_data; | 353 | void *algo_data; |
| 351 | 354 | ||
| @@ -369,14 +372,14 @@ struct i2c_adapter { | |||
| 369 | }; | 372 | }; |
| 370 | #define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev) | 373 | #define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev) |
| 371 | 374 | ||
| 372 | static inline void *i2c_get_adapdata (struct i2c_adapter *dev) | 375 | static inline void *i2c_get_adapdata(const struct i2c_adapter *dev) |
| 373 | { | 376 | { |
| 374 | return dev_get_drvdata (&dev->dev); | 377 | return dev_get_drvdata(&dev->dev); |
| 375 | } | 378 | } |
| 376 | 379 | ||
| 377 | static inline void i2c_set_adapdata (struct i2c_adapter *dev, void *data) | 380 | static inline void i2c_set_adapdata(struct i2c_adapter *dev, void *data) |
| 378 | { | 381 | { |
| 379 | dev_set_drvdata (&dev->dev, data); | 382 | dev_set_drvdata(&dev->dev, data); |
| 380 | } | 383 | } |
| 381 | 384 | ||
| 382 | /*flags for the client struct: */ | 385 | /*flags for the client struct: */ |
| @@ -449,7 +452,7 @@ extern int i2c_probe(struct i2c_adapter *adapter, | |||
| 449 | const struct i2c_client_address_data *address_data, | 452 | const struct i2c_client_address_data *address_data, |
| 450 | int (*found_proc) (struct i2c_adapter *, int, int)); | 453 | int (*found_proc) (struct i2c_adapter *, int, int)); |
| 451 | 454 | ||
| 452 | extern struct i2c_adapter* i2c_get_adapter(int id); | 455 | extern struct i2c_adapter *i2c_get_adapter(int id); |
| 453 | extern void i2c_put_adapter(struct i2c_adapter *adap); | 456 | extern void i2c_put_adapter(struct i2c_adapter *adap); |
| 454 | 457 | ||
| 455 | 458 | ||
| @@ -465,7 +468,7 @@ static inline int i2c_check_functionality(struct i2c_adapter *adap, u32 func) | |||
| 465 | return (func & i2c_get_functionality(adap)) == func; | 468 | return (func & i2c_get_functionality(adap)) == func; |
| 466 | } | 469 | } |
| 467 | 470 | ||
| 468 | /* Return id number for a specific adapter */ | 471 | /* Return the adapter number for a specific adapter */ |
| 469 | static inline int i2c_adapter_id(struct i2c_adapter *adap) | 472 | static inline int i2c_adapter_id(struct i2c_adapter *adap) |
| 470 | { | 473 | { |
| 471 | return adap->nr; | 474 | return adap->nr; |
| @@ -526,7 +529,7 @@ struct i2c_msg { | |||
| 526 | 529 | ||
| 527 | #define I2C_FUNC_I2C 0x00000001 | 530 | #define I2C_FUNC_I2C 0x00000001 |
| 528 | #define I2C_FUNC_10BIT_ADDR 0x00000002 | 531 | #define I2C_FUNC_10BIT_ADDR 0x00000002 |
| 529 | #define I2C_FUNC_PROTOCOL_MANGLING 0x00000004 /* I2C_M_{REV_DIR_ADDR,NOSTART,..} */ | 532 | #define I2C_FUNC_PROTOCOL_MANGLING 0x00000004 /* I2C_M_NOSTART etc. */ |
| 530 | #define I2C_FUNC_SMBUS_PEC 0x00000008 | 533 | #define I2C_FUNC_SMBUS_PEC 0x00000008 |
| 531 | #define I2C_FUNC_SMBUS_BLOCK_PROC_CALL 0x00008000 /* SMBus 2.0 */ | 534 | #define I2C_FUNC_SMBUS_BLOCK_PROC_CALL 0x00008000 /* SMBus 2.0 */ |
| 532 | #define I2C_FUNC_SMBUS_QUICK 0x00010000 | 535 | #define I2C_FUNC_SMBUS_QUICK 0x00010000 |
| @@ -541,30 +544,26 @@ struct i2c_msg { | |||
| 541 | #define I2C_FUNC_SMBUS_WRITE_BLOCK_DATA 0x02000000 | 544 | #define I2C_FUNC_SMBUS_WRITE_BLOCK_DATA 0x02000000 |
| 542 | #define I2C_FUNC_SMBUS_READ_I2C_BLOCK 0x04000000 /* I2C-like block xfer */ | 545 | #define I2C_FUNC_SMBUS_READ_I2C_BLOCK 0x04000000 /* I2C-like block xfer */ |
| 543 | #define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK 0x08000000 /* w/ 1-byte reg. addr. */ | 546 | #define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK 0x08000000 /* w/ 1-byte reg. addr. */ |
| 544 | #define I2C_FUNC_SMBUS_READ_I2C_BLOCK_2 0x10000000 /* I2C-like block xfer */ | 547 | |
| 545 | #define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK_2 0x20000000 /* w/ 2-byte reg. addr. */ | 548 | #define I2C_FUNC_SMBUS_BYTE (I2C_FUNC_SMBUS_READ_BYTE | \ |
| 546 | 549 | I2C_FUNC_SMBUS_WRITE_BYTE) | |
| 547 | #define I2C_FUNC_SMBUS_BYTE (I2C_FUNC_SMBUS_READ_BYTE | \ | 550 | #define I2C_FUNC_SMBUS_BYTE_DATA (I2C_FUNC_SMBUS_READ_BYTE_DATA | \ |
| 548 | I2C_FUNC_SMBUS_WRITE_BYTE) | 551 | I2C_FUNC_SMBUS_WRITE_BYTE_DATA) |
| 549 | #define I2C_FUNC_SMBUS_BYTE_DATA (I2C_FUNC_SMBUS_READ_BYTE_DATA | \ | 552 | #define I2C_FUNC_SMBUS_WORD_DATA (I2C_FUNC_SMBUS_READ_WORD_DATA | \ |
| 550 | I2C_FUNC_SMBUS_WRITE_BYTE_DATA) | 553 | I2C_FUNC_SMBUS_WRITE_WORD_DATA) |
| 551 | #define I2C_FUNC_SMBUS_WORD_DATA (I2C_FUNC_SMBUS_READ_WORD_DATA | \ | 554 | #define I2C_FUNC_SMBUS_BLOCK_DATA (I2C_FUNC_SMBUS_READ_BLOCK_DATA | \ |
| 552 | I2C_FUNC_SMBUS_WRITE_WORD_DATA) | 555 | I2C_FUNC_SMBUS_WRITE_BLOCK_DATA) |
| 553 | #define I2C_FUNC_SMBUS_BLOCK_DATA (I2C_FUNC_SMBUS_READ_BLOCK_DATA | \ | 556 | #define I2C_FUNC_SMBUS_I2C_BLOCK (I2C_FUNC_SMBUS_READ_I2C_BLOCK | \ |
| 554 | I2C_FUNC_SMBUS_WRITE_BLOCK_DATA) | 557 | I2C_FUNC_SMBUS_WRITE_I2C_BLOCK) |
| 555 | #define I2C_FUNC_SMBUS_I2C_BLOCK (I2C_FUNC_SMBUS_READ_I2C_BLOCK | \ | 558 | |
| 556 | I2C_FUNC_SMBUS_WRITE_I2C_BLOCK) | 559 | #define I2C_FUNC_SMBUS_EMUL (I2C_FUNC_SMBUS_QUICK | \ |
| 557 | #define I2C_FUNC_SMBUS_I2C_BLOCK_2 (I2C_FUNC_SMBUS_READ_I2C_BLOCK_2 | \ | 560 | I2C_FUNC_SMBUS_BYTE | \ |
| 558 | I2C_FUNC_SMBUS_WRITE_I2C_BLOCK_2) | 561 | I2C_FUNC_SMBUS_BYTE_DATA | \ |
| 559 | 562 | I2C_FUNC_SMBUS_WORD_DATA | \ | |
| 560 | #define I2C_FUNC_SMBUS_EMUL (I2C_FUNC_SMBUS_QUICK | \ | 563 | I2C_FUNC_SMBUS_PROC_CALL | \ |
| 561 | I2C_FUNC_SMBUS_BYTE | \ | 564 | I2C_FUNC_SMBUS_WRITE_BLOCK_DATA | \ |
| 562 | I2C_FUNC_SMBUS_BYTE_DATA | \ | 565 | I2C_FUNC_SMBUS_I2C_BLOCK | \ |
| 563 | I2C_FUNC_SMBUS_WORD_DATA | \ | 566 | I2C_FUNC_SMBUS_PEC) |
| 564 | I2C_FUNC_SMBUS_PROC_CALL | \ | ||
| 565 | I2C_FUNC_SMBUS_WRITE_BLOCK_DATA | \ | ||
| 566 | I2C_FUNC_SMBUS_I2C_BLOCK | \ | ||
| 567 | I2C_FUNC_SMBUS_PEC) | ||
| 568 | 567 | ||
| 569 | /* | 568 | /* |
| 570 | * Data for SMBus Messages | 569 | * Data for SMBus Messages |
| @@ -574,7 +573,7 @@ union i2c_smbus_data { | |||
| 574 | __u8 byte; | 573 | __u8 byte; |
| 575 | __u16 word; | 574 | __u16 word; |
| 576 | __u8 block[I2C_SMBUS_BLOCK_MAX + 2]; /* block[0] is used for length */ | 575 | __u8 block[I2C_SMBUS_BLOCK_MAX + 2]; /* block[0] is used for length */ |
| 577 | /* and one more for user-space compatibility */ | 576 | /* and one more for user-space compatibility */ |
| 578 | }; | 577 | }; |
| 579 | 578 | ||
| 580 | /* i2c_smbus_xfer read or write markers */ | 579 | /* i2c_smbus_xfer read or write markers */ |
| @@ -602,21 +601,21 @@ union i2c_smbus_data { | |||
| 602 | 601 | ||
| 603 | /* Default fill of many variables */ | 602 | /* Default fill of many variables */ |
| 604 | #define I2C_CLIENT_DEFAULTS {I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | 603 | #define I2C_CLIENT_DEFAULTS {I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ |
| 605 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | 604 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ |
| 606 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | 605 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ |
| 607 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | 606 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ |
| 608 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | 607 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ |
| 609 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | 608 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ |
| 610 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | 609 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ |
| 611 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | 610 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ |
| 612 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | 611 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ |
| 613 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | 612 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ |
| 614 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | 613 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ |
| 615 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | 614 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ |
| 616 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | 615 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ |
| 617 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | 616 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ |
| 618 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | 617 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ |
| 619 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END} | 618 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END} |
| 620 | 619 | ||
| 621 | /* I2C_CLIENT_MODULE_PARM creates a module parameter, and puts it in the | 620 | /* I2C_CLIENT_MODULE_PARM creates a module parameter, and puts it in the |
| 622 | module header */ | 621 | module header */ |
| @@ -625,7 +624,7 @@ union i2c_smbus_data { | |||
| 625 | static unsigned short var[I2C_CLIENT_MAX_OPTS] = I2C_CLIENT_DEFAULTS; \ | 624 | static unsigned short var[I2C_CLIENT_MAX_OPTS] = I2C_CLIENT_DEFAULTS; \ |
| 626 | static unsigned int var##_num; \ | 625 | static unsigned int var##_num; \ |
| 627 | module_param_array(var, short, &var##_num, 0); \ | 626 | module_param_array(var, short, &var##_num, 0); \ |
| 628 | MODULE_PARM_DESC(var,desc) | 627 | MODULE_PARM_DESC(var, desc) |
| 629 | 628 | ||
| 630 | #define I2C_CLIENT_MODULE_PARM_FORCE(name) \ | 629 | #define I2C_CLIENT_MODULE_PARM_FORCE(name) \ |
| 631 | I2C_CLIENT_MODULE_PARM(force_##name, \ | 630 | I2C_CLIENT_MODULE_PARM(force_##name, \ |
diff --git a/include/linux/i2c/twl4030.h b/include/linux/i2c/twl4030.h index cdb453162a97..fb604dcd38f1 100644 --- a/include/linux/i2c/twl4030.h +++ b/include/linux/i2c/twl4030.h | |||
| @@ -228,6 +228,12 @@ struct twl4030_gpio_platform_data { | |||
| 228 | int gpio_base; | 228 | int gpio_base; |
| 229 | unsigned irq_base, irq_end; | 229 | unsigned irq_base, irq_end; |
| 230 | 230 | ||
| 231 | /* package the two LED signals as output-only GPIOs? */ | ||
| 232 | bool use_leds; | ||
| 233 | |||
| 234 | /* gpio-n should control VMMC(n+1) if BIT(n) in mmc_cd is set */ | ||
| 235 | u8 mmc_cd; | ||
| 236 | |||
| 231 | /* For gpio-N, bit (1 << N) in "pullups" is set if that pullup | 237 | /* For gpio-N, bit (1 << N) in "pullups" is set if that pullup |
| 232 | * should be enabled. Else, if that bit is set in "pulldowns", | 238 | * should be enabled. Else, if that bit is set in "pulldowns", |
| 233 | * that pulldown is enabled. Don't waste power by letting any | 239 | * that pulldown is enabled. Don't waste power by letting any |
| @@ -277,6 +283,8 @@ struct twl4030_platform_data { | |||
| 277 | 283 | ||
| 278 | /*----------------------------------------------------------------------*/ | 284 | /*----------------------------------------------------------------------*/ |
| 279 | 285 | ||
| 286 | int twl4030_sih_setup(int module); | ||
| 287 | |||
| 280 | /* | 288 | /* |
| 281 | * FIXME completely stop using TWL4030_IRQ_BASE ... instead, pass the | 289 | * FIXME completely stop using TWL4030_IRQ_BASE ... instead, pass the |
| 282 | * IRQ data to subsidiary devices using platform device resources. | 290 | * IRQ data to subsidiary devices using platform device resources. |
| @@ -291,16 +299,16 @@ struct twl4030_platform_data { | |||
| 291 | #define TWL4030_MODIRQ_BCI (TWL4030_IRQ_BASE + 2) | 299 | #define TWL4030_MODIRQ_BCI (TWL4030_IRQ_BASE + 2) |
| 292 | #define TWL4030_MODIRQ_MADC (TWL4030_IRQ_BASE + 3) | 300 | #define TWL4030_MODIRQ_MADC (TWL4030_IRQ_BASE + 3) |
| 293 | /* #define TWL4030_MODIRQ_USB (TWL4030_IRQ_BASE + 4) */ | 301 | /* #define TWL4030_MODIRQ_USB (TWL4030_IRQ_BASE + 4) */ |
| 294 | #define TWL4030_MODIRQ_PWR (TWL4030_IRQ_BASE + 5) | 302 | /* #define TWL4030_MODIRQ_PWR (TWL4030_IRQ_BASE + 5) */ |
| 295 | 303 | ||
| 296 | #define TWL4030_PWRIRQ_PWRBTN (TWL4030_PWR_IRQ_BASE + 0) | 304 | #define TWL4030_PWRIRQ_PWRBTN (TWL4030_PWR_IRQ_BASE + 0) |
| 297 | #define TWL4030_PWRIRQ_CHG_PRES (TWL4030_PWR_IRQ_BASE + 1) | 305 | /* #define TWL4030_PWRIRQ_CHG_PRES (TWL4030_PWR_IRQ_BASE + 1) */ |
| 298 | #define TWL4030_PWRIRQ_USB_PRES (TWL4030_PWR_IRQ_BASE + 2) | 306 | /* #define TWL4030_PWRIRQ_USB_PRES (TWL4030_PWR_IRQ_BASE + 2) */ |
| 299 | #define TWL4030_PWRIRQ_RTC (TWL4030_PWR_IRQ_BASE + 3) | 307 | /* #define TWL4030_PWRIRQ_RTC (TWL4030_PWR_IRQ_BASE + 3) */ |
| 300 | #define TWL4030_PWRIRQ_HOT_DIE (TWL4030_PWR_IRQ_BASE + 4) | 308 | /* #define TWL4030_PWRIRQ_HOT_DIE (TWL4030_PWR_IRQ_BASE + 4) */ |
| 301 | #define TWL4030_PWRIRQ_PWROK_TIMEOUT (TWL4030_PWR_IRQ_BASE + 5) | 309 | /* #define TWL4030_PWRIRQ_PWROK_TIMEOUT (TWL4030_PWR_IRQ_BASE + 5) */ |
| 302 | #define TWL4030_PWRIRQ_MBCHG (TWL4030_PWR_IRQ_BASE + 6) | 310 | /* #define TWL4030_PWRIRQ_MBCHG (TWL4030_PWR_IRQ_BASE + 6) */ |
| 303 | #define TWL4030_PWRIRQ_SC_DETECT (TWL4030_PWR_IRQ_BASE + 7) | 311 | /* #define TWL4030_PWRIRQ_SC_DETECT (TWL4030_PWR_IRQ_BASE + 7) */ |
| 304 | 312 | ||
| 305 | /* Rest are unsued currently*/ | 313 | /* Rest are unsued currently*/ |
| 306 | 314 | ||
| @@ -317,17 +325,13 @@ struct twl4030_platform_data { | |||
| 317 | /* TWL4030 GPIO interrupt definitions */ | 325 | /* TWL4030 GPIO interrupt definitions */ |
| 318 | 326 | ||
| 319 | #define TWL4030_GPIO_IRQ_NO(n) (TWL4030_GPIO_IRQ_BASE + (n)) | 327 | #define TWL4030_GPIO_IRQ_NO(n) (TWL4030_GPIO_IRQ_BASE + (n)) |
| 320 | #define TWL4030_GPIO_IS_ENABLE 1 | ||
| 321 | 328 | ||
| 322 | /* | 329 | /* |
| 323 | * Exported TWL4030 GPIO APIs | 330 | * Exported TWL4030 GPIO APIs |
| 324 | * | 331 | * |
| 325 | * WARNING -- use standard GPIO and IRQ calls instead; these will vanish. | 332 | * WARNING -- use standard GPIO and IRQ calls instead; these will vanish. |
| 326 | */ | 333 | */ |
| 327 | int twl4030_get_gpio_datain(int gpio); | ||
| 328 | int twl4030_request_gpio(int gpio); | ||
| 329 | int twl4030_set_gpio_debounce(int gpio, int enable); | 334 | int twl4030_set_gpio_debounce(int gpio, int enable); |
| 330 | int twl4030_free_gpio(int gpio); | ||
| 331 | 335 | ||
| 332 | #if defined(CONFIG_TWL4030_BCI_BATTERY) || \ | 336 | #if defined(CONFIG_TWL4030_BCI_BATTERY) || \ |
| 333 | defined(CONFIG_TWL4030_BCI_BATTERY_MODULE) | 337 | defined(CONFIG_TWL4030_BCI_BATTERY_MODULE) |
diff --git a/include/linux/ide.h b/include/linux/ide.h index 89e53cfbc787..54525be4b5f8 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
| @@ -474,8 +474,8 @@ struct ide_disk_ops { | |||
| 474 | ide_startstop_t (*do_request)(struct ide_drive_s *, struct request *, | 474 | ide_startstop_t (*do_request)(struct ide_drive_s *, struct request *, |
| 475 | sector_t); | 475 | sector_t); |
| 476 | int (*end_request)(struct ide_drive_s *, int, int); | 476 | int (*end_request)(struct ide_drive_s *, int, int); |
| 477 | int (*ioctl)(struct ide_drive_s *, struct inode *, | 477 | int (*ioctl)(struct ide_drive_s *, struct block_device *, |
| 478 | struct file *, unsigned int, unsigned long); | 478 | fmode_t, unsigned int, unsigned long); |
| 479 | }; | 479 | }; |
| 480 | 480 | ||
| 481 | /* ATAPI device flags */ | 481 | /* ATAPI device flags */ |
| @@ -1158,8 +1158,7 @@ struct ide_ioctl_devset { | |||
| 1158 | int ide_setting_ioctl(ide_drive_t *, struct block_device *, unsigned int, | 1158 | int ide_setting_ioctl(ide_drive_t *, struct block_device *, unsigned int, |
| 1159 | unsigned long, const struct ide_ioctl_devset *); | 1159 | unsigned long, const struct ide_ioctl_devset *); |
| 1160 | 1160 | ||
| 1161 | int generic_ide_ioctl(ide_drive_t *, struct file *, struct block_device *, | 1161 | int generic_ide_ioctl(ide_drive_t *, struct block_device *, unsigned, unsigned long); |
| 1162 | unsigned, unsigned long); | ||
| 1163 | 1162 | ||
| 1164 | extern int ide_vlb_clk; | 1163 | extern int ide_vlb_clk; |
| 1165 | extern int ide_pci_clk; | 1164 | extern int ide_pci_clk; |
diff --git a/include/linux/init_task.h b/include/linux/init_task.h index 021d8e720c79..23fd8909b9e5 100644 --- a/include/linux/init_task.h +++ b/include/linux/init_task.h | |||
| @@ -170,6 +170,7 @@ extern struct group_info init_groups; | |||
| 170 | .cpu_timers = INIT_CPU_TIMERS(tsk.cpu_timers), \ | 170 | .cpu_timers = INIT_CPU_TIMERS(tsk.cpu_timers), \ |
| 171 | .fs_excl = ATOMIC_INIT(0), \ | 171 | .fs_excl = ATOMIC_INIT(0), \ |
| 172 | .pi_lock = __SPIN_LOCK_UNLOCKED(tsk.pi_lock), \ | 172 | .pi_lock = __SPIN_LOCK_UNLOCKED(tsk.pi_lock), \ |
| 173 | .timer_slack_ns = 50000, /* 50 usec default slack */ \ | ||
| 173 | .pids = { \ | 174 | .pids = { \ |
| 174 | [PIDTYPE_PID] = INIT_PID_LINK(PIDTYPE_PID), \ | 175 | [PIDTYPE_PID] = INIT_PID_LINK(PIDTYPE_PID), \ |
| 175 | [PIDTYPE_PGID] = INIT_PID_LINK(PIDTYPE_PGID), \ | 176 | [PIDTYPE_PGID] = INIT_PID_LINK(PIDTYPE_PGID), \ |
diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h index 2e117f30a76c..3d017cfd245b 100644 --- a/include/linux/intel-iommu.h +++ b/include/linux/intel-iommu.h | |||
| @@ -29,6 +29,7 @@ | |||
| 29 | #include <linux/io.h> | 29 | #include <linux/io.h> |
| 30 | #include <linux/dma_remapping.h> | 30 | #include <linux/dma_remapping.h> |
| 31 | #include <asm/cacheflush.h> | 31 | #include <asm/cacheflush.h> |
| 32 | #include <asm/iommu.h> | ||
| 32 | 33 | ||
| 33 | /* | 34 | /* |
| 34 | * Intel IOMMU register specification per version 1.0 public spec. | 35 | * Intel IOMMU register specification per version 1.0 public spec. |
| @@ -127,6 +128,7 @@ static inline void dmar_writeq(void __iomem *addr, u64 val) | |||
| 127 | 128 | ||
| 128 | 129 | ||
| 129 | /* IOTLB_REG */ | 130 | /* IOTLB_REG */ |
| 131 | #define DMA_TLB_FLUSH_GRANU_OFFSET 60 | ||
| 130 | #define DMA_TLB_GLOBAL_FLUSH (((u64)1) << 60) | 132 | #define DMA_TLB_GLOBAL_FLUSH (((u64)1) << 60) |
| 131 | #define DMA_TLB_DSI_FLUSH (((u64)2) << 60) | 133 | #define DMA_TLB_DSI_FLUSH (((u64)2) << 60) |
| 132 | #define DMA_TLB_PSI_FLUSH (((u64)3) << 60) | 134 | #define DMA_TLB_PSI_FLUSH (((u64)3) << 60) |
| @@ -140,6 +142,7 @@ static inline void dmar_writeq(void __iomem *addr, u64 val) | |||
| 140 | #define DMA_TLB_MAX_SIZE (0x3f) | 142 | #define DMA_TLB_MAX_SIZE (0x3f) |
| 141 | 143 | ||
| 142 | /* INVALID_DESC */ | 144 | /* INVALID_DESC */ |
| 145 | #define DMA_CCMD_INVL_GRANU_OFFSET 61 | ||
| 143 | #define DMA_ID_TLB_GLOBAL_FLUSH (((u64)1) << 3) | 146 | #define DMA_ID_TLB_GLOBAL_FLUSH (((u64)1) << 3) |
| 144 | #define DMA_ID_TLB_DSI_FLUSH (((u64)2) << 3) | 147 | #define DMA_ID_TLB_DSI_FLUSH (((u64)2) << 3) |
| 145 | #define DMA_ID_TLB_PSI_FLUSH (((u64)3) << 3) | 148 | #define DMA_ID_TLB_PSI_FLUSH (((u64)3) << 3) |
| @@ -200,22 +203,21 @@ static inline void dmar_writeq(void __iomem *addr, u64 val) | |||
| 200 | #define dma_frcd_type(d) ((d >> 30) & 1) | 203 | #define dma_frcd_type(d) ((d >> 30) & 1) |
| 201 | #define dma_frcd_fault_reason(c) (c & 0xff) | 204 | #define dma_frcd_fault_reason(c) (c & 0xff) |
| 202 | #define dma_frcd_source_id(c) (c & 0xffff) | 205 | #define dma_frcd_source_id(c) (c & 0xffff) |
| 203 | #define dma_frcd_page_addr(d) (d & (((u64)-1) << 12)) /* low 64 bit */ | 206 | /* low 64 bit */ |
| 204 | 207 | #define dma_frcd_page_addr(d) (d & (((u64)-1) << PAGE_SHIFT)) | |
| 205 | #define DMAR_OPERATION_TIMEOUT ((cycles_t) tsc_khz*10*1000) /* 10sec */ | 208 | |
| 206 | 209 | #define IOMMU_WAIT_OP(iommu, offset, op, cond, sts) \ | |
| 207 | #define IOMMU_WAIT_OP(iommu, offset, op, cond, sts) \ | 210 | do { \ |
| 208 | {\ | 211 | cycles_t start_time = get_cycles(); \ |
| 209 | cycles_t start_time = get_cycles();\ | 212 | while (1) { \ |
| 210 | while (1) {\ | 213 | sts = op(iommu->reg + offset); \ |
| 211 | sts = op (iommu->reg + offset);\ | 214 | if (cond) \ |
| 212 | if (cond)\ | 215 | break; \ |
| 213 | break;\ | ||
| 214 | if (DMAR_OPERATION_TIMEOUT < (get_cycles() - start_time))\ | 216 | if (DMAR_OPERATION_TIMEOUT < (get_cycles() - start_time))\ |
| 215 | panic("DMAR hardware is malfunctioning\n");\ | 217 | panic("DMAR hardware is malfunctioning\n"); \ |
| 216 | cpu_relax();\ | 218 | cpu_relax(); \ |
| 217 | }\ | 219 | } \ |
| 218 | } | 220 | } while (0) |
| 219 | 221 | ||
| 220 | #define QI_LENGTH 256 /* queue length */ | 222 | #define QI_LENGTH 256 /* queue length */ |
| 221 | 223 | ||
| @@ -238,6 +240,19 @@ enum { | |||
| 238 | #define QI_IWD_STATUS_DATA(d) (((u64)d) << 32) | 240 | #define QI_IWD_STATUS_DATA(d) (((u64)d) << 32) |
| 239 | #define QI_IWD_STATUS_WRITE (((u64)1) << 5) | 241 | #define QI_IWD_STATUS_WRITE (((u64)1) << 5) |
| 240 | 242 | ||
| 243 | #define QI_IOTLB_DID(did) (((u64)did) << 16) | ||
| 244 | #define QI_IOTLB_DR(dr) (((u64)dr) << 7) | ||
| 245 | #define QI_IOTLB_DW(dw) (((u64)dw) << 6) | ||
| 246 | #define QI_IOTLB_GRAN(gran) (((u64)gran) >> (DMA_TLB_FLUSH_GRANU_OFFSET-4)) | ||
| 247 | #define QI_IOTLB_ADDR(addr) (((u64)addr) & VTD_PAGE_MASK) | ||
| 248 | #define QI_IOTLB_IH(ih) (((u64)ih) << 6) | ||
| 249 | #define QI_IOTLB_AM(am) (((u8)am)) | ||
| 250 | |||
| 251 | #define QI_CC_FM(fm) (((u64)fm) << 48) | ||
| 252 | #define QI_CC_SID(sid) (((u64)sid) << 32) | ||
| 253 | #define QI_CC_DID(did) (((u64)did) << 16) | ||
| 254 | #define QI_CC_GRAN(gran) (((u64)gran) >> (DMA_CCMD_INVL_GRANU_OFFSET-4)) | ||
| 255 | |||
| 241 | struct qi_desc { | 256 | struct qi_desc { |
| 242 | u64 low, high; | 257 | u64 low, high; |
| 243 | }; | 258 | }; |
| @@ -263,6 +278,13 @@ struct ir_table { | |||
| 263 | }; | 278 | }; |
| 264 | #endif | 279 | #endif |
| 265 | 280 | ||
| 281 | struct iommu_flush { | ||
| 282 | int (*flush_context)(struct intel_iommu *iommu, u16 did, u16 sid, u8 fm, | ||
| 283 | u64 type, int non_present_entry_flush); | ||
| 284 | int (*flush_iotlb)(struct intel_iommu *iommu, u16 did, u64 addr, | ||
| 285 | unsigned int size_order, u64 type, int non_present_entry_flush); | ||
| 286 | }; | ||
| 287 | |||
| 266 | struct intel_iommu { | 288 | struct intel_iommu { |
| 267 | void __iomem *reg; /* Pointer to hardware regs, virtual addr */ | 289 | void __iomem *reg; /* Pointer to hardware regs, virtual addr */ |
| 268 | u64 cap; | 290 | u64 cap; |
| @@ -282,6 +304,7 @@ struct intel_iommu { | |||
| 282 | unsigned char name[7]; /* Device Name */ | 304 | unsigned char name[7]; /* Device Name */ |
| 283 | struct msi_msg saved_msg; | 305 | struct msi_msg saved_msg; |
| 284 | struct sys_device sysdev; | 306 | struct sys_device sysdev; |
| 307 | struct iommu_flush flush; | ||
| 285 | #endif | 308 | #endif |
| 286 | struct q_inval *qi; /* Queued invalidation info */ | 309 | struct q_inval *qi; /* Queued invalidation info */ |
| 287 | #ifdef CONFIG_INTR_REMAP | 310 | #ifdef CONFIG_INTR_REMAP |
| @@ -303,6 +326,12 @@ extern void free_iommu(struct intel_iommu *iommu); | |||
| 303 | extern int dmar_enable_qi(struct intel_iommu *iommu); | 326 | extern int dmar_enable_qi(struct intel_iommu *iommu); |
| 304 | extern void qi_global_iec(struct intel_iommu *iommu); | 327 | extern void qi_global_iec(struct intel_iommu *iommu); |
| 305 | 328 | ||
| 329 | extern int qi_flush_context(struct intel_iommu *iommu, u16 did, u16 sid, | ||
| 330 | u8 fm, u64 type, int non_present_entry_flush); | ||
| 331 | extern int qi_flush_iotlb(struct intel_iommu *iommu, u16 did, u64 addr, | ||
| 332 | unsigned int size_order, u64 type, | ||
| 333 | int non_present_entry_flush); | ||
| 334 | |||
| 306 | extern void qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu); | 335 | extern void qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu); |
| 307 | 336 | ||
| 308 | void intel_iommu_domain_exit(struct dmar_domain *domain); | 337 | void intel_iommu_domain_exit(struct dmar_domain *domain); |
| @@ -324,4 +353,11 @@ static inline int intel_iommu_found(void) | |||
| 324 | } | 353 | } |
| 325 | #endif /* CONFIG_DMAR */ | 354 | #endif /* CONFIG_DMAR */ |
| 326 | 355 | ||
| 356 | extern void *intel_alloc_coherent(struct device *, size_t, dma_addr_t *, gfp_t); | ||
| 357 | extern void intel_free_coherent(struct device *, size_t, void *, dma_addr_t); | ||
| 358 | extern dma_addr_t intel_map_single(struct device *, phys_addr_t, size_t, int); | ||
| 359 | extern void intel_unmap_single(struct device *, dma_addr_t, size_t, int); | ||
| 360 | extern int intel_map_sg(struct device *, struct scatterlist *, int, int); | ||
| 361 | extern void intel_unmap_sg(struct device *, struct scatterlist *, int, int); | ||
| 362 | |||
| 327 | #endif | 363 | #endif |
diff --git a/include/linux/irqnr.h b/include/linux/irqnr.h index 3171ddc3b39d..452c280c8115 100644 --- a/include/linux/irqnr.h +++ b/include/linux/irqnr.h | |||
| @@ -13,9 +13,9 @@ extern int nr_irqs; | |||
| 13 | # define for_each_irq_desc(irq, desc) \ | 13 | # define for_each_irq_desc(irq, desc) \ |
| 14 | for (irq = 0, desc = irq_desc; irq < nr_irqs; irq++, desc++) | 14 | for (irq = 0, desc = irq_desc; irq < nr_irqs; irq++, desc++) |
| 15 | 15 | ||
| 16 | # define for_each_irq_desc_reverse(irq, desc) \ | 16 | # define for_each_irq_desc_reverse(irq, desc) \ |
| 17 | for (irq = nr_irqs -1, desc = irq_desc + (nr_irqs -1 ); \ | 17 | for (irq = nr_irqs - 1, desc = irq_desc + (nr_irqs - 1); \ |
| 18 | irq > 0; irq--, desc--) | 18 | irq >= 0; irq--, desc--) |
| 19 | #endif | 19 | #endif |
| 20 | 20 | ||
| 21 | #define for_each_irq_nr(irq) \ | 21 | #define for_each_irq_nr(irq) \ |
diff --git a/include/linux/jbd.h b/include/linux/jbd.h index 35d4f6342fac..346e2b80be7d 100644 --- a/include/linux/jbd.h +++ b/include/linux/jbd.h | |||
| @@ -911,7 +911,7 @@ extern int journal_set_features | |||
| 911 | (journal_t *, unsigned long, unsigned long, unsigned long); | 911 | (journal_t *, unsigned long, unsigned long, unsigned long); |
| 912 | extern int journal_create (journal_t *); | 912 | extern int journal_create (journal_t *); |
| 913 | extern int journal_load (journal_t *journal); | 913 | extern int journal_load (journal_t *journal); |
| 914 | extern void journal_destroy (journal_t *); | 914 | extern int journal_destroy (journal_t *); |
| 915 | extern int journal_recover (journal_t *journal); | 915 | extern int journal_recover (journal_t *journal); |
| 916 | extern int journal_wipe (journal_t *, int); | 916 | extern int journal_wipe (journal_t *, int); |
| 917 | extern int journal_skip_recovery (journal_t *); | 917 | extern int journal_skip_recovery (journal_t *); |
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 94d17ff64c5a..396a350b87a6 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
| @@ -191,6 +191,30 @@ extern int kernel_text_address(unsigned long addr); | |||
| 191 | struct pid; | 191 | struct pid; |
| 192 | extern struct pid *session_of_pgrp(struct pid *pgrp); | 192 | extern struct pid *session_of_pgrp(struct pid *pgrp); |
| 193 | 193 | ||
| 194 | /* | ||
| 195 | * FW_BUG | ||
| 196 | * Add this to a message where you are sure the firmware is buggy or behaves | ||
| 197 | * really stupid or out of spec. Be aware that the responsible BIOS developer | ||
| 198 | * should be able to fix this issue or at least get a concrete idea of the | ||
| 199 | * problem by reading your message without the need of looking at the kernel | ||
| 200 | * code. | ||
| 201 | * | ||
| 202 | * Use it for definite and high priority BIOS bugs. | ||
| 203 | * | ||
| 204 | * FW_WARN | ||
| 205 | * Use it for not that clear (e.g. could the kernel messed up things already?) | ||
| 206 | * and medium priority BIOS bugs. | ||
| 207 | * | ||
| 208 | * FW_INFO | ||
| 209 | * Use this one if you want to tell the user or vendor about something | ||
| 210 | * suspicious, but generally harmless related to the firmware. | ||
| 211 | * | ||
| 212 | * Use it for information or very low priority BIOS bugs. | ||
| 213 | */ | ||
| 214 | #define FW_BUG "[Firmware Bug]: " | ||
| 215 | #define FW_WARN "[Firmware Warn]: " | ||
| 216 | #define FW_INFO "[Firmware Info]: " | ||
| 217 | |||
| 194 | #ifdef CONFIG_PRINTK | 218 | #ifdef CONFIG_PRINTK |
| 195 | asmlinkage int vprintk(const char *fmt, va_list args) | 219 | asmlinkage int vprintk(const char *fmt, va_list args) |
| 196 | __attribute__ ((format (printf, 1, 0))); | 220 | __attribute__ ((format (printf, 1, 0))); |
diff --git a/include/linux/leds.h b/include/linux/leds.h index d41ccb56146a..d3a73f5a48c3 100644 --- a/include/linux/leds.h +++ b/include/linux/leds.h | |||
| @@ -123,7 +123,7 @@ extern void ledtrig_ide_activity(void); | |||
| 123 | */ | 123 | */ |
| 124 | struct led_info { | 124 | struct led_info { |
| 125 | const char *name; | 125 | const char *name; |
| 126 | char *default_trigger; | 126 | const char *default_trigger; |
| 127 | int flags; | 127 | int flags; |
| 128 | }; | 128 | }; |
| 129 | 129 | ||
| @@ -135,7 +135,7 @@ struct led_platform_data { | |||
| 135 | /* For the leds-gpio driver */ | 135 | /* For the leds-gpio driver */ |
| 136 | struct gpio_led { | 136 | struct gpio_led { |
| 137 | const char *name; | 137 | const char *name; |
| 138 | char *default_trigger; | 138 | const char *default_trigger; |
| 139 | unsigned gpio; | 139 | unsigned gpio; |
| 140 | u8 active_low; | 140 | u8 active_low; |
| 141 | }; | 141 | }; |
diff --git a/include/linux/libata.h b/include/linux/libata.h index 947cf84e555d..507f53ef8038 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
| @@ -340,6 +340,9 @@ enum { | |||
| 340 | 340 | ||
| 341 | ATA_EHI_DID_RESET = ATA_EHI_DID_SOFTRESET | ATA_EHI_DID_HARDRESET, | 341 | ATA_EHI_DID_RESET = ATA_EHI_DID_SOFTRESET | ATA_EHI_DID_HARDRESET, |
| 342 | 342 | ||
| 343 | /* mask of flags to transfer *to* the slave link */ | ||
| 344 | ATA_EHI_TO_SLAVE_MASK = ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET, | ||
| 345 | |||
| 343 | /* max tries if error condition is still set after ->error_handler */ | 346 | /* max tries if error condition is still set after ->error_handler */ |
| 344 | ATA_EH_MAX_TRIES = 5, | 347 | ATA_EH_MAX_TRIES = 5, |
| 345 | 348 | ||
| @@ -692,7 +695,6 @@ struct ata_port { | |||
| 692 | unsigned int cbl; /* cable type; ATA_CBL_xxx */ | 695 | unsigned int cbl; /* cable type; ATA_CBL_xxx */ |
| 693 | 696 | ||
| 694 | struct ata_queued_cmd qcmd[ATA_MAX_QUEUE]; | 697 | struct ata_queued_cmd qcmd[ATA_MAX_QUEUE]; |
| 695 | unsigned long qc_allocated; | ||
| 696 | unsigned int qc_active; | 698 | unsigned int qc_active; |
| 697 | int nr_active_links; /* #links with active qcs */ | 699 | int nr_active_links; /* #links with active qcs */ |
| 698 | 700 | ||
diff --git a/include/linux/mlx4/cmd.h b/include/linux/mlx4/cmd.h index 77323a72dd3c..cf9c679ab38b 100644 --- a/include/linux/mlx4/cmd.h +++ b/include/linux/mlx4/cmd.h | |||
| @@ -132,6 +132,15 @@ enum { | |||
| 132 | MLX4_MAILBOX_SIZE = 4096 | 132 | MLX4_MAILBOX_SIZE = 4096 |
| 133 | }; | 133 | }; |
| 134 | 134 | ||
| 135 | enum { | ||
| 136 | /* set port opcode modifiers */ | ||
| 137 | MLX4_SET_PORT_GENERAL = 0x0, | ||
| 138 | MLX4_SET_PORT_RQP_CALC = 0x1, | ||
| 139 | MLX4_SET_PORT_MAC_TABLE = 0x2, | ||
| 140 | MLX4_SET_PORT_VLAN_TABLE = 0x3, | ||
| 141 | MLX4_SET_PORT_PRIO_MAP = 0x4, | ||
| 142 | }; | ||
| 143 | |||
| 135 | struct mlx4_dev; | 144 | struct mlx4_dev; |
| 136 | 145 | ||
| 137 | struct mlx4_cmd_mailbox { | 146 | struct mlx4_cmd_mailbox { |
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h index b2f944468313..bd9977b89490 100644 --- a/include/linux/mlx4/device.h +++ b/include/linux/mlx4/device.h | |||
| @@ -60,6 +60,7 @@ enum { | |||
| 60 | MLX4_DEV_CAP_FLAG_IPOIB_CSUM = 1 << 7, | 60 | MLX4_DEV_CAP_FLAG_IPOIB_CSUM = 1 << 7, |
| 61 | MLX4_DEV_CAP_FLAG_BAD_PKEY_CNTR = 1 << 8, | 61 | MLX4_DEV_CAP_FLAG_BAD_PKEY_CNTR = 1 << 8, |
| 62 | MLX4_DEV_CAP_FLAG_BAD_QKEY_CNTR = 1 << 9, | 62 | MLX4_DEV_CAP_FLAG_BAD_QKEY_CNTR = 1 << 9, |
| 63 | MLX4_DEV_CAP_FLAG_DPDP = 1 << 12, | ||
| 63 | MLX4_DEV_CAP_FLAG_MEM_WINDOW = 1 << 16, | 64 | MLX4_DEV_CAP_FLAG_MEM_WINDOW = 1 << 16, |
| 64 | MLX4_DEV_CAP_FLAG_APM = 1 << 17, | 65 | MLX4_DEV_CAP_FLAG_APM = 1 << 17, |
| 65 | MLX4_DEV_CAP_FLAG_ATOMIC = 1 << 18, | 66 | MLX4_DEV_CAP_FLAG_ATOMIC = 1 << 18, |
| @@ -145,6 +146,29 @@ enum { | |||
| 145 | MLX4_MTT_FLAG_PRESENT = 1 | 146 | MLX4_MTT_FLAG_PRESENT = 1 |
| 146 | }; | 147 | }; |
| 147 | 148 | ||
| 149 | enum mlx4_qp_region { | ||
| 150 | MLX4_QP_REGION_FW = 0, | ||
| 151 | MLX4_QP_REGION_ETH_ADDR, | ||
| 152 | MLX4_QP_REGION_FC_ADDR, | ||
| 153 | MLX4_QP_REGION_FC_EXCH, | ||
| 154 | MLX4_NUM_QP_REGION | ||
| 155 | }; | ||
| 156 | |||
| 157 | enum mlx4_port_type { | ||
| 158 | MLX4_PORT_TYPE_IB = 1 << 0, | ||
| 159 | MLX4_PORT_TYPE_ETH = 1 << 1, | ||
| 160 | }; | ||
| 161 | |||
| 162 | enum mlx4_special_vlan_idx { | ||
| 163 | MLX4_NO_VLAN_IDX = 0, | ||
| 164 | MLX4_VLAN_MISS_IDX, | ||
| 165 | MLX4_VLAN_REGULAR | ||
| 166 | }; | ||
| 167 | |||
| 168 | enum { | ||
| 169 | MLX4_NUM_FEXCH = 64 * 1024, | ||
| 170 | }; | ||
| 171 | |||
| 148 | static inline u64 mlx4_fw_ver(u64 major, u64 minor, u64 subminor) | 172 | static inline u64 mlx4_fw_ver(u64 major, u64 minor, u64 subminor) |
| 149 | { | 173 | { |
| 150 | return (major << 32) | (minor << 16) | subminor; | 174 | return (major << 32) | (minor << 16) | subminor; |
| @@ -154,7 +178,9 @@ struct mlx4_caps { | |||
| 154 | u64 fw_ver; | 178 | u64 fw_ver; |
| 155 | int num_ports; | 179 | int num_ports; |
| 156 | int vl_cap[MLX4_MAX_PORTS + 1]; | 180 | int vl_cap[MLX4_MAX_PORTS + 1]; |
| 157 | int mtu_cap[MLX4_MAX_PORTS + 1]; | 181 | int ib_mtu_cap[MLX4_MAX_PORTS + 1]; |
| 182 | u64 def_mac[MLX4_MAX_PORTS + 1]; | ||
| 183 | int eth_mtu_cap[MLX4_MAX_PORTS + 1]; | ||
| 158 | int gid_table_len[MLX4_MAX_PORTS + 1]; | 184 | int gid_table_len[MLX4_MAX_PORTS + 1]; |
| 159 | int pkey_table_len[MLX4_MAX_PORTS + 1]; | 185 | int pkey_table_len[MLX4_MAX_PORTS + 1]; |
| 160 | int local_ca_ack_delay; | 186 | int local_ca_ack_delay; |
| @@ -169,7 +195,6 @@ struct mlx4_caps { | |||
| 169 | int max_rq_desc_sz; | 195 | int max_rq_desc_sz; |
| 170 | int max_qp_init_rdma; | 196 | int max_qp_init_rdma; |
| 171 | int max_qp_dest_rdma; | 197 | int max_qp_dest_rdma; |
| 172 | int reserved_qps; | ||
| 173 | int sqp_start; | 198 | int sqp_start; |
| 174 | int num_srqs; | 199 | int num_srqs; |
| 175 | int max_srq_wqes; | 200 | int max_srq_wqes; |
| @@ -201,6 +226,15 @@ struct mlx4_caps { | |||
| 201 | u16 stat_rate_support; | 226 | u16 stat_rate_support; |
| 202 | u8 port_width_cap[MLX4_MAX_PORTS + 1]; | 227 | u8 port_width_cap[MLX4_MAX_PORTS + 1]; |
| 203 | int max_gso_sz; | 228 | int max_gso_sz; |
| 229 | int reserved_qps_cnt[MLX4_NUM_QP_REGION]; | ||
| 230 | int reserved_qps; | ||
| 231 | int reserved_qps_base[MLX4_NUM_QP_REGION]; | ||
| 232 | int log_num_macs; | ||
| 233 | int log_num_vlans; | ||
| 234 | int log_num_prios; | ||
| 235 | enum mlx4_port_type port_type[MLX4_MAX_PORTS + 1]; | ||
| 236 | u8 supported_type[MLX4_MAX_PORTS + 1]; | ||
| 237 | u32 port_mask; | ||
| 204 | }; | 238 | }; |
| 205 | 239 | ||
| 206 | struct mlx4_buf_list { | 240 | struct mlx4_buf_list { |
| @@ -355,6 +389,11 @@ struct mlx4_init_port_param { | |||
| 355 | u64 si_guid; | 389 | u64 si_guid; |
| 356 | }; | 390 | }; |
| 357 | 391 | ||
| 392 | #define mlx4_foreach_port(port, dev, type) \ | ||
| 393 | for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++) \ | ||
| 394 | if (((type) == MLX4_PORT_TYPE_IB ? (dev)->caps.port_mask : \ | ||
| 395 | ~(dev)->caps.port_mask) & 1 << ((port) - 1)) | ||
| 396 | |||
| 358 | int mlx4_buf_alloc(struct mlx4_dev *dev, int size, int max_direct, | 397 | int mlx4_buf_alloc(struct mlx4_dev *dev, int size, int max_direct, |
| 359 | struct mlx4_buf *buf); | 398 | struct mlx4_buf *buf); |
| 360 | void mlx4_buf_free(struct mlx4_dev *dev, int size, struct mlx4_buf *buf); | 399 | void mlx4_buf_free(struct mlx4_dev *dev, int size, struct mlx4_buf *buf); |
| @@ -400,7 +439,10 @@ int mlx4_cq_alloc(struct mlx4_dev *dev, int nent, struct mlx4_mtt *mtt, | |||
| 400 | int collapsed); | 439 | int collapsed); |
| 401 | void mlx4_cq_free(struct mlx4_dev *dev, struct mlx4_cq *cq); | 440 | void mlx4_cq_free(struct mlx4_dev *dev, struct mlx4_cq *cq); |
| 402 | 441 | ||
| 403 | int mlx4_qp_alloc(struct mlx4_dev *dev, int sqpn, struct mlx4_qp *qp); | 442 | int mlx4_qp_reserve_range(struct mlx4_dev *dev, int cnt, int align, int *base); |
| 443 | void mlx4_qp_release_range(struct mlx4_dev *dev, int base_qpn, int cnt); | ||
| 444 | |||
| 445 | int mlx4_qp_alloc(struct mlx4_dev *dev, int qpn, struct mlx4_qp *qp); | ||
| 404 | void mlx4_qp_free(struct mlx4_dev *dev, struct mlx4_qp *qp); | 446 | void mlx4_qp_free(struct mlx4_dev *dev, struct mlx4_qp *qp); |
| 405 | 447 | ||
| 406 | int mlx4_srq_alloc(struct mlx4_dev *dev, u32 pdn, struct mlx4_mtt *mtt, | 448 | int mlx4_srq_alloc(struct mlx4_dev *dev, u32 pdn, struct mlx4_mtt *mtt, |
| @@ -416,6 +458,12 @@ int mlx4_multicast_attach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16], | |||
| 416 | int block_mcast_loopback); | 458 | int block_mcast_loopback); |
| 417 | int mlx4_multicast_detach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16]); | 459 | int mlx4_multicast_detach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16]); |
| 418 | 460 | ||
| 461 | int mlx4_register_mac(struct mlx4_dev *dev, u8 port, u64 mac, int *index); | ||
| 462 | void mlx4_unregister_mac(struct mlx4_dev *dev, u8 port, int index); | ||
| 463 | |||
| 464 | int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index); | ||
| 465 | void mlx4_unregister_vlan(struct mlx4_dev *dev, u8 port, int index); | ||
| 466 | |||
| 419 | int mlx4_map_phys_fmr(struct mlx4_dev *dev, struct mlx4_fmr *fmr, u64 *page_list, | 467 | int mlx4_map_phys_fmr(struct mlx4_dev *dev, struct mlx4_fmr *fmr, u64 *page_list, |
| 420 | int npages, u64 iova, u32 *lkey, u32 *rkey); | 468 | int npages, u64 iova, u32 *lkey, u32 *rkey); |
| 421 | int mlx4_fmr_alloc(struct mlx4_dev *dev, u32 pd, u32 access, int max_pages, | 469 | int mlx4_fmr_alloc(struct mlx4_dev *dev, u32 pd, u32 access, int max_pages, |
diff --git a/include/linux/module.h b/include/linux/module.h index 5d2970cdce93..3bfed013350b 100644 --- a/include/linux/module.h +++ b/include/linux/module.h | |||
| @@ -29,7 +29,7 @@ | |||
| 29 | #define MODULE_SYMBOL_PREFIX "" | 29 | #define MODULE_SYMBOL_PREFIX "" |
| 30 | #endif | 30 | #endif |
| 31 | 31 | ||
| 32 | #define MODULE_NAME_LEN (64 - sizeof(unsigned long)) | 32 | #define MODULE_NAME_LEN MAX_PARAM_PREFIX_LEN |
| 33 | 33 | ||
| 34 | struct kernel_symbol | 34 | struct kernel_symbol |
| 35 | { | 35 | { |
| @@ -60,6 +60,7 @@ struct module_kobject | |||
| 60 | struct kobject kobj; | 60 | struct kobject kobj; |
| 61 | struct module *mod; | 61 | struct module *mod; |
| 62 | struct kobject *drivers_dir; | 62 | struct kobject *drivers_dir; |
| 63 | struct module_param_attrs *mp; | ||
| 63 | }; | 64 | }; |
| 64 | 65 | ||
| 65 | /* These are either module local, or the kernel's dummy ones. */ | 66 | /* These are either module local, or the kernel's dummy ones. */ |
| @@ -242,7 +243,6 @@ struct module | |||
| 242 | 243 | ||
| 243 | /* Sysfs stuff. */ | 244 | /* Sysfs stuff. */ |
| 244 | struct module_kobject mkobj; | 245 | struct module_kobject mkobj; |
| 245 | struct module_param_attrs *param_attrs; | ||
| 246 | struct module_attribute *modinfo_attrs; | 246 | struct module_attribute *modinfo_attrs; |
| 247 | const char *version; | 247 | const char *version; |
| 248 | const char *srcversion; | 248 | const char *srcversion; |
| @@ -277,7 +277,7 @@ struct module | |||
| 277 | 277 | ||
| 278 | /* Exception table */ | 278 | /* Exception table */ |
| 279 | unsigned int num_exentries; | 279 | unsigned int num_exentries; |
| 280 | const struct exception_table_entry *extable; | 280 | struct exception_table_entry *extable; |
| 281 | 281 | ||
| 282 | /* Startup function. */ | 282 | /* Startup function. */ |
| 283 | int (*init)(void); | 283 | int (*init)(void); |
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h index ec624381c844..e4af3399ef48 100644 --- a/include/linux/moduleparam.h +++ b/include/linux/moduleparam.h | |||
| @@ -13,6 +13,9 @@ | |||
| 13 | #define MODULE_PARAM_PREFIX KBUILD_MODNAME "." | 13 | #define MODULE_PARAM_PREFIX KBUILD_MODNAME "." |
| 14 | #endif | 14 | #endif |
| 15 | 15 | ||
| 16 | /* Chosen so that structs with an unsigned long line up. */ | ||
| 17 | #define MAX_PARAM_PREFIX_LEN (64 - sizeof(unsigned long)) | ||
| 18 | |||
| 16 | #ifdef MODULE | 19 | #ifdef MODULE |
| 17 | #define ___module_cat(a,b) __mod_ ## a ## b | 20 | #define ___module_cat(a,b) __mod_ ## a ## b |
| 18 | #define __module_cat(a,b) ___module_cat(a,b) | 21 | #define __module_cat(a,b) ___module_cat(a,b) |
| @@ -79,7 +82,8 @@ struct kparam_array | |||
| 79 | #define __module_param_call(prefix, name, set, get, arg, perm) \ | 82 | #define __module_param_call(prefix, name, set, get, arg, perm) \ |
| 80 | /* Default value instead of permissions? */ \ | 83 | /* Default value instead of permissions? */ \ |
| 81 | static int __param_perm_check_##name __attribute__((unused)) = \ | 84 | static int __param_perm_check_##name __attribute__((unused)) = \ |
| 82 | BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)); \ | 85 | BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)) \ |
| 86 | + BUILD_BUG_ON_ZERO(sizeof(""prefix) > MAX_PARAM_PREFIX_LEN); \ | ||
| 83 | static const char __param_str_##name[] = prefix #name; \ | 87 | static const char __param_str_##name[] = prefix #name; \ |
| 84 | static struct kernel_param __moduleparam_const __param_##name \ | 88 | static struct kernel_param __moduleparam_const __param_##name \ |
| 85 | __used \ | 89 | __used \ |
| @@ -100,6 +104,25 @@ struct kparam_array | |||
| 100 | #define module_param(name, type, perm) \ | 104 | #define module_param(name, type, perm) \ |
| 101 | module_param_named(name, name, type, perm) | 105 | module_param_named(name, name, type, perm) |
| 102 | 106 | ||
| 107 | #ifndef MODULE | ||
| 108 | /** | ||
| 109 | * core_param - define a historical core kernel parameter. | ||
| 110 | * @name: the name of the cmdline and sysfs parameter (often the same as var) | ||
| 111 | * @var: the variable | ||
| 112 | * @type: the type (for param_set_##type and param_get_##type) | ||
| 113 | * @perm: visibility in sysfs | ||
| 114 | * | ||
| 115 | * core_param is just like module_param(), but cannot be modular and | ||
| 116 | * doesn't add a prefix (such as "printk."). This is for compatibility | ||
| 117 | * with __setup(), and it makes sense as truly core parameters aren't | ||
| 118 | * tied to the particular file they're in. | ||
| 119 | */ | ||
| 120 | #define core_param(name, var, type, perm) \ | ||
| 121 | param_check_##type(name, &(var)); \ | ||
| 122 | __module_param_call("", name, param_set_##type, param_get_##type, \ | ||
| 123 | &var, perm) | ||
| 124 | #endif /* !MODULE */ | ||
| 125 | |||
| 103 | /* Actually copy string: maxlen param is usually sizeof(string). */ | 126 | /* Actually copy string: maxlen param is usually sizeof(string). */ |
| 104 | #define module_param_string(name, string, len, perm) \ | 127 | #define module_param_string(name, string, len, perm) \ |
| 105 | static const struct kparam_string __param_string_##name \ | 128 | static const struct kparam_string __param_string_##name \ |
diff --git a/include/linux/namei.h b/include/linux/namei.h index 68f8c3203c89..99eb80306dc5 100644 --- a/include/linux/namei.h +++ b/include/linux/namei.h | |||
| @@ -51,8 +51,10 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND}; | |||
| 51 | /* | 51 | /* |
| 52 | * Intent data | 52 | * Intent data |
| 53 | */ | 53 | */ |
| 54 | #define LOOKUP_OPEN (0x0100) | 54 | #define LOOKUP_OPEN 0x0100 |
| 55 | #define LOOKUP_CREATE (0x0200) | 55 | #define LOOKUP_CREATE 0x0200 |
| 56 | #define LOOKUP_EXCL 0x0400 | ||
| 57 | #define LOOKUP_RENAME_TARGET 0x0800 | ||
| 56 | 58 | ||
| 57 | extern int user_path_at(int, const char __user *, unsigned, struct path *); | 59 | extern int user_path_at(int, const char __user *, unsigned, struct path *); |
| 58 | 60 | ||
| @@ -61,6 +63,8 @@ extern int user_path_at(int, const char __user *, unsigned, struct path *); | |||
| 61 | #define user_path_dir(name, path) \ | 63 | #define user_path_dir(name, path) \ |
| 62 | user_path_at(AT_FDCWD, name, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, path) | 64 | user_path_at(AT_FDCWD, name, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, path) |
| 63 | 65 | ||
| 66 | extern int kern_path(const char *, unsigned, struct path *); | ||
| 67 | |||
| 64 | extern int path_lookup(const char *, unsigned, struct nameidata *); | 68 | extern int path_lookup(const char *, unsigned, struct nameidata *); |
| 65 | extern int vfs_path_lookup(struct dentry *, struct vfsmount *, | 69 | extern int vfs_path_lookup(struct dentry *, struct vfsmount *, |
| 66 | const char *, unsigned int, struct nameidata *); | 70 | const char *, unsigned int, struct nameidata *); |
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 64875859d654..c8bcb59adfdf 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
| @@ -541,6 +541,14 @@ struct net_device | |||
| 541 | #define NETIF_F_V6_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IPV6_CSUM) | 541 | #define NETIF_F_V6_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IPV6_CSUM) |
| 542 | #define NETIF_F_ALL_CSUM (NETIF_F_V4_CSUM | NETIF_F_V6_CSUM) | 542 | #define NETIF_F_ALL_CSUM (NETIF_F_V4_CSUM | NETIF_F_V6_CSUM) |
| 543 | 543 | ||
| 544 | /* | ||
| 545 | * If one device supports one of these features, then enable them | ||
| 546 | * for all in netdev_increment_features. | ||
| 547 | */ | ||
| 548 | #define NETIF_F_ONE_FOR_ALL (NETIF_F_GSO_SOFTWARE | NETIF_F_GSO_ROBUST | \ | ||
| 549 | NETIF_F_SG | NETIF_F_HIGHDMA | \ | ||
| 550 | NETIF_F_FRAGLIST) | ||
| 551 | |||
| 544 | /* Interface index. Unique device identifier */ | 552 | /* Interface index. Unique device identifier */ |
| 545 | int ifindex; | 553 | int ifindex; |
| 546 | int iflink; | 554 | int iflink; |
| @@ -1698,7 +1706,9 @@ extern char *netdev_drivername(const struct net_device *dev, char *buffer, int l | |||
| 1698 | 1706 | ||
| 1699 | extern void linkwatch_run_queue(void); | 1707 | extern void linkwatch_run_queue(void); |
| 1700 | 1708 | ||
| 1701 | extern int netdev_compute_features(unsigned long all, unsigned long one); | 1709 | unsigned long netdev_increment_features(unsigned long all, unsigned long one, |
| 1710 | unsigned long mask); | ||
| 1711 | unsigned long netdev_fix_features(unsigned long features, const char *name); | ||
| 1702 | 1712 | ||
| 1703 | static inline int net_gso_ok(int features, int gso_type) | 1713 | static inline int net_gso_ok(int features, int gso_type) |
| 1704 | { | 1714 | { |
diff --git a/include/linux/oprofile.h b/include/linux/oprofile.h index bcb8f725427c..5231861f357d 100644 --- a/include/linux/oprofile.h +++ b/include/linux/oprofile.h | |||
| @@ -86,13 +86,6 @@ int oprofile_arch_init(struct oprofile_operations * ops); | |||
| 86 | void oprofile_arch_exit(void); | 86 | void oprofile_arch_exit(void); |
| 87 | 87 | ||
| 88 | /** | 88 | /** |
| 89 | * Add data to the event buffer. | ||
| 90 | * The data passed is free-form, but typically consists of | ||
| 91 | * file offsets, dcookies, context information, and ESCAPE codes. | ||
| 92 | */ | ||
| 93 | void add_event_entry(unsigned long data); | ||
| 94 | |||
| 95 | /** | ||
| 96 | * Add a sample. This may be called from any context. Pass | 89 | * Add a sample. This may be called from any context. Pass |
| 97 | * smp_processor_id() as cpu. | 90 | * smp_processor_id() as cpu. |
| 98 | */ | 91 | */ |
| @@ -162,5 +155,14 @@ int oprofilefs_ulong_from_user(unsigned long * val, char const __user * buf, siz | |||
| 162 | 155 | ||
| 163 | /** lock for read/write safety */ | 156 | /** lock for read/write safety */ |
| 164 | extern spinlock_t oprofilefs_lock; | 157 | extern spinlock_t oprofilefs_lock; |
| 158 | |||
| 159 | /** | ||
| 160 | * Add the contents of a circular buffer to the event buffer. | ||
| 161 | */ | ||
| 162 | void oprofile_put_buff(unsigned long *buf, unsigned int start, | ||
| 163 | unsigned int stop, unsigned int max); | ||
| 164 | |||
| 165 | unsigned long oprofile_get_cpu_buffer_size(void); | ||
| 166 | void oprofile_cpu_buffer_inc_smpl_lost(void); | ||
| 165 | 167 | ||
| 166 | #endif /* OPROFILE_H */ | 168 | #endif /* OPROFILE_H */ |
diff --git a/include/linux/page_cgroup.h b/include/linux/page_cgroup.h index 0fd39f2231ec..f546ad6fc028 100644 --- a/include/linux/page_cgroup.h +++ b/include/linux/page_cgroup.h | |||
| @@ -99,5 +99,10 @@ static inline struct page_cgroup *lookup_page_cgroup(struct page *page) | |||
| 99 | { | 99 | { |
| 100 | return NULL; | 100 | return NULL; |
| 101 | } | 101 | } |
| 102 | |||
| 103 | static inline void page_cgroup_init(void) | ||
| 104 | { | ||
| 105 | } | ||
| 106 | |||
| 102 | #endif | 107 | #endif |
| 103 | #endif | 108 | #endif |
diff --git a/include/linux/pci.h b/include/linux/pci.h index 085187be29c7..c75b82bda327 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
| @@ -51,6 +51,7 @@ | |||
| 51 | #include <linux/kobject.h> | 51 | #include <linux/kobject.h> |
| 52 | #include <asm/atomic.h> | 52 | #include <asm/atomic.h> |
| 53 | #include <linux/device.h> | 53 | #include <linux/device.h> |
| 54 | #include <linux/io.h> | ||
| 54 | 55 | ||
| 55 | /* Include the ID list */ | 56 | /* Include the ID list */ |
| 56 | #include <linux/pci_ids.h> | 57 | #include <linux/pci_ids.h> |
| @@ -64,6 +65,11 @@ struct pci_slot { | |||
| 64 | struct kobject kobj; | 65 | struct kobject kobj; |
| 65 | }; | 66 | }; |
| 66 | 67 | ||
| 68 | static inline const char *pci_slot_name(const struct pci_slot *slot) | ||
| 69 | { | ||
| 70 | return kobject_name(&slot->kobj); | ||
| 71 | } | ||
| 72 | |||
| 67 | /* File state for mmap()s on /proc/bus/pci/X/Y */ | 73 | /* File state for mmap()s on /proc/bus/pci/X/Y */ |
| 68 | enum pci_mmap_state { | 74 | enum pci_mmap_state { |
| 69 | pci_mmap_io, | 75 | pci_mmap_io, |
| @@ -509,9 +515,10 @@ struct pci_bus *pci_create_bus(struct device *parent, int bus, | |||
| 509 | struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, | 515 | struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, |
| 510 | int busnr); | 516 | int busnr); |
| 511 | struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr, | 517 | struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr, |
| 512 | const char *name); | 518 | const char *name, |
| 519 | struct hotplug_slot *hotplug); | ||
| 513 | void pci_destroy_slot(struct pci_slot *slot); | 520 | void pci_destroy_slot(struct pci_slot *slot); |
| 514 | void pci_update_slot_number(struct pci_slot *slot, int slot_nr); | 521 | void pci_renumber_slot(struct pci_slot *slot, int slot_nr); |
| 515 | int pci_scan_slot(struct pci_bus *bus, int devfn); | 522 | int pci_scan_slot(struct pci_bus *bus, int devfn); |
| 516 | struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn); | 523 | struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn); |
| 517 | void pci_device_add(struct pci_dev *dev, struct pci_bus *bus); | 524 | void pci_device_add(struct pci_dev *dev, struct pci_bus *bus); |
| @@ -539,6 +546,13 @@ struct pci_dev __deprecated *pci_find_slot(unsigned int bus, | |||
| 539 | unsigned int devfn); | 546 | unsigned int devfn); |
| 540 | #endif /* CONFIG_PCI_LEGACY */ | 547 | #endif /* CONFIG_PCI_LEGACY */ |
| 541 | 548 | ||
| 549 | enum pci_lost_interrupt_reason { | ||
| 550 | PCI_LOST_IRQ_NO_INFORMATION = 0, | ||
| 551 | PCI_LOST_IRQ_DISABLE_MSI, | ||
| 552 | PCI_LOST_IRQ_DISABLE_MSIX, | ||
| 553 | PCI_LOST_IRQ_DISABLE_ACPI, | ||
| 554 | }; | ||
| 555 | enum pci_lost_interrupt_reason pci_lost_interrupt(struct pci_dev *dev); | ||
| 542 | int pci_find_capability(struct pci_dev *dev, int cap); | 556 | int pci_find_capability(struct pci_dev *dev, int cap); |
| 543 | int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap); | 557 | int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap); |
| 544 | int pci_find_ext_capability(struct pci_dev *dev, int cap); | 558 | int pci_find_ext_capability(struct pci_dev *dev, int cap); |
| @@ -626,6 +640,8 @@ int pcix_get_mmrbc(struct pci_dev *dev); | |||
| 626 | int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc); | 640 | int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc); |
| 627 | int pcie_get_readrq(struct pci_dev *dev); | 641 | int pcie_get_readrq(struct pci_dev *dev); |
| 628 | int pcie_set_readrq(struct pci_dev *dev, int rq); | 642 | int pcie_set_readrq(struct pci_dev *dev, int rq); |
| 643 | int pci_reset_function(struct pci_dev *dev); | ||
| 644 | int pci_execute_reset_function(struct pci_dev *dev); | ||
| 629 | void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno); | 645 | void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno); |
| 630 | int __must_check pci_assign_resource(struct pci_dev *dev, int i); | 646 | int __must_check pci_assign_resource(struct pci_dev *dev, int i); |
| 631 | int pci_select_bars(struct pci_dev *dev, unsigned long flags); | 647 | int pci_select_bars(struct pci_dev *dev, unsigned long flags); |
diff --git a/include/linux/pci_hotplug.h b/include/linux/pci_hotplug.h index a08cd06b541a..a00bd1a0f156 100644 --- a/include/linux/pci_hotplug.h +++ b/include/linux/pci_hotplug.h | |||
| @@ -142,8 +142,6 @@ struct hotplug_slot_info { | |||
| 142 | 142 | ||
| 143 | /** | 143 | /** |
| 144 | * struct hotplug_slot - used to register a physical slot with the hotplug pci core | 144 | * struct hotplug_slot - used to register a physical slot with the hotplug pci core |
| 145 | * @name: the name of the slot being registered. This string must | ||
| 146 | * be unique amoung slots registered on this system. | ||
| 147 | * @ops: pointer to the &struct hotplug_slot_ops to be used for this slot | 145 | * @ops: pointer to the &struct hotplug_slot_ops to be used for this slot |
| 148 | * @info: pointer to the &struct hotplug_slot_info for the initial values for | 146 | * @info: pointer to the &struct hotplug_slot_info for the initial values for |
| 149 | * this slot. | 147 | * this slot. |
| @@ -153,7 +151,6 @@ struct hotplug_slot_info { | |||
| 153 | * needs. | 151 | * needs. |
| 154 | */ | 152 | */ |
| 155 | struct hotplug_slot { | 153 | struct hotplug_slot { |
| 156 | char *name; | ||
| 157 | struct hotplug_slot_ops *ops; | 154 | struct hotplug_slot_ops *ops; |
| 158 | struct hotplug_slot_info *info; | 155 | struct hotplug_slot_info *info; |
| 159 | void (*release) (struct hotplug_slot *slot); | 156 | void (*release) (struct hotplug_slot *slot); |
| @@ -165,7 +162,13 @@ struct hotplug_slot { | |||
| 165 | }; | 162 | }; |
| 166 | #define to_hotplug_slot(n) container_of(n, struct hotplug_slot, kobj) | 163 | #define to_hotplug_slot(n) container_of(n, struct hotplug_slot, kobj) |
| 167 | 164 | ||
| 168 | extern int pci_hp_register(struct hotplug_slot *, struct pci_bus *, int nr); | 165 | static inline const char *hotplug_slot_name(const struct hotplug_slot *slot) |
| 166 | { | ||
| 167 | return pci_slot_name(slot->pci_slot); | ||
| 168 | } | ||
| 169 | |||
| 170 | extern int pci_hp_register(struct hotplug_slot *, struct pci_bus *, int nr, | ||
| 171 | const char *name); | ||
| 169 | extern int pci_hp_deregister(struct hotplug_slot *slot); | 172 | extern int pci_hp_deregister(struct hotplug_slot *slot); |
| 170 | extern int __must_check pci_hp_change_slot_info (struct hotplug_slot *slot, | 173 | extern int __must_check pci_hp_change_slot_info (struct hotplug_slot *slot, |
| 171 | struct hotplug_slot_info *info); | 174 | struct hotplug_slot_info *info); |
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index e5d344bfcb7e..1800f1d6e40d 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
| @@ -1944,6 +1944,14 @@ | |||
| 1944 | 1944 | ||
| 1945 | #define PCI_VENDOR_ID_OXSEMI 0x1415 | 1945 | #define PCI_VENDOR_ID_OXSEMI 0x1415 |
| 1946 | #define PCI_DEVICE_ID_OXSEMI_12PCI840 0x8403 | 1946 | #define PCI_DEVICE_ID_OXSEMI_12PCI840 0x8403 |
| 1947 | #define PCI_DEVICE_ID_OXSEMI_PCIe840 0xC000 | ||
| 1948 | #define PCI_DEVICE_ID_OXSEMI_PCIe840_G 0xC004 | ||
| 1949 | #define PCI_DEVICE_ID_OXSEMI_PCIe952_0 0xC100 | ||
| 1950 | #define PCI_DEVICE_ID_OXSEMI_PCIe952_0_G 0xC104 | ||
| 1951 | #define PCI_DEVICE_ID_OXSEMI_PCIe952_1 0xC110 | ||
| 1952 | #define PCI_DEVICE_ID_OXSEMI_PCIe952_1_G 0xC114 | ||
| 1953 | #define PCI_DEVICE_ID_OXSEMI_PCIe952_1_U 0xC118 | ||
| 1954 | #define PCI_DEVICE_ID_OXSEMI_PCIe952_1_GU 0xC11C | ||
| 1947 | #define PCI_DEVICE_ID_OXSEMI_16PCI954 0x9501 | 1955 | #define PCI_DEVICE_ID_OXSEMI_16PCI954 0x9501 |
| 1948 | #define PCI_DEVICE_ID_OXSEMI_16PCI95N 0x9511 | 1956 | #define PCI_DEVICE_ID_OXSEMI_16PCI95N 0x9511 |
| 1949 | #define PCI_DEVICE_ID_OXSEMI_16PCI954PP 0x9513 | 1957 | #define PCI_DEVICE_ID_OXSEMI_16PCI954PP 0x9513 |
| @@ -2448,6 +2456,7 @@ | |||
| 2448 | #define PCI_DEVICE_ID_INTEL_MCH_PC1 0x359a | 2456 | #define PCI_DEVICE_ID_INTEL_MCH_PC1 0x359a |
| 2449 | #define PCI_DEVICE_ID_INTEL_E7525_MCH 0x359e | 2457 | #define PCI_DEVICE_ID_INTEL_E7525_MCH 0x359e |
| 2450 | #define PCI_DEVICE_ID_INTEL_IOAT_CNB 0x360b | 2458 | #define PCI_DEVICE_ID_INTEL_IOAT_CNB 0x360b |
| 2459 | #define PCI_DEVICE_ID_INTEL_FBD_CNB 0x360c | ||
| 2451 | #define PCI_DEVICE_ID_INTEL_ICH10_0 0x3a14 | 2460 | #define PCI_DEVICE_ID_INTEL_ICH10_0 0x3a14 |
| 2452 | #define PCI_DEVICE_ID_INTEL_ICH10_1 0x3a16 | 2461 | #define PCI_DEVICE_ID_INTEL_ICH10_1 0x3a16 |
| 2453 | #define PCI_DEVICE_ID_INTEL_ICH10_2 0x3a18 | 2462 | #define PCI_DEVICE_ID_INTEL_ICH10_2 0x3a18 |
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h index eb6686b88f9a..e5effd47ed74 100644 --- a/include/linux/pci_regs.h +++ b/include/linux/pci_regs.h | |||
| @@ -377,6 +377,7 @@ | |||
| 377 | #define PCI_EXP_DEVCAP_RBER 0x8000 /* Role-Based Error Reporting */ | 377 | #define PCI_EXP_DEVCAP_RBER 0x8000 /* Role-Based Error Reporting */ |
| 378 | #define PCI_EXP_DEVCAP_PWR_VAL 0x3fc0000 /* Slot Power Limit Value */ | 378 | #define PCI_EXP_DEVCAP_PWR_VAL 0x3fc0000 /* Slot Power Limit Value */ |
| 379 | #define PCI_EXP_DEVCAP_PWR_SCL 0xc000000 /* Slot Power Limit Scale */ | 379 | #define PCI_EXP_DEVCAP_PWR_SCL 0xc000000 /* Slot Power Limit Scale */ |
| 380 | #define PCI_EXP_DEVCAP_FLR 0x10000000 /* Function Level Reset */ | ||
| 380 | #define PCI_EXP_DEVCTL 8 /* Device Control */ | 381 | #define PCI_EXP_DEVCTL 8 /* Device Control */ |
| 381 | #define PCI_EXP_DEVCTL_CERE 0x0001 /* Correctable Error Reporting En. */ | 382 | #define PCI_EXP_DEVCTL_CERE 0x0001 /* Correctable Error Reporting En. */ |
| 382 | #define PCI_EXP_DEVCTL_NFERE 0x0002 /* Non-Fatal Error Reporting Enable */ | 383 | #define PCI_EXP_DEVCTL_NFERE 0x0002 /* Non-Fatal Error Reporting Enable */ |
| @@ -389,6 +390,7 @@ | |||
| 389 | #define PCI_EXP_DEVCTL_AUX_PME 0x0400 /* Auxiliary Power PM Enable */ | 390 | #define PCI_EXP_DEVCTL_AUX_PME 0x0400 /* Auxiliary Power PM Enable */ |
| 390 | #define PCI_EXP_DEVCTL_NOSNOOP_EN 0x0800 /* Enable No Snoop */ | 391 | #define PCI_EXP_DEVCTL_NOSNOOP_EN 0x0800 /* Enable No Snoop */ |
| 391 | #define PCI_EXP_DEVCTL_READRQ 0x7000 /* Max_Read_Request_Size */ | 392 | #define PCI_EXP_DEVCTL_READRQ 0x7000 /* Max_Read_Request_Size */ |
| 393 | #define PCI_EXP_DEVCTL_BCR_FLR 0x8000 /* Bridge Configuration Retry / FLR */ | ||
| 392 | #define PCI_EXP_DEVSTA 10 /* Device Status */ | 394 | #define PCI_EXP_DEVSTA 10 /* Device Status */ |
| 393 | #define PCI_EXP_DEVSTA_CED 0x01 /* Correctable Error Detected */ | 395 | #define PCI_EXP_DEVSTA_CED 0x01 /* Correctable Error Detected */ |
| 394 | #define PCI_EXP_DEVSTA_NFED 0x02 /* Non-Fatal Error Detected */ | 396 | #define PCI_EXP_DEVSTA_NFED 0x02 /* Non-Fatal Error Detected */ |
diff --git a/include/linux/pnp.h b/include/linux/pnp.h index 53b70fd1d9a5..ca3c88773028 100644 --- a/include/linux/pnp.h +++ b/include/linux/pnp.h | |||
| @@ -485,14 +485,4 @@ static inline void pnp_unregister_driver(struct pnp_driver *drv) { } | |||
| 485 | 485 | ||
| 486 | #endif /* CONFIG_PNP */ | 486 | #endif /* CONFIG_PNP */ |
| 487 | 487 | ||
| 488 | #define pnp_err(format, arg...) printk(KERN_ERR "pnp: " format "\n" , ## arg) | ||
| 489 | #define pnp_info(format, arg...) printk(KERN_INFO "pnp: " format "\n" , ## arg) | ||
| 490 | #define pnp_warn(format, arg...) printk(KERN_WARNING "pnp: " format "\n" , ## arg) | ||
| 491 | |||
| 492 | #ifdef CONFIG_PNP_DEBUG | ||
| 493 | #define pnp_dbg(format, arg...) printk(KERN_DEBUG "pnp: " format "\n" , ## arg) | ||
| 494 | #else | ||
| 495 | #define pnp_dbg(format, arg...) do {} while (0) | ||
| 496 | #endif | ||
| 497 | |||
| 498 | #endif /* _LINUX_PNP_H */ | 488 | #endif /* _LINUX_PNP_H */ |
diff --git a/include/linux/poll.h b/include/linux/poll.h index ef453828877a..badd98ab06f6 100644 --- a/include/linux/poll.h +++ b/include/linux/poll.h | |||
| @@ -114,11 +114,13 @@ void zero_fd_set(unsigned long nr, unsigned long *fdset) | |||
| 114 | 114 | ||
| 115 | #define MAX_INT64_SECONDS (((s64)(~((u64)0)>>1)/HZ)-1) | 115 | #define MAX_INT64_SECONDS (((s64)(~((u64)0)>>1)/HZ)-1) |
| 116 | 116 | ||
| 117 | extern int do_select(int n, fd_set_bits *fds, s64 *timeout); | 117 | extern int do_select(int n, fd_set_bits *fds, struct timespec *end_time); |
| 118 | extern int do_sys_poll(struct pollfd __user * ufds, unsigned int nfds, | 118 | extern int do_sys_poll(struct pollfd __user * ufds, unsigned int nfds, |
| 119 | s64 *timeout); | 119 | struct timespec *end_time); |
| 120 | extern int core_sys_select(int n, fd_set __user *inp, fd_set __user *outp, | 120 | extern int core_sys_select(int n, fd_set __user *inp, fd_set __user *outp, |
| 121 | fd_set __user *exp, s64 *timeout); | 121 | fd_set __user *exp, struct timespec *end_time); |
| 122 | |||
| 123 | extern int poll_select_set_timeout(struct timespec *to, long sec, long nsec); | ||
| 122 | 124 | ||
| 123 | #endif /* KERNEL */ | 125 | #endif /* KERNEL */ |
| 124 | 126 | ||
diff --git a/include/linux/prctl.h b/include/linux/prctl.h index 5ad79198d6f9..48d887e3c6e7 100644 --- a/include/linux/prctl.h +++ b/include/linux/prctl.h | |||
| @@ -78,4 +78,11 @@ | |||
| 78 | #define PR_GET_SECUREBITS 27 | 78 | #define PR_GET_SECUREBITS 27 |
| 79 | #define PR_SET_SECUREBITS 28 | 79 | #define PR_SET_SECUREBITS 28 |
| 80 | 80 | ||
| 81 | /* | ||
| 82 | * Get/set the timerslack as used by poll/select/nanosleep | ||
| 83 | * A value of 0 means "use default" | ||
| 84 | */ | ||
| 85 | #define PR_SET_TIMERSLACK 29 | ||
| 86 | #define PR_GET_TIMERSLACK 30 | ||
| 87 | |||
| 81 | #endif /* _LINUX_PRCTL_H */ | 88 | #endif /* _LINUX_PRCTL_H */ |
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h index 27d534f4470d..b8bdb96eff78 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.h | |||
| @@ -97,12 +97,9 @@ struct vmcore { | |||
| 97 | 97 | ||
| 98 | #ifdef CONFIG_PROC_FS | 98 | #ifdef CONFIG_PROC_FS |
| 99 | 99 | ||
| 100 | extern struct proc_dir_entry *proc_root_kcore; | ||
| 101 | |||
| 102 | extern spinlock_t proc_subdir_lock; | 100 | extern spinlock_t proc_subdir_lock; |
| 103 | 101 | ||
| 104 | extern void proc_root_init(void); | 102 | extern void proc_root_init(void); |
| 105 | extern void proc_misc_init(void); | ||
| 106 | 103 | ||
| 107 | void proc_flush_task(struct task_struct *task); | 104 | void proc_flush_task(struct task_struct *task); |
| 108 | struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *); | 105 | struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *); |
| @@ -138,8 +135,6 @@ extern struct inode *proc_get_inode(struct super_block *, unsigned int, struct p | |||
| 138 | extern int proc_readdir(struct file *, void *, filldir_t); | 135 | extern int proc_readdir(struct file *, void *, filldir_t); |
| 139 | extern struct dentry *proc_lookup(struct inode *, struct dentry *, struct nameidata *); | 136 | extern struct dentry *proc_lookup(struct inode *, struct dentry *, struct nameidata *); |
| 140 | 137 | ||
| 141 | extern const struct file_operations proc_kcore_operations; | ||
| 142 | |||
| 143 | extern int pid_ns_prepare_proc(struct pid_namespace *ns); | 138 | extern int pid_ns_prepare_proc(struct pid_namespace *ns); |
| 144 | extern void pid_ns_release_proc(struct pid_namespace *ns); | 139 | extern void pid_ns_release_proc(struct pid_namespace *ns); |
| 145 | 140 | ||
diff --git a/include/linux/profile.h b/include/linux/profile.h index 570045053ce9..a0fc32279fc0 100644 --- a/include/linux/profile.h +++ b/include/linux/profile.h | |||
| @@ -19,10 +19,16 @@ struct notifier_block; | |||
| 19 | 19 | ||
| 20 | #if defined(CONFIG_PROFILING) && defined(CONFIG_PROC_FS) | 20 | #if defined(CONFIG_PROFILING) && defined(CONFIG_PROC_FS) |
| 21 | void create_prof_cpu_mask(struct proc_dir_entry *de); | 21 | void create_prof_cpu_mask(struct proc_dir_entry *de); |
| 22 | int create_proc_profile(void); | ||
| 22 | #else | 23 | #else |
| 23 | static inline void create_prof_cpu_mask(struct proc_dir_entry *de) | 24 | static inline void create_prof_cpu_mask(struct proc_dir_entry *de) |
| 24 | { | 25 | { |
| 25 | } | 26 | } |
| 27 | |||
| 28 | static inline int create_proc_profile(void) | ||
| 29 | { | ||
| 30 | return 0; | ||
| 31 | } | ||
| 26 | #endif | 32 | #endif |
| 27 | 33 | ||
| 28 | enum profile_type { | 34 | enum profile_type { |
| @@ -37,7 +43,6 @@ extern int prof_on __read_mostly; | |||
| 37 | /* init basic kernel profiler */ | 43 | /* init basic kernel profiler */ |
| 38 | int profile_init(void); | 44 | int profile_init(void); |
| 39 | int profile_setup(char *str); | 45 | int profile_setup(char *str); |
| 40 | int create_proc_profile(void); | ||
| 41 | void profile_tick(int type); | 46 | void profile_tick(int type); |
| 42 | 47 | ||
| 43 | /* | 48 | /* |
diff --git a/include/linux/reiserfs_fs_sb.h b/include/linux/reiserfs_fs_sb.h index 315517e8bfa1..bda6b562a1e0 100644 --- a/include/linux/reiserfs_fs_sb.h +++ b/include/linux/reiserfs_fs_sb.h | |||
| @@ -178,6 +178,7 @@ struct reiserfs_journal { | |||
| 178 | struct reiserfs_journal_cnode *j_first; /* oldest journal block. start here for traverse */ | 178 | struct reiserfs_journal_cnode *j_first; /* oldest journal block. start here for traverse */ |
| 179 | 179 | ||
| 180 | struct block_device *j_dev_bd; | 180 | struct block_device *j_dev_bd; |
| 181 | fmode_t j_dev_mode; | ||
| 181 | int j_1st_reserved_block; /* first block on s_dev of reserved area journal */ | 182 | int j_1st_reserved_block; /* first block on s_dev of reserved area journal */ |
| 182 | 183 | ||
| 183 | unsigned long j_state; | 184 | unsigned long j_state; |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 5c38db536e07..8478f334d732 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
| @@ -287,7 +287,6 @@ extern void trap_init(void); | |||
| 287 | extern void account_process_tick(struct task_struct *task, int user); | 287 | extern void account_process_tick(struct task_struct *task, int user); |
| 288 | extern void update_process_times(int user); | 288 | extern void update_process_times(int user); |
| 289 | extern void scheduler_tick(void); | 289 | extern void scheduler_tick(void); |
| 290 | extern void hrtick_resched(void); | ||
| 291 | 290 | ||
| 292 | extern void sched_show_task(struct task_struct *p); | 291 | extern void sched_show_task(struct task_struct *p); |
| 293 | 292 | ||
| @@ -681,10 +680,6 @@ struct sched_info { | |||
| 681 | }; | 680 | }; |
| 682 | #endif /* defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) */ | 681 | #endif /* defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) */ |
| 683 | 682 | ||
| 684 | #ifdef CONFIG_SCHEDSTATS | ||
| 685 | extern const struct file_operations proc_schedstat_operations; | ||
| 686 | #endif /* CONFIG_SCHEDSTATS */ | ||
| 687 | |||
| 688 | #ifdef CONFIG_TASK_DELAY_ACCT | 683 | #ifdef CONFIG_TASK_DELAY_ACCT |
| 689 | struct task_delay_info { | 684 | struct task_delay_info { |
| 690 | spinlock_t lock; | 685 | spinlock_t lock; |
| @@ -1346,6 +1341,12 @@ struct task_struct { | |||
| 1346 | int latency_record_count; | 1341 | int latency_record_count; |
| 1347 | struct latency_record latency_record[LT_SAVECOUNT]; | 1342 | struct latency_record latency_record[LT_SAVECOUNT]; |
| 1348 | #endif | 1343 | #endif |
| 1344 | /* | ||
| 1345 | * time slack values; these are used to round up poll() and | ||
| 1346 | * select() etc timeout values. These are in nanoseconds. | ||
| 1347 | */ | ||
| 1348 | unsigned long timer_slack_ns; | ||
| 1349 | unsigned long default_timer_slack_ns; | ||
| 1349 | }; | 1350 | }; |
| 1350 | 1351 | ||
| 1351 | /* | 1352 | /* |
| @@ -1665,6 +1666,7 @@ extern unsigned int sysctl_sched_features; | |||
| 1665 | extern unsigned int sysctl_sched_migration_cost; | 1666 | extern unsigned int sysctl_sched_migration_cost; |
| 1666 | extern unsigned int sysctl_sched_nr_migrate; | 1667 | extern unsigned int sysctl_sched_nr_migrate; |
| 1667 | extern unsigned int sysctl_sched_shares_ratelimit; | 1668 | extern unsigned int sysctl_sched_shares_ratelimit; |
| 1669 | extern unsigned int sysctl_sched_shares_thresh; | ||
| 1668 | 1670 | ||
| 1669 | int sched_nr_latency_handler(struct ctl_table *table, int write, | 1671 | int sched_nr_latency_handler(struct ctl_table *table, int write, |
| 1670 | struct file *file, void __user *buffer, size_t *length, | 1672 | struct file *file, void __user *buffer, size_t *length, |
diff --git a/include/linux/slab.h b/include/linux/slab.h index 5ff9676c1e2c..ba965c84ae06 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h | |||
| @@ -288,9 +288,4 @@ static inline void *kzalloc_node(size_t size, gfp_t flags, int node) | |||
| 288 | return kmalloc_node(size, flags | __GFP_ZERO, node); | 288 | return kmalloc_node(size, flags | __GFP_ZERO, node); |
| 289 | } | 289 | } |
| 290 | 290 | ||
| 291 | #ifdef CONFIG_SLABINFO | ||
| 292 | extern const struct seq_operations slabinfo_op; | ||
| 293 | ssize_t slabinfo_write(struct file *, const char __user *, size_t, loff_t *); | ||
| 294 | #endif | ||
| 295 | |||
| 296 | #endif /* _LINUX_SLAB_H */ | 291 | #endif /* _LINUX_SLAB_H */ |
diff --git a/include/linux/smc911x.h b/include/linux/smc911x.h index b58f54c24183..521f37143fae 100644 --- a/include/linux/smc911x.h +++ b/include/linux/smc911x.h | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | struct smc911x_platdata { | 7 | struct smc911x_platdata { |
| 8 | unsigned long flags; | 8 | unsigned long flags; |
| 9 | unsigned long irq_flags; /* IRQF_... */ | 9 | unsigned long irq_flags; /* IRQF_... */ |
| 10 | int irq_polarity; | ||
| 10 | }; | 11 | }; |
| 11 | 12 | ||
| 12 | #endif /* __SMC911X_H__ */ | 13 | #endif /* __SMC911X_H__ */ |
diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h index 38a56477f27a..e6b820f8b56b 100644 --- a/include/linux/thread_info.h +++ b/include/linux/thread_info.h | |||
| @@ -38,6 +38,14 @@ struct restart_block { | |||
| 38 | #endif | 38 | #endif |
| 39 | u64 expires; | 39 | u64 expires; |
| 40 | } nanosleep; | 40 | } nanosleep; |
| 41 | /* For poll */ | ||
| 42 | struct { | ||
| 43 | struct pollfd __user *ufds; | ||
| 44 | int nfds; | ||
| 45 | int has_timeout; | ||
| 46 | unsigned long tv_sec; | ||
| 47 | unsigned long tv_nsec; | ||
| 48 | } poll; | ||
| 41 | }; | 49 | }; |
| 42 | }; | 50 | }; |
| 43 | 51 | ||
diff --git a/include/linux/time.h b/include/linux/time.h index 4f1c9db57707..ce321ac5c8f8 100644 --- a/include/linux/time.h +++ b/include/linux/time.h | |||
| @@ -40,6 +40,8 @@ extern struct timezone sys_tz; | |||
| 40 | #define NSEC_PER_SEC 1000000000L | 40 | #define NSEC_PER_SEC 1000000000L |
| 41 | #define FSEC_PER_SEC 1000000000000000L | 41 | #define FSEC_PER_SEC 1000000000000000L |
| 42 | 42 | ||
| 43 | #define TIME_T_MAX (time_t)((1UL << ((sizeof(time_t) << 3) - 1)) - 1) | ||
| 44 | |||
| 43 | static inline int timespec_equal(const struct timespec *a, | 45 | static inline int timespec_equal(const struct timespec *a, |
| 44 | const struct timespec *b) | 46 | const struct timespec *b) |
| 45 | { | 47 | { |
| @@ -74,6 +76,8 @@ extern unsigned long mktime(const unsigned int year, const unsigned int mon, | |||
| 74 | const unsigned int min, const unsigned int sec); | 76 | const unsigned int min, const unsigned int sec); |
| 75 | 77 | ||
| 76 | extern void set_normalized_timespec(struct timespec *ts, time_t sec, long nsec); | 78 | extern void set_normalized_timespec(struct timespec *ts, time_t sec, long nsec); |
| 79 | extern struct timespec timespec_add_safe(const struct timespec lhs, | ||
| 80 | const struct timespec rhs); | ||
| 77 | 81 | ||
| 78 | /* | 82 | /* |
| 79 | * sub = lhs - rhs, in normalized form | 83 | * sub = lhs - rhs, in normalized form |
diff --git a/include/linux/types.h b/include/linux/types.h index f24f7beb47df..1d98330b1f2c 100644 --- a/include/linux/types.h +++ b/include/linux/types.h | |||
| @@ -190,6 +190,7 @@ typedef __u32 __bitwise __wsum; | |||
| 190 | 190 | ||
| 191 | #ifdef __KERNEL__ | 191 | #ifdef __KERNEL__ |
| 192 | typedef unsigned __bitwise__ gfp_t; | 192 | typedef unsigned __bitwise__ gfp_t; |
| 193 | typedef unsigned __bitwise__ fmode_t; | ||
| 193 | 194 | ||
| 194 | #ifdef CONFIG_PHYS_ADDR_T_64BIT | 195 | #ifdef CONFIG_PHYS_ADDR_T_64BIT |
| 195 | typedef u64 phys_addr_t; | 196 | typedef u64 phys_addr_t; |
diff --git a/include/linux/usb/wusb-wa.h b/include/linux/usb/wusb-wa.h new file mode 100644 index 000000000000..a102561e7026 --- /dev/null +++ b/include/linux/usb/wusb-wa.h | |||
| @@ -0,0 +1,271 @@ | |||
| 1 | /* | ||
| 2 | * Wireless USB Wire Adapter constants and structures. | ||
| 3 | * | ||
| 4 | * Copyright (C) 2005-2006 Intel Corporation. | ||
| 5 | * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com> | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or | ||
| 8 | * modify it under the terms of the GNU General Public License version | ||
| 9 | * 2 as published by the Free Software Foundation. | ||
| 10 | * | ||
| 11 | * This program is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License | ||
| 17 | * along with this program; if not, write to the Free Software | ||
| 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
| 19 | * 02110-1301, USA. | ||
| 20 | * | ||
| 21 | * | ||
| 22 | * FIXME: docs | ||
| 23 | * FIXME: organize properly, group logically | ||
| 24 | * | ||
| 25 | * All the event structures are defined in uwb/spec.h, as they are | ||
| 26 | * common to the WHCI and WUSB radio control interfaces. | ||
| 27 | * | ||
| 28 | * References: | ||
| 29 | * [WUSB] Wireless Universal Serial Bus Specification, revision 1.0, ch8 | ||
| 30 | */ | ||
| 31 | #ifndef __LINUX_USB_WUSB_WA_H | ||
| 32 | #define __LINUX_USB_WUSB_WA_H | ||
| 33 | |||
| 34 | /** | ||
| 35 | * Radio Command Request for the Radio Control Interface | ||
| 36 | * | ||
| 37 | * Radio Control Interface command and event codes are the same as | ||
| 38 | * WHCI, and listed in include/linux/uwb.h:UWB_RC_{CMD,EVT}_* | ||
| 39 | */ | ||
| 40 | enum { | ||
| 41 | WA_EXEC_RC_CMD = 40, /* Radio Control command Request */ | ||
| 42 | }; | ||
| 43 | |||
| 44 | /* Wireless Adapter Requests ([WUSB] table 8-51) */ | ||
| 45 | enum { | ||
| 46 | WUSB_REQ_ADD_MMC_IE = 20, | ||
| 47 | WUSB_REQ_REMOVE_MMC_IE = 21, | ||
| 48 | WUSB_REQ_SET_NUM_DNTS = 22, | ||
| 49 | WUSB_REQ_SET_CLUSTER_ID = 23, | ||
| 50 | WUSB_REQ_SET_DEV_INFO = 24, | ||
| 51 | WUSB_REQ_GET_TIME = 25, | ||
| 52 | WUSB_REQ_SET_STREAM_IDX = 26, | ||
| 53 | WUSB_REQ_SET_WUSB_MAS = 27, | ||
| 54 | }; | ||
| 55 | |||
| 56 | |||
| 57 | /* Wireless Adapter WUSB Channel Time types ([WUSB] table 8-52) */ | ||
| 58 | enum { | ||
| 59 | WUSB_TIME_ADJ = 0, | ||
| 60 | WUSB_TIME_BPST = 1, | ||
| 61 | WUSB_TIME_WUSB = 2, | ||
| 62 | }; | ||
| 63 | |||
| 64 | enum { | ||
| 65 | WA_ENABLE = 0x01, | ||
| 66 | WA_RESET = 0x02, | ||
| 67 | RPIPE_PAUSE = 0x1, | ||
| 68 | }; | ||
| 69 | |||
| 70 | /* Responses from Get Status request ([WUSB] section 8.3.1.6) */ | ||
| 71 | enum { | ||
| 72 | WA_STATUS_ENABLED = 0x01, | ||
| 73 | WA_STATUS_RESETTING = 0x02 | ||
| 74 | }; | ||
| 75 | |||
| 76 | enum rpipe_crs { | ||
| 77 | RPIPE_CRS_CTL = 0x01, | ||
| 78 | RPIPE_CRS_ISO = 0x02, | ||
| 79 | RPIPE_CRS_BULK = 0x04, | ||
| 80 | RPIPE_CRS_INTR = 0x08 | ||
| 81 | }; | ||
| 82 | |||
| 83 | /** | ||
| 84 | * RPipe descriptor ([WUSB] section 8.5.2.11) | ||
| 85 | * | ||
| 86 | * FIXME: explain rpipes | ||
| 87 | */ | ||
| 88 | struct usb_rpipe_descriptor { | ||
| 89 | u8 bLength; | ||
| 90 | u8 bDescriptorType; | ||
| 91 | __le16 wRPipeIndex; | ||
| 92 | __le16 wRequests; | ||
| 93 | __le16 wBlocks; /* rw if 0 */ | ||
| 94 | __le16 wMaxPacketSize; /* rw? */ | ||
| 95 | u8 bHSHubAddress; /* reserved: 0 */ | ||
| 96 | u8 bHSHubPort; /* ??? FIXME ??? */ | ||
| 97 | u8 bSpeed; /* rw: xfer rate 'enum uwb_phy_rate' */ | ||
| 98 | u8 bDeviceAddress; /* rw: Target device address */ | ||
| 99 | u8 bEndpointAddress; /* rw: Target EP address */ | ||
| 100 | u8 bDataSequence; /* ro: Current Data sequence */ | ||
| 101 | __le32 dwCurrentWindow; /* ro */ | ||
| 102 | u8 bMaxDataSequence; /* ro?: max supported seq */ | ||
| 103 | u8 bInterval; /* rw: */ | ||
| 104 | u8 bOverTheAirInterval; /* rw: */ | ||
| 105 | u8 bmAttribute; /* ro? */ | ||
| 106 | u8 bmCharacteristics; /* ro? enum rpipe_attr, supported xsactions */ | ||
| 107 | u8 bmRetryOptions; /* rw? */ | ||
| 108 | __le16 wNumTransactionErrors; /* rw */ | ||
| 109 | } __attribute__ ((packed)); | ||
| 110 | |||
| 111 | /** | ||
| 112 | * Wire Adapter Notification types ([WUSB] sections 8.4.5 & 8.5.4) | ||
| 113 | * | ||
| 114 | * These are the notifications coming on the notification endpoint of | ||
| 115 | * an HWA and a DWA. | ||
| 116 | */ | ||
| 117 | enum wa_notif_type { | ||
| 118 | DWA_NOTIF_RWAKE = 0x91, | ||
| 119 | DWA_NOTIF_PORTSTATUS = 0x92, | ||
| 120 | WA_NOTIF_TRANSFER = 0x93, | ||
| 121 | HWA_NOTIF_BPST_ADJ = 0x94, | ||
| 122 | HWA_NOTIF_DN = 0x95, | ||
| 123 | }; | ||
| 124 | |||
| 125 | /** | ||
| 126 | * Wire Adapter notification header | ||
| 127 | * | ||
| 128 | * Notifications coming from a wire adapter use a common header | ||
| 129 | * defined in [WUSB] sections 8.4.5 & 8.5.4. | ||
| 130 | */ | ||
| 131 | struct wa_notif_hdr { | ||
| 132 | u8 bLength; | ||
| 133 | u8 bNotifyType; /* enum wa_notif_type */ | ||
| 134 | } __attribute__((packed)); | ||
| 135 | |||
| 136 | /** | ||
| 137 | * HWA DN Received notification [(WUSB] section 8.5.4.2) | ||
| 138 | * | ||
| 139 | * The DNData is specified in WUSB1.0[7.6]. For each device | ||
| 140 | * notification we received, we just need to dispatch it. | ||
| 141 | * | ||
| 142 | * @dndata: this is really an array of notifications, but all start | ||
| 143 | * with the same header. | ||
| 144 | */ | ||
| 145 | struct hwa_notif_dn { | ||
| 146 | struct wa_notif_hdr hdr; | ||
| 147 | u8 bSourceDeviceAddr; /* from errata 2005/07 */ | ||
| 148 | u8 bmAttributes; | ||
| 149 | struct wusb_dn_hdr dndata[]; | ||
| 150 | } __attribute__((packed)); | ||
| 151 | |||
| 152 | /* [WUSB] section 8.3.3 */ | ||
| 153 | enum wa_xfer_type { | ||
| 154 | WA_XFER_TYPE_CTL = 0x80, | ||
| 155 | WA_XFER_TYPE_BI = 0x81, /* bulk/interrupt */ | ||
| 156 | WA_XFER_TYPE_ISO = 0x82, | ||
| 157 | WA_XFER_RESULT = 0x83, | ||
| 158 | WA_XFER_ABORT = 0x84, | ||
| 159 | }; | ||
| 160 | |||
| 161 | /* [WUSB] section 8.3.3 */ | ||
| 162 | struct wa_xfer_hdr { | ||
| 163 | u8 bLength; /* 0x18 */ | ||
| 164 | u8 bRequestType; /* 0x80 WA_REQUEST_TYPE_CTL */ | ||
| 165 | __le16 wRPipe; /* RPipe index */ | ||
| 166 | __le32 dwTransferID; /* Host-assigned ID */ | ||
| 167 | __le32 dwTransferLength; /* Length of data to xfer */ | ||
| 168 | u8 bTransferSegment; | ||
| 169 | } __attribute__((packed)); | ||
| 170 | |||
| 171 | struct wa_xfer_ctl { | ||
| 172 | struct wa_xfer_hdr hdr; | ||
| 173 | u8 bmAttribute; | ||
| 174 | __le16 wReserved; | ||
| 175 | struct usb_ctrlrequest baSetupData; | ||
| 176 | } __attribute__((packed)); | ||
| 177 | |||
| 178 | struct wa_xfer_bi { | ||
| 179 | struct wa_xfer_hdr hdr; | ||
| 180 | u8 bReserved; | ||
| 181 | __le16 wReserved; | ||
| 182 | } __attribute__((packed)); | ||
| 183 | |||
| 184 | struct wa_xfer_hwaiso { | ||
| 185 | struct wa_xfer_hdr hdr; | ||
| 186 | u8 bReserved; | ||
| 187 | __le16 wPresentationTime; | ||
| 188 | __le32 dwNumOfPackets; | ||
| 189 | /* FIXME: u8 pktdata[]? */ | ||
| 190 | } __attribute__((packed)); | ||
| 191 | |||
| 192 | /* [WUSB] section 8.3.3.5 */ | ||
| 193 | struct wa_xfer_abort { | ||
| 194 | u8 bLength; | ||
| 195 | u8 bRequestType; | ||
| 196 | __le16 wRPipe; /* RPipe index */ | ||
| 197 | __le32 dwTransferID; /* Host-assigned ID */ | ||
| 198 | } __attribute__((packed)); | ||
| 199 | |||
| 200 | /** | ||
| 201 | * WA Transfer Complete notification ([WUSB] section 8.3.3.3) | ||
| 202 | * | ||
| 203 | */ | ||
| 204 | struct wa_notif_xfer { | ||
| 205 | struct wa_notif_hdr hdr; | ||
| 206 | u8 bEndpoint; | ||
| 207 | u8 Reserved; | ||
| 208 | } __attribute__((packed)); | ||
| 209 | |||
| 210 | /** Transfer result basic codes [WUSB] table 8-15 */ | ||
| 211 | enum { | ||
| 212 | WA_XFER_STATUS_SUCCESS, | ||
| 213 | WA_XFER_STATUS_HALTED, | ||
| 214 | WA_XFER_STATUS_DATA_BUFFER_ERROR, | ||
| 215 | WA_XFER_STATUS_BABBLE, | ||
| 216 | WA_XFER_RESERVED, | ||
| 217 | WA_XFER_STATUS_NOT_FOUND, | ||
| 218 | WA_XFER_STATUS_INSUFFICIENT_RESOURCE, | ||
| 219 | WA_XFER_STATUS_TRANSACTION_ERROR, | ||
| 220 | WA_XFER_STATUS_ABORTED, | ||
| 221 | WA_XFER_STATUS_RPIPE_NOT_READY, | ||
| 222 | WA_XFER_INVALID_FORMAT, | ||
| 223 | WA_XFER_UNEXPECTED_SEGMENT_NUMBER, | ||
| 224 | WA_XFER_STATUS_RPIPE_TYPE_MISMATCH, | ||
| 225 | }; | ||
| 226 | |||
| 227 | /** [WUSB] section 8.3.3.4 */ | ||
| 228 | struct wa_xfer_result { | ||
| 229 | struct wa_notif_hdr hdr; | ||
| 230 | __le32 dwTransferID; | ||
| 231 | __le32 dwTransferLength; | ||
| 232 | u8 bTransferSegment; | ||
| 233 | u8 bTransferStatus; | ||
| 234 | __le32 dwNumOfPackets; | ||
| 235 | } __attribute__((packed)); | ||
| 236 | |||
| 237 | /** | ||
| 238 | * Wire Adapter Class Descriptor ([WUSB] section 8.5.2.7). | ||
| 239 | * | ||
| 240 | * NOTE: u16 fields are read Little Endian from the hardware. | ||
| 241 | * | ||
| 242 | * @bNumPorts is the original max number of devices that the host can | ||
| 243 | * connect; we might chop this so the stack can handle | ||
| 244 | * it. In case you need to access it, use wusbhc->ports_max | ||
| 245 | * if it is a Wireless USB WA. | ||
| 246 | */ | ||
| 247 | struct usb_wa_descriptor { | ||
| 248 | u8 bLength; | ||
| 249 | u8 bDescriptorType; | ||
| 250 | u16 bcdWAVersion; | ||
| 251 | u8 bNumPorts; /* don't use!! */ | ||
| 252 | u8 bmAttributes; /* Reserved == 0 */ | ||
| 253 | u16 wNumRPipes; | ||
| 254 | u16 wRPipeMaxBlock; | ||
| 255 | u8 bRPipeBlockSize; | ||
| 256 | u8 bPwrOn2PwrGood; | ||
| 257 | u8 bNumMMCIEs; | ||
| 258 | u8 DeviceRemovable; /* FIXME: in DWA this is up to 16 bytes */ | ||
| 259 | } __attribute__((packed)); | ||
| 260 | |||
| 261 | /** | ||
| 262 | * HWA Device Information Buffer (WUSB1.0[T8.54]) | ||
| 263 | */ | ||
| 264 | struct hwa_dev_info { | ||
| 265 | u8 bmDeviceAvailability[32]; /* FIXME: ignored for now */ | ||
| 266 | u8 bDeviceAddress; | ||
| 267 | __le16 wPHYRates; | ||
| 268 | u8 bmDeviceAttribute; | ||
| 269 | } __attribute__((packed)); | ||
| 270 | |||
| 271 | #endif /* #ifndef __LINUX_USB_WUSB_WA_H */ | ||
diff --git a/include/linux/usb/wusb.h b/include/linux/usb/wusb.h new file mode 100644 index 000000000000..5f401b644ed5 --- /dev/null +++ b/include/linux/usb/wusb.h | |||
| @@ -0,0 +1,376 @@ | |||
| 1 | /* | ||
| 2 | * Wireless USB Standard Definitions | ||
| 3 | * Event Size Tables | ||
| 4 | * | ||
| 5 | * Copyright (C) 2005-2006 Intel Corporation | ||
| 6 | * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com> | ||
| 7 | * | ||
| 8 | * This program is free software; you can redistribute it and/or | ||
| 9 | * modify it under the terms of the GNU General Public License version | ||
| 10 | * 2 as published by the Free Software Foundation. | ||
| 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., 51 Franklin Street, Fifth Floor, Boston, MA | ||
| 20 | * 02110-1301, USA. | ||
| 21 | * | ||
| 22 | * | ||
| 23 | * FIXME: docs | ||
| 24 | * FIXME: organize properly, group logically | ||
| 25 | * | ||
| 26 | * All the event structures are defined in uwb/spec.h, as they are | ||
| 27 | * common to the WHCI and WUSB radio control interfaces. | ||
| 28 | */ | ||
| 29 | |||
| 30 | #ifndef __WUSB_H__ | ||
| 31 | #define __WUSB_H__ | ||
| 32 | |||
| 33 | #include <linux/types.h> | ||
| 34 | #include <linux/kernel.h> | ||
| 35 | #include <linux/uwb/spec.h> | ||
| 36 | #include <linux/usb/ch9.h> | ||
| 37 | #include <linux/param.h> | ||
| 38 | |||
| 39 | /** | ||
| 40 | * WUSB Information Element header | ||
| 41 | * | ||
| 42 | * I don't know why, they decided to make it different to the MBOA MAC | ||
| 43 | * IE Header; beats me. | ||
| 44 | */ | ||
| 45 | struct wuie_hdr { | ||
| 46 | u8 bLength; | ||
| 47 | u8 bIEIdentifier; | ||
| 48 | } __attribute__((packed)); | ||
| 49 | |||
| 50 | enum { | ||
| 51 | WUIE_ID_WCTA = 0x80, | ||
| 52 | WUIE_ID_CONNECTACK, | ||
| 53 | WUIE_ID_HOST_INFO, | ||
| 54 | WUIE_ID_CHANGE_ANNOUNCE, | ||
| 55 | WUIE_ID_DEVICE_DISCONNECT, | ||
| 56 | WUIE_ID_HOST_DISCONNECT, | ||
| 57 | WUIE_ID_KEEP_ALIVE = 0x89, | ||
| 58 | WUIE_ID_ISOCH_DISCARD, | ||
| 59 | WUIE_ID_RESET_DEVICE, | ||
| 60 | }; | ||
| 61 | |||
| 62 | /** | ||
| 63 | * Maximum number of array elements in a WUSB IE. | ||
| 64 | * | ||
| 65 | * WUSB1.0[7.5 before table 7-38] says that in WUSB IEs that | ||
| 66 | * are "arrays" have to limited to 4 elements. So we define it | ||
| 67 | * like that to ease up and submit only the neeed size. | ||
| 68 | */ | ||
| 69 | #define WUIE_ELT_MAX 4 | ||
| 70 | |||
| 71 | /** | ||
| 72 | * Wrapper for the data that defines a CHID, a CDID or a CK | ||
| 73 | * | ||
| 74 | * WUSB defines that CHIDs, CDIDs and CKs are a 16 byte string of | ||
| 75 | * data. In order to avoid confusion and enforce types, we wrap it. | ||
| 76 | * | ||
| 77 | * Make it packed, as we use it in some hw defintions. | ||
| 78 | */ | ||
| 79 | struct wusb_ckhdid { | ||
| 80 | u8 data[16]; | ||
| 81 | } __attribute__((packed)); | ||
| 82 | |||
| 83 | const static | ||
| 84 | struct wusb_ckhdid wusb_ckhdid_zero = { .data = { 0 } }; | ||
| 85 | |||
| 86 | #define WUSB_CKHDID_STRSIZE (3 * sizeof(struct wusb_ckhdid) + 1) | ||
| 87 | |||
| 88 | /** | ||
| 89 | * WUSB IE: Host Information (WUSB1.0[7.5.2]) | ||
| 90 | * | ||
| 91 | * Used to provide information about the host to the Wireless USB | ||
| 92 | * devices in range (CHID can be used as an ASCII string). | ||
| 93 | */ | ||
| 94 | struct wuie_host_info { | ||
| 95 | struct wuie_hdr hdr; | ||
| 96 | __le16 attributes; | ||
| 97 | struct wusb_ckhdid CHID; | ||
| 98 | } __attribute__((packed)); | ||
| 99 | |||
| 100 | /** | ||
| 101 | * WUSB IE: Connect Ack (WUSB1.0[7.5.1]) | ||
| 102 | * | ||
| 103 | * Used to acknowledge device connect requests. See note for | ||
| 104 | * WUIE_ELT_MAX. | ||
| 105 | */ | ||
| 106 | struct wuie_connect_ack { | ||
| 107 | struct wuie_hdr hdr; | ||
| 108 | struct { | ||
| 109 | struct wusb_ckhdid CDID; | ||
| 110 | u8 bDeviceAddress; /* 0 means unused */ | ||
| 111 | u8 bReserved; | ||
| 112 | } blk[WUIE_ELT_MAX]; | ||
| 113 | } __attribute__((packed)); | ||
| 114 | |||
| 115 | /** | ||
| 116 | * WUSB IE Host Information Element, Connect Availability | ||
| 117 | * | ||
| 118 | * WUSB1.0[7.5.2], bmAttributes description | ||
| 119 | */ | ||
| 120 | enum { | ||
| 121 | WUIE_HI_CAP_RECONNECT = 0, | ||
| 122 | WUIE_HI_CAP_LIMITED, | ||
| 123 | WUIE_HI_CAP_RESERVED, | ||
| 124 | WUIE_HI_CAP_ALL, | ||
| 125 | }; | ||
| 126 | |||
| 127 | /** | ||
| 128 | * WUSB IE: Channel Stop (WUSB1.0[7.5.8]) | ||
| 129 | * | ||
| 130 | * Tells devices the host is going to stop sending MMCs and will dissapear. | ||
| 131 | */ | ||
| 132 | struct wuie_channel_stop { | ||
| 133 | struct wuie_hdr hdr; | ||
| 134 | u8 attributes; | ||
| 135 | u8 timestamp[3]; | ||
| 136 | } __attribute__((packed)); | ||
| 137 | |||
| 138 | /** | ||
| 139 | * WUSB IE: Keepalive (WUSB1.0[7.5.9]) | ||
| 140 | * | ||
| 141 | * Ask device(s) to send keepalives. | ||
| 142 | */ | ||
| 143 | struct wuie_keep_alive { | ||
| 144 | struct wuie_hdr hdr; | ||
| 145 | u8 bDeviceAddress[WUIE_ELT_MAX]; | ||
| 146 | } __attribute__((packed)); | ||
| 147 | |||
| 148 | /** | ||
| 149 | * WUSB IE: Reset device (WUSB1.0[7.5.11]) | ||
| 150 | * | ||
| 151 | * Tell device to reset; in all truth, we can fit 4 CDIDs, but we only | ||
| 152 | * use it for one at the time... | ||
| 153 | * | ||
| 154 | * In any case, this request is a wee bit silly: why don't they target | ||
| 155 | * by address?? | ||
| 156 | */ | ||
| 157 | struct wuie_reset { | ||
| 158 | struct wuie_hdr hdr; | ||
| 159 | struct wusb_ckhdid CDID; | ||
| 160 | } __attribute__((packed)); | ||
| 161 | |||
| 162 | /** | ||
| 163 | * WUSB IE: Disconnect device (WUSB1.0[7.5.11]) | ||
| 164 | * | ||
| 165 | * Tell device to disconnect; we can fit 4 addresses, but we only use | ||
| 166 | * it for one at the time... | ||
| 167 | */ | ||
| 168 | struct wuie_disconnect { | ||
| 169 | struct wuie_hdr hdr; | ||
| 170 | u8 bDeviceAddress; | ||
| 171 | u8 padding; | ||
| 172 | } __attribute__((packed)); | ||
| 173 | |||
| 174 | /** | ||
| 175 | * WUSB IE: Host disconnect ([WUSB] section 7.5.5) | ||
| 176 | * | ||
| 177 | * Tells all connected devices to disconnect. | ||
| 178 | */ | ||
| 179 | struct wuie_host_disconnect { | ||
| 180 | struct wuie_hdr hdr; | ||
| 181 | } __attribute__((packed)); | ||
| 182 | |||
| 183 | /** | ||
| 184 | * WUSB Device Notification header (WUSB1.0[7.6]) | ||
| 185 | */ | ||
| 186 | struct wusb_dn_hdr { | ||
| 187 | u8 bType; | ||
| 188 | u8 notifdata[]; | ||
| 189 | } __attribute__((packed)); | ||
| 190 | |||
| 191 | /** Device Notification codes (WUSB1.0[Table 7-54]) */ | ||
| 192 | enum WUSB_DN { | ||
| 193 | WUSB_DN_CONNECT = 0x01, | ||
| 194 | WUSB_DN_DISCONNECT = 0x02, | ||
| 195 | WUSB_DN_EPRDY = 0x03, | ||
| 196 | WUSB_DN_MASAVAILCHANGED = 0x04, | ||
| 197 | WUSB_DN_RWAKE = 0x05, | ||
| 198 | WUSB_DN_SLEEP = 0x06, | ||
| 199 | WUSB_DN_ALIVE = 0x07, | ||
| 200 | }; | ||
| 201 | |||
| 202 | /** WUSB Device Notification Connect */ | ||
| 203 | struct wusb_dn_connect { | ||
| 204 | struct wusb_dn_hdr hdr; | ||
| 205 | __le16 attributes; | ||
| 206 | struct wusb_ckhdid CDID; | ||
| 207 | } __attribute__((packed)); | ||
| 208 | |||
| 209 | static inline int wusb_dn_connect_prev_dev_addr(const struct wusb_dn_connect *dn) | ||
| 210 | { | ||
| 211 | return le16_to_cpu(dn->attributes) & 0xff; | ||
| 212 | } | ||
| 213 | |||
| 214 | static inline int wusb_dn_connect_new_connection(const struct wusb_dn_connect *dn) | ||
| 215 | { | ||
| 216 | return (le16_to_cpu(dn->attributes) >> 8) & 0x1; | ||
| 217 | } | ||
| 218 | |||
| 219 | static inline int wusb_dn_connect_beacon_behavior(const struct wusb_dn_connect *dn) | ||
| 220 | { | ||
| 221 | return (le16_to_cpu(dn->attributes) >> 9) & 0x03; | ||
| 222 | } | ||
| 223 | |||
| 224 | /** Device is alive (aka: pong) (WUSB1.0[7.6.7]) */ | ||
| 225 | struct wusb_dn_alive { | ||
| 226 | struct wusb_dn_hdr hdr; | ||
| 227 | } __attribute__((packed)); | ||
| 228 | |||
| 229 | /** Device is disconnecting (WUSB1.0[7.6.2]) */ | ||
| 230 | struct wusb_dn_disconnect { | ||
| 231 | struct wusb_dn_hdr hdr; | ||
| 232 | } __attribute__((packed)); | ||
| 233 | |||
| 234 | /* General constants */ | ||
| 235 | enum { | ||
| 236 | WUSB_TRUST_TIMEOUT_MS = 4000, /* [WUSB] section 4.15.1 */ | ||
| 237 | }; | ||
| 238 | |||
| 239 | static inline size_t ckhdid_printf(char *pr_ckhdid, size_t size, | ||
| 240 | const struct wusb_ckhdid *ckhdid) | ||
| 241 | { | ||
| 242 | return scnprintf(pr_ckhdid, size, | ||
| 243 | "%02hx %02hx %02hx %02hx %02hx %02hx %02hx %02hx " | ||
| 244 | "%02hx %02hx %02hx %02hx %02hx %02hx %02hx %02hx", | ||
| 245 | ckhdid->data[0], ckhdid->data[1], | ||
| 246 | ckhdid->data[2], ckhdid->data[3], | ||
| 247 | ckhdid->data[4], ckhdid->data[5], | ||
| 248 | ckhdid->data[6], ckhdid->data[7], | ||
| 249 | ckhdid->data[8], ckhdid->data[9], | ||
| 250 | ckhdid->data[10], ckhdid->data[11], | ||
| 251 | ckhdid->data[12], ckhdid->data[13], | ||
| 252 | ckhdid->data[14], ckhdid->data[15]); | ||
| 253 | } | ||
| 254 | |||
| 255 | /* | ||
| 256 | * WUSB Crypto stuff (WUSB1.0[6]) | ||
| 257 | */ | ||
| 258 | |||
| 259 | extern const char *wusb_et_name(u8); | ||
| 260 | |||
| 261 | /** | ||
| 262 | * WUSB key index WUSB1.0[7.3.2.4], for usage when setting keys for | ||
| 263 | * the host or the device. | ||
| 264 | */ | ||
| 265 | static inline u8 wusb_key_index(int index, int type, int originator) | ||
| 266 | { | ||
| 267 | return (originator << 6) | (type << 4) | index; | ||
| 268 | } | ||
| 269 | |||
| 270 | #define WUSB_KEY_INDEX_TYPE_PTK 0 /* for HWA only */ | ||
| 271 | #define WUSB_KEY_INDEX_TYPE_ASSOC 1 | ||
| 272 | #define WUSB_KEY_INDEX_TYPE_GTK 2 | ||
| 273 | #define WUSB_KEY_INDEX_ORIGINATOR_HOST 0 | ||
| 274 | #define WUSB_KEY_INDEX_ORIGINATOR_DEVICE 1 | ||
| 275 | |||
| 276 | /* A CCM Nonce, defined in WUSB1.0[6.4.1] */ | ||
| 277 | struct aes_ccm_nonce { | ||
| 278 | u8 sfn[6]; /* Little Endian */ | ||
| 279 | u8 tkid[3]; /* LE */ | ||
| 280 | struct uwb_dev_addr dest_addr; | ||
| 281 | struct uwb_dev_addr src_addr; | ||
| 282 | } __attribute__((packed)); | ||
| 283 | |||
| 284 | /* A CCM operation label, defined on WUSB1.0[6.5.x] */ | ||
| 285 | struct aes_ccm_label { | ||
| 286 | u8 data[14]; | ||
| 287 | } __attribute__((packed)); | ||
| 288 | |||
| 289 | /* | ||
| 290 | * Input to the key derivation sequence defined in | ||
| 291 | * WUSB1.0[6.5.1]. Rest of the data is in the CCM Nonce passed to the | ||
| 292 | * PRF function. | ||
| 293 | */ | ||
| 294 | struct wusb_keydvt_in { | ||
| 295 | u8 hnonce[16]; | ||
| 296 | u8 dnonce[16]; | ||
| 297 | } __attribute__((packed)); | ||
| 298 | |||
| 299 | /* | ||
| 300 | * Output from the key derivation sequence defined in | ||
| 301 | * WUSB1.0[6.5.1]. | ||
| 302 | */ | ||
| 303 | struct wusb_keydvt_out { | ||
| 304 | u8 kck[16]; | ||
| 305 | u8 ptk[16]; | ||
| 306 | } __attribute__((packed)); | ||
| 307 | |||
| 308 | /* Pseudo Random Function WUSB1.0[6.5] */ | ||
| 309 | extern int wusb_crypto_init(void); | ||
| 310 | extern void wusb_crypto_exit(void); | ||
| 311 | extern ssize_t wusb_prf(void *out, size_t out_size, | ||
| 312 | const u8 key[16], const struct aes_ccm_nonce *_n, | ||
| 313 | const struct aes_ccm_label *a, | ||
| 314 | const void *b, size_t blen, size_t len); | ||
| 315 | |||
| 316 | static inline int wusb_prf_64(void *out, size_t out_size, const u8 key[16], | ||
| 317 | const struct aes_ccm_nonce *n, | ||
| 318 | const struct aes_ccm_label *a, | ||
| 319 | const void *b, size_t blen) | ||
| 320 | { | ||
| 321 | return wusb_prf(out, out_size, key, n, a, b, blen, 64); | ||
| 322 | } | ||
| 323 | |||
| 324 | static inline int wusb_prf_128(void *out, size_t out_size, const u8 key[16], | ||
| 325 | const struct aes_ccm_nonce *n, | ||
| 326 | const struct aes_ccm_label *a, | ||
| 327 | const void *b, size_t blen) | ||
| 328 | { | ||
| 329 | return wusb_prf(out, out_size, key, n, a, b, blen, 128); | ||
| 330 | } | ||
| 331 | |||
| 332 | static inline int wusb_prf_256(void *out, size_t out_size, const u8 key[16], | ||
| 333 | const struct aes_ccm_nonce *n, | ||
| 334 | const struct aes_ccm_label *a, | ||
| 335 | const void *b, size_t blen) | ||
| 336 | { | ||
| 337 | return wusb_prf(out, out_size, key, n, a, b, blen, 256); | ||
| 338 | } | ||
| 339 | |||
| 340 | /* Key derivation WUSB1.0[6.5.1] */ | ||
| 341 | static inline int wusb_key_derive(struct wusb_keydvt_out *keydvt_out, | ||
| 342 | const u8 key[16], | ||
| 343 | const struct aes_ccm_nonce *n, | ||
| 344 | const struct wusb_keydvt_in *keydvt_in) | ||
| 345 | { | ||
| 346 | const struct aes_ccm_label a = { .data = "Pair-wise keys" }; | ||
| 347 | return wusb_prf_256(keydvt_out, sizeof(*keydvt_out), key, n, &a, | ||
| 348 | keydvt_in, sizeof(*keydvt_in)); | ||
| 349 | } | ||
| 350 | |||
| 351 | /* | ||
| 352 | * Out-of-band MIC Generation WUSB1.0[6.5.2] | ||
| 353 | * | ||
| 354 | * Compute the MIC over @key, @n and @hs and place it in @mic_out. | ||
| 355 | * | ||
| 356 | * @mic_out: Where to place the 8 byte MIC tag | ||
| 357 | * @key: KCK from the derivation process | ||
| 358 | * @n: CCM nonce, n->sfn == 0, TKID as established in the | ||
| 359 | * process. | ||
| 360 | * @hs: Handshake struct for phase 2 of the 4-way. | ||
| 361 | * hs->bStatus and hs->bReserved are zero. | ||
| 362 | * hs->bMessageNumber is 2 (WUSB1.0[7.3.2.5.2] | ||
| 363 | * hs->dest_addr is the device's USB address padded with 0 | ||
| 364 | * hs->src_addr is the hosts's UWB device address | ||
| 365 | * hs->mic is ignored (as we compute that value). | ||
| 366 | */ | ||
| 367 | static inline int wusb_oob_mic(u8 mic_out[8], const u8 key[16], | ||
| 368 | const struct aes_ccm_nonce *n, | ||
| 369 | const struct usb_handshake *hs) | ||
| 370 | { | ||
| 371 | const struct aes_ccm_label a = { .data = "out-of-bandMIC" }; | ||
| 372 | return wusb_prf_64(mic_out, 8, key, n, &a, | ||
| 373 | hs, sizeof(*hs) - sizeof(hs->MIC)); | ||
| 374 | } | ||
| 375 | |||
| 376 | #endif /* #ifndef __WUSB_H__ */ | ||
diff --git a/include/linux/uwb.h b/include/linux/uwb.h new file mode 100644 index 000000000000..f9ccbd9a2ced --- /dev/null +++ b/include/linux/uwb.h | |||
| @@ -0,0 +1,765 @@ | |||
| 1 | /* | ||
| 2 | * Ultra Wide Band | ||
| 3 | * UWB API | ||
| 4 | * | ||
| 5 | * Copyright (C) 2005-2006 Intel Corporation | ||
| 6 | * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com> | ||
| 7 | * | ||
| 8 | * This program is free software; you can redistribute it and/or | ||
| 9 | * modify it under the terms of the GNU General Public License version | ||
| 10 | * 2 as published by the Free Software Foundation. | ||
| 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., 51 Franklin Street, Fifth Floor, Boston, MA | ||
| 20 | * 02110-1301, USA. | ||
| 21 | * | ||
| 22 | * | ||
| 23 | * FIXME: doc: overview of the API, different parts and pointers | ||
| 24 | */ | ||
| 25 | |||
| 26 | #ifndef __LINUX__UWB_H__ | ||
| 27 | #define __LINUX__UWB_H__ | ||
| 28 | |||
| 29 | #include <linux/limits.h> | ||
| 30 | #include <linux/device.h> | ||
| 31 | #include <linux/mutex.h> | ||
| 32 | #include <linux/timer.h> | ||
| 33 | #include <linux/workqueue.h> | ||
| 34 | #include <linux/uwb/spec.h> | ||
| 35 | |||
| 36 | struct uwb_dev; | ||
| 37 | struct uwb_beca_e; | ||
| 38 | struct uwb_rc; | ||
| 39 | struct uwb_rsv; | ||
| 40 | struct uwb_dbg; | ||
| 41 | |||
| 42 | /** | ||
| 43 | * struct uwb_dev - a UWB Device | ||
| 44 | * @rc: UWB Radio Controller that discovered the device (kind of its | ||
| 45 | * parent). | ||
| 46 | * @bce: a beacon cache entry for this device; or NULL if the device | ||
| 47 | * is a local radio controller. | ||
| 48 | * @mac_addr: the EUI-48 address of this device. | ||
| 49 | * @dev_addr: the current DevAddr used by this device. | ||
| 50 | * @beacon_slot: the slot number the beacon is using. | ||
| 51 | * @streams: bitmap of streams allocated to reservations targeted at | ||
| 52 | * this device. For an RC, this is the streams allocated for | ||
| 53 | * reservations targeted at DevAddrs. | ||
| 54 | * | ||
| 55 | * A UWB device may either by a neighbor or part of a local radio | ||
| 56 | * controller. | ||
| 57 | */ | ||
| 58 | struct uwb_dev { | ||
| 59 | struct mutex mutex; | ||
| 60 | struct list_head list_node; | ||
| 61 | struct device dev; | ||
| 62 | struct uwb_rc *rc; /* radio controller */ | ||
| 63 | struct uwb_beca_e *bce; /* Beacon Cache Entry */ | ||
| 64 | |||
| 65 | struct uwb_mac_addr mac_addr; | ||
| 66 | struct uwb_dev_addr dev_addr; | ||
| 67 | int beacon_slot; | ||
| 68 | DECLARE_BITMAP(streams, UWB_NUM_STREAMS); | ||
| 69 | }; | ||
| 70 | #define to_uwb_dev(d) container_of(d, struct uwb_dev, dev) | ||
| 71 | |||
| 72 | /** | ||
| 73 | * UWB HWA/WHCI Radio Control {Command|Event} Block context IDs | ||
| 74 | * | ||
| 75 | * RC[CE]Bs have a 'context ID' field that matches the command with | ||
| 76 | * the event received to confirm it. | ||
| 77 | * | ||
| 78 | * Maximum number of context IDs | ||
| 79 | */ | ||
| 80 | enum { UWB_RC_CTX_MAX = 256 }; | ||
| 81 | |||
| 82 | |||
| 83 | /** Notification chain head for UWB generated events to listeners */ | ||
| 84 | struct uwb_notifs_chain { | ||
| 85 | struct list_head list; | ||
| 86 | struct mutex mutex; | ||
| 87 | }; | ||
| 88 | |||
| 89 | /** | ||
| 90 | * struct uwb_mas_bm - a bitmap of all MAS in a superframe | ||
| 91 | * @bm: a bitmap of length #UWB_NUM_MAS | ||
| 92 | */ | ||
| 93 | struct uwb_mas_bm { | ||
| 94 | DECLARE_BITMAP(bm, UWB_NUM_MAS); | ||
| 95 | }; | ||
| 96 | |||
| 97 | /** | ||
| 98 | * uwb_rsv_state - UWB Reservation state. | ||
| 99 | * | ||
| 100 | * NONE - reservation is not active (no DRP IE being transmitted). | ||
| 101 | * | ||
| 102 | * Owner reservation states: | ||
| 103 | * | ||
| 104 | * INITIATED - owner has sent an initial DRP request. | ||
| 105 | * PENDING - target responded with pending Reason Code. | ||
| 106 | * MODIFIED - reservation manager is modifying an established | ||
| 107 | * reservation with a different MAS allocation. | ||
| 108 | * ESTABLISHED - the reservation has been successfully negotiated. | ||
| 109 | * | ||
| 110 | * Target reservation states: | ||
| 111 | * | ||
| 112 | * DENIED - request is denied. | ||
| 113 | * ACCEPTED - request is accepted. | ||
| 114 | * PENDING - PAL has yet to make a decision to whether to accept or | ||
| 115 | * deny. | ||
| 116 | * | ||
| 117 | * FIXME: further target states TBD. | ||
| 118 | */ | ||
| 119 | enum uwb_rsv_state { | ||
| 120 | UWB_RSV_STATE_NONE, | ||
| 121 | UWB_RSV_STATE_O_INITIATED, | ||
| 122 | UWB_RSV_STATE_O_PENDING, | ||
| 123 | UWB_RSV_STATE_O_MODIFIED, | ||
| 124 | UWB_RSV_STATE_O_ESTABLISHED, | ||
| 125 | UWB_RSV_STATE_T_ACCEPTED, | ||
| 126 | UWB_RSV_STATE_T_DENIED, | ||
| 127 | UWB_RSV_STATE_T_PENDING, | ||
| 128 | |||
| 129 | UWB_RSV_STATE_LAST, | ||
| 130 | }; | ||
| 131 | |||
| 132 | enum uwb_rsv_target_type { | ||
| 133 | UWB_RSV_TARGET_DEV, | ||
| 134 | UWB_RSV_TARGET_DEVADDR, | ||
| 135 | }; | ||
| 136 | |||
| 137 | /** | ||
| 138 | * struct uwb_rsv_target - the target of a reservation. | ||
| 139 | * | ||
| 140 | * Reservations unicast and targeted at a single device | ||
| 141 | * (UWB_RSV_TARGET_DEV); or (e.g., in the case of WUSB) targeted at a | ||
| 142 | * specific (private) DevAddr (UWB_RSV_TARGET_DEVADDR). | ||
| 143 | */ | ||
| 144 | struct uwb_rsv_target { | ||
| 145 | enum uwb_rsv_target_type type; | ||
| 146 | union { | ||
| 147 | struct uwb_dev *dev; | ||
| 148 | struct uwb_dev_addr devaddr; | ||
| 149 | }; | ||
| 150 | }; | ||
| 151 | |||
| 152 | /* | ||
| 153 | * Number of streams reserved for reservations targeted at DevAddrs. | ||
| 154 | */ | ||
| 155 | #define UWB_NUM_GLOBAL_STREAMS 1 | ||
| 156 | |||
| 157 | typedef void (*uwb_rsv_cb_f)(struct uwb_rsv *rsv); | ||
| 158 | |||
| 159 | /** | ||
| 160 | * struct uwb_rsv - a DRP reservation | ||
| 161 | * | ||
| 162 | * Data structure management: | ||
| 163 | * | ||
| 164 | * @rc: the radio controller this reservation is for | ||
| 165 | * (as target or owner) | ||
| 166 | * @rc_node: a list node for the RC | ||
| 167 | * @pal_node: a list node for the PAL | ||
| 168 | * | ||
| 169 | * Owner and target parameters: | ||
| 170 | * | ||
| 171 | * @owner: the UWB device owning this reservation | ||
| 172 | * @target: the target UWB device | ||
| 173 | * @type: reservation type | ||
| 174 | * | ||
| 175 | * Owner parameters: | ||
| 176 | * | ||
| 177 | * @max_mas: maxiumum number of MAS | ||
| 178 | * @min_mas: minimum number of MAS | ||
| 179 | * @sparsity: owner selected sparsity | ||
| 180 | * @is_multicast: true iff multicast | ||
| 181 | * | ||
| 182 | * @callback: callback function when the reservation completes | ||
| 183 | * @pal_priv: private data for the PAL making the reservation | ||
| 184 | * | ||
| 185 | * Reservation status: | ||
| 186 | * | ||
| 187 | * @status: negotiation status | ||
| 188 | * @stream: stream index allocated for this reservation | ||
| 189 | * @mas: reserved MAS | ||
| 190 | * @drp_ie: the DRP IE | ||
| 191 | * @ie_valid: true iff the DRP IE matches the reservation parameters | ||
| 192 | * | ||
| 193 | * DRP reservations are uniquely identified by the owner, target and | ||
| 194 | * stream index. However, when using a DevAddr as a target (e.g., for | ||
| 195 | * a WUSB cluster reservation) the responses may be received from | ||
| 196 | * devices with different DevAddrs. In this case, reservations are | ||
| 197 | * uniquely identified by just the stream index. A number of stream | ||
| 198 | * indexes (UWB_NUM_GLOBAL_STREAMS) are reserved for this. | ||
| 199 | */ | ||
| 200 | struct uwb_rsv { | ||
| 201 | struct uwb_rc *rc; | ||
| 202 | struct list_head rc_node; | ||
| 203 | struct list_head pal_node; | ||
| 204 | |||
| 205 | struct uwb_dev *owner; | ||
| 206 | struct uwb_rsv_target target; | ||
| 207 | enum uwb_drp_type type; | ||
| 208 | int max_mas; | ||
| 209 | int min_mas; | ||
| 210 | int sparsity; | ||
| 211 | bool is_multicast; | ||
| 212 | |||
| 213 | uwb_rsv_cb_f callback; | ||
| 214 | void *pal_priv; | ||
| 215 | |||
| 216 | enum uwb_rsv_state state; | ||
| 217 | u8 stream; | ||
| 218 | struct uwb_mas_bm mas; | ||
| 219 | struct uwb_ie_drp *drp_ie; | ||
| 220 | bool ie_valid; | ||
| 221 | struct timer_list timer; | ||
| 222 | bool expired; | ||
| 223 | }; | ||
| 224 | |||
| 225 | static const | ||
| 226 | struct uwb_mas_bm uwb_mas_bm_zero = { .bm = { 0 } }; | ||
| 227 | |||
| 228 | static inline void uwb_mas_bm_copy_le(void *dst, const struct uwb_mas_bm *mas) | ||
| 229 | { | ||
| 230 | bitmap_copy_le(dst, mas->bm, UWB_NUM_MAS); | ||
| 231 | } | ||
| 232 | |||
| 233 | /** | ||
| 234 | * struct uwb_drp_avail - a radio controller's view of MAS usage | ||
| 235 | * @global: MAS unused by neighbors (excluding reservations targetted | ||
| 236 | * or owned by the local radio controller) or the beaon period | ||
| 237 | * @local: MAS unused by local established reservations | ||
| 238 | * @pending: MAS unused by local pending reservations | ||
| 239 | * @ie: DRP Availability IE to be included in the beacon | ||
| 240 | * @ie_valid: true iff @ie is valid and does not need to regenerated from | ||
| 241 | * @global and @local | ||
| 242 | * | ||
| 243 | * Each radio controller maintains a view of MAS usage or | ||
| 244 | * availability. MAS available for a new reservation are determined | ||
| 245 | * from the intersection of @global, @local, and @pending. | ||
| 246 | * | ||
| 247 | * The radio controller must transmit a DRP Availability IE that's the | ||
| 248 | * intersection of @global and @local. | ||
| 249 | * | ||
| 250 | * A set bit indicates the MAS is unused and available. | ||
| 251 | * | ||
| 252 | * rc->rsvs_mutex should be held before accessing this data structure. | ||
| 253 | * | ||
| 254 | * [ECMA-368] section 17.4.3. | ||
| 255 | */ | ||
| 256 | struct uwb_drp_avail { | ||
| 257 | DECLARE_BITMAP(global, UWB_NUM_MAS); | ||
| 258 | DECLARE_BITMAP(local, UWB_NUM_MAS); | ||
| 259 | DECLARE_BITMAP(pending, UWB_NUM_MAS); | ||
| 260 | struct uwb_ie_drp_avail ie; | ||
| 261 | bool ie_valid; | ||
| 262 | }; | ||
| 263 | |||
| 264 | |||
| 265 | const char *uwb_rsv_state_str(enum uwb_rsv_state state); | ||
| 266 | const char *uwb_rsv_type_str(enum uwb_drp_type type); | ||
| 267 | |||
| 268 | struct uwb_rsv *uwb_rsv_create(struct uwb_rc *rc, uwb_rsv_cb_f cb, | ||
| 269 | void *pal_priv); | ||
| 270 | void uwb_rsv_destroy(struct uwb_rsv *rsv); | ||
| 271 | |||
| 272 | int uwb_rsv_establish(struct uwb_rsv *rsv); | ||
| 273 | int uwb_rsv_modify(struct uwb_rsv *rsv, | ||
| 274 | int max_mas, int min_mas, int sparsity); | ||
| 275 | void uwb_rsv_terminate(struct uwb_rsv *rsv); | ||
| 276 | |||
| 277 | void uwb_rsv_accept(struct uwb_rsv *rsv, uwb_rsv_cb_f cb, void *pal_priv); | ||
| 278 | |||
| 279 | /** | ||
| 280 | * Radio Control Interface instance | ||
| 281 | * | ||
| 282 | * | ||
| 283 | * Life cycle rules: those of the UWB Device. | ||
| 284 | * | ||
| 285 | * @index: an index number for this radio controller, as used in the | ||
| 286 | * device name. | ||
| 287 | * @version: version of protocol supported by this device | ||
| 288 | * @priv: Backend implementation; rw with uwb_dev.dev.sem taken. | ||
| 289 | * @cmd: Backend implementation to execute commands; rw and call | ||
| 290 | * only with uwb_dev.dev.sem taken. | ||
| 291 | * @reset: Hardware reset of radio controller and any PAL controllers. | ||
| 292 | * @filter: Backend implementation to manipulate data to and from device | ||
| 293 | * to be compliant to specification assumed by driver (WHCI | ||
| 294 | * 0.95). | ||
| 295 | * | ||
| 296 | * uwb_dev.dev.mutex is used to execute commands and update | ||
| 297 | * the corresponding structures; can't use a spinlock | ||
| 298 | * because rc->cmd() can sleep. | ||
| 299 | * @ies: This is a dynamically allocated array cacheing the | ||
| 300 | * IEs (settable by the host) that the beacon of this | ||
| 301 | * radio controller is currently sending. | ||
| 302 | * | ||
| 303 | * In reality, we store here the full command we set to | ||
| 304 | * the radio controller (which is basically a command | ||
| 305 | * prefix followed by all the IEs the beacon currently | ||
| 306 | * contains). This way we don't have to realloc and | ||
| 307 | * memcpy when setting it. | ||
| 308 | * | ||
| 309 | * We set this up in uwb_rc_ie_setup(), where we alloc | ||
| 310 | * this struct, call get_ie() [so we know which IEs are | ||
| 311 | * currently being sent, if any]. | ||
| 312 | * | ||
| 313 | * @ies_capacity:Amount of space (in bytes) allocated in @ies. The | ||
| 314 | * amount used is given by sizeof(*ies) plus ies->wIELength | ||
| 315 | * (which is a little endian quantity all the time). | ||
| 316 | * @ies_mutex: protect the IE cache | ||
| 317 | * @dbg: information for the debug interface | ||
| 318 | */ | ||
| 319 | struct uwb_rc { | ||
| 320 | struct uwb_dev uwb_dev; | ||
| 321 | int index; | ||
| 322 | u16 version; | ||
| 323 | |||
| 324 | struct module *owner; | ||
| 325 | void *priv; | ||
| 326 | int (*start)(struct uwb_rc *rc); | ||
| 327 | void (*stop)(struct uwb_rc *rc); | ||
| 328 | int (*cmd)(struct uwb_rc *, const struct uwb_rccb *, size_t); | ||
| 329 | int (*reset)(struct uwb_rc *rc); | ||
| 330 | int (*filter_cmd)(struct uwb_rc *, struct uwb_rccb **, size_t *); | ||
| 331 | int (*filter_event)(struct uwb_rc *, struct uwb_rceb **, const size_t, | ||
| 332 | size_t *, size_t *); | ||
| 333 | |||
| 334 | spinlock_t neh_lock; /* protects neh_* and ctx_* */ | ||
| 335 | struct list_head neh_list; /* Open NE handles */ | ||
| 336 | unsigned long ctx_bm[UWB_RC_CTX_MAX / 8 / sizeof(unsigned long)]; | ||
| 337 | u8 ctx_roll; | ||
| 338 | |||
| 339 | int beaconing; /* Beaconing state [channel number] */ | ||
| 340 | int scanning; | ||
| 341 | enum uwb_scan_type scan_type:3; | ||
| 342 | unsigned ready:1; | ||
| 343 | struct uwb_notifs_chain notifs_chain; | ||
| 344 | |||
| 345 | struct uwb_drp_avail drp_avail; | ||
| 346 | struct list_head reservations; | ||
| 347 | struct mutex rsvs_mutex; | ||
| 348 | struct workqueue_struct *rsv_workq; | ||
| 349 | struct work_struct rsv_update_work; | ||
| 350 | |||
| 351 | struct mutex ies_mutex; | ||
| 352 | struct uwb_rc_cmd_set_ie *ies; | ||
| 353 | size_t ies_capacity; | ||
| 354 | |||
| 355 | spinlock_t pal_lock; | ||
| 356 | struct list_head pals; | ||
| 357 | |||
| 358 | struct uwb_dbg *dbg; | ||
| 359 | }; | ||
| 360 | |||
| 361 | |||
| 362 | /** | ||
| 363 | * struct uwb_pal - a UWB PAL | ||
| 364 | * @name: descriptive name for this PAL (wushc, wlp, etc.). | ||
| 365 | * @device: a device for the PAL. Used to link the PAL and the radio | ||
| 366 | * controller in sysfs. | ||
| 367 | * @new_rsv: called when a peer requests a reservation (may be NULL if | ||
| 368 | * the PAL cannot accept reservation requests). | ||
| 369 | * | ||
| 370 | * A Protocol Adaptation Layer (PAL) is a user of the WiMedia UWB | ||
| 371 | * radio platform (e.g., WUSB, WLP or Bluetooth UWB AMP). | ||
| 372 | * | ||
| 373 | * The PALs using a radio controller must register themselves to | ||
| 374 | * permit the UWB stack to coordinate usage of the radio between the | ||
| 375 | * various PALs or to allow PALs to response to certain requests from | ||
| 376 | * peers. | ||
| 377 | * | ||
| 378 | * A struct uwb_pal should be embedded in a containing structure | ||
| 379 | * belonging to the PAL and initialized with uwb_pal_init()). Fields | ||
| 380 | * should be set appropriately by the PAL before registering the PAL | ||
| 381 | * with uwb_pal_register(). | ||
| 382 | */ | ||
| 383 | struct uwb_pal { | ||
| 384 | struct list_head node; | ||
| 385 | const char *name; | ||
| 386 | struct device *device; | ||
| 387 | void (*new_rsv)(struct uwb_rsv *rsv); | ||
| 388 | }; | ||
| 389 | |||
| 390 | void uwb_pal_init(struct uwb_pal *pal); | ||
| 391 | int uwb_pal_register(struct uwb_rc *rc, struct uwb_pal *pal); | ||
| 392 | void uwb_pal_unregister(struct uwb_rc *rc, struct uwb_pal *pal); | ||
| 393 | |||
| 394 | /* | ||
| 395 | * General public API | ||
| 396 | * | ||
| 397 | * This API can be used by UWB device drivers or by those implementing | ||
| 398 | * UWB Radio Controllers | ||
| 399 | */ | ||
| 400 | struct uwb_dev *uwb_dev_get_by_devaddr(struct uwb_rc *rc, | ||
| 401 | const struct uwb_dev_addr *devaddr); | ||
| 402 | struct uwb_dev *uwb_dev_get_by_rc(struct uwb_dev *, struct uwb_rc *); | ||
| 403 | static inline void uwb_dev_get(struct uwb_dev *uwb_dev) | ||
| 404 | { | ||
| 405 | get_device(&uwb_dev->dev); | ||
| 406 | } | ||
| 407 | static inline void uwb_dev_put(struct uwb_dev *uwb_dev) | ||
| 408 | { | ||
| 409 | put_device(&uwb_dev->dev); | ||
| 410 | } | ||
| 411 | struct uwb_dev *uwb_dev_try_get(struct uwb_rc *rc, struct uwb_dev *uwb_dev); | ||
| 412 | |||
| 413 | /** | ||
| 414 | * Callback function for 'uwb_{dev,rc}_foreach()'. | ||
| 415 | * | ||
| 416 | * @dev: Linux device instance | ||
| 417 | * 'uwb_dev = container_of(dev, struct uwb_dev, dev)' | ||
| 418 | * @priv: Data passed by the caller to 'uwb_{dev,rc}_foreach()'. | ||
| 419 | * | ||
| 420 | * @returns: 0 to continue the iterations, any other val to stop | ||
| 421 | * iterating and return the value to the caller of | ||
| 422 | * _foreach(). | ||
| 423 | */ | ||
| 424 | typedef int (*uwb_dev_for_each_f)(struct device *dev, void *priv); | ||
| 425 | int uwb_dev_for_each(struct uwb_rc *rc, uwb_dev_for_each_f func, void *priv); | ||
| 426 | |||
| 427 | struct uwb_rc *uwb_rc_alloc(void); | ||
| 428 | struct uwb_rc *uwb_rc_get_by_dev(const struct uwb_dev_addr *); | ||
| 429 | struct uwb_rc *uwb_rc_get_by_grandpa(const struct device *); | ||
| 430 | void uwb_rc_put(struct uwb_rc *rc); | ||
| 431 | |||
| 432 | typedef void (*uwb_rc_cmd_cb_f)(struct uwb_rc *rc, void *arg, | ||
| 433 | struct uwb_rceb *reply, ssize_t reply_size); | ||
| 434 | |||
| 435 | int uwb_rc_cmd_async(struct uwb_rc *rc, const char *cmd_name, | ||
| 436 | struct uwb_rccb *cmd, size_t cmd_size, | ||
| 437 | u8 expected_type, u16 expected_event, | ||
| 438 | uwb_rc_cmd_cb_f cb, void *arg); | ||
| 439 | ssize_t uwb_rc_cmd(struct uwb_rc *rc, const char *cmd_name, | ||
| 440 | struct uwb_rccb *cmd, size_t cmd_size, | ||
| 441 | struct uwb_rceb *reply, size_t reply_size); | ||
| 442 | ssize_t uwb_rc_vcmd(struct uwb_rc *rc, const char *cmd_name, | ||
| 443 | struct uwb_rccb *cmd, size_t cmd_size, | ||
| 444 | u8 expected_type, u16 expected_event, | ||
| 445 | struct uwb_rceb **preply); | ||
| 446 | ssize_t uwb_rc_get_ie(struct uwb_rc *, struct uwb_rc_evt_get_ie **); | ||
| 447 | int uwb_bg_joined(struct uwb_rc *rc); | ||
| 448 | |||
| 449 | size_t __uwb_addr_print(char *, size_t, const unsigned char *, int); | ||
| 450 | |||
| 451 | int uwb_rc_dev_addr_set(struct uwb_rc *, const struct uwb_dev_addr *); | ||
| 452 | int uwb_rc_dev_addr_get(struct uwb_rc *, struct uwb_dev_addr *); | ||
| 453 | int uwb_rc_mac_addr_set(struct uwb_rc *, const struct uwb_mac_addr *); | ||
| 454 | int uwb_rc_mac_addr_get(struct uwb_rc *, struct uwb_mac_addr *); | ||
| 455 | int __uwb_mac_addr_assigned_check(struct device *, void *); | ||
| 456 | int __uwb_dev_addr_assigned_check(struct device *, void *); | ||
| 457 | |||
| 458 | /* Print in @buf a pretty repr of @addr */ | ||
| 459 | static inline size_t uwb_dev_addr_print(char *buf, size_t buf_size, | ||
| 460 | const struct uwb_dev_addr *addr) | ||
| 461 | { | ||
| 462 | return __uwb_addr_print(buf, buf_size, addr->data, 0); | ||
| 463 | } | ||
| 464 | |||
| 465 | /* Print in @buf a pretty repr of @addr */ | ||
| 466 | static inline size_t uwb_mac_addr_print(char *buf, size_t buf_size, | ||
| 467 | const struct uwb_mac_addr *addr) | ||
| 468 | { | ||
| 469 | return __uwb_addr_print(buf, buf_size, addr->data, 1); | ||
| 470 | } | ||
| 471 | |||
| 472 | /* @returns 0 if device addresses @addr2 and @addr1 are equal */ | ||
| 473 | static inline int uwb_dev_addr_cmp(const struct uwb_dev_addr *addr1, | ||
| 474 | const struct uwb_dev_addr *addr2) | ||
| 475 | { | ||
| 476 | return memcmp(addr1, addr2, sizeof(*addr1)); | ||
| 477 | } | ||
| 478 | |||
| 479 | /* @returns 0 if MAC addresses @addr2 and @addr1 are equal */ | ||
| 480 | static inline int uwb_mac_addr_cmp(const struct uwb_mac_addr *addr1, | ||
| 481 | const struct uwb_mac_addr *addr2) | ||
| 482 | { | ||
| 483 | return memcmp(addr1, addr2, sizeof(*addr1)); | ||
| 484 | } | ||
| 485 | |||
| 486 | /* @returns !0 if a MAC @addr is a broadcast address */ | ||
| 487 | static inline int uwb_mac_addr_bcast(const struct uwb_mac_addr *addr) | ||
| 488 | { | ||
| 489 | struct uwb_mac_addr bcast = { | ||
| 490 | .data = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } | ||
| 491 | }; | ||
| 492 | return !uwb_mac_addr_cmp(addr, &bcast); | ||
| 493 | } | ||
| 494 | |||
| 495 | /* @returns !0 if a MAC @addr is all zeroes*/ | ||
| 496 | static inline int uwb_mac_addr_unset(const struct uwb_mac_addr *addr) | ||
| 497 | { | ||
| 498 | struct uwb_mac_addr unset = { | ||
| 499 | .data = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } | ||
| 500 | }; | ||
| 501 | return !uwb_mac_addr_cmp(addr, &unset); | ||
| 502 | } | ||
| 503 | |||
| 504 | /* @returns !0 if the address is in use. */ | ||
| 505 | static inline unsigned __uwb_dev_addr_assigned(struct uwb_rc *rc, | ||
| 506 | struct uwb_dev_addr *addr) | ||
| 507 | { | ||
| 508 | return uwb_dev_for_each(rc, __uwb_dev_addr_assigned_check, addr); | ||
| 509 | } | ||
| 510 | |||
| 511 | /* | ||
| 512 | * UWB Radio Controller API | ||
| 513 | * | ||
| 514 | * This API is used (in addition to the general API) to implement UWB | ||
| 515 | * Radio Controllers. | ||
| 516 | */ | ||
| 517 | void uwb_rc_init(struct uwb_rc *); | ||
| 518 | int uwb_rc_add(struct uwb_rc *, struct device *dev, void *rc_priv); | ||
| 519 | void uwb_rc_rm(struct uwb_rc *); | ||
| 520 | void uwb_rc_neh_grok(struct uwb_rc *, void *, size_t); | ||
| 521 | void uwb_rc_neh_error(struct uwb_rc *, int); | ||
| 522 | void uwb_rc_reset_all(struct uwb_rc *rc); | ||
| 523 | |||
| 524 | /** | ||
| 525 | * uwb_rsv_is_owner - is the owner of this reservation the RC? | ||
| 526 | * @rsv: the reservation | ||
| 527 | */ | ||
| 528 | static inline bool uwb_rsv_is_owner(struct uwb_rsv *rsv) | ||
| 529 | { | ||
| 530 | return rsv->owner == &rsv->rc->uwb_dev; | ||
| 531 | } | ||
| 532 | |||
| 533 | /** | ||
| 534 | * Events generated by UWB that can be passed to any listeners | ||
| 535 | * | ||
| 536 | * Higher layers can register callback functions with the radio | ||
| 537 | * controller using uwb_notifs_register(). The radio controller | ||
| 538 | * maintains a list of all registered handlers and will notify all | ||
| 539 | * nodes when an event occurs. | ||
| 540 | */ | ||
| 541 | enum uwb_notifs { | ||
| 542 | UWB_NOTIF_BG_JOIN = 0, /* radio controller joined a beacon group */ | ||
| 543 | UWB_NOTIF_BG_LEAVE = 1, /* radio controller left a beacon group */ | ||
| 544 | UWB_NOTIF_ONAIR, | ||
| 545 | UWB_NOTIF_OFFAIR, | ||
| 546 | }; | ||
| 547 | |||
| 548 | /* Callback function registered with UWB */ | ||
| 549 | struct uwb_notifs_handler { | ||
| 550 | struct list_head list_node; | ||
| 551 | void (*cb)(void *, struct uwb_dev *, enum uwb_notifs); | ||
| 552 | void *data; | ||
| 553 | }; | ||
| 554 | |||
| 555 | int uwb_notifs_register(struct uwb_rc *, struct uwb_notifs_handler *); | ||
| 556 | int uwb_notifs_deregister(struct uwb_rc *, struct uwb_notifs_handler *); | ||
| 557 | |||
| 558 | |||
| 559 | /** | ||
| 560 | * UWB radio controller Event Size Entry (for creating entry tables) | ||
| 561 | * | ||
| 562 | * WUSB and WHCI define events and notifications, and they might have | ||
| 563 | * fixed or variable size. | ||
| 564 | * | ||
| 565 | * Each event/notification has a size which is not necessarily known | ||
| 566 | * in advance based on the event code. As well, vendor specific | ||
| 567 | * events/notifications will have a size impossible to determine | ||
| 568 | * unless we know about the device's specific details. | ||
| 569 | * | ||
| 570 | * It was way too smart of the spec writers not to think that it would | ||
| 571 | * be impossible for a generic driver to skip over vendor specific | ||
| 572 | * events/notifications if there are no LENGTH fields in the HEADER of | ||
| 573 | * each message...the transaction size cannot be counted on as the | ||
| 574 | * spec does not forbid to pack more than one event in a single | ||
| 575 | * transaction. | ||
| 576 | * | ||
| 577 | * Thus, we guess sizes with tables (or for events, when you know the | ||
| 578 | * size ahead of time you can use uwb_rc_neh_extra_size*()). We | ||
| 579 | * register tables with the known events and their sizes, and then we | ||
| 580 | * traverse those tables. For those with variable length, we provide a | ||
| 581 | * way to lookup the size inside the event/notification's | ||
| 582 | * payload. This allows device-specific event size tables to be | ||
| 583 | * registered. | ||
| 584 | * | ||
| 585 | * @size: Size of the payload | ||
| 586 | * | ||
| 587 | * @offset: if != 0, at offset @offset-1 starts a field with a length | ||
| 588 | * that has to be added to @size. The format of the field is | ||
| 589 | * given by @type. | ||
| 590 | * | ||
| 591 | * @type: Type and length of the offset field. Most common is LE 16 | ||
| 592 | * bits (that's why that is zero); others are there mostly to | ||
| 593 | * cover for bugs and weirdos. | ||
| 594 | */ | ||
| 595 | struct uwb_est_entry { | ||
| 596 | size_t size; | ||
| 597 | unsigned offset; | ||
| 598 | enum { UWB_EST_16 = 0, UWB_EST_8 = 1 } type; | ||
| 599 | }; | ||
| 600 | |||
| 601 | int uwb_est_register(u8 type, u8 code_high, u16 vendor, u16 product, | ||
| 602 | const struct uwb_est_entry *, size_t entries); | ||
| 603 | int uwb_est_unregister(u8 type, u8 code_high, u16 vendor, u16 product, | ||
| 604 | const struct uwb_est_entry *, size_t entries); | ||
| 605 | ssize_t uwb_est_find_size(struct uwb_rc *rc, const struct uwb_rceb *rceb, | ||
| 606 | size_t len); | ||
| 607 | |||
| 608 | /* -- Misc */ | ||
| 609 | |||
| 610 | enum { | ||
| 611 | EDC_MAX_ERRORS = 10, | ||
| 612 | EDC_ERROR_TIMEFRAME = HZ, | ||
| 613 | }; | ||
| 614 | |||
| 615 | /* error density counter */ | ||
| 616 | struct edc { | ||
| 617 | unsigned long timestart; | ||
| 618 | u16 errorcount; | ||
| 619 | }; | ||
| 620 | |||
| 621 | static inline | ||
| 622 | void edc_init(struct edc *edc) | ||
| 623 | { | ||
| 624 | edc->timestart = jiffies; | ||
| 625 | } | ||
| 626 | |||
| 627 | /* Called when an error occured. | ||
| 628 | * This is way to determine if the number of acceptable errors per time | ||
| 629 | * period has been exceeded. It is not accurate as there are cases in which | ||
| 630 | * this scheme will not work, for example if there are periodic occurences | ||
| 631 | * of errors that straddle updates to the start time. This scheme is | ||
| 632 | * sufficient for our usage. | ||
| 633 | * | ||
| 634 | * @returns 1 if maximum acceptable errors per timeframe has been exceeded. | ||
| 635 | */ | ||
| 636 | static inline int edc_inc(struct edc *err_hist, u16 max_err, u16 timeframe) | ||
| 637 | { | ||
| 638 | unsigned long now; | ||
| 639 | |||
| 640 | now = jiffies; | ||
| 641 | if (now - err_hist->timestart > timeframe) { | ||
| 642 | err_hist->errorcount = 1; | ||
| 643 | err_hist->timestart = now; | ||
| 644 | } else if (++err_hist->errorcount > max_err) { | ||
| 645 | err_hist->errorcount = 0; | ||
| 646 | err_hist->timestart = now; | ||
| 647 | return 1; | ||
| 648 | } | ||
| 649 | return 0; | ||
| 650 | } | ||
| 651 | |||
| 652 | |||
| 653 | /* Information Element handling */ | ||
| 654 | |||
| 655 | /* For representing the state of writing to a buffer when iterating */ | ||
| 656 | struct uwb_buf_ctx { | ||
| 657 | char *buf; | ||
| 658 | size_t bytes, size; | ||
| 659 | }; | ||
| 660 | |||
| 661 | typedef int (*uwb_ie_f)(struct uwb_dev *, const struct uwb_ie_hdr *, | ||
| 662 | size_t, void *); | ||
| 663 | struct uwb_ie_hdr *uwb_ie_next(void **ptr, size_t *len); | ||
| 664 | ssize_t uwb_ie_for_each(struct uwb_dev *uwb_dev, uwb_ie_f fn, void *data, | ||
| 665 | const void *buf, size_t size); | ||
| 666 | int uwb_ie_dump_hex(struct uwb_dev *, const struct uwb_ie_hdr *, | ||
| 667 | size_t, void *); | ||
| 668 | int uwb_rc_set_ie(struct uwb_rc *, struct uwb_rc_cmd_set_ie *); | ||
| 669 | struct uwb_ie_hdr *uwb_ie_next(void **ptr, size_t *len); | ||
| 670 | |||
| 671 | |||
| 672 | /* | ||
| 673 | * Transmission statistics | ||
| 674 | * | ||
| 675 | * UWB uses LQI and RSSI (one byte values) for reporting radio signal | ||
| 676 | * strength and line quality indication. We do quick and dirty | ||
| 677 | * averages of those. They are signed values, btw. | ||
| 678 | * | ||
| 679 | * For 8 bit quantities, we keep the min, the max, an accumulator | ||
| 680 | * (@sigma) and a # of samples. When @samples gets to 255, we compute | ||
| 681 | * the average (@sigma / @samples), place it in @sigma and reset | ||
| 682 | * @samples to 1 (so we use it as the first sample). | ||
| 683 | * | ||
| 684 | * Now, statistically speaking, probably I am kicking the kidneys of | ||
| 685 | * some books I have in my shelves collecting dust, but I just want to | ||
| 686 | * get an approx, not the Nobel. | ||
| 687 | * | ||
| 688 | * LOCKING: there is no locking per se, but we try to keep a lockless | ||
| 689 | * schema. Only _add_samples() modifies the values--as long as you | ||
| 690 | * have other locking on top that makes sure that no two calls of | ||
| 691 | * _add_sample() happen at the same time, then we are fine. Now, for | ||
| 692 | * resetting the values we just set @samples to 0 and that makes the | ||
| 693 | * next _add_sample() to start with defaults. Reading the values in | ||
| 694 | * _show() currently can race, so you need to make sure the calls are | ||
| 695 | * under the same lock that protects calls to _add_sample(). FIXME: | ||
| 696 | * currently unlocked (It is not ultraprecise but does the trick. Bite | ||
| 697 | * me). | ||
| 698 | */ | ||
| 699 | struct stats { | ||
| 700 | s8 min, max; | ||
| 701 | s16 sigma; | ||
| 702 | atomic_t samples; | ||
| 703 | }; | ||
| 704 | |||
| 705 | static inline | ||
| 706 | void stats_init(struct stats *stats) | ||
| 707 | { | ||
| 708 | atomic_set(&stats->samples, 0); | ||
| 709 | wmb(); | ||
| 710 | } | ||
| 711 | |||
| 712 | static inline | ||
| 713 | void stats_add_sample(struct stats *stats, s8 sample) | ||
| 714 | { | ||
| 715 | s8 min, max; | ||
| 716 | s16 sigma; | ||
| 717 | unsigned samples = atomic_read(&stats->samples); | ||
| 718 | if (samples == 0) { /* it was zero before, so we initialize */ | ||
| 719 | min = 127; | ||
| 720 | max = -128; | ||
| 721 | sigma = 0; | ||
| 722 | } else { | ||
| 723 | min = stats->min; | ||
| 724 | max = stats->max; | ||
| 725 | sigma = stats->sigma; | ||
| 726 | } | ||
| 727 | |||
| 728 | if (sample < min) /* compute new values */ | ||
| 729 | min = sample; | ||
| 730 | else if (sample > max) | ||
| 731 | max = sample; | ||
| 732 | sigma += sample; | ||
| 733 | |||
| 734 | stats->min = min; /* commit */ | ||
| 735 | stats->max = max; | ||
| 736 | stats->sigma = sigma; | ||
| 737 | if (atomic_add_return(1, &stats->samples) > 255) { | ||
| 738 | /* wrapped around! reset */ | ||
| 739 | stats->sigma = sigma / 256; | ||
| 740 | atomic_set(&stats->samples, 1); | ||
| 741 | } | ||
| 742 | } | ||
| 743 | |||
| 744 | static inline ssize_t stats_show(struct stats *stats, char *buf) | ||
| 745 | { | ||
| 746 | int min, max, avg; | ||
| 747 | int samples = atomic_read(&stats->samples); | ||
| 748 | if (samples == 0) | ||
| 749 | min = max = avg = 0; | ||
| 750 | else { | ||
| 751 | min = stats->min; | ||
| 752 | max = stats->max; | ||
| 753 | avg = stats->sigma / samples; | ||
| 754 | } | ||
| 755 | return scnprintf(buf, PAGE_SIZE, "%d %d %d\n", min, max, avg); | ||
| 756 | } | ||
| 757 | |||
| 758 | static inline ssize_t stats_store(struct stats *stats, const char *buf, | ||
| 759 | size_t size) | ||
| 760 | { | ||
| 761 | stats_init(stats); | ||
| 762 | return size; | ||
| 763 | } | ||
| 764 | |||
| 765 | #endif /* #ifndef __LINUX__UWB_H__ */ | ||
diff --git a/include/linux/uwb/debug-cmd.h b/include/linux/uwb/debug-cmd.h new file mode 100644 index 000000000000..1141f41bab5c --- /dev/null +++ b/include/linux/uwb/debug-cmd.h | |||
| @@ -0,0 +1,57 @@ | |||
| 1 | /* | ||
| 2 | * Ultra Wide Band | ||
| 3 | * Debug interface commands | ||
| 4 | * | ||
| 5 | * Copyright (C) 2008 Cambridge Silicon Radio Ltd. | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or | ||
| 8 | * modify it under the terms of the GNU General Public License version | ||
| 9 | * 2 as published by the Free Software Foundation. | ||
| 10 | * | ||
| 11 | * This program is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License | ||
| 17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 18 | */ | ||
| 19 | #ifndef __LINUX__UWB__DEBUG_CMD_H__ | ||
| 20 | #define __LINUX__UWB__DEBUG_CMD_H__ | ||
| 21 | |||
| 22 | #include <linux/types.h> | ||
| 23 | |||
| 24 | /* | ||
| 25 | * Debug interface commands | ||
| 26 | * | ||
| 27 | * UWB_DBG_CMD_RSV_ESTABLISH: Establish a new unicast reservation. | ||
| 28 | * | ||
| 29 | * UWB_DBG_CMD_RSV_TERMINATE: Terminate the Nth reservation. | ||
| 30 | */ | ||
| 31 | |||
| 32 | enum uwb_dbg_cmd_type { | ||
| 33 | UWB_DBG_CMD_RSV_ESTABLISH = 1, | ||
| 34 | UWB_DBG_CMD_RSV_TERMINATE = 2, | ||
| 35 | }; | ||
| 36 | |||
| 37 | struct uwb_dbg_cmd_rsv_establish { | ||
| 38 | __u8 target[6]; | ||
| 39 | __u8 type; | ||
| 40 | __u16 max_mas; | ||
| 41 | __u16 min_mas; | ||
| 42 | __u8 sparsity; | ||
| 43 | }; | ||
| 44 | |||
| 45 | struct uwb_dbg_cmd_rsv_terminate { | ||
| 46 | int index; | ||
| 47 | }; | ||
| 48 | |||
| 49 | struct uwb_dbg_cmd { | ||
| 50 | __u32 type; | ||
| 51 | union { | ||
| 52 | struct uwb_dbg_cmd_rsv_establish rsv_establish; | ||
| 53 | struct uwb_dbg_cmd_rsv_terminate rsv_terminate; | ||
| 54 | }; | ||
| 55 | }; | ||
| 56 | |||
| 57 | #endif /* #ifndef __LINUX__UWB__DEBUG_CMD_H__ */ | ||
diff --git a/include/linux/uwb/debug.h b/include/linux/uwb/debug.h new file mode 100644 index 000000000000..a86a73fe303f --- /dev/null +++ b/include/linux/uwb/debug.h | |||
| @@ -0,0 +1,82 @@ | |||
| 1 | /* | ||
| 2 | * Ultra Wide Band | ||
| 3 | * Debug Support | ||
| 4 | * | ||
| 5 | * Copyright (C) 2005-2006 Intel Corporation | ||
| 6 | * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com> | ||
| 7 | * | ||
| 8 | * This program is free software; you can redistribute it and/or | ||
| 9 | * modify it under the terms of the GNU General Public License version | ||
| 10 | * 2 as published by the Free Software Foundation. | ||
| 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., 51 Franklin Street, Fifth Floor, Boston, MA | ||
| 20 | * 02110-1301, USA. | ||
| 21 | * | ||
| 22 | * | ||
| 23 | * FIXME: doc | ||
| 24 | * Invoke like: | ||
| 25 | * | ||
| 26 | * #define D_LOCAL 4 | ||
| 27 | * #include <linux/uwb/debug.h> | ||
| 28 | * | ||
| 29 | * At the end of your include files. | ||
| 30 | */ | ||
| 31 | #include <linux/types.h> | ||
| 32 | |||
| 33 | struct device; | ||
| 34 | extern void dump_bytes(struct device *dev, const void *_buf, size_t rsize); | ||
| 35 | |||
| 36 | /* Master debug switch; !0 enables, 0 disables */ | ||
| 37 | #define D_MASTER (!0) | ||
| 38 | |||
| 39 | /* Local (per-file) debug switch; #define before #including */ | ||
| 40 | #ifndef D_LOCAL | ||
| 41 | #define D_LOCAL 0 | ||
| 42 | #endif | ||
| 43 | |||
| 44 | #undef __d_printf | ||
| 45 | #undef d_fnstart | ||
| 46 | #undef d_fnend | ||
| 47 | #undef d_printf | ||
| 48 | #undef d_dump | ||
| 49 | |||
| 50 | #define __d_printf(l, _tag, _dev, f, a...) \ | ||
| 51 | do { \ | ||
| 52 | struct device *__dev = (_dev); \ | ||
| 53 | if (D_MASTER && D_LOCAL >= (l)) { \ | ||
| 54 | char __head[64] = ""; \ | ||
| 55 | if (_dev != NULL) { \ | ||
| 56 | if ((unsigned long)__dev < 4096) \ | ||
| 57 | printk(KERN_ERR "E: Corrupt dev %p\n", \ | ||
| 58 | __dev); \ | ||
| 59 | else \ | ||
| 60 | snprintf(__head, sizeof(__head), \ | ||
| 61 | "%s %s: ", \ | ||
| 62 | dev_driver_string(__dev), \ | ||
| 63 | __dev->bus_id); \ | ||
| 64 | } \ | ||
| 65 | printk(KERN_ERR "%s%s" _tag ": " f, __head, \ | ||
| 66 | __func__, ## a); \ | ||
| 67 | } \ | ||
| 68 | } while (0 && _dev) | ||
| 69 | |||
| 70 | #define d_fnstart(l, _dev, f, a...) \ | ||
| 71 | __d_printf(l, " FNSTART", _dev, f, ## a) | ||
| 72 | #define d_fnend(l, _dev, f, a...) \ | ||
| 73 | __d_printf(l, " FNEND", _dev, f, ## a) | ||
| 74 | #define d_printf(l, _dev, f, a...) \ | ||
| 75 | __d_printf(l, "", _dev, f, ## a) | ||
| 76 | #define d_dump(l, _dev, ptr, size) \ | ||
| 77 | do { \ | ||
| 78 | struct device *__dev = _dev; \ | ||
| 79 | if (D_MASTER && D_LOCAL >= (l)) \ | ||
| 80 | dump_bytes(__dev, ptr, size); \ | ||
| 81 | } while (0 && _dev) | ||
| 82 | #define d_test(l) (D_MASTER && D_LOCAL >= (l)) | ||
diff --git a/include/linux/uwb/spec.h b/include/linux/uwb/spec.h new file mode 100644 index 000000000000..198c15f8e251 --- /dev/null +++ b/include/linux/uwb/spec.h | |||
| @@ -0,0 +1,727 @@ | |||
| 1 | /* | ||
| 2 | * Ultra Wide Band | ||
| 3 | * UWB Standard definitions | ||
| 4 | * | ||
| 5 | * Copyright (C) 2005-2006 Intel Corporation | ||
| 6 | * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com> | ||
| 7 | * | ||
| 8 | * This program is free software; you can redistribute it and/or | ||
| 9 | * modify it under the terms of the GNU General Public License version | ||
| 10 | * 2 as published by the Free Software Foundation. | ||
| 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., 51 Franklin Street, Fifth Floor, Boston, MA | ||
| 20 | * 02110-1301, USA. | ||
| 21 | * | ||
| 22 | * | ||
| 23 | * All these definitions are based on the ECMA-368 standard. | ||
| 24 | * | ||
| 25 | * Note all definitions are Little Endian in the wire, and we will | ||
| 26 | * convert them to host order before operating on the bitfields (that | ||
| 27 | * yes, we use extensively). | ||
| 28 | */ | ||
| 29 | |||
| 30 | #ifndef __LINUX__UWB_SPEC_H__ | ||
| 31 | #define __LINUX__UWB_SPEC_H__ | ||
| 32 | |||
| 33 | #include <linux/types.h> | ||
| 34 | #include <linux/bitmap.h> | ||
| 35 | |||
| 36 | #define i1480_FW 0x00000303 | ||
| 37 | /* #define i1480_FW 0x00000302 */ | ||
| 38 | |||
| 39 | /** | ||
| 40 | * Number of Medium Access Slots in a superframe. | ||
| 41 | * | ||
| 42 | * UWB divides time in SuperFrames, each one divided in 256 pieces, or | ||
| 43 | * Medium Access Slots. See MBOA MAC[5.4.5] for details. The MAS is the | ||
| 44 | * basic bandwidth allocation unit in UWB. | ||
| 45 | */ | ||
| 46 | enum { UWB_NUM_MAS = 256 }; | ||
| 47 | |||
| 48 | /** | ||
| 49 | * Number of Zones in superframe. | ||
| 50 | * | ||
| 51 | * UWB divides the superframe into zones with numbering starting from BPST. | ||
| 52 | * See MBOA MAC[16.8.6] | ||
| 53 | */ | ||
| 54 | enum { UWB_NUM_ZONES = 16 }; | ||
| 55 | |||
| 56 | /* | ||
| 57 | * Number of MAS in a zone. | ||
| 58 | */ | ||
| 59 | #define UWB_MAS_PER_ZONE (UWB_NUM_MAS / UWB_NUM_ZONES) | ||
| 60 | |||
| 61 | /* | ||
| 62 | * Number of streams per DRP reservation between a pair of devices. | ||
| 63 | * | ||
| 64 | * [ECMA-368] section 16.8.6. | ||
| 65 | */ | ||
| 66 | enum { UWB_NUM_STREAMS = 8 }; | ||
| 67 | |||
| 68 | /* | ||
| 69 | * mMasLength | ||
| 70 | * | ||
| 71 | * The length of a MAS in microseconds. | ||
| 72 | * | ||
| 73 | * [ECMA-368] section 17.16. | ||
| 74 | */ | ||
| 75 | enum { UWB_MAS_LENGTH_US = 256 }; | ||
| 76 | |||
| 77 | /* | ||
| 78 | * mBeaconSlotLength | ||
| 79 | * | ||
| 80 | * The length of the beacon slot in microseconds. | ||
| 81 | * | ||
| 82 | * [ECMA-368] section 17.16 | ||
| 83 | */ | ||
| 84 | enum { UWB_BEACON_SLOT_LENGTH_US = 85 }; | ||
| 85 | |||
| 86 | /* | ||
| 87 | * mMaxLostBeacons | ||
| 88 | * | ||
| 89 | * The number beacons missing in consecutive superframes before a | ||
| 90 | * device can be considered as unreachable. | ||
| 91 | * | ||
| 92 | * [ECMA-368] section 17.16 | ||
| 93 | */ | ||
| 94 | enum { UWB_MAX_LOST_BEACONS = 3 }; | ||
| 95 | |||
| 96 | /* | ||
| 97 | * Length of a superframe in microseconds. | ||
| 98 | */ | ||
| 99 | #define UWB_SUPERFRAME_LENGTH_US (UWB_MAS_LENGTH_US * UWB_NUM_MAS) | ||
| 100 | |||
| 101 | /** | ||
| 102 | * UWB MAC address | ||
| 103 | * | ||
| 104 | * It is *imperative* that this struct is exactly 6 packed bytes (as | ||
| 105 | * it is also used to define headers sent down and up the wire/radio). | ||
| 106 | */ | ||
| 107 | struct uwb_mac_addr { | ||
| 108 | u8 data[6]; | ||
| 109 | } __attribute__((packed)); | ||
| 110 | |||
| 111 | |||
| 112 | /** | ||
| 113 | * UWB device address | ||
| 114 | * | ||
| 115 | * It is *imperative* that this struct is exactly 6 packed bytes (as | ||
| 116 | * it is also used to define headers sent down and up the wire/radio). | ||
| 117 | */ | ||
| 118 | struct uwb_dev_addr { | ||
| 119 | u8 data[2]; | ||
| 120 | } __attribute__((packed)); | ||
| 121 | |||
| 122 | |||
| 123 | /** | ||
| 124 | * Types of UWB addresses | ||
| 125 | * | ||
| 126 | * Order matters (by size). | ||
| 127 | */ | ||
| 128 | enum uwb_addr_type { | ||
| 129 | UWB_ADDR_DEV = 0, | ||
| 130 | UWB_ADDR_MAC = 1, | ||
| 131 | }; | ||
| 132 | |||
| 133 | |||
| 134 | /** Size of a char buffer for printing a MAC/device address */ | ||
| 135 | enum { UWB_ADDR_STRSIZE = 32 }; | ||
| 136 | |||
| 137 | |||
| 138 | /** UWB WiMedia protocol IDs. */ | ||
| 139 | enum uwb_prid { | ||
| 140 | UWB_PRID_WLP_RESERVED = 0x0000, | ||
| 141 | UWB_PRID_WLP = 0x0001, | ||
| 142 | UWB_PRID_WUSB_BOT = 0x0010, | ||
| 143 | UWB_PRID_WUSB = 0x0010, | ||
| 144 | UWB_PRID_WUSB_TOP = 0x001F, | ||
| 145 | }; | ||
| 146 | |||
| 147 | |||
| 148 | /** PHY Rate (MBOA MAC[7.8.12, Table 61]) */ | ||
| 149 | enum uwb_phy_rate { | ||
| 150 | UWB_PHY_RATE_53 = 0, | ||
| 151 | UWB_PHY_RATE_80, | ||
| 152 | UWB_PHY_RATE_106, | ||
| 153 | UWB_PHY_RATE_160, | ||
| 154 | UWB_PHY_RATE_200, | ||
| 155 | UWB_PHY_RATE_320, | ||
| 156 | UWB_PHY_RATE_400, | ||
| 157 | UWB_PHY_RATE_480, | ||
| 158 | UWB_PHY_RATE_INVALID | ||
| 159 | }; | ||
| 160 | |||
| 161 | |||
| 162 | /** | ||
| 163 | * Different ways to scan (MBOA MAC[6.2.2, Table 8], WUSB[Table 8-78]) | ||
| 164 | */ | ||
| 165 | enum uwb_scan_type { | ||
| 166 | UWB_SCAN_ONLY = 0, | ||
| 167 | UWB_SCAN_OUTSIDE_BP, | ||
| 168 | UWB_SCAN_WHILE_INACTIVE, | ||
| 169 | UWB_SCAN_DISABLED, | ||
| 170 | UWB_SCAN_ONLY_STARTTIME, | ||
| 171 | UWB_SCAN_TOP | ||
| 172 | }; | ||
| 173 | |||
| 174 | |||
| 175 | /** ACK Policy types (MBOA MAC[7.2.1.3]) */ | ||
| 176 | enum uwb_ack_pol { | ||
| 177 | UWB_ACK_NO = 0, | ||
| 178 | UWB_ACK_INM = 1, | ||
| 179 | UWB_ACK_B = 2, | ||
| 180 | UWB_ACK_B_REQ = 3, | ||
| 181 | }; | ||
| 182 | |||
| 183 | |||
| 184 | /** DRP reservation types ([ECMA-368 table 106) */ | ||
| 185 | enum uwb_drp_type { | ||
| 186 | UWB_DRP_TYPE_ALIEN_BP = 0, | ||
| 187 | UWB_DRP_TYPE_HARD, | ||
| 188 | UWB_DRP_TYPE_SOFT, | ||
| 189 | UWB_DRP_TYPE_PRIVATE, | ||
| 190 | UWB_DRP_TYPE_PCA, | ||
| 191 | }; | ||
| 192 | |||
| 193 | |||
| 194 | /** DRP Reason Codes ([ECMA-368] table 107) */ | ||
| 195 | enum uwb_drp_reason { | ||
| 196 | UWB_DRP_REASON_ACCEPTED = 0, | ||
| 197 | UWB_DRP_REASON_CONFLICT, | ||
| 198 | UWB_DRP_REASON_PENDING, | ||
| 199 | UWB_DRP_REASON_DENIED, | ||
| 200 | UWB_DRP_REASON_MODIFIED, | ||
| 201 | }; | ||
| 202 | |||
| 203 | /** | ||
| 204 | * DRP Notification Reason Codes (WHCI 0.95 [3.1.4.9]) | ||
| 205 | */ | ||
| 206 | enum uwb_drp_notif_reason { | ||
| 207 | UWB_DRP_NOTIF_DRP_IE_RCVD = 0, | ||
| 208 | UWB_DRP_NOTIF_CONFLICT, | ||
| 209 | UWB_DRP_NOTIF_TERMINATE, | ||
| 210 | }; | ||
| 211 | |||
| 212 | |||
| 213 | /** Allocation of MAS slots in a DRP request MBOA MAC[7.8.7] */ | ||
| 214 | struct uwb_drp_alloc { | ||
| 215 | __le16 zone_bm; | ||
| 216 | __le16 mas_bm; | ||
| 217 | } __attribute__((packed)); | ||
| 218 | |||
| 219 | |||
| 220 | /** General MAC Header format (ECMA-368[16.2]) */ | ||
| 221 | struct uwb_mac_frame_hdr { | ||
| 222 | __le16 Frame_Control; | ||
| 223 | struct uwb_dev_addr DestAddr; | ||
| 224 | struct uwb_dev_addr SrcAddr; | ||
| 225 | __le16 Sequence_Control; | ||
| 226 | __le16 Access_Information; | ||
| 227 | } __attribute__((packed)); | ||
| 228 | |||
| 229 | |||
| 230 | /** | ||
| 231 | * uwb_beacon_frame - a beacon frame including MAC headers | ||
| 232 | * | ||
| 233 | * [ECMA] section 16.3. | ||
| 234 | */ | ||
| 235 | struct uwb_beacon_frame { | ||
| 236 | struct uwb_mac_frame_hdr hdr; | ||
| 237 | struct uwb_mac_addr Device_Identifier; /* may be a NULL EUI-48 */ | ||
| 238 | u8 Beacon_Slot_Number; | ||
| 239 | u8 Device_Control; | ||
| 240 | u8 IEData[]; | ||
| 241 | } __attribute__((packed)); | ||
| 242 | |||
| 243 | |||
| 244 | /** Information Element codes (MBOA MAC[T54]) */ | ||
| 245 | enum uwb_ie { | ||
| 246 | UWB_PCA_AVAILABILITY = 2, | ||
| 247 | UWB_IE_DRP_AVAILABILITY = 8, | ||
| 248 | UWB_IE_DRP = 9, | ||
| 249 | UWB_BP_SWITCH_IE = 11, | ||
| 250 | UWB_MAC_CAPABILITIES_IE = 12, | ||
| 251 | UWB_PHY_CAPABILITIES_IE = 13, | ||
| 252 | UWB_APP_SPEC_PROBE_IE = 15, | ||
| 253 | UWB_IDENTIFICATION_IE = 19, | ||
| 254 | UWB_MASTER_KEY_ID_IE = 20, | ||
| 255 | UWB_IE_WLP = 250, /* WiMedia Logical Link Control Protocol WLP 0.99 */ | ||
| 256 | UWB_APP_SPEC_IE = 255, | ||
| 257 | }; | ||
| 258 | |||
| 259 | |||
| 260 | /** | ||
| 261 | * Header common to all Information Elements (IEs) | ||
| 262 | */ | ||
| 263 | struct uwb_ie_hdr { | ||
| 264 | u8 element_id; /* enum uwb_ie */ | ||
| 265 | u8 length; | ||
| 266 | } __attribute__((packed)); | ||
| 267 | |||
| 268 | |||
| 269 | /** Dynamic Reservation Protocol IE (MBOA MAC[7.8.6]) */ | ||
| 270 | struct uwb_ie_drp { | ||
| 271 | struct uwb_ie_hdr hdr; | ||
| 272 | __le16 drp_control; | ||
| 273 | struct uwb_dev_addr dev_addr; | ||
| 274 | struct uwb_drp_alloc allocs[]; | ||
| 275 | } __attribute__((packed)); | ||
| 276 | |||
| 277 | static inline int uwb_ie_drp_type(struct uwb_ie_drp *ie) | ||
| 278 | { | ||
| 279 | return (le16_to_cpu(ie->drp_control) >> 0) & 0x7; | ||
| 280 | } | ||
| 281 | |||
| 282 | static inline int uwb_ie_drp_stream_index(struct uwb_ie_drp *ie) | ||
| 283 | { | ||
| 284 | return (le16_to_cpu(ie->drp_control) >> 3) & 0x7; | ||
| 285 | } | ||
| 286 | |||
| 287 | static inline int uwb_ie_drp_reason_code(struct uwb_ie_drp *ie) | ||
| 288 | { | ||
| 289 | return (le16_to_cpu(ie->drp_control) >> 6) & 0x7; | ||
| 290 | } | ||
| 291 | |||
| 292 | static inline int uwb_ie_drp_status(struct uwb_ie_drp *ie) | ||
| 293 | { | ||
| 294 | return (le16_to_cpu(ie->drp_control) >> 9) & 0x1; | ||
| 295 | } | ||
| 296 | |||
| 297 | static inline int uwb_ie_drp_owner(struct uwb_ie_drp *ie) | ||
| 298 | { | ||
| 299 | return (le16_to_cpu(ie->drp_control) >> 10) & 0x1; | ||
| 300 | } | ||
| 301 | |||
| 302 | static inline int uwb_ie_drp_tiebreaker(struct uwb_ie_drp *ie) | ||
| 303 | { | ||
| 304 | return (le16_to_cpu(ie->drp_control) >> 11) & 0x1; | ||
| 305 | } | ||
| 306 | |||
| 307 | static inline int uwb_ie_drp_unsafe(struct uwb_ie_drp *ie) | ||
| 308 | { | ||
| 309 | return (le16_to_cpu(ie->drp_control) >> 12) & 0x1; | ||
| 310 | } | ||
| 311 | |||
| 312 | static inline void uwb_ie_drp_set_type(struct uwb_ie_drp *ie, enum uwb_drp_type type) | ||
| 313 | { | ||
| 314 | u16 drp_control = le16_to_cpu(ie->drp_control); | ||
| 315 | drp_control = (drp_control & ~(0x7 << 0)) | (type << 0); | ||
| 316 | ie->drp_control = cpu_to_le16(drp_control); | ||
| 317 | } | ||
| 318 | |||
| 319 | static inline void uwb_ie_drp_set_stream_index(struct uwb_ie_drp *ie, int stream_index) | ||
| 320 | { | ||
| 321 | u16 drp_control = le16_to_cpu(ie->drp_control); | ||
| 322 | drp_control = (drp_control & ~(0x7 << 3)) | (stream_index << 3); | ||
| 323 | ie->drp_control = cpu_to_le16(drp_control); | ||
| 324 | } | ||
| 325 | |||
| 326 | static inline void uwb_ie_drp_set_reason_code(struct uwb_ie_drp *ie, | ||
| 327 | enum uwb_drp_reason reason_code) | ||
| 328 | { | ||
| 329 | u16 drp_control = le16_to_cpu(ie->drp_control); | ||
| 330 | drp_control = (ie->drp_control & ~(0x7 << 6)) | (reason_code << 6); | ||
| 331 | ie->drp_control = cpu_to_le16(drp_control); | ||
| 332 | } | ||
| 333 | |||
| 334 | static inline void uwb_ie_drp_set_status(struct uwb_ie_drp *ie, int status) | ||
| 335 | { | ||
| 336 | u16 drp_control = le16_to_cpu(ie->drp_control); | ||
| 337 | drp_control = (drp_control & ~(0x1 << 9)) | (status << 9); | ||
| 338 | ie->drp_control = cpu_to_le16(drp_control); | ||
| 339 | } | ||
| 340 | |||
| 341 | static inline void uwb_ie_drp_set_owner(struct uwb_ie_drp *ie, int owner) | ||
| 342 | { | ||
| 343 | u16 drp_control = le16_to_cpu(ie->drp_control); | ||
| 344 | drp_control = (drp_control & ~(0x1 << 10)) | (owner << 10); | ||
| 345 | ie->drp_control = cpu_to_le16(drp_control); | ||
| 346 | } | ||
| 347 | |||
| 348 | static inline void uwb_ie_drp_set_tiebreaker(struct uwb_ie_drp *ie, int tiebreaker) | ||
| 349 | { | ||
| 350 | u16 drp_control = le16_to_cpu(ie->drp_control); | ||
| 351 | drp_control = (drp_control & ~(0x1 << 11)) | (tiebreaker << 11); | ||
| 352 | ie->drp_control = cpu_to_le16(drp_control); | ||
| 353 | } | ||
| 354 | |||
| 355 | static inline void uwb_ie_drp_set_unsafe(struct uwb_ie_drp *ie, int unsafe) | ||
| 356 | { | ||
| 357 | u16 drp_control = le16_to_cpu(ie->drp_control); | ||
| 358 | drp_control = (drp_control & ~(0x1 << 12)) | (unsafe << 12); | ||
| 359 | ie->drp_control = cpu_to_le16(drp_control); | ||
| 360 | } | ||
| 361 | |||
| 362 | /** Dynamic Reservation Protocol IE (MBOA MAC[7.8.7]) */ | ||
| 363 | struct uwb_ie_drp_avail { | ||
| 364 | struct uwb_ie_hdr hdr; | ||
| 365 | DECLARE_BITMAP(bmp, UWB_NUM_MAS); | ||
| 366 | } __attribute__((packed)); | ||
| 367 | |||
| 368 | /** | ||
| 369 | * The Vendor ID is set to an OUI that indicates the vendor of the device. | ||
| 370 | * ECMA-368 [16.8.10] | ||
| 371 | */ | ||
| 372 | struct uwb_vendor_id { | ||
| 373 | u8 data[3]; | ||
| 374 | } __attribute__((packed)); | ||
| 375 | |||
| 376 | /** | ||
| 377 | * The device type ID | ||
| 378 | * FIXME: clarify what this means | ||
| 379 | * ECMA-368 [16.8.10] | ||
| 380 | */ | ||
| 381 | struct uwb_device_type_id { | ||
| 382 | u8 data[3]; | ||
| 383 | } __attribute__((packed)); | ||
| 384 | |||
| 385 | |||
| 386 | /** | ||
| 387 | * UWB device information types | ||
| 388 | * ECMA-368 [16.8.10] | ||
| 389 | */ | ||
| 390 | enum uwb_dev_info_type { | ||
| 391 | UWB_DEV_INFO_VENDOR_ID = 0, | ||
| 392 | UWB_DEV_INFO_VENDOR_TYPE, | ||
| 393 | UWB_DEV_INFO_NAME, | ||
| 394 | }; | ||
| 395 | |||
| 396 | /** | ||
| 397 | * UWB device information found in Identification IE | ||
| 398 | * ECMA-368 [16.8.10] | ||
| 399 | */ | ||
| 400 | struct uwb_dev_info { | ||
| 401 | u8 type; /* enum uwb_dev_info_type */ | ||
| 402 | u8 length; | ||
| 403 | u8 data[]; | ||
| 404 | } __attribute__((packed)); | ||
| 405 | |||
| 406 | /** | ||
| 407 | * UWB Identification IE | ||
| 408 | * ECMA-368 [16.8.10] | ||
| 409 | */ | ||
| 410 | struct uwb_identification_ie { | ||
| 411 | struct uwb_ie_hdr hdr; | ||
| 412 | struct uwb_dev_info info[]; | ||
| 413 | } __attribute__((packed)); | ||
| 414 | |||
| 415 | /* | ||
| 416 | * UWB Radio Controller | ||
| 417 | * | ||
| 418 | * These definitions are common to the Radio Control layers as | ||
| 419 | * exported by the WUSB1.0 HWA and WHCI interfaces. | ||
| 420 | */ | ||
| 421 | |||
| 422 | /** Radio Control Command Block (WUSB1.0[Table 8-65] and WHCI 0.95) */ | ||
| 423 | struct uwb_rccb { | ||
| 424 | u8 bCommandType; /* enum hwa_cet */ | ||
| 425 | __le16 wCommand; /* Command code */ | ||
| 426 | u8 bCommandContext; /* Context ID */ | ||
| 427 | } __attribute__((packed)); | ||
| 428 | |||
| 429 | |||
| 430 | /** Radio Control Event Block (WUSB[table 8-66], WHCI 0.95) */ | ||
| 431 | struct uwb_rceb { | ||
| 432 | u8 bEventType; /* enum hwa_cet */ | ||
| 433 | __le16 wEvent; /* Event code */ | ||
| 434 | u8 bEventContext; /* Context ID */ | ||
| 435 | } __attribute__((packed)); | ||
| 436 | |||
| 437 | |||
| 438 | enum { | ||
| 439 | UWB_RC_CET_GENERAL = 0, /* General Command/Event type */ | ||
| 440 | UWB_RC_CET_EX_TYPE_1 = 1, /* Extended Type 1 Command/Event type */ | ||
| 441 | }; | ||
| 442 | |||
| 443 | /* Commands to the radio controller */ | ||
| 444 | enum uwb_rc_cmd { | ||
| 445 | UWB_RC_CMD_CHANNEL_CHANGE = 16, | ||
| 446 | UWB_RC_CMD_DEV_ADDR_MGMT = 17, /* Device Address Management */ | ||
| 447 | UWB_RC_CMD_GET_IE = 18, /* GET Information Elements */ | ||
| 448 | UWB_RC_CMD_RESET = 19, | ||
| 449 | UWB_RC_CMD_SCAN = 20, /* Scan management */ | ||
| 450 | UWB_RC_CMD_SET_BEACON_FILTER = 21, | ||
| 451 | UWB_RC_CMD_SET_DRP_IE = 22, /* Dynamic Reservation Protocol IEs */ | ||
| 452 | UWB_RC_CMD_SET_IE = 23, /* Information Element management */ | ||
| 453 | UWB_RC_CMD_SET_NOTIFICATION_FILTER = 24, | ||
| 454 | UWB_RC_CMD_SET_TX_POWER = 25, | ||
| 455 | UWB_RC_CMD_SLEEP = 26, | ||
| 456 | UWB_RC_CMD_START_BEACON = 27, | ||
| 457 | UWB_RC_CMD_STOP_BEACON = 28, | ||
| 458 | UWB_RC_CMD_BP_MERGE = 29, | ||
| 459 | UWB_RC_CMD_SEND_COMMAND_FRAME = 30, | ||
| 460 | UWB_RC_CMD_SET_ASIE_NOTIF = 31, | ||
| 461 | }; | ||
| 462 | |||
| 463 | /* Notifications from the radio controller */ | ||
| 464 | enum uwb_rc_evt { | ||
| 465 | UWB_RC_EVT_IE_RCV = 0, | ||
| 466 | UWB_RC_EVT_BEACON = 1, | ||
| 467 | UWB_RC_EVT_BEACON_SIZE = 2, | ||
| 468 | UWB_RC_EVT_BPOIE_CHANGE = 3, | ||
| 469 | UWB_RC_EVT_BP_SLOT_CHANGE = 4, | ||
| 470 | UWB_RC_EVT_BP_SWITCH_IE_RCV = 5, | ||
| 471 | UWB_RC_EVT_DEV_ADDR_CONFLICT = 6, | ||
| 472 | UWB_RC_EVT_DRP_AVAIL = 7, | ||
| 473 | UWB_RC_EVT_DRP = 8, | ||
| 474 | UWB_RC_EVT_BP_SWITCH_STATUS = 9, | ||
| 475 | UWB_RC_EVT_CMD_FRAME_RCV = 10, | ||
| 476 | UWB_RC_EVT_CHANNEL_CHANGE_IE_RCV = 11, | ||
| 477 | /* Events (command responses) use the same code as the command */ | ||
| 478 | UWB_RC_EVT_UNKNOWN_CMD_RCV = 65535, | ||
| 479 | }; | ||
| 480 | |||
| 481 | enum uwb_rc_extended_type_1_cmd { | ||
| 482 | UWB_RC_SET_DAA_ENERGY_MASK = 32, | ||
| 483 | UWB_RC_SET_NOTIFICATION_FILTER_EX = 33, | ||
| 484 | }; | ||
| 485 | |||
| 486 | enum uwb_rc_extended_type_1_evt { | ||
| 487 | UWB_RC_DAA_ENERGY_DETECTED = 0, | ||
| 488 | }; | ||
| 489 | |||
| 490 | /* Radio Control Result Code. [WHCI] table 3-3. */ | ||
| 491 | enum { | ||
| 492 | UWB_RC_RES_SUCCESS = 0, | ||
| 493 | UWB_RC_RES_FAIL, | ||
| 494 | UWB_RC_RES_FAIL_HARDWARE, | ||
| 495 | UWB_RC_RES_FAIL_NO_SLOTS, | ||
| 496 | UWB_RC_RES_FAIL_BEACON_TOO_LARGE, | ||
| 497 | UWB_RC_RES_FAIL_INVALID_PARAMETER, | ||
| 498 | UWB_RC_RES_FAIL_UNSUPPORTED_PWR_LEVEL, | ||
| 499 | UWB_RC_RES_FAIL_INVALID_IE_DATA, | ||
| 500 | UWB_RC_RES_FAIL_BEACON_SIZE_EXCEEDED, | ||
| 501 | UWB_RC_RES_FAIL_CANCELLED, | ||
| 502 | UWB_RC_RES_FAIL_INVALID_STATE, | ||
| 503 | UWB_RC_RES_FAIL_INVALID_SIZE, | ||
| 504 | UWB_RC_RES_FAIL_ACK_NOT_RECEIVED, | ||
| 505 | UWB_RC_RES_FAIL_NO_MORE_ASIE_NOTIF, | ||
| 506 | UWB_RC_RES_FAIL_TIME_OUT = 255, | ||
| 507 | }; | ||
| 508 | |||
| 509 | /* Confirm event. [WHCI] section 3.1.3.1 etc. */ | ||
| 510 | struct uwb_rc_evt_confirm { | ||
| 511 | struct uwb_rceb rceb; | ||
| 512 | u8 bResultCode; | ||
| 513 | } __attribute__((packed)); | ||
| 514 | |||
| 515 | /* Device Address Management event. [WHCI] section 3.1.3.2. */ | ||
| 516 | struct uwb_rc_evt_dev_addr_mgmt { | ||
| 517 | struct uwb_rceb rceb; | ||
| 518 | u8 baAddr[6]; | ||
| 519 | u8 bResultCode; | ||
| 520 | } __attribute__((packed)); | ||
| 521 | |||
| 522 | |||
| 523 | /* Get IE Event. [WHCI] section 3.1.3.3. */ | ||
| 524 | struct uwb_rc_evt_get_ie { | ||
| 525 | struct uwb_rceb rceb; | ||
| 526 | __le16 wIELength; | ||
| 527 | u8 IEData[]; | ||
| 528 | } __attribute__((packed)); | ||
| 529 | |||
| 530 | /* Set DRP IE Event. [WHCI] section 3.1.3.7. */ | ||
| 531 | struct uwb_rc_evt_set_drp_ie { | ||
| 532 | struct uwb_rceb rceb; | ||
| 533 | __le16 wRemainingSpace; | ||
| 534 | u8 bResultCode; | ||
| 535 | } __attribute__((packed)); | ||
| 536 | |||
| 537 | /* Set IE Event. [WHCI] section 3.1.3.8. */ | ||
| 538 | struct uwb_rc_evt_set_ie { | ||
| 539 | struct uwb_rceb rceb; | ||
| 540 | __le16 RemainingSpace; | ||
| 541 | u8 bResultCode; | ||
| 542 | } __attribute__((packed)); | ||
| 543 | |||
| 544 | /* Scan command. [WHCI] 3.1.3.5. */ | ||
| 545 | struct uwb_rc_cmd_scan { | ||
| 546 | struct uwb_rccb rccb; | ||
| 547 | u8 bChannelNumber; | ||
| 548 | u8 bScanState; | ||
| 549 | __le16 wStartTime; | ||
| 550 | } __attribute__((packed)); | ||
| 551 | |||
| 552 | /* Set DRP IE command. [WHCI] section 3.1.3.7. */ | ||
| 553 | struct uwb_rc_cmd_set_drp_ie { | ||
| 554 | struct uwb_rccb rccb; | ||
| 555 | __le16 wIELength; | ||
| 556 | struct uwb_ie_drp IEData[]; | ||
| 557 | } __attribute__((packed)); | ||
| 558 | |||
| 559 | /* Set IE command. [WHCI] section 3.1.3.8. */ | ||
| 560 | struct uwb_rc_cmd_set_ie { | ||
| 561 | struct uwb_rccb rccb; | ||
| 562 | __le16 wIELength; | ||
| 563 | u8 IEData[]; | ||
| 564 | } __attribute__((packed)); | ||
| 565 | |||
| 566 | /* Set DAA Energy Mask event. [WHCI 0.96] section 3.1.3.17. */ | ||
| 567 | struct uwb_rc_evt_set_daa_energy_mask { | ||
| 568 | struct uwb_rceb rceb; | ||
| 569 | __le16 wLength; | ||
| 570 | u8 result; | ||
| 571 | } __attribute__((packed)); | ||
| 572 | |||
| 573 | /* Set Notification Filter Extended event. [WHCI 0.96] section 3.1.3.18. */ | ||
| 574 | struct uwb_rc_evt_set_notification_filter_ex { | ||
| 575 | struct uwb_rceb rceb; | ||
| 576 | __le16 wLength; | ||
| 577 | u8 result; | ||
| 578 | } __attribute__((packed)); | ||
| 579 | |||
| 580 | /* IE Received notification. [WHCI] section 3.1.4.1. */ | ||
| 581 | struct uwb_rc_evt_ie_rcv { | ||
| 582 | struct uwb_rceb rceb; | ||
| 583 | struct uwb_dev_addr SrcAddr; | ||
| 584 | __le16 wIELength; | ||
| 585 | u8 IEData[]; | ||
| 586 | } __attribute__((packed)); | ||
| 587 | |||
| 588 | /* Type of the received beacon. [WHCI] section 3.1.4.2. */ | ||
| 589 | enum uwb_rc_beacon_type { | ||
| 590 | UWB_RC_BEACON_TYPE_SCAN = 0, | ||
| 591 | UWB_RC_BEACON_TYPE_NEIGHBOR, | ||
| 592 | UWB_RC_BEACON_TYPE_OL_ALIEN, | ||
| 593 | UWB_RC_BEACON_TYPE_NOL_ALIEN, | ||
| 594 | }; | ||
| 595 | |||
| 596 | /* Beacon received notification. [WHCI] 3.1.4.2. */ | ||
| 597 | struct uwb_rc_evt_beacon { | ||
| 598 | struct uwb_rceb rceb; | ||
| 599 | u8 bChannelNumber; | ||
| 600 | u8 bBeaconType; | ||
| 601 | __le16 wBPSTOffset; | ||
| 602 | u8 bLQI; | ||
| 603 | u8 bRSSI; | ||
| 604 | __le16 wBeaconInfoLength; | ||
| 605 | u8 BeaconInfo[]; | ||
| 606 | } __attribute__((packed)); | ||
| 607 | |||
| 608 | |||
| 609 | /* Beacon Size Change notification. [WHCI] section 3.1.4.3 */ | ||
| 610 | struct uwb_rc_evt_beacon_size { | ||
| 611 | struct uwb_rceb rceb; | ||
| 612 | __le16 wNewBeaconSize; | ||
| 613 | } __attribute__((packed)); | ||
| 614 | |||
| 615 | |||
| 616 | /* BPOIE Change notification. [WHCI] section 3.1.4.4. */ | ||
| 617 | struct uwb_rc_evt_bpoie_change { | ||
| 618 | struct uwb_rceb rceb; | ||
| 619 | __le16 wBPOIELength; | ||
| 620 | u8 BPOIE[]; | ||
| 621 | } __attribute__((packed)); | ||
| 622 | |||
| 623 | |||
| 624 | /* Beacon Slot Change notification. [WHCI] section 3.1.4.5. */ | ||
| 625 | struct uwb_rc_evt_bp_slot_change { | ||
| 626 | struct uwb_rceb rceb; | ||
| 627 | u8 slot_info; | ||
| 628 | } __attribute__((packed)); | ||
| 629 | |||
| 630 | static inline int uwb_rc_evt_bp_slot_change_slot_num( | ||
| 631 | const struct uwb_rc_evt_bp_slot_change *evt) | ||
| 632 | { | ||
| 633 | return evt->slot_info & 0x7f; | ||
| 634 | } | ||
| 635 | |||
| 636 | static inline int uwb_rc_evt_bp_slot_change_no_slot( | ||
| 637 | const struct uwb_rc_evt_bp_slot_change *evt) | ||
| 638 | { | ||
| 639 | return (evt->slot_info & 0x80) >> 7; | ||
| 640 | } | ||
| 641 | |||
| 642 | /* BP Switch IE Received notification. [WHCI] section 3.1.4.6. */ | ||
| 643 | struct uwb_rc_evt_bp_switch_ie_rcv { | ||
| 644 | struct uwb_rceb rceb; | ||
| 645 | struct uwb_dev_addr wSrcAddr; | ||
| 646 | __le16 wIELength; | ||
| 647 | u8 IEData[]; | ||
| 648 | } __attribute__((packed)); | ||
| 649 | |||
| 650 | /* DevAddr Conflict notification. [WHCI] section 3.1.4.7. */ | ||
| 651 | struct uwb_rc_evt_dev_addr_conflict { | ||
| 652 | struct uwb_rceb rceb; | ||
| 653 | } __attribute__((packed)); | ||
| 654 | |||
| 655 | /* DRP notification. [WHCI] section 3.1.4.9. */ | ||
| 656 | struct uwb_rc_evt_drp { | ||
| 657 | struct uwb_rceb rceb; | ||
| 658 | struct uwb_dev_addr src_addr; | ||
| 659 | u8 reason; | ||
| 660 | u8 beacon_slot_number; | ||
| 661 | __le16 ie_length; | ||
| 662 | u8 ie_data[]; | ||
| 663 | } __attribute__((packed)); | ||
| 664 | |||
| 665 | static inline enum uwb_drp_notif_reason uwb_rc_evt_drp_reason(struct uwb_rc_evt_drp *evt) | ||
| 666 | { | ||
| 667 | return evt->reason & 0x0f; | ||
| 668 | } | ||
| 669 | |||
| 670 | |||
| 671 | /* DRP Availability Change notification. [WHCI] section 3.1.4.8. */ | ||
| 672 | struct uwb_rc_evt_drp_avail { | ||
| 673 | struct uwb_rceb rceb; | ||
| 674 | DECLARE_BITMAP(bmp, UWB_NUM_MAS); | ||
| 675 | } __attribute__((packed)); | ||
| 676 | |||
| 677 | /* BP switch status notification. [WHCI] section 3.1.4.10. */ | ||
| 678 | struct uwb_rc_evt_bp_switch_status { | ||
| 679 | struct uwb_rceb rceb; | ||
| 680 | u8 status; | ||
| 681 | u8 slot_offset; | ||
| 682 | __le16 bpst_offset; | ||
| 683 | u8 move_countdown; | ||
| 684 | } __attribute__((packed)); | ||
| 685 | |||
| 686 | /* Command Frame Received notification. [WHCI] section 3.1.4.11. */ | ||
| 687 | struct uwb_rc_evt_cmd_frame_rcv { | ||
| 688 | struct uwb_rceb rceb; | ||
| 689 | __le16 receive_time; | ||
| 690 | struct uwb_dev_addr wSrcAddr; | ||
| 691 | struct uwb_dev_addr wDstAddr; | ||
| 692 | __le16 control; | ||
| 693 | __le16 reserved; | ||
| 694 | __le16 dataLength; | ||
| 695 | u8 data[]; | ||
| 696 | } __attribute__((packed)); | ||
| 697 | |||
| 698 | /* Channel Change IE Received notification. [WHCI] section 3.1.4.12. */ | ||
| 699 | struct uwb_rc_evt_channel_change_ie_rcv { | ||
| 700 | struct uwb_rceb rceb; | ||
| 701 | struct uwb_dev_addr wSrcAddr; | ||
| 702 | __le16 wIELength; | ||
| 703 | u8 IEData[]; | ||
| 704 | } __attribute__((packed)); | ||
| 705 | |||
| 706 | /* DAA Energy Detected notification. [WHCI 0.96] section 3.1.4.14. */ | ||
| 707 | struct uwb_rc_evt_daa_energy_detected { | ||
| 708 | struct uwb_rceb rceb; | ||
| 709 | __le16 wLength; | ||
| 710 | u8 bandID; | ||
| 711 | u8 reserved; | ||
| 712 | u8 toneBmp[16]; | ||
| 713 | } __attribute__((packed)); | ||
| 714 | |||
| 715 | |||
| 716 | /** | ||
| 717 | * Radio Control Interface Class Descriptor | ||
| 718 | * | ||
| 719 | * WUSB 1.0 [8.6.1.2] | ||
| 720 | */ | ||
| 721 | struct uwb_rc_control_intf_class_desc { | ||
| 722 | u8 bLength; | ||
| 723 | u8 bDescriptorType; | ||
| 724 | __le16 bcdRCIVersion; | ||
| 725 | } __attribute__((packed)); | ||
| 726 | |||
| 727 | #endif /* #ifndef __LINUX__UWB_SPEC_H__ */ | ||
diff --git a/include/linux/uwb/umc.h b/include/linux/uwb/umc.h new file mode 100644 index 000000000000..36a39e34f8d7 --- /dev/null +++ b/include/linux/uwb/umc.h | |||
| @@ -0,0 +1,194 @@ | |||
| 1 | /* | ||
| 2 | * UWB Multi-interface Controller support. | ||
| 3 | * | ||
| 4 | * Copyright (C) 2007 Cambridge Silicon Radio Ltd. | ||
| 5 | * | ||
| 6 | * This file is released under the GPLv2 | ||
| 7 | * | ||
| 8 | * UMC (UWB Multi-interface Controller) capabilities (e.g., radio | ||
| 9 | * controller, host controller) are presented as devices on the "umc" | ||
| 10 | * bus. | ||
| 11 | * | ||
| 12 | * The radio controller is not strictly a UMC capability but it's | ||
| 13 | * useful to present it as such. | ||
| 14 | * | ||
| 15 | * References: | ||
| 16 | * | ||
| 17 | * [WHCI] Wireless Host Controller Interface Specification for | ||
| 18 | * Certified Wireless Universal Serial Bus, revision 0.95. | ||
| 19 | * | ||
| 20 | * How this works is kind of convoluted but simple. The whci.ko driver | ||
| 21 | * loads when WHCI devices are detected. These WHCI devices expose | ||
| 22 | * many devices in the same PCI function (they couldn't have reused | ||
| 23 | * functions, no), so for each PCI function that exposes these many | ||
| 24 | * devices, whci ceates a umc_dev [whci_probe() -> whci_add_cap()] | ||
| 25 | * with umc_device_create() and adds it to the bus with | ||
| 26 | * umc_device_register(). | ||
| 27 | * | ||
| 28 | * umc_device_register() calls device_register() which will push the | ||
| 29 | * bus management code to load your UMC driver's somehting_probe() | ||
| 30 | * that you have registered for that capability code. | ||
| 31 | * | ||
| 32 | * Now when the WHCI device is removed, whci_remove() will go over | ||
| 33 | * each umc_dev assigned to each of the PCI function's capabilities | ||
| 34 | * and through whci_del_cap() call umc_device_unregister() each | ||
| 35 | * created umc_dev. Of course, if you are bound to the device, your | ||
| 36 | * driver's something_remove() will be called. | ||
| 37 | */ | ||
| 38 | |||
| 39 | #ifndef _LINUX_UWB_UMC_H_ | ||
| 40 | #define _LINUX_UWB_UMC_H_ | ||
| 41 | |||
| 42 | #include <linux/device.h> | ||
| 43 | #include <linux/pci.h> | ||
| 44 | |||
| 45 | /* | ||
| 46 | * UMC capability IDs. | ||
| 47 | * | ||
| 48 | * 0x00 is reserved so use it for the radio controller device. | ||
| 49 | * | ||
| 50 | * [WHCI] table 2-8 | ||
| 51 | */ | ||
| 52 | #define UMC_CAP_ID_WHCI_RC 0x00 /* radio controller */ | ||
| 53 | #define UMC_CAP_ID_WHCI_WUSB_HC 0x01 /* WUSB host controller */ | ||
| 54 | |||
| 55 | /** | ||
| 56 | * struct umc_dev - UMC capability device | ||
| 57 | * | ||
| 58 | * @version: version of the specification this capability conforms to. | ||
| 59 | * @cap_id: capability ID. | ||
| 60 | * @bar: PCI Bar (64 bit) where the resource lies | ||
| 61 | * @resource: register space resource. | ||
| 62 | * @irq: interrupt line. | ||
| 63 | */ | ||
| 64 | struct umc_dev { | ||
| 65 | u16 version; | ||
| 66 | u8 cap_id; | ||
| 67 | u8 bar; | ||
| 68 | struct resource resource; | ||
| 69 | unsigned irq; | ||
| 70 | struct device dev; | ||
| 71 | }; | ||
| 72 | |||
| 73 | #define to_umc_dev(d) container_of(d, struct umc_dev, dev) | ||
| 74 | |||
| 75 | /** | ||
| 76 | * struct umc_driver - UMC capability driver | ||
| 77 | * @cap_id: supported capability ID. | ||
| 78 | * @match: driver specific capability matching function. | ||
| 79 | * @match_data: driver specific data for match() (e.g., a | ||
| 80 | * table of pci_device_id's if umc_match_pci_id() is used). | ||
| 81 | */ | ||
| 82 | struct umc_driver { | ||
| 83 | char *name; | ||
| 84 | u8 cap_id; | ||
| 85 | int (*match)(struct umc_driver *, struct umc_dev *); | ||
| 86 | const void *match_data; | ||
| 87 | |||
| 88 | int (*probe)(struct umc_dev *); | ||
| 89 | void (*remove)(struct umc_dev *); | ||
| 90 | int (*suspend)(struct umc_dev *, pm_message_t state); | ||
| 91 | int (*resume)(struct umc_dev *); | ||
| 92 | |||
| 93 | struct device_driver driver; | ||
| 94 | }; | ||
| 95 | |||
| 96 | #define to_umc_driver(d) container_of(d, struct umc_driver, driver) | ||
| 97 | |||
| 98 | extern struct bus_type umc_bus_type; | ||
| 99 | |||
| 100 | struct umc_dev *umc_device_create(struct device *parent, int n); | ||
| 101 | int __must_check umc_device_register(struct umc_dev *umc); | ||
| 102 | void umc_device_unregister(struct umc_dev *umc); | ||
| 103 | |||
| 104 | int __must_check __umc_driver_register(struct umc_driver *umc_drv, | ||
| 105 | struct module *mod, | ||
| 106 | const char *mod_name); | ||
| 107 | |||
| 108 | /** | ||
| 109 | * umc_driver_register - register a UMC capabiltity driver. | ||
| 110 | * @umc_drv: pointer to the driver. | ||
| 111 | */ | ||
| 112 | static inline int __must_check umc_driver_register(struct umc_driver *umc_drv) | ||
| 113 | { | ||
| 114 | return __umc_driver_register(umc_drv, THIS_MODULE, KBUILD_MODNAME); | ||
| 115 | } | ||
| 116 | void umc_driver_unregister(struct umc_driver *umc_drv); | ||
| 117 | |||
| 118 | /* | ||
| 119 | * Utility function you can use to match (umc_driver->match) against a | ||
| 120 | * null-terminated array of 'struct pci_device_id' in | ||
| 121 | * umc_driver->match_data. | ||
| 122 | */ | ||
| 123 | int umc_match_pci_id(struct umc_driver *umc_drv, struct umc_dev *umc); | ||
| 124 | |||
| 125 | /** | ||
| 126 | * umc_parent_pci_dev - return the UMC's parent PCI device or NULL if none | ||
| 127 | * @umc_dev: UMC device whose parent PCI device we are looking for | ||
| 128 | * | ||
| 129 | * DIRTY!!! DON'T RELY ON THIS | ||
| 130 | * | ||
| 131 | * FIXME: This is as dirty as it gets, but we need some way to check | ||
| 132 | * the correct type of umc_dev->parent (so that for example, we can | ||
| 133 | * cast to pci_dev). Casting to pci_dev is necesary because at some | ||
| 134 | * point we need to request resources from the device. Mapping is | ||
| 135 | * easily over come (ioremap and stuff are bus agnostic), but hooking | ||
| 136 | * up to some error handlers (such as pci error handlers) might need | ||
| 137 | * this. | ||
| 138 | * | ||
| 139 | * THIS might (probably will) be removed in the future, so don't count | ||
| 140 | * on it. | ||
| 141 | */ | ||
| 142 | static inline struct pci_dev *umc_parent_pci_dev(struct umc_dev *umc_dev) | ||
| 143 | { | ||
| 144 | struct pci_dev *pci_dev = NULL; | ||
| 145 | if (umc_dev->dev.parent->bus == &pci_bus_type) | ||
| 146 | pci_dev = to_pci_dev(umc_dev->dev.parent); | ||
| 147 | return pci_dev; | ||
| 148 | } | ||
| 149 | |||
| 150 | /** | ||
| 151 | * umc_dev_get() - reference a UMC device. | ||
| 152 | * @umc_dev: Pointer to UMC device. | ||
| 153 | * | ||
| 154 | * NOTE: we are assuming in this whole scheme that the parent device | ||
| 155 | * is referenced at _probe() time and unreferenced at _remove() | ||
| 156 | * time by the parent's subsystem. | ||
| 157 | */ | ||
| 158 | static inline struct umc_dev *umc_dev_get(struct umc_dev *umc_dev) | ||
| 159 | { | ||
| 160 | get_device(&umc_dev->dev); | ||
| 161 | return umc_dev; | ||
| 162 | } | ||
| 163 | |||
| 164 | /** | ||
| 165 | * umc_dev_put() - unreference a UMC device. | ||
| 166 | * @umc_dev: Pointer to UMC device. | ||
| 167 | */ | ||
| 168 | static inline void umc_dev_put(struct umc_dev *umc_dev) | ||
| 169 | { | ||
| 170 | put_device(&umc_dev->dev); | ||
| 171 | } | ||
| 172 | |||
| 173 | /** | ||
| 174 | * umc_set_drvdata - set UMC device's driver data. | ||
| 175 | * @umc_dev: Pointer to UMC device. | ||
| 176 | * @data: Data to set. | ||
| 177 | */ | ||
| 178 | static inline void umc_set_drvdata(struct umc_dev *umc_dev, void *data) | ||
| 179 | { | ||
| 180 | dev_set_drvdata(&umc_dev->dev, data); | ||
| 181 | } | ||
| 182 | |||
| 183 | /** | ||
| 184 | * umc_get_drvdata - recover UMC device's driver data. | ||
| 185 | * @umc_dev: Pointer to UMC device. | ||
| 186 | */ | ||
| 187 | static inline void *umc_get_drvdata(struct umc_dev *umc_dev) | ||
| 188 | { | ||
| 189 | return dev_get_drvdata(&umc_dev->dev); | ||
| 190 | } | ||
| 191 | |||
| 192 | int umc_controller_reset(struct umc_dev *umc); | ||
| 193 | |||
| 194 | #endif /* #ifndef _LINUX_UWB_UMC_H_ */ | ||
diff --git a/include/linux/uwb/whci.h b/include/linux/uwb/whci.h new file mode 100644 index 000000000000..915ec23042d4 --- /dev/null +++ b/include/linux/uwb/whci.h | |||
| @@ -0,0 +1,117 @@ | |||
| 1 | /* | ||
| 2 | * Wireless Host Controller Interface for Ultra-Wide-Band and Wireless USB | ||
| 3 | * | ||
| 4 | * Copyright (C) 2005-2006 Intel Corporation | ||
| 5 | * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com> | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or | ||
| 8 | * modify it under the terms of the GNU General Public License version | ||
| 9 | * 2 as published by the Free Software Foundation. | ||
| 10 | * | ||
| 11 | * This program is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License | ||
| 17 | * along with this program; if not, write to the Free Software | ||
| 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
| 19 | * 02110-1301, USA. | ||
| 20 | * | ||
| 21 | * | ||
| 22 | * | ||
| 23 | * References: | ||
| 24 | * [WHCI] Wireless Host Controller Interface Specification for | ||
| 25 | * Certified Wireless Universal Serial Bus, revision 0.95. | ||
| 26 | */ | ||
| 27 | #ifndef _LINUX_UWB_WHCI_H_ | ||
| 28 | #define _LINUX_UWB_WHCI_H_ | ||
| 29 | |||
| 30 | #include <linux/pci.h> | ||
| 31 | |||
| 32 | /* | ||
| 33 | * UWB interface capability registers (offsets from UWBBASE) | ||
| 34 | * | ||
| 35 | * [WHCI] section 2.2 | ||
| 36 | */ | ||
| 37 | #define UWBCAPINFO 0x00 /* == UWBCAPDATA(0) */ | ||
| 38 | # define UWBCAPINFO_TO_N_CAPS(c) (((c) >> 0) & 0xFull) | ||
| 39 | #define UWBCAPDATA(n) (8*(n)) | ||
| 40 | # define UWBCAPDATA_TO_VERSION(c) (((c) >> 32) & 0xFFFFull) | ||
| 41 | # define UWBCAPDATA_TO_OFFSET(c) (((c) >> 18) & 0x3FFFull) | ||
| 42 | # define UWBCAPDATA_TO_BAR(c) (((c) >> 16) & 0x3ull) | ||
| 43 | # define UWBCAPDATA_TO_SIZE(c) ((((c) >> 8) & 0xFFull) * sizeof(u32)) | ||
| 44 | # define UWBCAPDATA_TO_CAP_ID(c) (((c) >> 0) & 0xFFull) | ||
| 45 | |||
| 46 | /* Size of the WHCI capability data (including the RC capability) for | ||
| 47 | a device with n capabilities. */ | ||
| 48 | #define UWBCAPDATA_SIZE(n) (8 + 8*(n)) | ||
| 49 | |||
| 50 | |||
| 51 | /* | ||
| 52 | * URC registers (offsets from URCBASE) | ||
| 53 | * | ||
| 54 | * [WHCI] section 2.3 | ||
| 55 | */ | ||
| 56 | #define URCCMD 0x00 | ||
| 57 | # define URCCMD_RESET (1 << 31) /* UMC Hardware reset */ | ||
| 58 | # define URCCMD_RS (1 << 30) /* Run/Stop */ | ||
| 59 | # define URCCMD_EARV (1 << 29) /* Event Address Register Valid */ | ||
| 60 | # define URCCMD_ACTIVE (1 << 15) /* Command is active */ | ||
| 61 | # define URCCMD_IWR (1 << 14) /* Interrupt When Ready */ | ||
| 62 | # define URCCMD_SIZE_MASK 0x00000fff /* Command size mask */ | ||
| 63 | #define URCSTS 0x04 | ||
| 64 | # define URCSTS_EPS (1 << 17) /* Event Processing Status */ | ||
| 65 | # define URCSTS_HALTED (1 << 16) /* RC halted */ | ||
| 66 | # define URCSTS_HSE (1 << 10) /* Host System Error...fried */ | ||
| 67 | # define URCSTS_ER (1 << 9) /* Event Ready */ | ||
| 68 | # define URCSTS_RCI (1 << 8) /* Ready for Command Interrupt */ | ||
| 69 | # define URCSTS_INT_MASK 0x00000700 /* URC interrupt sources */ | ||
| 70 | # define URCSTS_ISI 0x000000ff /* Interrupt Source Identification */ | ||
| 71 | #define URCINTR 0x08 | ||
| 72 | # define URCINTR_EN_ALL 0x000007ff /* Enable all interrupt sources */ | ||
| 73 | #define URCCMDADDR 0x10 | ||
| 74 | #define URCEVTADDR 0x18 | ||
| 75 | # define URCEVTADDR_OFFSET_MASK 0xfff /* Event pointer offset mask */ | ||
| 76 | |||
| 77 | |||
| 78 | /** Write 32 bit @value to little endian register at @addr */ | ||
| 79 | static inline | ||
| 80 | void le_writel(u32 value, void __iomem *addr) | ||
| 81 | { | ||
| 82 | iowrite32(value, addr); | ||
| 83 | } | ||
| 84 | |||
| 85 | |||
| 86 | /** Read from 32 bit little endian register at @addr */ | ||
| 87 | static inline | ||
| 88 | u32 le_readl(void __iomem *addr) | ||
| 89 | { | ||
| 90 | return ioread32(addr); | ||
| 91 | } | ||
| 92 | |||
| 93 | |||
| 94 | /** Write 64 bit @value to little endian register at @addr */ | ||
| 95 | static inline | ||
| 96 | void le_writeq(u64 value, void __iomem *addr) | ||
| 97 | { | ||
| 98 | iowrite32(value, addr); | ||
| 99 | iowrite32(value >> 32, addr + 4); | ||
| 100 | } | ||
| 101 | |||
| 102 | |||
| 103 | /** Read from 64 bit little endian register at @addr */ | ||
| 104 | static inline | ||
| 105 | u64 le_readq(void __iomem *addr) | ||
| 106 | { | ||
| 107 | u64 value; | ||
| 108 | value = ioread32(addr); | ||
| 109 | value |= (u64)ioread32(addr + 4) << 32; | ||
| 110 | return value; | ||
| 111 | } | ||
| 112 | |||
| 113 | extern int whci_wait_for(struct device *dev, u32 __iomem *reg, | ||
| 114 | u32 mask, u32 result, | ||
| 115 | unsigned long max_ms, const char *tag); | ||
| 116 | |||
| 117 | #endif /* #ifndef _LINUX_UWB_WHCI_H_ */ | ||
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index d4b03034ee73..4669d7e72e75 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h | |||
| @@ -315,6 +315,13 @@ struct v4l2_pix_format { | |||
| 315 | /* see http://www.siliconimaging.com/RGB%20Bayer.htm */ | 315 | /* see http://www.siliconimaging.com/RGB%20Bayer.htm */ |
| 316 | #define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') /* 8 BGBG.. GRGR.. */ | 316 | #define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') /* 8 BGBG.. GRGR.. */ |
| 317 | #define V4L2_PIX_FMT_SGBRG8 v4l2_fourcc('G', 'B', 'R', 'G') /* 8 GBGB.. RGRG.. */ | 317 | #define V4L2_PIX_FMT_SGBRG8 v4l2_fourcc('G', 'B', 'R', 'G') /* 8 GBGB.. RGRG.. */ |
| 318 | /* | ||
| 319 | * 10bit raw bayer, expanded to 16 bits | ||
| 320 | * xxxxrrrrrrrrrrxxxxgggggggggg xxxxggggggggggxxxxbbbbbbbbbb... | ||
| 321 | */ | ||
| 322 | #define V4L2_PIX_FMT_SGRBG10 v4l2_fourcc('B', 'A', '1', '0') | ||
| 323 | /* 10bit raw bayer DPCM compressed to 8 bits */ | ||
| 324 | #define V4L2_PIX_FMT_SGRBG10DPCM8 v4l2_fourcc('B', 'D', '1', '0') | ||
| 318 | #define V4L2_PIX_FMT_SBGGR16 v4l2_fourcc('B', 'Y', 'R', '2') /* 16 BGBG.. GRGR.. */ | 325 | #define V4L2_PIX_FMT_SBGGR16 v4l2_fourcc('B', 'Y', 'R', '2') /* 16 BGBG.. GRGR.. */ |
| 319 | 326 | ||
| 320 | /* compressed formats */ | 327 | /* compressed formats */ |
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h index 4c28c4d564e2..307b88577eaa 100644 --- a/include/linux/vmalloc.h +++ b/include/linux/vmalloc.h | |||
| @@ -103,6 +103,4 @@ extern void free_vm_area(struct vm_struct *area); | |||
| 103 | extern rwlock_t vmlist_lock; | 103 | extern rwlock_t vmlist_lock; |
| 104 | extern struct vm_struct *vmlist; | 104 | extern struct vm_struct *vmlist; |
| 105 | 105 | ||
| 106 | extern const struct seq_operations vmalloc_op; | ||
| 107 | |||
| 108 | #endif /* _LINUX_VMALLOC_H */ | 106 | #endif /* _LINUX_VMALLOC_H */ |
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h index 9cd3ab0f554d..524cd1b28ecb 100644 --- a/include/linux/vmstat.h +++ b/include/linux/vmstat.h | |||
| @@ -54,10 +54,6 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT, | |||
| 54 | NR_VM_EVENT_ITEMS | 54 | NR_VM_EVENT_ITEMS |
| 55 | }; | 55 | }; |
| 56 | 56 | ||
| 57 | extern const struct seq_operations fragmentation_op; | ||
| 58 | extern const struct seq_operations pagetypeinfo_op; | ||
| 59 | extern const struct seq_operations zoneinfo_op; | ||
| 60 | extern const struct seq_operations vmstat_op; | ||
| 61 | extern int sysctl_stat_interval; | 57 | extern int sysctl_stat_interval; |
| 62 | 58 | ||
| 63 | #ifdef CONFIG_VM_EVENT_COUNTERS | 59 | #ifdef CONFIG_VM_EVENT_COUNTERS |
diff --git a/include/linux/wlp.h b/include/linux/wlp.h new file mode 100644 index 000000000000..033545e145c7 --- /dev/null +++ b/include/linux/wlp.h | |||
| @@ -0,0 +1,735 @@ | |||
| 1 | /* | ||
| 2 | * WiMedia Logical Link Control Protocol (WLP) | ||
| 3 | * | ||
| 4 | * Copyright (C) 2005-2006 Intel Corporation | ||
| 5 | * Reinette Chatre <reinette.chatre@intel.com> | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or | ||
| 8 | * modify it under the terms of the GNU General Public License version | ||
| 9 | * 2 as published by the Free Software Foundation. | ||
| 10 | * | ||
| 11 | * This program is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License | ||
| 17 | * along with this program; if not, write to the Free Software | ||
| 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
| 19 | * 02110-1301, USA. | ||
| 20 | * | ||
| 21 | * | ||
| 22 | * FIXME: docs | ||
| 23 | * | ||
| 24 | * - Does not (yet) include support for WLP control frames | ||
| 25 | * WLP Draft 0.99 [6.5]. | ||
| 26 | * | ||
| 27 | * A visual representation of the data structures. | ||
| 28 | * | ||
| 29 | * wssidB wssidB | ||
| 30 | * ^ ^ | ||
| 31 | * | | | ||
| 32 | * wssidA wssidA | ||
| 33 | * wlp interface { ^ ^ | ||
| 34 | * ... | | | ||
| 35 | * ... ... wssid wssid ... | ||
| 36 | * wlp --- ... | | | ||
| 37 | * }; neighbors --> neighbA --> neighbB | ||
| 38 | * ... | ||
| 39 | * wss | ||
| 40 | * ... | ||
| 41 | * eda cache --> neighborA --> neighborB --> neighborC ... | ||
| 42 | */ | ||
| 43 | |||
| 44 | #ifndef __LINUX__WLP_H_ | ||
| 45 | #define __LINUX__WLP_H_ | ||
| 46 | |||
| 47 | #include <linux/netdevice.h> | ||
| 48 | #include <linux/skbuff.h> | ||
| 49 | #include <linux/list.h> | ||
| 50 | #include <linux/uwb.h> | ||
| 51 | |||
| 52 | /** | ||
| 53 | * WLP Protocol ID | ||
| 54 | * WLP Draft 0.99 [6.2] | ||
| 55 | * | ||
| 56 | * The MUX header for all WLP frames | ||
| 57 | */ | ||
| 58 | #define WLP_PROTOCOL_ID 0x0100 | ||
| 59 | |||
| 60 | /** | ||
| 61 | * WLP Version | ||
| 62 | * WLP version placed in the association frames (WLP 0.99 [6.6]) | ||
| 63 | */ | ||
| 64 | #define WLP_VERSION 0x10 | ||
| 65 | |||
| 66 | /** | ||
| 67 | * Bytes needed to print UUID as string | ||
| 68 | */ | ||
| 69 | #define WLP_WSS_UUID_STRSIZE 48 | ||
| 70 | |||
| 71 | /** | ||
| 72 | * Bytes needed to print nonce as string | ||
| 73 | */ | ||
| 74 | #define WLP_WSS_NONCE_STRSIZE 48 | ||
| 75 | |||
| 76 | |||
| 77 | /** | ||
| 78 | * Size used for WLP name size | ||
| 79 | * | ||
| 80 | * The WSS name is set to 65 bytes, 1 byte larger than the maximum | ||
| 81 | * allowed by the WLP spec. This is to have a null terminated string | ||
| 82 | * for display to the user. A maximum of 64 bytes will still be used | ||
| 83 | * when placing the WSS name field in association frames. | ||
| 84 | */ | ||
| 85 | #define WLP_WSS_NAME_SIZE 65 | ||
| 86 | |||
| 87 | /** | ||
| 88 | * Number of bytes added by WLP to data frame | ||
| 89 | * | ||
| 90 | * A data frame transmitted from a host will be placed in a Standard or | ||
| 91 | * Abbreviated WLP frame. These have an extra 4 bytes of header (struct | ||
| 92 | * wlp_frame_std_abbrv_hdr). | ||
| 93 | * When the stack sends this data frame for transmission it needs to ensure | ||
| 94 | * there is enough headroom for this header. | ||
| 95 | */ | ||
| 96 | #define WLP_DATA_HLEN 4 | ||
| 97 | |||
| 98 | /** | ||
| 99 | * State of device regarding WLP Service Set | ||
| 100 | * | ||
| 101 | * WLP_WSS_STATE_NONE: the host does not participate in any WSS | ||
| 102 | * WLP_WSS_STATE_PART_ENROLLED: used as part of the enrollment sequence | ||
| 103 | * ("Partial Enroll"). This state is used to | ||
| 104 | * indicate the first part of enrollment that is | ||
| 105 | * unsecure. If the WSS is unsecure then the | ||
| 106 | * state will promptly go to WLP_WSS_STATE_ENROLLED, | ||
| 107 | * if the WSS is not secure then the enrollment | ||
| 108 | * procedure is a few more steps before we are | ||
| 109 | * enrolled. | ||
| 110 | * WLP_WSS_STATE_ENROLLED: the host is enrolled in a WSS | ||
| 111 | * WLP_WSS_STATE_ACTIVE: WSS is activated | ||
| 112 | * WLP_WSS_STATE_CONNECTED: host is connected to neighbor in WSS | ||
| 113 | * | ||
| 114 | */ | ||
| 115 | enum wlp_wss_state { | ||
| 116 | WLP_WSS_STATE_NONE = 0, | ||
| 117 | WLP_WSS_STATE_PART_ENROLLED, | ||
| 118 | WLP_WSS_STATE_ENROLLED, | ||
| 119 | WLP_WSS_STATE_ACTIVE, | ||
| 120 | WLP_WSS_STATE_CONNECTED, | ||
| 121 | }; | ||
| 122 | |||
| 123 | /** | ||
| 124 | * WSS Secure status | ||
| 125 | * WLP 0.99 Table 6 | ||
| 126 | * | ||
| 127 | * Set to one if the WSS is secure, zero if it is not secure | ||
| 128 | */ | ||
| 129 | enum wlp_wss_sec_status { | ||
| 130 | WLP_WSS_UNSECURE = 0, | ||
| 131 | WLP_WSS_SECURE, | ||
| 132 | }; | ||
| 133 | |||
| 134 | /** | ||
| 135 | * WLP frame type | ||
| 136 | * WLP Draft 0.99 [6.2 Table 1] | ||
| 137 | */ | ||
| 138 | enum wlp_frame_type { | ||
| 139 | WLP_FRAME_STANDARD = 0, | ||
| 140 | WLP_FRAME_ABBREVIATED, | ||
| 141 | WLP_FRAME_CONTROL, | ||
| 142 | WLP_FRAME_ASSOCIATION, | ||
| 143 | }; | ||
| 144 | |||
| 145 | /** | ||
| 146 | * WLP Association Message Type | ||
| 147 | * WLP Draft 0.99 [6.6.1.2 Table 8] | ||
| 148 | */ | ||
| 149 | enum wlp_assoc_type { | ||
| 150 | WLP_ASSOC_D1 = 2, | ||
| 151 | WLP_ASSOC_D2 = 3, | ||
| 152 | WLP_ASSOC_M1 = 4, | ||
| 153 | WLP_ASSOC_M2 = 5, | ||
| 154 | WLP_ASSOC_M3 = 7, | ||
| 155 | WLP_ASSOC_M4 = 8, | ||
| 156 | WLP_ASSOC_M5 = 9, | ||
| 157 | WLP_ASSOC_M6 = 10, | ||
| 158 | WLP_ASSOC_M7 = 11, | ||
| 159 | WLP_ASSOC_M8 = 12, | ||
| 160 | WLP_ASSOC_F0 = 14, | ||
| 161 | WLP_ASSOC_E1 = 32, | ||
| 162 | WLP_ASSOC_E2 = 33, | ||
| 163 | WLP_ASSOC_C1 = 34, | ||
| 164 | WLP_ASSOC_C2 = 35, | ||
| 165 | WLP_ASSOC_C3 = 36, | ||
| 166 | WLP_ASSOC_C4 = 37, | ||
| 167 | }; | ||
| 168 | |||
| 169 | /** | ||
| 170 | * WLP Attribute Type | ||
| 171 | * WLP Draft 0.99 [6.6.1 Table 6] | ||
| 172 | */ | ||
| 173 | enum wlp_attr_type { | ||
| 174 | WLP_ATTR_AUTH = 0x1005, /* Authenticator */ | ||
| 175 | WLP_ATTR_DEV_NAME = 0x1011, /* Device Name */ | ||
| 176 | WLP_ATTR_DEV_PWD_ID = 0x1012, /* Device Password ID */ | ||
| 177 | WLP_ATTR_E_HASH1 = 0x1014, /* E-Hash1 */ | ||
| 178 | WLP_ATTR_E_HASH2 = 0x1015, /* E-Hash2 */ | ||
| 179 | WLP_ATTR_E_SNONCE1 = 0x1016, /* E-SNonce1 */ | ||
| 180 | WLP_ATTR_E_SNONCE2 = 0x1017, /* E-SNonce2 */ | ||
| 181 | WLP_ATTR_ENCR_SET = 0x1018, /* Encrypted Settings */ | ||
| 182 | WLP_ATTR_ENRL_NONCE = 0x101A, /* Enrollee Nonce */ | ||
| 183 | WLP_ATTR_KEYWRAP_AUTH = 0x101E, /* Key Wrap Authenticator */ | ||
| 184 | WLP_ATTR_MANUF = 0x1021, /* Manufacturer */ | ||
| 185 | WLP_ATTR_MSG_TYPE = 0x1022, /* Message Type */ | ||
| 186 | WLP_ATTR_MODEL_NAME = 0x1023, /* Model Name */ | ||
| 187 | WLP_ATTR_MODEL_NR = 0x1024, /* Model Number */ | ||
| 188 | WLP_ATTR_PUB_KEY = 0x1032, /* Public Key */ | ||
| 189 | WLP_ATTR_REG_NONCE = 0x1039, /* Registrar Nonce */ | ||
| 190 | WLP_ATTR_R_HASH1 = 0x103D, /* R-Hash1 */ | ||
| 191 | WLP_ATTR_R_HASH2 = 0x103E, /* R-Hash2 */ | ||
| 192 | WLP_ATTR_R_SNONCE1 = 0x103F, /* R-SNonce1 */ | ||
| 193 | WLP_ATTR_R_SNONCE2 = 0x1040, /* R-SNonce2 */ | ||
| 194 | WLP_ATTR_SERIAL = 0x1042, /* Serial number */ | ||
| 195 | WLP_ATTR_UUID_E = 0x1047, /* UUID-E */ | ||
| 196 | WLP_ATTR_UUID_R = 0x1048, /* UUID-R */ | ||
| 197 | WLP_ATTR_PRI_DEV_TYPE = 0x1054, /* Primary Device Type */ | ||
| 198 | WLP_ATTR_SEC_DEV_TYPE = 0x1055, /* Secondary Device Type */ | ||
| 199 | WLP_ATTR_PORT_DEV = 0x1056, /* Portable Device */ | ||
| 200 | WLP_ATTR_APP_EXT = 0x1058, /* Application Extension */ | ||
| 201 | WLP_ATTR_WLP_VER = 0x2000, /* WLP Version */ | ||
| 202 | WLP_ATTR_WSSID = 0x2001, /* WSSID */ | ||
| 203 | WLP_ATTR_WSS_NAME = 0x2002, /* WSS Name */ | ||
| 204 | WLP_ATTR_WSS_SEC_STAT = 0x2003, /* WSS Secure Status */ | ||
| 205 | WLP_ATTR_WSS_BCAST = 0x2004, /* WSS Broadcast Address */ | ||
| 206 | WLP_ATTR_WSS_M_KEY = 0x2005, /* WSS Master Key */ | ||
| 207 | WLP_ATTR_ACC_ENRL = 0x2006, /* Accepting Enrollment */ | ||
| 208 | WLP_ATTR_WSS_INFO = 0x2007, /* WSS Information */ | ||
| 209 | WLP_ATTR_WSS_SEL_MTHD = 0x2008, /* WSS Selection Method */ | ||
| 210 | WLP_ATTR_ASSC_MTHD_LIST = 0x2009, /* Association Methods List */ | ||
| 211 | WLP_ATTR_SEL_ASSC_MTHD = 0x200A, /* Selected Association Method */ | ||
| 212 | WLP_ATTR_ENRL_HASH_COMM = 0x200B, /* Enrollee Hash Commitment */ | ||
| 213 | WLP_ATTR_WSS_TAG = 0x200C, /* WSS Tag */ | ||
| 214 | WLP_ATTR_WSS_VIRT = 0x200D, /* WSS Virtual EUI-48 */ | ||
| 215 | WLP_ATTR_WLP_ASSC_ERR = 0x200E, /* WLP Association Error */ | ||
| 216 | WLP_ATTR_VNDR_EXT = 0x200F, /* Vendor Extension */ | ||
| 217 | }; | ||
| 218 | |||
| 219 | /** | ||
| 220 | * WLP Category ID of primary/secondary device | ||
| 221 | * WLP Draft 0.99 [6.6.1.8 Table 12] | ||
| 222 | */ | ||
| 223 | enum wlp_dev_category_id { | ||
| 224 | WLP_DEV_CAT_COMPUTER = 1, | ||
| 225 | WLP_DEV_CAT_INPUT, | ||
| 226 | WLP_DEV_CAT_PRINT_SCAN_FAX_COPIER, | ||
| 227 | WLP_DEV_CAT_CAMERA, | ||
| 228 | WLP_DEV_CAT_STORAGE, | ||
| 229 | WLP_DEV_CAT_INFRASTRUCTURE, | ||
| 230 | WLP_DEV_CAT_DISPLAY, | ||
| 231 | WLP_DEV_CAT_MULTIM, | ||
| 232 | WLP_DEV_CAT_GAMING, | ||
| 233 | WLP_DEV_CAT_TELEPHONE, | ||
| 234 | WLP_DEV_CAT_OTHER = 65535, | ||
| 235 | }; | ||
| 236 | |||
| 237 | /** | ||
| 238 | * WLP WSS selection method | ||
| 239 | * WLP Draft 0.99 [6.6.1.6 Table 10] | ||
| 240 | */ | ||
| 241 | enum wlp_wss_sel_mthd { | ||
| 242 | WLP_WSS_ENRL_SELECT = 1, /* Enrollee selects */ | ||
| 243 | WLP_WSS_REG_SELECT, /* Registrar selects */ | ||
| 244 | }; | ||
| 245 | |||
| 246 | /** | ||
| 247 | * WLP association error values | ||
| 248 | * WLP Draft 0.99 [6.6.1.5 Table 9] | ||
| 249 | */ | ||
| 250 | enum wlp_assc_error { | ||
| 251 | WLP_ASSOC_ERROR_NONE, | ||
| 252 | WLP_ASSOC_ERROR_AUTH, /* Authenticator Failure */ | ||
| 253 | WLP_ASSOC_ERROR_ROGUE, /* Rogue activity suspected */ | ||
| 254 | WLP_ASSOC_ERROR_BUSY, /* Device busy */ | ||
| 255 | WLP_ASSOC_ERROR_LOCK, /* Setup Locked */ | ||
| 256 | WLP_ASSOC_ERROR_NOT_READY, /* Registrar not ready */ | ||
| 257 | WLP_ASSOC_ERROR_INV, /* Invalid WSS selection */ | ||
| 258 | WLP_ASSOC_ERROR_MSG_TIME, /* Message timeout */ | ||
| 259 | WLP_ASSOC_ERROR_ENR_TIME, /* Enrollment session timeout */ | ||
| 260 | WLP_ASSOC_ERROR_PW, /* Device password invalid */ | ||
| 261 | WLP_ASSOC_ERROR_VER, /* Unsupported version */ | ||
| 262 | WLP_ASSOC_ERROR_INT, /* Internal error */ | ||
| 263 | WLP_ASSOC_ERROR_UNDEF, /* Undefined error */ | ||
| 264 | WLP_ASSOC_ERROR_NUM, /* Numeric comparison failure */ | ||
| 265 | WLP_ASSOC_ERROR_WAIT, /* Waiting for user input */ | ||
| 266 | }; | ||
| 267 | |||
| 268 | /** | ||
| 269 | * WLP Parameters | ||
| 270 | * WLP 0.99 [7.7] | ||
| 271 | */ | ||
| 272 | enum wlp_parameters { | ||
| 273 | WLP_PER_MSG_TIMEOUT = 15, /* Seconds to wait for response to | ||
| 274 | association message. */ | ||
| 275 | }; | ||
| 276 | |||
| 277 | /** | ||
| 278 | * WLP IE | ||
| 279 | * | ||
| 280 | * The WLP IE should be included in beacons by all devices. | ||
| 281 | * | ||
| 282 | * The driver can set only a few of the fields in this information element, | ||
| 283 | * most fields are managed by the device self. When the driver needs to set | ||
| 284 | * a field it will only provide values for the fields of interest, the rest | ||
| 285 | * will be filled with zeroes. The fields of interest are: | ||
| 286 | * | ||
| 287 | * Element ID | ||
| 288 | * Length | ||
| 289 | * Capabilities (only to include WSSID Hash list length) | ||
| 290 | * WSSID Hash List fields | ||
| 291 | * | ||
| 292 | * WLP 0.99 [6.7] | ||
| 293 | * | ||
| 294 | * Only the fields that will be used are detailed in this structure, rest | ||
| 295 | * are not detailed or marked as "notused". | ||
| 296 | */ | ||
| 297 | struct wlp_ie { | ||
| 298 | struct uwb_ie_hdr hdr; | ||
| 299 | __le16 capabilities; | ||
| 300 | __le16 cycle_param; | ||
| 301 | __le16 acw_anchor_addr; | ||
| 302 | u8 wssid_hash_list[]; | ||
| 303 | } __attribute__((packed)); | ||
| 304 | |||
| 305 | static inline int wlp_ie_hash_length(struct wlp_ie *ie) | ||
| 306 | { | ||
| 307 | return (le16_to_cpu(ie->capabilities) >> 12) & 0xf; | ||
| 308 | } | ||
| 309 | |||
| 310 | static inline void wlp_ie_set_hash_length(struct wlp_ie *ie, int hash_length) | ||
| 311 | { | ||
| 312 | u16 caps = le16_to_cpu(ie->capabilities); | ||
| 313 | caps = (caps & ~(0xf << 12)) | (hash_length << 12); | ||
| 314 | ie->capabilities = cpu_to_le16(caps); | ||
| 315 | } | ||
| 316 | |||
| 317 | /** | ||
| 318 | * WLP nonce | ||
| 319 | * WLP Draft 0.99 [6.6.1 Table 6] | ||
| 320 | * | ||
| 321 | * A 128-bit random number often used (E-SNonce1, E-SNonce2, Enrollee | ||
| 322 | * Nonce, Registrar Nonce, R-SNonce1, R-SNonce2). It is passed to HW so | ||
| 323 | * it is packed. | ||
| 324 | */ | ||
| 325 | struct wlp_nonce { | ||
| 326 | u8 data[16]; | ||
| 327 | } __attribute__((packed)); | ||
| 328 | |||
| 329 | /** | ||
| 330 | * WLP UUID | ||
| 331 | * WLP Draft 0.99 [6.6.1 Table 6] | ||
| 332 | * | ||
| 333 | * Universally Unique Identifier (UUID) encoded as an octet string in the | ||
| 334 | * order the octets are shown in string representation in RFC4122. A UUID | ||
| 335 | * is often used (UUID-E, UUID-R, WSSID). It is passed to HW so it is packed. | ||
| 336 | */ | ||
| 337 | struct wlp_uuid { | ||
| 338 | u8 data[16]; | ||
| 339 | } __attribute__((packed)); | ||
| 340 | |||
| 341 | |||
| 342 | /** | ||
| 343 | * Primary and secondary device type attributes | ||
| 344 | * WLP Draft 0.99 [6.6.1.8] | ||
| 345 | */ | ||
| 346 | struct wlp_dev_type { | ||
| 347 | enum wlp_dev_category_id category:16; | ||
| 348 | u8 OUI[3]; | ||
| 349 | u8 OUIsubdiv; | ||
| 350 | __le16 subID; | ||
| 351 | } __attribute__((packed)); | ||
| 352 | |||
| 353 | /** | ||
| 354 | * WLP frame header | ||
| 355 | * WLP Draft 0.99 [6.2] | ||
| 356 | */ | ||
| 357 | struct wlp_frame_hdr { | ||
| 358 | __le16 mux_hdr; /* WLP_PROTOCOL_ID */ | ||
| 359 | enum wlp_frame_type type:8; | ||
| 360 | } __attribute__((packed)); | ||
| 361 | |||
| 362 | /** | ||
| 363 | * WLP attribute field header | ||
| 364 | * WLP Draft 0.99 [6.6.1] | ||
| 365 | * | ||
| 366 | * Header of each attribute found in an association frame | ||
| 367 | */ | ||
| 368 | struct wlp_attr_hdr { | ||
| 369 | __le16 type; | ||
| 370 | __le16 length; | ||
| 371 | } __attribute__((packed)); | ||
| 372 | |||
| 373 | /** | ||
| 374 | * Device information commonly used together | ||
| 375 | * | ||
| 376 | * Each of these device information elements has a specified range in which it | ||
| 377 | * should fit (WLP 0.99 [Table 6]). This range provided in the spec does not | ||
| 378 | * include the termination null '\0' character (when used in the | ||
| 379 | * association protocol the attribute fields are accompanied | ||
| 380 | * with a "length" field so the full range from the spec can be used for | ||
| 381 | * the value). We thus allocate an extra byte to be able to store a string | ||
| 382 | * of max length with a terminating '\0'. | ||
| 383 | */ | ||
| 384 | struct wlp_device_info { | ||
| 385 | char name[33]; | ||
| 386 | char model_name[33]; | ||
| 387 | char manufacturer[65]; | ||
| 388 | char model_nr[33]; | ||
| 389 | char serial[33]; | ||
| 390 | struct wlp_dev_type prim_dev_type; | ||
| 391 | }; | ||
| 392 | |||
| 393 | /** | ||
| 394 | * Macros for the WLP attributes | ||
| 395 | * | ||
| 396 | * There are quite a few attributes (total is 43). The attribute layout can be | ||
| 397 | * in one of three categories: one value, an array, an enum forced to 8 bits. | ||
| 398 | * These macros help with their definitions. | ||
| 399 | */ | ||
| 400 | #define wlp_attr(type, name) \ | ||
| 401 | struct wlp_attr_##name { \ | ||
| 402 | struct wlp_attr_hdr hdr; \ | ||
| 403 | type name; \ | ||
| 404 | } __attribute__((packed)); | ||
| 405 | |||
| 406 | #define wlp_attr_array(type, name) \ | ||
| 407 | struct wlp_attr_##name { \ | ||
| 408 | struct wlp_attr_hdr hdr; \ | ||
| 409 | type name[]; \ | ||
| 410 | } __attribute__((packed)); | ||
| 411 | |||
| 412 | /** | ||
| 413 | * WLP association attribute fields | ||
| 414 | * WLP Draft 0.99 [6.6.1 Table 6] | ||
| 415 | * | ||
| 416 | * Attributes appear in same order as the Table in the spec | ||
| 417 | * FIXME Does not define all attributes yet | ||
| 418 | */ | ||
| 419 | |||
| 420 | /* Device name: Friendly name of sending device */ | ||
| 421 | wlp_attr_array(u8, dev_name) | ||
| 422 | |||
| 423 | /* Enrollee Nonce: Random number generated by enrollee for an enrollment | ||
| 424 | * session */ | ||
| 425 | wlp_attr(struct wlp_nonce, enonce) | ||
| 426 | |||
| 427 | /* Manufacturer name: Name of manufacturer of the sending device */ | ||
| 428 | wlp_attr_array(u8, manufacturer) | ||
| 429 | |||
| 430 | /* WLP Message Type */ | ||
| 431 | wlp_attr(u8, msg_type) | ||
| 432 | |||
| 433 | /* WLP Model name: Model name of sending device */ | ||
| 434 | wlp_attr_array(u8, model_name) | ||
| 435 | |||
| 436 | /* WLP Model number: Model number of sending device */ | ||
| 437 | wlp_attr_array(u8, model_nr) | ||
| 438 | |||
| 439 | /* Registrar Nonce: Random number generated by registrar for an enrollment | ||
| 440 | * session */ | ||
| 441 | wlp_attr(struct wlp_nonce, rnonce) | ||
| 442 | |||
| 443 | /* Serial number of device */ | ||
| 444 | wlp_attr_array(u8, serial) | ||
| 445 | |||
| 446 | /* UUID of enrollee */ | ||
| 447 | wlp_attr(struct wlp_uuid, uuid_e) | ||
| 448 | |||
| 449 | /* UUID of registrar */ | ||
| 450 | wlp_attr(struct wlp_uuid, uuid_r) | ||
| 451 | |||
| 452 | /* WLP Primary device type */ | ||
| 453 | wlp_attr(struct wlp_dev_type, prim_dev_type) | ||
| 454 | |||
| 455 | /* WLP Secondary device type */ | ||
| 456 | wlp_attr(struct wlp_dev_type, sec_dev_type) | ||
| 457 | |||
| 458 | /* WLP protocol version */ | ||
| 459 | wlp_attr(u8, version) | ||
| 460 | |||
| 461 | /* WLP service set identifier */ | ||
| 462 | wlp_attr(struct wlp_uuid, wssid) | ||
| 463 | |||
| 464 | /* WLP WSS name */ | ||
| 465 | wlp_attr_array(u8, wss_name) | ||
| 466 | |||
| 467 | /* WLP WSS Secure Status */ | ||
| 468 | wlp_attr(u8, wss_sec_status) | ||
| 469 | |||
| 470 | /* WSS Broadcast Address */ | ||
| 471 | wlp_attr(struct uwb_mac_addr, wss_bcast) | ||
| 472 | |||
| 473 | /* WLP Accepting Enrollment */ | ||
| 474 | wlp_attr(u8, accept_enrl) | ||
| 475 | |||
| 476 | /** | ||
| 477 | * WSS information attributes | ||
| 478 | * WLP Draft 0.99 [6.6.3 Table 15] | ||
| 479 | */ | ||
| 480 | struct wlp_wss_info { | ||
| 481 | struct wlp_attr_wssid wssid; | ||
| 482 | struct wlp_attr_wss_name name; | ||
| 483 | struct wlp_attr_accept_enrl accept; | ||
| 484 | struct wlp_attr_wss_sec_status sec_stat; | ||
| 485 | struct wlp_attr_wss_bcast bcast; | ||
| 486 | } __attribute__((packed)); | ||
| 487 | |||
| 488 | /* WLP WSS Information */ | ||
| 489 | wlp_attr_array(struct wlp_wss_info, wss_info) | ||
| 490 | |||
| 491 | /* WLP WSS Selection method */ | ||
| 492 | wlp_attr(u8, wss_sel_mthd) | ||
| 493 | |||
| 494 | /* WLP WSS tag */ | ||
| 495 | wlp_attr(u8, wss_tag) | ||
| 496 | |||
| 497 | /* WSS Virtual Address */ | ||
| 498 | wlp_attr(struct uwb_mac_addr, wss_virt) | ||
| 499 | |||
| 500 | /* WLP association error */ | ||
| 501 | wlp_attr(u8, wlp_assc_err) | ||
| 502 | |||
| 503 | /** | ||
| 504 | * WLP standard and abbreviated frames | ||
| 505 | * | ||
| 506 | * WLP Draft 0.99 [6.3] and [6.4] | ||
| 507 | * | ||
| 508 | * The difference between the WLP standard frame and the WLP | ||
| 509 | * abbreviated frame is that the standard frame includes the src | ||
| 510 | * and dest addresses from the Ethernet header, the abbreviated frame does | ||
| 511 | * not. | ||
| 512 | * The src/dest (as well as the type/length and client data) are already | ||
| 513 | * defined as part of the Ethernet header, we do not do this here. | ||
| 514 | * From this perspective the standard and abbreviated frames appear the | ||
| 515 | * same - they will be treated differently though. | ||
| 516 | * | ||
| 517 | * The size of this header is also captured in WLP_DATA_HLEN to enable | ||
| 518 | * interfaces to prepare their headroom. | ||
| 519 | */ | ||
| 520 | struct wlp_frame_std_abbrv_hdr { | ||
| 521 | struct wlp_frame_hdr hdr; | ||
| 522 | u8 tag; | ||
| 523 | } __attribute__((packed)); | ||
| 524 | |||
| 525 | /** | ||
| 526 | * WLP association frames | ||
| 527 | * | ||
| 528 | * WLP Draft 0.99 [6.6] | ||
| 529 | */ | ||
| 530 | struct wlp_frame_assoc { | ||
| 531 | struct wlp_frame_hdr hdr; | ||
| 532 | enum wlp_assoc_type type:8; | ||
| 533 | struct wlp_attr_version version; | ||
| 534 | struct wlp_attr_msg_type msg_type; | ||
| 535 | u8 attr[]; | ||
| 536 | } __attribute__((packed)); | ||
| 537 | |||
| 538 | /* Ethernet to dev address mapping */ | ||
| 539 | struct wlp_eda { | ||
| 540 | spinlock_t lock; | ||
| 541 | struct list_head cache; /* Eth<->Dev Addr cache */ | ||
| 542 | }; | ||
| 543 | |||
| 544 | /** | ||
| 545 | * WSS information temporary storage | ||
| 546 | * | ||
| 547 | * This information is only stored temporarily during discovery. It should | ||
| 548 | * not be stored unless the device is enrolled in the advertised WSS. This | ||
| 549 | * is done mainly because we follow the letter of the spec in this regard. | ||
| 550 | * See WLP 0.99 [7.2.3]. | ||
| 551 | * When the device does become enrolled in a WSS the WSS information will | ||
| 552 | * be stored as part of the more comprehensive struct wlp_wss. | ||
| 553 | */ | ||
| 554 | struct wlp_wss_tmp_info { | ||
| 555 | char name[WLP_WSS_NAME_SIZE]; | ||
| 556 | u8 accept_enroll; | ||
| 557 | u8 sec_status; | ||
| 558 | struct uwb_mac_addr bcast; | ||
| 559 | }; | ||
| 560 | |||
| 561 | struct wlp_wssid_e { | ||
| 562 | struct list_head node; | ||
| 563 | struct wlp_uuid wssid; | ||
| 564 | struct wlp_wss_tmp_info *info; | ||
| 565 | }; | ||
| 566 | |||
| 567 | /** | ||
| 568 | * A cache entry of WLP neighborhood | ||
| 569 | * | ||
| 570 | * @node: head of list is wlp->neighbors | ||
| 571 | * @wssid: list of wssids of this neighbor, element is wlp_wssid_e | ||
| 572 | * @info: temporary storage for information learned during discovery. This | ||
| 573 | * storage is used together with the wssid_e temporary storage | ||
| 574 | * during discovery. | ||
| 575 | */ | ||
| 576 | struct wlp_neighbor_e { | ||
| 577 | struct list_head node; | ||
| 578 | struct wlp_uuid uuid; | ||
| 579 | struct uwb_dev *uwb_dev; | ||
| 580 | struct list_head wssid; /* Elements are wlp_wssid_e */ | ||
| 581 | struct wlp_device_info *info; | ||
| 582 | }; | ||
| 583 | |||
| 584 | struct wlp; | ||
| 585 | /** | ||
| 586 | * Information for an association session in progress. | ||
| 587 | * | ||
| 588 | * @exp_message: The type of the expected message. Both this message and a | ||
| 589 | * F0 message (which can be sent in response to any | ||
| 590 | * association frame) will be accepted as a valid message for | ||
| 591 | * this session. | ||
| 592 | * @cb: The function that will be called upon receipt of this | ||
| 593 | * message. | ||
| 594 | * @cb_priv: Private data of callback | ||
| 595 | * @data: Data used in association process (always a sk_buff?) | ||
| 596 | * @neighbor: Address of neighbor with which association session is in | ||
| 597 | * progress. | ||
| 598 | */ | ||
| 599 | struct wlp_session { | ||
| 600 | enum wlp_assoc_type exp_message; | ||
| 601 | void (*cb)(struct wlp *); | ||
| 602 | void *cb_priv; | ||
| 603 | void *data; | ||
| 604 | struct uwb_dev_addr neighbor_addr; | ||
| 605 | }; | ||
| 606 | |||
| 607 | /** | ||
| 608 | * WLP Service Set | ||
| 609 | * | ||
| 610 | * @mutex: used to protect entire WSS structure. | ||
| 611 | * | ||
| 612 | * @name: The WSS name is set to 65 bytes, 1 byte larger than the maximum | ||
| 613 | * allowed by the WLP spec. This is to have a null terminated string | ||
| 614 | * for display to the user. A maximum of 64 bytes will still be used | ||
| 615 | * when placing the WSS name field in association frames. | ||
| 616 | * | ||
| 617 | * @accept_enroll: Accepting enrollment: Set to one if registrar is | ||
| 618 | * accepting enrollment in WSS, or zero otherwise. | ||
| 619 | * | ||
| 620 | * Global and local information for each WSS in which we are enrolled. | ||
| 621 | * WLP 0.99 Section 7.2.1 and Section 7.2.2 | ||
| 622 | */ | ||
| 623 | struct wlp_wss { | ||
| 624 | struct mutex mutex; | ||
| 625 | struct kobject kobj; | ||
| 626 | /* Global properties. */ | ||
| 627 | struct wlp_uuid wssid; | ||
| 628 | u8 hash; | ||
| 629 | char name[WLP_WSS_NAME_SIZE]; | ||
| 630 | struct uwb_mac_addr bcast; | ||
| 631 | u8 secure_status:1; | ||
| 632 | u8 master_key[16]; | ||
| 633 | /* Local properties. */ | ||
| 634 | u8 tag; | ||
| 635 | struct uwb_mac_addr virtual_addr; | ||
| 636 | /* Extra */ | ||
| 637 | u8 accept_enroll:1; | ||
| 638 | enum wlp_wss_state state; | ||
| 639 | }; | ||
| 640 | |||
| 641 | /** | ||
| 642 | * WLP main structure | ||
| 643 | * @mutex: protect changes to WLP structure. We only allow changes to the | ||
| 644 | * uuid, so currently this mutex only protects this field. | ||
| 645 | */ | ||
| 646 | struct wlp { | ||
| 647 | struct mutex mutex; | ||
| 648 | struct uwb_rc *rc; /* UWB radio controller */ | ||
| 649 | struct uwb_pal pal; | ||
| 650 | struct wlp_eda eda; | ||
| 651 | struct wlp_uuid uuid; | ||
| 652 | struct wlp_session *session; | ||
| 653 | struct wlp_wss wss; | ||
| 654 | struct mutex nbmutex; /* Neighbor mutex protects neighbors list */ | ||
| 655 | struct list_head neighbors; /* Elements are wlp_neighbor_e */ | ||
| 656 | struct uwb_notifs_handler uwb_notifs_handler; | ||
| 657 | struct wlp_device_info *dev_info; | ||
| 658 | void (*fill_device_info)(struct wlp *wlp, struct wlp_device_info *info); | ||
| 659 | int (*xmit_frame)(struct wlp *, struct sk_buff *, | ||
| 660 | struct uwb_dev_addr *); | ||
| 661 | void (*stop_queue)(struct wlp *); | ||
| 662 | void (*start_queue)(struct wlp *); | ||
| 663 | }; | ||
| 664 | |||
| 665 | /* sysfs */ | ||
| 666 | |||
| 667 | |||
| 668 | struct wlp_wss_attribute { | ||
| 669 | struct attribute attr; | ||
| 670 | ssize_t (*show)(struct wlp_wss *wss, char *buf); | ||
| 671 | ssize_t (*store)(struct wlp_wss *wss, const char *buf, size_t count); | ||
| 672 | }; | ||
| 673 | |||
| 674 | #define WSS_ATTR(_name, _mode, _show, _store) \ | ||
| 675 | static struct wlp_wss_attribute wss_attr_##_name = __ATTR(_name, _mode, \ | ||
| 676 | _show, _store) | ||
| 677 | |||
| 678 | extern int wlp_setup(struct wlp *, struct uwb_rc *); | ||
| 679 | extern void wlp_remove(struct wlp *); | ||
| 680 | extern ssize_t wlp_neighborhood_show(struct wlp *, char *); | ||
| 681 | extern int wlp_wss_setup(struct net_device *, struct wlp_wss *); | ||
| 682 | extern void wlp_wss_remove(struct wlp_wss *); | ||
| 683 | extern ssize_t wlp_wss_activate_show(struct wlp_wss *, char *); | ||
| 684 | extern ssize_t wlp_wss_activate_store(struct wlp_wss *, const char *, size_t); | ||
| 685 | extern ssize_t wlp_eda_show(struct wlp *, char *); | ||
| 686 | extern ssize_t wlp_eda_store(struct wlp *, const char *, size_t); | ||
| 687 | extern ssize_t wlp_uuid_show(struct wlp *, char *); | ||
| 688 | extern ssize_t wlp_uuid_store(struct wlp *, const char *, size_t); | ||
| 689 | extern ssize_t wlp_dev_name_show(struct wlp *, char *); | ||
| 690 | extern ssize_t wlp_dev_name_store(struct wlp *, const char *, size_t); | ||
| 691 | extern ssize_t wlp_dev_manufacturer_show(struct wlp *, char *); | ||
| 692 | extern ssize_t wlp_dev_manufacturer_store(struct wlp *, const char *, size_t); | ||
| 693 | extern ssize_t wlp_dev_model_name_show(struct wlp *, char *); | ||
| 694 | extern ssize_t wlp_dev_model_name_store(struct wlp *, const char *, size_t); | ||
| 695 | extern ssize_t wlp_dev_model_nr_show(struct wlp *, char *); | ||
| 696 | extern ssize_t wlp_dev_model_nr_store(struct wlp *, const char *, size_t); | ||
| 697 | extern ssize_t wlp_dev_serial_show(struct wlp *, char *); | ||
| 698 | extern ssize_t wlp_dev_serial_store(struct wlp *, const char *, size_t); | ||
| 699 | extern ssize_t wlp_dev_prim_category_show(struct wlp *, char *); | ||
| 700 | extern ssize_t wlp_dev_prim_category_store(struct wlp *, const char *, | ||
| 701 | size_t); | ||
| 702 | extern ssize_t wlp_dev_prim_OUI_show(struct wlp *, char *); | ||
| 703 | extern ssize_t wlp_dev_prim_OUI_store(struct wlp *, const char *, size_t); | ||
| 704 | extern ssize_t wlp_dev_prim_OUI_sub_show(struct wlp *, char *); | ||
| 705 | extern ssize_t wlp_dev_prim_OUI_sub_store(struct wlp *, const char *, | ||
| 706 | size_t); | ||
| 707 | extern ssize_t wlp_dev_prim_subcat_show(struct wlp *, char *); | ||
| 708 | extern ssize_t wlp_dev_prim_subcat_store(struct wlp *, const char *, | ||
| 709 | size_t); | ||
| 710 | extern int wlp_receive_frame(struct device *, struct wlp *, struct sk_buff *, | ||
| 711 | struct uwb_dev_addr *); | ||
| 712 | extern int wlp_prepare_tx_frame(struct device *, struct wlp *, | ||
| 713 | struct sk_buff *, struct uwb_dev_addr *); | ||
| 714 | void wlp_reset_all(struct wlp *wlp); | ||
| 715 | |||
| 716 | /** | ||
| 717 | * Initialize WSS | ||
| 718 | */ | ||
| 719 | static inline | ||
| 720 | void wlp_wss_init(struct wlp_wss *wss) | ||
| 721 | { | ||
| 722 | mutex_init(&wss->mutex); | ||
| 723 | } | ||
| 724 | |||
| 725 | static inline | ||
| 726 | void wlp_init(struct wlp *wlp) | ||
| 727 | { | ||
| 728 | INIT_LIST_HEAD(&wlp->neighbors); | ||
| 729 | mutex_init(&wlp->mutex); | ||
| 730 | mutex_init(&wlp->nbmutex); | ||
| 731 | wlp_wss_init(&wlp->wss); | ||
| 732 | } | ||
| 733 | |||
| 734 | |||
| 735 | #endif /* #ifndef __LINUX__WLP_H_ */ | ||
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index 5c158c477ac7..89a5a1231ffb 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h | |||
| @@ -149,11 +149,11 @@ struct execute_work { | |||
| 149 | 149 | ||
| 150 | extern struct workqueue_struct * | 150 | extern struct workqueue_struct * |
| 151 | __create_workqueue_key(const char *name, int singlethread, | 151 | __create_workqueue_key(const char *name, int singlethread, |
| 152 | int freezeable, struct lock_class_key *key, | 152 | int freezeable, int rt, struct lock_class_key *key, |
| 153 | const char *lock_name); | 153 | const char *lock_name); |
| 154 | 154 | ||
| 155 | #ifdef CONFIG_LOCKDEP | 155 | #ifdef CONFIG_LOCKDEP |
| 156 | #define __create_workqueue(name, singlethread, freezeable) \ | 156 | #define __create_workqueue(name, singlethread, freezeable, rt) \ |
| 157 | ({ \ | 157 | ({ \ |
| 158 | static struct lock_class_key __key; \ | 158 | static struct lock_class_key __key; \ |
| 159 | const char *__lock_name; \ | 159 | const char *__lock_name; \ |
| @@ -164,17 +164,19 @@ __create_workqueue_key(const char *name, int singlethread, | |||
| 164 | __lock_name = #name; \ | 164 | __lock_name = #name; \ |
| 165 | \ | 165 | \ |
| 166 | __create_workqueue_key((name), (singlethread), \ | 166 | __create_workqueue_key((name), (singlethread), \ |
| 167 | (freezeable), &__key, \ | 167 | (freezeable), (rt), &__key, \ |
| 168 | __lock_name); \ | 168 | __lock_name); \ |
| 169 | }) | 169 | }) |
| 170 | #else | 170 | #else |
| 171 | #define __create_workqueue(name, singlethread, freezeable) \ | 171 | #define __create_workqueue(name, singlethread, freezeable, rt) \ |
| 172 | __create_workqueue_key((name), (singlethread), (freezeable), NULL, NULL) | 172 | __create_workqueue_key((name), (singlethread), (freezeable), (rt), \ |
| 173 | NULL, NULL) | ||
| 173 | #endif | 174 | #endif |
| 174 | 175 | ||
| 175 | #define create_workqueue(name) __create_workqueue((name), 0, 0) | 176 | #define create_workqueue(name) __create_workqueue((name), 0, 0, 0) |
| 176 | #define create_freezeable_workqueue(name) __create_workqueue((name), 1, 1) | 177 | #define create_rt_workqueue(name) __create_workqueue((name), 0, 0, 1) |
| 177 | #define create_singlethread_workqueue(name) __create_workqueue((name), 1, 0) | 178 | #define create_freezeable_workqueue(name) __create_workqueue((name), 1, 1, 0) |
| 179 | #define create_singlethread_workqueue(name) __create_workqueue((name), 1, 0, 0) | ||
| 178 | 180 | ||
| 179 | extern void destroy_workqueue(struct workqueue_struct *wq); | 181 | extern void destroy_workqueue(struct workqueue_struct *wq); |
| 180 | 182 | ||
