Prepare input updates for 5.4 merge window.
Showing the changes to include/linux (370 of 13457 files). Show all
Unified · Split
| @@ -10,6 +10,7 @@ · 9 unmodified lines | |||
| 10 | 10 | ||
| 11 | #include <linux/errno.h> | 11 | #include <linux/errno.h> |
| 12 | #include <linux/ioport.h> /* for struct resource */ | 12 | #include <linux/ioport.h> /* for struct resource */ |
| 13 | #include <linux/irqdomain.h> | ||
| 13 | #include <linux/resource_ext.h> | 14 | #include <linux/resource_ext.h> |
| 14 | #include <linux/device.h> | 15 | #include <linux/device.h> |
| 15 | #include <linux/property.h> | 16 | #include <linux/property.h> |
| @@ -314,10 +315,19 @@ int acpi_isa_irq_to_gsi (unsigned isa_irq, u32 *gsi); · 298 unmodified lines | |||
| 314 | void acpi_set_irq_model(enum acpi_irq_model_id model, | 315 | void acpi_set_irq_model(enum acpi_irq_model_id model, |
| 315 | struct fwnode_handle *fwnode); | 316 | struct fwnode_handle *fwnode); |
| 316 | 317 | ||
| 318 | struct irq_domain *acpi_irq_create_hierarchy(unsigned int flags, | ||
| 319 | unsigned int size, | ||
| 320 | struct fwnode_handle *fwnode, | ||
| 321 | const struct irq_domain_ops *ops, | ||
| 322 | void *host_data); | ||
| 323 | |||
| 317 | #ifdef CONFIG_X86_IO_APIC | 324 | #ifdef CONFIG_X86_IO_APIC |
| 318 | extern int acpi_get_override_irq(u32 gsi, int *trigger, int *polarity); | 325 | extern int acpi_get_override_irq(u32 gsi, int *trigger, int *polarity); |
| 319 | #else | 326 | #else |
| 320 | #define acpi_get_override_irq(gsi, trigger, polarity) (-1) | 327 | static inline int acpi_get_override_irq(u32 gsi, int *trigger, int *polarity) |
| 328 | { | ||
| 329 | return -1; | ||
| 330 | } | ||
| 321 | #endif | 331 | #endif |
| 322 | /* | 332 | /* |
| 323 | * This function undoes the effect of one call to acpi_register_gsi(). | 333 | * This function undoes the effect of one call to acpi_register_gsi(). |
| @@ -367,6 +377,7 @@ extern acpi_status wmi_install_notify_handler(const char *guid, · 43 unmodified lines | |||
| 367 | extern acpi_status wmi_remove_notify_handler(const char *guid); | 377 | extern acpi_status wmi_remove_notify_handler(const char *guid); |
| 368 | extern acpi_status wmi_get_event_data(u32 event, struct acpi_buffer *out); | 378 | extern acpi_status wmi_get_event_data(u32 event, struct acpi_buffer *out); |
| 369 | extern bool wmi_has_guid(const char *guid); | 379 | extern bool wmi_has_guid(const char *guid); |
| 380 | extern char *wmi_get_acpi_device_uid(const char *guid); | ||
| 370 | 381 | ||
| 371 | #endif /* CONFIG_ACPI_WMI */ | 382 | #endif /* CONFIG_ACPI_WMI */ |
| 372 | 383 | ||
| @@ -913,31 +924,21 @@ static inline int acpi_dev_pm_attach(struct device *dev, bool power_on) · 540 unmodified lines | |||
| 913 | #endif | 924 | #endif |
| 914 | 925 | ||
| 915 | #if defined(CONFIG_ACPI) && defined(CONFIG_PM_SLEEP) | 926 | #if defined(CONFIG_ACPI) && defined(CONFIG_PM_SLEEP) |
| 916 | int acpi_dev_suspend_late(struct device *dev); | ||
| 917 | int acpi_subsys_prepare(struct device *dev); | 927 | int acpi_subsys_prepare(struct device *dev); |
| 918 | void acpi_subsys_complete(struct device *dev); | 928 | void acpi_subsys_complete(struct device *dev); |
| 919 | int acpi_subsys_suspend_late(struct device *dev); | 929 | int acpi_subsys_suspend_late(struct device *dev); |
| 920 | int acpi_subsys_suspend_noirq(struct device *dev); | 930 | int acpi_subsys_suspend_noirq(struct device *dev); |
| 921 | int acpi_subsys_resume_noirq(struct device *dev); | ||
| 922 | int acpi_subsys_resume_early(struct device *dev); | ||
| 923 | int acpi_subsys_suspend(struct device *dev); | 931 | int acpi_subsys_suspend(struct device *dev); |
| 924 | int acpi_subsys_freeze(struct device *dev); | 932 | int acpi_subsys_freeze(struct device *dev); |
| 925 | int acpi_subsys_freeze_late(struct device *dev); | 933 | int acpi_subsys_poweroff(struct device *dev); |
| 926 | int acpi_subsys_freeze_noirq(struct device *dev); | ||
| 927 | int acpi_subsys_thaw_noirq(struct device *dev); | ||
| 928 | #else | 934 | #else |
| 929 | static inline int acpi_dev_resume_early(struct device *dev) { return 0; } | ||
| 930 | static inline int acpi_subsys_prepare(struct device *dev) { return 0; } | 935 | static inline int acpi_subsys_prepare(struct device *dev) { return 0; } |
| 931 | static inline void acpi_subsys_complete(struct device *dev) {} | 936 | static inline void acpi_subsys_complete(struct device *dev) {} |
| 932 | static inline int acpi_subsys_suspend_late(struct device *dev) { return 0; } | 937 | static inline int acpi_subsys_suspend_late(struct device *dev) { return 0; } |
| 933 | static inline int acpi_subsys_suspend_noirq(struct device *dev) { return 0; } | 938 | static inline int acpi_subsys_suspend_noirq(struct device *dev) { return 0; } |
| 934 | static inline int acpi_subsys_resume_noirq(struct device *dev) { return 0; } | ||
| 935 | static inline int acpi_subsys_resume_early(struct device *dev) { return 0; } | ||
| 936 | static inline int acpi_subsys_suspend(struct device *dev) { return 0; } | 939 | static inline int acpi_subsys_suspend(struct device *dev) { return 0; } |
| 937 | static inline int acpi_subsys_freeze(struct device *dev) { return 0; } | 940 | static inline int acpi_subsys_freeze(struct device *dev) { return 0; } |
| 938 | static inline int acpi_subsys_freeze_late(struct device *dev) { return 0; } | 941 | static inline int acpi_subsys_poweroff(struct device *dev) { return 0; } |
| 939 | static inline int acpi_subsys_freeze_noirq(struct device *dev) { return 0; } | ||
| 940 | static inline int acpi_subsys_thaw_noirq(struct device *dev) { return 0; } | ||
| 941 | #endif | 942 | #endif |
| 942 | 943 | ||
| 943 | #ifdef CONFIG_ACPI | 944 | #ifdef CONFIG_ACPI |
| @@ -1303,6 +1304,7 @@ static inline int lpit_read_residency_count_address(u64 *address) · 359 unmodified lines | |||
| 1303 | #ifdef CONFIG_ACPI_PPTT | 1304 | #ifdef CONFIG_ACPI_PPTT |
| 1304 | int find_acpi_cpu_topology(unsigned int cpu, int level); | 1305 | int find_acpi_cpu_topology(unsigned int cpu, int level); |
| 1305 | int find_acpi_cpu_topology_package(unsigned int cpu); | 1306 | int find_acpi_cpu_topology_package(unsigned int cpu); |
| 1307 | int find_acpi_cpu_topology_hetero_id(unsigned int cpu); | ||
| 1306 | int find_acpi_cpu_cache_topology(unsigned int cpu, int level); | 1308 | int find_acpi_cpu_cache_topology(unsigned int cpu, int level); |
| 1307 | #else | 1309 | #else |
| 1308 | static inline int find_acpi_cpu_topology(unsigned int cpu, int level) | 1310 | static inline int find_acpi_cpu_topology(unsigned int cpu, int level) |
| @@ -1313,6 +1315,10 @@ static inline int find_acpi_cpu_topology_package(unsigned int cpu) · 4 unmodified lines | |||
| 1313 | { | 1315 | { |
| 1314 | return -EINVAL; | 1316 | return -EINVAL; |
| 1315 | } | 1317 | } |
| 1318 | static inline int find_acpi_cpu_topology_hetero_id(unsigned int cpu) | ||
| 1319 | { | ||
| 1320 | return -EINVAL; | ||
| 1321 | } | ||
| 1316 | static inline int find_acpi_cpu_cache_topology(unsigned int cpu, int level) | 1322 | static inline int find_acpi_cpu_cache_topology(unsigned int cpu, int level) |
| 1317 | { | 1323 | { |
| 1318 | return -EINVAL; | 1324 | return -EINVAL; |
| @@ -18,7 +18,7 @@ DECLARE_PER_CPU(unsigned long, cpu_scale); · 17 unmodified lines | |||
| 18 | 18 | ||
| 19 | struct sched_domain; | 19 | struct sched_domain; |
| 20 | static inline | 20 | static inline |
| 21 | unsigned long topology_get_cpu_scale(struct sched_domain *sd, int cpu) | 21 | unsigned long topology_get_cpu_scale(int cpu) |
| 22 | { | 22 | { |
| 23 | return per_cpu(cpu_scale, cpu); | 23 | return per_cpu(cpu_scale, cpu); |
| 24 | } | 24 | } |
| @@ -182,6 +182,9 @@ static inline unsigned int audit_get_sessionid(struct task_struct *tsk) · 181 unmodified lines | |||
| 182 | } | 182 | } |
| 183 | 183 | ||
| 184 | extern u32 audit_enabled; | 184 | extern u32 audit_enabled; |
| 185 | |||
| 186 | extern int audit_signal_info(int sig, struct task_struct *t); | ||
| 187 | |||
| 185 | #else /* CONFIG_AUDIT */ | 188 | #else /* CONFIG_AUDIT */ |
| 186 | static inline __printf(4, 5) | 189 | static inline __printf(4, 5) |
| 187 | void audit_log(struct audit_context *ctx, gfp_t gfp_mask, int type, | 190 | void audit_log(struct audit_context *ctx, gfp_t gfp_mask, int type, |
| @@ -235,6 +238,12 @@ static inline unsigned int audit_get_sessionid(struct task_struct *tsk) · 47 unmodified lines | |||
| 235 | } | 238 | } |
| 236 | 239 | ||
| 237 | #define audit_enabled AUDIT_OFF | 240 | #define audit_enabled AUDIT_OFF |
| 241 | |||
| 242 | static inline int audit_signal_info(int sig, struct task_struct *t) | ||
| 243 | { | ||
| 244 | return 0; | ||
| 245 | } | ||
| 246 | |||
| 238 | #endif /* CONFIG_AUDIT */ | 247 | #endif /* CONFIG_AUDIT */ |
| 239 | 248 | ||
| 240 | #ifdef CONFIG_AUDIT_COMPAT_GENERIC | 249 | #ifdef CONFIG_AUDIT_COMPAT_GENERIC |
| @@ -61,12 +61,14 @@ enum virtchnl_status_code { · 60 unmodified lines | |||
| 61 | #define VIRTCHNL_ERR_PARAM VIRTCHNL_STATUS_ERR_PARAM | 61 | #define VIRTCHNL_ERR_PARAM VIRTCHNL_STATUS_ERR_PARAM |
| 62 | #define VIRTCHNL_STATUS_NOT_SUPPORTED VIRTCHNL_STATUS_ERR_NOT_SUPPORTED | 62 | #define VIRTCHNL_STATUS_NOT_SUPPORTED VIRTCHNL_STATUS_ERR_NOT_SUPPORTED |
| 63 | 63 | ||
| 64 | #define VIRTCHNL_LINK_SPEED_2_5GB_SHIFT 0x0 | ||
| 64 | #define VIRTCHNL_LINK_SPEED_100MB_SHIFT 0x1 | 65 | #define VIRTCHNL_LINK_SPEED_100MB_SHIFT 0x1 |
| 65 | #define VIRTCHNL_LINK_SPEED_1000MB_SHIFT 0x2 | 66 | #define VIRTCHNL_LINK_SPEED_1000MB_SHIFT 0x2 |
| 66 | #define VIRTCHNL_LINK_SPEED_10GB_SHIFT 0x3 | 67 | #define VIRTCHNL_LINK_SPEED_10GB_SHIFT 0x3 |
| 67 | #define VIRTCHNL_LINK_SPEED_40GB_SHIFT 0x4 | 68 | #define VIRTCHNL_LINK_SPEED_40GB_SHIFT 0x4 |
| 68 | #define VIRTCHNL_LINK_SPEED_20GB_SHIFT 0x5 | 69 | #define VIRTCHNL_LINK_SPEED_20GB_SHIFT 0x5 |
| 69 | #define VIRTCHNL_LINK_SPEED_25GB_SHIFT 0x6 | 70 | #define VIRTCHNL_LINK_SPEED_25GB_SHIFT 0x6 |
| 71 | #define VIRTCHNL_LINK_SPEED_5GB_SHIFT 0x7 | ||
| 70 | 72 | ||
| 71 | enum virtchnl_link_speed { | 73 | enum virtchnl_link_speed { |
| 72 | VIRTCHNL_LINK_SPEED_UNKNOWN = 0, | 74 | VIRTCHNL_LINK_SPEED_UNKNOWN = 0, |
| @@ -76,6 +78,8 @@ enum virtchnl_link_speed { · 3 unmodified lines | |||
| 76 | VIRTCHNL_LINK_SPEED_40GB = BIT(VIRTCHNL_LINK_SPEED_40GB_SHIFT), | 78 | VIRTCHNL_LINK_SPEED_40GB = BIT(VIRTCHNL_LINK_SPEED_40GB_SHIFT), |
| 77 | VIRTCHNL_LINK_SPEED_20GB = BIT(VIRTCHNL_LINK_SPEED_20GB_SHIFT), | 79 | VIRTCHNL_LINK_SPEED_20GB = BIT(VIRTCHNL_LINK_SPEED_20GB_SHIFT), |
| 78 | VIRTCHNL_LINK_SPEED_25GB = BIT(VIRTCHNL_LINK_SPEED_25GB_SHIFT), | 80 | VIRTCHNL_LINK_SPEED_25GB = BIT(VIRTCHNL_LINK_SPEED_25GB_SHIFT), |
| 81 | VIRTCHNL_LINK_SPEED_2_5GB = BIT(VIRTCHNL_LINK_SPEED_2_5GB_SHIFT), | ||
| 82 | VIRTCHNL_LINK_SPEED_5GB = BIT(VIRTCHNL_LINK_SPEED_5GB_SHIFT), | ||
| 79 | }; | 83 | }; |
| 80 | 84 | ||
| 81 | /* for hsplit_0 field of Rx HMC context */ | 85 | /* for hsplit_0 field of Rx HMC context */ |
| @@ -203,7 +203,6 @@ struct backing_dev_info { · 202 unmodified lines | |||
| 203 | 203 | ||
| 204 | #ifdef CONFIG_DEBUG_FS | 204 | #ifdef CONFIG_DEBUG_FS |
| 205 | struct dentry *debug_dir; | 205 | struct dentry *debug_dir; |
| 206 | struct dentry *debug_stats; | ||
| 207 | #endif | 206 | #endif |
| 208 | }; | 207 | }; |
| 209 | 208 | ||
| @@ -48,6 +48,7 @@ extern spinlock_t bdi_lock; · 47 unmodified lines | |||
| 48 | extern struct list_head bdi_list; | 48 | extern struct list_head bdi_list; |
| 49 | 49 | ||
| 50 | extern struct workqueue_struct *bdi_wq; | 50 | extern struct workqueue_struct *bdi_wq; |
| 51 | extern struct workqueue_struct *bdi_async_bio_wq; | ||
| 51 | 52 | ||
| 52 | static inline bool wb_has_dirty_io(struct bdi_writeback *wb) | 53 | static inline bool wb_has_dirty_io(struct bdi_writeback *wb) |
| 53 | { | 54 | { |
| @@ -64,6 +64,10 @@ extern struct page *balloon_page_alloc(void); · 63 unmodified lines | |||
| 64 | extern void balloon_page_enqueue(struct balloon_dev_info *b_dev_info, | 64 | extern void balloon_page_enqueue(struct balloon_dev_info *b_dev_info, |
| 65 | struct page *page); | 65 | struct page *page); |
| 66 | extern struct page *balloon_page_dequeue(struct balloon_dev_info *b_dev_info); | 66 | extern struct page *balloon_page_dequeue(struct balloon_dev_info *b_dev_info); |
| 67 | extern size_t balloon_page_list_enqueue(struct balloon_dev_info *b_dev_info, | ||
| 68 | struct list_head *pages); | ||
| 69 | extern size_t balloon_page_list_dequeue(struct balloon_dev_info *b_dev_info, | ||
| 70 | struct list_head *pages, size_t n_req_pages); | ||
| 67 | 71 | ||
| 68 | static inline void balloon_devinfo_init(struct balloon_dev_info *balloon) | 72 | static inline void balloon_devinfo_init(struct balloon_dev_info *balloon) |
| 69 | { | 73 | { |
| @@ -102,9 +102,23 @@ static inline void *bio_data(struct bio *bio) · 101 unmodified lines | |||
| 102 | return NULL; | 102 | return NULL; |
| 103 | } | 103 | } |
| 104 | 104 | ||
| 105 | static inline bool bio_full(struct bio *bio) | 105 | /** |
| 106 | * bio_full - check if the bio is full | ||
| 107 | * @bio: bio to check | ||
| 108 | * @len: length of one segment to be added | ||
| 109 | * | ||
| 110 | * Return true if @bio is full and one segment with @len bytes can't be | ||
| 111 | * added to the bio, otherwise return false | ||
| 112 | */ | ||
| 113 | static inline bool bio_full(struct bio *bio, unsigned len) | ||
| 106 | { | 114 | { |
| 107 | return bio->bi_vcnt >= bio->bi_max_vecs; | 115 | if (bio->bi_vcnt >= bio->bi_max_vecs) |
| 116 | return true; | ||
| 117 | |||
| 118 | if (bio->bi_iter.bi_size > UINT_MAX - len) | ||
| 119 | return true; | ||
| 120 | |||
| 121 | return false; | ||
| 108 | } | 122 | } |
| 109 | 123 | ||
| 110 | static inline bool bio_next_segment(const struct bio *bio, | 124 | static inline bool bio_next_segment(const struct bio *bio, |
| @@ -408,7 +422,6 @@ static inline void bio_wouldblock_error(struct bio *bio) · 297 unmodified lines | |||
| 408 | } | 422 | } |
| 409 | 423 | ||
| 410 | struct request_queue; | 424 | struct request_queue; |
| 411 | extern int bio_phys_segments(struct request_queue *, struct bio *); | ||
| 412 | 425 | ||
| 413 | extern int submit_bio_wait(struct bio *bio); | 426 | extern int submit_bio_wait(struct bio *bio); |
| 414 | extern void bio_advance(struct bio *, unsigned); | 427 | extern void bio_advance(struct bio *, unsigned); |
| @@ -427,6 +440,7 @@ bool __bio_try_merge_page(struct bio *bio, struct page *page, · 12 unmodified lines | |||
| 427 | void __bio_add_page(struct bio *bio, struct page *page, | 440 | void __bio_add_page(struct bio *bio, struct page *page, |
| 428 | unsigned int len, unsigned int off); | 441 | unsigned int len, unsigned int off); |
| 429 | int bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter); | 442 | int bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter); |
| 443 | void bio_release_pages(struct bio *bio, bool mark_dirty); | ||
| 430 | struct rq_map_data; | 444 | struct rq_map_data; |
| 431 | extern struct bio *bio_map_user_iov(struct request_queue *, | 445 | extern struct bio *bio_map_user_iov(struct request_queue *, |
| 432 | struct iov_iter *, gfp_t); | 446 | struct iov_iter *, gfp_t); |
| @@ -444,17 +458,6 @@ void generic_end_io_acct(struct request_queue *q, int op, · 11 unmodified lines | |||
| 444 | struct hd_struct *part, | 458 | struct hd_struct *part, |
| 445 | unsigned long start_time); | 459 | unsigned long start_time); |
| 446 | 460 | ||
| 447 | #ifndef ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE | ||
| 448 | # error "You should define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE for your platform" | ||
| 449 | #endif | ||
| 450 | #if ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE | ||
| 451 | extern void bio_flush_dcache_pages(struct bio *bi); | ||
| 452 | #else | ||
| 453 | static inline void bio_flush_dcache_pages(struct bio *bi) | ||
| 454 | { | ||
| 455 | } | ||
| 456 | #endif | ||
| 457 | |||
| 458 | extern void bio_copy_data_iter(struct bio *dst, struct bvec_iter *dst_iter, | 461 | extern void bio_copy_data_iter(struct bio *dst, struct bvec_iter *dst_iter, |
| 459 | struct bio *src, struct bvec_iter *src_iter); | 462 | struct bio *src, struct bvec_iter *src_iter); |
| 460 | extern void bio_copy_data(struct bio *dst, struct bio *src); | 463 | extern void bio_copy_data(struct bio *dst, struct bio *src); |
| @@ -1,13 +1,15 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | #ifndef __LINUX_BITS_H | 2 | #ifndef __LINUX_BITS_H |
| 3 | #define __LINUX_BITS_H | 3 | #define __LINUX_BITS_H |
| 4 | |||
| 5 | #include <linux/const.h> | ||
| 4 | #include <asm/bitsperlong.h> | 6 | #include <asm/bitsperlong.h> |
| 5 | 7 | ||
| 6 | #define BIT(nr) (1UL << (nr)) | 8 | #define BIT(nr) (UL(1) << (nr)) |
| 7 | #define BIT_ULL(nr) (1ULL << (nr)) | 9 | #define BIT_ULL(nr) (ULL(1) << (nr)) |
| 8 | #define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG)) | 10 | #define BIT_MASK(nr) (UL(1) << ((nr) % BITS_PER_LONG)) |
| 9 | #define BIT_WORD(nr) ((nr) / BITS_PER_LONG) | 11 | #define BIT_WORD(nr) ((nr) / BITS_PER_LONG) |
| 10 | #define BIT_ULL_MASK(nr) (1ULL << ((nr) % BITS_PER_LONG_LONG)) | 12 | #define BIT_ULL_MASK(nr) (ULL(1) << ((nr) % BITS_PER_LONG_LONG)) |
| 11 | #define BIT_ULL_WORD(nr) ((nr) / BITS_PER_LONG_LONG) | 13 | #define BIT_ULL_WORD(nr) ((nr) / BITS_PER_LONG_LONG) |
| 12 | #define BITS_PER_BYTE 8 | 14 | #define BITS_PER_BYTE 8 |
| 13 | 15 | ||
| @@ -17,10 +19,11 @@ · 3 unmodified lines | |||
| 17 | * GENMASK_ULL(39, 21) gives us the 64bit vector 0x000000ffffe00000. | 19 | * GENMASK_ULL(39, 21) gives us the 64bit vector 0x000000ffffe00000. |
| 18 | */ | 20 | */ |
| 19 | #define GENMASK(h, l) \ | 21 | #define GENMASK(h, l) \ |
| 20 | (((~0UL) - (1UL << (l)) + 1) & (~0UL >> (BITS_PER_LONG - 1 - (h)))) | 22 | (((~UL(0)) - (UL(1) << (l)) + 1) & \ |
| 23 | (~UL(0) >> (BITS_PER_LONG - 1 - (h)))) | ||
| 21 | 24 | ||
| 22 | #define GENMASK_ULL(h, l) \ | 25 | #define GENMASK_ULL(h, l) \ |
| 23 | (((~0ULL) - (1ULL << (l)) + 1) & \ | 26 | (((~ULL(0)) - (ULL(1) << (l)) + 1) & \ |
| 24 | (~0ULL >> (BITS_PER_LONG_LONG - 1 - (h)))) | 27 | (~ULL(0) >> (BITS_PER_LONG_LONG - 1 - (h)))) |
| 25 | 28 | ||
| 26 | #endif /* __LINUX_BITS_H */ | 29 | #endif /* __LINUX_BITS_H */ |
| @@ -63,19 +63,17 @@ struct blkcg { · 62 unmodified lines | |||
| 63 | 63 | ||
| 64 | /* | 64 | /* |
| 65 | * blkg_[rw]stat->aux_cnt is excluded for local stats but included for | 65 | * blkg_[rw]stat->aux_cnt is excluded for local stats but included for |
| 66 | * recursive. Used to carry stats of dead children, and, for blkg_rwstat, | 66 | * recursive. Used to carry stats of dead children. |
| 67 | * to carry result values from read and sum operations. | ||
| 68 | */ | 67 | */ |
| 69 | struct blkg_stat { | ||
| 70 | struct percpu_counter cpu_cnt; | ||
| 71 | atomic64_t aux_cnt; | ||
| 72 | }; | ||
| 73 | |||
| 74 | struct blkg_rwstat { | 68 | struct blkg_rwstat { |
| 75 | struct percpu_counter cpu_cnt[BLKG_RWSTAT_NR]; | 69 | struct percpu_counter cpu_cnt[BLKG_RWSTAT_NR]; |
| 76 | atomic64_t aux_cnt[BLKG_RWSTAT_NR]; | 70 | atomic64_t aux_cnt[BLKG_RWSTAT_NR]; |
| 77 | }; | 71 | }; |
| 78 | 72 | ||
| 73 | struct blkg_rwstat_sample { | ||
| 74 | u64 cnt[BLKG_RWSTAT_NR]; | ||
| 75 | }; | ||
| 76 | |||
| 79 | /* | 77 | /* |
| 80 | * A blkcg_gq (blkg) is association between a block cgroup (blkcg) and a | 78 | * A blkcg_gq (blkg) is association between a block cgroup (blkcg) and a |
| 81 | * request_queue (q). This is used by blkcg policies which need to track | 79 | * request_queue (q). This is used by blkcg policies which need to track |
| @@ -134,13 +132,17 @@ struct blkcg_gq { · 52 unmodified lines | |||
| 134 | 132 | ||
| 135 | struct blkg_policy_data *pd[BLKCG_MAX_POLS]; | 133 | struct blkg_policy_data *pd[BLKCG_MAX_POLS]; |
| 136 | 134 | ||
| 137 | struct rcu_head rcu_head; | 135 | spinlock_t async_bio_lock; |
| 136 | struct bio_list async_bios; | ||
| 137 | struct work_struct async_bio_work; | ||
| 138 | 138 | ||
| 139 | atomic_t use_delay; | 139 | atomic_t use_delay; |
| 140 | atomic64_t delay_nsec; | 140 | atomic64_t delay_nsec; |
| 141 | atomic64_t delay_start; | 141 | atomic64_t delay_start; |
| 142 | u64 last_delay; | 142 | u64 last_delay; |
| 143 | int last_use; | 143 | int last_use; |
| 144 | |||
| 145 | struct rcu_head rcu_head; | ||
| 144 | }; | 146 | }; |
| 145 | 147 | ||
| 146 | typedef struct blkcg_policy_data *(blkcg_pol_alloc_cpd_fn)(gfp_t gfp); | 148 | typedef struct blkcg_policy_data *(blkcg_pol_alloc_cpd_fn)(gfp_t gfp); |
| @@ -179,6 +181,7 @@ struct blkcg_policy { · 32 unmodified lines | |||
| 179 | 181 | ||
| 180 | extern struct blkcg blkcg_root; | 182 | extern struct blkcg blkcg_root; |
| 181 | extern struct cgroup_subsys_state * const blkcg_root_css; | 183 | extern struct cgroup_subsys_state * const blkcg_root_css; |
| 184 | extern bool blkcg_debug_stats; | ||
| 182 | 185 | ||
| 183 | struct blkcg_gq *blkg_lookup_slowpath(struct blkcg *blkcg, | 186 | struct blkcg_gq *blkg_lookup_slowpath(struct blkcg *blkcg, |
| 184 | struct request_queue *q, bool update_hint); | 187 | struct request_queue *q, bool update_hint); |
| @@ -198,6 +201,13 @@ int blkcg_activate_policy(struct request_queue *q, · 13 unmodified lines | |||
| 198 | void blkcg_deactivate_policy(struct request_queue *q, | 201 | void blkcg_deactivate_policy(struct request_queue *q, |
| 199 | const struct blkcg_policy *pol); | 202 | const struct blkcg_policy *pol); |
| 200 | 203 | ||
| 204 | static inline u64 blkg_rwstat_read_counter(struct blkg_rwstat *rwstat, | ||
| 205 | unsigned int idx) | ||
| 206 | { | ||
| 207 | return atomic64_read(&rwstat->aux_cnt[idx]) + | ||
| 208 | percpu_counter_sum_positive(&rwstat->cpu_cnt[idx]); | ||
| 209 | } | ||
| 210 | |||
| 201 | const char *blkg_dev_name(struct blkcg_gq *blkg); | 211 | const char *blkg_dev_name(struct blkcg_gq *blkg); |
| 202 | void blkcg_print_blkgs(struct seq_file *sf, struct blkcg *blkcg, | 212 | void blkcg_print_blkgs(struct seq_file *sf, struct blkcg *blkcg, |
| 203 | u64 (*prfill)(struct seq_file *, | 213 | u64 (*prfill)(struct seq_file *, |
| @@ -206,8 +216,7 @@ void blkcg_print_blkgs(struct seq_file *sf, struct blkcg *blkcg, · 2 unmodified lines | |||
| 206 | bool show_total); | 216 | bool show_total); |
| 207 | u64 __blkg_prfill_u64(struct seq_file *sf, struct blkg_policy_data *pd, u64 v); | 217 | u64 __blkg_prfill_u64(struct seq_file *sf, struct blkg_policy_data *pd, u64 v); |
| 208 | u64 __blkg_prfill_rwstat(struct seq_file *sf, struct blkg_policy_data *pd, | 218 | u64 __blkg_prfill_rwstat(struct seq_file *sf, struct blkg_policy_data *pd, |
| 209 | const struct blkg_rwstat *rwstat); | 219 | const struct blkg_rwstat_sample *rwstat); |
| 210 | u64 blkg_prfill_stat(struct seq_file *sf, struct blkg_policy_data *pd, int off); | ||
| 211 | u64 blkg_prfill_rwstat(struct seq_file *sf, struct blkg_policy_data *pd, | 220 | u64 blkg_prfill_rwstat(struct seq_file *sf, struct blkg_policy_data *pd, |
| 212 | int off); | 221 | int off); |
| 213 | int blkg_print_stat_bytes(struct seq_file *sf, void *v); | 222 | int blkg_print_stat_bytes(struct seq_file *sf, void *v); |
| @@ -215,10 +224,8 @@ int blkg_print_stat_ios(struct seq_file *sf, void *v); · 1 unmodified line | |||
| 215 | int blkg_print_stat_bytes_recursive(struct seq_file *sf, void *v); | 224 | int blkg_print_stat_bytes_recursive(struct seq_file *sf, void *v); |
| 216 | int blkg_print_stat_ios_recursive(struct seq_file *sf, void *v); | 225 | int blkg_print_stat_ios_recursive(struct seq_file *sf, void *v); |
| 217 | 226 | ||
| 218 | u64 blkg_stat_recursive_sum(struct blkcg_gq *blkg, | 227 | void blkg_rwstat_recursive_sum(struct blkcg_gq *blkg, struct blkcg_policy *pol, |
| 219 | struct blkcg_policy *pol, int off); | 228 | int off, struct blkg_rwstat_sample *sum); |
| 220 | struct blkg_rwstat blkg_rwstat_recursive_sum(struct blkcg_gq *blkg, | ||
| 221 | struct blkcg_policy *pol, int off); | ||
| 222 | 229 | ||
| 223 | struct blkg_conf_ctx { | 230 | struct blkg_conf_ctx { |
| 224 | struct gendisk *disk; | 231 | struct gendisk *disk; |
| @@ -569,69 +576,6 @@ static inline void blkg_put(struct blkcg_gq *blkg) · 344 unmodified lines | |||
| 569 | if (((d_blkg) = __blkg_lookup(css_to_blkcg(pos_css), \ | 576 | if (((d_blkg) = __blkg_lookup(css_to_blkcg(pos_css), \ |
| 570 | (p_blkg)->q, false))) | 577 | (p_blkg)->q, false))) |
| 571 | 578 | ||
| 572 | static inline int blkg_stat_init(struct blkg_stat *stat, gfp_t gfp) | ||
| 573 | { | ||
| 574 | int ret; | ||
| 575 | |||
| 576 | ret = percpu_counter_init(&stat->cpu_cnt, 0, gfp); | ||
| 577 | if (ret) | ||
| 578 | return ret; | ||
| 579 | |||
| 580 | atomic64_set(&stat->aux_cnt, 0); | ||
| 581 | return 0; | ||
| 582 | } | ||
| 583 | |||
| 584 | static inline void blkg_stat_exit(struct blkg_stat *stat) | ||
| 585 | { | ||
| 586 | percpu_counter_destroy(&stat->cpu_cnt); | ||
| 587 | } | ||
| 588 | |||
| 589 | /** | ||
| 590 | * blkg_stat_add - add a value to a blkg_stat | ||
| 591 | * @stat: target blkg_stat | ||
| 592 | * @val: value to add | ||
| 593 | * | ||
| 594 | * Add @val to @stat. The caller must ensure that IRQ on the same CPU | ||
| 595 | * don't re-enter this function for the same counter. | ||
| 596 | */ | ||
| 597 | static inline void blkg_stat_add(struct blkg_stat *stat, uint64_t val) | ||
| 598 | { | ||
| 599 | percpu_counter_add_batch(&stat->cpu_cnt, val, BLKG_STAT_CPU_BATCH); | ||
| 600 | } | ||
| 601 | |||
| 602 | /** | ||
| 603 | * blkg_stat_read - read the current value of a blkg_stat | ||
| 604 | * @stat: blkg_stat to read | ||
| 605 | */ | ||
| 606 | static inline uint64_t blkg_stat_read(struct blkg_stat *stat) | ||
| 607 | { | ||
| 608 | return percpu_counter_sum_positive(&stat->cpu_cnt); | ||
| 609 | } | ||
| 610 | |||
| 611 | /** | ||
| 612 | * blkg_stat_reset - reset a blkg_stat | ||
| 613 | * @stat: blkg_stat to reset | ||
| 614 | */ | ||
| 615 | static inline void blkg_stat_reset(struct blkg_stat *stat) | ||
| 616 | { | ||
| 617 | percpu_counter_set(&stat->cpu_cnt, 0); | ||
| 618 | atomic64_set(&stat->aux_cnt, 0); | ||
| 619 | } | ||
| 620 | |||
| 621 | /** | ||
| 622 | * blkg_stat_add_aux - add a blkg_stat into another's aux count | ||
| 623 | * @to: the destination blkg_stat | ||
| 624 | * @from: the source | ||
| 625 | * | ||
| 626 | * Add @from's count including the aux one to @to's aux count. | ||
| 627 | */ | ||
| 628 | static inline void blkg_stat_add_aux(struct blkg_stat *to, | ||
| 629 | struct blkg_stat *from) | ||
| 630 | { | ||
| 631 | atomic64_add(blkg_stat_read(from) + atomic64_read(&from->aux_cnt), | ||
| 632 | &to->aux_cnt); | ||
| 633 | } | ||
| 634 | |||
| 635 | static inline int blkg_rwstat_init(struct blkg_rwstat *rwstat, gfp_t gfp) | 579 | static inline int blkg_rwstat_init(struct blkg_rwstat *rwstat, gfp_t gfp) |
| 636 | { | 580 | { |
| 637 | int i, ret; | 581 | int i, ret; |
| @@ -693,15 +637,14 @@ static inline void blkg_rwstat_add(struct blkg_rwstat *rwstat, · 55 unmodified lines | |||
| 693 | * | 637 | * |
| 694 | * Read the current snapshot of @rwstat and return it in the aux counts. | 638 | * Read the current snapshot of @rwstat and return it in the aux counts. |
| 695 | */ | 639 | */ |
| 696 | static inline struct blkg_rwstat blkg_rwstat_read(struct blkg_rwstat *rwstat) | 640 | static inline void blkg_rwstat_read(struct blkg_rwstat *rwstat, |
| 641 | struct blkg_rwstat_sample *result) | ||
| 697 | { | 642 | { |
| 698 | struct blkg_rwstat result; | ||
| 699 | int i; | 643 | int i; |
| 700 | 644 | ||
| 701 | for (i = 0; i < BLKG_RWSTAT_NR; i++) | 645 | for (i = 0; i < BLKG_RWSTAT_NR; i++) |
| 702 | atomic64_set(&result.aux_cnt[i], | 646 | result->cnt[i] = |
| 703 | percpu_counter_sum_positive(&rwstat->cpu_cnt[i])); | 647 | percpu_counter_sum_positive(&rwstat->cpu_cnt[i]); |
| 704 | return result; | ||
| 705 | } | 648 | } |
| 706 | 649 | ||
| 707 | /** | 650 | /** |
| @@ -714,10 +657,10 @@ static inline struct blkg_rwstat blkg_rwstat_read(struct blkg_rwstat *rwstat) · 6 unmodified lines | |||
| 714 | */ | 657 | */ |
| 715 | static inline uint64_t blkg_rwstat_total(struct blkg_rwstat *rwstat) | 658 | static inline uint64_t blkg_rwstat_total(struct blkg_rwstat *rwstat) |
| 716 | { | 659 | { |
| 717 | struct blkg_rwstat tmp = blkg_rwstat_read(rwstat); | 660 | struct blkg_rwstat_sample tmp = { }; |
| 718 | 661 | ||
| 719 | return atomic64_read(&tmp.aux_cnt[BLKG_RWSTAT_READ]) + | 662 | blkg_rwstat_read(rwstat, &tmp); |
| 720 | atomic64_read(&tmp.aux_cnt[BLKG_RWSTAT_WRITE]); | 663 | return tmp.cnt[BLKG_RWSTAT_READ] + tmp.cnt[BLKG_RWSTAT_WRITE]; |
| 721 | } | 664 | } |
| 722 | 665 | ||
| 723 | /** | 666 | /** |
| @@ -763,6 +706,15 @@ static inline bool blk_throtl_bio(struct request_queue *q, struct blkcg_gq *blkg · 39 unmodified lines | |||
| 763 | struct bio *bio) { return false; } | 706 | struct bio *bio) { return false; } |
| 764 | #endif | 707 | #endif |
| 765 | 708 | ||
| 709 | bool __blkcg_punt_bio_submit(struct bio *bio); | ||
| 710 | |||
| 711 | static inline bool blkcg_punt_bio_submit(struct bio *bio) | ||
| 712 | { | ||
| 713 | if (bio->bi_opf & REQ_CGROUP_PUNT) | ||
| 714 | return __blkcg_punt_bio_submit(bio); | ||
| 715 | else | ||
| 716 | return false; | ||
| 717 | } | ||
| 766 | 718 | ||
| 767 | static inline void blkcg_bio_issue_init(struct bio *bio) | 719 | static inline void blkcg_bio_issue_init(struct bio *bio) |
| 768 | { | 720 | { |
| @@ -910,6 +862,7 @@ static inline char *blkg_path(struct blkcg_gq *blkg) { return NULL; } · 141 unmodified lines | |||
| 910 | static inline void blkg_get(struct blkcg_gq *blkg) { } | 862 | static inline void blkg_get(struct blkcg_gq *blkg) { } |
| 911 | static inline void blkg_put(struct blkcg_gq *blkg) { } | 863 | static inline void blkg_put(struct blkcg_gq *blkg) { } |
| 912 | 864 | ||
| 865 | static inline bool blkcg_punt_bio_submit(struct bio *bio) { return false; } | ||
| 913 | static inline void blkcg_bio_issue_init(struct bio *bio) { } | 866 | static inline void blkcg_bio_issue_init(struct bio *bio) { } |
| 914 | static inline bool blkcg_bio_issue_check(struct request_queue *q, | 867 | static inline bool blkcg_bio_issue_check(struct request_queue *q, |
| 915 | struct bio *bio) { return true; } | 868 | struct bio *bio) { return true; } |
| @@ -306,7 +306,7 @@ void blk_mq_delay_kick_requeue_list(struct request_queue *q, unsigned long msecs · 305 unmodified lines | |||
| 306 | bool blk_mq_complete_request(struct request *rq); | 306 | bool blk_mq_complete_request(struct request *rq); |
| 307 | void blk_mq_complete_request_sync(struct request *rq); | 307 | void blk_mq_complete_request_sync(struct request *rq); |
| 308 | bool blk_mq_bio_list_merge(struct request_queue *q, struct list_head *list, | 308 | bool blk_mq_bio_list_merge(struct request_queue *q, struct list_head *list, |
| 309 | struct bio *bio); | 309 | struct bio *bio, unsigned int nr_segs); |
| 310 | bool blk_mq_queue_stopped(struct request_queue *q); | 310 | bool blk_mq_queue_stopped(struct request_queue *q); |
| 311 | void blk_mq_stop_hw_queue(struct blk_mq_hw_ctx *hctx); | 311 | void blk_mq_stop_hw_queue(struct blk_mq_hw_ctx *hctx); |
| 312 | void blk_mq_start_hw_queue(struct blk_mq_hw_ctx *hctx); | 312 | void blk_mq_start_hw_queue(struct blk_mq_hw_ctx *hctx); |
| @@ -154,11 +154,6 @@ struct bio { · 153 unmodified lines | |||
| 154 | blk_status_t bi_status; | 154 | blk_status_t bi_status; |
| 155 | u8 bi_partno; | 155 | u8 bi_partno; |
| 156 | 156 | ||
| 157 | /* Number of segments in this BIO after | ||
| 158 | * physical address coalescing is performed. | ||
| 159 | */ | ||
| 160 | unsigned int bi_phys_segments; | ||
| 161 | |||
| 162 | struct bvec_iter bi_iter; | 157 | struct bvec_iter bi_iter; |
| 163 | 158 | ||
| 164 | atomic_t __bi_remaining; | 159 | atomic_t __bi_remaining; |
| @@ -210,7 +205,6 @@ struct bio { · 45 unmodified lines | |||
| 210 | */ | 205 | */ |
| 211 | enum { | 206 | enum { |
| 212 | BIO_NO_PAGE_REF, /* don't put release vec pages */ | 207 | BIO_NO_PAGE_REF, /* don't put release vec pages */ |
| 213 | BIO_SEG_VALID, /* bi_phys_segments valid */ | ||
| 214 | BIO_CLONED, /* doesn't own data */ | 208 | BIO_CLONED, /* doesn't own data */ |
| 215 | BIO_BOUNCED, /* bio is a bounce bio */ | 209 | BIO_BOUNCED, /* bio is a bounce bio */ |
| 216 | BIO_USER_MAPPED, /* contains user pages */ | 210 | BIO_USER_MAPPED, /* contains user pages */ |
| @@ -317,6 +311,15 @@ enum req_flag_bits { · 100 unmodified lines | |||
| 317 | __REQ_RAHEAD, /* read ahead, can fail anytime */ | 311 | __REQ_RAHEAD, /* read ahead, can fail anytime */ |
| 318 | __REQ_BACKGROUND, /* background IO */ | 312 | __REQ_BACKGROUND, /* background IO */ |
| 319 | __REQ_NOWAIT, /* Don't wait if request will block */ | 313 | __REQ_NOWAIT, /* Don't wait if request will block */ |
| 314 | __REQ_NOWAIT_INLINE, /* Return would-block error inline */ | ||
| 315 | /* | ||
| 316 | * When a shared kthread needs to issue a bio for a cgroup, doing | ||
| 317 | * so synchronously can lead to priority inversions as the kthread | ||
| 318 | * can be trapped waiting for that cgroup. CGROUP_PUNT flag makes | ||
| 319 | * submit_bio() punt the actual issuing to a dedicated per-blkcg | ||
| 320 | * work item to avoid such priority inversions. | ||
| 321 | */ | ||
| 322 | __REQ_CGROUP_PUNT, | ||
| 320 | 323 | ||
| 321 | /* command specific flags for REQ_OP_WRITE_ZEROES: */ | 324 | /* command specific flags for REQ_OP_WRITE_ZEROES: */ |
| 322 | __REQ_NOUNMAP, /* do not free blocks when zeroing */ | 325 | __REQ_NOUNMAP, /* do not free blocks when zeroing */ |
| @@ -343,6 +346,9 @@ enum req_flag_bits { · 20 unmodified lines | |||
| 343 | #define REQ_RAHEAD (1ULL << __REQ_RAHEAD) | 346 | #define REQ_RAHEAD (1ULL << __REQ_RAHEAD) |
| 344 | #define REQ_BACKGROUND (1ULL << __REQ_BACKGROUND) | 347 | #define REQ_BACKGROUND (1ULL << __REQ_BACKGROUND) |
| 345 | #define REQ_NOWAIT (1ULL << __REQ_NOWAIT) | 348 | #define REQ_NOWAIT (1ULL << __REQ_NOWAIT) |
| 349 | #define REQ_NOWAIT_INLINE (1ULL << __REQ_NOWAIT_INLINE) | ||
| 350 | #define REQ_CGROUP_PUNT (1ULL << __REQ_CGROUP_PUNT) | ||
| 351 | |||
| 346 | #define REQ_NOUNMAP (1ULL << __REQ_NOUNMAP) | 352 | #define REQ_NOUNMAP (1ULL << __REQ_NOUNMAP) |
| 347 | #define REQ_HIPRI (1ULL << __REQ_HIPRI) | 353 | #define REQ_HIPRI (1ULL << __REQ_HIPRI) |
| 348 | 354 | ||
| @@ -414,12 +420,13 @@ static inline int op_stat_group(unsigned int op) · 65 unmodified lines | |||
| 414 | 420 | ||
| 415 | typedef unsigned int blk_qc_t; | 421 | typedef unsigned int blk_qc_t; |
| 416 | #define BLK_QC_T_NONE -1U | 422 | #define BLK_QC_T_NONE -1U |
| 423 | #define BLK_QC_T_EAGAIN -2U | ||
| 417 | #define BLK_QC_T_SHIFT 16 | 424 | #define BLK_QC_T_SHIFT 16 |
| 418 | #define BLK_QC_T_INTERNAL (1U << 31) | 425 | #define BLK_QC_T_INTERNAL (1U << 31) |
| 419 | 426 | ||
| 420 | static inline bool blk_qc_t_valid(blk_qc_t cookie) | 427 | static inline bool blk_qc_t_valid(blk_qc_t cookie) |
| 421 | { | 428 | { |
| 422 | return cookie != BLK_QC_T_NONE; | 429 | return cookie != BLK_QC_T_NONE && cookie != BLK_QC_T_EAGAIN; |
| 423 | } | 430 | } |
| 424 | 431 | ||
| 425 | static inline unsigned int blk_qc_t_to_queue_num(blk_qc_t cookie) | 432 | static inline unsigned int blk_qc_t_to_queue_num(blk_qc_t cookie) |
| @@ -137,11 +137,11 @@ struct request { · 136 unmodified lines | |||
| 137 | unsigned int cmd_flags; /* op and common flags */ | 137 | unsigned int cmd_flags; /* op and common flags */ |
| 138 | req_flags_t rq_flags; | 138 | req_flags_t rq_flags; |
| 139 | 139 | ||
| 140 | int tag; | ||
| 140 | int internal_tag; | 141 | int internal_tag; |
| 141 | 142 | ||
| 142 | /* the following two fields are internal, NEVER access directly */ | 143 | /* the following two fields are internal, NEVER access directly */ |
| 143 | unsigned int __data_len; /* total data len */ | 144 | unsigned int __data_len; /* total data len */ |
| 144 | int tag; | ||
| 145 | sector_t __sector; /* sector cursor */ | 145 | sector_t __sector; /* sector cursor */ |
| 146 | 146 | ||
| 147 | struct bio *bio; | 147 | struct bio *bio; |
| @@ -344,10 +344,15 @@ struct queue_limits { · 196 unmodified lines | |||
| 344 | 344 | ||
| 345 | #ifdef CONFIG_BLK_DEV_ZONED | 345 | #ifdef CONFIG_BLK_DEV_ZONED |
| 346 | 346 | ||
| 347 | /* | ||
| 348 | * Maximum number of zones to report with a single report zones command. | ||
| 349 | */ | ||
| 350 | #define BLK_ZONED_REPORT_MAX_ZONES 8192U | ||
| 351 | |||
| 347 | extern unsigned int blkdev_nr_zones(struct block_device *bdev); | 352 | extern unsigned int blkdev_nr_zones(struct block_device *bdev); |
| 348 | extern int blkdev_report_zones(struct block_device *bdev, | 353 | extern int blkdev_report_zones(struct block_device *bdev, |
| 349 | sector_t sector, struct blk_zone *zones, | 354 | sector_t sector, struct blk_zone *zones, |
| 350 | unsigned int *nr_zones, gfp_t gfp_mask); | 355 | unsigned int *nr_zones); |
| 351 | extern int blkdev_reset_zones(struct block_device *bdev, sector_t sectors, | 356 | extern int blkdev_reset_zones(struct block_device *bdev, sector_t sectors, |
| 352 | sector_t nr_sectors, gfp_t gfp_mask); | 357 | sector_t nr_sectors, gfp_t gfp_mask); |
| 353 | extern int blk_revalidate_disk_zones(struct gendisk *disk); | 358 | extern int blk_revalidate_disk_zones(struct gendisk *disk); |
| @@ -681,7 +686,7 @@ static inline bool blk_queue_is_zoned(struct request_queue *q) · 327 unmodified lines | |||
| 681 | } | 686 | } |
| 682 | } | 687 | } |
| 683 | 688 | ||
| 684 | static inline unsigned int blk_queue_zone_sectors(struct request_queue *q) | 689 | static inline sector_t blk_queue_zone_sectors(struct request_queue *q) |
| 685 | { | 690 | { |
| 686 | return blk_queue_is_zoned(q) ? q->limits.chunk_sectors : 0; | 691 | return blk_queue_is_zoned(q) ? q->limits.chunk_sectors : 0; |
| 687 | } | 692 | } |
| @@ -828,7 +833,6 @@ extern void blk_unregister_queue(struct gendisk *disk); · 140 unmodified lines | |||
| 828 | extern blk_qc_t generic_make_request(struct bio *bio); | 833 | extern blk_qc_t generic_make_request(struct bio *bio); |
| 829 | extern blk_qc_t direct_make_request(struct bio *bio); | 834 | extern blk_qc_t direct_make_request(struct bio *bio); |
| 830 | extern void blk_rq_init(struct request_queue *q, struct request *rq); | 835 | extern void blk_rq_init(struct request_queue *q, struct request *rq); |
| 831 | extern void blk_init_request_from_bio(struct request *req, struct bio *bio); | ||
| 832 | extern void blk_put_request(struct request *); | 836 | extern void blk_put_request(struct request *); |
| 833 | extern struct request *blk_get_request(struct request_queue *, unsigned int op, | 837 | extern struct request *blk_get_request(struct request_queue *, unsigned int op, |
| 834 | blk_mq_req_flags_t flags); | 838 | blk_mq_req_flags_t flags); |
| @@ -842,7 +846,6 @@ extern blk_status_t blk_insert_cloned_request(struct request_queue *q, · 7 unmodified lines | |||
| 842 | struct request *rq); | 846 | struct request *rq); |
| 843 | extern int blk_rq_append_bio(struct request *rq, struct bio **bio); | 847 | extern int blk_rq_append_bio(struct request *rq, struct bio **bio); |
| 844 | extern void blk_queue_split(struct request_queue *, struct bio **); | 848 | extern void blk_queue_split(struct request_queue *, struct bio **); |
| 845 | extern void blk_recount_segments(struct request_queue *, struct bio *); | ||
| 846 | extern int scsi_verify_blk_ioctl(struct block_device *, unsigned int); | 849 | extern int scsi_verify_blk_ioctl(struct block_device *, unsigned int); |
| 847 | extern int scsi_cmd_blk_ioctl(struct block_device *, fmode_t, | 850 | extern int scsi_cmd_blk_ioctl(struct block_device *, fmode_t, |
| 848 | unsigned int, void __user *); | 851 | unsigned int, void __user *); |
| @@ -867,6 +870,9 @@ extern void blk_execute_rq(struct request_queue *, struct gendisk *, · 18 unmodified lines | |||
| 867 | extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *, | 870 | extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *, |
| 868 | struct request *, int, rq_end_io_fn *); | 871 | struct request *, int, rq_end_io_fn *); |
| 869 | 872 | ||
| 873 | /* Helper to convert REQ_OP_XXX to its string format XXX */ | ||
| 874 | extern const char *blk_op_str(unsigned int op); | ||
| 875 | |||
| 870 | int blk_status_to_errno(blk_status_t status); | 876 | int blk_status_to_errno(blk_status_t status); |
| 871 | blk_status_t errno_to_blk_status(int errno); | 877 | blk_status_t errno_to_blk_status(int errno); |
| 872 | 878 | ||
| @@ -1026,21 +1032,9 @@ void blk_steal_bios(struct bio_list *list, struct request *rq); · 153 unmodified lines | |||
| 1026 | * | 1032 | * |
| 1027 | * blk_update_request() completes given number of bytes and updates | 1033 | * blk_update_request() completes given number of bytes and updates |
| 1028 | * the request without completing it. | 1034 | * the request without completing it. |
| 1029 | * | ||
| 1030 | * blk_end_request() and friends. __blk_end_request() must be called | ||
| 1031 | * with the request queue spinlock acquired. | ||
| 1032 | * | ||
| 1033 | * Several drivers define their own end_request and call | ||
| 1034 | * blk_end_request() for parts of the original function. | ||
| 1035 | * This prevents code duplication in drivers. | ||
| 1036 | */ | 1035 | */ |
| 1037 | extern bool blk_update_request(struct request *rq, blk_status_t error, | 1036 | extern bool blk_update_request(struct request *rq, blk_status_t error, |
| 1038 | unsigned int nr_bytes); | 1037 | unsigned int nr_bytes); |
| 1039 | extern void blk_end_request_all(struct request *rq, blk_status_t error); | ||
| 1040 | extern bool __blk_end_request(struct request *rq, blk_status_t error, | ||
| 1041 | unsigned int nr_bytes); | ||
| 1042 | extern void __blk_end_request_all(struct request *rq, blk_status_t error); | ||
| 1043 | extern bool __blk_end_request_cur(struct request *rq, blk_status_t error); | ||
| 1044 | 1038 | ||
| 1045 | extern void __blk_complete_request(struct request *); | 1039 | extern void __blk_complete_request(struct request *); |
| 1046 | extern void blk_abort_request(struct request *); | 1040 | extern void blk_abort_request(struct request *); |
| @@ -1429,7 +1423,7 @@ static inline bool bdev_is_zoned(struct block_device *bdev) · 382 unmodified lines | |||
| 1429 | return false; | 1423 | return false; |
| 1430 | } | 1424 | } |
| 1431 | 1425 | ||
| 1432 | static inline unsigned int bdev_zone_sectors(struct block_device *bdev) | 1426 | static inline sector_t bdev_zone_sectors(struct block_device *bdev) |
| 1433 | { | 1427 | { |
| 1434 | struct request_queue *q = bdev_get_queue(bdev); | 1428 | struct request_queue *q = bdev_get_queue(bdev); |
| 1435 | 1429 | ||
| @@ -1684,8 +1678,7 @@ struct block_device_operations { · 248 unmodified lines | |||
| 1684 | /* this callback is with swap_lock and sometimes page table lock held */ | 1678 | /* this callback is with swap_lock and sometimes page table lock held */ |
| 1685 | void (*swap_slot_free_notify) (struct block_device *, unsigned long); | 1679 | void (*swap_slot_free_notify) (struct block_device *, unsigned long); |
| 1686 | int (*report_zones)(struct gendisk *, sector_t sector, | 1680 | int (*report_zones)(struct gendisk *, sector_t sector, |
| 1687 | struct blk_zone *zones, unsigned int *nr_zones, | 1681 | struct blk_zone *zones, unsigned int *nr_zones); |
| 1688 | gfp_t gfp_mask); | ||
| 1689 | struct module *owner; | 1682 | struct module *owner; |
| 1690 | const struct pr_ops *pr_ops; | 1683 | const struct pr_ops *pr_ops; |
| 1691 | }; | 1684 | }; |
| @@ -6,6 +6,7 @@ · 5 unmodified lines | |||
| 6 | #include <linux/errno.h> | 6 | #include <linux/errno.h> |
| 7 | #include <linux/jump_label.h> | 7 | #include <linux/jump_label.h> |
| 8 | #include <linux/percpu.h> | 8 | #include <linux/percpu.h> |
| 9 | #include <linux/percpu-refcount.h> | ||
| 9 | #include <linux/rbtree.h> | 10 | #include <linux/rbtree.h> |
| 10 | #include <uapi/linux/bpf.h> | 11 | #include <uapi/linux/bpf.h> |
| 11 | 12 | ||
| @@ -71,11 +72,17 @@ struct cgroup_bpf { · 59 unmodified lines | |||
| 71 | u32 flags[MAX_BPF_ATTACH_TYPE]; | 72 | u32 flags[MAX_BPF_ATTACH_TYPE]; |
| 72 | 73 | ||
| 73 | /* temp storage for effective prog array used by prog_attach/detach */ | 74 | /* temp storage for effective prog array used by prog_attach/detach */ |
| 74 | struct bpf_prog_array __rcu *inactive; | 75 | struct bpf_prog_array *inactive; |
| 76 | |||
| 77 | /* reference counter used to detach bpf programs after cgroup removal */ | ||
| 78 | struct percpu_ref refcnt; | ||
| 79 | |||
| 80 | /* cgroup_bpf is released using a work queue */ | ||
| 81 | struct work_struct release_work; | ||
| 75 | }; | 82 | }; |
| 76 | 83 | ||
| 77 | void cgroup_bpf_put(struct cgroup *cgrp); | ||
| 78 | int cgroup_bpf_inherit(struct cgroup *cgrp); | 84 | int cgroup_bpf_inherit(struct cgroup *cgrp); |
| 85 | void cgroup_bpf_offline(struct cgroup *cgrp); | ||
| 79 | 86 | ||
| 80 | int __cgroup_bpf_attach(struct cgroup *cgrp, struct bpf_prog *prog, | 87 | int __cgroup_bpf_attach(struct cgroup *cgrp, struct bpf_prog *prog, |
| 81 | enum bpf_attach_type type, u32 flags); | 88 | enum bpf_attach_type type, u32 flags); |
| @@ -117,6 +124,14 @@ int __cgroup_bpf_run_filter_sysctl(struct ctl_table_header *head, · 35 unmodified lines | |||
| 117 | loff_t *ppos, void **new_buf, | 124 | loff_t *ppos, void **new_buf, |
| 118 | enum bpf_attach_type type); | 125 | enum bpf_attach_type type); |
| 119 | 126 | ||
| 127 | int __cgroup_bpf_run_filter_setsockopt(struct sock *sock, int *level, | ||
| 128 | int *optname, char __user *optval, | ||
| 129 | int *optlen, char **kernel_optval); | ||
| 130 | int __cgroup_bpf_run_filter_getsockopt(struct sock *sk, int level, | ||
| 131 | int optname, char __user *optval, | ||
| 132 | int __user *optlen, int max_optlen, | ||
| 133 | int retval); | ||
| 134 | |||
| 120 | static inline enum bpf_cgroup_storage_type cgroup_storage_type( | 135 | static inline enum bpf_cgroup_storage_type cgroup_storage_type( |
| 121 | struct bpf_map *map) | 136 | struct bpf_map *map) |
| 122 | { | 137 | { |
| @@ -279,6 +294,38 @@ int bpf_percpu_cgroup_storage_update(struct bpf_map *map, void *key, · 156 unmodified lines | |||
| 279 | __ret; \ | 294 | __ret; \ |
| 280 | }) | 295 | }) |
| 281 | 296 | ||
| 297 | #define BPF_CGROUP_RUN_PROG_SETSOCKOPT(sock, level, optname, optval, optlen, \ | ||
| 298 | kernel_optval) \ | ||
| 299 | ({ \ | ||
| 300 | int __ret = 0; \ | ||
| 301 | if (cgroup_bpf_enabled) \ | ||
| 302 | __ret = __cgroup_bpf_run_filter_setsockopt(sock, level, \ | ||
| 303 | optname, optval, \ | ||
| 304 | optlen, \ | ||
| 305 | kernel_optval); \ | ||
| 306 | __ret; \ | ||
| 307 | }) | ||
| 308 | |||
| 309 | #define BPF_CGROUP_GETSOCKOPT_MAX_OPTLEN(optlen) \ | ||
| 310 | ({ \ | ||
| 311 | int __ret = 0; \ | ||
| 312 | if (cgroup_bpf_enabled) \ | ||
| 313 | get_user(__ret, optlen); \ | ||
| 314 | __ret; \ | ||
| 315 | }) | ||
| 316 | |||
| 317 | #define BPF_CGROUP_RUN_PROG_GETSOCKOPT(sock, level, optname, optval, optlen, \ | ||
| 318 | max_optlen, retval) \ | ||
| 319 | ({ \ | ||
| 320 | int __ret = retval; \ | ||
| 321 | if (cgroup_bpf_enabled) \ | ||
| 322 | __ret = __cgroup_bpf_run_filter_getsockopt(sock, level, \ | ||
| 323 | optname, optval, \ | ||
| 324 | optlen, max_optlen, \ | ||
| 325 | retval); \ | ||
| 326 | __ret; \ | ||
| 327 | }) | ||
| 328 | |||
| 282 | int cgroup_bpf_prog_attach(const union bpf_attr *attr, | 329 | int cgroup_bpf_prog_attach(const union bpf_attr *attr, |
| 283 | enum bpf_prog_type ptype, struct bpf_prog *prog); | 330 | enum bpf_prog_type ptype, struct bpf_prog *prog); |
| 284 | int cgroup_bpf_prog_detach(const union bpf_attr *attr, | 331 | int cgroup_bpf_prog_detach(const union bpf_attr *attr, |
| @@ -289,8 +336,8 @@ int cgroup_bpf_prog_query(const union bpf_attr *attr, · 4 unmodified lines | |||
| 289 | 336 | ||
| 290 | struct bpf_prog; | 337 | struct bpf_prog; |
| 291 | struct cgroup_bpf {}; | 338 | struct cgroup_bpf {}; |
| 292 | static inline void cgroup_bpf_put(struct cgroup *cgrp) {} | ||
| 293 | static inline int cgroup_bpf_inherit(struct cgroup *cgrp) { return 0; } | 339 | static inline int cgroup_bpf_inherit(struct cgroup *cgrp) { return 0; } |
| 340 | static inline void cgroup_bpf_offline(struct cgroup *cgrp) {} | ||
| 294 | 341 | ||
| 295 | static inline int cgroup_bpf_prog_attach(const union bpf_attr *attr, | 342 | static inline int cgroup_bpf_prog_attach(const union bpf_attr *attr, |
| 296 | enum bpf_prog_type ptype, | 343 | enum bpf_prog_type ptype, |
| @@ -350,6 +397,11 @@ static inline int bpf_percpu_cgroup_storage_update(struct bpf_map *map, · 53 unmodified lines | |||
| 350 | #define BPF_CGROUP_RUN_PROG_SOCK_OPS(sock_ops) ({ 0; }) | 397 | #define BPF_CGROUP_RUN_PROG_SOCK_OPS(sock_ops) ({ 0; }) |
| 351 | #define BPF_CGROUP_RUN_PROG_DEVICE_CGROUP(type,major,minor,access) ({ 0; }) | 398 | #define BPF_CGROUP_RUN_PROG_DEVICE_CGROUP(type,major,minor,access) ({ 0; }) |
| 352 | #define BPF_CGROUP_RUN_PROG_SYSCTL(head,table,write,buf,count,pos,nbuf) ({ 0; }) | 399 | #define BPF_CGROUP_RUN_PROG_SYSCTL(head,table,write,buf,count,pos,nbuf) ({ 0; }) |
| 400 | #define BPF_CGROUP_GETSOCKOPT_MAX_OPTLEN(optlen) ({ 0; }) | ||
| 401 | #define BPF_CGROUP_RUN_PROG_GETSOCKOPT(sock, level, optname, optval, \ | ||
| 402 | optlen, max_optlen, retval) ({ retval; }) | ||
| 403 | #define BPF_CGROUP_RUN_PROG_SETSOCKOPT(sock, level, optname, optval, optlen, \ | ||
| 404 | kernel_optval) ({ 0; }) | ||
| 353 | 405 | ||
| 354 | #define for_each_cgroup_storage_type(stype) for (; false; ) | 406 | #define for_each_cgroup_storage_type(stype) for (; false; ) |
| 355 | 407 | ||
| @@ -63,6 +63,11 @@ struct bpf_map_ops { · 62 unmodified lines | |||
| 63 | u64 imm, u32 *off); | 63 | u64 imm, u32 *off); |
| 64 | }; | 64 | }; |
| 65 | 65 | ||
| 66 | struct bpf_map_memory { | ||
| 67 | u32 pages; | ||
| 68 | struct user_struct *user; | ||
| 69 | }; | ||
| 70 | |||
| 66 | struct bpf_map { | 71 | struct bpf_map { |
| 67 | /* The first two cachelines with read-mostly members of which some | 72 | /* The first two cachelines with read-mostly members of which some |
| 68 | * are also accessed in fast-path (e.g. ops, max_entries). | 73 | * are also accessed in fast-path (e.g. ops, max_entries). |
| @@ -83,7 +88,7 @@ struct bpf_map { · 14 unmodified lines | |||
| 83 | u32 btf_key_type_id; | 88 | u32 btf_key_type_id; |
| 84 | u32 btf_value_type_id; | 89 | u32 btf_value_type_id; |
| 85 | struct btf *btf; | 90 | struct btf *btf; |
| 86 | u32 pages; | 91 | struct bpf_map_memory memory; |
| 87 | bool unpriv_array; | 92 | bool unpriv_array; |
| 88 | bool frozen; /* write-once */ | 93 | bool frozen; /* write-once */ |
| 89 | /* 48 bytes hole */ | 94 | /* 48 bytes hole */ |
| @@ -91,8 +96,7 @@ struct bpf_map { · 1 unmodified line | |||
| 91 | /* The 3rd and 4th cacheline with misc members to avoid false sharing | 96 | /* The 3rd and 4th cacheline with misc members to avoid false sharing |
| 92 | * particularly with refcounting. | 97 | * particularly with refcounting. |
| 93 | */ | 98 | */ |
| 94 | struct user_struct *user ____cacheline_aligned; | 99 | atomic_t refcnt ____cacheline_aligned; |
| 95 | atomic_t refcnt; | ||
| 96 | atomic_t usercnt; | 100 | atomic_t usercnt; |
| 97 | struct work_struct work; | 101 | struct work_struct work; |
| 98 | char name[BPF_OBJ_NAME_LEN]; | 102 | char name[BPF_OBJ_NAME_LEN]; |
| @@ -273,6 +277,7 @@ enum bpf_reg_type { · 174 unmodified lines | |||
| 273 | PTR_TO_TCP_SOCK, /* reg points to struct tcp_sock */ | 277 | PTR_TO_TCP_SOCK, /* reg points to struct tcp_sock */ |
| 274 | PTR_TO_TCP_SOCK_OR_NULL, /* reg points to struct tcp_sock or NULL */ | 278 | PTR_TO_TCP_SOCK_OR_NULL, /* reg points to struct tcp_sock or NULL */ |
| 275 | PTR_TO_TP_BUFFER, /* reg points to a writable raw tp's buffer */ | 279 | PTR_TO_TP_BUFFER, /* reg points to a writable raw tp's buffer */ |
| 280 | PTR_TO_XDP_SOCK, /* reg points to struct xdp_sock */ | ||
| 276 | }; | 281 | }; |
| 277 | 282 | ||
| 278 | /* The information passed from prog-specific *_is_valid_access | 283 | /* The information passed from prog-specific *_is_valid_access |
| @@ -367,6 +372,7 @@ struct bpf_prog_aux { · 88 unmodified lines | |||
| 367 | u32 id; | 372 | u32 id; |
| 368 | u32 func_cnt; /* used by non-func prog as the number of func progs */ | 373 | u32 func_cnt; /* used by non-func prog as the number of func progs */ |
| 369 | u32 func_idx; /* 0 for non-func prog, the index in func array for func prog */ | 374 | u32 func_idx; /* 0 for non-func prog, the index in func array for func prog */ |
| 375 | bool verifier_zext; /* Zero extensions has been inserted by verifier. */ | ||
| 370 | bool offload_requested; | 376 | bool offload_requested; |
| 371 | struct bpf_prog **func; | 377 | struct bpf_prog **func; |
| 372 | void *jit_data; /* JIT specific data. arch dependent */ | 378 | void *jit_data; /* JIT specific data. arch dependent */ |
| @@ -510,17 +516,18 @@ struct bpf_prog_array { · 137 unmodified lines | |||
| 510 | }; | 516 | }; |
| 511 | 517 | ||
| 512 | struct bpf_prog_array *bpf_prog_array_alloc(u32 prog_cnt, gfp_t flags); | 518 | struct bpf_prog_array *bpf_prog_array_alloc(u32 prog_cnt, gfp_t flags); |
| 513 | void bpf_prog_array_free(struct bpf_prog_array __rcu *progs); | 519 | void bpf_prog_array_free(struct bpf_prog_array *progs); |
| 514 | int bpf_prog_array_length(struct bpf_prog_array __rcu *progs); | 520 | int bpf_prog_array_length(struct bpf_prog_array *progs); |
| 515 | int bpf_prog_array_copy_to_user(struct bpf_prog_array __rcu *progs, | 521 | bool bpf_prog_array_is_empty(struct bpf_prog_array *array); |
| 522 | int bpf_prog_array_copy_to_user(struct bpf_prog_array *progs, | ||
| 516 | __u32 __user *prog_ids, u32 cnt); | 523 | __u32 __user *prog_ids, u32 cnt); |
| 517 | 524 | ||
| 518 | void bpf_prog_array_delete_safe(struct bpf_prog_array __rcu *progs, | 525 | void bpf_prog_array_delete_safe(struct bpf_prog_array *progs, |
| 519 | struct bpf_prog *old_prog); | 526 | struct bpf_prog *old_prog); |
| 520 | int bpf_prog_array_copy_info(struct bpf_prog_array __rcu *array, | 527 | int bpf_prog_array_copy_info(struct bpf_prog_array *array, |
| 521 | u32 *prog_ids, u32 request_cnt, | 528 | u32 *prog_ids, u32 request_cnt, |
| 522 | u32 *prog_cnt); | 529 | u32 *prog_cnt); |
| 523 | int bpf_prog_array_copy(struct bpf_prog_array __rcu *old_array, | 530 | int bpf_prog_array_copy(struct bpf_prog_array *old_array, |
| 524 | struct bpf_prog *exclude_prog, | 531 | struct bpf_prog *exclude_prog, |
| 525 | struct bpf_prog *include_prog, | 532 | struct bpf_prog *include_prog, |
| 526 | struct bpf_prog_array **new_array); | 533 | struct bpf_prog_array **new_array); |
| @@ -548,6 +555,56 @@ _out: \ · 21 unmodified lines | |||
| 548 | _ret; \ | 555 | _ret; \ |
| 549 | }) | 556 | }) |
| 550 | 557 | ||
| 558 | /* To be used by __cgroup_bpf_run_filter_skb for EGRESS BPF progs | ||
| 559 | * so BPF programs can request cwr for TCP packets. | ||
| 560 | * | ||
| 561 | * Current cgroup skb programs can only return 0 or 1 (0 to drop the | ||
| 562 | * packet. This macro changes the behavior so the low order bit | ||
| 563 | * indicates whether the packet should be dropped (0) or not (1) | ||
| 564 | * and the next bit is a congestion notification bit. This could be | ||
| 565 | * used by TCP to call tcp_enter_cwr() | ||
| 566 | * | ||
| 567 | * Hence, new allowed return values of CGROUP EGRESS BPF programs are: | ||
| 568 | * 0: drop packet | ||
| 569 | * 1: keep packet | ||
| 570 | * 2: drop packet and cn | ||
| 571 | * 3: keep packet and cn | ||
| 572 | * | ||
| 573 | * This macro then converts it to one of the NET_XMIT or an error | ||
| 574 | * code that is then interpreted as drop packet (and no cn): | ||
| 575 | * 0: NET_XMIT_SUCCESS skb should be transmitted | ||
| 576 | * 1: NET_XMIT_DROP skb should be dropped and cn | ||
| 577 | * 2: NET_XMIT_CN skb should be transmitted and cn | ||
| 578 | * 3: -EPERM skb should be dropped | ||
| 579 | */ | ||
| 580 | #define BPF_PROG_CGROUP_INET_EGRESS_RUN_ARRAY(array, ctx, func) \ | ||
| 581 | ({ \ | ||
| 582 | struct bpf_prog_array_item *_item; \ | ||
| 583 | struct bpf_prog *_prog; \ | ||
| 584 | struct bpf_prog_array *_array; \ | ||
| 585 | u32 ret; \ | ||
| 586 | u32 _ret = 1; \ | ||
| 587 | u32 _cn = 0; \ | ||
| 588 | preempt_disable(); \ | ||
| 589 | rcu_read_lock(); \ | ||
| 590 | _array = rcu_dereference(array); \ | ||
| 591 | _item = &_array->items[0]; \ | ||
| 592 | while ((_prog = READ_ONCE(_item->prog))) { \ | ||
| 593 | bpf_cgroup_storage_set(_item->cgroup_storage); \ | ||
| 594 | ret = func(_prog, ctx); \ | ||
| 595 | _ret &= (ret & 1); \ | ||
| 596 | _cn |= (ret & 2); \ | ||
| 597 | _item++; \ | ||
| 598 | } \ | ||
| 599 | rcu_read_unlock(); \ | ||
| 600 | preempt_enable(); \ | ||
| 601 | if (_ret) \ | ||
| 602 | _ret = (_cn ? NET_XMIT_CN : NET_XMIT_SUCCESS); \ | ||
| 603 | else \ | ||
| 604 | _ret = (_cn ? NET_XMIT_DROP : -EPERM); \ | ||
| 605 | _ret; \ | ||
| 606 | }) | ||
| 607 | |||
| 551 | #define BPF_PROG_RUN_ARRAY(array, ctx, func) \ | 608 | #define BPF_PROG_RUN_ARRAY(array, ctx, func) \ |
| 552 | __BPF_PROG_RUN_ARRAY(array, ctx, func, false) | 609 | __BPF_PROG_RUN_ARRAY(array, ctx, func, false) |
| 553 | 610 | ||
| @@ -592,9 +649,12 @@ struct bpf_map *__bpf_map_get(struct fd f); · 38 unmodified lines | |||
| 592 | struct bpf_map * __must_check bpf_map_inc(struct bpf_map *map, bool uref); | 649 | struct bpf_map * __must_check bpf_map_inc(struct bpf_map *map, bool uref); |
| 593 | void bpf_map_put_with_uref(struct bpf_map *map); | 650 | void bpf_map_put_with_uref(struct bpf_map *map); |
| 594 | void bpf_map_put(struct bpf_map *map); | 651 | void bpf_map_put(struct bpf_map *map); |
| 595 | int bpf_map_precharge_memlock(u32 pages); | ||
| 596 | int bpf_map_charge_memlock(struct bpf_map *map, u32 pages); | 652 | int bpf_map_charge_memlock(struct bpf_map *map, u32 pages); |
| 597 | void bpf_map_uncharge_memlock(struct bpf_map *map, u32 pages); | 653 | void bpf_map_uncharge_memlock(struct bpf_map *map, u32 pages); |
| 654 | int bpf_map_charge_init(struct bpf_map_memory *mem, size_t size); | ||
| 655 | void bpf_map_charge_finish(struct bpf_map_memory *mem); | ||
| 656 | void bpf_map_charge_move(struct bpf_map_memory *dst, | ||
| 657 | struct bpf_map_memory *src); | ||
| 598 | void *bpf_map_area_alloc(size_t size, int numa_node); | 658 | void *bpf_map_area_alloc(size_t size, int numa_node); |
| 599 | void bpf_map_area_free(void *base); | 659 | void bpf_map_area_free(void *base); |
| 600 | void bpf_map_init_from_attr(struct bpf_map *map, union bpf_attr *attr); | 660 | void bpf_map_init_from_attr(struct bpf_map *map, union bpf_attr *attr); |
| @@ -992,6 +1052,7 @@ extern const struct bpf_func_proto bpf_spin_unlock_proto; · 391 unmodified lines | |||
| 992 | extern const struct bpf_func_proto bpf_get_local_storage_proto; | 1052 | extern const struct bpf_func_proto bpf_get_local_storage_proto; |
| 993 | extern const struct bpf_func_proto bpf_strtol_proto; | 1053 | extern const struct bpf_func_proto bpf_strtol_proto; |
| 994 | extern const struct bpf_func_proto bpf_strtoul_proto; | 1054 | extern const struct bpf_func_proto bpf_strtoul_proto; |
| 1055 | extern const struct bpf_func_proto bpf_tcp_sock_proto; | ||
| 995 | 1056 | ||
| 996 | /* Shared helpers among cBPF and eBPF. */ | 1057 | /* Shared helpers among cBPF and eBPF. */ |
| 997 | void bpf_user_rnd_init_once(void); | 1058 | void bpf_user_rnd_init_once(void); |
| @@ -1040,6 +1101,15 @@ u32 bpf_tcp_sock_convert_ctx_access(enum bpf_access_type type, · 42 unmodified lines | |||
| 1040 | struct bpf_insn *insn_buf, | 1101 | struct bpf_insn *insn_buf, |
| 1041 | struct bpf_prog *prog, | 1102 | struct bpf_prog *prog, |
| 1042 | u32 *target_size); | 1103 | u32 *target_size); |
| 1104 | |||
| 1105 | bool bpf_xdp_sock_is_valid_access(int off, int size, enum bpf_access_type type, | ||
| 1106 | struct bpf_insn_access_aux *info); | ||
| 1107 | |||
| 1108 | u32 bpf_xdp_sock_convert_ctx_access(enum bpf_access_type type, | ||
| 1109 | const struct bpf_insn *si, | ||
| 1110 | struct bpf_insn *insn_buf, | ||
| 1111 | struct bpf_prog *prog, | ||
| 1112 | u32 *target_size); | ||
| 1043 | #else | 1113 | #else |
| 1044 | static inline bool bpf_tcp_sock_is_valid_access(int off, int size, | 1114 | static inline bool bpf_tcp_sock_is_valid_access(int off, int size, |
| 1045 | enum bpf_access_type type, | 1115 | enum bpf_access_type type, |
| @@ -1056,6 +1126,21 @@ static inline u32 bpf_tcp_sock_convert_ctx_access(enum bpf_access_type type, · 10 unmodified lines | |||
| 1056 | { | 1126 | { |
| 1057 | return 0; | 1127 | return 0; |
| 1058 | } | 1128 | } |
| 1129 | static inline bool bpf_xdp_sock_is_valid_access(int off, int size, | ||
| 1130 | enum bpf_access_type type, | ||
| 1131 | struct bpf_insn_access_aux *info) | ||
| 1132 | { | ||
| 1133 | return false; | ||
| 1134 | } | ||
| 1135 | |||
| 1136 | static inline u32 bpf_xdp_sock_convert_ctx_access(enum bpf_access_type type, | ||
| 1137 | const struct bpf_insn *si, | ||
| 1138 | struct bpf_insn *insn_buf, | ||
| 1139 | struct bpf_prog *prog, | ||
| 1140 | u32 *target_size) | ||
| 1141 | { | ||
| 1142 | return 0; | ||
| 1143 | } | ||
| 1059 | #endif /* CONFIG_INET */ | 1144 | #endif /* CONFIG_INET */ |
| 1060 | 1145 | ||
| 1061 | #endif /* _LINUX_BPF_H */ | 1146 | #endif /* _LINUX_BPF_H */ |
| @@ -30,6 +30,7 @@ BPF_PROG_TYPE(BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE, raw_tracepoint_writable) · 29 unmodified lines | |||
| 30 | #ifdef CONFIG_CGROUP_BPF | 30 | #ifdef CONFIG_CGROUP_BPF |
| 31 | BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_DEVICE, cg_dev) | 31 | BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_DEVICE, cg_dev) |
| 32 | BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_SYSCTL, cg_sysctl) | 32 | BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_SYSCTL, cg_sysctl) |
| 33 | BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_SOCKOPT, cg_sockopt) | ||
| 33 | #endif | 34 | #endif |
| 34 | #ifdef CONFIG_BPF_LIRC_MODE2 | 35 | #ifdef CONFIG_BPF_LIRC_MODE2 |
| 35 | BPF_PROG_TYPE(BPF_PROG_TYPE_LIRC_MODE2, lirc_mode2) | 36 | BPF_PROG_TYPE(BPF_PROG_TYPE_LIRC_MODE2, lirc_mode2) |
| @@ -33,9 +33,11 @@ · 32 unmodified lines | |||
| 33 | */ | 33 | */ |
| 34 | enum bpf_reg_liveness { | 34 | enum bpf_reg_liveness { |
| 35 | REG_LIVE_NONE = 0, /* reg hasn't been read or written this branch */ | 35 | REG_LIVE_NONE = 0, /* reg hasn't been read or written this branch */ |
| 36 | REG_LIVE_READ, /* reg was read, so we're sensitive to initial value */ | 36 | REG_LIVE_READ32 = 0x1, /* reg was read, so we're sensitive to initial value */ |
| 37 | REG_LIVE_WRITTEN, /* reg was written first, screening off later reads */ | 37 | REG_LIVE_READ64 = 0x2, /* likewise, but full 64-bit content matters */ |
| 38 | REG_LIVE_DONE = 4, /* liveness won't be updating this register anymore */ | 38 | REG_LIVE_READ = REG_LIVE_READ32 | REG_LIVE_READ64, |
| 39 | REG_LIVE_WRITTEN = 0x4, /* reg was written first, screening off later reads */ | ||
| 40 | REG_LIVE_DONE = 0x8, /* liveness won't be updating this register anymore */ | ||
| 39 | }; | 41 | }; |
| 40 | 42 | ||
| 41 | struct bpf_reg_state { | 43 | struct bpf_reg_state { |
| @@ -128,7 +130,14 @@ struct bpf_reg_state { · 86 unmodified lines | |||
| 128 | * pointing to bpf_func_state. | 130 | * pointing to bpf_func_state. |
| 129 | */ | 131 | */ |
| 130 | u32 frameno; | 132 | u32 frameno; |
| 133 | /* Tracks subreg definition. The stored value is the insn_idx of the | ||
| 134 | * writing insn. This is safe because subreg_def is used before any insn | ||
| 135 | * patching which only happens after main verification finished. | ||
| 136 | */ | ||
| 137 | s32 subreg_def; | ||
| 131 | enum bpf_reg_liveness live; | 138 | enum bpf_reg_liveness live; |
| 139 | /* if (!precise && SCALAR_VALUE) min/max/tnum don't affect safety */ | ||
| 140 | bool precise; | ||
| 132 | }; | 141 | }; |
| 133 | 142 | ||
| 134 | enum bpf_stack_slot_type { | 143 | enum bpf_stack_slot_type { |
| @@ -180,13 +189,77 @@ struct bpf_func_state { · 45 unmodified lines | |||
| 180 | struct bpf_stack_state *stack; | 189 | struct bpf_stack_state *stack; |
| 181 | }; | 190 | }; |
| 182 | 191 | ||
| 192 | struct bpf_idx_pair { | ||
| 193 | u32 prev_idx; | ||
| 194 | u32 idx; | ||
| 195 | }; | ||
| 196 | |||
| 183 | #define MAX_CALL_FRAMES 8 | 197 | #define MAX_CALL_FRAMES 8 |
| 184 | struct bpf_verifier_state { | 198 | struct bpf_verifier_state { |
| 185 | /* call stack tracking */ | 199 | /* call stack tracking */ |
| 186 | struct bpf_func_state *frame[MAX_CALL_FRAMES]; | 200 | struct bpf_func_state *frame[MAX_CALL_FRAMES]; |
| 201 | struct bpf_verifier_state *parent; | ||
| 202 | /* | ||
| 203 | * 'branches' field is the number of branches left to explore: | ||
| 204 | * 0 - all possible paths from this state reached bpf_exit or | ||
| 205 | * were safely pruned | ||
| 206 | * 1 - at least one path is being explored. | ||
| 207 | * This state hasn't reached bpf_exit | ||
| 208 | * 2 - at least two paths are being explored. | ||
| 209 | * This state is an immediate parent of two children. | ||
| 210 | * One is fallthrough branch with branches==1 and another | ||
| 211 | * state is pushed into stack (to be explored later) also with | ||
| 212 | * branches==1. The parent of this state has branches==1. | ||
| 213 | * The verifier state tree connected via 'parent' pointer looks like: | ||
| 214 | * 1 | ||
| 215 | * 1 | ||
| 216 | * 2 -> 1 (first 'if' pushed into stack) | ||
| 217 | * 1 | ||
| 218 | * 2 -> 1 (second 'if' pushed into stack) | ||
| 219 | * 1 | ||
| 220 | * 1 | ||
| 221 | * 1 bpf_exit. | ||
| 222 | * | ||
| 223 | * Once do_check() reaches bpf_exit, it calls update_branch_counts() | ||
| 224 | * and the verifier state tree will look: | ||
| 225 | * 1 | ||
| 226 | * 1 | ||
| 227 | * 2 -> 1 (first 'if' pushed into stack) | ||
| 228 | * 1 | ||
| 229 | * 1 -> 1 (second 'if' pushed into stack) | ||
| 230 | * 0 | ||
| 231 | * 0 | ||
| 232 | * 0 bpf_exit. | ||
| 233 | * After pop_stack() the do_check() will resume at second 'if'. | ||
| 234 | * | ||
| 235 | * If is_state_visited() sees a state with branches > 0 it means | ||
| 236 | * there is a loop. If such state is exactly equal to the current state | ||
| 237 | * it's an infinite loop. Note states_equal() checks for states | ||
| 238 | * equvalency, so two states being 'states_equal' does not mean | ||
| 239 | * infinite loop. The exact comparison is provided by | ||
| 240 | * states_maybe_looping() function. It's a stronger pre-check and | ||
| 241 | * much faster than states_equal(). | ||
| 242 | * | ||
| 243 | * This algorithm may not find all possible infinite loops or | ||
| 244 | * loop iteration count may be too high. | ||
| 245 | * In such cases BPF_COMPLEXITY_LIMIT_INSNS limit kicks in. | ||
| 246 | */ | ||
| 247 | u32 branches; | ||
| 248 | u32 insn_idx; | ||
| 187 | u32 curframe; | 249 | u32 curframe; |
| 188 | u32 active_spin_lock; | 250 | u32 active_spin_lock; |
| 189 | bool speculative; | 251 | bool speculative; |
| 252 | |||
| 253 | /* first and last insn idx of this verifier state */ | ||
| 254 | u32 first_insn_idx; | ||
| 255 | u32 last_insn_idx; | ||
| 256 | /* jmp history recorded from first to last. | ||
| 257 | * backtracking is using it to go from last to first. | ||
| 258 | * For most states jmp_history_cnt is [0-3]. | ||
| 259 | * For loops can go up to ~40. | ||
| 260 | */ | ||
| 261 | struct bpf_idx_pair *jmp_history; | ||
| 262 | u32 jmp_history_cnt; | ||
| 190 | }; | 263 | }; |
| 191 | 264 | ||
| 192 | #define bpf_get_spilled_reg(slot, frame) \ | 265 | #define bpf_get_spilled_reg(slot, frame) \ |
| @@ -229,7 +302,9 @@ struct bpf_insn_aux_data { · 36 unmodified lines | |||
| 229 | int ctx_field_size; /* the ctx field size for load insn, maybe 0 */ | 302 | int ctx_field_size; /* the ctx field size for load insn, maybe 0 */ |
| 230 | int sanitize_stack_off; /* stack slot to be cleared */ | 303 | int sanitize_stack_off; /* stack slot to be cleared */ |
| 231 | bool seen; /* this insn was processed by the verifier */ | 304 | bool seen; /* this insn was processed by the verifier */ |
| 305 | bool zext_dst; /* this insn zero extends dst reg */ | ||
| 232 | u8 alu_state; /* used in combination with alu_limit */ | 306 | u8 alu_state; /* used in combination with alu_limit */ |
| 307 | bool prune_point; | ||
| 233 | unsigned int orig_idx; /* original instruction index */ | 308 | unsigned int orig_idx; /* original instruction index */ |
| 234 | }; | 309 | }; |
| 235 | 310 | ||
| @@ -299,7 +374,9 @@ struct bpf_verifier_env { · 63 unmodified lines | |||
| 299 | } cfg; | 374 | } cfg; |
| 300 | u32 subprog_cnt; | 375 | u32 subprog_cnt; |
| 301 | /* number of instructions analyzed by the verifier */ | 376 | /* number of instructions analyzed by the verifier */ |
| 302 | u32 insn_processed; | 377 | u32 prev_insn_processed, insn_processed; |
| 378 | /* number of jmps, calls, exits analyzed so far */ | ||
| 379 | u32 prev_jmps_processed, jmps_processed; | ||
| 303 | /* total verification time */ | 380 | /* total verification time */ |
| 304 | u64 verification_time; | 381 | u64 verification_time; |
| 305 | /* maximum number of verifier states kept in 'branching' instructions */ | 382 | /* maximum number of verifier states kept in 'branching' instructions */ |
| @@ -17,6 +17,8 @@ enum cache_type { · 16 unmodified lines | |||
| 17 | CACHE_TYPE_UNIFIED = BIT(2), | 17 | CACHE_TYPE_UNIFIED = BIT(2), |
| 18 | }; | 18 | }; |
| 19 | 19 | ||
| 20 | extern unsigned int coherency_max_size; | ||
| 21 | |||
| 20 | /** | 22 | /** |
| 21 | * struct cacheinfo - represent a cache leaf node | 23 | * struct cacheinfo - represent a cache leaf node |
| 22 | * @id: This cache's id. It is unique among caches with the same (type, level). | 24 | * @id: This cache's id. It is unique among caches with the same (type, level). |
| @@ -170,6 +170,8 @@ struct ccp_aes_engine { · 169 unmodified lines | |||
| 170 | enum ccp_aes_mode mode; | 170 | enum ccp_aes_mode mode; |
| 171 | enum ccp_aes_action action; | 171 | enum ccp_aes_action action; |
| 172 | 172 | ||
| 173 | u32 authsize; | ||
| 174 | |||
| 173 | struct scatterlist *key; | 175 | struct scatterlist *key; |
| 174 | u32 key_len; /* In bytes */ | 176 | u32 key_len; /* In bytes */ |
| 175 | 177 | ||
| @@ -211,6 +211,7 @@ DEFINE_CEPH_FEATURE_DEPRECATED(63, 1, RESERVED_BROKEN, LUMINOUS) // client-facin · 210 unmodified lines | |||
| 211 | CEPH_FEATURE_MON_STATEFUL_SUB | \ | 211 | CEPH_FEATURE_MON_STATEFUL_SUB | \ |
| 212 | CEPH_FEATURE_CRUSH_TUNABLES5 | \ | 212 | CEPH_FEATURE_CRUSH_TUNABLES5 | \ |
| 213 | CEPH_FEATURE_NEW_OSDOPREPLY_ENCODING | \ | 213 | CEPH_FEATURE_NEW_OSDOPREPLY_ENCODING | \ |
| 214 | CEPH_FEATURE_MSG_ADDR2 | \ | ||
| 214 | CEPH_FEATURE_CEPHX_V2) | 215 | CEPH_FEATURE_CEPHX_V2) |
| 215 | 216 | ||
| 216 | #define CEPH_FEATURES_REQUIRED_DEFAULT 0 | 217 | #define CEPH_FEATURES_REQUIRED_DEFAULT 0 |
| @@ -682,7 +682,7 @@ extern const char *ceph_cap_op_name(int op); · 681 unmodified lines | |||
| 682 | /* flags field in client cap messages (version >= 10) */ | 682 | /* flags field in client cap messages (version >= 10) */ |
| 683 | #define CEPH_CLIENT_CAPS_SYNC (1<<0) | 683 | #define CEPH_CLIENT_CAPS_SYNC (1<<0) |
| 684 | #define CEPH_CLIENT_CAPS_NO_CAPSNAP (1<<1) | 684 | #define CEPH_CLIENT_CAPS_NO_CAPSNAP (1<<1) |
| 685 | #define CEPH_CLIENT_CAPS_PENDING_CAPSNAP (1<<2); | 685 | #define CEPH_CLIENT_CAPS_PENDING_CAPSNAP (1<<2) |
| 686 | 686 | ||
| 687 | /* | 687 | /* |
| 688 | * caps message, used for capability callbacks, acks, requests, etc. | 688 | * caps message, used for capability callbacks, acks, requests, etc. |
| @@ -52,4 +52,7 @@ int ceph_cls_lock_info(struct ceph_osd_client *osdc, · 51 unmodified lines | |||
| 52 | char *lock_name, u8 *type, char **tag, | 52 | char *lock_name, u8 *type, char **tag, |
| 53 | struct ceph_locker **lockers, u32 *num_lockers); | 53 | struct ceph_locker **lockers, u32 *num_lockers); |
| 54 | 54 | ||
| 55 | int ceph_cls_assert_locked(struct ceph_osd_request *req, int which, | ||
| 56 | char *lock_name, u8 type, char *cookie, char *tag); | ||
| 57 | |||
| 55 | #endif | 58 | #endif |
| @@ -19,9 +19,9 @@ static const struct file_operations name##_fops = { \ · 18 unmodified lines | |||
| 19 | }; | 19 | }; |
| 20 | 20 | ||
| 21 | /* debugfs.c */ | 21 | /* debugfs.c */ |
| 22 | extern int ceph_debugfs_init(void); | 22 | extern void ceph_debugfs_init(void); |
| 23 | extern void ceph_debugfs_cleanup(void); | 23 | extern void ceph_debugfs_cleanup(void); |
| 24 | extern int ceph_debugfs_client_init(struct ceph_client *client); | 24 | extern void ceph_debugfs_client_init(struct ceph_client *client); |
| 25 | extern void ceph_debugfs_client_cleanup(struct ceph_client *client); | 25 | extern void ceph_debugfs_client_cleanup(struct ceph_client *client); |
| 26 | 26 | ||
| 27 | #endif | 27 | #endif |
| @@ -218,18 +218,27 @@ static inline void ceph_encode_timespec64(struct ceph_timespec *tv, · 217 unmodified lines | |||
| 218 | /* | 218 | /* |
| 219 | * sockaddr_storage <-> ceph_sockaddr | 219 | * sockaddr_storage <-> ceph_sockaddr |
| 220 | */ | 220 | */ |
| 221 | static inline void ceph_encode_addr(struct ceph_entity_addr *a) | 221 | #define CEPH_ENTITY_ADDR_TYPE_NONE 0 |
| 222 | #define CEPH_ENTITY_ADDR_TYPE_LEGACY __cpu_to_le32(1) | ||
| 223 | |||
| 224 | static inline void ceph_encode_banner_addr(struct ceph_entity_addr *a) | ||
| 222 | { | 225 | { |
| 223 | __be16 ss_family = htons(a->in_addr.ss_family); | 226 | __be16 ss_family = htons(a->in_addr.ss_family); |
| 224 | a->in_addr.ss_family = *(__u16 *)&ss_family; | 227 | a->in_addr.ss_family = *(__u16 *)&ss_family; |
| 228 | |||
| 229 | /* Banner addresses require TYPE_NONE */ | ||
| 230 | a->type = CEPH_ENTITY_ADDR_TYPE_NONE; | ||
| 225 | } | 231 | } |
| 226 | static inline void ceph_decode_addr(struct ceph_entity_addr *a) | 232 | static inline void ceph_decode_banner_addr(struct ceph_entity_addr *a) |
| 227 | { | 233 | { |
| 228 | __be16 ss_family = *(__be16 *)&a->in_addr.ss_family; | 234 | __be16 ss_family = *(__be16 *)&a->in_addr.ss_family; |
| 229 | a->in_addr.ss_family = ntohs(ss_family); | 235 | a->in_addr.ss_family = ntohs(ss_family); |
| 230 | WARN_ON(a->in_addr.ss_family == 512); | 236 | WARN_ON(a->in_addr.ss_family == 512); |
| 237 | a->type = CEPH_ENTITY_ADDR_TYPE_LEGACY; | ||
| 231 | } | 238 | } |
| 232 | 239 | ||
| 240 | extern int ceph_decode_entity_addr(void **p, void *end, | ||
| 241 | struct ceph_entity_addr *addr); | ||
| 233 | /* | 242 | /* |
| 234 | * encoders | 243 | * encoders |
| 235 | */ | 244 | */ |
| @@ -84,11 +84,13 @@ struct ceph_options { · 83 unmodified lines | |||
| 84 | #define CEPH_MSG_MAX_MIDDLE_LEN (16*1024*1024) | 84 | #define CEPH_MSG_MAX_MIDDLE_LEN (16*1024*1024) |
| 85 | 85 | ||
| 86 | /* | 86 | /* |
| 87 | * Handle the largest possible rbd object in one message. | 87 | * The largest possible rbd data object is 32M. |
| 88 | * The largest possible rbd object map object is 64M. | ||
| 89 | * | ||
| 88 | * There is no limit on the size of cephfs objects, but it has to obey | 90 | * There is no limit on the size of cephfs objects, but it has to obey |
| 89 | * rsize and wsize mount options anyway. | 91 | * rsize and wsize mount options anyway. |
| 90 | */ | 92 | */ |
| 91 | #define CEPH_MSG_MAX_DATA_LEN (32*1024*1024) | 93 | #define CEPH_MSG_MAX_DATA_LEN (64*1024*1024) |
| 92 | 94 | ||
| 93 | #define CEPH_AUTH_NAME_DEFAULT "guest" | 95 | #define CEPH_AUTH_NAME_DEFAULT "guest" |
| 94 | 96 | ||
| @@ -299,10 +301,6 @@ int ceph_wait_for_latest_osdmap(struct ceph_client *client, · 204 unmodified lines | |||
| 299 | 301 | ||
| 300 | /* pagevec.c */ | 302 | /* pagevec.c */ |
| 301 | extern void ceph_release_page_vector(struct page **pages, int num_pages); | 303 | extern void ceph_release_page_vector(struct page **pages, int num_pages); |
| 302 | |||
| 303 | extern struct page **ceph_get_direct_page_vector(const void __user *data, | ||
| 304 | int num_pages, | ||
| 305 | bool write_page); | ||
| 306 | extern void ceph_put_page_vector(struct page **pages, int num_pages, | 304 | extern void ceph_put_page_vector(struct page **pages, int num_pages, |
| 307 | bool dirty); | 305 | bool dirty); |
| 308 | extern struct page **ceph_alloc_page_vector(int num_pages, gfp_t flags); | 306 | extern struct page **ceph_alloc_page_vector(int num_pages, gfp_t flags); |
| @@ -104,7 +104,6 @@ struct ceph_mon_client { · 103 unmodified lines | |||
| 104 | #endif | 104 | #endif |
| 105 | }; | 105 | }; |
| 106 | 106 | ||
| 107 | extern struct ceph_monmap *ceph_monmap_decode(void *p, void *end); | ||
| 108 | extern int ceph_monmap_contains(struct ceph_monmap *m, | 107 | extern int ceph_monmap_contains(struct ceph_monmap *m, |
| 109 | struct ceph_entity_addr *addr); | 108 | struct ceph_entity_addr *addr); |
| 110 | 109 | ||
| @@ -198,9 +198,9 @@ struct ceph_osd_request { · 197 unmodified lines | |||
| 198 | bool r_mempool; | 198 | bool r_mempool; |
| 199 | struct completion r_completion; /* private to osd_client.c */ | 199 | struct completion r_completion; /* private to osd_client.c */ |
| 200 | ceph_osdc_callback_t r_callback; | 200 | ceph_osdc_callback_t r_callback; |
| 201 | struct list_head r_unsafe_item; | ||
| 202 | 201 | ||
| 203 | struct inode *r_inode; /* for use by callbacks */ | 202 | struct inode *r_inode; /* for use by callbacks */ |
| 203 | struct list_head r_private_item; /* ditto */ | ||
| 204 | void *r_priv; /* ditto */ | 204 | void *r_priv; /* ditto */ |
| 205 | 205 | ||
| 206 | /* set by submitter */ | 206 | /* set by submitter */ |
| @@ -389,6 +389,14 @@ extern void ceph_osdc_handle_map(struct ceph_osd_client *osdc, · 182 unmodified lines | |||
| 389 | void ceph_osdc_update_epoch_barrier(struct ceph_osd_client *osdc, u32 eb); | 389 | void ceph_osdc_update_epoch_barrier(struct ceph_osd_client *osdc, u32 eb); |
| 390 | void ceph_osdc_abort_requests(struct ceph_osd_client *osdc, int err); | 390 | void ceph_osdc_abort_requests(struct ceph_osd_client *osdc, int err); |
| 391 | 391 | ||
| 392 | #define osd_req_op_data(oreq, whch, typ, fld) \ | ||
| 393 | ({ \ | ||
| 394 | struct ceph_osd_request *__oreq = (oreq); \ | ||
| 395 | unsigned int __whch = (whch); \ | ||
| 396 | BUG_ON(__whch >= __oreq->r_num_ops); \ | ||
| 397 | &__oreq->r_ops[__whch].typ.fld; \ | ||
| 398 | }) | ||
| 399 | |||
| 392 | extern void osd_req_op_init(struct ceph_osd_request *osd_req, | 400 | extern void osd_req_op_init(struct ceph_osd_request *osd_req, |
| 393 | unsigned int which, u16 opcode, u32 flags); | 401 | unsigned int which, u16 opcode, u32 flags); |
| 394 | 402 | ||
| @@ -497,7 +505,7 @@ int ceph_osdc_call(struct ceph_osd_client *osdc, · 102 unmodified lines | |||
| 497 | const char *class, const char *method, | 505 | const char *class, const char *method, |
| 498 | unsigned int flags, | 506 | unsigned int flags, |
| 499 | struct page *req_page, size_t req_len, | 507 | struct page *req_page, size_t req_len, |
| 500 | struct page *resp_page, size_t *resp_len); | 508 | struct page **resp_pages, size_t *resp_len); |
| 501 | 509 | ||
| 502 | extern int ceph_osdc_readpages(struct ceph_osd_client *osdc, | 510 | extern int ceph_osdc_readpages(struct ceph_osd_client *osdc, |
| 503 | struct ceph_vino vino, | 511 | struct ceph_vino vino, |
| @@ -66,4 +66,6 @@ int ceph_extent_to_file(struct ceph_file_layout *l, · 65 unmodified lines | |||
| 66 | struct ceph_file_extent **file_extents, | 66 | struct ceph_file_extent **file_extents, |
| 67 | u32 *num_file_extents); | 67 | u32 *num_file_extents); |
| 68 | 68 | ||
| 69 | u64 ceph_get_num_objects(struct ceph_file_layout *l, u64 size); | ||
| 70 | |||
| 69 | #endif | 71 | #endif |
| @@ -624,7 +624,7 @@ struct cftype { · 623 unmodified lines | |||
| 624 | 624 | ||
| 625 | /* | 625 | /* |
| 626 | * Control Group subsystem type. | 626 | * Control Group subsystem type. |
| 627 | * See Documentation/cgroup-v1/cgroups.txt for details | 627 | * See Documentation/admin-guide/cgroup-v1/cgroups.rst for details |
| 628 | */ | 628 | */ |
| 629 | struct cgroup_subsys { | 629 | struct cgroup_subsys { |
| 630 | struct cgroup_subsys_state *(*css_alloc)(struct cgroup_subsys_state *parent_css); | 630 | struct cgroup_subsys_state *(*css_alloc)(struct cgroup_subsys_state *parent_css); |
| @@ -131,6 +131,8 @@ void cgroup_free(struct task_struct *p); · 130 unmodified lines | |||
| 131 | int cgroup_init_early(void); | 131 | int cgroup_init_early(void); |
| 132 | int cgroup_init(void); | 132 | int cgroup_init(void); |
| 133 | 133 | ||
| 134 | int cgroup_parse_float(const char *input, unsigned dec_shift, s64 *v); | ||
| 135 | |||
| 134 | /* | 136 | /* |
| 135 | * Iteration helpers and macros. | 137 | * Iteration helpers and macros. |
| 136 | */ | 138 | */ |
| @@ -697,6 +699,7 @@ void cgroup_path_from_kernfs_id(const union kernfs_node_id *id, · 560 unmodified lines | |||
| 697 | struct cgroup_subsys_state; | 699 | struct cgroup_subsys_state; |
| 698 | struct cgroup; | 700 | struct cgroup; |
| 699 | 701 | ||
| 702 | static inline void css_get(struct cgroup_subsys_state *css) {} | ||
| 700 | static inline void css_put(struct cgroup_subsys_state *css) {} | 703 | static inline void css_put(struct cgroup_subsys_state *css) {} |
| 701 | static inline int cgroup_attach_task_all(struct task_struct *from, | 704 | static inline int cgroup_attach_task_all(struct task_struct *from, |
| 702 | struct task_struct *t) { return 0; } | 705 | struct task_struct *t) { return 0; } |
| @@ -934,4 +937,22 @@ static inline bool cgroup_task_frozen(struct task_struct *task) · 231 unmodified lines | |||
| 934 | 937 | ||
| 935 | #endif /* !CONFIG_CGROUPS */ | 938 | #endif /* !CONFIG_CGROUPS */ |
| 936 | 939 | ||
| 940 | #ifdef CONFIG_CGROUP_BPF | ||
| 941 | static inline void cgroup_bpf_get(struct cgroup *cgrp) | ||
| 942 | { | ||
| 943 | percpu_ref_get(&cgrp->bpf.refcnt); | ||
| 944 | } | ||
| 945 | |||
| 946 | static inline void cgroup_bpf_put(struct cgroup *cgrp) | ||
| 947 | { | ||
| 948 | percpu_ref_put(&cgrp->bpf.refcnt); | ||
| 949 | } | ||
| 950 | |||
| 951 | #else /* CONFIG_CGROUP_BPF */ | ||
| 952 | |||
| 953 | static inline void cgroup_bpf_get(struct cgroup *cgrp) {} | ||
| 954 | static inline void cgroup_bpf_put(struct cgroup *cgrp) {} | ||
| 955 | |||
| 956 | #endif /* CONFIG_CGROUP_BPF */ | ||
| 957 | |||
| 937 | #endif /* _LINUX_CGROUP_H */ | 958 | #endif /* _LINUX_CGROUP_H */ |
| @@ -9,8 +9,6 @@ · 8 unmodified lines | |||
| 9 | #include <linux/of.h> | 9 | #include <linux/of.h> |
| 10 | #include <linux/of_clk.h> | 10 | #include <linux/of_clk.h> |
| 11 | 11 | ||
| 12 | #ifdef CONFIG_COMMON_CLK | ||
| 13 | |||
| 14 | /* | 12 | /* |
| 15 | * flags used across common struct clk. these flags should only affect the | 13 | * flags used across common struct clk. these flags should only affect the |
| 16 | * top-level framework. custom flags for dealing with hardware specifics | 14 | * top-level framework. custom flags for dealing with hardware specifics |
| @@ -807,7 +805,14 @@ void devm_clk_hw_unregister(struct device *dev, struct clk_hw *hw); · 790 unmodified lines | |||
| 807 | /* helper functions */ | 805 | /* helper functions */ |
| 808 | const char *__clk_get_name(const struct clk *clk); | 806 | const char *__clk_get_name(const struct clk *clk); |
| 809 | const char *clk_hw_get_name(const struct clk_hw *hw); | 807 | const char *clk_hw_get_name(const struct clk_hw *hw); |
| 808 | #ifdef CONFIG_COMMON_CLK | ||
| 810 | struct clk_hw *__clk_get_hw(struct clk *clk); | 809 | struct clk_hw *__clk_get_hw(struct clk *clk); |
| 810 | #else | ||
| 811 | static inline struct clk_hw *__clk_get_hw(struct clk *clk) | ||
| 812 | { | ||
| 813 | return (struct clk_hw *)clk; | ||
| 814 | } | ||
| 815 | #endif | ||
| 811 | unsigned int clk_hw_get_num_parents(const struct clk_hw *hw); | 816 | unsigned int clk_hw_get_num_parents(const struct clk_hw *hw); |
| 812 | struct clk_hw *clk_hw_get_parent(const struct clk_hw *hw); | 817 | struct clk_hw *clk_hw_get_parent(const struct clk_hw *hw); |
| 813 | struct clk_hw *clk_hw_get_parent_by_index(const struct clk_hw *hw, | 818 | struct clk_hw *clk_hw_get_parent_by_index(const struct clk_hw *hw, |
| @@ -867,8 +872,6 @@ static inline long divider_ro_round_rate(struct clk_hw *hw, unsigned long rate, · 53 unmodified lines | |||
| 867 | */ | 872 | */ |
| 868 | unsigned long clk_hw_round_rate(struct clk_hw *hw, unsigned long rate); | 873 | unsigned long clk_hw_round_rate(struct clk_hw *hw, unsigned long rate); |
| 869 | 874 | ||
| 870 | struct of_device_id; | ||
| 871 | |||
| 872 | struct clk_onecell_data { | 875 | struct clk_onecell_data { |
| 873 | struct clk **clks; | 876 | struct clk **clks; |
| 874 | unsigned int clk_num; | 877 | unsigned int clk_num; |
| @@ -879,8 +882,6 @@ struct clk_hw_onecell_data { · 4 unmodified lines | |||
| 879 | struct clk_hw *hws[]; | 882 | struct clk_hw *hws[]; |
| 880 | }; | 883 | }; |
| 881 | 884 | ||
| 882 | extern struct of_device_id __clk_of_table; | ||
| 883 | |||
| 884 | #define CLK_OF_DECLARE(name, compat, fn) OF_DECLARE_1(clk, name, compat, fn) | 885 | #define CLK_OF_DECLARE(name, compat, fn) OF_DECLARE_1(clk, name, compat, fn) |
| 885 | 886 | ||
| 886 | /* | 887 | /* |
| @@ -904,6 +905,40 @@ extern struct of_device_id __clk_of_table; · 17 unmodified lines | |||
| 904 | .ops = _ops, \ | 905 | .ops = _ops, \ |
| 905 | }) | 906 | }) |
| 906 | 907 | ||
| 908 | #define CLK_HW_INIT_HW(_name, _parent, _ops, _flags) \ | ||
| 909 | (&(struct clk_init_data) { \ | ||
| 910 | .flags = _flags, \ | ||
| 911 | .name = _name, \ | ||
| 912 | .parent_hws = (const struct clk_hw*[]) { _parent }, \ | ||
| 913 | .num_parents = 1, \ | ||
| 914 | .ops = _ops, \ | ||
| 915 | }) | ||
| 916 | |||
| 917 | /* | ||
| 918 | * This macro is intended for drivers to be able to share the otherwise | ||
| 919 | * individual struct clk_hw[] compound literals created by the compiler | ||
| 920 | * when using CLK_HW_INIT_HW. It does NOT support multiple parents. | ||
| 921 | */ | ||
| 922 | #define CLK_HW_INIT_HWS(_name, _parent, _ops, _flags) \ | ||
| 923 | (&(struct clk_init_data) { \ | ||
| 924 | .flags = _flags, \ | ||
| 925 | .name = _name, \ | ||
| 926 | .parent_hws = _parent, \ | ||
| 927 | .num_parents = 1, \ | ||
| 928 | .ops = _ops, \ | ||
| 929 | }) | ||
| 930 | |||
| 931 | #define CLK_HW_INIT_FW_NAME(_name, _parent, _ops, _flags) \ | ||
| 932 | (&(struct clk_init_data) { \ | ||
| 933 | .flags = _flags, \ | ||
| 934 | .name = _name, \ | ||
| 935 | .parent_data = (const struct clk_parent_data[]) { \ | ||
| 936 | { .fw_name = _parent }, \ | ||
| 937 | }, \ | ||
| 938 | .num_parents = 1, \ | ||
| 939 | .ops = _ops, \ | ||
| 940 | }) | ||
| 941 | |||
| 907 | #define CLK_HW_INIT_PARENTS(_name, _parents, _ops, _flags) \ | 942 | #define CLK_HW_INIT_PARENTS(_name, _parents, _ops, _flags) \ |
| 908 | (&(struct clk_init_data) { \ | 943 | (&(struct clk_init_data) { \ |
| 909 | .flags = _flags, \ | 944 | .flags = _flags, \ |
| @@ -913,6 +948,24 @@ extern struct of_device_id __clk_of_table; · 3 unmodified lines | |||
| 913 | .ops = _ops, \ | 948 | .ops = _ops, \ |
| 914 | }) | 949 | }) |
| 915 | 950 | ||
| 951 | #define CLK_HW_INIT_PARENTS_HW(_name, _parents, _ops, _flags) \ | ||
| 952 | (&(struct clk_init_data) { \ | ||
| 953 | .flags = _flags, \ | ||
| 954 | .name = _name, \ | ||
| 955 | .parent_hws = _parents, \ | ||
| 956 | .num_parents = ARRAY_SIZE(_parents), \ | ||
| 957 | .ops = _ops, \ | ||
| 958 | }) | ||
| 959 | |||
| 960 | #define CLK_HW_INIT_PARENTS_DATA(_name, _parents, _ops, _flags) \ | ||
| 961 | (&(struct clk_init_data) { \ | ||
| 962 | .flags = _flags, \ | ||
| 963 | .name = _name, \ | ||
| 964 | .parent_data = _parents, \ | ||
| 965 | .num_parents = ARRAY_SIZE(_parents), \ | ||
| 966 | .ops = _ops, \ | ||
| 967 | }) | ||
| 968 | |||
| 916 | #define CLK_HW_INIT_NO_PARENT(_name, _ops, _flags) \ | 969 | #define CLK_HW_INIT_NO_PARENT(_name, _ops, _flags) \ |
| 917 | (&(struct clk_init_data) { \ | 970 | (&(struct clk_init_data) { \ |
| 918 | .flags = _flags, \ | 971 | .flags = _flags, \ |
| @@ -933,6 +986,43 @@ extern struct of_device_id __clk_of_table; · 14 unmodified lines | |||
| 933 | _flags), \ | 986 | _flags), \ |
| 934 | } | 987 | } |
| 935 | 988 | ||
| 989 | #define CLK_FIXED_FACTOR_HW(_struct, _name, _parent, \ | ||
| 990 | _div, _mult, _flags) \ | ||
| 991 | struct clk_fixed_factor _struct = { \ | ||
| 992 | .div = _div, \ | ||
| 993 | .mult = _mult, \ | ||
| 994 | .hw.init = CLK_HW_INIT_HW(_name, \ | ||
| 995 | _parent, \ | ||
| 996 | &clk_fixed_factor_ops, \ | ||
| 997 | _flags), \ | ||
| 998 | } | ||
| 999 | |||
| 1000 | /* | ||
| 1001 | * This macro allows the driver to reuse the _parent array for multiple | ||
| 1002 | * fixed factor clk declarations. | ||
| 1003 | */ | ||
| 1004 | #define CLK_FIXED_FACTOR_HWS(_struct, _name, _parent, \ | ||
| 1005 | _div, _mult, _flags) \ | ||
| 1006 | struct clk_fixed_factor _struct = { \ | ||
| 1007 | .div = _div, \ | ||
| 1008 | .mult = _mult, \ | ||
| 1009 | .hw.init = CLK_HW_INIT_HWS(_name, \ | ||
| 1010 | _parent, \ | ||
| 1011 | &clk_fixed_factor_ops, \ | ||
| 1012 | _flags), \ | ||
| 1013 | } | ||
| 1014 | |||
| 1015 | #define CLK_FIXED_FACTOR_FW_NAME(_struct, _name, _parent, \ | ||
| 1016 | _div, _mult, _flags) \ | ||
| 1017 | struct clk_fixed_factor _struct = { \ | ||
| 1018 | .div = _div, \ | ||
| 1019 | .mult = _mult, \ | ||
| 1020 | .hw.init = CLK_HW_INIT_FW_NAME(_name, \ | ||
| 1021 | _parent, \ | ||
| 1022 | &clk_fixed_factor_ops, \ | ||
| 1023 | _flags), \ | ||
| 1024 | } | ||
| 1025 | |||
| 936 | #ifdef CONFIG_OF | 1026 | #ifdef CONFIG_OF |
| 937 | int of_clk_add_provider(struct device_node *np, | 1027 | int of_clk_add_provider(struct device_node *np, |
| 938 | struct clk *(*clk_src_get)(struct of_phandle_args *args, | 1028 | struct clk *(*clk_src_get)(struct of_phandle_args *args, |
| @@ -1019,5 +1109,4 @@ static inline int of_clk_detect_critical(struct device_node *np, int index, · 80 unmodified lines | |||
| 1019 | 1109 | ||
| 1020 | void clk_gate_restore_context(struct clk_hw *hw); | 1110 | void clk_gate_restore_context(struct clk_hw *hw); |
| 1021 | 1111 | ||
| 1022 | #endif /* CONFIG_COMMON_CLK */ | ||
| 1023 | #endif /* CLK_PROVIDER_H */ | 1112 | #endif /* CLK_PROVIDER_H */ |
| @@ -329,6 +329,19 @@ int __must_check clk_bulk_get(struct device *dev, int num_clks, · 328 unmodified lines | |||
| 329 | */ | 329 | */ |
| 330 | int __must_check clk_bulk_get_all(struct device *dev, | 330 | int __must_check clk_bulk_get_all(struct device *dev, |
| 331 | struct clk_bulk_data **clks); | 331 | struct clk_bulk_data **clks); |
| 332 | |||
| 333 | /** | ||
| 334 | * clk_bulk_get_optional - lookup and obtain a number of references to clock producer | ||
| 335 | * @dev: device for clock "consumer" | ||
| 336 | * @num_clks: the number of clk_bulk_data | ||
| 337 | * @clks: the clk_bulk_data table of consumer | ||
| 338 | * | ||
| 339 | * Behaves the same as clk_bulk_get() except where there is no clock producer. | ||
| 340 | * In this case, instead of returning -ENOENT, the function returns 0 and | ||
| 341 | * NULL for a clk for which a clock producer could not be determined. | ||
| 342 | */ | ||
| 343 | int __must_check clk_bulk_get_optional(struct device *dev, int num_clks, | ||
| 344 | struct clk_bulk_data *clks); | ||
| 332 | /** | 345 | /** |
| 333 | * devm_clk_bulk_get - managed get multiple clk consumers | 346 | * devm_clk_bulk_get - managed get multiple clk consumers |
| 334 | * @dev: device for clock "consumer" | 347 | * @dev: device for clock "consumer" |
| @@ -343,6 +356,29 @@ int __must_check clk_bulk_get_all(struct device *dev, · 8 unmodified lines | |||
| 343 | */ | 356 | */ |
| 344 | int __must_check devm_clk_bulk_get(struct device *dev, int num_clks, | 357 | int __must_check devm_clk_bulk_get(struct device *dev, int num_clks, |
| 345 | struct clk_bulk_data *clks); | 358 | struct clk_bulk_data *clks); |
| 359 | /** | ||
| 360 | * devm_clk_bulk_get_optional - managed get multiple optional consumer clocks | ||
| 361 | * @dev: device for clock "consumer" | ||
| 362 | * @num_clks: the number of clk_bulk_data | ||
| 363 | * @clks: pointer to the clk_bulk_data table of consumer | ||
| 364 | * | ||
| 365 | * Behaves the same as devm_clk_bulk_get() except where there is no clock | ||
| 366 | * producer. In this case, instead of returning -ENOENT, the function returns | ||
| 367 | * NULL for given clk. It is assumed all clocks in clk_bulk_data are optional. | ||
| 368 | * | ||
| 369 | * Returns 0 if all clocks specified in clk_bulk_data table are obtained | ||
| 370 | * successfully or for any clk there was no clk provider available, otherwise | ||
| 371 | * returns valid IS_ERR() condition containing errno. | ||
| 372 | * The implementation uses @dev and @clk_bulk_data.id to determine the | ||
| 373 | * clock consumer, and thereby the clock producer. | ||
| 374 | * The clock returned is stored in each @clk_bulk_data.clk field. | ||
| 375 | * | ||
| 376 | * Drivers must assume that the clock source is not enabled. | ||
| 377 | * | ||
| 378 | * clk_bulk_get should not be called from within interrupt context. | ||
| 379 | */ | ||
| 380 | int __must_check devm_clk_bulk_get_optional(struct device *dev, int num_clks, | ||
| 381 | struct clk_bulk_data *clks); | ||
| 346 | /** | 382 | /** |
| 347 | * devm_clk_bulk_get_all - managed get multiple clk consumers | 383 | * devm_clk_bulk_get_all - managed get multiple clk consumers |
| 348 | * @dev: device for clock "consumer" | 384 | * @dev: device for clock "consumer" |
| @@ -715,6 +751,12 @@ static inline int __must_check clk_bulk_get(struct device *dev, int num_clks, · 366 unmodified lines | |||
| 715 | return 0; | 751 | return 0; |
| 716 | } | 752 | } |
| 717 | 753 | ||
| 754 | static inline int __must_check clk_bulk_get_optional(struct device *dev, | ||
| 755 | int num_clks, struct clk_bulk_data *clks) | ||
| 756 | { | ||
| 757 | return 0; | ||
| 758 | } | ||
| 759 | |||
| 718 | static inline int __must_check clk_bulk_get_all(struct device *dev, | 760 | static inline int __must_check clk_bulk_get_all(struct device *dev, |
| 719 | struct clk_bulk_data **clks) | 761 | struct clk_bulk_data **clks) |
| 720 | { | 762 | { |
| @@ -738,6 +780,12 @@ static inline int __must_check devm_clk_bulk_get(struct device *dev, int num_clk · 17 unmodified lines | |||
| 738 | return 0; | 780 | return 0; |
| 739 | } | 781 | } |
| 740 | 782 | ||
| 783 | static inline int __must_check devm_clk_bulk_get_optional(struct device *dev, | ||
| 784 | int num_clks, struct clk_bulk_data *clks) | ||
| 785 | { | ||
| 786 | return 0; | ||
| 787 | } | ||
| 788 | |||
| 741 | static inline int __must_check devm_clk_bulk_get_all(struct device *dev, | 789 | static inline int __must_check devm_clk_bulk_get_all(struct device *dev, |
| 742 | struct clk_bulk_data **clks) | 790 | struct clk_bulk_data **clks) |
| 743 | { | 791 | { |
| @@ -58,8 +58,7 @@ Mellon the rights to redistribute these changes without encumbrance. · 57 unmodified lines | |||
| 58 | #ifndef _CODA_HEADER_ | 58 | #ifndef _CODA_HEADER_ |
| 59 | #define _CODA_HEADER_ | 59 | #define _CODA_HEADER_ |
| 60 | 60 | ||
| 61 | #if defined(__linux__) | ||
| 62 | typedef unsigned long long u_quad_t; | 61 | typedef unsigned long long u_quad_t; |
| 63 | #endif | 62 | |
| 64 | #include <uapi/linux/coda.h> | 63 | #include <uapi/linux/coda.h> |
| 65 | #endif | 64 | #endif |
| @@ -1,72 +0,0 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | #ifndef __CODA_PSDEV_H | ||
| 3 | #define __CODA_PSDEV_H | ||
| 4 | |||
| 5 | #include <linux/backing-dev.h> | ||
| 6 | #include <linux/mutex.h> | ||
| 7 | #include <uapi/linux/coda_psdev.h> | ||
| 8 | |||
| 9 | struct kstatfs; | ||
| 10 | |||
| 11 | /* communication pending/processing queues */ | ||
| 12 | struct venus_comm { | ||
| 13 | u_long vc_seq; | ||
| 14 | wait_queue_head_t vc_waitq; /* Venus wait queue */ | ||
| 15 | struct list_head vc_pending; | ||
| 16 | struct list_head vc_processing; | ||
| 17 | int vc_inuse; | ||
| 18 | struct super_block *vc_sb; | ||
| 19 | struct mutex vc_mutex; | ||
| 20 | }; | ||
| 21 | |||
| 22 | |||
| 23 | static inline struct venus_comm *coda_vcp(struct super_block *sb) | ||
| 24 | { | ||
| 25 | return (struct venus_comm *)((sb)->s_fs_info); | ||
| 26 | } | ||
| 27 | |||
| 28 | /* upcalls */ | ||
| 29 | int venus_rootfid(struct super_block *sb, struct CodaFid *fidp); | ||
| 30 | int venus_getattr(struct super_block *sb, struct CodaFid *fid, | ||
| 31 | struct coda_vattr *attr); | ||
| 32 | int venus_setattr(struct super_block *, struct CodaFid *, struct coda_vattr *); | ||
| 33 | int venus_lookup(struct super_block *sb, struct CodaFid *fid, | ||
| 34 | const char *name, int length, int *type, | ||
| 35 | struct CodaFid *resfid); | ||
| 36 | int venus_close(struct super_block *sb, struct CodaFid *fid, int flags, | ||
| 37 | kuid_t uid); | ||
| 38 | int venus_open(struct super_block *sb, struct CodaFid *fid, int flags, | ||
| 39 | struct file **f); | ||
| 40 | int venus_mkdir(struct super_block *sb, struct CodaFid *dirfid, | ||
| 41 | const char *name, int length, | ||
| 42 | struct CodaFid *newfid, struct coda_vattr *attrs); | ||
| 43 | int venus_create(struct super_block *sb, struct CodaFid *dirfid, | ||
| 44 | const char *name, int length, int excl, int mode, | ||
| 45 | struct CodaFid *newfid, struct coda_vattr *attrs) ; | ||
| 46 | int venus_rmdir(struct super_block *sb, struct CodaFid *dirfid, | ||
| 47 | const char *name, int length); | ||
| 48 | int venus_remove(struct super_block *sb, struct CodaFid *dirfid, | ||
| 49 | const char *name, int length); | ||
| 50 | int venus_readlink(struct super_block *sb, struct CodaFid *fid, | ||
| 51 | char *buffer, int *length); | ||
| 52 | int venus_rename(struct super_block *, struct CodaFid *new_fid, | ||
| 53 | struct CodaFid *old_fid, size_t old_length, | ||
| 54 | size_t new_length, const char *old_name, | ||
| 55 | const char *new_name); | ||
| 56 | int venus_link(struct super_block *sb, struct CodaFid *fid, | ||
| 57 | struct CodaFid *dirfid, const char *name, int len ); | ||
| 58 | int venus_symlink(struct super_block *sb, struct CodaFid *fid, | ||
| 59 | const char *name, int len, const char *symname, int symlen); | ||
| 60 | int venus_access(struct super_block *sb, struct CodaFid *fid, int mask); | ||
| 61 | int venus_pioctl(struct super_block *sb, struct CodaFid *fid, | ||
| 62 | unsigned int cmd, struct PioctlData *data); | ||
| 63 | int coda_downcall(struct venus_comm *vcp, int opcode, union outputArgs *out); | ||
| 64 | int venus_fsync(struct super_block *sb, struct CodaFid *fid); | ||
| 65 | int venus_statfs(struct dentry *dentry, struct kstatfs *sfs); | ||
| 66 | |||
| 67 | /* | ||
| 68 | * Statistics | ||
| 69 | */ | ||
| 70 | |||
| 71 | extern struct venus_comm coda_comms[]; | ||
| 72 | #endif | ||
| @@ -138,8 +138,7 @@ typedef struct { · 137 unmodified lines | |||
| 138 | compat_sigset_word sig[_COMPAT_NSIG_WORDS]; | 138 | compat_sigset_word sig[_COMPAT_NSIG_WORDS]; |
| 139 | } compat_sigset_t; | 139 | } compat_sigset_t; |
| 140 | 140 | ||
| 141 | int set_compat_user_sigmask(const compat_sigset_t __user *usigmask, | 141 | int set_compat_user_sigmask(const compat_sigset_t __user *umask, |
| 142 | sigset_t *set, sigset_t *oldset, | ||
| 143 | size_t sigsetsize); | 142 | size_t sigsetsize); |
| 144 | 143 | ||
| 145 | struct compat_sigaction { | 144 | struct compat_sigaction { |
| @@ -170,3 +170,5 @@ · 169 unmodified lines | |||
| 170 | #else | 170 | #else |
| 171 | #define __diag_GCC_8(s) | 171 | #define __diag_GCC_8(s) |
| 172 | #endif | 172 | #endif |
| 173 | |||
| 174 | #define __no_fgcse __attribute__((optimize("-fno-gcse"))) | ||
| @@ -116,9 +116,14 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, · 115 unmodified lines | |||
| 116 | ".pushsection .discard.unreachable\n\t" \ | 116 | ".pushsection .discard.unreachable\n\t" \ |
| 117 | ".long 999b - .\n\t" \ | 117 | ".long 999b - .\n\t" \ |
| 118 | ".popsection\n\t" | 118 | ".popsection\n\t" |
| 119 | |||
| 120 | /* Annotate a C jump table to allow objtool to follow the code flow */ | ||
| 121 | #define __annotate_jump_table __section(".rodata..c_jump_table") | ||
| 122 | |||
| 119 | #else | 123 | #else |
| 120 | #define annotate_reachable() | 124 | #define annotate_reachable() |
| 121 | #define annotate_unreachable() | 125 | #define annotate_unreachable() |
| 126 | #define __annotate_jump_table | ||
| 122 | #endif | 127 | #endif |
| 123 | 128 | ||
| 124 | #ifndef ASM_UNREACHABLE | 129 | #ifndef ASM_UNREACHABLE |
| @@ -112,6 +112,8 @@ struct ftrace_likely_data { · 111 unmodified lines | |||
| 112 | 112 | ||
| 113 | #if defined(CC_USING_HOTPATCH) | 113 | #if defined(CC_USING_HOTPATCH) |
| 114 | #define notrace __attribute__((hotpatch(0, 0))) | 114 | #define notrace __attribute__((hotpatch(0, 0))) |
| 115 | #elif defined(CC_USING_PATCHABLE_FUNCTION_ENTRY) | ||
| 116 | #define notrace __attribute__((patchable_function_entry(0, 0))) | ||
| 115 | #else | 117 | #else |
| 116 | #define notrace __attribute__((__no_instrument_function__)) | 118 | #define notrace __attribute__((__no_instrument_function__)) |
| 117 | #endif | 119 | #endif |
| @@ -187,6 +189,10 @@ struct ftrace_likely_data { · 69 unmodified lines | |||
| 187 | #define asm_volatile_goto(x...) asm goto(x) | 189 | #define asm_volatile_goto(x...) asm goto(x) |
| 188 | #endif | 190 | #endif |
| 189 | 191 | ||
| 192 | #ifndef __no_fgcse | ||
| 193 | # define __no_fgcse | ||
| 194 | #endif | ||
| 195 | |||
| 190 | /* Are two types/vars the same type (ignoring qualifiers)? */ | 196 | /* Are two types/vars the same type (ignoring qualifiers)? */ |
| 191 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) | 197 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) |
| 192 | 198 | ||
| @@ -1,112 +0,0 @@ | |||
| 1 | /* $Id: concap.h,v 1.3.2.2 2004/01/12 23:08:35 keil Exp $ | ||
| 2 | * | ||
| 3 | * Copyright 1997 by Henner Eisen <eis@baty.hanse.de> | ||
| 4 | * | ||
| 5 | * This software may be used and distributed according to the terms | ||
| 6 | * of the GNU General Public License, incorporated herein by reference. | ||
| 7 | */ | ||
| 8 | |||
| 9 | #ifndef _LINUX_CONCAP_H | ||
| 10 | #define _LINUX_CONCAP_H | ||
| 11 | |||
| 12 | #include <linux/skbuff.h> | ||
| 13 | #include <linux/netdevice.h> | ||
| 14 | |||
| 15 | /* Stuff to support encapsulation protocols genericly. The encapsulation | ||
| 16 | protocol is processed at the uppermost layer of the network interface. | ||
| 17 | |||
| 18 | Based on a ideas developed in a 'synchronous device' thread in the | ||
| 19 | linux-x25 mailing list contributed by Alan Cox, Thomasz Motylewski | ||
| 20 | and Jonathan Naylor. | ||
| 21 | |||
| 22 | For more documetation on this refer to Documentation/isdn/README.concap | ||
| 23 | */ | ||
| 24 | |||
| 25 | struct concap_proto_ops; | ||
| 26 | struct concap_device_ops; | ||
| 27 | |||
| 28 | /* this manages all data needed by the encapsulation protocol | ||
| 29 | */ | ||
| 30 | struct concap_proto{ | ||
| 31 | struct net_device *net_dev; /* net device using our service */ | ||
| 32 | struct concap_device_ops *dops; /* callbacks provided by device */ | ||
| 33 | struct concap_proto_ops *pops; /* callbacks provided by us */ | ||
| 34 | spinlock_t lock; | ||
| 35 | int flags; | ||
| 36 | void *proto_data; /* protocol specific private data, to | ||
| 37 | be accessed via *pops methods only*/ | ||
| 38 | /* | ||
| 39 | : | ||
| 40 | whatever | ||
| 41 | : | ||
| 42 | */ | ||
| 43 | }; | ||
| 44 | |||
| 45 | /* Operations to be supported by the net device. Called by the encapsulation | ||
| 46 | * protocol entity. No receive method is offered because the encapsulation | ||
| 47 | * protocol directly calls netif_rx(). | ||
| 48 | */ | ||
| 49 | struct concap_device_ops{ | ||
| 50 | |||
| 51 | /* to request data is submitted by device*/ | ||
| 52 | int (*data_req)(struct concap_proto *, struct sk_buff *); | ||
| 53 | |||
| 54 | /* Control methods must be set to NULL by devices which do not | ||
| 55 | support connection control.*/ | ||
| 56 | /* to request a connection is set up */ | ||
| 57 | int (*connect_req)(struct concap_proto *); | ||
| 58 | |||
| 59 | /* to request a connection is released */ | ||
| 60 | int (*disconn_req)(struct concap_proto *); | ||
| 61 | }; | ||
| 62 | |||
| 63 | /* Operations to be supported by the encapsulation protocol. Called by | ||
| 64 | * device driver. | ||
| 65 | */ | ||
| 66 | struct concap_proto_ops{ | ||
| 67 | |||
| 68 | /* create a new encapsulation protocol instance of same type */ | ||
| 69 | struct concap_proto * (*proto_new) (void); | ||
| 70 | |||
| 71 | /* delete encapsulation protocol instance and free all its resources. | ||
| 72 | cprot may no loger be referenced after calling this */ | ||
| 73 | void (*proto_del)(struct concap_proto *cprot); | ||
| 74 | |||
| 75 | /* initialize the protocol's data. To be called at interface startup | ||
| 76 | or when the device driver resets the interface. All services of the | ||
| 77 | encapsulation protocol may be used after this*/ | ||
| 78 | int (*restart)(struct concap_proto *cprot, | ||
| 79 | struct net_device *ndev, | ||
| 80 | struct concap_device_ops *dops); | ||
| 81 | |||
| 82 | /* inactivate an encapsulation protocol instance. The encapsulation | ||
| 83 | protocol may not call any *dops methods after this. */ | ||
| 84 | int (*close)(struct concap_proto *cprot); | ||
| 85 | |||
| 86 | /* process a frame handed down to us by upper layer */ | ||
| 87 | int (*encap_and_xmit)(struct concap_proto *cprot, struct sk_buff *skb); | ||
| 88 | |||
| 89 | /* to be called for each data entity received from lower layer*/ | ||
| 90 | int (*data_ind)(struct concap_proto *cprot, struct sk_buff *skb); | ||
| 91 | |||
| 92 | /* to be called when a connection was set up/down. | ||
| 93 | Protocols that don't process these primitives might fill in | ||
| 94 | dummy methods here */ | ||
| 95 | int (*connect_ind)(struct concap_proto *cprot); | ||
| 96 | int (*disconn_ind)(struct concap_proto *cprot); | ||
| 97 | /* | ||
| 98 | Some network device support functions, like net_header(), rebuild_header(), | ||
| 99 | and others, that depend solely on the encapsulation protocol, might | ||
| 100 | be provided here, too. The net device would just fill them in its | ||
| 101 | corresponding fields when it is opened. | ||
| 102 | */ | ||
| 103 | }; | ||
| 104 | |||
| 105 | /* dummy restart/close/connect/reset/disconn methods | ||
| 106 | */ | ||
| 107 | extern int concap_nop(struct concap_proto *cprot); | ||
| 108 | |||
| 109 | /* dummy submit method | ||
| 110 | */ | ||
| 111 | extern int concap_drop_skb(struct concap_proto *cprot, struct sk_buff *skb); | ||
| 112 | #endif | ||
| @@ -50,15 +50,75 @@ struct cn_dev { · 49 unmodified lines | |||
| 50 | 50 | ||
| 51 | u32 seq, groups; | 51 | u32 seq, groups; |
| 52 | struct sock *nls; | 52 | struct sock *nls; |
| 53 | void (*input) (struct sk_buff *skb); | ||
| 54 | 53 | ||
| 55 | struct cn_queue_dev *cbdev; | 54 | struct cn_queue_dev *cbdev; |
| 56 | }; | 55 | }; |
| 57 | 56 | ||
| 57 | /** | ||
| 58 | * cn_add_callback() - Registers new callback with connector core. | ||
| 59 | * | ||
| 60 | * @id: unique connector's user identifier. | ||
| 61 | * It must be registered in connector.h for legal | ||
| 62 | * in-kernel users. | ||
| 63 | * @name: connector's callback symbolic name. | ||
| 64 | * @callback: connector's callback. | ||
| 65 | * parameters are %cn_msg and the sender's credentials | ||
| 66 | */ | ||
| 58 | int cn_add_callback(struct cb_id *id, const char *name, | 67 | int cn_add_callback(struct cb_id *id, const char *name, |
| 59 | void (*callback)(struct cn_msg *, struct netlink_skb_parms *)); | 68 | void (*callback)(struct cn_msg *, struct netlink_skb_parms *)); |
| 60 | void cn_del_callback(struct cb_id *); | 69 | /** |
| 70 | * cn_del_callback() - Unregisters new callback with connector core. | ||
| 71 | * | ||
| 72 | * @id: unique connector's user identifier. | ||
| 73 | */ | ||
| 74 | void cn_del_callback(struct cb_id *id); | ||
| 75 | |||
| 76 | |||
| 77 | /** | ||
| 78 | * cn_netlink_send_mult - Sends message to the specified groups. | ||
| 79 | * | ||
| 80 | * @msg: message header(with attached data). | ||
| 81 | * @len: Number of @msg to be sent. | ||
| 82 | * @portid: destination port. | ||
| 83 | * If non-zero the message will be sent to the given port, | ||
| 84 | * which should be set to the original sender. | ||
| 85 | * @group: destination group. | ||
| 86 | * If @portid and @group is zero, then appropriate group will | ||
| 87 | * be searched through all registered connector users, and | ||
| 88 | * message will be delivered to the group which was created | ||
| 89 | * for user with the same ID as in @msg. | ||
| 90 | * If @group is not zero, then message will be delivered | ||
| 91 | * to the specified group. | ||
| 92 | * @gfp_mask: GFP mask. | ||
| 93 | * | ||
| 94 | * It can be safely called from softirq context, but may silently | ||
| 95 | * fail under strong memory pressure. | ||
| 96 | * | ||
| 97 | * If there are no listeners for given group %-ESRCH can be returned. | ||
| 98 | */ | ||
| 61 | int cn_netlink_send_mult(struct cn_msg *msg, u16 len, u32 portid, u32 group, gfp_t gfp_mask); | 99 | int cn_netlink_send_mult(struct cn_msg *msg, u16 len, u32 portid, u32 group, gfp_t gfp_mask); |
| 100 | |||
| 101 | /** | ||
| 102 | * cn_netlink_send_mult - Sends message to the specified groups. | ||
| 103 | * | ||
| 104 | * @msg: message header(with attached data). | ||
| 105 | * @portid: destination port. | ||
| 106 | * If non-zero the message will be sent to the given port, | ||
| 107 | * which should be set to the original sender. | ||
| 108 | * @group: destination group. | ||
| 109 | * If @portid and @group is zero, then appropriate group will | ||
| 110 | * be searched through all registered connector users, and | ||
| 111 | * message will be delivered to the group which was created | ||
| 112 | * for user with the same ID as in @msg. | ||
| 113 | * If @group is not zero, then message will be delivered | ||
| 114 | * to the specified group. | ||
| 115 | * @gfp_mask: GFP mask. | ||
| 116 | * | ||
| 117 | * It can be safely called from softirq context, but may silently | ||
| 118 | * fail under strong memory pressure. | ||
| 119 | * | ||
| 120 | * If there are no listeners for given group %-ESRCH can be returned. | ||
| 121 | */ | ||
| 62 | int cn_netlink_send(struct cn_msg *msg, u32 portid, u32 group, gfp_t gfp_mask); | 122 | int cn_netlink_send(struct cn_msg *msg, u32 portid, u32 group, gfp_t gfp_mask); |
| 63 | 123 | ||
| 64 | int cn_queue_add_callback(struct cn_queue_dev *dev, const char *name, | 124 | int cn_queue_add_callback(struct cn_queue_dev *dev, const char *name, |
| @@ -168,9 +168,6 @@ extern void vc_SAK(struct work_struct *work); · 167 unmodified lines | |||
| 168 | 168 | ||
| 169 | #define CUR_DEFAULT CUR_UNDERLINE | 169 | #define CUR_DEFAULT CUR_UNDERLINE |
| 170 | 170 | ||
| 171 | static inline bool con_is_visible(const struct vc_data *vc) | 171 | bool con_is_visible(const struct vc_data *vc); |
| 172 | { | ||
| 173 | return *vc->vc_display_fg == vc; | ||
| 174 | } | ||
| 175 | 172 | ||
| 176 | #endif /* _LINUX_CONSOLE_STRUCT_H */ | 173 | #endif /* _LINUX_CONSOLE_STRUCT_H */ |
| @@ -91,15 +91,11 @@ union coresight_dev_subtype { · 90 unmodified lines | |||
| 91 | 91 | ||
| 92 | /** | 92 | /** |
| 93 | * struct coresight_platform_data - data harvested from the DT specification | 93 | * struct coresight_platform_data - data harvested from the DT specification |
| 94 | * @cpu: the CPU a source belongs to. Only applicable for ETM/PTMs. | ||
| 95 | * @name: name of the component as shown under sysfs. | ||
| 96 | * @nr_inport: number of input ports for this component. | 94 | * @nr_inport: number of input ports for this component. |
| 97 | * @nr_outport: number of output ports for this component. | 95 | * @nr_outport: number of output ports for this component. |
| 98 | * @conns: Array of nr_outport connections from this component | 96 | * @conns: Array of nr_outport connections from this component |
| 99 | */ | 97 | */ |
| 100 | struct coresight_platform_data { | 98 | struct coresight_platform_data { |
| 101 | int cpu; | ||
| 102 | const char *name; | ||
| 103 | int nr_inport; | 99 | int nr_inport; |
| 104 | int nr_outport; | 100 | int nr_outport; |
| 105 | struct coresight_connection *conns; | 101 | struct coresight_connection *conns; |
| @@ -110,11 +106,12 @@ struct coresight_platform_data { · 4 unmodified lines | |||
| 110 | * @type: as defined by @coresight_dev_type. | 106 | * @type: as defined by @coresight_dev_type. |
| 111 | * @subtype: as defined by @coresight_dev_subtype. | 107 | * @subtype: as defined by @coresight_dev_subtype. |
| 112 | * @ops: generic operations for this component, as defined | 108 | * @ops: generic operations for this component, as defined |
| 113 | by @coresight_ops. | 109 | * by @coresight_ops. |
| 114 | * @pdata: platform data collected from DT. | 110 | * @pdata: platform data collected from DT. |
| 115 | * @dev: The device entity associated to this component. | 111 | * @dev: The device entity associated to this component. |
| 116 | * @groups: operations specific to this component. These will end up | 112 | * @groups: operations specific to this component. These will end up |
| 117 | in the component's sysfs sub-directory. | 113 | * in the component's sysfs sub-directory. |
| 114 | * @name: name for the coresight device, also shown under sysfs. | ||
| 118 | */ | 115 | */ |
| 119 | struct coresight_desc { | 116 | struct coresight_desc { |
| 120 | enum coresight_dev_type type; | 117 | enum coresight_dev_type type; |
| @@ -123,28 +120,27 @@ struct coresight_desc { · 2 unmodified lines | |||
| 123 | struct coresight_platform_data *pdata; | 120 | struct coresight_platform_data *pdata; |
| 124 | struct device *dev; | 121 | struct device *dev; |
| 125 | const struct attribute_group **groups; | 122 | const struct attribute_group **groups; |
| 123 | const char *name; | ||
| 126 | }; | 124 | }; |
| 127 | 125 | ||
| 128 | /** | 126 | /** |
| 129 | * struct coresight_connection - representation of a single connection | 127 | * struct coresight_connection - representation of a single connection |
| 130 | * @outport: a connection's output port number. | 128 | * @outport: a connection's output port number. |
| 131 | * @chid_name: remote component's name. | ||
| 132 | * @child_port: remote component's port number @output is connected to. | 129 | * @child_port: remote component's port number @output is connected to. |
| 130 | * @chid_fwnode: remote component's fwnode handle. | ||
| 133 | * @child_dev: a @coresight_device representation of the component | 131 | * @child_dev: a @coresight_device representation of the component |
| 134 | connected to @outport. | 132 | connected to @outport. |
| 135 | */ | 133 | */ |
| 136 | struct coresight_connection { | 134 | struct coresight_connection { |
| 137 | int outport; | 135 | int outport; |
| 138 | const char *child_name; | ||
| 139 | int child_port; | 136 | int child_port; |
| 137 | struct fwnode_handle *child_fwnode; | ||
| 140 | struct coresight_device *child_dev; | 138 | struct coresight_device *child_dev; |
| 141 | }; | 139 | }; |
| 142 | 140 | ||
| 143 | /** | 141 | /** |
| 144 | * struct coresight_device - representation of a device as used by the framework | 142 | * struct coresight_device - representation of a device as used by the framework |
| 145 | * @conns: array of coresight_connections associated to this component. | 143 | * @pdata: Platform data with device connections associated to this device. |
| 146 | * @nr_inport: number of input port associated to this component. | ||
| 147 | * @nr_outport: number of output port associated to this component. | ||
| 148 | * @type: as defined by @coresight_dev_type. | 144 | * @type: as defined by @coresight_dev_type. |
| 149 | * @subtype: as defined by @coresight_dev_subtype. | 145 | * @subtype: as defined by @coresight_dev_subtype. |
| 150 | * @ops: generic operations for this component, as defined | 146 | * @ops: generic operations for this component, as defined |
| @@ -159,9 +155,7 @@ struct coresight_connection { · 8 unmodified lines | |||
| 159 | * @ea: Device attribute for sink representation under PMU directory. | 155 | * @ea: Device attribute for sink representation under PMU directory. |
| 160 | */ | 156 | */ |
| 161 | struct coresight_device { | 157 | struct coresight_device { |
| 162 | struct coresight_connection *conns; | 158 | struct coresight_platform_data *pdata; |
| 163 | int nr_inport; | ||
| 164 | int nr_outport; | ||
| 165 | enum coresight_dev_type type; | 159 | enum coresight_dev_type type; |
| 166 | union coresight_dev_subtype subtype; | 160 | union coresight_dev_subtype subtype; |
| 167 | const struct coresight_ops *ops; | 161 | const struct coresight_ops *ops; |
| @@ -174,6 +168,28 @@ struct coresight_device { · 6 unmodified lines | |||
| 174 | struct dev_ext_attribute *ea; | 168 | struct dev_ext_attribute *ea; |
| 175 | }; | 169 | }; |
| 176 | 170 | ||
| 171 | /* | ||
| 172 | * coresight_dev_list - Mapping for devices to "name" index for device | ||
| 173 | * names. | ||
| 174 | * | ||
| 175 | * @nr_idx: Number of entries already allocated. | ||
| 176 | * @pfx: Prefix pattern for device name. | ||
| 177 | * @fwnode_list: Array of fwnode_handles associated with each allocated | ||
| 178 | * index, upto nr_idx entries. | ||
| 179 | */ | ||
| 180 | struct coresight_dev_list { | ||
| 181 | int nr_idx; | ||
| 182 | const char *pfx; | ||
| 183 | struct fwnode_handle **fwnode_list; | ||
| 184 | }; | ||
| 185 | |||
| 186 | #define DEFINE_CORESIGHT_DEVLIST(var, dev_pfx) \ | ||
| 187 | static struct coresight_dev_list (var) = { \ | ||
| 188 | .pfx = dev_pfx, \ | ||
| 189 | .nr_idx = 0, \ | ||
| 190 | .fwnode_list = NULL, \ | ||
| 191 | } | ||
| 192 | |||
| 177 | #define to_coresight_device(d) container_of(d, struct coresight_device, dev) | 193 | #define to_coresight_device(d) container_of(d, struct coresight_device, dev) |
| 178 | 194 | ||
| 179 | #define source_ops(csdev) csdev->ops->source_ops | 195 | #define source_ops(csdev) csdev->ops->source_ops |
| @@ -267,7 +283,8 @@ extern int coresight_claim_device_unlocked(void __iomem *base); · 87 unmodified lines | |||
| 267 | 283 | ||
| 268 | extern void coresight_disclaim_device(void __iomem *base); | 284 | extern void coresight_disclaim_device(void __iomem *base); |
| 269 | extern void coresight_disclaim_device_unlocked(void __iomem *base); | 285 | extern void coresight_disclaim_device_unlocked(void __iomem *base); |
| 270 | 286 | extern char *coresight_alloc_device_name(struct coresight_dev_list *devs, | |
| 287 | struct device *dev); | ||
| 271 | #else | 288 | #else |
| 272 | static inline struct coresight_device * | 289 | static inline struct coresight_device * |
| 273 | coresight_register(struct coresight_desc *desc) { return NULL; } | 290 | coresight_register(struct coresight_desc *desc) { return NULL; } |
| @@ -292,16 +309,8 @@ static inline void coresight_disclaim_device_unlocked(void __iomem *base) {} · 18 unmodified lines | |||
| 292 | 309 | ||
| 293 | #endif | 310 | #endif |
| 294 | 311 | ||
| 295 | #ifdef CONFIG_OF | 312 | extern int coresight_get_cpu(struct device *dev); |
| 296 | extern int of_coresight_get_cpu(const struct device_node *node); | 313 | |
| 297 | extern struct coresight_platform_data * | 314 | struct coresight_platform_data *coresight_get_platform_data(struct device *dev); |
| 298 | of_get_coresight_platform_data(struct device *dev, | ||
| 299 | const struct device_node *node); | ||
| 300 | #else | ||
| 301 | static inline int of_coresight_get_cpu(const struct device_node *node) | ||
| 302 | { return 0; } | ||
| 303 | static inline struct coresight_platform_data *of_get_coresight_platform_data( | ||
| 304 | struct device *dev, const struct device_node *node) { return NULL; } | ||
| 305 | #endif | ||
| 306 | 315 | ||
| 307 | #endif | 316 | #endif |
| @@ -47,11 +47,6 @@ struct cpufreq_cpuinfo { · 46 unmodified lines | |||
| 47 | unsigned int transition_latency; | 47 | unsigned int transition_latency; |
| 48 | }; | 48 | }; |
| 49 | 49 | ||
| 50 | struct cpufreq_user_policy { | ||
| 51 | unsigned int min; /* in kHz */ | ||
| 52 | unsigned int max; /* in kHz */ | ||
| 53 | }; | ||
| 54 | |||
| 55 | struct cpufreq_policy { | 50 | struct cpufreq_policy { |
| 56 | /* CPUs sharing clock, require sw coordination */ | 51 | /* CPUs sharing clock, require sw coordination */ |
| 57 | cpumask_var_t cpus; /* Online CPUs only */ | 52 | cpumask_var_t cpus; /* Online CPUs only */ |
| @@ -81,7 +76,8 @@ struct cpufreq_policy { · 23 unmodified lines | |||
| 81 | struct work_struct update; /* if update_policy() needs to be | 76 | struct work_struct update; /* if update_policy() needs to be |
| 82 | * called, but you're in IRQ context */ | 77 | * called, but you're in IRQ context */ |
| 83 | 78 | ||
| 84 | struct cpufreq_user_policy user_policy; | 79 | struct dev_pm_qos_request *min_freq_req; |
| 80 | struct dev_pm_qos_request *max_freq_req; | ||
| 85 | struct cpufreq_frequency_table *freq_table; | 81 | struct cpufreq_frequency_table *freq_table; |
| 86 | enum cpufreq_table_sorting freq_table_sorted; | 82 | enum cpufreq_table_sorting freq_table_sorted; |
| 87 | 83 | ||
| @@ -144,6 +140,9 @@ struct cpufreq_policy { · 56 unmodified lines | |||
| 144 | 140 | ||
| 145 | /* Pointer to the cooling device if used for thermal mitigation */ | 141 | /* Pointer to the cooling device if used for thermal mitigation */ |
| 146 | struct thermal_cooling_device *cdev; | 142 | struct thermal_cooling_device *cdev; |
| 143 | |||
| 144 | struct notifier_block nb_min; | ||
| 145 | struct notifier_block nb_max; | ||
| 147 | }; | 146 | }; |
| 148 | 147 | ||
| 149 | struct cpufreq_freqs { | 148 | struct cpufreq_freqs { |
| @@ -201,6 +200,7 @@ void cpufreq_cpu_release(struct cpufreq_policy *policy); · 51 unmodified lines | |||
| 201 | int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu); | 200 | int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu); |
| 202 | int cpufreq_set_policy(struct cpufreq_policy *policy, | 201 | int cpufreq_set_policy(struct cpufreq_policy *policy, |
| 203 | struct cpufreq_policy *new_policy); | 202 | struct cpufreq_policy *new_policy); |
| 203 | void refresh_frequency_limits(struct cpufreq_policy *policy); | ||
| 204 | void cpufreq_update_policy(unsigned int cpu); | 204 | void cpufreq_update_policy(unsigned int cpu); |
| 205 | void cpufreq_update_limits(unsigned int cpu); | 205 | void cpufreq_update_limits(unsigned int cpu); |
| 206 | bool have_governor_per_policy(void); | 206 | bool have_governor_per_policy(void); |
| @@ -406,6 +406,12 @@ int cpufreq_unregister_driver(struct cpufreq_driver *driver_data); · 199 unmodified lines | |||
| 406 | const char *cpufreq_get_current_driver(void); | 406 | const char *cpufreq_get_current_driver(void); |
| 407 | void *cpufreq_get_driver_data(void); | 407 | void *cpufreq_get_driver_data(void); |
| 408 | 408 | ||
| 409 | static inline int cpufreq_thermal_control_enabled(struct cpufreq_driver *drv) | ||
| 410 | { | ||
| 411 | return IS_ENABLED(CONFIG_CPU_THERMAL) && | ||
| 412 | (drv->flags & CPUFREQ_IS_COOLING_DEV); | ||
| 413 | } | ||
| 414 | |||
| 409 | static inline void cpufreq_verify_within_limits(struct cpufreq_policy *policy, | 415 | static inline void cpufreq_verify_within_limits(struct cpufreq_policy *policy, |
| 410 | unsigned int min, unsigned int max) | 416 | unsigned int min, unsigned int max) |
| 411 | { | 417 | { |
| @@ -986,7 +992,7 @@ extern struct freq_attr *cpufreq_generic_attr[]; · 574 unmodified lines | |||
| 986 | int cpufreq_table_validate_and_sort(struct cpufreq_policy *policy); | 992 | int cpufreq_table_validate_and_sort(struct cpufreq_policy *policy); |
| 987 | 993 | ||
| 988 | unsigned int cpufreq_generic_get(unsigned int cpu); | 994 | unsigned int cpufreq_generic_get(unsigned int cpu); |
| 989 | int cpufreq_generic_init(struct cpufreq_policy *policy, | 995 | void cpufreq_generic_init(struct cpufreq_policy *policy, |
| 990 | struct cpufreq_frequency_table *table, | 996 | struct cpufreq_frequency_table *table, |
| 991 | unsigned int transition_latency); | 997 | unsigned int transition_latency); |
| 992 | #endif /* _LINUX_CPUFREQ_H */ | 998 | #endif /* _LINUX_CPUFREQ_H */ |
| @@ -116,10 +116,10 @@ enum cpuhp_state { · 115 unmodified lines | |||
| 116 | CPUHP_AP_PERF_ARM_ACPI_STARTING, | 116 | CPUHP_AP_PERF_ARM_ACPI_STARTING, |
| 117 | CPUHP_AP_PERF_ARM_STARTING, | 117 | CPUHP_AP_PERF_ARM_STARTING, |
| 118 | CPUHP_AP_ARM_L2X0_STARTING, | 118 | CPUHP_AP_ARM_L2X0_STARTING, |
| 119 | CPUHP_AP_EXYNOS4_MCT_TIMER_STARTING, | ||
| 119 | CPUHP_AP_ARM_ARCH_TIMER_STARTING, | 120 | CPUHP_AP_ARM_ARCH_TIMER_STARTING, |
| 120 | CPUHP_AP_ARM_GLOBAL_TIMER_STARTING, | 121 | CPUHP_AP_ARM_GLOBAL_TIMER_STARTING, |
| 121 | CPUHP_AP_JCORE_TIMER_STARTING, | 122 | CPUHP_AP_JCORE_TIMER_STARTING, |
| 122 | CPUHP_AP_EXYNOS4_MCT_TIMER_STARTING, | ||
| 123 | CPUHP_AP_ARM_TWD_STARTING, | 123 | CPUHP_AP_ARM_TWD_STARTING, |
| 124 | CPUHP_AP_QCOM_TIMER_STARTING, | 124 | CPUHP_AP_QCOM_TIMER_STARTING, |
| 125 | CPUHP_AP_TEGRA_TIMER_STARTING, | 125 | CPUHP_AP_TEGRA_TIMER_STARTING, |
| @@ -176,6 +176,7 @@ enum cpuhp_state { · 50 unmodified lines | |||
| 176 | CPUHP_AP_WATCHDOG_ONLINE, | 176 | CPUHP_AP_WATCHDOG_ONLINE, |
| 177 | CPUHP_AP_WORKQUEUE_ONLINE, | 177 | CPUHP_AP_WORKQUEUE_ONLINE, |
| 178 | CPUHP_AP_RCUTREE_ONLINE, | 178 | CPUHP_AP_RCUTREE_ONLINE, |
| 179 | CPUHP_AP_BASE_CACHEINFO_ONLINE, | ||
| 179 | CPUHP_AP_ONLINE_DYN, | 180 | CPUHP_AP_ONLINE_DYN, |
| 180 | CPUHP_AP_ONLINE_DYN_END = CPUHP_AP_ONLINE_DYN + 30, | 181 | CPUHP_AP_ONLINE_DYN_END = CPUHP_AP_ONLINE_DYN + 30, |
| 181 | CPUHP_AP_X86_HPET_ONLINE, | 182 | CPUHP_AP_X86_HPET_ONLINE, |
| @@ -145,7 +145,11 @@ struct cred { · 144 unmodified lines | |||
| 145 | struct user_struct *user; /* real user ID subscription */ | 145 | struct user_struct *user; /* real user ID subscription */ |
| 146 | struct user_namespace *user_ns; /* user_ns the caps and keyrings are relative to. */ | 146 | struct user_namespace *user_ns; /* user_ns the caps and keyrings are relative to. */ |
| 147 | struct group_info *group_info; /* supplementary groups for euid/fsgid */ | 147 | struct group_info *group_info; /* supplementary groups for euid/fsgid */ |
| 148 | struct rcu_head rcu; /* RCU deletion hook */ | 148 | /* RCU deletion */ |
| 149 | union { | ||
| 150 | int non_rcu; /* Can we skip RCU deletion? */ | ||
| 151 | struct rcu_head rcu; /* RCU deletion hook */ | ||
| 152 | }; | ||
| 149 | } __randomize_layout; | 153 | } __randomize_layout; |
| 150 | 154 | ||
| 151 | extern void __put_cred(struct cred *); | 155 | extern void __put_cred(struct cred *); |
| @@ -246,6 +250,7 @@ static inline const struct cred *get_cred(const struct cred *cred) · 94 unmodified lines | |||
| 246 | if (!cred) | 250 | if (!cred) |
| 247 | return cred; | 251 | return cred; |
| 248 | validate_creds(cred); | 252 | validate_creds(cred); |
| 253 | nonconst_cred->non_rcu = 0; | ||
| 249 | return get_new_cred(nonconst_cred); | 254 | return get_new_cred(nonconst_cred); |
| 250 | } | 255 | } |
| 251 | 256 | ||
| @@ -257,6 +262,7 @@ static inline const struct cred *get_cred_rcu(const struct cred *cred) · 5 unmodified lines | |||
| 257 | if (!atomic_inc_not_zero(&nonconst_cred->usage)) | 262 | if (!atomic_inc_not_zero(&nonconst_cred->usage)) |
| 258 | return NULL; | 263 | return NULL; |
| 259 | validate_creds(cred); | 264 | validate_creds(cred); |
| 265 | nonconst_cred->non_rcu = 0; | ||
| 260 | return cred; | 266 | return cred; |
| 261 | } | 267 | } |
| 262 | 268 | ||
| @@ -49,7 +49,6 @@ · 48 unmodified lines | |||
| 49 | #define CRYPTO_ALG_TYPE_SCOMPRESS 0x0000000b | 49 | #define CRYPTO_ALG_TYPE_SCOMPRESS 0x0000000b |
| 50 | #define CRYPTO_ALG_TYPE_RNG 0x0000000c | 50 | #define CRYPTO_ALG_TYPE_RNG 0x0000000c |
| 51 | #define CRYPTO_ALG_TYPE_AKCIPHER 0x0000000d | 51 | #define CRYPTO_ALG_TYPE_AKCIPHER 0x0000000d |
| 52 | #define CRYPTO_ALG_TYPE_DIGEST 0x0000000e | ||
| 53 | #define CRYPTO_ALG_TYPE_HASH 0x0000000e | 52 | #define CRYPTO_ALG_TYPE_HASH 0x0000000e |
| 54 | #define CRYPTO_ALG_TYPE_SHASH 0x0000000e | 53 | #define CRYPTO_ALG_TYPE_SHASH 0x0000000e |
| 55 | #define CRYPTO_ALG_TYPE_AHASH 0x0000000f | 54 | #define CRYPTO_ALG_TYPE_AHASH 0x0000000f |
| @@ -323,6 +322,17 @@ struct cipher_alg { · 267 unmodified lines | |||
| 323 | void (*cia_decrypt)(struct crypto_tfm *tfm, u8 *dst, const u8 *src); | 322 | void (*cia_decrypt)(struct crypto_tfm *tfm, u8 *dst, const u8 *src); |
| 324 | }; | 323 | }; |
| 325 | 324 | ||
| 325 | /** | ||
| 326 | * struct compress_alg - compression/decompression algorithm | ||
| 327 | * @coa_compress: Compress a buffer of specified length, storing the resulting | ||
| 328 | * data in the specified buffer. Return the length of the | ||
| 329 | * compressed data in dlen. | ||
| 330 | * @coa_decompress: Decompress the source buffer, storing the uncompressed | ||
| 331 | * data in the specified buffer. The length of the data is | ||
| 332 | * returned in dlen. | ||
| 333 | * | ||
| 334 | * All fields are mandatory. | ||
| 335 | */ | ||
| 326 | struct compress_alg { | 336 | struct compress_alg { |
| 327 | int (*coa_compress)(struct crypto_tfm *tfm, const u8 *src, | 337 | int (*coa_compress)(struct crypto_tfm *tfm, const u8 *src, |
| 328 | unsigned int slen, u8 *dst, unsigned int *dlen); | 338 | unsigned int slen, u8 *dst, unsigned int *dlen); |
| @@ -7,6 +7,9 @@ · 6 unmodified lines | |||
| 7 | #include <linux/radix-tree.h> | 7 | #include <linux/radix-tree.h> |
| 8 | #include <asm/pgtable.h> | 8 | #include <asm/pgtable.h> |
| 9 | 9 | ||
| 10 | /* Flag for synchronous flush */ | ||
| 11 | #define DAXDEV_F_SYNC (1UL << 0) | ||
| 12 | |||
| 10 | typedef unsigned long dax_entry_t; | 13 | typedef unsigned long dax_entry_t; |
| 11 | 14 | ||
| 12 | struct iomap_ops; | 15 | struct iomap_ops; |
| @@ -38,18 +41,40 @@ extern struct attribute_group dax_attribute_group; · 25 unmodified lines | |||
| 38 | #if IS_ENABLED(CONFIG_DAX) | 41 | #if IS_ENABLED(CONFIG_DAX) |
| 39 | struct dax_device *dax_get_by_host(const char *host); | 42 | struct dax_device *dax_get_by_host(const char *host); |
| 40 | struct dax_device *alloc_dax(void *private, const char *host, | 43 | struct dax_device *alloc_dax(void *private, const char *host, |
| 41 | const struct dax_operations *ops); | 44 | const struct dax_operations *ops, unsigned long flags); |
| 42 | void put_dax(struct dax_device *dax_dev); | 45 | void put_dax(struct dax_device *dax_dev); |
| 43 | void kill_dax(struct dax_device *dax_dev); | 46 | void kill_dax(struct dax_device *dax_dev); |
| 44 | void dax_write_cache(struct dax_device *dax_dev, bool wc); | 47 | void dax_write_cache(struct dax_device *dax_dev, bool wc); |
| 45 | bool dax_write_cache_enabled(struct dax_device *dax_dev); | 48 | bool dax_write_cache_enabled(struct dax_device *dax_dev); |
| 49 | bool __dax_synchronous(struct dax_device *dax_dev); | ||
| 50 | static inline bool dax_synchronous(struct dax_device *dax_dev) | ||
| 51 | { | ||
| 52 | return __dax_synchronous(dax_dev); | ||
| 53 | } | ||
| 54 | void __set_dax_synchronous(struct dax_device *dax_dev); | ||
| 55 | static inline void set_dax_synchronous(struct dax_device *dax_dev) | ||
| 56 | { | ||
| 57 | __set_dax_synchronous(dax_dev); | ||
| 58 | } | ||
| 59 | /* | ||
| 60 | * Check if given mapping is supported by the file / underlying device. | ||
| 61 | */ | ||
| 62 | static inline bool daxdev_mapping_supported(struct vm_area_struct *vma, | ||
| 63 | struct dax_device *dax_dev) | ||
| 64 | { | ||
| 65 | if (!(vma->vm_flags & VM_SYNC)) | ||
| 66 | return true; | ||
| 67 | if (!IS_DAX(file_inode(vma->vm_file))) | ||
| 68 | return false; | ||
| 69 | return dax_synchronous(dax_dev); | ||
| 70 | } | ||
| 46 | #else | 71 | #else |
| 47 | static inline struct dax_device *dax_get_by_host(const char *host) | 72 | static inline struct dax_device *dax_get_by_host(const char *host) |
| 48 | { | 73 | { |
| 49 | return NULL; | 74 | return NULL; |
| 50 | } | 75 | } |
| 51 | static inline struct dax_device *alloc_dax(void *private, const char *host, | 76 | static inline struct dax_device *alloc_dax(void *private, const char *host, |
| 52 | const struct dax_operations *ops) | 77 | const struct dax_operations *ops, unsigned long flags) |
| 53 | { | 78 | { |
| 54 | /* | 79 | /* |
| 55 | * Callers should check IS_ENABLED(CONFIG_DAX) to know if this | 80 | * Callers should check IS_ENABLED(CONFIG_DAX) to know if this |
| @@ -70,6 +95,18 @@ static inline bool dax_write_cache_enabled(struct dax_device *dax_dev) · 14 unmodified lines | |||
| 70 | { | 95 | { |
| 71 | return false; | 96 | return false; |
| 72 | } | 97 | } |
| 98 | static inline bool dax_synchronous(struct dax_device *dax_dev) | ||
| 99 | { | ||
| 100 | return true; | ||
| 101 | } | ||
| 102 | static inline void set_dax_synchronous(struct dax_device *dax_dev) | ||
| 103 | { | ||
| 104 | } | ||
| 105 | static inline bool daxdev_mapping_supported(struct vm_area_struct *vma, | ||
| 106 | struct dax_device *dax_dev) | ||
| 107 | { | ||
| 108 | return !(vma->vm_flags & VM_SYNC); | ||
| 109 | } | ||
| 73 | #endif | 110 | #endif |
| 74 | 111 | ||
| 75 | struct writeback_control; | 112 | struct writeback_control; |
| @@ -153,7 +153,7 @@ struct dentry_operations { · 152 unmodified lines | |||
| 153 | * Locking rules for dentry_operations callbacks are to be found in | 153 | * Locking rules for dentry_operations callbacks are to be found in |
| 154 | * Documentation/filesystems/Locking. Keep it updated! | 154 | * Documentation/filesystems/Locking. Keep it updated! |
| 155 | * | 155 | * |
| 156 | * FUrther descriptions are found in Documentation/filesystems/vfs.txt. | 156 | * FUrther descriptions are found in Documentation/filesystems/vfs.rst. |
| 157 | * Keep it updated too! | 157 | * Keep it updated too! |
| 158 | */ | 158 | */ |
| 159 | 159 | ||
| @@ -291,7 +291,6 @@ static inline unsigned d_count(const struct dentry *dentry) · 131 unmodified lines | |||
| 291 | */ | 291 | */ |
| 292 | extern __printf(4, 5) | 292 | extern __printf(4, 5) |
| 293 | char *dynamic_dname(struct dentry *, char *, int, const char *, ...); | 293 | char *dynamic_dname(struct dentry *, char *, int, const char *, ...); |
| 294 | extern char *simple_dname(struct dentry *, char *, int); | ||
| 295 | 294 | ||
| 296 | extern char *__d_path(const struct path *, const struct path *, char *, int); | 295 | extern char *__d_path(const struct path *, const struct path *, char *, int); |
| 297 | extern char *d_absolute_path(const struct path *, char *, int); | 296 | extern char *d_absolute_path(const struct path *, char *, int); |
| @@ -568,7 +567,7 @@ static inline struct dentry *d_backing_dentry(struct dentry *upper) · 270 unmodified lines | |||
| 568 | * If dentry is on a union/overlay, then return the underlying, real dentry. | 567 | * If dentry is on a union/overlay, then return the underlying, real dentry. |
| 569 | * Otherwise return the dentry itself. | 568 | * Otherwise return the dentry itself. |
| 570 | * | 569 | * |
| 571 | * See also: Documentation/filesystems/vfs.txt | 570 | * See also: Documentation/filesystems/vfs.rst |
| 572 | */ | 571 | */ |
| 573 | static inline struct dentry *d_real(struct dentry *dentry, | 572 | static inline struct dentry *d_real(struct dentry *dentry, |
| 574 | const struct inode *inode) | 573 | const struct inode *inode) |
| @@ -133,9 +133,8 @@ struct dentry *debugfs_create_regset32(const char *name, umode_t mode, · 132 unmodified lines | |||
| 133 | void debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs, | 133 | void debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs, |
| 134 | int nregs, void __iomem *base, char *prefix); | 134 | int nregs, void __iomem *base, char *prefix); |
| 135 | 135 | ||
| 136 | struct dentry *debugfs_create_u32_array(const char *name, umode_t mode, | 136 | void debugfs_create_u32_array(const char *name, umode_t mode, |
| 137 | struct dentry *parent, | 137 | struct dentry *parent, u32 *array, u32 elements); |
| 138 | u32 *array, u32 elements); | ||
| 139 | 138 | ||
| 140 | struct dentry *debugfs_create_devm_seqfile(struct device *dev, const char *name, | 139 | struct dentry *debugfs_create_devm_seqfile(struct device *dev, const char *name, |
| 141 | struct dentry *parent, | 140 | struct dentry *parent, |
| @@ -353,11 +352,10 @@ static inline bool debugfs_initialized(void) · 211 unmodified lines | |||
| 353 | return false; | 352 | return false; |
| 354 | } | 353 | } |
| 355 | 354 | ||
| 356 | static inline struct dentry *debugfs_create_u32_array(const char *name, umode_t mode, | 355 | static inline void debugfs_create_u32_array(const char *name, umode_t mode, |
| 357 | struct dentry *parent, | 356 | struct dentry *parent, u32 *array, |
| 358 | u32 *array, u32 elements) | 357 | u32 elements) |
| 359 | { | 358 | { |
| 360 | return ERR_PTR(-ENODEV); | ||
| 361 | } | 359 | } |
| 362 | 360 | ||
| 363 | static inline struct dentry *debugfs_create_devm_seqfile(struct device *dev, | 361 | static inline struct dentry *debugfs_create_devm_seqfile(struct device *dev, |
| @@ -95,8 +95,7 @@ typedef int (*dm_prepare_ioctl_fn) (struct dm_target *ti, struct block_device ** · 94 unmodified lines | |||
| 95 | 95 | ||
| 96 | typedef int (*dm_report_zones_fn) (struct dm_target *ti, sector_t sector, | 96 | typedef int (*dm_report_zones_fn) (struct dm_target *ti, sector_t sector, |
| 97 | struct blk_zone *zones, | 97 | struct blk_zone *zones, |
| 98 | unsigned int *nr_zones, | 98 | unsigned int *nr_zones); |
| 99 | gfp_t gfp_mask); | ||
| 100 | 99 | ||
| 101 | /* | 100 | /* |
| 102 | * These iteration functions are typically used to check (and combine) | 101 | * These iteration functions are typically used to check (and combine) |
| @@ -530,29 +529,20 @@ void *dm_vcalloc(unsigned long nmemb, unsigned long elem_size); · 427 unmodified lines | |||
| 530 | *---------------------------------------------------------------*/ | 529 | *---------------------------------------------------------------*/ |
| 531 | #define DM_NAME "device-mapper" | 530 | #define DM_NAME "device-mapper" |
| 532 | 531 | ||
| 533 | #define DM_RATELIMIT(pr_func, fmt, ...) \ | ||
| 534 | do { \ | ||
| 535 | static DEFINE_RATELIMIT_STATE(rs, DEFAULT_RATELIMIT_INTERVAL, \ | ||
| 536 | DEFAULT_RATELIMIT_BURST); \ | ||
| 537 | \ | ||
| 538 | if (__ratelimit(&rs)) \ | ||
| 539 | pr_func(DM_FMT(fmt), ##__VA_ARGS__); \ | ||
| 540 | } while (0) | ||
| 541 | |||
| 542 | #define DM_FMT(fmt) DM_NAME ": " DM_MSG_PREFIX ": " fmt "\n" | 532 | #define DM_FMT(fmt) DM_NAME ": " DM_MSG_PREFIX ": " fmt "\n" |
| 543 | 533 | ||
| 544 | #define DMCRIT(fmt, ...) pr_crit(DM_FMT(fmt), ##__VA_ARGS__) | 534 | #define DMCRIT(fmt, ...) pr_crit(DM_FMT(fmt), ##__VA_ARGS__) |
| 545 | 535 | ||
| 546 | #define DMERR(fmt, ...) pr_err(DM_FMT(fmt), ##__VA_ARGS__) | 536 | #define DMERR(fmt, ...) pr_err(DM_FMT(fmt), ##__VA_ARGS__) |
| 547 | #define DMERR_LIMIT(fmt, ...) DM_RATELIMIT(pr_err, fmt, ##__VA_ARGS__) | 537 | #define DMERR_LIMIT(fmt, ...) pr_err_ratelimited(DM_FMT(fmt), ##__VA_ARGS__) |
| 548 | #define DMWARN(fmt, ...) pr_warn(DM_FMT(fmt), ##__VA_ARGS__) | 538 | #define DMWARN(fmt, ...) pr_warn(DM_FMT(fmt), ##__VA_ARGS__) |
| 549 | #define DMWARN_LIMIT(fmt, ...) DM_RATELIMIT(pr_warn, fmt, ##__VA_ARGS__) | 539 | #define DMWARN_LIMIT(fmt, ...) pr_warn_ratelimited(DM_FMT(fmt), ##__VA_ARGS__) |
| 550 | #define DMINFO(fmt, ...) pr_info(DM_FMT(fmt), ##__VA_ARGS__) | 540 | #define DMINFO(fmt, ...) pr_info(DM_FMT(fmt), ##__VA_ARGS__) |
| 551 | #define DMINFO_LIMIT(fmt, ...) DM_RATELIMIT(pr_info, fmt, ##__VA_ARGS__) | 541 | #define DMINFO_LIMIT(fmt, ...) pr_info_ratelimited(DM_FMT(fmt), ##__VA_ARGS__) |
| 552 | 542 | ||
| 553 | #ifdef CONFIG_DM_DEBUG | 543 | #ifdef CONFIG_DM_DEBUG |
| 554 | #define DMDEBUG(fmt, ...) printk(KERN_DEBUG DM_FMT(fmt), ##__VA_ARGS__) | 544 | #define DMDEBUG(fmt, ...) printk(KERN_DEBUG DM_FMT(fmt), ##__VA_ARGS__) |
| 555 | #define DMDEBUG_LIMIT(fmt, ...) DM_RATELIMIT(pr_debug, fmt, ##__VA_ARGS__) | 545 | #define DMDEBUG_LIMIT(fmt, ...) pr_debug_ratelimited(DM_FMT(fmt), ##__VA_ARGS__) |
| 556 | #else | 546 | #else |
| 557 | #define DMDEBUG(fmt, ...) no_printk(fmt, ##__VA_ARGS__) | 547 | #define DMDEBUG(fmt, ...) no_printk(fmt, ##__VA_ARGS__) |
| 558 | #define DMDEBUG_LIMIT(fmt, ...) no_printk(fmt, ##__VA_ARGS__) | 548 | #define DMDEBUG_LIMIT(fmt, ...) no_printk(fmt, ##__VA_ARGS__) |
| @@ -6,7 +6,7 @@ · 5 unmodified lines | |||
| 6 | * Copyright (c) 2004-2009 Greg Kroah-Hartman <gregkh@suse.de> | 6 | * Copyright (c) 2004-2009 Greg Kroah-Hartman <gregkh@suse.de> |
| 7 | * Copyright (c) 2008-2009 Novell Inc. | 7 | * Copyright (c) 2008-2009 Novell Inc. |
| 8 | * | 8 | * |
| 9 | * See Documentation/driver-model/ for more information. | 9 | * See Documentation/driver-api/driver-model/ for more information. |
| 10 | */ | 10 | */ |
| 11 | 11 | ||
| 12 | #ifndef _DEVICE_H_ | 12 | #ifndef _DEVICE_H_ |
| @@ -42,6 +42,7 @@ struct iommu_ops; · 29 unmodified lines | |||
| 42 | struct iommu_group; | 42 | struct iommu_group; |
| 43 | struct iommu_fwspec; | 43 | struct iommu_fwspec; |
| 44 | struct dev_pin_info; | 44 | struct dev_pin_info; |
| 45 | struct iommu_param; | ||
| 45 | 46 | ||
| 46 | struct bus_attribute { | 47 | struct bus_attribute { |
| 47 | struct attribute attr; | 48 | struct attribute attr; |
| @@ -163,11 +164,13 @@ void subsys_dev_iter_init(struct subsys_dev_iter *iter, · 115 unmodified lines | |||
| 163 | struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter); | 164 | struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter); |
| 164 | void subsys_dev_iter_exit(struct subsys_dev_iter *iter); | 165 | void subsys_dev_iter_exit(struct subsys_dev_iter *iter); |
| 165 | 166 | ||
| 167 | int device_match_of_node(struct device *dev, const void *np); | ||
| 168 | |||
| 166 | int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data, | 169 | int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data, |
| 167 | int (*fn)(struct device *dev, void *data)); | 170 | int (*fn)(struct device *dev, void *data)); |
| 168 | struct device *bus_find_device(struct bus_type *bus, struct device *start, | 171 | struct device *bus_find_device(struct bus_type *bus, struct device *start, |
| 169 | void *data, | 172 | const void *data, |
| 170 | int (*match)(struct device *dev, void *data)); | 173 | int (*match)(struct device *dev, const void *data)); |
| 171 | struct device *bus_find_device_by_name(struct bus_type *bus, | 174 | struct device *bus_find_device_by_name(struct bus_type *bus, |
| 172 | struct device *start, | 175 | struct device *start, |
| 173 | const char *name); | 176 | const char *name); |
| @@ -259,6 +262,8 @@ enum probe_type { · 85 unmodified lines | |||
| 259 | * @resume: Called to bring a device from sleep mode. | 262 | * @resume: Called to bring a device from sleep mode. |
| 260 | * @groups: Default attributes that get created by the driver core | 263 | * @groups: Default attributes that get created by the driver core |
| 261 | * automatically. | 264 | * automatically. |
| 265 | * @dev_groups: Additional attributes attached to device instance once the | ||
| 266 | * it is bound to the driver. | ||
| 262 | * @pm: Power management operations of the device which matched | 267 | * @pm: Power management operations of the device which matched |
| 263 | * this driver. | 268 | * this driver. |
| 264 | * @coredump: Called when sysfs entry is written to. The device driver | 269 | * @coredump: Called when sysfs entry is written to. The device driver |
| @@ -293,6 +298,7 @@ struct device_driver { · 28 unmodified lines | |||
| 293 | int (*suspend) (struct device *dev, pm_message_t state); | 298 | int (*suspend) (struct device *dev, pm_message_t state); |
| 294 | int (*resume) (struct device *dev); | 299 | int (*resume) (struct device *dev); |
| 295 | const struct attribute_group **groups; | 300 | const struct attribute_group **groups; |
| 301 | const struct attribute_group **dev_groups; | ||
| 296 | 302 | ||
| 297 | const struct dev_pm_ops *pm; | 303 | const struct dev_pm_ops *pm; |
| 298 | void (*coredump) (struct device *dev); | 304 | void (*coredump) (struct device *dev); |
| @@ -336,11 +342,12 @@ extern int __must_check driver_for_each_device(struct device_driver *drv, · 37 unmodified lines | |||
| 336 | int (*fn)(struct device *dev, | 342 | int (*fn)(struct device *dev, |
| 337 | void *)); | 343 | void *)); |
| 338 | struct device *driver_find_device(struct device_driver *drv, | 344 | struct device *driver_find_device(struct device_driver *drv, |
| 339 | struct device *start, void *data, | 345 | struct device *start, const void *data, |
| 340 | int (*match)(struct device *dev, void *data)); | 346 | int (*match)(struct device *dev, const void *data)); |
| 341 | 347 | ||
| 342 | void driver_deferred_probe_add(struct device *dev); | 348 | void driver_deferred_probe_add(struct device *dev); |
| 343 | int driver_deferred_probe_check_state(struct device *dev); | 349 | int driver_deferred_probe_check_state(struct device *dev); |
| 350 | int driver_deferred_probe_check_state_continue(struct device *dev); | ||
| 344 | 351 | ||
| 345 | /** | 352 | /** |
| 346 | * struct subsys_interface - interfaces to device functions | 353 | * struct subsys_interface - interfaces to device functions |
| @@ -911,6 +918,8 @@ struct dev_links_info { · 564 unmodified lines | |||
| 911 | * This identifies the device type and carries type-specific | 918 | * This identifies the device type and carries type-specific |
| 912 | * information. | 919 | * information. |
| 913 | * @mutex: Mutex to synchronize calls to its driver. | 920 | * @mutex: Mutex to synchronize calls to its driver. |
| 921 | * @lockdep_mutex: An optional debug lock that a subsystem can use as a | ||
| 922 | * peer lock to gain localized lockdep coverage of the device_lock. | ||
| 914 | * @bus: Type of bus device is on. | 923 | * @bus: Type of bus device is on. |
| 915 | * @driver: Which driver has allocated this | 924 | * @driver: Which driver has allocated this |
| 916 | * @platform_data: Platform data specific to the device. | 925 | * @platform_data: Platform data specific to the device. |
| @@ -961,6 +970,7 @@ struct dev_links_info { · 44 unmodified lines | |||
| 961 | * device (i.e. the bus driver that discovered the device). | 970 | * device (i.e. the bus driver that discovered the device). |
| 962 | * @iommu_group: IOMMU group the device belongs to. | 971 | * @iommu_group: IOMMU group the device belongs to. |
| 963 | * @iommu_fwspec: IOMMU-specific properties supplied by firmware. | 972 | * @iommu_fwspec: IOMMU-specific properties supplied by firmware. |
| 973 | * @iommu_param: Per device generic IOMMU runtime data | ||
| 964 | * | 974 | * |
| 965 | * @offline_disabled: If set, the device is permanently online. | 975 | * @offline_disabled: If set, the device is permanently online. |
| 966 | * @offline: Set after successful invocation of bus type's .offline(). | 976 | * @offline: Set after successful invocation of bus type's .offline(). |
| @@ -993,6 +1003,9 @@ struct device { · 26 unmodified lines | |||
| 993 | core doesn't touch it */ | 1003 | core doesn't touch it */ |
| 994 | void *driver_data; /* Driver data, set and get with | 1004 | void *driver_data; /* Driver data, set and get with |
| 995 | dev_set_drvdata/dev_get_drvdata */ | 1005 | dev_set_drvdata/dev_get_drvdata */ |
| 1006 | #ifdef CONFIG_PROVE_LOCKING | ||
| 1007 | struct mutex lockdep_mutex; | ||
| 1008 | #endif | ||
| 996 | struct mutex mutex; /* mutex to synchronize calls to | 1009 | struct mutex mutex; /* mutex to synchronize calls to |
| 997 | * its driver. | 1010 | * its driver. |
| 998 | */ | 1011 | */ |
| @@ -1054,6 +1067,7 @@ struct device { · 55 unmodified lines | |||
| 1054 | void (*release)(struct device *dev); | 1067 | void (*release)(struct device *dev); |
| 1055 | struct iommu_group *iommu_group; | 1068 | struct iommu_group *iommu_group; |
| 1056 | struct iommu_fwspec *iommu_fwspec; | 1069 | struct iommu_fwspec *iommu_fwspec; |
| 1070 | struct iommu_param *iommu_param; | ||
| 1057 | 1071 | ||
| 1058 | bool offline_disabled:1; | 1072 | bool offline_disabled:1; |
| 1059 | bool offline:1; | 1073 | bool offline:1; |
| @@ -1252,6 +1266,8 @@ extern int device_for_each_child_reverse(struct device *dev, void *data, · 192 unmodified lines | |||
| 1252 | int (*fn)(struct device *dev, void *data)); | 1266 | int (*fn)(struct device *dev, void *data)); |
| 1253 | extern struct device *device_find_child(struct device *dev, void *data, | 1267 | extern struct device *device_find_child(struct device *dev, void *data, |
| 1254 | int (*match)(struct device *dev, void *data)); | 1268 | int (*match)(struct device *dev, void *data)); |
| 1269 | extern struct device *device_find_child_by_name(struct device *parent, | ||
| 1270 | const char *name); | ||
| 1255 | extern int device_rename(struct device *dev, const char *new_name); | 1271 | extern int device_rename(struct device *dev, const char *new_name); |
| 1256 | extern int device_move(struct device *dev, struct device *new_parent, | 1272 | extern int device_move(struct device *dev, struct device *new_parent, |
| 1257 | enum dpm_order dpm_order); | 1273 | enum dpm_order dpm_order); |
| @@ -1375,6 +1391,7 @@ extern int (*platform_notify_remove)(struct device *dev); · 117 unmodified lines | |||
| 1375 | */ | 1391 | */ |
| 1376 | extern struct device *get_device(struct device *dev); | 1392 | extern struct device *get_device(struct device *dev); |
| 1377 | extern void put_device(struct device *dev); | 1393 | extern void put_device(struct device *dev); |
| 1394 | extern bool kill_device(struct device *dev); | ||
| 1378 | 1395 | ||
| 1379 | #ifdef CONFIG_DEVTMPFS | 1396 | #ifdef CONFIG_DEVTMPFS |
| 1380 | extern int devtmpfs_create_node(struct device *dev); | 1397 | extern int devtmpfs_create_node(struct device *dev); |
| @@ -0,0 +1,333 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ | ||
| 2 | /* Copyright (c) 2019 Mellanox Technologies. */ | ||
| 3 | |||
| 4 | #ifndef DIM_H | ||
| 5 | #define DIM_H | ||
| 6 | |||
| 7 | #include <linux/module.h> | ||
| 8 | |||
| 9 | /** | ||
| 10 | * Number of events between DIM iterations. | ||
| 11 | * Causes a moderation of the algorithm run. | ||
| 12 | */ | ||
| 13 | #define DIM_NEVENTS 64 | ||
| 14 | |||
| 15 | /** | ||
| 16 | * Is a difference between values justifies taking an action. | ||
| 17 | * We consider 10% difference as significant. | ||
| 18 | */ | ||
| 19 | #define IS_SIGNIFICANT_DIFF(val, ref) \ | ||
| 20 | (((100UL * abs((val) - (ref))) / (ref)) > 10) | ||
| 21 | |||
| 22 | /** | ||
| 23 | * Calculate the gap between two values. | ||
| 24 | * Take wrap-around and variable size into consideration. | ||
| 25 | */ | ||
| 26 | #define BIT_GAP(bits, end, start) ((((end) - (start)) + BIT_ULL(bits)) \ | ||
| 27 | & (BIT_ULL(bits) - 1)) | ||
| 28 | |||
| 29 | /** | ||
| 30 | * Structure for CQ moderation values. | ||
| 31 | * Used for communications between DIM and its consumer. | ||
| 32 | * | ||
| 33 | * @usec: CQ timer suggestion (by DIM) | ||
| 34 | * @pkts: CQ packet counter suggestion (by DIM) | ||
| 35 | * @cq_period_mode: CQ priod count mode (from CQE/EQE) | ||
| 36 | */ | ||
| 37 | struct dim_cq_moder { | ||
| 38 | u16 usec; | ||
| 39 | u16 pkts; | ||
| 40 | u16 comps; | ||
| 41 | u8 cq_period_mode; | ||
| 42 | }; | ||
| 43 | |||
| 44 | /** | ||
| 45 | * Structure for DIM sample data. | ||
| 46 | * Used for communications between DIM and its consumer. | ||
| 47 | * | ||
| 48 | * @time: Sample timestamp | ||
| 49 | * @pkt_ctr: Number of packets | ||
| 50 | * @byte_ctr: Number of bytes | ||
| 51 | * @event_ctr: Number of events | ||
| 52 | */ | ||
| 53 | struct dim_sample { | ||
| 54 | ktime_t time; | ||
| 55 | u32 pkt_ctr; | ||
| 56 | u32 byte_ctr; | ||
| 57 | u16 event_ctr; | ||
| 58 | u32 comp_ctr; | ||
| 59 | }; | ||
| 60 | |||
| 61 | /** | ||
| 62 | * Structure for DIM stats. | ||
| 63 | * Used for holding current measured rates. | ||
| 64 | * | ||
| 65 | * @ppms: Packets per msec | ||
| 66 | * @bpms: Bytes per msec | ||
| 67 | * @epms: Events per msec | ||
| 68 | */ | ||
| 69 | struct dim_stats { | ||
| 70 | int ppms; /* packets per msec */ | ||
| 71 | int bpms; /* bytes per msec */ | ||
| 72 | int epms; /* events per msec */ | ||
| 73 | int cpms; /* completions per msec */ | ||
| 74 | int cpe_ratio; /* ratio of completions to events */ | ||
| 75 | }; | ||
| 76 | |||
| 77 | /** | ||
| 78 | * Main structure for dynamic interrupt moderation (DIM). | ||
| 79 | * Used for holding all information about a specific DIM instance. | ||
| 80 | * | ||
| 81 | * @state: Algorithm state (see below) | ||
| 82 | * @prev_stats: Measured rates from previous iteration (for comparison) | ||
| 83 | * @start_sample: Sampled data at start of current iteration | ||
| 84 | * @work: Work to perform on action required | ||
| 85 | * @priv: A pointer to the struct that points to dim | ||
| 86 | * @profile_ix: Current moderation profile | ||
| 87 | * @mode: CQ period count mode | ||
| 88 | * @tune_state: Algorithm tuning state (see below) | ||
| 89 | * @steps_right: Number of steps taken towards higher moderation | ||
| 90 | * @steps_left: Number of steps taken towards lower moderation | ||
| 91 | * @tired: Parking depth counter | ||
| 92 | */ | ||
| 93 | struct dim { | ||
| 94 | u8 state; | ||
| 95 | struct dim_stats prev_stats; | ||
| 96 | struct dim_sample start_sample; | ||
| 97 | struct dim_sample measuring_sample; | ||
| 98 | struct work_struct work; | ||
| 99 | void *priv; | ||
| 100 | u8 profile_ix; | ||
| 101 | u8 mode; | ||
| 102 | u8 tune_state; | ||
| 103 | u8 steps_right; | ||
| 104 | u8 steps_left; | ||
| 105 | u8 tired; | ||
| 106 | }; | ||
| 107 | |||
| 108 | /** | ||
| 109 | * enum dim_cq_period_mode | ||
| 110 | * | ||
| 111 | * These are the modes for CQ period count. | ||
| 112 | * | ||
| 113 | * @DIM_CQ_PERIOD_MODE_START_FROM_EQE: Start counting from EQE | ||
| 114 | * @DIM_CQ_PERIOD_MODE_START_FROM_CQE: Start counting from CQE (implies timer reset) | ||
| 115 | * @DIM_CQ_PERIOD_NUM_MODES: Number of modes | ||
| 116 | */ | ||
| 117 | enum { | ||
| 118 | DIM_CQ_PERIOD_MODE_START_FROM_EQE = 0x0, | ||
| 119 | DIM_CQ_PERIOD_MODE_START_FROM_CQE = 0x1, | ||
| 120 | DIM_CQ_PERIOD_NUM_MODES | ||
| 121 | }; | ||
| 122 | |||
| 123 | /** | ||
| 124 | * enum dim_state | ||
| 125 | * | ||
| 126 | * These are the DIM algorithm states. | ||
| 127 | * These will determine if the algorithm is in a valid state to start an iteration. | ||
| 128 | * | ||
| 129 | * @DIM_START_MEASURE: This is the first iteration (also after applying a new profile) | ||
| 130 | * @DIM_MEASURE_IN_PROGRESS: Algorithm is already in progress - check if | ||
| 131 | * need to perform an action | ||
| 132 | * @DIM_APPLY_NEW_PROFILE: DIM consumer is currently applying a profile - no need to measure | ||
| 133 | */ | ||
| 134 | enum { | ||
| 135 | DIM_START_MEASURE, | ||
| 136 | DIM_MEASURE_IN_PROGRESS, | ||
| 137 | DIM_APPLY_NEW_PROFILE, | ||
| 138 | }; | ||
| 139 | |||
| 140 | /** | ||
| 141 | * enum dim_tune_state | ||
| 142 | * | ||
| 143 | * These are the DIM algorithm tune states. | ||
| 144 | * These will determine which action the algorithm should perform. | ||
| 145 | * | ||
| 146 | * @DIM_PARKING_ON_TOP: Algorithm found a local top point - exit on significant difference | ||
| 147 | * @DIM_PARKING_TIRED: Algorithm found a deep top point - don't exit if tired > 0 | ||
| 148 | * @DIM_GOING_RIGHT: Algorithm is currently trying higher moderation levels | ||
| 149 | * @DIM_GOING_LEFT: Algorithm is currently trying lower moderation levels | ||
| 150 | */ | ||
| 151 | enum { | ||
| 152 | DIM_PARKING_ON_TOP, | ||
| 153 | DIM_PARKING_TIRED, | ||
| 154 | DIM_GOING_RIGHT, | ||
| 155 | DIM_GOING_LEFT, | ||
| 156 | }; | ||
| 157 | |||
| 158 | /** | ||
| 159 | * enum dim_stats_state | ||
| 160 | * | ||
| 161 | * These are the DIM algorithm statistics states. | ||
| 162 | * These will determine the verdict of current iteration. | ||
| 163 | * | ||
| 164 | * @DIM_STATS_WORSE: Current iteration shows worse performance than before | ||
| 165 | * @DIM_STATS_WORSE: Current iteration shows same performance than before | ||
| 166 | * @DIM_STATS_WORSE: Current iteration shows better performance than before | ||
| 167 | */ | ||
| 168 | enum { | ||
| 169 | DIM_STATS_WORSE, | ||
| 170 | DIM_STATS_SAME, | ||
| 171 | DIM_STATS_BETTER, | ||
| 172 | }; | ||
| 173 | |||
| 174 | /** | ||
| 175 | * enum dim_step_result | ||
| 176 | * | ||
| 177 | * These are the DIM algorithm step results. | ||
| 178 | * These describe the result of a step. | ||
| 179 | * | ||
| 180 | * @DIM_STEPPED: Performed a regular step | ||
| 181 | * @DIM_TOO_TIRED: Same kind of step was done multiple times - should go to | ||
| 182 | * tired parking | ||
| 183 | * @DIM_ON_EDGE: Stepped to the most left/right profile | ||
| 184 | */ | ||
| 185 | enum { | ||
| 186 | DIM_STEPPED, | ||
| 187 | DIM_TOO_TIRED, | ||
| 188 | DIM_ON_EDGE, | ||
| 189 | }; | ||
| 190 | |||
| 191 | /** | ||
| 192 | * dim_on_top - check if current state is a good place to stop (top location) | ||
| 193 | * @dim: DIM context | ||
| 194 | * | ||
| 195 | * Check if current profile is a good place to park at. | ||
| 196 | * This will result in reducing the DIM checks frequency as we assume we | ||
| 197 | * shouldn't probably change profiles, unless traffic pattern wasn't changed. | ||
| 198 | */ | ||
| 199 | bool dim_on_top(struct dim *dim); | ||
| 200 | |||
| 201 | /** | ||
| 202 | * dim_turn - change profile alterning direction | ||
| 203 | * @dim: DIM context | ||
| 204 | * | ||
| 205 | * Go left if we were going right and vice-versa. | ||
| 206 | * Do nothing if currently parking. | ||
| 207 | */ | ||
| 208 | void dim_turn(struct dim *dim); | ||
| 209 | |||
| 210 | /** | ||
| 211 | * dim_park_on_top - enter a parking state on a top location | ||
| 212 | * @dim: DIM context | ||
| 213 | * | ||
| 214 | * Enter parking state. | ||
| 215 | * Clear all movement history. | ||
| 216 | */ | ||
| 217 | void dim_park_on_top(struct dim *dim); | ||
| 218 | |||
| 219 | /** | ||
| 220 | * dim_park_tired - enter a tired parking state | ||
| 221 | * @dim: DIM context | ||
| 222 | * | ||
| 223 | * Enter parking state. | ||
| 224 | * Clear all movement history and cause DIM checks frequency to reduce. | ||
| 225 | */ | ||
| 226 | void dim_park_tired(struct dim *dim); | ||
| 227 | |||
| 228 | /** | ||
| 229 | * dim_calc_stats - calculate the difference between two samples | ||
| 230 | * @start: start sample | ||
| 231 | * @end: end sample | ||
| 232 | * @curr_stats: delta between samples | ||
| 233 | * | ||
| 234 | * Calculate the delta between two samples (in data rates). | ||
| 235 | * Takes into consideration counter wrap-around. | ||
| 236 | */ | ||
| 237 | void dim_calc_stats(struct dim_sample *start, struct dim_sample *end, | ||
| 238 | struct dim_stats *curr_stats); | ||
| 239 | |||
| 240 | /** | ||
| 241 | * dim_update_sample - set a sample's fields with give values | ||
| 242 | * @event_ctr: number of events to set | ||
| 243 | * @packets: number of packets to set | ||
| 244 | * @bytes: number of bytes to set | ||
| 245 | * @s: DIM sample | ||
| 246 | */ | ||
| 247 | static inline void | ||
| 248 | dim_update_sample(u16 event_ctr, u64 packets, u64 bytes, struct dim_sample *s) | ||
| 249 | { | ||
| 250 | s->time = ktime_get(); | ||
| 251 | s->pkt_ctr = packets; | ||
| 252 | s->byte_ctr = bytes; | ||
| 253 | s->event_ctr = event_ctr; | ||
| 254 | } | ||
| 255 | |||
| 256 | /** | ||
| 257 | * dim_update_sample_with_comps - set a sample's fields with given | ||
| 258 | * values including the completion parameter | ||
| 259 | * @event_ctr: number of events to set | ||
| 260 | * @packets: number of packets to set | ||
| 261 | * @bytes: number of bytes to set | ||
| 262 | * @comps: number of completions to set | ||
| 263 | * @s: DIM sample | ||
| 264 | */ | ||
| 265 | static inline void | ||
| 266 | dim_update_sample_with_comps(u16 event_ctr, u64 packets, u64 bytes, u64 comps, | ||
| 267 | struct dim_sample *s) | ||
| 268 | { | ||
| 269 | dim_update_sample(event_ctr, packets, bytes, s); | ||
| 270 | s->comp_ctr = comps; | ||
| 271 | } | ||
| 272 | |||
| 273 | /* Net DIM */ | ||
| 274 | |||
| 275 | /** | ||
| 276 | * net_dim_get_rx_moderation - provide a CQ moderation object for the given RX profile | ||
| 277 | * @cq_period_mode: CQ period mode | ||
| 278 | * @ix: Profile index | ||
| 279 | */ | ||
| 280 | struct dim_cq_moder net_dim_get_rx_moderation(u8 cq_period_mode, int ix); | ||
| 281 | |||
| 282 | /** | ||
| 283 | * net_dim_get_def_rx_moderation - provide the default RX moderation | ||
| 284 | * @cq_period_mode: CQ period mode | ||
| 285 | */ | ||
| 286 | struct dim_cq_moder net_dim_get_def_rx_moderation(u8 cq_period_mode); | ||
| 287 | |||
| 288 | /** | ||
| 289 | * net_dim_get_tx_moderation - provide a CQ moderation object for the given TX profile | ||
| 290 | * @cq_period_mode: CQ period mode | ||
| 291 | * @ix: Profile index | ||
| 292 | */ | ||
| 293 | struct dim_cq_moder net_dim_get_tx_moderation(u8 cq_period_mode, int ix); | ||
| 294 | |||
| 295 | /** | ||
| 296 | * net_dim_get_def_tx_moderation - provide the default TX moderation | ||
| 297 | * @cq_period_mode: CQ period mode | ||
| 298 | */ | ||
| 299 | struct dim_cq_moder net_dim_get_def_tx_moderation(u8 cq_period_mode); | ||
| 300 | |||
| 301 | /** | ||
| 302 | * net_dim - main DIM algorithm entry point | ||
| 303 | * @dim: DIM instance information | ||
| 304 | * @end_sample: Current data measurement | ||
| 305 | * | ||
| 306 | * Called by the consumer. | ||
| 307 | * This is the main logic of the algorithm, where data is processed in order to decide on next | ||
| 308 | * required action. | ||
| 309 | */ | ||
| 310 | void net_dim(struct dim *dim, struct dim_sample end_sample); | ||
| 311 | |||
| 312 | /* RDMA DIM */ | ||
| 313 | |||
| 314 | /* | ||
| 315 | * RDMA DIM profile: | ||
| 316 | * profile size must be of RDMA_DIM_PARAMS_NUM_PROFILES. | ||
| 317 | */ | ||
| 318 | #define RDMA_DIM_PARAMS_NUM_PROFILES 9 | ||
| 319 | #define RDMA_DIM_START_PROFILE 0 | ||
| 320 | |||
| 321 | /** | ||
| 322 | * rdma_dim - Runs the adaptive moderation. | ||
| 323 | * @dim: The moderation struct. | ||
| 324 | * @completions: The number of completions collected in this round. | ||
| 325 | * | ||
| 326 | * Each call to rdma_dim takes the latest amount of completions that | ||
| 327 | * have been collected and counts them as a new event. | ||
| 328 | * Once enough events have been collected the algorithm decides a new | ||
| 329 | * moderation level. | ||
| 330 | */ | ||
| 331 | void rdma_dim(struct dim *dim, u64 completions); | ||
| 332 | |||
| 333 | #endif /* DIM_H */ | ||
| @@ -28,18 +28,20 @@ struct dma_buf_attachment; · 27 unmodified lines | |||
| 28 | 28 | ||
| 29 | /** | 29 | /** |
| 30 | * struct dma_buf_ops - operations possible on struct dma_buf | 30 | * struct dma_buf_ops - operations possible on struct dma_buf |
| 31 | * @map_atomic: [optional] maps a page from the buffer into kernel address | ||
| 32 | * space, users may not block until the subsequent unmap call. | ||
| 33 | * This callback must not sleep. | ||
| 34 | * @unmap_atomic: [optional] unmaps a atomically mapped page from the buffer. | ||
| 35 | * This Callback must not sleep. | ||
| 36 | * @map: [optional] maps a page from the buffer into kernel address space. | ||
| 37 | * @unmap: [optional] unmaps a page from the buffer. | ||
| 38 | * @vmap: [optional] creates a virtual mapping for the buffer into kernel | 31 | * @vmap: [optional] creates a virtual mapping for the buffer into kernel |
| 39 | * address space. Same restrictions as for vmap and friends apply. | 32 | * address space. Same restrictions as for vmap and friends apply. |
| 40 | * @vunmap: [optional] unmaps a vmap from the buffer | 33 | * @vunmap: [optional] unmaps a vmap from the buffer |
| 41 | */ | 34 | */ |
| 42 | struct dma_buf_ops { | 35 | struct dma_buf_ops { |
| 36 | /** | ||
| 37 | * @cache_sgt_mapping: | ||
| 38 | * | ||
| 39 | * If true the framework will cache the first mapping made for each | ||
| 40 | * attachment. This avoids creating mappings for attachments multiple | ||
| 41 | * times. | ||
| 42 | */ | ||
| 43 | bool cache_sgt_mapping; | ||
| 44 | |||
| 43 | /** | 45 | /** |
| 44 | * @attach: | 46 | * @attach: |
| 45 | * | 47 | * |
| @@ -194,8 +196,6 @@ struct dma_buf_ops { · 148 unmodified lines | |||
| 194 | * to be restarted. | 196 | * to be restarted. |
| 195 | */ | 197 | */ |
| 196 | int (*end_cpu_access)(struct dma_buf *, enum dma_data_direction); | 198 | int (*end_cpu_access)(struct dma_buf *, enum dma_data_direction); |
| 197 | void *(*map)(struct dma_buf *, unsigned long); | ||
| 198 | void (*unmap)(struct dma_buf *, unsigned long, void *); | ||
| 199 | 199 | ||
| 200 | /** | 200 | /** |
| 201 | * @mmap: | 201 | * @mmap: |
| @@ -234,6 +234,31 @@ struct dma_buf_ops { · 32 unmodified lines | |||
| 234 | */ | 234 | */ |
| 235 | int (*mmap)(struct dma_buf *, struct vm_area_struct *vma); | 235 | int (*mmap)(struct dma_buf *, struct vm_area_struct *vma); |
| 236 | 236 | ||
| 237 | /** | ||
| 238 | * @map: | ||
| 239 | * | ||
| 240 | * Maps a page from the buffer into kernel address space. The page is | ||
| 241 | * specified by offset into the buffer in PAGE_SIZE units. | ||
| 242 | * | ||
| 243 | * This callback is optional. | ||
| 244 | * | ||
| 245 | * Returns: | ||
| 246 | * | ||
| 247 | * Virtual address pointer where requested page can be accessed. NULL | ||
| 248 | * on error or when this function is unimplemented by the exporter. | ||
| 249 | */ | ||
| 250 | void *(*map)(struct dma_buf *, unsigned long); | ||
| 251 | |||
| 252 | /** | ||
| 253 | * @unmap: | ||
| 254 | * | ||
| 255 | * Unmaps a page from the buffer. Page offset and address pointer should | ||
| 256 | * be the same as the one passed to and returned by matching call to map. | ||
| 257 | * | ||
| 258 | * This callback is optional. | ||
| 259 | */ | ||
| 260 | void (*unmap)(struct dma_buf *, unsigned long, void *); | ||
| 261 | |||
| 237 | void *(*vmap)(struct dma_buf *); | 262 | void *(*vmap)(struct dma_buf *); |
| 238 | void (*vunmap)(struct dma_buf *, void *vaddr); | 263 | void (*vunmap)(struct dma_buf *, void *vaddr); |
| 239 | }; | 264 | }; |
| @@ -244,10 +269,12 @@ struct dma_buf_ops { · 4 unmodified lines | |||
| 244 | * @file: file pointer used for sharing buffers across, and for refcounting. | 269 | * @file: file pointer used for sharing buffers across, and for refcounting. |
| 245 | * @attachments: list of dma_buf_attachment that denotes all devices attached. | 270 | * @attachments: list of dma_buf_attachment that denotes all devices attached. |
| 246 | * @ops: dma_buf_ops associated with this buffer object. | 271 | * @ops: dma_buf_ops associated with this buffer object. |
| 247 | * @lock: used internally to serialize list manipulation, attach/detach and vmap/unmap | 272 | * @lock: used internally to serialize list manipulation, attach/detach and |
| 273 | * vmap/unmap, and accesses to name | ||
| 248 | * @vmapping_counter: used internally to refcnt the vmaps | 274 | * @vmapping_counter: used internally to refcnt the vmaps |
| 249 | * @vmap_ptr: the current vmap ptr if vmapping_counter > 0 | 275 | * @vmap_ptr: the current vmap ptr if vmapping_counter > 0 |
| 250 | * @exp_name: name of the exporter; useful for debugging. | 276 | * @exp_name: name of the exporter; useful for debugging. |
| 277 | * @name: userspace-provided name; useful for accounting and debugging. | ||
| 251 | * @owner: pointer to exporter module; used for refcounting when exporter is a | 278 | * @owner: pointer to exporter module; used for refcounting when exporter is a |
| 252 | * kernel module. | 279 | * kernel module. |
| 253 | * @list_node: node for dma_buf accounting and debugging. | 280 | * @list_node: node for dma_buf accounting and debugging. |
| @@ -275,6 +302,7 @@ struct dma_buf { · 21 unmodified lines | |||
| 275 | unsigned vmapping_counter; | 302 | unsigned vmapping_counter; |
| 276 | void *vmap_ptr; | 303 | void *vmap_ptr; |
| 277 | const char *exp_name; | 304 | const char *exp_name; |
| 305 | const char *name; | ||
| 278 | struct module *owner; | 306 | struct module *owner; |
| 279 | struct list_head list_node; | 307 | struct list_head list_node; |
| 280 | void *priv; | 308 | void *priv; |
| @@ -296,6 +324,8 @@ struct dma_buf { · 15 unmodified lines | |||
| 296 | * @dmabuf: buffer for this attachment. | 324 | * @dmabuf: buffer for this attachment. |
| 297 | * @dev: device attached to the buffer. | 325 | * @dev: device attached to the buffer. |
| 298 | * @node: list of dma_buf_attachment. | 326 | * @node: list of dma_buf_attachment. |
| 327 | * @sgt: cached mapping. | ||
| 328 | * @dir: direction of cached mapping. | ||
| 299 | * @priv: exporter specific attachment data. | 329 | * @priv: exporter specific attachment data. |
| 300 | * | 330 | * |
| 301 | * This structure holds the attachment information between the dma_buf buffer | 331 | * This structure holds the attachment information between the dma_buf buffer |
| @@ -311,6 +341,8 @@ struct dma_buf_attachment { · 9 unmodified lines | |||
| 311 | struct dma_buf *dmabuf; | 341 | struct dma_buf *dmabuf; |
| 312 | struct device *dev; | 342 | struct device *dev; |
| 313 | struct list_head node; | 343 | struct list_head node; |
| 344 | struct sg_table *sgt; | ||
| 345 | enum dma_data_direction dir; | ||
| 314 | void *priv; | 346 | void *priv; |
| 315 | }; | 347 | }; |
| 316 | 348 | ||
| @@ -50,6 +50,7 @@ · 49 unmodified lines | |||
| 50 | #ifdef __KERNEL__ | 50 | #ifdef __KERNEL__ |
| 51 | 51 | ||
| 52 | #include <linux/device.h> | 52 | #include <linux/device.h> |
| 53 | #include <linux/mm.h> | ||
| 53 | 54 | ||
| 54 | struct cma; | 55 | struct cma; |
| 55 | struct page; | 56 | struct page; |
| @@ -111,6 +112,8 @@ struct page *dma_alloc_from_contiguous(struct device *dev, size_t count, · 55 unmodified lines | |||
| 111 | unsigned int order, bool no_warn); | 112 | unsigned int order, bool no_warn); |
| 112 | bool dma_release_from_contiguous(struct device *dev, struct page *pages, | 113 | bool dma_release_from_contiguous(struct device *dev, struct page *pages, |
| 113 | int count); | 114 | int count); |
| 115 | struct page *dma_alloc_contiguous(struct device *dev, size_t size, gfp_t gfp); | ||
| 116 | void dma_free_contiguous(struct device *dev, struct page *page, size_t size); | ||
| 114 | 117 | ||
| 115 | #else | 118 | #else |
| 116 | 119 | ||
| @@ -153,6 +156,22 @@ bool dma_release_from_contiguous(struct device *dev, struct page *pages, · 36 unmodified lines | |||
| 153 | return false; | 156 | return false; |
| 154 | } | 157 | } |
| 155 | 158 | ||
| 159 | /* Use fallback alloc() and free() when CONFIG_DMA_CMA=n */ | ||
| 160 | static inline struct page *dma_alloc_contiguous(struct device *dev, size_t size, | ||
| 161 | gfp_t gfp) | ||
| 162 | { | ||
| 163 | int node = dev ? dev_to_node(dev) : NUMA_NO_NODE; | ||
| 164 | size_t align = get_order(PAGE_ALIGN(size)); | ||
| 165 | |||
| 166 | return alloc_pages_node(node, gfp, align); | ||
| 167 | } | ||
| 168 | |||
| 169 | static inline void dma_free_contiguous(struct device *dev, struct page *page, | ||
| 170 | size_t size) | ||
| 171 | { | ||
| 172 | __free_pages(page, get_order(size)); | ||
| 173 | } | ||
| 174 | |||
| 156 | #endif | 175 | #endif |
| 157 | 176 | ||
| 158 | #endif | 177 | #endif |
| @@ -32,6 +32,15 @@ static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size) · 31 unmodified lines | |||
| 32 | } | 32 | } |
| 33 | #endif /* !CONFIG_ARCH_HAS_PHYS_TO_DMA */ | 33 | #endif /* !CONFIG_ARCH_HAS_PHYS_TO_DMA */ |
| 34 | 34 | ||
| 35 | #ifdef CONFIG_ARCH_HAS_FORCE_DMA_UNENCRYPTED | ||
| 36 | bool force_dma_unencrypted(struct device *dev); | ||
| 37 | #else | ||
| 38 | static inline bool force_dma_unencrypted(struct device *dev) | ||
| 39 | { | ||
| 40 | return false; | ||
| 41 | } | ||
| 42 | #endif /* CONFIG_ARCH_HAS_FORCE_DMA_UNENCRYPTED */ | ||
| 43 | |||
| 35 | /* | 44 | /* |
| 36 | * If memory encryption is supported, phys_to_dma will set the memory encryption | 45 | * If memory encryption is supported, phys_to_dma will set the memory encryption |
| 37 | * bit in the DMA address, and dma_to_phys will clear it. The raw __phys_to_dma | 46 | * bit in the DMA address, and dma_to_phys will clear it. The raw __phys_to_dma |
| @@ -5,59 +5,21 @@ · 4 unmodified lines | |||
| 5 | #ifndef __DMA_IOMMU_H | 5 | #ifndef __DMA_IOMMU_H |
| 6 | #define __DMA_IOMMU_H | 6 | #define __DMA_IOMMU_H |
| 7 | 7 | ||
| 8 | #ifdef __KERNEL__ | 8 | #include <linux/errno.h> |
| 9 | #include <linux/types.h> | 9 | #include <linux/types.h> |
| 10 | #include <asm/errno.h> | ||
| 11 | 10 | ||
| 12 | #ifdef CONFIG_IOMMU_DMA | 11 | #ifdef CONFIG_IOMMU_DMA |
| 13 | #include <linux/dma-mapping.h> | 12 | #include <linux/dma-mapping.h> |
| 14 | #include <linux/iommu.h> | 13 | #include <linux/iommu.h> |
| 15 | #include <linux/msi.h> | 14 | #include <linux/msi.h> |
| 16 | 15 | ||
| 17 | int iommu_dma_init(void); | ||
| 18 | |||
| 19 | /* Domain management interface for IOMMU drivers */ | 16 | /* Domain management interface for IOMMU drivers */ |
| 20 | int iommu_get_dma_cookie(struct iommu_domain *domain); | 17 | int iommu_get_dma_cookie(struct iommu_domain *domain); |
| 21 | int iommu_get_msi_cookie(struct iommu_domain *domain, dma_addr_t base); | 18 | int iommu_get_msi_cookie(struct iommu_domain *domain, dma_addr_t base); |
| 22 | void iommu_put_dma_cookie(struct iommu_domain *domain); | 19 | void iommu_put_dma_cookie(struct iommu_domain *domain); |
| 23 | 20 | ||
| 24 | /* Setup call for arch DMA mapping code */ | 21 | /* Setup call for arch DMA mapping code */ |
| 25 | int iommu_dma_init_domain(struct iommu_domain *domain, dma_addr_t base, | 22 | void iommu_setup_dma_ops(struct device *dev, u64 dma_base, u64 size); |
| 26 | u64 size, struct device *dev); | ||
| 27 | |||
| 28 | /* General helpers for DMA-API <-> IOMMU-API interaction */ | ||
| 29 | int dma_info_to_prot(enum dma_data_direction dir, bool coherent, | ||
| 30 | unsigned long attrs); | ||
| 31 | |||
| 32 | /* | ||
| 33 | * These implement the bulk of the relevant DMA mapping callbacks, but require | ||
| 34 | * the arch code to take care of attributes and cache maintenance | ||
| 35 | */ | ||
| 36 | struct page **iommu_dma_alloc(struct device *dev, size_t size, gfp_t gfp, | ||
| 37 | unsigned long attrs, int prot, dma_addr_t *handle, | ||
| 38 | void (*flush_page)(struct device *, const void *, phys_addr_t)); | ||
| 39 | void iommu_dma_free(struct device *dev, struct page **pages, size_t size, | ||
| 40 | dma_addr_t *handle); | ||
| 41 | |||
| 42 | int iommu_dma_mmap(struct page **pages, size_t size, struct vm_area_struct *vma); | ||
| 43 | |||
| 44 | dma_addr_t iommu_dma_map_page(struct device *dev, struct page *page, | ||
| 45 | unsigned long offset, size_t size, int prot); | ||
| 46 | int iommu_dma_map_sg(struct device *dev, struct scatterlist *sg, | ||
| 47 | int nents, int prot); | ||
| 48 | |||
| 49 | /* | ||
| 50 | * Arch code with no special attribute handling may use these | ||
| 51 | * directly as DMA mapping callbacks for simplicity | ||
| 52 | */ | ||
| 53 | void iommu_dma_unmap_page(struct device *dev, dma_addr_t handle, size_t size, | ||
| 54 | enum dma_data_direction dir, unsigned long attrs); | ||
| 55 | void iommu_dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nents, | ||
| 56 | enum dma_data_direction dir, unsigned long attrs); | ||
| 57 | dma_addr_t iommu_dma_map_resource(struct device *dev, phys_addr_t phys, | ||
| 58 | size_t size, enum dma_data_direction dir, unsigned long attrs); | ||
| 59 | void iommu_dma_unmap_resource(struct device *dev, dma_addr_t handle, | ||
| 60 | size_t size, enum dma_data_direction dir, unsigned long attrs); | ||
| 61 | 23 | ||
| 62 | /* The DMA API isn't _quite_ the whole story, though... */ | 24 | /* The DMA API isn't _quite_ the whole story, though... */ |
| 63 | /* | 25 | /* |
| @@ -75,16 +37,16 @@ void iommu_dma_compose_msi_msg(struct msi_desc *desc, · 11 unmodified lines | |||
| 75 | 37 | ||
| 76 | void iommu_dma_get_resv_regions(struct device *dev, struct list_head *list); | 38 | void iommu_dma_get_resv_regions(struct device *dev, struct list_head *list); |
| 77 | 39 | ||
| 78 | #else | 40 | #else /* CONFIG_IOMMU_DMA */ |
| 79 | 41 | ||
| 80 | struct iommu_domain; | 42 | struct iommu_domain; |
| 81 | struct msi_desc; | 43 | struct msi_desc; |
| 82 | struct msi_msg; | 44 | struct msi_msg; |
| 83 | struct device; | 45 | struct device; |
| 84 | 46 | ||
| 85 | static inline int iommu_dma_init(void) | 47 | static inline void iommu_setup_dma_ops(struct device *dev, u64 dma_base, |
| 48 | u64 size) | ||
| 86 | { | 49 | { |
| 87 | return 0; | ||
| 88 | } | 50 | } |
| 89 | 51 | ||
| 90 | static inline int iommu_get_dma_cookie(struct iommu_domain *domain) | 52 | static inline int iommu_get_dma_cookie(struct iommu_domain *domain) |
| @@ -117,5 +79,4 @@ static inline void iommu_dma_get_resv_regions(struct device *dev, struct list_he · 26 unmodified lines | |||
| 117 | } | 79 | } |
| 118 | 80 | ||
| 119 | #endif /* CONFIG_IOMMU_DMA */ | 81 | #endif /* CONFIG_IOMMU_DMA */ |
| 120 | #endif /* __KERNEL__ */ | ||
| 121 | #endif /* __DMA_IOMMU_H */ | 82 | #endif /* __DMA_IOMMU_H */ |
| @@ -679,6 +679,20 @@ static inline int dma_coerce_mask_and_coherent(struct device *dev, u64 mask) · 678 unmodified lines | |||
| 679 | return dma_set_mask_and_coherent(dev, mask); | 679 | return dma_set_mask_and_coherent(dev, mask); |
| 680 | } | 680 | } |
| 681 | 681 | ||
| 682 | /** | ||
| 683 | * dma_addressing_limited - return if the device is addressing limited | ||
| 684 | * @dev: device to check | ||
| 685 | * | ||
| 686 | * Return %true if the devices DMA mask is too small to address all memory in | ||
| 687 | * the system, else %false. Lack of addressing bits is the prime reason for | ||
| 688 | * bounce buffering, but might not be the only one. | ||
| 689 | */ | ||
| 690 | static inline bool dma_addressing_limited(struct device *dev) | ||
| 691 | { | ||
| 692 | return min_not_zero(dma_get_mask(dev), dev->bus_dma_mask) < | ||
| 693 | dma_get_required_mask(dev); | ||
| 694 | } | ||
| 695 | |||
| 682 | #ifdef CONFIG_ARCH_HAS_SETUP_DMA_OPS | 696 | #ifdef CONFIG_ARCH_HAS_SETUP_DMA_OPS |
| 683 | void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, | 697 | void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, |
| 684 | const struct iommu_ops *iommu, bool coherent); | 698 | const struct iommu_ops *iommu, bool coherent); |
| @@ -729,13 +743,6 @@ static inline int dma_set_seg_boundary(struct device *dev, unsigned long mask) · 44 unmodified lines | |||
| 729 | return -EIO; | 743 | return -EIO; |
| 730 | } | 744 | } |
| 731 | 745 | ||
| 732 | #ifndef dma_max_pfn | ||
| 733 | static inline unsigned long dma_max_pfn(struct device *dev) | ||
| 734 | { | ||
| 735 | return (*dev->dma_mask >> PAGE_SHIFT) + dev->dma_pfn_offset; | ||
| 736 | } | ||
| 737 | #endif | ||
| 738 | |||
| 739 | static inline int dma_get_cache_alignment(void) | 746 | static inline int dma_get_cache_alignment(void) |
| 740 | { | 747 | { |
| 741 | #ifdef ARCH_DMA_MINALIGN | 748 | #ifdef ARCH_DMA_MINALIGN |
| @@ -20,6 +20,22 @@ static inline bool dev_is_dma_coherent(struct device *dev) · 19 unmodified lines | |||
| 20 | } | 20 | } |
| 21 | #endif /* CONFIG_ARCH_HAS_DMA_COHERENCE_H */ | 21 | #endif /* CONFIG_ARCH_HAS_DMA_COHERENCE_H */ |
| 22 | 22 | ||
| 23 | /* | ||
| 24 | * Check if an allocation needs to be marked uncached to be coherent. | ||
| 25 | */ | ||
| 26 | static __always_inline bool dma_alloc_need_uncached(struct device *dev, | ||
| 27 | unsigned long attrs) | ||
| 28 | { | ||
| 29 | if (dev_is_dma_coherent(dev)) | ||
| 30 | return false; | ||
| 31 | if (attrs & DMA_ATTR_NO_KERNEL_MAPPING) | ||
| 32 | return false; | ||
| 33 | if (IS_ENABLED(CONFIG_DMA_NONCOHERENT_CACHE_SYNC) && | ||
| 34 | (attrs & DMA_ATTR_NON_CONSISTENT)) | ||
| 35 | return false; | ||
| 36 | return true; | ||
| 37 | } | ||
| 38 | |||
| 23 | void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle, | 39 | void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle, |
| 24 | gfp_t gfp, unsigned long attrs); | 40 | gfp_t gfp, unsigned long attrs); |
| 25 | void arch_dma_free(struct device *dev, size_t size, void *cpu_addr, | 41 | void arch_dma_free(struct device *dev, size_t size, void *cpu_addr, |
| @@ -80,4 +96,7 @@ static inline void arch_dma_prep_coherent(struct page *page, size_t size) · 54 unmodified lines | |||
| 80 | } | 96 | } |
| 81 | #endif /* CONFIG_ARCH_HAS_DMA_PREP_COHERENT */ | 97 | #endif /* CONFIG_ARCH_HAS_DMA_PREP_COHERENT */ |
| 82 | 98 | ||
| 99 | void *uncached_kernel_address(void *addr); | ||
| 100 | void *cached_kernel_address(void *addr); | ||
| 101 | |||
| 83 | #endif /* _LINUX_DMA_NONCOHERENT_H */ | 102 | #endif /* _LINUX_DMA_NONCOHERENT_H */ |
| @@ -0,0 +1,47 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | /* | ||
| 3 | * Copyright (c) 2018-2019 Synopsys, Inc. and/or its affiliates. | ||
| 4 | * Synopsys DesignWare eDMA core driver | ||
| 5 | * | ||
| 6 | * Author: Gustavo Pimentel <gustavo.pimentel@synopsys.com> | ||
| 7 | */ | ||
| 8 | |||
| 9 | #ifndef _DW_EDMA_H | ||
| 10 | #define _DW_EDMA_H | ||
| 11 | |||
| 12 | #include <linux/device.h> | ||
| 13 | #include <linux/dmaengine.h> | ||
| 14 | |||
| 15 | struct dw_edma; | ||
| 16 | |||
| 17 | /** | ||
| 18 | * struct dw_edma_chip - representation of DesignWare eDMA controller hardware | ||
| 19 | * @dev: struct device of the eDMA controller | ||
| 20 | * @id: instance ID | ||
| 21 | * @irq: irq line | ||
| 22 | * @dw: struct dw_edma that is filed by dw_edma_probe() | ||
| 23 | */ | ||
| 24 | struct dw_edma_chip { | ||
| 25 | struct device *dev; | ||
| 26 | int id; | ||
| 27 | int irq; | ||
| 28 | struct dw_edma *dw; | ||
| 29 | }; | ||
| 30 | |||
| 31 | /* Export to the platform drivers */ | ||
| 32 | #if IS_ENABLED(CONFIG_DW_EDMA) | ||
| 33 | int dw_edma_probe(struct dw_edma_chip *chip); | ||
| 34 | int dw_edma_remove(struct dw_edma_chip *chip); | ||
| 35 | #else | ||
| 36 | static inline int dw_edma_probe(struct dw_edma_chip *chip) | ||
| 37 | { | ||
| 38 | return -ENODEV; | ||
| 39 | } | ||
| 40 | |||
| 41 | static inline int dw_edma_remove(struct dw_edma_chip *chip) | ||
| 42 | { | ||
| 43 | return 0; | ||
| 44 | } | ||
| 45 | #endif /* CONFIG_DW_EDMA */ | ||
| 46 | |||
| 47 | #endif /* _DW_EDMA_H */ | ||
| @@ -0,0 +1,24 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | #ifndef _MXS_DMA_H_ | ||
| 3 | #define _MXS_DMA_H_ | ||
| 4 | |||
| 5 | #include <linux/dmaengine.h> | ||
| 6 | |||
| 7 | #define MXS_DMA_CTRL_WAIT4END BIT(31) | ||
| 8 | #define MXS_DMA_CTRL_WAIT4RDY BIT(30) | ||
| 9 | |||
| 10 | /* | ||
| 11 | * The mxs dmaengine can do PIO transfers. We pass a pointer to the PIO words | ||
| 12 | * in the second argument to dmaengine_prep_slave_sg when the direction is | ||
| 13 | * set to DMA_TRANS_NONE. To make this clear and to prevent users from doing | ||
| 14 | * the error prone casting we have this wrapper function | ||
| 15 | */ | ||
| 16 | static inline struct dma_async_tx_descriptor *mxs_dmaengine_prep_pio( | ||
| 17 | struct dma_chan *chan, u32 *pio, unsigned int npio, | ||
| 18 | enum dma_transfer_direction dir, unsigned long flags) | ||
| 19 | { | ||
| 20 | return dmaengine_prep_slave_sg(chan, (struct scatterlist *)pio, npio, | ||
| 21 | dir, flags); | ||
| 22 | } | ||
| 23 | |||
| 24 | #endif /* _MXS_DMA_H_ */ | ||
| @@ -1302,7 +1302,8 @@ enum dma_status dma_sync_wait(struct dma_chan *chan, dma_cookie_t cookie); · 1301 unmodified lines | |||
| 1302 | enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx); | 1302 | enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx); |
| 1303 | void dma_issue_pending_all(void); | 1303 | void dma_issue_pending_all(void); |
| 1304 | struct dma_chan *__dma_request_channel(const dma_cap_mask_t *mask, | 1304 | struct dma_chan *__dma_request_channel(const dma_cap_mask_t *mask, |
| 1305 | dma_filter_fn fn, void *fn_param); | 1305 | dma_filter_fn fn, void *fn_param, |
| 1306 | struct device_node *np); | ||
| 1306 | struct dma_chan *dma_request_slave_channel(struct device *dev, const char *name); | 1307 | struct dma_chan *dma_request_slave_channel(struct device *dev, const char *name); |
| 1307 | 1308 | ||
| 1308 | struct dma_chan *dma_request_chan(struct device *dev, const char *name); | 1309 | struct dma_chan *dma_request_chan(struct device *dev, const char *name); |
| @@ -1327,7 +1328,9 @@ static inline void dma_issue_pending_all(void) · 18 unmodified lines | |||
| 1327 | { | 1328 | { |
| 1328 | } | 1329 | } |
| 1329 | static inline struct dma_chan *__dma_request_channel(const dma_cap_mask_t *mask, | 1330 | static inline struct dma_chan *__dma_request_channel(const dma_cap_mask_t *mask, |
| 1330 | dma_filter_fn fn, void *fn_param) | 1331 | dma_filter_fn fn, |
| 1332 | void *fn_param, | ||
| 1333 | struct device_node *np) | ||
| 1331 | { | 1334 | { |
| 1332 | return NULL; | 1335 | return NULL; |
| 1333 | } | 1336 | } |
| @@ -1399,7 +1402,8 @@ void dma_async_device_unregister(struct dma_device *device); · 65 unmodified lines | |||
| 1399 | void dma_run_dependencies(struct dma_async_tx_descriptor *tx); | 1402 | void dma_run_dependencies(struct dma_async_tx_descriptor *tx); |
| 1400 | struct dma_chan *dma_get_slave_channel(struct dma_chan *chan); | 1403 | struct dma_chan *dma_get_slave_channel(struct dma_chan *chan); |
| 1401 | struct dma_chan *dma_get_any_slave_channel(struct dma_device *device); | 1404 | struct dma_chan *dma_get_any_slave_channel(struct dma_device *device); |
| 1402 | #define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y) | 1405 | #define dma_request_channel(mask, x, y) \ |
| 1406 | __dma_request_channel(&(mask), x, y, NULL) | ||
| 1403 | #define dma_request_slave_channel_compat(mask, x, y, dev, name) \ | 1407 | #define dma_request_slave_channel_compat(mask, x, y, dev, name) \ |
| 1404 | __dma_request_slave_channel_compat(&(mask), x, y, dev, name) | 1408 | __dma_request_slave_channel_compat(&(mask), x, y, dev, name) |
| 1405 | 1409 | ||
| @@ -1417,6 +1421,6 @@ static inline struct dma_chan · 11 unmodified lines | |||
| 1417 | if (!fn || !fn_param) | 1421 | if (!fn || !fn_param) |
| 1418 | return NULL; | 1422 | return NULL; |
| 1419 | 1423 | ||
| 1420 | return __dma_request_channel(mask, fn, fn_param); | 1424 | return __dma_request_channel(mask, fn, fn_param, NULL); |
| 1421 | } | 1425 | } |
| 1422 | #endif /* DMAENGINE_H */ | 1426 | #endif /* DMAENGINE_H */ |
| @@ -92,12 +92,14 @@ static inline bool dmar_rcu_check(void) · 91 unmodified lines | |||
| 92 | 92 | ||
| 93 | #define dmar_rcu_dereference(p) rcu_dereference_check((p), dmar_rcu_check()) | 93 | #define dmar_rcu_dereference(p) rcu_dereference_check((p), dmar_rcu_check()) |
| 94 | 94 | ||
| 95 | #define for_each_dev_scope(a, c, p, d) \ | 95 | #define for_each_dev_scope(devs, cnt, i, tmp) \ |
| 96 | for ((p) = 0; ((d) = (p) < (c) ? dmar_rcu_dereference((a)[(p)].dev) : \ | 96 | for ((i) = 0; ((tmp) = (i) < (cnt) ? \ |
| 97 | NULL, (p) < (c)); (p)++) | 97 | dmar_rcu_dereference((devs)[(i)].dev) : NULL, (i) < (cnt)); \ |
| 98 | 98 | (i)++) | |
| 99 | #define for_each_active_dev_scope(a, c, p, d) \ | 99 | |
| 100 | for_each_dev_scope((a), (c), (p), (d)) if (!(d)) { continue; } else | 100 | #define for_each_active_dev_scope(devs, cnt, i, tmp) \ |
| 101 | for_each_dev_scope((devs), (cnt), (i), (tmp)) \ | ||
| 102 | if (!(tmp)) { continue; } else | ||
| 101 | 103 | ||
| 102 | extern int dmar_table_init(void); | 104 | extern int dmar_table_init(void); |
| 103 | extern int dmar_dev_scope_init(void); | 105 | extern int dmar_dev_scope_init(void); |
| @@ -26,7 +26,8 @@ · 25 unmodified lines | |||
| 26 | 26 | ||
| 27 | #include <uapi/linux/dns_resolver.h> | 27 | #include <uapi/linux/dns_resolver.h> |
| 28 | 28 | ||
| 29 | extern int dns_query(const char *type, const char *name, size_t namelen, | 29 | struct net; |
| 30 | extern int dns_query(struct net *net, const char *type, const char *name, size_t namelen, | ||
| 30 | const char *options, char **_result, time64_t *_expiry, | 31 | const char *options, char **_result, time64_t *_expiry, |
| 31 | bool invalidate); | 32 | bool invalidate); |
| 32 | 33 | ||
| @@ -20,9 +20,6 @@ int dsa_port_setup_8021q_tagging(struct dsa_switch *ds, int index, · 19 unmodified lines | |||
| 20 | struct sk_buff *dsa_8021q_xmit(struct sk_buff *skb, struct net_device *netdev, | 20 | struct sk_buff *dsa_8021q_xmit(struct sk_buff *skb, struct net_device *netdev, |
| 21 | u16 tpid, u16 tci); | 21 | u16 tpid, u16 tci); |
| 22 | 22 | ||
| 23 | struct sk_buff *dsa_8021q_rcv(struct sk_buff *skb, struct net_device *netdev, | ||
| 24 | struct packet_type *pt, u16 *tpid, u16 *tci); | ||
| 25 | |||
| 26 | u16 dsa_8021q_tx_vid(struct dsa_switch *ds, int port); | 23 | u16 dsa_8021q_tx_vid(struct dsa_switch *ds, int port); |
| 27 | 24 | ||
| 28 | u16 dsa_8021q_rx_vid(struct dsa_switch *ds, int port); | 25 | u16 dsa_8021q_rx_vid(struct dsa_switch *ds, int port); |
| @@ -31,6 +28,8 @@ int dsa_8021q_rx_switch_id(u16 vid); · 2 unmodified lines | |||
| 31 | 28 | ||
| 32 | int dsa_8021q_rx_source_port(u16 vid); | 29 | int dsa_8021q_rx_source_port(u16 vid); |
| 33 | 30 | ||
| 31 | struct sk_buff *dsa_8021q_remove_header(struct sk_buff *skb); | ||
| 32 | |||
| 34 | #else | 33 | #else |
| 35 | 34 | ||
| 36 | int dsa_port_setup_8021q_tagging(struct dsa_switch *ds, int index, | 35 | int dsa_port_setup_8021q_tagging(struct dsa_switch *ds, int index, |
| @@ -45,12 +44,6 @@ struct sk_buff *dsa_8021q_xmit(struct sk_buff *skb, struct net_device *netdev, · 8 unmodified lines | |||
| 45 | return NULL; | 44 | return NULL; |
| 46 | } | 45 | } |
| 47 | 46 | ||
| 48 | struct sk_buff *dsa_8021q_rcv(struct sk_buff *skb, struct net_device *netdev, | ||
| 49 | struct packet_type *pt, u16 *tpid, u16 *tci) | ||
| 50 | { | ||
| 51 | return NULL; | ||
| 52 | } | ||
| 53 | |||
| 54 | u16 dsa_8021q_tx_vid(struct dsa_switch *ds, int port) | 47 | u16 dsa_8021q_tx_vid(struct dsa_switch *ds, int port) |
| 55 | { | 48 | { |
| 56 | return 0; | 49 | return 0; |
| @@ -71,6 +64,11 @@ int dsa_8021q_rx_source_port(u16 vid) · 14 unmodified lines | |||
| 71 | return 0; | 64 | return 0; |
| 72 | } | 65 | } |
| 73 | 66 | ||
| 67 | struct sk_buff *dsa_8021q_remove_header(struct sk_buff *skb) | ||
| 68 | { | ||
| 69 | return NULL; | ||
| 70 | } | ||
| 71 | |||
| 74 | #endif /* IS_ENABLED(CONFIG_NET_DSA_TAG_8021Q) */ | 72 | #endif /* IS_ENABLED(CONFIG_NET_DSA_TAG_8021Q) */ |
| 75 | 73 | ||
| 76 | #endif /* _NET_DSA_8021Q_H */ | 74 | #endif /* _NET_DSA_8021Q_H */ |
| @@ -12,6 +12,7 @@ · 11 unmodified lines | |||
| 12 | #include <net/dsa.h> | 12 | #include <net/dsa.h> |
| 13 | 13 | ||
| 14 | #define ETH_P_SJA1105 ETH_P_DSA_8021Q | 14 | #define ETH_P_SJA1105 ETH_P_DSA_8021Q |
| 15 | #define ETH_P_SJA1105_META 0x0008 | ||
| 15 | 16 | ||
| 16 | /* IEEE 802.3 Annex 57A: Slow Protocols PDUs (01:80:C2:xx:xx:xx) */ | 17 | /* IEEE 802.3 Annex 57A: Slow Protocols PDUs (01:80:C2:xx:xx:xx) */ |
| 17 | #define SJA1105_LINKLOCAL_FILTER_A 0x0180C2000000ull | 18 | #define SJA1105_LINKLOCAL_FILTER_A 0x0180C2000000ull |
| @@ -20,8 +21,41 @@ · 2 unmodified lines | |||
| 20 | #define SJA1105_LINKLOCAL_FILTER_B 0x011B19000000ull | 21 | #define SJA1105_LINKLOCAL_FILTER_B 0x011B19000000ull |
| 21 | #define SJA1105_LINKLOCAL_FILTER_B_MASK 0xFFFFFF000000ull | 22 | #define SJA1105_LINKLOCAL_FILTER_B_MASK 0xFFFFFF000000ull |
| 22 | 23 | ||
| 24 | /* Source and Destination MAC of follow-up meta frames. | ||
| 25 | * Whereas the choice of SMAC only affects the unique identification of the | ||
| 26 | * switch as sender of meta frames, the DMAC must be an address that is present | ||
| 27 | * in the DSA master port's multicast MAC filter. | ||
| 28 | * 01-80-C2-00-00-0E is a good choice for this, as all profiles of IEEE 1588 | ||
| 29 | * over L2 use this address for some purpose already. | ||
| 30 | */ | ||
| 31 | #define SJA1105_META_SMAC 0x222222222222ull | ||
| 32 | #define SJA1105_META_DMAC 0x0180C200000Eull | ||
| 33 | |||
| 34 | /* Global tagger data: each struct sja1105_port has a reference to | ||
| 35 | * the structure defined in struct sja1105_private. | ||
| 36 | */ | ||
| 37 | struct sja1105_tagger_data { | ||
| 38 | struct sk_buff_head skb_rxtstamp_queue; | ||
| 39 | struct work_struct rxtstamp_work; | ||
| 40 | struct sk_buff *stampable_skb; | ||
| 41 | /* Protects concurrent access to the meta state machine | ||
| 42 | * from taggers running on multiple ports on SMP systems | ||
| 43 | */ | ||
| 44 | spinlock_t meta_lock; | ||
| 45 | bool hwts_rx_en; | ||
| 46 | }; | ||
| 47 | |||
| 48 | struct sja1105_skb_cb { | ||
| 49 | u32 meta_tstamp; | ||
| 50 | }; | ||
| 51 | |||
| 52 | #define SJA1105_SKB_CB(skb) \ | ||
| 53 | ((struct sja1105_skb_cb *)DSA_SKB_CB_PRIV(skb)) | ||
| 54 | |||
| 23 | struct sja1105_port { | 55 | struct sja1105_port { |
| 56 | struct sja1105_tagger_data *data; | ||
| 24 | struct dsa_port *dp; | 57 | struct dsa_port *dp; |
| 58 | bool hwts_tx_en; | ||
| 25 | int mgmt_slot; | 59 | int mgmt_slot; |
| 26 | }; | 60 | }; |
| 27 | 61 | ||
| @@ -689,6 +689,7 @@ void efi_native_runtime_setup(void); · 688 unmodified lines | |||
| 689 | #define LINUX_EFI_LOADER_ENTRY_GUID EFI_GUID(0x4a67b082, 0x0a4c, 0x41cf, 0xb6, 0xc7, 0x44, 0x0b, 0x29, 0xbb, 0x8c, 0x4f) | 689 | #define LINUX_EFI_LOADER_ENTRY_GUID EFI_GUID(0x4a67b082, 0x0a4c, 0x41cf, 0xb6, 0xc7, 0x44, 0x0b, 0x29, 0xbb, 0x8c, 0x4f) |
| 690 | #define LINUX_EFI_RANDOM_SEED_TABLE_GUID EFI_GUID(0x1ce1e5bc, 0x7ceb, 0x42f2, 0x81, 0xe5, 0x8a, 0xad, 0xf1, 0x80, 0xf5, 0x7b) | 690 | #define LINUX_EFI_RANDOM_SEED_TABLE_GUID EFI_GUID(0x1ce1e5bc, 0x7ceb, 0x42f2, 0x81, 0xe5, 0x8a, 0xad, 0xf1, 0x80, 0xf5, 0x7b) |
| 691 | #define LINUX_EFI_TPM_EVENT_LOG_GUID EFI_GUID(0xb7799cb0, 0xeca2, 0x4943, 0x96, 0x67, 0x1f, 0xae, 0x07, 0xb7, 0x47, 0xfa) | 691 | #define LINUX_EFI_TPM_EVENT_LOG_GUID EFI_GUID(0xb7799cb0, 0xeca2, 0x4943, 0x96, 0x67, 0x1f, 0xae, 0x07, 0xb7, 0x47, 0xfa) |
| 692 | #define LINUX_EFI_TPM_FINAL_LOG_GUID EFI_GUID(0x1e2ed096, 0x30e2, 0x4254, 0xbd, 0x89, 0x86, 0x3b, 0xbe, 0xf8, 0x23, 0x25) | ||
| 692 | #define LINUX_EFI_MEMRESERVE_TABLE_GUID EFI_GUID(0x888eb0c6, 0x8ede, 0x4ff5, 0xa8, 0xf0, 0x9a, 0xee, 0x5c, 0xb9, 0x77, 0xc2) | 693 | #define LINUX_EFI_MEMRESERVE_TABLE_GUID EFI_GUID(0x888eb0c6, 0x8ede, 0x4ff5, 0xa8, 0xf0, 0x9a, 0xee, 0x5c, 0xb9, 0x77, 0xc2) |
| 693 | 694 | ||
| 694 | typedef struct { | 695 | typedef struct { |
| @@ -996,6 +997,7 @@ extern struct efi { · 301 unmodified lines | |||
| 996 | unsigned long mem_attr_table; /* memory attributes table */ | 997 | unsigned long mem_attr_table; /* memory attributes table */ |
| 997 | unsigned long rng_seed; /* UEFI firmware random seed */ | 998 | unsigned long rng_seed; /* UEFI firmware random seed */ |
| 998 | unsigned long tpm_log; /* TPM2 Event Log table */ | 999 | unsigned long tpm_log; /* TPM2 Event Log table */ |
| 1000 | unsigned long tpm_final_log; /* TPM2 Final Events Log table */ | ||
| 999 | unsigned long mem_reserve; /* Linux EFI memreserve table */ | 1001 | unsigned long mem_reserve; /* Linux EFI memreserve table */ |
| 1000 | efi_get_time_t *get_time; | 1002 | efi_get_time_t *get_time; |
| 1001 | efi_set_time_t *set_time; | 1003 | efi_set_time_t *set_time; |
| @@ -1706,12 +1708,20 @@ struct linux_efi_random_seed { · 704 unmodified lines | |||
| 1706 | 1708 | ||
| 1707 | struct linux_efi_tpm_eventlog { | 1709 | struct linux_efi_tpm_eventlog { |
| 1708 | u32 size; | 1710 | u32 size; |
| 1711 | u32 final_events_preboot_size; | ||
| 1709 | u8 version; | 1712 | u8 version; |
| 1710 | u8 log[]; | 1713 | u8 log[]; |
| 1711 | }; | 1714 | }; |
| 1712 | 1715 | ||
| 1713 | extern int efi_tpm_eventlog_init(void); | 1716 | extern int efi_tpm_eventlog_init(void); |
| 1714 | 1717 | ||
| 1718 | struct efi_tcg2_final_events_table { | ||
| 1719 | u64 version; | ||
| 1720 | u64 nr_events; | ||
| 1721 | u8 events[]; | ||
| 1722 | }; | ||
| 1723 | extern int efi_tpm_final_log_size; | ||
| 1724 | |||
| 1715 | /* | 1725 | /* |
| 1716 | * efi_runtime_service() function identifiers. | 1726 | * efi_runtime_service() function identifiers. |
| 1717 | * "NONE" is used by efi_recover_from_page_fault() to check if the page | 1727 | * "NONE" is used by efi_recover_from_page_fault() to check if the page |
| @@ -34,7 +34,7 @@ struct elevator_mq_ops { · 33 unmodified lines | |||
| 34 | void (*depth_updated)(struct blk_mq_hw_ctx *); | 34 | void (*depth_updated)(struct blk_mq_hw_ctx *); |
| 35 | 35 | ||
| 36 | bool (*allow_merge)(struct request_queue *, struct request *, struct bio *); | 36 | bool (*allow_merge)(struct request_queue *, struct request *, struct bio *); |
| 37 | bool (*bio_merge)(struct blk_mq_hw_ctx *, struct bio *); | 37 | bool (*bio_merge)(struct blk_mq_hw_ctx *, struct bio *, unsigned int); |
| 38 | int (*request_merge)(struct request_queue *q, struct request **, struct bio *); | 38 | int (*request_merge)(struct request_queue *q, struct request **, struct bio *); |
| 39 | void (*request_merged)(struct request_queue *, struct request *, enum elv_merge); | 39 | void (*request_merged)(struct request_queue *, struct request *, enum elv_merge); |
| 40 | void (*requests_merged)(struct request_queue *, struct request *, struct request *); | 40 | void (*requests_merged)(struct request_queue *, struct request *, struct request *); |
| @@ -45,7 +45,6 @@ struct elevator_mq_ops { · 4 unmodified lines | |||
| 45 | struct request *(*dispatch_request)(struct blk_mq_hw_ctx *); | 45 | struct request *(*dispatch_request)(struct blk_mq_hw_ctx *); |
| 46 | bool (*has_work)(struct blk_mq_hw_ctx *); | 46 | bool (*has_work)(struct blk_mq_hw_ctx *); |
| 47 | void (*completed_request)(struct request *, u64); | 47 | void (*completed_request)(struct request *, u64); |
| 48 | void (*started_request)(struct request *); | ||
| 49 | void (*requeue_request)(struct request *); | 48 | void (*requeue_request)(struct request *); |
| 50 | struct request *(*former_request)(struct request_queue *, struct request *); | 49 | struct request *(*former_request)(struct request_queue *, struct request *); |
| 51 | struct request *(*next_request)(struct request_queue *, struct request *); | 50 | struct request *(*next_request)(struct request_queue *, struct request *); |
| @@ -75,7 +74,7 @@ struct elevator_type · 23 unmodified lines | |||
| 75 | size_t icq_size; /* see iocontext.h */ | 74 | size_t icq_size; /* see iocontext.h */ |
| 76 | size_t icq_align; /* ditto */ | 75 | size_t icq_align; /* ditto */ |
| 77 | struct elv_fs_entry *elevator_attrs; | 76 | struct elv_fs_entry *elevator_attrs; |
| 78 | char elevator_name[ELV_NAME_MAX]; | 77 | const char *elevator_name; |
| 79 | const char *elevator_alias; | 78 | const char *elevator_alias; |
| 80 | struct module *elevator_owner; | 79 | struct module *elevator_owner; |
| 81 | #ifdef CONFIG_BLK_DEBUG_FS | 80 | #ifdef CONFIG_BLK_DEBUG_FS |
| @@ -160,15 +159,6 @@ extern struct request *elv_rb_find(struct rb_root *, sector_t); · 78 unmodified lines | |||
| 160 | #define ELEVATOR_INSERT_FLUSH 5 | 159 | #define ELEVATOR_INSERT_FLUSH 5 |
| 161 | #define ELEVATOR_INSERT_SORT_MERGE 6 | 160 | #define ELEVATOR_INSERT_SORT_MERGE 6 |
| 162 | 161 | ||
| 163 | /* | ||
| 164 | * return values from elevator_may_queue_fn | ||
| 165 | */ | ||
| 166 | enum { | ||
| 167 | ELV_MQUEUE_MAY, | ||
| 168 | ELV_MQUEUE_NO, | ||
| 169 | ELV_MQUEUE_MUST, | ||
| 170 | }; | ||
| 171 | |||
| 172 | #define rq_end_sector(rq) (blk_rq_pos(rq) + blk_rq_sectors(rq)) | 162 | #define rq_end_sector(rq) (blk_rq_pos(rq) + blk_rq_sectors(rq)) |
| 173 | #define rb_entry_rq(node) rb_entry((node), struct request, rb_node) | 163 | #define rb_entry_rq(node) rb_entry((node), struct request, rb_node) |
| 174 | 164 | ||
| @@ -89,7 +89,7 @@ static inline unsigned long em_pd_energy(struct em_perf_domain *pd, · 88 unmodified lines | |||
| 89 | * like schedutil. | 89 | * like schedutil. |
| 90 | */ | 90 | */ |
| 91 | cpu = cpumask_first(to_cpumask(pd->cpus)); | 91 | cpu = cpumask_first(to_cpumask(pd->cpus)); |
| 92 | scale_cpu = arch_scale_cpu_capacity(NULL, cpu); | 92 | scale_cpu = arch_scale_cpu_capacity(cpu); |
| 93 | cs = &pd->table[pd->nr_cap_states - 1]; | 93 | cs = &pd->table[pd->nr_cap_states - 1]; |
| 94 | freq = map_util_freq(max_util, cs->frequency, scale_cpu); | 94 | freq = map_util_freq(max_util, cs->frequency, scale_cpu); |
| 95 | 95 | ||
| @@ -11,7 +11,7 @@ · 10 unmodified lines | |||
| 11 | 11 | ||
| 12 | /* | 12 | /* |
| 13 | * For explanation of the elements of this struct, see | 13 | * For explanation of the elements of this struct, see |
| 14 | * Documentation/fault-injection/fault-injection.txt | 14 | * Documentation/fault-injection/fault-injection.rst |
| 15 | */ | 15 | */ |
| 16 | struct fault_attr { | 16 | struct fault_attr { |
| 17 | unsigned long probability; | 17 | unsigned long probability; |
| @@ -126,39 +126,15 @@ struct fb_cursor_user { · 125 unmodified lines | |||
| 126 | 126 | ||
| 127 | /* The resolution of the passed in fb_info about to change */ | 127 | /* The resolution of the passed in fb_info about to change */ |
| 128 | #define FB_EVENT_MODE_CHANGE 0x01 | 128 | #define FB_EVENT_MODE_CHANGE 0x01 |
| 129 | /* The display on this fb_info is being suspended, no access to the | 129 | |
| 130 | * framebuffer is allowed any more after that call returns | 130 | #ifdef CONFIG_GUMSTIX_AM200EPD |
| 131 | */ | 131 | /* only used by mach-pxa/am200epd.c */ |
| 132 | #define FB_EVENT_SUSPEND 0x02 | ||
| 133 | /* The display on this fb_info was resumed, you can restore the display | ||
| 134 | * if you own it | ||
| 135 | */ | ||
| 136 | #define FB_EVENT_RESUME 0x03 | ||
| 137 | /* An entry from the modelist was removed */ | ||
| 138 | #define FB_EVENT_MODE_DELETE 0x04 | ||
| 139 | /* A driver registered itself */ | ||
| 140 | #define FB_EVENT_FB_REGISTERED 0x05 | 132 | #define FB_EVENT_FB_REGISTERED 0x05 |
| 141 | /* A driver unregistered itself */ | ||
| 142 | #define FB_EVENT_FB_UNREGISTERED 0x06 | 133 | #define FB_EVENT_FB_UNREGISTERED 0x06 |
| 143 | /* CONSOLE-SPECIFIC: get console to framebuffer mapping */ | 134 | #endif |
| 144 | #define FB_EVENT_GET_CONSOLE_MAP 0x07 | 135 | |
| 145 | /* CONSOLE-SPECIFIC: set console to framebuffer mapping */ | 136 | /* A display blank is requested */ |
| 146 | #define FB_EVENT_SET_CONSOLE_MAP 0x08 | ||
| 147 | /* A hardware display blank change occurred */ | ||
| 148 | #define FB_EVENT_BLANK 0x09 | 137 | #define FB_EVENT_BLANK 0x09 |
| 149 | /* Private modelist is to be replaced */ | ||
| 150 | #define FB_EVENT_NEW_MODELIST 0x0A | ||
| 151 | /* The resolution of the passed in fb_info about to change and | ||
| 152 | all vc's should be changed */ | ||
| 153 | #define FB_EVENT_MODE_CHANGE_ALL 0x0B | ||
| 154 | /* A software display blank change occurred */ | ||
| 155 | #define FB_EVENT_CONBLANK 0x0C | ||
| 156 | /* Get drawing requirements */ | ||
| 157 | #define FB_EVENT_GET_REQ 0x0D | ||
| 158 | /* Unbind from the console if possible */ | ||
| 159 | #define FB_EVENT_FB_UNBIND 0x0E | ||
| 160 | /* CONSOLE-SPECIFIC: remap all consoles to new fb - for vga_switcheroo */ | ||
| 161 | #define FB_EVENT_REMAP_ALL_CONSOLE 0x0F | ||
| 162 | /* A hardware display blank early change occurred */ | 138 | /* A hardware display blank early change occurred */ |
| 163 | #define FB_EARLY_EVENT_BLANK 0x10 | 139 | #define FB_EARLY_EVENT_BLANK 0x10 |
| 164 | /* A hardware display blank revert early change occurred */ | 140 | /* A hardware display blank revert early change occurred */ |
| @@ -633,8 +609,8 @@ extern ssize_t fb_sys_write(struct fb_info *info, const char __user *buf, · 468 unmodified lines | |||
| 633 | 609 | ||
| 634 | /* drivers/video/fbmem.c */ | 610 | /* drivers/video/fbmem.c */ |
| 635 | extern int register_framebuffer(struct fb_info *fb_info); | 611 | extern int register_framebuffer(struct fb_info *fb_info); |
| 636 | extern int unregister_framebuffer(struct fb_info *fb_info); | 612 | extern void unregister_framebuffer(struct fb_info *fb_info); |
| 637 | extern int unlink_framebuffer(struct fb_info *fb_info); | 613 | extern void unlink_framebuffer(struct fb_info *fb_info); |
| 638 | extern int remove_conflicting_pci_framebuffers(struct pci_dev *pdev, int res_id, | 614 | extern int remove_conflicting_pci_framebuffers(struct pci_dev *pdev, int res_id, |
| 639 | const char *name); | 615 | const char *name); |
| 640 | extern int remove_conflicting_framebuffers(struct apertures_struct *a, | 616 | extern int remove_conflicting_framebuffers(struct apertures_struct *a, |
| @@ -660,7 +636,10 @@ extern struct class *fb_class; · 19 unmodified lines | |||
| 660 | for (i = 0; i < FB_MAX; i++) \ | 636 | for (i = 0; i < FB_MAX; i++) \ |
| 661 | if (!registered_fb[i]) {} else | 637 | if (!registered_fb[i]) {} else |
| 662 | 638 | ||
| 663 | extern int lock_fb_info(struct fb_info *info); | 639 | static inline void lock_fb_info(struct fb_info *info) |
| 640 | { | ||
| 641 | mutex_lock(&info->lock); | ||
| 642 | } | ||
| 664 | 643 | ||
| 665 | static inline void unlock_fb_info(struct fb_info *info) | 644 | static inline void unlock_fb_info(struct fb_info *info) |
| 666 | { | 645 | { |
| @@ -4,9 +4,39 @@ · 3 unmodified lines | |||
| 4 | #ifdef CONFIG_FRAMEBUFFER_CONSOLE | 4 | #ifdef CONFIG_FRAMEBUFFER_CONSOLE |
| 5 | void __init fb_console_init(void); | 5 | void __init fb_console_init(void); |
| 6 | void __exit fb_console_exit(void); | 6 | void __exit fb_console_exit(void); |
| 7 | int fbcon_fb_registered(struct fb_info *info); | ||
| 8 | void fbcon_fb_unregistered(struct fb_info *info); | ||
| 9 | void fbcon_fb_unbind(struct fb_info *info); | ||
| 10 | void fbcon_suspended(struct fb_info *info); | ||
| 11 | void fbcon_resumed(struct fb_info *info); | ||
| 12 | int fbcon_mode_deleted(struct fb_info *info, | ||
| 13 | struct fb_videomode *mode); | ||
| 14 | void fbcon_new_modelist(struct fb_info *info); | ||
| 15 | void fbcon_get_requirement(struct fb_info *info, | ||
| 16 | struct fb_blit_caps *caps); | ||
| 17 | void fbcon_fb_blanked(struct fb_info *info, int blank); | ||
| 18 | void fbcon_update_vcs(struct fb_info *info, bool all); | ||
| 19 | void fbcon_remap_all(struct fb_info *info); | ||
| 20 | int fbcon_set_con2fb_map_ioctl(void __user *argp); | ||
| 21 | int fbcon_get_con2fb_map_ioctl(void __user *argp); | ||
| 7 | #else | 22 | #else |
| 8 | static inline void fb_console_init(void) {} | 23 | static inline void fb_console_init(void) {} |
| 9 | static inline void fb_console_exit(void) {} | 24 | static inline void fb_console_exit(void) {} |
| 25 | static inline int fbcon_fb_registered(struct fb_info *info) { return 0; } | ||
| 26 | static inline void fbcon_fb_unregistered(struct fb_info *info) {} | ||
| 27 | static inline void fbcon_fb_unbind(struct fb_info *info) {} | ||
| 28 | static inline void fbcon_suspended(struct fb_info *info) {} | ||
| 29 | static inline void fbcon_resumed(struct fb_info *info) {} | ||
| 30 | static inline int fbcon_mode_deleted(struct fb_info *info, | ||
| 31 | struct fb_videomode *mode) { return 0; } | ||
| 32 | static inline void fbcon_new_modelist(struct fb_info *info) {} | ||
| 33 | static inline void fbcon_get_requirement(struct fb_info *info, | ||
| 34 | struct fb_blit_caps *caps) {} | ||
| 35 | static inline void fbcon_fb_blanked(struct fb_info *info, int blank) {} | ||
| 36 | static inline void fbcon_update_vcs(struct fb_info *info, bool all) {} | ||
| 37 | static inline void fbcon_remap_all(struct fb_info *info) {} | ||
| 38 | static inline int fbcon_set_con2fb_map_ioctl(void __user *argp) { return 0; } | ||
| 39 | static inline int fbcon_get_con2fb_map_ioctl(void __user *argp) { return 0; } | ||
| 10 | #endif | 40 | #endif |
| 11 | 41 | ||
| 12 | #endif /* _LINUX_FBCON_H */ | 42 | #endif /* _LINUX_FBCON_H */ |
| @@ -24,6 +24,7 @@ · 23 unmodified lines | |||
| 24 | 24 | ||
| 25 | #include <net/sch_generic.h> | 25 | #include <net/sch_generic.h> |
| 26 | 26 | ||
| 27 | #include <asm/byteorder.h> | ||
| 27 | #include <uapi/linux/filter.h> | 28 | #include <uapi/linux/filter.h> |
| 28 | #include <uapi/linux/bpf.h> | 29 | #include <uapi/linux/bpf.h> |
| 29 | 30 | ||
| @@ -160,6 +161,20 @@ struct ctl_table_header; · 130 unmodified lines | |||
| 160 | .off = 0, \ | 161 | .off = 0, \ |
| 161 | .imm = IMM }) | 162 | .imm = IMM }) |
| 162 | 163 | ||
| 164 | /* Special form of mov32, used for doing explicit zero extension on dst. */ | ||
| 165 | #define BPF_ZEXT_REG(DST) \ | ||
| 166 | ((struct bpf_insn) { \ | ||
| 167 | .code = BPF_ALU | BPF_MOV | BPF_X, \ | ||
| 168 | .dst_reg = DST, \ | ||
| 169 | .src_reg = DST, \ | ||
| 170 | .off = 0, \ | ||
| 171 | .imm = 1 }) | ||
| 172 | |||
| 173 | static inline bool insn_is_zext(const struct bpf_insn *insn) | ||
| 174 | { | ||
| 175 | return insn->code == (BPF_ALU | BPF_MOV | BPF_X) && insn->imm == 1; | ||
| 176 | } | ||
| 177 | |||
| 163 | /* BPF_LD_IMM64 macro encodes single 'load 64-bit immediate' insn */ | 178 | /* BPF_LD_IMM64 macro encodes single 'load 64-bit immediate' insn */ |
| 164 | #define BPF_LD_IMM64(DST, IMM) \ | 179 | #define BPF_LD_IMM64(DST, IMM) \ |
| 165 | BPF_LD_IMM64_RAW(DST, 0, IMM) | 180 | BPF_LD_IMM64_RAW(DST, 0, IMM) |
| @@ -512,7 +527,8 @@ struct bpf_prog { · 346 unmodified lines | |||
| 512 | blinded:1, /* Was blinded */ | 527 | blinded:1, /* Was blinded */ |
| 513 | is_func:1, /* program is a bpf function */ | 528 | is_func:1, /* program is a bpf function */ |
| 514 | kprobe_override:1, /* Do we override a kprobe? */ | 529 | kprobe_override:1, /* Do we override a kprobe? */ |
| 515 | has_callchain_buf:1; /* callchain buffer allocated? */ | 530 | has_callchain_buf:1, /* callchain buffer allocated? */ |
| 531 | enforce_expected_attach_type:1; /* Enforce expected_attach_type checking at attach time */ | ||
| 516 | enum bpf_prog_type type; /* Type of BPF program */ | 532 | enum bpf_prog_type type; /* Type of BPF program */ |
| 517 | enum bpf_attach_type expected_attach_type; /* For some prog types */ | 533 | enum bpf_attach_type expected_attach_type; /* For some prog types */ |
| 518 | u32 len; /* Number of filter blocks */ | 534 | u32 len; /* Number of filter blocks */ |
| @@ -563,8 +579,9 @@ struct bpf_skb_data_end { · 44 unmodified lines | |||
| 563 | }; | 579 | }; |
| 564 | 580 | ||
| 565 | struct bpf_redirect_info { | 581 | struct bpf_redirect_info { |
| 566 | u32 ifindex; | ||
| 567 | u32 flags; | 582 | u32 flags; |
| 583 | u32 tgt_index; | ||
| 584 | void *tgt_value; | ||
| 568 | struct bpf_map *map; | 585 | struct bpf_map *map; |
| 569 | struct bpf_map *map_to_flush; | 586 | struct bpf_map *map_to_flush; |
| 570 | u32 kern_flags; | 587 | u32 kern_flags; |
| @@ -731,6 +748,24 @@ bpf_ctx_narrow_access_ok(u32 off, u32 size, u32 size_default) · 160 unmodified lines | |||
| 731 | return size <= size_default && (size & (size - 1)) == 0; | 748 | return size <= size_default && (size & (size - 1)) == 0; |
| 732 | } | 749 | } |
| 733 | 750 | ||
| 751 | static inline u8 | ||
| 752 | bpf_ctx_narrow_load_shift(u32 off, u32 size, u32 size_default) | ||
| 753 | { | ||
| 754 | u8 load_off = off & (size_default - 1); | ||
| 755 | |||
| 756 | #ifdef __LITTLE_ENDIAN | ||
| 757 | return load_off * 8; | ||
| 758 | #else | ||
| 759 | return (size_default - (load_off + size)) * 8; | ||
| 760 | #endif | ||
| 761 | } | ||
| 762 | |||
| 763 | #define bpf_ctx_wide_access_ok(off, size, type, field) \ | ||
| 764 | (size == sizeof(__u64) && \ | ||
| 765 | off >= offsetof(type, field) && \ | ||
| 766 | off + sizeof(__u64) <= offsetofend(type, field) && \ | ||
| 767 | off % sizeof(__u64) == 0) | ||
| 768 | |||
| 734 | #define bpf_classic_proglen(fprog) (fprog->len * sizeof(fprog->filter[0])) | 769 | #define bpf_classic_proglen(fprog) (fprog->len * sizeof(fprog->filter[0])) |
| 735 | 770 | ||
| 736 | static inline void bpf_prog_lock_ro(struct bpf_prog *fp) | 771 | static inline void bpf_prog_lock_ro(struct bpf_prog *fp) |
| @@ -811,6 +846,7 @@ u64 __bpf_call_base(u64 r1, u64 r2, u64 r3, u64 r4, u64 r5); · 74 unmodified lines | |||
| 811 | 846 | ||
| 812 | struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog); | 847 | struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog); |
| 813 | void bpf_jit_compile(struct bpf_prog *prog); | 848 | void bpf_jit_compile(struct bpf_prog *prog); |
| 849 | bool bpf_jit_needs_zext(void); | ||
| 814 | bool bpf_helper_changes_pkt_data(void *func); | 850 | bool bpf_helper_changes_pkt_data(void *func); |
| 815 | 851 | ||
| 816 | static inline bool bpf_dump_raw_ok(void) | 852 | static inline bool bpf_dump_raw_ok(void) |
| @@ -1183,4 +1219,14 @@ struct bpf_sysctl_kern { · 366 unmodified lines | |||
| 1183 | u64 tmp_reg; | 1219 | u64 tmp_reg; |
| 1184 | }; | 1220 | }; |
| 1185 | 1221 | ||
| 1222 | struct bpf_sockopt_kern { | ||
| 1223 | struct sock *sk; | ||
| 1224 | u8 *optval; | ||
| 1225 | u8 *optval_end; | ||
| 1226 | s32 level; | ||
| 1227 | s32 optname; | ||
| 1228 | s32 optlen; | ||
| 1229 | s32 retval; | ||
| 1230 | }; | ||
| 1231 | |||
| 1186 | #endif /* __LINUX_FILTER_H__ */ | 1232 | #endif /* __LINUX_FILTER_H__ */ |
| @@ -46,7 +46,6 @@ · 45 unmodified lines | |||
| 46 | #define ZYNQMP_PM_CAPABILITY_ACCESS 0x1U | 46 | #define ZYNQMP_PM_CAPABILITY_ACCESS 0x1U |
| 47 | #define ZYNQMP_PM_CAPABILITY_CONTEXT 0x2U | 47 | #define ZYNQMP_PM_CAPABILITY_CONTEXT 0x2U |
| 48 | #define ZYNQMP_PM_CAPABILITY_WAKEUP 0x4U | 48 | #define ZYNQMP_PM_CAPABILITY_WAKEUP 0x4U |
| 49 | #define ZYNQMP_PM_CAPABILITY_POWER 0x8U | ||
| 50 | 49 | ||
| 51 | /* | 50 | /* |
| 52 | * Firmware FPGA Manager flags | 51 | * Firmware FPGA Manager flags |
| @@ -10,8 +10,41 @@ · 9 unmodified lines | |||
| 10 | #ifndef _LINUX_FLAT_H | 10 | #ifndef _LINUX_FLAT_H |
| 11 | #define _LINUX_FLAT_H | 11 | #define _LINUX_FLAT_H |
| 12 | 12 | ||
| 13 | #include <uapi/linux/flat.h> | 13 | #define FLAT_VERSION 0x00000004L |
| 14 | #include <asm/flat.h> | 14 | |
| 15 | /* | ||
| 16 | * To make everything easier to port and manage cross platform | ||
| 17 | * development, all fields are in network byte order. | ||
| 18 | */ | ||
| 19 | |||
| 20 | struct flat_hdr { | ||
| 21 | char magic[4]; | ||
| 22 | __be32 rev; /* version (as above) */ | ||
| 23 | __be32 entry; /* Offset of first executable instruction | ||
| 24 | with text segment from beginning of file */ | ||
| 25 | __be32 data_start; /* Offset of data segment from beginning of | ||
| 26 | file */ | ||
| 27 | __be32 data_end; /* Offset of end of data segment from beginning | ||
| 28 | of file */ | ||
| 29 | __be32 bss_end; /* Offset of end of bss segment from beginning | ||
| 30 | of file */ | ||
| 31 | |||
| 32 | /* (It is assumed that data_end through bss_end forms the bss segment.) */ | ||
| 33 | |||
| 34 | __be32 stack_size; /* Size of stack, in bytes */ | ||
| 35 | __be32 reloc_start; /* Offset of relocation records from beginning of | ||
| 36 | file */ | ||
| 37 | __be32 reloc_count; /* Number of relocation records */ | ||
| 38 | __be32 flags; | ||
| 39 | __be32 build_date; /* When the program/library was built */ | ||
| 40 | __u32 filler[5]; /* Reservered, set to zero */ | ||
| 41 | }; | ||
| 42 | |||
| 43 | #define FLAT_FLAG_RAM 0x0001 /* load program entirely into RAM */ | ||
| 44 | #define FLAT_FLAG_GOTPIC 0x0002 /* program is PIC with GOT */ | ||
| 45 | #define FLAT_FLAG_GZIP 0x0004 /* all but the header is compressed */ | ||
| 46 | #define FLAT_FLAG_GZDATA 0x0008 /* only data/relocs are compressed (for XIP) */ | ||
| 47 | #define FLAT_FLAG_KTRACE 0x0010 /* output useful kernel trace for debugging */ | ||
| 15 | 48 | ||
| 16 | /* | 49 | /* |
| 17 | * While it would be nice to keep this header clean, users of older | 50 | * While it would be nice to keep this header clean, users of older |
| @@ -22,28 +55,21 @@ · 4 unmodified lines | |||
| 22 | * with the format above, except to fix bugs with old format support. | 55 | * with the format above, except to fix bugs with old format support. |
| 23 | */ | 56 | */ |
| 24 | 57 | ||
| 25 | #include <asm/byteorder.h> | ||
| 26 | |||
| 27 | #define OLD_FLAT_VERSION 0x00000002L | 58 | #define OLD_FLAT_VERSION 0x00000002L |
| 28 | #define OLD_FLAT_RELOC_TYPE_TEXT 0 | 59 | #define OLD_FLAT_RELOC_TYPE_TEXT 0 |
| 29 | #define OLD_FLAT_RELOC_TYPE_DATA 1 | 60 | #define OLD_FLAT_RELOC_TYPE_DATA 1 |
| 30 | #define OLD_FLAT_RELOC_TYPE_BSS 2 | 61 | #define OLD_FLAT_RELOC_TYPE_BSS 2 |
| 31 | 62 | ||
| 32 | typedef union { | 63 | typedef union { |
| 33 | unsigned long value; | 64 | u32 value; |
| 34 | struct { | 65 | struct { |
| 35 | # if defined(mc68000) && !defined(CONFIG_COLDFIRE) | 66 | #if defined(__LITTLE_ENDIAN_BITFIELD) || \ |
| 36 | signed long offset : 30; | 67 | (defined(mc68000) && !defined(CONFIG_COLDFIRE)) |
| 37 | unsigned long type : 2; | 68 | s32 offset : 30; |
| 38 | # define OLD_FLAT_FLAG_RAM 0x1 /* load program entirely into RAM */ | 69 | u32 type : 2; |
| 39 | # elif defined(__BIG_ENDIAN_BITFIELD) | 70 | # elif defined(__BIG_ENDIAN_BITFIELD) |
| 40 | unsigned long type : 2; | 71 | u32 type : 2; |
| 41 | signed long offset : 30; | 72 | s32 offset : 30; |
| 42 | # define OLD_FLAT_FLAG_RAM 0x1 /* load program entirely into RAM */ | ||
| 43 | # elif defined(__LITTLE_ENDIAN_BITFIELD) | ||
| 44 | signed long offset : 30; | ||
| 45 | unsigned long type : 2; | ||
| 46 | # define OLD_FLAT_FLAG_RAM 0x1 /* load program entirely into RAM */ | ||
| 47 | # else | 73 | # else |
| 48 | # error "Unknown bitfield order for flat files." | 74 | # error "Unknown bitfield order for flat files." |
| 49 | # endif | 75 | # endif |
| @@ -1,39 +0,0 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | /* | ||
| 3 | * This file is separate from sdb.h, because I want that one to remain | ||
| 4 | * unchanged (as far as possible) from the official sdb distribution | ||
| 5 | * | ||
| 6 | * This file and associated functionality are a playground for me to | ||
| 7 | * understand stuff which will later be implemented in more generic places. | ||
| 8 | */ | ||
| 9 | #include <linux/sdb.h> | ||
| 10 | |||
| 11 | /* This is the union of all currently defined types */ | ||
| 12 | union sdb_record { | ||
| 13 | struct sdb_interconnect ic; | ||
| 14 | struct sdb_device dev; | ||
| 15 | struct sdb_bridge bridge; | ||
| 16 | struct sdb_integration integr; | ||
| 17 | struct sdb_empty empty; | ||
| 18 | struct sdb_synthesis synthesis; | ||
| 19 | struct sdb_repo_url repo_url; | ||
| 20 | }; | ||
| 21 | |||
| 22 | struct fmc_device; | ||
| 23 | |||
| 24 | /* Every sdb table is turned into this structure */ | ||
| 25 | struct sdb_array { | ||
| 26 | int len; | ||
| 27 | int level; | ||
| 28 | unsigned long baseaddr; | ||
| 29 | struct fmc_device *fmc; /* the device that hosts it */ | ||
| 30 | struct sdb_array *parent; /* NULL at root */ | ||
| 31 | union sdb_record *record; /* copies of the struct */ | ||
| 32 | struct sdb_array **subtree; /* only valid for bridge items */ | ||
| 33 | }; | ||
| 34 | |||
| 35 | extern int fmc_scan_sdb_tree(struct fmc_device *fmc, unsigned long address); | ||
| 36 | extern void fmc_show_sdb_tree(const struct fmc_device *fmc); | ||
| 37 | extern signed long fmc_find_sdb_device(struct sdb_array *tree, uint64_t vendor, | ||
| 38 | uint32_t device, unsigned long *sz); | ||
| 39 | extern int fmc_free_sdb_tree(struct fmc_device *fmc); | ||
| @@ -1,269 +0,0 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ | ||
| 2 | /* | ||
| 3 | * Copyright (C) 2012 CERN (www.cern.ch) | ||
| 4 | * Author: Alessandro Rubini <rubini@gnudd.com> | ||
| 5 | * | ||
| 6 | * This work is part of the White Rabbit project, a research effort led | ||
| 7 | * by CERN, the European Institute for Nuclear Research. | ||
| 8 | */ | ||
| 9 | #ifndef __LINUX_FMC_H__ | ||
| 10 | #define __LINUX_FMC_H__ | ||
| 11 | #include <linux/types.h> | ||
| 12 | #include <linux/moduleparam.h> | ||
| 13 | #include <linux/device.h> | ||
| 14 | #include <linux/list.h> | ||
| 15 | #include <linux/interrupt.h> | ||
| 16 | #include <linux/io.h> | ||
| 17 | |||
| 18 | struct fmc_device; | ||
| 19 | struct fmc_driver; | ||
| 20 | |||
| 21 | /* | ||
| 22 | * This bus abstraction is developed separately from drivers, so we need | ||
| 23 | * to check the version of the data structures we receive. | ||
| 24 | */ | ||
| 25 | |||
| 26 | #define FMC_MAJOR 3 | ||
| 27 | #define FMC_MINOR 0 | ||
| 28 | #define FMC_VERSION ((FMC_MAJOR << 16) | FMC_MINOR) | ||
| 29 | #define __FMC_MAJOR(x) ((x) >> 16) | ||
| 30 | #define __FMC_MINOR(x) ((x) & 0xffff) | ||
| 31 | |||
| 32 | /* | ||
| 33 | * The device identification, as defined by the IPMI FRU (Field Replaceable | ||
| 34 | * Unit) includes four different strings to describe the device. Here we | ||
| 35 | * only match the "Board Manufacturer" and the "Board Product Name", | ||
| 36 | * ignoring the "Board Serial Number" and "Board Part Number". All 4 are | ||
| 37 | * expected to be strings, so they are treated as zero-terminated C strings. | ||
| 38 | * Unspecified string (NULL) means "any", so if both are unspecified this | ||
| 39 | * is a catch-all driver. So null entries are allowed and we use array | ||
| 40 | * and length. This is unlike pci and usb that use null-terminated arrays | ||
| 41 | */ | ||
| 42 | struct fmc_fru_id { | ||
| 43 | char *manufacturer; | ||
| 44 | char *product_name; | ||
| 45 | }; | ||
| 46 | |||
| 47 | /* | ||
| 48 | * If the FPGA is already programmed (think Etherbone or the second | ||
| 49 | * SVEC slot), we can match on SDB devices in the memory image. This | ||
| 50 | * match uses an array of devices that must all be present, and the | ||
| 51 | * match is based on vendor and device only. Further checks are expected | ||
| 52 | * to happen in the probe function. Zero means "any" and catch-all is allowed. | ||
| 53 | */ | ||
| 54 | struct fmc_sdb_one_id { | ||
| 55 | uint64_t vendor; | ||
| 56 | uint32_t device; | ||
| 57 | }; | ||
| 58 | struct fmc_sdb_id { | ||
| 59 | struct fmc_sdb_one_id *cores; | ||
| 60 | int cores_nr; | ||
| 61 | }; | ||
| 62 | |||
| 63 | struct fmc_device_id { | ||
| 64 | struct fmc_fru_id *fru_id; | ||
| 65 | int fru_id_nr; | ||
| 66 | struct fmc_sdb_id *sdb_id; | ||
| 67 | int sdb_id_nr; | ||
| 68 | }; | ||
| 69 | |||
| 70 | /* This sizes the module_param_array used by generic module parameters */ | ||
| 71 | #define FMC_MAX_CARDS 32 | ||
| 72 | |||
| 73 | /* The driver is a pretty simple thing */ | ||
| 74 | struct fmc_driver { | ||
| 75 | unsigned long version; | ||
| 76 | struct device_driver driver; | ||
| 77 | int (*probe)(struct fmc_device *); | ||
| 78 | int (*remove)(struct fmc_device *); | ||
| 79 | const struct fmc_device_id id_table; | ||
| 80 | /* What follows is for generic module parameters */ | ||
| 81 | int busid_n; | ||
| 82 | int busid_val[FMC_MAX_CARDS]; | ||
| 83 | int gw_n; | ||
| 84 | char *gw_val[FMC_MAX_CARDS]; | ||
| 85 | }; | ||
| 86 | #define to_fmc_driver(x) container_of((x), struct fmc_driver, driver) | ||
| 87 | |||
| 88 | /* These are the generic parameters, that drivers may instantiate */ | ||
| 89 | #define FMC_PARAM_BUSID(_d) \ | ||
| 90 | module_param_array_named(busid, _d.busid_val, int, &_d.busid_n, 0444) | ||
| 91 | #define FMC_PARAM_GATEWARE(_d) \ | ||
| 92 | module_param_array_named(gateware, _d.gw_val, charp, &_d.gw_n, 0444) | ||
| 93 | |||
| 94 | /* | ||
| 95 | * Drivers may need to configure gpio pins in the carrier. To read input | ||
| 96 | * (a very uncommon operation, and definitely not in the hot paths), just | ||
| 97 | * configure one gpio only and get 0 or 1 as retval of the config method | ||
| 98 | */ | ||
| 99 | struct fmc_gpio { | ||
| 100 | char *carrier_name; /* name or NULL for virtual pins */ | ||
| 101 | int gpio; | ||
| 102 | int _gpio; /* internal use by the carrier */ | ||
| 103 | int mode; /* GPIOF_DIR_OUT etc, from <linux/gpio.h> */ | ||
| 104 | int irqmode; /* IRQF_TRIGGER_LOW and so on */ | ||
| 105 | }; | ||
| 106 | |||
| 107 | /* The numbering of gpio pins allows access to raw pins or virtual roles */ | ||
| 108 | #define FMC_GPIO_RAW(x) (x) /* 4096 of them */ | ||
| 109 | #define __FMC_GPIO_IS_RAW(x) ((x) < 0x1000) | ||
| 110 | #define FMC_GPIO_IRQ(x) ((x) + 0x1000) /* 256 of them */ | ||
| 111 | #define FMC_GPIO_LED(x) ((x) + 0x1100) /* 256 of them */ | ||
| 112 | #define FMC_GPIO_KEY(x) ((x) + 0x1200) /* 256 of them */ | ||
| 113 | #define FMC_GPIO_TP(x) ((x) + 0x1300) /* 256 of them */ | ||
| 114 | #define FMC_GPIO_USER(x) ((x) + 0x1400) /* 256 of them */ | ||
| 115 | /* We may add SCL and SDA, or other roles if the need arises */ | ||
| 116 | |||
| 117 | /* GPIOF_DIR_IN etc are missing before 3.0. copy from <linux/gpio.h> */ | ||
| 118 | #ifndef GPIOF_DIR_IN | ||
| 119 | # define GPIOF_DIR_OUT (0 << 0) | ||
| 120 | # define GPIOF_DIR_IN (1 << 0) | ||
| 121 | # define GPIOF_INIT_LOW (0 << 1) | ||
| 122 | # define GPIOF_INIT_HIGH (1 << 1) | ||
| 123 | #endif | ||
| 124 | |||
| 125 | /* | ||
| 126 | * The operations are offered by each carrier and should make driver | ||
| 127 | * design completely independent of the carrier. Named GPIO pins may be | ||
| 128 | * the exception. | ||
| 129 | */ | ||
| 130 | struct fmc_operations { | ||
| 131 | uint32_t (*read32)(struct fmc_device *fmc, int offset); | ||
| 132 | void (*write32)(struct fmc_device *fmc, uint32_t value, int offset); | ||
| 133 | int (*validate)(struct fmc_device *fmc, struct fmc_driver *drv); | ||
| 134 | int (*reprogram_raw)(struct fmc_device *f, struct fmc_driver *d, | ||
| 135 | void *gw, unsigned long len); | ||
| 136 | int (*reprogram)(struct fmc_device *f, struct fmc_driver *d, char *gw); | ||
| 137 | int (*irq_request)(struct fmc_device *fmc, irq_handler_t h, | ||
| 138 | char *name, int flags); | ||
| 139 | void (*irq_ack)(struct fmc_device *fmc); | ||
| 140 | int (*irq_free)(struct fmc_device *fmc); | ||
| 141 | int (*gpio_config)(struct fmc_device *fmc, struct fmc_gpio *gpio, | ||
| 142 | int ngpio); | ||
| 143 | int (*read_ee)(struct fmc_device *fmc, int pos, void *d, int l); | ||
| 144 | int (*write_ee)(struct fmc_device *fmc, int pos, const void *d, int l); | ||
| 145 | }; | ||
| 146 | |||
| 147 | /* Prefer this helper rather than calling of fmc->reprogram directly */ | ||
| 148 | int fmc_reprogram_raw(struct fmc_device *fmc, struct fmc_driver *d, | ||
| 149 | void *gw, unsigned long len, int sdb_entry); | ||
| 150 | extern int fmc_reprogram(struct fmc_device *f, struct fmc_driver *d, char *gw, | ||
| 151 | int sdb_entry); | ||
| 152 | |||
| 153 | /* | ||
| 154 | * The device reports all information needed to access hw. | ||
| 155 | * | ||
| 156 | * If we have eeprom_len and not contents, the core reads it. | ||
| 157 | * Then, parsing of identifiers is done by the core which fills fmc_fru_id.. | ||
| 158 | * Similarly a device that must be matched based on SDB cores must | ||
| 159 | * fill the entry point and the core will scan the bus (FIXME: sdb match) | ||
| 160 | */ | ||
| 161 | struct fmc_device { | ||
| 162 | unsigned long version; | ||
| 163 | unsigned long flags; | ||
| 164 | struct module *owner; /* char device must pin it */ | ||
| 165 | struct fmc_fru_id id; /* for EEPROM-based match */ | ||
| 166 | struct fmc_operations *op; /* carrier-provided */ | ||
| 167 | int irq; /* according to host bus. 0 == none */ | ||
| 168 | int eeprom_len; /* Usually 8kB, may be less */ | ||
| 169 | int eeprom_addr; /* 0x50, 0x52 etc */ | ||
| 170 | uint8_t *eeprom; /* Full contents or leading part */ | ||
| 171 | char *carrier_name; /* "SPEC" or similar, for special use */ | ||
| 172 | void *carrier_data; /* "struct spec *" or equivalent */ | ||
| 173 | __iomem void *fpga_base; /* May be NULL (Etherbone) */ | ||
| 174 | __iomem void *slot_base; /* Set by the driver */ | ||
| 175 | struct fmc_device **devarray; /* Allocated by the bus */ | ||
| 176 | int slot_id; /* Index in the slot array */ | ||
| 177 | int nr_slots; /* Number of slots in this carrier */ | ||
| 178 | unsigned long memlen; /* Used for the char device */ | ||
| 179 | struct device dev; /* For Linux use */ | ||
| 180 | struct device *hwdev; /* The underlying hardware device */ | ||
| 181 | unsigned long sdbfs_entry; | ||
| 182 | struct sdb_array *sdb; | ||
| 183 | uint32_t device_id; /* Filled by the device */ | ||
| 184 | char *mezzanine_name; /* Defaults to ``fmc'' */ | ||
| 185 | void *mezzanine_data; | ||
| 186 | |||
| 187 | struct dentry *dbg_dir; | ||
| 188 | struct dentry *dbg_sdb_dump; | ||
| 189 | }; | ||
| 190 | #define to_fmc_device(x) container_of((x), struct fmc_device, dev) | ||
| 191 | |||
| 192 | #define FMC_DEVICE_HAS_GOLDEN 1 | ||
| 193 | #define FMC_DEVICE_HAS_CUSTOM 2 | ||
| 194 | #define FMC_DEVICE_NO_MEZZANINE 4 | ||
| 195 | #define FMC_DEVICE_MATCH_SDB 8 /* fmc-core must scan sdb in fpga */ | ||
| 196 | |||
| 197 | /* | ||
| 198 | * If fpga_base can be used, the carrier offers no readl/writel methods, and | ||
| 199 | * this expands to a single, fast, I/O access. | ||
| 200 | */ | ||
| 201 | static inline uint32_t fmc_readl(struct fmc_device *fmc, int offset) | ||
| 202 | { | ||
| 203 | if (unlikely(fmc->op->read32)) | ||
| 204 | return fmc->op->read32(fmc, offset); | ||
| 205 | return readl(fmc->fpga_base + offset); | ||
| 206 | } | ||
| 207 | static inline void fmc_writel(struct fmc_device *fmc, uint32_t val, int off) | ||
| 208 | { | ||
| 209 | if (unlikely(fmc->op->write32)) | ||
| 210 | fmc->op->write32(fmc, val, off); | ||
| 211 | else | ||
| 212 | writel(val, fmc->fpga_base + off); | ||
| 213 | } | ||
| 214 | |||
| 215 | /* pci-like naming */ | ||
| 216 | static inline void *fmc_get_drvdata(const struct fmc_device *fmc) | ||
| 217 | { | ||
| 218 | return dev_get_drvdata(&fmc->dev); | ||
| 219 | } | ||
| 220 | |||
| 221 | static inline void fmc_set_drvdata(struct fmc_device *fmc, void *data) | ||
| 222 | { | ||
| 223 | dev_set_drvdata(&fmc->dev, data); | ||
| 224 | } | ||
| 225 | |||
| 226 | struct fmc_gateware { | ||
| 227 | void *bitstream; | ||
| 228 | unsigned long len; | ||
| 229 | }; | ||
| 230 | |||
| 231 | /* The 5 access points */ | ||
| 232 | extern int fmc_driver_register(struct fmc_driver *drv); | ||
| 233 | extern void fmc_driver_unregister(struct fmc_driver *drv); | ||
| 234 | extern int fmc_device_register(struct fmc_device *tdev); | ||
| 235 | extern int fmc_device_register_gw(struct fmc_device *tdev, | ||
| 236 | struct fmc_gateware *gw); | ||
| 237 | extern void fmc_device_unregister(struct fmc_device *tdev); | ||
| 238 | |||
| 239 | /* Three more for device sets, all driven by the same FPGA */ | ||
| 240 | extern int fmc_device_register_n(struct fmc_device **devs, int n); | ||
| 241 | extern int fmc_device_register_n_gw(struct fmc_device **devs, int n, | ||
| 242 | struct fmc_gateware *gw); | ||
| 243 | extern void fmc_device_unregister_n(struct fmc_device **devs, int n); | ||
| 244 | |||
| 245 | /* Internal cross-calls between files; not exported to other modules */ | ||
| 246 | extern int fmc_match(struct device *dev, struct device_driver *drv); | ||
| 247 | extern int fmc_fill_id_info(struct fmc_device *fmc); | ||
| 248 | extern void fmc_free_id_info(struct fmc_device *fmc); | ||
| 249 | extern void fmc_dump_eeprom(const struct fmc_device *fmc); | ||
| 250 | |||
| 251 | /* helpers for FMC operations */ | ||
| 252 | extern int fmc_irq_request(struct fmc_device *fmc, irq_handler_t h, | ||
| 253 | char *name, int flags); | ||
| 254 | extern void fmc_irq_free(struct fmc_device *fmc); | ||
| 255 | extern void fmc_irq_ack(struct fmc_device *fmc); | ||
| 256 | extern int fmc_validate(struct fmc_device *fmc, struct fmc_driver *drv); | ||
| 257 | extern int fmc_gpio_config(struct fmc_device *fmc, struct fmc_gpio *gpio, | ||
| 258 | int ngpio); | ||
| 259 | extern int fmc_read_ee(struct fmc_device *fmc, int pos, void *d, int l); | ||
| 260 | extern int fmc_write_ee(struct fmc_device *fmc, int pos, const void *d, int l); | ||
| 261 | |||
| 262 | /* helpers for FMC operations */ | ||
| 263 | extern int fmc_irq_request(struct fmc_device *fmc, irq_handler_t h, | ||
| 264 | char *name, int flags); | ||
| 265 | extern void fmc_irq_free(struct fmc_device *fmc); | ||
| 266 | extern void fmc_irq_ack(struct fmc_device *fmc); | ||
| 267 | extern int fmc_validate(struct fmc_device *fmc, struct fmc_driver *drv); | ||
| 268 | |||
| 269 | #endif /* __LINUX_FMC_H__ */ | ||
| @@ -0,0 +1,19 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | /* | ||
| 3 | * Analog Devices AXI common registers & definitions | ||
| 4 | * | ||
| 5 | * Copyright 2019 Analog Devices Inc. | ||
| 6 | * | ||
| 7 | * https://wiki.analog.com/resources/fpga/docs/axi_ip | ||
| 8 | * https://wiki.analog.com/resources/fpga/docs/hdl/regmap | ||
| 9 | */ | ||
| 10 | |||
| 11 | #ifndef ADI_AXI_COMMON_H_ | ||
| 12 | #define ADI_AXI_COMMON_H_ | ||
| 13 | |||
| 14 | #define ADI_AXI_REG_VERSION 0x0000 | ||
| 15 | |||
| 16 | #define ADI_AXI_PCORE_VER(major, minor, patch) \ | ||
| 17 | (((major) << 16) | ((minor) << 8) | (patch)) | ||
| 18 | |||
| 19 | #endif /* ADI_AXI_COMMON_H_ */ | ||
| @@ -694,7 +694,7 @@ struct inode { · 693 unmodified lines | |||
| 694 | atomic_t i_count; | 694 | atomic_t i_count; |
| 695 | atomic_t i_dio_count; | 695 | atomic_t i_dio_count; |
| 696 | atomic_t i_writecount; | 696 | atomic_t i_writecount; |
| 697 | #ifdef CONFIG_IMA | 697 | #if defined(CONFIG_IMA) || defined(CONFIG_FILE_LOCKING) |
| 698 | atomic_t i_readcount; /* struct files open RO */ | 698 | atomic_t i_readcount; /* struct files open RO */ |
| 699 | #endif | 699 | #endif |
| 700 | union { | 700 | union { |
| @@ -1019,8 +1019,6 @@ struct file_lock_operations { · 318 unmodified lines | |||
| 1019 | }; | 1019 | }; |
| 1020 | 1020 | ||
| 1021 | struct lock_manager_operations { | 1021 | struct lock_manager_operations { |
| 1022 | int (*lm_compare_owner)(struct file_lock *, struct file_lock *); | ||
| 1023 | unsigned long (*lm_owner_key)(struct file_lock *); | ||
| 1024 | fl_owner_t (*lm_get_owner)(fl_owner_t); | 1022 | fl_owner_t (*lm_get_owner)(fl_owner_t); |
| 1025 | void (*lm_put_owner)(fl_owner_t); | 1023 | void (*lm_put_owner)(fl_owner_t); |
| 1026 | void (*lm_notify)(struct file_lock *); /* unblock callback */ | 1024 | void (*lm_notify)(struct file_lock *); /* unblock callback */ |
| @@ -1769,7 +1767,7 @@ struct block_device_operations; · 742 unmodified lines | |||
| 1769 | /* | 1767 | /* |
| 1770 | * These flags control the behavior of the remap_file_range function pointer. | 1768 | * These flags control the behavior of the remap_file_range function pointer. |
| 1771 | * If it is called with len == 0 that means "remap to end of source file". | 1769 | * If it is called with len == 0 that means "remap to end of source file". |
| 1772 | * See Documentation/filesystems/vfs.txt for more details about this call. | 1770 | * See Documentation/filesystems/vfs.rst for more details about this call. |
| 1773 | * | 1771 | * |
| 1774 | * REMAP_FILE_DEDUP: only remap if contents identical (i.e. deduplicate) | 1772 | * REMAP_FILE_DEDUP: only remap if contents identical (i.e. deduplicate) |
| 1775 | * REMAP_FILE_CAN_SHORTEN: caller can handle a shortened request | 1773 | * REMAP_FILE_CAN_SHORTEN: caller can handle a shortened request |
| @@ -1889,6 +1887,9 @@ extern ssize_t vfs_readv(struct file *, const struct iovec __user *, · 113 unmodified lines | |||
| 1889 | unsigned long, loff_t *, rwf_t); | 1887 | unsigned long, loff_t *, rwf_t); |
| 1890 | extern ssize_t vfs_copy_file_range(struct file *, loff_t , struct file *, | 1888 | extern ssize_t vfs_copy_file_range(struct file *, loff_t , struct file *, |
| 1891 | loff_t, size_t, unsigned int); | 1889 | loff_t, size_t, unsigned int); |
| 1890 | extern ssize_t generic_copy_file_range(struct file *file_in, loff_t pos_in, | ||
| 1891 | struct file *file_out, loff_t pos_out, | ||
| 1892 | size_t len, unsigned int flags); | ||
| 1892 | extern int generic_remap_file_range_prep(struct file *file_in, loff_t pos_in, | 1893 | extern int generic_remap_file_range_prep(struct file *file_in, loff_t pos_in, |
| 1893 | struct file *file_out, loff_t pos_out, | 1894 | struct file *file_out, loff_t pos_out, |
| 1894 | loff_t *count, | 1895 | loff_t *count, |
| @@ -2174,6 +2175,8 @@ static inline void file_accessed(struct file *file) · 279 unmodified lines | |||
| 2174 | touch_atime(&file->f_path); | 2175 | touch_atime(&file->f_path); |
| 2175 | } | 2176 | } |
| 2176 | 2177 | ||
| 2178 | extern int file_modified(struct file *file); | ||
| 2179 | |||
| 2177 | int sync_inode(struct inode *inode, struct writeback_control *wbc); | 2180 | int sync_inode(struct inode *inode, struct writeback_control *wbc); |
| 2178 | int sync_inode_metadata(struct inode *inode, int wait); | 2181 | int sync_inode_metadata(struct inode *inode, int wait); |
| 2179 | 2182 | ||
| @@ -2184,6 +2187,7 @@ struct file_system_type { · 4 unmodified lines | |||
| 2184 | #define FS_BINARY_MOUNTDATA 2 | 2187 | #define FS_BINARY_MOUNTDATA 2 |
| 2185 | #define FS_HAS_SUBTYPE 4 | 2188 | #define FS_HAS_SUBTYPE 4 |
| 2186 | #define FS_USERNS_MOUNT 8 /* Can be mounted by userns root */ | 2189 | #define FS_USERNS_MOUNT 8 /* Can be mounted by userns root */ |
| 2190 | #define FS_DISALLOW_NOTIFY_PERM 16 /* Disable fanotify permission events */ | ||
| 2187 | #define FS_RENAME_DOES_D_MOVE 32768 /* FS will handle d_move() during rename() internally. */ | 2191 | #define FS_RENAME_DOES_D_MOVE 32768 /* FS will handle d_move() during rename() internally. */ |
| 2188 | int (*init_fs_context)(struct fs_context *); | 2192 | int (*init_fs_context)(struct fs_context *); |
| 2189 | const struct fs_parameter_description *parameters; | 2193 | const struct fs_parameter_description *parameters; |
| @@ -2206,9 +2210,6 @@ struct file_system_type { · 16 unmodified lines | |||
| 2206 | 2210 | ||
| 2207 | #define MODULE_ALIAS_FS(NAME) MODULE_ALIAS("fs-" NAME) | 2211 | #define MODULE_ALIAS_FS(NAME) MODULE_ALIAS("fs-" NAME) |
| 2208 | 2212 | ||
| 2209 | extern struct dentry *mount_ns(struct file_system_type *fs_type, | ||
| 2210 | int flags, void *data, void *ns, struct user_namespace *user_ns, | ||
| 2211 | int (*fill_super)(struct super_block *, void *, int)); | ||
| 2212 | #ifdef CONFIG_BLOCK | 2213 | #ifdef CONFIG_BLOCK |
| 2213 | extern struct dentry *mount_bdev(struct file_system_type *fs_type, | 2214 | extern struct dentry *mount_bdev(struct file_system_type *fs_type, |
| 2214 | int flags, const char *dev_name, void *data, | 2215 | int flags, const char *dev_name, void *data, |
| @@ -2248,28 +2249,10 @@ void free_anon_bdev(dev_t); · 33 unmodified lines | |||
| 2248 | struct super_block *sget_fc(struct fs_context *fc, | 2249 | struct super_block *sget_fc(struct fs_context *fc, |
| 2249 | int (*test)(struct super_block *, struct fs_context *), | 2250 | int (*test)(struct super_block *, struct fs_context *), |
| 2250 | int (*set)(struct super_block *, struct fs_context *)); | 2251 | int (*set)(struct super_block *, struct fs_context *)); |
| 2251 | struct super_block *sget_userns(struct file_system_type *type, | ||
| 2252 | int (*test)(struct super_block *,void *), | ||
| 2253 | int (*set)(struct super_block *,void *), | ||
| 2254 | int flags, struct user_namespace *user_ns, | ||
| 2255 | void *data); | ||
| 2256 | struct super_block *sget(struct file_system_type *type, | 2252 | struct super_block *sget(struct file_system_type *type, |
| 2257 | int (*test)(struct super_block *,void *), | 2253 | int (*test)(struct super_block *,void *), |
| 2258 | int (*set)(struct super_block *,void *), | 2254 | int (*set)(struct super_block *,void *), |
| 2259 | int flags, void *data); | 2255 | int flags, void *data); |
| 2260 | extern struct dentry *mount_pseudo_xattr(struct file_system_type *, char *, | ||
| 2261 | const struct super_operations *ops, | ||
| 2262 | const struct xattr_handler **xattr, | ||
| 2263 | const struct dentry_operations *dops, | ||
| 2264 | unsigned long); | ||
| 2265 | |||
| 2266 | static inline struct dentry * | ||
| 2267 | mount_pseudo(struct file_system_type *fs_type, char *name, | ||
| 2268 | const struct super_operations *ops, | ||
| 2269 | const struct dentry_operations *dops, unsigned long magic) | ||
| 2270 | { | ||
| 2271 | return mount_pseudo_xattr(fs_type, name, ops, NULL, dops, magic); | ||
| 2272 | } | ||
| 2273 | 2256 | ||
| 2274 | /* Alas, no aliases. Too much hassle with bringing module.h everywhere */ | 2257 | /* Alas, no aliases. Too much hassle with bringing module.h everywhere */ |
| 2275 | #define fops_get(fops) \ | 2258 | #define fops_get(fops) \ |
| @@ -2615,6 +2598,12 @@ extern struct block_device *blkdev_get_by_path(const char *path, fmode_t mode, · 339 unmodified lines | |||
| 2615 | void *holder); | 2598 | void *holder); |
| 2616 | extern struct block_device *blkdev_get_by_dev(dev_t dev, fmode_t mode, | 2599 | extern struct block_device *blkdev_get_by_dev(dev_t dev, fmode_t mode, |
| 2617 | void *holder); | 2600 | void *holder); |
| 2601 | extern struct block_device *bd_start_claiming(struct block_device *bdev, | ||
| 2602 | void *holder); | ||
| 2603 | extern void bd_finish_claiming(struct block_device *bdev, | ||
| 2604 | struct block_device *whole, void *holder); | ||
| 2605 | extern void bd_abort_claiming(struct block_device *bdev, | ||
| 2606 | struct block_device *whole, void *holder); | ||
| 2618 | extern void blkdev_put(struct block_device *bdev, fmode_t mode); | 2607 | extern void blkdev_put(struct block_device *bdev, fmode_t mode); |
| 2619 | extern int __blkdev_reread_part(struct block_device *bdev); | 2608 | extern int __blkdev_reread_part(struct block_device *bdev); |
| 2620 | extern int blkdev_reread_part(struct block_device *bdev); | 2609 | extern int blkdev_reread_part(struct block_device *bdev); |
| @@ -2712,6 +2701,8 @@ extern int filemap_flush(struct address_space *); · 91 unmodified lines | |||
| 2712 | extern int filemap_fdatawait_keep_errors(struct address_space *mapping); | 2701 | extern int filemap_fdatawait_keep_errors(struct address_space *mapping); |
| 2713 | extern int filemap_fdatawait_range(struct address_space *, loff_t lstart, | 2702 | extern int filemap_fdatawait_range(struct address_space *, loff_t lstart, |
| 2714 | loff_t lend); | 2703 | loff_t lend); |
| 2704 | extern int filemap_fdatawait_range_keep_errors(struct address_space *mapping, | ||
| 2705 | loff_t start_byte, loff_t end_byte); | ||
| 2715 | 2706 | ||
| 2716 | static inline int filemap_fdatawait(struct address_space *mapping) | 2707 | static inline int filemap_fdatawait(struct address_space *mapping) |
| 2717 | { | 2708 | { |
| @@ -2890,7 +2881,7 @@ static inline bool inode_is_open_for_write(const struct inode *inode) · 172 unmodified lines | |||
| 2890 | return atomic_read(&inode->i_writecount) > 0; | 2881 | return atomic_read(&inode->i_writecount) > 0; |
| 2891 | } | 2882 | } |
| 2892 | 2883 | ||
| 2893 | #ifdef CONFIG_IMA | 2884 | #if defined(CONFIG_IMA) || defined(CONFIG_FILE_LOCKING) |
| 2894 | static inline void i_readcount_dec(struct inode *inode) | 2885 | static inline void i_readcount_dec(struct inode *inode) |
| 2895 | { | 2886 | { |
| 2896 | BUG_ON(!atomic_read(&inode->i_readcount)); | 2887 | BUG_ON(!atomic_read(&inode->i_readcount)); |
| @@ -3046,6 +3037,10 @@ extern ssize_t generic_write_checks(struct kiocb *, struct iov_iter *); · 149 unmodified lines | |||
| 3046 | extern int generic_remap_checks(struct file *file_in, loff_t pos_in, | 3037 | extern int generic_remap_checks(struct file *file_in, loff_t pos_in, |
| 3047 | struct file *file_out, loff_t pos_out, | 3038 | struct file *file_out, loff_t pos_out, |
| 3048 | loff_t *count, unsigned int remap_flags); | 3039 | loff_t *count, unsigned int remap_flags); |
| 3040 | extern int generic_file_rw_checks(struct file *file_in, struct file *file_out); | ||
| 3041 | extern int generic_copy_file_checks(struct file *file_in, loff_t pos_in, | ||
| 3042 | struct file *file_out, loff_t pos_out, | ||
| 3043 | size_t *count, unsigned int flags); | ||
| 3049 | extern ssize_t generic_file_read_iter(struct kiocb *, struct iov_iter *); | 3044 | extern ssize_t generic_file_read_iter(struct kiocb *, struct iov_iter *); |
| 3050 | extern ssize_t __generic_file_write_iter(struct kiocb *, struct iov_iter *); | 3045 | extern ssize_t __generic_file_write_iter(struct kiocb *, struct iov_iter *); |
| 3051 | extern ssize_t generic_file_write_iter(struct kiocb *, struct iov_iter *); | 3046 | extern ssize_t generic_file_write_iter(struct kiocb *, struct iov_iter *); |
| @@ -3546,4 +3541,16 @@ static inline struct sock *io_uring_get_socket(struct file *file) · 494 unmodified lines | |||
| 3546 | } | 3541 | } |
| 3547 | #endif | 3542 | #endif |
| 3548 | 3543 | ||
| 3544 | int vfs_ioc_setflags_prepare(struct inode *inode, unsigned int oldflags, | ||
| 3545 | unsigned int flags); | ||
| 3546 | |||
| 3547 | int vfs_ioc_fssetxattr_check(struct inode *inode, const struct fsxattr *old_fa, | ||
| 3548 | struct fsxattr *fa); | ||
| 3549 | |||
| 3550 | static inline void simple_fill_fsxattr(struct fsxattr *fa, __u32 xflags) | ||
| 3551 | { | ||
| 3552 | memset(fa, 0, sizeof(*fa)); | ||
| 3553 | fa->fsx_xflags = xflags; | ||
| 3554 | } | ||
| 3555 | |||
| 3549 | #endif /* _LINUX_FS_H */ | 3556 | #endif /* _LINUX_FS_H */ |
| @@ -81,7 +81,7 @@ struct fs_parameter { · 80 unmodified lines | |||
| 81 | * Superblock creation fills in ->root whereas reconfiguration begins with this | 81 | * Superblock creation fills in ->root whereas reconfiguration begins with this |
| 82 | * already set. | 82 | * already set. |
| 83 | * | 83 | * |
| 84 | * See Documentation/filesystems/mounting.txt | 84 | * See Documentation/filesystems/mount_api.txt |
| 85 | */ | 85 | */ |
| 86 | struct fs_context { | 86 | struct fs_context { |
| 87 | const struct fs_context_operations *ops; | 87 | const struct fs_context_operations *ops; |
| @@ -99,6 +99,7 @@ struct fs_context { · 11 unmodified lines | |||
| 99 | void *s_fs_info; /* Proposed s_fs_info */ | 99 | void *s_fs_info; /* Proposed s_fs_info */ |
| 100 | unsigned int sb_flags; /* Proposed superblock flags (SB_*) */ | 100 | unsigned int sb_flags; /* Proposed superblock flags (SB_*) */ |
| 101 | unsigned int sb_flags_mask; /* Superblock flags that were changed */ | 101 | unsigned int sb_flags_mask; /* Superblock flags that were changed */ |
| 102 | unsigned int s_iflags; /* OR'd with sb->s_iflags */ | ||
| 102 | unsigned int lsm_flags; /* Information flags from the fs to the LSM */ | 103 | unsigned int lsm_flags; /* Information flags from the fs to the LSM */ |
| 103 | enum fs_context_purpose purpose:8; | 104 | enum fs_context_purpose purpose:8; |
| 104 | enum fs_context_phase phase:8; /* The phase the context is in */ | 105 | enum fs_context_phase phase:8; /* The phase the context is in */ |
| @@ -146,6 +147,12 @@ extern int vfs_get_super(struct fs_context *fc, · 41 unmodified lines | |||
| 146 | enum vfs_get_super_keying keying, | 147 | enum vfs_get_super_keying keying, |
| 147 | int (*fill_super)(struct super_block *sb, | 148 | int (*fill_super)(struct super_block *sb, |
| 148 | struct fs_context *fc)); | 149 | struct fs_context *fc)); |
| 150 | extern int get_tree_nodev(struct fs_context *fc, | ||
| 151 | int (*fill_super)(struct super_block *sb, | ||
| 152 | struct fs_context *fc)); | ||
| 153 | extern int get_tree_single(struct fs_context *fc, | ||
| 154 | int (*fill_super)(struct super_block *sb, | ||
| 155 | struct fs_context *fc)); | ||
| 149 | 156 | ||
| 150 | extern const struct file_operations fscontext_fops; | 157 | extern const struct file_operations fscontext_fops; |
| 151 | 158 | ||
| @@ -20,6 +20,5 @@ static inline void init_fs_pin(struct fs_pin *p, void (*kill)(struct fs_pin *)) · 19 unmodified lines | |||
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | void pin_remove(struct fs_pin *); | 22 | void pin_remove(struct fs_pin *); |
| 23 | void pin_insert_group(struct fs_pin *, struct vfsmount *, struct hlist_head *); | ||
| 24 | void pin_insert(struct fs_pin *, struct vfsmount *); | 23 | void pin_insert(struct fs_pin *, struct vfsmount *); |
| 25 | void pin_kill(struct fs_pin *); | 24 | void pin_kill(struct fs_pin *); |
| @@ -63,16 +63,13 @@ struct fscrypt_operations { · 62 unmodified lines | |||
| 63 | unsigned int max_namelen; | 63 | unsigned int max_namelen; |
| 64 | }; | 64 | }; |
| 65 | 65 | ||
| 66 | /* Decryption work */ | ||
| 66 | struct fscrypt_ctx { | 67 | struct fscrypt_ctx { |
| 67 | union { | 68 | union { |
| 68 | struct { | ||
| 69 | struct page *bounce_page; /* Ciphertext page */ | ||
| 70 | struct page *control_page; /* Original page */ | ||
| 71 | } w; | ||
| 72 | struct { | 69 | struct { |
| 73 | struct bio *bio; | 70 | struct bio *bio; |
| 74 | struct work_struct work; | 71 | struct work_struct work; |
| 75 | } r; | 72 | }; |
| 76 | struct list_head free_list; /* Free list */ | 73 | struct list_head free_list; /* Free list */ |
| 77 | }; | 74 | }; |
| 78 | u8 flags; /* Flags */ | 75 | u8 flags; /* Flags */ |
| @@ -106,18 +103,33 @@ static inline void fscrypt_handle_d_move(struct dentry *dentry) · 27 unmodified lines | |||
| 106 | extern void fscrypt_enqueue_decrypt_work(struct work_struct *); | 103 | extern void fscrypt_enqueue_decrypt_work(struct work_struct *); |
| 107 | extern struct fscrypt_ctx *fscrypt_get_ctx(gfp_t); | 104 | extern struct fscrypt_ctx *fscrypt_get_ctx(gfp_t); |
| 108 | extern void fscrypt_release_ctx(struct fscrypt_ctx *); | 105 | extern void fscrypt_release_ctx(struct fscrypt_ctx *); |
| 109 | extern struct page *fscrypt_encrypt_page(const struct inode *, struct page *, | ||
| 110 | unsigned int, unsigned int, | ||
| 111 | u64, gfp_t); | ||
| 112 | extern int fscrypt_decrypt_page(const struct inode *, struct page *, unsigned int, | ||
| 113 | unsigned int, u64); | ||
| 114 | 106 | ||
| 115 | static inline struct page *fscrypt_control_page(struct page *page) | 107 | extern struct page *fscrypt_encrypt_pagecache_blocks(struct page *page, |
| 108 | unsigned int len, | ||
| 109 | unsigned int offs, | ||
| 110 | gfp_t gfp_flags); | ||
| 111 | extern int fscrypt_encrypt_block_inplace(const struct inode *inode, | ||
| 112 | struct page *page, unsigned int len, | ||
| 113 | unsigned int offs, u64 lblk_num, | ||
| 114 | gfp_t gfp_flags); | ||
| 115 | |||
| 116 | extern int fscrypt_decrypt_pagecache_blocks(struct page *page, unsigned int len, | ||
| 117 | unsigned int offs); | ||
| 118 | extern int fscrypt_decrypt_block_inplace(const struct inode *inode, | ||
| 119 | struct page *page, unsigned int len, | ||
| 120 | unsigned int offs, u64 lblk_num); | ||
| 121 | |||
| 122 | static inline bool fscrypt_is_bounce_page(struct page *page) | ||
| 123 | { | ||
| 124 | return page->mapping == NULL; | ||
| 125 | } | ||
| 126 | |||
| 127 | static inline struct page *fscrypt_pagecache_page(struct page *bounce_page) | ||
| 116 | { | 128 | { |
| 117 | return ((struct fscrypt_ctx *)page_private(page))->w.control_page; | 129 | return (struct page *)page_private(bounce_page); |
| 118 | } | 130 | } |
| 119 | 131 | ||
| 120 | extern void fscrypt_restore_control_page(struct page *); | 132 | extern void fscrypt_free_bounce_page(struct page *bounce_page); |
| 121 | 133 | ||
| 122 | /* policy.c */ | 134 | /* policy.c */ |
| 123 | extern int fscrypt_ioctl_set_policy(struct file *, const void __user *); | 135 | extern int fscrypt_ioctl_set_policy(struct file *, const void __user *); |
| @@ -223,7 +235,6 @@ static inline bool fscrypt_match_name(const struct fscrypt_name *fname, · 99 unmodified lines | |||
| 223 | extern void fscrypt_decrypt_bio(struct bio *); | 235 | extern void fscrypt_decrypt_bio(struct bio *); |
| 224 | extern void fscrypt_enqueue_decrypt_bio(struct fscrypt_ctx *ctx, | 236 | extern void fscrypt_enqueue_decrypt_bio(struct fscrypt_ctx *ctx, |
| 225 | struct bio *bio); | 237 | struct bio *bio); |
| 226 | extern void fscrypt_pullback_bio_page(struct page **, bool); | ||
| 227 | extern int fscrypt_zeroout_range(const struct inode *, pgoff_t, sector_t, | 238 | extern int fscrypt_zeroout_range(const struct inode *, pgoff_t, sector_t, |
| 228 | unsigned int); | 239 | unsigned int); |
| 229 | 240 | ||
| @@ -283,32 +294,51 @@ static inline void fscrypt_release_ctx(struct fscrypt_ctx *ctx) · 53 unmodified lines | |||
| 283 | return; | 294 | return; |
| 284 | } | 295 | } |
| 285 | 296 | ||
| 286 | static inline struct page *fscrypt_encrypt_page(const struct inode *inode, | 297 | static inline struct page *fscrypt_encrypt_pagecache_blocks(struct page *page, |
| 298 | unsigned int len, | ||
| 299 | unsigned int offs, | ||
| 300 | gfp_t gfp_flags) | ||
| 301 | { | ||
| 302 | return ERR_PTR(-EOPNOTSUPP); | ||
| 303 | } | ||
| 304 | |||
| 305 | static inline int fscrypt_encrypt_block_inplace(const struct inode *inode, | ||
| 287 | struct page *page, | 306 | struct page *page, |
| 288 | unsigned int len, | 307 | unsigned int len, |
| 289 | unsigned int offs, | 308 | unsigned int offs, u64 lblk_num, |
| 290 | u64 lblk_num, gfp_t gfp_flags) | 309 | gfp_t gfp_flags) |
| 291 | { | 310 | { |
| 292 | return ERR_PTR(-EOPNOTSUPP); | 311 | return -EOPNOTSUPP; |
| 312 | } | ||
| 313 | |||
| 314 | static inline int fscrypt_decrypt_pagecache_blocks(struct page *page, | ||
| 315 | unsigned int len, | ||
| 316 | unsigned int offs) | ||
| 317 | { | ||
| 318 | return -EOPNOTSUPP; | ||
| 293 | } | 319 | } |
| 294 | 320 | ||
| 295 | static inline int fscrypt_decrypt_page(const struct inode *inode, | 321 | static inline int fscrypt_decrypt_block_inplace(const struct inode *inode, |
| 296 | struct page *page, | 322 | struct page *page, |
| 297 | unsigned int len, unsigned int offs, | 323 | unsigned int len, |
| 298 | u64 lblk_num) | 324 | unsigned int offs, u64 lblk_num) |
| 299 | { | 325 | { |
| 300 | return -EOPNOTSUPP; | 326 | return -EOPNOTSUPP; |
| 301 | } | 327 | } |
| 302 | 328 | ||
| 303 | static inline struct page *fscrypt_control_page(struct page *page) | 329 | static inline bool fscrypt_is_bounce_page(struct page *page) |
| 330 | { | ||
| 331 | return false; | ||
| 332 | } | ||
| 333 | |||
| 334 | static inline struct page *fscrypt_pagecache_page(struct page *bounce_page) | ||
| 304 | { | 335 | { |
| 305 | WARN_ON_ONCE(1); | 336 | WARN_ON_ONCE(1); |
| 306 | return ERR_PTR(-EINVAL); | 337 | return ERR_PTR(-EINVAL); |
| 307 | } | 338 | } |
| 308 | 339 | ||
| 309 | static inline void fscrypt_restore_control_page(struct page *page) | 340 | static inline void fscrypt_free_bounce_page(struct page *bounce_page) |
| 310 | { | 341 | { |
| 311 | return; | ||
| 312 | } | 342 | } |
| 313 | 343 | ||
| 314 | /* policy.c */ | 344 | /* policy.c */ |
| @@ -410,11 +440,6 @@ static inline void fscrypt_enqueue_decrypt_bio(struct fscrypt_ctx *ctx, · 95 unmodified lines | |||
| 410 | { | 440 | { |
| 411 | } | 441 | } |
| 412 | 442 | ||
| 413 | static inline void fscrypt_pullback_bio_page(struct page **page, bool restore) | ||
| 414 | { | ||
| 415 | return; | ||
| 416 | } | ||
| 417 | |||
| 418 | static inline int fscrypt_zeroout_range(const struct inode *inode, pgoff_t lblk, | 443 | static inline int fscrypt_zeroout_range(const struct inode *inode, pgoff_t lblk, |
| 419 | sector_t pblk, unsigned int len) | 444 | sector_t pblk, unsigned int len) |
| 420 | { | 445 | { |
| @@ -692,4 +717,15 @@ static inline int fscrypt_encrypt_symlink(struct inode *inode, · 271 unmodified lines | |||
| 692 | return 0; | 717 | return 0; |
| 693 | } | 718 | } |
| 694 | 719 | ||
| 720 | /* If *pagep is a bounce page, free it and set *pagep to the pagecache page */ | ||
| 721 | static inline void fscrypt_finalize_bounce_page(struct page **pagep) | ||
| 722 | { | ||
| 723 | struct page *page = *pagep; | ||
| 724 | |||
| 725 | if (fscrypt_is_bounce_page(page)) { | ||
| 726 | *pagep = fscrypt_pagecache_page(page); | ||
| 727 | fscrypt_free_bounce_page(page); | ||
| 728 | } | ||
| 729 | } | ||
| 730 | |||
| 695 | #endif /* _LINUX_FSCRYPT_H */ | 731 | #endif /* _LINUX_FSCRYPT_H */ |
| @@ -98,6 +98,7 @@ struct fsl_usb2_platform_data { · 97 unmodified lines | |||
| 98 | unsigned has_fsl_erratum_14:1; | 98 | unsigned has_fsl_erratum_14:1; |
| 99 | unsigned has_fsl_erratum_a005275:1; | 99 | unsigned has_fsl_erratum_a005275:1; |
| 100 | unsigned has_fsl_erratum_a005697:1; | 100 | unsigned has_fsl_erratum_a005697:1; |
| 101 | unsigned has_fsl_erratum_a006918:1; | ||
| 101 | unsigned check_phy_clk_valid:1; | 102 | unsigned check_phy_clk_valid:1; |
| 102 | 103 | ||
| 103 | /* register save area for suspend/resume */ | 104 | /* register save area for suspend/resume */ |
| @@ -188,6 +188,19 @@ static inline void fsnotify_link(struct inode *dir, struct inode *inode, struct · 187 unmodified lines | |||
| 188 | fsnotify(dir, FS_CREATE, inode, FSNOTIFY_EVENT_INODE, &new_dentry->d_name, 0); | 188 | fsnotify(dir, FS_CREATE, inode, FSNOTIFY_EVENT_INODE, &new_dentry->d_name, 0); |
| 189 | } | 189 | } |
| 190 | 190 | ||
| 191 | /* | ||
| 192 | * fsnotify_unlink - 'name' was unlinked | ||
| 193 | * | ||
| 194 | * Caller must make sure that dentry->d_name is stable. | ||
| 195 | */ | ||
| 196 | static inline void fsnotify_unlink(struct inode *dir, struct dentry *dentry) | ||
| 197 | { | ||
| 198 | /* Expected to be called before d_delete() */ | ||
| 199 | WARN_ON_ONCE(d_is_negative(dentry)); | ||
| 200 | |||
| 201 | fsnotify_dirent(dir, dentry, FS_DELETE); | ||
| 202 | } | ||
| 203 | |||
| 191 | /* | 204 | /* |
| 192 | * fsnotify_mkdir - directory 'name' was created | 205 | * fsnotify_mkdir - directory 'name' was created |
| 193 | */ | 206 | */ |
| @@ -198,6 +211,19 @@ static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry) · 4 unmodified lines | |||
| 198 | fsnotify_dirent(inode, dentry, FS_CREATE | FS_ISDIR); | 211 | fsnotify_dirent(inode, dentry, FS_CREATE | FS_ISDIR); |
| 199 | } | 212 | } |
| 200 | 213 | ||
| 214 | /* | ||
| 215 | * fsnotify_rmdir - directory 'name' was removed | ||
| 216 | * | ||
| 217 | * Caller must make sure that dentry->d_name is stable. | ||
| 218 | */ | ||
| 219 | static inline void fsnotify_rmdir(struct inode *dir, struct dentry *dentry) | ||
| 220 | { | ||
| 221 | /* Expected to be called before d_delete() */ | ||
| 222 | WARN_ON_ONCE(d_is_negative(dentry)); | ||
| 223 | |||
| 224 | fsnotify_dirent(dir, dentry, FS_DELETE | FS_ISDIR); | ||
| 225 | } | ||
| 226 | |||
| 201 | /* | 227 | /* |
| 202 | * fsnotify_access - file was read | 228 | * fsnotify_access - file was read |
| 203 | */ | 229 | */ |
| @@ -357,7 +357,6 @@ extern int __fsnotify_parent(const struct path *path, struct dentry *dentry, __u · 356 unmodified lines | |||
| 357 | extern void __fsnotify_inode_delete(struct inode *inode); | 357 | extern void __fsnotify_inode_delete(struct inode *inode); |
| 358 | extern void __fsnotify_vfsmount_delete(struct vfsmount *mnt); | 358 | extern void __fsnotify_vfsmount_delete(struct vfsmount *mnt); |
| 359 | extern void fsnotify_sb_delete(struct super_block *sb); | 359 | extern void fsnotify_sb_delete(struct super_block *sb); |
| 360 | extern void fsnotify_nameremove(struct dentry *dentry, int isdir); | ||
| 361 | extern u32 fsnotify_get_cookie(void); | 360 | extern u32 fsnotify_get_cookie(void); |
| 362 | 361 | ||
| 363 | static inline int fsnotify_inode_watches_children(struct inode *inode) | 362 | static inline int fsnotify_inode_watches_children(struct inode *inode) |
| @@ -527,9 +526,6 @@ static inline void __fsnotify_vfsmount_delete(struct vfsmount *mnt) · 163 unmodified lines | |||
| 527 | static inline void fsnotify_sb_delete(struct super_block *sb) | 526 | static inline void fsnotify_sb_delete(struct super_block *sb) |
| 528 | {} | 527 | {} |
| 529 | 528 | ||
| 530 | static inline void fsnotify_nameremove(struct dentry *dentry, int isdir) | ||
| 531 | {} | ||
| 532 | |||
| 533 | static inline void fsnotify_update_flags(struct dentry *dentry) | 529 | static inline void fsnotify_update_flags(struct dentry *dentry) |
| 534 | {} | 530 | {} |
| 535 | 531 | ||
| @@ -427,8 +427,8 @@ struct dyn_ftrace *ftrace_rec_iter_record(struct ftrace_rec_iter *iter); · 426 unmodified lines | |||
| 427 | iter = ftrace_rec_iter_next(iter)) | 427 | iter = ftrace_rec_iter_next(iter)) |
| 428 | 428 | ||
| 429 | 429 | ||
| 430 | int ftrace_update_record(struct dyn_ftrace *rec, int enable); | 430 | int ftrace_update_record(struct dyn_ftrace *rec, bool enable); |
| 431 | int ftrace_test_record(struct dyn_ftrace *rec, int enable); | 431 | int ftrace_test_record(struct dyn_ftrace *rec, bool enable); |
| 432 | void ftrace_run_stop_machine(int command); | 432 | void ftrace_run_stop_machine(int command); |
| 433 | unsigned long ftrace_location(unsigned long ip); | 433 | unsigned long ftrace_location(unsigned long ip); |
| 434 | unsigned long ftrace_location_range(unsigned long start, unsigned long end); | 434 | unsigned long ftrace_location_range(unsigned long start, unsigned long end); |
| @@ -155,6 +155,15 @@ static inline unsigned long gen_pool_alloc(struct gen_pool *pool, size_t size) · 154 unmodified lines | |||
| 155 | 155 | ||
| 156 | extern void *gen_pool_dma_alloc(struct gen_pool *pool, size_t size, | 156 | extern void *gen_pool_dma_alloc(struct gen_pool *pool, size_t size, |
| 157 | dma_addr_t *dma); | 157 | dma_addr_t *dma); |
| 158 | extern void *gen_pool_dma_alloc_algo(struct gen_pool *pool, size_t size, | ||
| 159 | dma_addr_t *dma, genpool_algo_t algo, void *data); | ||
| 160 | extern void *gen_pool_dma_alloc_align(struct gen_pool *pool, size_t size, | ||
| 161 | dma_addr_t *dma, int align); | ||
| 162 | extern void *gen_pool_dma_zalloc(struct gen_pool *pool, size_t size, dma_addr_t *dma); | ||
| 163 | extern void *gen_pool_dma_zalloc_algo(struct gen_pool *pool, size_t size, | ||
| 164 | dma_addr_t *dma, genpool_algo_t algo, void *data); | ||
| 165 | extern void *gen_pool_dma_zalloc_align(struct gen_pool *pool, size_t size, | ||
| 166 | dma_addr_t *dma, int align); | ||
| 158 | extern void gen_pool_free_owner(struct gen_pool *pool, unsigned long addr, | 167 | extern void gen_pool_free_owner(struct gen_pool *pool, unsigned long addr, |
| 159 | size_t size, void **owner); | 168 | size_t size, void **owner); |
| 160 | static inline void gen_pool_free(struct gen_pool *pool, unsigned long addr, | 169 | static inline void gen_pool_free(struct gen_pool *pool, unsigned long addr, |
| @@ -106,6 +106,7 @@ void devm_gpio_free(struct device *dev, unsigned int gpio); · 105 unmodified lines | |||
| 106 | 106 | ||
| 107 | struct device; | 107 | struct device; |
| 108 | struct gpio_chip; | 108 | struct gpio_chip; |
| 109 | struct pinctrl_dev; | ||
| 109 | 110 | ||
| 110 | static inline bool gpio_is_valid(int number) | 111 | static inline bool gpio_is_valid(int number) |
| 111 | { | 112 | { |
| @@ -247,7 +247,7 @@ static inline void gpiod_put(struct gpio_desc *desc) · 246 unmodified lines | |||
| 247 | might_sleep(); | 247 | might_sleep(); |
| 248 | 248 | ||
| 249 | /* GPIO can never have been requested */ | 249 | /* GPIO can never have been requested */ |
| 250 | WARN_ON(1); | 250 | WARN_ON(desc); |
| 251 | } | 251 | } |
| 252 | 252 | ||
| 253 | static inline void devm_gpiod_unhinge(struct device *dev, | 253 | static inline void devm_gpiod_unhinge(struct device *dev, |
| @@ -256,7 +256,7 @@ static inline void devm_gpiod_unhinge(struct device *dev, · 2 unmodified lines | |||
| 256 | might_sleep(); | 256 | might_sleep(); |
| 257 | 257 | ||
| 258 | /* GPIO can never have been requested */ | 258 | /* GPIO can never have been requested */ |
| 259 | WARN_ON(1); | 259 | WARN_ON(desc); |
| 260 | } | 260 | } |
| 261 | 261 | ||
| 262 | static inline void gpiod_put_array(struct gpio_descs *descs) | 262 | static inline void gpiod_put_array(struct gpio_descs *descs) |
| @@ -264,7 +264,7 @@ static inline void gpiod_put_array(struct gpio_descs *descs) · 1 unmodified line | |||
| 264 | might_sleep(); | 264 | might_sleep(); |
| 265 | 265 | ||
| 266 | /* GPIO can never have been requested */ | 266 | /* GPIO can never have been requested */ |
| 267 | WARN_ON(1); | 267 | WARN_ON(descs); |
| 268 | } | 268 | } |
| 269 | 269 | ||
| 270 | static inline struct gpio_desc *__must_check | 270 | static inline struct gpio_desc *__must_check |
| @@ -317,7 +317,7 @@ static inline void devm_gpiod_put(struct device *dev, struct gpio_desc *desc) · 46 unmodified lines | |||
| 317 | might_sleep(); | 317 | might_sleep(); |
| 318 | 318 | ||
| 319 | /* GPIO can never have been requested */ | 319 | /* GPIO can never have been requested */ |
| 320 | WARN_ON(1); | 320 | WARN_ON(desc); |
| 321 | } | 321 | } |
| 322 | 322 | ||
| 323 | static inline void devm_gpiod_put_array(struct device *dev, | 323 | static inline void devm_gpiod_put_array(struct device *dev, |
| @@ -326,32 +326,32 @@ static inline void devm_gpiod_put_array(struct device *dev, · 2 unmodified lines | |||
| 326 | might_sleep(); | 326 | might_sleep(); |
| 327 | 327 | ||
| 328 | /* GPIO can never have been requested */ | 328 | /* GPIO can never have been requested */ |
| 329 | WARN_ON(1); | 329 | WARN_ON(descs); |
| 330 | } | 330 | } |
| 331 | 331 | ||
| 332 | 332 | ||
| 333 | static inline int gpiod_get_direction(const struct gpio_desc *desc) | 333 | static inline int gpiod_get_direction(const struct gpio_desc *desc) |
| 334 | { | 334 | { |
| 335 | /* GPIO can never have been requested */ | 335 | /* GPIO can never have been requested */ |
| 336 | WARN_ON(1); | 336 | WARN_ON(desc); |
| 337 | return -ENOSYS; | 337 | return -ENOSYS; |
| 338 | } | 338 | } |
| 339 | static inline int gpiod_direction_input(struct gpio_desc *desc) | 339 | static inline int gpiod_direction_input(struct gpio_desc *desc) |
| 340 | { | 340 | { |
| 341 | /* GPIO can never have been requested */ | 341 | /* GPIO can never have been requested */ |
| 342 | WARN_ON(1); | 342 | WARN_ON(desc); |
| 343 | return -ENOSYS; | 343 | return -ENOSYS; |
| 344 | } | 344 | } |
| 345 | static inline int gpiod_direction_output(struct gpio_desc *desc, int value) | 345 | static inline int gpiod_direction_output(struct gpio_desc *desc, int value) |
| 346 | { | 346 | { |
| 347 | /* GPIO can never have been requested */ | 347 | /* GPIO can never have been requested */ |
| 348 | WARN_ON(1); | 348 | WARN_ON(desc); |
| 349 | return -ENOSYS; | 349 | return -ENOSYS; |
| 350 | } | 350 | } |
| 351 | static inline int gpiod_direction_output_raw(struct gpio_desc *desc, int value) | 351 | static inline int gpiod_direction_output_raw(struct gpio_desc *desc, int value) |
| 352 | { | 352 | { |
| 353 | /* GPIO can never have been requested */ | 353 | /* GPIO can never have been requested */ |
| 354 | WARN_ON(1); | 354 | WARN_ON(desc); |
| 355 | return -ENOSYS; | 355 | return -ENOSYS; |
| 356 | } | 356 | } |
| 357 | 357 | ||
| @@ -359,7 +359,7 @@ static inline int gpiod_direction_output_raw(struct gpio_desc *desc, int value) · 1 unmodified line | |||
| 359 | static inline int gpiod_get_value(const struct gpio_desc *desc) | 359 | static inline int gpiod_get_value(const struct gpio_desc *desc) |
| 360 | { | 360 | { |
| 361 | /* GPIO can never have been requested */ | 361 | /* GPIO can never have been requested */ |
| 362 | WARN_ON(1); | 362 | WARN_ON(desc); |
| 363 | return 0; | 363 | return 0; |
| 364 | } | 364 | } |
| 365 | static inline int gpiod_get_array_value(unsigned int array_size, | 365 | static inline int gpiod_get_array_value(unsigned int array_size, |
| @@ -368,13 +368,13 @@ static inline int gpiod_get_array_value(unsigned int array_size, · 2 unmodified lines | |||
| 368 | unsigned long *value_bitmap) | 368 | unsigned long *value_bitmap) |
| 369 | { | 369 | { |
| 370 | /* GPIO can never have been requested */ | 370 | /* GPIO can never have been requested */ |
| 371 | WARN_ON(1); | 371 | WARN_ON(desc_array); |
| 372 | return 0; | 372 | return 0; |
| 373 | } | 373 | } |
| 374 | static inline void gpiod_set_value(struct gpio_desc *desc, int value) | 374 | static inline void gpiod_set_value(struct gpio_desc *desc, int value) |
| 375 | { | 375 | { |
| 376 | /* GPIO can never have been requested */ | 376 | /* GPIO can never have been requested */ |
| 377 | WARN_ON(1); | 377 | WARN_ON(desc); |
| 378 | } | 378 | } |
| 379 | static inline int gpiod_set_array_value(unsigned int array_size, | 379 | static inline int gpiod_set_array_value(unsigned int array_size, |
| 380 | struct gpio_desc **desc_array, | 380 | struct gpio_desc **desc_array, |
| @@ -382,13 +382,13 @@ static inline int gpiod_set_array_value(unsigned int array_size, · 1 unmodified line | |||
| 382 | unsigned long *value_bitmap) | 382 | unsigned long *value_bitmap) |
| 383 | { | 383 | { |
| 384 | /* GPIO can never have been requested */ | 384 | /* GPIO can never have been requested */ |
| 385 | WARN_ON(1); | 385 | WARN_ON(desc_array); |
| 386 | return 0; | 386 | return 0; |
| 387 | } | 387 | } |
| 388 | static inline int gpiod_get_raw_value(const struct gpio_desc *desc) | 388 | static inline int gpiod_get_raw_value(const struct gpio_desc *desc) |
| 389 | { | 389 | { |
| 390 | /* GPIO can never have been requested */ | 390 | /* GPIO can never have been requested */ |
| 391 | WARN_ON(1); | 391 | WARN_ON(desc); |
| 392 | return 0; | 392 | return 0; |
| 393 | } | 393 | } |
| 394 | static inline int gpiod_get_raw_array_value(unsigned int array_size, | 394 | static inline int gpiod_get_raw_array_value(unsigned int array_size, |
| @@ -397,13 +397,13 @@ static inline int gpiod_get_raw_array_value(unsigned int array_size, · 2 unmodified lines | |||
| 397 | unsigned long *value_bitmap) | 397 | unsigned long *value_bitmap) |
| 398 | { | 398 | { |
| 399 | /* GPIO can never have been requested */ | 399 | /* GPIO can never have been requested */ |
| 400 | WARN_ON(1); | 400 | WARN_ON(desc_array); |
| 401 | return 0; | 401 | return 0; |
| 402 | } | 402 | } |
| 403 | static inline void gpiod_set_raw_value(struct gpio_desc *desc, int value) | 403 | static inline void gpiod_set_raw_value(struct gpio_desc *desc, int value) |
| 404 | { | 404 | { |
| 405 | /* GPIO can never have been requested */ | 405 | /* GPIO can never have been requested */ |
| 406 | WARN_ON(1); | 406 | WARN_ON(desc); |
| 407 | } | 407 | } |
| 408 | static inline int gpiod_set_raw_array_value(unsigned int array_size, | 408 | static inline int gpiod_set_raw_array_value(unsigned int array_size, |
| 409 | struct gpio_desc **desc_array, | 409 | struct gpio_desc **desc_array, |
| @@ -411,14 +411,14 @@ static inline int gpiod_set_raw_array_value(unsigned int array_size, · 1 unmodified line | |||
| 411 | unsigned long *value_bitmap) | 411 | unsigned long *value_bitmap) |
| 412 | { | 412 | { |
| 413 | /* GPIO can never have been requested */ | 413 | /* GPIO can never have been requested */ |
| 414 | WARN_ON(1); | 414 | WARN_ON(desc_array); |
| 415 | return 0; | 415 | return 0; |
| 416 | } | 416 | } |
| 417 | 417 | ||
| 418 | static inline int gpiod_get_value_cansleep(const struct gpio_desc *desc) | 418 | static inline int gpiod_get_value_cansleep(const struct gpio_desc *desc) |
| 419 | { | 419 | { |
| 420 | /* GPIO can never have been requested */ | 420 | /* GPIO can never have been requested */ |
| 421 | WARN_ON(1); | 421 | WARN_ON(desc); |
| 422 | return 0; | 422 | return 0; |
| 423 | } | 423 | } |
| 424 | static inline int gpiod_get_array_value_cansleep(unsigned int array_size, | 424 | static inline int gpiod_get_array_value_cansleep(unsigned int array_size, |
| @@ -427,13 +427,13 @@ static inline int gpiod_get_array_value_cansleep(unsigned int array_size, · 2 unmodified lines | |||
| 427 | unsigned long *value_bitmap) | 427 | unsigned long *value_bitmap) |
| 428 | { | 428 | { |
| 429 | /* GPIO can never have been requested */ | 429 | /* GPIO can never have been requested */ |
| 430 | WARN_ON(1); | 430 | WARN_ON(desc_array); |
| 431 | return 0; | 431 | return 0; |
| 432 | } | 432 | } |
| 433 | static inline void gpiod_set_value_cansleep(struct gpio_desc *desc, int value) | 433 | static inline void gpiod_set_value_cansleep(struct gpio_desc *desc, int value) |
| 434 | { | 434 | { |
| 435 | /* GPIO can never have been requested */ | 435 | /* GPIO can never have been requested */ |
| 436 | WARN_ON(1); | 436 | WARN_ON(desc); |
| 437 | } | 437 | } |
| 438 | static inline int gpiod_set_array_value_cansleep(unsigned int array_size, | 438 | static inline int gpiod_set_array_value_cansleep(unsigned int array_size, |
| 439 | struct gpio_desc **desc_array, | 439 | struct gpio_desc **desc_array, |
| @@ -441,13 +441,13 @@ static inline int gpiod_set_array_value_cansleep(unsigned int array_size, · 1 unmodified line | |||
| 441 | unsigned long *value_bitmap) | 441 | unsigned long *value_bitmap) |
| 442 | { | 442 | { |
| 443 | /* GPIO can never have been requested */ | 443 | /* GPIO can never have been requested */ |
| 444 | WARN_ON(1); | 444 | WARN_ON(desc_array); |
| 445 | return 0; | 445 | return 0; |
| 446 | } | 446 | } |
| 447 | static inline int gpiod_get_raw_value_cansleep(const struct gpio_desc *desc) | 447 | static inline int gpiod_get_raw_value_cansleep(const struct gpio_desc *desc) |
| 448 | { | 448 | { |
| 449 | /* GPIO can never have been requested */ | 449 | /* GPIO can never have been requested */ |
| 450 | WARN_ON(1); | 450 | WARN_ON(desc); |
| 451 | return 0; | 451 | return 0; |
| 452 | } | 452 | } |
| 453 | static inline int gpiod_get_raw_array_value_cansleep(unsigned int array_size, | 453 | static inline int gpiod_get_raw_array_value_cansleep(unsigned int array_size, |
| @@ -456,14 +456,14 @@ static inline int gpiod_get_raw_array_value_cansleep(unsigned int array_size, · 2 unmodified lines | |||
| 456 | unsigned long *value_bitmap) | 456 | unsigned long *value_bitmap) |
| 457 | { | 457 | { |
| 458 | /* GPIO can never have been requested */ | 458 | /* GPIO can never have been requested */ |
| 459 | WARN_ON(1); | 459 | WARN_ON(desc_array); |
| 460 | return 0; | 460 | return 0; |
| 461 | } | 461 | } |
| 462 | static inline void gpiod_set_raw_value_cansleep(struct gpio_desc *desc, | 462 | static inline void gpiod_set_raw_value_cansleep(struct gpio_desc *desc, |
| 463 | int value) | 463 | int value) |
| 464 | { | 464 | { |
| 465 | /* GPIO can never have been requested */ | 465 | /* GPIO can never have been requested */ |
| 466 | WARN_ON(1); | 466 | WARN_ON(desc); |
| 467 | } | 467 | } |
| 468 | static inline int gpiod_set_raw_array_value_cansleep(unsigned int array_size, | 468 | static inline int gpiod_set_raw_array_value_cansleep(unsigned int array_size, |
| 469 | struct gpio_desc **desc_array, | 469 | struct gpio_desc **desc_array, |
| @@ -471,41 +471,41 @@ static inline int gpiod_set_raw_array_value_cansleep(unsigned int array_size, · 1 unmodified line | |||
| 471 | unsigned long *value_bitmap) | 471 | unsigned long *value_bitmap) |
| 472 | { | 472 | { |
| 473 | /* GPIO can never have been requested */ | 473 | /* GPIO can never have been requested */ |
| 474 | WARN_ON(1); | 474 | WARN_ON(desc_array); |
| 475 | return 0; | 475 | return 0; |
| 476 | } | 476 | } |
| 477 | 477 | ||
| 478 | static inline int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce) | 478 | static inline int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce) |
| 479 | { | 479 | { |
| 480 | /* GPIO can never have been requested */ | 480 | /* GPIO can never have been requested */ |
| 481 | WARN_ON(1); | 481 | WARN_ON(desc); |
| 482 | return -ENOSYS; | 482 | return -ENOSYS; |
| 483 | } | 483 | } |
| 484 | 484 | ||
| 485 | static inline int gpiod_set_transitory(struct gpio_desc *desc, bool transitory) | 485 | static inline int gpiod_set_transitory(struct gpio_desc *desc, bool transitory) |
| 486 | { | 486 | { |
| 487 | /* GPIO can never have been requested */ | 487 | /* GPIO can never have been requested */ |
| 488 | WARN_ON(1); | 488 | WARN_ON(desc); |
| 489 | return -ENOSYS; | 489 | return -ENOSYS; |
| 490 | } | 490 | } |
| 491 | 491 | ||
| 492 | static inline int gpiod_is_active_low(const struct gpio_desc *desc) | 492 | static inline int gpiod_is_active_low(const struct gpio_desc *desc) |
| 493 | { | 493 | { |
| 494 | /* GPIO can never have been requested */ | 494 | /* GPIO can never have been requested */ |
| 495 | WARN_ON(1); | 495 | WARN_ON(desc); |
| 496 | return 0; | 496 | return 0; |
| 497 | } | 497 | } |
| 498 | static inline int gpiod_cansleep(const struct gpio_desc *desc) | 498 | static inline int gpiod_cansleep(const struct gpio_desc *desc) |
| 499 | { | 499 | { |
| 500 | /* GPIO can never have been requested */ | 500 | /* GPIO can never have been requested */ |
| 501 | WARN_ON(1); | 501 | WARN_ON(desc); |
| 502 | return 0; | 502 | return 0; |
| 503 | } | 503 | } |
| 504 | 504 | ||
| 505 | static inline int gpiod_to_irq(const struct gpio_desc *desc) | 505 | static inline int gpiod_to_irq(const struct gpio_desc *desc) |
| 506 | { | 506 | { |
| 507 | /* GPIO can never have been requested */ | 507 | /* GPIO can never have been requested */ |
| 508 | WARN_ON(1); | 508 | WARN_ON(desc); |
| 509 | return -EINVAL; | 509 | return -EINVAL; |
| 510 | } | 510 | } |
| 511 | 511 | ||
| @@ -513,7 +513,7 @@ static inline int gpiod_set_consumer_name(struct gpio_desc *desc, · 1 unmodified line | |||
| 513 | const char *name) | 513 | const char *name) |
| 514 | { | 514 | { |
| 515 | /* GPIO can never have been requested */ | 515 | /* GPIO can never have been requested */ |
| 516 | WARN_ON(1); | 516 | WARN_ON(desc); |
| 517 | return -EINVAL; | 517 | return -EINVAL; |
| 518 | } | 518 | } |
| 519 | 519 | ||
| @@ -525,7 +525,7 @@ static inline struct gpio_desc *gpio_to_desc(unsigned gpio) · 5 unmodified lines | |||
| 525 | static inline int desc_to_gpio(const struct gpio_desc *desc) | 525 | static inline int desc_to_gpio(const struct gpio_desc *desc) |
| 526 | { | 526 | { |
| 527 | /* GPIO can never have been requested */ | 527 | /* GPIO can never have been requested */ |
| 528 | WARN_ON(1); | 528 | WARN_ON(desc); |
| 529 | return -EINVAL; | 529 | return -EINVAL; |
| 530 | } | 530 | } |
| 531 | 531 | ||
| @@ -18,6 +18,7 @@ struct seq_file; · 17 unmodified lines | |||
| 18 | struct gpio_device; | 18 | struct gpio_device; |
| 19 | struct module; | 19 | struct module; |
| 20 | enum gpiod_flags; | 20 | enum gpiod_flags; |
| 21 | enum gpio_lookup_flags; | ||
| 21 | 22 | ||
| 22 | #ifdef CONFIG_GPIOLIB | 23 | #ifdef CONFIG_GPIOLIB |
| 23 | 24 | ||
| @@ -101,13 +102,6 @@ struct gpio_irq_chip { · 77 unmodified lines | |||
| 101 | */ | 102 | */ |
| 102 | unsigned int num_parents; | 103 | unsigned int num_parents; |
| 103 | 104 | ||
| 104 | /** | ||
| 105 | * @parent_irq: | ||
| 106 | * | ||
| 107 | * For use by gpiochip_set_cascaded_irqchip() | ||
| 108 | */ | ||
| 109 | unsigned int parent_irq; | ||
| 110 | |||
| 111 | /** | 105 | /** |
| 112 | * @parents: | 106 | * @parents: |
| 113 | * | 107 | * |
| @@ -167,7 +161,7 @@ struct gpio_irq_chip { · 53 unmodified lines | |||
| 167 | */ | 161 | */ |
| 168 | void (*irq_disable)(struct irq_data *data); | 162 | void (*irq_disable)(struct irq_data *data); |
| 169 | }; | 163 | }; |
| 170 | #endif | 164 | #endif /* CONFIG_GPIOLIB_IRQCHIP */ |
| 171 | 165 | ||
| 172 | /** | 166 | /** |
| 173 | * struct gpio_chip - abstract a GPIO controller | 167 | * struct gpio_chip - abstract a GPIO controller |
| @@ -200,6 +194,8 @@ struct gpio_irq_chip { · 26 unmodified lines | |||
| 200 | * @dbg_show: optional routine to show contents in debugfs; default code | 194 | * @dbg_show: optional routine to show contents in debugfs; default code |
| 201 | * will be used when this is omitted, but custom code can show extra | 195 | * will be used when this is omitted, but custom code can show extra |
| 202 | * state (such as pullup/pulldown configuration). | 196 | * state (such as pullup/pulldown configuration). |
| 197 | * @init_valid_mask: optional routine to initialize @valid_mask, to be used if | ||
| 198 | * not all GPIOs are valid. | ||
| 203 | * @base: identifies the first GPIO number handled by this chip; | 199 | * @base: identifies the first GPIO number handled by this chip; |
| 204 | * or, if negative during registration, requests dynamic ID allocation. | 200 | * or, if negative during registration, requests dynamic ID allocation. |
| 205 | * DEPRECATION: providing anything non-negative and nailing the base | 201 | * DEPRECATION: providing anything non-negative and nailing the base |
| @@ -307,7 +303,7 @@ struct gpio_chip { · 101 unmodified lines | |||
| 307 | spinlock_t bgpio_lock; | 303 | spinlock_t bgpio_lock; |
| 308 | unsigned long bgpio_data; | 304 | unsigned long bgpio_data; |
| 309 | unsigned long bgpio_dir; | 305 | unsigned long bgpio_dir; |
| 310 | #endif | 306 | #endif /* CONFIG_GPIO_GENERIC */ |
| 311 | 307 | ||
| 312 | #ifdef CONFIG_GPIOLIB_IRQCHIP | 308 | #ifdef CONFIG_GPIOLIB_IRQCHIP |
| 313 | /* | 309 | /* |
| @@ -322,7 +318,7 @@ struct gpio_chip { · 8 unmodified lines | |||
| 322 | * used to handle IRQs for most practical cases. | 318 | * used to handle IRQs for most practical cases. |
| 323 | */ | 319 | */ |
| 324 | struct gpio_irq_chip irq; | 320 | struct gpio_irq_chip irq; |
| 325 | #endif | 321 | #endif /* CONFIG_GPIOLIB_IRQCHIP */ |
| 326 | 322 | ||
| 327 | /** | 323 | /** |
| 328 | * @need_valid_mask: | 324 | * @need_valid_mask: |
| @@ -369,7 +365,7 @@ struct gpio_chip { · 40 unmodified lines | |||
| 369 | */ | 365 | */ |
| 370 | int (*of_xlate)(struct gpio_chip *gc, | 366 | int (*of_xlate)(struct gpio_chip *gc, |
| 371 | const struct of_phandle_args *gpiospec, u32 *flags); | 367 | const struct of_phandle_args *gpiospec, u32 *flags); |
| 372 | #endif | 368 | #endif /* CONFIG_OF_GPIO */ |
| 373 | }; | 369 | }; |
| 374 | 370 | ||
| 375 | extern const char *gpiochip_is_requested(struct gpio_chip *chip, | 371 | extern const char *gpiochip_is_requested(struct gpio_chip *chip, |
| @@ -412,7 +408,7 @@ extern int gpiochip_add_data_with_key(struct gpio_chip *chip, void *data, · 36 unmodified lines | |||
| 412 | }) | 408 | }) |
| 413 | #else | 409 | #else |
| 414 | #define gpiochip_add_data(chip, data) gpiochip_add_data_with_key(chip, data, NULL, NULL) | 410 | #define gpiochip_add_data(chip, data) gpiochip_add_data_with_key(chip, data, NULL, NULL) |
| 415 | #endif | 411 | #endif /* CONFIG_LOCKDEP */ |
| 416 | 412 | ||
| 417 | static inline int gpiochip_add(struct gpio_chip *chip) | 413 | static inline int gpiochip_add(struct gpio_chip *chip) |
| 418 | { | 414 | { |
| @@ -467,7 +463,7 @@ int bgpio_init(struct gpio_chip *gc, struct device *dev, · 48 unmodified lines | |||
| 467 | #define BGPIOF_READ_OUTPUT_REG_SET BIT(4) /* reg_set stores output value */ | 463 | #define BGPIOF_READ_OUTPUT_REG_SET BIT(4) /* reg_set stores output value */ |
| 468 | #define BGPIOF_NO_OUTPUT BIT(5) /* only input */ | 464 | #define BGPIOF_NO_OUTPUT BIT(5) /* only input */ |
| 469 | 465 | ||
| 470 | #endif | 466 | #endif /* CONFIG_GPIO_GENERIC */ |
| 471 | 467 | ||
| 472 | #ifdef CONFIG_GPIOLIB_IRQCHIP | 468 | #ifdef CONFIG_GPIOLIB_IRQCHIP |
| 473 | 469 | ||
| @@ -537,7 +533,7 @@ static inline int gpiochip_irqchip_add_nested(struct gpio_chip *gpiochip, · 63 unmodified lines | |||
| 537 | handler, type, true, | 533 | handler, type, true, |
| 538 | &lock_key, &request_key); | 534 | &lock_key, &request_key); |
| 539 | } | 535 | } |
| 540 | #else | 536 | #else /* ! CONFIG_LOCKDEP */ |
| 541 | static inline int gpiochip_irqchip_add(struct gpio_chip *gpiochip, | 537 | static inline int gpiochip_irqchip_add(struct gpio_chip *gpiochip, |
| 542 | struct irq_chip *irqchip, | 538 | struct irq_chip *irqchip, |
| 543 | unsigned int first_irq, | 539 | unsigned int first_irq, |
| @@ -588,7 +584,9 @@ int gpiochip_add_pingroup_range(struct gpio_chip *chip, · 44 unmodified lines | |||
| 588 | unsigned int gpio_offset, const char *pin_group); | 584 | unsigned int gpio_offset, const char *pin_group); |
| 589 | void gpiochip_remove_pin_ranges(struct gpio_chip *chip); | 585 | void gpiochip_remove_pin_ranges(struct gpio_chip *chip); |
| 590 | 586 | ||
| 591 | #else | 587 | #else /* ! CONFIG_PINCTRL */ |
| 588 | |||
| 589 | struct pinctrl_dev; | ||
| 592 | 590 | ||
| 593 | static inline int | 591 | static inline int |
| 594 | gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name, | 592 | gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name, |
| @@ -614,7 +612,8 @@ gpiochip_remove_pin_ranges(struct gpio_chip *chip) · 19 unmodified lines | |||
| 614 | 612 | ||
| 615 | struct gpio_desc *gpiochip_request_own_desc(struct gpio_chip *chip, u16 hwnum, | 613 | struct gpio_desc *gpiochip_request_own_desc(struct gpio_chip *chip, u16 hwnum, |
| 616 | const char *label, | 614 | const char *label, |
| 617 | enum gpiod_flags flags); | 615 | enum gpio_lookup_flags lflags, |
| 616 | enum gpiod_flags dflags); | ||
| 618 | void gpiochip_free_own_desc(struct gpio_desc *desc); | 617 | void gpiochip_free_own_desc(struct gpio_desc *desc); |
| 619 | 618 | ||
| 620 | void devprop_gpiochip_set_names(struct gpio_chip *chip, | 619 | void devprop_gpiochip_set_names(struct gpio_chip *chip, |
| @@ -11,4 +11,4 @@ struct gpio_chip *gpio_reg_init(struct device *dev, void __iomem *reg, · 10 unmodified lines | |||
| 11 | 11 | ||
| 12 | int gpio_reg_resume(struct gpio_chip *gc); | 12 | int gpio_reg_resume(struct gpio_chip *gc); |
| 13 | 13 | ||
| 14 | #endif | 14 | #endif /* GPIO_REG_H */ |
| @@ -97,7 +97,7 @@ void gpiod_add_lookup_table(struct gpiod_lookup_table *table); · 96 unmodified lines | |||
| 97 | void gpiod_add_lookup_tables(struct gpiod_lookup_table **tables, size_t n); | 97 | void gpiod_add_lookup_tables(struct gpiod_lookup_table **tables, size_t n); |
| 98 | void gpiod_remove_lookup_table(struct gpiod_lookup_table *table); | 98 | void gpiod_remove_lookup_table(struct gpiod_lookup_table *table); |
| 99 | void gpiod_add_hogs(struct gpiod_hog *hogs); | 99 | void gpiod_add_hogs(struct gpiod_hog *hogs); |
| 100 | #else | 100 | #else /* ! CONFIG_GPIOLIB */ |
| 101 | static inline | 101 | static inline |
| 102 | void gpiod_add_lookup_table(struct gpiod_lookup_table *table) {} | 102 | void gpiod_add_lookup_table(struct gpiod_lookup_table *table) {} |
| 103 | static inline | 103 | static inline |
| @@ -105,6 +105,6 @@ void gpiod_add_lookup_tables(struct gpiod_lookup_table **tables, size_t n) {} · 1 unmodified line | |||
| 105 | static inline | 105 | static inline |
| 106 | void gpiod_remove_lookup_table(struct gpiod_lookup_table *table) {} | 106 | void gpiod_remove_lookup_table(struct gpiod_lookup_table *table) {} |
| 107 | static inline void gpiod_add_hogs(struct gpiod_hog *hogs) {} | 107 | static inline void gpiod_add_hogs(struct gpiod_hog *hogs) {} |
| 108 | #endif | 108 | #endif /* CONFIG_GPIOLIB */ |
| 109 | 109 | ||
| 110 | #endif /* __LINUX_GPIO_MACHINE_H */ | 110 | #endif /* __LINUX_GPIO_MACHINE_H */ |
| @@ -47,6 +47,7 @@ enum hdmi_infoframe_type { · 46 unmodified lines | |||
| 47 | HDMI_INFOFRAME_TYPE_AVI = 0x82, | 47 | HDMI_INFOFRAME_TYPE_AVI = 0x82, |
| 48 | HDMI_INFOFRAME_TYPE_SPD = 0x83, | 48 | HDMI_INFOFRAME_TYPE_SPD = 0x83, |
| 49 | HDMI_INFOFRAME_TYPE_AUDIO = 0x84, | 49 | HDMI_INFOFRAME_TYPE_AUDIO = 0x84, |
| 50 | HDMI_INFOFRAME_TYPE_DRM = 0x87, | ||
| 50 | }; | 51 | }; |
| 51 | 52 | ||
| 52 | #define HDMI_IEEE_OUI 0x000c03 | 53 | #define HDMI_IEEE_OUI 0x000c03 |
| @@ -55,6 +56,7 @@ enum hdmi_infoframe_type { · 2 unmodified lines | |||
| 55 | #define HDMI_AVI_INFOFRAME_SIZE 13 | 56 | #define HDMI_AVI_INFOFRAME_SIZE 13 |
| 56 | #define HDMI_SPD_INFOFRAME_SIZE 25 | 57 | #define HDMI_SPD_INFOFRAME_SIZE 25 |
| 57 | #define HDMI_AUDIO_INFOFRAME_SIZE 10 | 58 | #define HDMI_AUDIO_INFOFRAME_SIZE 10 |
| 59 | #define HDMI_DRM_INFOFRAME_SIZE 26 | ||
| 58 | 60 | ||
| 59 | #define HDMI_INFOFRAME_SIZE(type) \ | 61 | #define HDMI_INFOFRAME_SIZE(type) \ |
| 60 | (HDMI_INFOFRAME_HEADER_SIZE + HDMI_ ## type ## _INFOFRAME_SIZE) | 62 | (HDMI_INFOFRAME_HEADER_SIZE + HDMI_ ## type ## _INFOFRAME_SIZE) |
| @@ -152,6 +154,17 @@ enum hdmi_content_type { · 91 unmodified lines | |||
| 152 | HDMI_CONTENT_TYPE_GAME, | 154 | HDMI_CONTENT_TYPE_GAME, |
| 153 | }; | 155 | }; |
| 154 | 156 | ||
| 157 | enum hdmi_metadata_type { | ||
| 158 | HDMI_STATIC_METADATA_TYPE1 = 1, | ||
| 159 | }; | ||
| 160 | |||
| 161 | enum hdmi_eotf { | ||
| 162 | HDMI_EOTF_TRADITIONAL_GAMMA_SDR, | ||
| 163 | HDMI_EOTF_TRADITIONAL_GAMMA_HDR, | ||
| 164 | HDMI_EOTF_SMPTE_ST2084, | ||
| 165 | HDMI_EOTF_BT_2100_HLG, | ||
| 166 | }; | ||
| 167 | |||
| 155 | struct hdmi_avi_infoframe { | 168 | struct hdmi_avi_infoframe { |
| 156 | enum hdmi_infoframe_type type; | 169 | enum hdmi_infoframe_type type; |
| 157 | unsigned char version; | 170 | unsigned char version; |
| @@ -175,12 +188,37 @@ struct hdmi_avi_infoframe { · 17 unmodified lines | |||
| 175 | unsigned short right_bar; | 188 | unsigned short right_bar; |
| 176 | }; | 189 | }; |
| 177 | 190 | ||
| 191 | /* DRM Infoframe as per CTA 861.G spec */ | ||
| 192 | struct hdmi_drm_infoframe { | ||
| 193 | enum hdmi_infoframe_type type; | ||
| 194 | unsigned char version; | ||
| 195 | unsigned char length; | ||
| 196 | enum hdmi_eotf eotf; | ||
| 197 | enum hdmi_metadata_type metadata_type; | ||
| 198 | struct { | ||
| 199 | u16 x, y; | ||
| 200 | } display_primaries[3]; | ||
| 201 | struct { | ||
| 202 | u16 x, y; | ||
| 203 | } white_point; | ||
| 204 | u16 max_display_mastering_luminance; | ||
| 205 | u16 min_display_mastering_luminance; | ||
| 206 | u16 max_cll; | ||
| 207 | u16 max_fall; | ||
| 208 | }; | ||
| 209 | |||
| 178 | int hdmi_avi_infoframe_init(struct hdmi_avi_infoframe *frame); | 210 | int hdmi_avi_infoframe_init(struct hdmi_avi_infoframe *frame); |
| 179 | ssize_t hdmi_avi_infoframe_pack(struct hdmi_avi_infoframe *frame, void *buffer, | 211 | ssize_t hdmi_avi_infoframe_pack(struct hdmi_avi_infoframe *frame, void *buffer, |
| 180 | size_t size); | 212 | size_t size); |
| 181 | ssize_t hdmi_avi_infoframe_pack_only(const struct hdmi_avi_infoframe *frame, | 213 | ssize_t hdmi_avi_infoframe_pack_only(const struct hdmi_avi_infoframe *frame, |
| 182 | void *buffer, size_t size); | 214 | void *buffer, size_t size); |
| 183 | int hdmi_avi_infoframe_check(struct hdmi_avi_infoframe *frame); | 215 | int hdmi_avi_infoframe_check(struct hdmi_avi_infoframe *frame); |
| 216 | int hdmi_drm_infoframe_init(struct hdmi_drm_infoframe *frame); | ||
| 217 | ssize_t hdmi_drm_infoframe_pack(struct hdmi_drm_infoframe *frame, void *buffer, | ||
| 218 | size_t size); | ||
| 219 | ssize_t hdmi_drm_infoframe_pack_only(const struct hdmi_drm_infoframe *frame, | ||
| 220 | void *buffer, size_t size); | ||
| 221 | int hdmi_drm_infoframe_check(struct hdmi_drm_infoframe *frame); | ||
| 184 | 222 | ||
| 185 | enum hdmi_spd_sdi { | 223 | enum hdmi_spd_sdi { |
| 186 | HDMI_SPD_SDI_UNKNOWN, | 224 | HDMI_SPD_SDI_UNKNOWN, |
| @@ -320,6 +358,33 @@ struct hdmi_vendor_infoframe { · 133 unmodified lines | |||
| 320 | unsigned int s3d_ext_data; | 358 | unsigned int s3d_ext_data; |
| 321 | }; | 359 | }; |
| 322 | 360 | ||
| 361 | /* HDR Metadata as per 861.G spec */ | ||
| 362 | struct hdr_static_metadata { | ||
| 363 | __u8 eotf; | ||
| 364 | __u8 metadata_type; | ||
| 365 | __u16 max_cll; | ||
| 366 | __u16 max_fall; | ||
| 367 | __u16 min_cll; | ||
| 368 | }; | ||
| 369 | |||
| 370 | /** | ||
| 371 | * struct hdr_sink_metadata - HDR sink metadata | ||
| 372 | * | ||
| 373 | * Metadata Information read from Sink's EDID | ||
| 374 | */ | ||
| 375 | struct hdr_sink_metadata { | ||
| 376 | /** | ||
| 377 | * @metadata_type: Static_Metadata_Descriptor_ID. | ||
| 378 | */ | ||
| 379 | __u32 metadata_type; | ||
| 380 | /** | ||
| 381 | * @hdmi_type1: HDR Metadata Infoframe. | ||
| 382 | */ | ||
| 383 | union { | ||
| 384 | struct hdr_static_metadata hdmi_type1; | ||
| 385 | }; | ||
| 386 | }; | ||
| 387 | |||
| 323 | int hdmi_vendor_infoframe_init(struct hdmi_vendor_infoframe *frame); | 388 | int hdmi_vendor_infoframe_init(struct hdmi_vendor_infoframe *frame); |
| 324 | ssize_t hdmi_vendor_infoframe_pack(struct hdmi_vendor_infoframe *frame, | 389 | ssize_t hdmi_vendor_infoframe_pack(struct hdmi_vendor_infoframe *frame, |
| 325 | void *buffer, size_t size); | 390 | void *buffer, size_t size); |
| @@ -344,6 +409,7 @@ union hdmi_vendor_any_infoframe { · 18 unmodified lines | |||
| 344 | * @spd: spd infoframe | 409 | * @spd: spd infoframe |
| 345 | * @vendor: union of all vendor infoframes | 410 | * @vendor: union of all vendor infoframes |
| 346 | * @audio: audio infoframe | 411 | * @audio: audio infoframe |
| 412 | * @drm: Dynamic Range and Mastering infoframe | ||
| 347 | * | 413 | * |
| 348 | * This is used by the generic pack function. This works since all infoframes | 414 | * This is used by the generic pack function. This works since all infoframes |
| 349 | * have the same header which also indicates which type of infoframe should be | 415 | * have the same header which also indicates which type of infoframe should be |
| @@ -355,6 +421,7 @@ union hdmi_infoframe { · 5 unmodified lines | |||
| 355 | struct hdmi_spd_infoframe spd; | 421 | struct hdmi_spd_infoframe spd; |
| 356 | union hdmi_vendor_any_infoframe vendor; | 422 | union hdmi_vendor_any_infoframe vendor; |
| 357 | struct hdmi_audio_infoframe audio; | 423 | struct hdmi_audio_infoframe audio; |
| 424 | struct hdmi_drm_infoframe drm; | ||
| 358 | }; | 425 | }; |
| 359 | 426 | ||
| 360 | ssize_t hdmi_infoframe_pack(union hdmi_infoframe *frame, void *buffer, | 427 | ssize_t hdmi_infoframe_pack(union hdmi_infoframe *frame, void *buffer, |
| @@ -21,8 +21,8 @@ · 20 unmodified lines | |||
| 21 | * | 21 | * |
| 22 | * HMM address space mirroring API: | 22 | * HMM address space mirroring API: |
| 23 | * | 23 | * |
| 24 | * Use HMM address space mirroring if you want to mirror range of the CPU page | 24 | * Use HMM address space mirroring if you want to mirror a range of the CPU |
| 25 | * table of a process into a device page table. Here, "mirror" means "keep | 25 | * page tables of a process into a device page table. Here, "mirror" means "keep |
| 26 | * synchronized". Prerequisites: the device must provide the ability to write- | 26 | * synchronized". Prerequisites: the device must provide the ability to write- |
| 27 | * protect its page tables (at PAGE_SIZE granularity), and must be able to | 27 | * protect its page tables (at PAGE_SIZE granularity), and must be able to |
| 28 | * recover from the resulting potential page faults. | 28 | * recover from the resulting potential page faults. |
| @@ -62,7 +62,7 @@ · 33 unmodified lines | |||
| 62 | #include <linux/kconfig.h> | 62 | #include <linux/kconfig.h> |
| 63 | #include <asm/pgtable.h> | 63 | #include <asm/pgtable.h> |
| 64 | 64 | ||
| 65 | #if IS_ENABLED(CONFIG_HMM) | 65 | #ifdef CONFIG_HMM_MIRROR |
| 66 | 66 | ||
| 67 | #include <linux/device.h> | 67 | #include <linux/device.h> |
| 68 | #include <linux/migrate.h> | 68 | #include <linux/migrate.h> |
| @@ -82,19 +82,18 @@ · 13 unmodified lines | |||
| 82 | * @mirrors_sem: read/write semaphore protecting the mirrors list | 82 | * @mirrors_sem: read/write semaphore protecting the mirrors list |
| 83 | * @wq: wait queue for user waiting on a range invalidation | 83 | * @wq: wait queue for user waiting on a range invalidation |
| 84 | * @notifiers: count of active mmu notifiers | 84 | * @notifiers: count of active mmu notifiers |
| 85 | * @dead: is the mm dead ? | ||
| 86 | */ | 85 | */ |
| 87 | struct hmm { | 86 | struct hmm { |
| 88 | struct mm_struct *mm; | 87 | struct mm_struct *mm; |
| 89 | struct kref kref; | 88 | struct kref kref; |
| 90 | struct mutex lock; | 89 | spinlock_t ranges_lock; |
| 91 | struct list_head ranges; | 90 | struct list_head ranges; |
| 92 | struct list_head mirrors; | 91 | struct list_head mirrors; |
| 93 | struct mmu_notifier mmu_notifier; | 92 | struct mmu_notifier mmu_notifier; |
| 94 | struct rw_semaphore mirrors_sem; | 93 | struct rw_semaphore mirrors_sem; |
| 95 | wait_queue_head_t wq; | 94 | wait_queue_head_t wq; |
| 95 | struct rcu_head rcu; | ||
| 96 | long notifiers; | 96 | long notifiers; |
| 97 | bool dead; | ||
| 98 | }; | 97 | }; |
| 99 | 98 | ||
| 100 | /* | 99 | /* |
| @@ -105,10 +104,11 @@ struct hmm { · 4 unmodified lines | |||
| 105 | * HMM_PFN_WRITE: CPU page table has write permission set | 104 | * HMM_PFN_WRITE: CPU page table has write permission set |
| 106 | * HMM_PFN_DEVICE_PRIVATE: private device memory (ZONE_DEVICE) | 105 | * HMM_PFN_DEVICE_PRIVATE: private device memory (ZONE_DEVICE) |
| 107 | * | 106 | * |
| 108 | * The driver provide a flags array, if driver valid bit for an entry is bit | 107 | * The driver provides a flags array for mapping page protections to device |
| 109 | * 3 ie (entry & (1 << 3)) is true if entry is valid then driver must provide | 108 | * PTE bits. If the driver valid bit for an entry is bit 3, |
| 109 | * i.e., (entry & (1 << 3)), then the driver must provide | ||
| 110 | * an array in hmm_range.flags with hmm_range.flags[HMM_PFN_VALID] == 1 << 3. | 110 | * an array in hmm_range.flags with hmm_range.flags[HMM_PFN_VALID] == 1 << 3. |
| 111 | * Same logic apply to all flags. This is same idea as vm_page_prot in vma | 111 | * Same logic apply to all flags. This is the same idea as vm_page_prot in vma |
| 112 | * except that this is per device driver rather than per architecture. | 112 | * except that this is per device driver rather than per architecture. |
| 113 | */ | 113 | */ |
| 114 | enum hmm_pfn_flag_e { | 114 | enum hmm_pfn_flag_e { |
| @@ -129,13 +129,13 @@ enum hmm_pfn_flag_e { · 14 unmodified lines | |||
| 129 | * be mirrored by a device, because the entry will never have HMM_PFN_VALID | 129 | * be mirrored by a device, because the entry will never have HMM_PFN_VALID |
| 130 | * set and the pfn value is undefined. | 130 | * set and the pfn value is undefined. |
| 131 | * | 131 | * |
| 132 | * Driver provide entry value for none entry, error entry and special entry, | 132 | * Driver provides values for none entry, error entry, and special entry. |
| 133 | * driver can alias (ie use same value for error and special for instance). It | 133 | * Driver can alias (i.e., use same value) error and special, but |
| 134 | * should not alias none and error or special. | 134 | * it should not alias none with error or special. |
| 135 | * | 135 | * |
| 136 | * HMM pfn value returned by hmm_vma_get_pfns() or hmm_vma_fault() will be: | 136 | * HMM pfn value returned by hmm_vma_get_pfns() or hmm_vma_fault() will be: |
| 137 | * hmm_range.values[HMM_PFN_ERROR] if CPU page table entry is poisonous, | 137 | * hmm_range.values[HMM_PFN_ERROR] if CPU page table entry is poisonous, |
| 138 | * hmm_range.values[HMM_PFN_NONE] if there is no CPU page table | 138 | * hmm_range.values[HMM_PFN_NONE] if there is no CPU page table entry, |
| 139 | * hmm_range.values[HMM_PFN_SPECIAL] if CPU page table entry is a special one | 139 | * hmm_range.values[HMM_PFN_SPECIAL] if CPU page table entry is a special one |
| 140 | */ | 140 | */ |
| 141 | enum hmm_pfn_value_e { | 141 | enum hmm_pfn_value_e { |
| @@ -158,6 +158,7 @@ enum hmm_pfn_value_e { · 16 unmodified lines | |||
| 158 | * @values: pfn value for some special case (none, special, error, ...) | 158 | * @values: pfn value for some special case (none, special, error, ...) |
| 159 | * @default_flags: default flags for the range (write, read, ... see hmm doc) | 159 | * @default_flags: default flags for the range (write, read, ... see hmm doc) |
| 160 | * @pfn_flags_mask: allows to mask pfn flags so that only default_flags matter | 160 | * @pfn_flags_mask: allows to mask pfn flags so that only default_flags matter |
| 161 | * @page_shift: device virtual address shift value (should be >= PAGE_SHIFT) | ||
| 161 | * @pfn_shifts: pfn shift value (should be <= PAGE_SHIFT) | 162 | * @pfn_shifts: pfn shift value (should be <= PAGE_SHIFT) |
| 162 | * @valid: pfns array did not change since it has been fill by an HMM function | 163 | * @valid: pfns array did not change since it has been fill by an HMM function |
| 163 | */ | 164 | */ |
| @@ -180,7 +181,7 @@ struct hmm_range { · 16 unmodified lines | |||
| 180 | /* | 181 | /* |
| 181 | * hmm_range_page_shift() - return the page shift for the range | 182 | * hmm_range_page_shift() - return the page shift for the range |
| 182 | * @range: range being queried | 183 | * @range: range being queried |
| 183 | * Returns: page shift (page size = 1 << page shift) for the range | 184 | * Return: page shift (page size = 1 << page shift) for the range |
| 184 | */ | 185 | */ |
| 185 | static inline unsigned hmm_range_page_shift(const struct hmm_range *range) | 186 | static inline unsigned hmm_range_page_shift(const struct hmm_range *range) |
| 186 | { | 187 | { |
| @@ -190,7 +191,7 @@ static inline unsigned hmm_range_page_shift(const struct hmm_range *range) · 3 unmodified lines | |||
| 190 | /* | 191 | /* |
| 191 | * hmm_range_page_size() - return the page size for the range | 192 | * hmm_range_page_size() - return the page size for the range |
| 192 | * @range: range being queried | 193 | * @range: range being queried |
| 193 | * Returns: page size for the range in bytes | 194 | * Return: page size for the range in bytes |
| 194 | */ | 195 | */ |
| 195 | static inline unsigned long hmm_range_page_size(const struct hmm_range *range) | 196 | static inline unsigned long hmm_range_page_size(const struct hmm_range *range) |
| 196 | { | 197 | { |
| @@ -201,28 +202,19 @@ static inline unsigned long hmm_range_page_size(const struct hmm_range *range) · 4 unmodified lines | |||
| 201 | * hmm_range_wait_until_valid() - wait for range to be valid | 202 | * hmm_range_wait_until_valid() - wait for range to be valid |
| 202 | * @range: range affected by invalidation to wait on | 203 | * @range: range affected by invalidation to wait on |
| 203 | * @timeout: time out for wait in ms (ie abort wait after that period of time) | 204 | * @timeout: time out for wait in ms (ie abort wait after that period of time) |
| 204 | * Returns: true if the range is valid, false otherwise. | 205 | * Return: true if the range is valid, false otherwise. |
| 205 | */ | 206 | */ |
| 206 | static inline bool hmm_range_wait_until_valid(struct hmm_range *range, | 207 | static inline bool hmm_range_wait_until_valid(struct hmm_range *range, |
| 207 | unsigned long timeout) | 208 | unsigned long timeout) |
| 208 | { | 209 | { |
| 209 | /* Check if mm is dead ? */ | 210 | return wait_event_timeout(range->hmm->wq, range->valid, |
| 210 | if (range->hmm == NULL || range->hmm->dead || range->hmm->mm == NULL) { | 211 | msecs_to_jiffies(timeout)) != 0; |
| 211 | range->valid = false; | ||
| 212 | return false; | ||
| 213 | } | ||
| 214 | if (range->valid) | ||
| 215 | return true; | ||
| 216 | wait_event_timeout(range->hmm->wq, range->valid || range->hmm->dead, | ||
| 217 | msecs_to_jiffies(timeout)); | ||
| 218 | /* Return current valid status just in case we get lucky */ | ||
| 219 | return range->valid; | ||
| 220 | } | 212 | } |
| 221 | 213 | ||
| 222 | /* | 214 | /* |
| 223 | * hmm_range_valid() - test if a range is valid or not | 215 | * hmm_range_valid() - test if a range is valid or not |
| 224 | * @range: range | 216 | * @range: range |
| 225 | * Returns: true if the range is valid, false otherwise. | 217 | * Return: true if the range is valid, false otherwise. |
| 226 | */ | 218 | */ |
| 227 | static inline bool hmm_range_valid(struct hmm_range *range) | 219 | static inline bool hmm_range_valid(struct hmm_range *range) |
| 228 | { | 220 | { |
| @@ -233,7 +225,7 @@ static inline bool hmm_range_valid(struct hmm_range *range) · 4 unmodified lines | |||
| 233 | * hmm_device_entry_to_page() - return struct page pointed to by a device entry | 225 | * hmm_device_entry_to_page() - return struct page pointed to by a device entry |
| 234 | * @range: range use to decode device entry value | 226 | * @range: range use to decode device entry value |
| 235 | * @entry: device entry value to get corresponding struct page from | 227 | * @entry: device entry value to get corresponding struct page from |
| 236 | * Returns: struct page pointer if entry is a valid, NULL otherwise | 228 | * Return: struct page pointer if entry is a valid, NULL otherwise |
| 237 | * | 229 | * |
| 238 | * If the device entry is valid (ie valid flag set) then return the struct page | 230 | * If the device entry is valid (ie valid flag set) then return the struct page |
| 239 | * matching the entry value. Otherwise return NULL. | 231 | * matching the entry value. Otherwise return NULL. |
| @@ -256,7 +248,7 @@ static inline struct page *hmm_device_entry_to_page(const struct hmm_range *rang · 16 unmodified lines | |||
| 256 | * hmm_device_entry_to_pfn() - return pfn value store in a device entry | 248 | * hmm_device_entry_to_pfn() - return pfn value store in a device entry |
| 257 | * @range: range use to decode device entry value | 249 | * @range: range use to decode device entry value |
| 258 | * @entry: device entry to extract pfn from | 250 | * @entry: device entry to extract pfn from |
| 259 | * Returns: pfn value if device entry is valid, -1UL otherwise | 251 | * Return: pfn value if device entry is valid, -1UL otherwise |
| 260 | */ | 252 | */ |
| 261 | static inline unsigned long | 253 | static inline unsigned long |
| 262 | hmm_device_entry_to_pfn(const struct hmm_range *range, uint64_t pfn) | 254 | hmm_device_entry_to_pfn(const struct hmm_range *range, uint64_t pfn) |
| @@ -276,7 +268,7 @@ hmm_device_entry_to_pfn(const struct hmm_range *range, uint64_t pfn) · 13 unmodified lines | |||
| 276 | * hmm_device_entry_from_page() - create a valid device entry for a page | 268 | * hmm_device_entry_from_page() - create a valid device entry for a page |
| 277 | * @range: range use to encode HMM pfn value | 269 | * @range: range use to encode HMM pfn value |
| 278 | * @page: page for which to create the device entry | 270 | * @page: page for which to create the device entry |
| 279 | * Returns: valid device entry for the page | 271 | * Return: valid device entry for the page |
| 280 | */ | 272 | */ |
| 281 | static inline uint64_t hmm_device_entry_from_page(const struct hmm_range *range, | 273 | static inline uint64_t hmm_device_entry_from_page(const struct hmm_range *range, |
| 282 | struct page *page) | 274 | struct page *page) |
| @@ -289,7 +281,7 @@ static inline uint64_t hmm_device_entry_from_page(const struct hmm_range *range, · 6 unmodified lines | |||
| 289 | * hmm_device_entry_from_pfn() - create a valid device entry value from pfn | 281 | * hmm_device_entry_from_pfn() - create a valid device entry value from pfn |
| 290 | * @range: range use to encode HMM pfn value | 282 | * @range: range use to encode HMM pfn value |
| 291 | * @pfn: pfn value for which to create the device entry | 283 | * @pfn: pfn value for which to create the device entry |
| 292 | * Returns: valid device entry for the pfn | 284 | * Return: valid device entry for the pfn |
| 293 | */ | 285 | */ |
| 294 | static inline uint64_t hmm_device_entry_from_pfn(const struct hmm_range *range, | 286 | static inline uint64_t hmm_device_entry_from_pfn(const struct hmm_range *range, |
| 295 | unsigned long pfn) | 287 | unsigned long pfn) |
| @@ -332,9 +324,6 @@ static inline uint64_t hmm_pfn_from_pfn(const struct hmm_range *range, · 36 unmodified lines | |||
| 332 | return hmm_device_entry_from_pfn(range, pfn); | 324 | return hmm_device_entry_from_pfn(range, pfn); |
| 333 | } | 325 | } |
| 334 | 326 | ||
| 335 | |||
| 336 | |||
| 337 | #if IS_ENABLED(CONFIG_HMM_MIRROR) | ||
| 338 | /* | 327 | /* |
| 339 | * Mirroring: how to synchronize device page table with CPU page table. | 328 | * Mirroring: how to synchronize device page table with CPU page table. |
| 340 | * | 329 | * |
| @@ -394,7 +383,7 @@ enum hmm_update_event { · 53 unmodified lines | |||
| 394 | }; | 383 | }; |
| 395 | 384 | ||
| 396 | /* | 385 | /* |
| 397 | * struct hmm_update - HMM update informations for callback | 386 | * struct hmm_update - HMM update information for callback |
| 398 | * | 387 | * |
| 399 | * @start: virtual start address of the range to update | 388 | * @start: virtual start address of the range to update |
| 400 | * @end: virtual end address of the range to update | 389 | * @end: virtual end address of the range to update |
| @@ -418,17 +407,18 @@ struct hmm_mirror_ops { · 17 unmodified lines | |||
| 418 | * | 407 | * |
| 419 | * @mirror: pointer to struct hmm_mirror | 408 | * @mirror: pointer to struct hmm_mirror |
| 420 | * | 409 | * |
| 421 | * This is called when the mm_struct is being released. | 410 | * This is called when the mm_struct is being released. The callback |
| 422 | * The callback should make sure no references to the mirror occur | 411 | * must ensure that all access to any pages obtained from this mirror |
| 423 | * after the callback returns. | 412 | * is halted before the callback returns. All future access should |
| 413 | * fault. | ||
| 424 | */ | 414 | */ |
| 425 | void (*release)(struct hmm_mirror *mirror); | 415 | void (*release)(struct hmm_mirror *mirror); |
| 426 | 416 | ||
| 427 | /* sync_cpu_device_pagetables() - synchronize page tables | 417 | /* sync_cpu_device_pagetables() - synchronize page tables |
| 428 | * | 418 | * |
| 429 | * @mirror: pointer to struct hmm_mirror | 419 | * @mirror: pointer to struct hmm_mirror |
| 430 | * @update: update informations (see struct hmm_update) | 420 | * @update: update information (see struct hmm_update) |
| 431 | * Returns: -EAGAIN if update.blockable false and callback need to | 421 | * Return: -EAGAIN if update.blockable false and callback need to |
| 432 | * block, 0 otherwise. | 422 | * block, 0 otherwise. |
| 433 | * | 423 | * |
| 434 | * This callback ultimately originates from mmu_notifiers when the CPU | 424 | * This callback ultimately originates from mmu_notifiers when the CPU |
| @@ -464,36 +454,11 @@ struct hmm_mirror { · 29 unmodified lines | |||
| 464 | int hmm_mirror_register(struct hmm_mirror *mirror, struct mm_struct *mm); | 454 | int hmm_mirror_register(struct hmm_mirror *mirror, struct mm_struct *mm); |
| 465 | void hmm_mirror_unregister(struct hmm_mirror *mirror); | 455 | void hmm_mirror_unregister(struct hmm_mirror *mirror); |
| 466 | 456 | ||
| 467 | /* | ||
| 468 | * hmm_mirror_mm_is_alive() - test if mm is still alive | ||
| 469 | * @mirror: the HMM mm mirror for which we want to lock the mmap_sem | ||
| 470 | * Returns: false if the mm is dead, true otherwise | ||
| 471 | * | ||
| 472 | * This is an optimization it will not accurately always return -EINVAL if the | ||
| 473 | * mm is dead ie there can be false negative (process is being kill but HMM is | ||
| 474 | * not yet inform of that). It is only intented to be use to optimize out case | ||
| 475 | * where driver is about to do something time consuming and it would be better | ||
| 476 | * to skip it if the mm is dead. | ||
| 477 | */ | ||
| 478 | static inline bool hmm_mirror_mm_is_alive(struct hmm_mirror *mirror) | ||
| 479 | { | ||
| 480 | struct mm_struct *mm; | ||
| 481 | |||
| 482 | if (!mirror || !mirror->hmm) | ||
| 483 | return false; | ||
| 484 | mm = READ_ONCE(mirror->hmm->mm); | ||
| 485 | if (mirror->hmm->dead || !mm) | ||
| 486 | return false; | ||
| 487 | |||
| 488 | return true; | ||
| 489 | } | ||
| 490 | |||
| 491 | |||
| 492 | /* | 457 | /* |
| 493 | * Please see Documentation/vm/hmm.rst for how to use the range API. | 458 | * Please see Documentation/vm/hmm.rst for how to use the range API. |
| 494 | */ | 459 | */ |
| 495 | int hmm_range_register(struct hmm_range *range, | 460 | int hmm_range_register(struct hmm_range *range, |
| 496 | struct mm_struct *mm, | 461 | struct hmm_mirror *mirror, |
| 497 | unsigned long start, | 462 | unsigned long start, |
| 498 | unsigned long end, | 463 | unsigned long end, |
| 499 | unsigned page_shift); | 464 | unsigned page_shift); |
| @@ -519,262 +484,13 @@ long hmm_range_dma_unmap(struct hmm_range *range, · 19 unmodified lines | |||
| 519 | */ | 484 | */ |
| 520 | #define HMM_RANGE_DEFAULT_TIMEOUT 1000 | 485 | #define HMM_RANGE_DEFAULT_TIMEOUT 1000 |
| 521 | 486 | ||
| 522 | /* This is a temporary helper to avoid merge conflict between trees. */ | ||
| 523 | static inline bool hmm_vma_range_done(struct hmm_range *range) | ||
| 524 | { | ||
| 525 | bool ret = hmm_range_valid(range); | ||
| 526 | |||
| 527 | hmm_range_unregister(range); | ||
| 528 | return ret; | ||
| 529 | } | ||
| 530 | |||
| 531 | /* This is a temporary helper to avoid merge conflict between trees. */ | ||
| 532 | static inline int hmm_vma_fault(struct hmm_range *range, bool block) | ||
| 533 | { | ||
| 534 | long ret; | ||
| 535 | |||
| 536 | /* | ||
| 537 | * With the old API the driver must set each individual entries with | ||
| 538 | * the requested flags (valid, write, ...). So here we set the mask to | ||
| 539 | * keep intact the entries provided by the driver and zero out the | ||
| 540 | * default_flags. | ||
| 541 | */ | ||
| 542 | range->default_flags = 0; | ||
| 543 | range->pfn_flags_mask = -1UL; | ||
| 544 | |||
| 545 | ret = hmm_range_register(range, range->vma->vm_mm, | ||
| 546 | range->start, range->end, | ||
| 547 | PAGE_SHIFT); | ||
| 548 | if (ret) | ||
| 549 | return (int)ret; | ||
| 550 | |||
| 551 | if (!hmm_range_wait_until_valid(range, HMM_RANGE_DEFAULT_TIMEOUT)) { | ||
| 552 | /* | ||
| 553 | * The mmap_sem was taken by driver we release it here and | ||
| 554 | * returns -EAGAIN which correspond to mmap_sem have been | ||
| 555 | * drop in the old API. | ||
| 556 | */ | ||
| 557 | up_read(&range->vma->vm_mm->mmap_sem); | ||
| 558 | return -EAGAIN; | ||
| 559 | } | ||
| 560 | |||
| 561 | ret = hmm_range_fault(range, block); | ||
| 562 | if (ret <= 0) { | ||
| 563 | if (ret == -EBUSY || !ret) { | ||
| 564 | /* Same as above drop mmap_sem to match old API. */ | ||
| 565 | up_read(&range->vma->vm_mm->mmap_sem); | ||
| 566 | ret = -EBUSY; | ||
| 567 | } else if (ret == -EAGAIN) | ||
| 568 | ret = -EBUSY; | ||
| 569 | hmm_range_unregister(range); | ||
| 570 | return ret; | ||
| 571 | } | ||
| 572 | return 0; | ||
| 573 | } | ||
| 574 | |||
| 575 | /* Below are for HMM internal use only! Not to be used by device driver! */ | 487 | /* Below are for HMM internal use only! Not to be used by device driver! */ |
| 576 | void hmm_mm_destroy(struct mm_struct *mm); | ||
| 577 | |||
| 578 | static inline void hmm_mm_init(struct mm_struct *mm) | 488 | static inline void hmm_mm_init(struct mm_struct *mm) |
| 579 | { | 489 | { |
| 580 | mm->hmm = NULL; | 490 | mm->hmm = NULL; |
| 581 | } | 491 | } |
| 582 | #else /* IS_ENABLED(CONFIG_HMM_MIRROR) */ | 492 | #else /* IS_ENABLED(CONFIG_HMM_MIRROR) */ |
| 583 | static inline void hmm_mm_destroy(struct mm_struct *mm) {} | ||
| 584 | static inline void hmm_mm_init(struct mm_struct *mm) {} | 493 | static inline void hmm_mm_init(struct mm_struct *mm) {} |
| 585 | #endif /* IS_ENABLED(CONFIG_HMM_MIRROR) */ | 494 | #endif /* IS_ENABLED(CONFIG_HMM_MIRROR) */ |
| 586 | 495 | ||
| 587 | #if IS_ENABLED(CONFIG_DEVICE_PRIVATE) || IS_ENABLED(CONFIG_DEVICE_PUBLIC) | ||
| 588 | struct hmm_devmem; | ||
| 589 | |||
| 590 | struct page *hmm_vma_alloc_locked_page(struct vm_area_struct *vma, | ||
| 591 | unsigned long addr); | ||
| 592 | |||
| 593 | /* | ||
| 594 | * struct hmm_devmem_ops - callback for ZONE_DEVICE memory events | ||
| 595 | * | ||
| 596 | * @free: call when refcount on page reach 1 and thus is no longer use | ||
| 597 | * @fault: call when there is a page fault to unaddressable memory | ||
| 598 | * | ||
| 599 | * Both callback happens from page_free() and page_fault() callback of struct | ||
| 600 | * dev_pagemap respectively. See include/linux/memremap.h for more details on | ||
| 601 | * those. | ||
| 602 | * | ||
| 603 | * The hmm_devmem_ops callback are just here to provide a coherent and | ||
| 604 | * uniq API to device driver and device driver should not register their | ||
| 605 | * own page_free() or page_fault() but rely on the hmm_devmem_ops call- | ||
| 606 | * back. | ||
| 607 | */ | ||
| 608 | struct hmm_devmem_ops { | ||
| 609 | /* | ||
| 610 | * free() - free a device page | ||
| 611 | * @devmem: device memory structure (see struct hmm_devmem) | ||
| 612 | * @page: pointer to struct page being freed | ||
| 613 | * | ||
| 614 | * Call back occurs whenever a device page refcount reach 1 which | ||
| 615 | * means that no one is holding any reference on the page anymore | ||
| 616 | * (ZONE_DEVICE page have an elevated refcount of 1 as default so | ||
| 617 | * that they are not release to the general page allocator). | ||
| 618 | * | ||
| 619 | * Note that callback has exclusive ownership of the page (as no | ||
| 620 | * one is holding any reference). | ||
| 621 | */ | ||
| 622 | void (*free)(struct hmm_devmem *devmem, struct page *page); | ||
| 623 | /* | ||
| 624 | * fault() - CPU page fault or get user page (GUP) | ||
| 625 | * @devmem: device memory structure (see struct hmm_devmem) | ||
| 626 | * @vma: virtual memory area containing the virtual address | ||
| 627 | * @addr: virtual address that faulted or for which there is a GUP | ||
| 628 | * @page: pointer to struct page backing virtual address (unreliable) | ||
| 629 | * @flags: FAULT_FLAG_* (see include/linux/mm.h) | ||
| 630 | * @pmdp: page middle directory | ||
| 631 | * Returns: VM_FAULT_MINOR/MAJOR on success or one of VM_FAULT_ERROR | ||
| 632 | * on error | ||
| 633 | * | ||
| 634 | * The callback occurs whenever there is a CPU page fault or GUP on a | ||
| 635 | * virtual address. This means that the device driver must migrate the | ||
| 636 | * page back to regular memory (CPU accessible). | ||
| 637 | * | ||
| 638 | * The device driver is free to migrate more than one page from the | ||
| 639 | * fault() callback as an optimization. However if device decide to | ||
| 640 | * migrate more than one page it must always priotirize the faulting | ||
| 641 | * address over the others. | ||
| 642 | * | ||
| 643 | * The struct page pointer is only given as an hint to allow quick | ||
| 644 | * lookup of internal device driver data. A concurrent migration | ||
| 645 | * might have already free that page and the virtual address might | ||
| 646 | * not longer be back by it. So it should not be modified by the | ||
| 647 | * callback. | ||
| 648 | * | ||
| 649 | * Note that mmap semaphore is held in read mode at least when this | ||
| 650 | * callback occurs, hence the vma is valid upon callback entry. | ||
| 651 | */ | ||
| 652 | vm_fault_t (*fault)(struct hmm_devmem *devmem, | ||
| 653 | struct vm_area_struct *vma, | ||
| 654 | unsigned long addr, | ||
| 655 | const struct page *page, | ||
| 656 | unsigned int flags, | ||
| 657 | pmd_t *pmdp); | ||
| 658 | }; | ||
| 659 | |||
| 660 | /* | ||
| 661 | * struct hmm_devmem - track device memory | ||
| 662 | * | ||
| 663 | * @completion: completion object for device memory | ||
| 664 | * @pfn_first: first pfn for this resource (set by hmm_devmem_add()) | ||
| 665 | * @pfn_last: last pfn for this resource (set by hmm_devmem_add()) | ||
| 666 | * @resource: IO resource reserved for this chunk of memory | ||
| 667 | * @pagemap: device page map for that chunk | ||
| 668 | * @device: device to bind resource to | ||
| 669 | * @ops: memory operations callback | ||
| 670 | * @ref: per CPU refcount | ||
| 671 | * @page_fault: callback when CPU fault on an unaddressable device page | ||
| 672 | * | ||
| 673 | * This an helper structure for device drivers that do not wish to implement | ||
| 674 | * the gory details related to hotplugging new memoy and allocating struct | ||
| 675 | * pages. | ||
| 676 | * | ||
| 677 | * Device drivers can directly use ZONE_DEVICE memory on their own if they | ||
| 678 | * wish to do so. | ||
| 679 | * | ||
| 680 | * The page_fault() callback must migrate page back, from device memory to | ||
| 681 | * system memory, so that the CPU can access it. This might fail for various | ||
| 682 | * reasons (device issues, device have been unplugged, ...). When such error | ||
| 683 | * conditions happen, the page_fault() callback must return VM_FAULT_SIGBUS and | ||
| 684 | * set the CPU page table entry to "poisoned". | ||
| 685 | * | ||
| 686 | * Note that because memory cgroup charges are transferred to the device memory, | ||
| 687 | * this should never fail due to memory restrictions. However, allocation | ||
| 688 | * of a regular system page might still fail because we are out of memory. If | ||
| 689 | * that happens, the page_fault() callback must return VM_FAULT_OOM. | ||
| 690 | * | ||
| 691 | * The page_fault() callback can also try to migrate back multiple pages in one | ||
| 692 | * chunk, as an optimization. It must, however, prioritize the faulting address | ||
| 693 | * over all the others. | ||
| 694 | */ | ||
| 695 | typedef vm_fault_t (*dev_page_fault_t)(struct vm_area_struct *vma, | ||
| 696 | unsigned long addr, | ||
| 697 | const struct page *page, | ||
| 698 | unsigned int flags, | ||
| 699 | pmd_t *pmdp); | ||
| 700 | |||
| 701 | struct hmm_devmem { | ||
| 702 | struct completion completion; | ||
| 703 | unsigned long pfn_first; | ||
| 704 | unsigned long pfn_last; | ||
| 705 | struct resource *resource; | ||
| 706 | struct device *device; | ||
| 707 | struct dev_pagemap pagemap; | ||
| 708 | const struct hmm_devmem_ops *ops; | ||
| 709 | struct percpu_ref ref; | ||
| 710 | dev_page_fault_t page_fault; | ||
| 711 | }; | ||
| 712 | |||
| 713 | /* | ||
| 714 | * To add (hotplug) device memory, HMM assumes that there is no real resource | ||
| 715 | * that reserves a range in the physical address space (this is intended to be | ||
| 716 | * use by unaddressable device memory). It will reserve a physical range big | ||
| 717 | * enough and allocate struct page for it. | ||
| 718 | * | ||
| 719 | * The device driver can wrap the hmm_devmem struct inside a private device | ||
| 720 | * driver struct. | ||
| 721 | */ | ||
| 722 | struct hmm_devmem *hmm_devmem_add(const struct hmm_devmem_ops *ops, | ||
| 723 | struct device *device, | ||
| 724 | unsigned long size); | ||
| 725 | struct hmm_devmem *hmm_devmem_add_resource(const struct hmm_devmem_ops *ops, | ||
| 726 | struct device *device, | ||
| 727 | struct resource *res); | ||
| 728 | |||
| 729 | /* | ||
| 730 | * hmm_devmem_page_set_drvdata - set per-page driver data field | ||
| 731 | * | ||
| 732 | * @page: pointer to struct page | ||
| 733 | * @data: driver data value to set | ||
| 734 | * | ||
| 735 | * Because page can not be on lru we have an unsigned long that driver can use | ||
| 736 | * to store a per page field. This just a simple helper to do that. | ||
| 737 | */ | ||
| 738 | static inline void hmm_devmem_page_set_drvdata(struct page *page, | ||
| 739 | unsigned long data) | ||
| 740 | { | ||
| 741 | page->hmm_data = data; | ||
| 742 | } | ||
| 743 | |||
| 744 | /* | ||
| 745 | * hmm_devmem_page_get_drvdata - get per page driver data field | ||
| 746 | * | ||
| 747 | * @page: pointer to struct page | ||
| 748 | * Return: driver data value | ||
| 749 | */ | ||
| 750 | static inline unsigned long hmm_devmem_page_get_drvdata(const struct page *page) | ||
| 751 | { | ||
| 752 | return page->hmm_data; | ||
| 753 | } | ||
| 754 | |||
| 755 | |||
| 756 | /* | ||
| 757 | * struct hmm_device - fake device to hang device memory onto | ||
| 758 | * | ||
| 759 | * @device: device struct | ||
| 760 | * @minor: device minor number | ||
| 761 | */ | ||
| 762 | struct hmm_device { | ||
| 763 | struct device device; | ||
| 764 | unsigned int minor; | ||
| 765 | }; | ||
| 766 | |||
| 767 | /* | ||
| 768 | * A device driver that wants to handle multiple devices memory through a | ||
| 769 | * single fake device can use hmm_device to do so. This is purely a helper and | ||
| 770 | * it is not strictly needed, in order to make use of any HMM functionality. | ||
| 771 | */ | ||
| 772 | struct hmm_device *hmm_device_new(void *drvdata); | ||
| 773 | void hmm_device_put(struct hmm_device *hmm_device); | ||
| 774 | #endif /* CONFIG_DEVICE_PRIVATE || CONFIG_DEVICE_PUBLIC */ | ||
| 775 | #else /* IS_ENABLED(CONFIG_HMM) */ | ||
| 776 | static inline void hmm_mm_destroy(struct mm_struct *mm) {} | ||
| 777 | static inline void hmm_mm_init(struct mm_struct *mm) {} | ||
| 778 | #endif /* IS_ENABLED(CONFIG_HMM) */ | ||
| 779 | |||
| 780 | #endif /* LINUX_HMM_H */ | 496 | #endif /* LINUX_HMM_H */ |
| @@ -297,6 +297,8 @@ struct host1x_device { · 296 unmodified lines | |||
| 297 | struct list_head clients; | 297 | struct list_head clients; |
| 298 | 298 | ||
| 299 | bool registered; | 299 | bool registered; |
| 300 | |||
| 301 | struct device_dma_parameters dma_parms; | ||
| 300 | }; | 302 | }; |
| 301 | 303 | ||
| 302 | static inline struct host1x_device *to_host1x_device(struct device *dev) | 304 | static inline struct host1x_device *to_host1x_device(struct device *dev) |
| @@ -12,8 +12,8 @@ · 11 unmodified lines | |||
| 12 | #ifndef _LINUX_HRTIMER_H | 12 | #ifndef _LINUX_HRTIMER_H |
| 13 | #define _LINUX_HRTIMER_H | 13 | #define _LINUX_HRTIMER_H |
| 14 | 14 | ||
| 15 | #include <linux/hrtimer_defs.h> | ||
| 15 | #include <linux/rbtree.h> | 16 | #include <linux/rbtree.h> |
| 16 | #include <linux/ktime.h> | ||
| 17 | #include <linux/init.h> | 17 | #include <linux/init.h> |
| 18 | #include <linux/list.h> | 18 | #include <linux/list.h> |
| 19 | #include <linux/percpu.h> | 19 | #include <linux/percpu.h> |
| @@ -298,26 +298,12 @@ struct clock_event_device; · 278 unmodified lines | |||
| 298 | 298 | ||
| 299 | extern void hrtimer_interrupt(struct clock_event_device *dev); | 299 | extern void hrtimer_interrupt(struct clock_event_device *dev); |
| 300 | 300 | ||
| 301 | /* | ||
| 302 | * The resolution of the clocks. The resolution value is returned in | ||
| 303 | * the clock_getres() system call to give application programmers an | ||
| 304 | * idea of the (in)accuracy of timers. Timer values are rounded up to | ||
| 305 | * this resolution values. | ||
| 306 | */ | ||
| 307 | # define HIGH_RES_NSEC 1 | ||
| 308 | # define KTIME_HIGH_RES (HIGH_RES_NSEC) | ||
| 309 | # define MONOTONIC_RES_NSEC HIGH_RES_NSEC | ||
| 310 | # define KTIME_MONOTONIC_RES KTIME_HIGH_RES | ||
| 311 | |||
| 312 | extern void clock_was_set_delayed(void); | 301 | extern void clock_was_set_delayed(void); |
| 313 | 302 | ||
| 314 | extern unsigned int hrtimer_resolution; | 303 | extern unsigned int hrtimer_resolution; |
| 315 | 304 | ||
| 316 | #else | 305 | #else |
| 317 | 306 | ||
| 318 | # define MONOTONIC_RES_NSEC LOW_RES_NSEC | ||
| 319 | # define KTIME_MONOTONIC_RES KTIME_LOW_RES | ||
| 320 | |||
| 321 | #define hrtimer_resolution (unsigned int)LOW_RES_NSEC | 307 | #define hrtimer_resolution (unsigned int)LOW_RES_NSEC |
| 322 | 308 | ||
| 323 | static inline void clock_was_set_delayed(void) { } | 309 | static inline void clock_was_set_delayed(void) { } |
| @@ -0,0 +1,27 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | #ifndef _LINUX_HRTIMER_DEFS_H | ||
| 3 | #define _LINUX_HRTIMER_DEFS_H | ||
| 4 | |||
| 5 | #include <linux/ktime.h> | ||
| 6 | |||
| 7 | #ifdef CONFIG_HIGH_RES_TIMERS | ||
| 8 | |||
| 9 | /* | ||
| 10 | * The resolution of the clocks. The resolution value is returned in | ||
| 11 | * the clock_getres() system call to give application programmers an | ||
| 12 | * idea of the (in)accuracy of timers. Timer values are rounded up to | ||
| 13 | * this resolution values. | ||
| 14 | */ | ||
| 15 | # define HIGH_RES_NSEC 1 | ||
| 16 | # define KTIME_HIGH_RES (HIGH_RES_NSEC) | ||
| 17 | # define MONOTONIC_RES_NSEC HIGH_RES_NSEC | ||
| 18 | # define KTIME_MONOTONIC_RES KTIME_HIGH_RES | ||
| 19 | |||
| 20 | #else | ||
| 21 | |||
| 22 | # define MONOTONIC_RES_NSEC LOW_RES_NSEC | ||
| 23 | # define KTIME_MONOTONIC_RES KTIME_LOW_RES | ||
| 24 | |||
| 25 | #endif | ||
| 26 | |||
| 27 | #endif | ||
| @@ -121,6 +121,23 @@ static inline bool __transparent_hugepage_enabled(struct vm_area_struct *vma) · 120 unmodified lines | |||
| 121 | 121 | ||
| 122 | bool transparent_hugepage_enabled(struct vm_area_struct *vma); | 122 | bool transparent_hugepage_enabled(struct vm_area_struct *vma); |
| 123 | 123 | ||
| 124 | #define HPAGE_CACHE_INDEX_MASK (HPAGE_PMD_NR - 1) | ||
| 125 | |||
| 126 | static inline bool transhuge_vma_suitable(struct vm_area_struct *vma, | ||
| 127 | unsigned long haddr) | ||
| 128 | { | ||
| 129 | /* Don't have to check pgoff for anonymous vma */ | ||
| 130 | if (!vma_is_anonymous(vma)) { | ||
| 131 | if (((vma->vm_start >> PAGE_SHIFT) & HPAGE_CACHE_INDEX_MASK) != | ||
| 132 | (vma->vm_pgoff & HPAGE_CACHE_INDEX_MASK)) | ||
| 133 | return false; | ||
| 134 | } | ||
| 135 | |||
| 136 | if (haddr < vma->vm_start || haddr + HPAGE_PMD_SIZE > vma->vm_end) | ||
| 137 | return false; | ||
| 138 | return true; | ||
| 139 | } | ||
| 140 | |||
| 124 | #define transparent_hugepage_use_zero_page() \ | 141 | #define transparent_hugepage_use_zero_page() \ |
| 125 | (transparent_hugepage_flags & \ | 142 | (transparent_hugepage_flags & \ |
| 126 | (1<<TRANSPARENT_HUGEPAGE_USE_ZERO_PAGE_FLAG)) | 143 | (1<<TRANSPARENT_HUGEPAGE_USE_ZERO_PAGE_FLAG)) |
| @@ -271,6 +288,12 @@ static inline bool transparent_hugepage_enabled(struct vm_area_struct *vma) · 144 unmodified lines | |||
| 271 | return false; | 288 | return false; |
| 272 | } | 289 | } |
| 273 | 290 | ||
| 291 | static inline bool transhuge_vma_suitable(struct vm_area_struct *vma, | ||
| 292 | unsigned long haddr) | ||
| 293 | { | ||
| 294 | return false; | ||
| 295 | } | ||
| 296 | |||
| 274 | static inline void prep_transhuge_page(struct page *page) {} | 297 | static inline void prep_transhuge_page(struct page *page) {} |
| 275 | 298 | ||
| 276 | #define transparent_hugepage_flags 0UL | 299 | #define transparent_hugepage_flags 0UL |
| @@ -16,29 +16,11 @@ struct user_struct; · 15 unmodified lines | |||
| 16 | struct mmu_gather; | 16 | struct mmu_gather; |
| 17 | 17 | ||
| 18 | #ifndef is_hugepd | 18 | #ifndef is_hugepd |
| 19 | /* | ||
| 20 | * Some architectures requires a hugepage directory format that is | ||
| 21 | * required to support multiple hugepage sizes. For example | ||
| 22 | * a4fe3ce76 "powerpc/mm: Allow more flexible layouts for hugepage pagetables" | ||
| 23 | * introduced the same on powerpc. This allows for a more flexible hugepage | ||
| 24 | * pagetable layout. | ||
| 25 | */ | ||
| 26 | typedef struct { unsigned long pd; } hugepd_t; | 19 | typedef struct { unsigned long pd; } hugepd_t; |
| 27 | #define is_hugepd(hugepd) (0) | 20 | #define is_hugepd(hugepd) (0) |
| 28 | #define __hugepd(x) ((hugepd_t) { (x) }) | 21 | #define __hugepd(x) ((hugepd_t) { (x) }) |
| 29 | static inline int gup_huge_pd(hugepd_t hugepd, unsigned long addr, | ||
| 30 | unsigned pdshift, unsigned long end, | ||
| 31 | int write, struct page **pages, int *nr) | ||
| 32 | { | ||
| 33 | return 0; | ||
| 34 | } | ||
| 35 | #else | ||
| 36 | extern int gup_huge_pd(hugepd_t hugepd, unsigned long addr, | ||
| 37 | unsigned pdshift, unsigned long end, | ||
| 38 | int write, struct page **pages, int *nr); | ||
| 39 | #endif | 22 | #endif |
| 40 | 23 | ||
| 41 | |||
| 42 | #ifdef CONFIG_HUGETLB_PAGE | 24 | #ifdef CONFIG_HUGETLB_PAGE |
| 43 | 25 | ||
| 44 | #include <linux/mempolicy.h> | 26 | #include <linux/mempolicy.h> |
| @@ -608,22 +590,92 @@ static inline void huge_ptep_modify_prot_commit(struct vm_area_struct *vma, · 563 unmodified lines | |||
| 608 | 590 | ||
| 609 | #else /* CONFIG_HUGETLB_PAGE */ | 591 | #else /* CONFIG_HUGETLB_PAGE */ |
| 610 | struct hstate {}; | 592 | struct hstate {}; |
| 611 | #define alloc_huge_page(v, a, r) NULL | 593 | |
| 612 | #define alloc_huge_page_node(h, nid) NULL | 594 | static inline struct page *alloc_huge_page(struct vm_area_struct *vma, |
| 613 | #define alloc_huge_page_nodemask(h, preferred_nid, nmask) NULL | 595 | unsigned long addr, |
| 614 | #define alloc_huge_page_vma(h, vma, address) NULL | 596 | int avoid_reserve) |
| 615 | #define alloc_bootmem_huge_page(h) NULL | 597 | { |
| 616 | #define hstate_file(f) NULL | 598 | return NULL; |
| 617 | #define hstate_sizelog(s) NULL | 599 | } |
| 618 | #define hstate_vma(v) NULL | 600 | |
| 619 | #define hstate_inode(i) NULL | 601 | static inline struct page *alloc_huge_page_node(struct hstate *h, int nid) |
| 620 | #define page_hstate(page) NULL | 602 | { |
| 621 | #define huge_page_size(h) PAGE_SIZE | 603 | return NULL; |
| 622 | #define huge_page_mask(h) PAGE_MASK | 604 | } |
| 623 | #define vma_kernel_pagesize(v) PAGE_SIZE | 605 | |
| 624 | #define vma_mmu_pagesize(v) PAGE_SIZE | 606 | static inline struct page * |
| 625 | #define huge_page_order(h) 0 | 607 | alloc_huge_page_nodemask(struct hstate *h, int preferred_nid, nodemask_t *nmask) |
| 626 | #define huge_page_shift(h) PAGE_SHIFT | 608 | { |
| 609 | return NULL; | ||
| 610 | } | ||
| 611 | |||
| 612 | static inline struct page *alloc_huge_page_vma(struct hstate *h, | ||
| 613 | struct vm_area_struct *vma, | ||
| 614 | unsigned long address) | ||
| 615 | { | ||
| 616 | return NULL; | ||
| 617 | } | ||
| 618 | |||
| 619 | static inline int __alloc_bootmem_huge_page(struct hstate *h) | ||
| 620 | { | ||
| 621 | return 0; | ||
| 622 | } | ||
| 623 | |||
| 624 | static inline struct hstate *hstate_file(struct file *f) | ||
| 625 | { | ||
| 626 | return NULL; | ||
| 627 | } | ||
| 628 | |||
| 629 | static inline struct hstate *hstate_sizelog(int page_size_log) | ||
| 630 | { | ||
| 631 | return NULL; | ||
| 632 | } | ||
| 633 | |||
| 634 | static inline struct hstate *hstate_vma(struct vm_area_struct *vma) | ||
| 635 | { | ||
| 636 | return NULL; | ||
| 637 | } | ||
| 638 | |||
| 639 | static inline struct hstate *hstate_inode(struct inode *i) | ||
| 640 | { | ||
| 641 | return NULL; | ||
| 642 | } | ||
| 643 | |||
| 644 | static inline struct hstate *page_hstate(struct page *page) | ||
| 645 | { | ||
| 646 | return NULL; | ||
| 647 | } | ||
| 648 | |||
| 649 | static inline unsigned long huge_page_size(struct hstate *h) | ||
| 650 | { | ||
| 651 | return PAGE_SIZE; | ||
| 652 | } | ||
| 653 | |||
| 654 | static inline unsigned long huge_page_mask(struct hstate *h) | ||
| 655 | { | ||
| 656 | return PAGE_MASK; | ||
| 657 | } | ||
| 658 | |||
| 659 | static inline unsigned long vma_kernel_pagesize(struct vm_area_struct *vma) | ||
| 660 | { | ||
| 661 | return PAGE_SIZE; | ||
| 662 | } | ||
| 663 | |||
| 664 | static inline unsigned long vma_mmu_pagesize(struct vm_area_struct *vma) | ||
| 665 | { | ||
| 666 | return PAGE_SIZE; | ||
| 667 | } | ||
| 668 | |||
| 669 | static inline unsigned int huge_page_order(struct hstate *h) | ||
| 670 | { | ||
| 671 | return 0; | ||
| 672 | } | ||
| 673 | |||
| 674 | static inline unsigned int huge_page_shift(struct hstate *h) | ||
| 675 | { | ||
| 676 | return PAGE_SHIFT; | ||
| 677 | } | ||
| 678 | |||
| 627 | static inline bool hstate_is_gigantic(struct hstate *h) | 679 | static inline bool hstate_is_gigantic(struct hstate *h) |
| 628 | { | 680 | { |
| 629 | return false; | 681 | return false; |
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | Hardware Random Number Generator | 2 | Hardware Random Number Generator |
| 3 | 3 | ||
| 4 | Please read Documentation/hw_random.txt for details on use. | 4 | Please read Documentation/admin-guide/hw_random.rst for details on use. |
| 5 | 5 | ||
| 6 | ---------------------------------------------------------- | 6 | ---------------------------------------------------------- |
| 7 | This software may be used and distributed according to the terms | 7 | This software may be used and distributed according to the terms |
| @@ -14,9 +14,10 @@ · 13 unmodified lines | |||
| 14 | #include <linux/sched.h> | 14 | #include <linux/sched.h> |
| 15 | 15 | ||
| 16 | /* hwspinlock mode argument */ | 16 | /* hwspinlock mode argument */ |
| 17 | #define HWLOCK_IRQSTATE 0x01 /* Disable interrupts, save state */ | 17 | #define HWLOCK_IRQSTATE 0x01 /* Disable interrupts, save state */ |
| 18 | #define HWLOCK_IRQ 0x02 /* Disable interrupts, don't save state */ | 18 | #define HWLOCK_IRQ 0x02 /* Disable interrupts, don't save state */ |
| 19 | #define HWLOCK_RAW 0x03 | 19 | #define HWLOCK_RAW 0x03 |
| 20 | #define HWLOCK_IN_ATOMIC 0x04 /* Called while in atomic context */ | ||
| 20 | 21 | ||
| 21 | struct device; | 22 | struct device; |
| 22 | struct device_node; | 23 | struct device_node; |
| @@ -222,6 +223,23 @@ static inline int hwspin_trylock_raw(struct hwspinlock *hwlock) · 199 unmodified lines | |||
| 222 | return __hwspin_trylock(hwlock, HWLOCK_RAW, NULL); | 223 | return __hwspin_trylock(hwlock, HWLOCK_RAW, NULL); |
| 223 | } | 224 | } |
| 224 | 225 | ||
| 226 | /** | ||
| 227 | * hwspin_trylock_in_atomic() - attempt to lock a specific hwspinlock | ||
| 228 | * @hwlock: an hwspinlock which we want to trylock | ||
| 229 | * | ||
| 230 | * This function attempts to lock an hwspinlock, and will immediately fail | ||
| 231 | * if the hwspinlock is already taken. | ||
| 232 | * | ||
| 233 | * This function shall be called only from an atomic context. | ||
| 234 | * | ||
| 235 | * Returns 0 if we successfully locked the hwspinlock, -EBUSY if | ||
| 236 | * the hwspinlock was already taken, and -EINVAL if @hwlock is invalid. | ||
| 237 | */ | ||
| 238 | static inline int hwspin_trylock_in_atomic(struct hwspinlock *hwlock) | ||
| 239 | { | ||
| 240 | return __hwspin_trylock(hwlock, HWLOCK_IN_ATOMIC, NULL); | ||
| 241 | } | ||
| 242 | |||
| 225 | /** | 243 | /** |
| 226 | * hwspin_trylock() - attempt to lock a specific hwspinlock | 244 | * hwspin_trylock() - attempt to lock a specific hwspinlock |
| 227 | * @hwlock: an hwspinlock which we want to trylock | 245 | * @hwlock: an hwspinlock which we want to trylock |
| @@ -312,6 +330,28 @@ int hwspin_lock_timeout_raw(struct hwspinlock *hwlock, unsigned int to) · 84 unmodified lines | |||
| 312 | return __hwspin_lock_timeout(hwlock, to, HWLOCK_RAW, NULL); | 330 | return __hwspin_lock_timeout(hwlock, to, HWLOCK_RAW, NULL); |
| 313 | } | 331 | } |
| 314 | 332 | ||
| 333 | /** | ||
| 334 | * hwspin_lock_timeout_in_atomic() - lock an hwspinlock with timeout limit | ||
| 335 | * @hwlock: the hwspinlock to be locked | ||
| 336 | * @to: timeout value in msecs | ||
| 337 | * | ||
| 338 | * This function locks the underlying @hwlock. If the @hwlock | ||
| 339 | * is already taken, the function will busy loop waiting for it to | ||
| 340 | * be released, but give up when @timeout msecs have elapsed. | ||
| 341 | * | ||
| 342 | * This function shall be called only from an atomic context and the timeout | ||
| 343 | * value shall not exceed a few msecs. | ||
| 344 | * | ||
| 345 | * Returns 0 when the @hwlock was successfully taken, and an appropriate | ||
| 346 | * error code otherwise (most notably an -ETIMEDOUT if the @hwlock is still | ||
| 347 | * busy after @timeout msecs). The function will never sleep. | ||
| 348 | */ | ||
| 349 | static inline | ||
| 350 | int hwspin_lock_timeout_in_atomic(struct hwspinlock *hwlock, unsigned int to) | ||
| 351 | { | ||
| 352 | return __hwspin_lock_timeout(hwlock, to, HWLOCK_IN_ATOMIC, NULL); | ||
| 353 | } | ||
| 354 | |||
| 315 | /** | 355 | /** |
| 316 | * hwspin_lock_timeout() - lock an hwspinlock with timeout limit | 356 | * hwspin_lock_timeout() - lock an hwspinlock with timeout limit |
| 317 | * @hwlock: the hwspinlock to be locked | 357 | * @hwlock: the hwspinlock to be locked |
| @@ -386,6 +426,21 @@ static inline void hwspin_unlock_raw(struct hwspinlock *hwlock) · 68 unmodified lines | |||
| 386 | __hwspin_unlock(hwlock, HWLOCK_RAW, NULL); | 426 | __hwspin_unlock(hwlock, HWLOCK_RAW, NULL); |
| 387 | } | 427 | } |
| 388 | 428 | ||
| 429 | /** | ||
| 430 | * hwspin_unlock_in_atomic() - unlock hwspinlock | ||
| 431 | * @hwlock: a previously-acquired hwspinlock which we want to unlock | ||
| 432 | * | ||
| 433 | * This function will unlock a specific hwspinlock. | ||
| 434 | * | ||
| 435 | * @hwlock must be already locked (e.g. by hwspin_trylock()) before calling | ||
| 436 | * this function: it is a bug to call unlock on a @hwlock that is already | ||
| 437 | * unlocked. | ||
| 438 | */ | ||
| 439 | static inline void hwspin_unlock_in_atomic(struct hwspinlock *hwlock) | ||
| 440 | { | ||
| 441 | __hwspin_unlock(hwlock, HWLOCK_IN_ATOMIC, NULL); | ||
| 442 | } | ||
| 443 | |||
| 389 | /** | 444 | /** |
| 390 | * hwspin_unlock() - unlock hwspinlock | 445 | * hwspin_unlock() - unlock hwspinlock |
| 391 | * @hwlock: a previously-acquired hwspinlock which we want to unlock | 446 | * @hwlock: a previously-acquired hwspinlock which we want to unlock |
| @@ -1,19 +1,16 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
| 2 | /* ------------------------------------------------------------------------- */ | 2 | /* |
| 3 | /* */ | 3 | * i2c.h - definitions for the Linux i2c bus interface |
| 4 | /* i2c.h - definitions for the i2c-bus interface */ | 4 | * Copyright (C) 1995-2000 Simon G. Vogl |
| 5 | /* */ | 5 | * Copyright (C) 2013-2019 Wolfram Sang <wsa@the-dreams.de> |
| 6 | /* ------------------------------------------------------------------------- */ | 6 | * |
| 7 | /* Copyright (C) 1995-2000 Simon G. Vogl | 7 | * With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and |
| 8 | 8 | * Frodo Looijaard <frodol@dds.nl> | |
| 9 | */ | 9 | */ |
| 10 | /* ------------------------------------------------------------------------- */ | ||
| 11 | |||
| 12 | /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and | ||
| 13 | Frodo Looijaard <frodol@dds.nl> */ | ||
| 14 | #ifndef _LINUX_I2C_H | 10 | #ifndef _LINUX_I2C_H |
| 15 | #define _LINUX_I2C_H | 11 | #define _LINUX_I2C_H |
| 16 | 12 | ||
| 13 | #include <linux/acpi.h> /* for acpi_handle */ | ||
| 17 | #include <linux/mod_devicetable.h> | 14 | #include <linux/mod_devicetable.h> |
| 18 | #include <linux/device.h> /* for struct device */ | 15 | #include <linux/device.h> /* for struct device */ |
| 19 | #include <linux/sched.h> /* for completion */ | 16 | #include <linux/sched.h> /* for completion */ |
| @@ -39,7 +36,8 @@ struct i2c_device_identity; · 19 unmodified lines | |||
| 39 | union i2c_smbus_data; | 36 | union i2c_smbus_data; |
| 40 | struct i2c_board_info; | 37 | struct i2c_board_info; |
| 41 | enum i2c_slave_event; | 38 | enum i2c_slave_event; |
| 42 | typedef int (*i2c_slave_cb_t)(struct i2c_client *, enum i2c_slave_event, u8 *); | 39 | typedef int (*i2c_slave_cb_t)(struct i2c_client *client, |
| 40 | enum i2c_slave_event event, u8 *val); | ||
| 43 | 41 | ||
| 44 | struct module; | 42 | struct module; |
| 45 | struct property_entry; | 43 | struct property_entry; |
| @@ -256,16 +254,16 @@ struct i2c_driver { · 210 unmodified lines | |||
| 256 | unsigned int class; | 254 | unsigned int class; |
| 257 | 255 | ||
| 258 | /* Standard driver model interfaces */ | 256 | /* Standard driver model interfaces */ |
| 259 | int (*probe)(struct i2c_client *, const struct i2c_device_id *); | 257 | int (*probe)(struct i2c_client *client, const struct i2c_device_id *id); |
| 260 | int (*remove)(struct i2c_client *); | 258 | int (*remove)(struct i2c_client *client); |
| 261 | 259 | ||
| 262 | /* New driver model interface to aid the seamless removal of the | 260 | /* New driver model interface to aid the seamless removal of the |
| 263 | * current probe()'s, more commonly unused than used second parameter. | 261 | * current probe()'s, more commonly unused than used second parameter. |
| 264 | */ | 262 | */ |
| 265 | int (*probe_new)(struct i2c_client *); | 263 | int (*probe_new)(struct i2c_client *client); |
| 266 | 264 | ||
| 267 | /* driver model interfaces that don't relate to enumeration */ | 265 | /* driver model interfaces that don't relate to enumeration */ |
| 268 | void (*shutdown)(struct i2c_client *); | 266 | void (*shutdown)(struct i2c_client *client); |
| 269 | 267 | ||
| 270 | /* Alert callback, for example for the SMBus alert protocol. | 268 | /* Alert callback, for example for the SMBus alert protocol. |
| 271 | * The format and meaning of the data value depends on the protocol. | 269 | * The format and meaning of the data value depends on the protocol. |
| @@ -274,7 +272,7 @@ struct i2c_driver { · 2 unmodified lines | |||
| 274 | * For the SMBus Host Notify protocol, the data corresponds to the | 272 | * For the SMBus Host Notify protocol, the data corresponds to the |
| 275 | * 16-bit payload data reported by the slave device acting as master. | 273 | * 16-bit payload data reported by the slave device acting as master. |
| 276 | */ | 274 | */ |
| 277 | void (*alert)(struct i2c_client *, enum i2c_alert_protocol protocol, | 275 | void (*alert)(struct i2c_client *client, enum i2c_alert_protocol protocol, |
| 278 | unsigned int data); | 276 | unsigned int data); |
| 279 | 277 | ||
| 280 | /* a ioctl like command that can be used to perform specific functions | 278 | /* a ioctl like command that can be used to perform specific functions |
| @@ -286,7 +284,7 @@ struct i2c_driver { · 5 unmodified lines | |||
| 286 | const struct i2c_device_id *id_table; | 284 | const struct i2c_device_id *id_table; |
| 287 | 285 | ||
| 288 | /* Device detection callback for automatic device creation */ | 286 | /* Device detection callback for automatic device creation */ |
| 289 | int (*detect)(struct i2c_client *, struct i2c_board_info *); | 287 | int (*detect)(struct i2c_client *client, struct i2c_board_info *info); |
| 290 | const unsigned short *address_list; | 288 | const unsigned short *address_list; |
| 291 | struct list_head clients; | 289 | struct list_head clients; |
| 292 | 290 | ||
| @@ -296,8 +294,7 @@ struct i2c_driver { · 3 unmodified lines | |||
| 296 | 294 | ||
| 297 | /** | 295 | /** |
| 298 | * struct i2c_client - represent an I2C slave device | 296 | * struct i2c_client - represent an I2C slave device |
| 299 | * @flags: I2C_CLIENT_TEN indicates the device uses a ten bit chip address; | 297 | * @flags: see I2C_CLIENT_* for possible flags |
| 300 | * I2C_CLIENT_PEC indicates it uses SMBus Packet Error Checking | ||
| 301 | * @addr: Address used on the I2C bus connected to the parent adapter. | 298 | * @addr: Address used on the I2C bus connected to the parent adapter. |
| 302 | * @name: Indicates the type of the device, usually a chip name that's | 299 | * @name: Indicates the type of the device, usually a chip name that's |
| 303 | * generic enough to hide second-sourcing and compatible revisions. | 300 | * generic enough to hide second-sourcing and compatible revisions. |
| @@ -315,6 +312,15 @@ struct i2c_driver { · 11 unmodified lines | |||
| 315 | */ | 312 | */ |
| 316 | struct i2c_client { | 313 | struct i2c_client { |
| 317 | unsigned short flags; /* div., see below */ | 314 | unsigned short flags; /* div., see below */ |
| 315 | #define I2C_CLIENT_PEC 0x04 /* Use Packet Error Checking */ | ||
| 316 | #define I2C_CLIENT_TEN 0x10 /* we have a ten bit chip address */ | ||
| 317 | /* Must equal I2C_M_TEN below */ | ||
| 318 | #define I2C_CLIENT_SLAVE 0x20 /* we are the slave */ | ||
| 319 | #define I2C_CLIENT_HOST_NOTIFY 0x40 /* We want to use I2C host notify */ | ||
| 320 | #define I2C_CLIENT_WAKE 0x80 /* for board_info; true iff can wake */ | ||
| 321 | #define I2C_CLIENT_SCCB 0x9000 /* Use Omnivision SCCB protocol */ | ||
| 322 | /* Must match I2C_M_STOP|IGNORE_NAK */ | ||
| 323 | |||
| 318 | unsigned short addr; /* chip address - NOTE: 7bit */ | 324 | unsigned short addr; /* chip address - NOTE: 7bit */ |
| 319 | /* addresses are stored in the */ | 325 | /* addresses are stored in the */ |
| 320 | /* _LOWER_ 7 bits */ | 326 | /* _LOWER_ 7 bits */ |
| @@ -436,6 +442,9 @@ struct i2c_board_info { · 115 unmodified lines | |||
| 436 | extern struct i2c_client * | 442 | extern struct i2c_client * |
| 437 | i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info); | 443 | i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info); |
| 438 | 444 | ||
| 445 | extern struct i2c_client * | ||
| 446 | i2c_new_client_device(struct i2c_adapter *adap, struct i2c_board_info const *info); | ||
| 447 | |||
| 439 | /* If you don't know the exact address of an I2C device, use this variant | 448 | /* If you don't know the exact address of an I2C device, use this variant |
| 440 | * instead, which can probe for device presence in a list of possible | 449 | * instead, which can probe for device presence in a list of possible |
| 441 | * addresses. The "probe" callback function is optional. If it is provided, | 450 | * addresses. The "probe" callback function is optional. If it is provided, |
| @@ -446,10 +455,10 @@ extern struct i2c_client * · 4 unmodified lines | |||
| 446 | i2c_new_probed_device(struct i2c_adapter *adap, | 455 | i2c_new_probed_device(struct i2c_adapter *adap, |
| 447 | struct i2c_board_info *info, | 456 | struct i2c_board_info *info, |
| 448 | unsigned short const *addr_list, | 457 | unsigned short const *addr_list, |
| 449 | int (*probe)(struct i2c_adapter *, unsigned short addr)); | 458 | int (*probe)(struct i2c_adapter *adap, unsigned short addr)); |
| 450 | 459 | ||
| 451 | /* Common custom probe functions */ | 460 | /* Common custom probe functions */ |
| 452 | extern int i2c_probe_func_quick_read(struct i2c_adapter *, unsigned short addr); | 461 | extern int i2c_probe_func_quick_read(struct i2c_adapter *adap, unsigned short addr); |
| 453 | 462 | ||
| 454 | /* For devices that use several addresses, use i2c_new_dummy() to make | 463 | /* For devices that use several addresses, use i2c_new_dummy() to make |
| 455 | * client handles for the extra addresses. | 464 | * client handles for the extra addresses. |
| @@ -457,6 +466,9 @@ extern int i2c_probe_func_quick_read(struct i2c_adapter *, unsigned short addr); · 1 unmodified line | |||
| 457 | extern struct i2c_client * | 466 | extern struct i2c_client * |
| 458 | i2c_new_dummy(struct i2c_adapter *adap, u16 address); | 467 | i2c_new_dummy(struct i2c_adapter *adap, u16 address); |
| 459 | 468 | ||
| 469 | extern struct i2c_client * | ||
| 470 | i2c_new_dummy_device(struct i2c_adapter *adapter, u16 address); | ||
| 471 | |||
| 460 | extern struct i2c_client * | 472 | extern struct i2c_client * |
| 461 | devm_i2c_new_dummy_device(struct device *dev, struct i2c_adapter *adap, u16 address); | 473 | devm_i2c_new_dummy_device(struct device *dev, struct i2c_adapter *adap, u16 address); |
| 462 | 474 | ||
| @@ -465,7 +477,7 @@ i2c_new_secondary_device(struct i2c_client *client, · 2 unmodified lines | |||
| 465 | const char *name, | 477 | const char *name, |
| 466 | u16 default_addr); | 478 | u16 default_addr); |
| 467 | 479 | ||
| 468 | extern void i2c_unregister_device(struct i2c_client *); | 480 | extern void i2c_unregister_device(struct i2c_client *client); |
| 469 | #endif /* I2C */ | 481 | #endif /* I2C */ |
| 470 | 482 | ||
| 471 | /* Mainboard arch_initcall() code should register all its I2C devices. | 483 | /* Mainboard arch_initcall() code should register all its I2C devices. |
| @@ -550,9 +562,9 @@ struct i2c_algorithm { · 78 unmodified lines | |||
| 550 | * The main operations are wrapped by i2c_lock_bus and i2c_unlock_bus. | 562 | * The main operations are wrapped by i2c_lock_bus and i2c_unlock_bus. |
| 551 | */ | 563 | */ |
| 552 | struct i2c_lock_operations { | 564 | struct i2c_lock_operations { |
| 553 | void (*lock_bus)(struct i2c_adapter *, unsigned int flags); | 565 | void (*lock_bus)(struct i2c_adapter *adapter, unsigned int flags); |
| 554 | int (*trylock_bus)(struct i2c_adapter *, unsigned int flags); | 566 | int (*trylock_bus)(struct i2c_adapter *adapter, unsigned int flags); |
| 555 | void (*unlock_bus)(struct i2c_adapter *, unsigned int flags); | 567 | void (*unlock_bus)(struct i2c_adapter *adapter, unsigned int flags); |
| 556 | }; | 568 | }; |
| 557 | 569 | ||
| 558 | /** | 570 | /** |
| @@ -702,14 +714,14 @@ struct i2c_adapter { · 143 unmodified lines | |||
| 702 | }; | 714 | }; |
| 703 | #define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev) | 715 | #define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev) |
| 704 | 716 | ||
| 705 | static inline void *i2c_get_adapdata(const struct i2c_adapter *dev) | 717 | static inline void *i2c_get_adapdata(const struct i2c_adapter *adap) |
| 706 | { | 718 | { |
| 707 | return dev_get_drvdata(&dev->dev); | 719 | return dev_get_drvdata(&adap->dev); |
| 708 | } | 720 | } |
| 709 | 721 | ||
| 710 | static inline void i2c_set_adapdata(struct i2c_adapter *dev, void *data) | 722 | static inline void i2c_set_adapdata(struct i2c_adapter *adap, void *data) |
| 711 | { | 723 | { |
| 712 | dev_set_drvdata(&dev->dev, data); | 724 | dev_set_drvdata(&adap->dev, data); |
| 713 | } | 725 | } |
| 714 | 726 | ||
| 715 | static inline struct i2c_adapter * | 727 | static inline struct i2c_adapter * |
| @@ -725,7 +737,7 @@ i2c_parent_is_i2c_adapter(const struct i2c_adapter *adapter) · 9 unmodified lines | |||
| 725 | return NULL; | 737 | return NULL; |
| 726 | } | 738 | } |
| 727 | 739 | ||
| 728 | int i2c_for_each_dev(void *data, int (*fn)(struct device *, void *)); | 740 | int i2c_for_each_dev(void *data, int (*fn)(struct device *dev, void *data)); |
| 729 | 741 | ||
| 730 | /* Adapter locking functions, exported for shared pin cases */ | 742 | /* Adapter locking functions, exported for shared pin cases */ |
| 731 | #define I2C_LOCK_ROOT_ADAPTER BIT(0) | 743 | #define I2C_LOCK_ROOT_ADAPTER BIT(0) |
| @@ -801,16 +813,6 @@ static inline void i2c_mark_adapter_resumed(struct i2c_adapter *adap) · 69 unmodified lines | |||
| 801 | i2c_unlock_bus(adap, I2C_LOCK_ROOT_ADAPTER); | 813 | i2c_unlock_bus(adap, I2C_LOCK_ROOT_ADAPTER); |
| 802 | } | 814 | } |
| 803 | 815 | ||
| 804 | /*flags for the client struct: */ | ||
| 805 | #define I2C_CLIENT_PEC 0x04 /* Use Packet Error Checking */ | ||
| 806 | #define I2C_CLIENT_TEN 0x10 /* we have a ten bit chip address */ | ||
| 807 | /* Must equal I2C_M_TEN below */ | ||
| 808 | #define I2C_CLIENT_SLAVE 0x20 /* we are the slave */ | ||
| 809 | #define I2C_CLIENT_HOST_NOTIFY 0x40 /* We want to use I2C host notify */ | ||
| 810 | #define I2C_CLIENT_WAKE 0x80 /* for board_info; true iff can wake */ | ||
| 811 | #define I2C_CLIENT_SCCB 0x9000 /* Use Omnivision SCCB protocol */ | ||
| 812 | /* Must match I2C_M_STOP|IGNORE_NAK */ | ||
| 813 | |||
| 814 | /* i2c adapter classes (bitmask) */ | 816 | /* i2c adapter classes (bitmask) */ |
| 815 | #define I2C_CLASS_HWMON (1<<0) /* lm_sensors, ... */ | 817 | #define I2C_CLASS_HWMON (1<<0) /* lm_sensors, ... */ |
| 816 | #define I2C_CLASS_DDC (1<<3) /* DDC bus on graphics adapters */ | 818 | #define I2C_CLASS_DDC (1<<3) /* DDC bus on graphics adapters */ |
| @@ -831,12 +833,12 @@ static inline void i2c_mark_adapter_resumed(struct i2c_adapter *adap) · 14 unmodified lines | |||
| 831 | /* administration... | 833 | /* administration... |
| 832 | */ | 834 | */ |
| 833 | #if IS_ENABLED(CONFIG_I2C) | 835 | #if IS_ENABLED(CONFIG_I2C) |
| 834 | extern int i2c_add_adapter(struct i2c_adapter *); | 836 | extern int i2c_add_adapter(struct i2c_adapter *adap); |
| 835 | extern void i2c_del_adapter(struct i2c_adapter *); | 837 | extern void i2c_del_adapter(struct i2c_adapter *adap); |
| 836 | extern int i2c_add_numbered_adapter(struct i2c_adapter *); | 838 | extern int i2c_add_numbered_adapter(struct i2c_adapter *adap); |
| 837 | 839 | ||
| 838 | extern int i2c_register_driver(struct module *, struct i2c_driver *); | 840 | extern int i2c_register_driver(struct module *owner, struct i2c_driver *driver); |
| 839 | extern void i2c_del_driver(struct i2c_driver *); | 841 | extern void i2c_del_driver(struct i2c_driver *driver); |
| 840 | 842 | ||
| 841 | /* use a define to avoid include chaining to get THIS_MODULE */ | 843 | /* use a define to avoid include chaining to get THIS_MODULE */ |
| 842 | #define i2c_add_driver(driver) \ | 844 | #define i2c_add_driver(driver) \ |
| @@ -981,6 +983,7 @@ bool i2c_acpi_get_i2c_resource(struct acpi_resource *ares, · 138 unmodified lines | |||
| 981 | u32 i2c_acpi_find_bus_speed(struct device *dev); | 983 | u32 i2c_acpi_find_bus_speed(struct device *dev); |
| 982 | struct i2c_client *i2c_acpi_new_device(struct device *dev, int index, | 984 | struct i2c_client *i2c_acpi_new_device(struct device *dev, int index, |
| 983 | struct i2c_board_info *info); | 985 | struct i2c_board_info *info); |
| 986 | struct i2c_adapter *i2c_acpi_find_adapter_by_handle(acpi_handle handle); | ||
| 984 | #else | 987 | #else |
| 985 | static inline bool i2c_acpi_get_i2c_resource(struct acpi_resource *ares, | 988 | static inline bool i2c_acpi_get_i2c_resource(struct acpi_resource *ares, |
| 986 | struct acpi_resource_i2c_serialbus **i2c) | 989 | struct acpi_resource_i2c_serialbus **i2c) |
| @@ -996,6 +999,10 @@ static inline struct i2c_client *i2c_acpi_new_device(struct device *dev, · 9 unmodified lines | |||
| 996 | { | 999 | { |
| 997 | return NULL; | 1000 | return NULL; |
| 998 | } | 1001 | } |
| 1002 | static inline struct i2c_adapter *i2c_acpi_find_adapter_by_handle(acpi_handle handle) | ||
| 1003 | { | ||
| 1004 | return NULL; | ||
| 1005 | } | ||
| 999 | #endif /* CONFIG_ACPI */ | 1006 | #endif /* CONFIG_ACPI */ |
| 1000 | 1007 | ||
| 1001 | #endif /* _LINUX_I2C_H */ | 1008 | #endif /* _LINUX_I2C_H */ |
| @@ -48,7 +48,7 @@ struct i3c_i2c_dev_desc { · 47 unmodified lines | |||
| 48 | #define I3C_LVR_I2C_INDEX(x) ((x) << 5) | 48 | #define I3C_LVR_I2C_INDEX(x) ((x) << 5) |
| 49 | #define I3C_LVR_I2C_FM_MODE BIT(4) | 49 | #define I3C_LVR_I2C_FM_MODE BIT(4) |
| 50 | 50 | ||
| 51 | #define I2C_MAX_ADDR GENMASK(9, 0) | 51 | #define I2C_MAX_ADDR GENMASK(6, 0) |
| 52 | 52 | ||
| 53 | /** | 53 | /** |
| 54 | * struct i2c_dev_boardinfo - I2C device board information | 54 | * struct i2c_dev_boardinfo - I2C device board information |
| @@ -250,12 +250,17 @@ struct i3c_device { · 195 unmodified lines | |||
| 250 | * the bus. The only impact in this mode is that the | 250 | * the bus. The only impact in this mode is that the |
| 251 | * high SCL pulse has to stay below 50ns to trick I2C | 251 | * high SCL pulse has to stay below 50ns to trick I2C |
| 252 | * devices when transmitting I3C frames | 252 | * devices when transmitting I3C frames |
| 253 | * @I3C_BUS_MODE_MIXED_LIMITED: I2C devices without 50ns spike filter are | ||
| 254 | * present on the bus. However they allow | ||
| 255 | * compliance up to the maximum SDR SCL clock | ||
| 256 | * frequency. | ||
| 253 | * @I3C_BUS_MODE_MIXED_SLOW: I2C devices without 50ns spike filter are present | 257 | * @I3C_BUS_MODE_MIXED_SLOW: I2C devices without 50ns spike filter are present |
| 254 | * on the bus | 258 | * on the bus |
| 255 | */ | 259 | */ |
| 256 | enum i3c_bus_mode { | 260 | enum i3c_bus_mode { |
| 257 | I3C_BUS_MODE_PURE, | 261 | I3C_BUS_MODE_PURE, |
| 258 | I3C_BUS_MODE_MIXED_FAST, | 262 | I3C_BUS_MODE_MIXED_FAST, |
| 263 | I3C_BUS_MODE_MIXED_LIMITED, | ||
| 259 | I3C_BUS_MODE_MIXED_SLOW, | 264 | I3C_BUS_MODE_MIXED_SLOW, |
| 260 | }; | 265 | }; |
| 261 | 266 | ||
| @@ -390,8 +395,6 @@ struct i3c_bus { · 128 unmodified lines | |||
| 390 | * and i2c_put_dma_safe_msg_buf() helpers provided by the I2C | 395 | * and i2c_put_dma_safe_msg_buf() helpers provided by the I2C |
| 391 | * framework. | 396 | * framework. |
| 392 | * This method is mandatory. | 397 | * This method is mandatory. |
| 393 | * @i2c_funcs: expose the supported I2C functionalities. | ||
| 394 | * This method is mandatory. | ||
| 395 | * @request_ibi: attach an IBI handler to an I3C device. This implies defining | 398 | * @request_ibi: attach an IBI handler to an I3C device. This implies defining |
| 396 | * an IBI handler and the constraints of the IBI (maximum payload | 399 | * an IBI handler and the constraints of the IBI (maximum payload |
| 397 | * length and number of pre-allocated slots). | 400 | * length and number of pre-allocated slots). |
| @@ -437,7 +440,6 @@ struct i3c_master_controller_ops { · 39 unmodified lines | |||
| 437 | void (*detach_i2c_dev)(struct i2c_dev_desc *dev); | 440 | void (*detach_i2c_dev)(struct i2c_dev_desc *dev); |
| 438 | int (*i2c_xfers)(struct i2c_dev_desc *dev, | 441 | int (*i2c_xfers)(struct i2c_dev_desc *dev, |
| 439 | const struct i2c_msg *xfers, int nxfers); | 442 | const struct i2c_msg *xfers, int nxfers); |
| 440 | u32 (*i2c_funcs)(struct i3c_master_controller *master); | ||
| 441 | int (*request_ibi)(struct i3c_dev_desc *dev, | 443 | int (*request_ibi)(struct i3c_dev_desc *dev, |
| 442 | const struct i3c_ibi_setup *req); | 444 | const struct i3c_ibi_setup *req); |
| 443 | void (*free_ibi)(struct i3c_dev_desc *dev); | 445 | void (*free_ibi)(struct i3c_dev_desc *dev); |
| @@ -253,9 +253,9 @@ static inline void ide_std_init_ports(struct ide_hw *hw, · 252 unmodified lines | |||
| 253 | * Special Driver Flags | 253 | * Special Driver Flags |
| 254 | */ | 254 | */ |
| 255 | enum { | 255 | enum { |
| 256 | IDE_SFLAG_SET_GEOMETRY = (1 << 0), | 256 | IDE_SFLAG_SET_GEOMETRY = BIT(0), |
| 257 | IDE_SFLAG_RECALIBRATE = (1 << 1), | 257 | IDE_SFLAG_RECALIBRATE = BIT(1), |
| 258 | IDE_SFLAG_SET_MULTMODE = (1 << 2), | 258 | IDE_SFLAG_SET_MULTMODE = BIT(2), |
| 259 | }; | 259 | }; |
| 260 | 260 | ||
| 261 | /* | 261 | /* |
| @@ -267,13 +267,13 @@ typedef enum { · 5 unmodified lines | |||
| 267 | } ide_startstop_t; | 267 | } ide_startstop_t; |
| 268 | 268 | ||
| 269 | enum { | 269 | enum { |
| 270 | IDE_VALID_ERROR = (1 << 1), | 270 | IDE_VALID_ERROR = BIT(1), |
| 271 | IDE_VALID_FEATURE = IDE_VALID_ERROR, | 271 | IDE_VALID_FEATURE = IDE_VALID_ERROR, |
| 272 | IDE_VALID_NSECT = (1 << 2), | 272 | IDE_VALID_NSECT = BIT(2), |
| 273 | IDE_VALID_LBAL = (1 << 3), | 273 | IDE_VALID_LBAL = BIT(3), |
| 274 | IDE_VALID_LBAM = (1 << 4), | 274 | IDE_VALID_LBAM = BIT(4), |
| 275 | IDE_VALID_LBAH = (1 << 5), | 275 | IDE_VALID_LBAH = BIT(5), |
| 276 | IDE_VALID_DEVICE = (1 << 6), | 276 | IDE_VALID_DEVICE = BIT(6), |
| 277 | IDE_VALID_LBA = IDE_VALID_LBAL | | 277 | IDE_VALID_LBA = IDE_VALID_LBAL | |
| 278 | IDE_VALID_LBAM | | 278 | IDE_VALID_LBAM | |
| 279 | IDE_VALID_LBAH, | 279 | IDE_VALID_LBAH, |
| @@ -289,24 +289,24 @@ enum { · 9 unmodified lines | |||
| 289 | }; | 289 | }; |
| 290 | 290 | ||
| 291 | enum { | 291 | enum { |
| 292 | IDE_TFLAG_LBA48 = (1 << 0), | 292 | IDE_TFLAG_LBA48 = BIT(0), |
| 293 | IDE_TFLAG_WRITE = (1 << 1), | 293 | IDE_TFLAG_WRITE = BIT(1), |
| 294 | IDE_TFLAG_CUSTOM_HANDLER = (1 << 2), | 294 | IDE_TFLAG_CUSTOM_HANDLER = BIT(2), |
| 295 | IDE_TFLAG_DMA_PIO_FALLBACK = (1 << 3), | 295 | IDE_TFLAG_DMA_PIO_FALLBACK = BIT(3), |
| 296 | /* force 16-bit I/O operations */ | 296 | /* force 16-bit I/O operations */ |
| 297 | IDE_TFLAG_IO_16BIT = (1 << 4), | 297 | IDE_TFLAG_IO_16BIT = BIT(4), |
| 298 | /* struct ide_cmd was allocated using kmalloc() */ | 298 | /* struct ide_cmd was allocated using kmalloc() */ |
| 299 | IDE_TFLAG_DYN = (1 << 5), | 299 | IDE_TFLAG_DYN = BIT(5), |
| 300 | IDE_TFLAG_FS = (1 << 6), | 300 | IDE_TFLAG_FS = BIT(6), |
| 301 | IDE_TFLAG_MULTI_PIO = (1 << 7), | 301 | IDE_TFLAG_MULTI_PIO = BIT(7), |
| 302 | IDE_TFLAG_SET_XFER = (1 << 8), | 302 | IDE_TFLAG_SET_XFER = BIT(8), |
| 303 | }; | 303 | }; |
| 304 | 304 | ||
| 305 | enum { | 305 | enum { |
| 306 | IDE_FTFLAG_FLAGGED = (1 << 0), | 306 | IDE_FTFLAG_FLAGGED = BIT(0), |
| 307 | IDE_FTFLAG_SET_IN_FLAGS = (1 << 1), | 307 | IDE_FTFLAG_SET_IN_FLAGS = BIT(1), |
| 308 | IDE_FTFLAG_OUT_DATA = (1 << 2), | 308 | IDE_FTFLAG_OUT_DATA = BIT(2), |
| 309 | IDE_FTFLAG_IN_DATA = (1 << 3), | 309 | IDE_FTFLAG_IN_DATA = BIT(3), |
| 310 | }; | 310 | }; |
| 311 | 311 | ||
| 312 | struct ide_taskfile { | 312 | struct ide_taskfile { |
| @@ -357,13 +357,13 @@ struct ide_cmd { · 44 unmodified lines | |||
| 357 | /* ATAPI packet command flags */ | 357 | /* ATAPI packet command flags */ |
| 358 | enum { | 358 | enum { |
| 359 | /* set when an error is considered normal - no retry (ide-tape) */ | 359 | /* set when an error is considered normal - no retry (ide-tape) */ |
| 360 | PC_FLAG_ABORT = (1 << 0), | 360 | PC_FLAG_ABORT = BIT(0), |
| 361 | PC_FLAG_SUPPRESS_ERROR = (1 << 1), | 361 | PC_FLAG_SUPPRESS_ERROR = BIT(1), |
| 362 | PC_FLAG_WAIT_FOR_DSC = (1 << 2), | 362 | PC_FLAG_WAIT_FOR_DSC = BIT(2), |
| 363 | PC_FLAG_DMA_OK = (1 << 3), | 363 | PC_FLAG_DMA_OK = BIT(3), |
| 364 | PC_FLAG_DMA_IN_PROGRESS = (1 << 4), | 364 | PC_FLAG_DMA_IN_PROGRESS = BIT(4), |
| 365 | PC_FLAG_DMA_ERROR = (1 << 5), | 365 | PC_FLAG_DMA_ERROR = BIT(5), |
| 366 | PC_FLAG_WRITING = (1 << 6), | 366 | PC_FLAG_WRITING = BIT(6), |
| 367 | }; | 367 | }; |
| 368 | 368 | ||
| 369 | #define ATAPI_WAIT_PC (60 * HZ) | 369 | #define ATAPI_WAIT_PC (60 * HZ) |
| @@ -417,111 +417,111 @@ struct ide_disk_ops { · 47 unmodified lines | |||
| 417 | 417 | ||
| 418 | /* ATAPI device flags */ | 418 | /* ATAPI device flags */ |
| 419 | enum { | 419 | enum { |
| 420 | IDE_AFLAG_DRQ_INTERRUPT = (1 << 0), | 420 | IDE_AFLAG_DRQ_INTERRUPT = BIT(0), |
| 421 | 421 | ||
| 422 | /* ide-cd */ | 422 | /* ide-cd */ |
| 423 | /* Drive cannot eject the disc. */ | 423 | /* Drive cannot eject the disc. */ |
| 424 | IDE_AFLAG_NO_EJECT = (1 << 1), | 424 | IDE_AFLAG_NO_EJECT = BIT(1), |
| 425 | /* Drive is a pre ATAPI 1.2 drive. */ | 425 | /* Drive is a pre ATAPI 1.2 drive. */ |
| 426 | IDE_AFLAG_PRE_ATAPI12 = (1 << 2), | 426 | IDE_AFLAG_PRE_ATAPI12 = BIT(2), |
| 427 | /* TOC addresses are in BCD. */ | 427 | /* TOC addresses are in BCD. */ |
| 428 | IDE_AFLAG_TOCADDR_AS_BCD = (1 << 3), | 428 | IDE_AFLAG_TOCADDR_AS_BCD = BIT(3), |
| 429 | /* TOC track numbers are in BCD. */ | 429 | /* TOC track numbers are in BCD. */ |
| 430 | IDE_AFLAG_TOCTRACKS_AS_BCD = (1 << 4), | 430 | IDE_AFLAG_TOCTRACKS_AS_BCD = BIT(4), |
| 431 | /* Saved TOC information is current. */ | 431 | /* Saved TOC information is current. */ |
| 432 | IDE_AFLAG_TOC_VALID = (1 << 6), | 432 | IDE_AFLAG_TOC_VALID = BIT(6), |
| 433 | /* We think that the drive door is locked. */ | 433 | /* We think that the drive door is locked. */ |
| 434 | IDE_AFLAG_DOOR_LOCKED = (1 << 7), | 434 | IDE_AFLAG_DOOR_LOCKED = BIT(7), |
| 435 | /* SET_CD_SPEED command is unsupported. */ | 435 | /* SET_CD_SPEED command is unsupported. */ |
| 436 | IDE_AFLAG_NO_SPEED_SELECT = (1 << 8), | 436 | IDE_AFLAG_NO_SPEED_SELECT = BIT(8), |
| 437 | IDE_AFLAG_VERTOS_300_SSD = (1 << 9), | 437 | IDE_AFLAG_VERTOS_300_SSD = BIT(9), |
| 438 | IDE_AFLAG_VERTOS_600_ESD = (1 << 10), | 438 | IDE_AFLAG_VERTOS_600_ESD = BIT(10), |
| 439 | IDE_AFLAG_SANYO_3CD = (1 << 11), | 439 | IDE_AFLAG_SANYO_3CD = BIT(11), |
| 440 | IDE_AFLAG_FULL_CAPS_PAGE = (1 << 12), | 440 | IDE_AFLAG_FULL_CAPS_PAGE = BIT(12), |
| 441 | IDE_AFLAG_PLAY_AUDIO_OK = (1 << 13), | 441 | IDE_AFLAG_PLAY_AUDIO_OK = BIT(13), |
| 442 | IDE_AFLAG_LE_SPEED_FIELDS = (1 << 14), | 442 | IDE_AFLAG_LE_SPEED_FIELDS = BIT(14), |
| 443 | 443 | ||
| 444 | /* ide-floppy */ | 444 | /* ide-floppy */ |
| 445 | /* Avoid commands not supported in Clik drive */ | 445 | /* Avoid commands not supported in Clik drive */ |
| 446 | IDE_AFLAG_CLIK_DRIVE = (1 << 15), | 446 | IDE_AFLAG_CLIK_DRIVE = BIT(15), |
| 447 | /* Requires BH algorithm for packets */ | 447 | /* Requires BH algorithm for packets */ |
| 448 | IDE_AFLAG_ZIP_DRIVE = (1 << 16), | 448 | IDE_AFLAG_ZIP_DRIVE = BIT(16), |
| 449 | /* Supports format progress report */ | 449 | /* Supports format progress report */ |
| 450 | IDE_AFLAG_SRFP = (1 << 17), | 450 | IDE_AFLAG_SRFP = BIT(17), |
| 451 | 451 | ||
| 452 | /* ide-tape */ | 452 | /* ide-tape */ |
| 453 | IDE_AFLAG_IGNORE_DSC = (1 << 18), | 453 | IDE_AFLAG_IGNORE_DSC = BIT(18), |
| 454 | /* 0 When the tape position is unknown */ | 454 | /* 0 When the tape position is unknown */ |
| 455 | IDE_AFLAG_ADDRESS_VALID = (1 << 19), | 455 | IDE_AFLAG_ADDRESS_VALID = BIT(19), |
| 456 | /* Device already opened */ | 456 | /* Device already opened */ |
| 457 | IDE_AFLAG_BUSY = (1 << 20), | 457 | IDE_AFLAG_BUSY = BIT(20), |
| 458 | /* Attempt to auto-detect the current user block size */ | 458 | /* Attempt to auto-detect the current user block size */ |
| 459 | IDE_AFLAG_DETECT_BS = (1 << 21), | 459 | IDE_AFLAG_DETECT_BS = BIT(21), |
| 460 | /* Currently on a filemark */ | 460 | /* Currently on a filemark */ |
| 461 | IDE_AFLAG_FILEMARK = (1 << 22), | 461 | IDE_AFLAG_FILEMARK = BIT(22), |
| 462 | /* 0 = no tape is loaded, so we don't rewind after ejecting */ | 462 | /* 0 = no tape is loaded, so we don't rewind after ejecting */ |
| 463 | IDE_AFLAG_MEDIUM_PRESENT = (1 << 23), | 463 | IDE_AFLAG_MEDIUM_PRESENT = BIT(23), |
| 464 | 464 | ||
| 465 | IDE_AFLAG_NO_AUTOCLOSE = (1 << 24), | 465 | IDE_AFLAG_NO_AUTOCLOSE = BIT(24), |
| 466 | }; | 466 | }; |
| 467 | 467 | ||
| 468 | /* device flags */ | 468 | /* device flags */ |
| 469 | enum { | 469 | enum { |
| 470 | /* restore settings after device reset */ | 470 | /* restore settings after device reset */ |
| 471 | IDE_DFLAG_KEEP_SETTINGS = (1 << 0), | 471 | IDE_DFLAG_KEEP_SETTINGS = BIT(0), |
| 472 | /* device is using DMA for read/write */ | 472 | /* device is using DMA for read/write */ |
| 473 | IDE_DFLAG_USING_DMA = (1 << 1), | 473 | IDE_DFLAG_USING_DMA = BIT(1), |
| 474 | /* okay to unmask other IRQs */ | 474 | /* okay to unmask other IRQs */ |
| 475 | IDE_DFLAG_UNMASK = (1 << 2), | 475 | IDE_DFLAG_UNMASK = BIT(2), |
| 476 | /* don't attempt flushes */ | 476 | /* don't attempt flushes */ |
| 477 | IDE_DFLAG_NOFLUSH = (1 << 3), | 477 | IDE_DFLAG_NOFLUSH = BIT(3), |
| 478 | /* DSC overlap */ | 478 | /* DSC overlap */ |
| 479 | IDE_DFLAG_DSC_OVERLAP = (1 << 4), | 479 | IDE_DFLAG_DSC_OVERLAP = BIT(4), |
| 480 | /* give potential excess bandwidth */ | 480 | /* give potential excess bandwidth */ |
| 481 | IDE_DFLAG_NICE1 = (1 << 5), | 481 | IDE_DFLAG_NICE1 = BIT(5), |
| 482 | /* device is physically present */ | 482 | /* device is physically present */ |
| 483 | IDE_DFLAG_PRESENT = (1 << 6), | 483 | IDE_DFLAG_PRESENT = BIT(6), |
| 484 | /* disable Host Protected Area */ | 484 | /* disable Host Protected Area */ |
| 485 | IDE_DFLAG_NOHPA = (1 << 7), | 485 | IDE_DFLAG_NOHPA = BIT(7), |
| 486 | /* id read from device (synthetic if not set) */ | 486 | /* id read from device (synthetic if not set) */ |
| 487 | IDE_DFLAG_ID_READ = (1 << 8), | 487 | IDE_DFLAG_ID_READ = BIT(8), |
| 488 | IDE_DFLAG_NOPROBE = (1 << 9), | 488 | IDE_DFLAG_NOPROBE = BIT(9), |
| 489 | /* need to do check_media_change() */ | 489 | /* need to do check_media_change() */ |
| 490 | IDE_DFLAG_REMOVABLE = (1 << 10), | 490 | IDE_DFLAG_REMOVABLE = BIT(10), |
| 491 | /* needed for removable devices */ | 491 | /* needed for removable devices */ |
| 492 | IDE_DFLAG_ATTACH = (1 << 11), | 492 | IDE_DFLAG_ATTACH = BIT(11), |
| 493 | IDE_DFLAG_FORCED_GEOM = (1 << 12), | 493 | IDE_DFLAG_FORCED_GEOM = BIT(12), |
| 494 | /* disallow setting unmask bit */ | 494 | /* disallow setting unmask bit */ |
| 495 | IDE_DFLAG_NO_UNMASK = (1 << 13), | 495 | IDE_DFLAG_NO_UNMASK = BIT(13), |
| 496 | /* disallow enabling 32-bit I/O */ | 496 | /* disallow enabling 32-bit I/O */ |
| 497 | IDE_DFLAG_NO_IO_32BIT = (1 << 14), | 497 | IDE_DFLAG_NO_IO_32BIT = BIT(14), |
| 498 | /* for removable only: door lock/unlock works */ | 498 | /* for removable only: door lock/unlock works */ |
| 499 | IDE_DFLAG_DOORLOCKING = (1 << 15), | 499 | IDE_DFLAG_DOORLOCKING = BIT(15), |
| 500 | /* disallow DMA */ | 500 | /* disallow DMA */ |
| 501 | IDE_DFLAG_NODMA = (1 << 16), | 501 | IDE_DFLAG_NODMA = BIT(16), |
| 502 | /* powermanagement told us not to do anything, so sleep nicely */ | 502 | /* powermanagement told us not to do anything, so sleep nicely */ |
| 503 | IDE_DFLAG_BLOCKED = (1 << 17), | 503 | IDE_DFLAG_BLOCKED = BIT(17), |
| 504 | /* sleeping & sleep field valid */ | 504 | /* sleeping & sleep field valid */ |
| 505 | IDE_DFLAG_SLEEPING = (1 << 18), | 505 | IDE_DFLAG_SLEEPING = BIT(18), |
| 506 | IDE_DFLAG_POST_RESET = (1 << 19), | 506 | IDE_DFLAG_POST_RESET = BIT(19), |
| 507 | IDE_DFLAG_UDMA33_WARNED = (1 << 20), | 507 | IDE_DFLAG_UDMA33_WARNED = BIT(20), |
| 508 | IDE_DFLAG_LBA48 = (1 << 21), | 508 | IDE_DFLAG_LBA48 = BIT(21), |
| 509 | /* status of write cache */ | 509 | /* status of write cache */ |
| 510 | IDE_DFLAG_WCACHE = (1 << 22), | 510 | IDE_DFLAG_WCACHE = BIT(22), |
| 511 | /* used for ignoring ATA_DF */ | 511 | /* used for ignoring ATA_DF */ |
| 512 | IDE_DFLAG_NOWERR = (1 << 23), | 512 | IDE_DFLAG_NOWERR = BIT(23), |
| 513 | /* retrying in PIO */ | 513 | /* retrying in PIO */ |
| 514 | IDE_DFLAG_DMA_PIO_RETRY = (1 << 24), | 514 | IDE_DFLAG_DMA_PIO_RETRY = BIT(24), |
| 515 | IDE_DFLAG_LBA = (1 << 25), | 515 | IDE_DFLAG_LBA = BIT(25), |
| 516 | /* don't unload heads */ | 516 | /* don't unload heads */ |
| 517 | IDE_DFLAG_NO_UNLOAD = (1 << 26), | 517 | IDE_DFLAG_NO_UNLOAD = BIT(26), |
| 518 | /* heads unloaded, please don't reset port */ | 518 | /* heads unloaded, please don't reset port */ |
| 519 | IDE_DFLAG_PARKED = (1 << 27), | 519 | IDE_DFLAG_PARKED = BIT(27), |
| 520 | IDE_DFLAG_MEDIA_CHANGED = (1 << 28), | 520 | IDE_DFLAG_MEDIA_CHANGED = BIT(28), |
| 521 | /* write protect */ | 521 | /* write protect */ |
| 522 | IDE_DFLAG_WP = (1 << 29), | 522 | IDE_DFLAG_WP = BIT(29), |
| 523 | IDE_DFLAG_FORMAT_IN_PROGRESS = (1 << 30), | 523 | IDE_DFLAG_FORMAT_IN_PROGRESS = BIT(30), |
| 524 | IDE_DFLAG_NIEN_QUIRK = (1 << 31), | 524 | IDE_DFLAG_NIEN_QUIRK = BIT(31), |
| 525 | }; | 525 | }; |
| 526 | 526 | ||
| 527 | struct ide_drive_s { | 527 | struct ide_drive_s { |
| @@ -709,7 +709,7 @@ struct ide_dma_ops { · 181 unmodified lines | |||
| 709 | }; | 709 | }; |
| 710 | 710 | ||
| 711 | enum { | 711 | enum { |
| 712 | IDE_PFLAG_PROBING = (1 << 0), | 712 | IDE_PFLAG_PROBING = BIT(0), |
| 713 | }; | 713 | }; |
| 714 | 714 | ||
| 715 | struct ide_host; | 715 | struct ide_host; |
| @@ -862,7 +862,7 @@ extern struct mutex ide_setting_mtx; · 146 unmodified lines | |||
| 862 | * configurable drive settings | 862 | * configurable drive settings |
| 863 | */ | 863 | */ |
| 864 | 864 | ||
| 865 | #define DS_SYNC (1 << 0) | 865 | #define DS_SYNC BIT(0) |
| 866 | 866 | ||
| 867 | struct ide_devset { | 867 | struct ide_devset { |
| 868 | int (*get)(ide_drive_t *); | 868 | int (*get)(ide_drive_t *); |
| @@ -1000,15 +1000,15 @@ static inline void ide_proc_unregister_driver(ide_drive_t *drive, · 131 unmodified lines | |||
| 1000 | 1000 | ||
| 1001 | enum { | 1001 | enum { |
| 1002 | /* enter/exit functions */ | 1002 | /* enter/exit functions */ |
| 1003 | IDE_DBG_FUNC = (1 << 0), | 1003 | IDE_DBG_FUNC = BIT(0), |
| 1004 | /* sense key/asc handling */ | 1004 | /* sense key/asc handling */ |
| 1005 | IDE_DBG_SENSE = (1 << 1), | 1005 | IDE_DBG_SENSE = BIT(1), |
| 1006 | /* packet commands handling */ | 1006 | /* packet commands handling */ |
| 1007 | IDE_DBG_PC = (1 << 2), | 1007 | IDE_DBG_PC = BIT(2), |
| 1008 | /* request handling */ | 1008 | /* request handling */ |
| 1009 | IDE_DBG_RQ = (1 << 3), | 1009 | IDE_DBG_RQ = BIT(3), |
| 1010 | /* driver probing/setup */ | 1010 | /* driver probing/setup */ |
| 1011 | IDE_DBG_PROBE = (1 << 4), | 1011 | IDE_DBG_PROBE = BIT(4), |
| 1012 | }; | 1012 | }; |
| 1013 | 1013 | ||
| 1014 | /* DRV_NAME has to be defined in the driver before using the macro below */ | 1014 | /* DRV_NAME has to be defined in the driver before using the macro below */ |
| @@ -1171,10 +1171,10 @@ ssize_t ide_park_store(struct device *dev, struct device_attribute *attr, · 156 unmodified lines | |||
| 1171 | * the tail of our block device request queue and wait for their completion. | 1171 | * the tail of our block device request queue and wait for their completion. |
| 1172 | */ | 1172 | */ |
| 1173 | enum { | 1173 | enum { |
| 1174 | REQ_IDETAPE_PC1 = (1 << 0), /* packet command (first stage) */ | 1174 | REQ_IDETAPE_PC1 = BIT(0), /* packet command (first stage) */ |
| 1175 | REQ_IDETAPE_PC2 = (1 << 1), /* packet command (second stage) */ | 1175 | REQ_IDETAPE_PC2 = BIT(1), /* packet command (second stage) */ |
| 1176 | REQ_IDETAPE_READ = (1 << 2), | 1176 | REQ_IDETAPE_READ = BIT(2), |
| 1177 | REQ_IDETAPE_WRITE = (1 << 3), | 1177 | REQ_IDETAPE_WRITE = BIT(3), |
| 1178 | }; | 1178 | }; |
| 1179 | 1179 | ||
| 1180 | int ide_queue_pc_tail(ide_drive_t *, struct gendisk *, struct ide_atapi_pc *, | 1180 | int ide_queue_pc_tail(ide_drive_t *, struct gendisk *, struct ide_atapi_pc *, |
| @@ -1264,71 +1264,71 @@ struct ide_pci_enablebit { · 83 unmodified lines | |||
| 1264 | 1264 | ||
| 1265 | enum { | 1265 | enum { |
| 1266 | /* Uses ISA control ports not PCI ones. */ | 1266 | /* Uses ISA control ports not PCI ones. */ |
| 1267 | IDE_HFLAG_ISA_PORTS = (1 << 0), | 1267 | IDE_HFLAG_ISA_PORTS = BIT(0), |
| 1268 | /* single port device */ | 1268 | /* single port device */ |
| 1269 | IDE_HFLAG_SINGLE = (1 << 1), | 1269 | IDE_HFLAG_SINGLE = BIT(1), |
| 1270 | /* don't use legacy PIO blacklist */ | 1270 | /* don't use legacy PIO blacklist */ |
| 1271 | IDE_HFLAG_PIO_NO_BLACKLIST = (1 << 2), | 1271 | IDE_HFLAG_PIO_NO_BLACKLIST = BIT(2), |
| 1272 | /* set for the second port of QD65xx */ | 1272 | /* set for the second port of QD65xx */ |
| 1273 | IDE_HFLAG_QD_2ND_PORT = (1 << 3), | 1273 | IDE_HFLAG_QD_2ND_PORT = BIT(3), |
| 1274 | /* use PIO8/9 for prefetch off/on */ | 1274 | /* use PIO8/9 for prefetch off/on */ |
| 1275 | IDE_HFLAG_ABUSE_PREFETCH = (1 << 4), | 1275 | IDE_HFLAG_ABUSE_PREFETCH = BIT(4), |
| 1276 | /* use PIO6/7 for fast-devsel off/on */ | 1276 | /* use PIO6/7 for fast-devsel off/on */ |
| 1277 | IDE_HFLAG_ABUSE_FAST_DEVSEL = (1 << 5), | 1277 | IDE_HFLAG_ABUSE_FAST_DEVSEL = BIT(5), |
| 1278 | /* use 100-102 and 200-202 PIO values to set DMA modes */ | 1278 | /* use 100-102 and 200-202 PIO values to set DMA modes */ |
| 1279 | IDE_HFLAG_ABUSE_DMA_MODES = (1 << 6), | 1279 | IDE_HFLAG_ABUSE_DMA_MODES = BIT(6), |
| 1280 | /* | 1280 | /* |
| 1281 | * keep DMA setting when programming PIO mode, may be used only | 1281 | * keep DMA setting when programming PIO mode, may be used only |
| 1282 | * for hosts which have separate PIO and DMA timings (ie. PMAC) | 1282 | * for hosts which have separate PIO and DMA timings (ie. PMAC) |
| 1283 | */ | 1283 | */ |
| 1284 | IDE_HFLAG_SET_PIO_MODE_KEEP_DMA = (1 << 7), | 1284 | IDE_HFLAG_SET_PIO_MODE_KEEP_DMA = BIT(7), |
| 1285 | /* program host for the transfer mode after programming device */ | 1285 | /* program host for the transfer mode after programming device */ |
| 1286 | IDE_HFLAG_POST_SET_MODE = (1 << 8), | 1286 | IDE_HFLAG_POST_SET_MODE = BIT(8), |
| 1287 | /* don't program host/device for the transfer mode ("smart" hosts) */ | 1287 | /* don't program host/device for the transfer mode ("smart" hosts) */ |
| 1288 | IDE_HFLAG_NO_SET_MODE = (1 << 9), | 1288 | IDE_HFLAG_NO_SET_MODE = BIT(9), |
| 1289 | /* trust BIOS for programming chipset/device for DMA */ | 1289 | /* trust BIOS for programming chipset/device for DMA */ |
| 1290 | IDE_HFLAG_TRUST_BIOS_FOR_DMA = (1 << 10), | 1290 | IDE_HFLAG_TRUST_BIOS_FOR_DMA = BIT(10), |
| 1291 | /* host is CS5510/CS5520 */ | 1291 | /* host is CS5510/CS5520 */ |
| 1292 | IDE_HFLAG_CS5520 = (1 << 11), | 1292 | IDE_HFLAG_CS5520 = BIT(11), |
| 1293 | /* ATAPI DMA is unsupported */ | 1293 | /* ATAPI DMA is unsupported */ |
| 1294 | IDE_HFLAG_NO_ATAPI_DMA = (1 << 12), | 1294 | IDE_HFLAG_NO_ATAPI_DMA = BIT(12), |
| 1295 | /* set if host is a "non-bootable" controller */ | 1295 | /* set if host is a "non-bootable" controller */ |
| 1296 | IDE_HFLAG_NON_BOOTABLE = (1 << 13), | 1296 | IDE_HFLAG_NON_BOOTABLE = BIT(13), |
| 1297 | /* host doesn't support DMA */ | 1297 | /* host doesn't support DMA */ |
| 1298 | IDE_HFLAG_NO_DMA = (1 << 14), | 1298 | IDE_HFLAG_NO_DMA = BIT(14), |
| 1299 | /* check if host is PCI IDE device before allowing DMA */ | 1299 | /* check if host is PCI IDE device before allowing DMA */ |
| 1300 | IDE_HFLAG_NO_AUTODMA = (1 << 15), | 1300 | IDE_HFLAG_NO_AUTODMA = BIT(15), |
| 1301 | /* host uses MMIO */ | 1301 | /* host uses MMIO */ |
| 1302 | IDE_HFLAG_MMIO = (1 << 16), | 1302 | IDE_HFLAG_MMIO = BIT(16), |
| 1303 | /* no LBA48 */ | 1303 | /* no LBA48 */ |
| 1304 | IDE_HFLAG_NO_LBA48 = (1 << 17), | 1304 | IDE_HFLAG_NO_LBA48 = BIT(17), |
| 1305 | /* no LBA48 DMA */ | 1305 | /* no LBA48 DMA */ |
| 1306 | IDE_HFLAG_NO_LBA48_DMA = (1 << 18), | 1306 | IDE_HFLAG_NO_LBA48_DMA = BIT(18), |
| 1307 | /* data FIFO is cleared by an error */ | 1307 | /* data FIFO is cleared by an error */ |
| 1308 | IDE_HFLAG_ERROR_STOPS_FIFO = (1 << 19), | 1308 | IDE_HFLAG_ERROR_STOPS_FIFO = BIT(19), |
| 1309 | /* serialize ports */ | 1309 | /* serialize ports */ |
| 1310 | IDE_HFLAG_SERIALIZE = (1 << 20), | 1310 | IDE_HFLAG_SERIALIZE = BIT(20), |
| 1311 | /* host is DTC2278 */ | 1311 | /* host is DTC2278 */ |
| 1312 | IDE_HFLAG_DTC2278 = (1 << 21), | 1312 | IDE_HFLAG_DTC2278 = BIT(21), |
| 1313 | /* 4 devices on a single set of I/O ports */ | 1313 | /* 4 devices on a single set of I/O ports */ |
| 1314 | IDE_HFLAG_4DRIVES = (1 << 22), | 1314 | IDE_HFLAG_4DRIVES = BIT(22), |
| 1315 | /* host is TRM290 */ | 1315 | /* host is TRM290 */ |
| 1316 | IDE_HFLAG_TRM290 = (1 << 23), | 1316 | IDE_HFLAG_TRM290 = BIT(23), |
| 1317 | /* use 32-bit I/O ops */ | 1317 | /* use 32-bit I/O ops */ |
| 1318 | IDE_HFLAG_IO_32BIT = (1 << 24), | 1318 | IDE_HFLAG_IO_32BIT = BIT(24), |
| 1319 | /* unmask IRQs */ | 1319 | /* unmask IRQs */ |
| 1320 | IDE_HFLAG_UNMASK_IRQS = (1 << 25), | 1320 | IDE_HFLAG_UNMASK_IRQS = BIT(25), |
| 1321 | IDE_HFLAG_BROKEN_ALTSTATUS = (1 << 26), | 1321 | IDE_HFLAG_BROKEN_ALTSTATUS = BIT(26), |
| 1322 | /* serialize ports if DMA is possible (for sl82c105) */ | 1322 | /* serialize ports if DMA is possible (for sl82c105) */ |
| 1323 | IDE_HFLAG_SERIALIZE_DMA = (1 << 27), | 1323 | IDE_HFLAG_SERIALIZE_DMA = BIT(27), |
| 1324 | /* force host out of "simplex" mode */ | 1324 | /* force host out of "simplex" mode */ |
| 1325 | IDE_HFLAG_CLEAR_SIMPLEX = (1 << 28), | 1325 | IDE_HFLAG_CLEAR_SIMPLEX = BIT(28), |
| 1326 | /* DSC overlap is unsupported */ | 1326 | /* DSC overlap is unsupported */ |
| 1327 | IDE_HFLAG_NO_DSC = (1 << 29), | 1327 | IDE_HFLAG_NO_DSC = BIT(29), |
| 1328 | /* never use 32-bit I/O ops */ | 1328 | /* never use 32-bit I/O ops */ |
| 1329 | IDE_HFLAG_NO_IO_32BIT = (1 << 30), | 1329 | IDE_HFLAG_NO_IO_32BIT = BIT(30), |
| 1330 | /* never unmask IRQs */ | 1330 | /* never unmask IRQs */ |
| 1331 | IDE_HFLAG_NO_UNMASK_IRQS = (1 << 31), | 1331 | IDE_HFLAG_NO_UNMASK_IRQS = BIT(31), |
| 1332 | }; | 1332 | }; |
| 1333 | 1333 | ||
| 1334 | #ifdef CONFIG_BLK_DEV_OFFBOARD | 1334 | #ifdef CONFIG_BLK_DEV_OFFBOARD |
| @@ -1536,16 +1536,16 @@ struct ide_timing { · 201 unmodified lines | |||
| 1536 | }; | 1536 | }; |
| 1537 | 1537 | ||
| 1538 | enum { | 1538 | enum { |
| 1539 | IDE_TIMING_SETUP = (1 << 0), | 1539 | IDE_TIMING_SETUP = BIT(0), |
| 1540 | IDE_TIMING_ACT8B = (1 << 1), | 1540 | IDE_TIMING_ACT8B = BIT(1), |
| 1541 | IDE_TIMING_REC8B = (1 << 2), | 1541 | IDE_TIMING_REC8B = BIT(2), |
| 1542 | IDE_TIMING_CYC8B = (1 << 3), | 1542 | IDE_TIMING_CYC8B = BIT(3), |
| 1543 | IDE_TIMING_8BIT = IDE_TIMING_ACT8B | IDE_TIMING_REC8B | | 1543 | IDE_TIMING_8BIT = IDE_TIMING_ACT8B | IDE_TIMING_REC8B | |
| 1544 | IDE_TIMING_CYC8B, | 1544 | IDE_TIMING_CYC8B, |
| 1545 | IDE_TIMING_ACTIVE = (1 << 4), | 1545 | IDE_TIMING_ACTIVE = BIT(4), |
| 1546 | IDE_TIMING_RECOVER = (1 << 5), | 1546 | IDE_TIMING_RECOVER = BIT(5), |
| 1547 | IDE_TIMING_CYCLE = (1 << 6), | 1547 | IDE_TIMING_CYCLE = BIT(6), |
| 1548 | IDE_TIMING_UDMA = (1 << 7), | 1548 | IDE_TIMING_UDMA = BIT(7), |
| 1549 | IDE_TIMING_ALL = IDE_TIMING_SETUP | IDE_TIMING_8BIT | | 1549 | IDE_TIMING_ALL = IDE_TIMING_SETUP | IDE_TIMING_8BIT | |
| 1550 | IDE_TIMING_ACTIVE | IDE_TIMING_RECOVER | | 1550 | IDE_TIMING_ACTIVE | IDE_TIMING_RECOVER | |
| 1551 | IDE_TIMING_CYCLE | IDE_TIMING_UDMA, | 1551 | IDE_TIMING_CYCLE | IDE_TIMING_UDMA, |
| @@ -191,14 +191,17 @@ static inline void idr_preload_end(void) · 190 unmodified lines | |||
| 191 | * idr_for_each_entry_ul() - Iterate over an IDR's elements of a given type. | 191 | * idr_for_each_entry_ul() - Iterate over an IDR's elements of a given type. |
| 192 | * @idr: IDR handle. | 192 | * @idr: IDR handle. |
| 193 | * @entry: The type * to use as cursor. | 193 | * @entry: The type * to use as cursor. |
| 194 | * @tmp: A temporary placeholder for ID. | ||
| 194 | * @id: Entry ID. | 195 | * @id: Entry ID. |
| 195 | * | 196 | * |
| 196 | * @entry and @id do not need to be initialized before the loop, and | 197 | * @entry and @id do not need to be initialized before the loop, and |
| 197 | * after normal termination @entry is left with the value NULL. This | 198 | * after normal termination @entry is left with the value NULL. This |
| 198 | * is convenient for a "not found" value. | 199 | * is convenient for a "not found" value. |
| 199 | */ | 200 | */ |
| 200 | #define idr_for_each_entry_ul(idr, entry, id) \ | 201 | #define idr_for_each_entry_ul(idr, entry, tmp, id) \ |
| 201 | for (id = 0; ((entry) = idr_get_next_ul(idr, &(id))) != NULL; ++id) | 202 | for (tmp = 0, id = 0; \ |
| 203 | tmp <= id && ((entry) = idr_get_next_ul(idr, &(id))) != NULL; \ | ||
| 204 | tmp = id, ++id) | ||
| 202 | 205 | ||
| 203 | /** | 206 | /** |
| 204 | * idr_for_each_entry_continue() - Continue iteration over an IDR's elements of a given type | 207 | * idr_for_each_entry_continue() - Continue iteration over an IDR's elements of a given type |
| @@ -213,6 +216,20 @@ static inline void idr_preload_end(void) · 8 unmodified lines | |||
| 213 | entry; \ | 216 | entry; \ |
| 214 | ++id, (entry) = idr_get_next((idr), &(id))) | 217 | ++id, (entry) = idr_get_next((idr), &(id))) |
| 215 | 218 | ||
| 219 | /** | ||
| 220 | * idr_for_each_entry_continue_ul() - Continue iteration over an IDR's elements of a given type | ||
| 221 | * @idr: IDR handle. | ||
| 222 | * @entry: The type * to use as a cursor. | ||
| 223 | * @tmp: A temporary placeholder for ID. | ||
| 224 | * @id: Entry ID. | ||
| 225 | * | ||
| 226 | * Continue to iterate over entries, continuing after the current position. | ||
| 227 | */ | ||
| 228 | #define idr_for_each_entry_continue_ul(idr, entry, tmp, id) \ | ||
| 229 | for (tmp = id; \ | ||
| 230 | tmp <= id && ((entry) = idr_get_next_ul(idr, &(id))) != NULL; \ | ||
| 231 | tmp = id, ++id) | ||
| 232 | |||
| 216 | /* | 233 | /* |
| 217 | * IDA - ID Allocator, use when translation from id to pointer isn't necessary. | 234 | * IDA - ID Allocator, use when translation from id to pointer isn't necessary. |
| 218 | */ | 235 | */ |
| @@ -2609,6 +2609,7 @@ enum ieee80211_key_len { · 2608 unmodified lines | |||
| 2609 | #define FILS_ERP_MAX_RRK_LEN 64 | 2609 | #define FILS_ERP_MAX_RRK_LEN 64 |
| 2610 | 2610 | ||
| 2611 | #define PMK_MAX_LEN 64 | 2611 | #define PMK_MAX_LEN 64 |
| 2612 | #define SAE_PASSWORD_MAX_LEN 128 | ||
| 2612 | 2613 | ||
| 2613 | /* Public action codes (IEEE Std 802.11-2016, 9.6.8.1, Table 9-307) */ | 2614 | /* Public action codes (IEEE Std 802.11-2016, 9.6.8.1, Table 9-307) */ |
| 2614 | enum ieee80211_pub_actioncode { | 2615 | enum ieee80211_pub_actioncode { |
| @@ -2709,6 +2710,13 @@ enum ieee80211_tdls_actioncode { · 94 unmodified lines | |||
| 2709 | #define WLAN_EXT_CAPA10_TWT_REQUESTER_SUPPORT BIT(5) | 2710 | #define WLAN_EXT_CAPA10_TWT_REQUESTER_SUPPORT BIT(5) |
| 2710 | #define WLAN_EXT_CAPA10_TWT_RESPONDER_SUPPORT BIT(6) | 2711 | #define WLAN_EXT_CAPA10_TWT_RESPONDER_SUPPORT BIT(6) |
| 2711 | 2712 | ||
| 2713 | /* | ||
| 2714 | * When set, indicates that the AP is able to tolerate 26-tone RU UL | ||
| 2715 | * OFDMA transmissions using HE TB PPDU from OBSS (not falsely classify the | ||
| 2716 | * 26-tone RU UL OFDMA transmissions as radar pulses). | ||
| 2717 | */ | ||
| 2718 | #define WLAN_EXT_CAPA10_OBSS_NARROW_BW_RU_TOLERANCE_SUPPORT BIT(7) | ||
| 2719 | |||
| 2712 | /* Defines support for enhanced multi-bssid advertisement*/ | 2720 | /* Defines support for enhanced multi-bssid advertisement*/ |
| 2713 | #define WLAN_EXT_CAPA11_EMA_SUPPORT BIT(1) | 2721 | #define WLAN_EXT_CAPA11_EMA_SUPPORT BIT(1) |
| 2714 | 2722 | ||
| @@ -88,6 +88,8 @@ static inline bool br_multicast_router(const struct net_device *dev) · 87 unmodified lines | |||
| 88 | #if IS_ENABLED(CONFIG_BRIDGE) && IS_ENABLED(CONFIG_BRIDGE_VLAN_FILTERING) | 88 | #if IS_ENABLED(CONFIG_BRIDGE) && IS_ENABLED(CONFIG_BRIDGE_VLAN_FILTERING) |
| 89 | bool br_vlan_enabled(const struct net_device *dev); | 89 | bool br_vlan_enabled(const struct net_device *dev); |
| 90 | int br_vlan_get_pvid(const struct net_device *dev, u16 *p_pvid); | 90 | int br_vlan_get_pvid(const struct net_device *dev, u16 *p_pvid); |
| 91 | int br_vlan_get_pvid_rcu(const struct net_device *dev, u16 *p_pvid); | ||
| 92 | int br_vlan_get_proto(const struct net_device *dev, u16 *p_proto); | ||
| 91 | int br_vlan_get_info(const struct net_device *dev, u16 vid, | 93 | int br_vlan_get_info(const struct net_device *dev, u16 vid, |
| 92 | struct bridge_vlan_info *p_vinfo); | 94 | struct bridge_vlan_info *p_vinfo); |
| 93 | #else | 95 | #else |
| @@ -101,6 +103,16 @@ static inline int br_vlan_get_pvid(const struct net_device *dev, u16 *p_pvid) · 7 unmodified lines | |||
| 101 | return -EINVAL; | 103 | return -EINVAL; |
| 102 | } | 104 | } |
| 103 | 105 | ||
| 106 | static inline int br_vlan_get_proto(const struct net_device *dev, u16 *p_proto) | ||
| 107 | { | ||
| 108 | return -EINVAL; | ||
| 109 | } | ||
| 110 | |||
| 111 | static inline int br_vlan_get_pvid_rcu(const struct net_device *dev, u16 *p_pvid) | ||
| 112 | { | ||
| 113 | return -EINVAL; | ||
| 114 | } | ||
| 115 | |||
| 104 | static inline int br_vlan_get_info(const struct net_device *dev, u16 vid, | 116 | static inline int br_vlan_get_info(const struct net_device *dev, u16 vid, |
| 105 | struct bridge_vlan_info *p_vinfo) | 117 | struct bridge_vlan_info *p_vinfo) |
| 106 | { | 118 | { |
| @@ -80,6 +80,9 @@ extern int register_pppox_proto(int proto_num, const struct pppox_proto *pp); · 79 unmodified lines | |||
| 80 | extern void unregister_pppox_proto(int proto_num); | 80 | extern void unregister_pppox_proto(int proto_num); |
| 81 | extern void pppox_unbind_sock(struct sock *sk);/* delete ppp-channel binding */ | 81 | extern void pppox_unbind_sock(struct sock *sk);/* delete ppp-channel binding */ |
| 82 | extern int pppox_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); | 82 | extern int pppox_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); |
| 83 | extern int pppox_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); | ||
| 84 | |||
| 85 | #define PPPOEIOCSFWD32 _IOW(0xB1 ,0, compat_size_t) | ||
| 83 | 86 | ||
| 84 | /* PPPoX socket states */ | 87 | /* PPPoX socket states */ |
| 85 | enum { | 88 | enum { |
| @@ -0,0 +1,55 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0-only | ||
| 2 | * Copyright (c) 2013-2019, The Linux Foundation. All rights reserved. | ||
| 3 | */ | ||
| 4 | |||
| 5 | #ifndef _LINUX_IF_RMNET_H_ | ||
| 6 | #define _LINUX_IF_RMNET_H_ | ||
| 7 | |||
| 8 | struct rmnet_map_header { | ||
| 9 | #if defined(__LITTLE_ENDIAN_BITFIELD) | ||
| 10 | u8 pad_len:6; | ||
| 11 | u8 reserved_bit:1; | ||
| 12 | u8 cd_bit:1; | ||
| 13 | #elif defined (__BIG_ENDIAN_BITFIELD) | ||
| 14 | u8 cd_bit:1; | ||
| 15 | u8 reserved_bit:1; | ||
| 16 | u8 pad_len:6; | ||
| 17 | #else | ||
| 18 | #error "Please fix <asm/byteorder.h>" | ||
| 19 | #endif | ||
| 20 | u8 mux_id; | ||
| 21 | __be16 pkt_len; | ||
| 22 | } __aligned(1); | ||
| 23 | |||
| 24 | struct rmnet_map_dl_csum_trailer { | ||
| 25 | u8 reserved1; | ||
| 26 | #if defined(__LITTLE_ENDIAN_BITFIELD) | ||
| 27 | u8 valid:1; | ||
| 28 | u8 reserved2:7; | ||
| 29 | #elif defined (__BIG_ENDIAN_BITFIELD) | ||
| 30 | u8 reserved2:7; | ||
| 31 | u8 valid:1; | ||
| 32 | #else | ||
| 33 | #error "Please fix <asm/byteorder.h>" | ||
| 34 | #endif | ||
| 35 | u16 csum_start_offset; | ||
| 36 | u16 csum_length; | ||
| 37 | __be16 csum_value; | ||
| 38 | } __aligned(1); | ||
| 39 | |||
| 40 | struct rmnet_map_ul_csum_header { | ||
| 41 | __be16 csum_start_offset; | ||
| 42 | #if defined(__LITTLE_ENDIAN_BITFIELD) | ||
| 43 | u16 csum_insert_offset:14; | ||
| 44 | u16 udp_ind:1; | ||
| 45 | u16 csum_enabled:1; | ||
| 46 | #elif defined (__BIG_ENDIAN_BITFIELD) | ||
| 47 | u16 csum_enabled:1; | ||
| 48 | u16 udp_ind:1; | ||
| 49 | u16 csum_insert_offset:14; | ||
| 50 | #else | ||
| 51 | #error "Please fix <asm/byteorder.h>" | ||
| 52 | #endif | ||
| 53 | } __aligned(1); | ||
| 54 | |||
| 55 | #endif /* !(_LINUX_IF_RMNET_H_) */ | ||
| @@ -62,7 +62,6 @@ struct tap_dev { · 61 unmodified lines | |||
| 62 | struct tap_queue { | 62 | struct tap_queue { |
| 63 | struct sock sk; | 63 | struct sock sk; |
| 64 | struct socket sock; | 64 | struct socket sock; |
| 65 | struct socket_wq wq; | ||
| 66 | int vnet_hdr_sz; | 65 | int vnet_hdr_sz; |
| 67 | struct tap_dev __rcu *tap; | 66 | struct tap_dev __rcu *tap; |
| 68 | struct file *file; | 67 | struct file *file; |
| @@ -60,8 +60,8 @@ struct ip_mc_socklist { · 59 unmodified lines | |||
| 60 | 60 | ||
| 61 | struct ip_sf_list { | 61 | struct ip_sf_list { |
| 62 | struct ip_sf_list *sf_next; | 62 | struct ip_sf_list *sf_next; |
| 63 | __be32 sf_inaddr; | ||
| 64 | unsigned long sf_count[2]; /* include/exclude counts */ | 63 | unsigned long sf_count[2]; /* include/exclude counts */ |
| 64 | __be32 sf_inaddr; | ||
| 65 | unsigned char sf_gsresp; /* include in g & s response? */ | 65 | unsigned char sf_gsresp; /* include in g & s response? */ |
| 66 | unsigned char sf_oldin; /* change state */ | 66 | unsigned char sf_oldin; /* change state */ |
| 67 | unsigned char sf_crcount; /* retrans. left to send */ | 67 | unsigned char sf_crcount; /* retrans. left to send */ |
| @@ -23,6 +23,7 @@ extern int ima_read_file(struct file *file, enum kernel_read_file_id id); · 22 unmodified lines | |||
| 23 | extern int ima_post_read_file(struct file *file, void *buf, loff_t size, | 23 | extern int ima_post_read_file(struct file *file, void *buf, loff_t size, |
| 24 | enum kernel_read_file_id id); | 24 | enum kernel_read_file_id id); |
| 25 | extern void ima_post_path_mknod(struct dentry *dentry); | 25 | extern void ima_post_path_mknod(struct dentry *dentry); |
| 26 | extern void ima_kexec_cmdline(const void *buf, int size); | ||
| 26 | 27 | ||
| 27 | #ifdef CONFIG_IMA_KEXEC | 28 | #ifdef CONFIG_IMA_KEXEC |
| 28 | extern void ima_add_kexec_buffer(struct kimage *image); | 29 | extern void ima_add_kexec_buffer(struct kimage *image); |
| @@ -89,6 +90,7 @@ static inline void ima_post_path_mknod(struct dentry *dentry) · 60 unmodified lines | |||
| 89 | return; | 90 | return; |
| 90 | } | 91 | } |
| 91 | 92 | ||
| 93 | static inline void ima_kexec_cmdline(const void *buf, int size) {} | ||
| 92 | #endif /* CONFIG_IMA */ | 94 | #endif /* CONFIG_IMA */ |
| 93 | 95 | ||
| 94 | #ifndef CONFIG_IMA_KEXEC | 96 | #ifndef CONFIG_IMA_KEXEC |
| @@ -63,7 +63,7 @@ static inline bool ipv4_is_all_snoopers(__be32 addr) · 62 unmodified lines | |||
| 63 | 63 | ||
| 64 | static inline bool ipv4_is_zeronet(__be32 addr) | 64 | static inline bool ipv4_is_zeronet(__be32 addr) |
| 65 | { | 65 | { |
| 66 | return (addr & htonl(0xff000000)) == htonl(0x00000000); | 66 | return (addr == 0); |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | /* Special-Use IPv4 Addresses (RFC3330) */ | 69 | /* Special-Use IPv4 Addresses (RFC3330) */ |
| @@ -26,7 +26,7 @@ struct in_device { · 25 unmodified lines | |||
| 26 | struct net_device *dev; | 26 | struct net_device *dev; |
| 27 | refcount_t refcnt; | 27 | refcount_t refcnt; |
| 28 | int dead; | 28 | int dead; |
| 29 | struct in_ifaddr *ifa_list; /* IP ifaddr chain */ | 29 | struct in_ifaddr __rcu *ifa_list;/* IP ifaddr chain */ |
| 30 | 30 | ||
| 31 | struct ip_mc_list __rcu *mc_list; /* IP multicast filter chain */ | 31 | struct ip_mc_list __rcu *mc_list; /* IP multicast filter chain */ |
| 32 | struct ip_mc_list __rcu * __rcu *mc_hash; | 32 | struct ip_mc_list __rcu * __rcu *mc_hash; |
| @@ -136,7 +136,7 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev) · 103 unmodified lines | |||
| 136 | 136 | ||
| 137 | struct in_ifaddr { | 137 | struct in_ifaddr { |
| 138 | struct hlist_node hash; | 138 | struct hlist_node hash; |
| 139 | struct in_ifaddr *ifa_next; | 139 | struct in_ifaddr __rcu *ifa_next; |
| 140 | struct in_device *ifa_dev; | 140 | struct in_device *ifa_dev; |
| 141 | struct rcu_head rcu_head; | 141 | struct rcu_head rcu_head; |
| 142 | __be32 ifa_local; | 142 | __be32 ifa_local; |
| @@ -186,7 +186,7 @@ __be32 inet_confirm_addr(struct net *net, struct in_device *in_dev, __be32 dst, · 43 unmodified lines | |||
| 186 | struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, __be32 prefix, | 186 | struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, __be32 prefix, |
| 187 | __be32 mask); | 187 | __be32 mask); |
| 188 | struct in_ifaddr *inet_lookup_ifaddr_rcu(struct net *net, __be32 addr); | 188 | struct in_ifaddr *inet_lookup_ifaddr_rcu(struct net *net, __be32 addr); |
| 189 | static __inline__ bool inet_ifa_match(__be32 addr, struct in_ifaddr *ifa) | 189 | static inline bool inet_ifa_match(__be32 addr, const struct in_ifaddr *ifa) |
| 190 | { | 190 | { |
| 191 | return !((addr^ifa->ifa_address)&ifa->ifa_mask); | 191 | return !((addr^ifa->ifa_address)&ifa->ifa_mask); |
| 192 | } | 192 | } |
| @@ -206,14 +206,13 @@ static __inline__ bool bad_mask(__be32 mask, __be32 addr) · 13 unmodified lines | |||
| 206 | return false; | 206 | return false; |
| 207 | } | 207 | } |
| 208 | 208 | ||
| 209 | #define for_primary_ifa(in_dev) { struct in_ifaddr *ifa; \ | 209 | #define in_dev_for_each_ifa_rtnl(ifa, in_dev) \ |
| 210 | for (ifa = (in_dev)->ifa_list; ifa && !(ifa->ifa_flags&IFA_F_SECONDARY); ifa = ifa->ifa_next) | 210 | for (ifa = rtnl_dereference((in_dev)->ifa_list); ifa; \ |
| 211 | ifa = rtnl_dereference(ifa->ifa_next)) | ||
| 211 | 212 | ||
| 212 | #define for_ifa(in_dev) { struct in_ifaddr *ifa; \ | 213 | #define in_dev_for_each_ifa_rcu(ifa, in_dev) \ |
| 213 | for (ifa = (in_dev)->ifa_list; ifa; ifa = ifa->ifa_next) | 214 | for (ifa = rcu_dereference((in_dev)->ifa_list); ifa; \ |
| 214 | 215 | ifa = rcu_dereference(ifa->ifa_next)) | |
| 215 | |||
| 216 | #define endfor_ifa(in_dev) } | ||
| 217 | 216 | ||
| 218 | static inline struct in_device *__in_dev_get_rcu(const struct net_device *dev) | 217 | static inline struct in_device *__in_dev_get_rcu(const struct net_device *dev) |
| 219 | { | 218 | { |
| @@ -137,6 +137,8 @@ extern initcall_entry_t __con_initcall_start[], __con_initcall_end[]; · 136 unmodified lines | |||
| 137 | /* Used for contructor calls. */ | 137 | /* Used for contructor calls. */ |
| 138 | typedef void (*ctor_fn_t)(void); | 138 | typedef void (*ctor_fn_t)(void); |
| 139 | 139 | ||
| 140 | struct file_system_type; | ||
| 141 | |||
| 140 | /* Defined in init/main.c */ | 142 | /* Defined in init/main.c */ |
| 141 | extern int do_one_initcall(initcall_t fn); | 143 | extern int do_one_initcall(initcall_t fn); |
| 142 | extern char __initdata boot_command_line[]; | 144 | extern char __initdata boot_command_line[]; |
| @@ -146,7 +148,8 @@ extern unsigned int reset_devices; · 3 unmodified lines | |||
| 146 | /* used by init/main.c */ | 148 | /* used by init/main.c */ |
| 147 | void setup_arch(char **); | 149 | void setup_arch(char **); |
| 148 | void prepare_namespace(void); | 150 | void prepare_namespace(void); |
| 149 | int __init init_rootfs(void); | 151 | void __init init_rootfs(void); |
| 152 | extern struct file_system_type rootfs_fs_type; | ||
| 150 | 153 | ||
| 151 | #if defined(CONFIG_STRICT_KERNEL_RWX) || defined(CONFIG_STRICT_MODULE_RWX) | 154 | #if defined(CONFIG_STRICT_KERNEL_RWX) || defined(CONFIG_STRICT_MODULE_RWX) |
| 152 | extern bool rodata_enabled; | 155 | extern bool rodata_enabled; |
| @@ -21,6 +21,8 @@ · 20 unmodified lines | |||
| 21 | #include <linux/timer.h> | 21 | #include <linux/timer.h> |
| 22 | #include <linux/mod_devicetable.h> | 22 | #include <linux/mod_devicetable.h> |
| 23 | 23 | ||
| 24 | struct input_dev_poller; | ||
| 25 | |||
| 24 | /** | 26 | /** |
| 25 | * struct input_value - input value representation | 27 | * struct input_value - input value representation |
| 26 | * @type: type of value (EV_KEY, EV_ABS, etc) | 28 | * @type: type of value (EV_KEY, EV_ABS, etc) |
| @@ -33,6 +35,13 @@ struct input_value { · 6 unmodified lines | |||
| 33 | __s32 value; | 35 | __s32 value; |
| 34 | }; | 36 | }; |
| 35 | 37 | ||
| 38 | enum input_clock_type { | ||
| 39 | INPUT_CLK_REAL = 0, | ||
| 40 | INPUT_CLK_MONO, | ||
| 41 | INPUT_CLK_BOOT, | ||
| 42 | INPUT_CLK_MAX | ||
| 43 | }; | ||
| 44 | |||
| 36 | /** | 45 | /** |
| 37 | * struct input_dev - represents an input device | 46 | * struct input_dev - represents an input device |
| 38 | * @name: name of the device | 47 | * @name: name of the device |
| @@ -64,6 +73,8 @@ struct input_value { · 25 unmodified lines | |||
| 64 | * not sleep | 73 | * not sleep |
| 65 | * @ff: force feedback structure associated with the device if device | 74 | * @ff: force feedback structure associated with the device if device |
| 66 | * supports force feedback effects | 75 | * supports force feedback effects |
| 76 | * @poller: poller structure associated with the device if device is | ||
| 77 | * set up to use polling mode | ||
| 67 | * @repeat_key: stores key code of the last key pressed; used to implement | 78 | * @repeat_key: stores key code of the last key pressed; used to implement |
| 68 | * software autorepeat | 79 | * software autorepeat |
| 69 | * @timer: timer for software autorepeat | 80 | * @timer: timer for software autorepeat |
| @@ -114,6 +125,8 @@ struct input_value { · 44 unmodified lines | |||
| 114 | * @vals: array of values queued in the current frame | 125 | * @vals: array of values queued in the current frame |
| 115 | * @devres_managed: indicates that devices is managed with devres framework | 126 | * @devres_managed: indicates that devices is managed with devres framework |
| 116 | * and needs not be explicitly unregistered or freed. | 127 | * and needs not be explicitly unregistered or freed. |
| 128 | * @timestamp: storage for a timestamp set by input_set_timestamp called | ||
| 129 | * by a driver | ||
| 117 | */ | 130 | */ |
| 118 | struct input_dev { | 131 | struct input_dev { |
| 119 | const char *name; | 132 | const char *name; |
| @@ -147,6 +160,8 @@ struct input_dev { · 27 unmodified lines | |||
| 147 | 160 | ||
| 148 | struct ff_device *ff; | 161 | struct ff_device *ff; |
| 149 | 162 | ||
| 163 | struct input_dev_poller *poller; | ||
| 164 | |||
| 150 | unsigned int repeat_key; | 165 | unsigned int repeat_key; |
| 151 | struct timer_list timer; | 166 | struct timer_list timer; |
| 152 | 167 | ||
| @@ -184,6 +199,8 @@ struct input_dev { · 31 unmodified lines | |||
| 184 | struct input_value *vals; | 199 | struct input_value *vals; |
| 185 | 200 | ||
| 186 | bool devres_managed; | 201 | bool devres_managed; |
| 202 | |||
| 203 | ktime_t timestamp[INPUT_CLK_MAX]; | ||
| 187 | }; | 204 | }; |
| 188 | #define to_input_dev(d) container_of(d, struct input_dev, dev) | 205 | #define to_input_dev(d) container_of(d, struct input_dev, dev) |
| 189 | 206 | ||
| @@ -361,6 +378,12 @@ void input_unregister_device(struct input_dev *); · 171 unmodified lines | |||
| 361 | 378 | ||
| 362 | void input_reset_device(struct input_dev *); | 379 | void input_reset_device(struct input_dev *); |
| 363 | 380 | ||
| 381 | int input_setup_polling(struct input_dev *dev, | ||
| 382 | void (*poll_fn)(struct input_dev *dev)); | ||
| 383 | void input_set_poll_interval(struct input_dev *dev, unsigned int interval); | ||
| 384 | void input_set_min_poll_interval(struct input_dev *dev, unsigned int interval); | ||
| 385 | void input_set_max_poll_interval(struct input_dev *dev, unsigned int interval); | ||
| 386 | |||
| 364 | int __must_check input_register_handler(struct input_handler *); | 387 | int __must_check input_register_handler(struct input_handler *); |
| 365 | void input_unregister_handler(struct input_handler *); | 388 | void input_unregister_handler(struct input_handler *); |
| 366 | 389 | ||
| @@ -382,6 +405,9 @@ void input_close_device(struct input_handle *); · 15 unmodified lines | |||
| 382 | 405 | ||
| 383 | int input_flush_device(struct input_handle *handle, struct file *file); | 406 | int input_flush_device(struct input_handle *handle, struct file *file); |
| 384 | 407 | ||
| 408 | void input_set_timestamp(struct input_dev *dev, ktime_t timestamp); | ||
| 409 | ktime_t *input_get_timestamp(struct input_dev *dev); | ||
| 410 | |||
| 385 | void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value); | 411 | void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value); |
| 386 | void input_inject_event(struct input_handle *handle, unsigned int type, unsigned int code, int value); | 412 | void input_inject_event(struct input_handle *handle, unsigned int type, unsigned int code, int value); |
| 387 | 413 | ||
| @@ -1,34 +0,0 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0-only */ | ||
| 2 | /* | ||
| 3 | * Copyright (C) ST-Ericsson SA 2010 | ||
| 4 | * Author: Naveen Kumar G <naveen.gaddipati@stericsson.com> for ST-Ericsson | ||
| 5 | */ | ||
| 6 | |||
| 7 | #ifndef _BU21013_H | ||
| 8 | #define _BU21013_H | ||
| 9 | |||
| 10 | /** | ||
| 11 | * struct bu21013_platform_device - Handle the platform data | ||
| 12 | * @touch_x_max: touch x max | ||
| 13 | * @touch_y_max: touch y max | ||
| 14 | * @cs_pin: chip select pin | ||
| 15 | * @touch_pin: touch gpio pin | ||
| 16 | * @ext_clk: external clock flag | ||
| 17 | * @x_flip: x flip flag | ||
| 18 | * @y_flip: y flip flag | ||
| 19 | * @wakeup: wakeup flag | ||
| 20 | * | ||
| 21 | * This is used to handle the platform data | ||
| 22 | */ | ||
| 23 | struct bu21013_platform_device { | ||
| 24 | int touch_x_max; | ||
| 25 | int touch_y_max; | ||
| 26 | unsigned int cs_pin; | ||
| 27 | unsigned int touch_pin; | ||
| 28 | bool ext_clk; | ||
| 29 | bool x_flip; | ||
| 30 | bool y_flip; | ||
| 31 | bool wakeup; | ||
| 32 | }; | ||
| 33 | |||
| 34 | #endif | ||
| @@ -435,6 +435,12 @@ enum { · 434 unmodified lines | |||
| 435 | #define VTD_FLAG_TRANS_PRE_ENABLED (1 << 0) | 435 | #define VTD_FLAG_TRANS_PRE_ENABLED (1 << 0) |
| 436 | #define VTD_FLAG_IRQ_REMAP_PRE_ENABLED (1 << 1) | 436 | #define VTD_FLAG_IRQ_REMAP_PRE_ENABLED (1 << 1) |
| 437 | 437 | ||
| 438 | extern int intel_iommu_sm; | ||
| 439 | |||
| 440 | #define sm_supported(iommu) (intel_iommu_sm && ecap_smts((iommu)->ecap)) | ||
| 441 | #define pasid_supported(iommu) (sm_supported(iommu) && \ | ||
| 442 | ecap_pasid((iommu)->ecap)) | ||
| 443 | |||
| 438 | struct pasid_entry; | 444 | struct pasid_entry; |
| 439 | struct pasid_state_entry; | 445 | struct pasid_state_entry; |
| 440 | struct page_req_dsc; | 446 | struct page_req_dsc; |
| @@ -642,7 +648,6 @@ extern int qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu); · 201 unmodified lines | |||
| 642 | 648 | ||
| 643 | extern int dmar_ir_support(void); | 649 | extern int dmar_ir_support(void); |
| 644 | 650 | ||
| 645 | struct dmar_domain *get_valid_domain_for_dev(struct device *dev); | ||
| 646 | void *alloc_pgtable_page(int node); | 651 | void *alloc_pgtable_page(int node); |
| 647 | void free_pgtable_page(void *vaddr); | 652 | void free_pgtable_page(void *vaddr); |
| 648 | struct intel_iommu *domain_get_iommu(struct dmar_domain *domain); | 653 | struct intel_iommu *domain_get_iommu(struct dmar_domain *domain); |
| @@ -49,7 +49,7 @@ struct svm_dev_ops { · 48 unmodified lines | |||
| 49 | 49 | ||
| 50 | /** | 50 | /** |
| 51 | * intel_svm_bind_mm() - Bind the current process to a PASID | 51 | * intel_svm_bind_mm() - Bind the current process to a PASID |
| 52 | * @dev: Device to be granted acccess | 52 | * @dev: Device to be granted access |
| 53 | * @pasid: Address for allocated PASID | 53 | * @pasid: Address for allocated PASID |
| 54 | * @flags: Flags. Later for requesting supervisor mode, etc. | 54 | * @flags: Flags. Later for requesting supervisor mode, etc. |
| 55 | * @ops: Callbacks to device driver | 55 | * @ops: Callbacks to device driver |
| @@ -0,0 +1,155 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | /* | ||
| 3 | * Data types and headers for RAPL support | ||
| 4 | * | ||
| 5 | * Copyright (C) 2019 Intel Corporation. | ||
| 6 | * | ||
| 7 | * Author: Zhang Rui <rui.zhang@intel.com> | ||
| 8 | */ | ||
| 9 | |||
| 10 | #ifndef __INTEL_RAPL_H__ | ||
| 11 | #define __INTEL_RAPL_H__ | ||
| 12 | |||
| 13 | #include <linux/types.h> | ||
| 14 | #include <linux/powercap.h> | ||
| 15 | #include <linux/cpuhotplug.h> | ||
| 16 | |||
| 17 | enum rapl_domain_type { | ||
| 18 | RAPL_DOMAIN_PACKAGE, /* entire package/socket */ | ||
| 19 | RAPL_DOMAIN_PP0, /* core power plane */ | ||
| 20 | RAPL_DOMAIN_PP1, /* graphics uncore */ | ||
| 21 | RAPL_DOMAIN_DRAM, /* DRAM control_type */ | ||
| 22 | RAPL_DOMAIN_PLATFORM, /* PSys control_type */ | ||
| 23 | RAPL_DOMAIN_MAX, | ||
| 24 | }; | ||
| 25 | |||
| 26 | enum rapl_domain_reg_id { | ||
| 27 | RAPL_DOMAIN_REG_LIMIT, | ||
| 28 | RAPL_DOMAIN_REG_STATUS, | ||
| 29 | RAPL_DOMAIN_REG_PERF, | ||
| 30 | RAPL_DOMAIN_REG_POLICY, | ||
| 31 | RAPL_DOMAIN_REG_INFO, | ||
| 32 | RAPL_DOMAIN_REG_MAX, | ||
| 33 | }; | ||
| 34 | |||
| 35 | struct rapl_package; | ||
| 36 | |||
| 37 | enum rapl_primitives { | ||
| 38 | ENERGY_COUNTER, | ||
| 39 | POWER_LIMIT1, | ||
| 40 | POWER_LIMIT2, | ||
| 41 | FW_LOCK, | ||
| 42 | |||
| 43 | PL1_ENABLE, /* power limit 1, aka long term */ | ||
| 44 | PL1_CLAMP, /* allow frequency to go below OS request */ | ||
| 45 | PL2_ENABLE, /* power limit 2, aka short term, instantaneous */ | ||
| 46 | PL2_CLAMP, | ||
| 47 | |||
| 48 | TIME_WINDOW1, /* long term */ | ||
| 49 | TIME_WINDOW2, /* short term */ | ||
| 50 | THERMAL_SPEC_POWER, | ||
| 51 | MAX_POWER, | ||
| 52 | |||
| 53 | MIN_POWER, | ||
| 54 | MAX_TIME_WINDOW, | ||
| 55 | THROTTLED_TIME, | ||
| 56 | PRIORITY_LEVEL, | ||
| 57 | |||
| 58 | /* below are not raw primitive data */ | ||
| 59 | AVERAGE_POWER, | ||
| 60 | NR_RAPL_PRIMITIVES, | ||
| 61 | }; | ||
| 62 | |||
| 63 | struct rapl_domain_data { | ||
| 64 | u64 primitives[NR_RAPL_PRIMITIVES]; | ||
| 65 | unsigned long timestamp; | ||
| 66 | }; | ||
| 67 | |||
| 68 | #define NR_POWER_LIMITS (2) | ||
| 69 | struct rapl_power_limit { | ||
| 70 | struct powercap_zone_constraint *constraint; | ||
| 71 | int prim_id; /* primitive ID used to enable */ | ||
| 72 | struct rapl_domain *domain; | ||
| 73 | const char *name; | ||
| 74 | u64 last_power_limit; | ||
| 75 | }; | ||
| 76 | |||
| 77 | struct rapl_package; | ||
| 78 | |||
| 79 | struct rapl_domain { | ||
| 80 | const char *name; | ||
| 81 | enum rapl_domain_type id; | ||
| 82 | u64 regs[RAPL_DOMAIN_REG_MAX]; | ||
| 83 | struct powercap_zone power_zone; | ||
| 84 | struct rapl_domain_data rdd; | ||
| 85 | struct rapl_power_limit rpl[NR_POWER_LIMITS]; | ||
| 86 | u64 attr_map; /* track capabilities */ | ||
| 87 | unsigned int state; | ||
| 88 | unsigned int domain_energy_unit; | ||
| 89 | struct rapl_package *rp; | ||
| 90 | }; | ||
| 91 | |||
| 92 | struct reg_action { | ||
| 93 | u64 reg; | ||
| 94 | u64 mask; | ||
| 95 | u64 value; | ||
| 96 | int err; | ||
| 97 | }; | ||
| 98 | |||
| 99 | /** | ||
| 100 | * struct rapl_if_priv: private data for different RAPL interfaces | ||
| 101 | * @control_type: Each RAPL interface must have its own powercap | ||
| 102 | * control type. | ||
| 103 | * @platform_rapl_domain: Optional. Some RAPL interface may have platform | ||
| 104 | * level RAPL control. | ||
| 105 | * @pcap_rapl_online: CPU hotplug state for each RAPL interface. | ||
| 106 | * @reg_unit: Register for getting energy/power/time unit. | ||
| 107 | * @regs: Register sets for different RAPL Domains. | ||
| 108 | * @limits: Number of power limits supported by each domain. | ||
| 109 | * @read_raw: Callback for reading RAPL interface specific | ||
| 110 | * registers. | ||
| 111 | * @write_raw: Callback for writing RAPL interface specific | ||
| 112 | * registers. | ||
| 113 | */ | ||
| 114 | struct rapl_if_priv { | ||
| 115 | struct powercap_control_type *control_type; | ||
| 116 | struct rapl_domain *platform_rapl_domain; | ||
| 117 | enum cpuhp_state pcap_rapl_online; | ||
| 118 | u64 reg_unit; | ||
| 119 | u64 regs[RAPL_DOMAIN_MAX][RAPL_DOMAIN_REG_MAX]; | ||
| 120 | int limits[RAPL_DOMAIN_MAX]; | ||
| 121 | int (*read_raw)(int cpu, struct reg_action *ra); | ||
| 122 | int (*write_raw)(int cpu, struct reg_action *ra); | ||
| 123 | }; | ||
| 124 | |||
| 125 | /* maximum rapl package domain name: package-%d-die-%d */ | ||
| 126 | #define PACKAGE_DOMAIN_NAME_LENGTH 30 | ||
| 127 | |||
| 128 | struct rapl_package { | ||
| 129 | unsigned int id; /* logical die id, equals physical 1-die systems */ | ||
| 130 | unsigned int nr_domains; | ||
| 131 | unsigned long domain_map; /* bit map of active domains */ | ||
| 132 | unsigned int power_unit; | ||
| 133 | unsigned int energy_unit; | ||
| 134 | unsigned int time_unit; | ||
| 135 | struct rapl_domain *domains; /* array of domains, sized at runtime */ | ||
| 136 | struct powercap_zone *power_zone; /* keep track of parent zone */ | ||
| 137 | unsigned long power_limit_irq; /* keep track of package power limit | ||
| 138 | * notify interrupt enable status. | ||
| 139 | */ | ||
| 140 | struct list_head plist; | ||
| 141 | int lead_cpu; /* one active cpu per package for access */ | ||
| 142 | /* Track active cpus */ | ||
| 143 | struct cpumask cpumask; | ||
| 144 | char name[PACKAGE_DOMAIN_NAME_LENGTH]; | ||
| 145 | struct rapl_if_priv *priv; | ||
| 146 | }; | ||
| 147 | |||
| 148 | struct rapl_package *rapl_find_package_domain(int cpu, struct rapl_if_priv *priv); | ||
| 149 | struct rapl_package *rapl_add_package(int cpu, struct rapl_if_priv *priv); | ||
| 150 | void rapl_remove_package(struct rapl_package *rp); | ||
| 151 | |||
| 152 | int rapl_add_platform_domain(struct rapl_if_priv *priv); | ||
| 153 | void rapl_remove_platform_domain(struct rapl_if_priv *priv); | ||
| 154 | |||
| 155 | #endif /* __INTEL_RAPL_H__ */ | ||
| @@ -52,7 +52,7 @@ · 51 unmodified lines | |||
| 52 | * irq line disabled until the threaded handler has been run. | 52 | * irq line disabled until the threaded handler has been run. |
| 53 | * IRQF_NO_SUSPEND - Do not disable this IRQ during suspend. Does not guarantee | 53 | * IRQF_NO_SUSPEND - Do not disable this IRQ during suspend. Does not guarantee |
| 54 | * that this interrupt will wake the system from a suspended | 54 | * that this interrupt will wake the system from a suspended |
| 55 | * state. See Documentation/power/suspend-and-interrupts.txt | 55 | * state. See Documentation/power/suspend-and-interrupts.rst |
| 56 | * IRQF_FORCE_RESUME - Force enable it on resume even if IRQF_NO_SUSPEND is set | 56 | * IRQF_FORCE_RESUME - Force enable it on resume even if IRQF_NO_SUSPEND is set |
| 57 | * IRQF_NO_THREAD - Interrupt cannot be threaded | 57 | * IRQF_NO_THREAD - Interrupt cannot be threaded |
| 58 | * IRQF_EARLY_RESUME - Resume IRQ early during syscore instead of at device | 58 | * IRQF_EARLY_RESUME - Resume IRQ early during syscore instead of at device |
| @@ -44,6 +44,8 @@ struct iommu_gather_ops { · 43 unmodified lines | |||
| 44 | * tables. | 44 | * tables. |
| 45 | * @ias: Input address (iova) size, in bits. | 45 | * @ias: Input address (iova) size, in bits. |
| 46 | * @oas: Output address (paddr) size, in bits. | 46 | * @oas: Output address (paddr) size, in bits. |
| 47 | * @coherent_walk A flag to indicate whether or not page table walks made | ||
| 48 | * by the IOMMU are coherent with the CPU caches. | ||
| 47 | * @tlb: TLB management callbacks for this set of tables. | 49 | * @tlb: TLB management callbacks for this set of tables. |
| 48 | * @iommu_dev: The device representing the DMA configuration for the | 50 | * @iommu_dev: The device representing the DMA configuration for the |
| 49 | * page table walker. | 51 | * page table walker. |
| @@ -68,11 +70,6 @@ struct io_pgtable_cfg { · 18 unmodified lines | |||
| 68 | * when the SoC is in "4GB mode" and they can only access the high | 70 | * when the SoC is in "4GB mode" and they can only access the high |
| 69 | * remap of DRAM (0x1_00000000 to 0x1_ffffffff). | 71 | * remap of DRAM (0x1_00000000 to 0x1_ffffffff). |
| 70 | * | 72 | * |
| 71 | * IO_PGTABLE_QUIRK_NO_DMA: Guarantees that the tables will only ever | ||
| 72 | * be accessed by a fully cache-coherent IOMMU or CPU (e.g. for a | ||
| 73 | * software-emulated IOMMU), such that pagetable updates need not | ||
| 74 | * be treated as explicit DMA data. | ||
| 75 | * | ||
| 76 | * IO_PGTABLE_QUIRK_NON_STRICT: Skip issuing synchronous leaf TLBIs | 73 | * IO_PGTABLE_QUIRK_NON_STRICT: Skip issuing synchronous leaf TLBIs |
| 77 | * on unmap, for DMA domains using the flush queue mechanism for | 74 | * on unmap, for DMA domains using the flush queue mechanism for |
| 78 | * delayed invalidation. | 75 | * delayed invalidation. |
| @@ -81,12 +78,12 @@ struct io_pgtable_cfg { · 2 unmodified lines | |||
| 81 | #define IO_PGTABLE_QUIRK_NO_PERMS BIT(1) | 78 | #define IO_PGTABLE_QUIRK_NO_PERMS BIT(1) |
| 82 | #define IO_PGTABLE_QUIRK_TLBI_ON_MAP BIT(2) | 79 | #define IO_PGTABLE_QUIRK_TLBI_ON_MAP BIT(2) |
| 83 | #define IO_PGTABLE_QUIRK_ARM_MTK_4GB BIT(3) | 80 | #define IO_PGTABLE_QUIRK_ARM_MTK_4GB BIT(3) |
| 84 | #define IO_PGTABLE_QUIRK_NO_DMA BIT(4) | 81 | #define IO_PGTABLE_QUIRK_NON_STRICT BIT(4) |
| 85 | #define IO_PGTABLE_QUIRK_NON_STRICT BIT(5) | ||
| 86 | unsigned long quirks; | 82 | unsigned long quirks; |
| 87 | unsigned long pgsize_bitmap; | 83 | unsigned long pgsize_bitmap; |
| 88 | unsigned int ias; | 84 | unsigned int ias; |
| 89 | unsigned int oas; | 85 | unsigned int oas; |
| 86 | bool coherent_walk; | ||
| 90 | const struct iommu_gather_ops *tlb; | 87 | const struct iommu_gather_ops *tlb; |
| 91 | struct device *iommu_dev; | 88 | struct device *iommu_dev; |
| 92 | 89 | ||
| @@ -33,6 +33,7 @@ static inline int ioremap_page_range(unsigned long addr, unsigned long end, · 32 unmodified lines | |||
| 33 | 33 | ||
| 34 | #ifdef CONFIG_HAVE_ARCH_HUGE_VMAP | 34 | #ifdef CONFIG_HAVE_ARCH_HUGE_VMAP |
| 35 | void __init ioremap_huge_init(void); | 35 | void __init ioremap_huge_init(void); |
| 36 | int arch_ioremap_p4d_supported(void); | ||
| 36 | int arch_ioremap_pud_supported(void); | 37 | int arch_ioremap_pud_supported(void); |
| 37 | int arch_ioremap_pmd_supported(void); | 38 | int arch_ioremap_pmd_supported(void); |
| 38 | #else | 39 | #else |
| @@ -7,6 +7,7 @@ · 6 unmodified lines | |||
| 7 | #include <linux/mm.h> | 7 | #include <linux/mm.h> |
| 8 | #include <linux/types.h> | 8 | #include <linux/types.h> |
| 9 | #include <linux/mm_types.h> | 9 | #include <linux/mm_types.h> |
| 10 | #include <linux/blkdev.h> | ||
| 10 | 11 | ||
| 11 | struct address_space; | 12 | struct address_space; |
| 12 | struct fiemap_extent_info; | 13 | struct fiemap_extent_info; |
| @@ -35,6 +36,7 @@ struct vm_fault; · 22 unmodified lines | |||
| 35 | #define IOMAP_F_NEW 0x01 /* blocks have been newly allocated */ | 36 | #define IOMAP_F_NEW 0x01 /* blocks have been newly allocated */ |
| 36 | #define IOMAP_F_DIRTY 0x02 /* uncommitted metadata */ | 37 | #define IOMAP_F_DIRTY 0x02 /* uncommitted metadata */ |
| 37 | #define IOMAP_F_BUFFER_HEAD 0x04 /* file system requires buffer heads */ | 38 | #define IOMAP_F_BUFFER_HEAD 0x04 /* file system requires buffer heads */ |
| 39 | #define IOMAP_F_SIZE_CHANGED 0x08 /* file size has changed */ | ||
| 38 | 40 | ||
| 39 | /* | 41 | /* |
| 40 | * Flags that only need to be reported for IOMAP_REPORT requests: | 42 | * Flags that only need to be reported for IOMAP_REPORT requests: |
| @@ -68,6 +70,12 @@ struct iomap { · 27 unmodified lines | |||
| 68 | const struct iomap_page_ops *page_ops; | 70 | const struct iomap_page_ops *page_ops; |
| 69 | }; | 71 | }; |
| 70 | 72 | ||
| 73 | static inline sector_t | ||
| 74 | iomap_sector(struct iomap *iomap, loff_t pos) | ||
| 75 | { | ||
| 76 | return (iomap->addr + pos - iomap->offset) >> SECTOR_SHIFT; | ||
| 77 | } | ||
| 78 | |||
| 71 | /* | 79 | /* |
| 72 | * When a filesystem sets page_ops in an iomap mapping it returns, page_prepare | 80 | * When a filesystem sets page_ops in an iomap mapping it returns, page_prepare |
| 73 | * and page_done will be called for each page written to. This only applies to | 81 | * and page_done will be called for each page written to. This only applies to |
| @@ -114,6 +122,16 @@ struct iomap_ops { · 40 unmodified lines | |||
| 114 | ssize_t written, unsigned flags, struct iomap *iomap); | 122 | ssize_t written, unsigned flags, struct iomap *iomap); |
| 115 | }; | 123 | }; |
| 116 | 124 | ||
| 125 | /* | ||
| 126 | * Main iomap iterator function. | ||
| 127 | */ | ||
| 128 | typedef loff_t (*iomap_actor_t)(struct inode *inode, loff_t pos, loff_t len, | ||
| 129 | void *data, struct iomap *iomap); | ||
| 130 | |||
| 131 | loff_t iomap_apply(struct inode *inode, loff_t pos, loff_t length, | ||
| 132 | unsigned flags, const struct iomap_ops *ops, void *data, | ||
| 133 | iomap_actor_t actor); | ||
| 134 | |||
| 117 | /* | 135 | /* |
| 118 | * Structure allocate for each page when block size < PAGE_SIZE to track | 136 | * Structure allocate for each page when block size < PAGE_SIZE to track |
| 119 | * sub-page uptodate status and I/O completions. | 137 | * sub-page uptodate status and I/O completions. |
| @@ -13,6 +13,7 @@ · 12 unmodified lines | |||
| 13 | #include <linux/errno.h> | 13 | #include <linux/errno.h> |
| 14 | #include <linux/err.h> | 14 | #include <linux/err.h> |
| 15 | #include <linux/of.h> | 15 | #include <linux/of.h> |
| 16 | #include <uapi/linux/iommu.h> | ||
| 16 | 17 | ||
| 17 | #define IOMMU_READ (1 << 0) | 18 | #define IOMMU_READ (1 << 0) |
| 18 | #define IOMMU_WRITE (1 << 1) | 19 | #define IOMMU_WRITE (1 << 1) |
| @@ -29,6 +30,12 @@ · 10 unmodified lines | |||
| 29 | * if the IOMMU page table format is equivalent. | 30 | * if the IOMMU page table format is equivalent. |
| 30 | */ | 31 | */ |
| 31 | #define IOMMU_PRIV (1 << 5) | 32 | #define IOMMU_PRIV (1 << 5) |
| 33 | /* | ||
| 34 | * Non-coherent masters on few Qualcomm SoCs can use this page protection flag | ||
| 35 | * to set correct cacheability attributes to use an outer level of cache - | ||
| 36 | * last level cache, aka system cache. | ||
| 37 | */ | ||
| 38 | #define IOMMU_QCOM_SYS_CACHE (1 << 6) | ||
| 32 | 39 | ||
| 33 | struct iommu_ops; | 40 | struct iommu_ops; |
| 34 | struct iommu_group; | 41 | struct iommu_group; |
| @@ -37,6 +44,7 @@ struct device; · 2 unmodified lines | |||
| 37 | struct iommu_domain; | 44 | struct iommu_domain; |
| 38 | struct notifier_block; | 45 | struct notifier_block; |
| 39 | struct iommu_sva; | 46 | struct iommu_sva; |
| 47 | struct iommu_fault_event; | ||
| 40 | 48 | ||
| 41 | /* iommu fault flags */ | 49 | /* iommu fault flags */ |
| 42 | #define IOMMU_FAULT_READ 0x0 | 50 | #define IOMMU_FAULT_READ 0x0 |
| @@ -46,6 +54,7 @@ typedef int (*iommu_fault_handler_t)(struct iommu_domain *, · 3 unmodified lines | |||
| 46 | struct device *, unsigned long, int, void *); | 54 | struct device *, unsigned long, int, void *); |
| 47 | typedef int (*iommu_mm_exit_handler_t)(struct device *dev, struct iommu_sva *, | 55 | typedef int (*iommu_mm_exit_handler_t)(struct device *dev, struct iommu_sva *, |
| 48 | void *); | 56 | void *); |
| 57 | typedef int (*iommu_dev_fault_handler_t)(struct iommu_fault *, void *); | ||
| 49 | 58 | ||
| 50 | struct iommu_domain_geometry { | 59 | struct iommu_domain_geometry { |
| 51 | dma_addr_t aperture_start; /* First address that can be mapped */ | 60 | dma_addr_t aperture_start; /* First address that can be mapped */ |
| @@ -123,6 +132,12 @@ enum iommu_attr { · 71 unmodified lines | |||
| 123 | enum iommu_resv_type { | 132 | enum iommu_resv_type { |
| 124 | /* Memory regions which must be mapped 1:1 at all times */ | 133 | /* Memory regions which must be mapped 1:1 at all times */ |
| 125 | IOMMU_RESV_DIRECT, | 134 | IOMMU_RESV_DIRECT, |
| 135 | /* | ||
| 136 | * Memory regions which are advertised to be 1:1 but are | ||
| 137 | * commonly considered relaxable in some conditions, | ||
| 138 | * for instance in device assignment use case (USB, Graphics) | ||
| 139 | */ | ||
| 140 | IOMMU_RESV_DIRECT_RELAXABLE, | ||
| 126 | /* Arbitrary "never map this or give it to a device" address ranges */ | 141 | /* Arbitrary "never map this or give it to a device" address ranges */ |
| 127 | IOMMU_RESV_RESERVED, | 142 | IOMMU_RESV_RESERVED, |
| 128 | /* Hardware MSI region (untranslated) */ | 143 | /* Hardware MSI region (untranslated) */ |
| @@ -212,6 +227,7 @@ struct iommu_sva_ops { · 83 unmodified lines | |||
| 212 | * @sva_bind: Bind process address space to device | 227 | * @sva_bind: Bind process address space to device |
| 213 | * @sva_unbind: Unbind process address space from device | 228 | * @sva_unbind: Unbind process address space from device |
| 214 | * @sva_get_pasid: Get PASID associated to a SVA handle | 229 | * @sva_get_pasid: Get PASID associated to a SVA handle |
| 230 | * @page_response: handle page request response | ||
| 215 | * @pgsize_bitmap: bitmap of all possible supported page sizes | 231 | * @pgsize_bitmap: bitmap of all possible supported page sizes |
| 216 | */ | 232 | */ |
| 217 | struct iommu_ops { | 233 | struct iommu_ops { |
| @@ -272,6 +288,10 @@ struct iommu_ops { · 54 unmodified lines | |||
| 272 | void (*sva_unbind)(struct iommu_sva *handle); | 288 | void (*sva_unbind)(struct iommu_sva *handle); |
| 273 | int (*sva_get_pasid)(struct iommu_sva *handle); | 289 | int (*sva_get_pasid)(struct iommu_sva *handle); |
| 274 | 290 | ||
| 291 | int (*page_response)(struct device *dev, | ||
| 292 | struct iommu_fault_event *evt, | ||
| 293 | struct iommu_page_response *msg); | ||
| 294 | |||
| 275 | unsigned long pgsize_bitmap; | 295 | unsigned long pgsize_bitmap; |
| 276 | }; | 296 | }; |
| 277 | 297 | ||
| @@ -289,6 +309,48 @@ struct iommu_device { · 11 unmodified lines | |||
| 289 | struct device *dev; | 309 | struct device *dev; |
| 290 | }; | 310 | }; |
| 291 | 311 | ||
| 312 | /** | ||
| 313 | * struct iommu_fault_event - Generic fault event | ||
| 314 | * | ||
| 315 | * Can represent recoverable faults such as a page requests or | ||
| 316 | * unrecoverable faults such as DMA or IRQ remapping faults. | ||
| 317 | * | ||
| 318 | * @fault: fault descriptor | ||
| 319 | * @list: pending fault event list, used for tracking responses | ||
| 320 | */ | ||
| 321 | struct iommu_fault_event { | ||
| 322 | struct iommu_fault fault; | ||
| 323 | struct list_head list; | ||
| 324 | }; | ||
| 325 | |||
| 326 | /** | ||
| 327 | * struct iommu_fault_param - per-device IOMMU fault data | ||
| 328 | * @handler: Callback function to handle IOMMU faults at device level | ||
| 329 | * @data: handler private data | ||
| 330 | * @faults: holds the pending faults which needs response | ||
| 331 | * @lock: protect pending faults list | ||
| 332 | */ | ||
| 333 | struct iommu_fault_param { | ||
| 334 | iommu_dev_fault_handler_t handler; | ||
| 335 | void *data; | ||
| 336 | struct list_head faults; | ||
| 337 | struct mutex lock; | ||
| 338 | }; | ||
| 339 | |||
| 340 | /** | ||
| 341 | * struct iommu_param - collection of per-device IOMMU data | ||
| 342 | * | ||
| 343 | * @fault_param: IOMMU detected device fault reporting data | ||
| 344 | * | ||
| 345 | * TODO: migrate other per device data pointers under iommu_dev_data, e.g. | ||
| 346 | * struct iommu_group *iommu_group; | ||
| 347 | * struct iommu_fwspec *iommu_fwspec; | ||
| 348 | */ | ||
| 349 | struct iommu_param { | ||
| 350 | struct mutex lock; | ||
| 351 | struct iommu_fault_param *fault_param; | ||
| 352 | }; | ||
| 353 | |||
| 292 | int iommu_device_register(struct iommu_device *iommu); | 354 | int iommu_device_register(struct iommu_device *iommu); |
| 293 | void iommu_device_unregister(struct iommu_device *iommu); | 355 | void iommu_device_unregister(struct iommu_device *iommu); |
| 294 | int iommu_device_sysfs_add(struct iommu_device *iommu, | 356 | int iommu_device_sysfs_add(struct iommu_device *iommu, |
| @@ -350,6 +412,7 @@ extern void iommu_set_fault_handler(struct iommu_domain *domain, · 55 unmodified lines | |||
| 350 | extern void iommu_get_resv_regions(struct device *dev, struct list_head *list); | 412 | extern void iommu_get_resv_regions(struct device *dev, struct list_head *list); |
| 351 | extern void iommu_put_resv_regions(struct device *dev, struct list_head *list); | 413 | extern void iommu_put_resv_regions(struct device *dev, struct list_head *list); |
| 352 | extern int iommu_request_dm_for_dev(struct device *dev); | 414 | extern int iommu_request_dm_for_dev(struct device *dev); |
| 415 | extern int iommu_request_dma_domain_for_dev(struct device *dev); | ||
| 353 | extern struct iommu_resv_region * | 416 | extern struct iommu_resv_region * |
| 354 | iommu_alloc_resv_region(phys_addr_t start, size_t length, int prot, | 417 | iommu_alloc_resv_region(phys_addr_t start, size_t length, int prot, |
| 355 | enum iommu_resv_type type); | 418 | enum iommu_resv_type type); |
| @@ -378,6 +441,17 @@ extern int iommu_group_register_notifier(struct iommu_group *group, · 22 unmodified lines | |||
| 378 | struct notifier_block *nb); | 441 | struct notifier_block *nb); |
| 379 | extern int iommu_group_unregister_notifier(struct iommu_group *group, | 442 | extern int iommu_group_unregister_notifier(struct iommu_group *group, |
| 380 | struct notifier_block *nb); | 443 | struct notifier_block *nb); |
| 444 | extern int iommu_register_device_fault_handler(struct device *dev, | ||
| 445 | iommu_dev_fault_handler_t handler, | ||
| 446 | void *data); | ||
| 447 | |||
| 448 | extern int iommu_unregister_device_fault_handler(struct device *dev); | ||
| 449 | |||
| 450 | extern int iommu_report_device_fault(struct device *dev, | ||
| 451 | struct iommu_fault_event *evt); | ||
| 452 | extern int iommu_page_response(struct device *dev, | ||
| 453 | struct iommu_page_response *msg); | ||
| 454 | |||
| 381 | extern int iommu_group_id(struct iommu_group *group); | 455 | extern int iommu_group_id(struct iommu_group *group); |
| 382 | extern struct iommu_group *iommu_group_get_for_dev(struct device *dev); | 456 | extern struct iommu_group *iommu_group_get_for_dev(struct device *dev); |
| 383 | extern struct iommu_domain *iommu_group_default_domain(struct iommu_group *); | 457 | extern struct iommu_domain *iommu_group_default_domain(struct iommu_group *); |
| @@ -492,6 +566,7 @@ struct iommu_ops {}; · 108 unmodified lines | |||
| 492 | struct iommu_group {}; | 566 | struct iommu_group {}; |
| 493 | struct iommu_fwspec {}; | 567 | struct iommu_fwspec {}; |
| 494 | struct iommu_device {}; | 568 | struct iommu_device {}; |
| 569 | struct iommu_fault_param {}; | ||
| 495 | 570 | ||
| 496 | static inline bool iommu_present(struct bus_type *bus) | 571 | static inline bool iommu_present(struct bus_type *bus) |
| 497 | { | 572 | { |
| @@ -614,6 +689,11 @@ static inline int iommu_request_dm_for_dev(struct device *dev) · 116 unmodified lines | |||
| 614 | return -ENODEV; | 689 | return -ENODEV; |
| 615 | } | 690 | } |
| 616 | 691 | ||
| 692 | static inline int iommu_request_dma_domain_for_dev(struct device *dev) | ||
| 693 | { | ||
| 694 | return -ENODEV; | ||
| 695 | } | ||
| 696 | |||
| 617 | static inline int iommu_attach_group(struct iommu_domain *domain, | 697 | static inline int iommu_attach_group(struct iommu_domain *domain, |
| 618 | struct iommu_group *group) | 698 | struct iommu_group *group) |
| 619 | { | 699 | { |
| @@ -685,6 +765,31 @@ static inline int iommu_group_unregister_notifier(struct iommu_group *group, · 65 unmodified lines | |||
| 685 | return 0; | 765 | return 0; |
| 686 | } | 766 | } |
| 687 | 767 | ||
| 768 | static inline | ||
| 769 | int iommu_register_device_fault_handler(struct device *dev, | ||
| 770 | iommu_dev_fault_handler_t handler, | ||
| 771 | void *data) | ||
| 772 | { | ||
| 773 | return -ENODEV; | ||
| 774 | } | ||
| 775 | |||
| 776 | static inline int iommu_unregister_device_fault_handler(struct device *dev) | ||
| 777 | { | ||
| 778 | return 0; | ||
| 779 | } | ||
| 780 | |||
| 781 | static inline | ||
| 782 | int iommu_report_device_fault(struct device *dev, struct iommu_fault_event *evt) | ||
| 783 | { | ||
| 784 | return -ENODEV; | ||
| 785 | } | ||
| 786 | |||
| 787 | static inline int iommu_page_response(struct device *dev, | ||
| 788 | struct iommu_page_response *msg) | ||
| 789 | { | ||
| 790 | return -ENODEV; | ||
| 791 | } | ||
| 792 | |||
| 688 | static inline int iommu_group_id(struct iommu_group *group) | 793 | static inline int iommu_group_id(struct iommu_group *group) |
| 689 | { | 794 | { |
| 690 | return -ENODEV; | 795 | return -ENODEV; |
| @@ -21,7 +21,7 @@ · 20 unmodified lines | |||
| 21 | * @cond: Break condition (usually involving @val) | 21 | * @cond: Break condition (usually involving @val) |
| 22 | * @sleep_us: Maximum time to sleep between reads in us (0 | 22 | * @sleep_us: Maximum time to sleep between reads in us (0 |
| 23 | * tight-loops). Should be less than ~20ms since usleep_range | 23 | * tight-loops). Should be less than ~20ms since usleep_range |
| 24 | * is used (see Documentation/timers/timers-howto.txt). | 24 | * is used (see Documentation/timers/timers-howto.rst). |
| 25 | * @timeout_us: Timeout in us, 0 means never timeout | 25 | * @timeout_us: Timeout in us, 0 means never timeout |
| 26 | * | 26 | * |
| 27 | * Returns 0 on success and -ETIMEDOUT upon a timeout. In either | 27 | * Returns 0 on success and -ETIMEDOUT upon a timeout. In either |
| @@ -60,7 +60,7 @@ · 32 unmodified lines | |||
| 60 | * @cond: Break condition (usually involving @val) | 60 | * @cond: Break condition (usually involving @val) |
| 61 | * @delay_us: Time to udelay between reads in us (0 tight-loops). Should | 61 | * @delay_us: Time to udelay between reads in us (0 tight-loops). Should |
| 62 | * be less than ~10us since udelay is used (see | 62 | * be less than ~10us since udelay is used (see |
| 63 | * Documentation/timers/timers-howto.txt). | 63 | * Documentation/timers/timers-howto.rst). |
| 64 | * @timeout_us: Timeout in us, 0 means never timeout | 64 | * @timeout_us: Timeout in us, 0 means never timeout |
| 65 | * | 65 | * |
| 66 | * Returns 0 on success and -ETIMEDOUT upon a timeout. In either | 66 | * Returns 0 on success and -ETIMEDOUT upon a timeout. In either |
| @@ -12,6 +12,7 @@ · 11 unmodified lines | |||
| 12 | #ifndef __ASSEMBLY__ | 12 | #ifndef __ASSEMBLY__ |
| 13 | #include <linux/compiler.h> | 13 | #include <linux/compiler.h> |
| 14 | #include <linux/types.h> | 14 | #include <linux/types.h> |
| 15 | #include <linux/bits.h> | ||
| 15 | /* | 16 | /* |
| 16 | * Resources are tree-like, allowing | 17 | * Resources are tree-like, allowing |
| 17 | * nesting etc.. | 18 | * nesting etc.. |
| @@ -132,7 +133,15 @@ enum { · 114 unmodified lines | |||
| 132 | IORES_DESC_PERSISTENT_MEMORY = 4, | 133 | IORES_DESC_PERSISTENT_MEMORY = 4, |
| 133 | IORES_DESC_PERSISTENT_MEMORY_LEGACY = 5, | 134 | IORES_DESC_PERSISTENT_MEMORY_LEGACY = 5, |
| 134 | IORES_DESC_DEVICE_PRIVATE_MEMORY = 6, | 135 | IORES_DESC_DEVICE_PRIVATE_MEMORY = 6, |
| 135 | IORES_DESC_DEVICE_PUBLIC_MEMORY = 7, | 136 | IORES_DESC_RESERVED = 7, |
| 137 | }; | ||
| 138 | |||
| 139 | /* | ||
| 140 | * Flags controlling ioremap() behavior. | ||
| 141 | */ | ||
| 142 | enum { | ||
| 143 | IORES_MAP_SYSTEM_RAM = BIT(0), | ||
| 144 | IORES_MAP_ENCRYPTED = BIT(1), | ||
| 136 | }; | 145 | }; |
| 137 | 146 | ||
| 138 | /* helpers to define resources */ | 147 | /* helpers to define resources */ |
| @@ -286,6 +295,8 @@ static inline bool resource_overlaps(struct resource *r1, struct resource *r2) · 147 unmodified lines | |||
| 286 | return (r1->start <= r2->end && r1->end >= r2->start); | 295 | return (r1->start <= r2->end && r1->end >= r2->start); |
| 287 | } | 296 | } |
| 288 | 297 | ||
| 298 | struct resource *devm_request_free_mem_region(struct device *dev, | ||
| 299 | struct resource *base, unsigned long size); | ||
| 289 | 300 | ||
| 290 | #endif /* __ASSEMBLY__ */ | 301 | #endif /* __ASSEMBLY__ */ |
| 291 | #endif /* _LINUX_IOPORT_H */ | 302 | #endif /* _LINUX_IOPORT_H */ |
| @@ -155,6 +155,7 @@ struct iova *reserve_iova(struct iova_domain *iovad, unsigned long pfn_lo, · 154 unmodified lines | |||
| 155 | void copy_reserved_iova(struct iova_domain *from, struct iova_domain *to); | 155 | void copy_reserved_iova(struct iova_domain *from, struct iova_domain *to); |
| 156 | void init_iova_domain(struct iova_domain *iovad, unsigned long granule, | 156 | void init_iova_domain(struct iova_domain *iovad, unsigned long granule, |
| 157 | unsigned long start_pfn); | 157 | unsigned long start_pfn); |
| 158 | bool has_iova_flush_queue(struct iova_domain *iovad); | ||
| 158 | int init_iova_flush_queue(struct iova_domain *iovad, | 159 | int init_iova_flush_queue(struct iova_domain *iovad, |
| 159 | iova_flush_cb flush_cb, iova_entry_dtor entry_dtor); | 160 | iova_flush_cb flush_cb, iova_entry_dtor entry_dtor); |
| 160 | struct iova *find_iova(struct iova_domain *iovad, unsigned long pfn); | 161 | struct iova *find_iova(struct iova_domain *iovad, unsigned long pfn); |
| @@ -235,6 +236,11 @@ static inline void init_iova_domain(struct iova_domain *iovad, · 74 unmodified lines | |||
| 235 | { | 236 | { |
| 236 | } | 237 | } |
| 237 | 238 | ||
| 239 | static inline bool has_iova_flush_queue(struct iova_domain *iovad) | ||
| 240 | { | ||
| 241 | return false; | ||
| 242 | } | ||
| 243 | |||
| 238 | static inline int init_iova_flush_queue(struct iova_domain *iovad, | 244 | static inline int init_iova_flush_queue(struct iova_domain *iovad, |
| 239 | iova_flush_cb flush_cb, | 245 | iova_flush_cb flush_cb, |
| 240 | iova_entry_dtor entry_dtor) | 246 | iova_entry_dtor entry_dtor) |
| @@ -36,4 +36,9 @@ struct gic_kvm_info { · 35 unmodified lines | |||
| 36 | 36 | ||
| 37 | const struct gic_kvm_info *gic_get_kvm_info(void); | 37 | const struct gic_kvm_info *gic_get_kvm_info(void); |
| 38 | 38 | ||
| 39 | struct irq_domain; | ||
| 40 | struct fwnode_handle; | ||
| 41 | int gicv2m_init(struct fwnode_handle *parent_handle, | ||
| 42 | struct irq_domain *parent); | ||
| 43 | |||
| 39 | #endif /* __LINUX_IRQCHIP_ARM_GIC_COMMON_H */ | 44 | #endif /* __LINUX_IRQCHIP_ARM_GIC_COMMON_H */ |
| @@ -157,9 +157,6 @@ int gic_of_init_child(struct device *dev, struct gic_chip_data **gic, int irq); · 156 unmodified lines | |||
| 157 | */ | 157 | */ |
| 158 | void gic_init(void __iomem *dist , void __iomem *cpu); | 158 | void gic_init(void __iomem *dist , void __iomem *cpu); |
| 159 | 159 | ||
| 160 | int gicv2m_init(struct fwnode_handle *parent_handle, | ||
| 161 | struct irq_domain *parent); | ||
| 162 | |||
| 163 | void gic_send_sgi(unsigned int cpu_id, unsigned int irq); | 160 | void gic_send_sgi(unsigned int cpu_id, unsigned int irq); |
| 164 | int gic_get_cpu_id(unsigned int cpu); | 161 | int gic_get_cpu_id(unsigned int cpu); |
| 165 | void gic_migrate_target(unsigned int new_cpu_id); | 162 | void gic_migrate_target(unsigned int new_cpu_id); |
| @@ -1,473 +0,0 @@ | |||
| 1 | /* $Id: isdn.h,v 1.125.2.3 2004/02/10 01:07:14 keil Exp $ | ||
| 2 | * | ||
| 3 | * Main header for the Linux ISDN subsystem (linklevel). | ||
| 4 | * | ||
| 5 | * Copyright 1994,95,96 by Fritz Elfert (fritz@isdn4linux.de) | ||
| 6 | * Copyright 1995,96 by Thinking Objects Software GmbH Wuerzburg | ||
| 7 | * Copyright 1995,96 by Michael Hipp (Michael.Hipp@student.uni-tuebingen.de) | ||
| 8 | * | ||
| 9 | * This software may be used and distributed according to the terms | ||
| 10 | * of the GNU General Public License, incorporated herein by reference. | ||
| 11 | * | ||
| 12 | */ | ||
| 13 | #ifndef __ISDN_H__ | ||
| 14 | #define __ISDN_H__ | ||
| 15 | |||
| 16 | |||
| 17 | #include <linux/errno.h> | ||
| 18 | #include <linux/fs.h> | ||
| 19 | #include <linux/major.h> | ||
| 20 | #include <asm/io.h> | ||
| 21 | #include <linux/kernel.h> | ||
| 22 | #include <linux/signal.h> | ||
| 23 | #include <linux/slab.h> | ||
| 24 | #include <linux/timer.h> | ||
| 25 | #include <linux/wait.h> | ||
| 26 | #include <linux/tty.h> | ||
| 27 | #include <linux/tty_flip.h> | ||
| 28 | #include <linux/serial_reg.h> | ||
| 29 | #include <linux/fcntl.h> | ||
| 30 | #include <linux/types.h> | ||
| 31 | #include <linux/interrupt.h> | ||
| 32 | #include <linux/ip.h> | ||
| 33 | #include <linux/in.h> | ||
| 34 | #include <linux/netdevice.h> | ||
| 35 | #include <linux/etherdevice.h> | ||
| 36 | #include <linux/skbuff.h> | ||
| 37 | #include <linux/tcp.h> | ||
| 38 | #include <linux/mutex.h> | ||
| 39 | #include <uapi/linux/isdn.h> | ||
| 40 | |||
| 41 | #define ISDN_TTY_MAJOR 43 | ||
| 42 | #define ISDN_TTYAUX_MAJOR 44 | ||
| 43 | #define ISDN_MAJOR 45 | ||
| 44 | |||
| 45 | /* The minor-devicenumbers for Channel 0 and 1 are used as arguments for | ||
| 46 | * physical Channel-Mapping, so they MUST NOT be changed without changing | ||
| 47 | * the correspondent code in isdn.c | ||
| 48 | */ | ||
| 49 | |||
| 50 | #define ISDN_MINOR_B 0 | ||
| 51 | #define ISDN_MINOR_BMAX (ISDN_MAX_CHANNELS-1) | ||
| 52 | #define ISDN_MINOR_CTRL 64 | ||
| 53 | #define ISDN_MINOR_CTRLMAX (64 + (ISDN_MAX_CHANNELS-1)) | ||
| 54 | #define ISDN_MINOR_PPP 128 | ||
| 55 | #define ISDN_MINOR_PPPMAX (128 + (ISDN_MAX_CHANNELS-1)) | ||
| 56 | #define ISDN_MINOR_STATUS 255 | ||
| 57 | |||
| 58 | #ifdef CONFIG_ISDN_PPP | ||
| 59 | |||
| 60 | #ifdef CONFIG_ISDN_PPP_VJ | ||
| 61 | # include <net/slhc_vj.h> | ||
| 62 | #endif | ||
| 63 | |||
| 64 | #include <linux/ppp_defs.h> | ||
| 65 | #include <linux/ppp-ioctl.h> | ||
| 66 | |||
| 67 | #include <linux/isdn_ppp.h> | ||
| 68 | #endif | ||
| 69 | |||
| 70 | #ifdef CONFIG_ISDN_X25 | ||
| 71 | # include <linux/concap.h> | ||
| 72 | #endif | ||
| 73 | |||
| 74 | #include <linux/isdnif.h> | ||
| 75 | |||
| 76 | #define ISDN_DRVIOCTL_MASK 0x7f /* Mask for Device-ioctl */ | ||
| 77 | |||
| 78 | /* Until now unused */ | ||
| 79 | #define ISDN_SERVICE_VOICE 1 | ||
| 80 | #define ISDN_SERVICE_AB 1<<1 | ||
| 81 | #define ISDN_SERVICE_X21 1<<2 | ||
| 82 | #define ISDN_SERVICE_G4 1<<3 | ||
| 83 | #define ISDN_SERVICE_BTX 1<<4 | ||
| 84 | #define ISDN_SERVICE_DFUE 1<<5 | ||
| 85 | #define ISDN_SERVICE_X25 1<<6 | ||
| 86 | #define ISDN_SERVICE_TTX 1<<7 | ||
| 87 | #define ISDN_SERVICE_MIXED 1<<8 | ||
| 88 | #define ISDN_SERVICE_FW 1<<9 | ||
| 89 | #define ISDN_SERVICE_GTEL 1<<10 | ||
| 90 | #define ISDN_SERVICE_BTXN 1<<11 | ||
| 91 | #define ISDN_SERVICE_BTEL 1<<12 | ||
| 92 | |||
| 93 | /* Macros checking plain usage */ | ||
| 94 | #define USG_NONE(x) ((x & ISDN_USAGE_MASK)==ISDN_USAGE_NONE) | ||
| 95 | #define USG_RAW(x) ((x & ISDN_USAGE_MASK)==ISDN_USAGE_RAW) | ||
| 96 | #define USG_MODEM(x) ((x & ISDN_USAGE_MASK)==ISDN_USAGE_MODEM) | ||
| 97 | #define USG_VOICE(x) ((x & ISDN_USAGE_MASK)==ISDN_USAGE_VOICE) | ||
| 98 | #define USG_NET(x) ((x & ISDN_USAGE_MASK)==ISDN_USAGE_NET) | ||
| 99 | #define USG_FAX(x) ((x & ISDN_USAGE_MASK)==ISDN_USAGE_FAX) | ||
| 100 | #define USG_OUTGOING(x) ((x & ISDN_USAGE_OUTGOING)==ISDN_USAGE_OUTGOING) | ||
| 101 | #define USG_MODEMORVOICE(x) (((x & ISDN_USAGE_MASK)==ISDN_USAGE_MODEM) || \ | ||
| 102 | ((x & ISDN_USAGE_MASK)==ISDN_USAGE_VOICE) ) | ||
| 103 | |||
| 104 | /* Timer-delays and scheduling-flags */ | ||
| 105 | #define ISDN_TIMER_RES 4 /* Main Timer-Resolution */ | ||
| 106 | #define ISDN_TIMER_02SEC (HZ/ISDN_TIMER_RES/5) /* Slow-Timer1 .2 sec */ | ||
| 107 | #define ISDN_TIMER_1SEC (HZ/ISDN_TIMER_RES) /* Slow-Timer2 1 sec */ | ||
| 108 | #define ISDN_TIMER_RINGING 5 /* tty RINGs = ISDN_TIMER_1SEC * this factor */ | ||
| 109 | #define ISDN_TIMER_KEEPINT 10 /* Cisco-Keepalive = ISDN_TIMER_1SEC * this factor */ | ||
| 110 | #define ISDN_TIMER_MODEMREAD 1 | ||
| 111 | #define ISDN_TIMER_MODEMPLUS 2 | ||
| 112 | #define ISDN_TIMER_MODEMRING 4 | ||
| 113 | #define ISDN_TIMER_MODEMXMIT 8 | ||
| 114 | #define ISDN_TIMER_NETDIAL 16 | ||
| 115 | #define ISDN_TIMER_NETHANGUP 32 | ||
| 116 | #define ISDN_TIMER_CARRIER 256 /* Wait for Carrier */ | ||
| 117 | #define ISDN_TIMER_FAST (ISDN_TIMER_MODEMREAD | ISDN_TIMER_MODEMPLUS | \ | ||
| 118 | ISDN_TIMER_MODEMXMIT) | ||
| 119 | #define ISDN_TIMER_SLOW (ISDN_TIMER_MODEMRING | ISDN_TIMER_NETHANGUP | \ | ||
| 120 | ISDN_TIMER_NETDIAL | ISDN_TIMER_CARRIER) | ||
| 121 | |||
| 122 | /* Timeout-Values for isdn_net_dial() */ | ||
| 123 | #define ISDN_TIMER_DTIMEOUT10 (10*HZ/(ISDN_TIMER_02SEC*(ISDN_TIMER_RES+1))) | ||
| 124 | #define ISDN_TIMER_DTIMEOUT15 (15*HZ/(ISDN_TIMER_02SEC*(ISDN_TIMER_RES+1))) | ||
| 125 | #define ISDN_TIMER_DTIMEOUT60 (60*HZ/(ISDN_TIMER_02SEC*(ISDN_TIMER_RES+1))) | ||
| 126 | |||
| 127 | /* GLOBAL_FLAGS */ | ||
| 128 | #define ISDN_GLOBAL_STOPPED 1 | ||
| 129 | |||
| 130 | /*=================== Start of ip-over-ISDN stuff =========================*/ | ||
| 131 | |||
| 132 | /* Feature- and status-flags for a net-interface */ | ||
| 133 | #define ISDN_NET_CONNECTED 0x01 /* Bound to ISDN-Channel */ | ||
| 134 | #define ISDN_NET_SECURE 0x02 /* Accept calls from phonelist only */ | ||
| 135 | #define ISDN_NET_CALLBACK 0x04 /* activate callback */ | ||
| 136 | #define ISDN_NET_CBHUP 0x08 /* hangup before callback */ | ||
| 137 | #define ISDN_NET_CBOUT 0x10 /* remote machine does callback */ | ||
| 138 | |||
| 139 | #define ISDN_NET_MAGIC 0x49344C02 /* for paranoia-checking */ | ||
| 140 | |||
| 141 | /* Phone-list-element */ | ||
| 142 | typedef struct { | ||
| 143 | void *next; | ||
| 144 | char num[ISDN_MSNLEN]; | ||
| 145 | } isdn_net_phone; | ||
| 146 | |||
| 147 | /* | ||
| 148 | Principles when extending structures for generic encapsulation protocol | ||
| 149 | ("concap") support: | ||
| 150 | - Stuff which is hardware specific (here i4l-specific) goes in | ||
| 151 | the netdev -> local structure (here: isdn_net_local) | ||
| 152 | - Stuff which is encapsulation protocol specific goes in the structure | ||
| 153 | which holds the linux device structure (here: isdn_net_device) | ||
| 154 | */ | ||
| 155 | |||
| 156 | /* Local interface-data */ | ||
| 157 | typedef struct isdn_net_local_s { | ||
| 158 | ulong magic; | ||
| 159 | struct net_device_stats stats; /* Ethernet Statistics */ | ||
| 160 | int isdn_device; /* Index to isdn-device */ | ||
| 161 | int isdn_channel; /* Index to isdn-channel */ | ||
| 162 | int ppp_slot; /* PPPD device slot number */ | ||
| 163 | int pre_device; /* Preselected isdn-device */ | ||
| 164 | int pre_channel; /* Preselected isdn-channel */ | ||
| 165 | int exclusive; /* If non-zero idx to reserved chan.*/ | ||
| 166 | int flags; /* Connection-flags */ | ||
| 167 | int dialretry; /* Counter for Dialout-retries */ | ||
| 168 | int dialmax; /* Max. Number of Dial-retries */ | ||
| 169 | int cbdelay; /* Delay before Callback starts */ | ||
| 170 | int dtimer; /* Timeout-counter for dialing */ | ||
| 171 | char msn[ISDN_MSNLEN]; /* MSNs/EAZs for this interface */ | ||
| 172 | u_char cbhup; /* Flag: Reject Call before Callback*/ | ||
| 173 | u_char dialstate; /* State for dialing */ | ||
| 174 | u_char p_encap; /* Packet encapsulation */ | ||
| 175 | /* 0 = Ethernet over ISDN */ | ||
| 176 | /* 1 = RAW-IP */ | ||
| 177 | /* 2 = IP with type field */ | ||
| 178 | u_char l2_proto; /* Layer-2-protocol */ | ||
| 179 | /* See ISDN_PROTO_L2..-constants in */ | ||
| 180 | /* isdnif.h */ | ||
| 181 | /* 0 = X75/LAPB with I-Frames */ | ||
| 182 | /* 1 = X75/LAPB with UI-Frames */ | ||
| 183 | /* 2 = X75/LAPB with BUI-Frames */ | ||
| 184 | /* 3 = HDLC */ | ||
| 185 | u_char l3_proto; /* Layer-3-protocol */ | ||
| 186 | /* See ISDN_PROTO_L3..-constants in */ | ||
| 187 | /* isdnif.h */ | ||
| 188 | /* 0 = Transparent */ | ||
| 189 | int huptimer; /* Timeout-counter for auto-hangup */ | ||
| 190 | int charge; /* Counter for charging units */ | ||
| 191 | ulong chargetime; /* Timer for Charging info */ | ||
| 192 | int hupflags; /* Flags for charge-unit-hangup: */ | ||
| 193 | /* bit0: chargeint is invalid */ | ||
| 194 | /* bit1: Getting charge-interval */ | ||
| 195 | /* bit2: Do charge-unit-hangup */ | ||
| 196 | /* bit3: Do hangup even on incoming */ | ||
| 197 | int outgoing; /* Flag: outgoing call */ | ||
| 198 | int onhtime; /* Time to keep link up */ | ||
| 199 | int chargeint; /* Interval between charge-infos */ | ||
| 200 | int onum; /* Flag: at least 1 outgoing number */ | ||
| 201 | int cps; /* current speed of this interface */ | ||
| 202 | int transcount; /* byte-counter for cps-calculation */ | ||
| 203 | int sqfull; /* Flag: netdev-queue overloaded */ | ||
| 204 | ulong sqfull_stamp; /* Start-Time of overload */ | ||
| 205 | ulong slavedelay; /* Dynamic bundling delaytime */ | ||
| 206 | int triggercps; /* BogoCPS needed for trigger slave */ | ||
| 207 | isdn_net_phone *phone[2]; /* List of remote-phonenumbers */ | ||
| 208 | /* phone[0] = Incoming Numbers */ | ||
| 209 | /* phone[1] = Outgoing Numbers */ | ||
| 210 | isdn_net_phone *dial; /* Pointer to dialed number */ | ||
| 211 | struct net_device *master; /* Ptr to Master device for slaves */ | ||
| 212 | struct net_device *slave; /* Ptr to Slave device for masters */ | ||
| 213 | struct isdn_net_local_s *next; /* Ptr to next link in bundle */ | ||
| 214 | struct isdn_net_local_s *last; /* Ptr to last link in bundle */ | ||
| 215 | struct isdn_net_dev_s *netdev; /* Ptr to netdev */ | ||
| 216 | struct sk_buff_head super_tx_queue; /* List of supervisory frames to */ | ||
| 217 | /* be transmitted asap */ | ||
| 218 | atomic_t frame_cnt; /* number of frames currently */ | ||
| 219 | /* queued in HL driver */ | ||
| 220 | /* Ptr to orig. hard_header_cache */ | ||
| 221 | spinlock_t xmit_lock; /* used to protect the xmit path of */ | ||
| 222 | /* a particular channel (including */ | ||
| 223 | /* the frame_cnt */ | ||
| 224 | |||
| 225 | int pppbind; /* ippp device for bindings */ | ||
| 226 | int dialtimeout; /* How long shall we try on dialing? (jiffies) */ | ||
| 227 | int dialwait; /* How long shall we wait after failed attempt? (jiffies) */ | ||
| 228 | ulong dialstarted; /* jiffies of first dialing-attempt */ | ||
| 229 | ulong dialwait_timer; /* jiffies of earliest next dialing-attempt */ | ||
| 230 | int huptimeout; /* How long will the connection be up? (seconds) */ | ||
| 231 | #ifdef CONFIG_ISDN_X25 | ||
| 232 | struct concap_device_ops *dops; /* callbacks used by encapsulator */ | ||
| 233 | #endif | ||
| 234 | /* use an own struct for that in later versions */ | ||
| 235 | ulong cisco_myseq; /* Local keepalive seq. for Cisco */ | ||
| 236 | ulong cisco_mineseen; /* returned keepalive seq. from remote */ | ||
| 237 | ulong cisco_yourseq; /* Remote keepalive seq. for Cisco */ | ||
| 238 | int cisco_keepalive_period; /* keepalive period */ | ||
| 239 | ulong cisco_last_slarp_in; /* jiffie of last keepalive packet we received */ | ||
| 240 | char cisco_line_state; /* state of line according to keepalive packets */ | ||
| 241 | char cisco_debserint; /* debugging flag of cisco hdlc with slarp */ | ||
| 242 | struct timer_list cisco_timer; | ||
| 243 | struct work_struct tqueue; | ||
| 244 | } isdn_net_local; | ||
| 245 | |||
| 246 | /* the interface itself */ | ||
| 247 | typedef struct isdn_net_dev_s { | ||
| 248 | isdn_net_local *local; | ||
| 249 | isdn_net_local *queue; /* circular list of all bundled | ||
| 250 | channels, which are currently | ||
| 251 | online */ | ||
| 252 | spinlock_t queue_lock; /* lock to protect queue */ | ||
| 253 | void *next; /* Pointer to next isdn-interface */ | ||
| 254 | struct net_device *dev; /* interface to upper levels */ | ||
| 255 | #ifdef CONFIG_ISDN_PPP | ||
| 256 | ippp_bundle * pb; /* pointer to the common bundle structure | ||
| 257 | * with the per-bundle data */ | ||
| 258 | #endif | ||
| 259 | #ifdef CONFIG_ISDN_X25 | ||
| 260 | struct concap_proto *cprot; /* connection oriented encapsulation protocol */ | ||
| 261 | #endif | ||
| 262 | |||
| 263 | } isdn_net_dev; | ||
| 264 | |||
| 265 | /*===================== End of ip-over-ISDN stuff ===========================*/ | ||
| 266 | |||
| 267 | /*======================= Start of ISDN-tty stuff ===========================*/ | ||
| 268 | |||
| 269 | #define ISDN_ASYNC_MAGIC 0x49344C01 /* for paranoia-checking */ | ||
| 270 | #define ISDN_SERIAL_XMIT_SIZE 1024 /* Default bufsize for write */ | ||
| 271 | #define ISDN_SERIAL_XMIT_MAX 4000 /* Maximum bufsize for write */ | ||
| 272 | |||
| 273 | #ifdef CONFIG_ISDN_AUDIO | ||
| 274 | /* For using sk_buffs with audio we need some private variables | ||
| 275 | * within each sk_buff. For this purpose, we declare a struct here, | ||
| 276 | * and put it always at the private skb->cb data array. A few macros help | ||
| 277 | * accessing the variables. | ||
| 278 | */ | ||
| 279 | typedef struct _isdn_audio_data { | ||
| 280 | unsigned short dle_count; | ||
| 281 | unsigned char lock; | ||
| 282 | } isdn_audio_data_t; | ||
| 283 | |||
| 284 | #define ISDN_AUDIO_SKB_DLECOUNT(skb) (((isdn_audio_data_t *)&skb->cb[0])->dle_count) | ||
| 285 | #define ISDN_AUDIO_SKB_LOCK(skb) (((isdn_audio_data_t *)&skb->cb[0])->lock) | ||
| 286 | #endif | ||
| 287 | |||
| 288 | /* Private data of AT-command-interpreter */ | ||
| 289 | typedef struct atemu { | ||
| 290 | u_char profile[ISDN_MODEM_NUMREG]; /* Modem-Regs. Profile 0 */ | ||
| 291 | u_char mdmreg[ISDN_MODEM_NUMREG]; /* Modem-Registers */ | ||
| 292 | char pmsn[ISDN_MSNLEN]; /* EAZ/MSNs Profile 0 */ | ||
| 293 | char msn[ISDN_MSNLEN]; /* EAZ/MSN */ | ||
| 294 | char plmsn[ISDN_LMSNLEN]; /* Listening MSNs Profile 0 */ | ||
| 295 | char lmsn[ISDN_LMSNLEN]; /* Listening MSNs */ | ||
| 296 | char cpn[ISDN_MSNLEN]; /* CalledPartyNumber on incoming call */ | ||
| 297 | char connmsg[ISDN_CMSGLEN]; /* CONNECT-Msg from HL-Driver */ | ||
| 298 | #ifdef CONFIG_ISDN_AUDIO | ||
| 299 | u_char vpar[10]; /* Voice-parameters */ | ||
| 300 | int lastDLE; /* Flag for voice-coding: DLE seen */ | ||
| 301 | #endif | ||
| 302 | int mdmcmdl; /* Length of Modem-Commandbuffer */ | ||
| 303 | int pluscount; /* Counter for +++ sequence */ | ||
| 304 | u_long lastplus; /* Timestamp of last + */ | ||
| 305 | int carrierwait; /* Seconds of carrier waiting */ | ||
| 306 | char mdmcmd[255]; /* Modem-Commandbuffer */ | ||
| 307 | unsigned int charge; /* Charge units of current connection */ | ||
| 308 | } atemu; | ||
| 309 | |||
| 310 | /* Private data (similar to async_struct in <linux/serial.h>) */ | ||
| 311 | typedef struct modem_info { | ||
| 312 | int magic; | ||
| 313 | struct tty_port port; | ||
| 314 | int x_char; /* xon/xoff character */ | ||
| 315 | int mcr; /* Modem control register */ | ||
| 316 | int msr; /* Modem status register */ | ||
| 317 | int lsr; /* Line status register */ | ||
| 318 | int line; | ||
| 319 | int online; /* 1 = B-Channel is up, drop data */ | ||
| 320 | /* 2 = B-Channel is up, deliver d.*/ | ||
| 321 | int dialing; /* Dial in progress or ATA */ | ||
| 322 | int closing; | ||
| 323 | int rcvsched; /* Receive needs schedule */ | ||
| 324 | int isdn_driver; /* Index to isdn-driver */ | ||
| 325 | int isdn_channel; /* Index to isdn-channel */ | ||
| 326 | int drv_index; /* Index to dev->usage */ | ||
| 327 | int ncarrier; /* Flag: schedule NO CARRIER */ | ||
| 328 | unsigned char last_cause[8]; /* Last cause message */ | ||
| 329 | unsigned char last_num[ISDN_MSNLEN]; | ||
| 330 | /* Last phone-number */ | ||
| 331 | unsigned char last_l2; /* Last layer-2 protocol */ | ||
| 332 | unsigned char last_si; /* Last service */ | ||
| 333 | unsigned char last_lhup; /* Last hangup local? */ | ||
| 334 | unsigned char last_dir; /* Last direction (in or out) */ | ||
| 335 | struct timer_list nc_timer; /* Timer for delayed NO CARRIER */ | ||
| 336 | int send_outstanding;/* # of outstanding send-requests */ | ||
| 337 | int xmit_size; /* max. # of chars in xmit_buf */ | ||
| 338 | int xmit_count; /* # of chars in xmit_buf */ | ||
| 339 | struct sk_buff_head xmit_queue; /* transmit queue */ | ||
| 340 | atomic_t xmit_lock; /* Semaphore for isdn_tty_write */ | ||
| 341 | #ifdef CONFIG_ISDN_AUDIO | ||
| 342 | int vonline; /* Voice-channel status */ | ||
| 343 | /* Bit 0 = recording */ | ||
| 344 | /* Bit 1 = playback */ | ||
| 345 | /* Bit 2 = playback, DLE-ETX seen */ | ||
| 346 | struct sk_buff_head dtmf_queue; /* queue for dtmf results */ | ||
| 347 | void *adpcms; /* state for adpcm decompression */ | ||
| 348 | void *adpcmr; /* state for adpcm compression */ | ||
| 349 | void *dtmf_state; /* state for dtmf decoder */ | ||
| 350 | void *silence_state; /* state for silence detection */ | ||
| 351 | #endif | ||
| 352 | #ifdef CONFIG_ISDN_TTY_FAX | ||
| 353 | struct T30_s *fax; /* T30 Fax Group 3 data/interface */ | ||
| 354 | int faxonline; /* Fax-channel status */ | ||
| 355 | #endif | ||
| 356 | atemu emu; /* AT-emulator data */ | ||
| 357 | spinlock_t readlock; | ||
| 358 | } modem_info; | ||
| 359 | |||
| 360 | #define ISDN_MODEM_WINSIZE 8 | ||
| 361 | |||
| 362 | /* Description of one ISDN-tty */ | ||
| 363 | typedef struct _isdn_modem { | ||
| 364 | int refcount; /* Number of opens */ | ||
| 365 | struct tty_driver *tty_modem; /* tty-device */ | ||
| 366 | struct tty_struct *modem_table[ISDN_MAX_CHANNELS]; /* ?? copied from Orig */ | ||
| 367 | struct ktermios *modem_termios[ISDN_MAX_CHANNELS]; | ||
| 368 | struct ktermios *modem_termios_locked[ISDN_MAX_CHANNELS]; | ||
| 369 | modem_info info[ISDN_MAX_CHANNELS]; /* Private data */ | ||
| 370 | } isdn_modem_t; | ||
| 371 | |||
| 372 | /*======================= End of ISDN-tty stuff ============================*/ | ||
| 373 | |||
| 374 | /*======================== Start of V.110 stuff ============================*/ | ||
| 375 | #define V110_BUFSIZE 1024 | ||
| 376 | |||
| 377 | typedef struct { | ||
| 378 | int nbytes; /* 1 Matrixbyte -> nbytes in stream */ | ||
| 379 | int nbits; /* Number of used bits in streambyte */ | ||
| 380 | unsigned char key; /* Bitmask in stream eg. 11 (nbits=2) */ | ||
| 381 | int decodelen; /* Amount of data in decodebuf */ | ||
| 382 | int SyncInit; /* Number of sync frames to send */ | ||
| 383 | unsigned char *OnlineFrame; /* Precalculated V110 idle frame */ | ||
| 384 | unsigned char *OfflineFrame; /* Precalculated V110 sync Frame */ | ||
| 385 | int framelen; /* Length of frames */ | ||
| 386 | int skbuser; /* Number of unacked userdata skbs */ | ||
| 387 | int skbidle; /* Number of unacked idle/sync skbs */ | ||
| 388 | int introducer; /* Local vars for decoder */ | ||
| 389 | int dbit; | ||
| 390 | unsigned char b; | ||
| 391 | int skbres; /* space to reserve in outgoing skb */ | ||
| 392 | int maxsize; /* maxbufsize of lowlevel driver */ | ||
| 393 | unsigned char *encodebuf; /* temporary buffer for encoding */ | ||
| 394 | unsigned char decodebuf[V110_BUFSIZE]; /* incomplete V110 matrices */ | ||
| 395 | } isdn_v110_stream; | ||
| 396 | |||
| 397 | /*========================= End of V.110 stuff =============================*/ | ||
| 398 | |||
| 399 | /*======================= Start of general stuff ===========================*/ | ||
| 400 | |||
| 401 | typedef struct { | ||
| 402 | char *next; | ||
| 403 | char *private; | ||
| 404 | } infostruct; | ||
| 405 | |||
| 406 | #define DRV_FLAG_RUNNING 1 | ||
| 407 | #define DRV_FLAG_REJBUS 2 | ||
| 408 | #define DRV_FLAG_LOADED 4 | ||
| 409 | |||
| 410 | /* Description of hardware-level-driver */ | ||
| 411 | typedef struct _isdn_driver { | ||
| 412 | ulong online; /* Channel-Online flags */ | ||
| 413 | ulong flags; /* Misc driver Flags */ | ||
| 414 | int locks; /* Number of locks for this driver */ | ||
| 415 | int channels; /* Number of channels */ | ||
| 416 | wait_queue_head_t st_waitq; /* Wait-Queue for status-read's */ | ||
| 417 | int maxbufsize; /* Maximum Buffersize supported */ | ||
| 418 | unsigned long pktcount; /* Until now: unused */ | ||
| 419 | int stavail; /* Chars avail on Status-device */ | ||
| 420 | isdn_if *interface; /* Interface to driver */ | ||
| 421 | int *rcverr; /* Error-counters for B-Ch.-receive */ | ||
| 422 | int *rcvcount; /* Byte-counters for B-Ch.-receive */ | ||
| 423 | #ifdef CONFIG_ISDN_AUDIO | ||
| 424 | unsigned long DLEflag; /* Flags: Insert DLE at next read */ | ||
| 425 | #endif | ||
| 426 | struct sk_buff_head *rpqueue; /* Pointers to start of Rcv-Queue */ | ||
| 427 | wait_queue_head_t *rcv_waitq; /* Wait-Queues for B-Channel-Reads */ | ||
| 428 | wait_queue_head_t *snd_waitq; /* Wait-Queue for B-Channel-Send's */ | ||
| 429 | char msn2eaz[10][ISDN_MSNLEN]; /* Mapping-Table MSN->EAZ */ | ||
| 430 | } isdn_driver_t; | ||
| 431 | |||
| 432 | /* Main driver-data */ | ||
| 433 | typedef struct isdn_devt { | ||
| 434 | struct module *owner; | ||
| 435 | spinlock_t lock; | ||
| 436 | unsigned short flags; /* Bitmapped Flags: */ | ||
| 437 | int drivers; /* Current number of drivers */ | ||
| 438 | int channels; /* Current number of channels */ | ||
| 439 | int net_verbose; /* Verbose-Flag */ | ||
| 440 | int modempoll; /* Flag: tty-read active */ | ||
| 441 | spinlock_t timerlock; | ||
| 442 | int tflags; /* Timer-Flags: */ | ||
| 443 | /* see ISDN_TIMER_..defines */ | ||
| 444 | int global_flags; | ||
| 445 | infostruct *infochain; /* List of open info-devs. */ | ||
| 446 | wait_queue_head_t info_waitq; /* Wait-Queue for isdninfo */ | ||
| 447 | struct timer_list timer; /* Misc.-function Timer */ | ||
| 448 | int chanmap[ISDN_MAX_CHANNELS]; /* Map minor->device-channel */ | ||
| 449 | int drvmap[ISDN_MAX_CHANNELS]; /* Map minor->driver-index */ | ||
| 450 | int usage[ISDN_MAX_CHANNELS]; /* Used by tty/ip/voice */ | ||
| 451 | char num[ISDN_MAX_CHANNELS][ISDN_MSNLEN]; | ||
| 452 | /* Remote number of active ch.*/ | ||
| 453 | int m_idx[ISDN_MAX_CHANNELS]; /* Index for mdm.... */ | ||
| 454 | isdn_driver_t *drv[ISDN_MAX_DRIVERS]; /* Array of drivers */ | ||
| 455 | isdn_net_dev *netdev; /* Linked list of net-if's */ | ||
| 456 | char drvid[ISDN_MAX_DRIVERS][20];/* Driver-ID */ | ||
| 457 | struct task_struct *profd; /* For iprofd */ | ||
| 458 | isdn_modem_t mdm; /* tty-driver-data */ | ||
| 459 | isdn_net_dev *rx_netdev[ISDN_MAX_CHANNELS]; /* rx netdev-pointers */ | ||
| 460 | isdn_net_dev *st_netdev[ISDN_MAX_CHANNELS]; /* stat netdev-pointers */ | ||
| 461 | ulong ibytes[ISDN_MAX_CHANNELS]; /* Statistics incoming bytes */ | ||
| 462 | ulong obytes[ISDN_MAX_CHANNELS]; /* Statistics outgoing bytes */ | ||
| 463 | int v110emu[ISDN_MAX_CHANNELS]; /* V.110 emulator-mode 0=none */ | ||
| 464 | atomic_t v110use[ISDN_MAX_CHANNELS]; /* Usage-Semaphore for stream */ | ||
| 465 | isdn_v110_stream *v110[ISDN_MAX_CHANNELS]; /* V.110 private data */ | ||
| 466 | struct mutex mtx; /* serialize list access*/ | ||
| 467 | unsigned long global_features; | ||
| 468 | } isdn_dev; | ||
| 469 | |||
| 470 | extern isdn_dev *dev; | ||
| 471 | |||
| 472 | |||
| 473 | #endif /* __ISDN_H__ */ | ||
| @@ -1,69 +0,0 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ | ||
| 2 | /* | ||
| 3 | * hdlc.h -- General purpose ISDN HDLC decoder. | ||
| 4 | * | ||
| 5 | * Implementation of a HDLC decoder/encoder in software. | ||
| 6 | * Necessary because some ISDN devices don't have HDLC | ||
| 7 | * controllers. | ||
| 8 | * | ||
| 9 | * Copyright (C) | ||
| 10 | * 2009 Karsten Keil <keil@b1-systems.de> | ||
| 11 | * 2002 Wolfgang Mües <wolfgang@iksw-muees.de> | ||
| 12 | * 2001 Frode Isaksen <fisaksen@bewan.com> | ||
| 13 | * 2001 Kai Germaschewski <kai.germaschewski@gmx.de> | ||
| 14 | */ | ||
| 15 | |||
| 16 | #ifndef __ISDNHDLC_H__ | ||
| 17 | #define __ISDNHDLC_H__ | ||
| 18 | |||
| 19 | struct isdnhdlc_vars { | ||
| 20 | int bit_shift; | ||
| 21 | int hdlc_bits1; | ||
| 22 | int data_bits; | ||
| 23 | int ffbit_shift; /* encoding only */ | ||
| 24 | int state; | ||
| 25 | int dstpos; | ||
| 26 | |||
| 27 | u16 crc; | ||
| 28 | |||
| 29 | u8 cbin; | ||
| 30 | u8 shift_reg; | ||
| 31 | u8 ffvalue; | ||
| 32 | |||
| 33 | /* set if transferring data */ | ||
| 34 | u32 data_received:1; | ||
| 35 | /* set if D channel (send idle instead of flags) */ | ||
| 36 | u32 dchannel:1; | ||
| 37 | /* set if 56K adaptation */ | ||
| 38 | u32 do_adapt56:1; | ||
| 39 | /* set if in closing phase (need to send CRC + flag) */ | ||
| 40 | u32 do_closing:1; | ||
| 41 | /* set if data is bitreverse */ | ||
| 42 | u32 do_bitreverse:1; | ||
| 43 | }; | ||
| 44 | |||
| 45 | /* Feature Flags */ | ||
| 46 | #define HDLC_56KBIT 0x01 | ||
| 47 | #define HDLC_DCHANNEL 0x02 | ||
| 48 | #define HDLC_BITREVERSE 0x04 | ||
| 49 | |||
| 50 | /* | ||
| 51 | The return value from isdnhdlc_decode is | ||
| 52 | the frame length, 0 if no complete frame was decoded, | ||
| 53 | or a negative error number | ||
| 54 | */ | ||
| 55 | #define HDLC_FRAMING_ERROR 1 | ||
| 56 | #define HDLC_CRC_ERROR 2 | ||
| 57 | #define HDLC_LENGTH_ERROR 3 | ||
| 58 | |||
| 59 | extern void isdnhdlc_rcv_init(struct isdnhdlc_vars *hdlc, u32 features); | ||
| 60 | |||
| 61 | extern int isdnhdlc_decode(struct isdnhdlc_vars *hdlc, const u8 *src, | ||
| 62 | int slen, int *count, u8 *dst, int dsize); | ||
| 63 | |||
| 64 | extern void isdnhdlc_out_init(struct isdnhdlc_vars *hdlc, u32 features); | ||
| 65 | |||
| 66 | extern int isdnhdlc_encode(struct isdnhdlc_vars *hdlc, const u8 *src, | ||
| 67 | u16 slen, int *count, u8 *dst, int dsize); | ||
| 68 | |||
| 69 | #endif /* __ISDNHDLC_H__ */ | ||
| @@ -1,35 +0,0 @@ | |||
| 1 | /* $Id: isdn_divertif.h,v 1.4.6.1 2001/09/23 22:25:05 kai Exp $ | ||
| 2 | * | ||
| 3 | * Header for the diversion supplementary interface for i4l. | ||
| 4 | * | ||
| 5 | * Author Werner Cornelius (werner@titro.de) | ||
| 6 | * Copyright by Werner Cornelius (werner@titro.de) | ||
| 7 | * | ||
| 8 | * This software may be used and distributed according to the terms | ||
| 9 | * of the GNU General Public License, incorporated herein by reference. | ||
| 10 | * | ||
| 11 | */ | ||
| 12 | #ifndef _LINUX_ISDN_DIVERTIF_H | ||
| 13 | #define _LINUX_ISDN_DIVERTIF_H | ||
| 14 | |||
| 15 | #include <linux/isdnif.h> | ||
| 16 | #include <linux/types.h> | ||
| 17 | #include <uapi/linux/isdn_divertif.h> | ||
| 18 | |||
| 19 | /***************************************************************/ | ||
| 20 | /* structure exchanging data between isdn hl and divert module */ | ||
| 21 | /***************************************************************/ | ||
| 22 | typedef struct | ||
| 23 | { ulong if_magic; /* magic info and version */ | ||
| 24 | int cmd; /* command */ | ||
| 25 | int (*stat_callback)(isdn_ctrl *); /* supplied by divert module when calling */ | ||
| 26 | int (*ll_cmd)(isdn_ctrl *); /* supplied by hl on return */ | ||
| 27 | char * (*drv_to_name)(int); /* map a driver id to name, supplied by hl */ | ||
| 28 | int (*name_to_drv)(char *); /* map a driver id to name, supplied by hl */ | ||
| 29 | } isdn_divert_if; | ||
| 30 | |||
| 31 | /*********************/ | ||
| 32 | /* function register */ | ||
| 33 | /*********************/ | ||
| 34 | extern int DIVERT_REG_NAME(isdn_divert_if *); | ||
| 35 | #endif /* _LINUX_ISDN_DIVERTIF_H */ | ||
| @@ -1,194 +0,0 @@ | |||
| 1 | /* Linux ISDN subsystem, sync PPP, interface to ipppd | ||
| 2 | * | ||
| 3 | * Copyright 1994-1999 by Fritz Elfert (fritz@isdn4linux.de) | ||
| 4 | * Copyright 1995,96 Thinking Objects Software GmbH Wuerzburg | ||
| 5 | * Copyright 1995,96 by Michael Hipp (Michael.Hipp@student.uni-tuebingen.de) | ||
| 6 | * Copyright 2000-2002 by Kai Germaschewski (kai@germaschewski.name) | ||
| 7 | * | ||
| 8 | * This software may be used and distributed according to the terms | ||
| 9 | * of the GNU General Public License, incorporated herein by reference. | ||
| 10 | * | ||
| 11 | */ | ||
| 12 | #ifndef _LINUX_ISDN_PPP_H | ||
| 13 | #define _LINUX_ISDN_PPP_H | ||
| 14 | |||
| 15 | |||
| 16 | |||
| 17 | |||
| 18 | #ifdef CONFIG_IPPP_FILTER | ||
| 19 | #include <linux/filter.h> | ||
| 20 | #endif | ||
| 21 | #include <uapi/linux/isdn_ppp.h> | ||
| 22 | |||
| 23 | #define DECOMP_ERR_NOMEM (-10) | ||
| 24 | |||
| 25 | #define MP_END_FRAG 0x40 | ||
| 26 | #define MP_BEGIN_FRAG 0x80 | ||
| 27 | |||
| 28 | #define MP_MAX_QUEUE_LEN 16 | ||
| 29 | |||
| 30 | /* | ||
| 31 | * We need a way for the decompressor to influence the generation of CCP | ||
| 32 | * Reset-Requests in a variety of ways. The decompressor is already returning | ||
| 33 | * a lot of information (generated skb length, error conditions) so we use | ||
| 34 | * another parameter. This parameter is a pointer to a structure which is | ||
| 35 | * to be marked valid by the decompressor and only in this case is ever used. | ||
| 36 | * Furthermore, the only case where this data is used is when the decom- | ||
| 37 | * pressor returns DECOMP_ERROR. | ||
| 38 | * | ||
| 39 | * We use this same struct for the reset entry of the compressor to commu- | ||
| 40 | * nicate to its caller how to deal with sending of a Reset Ack. In this | ||
| 41 | * case, expra is not used, but other options still apply (suppressing | ||
| 42 | * sending with rsend, appending arbitrary data, etc). | ||
| 43 | */ | ||
| 44 | |||
| 45 | #define IPPP_RESET_MAXDATABYTES 32 | ||
| 46 | |||
| 47 | struct isdn_ppp_resetparams { | ||
| 48 | unsigned char valid:1; /* rw Is this structure filled at all ? */ | ||
| 49 | unsigned char rsend:1; /* rw Should we send one at all ? */ | ||
| 50 | unsigned char idval:1; /* rw Is the id field valid ? */ | ||
| 51 | unsigned char dtval:1; /* rw Is the data field valid ? */ | ||
| 52 | unsigned char expra:1; /* rw Is an Ack expected for this Req ? */ | ||
| 53 | unsigned char id; /* wo Send CCP ResetReq with this id */ | ||
| 54 | unsigned short maxdlen; /* ro Max bytes to be stored in data field */ | ||
| 55 | unsigned short dlen; /* rw Bytes stored in data field */ | ||
| 56 | unsigned char *data; /* wo Data for ResetReq info field */ | ||
| 57 | }; | ||
| 58 | |||
| 59 | /* | ||
| 60 | * this is an 'old friend' from ppp-comp.h under a new name | ||
| 61 | * check the original include for more information | ||
| 62 | */ | ||
| 63 | struct isdn_ppp_compressor { | ||
| 64 | struct isdn_ppp_compressor *next, *prev; | ||
| 65 | struct module *owner; | ||
| 66 | int num; /* CCP compression protocol number */ | ||
| 67 | |||
| 68 | void *(*alloc) (struct isdn_ppp_comp_data *); | ||
| 69 | void (*free) (void *state); | ||
| 70 | int (*init) (void *state, struct isdn_ppp_comp_data *, | ||
| 71 | int unit,int debug); | ||
| 72 | |||
| 73 | /* The reset entry needs to get more exact information about the | ||
| 74 | ResetReq or ResetAck it was called with. The parameters are | ||
| 75 | obvious. If reset is called without a Req or Ack frame which | ||
| 76 | could be handed into it, code MUST be set to 0. Using rsparm, | ||
| 77 | the reset entry can control if and how a ResetAck is returned. */ | ||
| 78 | |||
| 79 | void (*reset) (void *state, unsigned char code, unsigned char id, | ||
| 80 | unsigned char *data, unsigned len, | ||
| 81 | struct isdn_ppp_resetparams *rsparm); | ||
| 82 | |||
| 83 | int (*compress) (void *state, struct sk_buff *in, | ||
| 84 | struct sk_buff *skb_out, int proto); | ||
| 85 | |||
| 86 | int (*decompress) (void *state,struct sk_buff *in, | ||
| 87 | struct sk_buff *skb_out, | ||
| 88 | struct isdn_ppp_resetparams *rsparm); | ||
| 89 | |||
| 90 | void (*incomp) (void *state, struct sk_buff *in,int proto); | ||
| 91 | void (*stat) (void *state, struct compstat *stats); | ||
| 92 | }; | ||
| 93 | |||
| 94 | extern int isdn_ppp_register_compressor(struct isdn_ppp_compressor *); | ||
| 95 | extern int isdn_ppp_unregister_compressor(struct isdn_ppp_compressor *); | ||
| 96 | extern int isdn_ppp_dial_slave(char *); | ||
| 97 | extern int isdn_ppp_hangup_slave(char *); | ||
| 98 | |||
| 99 | typedef struct { | ||
| 100 | unsigned long seqerrs; | ||
| 101 | unsigned long frame_drops; | ||
| 102 | unsigned long overflows; | ||
| 103 | unsigned long max_queue_len; | ||
| 104 | } isdn_mppp_stats; | ||
| 105 | |||
| 106 | typedef struct { | ||
| 107 | int mp_mrru; /* unused */ | ||
| 108 | struct sk_buff * frags; /* fragments sl list -- use skb->next */ | ||
| 109 | long frames; /* number of frames in the frame list */ | ||
| 110 | unsigned int seq; /* last processed packet seq #: any packets | ||
| 111 | * with smaller seq # will be dropped | ||
| 112 | * unconditionally */ | ||
| 113 | spinlock_t lock; | ||
| 114 | int ref_ct; | ||
| 115 | /* statistics */ | ||
| 116 | isdn_mppp_stats stats; | ||
| 117 | } ippp_bundle; | ||
| 118 | |||
| 119 | #define NUM_RCV_BUFFS 64 | ||
| 120 | |||
| 121 | struct ippp_buf_queue { | ||
| 122 | struct ippp_buf_queue *next; | ||
| 123 | struct ippp_buf_queue *last; | ||
| 124 | char *buf; /* NULL here indicates end of queue */ | ||
| 125 | int len; | ||
| 126 | }; | ||
| 127 | |||
| 128 | /* The data structure for one CCP reset transaction */ | ||
| 129 | enum ippp_ccp_reset_states { | ||
| 130 | CCPResetIdle, | ||
| 131 | CCPResetSentReq, | ||
| 132 | CCPResetRcvdReq, | ||
| 133 | CCPResetSentAck, | ||
| 134 | CCPResetRcvdAck | ||
| 135 | }; | ||
| 136 | |||
| 137 | struct ippp_ccp_reset_state { | ||
| 138 | enum ippp_ccp_reset_states state; /* State of this transaction */ | ||
| 139 | struct ippp_struct *is; /* Backlink to device stuff */ | ||
| 140 | unsigned char id; /* Backlink id index */ | ||
| 141 | unsigned char ta:1; /* The timer is active (flag) */ | ||
| 142 | unsigned char expra:1; /* We expect a ResetAck at all */ | ||
| 143 | int dlen; /* Databytes stored in data */ | ||
| 144 | struct timer_list timer; /* For timeouts/retries */ | ||
| 145 | /* This is a hack but seems sufficient for the moment. We do not want | ||
| 146 | to have this be yet another allocation for some bytes, it is more | ||
| 147 | memory management overhead than the whole mess is worth. */ | ||
| 148 | unsigned char data[IPPP_RESET_MAXDATABYTES]; | ||
| 149 | }; | ||
| 150 | |||
| 151 | /* The data structure keeping track of the currently outstanding CCP Reset | ||
| 152 | transactions. */ | ||
| 153 | struct ippp_ccp_reset { | ||
| 154 | struct ippp_ccp_reset_state *rs[256]; /* One per possible id */ | ||
| 155 | unsigned char lastid; /* Last id allocated by the engine */ | ||
| 156 | }; | ||
| 157 | |||
| 158 | struct ippp_struct { | ||
| 159 | struct ippp_struct *next_link; | ||
| 160 | int state; | ||
| 161 | spinlock_t buflock; | ||
| 162 | struct ippp_buf_queue rq[NUM_RCV_BUFFS]; /* packet queue for isdn_ppp_read() */ | ||
| 163 | struct ippp_buf_queue *first; /* pointer to (current) first packet */ | ||
| 164 | struct ippp_buf_queue *last; /* pointer to (current) last used packet in queue */ | ||
| 165 | wait_queue_head_t wq; | ||
| 166 | struct task_struct *tk; | ||
| 167 | unsigned int mpppcfg; | ||
| 168 | unsigned int pppcfg; | ||
| 169 | unsigned int mru; | ||
| 170 | unsigned int mpmru; | ||
| 171 | unsigned int mpmtu; | ||
| 172 | unsigned int maxcid; | ||
| 173 | struct isdn_net_local_s *lp; | ||
| 174 | int unit; | ||
| 175 | int minor; | ||
| 176 | unsigned int last_link_seqno; | ||
| 177 | long mp_seqno; | ||
| 178 | #ifdef CONFIG_ISDN_PPP_VJ | ||
| 179 | unsigned char *cbuf; | ||
| 180 | struct slcompress *slcomp; | ||
| 181 | #endif | ||
| 182 | #ifdef CONFIG_IPPP_FILTER | ||
| 183 | struct bpf_prog *pass_filter; /* filter for packets to pass */ | ||
| 184 | struct bpf_prog *active_filter; /* filter for pkts to reset idle */ | ||
| 185 | #endif | ||
| 186 | unsigned long debug; | ||
| 187 | struct isdn_ppp_compressor *compressor,*decompressor; | ||
| 188 | struct isdn_ppp_compressor *link_compressor,*link_decompressor; | ||
| 189 | void *decomp_stat,*comp_stat,*link_decomp_stat,*link_comp_stat; | ||
| 190 | struct ippp_ccp_reset *reset; /* Allocated on demand, may never be needed */ | ||
| 191 | unsigned long compflags; | ||
| 192 | }; | ||
| 193 | |||
| 194 | #endif /* _LINUX_ISDN_PPP_H */ | ||
| @@ -1,505 +0,0 @@ | |||
| 1 | /* $Id: isdnif.h,v 1.43.2.2 2004/01/12 23:08:35 keil Exp $ | ||
| 2 | * | ||
| 3 | * Linux ISDN subsystem | ||
| 4 | * Definition of the interface between the subsystem and its low-level drivers. | ||
| 5 | * | ||
| 6 | * Copyright 1994,95,96 by Fritz Elfert (fritz@isdn4linux.de) | ||
| 7 | * Copyright 1995,96 Thinking Objects Software GmbH Wuerzburg | ||
| 8 | * | ||
| 9 | * This software may be used and distributed according to the terms | ||
| 10 | * of the GNU General Public License, incorporated herein by reference. | ||
| 11 | * | ||
| 12 | */ | ||
| 13 | #ifndef __ISDNIF_H__ | ||
| 14 | #define __ISDNIF_H__ | ||
| 15 | |||
| 16 | |||
| 17 | #include <linux/skbuff.h> | ||
| 18 | #include <uapi/linux/isdnif.h> | ||
| 19 | |||
| 20 | /***************************************************************************/ | ||
| 21 | /* Extensions made by Werner Cornelius (werner@ikt.de) */ | ||
| 22 | /* */ | ||
| 23 | /* The proceed command holds a incoming call in a state to leave processes */ | ||
| 24 | /* enough time to check whether ist should be accepted. */ | ||
| 25 | /* The PROT_IO Command extends the interface to make protocol dependent */ | ||
| 26 | /* features available (call diversion, call waiting...). */ | ||
| 27 | /* */ | ||
| 28 | /* The PROT_IO Command is executed with the desired driver id and the arg */ | ||
| 29 | /* parameter coded as follows: */ | ||
| 30 | /* The lower 8 bits of arg contain the desired protocol from ISDN_PTYPE */ | ||
| 31 | /* definitions. The upper 24 bits represent the protocol specific cmd/stat.*/ | ||
| 32 | /* Any additional data is protocol and command specific. */ | ||
| 33 | /* This mechanism also applies to the statcallb callback STAT_PROT. */ | ||
| 34 | /* */ | ||
| 35 | /* This suggested extension permits an easy expansion of protocol specific */ | ||
| 36 | /* handling. Extensions may be added at any time without changing the HL */ | ||
| 37 | /* driver code and not getting conflicts without certifications. */ | ||
| 38 | /* The well known CAPI 2.0 interface handles such extensions in a similar */ | ||
| 39 | /* way. Perhaps a protocol specific module may be added and separately */ | ||
| 40 | /* loaded and linked to the basic isdn module for handling. */ | ||
| 41 | /***************************************************************************/ | ||
| 42 | |||
| 43 | /*****************/ | ||
| 44 | /* DSS1 commands */ | ||
| 45 | /*****************/ | ||
| 46 | #define DSS1_CMD_INVOKE ((0x00 << 8) | ISDN_PTYPE_EURO) /* invoke a supplementary service */ | ||
| 47 | #define DSS1_CMD_INVOKE_ABORT ((0x01 << 8) | ISDN_PTYPE_EURO) /* abort a invoke cmd */ | ||
| 48 | |||
| 49 | /*******************************/ | ||
| 50 | /* DSS1 Status callback values */ | ||
| 51 | /*******************************/ | ||
| 52 | #define DSS1_STAT_INVOKE_RES ((0x80 << 8) | ISDN_PTYPE_EURO) /* Result for invocation */ | ||
| 53 | #define DSS1_STAT_INVOKE_ERR ((0x81 << 8) | ISDN_PTYPE_EURO) /* Error Return for invocation */ | ||
| 54 | #define DSS1_STAT_INVOKE_BRD ((0x82 << 8) | ISDN_PTYPE_EURO) /* Deliver invoke broadcast info */ | ||
| 55 | |||
| 56 | |||
| 57 | /*********************************************************************/ | ||
| 58 | /* structures for DSS1 commands and callback */ | ||
| 59 | /* */ | ||
| 60 | /* An action is invoked by sending a DSS1_CMD_INVOKE. The ll_id, proc*/ | ||
| 61 | /* timeout, datalen and data fields must be set before calling. */ | ||
| 62 | /* */ | ||
| 63 | /* The return value is a positive hl_id value also delivered in the */ | ||
| 64 | /* hl_id field. A value of zero signals no more left hl_id capacitys.*/ | ||
| 65 | /* A negative return value signals errors in LL. So if the return */ | ||
| 66 | /* value is <= 0 no action in LL will be taken -> request ignored */ | ||
| 67 | /* */ | ||
| 68 | /* The timeout field must be filled with a positive value specifying */ | ||
| 69 | /* the amount of time the INVOKED process waits for a reaction from */ | ||
| 70 | /* the network. */ | ||
| 71 | /* If a response (either error or result) is received during this */ | ||
| 72 | /* intervall, a reporting callback is initiated and the process will */ | ||
| 73 | /* be deleted, the hl identifier will be freed. */ | ||
| 74 | /* If no response is received during the specified intervall, a error*/ | ||
| 75 | /* callback is initiated with timeout set to -1 and a datalen set */ | ||
| 76 | /* to 0. */ | ||
| 77 | /* If timeout is set to a value <= 0 during INVOCATION the process is*/ | ||
| 78 | /* immediately deleted after sending the data. No callback occurs ! */ | ||
| 79 | /* */ | ||
| 80 | /* A currently waiting process may be aborted with INVOKE_ABORT. No */ | ||
| 81 | /* callback will occur when a process has been aborted. */ | ||
| 82 | /* */ | ||
| 83 | /* Broadcast invoke frames from the network are reported via the */ | ||
| 84 | /* STAT_INVOKE_BRD callback. The ll_id is set to 0, the other fields */ | ||
| 85 | /* are supplied by the network and not by the HL. */ | ||
| 86 | /*********************************************************************/ | ||
| 87 | |||
| 88 | /*****************/ | ||
| 89 | /* NI1 commands */ | ||
| 90 | /*****************/ | ||
| 91 | #define NI1_CMD_INVOKE ((0x00 << 8) | ISDN_PTYPE_NI1) /* invoke a supplementary service */ | ||
| 92 | #define NI1_CMD_INVOKE_ABORT ((0x01 << 8) | ISDN_PTYPE_NI1) /* abort a invoke cmd */ | ||
| 93 | |||
| 94 | /*******************************/ | ||
| 95 | /* NI1 Status callback values */ | ||
| 96 | /*******************************/ | ||
| 97 | #define NI1_STAT_INVOKE_RES ((0x80 << 8) | ISDN_PTYPE_NI1) /* Result for invocation */ | ||
| 98 | #define NI1_STAT_INVOKE_ERR ((0x81 << 8) | ISDN_PTYPE_NI1) /* Error Return for invocation */ | ||
| 99 | #define NI1_STAT_INVOKE_BRD ((0x82 << 8) | ISDN_PTYPE_NI1) /* Deliver invoke broadcast info */ | ||
| 100 | |||
| 101 | typedef struct | ||
| 102 | { ulong ll_id; /* ID supplied by LL when executing */ | ||
| 103 | /* a command and returned by HL for */ | ||
| 104 | /* INVOKE_RES and INVOKE_ERR */ | ||
| 105 | int hl_id; /* ID supplied by HL when called */ | ||
| 106 | /* for executing a cmd and delivered */ | ||
| 107 | /* for results and errors */ | ||
| 108 | /* must be supplied by LL when aborting*/ | ||
| 109 | int proc; /* invoke procedure used by CMD_INVOKE */ | ||
| 110 | /* returned by callback and broadcast */ | ||
| 111 | int timeout; /* timeout for INVOKE CMD in ms */ | ||
| 112 | /* -1 in stat callback when timed out */ | ||
| 113 | /* error value when error callback */ | ||
| 114 | int datalen; /* length of cmd or stat data */ | ||
| 115 | u_char *data;/* pointer to data delivered or send */ | ||
| 116 | } isdn_cmd_stat; | ||
| 117 | |||
| 118 | /* | ||
| 119 | * Commands from linklevel to lowlevel | ||
| 120 | * | ||
| 121 | */ | ||
| 122 | #define ISDN_CMD_IOCTL 0 /* Perform ioctl */ | ||
| 123 | #define ISDN_CMD_DIAL 1 /* Dial out */ | ||
| 124 | #define ISDN_CMD_ACCEPTD 2 /* Accept an incoming call on D-Chan. */ | ||
| 125 | #define ISDN_CMD_ACCEPTB 3 /* Request B-Channel connect. */ | ||
| 126 | #define ISDN_CMD_HANGUP 4 /* Hangup */ | ||
| 127 | #define ISDN_CMD_CLREAZ 5 /* Clear EAZ(s) of channel */ | ||
| 128 | #define ISDN_CMD_SETEAZ 6 /* Set EAZ(s) of channel */ | ||
| 129 | #define ISDN_CMD_GETEAZ 7 /* Get EAZ(s) of channel */ | ||
| 130 | #define ISDN_CMD_SETSIL 8 /* Set Service-Indicator-List of channel */ | ||
| 131 | #define ISDN_CMD_GETSIL 9 /* Get Service-Indicator-List of channel */ | ||
| 132 | #define ISDN_CMD_SETL2 10 /* Set B-Chan. Layer2-Parameter */ | ||
| 133 | #define ISDN_CMD_GETL2 11 /* Get B-Chan. Layer2-Parameter */ | ||
| 134 | #define ISDN_CMD_SETL3 12 /* Set B-Chan. Layer3-Parameter */ | ||
| 135 | #define ISDN_CMD_GETL3 13 /* Get B-Chan. Layer3-Parameter */ | ||
| 136 | // #define ISDN_CMD_LOCK 14 /* Signal usage by upper levels */ | ||
| 137 | // #define ISDN_CMD_UNLOCK 15 /* Release usage-lock */ | ||
| 138 | #define ISDN_CMD_SUSPEND 16 /* Suspend connection */ | ||
| 139 | #define ISDN_CMD_RESUME 17 /* Resume connection */ | ||
| 140 | #define ISDN_CMD_PROCEED 18 /* Proceed with call establishment */ | ||
| 141 | #define ISDN_CMD_ALERT 19 /* Alert after Proceeding */ | ||
| 142 | #define ISDN_CMD_REDIR 20 /* Redir a incoming call */ | ||
| 143 | #define ISDN_CMD_PROT_IO 21 /* Protocol specific commands */ | ||
| 144 | #define CAPI_PUT_MESSAGE 22 /* CAPI message send down or up */ | ||
| 145 | #define ISDN_CMD_FAXCMD 23 /* FAX commands to HL-driver */ | ||
| 146 | #define ISDN_CMD_AUDIO 24 /* DSP, DTMF, ... settings */ | ||
| 147 | |||
| 148 | /* | ||
| 149 | * Status-Values delivered from lowlevel to linklevel via | ||
| 150 | * statcallb(). | ||
| 151 | * | ||
| 152 | */ | ||
| 153 | #define ISDN_STAT_STAVAIL 256 /* Raw status-data available */ | ||
| 154 | #define ISDN_STAT_ICALL 257 /* Incoming call detected */ | ||
| 155 | #define ISDN_STAT_RUN 258 /* Signal protocol-code is running */ | ||
| 156 | #define ISDN_STAT_STOP 259 /* Signal halt of protocol-code */ | ||
| 157 | #define ISDN_STAT_DCONN 260 /* Signal D-Channel connect */ | ||
| 158 | #define ISDN_STAT_BCONN 261 /* Signal B-Channel connect */ | ||
| 159 | #define ISDN_STAT_DHUP 262 /* Signal D-Channel disconnect */ | ||
| 160 | #define ISDN_STAT_BHUP 263 /* Signal B-Channel disconnect */ | ||
| 161 | #define ISDN_STAT_CINF 264 /* Charge-Info */ | ||
| 162 | #define ISDN_STAT_LOAD 265 /* Signal new lowlevel-driver is loaded */ | ||
| 163 | #define ISDN_STAT_UNLOAD 266 /* Signal unload of lowlevel-driver */ | ||
| 164 | #define ISDN_STAT_BSENT 267 /* Signal packet sent */ | ||
| 165 | #define ISDN_STAT_NODCH 268 /* Signal no D-Channel */ | ||
| 166 | #define ISDN_STAT_ADDCH 269 /* Add more Channels */ | ||
| 167 | #define ISDN_STAT_CAUSE 270 /* Cause-Message */ | ||
| 168 | #define ISDN_STAT_ICALLW 271 /* Incoming call without B-chan waiting */ | ||
| 169 | #define ISDN_STAT_REDIR 272 /* Redir result */ | ||
| 170 | #define ISDN_STAT_PROT 273 /* protocol IO specific callback */ | ||
| 171 | #define ISDN_STAT_DISPLAY 274 /* deliver a received display message */ | ||
| 172 | #define ISDN_STAT_L1ERR 275 /* Signal Layer-1 Error */ | ||
| 173 | #define ISDN_STAT_FAXIND 276 /* FAX indications from HL-driver */ | ||
| 174 | #define ISDN_STAT_AUDIO 277 /* DTMF, DSP indications */ | ||
| 175 | #define ISDN_STAT_DISCH 278 /* Disable/Enable channel usage */ | ||
| 176 | |||
| 177 | /* | ||
| 178 | * Audio commands | ||
| 179 | */ | ||
| 180 | #define ISDN_AUDIO_SETDD 0 /* Set DTMF detection */ | ||
| 181 | #define ISDN_AUDIO_DTMF 1 /* Rx/Tx DTMF */ | ||
| 182 | |||
| 183 | /* | ||
| 184 | * Values for errcode field | ||
| 185 | */ | ||
| 186 | #define ISDN_STAT_L1ERR_SEND 1 | ||
| 187 | #define ISDN_STAT_L1ERR_RECV 2 | ||
| 188 | |||
| 189 | /* | ||
| 190 | * Values for feature-field of interface-struct. | ||
| 191 | */ | ||
| 192 | /* Layer 2 */ | ||
| 193 | #define ISDN_FEATURE_L2_X75I (0x0001 << ISDN_PROTO_L2_X75I) | ||
| 194 | #define ISDN_FEATURE_L2_X75UI (0x0001 << ISDN_PROTO_L2_X75UI) | ||
| 195 | #define ISDN_FEATURE_L2_X75BUI (0x0001 << ISDN_PROTO_L2_X75BUI) | ||
| 196 | #define ISDN_FEATURE_L2_HDLC (0x0001 << ISDN_PROTO_L2_HDLC) | ||
| 197 | #define ISDN_FEATURE_L2_TRANS (0x0001 << ISDN_PROTO_L2_TRANS) | ||
| 198 | #define ISDN_FEATURE_L2_X25DTE (0x0001 << ISDN_PROTO_L2_X25DTE) | ||
| 199 | #define ISDN_FEATURE_L2_X25DCE (0x0001 << ISDN_PROTO_L2_X25DCE) | ||
| 200 | #define ISDN_FEATURE_L2_V11096 (0x0001 << ISDN_PROTO_L2_V11096) | ||
| 201 | #define ISDN_FEATURE_L2_V11019 (0x0001 << ISDN_PROTO_L2_V11019) | ||
| 202 | #define ISDN_FEATURE_L2_V11038 (0x0001 << ISDN_PROTO_L2_V11038) | ||
| 203 | #define ISDN_FEATURE_L2_MODEM (0x0001 << ISDN_PROTO_L2_MODEM) | ||
| 204 | #define ISDN_FEATURE_L2_FAX (0x0001 << ISDN_PROTO_L2_FAX) | ||
| 205 | #define ISDN_FEATURE_L2_HDLC_56K (0x0001 << ISDN_PROTO_L2_HDLC_56K) | ||
| 206 | |||
| 207 | #define ISDN_FEATURE_L2_MASK (0x0FFFF) /* Max. 16 protocols */ | ||
| 208 | #define ISDN_FEATURE_L2_SHIFT (0) | ||
| 209 | |||
| 210 | /* Layer 3 */ | ||
| 211 | #define ISDN_FEATURE_L3_TRANS (0x10000 << ISDN_PROTO_L3_TRANS) | ||
| 212 | #define ISDN_FEATURE_L3_TRANSDSP (0x10000 << ISDN_PROTO_L3_TRANSDSP) | ||
| 213 | #define ISDN_FEATURE_L3_FCLASS2 (0x10000 << ISDN_PROTO_L3_FCLASS2) | ||
| 214 | #define ISDN_FEATURE_L3_FCLASS1 (0x10000 << ISDN_PROTO_L3_FCLASS1) | ||
| 215 | |||
| 216 | #define ISDN_FEATURE_L3_MASK (0x0FF0000) /* Max. 8 Protocols */ | ||
| 217 | #define ISDN_FEATURE_L3_SHIFT (16) | ||
| 218 | |||
| 219 | /* Signaling */ | ||
| 220 | #define ISDN_FEATURE_P_UNKNOWN (0x1000000 << ISDN_PTYPE_UNKNOWN) | ||
| 221 | #define ISDN_FEATURE_P_1TR6 (0x1000000 << ISDN_PTYPE_1TR6) | ||
| 222 | #define ISDN_FEATURE_P_EURO (0x1000000 << ISDN_PTYPE_EURO) | ||
| 223 | #define ISDN_FEATURE_P_NI1 (0x1000000 << ISDN_PTYPE_NI1) | ||
| 224 | |||
| 225 | #define ISDN_FEATURE_P_MASK (0x0FF000000) /* Max. 8 Protocols */ | ||
| 226 | #define ISDN_FEATURE_P_SHIFT (24) | ||
| 227 | |||
| 228 | typedef struct setup_parm { | ||
| 229 | unsigned char phone[32]; /* Remote Phone-Number */ | ||
| 230 | unsigned char eazmsn[32]; /* Local EAZ or MSN */ | ||
| 231 | unsigned char si1; /* Service Indicator 1 */ | ||
| 232 | unsigned char si2; /* Service Indicator 2 */ | ||
| 233 | unsigned char plan; /* Numbering plan */ | ||
| 234 | unsigned char screen; /* Screening info */ | ||
| 235 | } setup_parm; | ||
| 236 | |||
| 237 | |||
| 238 | #ifdef CONFIG_ISDN_TTY_FAX | ||
| 239 | /* T.30 Fax G3 */ | ||
| 240 | |||
| 241 | #define FAXIDLEN 21 | ||
| 242 | |||
| 243 | typedef struct T30_s { | ||
| 244 | /* session parameters */ | ||
| 245 | __u8 resolution; | ||
| 246 | __u8 rate; | ||
| 247 | __u8 width; | ||
| 248 | __u8 length; | ||
| 249 | __u8 compression; | ||
| 250 | __u8 ecm; | ||
| 251 | __u8 binary; | ||
| 252 | __u8 scantime; | ||
| 253 | __u8 id[FAXIDLEN]; | ||
| 254 | /* additional parameters */ | ||
| 255 | __u8 phase; | ||
| 256 | __u8 direction; | ||
| 257 | __u8 code; | ||
| 258 | __u8 badlin; | ||
| 259 | __u8 badmul; | ||
| 260 | __u8 bor; | ||
| 261 | __u8 fet; | ||
| 262 | __u8 pollid[FAXIDLEN]; | ||
| 263 | __u8 cq; | ||
| 264 | __u8 cr; | ||
| 265 | __u8 ctcrty; | ||
| 266 | __u8 minsp; | ||
| 267 | __u8 phcto; | ||
| 268 | __u8 rel; | ||
| 269 | __u8 nbc; | ||
| 270 | /* remote station parameters */ | ||
| 271 | __u8 r_resolution; | ||
| 272 | __u8 r_rate; | ||
| 273 | __u8 r_width; | ||
| 274 | __u8 r_length; | ||
| 275 | __u8 r_compression; | ||
| 276 | __u8 r_ecm; | ||
| 277 | __u8 r_binary; | ||
| 278 | __u8 r_scantime; | ||
| 279 | __u8 r_id[FAXIDLEN]; | ||
| 280 | __u8 r_code; | ||
| 281 | } __packed T30_s; | ||
| 282 | |||
| 283 | #define ISDN_TTY_FAX_CONN_IN 0 | ||
| 284 | #define ISDN_TTY_FAX_CONN_OUT 1 | ||
| 285 | |||
| 286 | #define ISDN_TTY_FAX_FCON 0 | ||
| 287 | #define ISDN_TTY_FAX_DIS 1 | ||
| 288 | #define ISDN_TTY_FAX_FTT 2 | ||
| 289 | #define ISDN_TTY_FAX_MCF 3 | ||
| 290 | #define ISDN_TTY_FAX_DCS 4 | ||
| 291 | #define ISDN_TTY_FAX_TRAIN_OK 5 | ||
| 292 | #define ISDN_TTY_FAX_EOP 6 | ||
| 293 | #define ISDN_TTY_FAX_EOM 7 | ||
| 294 | #define ISDN_TTY_FAX_MPS 8 | ||
| 295 | #define ISDN_TTY_FAX_DTC 9 | ||
| 296 | #define ISDN_TTY_FAX_RID 10 | ||
| 297 | #define ISDN_TTY_FAX_HNG 11 | ||
| 298 | #define ISDN_TTY_FAX_DT 12 | ||
| 299 | #define ISDN_TTY_FAX_FCON_I 13 | ||
| 300 | #define ISDN_TTY_FAX_DR 14 | ||
| 301 | #define ISDN_TTY_FAX_ET 15 | ||
| 302 | #define ISDN_TTY_FAX_CFR 16 | ||
| 303 | #define ISDN_TTY_FAX_PTS 17 | ||
| 304 | #define ISDN_TTY_FAX_SENT 18 | ||
| 305 | |||
| 306 | #define ISDN_FAX_PHASE_IDLE 0 | ||
| 307 | #define ISDN_FAX_PHASE_A 1 | ||
| 308 | #define ISDN_FAX_PHASE_B 2 | ||
| 309 | #define ISDN_FAX_PHASE_C 3 | ||
| 310 | #define ISDN_FAX_PHASE_D 4 | ||
| 311 | #define ISDN_FAX_PHASE_E 5 | ||
| 312 | |||
| 313 | #endif /* TTY_FAX */ | ||
| 314 | |||
| 315 | #define ISDN_FAX_CLASS1_FAE 0 | ||
| 316 | #define ISDN_FAX_CLASS1_FTS 1 | ||
| 317 | #define ISDN_FAX_CLASS1_FRS 2 | ||
| 318 | #define ISDN_FAX_CLASS1_FTM 3 | ||
| 319 | #define ISDN_FAX_CLASS1_FRM 4 | ||
| 320 | #define ISDN_FAX_CLASS1_FTH 5 | ||
| 321 | #define ISDN_FAX_CLASS1_FRH 6 | ||
| 322 | #define ISDN_FAX_CLASS1_CTRL 7 | ||
| 323 | |||
| 324 | #define ISDN_FAX_CLASS1_OK 0 | ||
| 325 | #define ISDN_FAX_CLASS1_CONNECT 1 | ||
| 326 | #define ISDN_FAX_CLASS1_NOCARR 2 | ||
| 327 | #define ISDN_FAX_CLASS1_ERROR 3 | ||
| 328 | #define ISDN_FAX_CLASS1_FCERROR 4 | ||
| 329 | #define ISDN_FAX_CLASS1_QUERY 5 | ||
| 330 | |||
| 331 | typedef struct { | ||
| 332 | __u8 cmd; | ||
| 333 | __u8 subcmd; | ||
| 334 | __u8 para[50]; | ||
| 335 | } aux_s; | ||
| 336 | |||
| 337 | #define AT_COMMAND 0 | ||
| 338 | #define AT_EQ_VALUE 1 | ||
| 339 | #define AT_QUERY 2 | ||
| 340 | #define AT_EQ_QUERY 3 | ||
| 341 | |||
| 342 | /* CAPI structs */ | ||
| 343 | |||
| 344 | /* this is compatible to the old union size */ | ||
| 345 | #define MAX_CAPI_PARA_LEN 50 | ||
| 346 | |||
| 347 | typedef struct { | ||
| 348 | /* Header */ | ||
| 349 | __u16 Length; | ||
| 350 | __u16 ApplId; | ||
| 351 | __u8 Command; | ||
| 352 | __u8 Subcommand; | ||
| 353 | __u16 Messagenumber; | ||
| 354 | |||
| 355 | /* Parameter */ | ||
| 356 | union { | ||
| 357 | __u32 Controller; | ||
| 358 | __u32 PLCI; | ||
| 359 | __u32 NCCI; | ||
| 360 | } adr; | ||
| 361 | __u8 para[MAX_CAPI_PARA_LEN]; | ||
| 362 | } capi_msg; | ||
| 363 | |||
| 364 | /* | ||
| 365 | * Structure for exchanging above infos | ||
| 366 | * | ||
| 367 | */ | ||
| 368 | typedef struct { | ||
| 369 | int driver; /* Lowlevel-Driver-ID */ | ||
| 370 | int command; /* Command or Status (see above) */ | ||
| 371 | ulong arg; /* Additional Data */ | ||
| 372 | union { | ||
| 373 | ulong errcode; /* Type of error with STAT_L1ERR */ | ||
| 374 | int length; /* Amount of bytes sent with STAT_BSENT */ | ||
| 375 | u_char num[50]; /* Additional Data */ | ||
| 376 | setup_parm setup;/* For SETUP msg */ | ||
| 377 | capi_msg cmsg; /* For CAPI like messages */ | ||
| 378 | char display[85];/* display message data */ | ||
| 379 | isdn_cmd_stat isdn_io; /* ISDN IO-parameter/result */ | ||
| 380 | aux_s aux; /* for modem commands/indications */ | ||
| 381 | #ifdef CONFIG_ISDN_TTY_FAX | ||
| 382 | T30_s *fax; /* Pointer to ttys fax struct */ | ||
| 383 | #endif | ||
| 384 | ulong userdata; /* User Data */ | ||
| 385 | } parm; | ||
| 386 | } isdn_ctrl; | ||
| 387 | |||
| 388 | #define dss1_io isdn_io | ||
| 389 | #define ni1_io isdn_io | ||
| 390 | |||
| 391 | /* | ||
| 392 | * The interface-struct itself (initialized at load-time of lowlevel-driver) | ||
| 393 | * | ||
| 394 | * See Documentation/isdn/INTERFACE for a description, how the communication | ||
| 395 | * between the ISDN subsystem and its drivers is done. | ||
| 396 | * | ||
| 397 | */ | ||
| 398 | typedef struct { | ||
| 399 | struct module *owner; | ||
| 400 | |||
| 401 | /* Number of channels supported by this driver | ||
| 402 | */ | ||
| 403 | int channels; | ||
| 404 | |||
| 405 | /* | ||
| 406 | * Maximum Size of transmit/receive-buffer this driver supports. | ||
| 407 | */ | ||
| 408 | int maxbufsize; | ||
| 409 | |||
| 410 | /* Feature-Flags for this driver. | ||
| 411 | * See defines ISDN_FEATURE_... for Values | ||
| 412 | */ | ||
| 413 | unsigned long features; | ||
| 414 | |||
| 415 | /* | ||
| 416 | * Needed for calculating | ||
| 417 | * dev->hard_header_len = linklayer header + hl_hdrlen; | ||
| 418 | * Drivers, not supporting sk_buff's should set this to 0. | ||
| 419 | */ | ||
| 420 | unsigned short hl_hdrlen; | ||
| 421 | |||
| 422 | /* | ||
| 423 | * Receive-Callback using sk_buff's | ||
| 424 | * Parameters: | ||
| 425 | * int Driver-ID | ||
| 426 | * int local channel-number (0 ...) | ||
| 427 | * struct sk_buff *skb received Data | ||
| 428 | */ | ||
| 429 | void (*rcvcallb_skb)(int, int, struct sk_buff *); | ||
| 430 | |||
| 431 | /* Status-Callback | ||
| 432 | * Parameters: | ||
| 433 | * isdn_ctrl* | ||
| 434 | * driver = Driver ID. | ||
| 435 | * command = One of above ISDN_STAT_... constants. | ||
| 436 | * arg = depending on status-type. | ||
| 437 | * num = depending on status-type. | ||
| 438 | */ | ||
| 439 | int (*statcallb)(isdn_ctrl*); | ||
| 440 | |||
| 441 | /* Send command | ||
| 442 | * Parameters: | ||
| 443 | * isdn_ctrl* | ||
| 444 | * driver = Driver ID. | ||
| 445 | * command = One of above ISDN_CMD_... constants. | ||
| 446 | * arg = depending on command. | ||
| 447 | * num = depending on command. | ||
| 448 | */ | ||
| 449 | int (*command)(isdn_ctrl*); | ||
| 450 | |||
| 451 | /* | ||
| 452 | * Send data using sk_buff's | ||
| 453 | * Parameters: | ||
| 454 | * int driverId | ||
| 455 | * int local channel-number (0...) | ||
| 456 | * int Flag: Need ACK for this packet. | ||
| 457 | * struct sk_buff *skb Data to send | ||
| 458 | */ | ||
| 459 | int (*writebuf_skb) (int, int, int, struct sk_buff *); | ||
| 460 | |||
| 461 | /* Send raw D-Channel-Commands | ||
| 462 | * Parameters: | ||
| 463 | * u_char pointer data | ||
| 464 | * int length of data | ||
| 465 | * int driverId | ||
| 466 | * int local channel-number (0 ...) | ||
| 467 | */ | ||
| 468 | int (*writecmd)(const u_char __user *, int, int, int); | ||
| 469 | |||
| 470 | /* Read raw Status replies | ||
| 471 | * u_char pointer data (volatile) | ||
| 472 | * int length of buffer | ||
| 473 | * int driverId | ||
| 474 | * int local channel-number (0 ...) | ||
| 475 | */ | ||
| 476 | int (*readstat)(u_char __user *, int, int, int); | ||
| 477 | |||
| 478 | char id[20]; | ||
| 479 | } isdn_if; | ||
| 480 | |||
| 481 | /* | ||
| 482 | * Function which must be called by lowlevel-driver at loadtime with | ||
| 483 | * the following fields of above struct set: | ||
| 484 | * | ||
| 485 | * channels Number of channels that will be supported. | ||
| 486 | * hl_hdrlen Space to preserve in sk_buff's when sending. Drivers, not | ||
| 487 | * supporting sk_buff's should set this to 0. | ||
| 488 | * command Address of Command-Handler. | ||
| 489 | * features Bitwise coded Features of this driver. (use ISDN_FEATURE_...) | ||
| 490 | * writebuf_skb Address of Skbuff-Send-Handler. | ||
| 491 | * writecmd " " D-Channel " which accepts raw D-Ch-Commands. | ||
| 492 | * readstat " " D-Channel " which delivers raw Status-Data. | ||
| 493 | * | ||
| 494 | * The linklevel-driver fills the following fields: | ||
| 495 | * | ||
| 496 | * channels Driver-ID assigned to this driver. (Must be used on all | ||
| 497 | * subsequent callbacks. | ||
| 498 | * rcvcallb_skb Address of handler for received Skbuff's. | ||
| 499 | * statcallb " " " for status-changes. | ||
| 500 | * | ||
| 501 | */ | ||
| 502 | extern int register_isdn(isdn_if*); | ||
| 503 | #include <linux/uaccess.h> | ||
| 504 | |||
| 505 | #endif /* __ISDNIF_H__ */ | ||
| @@ -112,6 +112,30 @@ inode_peek_iversion_raw(const struct inode *inode) · 111 unmodified lines | |||
| 112 | return atomic64_read(&inode->i_version); | 112 | return atomic64_read(&inode->i_version); |
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | /** | ||
| 116 | * inode_set_max_iversion_raw - update i_version new value is larger | ||
| 117 | * @inode: inode to set | ||
| 118 | * @val: new i_version to set | ||
| 119 | * | ||
| 120 | * Some self-managed filesystems (e.g Ceph) will only update the i_version | ||
| 121 | * value if the new value is larger than the one we already have. | ||
| 122 | */ | ||
| 123 | static inline void | ||
| 124 | inode_set_max_iversion_raw(struct inode *inode, u64 val) | ||
| 125 | { | ||
| 126 | u64 cur, old; | ||
| 127 | |||
| 128 | cur = inode_peek_iversion_raw(inode); | ||
| 129 | for (;;) { | ||
| 130 | if (cur > val) | ||
| 131 | break; | ||
| 132 | old = atomic64_cmpxchg(&inode->i_version, cur, val); | ||
| 133 | if (likely(old == cur)) | ||
| 134 | break; | ||
| 135 | cur = old; | ||
| 136 | } | ||
| 137 | } | ||
| 138 | |||
| 115 | /** | 139 | /** |
| 116 | * inode_set_iversion - set i_version to a particular value | 140 | * inode_set_iversion - set i_version to a particular value |
| 117 | * @inode: inode to set | 141 | * @inode: inode to set |
| @@ -451,6 +451,22 @@ struct jbd2_inode { · 450 unmodified lines | |||
| 451 | * @i_flags: Flags of inode [j_list_lock] | 451 | * @i_flags: Flags of inode [j_list_lock] |
| 452 | */ | 452 | */ |
| 453 | unsigned long i_flags; | 453 | unsigned long i_flags; |
| 454 | |||
| 455 | /** | ||
| 456 | * @i_dirty_start: | ||
| 457 | * | ||
| 458 | * Offset in bytes where the dirty range for this inode starts. | ||
| 459 | * [j_list_lock] | ||
| 460 | */ | ||
| 461 | loff_t i_dirty_start; | ||
| 462 | |||
| 463 | /** | ||
| 464 | * @i_dirty_end: | ||
| 465 | * | ||
| 466 | * Inclusive offset in bytes where the dirty range for this inode | ||
| 467 | * ends. [j_list_lock] | ||
| 468 | */ | ||
| 469 | loff_t i_dirty_end; | ||
| 454 | }; | 470 | }; |
| 455 | 471 | ||
| 456 | struct jbd2_revoke_table_s; | 472 | struct jbd2_revoke_table_s; |
| @@ -1357,7 +1373,6 @@ void jbd2_journal_set_triggers(struct buffer_head *, · 900 unmodified lines | |||
| 1357 | struct jbd2_buffer_trigger_type *type); | 1373 | struct jbd2_buffer_trigger_type *type); |
| 1358 | extern int jbd2_journal_dirty_metadata (handle_t *, struct buffer_head *); | 1374 | extern int jbd2_journal_dirty_metadata (handle_t *, struct buffer_head *); |
| 1359 | extern int jbd2_journal_forget (handle_t *, struct buffer_head *); | 1375 | extern int jbd2_journal_forget (handle_t *, struct buffer_head *); |
| 1360 | extern void journal_sync_buffer (struct buffer_head *); | ||
| 1361 | extern int jbd2_journal_invalidatepage(journal_t *, | 1376 | extern int jbd2_journal_invalidatepage(journal_t *, |
| 1362 | struct page *, unsigned int, unsigned int); | 1377 | struct page *, unsigned int, unsigned int); |
| 1363 | extern int jbd2_journal_try_to_free_buffers(journal_t *, struct page *, gfp_t); | 1378 | extern int jbd2_journal_try_to_free_buffers(journal_t *, struct page *, gfp_t); |
| @@ -1397,6 +1412,12 @@ extern int jbd2_journal_force_commit(journal_t *); · 33 unmodified lines | |||
| 1397 | extern int jbd2_journal_force_commit_nested(journal_t *); | 1412 | extern int jbd2_journal_force_commit_nested(journal_t *); |
| 1398 | extern int jbd2_journal_inode_add_write(handle_t *handle, struct jbd2_inode *inode); | 1413 | extern int jbd2_journal_inode_add_write(handle_t *handle, struct jbd2_inode *inode); |
| 1399 | extern int jbd2_journal_inode_add_wait(handle_t *handle, struct jbd2_inode *inode); | 1414 | extern int jbd2_journal_inode_add_wait(handle_t *handle, struct jbd2_inode *inode); |
| 1415 | extern int jbd2_journal_inode_ranged_write(handle_t *handle, | ||
| 1416 | struct jbd2_inode *inode, loff_t start_byte, | ||
| 1417 | loff_t length); | ||
| 1418 | extern int jbd2_journal_inode_ranged_wait(handle_t *handle, | ||
| 1419 | struct jbd2_inode *inode, loff_t start_byte, | ||
| 1420 | loff_t length); | ||
| 1400 | extern int jbd2_journal_begin_ordered_truncate(journal_t *journal, | 1421 | extern int jbd2_journal_begin_ordered_truncate(journal_t *journal, |
| 1401 | struct jbd2_inode *inode, loff_t new_size); | 1422 | struct jbd2_inode *inode, loff_t new_size); |
| 1402 | extern void jbd2_journal_init_jbd_inode(struct jbd2_inode *jinode, struct inode *inode); | 1423 | extern void jbd2_journal_init_jbd_inode(struct jbd2_inode *jinode, struct inode *inode); |
| @@ -17,7 +17,7 @@ · 16 unmodified lines | |||
| 17 | * if SELF_TEST is defined. You can use this free for any purpose. It's in | 17 | * if SELF_TEST is defined. You can use this free for any purpose. It's in |
| 18 | * the public domain. It has no warranty. | 18 | * the public domain. It has no warranty. |
| 19 | * | 19 | * |
| 20 | * Copyright (C) 2009-2010 Jozsef Kadlecsik (kadlec@blackhole.kfki.hu) | 20 | * Copyright (C) 2009-2010 Jozsef Kadlecsik (kadlec@netfilter.org) |
| 21 | * | 21 | * |
| 22 | * I've modified Bob's hash to be useful in the Linux kernel, and | 22 | * I've modified Bob's hash to be useful in the Linux kernel, and |
| 23 | * any bugs present are my fault. | 23 | * any bugs present are my fault. |
| @@ -215,6 +215,9 @@ extern void arch_jump_label_transform(struct jump_entry *entry, · 214 unmodified lines | |||
| 215 | enum jump_label_type type); | 215 | enum jump_label_type type); |
| 216 | extern void arch_jump_label_transform_static(struct jump_entry *entry, | 216 | extern void arch_jump_label_transform_static(struct jump_entry *entry, |
| 217 | enum jump_label_type type); | 217 | enum jump_label_type type); |
| 218 | extern bool arch_jump_label_transform_queue(struct jump_entry *entry, | ||
| 219 | enum jump_label_type type); | ||
| 220 | extern void arch_jump_label_transform_apply(void); | ||
| 218 | extern int jump_label_text_reserved(void *start, void *end); | 221 | extern int jump_label_text_reserved(void *start, void *end); |
| 219 | extern void static_key_slow_inc(struct static_key *key); | 222 | extern void static_key_slow_inc(struct static_key *key); |
| 220 | extern void static_key_slow_dec(struct static_key *key); | 223 | extern void static_key_slow_dec(struct static_key *key); |
| @@ -60,8 +60,6 @@ extern void jump_label_update_timeout(struct work_struct *work); · 59 unmodified lines | |||
| 60 | 0), \ | 60 | 0), \ |
| 61 | } | 61 | } |
| 62 | 62 | ||
| 63 | #define static_branch_deferred_inc(x) static_branch_inc(&(x)->key) | ||
| 64 | |||
| 65 | #else /* !CONFIG_JUMP_LABEL */ | 63 | #else /* !CONFIG_JUMP_LABEL */ |
| 66 | struct static_key_deferred { | 64 | struct static_key_deferred { |
| 67 | struct static_key key; | 65 | struct static_key key; |
| @@ -95,4 +93,7 @@ jump_label_rate_limit(struct static_key_deferred *key, · 27 unmodified lines | |||
| 95 | STATIC_KEY_CHECK_USE(key); | 93 | STATIC_KEY_CHECK_USE(key); |
| 96 | } | 94 | } |
| 97 | #endif /* CONFIG_JUMP_LABEL */ | 95 | #endif /* CONFIG_JUMP_LABEL */ |
| 96 | |||
| 97 | #define static_branch_deferred_inc(x) static_branch_inc(&(x)->key) | ||
| 98 | |||
| 98 | #endif /* _LINUX_JUMP_LABEL_RATELIMIT_H */ | 99 | #endif /* _LINUX_JUMP_LABEL_RATELIMIT_H */ |
| @@ -2,14 +2,43 @@ · 1 unmodified line | |||
| 2 | #ifndef _LINUX_KASAN_CHECKS_H | 2 | #ifndef _LINUX_KASAN_CHECKS_H |
| 3 | #define _LINUX_KASAN_CHECKS_H | 3 | #define _LINUX_KASAN_CHECKS_H |
| 4 | 4 | ||
| 5 | #if defined(__SANITIZE_ADDRESS__) || defined(__KASAN_INTERNAL) | 5 | #include <linux/types.h> |
| 6 | void kasan_check_read(const volatile void *p, unsigned int size); | 6 | |
| 7 | void kasan_check_write(const volatile void *p, unsigned int size); | 7 | /* |
| 8 | * __kasan_check_*: Always available when KASAN is enabled. This may be used | ||
| 9 | * even in compilation units that selectively disable KASAN, but must use KASAN | ||
| 10 | * to validate access to an address. Never use these in header files! | ||
| 11 | */ | ||
| 12 | #ifdef CONFIG_KASAN | ||
| 13 | bool __kasan_check_read(const volatile void *p, unsigned int size); | ||
| 14 | bool __kasan_check_write(const volatile void *p, unsigned int size); | ||
| 15 | #else | ||
| 16 | static inline bool __kasan_check_read(const volatile void *p, unsigned int size) | ||
| 17 | { | ||
| 18 | return true; | ||
| 19 | } | ||
| 20 | static inline bool __kasan_check_write(const volatile void *p, unsigned int size) | ||
| 21 | { | ||
| 22 | return true; | ||
| 23 | } | ||
| 24 | #endif | ||
| 25 | |||
| 26 | /* | ||
| 27 | * kasan_check_*: Only available when the particular compilation unit has KASAN | ||
| 28 | * instrumentation enabled. May be used in header files. | ||
| 29 | */ | ||
| 30 | #ifdef __SANITIZE_ADDRESS__ | ||
| 31 | #define kasan_check_read __kasan_check_read | ||
| 32 | #define kasan_check_write __kasan_check_write | ||
| 8 | #else | 33 | #else |
| 9 | static inline void kasan_check_read(const volatile void *p, unsigned int size) | 34 | static inline bool kasan_check_read(const volatile void *p, unsigned int size) |
| 10 | { } | 35 | { |
| 11 | static inline void kasan_check_write(const volatile void *p, unsigned int size) | 36 | return true; |
| 12 | { } | 37 | } |
| 38 | static inline bool kasan_check_write(const volatile void *p, unsigned int size) | ||
| 39 | { | ||
| 40 | return true; | ||
| 41 | } | ||
| 13 | #endif | 42 | #endif |
| 14 | 43 | ||
| 15 | #endif | 44 | #endif |
| @@ -76,8 +76,11 @@ void kasan_free_shadow(const struct vm_struct *vm); · 75 unmodified lines | |||
| 76 | int kasan_add_zero_shadow(void *start, unsigned long size); | 76 | int kasan_add_zero_shadow(void *start, unsigned long size); |
| 77 | void kasan_remove_zero_shadow(void *start, unsigned long size); | 77 | void kasan_remove_zero_shadow(void *start, unsigned long size); |
| 78 | 78 | ||
| 79 | size_t ksize(const void *); | 79 | size_t __ksize(const void *); |
| 80 | static inline void kasan_unpoison_slab(const void *ptr) { ksize(ptr); } | 80 | static inline void kasan_unpoison_slab(const void *ptr) |
| 81 | { | ||
| 82 | kasan_unpoison_shadow(ptr, __ksize(ptr)); | ||
| 83 | } | ||
| 81 | size_t kasan_metadata_size(struct kmem_cache *cache); | 84 | size_t kasan_metadata_size(struct kmem_cache *cache); |
| 82 | 85 | ||
| 83 | bool kasan_save_enable_multi_shot(void); | 86 | bool kasan_save_enable_multi_shot(void); |
| @@ -88,6 +88,8 @@ · 87 unmodified lines | |||
| 88 | */ | 88 | */ |
| 89 | #define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f)) | 89 | #define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f)) |
| 90 | 90 | ||
| 91 | #define typeof_member(T, m) typeof(((T*)0)->m) | ||
| 92 | |||
| 91 | #define DIV_ROUND_UP __KERNEL_DIV_ROUND_UP | 93 | #define DIV_ROUND_UP __KERNEL_DIV_ROUND_UP |
| 92 | 94 | ||
| 93 | #define DIV_ROUND_DOWN_ULL(ll, d) \ | 95 | #define DIV_ROUND_DOWN_ULL(ll, d) \ |
| @@ -70,6 +70,9 @@ struct key_type { · 69 unmodified lines | |||
| 70 | */ | 70 | */ |
| 71 | size_t def_datalen; | 71 | size_t def_datalen; |
| 72 | 72 | ||
| 73 | unsigned int flags; | ||
| 74 | #define KEY_TYPE_NET_DOMAIN 0x00000001 /* Keys of this type have a net namespace domain */ | ||
| 75 | |||
| 73 | /* vet a description */ | 76 | /* vet a description */ |
| 74 | int (*vet_description)(const char *description); | 77 | int (*vet_description)(const char *description); |
| 75 | 78 | ||
| @@ -31,6 +31,7 @@ typedef int32_t key_serial_t; · 30 unmodified lines | |||
| 31 | typedef uint32_t key_perm_t; | 31 | typedef uint32_t key_perm_t; |
| 32 | 32 | ||
| 33 | struct key; | 33 | struct key; |
| 34 | struct net; | ||
| 34 | 35 | ||
| 35 | #ifdef CONFIG_KEYS | 36 | #ifdef CONFIG_KEYS |
| 36 | 37 | ||
| @@ -77,13 +78,34 @@ struct cred; · 40 unmodified lines | |||
| 77 | 78 | ||
| 78 | struct key_type; | 79 | struct key_type; |
| 79 | struct key_owner; | 80 | struct key_owner; |
| 81 | struct key_tag; | ||
| 80 | struct keyring_list; | 82 | struct keyring_list; |
| 81 | struct keyring_name; | 83 | struct keyring_name; |
| 82 | 84 | ||
| 85 | struct key_tag { | ||
| 86 | struct rcu_head rcu; | ||
| 87 | refcount_t usage; | ||
| 88 | bool removed; /* T when subject removed */ | ||
| 89 | }; | ||
| 90 | |||
| 83 | struct keyring_index_key { | 91 | struct keyring_index_key { |
| 92 | /* [!] If this structure is altered, the union in struct key must change too! */ | ||
| 93 | unsigned long hash; /* Hash value */ | ||
| 94 | union { | ||
| 95 | struct { | ||
| 96 | #ifdef __LITTLE_ENDIAN /* Put desc_len at the LSB of x */ | ||
| 97 | u8 desc_len; | ||
| 98 | char desc[sizeof(long) - 1]; /* First few chars of description */ | ||
| 99 | #else | ||
| 100 | char desc[sizeof(long) - 1]; /* First few chars of description */ | ||
| 101 | u8 desc_len; | ||
| 102 | #endif | ||
| 103 | }; | ||
| 104 | unsigned long x; | ||
| 105 | }; | ||
| 84 | struct key_type *type; | 106 | struct key_type *type; |
| 107 | struct key_tag *domain_tag; /* Domain of operation */ | ||
| 85 | const char *description; | 108 | const char *description; |
| 86 | size_t desc_len; | ||
| 87 | }; | 109 | }; |
| 88 | 110 | ||
| 89 | union key_payload { | 111 | union key_payload { |
| @@ -197,7 +219,10 @@ struct key { · 107 unmodified lines | |||
| 197 | union { | 219 | union { |
| 198 | struct keyring_index_key index_key; | 220 | struct keyring_index_key index_key; |
| 199 | struct { | 221 | struct { |
| 222 | unsigned long hash; | ||
| 223 | unsigned long len_desc; | ||
| 200 | struct key_type *type; /* type of key */ | 224 | struct key_type *type; /* type of key */ |
| 225 | struct key_tag *domain_tag; /* Domain of operation */ | ||
| 201 | char *description; | 226 | char *description; |
| 202 | }; | 227 | }; |
| 203 | }; | 228 | }; |
| @@ -248,6 +273,8 @@ extern struct key *key_alloc(struct key_type *type, · 44 unmodified lines | |||
| 248 | extern void key_revoke(struct key *key); | 273 | extern void key_revoke(struct key *key); |
| 249 | extern void key_invalidate(struct key *key); | 274 | extern void key_invalidate(struct key *key); |
| 250 | extern void key_put(struct key *key); | 275 | extern void key_put(struct key *key); |
| 276 | extern bool key_put_tag(struct key_tag *tag); | ||
| 277 | extern void key_remove_domain(struct key_tag *domain_tag); | ||
| 251 | 278 | ||
| 252 | static inline struct key *__key_get(struct key *key) | 279 | static inline struct key *__key_get(struct key *key) |
| 253 | { | 280 | { |
| @@ -265,26 +292,56 @@ static inline void key_ref_put(key_ref_t key_ref) · 11 unmodified lines | |||
| 265 | key_put(key_ref_to_ptr(key_ref)); | 292 | key_put(key_ref_to_ptr(key_ref)); |
| 266 | } | 293 | } |
| 267 | 294 | ||
| 268 | extern struct key *request_key(struct key_type *type, | 295 | extern struct key *request_key_tag(struct key_type *type, |
| 269 | const char *description, | 296 | const char *description, |
| 270 | const char *callout_info); | 297 | struct key_tag *domain_tag, |
| 298 | const char *callout_info); | ||
| 299 | |||
| 300 | extern struct key *request_key_rcu(struct key_type *type, | ||
| 301 | const char *description, | ||
| 302 | struct key_tag *domain_tag); | ||
| 271 | 303 | ||
| 272 | extern struct key *request_key_with_auxdata(struct key_type *type, | 304 | extern struct key *request_key_with_auxdata(struct key_type *type, |
| 273 | const char *description, | 305 | const char *description, |
| 306 | struct key_tag *domain_tag, | ||
| 274 | const void *callout_info, | 307 | const void *callout_info, |
| 275 | size_t callout_len, | 308 | size_t callout_len, |
| 276 | void *aux); | 309 | void *aux); |
| 277 | 310 | ||
| 278 | extern struct key *request_key_async(struct key_type *type, | 311 | /** |
| 279 | const char *description, | 312 | * request_key - Request a key and wait for construction |
| 280 | const void *callout_info, | 313 | * @type: Type of key. |
| 281 | size_t callout_len); | 314 | * @description: The searchable description of the key. |
| 315 | * @callout_info: The data to pass to the instantiation upcall (or NULL). | ||
| 316 | * | ||
| 317 | * As for request_key_tag(), but with the default global domain tag. | ||
| 318 | */ | ||
| 319 | static inline struct key *request_key(struct key_type *type, | ||
| 320 | const char *description, | ||
| 321 | const char *callout_info) | ||
| 322 | { | ||
| 323 | return request_key_tag(type, description, NULL, callout_info); | ||
| 324 | } | ||
| 282 | 325 | ||
| 283 | extern struct key *request_key_async_with_auxdata(struct key_type *type, | 326 | #ifdef CONFIG_NET |
| 284 | const char *description, | 327 | /* |
| 285 | const void *callout_info, | 328 | * request_key_net - Request a key for a net namespace and wait for construction |
| 286 | size_t callout_len, | 329 | * @type: Type of key. |
| 287 | void *aux); | 330 | * @description: The searchable description of the key. |
| 331 | * @net: The network namespace that is the key's domain of operation. | ||
| 332 | * @callout_info: The data to pass to the instantiation upcall (or NULL). | ||
| 333 | * | ||
| 334 | * As for request_key() except that it does not add the returned key to a | ||
| 335 | * keyring if found, new keys are always allocated in the user's quota, the | ||
| 336 | * callout_info must be a NUL-terminated string and no auxiliary data can be | ||
| 337 | * passed. Only keys that operate the specified network namespace are used. | ||
| 338 | * | ||
| 339 | * Furthermore, it then works as wait_for_key_construction() to wait for the | ||
| 340 | * completion of keys undergoing construction with a non-interruptible wait. | ||
| 341 | */ | ||
| 342 | #define request_key_net(type, description, net, callout_info) \ | ||
| 343 | request_key_tag(type, description, net->key_domain, callout_info); | ||
| 344 | #endif /* CONFIG_NET */ | ||
| 288 | 345 | ||
| 289 | extern int wait_for_key_construction(struct key *key, bool intr); | 346 | extern int wait_for_key_construction(struct key *key, bool intr); |
| 290 | 347 | ||
| @@ -305,6 +362,11 @@ extern int key_update(key_ref_t key, · 14 unmodified lines | |||
| 305 | extern int key_link(struct key *keyring, | 362 | extern int key_link(struct key *keyring, |
| 306 | struct key *key); | 363 | struct key *key); |
| 307 | 364 | ||
| 365 | extern int key_move(struct key *key, | ||
| 366 | struct key *from_keyring, | ||
| 367 | struct key *to_keyring, | ||
| 368 | unsigned int flags); | ||
| 369 | |||
| 308 | extern int key_unlink(struct key *keyring, | 370 | extern int key_unlink(struct key *keyring, |
| 309 | struct key *key); | 371 | struct key *key); |
| 310 | 372 | ||
| @@ -324,7 +386,8 @@ extern int keyring_clear(struct key *keyring); · 13 unmodified lines | |||
| 324 | 386 | ||
| 325 | extern key_ref_t keyring_search(key_ref_t keyring, | 387 | extern key_ref_t keyring_search(key_ref_t keyring, |
| 326 | struct key_type *type, | 388 | struct key_type *type, |
| 327 | const char *description); | 389 | const char *description, |
| 390 | bool recurse); | ||
| 328 | 391 | ||
| 329 | extern int keyring_add_key(struct key *keyring, | 392 | extern int keyring_add_key(struct key *keyring, |
| 330 | struct key *key); | 393 | struct key *key); |
| @@ -343,6 +406,7 @@ extern void key_set_timeout(struct key *, unsigned); · 12 unmodified lines | |||
| 343 | 406 | ||
| 344 | extern key_ref_t lookup_user_key(key_serial_t id, unsigned long flags, | 407 | extern key_ref_t lookup_user_key(key_serial_t id, unsigned long flags, |
| 345 | key_perm_t perm); | 408 | key_perm_t perm); |
| 409 | extern void key_free_user_ns(struct user_namespace *); | ||
| 346 | 410 | ||
| 347 | /* | 411 | /* |
| 348 | * The permissions required on a key that we're looking up. | 412 | * The permissions required on a key that we're looking up. |
| @@ -397,8 +461,8 @@ extern struct ctl_table key_sysctls[]; · 48 unmodified lines | |||
| 397 | * the userspace interface | 461 | * the userspace interface |
| 398 | */ | 462 | */ |
| 399 | extern int install_thread_keyring_to_cred(struct cred *cred); | 463 | extern int install_thread_keyring_to_cred(struct cred *cred); |
| 400 | extern void key_fsuid_changed(struct task_struct *tsk); | 464 | extern void key_fsuid_changed(struct cred *new_cred); |
| 401 | extern void key_fsgid_changed(struct task_struct *tsk); | 465 | extern void key_fsgid_changed(struct cred *new_cred); |
| 402 | extern void key_init(void); | 466 | extern void key_init(void); |
| 403 | 467 | ||
| 404 | #else /* CONFIG_KEYS */ | 468 | #else /* CONFIG_KEYS */ |
| @@ -413,9 +477,11 @@ extern void key_init(void); · 8 unmodified lines | |||
| 413 | #define make_key_ref(k, p) NULL | 477 | #define make_key_ref(k, p) NULL |
| 414 | #define key_ref_to_ptr(k) NULL | 478 | #define key_ref_to_ptr(k) NULL |
| 415 | #define is_key_possessed(k) 0 | 479 | #define is_key_possessed(k) 0 |
| 416 | #define key_fsuid_changed(t) do { } while(0) | 480 | #define key_fsuid_changed(c) do { } while(0) |
| 417 | #define key_fsgid_changed(t) do { } while(0) | 481 | #define key_fsgid_changed(c) do { } while(0) |
| 418 | #define key_init() do { } while(0) | 482 | #define key_init() do { } while(0) |
| 483 | #define key_free_user_ns(ns) do { } while(0) | ||
| 484 | #define key_remove_domain(d) do { } while(0) | ||
| 419 | 485 | ||
| 420 | #endif /* CONFIG_KEYS */ | 486 | #endif /* CONFIG_KEYS */ |
| 421 | #endif /* __KERNEL__ */ | 487 | #endif /* __KERNEL__ */ |
| @@ -458,4 +458,23 @@ static inline bool is_kprobe_optinsn_slot(unsigned long addr) · 457 unmodified lines | |||
| 458 | } | 458 | } |
| 459 | #endif | 459 | #endif |
| 460 | 460 | ||
| 461 | /* Returns true if kprobes handled the fault */ | ||
| 462 | static nokprobe_inline bool kprobe_page_fault(struct pt_regs *regs, | ||
| 463 | unsigned int trap) | ||
| 464 | { | ||
| 465 | if (!kprobes_built_in()) | ||
| 466 | return false; | ||
| 467 | if (user_mode(regs)) | ||
| 468 | return false; | ||
| 469 | /* | ||
| 470 | * To be potentially processing a kprobe fault and to be allowed | ||
| 471 | * to call kprobe_running(), we have to be non-preemptible. | ||
| 472 | */ | ||
| 473 | if (preemptible()) | ||
| 474 | return false; | ||
| 475 | if (!kprobe_running()) | ||
| 476 | return false; | ||
| 477 | return kprobe_fault_handler(regs, trap); | ||
| 478 | } | ||
| 479 | |||
| 461 | #endif /* _LINUX_KPROBES_H */ | 480 | #endif /* _LINUX_KPROBES_H */ |
| @@ -159,7 +159,7 @@ static inline bool is_error_page(struct page *page) · 158 unmodified lines | |||
| 159 | 159 | ||
| 160 | extern struct kmem_cache *kvm_vcpu_cache; | 160 | extern struct kmem_cache *kvm_vcpu_cache; |
| 161 | 161 | ||
| 162 | extern spinlock_t kvm_lock; | 162 | extern struct mutex kvm_lock; |
| 163 | extern struct list_head vm_list; | 163 | extern struct list_head vm_list; |
| 164 | 164 | ||
| 165 | struct kvm_io_range { | 165 | struct kvm_io_range { |
| @@ -318,6 +318,7 @@ struct kvm_vcpu { · 152 unmodified lines | |||
| 318 | } spin_loop; | 318 | } spin_loop; |
| 319 | #endif | 319 | #endif |
| 320 | bool preempted; | 320 | bool preempted; |
| 321 | bool ready; | ||
| 321 | struct kvm_vcpu_arch arch; | 322 | struct kvm_vcpu_arch arch; |
| 322 | struct dentry *debugfs_dentry; | 323 | struct dentry *debugfs_dentry; |
| 323 | }; | 324 | }; |
| @@ -860,17 +861,19 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu); · 536 unmodified lines | |||
| 860 | void kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu); | 861 | void kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu); |
| 861 | void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu); | 862 | void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu); |
| 862 | 863 | ||
| 863 | bool kvm_arch_has_vcpu_debugfs(void); | 864 | #ifdef __KVM_HAVE_ARCH_VCPU_DEBUGFS |
| 864 | int kvm_arch_create_vcpu_debugfs(struct kvm_vcpu *vcpu); | 865 | void kvm_arch_create_vcpu_debugfs(struct kvm_vcpu *vcpu); |
| 866 | #endif | ||
| 865 | 867 | ||
| 866 | int kvm_arch_hardware_enable(void); | 868 | int kvm_arch_hardware_enable(void); |
| 867 | void kvm_arch_hardware_disable(void); | 869 | void kvm_arch_hardware_disable(void); |
| 868 | int kvm_arch_hardware_setup(void); | 870 | int kvm_arch_hardware_setup(void); |
| 869 | void kvm_arch_hardware_unsetup(void); | 871 | void kvm_arch_hardware_unsetup(void); |
| 870 | void kvm_arch_check_processor_compat(void *rtn); | 872 | int kvm_arch_check_processor_compat(void); |
| 871 | int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu); | 873 | int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu); |
| 872 | bool kvm_arch_vcpu_in_kernel(struct kvm_vcpu *vcpu); | 874 | bool kvm_arch_vcpu_in_kernel(struct kvm_vcpu *vcpu); |
| 873 | int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu); | 875 | int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu); |
| 876 | bool kvm_arch_dy_runnable(struct kvm_vcpu *vcpu); | ||
| 874 | 877 | ||
| 875 | #ifndef __KVM_HAVE_ARCH_VM_ALLOC | 878 | #ifndef __KVM_HAVE_ARCH_VM_ALLOC |
| 876 | /* | 879 | /* |
| @@ -990,6 +993,7 @@ void kvm_unregister_irq_ack_notifier(struct kvm *kvm, · 113 unmodified lines | |||
| 990 | struct kvm_irq_ack_notifier *kian); | 993 | struct kvm_irq_ack_notifier *kian); |
| 991 | int kvm_request_irq_source_id(struct kvm *kvm); | 994 | int kvm_request_irq_source_id(struct kvm *kvm); |
| 992 | void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id); | 995 | void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id); |
| 996 | bool kvm_arch_irqfd_allowed(struct kvm *kvm, struct kvm_irqfd *args); | ||
| 993 | 997 | ||
| 994 | /* | 998 | /* |
| 995 | * search_memslots() and __gfn_to_memslot() are here because they are | 999 | * search_memslots() and __gfn_to_memslot() are here because they are |
| @@ -0,0 +1,47 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | // TI LMU Common Core | ||
| 3 | // Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/ | ||
| 4 | |||
| 5 | #ifndef _TI_LMU_COMMON_H_ | ||
| 6 | #define _TI_LMU_COMMON_H_ | ||
| 7 | |||
| 8 | #include <linux/delay.h> | ||
| 9 | #include <linux/device.h> | ||
| 10 | #include <linux/init.h> | ||
| 11 | #include <linux/leds.h> | ||
| 12 | #include <linux/module.h> | ||
| 13 | #include <linux/regmap.h> | ||
| 14 | #include <linux/slab.h> | ||
| 15 | #include <uapi/linux/uleds.h> | ||
| 16 | |||
| 17 | #define LMU_11BIT_LSB_MASK (BIT(0) | BIT(1) | BIT(2)) | ||
| 18 | #define LMU_11BIT_MSB_SHIFT 3 | ||
| 19 | |||
| 20 | #define MAX_BRIGHTNESS_8BIT 255 | ||
| 21 | #define MAX_BRIGHTNESS_11BIT 2047 | ||
| 22 | |||
| 23 | struct ti_lmu_bank { | ||
| 24 | struct regmap *regmap; | ||
| 25 | |||
| 26 | int max_brightness; | ||
| 27 | |||
| 28 | u8 lsb_brightness_reg; | ||
| 29 | u8 msb_brightness_reg; | ||
| 30 | |||
| 31 | u8 runtime_ramp_reg; | ||
| 32 | u32 ramp_up_usec; | ||
| 33 | u32 ramp_down_usec; | ||
| 34 | }; | ||
| 35 | |||
| 36 | int ti_lmu_common_set_brightness(struct ti_lmu_bank *lmu_bank, int brightness); | ||
| 37 | |||
| 38 | int ti_lmu_common_set_ramp(struct ti_lmu_bank *lmu_bank); | ||
| 39 | |||
| 40 | int ti_lmu_common_get_ramp_params(struct device *dev, | ||
| 41 | struct fwnode_handle *child, | ||
| 42 | struct ti_lmu_bank *lmu_data); | ||
| 43 | |||
| 44 | int ti_lmu_common_get_brt_res(struct device *dev, struct fwnode_handle *child, | ||
| 45 | struct ti_lmu_bank *lmu_data); | ||
| 46 | |||
| 47 | #endif /* _TI_LMU_COMMON_H_ */ | ||
| @@ -11,6 +11,7 @@ · 10 unmodified lines | |||
| 11 | #include <linux/types.h> | 11 | #include <linux/types.h> |
| 12 | #include <linux/uuid.h> | 12 | #include <linux/uuid.h> |
| 13 | #include <linux/spinlock.h> | 13 | #include <linux/spinlock.h> |
| 14 | #include <linux/bio.h> | ||
| 14 | 15 | ||
| 15 | struct badrange_entry { | 16 | struct badrange_entry { |
| 16 | u64 start; | 17 | u64 start; |
| @@ -57,6 +58,9 @@ enum { · 40 unmodified lines | |||
| 57 | */ | 58 | */ |
| 58 | ND_REGION_PERSIST_MEMCTRL = 2, | 59 | ND_REGION_PERSIST_MEMCTRL = 2, |
| 59 | 60 | ||
| 61 | /* Platform provides asynchronous flush mechanism */ | ||
| 62 | ND_REGION_ASYNC = 3, | ||
| 63 | |||
| 60 | /* mark newly adjusted resources as requiring a label update */ | 64 | /* mark newly adjusted resources as requiring a label update */ |
| 61 | DPA_RESOURCE_ADJUSTED = 1 << 0, | 65 | DPA_RESOURCE_ADJUSTED = 1 << 0, |
| 62 | }; | 66 | }; |
| @@ -113,6 +117,7 @@ struct nd_mapping_desc { · 50 unmodified lines | |||
| 113 | int position; | 117 | int position; |
| 114 | }; | 118 | }; |
| 115 | 119 | ||
| 120 | struct nd_region; | ||
| 116 | struct nd_region_desc { | 121 | struct nd_region_desc { |
| 117 | struct resource *res; | 122 | struct resource *res; |
| 118 | struct nd_mapping_desc *mapping; | 123 | struct nd_mapping_desc *mapping; |
| @@ -125,6 +130,7 @@ struct nd_region_desc { · 6 unmodified lines | |||
| 125 | int target_node; | 130 | int target_node; |
| 126 | unsigned long flags; | 131 | unsigned long flags; |
| 127 | struct device_node *of_node; | 132 | struct device_node *of_node; |
| 133 | int (*flush)(struct nd_region *nd_region, struct bio *bio); | ||
| 128 | }; | 134 | }; |
| 129 | 135 | ||
| 130 | struct device; | 136 | struct device; |
| @@ -252,10 +258,12 @@ unsigned long nd_blk_memremap_flags(struct nd_blk_region *ndbr); · 121 unmodified lines | |||
| 252 | unsigned int nd_region_acquire_lane(struct nd_region *nd_region); | 258 | unsigned int nd_region_acquire_lane(struct nd_region *nd_region); |
| 253 | void nd_region_release_lane(struct nd_region *nd_region, unsigned int lane); | 259 | void nd_region_release_lane(struct nd_region *nd_region, unsigned int lane); |
| 254 | u64 nd_fletcher64(void *addr, size_t len, bool le); | 260 | u64 nd_fletcher64(void *addr, size_t len, bool le); |
| 255 | void nvdimm_flush(struct nd_region *nd_region); | 261 | int nvdimm_flush(struct nd_region *nd_region, struct bio *bio); |
| 262 | int generic_nvdimm_flush(struct nd_region *nd_region); | ||
| 256 | int nvdimm_has_flush(struct nd_region *nd_region); | 263 | int nvdimm_has_flush(struct nd_region *nd_region); |
| 257 | int nvdimm_has_cache(struct nd_region *nd_region); | 264 | int nvdimm_has_cache(struct nd_region *nd_region); |
| 258 | int nvdimm_in_overwrite(struct nvdimm *nvdimm); | 265 | int nvdimm_in_overwrite(struct nvdimm *nvdimm); |
| 266 | bool is_nvdimm_sync(struct nd_region *nd_region); | ||
| 259 | 267 | ||
| 260 | static inline int nvdimm_ctl(struct nvdimm *nvdimm, unsigned int cmd, void *buf, | 268 | static inline int nvdimm_ctl(struct nvdimm *nvdimm, unsigned int cmd, void *buf, |
| 261 | unsigned int buf_len, int *cmd_rc) | 269 | unsigned int buf_len, int *cmd_rc) |
| @@ -106,6 +106,20 @@ static inline void __list_del(struct list_head * prev, struct list_head * next) · 105 unmodified lines | |||
| 106 | WRITE_ONCE(prev->next, next); | 106 | WRITE_ONCE(prev->next, next); |
| 107 | } | 107 | } |
| 108 | 108 | ||
| 109 | /* | ||
| 110 | * Delete a list entry and clear the 'prev' pointer. | ||
| 111 | * | ||
| 112 | * This is a special-purpose list clearing method used in the networking code | ||
| 113 | * for lists allocated as per-cpu, where we don't want to incur the extra | ||
| 114 | * WRITE_ONCE() overhead of a regular list_del_init(). The code that uses this | ||
| 115 | * needs to check the node 'prev' pointer instead of calling list_empty(). | ||
| 116 | */ | ||
| 117 | static inline void __list_del_clearprev(struct list_head *entry) | ||
| 118 | { | ||
| 119 | __list_del(entry->prev, entry->next); | ||
| 120 | entry->prev = NULL; | ||
| 121 | } | ||
| 122 | |||
| 109 | /** | 123 | /** |
| 110 | * list_del - deletes entry from list. | 124 | * list_del - deletes entry from list. |
| 111 | * @entry: the element to delete from the list. | 125 | * @entry: the element to delete from the list. |
| @@ -35,7 +35,6 @@ · 34 unmodified lines | |||
| 35 | * @stack_node: list node for klp_ops func_stack list | 35 | * @stack_node: list node for klp_ops func_stack list |
| 36 | * @old_size: size of the old function | 36 | * @old_size: size of the old function |
| 37 | * @new_size: size of the new function | 37 | * @new_size: size of the new function |
| 38 | * @kobj_added: @kobj has been added and needs freeing | ||
| 39 | * @nop: temporary patch to use the original code again; dyn. allocated | 38 | * @nop: temporary patch to use the original code again; dyn. allocated |
| 40 | * @patched: the func has been added to the klp_ops list | 39 | * @patched: the func has been added to the klp_ops list |
| 41 | * @transition: the func is currently being applied or reverted | 40 | * @transition: the func is currently being applied or reverted |
| @@ -113,7 +112,6 @@ struct klp_callbacks { · 71 unmodified lines | |||
| 113 | * @node: list node for klp_patch obj_list | 112 | * @node: list node for klp_patch obj_list |
| 114 | * @mod: kernel module associated with the patched object | 113 | * @mod: kernel module associated with the patched object |
| 115 | * (NULL for vmlinux) | 114 | * (NULL for vmlinux) |
| 116 | * @kobj_added: @kobj has been added and needs freeing | ||
| 117 | * @dynamic: temporary object for nop functions; dynamically allocated | 115 | * @dynamic: temporary object for nop functions; dynamically allocated |
| 118 | * @patched: the object's funcs have been added to the klp_ops list | 116 | * @patched: the object's funcs have been added to the klp_ops list |
| 119 | */ | 117 | */ |
| @@ -140,7 +138,6 @@ struct klp_object { · 20 unmodified lines | |||
| 140 | * @list: list node for global list of actively used patches | 138 | * @list: list node for global list of actively used patches |
| 141 | * @kobj: kobject for sysfs resources | 139 | * @kobj: kobject for sysfs resources |
| 142 | * @obj_list: dynamic list of the object entries | 140 | * @obj_list: dynamic list of the object entries |
| 143 | * @kobj_added: @kobj has been added and needs freeing | ||
| 144 | * @enabled: the patch is enabled (but operation may be incomplete) | 141 | * @enabled: the patch is enabled (but operation may be incomplete) |
| 145 | * @forced: was involved in a forced transition | 142 | * @forced: was involved in a forced transition |
| 146 | * @free_work: patch cleanup from workqueue-context | 143 | * @free_work: patch cleanup from workqueue-context |
| @@ -282,6 +282,7 @@ void nlmsvc_traverse_blocks(struct nlm_host *, struct nlm_file *, · 281 unmodified lines | |||
| 282 | nlm_host_match_fn_t match); | 282 | nlm_host_match_fn_t match); |
| 283 | void nlmsvc_grant_reply(struct nlm_cookie *, __be32); | 283 | void nlmsvc_grant_reply(struct nlm_cookie *, __be32); |
| 284 | void nlmsvc_release_call(struct nlm_rqst *); | 284 | void nlmsvc_release_call(struct nlm_rqst *); |
| 285 | void nlmsvc_locks_init_private(struct file_lock *, struct nlm_host *, pid_t); | ||
| 285 | 286 | ||
| 286 | /* | 287 | /* |
| 287 | * File handling for the server personality | 288 | * File handling for the server personality |
| @@ -289,6 +290,7 @@ void nlmsvc_release_call(struct nlm_rqst *); · 1 unmodified line | |||
| 289 | __be32 nlm_lookup_file(struct svc_rqst *, struct nlm_file **, | 290 | __be32 nlm_lookup_file(struct svc_rqst *, struct nlm_file **, |
| 290 | struct nfs_fh *); | 291 | struct nfs_fh *); |
| 291 | void nlm_release_file(struct nlm_file *); | 292 | void nlm_release_file(struct nlm_file *); |
| 293 | void nlmsvc_release_lockowner(struct nlm_lock *); | ||
| 292 | void nlmsvc_mark_resources(struct net *); | 294 | void nlmsvc_mark_resources(struct net *); |
| 293 | void nlmsvc_free_host_resources(struct nlm_host *); | 295 | void nlmsvc_free_host_resources(struct nlm_host *); |
| 294 | void nlmsvc_invalidate_all(void); | 296 | void nlmsvc_invalidate_all(void); |
| @@ -5,7 +5,7 @@ · 4 unmodified lines | |||
| 5 | * Copyright (C) 2006,2007 Red Hat, Inc., Ingo Molnar <mingo@redhat.com> | 5 | * Copyright (C) 2006,2007 Red Hat, Inc., Ingo Molnar <mingo@redhat.com> |
| 6 | * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra | 6 | * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra |
| 7 | * | 7 | * |
| 8 | * see Documentation/locking/lockdep-design.txt for more details. | 8 | * see Documentation/locking/lockdep-design.rst for more details. |
| 9 | */ | 9 | */ |
| 10 | #ifndef __LINUX_LOCKDEP_H | 10 | #ifndef __LINUX_LOCKDEP_H |
| 11 | #define __LINUX_LOCKDEP_H | 11 | #define __LINUX_LOCKDEP_H |
| @@ -203,11 +203,17 @@ struct lock_list { · 191 unmodified lines | |||
| 203 | struct lock_list *parent; | 203 | struct lock_list *parent; |
| 204 | }; | 204 | }; |
| 205 | 205 | ||
| 206 | /* | 206 | /** |
| 207 | * We record lock dependency chains, so that we can cache them: | 207 | * struct lock_chain - lock dependency chain record |
| 208 | * | ||
| 209 | * @irq_context: the same as irq_context in held_lock below | ||
| 210 | * @depth: the number of held locks in this chain | ||
| 211 | * @base: the index in chain_hlocks for this chain | ||
| 212 | * @entry: the collided lock chains in lock_chain hash list | ||
| 213 | * @chain_key: the hash key of this lock_chain | ||
| 208 | */ | 214 | */ |
| 209 | struct lock_chain { | 215 | struct lock_chain { |
| 210 | /* see BUILD_BUG_ON()s in lookup_chain_cache() */ | 216 | /* see BUILD_BUG_ON()s in add_chain_cache() */ |
| 211 | unsigned int irq_context : 2, | 217 | unsigned int irq_context : 2, |
| 212 | depth : 6, | 218 | depth : 6, |
| 213 | base : 24; | 219 | base : 24; |
| @@ -217,12 +223,8 @@ struct lock_chain { · 3 unmodified lines | |||
| 217 | }; | 223 | }; |
| 218 | 224 | ||
| 219 | #define MAX_LOCKDEP_KEYS_BITS 13 | 225 | #define MAX_LOCKDEP_KEYS_BITS 13 |
| 220 | /* | 226 | #define MAX_LOCKDEP_KEYS (1UL << MAX_LOCKDEP_KEYS_BITS) |
| 221 | * Subtract one because we offset hlock->class_idx by 1 in order | 227 | #define INITIAL_CHAIN_KEY -1 |
| 222 | * to make 0 mean no class. This avoids overflowing the class_idx | ||
| 223 | * bitfield and hitting the BUG in hlock_class(). | ||
| 224 | */ | ||
| 225 | #define MAX_LOCKDEP_KEYS ((1UL << MAX_LOCKDEP_KEYS_BITS) - 1) | ||
| 226 | 228 | ||
| 227 | struct held_lock { | 229 | struct held_lock { |
| 228 | /* | 230 | /* |
| @@ -247,6 +249,11 @@ struct held_lock { · 18 unmodified lines | |||
| 247 | u64 waittime_stamp; | 249 | u64 waittime_stamp; |
| 248 | u64 holdtime_stamp; | 250 | u64 holdtime_stamp; |
| 249 | #endif | 251 | #endif |
| 252 | /* | ||
| 253 | * class_idx is zero-indexed; it points to the element in | ||
| 254 | * lock_classes this held lock instance belongs to. class_idx is in | ||
| 255 | * the range from 0 to (MAX_LOCKDEP_KEYS-1) inclusive. | ||
| 256 | */ | ||
| 250 | unsigned int class_idx:MAX_LOCKDEP_KEYS_BITS; | 257 | unsigned int class_idx:MAX_LOCKDEP_KEYS_BITS; |
| 251 | /* | 258 | /* |
| 252 | * The lock-stack is unified in that the lock chains of interrupt | 259 | * The lock-stack is unified in that the lock chains of interrupt |
| @@ -281,6 +288,8 @@ extern void lockdep_free_key_range(void *start, unsigned long size); · 28 unmodified lines | |||
| 281 | extern asmlinkage void lockdep_sys_exit(void); | 288 | extern asmlinkage void lockdep_sys_exit(void); |
| 282 | extern void lockdep_set_selftest_task(struct task_struct *task); | 289 | extern void lockdep_set_selftest_task(struct task_struct *task); |
| 283 | 290 | ||
| 291 | extern void lockdep_init_task(struct task_struct *task); | ||
| 292 | |||
| 284 | extern void lockdep_off(void); | 293 | extern void lockdep_off(void); |
| 285 | extern void lockdep_on(void); | 294 | extern void lockdep_on(void); |
| 286 | 295 | ||
| @@ -385,7 +394,7 @@ extern void lock_unpin_lock(struct lockdep_map *lock, struct pin_cookie); · 98 unmodified lines | |||
| 385 | WARN_ON(debug_locks && !lockdep_is_held(l)); \ | 394 | WARN_ON(debug_locks && !lockdep_is_held(l)); \ |
| 386 | } while (0) | 395 | } while (0) |
| 387 | 396 | ||
| 388 | #define lockdep_assert_held_exclusive(l) do { \ | 397 | #define lockdep_assert_held_write(l) do { \ |
| 389 | WARN_ON(debug_locks && !lockdep_is_held_type(l, 0)); \ | 398 | WARN_ON(debug_locks && !lockdep_is_held_type(l, 0)); \ |
| 390 | } while (0) | 399 | } while (0) |
| 391 | 400 | ||
| @@ -405,6 +414,10 @@ extern void lock_unpin_lock(struct lockdep_map *lock, struct pin_cookie); · 13 unmodified lines | |||
| 405 | 414 | ||
| 406 | #else /* !CONFIG_LOCKDEP */ | 415 | #else /* !CONFIG_LOCKDEP */ |
| 407 | 416 | ||
| 417 | static inline void lockdep_init_task(struct task_struct *task) | ||
| 418 | { | ||
| 419 | } | ||
| 420 | |||
| 408 | static inline void lockdep_off(void) | 421 | static inline void lockdep_off(void) |
| 409 | { | 422 | { |
| 410 | } | 423 | } |
| @@ -466,7 +479,7 @@ struct lockdep_map { }; · 55 unmodified lines | |||
| 466 | #define lockdep_is_held_type(l, r) (1) | 479 | #define lockdep_is_held_type(l, r) (1) |
| 467 | 480 | ||
| 468 | #define lockdep_assert_held(l) do { (void)(l); } while (0) | 481 | #define lockdep_assert_held(l) do { (void)(l); } while (0) |
| 469 | #define lockdep_assert_held_exclusive(l) do { (void)(l); } while (0) | 482 | #define lockdep_assert_held_write(l) do { (void)(l); } while (0) |
| 470 | #define lockdep_assert_held_read(l) do { (void)(l); } while (0) | 483 | #define lockdep_assert_held_read(l) do { (void)(l); } while (0) |
| 471 | #define lockdep_assert_held_once(l) do { (void)(l); } while (0) | 484 | #define lockdep_assert_held_once(l) do { (void)(l); } while (0) |
| 472 | 485 | ||
| @@ -497,7 +510,6 @@ enum xhlock_context_t { · 24 unmodified lines | |||
| 497 | { .name = (_name), .key = (void *)(_key), } | 510 | { .name = (_name), .key = (void *)(_key), } |
| 498 | 511 | ||
| 499 | static inline void lockdep_invariant_state(bool force) {} | 512 | static inline void lockdep_invariant_state(bool force) {} |
| 500 | static inline void lockdep_init_task(struct task_struct *task) {} | ||
| 501 | static inline void lockdep_free_task(struct task_struct *task) {} | 513 | static inline void lockdep_free_task(struct task_struct *task) {} |
| 502 | 514 | ||
| 503 | #ifdef CONFIG_LOCK_STAT | 515 | #ifdef CONFIG_LOCK_STAT |
| @@ -632,11 +644,18 @@ do { \ · 128 unmodified lines | |||
| 632 | "IRQs not disabled as expected\n"); \ | 644 | "IRQs not disabled as expected\n"); \ |
| 633 | } while (0) | 645 | } while (0) |
| 634 | 646 | ||
| 647 | #define lockdep_assert_in_irq() do { \ | ||
| 648 | WARN_ONCE(debug_locks && !current->lockdep_recursion && \ | ||
| 649 | !current->hardirq_context, \ | ||
| 650 | "Not in hardirq as expected\n"); \ | ||
| 651 | } while (0) | ||
| 652 | |||
| 635 | #else | 653 | #else |
| 636 | # define might_lock(lock) do { } while (0) | 654 | # define might_lock(lock) do { } while (0) |
| 637 | # define might_lock_read(lock) do { } while (0) | 655 | # define might_lock_read(lock) do { } while (0) |
| 638 | # define lockdep_assert_irqs_enabled() do { } while (0) | 656 | # define lockdep_assert_irqs_enabled() do { } while (0) |
| 639 | # define lockdep_assert_irqs_disabled() do { } while (0) | 657 | # define lockdep_assert_irqs_disabled() do { } while (0) |
| 658 | # define lockdep_assert_in_irq() do { } while (0) | ||
| 640 | #endif | 659 | #endif |
| 641 | 660 | ||
| 642 | #ifdef CONFIG_LOCKDEP | 661 | #ifdef CONFIG_LOCKDEP |
| @@ -220,4 +220,38 @@ int __order_base_2(unsigned long n) · 219 unmodified lines | |||
| 220 | ilog2((n) - 1) + 1) : \ | 220 | ilog2((n) - 1) + 1) : \ |
| 221 | __order_base_2(n) \ | 221 | __order_base_2(n) \ |
| 222 | ) | 222 | ) |
| 223 | |||
| 224 | static inline __attribute__((const)) | ||
| 225 | int __bits_per(unsigned long n) | ||
| 226 | { | ||
| 227 | if (n < 2) | ||
| 228 | return 1; | ||
| 229 | if (is_power_of_2(n)) | ||
| 230 | return order_base_2(n) + 1; | ||
| 231 | return order_base_2(n); | ||
| 232 | } | ||
| 233 | |||
| 234 | /** | ||
| 235 | * bits_per - calculate the number of bits required for the argument | ||
| 236 | * @n: parameter | ||
| 237 | * | ||
| 238 | * This is constant-capable and can be used for compile time | ||
| 239 | * initializations, e.g bitfields. | ||
| 240 | * | ||
| 241 | * The first few values calculated by this routine: | ||
| 242 | * bf(0) = 1 | ||
| 243 | * bf(1) = 1 | ||
| 244 | * bf(2) = 2 | ||
| 245 | * bf(3) = 2 | ||
| 246 | * bf(4) = 3 | ||
| 247 | * ... and so on. | ||
| 248 | */ | ||
| 249 | #define bits_per(n) \ | ||
| 250 | ( \ | ||
| 251 | __builtin_constant_p(n) ? ( \ | ||
| 252 | ((n) == 0 || (n) == 1) \ | ||
| 253 | ? 1 : ilog2(n) + 1 \ | ||
| 254 | ) : \ | ||
| 255 | __bits_per(n) \ | ||
| 256 | ) | ||
| 223 | #endif /* _LINUX_LOG2_H */ | 257 | #endif /* _LINUX_LOG2_H */ |
| @@ -77,7 +77,7 @@ · 76 unmodified lines | |||
| 77 | * state. This is called immediately after commit_creds(). | 77 | * state. This is called immediately after commit_creds(). |
| 78 | * | 78 | * |
| 79 | * Security hooks for mount using fs_context. | 79 | * Security hooks for mount using fs_context. |
| 80 | * [See also Documentation/filesystems/mounting.txt] | 80 | * [See also Documentation/filesystems/mount_api.txt] |
| 81 | * | 81 | * |
| 82 | * @fs_context_dup: | 82 | * @fs_context_dup: |
| 83 | * Allocate and attach a security structure to sc->security. This pointer | 83 | * Allocate and attach a security structure to sc->security. This pointer |
| @@ -278,7 +278,7 @@ int LZ4_decompress_fast(const char *source, char *dest, int originalSize); · 277 unmodified lines | |||
| 278 | * @compressedSize: is the precise full size of the compressed block | 278 | * @compressedSize: is the precise full size of the compressed block |
| 279 | * @maxDecompressedSize: is the size of 'dest' buffer | 279 | * @maxDecompressedSize: is the size of 'dest' buffer |
| 280 | * | 280 | * |
| 281 | * Decompresses data fom 'source' into 'dest'. | 281 | * Decompresses data from 'source' into 'dest'. |
| 282 | * If the source stream is detected malformed, the function will | 282 | * If the source stream is detected malformed, the function will |
| 283 | * stop decoding and return a negative result. | 283 | * stop decoding and return a negative result. |
| 284 | * This function is protected against buffer overflow exploits, | 284 | * This function is protected against buffer overflow exploits, |
| @@ -522,7 +522,7 @@ int LZ4_setStreamDecode(LZ4_streamDecode_t *LZ4_streamDecode, · 237 unmodified lines | |||
| 522 | const char *dictionary, int dictSize); | 522 | const char *dictionary, int dictSize); |
| 523 | 523 | ||
| 524 | /** | 524 | /** |
| 525 | * LZ4_decompress_fast_continue() - Decompress blocks in streaming mode | 525 | * LZ4_decompress_safe_continue() - Decompress blocks in streaming mode |
| 526 | * @LZ4_streamDecode: the 'LZ4_streamDecode_t' structure | 526 | * @LZ4_streamDecode: the 'LZ4_streamDecode_t' structure |
| 527 | * @source: source address of the compressed data | 527 | * @source: source address of the compressed data |
| 528 | * @dest: output buffer address of the uncompressed data | 528 | * @dest: output buffer address of the uncompressed data |
| @@ -530,7 +530,7 @@ int LZ4_setStreamDecode(LZ4_streamDecode_t *LZ4_streamDecode, · 1 unmodified line | |||
| 530 | * @compressedSize: is the precise full size of the compressed block | 530 | * @compressedSize: is the precise full size of the compressed block |
| 531 | * @maxDecompressedSize: is the size of 'dest' buffer | 531 | * @maxDecompressedSize: is the size of 'dest' buffer |
| 532 | * | 532 | * |
| 533 | * These decoding function allows decompression of multiple blocks | 533 | * This decoding function allows decompression of multiple blocks |
| 534 | * in "streaming" mode. | 534 | * in "streaming" mode. |
| 535 | * Previously decoded blocks *must* remain available at the memory position | 535 | * Previously decoded blocks *must* remain available at the memory position |
| 536 | * where they were decoded (up to 64 KB) | 536 | * where they were decoded (up to 64 KB) |
| @@ -569,7 +569,7 @@ int LZ4_decompress_safe_continue(LZ4_streamDecode_t *LZ4_streamDecode, · 32 unmodified lines | |||
| 569 | * which must be already allocated with 'originalSize' bytes | 569 | * which must be already allocated with 'originalSize' bytes |
| 570 | * @originalSize: is the original and therefore uncompressed size | 570 | * @originalSize: is the original and therefore uncompressed size |
| 571 | * | 571 | * |
| 572 | * These decoding function allows decompression of multiple blocks | 572 | * This decoding function allows decompression of multiple blocks |
| 573 | * in "streaming" mode. | 573 | * in "streaming" mode. |
| 574 | * Previously decoded blocks *must* remain available at the memory position | 574 | * Previously decoded blocks *must* remain available at the memory position |
| 575 | * where they were decoded (up to 64 KB) | 575 | * where they were decoded (up to 64 KB) |
| @@ -610,10 +610,10 @@ int LZ4_decompress_fast_continue(LZ4_streamDecode_t *LZ4_streamDecode, · 34 unmodified lines | |||
| 610 | * @dictStart: pointer to the start of the dictionary in memory | 610 | * @dictStart: pointer to the start of the dictionary in memory |
| 611 | * @dictSize: size of dictionary | 611 | * @dictSize: size of dictionary |
| 612 | * | 612 | * |
| 613 | * These decoding function works the same as | 613 | * This decoding function works the same as |
| 614 | * a combination of LZ4_setStreamDecode() followed by | 614 | * a combination of LZ4_setStreamDecode() followed by |
| 615 | * LZ4_decompress_safe_continue() | 615 | * LZ4_decompress_safe_continue() |
| 616 | * It is stand-alone, and don'tn eed a LZ4_streamDecode_t structure. | 616 | * It is stand-alone, and doesn't need an LZ4_streamDecode_t structure. |
| 617 | * | 617 | * |
| 618 | * Return: number of bytes decompressed into destination buffer | 618 | * Return: number of bytes decompressed into destination buffer |
| 619 | * (necessarily <= maxDecompressedSize) | 619 | * (necessarily <= maxDecompressedSize) |
| @@ -633,10 +633,10 @@ int LZ4_decompress_safe_usingDict(const char *source, char *dest, · 13 unmodified lines | |||
| 633 | * @dictStart: pointer to the start of the dictionary in memory | 633 | * @dictStart: pointer to the start of the dictionary in memory |
| 634 | * @dictSize: size of dictionary | 634 | * @dictSize: size of dictionary |
| 635 | * | 635 | * |
| 636 | * These decoding function works the same as | 636 | * This decoding function works the same as |
| 637 | * a combination of LZ4_setStreamDecode() followed by | 637 | * a combination of LZ4_setStreamDecode() followed by |
| 638 | * LZ4_decompress_safe_continue() | 638 | * LZ4_decompress_fast_continue() |
| 639 | * It is stand-alone, and don'tn eed a LZ4_streamDecode_t structure. | 639 | * It is stand-alone, and doesn't need an LZ4_streamDecode_t structure. |
| 640 | * | 640 | * |
| 641 | * Return: number of bytes decompressed into destination buffer | 641 | * Return: number of bytes decompressed into destination buffer |
| 642 | * (necessarily <= maxDecompressedSize) | 642 | * (necessarily <= maxDecompressedSize) |
| @@ -233,8 +233,9 @@ struct mem_cgroup { · 232 unmodified lines | |||
| 233 | /* OOM-Killer disable */ | 233 | /* OOM-Killer disable */ |
| 234 | int oom_kill_disable; | 234 | int oom_kill_disable; |
| 235 | 235 | ||
| 236 | /* memory.events */ | 236 | /* memory.events and memory.events.local */ |
| 237 | struct cgroup_file events_file; | 237 | struct cgroup_file events_file; |
| 238 | struct cgroup_file events_local_file; | ||
| 238 | 239 | ||
| 239 | /* handle for "memory.swap.events" */ | 240 | /* handle for "memory.swap.events" */ |
| 240 | struct cgroup_file swap_events_file; | 241 | struct cgroup_file swap_events_file; |
| @@ -281,6 +282,7 @@ struct mem_cgroup { · 40 unmodified lines | |||
| 281 | 282 | ||
| 282 | /* memory.events */ | 283 | /* memory.events */ |
| 283 | atomic_long_t memory_events[MEMCG_NR_MEMORY_EVENTS]; | 284 | atomic_long_t memory_events[MEMCG_NR_MEMORY_EVENTS]; |
| 285 | atomic_long_t memory_events_local[MEMCG_NR_MEMORY_EVENTS]; | ||
| 284 | 286 | ||
| 285 | unsigned long socket_pressure; | 287 | unsigned long socket_pressure; |
| 286 | 288 | ||
| @@ -392,7 +394,6 @@ out: · 105 unmodified lines | |||
| 392 | 394 | ||
| 393 | struct lruvec *mem_cgroup_page_lruvec(struct page *, struct pglist_data *); | 395 | struct lruvec *mem_cgroup_page_lruvec(struct page *, struct pglist_data *); |
| 394 | 396 | ||
| 395 | bool task_in_mem_cgroup(struct task_struct *task, struct mem_cgroup *memcg); | ||
| 396 | struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p); | 397 | struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p); |
| 397 | 398 | ||
| 398 | struct mem_cgroup *get_mem_cgroup_from_mm(struct mm_struct *mm); | 399 | struct mem_cgroup *get_mem_cgroup_from_mm(struct mm_struct *mm); |
| @@ -747,6 +748,9 @@ static inline void count_memcg_event_mm(struct mm_struct *mm, · 348 unmodified lines | |||
| 747 | static inline void memcg_memory_event(struct mem_cgroup *memcg, | 748 | static inline void memcg_memory_event(struct mem_cgroup *memcg, |
| 748 | enum memcg_memory_event event) | 749 | enum memcg_memory_event event) |
| 749 | { | 750 | { |
| 751 | atomic_long_inc(&memcg->memory_events_local[event]); | ||
| 752 | cgroup_file_notify(&memcg->events_local_file); | ||
| 753 | |||
| 750 | do { | 754 | do { |
| 751 | atomic_long_inc(&memcg->memory_events[event]); | 755 | atomic_long_inc(&memcg->memory_events[event]); |
| 752 | cgroup_file_notify(&memcg->events_file); | 756 | cgroup_file_notify(&memcg->events_file); |
| @@ -870,12 +874,6 @@ static inline bool mm_match_cgroup(struct mm_struct *mm, · 117 unmodified lines | |||
| 870 | return true; | 874 | return true; |
| 871 | } | 875 | } |
| 872 | 876 | ||
| 873 | static inline bool task_in_mem_cgroup(struct task_struct *task, | ||
| 874 | const struct mem_cgroup *memcg) | ||
| 875 | { | ||
| 876 | return true; | ||
| 877 | } | ||
| 878 | |||
| 879 | static inline struct mem_cgroup *get_mem_cgroup_from_mm(struct mm_struct *mm) | 877 | static inline struct mem_cgroup *get_mem_cgroup_from_mm(struct mm_struct *mm) |
| 880 | { | 878 | { |
| 881 | return NULL; | 879 | return NULL; |
| @@ -1273,6 +1271,8 @@ int __memcg_kmem_charge(struct page *page, gfp_t gfp, int order); · 391 unmodified lines | |||
| 1273 | void __memcg_kmem_uncharge(struct page *page, int order); | 1271 | void __memcg_kmem_uncharge(struct page *page, int order); |
| 1274 | int __memcg_kmem_charge_memcg(struct page *page, gfp_t gfp, int order, | 1272 | int __memcg_kmem_charge_memcg(struct page *page, gfp_t gfp, int order, |
| 1275 | struct mem_cgroup *memcg); | 1273 | struct mem_cgroup *memcg); |
| 1274 | void __memcg_kmem_uncharge_memcg(struct mem_cgroup *memcg, | ||
| 1275 | unsigned int nr_pages); | ||
| 1276 | 1276 | ||
| 1277 | extern struct static_key_false memcg_kmem_enabled_key; | 1277 | extern struct static_key_false memcg_kmem_enabled_key; |
| 1278 | extern struct workqueue_struct *memcg_kmem_cache_wq; | 1278 | extern struct workqueue_struct *memcg_kmem_cache_wq; |
| @@ -1314,6 +1314,14 @@ static inline int memcg_kmem_charge_memcg(struct page *page, gfp_t gfp, · 35 unmodified lines | |||
| 1314 | return __memcg_kmem_charge_memcg(page, gfp, order, memcg); | 1314 | return __memcg_kmem_charge_memcg(page, gfp, order, memcg); |
| 1315 | return 0; | 1315 | return 0; |
| 1316 | } | 1316 | } |
| 1317 | |||
| 1318 | static inline void memcg_kmem_uncharge_memcg(struct page *page, int order, | ||
| 1319 | struct mem_cgroup *memcg) | ||
| 1320 | { | ||
| 1321 | if (memcg_kmem_enabled()) | ||
| 1322 | __memcg_kmem_uncharge_memcg(memcg, 1 << order); | ||
| 1323 | } | ||
| 1324 | |||
| 1317 | /* | 1325 | /* |
| 1318 | * helper for accessing a memcg's index. It will be used as an index in the | 1326 | * helper for accessing a memcg's index. It will be used as an index in the |
| 1319 | * child cache array in kmem_cache, and also to derive its name. This function | 1327 | * child cache array in kmem_cache, and also to derive its name. This function |
| @@ -111,16 +111,15 @@ extern int register_memory_notifier(struct notifier_block *nb); · 110 unmodified lines | |||
| 111 | extern void unregister_memory_notifier(struct notifier_block *nb); | 111 | extern void unregister_memory_notifier(struct notifier_block *nb); |
| 112 | extern int register_memory_isolate_notifier(struct notifier_block *nb); | 112 | extern int register_memory_isolate_notifier(struct notifier_block *nb); |
| 113 | extern void unregister_memory_isolate_notifier(struct notifier_block *nb); | 113 | extern void unregister_memory_isolate_notifier(struct notifier_block *nb); |
| 114 | int hotplug_memory_register(int nid, struct mem_section *section); | 114 | int create_memory_block_devices(unsigned long start, unsigned long size); |
| 115 | #ifdef CONFIG_MEMORY_HOTREMOVE | 115 | void remove_memory_block_devices(unsigned long start, unsigned long size); |
| 116 | extern void unregister_memory_section(struct mem_section *); | ||
| 117 | #endif | ||
| 118 | extern int memory_dev_init(void); | 116 | extern int memory_dev_init(void); |
| 119 | extern int memory_notify(unsigned long val, void *v); | 117 | extern int memory_notify(unsigned long val, void *v); |
| 120 | extern int memory_isolate_notify(unsigned long val, void *v); | 118 | extern int memory_isolate_notify(unsigned long val, void *v); |
| 121 | extern struct memory_block *find_memory_block_hinted(struct mem_section *, | ||
| 122 | struct memory_block *); | ||
| 123 | extern struct memory_block *find_memory_block(struct mem_section *); | 119 | extern struct memory_block *find_memory_block(struct mem_section *); |
| 120 | typedef int (*walk_memory_blocks_func_t)(struct memory_block *, void *); | ||
| 121 | extern int walk_memory_blocks(unsigned long start, unsigned long size, | ||
| 122 | void *arg, walk_memory_blocks_func_t func); | ||
| 124 | #define CONFIG_MEM_BLOCK_SIZE (PAGES_PER_SECTION<<PAGE_SHIFT) | 123 | #define CONFIG_MEM_BLOCK_SIZE (PAGES_PER_SECTION<<PAGE_SHIFT) |
| 125 | #endif /* CONFIG_MEMORY_HOTPLUG_SPARSE */ | 124 | #endif /* CONFIG_MEMORY_HOTPLUG_SPARSE */ |
| 126 | 125 | ||
| @@ -123,20 +123,10 @@ static inline bool movable_node_is_enabled(void) · 122 unmodified lines | |||
| 123 | return movable_node_enabled; | 123 | return movable_node_enabled; |
| 124 | } | 124 | } |
| 125 | 125 | ||
| 126 | #ifdef CONFIG_MEMORY_HOTREMOVE | ||
| 127 | extern void arch_remove_memory(int nid, u64 start, u64 size, | 126 | extern void arch_remove_memory(int nid, u64 start, u64 size, |
| 128 | struct vmem_altmap *altmap); | 127 | struct vmem_altmap *altmap); |
| 129 | extern void __remove_pages(struct zone *zone, unsigned long start_pfn, | 128 | extern void __remove_pages(struct zone *zone, unsigned long start_pfn, |
| 130 | unsigned long nr_pages, struct vmem_altmap *altmap); | 129 | unsigned long nr_pages, struct vmem_altmap *altmap); |
| 131 | #endif /* CONFIG_MEMORY_HOTREMOVE */ | ||
| 132 | |||
| 133 | /* | ||
| 134 | * Do we want sysfs memblock files created. This will allow userspace to online | ||
| 135 | * and offline memory explicitly. Lack of this bit means that the caller has to | ||
| 136 | * call move_pfn_range_to_zone to finish the initialization. | ||
| 137 | */ | ||
| 138 | |||
| 139 | #define MHP_MEMBLOCK_API (1<<0) | ||
| 140 | 130 | ||
| 141 | /* reasonably generic interface to expand the physical pages */ | 131 | /* reasonably generic interface to expand the physical pages */ |
| 142 | extern int __add_pages(int nid, unsigned long start_pfn, unsigned long nr_pages, | 132 | extern int __add_pages(int nid, unsigned long start_pfn, unsigned long nr_pages, |
| @@ -324,7 +314,7 @@ static inline void pgdat_resize_init(struct pglist_data *pgdat) {} · 181 unmodified lines | |||
| 324 | extern bool is_mem_section_removable(unsigned long pfn, unsigned long nr_pages); | 314 | extern bool is_mem_section_removable(unsigned long pfn, unsigned long nr_pages); |
| 325 | extern void try_offline_node(int nid); | 315 | extern void try_offline_node(int nid); |
| 326 | extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages); | 316 | extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages); |
| 327 | extern void remove_memory(int nid, u64 start, u64 size); | 317 | extern int remove_memory(int nid, u64 start, u64 size); |
| 328 | extern void __remove_memory(int nid, u64 start, u64 size); | 318 | extern void __remove_memory(int nid, u64 start, u64 size); |
| 329 | 319 | ||
| 330 | #else | 320 | #else |
| @@ -341,22 +331,25 @@ static inline int offline_pages(unsigned long start_pfn, unsigned long nr_pages) · 10 unmodified lines | |||
| 341 | return -EINVAL; | 331 | return -EINVAL; |
| 342 | } | 332 | } |
| 343 | 333 | ||
| 344 | static inline void remove_memory(int nid, u64 start, u64 size) {} | 334 | static inline int remove_memory(int nid, u64 start, u64 size) |
| 335 | { | ||
| 336 | return -EBUSY; | ||
| 337 | } | ||
| 338 | |||
| 345 | static inline void __remove_memory(int nid, u64 start, u64 size) {} | 339 | static inline void __remove_memory(int nid, u64 start, u64 size) {} |
| 346 | #endif /* CONFIG_MEMORY_HOTREMOVE */ | 340 | #endif /* CONFIG_MEMORY_HOTREMOVE */ |
| 347 | 341 | ||
| 348 | extern void __ref free_area_init_core_hotplug(int nid); | 342 | extern void __ref free_area_init_core_hotplug(int nid); |
| 349 | extern int walk_memory_range(unsigned long start_pfn, unsigned long end_pfn, | ||
| 350 | void *arg, int (*func)(struct memory_block *, void *)); | ||
| 351 | extern int __add_memory(int nid, u64 start, u64 size); | 343 | extern int __add_memory(int nid, u64 start, u64 size); |
| 352 | extern int add_memory(int nid, u64 start, u64 size); | 344 | extern int add_memory(int nid, u64 start, u64 size); |
| 353 | extern int add_memory_resource(int nid, struct resource *resource); | 345 | extern int add_memory_resource(int nid, struct resource *resource); |
| 354 | extern void move_pfn_range_to_zone(struct zone *zone, unsigned long start_pfn, | 346 | extern void move_pfn_range_to_zone(struct zone *zone, unsigned long start_pfn, |
| 355 | unsigned long nr_pages, struct vmem_altmap *altmap); | 347 | unsigned long nr_pages, struct vmem_altmap *altmap); |
| 356 | extern bool is_memblock_offlined(struct memory_block *mem); | 348 | extern bool is_memblock_offlined(struct memory_block *mem); |
| 357 | extern int sparse_add_one_section(int nid, unsigned long start_pfn, | 349 | extern int sparse_add_section(int nid, unsigned long pfn, |
| 358 | struct vmem_altmap *altmap); | 350 | unsigned long nr_pages, struct vmem_altmap *altmap); |
| 359 | extern void sparse_remove_one_section(struct zone *zone, struct mem_section *ms, | 351 | extern void sparse_remove_section(struct mem_section *ms, |
| 352 | unsigned long pfn, unsigned long nr_pages, | ||
| 360 | unsigned long map_offset, struct vmem_altmap *altmap); | 353 | unsigned long map_offset, struct vmem_altmap *altmap); |
| 361 | extern struct page *sparse_decode_mem_map(unsigned long coded_mem_map, | 354 | extern struct page *sparse_decode_mem_map(unsigned long coded_mem_map, |
| 362 | unsigned long pnum); | 355 | unsigned long pnum); |
| @@ -37,13 +37,6 @@ struct vmem_altmap { · 36 unmodified lines | |||
| 37 | * A more complete discussion of unaddressable memory may be found in | 37 | * A more complete discussion of unaddressable memory may be found in |
| 38 | * include/linux/hmm.h and Documentation/vm/hmm.rst. | 38 | * include/linux/hmm.h and Documentation/vm/hmm.rst. |
| 39 | * | 39 | * |
| 40 | * MEMORY_DEVICE_PUBLIC: | ||
| 41 | * Device memory that is cache coherent from device and CPU point of view. This | ||
| 42 | * is use on platform that have an advance system bus (like CAPI or CCIX). A | ||
| 43 | * driver can hotplug the device memory using ZONE_DEVICE and with that memory | ||
| 44 | * type. Any page of a process can be migrated to such memory. However no one | ||
| 45 | * should be allow to pin such memory so that it can always be evicted. | ||
| 46 | * | ||
| 47 | * MEMORY_DEVICE_FS_DAX: | 40 | * MEMORY_DEVICE_FS_DAX: |
| 48 | * Host memory that has similar access semantics as System RAM i.e. DMA | 41 | * Host memory that has similar access semantics as System RAM i.e. DMA |
| 49 | * coherent and supports page pinning. In support of coordinating page | 42 | * coherent and supports page pinning. In support of coordinating page |
| @@ -52,54 +45,84 @@ struct vmem_altmap { · 2 unmodified lines | |||
| 52 | * wakeup is used to coordinate physical address space management (ex: | 45 | * wakeup is used to coordinate physical address space management (ex: |
| 53 | * fs truncate/hole punch) vs pinned pages (ex: device dma). | 46 | * fs truncate/hole punch) vs pinned pages (ex: device dma). |
| 54 | * | 47 | * |
| 48 | * MEMORY_DEVICE_DEVDAX: | ||
| 49 | * Host memory that has similar access semantics as System RAM i.e. DMA | ||
| 50 | * coherent and supports page pinning. In contrast to | ||
| 51 | * MEMORY_DEVICE_FS_DAX, this memory is access via a device-dax | ||
| 52 | * character device. | ||
| 53 | * | ||
| 55 | * MEMORY_DEVICE_PCI_P2PDMA: | 54 | * MEMORY_DEVICE_PCI_P2PDMA: |
| 56 | * Device memory residing in a PCI BAR intended for use with Peer-to-Peer | 55 | * Device memory residing in a PCI BAR intended for use with Peer-to-Peer |
| 57 | * transactions. | 56 | * transactions. |
| 58 | */ | 57 | */ |
| 59 | enum memory_type { | 58 | enum memory_type { |
| 59 | /* 0 is reserved to catch uninitialized type fields */ | ||
| 60 | MEMORY_DEVICE_PRIVATE = 1, | 60 | MEMORY_DEVICE_PRIVATE = 1, |
| 61 | MEMORY_DEVICE_PUBLIC, | ||
| 62 | MEMORY_DEVICE_FS_DAX, | 61 | MEMORY_DEVICE_FS_DAX, |
| 62 | MEMORY_DEVICE_DEVDAX, | ||
| 63 | MEMORY_DEVICE_PCI_P2PDMA, | 63 | MEMORY_DEVICE_PCI_P2PDMA, |
| 64 | }; | 64 | }; |
| 65 | 65 | ||
| 66 | /* | 66 | struct dev_pagemap_ops { |
| 67 | * Additional notes about MEMORY_DEVICE_PRIVATE may be found in | 67 | /* |
| 68 | * include/linux/hmm.h and Documentation/vm/hmm.rst. There is also a brief | 68 | * Called once the page refcount reaches 1. (ZONE_DEVICE pages never |
| 69 | * explanation in include/linux/memory_hotplug.h. | 69 | * reach 0 refcount unless there is a refcount bug. This allows the |
| 70 | * | 70 | * device driver to implement its own memory management.) |
| 71 | * The page_free() callback is called once the page refcount reaches 1 | 71 | */ |
| 72 | * (ZONE_DEVICE pages never reach 0 refcount unless there is a refcount bug. | 72 | void (*page_free)(struct page *page); |
| 73 | * This allows the device driver to implement its own memory management.) | 73 | |
| 74 | */ | 74 | /* |
| 75 | typedef void (*dev_page_free_t)(struct page *page, void *data); | 75 | * Transition the refcount in struct dev_pagemap to the dead state. |
| 76 | */ | ||
| 77 | void (*kill)(struct dev_pagemap *pgmap); | ||
| 78 | |||
| 79 | /* | ||
| 80 | * Wait for refcount in struct dev_pagemap to be idle and reap it. | ||
| 81 | */ | ||
| 82 | void (*cleanup)(struct dev_pagemap *pgmap); | ||
| 83 | |||
| 84 | /* | ||
| 85 | * Used for private (un-addressable) device memory only. Must migrate | ||
| 86 | * the page back to a CPU accessible page. | ||
| 87 | */ | ||
| 88 | vm_fault_t (*migrate_to_ram)(struct vm_fault *vmf); | ||
| 89 | }; | ||
| 90 | |||
| 91 | #define PGMAP_ALTMAP_VALID (1 << 0) | ||
| 76 | 92 | ||
| 77 | /** | 93 | /** |
| 78 | * struct dev_pagemap - metadata for ZONE_DEVICE mappings | 94 | * struct dev_pagemap - metadata for ZONE_DEVICE mappings |
| 79 | * @page_free: free page callback when page refcount reaches 1 | ||
| 80 | * @altmap: pre-allocated/reserved memory for vmemmap allocations | 95 | * @altmap: pre-allocated/reserved memory for vmemmap allocations |
| 81 | * @res: physical address range covered by @ref | 96 | * @res: physical address range covered by @ref |
| 82 | * @ref: reference count that pins the devm_memremap_pages() mapping | 97 | * @ref: reference count that pins the devm_memremap_pages() mapping |
| 83 | * @kill: callback to transition @ref to the dead state | 98 | * @internal_ref: internal reference if @ref is not provided by the caller |
| 84 | * @cleanup: callback to wait for @ref to be idle and reap it | 99 | * @done: completion for @internal_ref |
| 85 | * @dev: host device of the mapping for debug | 100 | * @dev: host device of the mapping for debug |
| 86 | * @data: private data pointer for page_free() | 101 | * @data: private data pointer for page_free() |
| 87 | * @type: memory type: see MEMORY_* in memory_hotplug.h | 102 | * @type: memory type: see MEMORY_* in memory_hotplug.h |
| 103 | * @flags: PGMAP_* flags to specify defailed behavior | ||
| 104 | * @ops: method table | ||
| 88 | */ | 105 | */ |
| 89 | struct dev_pagemap { | 106 | struct dev_pagemap { |
| 90 | dev_page_free_t page_free; | ||
| 91 | struct vmem_altmap altmap; | 107 | struct vmem_altmap altmap; |
| 92 | bool altmap_valid; | ||
| 93 | struct resource res; | 108 | struct resource res; |
| 94 | struct percpu_ref *ref; | 109 | struct percpu_ref *ref; |
| 95 | void (*kill)(struct percpu_ref *ref); | 110 | struct percpu_ref internal_ref; |
| 96 | void (*cleanup)(struct percpu_ref *ref); | 111 | struct completion done; |
| 97 | struct device *dev; | 112 | struct device *dev; |
| 98 | void *data; | ||
| 99 | enum memory_type type; | 113 | enum memory_type type; |
| 114 | unsigned int flags; | ||
| 100 | u64 pci_p2pdma_bus_offset; | 115 | u64 pci_p2pdma_bus_offset; |
| 116 | const struct dev_pagemap_ops *ops; | ||
| 101 | }; | 117 | }; |
| 102 | 118 | ||
| 119 | static inline struct vmem_altmap *pgmap_altmap(struct dev_pagemap *pgmap) | ||
| 120 | { | ||
| 121 | if (pgmap->flags & PGMAP_ALTMAP_VALID) | ||
| 122 | return &pgmap->altmap; | ||
| 123 | return NULL; | ||
| 124 | } | ||
| 125 | |||
| 103 | #ifdef CONFIG_ZONE_DEVICE | 126 | #ifdef CONFIG_ZONE_DEVICE |
| 104 | void *devm_memremap_pages(struct device *dev, struct dev_pagemap *pgmap); | 127 | void *devm_memremap_pages(struct device *dev, struct dev_pagemap *pgmap); |
| 105 | void devm_memunmap_pages(struct device *dev, struct dev_pagemap *pgmap); | 128 | void devm_memunmap_pages(struct device *dev, struct dev_pagemap *pgmap); |
| @@ -19,6 +19,7 @@ · 18 unmodified lines | |||
| 19 | #define CROS_EC_DEV_PD_NAME "cros_pd" | 19 | #define CROS_EC_DEV_PD_NAME "cros_pd" |
| 20 | #define CROS_EC_DEV_TP_NAME "cros_tp" | 20 | #define CROS_EC_DEV_TP_NAME "cros_tp" |
| 21 | #define CROS_EC_DEV_ISH_NAME "cros_ish" | 21 | #define CROS_EC_DEV_ISH_NAME "cros_ish" |
| 22 | #define CROS_EC_DEV_SCP_NAME "cros_scp" | ||
| 22 | 23 | ||
| 23 | /* | 24 | /* |
| 24 | * The EC is unresponsive for a time after a reboot command. Add a | 25 | * The EC is unresponsive for a time after a reboot command. Add a |
| @@ -155,6 +156,7 @@ struct cros_ec_device { · 130 unmodified lines | |||
| 155 | struct ec_response_get_next_event_v1 event_data; | 156 | struct ec_response_get_next_event_v1 event_data; |
| 156 | int event_size; | 157 | int event_size; |
| 157 | u32 host_event_wake_mask; | 158 | u32 host_event_wake_mask; |
| 159 | u32 last_resume_result; | ||
| 158 | }; | 160 | }; |
| 159 | 161 | ||
| 160 | /** | 162 | /** |
| @@ -4,17 +4,20 @@ · 3 unmodified lines | |||
| 4 | * | 4 | * |
| 5 | * Copyright (C) 2012 Google, Inc | 5 | * Copyright (C) 2012 Google, Inc |
| 6 | * | 6 | * |
| 7 | * The ChromeOS EC multi function device is used to mux all the requests | 7 | * NOTE: This file is auto-generated from ChromeOS EC Open Source code from |
| 8 | * to the EC device for its multiple features: keyboard controller, | 8 | * https://chromium.googlesource.com/chromiumos/platform/ec/+/master/include/ec_commands.h |
| 9 | * battery charging and regulator control, firmware update. | ||
| 10 | * | ||
| 11 | * NOTE: This file is copied verbatim from the ChromeOS EC Open Source | ||
| 12 | * project in an attempt to make future updates easy to make. | ||
| 13 | */ | 9 | */ |
| 14 | 10 | ||
| 11 | /* Host communication command constants for Chrome EC */ | ||
| 12 | |||
| 15 | #ifndef __CROS_EC_COMMANDS_H | 13 | #ifndef __CROS_EC_COMMANDS_H |
| 16 | #define __CROS_EC_COMMANDS_H | 14 | #define __CROS_EC_COMMANDS_H |
| 17 | 15 | ||
| 16 | |||
| 17 | |||
| 18 | |||
| 19 | #define BUILD_ASSERT(_cond) | ||
| 20 | |||
| 18 | /* | 21 | /* |
| 19 | * Current version of this protocol | 22 | * Current version of this protocol |
| 20 | * | 23 | * |
| @@ -25,7 +28,7 @@ · 4 unmodified lines | |||
| 25 | #define EC_PROTO_VERSION 0x00000002 | 28 | #define EC_PROTO_VERSION 0x00000002 |
| 26 | 29 | ||
| 27 | /* Command version mask */ | 30 | /* Command version mask */ |
| 28 | #define EC_VER_MASK(version) (1UL << (version)) | 31 | #define EC_VER_MASK(version) BIT(version) |
| 29 | 32 | ||
| 30 | /* I/O addresses for ACPI commands */ | 33 | /* I/O addresses for ACPI commands */ |
| 31 | #define EC_LPC_ADDR_ACPI_DATA 0x62 | 34 | #define EC_LPC_ADDR_ACPI_DATA 0x62 |
| @@ -39,25 +42,28 @@ · 7 unmodified lines | |||
| 39 | /* Protocol version 2 */ | 42 | /* Protocol version 2 */ |
| 40 | #define EC_LPC_ADDR_HOST_ARGS 0x800 /* And 0x801, 0x802, 0x803 */ | 43 | #define EC_LPC_ADDR_HOST_ARGS 0x800 /* And 0x801, 0x802, 0x803 */ |
| 41 | #define EC_LPC_ADDR_HOST_PARAM 0x804 /* For version 2 params; size is | 44 | #define EC_LPC_ADDR_HOST_PARAM 0x804 /* For version 2 params; size is |
| 42 | * EC_PROTO2_MAX_PARAM_SIZE */ | 45 | * EC_PROTO2_MAX_PARAM_SIZE |
| 46 | */ | ||
| 43 | /* Protocol version 3 */ | 47 | /* Protocol version 3 */ |
| 44 | #define EC_LPC_ADDR_HOST_PACKET 0x800 /* Offset of version 3 packet */ | 48 | #define EC_LPC_ADDR_HOST_PACKET 0x800 /* Offset of version 3 packet */ |
| 45 | #define EC_LPC_HOST_PACKET_SIZE 0x100 /* Max size of version 3 packet */ | 49 | #define EC_LPC_HOST_PACKET_SIZE 0x100 /* Max size of version 3 packet */ |
| 46 | 50 | ||
| 47 | /* The actual block is 0x800-0x8ff, but some BIOSes think it's 0x880-0x8ff | 51 | /* |
| 48 | * and they tell the kernel that so we have to think of it as two parts. */ | 52 | * The actual block is 0x800-0x8ff, but some BIOSes think it's 0x880-0x8ff |
| 53 | * and they tell the kernel that so we have to think of it as two parts. | ||
| 54 | */ | ||
| 49 | #define EC_HOST_CMD_REGION0 0x800 | 55 | #define EC_HOST_CMD_REGION0 0x800 |
| 50 | #define EC_HOST_CMD_REGION1 0x880 | 56 | #define EC_HOST_CMD_REGION1 0x880 |
| 51 | #define EC_HOST_CMD_REGION_SIZE 0x80 | 57 | #define EC_HOST_CMD_REGION_SIZE 0x80 |
| 52 | 58 | ||
| 53 | /* EC command register bit functions */ | 59 | /* EC command register bit functions */ |
| 54 | #define EC_LPC_CMDR_DATA (1 << 0) /* Data ready for host to read */ | 60 | #define EC_LPC_CMDR_DATA BIT(0) /* Data ready for host to read */ |
| 55 | #define EC_LPC_CMDR_PENDING (1 << 1) /* Write pending to EC */ | 61 | #define EC_LPC_CMDR_PENDING BIT(1) /* Write pending to EC */ |
| 56 | #define EC_LPC_CMDR_BUSY (1 << 2) /* EC is busy processing a command */ | 62 | #define EC_LPC_CMDR_BUSY BIT(2) /* EC is busy processing a command */ |
| 57 | #define EC_LPC_CMDR_CMD (1 << 3) /* Last host write was a command */ | 63 | #define EC_LPC_CMDR_CMD BIT(3) /* Last host write was a command */ |
| 58 | #define EC_LPC_CMDR_ACPI_BRST (1 << 4) /* Burst mode (not used) */ | 64 | #define EC_LPC_CMDR_ACPI_BRST BIT(4) /* Burst mode (not used) */ |
| 59 | #define EC_LPC_CMDR_SCI (1 << 5) /* SCI event is pending */ | 65 | #define EC_LPC_CMDR_SCI BIT(5) /* SCI event is pending */ |
| 60 | #define EC_LPC_CMDR_SMI (1 << 6) /* SMI event is pending */ | 66 | #define EC_LPC_CMDR_SMI BIT(6) /* SMI event is pending */ |
| 61 | 67 | ||
| 62 | #define EC_LPC_ADDR_MEMMAP 0x900 | 68 | #define EC_LPC_ADDR_MEMMAP 0x900 |
| 63 | #define EC_MEMMAP_SIZE 255 /* ACPI IO buffer max is 255 bytes */ | 69 | #define EC_MEMMAP_SIZE 255 /* ACPI IO buffer max is 255 bytes */ |
| @@ -77,13 +83,15 @@ · 13 unmodified lines | |||
| 77 | /* Unused 0x28 - 0x2f */ | 83 | /* Unused 0x28 - 0x2f */ |
| 78 | #define EC_MEMMAP_SWITCHES 0x30 /* 8 bits */ | 84 | #define EC_MEMMAP_SWITCHES 0x30 /* 8 bits */ |
| 79 | /* Unused 0x31 - 0x33 */ | 85 | /* Unused 0x31 - 0x33 */ |
| 80 | #define EC_MEMMAP_HOST_EVENTS 0x34 /* 32 bits */ | 86 | #define EC_MEMMAP_HOST_EVENTS 0x34 /* 64 bits */ |
| 81 | /* Reserve 0x38 - 0x3f for additional host event-related stuff */ | 87 | /* Battery values are all 32 bits, unless otherwise noted. */ |
| 82 | /* Battery values are all 32 bits */ | ||
| 83 | #define EC_MEMMAP_BATT_VOLT 0x40 /* Battery Present Voltage */ | 88 | #define EC_MEMMAP_BATT_VOLT 0x40 /* Battery Present Voltage */ |
| 84 | #define EC_MEMMAP_BATT_RATE 0x44 /* Battery Present Rate */ | 89 | #define EC_MEMMAP_BATT_RATE 0x44 /* Battery Present Rate */ |
| 85 | #define EC_MEMMAP_BATT_CAP 0x48 /* Battery Remaining Capacity */ | 90 | #define EC_MEMMAP_BATT_CAP 0x48 /* Battery Remaining Capacity */ |
| 86 | #define EC_MEMMAP_BATT_FLAG 0x4c /* Battery State, defined below */ | 91 | #define EC_MEMMAP_BATT_FLAG 0x4c /* Battery State, see below (8-bit) */ |
| 92 | #define EC_MEMMAP_BATT_COUNT 0x4d /* Battery Count (8-bit) */ | ||
| 93 | #define EC_MEMMAP_BATT_INDEX 0x4e /* Current Battery Data Index (8-bit) */ | ||
| 94 | /* Unused 0x4f */ | ||
| 87 | #define EC_MEMMAP_BATT_DCAP 0x50 /* Battery Design Capacity */ | 95 | #define EC_MEMMAP_BATT_DCAP 0x50 /* Battery Design Capacity */ |
| 88 | #define EC_MEMMAP_BATT_DVLT 0x54 /* Battery Design Voltage */ | 96 | #define EC_MEMMAP_BATT_DVLT 0x54 /* Battery Design Voltage */ |
| 89 | #define EC_MEMMAP_BATT_LFCC 0x58 /* Battery Last Full Charge Capacity */ | 97 | #define EC_MEMMAP_BATT_LFCC 0x58 /* Battery Last Full Charge Capacity */ |
| @@ -97,15 +105,24 @@ · 7 unmodified lines | |||
| 97 | /* Unused 0x84 - 0x8f */ | 105 | /* Unused 0x84 - 0x8f */ |
| 98 | #define EC_MEMMAP_ACC_STATUS 0x90 /* Accelerometer status (8 bits )*/ | 106 | #define EC_MEMMAP_ACC_STATUS 0x90 /* Accelerometer status (8 bits )*/ |
| 99 | /* Unused 0x91 */ | 107 | /* Unused 0x91 */ |
| 100 | #define EC_MEMMAP_ACC_DATA 0x92 /* Accelerometer data 0x92 - 0x9f */ | 108 | #define EC_MEMMAP_ACC_DATA 0x92 /* Accelerometers data 0x92 - 0x9f */ |
| 109 | /* 0x92: Lid Angle if available, LID_ANGLE_UNRELIABLE otherwise */ | ||
| 110 | /* 0x94 - 0x99: 1st Accelerometer */ | ||
| 111 | /* 0x9a - 0x9f: 2nd Accelerometer */ | ||
| 101 | #define EC_MEMMAP_GYRO_DATA 0xa0 /* Gyroscope data 0xa0 - 0xa5 */ | 112 | #define EC_MEMMAP_GYRO_DATA 0xa0 /* Gyroscope data 0xa0 - 0xa5 */ |
| 102 | /* Unused 0xa6 - 0xfe (remember, 0xff is NOT part of the memmap region) */ | 113 | /* Unused 0xa6 - 0xdf */ |
| 103 | 114 | ||
| 115 | /* | ||
| 116 | * ACPI is unable to access memory mapped data at or above this offset due to | ||
| 117 | * limitations of the ACPI protocol. Do not place data in the range 0xe0 - 0xfe | ||
| 118 | * which might be needed by ACPI. | ||
| 119 | */ | ||
| 120 | #define EC_MEMMAP_NO_ACPI 0xe0 | ||
| 104 | 121 | ||
| 105 | /* Define the format of the accelerometer mapped memory status byte. */ | 122 | /* Define the format of the accelerometer mapped memory status byte. */ |
| 106 | #define EC_MEMMAP_ACC_STATUS_SAMPLE_ID_MASK 0x0f | 123 | #define EC_MEMMAP_ACC_STATUS_SAMPLE_ID_MASK 0x0f |
| 107 | #define EC_MEMMAP_ACC_STATUS_BUSY_BIT (1 << 4) | 124 | #define EC_MEMMAP_ACC_STATUS_BUSY_BIT BIT(4) |
| 108 | #define EC_MEMMAP_ACC_STATUS_PRESENCE_BIT (1 << 7) | 125 | #define EC_MEMMAP_ACC_STATUS_PRESENCE_BIT BIT(7) |
| 109 | 126 | ||
| 110 | /* Number of temp sensors at EC_MEMMAP_TEMP_SENSOR */ | 127 | /* Number of temp sensors at EC_MEMMAP_TEMP_SENSOR */ |
| 111 | #define EC_TEMP_SENSOR_ENTRIES 16 | 128 | #define EC_TEMP_SENSOR_ENTRIES 16 |
| @@ -149,6 +166,8 @@ · 37 unmodified lines | |||
| 149 | #define EC_BATT_FLAG_DISCHARGING 0x04 | 166 | #define EC_BATT_FLAG_DISCHARGING 0x04 |
| 150 | #define EC_BATT_FLAG_CHARGING 0x08 | 167 | #define EC_BATT_FLAG_CHARGING 0x08 |
| 151 | #define EC_BATT_FLAG_LEVEL_CRITICAL 0x10 | 168 | #define EC_BATT_FLAG_LEVEL_CRITICAL 0x10 |
| 169 | /* Set if some of the static/dynamic data is invalid (or outdated). */ | ||
| 170 | #define EC_BATT_FLAG_INVALID_DATA 0x20 | ||
| 152 | 171 | ||
| 153 | /* Switch flags at EC_MEMMAP_SWITCHES */ | 172 | /* Switch flags at EC_MEMMAP_SWITCHES */ |
| 154 | #define EC_SWITCH_LID_OPEN 0x01 | 173 | #define EC_SWITCH_LID_OPEN 0x01 |
| @@ -174,20 +193,242 @@ · 19 unmodified lines | |||
| 174 | #define EC_WIRELESS_SWITCH_WWAN 0x04 /* WWAN power */ | 193 | #define EC_WIRELESS_SWITCH_WWAN 0x04 /* WWAN power */ |
| 175 | #define EC_WIRELESS_SWITCH_WLAN_POWER 0x08 /* WLAN power */ | 194 | #define EC_WIRELESS_SWITCH_WLAN_POWER 0x08 /* WLAN power */ |
| 176 | 195 | ||
| 196 | /*****************************************************************************/ | ||
| 197 | /* | ||
| 198 | * ACPI commands | ||
| 199 | * | ||
| 200 | * These are valid ONLY on the ACPI command/data port. | ||
| 201 | */ | ||
| 202 | |||
| 203 | /* | ||
| 204 | * ACPI Read Embedded Controller | ||
| 205 | * | ||
| 206 | * This reads from ACPI memory space on the EC (EC_ACPI_MEM_*). | ||
| 207 | * | ||
| 208 | * Use the following sequence: | ||
| 209 | * | ||
| 210 | * - Write EC_CMD_ACPI_READ to EC_LPC_ADDR_ACPI_CMD | ||
| 211 | * - Wait for EC_LPC_CMDR_PENDING bit to clear | ||
| 212 | * - Write address to EC_LPC_ADDR_ACPI_DATA | ||
| 213 | * - Wait for EC_LPC_CMDR_DATA bit to set | ||
| 214 | * - Read value from EC_LPC_ADDR_ACPI_DATA | ||
| 215 | */ | ||
| 216 | #define EC_CMD_ACPI_READ 0x0080 | ||
| 217 | |||
| 218 | /* | ||
| 219 | * ACPI Write Embedded Controller | ||
| 220 | * | ||
| 221 | * This reads from ACPI memory space on the EC (EC_ACPI_MEM_*). | ||
| 222 | * | ||
| 223 | * Use the following sequence: | ||
| 224 | * | ||
| 225 | * - Write EC_CMD_ACPI_WRITE to EC_LPC_ADDR_ACPI_CMD | ||
| 226 | * - Wait for EC_LPC_CMDR_PENDING bit to clear | ||
| 227 | * - Write address to EC_LPC_ADDR_ACPI_DATA | ||
| 228 | * - Wait for EC_LPC_CMDR_PENDING bit to clear | ||
| 229 | * - Write value to EC_LPC_ADDR_ACPI_DATA | ||
| 230 | */ | ||
| 231 | #define EC_CMD_ACPI_WRITE 0x0081 | ||
| 232 | |||
| 233 | /* | ||
| 234 | * ACPI Burst Enable Embedded Controller | ||
| 235 | * | ||
| 236 | * This enables burst mode on the EC to allow the host to issue several | ||
| 237 | * commands back-to-back. While in this mode, writes to mapped multi-byte | ||
| 238 | * data are locked out to ensure data consistency. | ||
| 239 | */ | ||
| 240 | #define EC_CMD_ACPI_BURST_ENABLE 0x0082 | ||
| 241 | |||
| 242 | /* | ||
| 243 | * ACPI Burst Disable Embedded Controller | ||
| 244 | * | ||
| 245 | * This disables burst mode on the EC and stops preventing EC writes to mapped | ||
| 246 | * multi-byte data. | ||
| 247 | */ | ||
| 248 | #define EC_CMD_ACPI_BURST_DISABLE 0x0083 | ||
| 249 | |||
| 250 | /* | ||
| 251 | * ACPI Query Embedded Controller | ||
| 252 | * | ||
| 253 | * This clears the lowest-order bit in the currently pending host events, and | ||
| 254 | * sets the result code to the 1-based index of the bit (event 0x00000001 = 1, | ||
| 255 | * event 0x80000000 = 32), or 0 if no event was pending. | ||
| 256 | */ | ||
| 257 | #define EC_CMD_ACPI_QUERY_EVENT 0x0084 | ||
| 258 | |||
| 259 | /* Valid addresses in ACPI memory space, for read/write commands */ | ||
| 260 | |||
| 261 | /* Memory space version; set to EC_ACPI_MEM_VERSION_CURRENT */ | ||
| 262 | #define EC_ACPI_MEM_VERSION 0x00 | ||
| 263 | /* | ||
| 264 | * Test location; writing value here updates test compliment byte to (0xff - | ||
| 265 | * value). | ||
| 266 | */ | ||
| 267 | #define EC_ACPI_MEM_TEST 0x01 | ||
| 268 | /* Test compliment; writes here are ignored. */ | ||
| 269 | #define EC_ACPI_MEM_TEST_COMPLIMENT 0x02 | ||
| 270 | |||
| 271 | /* Keyboard backlight brightness percent (0 - 100) */ | ||
| 272 | #define EC_ACPI_MEM_KEYBOARD_BACKLIGHT 0x03 | ||
| 273 | /* DPTF Target Fan Duty (0-100, 0xff for auto/none) */ | ||
| 274 | #define EC_ACPI_MEM_FAN_DUTY 0x04 | ||
| 275 | |||
| 276 | /* | ||
| 277 | * DPTF temp thresholds. Any of the EC's temp sensors can have up to two | ||
| 278 | * independent thresholds attached to them. The current value of the ID | ||
| 279 | * register determines which sensor is affected by the THRESHOLD and COMMIT | ||
| 280 | * registers. The THRESHOLD register uses the same EC_TEMP_SENSOR_OFFSET scheme | ||
| 281 | * as the memory-mapped sensors. The COMMIT register applies those settings. | ||
| 282 | * | ||
| 283 | * The spec does not mandate any way to read back the threshold settings | ||
| 284 | * themselves, but when a threshold is crossed the AP needs a way to determine | ||
| 285 | * which sensor(s) are responsible. Each reading of the ID register clears and | ||
| 286 | * returns one sensor ID that has crossed one of its threshold (in either | ||
| 287 | * direction) since the last read. A value of 0xFF means "no new thresholds | ||
| 288 | * have tripped". Setting or enabling the thresholds for a sensor will clear | ||
| 289 | * the unread event count for that sensor. | ||
| 290 | */ | ||
| 291 | #define EC_ACPI_MEM_TEMP_ID 0x05 | ||
| 292 | #define EC_ACPI_MEM_TEMP_THRESHOLD 0x06 | ||
| 293 | #define EC_ACPI_MEM_TEMP_COMMIT 0x07 | ||
| 294 | /* | ||
| 295 | * Here are the bits for the COMMIT register: | ||
| 296 | * bit 0 selects the threshold index for the chosen sensor (0/1) | ||
| 297 | * bit 1 enables/disables the selected threshold (0 = off, 1 = on) | ||
| 298 | * Each write to the commit register affects one threshold. | ||
| 299 | */ | ||
| 300 | #define EC_ACPI_MEM_TEMP_COMMIT_SELECT_MASK BIT(0) | ||
| 301 | #define EC_ACPI_MEM_TEMP_COMMIT_ENABLE_MASK BIT(1) | ||
| 302 | /* | ||
| 303 | * Example: | ||
| 304 | * | ||
| 305 | * Set the thresholds for sensor 2 to 50 C and 60 C: | ||
| 306 | * write 2 to [0x05] -- select temp sensor 2 | ||
| 307 | * write 0x7b to [0x06] -- C_TO_K(50) - EC_TEMP_SENSOR_OFFSET | ||
| 308 | * write 0x2 to [0x07] -- enable threshold 0 with this value | ||
| 309 | * write 0x85 to [0x06] -- C_TO_K(60) - EC_TEMP_SENSOR_OFFSET | ||
| 310 | * write 0x3 to [0x07] -- enable threshold 1 with this value | ||
| 311 | * | ||
| 312 | * Disable the 60 C threshold, leaving the 50 C threshold unchanged: | ||
| 313 | * write 2 to [0x05] -- select temp sensor 2 | ||
| 314 | * write 0x1 to [0x07] -- disable threshold 1 | ||
| 315 | */ | ||
| 316 | |||
| 317 | /* DPTF battery charging current limit */ | ||
| 318 | #define EC_ACPI_MEM_CHARGING_LIMIT 0x08 | ||
| 319 | |||
| 320 | /* Charging limit is specified in 64 mA steps */ | ||
| 321 | #define EC_ACPI_MEM_CHARGING_LIMIT_STEP_MA 64 | ||
| 322 | /* Value to disable DPTF battery charging limit */ | ||
| 323 | #define EC_ACPI_MEM_CHARGING_LIMIT_DISABLED 0xff | ||
| 324 | |||
| 325 | /* | ||
| 326 | * Report device orientation | ||
| 327 | * Bits Definition | ||
| 328 | * 3:1 Device DPTF Profile Number (DDPN) | ||
| 329 | * 0 = Reserved for backward compatibility (indicates no valid | ||
| 330 | * profile number. Host should fall back to using TBMD). | ||
| 331 | * 1..7 = DPTF Profile number to indicate to host which table needs | ||
| 332 | * to be loaded. | ||
| 333 | * 0 Tablet Mode Device Indicator (TBMD) | ||
| 334 | */ | ||
| 335 | #define EC_ACPI_MEM_DEVICE_ORIENTATION 0x09 | ||
| 336 | #define EC_ACPI_MEM_TBMD_SHIFT 0 | ||
| 337 | #define EC_ACPI_MEM_TBMD_MASK 0x1 | ||
| 338 | #define EC_ACPI_MEM_DDPN_SHIFT 1 | ||
| 339 | #define EC_ACPI_MEM_DDPN_MASK 0x7 | ||
| 340 | |||
| 341 | /* | ||
| 342 | * Report device features. Uses the same format as the host command, except: | ||
| 343 | * | ||
| 344 | * bit 0 (EC_FEATURE_LIMITED) changes meaning from "EC code has a limited set | ||
| 345 | * of features", which is of limited interest when the system is already | ||
| 346 | * interpreting ACPI bytecode, to "EC_FEATURES[0-7] is not supported". Since | ||
| 347 | * these are supported, it defaults to 0. | ||
| 348 | * This allows detecting the presence of this field since older versions of | ||
| 349 | * the EC codebase would simply return 0xff to that unknown address. Check | ||
| 350 | * FEATURES0 != 0xff (or FEATURES0[0] == 0) to make sure that the other bits | ||
| 351 | * are valid. | ||
| 352 | */ | ||
| 353 | #define EC_ACPI_MEM_DEVICE_FEATURES0 0x0a | ||
| 354 | #define EC_ACPI_MEM_DEVICE_FEATURES1 0x0b | ||
| 355 | #define EC_ACPI_MEM_DEVICE_FEATURES2 0x0c | ||
| 356 | #define EC_ACPI_MEM_DEVICE_FEATURES3 0x0d | ||
| 357 | #define EC_ACPI_MEM_DEVICE_FEATURES4 0x0e | ||
| 358 | #define EC_ACPI_MEM_DEVICE_FEATURES5 0x0f | ||
| 359 | #define EC_ACPI_MEM_DEVICE_FEATURES6 0x10 | ||
| 360 | #define EC_ACPI_MEM_DEVICE_FEATURES7 0x11 | ||
| 361 | |||
| 362 | #define EC_ACPI_MEM_BATTERY_INDEX 0x12 | ||
| 363 | |||
| 364 | /* | ||
| 365 | * USB Port Power. Each bit indicates whether the corresponding USB ports' power | ||
| 366 | * is enabled (1) or disabled (0). | ||
| 367 | * bit 0 USB port ID 0 | ||
| 368 | * ... | ||
| 369 | * bit 7 USB port ID 7 | ||
| 370 | */ | ||
| 371 | #define EC_ACPI_MEM_USB_PORT_POWER 0x13 | ||
| 372 | |||
| 373 | /* | ||
| 374 | * ACPI addresses 0x20 - 0xff map to EC_MEMMAP offset 0x00 - 0xdf. This data | ||
| 375 | * is read-only from the AP. Added in EC_ACPI_MEM_VERSION 2. | ||
| 376 | */ | ||
| 377 | #define EC_ACPI_MEM_MAPPED_BEGIN 0x20 | ||
| 378 | #define EC_ACPI_MEM_MAPPED_SIZE 0xe0 | ||
| 379 | |||
| 380 | /* Current version of ACPI memory address space */ | ||
| 381 | #define EC_ACPI_MEM_VERSION_CURRENT 2 | ||
| 382 | |||
| 383 | |||
| 177 | /* | 384 | /* |
| 178 | * This header file is used in coreboot both in C and ACPI code. The ACPI code | 385 | * This header file is used in coreboot both in C and ACPI code. The ACPI code |
| 179 | * is pre-processed to handle constants but the ASL compiler is unable to | 386 | * is pre-processed to handle constants but the ASL compiler is unable to |
| 180 | * handle actual C code so keep it separate. | 387 | * handle actual C code so keep it separate. |
| 181 | */ | 388 | */ |
| 182 | #ifndef __ACPI__ | 389 | |
| 390 | |||
| 391 | /* | ||
| 392 | * Attributes for EC request and response packets. Just defining __packed | ||
| 393 | * results in inefficient assembly code on ARM, if the structure is actually | ||
| 394 | * 32-bit aligned, as it should be for all buffers. | ||
| 395 | * | ||
| 396 | * Be very careful when adding these to existing structures. They will round | ||
| 397 | * up the structure size to the specified boundary. | ||
| 398 | * | ||
| 399 | * Also be very careful to make that if a structure is included in some other | ||
| 400 | * parent structure that the alignment will still be true given the packing of | ||
| 401 | * the parent structure. This is particularly important if the sub-structure | ||
| 402 | * will be passed as a pointer to another function, since that function will | ||
| 403 | * not know about the misaligment caused by the parent structure's packing. | ||
| 404 | * | ||
| 405 | * Also be very careful using __packed - particularly when nesting non-packed | ||
| 406 | * structures inside packed ones. In fact, DO NOT use __packed directly; | ||
| 407 | * always use one of these attributes. | ||
| 408 | * | ||
| 409 | * Once everything is annotated properly, the following search strings should | ||
| 410 | * not return ANY matches in this file other than right here: | ||
| 411 | * | ||
| 412 | * "__packed" - generates inefficient code; all sub-structs must also be packed | ||
| 413 | * | ||
| 414 | * "struct [^_]" - all structs should be annotated, except for structs that are | ||
| 415 | * members of other structs/unions (and their original declarations should be | ||
| 416 | * annotated). | ||
| 417 | */ | ||
| 183 | 418 | ||
| 184 | /* | 419 | /* |
| 185 | * Define __packed if someone hasn't beat us to it. Linux kernel style | 420 | * Packed structures make no assumption about alignment, so they do inefficient |
| 186 | * checking prefers __packed over __attribute__((packed)). | 421 | * byte-wise reads. |
| 187 | */ | 422 | */ |
| 188 | #ifndef __packed | 423 | #define __ec_align1 __packed |
| 189 | #define __packed __attribute__((packed)) | 424 | #define __ec_align2 __packed |
| 190 | #endif | 425 | #define __ec_align4 __packed |
| 426 | #define __ec_align_size1 __packed | ||
| 427 | #define __ec_align_offset1 __packed | ||
| 428 | #define __ec_align_offset2 __packed | ||
| 429 | #define __ec_todo_packed __packed | ||
| 430 | #define __ec_todo_unpacked | ||
| 431 | |||
| 191 | 432 | ||
| 192 | /* LPC command status byte masks */ | 433 | /* LPC command status byte masks */ |
| 193 | /* EC has written a byte in the data register and host hasn't read it yet */ | 434 | /* EC has written a byte in the data register and host hasn't read it yet */ |
| @@ -198,7 +439,7 @@ · 4 unmodified lines | |||
| 198 | #define EC_LPC_STATUS_PROCESSING 0x04 | 439 | #define EC_LPC_STATUS_PROCESSING 0x04 |
| 199 | /* Last write to EC was a command, not data */ | 440 | /* Last write to EC was a command, not data */ |
| 200 | #define EC_LPC_STATUS_LAST_CMD 0x08 | 441 | #define EC_LPC_STATUS_LAST_CMD 0x08 |
| 201 | /* EC is in burst mode. Unsupported by Chrome EC, so this bit is never set */ | 442 | /* EC is in burst mode */ |
| 202 | #define EC_LPC_STATUS_BURST_MODE 0x10 | 443 | #define EC_LPC_STATUS_BURST_MODE 0x10 |
| 203 | /* SCI event is pending (requesting SCI query) */ | 444 | /* SCI event is pending (requesting SCI query) */ |
| 204 | #define EC_LPC_STATUS_SCI_PENDING 0x20 | 445 | #define EC_LPC_STATUS_SCI_PENDING 0x20 |
| @@ -214,7 +455,10 @@ · 9 unmodified lines | |||
| 214 | #define EC_LPC_STATUS_BUSY_MASK \ | 455 | #define EC_LPC_STATUS_BUSY_MASK \ |
| 215 | (EC_LPC_STATUS_FROM_HOST | EC_LPC_STATUS_PROCESSING) | 456 | (EC_LPC_STATUS_FROM_HOST | EC_LPC_STATUS_PROCESSING) |
| 216 | 457 | ||
| 217 | /* Host command response codes */ | 458 | /* |
| 459 | * Host command response codes (16-bit). Note that response codes should be | ||
| 460 | * stored in a uint16_t rather than directly in a value of this type. | ||
| 461 | */ | ||
| 218 | enum ec_status { | 462 | enum ec_status { |
| 219 | EC_RES_SUCCESS = 0, | 463 | EC_RES_SUCCESS = 0, |
| 220 | EC_RES_INVALID_COMMAND = 1, | 464 | EC_RES_INVALID_COMMAND = 1, |
| @@ -230,7 +474,13 @@ enum ec_status { · 9 unmodified lines | |||
| 230 | EC_RES_OVERFLOW = 11, /* Table / data overflow */ | 474 | EC_RES_OVERFLOW = 11, /* Table / data overflow */ |
| 231 | EC_RES_INVALID_HEADER = 12, /* Header contains invalid data */ | 475 | EC_RES_INVALID_HEADER = 12, /* Header contains invalid data */ |
| 232 | EC_RES_REQUEST_TRUNCATED = 13, /* Didn't get the entire request */ | 476 | EC_RES_REQUEST_TRUNCATED = 13, /* Didn't get the entire request */ |
| 233 | EC_RES_RESPONSE_TOO_BIG = 14 /* Response was too big to handle */ | 477 | EC_RES_RESPONSE_TOO_BIG = 14, /* Response was too big to handle */ |
| 478 | EC_RES_BUS_ERROR = 15, /* Communications bus error */ | ||
| 479 | EC_RES_BUSY = 16, /* Up but too busy. Should retry */ | ||
| 480 | EC_RES_INVALID_HEADER_VERSION = 17, /* Header version invalid */ | ||
| 481 | EC_RES_INVALID_HEADER_CRC = 18, /* Header CRC invalid */ | ||
| 482 | EC_RES_INVALID_DATA_CRC = 19, /* Data CRC invalid */ | ||
| 483 | EC_RES_DUP_UNAVAILABLE = 20, /* Can't resend response */ | ||
| 234 | }; | 484 | }; |
| 235 | 485 | ||
| 236 | /* | 486 | /* |
| @@ -250,7 +500,8 @@ enum host_event_code { · 13 unmodified lines | |||
| 250 | EC_HOST_EVENT_BATTERY_CRITICAL = 7, | 500 | EC_HOST_EVENT_BATTERY_CRITICAL = 7, |
| 251 | EC_HOST_EVENT_BATTERY = 8, | 501 | EC_HOST_EVENT_BATTERY = 8, |
| 252 | EC_HOST_EVENT_THERMAL_THRESHOLD = 9, | 502 | EC_HOST_EVENT_THERMAL_THRESHOLD = 9, |
| 253 | EC_HOST_EVENT_THERMAL_OVERLOAD = 10, | 503 | /* Event generated by a device attached to the EC */ |
| 504 | EC_HOST_EVENT_DEVICE = 10, | ||
| 254 | EC_HOST_EVENT_THERMAL = 11, | 505 | EC_HOST_EVENT_THERMAL = 11, |
| 255 | EC_HOST_EVENT_USB_CHARGER = 12, | 506 | EC_HOST_EVENT_USB_CHARGER = 12, |
| 256 | EC_HOST_EVENT_KEY_PRESSED = 13, | 507 | EC_HOST_EVENT_KEY_PRESSED = 13, |
| @@ -277,15 +528,34 @@ enum host_event_code { · 20 unmodified lines | |||
| 277 | EC_HOST_EVENT_HANG_DETECT = 20, | 528 | EC_HOST_EVENT_HANG_DETECT = 20, |
| 278 | /* Hang detect logic detected a hang and warm rebooted the AP */ | 529 | /* Hang detect logic detected a hang and warm rebooted the AP */ |
| 279 | EC_HOST_EVENT_HANG_REBOOT = 21, | 530 | EC_HOST_EVENT_HANG_REBOOT = 21, |
| 531 | |||
| 280 | /* PD MCU triggering host event */ | 532 | /* PD MCU triggering host event */ |
| 281 | EC_HOST_EVENT_PD_MCU = 22, | 533 | EC_HOST_EVENT_PD_MCU = 22, |
| 282 | 534 | ||
| 283 | /* EC desires to change state of host-controlled USB mux */ | 535 | /* Battery Status flags have changed */ |
| 284 | EC_HOST_EVENT_USB_MUX = 28, | 536 | EC_HOST_EVENT_BATTERY_STATUS = 23, |
| 537 | |||
| 538 | /* EC encountered a panic, triggering a reset */ | ||
| 539 | EC_HOST_EVENT_PANIC = 24, | ||
| 540 | |||
| 541 | /* Keyboard fastboot combo has been pressed */ | ||
| 542 | EC_HOST_EVENT_KEYBOARD_FASTBOOT = 25, | ||
| 285 | 543 | ||
| 286 | /* EC RTC event occurred */ | 544 | /* EC RTC event occurred */ |
| 287 | EC_HOST_EVENT_RTC = 26, | 545 | EC_HOST_EVENT_RTC = 26, |
| 288 | 546 | ||
| 547 | /* Emulate MKBP event */ | ||
| 548 | EC_HOST_EVENT_MKBP = 27, | ||
| 549 | |||
| 550 | /* EC desires to change state of host-controlled USB mux */ | ||
| 551 | EC_HOST_EVENT_USB_MUX = 28, | ||
| 552 | |||
| 553 | /* TABLET/LAPTOP mode or detachable base attach/detach event */ | ||
| 554 | EC_HOST_EVENT_MODE_CHANGE = 29, | ||
| 555 | |||
| 556 | /* Keyboard recovery combo with hardware reinitialization */ | ||
| 557 | EC_HOST_EVENT_KEYBOARD_RECOVERY_HW_REINIT = 30, | ||
| 558 | |||
| 289 | /* | 559 | /* |
| 290 | * The high bit of the event mask is not used as a host event code. If | 560 | * The high bit of the event mask is not used as a host event code. If |
| 291 | * it reads back as set, then the entire event mask should be | 561 | * it reads back as set, then the entire event mask should be |
| @@ -296,7 +566,7 @@ enum host_event_code { · 4 unmodified lines | |||
| 296 | EC_HOST_EVENT_INVALID = 32 | 566 | EC_HOST_EVENT_INVALID = 32 |
| 297 | }; | 567 | }; |
| 298 | /* Host event mask */ | 568 | /* Host event mask */ |
| 299 | #define EC_HOST_EVENT_MASK(event_code) (1UL << ((event_code) - 1)) | 569 | #define EC_HOST_EVENT_MASK(event_code) BIT_ULL((event_code) - 1) |
| 300 | 570 | ||
| 301 | /** | 571 | /** |
| 302 | * struct ec_lpc_host_args - Arguments at EC_LPC_ADDR_HOST_ARGS | 572 | * struct ec_lpc_host_args - Arguments at EC_LPC_ADDR_HOST_ARGS |
| @@ -311,7 +581,7 @@ struct ec_lpc_host_args { · 8 unmodified lines | |||
| 311 | uint8_t command_version; | 581 | uint8_t command_version; |
| 312 | uint8_t data_size; | 582 | uint8_t data_size; |
| 313 | uint8_t checksum; | 583 | uint8_t checksum; |
| 314 | } __packed; | 584 | } __ec_align4; |
| 315 | 585 | ||
| 316 | /* Flags for ec_lpc_host_args.flags */ | 586 | /* Flags for ec_lpc_host_args.flags */ |
| 317 | /* | 587 | /* |
| @@ -321,7 +591,7 @@ struct ec_lpc_host_args { · 3 unmodified lines | |||
| 321 | * If EC gets a command and this flag is not set, this is an old-style command. | 591 | * If EC gets a command and this flag is not set, this is an old-style command. |
| 322 | * Command version is 0 and params from host are at EC_LPC_ADDR_OLD_PARAM with | 592 | * Command version is 0 and params from host are at EC_LPC_ADDR_OLD_PARAM with |
| 323 | * unknown length. EC must respond with an old-style response (that is, | 593 | * unknown length. EC must respond with an old-style response (that is, |
| 324 | * withouth setting EC_HOST_ARGS_FLAG_TO_HOST). | 594 | * without setting EC_HOST_ARGS_FLAG_TO_HOST). |
| 325 | */ | 595 | */ |
| 326 | #define EC_HOST_ARGS_FLAG_FROM_HOST 0x01 | 596 | #define EC_HOST_ARGS_FLAG_FROM_HOST 0x01 |
| 327 | /* | 597 | /* |
| @@ -482,7 +752,7 @@ struct ec_host_request { · 154 unmodified lines | |||
| 482 | uint8_t command_version; | 752 | uint8_t command_version; |
| 483 | uint8_t reserved; | 753 | uint8_t reserved; |
| 484 | uint16_t data_len; | 754 | uint16_t data_len; |
| 485 | } __packed; | 755 | } __ec_align4; |
| 486 | 756 | ||
| 487 | #define EC_HOST_RESPONSE_VERSION 3 | 757 | #define EC_HOST_RESPONSE_VERSION 3 |
| 488 | 758 | ||
| @@ -501,18 +771,151 @@ struct ec_host_response { · 12 unmodified lines | |||
| 501 | uint16_t result; | 771 | uint16_t result; |
| 502 | uint16_t data_len; | 772 | uint16_t data_len; |
| 503 | uint16_t reserved; | 773 | uint16_t reserved; |
| 504 | } __packed; | 774 | } __ec_align4; |
| 775 | |||
| 776 | /*****************************************************************************/ | ||
| 777 | |||
| 778 | /* | ||
| 779 | * Host command protocol V4. | ||
| 780 | * | ||
| 781 | * Packets always start with a request or response header. They are followed | ||
| 782 | * by data_len bytes of data. If the data_crc_present flag is set, the data | ||
| 783 | * bytes are followed by a CRC-8 of that data, using using x^8 + x^2 + x + 1 | ||
| 784 | * polynomial. | ||
| 785 | * | ||
| 786 | * Host algorithm when sending a request q: | ||
| 787 | * | ||
| 788 | * 101) tries_left=(some value, e.g. 3); | ||
| 789 | * 102) q.seq_num++ | ||
| 790 | * 103) q.seq_dup=0 | ||
| 791 | * 104) Calculate q.header_crc. | ||
| 792 | * 105) Send request q to EC. | ||
| 793 | * 106) Wait for response r. Go to 201 if received or 301 if timeout. | ||
| 794 | * | ||
| 795 | * 201) If r.struct_version != 4, go to 301. | ||
| 796 | * 202) If r.header_crc mismatches calculated CRC for r header, go to 301. | ||
| 797 | * 203) If r.data_crc_present and r.data_crc mismatches, go to 301. | ||
| 798 | * 204) If r.seq_num != q.seq_num, go to 301. | ||
| 799 | * 205) If r.seq_dup == q.seq_dup, return success. | ||
| 800 | * 207) If r.seq_dup == 1, go to 301. | ||
| 801 | * 208) Return error. | ||
| 802 | * | ||
| 803 | * 301) If --tries_left <= 0, return error. | ||
| 804 | * 302) If q.seq_dup == 1, go to 105. | ||
| 805 | * 303) q.seq_dup = 1 | ||
| 806 | * 304) Go to 104. | ||
| 807 | * | ||
| 808 | * EC algorithm when receiving a request q. | ||
| 809 | * EC has response buffer r, error buffer e. | ||
| 810 | * | ||
| 811 | * 101) If q.struct_version != 4, set e.result = EC_RES_INVALID_HEADER_VERSION | ||
| 812 | * and go to 301 | ||
| 813 | * 102) If q.header_crc mismatches calculated CRC, set e.result = | ||
| 814 | * EC_RES_INVALID_HEADER_CRC and go to 301 | ||
| 815 | * 103) If q.data_crc_present, calculate data CRC. If that mismatches the CRC | ||
| 816 | * byte at the end of the packet, set e.result = EC_RES_INVALID_DATA_CRC | ||
| 817 | * and go to 301. | ||
| 818 | * 104) If q.seq_dup == 0, go to 201. | ||
| 819 | * 105) If q.seq_num != r.seq_num, go to 201. | ||
| 820 | * 106) If q.seq_dup == r.seq_dup, go to 205, else go to 203. | ||
| 821 | * | ||
| 822 | * 201) Process request q into response r. | ||
| 823 | * 202) r.seq_num = q.seq_num | ||
| 824 | * 203) r.seq_dup = q.seq_dup | ||
| 825 | * 204) Calculate r.header_crc | ||
| 826 | * 205) If r.data_len > 0 and data is no longer available, set e.result = | ||
| 827 | * EC_RES_DUP_UNAVAILABLE and go to 301. | ||
| 828 | * 206) Send response r. | ||
| 829 | * | ||
| 830 | * 301) e.seq_num = q.seq_num | ||
| 831 | * 302) e.seq_dup = q.seq_dup | ||
| 832 | * 303) Calculate e.header_crc. | ||
| 833 | * 304) Send error response e. | ||
| 834 | */ | ||
| 835 | |||
| 836 | /* Version 4 request from host */ | ||
| 837 | struct ec_host_request4 { | ||
| 838 | /* | ||
| 839 | * bits 0-3: struct_version: Structure version (=4) | ||
| 840 | * bit 4: is_response: Is response (=0) | ||
| 841 | * bits 5-6: seq_num: Sequence number | ||
| 842 | * bit 7: seq_dup: Sequence duplicate flag | ||
| 843 | */ | ||
| 844 | uint8_t fields0; | ||
| 845 | |||
| 846 | /* | ||
| 847 | * bits 0-4: command_version: Command version | ||
| 848 | * bits 5-6: Reserved (set 0, ignore on read) | ||
| 849 | * bit 7: data_crc_present: Is data CRC present after data | ||
| 850 | */ | ||
| 851 | uint8_t fields1; | ||
| 852 | |||
| 853 | /* Command code (EC_CMD_*) */ | ||
| 854 | uint16_t command; | ||
| 855 | |||
| 856 | /* Length of data which follows this header (not including data CRC) */ | ||
| 857 | uint16_t data_len; | ||
| 858 | |||
| 859 | /* Reserved (set 0, ignore on read) */ | ||
| 860 | uint8_t reserved; | ||
| 861 | |||
| 862 | /* CRC-8 of above fields, using x^8 + x^2 + x + 1 polynomial */ | ||
| 863 | uint8_t header_crc; | ||
| 864 | } __ec_align4; | ||
| 865 | |||
| 866 | /* Version 4 response from EC */ | ||
| 867 | struct ec_host_response4 { | ||
| 868 | /* | ||
| 869 | * bits 0-3: struct_version: Structure version (=4) | ||
| 870 | * bit 4: is_response: Is response (=1) | ||
| 871 | * bits 5-6: seq_num: Sequence number | ||
| 872 | * bit 7: seq_dup: Sequence duplicate flag | ||
| 873 | */ | ||
| 874 | uint8_t fields0; | ||
| 875 | |||
| 876 | /* | ||
| 877 | * bits 0-6: Reserved (set 0, ignore on read) | ||
| 878 | * bit 7: data_crc_present: Is data CRC present after data | ||
| 879 | */ | ||
| 880 | uint8_t fields1; | ||
| 881 | |||
| 882 | /* Result code (EC_RES_*) */ | ||
| 883 | uint16_t result; | ||
| 884 | |||
| 885 | /* Length of data which follows this header (not including data CRC) */ | ||
| 886 | uint16_t data_len; | ||
| 887 | |||
| 888 | /* Reserved (set 0, ignore on read) */ | ||
| 889 | uint8_t reserved; | ||
| 890 | |||
| 891 | /* CRC-8 of above fields, using x^8 + x^2 + x + 1 polynomial */ | ||
| 892 | uint8_t header_crc; | ||
| 893 | } __ec_align4; | ||
| 894 | |||
| 895 | /* Fields in fields0 byte */ | ||
| 896 | #define EC_PACKET4_0_STRUCT_VERSION_MASK 0x0f | ||
| 897 | #define EC_PACKET4_0_IS_RESPONSE_MASK 0x10 | ||
| 898 | #define EC_PACKET4_0_SEQ_NUM_SHIFT 5 | ||
| 899 | #define EC_PACKET4_0_SEQ_NUM_MASK 0x60 | ||
| 900 | #define EC_PACKET4_0_SEQ_DUP_MASK 0x80 | ||
| 901 | |||
| 902 | /* Fields in fields1 byte */ | ||
| 903 | #define EC_PACKET4_1_COMMAND_VERSION_MASK 0x1f /* (request only) */ | ||
| 904 | #define EC_PACKET4_1_DATA_CRC_PRESENT_MASK 0x80 | ||
| 505 | 905 | ||
| 506 | /*****************************************************************************/ | 906 | /*****************************************************************************/ |
| 507 | /* | 907 | /* |
| 508 | * Notes on commands: | 908 | * Notes on commands: |
| 509 | * | 909 | * |
| 510 | * Each command is an 16-bit command value. Commands which take params or | 910 | * Each command is an 16-bit command value. Commands which take params or |
| 511 | * return response data specify structs for that data. If no struct is | 911 | * return response data specify structures for that data. If no structure is |
| 512 | * specified, the command does not input or output data, respectively. | 912 | * specified, the command does not input or output data, respectively. |
| 513 | * Parameter/response length is implicit in the structs. Some underlying | 913 | * Parameter/response length is implicit in the structs. Some underlying |
| 514 | * communication protocols (I2C, SPI) may add length or checksum headers, but | 914 | * communication protocols (I2C, SPI) may add length or checksum headers, but |
| 515 | * those are implementation-dependent and not defined here. | 915 | * those are implementation-dependent and not defined here. |
| 916 | * | ||
| 917 | * All commands MUST be #defined to be 4-digit UPPER CASE hex values | ||
| 918 | * (e.g., 0x00AB, not 0xab) for CONFIG_HOSTCMD_SECTION_SORTED to work. | ||
| 516 | */ | 919 | */ |
| 517 | 920 | ||
| 518 | /*****************************************************************************/ | 921 | /*****************************************************************************/ |
| @@ -522,7 +925,7 @@ struct ec_host_response { · 3 unmodified lines | |||
| 522 | * Get protocol version, used to deal with non-backward compatible protocol | 925 | * Get protocol version, used to deal with non-backward compatible protocol |
| 523 | * changes. | 926 | * changes. |
| 524 | */ | 927 | */ |
| 525 | #define EC_CMD_PROTO_VERSION 0x00 | 928 | #define EC_CMD_PROTO_VERSION 0x0000 |
| 526 | 929 | ||
| 527 | /** | 930 | /** |
| 528 | * struct ec_response_proto_version - Response to the proto version command. | 931 | * struct ec_response_proto_version - Response to the proto version command. |
| @@ -530,13 +933,13 @@ struct ec_host_response { · 1 unmodified line | |||
| 530 | */ | 933 | */ |
| 531 | struct ec_response_proto_version { | 934 | struct ec_response_proto_version { |
| 532 | uint32_t version; | 935 | uint32_t version; |
| 533 | } __packed; | 936 | } __ec_align4; |
| 534 | 937 | ||
| 535 | /* | 938 | /* |
| 536 | * Hello. This is a simple command to test the EC is responsive to | 939 | * Hello. This is a simple command to test the EC is responsive to |
| 537 | * commands. | 940 | * commands. |
| 538 | */ | 941 | */ |
| 539 | #define EC_CMD_HELLO 0x01 | 942 | #define EC_CMD_HELLO 0x0001 |
| 540 | 943 | ||
| 541 | /** | 944 | /** |
| 542 | * struct ec_params_hello - Parameters to the hello command. | 945 | * struct ec_params_hello - Parameters to the hello command. |
| @@ -544,7 +947,7 @@ struct ec_response_proto_version { · 1 unmodified line | |||
| 544 | */ | 947 | */ |
| 545 | struct ec_params_hello { | 948 | struct ec_params_hello { |
| 546 | uint32_t in_data; | 949 | uint32_t in_data; |
| 547 | } __packed; | 950 | } __ec_align4; |
| 548 | 951 | ||
| 549 | /** | 952 | /** |
| 550 | * struct ec_response_hello - Response to the hello command. | 953 | * struct ec_response_hello - Response to the hello command. |
| @@ -552,10 +955,10 @@ struct ec_params_hello { · 1 unmodified line | |||
| 552 | */ | 955 | */ |
| 553 | struct ec_response_hello { | 956 | struct ec_response_hello { |
| 554 | uint32_t out_data; | 957 | uint32_t out_data; |
| 555 | } __packed; | 958 | } __ec_align4; |
| 556 | 959 | ||
| 557 | /* Get version number */ | 960 | /* Get version number */ |
| 558 | #define EC_CMD_GET_VERSION 0x02 | 961 | #define EC_CMD_GET_VERSION 0x0002 |
| 559 | 962 | ||
| 560 | enum ec_current_image { | 963 | enum ec_current_image { |
| 561 | EC_IMAGE_UNKNOWN = 0, | 964 | EC_IMAGE_UNKNOWN = 0, |
| @@ -575,10 +978,10 @@ struct ec_response_get_version { · 13 unmodified lines | |||
| 575 | char version_string_rw[32]; | 978 | char version_string_rw[32]; |
| 576 | char reserved[32]; | 979 | char reserved[32]; |
| 577 | uint32_t current_image; | 980 | uint32_t current_image; |
| 578 | } __packed; | 981 | } __ec_align4; |
| 579 | 982 | ||
| 580 | /* Read test */ | 983 | /* Read test */ |
| 581 | #define EC_CMD_READ_TEST 0x03 | 984 | #define EC_CMD_READ_TEST 0x0003 |
| 582 | 985 | ||
| 583 | /** | 986 | /** |
| 584 | * struct ec_params_read_test - Parameters for the read test command. | 987 | * struct ec_params_read_test - Parameters for the read test command. |
| @@ -588,7 +991,7 @@ struct ec_response_get_version { · 3 unmodified lines | |||
| 588 | struct ec_params_read_test { | 991 | struct ec_params_read_test { |
| 589 | uint32_t offset; | 992 | uint32_t offset; |
| 590 | uint32_t size; | 993 | uint32_t size; |
| 591 | } __packed; | 994 | } __ec_align4; |
| 592 | 995 | ||
| 593 | /** | 996 | /** |
| 594 | * struct ec_response_read_test - Response to the read test command. | 997 | * struct ec_response_read_test - Response to the read test command. |
| @@ -596,17 +999,17 @@ struct ec_params_read_test { · 1 unmodified line | |||
| 596 | */ | 999 | */ |
| 597 | struct ec_response_read_test { | 1000 | struct ec_response_read_test { |
| 598 | uint32_t data[32]; | 1001 | uint32_t data[32]; |
| 599 | } __packed; | 1002 | } __ec_align4; |
| 600 | 1003 | ||
| 601 | /* | 1004 | /* |
| 602 | * Get build information | 1005 | * Get build information |
| 603 | * | 1006 | * |
| 604 | * Response is null-terminated string. | 1007 | * Response is null-terminated string. |
| 605 | */ | 1008 | */ |
| 606 | #define EC_CMD_GET_BUILD_INFO 0x04 | 1009 | #define EC_CMD_GET_BUILD_INFO 0x0004 |
| 607 | 1010 | ||
| 608 | /* Get chip info */ | 1011 | /* Get chip info */ |
| 609 | #define EC_CMD_GET_CHIP_INFO 0x05 | 1012 | #define EC_CMD_GET_CHIP_INFO 0x0005 |
| 610 | 1013 | ||
| 611 | /** | 1014 | /** |
| 612 | * struct ec_response_get_chip_info - Response to the get chip info command. | 1015 | * struct ec_response_get_chip_info - Response to the get chip info command. |
| @@ -618,10 +1021,10 @@ struct ec_response_get_chip_info { · 5 unmodified lines | |||
| 618 | char vendor[32]; | 1021 | char vendor[32]; |
| 619 | char name[32]; | 1022 | char name[32]; |
| 620 | char revision[32]; | 1023 | char revision[32]; |
| 621 | } __packed; | 1024 | } __ec_align4; |
| 622 | 1025 | ||
| 623 | /* Get board HW version */ | 1026 | /* Get board HW version */ |
| 624 | #define EC_CMD_GET_BOARD_VERSION 0x06 | 1027 | #define EC_CMD_GET_BOARD_VERSION 0x0006 |
| 625 | 1028 | ||
| 626 | /** | 1029 | /** |
| 627 | * struct ec_response_board_version - Response to the board version command. | 1030 | * struct ec_response_board_version - Response to the board version command. |
| @@ -629,7 +1032,7 @@ struct ec_response_get_chip_info { · 1 unmodified line | |||
| 629 | */ | 1032 | */ |
| 630 | struct ec_response_board_version { | 1033 | struct ec_response_board_version { |
| 631 | uint16_t board_version; | 1034 | uint16_t board_version; |
| 632 | } __packed; | 1035 | } __ec_align2; |
| 633 | 1036 | ||
| 634 | /* | 1037 | /* |
| 635 | * Read memory-mapped data. | 1038 | * Read memory-mapped data. |
| @@ -639,7 +1042,7 @@ struct ec_response_board_version { · 3 unmodified lines | |||
| 639 | * | 1042 | * |
| 640 | * Response is params.size bytes of data. | 1043 | * Response is params.size bytes of data. |
| 641 | */ | 1044 | */ |
| 642 | #define EC_CMD_READ_MEMMAP 0x07 | 1045 | #define EC_CMD_READ_MEMMAP 0x0007 |
| 643 | 1046 | ||
| 644 | /** | 1047 | /** |
| 645 | * struct ec_params_read_memmap - Parameters for the read memory map command. | 1048 | * struct ec_params_read_memmap - Parameters for the read memory map command. |
| @@ -649,10 +1052,10 @@ struct ec_response_board_version { · 3 unmodified lines | |||
| 649 | struct ec_params_read_memmap { | 1052 | struct ec_params_read_memmap { |
| 650 | uint8_t offset; | 1053 | uint8_t offset; |
| 651 | uint8_t size; | 1054 | uint8_t size; |
| 652 | } __packed; | 1055 | } __ec_align1; |
| 653 | 1056 | ||
| 654 | /* Read versions supported for a command */ | 1057 | /* Read versions supported for a command */ |
| 655 | #define EC_CMD_GET_CMD_VERSIONS 0x08 | 1058 | #define EC_CMD_GET_CMD_VERSIONS 0x0008 |
| 656 | 1059 | ||
| 657 | /** | 1060 | /** |
| 658 | * struct ec_params_get_cmd_versions - Parameters for the get command versions. | 1061 | * struct ec_params_get_cmd_versions - Parameters for the get command versions. |
| @@ -660,7 +1063,7 @@ struct ec_params_read_memmap { · 1 unmodified line | |||
| 660 | */ | 1063 | */ |
| 661 | struct ec_params_get_cmd_versions { | 1064 | struct ec_params_get_cmd_versions { |
| 662 | uint8_t cmd; | 1065 | uint8_t cmd; |
| 663 | } __packed; | 1066 | } __ec_align1; |
| 664 | 1067 | ||
| 665 | /** | 1068 | /** |
| 666 | * struct ec_params_get_cmd_versions_v1 - Parameters for the get command | 1069 | * struct ec_params_get_cmd_versions_v1 - Parameters for the get command |
| @@ -669,7 +1072,7 @@ struct ec_params_get_cmd_versions { · 2 unmodified lines | |||
| 669 | */ | 1072 | */ |
| 670 | struct ec_params_get_cmd_versions_v1 { | 1073 | struct ec_params_get_cmd_versions_v1 { |
| 671 | uint16_t cmd; | 1074 | uint16_t cmd; |
| 672 | } __packed; | 1075 | } __ec_align2; |
| 673 | 1076 | ||
| 674 | /** | 1077 | /** |
| 675 | * struct ec_response_get_cmd_version - Response to the get command versions. | 1078 | * struct ec_response_get_cmd_version - Response to the get command versions. |
| @@ -678,20 +1081,20 @@ struct ec_params_get_cmd_versions_v1 { · 2 unmodified lines | |||
| 678 | */ | 1081 | */ |
| 679 | struct ec_response_get_cmd_versions { | 1082 | struct ec_response_get_cmd_versions { |
| 680 | uint32_t version_mask; | 1083 | uint32_t version_mask; |
| 681 | } __packed; | 1084 | } __ec_align4; |
| 682 | 1085 | ||
| 683 | /* | 1086 | /* |
| 684 | * Check EC communcations status (busy). This is needed on i2c/spi but not | 1087 | * Check EC communications status (busy). This is needed on i2c/spi but not |
| 685 | * on lpc since it has its own out-of-band busy indicator. | 1088 | * on lpc since it has its own out-of-band busy indicator. |
| 686 | * | 1089 | * |
| 687 | * lpc must read the status from the command register. Attempting this on | 1090 | * lpc must read the status from the command register. Attempting this on |
| 688 | * lpc will overwrite the args/parameter space and corrupt its data. | 1091 | * lpc will overwrite the args/parameter space and corrupt its data. |
| 689 | */ | 1092 | */ |
| 690 | #define EC_CMD_GET_COMMS_STATUS 0x09 | 1093 | #define EC_CMD_GET_COMMS_STATUS 0x0009 |
| 691 | 1094 | ||
| 692 | /* Avoid using ec_status which is for return values */ | 1095 | /* Avoid using ec_status which is for return values */ |
| 693 | enum ec_comms_status { | 1096 | enum ec_comms_status { |
| 694 | EC_COMMS_STATUS_PROCESSING = 1 << 0, /* Processing cmd */ | 1097 | EC_COMMS_STATUS_PROCESSING = BIT(0), /* Processing cmd */ |
| 695 | }; | 1098 | }; |
| 696 | 1099 | ||
| 697 | /** | 1100 | /** |
| @@ -701,29 +1104,29 @@ enum ec_comms_status { · 3 unmodified lines | |||
| 701 | */ | 1104 | */ |
| 702 | struct ec_response_get_comms_status { | 1105 | struct ec_response_get_comms_status { |
| 703 | uint32_t flags; /* Mask of enum ec_comms_status */ | 1106 | uint32_t flags; /* Mask of enum ec_comms_status */ |
| 704 | } __packed; | 1107 | } __ec_align4; |
| 705 | 1108 | ||
| 706 | /* Fake a variety of responses, purely for testing purposes. */ | 1109 | /* Fake a variety of responses, purely for testing purposes. */ |
| 707 | #define EC_CMD_TEST_PROTOCOL 0x0a | 1110 | #define EC_CMD_TEST_PROTOCOL 0x000A |
| 708 | 1111 | ||
| 709 | /* Tell the EC what to send back to us. */ | 1112 | /* Tell the EC what to send back to us. */ |
| 710 | struct ec_params_test_protocol { | 1113 | struct ec_params_test_protocol { |
| 711 | uint32_t ec_result; | 1114 | uint32_t ec_result; |
| 712 | uint32_t ret_len; | 1115 | uint32_t ret_len; |
| 713 | uint8_t buf[32]; | 1116 | uint8_t buf[32]; |
| 714 | } __packed; | 1117 | } __ec_align4; |
| 715 | 1118 | ||
| 716 | /* Here it comes... */ | 1119 | /* Here it comes... */ |
| 717 | struct ec_response_test_protocol { | 1120 | struct ec_response_test_protocol { |
| 718 | uint8_t buf[32]; | 1121 | uint8_t buf[32]; |
| 719 | } __packed; | 1122 | } __ec_align4; |
| 720 | 1123 | ||
| 721 | /* Get prococol information */ | 1124 | /* Get protocol information */ |
| 722 | #define EC_CMD_GET_PROTOCOL_INFO 0x0b | 1125 | #define EC_CMD_GET_PROTOCOL_INFO 0x000B |
| 723 | 1126 | ||
| 724 | /* Flags for ec_response_get_protocol_info.flags */ | 1127 | /* Flags for ec_response_get_protocol_info.flags */ |
| 725 | /* EC_RES_IN_PROGRESS may be returned if a command is slow */ | 1128 | /* EC_RES_IN_PROGRESS may be returned if a command is slow */ |
| 726 | #define EC_PROTOCOL_INFO_IN_PROGRESS_SUPPORTED (1 << 0) | 1129 | #define EC_PROTOCOL_INFO_IN_PROGRESS_SUPPORTED BIT(0) |
| 727 | 1130 | ||
| 728 | /** | 1131 | /** |
| 729 | * struct ec_response_get_protocol_info - Response to the get protocol info. | 1132 | * struct ec_response_get_protocol_info - Response to the get protocol info. |
| @@ -739,7 +1142,7 @@ struct ec_response_get_protocol_info { · 9 unmodified lines | |||
| 739 | uint16_t max_request_packet_size; | 1142 | uint16_t max_request_packet_size; |
| 740 | uint16_t max_response_packet_size; | 1143 | uint16_t max_response_packet_size; |
| 741 | uint32_t flags; | 1144 | uint32_t flags; |
| 742 | } __packed; | 1145 | } __ec_align4; |
| 743 | 1146 | ||
| 744 | 1147 | ||
| 745 | /*****************************************************************************/ | 1148 | /*****************************************************************************/ |
| @@ -757,19 +1160,19 @@ struct ec_response_get_protocol_info { · 11 unmodified lines | |||
| 757 | struct ec_params_get_set_value { | 1160 | struct ec_params_get_set_value { |
| 758 | uint32_t flags; | 1161 | uint32_t flags; |
| 759 | uint32_t value; | 1162 | uint32_t value; |
| 760 | } __packed; | 1163 | } __ec_align4; |
| 761 | 1164 | ||
| 762 | struct ec_response_get_set_value { | 1165 | struct ec_response_get_set_value { |
| 763 | uint32_t flags; | 1166 | uint32_t flags; |
| 764 | uint32_t value; | 1167 | uint32_t value; |
| 765 | } __packed; | 1168 | } __ec_align4; |
| 766 | 1169 | ||
| 767 | /* More than one command can use these structs to get/set paramters. */ | 1170 | /* More than one command can use these structs to get/set parameters. */ |
| 768 | #define EC_CMD_GSV_PAUSE_IN_S5 0x0c | 1171 | #define EC_CMD_GSV_PAUSE_IN_S5 0x000C |
| 769 | 1172 | ||
| 770 | /*****************************************************************************/ | 1173 | /*****************************************************************************/ |
| 771 | /* List the features supported by the firmware */ | 1174 | /* List the features supported by the firmware */ |
| 772 | #define EC_CMD_GET_FEATURES 0x0d | 1175 | #define EC_CMD_GET_FEATURES 0x000D |
| 773 | 1176 | ||
| 774 | /* Supported features */ | 1177 | /* Supported features */ |
| 775 | enum ec_feature_code { | 1178 | enum ec_feature_code { |
| @@ -876,24 +1279,36 @@ enum ec_feature_code { · 100 unmodified lines | |||
| 876 | EC_FEATURE_REFINED_TABLET_MODE_HYSTERESIS = 37, | 1279 | EC_FEATURE_REFINED_TABLET_MODE_HYSTERESIS = 37, |
| 877 | /* EC supports audio codec. */ | 1280 | /* EC supports audio codec. */ |
| 878 | EC_FEATURE_AUDIO_CODEC = 38, | 1281 | EC_FEATURE_AUDIO_CODEC = 38, |
| 879 | /* EC Supports SCP. */ | 1282 | /* The MCU is a System Companion Processor (SCP). */ |
| 880 | EC_FEATURE_SCP = 39, | 1283 | EC_FEATURE_SCP = 39, |
| 881 | /* The MCU is an Integrated Sensor Hub */ | 1284 | /* The MCU is an Integrated Sensor Hub */ |
| 882 | EC_FEATURE_ISH = 40, | 1285 | EC_FEATURE_ISH = 40, |
| 883 | }; | 1286 | }; |
| 884 | 1287 | ||
| 885 | #define EC_FEATURE_MASK_0(event_code) (1UL << (event_code % 32)) | 1288 | #define EC_FEATURE_MASK_0(event_code) BIT(event_code % 32) |
| 886 | #define EC_FEATURE_MASK_1(event_code) (1UL << (event_code - 32)) | 1289 | #define EC_FEATURE_MASK_1(event_code) BIT(event_code - 32) |
| 887 | 1290 | ||
| 888 | struct ec_response_get_features { | 1291 | struct ec_response_get_features { |
| 889 | uint32_t flags[2]; | 1292 | uint32_t flags[2]; |
| 890 | } __packed; | 1293 | } __ec_align4; |
| 1294 | |||
| 1295 | /*****************************************************************************/ | ||
| 1296 | /* Get the board's SKU ID from EC */ | ||
| 1297 | #define EC_CMD_GET_SKU_ID 0x000E | ||
| 1298 | |||
| 1299 | /* Set SKU ID from AP */ | ||
| 1300 | #define EC_CMD_SET_SKU_ID 0x000F | ||
| 1301 | |||
| 1302 | struct ec_sku_id_info { | ||
| 1303 | uint32_t sku_id; | ||
| 1304 | } __ec_align4; | ||
| 891 | 1305 | ||
| 892 | /*****************************************************************************/ | 1306 | /*****************************************************************************/ |
| 893 | /* Flash commands */ | 1307 | /* Flash commands */ |
| 894 | 1308 | ||
| 895 | /* Get flash info */ | 1309 | /* Get flash info */ |
| 896 | #define EC_CMD_FLASH_INFO 0x10 | 1310 | #define EC_CMD_FLASH_INFO 0x0010 |
| 1311 | #define EC_VER_FLASH_INFO 2 | ||
| 897 | 1312 | ||
| 898 | /** | 1313 | /** |
| 899 | * struct ec_response_flash_info - Response to the flash info command. | 1314 | * struct ec_response_flash_info - Response to the flash info command. |
| @@ -912,11 +1327,22 @@ struct ec_response_flash_info { · 12 unmodified lines | |||
| 912 | uint32_t write_block_size; | 1327 | uint32_t write_block_size; |
| 913 | uint32_t erase_block_size; | 1328 | uint32_t erase_block_size; |
| 914 | uint32_t protect_block_size; | 1329 | uint32_t protect_block_size; |
| 915 | } __packed; | 1330 | } __ec_align4; |
| 1331 | |||
| 1332 | /* | ||
| 1333 | * Flags for version 1+ flash info command | ||
| 1334 | * EC flash erases bits to 0 instead of 1. | ||
| 1335 | */ | ||
| 1336 | #define EC_FLASH_INFO_ERASE_TO_0 BIT(0) | ||
| 916 | 1337 | ||
| 917 | /* Flags for version 1+ flash info command */ | 1338 | /* |
| 918 | /* EC flash erases bits to 0 instead of 1 */ | 1339 | * Flash must be selected for read/write/erase operations to succeed. This may |
| 919 | #define EC_FLASH_INFO_ERASE_TO_0 (1 << 0) | 1340 | * be necessary on a chip where write/erase can be corrupted by other board |
| 1341 | * activity, or where the chip needs to enable some sort of programming voltage, | ||
| 1342 | * or where the read/write/erase operations require cleanly suspending other | ||
| 1343 | * chip functionality. | ||
| 1344 | */ | ||
| 1345 | #define EC_FLASH_INFO_SELECT_REQUIRED BIT(1) | ||
| 920 | 1346 | ||
| 921 | /** | 1347 | /** |
| 922 | * struct ec_response_flash_info_1 - Response to the flash info v1 command. | 1348 | * struct ec_response_flash_info_1 - Response to the flash info v1 command. |
| @@ -938,7 +1364,14 @@ struct ec_response_flash_info { · 15 unmodified lines | |||
| 938 | * fields following. | 1364 | * fields following. |
| 939 | * | 1365 | * |
| 940 | * gcc anonymous structs don't seem to get along with the __packed directive; | 1366 | * gcc anonymous structs don't seem to get along with the __packed directive; |
| 941 | * if they did we'd define the version 0 struct as a sub-struct of this one. | 1367 | * if they did we'd define the version 0 structure as a sub-structure of this |
| 1368 | * one. | ||
| 1369 | * | ||
| 1370 | * Version 2 supports flash banks of different sizes: | ||
| 1371 | * The caller specified the number of banks it has preallocated | ||
| 1372 | * (num_banks_desc) | ||
| 1373 | * The EC returns the number of banks describing the flash memory. | ||
| 1374 | * It adds banks descriptions up to num_banks_desc. | ||
| 942 | */ | 1375 | */ |
| 943 | struct ec_response_flash_info_1 { | 1376 | struct ec_response_flash_info_1 { |
| 944 | /* Version 0 fields; see above for description */ | 1377 | /* Version 0 fields; see above for description */ |
| @@ -950,14 +1383,50 @@ struct ec_response_flash_info_1 { · 5 unmodified lines | |||
| 950 | /* Version 1 adds these fields: */ | 1383 | /* Version 1 adds these fields: */ |
| 951 | uint32_t write_ideal_size; | 1384 | uint32_t write_ideal_size; |
| 952 | uint32_t flags; | 1385 | uint32_t flags; |
| 953 | } __packed; | 1386 | } __ec_align4; |
| 1387 | |||
| 1388 | struct ec_params_flash_info_2 { | ||
| 1389 | /* Number of banks to describe */ | ||
| 1390 | uint16_t num_banks_desc; | ||
| 1391 | /* Reserved; set 0; ignore on read */ | ||
| 1392 | uint8_t reserved[2]; | ||
| 1393 | } __ec_align4; | ||
| 1394 | |||
| 1395 | struct ec_flash_bank { | ||
| 1396 | /* Number of sector is in this bank. */ | ||
| 1397 | uint16_t count; | ||
| 1398 | /* Size in power of 2 of each sector (8 --> 256 bytes) */ | ||
| 1399 | uint8_t size_exp; | ||
| 1400 | /* Minimal write size for the sectors in this bank */ | ||
| 1401 | uint8_t write_size_exp; | ||
| 1402 | /* Erase size for the sectors in this bank */ | ||
| 1403 | uint8_t erase_size_exp; | ||
| 1404 | /* Size for write protection, usually identical to erase size. */ | ||
| 1405 | uint8_t protect_size_exp; | ||
| 1406 | /* Reserved; set 0; ignore on read */ | ||
| 1407 | uint8_t reserved[2]; | ||
| 1408 | }; | ||
| 1409 | |||
| 1410 | struct ec_response_flash_info_2 { | ||
| 1411 | /* Total flash in the EC. */ | ||
| 1412 | uint32_t flash_size; | ||
| 1413 | /* Flags; see EC_FLASH_INFO_* */ | ||
| 1414 | uint32_t flags; | ||
| 1415 | /* Maximum size to use to send data to write to the EC. */ | ||
| 1416 | uint32_t write_ideal_size; | ||
| 1417 | /* Number of banks present in the EC. */ | ||
| 1418 | uint16_t num_banks_total; | ||
| 1419 | /* Number of banks described in banks array. */ | ||
| 1420 | uint16_t num_banks_desc; | ||
| 1421 | struct ec_flash_bank banks[0]; | ||
| 1422 | } __ec_align4; | ||
| 954 | 1423 | ||
| 955 | /* | 1424 | /* |
| 956 | * Read flash | 1425 | * Read flash |
| 957 | * | 1426 | * |
| 958 | * Response is params.size bytes of data. | 1427 | * Response is params.size bytes of data. |
| 959 | */ | 1428 | */ |
| 960 | #define EC_CMD_FLASH_READ 0x11 | 1429 | #define EC_CMD_FLASH_READ 0x0011 |
| 961 | 1430 | ||
| 962 | /** | 1431 | /** |
| 963 | * struct ec_params_flash_read - Parameters for the flash read command. | 1432 | * struct ec_params_flash_read - Parameters for the flash read command. |
| @@ -967,10 +1436,10 @@ struct ec_response_flash_info_1 { · 3 unmodified lines | |||
| 967 | struct ec_params_flash_read { | 1436 | struct ec_params_flash_read { |
| 968 | uint32_t offset; | 1437 | uint32_t offset; |
| 969 | uint32_t size; | 1438 | uint32_t size; |
| 970 | } __packed; | 1439 | } __ec_align4; |
| 971 | 1440 | ||
| 972 | /* Write flash */ | 1441 | /* Write flash */ |
| 973 | #define EC_CMD_FLASH_WRITE 0x12 | 1442 | #define EC_CMD_FLASH_WRITE 0x0012 |
| 974 | #define EC_VER_FLASH_WRITE 1 | 1443 | #define EC_VER_FLASH_WRITE 1 |
| 975 | 1444 | ||
| 976 | /* Version 0 of the flash command supported only 64 bytes of data */ | 1445 | /* Version 0 of the flash command supported only 64 bytes of data */ |
| @@ -985,20 +1454,57 @@ struct ec_params_flash_write { · 8 unmodified lines | |||
| 985 | uint32_t offset; | 1454 | uint32_t offset; |
| 986 | uint32_t size; | 1455 | uint32_t size; |
| 987 | /* Followed by data to write */ | 1456 | /* Followed by data to write */ |
| 988 | } __packed; | 1457 | } __ec_align4; |
| 989 | 1458 | ||
| 990 | /* Erase flash */ | 1459 | /* Erase flash */ |
| 991 | #define EC_CMD_FLASH_ERASE 0x13 | 1460 | #define EC_CMD_FLASH_ERASE 0x0013 |
| 992 | 1461 | ||
| 993 | /** | 1462 | /** |
| 994 | * struct ec_params_flash_erase - Parameters for the flash erase command. | 1463 | * struct ec_params_flash_erase - Parameters for the flash erase command, v0. |
| 995 | * @offset: Byte offset to erase. | 1464 | * @offset: Byte offset to erase. |
| 996 | * @size: Size to erase in bytes. | 1465 | * @size: Size to erase in bytes. |
| 997 | */ | 1466 | */ |
| 998 | struct ec_params_flash_erase { | 1467 | struct ec_params_flash_erase { |
| 999 | uint32_t offset; | 1468 | uint32_t offset; |
| 1000 | uint32_t size; | 1469 | uint32_t size; |
| 1001 | } __packed; | 1470 | } __ec_align4; |
| 1471 | |||
| 1472 | /* | ||
| 1473 | * v1 add async erase: | ||
| 1474 | * subcommands can returns: | ||
| 1475 | * EC_RES_SUCCESS : erased (see ERASE_SECTOR_ASYNC case below). | ||
| 1476 | * EC_RES_INVALID_PARAM : offset/size are not aligned on a erase boundary. | ||
| 1477 | * EC_RES_ERROR : other errors. | ||
| 1478 | * EC_RES_BUSY : an existing erase operation is in progress. | ||
| 1479 | * EC_RES_ACCESS_DENIED: Trying to erase running image. | ||
| 1480 | * | ||
| 1481 | * When ERASE_SECTOR_ASYNC returns EC_RES_SUCCESS, the operation is just | ||
| 1482 | * properly queued. The user must call ERASE_GET_RESULT subcommand to get | ||
| 1483 | * the proper result. | ||
| 1484 | * When ERASE_GET_RESULT returns EC_RES_BUSY, the caller must wait and send | ||
| 1485 | * ERASE_GET_RESULT again to get the result of ERASE_SECTOR_ASYNC. | ||
| 1486 | * ERASE_GET_RESULT command may timeout on EC where flash access is not | ||
| 1487 | * permitted while erasing. (For instance, STM32F4). | ||
| 1488 | */ | ||
| 1489 | enum ec_flash_erase_cmd { | ||
| 1490 | FLASH_ERASE_SECTOR, /* Erase and wait for result */ | ||
| 1491 | FLASH_ERASE_SECTOR_ASYNC, /* Erase and return immediately. */ | ||
| 1492 | FLASH_ERASE_GET_RESULT, /* Ask for last erase result */ | ||
| 1493 | }; | ||
| 1494 | |||
| 1495 | /** | ||
| 1496 | * struct ec_params_flash_erase_v1 - Parameters for the flash erase command, v1. | ||
| 1497 | * @cmd: One of ec_flash_erase_cmd. | ||
| 1498 | * @reserved: Pad byte; currently always contains 0. | ||
| 1499 | * @flag: No flags defined yet; set to 0. | ||
| 1500 | * @params: Same as v0 parameters. | ||
| 1501 | */ | ||
| 1502 | struct ec_params_flash_erase_v1 { | ||
| 1503 | uint8_t cmd; | ||
| 1504 | uint8_t reserved; | ||
| 1505 | uint16_t flag; | ||
| 1506 | struct ec_params_flash_erase params; | ||
| 1507 | } __ec_align4; | ||
| 1002 | 1508 | ||
| 1003 | /* | 1509 | /* |
| 1004 | * Get/set flash protection. | 1510 | * Get/set flash protection. |
| @@ -1010,31 +1516,40 @@ struct ec_params_flash_erase { · 5 unmodified lines | |||
| 1010 | * | 1516 | * |
| 1011 | * If mask=0, simply returns the current flags state. | 1517 | * If mask=0, simply returns the current flags state. |
| 1012 | */ | 1518 | */ |
| 1013 | #define EC_CMD_FLASH_PROTECT 0x15 | 1519 | #define EC_CMD_FLASH_PROTECT 0x0015 |
| 1014 | #define EC_VER_FLASH_PROTECT 1 /* Command version 1 */ | 1520 | #define EC_VER_FLASH_PROTECT 1 /* Command version 1 */ |
| 1015 | 1521 | ||
| 1016 | /* Flags for flash protection */ | 1522 | /* Flags for flash protection */ |
| 1017 | /* RO flash code protected when the EC boots */ | 1523 | /* RO flash code protected when the EC boots */ |
| 1018 | #define EC_FLASH_PROTECT_RO_AT_BOOT (1 << 0) | 1524 | #define EC_FLASH_PROTECT_RO_AT_BOOT BIT(0) |
| 1019 | /* | 1525 | /* |
| 1020 | * RO flash code protected now. If this bit is set, at-boot status cannot | 1526 | * RO flash code protected now. If this bit is set, at-boot status cannot |
| 1021 | * be changed. | 1527 | * be changed. |
| 1022 | */ | 1528 | */ |
| 1023 | #define EC_FLASH_PROTECT_RO_NOW (1 << 1) | 1529 | #define EC_FLASH_PROTECT_RO_NOW BIT(1) |
| 1024 | /* Entire flash code protected now, until reboot. */ | 1530 | /* Entire flash code protected now, until reboot. */ |
| 1025 | #define EC_FLASH_PROTECT_ALL_NOW (1 << 2) | 1531 | #define EC_FLASH_PROTECT_ALL_NOW BIT(2) |
| 1026 | /* Flash write protect GPIO is asserted now */ | 1532 | /* Flash write protect GPIO is asserted now */ |
| 1027 | #define EC_FLASH_PROTECT_GPIO_ASSERTED (1 << 3) | 1533 | #define EC_FLASH_PROTECT_GPIO_ASSERTED BIT(3) |
| 1028 | /* Error - at least one bank of flash is stuck locked, and cannot be unlocked */ | 1534 | /* Error - at least one bank of flash is stuck locked, and cannot be unlocked */ |
| 1029 | #define EC_FLASH_PROTECT_ERROR_STUCK (1 << 4) | 1535 | #define EC_FLASH_PROTECT_ERROR_STUCK BIT(4) |
| 1030 | /* | 1536 | /* |
| 1031 | * Error - flash protection is in inconsistent state. At least one bank of | 1537 | * Error - flash protection is in inconsistent state. At least one bank of |
| 1032 | * flash which should be protected is not protected. Usually fixed by | 1538 | * flash which should be protected is not protected. Usually fixed by |
| 1033 | * re-requesting the desired flags, or by a hard reset if that fails. | 1539 | * re-requesting the desired flags, or by a hard reset if that fails. |
| 1034 | */ | 1540 | */ |
| 1035 | #define EC_FLASH_PROTECT_ERROR_INCONSISTENT (1 << 5) | 1541 | #define EC_FLASH_PROTECT_ERROR_INCONSISTENT BIT(5) |
| 1036 | /* Entile flash code protected when the EC boots */ | 1542 | /* Entire flash code protected when the EC boots */ |
| 1037 | #define EC_FLASH_PROTECT_ALL_AT_BOOT (1 << 6) | 1543 | #define EC_FLASH_PROTECT_ALL_AT_BOOT BIT(6) |
| 1544 | /* RW flash code protected when the EC boots */ | ||
| 1545 | #define EC_FLASH_PROTECT_RW_AT_BOOT BIT(7) | ||
| 1546 | /* RW flash code protected now. */ | ||
| 1547 | #define EC_FLASH_PROTECT_RW_NOW BIT(8) | ||
| 1548 | /* Rollback information flash region protected when the EC boots */ | ||
| 1549 | #define EC_FLASH_PROTECT_ROLLBACK_AT_BOOT BIT(9) | ||
| 1550 | /* Rollback information flash region protected now */ | ||
| 1551 | #define EC_FLASH_PROTECT_ROLLBACK_NOW BIT(10) | ||
| 1552 | |||
| 1038 | 1553 | ||
| 1039 | /** | 1554 | /** |
| 1040 | * struct ec_params_flash_protect - Parameters for the flash protect command. | 1555 | * struct ec_params_flash_protect - Parameters for the flash protect command. |
| @@ -1044,7 +1559,7 @@ struct ec_params_flash_erase { · 3 unmodified lines | |||
| 1044 | struct ec_params_flash_protect { | 1559 | struct ec_params_flash_protect { |
| 1045 | uint32_t mask; | 1560 | uint32_t mask; |
| 1046 | uint32_t flags; | 1561 | uint32_t flags; |
| 1047 | } __packed; | 1562 | } __ec_align4; |
| 1048 | 1563 | ||
| 1049 | /** | 1564 | /** |
| 1050 | * struct ec_response_flash_protect - Response to the flash protect command. | 1565 | * struct ec_response_flash_protect - Response to the flash protect command. |
| @@ -1059,7 +1574,7 @@ struct ec_response_flash_protect { · 8 unmodified lines | |||
| 1059 | uint32_t flags; | 1574 | uint32_t flags; |
| 1060 | uint32_t valid_flags; | 1575 | uint32_t valid_flags; |
| 1061 | uint32_t writable_flags; | 1576 | uint32_t writable_flags; |
| 1062 | } __packed; | 1577 | } __ec_align4; |
| 1063 | 1578 | ||
| 1064 | /* | 1579 | /* |
| 1065 | * Note: commands 0x14 - 0x19 version 0 were old commands to get/set flash | 1580 | * Note: commands 0x14 - 0x19 version 0 were old commands to get/set flash |
| @@ -1067,22 +1582,37 @@ struct ec_response_flash_protect { · 1 unmodified line | |||
| 1067 | */ | 1582 | */ |
| 1068 | 1583 | ||
| 1069 | /* Get the region offset/size */ | 1584 | /* Get the region offset/size */ |
| 1070 | #define EC_CMD_FLASH_REGION_INFO 0x16 | 1585 | #define EC_CMD_FLASH_REGION_INFO 0x0016 |
| 1071 | #define EC_VER_FLASH_REGION_INFO 1 | 1586 | #define EC_VER_FLASH_REGION_INFO 1 |
| 1072 | 1587 | ||
| 1073 | enum ec_flash_region { | 1588 | enum ec_flash_region { |
| 1074 | /* Region which holds read-only EC image */ | 1589 | /* Region which holds read-only EC image */ |
| 1075 | EC_FLASH_REGION_RO = 0, | 1590 | EC_FLASH_REGION_RO = 0, |
| 1076 | /* Region which holds rewritable EC image */ | 1591 | /* |
| 1077 | EC_FLASH_REGION_RW, | 1592 | * Region which holds active RW image. 'Active' is different from |
| 1593 | * 'running'. Active means 'scheduled-to-run'. Since RO image always | ||
| 1594 | * scheduled to run, active/non-active applies only to RW images (for | ||
| 1595 | * the same reason 'update' applies only to RW images. It's a state of | ||
| 1596 | * an image on a flash. Running image can be RO, RW_A, RW_B but active | ||
| 1597 | * image can only be RW_A or RW_B. In recovery mode, an active RW image | ||
| 1598 | * doesn't enter 'running' state but it's still active on a flash. | ||
| 1599 | */ | ||
| 1600 | EC_FLASH_REGION_ACTIVE, | ||
| 1078 | /* | 1601 | /* |
| 1079 | * Region which should be write-protected in the factory (a superset of | 1602 | * Region which should be write-protected in the factory (a superset of |
| 1080 | * EC_FLASH_REGION_RO) | 1603 | * EC_FLASH_REGION_RO) |
| 1081 | */ | 1604 | */ |
| 1082 | EC_FLASH_REGION_WP_RO, | 1605 | EC_FLASH_REGION_WP_RO, |
| 1606 | /* Region which holds updatable (non-active) RW image */ | ||
| 1607 | EC_FLASH_REGION_UPDATE, | ||
| 1083 | /* Number of regions */ | 1608 | /* Number of regions */ |
| 1084 | EC_FLASH_REGION_COUNT, | 1609 | EC_FLASH_REGION_COUNT, |
| 1085 | }; | 1610 | }; |
| 1611 | /* | ||
| 1612 | * 'RW' is vague if there are multiple RW images; we mean the active one, | ||
| 1613 | * so the old constant is deprecated. | ||
| 1614 | */ | ||
| 1615 | #define EC_FLASH_REGION_RW EC_FLASH_REGION_ACTIVE | ||
| 1086 | 1616 | ||
| 1087 | /** | 1617 | /** |
| 1088 | * struct ec_params_flash_region_info - Parameters for the flash region info | 1618 | * struct ec_params_flash_region_info - Parameters for the flash region info |
| @@ -1091,15 +1621,15 @@ enum ec_flash_region { · 2 unmodified lines | |||
| 1091 | */ | 1621 | */ |
| 1092 | struct ec_params_flash_region_info { | 1622 | struct ec_params_flash_region_info { |
| 1093 | uint32_t region; | 1623 | uint32_t region; |
| 1094 | } __packed; | 1624 | } __ec_align4; |
| 1095 | 1625 | ||
| 1096 | struct ec_response_flash_region_info { | 1626 | struct ec_response_flash_region_info { |
| 1097 | uint32_t offset; | 1627 | uint32_t offset; |
| 1098 | uint32_t size; | 1628 | uint32_t size; |
| 1099 | } __packed; | 1629 | } __ec_align4; |
| 1100 | 1630 | ||
| 1101 | /* Read/write VbNvContext */ | 1631 | /* Read/write VbNvContext */ |
| 1102 | #define EC_CMD_VBNV_CONTEXT 0x17 | 1632 | #define EC_CMD_VBNV_CONTEXT 0x0017 |
| 1103 | #define EC_VER_VBNV_CONTEXT 1 | 1633 | #define EC_VER_VBNV_CONTEXT 1 |
| 1104 | #define EC_VBNV_BLOCK_SIZE 16 | 1634 | #define EC_VBNV_BLOCK_SIZE 16 |
| 1105 | 1635 | ||
| @@ -1111,52 +1641,99 @@ enum ec_vbnvcontext_op { · 5 unmodified lines | |||
| 1111 | struct ec_params_vbnvcontext { | 1641 | struct ec_params_vbnvcontext { |
| 1112 | uint32_t op; | 1642 | uint32_t op; |
| 1113 | uint8_t block[EC_VBNV_BLOCK_SIZE]; | 1643 | uint8_t block[EC_VBNV_BLOCK_SIZE]; |
| 1114 | } __packed; | 1644 | } __ec_align4; |
| 1115 | 1645 | ||
| 1116 | struct ec_response_vbnvcontext { | 1646 | struct ec_response_vbnvcontext { |
| 1117 | uint8_t block[EC_VBNV_BLOCK_SIZE]; | 1647 | uint8_t block[EC_VBNV_BLOCK_SIZE]; |
| 1118 | } __packed; | 1648 | } __ec_align4; |
| 1649 | |||
| 1650 | |||
| 1651 | /* Get SPI flash information */ | ||
| 1652 | #define EC_CMD_FLASH_SPI_INFO 0x0018 | ||
| 1653 | |||
| 1654 | struct ec_response_flash_spi_info { | ||
| 1655 | /* JEDEC info from command 0x9F (manufacturer, memory type, size) */ | ||
| 1656 | uint8_t jedec[3]; | ||
| 1657 | |||
| 1658 | /* Pad byte; currently always contains 0 */ | ||
| 1659 | uint8_t reserved0; | ||
| 1660 | |||
| 1661 | /* Manufacturer / device ID from command 0x90 */ | ||
| 1662 | uint8_t mfr_dev_id[2]; | ||
| 1663 | |||
| 1664 | /* Status registers from command 0x05 and 0x35 */ | ||
| 1665 | uint8_t sr1, sr2; | ||
| 1666 | } __ec_align1; | ||
| 1667 | |||
| 1668 | |||
| 1669 | /* Select flash during flash operations */ | ||
| 1670 | #define EC_CMD_FLASH_SELECT 0x0019 | ||
| 1671 | |||
| 1672 | /** | ||
| 1673 | * struct ec_params_flash_select - Parameters for the flash select command. | ||
| 1674 | * @select: 1 to select flash, 0 to deselect flash | ||
| 1675 | */ | ||
| 1676 | struct ec_params_flash_select { | ||
| 1677 | uint8_t select; | ||
| 1678 | } __ec_align4; | ||
| 1679 | |||
| 1119 | 1680 | ||
| 1120 | /*****************************************************************************/ | 1681 | /*****************************************************************************/ |
| 1121 | /* PWM commands */ | 1682 | /* PWM commands */ |
| 1122 | 1683 | ||
| 1123 | /* Get fan target RPM */ | 1684 | /* Get fan target RPM */ |
| 1124 | #define EC_CMD_PWM_GET_FAN_TARGET_RPM 0x20 | 1685 | #define EC_CMD_PWM_GET_FAN_TARGET_RPM 0x0020 |
| 1125 | 1686 | ||
| 1126 | struct ec_response_pwm_get_fan_rpm { | 1687 | struct ec_response_pwm_get_fan_rpm { |
| 1127 | uint32_t rpm; | 1688 | uint32_t rpm; |
| 1128 | } __packed; | 1689 | } __ec_align4; |
| 1129 | 1690 | ||
| 1130 | /* Set target fan RPM */ | 1691 | /* Set target fan RPM */ |
| 1131 | #define EC_CMD_PWM_SET_FAN_TARGET_RPM 0x21 | 1692 | #define EC_CMD_PWM_SET_FAN_TARGET_RPM 0x0021 |
| 1693 | |||
| 1694 | /* Version 0 of input params */ | ||
| 1695 | struct ec_params_pwm_set_fan_target_rpm_v0 { | ||
| 1696 | uint32_t rpm; | ||
| 1697 | } __ec_align4; | ||
| 1132 | 1698 | ||
| 1133 | struct ec_params_pwm_set_fan_target_rpm { | 1699 | /* Version 1 of input params */ |
| 1700 | struct ec_params_pwm_set_fan_target_rpm_v1 { | ||
| 1134 | uint32_t rpm; | 1701 | uint32_t rpm; |
| 1135 | } __packed; | 1702 | uint8_t fan_idx; |
| 1703 | } __ec_align_size1; | ||
| 1136 | 1704 | ||
| 1137 | /* Get keyboard backlight */ | 1705 | /* Get keyboard backlight */ |
| 1138 | #define EC_CMD_PWM_GET_KEYBOARD_BACKLIGHT 0x22 | 1706 | /* OBSOLETE - Use EC_CMD_PWM_SET_DUTY */ |
| 1707 | #define EC_CMD_PWM_GET_KEYBOARD_BACKLIGHT 0x0022 | ||
| 1139 | 1708 | ||
| 1140 | struct ec_response_pwm_get_keyboard_backlight { | 1709 | struct ec_response_pwm_get_keyboard_backlight { |
| 1141 | uint8_t percent; | 1710 | uint8_t percent; |
| 1142 | uint8_t enabled; | 1711 | uint8_t enabled; |
| 1143 | } __packed; | 1712 | } __ec_align1; |
| 1144 | 1713 | ||
| 1145 | /* Set keyboard backlight */ | 1714 | /* Set keyboard backlight */ |
| 1146 | #define EC_CMD_PWM_SET_KEYBOARD_BACKLIGHT 0x23 | 1715 | /* OBSOLETE - Use EC_CMD_PWM_SET_DUTY */ |
| 1716 | #define EC_CMD_PWM_SET_KEYBOARD_BACKLIGHT 0x0023 | ||
| 1147 | 1717 | ||
| 1148 | struct ec_params_pwm_set_keyboard_backlight { | 1718 | struct ec_params_pwm_set_keyboard_backlight { |
| 1149 | uint8_t percent; | 1719 | uint8_t percent; |
| 1150 | } __packed; | 1720 | } __ec_align1; |
| 1151 | 1721 | ||
| 1152 | /* Set target fan PWM duty cycle */ | 1722 | /* Set target fan PWM duty cycle */ |
| 1153 | #define EC_CMD_PWM_SET_FAN_DUTY 0x24 | 1723 | #define EC_CMD_PWM_SET_FAN_DUTY 0x0024 |
| 1724 | |||
| 1725 | /* Version 0 of input params */ | ||
| 1726 | struct ec_params_pwm_set_fan_duty_v0 { | ||
| 1727 | uint32_t percent; | ||
| 1728 | } __ec_align4; | ||
| 1154 | 1729 | ||
| 1155 | struct ec_params_pwm_set_fan_duty { | 1730 | /* Version 1 of input params */ |
| 1731 | struct ec_params_pwm_set_fan_duty_v1 { | ||
| 1156 | uint32_t percent; | 1732 | uint32_t percent; |
| 1157 | } __packed; | 1733 | uint8_t fan_idx; |
| 1734 | } __ec_align_size1; | ||
| 1158 | 1735 | ||
| 1159 | #define EC_CMD_PWM_SET_DUTY 0x25 | 1736 | #define EC_CMD_PWM_SET_DUTY 0x0025 |
| 1160 | /* 16 bit duty cycle, 0xffff = 100% */ | 1737 | /* 16 bit duty cycle, 0xffff = 100% */ |
| 1161 | #define EC_PWM_MAX_DUTY 0xffff | 1738 | #define EC_PWM_MAX_DUTY 0xffff |
| 1162 | 1739 | ||
| @@ -1174,18 +1751,18 @@ struct ec_params_pwm_set_duty { · 11 unmodified lines | |||
| 1174 | uint16_t duty; /* Duty cycle, EC_PWM_MAX_DUTY = 100% */ | 1751 | uint16_t duty; /* Duty cycle, EC_PWM_MAX_DUTY = 100% */ |
| 1175 | uint8_t pwm_type; /* ec_pwm_type */ | 1752 | uint8_t pwm_type; /* ec_pwm_type */ |
| 1176 | uint8_t index; /* Type-specific index, or 0 if unique */ | 1753 | uint8_t index; /* Type-specific index, or 0 if unique */ |
| 1177 | } __packed; | 1754 | } __ec_align4; |
| 1178 | 1755 | ||
| 1179 | #define EC_CMD_PWM_GET_DUTY 0x26 | 1756 | #define EC_CMD_PWM_GET_DUTY 0x0026 |
| 1180 | 1757 | ||
| 1181 | struct ec_params_pwm_get_duty { | 1758 | struct ec_params_pwm_get_duty { |
| 1182 | uint8_t pwm_type; /* ec_pwm_type */ | 1759 | uint8_t pwm_type; /* ec_pwm_type */ |
| 1183 | uint8_t index; /* Type-specific index, or 0 if unique */ | 1760 | uint8_t index; /* Type-specific index, or 0 if unique */ |
| 1184 | } __packed; | 1761 | } __ec_align1; |
| 1185 | 1762 | ||
| 1186 | struct ec_response_pwm_get_duty { | 1763 | struct ec_response_pwm_get_duty { |
| 1187 | uint16_t duty; /* Duty cycle, EC_PWM_MAX_DUTY = 100% */ | 1764 | uint16_t duty; /* Duty cycle, EC_PWM_MAX_DUTY = 100% */ |
| 1188 | } __packed; | 1765 | } __ec_align2; |
| 1189 | 1766 | ||
| 1190 | /*****************************************************************************/ | 1767 | /*****************************************************************************/ |
| 1191 | /* | 1768 | /* |
| @@ -1194,11 +1771,11 @@ struct ec_response_pwm_get_duty { · 2 unmodified lines | |||
| 1194 | * into a subcommand. We'll make separate structs for subcommands with | 1771 | * into a subcommand. We'll make separate structs for subcommands with |
| 1195 | * different input args, so that we know how much to expect. | 1772 | * different input args, so that we know how much to expect. |
| 1196 | */ | 1773 | */ |
| 1197 | #define EC_CMD_LIGHTBAR_CMD 0x28 | 1774 | #define EC_CMD_LIGHTBAR_CMD 0x0028 |
| 1198 | 1775 | ||
| 1199 | struct rgb_s { | 1776 | struct rgb_s { |
| 1200 | uint8_t r, g, b; | 1777 | uint8_t r, g, b; |
| 1201 | }; | 1778 | } __ec_todo_unpacked; |
| 1202 | 1779 | ||
| 1203 | #define LB_BATTERY_LEVELS 4 | 1780 | #define LB_BATTERY_LEVELS 4 |
| 1204 | 1781 | ||
| @@ -1238,7 +1815,7 @@ struct lightbar_params_v0 { · 33 unmodified lines | |||
| 1238 | 1815 | ||
| 1239 | /* Color palette */ | 1816 | /* Color palette */ |
| 1240 | struct rgb_s color[8]; /* 0-3 are Google colors */ | 1817 | struct rgb_s color[8]; /* 0-3 are Google colors */ |
| 1241 | } __packed; | 1818 | } __ec_todo_packed; |
| 1242 | 1819 | ||
| 1243 | struct lightbar_params_v1 { | 1820 | struct lightbar_params_v1 { |
| 1244 | /* Timing */ | 1821 | /* Timing */ |
| @@ -1251,7 +1828,10 @@ struct lightbar_params_v1 { · 6 unmodified lines | |||
| 1251 | int32_t s3_sleep_for; | 1828 | int32_t s3_sleep_for; |
| 1252 | int32_t s3_ramp_up; | 1829 | int32_t s3_ramp_up; |
| 1253 | int32_t s3_ramp_down; | 1830 | int32_t s3_ramp_down; |
| 1831 | int32_t s5_ramp_up; | ||
| 1832 | int32_t s5_ramp_down; | ||
| 1254 | int32_t tap_tick_delay; | 1833 | int32_t tap_tick_delay; |
| 1834 | int32_t tap_gate_delay; | ||
| 1255 | int32_t tap_display_time; | 1835 | int32_t tap_display_time; |
| 1256 | 1836 | ||
| 1257 | /* Tap-for-battery params */ | 1837 | /* Tap-for-battery params */ |
| @@ -1279,84 +1859,182 @@ struct lightbar_params_v1 { · 21 unmodified lines | |||
| 1279 | uint8_t s0_idx[2][LB_BATTERY_LEVELS]; /* AP is running */ | 1859 | uint8_t s0_idx[2][LB_BATTERY_LEVELS]; /* AP is running */ |
| 1280 | uint8_t s3_idx[2][LB_BATTERY_LEVELS]; /* AP is sleeping */ | 1860 | uint8_t s3_idx[2][LB_BATTERY_LEVELS]; /* AP is sleeping */ |
| 1281 | 1861 | ||
| 1862 | /* s5: single color pulse on inhibited power-up */ | ||
| 1863 | uint8_t s5_idx; | ||
| 1864 | |||
| 1282 | /* Color palette */ | 1865 | /* Color palette */ |
| 1283 | struct rgb_s color[8]; /* 0-3 are Google colors */ | 1866 | struct rgb_s color[8]; /* 0-3 are Google colors */ |
| 1284 | } __packed; | 1867 | } __ec_todo_packed; |
| 1285 | 1868 | ||
| 1286 | /* Lightbar program */ | 1869 | /* Lightbar command params v2 |
| 1287 | #define EC_LB_PROG_LEN 192 | 1870 | * crbug.com/467716 |
| 1871 | * | ||
| 1872 | * lightbar_parms_v1 was too big for i2c, therefore in v2, we split them up by | ||
| 1873 | * logical groups to make it more manageable ( < 120 bytes). | ||
| 1874 | * | ||
| 1875 | * NOTE: Each of these groups must be less than 120 bytes. | ||
| 1876 | */ | ||
| 1877 | |||
| 1878 | struct lightbar_params_v2_timing { | ||
| 1879 | /* Timing */ | ||
| 1880 | int32_t google_ramp_up; | ||
| 1881 | int32_t google_ramp_down; | ||
| 1882 | int32_t s3s0_ramp_up; | ||
| 1883 | int32_t s0_tick_delay[2]; /* AC=0/1 */ | ||
| 1884 | int32_t s0a_tick_delay[2]; /* AC=0/1 */ | ||
| 1885 | int32_t s0s3_ramp_down; | ||
| 1886 | int32_t s3_sleep_for; | ||
| 1887 | int32_t s3_ramp_up; | ||
| 1888 | int32_t s3_ramp_down; | ||
| 1889 | int32_t s5_ramp_up; | ||
| 1890 | int32_t s5_ramp_down; | ||
| 1891 | int32_t tap_tick_delay; | ||
| 1892 | int32_t tap_gate_delay; | ||
| 1893 | int32_t tap_display_time; | ||
| 1894 | } __ec_todo_packed; | ||
| 1895 | |||
| 1896 | struct lightbar_params_v2_tap { | ||
| 1897 | /* Tap-for-battery params */ | ||
| 1898 | uint8_t tap_pct_red; | ||
| 1899 | uint8_t tap_pct_green; | ||
| 1900 | uint8_t tap_seg_min_on; | ||
| 1901 | uint8_t tap_seg_max_on; | ||
| 1902 | uint8_t tap_seg_osc; | ||
| 1903 | uint8_t tap_idx[3]; | ||
| 1904 | } __ec_todo_packed; | ||
| 1905 | |||
| 1906 | struct lightbar_params_v2_oscillation { | ||
| 1907 | /* Oscillation */ | ||
| 1908 | uint8_t osc_min[2]; /* AC=0/1 */ | ||
| 1909 | uint8_t osc_max[2]; /* AC=0/1 */ | ||
| 1910 | uint8_t w_ofs[2]; /* AC=0/1 */ | ||
| 1911 | } __ec_todo_packed; | ||
| 1912 | |||
| 1913 | struct lightbar_params_v2_brightness { | ||
| 1914 | /* Brightness limits based on the backlight and AC. */ | ||
| 1915 | uint8_t bright_bl_off_fixed[2]; /* AC=0/1 */ | ||
| 1916 | uint8_t bright_bl_on_min[2]; /* AC=0/1 */ | ||
| 1917 | uint8_t bright_bl_on_max[2]; /* AC=0/1 */ | ||
| 1918 | } __ec_todo_packed; | ||
| 1919 | |||
| 1920 | struct lightbar_params_v2_thresholds { | ||
| 1921 | /* Battery level thresholds */ | ||
| 1922 | uint8_t battery_threshold[LB_BATTERY_LEVELS - 1]; | ||
| 1923 | } __ec_todo_packed; | ||
| 1924 | |||
| 1925 | struct lightbar_params_v2_colors { | ||
| 1926 | /* Map [AC][battery_level] to color index */ | ||
| 1927 | uint8_t s0_idx[2][LB_BATTERY_LEVELS]; /* AP is running */ | ||
| 1928 | uint8_t s3_idx[2][LB_BATTERY_LEVELS]; /* AP is sleeping */ | ||
| 1929 | |||
| 1930 | /* s5: single color pulse on inhibited power-up */ | ||
| 1931 | uint8_t s5_idx; | ||
| 1932 | |||
| 1933 | /* Color palette */ | ||
| 1934 | struct rgb_s color[8]; /* 0-3 are Google colors */ | ||
| 1935 | } __ec_todo_packed; | ||
| 1936 | |||
| 1937 | /* Lightbar program. */ | ||
| 1938 | #define EC_LB_PROG_LEN 192 | ||
| 1288 | struct lightbar_program { | 1939 | struct lightbar_program { |
| 1289 | uint8_t size; | 1940 | uint8_t size; |
| 1290 | uint8_t data[EC_LB_PROG_LEN]; | 1941 | uint8_t data[EC_LB_PROG_LEN]; |
| 1291 | }; | 1942 | } __ec_todo_unpacked; |
| 1292 | 1943 | ||
| 1293 | struct ec_params_lightbar { | 1944 | struct ec_params_lightbar { |
| 1294 | uint8_t cmd; /* Command (see enum lightbar_command) */ | 1945 | uint8_t cmd; /* Command (see enum lightbar_command) */ |
| 1295 | union { | 1946 | union { |
| 1296 | struct { | 1947 | /* |
| 1297 | /* no args */ | 1948 | * The following commands have no args: |
| 1298 | } dump, off, on, init, get_seq, get_params_v0, get_params_v1, | 1949 | * |
| 1299 | version, get_brightness, get_demo, suspend, resume; | 1950 | * dump, off, on, init, get_seq, get_params_v0, get_params_v1, |
| 1951 | * version, get_brightness, get_demo, suspend, resume, | ||
| 1952 | * get_params_v2_timing, get_params_v2_tap, get_params_v2_osc, | ||
| 1953 | * get_params_v2_bright, get_params_v2_thlds, | ||
| 1954 | * get_params_v2_colors | ||
| 1955 | * | ||
| 1956 | * Don't use an empty struct, because C++ hates that. | ||
| 1957 | */ | ||
| 1300 | 1958 | ||
| 1301 | struct { | 1959 | struct __ec_todo_unpacked { |
| 1302 | uint8_t num; | 1960 | uint8_t num; |
| 1303 | } set_brightness, seq, demo; | 1961 | } set_brightness, seq, demo; |
| 1304 | 1962 | ||
| 1305 | struct { | 1963 | struct __ec_todo_unpacked { |
| 1306 | uint8_t ctrl, reg, value; | 1964 | uint8_t ctrl, reg, value; |
| 1307 | } reg; | 1965 | } reg; |
| 1308 | 1966 | ||
| 1309 | struct { | 1967 | struct __ec_todo_unpacked { |
| 1310 | uint8_t led, red, green, blue; | 1968 | uint8_t led, red, green, blue; |
| 1311 | } set_rgb; | 1969 | } set_rgb; |
| 1312 | 1970 | ||
| 1313 | struct { | 1971 | struct __ec_todo_unpacked { |
| 1314 | uint8_t led; | 1972 | uint8_t led; |
| 1315 | } get_rgb; | 1973 | } get_rgb; |
| 1316 | 1974 | ||
| 1317 | struct { | 1975 | struct __ec_todo_unpacked { |
| 1318 | uint8_t enable; | 1976 | uint8_t enable; |
| 1319 | } manual_suspend_ctrl; | 1977 | } manual_suspend_ctrl; |
| 1320 | 1978 | ||
| 1321 | struct lightbar_params_v0 set_params_v0; | 1979 | struct lightbar_params_v0 set_params_v0; |
| 1322 | struct lightbar_params_v1 set_params_v1; | 1980 | struct lightbar_params_v1 set_params_v1; |
| 1981 | |||
| 1982 | struct lightbar_params_v2_timing set_v2par_timing; | ||
| 1983 | struct lightbar_params_v2_tap set_v2par_tap; | ||
| 1984 | struct lightbar_params_v2_oscillation set_v2par_osc; | ||
| 1985 | struct lightbar_params_v2_brightness set_v2par_bright; | ||
| 1986 | struct lightbar_params_v2_thresholds set_v2par_thlds; | ||
| 1987 | struct lightbar_params_v2_colors set_v2par_colors; | ||
| 1988 | |||
| 1323 | struct lightbar_program set_program; | 1989 | struct lightbar_program set_program; |
| 1324 | }; | 1990 | }; |
| 1325 | } __packed; | 1991 | } __ec_todo_packed; |
| 1326 | 1992 | ||
| 1327 | struct ec_response_lightbar { | 1993 | struct ec_response_lightbar { |
| 1328 | union { | 1994 | union { |
| 1329 | struct { | 1995 | struct __ec_todo_unpacked { |
| 1330 | struct { | 1996 | struct __ec_todo_unpacked { |
| 1331 | uint8_t reg; | 1997 | uint8_t reg; |
| 1332 | uint8_t ic0; | 1998 | uint8_t ic0; |
| 1333 | uint8_t ic1; | 1999 | uint8_t ic1; |
| 1334 | } vals[23]; | 2000 | } vals[23]; |
| 1335 | } dump; | 2001 | } dump; |
| 1336 | 2002 | ||
| 1337 | struct { | 2003 | struct __ec_todo_unpacked { |
| 1338 | uint8_t num; | 2004 | uint8_t num; |
| 1339 | } get_seq, get_brightness, get_demo; | 2005 | } get_seq, get_brightness, get_demo; |
| 1340 | 2006 | ||
| 1341 | struct lightbar_params_v0 get_params_v0; | 2007 | struct lightbar_params_v0 get_params_v0; |
| 1342 | struct lightbar_params_v1 get_params_v1; | 2008 | struct lightbar_params_v1 get_params_v1; |
| 1343 | 2009 | ||
| 1344 | struct { | 2010 | |
| 2011 | struct lightbar_params_v2_timing get_params_v2_timing; | ||
| 2012 | struct lightbar_params_v2_tap get_params_v2_tap; | ||
| 2013 | struct lightbar_params_v2_oscillation get_params_v2_osc; | ||
| 2014 | struct lightbar_params_v2_brightness get_params_v2_bright; | ||
| 2015 | struct lightbar_params_v2_thresholds get_params_v2_thlds; | ||
| 2016 | struct lightbar_params_v2_colors get_params_v2_colors; | ||
| 2017 | |||
| 2018 | struct __ec_todo_unpacked { | ||
| 1345 | uint32_t num; | 2019 | uint32_t num; |
| 1346 | uint32_t flags; | 2020 | uint32_t flags; |
| 1347 | } version; | 2021 | } version; |
| 1348 | 2022 | ||
| 1349 | struct { | 2023 | struct __ec_todo_unpacked { |
| 1350 | uint8_t red, green, blue; | 2024 | uint8_t red, green, blue; |
| 1351 | } get_rgb; | 2025 | } get_rgb; |
| 1352 | 2026 | ||
| 1353 | struct { | 2027 | /* |
| 1354 | /* no return params */ | 2028 | * The following commands have no response: |
| 1355 | } off, on, init, set_brightness, seq, reg, set_rgb, | 2029 | * |
| 1356 | demo, set_params_v0, set_params_v1, | 2030 | * off, on, init, set_brightness, seq, reg, set_rgb, demo, |
| 1357 | set_program, manual_suspend_ctrl, suspend, resume; | 2031 | * set_params_v0, set_params_v1, set_program, |
| 2032 | * manual_suspend_ctrl, suspend, resume, set_v2par_timing, | ||
| 2033 | * set_v2par_tap, set_v2par_osc, set_v2par_bright, | ||
| 2034 | * set_v2par_thlds, set_v2par_colors | ||
| 2035 | */ | ||
| 1358 | }; | 2036 | }; |
| 1359 | } __packed; | 2037 | } __ec_todo_packed; |
| 1360 | 2038 | ||
| 1361 | /* Lightbar commands */ | 2039 | /* Lightbar commands */ |
| 1362 | enum lightbar_command { | 2040 | enum lightbar_command { |
| @@ -1382,13 +2060,25 @@ enum lightbar_command { · 19 unmodified lines | |||
| 1382 | LIGHTBAR_CMD_MANUAL_SUSPEND_CTRL = 19, | 2060 | LIGHTBAR_CMD_MANUAL_SUSPEND_CTRL = 19, |
| 1383 | LIGHTBAR_CMD_SUSPEND = 20, | 2061 | LIGHTBAR_CMD_SUSPEND = 20, |
| 1384 | LIGHTBAR_CMD_RESUME = 21, | 2062 | LIGHTBAR_CMD_RESUME = 21, |
| 2063 | LIGHTBAR_CMD_GET_PARAMS_V2_TIMING = 22, | ||
| 2064 | LIGHTBAR_CMD_SET_PARAMS_V2_TIMING = 23, | ||
| 2065 | LIGHTBAR_CMD_GET_PARAMS_V2_TAP = 24, | ||
| 2066 | LIGHTBAR_CMD_SET_PARAMS_V2_TAP = 25, | ||
| 2067 | LIGHTBAR_CMD_GET_PARAMS_V2_OSCILLATION = 26, | ||
| 2068 | LIGHTBAR_CMD_SET_PARAMS_V2_OSCILLATION = 27, | ||
| 2069 | LIGHTBAR_CMD_GET_PARAMS_V2_BRIGHTNESS = 28, | ||
| 2070 | LIGHTBAR_CMD_SET_PARAMS_V2_BRIGHTNESS = 29, | ||
| 2071 | LIGHTBAR_CMD_GET_PARAMS_V2_THRESHOLDS = 30, | ||
| 2072 | LIGHTBAR_CMD_SET_PARAMS_V2_THRESHOLDS = 31, | ||
| 2073 | LIGHTBAR_CMD_GET_PARAMS_V2_COLORS = 32, | ||
| 2074 | LIGHTBAR_CMD_SET_PARAMS_V2_COLORS = 33, | ||
| 1385 | LIGHTBAR_NUM_CMDS | 2075 | LIGHTBAR_NUM_CMDS |
| 1386 | }; | 2076 | }; |
| 1387 | 2077 | ||
| 1388 | /*****************************************************************************/ | 2078 | /*****************************************************************************/ |
| 1389 | /* LED control commands */ | 2079 | /* LED control commands */ |
| 1390 | 2080 | ||
| 1391 | #define EC_CMD_LED_CONTROL 0x29 | 2081 | #define EC_CMD_LED_CONTROL 0x0029 |
| 1392 | 2082 | ||
| 1393 | enum ec_led_id { | 2083 | enum ec_led_id { |
| 1394 | /* LED to indicate battery state of charge */ | 2084 | /* LED to indicate battery state of charge */ |
| @@ -1400,13 +2090,21 @@ enum ec_led_id { · 5 unmodified lines | |||
| 1400 | EC_LED_ID_POWER_LED, | 2090 | EC_LED_ID_POWER_LED, |
| 1401 | /* LED on power adapter or its plug */ | 2091 | /* LED on power adapter or its plug */ |
| 1402 | EC_LED_ID_ADAPTER_LED, | 2092 | EC_LED_ID_ADAPTER_LED, |
| 2093 | /* LED to indicate left side */ | ||
| 2094 | EC_LED_ID_LEFT_LED, | ||
| 2095 | /* LED to indicate right side */ | ||
| 2096 | EC_LED_ID_RIGHT_LED, | ||
| 2097 | /* LED to indicate recovery mode with HW_REINIT */ | ||
| 2098 | EC_LED_ID_RECOVERY_HW_REINIT_LED, | ||
| 2099 | /* LED to indicate sysrq debug mode. */ | ||
| 2100 | EC_LED_ID_SYSRQ_DEBUG_LED, | ||
| 1403 | 2101 | ||
| 1404 | EC_LED_ID_COUNT | 2102 | EC_LED_ID_COUNT |
| 1405 | }; | 2103 | }; |
| 1406 | 2104 | ||
| 1407 | /* LED control flags */ | 2105 | /* LED control flags */ |
| 1408 | #define EC_LED_FLAGS_QUERY (1 << 0) /* Query LED capability only */ | 2106 | #define EC_LED_FLAGS_QUERY BIT(0) /* Query LED capability only */ |
| 1409 | #define EC_LED_FLAGS_AUTO (1 << 1) /* Switch LED back to automatic control */ | 2107 | #define EC_LED_FLAGS_AUTO BIT(1) /* Switch LED back to automatic control */ |
| 1410 | 2108 | ||
| 1411 | enum ec_led_colors { | 2109 | enum ec_led_colors { |
| 1412 | EC_LED_COLOR_RED = 0, | 2110 | EC_LED_COLOR_RED = 0, |
| @@ -1414,6 +2112,7 @@ enum ec_led_colors { · 1 unmodified line | |||
| 1414 | EC_LED_COLOR_BLUE, | 2112 | EC_LED_COLOR_BLUE, |
| 1415 | EC_LED_COLOR_YELLOW, | 2113 | EC_LED_COLOR_YELLOW, |
| 1416 | EC_LED_COLOR_WHITE, | 2114 | EC_LED_COLOR_WHITE, |
| 2115 | EC_LED_COLOR_AMBER, | ||
| 1417 | 2116 | ||
| 1418 | EC_LED_COLOR_COUNT | 2117 | EC_LED_COLOR_COUNT |
| 1419 | }; | 2118 | }; |
| @@ -1423,7 +2122,7 @@ struct ec_params_led_control { · 3 unmodified lines | |||
| 1423 | uint8_t flags; /* Control flags */ | 2122 | uint8_t flags; /* Control flags */ |
| 1424 | 2123 | ||
| 1425 | uint8_t brightness[EC_LED_COLOR_COUNT]; | 2124 | uint8_t brightness[EC_LED_COLOR_COUNT]; |
| 1426 | } __packed; | 2125 | } __ec_align1; |
| 1427 | 2126 | ||
| 1428 | struct ec_response_led_control { | 2127 | struct ec_response_led_control { |
| 1429 | /* | 2128 | /* |
| @@ -1434,7 +2133,7 @@ struct ec_response_led_control { · 4 unmodified lines | |||
| 1434 | * Other values means the LED is control by PWM. | 2133 | * Other values means the LED is control by PWM. |
| 1435 | */ | 2134 | */ |
| 1436 | uint8_t brightness_range[EC_LED_COLOR_COUNT]; | 2135 | uint8_t brightness_range[EC_LED_COLOR_COUNT]; |
| 1437 | } __packed; | 2136 | } __ec_align1; |
| 1438 | 2137 | ||
| 1439 | /*****************************************************************************/ | 2138 | /*****************************************************************************/ |
| 1440 | /* Verified boot commands */ | 2139 | /* Verified boot commands */ |
| @@ -1445,7 +2144,7 @@ struct ec_response_led_control { · 4 unmodified lines | |||
| 1445 | */ | 2144 | */ |
| 1446 | 2145 | ||
| 1447 | /* Verified boot hash command */ | 2146 | /* Verified boot hash command */ |
| 1448 | #define EC_CMD_VBOOT_HASH 0x2A | 2147 | #define EC_CMD_VBOOT_HASH 0x002A |
| 1449 | 2148 | ||
| 1450 | struct ec_params_vboot_hash { | 2149 | struct ec_params_vboot_hash { |
| 1451 | uint8_t cmd; /* enum ec_vboot_hash_cmd */ | 2150 | uint8_t cmd; /* enum ec_vboot_hash_cmd */ |
| @@ -1455,7 +2154,7 @@ struct ec_params_vboot_hash { · 3 unmodified lines | |||
| 1455 | uint32_t offset; /* Offset in flash to hash */ | 2154 | uint32_t offset; /* Offset in flash to hash */ |
| 1456 | uint32_t size; /* Number of bytes to hash */ | 2155 | uint32_t size; /* Number of bytes to hash */ |
| 1457 | uint8_t nonce_data[64]; /* Nonce data; ignored if nonce_size=0 */ | 2156 | uint8_t nonce_data[64]; /* Nonce data; ignored if nonce_size=0 */ |
| 1458 | } __packed; | 2157 | } __ec_align4; |
| 1459 | 2158 | ||
| 1460 | struct ec_response_vboot_hash { | 2159 | struct ec_response_vboot_hash { |
| 1461 | uint8_t status; /* enum ec_vboot_hash_status */ | 2160 | uint8_t status; /* enum ec_vboot_hash_status */ |
| @@ -1465,7 +2164,7 @@ struct ec_response_vboot_hash { · 3 unmodified lines | |||
| 1465 | uint32_t offset; /* Offset in flash which was hashed */ | 2164 | uint32_t offset; /* Offset in flash which was hashed */ |
| 1466 | uint32_t size; /* Number of bytes hashed */ | 2165 | uint32_t size; /* Number of bytes hashed */ |
| 1467 | uint8_t hash_digest[64]; /* Hash digest data */ | 2166 | uint8_t hash_digest[64]; /* Hash digest data */ |
| 1468 | } __packed; | 2167 | } __ec_align4; |
| 1469 | 2168 | ||
| 1470 | enum ec_vboot_hash_cmd { | 2169 | enum ec_vboot_hash_cmd { |
| 1471 | EC_VBOOT_HASH_GET = 0, /* Get current hash status */ | 2170 | EC_VBOOT_HASH_GET = 0, /* Get current hash status */ |
| @@ -1489,15 +2188,22 @@ enum ec_vboot_hash_status { · 17 unmodified lines | |||
| 1489 | * If one of these is specified, the EC will automatically update offset and | 2188 | * If one of these is specified, the EC will automatically update offset and |
| 1490 | * size to the correct values for the specified image (RO or RW). | 2189 | * size to the correct values for the specified image (RO or RW). |
| 1491 | */ | 2190 | */ |
| 1492 | #define EC_VBOOT_HASH_OFFSET_RO 0xfffffffe | 2191 | #define EC_VBOOT_HASH_OFFSET_RO 0xfffffffe |
| 1493 | #define EC_VBOOT_HASH_OFFSET_RW 0xfffffffd | 2192 | #define EC_VBOOT_HASH_OFFSET_ACTIVE 0xfffffffd |
| 2193 | #define EC_VBOOT_HASH_OFFSET_UPDATE 0xfffffffc | ||
| 2194 | |||
| 2195 | /* | ||
| 2196 | * 'RW' is vague if there are multiple RW images; we mean the active one, | ||
| 2197 | * so the old constant is deprecated. | ||
| 2198 | */ | ||
| 2199 | #define EC_VBOOT_HASH_OFFSET_RW EC_VBOOT_HASH_OFFSET_ACTIVE | ||
| 1494 | 2200 | ||
| 1495 | /*****************************************************************************/ | 2201 | /*****************************************************************************/ |
| 1496 | /* | 2202 | /* |
| 1497 | * Motion sense commands. We'll make separate structs for sub-commands with | 2203 | * Motion sense commands. We'll make separate structs for sub-commands with |
| 1498 | * different input args, so that we know how much to expect. | 2204 | * different input args, so that we know how much to expect. |
| 1499 | */ | 2205 | */ |
| 1500 | #define EC_CMD_MOTION_SENSE_CMD 0x2B | 2206 | #define EC_CMD_MOTION_SENSE_CMD 0x002B |
| 1501 | 2207 | ||
| 1502 | /* Motion sense commands */ | 2208 | /* Motion sense commands */ |
| 1503 | enum motionsense_command { | 2209 | enum motionsense_command { |
| @@ -1516,7 +2222,13 @@ enum motionsense_command { · 12 unmodified lines | |||
| 1516 | 2222 | ||
| 1517 | /* | 2223 | /* |
| 1518 | * EC Rate command is a setter/getter command for the EC sampling rate | 2224 | * EC Rate command is a setter/getter command for the EC sampling rate |
| 1519 | * of all motion sensors in milliseconds. | 2225 | * in milliseconds. |
| 2226 | * It is per sensor, the EC run sample task at the minimum of all | ||
| 2227 | * sensors EC_RATE. | ||
| 2228 | * For sensors without hardware FIFO, EC_RATE should be equals to 1/ODR | ||
| 2229 | * to collect all the sensor samples. | ||
| 2230 | * For sensor with hardware FIFO, EC_RATE is used as the maximal delay | ||
| 2231 | * to process of all motion sensors in milliseconds. | ||
| 1520 | */ | 2232 | */ |
| 1521 | MOTIONSENSE_CMD_EC_RATE = 2, | 2233 | MOTIONSENSE_CMD_EC_RATE = 2, |
| 1522 | 2234 | ||
| @@ -1547,32 +2259,76 @@ enum motionsense_command { · 24 unmodified lines | |||
| 1547 | MOTIONSENSE_CMD_DATA = 6, | 2259 | MOTIONSENSE_CMD_DATA = 6, |
| 1548 | 2260 | ||
| 1549 | /* | 2261 | /* |
| 1550 | * Perform low level calibration.. On sensors that support it, ask to | 2262 | * Return sensor fifo info. |
| 1551 | * do offset calibration. | 2263 | */ |
| 2264 | MOTIONSENSE_CMD_FIFO_INFO = 7, | ||
| 2265 | |||
| 2266 | /* | ||
| 2267 | * Insert a flush element in the fifo and return sensor fifo info. | ||
| 2268 | * The host can use that element to synchronize its operation. | ||
| 2269 | */ | ||
| 2270 | MOTIONSENSE_CMD_FIFO_FLUSH = 8, | ||
| 2271 | |||
| 2272 | /* | ||
| 2273 | * Return a portion of the fifo. | ||
| 2274 | */ | ||
| 2275 | MOTIONSENSE_CMD_FIFO_READ = 9, | ||
| 2276 | |||
| 2277 | /* | ||
| 2278 | * Perform low level calibration. | ||
| 2279 | * On sensors that support it, ask to do offset calibration. | ||
| 1552 | */ | 2280 | */ |
| 1553 | MOTIONSENSE_CMD_PERFORM_CALIB = 10, | 2281 | MOTIONSENSE_CMD_PERFORM_CALIB = 10, |
| 1554 | 2282 | ||
| 1555 | /* | 2283 | /* |
| 1556 | * Sensor Offset command is a setter/getter command for the offset used | 2284 | * Sensor Offset command is a setter/getter command for the offset |
| 1557 | * for calibration. The offsets can be calculated by the host, or via | 2285 | * used for calibration. |
| 2286 | * The offsets can be calculated by the host, or via | ||
| 1558 | * PERFORM_CALIB command. | 2287 | * PERFORM_CALIB command. |
| 1559 | */ | 2288 | */ |
| 1560 | MOTIONSENSE_CMD_SENSOR_OFFSET = 11, | 2289 | MOTIONSENSE_CMD_SENSOR_OFFSET = 11, |
| 1561 | 2290 | ||
| 1562 | /* Number of motionsense sub-commands. */ | 2291 | /* |
| 1563 | MOTIONSENSE_NUM_CMDS | 2292 | * List available activities for a MOTION sensor. |
| 1564 | }; | 2293 | * Indicates if they are enabled or disabled. |
| 2294 | */ | ||
| 2295 | MOTIONSENSE_CMD_LIST_ACTIVITIES = 12, | ||
| 2296 | |||
| 2297 | /* | ||
| 2298 | * Activity management | ||
| 2299 | * Enable/Disable activity recognition. | ||
| 2300 | */ | ||
| 2301 | MOTIONSENSE_CMD_SET_ACTIVITY = 13, | ||
| 2302 | |||
| 2303 | /* | ||
| 2304 | * Lid Angle | ||
| 2305 | */ | ||
| 2306 | MOTIONSENSE_CMD_LID_ANGLE = 14, | ||
| 2307 | |||
| 2308 | /* | ||
| 2309 | * Allow the FIFO to trigger interrupt via MKBP events. | ||
| 2310 | * By default the FIFO does not send interrupt to process the FIFO | ||
| 2311 | * until the AP is ready or it is coming from a wakeup sensor. | ||
| 2312 | */ | ||
| 2313 | MOTIONSENSE_CMD_FIFO_INT_ENABLE = 15, | ||
| 1565 | 2314 | ||
| 1566 | enum motionsensor_id { | 2315 | /* |
| 1567 | EC_MOTION_SENSOR_ACCEL_BASE = 0, | 2316 | * Spoof the readings of the sensors. The spoofed readings can be set |
| 1568 | EC_MOTION_SENSOR_ACCEL_LID = 1, | 2317 | * to arbitrary values, or will lock to the last read actual values. |
| 1569 | EC_MOTION_SENSOR_GYRO = 2, | 2318 | */ |
| 2319 | MOTIONSENSE_CMD_SPOOF = 16, | ||
| 2320 | |||
| 2321 | /* Set lid angle for tablet mode detection. */ | ||
| 2322 | MOTIONSENSE_CMD_TABLET_MODE_LID_ANGLE = 17, | ||
| 1570 | 2323 | ||
| 1571 | /* | 2324 | /* |
| 1572 | * Note, if more sensors are added and this count changes, the padding | 2325 | * Sensor Scale command is a setter/getter command for the calibration |
| 1573 | * in ec_response_motion_sense dump command must be modified. | 2326 | * scale. |
| 1574 | */ | 2327 | */ |
| 1575 | EC_MOTION_SENSOR_COUNT = 3 | 2328 | MOTIONSENSE_CMD_SENSOR_SCALE = 18, |
| 2329 | |||
| 2330 | /* Number of motionsense sub-commands. */ | ||
| 2331 | MOTIONSENSE_NUM_CMDS | ||
| 1576 | }; | 2332 | }; |
| 1577 | 2333 | ||
| 1578 | /* List of motion sensor types. */ | 2334 | /* List of motion sensor types. */ |
| @@ -1584,6 +2340,7 @@ enum motionsensor_type { · 5 unmodified lines | |||
| 1584 | MOTIONSENSE_TYPE_LIGHT = 4, | 2340 | MOTIONSENSE_TYPE_LIGHT = 4, |
| 1585 | MOTIONSENSE_TYPE_ACTIVITY = 5, | 2341 | MOTIONSENSE_TYPE_ACTIVITY = 5, |
| 1586 | MOTIONSENSE_TYPE_BARO = 6, | 2342 | MOTIONSENSE_TYPE_BARO = 6, |
| 2343 | MOTIONSENSE_TYPE_SYNC = 7, | ||
| 1587 | MOTIONSENSE_TYPE_MAX, | 2344 | MOTIONSENSE_TYPE_MAX, |
| 1588 | }; | 2345 | }; |
| 1589 | 2346 | ||
| @@ -1591,19 +2348,116 @@ enum motionsensor_type { · 1 unmodified line | |||
| 1591 | enum motionsensor_location { | 2348 | enum motionsensor_location { |
| 1592 | MOTIONSENSE_LOC_BASE = 0, | 2349 | MOTIONSENSE_LOC_BASE = 0, |
| 1593 | MOTIONSENSE_LOC_LID = 1, | 2350 | MOTIONSENSE_LOC_LID = 1, |
| 2351 | MOTIONSENSE_LOC_CAMERA = 2, | ||
| 1594 | MOTIONSENSE_LOC_MAX, | 2352 | MOTIONSENSE_LOC_MAX, |
| 1595 | }; | 2353 | }; |
| 1596 | 2354 | ||
| 1597 | /* List of motion sensor chips. */ | 2355 | /* List of motion sensor chips. */ |
| 1598 | enum motionsensor_chip { | 2356 | enum motionsensor_chip { |
| 1599 | MOTIONSENSE_CHIP_KXCJ9 = 0, | 2357 | MOTIONSENSE_CHIP_KXCJ9 = 0, |
| 2358 | MOTIONSENSE_CHIP_LSM6DS0 = 1, | ||
| 2359 | MOTIONSENSE_CHIP_BMI160 = 2, | ||
| 2360 | MOTIONSENSE_CHIP_SI1141 = 3, | ||
| 2361 | MOTIONSENSE_CHIP_SI1142 = 4, | ||
| 2362 | MOTIONSENSE_CHIP_SI1143 = 5, | ||
| 2363 | MOTIONSENSE_CHIP_KX022 = 6, | ||
| 2364 | MOTIONSENSE_CHIP_L3GD20H = 7, | ||
| 2365 | MOTIONSENSE_CHIP_BMA255 = 8, | ||
| 2366 | MOTIONSENSE_CHIP_BMP280 = 9, | ||
| 2367 | MOTIONSENSE_CHIP_OPT3001 = 10, | ||
| 2368 | MOTIONSENSE_CHIP_BH1730 = 11, | ||
| 2369 | MOTIONSENSE_CHIP_GPIO = 12, | ||
| 2370 | MOTIONSENSE_CHIP_LIS2DH = 13, | ||
| 2371 | MOTIONSENSE_CHIP_LSM6DSM = 14, | ||
| 2372 | MOTIONSENSE_CHIP_LIS2DE = 15, | ||
| 2373 | MOTIONSENSE_CHIP_LIS2MDL = 16, | ||
| 2374 | MOTIONSENSE_CHIP_LSM6DS3 = 17, | ||
| 2375 | MOTIONSENSE_CHIP_LSM6DSO = 18, | ||
| 2376 | MOTIONSENSE_CHIP_LNG2DM = 19, | ||
| 2377 | MOTIONSENSE_CHIP_MAX, | ||
| 2378 | }; | ||
| 2379 | |||
| 2380 | /* List of orientation positions */ | ||
| 2381 | enum motionsensor_orientation { | ||
| 2382 | MOTIONSENSE_ORIENTATION_LANDSCAPE = 0, | ||
| 2383 | MOTIONSENSE_ORIENTATION_PORTRAIT = 1, | ||
| 2384 | MOTIONSENSE_ORIENTATION_UPSIDE_DOWN_PORTRAIT = 2, | ||
| 2385 | MOTIONSENSE_ORIENTATION_UPSIDE_DOWN_LANDSCAPE = 3, | ||
| 2386 | MOTIONSENSE_ORIENTATION_UNKNOWN = 4, | ||
| 2387 | }; | ||
| 2388 | |||
| 2389 | struct ec_response_motion_sensor_data { | ||
| 2390 | /* Flags for each sensor. */ | ||
| 2391 | uint8_t flags; | ||
| 2392 | /* Sensor number the data comes from. */ | ||
| 2393 | uint8_t sensor_num; | ||
| 2394 | /* Each sensor is up to 3-axis. */ | ||
| 2395 | union { | ||
| 2396 | int16_t data[3]; | ||
| 2397 | struct __ec_todo_packed { | ||
| 2398 | uint16_t reserved; | ||
| 2399 | uint32_t timestamp; | ||
| 2400 | }; | ||
| 2401 | struct __ec_todo_unpacked { | ||
| 2402 | uint8_t activity; /* motionsensor_activity */ | ||
| 2403 | uint8_t state; | ||
| 2404 | int16_t add_info[2]; | ||
| 2405 | }; | ||
| 2406 | }; | ||
| 2407 | } __ec_todo_packed; | ||
| 2408 | |||
| 2409 | /* Note: used in ec_response_get_next_data */ | ||
| 2410 | struct ec_response_motion_sense_fifo_info { | ||
| 2411 | /* Size of the fifo */ | ||
| 2412 | uint16_t size; | ||
| 2413 | /* Amount of space used in the fifo */ | ||
| 2414 | uint16_t count; | ||
| 2415 | /* Timestamp recorded in us. | ||
| 2416 | * aka accurate timestamp when host event was triggered. | ||
| 2417 | */ | ||
| 2418 | uint32_t timestamp; | ||
| 2419 | /* Total amount of vector lost */ | ||
| 2420 | uint16_t total_lost; | ||
| 2421 | /* Lost events since the last fifo_info, per sensors */ | ||
| 2422 | uint16_t lost[0]; | ||
| 2423 | } __ec_todo_packed; | ||
| 2424 | |||
| 2425 | struct ec_response_motion_sense_fifo_data { | ||
| 2426 | uint32_t number_data; | ||
| 2427 | struct ec_response_motion_sensor_data data[0]; | ||
| 2428 | } __ec_todo_packed; | ||
| 2429 | |||
| 2430 | /* List supported activity recognition */ | ||
| 2431 | enum motionsensor_activity { | ||
| 2432 | MOTIONSENSE_ACTIVITY_RESERVED = 0, | ||
| 2433 | MOTIONSENSE_ACTIVITY_SIG_MOTION = 1, | ||
| 2434 | MOTIONSENSE_ACTIVITY_DOUBLE_TAP = 2, | ||
| 2435 | MOTIONSENSE_ACTIVITY_ORIENTATION = 3, | ||
| 1600 | }; | 2436 | }; |
| 1601 | 2437 | ||
| 2438 | struct ec_motion_sense_activity { | ||
| 2439 | uint8_t sensor_num; | ||
| 2440 | uint8_t activity; /* one of enum motionsensor_activity */ | ||
| 2441 | uint8_t enable; /* 1: enable, 0: disable */ | ||
| 2442 | uint8_t reserved; | ||
| 2443 | uint16_t parameters[3]; /* activity dependent parameters */ | ||
| 2444 | } __ec_todo_unpacked; | ||
| 2445 | |||
| 1602 | /* Module flag masks used for the dump sub-command. */ | 2446 | /* Module flag masks used for the dump sub-command. */ |
| 1603 | #define MOTIONSENSE_MODULE_FLAG_ACTIVE (1<<0) | 2447 | #define MOTIONSENSE_MODULE_FLAG_ACTIVE BIT(0) |
| 1604 | 2448 | ||
| 1605 | /* Sensor flag masks used for the dump sub-command. */ | 2449 | /* Sensor flag masks used for the dump sub-command. */ |
| 1606 | #define MOTIONSENSE_SENSOR_FLAG_PRESENT (1<<0) | 2450 | #define MOTIONSENSE_SENSOR_FLAG_PRESENT BIT(0) |
| 2451 | |||
| 2452 | /* | ||
| 2453 | * Flush entry for synchronization. | ||
| 2454 | * data contains time stamp | ||
| 2455 | */ | ||
| 2456 | #define MOTIONSENSE_SENSOR_FLAG_FLUSH BIT(0) | ||
| 2457 | #define MOTIONSENSE_SENSOR_FLAG_TIMESTAMP BIT(1) | ||
| 2458 | #define MOTIONSENSE_SENSOR_FLAG_WAKEUP BIT(2) | ||
| 2459 | #define MOTIONSENSE_SENSOR_FLAG_TABLET_MODE BIT(3) | ||
| 2460 | #define MOTIONSENSE_SENSOR_FLAG_ODR BIT(4) | ||
| 1607 | 2461 | ||
| 1608 | /* | 2462 | /* |
| 1609 | * Send this value for the data element to only perform a read. If you | 2463 | * Send this value for the data element to only perform a read. If you |
| @@ -1614,48 +2468,79 @@ enum motionsensor_chip { · 4 unmodified lines | |||
| 1614 | 2468 | ||
| 1615 | #define EC_MOTION_SENSE_INVALID_CALIB_TEMP 0x8000 | 2469 | #define EC_MOTION_SENSE_INVALID_CALIB_TEMP 0x8000 |
| 1616 | 2470 | ||
| 2471 | /* MOTIONSENSE_CMD_SENSOR_OFFSET subcommand flag */ | ||
| 1617 | /* Set Calibration information */ | 2472 | /* Set Calibration information */ |
| 1618 | #define MOTION_SENSE_SET_OFFSET 1 | 2473 | #define MOTION_SENSE_SET_OFFSET BIT(0) |
| 1619 | 2474 | ||
| 1620 | struct ec_response_motion_sensor_data { | 2475 | /* Default Scale value, factor 1. */ |
| 1621 | /* Flags for each sensor. */ | 2476 | #define MOTION_SENSE_DEFAULT_SCALE BIT(15) |
| 1622 | uint8_t flags; | 2477 | |
| 1623 | /* Sensor number the data comes from */ | 2478 | #define LID_ANGLE_UNRELIABLE 500 |
| 1624 | uint8_t sensor_num; | 2479 | |
| 1625 | /* Each sensor is up to 3-axis. */ | 2480 | enum motionsense_spoof_mode { |
| 1626 | union { | 2481 | /* Disable spoof mode. */ |
| 1627 | int16_t data[3]; | 2482 | MOTIONSENSE_SPOOF_MODE_DISABLE = 0, |
| 1628 | struct { | 2483 | |
| 1629 | uint16_t rsvd; | 2484 | /* Enable spoof mode, but use provided component values. */ |
| 1630 | uint32_t timestamp; | 2485 | MOTIONSENSE_SPOOF_MODE_CUSTOM, |
| 1631 | } __packed; | 2486 | |
| 1632 | struct { | 2487 | /* Enable spoof mode, but use the current sensor values. */ |
| 1633 | uint8_t activity; /* motionsensor_activity */ | 2488 | MOTIONSENSE_SPOOF_MODE_LOCK_CURRENT, |
| 1634 | uint8_t state; | 2489 | |
| 1635 | int16_t add_info[2]; | 2490 | /* Query the current spoof mode status for the sensor. */ |
| 1636 | }; | 2491 | MOTIONSENSE_SPOOF_MODE_QUERY, |
| 1637 | }; | 2492 | }; |
| 1638 | } __packed; | ||
| 1639 | 2493 | ||
| 1640 | struct ec_params_motion_sense { | 2494 | struct ec_params_motion_sense { |
| 1641 | uint8_t cmd; | 2495 | uint8_t cmd; |
| 1642 | union { | 2496 | union { |
| 1643 | /* Used for MOTIONSENSE_CMD_DUMP. */ | 2497 | /* Used for MOTIONSENSE_CMD_DUMP. */ |
| 1644 | struct { | 2498 | struct __ec_todo_unpacked { |
| 1645 | /* no args */ | 2499 | /* |
| 2500 | * Maximal number of sensor the host is expecting. | ||
| 2501 | * 0 means the host is only interested in the number | ||
| 2502 | * of sensors controlled by the EC. | ||
| 2503 | */ | ||
| 2504 | uint8_t max_sensor_count; | ||
| 1646 | } dump; | 2505 | } dump; |
| 1647 | 2506 | ||
| 1648 | /* | 2507 | /* |
| 1649 | * Used for MOTIONSENSE_CMD_EC_RATE and | 2508 | * Used for MOTIONSENSE_CMD_KB_WAKE_ANGLE. |
| 1650 | * MOTIONSENSE_CMD_KB_WAKE_ANGLE. | ||
| 1651 | */ | 2509 | */ |
| 1652 | struct { | 2510 | struct __ec_todo_unpacked { |
| 1653 | /* Data to set or EC_MOTION_SENSE_NO_VALUE to read. */ | 2511 | /* Data to set or EC_MOTION_SENSE_NO_VALUE to read. |
| 2512 | * kb_wake_angle: angle to wakup AP. | ||
| 2513 | */ | ||
| 1654 | int16_t data; | 2514 | int16_t data; |
| 1655 | } ec_rate, kb_wake_angle; | 2515 | } kb_wake_angle; |
| 2516 | |||
| 2517 | /* | ||
| 2518 | * Used for MOTIONSENSE_CMD_INFO, MOTIONSENSE_CMD_DATA | ||
| 2519 | * and MOTIONSENSE_CMD_PERFORM_CALIB. | ||
| 2520 | */ | ||
| 2521 | struct __ec_todo_unpacked { | ||
| 2522 | uint8_t sensor_num; | ||
| 2523 | } info, info_3, data, fifo_flush, perform_calib, | ||
| 2524 | list_activities; | ||
| 2525 | |||
| 2526 | /* | ||
| 2527 | * Used for MOTIONSENSE_CMD_EC_RATE, MOTIONSENSE_CMD_SENSOR_ODR | ||
| 2528 | * and MOTIONSENSE_CMD_SENSOR_RANGE. | ||
| 2529 | */ | ||
| 2530 | struct __ec_todo_unpacked { | ||
| 2531 | uint8_t sensor_num; | ||
| 2532 | |||
| 2533 | /* Rounding flag, true for round-up, false for down. */ | ||
| 2534 | uint8_t roundup; | ||
| 2535 | |||
| 2536 | uint16_t reserved; | ||
| 2537 | |||
| 2538 | /* Data to set or EC_MOTION_SENSE_NO_VALUE to read. */ | ||
| 2539 | int32_t data; | ||
| 2540 | } ec_rate, sensor_odr, sensor_range; | ||
| 1656 | 2541 | ||
| 1657 | /* Used for MOTIONSENSE_CMD_SENSOR_OFFSET */ | 2542 | /* Used for MOTIONSENSE_CMD_SENSOR_OFFSET */ |
| 1658 | struct { | 2543 | struct __ec_todo_packed { |
| 1659 | uint8_t sensor_num; | 2544 | uint8_t sensor_num; |
| 1660 | 2545 | ||
| 1661 | /* | 2546 | /* |
| @@ -1681,36 +2566,102 @@ struct ec_params_motion_sense { · 19 unmodified lines | |||
| 1681 | * Compass: 1/16 uT | 2566 | * Compass: 1/16 uT |
| 1682 | */ | 2567 | */ |
| 1683 | int16_t offset[3]; | 2568 | int16_t offset[3]; |
| 1684 | } __packed sensor_offset; | 2569 | } sensor_offset; |
| 1685 | 2570 | ||
| 1686 | /* Used for MOTIONSENSE_CMD_INFO. */ | 2571 | /* Used for MOTIONSENSE_CMD_SENSOR_SCALE */ |
| 1687 | struct { | 2572 | struct __ec_todo_packed { |
| 1688 | uint8_t sensor_num; | 2573 | uint8_t sensor_num; |
| 1689 | } info; | ||
| 1690 | 2574 | ||
| 1691 | /* | 2575 | /* |
| 1692 | * Used for MOTIONSENSE_CMD_SENSOR_ODR and | 2576 | * bit 0: If set (MOTION_SENSE_SET_OFFSET), set |
| 1693 | * MOTIONSENSE_CMD_SENSOR_RANGE. | 2577 | * the calibration information in the EC. |
| 1694 | */ | 2578 | * If unset, just retrieve calibration information. |
| 1695 | struct { | 2579 | */ |
| 1696 | /* Should be element of enum motionsensor_id. */ | 2580 | uint16_t flags; |
| 1697 | uint8_t sensor_num; | ||
| 1698 | 2581 | ||
| 1699 | /* Rounding flag, true for round-up, false for down. */ | 2582 | /* |
| 1700 | uint8_t roundup; | 2583 | * Temperature at calibration, in units of 0.01 C |
| 2584 | * 0x8000: invalid / unknown. | ||
| 2585 | * 0x0: 0C | ||
| 2586 | * 0x7fff: +327.67C | ||
| 2587 | */ | ||
| 2588 | int16_t temp; | ||
| 1701 | 2589 | ||
| 1702 | uint16_t reserved; | 2590 | /* |
| 2591 | * Scale for calibration: | ||
| 2592 | * By default scale is 1, it is encoded on 16bits: | ||
| 2593 | * 1 = BIT(15) | ||
| 2594 | * ~2 = 0xFFFF | ||
| 2595 | * ~0 = 0. | ||
| 2596 | */ | ||
| 2597 | uint16_t scale[3]; | ||
| 2598 | } sensor_scale; | ||
| 1703 | 2599 | ||
| 1704 | /* Data to set or EC_MOTION_SENSE_NO_VALUE to read. */ | 2600 | |
| 1705 | int32_t data; | 2601 | /* Used for MOTIONSENSE_CMD_FIFO_INFO */ |
| 1706 | } sensor_odr, sensor_range; | 2602 | /* (no params) */ |
| 2603 | |||
| 2604 | /* Used for MOTIONSENSE_CMD_FIFO_READ */ | ||
| 2605 | struct __ec_todo_unpacked { | ||
| 2606 | /* | ||
| 2607 | * Number of expected vector to return. | ||
| 2608 | * EC may return less or 0 if none available. | ||
| 2609 | */ | ||
| 2610 | uint32_t max_data_vector; | ||
| 2611 | } fifo_read; | ||
| 2612 | |||
| 2613 | struct ec_motion_sense_activity set_activity; | ||
| 2614 | |||
| 2615 | /* Used for MOTIONSENSE_CMD_LID_ANGLE */ | ||
| 2616 | /* (no params) */ | ||
| 2617 | |||
| 2618 | /* Used for MOTIONSENSE_CMD_FIFO_INT_ENABLE */ | ||
| 2619 | struct __ec_todo_unpacked { | ||
| 2620 | /* | ||
| 2621 | * 1: enable, 0 disable fifo, | ||
| 2622 | * EC_MOTION_SENSE_NO_VALUE return value. | ||
| 2623 | */ | ||
| 2624 | int8_t enable; | ||
| 2625 | } fifo_int_enable; | ||
| 2626 | |||
| 2627 | /* Used for MOTIONSENSE_CMD_SPOOF */ | ||
| 2628 | struct __ec_todo_packed { | ||
| 2629 | uint8_t sensor_id; | ||
| 2630 | |||
| 2631 | /* See enum motionsense_spoof_mode. */ | ||
| 2632 | uint8_t spoof_enable; | ||
| 2633 | |||
| 2634 | /* Ignored, used for alignment. */ | ||
| 2635 | uint8_t reserved; | ||
| 2636 | |||
| 2637 | /* Individual component values to spoof. */ | ||
| 2638 | int16_t components[3]; | ||
| 2639 | } spoof; | ||
| 2640 | |||
| 2641 | /* Used for MOTIONSENSE_CMD_TABLET_MODE_LID_ANGLE. */ | ||
| 2642 | struct __ec_todo_unpacked { | ||
| 2643 | /* | ||
| 2644 | * Lid angle threshold for switching between tablet and | ||
| 2645 | * clamshell mode. | ||
| 2646 | */ | ||
| 2647 | int16_t lid_angle; | ||
| 2648 | |||
| 2649 | /* | ||
| 2650 | * Hysteresis degree to prevent fluctuations between | ||
| 2651 | * clamshell and tablet mode if lid angle keeps | ||
| 2652 | * changing around the threshold. Lid motion driver will | ||
| 2653 | * use lid_angle + hys_degree to trigger tablet mode and | ||
| 2654 | * lid_angle - hys_degree to trigger clamshell mode. | ||
| 2655 | */ | ||
| 2656 | int16_t hys_degree; | ||
| 2657 | } tablet_mode_threshold; | ||
| 1707 | }; | 2658 | }; |
| 1708 | } __packed; | 2659 | } __ec_todo_packed; |
| 1709 | 2660 | ||
| 1710 | struct ec_response_motion_sense { | 2661 | struct ec_response_motion_sense { |
| 1711 | union { | 2662 | union { |
| 1712 | /* Used for MOTIONSENSE_CMD_DUMP. */ | 2663 | /* Used for MOTIONSENSE_CMD_DUMP */ |
| 1713 | struct { | 2664 | struct __ec_todo_unpacked { |
| 1714 | /* Flags representing the motion sensor module. */ | 2665 | /* Flags representing the motion sensor module. */ |
| 1715 | uint8_t module_flags; | 2666 | uint8_t module_flags; |
| 1716 | 2667 | ||
| @@ -1725,7 +2676,7 @@ struct ec_response_motion_sense { · 8 unmodified lines | |||
| 1725 | } dump; | 2676 | } dump; |
| 1726 | 2677 | ||
| 1727 | /* Used for MOTIONSENSE_CMD_INFO. */ | 2678 | /* Used for MOTIONSENSE_CMD_INFO. */ |
| 1728 | struct { | 2679 | struct __ec_todo_unpacked { |
| 1729 | /* Should be element of enum motionsensor_type. */ | 2680 | /* Should be element of enum motionsensor_type. */ |
| 1730 | uint8_t type; | 2681 | uint8_t type; |
| 1731 | 2682 | ||
| @@ -1736,74 +2687,166 @@ struct ec_response_motion_sense { · 4 unmodified lines | |||
| 1736 | uint8_t chip; | 2687 | uint8_t chip; |
| 1737 | } info; | 2688 | } info; |
| 1738 | 2689 | ||
| 2690 | /* Used for MOTIONSENSE_CMD_INFO version 3 */ | ||
| 2691 | struct __ec_todo_unpacked { | ||
| 2692 | /* Should be element of enum motionsensor_type. */ | ||
| 2693 | uint8_t type; | ||
| 2694 | |||
| 2695 | /* Should be element of enum motionsensor_location. */ | ||
| 2696 | uint8_t location; | ||
| 2697 | |||
| 2698 | /* Should be element of enum motionsensor_chip. */ | ||
| 2699 | uint8_t chip; | ||
| 2700 | |||
| 2701 | /* Minimum sensor sampling frequency */ | ||
| 2702 | uint32_t min_frequency; | ||
| 2703 | |||
| 2704 | /* Maximum sensor sampling frequency */ | ||
| 2705 | uint32_t max_frequency; | ||
| 2706 | |||
| 2707 | /* Max number of sensor events that could be in fifo */ | ||
| 2708 | uint32_t fifo_max_event_count; | ||
| 2709 | } info_3; | ||
| 2710 | |||
| 1739 | /* Used for MOTIONSENSE_CMD_DATA */ | 2711 | /* Used for MOTIONSENSE_CMD_DATA */ |
| 1740 | struct ec_response_motion_sensor_data data; | 2712 | struct ec_response_motion_sensor_data data; |
| 1741 | 2713 | ||
| 1742 | /* | 2714 | /* |
| 1743 | * Used for MOTIONSENSE_CMD_EC_RATE, MOTIONSENSE_CMD_SENSOR_ODR, | 2715 | * Used for MOTIONSENSE_CMD_EC_RATE, MOTIONSENSE_CMD_SENSOR_ODR, |
| 1744 | * MOTIONSENSE_CMD_SENSOR_RANGE, and | 2716 | * MOTIONSENSE_CMD_SENSOR_RANGE, |
| 1745 | * MOTIONSENSE_CMD_KB_WAKE_ANGLE. | 2717 | * MOTIONSENSE_CMD_KB_WAKE_ANGLE, |
| 2718 | * MOTIONSENSE_CMD_FIFO_INT_ENABLE and | ||
| 2719 | * MOTIONSENSE_CMD_SPOOF. | ||
| 1746 | */ | 2720 | */ |
| 1747 | struct { | 2721 | struct __ec_todo_unpacked { |
| 1748 | /* Current value of the parameter queried. */ | 2722 | /* Current value of the parameter queried. */ |
| 1749 | int32_t ret; | 2723 | int32_t ret; |
| 1750 | } ec_rate, sensor_odr, sensor_range, kb_wake_angle; | 2724 | } ec_rate, sensor_odr, sensor_range, kb_wake_angle, |
| 2725 | fifo_int_enable, spoof; | ||
| 1751 | 2726 | ||
| 1752 | /* Used for MOTIONSENSE_CMD_SENSOR_OFFSET */ | 2727 | /* |
| 1753 | struct { | 2728 | * Used for MOTIONSENSE_CMD_SENSOR_OFFSET, |
| 2729 | * PERFORM_CALIB. | ||
| 2730 | */ | ||
| 2731 | struct __ec_todo_unpacked { | ||
| 1754 | int16_t temp; | 2732 | int16_t temp; |
| 1755 | int16_t offset[3]; | 2733 | int16_t offset[3]; |
| 1756 | } sensor_offset, perform_calib; | 2734 | } sensor_offset, perform_calib; |
| 1757 | }; | ||
| 1758 | } __packed; | ||
| 1759 | 2735 | ||
| 1760 | /*****************************************************************************/ | 2736 | /* Used for MOTIONSENSE_CMD_SENSOR_SCALE */ |
| 1761 | /* USB charging control commands */ | 2737 | struct __ec_todo_unpacked { |
| 2738 | int16_t temp; | ||
| 2739 | uint16_t scale[3]; | ||
| 2740 | } sensor_scale; | ||
| 1762 | 2741 | ||
| 1763 | /* Set USB port charging mode */ | 2742 | struct ec_response_motion_sense_fifo_info fifo_info, fifo_flush; |
| 1764 | #define EC_CMD_USB_CHARGE_SET_MODE 0x30 | ||
| 1765 | 2743 | ||
| 1766 | struct ec_params_usb_charge_set_mode { | 2744 | struct ec_response_motion_sense_fifo_data fifo_read; |
| 1767 | uint8_t usb_port_id; | ||
| 1768 | uint8_t mode; | ||
| 1769 | } __packed; | ||
| 1770 | 2745 | ||
| 1771 | /*****************************************************************************/ | 2746 | struct __ec_todo_packed { |
| 1772 | /* Persistent storage for host */ | 2747 | uint16_t reserved; |
| 2748 | uint32_t enabled; | ||
| 2749 | uint32_t disabled; | ||
| 2750 | } list_activities; | ||
| 1773 | 2751 | ||
| 1774 | /* Maximum bytes that can be read/written in a single command */ | 2752 | /* No params for set activity */ |
| 1775 | #define EC_PSTORE_SIZE_MAX 64 | ||
| 1776 | 2753 | ||
| 1777 | /* Get persistent storage info */ | 2754 | /* Used for MOTIONSENSE_CMD_LID_ANGLE */ |
| 1778 | #define EC_CMD_PSTORE_INFO 0x40 | 2755 | struct __ec_todo_unpacked { |
| 2756 | /* | ||
| 2757 | * Angle between 0 and 360 degree if available, | ||
| 2758 | * LID_ANGLE_UNRELIABLE otherwise. | ||
| 2759 | */ | ||
| 2760 | uint16_t value; | ||
| 2761 | } lid_angle; | ||
| 1779 | 2762 | ||
| 1780 | struct ec_response_pstore_info { | 2763 | /* Used for MOTIONSENSE_CMD_TABLET_MODE_LID_ANGLE. */ |
| 1781 | /* Persistent storage size, in bytes */ | 2764 | struct __ec_todo_unpacked { |
| 1782 | uint32_t pstore_size; | 2765 | /* |
| 1783 | /* Access size; read/write offset and size must be a multiple of this */ | 2766 | * Lid angle threshold for switching between tablet and |
| 1784 | uint32_t access_size; | 2767 | * clamshell mode. |
| 1785 | } __packed; | 2768 | */ |
| 2769 | uint16_t lid_angle; | ||
| 2770 | |||
| 2771 | /* Hysteresis degree. */ | ||
| 2772 | uint16_t hys_degree; | ||
| 2773 | } tablet_mode_threshold; | ||
| 2774 | |||
| 2775 | }; | ||
| 2776 | } __ec_todo_packed; | ||
| 2777 | |||
| 2778 | /*****************************************************************************/ | ||
| 2779 | /* Force lid open command */ | ||
| 2780 | |||
| 2781 | /* Make lid event always open */ | ||
| 2782 | #define EC_CMD_FORCE_LID_OPEN 0x002C | ||
| 2783 | |||
| 2784 | struct ec_params_force_lid_open { | ||
| 2785 | uint8_t enabled; | ||
| 2786 | } __ec_align1; | ||
| 2787 | |||
| 2788 | /*****************************************************************************/ | ||
| 2789 | /* Configure the behavior of the power button */ | ||
| 2790 | #define EC_CMD_CONFIG_POWER_BUTTON 0x002D | ||
| 2791 | |||
| 2792 | enum ec_config_power_button_flags { | ||
| 2793 | /* Enable/Disable power button pulses for x86 devices */ | ||
| 2794 | EC_POWER_BUTTON_ENABLE_PULSE = BIT(0), | ||
| 2795 | }; | ||
| 2796 | |||
| 2797 | struct ec_params_config_power_button { | ||
| 2798 | /* See enum ec_config_power_button_flags */ | ||
| 2799 | uint8_t flags; | ||
| 2800 | } __ec_align1; | ||
| 2801 | |||
| 2802 | /*****************************************************************************/ | ||
| 2803 | /* USB charging control commands */ | ||
| 2804 | |||
| 2805 | /* Set USB port charging mode */ | ||
| 2806 | #define EC_CMD_USB_CHARGE_SET_MODE 0x0030 | ||
| 2807 | |||
| 2808 | struct ec_params_usb_charge_set_mode { | ||
| 2809 | uint8_t usb_port_id; | ||
| 2810 | uint8_t mode:7; | ||
| 2811 | uint8_t inhibit_charge:1; | ||
| 2812 | } __ec_align1; | ||
| 2813 | |||
| 2814 | /*****************************************************************************/ | ||
| 2815 | /* Persistent storage for host */ | ||
| 2816 | |||
| 2817 | /* Maximum bytes that can be read/written in a single command */ | ||
| 2818 | #define EC_PSTORE_SIZE_MAX 64 | ||
| 2819 | |||
| 2820 | /* Get persistent storage info */ | ||
| 2821 | #define EC_CMD_PSTORE_INFO 0x0040 | ||
| 2822 | |||
| 2823 | struct ec_response_pstore_info { | ||
| 2824 | /* Persistent storage size, in bytes */ | ||
| 2825 | uint32_t pstore_size; | ||
| 2826 | /* Access size; read/write offset and size must be a multiple of this */ | ||
| 2827 | uint32_t access_size; | ||
| 2828 | } __ec_align4; | ||
| 1786 | 2829 | ||
| 1787 | /* | 2830 | /* |
| 1788 | * Read persistent storage | 2831 | * Read persistent storage |
| 1789 | * | 2832 | * |
| 1790 | * Response is params.size bytes of data. | 2833 | * Response is params.size bytes of data. |
| 1791 | */ | 2834 | */ |
| 1792 | #define EC_CMD_PSTORE_READ 0x41 | 2835 | #define EC_CMD_PSTORE_READ 0x0041 |
| 1793 | 2836 | ||
| 1794 | struct ec_params_pstore_read { | 2837 | struct ec_params_pstore_read { |
| 1795 | uint32_t offset; /* Byte offset to read */ | 2838 | uint32_t offset; /* Byte offset to read */ |
| 1796 | uint32_t size; /* Size to read in bytes */ | 2839 | uint32_t size; /* Size to read in bytes */ |
| 1797 | } __packed; | 2840 | } __ec_align4; |
| 1798 | 2841 | ||
| 1799 | /* Write persistent storage */ | 2842 | /* Write persistent storage */ |
| 1800 | #define EC_CMD_PSTORE_WRITE 0x42 | 2843 | #define EC_CMD_PSTORE_WRITE 0x0042 |
| 1801 | 2844 | ||
| 1802 | struct ec_params_pstore_write { | 2845 | struct ec_params_pstore_write { |
| 1803 | uint32_t offset; /* Byte offset to write */ | 2846 | uint32_t offset; /* Byte offset to write */ |
| 1804 | uint32_t size; /* Size to write in bytes */ | 2847 | uint32_t size; /* Size to write in bytes */ |
| 1805 | uint8_t data[EC_PSTORE_SIZE_MAX]; | 2848 | uint8_t data[EC_PSTORE_SIZE_MAX]; |
| 1806 | } __packed; | 2849 | } __ec_align4; |
| 1807 | 2850 | ||
| 1808 | /*****************************************************************************/ | 2851 | /*****************************************************************************/ |
| 1809 | /* Real-time clock */ | 2852 | /* Real-time clock */ |
| @@ -1811,21 +2854,21 @@ struct ec_params_pstore_write { · 1 unmodified line | |||
| 1811 | /* RTC params and response structures */ | 2854 | /* RTC params and response structures */ |
| 1812 | struct ec_params_rtc { | 2855 | struct ec_params_rtc { |
| 1813 | uint32_t time; | 2856 | uint32_t time; |
| 1814 | } __packed; | 2857 | } __ec_align4; |
| 1815 | 2858 | ||
| 1816 | struct ec_response_rtc { | 2859 | struct ec_response_rtc { |
| 1817 | uint32_t time; | 2860 | uint32_t time; |
| 1818 | } __packed; | 2861 | } __ec_align4; |
| 1819 | 2862 | ||
| 1820 | /* These use ec_response_rtc */ | 2863 | /* These use ec_response_rtc */ |
| 1821 | #define EC_CMD_RTC_GET_VALUE 0x44 | 2864 | #define EC_CMD_RTC_GET_VALUE 0x0044 |
| 1822 | #define EC_CMD_RTC_GET_ALARM 0x45 | 2865 | #define EC_CMD_RTC_GET_ALARM 0x0045 |
| 1823 | 2866 | ||
| 1824 | /* These all use ec_params_rtc */ | 2867 | /* These all use ec_params_rtc */ |
| 1825 | #define EC_CMD_RTC_SET_VALUE 0x46 | 2868 | #define EC_CMD_RTC_SET_VALUE 0x0046 |
| 1826 | #define EC_CMD_RTC_SET_ALARM 0x47 | 2869 | #define EC_CMD_RTC_SET_ALARM 0x0047 |
| 1827 | 2870 | ||
| 1828 | /* Pass as param to SET_ALARM to clear the current alarm */ | 2871 | /* Pass as time param to SET_ALARM to clear the current alarm */ |
| 1829 | #define EC_RTC_ALARM_CLEAR 0 | 2872 | #define EC_RTC_ALARM_CLEAR 0 |
| 1830 | 2873 | ||
| 1831 | /*****************************************************************************/ | 2874 | /*****************************************************************************/ |
| @@ -1835,8 +2878,8 @@ struct ec_response_rtc { · 3 unmodified lines | |||
| 1835 | #define EC_PORT80_SIZE_MAX 32 | 2878 | #define EC_PORT80_SIZE_MAX 32 |
| 1836 | 2879 | ||
| 1837 | /* Get last port80 code from previous boot */ | 2880 | /* Get last port80 code from previous boot */ |
| 1838 | #define EC_CMD_PORT80_LAST_BOOT 0x48 | 2881 | #define EC_CMD_PORT80_LAST_BOOT 0x0048 |
| 1839 | #define EC_CMD_PORT80_READ 0x48 | 2882 | #define EC_CMD_PORT80_READ 0x0048 |
| 1840 | 2883 | ||
| 1841 | enum ec_port80_subcmd { | 2884 | enum ec_port80_subcmd { |
| 1842 | EC_PORT80_GET_INFO = 0, | 2885 | EC_PORT80_GET_INFO = 0, |
| @@ -1846,29 +2889,72 @@ enum ec_port80_subcmd { · 3 unmodified lines | |||
| 1846 | struct ec_params_port80_read { | 2889 | struct ec_params_port80_read { |
| 1847 | uint16_t subcmd; | 2890 | uint16_t subcmd; |
| 1848 | union { | 2891 | union { |
| 1849 | struct { | 2892 | struct __ec_todo_unpacked { |
| 1850 | uint32_t offset; | 2893 | uint32_t offset; |
| 1851 | uint32_t num_entries; | 2894 | uint32_t num_entries; |
| 1852 | } read_buffer; | 2895 | } read_buffer; |
| 1853 | }; | 2896 | }; |
| 1854 | } __packed; | 2897 | } __ec_todo_packed; |
| 1855 | 2898 | ||
| 1856 | struct ec_response_port80_read { | 2899 | struct ec_response_port80_read { |
| 1857 | union { | 2900 | union { |
| 1858 | struct { | 2901 | struct __ec_todo_unpacked { |
| 1859 | uint32_t writes; | 2902 | uint32_t writes; |
| 1860 | uint32_t history_size; | 2903 | uint32_t history_size; |
| 1861 | uint32_t last_boot; | 2904 | uint32_t last_boot; |
| 1862 | } get_info; | 2905 | } get_info; |
| 1863 | struct { | 2906 | struct __ec_todo_unpacked { |
| 1864 | uint16_t codes[EC_PORT80_SIZE_MAX]; | 2907 | uint16_t codes[EC_PORT80_SIZE_MAX]; |
| 1865 | } data; | 2908 | } data; |
| 1866 | }; | 2909 | }; |
| 1867 | } __packed; | 2910 | } __ec_todo_packed; |
| 1868 | 2911 | ||
| 1869 | struct ec_response_port80_last_boot { | 2912 | struct ec_response_port80_last_boot { |
| 1870 | uint16_t code; | 2913 | uint16_t code; |
| 1871 | } __packed; | 2914 | } __ec_align2; |
| 2915 | |||
| 2916 | /*****************************************************************************/ | ||
| 2917 | /* Temporary secure storage for host verified boot use */ | ||
| 2918 | |||
| 2919 | /* Number of bytes in a vstore slot */ | ||
| 2920 | #define EC_VSTORE_SLOT_SIZE 64 | ||
| 2921 | |||
| 2922 | /* Maximum number of vstore slots */ | ||
| 2923 | #define EC_VSTORE_SLOT_MAX 32 | ||
| 2924 | |||
| 2925 | /* Get persistent storage info */ | ||
| 2926 | #define EC_CMD_VSTORE_INFO 0x0049 | ||
| 2927 | struct ec_response_vstore_info { | ||
| 2928 | /* Indicates which slots are locked */ | ||
| 2929 | uint32_t slot_locked; | ||
| 2930 | /* Total number of slots available */ | ||
| 2931 | uint8_t slot_count; | ||
| 2932 | } __ec_align_size1; | ||
| 2933 | |||
| 2934 | /* | ||
| 2935 | * Read temporary secure storage | ||
| 2936 | * | ||
| 2937 | * Response is EC_VSTORE_SLOT_SIZE bytes of data. | ||
| 2938 | */ | ||
| 2939 | #define EC_CMD_VSTORE_READ 0x004A | ||
| 2940 | |||
| 2941 | struct ec_params_vstore_read { | ||
| 2942 | uint8_t slot; /* Slot to read from */ | ||
| 2943 | } __ec_align1; | ||
| 2944 | |||
| 2945 | struct ec_response_vstore_read { | ||
| 2946 | uint8_t data[EC_VSTORE_SLOT_SIZE]; | ||
| 2947 | } __ec_align1; | ||
| 2948 | |||
| 2949 | /* | ||
| 2950 | * Write temporary secure storage and lock it. | ||
| 2951 | */ | ||
| 2952 | #define EC_CMD_VSTORE_WRITE 0x004B | ||
| 2953 | |||
| 2954 | struct ec_params_vstore_write { | ||
| 2955 | uint8_t slot; /* Slot to write to */ | ||
| 2956 | uint8_t data[EC_VSTORE_SLOT_SIZE]; | ||
| 2957 | } __ec_align1; | ||
| 1872 | 2958 | ||
| 1873 | /*****************************************************************************/ | 2959 | /*****************************************************************************/ |
| 1874 | /* Thermal engine commands. Note that there are two implementations. We'll | 2960 | /* Thermal engine commands. Note that there are two implementations. We'll |
| @@ -1877,8 +2963,8 @@ struct ec_response_port80_last_boot { · 2 unmodified lines | |||
| 1877 | * Version 1 separates the CPU thermal limits from the fan control. | 2963 | * Version 1 separates the CPU thermal limits from the fan control. |
| 1878 | */ | 2964 | */ |
| 1879 | 2965 | ||
| 1880 | #define EC_CMD_THERMAL_SET_THRESHOLD 0x50 | 2966 | #define EC_CMD_THERMAL_SET_THRESHOLD 0x0050 |
| 1881 | #define EC_CMD_THERMAL_GET_THRESHOLD 0x51 | 2967 | #define EC_CMD_THERMAL_GET_THRESHOLD 0x0051 |
| 1882 | 2968 | ||
| 1883 | /* The version 0 structs are opaque. You have to know what they are for | 2969 | /* The version 0 structs are opaque. You have to know what they are for |
| 1884 | * the get/set commands to make any sense. | 2970 | * the get/set commands to make any sense. |
| @@ -1889,17 +2975,17 @@ struct ec_params_thermal_set_threshold { · 4 unmodified lines | |||
| 1889 | uint8_t sensor_type; | 2975 | uint8_t sensor_type; |
| 1890 | uint8_t threshold_id; | 2976 | uint8_t threshold_id; |
| 1891 | uint16_t value; | 2977 | uint16_t value; |
| 1892 | } __packed; | 2978 | } __ec_align2; |
| 1893 | 2979 | ||
| 1894 | /* Version 0 - get */ | 2980 | /* Version 0 - get */ |
| 1895 | struct ec_params_thermal_get_threshold { | 2981 | struct ec_params_thermal_get_threshold { |
| 1896 | uint8_t sensor_type; | 2982 | uint8_t sensor_type; |
| 1897 | uint8_t threshold_id; | 2983 | uint8_t threshold_id; |
| 1898 | } __packed; | 2984 | } __ec_align1; |
| 1899 | 2985 | ||
| 1900 | struct ec_response_thermal_get_threshold { | 2986 | struct ec_response_thermal_get_threshold { |
| 1901 | uint16_t value; | 2987 | uint16_t value; |
| 1902 | } __packed; | 2988 | } __ec_align2; |
| 1903 | 2989 | ||
| 1904 | 2990 | ||
| 1905 | /* The version 1 structs are visible. */ | 2991 | /* The version 1 structs are visible. */ |
| @@ -1911,71 +2997,124 @@ enum ec_temp_thresholds { · 5 unmodified lines | |||
| 1911 | EC_TEMP_THRESH_COUNT | 2997 | EC_TEMP_THRESH_COUNT |
| 1912 | }; | 2998 | }; |
| 1913 | 2999 | ||
| 1914 | /* Thermal configuration for one temperature sensor. Temps are in degrees K. | 3000 | /* |
| 3001 | * Thermal configuration for one temperature sensor. Temps are in degrees K. | ||
| 1915 | * Zero values will be silently ignored by the thermal task. | 3002 | * Zero values will be silently ignored by the thermal task. |
| 3003 | * | ||
| 3004 | * Set 'temp_host' value allows thermal task to trigger some event with 1 degree | ||
| 3005 | * hysteresis. | ||
| 3006 | * For example, | ||
| 3007 | * temp_host[EC_TEMP_THRESH_HIGH] = 300 K | ||
| 3008 | * temp_host_release[EC_TEMP_THRESH_HIGH] = 0 K | ||
| 3009 | * EC will throttle ap when temperature >= 301 K, and release throttling when | ||
| 3010 | * temperature <= 299 K. | ||
| 3011 | * | ||
| 3012 | * Set 'temp_host_release' value allows thermal task has a custom hysteresis. | ||
| 3013 | * For example, | ||
| 3014 | * temp_host[EC_TEMP_THRESH_HIGH] = 300 K | ||
| 3015 | * temp_host_release[EC_TEMP_THRESH_HIGH] = 295 K | ||
| 3016 | * EC will throttle ap when temperature >= 301 K, and release throttling when | ||
| 3017 | * temperature <= 294 K. | ||
| 3018 | * | ||
| 3019 | * Note that this structure is a sub-structure of | ||
| 3020 | * ec_params_thermal_set_threshold_v1, but maintains its alignment there. | ||
| 1916 | */ | 3021 | */ |
| 1917 | struct ec_thermal_config { | 3022 | struct ec_thermal_config { |
| 1918 | uint32_t temp_host[EC_TEMP_THRESH_COUNT]; /* levels of hotness */ | 3023 | uint32_t temp_host[EC_TEMP_THRESH_COUNT]; /* levels of hotness */ |
| 3024 | uint32_t temp_host_release[EC_TEMP_THRESH_COUNT]; /* release levels */ | ||
| 1919 | uint32_t temp_fan_off; /* no active cooling needed */ | 3025 | uint32_t temp_fan_off; /* no active cooling needed */ |
| 1920 | uint32_t temp_fan_max; /* max active cooling needed */ | 3026 | uint32_t temp_fan_max; /* max active cooling needed */ |
| 1921 | } __packed; | 3027 | } __ec_align4; |
| 1922 | 3028 | ||
| 1923 | /* Version 1 - get config for one sensor. */ | 3029 | /* Version 1 - get config for one sensor. */ |
| 1924 | struct ec_params_thermal_get_threshold_v1 { | 3030 | struct ec_params_thermal_get_threshold_v1 { |
| 1925 | uint32_t sensor_num; | 3031 | uint32_t sensor_num; |
| 1926 | } __packed; | 3032 | } __ec_align4; |
| 1927 | /* This returns a struct ec_thermal_config */ | 3033 | /* This returns a struct ec_thermal_config */ |
| 1928 | 3034 | ||
| 1929 | /* Version 1 - set config for one sensor. | 3035 | /* |
| 1930 | * Use read-modify-write for best results! */ | 3036 | * Version 1 - set config for one sensor. |
| 3037 | * Use read-modify-write for best results! | ||
| 3038 | */ | ||
| 1931 | struct ec_params_thermal_set_threshold_v1 { | 3039 | struct ec_params_thermal_set_threshold_v1 { |
| 1932 | uint32_t sensor_num; | 3040 | uint32_t sensor_num; |
| 1933 | struct ec_thermal_config cfg; | 3041 | struct ec_thermal_config cfg; |
| 1934 | } __packed; | 3042 | } __ec_align4; |
| 1935 | /* This returns no data */ | 3043 | /* This returns no data */ |
| 1936 | 3044 | ||
| 1937 | /****************************************************************************/ | 3045 | /****************************************************************************/ |
| 1938 | 3046 | ||
| 1939 | /* Toggle automatic fan control */ | 3047 | /* Toggle automatic fan control */ |
| 1940 | #define EC_CMD_THERMAL_AUTO_FAN_CTRL 0x52 | 3048 | #define EC_CMD_THERMAL_AUTO_FAN_CTRL 0x0052 |
| 3049 | |||
| 3050 | /* Version 1 of input params */ | ||
| 3051 | struct ec_params_auto_fan_ctrl_v1 { | ||
| 3052 | uint8_t fan_idx; | ||
| 3053 | } __ec_align1; | ||
| 1941 | 3054 | ||
| 1942 | /* Get TMP006 calibration data */ | 3055 | /* Get/Set TMP006 calibration data */ |
| 1943 | #define EC_CMD_TMP006_GET_CALIBRATION 0x53 | 3056 | #define EC_CMD_TMP006_GET_CALIBRATION 0x0053 |
| 3057 | #define EC_CMD_TMP006_SET_CALIBRATION 0x0054 | ||
| 3058 | |||
| 3059 | /* | ||
| 3060 | * The original TMP006 calibration only needed four params, but now we need | ||
| 3061 | * more. Since the algorithm is nothing but magic numbers anyway, we'll leave | ||
| 3062 | * the params opaque. The v1 "get" response will include the algorithm number | ||
| 3063 | * and how many params it requires. That way we can change the EC code without | ||
| 3064 | * needing to update this file. We can also use a different algorithm on each | ||
| 3065 | * sensor. | ||
| 3066 | */ | ||
| 1944 | 3067 | ||
| 3068 | /* This is the same struct for both v0 and v1. */ | ||
| 1945 | struct ec_params_tmp006_get_calibration { | 3069 | struct ec_params_tmp006_get_calibration { |
| 1946 | uint8_t index; | 3070 | uint8_t index; |
| 1947 | } __packed; | 3071 | } __ec_align1; |
| 1948 | 3072 | ||
| 1949 | struct ec_response_tmp006_get_calibration { | 3073 | /* Version 0 */ |
| 3074 | struct ec_response_tmp006_get_calibration_v0 { | ||
| 1950 | float s0; | 3075 | float s0; |
| 1951 | float b0; | 3076 | float b0; |
| 1952 | float b1; | 3077 | float b1; |
| 1953 | float b2; | 3078 | float b2; |
| 1954 | } __packed; | 3079 | } __ec_align4; |
| 1955 | |||
| 1956 | /* Set TMP006 calibration data */ | ||
| 1957 | #define EC_CMD_TMP006_SET_CALIBRATION 0x54 | ||
| 1958 | 3080 | ||
| 1959 | struct ec_params_tmp006_set_calibration { | 3081 | struct ec_params_tmp006_set_calibration_v0 { |
| 1960 | uint8_t index; | 3082 | uint8_t index; |
| 1961 | uint8_t reserved[3]; /* Reserved; set 0 */ | 3083 | uint8_t reserved[3]; |
| 1962 | float s0; | 3084 | float s0; |
| 1963 | float b0; | 3085 | float b0; |
| 1964 | float b1; | 3086 | float b1; |
| 1965 | float b2; | 3087 | float b2; |
| 1966 | } __packed; | 3088 | } __ec_align4; |
| 3089 | |||
| 3090 | /* Version 1 */ | ||
| 3091 | struct ec_response_tmp006_get_calibration_v1 { | ||
| 3092 | uint8_t algorithm; | ||
| 3093 | uint8_t num_params; | ||
| 3094 | uint8_t reserved[2]; | ||
| 3095 | float val[0]; | ||
| 3096 | } __ec_align4; | ||
| 3097 | |||
| 3098 | struct ec_params_tmp006_set_calibration_v1 { | ||
| 3099 | uint8_t index; | ||
| 3100 | uint8_t algorithm; | ||
| 3101 | uint8_t num_params; | ||
| 3102 | uint8_t reserved; | ||
| 3103 | float val[0]; | ||
| 3104 | } __ec_align4; | ||
| 3105 | |||
| 1967 | 3106 | ||
| 1968 | /* Read raw TMP006 data */ | 3107 | /* Read raw TMP006 data */ |
| 1969 | #define EC_CMD_TMP006_GET_RAW 0x55 | 3108 | #define EC_CMD_TMP006_GET_RAW 0x0055 |
| 1970 | 3109 | ||
| 1971 | struct ec_params_tmp006_get_raw { | 3110 | struct ec_params_tmp006_get_raw { |
| 1972 | uint8_t index; | 3111 | uint8_t index; |
| 1973 | } __packed; | 3112 | } __ec_align1; |
| 1974 | 3113 | ||
| 1975 | struct ec_response_tmp006_get_raw { | 3114 | struct ec_response_tmp006_get_raw { |
| 1976 | int32_t t; /* In 1/100 K */ | 3115 | int32_t t; /* In 1/100 K */ |
| 1977 | int32_t v; /* In nV */ | 3116 | int32_t v; /* In nV */ |
| 1978 | }; | 3117 | } __ec_align4; |
| 1979 | 3118 | ||
| 1980 | /*****************************************************************************/ | 3119 | /*****************************************************************************/ |
| 1981 | /* MKBP - Matrix KeyBoard Protocol */ | 3120 | /* MKBP - Matrix KeyBoard Protocol */ |
| @@ -1990,24 +3129,24 @@ struct ec_response_tmp006_get_raw { · 8 unmodified lines | |||
| 1990 | * to obtain the instantaneous state, use EC_CMD_MKBP_INFO with the type | 3129 | * to obtain the instantaneous state, use EC_CMD_MKBP_INFO with the type |
| 1991 | * EC_MKBP_INFO_CURRENT and event EC_MKBP_EVENT_KEY_MATRIX. | 3130 | * EC_MKBP_INFO_CURRENT and event EC_MKBP_EVENT_KEY_MATRIX. |
| 1992 | */ | 3131 | */ |
| 1993 | #define EC_CMD_MKBP_STATE 0x60 | 3132 | #define EC_CMD_MKBP_STATE 0x0060 |
| 1994 | 3133 | ||
| 1995 | /* | 3134 | /* |
| 1996 | * Provide information about various MKBP things. See enum ec_mkbp_info_type. | 3135 | * Provide information about various MKBP things. See enum ec_mkbp_info_type. |
| 1997 | */ | 3136 | */ |
| 1998 | #define EC_CMD_MKBP_INFO 0x61 | 3137 | #define EC_CMD_MKBP_INFO 0x0061 |
| 1999 | 3138 | ||
| 2000 | struct ec_response_mkbp_info { | 3139 | struct ec_response_mkbp_info { |
| 2001 | uint32_t rows; | 3140 | uint32_t rows; |
| 2002 | uint32_t cols; | 3141 | uint32_t cols; |
| 2003 | /* Formerly "switches", which was 0. */ | 3142 | /* Formerly "switches", which was 0. */ |
| 2004 | uint8_t reserved; | 3143 | uint8_t reserved; |
| 2005 | } __packed; | 3144 | } __ec_align_size1; |
| 2006 | 3145 | ||
| 2007 | struct ec_params_mkbp_info { | 3146 | struct ec_params_mkbp_info { |
| 2008 | uint8_t info_type; | 3147 | uint8_t info_type; |
| 2009 | uint8_t event_type; | 3148 | uint8_t event_type; |
| 2010 | } __packed; | 3149 | } __ec_align1; |
| 2011 | 3150 | ||
| 2012 | enum ec_mkbp_info_type { | 3151 | enum ec_mkbp_info_type { |
| 2013 | /* | 3152 | /* |
| @@ -2049,17 +3188,28 @@ enum ec_mkbp_info_type { · 35 unmodified lines | |||
| 2049 | }; | 3188 | }; |
| 2050 | 3189 | ||
| 2051 | /* Simulate key press */ | 3190 | /* Simulate key press */ |
| 2052 | #define EC_CMD_MKBP_SIMULATE_KEY 0x62 | 3191 | #define EC_CMD_MKBP_SIMULATE_KEY 0x0062 |
| 2053 | 3192 | ||
| 2054 | struct ec_params_mkbp_simulate_key { | 3193 | struct ec_params_mkbp_simulate_key { |
| 2055 | uint8_t col; | 3194 | uint8_t col; |
| 2056 | uint8_t row; | 3195 | uint8_t row; |
| 2057 | uint8_t pressed; | 3196 | uint8_t pressed; |
| 2058 | } __packed; | 3197 | } __ec_align1; |
| 3198 | |||
| 3199 | #define EC_CMD_GET_KEYBOARD_ID 0x0063 | ||
| 3200 | |||
| 3201 | struct ec_response_keyboard_id { | ||
| 3202 | uint32_t keyboard_id; | ||
| 3203 | } __ec_align4; | ||
| 3204 | |||
| 3205 | enum keyboard_id { | ||
| 3206 | KEYBOARD_ID_UNSUPPORTED = 0, | ||
| 3207 | KEYBOARD_ID_UNREADABLE = 0xffffffff, | ||
| 3208 | }; | ||
| 2059 | 3209 | ||
| 2060 | /* Configure keyboard scanning */ | 3210 | /* Configure keyboard scanning */ |
| 2061 | #define EC_CMD_MKBP_SET_CONFIG 0x64 | 3211 | #define EC_CMD_MKBP_SET_CONFIG 0x0064 |
| 2062 | #define EC_CMD_MKBP_GET_CONFIG 0x65 | 3212 | #define EC_CMD_MKBP_GET_CONFIG 0x0065 |
| 2063 | 3213 | ||
| 2064 | /* flags */ | 3214 | /* flags */ |
| 2065 | enum mkbp_config_flags { | 3215 | enum mkbp_config_flags { |
| @@ -2067,16 +3217,21 @@ enum mkbp_config_flags { · 1 unmodified line | |||
| 2067 | }; | 3217 | }; |
| 2068 | 3218 | ||
| 2069 | enum mkbp_config_valid { | 3219 | enum mkbp_config_valid { |
| 2070 | EC_MKBP_VALID_SCAN_PERIOD = 1 << 0, | 3220 | EC_MKBP_VALID_SCAN_PERIOD = BIT(0), |
| 2071 | EC_MKBP_VALID_POLL_TIMEOUT = 1 << 1, | 3221 | EC_MKBP_VALID_POLL_TIMEOUT = BIT(1), |
| 2072 | EC_MKBP_VALID_MIN_POST_SCAN_DELAY = 1 << 3, | 3222 | EC_MKBP_VALID_MIN_POST_SCAN_DELAY = BIT(3), |
| 2073 | EC_MKBP_VALID_OUTPUT_SETTLE = 1 << 4, | 3223 | EC_MKBP_VALID_OUTPUT_SETTLE = BIT(4), |
| 2074 | EC_MKBP_VALID_DEBOUNCE_DOWN = 1 << 5, | 3224 | EC_MKBP_VALID_DEBOUNCE_DOWN = BIT(5), |
| 2075 | EC_MKBP_VALID_DEBOUNCE_UP = 1 << 6, | 3225 | EC_MKBP_VALID_DEBOUNCE_UP = BIT(6), |
| 2076 | EC_MKBP_VALID_FIFO_MAX_DEPTH = 1 << 7, | 3226 | EC_MKBP_VALID_FIFO_MAX_DEPTH = BIT(7), |
| 2077 | }; | 3227 | }; |
| 2078 | 3228 | ||
| 2079 | /* Configuration for our key scanning algorithm */ | 3229 | /* |
| 3230 | * Configuration for our key scanning algorithm. | ||
| 3231 | * | ||
| 3232 | * Note that this is used as a sub-structure of | ||
| 3233 | * ec_{params/response}_mkbp_get_config. | ||
| 3234 | */ | ||
| 2080 | struct ec_mkbp_config { | 3235 | struct ec_mkbp_config { |
| 2081 | uint32_t valid_mask; /* valid fields */ | 3236 | uint32_t valid_mask; /* valid fields */ |
| 2082 | uint8_t flags; /* some flags (enum mkbp_config_flags) */ | 3237 | uint8_t flags; /* some flags (enum mkbp_config_flags) */ |
| @@ -2096,18 +3251,18 @@ struct ec_mkbp_config { · 13 unmodified lines | |||
| 2096 | uint16_t debounce_up_us; /* time for debounce on key up */ | 3251 | uint16_t debounce_up_us; /* time for debounce on key up */ |
| 2097 | /* maximum depth to allow for fifo (0 = no keyscan output) */ | 3252 | /* maximum depth to allow for fifo (0 = no keyscan output) */ |
| 2098 | uint8_t fifo_max_depth; | 3253 | uint8_t fifo_max_depth; |
| 2099 | } __packed; | 3254 | } __ec_align_size1; |
| 2100 | 3255 | ||
| 2101 | struct ec_params_mkbp_set_config { | 3256 | struct ec_params_mkbp_set_config { |
| 2102 | struct ec_mkbp_config config; | 3257 | struct ec_mkbp_config config; |
| 2103 | } __packed; | 3258 | } __ec_align_size1; |
| 2104 | 3259 | ||
| 2105 | struct ec_response_mkbp_get_config { | 3260 | struct ec_response_mkbp_get_config { |
| 2106 | struct ec_mkbp_config config; | 3261 | struct ec_mkbp_config config; |
| 2107 | } __packed; | 3262 | } __ec_align_size1; |
| 2108 | 3263 | ||
| 2109 | /* Run the key scan emulation */ | 3264 | /* Run the key scan emulation */ |
| 2110 | #define EC_CMD_KEYSCAN_SEQ_CTRL 0x66 | 3265 | #define EC_CMD_KEYSCAN_SEQ_CTRL 0x0066 |
| 2111 | 3266 | ||
| 2112 | enum ec_keyscan_seq_cmd { | 3267 | enum ec_keyscan_seq_cmd { |
| 2113 | EC_KEYSCAN_SEQ_STATUS = 0, /* Get status information */ | 3268 | EC_KEYSCAN_SEQ_STATUS = 0, /* Get status information */ |
| @@ -2122,23 +3277,23 @@ enum ec_collect_flags { · 8 unmodified lines | |||
| 2122 | * Indicates this scan was processed by the EC. Due to timing, some | 3277 | * Indicates this scan was processed by the EC. Due to timing, some |
| 2123 | * scans may be skipped. | 3278 | * scans may be skipped. |
| 2124 | */ | 3279 | */ |
| 2125 | EC_KEYSCAN_SEQ_FLAG_DONE = 1 << 0, | 3280 | EC_KEYSCAN_SEQ_FLAG_DONE = BIT(0), |
| 2126 | }; | 3281 | }; |
| 2127 | 3282 | ||
| 2128 | struct ec_collect_item { | 3283 | struct ec_collect_item { |
| 2129 | uint8_t flags; /* some flags (enum ec_collect_flags) */ | 3284 | uint8_t flags; /* some flags (enum ec_collect_flags) */ |
| 2130 | }; | 3285 | } __ec_align1; |
| 2131 | 3286 | ||
| 2132 | struct ec_params_keyscan_seq_ctrl { | 3287 | struct ec_params_keyscan_seq_ctrl { |
| 2133 | uint8_t cmd; /* Command to send (enum ec_keyscan_seq_cmd) */ | 3288 | uint8_t cmd; /* Command to send (enum ec_keyscan_seq_cmd) */ |
| 2134 | union { | 3289 | union { |
| 2135 | struct { | 3290 | struct __ec_align1 { |
| 2136 | uint8_t active; /* still active */ | 3291 | uint8_t active; /* still active */ |
| 2137 | uint8_t num_items; /* number of items */ | 3292 | uint8_t num_items; /* number of items */ |
| 2138 | /* Current item being presented */ | 3293 | /* Current item being presented */ |
| 2139 | uint8_t cur_item; | 3294 | uint8_t cur_item; |
| 2140 | } status; | 3295 | } status; |
| 2141 | struct { | 3296 | struct __ec_todo_unpacked { |
| 2142 | /* | 3297 | /* |
| 2143 | * Absolute time for this scan, measured from the | 3298 | * Absolute time for this scan, measured from the |
| 2144 | * start of the sequence. | 3299 | * start of the sequence. |
| @@ -2146,29 +3301,40 @@ struct ec_params_keyscan_seq_ctrl { · 1 unmodified line | |||
| 2146 | uint32_t time_us; | 3301 | uint32_t time_us; |
| 2147 | uint8_t scan[0]; /* keyscan data */ | 3302 | uint8_t scan[0]; /* keyscan data */ |
| 2148 | } add; | 3303 | } add; |
| 2149 | struct { | 3304 | struct __ec_align1 { |
| 2150 | uint8_t start_item; /* First item to return */ | 3305 | uint8_t start_item; /* First item to return */ |
| 2151 | uint8_t num_items; /* Number of items to return */ | 3306 | uint8_t num_items; /* Number of items to return */ |
| 2152 | } collect; | 3307 | } collect; |
| 2153 | }; | 3308 | }; |
| 2154 | } __packed; | 3309 | } __ec_todo_packed; |
| 2155 | 3310 | ||
| 2156 | struct ec_result_keyscan_seq_ctrl { | 3311 | struct ec_result_keyscan_seq_ctrl { |
| 2157 | union { | 3312 | union { |
| 2158 | struct { | 3313 | struct __ec_todo_unpacked { |
| 2159 | uint8_t num_items; /* Number of items */ | 3314 | uint8_t num_items; /* Number of items */ |
| 2160 | /* Data for each item */ | 3315 | /* Data for each item */ |
| 2161 | struct ec_collect_item item[0]; | 3316 | struct ec_collect_item item[0]; |
| 2162 | } collect; | 3317 | } collect; |
| 2163 | }; | 3318 | }; |
| 2164 | } __packed; | 3319 | } __ec_todo_packed; |
| 2165 | 3320 | ||
| 2166 | /* | 3321 | /* |
| 2167 | * Command for retrieving the next pending MKBP event from the EC device | 3322 | * Get the next pending MKBP event. |
| 2168 | * | 3323 | * |
| 2169 | * The device replies with UNAVAILABLE if there aren't any pending events. | 3324 | * Returns EC_RES_UNAVAILABLE if there is no event pending. |
| 3325 | */ | ||
| 3326 | #define EC_CMD_GET_NEXT_EVENT 0x0067 | ||
| 3327 | |||
| 3328 | #define EC_MKBP_HAS_MORE_EVENTS_SHIFT 7 | ||
| 3329 | |||
| 3330 | /* | ||
| 3331 | * We use the most significant bit of the event type to indicate to the host | ||
| 3332 | * that the EC has more MKBP events available to provide. | ||
| 2170 | */ | 3333 | */ |
| 2171 | #define EC_CMD_GET_NEXT_EVENT 0x67 | 3334 | #define EC_MKBP_HAS_MORE_EVENTS BIT(EC_MKBP_HAS_MORE_EVENTS_SHIFT) |
| 3335 | |||
| 3336 | /* The mask to apply to get the raw event type */ | ||
| 3337 | #define EC_MKBP_EVENT_TYPE_MASK (BIT(EC_MKBP_HAS_MORE_EVENTS_SHIFT) - 1) | ||
| 2172 | 3338 | ||
| 2173 | enum ec_mkbp_event { | 3339 | enum ec_mkbp_event { |
| 2174 | /* Keyboard matrix changed. The event data is the new matrix state. */ | 3340 | /* Keyboard matrix changed. The event data is the new matrix state. */ |
| @@ -2186,9 +3352,21 @@ enum ec_mkbp_event { · 11 unmodified lines | |||
| 2186 | /* The state of the switches have changed. */ | 3352 | /* The state of the switches have changed. */ |
| 2187 | EC_MKBP_EVENT_SWITCH = 4, | 3353 | EC_MKBP_EVENT_SWITCH = 4, |
| 2188 | 3354 | ||
| 2189 | /* EC sent a sysrq command */ | 3355 | /* New Fingerprint sensor event, the event data is fp_events bitmap. */ |
| 3356 | EC_MKBP_EVENT_FINGERPRINT = 5, | ||
| 3357 | |||
| 3358 | /* | ||
| 3359 | * Sysrq event: send emulated sysrq. The event data is sysrq, | ||
| 3360 | * corresponding to the key to be pressed. | ||
| 3361 | */ | ||
| 2190 | EC_MKBP_EVENT_SYSRQ = 6, | 3362 | EC_MKBP_EVENT_SYSRQ = 6, |
| 2191 | 3363 | ||
| 3364 | /* | ||
| 3365 | * New 64-bit host event. | ||
| 3366 | * The event data is 8 bytes of host event flags. | ||
| 3367 | */ | ||
| 3368 | EC_MKBP_EVENT_HOST_EVENT64 = 7, | ||
| 3369 | |||
| 2192 | /* Notify the AP that something happened on CEC */ | 3370 | /* Notify the AP that something happened on CEC */ |
| 2193 | EC_MKBP_EVENT_CEC_EVENT = 8, | 3371 | EC_MKBP_EVENT_CEC_EVENT = 8, |
| 2194 | 3372 | ||
| @@ -2198,65 +3376,140 @@ enum ec_mkbp_event { · 3 unmodified lines | |||
| 2198 | /* Number of MKBP events */ | 3376 | /* Number of MKBP events */ |
| 2199 | EC_MKBP_EVENT_COUNT, | 3377 | EC_MKBP_EVENT_COUNT, |
| 2200 | }; | 3378 | }; |
| 3379 | BUILD_ASSERT(EC_MKBP_EVENT_COUNT <= EC_MKBP_EVENT_TYPE_MASK); | ||
| 2201 | 3380 | ||
| 2202 | union ec_response_get_next_data { | 3381 | union __ec_align_offset1 ec_response_get_next_data { |
| 2203 | uint8_t key_matrix[13]; | 3382 | uint8_t key_matrix[13]; |
| 2204 | 3383 | ||
| 2205 | /* Unaligned */ | 3384 | /* Unaligned */ |
| 2206 | uint32_t host_event; | 3385 | uint32_t host_event; |
| 3386 | uint64_t host_event64; | ||
| 2207 | 3387 | ||
| 2208 | uint32_t buttons; | 3388 | struct __ec_todo_unpacked { |
| 2209 | uint32_t switches; | 3389 | /* For aligning the fifo_info */ |
| 2210 | uint32_t sysrq; | 3390 | uint8_t reserved[3]; |
| 2211 | } __packed; | 3391 | struct ec_response_motion_sense_fifo_info info; |
| 3392 | } sensor_fifo; | ||
| 2212 | 3393 | ||
| 2213 | union ec_response_get_next_data_v1 { | 3394 | uint32_t buttons; |
| 3395 | |||
| 3396 | uint32_t switches; | ||
| 3397 | |||
| 3398 | uint32_t fp_events; | ||
| 3399 | |||
| 3400 | uint32_t sysrq; | ||
| 3401 | |||
| 3402 | /* CEC events from enum mkbp_cec_event */ | ||
| 3403 | uint32_t cec_events; | ||
| 3404 | }; | ||
| 3405 | |||
| 3406 | union __ec_align_offset1 ec_response_get_next_data_v1 { | ||
| 2214 | uint8_t key_matrix[16]; | 3407 | uint8_t key_matrix[16]; |
| 3408 | |||
| 3409 | /* Unaligned */ | ||
| 2215 | uint32_t host_event; | 3410 | uint32_t host_event; |
| 3411 | uint64_t host_event64; | ||
| 3412 | |||
| 3413 | struct __ec_todo_unpacked { | ||
| 3414 | /* For aligning the fifo_info */ | ||
| 3415 | uint8_t reserved[3]; | ||
| 3416 | struct ec_response_motion_sense_fifo_info info; | ||
| 3417 | } sensor_fifo; | ||
| 3418 | |||
| 2216 | uint32_t buttons; | 3419 | uint32_t buttons; |
| 3420 | |||
| 2217 | uint32_t switches; | 3421 | uint32_t switches; |
| 3422 | |||
| 3423 | uint32_t fp_events; | ||
| 3424 | |||
| 2218 | uint32_t sysrq; | 3425 | uint32_t sysrq; |
| 3426 | |||
| 3427 | /* CEC events from enum mkbp_cec_event */ | ||
| 2219 | uint32_t cec_events; | 3428 | uint32_t cec_events; |
| 3429 | |||
| 2220 | uint8_t cec_message[16]; | 3430 | uint8_t cec_message[16]; |
| 2221 | } __packed; | 3431 | }; |
| 3432 | BUILD_ASSERT(sizeof(union ec_response_get_next_data_v1) == 16); | ||
| 2222 | 3433 | ||
| 2223 | struct ec_response_get_next_event { | 3434 | struct ec_response_get_next_event { |
| 2224 | uint8_t event_type; | 3435 | uint8_t event_type; |
| 2225 | /* Followed by event data if any */ | 3436 | /* Followed by event data if any */ |
| 2226 | union ec_response_get_next_data data; | 3437 | union ec_response_get_next_data data; |
| 2227 | } __packed; | 3438 | } __ec_align1; |
| 2228 | 3439 | ||
| 2229 | struct ec_response_get_next_event_v1 { | 3440 | struct ec_response_get_next_event_v1 { |
| 2230 | uint8_t event_type; | 3441 | uint8_t event_type; |
| 2231 | /* Followed by event data if any */ | 3442 | /* Followed by event data if any */ |
| 2232 | union ec_response_get_next_data_v1 data; | 3443 | union ec_response_get_next_data_v1 data; |
| 2233 | } __packed; | 3444 | } __ec_align1; |
| 2234 | 3445 | ||
| 2235 | /* Bit indices for buttons and switches.*/ | 3446 | /* Bit indices for buttons and switches.*/ |
| 2236 | /* Buttons */ | 3447 | /* Buttons */ |
| 2237 | #define EC_MKBP_POWER_BUTTON 0 | 3448 | #define EC_MKBP_POWER_BUTTON 0 |
| 2238 | #define EC_MKBP_VOL_UP 1 | 3449 | #define EC_MKBP_VOL_UP 1 |
| 2239 | #define EC_MKBP_VOL_DOWN 2 | 3450 | #define EC_MKBP_VOL_DOWN 2 |
| 3451 | #define EC_MKBP_RECOVERY 3 | ||
| 2240 | 3452 | ||
| 2241 | /* Switches */ | 3453 | /* Switches */ |
| 2242 | #define EC_MKBP_LID_OPEN 0 | 3454 | #define EC_MKBP_LID_OPEN 0 |
| 2243 | #define EC_MKBP_TABLET_MODE 1 | 3455 | #define EC_MKBP_TABLET_MODE 1 |
| 2244 | #define EC_MKBP_BASE_ATTACHED 2 | 3456 | #define EC_MKBP_BASE_ATTACHED 2 |
| 2245 | 3457 | ||
| 3458 | /* Run keyboard factory test scanning */ | ||
| 3459 | #define EC_CMD_KEYBOARD_FACTORY_TEST 0x0068 | ||
| 3460 | |||
| 3461 | struct ec_response_keyboard_factory_test { | ||
| 3462 | uint16_t shorted; /* Keyboard pins are shorted */ | ||
| 3463 | } __ec_align2; | ||
| 3464 | |||
| 3465 | /* Fingerprint events in 'fp_events' for EC_MKBP_EVENT_FINGERPRINT */ | ||
| 3466 | #define EC_MKBP_FP_RAW_EVENT(fp_events) ((fp_events) & 0x00FFFFFF) | ||
| 3467 | #define EC_MKBP_FP_ERRCODE(fp_events) ((fp_events) & 0x0000000F) | ||
| 3468 | #define EC_MKBP_FP_ENROLL_PROGRESS_OFFSET 4 | ||
| 3469 | #define EC_MKBP_FP_ENROLL_PROGRESS(fpe) (((fpe) & 0x00000FF0) \ | ||
| 3470 | >> EC_MKBP_FP_ENROLL_PROGRESS_OFFSET) | ||
| 3471 | #define EC_MKBP_FP_MATCH_IDX_OFFSET 12 | ||
| 3472 | #define EC_MKBP_FP_MATCH_IDX_MASK 0x0000F000 | ||
| 3473 | #define EC_MKBP_FP_MATCH_IDX(fpe) (((fpe) & EC_MKBP_FP_MATCH_IDX_MASK) \ | ||
| 3474 | >> EC_MKBP_FP_MATCH_IDX_OFFSET) | ||
| 3475 | #define EC_MKBP_FP_ENROLL BIT(27) | ||
| 3476 | #define EC_MKBP_FP_MATCH BIT(28) | ||
| 3477 | #define EC_MKBP_FP_FINGER_DOWN BIT(29) | ||
| 3478 | #define EC_MKBP_FP_FINGER_UP BIT(30) | ||
| 3479 | #define EC_MKBP_FP_IMAGE_READY BIT(31) | ||
| 3480 | /* code given by EC_MKBP_FP_ERRCODE() when EC_MKBP_FP_ENROLL is set */ | ||
| 3481 | #define EC_MKBP_FP_ERR_ENROLL_OK 0 | ||
| 3482 | #define EC_MKBP_FP_ERR_ENROLL_LOW_QUALITY 1 | ||
| 3483 | #define EC_MKBP_FP_ERR_ENROLL_IMMOBILE 2 | ||
| 3484 | #define EC_MKBP_FP_ERR_ENROLL_LOW_COVERAGE 3 | ||
| 3485 | #define EC_MKBP_FP_ERR_ENROLL_INTERNAL 5 | ||
| 3486 | /* Can be used to detect if image was usable for enrollment or not. */ | ||
| 3487 | #define EC_MKBP_FP_ERR_ENROLL_PROBLEM_MASK 1 | ||
| 3488 | /* code given by EC_MKBP_FP_ERRCODE() when EC_MKBP_FP_MATCH is set */ | ||
| 3489 | #define EC_MKBP_FP_ERR_MATCH_NO 0 | ||
| 3490 | #define EC_MKBP_FP_ERR_MATCH_NO_INTERNAL 6 | ||
| 3491 | #define EC_MKBP_FP_ERR_MATCH_NO_TEMPLATES 7 | ||
| 3492 | #define EC_MKBP_FP_ERR_MATCH_NO_LOW_QUALITY 2 | ||
| 3493 | #define EC_MKBP_FP_ERR_MATCH_NO_LOW_COVERAGE 4 | ||
| 3494 | #define EC_MKBP_FP_ERR_MATCH_YES 1 | ||
| 3495 | #define EC_MKBP_FP_ERR_MATCH_YES_UPDATED 3 | ||
| 3496 | #define EC_MKBP_FP_ERR_MATCH_YES_UPDATE_FAILED 5 | ||
| 3497 | |||
| 3498 | |||
| 2246 | /*****************************************************************************/ | 3499 | /*****************************************************************************/ |
| 2247 | /* Temperature sensor commands */ | 3500 | /* Temperature sensor commands */ |
| 2248 | 3501 | ||
| 2249 | /* Read temperature sensor info */ | 3502 | /* Read temperature sensor info */ |
| 2250 | #define EC_CMD_TEMP_SENSOR_GET_INFO 0x70 | 3503 | #define EC_CMD_TEMP_SENSOR_GET_INFO 0x0070 |
| 2251 | 3504 | ||
| 2252 | struct ec_params_temp_sensor_get_info { | 3505 | struct ec_params_temp_sensor_get_info { |
| 2253 | uint8_t id; | 3506 | uint8_t id; |
| 2254 | } __packed; | 3507 | } __ec_align1; |
| 2255 | 3508 | ||
| 2256 | struct ec_response_temp_sensor_get_info { | 3509 | struct ec_response_temp_sensor_get_info { |
| 2257 | char sensor_name[32]; | 3510 | char sensor_name[32]; |
| 2258 | uint8_t sensor_type; | 3511 | uint8_t sensor_type; |
| 2259 | } __packed; | 3512 | } __ec_align1; |
| 2260 | 3513 | ||
| 2261 | /*****************************************************************************/ | 3514 | /*****************************************************************************/ |
| 2262 | 3515 | ||
| @@ -2269,49 +3522,131 @@ struct ec_response_temp_sensor_get_info { · 6 unmodified lines | |||
| 2269 | /*****************************************************************************/ | 3522 | /*****************************************************************************/ |
| 2270 | /* Host event commands */ | 3523 | /* Host event commands */ |
| 2271 | 3524 | ||
| 3525 | |||
| 3526 | /* Obsolete. New implementation should use EC_CMD_HOST_EVENT instead */ | ||
| 2272 | /* | 3527 | /* |
| 2273 | * Host event mask params and response structures, shared by all of the host | 3528 | * Host event mask params and response structures, shared by all of the host |
| 2274 | * event commands below. | 3529 | * event commands below. |
| 2275 | */ | 3530 | */ |
| 2276 | struct ec_params_host_event_mask { | 3531 | struct ec_params_host_event_mask { |
| 2277 | uint32_t mask; | 3532 | uint32_t mask; |
| 2278 | } __packed; | 3533 | } __ec_align4; |
| 2279 | 3534 | ||
| 2280 | struct ec_response_host_event_mask { | 3535 | struct ec_response_host_event_mask { |
| 2281 | uint32_t mask; | 3536 | uint32_t mask; |
| 2282 | } __packed; | 3537 | } __ec_align4; |
| 2283 | 3538 | ||
| 2284 | /* These all use ec_response_host_event_mask */ | 3539 | /* These all use ec_response_host_event_mask */ |
| 2285 | #define EC_CMD_HOST_EVENT_GET_B 0x87 | 3540 | #define EC_CMD_HOST_EVENT_GET_B 0x0087 |
| 2286 | #define EC_CMD_HOST_EVENT_GET_SMI_MASK 0x88 | 3541 | #define EC_CMD_HOST_EVENT_GET_SMI_MASK 0x0088 |
| 2287 | #define EC_CMD_HOST_EVENT_GET_SCI_MASK 0x89 | 3542 | #define EC_CMD_HOST_EVENT_GET_SCI_MASK 0x0089 |
| 2288 | #define EC_CMD_HOST_EVENT_GET_WAKE_MASK 0x8d | 3543 | #define EC_CMD_HOST_EVENT_GET_WAKE_MASK 0x008D |
| 2289 | 3544 | ||
| 2290 | /* These all use ec_params_host_event_mask */ | 3545 | /* These all use ec_params_host_event_mask */ |
| 2291 | #define EC_CMD_HOST_EVENT_SET_SMI_MASK 0x8a | 3546 | #define EC_CMD_HOST_EVENT_SET_SMI_MASK 0x008A |
| 2292 | #define EC_CMD_HOST_EVENT_SET_SCI_MASK 0x8b | 3547 | #define EC_CMD_HOST_EVENT_SET_SCI_MASK 0x008B |
| 2293 | #define EC_CMD_HOST_EVENT_CLEAR 0x8c | 3548 | #define EC_CMD_HOST_EVENT_CLEAR 0x008C |
| 2294 | #define EC_CMD_HOST_EVENT_SET_WAKE_MASK 0x8e | 3549 | #define EC_CMD_HOST_EVENT_SET_WAKE_MASK 0x008E |
| 2295 | #define EC_CMD_HOST_EVENT_CLEAR_B 0x8f | 3550 | #define EC_CMD_HOST_EVENT_CLEAR_B 0x008F |
| 3551 | |||
| 3552 | /* | ||
| 3553 | * Unified host event programming interface - Should be used by newer versions | ||
| 3554 | * of BIOS/OS to program host events and masks | ||
| 3555 | */ | ||
| 3556 | |||
| 3557 | struct ec_params_host_event { | ||
| 3558 | |||
| 3559 | /* Action requested by host - one of enum ec_host_event_action. */ | ||
| 3560 | uint8_t action; | ||
| 3561 | |||
| 3562 | /* | ||
| 3563 | * Mask type that the host requested the action on - one of | ||
| 3564 | * enum ec_host_event_mask_type. | ||
| 3565 | */ | ||
| 3566 | uint8_t mask_type; | ||
| 3567 | |||
| 3568 | /* Set to 0, ignore on read */ | ||
| 3569 | uint16_t reserved; | ||
| 3570 | |||
| 3571 | /* Value to be used in case of set operations. */ | ||
| 3572 | uint64_t value; | ||
| 3573 | } __ec_align4; | ||
| 3574 | |||
| 3575 | /* | ||
| 3576 | * Response structure returned by EC_CMD_HOST_EVENT. | ||
| 3577 | * Update the value on a GET request. Set to 0 on GET/CLEAR | ||
| 3578 | */ | ||
| 3579 | |||
| 3580 | struct ec_response_host_event { | ||
| 3581 | |||
| 3582 | /* Mask value in case of get operation */ | ||
| 3583 | uint64_t value; | ||
| 3584 | } __ec_align4; | ||
| 3585 | |||
| 3586 | enum ec_host_event_action { | ||
| 3587 | /* | ||
| 3588 | * params.value is ignored. Value of mask_type populated | ||
| 3589 | * in response.value | ||
| 3590 | */ | ||
| 3591 | EC_HOST_EVENT_GET, | ||
| 3592 | |||
| 3593 | /* Bits in params.value are set */ | ||
| 3594 | EC_HOST_EVENT_SET, | ||
| 3595 | |||
| 3596 | /* Bits in params.value are cleared */ | ||
| 3597 | EC_HOST_EVENT_CLEAR, | ||
| 3598 | }; | ||
| 3599 | |||
| 3600 | enum ec_host_event_mask_type { | ||
| 3601 | |||
| 3602 | /* Main host event copy */ | ||
| 3603 | EC_HOST_EVENT_MAIN, | ||
| 3604 | |||
| 3605 | /* Copy B of host events */ | ||
| 3606 | EC_HOST_EVENT_B, | ||
| 3607 | |||
| 3608 | /* SCI Mask */ | ||
| 3609 | EC_HOST_EVENT_SCI_MASK, | ||
| 3610 | |||
| 3611 | /* SMI Mask */ | ||
| 3612 | EC_HOST_EVENT_SMI_MASK, | ||
| 3613 | |||
| 3614 | /* Mask of events that should be always reported in hostevents */ | ||
| 3615 | EC_HOST_EVENT_ALWAYS_REPORT_MASK, | ||
| 3616 | |||
| 3617 | /* Active wake mask */ | ||
| 3618 | EC_HOST_EVENT_ACTIVE_WAKE_MASK, | ||
| 3619 | |||
| 3620 | /* Lazy wake mask for S0ix */ | ||
| 3621 | EC_HOST_EVENT_LAZY_WAKE_MASK_S0IX, | ||
| 3622 | |||
| 3623 | /* Lazy wake mask for S3 */ | ||
| 3624 | EC_HOST_EVENT_LAZY_WAKE_MASK_S3, | ||
| 3625 | |||
| 3626 | /* Lazy wake mask for S5 */ | ||
| 3627 | EC_HOST_EVENT_LAZY_WAKE_MASK_S5, | ||
| 3628 | }; | ||
| 3629 | |||
| 3630 | #define EC_CMD_HOST_EVENT 0x00A4 | ||
| 2296 | 3631 | ||
| 2297 | /*****************************************************************************/ | 3632 | /*****************************************************************************/ |
| 2298 | /* Switch commands */ | 3633 | /* Switch commands */ |
| 2299 | 3634 | ||
| 2300 | /* Enable/disable LCD backlight */ | 3635 | /* Enable/disable LCD backlight */ |
| 2301 | #define EC_CMD_SWITCH_ENABLE_BKLIGHT 0x90 | 3636 | #define EC_CMD_SWITCH_ENABLE_BKLIGHT 0x0090 |
| 2302 | 3637 | ||
| 2303 | struct ec_params_switch_enable_backlight { | 3638 | struct ec_params_switch_enable_backlight { |
| 2304 | uint8_t enabled; | 3639 | uint8_t enabled; |
| 2305 | } __packed; | 3640 | } __ec_align1; |
| 2306 | 3641 | ||
| 2307 | /* Enable/disable WLAN/Bluetooth */ | 3642 | /* Enable/disable WLAN/Bluetooth */ |
| 2308 | #define EC_CMD_SWITCH_ENABLE_WIRELESS 0x91 | 3643 | #define EC_CMD_SWITCH_ENABLE_WIRELESS 0x0091 |
| 2309 | #define EC_VER_SWITCH_ENABLE_WIRELESS 1 | 3644 | #define EC_VER_SWITCH_ENABLE_WIRELESS 1 |
| 2310 | 3645 | ||
| 2311 | /* Version 0 params; no response */ | 3646 | /* Version 0 params; no response */ |
| 2312 | struct ec_params_switch_enable_wireless_v0 { | 3647 | struct ec_params_switch_enable_wireless_v0 { |
| 2313 | uint8_t enabled; | 3648 | uint8_t enabled; |
| 2314 | } __packed; | 3649 | } __ec_align1; |
| 2315 | 3650 | ||
| 2316 | /* Version 1 params */ | 3651 | /* Version 1 params */ |
| 2317 | struct ec_params_switch_enable_wireless_v1 { | 3652 | struct ec_params_switch_enable_wireless_v1 { |
| @@ -2330,7 +3665,7 @@ struct ec_params_switch_enable_wireless_v1 { · 12 unmodified lines | |||
| 2330 | 3665 | ||
| 2331 | /* Which flags to copy from suspend_flags */ | 3666 | /* Which flags to copy from suspend_flags */ |
| 2332 | uint8_t suspend_mask; | 3667 | uint8_t suspend_mask; |
| 2333 | } __packed; | 3668 | } __ec_align1; |
| 2334 | 3669 | ||
| 2335 | /* Version 1 response */ | 3670 | /* Version 1 response */ |
| 2336 | struct ec_response_switch_enable_wireless_v1 { | 3671 | struct ec_response_switch_enable_wireless_v1 { |
| @@ -2339,55 +3674,56 @@ struct ec_response_switch_enable_wireless_v1 { · 2 unmodified lines | |||
| 2339 | 3674 | ||
| 2340 | /* Flags to leave enabled in S3 */ | 3675 | /* Flags to leave enabled in S3 */ |
| 2341 | uint8_t suspend_flags; | 3676 | uint8_t suspend_flags; |
| 2342 | } __packed; | 3677 | } __ec_align1; |
| 2343 | 3678 | ||
| 2344 | /*****************************************************************************/ | 3679 | /*****************************************************************************/ |
| 2345 | /* GPIO commands. Only available on EC if write protect has been disabled. */ | 3680 | /* GPIO commands. Only available on EC if write protect has been disabled. */ |
| 2346 | 3681 | ||
| 2347 | /* Set GPIO output value */ | 3682 | /* Set GPIO output value */ |
| 2348 | #define EC_CMD_GPIO_SET 0x92 | 3683 | #define EC_CMD_GPIO_SET 0x0092 |
| 2349 | 3684 | ||
| 2350 | struct ec_params_gpio_set { | 3685 | struct ec_params_gpio_set { |
| 2351 | char name[32]; | 3686 | char name[32]; |
| 2352 | uint8_t val; | 3687 | uint8_t val; |
| 2353 | } __packed; | 3688 | } __ec_align1; |
| 2354 | 3689 | ||
| 2355 | /* Get GPIO value */ | 3690 | /* Get GPIO value */ |
| 2356 | #define EC_CMD_GPIO_GET 0x93 | 3691 | #define EC_CMD_GPIO_GET 0x0093 |
| 2357 | 3692 | ||
| 2358 | /* Version 0 of input params and response */ | 3693 | /* Version 0 of input params and response */ |
| 2359 | struct ec_params_gpio_get { | 3694 | struct ec_params_gpio_get { |
| 2360 | char name[32]; | 3695 | char name[32]; |
| 2361 | } __packed; | 3696 | } __ec_align1; |
| 3697 | |||
| 2362 | struct ec_response_gpio_get { | 3698 | struct ec_response_gpio_get { |
| 2363 | uint8_t val; | 3699 | uint8_t val; |
| 2364 | } __packed; | 3700 | } __ec_align1; |
| 2365 | 3701 | ||
| 2366 | /* Version 1 of input params and response */ | 3702 | /* Version 1 of input params and response */ |
| 2367 | struct ec_params_gpio_get_v1 { | 3703 | struct ec_params_gpio_get_v1 { |
| 2368 | uint8_t subcmd; | 3704 | uint8_t subcmd; |
| 2369 | union { | 3705 | union { |
| 2370 | struct { | 3706 | struct __ec_align1 { |
| 2371 | char name[32]; | 3707 | char name[32]; |
| 2372 | } get_value_by_name; | 3708 | } get_value_by_name; |
| 2373 | struct { | 3709 | struct __ec_align1 { |
| 2374 | uint8_t index; | 3710 | uint8_t index; |
| 2375 | } get_info; | 3711 | } get_info; |
| 2376 | }; | 3712 | }; |
| 2377 | } __packed; | 3713 | } __ec_align1; |
| 2378 | 3714 | ||
| 2379 | struct ec_response_gpio_get_v1 { | 3715 | struct ec_response_gpio_get_v1 { |
| 2380 | union { | 3716 | union { |
| 2381 | struct { | 3717 | struct __ec_align1 { |
| 2382 | uint8_t val; | 3718 | uint8_t val; |
| 2383 | } get_value_by_name, get_count; | 3719 | } get_value_by_name, get_count; |
| 2384 | struct { | 3720 | struct __ec_todo_unpacked { |
| 2385 | uint8_t val; | 3721 | uint8_t val; |
| 2386 | char name[32]; | 3722 | char name[32]; |
| 2387 | uint32_t flags; | 3723 | uint32_t flags; |
| 2388 | } get_info; | 3724 | } get_info; |
| 2389 | }; | 3725 | }; |
| 2390 | } __packed; | 3726 | } __ec_todo_packed; |
| 2391 | 3727 | ||
| 2392 | enum gpio_get_subcmd { | 3728 | enum gpio_get_subcmd { |
| 2393 | EC_GPIO_GET_BY_NAME = 0, | 3729 | EC_GPIO_GET_BY_NAME = 0, |
| @@ -2399,25 +3735,28 @@ enum gpio_get_subcmd { · 5 unmodified lines | |||
| 2399 | /* I2C commands. Only available when flash write protect is unlocked. */ | 3735 | /* I2C commands. Only available when flash write protect is unlocked. */ |
| 2400 | 3736 | ||
| 2401 | /* | 3737 | /* |
| 2402 | * TODO(crosbug.com/p/23570): These commands are deprecated, and will be | 3738 | * CAUTION: These commands are deprecated, and are not supported anymore in EC |
| 2403 | * removed soon. Use EC_CMD_I2C_XFER instead. | 3739 | * builds >= 8398.0.0 (see crosbug.com/p/23570). |
| 3740 | * | ||
| 3741 | * Use EC_CMD_I2C_PASSTHRU instead. | ||
| 2404 | */ | 3742 | */ |
| 2405 | 3743 | ||
| 2406 | /* Read I2C bus */ | 3744 | /* Read I2C bus */ |
| 2407 | #define EC_CMD_I2C_READ 0x94 | 3745 | #define EC_CMD_I2C_READ 0x0094 |
| 2408 | 3746 | ||
| 2409 | struct ec_params_i2c_read { | 3747 | struct ec_params_i2c_read { |
| 2410 | uint16_t addr; /* 8-bit address (7-bit shifted << 1) */ | 3748 | uint16_t addr; /* 8-bit address (7-bit shifted << 1) */ |
| 2411 | uint8_t read_size; /* Either 8 or 16. */ | 3749 | uint8_t read_size; /* Either 8 or 16. */ |
| 2412 | uint8_t port; | 3750 | uint8_t port; |
| 2413 | uint8_t offset; | 3751 | uint8_t offset; |
| 2414 | } __packed; | 3752 | } __ec_align_size1; |
| 3753 | |||
| 2415 | struct ec_response_i2c_read { | 3754 | struct ec_response_i2c_read { |
| 2416 | uint16_t data; | 3755 | uint16_t data; |
| 2417 | } __packed; | 3756 | } __ec_align2; |
| 2418 | 3757 | ||
| 2419 | /* Write I2C bus */ | 3758 | /* Write I2C bus */ |
| 2420 | #define EC_CMD_I2C_WRITE 0x95 | 3759 | #define EC_CMD_I2C_WRITE 0x0095 |
| 2421 | 3760 | ||
| 2422 | struct ec_params_i2c_write { | 3761 | struct ec_params_i2c_write { |
| 2423 | uint16_t data; | 3762 | uint16_t data; |
| @@ -2425,7 +3764,7 @@ struct ec_params_i2c_write { · 1 unmodified line | |||
| 2425 | uint8_t write_size; /* Either 8 or 16. */ | 3764 | uint8_t write_size; /* Either 8 or 16. */ |
| 2426 | uint8_t port; | 3765 | uint8_t port; |
| 2427 | uint8_t offset; | 3766 | uint8_t offset; |
| 2428 | } __packed; | 3767 | } __ec_align_size1; |
| 2429 | 3768 | ||
| 2430 | /*****************************************************************************/ | 3769 | /*****************************************************************************/ |
| 2431 | /* Charge state commands. Only available when flash write protect unlocked. */ | 3770 | /* Charge state commands. Only available when flash write protect unlocked. */ |
| @@ -2433,7 +3772,7 @@ struct ec_params_i2c_write { · 1 unmodified line | |||
| 2433 | /* Force charge state machine to stop charging the battery or force it to | 3772 | /* Force charge state machine to stop charging the battery or force it to |
| 2434 | * discharge the battery. | 3773 | * discharge the battery. |
| 2435 | */ | 3774 | */ |
| 2436 | #define EC_CMD_CHARGE_CONTROL 0x96 | 3775 | #define EC_CMD_CHARGE_CONTROL 0x0096 |
| 2437 | #define EC_VER_CHARGE_CONTROL 1 | 3776 | #define EC_VER_CHARGE_CONTROL 1 |
| 2438 | 3777 | ||
| 2439 | enum ec_charge_control_mode { | 3778 | enum ec_charge_control_mode { |
| @@ -2444,13 +3783,12 @@ enum ec_charge_control_mode { · 4 unmodified lines | |||
| 2444 | 3783 | ||
| 2445 | struct ec_params_charge_control { | 3784 | struct ec_params_charge_control { |
| 2446 | uint32_t mode; /* enum charge_control_mode */ | 3785 | uint32_t mode; /* enum charge_control_mode */ |
| 2447 | } __packed; | 3786 | } __ec_align4; |
| 2448 | 3787 | ||
| 2449 | /*****************************************************************************/ | 3788 | /*****************************************************************************/ |
| 2450 | /* Console commands. Only available when flash write protect is unlocked. */ | ||
| 2451 | 3789 | ||
| 2452 | /* Snapshot console output buffer for use by EC_CMD_CONSOLE_READ. */ | 3790 | /* Snapshot console output buffer for use by EC_CMD_CONSOLE_READ. */ |
| 2453 | #define EC_CMD_CONSOLE_SNAPSHOT 0x97 | 3791 | #define EC_CMD_CONSOLE_SNAPSHOT 0x0097 |
| 2454 | 3792 | ||
| 2455 | /* | 3793 | /* |
| 2456 | * Read data from the saved snapshot. If the subcmd parameter is | 3794 | * Read data from the saved snapshot. If the subcmd parameter is |
| @@ -2464,7 +3802,7 @@ struct ec_params_charge_control { · 7 unmodified lines | |||
| 2464 | * Response is null-terminated string. Empty string, if there is no more | 3802 | * Response is null-terminated string. Empty string, if there is no more |
| 2465 | * remaining output. | 3803 | * remaining output. |
| 2466 | */ | 3804 | */ |
| 2467 | #define EC_CMD_CONSOLE_READ 0x98 | 3805 | #define EC_CMD_CONSOLE_READ 0x0098 |
| 2468 | 3806 | ||
| 2469 | enum ec_console_read_subcmd { | 3807 | enum ec_console_read_subcmd { |
| 2470 | CONSOLE_READ_NEXT = 0, | 3808 | CONSOLE_READ_NEXT = 0, |
| @@ -2473,7 +3811,7 @@ enum ec_console_read_subcmd { · 2 unmodified lines | |||
| 2473 | 3811 | ||
| 2474 | struct ec_params_console_read_v1 { | 3812 | struct ec_params_console_read_v1 { |
| 2475 | uint8_t subcmd; /* enum ec_console_read_subcmd */ | 3813 | uint8_t subcmd; /* enum ec_console_read_subcmd */ |
| 2476 | } __packed; | 3814 | } __ec_align1; |
| 2477 | 3815 | ||
| 2478 | /*****************************************************************************/ | 3816 | /*****************************************************************************/ |
| 2479 | 3817 | ||
| @@ -2484,14 +3822,13 @@ struct ec_params_console_read_v1 { · 4 unmodified lines | |||
| 2484 | * EC_RES_SUCCESS if the command was successful. | 3822 | * EC_RES_SUCCESS if the command was successful. |
| 2485 | * EC_RES_ERROR if the cut off command failed. | 3823 | * EC_RES_ERROR if the cut off command failed. |
| 2486 | */ | 3824 | */ |
| 3825 | #define EC_CMD_BATTERY_CUT_OFF 0x0099 | ||
| 2487 | 3826 | ||
| 2488 | #define EC_CMD_BATTERY_CUT_OFF 0x99 | 3827 | #define EC_BATTERY_CUTOFF_FLAG_AT_SHUTDOWN BIT(0) |
| 2489 | |||
| 2490 | #define EC_BATTERY_CUTOFF_FLAG_AT_SHUTDOWN (1 << 0) | ||
| 2491 | 3828 | ||
| 2492 | struct ec_params_battery_cutoff { | 3829 | struct ec_params_battery_cutoff { |
| 2493 | uint8_t flags; | 3830 | uint8_t flags; |
| 2494 | } __packed; | 3831 | } __ec_align1; |
| 2495 | 3832 | ||
| 2496 | /*****************************************************************************/ | 3833 | /*****************************************************************************/ |
| 2497 | /* USB port mux control. */ | 3834 | /* USB port mux control. */ |
| @@ -2499,11 +3836,11 @@ struct ec_params_battery_cutoff { · 1 unmodified line | |||
| 2499 | /* | 3836 | /* |
| 2500 | * Switch USB mux or return to automatic switching. | 3837 | * Switch USB mux or return to automatic switching. |
| 2501 | */ | 3838 | */ |
| 2502 | #define EC_CMD_USB_MUX 0x9a | 3839 | #define EC_CMD_USB_MUX 0x009A |
| 2503 | 3840 | ||
| 2504 | struct ec_params_usb_mux { | 3841 | struct ec_params_usb_mux { |
| 2505 | uint8_t mux; | 3842 | uint8_t mux; |
| 2506 | } __packed; | 3843 | } __ec_align1; |
| 2507 | 3844 | ||
| 2508 | /*****************************************************************************/ | 3845 | /*****************************************************************************/ |
| 2509 | /* LDOs / FETs control. */ | 3846 | /* LDOs / FETs control. */ |
| @@ -2516,25 +3853,25 @@ enum ec_ldo_state { · 6 unmodified lines | |||
| 2516 | /* | 3853 | /* |
| 2517 | * Switch on/off a LDO. | 3854 | * Switch on/off a LDO. |
| 2518 | */ | 3855 | */ |
| 2519 | #define EC_CMD_LDO_SET 0x9b | 3856 | #define EC_CMD_LDO_SET 0x009B |
| 2520 | 3857 | ||
| 2521 | struct ec_params_ldo_set { | 3858 | struct ec_params_ldo_set { |
| 2522 | uint8_t index; | 3859 | uint8_t index; |
| 2523 | uint8_t state; | 3860 | uint8_t state; |
| 2524 | } __packed; | 3861 | } __ec_align1; |
| 2525 | 3862 | ||
| 2526 | /* | 3863 | /* |
| 2527 | * Get LDO state. | 3864 | * Get LDO state. |
| 2528 | */ | 3865 | */ |
| 2529 | #define EC_CMD_LDO_GET 0x9c | 3866 | #define EC_CMD_LDO_GET 0x009C |
| 2530 | 3867 | ||
| 2531 | struct ec_params_ldo_get { | 3868 | struct ec_params_ldo_get { |
| 2532 | uint8_t index; | 3869 | uint8_t index; |
| 2533 | } __packed; | 3870 | } __ec_align1; |
| 2534 | 3871 | ||
| 2535 | struct ec_response_ldo_get { | 3872 | struct ec_response_ldo_get { |
| 2536 | uint8_t state; | 3873 | uint8_t state; |
| 2537 | } __packed; | 3874 | } __ec_align1; |
| 2538 | 3875 | ||
| 2539 | /*****************************************************************************/ | 3876 | /*****************************************************************************/ |
| 2540 | /* Power info. */ | 3877 | /* Power info. */ |
| @@ -2542,7 +3879,7 @@ struct ec_response_ldo_get { · 1 unmodified line | |||
| 2542 | /* | 3879 | /* |
| 2543 | * Get power info. | 3880 | * Get power info. |
| 2544 | */ | 3881 | */ |
| 2545 | #define EC_CMD_POWER_INFO 0x9d | 3882 | #define EC_CMD_POWER_INFO 0x009D |
| 2546 | 3883 | ||
| 2547 | struct ec_response_power_info { | 3884 | struct ec_response_power_info { |
| 2548 | uint32_t usb_dev_type; | 3885 | uint32_t usb_dev_type; |
| @@ -2550,21 +3887,21 @@ struct ec_response_power_info { · 1 unmodified line | |||
| 2550 | uint16_t voltage_system; | 3887 | uint16_t voltage_system; |
| 2551 | uint16_t current_system; | 3888 | uint16_t current_system; |
| 2552 | uint16_t usb_current_limit; | 3889 | uint16_t usb_current_limit; |
| 2553 | } __packed; | 3890 | } __ec_align4; |
| 2554 | 3891 | ||
| 2555 | /*****************************************************************************/ | 3892 | /*****************************************************************************/ |
| 2556 | /* I2C passthru command */ | 3893 | /* I2C passthru command */ |
| 2557 | 3894 | ||
| 2558 | #define EC_CMD_I2C_PASSTHRU 0x9e | 3895 | #define EC_CMD_I2C_PASSTHRU 0x009E |
| 2559 | 3896 | ||
| 2560 | /* Read data; if not present, message is a write */ | 3897 | /* Read data; if not present, message is a write */ |
| 2561 | #define EC_I2C_FLAG_READ (1 << 15) | 3898 | #define EC_I2C_FLAG_READ BIT(15) |
| 2562 | 3899 | ||
| 2563 | /* Mask for address */ | 3900 | /* Mask for address */ |
| 2564 | #define EC_I2C_ADDR_MASK 0x3ff | 3901 | #define EC_I2C_ADDR_MASK 0x3ff |
| 2565 | 3902 | ||
| 2566 | #define EC_I2C_STATUS_NAK (1 << 0) /* Transfer was not acknowledged */ | 3903 | #define EC_I2C_STATUS_NAK BIT(0) /* Transfer was not acknowledged */ |
| 2567 | #define EC_I2C_STATUS_TIMEOUT (1 << 1) /* Timeout during transfer */ | 3904 | #define EC_I2C_STATUS_TIMEOUT BIT(1) /* Timeout during transfer */ |
| 2568 | 3905 | ||
| 2569 | /* Any error */ | 3906 | /* Any error */ |
| 2570 | #define EC_I2C_STATUS_ERROR (EC_I2C_STATUS_NAK | EC_I2C_STATUS_TIMEOUT) | 3907 | #define EC_I2C_STATUS_ERROR (EC_I2C_STATUS_NAK | EC_I2C_STATUS_TIMEOUT) |
| @@ -2572,49 +3909,49 @@ struct ec_response_power_info { · 1 unmodified line | |||
| 2572 | struct ec_params_i2c_passthru_msg { | 3909 | struct ec_params_i2c_passthru_msg { |
| 2573 | uint16_t addr_flags; /* I2C slave address (7 or 10 bits) and flags */ | 3910 | uint16_t addr_flags; /* I2C slave address (7 or 10 bits) and flags */ |
| 2574 | uint16_t len; /* Number of bytes to read or write */ | 3911 | uint16_t len; /* Number of bytes to read or write */ |
| 2575 | } __packed; | 3912 | } __ec_align2; |
| 2576 | 3913 | ||
| 2577 | struct ec_params_i2c_passthru { | 3914 | struct ec_params_i2c_passthru { |
| 2578 | uint8_t port; /* I2C port number */ | 3915 | uint8_t port; /* I2C port number */ |
| 2579 | uint8_t num_msgs; /* Number of messages */ | 3916 | uint8_t num_msgs; /* Number of messages */ |
| 2580 | struct ec_params_i2c_passthru_msg msg[]; | 3917 | struct ec_params_i2c_passthru_msg msg[]; |
| 2581 | /* Data to write for all messages is concatenated here */ | 3918 | /* Data to write for all messages is concatenated here */ |
| 2582 | } __packed; | 3919 | } __ec_align2; |
| 2583 | 3920 | ||
| 2584 | struct ec_response_i2c_passthru { | 3921 | struct ec_response_i2c_passthru { |
| 2585 | uint8_t i2c_status; /* Status flags (EC_I2C_STATUS_...) */ | 3922 | uint8_t i2c_status; /* Status flags (EC_I2C_STATUS_...) */ |
| 2586 | uint8_t num_msgs; /* Number of messages processed */ | 3923 | uint8_t num_msgs; /* Number of messages processed */ |
| 2587 | uint8_t data[]; /* Data read by messages concatenated here */ | 3924 | uint8_t data[]; /* Data read by messages concatenated here */ |
| 2588 | } __packed; | 3925 | } __ec_align1; |
| 2589 | 3926 | ||
| 2590 | /*****************************************************************************/ | 3927 | /*****************************************************************************/ |
| 2591 | /* Power button hang detect */ | 3928 | /* Power button hang detect */ |
| 2592 | 3929 | ||
| 2593 | #define EC_CMD_HANG_DETECT 0x9f | 3930 | #define EC_CMD_HANG_DETECT 0x009F |
| 2594 | 3931 | ||
| 2595 | /* Reasons to start hang detection timer */ | 3932 | /* Reasons to start hang detection timer */ |
| 2596 | /* Power button pressed */ | 3933 | /* Power button pressed */ |
| 2597 | #define EC_HANG_START_ON_POWER_PRESS (1 << 0) | 3934 | #define EC_HANG_START_ON_POWER_PRESS BIT(0) |
| 2598 | 3935 | ||
| 2599 | /* Lid closed */ | 3936 | /* Lid closed */ |
| 2600 | #define EC_HANG_START_ON_LID_CLOSE (1 << 1) | 3937 | #define EC_HANG_START_ON_LID_CLOSE BIT(1) |
| 2601 | 3938 | ||
| 2602 | /* Lid opened */ | 3939 | /* Lid opened */ |
| 2603 | #define EC_HANG_START_ON_LID_OPEN (1 << 2) | 3940 | #define EC_HANG_START_ON_LID_OPEN BIT(2) |
| 2604 | 3941 | ||
| 2605 | /* Start of AP S3->S0 transition (booting or resuming from suspend) */ | 3942 | /* Start of AP S3->S0 transition (booting or resuming from suspend) */ |
| 2606 | #define EC_HANG_START_ON_RESUME (1 << 3) | 3943 | #define EC_HANG_START_ON_RESUME BIT(3) |
| 2607 | 3944 | ||
| 2608 | /* Reasons to cancel hang detection */ | 3945 | /* Reasons to cancel hang detection */ |
| 2609 | 3946 | ||
| 2610 | /* Power button released */ | 3947 | /* Power button released */ |
| 2611 | #define EC_HANG_STOP_ON_POWER_RELEASE (1 << 8) | 3948 | #define EC_HANG_STOP_ON_POWER_RELEASE BIT(8) |
| 2612 | 3949 | ||
| 2613 | /* Any host command from AP received */ | 3950 | /* Any host command from AP received */ |
| 2614 | #define EC_HANG_STOP_ON_HOST_COMMAND (1 << 9) | 3951 | #define EC_HANG_STOP_ON_HOST_COMMAND BIT(9) |
| 2615 | 3952 | ||
| 2616 | /* Stop on end of AP S0->S3 transition (suspending or shutting down) */ | 3953 | /* Stop on end of AP S0->S3 transition (suspending or shutting down) */ |
| 2617 | #define EC_HANG_STOP_ON_SUSPEND (1 << 10) | 3954 | #define EC_HANG_STOP_ON_SUSPEND BIT(10) |
| 2618 | 3955 | ||
| 2619 | /* | 3956 | /* |
| 2620 | * If this flag is set, all the other fields are ignored, and the hang detect | 3957 | * If this flag is set, all the other fields are ignored, and the hang detect |
| @@ -2622,14 +3959,14 @@ struct ec_response_i2c_passthru { · 1 unmodified line | |||
| 2622 | * without reconfiguring any of the other hang detect settings. Note that | 3959 | * without reconfiguring any of the other hang detect settings. Note that |
| 2623 | * you must previously have configured the timeouts. | 3960 | * you must previously have configured the timeouts. |
| 2624 | */ | 3961 | */ |
| 2625 | #define EC_HANG_START_NOW (1 << 30) | 3962 | #define EC_HANG_START_NOW BIT(30) |
| 2626 | 3963 | ||
| 2627 | /* | 3964 | /* |
| 2628 | * If this flag is set, all the other fields are ignored (including | 3965 | * If this flag is set, all the other fields are ignored (including |
| 2629 | * EC_HANG_START_NOW). This provides the AP a way to stop the hang timer | 3966 | * EC_HANG_START_NOW). This provides the AP a way to stop the hang timer |
| 2630 | * without reconfiguring any of the other hang detect settings. | 3967 | * without reconfiguring any of the other hang detect settings. |
| 2631 | */ | 3968 | */ |
| 2632 | #define EC_HANG_STOP_NOW (1 << 31) | 3969 | #define EC_HANG_STOP_NOW BIT(31) |
| 2633 | 3970 | ||
| 2634 | struct ec_params_hang_detect { | 3971 | struct ec_params_hang_detect { |
| 2635 | /* Flags; see EC_HANG_* */ | 3972 | /* Flags; see EC_HANG_* */ |
| @@ -2640,7 +3977,7 @@ struct ec_params_hang_detect { · 4 unmodified lines | |||
| 2640 | 3977 | ||
| 2641 | /* Timeout in msec before generating warm reboot, if enabled */ | 3978 | /* Timeout in msec before generating warm reboot, if enabled */ |
| 2642 | uint16_t warm_reboot_timeout_msec; | 3979 | uint16_t warm_reboot_timeout_msec; |
| 2643 | } __packed; | 3980 | } __ec_align4; |
| 2644 | 3981 | ||
| 2645 | /*****************************************************************************/ | 3982 | /*****************************************************************************/ |
| 2646 | /* Commands for battery charging */ | 3983 | /* Commands for battery charging */ |
| @@ -2649,7 +3986,7 @@ struct ec_params_hang_detect { · 2 unmodified lines | |||
| 2649 | * This is the single catch-all host command to exchange data regarding the | 3986 | * This is the single catch-all host command to exchange data regarding the |
| 2650 | * charge state machine (v2 and up). | 3987 | * charge state machine (v2 and up). |
| 2651 | */ | 3988 | */ |
| 2652 | #define EC_CMD_CHARGE_STATE 0xa0 | 3989 | #define EC_CMD_CHARGE_STATE 0x00A0 |
| 2653 | 3990 | ||
| 2654 | /* Subcommands for this host command */ | 3991 | /* Subcommands for this host command */ |
| 2655 | enum charge_state_command { | 3992 | enum charge_state_command { |
| @@ -2669,6 +4006,11 @@ enum charge_state_params { · 13 unmodified lines | |||
| 2669 | CS_PARAM_CHG_INPUT_CURRENT, /* charger input current limit */ | 4006 | CS_PARAM_CHG_INPUT_CURRENT, /* charger input current limit */ |
| 2670 | CS_PARAM_CHG_STATUS, /* charger-specific status */ | 4007 | CS_PARAM_CHG_STATUS, /* charger-specific status */ |
| 2671 | CS_PARAM_CHG_OPTION, /* charger-specific options */ | 4008 | CS_PARAM_CHG_OPTION, /* charger-specific options */ |
| 4009 | CS_PARAM_LIMIT_POWER, /* | ||
| 4010 | * Check if power is limited due to | ||
| 4011 | * low battery and / or a weak external | ||
| 4012 | * charger. READ ONLY. | ||
| 4013 | */ | ||
| 2672 | /* How many so far? */ | 4014 | /* How many so far? */ |
| 2673 | CS_NUM_BASE_PARAMS, | 4015 | CS_NUM_BASE_PARAMS, |
| 2674 | 4016 | ||
| @@ -2676,30 +4018,39 @@ enum charge_state_params { · 1 unmodified line | |||
| 2676 | CS_PARAM_CUSTOM_PROFILE_MIN = 0x10000, | 4018 | CS_PARAM_CUSTOM_PROFILE_MIN = 0x10000, |
| 2677 | CS_PARAM_CUSTOM_PROFILE_MAX = 0x1ffff, | 4019 | CS_PARAM_CUSTOM_PROFILE_MAX = 0x1ffff, |
| 2678 | 4020 | ||
| 4021 | /* Range for CONFIG_CHARGE_STATE_DEBUG params */ | ||
| 4022 | CS_PARAM_DEBUG_MIN = 0x20000, | ||
| 4023 | CS_PARAM_DEBUG_CTL_MODE = 0x20000, | ||
| 4024 | CS_PARAM_DEBUG_MANUAL_MODE, | ||
| 4025 | CS_PARAM_DEBUG_SEEMS_DEAD, | ||
| 4026 | CS_PARAM_DEBUG_SEEMS_DISCONNECTED, | ||
| 4027 | CS_PARAM_DEBUG_BATT_REMOVED, | ||
| 4028 | CS_PARAM_DEBUG_MANUAL_CURRENT, | ||
| 4029 | CS_PARAM_DEBUG_MANUAL_VOLTAGE, | ||
| 4030 | CS_PARAM_DEBUG_MAX = 0x2ffff, | ||
| 4031 | |||
| 2679 | /* Other custom param ranges go here... */ | 4032 | /* Other custom param ranges go here... */ |
| 2680 | }; | 4033 | }; |
| 2681 | 4034 | ||
| 2682 | struct ec_params_charge_state { | 4035 | struct ec_params_charge_state { |
| 2683 | uint8_t cmd; /* enum charge_state_command */ | 4036 | uint8_t cmd; /* enum charge_state_command */ |
| 2684 | union { | 4037 | union { |
| 2685 | struct { | 4038 | /* get_state has no args */ |
| 2686 | /* no args */ | ||
| 2687 | } get_state; | ||
| 2688 | 4039 | ||
| 2689 | struct { | 4040 | struct __ec_todo_unpacked { |
| 2690 | uint32_t param; /* enum charge_state_param */ | 4041 | uint32_t param; /* enum charge_state_param */ |
| 2691 | } get_param; | 4042 | } get_param; |
| 2692 | 4043 | ||
| 2693 | struct { | 4044 | struct __ec_todo_unpacked { |
| 2694 | uint32_t param; /* param to set */ | 4045 | uint32_t param; /* param to set */ |
| 2695 | uint32_t value; /* value to set */ | 4046 | uint32_t value; /* value to set */ |
| 2696 | } set_param; | 4047 | } set_param; |
| 2697 | }; | 4048 | }; |
| 2698 | } __packed; | 4049 | } __ec_todo_packed; |
| 2699 | 4050 | ||
| 2700 | struct ec_response_charge_state { | 4051 | struct ec_response_charge_state { |
| 2701 | union { | 4052 | union { |
| 2702 | struct { | 4053 | struct __ec_align4 { |
| 2703 | int ac; | 4054 | int ac; |
| 2704 | int chg_voltage; | 4055 | int chg_voltage; |
| 2705 | int chg_current; | 4056 | int chg_current; |
| @@ -2707,24 +4058,23 @@ struct ec_response_charge_state { · 1 unmodified line | |||
| 2707 | int batt_state_of_charge; | 4058 | int batt_state_of_charge; |
| 2708 | } get_state; | 4059 | } get_state; |
| 2709 | 4060 | ||
| 2710 | struct { | 4061 | struct __ec_align4 { |
| 2711 | uint32_t value; | 4062 | uint32_t value; |
| 2712 | } get_param; | 4063 | } get_param; |
| 2713 | struct { | 4064 | |
| 2714 | /* no return values */ | 4065 | /* set_param returns no args */ |
| 2715 | } set_param; | ||
| 2716 | }; | 4066 | }; |
| 2717 | } __packed; | 4067 | } __ec_align4; |
| 2718 | 4068 | ||
| 2719 | 4069 | ||
| 2720 | /* | 4070 | /* |
| 2721 | * Set maximum battery charging current. | 4071 | * Set maximum battery charging current. |
| 2722 | */ | 4072 | */ |
| 2723 | #define EC_CMD_CHARGE_CURRENT_LIMIT 0xa1 | 4073 | #define EC_CMD_CHARGE_CURRENT_LIMIT 0x00A1 |
| 2724 | 4074 | ||
| 2725 | struct ec_params_current_limit { | 4075 | struct ec_params_current_limit { |
| 2726 | uint32_t limit; /* in mA */ | 4076 | uint32_t limit; /* in mA */ |
| 2727 | } __packed; | 4077 | } __ec_align4; |
| 2728 | 4078 | ||
| 2729 | /* | 4079 | /* |
| 2730 | * Set maximum external voltage / current. | 4080 | * Set maximum external voltage / current. |
| @@ -2735,23 +4085,69 @@ struct ec_params_current_limit { · 4 unmodified lines | |||
| 2735 | struct ec_params_external_power_limit_v1 { | 4085 | struct ec_params_external_power_limit_v1 { |
| 2736 | uint16_t current_lim; /* in mA, or EC_POWER_LIMIT_NONE to clear limit */ | 4086 | uint16_t current_lim; /* in mA, or EC_POWER_LIMIT_NONE to clear limit */ |
| 2737 | uint16_t voltage_lim; /* in mV, or EC_POWER_LIMIT_NONE to clear limit */ | 4087 | uint16_t voltage_lim; /* in mV, or EC_POWER_LIMIT_NONE to clear limit */ |
| 2738 | } __packed; | 4088 | } __ec_align2; |
| 2739 | 4089 | ||
| 2740 | #define EC_POWER_LIMIT_NONE 0xffff | 4090 | #define EC_POWER_LIMIT_NONE 0xffff |
| 2741 | 4091 | ||
| 4092 | /* | ||
| 4093 | * Set maximum voltage & current of a dedicated charge port | ||
| 4094 | */ | ||
| 4095 | #define EC_CMD_OVERRIDE_DEDICATED_CHARGER_LIMIT 0x00A3 | ||
| 4096 | |||
| 4097 | struct ec_params_dedicated_charger_limit { | ||
| 4098 | uint16_t current_lim; /* in mA */ | ||
| 4099 | uint16_t voltage_lim; /* in mV */ | ||
| 4100 | } __ec_align2; | ||
| 4101 | |||
| 4102 | /*****************************************************************************/ | ||
| 4103 | /* Hibernate/Deep Sleep Commands */ | ||
| 4104 | |||
| 4105 | /* Set the delay before going into hibernation. */ | ||
| 4106 | #define EC_CMD_HIBERNATION_DELAY 0x00A8 | ||
| 4107 | |||
| 4108 | struct ec_params_hibernation_delay { | ||
| 4109 | /* | ||
| 4110 | * Seconds to wait in G3 before hibernate. Pass in 0 to read the | ||
| 4111 | * current settings without changing them. | ||
| 4112 | */ | ||
| 4113 | uint32_t seconds; | ||
| 4114 | } __ec_align4; | ||
| 4115 | |||
| 4116 | struct ec_response_hibernation_delay { | ||
| 4117 | /* | ||
| 4118 | * The current time in seconds in which the system has been in the G3 | ||
| 4119 | * state. This value is reset if the EC transitions out of G3. | ||
| 4120 | */ | ||
| 4121 | uint32_t time_g3; | ||
| 4122 | |||
| 4123 | /* | ||
| 4124 | * The current time remaining in seconds until the EC should hibernate. | ||
| 4125 | * This value is also reset if the EC transitions out of G3. | ||
| 4126 | */ | ||
| 4127 | uint32_t time_remaining; | ||
| 4128 | |||
| 4129 | /* | ||
| 4130 | * The current time in seconds that the EC should wait in G3 before | ||
| 4131 | * hibernating. | ||
| 4132 | */ | ||
| 4133 | uint32_t hibernate_delay; | ||
| 4134 | } __ec_align4; | ||
| 4135 | |||
| 2742 | /* Inform the EC when entering a sleep state */ | 4136 | /* Inform the EC when entering a sleep state */ |
| 2743 | #define EC_CMD_HOST_SLEEP_EVENT 0xa9 | 4137 | #define EC_CMD_HOST_SLEEP_EVENT 0x00A9 |
| 2744 | 4138 | ||
| 2745 | enum host_sleep_event { | 4139 | enum host_sleep_event { |
| 2746 | HOST_SLEEP_EVENT_S3_SUSPEND = 1, | 4140 | HOST_SLEEP_EVENT_S3_SUSPEND = 1, |
| 2747 | HOST_SLEEP_EVENT_S3_RESUME = 2, | 4141 | HOST_SLEEP_EVENT_S3_RESUME = 2, |
| 2748 | HOST_SLEEP_EVENT_S0IX_SUSPEND = 3, | 4142 | HOST_SLEEP_EVENT_S0IX_SUSPEND = 3, |
| 2749 | HOST_SLEEP_EVENT_S0IX_RESUME = 4 | 4143 | HOST_SLEEP_EVENT_S0IX_RESUME = 4, |
| 4144 | /* S3 suspend with additional enabled wake sources */ | ||
| 4145 | HOST_SLEEP_EVENT_S3_WAKEABLE_SUSPEND = 5, | ||
| 2750 | }; | 4146 | }; |
| 2751 | 4147 | ||
| 2752 | struct ec_params_host_sleep_event { | 4148 | struct ec_params_host_sleep_event { |
| 2753 | uint8_t sleep_event; | 4149 | uint8_t sleep_event; |
| 2754 | } __packed; | 4150 | } __ec_align1; |
| 2755 | 4151 | ||
| 2756 | /* | 4152 | /* |
| 2757 | * Use a default timeout value (CONFIG_SLEEP_TIMEOUT_MS) for detecting sleep | 4153 | * Use a default timeout value (CONFIG_SLEEP_TIMEOUT_MS) for detecting sleep |
| @@ -2782,7 +4178,7 @@ struct ec_params_host_sleep_event_v1 { · 24 unmodified lines | |||
| 2782 | 4178 | ||
| 2783 | /* No parameters for non-suspend messages. */ | 4179 | /* No parameters for non-suspend messages. */ |
| 2784 | }; | 4180 | }; |
| 2785 | } __packed; | 4181 | } __ec_align2; |
| 2786 | 4182 | ||
| 2787 | /* A timeout occurred when this bit is set */ | 4183 | /* A timeout occurred when this bit is set */ |
| 2788 | #define EC_HOST_RESUME_SLEEP_TIMEOUT 0x80000000 | 4184 | #define EC_HOST_RESUME_SLEEP_TIMEOUT 0x80000000 |
| @@ -2808,42 +4204,72 @@ struct ec_response_host_sleep_event_v1 { · 19 unmodified lines | |||
| 2808 | 4204 | ||
| 2809 | /* No response fields for non-resume messages. */ | 4205 | /* No response fields for non-resume messages. */ |
| 2810 | }; | 4206 | }; |
| 2811 | } __packed; | 4207 | } __ec_align4; |
| 4208 | |||
| 4209 | /*****************************************************************************/ | ||
| 4210 | /* Device events */ | ||
| 4211 | #define EC_CMD_DEVICE_EVENT 0x00AA | ||
| 4212 | |||
| 4213 | enum ec_device_event { | ||
| 4214 | EC_DEVICE_EVENT_TRACKPAD, | ||
| 4215 | EC_DEVICE_EVENT_DSP, | ||
| 4216 | EC_DEVICE_EVENT_WIFI, | ||
| 4217 | }; | ||
| 4218 | |||
| 4219 | enum ec_device_event_param { | ||
| 4220 | /* Get and clear pending device events */ | ||
| 4221 | EC_DEVICE_EVENT_PARAM_GET_CURRENT_EVENTS, | ||
| 4222 | /* Get device event mask */ | ||
| 4223 | EC_DEVICE_EVENT_PARAM_GET_ENABLED_EVENTS, | ||
| 4224 | /* Set device event mask */ | ||
| 4225 | EC_DEVICE_EVENT_PARAM_SET_ENABLED_EVENTS, | ||
| 4226 | }; | ||
| 4227 | |||
| 4228 | #define EC_DEVICE_EVENT_MASK(event_code) BIT(event_code % 32) | ||
| 4229 | |||
| 4230 | struct ec_params_device_event { | ||
| 4231 | uint32_t event_mask; | ||
| 4232 | uint8_t param; | ||
| 4233 | } __ec_align_size1; | ||
| 4234 | |||
| 4235 | struct ec_response_device_event { | ||
| 4236 | uint32_t event_mask; | ||
| 4237 | } __ec_align4; | ||
| 2812 | 4238 | ||
| 2813 | /*****************************************************************************/ | 4239 | /*****************************************************************************/ |
| 2814 | /* Smart battery pass-through */ | 4240 | /* Smart battery pass-through */ |
| 2815 | 4241 | ||
| 2816 | /* Get / Set 16-bit smart battery registers */ | 4242 | /* Get / Set 16-bit smart battery registers */ |
| 2817 | #define EC_CMD_SB_READ_WORD 0xb0 | 4243 | #define EC_CMD_SB_READ_WORD 0x00B0 |
| 2818 | #define EC_CMD_SB_WRITE_WORD 0xb1 | 4244 | #define EC_CMD_SB_WRITE_WORD 0x00B1 |
| 2819 | 4245 | ||
| 2820 | /* Get / Set string smart battery parameters | 4246 | /* Get / Set string smart battery parameters |
| 2821 | * formatted as SMBUS "block". | 4247 | * formatted as SMBUS "block". |
| 2822 | */ | 4248 | */ |
| 2823 | #define EC_CMD_SB_READ_BLOCK 0xb2 | 4249 | #define EC_CMD_SB_READ_BLOCK 0x00B2 |
| 2824 | #define EC_CMD_SB_WRITE_BLOCK 0xb3 | 4250 | #define EC_CMD_SB_WRITE_BLOCK 0x00B3 |
| 2825 | 4251 | ||
| 2826 | struct ec_params_sb_rd { | 4252 | struct ec_params_sb_rd { |
| 2827 | uint8_t reg; | 4253 | uint8_t reg; |
| 2828 | } __packed; | 4254 | } __ec_align1; |
| 2829 | 4255 | ||
| 2830 | struct ec_response_sb_rd_word { | 4256 | struct ec_response_sb_rd_word { |
| 2831 | uint16_t value; | 4257 | uint16_t value; |
| 2832 | } __packed; | 4258 | } __ec_align2; |
| 2833 | 4259 | ||
| 2834 | struct ec_params_sb_wr_word { | 4260 | struct ec_params_sb_wr_word { |
| 2835 | uint8_t reg; | 4261 | uint8_t reg; |
| 2836 | uint16_t value; | 4262 | uint16_t value; |
| 2837 | } __packed; | 4263 | } __ec_align1; |
| 2838 | 4264 | ||
| 2839 | struct ec_response_sb_rd_block { | 4265 | struct ec_response_sb_rd_block { |
| 2840 | uint8_t data[32]; | 4266 | uint8_t data[32]; |
| 2841 | } __packed; | 4267 | } __ec_align1; |
| 2842 | 4268 | ||
| 2843 | struct ec_params_sb_wr_block { | 4269 | struct ec_params_sb_wr_block { |
| 2844 | uint8_t reg; | 4270 | uint8_t reg; |
| 2845 | uint16_t data[32]; | 4271 | uint16_t data[32]; |
| 2846 | } __packed; | 4272 | } __ec_align1; |
| 2847 | 4273 | ||
| 2848 | /*****************************************************************************/ | 4274 | /*****************************************************************************/ |
| 2849 | /* Battery vendor parameters | 4275 | /* Battery vendor parameters |
| @@ -2854,7 +4280,7 @@ struct ec_params_sb_wr_block { · 4 unmodified lines | |||
| 2854 | * requested value. | 4280 | * requested value. |
| 2855 | */ | 4281 | */ |
| 2856 | 4282 | ||
| 2857 | #define EC_CMD_BATTERY_VENDOR_PARAM 0xb4 | 4283 | #define EC_CMD_BATTERY_VENDOR_PARAM 0x00B4 |
| 2858 | 4284 | ||
| 2859 | enum ec_battery_vendor_param_mode { | 4285 | enum ec_battery_vendor_param_mode { |
| 2860 | BATTERY_VENDOR_PARAM_MODE_GET = 0, | 4286 | BATTERY_VENDOR_PARAM_MODE_GET = 0, |
| @@ -2865,257 +4291,105 @@ struct ec_params_battery_vendor_param { · 4 unmodified lines | |||
| 2865 | uint32_t param; | 4291 | uint32_t param; |
| 2866 | uint32_t value; | 4292 | uint32_t value; |
| 2867 | uint8_t mode; | 4293 | uint8_t mode; |
| 2868 | } __packed; | 4294 | } __ec_align_size1; |
| 2869 | 4295 | ||
| 2870 | struct ec_response_battery_vendor_param { | 4296 | struct ec_response_battery_vendor_param { |
| 2871 | uint32_t value; | 4297 | uint32_t value; |
| 2872 | } __packed; | 4298 | } __ec_align4; |
| 2873 | 4299 | ||
| 2874 | /*****************************************************************************/ | 4300 | /*****************************************************************************/ |
| 2875 | /* Commands for I2S recording on audio codec. */ | 4301 | /* |
| 2876 | 4302 | * Smart Battery Firmware Update Commands | |
| 2877 | #define EC_CMD_CODEC_I2S 0x00BC | 4303 | */ |
| 2878 | 4304 | #define EC_CMD_SB_FW_UPDATE 0x00B5 | |
| 2879 | enum ec_codec_i2s_subcmd { | 4305 | |
| 2880 | EC_CODEC_SET_SAMPLE_DEPTH = 0x0, | 4306 | enum ec_sb_fw_update_subcmd { |
| 2881 | EC_CODEC_SET_GAIN = 0x1, | 4307 | EC_SB_FW_UPDATE_PREPARE = 0x0, |
| 2882 | EC_CODEC_GET_GAIN = 0x2, | 4308 | EC_SB_FW_UPDATE_INFO = 0x1, /*query sb info */ |
| 2883 | EC_CODEC_I2S_ENABLE = 0x3, | 4309 | EC_SB_FW_UPDATE_BEGIN = 0x2, /*check if protected */ |
| 2884 | EC_CODEC_I2S_SET_CONFIG = 0x4, | 4310 | EC_SB_FW_UPDATE_WRITE = 0x3, /*check if protected */ |
| 2885 | EC_CODEC_I2S_SET_TDM_CONFIG = 0x5, | 4311 | EC_SB_FW_UPDATE_END = 0x4, |
| 2886 | EC_CODEC_I2S_SET_BCLK = 0x6, | 4312 | EC_SB_FW_UPDATE_STATUS = 0x5, |
| 4313 | EC_SB_FW_UPDATE_PROTECT = 0x6, | ||
| 4314 | EC_SB_FW_UPDATE_MAX = 0x7, | ||
| 2887 | }; | 4315 | }; |
| 2888 | 4316 | ||
| 2889 | enum ec_sample_depth_value { | 4317 | #define SB_FW_UPDATE_CMD_WRITE_BLOCK_SIZE 32 |
| 2890 | EC_CODEC_SAMPLE_DEPTH_16 = 0, | 4318 | #define SB_FW_UPDATE_CMD_STATUS_SIZE 2 |
| 2891 | EC_CODEC_SAMPLE_DEPTH_24 = 1, | 4319 | #define SB_FW_UPDATE_CMD_INFO_SIZE 8 |
| 2892 | }; | ||
| 2893 | 4320 | ||
| 2894 | enum ec_i2s_config { | 4321 | struct ec_sb_fw_update_header { |
| 2895 | EC_DAI_FMT_I2S = 0, | 4322 | uint16_t subcmd; /* enum ec_sb_fw_update_subcmd */ |
| 2896 | EC_DAI_FMT_RIGHT_J = 1, | 4323 | uint16_t fw_id; /* firmware id */ |
| 2897 | EC_DAI_FMT_LEFT_J = 2, | 4324 | } __ec_align4; |
| 2898 | EC_DAI_FMT_PCM_A = 3, | ||
| 2899 | EC_DAI_FMT_PCM_B = 4, | ||
| 2900 | EC_DAI_FMT_PCM_TDM = 5, | ||
| 2901 | }; | ||
| 2902 | 4325 | ||
| 2903 | struct ec_param_codec_i2s { | 4326 | struct ec_params_sb_fw_update { |
| 2904 | /* | 4327 | struct ec_sb_fw_update_header hdr; |
| 2905 | * enum ec_codec_i2s_subcmd | ||
| 2906 | */ | ||
| 2907 | uint8_t cmd; | ||
| 2908 | union { | 4328 | union { |
| 2909 | /* | 4329 | /* EC_SB_FW_UPDATE_PREPARE = 0x0 */ |
| 2910 | * EC_CODEC_SET_SAMPLE_DEPTH | 4330 | /* EC_SB_FW_UPDATE_INFO = 0x1 */ |
| 2911 | * Value should be one of ec_sample_depth_value. | 4331 | /* EC_SB_FW_UPDATE_BEGIN = 0x2 */ |
| 2912 | */ | 4332 | /* EC_SB_FW_UPDATE_END = 0x4 */ |
| 2913 | uint8_t depth; | 4333 | /* EC_SB_FW_UPDATE_STATUS = 0x5 */ |
| 4334 | /* EC_SB_FW_UPDATE_PROTECT = 0x6 */ | ||
| 4335 | /* Those have no args */ | ||
| 4336 | |||
| 4337 | /* EC_SB_FW_UPDATE_WRITE = 0x3 */ | ||
| 4338 | struct __ec_align4 { | ||
| 4339 | uint8_t data[SB_FW_UPDATE_CMD_WRITE_BLOCK_SIZE]; | ||
| 4340 | } write; | ||
| 4341 | }; | ||
| 4342 | } __ec_align4; | ||
| 2914 | 4343 | ||
| 2915 | /* | 4344 | struct ec_response_sb_fw_update { |
| 2916 | * EC_CODEC_SET_GAIN | 4345 | union { |
| 2917 | * Value should be 0~43 for both channels. | 4346 | /* EC_SB_FW_UPDATE_INFO = 0x1 */ |
| 2918 | */ | 4347 | struct __ec_align1 { |
| 2919 | struct ec_param_codec_i2s_set_gain { | 4348 | uint8_t data[SB_FW_UPDATE_CMD_INFO_SIZE]; |
| 2920 | uint8_t left; | 4349 | } info; |
| 2921 | uint8_t right; | ||
| 2922 | } __packed gain; | ||
| 2923 | 4350 | ||
| 2924 | /* | 4351 | /* EC_SB_FW_UPDATE_STATUS = 0x5 */ |
| 2925 | * EC_CODEC_I2S_ENABLE | 4352 | struct __ec_align1 { |
| 2926 | * 1 to enable, 0 to disable. | 4353 | uint8_t data[SB_FW_UPDATE_CMD_STATUS_SIZE]; |
| 2927 | */ | 4354 | } status; |
| 2928 | uint8_t i2s_enable; | 4355 | }; |
| 4356 | } __ec_align1; | ||
| 2929 | 4357 | ||
| 2930 | /* | 4358 | /* |
| 2931 | * EC_CODEC_I2S_SET_COFNIG | 4359 | * Entering Verified Boot Mode Command |
| 2932 | * Value should be one of ec_i2s_config. | 4360 | * Default mode is VBOOT_MODE_NORMAL if EC did not receive this command. |
| 2933 | */ | 4361 | * Valid Modes are: normal, developer, and recovery. |
| 2934 | uint8_t i2s_config; | 4362 | */ |
| 4363 | #define EC_CMD_ENTERING_MODE 0x00B6 | ||
| 2935 | 4364 | ||
| 2936 | /* | 4365 | struct ec_params_entering_mode { |
| 2937 | * EC_CODEC_I2S_SET_TDM_CONFIG | 4366 | int vboot_mode; |
| 2938 | * Value should be one of ec_i2s_config. | 4367 | } __ec_align4; |
| 2939 | */ | ||
| 2940 | struct ec_param_codec_i2s_tdm { | ||
| 2941 | /* | ||
| 2942 | * 0 to 496 | ||
| 2943 | */ | ||
| 2944 | int16_t ch0_delay; | ||
| 2945 | /* | ||
| 2946 | * -1 to 496 | ||
| 2947 | */ | ||
| 2948 | int16_t ch1_delay; | ||
| 2949 | uint8_t adjacent_to_ch0; | ||
| 2950 | uint8_t adjacent_to_ch1; | ||
| 2951 | } __packed tdm_param; | ||
| 2952 | 4368 | ||
| 2953 | /* | 4369 | #define VBOOT_MODE_NORMAL 0 |
| 2954 | * EC_CODEC_I2S_SET_BCLK | 4370 | #define VBOOT_MODE_DEVELOPER 1 |
| 2955 | */ | 4371 | #define VBOOT_MODE_RECOVERY 2 |
| 2956 | uint32_t bclk; | ||
| 2957 | }; | ||
| 2958 | } __packed; | ||
| 2959 | |||
| 2960 | /* | ||
| 2961 | * For subcommand EC_CODEC_GET_GAIN. | ||
| 2962 | */ | ||
| 2963 | struct ec_response_codec_gain { | ||
| 2964 | uint8_t left; | ||
| 2965 | uint8_t right; | ||
| 2966 | } __packed; | ||
| 2967 | 4372 | ||
| 2968 | /*****************************************************************************/ | 4373 | /*****************************************************************************/ |
| 2969 | /* System commands */ | ||
| 2970 | |||
| 2971 | /* | 4374 | /* |
| 2972 | * TODO(crosbug.com/p/23747): This is a confusing name, since it doesn't | 4375 | * I2C passthru protection command: Protects I2C tunnels against access on |
| 2973 | * necessarily reboot the EC. Rename to "image" or something similar? | 4376 | * certain addresses (board-specific). |
| 2974 | */ | 4377 | */ |
| 2975 | #define EC_CMD_REBOOT_EC 0xd2 | 4378 | #define EC_CMD_I2C_PASSTHRU_PROTECT 0x00B7 |
| 2976 | 4379 | ||
| 2977 | /* Command */ | 4380 | enum ec_i2c_passthru_protect_subcmd { |
| 2978 | enum ec_reboot_cmd { | 4381 | EC_CMD_I2C_PASSTHRU_PROTECT_STATUS = 0x0, |
| 2979 | EC_REBOOT_CANCEL = 0, /* Cancel a pending reboot */ | 4382 | EC_CMD_I2C_PASSTHRU_PROTECT_ENABLE = 0x1, |
| 2980 | EC_REBOOT_JUMP_RO = 1, /* Jump to RO without rebooting */ | ||
| 2981 | EC_REBOOT_JUMP_RW = 2, /* Jump to RW without rebooting */ | ||
| 2982 | /* (command 3 was jump to RW-B) */ | ||
| 2983 | EC_REBOOT_COLD = 4, /* Cold-reboot */ | ||
| 2984 | EC_REBOOT_DISABLE_JUMP = 5, /* Disable jump until next reboot */ | ||
| 2985 | EC_REBOOT_HIBERNATE = 6 /* Hibernate EC */ | ||
| 2986 | }; | 4383 | }; |
| 2987 | 4384 | ||
| 2988 | /* Flags for ec_params_reboot_ec.reboot_flags */ | 4385 | struct ec_params_i2c_passthru_protect { |
| 2989 | #define EC_REBOOT_FLAG_RESERVED0 (1 << 0) /* Was recovery request */ | 4386 | uint8_t subcmd; |
| 2990 | #define EC_REBOOT_FLAG_ON_AP_SHUTDOWN (1 << 1) /* Reboot after AP shutdown */ | 4387 | uint8_t port; /* I2C port number */ |
| 2991 | 4388 | } __ec_align1; | |
| 2992 | struct ec_params_reboot_ec { | ||
| 2993 | uint8_t cmd; /* enum ec_reboot_cmd */ | ||
| 2994 | uint8_t flags; /* See EC_REBOOT_FLAG_* */ | ||
| 2995 | } __packed; | ||
| 2996 | |||
| 2997 | /* | ||
| 2998 | * Get information on last EC panic. | ||
| 2999 | * | ||
| 3000 | * Returns variable-length platform-dependent panic information. See panic.h | ||
| 3001 | * for details. | ||
| 3002 | */ | ||
| 3003 | #define EC_CMD_GET_PANIC_INFO 0xd3 | ||
| 3004 | |||
| 3005 | /*****************************************************************************/ | ||
| 3006 | /* | ||
| 3007 | * ACPI commands | ||
| 3008 | * | ||
| 3009 | * These are valid ONLY on the ACPI command/data port. | ||
| 3010 | */ | ||
| 3011 | |||
| 3012 | /* | ||
| 3013 | * ACPI Read Embedded Controller | ||
| 3014 | * | ||
| 3015 | * This reads from ACPI memory space on the EC (EC_ACPI_MEM_*). | ||
| 3016 | * | ||
| 3017 | * Use the following sequence: | ||
| 3018 | * | ||
| 3019 | * - Write EC_CMD_ACPI_READ to EC_LPC_ADDR_ACPI_CMD | ||
| 3020 | * - Wait for EC_LPC_CMDR_PENDING bit to clear | ||
| 3021 | * - Write address to EC_LPC_ADDR_ACPI_DATA | ||
| 3022 | * - Wait for EC_LPC_CMDR_DATA bit to set | ||
| 3023 | * - Read value from EC_LPC_ADDR_ACPI_DATA | ||
| 3024 | */ | ||
| 3025 | #define EC_CMD_ACPI_READ 0x80 | ||
| 3026 | |||
| 3027 | /* | ||
| 3028 | * ACPI Write Embedded Controller | ||
| 3029 | * | ||
| 3030 | * This reads from ACPI memory space on the EC (EC_ACPI_MEM_*). | ||
| 3031 | * | ||
| 3032 | * Use the following sequence: | ||
| 3033 | * | ||
| 3034 | * - Write EC_CMD_ACPI_WRITE to EC_LPC_ADDR_ACPI_CMD | ||
| 3035 | * - Wait for EC_LPC_CMDR_PENDING bit to clear | ||
| 3036 | * - Write address to EC_LPC_ADDR_ACPI_DATA | ||
| 3037 | * - Wait for EC_LPC_CMDR_PENDING bit to clear | ||
| 3038 | * - Write value to EC_LPC_ADDR_ACPI_DATA | ||
| 3039 | */ | ||
| 3040 | #define EC_CMD_ACPI_WRITE 0x81 | ||
| 3041 | |||
| 3042 | /* | ||
| 3043 | * ACPI Query Embedded Controller | ||
| 3044 | * | ||
| 3045 | * This clears the lowest-order bit in the currently pending host events, and | ||
| 3046 | * sets the result code to the 1-based index of the bit (event 0x00000001 = 1, | ||
| 3047 | * event 0x80000000 = 32), or 0 if no event was pending. | ||
| 3048 | */ | ||
| 3049 | #define EC_CMD_ACPI_QUERY_EVENT 0x84 | ||
| 3050 | |||
| 3051 | /* Valid addresses in ACPI memory space, for read/write commands */ | ||
| 3052 | |||
| 3053 | /* Memory space version; set to EC_ACPI_MEM_VERSION_CURRENT */ | ||
| 3054 | #define EC_ACPI_MEM_VERSION 0x00 | ||
| 3055 | /* | ||
| 3056 | * Test location; writing value here updates test compliment byte to (0xff - | ||
| 3057 | * value). | ||
| 3058 | */ | ||
| 3059 | #define EC_ACPI_MEM_TEST 0x01 | ||
| 3060 | /* Test compliment; writes here are ignored. */ | ||
| 3061 | #define EC_ACPI_MEM_TEST_COMPLIMENT 0x02 | ||
| 3062 | |||
| 3063 | /* Keyboard backlight brightness percent (0 - 100) */ | ||
| 3064 | #define EC_ACPI_MEM_KEYBOARD_BACKLIGHT 0x03 | ||
| 3065 | /* DPTF Target Fan Duty (0-100, 0xff for auto/none) */ | ||
| 3066 | #define EC_ACPI_MEM_FAN_DUTY 0x04 | ||
| 3067 | |||
| 3068 | /* | ||
| 3069 | * DPTF temp thresholds. Any of the EC's temp sensors can have up to two | ||
| 3070 | * independent thresholds attached to them. The current value of the ID | ||
| 3071 | * register determines which sensor is affected by the THRESHOLD and COMMIT | ||
| 3072 | * registers. The THRESHOLD register uses the same EC_TEMP_SENSOR_OFFSET scheme | ||
| 3073 | * as the memory-mapped sensors. The COMMIT register applies those settings. | ||
| 3074 | * | ||
| 3075 | * The spec does not mandate any way to read back the threshold settings | ||
| 3076 | * themselves, but when a threshold is crossed the AP needs a way to determine | ||
| 3077 | * which sensor(s) are responsible. Each reading of the ID register clears and | ||
| 3078 | * returns one sensor ID that has crossed one of its threshold (in either | ||
| 3079 | * direction) since the last read. A value of 0xFF means "no new thresholds | ||
| 3080 | * have tripped". Setting or enabling the thresholds for a sensor will clear | ||
| 3081 | * the unread event count for that sensor. | ||
| 3082 | */ | ||
| 3083 | #define EC_ACPI_MEM_TEMP_ID 0x05 | ||
| 3084 | #define EC_ACPI_MEM_TEMP_THRESHOLD 0x06 | ||
| 3085 | #define EC_ACPI_MEM_TEMP_COMMIT 0x07 | ||
| 3086 | /* | ||
| 3087 | * Here are the bits for the COMMIT register: | ||
| 3088 | * bit 0 selects the threshold index for the chosen sensor (0/1) | ||
| 3089 | * bit 1 enables/disables the selected threshold (0 = off, 1 = on) | ||
| 3090 | * Each write to the commit register affects one threshold. | ||
| 3091 | */ | ||
| 3092 | #define EC_ACPI_MEM_TEMP_COMMIT_SELECT_MASK (1 << 0) | ||
| 3093 | #define EC_ACPI_MEM_TEMP_COMMIT_ENABLE_MASK (1 << 1) | ||
| 3094 | /* | ||
| 3095 | * Example: | ||
| 3096 | * | ||
| 3097 | * Set the thresholds for sensor 2 to 50 C and 60 C: | ||
| 3098 | * write 2 to [0x05] -- select temp sensor 2 | ||
| 3099 | * write 0x7b to [0x06] -- C_TO_K(50) - EC_TEMP_SENSOR_OFFSET | ||
| 3100 | * write 0x2 to [0x07] -- enable threshold 0 with this value | ||
| 3101 | * write 0x85 to [0x06] -- C_TO_K(60) - EC_TEMP_SENSOR_OFFSET | ||
| 3102 | * write 0x3 to [0x07] -- enable threshold 1 with this value | ||
| 3103 | * | ||
| 3104 | * Disable the 60 C threshold, leaving the 50 C threshold unchanged: | ||
| 3105 | * write 2 to [0x05] -- select temp sensor 2 | ||
| 3106 | * write 0x1 to [0x07] -- disable threshold 1 | ||
| 3107 | */ | ||
| 3108 | |||
| 3109 | /* DPTF battery charging current limit */ | ||
| 3110 | #define EC_ACPI_MEM_CHARGING_LIMIT 0x08 | ||
| 3111 | |||
| 3112 | /* Charging limit is specified in 64 mA steps */ | ||
| 3113 | #define EC_ACPI_MEM_CHARGING_LIMIT_STEP_MA 64 | ||
| 3114 | /* Value to disable DPTF battery charging limit */ | ||
| 3115 | #define EC_ACPI_MEM_CHARGING_LIMIT_DISABLED 0xff | ||
| 3116 | 4389 | ||
| 3117 | /* Current version of ACPI memory address space */ | 4390 | struct ec_response_i2c_passthru_protect { |
| 3118 | #define EC_ACPI_MEM_VERSION_CURRENT 1 | 4391 | uint8_t status; /* Status flags (0: unlocked, 1: locked) */ |
| 4392 | } __ec_align1; | ||
| 3119 | 4393 | ||
| 3120 | 4394 | ||
| 3121 | /*****************************************************************************/ | 4395 | /*****************************************************************************/ |
| @@ -3124,7 +4398,8 @@ struct ec_params_reboot_ec { · 2 unmodified lines | |||
| 3124 | * | 4398 | * |
| 3125 | * These commands are for sending and receiving message via HDMI CEC | 4399 | * These commands are for sending and receiving message via HDMI CEC |
| 3126 | */ | 4400 | */ |
| 3127 | #define EC_MAX_CEC_MSG_LEN 16 | 4401 | |
| 4402 | #define MAX_CEC_MSG_LEN 16 | ||
| 3128 | 4403 | ||
| 3129 | /* CEC message from the AP to be written on the CEC bus */ | 4404 | /* CEC message from the AP to be written on the CEC bus */ |
| 3130 | #define EC_CMD_CEC_WRITE_MSG 0x00B8 | 4405 | #define EC_CMD_CEC_WRITE_MSG 0x00B8 |
| @@ -3134,8 +4409,8 @@ struct ec_params_reboot_ec { · 3 unmodified lines | |||
| 3134 | * @msg: message content to write to the CEC bus | 4409 | * @msg: message content to write to the CEC bus |
| 3135 | */ | 4410 | */ |
| 3136 | struct ec_params_cec_write { | 4411 | struct ec_params_cec_write { |
| 3137 | uint8_t msg[EC_MAX_CEC_MSG_LEN]; | 4412 | uint8_t msg[MAX_CEC_MSG_LEN]; |
| 3138 | } __packed; | 4413 | } __ec_align1; |
| 3139 | 4414 | ||
| 3140 | /* Set various CEC parameters */ | 4415 | /* Set various CEC parameters */ |
| 3141 | #define EC_CMD_CEC_SET 0x00BA | 4416 | #define EC_CMD_CEC_SET 0x00BA |
| @@ -3144,14 +4419,14 @@ struct ec_params_cec_write { · 2 unmodified lines | |||
| 3144 | * struct ec_params_cec_set - CEC parameters set | 4419 | * struct ec_params_cec_set - CEC parameters set |
| 3145 | * @cmd: parameter type, can be CEC_CMD_ENABLE or CEC_CMD_LOGICAL_ADDRESS | 4420 | * @cmd: parameter type, can be CEC_CMD_ENABLE or CEC_CMD_LOGICAL_ADDRESS |
| 3146 | * @val: in case cmd is CEC_CMD_ENABLE, this field can be 0 to disable CEC | 4421 | * @val: in case cmd is CEC_CMD_ENABLE, this field can be 0 to disable CEC |
| 3147 | * or 1 to enable CEC functionality, in case cmd is CEC_CMD_LOGICAL_ADDRESS, | 4422 | * or 1 to enable CEC functionality, in case cmd is |
| 3148 | * this field encodes the requested logical address between 0 and 15 | 4423 | * CEC_CMD_LOGICAL_ADDRESS, this field encodes the requested logical |
| 3149 | * or 0xff to unregister | 4424 | * address between 0 and 15 or 0xff to unregister |
| 3150 | */ | 4425 | */ |
| 3151 | struct ec_params_cec_set { | 4426 | struct ec_params_cec_set { |
| 3152 | uint8_t cmd; /* enum cec_command */ | 4427 | uint8_t cmd; /* enum cec_command */ |
| 3153 | uint8_t val; | 4428 | uint8_t val; |
| 3154 | } __packed; | 4429 | } __ec_align1; |
| 3155 | 4430 | ||
| 3156 | /* Read various CEC parameters */ | 4431 | /* Read various CEC parameters */ |
| 3157 | #define EC_CMD_CEC_GET 0x00BB | 4432 | #define EC_CMD_CEC_GET 0x00BB |
| @@ -3162,7 +4437,7 @@ struct ec_params_cec_set { · 4 unmodified lines | |||
| 3162 | */ | 4437 | */ |
| 3163 | struct ec_params_cec_get { | 4438 | struct ec_params_cec_get { |
| 3164 | uint8_t cmd; /* enum cec_command */ | 4439 | uint8_t cmd; /* enum cec_command */ |
| 3165 | } __packed; | 4440 | } __ec_align1; |
| 3166 | 4441 | ||
| 3167 | /** | 4442 | /** |
| 3168 | * struct ec_response_cec_get - CEC parameters get response | 4443 | * struct ec_response_cec_get - CEC parameters get response |
| @@ -3173,10 +4448,10 @@ struct ec_params_cec_get { · 4 unmodified lines | |||
| 3173 | */ | 4448 | */ |
| 3174 | struct ec_response_cec_get { | 4449 | struct ec_response_cec_get { |
| 3175 | uint8_t val; | 4450 | uint8_t val; |
| 3176 | } __packed; | 4451 | } __ec_align1; |
| 3177 | 4452 | ||
| 3178 | /* CEC parameters command */ | 4453 | /* CEC parameters command */ |
| 3179 | enum ec_cec_command { | 4454 | enum cec_command { |
| 3180 | /* CEC reading, writing and events enable */ | 4455 | /* CEC reading, writing and events enable */ |
| 3181 | CEC_CMD_ENABLE, | 4456 | CEC_CMD_ENABLE, |
| 3182 | /* CEC logical address */ | 4457 | /* CEC logical address */ |
| @@ -3191,6 +4466,134 @@ enum mkbp_cec_event { · 8 unmodified lines | |||
| 3191 | EC_MKBP_CEC_SEND_FAILED = BIT(1), | 4466 | EC_MKBP_CEC_SEND_FAILED = BIT(1), |
| 3192 | }; | 4467 | }; |
| 3193 | 4468 | ||
| 4469 | /*****************************************************************************/ | ||
| 4470 | |||
| 4471 | /* Commands for I2S recording on audio codec. */ | ||
| 4472 | |||
| 4473 | #define EC_CMD_CODEC_I2S 0x00BC | ||
| 4474 | #define EC_WOV_I2S_SAMPLE_RATE 48000 | ||
| 4475 | |||
| 4476 | enum ec_codec_i2s_subcmd { | ||
| 4477 | EC_CODEC_SET_SAMPLE_DEPTH = 0x0, | ||
| 4478 | EC_CODEC_SET_GAIN = 0x1, | ||
| 4479 | EC_CODEC_GET_GAIN = 0x2, | ||
| 4480 | EC_CODEC_I2S_ENABLE = 0x3, | ||
| 4481 | EC_CODEC_I2S_SET_CONFIG = 0x4, | ||
| 4482 | EC_CODEC_I2S_SET_TDM_CONFIG = 0x5, | ||
| 4483 | EC_CODEC_I2S_SET_BCLK = 0x6, | ||
| 4484 | EC_CODEC_I2S_SUBCMD_COUNT = 0x7, | ||
| 4485 | }; | ||
| 4486 | |||
| 4487 | enum ec_sample_depth_value { | ||
| 4488 | EC_CODEC_SAMPLE_DEPTH_16 = 0, | ||
| 4489 | EC_CODEC_SAMPLE_DEPTH_24 = 1, | ||
| 4490 | }; | ||
| 4491 | |||
| 4492 | enum ec_i2s_config { | ||
| 4493 | EC_DAI_FMT_I2S = 0, | ||
| 4494 | EC_DAI_FMT_RIGHT_J = 1, | ||
| 4495 | EC_DAI_FMT_LEFT_J = 2, | ||
| 4496 | EC_DAI_FMT_PCM_A = 3, | ||
| 4497 | EC_DAI_FMT_PCM_B = 4, | ||
| 4498 | EC_DAI_FMT_PCM_TDM = 5, | ||
| 4499 | }; | ||
| 4500 | |||
| 4501 | /* | ||
| 4502 | * For subcommand EC_CODEC_GET_GAIN. | ||
| 4503 | */ | ||
| 4504 | struct __ec_align1 ec_codec_i2s_gain { | ||
| 4505 | uint8_t left; | ||
| 4506 | uint8_t right; | ||
| 4507 | }; | ||
| 4508 | |||
| 4509 | struct __ec_todo_unpacked ec_param_codec_i2s_tdm { | ||
| 4510 | int16_t ch0_delay; /* 0 to 496 */ | ||
| 4511 | int16_t ch1_delay; /* -1 to 496 */ | ||
| 4512 | uint8_t adjacent_to_ch0; | ||
| 4513 | uint8_t adjacent_to_ch1; | ||
| 4514 | }; | ||
| 4515 | |||
| 4516 | struct __ec_todo_packed ec_param_codec_i2s { | ||
| 4517 | /* enum ec_codec_i2s_subcmd */ | ||
| 4518 | uint8_t cmd; | ||
| 4519 | union { | ||
| 4520 | /* | ||
| 4521 | * EC_CODEC_SET_SAMPLE_DEPTH | ||
| 4522 | * Value should be one of ec_sample_depth_value. | ||
| 4523 | */ | ||
| 4524 | uint8_t depth; | ||
| 4525 | |||
| 4526 | /* | ||
| 4527 | * EC_CODEC_SET_GAIN | ||
| 4528 | * Value should be 0~43 for both channels. | ||
| 4529 | */ | ||
| 4530 | struct ec_codec_i2s_gain gain; | ||
| 4531 | |||
| 4532 | /* | ||
| 4533 | * EC_CODEC_I2S_ENABLE | ||
| 4534 | * 1 to enable, 0 to disable. | ||
| 4535 | */ | ||
| 4536 | uint8_t i2s_enable; | ||
| 4537 | |||
| 4538 | /* | ||
| 4539 | * EC_CODEC_I2S_SET_CONFIG | ||
| 4540 | * Value should be one of ec_i2s_config. | ||
| 4541 | */ | ||
| 4542 | uint8_t i2s_config; | ||
| 4543 | |||
| 4544 | /* | ||
| 4545 | * EC_CODEC_I2S_SET_TDM_CONFIG | ||
| 4546 | * Value should be one of ec_i2s_config. | ||
| 4547 | */ | ||
| 4548 | struct ec_param_codec_i2s_tdm tdm_param; | ||
| 4549 | |||
| 4550 | /* | ||
| 4551 | * EC_CODEC_I2S_SET_BCLK | ||
| 4552 | */ | ||
| 4553 | uint32_t bclk; | ||
| 4554 | }; | ||
| 4555 | }; | ||
| 4556 | |||
| 4557 | |||
| 4558 | /*****************************************************************************/ | ||
| 4559 | /* System commands */ | ||
| 4560 | |||
| 4561 | /* | ||
| 4562 | * TODO(crosbug.com/p/23747): This is a confusing name, since it doesn't | ||
| 4563 | * necessarily reboot the EC. Rename to "image" or something similar? | ||
| 4564 | */ | ||
| 4565 | #define EC_CMD_REBOOT_EC 0x00D2 | ||
| 4566 | |||
| 4567 | /* Command */ | ||
| 4568 | enum ec_reboot_cmd { | ||
| 4569 | EC_REBOOT_CANCEL = 0, /* Cancel a pending reboot */ | ||
| 4570 | EC_REBOOT_JUMP_RO = 1, /* Jump to RO without rebooting */ | ||
| 4571 | EC_REBOOT_JUMP_RW = 2, /* Jump to active RW without rebooting */ | ||
| 4572 | /* (command 3 was jump to RW-B) */ | ||
| 4573 | EC_REBOOT_COLD = 4, /* Cold-reboot */ | ||
| 4574 | EC_REBOOT_DISABLE_JUMP = 5, /* Disable jump until next reboot */ | ||
| 4575 | EC_REBOOT_HIBERNATE = 6, /* Hibernate EC */ | ||
| 4576 | EC_REBOOT_HIBERNATE_CLEAR_AP_OFF = 7, /* and clears AP_OFF flag */ | ||
| 4577 | }; | ||
| 4578 | |||
| 4579 | /* Flags for ec_params_reboot_ec.reboot_flags */ | ||
| 4580 | #define EC_REBOOT_FLAG_RESERVED0 BIT(0) /* Was recovery request */ | ||
| 4581 | #define EC_REBOOT_FLAG_ON_AP_SHUTDOWN BIT(1) /* Reboot after AP shutdown */ | ||
| 4582 | #define EC_REBOOT_FLAG_SWITCH_RW_SLOT BIT(2) /* Switch RW slot */ | ||
| 4583 | |||
| 4584 | struct ec_params_reboot_ec { | ||
| 4585 | uint8_t cmd; /* enum ec_reboot_cmd */ | ||
| 4586 | uint8_t flags; /* See EC_REBOOT_FLAG_* */ | ||
| 4587 | } __ec_align1; | ||
| 4588 | |||
| 4589 | /* | ||
| 4590 | * Get information on last EC panic. | ||
| 4591 | * | ||
| 4592 | * Returns variable-length platform-dependent panic information. See panic.h | ||
| 4593 | * for details. | ||
| 4594 | */ | ||
| 4595 | #define EC_CMD_GET_PANIC_INFO 0x00D3 | ||
| 4596 | |||
| 3194 | /*****************************************************************************/ | 4597 | /*****************************************************************************/ |
| 3195 | /* | 4598 | /* |
| 3196 | * Special commands | 4599 | * Special commands |
| @@ -3208,7 +4611,7 @@ enum mkbp_cec_event { · 11 unmodified lines | |||
| 3208 | * | 4611 | * |
| 3209 | * Use EC_CMD_REBOOT_EC to reboot the EC more politely. | 4612 | * Use EC_CMD_REBOOT_EC to reboot the EC more politely. |
| 3210 | */ | 4613 | */ |
| 3211 | #define EC_CMD_REBOOT 0xd1 /* Think "die" */ | 4614 | #define EC_CMD_REBOOT 0x00D1 /* Think "die" */ |
| 3212 | 4615 | ||
| 3213 | /* | 4616 | /* |
| 3214 | * Resend last response (not supported on LPC). | 4617 | * Resend last response (not supported on LPC). |
| @@ -3217,7 +4620,7 @@ enum mkbp_cec_event { · 2 unmodified lines | |||
| 3217 | * there was no previous command, or the previous command's response was too | 4620 | * there was no previous command, or the previous command's response was too |
| 3218 | * big to save. | 4621 | * big to save. |
| 3219 | */ | 4622 | */ |
| 3220 | #define EC_CMD_RESEND_RESPONSE 0xdb | 4623 | #define EC_CMD_RESEND_RESPONSE 0x00DB |
| 3221 | 4624 | ||
| 3222 | /* | 4625 | /* |
| 3223 | * This header byte on a command indicate version 0. Any header byte less | 4626 | * This header byte on a command indicate version 0. Any header byte less |
| @@ -3229,9 +4632,7 @@ enum mkbp_cec_event { · 5 unmodified lines | |||
| 3229 | * | 4632 | * |
| 3230 | * The old EC interface must not use commands 0xdc or higher. | 4633 | * The old EC interface must not use commands 0xdc or higher. |
| 3231 | */ | 4634 | */ |
| 3232 | #define EC_CMD_VERSION0 0xdc | 4635 | #define EC_CMD_VERSION0 0x00DC |
| 3233 | |||
| 3234 | #endif /* !__ACPI__ */ | ||
| 3235 | 4636 | ||
| 3236 | /*****************************************************************************/ | 4637 | /*****************************************************************************/ |
| 3237 | /* | 4638 | /* |
| @@ -3241,21 +4642,56 @@ enum mkbp_cec_event { · 3 unmodified lines | |||
| 3241 | */ | 4642 | */ |
| 3242 | 4643 | ||
| 3243 | /* EC to PD MCU exchange status command */ | 4644 | /* EC to PD MCU exchange status command */ |
| 3244 | #define EC_CMD_PD_EXCHANGE_STATUS 0x100 | 4645 | #define EC_CMD_PD_EXCHANGE_STATUS 0x0100 |
| 4646 | #define EC_VER_PD_EXCHANGE_STATUS 2 | ||
| 4647 | |||
| 4648 | enum pd_charge_state { | ||
| 4649 | PD_CHARGE_NO_CHANGE = 0, /* Don't change charge state */ | ||
| 4650 | PD_CHARGE_NONE, /* No charging allowed */ | ||
| 4651 | PD_CHARGE_5V, /* 5V charging only */ | ||
| 4652 | PD_CHARGE_MAX /* Charge at max voltage */ | ||
| 4653 | }; | ||
| 3245 | 4654 | ||
| 3246 | /* Status of EC being sent to PD */ | 4655 | /* Status of EC being sent to PD */ |
| 4656 | #define EC_STATUS_HIBERNATING BIT(0) | ||
| 4657 | |||
| 3247 | struct ec_params_pd_status { | 4658 | struct ec_params_pd_status { |
| 3248 | int8_t batt_soc; /* battery state of charge */ | 4659 | uint8_t status; /* EC status */ |
| 3249 | } __packed; | 4660 | int8_t batt_soc; /* battery state of charge */ |
| 4661 | uint8_t charge_state; /* charging state (from enum pd_charge_state) */ | ||
| 4662 | } __ec_align1; | ||
| 3250 | 4663 | ||
| 3251 | /* Status of PD being sent back to EC */ | 4664 | /* Status of PD being sent back to EC */ |
| 4665 | #define PD_STATUS_HOST_EVENT BIT(0) /* Forward host event to AP */ | ||
| 4666 | #define PD_STATUS_IN_RW BIT(1) /* Running RW image */ | ||
| 4667 | #define PD_STATUS_JUMPED_TO_IMAGE BIT(2) /* Current image was jumped to */ | ||
| 4668 | #define PD_STATUS_TCPC_ALERT_0 BIT(3) /* Alert active in port 0 TCPC */ | ||
| 4669 | #define PD_STATUS_TCPC_ALERT_1 BIT(4) /* Alert active in port 1 TCPC */ | ||
| 4670 | #define PD_STATUS_TCPC_ALERT_2 BIT(5) /* Alert active in port 2 TCPC */ | ||
| 4671 | #define PD_STATUS_TCPC_ALERT_3 BIT(6) /* Alert active in port 3 TCPC */ | ||
| 4672 | #define PD_STATUS_EC_INT_ACTIVE (PD_STATUS_TCPC_ALERT_0 | \ | ||
| 4673 | PD_STATUS_TCPC_ALERT_1 | \ | ||
| 4674 | PD_STATUS_HOST_EVENT) | ||
| 3252 | struct ec_response_pd_status { | 4675 | struct ec_response_pd_status { |
| 3253 | int8_t status; /* PD MCU status */ | 4676 | uint32_t curr_lim_ma; /* input current limit */ |
| 3254 | uint32_t curr_lim_ma; /* input current limit */ | 4677 | uint16_t status; /* PD MCU status */ |
| 3255 | } __packed; | 4678 | int8_t active_charge_port; /* active charging port */ |
| 4679 | } __ec_align_size1; | ||
| 4680 | |||
| 4681 | /* AP to PD MCU host event status command, cleared on read */ | ||
| 4682 | #define EC_CMD_PD_HOST_EVENT_STATUS 0x0104 | ||
| 4683 | |||
| 4684 | /* PD MCU host event status bits */ | ||
| 4685 | #define PD_EVENT_UPDATE_DEVICE BIT(0) | ||
| 4686 | #define PD_EVENT_POWER_CHANGE BIT(1) | ||
| 4687 | #define PD_EVENT_IDENTITY_RECEIVED BIT(2) | ||
| 4688 | #define PD_EVENT_DATA_SWAP BIT(3) | ||
| 4689 | struct ec_response_host_event_status { | ||
| 4690 | uint32_t status; /* PD MCU host event status */ | ||
| 4691 | } __ec_align4; | ||
| 3256 | 4692 | ||
| 3257 | /* Set USB type-C port role and muxes */ | 4693 | /* Set USB type-C port role and muxes */ |
| 3258 | #define EC_CMD_USB_PD_CONTROL 0x101 | 4694 | #define EC_CMD_USB_PD_CONTROL 0x0101 |
| 3259 | 4695 | ||
| 3260 | enum usb_pd_control_role { | 4696 | enum usb_pd_control_role { |
| 3261 | USB_PD_CTRL_ROLE_NO_CHANGE = 0, | 4697 | USB_PD_CTRL_ROLE_NO_CHANGE = 0, |
| @@ -3263,6 +4699,8 @@ enum usb_pd_control_role { · 1 unmodified line | |||
| 3263 | USB_PD_CTRL_ROLE_TOGGLE_OFF = 2, | 4699 | USB_PD_CTRL_ROLE_TOGGLE_OFF = 2, |
| 3264 | USB_PD_CTRL_ROLE_FORCE_SINK = 3, | 4700 | USB_PD_CTRL_ROLE_FORCE_SINK = 3, |
| 3265 | USB_PD_CTRL_ROLE_FORCE_SOURCE = 4, | 4701 | USB_PD_CTRL_ROLE_FORCE_SOURCE = 4, |
| 4702 | USB_PD_CTRL_ROLE_FREEZE = 5, | ||
| 4703 | USB_PD_CTRL_ROLE_COUNT | ||
| 3266 | }; | 4704 | }; |
| 3267 | 4705 | ||
| 3268 | enum usb_pd_control_mux { | 4706 | enum usb_pd_control_mux { |
| @@ -3272,6 +4710,7 @@ enum usb_pd_control_mux { · 3 unmodified lines | |||
| 3272 | USB_PD_CTRL_MUX_DP = 3, | 4710 | USB_PD_CTRL_MUX_DP = 3, |
| 3273 | USB_PD_CTRL_MUX_DOCK = 4, | 4711 | USB_PD_CTRL_MUX_DOCK = 4, |
| 3274 | USB_PD_CTRL_MUX_AUTO = 5, | 4712 | USB_PD_CTRL_MUX_AUTO = 5, |
| 4713 | USB_PD_CTRL_MUX_COUNT | ||
| 3275 | }; | 4714 | }; |
| 3276 | 4715 | ||
| 3277 | enum usb_pd_control_swap { | 4716 | enum usb_pd_control_swap { |
| @@ -3287,11 +4726,11 @@ struct ec_params_usb_pd_control { · 9 unmodified lines | |||
| 3287 | uint8_t role; | 4726 | uint8_t role; |
| 3288 | uint8_t mux; | 4727 | uint8_t mux; |
| 3289 | uint8_t swap; | 4728 | uint8_t swap; |
| 3290 | } __packed; | 4729 | } __ec_align1; |
| 3291 | 4730 | ||
| 3292 | #define PD_CTRL_RESP_ENABLED_COMMS (1 << 0) /* Communication enabled */ | 4731 | #define PD_CTRL_RESP_ENABLED_COMMS BIT(0) /* Communication enabled */ |
| 3293 | #define PD_CTRL_RESP_ENABLED_CONNECTED (1 << 1) /* Device connected */ | 4732 | #define PD_CTRL_RESP_ENABLED_CONNECTED BIT(1) /* Device connected */ |
| 3294 | #define PD_CTRL_RESP_ENABLED_PD_CAPABLE (1 << 2) /* Partner is PD capable */ | 4733 | #define PD_CTRL_RESP_ENABLED_PD_CAPABLE BIT(2) /* Partner is PD capable */ |
| 3295 | 4734 | ||
| 3296 | #define PD_CTRL_RESP_ROLE_POWER BIT(0) /* 0=SNK/1=SRC */ | 4735 | #define PD_CTRL_RESP_ROLE_POWER BIT(0) /* 0=SNK/1=SRC */ |
| 3297 | #define PD_CTRL_RESP_ROLE_DATA BIT(1) /* 0=UFP/1=DFP */ | 4736 | #define PD_CTRL_RESP_ROLE_DATA BIT(1) /* 0=UFP/1=DFP */ |
| @@ -3301,28 +4740,54 @@ struct ec_params_usb_pd_control { · 3 unmodified lines | |||
| 3301 | #define PD_CTRL_RESP_ROLE_USB_COMM BIT(5) /* Partner USB comm capable */ | 4740 | #define PD_CTRL_RESP_ROLE_USB_COMM BIT(5) /* Partner USB comm capable */ |
| 3302 | #define PD_CTRL_RESP_ROLE_EXT_POWERED BIT(6) /* Partner externally powerd */ | 4741 | #define PD_CTRL_RESP_ROLE_EXT_POWERED BIT(6) /* Partner externally powerd */ |
| 3303 | 4742 | ||
| 4743 | struct ec_response_usb_pd_control { | ||
| 4744 | uint8_t enabled; | ||
| 4745 | uint8_t role; | ||
| 4746 | uint8_t polarity; | ||
| 4747 | uint8_t state; | ||
| 4748 | } __ec_align1; | ||
| 4749 | |||
| 3304 | struct ec_response_usb_pd_control_v1 { | 4750 | struct ec_response_usb_pd_control_v1 { |
| 3305 | uint8_t enabled; | 4751 | uint8_t enabled; |
| 3306 | uint8_t role; | 4752 | uint8_t role; |
| 3307 | uint8_t polarity; | 4753 | uint8_t polarity; |
| 3308 | char state[32]; | 4754 | char state[32]; |
| 3309 | } __packed; | 4755 | } __ec_align1; |
| 4756 | |||
| 4757 | /* Values representing usbc PD CC state */ | ||
| 4758 | #define USBC_PD_CC_NONE 0 /* No accessory connected */ | ||
| 4759 | #define USBC_PD_CC_NO_UFP 1 /* No UFP accessory connected */ | ||
| 4760 | #define USBC_PD_CC_AUDIO_ACC 2 /* Audio accessory connected */ | ||
| 4761 | #define USBC_PD_CC_DEBUG_ACC 3 /* Debug accessory connected */ | ||
| 4762 | #define USBC_PD_CC_UFP_ATTACHED 4 /* UFP attached to usbc */ | ||
| 4763 | #define USBC_PD_CC_DFP_ATTACHED 5 /* DPF attached to usbc */ | ||
| 4764 | |||
| 4765 | struct ec_response_usb_pd_control_v2 { | ||
| 4766 | uint8_t enabled; | ||
| 4767 | uint8_t role; | ||
| 4768 | uint8_t polarity; | ||
| 4769 | char state[32]; | ||
| 4770 | uint8_t cc_state; /* USBC_PD_CC_*Encoded cc state */ | ||
| 4771 | uint8_t dp_mode; /* Current DP pin mode (MODE_DP_PIN_[A-E]) */ | ||
| 4772 | /* CL:1500994 Current cable type */ | ||
| 4773 | uint8_t reserved_cable_type; | ||
| 4774 | } __ec_align1; | ||
| 3310 | 4775 | ||
| 3311 | #define EC_CMD_USB_PD_PORTS 0x102 | 4776 | #define EC_CMD_USB_PD_PORTS 0x0102 |
| 3312 | 4777 | ||
| 3313 | /* Maximum number of PD ports on a device, num_ports will be <= this */ | 4778 | /* Maximum number of PD ports on a device, num_ports will be <= this */ |
| 3314 | #define EC_USB_PD_MAX_PORTS 8 | 4779 | #define EC_USB_PD_MAX_PORTS 8 |
| 3315 | 4780 | ||
| 3316 | struct ec_response_usb_pd_ports { | 4781 | struct ec_response_usb_pd_ports { |
| 3317 | uint8_t num_ports; | 4782 | uint8_t num_ports; |
| 3318 | } __packed; | 4783 | } __ec_align1; |
| 3319 | 4784 | ||
| 3320 | #define EC_CMD_USB_PD_POWER_INFO 0x103 | 4785 | #define EC_CMD_USB_PD_POWER_INFO 0x0103 |
| 3321 | 4786 | ||
| 3322 | #define PD_POWER_CHARGING_PORT 0xff | 4787 | #define PD_POWER_CHARGING_PORT 0xff |
| 3323 | struct ec_params_usb_pd_power_info { | 4788 | struct ec_params_usb_pd_power_info { |
| 3324 | uint8_t port; | 4789 | uint8_t port; |
| 3325 | } __packed; | 4790 | } __ec_align1; |
| 3326 | 4791 | ||
| 3327 | enum usb_chg_type { | 4792 | enum usb_chg_type { |
| 3328 | USB_CHG_TYPE_NONE, | 4793 | USB_CHG_TYPE_NONE, |
| @@ -3335,6 +4800,7 @@ enum usb_chg_type { · 6 unmodified lines | |||
| 3335 | USB_CHG_TYPE_OTHER, | 4800 | USB_CHG_TYPE_OTHER, |
| 3336 | USB_CHG_TYPE_VBUS, | 4801 | USB_CHG_TYPE_VBUS, |
| 3337 | USB_CHG_TYPE_UNKNOWN, | 4802 | USB_CHG_TYPE_UNKNOWN, |
| 4803 | USB_CHG_TYPE_DEDICATED, | ||
| 3338 | }; | 4804 | }; |
| 3339 | enum usb_power_roles { | 4805 | enum usb_power_roles { |
| 3340 | USB_PD_PORT_POWER_DISCONNECTED, | 4806 | USB_PD_PORT_POWER_DISCONNECTED, |
| @@ -3348,7 +4814,7 @@ struct usb_chg_measures { · 7 unmodified lines | |||
| 3348 | uint16_t voltage_now; | 4814 | uint16_t voltage_now; |
| 3349 | uint16_t current_max; | 4815 | uint16_t current_max; |
| 3350 | uint16_t current_lim; | 4816 | uint16_t current_lim; |
| 3351 | } __packed; | 4817 | } __ec_align2; |
| 3352 | 4818 | ||
| 3353 | struct ec_response_usb_pd_power_info { | 4819 | struct ec_response_usb_pd_power_info { |
| 3354 | uint8_t role; | 4820 | uint8_t role; |
| @@ -3357,11 +4823,8 @@ struct ec_response_usb_pd_power_info { · 2 unmodified lines | |||
| 3357 | uint8_t reserved1; | 4823 | uint8_t reserved1; |
| 3358 | struct usb_chg_measures meas; | 4824 | struct usb_chg_measures meas; |
| 3359 | uint32_t max_power; | 4825 | uint32_t max_power; |
| 3360 | } __packed; | 4826 | } __ec_align4; |
| 3361 | 4827 | ||
| 3362 | struct ec_params_usb_pd_info_request { | ||
| 3363 | uint8_t port; | ||
| 3364 | } __packed; | ||
| 3365 | 4828 | ||
| 3366 | /* | 4829 | /* |
| 3367 | * This command will return the number of USB PD charge port + the number | 4830 | * This command will return the number of USB PD charge port + the number |
| @@ -3371,7 +4834,47 @@ struct ec_params_usb_pd_info_request { · 3 unmodified lines | |||
| 3371 | #define EC_CMD_CHARGE_PORT_COUNT 0x0105 | 4834 | #define EC_CMD_CHARGE_PORT_COUNT 0x0105 |
| 3372 | struct ec_response_charge_port_count { | 4835 | struct ec_response_charge_port_count { |
| 3373 | uint8_t port_count; | 4836 | uint8_t port_count; |
| 3374 | } __packed; | 4837 | } __ec_align1; |
| 4838 | |||
| 4839 | /* Write USB-PD device FW */ | ||
| 4840 | #define EC_CMD_USB_PD_FW_UPDATE 0x0110 | ||
| 4841 | |||
| 4842 | enum usb_pd_fw_update_cmds { | ||
| 4843 | USB_PD_FW_REBOOT, | ||
| 4844 | USB_PD_FW_FLASH_ERASE, | ||
| 4845 | USB_PD_FW_FLASH_WRITE, | ||
| 4846 | USB_PD_FW_ERASE_SIG, | ||
| 4847 | }; | ||
| 4848 | |||
| 4849 | struct ec_params_usb_pd_fw_update { | ||
| 4850 | uint16_t dev_id; | ||
| 4851 | uint8_t cmd; | ||
| 4852 | uint8_t port; | ||
| 4853 | uint32_t size; /* Size to write in bytes */ | ||
| 4854 | /* Followed by data to write */ | ||
| 4855 | } __ec_align4; | ||
| 4856 | |||
| 4857 | /* Write USB-PD Accessory RW_HASH table entry */ | ||
| 4858 | #define EC_CMD_USB_PD_RW_HASH_ENTRY 0x0111 | ||
| 4859 | /* RW hash is first 20 bytes of SHA-256 of RW section */ | ||
| 4860 | #define PD_RW_HASH_SIZE 20 | ||
| 4861 | struct ec_params_usb_pd_rw_hash_entry { | ||
| 4862 | uint16_t dev_id; | ||
| 4863 | uint8_t dev_rw_hash[PD_RW_HASH_SIZE]; | ||
| 4864 | uint8_t reserved; /* | ||
| 4865 | * For alignment of current_image | ||
| 4866 | * TODO(rspangler) but it's not aligned! | ||
| 4867 | * Should have been reserved[2]. | ||
| 4868 | */ | ||
| 4869 | uint32_t current_image; /* One of ec_current_image */ | ||
| 4870 | } __ec_align1; | ||
| 4871 | |||
| 4872 | /* Read USB-PD Accessory info */ | ||
| 4873 | #define EC_CMD_USB_PD_DEV_INFO 0x0112 | ||
| 4874 | |||
| 4875 | struct ec_params_usb_pd_info_request { | ||
| 4876 | uint8_t port; | ||
| 4877 | } __ec_align1; | ||
| 3375 | 4878 | ||
| 3376 | /* Read USB-PD Device discovery info */ | 4879 | /* Read USB-PD Device discovery info */ |
| 3377 | #define EC_CMD_USB_PD_DISCOVERY 0x0113 | 4880 | #define EC_CMD_USB_PD_DISCOVERY 0x0113 |
| @@ -3379,7 +4882,7 @@ struct ec_params_usb_pd_discovery_entry { · 1 unmodified line | |||
| 3379 | uint16_t vid; /* USB-IF VID */ | 4882 | uint16_t vid; /* USB-IF VID */ |
| 3380 | uint16_t pid; /* USB-IF PID */ | 4883 | uint16_t pid; /* USB-IF PID */ |
| 3381 | uint8_t ptype; /* product type (hub,periph,cable,ama) */ | 4884 | uint8_t ptype; /* product type (hub,periph,cable,ama) */ |
| 3382 | } __packed; | 4885 | } __ec_align_size1; |
| 3383 | 4886 | ||
| 3384 | /* Override default charge behavior */ | 4887 | /* Override default charge behavior */ |
| 3385 | #define EC_CMD_PD_CHARGE_PORT_OVERRIDE 0x0114 | 4888 | #define EC_CMD_PD_CHARGE_PORT_OVERRIDE 0x0114 |
| @@ -3393,9 +4896,13 @@ enum usb_pd_override_ports { · 7 unmodified lines | |||
| 3393 | 4896 | ||
| 3394 | struct ec_params_charge_port_override { | 4897 | struct ec_params_charge_port_override { |
| 3395 | int16_t override_port; /* Override port# */ | 4898 | int16_t override_port; /* Override port# */ |
| 3396 | } __packed; | 4899 | } __ec_align2; |
| 3397 | 4900 | ||
| 3398 | /* Read (and delete) one entry of PD event log */ | 4901 | /* |
| 4902 | * Read (and delete) one entry of PD event log. | ||
| 4903 | * TODO(crbug.com/751742): Make this host command more generic to accommodate | ||
| 4904 | * future non-PD logs that use the same internal EC event_log. | ||
| 4905 | */ | ||
| 3399 | #define EC_CMD_PD_GET_LOG_ENTRY 0x0115 | 4906 | #define EC_CMD_PD_GET_LOG_ENTRY 0x0115 |
| 3400 | 4907 | ||
| 3401 | struct ec_response_pd_log { | 4908 | struct ec_response_pd_log { |
| @@ -3404,7 +4911,7 @@ struct ec_response_pd_log { · 2 unmodified lines | |||
| 3404 | uint8_t size_port; /* [7:5] port number [4:0] payload size in bytes */ | 4911 | uint8_t size_port; /* [7:5] port number [4:0] payload size in bytes */ |
| 3405 | uint16_t data; /* type-defined data payload */ | 4912 | uint16_t data; /* type-defined data payload */ |
| 3406 | uint8_t payload[0]; /* optional additional data payload: 0..16 bytes */ | 4913 | uint8_t payload[0]; /* optional additional data payload: 0..16 bytes */ |
| 3407 | } __packed; | 4914 | } __ec_align4; |
| 3408 | 4915 | ||
| 3409 | /* The timestamp is the microsecond counter shifted to get about a ms. */ | 4916 | /* The timestamp is the microsecond counter shifted to get about a ms. */ |
| 3410 | #define PD_LOG_TIMESTAMP_SHIFT 10 /* 1 LSB = 1024us */ | 4917 | #define PD_LOG_TIMESTAMP_SHIFT 10 /* 1 LSB = 1024us */ |
| @@ -3470,35 +4977,698 @@ struct mcdp_version { · 59 unmodified lines | |||
| 3470 | uint8_t major; | 4977 | uint8_t major; |
| 3471 | uint8_t minor; | 4978 | uint8_t minor; |
| 3472 | uint16_t build; | 4979 | uint16_t build; |
| 3473 | } __packed; | 4980 | } __ec_align4; |
| 3474 | 4981 | ||
| 3475 | struct mcdp_info { | 4982 | struct mcdp_info { |
| 3476 | uint8_t family[2]; | 4983 | uint8_t family[2]; |
| 3477 | uint8_t chipid[2]; | 4984 | uint8_t chipid[2]; |
| 3478 | struct mcdp_version irom; | 4985 | struct mcdp_version irom; |
| 3479 | struct mcdp_version fw; | 4986 | struct mcdp_version fw; |
| 3480 | } __packed; | 4987 | } __ec_align4; |
| 3481 | 4988 | ||
| 3482 | /* struct mcdp_info field decoding */ | 4989 | /* struct mcdp_info field decoding */ |
| 3483 | #define MCDP_CHIPID(chipid) ((chipid[0] << 8) | chipid[1]) | 4990 | #define MCDP_CHIPID(chipid) ((chipid[0] << 8) | chipid[1]) |
| 3484 | #define MCDP_FAMILY(family) ((family[0] << 8) | family[1]) | 4991 | #define MCDP_FAMILY(family) ((family[0] << 8) | family[1]) |
| 3485 | 4992 | ||
| 4993 | /* Get/Set USB-PD Alternate mode info */ | ||
| 4994 | #define EC_CMD_USB_PD_GET_AMODE 0x0116 | ||
| 4995 | struct ec_params_usb_pd_get_mode_request { | ||
| 4996 | uint16_t svid_idx; /* SVID index to get */ | ||
| 4997 | uint8_t port; /* port */ | ||
| 4998 | } __ec_align_size1; | ||
| 4999 | |||
| 5000 | struct ec_params_usb_pd_get_mode_response { | ||
| 5001 | uint16_t svid; /* SVID */ | ||
| 5002 | uint16_t opos; /* Object Position */ | ||
| 5003 | uint32_t vdo[6]; /* Mode VDOs */ | ||
| 5004 | } __ec_align4; | ||
| 5005 | |||
| 5006 | #define EC_CMD_USB_PD_SET_AMODE 0x0117 | ||
| 5007 | |||
| 5008 | enum pd_mode_cmd { | ||
| 5009 | PD_EXIT_MODE = 0, | ||
| 5010 | PD_ENTER_MODE = 1, | ||
| 5011 | /* Not a command. Do NOT remove. */ | ||
| 5012 | PD_MODE_CMD_COUNT, | ||
| 5013 | }; | ||
| 5014 | |||
| 5015 | struct ec_params_usb_pd_set_mode_request { | ||
| 5016 | uint32_t cmd; /* enum pd_mode_cmd */ | ||
| 5017 | uint16_t svid; /* SVID to set */ | ||
| 5018 | uint8_t opos; /* Object Position */ | ||
| 5019 | uint8_t port; /* port */ | ||
| 5020 | } __ec_align4; | ||
| 5021 | |||
| 5022 | /* Ask the PD MCU to record a log of a requested type */ | ||
| 5023 | #define EC_CMD_PD_WRITE_LOG_ENTRY 0x0118 | ||
| 5024 | |||
| 5025 | struct ec_params_pd_write_log_entry { | ||
| 5026 | uint8_t type; /* event type : see PD_EVENT_xx above */ | ||
| 5027 | uint8_t port; /* port#, or 0 for events unrelated to a given port */ | ||
| 5028 | } __ec_align1; | ||
| 5029 | |||
| 5030 | |||
| 5031 | /* Control USB-PD chip */ | ||
| 5032 | #define EC_CMD_PD_CONTROL 0x0119 | ||
| 5033 | |||
| 5034 | enum ec_pd_control_cmd { | ||
| 5035 | PD_SUSPEND = 0, /* Suspend the PD chip (EC: stop talking to PD) */ | ||
| 5036 | PD_RESUME, /* Resume the PD chip (EC: start talking to PD) */ | ||
| 5037 | PD_RESET, /* Force reset the PD chip */ | ||
| 5038 | PD_CONTROL_DISABLE, /* Disable further calls to this command */ | ||
| 5039 | PD_CHIP_ON, /* Power on the PD chip */ | ||
| 5040 | }; | ||
| 5041 | |||
| 5042 | struct ec_params_pd_control { | ||
| 5043 | uint8_t chip; /* chip id */ | ||
| 5044 | uint8_t subcmd; | ||
| 5045 | } __ec_align1; | ||
| 5046 | |||
| 3486 | /* Get info about USB-C SS muxes */ | 5047 | /* Get info about USB-C SS muxes */ |
| 3487 | #define EC_CMD_USB_PD_MUX_INFO 0x11a | 5048 | #define EC_CMD_USB_PD_MUX_INFO 0x011A |
| 3488 | 5049 | ||
| 3489 | struct ec_params_usb_pd_mux_info { | 5050 | struct ec_params_usb_pd_mux_info { |
| 3490 | uint8_t port; /* USB-C port number */ | 5051 | uint8_t port; /* USB-C port number */ |
| 3491 | } __packed; | 5052 | } __ec_align1; |
| 3492 | 5053 | ||
| 3493 | /* Flags representing mux state */ | 5054 | /* Flags representing mux state */ |
| 3494 | #define USB_PD_MUX_USB_ENABLED (1 << 0) | 5055 | #define USB_PD_MUX_USB_ENABLED BIT(0) /* USB connected */ |
| 3495 | #define USB_PD_MUX_DP_ENABLED (1 << 1) | 5056 | #define USB_PD_MUX_DP_ENABLED BIT(1) /* DP connected */ |
| 3496 | #define USB_PD_MUX_POLARITY_INVERTED (1 << 2) | 5057 | #define USB_PD_MUX_POLARITY_INVERTED BIT(2) /* CC line Polarity inverted */ |
| 3497 | #define USB_PD_MUX_HPD_IRQ (1 << 3) | 5058 | #define USB_PD_MUX_HPD_IRQ BIT(3) /* HPD IRQ is asserted */ |
| 5059 | #define USB_PD_MUX_HPD_LVL BIT(4) /* HPD level is asserted */ | ||
| 3498 | 5060 | ||
| 3499 | struct ec_response_usb_pd_mux_info { | 5061 | struct ec_response_usb_pd_mux_info { |
| 3500 | uint8_t flags; /* USB_PD_MUX_*-encoded USB mux state */ | 5062 | uint8_t flags; /* USB_PD_MUX_*-encoded USB mux state */ |
| 3501 | } __packed; | 5063 | } __ec_align1; |
| 5064 | |||
| 5065 | #define EC_CMD_PD_CHIP_INFO 0x011B | ||
| 5066 | |||
| 5067 | struct ec_params_pd_chip_info { | ||
| 5068 | uint8_t port; /* USB-C port number */ | ||
| 5069 | uint8_t renew; /* Force renewal */ | ||
| 5070 | } __ec_align1; | ||
| 5071 | |||
| 5072 | struct ec_response_pd_chip_info { | ||
| 5073 | uint16_t vendor_id; | ||
| 5074 | uint16_t product_id; | ||
| 5075 | uint16_t device_id; | ||
| 5076 | union { | ||
| 5077 | uint8_t fw_version_string[8]; | ||
| 5078 | uint64_t fw_version_number; | ||
| 5079 | }; | ||
| 5080 | } __ec_align2; | ||
| 5081 | |||
| 5082 | struct ec_response_pd_chip_info_v1 { | ||
| 5083 | uint16_t vendor_id; | ||
| 5084 | uint16_t product_id; | ||
| 5085 | uint16_t device_id; | ||
| 5086 | union { | ||
| 5087 | uint8_t fw_version_string[8]; | ||
| 5088 | uint64_t fw_version_number; | ||
| 5089 | }; | ||
| 5090 | union { | ||
| 5091 | uint8_t min_req_fw_version_string[8]; | ||
| 5092 | uint64_t min_req_fw_version_number; | ||
| 5093 | }; | ||
| 5094 | } __ec_align2; | ||
| 5095 | |||
| 5096 | /* Run RW signature verification and get status */ | ||
| 5097 | #define EC_CMD_RWSIG_CHECK_STATUS 0x011C | ||
| 5098 | |||
| 5099 | struct ec_response_rwsig_check_status { | ||
| 5100 | uint32_t status; | ||
| 5101 | } __ec_align4; | ||
| 5102 | |||
| 5103 | /* For controlling RWSIG task */ | ||
| 5104 | #define EC_CMD_RWSIG_ACTION 0x011D | ||
| 5105 | |||
| 5106 | enum rwsig_action { | ||
| 5107 | RWSIG_ACTION_ABORT = 0, /* Abort RWSIG and prevent jumping */ | ||
| 5108 | RWSIG_ACTION_CONTINUE = 1, /* Jump to RW immediately */ | ||
| 5109 | }; | ||
| 5110 | |||
| 5111 | struct ec_params_rwsig_action { | ||
| 5112 | uint32_t action; | ||
| 5113 | } __ec_align4; | ||
| 5114 | |||
| 5115 | /* Run verification on a slot */ | ||
| 5116 | #define EC_CMD_EFS_VERIFY 0x011E | ||
| 5117 | |||
| 5118 | struct ec_params_efs_verify { | ||
| 5119 | uint8_t region; /* enum ec_flash_region */ | ||
| 5120 | } __ec_align1; | ||
| 5121 | |||
| 5122 | /* | ||
| 5123 | * Retrieve info from Cros Board Info store. Response is based on the data | ||
| 5124 | * type. Integers return a uint32. Strings return a string, using the response | ||
| 5125 | * size to determine how big it is. | ||
| 5126 | */ | ||
| 5127 | #define EC_CMD_GET_CROS_BOARD_INFO 0x011F | ||
| 5128 | /* | ||
| 5129 | * Write info into Cros Board Info on EEPROM. Write fails if the board has | ||
| 5130 | * hardware write-protect enabled. | ||
| 5131 | */ | ||
| 5132 | #define EC_CMD_SET_CROS_BOARD_INFO 0x0120 | ||
| 5133 | |||
| 5134 | enum cbi_data_tag { | ||
| 5135 | CBI_TAG_BOARD_VERSION = 0, /* uint32_t or smaller */ | ||
| 5136 | CBI_TAG_OEM_ID = 1, /* uint32_t or smaller */ | ||
| 5137 | CBI_TAG_SKU_ID = 2, /* uint32_t or smaller */ | ||
| 5138 | CBI_TAG_DRAM_PART_NUM = 3, /* variable length ascii, nul terminated. */ | ||
| 5139 | CBI_TAG_OEM_NAME = 4, /* variable length ascii, nul terminated. */ | ||
| 5140 | CBI_TAG_MODEL_ID = 5, /* uint32_t or smaller */ | ||
| 5141 | CBI_TAG_COUNT, | ||
| 5142 | }; | ||
| 5143 | |||
| 5144 | /* | ||
| 5145 | * Flags to control read operation | ||
| 5146 | * | ||
| 5147 | * RELOAD: Invalidate cache and read data from EEPROM. Useful to verify | ||
| 5148 | * write was successful without reboot. | ||
| 5149 | */ | ||
| 5150 | #define CBI_GET_RELOAD BIT(0) | ||
| 5151 | |||
| 5152 | struct ec_params_get_cbi { | ||
| 5153 | uint32_t tag; /* enum cbi_data_tag */ | ||
| 5154 | uint32_t flag; /* CBI_GET_* */ | ||
| 5155 | } __ec_align4; | ||
| 5156 | |||
| 5157 | /* | ||
| 5158 | * Flags to control write behavior. | ||
| 5159 | * | ||
| 5160 | * NO_SYNC: Makes EC update data in RAM but skip writing to EEPROM. It's | ||
| 5161 | * useful when writing multiple fields in a row. | ||
| 5162 | * INIT: Need to be set when creating a new CBI from scratch. All fields | ||
| 5163 | * will be initialized to zero first. | ||
| 5164 | */ | ||
| 5165 | #define CBI_SET_NO_SYNC BIT(0) | ||
| 5166 | #define CBI_SET_INIT BIT(1) | ||
| 5167 | |||
| 5168 | struct ec_params_set_cbi { | ||
| 5169 | uint32_t tag; /* enum cbi_data_tag */ | ||
| 5170 | uint32_t flag; /* CBI_SET_* */ | ||
| 5171 | uint32_t size; /* Data size */ | ||
| 5172 | uint8_t data[]; /* For string and raw data */ | ||
| 5173 | } __ec_align1; | ||
| 5174 | |||
| 5175 | /* | ||
| 5176 | * Information about resets of the AP by the EC and the EC's own uptime. | ||
| 5177 | */ | ||
| 5178 | #define EC_CMD_GET_UPTIME_INFO 0x0121 | ||
| 5179 | |||
| 5180 | struct ec_response_uptime_info { | ||
| 5181 | /* | ||
| 5182 | * Number of milliseconds since the last EC boot. Sysjump resets | ||
| 5183 | * typically do not restart the EC's time_since_boot epoch. | ||
| 5184 | * | ||
| 5185 | * WARNING: The EC's sense of time is much less accurate than the AP's | ||
| 5186 | * sense of time, in both phase and frequency. This timebase is similar | ||
| 5187 | * to CLOCK_MONOTONIC_RAW, but with 1% or more frequency error. | ||
| 5188 | */ | ||
| 5189 | uint32_t time_since_ec_boot_ms; | ||
| 5190 | |||
| 5191 | /* | ||
| 5192 | * Number of times the AP was reset by the EC since the last EC boot. | ||
| 5193 | * Note that the AP may be held in reset by the EC during the initial | ||
| 5194 | * boot sequence, such that the very first AP boot may count as more | ||
| 5195 | * than one here. | ||
| 5196 | */ | ||
| 5197 | uint32_t ap_resets_since_ec_boot; | ||
| 5198 | |||
| 5199 | /* | ||
| 5200 | * The set of flags which describe the EC's most recent reset. See | ||
| 5201 | * include/system.h RESET_FLAG_* for details. | ||
| 5202 | */ | ||
| 5203 | uint32_t ec_reset_flags; | ||
| 5204 | |||
| 5205 | /* Empty log entries have both the cause and timestamp set to zero. */ | ||
| 5206 | struct ap_reset_log_entry { | ||
| 5207 | /* | ||
| 5208 | * See include/chipset.h: enum chipset_{reset,shutdown}_reason | ||
| 5209 | * for details. | ||
| 5210 | */ | ||
| 5211 | uint16_t reset_cause; | ||
| 5212 | |||
| 5213 | /* Reserved for protocol growth. */ | ||
| 5214 | uint16_t reserved; | ||
| 5215 | |||
| 5216 | /* | ||
| 5217 | * The time of the reset's assertion, in milliseconds since the | ||
| 5218 | * last EC boot, in the same epoch as time_since_ec_boot_ms. | ||
| 5219 | * Set to zero if the log entry is empty. | ||
| 5220 | */ | ||
| 5221 | uint32_t reset_time_ms; | ||
| 5222 | } recent_ap_reset[4]; | ||
| 5223 | } __ec_align4; | ||
| 5224 | |||
| 5225 | /* | ||
| 5226 | * Add entropy to the device secret (stored in the rollback region). | ||
| 5227 | * | ||
| 5228 | * Depending on the chip, the operation may take a long time (e.g. to erase | ||
| 5229 | * flash), so the commands are asynchronous. | ||
| 5230 | */ | ||
| 5231 | #define EC_CMD_ADD_ENTROPY 0x0122 | ||
| 5232 | |||
| 5233 | enum add_entropy_action { | ||
| 5234 | /* Add entropy to the current secret. */ | ||
| 5235 | ADD_ENTROPY_ASYNC = 0, | ||
| 5236 | /* | ||
| 5237 | * Add entropy, and also make sure that the previous secret is erased. | ||
| 5238 | * (this can be implemented by adding entropy multiple times until | ||
| 5239 | * all rolback blocks have been overwritten). | ||
| 5240 | */ | ||
| 5241 | ADD_ENTROPY_RESET_ASYNC = 1, | ||
| 5242 | /* Read back result from the previous operation. */ | ||
| 5243 | ADD_ENTROPY_GET_RESULT = 2, | ||
| 5244 | }; | ||
| 5245 | |||
| 5246 | struct ec_params_rollback_add_entropy { | ||
| 5247 | uint8_t action; | ||
| 5248 | } __ec_align1; | ||
| 5249 | |||
| 5250 | /* | ||
| 5251 | * Perform a single read of a given ADC channel. | ||
| 5252 | */ | ||
| 5253 | #define EC_CMD_ADC_READ 0x0123 | ||
| 5254 | |||
| 5255 | struct ec_params_adc_read { | ||
| 5256 | uint8_t adc_channel; | ||
| 5257 | } __ec_align1; | ||
| 5258 | |||
| 5259 | struct ec_response_adc_read { | ||
| 5260 | int32_t adc_value; | ||
| 5261 | } __ec_align4; | ||
| 5262 | |||
| 5263 | /* | ||
| 5264 | * Read back rollback info | ||
| 5265 | */ | ||
| 5266 | #define EC_CMD_ROLLBACK_INFO 0x0124 | ||
| 5267 | |||
| 5268 | struct ec_response_rollback_info { | ||
| 5269 | int32_t id; /* Incrementing number to indicate which region to use. */ | ||
| 5270 | int32_t rollback_min_version; | ||
| 5271 | int32_t rw_rollback_version; | ||
| 5272 | } __ec_align4; | ||
409 more lines aren’t shown here.
| @@ -797,6 +797,9 @@ · 796 unmodified lines | |||
| 797 | #define DA9062AA_BUCK3_SL_A_SHIFT 7 | 797 | #define DA9062AA_BUCK3_SL_A_SHIFT 7 |
| 798 | #define DA9062AA_BUCK3_SL_A_MASK BIT(7) | 798 | #define DA9062AA_BUCK3_SL_A_MASK BIT(7) |
| 799 | 799 | ||
| 800 | /* DA9062AA_VLDO[1-4]_A common */ | ||
| 801 | #define DA9062AA_VLDO_A_MIN_SEL 2 | ||
| 802 | |||
| 800 | /* DA9062AA_VLDO1_A = 0x0A9 */ | 803 | /* DA9062AA_VLDO1_A = 0x0A9 */ |
| 801 | #define DA9062AA_VLDO1_A_SHIFT 0 | 804 | #define DA9062AA_VLDO1_A_SHIFT 0 |
| 802 | #define DA9062AA_VLDO1_A_MASK 0x3f | 805 | #define DA9062AA_VLDO1_A_MASK 0x3f |
| @@ -11,55 +11,6 @@ · 10 unmodified lines | |||
| 11 | #ifndef __MFD_DA9063_PDATA_H__ | 11 | #ifndef __MFD_DA9063_PDATA_H__ |
| 12 | #define __MFD_DA9063_PDATA_H__ | 12 | #define __MFD_DA9063_PDATA_H__ |
| 13 | 13 | ||
| 14 | #include <linux/regulator/machine.h> | ||
| 15 | |||
| 16 | /* | ||
| 17 | * Regulator configuration | ||
| 18 | */ | ||
| 19 | /* DA9063 and DA9063L regulator IDs */ | ||
| 20 | enum { | ||
| 21 | /* BUCKs */ | ||
| 22 | DA9063_ID_BCORE1, | ||
| 23 | DA9063_ID_BCORE2, | ||
| 24 | DA9063_ID_BPRO, | ||
| 25 | DA9063_ID_BMEM, | ||
| 26 | DA9063_ID_BIO, | ||
| 27 | DA9063_ID_BPERI, | ||
| 28 | |||
| 29 | /* BCORE1 and BCORE2 in merged mode */ | ||
| 30 | DA9063_ID_BCORES_MERGED, | ||
| 31 | /* BMEM and BIO in merged mode */ | ||
| 32 | DA9063_ID_BMEM_BIO_MERGED, | ||
| 33 | /* When two BUCKs are merged, they cannot be reused separately */ | ||
| 34 | |||
| 35 | /* LDOs on both DA9063 and DA9063L */ | ||
| 36 | DA9063_ID_LDO3, | ||
| 37 | DA9063_ID_LDO7, | ||
| 38 | DA9063_ID_LDO8, | ||
| 39 | DA9063_ID_LDO9, | ||
| 40 | DA9063_ID_LDO11, | ||
| 41 | |||
| 42 | /* DA9063-only LDOs */ | ||
| 43 | DA9063_ID_LDO1, | ||
| 44 | DA9063_ID_LDO2, | ||
| 45 | DA9063_ID_LDO4, | ||
| 46 | DA9063_ID_LDO5, | ||
| 47 | DA9063_ID_LDO6, | ||
| 48 | DA9063_ID_LDO10, | ||
| 49 | }; | ||
| 50 | |||
| 51 | /* Regulators platform data */ | ||
| 52 | struct da9063_regulator_data { | ||
| 53 | int id; | ||
| 54 | struct regulator_init_data *initdata; | ||
| 55 | }; | ||
| 56 | |||
| 57 | struct da9063_regulators_pdata { | ||
| 58 | unsigned n_regulators; | ||
| 59 | struct da9063_regulator_data *regulator_data; | ||
| 60 | }; | ||
| 61 | |||
| 62 | |||
| 63 | /* | 14 | /* |
| 64 | * RGB LED configuration | 15 | * RGB LED configuration |
| 65 | */ | 16 | */ |
| @@ -14,6 +14,7 @@ · 13 unmodified lines | |||
| 14 | 14 | ||
| 15 | enum lp87565_device_type { | 15 | enum lp87565_device_type { |
| 16 | LP87565_DEVICE_TYPE_UNKNOWN = 0, | 16 | LP87565_DEVICE_TYPE_UNKNOWN = 0, |
| 17 | LP87565_DEVICE_TYPE_LP87561_Q1, | ||
| 17 | LP87565_DEVICE_TYPE_LP87565_Q1, | 18 | LP87565_DEVICE_TYPE_LP87565_Q1, |
| 18 | }; | 19 | }; |
| 19 | 20 | ||
| @@ -246,6 +247,7 @@ enum LP87565_regulator_id { · 226 unmodified lines | |||
| 246 | LP87565_BUCK_3, | 247 | LP87565_BUCK_3, |
| 247 | LP87565_BUCK_10, | 248 | LP87565_BUCK_10, |
| 248 | LP87565_BUCK_23, | 249 | LP87565_BUCK_23, |
| 250 | LP87565_BUCK_3210, | ||
| 249 | }; | 251 | }; |
| 250 | 252 | ||
| 251 | /** | 253 | /** |
| @@ -1,12 +1,8 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0 | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | /* | 2 | /* |
| 3 | * MFD internals for Cirrus Logic Madera codecs | 3 | * MFD internals for Cirrus Logic Madera codecs |
| 4 | * | 4 | * |
| 5 | * Copyright (C) 2015-2018 Cirrus Logic | 5 | * Copyright (C) 2015-2018 Cirrus Logic |
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License as published by the | ||
| 9 | * Free Software Foundation; version 2. | ||
| 10 | */ | 6 | */ |
| 11 | 7 | ||
| 12 | #ifndef MADERA_CORE_H | 8 | #ifndef MADERA_CORE_H |
| @@ -26,15 +22,21 @@ enum madera_type { · 13 unmodified lines | |||
| 26 | CS47L85 = 2, | 22 | CS47L85 = 2, |
| 27 | CS47L90 = 3, | 23 | CS47L90 = 3, |
| 28 | CS47L91 = 4, | 24 | CS47L91 = 4, |
| 25 | CS47L92 = 5, | ||
| 26 | CS47L93 = 6, | ||
| 29 | WM1840 = 7, | 27 | WM1840 = 7, |
| 28 | CS47L15 = 8, | ||
| 29 | CS42L92 = 9, | ||
| 30 | }; | 30 | }; |
| 31 | 31 | ||
| 32 | #define MADERA_MAX_CORE_SUPPLIES 2 | 32 | #define MADERA_MAX_CORE_SUPPLIES 2 |
| 33 | #define MADERA_MAX_GPIOS 40 | 33 | #define MADERA_MAX_GPIOS 40 |
| 34 | 34 | ||
| 35 | #define CS47L15_NUM_GPIOS 15 | ||
| 35 | #define CS47L35_NUM_GPIOS 16 | 36 | #define CS47L35_NUM_GPIOS 16 |
| 36 | #define CS47L85_NUM_GPIOS 40 | 37 | #define CS47L85_NUM_GPIOS 40 |
| 37 | #define CS47L90_NUM_GPIOS 38 | 38 | #define CS47L90_NUM_GPIOS 38 |
| 39 | #define CS47L92_NUM_GPIOS 16 | ||
| 38 | 40 | ||
| 39 | #define MADERA_MAX_MICBIAS 4 | 41 | #define MADERA_MAX_MICBIAS 4 |
| 40 | 42 | ||
| @@ -1,12 +1,8 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0 | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | /* | 2 | /* |
| 3 | * Platform data for Cirrus Logic Madera codecs | 3 | * Platform data for Cirrus Logic Madera codecs |
| 4 | * | 4 | * |
| 5 | * Copyright (C) 2015-2018 Cirrus Logic | 5 | * Copyright (C) 2015-2018 Cirrus Logic |
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License as published by the | ||
| 9 | * Free Software Foundation; version 2. | ||
| 10 | */ | 6 | */ |
| 11 | 7 | ||
| 12 | #ifndef MADERA_PDATA_H | 8 | #ifndef MADERA_PDATA_H |
| @@ -16,6 +12,7 @@ · 3 unmodified lines | |||
| 16 | #include <linux/regulator/arizona-ldo1.h> | 12 | #include <linux/regulator/arizona-ldo1.h> |
| 17 | #include <linux/regulator/arizona-micsupp.h> | 13 | #include <linux/regulator/arizona-micsupp.h> |
| 18 | #include <linux/regulator/machine.h> | 14 | #include <linux/regulator/machine.h> |
| 15 | #include <sound/madera-pdata.h> | ||
| 19 | 16 | ||
| 20 | #define MADERA_MAX_MICBIAS 4 | 17 | #define MADERA_MAX_MICBIAS 4 |
| 21 | #define MADERA_MAX_CHILD_MICBIAS 4 | 18 | #define MADERA_MAX_CHILD_MICBIAS 4 |
| @@ -34,11 +31,13 @@ struct madera_codec_pdata; · 12 unmodified lines | |||
| 34 | * @micvdd: Substruct of pdata for the MICVDD regulator | 31 | * @micvdd: Substruct of pdata for the MICVDD regulator |
| 35 | * @irq_flags: Mode for primary IRQ (defaults to active low) | 32 | * @irq_flags: Mode for primary IRQ (defaults to active low) |
| 36 | * @gpio_base: Base GPIO number | 33 | * @gpio_base: Base GPIO number |
| 37 | * @gpio_configs: Array of GPIO configurations (See Documentation/pinctrl.txt) | 34 | * @gpio_configs: Array of GPIO configurations (See |
| 35 | * Documentation/driver-api/pinctl.rst) | ||
| 38 | * @n_gpio_configs: Number of entries in gpio_configs | 36 | * @n_gpio_configs: Number of entries in gpio_configs |
| 39 | * @gpsw: General purpose switch mode setting. Depends on the external | 37 | * @gpsw: General purpose switch mode setting. Depends on the external |
| 40 | * hardware connected to the switch. (See the SW1_MODE field | 38 | * hardware connected to the switch. (See the SW1_MODE field |
| 41 | * in the datasheet for the available values for your codec) | 39 | * in the datasheet for the available values for your codec) |
| 40 | * @codec: Substruct of pdata for the ASoC codec driver | ||
| 42 | */ | 41 | */ |
| 43 | struct madera_pdata { | 42 | struct madera_pdata { |
| 44 | struct gpio_desc *reset; | 43 | struct gpio_desc *reset; |
| @@ -53,6 +52,8 @@ struct madera_pdata { · 8 unmodified lines | |||
| 53 | int n_gpio_configs; | 52 | int n_gpio_configs; |
| 54 | 53 | ||
| 55 | u32 gpsw[MADERA_MAX_GPSW]; | 54 | u32 gpsw[MADERA_MAX_GPSW]; |
| 55 | |||
| 56 | struct madera_codec_pdata codec; | ||
| 56 | }; | 57 | }; |
| 57 | 58 | ||
| 58 | #endif | 59 | #endif |
| @@ -1,12 +1,8 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0 | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | /* | 2 | /* |
| 3 | * Madera register definitions | 3 | * Madera register definitions |
| 4 | * | 4 | * |
| 5 | * Copyright (C) 2015-2018 Cirrus Logic | 5 | * Copyright (C) 2015-2018 Cirrus Logic |
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License as published by the | ||
| 9 | * Free Software Foundation; version 2. | ||
| 10 | */ | 6 | */ |
| 11 | 7 | ||
| 12 | #ifndef MADERA_REGISTERS_H | 8 | #ifndef MADERA_REGISTERS_H |
| @@ -76,10 +72,14 @@ · 63 unmodified lines | |||
| 76 | #define MADERA_FLL1_CONTROL_4 0x174 | 72 | #define MADERA_FLL1_CONTROL_4 0x174 |
| 77 | #define MADERA_FLL1_CONTROL_5 0x175 | 73 | #define MADERA_FLL1_CONTROL_5 0x175 |
| 78 | #define MADERA_FLL1_CONTROL_6 0x176 | 74 | #define MADERA_FLL1_CONTROL_6 0x176 |
| 79 | #define MADERA_FLL1_LOOP_FILTER_TEST_1 0x177 | 75 | #define CS47L92_FLL1_CONTROL_7 0x177 |
| 80 | #define MADERA_FLL1_NCO_TEST_0 0x178 | 76 | #define CS47L92_FLL1_CONTROL_8 0x178 |
| 81 | #define MADERA_FLL1_CONTROL_7 0x179 | 77 | #define MADERA_FLL1_CONTROL_7 0x179 |
| 78 | #define CS47L92_FLL1_CONTROL_9 0x179 | ||
| 82 | #define MADERA_FLL1_EFS_2 0x17A | 79 | #define MADERA_FLL1_EFS_2 0x17A |
| 80 | #define CS47L92_FLL1_CONTROL_10 0x17A | ||
| 81 | #define MADERA_FLL1_CONTROL_11 0x17B | ||
| 82 | #define MADERA_FLL1_DIGITAL_TEST_1 0x17D | ||
| 83 | #define CS47L35_FLL1_SYNCHRONISER_1 0x17F | 83 | #define CS47L35_FLL1_SYNCHRONISER_1 0x17F |
| 84 | #define CS47L35_FLL1_SYNCHRONISER_2 0x180 | 84 | #define CS47L35_FLL1_SYNCHRONISER_2 0x180 |
| 85 | #define CS47L35_FLL1_SYNCHRONISER_3 0x181 | 85 | #define CS47L35_FLL1_SYNCHRONISER_3 0x181 |
| @@ -98,16 +98,21 @@ · 12 unmodified lines | |||
| 98 | #define MADERA_FLL1_SYNCHRONISER_7 0x187 | 98 | #define MADERA_FLL1_SYNCHRONISER_7 0x187 |
| 99 | #define MADERA_FLL1_SPREAD_SPECTRUM 0x189 | 99 | #define MADERA_FLL1_SPREAD_SPECTRUM 0x189 |
| 100 | #define MADERA_FLL1_GPIO_CLOCK 0x18A | 100 | #define MADERA_FLL1_GPIO_CLOCK 0x18A |
| 101 | #define CS47L92_FLL1_GPIO_CLOCK 0x18E | ||
| 101 | #define MADERA_FLL2_CONTROL_1 0x191 | 102 | #define MADERA_FLL2_CONTROL_1 0x191 |
| 102 | #define MADERA_FLL2_CONTROL_2 0x192 | 103 | #define MADERA_FLL2_CONTROL_2 0x192 |
| 103 | #define MADERA_FLL2_CONTROL_3 0x193 | 104 | #define MADERA_FLL2_CONTROL_3 0x193 |
| 104 | #define MADERA_FLL2_CONTROL_4 0x194 | 105 | #define MADERA_FLL2_CONTROL_4 0x194 |
| 105 | #define MADERA_FLL2_CONTROL_5 0x195 | 106 | #define MADERA_FLL2_CONTROL_5 0x195 |
| 106 | #define MADERA_FLL2_CONTROL_6 0x196 | 107 | #define MADERA_FLL2_CONTROL_6 0x196 |
| 107 | #define MADERA_FLL2_LOOP_FILTER_TEST_1 0x197 | 108 | #define CS47L92_FLL2_CONTROL_7 0x197 |
| 108 | #define MADERA_FLL2_NCO_TEST_0 0x198 | 109 | #define CS47L92_FLL2_CONTROL_8 0x198 |
| 109 | #define MADERA_FLL2_CONTROL_7 0x199 | 110 | #define MADERA_FLL2_CONTROL_7 0x199 |
| 111 | #define CS47L92_FLL2_CONTROL_9 0x199 | ||
| 110 | #define MADERA_FLL2_EFS_2 0x19A | 112 | #define MADERA_FLL2_EFS_2 0x19A |
| 113 | #define CS47L92_FLL2_CONTROL_10 0x19A | ||
| 114 | #define MADERA_FLL2_CONTROL_11 0x19B | ||
| 115 | #define MADERA_FLL2_DIGITAL_TEST_1 0x19D | ||
| 111 | #define MADERA_FLL2_SYNCHRONISER_1 0x1A1 | 116 | #define MADERA_FLL2_SYNCHRONISER_1 0x1A1 |
| 112 | #define MADERA_FLL2_SYNCHRONISER_2 0x1A2 | 117 | #define MADERA_FLL2_SYNCHRONISER_2 0x1A2 |
| 113 | #define MADERA_FLL2_SYNCHRONISER_3 0x1A3 | 118 | #define MADERA_FLL2_SYNCHRONISER_3 0x1A3 |
| @@ -117,14 +122,13 @@ · 3 unmodified lines | |||
| 117 | #define MADERA_FLL2_SYNCHRONISER_7 0x1A7 | 122 | #define MADERA_FLL2_SYNCHRONISER_7 0x1A7 |
| 118 | #define MADERA_FLL2_SPREAD_SPECTRUM 0x1A9 | 123 | #define MADERA_FLL2_SPREAD_SPECTRUM 0x1A9 |
| 119 | #define MADERA_FLL2_GPIO_CLOCK 0x1AA | 124 | #define MADERA_FLL2_GPIO_CLOCK 0x1AA |
| 125 | #define CS47L92_FLL2_GPIO_CLOCK 0x1AE | ||
| 120 | #define MADERA_FLL3_CONTROL_1 0x1B1 | 126 | #define MADERA_FLL3_CONTROL_1 0x1B1 |
| 121 | #define MADERA_FLL3_CONTROL_2 0x1B2 | 127 | #define MADERA_FLL3_CONTROL_2 0x1B2 |
| 122 | #define MADERA_FLL3_CONTROL_3 0x1B3 | 128 | #define MADERA_FLL3_CONTROL_3 0x1B3 |
| 123 | #define MADERA_FLL3_CONTROL_4 0x1B4 | 129 | #define MADERA_FLL3_CONTROL_4 0x1B4 |
| 124 | #define MADERA_FLL3_CONTROL_5 0x1B5 | 130 | #define MADERA_FLL3_CONTROL_5 0x1B5 |
| 125 | #define MADERA_FLL3_CONTROL_6 0x1B6 | 131 | #define MADERA_FLL3_CONTROL_6 0x1B6 |
| 126 | #define MADERA_FLL3_LOOP_FILTER_TEST_1 0x1B7 | ||
| 127 | #define MADERA_FLL3_NCO_TEST_0 0x1B8 | ||
| 128 | #define MADERA_FLL3_CONTROL_7 0x1B9 | 132 | #define MADERA_FLL3_CONTROL_7 0x1B9 |
| 129 | #define MADERA_FLL3_SYNCHRONISER_1 0x1C1 | 133 | #define MADERA_FLL3_SYNCHRONISER_1 0x1C1 |
| 130 | #define MADERA_FLL3_SYNCHRONISER_2 0x1C2 | 134 | #define MADERA_FLL3_SYNCHRONISER_2 0x1C2 |
| @@ -244,6 +248,8 @@ · 113 unmodified lines | |||
| 244 | #define MADERA_IN6R_CONTROL 0x33C | 248 | #define MADERA_IN6R_CONTROL 0x33C |
| 245 | #define MADERA_ADC_DIGITAL_VOLUME_6R 0x33D | 249 | #define MADERA_ADC_DIGITAL_VOLUME_6R 0x33D |
| 246 | #define MADERA_DMIC6R_CONTROL 0x33E | 250 | #define MADERA_DMIC6R_CONTROL 0x33E |
| 251 | #define CS47L15_ADC_INT_BIAS 0x3A8 | ||
| 252 | #define CS47L15_PGA_BIAS_SEL 0x3C4 | ||
| 247 | #define MADERA_OUTPUT_ENABLES_1 0x400 | 253 | #define MADERA_OUTPUT_ENABLES_1 0x400 |
| 248 | #define MADERA_OUTPUT_STATUS_1 0x401 | 254 | #define MADERA_OUTPUT_STATUS_1 0x401 |
| 249 | #define MADERA_RAW_OUTPUT_STATUS_1 0x406 | 255 | #define MADERA_RAW_OUTPUT_STATUS_1 0x406 |
| @@ -265,6 +271,7 @@ · 15 unmodified lines | |||
| 265 | #define MADERA_NOISE_GATE_SELECT_2R 0x41F | 271 | #define MADERA_NOISE_GATE_SELECT_2R 0x41F |
| 266 | #define MADERA_OUTPUT_PATH_CONFIG_3L 0x420 | 272 | #define MADERA_OUTPUT_PATH_CONFIG_3L 0x420 |
| 267 | #define MADERA_DAC_DIGITAL_VOLUME_3L 0x421 | 273 | #define MADERA_DAC_DIGITAL_VOLUME_3L 0x421 |
| 274 | #define MADERA_OUTPUT_PATH_CONFIG_3 0x422 | ||
| 268 | #define MADERA_NOISE_GATE_SELECT_3L 0x423 | 275 | #define MADERA_NOISE_GATE_SELECT_3L 0x423 |
| 269 | #define MADERA_OUTPUT_PATH_CONFIG_3R 0x424 | 276 | #define MADERA_OUTPUT_PATH_CONFIG_3R 0x424 |
| 270 | #define MADERA_DAC_DIGITAL_VOLUME_3R 0x425 | 277 | #define MADERA_DAC_DIGITAL_VOLUME_3R 0x425 |
| @@ -287,9 +294,6 @@ · 16 unmodified lines | |||
| 287 | #define MADERA_OUTPUT_PATH_CONFIG_6R 0x43C | 294 | #define MADERA_OUTPUT_PATH_CONFIG_6R 0x43C |
| 288 | #define MADERA_DAC_DIGITAL_VOLUME_6R 0x43D | 295 | #define MADERA_DAC_DIGITAL_VOLUME_6R 0x43D |
| 289 | #define MADERA_NOISE_GATE_SELECT_6R 0x43F | 296 | #define MADERA_NOISE_GATE_SELECT_6R 0x43F |
| 290 | #define MADERA_DRE_ENABLE 0x440 | ||
| 291 | #define MADERA_EDRE_ENABLE 0x448 | ||
| 292 | #define MADERA_EDRE_MANUAL 0x44A | ||
| 293 | #define MADERA_DAC_AEC_CONTROL_1 0x450 | 297 | #define MADERA_DAC_AEC_CONTROL_1 0x450 |
| 294 | #define MADERA_DAC_AEC_CONTROL_2 0x451 | 298 | #define MADERA_DAC_AEC_CONTROL_2 0x451 |
| 295 | #define MADERA_NOISE_GATE_CONTROL 0x458 | 299 | #define MADERA_NOISE_GATE_CONTROL 0x458 |
| @@ -367,8 +371,20 @@ · 71 unmodified lines | |||
| 367 | #define MADERA_AIF3_FRAME_CTRL_2 0x588 | 371 | #define MADERA_AIF3_FRAME_CTRL_2 0x588 |
| 368 | #define MADERA_AIF3_FRAME_CTRL_3 0x589 | 372 | #define MADERA_AIF3_FRAME_CTRL_3 0x589 |
| 369 | #define MADERA_AIF3_FRAME_CTRL_4 0x58A | 373 | #define MADERA_AIF3_FRAME_CTRL_4 0x58A |
| 374 | #define MADERA_AIF3_FRAME_CTRL_5 0x58B | ||
| 375 | #define MADERA_AIF3_FRAME_CTRL_6 0x58C | ||
| 376 | #define MADERA_AIF3_FRAME_CTRL_7 0x58D | ||
| 377 | #define MADERA_AIF3_FRAME_CTRL_8 0x58E | ||
| 378 | #define MADERA_AIF3_FRAME_CTRL_9 0x58F | ||
| 379 | #define MADERA_AIF3_FRAME_CTRL_10 0x590 | ||
| 370 | #define MADERA_AIF3_FRAME_CTRL_11 0x591 | 380 | #define MADERA_AIF3_FRAME_CTRL_11 0x591 |
| 371 | #define MADERA_AIF3_FRAME_CTRL_12 0x592 | 381 | #define MADERA_AIF3_FRAME_CTRL_12 0x592 |
| 382 | #define MADERA_AIF3_FRAME_CTRL_13 0x593 | ||
| 383 | #define MADERA_AIF3_FRAME_CTRL_14 0x594 | ||
| 384 | #define MADERA_AIF3_FRAME_CTRL_15 0x595 | ||
| 385 | #define MADERA_AIF3_FRAME_CTRL_16 0x596 | ||
| 386 | #define MADERA_AIF3_FRAME_CTRL_17 0x597 | ||
| 387 | #define MADERA_AIF3_FRAME_CTRL_18 0x598 | ||
| 372 | #define MADERA_AIF3_TX_ENABLES 0x599 | 388 | #define MADERA_AIF3_TX_ENABLES 0x599 |
| 373 | #define MADERA_AIF3_RX_ENABLES 0x59A | 389 | #define MADERA_AIF3_RX_ENABLES 0x59A |
| 374 | #define MADERA_AIF3_FORCE_WRITE 0x59B | 390 | #define MADERA_AIF3_FORCE_WRITE 0x59B |
| @@ -660,6 +676,54 @@ · 285 unmodified lines | |||
| 660 | #define MADERA_AIF3TX2MIX_INPUT_3_VOLUME 0x78D | 676 | #define MADERA_AIF3TX2MIX_INPUT_3_VOLUME 0x78D |
| 661 | #define MADERA_AIF3TX2MIX_INPUT_4_SOURCE 0x78E | 677 | #define MADERA_AIF3TX2MIX_INPUT_4_SOURCE 0x78E |
| 662 | #define MADERA_AIF3TX2MIX_INPUT_4_VOLUME 0x78F | 678 | #define MADERA_AIF3TX2MIX_INPUT_4_VOLUME 0x78F |
| 679 | #define MADERA_AIF3TX3MIX_INPUT_1_SOURCE 0x790 | ||
| 680 | #define MADERA_AIF3TX3MIX_INPUT_1_VOLUME 0x791 | ||
| 681 | #define MADERA_AIF3TX3MIX_INPUT_2_SOURCE 0x792 | ||
| 682 | #define MADERA_AIF3TX3MIX_INPUT_2_VOLUME 0x793 | ||
| 683 | #define MADERA_AIF3TX3MIX_INPUT_3_SOURCE 0x794 | ||
| 684 | #define MADERA_AIF3TX3MIX_INPUT_3_VOLUME 0x795 | ||
| 685 | #define MADERA_AIF3TX3MIX_INPUT_4_SOURCE 0x796 | ||
| 686 | #define MADERA_AIF3TX3MIX_INPUT_4_VOLUME 0x797 | ||
| 687 | #define MADERA_AIF3TX4MIX_INPUT_1_SOURCE 0x798 | ||
| 688 | #define MADERA_AIF3TX4MIX_INPUT_1_VOLUME 0x799 | ||
| 689 | #define MADERA_AIF3TX4MIX_INPUT_2_SOURCE 0x79A | ||
| 690 | #define MADERA_AIF3TX4MIX_INPUT_2_VOLUME 0x79B | ||
| 691 | #define MADERA_AIF3TX4MIX_INPUT_3_SOURCE 0x79C | ||
| 692 | #define MADERA_AIF3TX4MIX_INPUT_3_VOLUME 0x79D | ||
| 693 | #define MADERA_AIF3TX4MIX_INPUT_4_SOURCE 0x79E | ||
| 694 | #define MADERA_AIF3TX4MIX_INPUT_4_VOLUME 0x79F | ||
| 695 | #define CS47L92_AIF3TX5MIX_INPUT_1_SOURCE 0x7A0 | ||
| 696 | #define CS47L92_AIF3TX5MIX_INPUT_1_VOLUME 0x7A1 | ||
| 697 | #define CS47L92_AIF3TX5MIX_INPUT_2_SOURCE 0x7A2 | ||
| 698 | #define CS47L92_AIF3TX5MIX_INPUT_2_VOLUME 0x7A3 | ||
| 699 | #define CS47L92_AIF3TX5MIX_INPUT_3_SOURCE 0x7A4 | ||
| 700 | #define CS47L92_AIF3TX5MIX_INPUT_3_VOLUME 0x7A5 | ||
| 701 | #define CS47L92_AIF3TX5MIX_INPUT_4_SOURCE 0x7A6 | ||
| 702 | #define CS47L92_AIF3TX5MIX_INPUT_4_VOLUME 0x7A7 | ||
| 703 | #define CS47L92_AIF3TX6MIX_INPUT_1_SOURCE 0x7A8 | ||
| 704 | #define CS47L92_AIF3TX6MIX_INPUT_1_VOLUME 0x7A9 | ||
| 705 | #define CS47L92_AIF3TX6MIX_INPUT_2_SOURCE 0x7AA | ||
| 706 | #define CS47L92_AIF3TX6MIX_INPUT_2_VOLUME 0x7AB | ||
| 707 | #define CS47L92_AIF3TX6MIX_INPUT_3_SOURCE 0x7AC | ||
| 708 | #define CS47L92_AIF3TX6MIX_INPUT_3_VOLUME 0x7AD | ||
| 709 | #define CS47L92_AIF3TX6MIX_INPUT_4_SOURCE 0x7AE | ||
| 710 | #define CS47L92_AIF3TX6MIX_INPUT_4_VOLUME 0x7AF | ||
| 711 | #define CS47L92_AIF3TX7MIX_INPUT_1_SOURCE 0x7B0 | ||
| 712 | #define CS47L92_AIF3TX7MIX_INPUT_1_VOLUME 0x7B1 | ||
| 713 | #define CS47L92_AIF3TX7MIX_INPUT_2_SOURCE 0x7B2 | ||
| 714 | #define CS47L92_AIF3TX7MIX_INPUT_2_VOLUME 0x7B3 | ||
| 715 | #define CS47L92_AIF3TX7MIX_INPUT_3_SOURCE 0x7B4 | ||
| 716 | #define CS47L92_AIF3TX7MIX_INPUT_3_VOLUME 0x7B5 | ||
| 717 | #define CS47L92_AIF3TX7MIX_INPUT_4_SOURCE 0x7B6 | ||
| 718 | #define CS47L92_AIF3TX7MIX_INPUT_4_VOLUME 0x7B7 | ||
| 719 | #define CS47L92_AIF3TX8MIX_INPUT_1_SOURCE 0x7B8 | ||
| 720 | #define CS47L92_AIF3TX8MIX_INPUT_1_VOLUME 0x7B9 | ||
| 721 | #define CS47L92_AIF3TX8MIX_INPUT_2_SOURCE 0x7BA | ||
| 722 | #define CS47L92_AIF3TX8MIX_INPUT_2_VOLUME 0x7BB | ||
| 723 | #define CS47L92_AIF3TX8MIX_INPUT_3_SOURCE 0x7BC | ||
| 724 | #define CS47L92_AIF3TX8MIX_INPUT_3_VOLUME 0x7BD | ||
| 725 | #define CS47L92_AIF3TX8MIX_INPUT_4_SOURCE 0x7BE | ||
| 726 | #define CS47L92_AIF3TX8MIX_INPUT_4_VOLUME 0x7BF | ||
| 663 | #define MADERA_AIF4TX1MIX_INPUT_1_SOURCE 0x7A0 | 727 | #define MADERA_AIF4TX1MIX_INPUT_1_SOURCE 0x7A0 |
| 664 | #define MADERA_AIF4TX1MIX_INPUT_1_VOLUME 0x7A1 | 728 | #define MADERA_AIF4TX1MIX_INPUT_1_VOLUME 0x7A1 |
| 665 | #define MADERA_AIF4TX1MIX_INPUT_2_SOURCE 0x7A2 | 729 | #define MADERA_AIF4TX1MIX_INPUT_2_SOURCE 0x7A2 |
| @@ -1103,68 +1167,8 @@ · 437 unmodified lines | |||
| 1103 | #define MADERA_FCR_ADC_REFORMATTER_CONTROL 0xF73 | 1167 | #define MADERA_FCR_ADC_REFORMATTER_CONTROL 0xF73 |
| 1104 | #define MADERA_FCR_COEFF_START 0xF74 | 1168 | #define MADERA_FCR_COEFF_START 0xF74 |
| 1105 | #define MADERA_FCR_COEFF_END 0xFC5 | 1169 | #define MADERA_FCR_COEFF_END 0xFC5 |
| 1106 | #define MADERA_DAC_COMP_1 0x1300 | 1170 | #define MADERA_AUXPDM1_CTRL_0 0x10C0 |
| 1107 | #define MADERA_DAC_COMP_2 0x1302 | 1171 | #define MADERA_AUXPDM1_CTRL_1 0x10C1 |
| 1108 | #define MADERA_FRF_COEFFICIENT_1L_1 0x1380 | ||
| 1109 | #define MADERA_FRF_COEFFICIENT_1L_2 0x1381 | ||
| 1110 | #define MADERA_FRF_COEFFICIENT_1L_3 0x1382 | ||
| 1111 | #define MADERA_FRF_COEFFICIENT_1L_4 0x1383 | ||
| 1112 | #define MADERA_FRF_COEFFICIENT_1R_1 0x1390 | ||
| 1113 | #define MADERA_FRF_COEFFICIENT_1R_2 0x1391 | ||
| 1114 | #define MADERA_FRF_COEFFICIENT_1R_3 0x1392 | ||
| 1115 | #define MADERA_FRF_COEFFICIENT_1R_4 0x1393 | ||
| 1116 | #define MADERA_FRF_COEFFICIENT_2L_1 0x13A0 | ||
| 1117 | #define MADERA_FRF_COEFFICIENT_2L_2 0x13A1 | ||
| 1118 | #define MADERA_FRF_COEFFICIENT_2L_3 0x13A2 | ||
| 1119 | #define MADERA_FRF_COEFFICIENT_2L_4 0x13A3 | ||
| 1120 | #define MADERA_FRF_COEFFICIENT_2R_1 0x13B0 | ||
| 1121 | #define MADERA_FRF_COEFFICIENT_2R_2 0x13B1 | ||
| 1122 | #define MADERA_FRF_COEFFICIENT_2R_3 0x13B2 | ||
| 1123 | #define MADERA_FRF_COEFFICIENT_2R_4 0x13B3 | ||
| 1124 | #define MADERA_FRF_COEFFICIENT_3L_1 0x13C0 | ||
| 1125 | #define MADERA_FRF_COEFFICIENT_3L_2 0x13C1 | ||
| 1126 | #define MADERA_FRF_COEFFICIENT_3L_3 0x13C2 | ||
| 1127 | #define MADERA_FRF_COEFFICIENT_3L_4 0x13C3 | ||
| 1128 | #define MADERA_FRF_COEFFICIENT_3R_1 0x13D0 | ||
| 1129 | #define MADERA_FRF_COEFFICIENT_3R_2 0x13D1 | ||
| 1130 | #define MADERA_FRF_COEFFICIENT_3R_3 0x13D2 | ||
| 1131 | #define MADERA_FRF_COEFFICIENT_3R_4 0x13D3 | ||
| 1132 | #define MADERA_FRF_COEFFICIENT_4L_1 0x13E0 | ||
| 1133 | #define MADERA_FRF_COEFFICIENT_4L_2 0x13E1 | ||
| 1134 | #define MADERA_FRF_COEFFICIENT_4L_3 0x13E2 | ||
| 1135 | #define MADERA_FRF_COEFFICIENT_4L_4 0x13E3 | ||
| 1136 | #define MADERA_FRF_COEFFICIENT_4R_1 0x13F0 | ||
| 1137 | #define MADERA_FRF_COEFFICIENT_4R_2 0x13F1 | ||
| 1138 | #define MADERA_FRF_COEFFICIENT_4R_3 0x13F2 | ||
| 1139 | #define MADERA_FRF_COEFFICIENT_4R_4 0x13F3 | ||
| 1140 | #define CS47L35_FRF_COEFFICIENT_4L_1 0x13A0 | ||
| 1141 | #define CS47L35_FRF_COEFFICIENT_4L_2 0x13A1 | ||
| 1142 | #define CS47L35_FRF_COEFFICIENT_4L_3 0x13A2 | ||
| 1143 | #define CS47L35_FRF_COEFFICIENT_4L_4 0x13A3 | ||
| 1144 | #define CS47L35_FRF_COEFFICIENT_5L_1 0x13B0 | ||
| 1145 | #define CS47L35_FRF_COEFFICIENT_5L_2 0x13B1 | ||
| 1146 | #define CS47L35_FRF_COEFFICIENT_5L_3 0x13B2 | ||
| 1147 | #define CS47L35_FRF_COEFFICIENT_5L_4 0x13B3 | ||
| 1148 | #define CS47L35_FRF_COEFFICIENT_5R_1 0x13C0 | ||
| 1149 | #define CS47L35_FRF_COEFFICIENT_5R_2 0x13C1 | ||
| 1150 | #define CS47L35_FRF_COEFFICIENT_5R_3 0x13C2 | ||
| 1151 | #define CS47L35_FRF_COEFFICIENT_5R_4 0x13C3 | ||
| 1152 | #define MADERA_FRF_COEFFICIENT_5L_1 0x1400 | ||
| 1153 | #define MADERA_FRF_COEFFICIENT_5L_2 0x1401 | ||
| 1154 | #define MADERA_FRF_COEFFICIENT_5L_3 0x1402 | ||
| 1155 | #define MADERA_FRF_COEFFICIENT_5L_4 0x1403 | ||
| 1156 | #define MADERA_FRF_COEFFICIENT_5R_1 0x1410 | ||
| 1157 | #define MADERA_FRF_COEFFICIENT_5R_2 0x1411 | ||
| 1158 | #define MADERA_FRF_COEFFICIENT_5R_3 0x1412 | ||
| 1159 | #define MADERA_FRF_COEFFICIENT_5R_4 0x1413 | ||
| 1160 | #define MADERA_FRF_COEFFICIENT_6L_1 0x1420 | ||
| 1161 | #define MADERA_FRF_COEFFICIENT_6L_2 0x1421 | ||
| 1162 | #define MADERA_FRF_COEFFICIENT_6L_3 0x1422 | ||
| 1163 | #define MADERA_FRF_COEFFICIENT_6L_4 0x1423 | ||
| 1164 | #define MADERA_FRF_COEFFICIENT_6R_1 0x1430 | ||
| 1165 | #define MADERA_FRF_COEFFICIENT_6R_2 0x1431 | ||
| 1166 | #define MADERA_FRF_COEFFICIENT_6R_3 0x1432 | ||
| 1167 | #define MADERA_FRF_COEFFICIENT_6R_4 0x1433 | ||
| 1168 | #define MADERA_DFC1_CTRL 0x1480 | 1172 | #define MADERA_DFC1_CTRL 0x1480 |
| 1169 | #define MADERA_DFC1_RX 0x1482 | 1173 | #define MADERA_DFC1_RX 0x1482 |
| 1170 | #define MADERA_DFC1_TX 0x1484 | 1174 | #define MADERA_DFC1_TX 0x1484 |
| @@ -1202,6 +1206,8 @@ · 31 unmodified lines | |||
| 1202 | #define MADERA_GPIO1_CTRL_2 0x1701 | 1206 | #define MADERA_GPIO1_CTRL_2 0x1701 |
| 1203 | #define MADERA_GPIO2_CTRL_1 0x1702 | 1207 | #define MADERA_GPIO2_CTRL_1 0x1702 |
| 1204 | #define MADERA_GPIO2_CTRL_2 0x1703 | 1208 | #define MADERA_GPIO2_CTRL_2 0x1703 |
| 1209 | #define MADERA_GPIO15_CTRL_1 0x171C | ||
| 1210 | #define MADERA_GPIO15_CTRL_2 0x171D | ||
| 1205 | #define MADERA_GPIO16_CTRL_1 0x171E | 1211 | #define MADERA_GPIO16_CTRL_1 0x171E |
| 1206 | #define MADERA_GPIO16_CTRL_2 0x171F | 1212 | #define MADERA_GPIO16_CTRL_2 0x171F |
| 1207 | #define MADERA_GPIO38_CTRL_1 0x174A | 1213 | #define MADERA_GPIO38_CTRL_1 0x174A |
| @@ -1232,6 +1238,7 @@ · 24 unmodified lines | |||
| 1232 | #define MADERA_IRQ2_CTRL 0x1A82 | 1238 | #define MADERA_IRQ2_CTRL 0x1A82 |
| 1233 | #define MADERA_INTERRUPT_RAW_STATUS_1 0x1AA0 | 1239 | #define MADERA_INTERRUPT_RAW_STATUS_1 0x1AA0 |
| 1234 | #define MADERA_WSEQ_SEQUENCE_1 0x3000 | 1240 | #define MADERA_WSEQ_SEQUENCE_1 0x3000 |
| 1241 | #define MADERA_WSEQ_SEQUENCE_225 0x31C0 | ||
| 1235 | #define MADERA_WSEQ_SEQUENCE_252 0x31F6 | 1242 | #define MADERA_WSEQ_SEQUENCE_252 0x31F6 |
| 1236 | #define CS47L35_OTP_HPDET_CAL_1 0x31F8 | 1243 | #define CS47L35_OTP_HPDET_CAL_1 0x31F8 |
| 1237 | #define CS47L35_OTP_HPDET_CAL_2 0x31FA | 1244 | #define CS47L35_OTP_HPDET_CAL_2 0x31FA |
| @@ -1441,6 +1448,12 @@ · 203 unmodified lines | |||
| 1441 | #define MADERA_OPCLK_ASYNC_SEL_WIDTH 3 | 1448 | #define MADERA_OPCLK_ASYNC_SEL_WIDTH 3 |
| 1442 | 1449 | ||
| 1443 | /* (0x0171) FLL1_Control_1 */ | 1450 | /* (0x0171) FLL1_Control_1 */ |
| 1451 | #define CS47L92_FLL1_REFCLK_SRC_MASK 0xF000 | ||
| 1452 | #define CS47L92_FLL1_REFCLK_SRC_SHIFT 12 | ||
| 1453 | #define CS47L92_FLL1_REFCLK_SRC_WIDTH 4 | ||
| 1454 | #define MADERA_FLL1_HOLD_MASK 0x0004 | ||
| 1455 | #define MADERA_FLL1_HOLD_SHIFT 2 | ||
| 1456 | #define MADERA_FLL1_HOLD_WIDTH 1 | ||
| 1444 | #define MADERA_FLL1_FREERUN 0x0002 | 1457 | #define MADERA_FLL1_FREERUN 0x0002 |
| 1445 | #define MADERA_FLL1_FREERUN_MASK 0x0002 | 1458 | #define MADERA_FLL1_FREERUN_MASK 0x0002 |
| 1446 | #define MADERA_FLL1_FREERUN_SHIFT 1 | 1459 | #define MADERA_FLL1_FREERUN_SHIFT 1 |
| @@ -1473,6 +1486,9 @@ · 26 unmodified lines | |||
| 1473 | #define MADERA_FLL1_FRATIO_MASK 0x0F00 | 1486 | #define MADERA_FLL1_FRATIO_MASK 0x0F00 |
| 1474 | #define MADERA_FLL1_FRATIO_SHIFT 8 | 1487 | #define MADERA_FLL1_FRATIO_SHIFT 8 |
| 1475 | #define MADERA_FLL1_FRATIO_WIDTH 4 | 1488 | #define MADERA_FLL1_FRATIO_WIDTH 4 |
| 1489 | #define MADERA_FLL1_FB_DIV_MASK 0x03FF | ||
| 1490 | #define MADERA_FLL1_FB_DIV_SHIFT 0 | ||
| 1491 | #define MADERA_FLL1_FB_DIV_WIDTH 10 | ||
| 1476 | 1492 | ||
| 1477 | /* (0x0176) FLL1_Control_6 */ | 1493 | /* (0x0176) FLL1_Control_6 */ |
| 1478 | #define MADERA_FLL1_REFCLK_DIV_MASK 0x00C0 | 1494 | #define MADERA_FLL1_REFCLK_DIV_MASK 0x00C0 |
| @@ -1482,15 +1498,6 @@ · 3 unmodified lines | |||
| 1482 | #define MADERA_FLL1_REFCLK_SRC_SHIFT 0 | 1498 | #define MADERA_FLL1_REFCLK_SRC_SHIFT 0 |
| 1483 | #define MADERA_FLL1_REFCLK_SRC_WIDTH 4 | 1499 | #define MADERA_FLL1_REFCLK_SRC_WIDTH 4 |
| 1484 | 1500 | ||
| 1485 | /* (0x0177) FLL1_Loop_Filter_Test_1 */ | ||
| 1486 | #define MADERA_FLL1_FRC_INTEG_UPD 0x8000 | ||
| 1487 | #define MADERA_FLL1_FRC_INTEG_UPD_MASK 0x8000 | ||
| 1488 | #define MADERA_FLL1_FRC_INTEG_UPD_SHIFT 15 | ||
| 1489 | #define MADERA_FLL1_FRC_INTEG_UPD_WIDTH 1 | ||
| 1490 | #define MADERA_FLL1_FRC_INTEG_VAL_MASK 0x0FFF | ||
| 1491 | #define MADERA_FLL1_FRC_INTEG_VAL_SHIFT 0 | ||
| 1492 | #define MADERA_FLL1_FRC_INTEG_VAL_WIDTH 12 | ||
| 1493 | |||
| 1494 | /* (0x0179) FLL1_Control_7 */ | 1501 | /* (0x0179) FLL1_Control_7 */ |
| 1495 | #define MADERA_FLL1_GAIN_MASK 0x003c | 1502 | #define MADERA_FLL1_GAIN_MASK 0x003c |
| 1496 | #define MADERA_FLL1_GAIN_SHIFT 2 | 1503 | #define MADERA_FLL1_GAIN_SHIFT 2 |
| @@ -1504,6 +1511,30 @@ · 7 unmodified lines | |||
| 1504 | #define MADERA_FLL1_PHASE_ENA_SHIFT 11 | 1511 | #define MADERA_FLL1_PHASE_ENA_SHIFT 11 |
| 1505 | #define MADERA_FLL1_PHASE_ENA_WIDTH 1 | 1512 | #define MADERA_FLL1_PHASE_ENA_WIDTH 1 |
| 1506 | 1513 | ||
| 1514 | /* (0x017A) FLL1_Control_10 */ | ||
| 1515 | #define MADERA_FLL1_HP_MASK 0xC000 | ||
| 1516 | #define MADERA_FLL1_HP_SHIFT 14 | ||
| 1517 | #define MADERA_FLL1_HP_WIDTH 2 | ||
| 1518 | #define MADERA_FLL1_PHASEDET_ENA_MASK 0x1000 | ||
| 1519 | #define MADERA_FLL1_PHASEDET_ENA_SHIFT 12 | ||
| 1520 | #define MADERA_FLL1_PHASEDET_ENA_WIDTH 1 | ||
| 1521 | |||
| 1522 | /* (0x017B) FLL1_Control_11 */ | ||
| 1523 | #define MADERA_FLL1_LOCKDET_THR_MASK 0x001E | ||
| 1524 | #define MADERA_FLL1_LOCKDET_THR_SHIFT 1 | ||
| 1525 | #define MADERA_FLL1_LOCKDET_THR_WIDTH 4 | ||
| 1526 | #define MADERA_FLL1_LOCKDET_MASK 0x0001 | ||
| 1527 | #define MADERA_FLL1_LOCKDET_SHIFT 0 | ||
| 1528 | #define MADERA_FLL1_LOCKDET_WIDTH 1 | ||
| 1529 | |||
| 1530 | /* (0x017D) FLL1_Digital_Test_1 */ | ||
| 1531 | #define MADERA_FLL1_SYNC_EFS_ENA_MASK 0x0100 | ||
| 1532 | #define MADERA_FLL1_SYNC_EFS_ENA_SHIFT 8 | ||
| 1533 | #define MADERA_FLL1_SYNC_EFS_ENA_WIDTH 1 | ||
| 1534 | #define MADERA_FLL1_CLK_VCO_FAST_SRC_MASK 0x0003 | ||
| 1535 | #define MADERA_FLL1_CLK_VCO_FAST_SRC_SHIFT 0 | ||
| 1536 | #define MADERA_FLL1_CLK_VCO_FAST_SRC_WIDTH 2 | ||
| 1537 | |||
| 1507 | /* (0x0181) FLL1_Synchroniser_1 */ | 1538 | /* (0x0181) FLL1_Synchroniser_1 */ |
| 1508 | #define MADERA_FLL1_SYNC_ENA 0x0001 | 1539 | #define MADERA_FLL1_SYNC_ENA 0x0001 |
| 1509 | #define MADERA_FLL1_SYNC_ENA_MASK 0x0001 | 1540 | #define MADERA_FLL1_SYNC_ENA_MASK 0x0001 |
| @@ -1625,6 +1656,13 @@ · 115 unmodified lines | |||
| 1625 | #define MADERA_LDO2_ENA_WIDTH 1 | 1656 | #define MADERA_LDO2_ENA_WIDTH 1 |
| 1626 | 1657 | ||
| 1627 | /* (0x0218) Mic_Bias_Ctrl_1 */ | 1658 | /* (0x0218) Mic_Bias_Ctrl_1 */ |
| 1659 | #define MADERA_MICB1_EXT_CAP 0x8000 | ||
| 1660 | #define MADERA_MICB1_EXT_CAP_MASK 0x8000 | ||
| 1661 | #define MADERA_MICB1_EXT_CAP_SHIFT 15 | ||
| 1662 | #define MADERA_MICB1_EXT_CAP_WIDTH 1 | ||
| 1663 | #define MADERA_MICB1_LVL_MASK 0x01E0 | ||
| 1664 | #define MADERA_MICB1_LVL_SHIFT 5 | ||
| 1665 | #define MADERA_MICB1_LVL_WIDTH 4 | ||
| 1628 | #define MADERA_MICB1_ENA 0x0001 | 1666 | #define MADERA_MICB1_ENA 0x0001 |
| 1629 | #define MADERA_MICB1_ENA_MASK 0x0001 | 1667 | #define MADERA_MICB1_ENA_MASK 0x0001 |
| 1630 | #define MADERA_MICB1_ENA_SHIFT 0 | 1668 | #define MADERA_MICB1_ENA_SHIFT 0 |
| @@ -2308,6 +2346,17 @@ · 677 unmodified lines | |||
| 2308 | #define MADERA_OUT1R_ENA_SHIFT 0 | 2346 | #define MADERA_OUT1R_ENA_SHIFT 0 |
| 2309 | #define MADERA_OUT1R_ENA_WIDTH 1 | 2347 | #define MADERA_OUT1R_ENA_WIDTH 1 |
| 2310 | 2348 | ||
| 2349 | /* (0x0408) Output_Rate_1 */ | ||
| 2350 | #define MADERA_CP_DAC_MODE_MASK 0x0040 | ||
| 2351 | #define MADERA_CP_DAC_MODE_SHIFT 6 | ||
| 2352 | #define MADERA_CP_DAC_MODE_WIDTH 1 | ||
| 2353 | #define MADERA_OUT_EXT_CLK_DIV_MASK 0x0030 | ||
| 2354 | #define MADERA_OUT_EXT_CLK_DIV_SHIFT 4 | ||
| 2355 | #define MADERA_OUT_EXT_CLK_DIV_WIDTH 2 | ||
| 2356 | #define MADERA_OUT_CLK_SRC_MASK 0x0007 | ||
| 2357 | #define MADERA_OUT_CLK_SRC_SHIFT 0 | ||
| 2358 | #define MADERA_OUT_CLK_SRC_WIDTH 3 | ||
| 2359 | |||
| 2311 | /* (0x0409) Output_Volume_Ramp */ | 2360 | /* (0x0409) Output_Volume_Ramp */ |
| 2312 | #define MADERA_OUT_VD_RAMP_MASK 0x0070 | 2361 | #define MADERA_OUT_VD_RAMP_MASK 0x0070 |
| 2313 | #define MADERA_OUT_VD_RAMP_SHIFT 4 | 2362 | #define MADERA_OUT_VD_RAMP_SHIFT 4 |
| @@ -2829,6 +2878,30 @@ · 515 unmodified lines | |||
| 2829 | #define MADERA_AIF2RX1_ENA_WIDTH 1 | 2878 | #define MADERA_AIF2RX1_ENA_WIDTH 1 |
| 2830 | 2879 | ||
| 2831 | /* (0x0599) AIF3_Tx_Enables */ | 2880 | /* (0x0599) AIF3_Tx_Enables */ |
| 2881 | #define MADERA_AIF3TX8_ENA 0x0080 | ||
| 2882 | #define MADERA_AIF3TX8_ENA_MASK 0x0080 | ||
| 2883 | #define MADERA_AIF3TX8_ENA_SHIFT 7 | ||
| 2884 | #define MADERA_AIF3TX8_ENA_WIDTH 1 | ||
| 2885 | #define MADERA_AIF3TX7_ENA 0x0040 | ||
| 2886 | #define MADERA_AIF3TX7_ENA_MASK 0x0040 | ||
| 2887 | #define MADERA_AIF3TX7_ENA_SHIFT 6 | ||
| 2888 | #define MADERA_AIF3TX7_ENA_WIDTH 1 | ||
| 2889 | #define MADERA_AIF3TX6_ENA 0x0020 | ||
| 2890 | #define MADERA_AIF3TX6_ENA_MASK 0x0020 | ||
| 2891 | #define MADERA_AIF3TX6_ENA_SHIFT 5 | ||
| 2892 | #define MADERA_AIF3TX6_ENA_WIDTH 1 | ||
| 2893 | #define MADERA_AIF3TX5_ENA 0x0010 | ||
| 2894 | #define MADERA_AIF3TX5_ENA_MASK 0x0010 | ||
| 2895 | #define MADERA_AIF3TX5_ENA_SHIFT 4 | ||
| 2896 | #define MADERA_AIF3TX5_ENA_WIDTH 1 | ||
| 2897 | #define MADERA_AIF3TX4_ENA 0x0008 | ||
| 2898 | #define MADERA_AIF3TX4_ENA_MASK 0x0008 | ||
| 2899 | #define MADERA_AIF3TX4_ENA_SHIFT 3 | ||
| 2900 | #define MADERA_AIF3TX4_ENA_WIDTH 1 | ||
| 2901 | #define MADERA_AIF3TX3_ENA 0x0004 | ||
| 2902 | #define MADERA_AIF3TX3_ENA_MASK 0x0004 | ||
| 2903 | #define MADERA_AIF3TX3_ENA_SHIFT 2 | ||
| 2904 | #define MADERA_AIF3TX3_ENA_WIDTH 1 | ||
| 2832 | #define MADERA_AIF3TX2_ENA 0x0002 | 2905 | #define MADERA_AIF3TX2_ENA 0x0002 |
| 2833 | #define MADERA_AIF3TX2_ENA_MASK 0x0002 | 2906 | #define MADERA_AIF3TX2_ENA_MASK 0x0002 |
| 2834 | #define MADERA_AIF3TX2_ENA_SHIFT 1 | 2907 | #define MADERA_AIF3TX2_ENA_SHIFT 1 |
| @@ -2839,6 +2912,30 @@ · 4 unmodified lines | |||
| 2839 | #define MADERA_AIF3TX1_ENA_WIDTH 1 | 2912 | #define MADERA_AIF3TX1_ENA_WIDTH 1 |
| 2840 | 2913 | ||
| 2841 | /* (0x059A) AIF3_Rx_Enables */ | 2914 | /* (0x059A) AIF3_Rx_Enables */ |
| 2915 | #define MADERA_AIF3RX8_ENA 0x0080 | ||
| 2916 | #define MADERA_AIF3RX8_ENA_MASK 0x0080 | ||
| 2917 | #define MADERA_AIF3RX8_ENA_SHIFT 7 | ||
| 2918 | #define MADERA_AIF3RX8_ENA_WIDTH 1 | ||
| 2919 | #define MADERA_AIF3RX7_ENA 0x0040 | ||
| 2920 | #define MADERA_AIF3RX7_ENA_MASK 0x0040 | ||
| 2921 | #define MADERA_AIF3RX7_ENA_SHIFT 6 | ||
| 2922 | #define MADERA_AIF3RX7_ENA_WIDTH 1 | ||
| 2923 | #define MADERA_AIF3RX6_ENA 0x0020 | ||
| 2924 | #define MADERA_AIF3RX6_ENA_MASK 0x0020 | ||
| 2925 | #define MADERA_AIF3RX6_ENA_SHIFT 5 | ||
| 2926 | #define MADERA_AIF3RX6_ENA_WIDTH 1 | ||
| 2927 | #define MADERA_AIF3RX5_ENA 0x0010 | ||
| 2928 | #define MADERA_AIF3RX5_ENA_MASK 0x0010 | ||
| 2929 | #define MADERA_AIF3RX5_ENA_SHIFT 4 | ||
| 2930 | #define MADERA_AIF3RX5_ENA_WIDTH 1 | ||
| 2931 | #define MADERA_AIF3RX4_ENA 0x0008 | ||
| 2932 | #define MADERA_AIF3RX4_ENA_MASK 0x0008 | ||
| 2933 | #define MADERA_AIF3RX4_ENA_SHIFT 3 | ||
| 2934 | #define MADERA_AIF3RX4_ENA_WIDTH 1 | ||
| 2935 | #define MADERA_AIF3RX3_ENA 0x0004 | ||
| 2936 | #define MADERA_AIF3RX3_ENA_MASK 0x0004 | ||
| 2937 | #define MADERA_AIF3RX3_ENA_SHIFT 2 | ||
| 2938 | #define MADERA_AIF3RX3_ENA_WIDTH 1 | ||
| 2842 | #define MADERA_AIF3RX2_ENA 0x0002 | 2939 | #define MADERA_AIF3RX2_ENA 0x0002 |
| 2843 | #define MADERA_AIF3RX2_ENA_MASK 0x0002 | 2940 | #define MADERA_AIF3RX2_ENA_MASK 0x0002 |
| 2844 | #define MADERA_AIF3RX2_ENA_SHIFT 1 | 2941 | #define MADERA_AIF3RX2_ENA_SHIFT 1 |
| @@ -3453,6 +3550,25 @@ · 608 unmodified lines | |||
| 3453 | #define MADERA_FCR_MIC_MODE_SEL_SHIFT 2 | 3550 | #define MADERA_FCR_MIC_MODE_SEL_SHIFT 2 |
| 3454 | #define MADERA_FCR_MIC_MODE_SEL_WIDTH 2 | 3551 | #define MADERA_FCR_MIC_MODE_SEL_WIDTH 2 |
| 3455 | 3552 | ||
| 3553 | /* (0x10C0) AUXPDM1_CTRL_0 */ | ||
| 3554 | #define MADERA_AUXPDM1_SRC_MASK 0x0F00 | ||
| 3555 | #define MADERA_AUXPDM1_SRC_SHIFT 8 | ||
| 3556 | #define MADERA_AUXPDM1_SRC_WIDTH 4 | ||
| 3557 | #define MADERA_AUXPDM1_TXEDGE_MASK 0x0010 | ||
| 3558 | #define MADERA_AUXPDM1_TXEDGE_SHIFT 4 | ||
| 3559 | #define MADERA_AUXPDM1_TXEDGE_WIDTH 1 | ||
| 3560 | #define MADERA_AUXPDM1_MSTR_MASK 0x0008 | ||
| 3561 | #define MADERA_AUXPDM1_MSTR_SHIFT 3 | ||
| 3562 | #define MADERA_AUXPDM1_MSTR_WIDTH 1 | ||
| 3563 | #define MADERA_AUXPDM1_ENABLE_MASK 0x0001 | ||
| 3564 | #define MADERA_AUXPDM1_ENABLE_SHIFT 0 | ||
| 3565 | #define MADERA_AUXPDM1_ENABLE_WIDTH 1 | ||
| 3566 | |||
| 3567 | /* (0x10C1) AUXPDM1_CTRL_1 */ | ||
| 3568 | #define MADERA_AUXPDM1_CLK_FREQ_MASK 0xC000 | ||
| 3569 | #define MADERA_AUXPDM1_CLK_FREQ_SHIFT 14 | ||
| 3570 | #define MADERA_AUXPDM1_CLK_FREQ_WIDTH 2 | ||
| 3571 | |||
| 3456 | /* (0x1480) DFC1_CTRL_W0 */ | 3572 | /* (0x1480) DFC1_CTRL_W0 */ |
| 3457 | #define MADERA_DFC1_RATE_MASK 0x007C | 3573 | #define MADERA_DFC1_RATE_MASK 0x007C |
| 3458 | #define MADERA_DFC1_RATE_SHIFT 2 | 3574 | #define MADERA_DFC1_RATE_SHIFT 2 |
| @@ -374,6 +374,7 @@ enum rk805_reg { · 373 unmodified lines | |||
| 374 | #define SWITCH1_EN BIT(5) | 374 | #define SWITCH1_EN BIT(5) |
| 375 | #define DEV_OFF_RST BIT(3) | 375 | #define DEV_OFF_RST BIT(3) |
| 376 | #define DEV_OFF BIT(0) | 376 | #define DEV_OFF BIT(0) |
| 377 | #define RTC_STOP BIT(0) | ||
| 377 | 378 | ||
| 378 | #define VB_LO_ACT BIT(4) | 379 | #define VB_LO_ACT BIT(4) |
| 379 | #define VB_LO_SEL_3500MV (7 << 0) | 380 | #define VB_LO_SEL_3500MV (7 << 0) |
| @@ -387,7 +388,179 @@ enum rk805_reg { · 7 unmodified lines | |||
| 387 | #define SHUTDOWN_FUN (0x2 << 2) | 388 | #define SHUTDOWN_FUN (0x2 << 2) |
| 388 | #define SLEEP_FUN (0x1 << 2) | 389 | #define SLEEP_FUN (0x1 << 2) |
| 389 | #define RK8XX_ID_MSK 0xfff0 | 390 | #define RK8XX_ID_MSK 0xfff0 |
| 391 | #define PWM_MODE_MSK BIT(7) | ||
| 390 | #define FPWM_MODE BIT(7) | 392 | #define FPWM_MODE BIT(7) |
| 393 | #define AUTO_PWM_MODE 0 | ||
| 394 | |||
| 395 | enum rk817_reg_id { | ||
| 396 | RK817_ID_DCDC1 = 0, | ||
| 397 | RK817_ID_DCDC2, | ||
| 398 | RK817_ID_DCDC3, | ||
| 399 | RK817_ID_DCDC4, | ||
| 400 | RK817_ID_LDO1, | ||
| 401 | RK817_ID_LDO2, | ||
| 402 | RK817_ID_LDO3, | ||
| 403 | RK817_ID_LDO4, | ||
| 404 | RK817_ID_LDO5, | ||
| 405 | RK817_ID_LDO6, | ||
| 406 | RK817_ID_LDO7, | ||
| 407 | RK817_ID_LDO8, | ||
| 408 | RK817_ID_LDO9, | ||
| 409 | RK817_ID_BOOST, | ||
| 410 | RK817_ID_BOOST_OTG_SW, | ||
| 411 | RK817_NUM_REGULATORS | ||
| 412 | }; | ||
| 413 | |||
| 414 | enum rk809_reg_id { | ||
| 415 | RK809_ID_DCDC5 = RK817_ID_BOOST, | ||
| 416 | RK809_ID_SW1, | ||
| 417 | RK809_ID_SW2, | ||
| 418 | RK809_NUM_REGULATORS | ||
| 419 | }; | ||
| 420 | |||
| 421 | #define RK817_SECONDS_REG 0x00 | ||
| 422 | #define RK817_MINUTES_REG 0x01 | ||
| 423 | #define RK817_HOURS_REG 0x02 | ||
| 424 | #define RK817_DAYS_REG 0x03 | ||
| 425 | #define RK817_MONTHS_REG 0x04 | ||
| 426 | #define RK817_YEARS_REG 0x05 | ||
| 427 | #define RK817_WEEKS_REG 0x06 | ||
| 428 | #define RK817_ALARM_SECONDS_REG 0x07 | ||
| 429 | #define RK817_ALARM_MINUTES_REG 0x08 | ||
| 430 | #define RK817_ALARM_HOURS_REG 0x09 | ||
| 431 | #define RK817_ALARM_DAYS_REG 0x0a | ||
| 432 | #define RK817_ALARM_MONTHS_REG 0x0b | ||
| 433 | #define RK817_ALARM_YEARS_REG 0x0c | ||
| 434 | #define RK817_RTC_CTRL_REG 0xd | ||
| 435 | #define RK817_RTC_STATUS_REG 0xe | ||
| 436 | #define RK817_RTC_INT_REG 0xf | ||
| 437 | #define RK817_RTC_COMP_LSB_REG 0x10 | ||
| 438 | #define RK817_RTC_COMP_MSB_REG 0x11 | ||
| 439 | |||
| 440 | #define RK817_POWER_EN_REG(i) (0xb1 + (i)) | ||
| 441 | #define RK817_POWER_SLP_EN_REG(i) (0xb5 + (i)) | ||
| 442 | |||
| 443 | #define RK817_POWER_CONFIG (0xb9) | ||
| 444 | |||
| 445 | #define RK817_BUCK_CONFIG_REG(i) (0xba + (i) * 3) | ||
| 446 | |||
| 447 | #define RK817_BUCK1_ON_VSEL_REG 0xBB | ||
| 448 | #define RK817_BUCK1_SLP_VSEL_REG 0xBC | ||
| 449 | |||
| 450 | #define RK817_BUCK2_CONFIG_REG 0xBD | ||
| 451 | #define RK817_BUCK2_ON_VSEL_REG 0xBE | ||
| 452 | #define RK817_BUCK2_SLP_VSEL_REG 0xBF | ||
| 453 | |||
| 454 | #define RK817_BUCK3_CONFIG_REG 0xC0 | ||
| 455 | #define RK817_BUCK3_ON_VSEL_REG 0xC1 | ||
| 456 | #define RK817_BUCK3_SLP_VSEL_REG 0xC2 | ||
| 457 | |||
| 458 | #define RK817_BUCK4_CONFIG_REG 0xC3 | ||
| 459 | #define RK817_BUCK4_ON_VSEL_REG 0xC4 | ||
| 460 | #define RK817_BUCK4_SLP_VSEL_REG 0xC5 | ||
| 461 | |||
| 462 | #define RK817_LDO_ON_VSEL_REG(idx) (0xcc + (idx) * 2) | ||
| 463 | #define RK817_BOOST_OTG_CFG (0xde) | ||
| 464 | |||
| 465 | #define RK817_ID_MSB 0xed | ||
| 466 | #define RK817_ID_LSB 0xee | ||
| 467 | |||
| 468 | #define RK817_SYS_STS 0xf0 | ||
| 469 | #define RK817_SYS_CFG(i) (0xf1 + (i)) | ||
| 470 | |||
| 471 | #define RK817_ON_SOURCE_REG 0xf5 | ||
| 472 | #define RK817_OFF_SOURCE_REG 0xf6 | ||
| 473 | |||
| 474 | /* INTERRUPT REGISTER */ | ||
| 475 | #define RK817_INT_STS_REG0 0xf8 | ||
| 476 | #define RK817_INT_STS_MSK_REG0 0xf9 | ||
| 477 | #define RK817_INT_STS_REG1 0xfa | ||
| 478 | #define RK817_INT_STS_MSK_REG1 0xfb | ||
| 479 | #define RK817_INT_STS_REG2 0xfc | ||
| 480 | #define RK817_INT_STS_MSK_REG2 0xfd | ||
| 481 | #define RK817_GPIO_INT_CFG 0xfe | ||
| 482 | |||
| 483 | /* IRQ Definitions */ | ||
| 484 | #define RK817_IRQ_PWRON_FALL 0 | ||
| 485 | #define RK817_IRQ_PWRON_RISE 1 | ||
| 486 | #define RK817_IRQ_PWRON 2 | ||
| 487 | #define RK817_IRQ_PWMON_LP 3 | ||
| 488 | #define RK817_IRQ_HOTDIE 4 | ||
| 489 | #define RK817_IRQ_RTC_ALARM 5 | ||
| 490 | #define RK817_IRQ_RTC_PERIOD 6 | ||
| 491 | #define RK817_IRQ_VB_LO 7 | ||
| 492 | #define RK817_IRQ_PLUG_IN 8 | ||
| 493 | #define RK817_IRQ_PLUG_OUT 9 | ||
| 494 | #define RK817_IRQ_CHRG_TERM 10 | ||
| 495 | #define RK817_IRQ_CHRG_TIME 11 | ||
| 496 | #define RK817_IRQ_CHRG_TS 12 | ||
| 497 | #define RK817_IRQ_USB_OV 13 | ||
| 498 | #define RK817_IRQ_CHRG_IN_CLMP 14 | ||
| 499 | #define RK817_IRQ_BAT_DIS_ILIM 15 | ||
| 500 | #define RK817_IRQ_GATE_GPIO 16 | ||
| 501 | #define RK817_IRQ_TS_GPIO 17 | ||
| 502 | #define RK817_IRQ_CODEC_PD 18 | ||
| 503 | #define RK817_IRQ_CODEC_PO 19 | ||
| 504 | #define RK817_IRQ_CLASSD_MUTE_DONE 20 | ||
| 505 | #define RK817_IRQ_CLASSD_OCP 21 | ||
| 506 | #define RK817_IRQ_BAT_OVP 22 | ||
| 507 | #define RK817_IRQ_CHRG_BAT_HI 23 | ||
| 508 | #define RK817_IRQ_END (RK817_IRQ_CHRG_BAT_HI + 1) | ||
| 509 | |||
| 510 | /* | ||
| 511 | * rtc_ctrl 0xd | ||
| 512 | * same as 808, except bit4 | ||
| 513 | */ | ||
| 514 | #define RK817_RTC_CTRL_RSV4 BIT(4) | ||
| 515 | |||
| 516 | /* power config 0xb9 */ | ||
| 517 | #define RK817_BUCK3_FB_RES_MSK BIT(6) | ||
| 518 | #define RK817_BUCK3_FB_RES_INTER BIT(6) | ||
| 519 | #define RK817_BUCK3_FB_RES_EXT 0 | ||
| 520 | |||
| 521 | /* buck config 0xba */ | ||
| 522 | #define RK817_RAMP_RATE_OFFSET 6 | ||
| 523 | #define RK817_RAMP_RATE_MASK (0x3 << RK817_RAMP_RATE_OFFSET) | ||
| 524 | #define RK817_RAMP_RATE_3MV_PER_US (0x0 << RK817_RAMP_RATE_OFFSET) | ||
| 525 | #define RK817_RAMP_RATE_6_3MV_PER_US (0x1 << RK817_RAMP_RATE_OFFSET) | ||
| 526 | #define RK817_RAMP_RATE_12_5MV_PER_US (0x2 << RK817_RAMP_RATE_OFFSET) | ||
| 527 | #define RK817_RAMP_RATE_25MV_PER_US (0x3 << RK817_RAMP_RATE_OFFSET) | ||
| 528 | |||
| 529 | /* sys_cfg1 0xf2 */ | ||
| 530 | #define RK817_HOTDIE_TEMP_MSK (0x3 << 4) | ||
| 531 | #define RK817_HOTDIE_85 (0x0 << 4) | ||
| 532 | #define RK817_HOTDIE_95 (0x1 << 4) | ||
| 533 | #define RK817_HOTDIE_105 (0x2 << 4) | ||
| 534 | #define RK817_HOTDIE_115 (0x3 << 4) | ||
| 535 | |||
| 536 | #define RK817_TSD_TEMP_MSK BIT(6) | ||
| 537 | #define RK817_TSD_140 0 | ||
| 538 | #define RK817_TSD_160 BIT(6) | ||
| 539 | |||
| 540 | #define RK817_CLK32KOUT2_EN BIT(7) | ||
| 541 | |||
| 542 | /* sys_cfg3 0xf4 */ | ||
| 543 | #define RK817_SLPPIN_FUNC_MSK (0x3 << 3) | ||
| 544 | #define SLPPIN_NULL_FUN (0x0 << 3) | ||
| 545 | #define SLPPIN_SLP_FUN (0x1 << 3) | ||
| 546 | #define SLPPIN_DN_FUN (0x2 << 3) | ||
| 547 | #define SLPPIN_RST_FUN (0x3 << 3) | ||
| 548 | |||
| 549 | #define RK817_RST_FUNC_MSK (0x3 << 6) | ||
| 550 | #define RK817_RST_FUNC_SFT (6) | ||
| 551 | #define RK817_RST_FUNC_CNT (3) | ||
| 552 | #define RK817_RST_FUNC_DEV (0) /* reset the dev */ | ||
| 553 | #define RK817_RST_FUNC_REG (0x1 << 6) /* reset the reg only */ | ||
| 554 | |||
| 555 | #define RK817_SLPPOL_MSK BIT(5) | ||
| 556 | #define RK817_SLPPOL_H BIT(5) | ||
| 557 | #define RK817_SLPPOL_L (0) | ||
| 558 | |||
| 559 | /* gpio&int 0xfe */ | ||
| 560 | #define RK817_INT_POL_MSK BIT(1) | ||
| 561 | #define RK817_INT_POL_H BIT(1) | ||
| 562 | #define RK817_INT_POL_L 0 | ||
| 563 | #define RK809_BUCK5_CONFIG(i) (RK817_BOOST_OTG_CFG + (i) * 1) | ||
| 391 | 564 | ||
| 392 | enum { | 565 | enum { |
| 393 | BUCK_ILMIN_50MA, | 566 | BUCK_ILMIN_50MA, |
| @@ -435,6 +608,8 @@ enum { · 41 unmodified lines | |||
| 435 | enum { | 608 | enum { |
| 436 | RK805_ID = 0x8050, | 609 | RK805_ID = 0x8050, |
| 437 | RK808_ID = 0x0000, | 610 | RK808_ID = 0x0000, |
| 611 | RK809_ID = 0x8090, | ||
| 612 | RK817_ID = 0x8170, | ||
| 438 | RK818_ID = 0x8181, | 613 | RK818_ID = 0x8181, |
| 439 | }; | 614 | }; |
| 440 | 615 | ||
| @@ -445,5 +620,7 @@ struct rk808 { · 4 unmodified lines | |||
| 445 | long variant; | 620 | long variant; |
| 446 | const struct regmap_config *regmap_cfg; | 621 | const struct regmap_config *regmap_cfg; |
| 447 | const struct regmap_irq_chip *regmap_irq_chip; | 622 | const struct regmap_irq_chip *regmap_irq_chip; |
| 623 | void (*pm_pwroff_fn)(void); | ||
| 624 | void (*pm_pwroff_prep_fn)(void); | ||
| 448 | }; | 625 | }; |
| 449 | #endif /* __LINUX_REGULATOR_RK808_H */ | 626 | #endif /* __LINUX_REGULATOR_RK808_H */ |
| @@ -0,0 +1,408 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ | ||
| 2 | /* Copyright (C) 2018 ROHM Semiconductors */ | ||
| 3 | |||
| 4 | #ifndef __LINUX_MFD_BD70528_H__ | ||
| 5 | #define __LINUX_MFD_BD70528_H__ | ||
| 6 | |||
| 7 | #include <linux/bits.h> | ||
| 8 | #include <linux/device.h> | ||
| 9 | #include <linux/mfd/rohm-generic.h> | ||
| 10 | #include <linux/regmap.h> | ||
| 11 | |||
| 12 | enum { | ||
| 13 | BD70528_BUCK1, | ||
| 14 | BD70528_BUCK2, | ||
| 15 | BD70528_BUCK3, | ||
| 16 | BD70528_LDO1, | ||
| 17 | BD70528_LDO2, | ||
| 18 | BD70528_LDO3, | ||
| 19 | BD70528_LED1, | ||
| 20 | BD70528_LED2, | ||
| 21 | }; | ||
| 22 | |||
| 23 | struct bd70528_data { | ||
| 24 | struct rohm_regmap_dev chip; | ||
| 25 | struct mutex rtc_timer_lock; | ||
| 26 | }; | ||
| 27 | |||
| 28 | #define BD70528_BUCK_VOLTS 17 | ||
| 29 | #define BD70528_BUCK_VOLTS 17 | ||
| 30 | #define BD70528_BUCK_VOLTS 17 | ||
| 31 | #define BD70528_LDO_VOLTS 0x20 | ||
| 32 | |||
| 33 | #define BD70528_REG_BUCK1_EN 0x0F | ||
| 34 | #define BD70528_REG_BUCK1_VOLT 0x15 | ||
| 35 | #define BD70528_REG_BUCK2_EN 0x10 | ||
| 36 | #define BD70528_REG_BUCK2_VOLT 0x16 | ||
| 37 | #define BD70528_REG_BUCK3_EN 0x11 | ||
| 38 | #define BD70528_REG_BUCK3_VOLT 0x17 | ||
| 39 | #define BD70528_REG_LDO1_EN 0x1b | ||
| 40 | #define BD70528_REG_LDO1_VOLT 0x1e | ||
| 41 | #define BD70528_REG_LDO2_EN 0x1c | ||
| 42 | #define BD70528_REG_LDO2_VOLT 0x1f | ||
| 43 | #define BD70528_REG_LDO3_EN 0x1d | ||
| 44 | #define BD70528_REG_LDO3_VOLT 0x20 | ||
| 45 | #define BD70528_REG_LED_CTRL 0x2b | ||
| 46 | #define BD70528_REG_LED_VOLT 0x29 | ||
| 47 | #define BD70528_REG_LED_EN 0x2a | ||
| 48 | |||
| 49 | /* main irq registers */ | ||
| 50 | #define BD70528_REG_INT_MAIN 0x7E | ||
| 51 | #define BD70528_REG_INT_MAIN_MASK 0x74 | ||
| 52 | |||
| 53 | /* 'sub irq' registers */ | ||
| 54 | #define BD70528_REG_INT_SHDN 0x7F | ||
| 55 | #define BD70528_REG_INT_PWR_FLT 0x80 | ||
| 56 | #define BD70528_REG_INT_VR_FLT 0x81 | ||
| 57 | #define BD70528_REG_INT_MISC 0x82 | ||
| 58 | #define BD70528_REG_INT_BAT1 0x83 | ||
| 59 | #define BD70528_REG_INT_BAT2 0x84 | ||
| 60 | #define BD70528_REG_INT_RTC 0x85 | ||
| 61 | #define BD70528_REG_INT_GPIO 0x86 | ||
| 62 | #define BD70528_REG_INT_OP_FAIL 0x87 | ||
| 63 | |||
| 64 | #define BD70528_REG_INT_SHDN_MASK 0x75 | ||
| 65 | #define BD70528_REG_INT_PWR_FLT_MASK 0x76 | ||
| 66 | #define BD70528_REG_INT_VR_FLT_MASK 0x77 | ||
| 67 | #define BD70528_REG_INT_MISC_MASK 0x78 | ||
| 68 | #define BD70528_REG_INT_BAT1_MASK 0x79 | ||
| 69 | #define BD70528_REG_INT_BAT2_MASK 0x7a | ||
| 70 | #define BD70528_REG_INT_RTC_MASK 0x7b | ||
| 71 | #define BD70528_REG_INT_GPIO_MASK 0x7c | ||
| 72 | #define BD70528_REG_INT_OP_FAIL_MASK 0x7d | ||
| 73 | |||
| 74 | /* Reset related 'magic' registers */ | ||
| 75 | #define BD70528_REG_SHIPMODE 0x03 | ||
| 76 | #define BD70528_REG_HWRESET 0x04 | ||
| 77 | #define BD70528_REG_WARMRESET 0x05 | ||
| 78 | #define BD70528_REG_STANDBY 0x06 | ||
| 79 | |||
| 80 | /* GPIO registers */ | ||
| 81 | #define BD70528_REG_GPIO_STATE 0x8F | ||
| 82 | |||
| 83 | #define BD70528_REG_GPIO1_IN 0x4d | ||
| 84 | #define BD70528_REG_GPIO2_IN 0x4f | ||
| 85 | #define BD70528_REG_GPIO3_IN 0x51 | ||
| 86 | #define BD70528_REG_GPIO4_IN 0x53 | ||
| 87 | #define BD70528_REG_GPIO1_OUT 0x4e | ||
| 88 | #define BD70528_REG_GPIO2_OUT 0x50 | ||
| 89 | #define BD70528_REG_GPIO3_OUT 0x52 | ||
| 90 | #define BD70528_REG_GPIO4_OUT 0x54 | ||
| 91 | |||
| 92 | /* clk control */ | ||
| 93 | |||
| 94 | #define BD70528_REG_CLK_OUT 0x2c | ||
| 95 | |||
| 96 | /* RTC */ | ||
| 97 | |||
| 98 | #define BD70528_REG_RTC_COUNT_H 0x2d | ||
| 99 | #define BD70528_REG_RTC_COUNT_L 0x2e | ||
| 100 | #define BD70528_REG_RTC_SEC 0x2f | ||
| 101 | #define BD70528_REG_RTC_MINUTE 0x30 | ||
| 102 | #define BD70528_REG_RTC_HOUR 0x31 | ||
| 103 | #define BD70528_REG_RTC_WEEK 0x32 | ||
| 104 | #define BD70528_REG_RTC_DAY 0x33 | ||
| 105 | #define BD70528_REG_RTC_MONTH 0x34 | ||
| 106 | #define BD70528_REG_RTC_YEAR 0x35 | ||
| 107 | |||
| 108 | #define BD70528_REG_RTC_ALM_SEC 0x36 | ||
| 109 | #define BD70528_REG_RTC_ALM_START BD70528_REG_RTC_ALM_SEC | ||
| 110 | #define BD70528_REG_RTC_ALM_MINUTE 0x37 | ||
| 111 | #define BD70528_REG_RTC_ALM_HOUR 0x38 | ||
| 112 | #define BD70528_REG_RTC_ALM_WEEK 0x39 | ||
| 113 | #define BD70528_REG_RTC_ALM_DAY 0x3a | ||
| 114 | #define BD70528_REG_RTC_ALM_MONTH 0x3b | ||
| 115 | #define BD70528_REG_RTC_ALM_YEAR 0x3c | ||
| 116 | #define BD70528_REG_RTC_ALM_MASK 0x3d | ||
| 117 | #define BD70528_REG_RTC_ALM_REPEAT 0x3e | ||
| 118 | #define BD70528_REG_RTC_START BD70528_REG_RTC_SEC | ||
| 119 | |||
| 120 | #define BD70528_REG_RTC_WAKE_SEC 0x43 | ||
| 121 | #define BD70528_REG_RTC_WAKE_START BD70528_REG_RTC_WAKE_SEC | ||
| 122 | #define BD70528_REG_RTC_WAKE_MIN 0x44 | ||
| 123 | #define BD70528_REG_RTC_WAKE_HOUR 0x45 | ||
| 124 | #define BD70528_REG_RTC_WAKE_CTRL 0x46 | ||
| 125 | |||
| 126 | #define BD70528_REG_ELAPSED_TIMER_EN 0x42 | ||
| 127 | #define BD70528_REG_WAKE_EN 0x46 | ||
| 128 | |||
| 129 | /* WDT registers */ | ||
| 130 | #define BD70528_REG_WDT_CTRL 0x4A | ||
| 131 | #define BD70528_REG_WDT_HOUR 0x49 | ||
| 132 | #define BD70528_REG_WDT_MINUTE 0x48 | ||
| 133 | #define BD70528_REG_WDT_SEC 0x47 | ||
| 134 | |||
| 135 | /* Charger / Battery */ | ||
| 136 | #define BD70528_REG_CHG_CURR_STAT 0x59 | ||
| 137 | #define BD70528_REG_CHG_BAT_STAT 0x57 | ||
| 138 | #define BD70528_REG_CHG_BAT_TEMP 0x58 | ||
| 139 | #define BD70528_REG_CHG_IN_STAT 0x56 | ||
| 140 | #define BD70528_REG_CHG_DCIN_ILIM 0x5d | ||
| 141 | #define BD70528_REG_CHG_CHG_CURR_WARM 0x61 | ||
| 142 | #define BD70528_REG_CHG_CHG_CURR_COLD 0x62 | ||
| 143 | |||
| 144 | /* Masks for main IRQ register bits */ | ||
| 145 | enum { | ||
| 146 | BD70528_INT_SHDN, | ||
| 147 | #define BD70528_INT_SHDN_MASK BIT(BD70528_INT_SHDN) | ||
| 148 | BD70528_INT_PWR_FLT, | ||
| 149 | #define BD70528_INT_PWR_FLT_MASK BIT(BD70528_INT_PWR_FLT) | ||
| 150 | BD70528_INT_VR_FLT, | ||
| 151 | #define BD70528_INT_VR_FLT_MASK BIT(BD70528_INT_VR_FLT) | ||
| 152 | BD70528_INT_MISC, | ||
| 153 | #define BD70528_INT_MISC_MASK BIT(BD70528_INT_MISC) | ||
| 154 | BD70528_INT_BAT1, | ||
| 155 | #define BD70528_INT_BAT1_MASK BIT(BD70528_INT_BAT1) | ||
| 156 | BD70528_INT_RTC, | ||
| 157 | #define BD70528_INT_RTC_MASK BIT(BD70528_INT_RTC) | ||
| 158 | BD70528_INT_GPIO, | ||
| 159 | #define BD70528_INT_GPIO_MASK BIT(BD70528_INT_GPIO) | ||
| 160 | BD70528_INT_OP_FAIL, | ||
| 161 | #define BD70528_INT_OP_FAIL_MASK BIT(BD70528_INT_OP_FAIL) | ||
| 162 | }; | ||
| 163 | |||
| 164 | /* IRQs */ | ||
| 165 | enum { | ||
| 166 | /* Shutdown register IRQs */ | ||
| 167 | BD70528_INT_LONGPUSH, | ||
| 168 | BD70528_INT_WDT, | ||
| 169 | BD70528_INT_HWRESET, | ||
| 170 | BD70528_INT_RSTB_FAULT, | ||
| 171 | BD70528_INT_VBAT_UVLO, | ||
| 172 | BD70528_INT_TSD, | ||
| 173 | BD70528_INT_RSTIN, | ||
| 174 | /* Power failure register IRQs */ | ||
| 175 | BD70528_INT_BUCK1_FAULT, | ||
| 176 | BD70528_INT_BUCK2_FAULT, | ||
| 177 | BD70528_INT_BUCK3_FAULT, | ||
| 178 | BD70528_INT_LDO1_FAULT, | ||
| 179 | BD70528_INT_LDO2_FAULT, | ||
| 180 | BD70528_INT_LDO3_FAULT, | ||
| 181 | BD70528_INT_LED1_FAULT, | ||
| 182 | BD70528_INT_LED2_FAULT, | ||
| 183 | /* VR FAULT register IRQs */ | ||
| 184 | BD70528_INT_BUCK1_OCP, | ||
| 185 | BD70528_INT_BUCK2_OCP, | ||
| 186 | BD70528_INT_BUCK3_OCP, | ||
| 187 | BD70528_INT_LED1_OCP, | ||
| 188 | BD70528_INT_LED2_OCP, | ||
| 189 | BD70528_INT_BUCK1_FULLON, | ||
| 190 | BD70528_INT_BUCK2_FULLON, | ||
| 191 | /* PMU register interrupts */ | ||
| 192 | BD70528_INT_SHORTPUSH, | ||
| 193 | BD70528_INT_AUTO_WAKEUP, | ||
| 194 | BD70528_INT_STATE_CHANGE, | ||
| 195 | /* Charger 1 register IRQs */ | ||
| 196 | BD70528_INT_BAT_OV_RES, | ||
| 197 | BD70528_INT_BAT_OV_DET, | ||
| 198 | BD70528_INT_DBAT_DET, | ||
| 199 | BD70528_INT_BATTSD_COLD_RES, | ||
| 200 | BD70528_INT_BATTSD_COLD_DET, | ||
| 201 | BD70528_INT_BATTSD_HOT_RES, | ||
| 202 | BD70528_INT_BATTSD_HOT_DET, | ||
| 203 | BD70528_INT_CHG_TSD, | ||
| 204 | /* Charger 2 register IRQs */ | ||
| 205 | BD70528_INT_BAT_RMV, | ||
| 206 | BD70528_INT_BAT_DET, | ||
| 207 | BD70528_INT_DCIN2_OV_RES, | ||
| 208 | BD70528_INT_DCIN2_OV_DET, | ||
| 209 | BD70528_INT_DCIN2_RMV, | ||
| 210 | BD70528_INT_DCIN2_DET, | ||
| 211 | BD70528_INT_DCIN1_RMV, | ||
| 212 | BD70528_INT_DCIN1_DET, | ||
| 213 | /* RTC register IRQs */ | ||
| 214 | BD70528_INT_RTC_ALARM, | ||
| 215 | BD70528_INT_ELPS_TIM, | ||
| 216 | /* GPIO register IRQs */ | ||
| 217 | BD70528_INT_GPIO0, | ||
| 218 | BD70528_INT_GPIO1, | ||
| 219 | BD70528_INT_GPIO2, | ||
| 220 | BD70528_INT_GPIO3, | ||
| 221 | /* Invalid operation register IRQs */ | ||
| 222 | BD70528_INT_BUCK1_DVS_OPFAIL, | ||
| 223 | BD70528_INT_BUCK2_DVS_OPFAIL, | ||
| 224 | BD70528_INT_BUCK3_DVS_OPFAIL, | ||
| 225 | BD70528_INT_LED1_VOLT_OPFAIL, | ||
| 226 | BD70528_INT_LED2_VOLT_OPFAIL, | ||
| 227 | }; | ||
| 228 | |||
| 229 | /* Masks */ | ||
| 230 | #define BD70528_INT_LONGPUSH_MASK 0x1 | ||
| 231 | #define BD70528_INT_WDT_MASK 0x2 | ||
| 232 | #define BD70528_INT_HWRESET_MASK 0x4 | ||
| 233 | #define BD70528_INT_RSTB_FAULT_MASK 0x8 | ||
| 234 | #define BD70528_INT_VBAT_UVLO_MASK 0x10 | ||
| 235 | #define BD70528_INT_TSD_MASK 0x20 | ||
| 236 | #define BD70528_INT_RSTIN_MASK 0x40 | ||
| 237 | |||
| 238 | #define BD70528_INT_BUCK1_FAULT_MASK 0x1 | ||
| 239 | #define BD70528_INT_BUCK2_FAULT_MASK 0x2 | ||
| 240 | #define BD70528_INT_BUCK3_FAULT_MASK 0x4 | ||
| 241 | #define BD70528_INT_LDO1_FAULT_MASK 0x8 | ||
| 242 | #define BD70528_INT_LDO2_FAULT_MASK 0x10 | ||
| 243 | #define BD70528_INT_LDO3_FAULT_MASK 0x20 | ||
| 244 | #define BD70528_INT_LED1_FAULT_MASK 0x40 | ||
| 245 | #define BD70528_INT_LED2_FAULT_MASK 0x80 | ||
| 246 | |||
| 247 | #define BD70528_INT_BUCK1_OCP_MASK 0x1 | ||
| 248 | #define BD70528_INT_BUCK2_OCP_MASK 0x2 | ||
| 249 | #define BD70528_INT_BUCK3_OCP_MASK 0x4 | ||
| 250 | #define BD70528_INT_LED1_OCP_MASK 0x8 | ||
| 251 | #define BD70528_INT_LED2_OCP_MASK 0x10 | ||
| 252 | #define BD70528_INT_BUCK1_FULLON_MASK 0x20 | ||
| 253 | #define BD70528_INT_BUCK2_FULLON_MASK 0x40 | ||
| 254 | |||
| 255 | #define BD70528_INT_SHORTPUSH_MASK 0x1 | ||
| 256 | #define BD70528_INT_AUTO_WAKEUP_MASK 0x2 | ||
| 257 | #define BD70528_INT_STATE_CHANGE_MASK 0x10 | ||
| 258 | |||
| 259 | #define BD70528_INT_BAT_OV_RES_MASK 0x1 | ||
| 260 | #define BD70528_INT_BAT_OV_DET_MASK 0x2 | ||
| 261 | #define BD70528_INT_DBAT_DET_MASK 0x4 | ||
| 262 | #define BD70528_INT_BATTSD_COLD_RES_MASK 0x8 | ||
| 263 | #define BD70528_INT_BATTSD_COLD_DET_MASK 0x10 | ||
| 264 | #define BD70528_INT_BATTSD_HOT_RES_MASK 0x20 | ||
| 265 | #define BD70528_INT_BATTSD_HOT_DET_MASK 0x40 | ||
| 266 | #define BD70528_INT_CHG_TSD_MASK 0x80 | ||
| 267 | |||
| 268 | #define BD70528_INT_BAT_RMV_MASK 0x1 | ||
| 269 | #define BD70528_INT_BAT_DET_MASK 0x2 | ||
| 270 | #define BD70528_INT_DCIN2_OV_RES_MASK 0x4 | ||
| 271 | #define BD70528_INT_DCIN2_OV_DET_MASK 0x8 | ||
| 272 | #define BD70528_INT_DCIN2_RMV_MASK 0x10 | ||
| 273 | #define BD70528_INT_DCIN2_DET_MASK 0x20 | ||
| 274 | #define BD70528_INT_DCIN1_RMV_MASK 0x40 | ||
| 275 | #define BD70528_INT_DCIN1_DET_MASK 0x80 | ||
| 276 | |||
| 277 | #define BD70528_INT_RTC_ALARM_MASK 0x1 | ||
| 278 | #define BD70528_INT_ELPS_TIM_MASK 0x2 | ||
| 279 | |||
| 280 | #define BD70528_INT_GPIO0_MASK 0x1 | ||
| 281 | #define BD70528_INT_GPIO1_MASK 0x2 | ||
| 282 | #define BD70528_INT_GPIO2_MASK 0x4 | ||
| 283 | #define BD70528_INT_GPIO3_MASK 0x8 | ||
| 284 | |||
| 285 | #define BD70528_INT_BUCK1_DVS_OPFAIL_MASK 0x1 | ||
| 286 | #define BD70528_INT_BUCK2_DVS_OPFAIL_MASK 0x2 | ||
| 287 | #define BD70528_INT_BUCK3_DVS_OPFAIL_MASK 0x4 | ||
| 288 | #define BD70528_INT_LED1_VOLT_OPFAIL_MASK 0x10 | ||
| 289 | #define BD70528_INT_LED2_VOLT_OPFAIL_MASK 0x20 | ||
| 290 | |||
| 291 | #define BD70528_DEBOUNCE_MASK 0x3 | ||
| 292 | |||
| 293 | #define BD70528_DEBOUNCE_DISABLE 0 | ||
| 294 | #define BD70528_DEBOUNCE_15MS 1 | ||
| 295 | #define BD70528_DEBOUNCE_30MS 2 | ||
| 296 | #define BD70528_DEBOUNCE_50MS 3 | ||
| 297 | |||
| 298 | #define BD70528_GPIO_DRIVE_MASK 0x2 | ||
| 299 | #define BD70528_GPIO_PUSH_PULL 0x0 | ||
| 300 | #define BD70528_GPIO_OPEN_DRAIN 0x2 | ||
| 301 | |||
| 302 | #define BD70528_GPIO_OUT_EN_MASK 0x80 | ||
| 303 | #define BD70528_GPIO_OUT_ENABLE 0x80 | ||
| 304 | #define BD70528_GPIO_OUT_DISABLE 0x0 | ||
| 305 | |||
| 306 | #define BD70528_GPIO_OUT_HI 0x1 | ||
| 307 | #define BD70528_GPIO_OUT_LO 0x0 | ||
| 308 | #define BD70528_GPIO_OUT_MASK 0x1 | ||
| 309 | |||
| 310 | #define BD70528_GPIO_IN_STATE_BASE 1 | ||
| 311 | |||
| 312 | #define BD70528_CLK_OUT_EN_MASK 0x1 | ||
| 313 | |||
| 314 | /* RTC masks to mask out reserved bits */ | ||
| 315 | |||
| 316 | #define BD70528_MASK_RTC_SEC 0x7f | ||
| 317 | #define BD70528_MASK_RTC_MINUTE 0x7f | ||
| 318 | #define BD70528_MASK_RTC_HOUR_24H 0x80 | ||
| 319 | #define BD70528_MASK_RTC_HOUR_PM 0x20 | ||
| 320 | #define BD70528_MASK_RTC_HOUR 0x1f | ||
| 321 | #define BD70528_MASK_RTC_DAY 0x3f | ||
| 322 | #define BD70528_MASK_RTC_WEEK 0x07 | ||
| 323 | #define BD70528_MASK_RTC_MONTH 0x1f | ||
| 324 | #define BD70528_MASK_RTC_YEAR 0xff | ||
| 325 | #define BD70528_MASK_RTC_COUNT_L 0x7f | ||
| 326 | |||
| 327 | #define BD70528_MASK_ELAPSED_TIMER_EN 0x1 | ||
| 328 | /* Mask second, min and hour fields | ||
| 329 | * HW would support ALM irq for over 24h | ||
| 330 | * (by setting day, month and year too) | ||
| 331 | * but as we wish to keep this same as for | ||
| 332 | * wake-up we limit ALM to 24H and only | ||
| 333 | * unmask sec, min and hour | ||
| 334 | */ | ||
| 335 | #define BD70528_MASK_ALM_EN 0x7 | ||
| 336 | #define BD70528_MASK_WAKE_EN 0x1 | ||
| 337 | |||
| 338 | /* WDT masks */ | ||
| 339 | #define BD70528_MASK_WDT_EN 0x1 | ||
| 340 | #define BD70528_MASK_WDT_HOUR 0x1 | ||
| 341 | #define BD70528_MASK_WDT_MINUTE 0x7f | ||
| 342 | #define BD70528_MASK_WDT_SEC 0x7f | ||
| 343 | |||
| 344 | #define BD70528_WDT_STATE_BIT 0x1 | ||
| 345 | #define BD70528_ELAPSED_STATE_BIT 0x2 | ||
| 346 | #define BD70528_WAKE_STATE_BIT 0x4 | ||
| 347 | |||
| 348 | /* Charger masks */ | ||
| 349 | #define BD70528_MASK_CHG_STAT 0x7f | ||
| 350 | #define BD70528_MASK_CHG_BAT_TIMER 0x20 | ||
| 351 | #define BD70528_MASK_CHG_BAT_OVERVOLT 0x10 | ||
| 352 | #define BD70528_MASK_CHG_BAT_DETECT 0x1 | ||
| 353 | #define BD70528_MASK_CHG_DCIN1_UVLO 0x1 | ||
| 354 | #define BD70528_MASK_CHG_DCIN_ILIM 0x3f | ||
| 355 | #define BD70528_MASK_CHG_CHG_CURR 0x1f | ||
| 356 | #define BD70528_MASK_CHG_TRICKLE_CURR 0x10 | ||
| 357 | |||
| 358 | /* | ||
| 359 | * Note, external battery register is the lonely rider at | ||
| 360 | * address 0xc5. See how to stuff that in the regmap | ||
| 361 | */ | ||
| 362 | #define BD70528_MAX_REGISTER 0x94 | ||
| 363 | |||
| 364 | /* Buck control masks */ | ||
| 365 | #define BD70528_MASK_RUN_EN 0x4 | ||
| 366 | #define BD70528_MASK_STBY_EN 0x2 | ||
| 367 | #define BD70528_MASK_IDLE_EN 0x1 | ||
| 368 | #define BD70528_MASK_LED1_EN 0x1 | ||
| 369 | #define BD70528_MASK_LED2_EN 0x10 | ||
| 370 | |||
| 371 | #define BD70528_MASK_BUCK_VOLT 0xf | ||
| 372 | #define BD70528_MASK_LDO_VOLT 0x1f | ||
| 373 | #define BD70528_MASK_LED1_VOLT 0x1 | ||
| 374 | #define BD70528_MASK_LED2_VOLT 0x10 | ||
| 375 | |||
| 376 | /* Misc irq masks */ | ||
| 377 | #define BD70528_INT_MASK_SHORT_PUSH 1 | ||
| 378 | #define BD70528_INT_MASK_AUTO_WAKE 2 | ||
| 379 | #define BD70528_INT_MASK_POWER_STATE 4 | ||
| 380 | |||
| 381 | #define BD70528_MASK_BUCK_RAMP 0x10 | ||
| 382 | #define BD70528_SIFT_BUCK_RAMP 4 | ||
| 383 | |||
| 384 | #if IS_ENABLED(CONFIG_BD70528_WATCHDOG) | ||
| 385 | |||
| 386 | int bd70528_wdt_set(struct rohm_regmap_dev *data, int enable, int *old_state); | ||
| 387 | void bd70528_wdt_lock(struct rohm_regmap_dev *data); | ||
| 388 | void bd70528_wdt_unlock(struct rohm_regmap_dev *data); | ||
| 389 | |||
| 390 | #else /* CONFIG_BD70528_WATCHDOG */ | ||
| 391 | |||
| 392 | static inline int bd70528_wdt_set(struct rohm_regmap_dev *data, int enable, | ||
| 393 | int *old_state) | ||
| 394 | { | ||
| 395 | return 0; | ||
| 396 | } | ||
| 397 | |||
| 398 | static inline void bd70528_wdt_lock(struct rohm_regmap_dev *data) | ||
| 399 | { | ||
| 400 | } | ||
| 401 | |||
| 402 | static inline void bd70528_wdt_unlock(struct rohm_regmap_dev *data) | ||
| 403 | { | ||
| 404 | } | ||
| 405 | |||
| 406 | #endif /* CONFIG_BD70528_WATCHDOG */ | ||
| 407 | |||
| 408 | #endif /* __LINUX_MFD_BD70528_H__ */ | ||
| @@ -4,14 +4,9 @@ · 3 unmodified lines | |||
| 4 | #ifndef __LINUX_MFD_BD718XX_H__ | 4 | #ifndef __LINUX_MFD_BD718XX_H__ |
| 5 | #define __LINUX_MFD_BD718XX_H__ | 5 | #define __LINUX_MFD_BD718XX_H__ |
| 6 | 6 | ||
| 7 | #include <linux/mfd/rohm-generic.h> | ||
| 7 | #include <linux/regmap.h> | 8 | #include <linux/regmap.h> |
| 8 | 9 | ||
| 9 | enum { | ||
| 10 | BD718XX_TYPE_BD71837 = 0, | ||
| 11 | BD718XX_TYPE_BD71847, | ||
| 12 | BD718XX_TYPE_AMOUNT | ||
| 13 | }; | ||
| 14 | |||
| 15 | enum { | 10 | enum { |
| 16 | BD718XX_BUCK1 = 0, | 11 | BD718XX_BUCK1 = 0, |
| 17 | BD718XX_BUCK2, | 12 | BD718XX_BUCK2, |
| @@ -321,18 +316,17 @@ enum { · 303 unmodified lines | |||
| 321 | BD718XX_PWRBTN_LONG_PRESS_15S | 316 | BD718XX_PWRBTN_LONG_PRESS_15S |
| 322 | }; | 317 | }; |
| 323 | 318 | ||
| 324 | struct bd718xx_clk; | ||
| 325 | |||
| 326 | struct bd718xx { | 319 | struct bd718xx { |
| 327 | unsigned int chip_type; | 320 | /* |
| 328 | struct device *dev; | 321 | * Please keep this as the first member here as some |
| 329 | struct regmap *regmap; | 322 | * drivers (clk) supporting more than one chip may only know this |
| 330 | unsigned long int id; | 323 | * generic struct 'struct rohm_regmap_dev' and assume it is |
| 324 | * the first chunk of parent device's private data. | ||
| 325 | */ | ||
| 326 | struct rohm_regmap_dev chip; | ||
| 331 | 327 | ||
| 332 | int chip_irq; | 328 | int chip_irq; |
| 333 | struct regmap_irq_chip_data *irq_data; | 329 | struct regmap_irq_chip_data *irq_data; |
| 334 | |||
| 335 | struct bd718xx_clk *clk; | ||
| 336 | }; | 330 | }; |
| 337 | 331 | ||
| 338 | #endif /* __LINUX_MFD_BD718XX_H__ */ | 332 | #endif /* __LINUX_MFD_BD718XX_H__ */ |
| @@ -0,0 +1,20 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ | ||
| 2 | /* Copyright (C) 2018 ROHM Semiconductors */ | ||
| 3 | |||
| 4 | #ifndef __LINUX_MFD_ROHM_H__ | ||
| 5 | #define __LINUX_MFD_ROHM_H__ | ||
| 6 | |||
| 7 | enum { | ||
| 8 | ROHM_CHIP_TYPE_BD71837 = 0, | ||
| 9 | ROHM_CHIP_TYPE_BD71847, | ||
| 10 | ROHM_CHIP_TYPE_BD70528, | ||
| 11 | ROHM_CHIP_TYPE_AMOUNT | ||
| 12 | }; | ||
| 13 | |||
| 14 | struct rohm_regmap_dev { | ||
| 15 | unsigned int chip_type; | ||
| 16 | struct device *dev; | ||
| 17 | struct regmap *regmap; | ||
| 18 | }; | ||
| 19 | |||
| 20 | #endif | ||
| @@ -20,6 +20,7 @@ · 19 unmodified lines | |||
| 20 | #define MIN_850_MV 850000 | 20 | #define MIN_850_MV 850000 |
| 21 | #define MIN_800_MV 800000 | 21 | #define MIN_800_MV 800000 |
| 22 | #define MIN_750_MV 750000 | 22 | #define MIN_750_MV 750000 |
| 23 | #define MIN_650_MV 650000 | ||
| 23 | #define MIN_600_MV 600000 | 24 | #define MIN_600_MV 600000 |
| 24 | #define MIN_500_MV 500000 | 25 | #define MIN_500_MV 500000 |
| 25 | 26 | ||
| @@ -170,7 +170,9 @@ enum s2mps11_regulators { · 169 unmodified lines | |||
| 170 | #define S2MPS11_ENABLE_MASK (0x03 << S2MPS11_ENABLE_SHIFT) | 170 | #define S2MPS11_ENABLE_MASK (0x03 << S2MPS11_ENABLE_SHIFT) |
| 171 | #define S2MPS11_ENABLE_SHIFT 0x06 | 171 | #define S2MPS11_ENABLE_SHIFT 0x06 |
| 172 | #define S2MPS11_LDO_N_VOLTAGES (S2MPS11_LDO_VSEL_MASK + 1) | 172 | #define S2MPS11_LDO_N_VOLTAGES (S2MPS11_LDO_VSEL_MASK + 1) |
| 173 | #define S2MPS11_BUCK_N_VOLTAGES (S2MPS11_BUCK_VSEL_MASK + 1) | 173 | #define S2MPS11_BUCK12346_N_VOLTAGES 153 |
| 174 | #define S2MPS11_BUCK5_N_VOLTAGES 216 | ||
| 175 | #define S2MPS11_BUCK7810_N_VOLTAGES 225 | ||
| 174 | #define S2MPS11_BUCK9_N_VOLTAGES (S2MPS11_BUCK9_VSEL_MASK + 1) | 176 | #define S2MPS11_BUCK9_N_VOLTAGES (S2MPS11_BUCK9_VSEL_MASK + 1) |
| 175 | #define S2MPS11_RAMP_DELAY 25000 /* uV/us */ | 177 | #define S2MPS11_RAMP_DELAY 25000 /* uV/us */ |
| 176 | 178 | ||
| @@ -188,4 +190,9 @@ enum s2mps11_regulators { · 11 unmodified lines | |||
| 188 | #define S2MPS11_BUCK6_RAMP_EN_SHIFT 0 | 190 | #define S2MPS11_BUCK6_RAMP_EN_SHIFT 0 |
| 189 | #define S2MPS11_PMIC_EN_SHIFT 6 | 191 | #define S2MPS11_PMIC_EN_SHIFT 6 |
| 190 | 192 | ||
| 193 | /* | ||
| 194 | * Bits for "enable suspend" (On/Off controlled by PWREN) | ||
| 195 | * are the same as in S2MPS14: S2MPS14_ENABLE_SUSPEND | ||
| 196 | */ | ||
| 197 | |||
| 191 | #endif /* __LINUX_MFD_S2MPS11_H */ | 198 | #endif /* __LINUX_MFD_S2MPS11_H */ |
| @@ -5,7 +5,7 @@ · 4 unmodified lines | |||
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | #ifndef MFD_STMFX_H | 7 | #ifndef MFD_STMFX_H |
| 8 | #define MFX_STMFX_H | 8 | #define MFD_STMFX_H |
| 9 | 9 | ||
| 10 | #include <linux/regmap.h> | 10 | #include <linux/regmap.h> |
| 11 | 11 | ||
| @@ -19,7 +19,6 @@ struct device_node; · 18 unmodified lines | |||
| 19 | #ifdef CONFIG_MFD_SYSCON | 19 | #ifdef CONFIG_MFD_SYSCON |
| 20 | extern struct regmap *syscon_node_to_regmap(struct device_node *np); | 20 | extern struct regmap *syscon_node_to_regmap(struct device_node *np); |
| 21 | extern struct regmap *syscon_regmap_lookup_by_compatible(const char *s); | 21 | extern struct regmap *syscon_regmap_lookup_by_compatible(const char *s); |
| 22 | extern struct regmap *syscon_regmap_lookup_by_pdevname(const char *s); | ||
| 23 | extern struct regmap *syscon_regmap_lookup_by_phandle( | 22 | extern struct regmap *syscon_regmap_lookup_by_phandle( |
| 24 | struct device_node *np, | 23 | struct device_node *np, |
| 25 | const char *property); | 24 | const char *property); |
| @@ -34,11 +33,6 @@ static inline struct regmap *syscon_regmap_lookup_by_compatible(const char *s) · 8 unmodified lines | |||
| 34 | return ERR_PTR(-ENOTSUPP); | 33 | return ERR_PTR(-ENOTSUPP); |
| 35 | } | 34 | } |
| 36 | 35 | ||
| 37 | static inline struct regmap *syscon_regmap_lookup_by_pdevname(const char *s) | ||
| 38 | { | ||
| 39 | return ERR_PTR(-ENOTSUPP); | ||
| 40 | } | ||
| 41 | |||
| 42 | static inline struct regmap *syscon_regmap_lookup_by_phandle( | 36 | static inline struct regmap *syscon_regmap_lookup_by_phandle( |
| 43 | struct device_node *np, | 37 | struct device_node *np, |
| 44 | const char *property) | 38 | const char *property) |
| @@ -187,47 +187,26 @@ · 186 unmodified lines | |||
| 187 | 187 | ||
| 188 | #define LM3695_MAX_REG 0x14 | 188 | #define LM3695_MAX_REG 0x14 |
| 189 | 189 | ||
| 190 | /* LM3697 */ | 190 | /* LM36274 */ |
| 191 | #define LM3697_REG_HVLED_OUTPUT_CFG 0x10 | 191 | #define LM36274_REG_REV 0x01 |
| 192 | #define LM3697_HVLED1_CFG_MASK BIT(0) | 192 | #define LM36274_REG_BL_CFG_1 0x02 |
| 193 | #define LM3697_HVLED2_CFG_MASK BIT(1) | 193 | #define LM36274_REG_BL_CFG_2 0x03 |
| 194 | #define LM3697_HVLED3_CFG_MASK BIT(2) | 194 | #define LM36274_REG_BRT_LSB 0x04 |
| 195 | #define LM3697_HVLED1_CFG_SHIFT 0 | 195 | #define LM36274_REG_BRT_MSB 0x05 |
| 196 | #define LM3697_HVLED2_CFG_SHIFT 1 | 196 | #define LM36274_REG_BL_EN 0x08 |
| 197 | #define LM3697_HVLED3_CFG_SHIFT 2 | 197 | |
| 198 | #define LM36274_REG_BIAS_CONFIG_1 0x09 | ||
| 199 | #define LM36274_EXT_EN_MASK BIT(0) | ||
| 200 | #define LM36274_EN_VNEG_MASK BIT(1) | ||
| 201 | #define LM36274_EN_VPOS_MASK BIT(2) | ||
| 202 | |||
| 203 | #define LM36274_REG_BIAS_CONFIG_2 0x0a | ||
| 204 | #define LM36274_REG_BIAS_CONFIG_3 0x0b | ||
| 205 | #define LM36274_REG_VOUT_BOOST 0x0c | ||
| 206 | #define LM36274_REG_VOUT_POS 0x0d | ||
| 207 | #define LM36274_REG_VOUT_NEG 0x0e | ||
| 208 | #define LM36274_VOUT_MASK 0x3F | ||
| 209 | |||
| 210 | #define LM36274_MAX_REG 0x13 | ||
| 198 | 211 | ||
| 199 | #define LM3697_REG_BL0_RAMP 0x11 | ||
| 200 | #define LM3697_REG_BL1_RAMP 0x12 | ||
| 201 | #define LM3697_RAMPUP_MASK 0xF0 | ||
| 202 | #define LM3697_RAMPUP_SHIFT 4 | ||
| 203 | #define LM3697_RAMPDN_MASK 0x0F | ||
| 204 | #define LM3697_RAMPDN_SHIFT 0 | ||
| 205 | |||
| 206 | #define LM3697_REG_RAMP_CONF 0x14 | ||
| 207 | #define LM3697_RAMP_MASK 0x0F | ||
| 208 | #define LM3697_RAMP_EACH 0x05 | ||
| 209 | |||
| 210 | #define LM3697_REG_PWM_CFG 0x1C | ||
| 211 | #define LM3697_PWM_A_MASK BIT(0) | ||
| 212 | #define LM3697_PWM_B_MASK BIT(1) | ||
| 213 | |||
| 214 | #define LM3697_REG_IMAX_A 0x17 | ||
| 215 | #define LM3697_REG_IMAX_B 0x18 | ||
| 216 | |||
| 217 | #define LM3697_REG_FEEDBACK_ENABLE 0x19 | ||
| 218 | |||
| 219 | #define LM3697_REG_BRT_A_LSB 0x20 | ||
| 220 | #define LM3697_REG_BRT_A_MSB 0x21 | ||
| 221 | #define LM3697_REG_BRT_B_LSB 0x22 | ||
| 222 | #define LM3697_REG_BRT_B_MSB 0x23 | ||
| 223 | |||
| 224 | #define LM3697_REG_ENABLE 0x24 | ||
| 225 | |||
| 226 | #define LM3697_REG_OPEN_FAULT_STATUS 0xB0 | ||
| 227 | |||
| 228 | #define LM3697_REG_SHORT_FAULT_STATUS 0xB2 | ||
| 229 | |||
| 230 | #define LM3697_REG_MONITOR_ENABLE 0xB4 | ||
| 231 | |||
| 232 | #define LM3697_MAX_REG 0xB4 | ||
| 233 | #endif | 212 | #endif |
| @@ -23,7 +23,7 @@ enum ti_lmu_id { · 22 unmodified lines | |||
| 23 | LM3632, | 23 | LM3632, |
| 24 | LM3633, | 24 | LM3633, |
| 25 | LM3695, | 25 | LM3695, |
| 26 | LM3697, | 26 | LM36274, |
| 27 | LMU_MAX_ID, | 27 | LMU_MAX_ID, |
| 28 | }; | 28 | }; |
| 29 | 29 | ||
| @@ -65,6 +65,9 @@ enum lm363x_regulator_id { · 35 unmodified lines | |||
| 65 | LM3632_BOOST, /* Boost output */ | 65 | LM3632_BOOST, /* Boost output */ |
| 66 | LM3632_LDO_POS, /* Positive display bias output */ | 66 | LM3632_LDO_POS, /* Positive display bias output */ |
| 67 | LM3632_LDO_NEG, /* Negative display bias output */ | 67 | LM3632_LDO_NEG, /* Negative display bias output */ |
| 68 | LM36274_BOOST, /* Boost output */ | ||
| 69 | LM36274_LDO_POS, /* Positive display bias output */ | ||
| 70 | LM36274_LDO_NEG, /* Negative display bias output */ | ||
| 68 | }; | 71 | }; |
| 69 | 72 | ||
| 70 | /** | 73 | /** |
| @@ -47,7 +47,6 @@ struct wm831x_battery_pdata { · 46 unmodified lines | |||
| 47 | * I2C or SPI buses. | 47 | * I2C or SPI buses. |
| 48 | */ | 48 | */ |
| 49 | struct wm831x_buckv_pdata { | 49 | struct wm831x_buckv_pdata { |
| 50 | int dvs_gpio; /** CPU GPIO to use for DVS switching */ | ||
| 51 | int dvs_control_src; /** Hardware DVS source to use (1 or 2) */ | 50 | int dvs_control_src; /** Hardware DVS source to use (1 or 2) */ |
| 52 | int dvs_init_state; /** DVS state to expect on startup */ | 51 | int dvs_init_state; /** DVS state to expect on startup */ |
| 53 | int dvs_state_gpio; /** CPU GPIO to use for monitoring status */ | 52 | int dvs_state_gpio; /** CPU GPIO to use for monitoring status */ |
| @@ -77,8 +77,7 @@ extern void migrate_page_copy(struct page *newpage, struct page *page); · 76 unmodified lines | |||
| 77 | extern int migrate_huge_page_move_mapping(struct address_space *mapping, | 77 | extern int migrate_huge_page_move_mapping(struct address_space *mapping, |
| 78 | struct page *newpage, struct page *page); | 78 | struct page *newpage, struct page *page); |
| 79 | extern int migrate_page_move_mapping(struct address_space *mapping, | 79 | extern int migrate_page_move_mapping(struct address_space *mapping, |
| 80 | struct page *newpage, struct page *page, enum migrate_mode mode, | 80 | struct page *newpage, struct page *page, int extra_count); |
| 81 | int extra_count); | ||
| 82 | #else | 81 | #else |
| 83 | 82 | ||
| 84 | static inline void putback_movable_pages(struct list_head *l) {} | 83 | static inline void putback_movable_pages(struct list_head *l) {} |
| @@ -114,7 +114,7 @@ enum mlx5_accel_ipsec_cap { · 113 unmodified lines | |||
| 114 | MLX5_ACCEL_IPSEC_CAP_TX_IV_IS_ESN = 1 << 7, | 114 | MLX5_ACCEL_IPSEC_CAP_TX_IV_IS_ESN = 1 << 7, |
| 115 | }; | 115 | }; |
| 116 | 116 | ||
| 117 | #ifdef CONFIG_MLX5_ACCEL | 117 | #ifdef CONFIG_MLX5_FPGA_IPSEC |
| 118 | 118 | ||
| 119 | u32 mlx5_accel_ipsec_device_caps(struct mlx5_core_dev *mdev); | 119 | u32 mlx5_accel_ipsec_device_caps(struct mlx5_core_dev *mdev); |
| 120 | 120 | ||
| @@ -47,7 +47,7 @@ struct mlx5_core_cq { · 46 unmodified lines | |||
| 47 | struct completion free; | 47 | struct completion free; |
| 48 | unsigned vector; | 48 | unsigned vector; |
| 49 | unsigned int irqn; | 49 | unsigned int irqn; |
| 50 | void (*comp) (struct mlx5_core_cq *); | 50 | void (*comp)(struct mlx5_core_cq *cq, struct mlx5_eqe *eqe); |
| 51 | void (*event) (struct mlx5_core_cq *, enum mlx5_event); | 51 | void (*event) (struct mlx5_core_cq *, enum mlx5_event); |
| 52 | u32 cons_index; | 52 | u32 cons_index; |
| 53 | unsigned arm_sn; | 53 | unsigned arm_sn; |
| @@ -55,7 +55,7 @@ struct mlx5_core_cq { · 1 unmodified line | |||
| 55 | int pid; | 55 | int pid; |
| 56 | struct { | 56 | struct { |
| 57 | struct list_head list; | 57 | struct list_head list; |
| 58 | void (*comp)(struct mlx5_core_cq *); | 58 | void (*comp)(struct mlx5_core_cq *cq, struct mlx5_eqe *eqe); |
| 59 | void *priv; | 59 | void *priv; |
| 60 | } tasklet_ctx; | 60 | } tasklet_ctx; |
| 61 | int reset_notify_added; | 61 | int reset_notify_added; |
| @@ -185,7 +185,7 @@ static inline void mlx5_cq_put(struct mlx5_core_cq *cq) · 123 unmodified lines | |||
| 185 | } | 185 | } |
| 186 | 186 | ||
| 187 | int mlx5_core_create_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq, | 187 | int mlx5_core_create_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq, |
| 188 | u32 *in, int inlen); | 188 | u32 *in, int inlen, u32 *out, int outlen); |
| 189 | int mlx5_core_destroy_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq); | 189 | int mlx5_core_destroy_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq); |
| 190 | int mlx5_core_query_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq, | 190 | int mlx5_core_query_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq, |
| 191 | u32 *out, int outlen); | 191 | u32 *out, int outlen); |
| @@ -342,7 +342,7 @@ enum mlx5_event { · 341 unmodified lines | |||
| 342 | MLX5_EVENT_TYPE_PAGE_FAULT = 0xc, | 342 | MLX5_EVENT_TYPE_PAGE_FAULT = 0xc, |
| 343 | MLX5_EVENT_TYPE_NIC_VPORT_CHANGE = 0xd, | 343 | MLX5_EVENT_TYPE_NIC_VPORT_CHANGE = 0xd, |
| 344 | 344 | ||
| 345 | MLX5_EVENT_TYPE_HOST_PARAMS_CHANGE = 0xe, | 345 | MLX5_EVENT_TYPE_ESW_FUNCTIONS_CHANGED = 0xe, |
| 346 | 346 | ||
| 347 | MLX5_EVENT_TYPE_DCT_DRAINED = 0x1c, | 347 | MLX5_EVENT_TYPE_DCT_DRAINED = 0x1c, |
| 348 | 348 | ||
| @@ -351,7 +351,7 @@ enum mlx5_event { · 2 unmodified lines | |||
| 351 | 351 | ||
| 352 | MLX5_EVENT_TYPE_DEVICE_TRACER = 0x26, | 352 | MLX5_EVENT_TYPE_DEVICE_TRACER = 0x26, |
| 353 | 353 | ||
| 354 | MLX5_EVENT_TYPE_MAX = MLX5_EVENT_TYPE_DEVICE_TRACER + 1, | 354 | MLX5_EVENT_TYPE_MAX = 0x100, |
| 355 | }; | 355 | }; |
| 356 | 356 | ||
| 357 | enum { | 357 | enum { |
| @@ -437,6 +437,7 @@ enum { · 79 unmodified lines | |||
| 437 | MLX5_OPCODE_SET_PSV = 0x20, | 437 | MLX5_OPCODE_SET_PSV = 0x20, |
| 438 | MLX5_OPCODE_GET_PSV = 0x21, | 438 | MLX5_OPCODE_GET_PSV = 0x21, |
| 439 | MLX5_OPCODE_CHECK_PSV = 0x22, | 439 | MLX5_OPCODE_CHECK_PSV = 0x22, |
| 440 | MLX5_OPCODE_DUMP = 0x23, | ||
| 440 | MLX5_OPCODE_RGET_PSV = 0x26, | 441 | MLX5_OPCODE_RGET_PSV = 0x26, |
| 441 | MLX5_OPCODE_RCHECK_PSV = 0x27, | 442 | MLX5_OPCODE_RCHECK_PSV = 0x27, |
| 442 | 443 | ||
| @@ -444,6 +445,14 @@ enum { · 1 unmodified line | |||
| 444 | 445 | ||
| 445 | }; | 446 | }; |
| 446 | 447 | ||
| 448 | enum { | ||
| 449 | MLX5_OPC_MOD_TLS_TIS_STATIC_PARAMS = 0x20, | ||
| 450 | }; | ||
| 451 | |||
| 452 | enum { | ||
| 453 | MLX5_OPC_MOD_TLS_TIS_PROGRESS_PARAMS = 0x20, | ||
| 454 | }; | ||
| 455 | |||
| 447 | enum { | 456 | enum { |
| 448 | MLX5_SET_PORT_RESET_QKEY = 0, | 457 | MLX5_SET_PORT_RESET_QKEY = 0, |
| 449 | MLX5_SET_PORT_GUID0 = 16, | 458 | MLX5_SET_PORT_GUID0 = 16, |
| @@ -510,6 +519,10 @@ struct mlx5_cmd_layout { · 60 unmodified lines | |||
| 510 | u8 status_own; | 519 | u8 status_own; |
| 511 | }; | 520 | }; |
| 512 | 521 | ||
| 522 | enum mlx5_fatal_assert_bit_offsets { | ||
| 523 | MLX5_RFR_OFFSET = 31, | ||
| 524 | }; | ||
| 525 | |||
| 513 | struct health_buffer { | 526 | struct health_buffer { |
| 514 | __be32 assert_var[5]; | 527 | __be32 assert_var[5]; |
| 515 | __be32 rsvd0[3]; | 528 | __be32 rsvd0[3]; |
| @@ -518,12 +531,16 @@ struct health_buffer { · 2 unmodified lines | |||
| 518 | __be32 rsvd1[2]; | 531 | __be32 rsvd1[2]; |
| 519 | __be32 fw_ver; | 532 | __be32 fw_ver; |
| 520 | __be32 hw_id; | 533 | __be32 hw_id; |
| 521 | __be32 rsvd2; | 534 | __be32 rfr; |
| 522 | u8 irisc_index; | 535 | u8 irisc_index; |
| 523 | u8 synd; | 536 | u8 synd; |
| 524 | __be16 ext_synd; | 537 | __be16 ext_synd; |
| 525 | }; | 538 | }; |
| 526 | 539 | ||
| 540 | enum mlx5_initializing_bit_offsets { | ||
| 541 | MLX5_FW_RESET_SUPPORTED_OFFSET = 30, | ||
| 542 | }; | ||
| 543 | |||
| 527 | enum mlx5_cmd_addr_l_sz_offset { | 544 | enum mlx5_cmd_addr_l_sz_offset { |
| 528 | MLX5_NIC_IFC_OFFSET = 8, | 545 | MLX5_NIC_IFC_OFFSET = 8, |
| 529 | }; | 546 | }; |
| @@ -1077,6 +1094,9 @@ enum mlx5_cap_type { · 547 unmodified lines | |||
| 1077 | MLX5_CAP_DEBUG, | 1094 | MLX5_CAP_DEBUG, |
| 1078 | MLX5_CAP_RESERVED_14, | 1095 | MLX5_CAP_RESERVED_14, |
| 1079 | MLX5_CAP_DEV_MEM, | 1096 | MLX5_CAP_DEV_MEM, |
| 1097 | MLX5_CAP_RESERVED_16, | ||
| 1098 | MLX5_CAP_TLS, | ||
| 1099 | MLX5_CAP_DEV_EVENT = 0x14, | ||
| 1080 | /* NUM OF CAP Types */ | 1100 | /* NUM OF CAP Types */ |
| 1081 | MLX5_CAP_NUM | 1101 | MLX5_CAP_NUM |
| 1082 | }; | 1102 | }; |
| @@ -1255,6 +1275,12 @@ enum mlx5_qcam_feature_groups { · 172 unmodified lines | |||
| 1255 | #define MLX5_CAP64_DEV_MEM(mdev, cap)\ | 1275 | #define MLX5_CAP64_DEV_MEM(mdev, cap)\ |
| 1256 | MLX5_GET64(device_mem_cap, mdev->caps.hca_cur[MLX5_CAP_DEV_MEM], cap) | 1276 | MLX5_GET64(device_mem_cap, mdev->caps.hca_cur[MLX5_CAP_DEV_MEM], cap) |
| 1257 | 1277 | ||
| 1278 | #define MLX5_CAP_TLS(mdev, cap) \ | ||
| 1279 | MLX5_GET(tls_cap, (mdev)->caps.hca_cur[MLX5_CAP_TLS], cap) | ||
| 1280 | |||
| 1281 | #define MLX5_CAP_DEV_EVENT(mdev, cap)\ | ||
| 1282 | MLX5_ADDR_OF(device_event_cap, (mdev)->caps.hca_cur[MLX5_CAP_DEV_EVENT], cap) | ||
| 1283 | |||
| 1258 | enum { | 1284 | enum { |
| 1259 | MLX5_CMD_STAT_OK = 0x0, | 1285 | MLX5_CMD_STAT_OK = 0x0, |
| 1260 | MLX5_CMD_STAT_INT_ERR = 0x1, | 1286 | MLX5_CMD_STAT_INT_ERR = 0x1, |
| @@ -41,7 +41,7 @@ · 40 unmodified lines | |||
| 41 | #include <linux/semaphore.h> | 41 | #include <linux/semaphore.h> |
| 42 | #include <linux/slab.h> | 42 | #include <linux/slab.h> |
| 43 | #include <linux/vmalloc.h> | 43 | #include <linux/vmalloc.h> |
| 44 | #include <linux/radix-tree.h> | 44 | #include <linux/xarray.h> |
| 45 | #include <linux/workqueue.h> | 45 | #include <linux/workqueue.h> |
| 46 | #include <linux/mempool.h> | 46 | #include <linux/mempool.h> |
| 47 | #include <linux/interrupt.h> | 47 | #include <linux/interrupt.h> |
| @@ -53,6 +53,7 @@ · 5 unmodified lines | |||
| 53 | #include <linux/mlx5/eq.h> | 53 | #include <linux/mlx5/eq.h> |
| 54 | #include <linux/timecounter.h> | 54 | #include <linux/timecounter.h> |
| 55 | #include <linux/ptp_clock_kernel.h> | 55 | #include <linux/ptp_clock_kernel.h> |
| 56 | #include <net/devlink.h> | ||
| 56 | 57 | ||
| 57 | enum { | 58 | enum { |
| 58 | MLX5_BOARD_ID_LEN = 64, | 59 | MLX5_BOARD_ID_LEN = 64, |
| @@ -107,6 +108,7 @@ enum { · 48 unmodified lines | |||
| 107 | MLX5_REG_FPGA_CAP = 0x4022, | 108 | MLX5_REG_FPGA_CAP = 0x4022, |
| 108 | MLX5_REG_FPGA_CTRL = 0x4023, | 109 | MLX5_REG_FPGA_CTRL = 0x4023, |
| 109 | MLX5_REG_FPGA_ACCESS_REG = 0x4024, | 110 | MLX5_REG_FPGA_ACCESS_REG = 0x4024, |
| 111 | MLX5_REG_CORE_DUMP = 0x402e, | ||
| 110 | MLX5_REG_PCAP = 0x5001, | 112 | MLX5_REG_PCAP = 0x5001, |
| 111 | MLX5_REG_PMTU = 0x5003, | 113 | MLX5_REG_PMTU = 0x5003, |
| 112 | MLX5_REG_PTYS = 0x5004, | 114 | MLX5_REG_PTYS = 0x5004, |
| @@ -137,6 +139,7 @@ enum { · 24 unmodified lines | |||
| 137 | MLX5_REG_MTPPS = 0x9053, | 139 | MLX5_REG_MTPPS = 0x9053, |
| 138 | MLX5_REG_MTPPSE = 0x9054, | 140 | MLX5_REG_MTPPSE = 0x9054, |
| 139 | MLX5_REG_MPEGC = 0x9056, | 141 | MLX5_REG_MPEGC = 0x9056, |
| 142 | MLX5_REG_MCQS = 0x9060, | ||
| 140 | MLX5_REG_MCQI = 0x9061, | 143 | MLX5_REG_MCQI = 0x9061, |
| 141 | MLX5_REG_MCC = 0x9062, | 144 | MLX5_REG_MCC = 0x9062, |
| 142 | MLX5_REG_MCDA = 0x9063, | 145 | MLX5_REG_MCDA = 0x9063, |
| @@ -180,6 +183,11 @@ enum port_state_policy { · 37 unmodified lines | |||
| 180 | MLX5_POLICY_INVALID = 0xffffffff | 183 | MLX5_POLICY_INVALID = 0xffffffff |
| 181 | }; | 184 | }; |
| 182 | 185 | ||
| 186 | enum mlx5_coredev_type { | ||
| 187 | MLX5_COREDEV_PF, | ||
| 188 | MLX5_COREDEV_VF | ||
| 189 | }; | ||
| 190 | |||
| 183 | struct mlx5_field_desc { | 191 | struct mlx5_field_desc { |
| 184 | struct dentry *dent; | 192 | struct dentry *dent; |
| 185 | int i; | 193 | int i; |
| @@ -433,13 +441,18 @@ struct mlx5_core_health { · 247 unmodified lines | |||
| 433 | struct timer_list timer; | 441 | struct timer_list timer; |
| 434 | u32 prev; | 442 | u32 prev; |
| 435 | int miss_counter; | 443 | int miss_counter; |
| 436 | bool sick; | 444 | u8 synd; |
| 445 | u32 fatal_error; | ||
| 446 | u32 crdump_size; | ||
| 437 | /* wq spinlock to synchronize draining */ | 447 | /* wq spinlock to synchronize draining */ |
| 438 | spinlock_t wq_lock; | 448 | spinlock_t wq_lock; |
| 439 | struct workqueue_struct *wq; | 449 | struct workqueue_struct *wq; |
| 440 | unsigned long flags; | 450 | unsigned long flags; |
| 441 | struct work_struct work; | 451 | struct work_struct fatal_report_work; |
| 452 | struct work_struct report_work; | ||
| 442 | struct delayed_work recover_work; | 453 | struct delayed_work recover_work; |
| 454 | struct devlink_health_reporter *fw_reporter; | ||
| 455 | struct devlink_health_reporter *fw_fatal_reporter; | ||
| 443 | }; | 456 | }; |
| 444 | 457 | ||
| 445 | struct mlx5_qp_table { | 458 | struct mlx5_qp_table { |
| @@ -451,13 +464,6 @@ struct mlx5_qp_table { · 5 unmodified lines | |||
| 451 | struct radix_tree_root tree; | 464 | struct radix_tree_root tree; |
| 452 | }; | 465 | }; |
| 453 | 466 | ||
| 454 | struct mlx5_mkey_table { | ||
| 455 | /* protect radix tree | ||
| 456 | */ | ||
| 457 | rwlock_t lock; | ||
| 458 | struct radix_tree_root tree; | ||
| 459 | }; | ||
| 460 | |||
| 461 | struct mlx5_vf_context { | 467 | struct mlx5_vf_context { |
| 462 | int enabled; | 468 | int enabled; |
| 463 | u64 port_guid; | 469 | u64 port_guid; |
| @@ -468,7 +474,7 @@ struct mlx5_vf_context { · 4 unmodified lines | |||
| 468 | struct mlx5_core_sriov { | 474 | struct mlx5_core_sriov { |
| 469 | struct mlx5_vf_context *vfs_ctx; | 475 | struct mlx5_vf_context *vfs_ctx; |
| 470 | int num_vfs; | 476 | int num_vfs; |
| 471 | int enabled_vfs; | 477 | u16 max_vfs; |
| 472 | }; | 478 | }; |
| 473 | 479 | ||
| 474 | struct mlx5_fc_stats { | 480 | struct mlx5_fc_stats { |
| @@ -490,6 +496,7 @@ struct mlx5_eswitch; · 15 unmodified lines | |||
| 490 | struct mlx5_lag; | 496 | struct mlx5_lag; |
| 491 | struct mlx5_devcom; | 497 | struct mlx5_devcom; |
| 492 | struct mlx5_eq_table; | 498 | struct mlx5_eq_table; |
| 499 | struct mlx5_irq_table; | ||
| 493 | 500 | ||
| 494 | struct mlx5_rate_limit { | 501 | struct mlx5_rate_limit { |
| 495 | u32 rate; | 502 | u32 rate; |
| @@ -519,6 +526,8 @@ struct mlx5_core_roce { · 23 unmodified lines | |||
| 519 | }; | 526 | }; |
| 520 | 527 | ||
| 521 | struct mlx5_priv { | 528 | struct mlx5_priv { |
| 529 | /* IRQ table valid only for real pci devices PF or VF */ | ||
| 530 | struct mlx5_irq_table *irq_table; | ||
| 522 | struct mlx5_eq_table *eq_table; | 531 | struct mlx5_eq_table *eq_table; |
| 523 | 532 | ||
| 524 | /* pages stuff */ | 533 | /* pages stuff */ |
| @@ -541,9 +550,7 @@ struct mlx5_priv { · 16 unmodified lines | |||
| 541 | struct dentry *cmdif_debugfs; | 550 | struct dentry *cmdif_debugfs; |
| 542 | /* end: qp staff */ | 551 | /* end: qp staff */ |
| 543 | 552 | ||
| 544 | /* start: mkey staff */ | 553 | struct xarray mkey_table; |
| 545 | struct mlx5_mkey_table mkey_table; | ||
| 546 | /* end: mkey staff */ | ||
| 547 | 554 | ||
| 548 | /* start: alloc staff */ | 555 | /* start: alloc staff */ |
| 549 | /* protect buffer alocation according to numa node */ | 556 | /* protect buffer alocation according to numa node */ |
| @@ -570,7 +577,6 @@ struct mlx5_priv { · 20 unmodified lines | |||
| 570 | struct mlx5_core_sriov sriov; | 577 | struct mlx5_core_sriov sriov; |
| 571 | struct mlx5_lag *lag; | 578 | struct mlx5_lag *lag; |
| 572 | struct mlx5_devcom *devcom; | 579 | struct mlx5_devcom *devcom; |
| 573 | unsigned long pci_dev_data; | ||
| 574 | struct mlx5_core_roce roce; | 580 | struct mlx5_core_roce roce; |
| 575 | struct mlx5_fc_stats fc_stats; | 581 | struct mlx5_fc_stats fc_stats; |
| 576 | struct mlx5_rl_table rl_table; | 582 | struct mlx5_rl_table rl_table; |
| @@ -580,6 +586,7 @@ struct mlx5_priv { · 3 unmodified lines | |||
| 580 | }; | 586 | }; |
| 581 | 587 | ||
| 582 | enum mlx5_device_state { | 588 | enum mlx5_device_state { |
| 589 | MLX5_DEVICE_STATE_UNINITIALIZED, | ||
| 583 | MLX5_DEVICE_STATE_UP, | 590 | MLX5_DEVICE_STATE_UP, |
| 584 | MLX5_DEVICE_STATE_INTERNAL_ERROR, | 591 | MLX5_DEVICE_STATE_INTERNAL_ERROR, |
| 585 | }; | 592 | }; |
| @@ -646,9 +653,11 @@ struct mlx5_clock { · 60 unmodified lines | |||
| 646 | 653 | ||
| 647 | struct mlx5_fw_tracer; | 654 | struct mlx5_fw_tracer; |
| 648 | struct mlx5_vxlan; | 655 | struct mlx5_vxlan; |
| 656 | struct mlx5_geneve; | ||
| 649 | 657 | ||
| 650 | struct mlx5_core_dev { | 658 | struct mlx5_core_dev { |
| 651 | struct device *device; | 659 | struct device *device; |
| 660 | enum mlx5_coredev_type coredev_type; | ||
| 652 | struct pci_dev *pdev; | 661 | struct pci_dev *pdev; |
| 653 | /* sync pci state */ | 662 | /* sync pci state */ |
| 654 | struct mutex pci_status_mutex; | 663 | struct mutex pci_status_mutex; |
| @@ -680,6 +689,7 @@ struct mlx5_core_dev { · 25 unmodified lines | |||
| 680 | u32 issi; | 689 | u32 issi; |
| 681 | struct mlx5e_resources mlx5e_res; | 690 | struct mlx5e_resources mlx5e_res; |
| 682 | struct mlx5_vxlan *vxlan; | 691 | struct mlx5_vxlan *vxlan; |
| 692 | struct mlx5_geneve *geneve; | ||
| 683 | struct { | 693 | struct { |
| 684 | struct mlx5_rsvd_gids reserved_gids; | 694 | struct mlx5_rsvd_gids reserved_gids; |
| 685 | u32 roce_en; | 695 | u32 roce_en; |
| @@ -690,6 +700,7 @@ struct mlx5_core_dev { · 4 unmodified lines | |||
| 690 | struct mlx5_clock clock; | 700 | struct mlx5_clock clock; |
| 691 | struct mlx5_ib_clock_info *clock_info; | 701 | struct mlx5_ib_clock_info *clock_info; |
| 692 | struct mlx5_fw_tracer *tracer; | 702 | struct mlx5_fw_tracer *tracer; |
| 703 | u32 vsc_addr; | ||
| 693 | }; | 704 | }; |
| 694 | 705 | ||
| 695 | struct mlx5_db { | 706 | struct mlx5_db { |
| @@ -901,7 +912,6 @@ void mlx5_start_health_poll(struct mlx5_core_dev *dev); · 205 unmodified lines | |||
| 901 | void mlx5_stop_health_poll(struct mlx5_core_dev *dev, bool disable_health); | 912 | void mlx5_stop_health_poll(struct mlx5_core_dev *dev, bool disable_health); |
| 902 | void mlx5_drain_health_wq(struct mlx5_core_dev *dev); | 913 | void mlx5_drain_health_wq(struct mlx5_core_dev *dev); |
| 903 | void mlx5_trigger_health_work(struct mlx5_core_dev *dev); | 914 | void mlx5_trigger_health_work(struct mlx5_core_dev *dev); |
| 904 | void mlx5_drain_health_recovery(struct mlx5_core_dev *dev); | ||
| 905 | int mlx5_buf_alloc_node(struct mlx5_core_dev *dev, int size, | 915 | int mlx5_buf_alloc_node(struct mlx5_core_dev *dev, int size, |
| 906 | struct mlx5_frag_buf *buf, int node); | 916 | struct mlx5_frag_buf *buf, int node); |
| 907 | int mlx5_buf_alloc(struct mlx5_core_dev *dev, | 917 | int mlx5_buf_alloc(struct mlx5_core_dev *dev, |
| @@ -1042,6 +1052,8 @@ int mlx5_register_interface(struct mlx5_interface *intf); · 134 unmodified lines | |||
| 1042 | void mlx5_unregister_interface(struct mlx5_interface *intf); | 1052 | void mlx5_unregister_interface(struct mlx5_interface *intf); |
| 1043 | int mlx5_notifier_register(struct mlx5_core_dev *dev, struct notifier_block *nb); | 1053 | int mlx5_notifier_register(struct mlx5_core_dev *dev, struct notifier_block *nb); |
| 1044 | int mlx5_notifier_unregister(struct mlx5_core_dev *dev, struct notifier_block *nb); | 1054 | int mlx5_notifier_unregister(struct mlx5_core_dev *dev, struct notifier_block *nb); |
| 1055 | int mlx5_eq_notifier_register(struct mlx5_core_dev *dev, struct mlx5_nb *nb); | ||
| 1056 | int mlx5_eq_notifier_unregister(struct mlx5_core_dev *dev, struct mlx5_nb *nb); | ||
| 1045 | 1057 | ||
| 1046 | int mlx5_core_query_vendor_id(struct mlx5_core_dev *mdev, u32 *vendor_id); | 1058 | int mlx5_core_query_vendor_id(struct mlx5_core_dev *mdev, u32 *vendor_id); |
| 1047 | 1059 | ||
| @@ -1082,9 +1094,9 @@ enum { · 34 unmodified lines | |||
| 1082 | MLX5_PCI_DEV_IS_VF = 1 << 0, | 1094 | MLX5_PCI_DEV_IS_VF = 1 << 0, |
| 1083 | }; | 1095 | }; |
| 1084 | 1096 | ||
| 1085 | static inline int mlx5_core_is_pf(struct mlx5_core_dev *dev) | 1097 | static inline bool mlx5_core_is_pf(const struct mlx5_core_dev *dev) |
| 1086 | { | 1098 | { |
| 1087 | return !(dev->priv.pci_dev_data & MLX5_PCI_DEV_IS_VF); | 1099 | return dev->coredev_type == MLX5_COREDEV_PF; |
| 1088 | } | 1100 | } |
| 1089 | 1101 | ||
| 1090 | static inline bool mlx5_core_is_ecpf(struct mlx5_core_dev *dev) | 1102 | static inline bool mlx5_core_is_ecpf(struct mlx5_core_dev *dev) |
| @@ -1092,23 +1104,20 @@ static inline bool mlx5_core_is_ecpf(struct mlx5_core_dev *dev) · 1 unmodified line | |||
| 1092 | return dev->caps.embedded_cpu; | 1104 | return dev->caps.embedded_cpu; |
| 1093 | } | 1105 | } |
| 1094 | 1106 | ||
| 1095 | static inline bool mlx5_core_is_ecpf_esw_manager(struct mlx5_core_dev *dev) | 1107 | static inline bool |
| 1108 | mlx5_core_is_ecpf_esw_manager(const struct mlx5_core_dev *dev) | ||
| 1096 | { | 1109 | { |
| 1097 | return dev->caps.embedded_cpu && MLX5_CAP_GEN(dev, eswitch_manager); | 1110 | return dev->caps.embedded_cpu && MLX5_CAP_GEN(dev, eswitch_manager); |
| 1098 | } | 1111 | } |
| 1099 | 1112 | ||
| 1100 | static inline bool mlx5_ecpf_vport_exists(struct mlx5_core_dev *dev) | 1113 | static inline bool mlx5_ecpf_vport_exists(const struct mlx5_core_dev *dev) |
| 1101 | { | 1114 | { |
| 1102 | return mlx5_core_is_pf(dev) && MLX5_CAP_ESW(dev, ecpf_vport_exists); | 1115 | return mlx5_core_is_pf(dev) && MLX5_CAP_ESW(dev, ecpf_vport_exists); |
| 1103 | } | 1116 | } |
| 1104 | 1117 | ||
| 1105 | #define MLX5_HOST_PF_MAX_VFS (127u) | 1118 | static inline u16 mlx5_core_max_vfs(const struct mlx5_core_dev *dev) |
| 1106 | static inline u16 mlx5_core_max_vfs(struct mlx5_core_dev *dev) | ||
| 1107 | { | 1119 | { |
| 1108 | if (mlx5_core_is_ecpf_esw_manager(dev)) | 1120 | return dev->priv.sriov.max_vfs; |
| 1109 | return MLX5_HOST_PF_MAX_VFS; | ||
| 1110 | else | ||
| 1111 | return pci_sriov_get_totalvfs(dev->pdev); | ||
| 1112 | } | 1121 | } |
| 1113 | 1122 | ||
| 1114 | static inline int mlx5_get_gid_table_len(u16 param) | 1123 | static inline int mlx5_get_gid_table_len(u16 param) |
| @@ -4,17 +4,7 @@ · 3 unmodified lines | |||
| 4 | #ifndef MLX5_CORE_EQ_H | 4 | #ifndef MLX5_CORE_EQ_H |
| 5 | #define MLX5_CORE_EQ_H | 5 | #define MLX5_CORE_EQ_H |
| 6 | 6 | ||
| 7 | enum { | 7 | #define MLX5_IRQ_VEC_COMP_BASE 1 |
| 8 | MLX5_EQ_PAGEREQ_IDX = 0, | ||
| 9 | MLX5_EQ_CMD_IDX = 1, | ||
| 10 | MLX5_EQ_ASYNC_IDX = 2, | ||
| 11 | /* reserved to be used by mlx5_core ulps (mlx5e/mlx5_ib) */ | ||
| 12 | MLX5_EQ_PFAULT_IDX = 3, | ||
| 13 | MLX5_EQ_MAX_ASYNC_EQS, | ||
| 14 | /* completion eqs vector indices start here */ | ||
| 15 | MLX5_EQ_VEC_COMP_BASE = MLX5_EQ_MAX_ASYNC_EQS, | ||
| 16 | }; | ||
| 17 | |||
| 18 | #define MLX5_NUM_CMD_EQE (32) | 8 | #define MLX5_NUM_CMD_EQE (32) |
| 19 | #define MLX5_NUM_ASYNC_EQE (0x1000) | 9 | #define MLX5_NUM_ASYNC_EQE (0x1000) |
| 20 | #define MLX5_NUM_SPARE_EQE (0x80) | 10 | #define MLX5_NUM_SPARE_EQE (0x80) |
| @@ -23,18 +13,19 @@ struct mlx5_eq; · 2 unmodified lines | |||
| 23 | struct mlx5_core_dev; | 13 | struct mlx5_core_dev; |
| 24 | 14 | ||
| 25 | struct mlx5_eq_param { | 15 | struct mlx5_eq_param { |
| 26 | u8 index; | 16 | u8 irq_index; |
| 27 | int nent; | 17 | int nent; |
| 28 | u64 mask; | 18 | u64 mask[4]; |
| 29 | void *context; | ||
| 30 | irq_handler_t handler; | ||
| 31 | }; | 19 | }; |
| 32 | 20 | ||
| 33 | struct mlx5_eq * | 21 | struct mlx5_eq * |
| 34 | mlx5_eq_create_generic(struct mlx5_core_dev *dev, const char *name, | 22 | mlx5_eq_create_generic(struct mlx5_core_dev *dev, struct mlx5_eq_param *param); |
| 35 | struct mlx5_eq_param *param); | ||
| 36 | int | 23 | int |
| 37 | mlx5_eq_destroy_generic(struct mlx5_core_dev *dev, struct mlx5_eq *eq); | 24 | mlx5_eq_destroy_generic(struct mlx5_core_dev *dev, struct mlx5_eq *eq); |
| 25 | int mlx5_eq_enable(struct mlx5_core_dev *dev, struct mlx5_eq *eq, | ||
| 26 | struct notifier_block *nb); | ||
| 27 | void mlx5_eq_disable(struct mlx5_core_dev *dev, struct mlx5_eq *eq, | ||
| 28 | struct notifier_block *nb); | ||
| 38 | 29 | ||
| 39 | struct mlx5_eqe *mlx5_eq_get_eqe(struct mlx5_eq *eq, u32 cc); | 30 | struct mlx5_eqe *mlx5_eq_get_eqe(struct mlx5_eq *eq, u32 cc); |
| 40 | void mlx5_eq_update_ci(struct mlx5_eq *eq, u32 cc, bool arm); | 31 | void mlx5_eq_update_ci(struct mlx5_eq *eq, u32 cc, bool arm); |
| @@ -7,13 +7,14 @@ · 6 unmodified lines | |||
| 7 | #define _MLX5_ESWITCH_ | 7 | #define _MLX5_ESWITCH_ |
| 8 | 8 | ||
| 9 | #include <linux/mlx5/driver.h> | 9 | #include <linux/mlx5/driver.h> |
| 10 | #include <net/devlink.h> | ||
| 10 | 11 | ||
| 11 | #define MLX5_ESWITCH_MANAGER(mdev) MLX5_CAP_GEN(mdev, eswitch_manager) | 12 | #define MLX5_ESWITCH_MANAGER(mdev) MLX5_CAP_GEN(mdev, eswitch_manager) |
| 12 | 13 | ||
| 13 | enum { | 14 | enum { |
| 14 | SRIOV_NONE, | 15 | MLX5_ESWITCH_NONE, |
| 15 | SRIOV_LEGACY, | 16 | MLX5_ESWITCH_LEGACY, |
| 16 | SRIOV_OFFLOADS | 17 | MLX5_ESWITCH_OFFLOADS |
| 17 | }; | 18 | }; |
| 18 | 19 | ||
| 19 | enum { | 20 | enum { |
| @@ -29,25 +30,29 @@ enum { · 9 unmodified lines | |||
| 29 | }; | 30 | }; |
| 30 | 31 | ||
| 31 | struct mlx5_eswitch_rep; | 32 | struct mlx5_eswitch_rep; |
| 32 | struct mlx5_eswitch_rep_if { | 33 | struct mlx5_eswitch_rep_ops { |
| 33 | int (*load)(struct mlx5_core_dev *dev, | 34 | int (*load)(struct mlx5_core_dev *dev, struct mlx5_eswitch_rep *rep); |
| 34 | struct mlx5_eswitch_rep *rep); | 35 | void (*unload)(struct mlx5_eswitch_rep *rep); |
| 35 | void (*unload)(struct mlx5_eswitch_rep *rep); | 36 | void *(*get_proto_dev)(struct mlx5_eswitch_rep *rep); |
| 36 | void *(*get_proto_dev)(struct mlx5_eswitch_rep *rep); | 37 | }; |
| 37 | void *priv; | 38 | |
| 38 | atomic_t state; | 39 | struct mlx5_eswitch_rep_data { |
| 40 | void *priv; | ||
| 41 | atomic_t state; | ||
| 39 | }; | 42 | }; |
| 40 | 43 | ||
| 41 | struct mlx5_eswitch_rep { | 44 | struct mlx5_eswitch_rep { |
| 42 | struct mlx5_eswitch_rep_if rep_if[NUM_REP_TYPES]; | 45 | struct mlx5_eswitch_rep_data rep_data[NUM_REP_TYPES]; |
| 43 | u16 vport; | 46 | u16 vport; |
| 44 | u8 hw_id[ETH_ALEN]; | 47 | u8 hw_id[ETH_ALEN]; |
| 45 | u16 vlan; | 48 | u16 vlan; |
| 49 | /* Only IB rep is using vport_index */ | ||
| 50 | u16 vport_index; | ||
| 46 | u32 vlan_refcount; | 51 | u32 vlan_refcount; |
| 47 | }; | 52 | }; |
| 48 | 53 | ||
| 49 | void mlx5_eswitch_register_vport_reps(struct mlx5_eswitch *esw, | 54 | void mlx5_eswitch_register_vport_reps(struct mlx5_eswitch *esw, |
| 50 | struct mlx5_eswitch_rep_if *rep_if, | 55 | const struct mlx5_eswitch_rep_ops *ops, |
| 51 | u8 rep_type); | 56 | u8 rep_type); |
| 52 | void mlx5_eswitch_unregister_vport_reps(struct mlx5_eswitch *esw, u8 rep_type); | 57 | void mlx5_eswitch_unregister_vport_reps(struct mlx5_eswitch *esw, u8 rep_type); |
| 53 | void *mlx5_eswitch_get_proto_dev(struct mlx5_eswitch *esw, | 58 | void *mlx5_eswitch_get_proto_dev(struct mlx5_eswitch *esw, |
| @@ -60,4 +65,35 @@ u8 mlx5_eswitch_mode(struct mlx5_eswitch *esw); · 6 unmodified lines | |||
| 60 | struct mlx5_flow_handle * | 65 | struct mlx5_flow_handle * |
| 61 | mlx5_eswitch_add_send_to_vport_rule(struct mlx5_eswitch *esw, | 66 | mlx5_eswitch_add_send_to_vport_rule(struct mlx5_eswitch *esw, |
| 62 | u16 vport_num, u32 sqn); | 67 | u16 vport_num, u32 sqn); |
| 68 | |||
| 69 | u16 mlx5_eswitch_get_total_vports(const struct mlx5_core_dev *dev); | ||
| 70 | |||
| 71 | #ifdef CONFIG_MLX5_ESWITCH | ||
| 72 | enum devlink_eswitch_encap_mode | ||
| 73 | mlx5_eswitch_get_encap_mode(const struct mlx5_core_dev *dev); | ||
| 74 | |||
| 75 | bool mlx5_eswitch_vport_match_metadata_enabled(const struct mlx5_eswitch *esw); | ||
| 76 | u32 mlx5_eswitch_get_vport_metadata_for_match(const struct mlx5_eswitch *esw, | ||
| 77 | u16 vport_num); | ||
| 78 | #else /* CONFIG_MLX5_ESWITCH */ | ||
| 79 | static inline enum devlink_eswitch_encap_mode | ||
| 80 | mlx5_eswitch_get_encap_mode(const struct mlx5_core_dev *dev) | ||
| 81 | { | ||
| 82 | return DEVLINK_ESWITCH_ENCAP_MODE_NONE; | ||
| 83 | } | ||
| 84 | |||
| 85 | static inline bool | ||
| 86 | mlx5_eswitch_vport_match_metadata_enabled(const struct mlx5_eswitch *esw) | ||
| 87 | { | ||
| 88 | return false; | ||
| 89 | }; | ||
| 90 | |||
| 91 | static inline u32 | ||
| 92 | mlx5_eswitch_get_vport_metadata_for_match(const struct mlx5_eswitch *esw, | ||
| 93 | int vport_num) | ||
| 94 | { | ||
| 95 | return 0; | ||
| 96 | }; | ||
| 97 | #endif /* CONFIG_MLX5_ESWITCH */ | ||
| 98 | |||
| 63 | #endif | 99 | #endif |
| @@ -47,6 +47,7 @@ enum { · 46 unmodified lines | |||
| 47 | enum { | 47 | enum { |
| 48 | MLX5_FLOW_TABLE_TUNNEL_EN_REFORMAT = BIT(0), | 48 | MLX5_FLOW_TABLE_TUNNEL_EN_REFORMAT = BIT(0), |
| 49 | MLX5_FLOW_TABLE_TUNNEL_EN_DECAP = BIT(1), | 49 | MLX5_FLOW_TABLE_TUNNEL_EN_DECAP = BIT(1), |
| 50 | MLX5_FLOW_TABLE_TERMINATION = BIT(2), | ||
| 50 | }; | 51 | }; |
| 51 | 52 | ||
| 52 | #define LEFTOVERS_RULE_NUM 2 | 53 | #define LEFTOVERS_RULE_NUM 2 |
| @@ -87,10 +88,21 @@ struct mlx5_flow_group; · 34 unmodified lines | |||
| 87 | struct mlx5_flow_namespace; | 88 | struct mlx5_flow_namespace; |
| 88 | struct mlx5_flow_handle; | 89 | struct mlx5_flow_handle; |
| 89 | 90 | ||
| 91 | enum { | ||
| 92 | FLOW_CONTEXT_HAS_TAG = BIT(0), | ||
| 93 | }; | ||
| 94 | |||
| 95 | struct mlx5_flow_context { | ||
| 96 | u32 flags; | ||
| 97 | u32 flow_tag; | ||
| 98 | u32 flow_source; | ||
| 99 | }; | ||
| 100 | |||
| 90 | struct mlx5_flow_spec { | 101 | struct mlx5_flow_spec { |
| 91 | u8 match_criteria_enable; | 102 | u8 match_criteria_enable; |
| 92 | u32 match_criteria[MLX5_ST_SZ_DW(fte_match_param)]; | 103 | u32 match_criteria[MLX5_ST_SZ_DW(fte_match_param)]; |
| 93 | u32 match_value[MLX5_ST_SZ_DW(fte_match_param)]; | 104 | u32 match_value[MLX5_ST_SZ_DW(fte_match_param)]; |
| 105 | struct mlx5_flow_context flow_context; | ||
| 94 | }; | 106 | }; |
| 95 | 107 | ||
| 96 | enum { | 108 | enum { |
| @@ -172,13 +184,11 @@ struct mlx5_fs_vlan { · 75 unmodified lines | |||
| 172 | #define MLX5_FS_VLAN_DEPTH 2 | 184 | #define MLX5_FS_VLAN_DEPTH 2 |
| 173 | 185 | ||
| 174 | enum { | 186 | enum { |
| 175 | FLOW_ACT_HAS_TAG = BIT(0), | 187 | FLOW_ACT_NO_APPEND = BIT(0), |
| 176 | FLOW_ACT_NO_APPEND = BIT(1), | ||
| 177 | }; | 188 | }; |
| 178 | 189 | ||
| 179 | struct mlx5_flow_act { | 190 | struct mlx5_flow_act { |
| 180 | u32 action; | 191 | u32 action; |
| 181 | u32 flow_tag; | ||
| 182 | u32 reformat_id; | 192 | u32 reformat_id; |
| 183 | u32 modify_id; | 193 | u32 modify_id; |
| 184 | uintptr_t esp_id; | 194 | uintptr_t esp_id; |
| @@ -189,7 +199,6 @@ struct mlx5_flow_act { · 4 unmodified lines | |||
| 189 | 199 | ||
| 190 | #define MLX5_DECLARE_FLOW_ACT(name) \ | 200 | #define MLX5_DECLARE_FLOW_ACT(name) \ |
| 191 | struct mlx5_flow_act name = { .action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST,\ | 201 | struct mlx5_flow_act name = { .action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST,\ |
| 192 | .flow_tag = MLX5_FS_DEFAULT_FLOW_TAG, \ | ||
| 193 | .reformat_id = 0, \ | 202 | .reformat_id = 0, \ |
| 194 | .modify_id = 0, \ | 203 | .modify_id = 0, \ |
| 195 | .flags = 0, } | 204 | .flags = 0, } |
| @@ -199,7 +208,7 @@ struct mlx5_flow_act { · 3 unmodified lines | |||
| 199 | */ | 208 | */ |
| 200 | struct mlx5_flow_handle * | 209 | struct mlx5_flow_handle * |
| 201 | mlx5_add_flow_rules(struct mlx5_flow_table *ft, | 210 | mlx5_add_flow_rules(struct mlx5_flow_table *ft, |
| 202 | struct mlx5_flow_spec *spec, | 211 | const struct mlx5_flow_spec *spec, |
| 203 | struct mlx5_flow_act *flow_act, | 212 | struct mlx5_flow_act *flow_act, |
| 204 | struct mlx5_flow_destination *dest, | 213 | struct mlx5_flow_destination *dest, |
| 205 | int num_dest); | 214 | int num_dest); |
| @@ -211,6 +220,7 @@ int mlx5_modify_rule_destination(struct mlx5_flow_handle *handler, · 5 unmodified lines | |||
| 211 | 220 | ||
| 212 | struct mlx5_fc *mlx5_fc_create(struct mlx5_core_dev *dev, bool aging); | 221 | struct mlx5_fc *mlx5_fc_create(struct mlx5_core_dev *dev, bool aging); |
| 213 | void mlx5_fc_destroy(struct mlx5_core_dev *dev, struct mlx5_fc *counter); | 222 | void mlx5_fc_destroy(struct mlx5_core_dev *dev, struct mlx5_fc *counter); |
| 223 | u64 mlx5_fc_query_lastuse(struct mlx5_fc *counter); | ||
| 214 | void mlx5_fc_query_cached(struct mlx5_fc *counter, | 224 | void mlx5_fc_query_cached(struct mlx5_fc *counter, |
| 215 | u64 *bytes, u64 *packets, u64 *lastuse); | 225 | u64 *bytes, u64 *packets, u64 *lastuse); |
| 216 | int mlx5_fc_query(struct mlx5_core_dev *dev, struct mlx5_fc *counter, | 226 | int mlx5_fc_query(struct mlx5_core_dev *dev, struct mlx5_fc *counter, |
| @@ -91,6 +91,20 @@ enum { · 90 unmodified lines | |||
| 91 | 91 | ||
| 92 | enum { | 92 | enum { |
| 93 | MLX5_OBJ_TYPE_GENEVE_TLV_OPT = 0x000b, | 93 | MLX5_OBJ_TYPE_GENEVE_TLV_OPT = 0x000b, |
| 94 | MLX5_OBJ_TYPE_MKEY = 0xff01, | ||
| 95 | MLX5_OBJ_TYPE_QP = 0xff02, | ||
| 96 | MLX5_OBJ_TYPE_PSV = 0xff03, | ||
| 97 | MLX5_OBJ_TYPE_RMP = 0xff04, | ||
| 98 | MLX5_OBJ_TYPE_XRC_SRQ = 0xff05, | ||
| 99 | MLX5_OBJ_TYPE_RQ = 0xff06, | ||
| 100 | MLX5_OBJ_TYPE_SQ = 0xff07, | ||
| 101 | MLX5_OBJ_TYPE_TIR = 0xff08, | ||
| 102 | MLX5_OBJ_TYPE_TIS = 0xff09, | ||
| 103 | MLX5_OBJ_TYPE_DCT = 0xff0a, | ||
| 104 | MLX5_OBJ_TYPE_XRQ = 0xff0b, | ||
| 105 | MLX5_OBJ_TYPE_RQT = 0xff0e, | ||
| 106 | MLX5_OBJ_TYPE_FLOW_COUNTER = 0xff0f, | ||
| 107 | MLX5_OBJ_TYPE_CQ = 0xff10, | ||
| 94 | }; | 108 | }; |
| 95 | 109 | ||
| 96 | enum { | 110 | enum { |
| @@ -106,6 +120,9 @@ enum { · 9 unmodified lines | |||
| 106 | MLX5_CMD_OP_QUERY_ISSI = 0x10a, | 120 | MLX5_CMD_OP_QUERY_ISSI = 0x10a, |
| 107 | MLX5_CMD_OP_SET_ISSI = 0x10b, | 121 | MLX5_CMD_OP_SET_ISSI = 0x10b, |
| 108 | MLX5_CMD_OP_SET_DRIVER_VERSION = 0x10d, | 122 | MLX5_CMD_OP_SET_DRIVER_VERSION = 0x10d, |
| 123 | MLX5_CMD_OP_QUERY_SF_PARTITION = 0x111, | ||
| 124 | MLX5_CMD_OP_ALLOC_SF = 0x113, | ||
| 125 | MLX5_CMD_OP_DEALLOC_SF = 0x114, | ||
| 109 | MLX5_CMD_OP_CREATE_MKEY = 0x200, | 126 | MLX5_CMD_OP_CREATE_MKEY = 0x200, |
| 110 | MLX5_CMD_OP_QUERY_MKEY = 0x201, | 127 | MLX5_CMD_OP_QUERY_MKEY = 0x201, |
| 111 | MLX5_CMD_OP_DESTROY_MKEY = 0x202, | 128 | MLX5_CMD_OP_DESTROY_MKEY = 0x202, |
| @@ -155,7 +172,7 @@ enum { · 43 unmodified lines | |||
| 155 | MLX5_CMD_OP_QUERY_XRQ_DC_PARAMS_ENTRY = 0x725, | 172 | MLX5_CMD_OP_QUERY_XRQ_DC_PARAMS_ENTRY = 0x725, |
| 156 | MLX5_CMD_OP_SET_XRQ_DC_PARAMS_ENTRY = 0x726, | 173 | MLX5_CMD_OP_SET_XRQ_DC_PARAMS_ENTRY = 0x726, |
| 157 | MLX5_CMD_OP_QUERY_XRQ_ERROR_PARAMS = 0x727, | 174 | MLX5_CMD_OP_QUERY_XRQ_ERROR_PARAMS = 0x727, |
| 158 | MLX5_CMD_OP_QUERY_HOST_PARAMS = 0x740, | 175 | MLX5_CMD_OP_QUERY_ESW_FUNCTIONS = 0x740, |
| 159 | MLX5_CMD_OP_QUERY_VPORT_STATE = 0x750, | 176 | MLX5_CMD_OP_QUERY_VPORT_STATE = 0x750, |
| 160 | MLX5_CMD_OP_MODIFY_VPORT_STATE = 0x751, | 177 | MLX5_CMD_OP_MODIFY_VPORT_STATE = 0x751, |
| 161 | MLX5_CMD_OP_QUERY_ESW_VPORT_CONTEXT = 0x752, | 178 | MLX5_CMD_OP_QUERY_ESW_VPORT_CONTEXT = 0x752, |
| @@ -382,7 +399,8 @@ struct mlx5_ifc_flow_table_prop_layout_bits { · 220 unmodified lines | |||
| 382 | u8 reformat_and_modify_action[0x1]; | 399 | u8 reformat_and_modify_action[0x1]; |
| 383 | u8 reserved_at_15[0x2]; | 400 | u8 reserved_at_15[0x2]; |
| 384 | u8 table_miss_action_domain[0x1]; | 401 | u8 table_miss_action_domain[0x1]; |
| 385 | u8 reserved_at_18[0x8]; | 402 | u8 termination_table[0x1]; |
| 403 | u8 reserved_at_19[0x7]; | ||
| 386 | u8 reserved_at_20[0x2]; | 404 | u8 reserved_at_20[0x2]; |
| 387 | u8 log_max_ft_size[0x6]; | 405 | u8 log_max_ft_size[0x6]; |
| 388 | u8 log_max_modify_header_context[0x8]; | 406 | u8 log_max_modify_header_context[0x8]; |
| @@ -527,7 +545,21 @@ struct mlx5_ifc_fte_match_set_misc2_bits { · 138 unmodified lines | |||
| 527 | 545 | ||
| 528 | struct mlx5_ifc_fte_match_mpls_bits outer_first_mpls_over_udp; | 546 | struct mlx5_ifc_fte_match_mpls_bits outer_first_mpls_over_udp; |
| 529 | 547 | ||
| 530 | u8 reserved_at_80[0x100]; | 548 | u8 metadata_reg_c_7[0x20]; |
| 549 | |||
| 550 | u8 metadata_reg_c_6[0x20]; | ||
| 551 | |||
| 552 | u8 metadata_reg_c_5[0x20]; | ||
| 553 | |||
| 554 | u8 metadata_reg_c_4[0x20]; | ||
| 555 | |||
| 556 | u8 metadata_reg_c_3[0x20]; | ||
| 557 | |||
| 558 | u8 metadata_reg_c_2[0x20]; | ||
| 559 | |||
| 560 | u8 metadata_reg_c_1[0x20]; | ||
| 561 | |||
| 562 | u8 metadata_reg_c_0[0x20]; | ||
| 531 | 563 | ||
| 532 | u8 metadata_reg_a[0x20]; | 564 | u8 metadata_reg_a[0x20]; |
| 533 | 565 | ||
| @@ -635,8 +667,22 @@ struct mlx5_ifc_flow_table_nic_cap_bits { · 101 unmodified lines | |||
| 635 | u8 reserved_at_e00[0x7200]; | 667 | u8 reserved_at_e00[0x7200]; |
| 636 | }; | 668 | }; |
| 637 | 669 | ||
| 670 | enum { | ||
| 671 | MLX5_FDB_TO_VPORT_REG_C_0 = 0x01, | ||
| 672 | MLX5_FDB_TO_VPORT_REG_C_1 = 0x02, | ||
| 673 | MLX5_FDB_TO_VPORT_REG_C_2 = 0x04, | ||
| 674 | MLX5_FDB_TO_VPORT_REG_C_3 = 0x08, | ||
| 675 | MLX5_FDB_TO_VPORT_REG_C_4 = 0x10, | ||
| 676 | MLX5_FDB_TO_VPORT_REG_C_5 = 0x20, | ||
| 677 | MLX5_FDB_TO_VPORT_REG_C_6 = 0x40, | ||
| 678 | MLX5_FDB_TO_VPORT_REG_C_7 = 0x80, | ||
| 679 | }; | ||
| 680 | |||
| 638 | struct mlx5_ifc_flow_table_eswitch_cap_bits { | 681 | struct mlx5_ifc_flow_table_eswitch_cap_bits { |
| 639 | u8 reserved_at_0[0x1a]; | 682 | u8 fdb_to_vport_reg_c_id[0x8]; |
| 683 | u8 reserved_at_8[0xf]; | ||
| 684 | u8 flow_source[0x1]; | ||
| 685 | u8 reserved_at_18[0x2]; | ||
| 640 | u8 multi_fdb_encap[0x1]; | 686 | u8 multi_fdb_encap[0x1]; |
| 641 | u8 reserved_at_1b[0x1]; | 687 | u8 reserved_at_1b[0x1]; |
| 642 | u8 fdb_multi_path_to_table[0x1]; | 688 | u8 fdb_multi_path_to_table[0x1]; |
| @@ -664,7 +710,11 @@ struct mlx5_ifc_e_switch_cap_bits { · 21 unmodified lines | |||
| 664 | u8 vport_svlan_insert[0x1]; | 710 | u8 vport_svlan_insert[0x1]; |
| 665 | u8 vport_cvlan_insert_if_not_exist[0x1]; | 711 | u8 vport_cvlan_insert_if_not_exist[0x1]; |
| 666 | u8 vport_cvlan_insert_overwrite[0x1]; | 712 | u8 vport_cvlan_insert_overwrite[0x1]; |
| 667 | u8 reserved_at_5[0x16]; | 713 | u8 reserved_at_5[0x3]; |
| 714 | u8 esw_uplink_ingress_acl[0x1]; | ||
| 715 | u8 reserved_at_9[0x10]; | ||
| 716 | u8 esw_functions_changed[0x1]; | ||
| 717 | u8 reserved_at_1a[0x1]; | ||
| 668 | u8 ecpf_vport_exists[0x1]; | 718 | u8 ecpf_vport_exists[0x1]; |
| 669 | u8 counter_eswitch_affinity[0x1]; | 719 | u8 counter_eswitch_affinity[0x1]; |
| 670 | u8 merged_eswitch[0x1]; | 720 | u8 merged_eswitch[0x1]; |
| @@ -680,7 +730,11 @@ struct mlx5_ifc_e_switch_cap_bits { · 9 unmodified lines | |||
| 680 | u8 reserved_2b[0x6]; | 730 | u8 reserved_2b[0x6]; |
| 681 | u8 max_encap_header_size[0xa]; | 731 | u8 max_encap_header_size[0xa]; |
| 682 | 732 | ||
| 683 | u8 reserved_40[0x7c0]; | 733 | u8 reserved_at_40[0xb]; |
| 734 | u8 log_max_esw_sf[0x5]; | ||
| 735 | u8 esw_sf_base_id[0x10]; | ||
| 736 | |||
| 737 | u8 reserved_at_60[0x7a0]; | ||
| 684 | 738 | ||
| 685 | }; | 739 | }; |
| 686 | 740 | ||
| @@ -715,7 +769,9 @@ struct mlx5_ifc_qos_cap_bits { · 28 unmodified lines | |||
| 715 | }; | 769 | }; |
| 716 | 770 | ||
| 717 | struct mlx5_ifc_debug_cap_bits { | 771 | struct mlx5_ifc_debug_cap_bits { |
| 718 | u8 reserved_at_0[0x20]; | 772 | u8 core_dump_general[0x1]; |
| 773 | u8 core_dump_qp[0x1]; | ||
| 774 | u8 reserved_at_2[0x1e]; | ||
| 719 | 775 | ||
| 720 | u8 reserved_at_20[0x2]; | 776 | u8 reserved_at_20[0x2]; |
| 721 | u8 stall_detect[0x1]; | 777 | u8 stall_detect[0x1]; |
| @@ -749,7 +805,8 @@ struct mlx5_ifc_per_protocol_networking_offload_caps_bits { · 27 unmodified lines | |||
| 749 | u8 swp[0x1]; | 805 | u8 swp[0x1]; |
| 750 | u8 swp_csum[0x1]; | 806 | u8 swp_csum[0x1]; |
| 751 | u8 swp_lso[0x1]; | 807 | u8 swp_lso[0x1]; |
| 752 | u8 reserved_at_23[0xd]; | 808 | u8 cqe_checksum_full[0x1]; |
| 809 | u8 reserved_at_24[0xc]; | ||
| 753 | u8 max_vxlan_udp_ports[0x8]; | 810 | u8 max_vxlan_udp_ports[0x8]; |
| 754 | u8 reserved_at_38[0x6]; | 811 | u8 reserved_at_38[0x6]; |
| 755 | u8 max_geneve_opt_len[0x1]; | 812 | u8 max_geneve_opt_len[0x1]; |
| @@ -818,6 +875,12 @@ struct mlx5_ifc_device_mem_cap_bits { · 62 unmodified lines | |||
| 818 | u8 reserved_at_180[0x680]; | 875 | u8 reserved_at_180[0x680]; |
| 819 | }; | 876 | }; |
| 820 | 877 | ||
| 878 | struct mlx5_ifc_device_event_cap_bits { | ||
| 879 | u8 user_affiliated_events[4][0x40]; | ||
| 880 | |||
| 881 | u8 user_unaffiliated_events[4][0x40]; | ||
| 882 | }; | ||
| 883 | |||
| 821 | enum { | 884 | enum { |
| 822 | MLX5_ATOMIC_CAPS_ATOMIC_SIZE_QP_1_BYTE = 0x0, | 885 | MLX5_ATOMIC_CAPS_ATOMIC_SIZE_QP_1_BYTE = 0x0, |
| 823 | MLX5_ATOMIC_CAPS_ATOMIC_SIZE_QP_2_BYTES = 0x2, | 886 | MLX5_ATOMIC_CAPS_ATOMIC_SIZE_QP_2_BYTES = 0x2, |
| @@ -911,6 +974,16 @@ struct mlx5_ifc_vector_calc_cap_bits { · 87 unmodified lines | |||
| 911 | u8 reserved_at_c0[0x720]; | 974 | u8 reserved_at_c0[0x720]; |
| 912 | }; | 975 | }; |
| 913 | 976 | ||
| 977 | struct mlx5_ifc_tls_cap_bits { | ||
| 978 | u8 tls_1_2_aes_gcm_128[0x1]; | ||
| 979 | u8 tls_1_3_aes_gcm_128[0x1]; | ||
| 980 | u8 tls_1_2_aes_gcm_256[0x1]; | ||
| 981 | u8 tls_1_3_aes_gcm_256[0x1]; | ||
| 982 | u8 reserved_at_4[0x1c]; | ||
| 983 | |||
| 984 | u8 reserved_at_20[0x7e0]; | ||
| 985 | }; | ||
| 986 | |||
| 914 | enum { | 987 | enum { |
| 915 | MLX5_WQ_TYPE_LINKED_LIST = 0x0, | 988 | MLX5_WQ_TYPE_LINKED_LIST = 0x0, |
| 916 | MLX5_WQ_TYPE_CYCLIC = 0x1, | 989 | MLX5_WQ_TYPE_CYCLIC = 0x1, |
| @@ -975,7 +1048,8 @@ struct mlx5_ifc_cmd_hca_cap_bits { · 58 unmodified lines | |||
| 975 | 1048 | ||
| 976 | u8 log_max_srq_sz[0x8]; | 1049 | u8 log_max_srq_sz[0x8]; |
| 977 | u8 log_max_qp_sz[0x8]; | 1050 | u8 log_max_qp_sz[0x8]; |
| 978 | u8 reserved_at_90[0x8]; | 1051 | u8 event_cap[0x1]; |
| 1052 | u8 reserved_at_91[0x7]; | ||
| 979 | u8 prio_tag_required[0x1]; | 1053 | u8 prio_tag_required[0x1]; |
| 980 | u8 reserved_at_99[0x2]; | 1054 | u8 reserved_at_99[0x2]; |
| 981 | u8 log_max_qp[0x5]; | 1055 | u8 log_max_qp[0x5]; |
| @@ -1023,7 +1097,9 @@ struct mlx5_ifc_cmd_hca_cap_bits { · 41 unmodified lines | |||
| 1023 | u8 cc_modify_allowed[0x1]; | 1097 | u8 cc_modify_allowed[0x1]; |
| 1024 | u8 start_pad[0x1]; | 1098 | u8 start_pad[0x1]; |
| 1025 | u8 cache_line_128byte[0x1]; | 1099 | u8 cache_line_128byte[0x1]; |
| 1026 | u8 reserved_at_165[0xa]; | 1100 | u8 reserved_at_165[0x4]; |
| 1101 | u8 rts2rts_qp_counters_set_id[0x1]; | ||
| 1102 | u8 reserved_at_16a[0x5]; | ||
| 1027 | u8 qcam_reg[0x1]; | 1103 | u8 qcam_reg[0x1]; |
| 1028 | u8 gid_table_size[0x10]; | 1104 | u8 gid_table_size[0x10]; |
| 1029 | 1105 | ||
| @@ -1240,7 +1316,8 @@ struct mlx5_ifc_cmd_hca_cap_bits { · 210 unmodified lines | |||
| 1240 | 1316 | ||
| 1241 | u8 reserved_at_440[0x20]; | 1317 | u8 reserved_at_440[0x20]; |
| 1242 | 1318 | ||
| 1243 | u8 reserved_at_460[0x3]; | 1319 | u8 tls[0x1]; |
| 1320 | u8 reserved_at_461[0x2]; | ||
| 1244 | u8 log_max_uctx[0x5]; | 1321 | u8 log_max_uctx[0x5]; |
| 1245 | u8 reserved_at_468[0x3]; | 1322 | u8 reserved_at_468[0x3]; |
| 1246 | u8 log_max_umem[0x5]; | 1323 | u8 log_max_umem[0x5]; |
| @@ -1265,7 +1342,9 @@ struct mlx5_ifc_cmd_hca_cap_bits { · 18 unmodified lines | |||
| 1265 | u8 max_geneve_tlv_option_data_len[0x5]; | 1342 | u8 max_geneve_tlv_option_data_len[0x5]; |
| 1266 | u8 reserved_at_570[0x10]; | 1343 | u8 reserved_at_570[0x10]; |
| 1267 | 1344 | ||
| 1268 | u8 reserved_at_580[0x3c]; | 1345 | u8 reserved_at_580[0x33]; |
| 1346 | u8 log_max_dek[0x5]; | ||
| 1347 | u8 reserved_at_5b8[0x4]; | ||
| 1269 | u8 mini_cqe_resp_stride_index[0x1]; | 1348 | u8 mini_cqe_resp_stride_index[0x1]; |
| 1270 | u8 cqe_128_always[0x1]; | 1349 | u8 cqe_128_always[0x1]; |
| 1271 | u8 cqe_compression_128[0x1]; | 1350 | u8 cqe_compression_128[0x1]; |
| @@ -1295,13 +1374,26 @@ struct mlx5_ifc_cmd_hca_cap_bits { · 23 unmodified lines | |||
| 1295 | u8 reserved_at_640[0x10]; | 1374 | u8 reserved_at_640[0x10]; |
| 1296 | u8 num_q_monitor_counters[0x10]; | 1375 | u8 num_q_monitor_counters[0x10]; |
| 1297 | 1376 | ||
| 1298 | u8 reserved_at_660[0x40]; | 1377 | u8 reserved_at_660[0x20]; |
| 1378 | |||
| 1379 | u8 sf[0x1]; | ||
| 1380 | u8 sf_set_partition[0x1]; | ||
| 1381 | u8 reserved_at_682[0x1]; | ||
| 1382 | u8 log_max_sf[0x5]; | ||
| 1383 | u8 reserved_at_688[0x8]; | ||
| 1384 | u8 log_min_sf_size[0x8]; | ||
| 1385 | u8 max_num_sf_partitions[0x8]; | ||
| 1299 | 1386 | ||
| 1300 | u8 uctx_cap[0x20]; | 1387 | u8 uctx_cap[0x20]; |
| 1301 | 1388 | ||
| 1302 | u8 reserved_at_6c0[0x4]; | 1389 | u8 reserved_at_6c0[0x4]; |
| 1303 | u8 flex_parser_id_geneve_tlv_option_0[0x4]; | 1390 | u8 flex_parser_id_geneve_tlv_option_0[0x4]; |
| 1304 | u8 reserved_at_6c8[0x138]; | 1391 | u8 reserved_at_6c8[0x28]; |
| 1392 | u8 sf_base_id[0x10]; | ||
| 1393 | |||
| 1394 | u8 reserved_at_700[0x80]; | ||
| 1395 | u8 vhca_tunnel_commands[0x40]; | ||
| 1396 | u8 reserved_at_7c0[0x40]; | ||
| 1305 | }; | 1397 | }; |
| 1306 | 1398 | ||
| 1307 | enum mlx5_flow_destination_type { | 1399 | enum mlx5_flow_destination_type { |
| @@ -2531,7 +2623,9 @@ union mlx5_ifc_hca_cap_union_bits { · 1223 unmodified lines | |||
| 2531 | struct mlx5_ifc_e_switch_cap_bits e_switch_cap; | 2623 | struct mlx5_ifc_e_switch_cap_bits e_switch_cap; |
| 2532 | struct mlx5_ifc_vector_calc_cap_bits vector_calc_cap; | 2624 | struct mlx5_ifc_vector_calc_cap_bits vector_calc_cap; |
| 2533 | struct mlx5_ifc_qos_cap_bits qos_cap; | 2625 | struct mlx5_ifc_qos_cap_bits qos_cap; |
| 2626 | struct mlx5_ifc_debug_cap_bits debug_cap; | ||
| 2534 | struct mlx5_ifc_fpga_cap_bits fpga_cap; | 2627 | struct mlx5_ifc_fpga_cap_bits fpga_cap; |
| 2628 | struct mlx5_ifc_tls_cap_bits tls_cap; | ||
| 2535 | u8 reserved_at_0[0x8000]; | 2629 | u8 reserved_at_0[0x8000]; |
| 2536 | }; | 2630 | }; |
| 2537 | 2631 | ||
| @@ -2549,6 +2643,12 @@ enum { · 11 unmodified lines | |||
| 2549 | MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH_2 = 0x800, | 2643 | MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH_2 = 0x800, |
| 2550 | }; | 2644 | }; |
| 2551 | 2645 | ||
| 2646 | enum { | ||
| 2647 | MLX5_FLOW_CONTEXT_FLOW_SOURCE_ANY_VPORT = 0x0, | ||
| 2648 | MLX5_FLOW_CONTEXT_FLOW_SOURCE_UPLINK = 0x1, | ||
| 2649 | MLX5_FLOW_CONTEXT_FLOW_SOURCE_LOCAL_VPORT = 0x2, | ||
| 2650 | }; | ||
| 2651 | |||
| 2552 | struct mlx5_ifc_vlan_bits { | 2652 | struct mlx5_ifc_vlan_bits { |
| 2553 | u8 ethtype[0x10]; | 2653 | u8 ethtype[0x10]; |
| 2554 | u8 prio[0x3]; | 2654 | u8 prio[0x3]; |
| @@ -2568,7 +2668,9 @@ struct mlx5_ifc_flow_context_bits { · 13 unmodified lines | |||
| 2568 | u8 action[0x10]; | 2668 | u8 action[0x10]; |
| 2569 | 2669 | ||
| 2570 | u8 extended_destination[0x1]; | 2670 | u8 extended_destination[0x1]; |
| 2571 | u8 reserved_at_80[0x7]; | 2671 | u8 reserved_at_81[0x1]; |
| 2672 | u8 flow_source[0x2]; | ||
| 2673 | u8 reserved_at_84[0x4]; | ||
| 2572 | u8 destination_list_size[0x18]; | 2674 | u8 destination_list_size[0x18]; |
| 2573 | 2675 | ||
| 2574 | u8 reserved_at_a0[0x8]; | 2676 | u8 reserved_at_a0[0x8]; |
| @@ -2663,7 +2765,8 @@ struct mlx5_ifc_traffic_counter_bits { · 88 unmodified lines | |||
| 2663 | 2765 | ||
| 2664 | struct mlx5_ifc_tisc_bits { | 2766 | struct mlx5_ifc_tisc_bits { |
| 2665 | u8 strict_lag_tx_port_affinity[0x1]; | 2767 | u8 strict_lag_tx_port_affinity[0x1]; |
| 2666 | u8 reserved_at_1[0x3]; | 2768 | u8 tls_en[0x1]; |
| 2769 | u8 reserved_at_1[0x2]; | ||
| 2667 | u8 lag_tx_port_affinity[0x04]; | 2770 | u8 lag_tx_port_affinity[0x04]; |
| 2668 | 2771 | ||
| 2669 | u8 reserved_at_8[0x4]; | 2772 | u8 reserved_at_8[0x4]; |
| @@ -2677,7 +2780,11 @@ struct mlx5_ifc_tisc_bits { · 7 unmodified lines | |||
| 2677 | 2780 | ||
| 2678 | u8 reserved_at_140[0x8]; | 2781 | u8 reserved_at_140[0x8]; |
| 2679 | u8 underlay_qpn[0x18]; | 2782 | u8 underlay_qpn[0x18]; |
| 2680 | u8 reserved_at_160[0x3a0]; | 2783 | |
| 2784 | u8 reserved_at_160[0x8]; | ||
| 2785 | u8 pd[0x18]; | ||
| 2786 | |||
| 2787 | u8 reserved_at_180[0x380]; | ||
| 2681 | }; | 2788 | }; |
| 2682 | 2789 | ||
| 2683 | enum { | 2790 | enum { |
| @@ -3093,12 +3200,14 @@ struct mlx5_ifc_hca_vport_context_bits { · 409 unmodified lines | |||
| 3093 | }; | 3200 | }; |
| 3094 | 3201 | ||
| 3095 | struct mlx5_ifc_esw_vport_context_bits { | 3202 | struct mlx5_ifc_esw_vport_context_bits { |
| 3096 | u8 reserved_at_0[0x3]; | 3203 | u8 fdb_to_vport_reg_c[0x1]; |
| 3204 | u8 reserved_at_1[0x2]; | ||
| 3097 | u8 vport_svlan_strip[0x1]; | 3205 | u8 vport_svlan_strip[0x1]; |
| 3098 | u8 vport_cvlan_strip[0x1]; | 3206 | u8 vport_cvlan_strip[0x1]; |
| 3099 | u8 vport_svlan_insert[0x1]; | 3207 | u8 vport_svlan_insert[0x1]; |
| 3100 | u8 vport_cvlan_insert[0x2]; | 3208 | u8 vport_cvlan_insert[0x2]; |
| 3101 | u8 reserved_at_8[0x18]; | 3209 | u8 fdb_to_vport_reg_c_id[0x8]; |
| 3210 | u8 reserved_at_10[0x10]; | ||
| 3102 | 3211 | ||
| 3103 | u8 reserved_at_20[0x20]; | 3212 | u8 reserved_at_20[0x20]; |
| 3104 | 3213 | ||
| @@ -4979,7 +5088,8 @@ struct mlx5_ifc_modify_esw_vport_context_out_bits { · 1874 unmodified lines | |||
| 4979 | }; | 5088 | }; |
| 4980 | 5089 | ||
| 4981 | struct mlx5_ifc_esw_vport_context_fields_select_bits { | 5090 | struct mlx5_ifc_esw_vport_context_fields_select_bits { |
| 4982 | u8 reserved_at_0[0x1c]; | 5091 | u8 reserved_at_0[0x1b]; |
| 5092 | u8 fdb_to_vport_reg_c_id[0x1]; | ||
| 4983 | u8 vport_cvlan_insert[0x1]; | 5093 | u8 vport_cvlan_insert[0x1]; |
| 4984 | u8 vport_svlan_insert[0x1]; | 5094 | u8 vport_svlan_insert[0x1]; |
| 4985 | u8 vport_cvlan_strip[0x1]; | 5095 | u8 vport_cvlan_strip[0x1]; |
| @@ -5176,6 +5286,7 @@ enum { · 190 unmodified lines | |||
| 5176 | MLX5_ACTION_IN_FIELD_OUT_DIPV4 = 0x16, | 5286 | MLX5_ACTION_IN_FIELD_OUT_DIPV4 = 0x16, |
| 5177 | MLX5_ACTION_IN_FIELD_OUT_FIRST_VID = 0x17, | 5287 | MLX5_ACTION_IN_FIELD_OUT_FIRST_VID = 0x17, |
| 5178 | MLX5_ACTION_IN_FIELD_OUT_IPV6_HOPLIMIT = 0x47, | 5288 | MLX5_ACTION_IN_FIELD_OUT_IPV6_HOPLIMIT = 0x47, |
| 5289 | MLX5_ACTION_IN_FIELD_METADATA_REG_C_0 = 0x51, | ||
| 5179 | }; | 5290 | }; |
| 5180 | 5291 | ||
| 5181 | struct mlx5_ifc_alloc_modify_header_context_out_bits { | 5292 | struct mlx5_ifc_alloc_modify_header_context_out_bits { |
| @@ -5864,10 +5975,12 @@ struct mlx5_ifc_modify_cq_in_bits { · 682 unmodified lines | |||
| 5864 | 5975 | ||
| 5865 | struct mlx5_ifc_cqc_bits cq_context; | 5976 | struct mlx5_ifc_cqc_bits cq_context; |
| 5866 | 5977 | ||
| 5867 | u8 reserved_at_280[0x40]; | 5978 | u8 reserved_at_280[0x60]; |
| 5868 | 5979 | ||
| 5869 | u8 cq_umem_valid[0x1]; | 5980 | u8 cq_umem_valid[0x1]; |
| 5870 | u8 reserved_at_2c1[0x5bf]; | 5981 | u8 reserved_at_2e1[0x1f]; |
| 5982 | |||
| 5983 | u8 reserved_at_300[0x580]; | ||
| 5871 | 5984 | ||
| 5872 | u8 pas[0][0x40]; | 5985 | u8 pas[0][0x40]; |
| 5873 | }; | 5986 | }; |
| @@ -7236,7 +7349,8 @@ struct mlx5_ifc_create_flow_table_out_bits { · 1362 unmodified lines | |||
| 7236 | struct mlx5_ifc_flow_table_context_bits { | 7349 | struct mlx5_ifc_flow_table_context_bits { |
| 7237 | u8 reformat_en[0x1]; | 7350 | u8 reformat_en[0x1]; |
| 7238 | u8 decap_en[0x1]; | 7351 | u8 decap_en[0x1]; |
| 7239 | u8 reserved_at_2[0x2]; | 7352 | u8 reserved_at_2[0x1]; |
| 7353 | u8 termination_table[0x1]; | ||
| 7240 | u8 table_miss_action[0x4]; | 7354 | u8 table_miss_action[0x4]; |
| 7241 | u8 level[0x8]; | 7355 | u8 level[0x8]; |
| 7242 | u8 reserved_at_10[0x8]; | 7356 | u8 reserved_at_10[0x8]; |
| @@ -7355,9 +7469,9 @@ struct mlx5_ifc_create_eq_in_bits { · 112 unmodified lines | |||
| 7355 | 7469 | ||
| 7356 | u8 reserved_at_280[0x40]; | 7470 | u8 reserved_at_280[0x40]; |
| 7357 | 7471 | ||
| 7358 | u8 event_bitmask[0x40]; | 7472 | u8 event_bitmask[4][0x40]; |
| 7359 | 7473 | ||
| 7360 | u8 reserved_at_300[0x580]; | 7474 | u8 reserved_at_3c0[0x4c0]; |
| 7361 | 7475 | ||
| 7362 | u8 pas[0][0x40]; | 7476 | u8 pas[0][0x40]; |
| 7363 | }; | 7477 | }; |
| @@ -8475,7 +8589,7 @@ struct mlx5_ifc_mcam_access_reg_bits { · 1111 unmodified lines | |||
| 8475 | u8 mcda[0x1]; | 8589 | u8 mcda[0x1]; |
| 8476 | u8 mcc[0x1]; | 8590 | u8 mcc[0x1]; |
| 8477 | u8 mcqi[0x1]; | 8591 | u8 mcqi[0x1]; |
| 8478 | u8 reserved_at_1f[0x1]; | 8592 | u8 mcqs[0x1]; |
| 8479 | 8593 | ||
| 8480 | u8 regs_95_to_87[0x9]; | 8594 | u8 regs_95_to_87[0x9]; |
| 8481 | u8 mpegc[0x1]; | 8595 | u8 mpegc[0x1]; |
| @@ -8546,6 +8660,18 @@ struct mlx5_ifc_qcam_reg_bits { · 64 unmodified lines | |||
| 8546 | u8 reserved_at_1c0[0x80]; | 8660 | u8 reserved_at_1c0[0x80]; |
| 8547 | }; | 8661 | }; |
| 8548 | 8662 | ||
| 8663 | struct mlx5_ifc_core_dump_reg_bits { | ||
| 8664 | u8 reserved_at_0[0x18]; | ||
| 8665 | u8 core_dump_type[0x8]; | ||
| 8666 | |||
| 8667 | u8 reserved_at_20[0x30]; | ||
| 8668 | u8 vhca_id[0x10]; | ||
| 8669 | |||
| 8670 | u8 reserved_at_60[0x8]; | ||
| 8671 | u8 qpn[0x18]; | ||
| 8672 | u8 reserved_at_80[0x180]; | ||
| 8673 | }; | ||
| 8674 | |||
| 8549 | struct mlx5_ifc_pcap_reg_bits { | 8675 | struct mlx5_ifc_pcap_reg_bits { |
| 8550 | u8 reserved_at_0[0x8]; | 8676 | u8 reserved_at_0[0x8]; |
| 8551 | u8 local_port[0x8]; | 8677 | u8 local_port[0x8]; |
| @@ -8955,6 +9081,24 @@ struct mlx5_ifc_mtppse_reg_bits { · 403 unmodified lines | |||
| 8955 | u8 reserved_at_40[0x40]; | 9081 | u8 reserved_at_40[0x40]; |
| 8956 | }; | 9082 | }; |
| 8957 | 9083 | ||
| 9084 | struct mlx5_ifc_mcqs_reg_bits { | ||
| 9085 | u8 last_index_flag[0x1]; | ||
| 9086 | u8 reserved_at_1[0x7]; | ||
| 9087 | u8 fw_device[0x8]; | ||
| 9088 | u8 component_index[0x10]; | ||
| 9089 | |||
| 9090 | u8 reserved_at_20[0x10]; | ||
| 9091 | u8 identifier[0x10]; | ||
| 9092 | |||
| 9093 | u8 reserved_at_40[0x17]; | ||
| 9094 | u8 component_status[0x5]; | ||
| 9095 | u8 component_update_state[0x4]; | ||
| 9096 | |||
| 9097 | u8 last_update_state_changer_type[0x4]; | ||
| 9098 | u8 last_update_state_changer_host_id[0x4]; | ||
| 9099 | u8 reserved_at_68[0x18]; | ||
| 9100 | }; | ||
| 9101 | |||
| 8958 | struct mlx5_ifc_mcqi_cap_bits { | 9102 | struct mlx5_ifc_mcqi_cap_bits { |
| 8959 | u8 supported_info_bitmask[0x20]; | 9103 | u8 supported_info_bitmask[0x20]; |
| 8960 | 9104 | ||
| @@ -8975,6 +9119,43 @@ struct mlx5_ifc_mcqi_cap_bits { · 14 unmodified lines | |||
| 8975 | u8 reserved_at_86[0x1a]; | 9119 | u8 reserved_at_86[0x1a]; |
| 8976 | }; | 9120 | }; |
| 8977 | 9121 | ||
| 9122 | struct mlx5_ifc_mcqi_version_bits { | ||
| 9123 | u8 reserved_at_0[0x2]; | ||
| 9124 | u8 build_time_valid[0x1]; | ||
| 9125 | u8 user_defined_time_valid[0x1]; | ||
| 9126 | u8 reserved_at_4[0x14]; | ||
| 9127 | u8 version_string_length[0x8]; | ||
| 9128 | |||
| 9129 | u8 version[0x20]; | ||
| 9130 | |||
| 9131 | u8 build_time[0x40]; | ||
| 9132 | |||
| 9133 | u8 user_defined_time[0x40]; | ||
| 9134 | |||
| 9135 | u8 build_tool_version[0x20]; | ||
| 9136 | |||
| 9137 | u8 reserved_at_e0[0x20]; | ||
| 9138 | |||
| 9139 | u8 version_string[92][0x8]; | ||
| 9140 | }; | ||
| 9141 | |||
| 9142 | struct mlx5_ifc_mcqi_activation_method_bits { | ||
| 9143 | u8 pending_server_ac_power_cycle[0x1]; | ||
| 9144 | u8 pending_server_dc_power_cycle[0x1]; | ||
| 9145 | u8 pending_server_reboot[0x1]; | ||
| 9146 | u8 pending_fw_reset[0x1]; | ||
| 9147 | u8 auto_activate[0x1]; | ||
| 9148 | u8 all_hosts_sync[0x1]; | ||
| 9149 | u8 device_hw_reset[0x1]; | ||
| 9150 | u8 reserved_at_7[0x19]; | ||
| 9151 | }; | ||
| 9152 | |||
| 9153 | union mlx5_ifc_mcqi_reg_data_bits { | ||
| 9154 | struct mlx5_ifc_mcqi_cap_bits mcqi_caps; | ||
| 9155 | struct mlx5_ifc_mcqi_version_bits mcqi_version; | ||
| 9156 | struct mlx5_ifc_mcqi_activation_method_bits mcqi_activation_mathod; | ||
| 9157 | }; | ||
| 9158 | |||
| 8978 | struct mlx5_ifc_mcqi_reg_bits { | 9159 | struct mlx5_ifc_mcqi_reg_bits { |
| 8979 | u8 read_pending_component[0x1]; | 9160 | u8 read_pending_component[0x1]; |
| 8980 | u8 reserved_at_1[0xf]; | 9161 | u8 reserved_at_1[0xf]; |
| @@ -8992,7 +9173,7 @@ struct mlx5_ifc_mcqi_reg_bits { · 11 unmodified lines | |||
| 8992 | u8 reserved_at_a0[0x10]; | 9173 | u8 reserved_at_a0[0x10]; |
| 8993 | u8 data_size[0x10]; | 9174 | u8 data_size[0x10]; |
| 8994 | 9175 | ||
| 8995 | u8 data[0][0x20]; | 9176 | union mlx5_ifc_mcqi_reg_data_bits data[0]; |
| 8996 | }; | 9177 | }; |
| 8997 | 9178 | ||
| 8998 | struct mlx5_ifc_mcc_reg_bits { | 9179 | struct mlx5_ifc_mcc_reg_bits { |
| @@ -9518,7 +9699,7 @@ struct mlx5_ifc_general_obj_in_cmd_hdr_bits { · 519 unmodified lines | |||
| 9518 | u8 opcode[0x10]; | 9699 | u8 opcode[0x10]; |
| 9519 | u8 uid[0x10]; | 9700 | u8 uid[0x10]; |
| 9520 | 9701 | ||
| 9521 | u8 reserved_at_20[0x10]; | 9702 | u8 vhca_tunnel_id[0x10]; |
| 9522 | u8 obj_type[0x10]; | 9703 | u8 obj_type[0x10]; |
| 9523 | 9704 | ||
| 9524 | u8 obj_id[0x20]; | 9705 | u8 obj_id[0x20]; |
| @@ -9689,10 +9870,11 @@ struct mlx5_ifc_mtrc_ctrl_bits { · 164 unmodified lines | |||
| 9689 | 9870 | ||
| 9690 | struct mlx5_ifc_host_params_context_bits { | 9871 | struct mlx5_ifc_host_params_context_bits { |
| 9691 | u8 host_number[0x8]; | 9872 | u8 host_number[0x8]; |
| 9692 | u8 reserved_at_8[0x8]; | 9873 | u8 reserved_at_8[0x7]; |
| 9874 | u8 host_pf_disabled[0x1]; | ||
| 9693 | u8 host_num_of_vfs[0x10]; | 9875 | u8 host_num_of_vfs[0x10]; |
| 9694 | 9876 | ||
| 9695 | u8 reserved_at_20[0x10]; | 9877 | u8 host_total_vfs[0x10]; |
| 9696 | u8 host_pci_bus[0x10]; | 9878 | u8 host_pci_bus[0x10]; |
| 9697 | 9879 | ||
| 9698 | u8 reserved_at_40[0x10]; | 9880 | u8 reserved_at_40[0x10]; |
| @@ -9704,7 +9886,7 @@ struct mlx5_ifc_host_params_context_bits { · 5 unmodified lines | |||
| 9704 | u8 reserved_at_80[0x180]; | 9886 | u8 reserved_at_80[0x180]; |
| 9705 | }; | 9887 | }; |
| 9706 | 9888 | ||
| 9707 | struct mlx5_ifc_query_host_params_in_bits { | 9889 | struct mlx5_ifc_query_esw_functions_in_bits { |
| 9708 | u8 opcode[0x10]; | 9890 | u8 opcode[0x10]; |
| 9709 | u8 reserved_at_10[0x10]; | 9891 | u8 reserved_at_10[0x10]; |
| 9710 | 9892 | ||
| @@ -9714,7 +9896,7 @@ struct mlx5_ifc_query_host_params_in_bits { · 3 unmodified lines | |||
| 9714 | u8 reserved_at_40[0x40]; | 9896 | u8 reserved_at_40[0x40]; |
| 9715 | }; | 9897 | }; |
| 9716 | 9898 | ||
| 9717 | struct mlx5_ifc_query_host_params_out_bits { | 9899 | struct mlx5_ifc_query_esw_functions_out_bits { |
| 9718 | u8 status[0x8]; | 9900 | u8 status[0x8]; |
| 9719 | u8 reserved_at_8[0x18]; | 9901 | u8 reserved_at_8[0x18]; |
| 9720 | 9902 | ||
| @@ -9725,6 +9907,165 @@ struct mlx5_ifc_query_host_params_out_bits { · 4 unmodified lines | |||
| 9725 | struct mlx5_ifc_host_params_context_bits host_params_context; | 9907 | struct mlx5_ifc_host_params_context_bits host_params_context; |
| 9726 | 9908 | ||
| 9727 | u8 reserved_at_280[0x180]; | 9909 | u8 reserved_at_280[0x180]; |
| 9910 | u8 host_sf_enable[0][0x40]; | ||
| 9911 | }; | ||
| 9912 | |||
| 9913 | struct mlx5_ifc_sf_partition_bits { | ||
| 9914 | u8 reserved_at_0[0x10]; | ||
| 9915 | u8 log_num_sf[0x8]; | ||
| 9916 | u8 log_sf_bar_size[0x8]; | ||
| 9917 | }; | ||
| 9918 | |||
| 9919 | struct mlx5_ifc_query_sf_partitions_out_bits { | ||
| 9920 | u8 status[0x8]; | ||
| 9921 | u8 reserved_at_8[0x18]; | ||
| 9922 | |||
| 9923 | u8 syndrome[0x20]; | ||
| 9924 | |||
| 9925 | u8 reserved_at_40[0x18]; | ||
| 9926 | u8 num_sf_partitions[0x8]; | ||
| 9927 | |||
| 9928 | u8 reserved_at_60[0x20]; | ||
| 9929 | |||
| 9930 | struct mlx5_ifc_sf_partition_bits sf_partition[0]; | ||
| 9931 | }; | ||
| 9932 | |||
| 9933 | struct mlx5_ifc_query_sf_partitions_in_bits { | ||
| 9934 | u8 opcode[0x10]; | ||
| 9935 | u8 reserved_at_10[0x10]; | ||
| 9936 | |||
| 9937 | u8 reserved_at_20[0x10]; | ||
| 9938 | u8 op_mod[0x10]; | ||
| 9939 | |||
| 9940 | u8 reserved_at_40[0x40]; | ||
| 9941 | }; | ||
| 9942 | |||
| 9943 | struct mlx5_ifc_dealloc_sf_out_bits { | ||
| 9944 | u8 status[0x8]; | ||
| 9945 | u8 reserved_at_8[0x18]; | ||
| 9946 | |||
| 9947 | u8 syndrome[0x20]; | ||
| 9948 | |||
| 9949 | u8 reserved_at_40[0x40]; | ||
| 9950 | }; | ||
| 9951 | |||
| 9952 | struct mlx5_ifc_dealloc_sf_in_bits { | ||
| 9953 | u8 opcode[0x10]; | ||
| 9954 | u8 reserved_at_10[0x10]; | ||
| 9955 | |||
| 9956 | u8 reserved_at_20[0x10]; | ||
| 9957 | u8 op_mod[0x10]; | ||
| 9958 | |||
| 9959 | u8 reserved_at_40[0x10]; | ||
| 9960 | u8 function_id[0x10]; | ||
| 9961 | |||
| 9962 | u8 reserved_at_60[0x20]; | ||
| 9963 | }; | ||
| 9964 | |||
| 9965 | struct mlx5_ifc_alloc_sf_out_bits { | ||
| 9966 | u8 status[0x8]; | ||
| 9967 | u8 reserved_at_8[0x18]; | ||
| 9968 | |||
| 9969 | u8 syndrome[0x20]; | ||
| 9970 | |||
| 9971 | u8 reserved_at_40[0x40]; | ||
| 9972 | }; | ||
| 9973 | |||
| 9974 | struct mlx5_ifc_alloc_sf_in_bits { | ||
| 9975 | u8 opcode[0x10]; | ||
| 9976 | u8 reserved_at_10[0x10]; | ||
| 9977 | |||
| 9978 | u8 reserved_at_20[0x10]; | ||
| 9979 | u8 op_mod[0x10]; | ||
| 9980 | |||
| 9981 | u8 reserved_at_40[0x10]; | ||
| 9982 | u8 function_id[0x10]; | ||
| 9983 | |||
| 9984 | u8 reserved_at_60[0x20]; | ||
| 9985 | }; | ||
| 9986 | |||
| 9987 | struct mlx5_ifc_affiliated_event_header_bits { | ||
| 9988 | u8 reserved_at_0[0x10]; | ||
| 9989 | u8 obj_type[0x10]; | ||
| 9990 | |||
| 9991 | u8 obj_id[0x20]; | ||
| 9992 | }; | ||
| 9993 | |||
| 9994 | enum { | ||
| 9995 | MLX5_HCA_CAP_GENERAL_OBJECT_TYPES_ENCRYPTION_KEY = BIT(0xc), | ||
| 9996 | }; | ||
| 9997 | |||
| 9998 | enum { | ||
| 9999 | MLX5_GENERAL_OBJECT_TYPES_ENCRYPTION_KEY = 0xc, | ||
| 10000 | }; | ||
| 10001 | |||
| 10002 | struct mlx5_ifc_encryption_key_obj_bits { | ||
| 10003 | u8 modify_field_select[0x40]; | ||
| 10004 | |||
| 10005 | u8 reserved_at_40[0x14]; | ||
| 10006 | u8 key_size[0x4]; | ||
| 10007 | u8 reserved_at_58[0x4]; | ||
| 10008 | u8 key_type[0x4]; | ||
| 10009 | |||
| 10010 | u8 reserved_at_60[0x8]; | ||
| 10011 | u8 pd[0x18]; | ||
| 10012 | |||
| 10013 | u8 reserved_at_80[0x180]; | ||
| 10014 | u8 key[8][0x20]; | ||
| 10015 | |||
| 10016 | u8 reserved_at_300[0x500]; | ||
| 10017 | }; | ||
| 10018 | |||
| 10019 | struct mlx5_ifc_create_encryption_key_in_bits { | ||
| 10020 | struct mlx5_ifc_general_obj_in_cmd_hdr_bits general_obj_in_cmd_hdr; | ||
| 10021 | struct mlx5_ifc_encryption_key_obj_bits encryption_key_object; | ||
| 10022 | }; | ||
| 10023 | |||
| 10024 | enum { | ||
| 10025 | MLX5_GENERAL_OBJECT_TYPE_ENCRYPTION_KEY_KEY_SIZE_128 = 0x0, | ||
| 10026 | MLX5_GENERAL_OBJECT_TYPE_ENCRYPTION_KEY_KEY_SIZE_256 = 0x1, | ||
| 10027 | }; | ||
| 10028 | |||
| 10029 | enum { | ||
| 10030 | MLX5_GENERAL_OBJECT_TYPE_ENCRYPTION_KEY_TYPE_DEK = 0x1, | ||
| 10031 | }; | ||
| 10032 | |||
| 10033 | struct mlx5_ifc_tls_static_params_bits { | ||
| 10034 | u8 const_2[0x2]; | ||
| 10035 | u8 tls_version[0x4]; | ||
| 10036 | u8 const_1[0x2]; | ||
| 10037 | u8 reserved_at_8[0x14]; | ||
| 10038 | u8 encryption_standard[0x4]; | ||
| 10039 | |||
| 10040 | u8 reserved_at_20[0x20]; | ||
| 10041 | |||
| 10042 | u8 initial_record_number[0x40]; | ||
| 10043 | |||
| 10044 | u8 resync_tcp_sn[0x20]; | ||
| 10045 | |||
| 10046 | u8 gcm_iv[0x20]; | ||
| 10047 | |||
| 10048 | u8 implicit_iv[0x40]; | ||
| 10049 | |||
| 10050 | u8 reserved_at_100[0x8]; | ||
| 10051 | u8 dek_index[0x18]; | ||
| 10052 | |||
| 10053 | u8 reserved_at_120[0xe0]; | ||
| 10054 | }; | ||
| 10055 | |||
| 10056 | struct mlx5_ifc_tls_progress_params_bits { | ||
| 10057 | u8 valid[0x1]; | ||
| 10058 | u8 reserved_at_1[0x7]; | ||
| 10059 | u8 pd[0x18]; | ||
| 10060 | |||
| 10061 | u8 next_record_tcp_sn[0x20]; | ||
| 10062 | |||
| 10063 | u8 hw_resync_tcp_sn[0x20]; | ||
| 10064 | |||
| 10065 | u8 record_tracker_state[0x2]; | ||
| 10066 | u8 auth_state[0x2]; | ||
| 10067 | u8 reserved_at_64[0x4]; | ||
| 10068 | u8 hw_offset_record_number[0x18]; | ||
| 9728 | }; | 10069 | }; |
| 9729 | 10070 | ||
| 9730 | #endif /* MLX5_IFC_H */ | 10071 | #endif /* MLX5_IFC_H */ |
| @@ -37,7 +37,8 @@ · 36 unmodified lines | |||
| 37 | #include <linux/mlx5/driver.h> | 37 | #include <linux/mlx5/driver.h> |
| 38 | 38 | ||
| 39 | #define MLX5_INVALID_LKEY 0x100 | 39 | #define MLX5_INVALID_LKEY 0x100 |
| 40 | #define MLX5_SIG_WQE_SIZE (MLX5_SEND_WQE_BB * 5) | 40 | /* UMR (3 WQE_BB's) + SIG (3 WQE_BB's) + PSV (mem) + PSV (wire) */ |
| 41 | #define MLX5_SIG_WQE_SIZE (MLX5_SEND_WQE_BB * 8) | ||
| 41 | #define MLX5_DIF_SIZE 8 | 42 | #define MLX5_DIF_SIZE 8 |
| 42 | #define MLX5_STRIDE_BLOCK_OP 0x400 | 43 | #define MLX5_STRIDE_BLOCK_OP 0x400 |
| 43 | #define MLX5_CPY_GRD_MASK 0xc0 | 44 | #define MLX5_CPY_GRD_MASK 0xc0 |
| @@ -70,6 +71,7 @@ enum mlx5_qp_optpar { · 26 unmodified lines | |||
| 70 | MLX5_QP_OPTPAR_CQN_RCV = 1 << 19, | 71 | MLX5_QP_OPTPAR_CQN_RCV = 1 << 19, |
| 71 | MLX5_QP_OPTPAR_DC_HS = 1 << 20, | 72 | MLX5_QP_OPTPAR_DC_HS = 1 << 20, |
| 72 | MLX5_QP_OPTPAR_DC_KEY = 1 << 21, | 73 | MLX5_QP_OPTPAR_DC_KEY = 1 << 21, |
| 74 | MLX5_QP_OPTPAR_COUNTER_SET_ID = 1 << 25, | ||
| 73 | }; | 75 | }; |
| 74 | 76 | ||
| 75 | enum mlx5_qp_state { | 77 | enum mlx5_qp_state { |
| @@ -202,7 +204,12 @@ struct mlx5_wqe_ctrl_seg { · 126 unmodified lines | |||
| 202 | u8 signature; | 204 | u8 signature; |
| 203 | u8 rsvd[2]; | 205 | u8 rsvd[2]; |
| 204 | u8 fm_ce_se; | 206 | u8 fm_ce_se; |
| 205 | __be32 imm; | 207 | union { |
| 208 | __be32 general_id; | ||
| 209 | __be32 imm; | ||
| 210 | __be32 umr_mkey; | ||
| 211 | __be32 tisn; | ||
| 212 | }; | ||
| 206 | }; | 213 | }; |
| 207 | 214 | ||
| 208 | #define MLX5_WQE_CTRL_DS_MASK 0x3f | 215 | #define MLX5_WQE_CTRL_DS_MASK 0x3f |
| @@ -551,11 +558,6 @@ static inline struct mlx5_core_qp *__mlx5_qp_lookup(struct mlx5_core_dev *dev, u · 342 unmodified lines | |||
| 551 | return radix_tree_lookup(&dev->priv.qp_table.tree, qpn); | 558 | return radix_tree_lookup(&dev->priv.qp_table.tree, qpn); |
| 552 | } | 559 | } |
| 553 | 560 | ||
| 554 | static inline struct mlx5_core_mkey *__mlx5_mr_lookup(struct mlx5_core_dev *dev, u32 key) | ||
| 555 | { | ||
| 556 | return radix_tree_lookup(&dev->priv.mkey_table.tree, key); | ||
| 557 | } | ||
| 558 | |||
| 559 | int mlx5_core_create_dct(struct mlx5_core_dev *dev, | 561 | int mlx5_core_create_dct(struct mlx5_core_dev *dev, |
| 560 | struct mlx5_core_dct *qp, | 562 | struct mlx5_core_dct *qp, |
| 561 | u32 *in, int inlen, | 563 | u32 *in, int inlen, |
| @@ -44,9 +44,6 @@ · 43 unmodified lines | |||
| 44 | MLX5_VPORT_UPLINK_PLACEHOLDER + \ | 44 | MLX5_VPORT_UPLINK_PLACEHOLDER + \ |
| 45 | MLX5_VPORT_ECPF_PLACEHOLDER(mdev)) | 45 | MLX5_VPORT_ECPF_PLACEHOLDER(mdev)) |
| 46 | 46 | ||
| 47 | #define MLX5_TOTAL_VPORTS(mdev) (MLX5_SPECIAL_VPORTS(mdev) + \ | ||
| 48 | mlx5_core_max_vfs(mdev)) | ||
| 49 | |||
| 50 | #define MLX5_VPORT_MANAGER(mdev) \ | 47 | #define MLX5_VPORT_MANAGER(mdev) \ |
| 51 | (MLX5_CAP_GEN(mdev, vport_group_manager) && \ | 48 | (MLX5_CAP_GEN(mdev, vport_group_manager) && \ |
| 52 | (MLX5_CAP_GEN(mdev, port_type) == MLX5_CAP_PORT_TYPE_ETH) && \ | 49 | (MLX5_CAP_GEN(mdev, port_type) == MLX5_CAP_PORT_TYPE_ETH) && \ |
| @@ -58,6 +55,7 @@ enum { · 5 unmodified lines | |||
| 58 | MLX5_CAP_INLINE_MODE_NOT_REQUIRED, | 55 | MLX5_CAP_INLINE_MODE_NOT_REQUIRED, |
| 59 | }; | 56 | }; |
| 60 | 57 | ||
| 58 | /* Vport number for each function must keep unchanged */ | ||
| 61 | enum { | 59 | enum { |
| 62 | MLX5_VPORT_PF = 0x0, | 60 | MLX5_VPORT_PF = 0x0, |
| 63 | MLX5_VPORT_FIRST_VF = 0x1, | 61 | MLX5_VPORT_FIRST_VF = 0x1, |
| @@ -69,7 +67,8 @@ u8 mlx5_query_vport_state(struct mlx5_core_dev *mdev, u8 opmod, u16 vport); · 5 unmodified lines | |||
| 69 | int mlx5_modify_vport_admin_state(struct mlx5_core_dev *mdev, u8 opmod, | 67 | int mlx5_modify_vport_admin_state(struct mlx5_core_dev *mdev, u8 opmod, |
| 70 | u16 vport, u8 other_vport, u8 state); | 68 | u16 vport, u8 other_vport, u8 state); |
| 71 | int mlx5_query_nic_vport_mac_address(struct mlx5_core_dev *mdev, | 69 | int mlx5_query_nic_vport_mac_address(struct mlx5_core_dev *mdev, |
| 72 | u16 vport, u8 *addr); | 70 | u16 vport, bool other, u8 *addr); |
| 71 | int mlx5_query_mac_address(struct mlx5_core_dev *mdev, u8 *addr); | ||
| 73 | int mlx5_query_nic_vport_min_inline(struct mlx5_core_dev *mdev, | 72 | int mlx5_query_nic_vport_min_inline(struct mlx5_core_dev *mdev, |
| 74 | u16 vport, u8 *min_inline); | 73 | u16 vport, u8 *min_inline); |
| 75 | void mlx5_query_min_inline(struct mlx5_core_dev *mdev, u8 *min_inline); | 74 | void mlx5_query_min_inline(struct mlx5_core_dev *mdev, u8 *min_inline); |
| @@ -541,13 +541,30 @@ static inline void vma_set_anonymous(struct vm_area_struct *vma) · 540 unmodified lines | |||
| 541 | vma->vm_ops = NULL; | 541 | vma->vm_ops = NULL; |
| 542 | } | 542 | } |
| 543 | 543 | ||
| 544 | static inline bool vma_is_anonymous(struct vm_area_struct *vma) | ||
| 545 | { | ||
| 546 | return !vma->vm_ops; | ||
| 547 | } | ||
| 548 | |||
| 549 | #ifdef CONFIG_SHMEM | ||
| 550 | /* | ||
| 551 | * The vma_is_shmem is not inline because it is used only by slow | ||
| 552 | * paths in userfault. | ||
| 553 | */ | ||
| 554 | bool vma_is_shmem(struct vm_area_struct *vma); | ||
| 555 | #else | ||
| 556 | static inline bool vma_is_shmem(struct vm_area_struct *vma) { return false; } | ||
| 557 | #endif | ||
| 558 | |||
| 559 | int vma_is_stack_for_current(struct vm_area_struct *vma); | ||
| 560 | |||
| 544 | /* flush_tlb_range() takes a vma, not a mm, and can care about flags */ | 561 | /* flush_tlb_range() takes a vma, not a mm, and can care about flags */ |
| 545 | #define TLB_FLUSH_VMA(mm,flags) { .vm_mm = (mm), .vm_flags = (flags) } | 562 | #define TLB_FLUSH_VMA(mm,flags) { .vm_mm = (mm), .vm_flags = (flags) } |
| 546 | 563 | ||
| 547 | struct mmu_gather; | 564 | struct mmu_gather; |
| 548 | struct inode; | 565 | struct inode; |
| 549 | 566 | ||
| 550 | #if !defined(__HAVE_ARCH_PTE_DEVMAP) || !defined(CONFIG_TRANSPARENT_HUGEPAGE) | 567 | #if !defined(CONFIG_ARCH_HAS_PTE_DEVMAP) || !defined(CONFIG_TRANSPARENT_HUGEPAGE) |
| 551 | static inline int pmd_devmap(pmd_t pmd) | 568 | static inline int pmd_devmap(pmd_t pmd) |
| 552 | { | 569 | { |
| 553 | return 0; | 570 | return 0; |
| @@ -633,6 +650,11 @@ static inline bool is_vmalloc_addr(const void *x) · 79 unmodified lines | |||
| 633 | return false; | 650 | return false; |
| 634 | #endif | 651 | #endif |
| 635 | } | 652 | } |
| 653 | |||
| 654 | #ifndef is_ioremap_addr | ||
| 655 | #define is_ioremap_addr(x) is_vmalloc_addr(x) | ||
| 656 | #endif | ||
| 657 | |||
| 636 | #ifdef CONFIG_MMU | 658 | #ifdef CONFIG_MMU |
| 637 | extern int is_vmalloc_or_module_addr(const void *x); | 659 | extern int is_vmalloc_or_module_addr(const void *x); |
| 638 | #else | 660 | #else |
| @@ -932,8 +954,6 @@ static inline bool is_zone_device_page(const struct page *page) · 293 unmodified lines | |||
| 932 | #endif | 954 | #endif |
| 933 | 955 | ||
| 934 | #ifdef CONFIG_DEV_PAGEMAP_OPS | 956 | #ifdef CONFIG_DEV_PAGEMAP_OPS |
| 935 | void dev_pagemap_get_ops(void); | ||
| 936 | void dev_pagemap_put_ops(void); | ||
| 937 | void __put_devmap_managed_page(struct page *page); | 957 | void __put_devmap_managed_page(struct page *page); |
| 938 | DECLARE_STATIC_KEY_FALSE(devmap_managed_key); | 958 | DECLARE_STATIC_KEY_FALSE(devmap_managed_key); |
| 939 | static inline bool put_devmap_managed_page(struct page *page) | 959 | static inline bool put_devmap_managed_page(struct page *page) |
| @@ -944,7 +964,6 @@ static inline bool put_devmap_managed_page(struct page *page) · 4 unmodified lines | |||
| 944 | return false; | 964 | return false; |
| 945 | switch (page->pgmap->type) { | 965 | switch (page->pgmap->type) { |
| 946 | case MEMORY_DEVICE_PRIVATE: | 966 | case MEMORY_DEVICE_PRIVATE: |
| 947 | case MEMORY_DEVICE_PUBLIC: | ||
| 948 | case MEMORY_DEVICE_FS_DAX: | 967 | case MEMORY_DEVICE_FS_DAX: |
| 949 | __put_devmap_managed_page(page); | 968 | __put_devmap_managed_page(page); |
| 950 | return true; | 969 | return true; |
| @@ -954,60 +973,28 @@ static inline bool put_devmap_managed_page(struct page *page) · 3 unmodified lines | |||
| 954 | return false; | 973 | return false; |
| 955 | } | 974 | } |
| 956 | 975 | ||
| 957 | static inline bool is_device_private_page(const struct page *page) | ||
| 958 | { | ||
| 959 | return is_zone_device_page(page) && | ||
| 960 | page->pgmap->type == MEMORY_DEVICE_PRIVATE; | ||
| 961 | } | ||
| 962 | |||
| 963 | static inline bool is_device_public_page(const struct page *page) | ||
| 964 | { | ||
| 965 | return is_zone_device_page(page) && | ||
| 966 | page->pgmap->type == MEMORY_DEVICE_PUBLIC; | ||
| 967 | } | ||
| 968 | |||
| 969 | #ifdef CONFIG_PCI_P2PDMA | ||
| 970 | static inline bool is_pci_p2pdma_page(const struct page *page) | ||
| 971 | { | ||
| 972 | return is_zone_device_page(page) && | ||
| 973 | page->pgmap->type == MEMORY_DEVICE_PCI_P2PDMA; | ||
| 974 | } | ||
| 975 | #else /* CONFIG_PCI_P2PDMA */ | ||
| 976 | static inline bool is_pci_p2pdma_page(const struct page *page) | ||
| 977 | { | ||
| 978 | return false; | ||
| 979 | } | ||
| 980 | #endif /* CONFIG_PCI_P2PDMA */ | ||
| 981 | |||
| 982 | #else /* CONFIG_DEV_PAGEMAP_OPS */ | 976 | #else /* CONFIG_DEV_PAGEMAP_OPS */ |
| 983 | static inline void dev_pagemap_get_ops(void) | ||
| 984 | { | ||
| 985 | } | ||
| 986 | |||
| 987 | static inline void dev_pagemap_put_ops(void) | ||
| 988 | { | ||
| 989 | } | ||
| 990 | |||
| 991 | static inline bool put_devmap_managed_page(struct page *page) | 977 | static inline bool put_devmap_managed_page(struct page *page) |
| 992 | { | 978 | { |
| 993 | return false; | 979 | return false; |
| 994 | } | 980 | } |
| 981 | #endif /* CONFIG_DEV_PAGEMAP_OPS */ | ||
| 995 | 982 | ||
| 996 | static inline bool is_device_private_page(const struct page *page) | 983 | static inline bool is_device_private_page(const struct page *page) |
| 997 | { | 984 | { |
| 998 | return false; | 985 | return IS_ENABLED(CONFIG_DEV_PAGEMAP_OPS) && |
| 999 | } | 986 | IS_ENABLED(CONFIG_DEVICE_PRIVATE) && |
| 1000 | 987 | is_zone_device_page(page) && | |
| 1001 | static inline bool is_device_public_page(const struct page *page) | 988 | page->pgmap->type == MEMORY_DEVICE_PRIVATE; |
| 1002 | { | ||
| 1003 | return false; | ||
| 1004 | } | 989 | } |
| 1005 | 990 | ||
| 1006 | static inline bool is_pci_p2pdma_page(const struct page *page) | 991 | static inline bool is_pci_p2pdma_page(const struct page *page) |
| 1007 | { | 992 | { |
| 1008 | return false; | 993 | return IS_ENABLED(CONFIG_DEV_PAGEMAP_OPS) && |
| 994 | IS_ENABLED(CONFIG_PCI_P2PDMA) && | ||
| 995 | is_zone_device_page(page) && | ||
| 996 | page->pgmap->type == MEMORY_DEVICE_PCI_P2PDMA; | ||
| 1009 | } | 997 | } |
| 1010 | #endif /* CONFIG_DEV_PAGEMAP_OPS */ | ||
| 1011 | 998 | ||
| 1012 | /* 127: arbitrary random number, small enough to assemble well */ | 999 | /* 127: arbitrary random number, small enough to assemble well */ |
| 1013 | #define page_ref_zero_or_close_to_overflow(page) \ | 1000 | #define page_ref_zero_or_close_to_overflow(page) \ |
| @@ -1431,10 +1418,8 @@ struct zap_details { · 417 unmodified lines | |||
| 1431 | pgoff_t last_index; /* Highest page->index to unmap */ | 1418 | pgoff_t last_index; /* Highest page->index to unmap */ |
| 1432 | }; | 1419 | }; |
| 1433 | 1420 | ||
| 1434 | struct page *_vm_normal_page(struct vm_area_struct *vma, unsigned long addr, | 1421 | struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr, |
| 1435 | pte_t pte, bool with_public_device); | 1422 | pte_t pte); |
| 1436 | #define vm_normal_page(vma, addr, pte) _vm_normal_page(vma, addr, pte, false) | ||
| 1437 | |||
| 1438 | struct page *vm_normal_page_pmd(struct vm_area_struct *vma, unsigned long addr, | 1423 | struct page *vm_normal_page_pmd(struct vm_area_struct *vma, unsigned long addr, |
| 1439 | pmd_t pmd); | 1424 | pmd_t pmd); |
| 1440 | 1425 | ||
| @@ -1575,6 +1560,10 @@ long get_user_pages_unlocked(unsigned long start, unsigned long nr_pages, · 134 unmodified lines | |||
| 1575 | int get_user_pages_fast(unsigned long start, int nr_pages, | 1560 | int get_user_pages_fast(unsigned long start, int nr_pages, |
| 1576 | unsigned int gup_flags, struct page **pages); | 1561 | unsigned int gup_flags, struct page **pages); |
| 1577 | 1562 | ||
| 1563 | int account_locked_vm(struct mm_struct *mm, unsigned long pages, bool inc); | ||
| 1564 | int __account_locked_vm(struct mm_struct *mm, unsigned long pages, bool inc, | ||
| 1565 | struct task_struct *task, bool bypass_rlim); | ||
| 1566 | |||
| 1578 | /* Container for pinned pfns / pages */ | 1567 | /* Container for pinned pfns / pages */ |
| 1579 | struct frame_vector { | 1568 | struct frame_vector { |
| 1580 | unsigned int nr_allocated; /* Number of frames we have space for */ | 1569 | unsigned int nr_allocated; /* Number of frames we have space for */ |
| @@ -1648,23 +1637,6 @@ int clear_page_dirty_for_io(struct page *page); · 67 unmodified lines | |||
| 1648 | 1637 | ||
| 1649 | int get_cmdline(struct task_struct *task, char *buffer, int buflen); | 1638 | int get_cmdline(struct task_struct *task, char *buffer, int buflen); |
| 1650 | 1639 | ||
| 1651 | static inline bool vma_is_anonymous(struct vm_area_struct *vma) | ||
| 1652 | { | ||
| 1653 | return !vma->vm_ops; | ||
| 1654 | } | ||
| 1655 | |||
| 1656 | #ifdef CONFIG_SHMEM | ||
| 1657 | /* | ||
| 1658 | * The vma_is_shmem is not inline because it is used only by slow | ||
| 1659 | * paths in userfault. | ||
| 1660 | */ | ||
| 1661 | bool vma_is_shmem(struct vm_area_struct *vma); | ||
| 1662 | #else | ||
| 1663 | static inline bool vma_is_shmem(struct vm_area_struct *vma) { return false; } | ||
| 1664 | #endif | ||
| 1665 | |||
| 1666 | int vma_is_stack_for_current(struct vm_area_struct *vma); | ||
| 1667 | |||
| 1668 | extern unsigned long move_page_tables(struct vm_area_struct *vma, | 1640 | extern unsigned long move_page_tables(struct vm_area_struct *vma, |
| 1669 | unsigned long old_addr, struct vm_area_struct *new_vma, | 1641 | unsigned long old_addr, struct vm_area_struct *new_vma, |
| 1670 | unsigned long new_addr, unsigned long len, | 1642 | unsigned long new_addr, unsigned long len, |
| @@ -1782,7 +1754,7 @@ static inline void sync_mm_rss(struct mm_struct *mm) · 111 unmodified lines | |||
| 1782 | } | 1754 | } |
| 1783 | #endif | 1755 | #endif |
| 1784 | 1756 | ||
| 1785 | #ifndef __HAVE_ARCH_PTE_DEVMAP | 1757 | #ifndef CONFIG_ARCH_HAS_PTE_DEVMAP |
| 1786 | static inline int pte_devmap(pte_t pte) | 1758 | static inline int pte_devmap(pte_t pte) |
| 1787 | { | 1759 | { |
| 1788 | return 0; | 1760 | return 0; |
| @@ -2681,8 +2653,7 @@ static inline int vm_fault_to_errno(vm_fault_t vm_fault, int foll_flags) · 892 unmodified lines | |||
| 2681 | return 0; | 2653 | return 0; |
| 2682 | } | 2654 | } |
| 2683 | 2655 | ||
| 2684 | typedef int (*pte_fn_t)(pte_t *pte, pgtable_t token, unsigned long addr, | 2656 | typedef int (*pte_fn_t)(pte_t *pte, unsigned long addr, void *data); |
| 2685 | void *data); | ||
| 2686 | extern int apply_to_page_range(struct mm_struct *mm, unsigned long address, | 2657 | extern int apply_to_page_range(struct mm_struct *mm, unsigned long address, |
| 2687 | unsigned long size, pte_fn_t fn, void *data); | 2658 | unsigned long size, pte_fn_t fn, void *data); |
| 2688 | 2659 | ||
| @@ -2696,11 +2667,42 @@ static inline void kernel_poison_pages(struct page *page, int numpages, · 7 unmodified lines | |||
| 2696 | int enable) { } | 2667 | int enable) { } |
| 2697 | #endif | 2668 | #endif |
| 2698 | 2669 | ||
| 2699 | extern bool _debug_pagealloc_enabled; | 2670 | #ifdef CONFIG_INIT_ON_ALLOC_DEFAULT_ON |
| 2671 | DECLARE_STATIC_KEY_TRUE(init_on_alloc); | ||
| 2672 | #else | ||
| 2673 | DECLARE_STATIC_KEY_FALSE(init_on_alloc); | ||
| 2674 | #endif | ||
| 2675 | static inline bool want_init_on_alloc(gfp_t flags) | ||
| 2676 | { | ||
| 2677 | if (static_branch_unlikely(&init_on_alloc) && | ||
| 2678 | !page_poisoning_enabled()) | ||
| 2679 | return true; | ||
| 2680 | return flags & __GFP_ZERO; | ||
| 2681 | } | ||
| 2682 | |||
| 2683 | #ifdef CONFIG_INIT_ON_FREE_DEFAULT_ON | ||
| 2684 | DECLARE_STATIC_KEY_TRUE(init_on_free); | ||
| 2685 | #else | ||
| 2686 | DECLARE_STATIC_KEY_FALSE(init_on_free); | ||
| 2687 | #endif | ||
| 2688 | static inline bool want_init_on_free(void) | ||
| 2689 | { | ||
| 2690 | return static_branch_unlikely(&init_on_free) && | ||
| 2691 | !page_poisoning_enabled(); | ||
| 2692 | } | ||
| 2693 | |||
| 2694 | #ifdef CONFIG_DEBUG_PAGEALLOC_ENABLE_DEFAULT | ||
| 2695 | DECLARE_STATIC_KEY_TRUE(_debug_pagealloc_enabled); | ||
| 2696 | #else | ||
| 2697 | DECLARE_STATIC_KEY_FALSE(_debug_pagealloc_enabled); | ||
| 2698 | #endif | ||
| 2700 | 2699 | ||
| 2701 | static inline bool debug_pagealloc_enabled(void) | 2700 | static inline bool debug_pagealloc_enabled(void) |
| 2702 | { | 2701 | { |
| 2703 | return IS_ENABLED(CONFIG_DEBUG_PAGEALLOC) && _debug_pagealloc_enabled; | 2702 | if (!IS_ENABLED(CONFIG_DEBUG_PAGEALLOC)) |
| 2703 | return false; | ||
| 2704 | |||
| 2705 | return static_branch_unlikely(&_debug_pagealloc_enabled); | ||
| 2704 | } | 2706 | } |
| 2705 | 2707 | ||
| 2706 | #if defined(CONFIG_DEBUG_PAGEALLOC) || defined(CONFIG_ARCH_HAS_SET_DIRECT_MAP) | 2708 | #if defined(CONFIG_DEBUG_PAGEALLOC) || defined(CONFIG_ARCH_HAS_SET_DIRECT_MAP) |
| @@ -2756,11 +2758,17 @@ extern int randomize_va_space; · 49 unmodified lines | |||
| 2756 | #endif | 2758 | #endif |
| 2757 | 2759 | ||
| 2758 | const char * arch_vma_name(struct vm_area_struct *vma); | 2760 | const char * arch_vma_name(struct vm_area_struct *vma); |
| 2761 | #ifdef CONFIG_MMU | ||
| 2759 | void print_vma_addr(char *prefix, unsigned long rip); | 2762 | void print_vma_addr(char *prefix, unsigned long rip); |
| 2763 | #else | ||
| 2764 | static inline void print_vma_addr(char *prefix, unsigned long rip) | ||
| 2765 | { | ||
| 2766 | } | ||
| 2767 | #endif | ||
| 2760 | 2768 | ||
| 2761 | void *sparse_buffer_alloc(unsigned long size); | 2769 | void *sparse_buffer_alloc(unsigned long size); |
| 2762 | struct page *sparse_mem_map_populate(unsigned long pnum, int nid, | 2770 | struct page * __populate_section_memmap(unsigned long pfn, |
| 2763 | struct vmem_altmap *altmap); | 2771 | unsigned long nr_pages, int nid, struct vmem_altmap *altmap); |
| 2764 | pgd_t *vmemmap_pgd_populate(unsigned long addr, int node); | 2772 | pgd_t *vmemmap_pgd_populate(unsigned long addr, int node); |
| 2765 | p4d_t *vmemmap_p4d_populate(pgd_t *pgd, unsigned long addr, int node); | 2773 | p4d_t *vmemmap_p4d_populate(pgd_t *pgd, unsigned long addr, int node); |
| 2766 | pud_t *vmemmap_pud_populate(p4d_t *p4d, unsigned long addr, int node); | 2774 | pud_t *vmemmap_pud_populate(p4d_t *p4d, unsigned long addr, int node); |
| @@ -2850,11 +2858,9 @@ extern long copy_huge_page_from_user(struct page *dst_page, · 83 unmodified lines | |||
| 2850 | bool allow_pagefault); | 2858 | bool allow_pagefault); |
| 2851 | #endif /* CONFIG_TRANSPARENT_HUGEPAGE || CONFIG_HUGETLBFS */ | 2859 | #endif /* CONFIG_TRANSPARENT_HUGEPAGE || CONFIG_HUGETLBFS */ |
| 2852 | 2860 | ||
| 2853 | extern struct page_ext_operations debug_guardpage_ops; | ||
| 2854 | |||
| 2855 | #ifdef CONFIG_DEBUG_PAGEALLOC | 2861 | #ifdef CONFIG_DEBUG_PAGEALLOC |
| 2856 | extern unsigned int _debug_guardpage_minorder; | 2862 | extern unsigned int _debug_guardpage_minorder; |
| 2857 | extern bool _debug_guardpage_enabled; | 2863 | DECLARE_STATIC_KEY_FALSE(_debug_guardpage_enabled); |
| 2858 | 2864 | ||
| 2859 | static inline unsigned int debug_guardpage_minorder(void) | 2865 | static inline unsigned int debug_guardpage_minorder(void) |
| 2860 | { | 2866 | { |
| @@ -2863,21 +2869,15 @@ static inline unsigned int debug_guardpage_minorder(void) · 2 unmodified lines | |||
| 2863 | 2869 | ||
| 2864 | static inline bool debug_guardpage_enabled(void) | 2870 | static inline bool debug_guardpage_enabled(void) |
| 2865 | { | 2871 | { |
| 2866 | return _debug_guardpage_enabled; | 2872 | return static_branch_unlikely(&_debug_guardpage_enabled); |
| 2867 | } | 2873 | } |
| 2868 | 2874 | ||
| 2869 | static inline bool page_is_guard(struct page *page) | 2875 | static inline bool page_is_guard(struct page *page) |
| 2870 | { | 2876 | { |
| 2871 | struct page_ext *page_ext; | ||
| 2872 | |||
| 2873 | if (!debug_guardpage_enabled()) | 2877 | if (!debug_guardpage_enabled()) |
| 2874 | return false; | 2878 | return false; |
| 2875 | 2879 | ||
| 2876 | page_ext = lookup_page_ext(page); | 2880 | return PageGuard(page); |
| 2877 | if (unlikely(!page_ext)) | ||
| 2878 | return false; | ||
| 2879 | |||
| 2880 | return test_bit(PAGE_EXT_DEBUG_GUARD, &page_ext->flags); | ||
| 2881 | } | 2881 | } |
| 2882 | #else | 2882 | #else |
| 2883 | static inline unsigned int debug_guardpage_minorder(void) { return 0; } | 2883 | static inline unsigned int debug_guardpage_minorder(void) { return 0; } |
| @@ -158,7 +158,7 @@ struct page { · 157 unmodified lines | |||
| 158 | struct { /* ZONE_DEVICE pages */ | 158 | struct { /* ZONE_DEVICE pages */ |
| 159 | /** @pgmap: Points to the hosting device page map. */ | 159 | /** @pgmap: Points to the hosting device page map. */ |
| 160 | struct dev_pagemap *pgmap; | 160 | struct dev_pagemap *pgmap; |
| 161 | unsigned long hmm_data; | 161 | void *zone_device_data; |
| 162 | unsigned long _zd_pad_1; /* uses mapping */ | 162 | unsigned long _zd_pad_1; /* uses mapping */ |
| 163 | }; | 163 | }; |
| 164 | 164 | ||
| @@ -329,7 +329,9 @@ struct vm_area_struct { · 164 unmodified lines | |||
| 329 | struct file * vm_file; /* File we map to (can be NULL). */ | 329 | struct file * vm_file; /* File we map to (can be NULL). */ |
| 330 | void * vm_private_data; /* was vm_pte (shared mem) */ | 330 | void * vm_private_data; /* was vm_pte (shared mem) */ |
| 331 | 331 | ||
| 332 | #ifdef CONFIG_SWAP | ||
| 332 | atomic_long_t swap_readahead_info; | 333 | atomic_long_t swap_readahead_info; |
| 334 | #endif | ||
| 333 | #ifndef CONFIG_MMU | 335 | #ifndef CONFIG_MMU |
| 334 | struct vm_region *vm_region; /* NOMMU mapping region */ | 336 | struct vm_region *vm_region; /* NOMMU mapping region */ |
| 335 | #endif | 337 | #endif |
| @@ -501,7 +503,7 @@ struct mm_struct { · 165 unmodified lines | |||
| 501 | #endif | 503 | #endif |
| 502 | struct work_struct async_put_work; | 504 | struct work_struct async_put_work; |
| 503 | 505 | ||
| 504 | #if IS_ENABLED(CONFIG_HMM) | 506 | #ifdef CONFIG_HMM_MIRROR |
| 505 | /* HMM needs to track a few things per mm */ | 507 | /* HMM needs to track a few things per mm */ |
| 506 | struct hmm *hmm; | 508 | struct hmm *hmm; |
| 507 | #endif | 509 | #endif |
| @@ -501,7 +501,6 @@ static inline void mmc_signal_sdio_irq(struct mmc_host *host) · 500 unmodified lines | |||
| 501 | wake_up_process(host->sdio_irq_thread); | 501 | wake_up_process(host->sdio_irq_thread); |
| 502 | } | 502 | } |
| 503 | 503 | ||
| 504 | void sdio_run_irqs(struct mmc_host *host); | ||
| 505 | void sdio_signal_irq(struct mmc_host *host); | 504 | void sdio_signal_irq(struct mmc_host *host); |
| 506 | 505 | ||
| 507 | #ifdef CONFIG_REGULATOR | 506 | #ifdef CONFIG_REGULATOR |
| @@ -855,18 +855,6 @@ static inline int local_memory_node(int node_id) { return node_id; }; · 854 unmodified lines | |||
| 855 | */ | 855 | */ |
| 856 | #define zone_idx(zone) ((zone) - (zone)->zone_pgdat->node_zones) | 856 | #define zone_idx(zone) ((zone) - (zone)->zone_pgdat->node_zones) |
| 857 | 857 | ||
| 858 | #ifdef CONFIG_ZONE_DEVICE | ||
| 859 | static inline bool is_dev_zone(const struct zone *zone) | ||
| 860 | { | ||
| 861 | return zone_idx(zone) == ZONE_DEVICE; | ||
| 862 | } | ||
| 863 | #else | ||
| 864 | static inline bool is_dev_zone(const struct zone *zone) | ||
| 865 | { | ||
| 866 | return false; | ||
| 867 | } | ||
| 868 | #endif | ||
| 869 | |||
| 870 | /* | 858 | /* |
| 871 | * Returns true if a zone has pages managed by the buddy allocator. | 859 | * Returns true if a zone has pages managed by the buddy allocator. |
| 872 | * All the reclaim decisions have to use this function rather than | 860 | * All the reclaim decisions have to use this function rather than |
| @@ -1160,6 +1148,29 @@ static inline unsigned long section_nr_to_pfn(unsigned long sec) · 287 unmodified lines | |||
| 1160 | #define SECTION_ALIGN_UP(pfn) (((pfn) + PAGES_PER_SECTION - 1) & PAGE_SECTION_MASK) | 1148 | #define SECTION_ALIGN_UP(pfn) (((pfn) + PAGES_PER_SECTION - 1) & PAGE_SECTION_MASK) |
| 1161 | #define SECTION_ALIGN_DOWN(pfn) ((pfn) & PAGE_SECTION_MASK) | 1149 | #define SECTION_ALIGN_DOWN(pfn) ((pfn) & PAGE_SECTION_MASK) |
| 1162 | 1150 | ||
| 1151 | #define SUBSECTION_SHIFT 21 | ||
| 1152 | |||
| 1153 | #define PFN_SUBSECTION_SHIFT (SUBSECTION_SHIFT - PAGE_SHIFT) | ||
| 1154 | #define PAGES_PER_SUBSECTION (1UL << PFN_SUBSECTION_SHIFT) | ||
| 1155 | #define PAGE_SUBSECTION_MASK (~(PAGES_PER_SUBSECTION-1)) | ||
| 1156 | |||
| 1157 | #if SUBSECTION_SHIFT > SECTION_SIZE_BITS | ||
| 1158 | #error Subsection size exceeds section size | ||
| 1159 | #else | ||
| 1160 | #define SUBSECTIONS_PER_SECTION (1UL << (SECTION_SIZE_BITS - SUBSECTION_SHIFT)) | ||
| 1161 | #endif | ||
| 1162 | |||
| 1163 | #define SUBSECTION_ALIGN_UP(pfn) ALIGN((pfn), PAGES_PER_SUBSECTION) | ||
| 1164 | #define SUBSECTION_ALIGN_DOWN(pfn) ((pfn) & PAGE_SUBSECTION_MASK) | ||
| 1165 | |||
| 1166 | struct mem_section_usage { | ||
| 1167 | DECLARE_BITMAP(subsection_map, SUBSECTIONS_PER_SECTION); | ||
| 1168 | /* See declaration of similar field in struct zone */ | ||
| 1169 | unsigned long pageblock_flags[0]; | ||
| 1170 | }; | ||
| 1171 | |||
| 1172 | void subsection_map_init(unsigned long pfn, unsigned long nr_pages); | ||
| 1173 | |||
| 1163 | struct page; | 1174 | struct page; |
| 1164 | struct page_ext; | 1175 | struct page_ext; |
| 1165 | struct mem_section { | 1176 | struct mem_section { |
| @@ -1177,8 +1188,7 @@ struct mem_section { · 11 unmodified lines | |||
| 1177 | */ | 1188 | */ |
| 1178 | unsigned long section_mem_map; | 1189 | unsigned long section_mem_map; |
| 1179 | 1190 | ||
| 1180 | /* See declaration of similar field in struct zone */ | 1191 | struct mem_section_usage *usage; |
| 1181 | unsigned long *pageblock_flags; | ||
| 1182 | #ifdef CONFIG_PAGE_EXTENSION | 1192 | #ifdef CONFIG_PAGE_EXTENSION |
| 1183 | /* | 1193 | /* |
| 1184 | * If SPARSEMEM, pgdat doesn't have page_ext pointer. We use | 1194 | * If SPARSEMEM, pgdat doesn't have page_ext pointer. We use |
| @@ -1209,6 +1219,11 @@ extern struct mem_section **mem_section; · 24 unmodified lines | |||
| 1209 | extern struct mem_section mem_section[NR_SECTION_ROOTS][SECTIONS_PER_ROOT]; | 1219 | extern struct mem_section mem_section[NR_SECTION_ROOTS][SECTIONS_PER_ROOT]; |
| 1210 | #endif | 1220 | #endif |
| 1211 | 1221 | ||
| 1222 | static inline unsigned long *section_to_usemap(struct mem_section *ms) | ||
| 1223 | { | ||
| 1224 | return ms->usage->pageblock_flags; | ||
| 1225 | } | ||
| 1226 | |||
| 1212 | static inline struct mem_section *__nr_to_section(unsigned long nr) | 1227 | static inline struct mem_section *__nr_to_section(unsigned long nr) |
| 1213 | { | 1228 | { |
| 1214 | #ifdef CONFIG_SPARSEMEM_EXTREME | 1229 | #ifdef CONFIG_SPARSEMEM_EXTREME |
| @@ -1219,8 +1234,8 @@ static inline struct mem_section *__nr_to_section(unsigned long nr) · 4 unmodified lines | |||
| 1219 | return NULL; | 1234 | return NULL; |
| 1220 | return &mem_section[SECTION_NR_TO_ROOT(nr)][nr & SECTION_ROOT_MASK]; | 1235 | return &mem_section[SECTION_NR_TO_ROOT(nr)][nr & SECTION_ROOT_MASK]; |
| 1221 | } | 1236 | } |
| 1222 | extern int __section_nr(struct mem_section* ms); | 1237 | extern unsigned long __section_nr(struct mem_section *ms); |
| 1223 | extern unsigned long usemap_size(void); | 1238 | extern size_t mem_section_usage_size(void); |
| 1224 | 1239 | ||
| 1225 | /* | 1240 | /* |
| 1226 | * We use the lower bits of the mem_map pointer to store | 1241 | * We use the lower bits of the mem_map pointer to store |
| @@ -1238,7 +1253,8 @@ extern unsigned long usemap_size(void); · 11 unmodified lines | |||
| 1238 | #define SECTION_MARKED_PRESENT (1UL<<0) | 1253 | #define SECTION_MARKED_PRESENT (1UL<<0) |
| 1239 | #define SECTION_HAS_MEM_MAP (1UL<<1) | 1254 | #define SECTION_HAS_MEM_MAP (1UL<<1) |
| 1240 | #define SECTION_IS_ONLINE (1UL<<2) | 1255 | #define SECTION_IS_ONLINE (1UL<<2) |
| 1241 | #define SECTION_MAP_LAST_BIT (1UL<<3) | 1256 | #define SECTION_IS_EARLY (1UL<<3) |
| 1257 | #define SECTION_MAP_LAST_BIT (1UL<<4) | ||
| 1242 | #define SECTION_MAP_MASK (~(SECTION_MAP_LAST_BIT-1)) | 1258 | #define SECTION_MAP_MASK (~(SECTION_MAP_LAST_BIT-1)) |
| 1243 | #define SECTION_NID_SHIFT 3 | 1259 | #define SECTION_NID_SHIFT 3 |
| 1244 | 1260 | ||
| @@ -1264,6 +1280,11 @@ static inline int valid_section(struct mem_section *section) · 19 unmodified lines | |||
| 1264 | return (section && (section->section_mem_map & SECTION_HAS_MEM_MAP)); | 1280 | return (section && (section->section_mem_map & SECTION_HAS_MEM_MAP)); |
| 1265 | } | 1281 | } |
| 1266 | 1282 | ||
| 1283 | static inline int early_section(struct mem_section *section) | ||
| 1284 | { | ||
| 1285 | return (section && (section->section_mem_map & SECTION_IS_EARLY)); | ||
| 1286 | } | ||
| 1287 | |||
| 1267 | static inline int valid_section_nr(unsigned long nr) | 1288 | static inline int valid_section_nr(unsigned long nr) |
| 1268 | { | 1289 | { |
| 1269 | return valid_section(__nr_to_section(nr)); | 1290 | return valid_section(__nr_to_section(nr)); |
| @@ -1291,14 +1312,42 @@ static inline struct mem_section *__pfn_to_section(unsigned long pfn) · 21 unmodified lines | |||
| 1291 | return __nr_to_section(pfn_to_section_nr(pfn)); | 1312 | return __nr_to_section(pfn_to_section_nr(pfn)); |
| 1292 | } | 1313 | } |
| 1293 | 1314 | ||
| 1294 | extern int __highest_present_section_nr; | 1315 | extern unsigned long __highest_present_section_nr; |
| 1316 | |||
| 1317 | static inline int subsection_map_index(unsigned long pfn) | ||
| 1318 | { | ||
| 1319 | return (pfn & ~(PAGE_SECTION_MASK)) / PAGES_PER_SUBSECTION; | ||
| 1320 | } | ||
| 1321 | |||
| 1322 | #ifdef CONFIG_SPARSEMEM_VMEMMAP | ||
| 1323 | static inline int pfn_section_valid(struct mem_section *ms, unsigned long pfn) | ||
| 1324 | { | ||
| 1325 | int idx = subsection_map_index(pfn); | ||
| 1326 | |||
| 1327 | return test_bit(idx, ms->usage->subsection_map); | ||
| 1328 | } | ||
| 1329 | #else | ||
| 1330 | static inline int pfn_section_valid(struct mem_section *ms, unsigned long pfn) | ||
| 1331 | { | ||
| 1332 | return 1; | ||
| 1333 | } | ||
| 1334 | #endif | ||
| 1295 | 1335 | ||
| 1296 | #ifndef CONFIG_HAVE_ARCH_PFN_VALID | 1336 | #ifndef CONFIG_HAVE_ARCH_PFN_VALID |
| 1297 | static inline int pfn_valid(unsigned long pfn) | 1337 | static inline int pfn_valid(unsigned long pfn) |
| 1298 | { | 1338 | { |
| 1339 | struct mem_section *ms; | ||
| 1340 | |||
| 1299 | if (pfn_to_section_nr(pfn) >= NR_MEM_SECTIONS) | 1341 | if (pfn_to_section_nr(pfn) >= NR_MEM_SECTIONS) |
| 1300 | return 0; | 1342 | return 0; |
| 1301 | return valid_section(__nr_to_section(pfn_to_section_nr(pfn))); | 1343 | ms = __nr_to_section(pfn_to_section_nr(pfn)); |
| 1344 | if (!valid_section(ms)) | ||
| 1345 | return 0; | ||
| 1346 | /* | ||
| 1347 | * Traditionally early sections always returned pfn_valid() for | ||
| 1348 | * the entire section-sized span. | ||
| 1349 | */ | ||
| 1350 | return early_section(ms) || pfn_section_valid(ms, pfn); | ||
| 1302 | } | 1351 | } |
| 1303 | #endif | 1352 | #endif |
| 1304 | 1353 | ||
| @@ -1330,6 +1379,7 @@ void sparse_init(void); · 25 unmodified lines | |||
| 1330 | #define sparse_init() do {} while (0) | 1379 | #define sparse_init() do {} while (0) |
| 1331 | #define sparse_index_init(_sec, _nid) do {} while (0) | 1380 | #define sparse_index_init(_sec, _nid) do {} while (0) |
| 1332 | #define pfn_present pfn_valid | 1381 | #define pfn_present pfn_valid |
| 1382 | #define subsection_map_init(_pfn, _nr_pages) do {} while (0) | ||
| 1333 | #endif /* CONFIG_SPARSEMEM */ | 1383 | #endif /* CONFIG_SPARSEMEM */ |
| 1334 | 1384 | ||
| 1335 | /* | 1385 | /* |
| @@ -16,6 +16,25 @@ typedef unsigned long kernel_ulong_t; · 15 unmodified lines | |||
| 16 | 16 | ||
| 17 | #define PCI_ANY_ID (~0) | 17 | #define PCI_ANY_ID (~0) |
| 18 | 18 | ||
| 19 | /** | ||
| 20 | * struct pci_device_id - PCI device ID structure | ||
| 21 | * @vendor: Vendor ID to match (or PCI_ANY_ID) | ||
| 22 | * @device: Device ID to match (or PCI_ANY_ID) | ||
| 23 | * @subvendor: Subsystem vendor ID to match (or PCI_ANY_ID) | ||
| 24 | * @subdevice: Subsystem device ID to match (or PCI_ANY_ID) | ||
| 25 | * @class: Device class, subclass, and "interface" to match. | ||
| 26 | * See Appendix D of the PCI Local Bus Spec or | ||
| 27 | * include/linux/pci_ids.h for a full list of classes. | ||
| 28 | * Most drivers do not need to specify class/class_mask | ||
| 29 | * as vendor/device is normally sufficient. | ||
| 30 | * @class_mask: Limit which sub-fields of the class field are compared. | ||
| 31 | * See drivers/scsi/sym53c8xx_2/ for example of usage. | ||
| 32 | * @driver_data: Data private to the driver. | ||
| 33 | * Most drivers don't need to use driver_data field. | ||
| 34 | * Best practice is to use driver_data as an index | ||
| 35 | * into a static list of equivalent device types, | ||
| 36 | * instead of using it as a pointer. | ||
| 37 | */ | ||
| 19 | struct pci_device_id { | 38 | struct pci_device_id { |
| 20 | __u32 vendor, device; /* Vendor and device ID or PCI_ANY_ID*/ | 39 | __u32 vendor, device; /* Vendor and device ID or PCI_ANY_ID*/ |
| 21 | __u32 subvendor, subdevice; /* Subsystem ID's or PCI_ANY_ID */ | 40 | __u32 subvendor, subdevice; /* Subsystem ID's or PCI_ANY_ID */ |
| @@ -257,17 +276,17 @@ struct pcmcia_device_id { · 235 unmodified lines | |||
| 257 | __u16 match_flags; | 276 | __u16 match_flags; |
| 258 | 277 | ||
| 259 | __u16 manf_id; | 278 | __u16 manf_id; |
| 260 | __u16 card_id; | 279 | __u16 card_id; |
| 261 | 280 | ||
| 262 | __u8 func_id; | 281 | __u8 func_id; |
| 263 | 282 | ||
| 264 | /* for real multi-function devices */ | 283 | /* for real multi-function devices */ |
| 265 | __u8 function; | 284 | __u8 function; |
| 266 | 285 | ||
| 267 | /* for pseudo multi-function devices */ | 286 | /* for pseudo multi-function devices */ |
| 268 | __u8 device_no; | 287 | __u8 device_no; |
| 269 | 288 | ||
| 270 | __u32 prod_id_hash[4]; | 289 | __u32 prod_id_hash[4]; |
| 271 | 290 | ||
| 272 | /* not matched against in kernelspace */ | 291 | /* not matched against in kernelspace */ |
| 273 | const char * prod_id[4]; | 292 | const char * prod_id[4]; |
| @@ -795,9 +814,11 @@ struct tee_client_device_id { · 521 unmodified lines | |||
| 795 | /** | 814 | /** |
| 796 | * struct wmi_device_id - WMI device identifier | 815 | * struct wmi_device_id - WMI device identifier |
| 797 | * @guid_string: 36 char string of the form fa50ff2b-f2e8-45de-83fa-65417f2f49ba | 816 | * @guid_string: 36 char string of the form fa50ff2b-f2e8-45de-83fa-65417f2f49ba |
| 817 | * @context: pointer to driver specific data | ||
| 798 | */ | 818 | */ |
| 799 | struct wmi_device_id { | 819 | struct wmi_device_id { |
| 800 | const char guid_string[UUID_STRING_LEN+1]; | 820 | const char guid_string[UUID_STRING_LEN+1]; |
| 821 | const void *context; | ||
| 801 | }; | 822 | }; |
| 802 | 823 | ||
| 803 | #endif /* LINUX_MOD_DEVICETABLE_H */ | 824 | #endif /* LINUX_MOD_DEVICETABLE_H */ |
| @@ -21,6 +21,7 @@ · 20 unmodified lines | |||
| 21 | #include <linux/rbtree_latch.h> | 21 | #include <linux/rbtree_latch.h> |
| 22 | #include <linux/error-injection.h> | 22 | #include <linux/error-injection.h> |
| 23 | #include <linux/tracepoint-defs.h> | 23 | #include <linux/tracepoint-defs.h> |
| 24 | #include <linux/srcu.h> | ||
| 24 | 25 | ||
| 25 | #include <linux/percpu.h> | 26 | #include <linux/percpu.h> |
| 26 | #include <asm/module.h> | 27 | #include <asm/module.h> |
| @@ -450,6 +451,10 @@ struct module { · 423 unmodified lines | |||
| 450 | unsigned int num_tracepoints; | 451 | unsigned int num_tracepoints; |
| 451 | tracepoint_ptr_t *tracepoints_ptrs; | 452 | tracepoint_ptr_t *tracepoints_ptrs; |
| 452 | #endif | 453 | #endif |
| 454 | #ifdef CONFIG_TREE_SRCU | ||
| 455 | unsigned int num_srcu_structs; | ||
| 456 | struct srcu_struct **srcu_struct_ptrs; | ||
| 457 | #endif | ||
| 453 | #ifdef CONFIG_BPF_EVENTS | 458 | #ifdef CONFIG_BPF_EVENTS |
| 454 | unsigned int num_bpf_raw_events; | 459 | unsigned int num_bpf_raw_events; |
| 455 | struct bpf_raw_event_map *bpf_raw_events; | 460 | struct bpf_raw_event_map *bpf_raw_events; |
| @@ -29,6 +29,11 @@ void *module_alloc(unsigned long size); · 28 unmodified lines | |||
| 29 | /* Free memory returned from module_alloc. */ | 29 | /* Free memory returned from module_alloc. */ |
| 30 | void module_memfree(void *module_region); | 30 | void module_memfree(void *module_region); |
| 31 | 31 | ||
| 32 | /* Determines if the section name is an exit section (that is only used during | ||
| 33 | * module unloading) | ||
| 34 | */ | ||
| 35 | bool module_exit_section(const char *name); | ||
| 36 | |||
| 32 | /* | 37 | /* |
| 33 | * Apply the given relocation to the (simplified) ELF. Return -error | 38 | * Apply the given relocation to the (simplified) ELF. Return -error |
| 34 | * or 0. | 39 | * or 0. |
| @@ -64,6 +64,10 @@ struct ti_sci_inta_msi_desc { · 63 unmodified lines | |||
| 64 | * @msg: The last set MSI message cached for reuse | 64 | * @msg: The last set MSI message cached for reuse |
| 65 | * @affinity: Optional pointer to a cpu affinity mask for this descriptor | 65 | * @affinity: Optional pointer to a cpu affinity mask for this descriptor |
| 66 | * | 66 | * |
| 67 | * @write_msi_msg: Callback that may be called when the MSI message | ||
| 68 | * address or data changes | ||
| 69 | * @write_msi_msg_data: Data parameter for the callback. | ||
| 70 | * | ||
| 67 | * @masked: [PCI MSI/X] Mask bits | 71 | * @masked: [PCI MSI/X] Mask bits |
| 68 | * @is_msix: [PCI MSI/X] True if MSI-X | 72 | * @is_msix: [PCI MSI/X] True if MSI-X |
| 69 | * @multiple: [PCI MSI/X] log2 num of messages allocated | 73 | * @multiple: [PCI MSI/X] log2 num of messages allocated |
| @@ -90,6 +94,9 @@ struct msi_desc { · 20 unmodified lines | |||
| 90 | const void *iommu_cookie; | 94 | const void *iommu_cookie; |
| 91 | #endif | 95 | #endif |
| 92 | 96 | ||
| 97 | void (*write_msi_msg)(struct msi_desc *entry, void *data); | ||
| 98 | void *write_msi_msg_data; | ||
| 99 | |||
| 93 | union { | 100 | union { |
| 94 | /* PCI MSI/X specific data */ | 101 | /* PCI MSI/X specific data */ |
| 95 | struct { | 102 | struct { |
| @@ -100,6 +107,7 @@ struct msi_desc { · 4 unmodified lines | |||
| 100 | u8 multi_cap : 3; | 107 | u8 multi_cap : 3; |
| 101 | u8 maskbit : 1; | 108 | u8 maskbit : 1; |
| 102 | u8 is_64 : 1; | 109 | u8 is_64 : 1; |
| 110 | u8 is_virtual : 1; | ||
| 103 | u16 entry_nr; | 111 | u16 entry_nr; |
| 104 | unsigned default_irq; | 112 | unsigned default_irq; |
| 105 | } msi_attrib; | 113 | } msi_attrib; |
| @@ -219,6 +219,13 @@ struct cfi_pri_amdstd { · 218 unmodified lines | |||
| 219 | uint8_t VppMin; | 219 | uint8_t VppMin; |
| 220 | uint8_t VppMax; | 220 | uint8_t VppMax; |
| 221 | uint8_t TopBottom; | 221 | uint8_t TopBottom; |
| 222 | /* Below field are added from version 1.5 */ | ||
| 223 | uint8_t ProgramSuspend; | ||
| 224 | uint8_t UnlockBypass; | ||
| 225 | uint8_t SecureSiliconSector; | ||
| 226 | uint8_t SoftwareFeatures; | ||
| 227 | #define CFI_POLL_STATUS_REG BIT(0) | ||
| 228 | #define CFI_POLL_DQ BIT(1) | ||
| 222 | } __packed; | 229 | } __packed; |
| 223 | 230 | ||
| 224 | /* Vendor-Specific PRI for Atmel chips (command set 0x0002) */ | 231 | /* Vendor-Specific PRI for Atmel chips (command set 0x0002) */ |
| @@ -0,0 +1,84 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 | ||
| 2 | * | ||
| 3 | * Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ | ||
| 4 | */ | ||
| 5 | |||
| 6 | #ifndef __LINUX_MTD_HYPERBUS_H__ | ||
| 7 | #define __LINUX_MTD_HYPERBUS_H__ | ||
| 8 | |||
| 9 | #include <linux/mtd/map.h> | ||
| 10 | |||
| 11 | enum hyperbus_memtype { | ||
| 12 | HYPERFLASH, | ||
| 13 | HYPERRAM, | ||
| 14 | }; | ||
| 15 | |||
| 16 | /** | ||
| 17 | * struct hyperbus_device - struct representing HyperBus slave device | ||
| 18 | * @map: map_info struct for accessing MMIO HyperBus flash memory | ||
| 19 | * @np: pointer to HyperBus slave device node | ||
| 20 | * @mtd: pointer to MTD struct | ||
| 21 | * @ctlr: pointer to HyperBus controller struct | ||
| 22 | * @memtype: type of memory device: HyperFlash or HyperRAM | ||
| 23 | */ | ||
| 24 | |||
| 25 | struct hyperbus_device { | ||
| 26 | struct map_info map; | ||
| 27 | struct device_node *np; | ||
| 28 | struct mtd_info *mtd; | ||
| 29 | struct hyperbus_ctlr *ctlr; | ||
| 30 | enum hyperbus_memtype memtype; | ||
| 31 | }; | ||
| 32 | |||
| 33 | /** | ||
| 34 | * struct hyperbus_ops - struct representing custom HyperBus operations | ||
| 35 | * @read16: read 16 bit of data from flash in a single burst. Used to read | ||
| 36 | * from non default address space, such as ID/CFI space | ||
| 37 | * @write16: write 16 bit of data to flash in a single burst. Used to | ||
| 38 | * send cmd to flash or write single 16 bit word at a time. | ||
| 39 | * @copy_from: copy data from flash memory | ||
| 40 | * @copy_to: copy data to flash memory | ||
| 41 | * @calibrate: calibrate HyperBus controller | ||
| 42 | */ | ||
| 43 | |||
| 44 | struct hyperbus_ops { | ||
| 45 | u16 (*read16)(struct hyperbus_device *hbdev, unsigned long addr); | ||
| 46 | void (*write16)(struct hyperbus_device *hbdev, | ||
| 47 | unsigned long addr, u16 val); | ||
| 48 | void (*copy_from)(struct hyperbus_device *hbdev, void *to, | ||
| 49 | unsigned long from, ssize_t len); | ||
| 50 | void (*copy_to)(struct hyperbus_device *dev, unsigned long to, | ||
| 51 | const void *from, ssize_t len); | ||
| 52 | int (*calibrate)(struct hyperbus_device *dev); | ||
| 53 | }; | ||
| 54 | |||
| 55 | /** | ||
| 56 | * struct hyperbus_ctlr - struct representing HyperBus controller | ||
| 57 | * @dev: pointer to HyperBus controller device | ||
| 58 | * @calibrated: flag to indicate ctlr calibration sequence is complete | ||
| 59 | * @ops: HyperBus controller ops | ||
| 60 | */ | ||
| 61 | struct hyperbus_ctlr { | ||
| 62 | struct device *dev; | ||
| 63 | bool calibrated; | ||
| 64 | |||
| 65 | const struct hyperbus_ops *ops; | ||
| 66 | }; | ||
| 67 | |||
| 68 | /** | ||
| 69 | * hyperbus_register_device - probe and register a HyperBus slave memory device | ||
| 70 | * @hbdev: hyperbus_device struct with dev, np and ctlr field populated | ||
| 71 | * | ||
| 72 | * Return: 0 for success, others for failure. | ||
| 73 | */ | ||
| 74 | int hyperbus_register_device(struct hyperbus_device *hbdev); | ||
| 75 | |||
| 76 | /** | ||
| 77 | * hyperbus_unregister_device - deregister HyperBus slave memory device | ||
| 78 | * @hbdev: hyperbus_device to be unregistered | ||
| 79 | * | ||
| 80 | * Return: 0 for success, others for failure. | ||
| 81 | */ | ||
| 82 | int hyperbus_unregister_device(struct hyperbus_device *hbdev); | ||
| 83 | |||
| 84 | #endif /* __LINUX_MTD_HYPERBUS_H__ */ | ||
| @@ -316,6 +316,12 @@ struct mtd_info { · 315 unmodified lines | |||
| 316 | int (*_get_device) (struct mtd_info *mtd); | 316 | int (*_get_device) (struct mtd_info *mtd); |
| 317 | void (*_put_device) (struct mtd_info *mtd); | 317 | void (*_put_device) (struct mtd_info *mtd); |
| 318 | 318 | ||
| 319 | /* | ||
| 320 | * flag indicates a panic write, low level drivers can take appropriate | ||
| 321 | * action if required to ensure writes go through | ||
| 322 | */ | ||
| 323 | bool oops_panic_write; | ||
| 324 | |||
| 319 | struct notifier_block reboot_notifier; /* default mode before reboot */ | 325 | struct notifier_block reboot_notifier; /* default mode before reboot */ |
| 320 | 326 | ||
| 321 | /* ECC status information */ | 327 | /* ECC status information */ |
| @@ -77,6 +77,7 @@ · 76 unmodified lines | |||
| 77 | #define ONENAND_DEVICE_DENSITY_1Gb (0x003) | 77 | #define ONENAND_DEVICE_DENSITY_1Gb (0x003) |
| 78 | #define ONENAND_DEVICE_DENSITY_2Gb (0x004) | 78 | #define ONENAND_DEVICE_DENSITY_2Gb (0x004) |
| 79 | #define ONENAND_DEVICE_DENSITY_4Gb (0x005) | 79 | #define ONENAND_DEVICE_DENSITY_4Gb (0x005) |
| 80 | #define ONENAND_DEVICE_DENSITY_8Gb (0x006) | ||
| 80 | 81 | ||
| 81 | /* | 82 | /* |
| 82 | * Version ID Register F002h (R) | 83 | * Version ID Register F002h (R) |
| @@ -874,6 +874,42 @@ int nand_op_parser_exec_op(struct nand_chip *chip, · 873 unmodified lines | |||
| 874 | const struct nand_op_parser *parser, | 874 | const struct nand_op_parser *parser, |
| 875 | const struct nand_operation *op, bool check_only); | 875 | const struct nand_operation *op, bool check_only); |
| 876 | 876 | ||
| 877 | static inline void nand_op_trace(const char *prefix, | ||
| 878 | const struct nand_op_instr *instr) | ||
| 879 | { | ||
| 880 | #if IS_ENABLED(CONFIG_DYNAMIC_DEBUG) || defined(DEBUG) | ||
| 881 | switch (instr->type) { | ||
| 882 | case NAND_OP_CMD_INSTR: | ||
| 883 | pr_debug("%sCMD [0x%02x]\n", prefix, | ||
| 884 | instr->ctx.cmd.opcode); | ||
| 885 | break; | ||
| 886 | case NAND_OP_ADDR_INSTR: | ||
| 887 | pr_debug("%sADDR [%d cyc: %*ph]\n", prefix, | ||
| 888 | instr->ctx.addr.naddrs, | ||
| 889 | instr->ctx.addr.naddrs < 64 ? | ||
| 890 | instr->ctx.addr.naddrs : 64, | ||
| 891 | instr->ctx.addr.addrs); | ||
| 892 | break; | ||
| 893 | case NAND_OP_DATA_IN_INSTR: | ||
| 894 | pr_debug("%sDATA_IN [%d B%s]\n", prefix, | ||
| 895 | instr->ctx.data.len, | ||
| 896 | instr->ctx.data.force_8bit ? | ||
| 897 | ", force 8-bit" : ""); | ||
| 898 | break; | ||
| 899 | case NAND_OP_DATA_OUT_INSTR: | ||
| 900 | pr_debug("%sDATA_OUT [%d B%s]\n", prefix, | ||
| 901 | instr->ctx.data.len, | ||
| 902 | instr->ctx.data.force_8bit ? | ||
| 903 | ", force 8-bit" : ""); | ||
| 904 | break; | ||
| 905 | case NAND_OP_WAITRDY_INSTR: | ||
| 906 | pr_debug("%sWAITRDY [max %d ms]\n", prefix, | ||
| 907 | instr->ctx.waitrdy.timeout_ms); | ||
| 908 | break; | ||
| 909 | } | ||
| 910 | #endif | ||
| 911 | } | ||
| 912 | |||
| 877 | /** | 913 | /** |
| 878 | * struct nand_controller_ops - Controller operations | 914 | * struct nand_controller_ops - Controller operations |
| 879 | * | 915 | * |
| @@ -68,30 +68,60 @@ · 67 unmodified lines | |||
| 68 | SPI_MEM_OP_DUMMY(ndummy, 1), \ | 68 | SPI_MEM_OP_DUMMY(ndummy, 1), \ |
| 69 | SPI_MEM_OP_DATA_IN(len, buf, 1)) | 69 | SPI_MEM_OP_DATA_IN(len, buf, 1)) |
| 70 | 70 | ||
| 71 | #define SPINAND_PAGE_READ_FROM_CACHE_OP_3A(fast, addr, ndummy, buf, len) \ | ||
| 72 | SPI_MEM_OP(SPI_MEM_OP_CMD(fast ? 0x0b : 0x03, 1), \ | ||
| 73 | SPI_MEM_OP_ADDR(3, addr, 1), \ | ||
| 74 | SPI_MEM_OP_DUMMY(ndummy, 1), \ | ||
| 75 | SPI_MEM_OP_DATA_IN(len, buf, 1)) | ||
| 76 | |||
| 71 | #define SPINAND_PAGE_READ_FROM_CACHE_X2_OP(addr, ndummy, buf, len) \ | 77 | #define SPINAND_PAGE_READ_FROM_CACHE_X2_OP(addr, ndummy, buf, len) \ |
| 72 | SPI_MEM_OP(SPI_MEM_OP_CMD(0x3b, 1), \ | 78 | SPI_MEM_OP(SPI_MEM_OP_CMD(0x3b, 1), \ |
| 73 | SPI_MEM_OP_ADDR(2, addr, 1), \ | 79 | SPI_MEM_OP_ADDR(2, addr, 1), \ |
| 74 | SPI_MEM_OP_DUMMY(ndummy, 1), \ | 80 | SPI_MEM_OP_DUMMY(ndummy, 1), \ |
| 75 | SPI_MEM_OP_DATA_IN(len, buf, 2)) | 81 | SPI_MEM_OP_DATA_IN(len, buf, 2)) |
| 76 | 82 | ||
| 83 | #define SPINAND_PAGE_READ_FROM_CACHE_X2_OP_3A(addr, ndummy, buf, len) \ | ||
| 84 | SPI_MEM_OP(SPI_MEM_OP_CMD(0x3b, 1), \ | ||
| 85 | SPI_MEM_OP_ADDR(3, addr, 1), \ | ||
| 86 | SPI_MEM_OP_DUMMY(ndummy, 1), \ | ||
| 87 | SPI_MEM_OP_DATA_IN(len, buf, 2)) | ||
| 88 | |||
| 77 | #define SPINAND_PAGE_READ_FROM_CACHE_X4_OP(addr, ndummy, buf, len) \ | 89 | #define SPINAND_PAGE_READ_FROM_CACHE_X4_OP(addr, ndummy, buf, len) \ |
| 78 | SPI_MEM_OP(SPI_MEM_OP_CMD(0x6b, 1), \ | 90 | SPI_MEM_OP(SPI_MEM_OP_CMD(0x6b, 1), \ |
| 79 | SPI_MEM_OP_ADDR(2, addr, 1), \ | 91 | SPI_MEM_OP_ADDR(2, addr, 1), \ |
| 80 | SPI_MEM_OP_DUMMY(ndummy, 1), \ | 92 | SPI_MEM_OP_DUMMY(ndummy, 1), \ |
| 81 | SPI_MEM_OP_DATA_IN(len, buf, 4)) | 93 | SPI_MEM_OP_DATA_IN(len, buf, 4)) |
| 82 | 94 | ||
| 95 | #define SPINAND_PAGE_READ_FROM_CACHE_X4_OP_3A(addr, ndummy, buf, len) \ | ||
| 96 | SPI_MEM_OP(SPI_MEM_OP_CMD(0x6b, 1), \ | ||
| 97 | SPI_MEM_OP_ADDR(3, addr, 1), \ | ||
| 98 | SPI_MEM_OP_DUMMY(ndummy, 1), \ | ||
| 99 | SPI_MEM_OP_DATA_IN(len, buf, 4)) | ||
| 100 | |||
| 83 | #define SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(addr, ndummy, buf, len) \ | 101 | #define SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(addr, ndummy, buf, len) \ |
| 84 | SPI_MEM_OP(SPI_MEM_OP_CMD(0xbb, 1), \ | 102 | SPI_MEM_OP(SPI_MEM_OP_CMD(0xbb, 1), \ |
| 85 | SPI_MEM_OP_ADDR(2, addr, 2), \ | 103 | SPI_MEM_OP_ADDR(2, addr, 2), \ |
| 86 | SPI_MEM_OP_DUMMY(ndummy, 2), \ | 104 | SPI_MEM_OP_DUMMY(ndummy, 2), \ |
| 87 | SPI_MEM_OP_DATA_IN(len, buf, 2)) | 105 | SPI_MEM_OP_DATA_IN(len, buf, 2)) |
| 88 | 106 | ||
| 107 | #define SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP_3A(addr, ndummy, buf, len) \ | ||
| 108 | SPI_MEM_OP(SPI_MEM_OP_CMD(0xbb, 1), \ | ||
| 109 | SPI_MEM_OP_ADDR(3, addr, 2), \ | ||
| 110 | SPI_MEM_OP_DUMMY(ndummy, 2), \ | ||
| 111 | SPI_MEM_OP_DATA_IN(len, buf, 2)) | ||
| 112 | |||
| 89 | #define SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(addr, ndummy, buf, len) \ | 113 | #define SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(addr, ndummy, buf, len) \ |
| 90 | SPI_MEM_OP(SPI_MEM_OP_CMD(0xeb, 1), \ | 114 | SPI_MEM_OP(SPI_MEM_OP_CMD(0xeb, 1), \ |
| 91 | SPI_MEM_OP_ADDR(2, addr, 4), \ | 115 | SPI_MEM_OP_ADDR(2, addr, 4), \ |
| 92 | SPI_MEM_OP_DUMMY(ndummy, 4), \ | 116 | SPI_MEM_OP_DUMMY(ndummy, 4), \ |
| 93 | SPI_MEM_OP_DATA_IN(len, buf, 4)) | 117 | SPI_MEM_OP_DATA_IN(len, buf, 4)) |
| 94 | 118 | ||
| 119 | #define SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP_3A(addr, ndummy, buf, len) \ | ||
| 120 | SPI_MEM_OP(SPI_MEM_OP_CMD(0xeb, 1), \ | ||
| 121 | SPI_MEM_OP_ADDR(3, addr, 4), \ | ||
| 122 | SPI_MEM_OP_DUMMY(ndummy, 4), \ | ||
| 123 | SPI_MEM_OP_DATA_IN(len, buf, 4)) | ||
| 124 | |||
| 95 | #define SPINAND_PROG_EXEC_OP(addr) \ | 125 | #define SPINAND_PROG_EXEC_OP(addr) \ |
| 96 | SPI_MEM_OP(SPI_MEM_OP_CMD(0x10, 1), \ | 126 | SPI_MEM_OP(SPI_MEM_OP_CMD(0x10, 1), \ |
| 97 | SPI_MEM_OP_ADDR(3, addr, 1), \ | 127 | SPI_MEM_OP_ADDR(3, addr, 1), \ |
| @@ -197,6 +227,7 @@ struct spinand_manufacturer { · 99 unmodified lines | |||
| 197 | extern const struct spinand_manufacturer gigadevice_spinand_manufacturer; | 227 | extern const struct spinand_manufacturer gigadevice_spinand_manufacturer; |
| 198 | extern const struct spinand_manufacturer macronix_spinand_manufacturer; | 228 | extern const struct spinand_manufacturer macronix_spinand_manufacturer; |
| 199 | extern const struct spinand_manufacturer micron_spinand_manufacturer; | 229 | extern const struct spinand_manufacturer micron_spinand_manufacturer; |
| 230 | extern const struct spinand_manufacturer paragon_spinand_manufacturer; | ||
| 200 | extern const struct spinand_manufacturer toshiba_spinand_manufacturer; | 231 | extern const struct spinand_manufacturer toshiba_spinand_manufacturer; |
| 201 | extern const struct spinand_manufacturer winbond_spinand_manufacturer; | 232 | extern const struct spinand_manufacturer winbond_spinand_manufacturer; |
| 202 | 233 | ||
| @@ -260,7 +291,7 @@ struct spinand_ecc_info { · 57 unmodified lines | |||
| 260 | */ | 291 | */ |
| 261 | struct spinand_info { | 292 | struct spinand_info { |
| 262 | const char *model; | 293 | const char *model; |
| 263 | u8 devid; | 294 | u16 devid; |
| 264 | u32 flags; | 295 | u32 flags; |
| 265 | struct nand_memory_organization memorg; | 296 | struct nand_memory_organization memorg; |
| 266 | struct nand_ecc_req eccreq; | 297 | struct nand_ecc_req eccreq; |
| @@ -422,7 +453,7 @@ static inline void spinand_set_of_node(struct spinand_device *spinand, · 155 unmodified lines | |||
| 422 | 453 | ||
| 423 | int spinand_match_and_init(struct spinand_device *dev, | 454 | int spinand_match_and_init(struct spinand_device *dev, |
| 424 | const struct spinand_info *table, | 455 | const struct spinand_info *table, |
| 425 | unsigned int table_size, u8 devid); | 456 | unsigned int table_size, u16 devid); |
| 426 | 457 | ||
| 427 | int spinand_upd_cfg(struct spinand_device *spinand, u8 mask, u8 val); | 458 | int spinand_upd_cfg(struct spinand_device *spinand, u8 mask, u8 val); |
| 428 | int spinand_select_target(struct spinand_device *spinand, unsigned int target); | 459 | int spinand_select_target(struct spinand_device *spinand, unsigned int target); |
| @@ -151,7 +151,7 @@ static inline bool mutex_is_locked(struct mutex *lock) · 150 unmodified lines | |||
| 151 | 151 | ||
| 152 | /* | 152 | /* |
| 153 | * See kernel/locking/mutex.c for detailed documentation of these APIs. | 153 | * See kernel/locking/mutex.c for detailed documentation of these APIs. |
| 154 | * Also see Documentation/locking/mutex-design.txt. | 154 | * Also see Documentation/locking/mutex-design.rst. |
| 155 | */ | 155 | */ |
| 156 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 156 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
| 157 | extern void mutex_lock_nested(struct mutex *lock, unsigned int subclass); | 157 | extern void mutex_lock_nested(struct mutex *lock, unsigned int subclass); |
| @@ -918,52 +918,6 @@ · 917 unmodified lines | |||
| 918 | 918 | ||
| 919 | extern void mv64340_irq_init(unsigned int base); | 919 | extern void mv64340_irq_init(unsigned int base); |
| 920 | 920 | ||
| 921 | /* MPSC Platform Device, Driver Data (Shared register regions) */ | ||
| 922 | #define MPSC_SHARED_NAME "mpsc_shared" | ||
| 923 | |||
| 924 | #define MPSC_ROUTING_BASE_ORDER 0 | ||
| 925 | #define MPSC_SDMA_INTR_BASE_ORDER 1 | ||
| 926 | |||
| 927 | #define MPSC_ROUTING_REG_BLOCK_SIZE 0x000c | ||
| 928 | #define MPSC_SDMA_INTR_REG_BLOCK_SIZE 0x0084 | ||
| 929 | |||
| 930 | struct mpsc_shared_pdata { | ||
| 931 | u32 mrr_val; | ||
| 932 | u32 rcrr_val; | ||
| 933 | u32 tcrr_val; | ||
| 934 | u32 intr_cause_val; | ||
| 935 | u32 intr_mask_val; | ||
| 936 | }; | ||
| 937 | |||
| 938 | /* MPSC Platform Device, Driver Data */ | ||
| 939 | #define MPSC_CTLR_NAME "mpsc" | ||
| 940 | |||
| 941 | #define MPSC_BASE_ORDER 0 | ||
| 942 | #define MPSC_SDMA_BASE_ORDER 1 | ||
| 943 | #define MPSC_BRG_BASE_ORDER 2 | ||
| 944 | |||
| 945 | #define MPSC_REG_BLOCK_SIZE 0x0038 | ||
| 946 | #define MPSC_SDMA_REG_BLOCK_SIZE 0x0c18 | ||
| 947 | #define MPSC_BRG_REG_BLOCK_SIZE 0x0008 | ||
| 948 | |||
| 949 | struct mpsc_pdata { | ||
| 950 | u8 mirror_regs; | ||
| 951 | u8 cache_mgmt; | ||
| 952 | u8 max_idle; | ||
| 953 | int default_baud; | ||
| 954 | int default_bits; | ||
| 955 | int default_parity; | ||
| 956 | int default_flow; | ||
| 957 | u32 chr_1_val; | ||
| 958 | u32 chr_2_val; | ||
| 959 | u32 chr_10_val; | ||
| 960 | u32 mpcr_val; | ||
| 961 | u32 bcr_val; | ||
| 962 | u8 brg_can_tune; | ||
| 963 | u8 brg_clk_src; | ||
| 964 | u32 brg_clk_freq; | ||
| 965 | }; | ||
| 966 | |||
| 967 | /* Watchdog Platform Device, Driver Data */ | 921 | /* Watchdog Platform Device, Driver Data */ |
| 968 | #define MV64x60_WDT_NAME "mv64x60_wdt" | 922 | #define MV64x60_WDT_NAME "mv64x60_wdt" |
| 969 | 923 | ||
| @@ -116,11 +116,11 @@ struct socket { · 115 unmodified lines | |||
| 116 | 116 | ||
| 117 | unsigned long flags; | 117 | unsigned long flags; |
| 118 | 118 | ||
| 119 | struct socket_wq *wq; | ||
| 120 | |||
| 121 | struct file *file; | 119 | struct file *file; |
| 122 | struct sock *sk; | 120 | struct sock *sk; |
| 123 | const struct proto_ops *ops; | 121 | const struct proto_ops *ops; |
| 122 | |||
| 123 | struct socket_wq wq; | ||
| 124 | }; | 124 | }; |
| 125 | 125 | ||
| 126 | struct vm_area_struct; | 126 | struct vm_area_struct; |
| @@ -1,418 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2016, Mellanox Technologies. All rights reserved. | ||
| 3 | * Copyright (c) 2017-2018, Broadcom Limited. All rights reserved. | ||
| 4 | * | ||
| 5 | * This software is available to you under a choice of one of two | ||
| 6 | * licenses. You may choose to be licensed under the terms of the GNU | ||
| 7 | * General Public License (GPL) Version 2, available from the file | ||
| 8 | * COPYING in the main directory of this source tree, or the | ||
| 9 | * OpenIB.org BSD license below: | ||
| 10 | * | ||
| 11 | * Redistribution and use in source and binary forms, with or | ||
| 12 | * without modification, are permitted provided that the following | ||
| 13 | * conditions are met: | ||
| 14 | * | ||
| 15 | * - Redistributions of source code must retain the above | ||
| 16 | * copyright notice, this list of conditions and the following | ||
| 17 | * disclaimer. | ||
| 18 | * | ||
| 19 | * - Redistributions in binary form must reproduce the above | ||
| 20 | * copyright notice, this list of conditions and the following | ||
| 21 | * disclaimer in the documentation and/or other materials | ||
| 22 | * provided with the distribution. | ||
| 23 | * | ||
| 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
| 25 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
| 26 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
| 27 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS | ||
| 28 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | ||
| 29 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
| 30 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| 31 | * SOFTWARE. | ||
| 32 | */ | ||
| 33 | |||
| 34 | #ifndef NET_DIM_H | ||
| 35 | #define NET_DIM_H | ||
| 36 | |||
| 37 | #include <linux/module.h> | ||
| 38 | |||
| 39 | struct net_dim_cq_moder { | ||
| 40 | u16 usec; | ||
| 41 | u16 pkts; | ||
| 42 | u8 cq_period_mode; | ||
| 43 | }; | ||
| 44 | |||
| 45 | struct net_dim_sample { | ||
| 46 | ktime_t time; | ||
| 47 | u32 pkt_ctr; | ||
| 48 | u32 byte_ctr; | ||
| 49 | u16 event_ctr; | ||
| 50 | }; | ||
| 51 | |||
| 52 | struct net_dim_stats { | ||
| 53 | int ppms; /* packets per msec */ | ||
| 54 | int bpms; /* bytes per msec */ | ||
| 55 | int epms; /* events per msec */ | ||
| 56 | }; | ||
| 57 | |||
| 58 | struct net_dim { /* Adaptive Moderation */ | ||
| 59 | u8 state; | ||
| 60 | struct net_dim_stats prev_stats; | ||
| 61 | struct net_dim_sample start_sample; | ||
| 62 | struct work_struct work; | ||
| 63 | u8 profile_ix; | ||
| 64 | u8 mode; | ||
| 65 | u8 tune_state; | ||
| 66 | u8 steps_right; | ||
| 67 | u8 steps_left; | ||
| 68 | u8 tired; | ||
| 69 | }; | ||
| 70 | |||
| 71 | enum { | ||
| 72 | NET_DIM_CQ_PERIOD_MODE_START_FROM_EQE = 0x0, | ||
| 73 | NET_DIM_CQ_PERIOD_MODE_START_FROM_CQE = 0x1, | ||
| 74 | NET_DIM_CQ_PERIOD_NUM_MODES | ||
| 75 | }; | ||
| 76 | |||
| 77 | /* Adaptive moderation logic */ | ||
| 78 | enum { | ||
| 79 | NET_DIM_START_MEASURE, | ||
| 80 | NET_DIM_MEASURE_IN_PROGRESS, | ||
| 81 | NET_DIM_APPLY_NEW_PROFILE, | ||
| 82 | }; | ||
| 83 | |||
| 84 | enum { | ||
| 85 | NET_DIM_PARKING_ON_TOP, | ||
| 86 | NET_DIM_PARKING_TIRED, | ||
| 87 | NET_DIM_GOING_RIGHT, | ||
| 88 | NET_DIM_GOING_LEFT, | ||
| 89 | }; | ||
| 90 | |||
| 91 | enum { | ||
| 92 | NET_DIM_STATS_WORSE, | ||
| 93 | NET_DIM_STATS_SAME, | ||
| 94 | NET_DIM_STATS_BETTER, | ||
| 95 | }; | ||
| 96 | |||
| 97 | enum { | ||
| 98 | NET_DIM_STEPPED, | ||
| 99 | NET_DIM_TOO_TIRED, | ||
| 100 | NET_DIM_ON_EDGE, | ||
| 101 | }; | ||
| 102 | |||
| 103 | #define NET_DIM_PARAMS_NUM_PROFILES 5 | ||
| 104 | /* Adaptive moderation profiles */ | ||
| 105 | #define NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE 256 | ||
| 106 | #define NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE 128 | ||
| 107 | #define NET_DIM_DEF_PROFILE_CQE 1 | ||
| 108 | #define NET_DIM_DEF_PROFILE_EQE 1 | ||
| 109 | |||
| 110 | /* All profiles sizes must be NET_PARAMS_DIM_NUM_PROFILES */ | ||
| 111 | #define NET_DIM_RX_EQE_PROFILES { \ | ||
| 112 | {1, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \ | ||
| 113 | {8, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \ | ||
| 114 | {64, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \ | ||
| 115 | {128, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \ | ||
| 116 | {256, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \ | ||
| 117 | } | ||
| 118 | |||
| 119 | #define NET_DIM_RX_CQE_PROFILES { \ | ||
| 120 | {2, 256}, \ | ||
| 121 | {8, 128}, \ | ||
| 122 | {16, 64}, \ | ||
| 123 | {32, 64}, \ | ||
| 124 | {64, 64} \ | ||
| 125 | } | ||
| 126 | |||
| 127 | #define NET_DIM_TX_EQE_PROFILES { \ | ||
| 128 | {1, NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE}, \ | ||
| 129 | {8, NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE}, \ | ||
| 130 | {32, NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE}, \ | ||
| 131 | {64, NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE}, \ | ||
| 132 | {128, NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE} \ | ||
| 133 | } | ||
| 134 | |||
| 135 | #define NET_DIM_TX_CQE_PROFILES { \ | ||
| 136 | {5, 128}, \ | ||
| 137 | {8, 64}, \ | ||
| 138 | {16, 32}, \ | ||
| 139 | {32, 32}, \ | ||
| 140 | {64, 32} \ | ||
| 141 | } | ||
| 142 | |||
| 143 | static const struct net_dim_cq_moder | ||
| 144 | rx_profile[NET_DIM_CQ_PERIOD_NUM_MODES][NET_DIM_PARAMS_NUM_PROFILES] = { | ||
| 145 | NET_DIM_RX_EQE_PROFILES, | ||
| 146 | NET_DIM_RX_CQE_PROFILES, | ||
| 147 | }; | ||
| 148 | |||
| 149 | static const struct net_dim_cq_moder | ||
| 150 | tx_profile[NET_DIM_CQ_PERIOD_NUM_MODES][NET_DIM_PARAMS_NUM_PROFILES] = { | ||
| 151 | NET_DIM_TX_EQE_PROFILES, | ||
| 152 | NET_DIM_TX_CQE_PROFILES, | ||
| 153 | }; | ||
| 154 | |||
| 155 | static inline struct net_dim_cq_moder | ||
| 156 | net_dim_get_rx_moderation(u8 cq_period_mode, int ix) | ||
| 157 | { | ||
| 158 | struct net_dim_cq_moder cq_moder = rx_profile[cq_period_mode][ix]; | ||
| 159 | |||
| 160 | cq_moder.cq_period_mode = cq_period_mode; | ||
| 161 | return cq_moder; | ||
| 162 | } | ||
| 163 | |||
| 164 | static inline struct net_dim_cq_moder | ||
| 165 | net_dim_get_def_rx_moderation(u8 cq_period_mode) | ||
| 166 | { | ||
| 167 | u8 profile_ix = cq_period_mode == NET_DIM_CQ_PERIOD_MODE_START_FROM_CQE ? | ||
| 168 | NET_DIM_DEF_PROFILE_CQE : NET_DIM_DEF_PROFILE_EQE; | ||
| 169 | |||
| 170 | return net_dim_get_rx_moderation(cq_period_mode, profile_ix); | ||
| 171 | } | ||
| 172 | |||
| 173 | static inline struct net_dim_cq_moder | ||
| 174 | net_dim_get_tx_moderation(u8 cq_period_mode, int ix) | ||
| 175 | { | ||
| 176 | struct net_dim_cq_moder cq_moder = tx_profile[cq_period_mode][ix]; | ||
| 177 | |||
| 178 | cq_moder.cq_period_mode = cq_period_mode; | ||
| 179 | return cq_moder; | ||
| 180 | } | ||
| 181 | |||
| 182 | static inline struct net_dim_cq_moder | ||
| 183 | net_dim_get_def_tx_moderation(u8 cq_period_mode) | ||
| 184 | { | ||
| 185 | u8 profile_ix = cq_period_mode == NET_DIM_CQ_PERIOD_MODE_START_FROM_CQE ? | ||
| 186 | NET_DIM_DEF_PROFILE_CQE : NET_DIM_DEF_PROFILE_EQE; | ||
| 187 | |||
| 188 | return net_dim_get_tx_moderation(cq_period_mode, profile_ix); | ||
| 189 | } | ||
| 190 | |||
| 191 | static inline bool net_dim_on_top(struct net_dim *dim) | ||
| 192 | { | ||
| 193 | switch (dim->tune_state) { | ||
| 194 | case NET_DIM_PARKING_ON_TOP: | ||
| 195 | case NET_DIM_PARKING_TIRED: | ||
| 196 | return true; | ||
| 197 | case NET_DIM_GOING_RIGHT: | ||
| 198 | return (dim->steps_left > 1) && (dim->steps_right == 1); | ||
| 199 | default: /* NET_DIM_GOING_LEFT */ | ||
| 200 | return (dim->steps_right > 1) && (dim->steps_left == 1); | ||
| 201 | } | ||
| 202 | } | ||
| 203 | |||
| 204 | static inline void net_dim_turn(struct net_dim *dim) | ||
| 205 | { | ||
| 206 | switch (dim->tune_state) { | ||
| 207 | case NET_DIM_PARKING_ON_TOP: | ||
| 208 | case NET_DIM_PARKING_TIRED: | ||
| 209 | break; | ||
| 210 | case NET_DIM_GOING_RIGHT: | ||
| 211 | dim->tune_state = NET_DIM_GOING_LEFT; | ||
| 212 | dim->steps_left = 0; | ||
| 213 | break; | ||
| 214 | case NET_DIM_GOING_LEFT: | ||
| 215 | dim->tune_state = NET_DIM_GOING_RIGHT; | ||
| 216 | dim->steps_right = 0; | ||
| 217 | break; | ||
| 218 | } | ||
| 219 | } | ||
| 220 | |||
| 221 | static inline int net_dim_step(struct net_dim *dim) | ||
| 222 | { | ||
| 223 | if (dim->tired == (NET_DIM_PARAMS_NUM_PROFILES * 2)) | ||
| 224 | return NET_DIM_TOO_TIRED; | ||
| 225 | |||
| 226 | switch (dim->tune_state) { | ||
| 227 | case NET_DIM_PARKING_ON_TOP: | ||
| 228 | case NET_DIM_PARKING_TIRED: | ||
| 229 | break; | ||
| 230 | case NET_DIM_GOING_RIGHT: | ||
| 231 | if (dim->profile_ix == (NET_DIM_PARAMS_NUM_PROFILES - 1)) | ||
| 232 | return NET_DIM_ON_EDGE; | ||
| 233 | dim->profile_ix++; | ||
| 234 | dim->steps_right++; | ||
| 235 | break; | ||
| 236 | case NET_DIM_GOING_LEFT: | ||
| 237 | if (dim->profile_ix == 0) | ||
| 238 | return NET_DIM_ON_EDGE; | ||
| 239 | dim->profile_ix--; | ||
| 240 | dim->steps_left++; | ||
| 241 | break; | ||
| 242 | } | ||
| 243 | |||
| 244 | dim->tired++; | ||
| 245 | return NET_DIM_STEPPED; | ||
| 246 | } | ||
| 247 | |||
| 248 | static inline void net_dim_park_on_top(struct net_dim *dim) | ||
| 249 | { | ||
| 250 | dim->steps_right = 0; | ||
| 251 | dim->steps_left = 0; | ||
| 252 | dim->tired = 0; | ||
| 253 | dim->tune_state = NET_DIM_PARKING_ON_TOP; | ||
| 254 | } | ||
| 255 | |||
| 256 | static inline void net_dim_park_tired(struct net_dim *dim) | ||
| 257 | { | ||
| 258 | dim->steps_right = 0; | ||
| 259 | dim->steps_left = 0; | ||
| 260 | dim->tune_state = NET_DIM_PARKING_TIRED; | ||
| 261 | } | ||
| 262 | |||
| 263 | static inline void net_dim_exit_parking(struct net_dim *dim) | ||
| 264 | { | ||
| 265 | dim->tune_state = dim->profile_ix ? NET_DIM_GOING_LEFT : | ||
| 266 | NET_DIM_GOING_RIGHT; | ||
| 267 | net_dim_step(dim); | ||
| 268 | } | ||
| 269 | |||
| 270 | #define IS_SIGNIFICANT_DIFF(val, ref) \ | ||
| 271 | (((100UL * abs((val) - (ref))) / (ref)) > 10) /* more than 10% difference */ | ||
| 272 | |||
| 273 | static inline int net_dim_stats_compare(struct net_dim_stats *curr, | ||
| 274 | struct net_dim_stats *prev) | ||
| 275 | { | ||
| 276 | if (!prev->bpms) | ||
| 277 | return curr->bpms ? NET_DIM_STATS_BETTER : | ||
| 278 | NET_DIM_STATS_SAME; | ||
| 279 | |||
| 280 | if (IS_SIGNIFICANT_DIFF(curr->bpms, prev->bpms)) | ||
| 281 | return (curr->bpms > prev->bpms) ? NET_DIM_STATS_BETTER : | ||
| 282 | NET_DIM_STATS_WORSE; | ||
| 283 | |||
| 284 | if (!prev->ppms) | ||
| 285 | return curr->ppms ? NET_DIM_STATS_BETTER : | ||
| 286 | NET_DIM_STATS_SAME; | ||
| 287 | |||
| 288 | if (IS_SIGNIFICANT_DIFF(curr->ppms, prev->ppms)) | ||
| 289 | return (curr->ppms > prev->ppms) ? NET_DIM_STATS_BETTER : | ||
| 290 | NET_DIM_STATS_WORSE; | ||
| 291 | |||
| 292 | if (!prev->epms) | ||
| 293 | return NET_DIM_STATS_SAME; | ||
| 294 | |||
| 295 | if (IS_SIGNIFICANT_DIFF(curr->epms, prev->epms)) | ||
| 296 | return (curr->epms < prev->epms) ? NET_DIM_STATS_BETTER : | ||
| 297 | NET_DIM_STATS_WORSE; | ||
| 298 | |||
| 299 | return NET_DIM_STATS_SAME; | ||
| 300 | } | ||
| 301 | |||
| 302 | static inline bool net_dim_decision(struct net_dim_stats *curr_stats, | ||
| 303 | struct net_dim *dim) | ||
| 304 | { | ||
| 305 | int prev_state = dim->tune_state; | ||
| 306 | int prev_ix = dim->profile_ix; | ||
| 307 | int stats_res; | ||
| 308 | int step_res; | ||
| 309 | |||
| 310 | switch (dim->tune_state) { | ||
| 311 | case NET_DIM_PARKING_ON_TOP: | ||
| 312 | stats_res = net_dim_stats_compare(curr_stats, &dim->prev_stats); | ||
| 313 | if (stats_res != NET_DIM_STATS_SAME) | ||
| 314 | net_dim_exit_parking(dim); | ||
| 315 | break; | ||
| 316 | |||
| 317 | case NET_DIM_PARKING_TIRED: | ||
| 318 | dim->tired--; | ||
| 319 | if (!dim->tired) | ||
| 320 | net_dim_exit_parking(dim); | ||
| 321 | break; | ||
| 322 | |||
| 323 | case NET_DIM_GOING_RIGHT: | ||
| 324 | case NET_DIM_GOING_LEFT: | ||
| 325 | stats_res = net_dim_stats_compare(curr_stats, &dim->prev_stats); | ||
| 326 | if (stats_res != NET_DIM_STATS_BETTER) | ||
| 327 | net_dim_turn(dim); | ||
| 328 | |||
| 329 | if (net_dim_on_top(dim)) { | ||
| 330 | net_dim_park_on_top(dim); | ||
| 331 | break; | ||
| 332 | } | ||
| 333 | |||
| 334 | step_res = net_dim_step(dim); | ||
| 335 | switch (step_res) { | ||
| 336 | case NET_DIM_ON_EDGE: | ||
| 337 | net_dim_park_on_top(dim); | ||
| 338 | break; | ||
| 339 | case NET_DIM_TOO_TIRED: | ||
| 340 | net_dim_park_tired(dim); | ||
| 341 | break; | ||
| 342 | } | ||
| 343 | |||
| 344 | break; | ||
| 345 | } | ||
| 346 | |||
| 347 | if ((prev_state != NET_DIM_PARKING_ON_TOP) || | ||
| 348 | (dim->tune_state != NET_DIM_PARKING_ON_TOP)) | ||
| 349 | dim->prev_stats = *curr_stats; | ||
| 350 | |||
| 351 | return dim->profile_ix != prev_ix; | ||
| 352 | } | ||
| 353 | |||
| 354 | static inline void net_dim_sample(u16 event_ctr, | ||
| 355 | u64 packets, | ||
| 356 | u64 bytes, | ||
| 357 | struct net_dim_sample *s) | ||
| 358 | { | ||
| 359 | s->time = ktime_get(); | ||
| 360 | s->pkt_ctr = packets; | ||
| 361 | s->byte_ctr = bytes; | ||
| 362 | s->event_ctr = event_ctr; | ||
| 363 | } | ||
| 364 | |||
| 365 | #define NET_DIM_NEVENTS 64 | ||
| 366 | #define BIT_GAP(bits, end, start) ((((end) - (start)) + BIT_ULL(bits)) & (BIT_ULL(bits) - 1)) | ||
| 367 | |||
| 368 | static inline void net_dim_calc_stats(struct net_dim_sample *start, | ||
| 369 | struct net_dim_sample *end, | ||
| 370 | struct net_dim_stats *curr_stats) | ||
| 371 | { | ||
| 372 | /* u32 holds up to 71 minutes, should be enough */ | ||
| 373 | u32 delta_us = ktime_us_delta(end->time, start->time); | ||
| 374 | u32 npkts = BIT_GAP(BITS_PER_TYPE(u32), end->pkt_ctr, start->pkt_ctr); | ||
| 375 | u32 nbytes = BIT_GAP(BITS_PER_TYPE(u32), end->byte_ctr, | ||
| 376 | start->byte_ctr); | ||
| 377 | |||
| 378 | if (!delta_us) | ||
| 379 | return; | ||
| 380 | |||
| 381 | curr_stats->ppms = DIV_ROUND_UP(npkts * USEC_PER_MSEC, delta_us); | ||
| 382 | curr_stats->bpms = DIV_ROUND_UP(nbytes * USEC_PER_MSEC, delta_us); | ||
| 383 | curr_stats->epms = DIV_ROUND_UP(NET_DIM_NEVENTS * USEC_PER_MSEC, | ||
| 384 | delta_us); | ||
| 385 | } | ||
| 386 | |||
| 387 | static inline void net_dim(struct net_dim *dim, | ||
| 388 | struct net_dim_sample end_sample) | ||
| 389 | { | ||
| 390 | struct net_dim_stats curr_stats; | ||
| 391 | u16 nevents; | ||
| 392 | |||
| 393 | switch (dim->state) { | ||
| 394 | case NET_DIM_MEASURE_IN_PROGRESS: | ||
| 395 | nevents = BIT_GAP(BITS_PER_TYPE(u16), | ||
| 396 | end_sample.event_ctr, | ||
| 397 | dim->start_sample.event_ctr); | ||
| 398 | if (nevents < NET_DIM_NEVENTS) | ||
| 399 | break; | ||
| 400 | net_dim_calc_stats(&dim->start_sample, &end_sample, | ||
| 401 | &curr_stats); | ||
| 402 | if (net_dim_decision(&curr_stats, dim)) { | ||
| 403 | dim->state = NET_DIM_APPLY_NEW_PROFILE; | ||
| 404 | schedule_work(&dim->work); | ||
| 405 | break; | ||
| 406 | } | ||
| 407 | /* fall through */ | ||
| 408 | case NET_DIM_START_MEASURE: | ||
| 409 | net_dim_sample(end_sample.event_ctr, end_sample.pkt_ctr, end_sample.byte_ctr, | ||
| 410 | &dim->start_sample); | ||
| 411 | dim->state = NET_DIM_MEASURE_IN_PROGRESS; | ||
| 412 | break; | ||
| 413 | case NET_DIM_APPLY_NEW_PROFILE: | ||
| 414 | break; | ||
| 415 | } | ||
| 416 | } | ||
| 417 | |||
| 418 | #endif /* NET_DIM_H */ | ||
| @@ -4870,4 +4870,6 @@ do { \ · 4869 unmodified lines | |||
| 4870 | #define PTYPE_HASH_SIZE (16) | 4870 | #define PTYPE_HASH_SIZE (16) |
| 4871 | #define PTYPE_HASH_MASK (PTYPE_HASH_SIZE - 1) | 4871 | #define PTYPE_HASH_MASK (PTYPE_HASH_SIZE - 1) |
| 4872 | 4872 | ||
| 4873 | extern struct net_device *blackhole_netdev; | ||
| 4874 | |||
| 4873 | #endif /* _LINUX_NETDEVICE_H */ | 4875 | #endif /* _LINUX_NETDEVICE_H */ |
| @@ -336,11 +336,6 @@ int compat_nf_getsockopt(struct sock *sk, u_int8_t pf, int optval, · 335 unmodified lines | |||
| 336 | char __user *opt, int *len); | 336 | char __user *opt, int *len); |
| 337 | #endif | 337 | #endif |
| 338 | 338 | ||
| 339 | /* Call this before modifying an existing packet: ensures it is | ||
| 340 | modifiable and linear to the point you care about (writable_len). | ||
| 341 | Returns true or false. */ | ||
| 342 | int skb_make_writable(struct sk_buff *skb, unsigned int writable_len); | ||
| 343 | |||
| 344 | struct flowi; | 339 | struct flowi; |
| 345 | struct nf_queue_entry; | 340 | struct nf_queue_entry; |
| 346 | 341 | ||
| @@ -2,7 +2,7 @@ · 1 unmodified line | |||
| 2 | /* Copyright (C) 2000-2002 Joakim Axelsson <gozem@linux.nu> | 2 | /* Copyright (C) 2000-2002 Joakim Axelsson <gozem@linux.nu> |
| 3 | * Patrick Schaaf <bof@bof.de> | 3 | * Patrick Schaaf <bof@bof.de> |
| 4 | * Martin Josefsson <gandalf@wlug.westbo.se> | 4 | * Martin Josefsson <gandalf@wlug.westbo.se> |
| 5 | * Copyright (C) 2003-2013 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 5 | * Copyright (C) 2003-2013 Jozsef Kadlecsik <kadlec@netfilter.org> |
| 6 | */ | 6 | */ |
| 7 | #ifndef _IP_SET_H | 7 | #ifndef _IP_SET_H |
| 8 | #define _IP_SET_H | 8 | #define _IP_SET_H |
| @@ -2,8 +2,7 @@ · 1 unmodified line | |||
| 2 | #ifndef _IP_SET_COUNTER_H | 2 | #ifndef _IP_SET_COUNTER_H |
| 3 | #define _IP_SET_COUNTER_H | 3 | #define _IP_SET_COUNTER_H |
| 4 | 4 | ||
| 5 | /* Copyright (C) 2015 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 5 | /* Copyright (C) 2015 Jozsef Kadlecsik <kadlec@netfilter.org> */ |
| 6 | */ | ||
| 7 | 6 | ||
| 8 | #ifdef __KERNEL__ | 7 | #ifdef __KERNEL__ |
| 9 | 8 | ||
| @@ -2,8 +2,7 @@ · 1 unmodified line | |||
| 2 | #ifndef _IP_SET_SKBINFO_H | 2 | #ifndef _IP_SET_SKBINFO_H |
| 3 | #define _IP_SET_SKBINFO_H | 3 | #define _IP_SET_SKBINFO_H |
| 4 | 4 | ||
| 5 | /* Copyright (C) 2015 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 5 | /* Copyright (C) 2015 Jozsef Kadlecsik <kadlec@netfilter.org> */ |
| 6 | */ | ||
| 7 | 6 | ||
| 8 | #ifdef __KERNEL__ | 7 | #ifdef __KERNEL__ |
| 9 | 8 | ||
| @@ -2,8 +2,7 @@ · 1 unmodified line | |||
| 2 | #ifndef _IP_SET_TIMEOUT_H | 2 | #ifndef _IP_SET_TIMEOUT_H |
| 3 | #define _IP_SET_TIMEOUT_H | 3 | #define _IP_SET_TIMEOUT_H |
| 4 | 4 | ||
| 5 | /* Copyright (C) 2003-2013 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 5 | /* Copyright (C) 2003-2013 Jozsef Kadlecsik <kadlec@netfilter.org> */ |
| 6 | */ | ||
| 7 | 6 | ||
| 8 | #ifdef __KERNEL__ | 7 | #ifdef __KERNEL__ |
| 9 | 8 | ||
| @@ -1,7 +1,6 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0-only */ | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | /**************************************************************************** | 2 | /**************************************************************************** |
| 3 | * ip_conntrack_h323_asn1.h - BER and PER decoding library for H.323 | 3 | * BER and PER decoding library for H.323 conntrack/NAT module. |
| 4 | * conntrack/NAT module. | ||
| 5 | * | 4 | * |
| 6 | * Copyright (c) 2006 by Jing Min Zhao <zhaojingmin@users.sourceforge.net> | 5 | * Copyright (c) 2006 by Jing Min Zhao <zhaojingmin@users.sourceforge.net> |
| 7 | * | 6 | * |
| @@ -8,6 +8,7 @@ · 7 unmodified lines | |||
| 8 | #define __LINUX_IP6_NETFILTER_H | 8 | #define __LINUX_IP6_NETFILTER_H |
| 9 | 9 | ||
| 10 | #include <uapi/linux/netfilter_ipv6.h> | 10 | #include <uapi/linux/netfilter_ipv6.h> |
| 11 | #include <net/tcp.h> | ||
| 11 | 12 | ||
| 12 | /* Extra routing may needed on local out, as the QUEUE target never returns | 13 | /* Extra routing may needed on local out, as the QUEUE target never returns |
| 13 | * control to the table. | 14 | * control to the table. |
| @@ -19,6 +20,7 @@ struct ip6_rt_info { · 5 unmodified lines | |||
| 19 | }; | 20 | }; |
| 20 | 21 | ||
| 21 | struct nf_queue_entry; | 22 | struct nf_queue_entry; |
| 23 | struct nf_ct_bridge_frag_data; | ||
| 22 | 24 | ||
| 23 | /* | 25 | /* |
| 24 | * Hook functions for ipv6 to allow xt_* modules to be built-in even | 26 | * Hook functions for ipv6 to allow xt_* modules to be built-in even |
| @@ -34,11 +36,24 @@ struct nf_ipv6_ops { · 9 unmodified lines | |||
| 34 | struct in6_addr *saddr); | 36 | struct in6_addr *saddr); |
| 35 | int (*route)(struct net *net, struct dst_entry **dst, struct flowi *fl, | 37 | int (*route)(struct net *net, struct dst_entry **dst, struct flowi *fl, |
| 36 | bool strict); | 38 | bool strict); |
| 39 | u32 (*cookie_init_sequence)(const struct ipv6hdr *iph, | ||
| 40 | const struct tcphdr *th, u16 *mssp); | ||
| 41 | int (*cookie_v6_check)(const struct ipv6hdr *iph, | ||
| 42 | const struct tcphdr *th, __u32 cookie); | ||
| 37 | #endif | 43 | #endif |
| 38 | void (*route_input)(struct sk_buff *skb); | 44 | void (*route_input)(struct sk_buff *skb); |
| 39 | int (*fragment)(struct net *net, struct sock *sk, struct sk_buff *skb, | 45 | int (*fragment)(struct net *net, struct sock *sk, struct sk_buff *skb, |
| 40 | int (*output)(struct net *, struct sock *, struct sk_buff *)); | 46 | int (*output)(struct net *, struct sock *, struct sk_buff *)); |
| 41 | int (*reroute)(struct sk_buff *skb, const struct nf_queue_entry *entry); | 47 | int (*reroute)(struct sk_buff *skb, const struct nf_queue_entry *entry); |
| 48 | #if IS_MODULE(CONFIG_IPV6) | ||
| 49 | int (*br_defrag)(struct net *net, struct sk_buff *skb, u32 user); | ||
| 50 | int (*br_fragment)(struct net *net, struct sock *sk, | ||
| 51 | struct sk_buff *skb, | ||
| 52 | struct nf_ct_bridge_frag_data *data, | ||
| 53 | int (*output)(struct net *, struct sock *sk, | ||
| 54 | const struct nf_ct_bridge_frag_data *data, | ||
| 55 | struct sk_buff *)); | ||
| 56 | #endif | ||
| 42 | }; | 57 | }; |
| 43 | 58 | ||
| 44 | #ifdef CONFIG_NETFILTER | 59 | #ifdef CONFIG_NETFILTER |
| @@ -60,8 +75,10 @@ static inline int nf_ipv6_chk_addr(struct net *net, const struct in6_addr *addr, · 15 unmodified lines | |||
| 60 | return 1; | 75 | return 1; |
| 61 | 76 | ||
| 62 | return v6_ops->chk_addr(net, addr, dev, strict); | 77 | return v6_ops->chk_addr(net, addr, dev, strict); |
| 63 | #else | 78 | #elif IS_BUILTIN(CONFIG_IPV6) |
| 64 | return ipv6_chk_addr(net, addr, dev, strict); | 79 | return ipv6_chk_addr(net, addr, dev, strict); |
| 80 | #else | ||
| 81 | return 1; | ||
| 65 | #endif | 82 | #endif |
| 66 | } | 83 | } |
| 67 | 84 | ||
| @@ -86,6 +103,52 @@ static inline int nf_ip6_route(struct net *net, struct dst_entry **dst, · 18 unmodified lines | |||
| 86 | #endif | 103 | #endif |
| 87 | } | 104 | } |
| 88 | 105 | ||
| 106 | #include <net/netfilter/ipv6/nf_defrag_ipv6.h> | ||
| 107 | |||
| 108 | static inline int nf_ipv6_br_defrag(struct net *net, struct sk_buff *skb, | ||
| 109 | u32 user) | ||
| 110 | { | ||
| 111 | #if IS_MODULE(CONFIG_IPV6) | ||
| 112 | const struct nf_ipv6_ops *v6_ops = nf_get_ipv6_ops(); | ||
| 113 | |||
| 114 | if (!v6_ops) | ||
| 115 | return 1; | ||
| 116 | |||
| 117 | return v6_ops->br_defrag(net, skb, user); | ||
| 118 | #elif IS_BUILTIN(CONFIG_IPV6) | ||
| 119 | return nf_ct_frag6_gather(net, skb, user); | ||
| 120 | #else | ||
| 121 | return 1; | ||
| 122 | #endif | ||
| 123 | } | ||
| 124 | |||
| 125 | int br_ip6_fragment(struct net *net, struct sock *sk, struct sk_buff *skb, | ||
| 126 | struct nf_ct_bridge_frag_data *data, | ||
| 127 | int (*output)(struct net *, struct sock *sk, | ||
| 128 | const struct nf_ct_bridge_frag_data *data, | ||
| 129 | struct sk_buff *)); | ||
| 130 | |||
| 131 | static inline int nf_br_ip6_fragment(struct net *net, struct sock *sk, | ||
| 132 | struct sk_buff *skb, | ||
| 133 | struct nf_ct_bridge_frag_data *data, | ||
| 134 | int (*output)(struct net *, struct sock *sk, | ||
| 135 | const struct nf_ct_bridge_frag_data *data, | ||
| 136 | struct sk_buff *)) | ||
| 137 | { | ||
| 138 | #if IS_MODULE(CONFIG_IPV6) | ||
| 139 | const struct nf_ipv6_ops *v6_ops = nf_get_ipv6_ops(); | ||
| 140 | |||
| 141 | if (!v6_ops) | ||
| 142 | return 1; | ||
| 143 | |||
| 144 | return v6_ops->br_fragment(net, sk, skb, data, output); | ||
| 145 | #elif IS_BUILTIN(CONFIG_IPV6) | ||
| 146 | return br_ip6_fragment(net, sk, skb, data, output); | ||
| 147 | #else | ||
| 148 | return 1; | ||
| 149 | #endif | ||
| 150 | } | ||
| 151 | |||
| 89 | int ip6_route_me_harder(struct net *net, struct sk_buff *skb); | 152 | int ip6_route_me_harder(struct net *net, struct sk_buff *skb); |
| 90 | 153 | ||
| 91 | static inline int nf_ip6_route_me_harder(struct net *net, struct sk_buff *skb) | 154 | static inline int nf_ip6_route_me_harder(struct net *net, struct sk_buff *skb) |
| @@ -97,9 +160,44 @@ static inline int nf_ip6_route_me_harder(struct net *net, struct sk_buff *skb) · 5 unmodified lines | |||
| 97 | return -EHOSTUNREACH; | 160 | return -EHOSTUNREACH; |
| 98 | 161 | ||
| 99 | return v6_ops->route_me_harder(net, skb); | 162 | return v6_ops->route_me_harder(net, skb); |
| 100 | #else | 163 | #elif IS_BUILTIN(CONFIG_IPV6) |
| 101 | return ip6_route_me_harder(net, skb); | 164 | return ip6_route_me_harder(net, skb); |
| 165 | #else | ||
| 166 | return -EHOSTUNREACH; | ||
| 167 | #endif | ||
| 168 | } | ||
| 169 | |||
| 170 | static inline u32 nf_ipv6_cookie_init_sequence(const struct ipv6hdr *iph, | ||
| 171 | const struct tcphdr *th, | ||
| 172 | u16 *mssp) | ||
| 173 | { | ||
| 174 | #if IS_ENABLED(CONFIG_SYN_COOKIES) | ||
| 175 | #if IS_MODULE(CONFIG_IPV6) | ||
| 176 | const struct nf_ipv6_ops *v6_ops = nf_get_ipv6_ops(); | ||
| 177 | |||
| 178 | if (v6_ops) | ||
| 179 | return v6_ops->cookie_init_sequence(iph, th, mssp); | ||
| 180 | #elif IS_BUILTIN(CONFIG_IPV6) | ||
| 181 | return __cookie_v6_init_sequence(iph, th, mssp); | ||
| 182 | #endif | ||
| 183 | #endif | ||
| 184 | return 0; | ||
| 185 | } | ||
| 186 | |||
| 187 | static inline int nf_cookie_v6_check(const struct ipv6hdr *iph, | ||
| 188 | const struct tcphdr *th, __u32 cookie) | ||
| 189 | { | ||
| 190 | #if IS_ENABLED(CONFIG_SYN_COOKIES) | ||
| 191 | #if IS_MODULE(CONFIG_IPV6) | ||
| 192 | const struct nf_ipv6_ops *v6_ops = nf_get_ipv6_ops(); | ||
| 193 | |||
| 194 | if (v6_ops) | ||
| 195 | return v6_ops->cookie_v6_check(iph, th, cookie); | ||
| 196 | #elif IS_BUILTIN(CONFIG_IPV6) | ||
| 197 | return __cookie_v6_check(iph, th, cookie); | ||
| 198 | #endif | ||
| 102 | #endif | 199 | #endif |
| 200 | return 0; | ||
| 103 | } | 201 | } |
| 104 | 202 | ||
| 105 | __sum16 nf_ip6_checksum(struct sk_buff *skb, unsigned int hook, | 203 | __sum16 nf_ip6_checksum(struct sk_buff *skb, unsigned int hook, |
| @@ -192,7 +192,14 @@ struct netlink_callback { · 191 unmodified lines | |||
| 192 | bool strict_check; | 192 | bool strict_check; |
| 193 | u16 answer_flags; | 193 | u16 answer_flags; |
| 194 | unsigned int prev_seq, seq; | 194 | unsigned int prev_seq, seq; |
| 195 | long args[6]; | 195 | union { |
| 196 | u8 ctx[48]; | ||
| 197 | |||
| 198 | /* args is deprecated. Cast a struct over ctx instead | ||
| 199 | * for proper type safety. | ||
| 200 | */ | ||
| 201 | long args[6]; | ||
| 202 | }; | ||
| 196 | }; | 203 | }; |
| 197 | 204 | ||
| 198 | struct netlink_notify { | 205 | struct netlink_notify { |
| @@ -660,6 +660,7 @@ enum pnfs_update_layout_reason { · 659 unmodified lines | |||
| 660 | PNFS_UPDATE_LAYOUT_BLOCKED, | 660 | PNFS_UPDATE_LAYOUT_BLOCKED, |
| 661 | PNFS_UPDATE_LAYOUT_INVALID_OPEN, | 661 | PNFS_UPDATE_LAYOUT_INVALID_OPEN, |
| 662 | PNFS_UPDATE_LAYOUT_SEND_LAYOUTGET, | 662 | PNFS_UPDATE_LAYOUT_SEND_LAYOUTGET, |
| 663 | PNFS_UPDATE_LAYOUT_EXIT, | ||
| 663 | }; | 664 | }; |
| 664 | 665 | ||
| 665 | #define NFS4_OP_MAP_NUM_LONGS \ | 666 | #define NFS4_OP_MAP_NUM_LONGS \ |
| @@ -223,6 +223,8 @@ struct nfs4_copy_state { · 222 unmodified lines | |||
| 223 | #define NFS_INO_INVALID_MTIME BIT(10) /* cached mtime is invalid */ | 223 | #define NFS_INO_INVALID_MTIME BIT(10) /* cached mtime is invalid */ |
| 224 | #define NFS_INO_INVALID_SIZE BIT(11) /* cached size is invalid */ | 224 | #define NFS_INO_INVALID_SIZE BIT(11) /* cached size is invalid */ |
| 225 | #define NFS_INO_INVALID_OTHER BIT(12) /* other attrs are invalid */ | 225 | #define NFS_INO_INVALID_OTHER BIT(12) /* other attrs are invalid */ |
| 226 | #define NFS_INO_DATA_INVAL_DEFER \ | ||
| 227 | BIT(13) /* Deferred cache invalidation */ | ||
| 226 | 228 | ||
| 227 | #define NFS_INO_INVALID_ATTR (NFS_INO_INVALID_CHANGE \ | 229 | #define NFS_INO_INVALID_ATTR (NFS_INO_INVALID_CHANGE \ |
| 228 | | NFS_INO_INVALID_CTIME \ | 230 | | NFS_INO_INVALID_CTIME \ |
| @@ -58,6 +58,7 @@ struct nfs_client { · 57 unmodified lines | |||
| 58 | struct nfs_subversion * cl_nfs_mod; /* pointer to nfs version module */ | 58 | struct nfs_subversion * cl_nfs_mod; /* pointer to nfs version module */ |
| 59 | 59 | ||
| 60 | u32 cl_minorversion;/* NFSv4 minorversion */ | 60 | u32 cl_minorversion;/* NFSv4 minorversion */ |
| 61 | unsigned int cl_nconnect; /* Number of connections */ | ||
| 61 | const char * cl_principal; /* used for machine cred */ | 62 | const char * cl_principal; /* used for machine cred */ |
| 62 | 63 | ||
| 63 | #if IS_ENABLED(CONFIG_NFS_V4) | 64 | #if IS_ENABLED(CONFIG_NFS_V4) |
| @@ -137,10 +137,7 @@ static inline int register_one_node(int nid) · 136 unmodified lines | |||
| 137 | extern void unregister_one_node(int nid); | 137 | extern void unregister_one_node(int nid); |
| 138 | extern int register_cpu_under_node(unsigned int cpu, unsigned int nid); | 138 | extern int register_cpu_under_node(unsigned int cpu, unsigned int nid); |
| 139 | extern int unregister_cpu_under_node(unsigned int cpu, unsigned int nid); | 139 | extern int unregister_cpu_under_node(unsigned int cpu, unsigned int nid); |
| 140 | extern int register_mem_sect_under_node(struct memory_block *mem_blk, | 140 | extern void unregister_memory_block_under_nodes(struct memory_block *mem_blk); |
| 141 | void *arg); | ||
| 142 | extern int unregister_mem_sect_under_nodes(struct memory_block *mem_blk, | ||
| 143 | unsigned long phys_index); | ||
| 144 | 141 | ||
| 145 | extern int register_memory_node_under_compute_node(unsigned int mem_nid, | 142 | extern int register_memory_node_under_compute_node(unsigned int mem_nid, |
| 146 | unsigned int cpu_nid, | 143 | unsigned int cpu_nid, |
| @@ -171,15 +168,8 @@ static inline int unregister_cpu_under_node(unsigned int cpu, unsigned int nid) · 24 unmodified lines | |||
| 171 | { | 168 | { |
| 172 | return 0; | 169 | return 0; |
| 173 | } | 170 | } |
| 174 | static inline int register_mem_sect_under_node(struct memory_block *mem_blk, | 171 | static inline void unregister_memory_block_under_nodes(struct memory_block *mem_blk) |
| 175 | void *arg) | ||
| 176 | { | 172 | { |
| 177 | return 0; | ||
| 178 | } | ||
| 179 | static inline int unregister_mem_sect_under_nodes(struct memory_block *mem_blk, | ||
| 180 | unsigned long phys_index) | ||
| 181 | { | ||
| 182 | return 0; | ||
| 183 | } | 173 | } |
| 184 | 174 | ||
| 185 | static inline void register_hugetlbfs_with_node(node_registration_func_t reg, | 175 | static inline void register_hugetlbfs_with_node(node_registration_func_t reg, |
| @@ -58,9 +58,11 @@ · 57 unmodified lines | |||
| 58 | 58 | ||
| 59 | #include <linux/completion.h> | 59 | #include <linux/completion.h> |
| 60 | #include <linux/device.h> | 60 | #include <linux/device.h> |
| 61 | #include <linux/interrupt.h> | ||
| 61 | 62 | ||
| 62 | struct ntb_client; | 63 | struct ntb_client; |
| 63 | struct ntb_dev; | 64 | struct ntb_dev; |
| 65 | struct ntb_msi; | ||
| 64 | struct pci_dev; | 66 | struct pci_dev; |
| 65 | 67 | ||
| 66 | /** | 68 | /** |
| @@ -205,7 +207,7 @@ static inline int ntb_ctx_ops_is_valid(const struct ntb_ctx_ops *ops) · 138 unmodified lines | |||
| 205 | } | 207 | } |
| 206 | 208 | ||
| 207 | /** | 209 | /** |
| 208 | * struct ntb_ctx_ops - ntb device operations | 210 | * struct ntb_dev_ops - ntb device operations |
| 209 | * @port_number: See ntb_port_number(). | 211 | * @port_number: See ntb_port_number(). |
| 210 | * @peer_port_count: See ntb_peer_port_count(). | 212 | * @peer_port_count: See ntb_peer_port_count(). |
| 211 | * @peer_port_number: See ntb_peer_port_number(). | 213 | * @peer_port_number: See ntb_peer_port_number(). |
| @@ -404,7 +406,7 @@ struct ntb_client { · 192 unmodified lines | |||
| 404 | #define drv_ntb_client(__drv) container_of((__drv), struct ntb_client, drv) | 406 | #define drv_ntb_client(__drv) container_of((__drv), struct ntb_client, drv) |
| 405 | 407 | ||
| 406 | /** | 408 | /** |
| 407 | * struct ntb_device - ntb device | 409 | * struct ntb_dev - ntb device |
| 408 | * @dev: Linux device object. | 410 | * @dev: Linux device object. |
| 409 | * @pdev: PCI device entry of the ntb. | 411 | * @pdev: PCI device entry of the ntb. |
| 410 | * @topo: Detected topology of the ntb. | 412 | * @topo: Detected topology of the ntb. |
| @@ -426,6 +428,10 @@ struct ntb_dev { · 15 unmodified lines | |||
| 426 | spinlock_t ctx_lock; | 428 | spinlock_t ctx_lock; |
| 427 | /* block unregister until device is fully released */ | 429 | /* block unregister until device is fully released */ |
| 428 | struct completion released; | 430 | struct completion released; |
| 431 | |||
| 432 | #ifdef CONFIG_NTB_MSI | ||
| 433 | struct ntb_msi *msi; | ||
| 434 | #endif | ||
| 429 | }; | 435 | }; |
| 430 | #define dev_ntb(__dev) container_of((__dev), struct ntb_dev, dev) | 436 | #define dev_ntb(__dev) container_of((__dev), struct ntb_dev, dev) |
| 431 | 437 | ||
| @@ -616,7 +622,6 @@ static inline int ntb_port_number(struct ntb_dev *ntb) · 184 unmodified lines | |||
| 616 | 622 | ||
| 617 | return ntb->ops->port_number(ntb); | 623 | return ntb->ops->port_number(ntb); |
| 618 | } | 624 | } |
| 619 | |||
| 620 | /** | 625 | /** |
| 621 | * ntb_peer_port_count() - get the number of peer device ports | 626 | * ntb_peer_port_count() - get the number of peer device ports |
| 622 | * @ntb: NTB device context. | 627 | * @ntb: NTB device context. |
| @@ -653,6 +658,58 @@ static inline int ntb_peer_port_number(struct ntb_dev *ntb, int pidx) · 30 unmodified lines | |||
| 653 | return ntb->ops->peer_port_number(ntb, pidx); | 658 | return ntb->ops->peer_port_number(ntb, pidx); |
| 654 | } | 659 | } |
| 655 | 660 | ||
| 661 | /** | ||
| 662 | * ntb_logical_port_number() - get the logical port number of the local port | ||
| 663 | * @ntb: NTB device context. | ||
| 664 | * | ||
| 665 | * The Logical Port Number is defined to be a unique number for each | ||
| 666 | * port starting from zero through to the number of ports minus one. | ||
| 667 | * This is in contrast to the Port Number where each port can be assigned | ||
| 668 | * any unique physical number by the hardware. | ||
| 669 | * | ||
| 670 | * The logical port number is useful for calculating the resource indexes | ||
| 671 | * used by peers. | ||
| 672 | * | ||
| 673 | * Return: the logical port number or negative value indicating an error | ||
| 674 | */ | ||
| 675 | static inline int ntb_logical_port_number(struct ntb_dev *ntb) | ||
| 676 | { | ||
| 677 | int lport = ntb_port_number(ntb); | ||
| 678 | int pidx; | ||
| 679 | |||
| 680 | if (lport < 0) | ||
| 681 | return lport; | ||
| 682 | |||
| 683 | for (pidx = 0; pidx < ntb_peer_port_count(ntb); pidx++) | ||
| 684 | if (lport <= ntb_peer_port_number(ntb, pidx)) | ||
| 685 | return pidx; | ||
| 686 | |||
| 687 | return pidx; | ||
| 688 | } | ||
| 689 | |||
| 690 | /** | ||
| 691 | * ntb_peer_logical_port_number() - get the logical peer port by given index | ||
| 692 | * @ntb: NTB device context. | ||
| 693 | * @pidx: Peer port index. | ||
| 694 | * | ||
| 695 | * The Logical Port Number is defined to be a unique number for each | ||
| 696 | * port starting from zero through to the number of ports minus one. | ||
| 697 | * This is in contrast to the Port Number where each port can be assigned | ||
| 698 | * any unique physical number by the hardware. | ||
| 699 | * | ||
| 700 | * The logical port number is useful for calculating the resource indexes | ||
| 701 | * used by peers. | ||
| 702 | * | ||
| 703 | * Return: the peer's logical port number or negative value indicating an error | ||
| 704 | */ | ||
| 705 | static inline int ntb_peer_logical_port_number(struct ntb_dev *ntb, int pidx) | ||
| 706 | { | ||
| 707 | if (ntb_peer_port_number(ntb, pidx) < ntb_port_number(ntb)) | ||
| 708 | return pidx; | ||
| 709 | else | ||
| 710 | return pidx + 1; | ||
| 711 | } | ||
| 712 | |||
| 656 | /** | 713 | /** |
| 657 | * ntb_peer_port_idx() - get the peer device port index by given port number | 714 | * ntb_peer_port_idx() - get the peer device port index by given port number |
| 658 | * @ntb: NTB device context. | 715 | * @ntb: NTB device context. |
| @@ -1506,4 +1563,141 @@ static inline int ntb_peer_msg_write(struct ntb_dev *ntb, int pidx, int midx, · 847 unmodified lines | |||
| 1506 | return ntb->ops->peer_msg_write(ntb, pidx, midx, msg); | 1563 | return ntb->ops->peer_msg_write(ntb, pidx, midx, msg); |
| 1507 | } | 1564 | } |
| 1508 | 1565 | ||
| 1566 | /** | ||
| 1567 | * ntb_peer_resource_idx() - get a resource index for a given peer idx | ||
| 1568 | * @ntb: NTB device context. | ||
| 1569 | * @pidx: Peer port index. | ||
| 1570 | * | ||
| 1571 | * When constructing a graph of peers, each remote peer must use a different | ||
| 1572 | * resource index (mw, doorbell, etc) to communicate with each other | ||
| 1573 | * peer. | ||
| 1574 | * | ||
| 1575 | * In a two peer system, this function should always return 0 such that | ||
| 1576 | * resource 0 points to the remote peer on both ports. | ||
| 1577 | * | ||
| 1578 | * In a 5 peer system, this function will return the following matrix | ||
| 1579 | * | ||
| 1580 | * pidx \ port 0 1 2 3 4 | ||
| 1581 | * 0 0 0 1 2 3 | ||
| 1582 | * 1 0 1 1 2 3 | ||
| 1583 | * 2 0 1 2 2 3 | ||
| 1584 | * 3 0 1 2 3 3 | ||
| 1585 | * | ||
| 1586 | * For example, if this function is used to program peer's memory | ||
| 1587 | * windows, port 0 will program MW 0 on all it's peers to point to itself. | ||
| 1588 | * port 1 will program MW 0 in port 0 to point to itself and MW 1 on all | ||
| 1589 | * other ports. etc. | ||
| 1590 | * | ||
| 1591 | * For the legacy two host case, ntb_port_number() and ntb_peer_port_number() | ||
| 1592 | * both return zero and therefore this function will always return zero. | ||
| 1593 | * So MW 0 on each host would be programmed to point to the other host. | ||
| 1594 | * | ||
| 1595 | * Return: the resource index to use for that peer. | ||
| 1596 | */ | ||
| 1597 | static inline int ntb_peer_resource_idx(struct ntb_dev *ntb, int pidx) | ||
| 1598 | { | ||
| 1599 | int local_port, peer_port; | ||
| 1600 | |||
| 1601 | if (pidx >= ntb_peer_port_count(ntb)) | ||
| 1602 | return -EINVAL; | ||
| 1603 | |||
| 1604 | local_port = ntb_logical_port_number(ntb); | ||
| 1605 | peer_port = ntb_peer_logical_port_number(ntb, pidx); | ||
| 1606 | |||
| 1607 | if (peer_port < local_port) | ||
| 1608 | return local_port - 1; | ||
| 1609 | else | ||
| 1610 | return local_port; | ||
| 1611 | } | ||
| 1612 | |||
| 1613 | /** | ||
| 1614 | * ntb_peer_highest_mw_idx() - get a memory window index for a given peer idx | ||
| 1615 | * using the highest index memory windows first | ||
| 1616 | * | ||
| 1617 | * @ntb: NTB device context. | ||
| 1618 | * @pidx: Peer port index. | ||
| 1619 | * | ||
| 1620 | * Like ntb_peer_resource_idx(), except it returns indexes starting with | ||
| 1621 | * last memory window index. | ||
| 1622 | * | ||
| 1623 | * Return: the resource index to use for that peer. | ||
| 1624 | */ | ||
| 1625 | static inline int ntb_peer_highest_mw_idx(struct ntb_dev *ntb, int pidx) | ||
| 1626 | { | ||
| 1627 | int ret; | ||
| 1628 | |||
| 1629 | ret = ntb_peer_resource_idx(ntb, pidx); | ||
| 1630 | if (ret < 0) | ||
| 1631 | return ret; | ||
| 1632 | |||
| 1633 | return ntb_mw_count(ntb, pidx) - ret - 1; | ||
| 1634 | } | ||
| 1635 | |||
| 1636 | struct ntb_msi_desc { | ||
| 1637 | u32 addr_offset; | ||
| 1638 | u32 data; | ||
| 1639 | }; | ||
| 1640 | |||
| 1641 | #ifdef CONFIG_NTB_MSI | ||
| 1642 | |||
| 1643 | int ntb_msi_init(struct ntb_dev *ntb, void (*desc_changed)(void *ctx)); | ||
| 1644 | int ntb_msi_setup_mws(struct ntb_dev *ntb); | ||
| 1645 | void ntb_msi_clear_mws(struct ntb_dev *ntb); | ||
| 1646 | int ntbm_msi_request_threaded_irq(struct ntb_dev *ntb, irq_handler_t handler, | ||
| 1647 | irq_handler_t thread_fn, | ||
| 1648 | const char *name, void *dev_id, | ||
| 1649 | struct ntb_msi_desc *msi_desc); | ||
| 1650 | void ntbm_msi_free_irq(struct ntb_dev *ntb, unsigned int irq, void *dev_id); | ||
| 1651 | int ntb_msi_peer_trigger(struct ntb_dev *ntb, int peer, | ||
| 1652 | struct ntb_msi_desc *desc); | ||
| 1653 | int ntb_msi_peer_addr(struct ntb_dev *ntb, int peer, | ||
| 1654 | struct ntb_msi_desc *desc, | ||
| 1655 | phys_addr_t *msi_addr); | ||
| 1656 | |||
| 1657 | #else /* not CONFIG_NTB_MSI */ | ||
| 1658 | |||
| 1659 | static inline int ntb_msi_init(struct ntb_dev *ntb, | ||
| 1660 | void (*desc_changed)(void *ctx)) | ||
| 1661 | { | ||
| 1662 | return -EOPNOTSUPP; | ||
| 1663 | } | ||
| 1664 | static inline int ntb_msi_setup_mws(struct ntb_dev *ntb) | ||
| 1665 | { | ||
| 1666 | return -EOPNOTSUPP; | ||
| 1667 | } | ||
| 1668 | static inline void ntb_msi_clear_mws(struct ntb_dev *ntb) {} | ||
| 1669 | static inline int ntbm_msi_request_threaded_irq(struct ntb_dev *ntb, | ||
| 1670 | irq_handler_t handler, | ||
| 1671 | irq_handler_t thread_fn, | ||
| 1672 | const char *name, void *dev_id, | ||
| 1673 | struct ntb_msi_desc *msi_desc) | ||
| 1674 | { | ||
| 1675 | return -EOPNOTSUPP; | ||
| 1676 | } | ||
| 1677 | static inline void ntbm_msi_free_irq(struct ntb_dev *ntb, unsigned int irq, | ||
| 1678 | void *dev_id) {} | ||
| 1679 | static inline int ntb_msi_peer_trigger(struct ntb_dev *ntb, int peer, | ||
| 1680 | struct ntb_msi_desc *desc) | ||
| 1681 | { | ||
| 1682 | return -EOPNOTSUPP; | ||
| 1683 | } | ||
| 1684 | static inline int ntb_msi_peer_addr(struct ntb_dev *ntb, int peer, | ||
| 1685 | struct ntb_msi_desc *desc, | ||
| 1686 | phys_addr_t *msi_addr) | ||
| 1687 | { | ||
| 1688 | return -EOPNOTSUPP; | ||
| 1689 | |||
| 1690 | } | ||
| 1691 | |||
| 1692 | #endif /* CONFIG_NTB_MSI */ | ||
| 1693 | |||
| 1694 | static inline int ntbm_msi_request_irq(struct ntb_dev *ntb, | ||
| 1695 | irq_handler_t handler, | ||
| 1696 | const char *name, void *dev_id, | ||
| 1697 | struct ntb_msi_desc *msi_desc) | ||
| 1698 | { | ||
| 1699 | return ntbm_msi_request_threaded_irq(ntb, handler, NULL, name, | ||
| 1700 | dev_id, msi_desc); | ||
| 1701 | } | ||
| 1702 | |||
| 1509 | #endif | 1703 | #endif |
| @@ -791,6 +791,11 @@ struct nvmet_fc_target_port { · 790 unmodified lines | |||
| 791 | * nvmefc_tgt_fcp_req. | 791 | * nvmefc_tgt_fcp_req. |
| 792 | * Entrypoint is Optional. | 792 | * Entrypoint is Optional. |
| 793 | * | 793 | * |
| 794 | * @discovery_event: Called by the transport to generate an RSCN | ||
| 795 | * change notifications to NVME initiators. The RSCN notifications | ||
| 796 | * should cause the initiator to rescan the discovery controller | ||
| 797 | * on the targetport. | ||
| 798 | * | ||
| 794 | * @max_hw_queues: indicates the maximum number of hw queues the LLDD | 799 | * @max_hw_queues: indicates the maximum number of hw queues the LLDD |
| 795 | * supports for cpu affinitization. | 800 | * supports for cpu affinitization. |
| 796 | * Value is Mandatory. Must be at least 1. | 801 | * Value is Mandatory. Must be at least 1. |
| @@ -832,6 +837,7 @@ struct nvmet_fc_target_template { · 35 unmodified lines | |||
| 832 | struct nvmefc_tgt_fcp_req *fcpreq); | 837 | struct nvmefc_tgt_fcp_req *fcpreq); |
| 833 | void (*defer_rcv)(struct nvmet_fc_target_port *tgtport, | 838 | void (*defer_rcv)(struct nvmet_fc_target_port *tgtport, |
| 834 | struct nvmefc_tgt_fcp_req *fcpreq); | 839 | struct nvmefc_tgt_fcp_req *fcpreq); |
| 840 | void (*discovery_event)(struct nvmet_fc_target_port *tgtport); | ||
| 835 | 841 | ||
| 836 | u32 max_hw_queues; | 842 | u32 max_hw_queues; |
| 837 | u16 max_sgl_segments; | 843 | u16 max_sgl_segments; |
| @@ -315,7 +315,7 @@ struct nvme_id_ns { · 314 unmodified lines | |||
| 315 | __u8 nmic; | 315 | __u8 nmic; |
| 316 | __u8 rescap; | 316 | __u8 rescap; |
| 317 | __u8 fpi; | 317 | __u8 fpi; |
| 318 | __u8 rsvd33; | 318 | __u8 dlfeat; |
| 319 | __le16 nawun; | 319 | __le16 nawun; |
| 320 | __le16 nawupf; | 320 | __le16 nawupf; |
| 321 | __le16 nacwu; | 321 | __le16 nacwu; |
| @@ -324,11 +324,17 @@ struct nvme_id_ns { · 2 unmodified lines | |||
| 324 | __le16 nabspf; | 324 | __le16 nabspf; |
| 325 | __le16 noiob; | 325 | __le16 noiob; |
| 326 | __u8 nvmcap[16]; | 326 | __u8 nvmcap[16]; |
| 327 | __u8 rsvd64[28]; | 327 | __le16 npwg; |
| 328 | __le16 npwa; | ||
| 329 | __le16 npdg; | ||
| 330 | __le16 npda; | ||
| 331 | __le16 nows; | ||
| 332 | __u8 rsvd74[18]; | ||
| 328 | __le32 anagrpid; | 333 | __le32 anagrpid; |
| 329 | __u8 rsvd96[3]; | 334 | __u8 rsvd96[3]; |
| 330 | __u8 nsattr; | 335 | __u8 nsattr; |
| 331 | __u8 rsvd100[4]; | 336 | __le16 nvmsetid; |
| 337 | __le16 endgid; | ||
| 332 | __u8 nguid[16]; | 338 | __u8 nguid[16]; |
| 333 | __u8 eui64[8]; | 339 | __u8 eui64[8]; |
| 334 | struct nvme_lbaf lbaf[16]; | 340 | struct nvme_lbaf lbaf[16]; |
| @@ -562,6 +568,22 @@ enum nvme_opcode { · 227 unmodified lines | |||
| 562 | nvme_cmd_resv_release = 0x15, | 568 | nvme_cmd_resv_release = 0x15, |
| 563 | }; | 569 | }; |
| 564 | 570 | ||
| 571 | #define nvme_opcode_name(opcode) { opcode, #opcode } | ||
| 572 | #define show_nvm_opcode_name(val) \ | ||
| 573 | __print_symbolic(val, \ | ||
| 574 | nvme_opcode_name(nvme_cmd_flush), \ | ||
| 575 | nvme_opcode_name(nvme_cmd_write), \ | ||
| 576 | nvme_opcode_name(nvme_cmd_read), \ | ||
| 577 | nvme_opcode_name(nvme_cmd_write_uncor), \ | ||
| 578 | nvme_opcode_name(nvme_cmd_compare), \ | ||
| 579 | nvme_opcode_name(nvme_cmd_write_zeroes), \ | ||
| 580 | nvme_opcode_name(nvme_cmd_dsm), \ | ||
| 581 | nvme_opcode_name(nvme_cmd_resv_register), \ | ||
| 582 | nvme_opcode_name(nvme_cmd_resv_report), \ | ||
| 583 | nvme_opcode_name(nvme_cmd_resv_acquire), \ | ||
| 584 | nvme_opcode_name(nvme_cmd_resv_release)) | ||
| 585 | |||
| 586 | |||
| 565 | /* | 587 | /* |
| 566 | * Descriptor subtype - lower 4 bits of nvme_(keyed_)sgl_desc identifier | 588 | * Descriptor subtype - lower 4 bits of nvme_(keyed_)sgl_desc identifier |
| 567 | * | 589 | * |
| @@ -794,6 +816,32 @@ enum nvme_admin_opcode { · 226 unmodified lines | |||
| 794 | nvme_admin_sanitize_nvm = 0x84, | 816 | nvme_admin_sanitize_nvm = 0x84, |
| 795 | }; | 817 | }; |
| 796 | 818 | ||
| 819 | #define nvme_admin_opcode_name(opcode) { opcode, #opcode } | ||
| 820 | #define show_admin_opcode_name(val) \ | ||
| 821 | __print_symbolic(val, \ | ||
| 822 | nvme_admin_opcode_name(nvme_admin_delete_sq), \ | ||
| 823 | nvme_admin_opcode_name(nvme_admin_create_sq), \ | ||
| 824 | nvme_admin_opcode_name(nvme_admin_get_log_page), \ | ||
| 825 | nvme_admin_opcode_name(nvme_admin_delete_cq), \ | ||
| 826 | nvme_admin_opcode_name(nvme_admin_create_cq), \ | ||
| 827 | nvme_admin_opcode_name(nvme_admin_identify), \ | ||
| 828 | nvme_admin_opcode_name(nvme_admin_abort_cmd), \ | ||
| 829 | nvme_admin_opcode_name(nvme_admin_set_features), \ | ||
| 830 | nvme_admin_opcode_name(nvme_admin_get_features), \ | ||
| 831 | nvme_admin_opcode_name(nvme_admin_async_event), \ | ||
| 832 | nvme_admin_opcode_name(nvme_admin_ns_mgmt), \ | ||
| 833 | nvme_admin_opcode_name(nvme_admin_activate_fw), \ | ||
| 834 | nvme_admin_opcode_name(nvme_admin_download_fw), \ | ||
| 835 | nvme_admin_opcode_name(nvme_admin_ns_attach), \ | ||
| 836 | nvme_admin_opcode_name(nvme_admin_keep_alive), \ | ||
| 837 | nvme_admin_opcode_name(nvme_admin_directive_send), \ | ||
| 838 | nvme_admin_opcode_name(nvme_admin_directive_recv), \ | ||
| 839 | nvme_admin_opcode_name(nvme_admin_dbbuf), \ | ||
| 840 | nvme_admin_opcode_name(nvme_admin_format_nvm), \ | ||
| 841 | nvme_admin_opcode_name(nvme_admin_security_send), \ | ||
| 842 | nvme_admin_opcode_name(nvme_admin_security_recv), \ | ||
| 843 | nvme_admin_opcode_name(nvme_admin_sanitize_nvm)) | ||
| 844 | |||
| 797 | enum { | 845 | enum { |
| 798 | NVME_QUEUE_PHYS_CONTIG = (1 << 0), | 846 | NVME_QUEUE_PHYS_CONTIG = (1 << 0), |
| 799 | NVME_CQ_IRQ_ENABLED = (1 << 1), | 847 | NVME_CQ_IRQ_ENABLED = (1 << 1), |
| @@ -1008,6 +1056,23 @@ enum nvmf_capsule_command { · 208 unmodified lines | |||
| 1008 | nvme_fabrics_type_property_get = 0x04, | 1056 | nvme_fabrics_type_property_get = 0x04, |
| 1009 | }; | 1057 | }; |
| 1010 | 1058 | ||
| 1059 | #define nvme_fabrics_type_name(type) { type, #type } | ||
| 1060 | #define show_fabrics_type_name(type) \ | ||
| 1061 | __print_symbolic(type, \ | ||
| 1062 | nvme_fabrics_type_name(nvme_fabrics_type_property_set), \ | ||
| 1063 | nvme_fabrics_type_name(nvme_fabrics_type_connect), \ | ||
| 1064 | nvme_fabrics_type_name(nvme_fabrics_type_property_get)) | ||
| 1065 | |||
| 1066 | /* | ||
| 1067 | * If not fabrics command, fctype will be ignored. | ||
| 1068 | */ | ||
| 1069 | #define show_opcode_name(qid, opcode, fctype) \ | ||
| 1070 | ((opcode) == nvme_fabrics_command ? \ | ||
| 1071 | show_fabrics_type_name(fctype) : \ | ||
| 1072 | ((qid) ? \ | ||
| 1073 | show_nvm_opcode_name(opcode) : \ | ||
| 1074 | show_admin_opcode_name(opcode))) | ||
| 1075 | |||
| 1011 | struct nvmf_common_command { | 1076 | struct nvmf_common_command { |
| 1012 | __u8 opcode; | 1077 | __u8 opcode; |
| 1013 | __u8 resv1; | 1078 | __u8 resv1; |
| @@ -1165,6 +1230,11 @@ struct nvme_command { · 151 unmodified lines | |||
| 1165 | }; | 1230 | }; |
| 1166 | }; | 1231 | }; |
| 1167 | 1232 | ||
| 1233 | static inline bool nvme_is_fabrics(struct nvme_command *cmd) | ||
| 1234 | { | ||
| 1235 | return cmd->common.opcode == nvme_fabrics_command; | ||
| 1236 | } | ||
| 1237 | |||
| 1168 | struct nvme_error_slot { | 1238 | struct nvme_error_slot { |
| 1169 | __le64 error_count; | 1239 | __le64 error_count; |
| 1170 | __le16 sqid; | 1240 | __le16 sqid; |
| @@ -1186,7 +1256,7 @@ static inline bool nvme_is_write(struct nvme_command *cmd) · 15 unmodified lines | |||
| 1186 | * | 1256 | * |
| 1187 | * Why can't we simply have a Fabrics In and Fabrics out command? | 1257 | * Why can't we simply have a Fabrics In and Fabrics out command? |
| 1188 | */ | 1258 | */ |
| 1189 | if (unlikely(cmd->common.opcode == nvme_fabrics_command)) | 1259 | if (unlikely(nvme_is_fabrics(cmd))) |
| 1190 | return cmd->fabrics.fctype & 1; | 1260 | return cmd->fabrics.fctype & 1; |
| 1191 | return cmd->common.opcode & 1; | 1261 | return cmd->common.opcode & 1; |
| 1192 | } | 1262 | } |
| @@ -1164,7 +1164,7 @@ static inline int of_property_read_string_index(const struct device_node *np, · 1163 unmodified lines | |||
| 1164 | } | 1164 | } |
| 1165 | 1165 | ||
| 1166 | /** | 1166 | /** |
| 1167 | * of_property_read_bool - Findfrom a property | 1167 | * of_property_read_bool - Find a property |
| 1168 | * @np: device node from which the property value is to be read. | 1168 | * @np: device node from which the property value is to be read. |
| 1169 | * @propname: name of the property to be searched. | 1169 | * @propname: name of the property to be searched. |
| 1170 | * | 1170 | * |
| @@ -23,15 +23,6 @@ · 22 unmodified lines | |||
| 23 | struct device_node; | 23 | struct device_node; |
| 24 | 24 | ||
| 25 | /* For scanning an arbitrary device-tree at any time */ | 25 | /* For scanning an arbitrary device-tree at any time */ |
| 26 | extern char *of_fdt_get_string(const void *blob, u32 offset); | ||
| 27 | extern void *of_fdt_get_property(const void *blob, | ||
| 28 | unsigned long node, | ||
| 29 | const char *name, | ||
| 30 | int *size); | ||
| 31 | extern bool of_fdt_is_big_endian(const void *blob, | ||
| 32 | unsigned long node); | ||
| 33 | extern int of_fdt_match(const void *blob, unsigned long node, | ||
| 34 | const char *const *compat); | ||
| 35 | extern void *of_fdt_unflatten_tree(const unsigned long *blob, | 26 | extern void *of_fdt_unflatten_tree(const unsigned long *blob, |
| 36 | struct device_node *dad, | 27 | struct device_node *dad, |
| 37 | struct device_node **mynodes); | 28 | struct device_node **mynodes); |
| @@ -64,9 +55,7 @@ extern int of_get_flat_dt_subnode_by_name(unsigned long node, · 26 unmodified lines | |||
| 64 | extern const void *of_get_flat_dt_prop(unsigned long node, const char *name, | 55 | extern const void *of_get_flat_dt_prop(unsigned long node, const char *name, |
| 65 | int *size); | 56 | int *size); |
| 66 | extern int of_flat_dt_is_compatible(unsigned long node, const char *name); | 57 | extern int of_flat_dt_is_compatible(unsigned long node, const char *name); |
| 67 | extern int of_flat_dt_match(unsigned long node, const char *const *matches); | ||
| 68 | extern unsigned long of_get_flat_dt_root(void); | 58 | extern unsigned long of_get_flat_dt_root(void); |
| 69 | extern int of_get_flat_dt_size(void); | ||
| 70 | extern uint32_t of_get_flat_dt_phandle(unsigned long node); | 59 | extern uint32_t of_get_flat_dt_phandle(unsigned long node); |
| 71 | 60 | ||
| 72 | extern int early_init_dt_scan_chosen(unsigned long node, const char *uname, | 61 | extern int early_init_dt_scan_chosen(unsigned long node, const char *uname, |
| @@ -2,6 +2,8 @@ · 1 unmodified line | |||
| 2 | #ifndef _LINUX_OLPC_EC_H | 2 | #ifndef _LINUX_OLPC_EC_H |
| 3 | #define _LINUX_OLPC_EC_H | 3 | #define _LINUX_OLPC_EC_H |
| 4 | 4 | ||
| 5 | #include <linux/bits.h> | ||
| 6 | |||
| 5 | /* XO-1 EC commands */ | 7 | /* XO-1 EC commands */ |
| 6 | #define EC_FIRMWARE_REV 0x08 | 8 | #define EC_FIRMWARE_REV 0x08 |
| 7 | #define EC_WRITE_SCI_MASK 0x1b | 9 | #define EC_WRITE_SCI_MASK 0x1b |
| @@ -16,28 +18,57 @@ · 8 unmodified lines | |||
| 16 | #define EC_SCI_QUERY 0x84 | 18 | #define EC_SCI_QUERY 0x84 |
| 17 | #define EC_EXT_SCI_QUERY 0x85 | 19 | #define EC_EXT_SCI_QUERY 0x85 |
| 18 | 20 | ||
| 21 | /* SCI source values */ | ||
| 22 | #define EC_SCI_SRC_GAME BIT(0) | ||
| 23 | #define EC_SCI_SRC_BATTERY BIT(1) | ||
| 24 | #define EC_SCI_SRC_BATSOC BIT(2) | ||
| 25 | #define EC_SCI_SRC_BATERR BIT(3) | ||
| 26 | #define EC_SCI_SRC_EBOOK BIT(4) /* XO-1 only */ | ||
| 27 | #define EC_SCI_SRC_WLAN BIT(5) /* XO-1 only */ | ||
| 28 | #define EC_SCI_SRC_ACPWR BIT(6) | ||
| 29 | #define EC_SCI_SRC_BATCRIT BIT(7) | ||
| 30 | #define EC_SCI_SRC_GPWAKE BIT(8) /* XO-1.5 only */ | ||
| 31 | #define EC_SCI_SRC_ALL GENMASK(8, 0) | ||
| 32 | |||
| 19 | struct platform_device; | 33 | struct platform_device; |
| 20 | 34 | ||
| 21 | struct olpc_ec_driver { | 35 | struct olpc_ec_driver { |
| 22 | int (*probe)(struct platform_device *); | ||
| 23 | int (*suspend)(struct platform_device *); | 36 | int (*suspend)(struct platform_device *); |
| 24 | int (*resume)(struct platform_device *); | 37 | int (*resume)(struct platform_device *); |
| 25 | 38 | ||
| 26 | int (*ec_cmd)(u8, u8 *, size_t, u8 *, size_t, void *); | 39 | int (*ec_cmd)(u8, u8 *, size_t, u8 *, size_t, void *); |
| 40 | |||
| 41 | bool wakeup_available; | ||
| 27 | }; | 42 | }; |
| 28 | 43 | ||
| 29 | #ifdef CONFIG_OLPC | 44 | #ifdef CONFIG_OLPC_EC |
| 30 | 45 | ||
| 31 | extern void olpc_ec_driver_register(struct olpc_ec_driver *drv, void *arg); | 46 | extern void olpc_ec_driver_register(struct olpc_ec_driver *drv, void *arg); |
| 32 | 47 | ||
| 33 | extern int olpc_ec_cmd(u8 cmd, u8 *inbuf, size_t inlen, u8 *outbuf, | 48 | extern int olpc_ec_cmd(u8 cmd, u8 *inbuf, size_t inlen, u8 *outbuf, |
| 34 | size_t outlen); | 49 | size_t outlen); |
| 35 | 50 | ||
| 51 | extern void olpc_ec_wakeup_set(u16 value); | ||
| 52 | extern void olpc_ec_wakeup_clear(u16 value); | ||
| 53 | |||
| 54 | extern int olpc_ec_mask_write(u16 bits); | ||
| 55 | extern int olpc_ec_sci_query(u16 *sci_value); | ||
| 56 | |||
| 57 | extern bool olpc_ec_wakeup_available(void); | ||
| 58 | |||
| 36 | #else | 59 | #else |
| 37 | 60 | ||
| 38 | static inline int olpc_ec_cmd(u8 cmd, u8 *inbuf, size_t inlen, u8 *outbuf, | 61 | static inline int olpc_ec_cmd(u8 cmd, u8 *inbuf, size_t inlen, u8 *outbuf, |
| 39 | size_t outlen) { return -ENODEV; } | 62 | size_t outlen) { return -ENODEV; } |
| 40 | 63 | ||
| 41 | #endif /* CONFIG_OLPC */ | 64 | static inline void olpc_ec_wakeup_set(u16 value) { } |
| 65 | static inline void olpc_ec_wakeup_clear(u16 value) { } | ||
| 66 | |||
| 67 | static inline bool olpc_ec_wakeup_available(void) | ||
| 68 | { | ||
| 69 | return false; | ||
| 70 | } | ||
| 71 | |||
| 72 | #endif /* CONFIG_OLPC_EC */ | ||
| 42 | 73 | ||
| 43 | #endif /* _LINUX_OLPC_EC_H */ | 74 | #endif /* _LINUX_OLPC_EC_H */ |
| @@ -6,7 +6,9 @@ · 5 unmodified lines | |||
| 6 | #ifndef OMAP_MAILBOX_H | 6 | #ifndef OMAP_MAILBOX_H |
| 7 | #define OMAP_MAILBOX_H | 7 | #define OMAP_MAILBOX_H |
| 8 | 8 | ||
| 9 | typedef u32 mbox_msg_t; | 9 | typedef uintptr_t mbox_msg_t; |
| 10 | |||
| 11 | #define omap_mbox_message(data) (u32)(mbox_msg_t)(data) | ||
| 10 | 12 | ||
| 11 | typedef int __bitwise omap_mbox_irq_t; | 13 | typedef int __bitwise omap_mbox_irq_t; |
| 12 | #define IRQ_TX ((__force omap_mbox_irq_t) 1) | 14 | #define IRQ_TX ((__force omap_mbox_irq_t) 1) |
| @@ -108,7 +108,6 @@ static inline vm_fault_t check_stable_address_space(struct mm_struct *mm) · 107 unmodified lines | |||
| 108 | bool __oom_reap_task_mm(struct mm_struct *mm); | 108 | bool __oom_reap_task_mm(struct mm_struct *mm); |
| 109 | 109 | ||
| 110 | extern unsigned long oom_badness(struct task_struct *p, | 110 | extern unsigned long oom_badness(struct task_struct *p, |
| 111 | struct mem_cgroup *memcg, const nodemask_t *nodemask, | ||
| 112 | unsigned long totalpages); | 111 | unsigned long totalpages); |
| 113 | 112 | ||
| 114 | extern bool out_of_memory(struct oom_control *oc); | 113 | extern bool out_of_memory(struct oom_control *oc); |
| @@ -32,6 +32,7 @@ · 31 unmodified lines | |||
| 32 | 32 | ||
| 33 | #endif /* CONFIG_SPARSEMEM */ | 33 | #endif /* CONFIG_SPARSEMEM */ |
| 34 | 34 | ||
| 35 | #ifndef BUILD_VDSO32_64 | ||
| 35 | /* | 36 | /* |
| 36 | * page->flags layout: | 37 | * page->flags layout: |
| 37 | * | 38 | * |
| @@ -76,20 +77,22 @@ · 38 unmodified lines | |||
| 76 | #define LAST_CPUPID_SHIFT 0 | 77 | #define LAST_CPUPID_SHIFT 0 |
| 77 | #endif | 78 | #endif |
| 78 | 79 | ||
| 79 | #if SECTIONS_WIDTH+ZONES_WIDTH+NODES_SHIFT+LAST_CPUPID_SHIFT <= BITS_PER_LONG - NR_PAGEFLAGS | 80 | #ifdef CONFIG_KASAN_SW_TAGS |
| 81 | #define KASAN_TAG_WIDTH 8 | ||
| 82 | #else | ||
| 83 | #define KASAN_TAG_WIDTH 0 | ||
| 84 | #endif | ||
| 85 | |||
| 86 | #if SECTIONS_WIDTH+ZONES_WIDTH+NODES_SHIFT+LAST_CPUPID_SHIFT+KASAN_TAG_WIDTH \ | ||
| 87 | <= BITS_PER_LONG - NR_PAGEFLAGS | ||
| 80 | #define LAST_CPUPID_WIDTH LAST_CPUPID_SHIFT | 88 | #define LAST_CPUPID_WIDTH LAST_CPUPID_SHIFT |
| 81 | #else | 89 | #else |
| 82 | #define LAST_CPUPID_WIDTH 0 | 90 | #define LAST_CPUPID_WIDTH 0 |
| 83 | #endif | 91 | #endif |
| 84 | 92 | ||
| 85 | #ifdef CONFIG_KASAN_SW_TAGS | ||
| 86 | #define KASAN_TAG_WIDTH 8 | ||
| 87 | #if SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH+LAST_CPUPID_WIDTH+KASAN_TAG_WIDTH \ | 93 | #if SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH+LAST_CPUPID_WIDTH+KASAN_TAG_WIDTH \ |
| 88 | > BITS_PER_LONG - NR_PAGEFLAGS | 94 | > BITS_PER_LONG - NR_PAGEFLAGS |
| 89 | #error "KASAN: not enough bits in page flags for tag" | 95 | #error "Not enough bits in page flags" |
| 90 | #endif | ||
| 91 | #else | ||
| 92 | #define KASAN_TAG_WIDTH 0 | ||
| 93 | #endif | 96 | #endif |
| 94 | 97 | ||
| 95 | /* | 98 | /* |
| @@ -104,4 +107,5 @@ · 8 unmodified lines | |||
| 104 | #define LAST_CPUPID_NOT_IN_PAGE_FLAGS | 107 | #define LAST_CPUPID_NOT_IN_PAGE_FLAGS |
| 105 | #endif | 108 | #endif |
| 106 | 109 | ||
| 110 | #endif | ||
| 107 | #endif /* _LINUX_PAGE_FLAGS_LAYOUT */ | 111 | #endif /* _LINUX_PAGE_FLAGS_LAYOUT */ |
| @@ -152,6 +152,8 @@ enum pageflags { · 151 unmodified lines | |||
| 152 | PG_savepinned = PG_dirty, | 152 | PG_savepinned = PG_dirty, |
| 153 | /* Has a grant mapping of another (foreign) domain's page. */ | 153 | /* Has a grant mapping of another (foreign) domain's page. */ |
| 154 | PG_foreign = PG_owner_priv_1, | 154 | PG_foreign = PG_owner_priv_1, |
| 155 | /* Remapped by swiotlb-xen. */ | ||
| 156 | PG_xen_remapped = PG_owner_priv_1, | ||
| 155 | 157 | ||
| 156 | /* SLOB */ | 158 | /* SLOB */ |
| 157 | PG_slob_free = PG_private, | 159 | PG_slob_free = PG_private, |
| @@ -329,6 +331,8 @@ PAGEFLAG(Pinned, pinned, PF_NO_COMPOUND) · 171 unmodified lines | |||
| 329 | TESTSCFLAG(Pinned, pinned, PF_NO_COMPOUND) | 331 | TESTSCFLAG(Pinned, pinned, PF_NO_COMPOUND) |
| 330 | PAGEFLAG(SavePinned, savepinned, PF_NO_COMPOUND); | 332 | PAGEFLAG(SavePinned, savepinned, PF_NO_COMPOUND); |
| 331 | PAGEFLAG(Foreign, foreign, PF_NO_COMPOUND); | 333 | PAGEFLAG(Foreign, foreign, PF_NO_COMPOUND); |
| 334 | PAGEFLAG(XenRemapped, xen_remapped, PF_NO_COMPOUND) | ||
| 335 | TESTCLEARFLAG(XenRemapped, xen_remapped, PF_NO_COMPOUND) | ||
| 332 | 336 | ||
| 333 | PAGEFLAG(Reserved, reserved, PF_NO_COMPOUND) | 337 | PAGEFLAG(Reserved, reserved, PF_NO_COMPOUND) |
| 334 | __CLEARPAGEFLAG(Reserved, reserved, PF_NO_COMPOUND) | 338 | __CLEARPAGEFLAG(Reserved, reserved, PF_NO_COMPOUND) |
| @@ -703,6 +707,7 @@ PAGEFLAG_FALSE(DoubleMap) · 368 unmodified lines | |||
| 703 | #define PG_offline 0x00000100 | 707 | #define PG_offline 0x00000100 |
| 704 | #define PG_kmemcg 0x00000200 | 708 | #define PG_kmemcg 0x00000200 |
| 705 | #define PG_table 0x00000400 | 709 | #define PG_table 0x00000400 |
| 710 | #define PG_guard 0x00000800 | ||
| 706 | 711 | ||
| 707 | #define PageType(page, flag) \ | 712 | #define PageType(page, flag) \ |
| 708 | ((page->page_type & (PAGE_TYPE_BASE | flag)) == PAGE_TYPE_BASE) | 713 | ((page->page_type & (PAGE_TYPE_BASE | flag)) == PAGE_TYPE_BASE) |
| @@ -754,6 +759,11 @@ PAGE_TYPE_OPS(Kmemcg, kmemcg) · 45 unmodified lines | |||
| 754 | */ | 759 | */ |
| 755 | PAGE_TYPE_OPS(Table, table) | 760 | PAGE_TYPE_OPS(Table, table) |
| 756 | 761 | ||
| 762 | /* | ||
| 763 | * Marks guardpages used with debug_pagealloc. | ||
| 764 | */ | ||
| 765 | PAGE_TYPE_OPS(Guard, guard) | ||
| 766 | |||
| 757 | extern bool is_free_buddy_page(struct page *page); | 767 | extern bool is_free_buddy_page(struct page *page); |
2 more lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 111 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 109 lines aren’t shown here.
This diff is large: its 157 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 64 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 53 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 134 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 117 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 124 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 42 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 99 lines aren’t shown here.
This diff is large: its 77 lines aren’t shown here.
This diff is large: its 74 lines aren’t shown here.
This diff is large: its 55 lines aren’t shown here.
This diff is large: its 59 lines aren’t shown here.
This diff is large: its 98 lines aren’t shown here.
This diff is large: its 45 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 67 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 81 lines aren’t shown here.
This diff is large: its 56 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 188 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 90 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 60 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 44 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 70 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 53 lines aren’t shown here.
This diff is large: its 90 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 310 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 164 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 89 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 50 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 61 lines aren’t shown here.
This diff is large: its 58 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 50 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 157 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 57 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 41 lines aren’t shown here.
This diff is large: its 47 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 81 lines aren’t shown here.
This diff is large: its 83 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 86 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 79 lines aren’t shown here.