Bug

[В начало]

Ошибка # 185

Показать/спрятать трассу ошибок
Error trace
Function bodies
Blocks
  • Others...
    Function bodies without model function calls
    Initialization function calls
    Initialization function bodies
    Entry point
    Entry point body
    Function calls
    Skipped function calls
    Formal parameter names
    Declarations
    Assumes
    Assume conditions
    Returns
    Return values
    DEG initialization
    DEG function calls
    Model function calls
    Model function bodies
    Model asserts
    Model state changes
    Model function function calls
    Model function function bodies
    Model returns
    Model others
    Identation
    Line numbers
    Expand signs
-__CPAchecker_initialize()
{
20 typedef unsigned char __u8;
23 typedef unsigned short __u16;
25 typedef int __s32;
26 typedef unsigned int __u32;
29 typedef long long __s64;
30 typedef unsigned long long __u64;
15 typedef signed char s8;
16 typedef unsigned char u8;
18 typedef short s16;
19 typedef unsigned short u16;
21 typedef int s32;
22 typedef unsigned int u32;
24 typedef long long s64;
25 typedef unsigned long long u64;
14 typedef long __kernel_long_t;
15 typedef unsigned long __kernel_ulong_t;
27 typedef int __kernel_pid_t;
48 typedef unsigned int __kernel_uid32_t;
49 typedef unsigned int __kernel_gid32_t;
71 typedef __kernel_ulong_t __kernel_size_t;
72 typedef __kernel_long_t __kernel_ssize_t;
87 typedef long long __kernel_loff_t;
88 typedef __kernel_long_t __kernel_time_t;
89 typedef __kernel_long_t __kernel_clock_t;
90 typedef int __kernel_timer_t;
91 typedef int __kernel_clockid_t;
287 struct kernel_symbol { unsigned long value; const char *name; } ;
34 struct module ;
12 typedef __u32 __kernel_dev_t;
15 typedef __kernel_dev_t dev_t;
18 typedef unsigned short umode_t;
21 typedef __kernel_pid_t pid_t;
26 typedef __kernel_clockid_t clockid_t;
29 typedef _Bool bool;
31 typedef __kernel_uid32_t uid_t;
32 typedef __kernel_gid32_t gid_t;
45 typedef __kernel_loff_t loff_t;
54 typedef __kernel_size_t size_t;
59 typedef __kernel_ssize_t ssize_t;
69 typedef __kernel_time_t time_t;
102 typedef __s32 int32_t;
108 typedef __u32 uint32_t;
133 typedef unsigned long sector_t;
134 typedef unsigned long blkcnt_t;
152 typedef u64 dma_addr_t;
157 typedef unsigned int gfp_t;
158 typedef unsigned int fmode_t;
161 typedef u64 phys_addr_t;
166 typedef phys_addr_t resource_size_t;
172 typedef unsigned long irq_hw_number_t;
176 struct __anonstruct_atomic_t_6 { int counter; } ;
176 typedef struct __anonstruct_atomic_t_6 atomic_t;
181 struct __anonstruct_atomic64_t_7 { long counter; } ;
181 typedef struct __anonstruct_atomic64_t_7 atomic64_t;
182 struct list_head { struct list_head *next; struct list_head *prev; } ;
187 struct hlist_node ;
187 struct hlist_head { struct hlist_node *first; } ;
191 struct hlist_node { struct hlist_node *next; struct hlist_node **pprev; } ;
202 struct callback_head { struct callback_head *next; void (*func)(struct callback_head *); } ;
117 typedef void (*ctor_fn_t)();
58 struct device ;
474 struct file_operations ;
486 struct completion ;
487 struct pt_regs ;
546 struct task_struct ;
20 struct qspinlock { atomic_t val; } ;
33 typedef struct qspinlock arch_spinlock_t;
34 struct qrwlock { atomic_t cnts; arch_spinlock_t wait_lock; } ;
14 typedef struct qrwlock arch_rwlock_t;
15 struct lockdep_map ;
23 typedef atomic64_t atomic_long_t;
242 struct bug_entry { int bug_addr_disp; int file_disp; unsigned short line; unsigned short flags; } ;
55 struct stack_trace { unsigned int nr_entries; unsigned int max_entries; unsigned long *entries; int skip; } ;
30 struct lockdep_subclass_key { char __one_byte; } ;
53 struct lock_class_key { struct lockdep_subclass_key subkeys[8U]; } ;
59 struct lock_class { struct hlist_node hash_entry; struct list_head lock_entry; struct lockdep_subclass_key *key; unsigned int subclass; unsigned int dep_gen_id; unsigned long usage_mask; struct stack_trace usage_traces[13U]; struct list_head locks_after; struct list_head locks_before; unsigned int version; unsigned long ops; const char *name; int name_version; unsigned long contention_point[4U]; unsigned long contending_point[4U]; } ;
144 struct lockdep_map { struct lock_class_key *key; struct lock_class *class_cache[2U]; const char *name; int cpu; unsigned long ip; } ;
207 struct held_lock { u64 prev_chain_key; unsigned long acquire_ip; struct lockdep_map *instance; struct lockdep_map *nest_lock; u64 waittime_stamp; u64 holdtime_stamp; unsigned short class_idx; unsigned char irq_context; unsigned char trylock; unsigned char read; unsigned char check; unsigned char hardirqs_off; unsigned short references; unsigned int pin_count; } ;
596 struct raw_spinlock { arch_spinlock_t raw_lock; unsigned int magic; unsigned int owner_cpu; void *owner; struct lockdep_map dep_map; } ;
32 typedef struct raw_spinlock raw_spinlock_t;
33 struct __anonstruct____missing_field_name_39 { u8 __padding[24U]; struct lockdep_map dep_map; } ;
33 union __anonunion____missing_field_name_38 { struct raw_spinlock rlock; struct __anonstruct____missing_field_name_39 __annonCompField4; } ;
33 struct spinlock { union __anonunion____missing_field_name_38 __annonCompField5; } ;
76 typedef struct spinlock spinlock_t;
23 struct __anonstruct_rwlock_t_40 { arch_rwlock_t raw_lock; unsigned int magic; unsigned int owner_cpu; void *owner; struct lockdep_map dep_map; } ;
23 typedef struct __anonstruct_rwlock_t_40 rwlock_t;
23 struct mm_struct ;
72 struct pt_regs { unsigned long r15; unsigned long r14; unsigned long r13; unsigned long r12; unsigned long bp; unsigned long bx; unsigned long r11; unsigned long r10; unsigned long r9; unsigned long r8; unsigned long ax; unsigned long cx; unsigned long dx; unsigned long si; unsigned long di; unsigned long orig_ax; unsigned long ip; unsigned long cs; unsigned long flags; unsigned long sp; unsigned long ss; } ;
66 struct __anonstruct____missing_field_name_42 { unsigned int a; unsigned int b; } ;
66 struct __anonstruct____missing_field_name_43 { u16 limit0; u16 base0; unsigned char base1; unsigned char type; unsigned char s; unsigned char dpl; unsigned char p; unsigned char limit; unsigned char avl; unsigned char l; unsigned char d; unsigned char g; unsigned char base2; } ;
66 union __anonunion____missing_field_name_41 { struct __anonstruct____missing_field_name_42 __annonCompField6; struct __anonstruct____missing_field_name_43 __annonCompField7; } ;
66 struct desc_struct { union __anonunion____missing_field_name_41 __annonCompField8; } ;
13 typedef unsigned long pteval_t;
14 typedef unsigned long pmdval_t;
15 typedef unsigned long pudval_t;
17 typedef unsigned long pgdval_t;
18 typedef unsigned long pgprotval_t;
20 struct __anonstruct_pte_t_44 { pteval_t pte; } ;
20 typedef struct __anonstruct_pte_t_44 pte_t;
22 struct pgprot { pgprotval_t pgprot; } ;
256 typedef struct pgprot pgprot_t;
258 struct __anonstruct_pgd_t_45 { pgdval_t pgd; } ;
258 typedef struct __anonstruct_pgd_t_45 pgd_t;
297 struct __anonstruct_pud_t_47 { pudval_t pud; } ;
297 typedef struct __anonstruct_pud_t_47 pud_t;
318 struct __anonstruct_pmd_t_48 { pmdval_t pmd; } ;
318 typedef struct __anonstruct_pmd_t_48 pmd_t;
460 struct page ;
460 typedef struct page *pgtable_t;
471 struct file ;
482 struct seq_file ;
519 struct thread_struct ;
521 struct cpumask ;
247 struct math_emu_info { long ___orig_eip; struct pt_regs *regs; } ;
83 struct static_key { atomic_t enabled; } ;
380 struct cpumask { unsigned long bits[128U]; } ;
15 typedef struct cpumask cpumask_t;
685 typedef struct cpumask *cpumask_var_t;
22 struct tracepoint_func { void *func; void *data; int prio; } ;
28 struct tracepoint { const char *name; struct static_key key; int (*regfunc)(); void (*unregfunc)(); struct tracepoint_func *funcs; } ;
237 struct fregs_state { u32 cwd; u32 swd; u32 twd; u32 fip; u32 fcs; u32 foo; u32 fos; u32 st_space[20U]; u32 status; } ;
26 struct __anonstruct____missing_field_name_61 { u64 rip; u64 rdp; } ;
26 struct __anonstruct____missing_field_name_62 { u32 fip; u32 fcs; u32 foo; u32 fos; } ;
26 union __anonunion____missing_field_name_60 { struct __anonstruct____missing_field_name_61 __annonCompField14; struct __anonstruct____missing_field_name_62 __annonCompField15; } ;
26 union __anonunion____missing_field_name_63 { u32 padding1[12U]; u32 sw_reserved[12U]; } ;
26 struct fxregs_state { u16 cwd; u16 swd; u16 twd; u16 fop; union __anonunion____missing_field_name_60 __annonCompField16; u32 mxcsr; u32 mxcsr_mask; u32 st_space[32U]; u32 xmm_space[64U]; u32 padding[12U]; union __anonunion____missing_field_name_63 __annonCompField17; } ;
66 struct swregs_state { u32 cwd; u32 swd; u32 twd; u32 fip; u32 fcs; u32 foo; u32 fos; u32 st_space[20U]; u8 ftop; u8 changed; u8 lookahead; u8 no_update; u8 rm; u8 alimit; struct math_emu_info *info; u32 entry_eip; } ;
227 struct xstate_header { u64 xfeatures; u64 xcomp_bv; u64 reserved[6U]; } ;
233 struct xregs_state { struct fxregs_state i387; struct xstate_header header; u8 extended_state_area[0U]; } ;
254 union fpregs_state { struct fregs_state fsave; struct fxregs_state fxsave; struct swregs_state soft; struct xregs_state xsave; u8 __padding[4096U]; } ;
271 struct fpu { unsigned int last_cpu; unsigned char fpstate_active; unsigned char fpregs_active; union fpregs_state state; } ;
174 struct seq_operations ;
416 struct perf_event ;
421 struct __anonstruct_mm_segment_t_75 { unsigned long seg; } ;
421 typedef struct __anonstruct_mm_segment_t_75 mm_segment_t;
422 struct thread_struct { struct desc_struct tls_array[3U]; unsigned long sp0; unsigned long sp; unsigned short es; unsigned short ds; unsigned short fsindex; unsigned short gsindex; u32 status; unsigned long fsbase; unsigned long gsbase; struct perf_event *ptrace_bps[4U]; unsigned long debugreg6; unsigned long ptrace_dr7; unsigned long cr2; unsigned long trap_nr; unsigned long error_code; unsigned long *io_bitmap_ptr; unsigned long iopl; unsigned int io_bitmap_max; mm_segment_t addr_limit; unsigned char sig_on_uaccess_err; unsigned char uaccess_err; struct fpu fpu; } ;
13 struct optimistic_spin_queue { atomic_t tail; } ;
39 struct ww_acquire_ctx ;
40 struct mutex { atomic_long_t owner; spinlock_t wait_lock; struct optimistic_spin_queue osq; struct list_head wait_list; void *magic; struct lockdep_map dep_map; } ;
72 struct mutex_waiter { struct list_head list; struct task_struct *task; struct ww_acquire_ctx *ww_ctx; void *magic; } ;
229 struct timespec ;
230 struct compat_timespec ;
231 struct pollfd ;
232 enum timespec_type { TT_NONE = 0, TT_NATIVE = 1, TT_COMPAT = 2 } ;
238 struct __anonstruct_futex_77 { u32 *uaddr; u32 val; u32 flags; u32 bitset; u64 time; u32 *uaddr2; } ;
238 union __anonunion____missing_field_name_79 { struct timespec *rmtp; struct compat_timespec *compat_rmtp; } ;
238 struct __anonstruct_nanosleep_78 { clockid_t clockid; enum timespec_type type; union __anonunion____missing_field_name_79 __annonCompField20; u64 expires; } ;
238 struct __anonstruct_poll_80 { struct pollfd *ufds; int nfds; int has_timeout; unsigned long tv_sec; unsigned long tv_nsec; } ;
238 union __anonunion____missing_field_name_76 { struct __anonstruct_futex_77 futex; struct __anonstruct_nanosleep_78 nanosleep; struct __anonstruct_poll_80 poll; } ;
238 struct restart_block { long int (*fn)(struct restart_block *); union __anonunion____missing_field_name_76 __annonCompField21; } ;
48 struct thread_info { unsigned long flags; } ;
65 struct radix_tree_root ;
65 union __anonunion____missing_field_name_87 { struct list_head private_list; struct callback_head callback_head; } ;
65 struct radix_tree_node { unsigned char shift; unsigned char offset; unsigned char count; unsigned char exceptional; struct radix_tree_node *parent; struct radix_tree_root *root; union __anonunion____missing_field_name_87 __annonCompField22; void *slots[64U]; unsigned long tags[3U][1U]; } ;
107 struct radix_tree_root { gfp_t gfp_mask; struct radix_tree_node *rnode; } ;
566 struct vm_area_struct ;
31 struct wait_queue_head { spinlock_t lock; struct list_head head; } ;
36 typedef struct wait_queue_head wait_queue_head_t;
950 struct seqcount { unsigned int sequence; struct lockdep_map dep_map; } ;
52 typedef struct seqcount seqcount_t;
97 struct __anonstruct_nodemask_t_101 { unsigned long bits[16U]; } ;
97 typedef struct __anonstruct_nodemask_t_101 nodemask_t;
253 typedef unsigned int isolate_mode_t;
764 struct rw_semaphore ;
765 struct rw_semaphore { atomic_long_t count; struct list_head wait_list; raw_spinlock_t wait_lock; struct optimistic_spin_queue osq; struct task_struct *owner; struct lockdep_map dep_map; } ;
178 struct timespec { __kernel_time_t tv_sec; long tv_nsec; } ;
7 typedef __s64 time64_t;
28 typedef s64 ktime_t;
109 struct timer_list { struct hlist_node entry; unsigned long expires; void (*function)(unsigned long); unsigned long data; u32 flags; struct lockdep_map lockdep_map; } ;
211 struct hrtimer ;
212 enum hrtimer_restart ;
235 struct workqueue_struct ;
236 struct work_struct ;
54 struct work_struct { atomic_long_t data; struct list_head entry; void (*func)(struct work_struct *); struct lockdep_map lockdep_map; } ;
107 struct delayed_work { struct work_struct work; struct timer_list timer; struct workqueue_struct *wq; int cpu; } ;
42 struct completion { unsigned int done; wait_queue_head_t wait; } ;
217 struct resource ;
38 struct ldt_struct ;
38 struct vdso_image ;
38 struct __anonstruct_mm_context_t_166 { struct ldt_struct *ldt; unsigned short ia32_compat; struct mutex lock; void *vdso; const struct vdso_image *vdso_image; atomic_t perf_rdpmc_allowed; u16 pkey_allocation_map; s16 execute_only_pkey; void *bd_addr; } ;
38 typedef struct __anonstruct_mm_context_t_166 mm_context_t;
34 struct bio_vec ;
244 struct irq_data ;
1314 struct llist_node ;
1314 struct llist_head { struct llist_node *first; } ;
69 struct llist_node { struct llist_node *next; } ;
176 struct ida { struct radix_tree_root ida_rt; } ;
216 struct rb_node { unsigned long __rb_parent_color; struct rb_node *rb_right; struct rb_node *rb_left; } ;
41 struct rb_root { struct rb_node *rb_node; } ;
100 struct dentry ;
101 struct iattr ;
102 struct super_block ;
103 struct file_system_type ;
104 struct kernfs_open_node ;
105 struct kernfs_iattrs ;
129 struct kernfs_root ;
129 struct kernfs_elem_dir { unsigned long subdirs; struct rb_root children; struct kernfs_root *root; } ;
86 struct kernfs_node ;
86 struct kernfs_elem_symlink { struct kernfs_node *target_kn; } ;
90 struct kernfs_ops ;
90 struct kernfs_elem_attr { const struct kernfs_ops *ops; struct kernfs_open_node *open; loff_t size; struct kernfs_node *notify_next; } ;
97 union __anonunion____missing_field_name_216 { struct kernfs_elem_dir dir; struct kernfs_elem_symlink symlink; struct kernfs_elem_attr attr; } ;
97 struct kernfs_node { atomic_t count; atomic_t active; struct lockdep_map dep_map; struct kernfs_node *parent; const char *name; struct rb_node rb; const void *ns; unsigned int hash; union __anonunion____missing_field_name_216 __annonCompField33; void *priv; unsigned short flags; umode_t mode; unsigned int ino; struct kernfs_iattrs *iattr; } ;
139 struct kernfs_syscall_ops { int (*remount_fs)(struct kernfs_root *, int *, char *); int (*show_options)(struct seq_file *, struct kernfs_root *); int (*mkdir)(struct kernfs_node *, const char *, umode_t ); int (*rmdir)(struct kernfs_node *); int (*rename)(struct kernfs_node *, struct kernfs_node *, const char *); int (*show_path)(struct seq_file *, struct kernfs_node *, struct kernfs_root *); } ;
158 struct kernfs_root { struct kernfs_node *kn; unsigned int flags; struct ida ino_ida; struct kernfs_syscall_ops *syscall_ops; struct list_head supers; wait_queue_head_t deactivate_waitq; } ;
174 struct vm_operations_struct ;
174 struct kernfs_open_file { struct kernfs_node *kn; struct file *file; struct seq_file *seq_file; void *priv; struct mutex mutex; struct mutex prealloc_mutex; int event; struct list_head list; char *prealloc_buf; size_t atomic_write_len; bool mmapped; bool released; const struct vm_operations_struct *vm_ops; } ;
194 struct kernfs_ops { int (*open)(struct kernfs_open_file *); void (*release)(struct kernfs_open_file *); int (*seq_show)(struct seq_file *, void *); void * (*seq_start)(struct seq_file *, loff_t *); void * (*seq_next)(struct seq_file *, void *, loff_t *); void (*seq_stop)(struct seq_file *, void *); ssize_t (*read)(struct kernfs_open_file *, char *, size_t , loff_t ); size_t atomic_write_len; bool prealloc; ssize_t (*write)(struct kernfs_open_file *, char *, size_t , loff_t ); int (*mmap)(struct kernfs_open_file *, struct vm_area_struct *); struct lock_class_key lockdep_key; } ;
296 struct inode ;
521 struct sock ;
522 struct kobject ;
523 enum kobj_ns_type { KOBJ_NS_TYPE_NONE = 0, KOBJ_NS_TYPE_NET = 1, KOBJ_NS_TYPES = 2 } ;
529 struct kobj_ns_type_operations { enum kobj_ns_type type; bool (*current_may_mount)(); void * (*grab_current_ns)(); const void * (*netlink_ns)(struct sock *); const void * (*initial_ns)(); void (*drop_ns)(void *); } ;
83 struct user_namespace ;
22 struct __anonstruct_kuid_t_219 { uid_t val; } ;
22 typedef struct __anonstruct_kuid_t_219 kuid_t;
27 struct __anonstruct_kgid_t_220 { gid_t val; } ;
27 typedef struct __anonstruct_kgid_t_220 kgid_t;
139 struct kstat { u32 result_mask; umode_t mode; unsigned int nlink; uint32_t blksize; u64 attributes; u64 attributes_mask; u64 ino; dev_t dev; dev_t rdev; kuid_t uid; kgid_t gid; loff_t size; struct timespec atime; struct timespec mtime; struct timespec ctime; struct timespec btime; u64 blocks; } ;
49 struct bin_attribute ;
50 struct attribute { const char *name; umode_t mode; bool ignore_lockdep; struct lock_class_key *key; struct lock_class_key skey; } ;
37 struct attribute_group { const char *name; umode_t (*is_visible)(struct kobject *, struct attribute *, int); umode_t (*is_bin_visible)(struct kobject *, struct bin_attribute *, int); struct attribute **attrs; struct bin_attribute **bin_attrs; } ;
92 struct bin_attribute { struct attribute attr; size_t size; void *private; ssize_t (*read)(struct file *, struct kobject *, struct bin_attribute *, char *, loff_t , size_t ); ssize_t (*write)(struct file *, struct kobject *, struct bin_attribute *, char *, loff_t , size_t ); int (*mmap)(struct file *, struct kobject *, struct bin_attribute *, struct vm_area_struct *); } ;
165 struct sysfs_ops { ssize_t (*show)(struct kobject *, struct attribute *, char *); ssize_t (*store)(struct kobject *, struct attribute *, const char *, size_t ); } ;
7 typedef int MultiMap;
39 struct resource { resource_size_t start; resource_size_t end; const char *name; unsigned long flags; unsigned long desc; struct resource *parent; struct resource *sibling; struct resource *child; } ;
282 struct refcount_struct { atomic_t refs; } ;
19 typedef struct refcount_struct refcount_t;
96 struct kref { refcount_t refcount; } ;
52 struct kset ;
52 struct kobj_type ;
52 struct kobject { const char *name; struct list_head entry; struct kobject *parent; struct kset *kset; struct kobj_type *ktype; struct kernfs_node *sd; struct kref kref; struct delayed_work release; unsigned char state_initialized; unsigned char state_in_sysfs; unsigned char state_add_uevent_sent; unsigned char state_remove_uevent_sent; unsigned char uevent_suppress; } ;
117 struct kobj_type { void (*release)(struct kobject *); const struct sysfs_ops *sysfs_ops; struct attribute **default_attrs; const struct kobj_ns_type_operations * (*child_ns_type)(struct kobject *); const void * (*namespace)(struct kobject *); } ;
125 struct kobj_uevent_env { char *argv[3U]; char *envp[32U]; int envp_idx; char buf[2048U]; int buflen; } ;
133 struct kset_uevent_ops { const int (*filter)(struct kset *, struct kobject *); const const char * (*name)(struct kset *, struct kobject *); const int (*uevent)(struct kset *, struct kobject *, struct kobj_uevent_env *); } ;
150 struct kset { struct list_head list; spinlock_t list_lock; struct kobject kobj; const struct kset_uevent_ops *uevent_ops; } ;
224 struct klist_node ;
37 struct klist_node { void *n_klist; struct list_head n_node; struct kref n_ref; } ;
93 struct hlist_bl_node ;
93 struct hlist_bl_head { struct hlist_bl_node *first; } ;
36 struct hlist_bl_node { struct hlist_bl_node *next; struct hlist_bl_node **pprev; } ;
114 struct __anonstruct____missing_field_name_268 { spinlock_t lock; int count; } ;
114 union __anonunion____missing_field_name_267 { struct __anonstruct____missing_field_name_268 __annonCompField34; } ;
114 struct lockref { union __anonunion____missing_field_name_267 __annonCompField35; } ;
77 struct path ;
78 struct vfsmount ;
79 struct __anonstruct____missing_field_name_270 { u32 hash; u32 len; } ;
79 union __anonunion____missing_field_name_269 { struct __anonstruct____missing_field_name_270 __annonCompField36; u64 hash_len; } ;
79 struct qstr { union __anonunion____missing_field_name_269 __annonCompField37; const unsigned char *name; } ;
71 struct dentry_operations ;
71 union __anonunion____missing_field_name_271 { struct list_head d_lru; wait_queue_head_t *d_wait; } ;
71 union __anonunion_d_u_272 { struct hlist_node d_alias; struct hlist_bl_node d_in_lookup_hash; struct callback_head d_rcu; } ;
71 struct dentry { unsigned int d_flags; seqcount_t d_seq; struct hlist_bl_node d_hash; struct dentry *d_parent; struct qstr d_name; struct inode *d_inode; unsigned char d_iname[32U]; struct lockref d_lockref; const struct dentry_operations *d_op; struct super_block *d_sb; unsigned long d_time; void *d_fsdata; union __anonunion____missing_field_name_271 __annonCompField38; struct list_head d_child; struct list_head d_subdirs; union __anonunion_d_u_272 d_u; } ;
127 struct dentry_operations { int (*d_revalidate)(struct dentry *, unsigned int); int (*d_weak_revalidate)(struct dentry *, unsigned int); int (*d_hash)(const struct dentry *, struct qstr *); int (*d_compare)(const struct dentry *, unsigned int, const char *, const struct qstr *); int (*d_delete)(const struct dentry *); int (*d_init)(struct dentry *); void (*d_release)(struct dentry *); void (*d_prune)(struct dentry *); void (*d_iput)(struct dentry *, struct inode *); char * (*d_dname)(struct dentry *, char *, int); struct vfsmount * (*d_automount)(struct path *); int (*d_manage)(const struct path *, bool ); struct dentry * (*d_real)(struct dentry *, const struct inode *, unsigned int); } ;
605 struct path { struct vfsmount *mnt; struct dentry *dentry; } ;
19 struct mem_cgroup ;
19 struct shrink_control { gfp_t gfp_mask; unsigned long nr_to_scan; int nid; struct mem_cgroup *memcg; } ;
27 struct shrinker { unsigned long int (*count_objects)(struct shrinker *, struct shrink_control *); unsigned long int (*scan_objects)(struct shrinker *, struct shrink_control *); int seeks; long batch; unsigned long flags; struct list_head list; atomic_long_t *nr_deferred; } ;
80 struct list_lru_one { struct list_head list; long nr_items; } ;
32 struct list_lru_memcg { struct list_lru_one *lru[0U]; } ;
37 struct list_lru_node { spinlock_t lock; struct list_lru_one lru; struct list_lru_memcg *memcg_lrus; long nr_items; } ;
49 struct list_lru { struct list_lru_node *node; struct list_head list; } ;
190 enum pid_type { PIDTYPE_PID = 0, PIDTYPE_PGID = 1, PIDTYPE_SID = 2, PIDTYPE_MAX = 3 } ;
197 struct pid_namespace ;
197 struct upid { int nr; struct pid_namespace *ns; struct hlist_node pid_chain; } ;
56 struct pid { atomic_t count; unsigned int level; struct hlist_head tasks[3U]; struct callback_head rcu; struct upid numbers[1U]; } ;
68 struct pid_link { struct hlist_node node; struct pid *pid; } ;
174 struct arch_tlbflush_unmap_batch { struct cpumask cpumask; } ;
13 struct vmacache { u32 seqnum; struct vm_area_struct *vmas[4U]; } ;
45 struct task_rss_stat { int events; int count[4U]; } ;
53 struct mm_rss_stat { atomic_long_t count[4U]; } ;
58 struct page_frag { struct page *page; __u32 offset; __u32 size; } ;
65 struct tlbflush_unmap_batch { struct arch_tlbflush_unmap_batch arch; bool flush_required; bool writable; } ;
58 struct arch_uprobe_task { unsigned long saved_scratch_register; unsigned int saved_trap_nr; unsigned int saved_tf; } ;
66 enum uprobe_task_state { UTASK_RUNNING = 0, UTASK_SSTEP = 1, UTASK_SSTEP_ACK = 2, UTASK_SSTEP_TRAPPED = 3 } ;
73 struct __anonstruct____missing_field_name_278 { struct arch_uprobe_task autask; unsigned long vaddr; } ;
73 struct __anonstruct____missing_field_name_279 { struct callback_head dup_xol_work; unsigned long dup_xol_addr; } ;
73 union __anonunion____missing_field_name_277 { struct __anonstruct____missing_field_name_278 __annonCompField41; struct __anonstruct____missing_field_name_279 __annonCompField42; } ;
73 struct uprobe ;
73 struct return_instance ;
73 struct uprobe_task { enum uprobe_task_state state; union __anonunion____missing_field_name_277 __annonCompField43; struct uprobe *active_uprobe; unsigned long xol_vaddr; struct return_instance *return_instances; unsigned int depth; } ;
95 struct return_instance { struct uprobe *uprobe; unsigned long func; unsigned long stack; unsigned long orig_ret_vaddr; bool chained; struct return_instance *next; } ;
111 struct xol_area ;
112 struct uprobes_state { struct xol_area *xol_area; } ;
151 struct address_space ;
152 union __anonunion____missing_field_name_280 { struct address_space *mapping; void *s_mem; atomic_t compound_mapcount; } ;
152 union __anonunion____missing_field_name_281 { unsigned long index; void *freelist; } ;
152 struct __anonstruct____missing_field_name_285 { unsigned short inuse; unsigned short objects; unsigned char frozen; } ;
152 union __anonunion____missing_field_name_284 { atomic_t _mapcount; unsigned int active; struct __anonstruct____missing_field_name_285 __annonCompField46; int units; } ;
152 struct __anonstruct____missing_field_name_283 { union __anonunion____missing_field_name_284 __annonCompField47; atomic_t _refcount; } ;
152 union __anonunion____missing_field_name_282 { unsigned long counters; struct __anonstruct____missing_field_name_283 __annonCompField48; } ;
152 struct dev_pagemap ;
152 struct __anonstruct____missing_field_name_287 { struct page *next; int pages; int pobjects; } ;
152 struct __anonstruct____missing_field_name_288 { unsigned long compound_head; unsigned int compound_dtor; unsigned int compound_order; } ;
152 struct __anonstruct____missing_field_name_289 { unsigned long __pad; pgtable_t pmd_huge_pte; } ;
152 union __anonunion____missing_field_name_286 { struct list_head lru; struct dev_pagemap *pgmap; struct __anonstruct____missing_field_name_287 __annonCompField50; struct callback_head callback_head; struct __anonstruct____missing_field_name_288 __annonCompField51; struct __anonstruct____missing_field_name_289 __annonCompField52; } ;
152 struct kmem_cache ;
152 union __anonunion____missing_field_name_290 { unsigned long private; spinlock_t *ptl; struct kmem_cache *slab_cache; } ;
152 struct page { unsigned long flags; union __anonunion____missing_field_name_280 __annonCompField44; union __anonunion____missing_field_name_281 __annonCompField45; union __anonunion____missing_field_name_282 __annonCompField49; union __anonunion____missing_field_name_286 __annonCompField53; union __anonunion____missing_field_name_290 __annonCompField54; struct mem_cgroup *mem_cgroup; } ;
266 struct userfaultfd_ctx ;
266 struct vm_userfaultfd_ctx { struct userfaultfd_ctx *ctx; } ;
273 struct __anonstruct_shared_291 { struct rb_node rb; unsigned long rb_subtree_last; } ;
273 struct anon_vma ;
273 struct mempolicy ;
273 struct vm_area_struct { unsigned long vm_start; unsigned long vm_end; struct vm_area_struct *vm_next; struct vm_area_struct *vm_prev; struct rb_node vm_rb; unsigned long rb_subtree_gap; struct mm_struct *vm_mm; pgprot_t vm_page_prot; unsigned long vm_flags; struct __anonstruct_shared_291 shared; struct list_head anon_vma_chain; struct anon_vma *anon_vma; const struct vm_operations_struct *vm_ops; unsigned long vm_pgoff; struct file *vm_file; void *vm_private_data; struct mempolicy *vm_policy; struct vm_userfaultfd_ctx vm_userfaultfd_ctx; } ;
346 struct core_thread { struct task_struct *task; struct core_thread *next; } ;
351 struct core_state { atomic_t nr_threads; struct core_thread dumper; struct completion startup; } ;
357 struct kioctx_table ;
358 struct linux_binfmt ;
358 struct mmu_notifier_mm ;
358 struct mm_struct { struct vm_area_struct *mmap; struct rb_root mm_rb; u32 vmacache_seqnum; unsigned long int (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long); unsigned long mmap_base; unsigned long mmap_legacy_base; unsigned long mmap_compat_base; unsigned long mmap_compat_legacy_base; unsigned long task_size; unsigned long highest_vm_end; pgd_t *pgd; atomic_t mm_users; atomic_t mm_count; atomic_long_t nr_ptes; atomic_long_t nr_pmds; int map_count; spinlock_t page_table_lock; struct rw_semaphore mmap_sem; struct list_head mmlist; unsigned long hiwater_rss; unsigned long hiwater_vm; unsigned long total_vm; unsigned long locked_vm; unsigned long pinned_vm; unsigned long data_vm; unsigned long exec_vm; unsigned long stack_vm; unsigned long def_flags; unsigned long start_code; unsigned long end_code; unsigned long start_data; unsigned long end_data; unsigned long start_brk; unsigned long brk; unsigned long start_stack; unsigned long arg_start; unsigned long arg_end; unsigned long env_start; unsigned long env_end; unsigned long saved_auxv[46U]; struct mm_rss_stat rss_stat; struct linux_binfmt *binfmt; cpumask_var_t cpu_vm_mask_var; mm_context_t context; unsigned long flags; struct core_state *core_state; spinlock_t ioctx_lock; struct kioctx_table *ioctx_table; struct task_struct *owner; struct user_namespace *user_ns; struct file *exe_file; struct mmu_notifier_mm *mmu_notifier_mm; struct cpumask cpumask_allocation; unsigned long numa_next_scan; unsigned long numa_scan_offset; int numa_scan_seq; bool tlb_flush_pending; struct uprobes_state uprobes_state; atomic_long_t hugetlb_usage; struct work_struct async_put_work; } ;
549 struct vm_fault ;
22 struct kernel_cap_struct { __u32 cap[2U]; } ;
25 typedef struct kernel_cap_struct kernel_cap_t;
217 struct fiemap_extent { __u64 fe_logical; __u64 fe_physical; __u64 fe_length; __u64 fe_reserved64[2U]; __u32 fe_flags; __u32 fe_reserved[3U]; } ;
38 enum migrate_mode { MIGRATE_ASYNC = 0, MIGRATE_SYNC_LIGHT = 1, MIGRATE_SYNC = 2 } ;
44 struct rcuwait { struct task_struct *task; } ;
32 enum rcu_sync_type { RCU_SYNC = 0, RCU_SCHED_SYNC = 1, RCU_BH_SYNC = 2 } ;
38 struct rcu_sync { int gp_state; int gp_count; wait_queue_head_t gp_wait; int cb_state; struct callback_head cb_head; enum rcu_sync_type gp_type; } ;
66 struct percpu_rw_semaphore { struct rcu_sync rss; unsigned int *read_count; struct rw_semaphore rw_sem; struct rcuwait writer; int readers_block; } ;
144 struct delayed_call { void (*fn)(void *); void *arg; } ;
25 struct __anonstruct_uuid_t_295 { __u8 b[16U]; } ;
25 typedef struct __anonstruct_uuid_t_295 uuid_t;
6 typedef u32 errseq_t;
302 struct backing_dev_info ;
303 struct bdi_writeback ;
305 struct export_operations ;
307 struct iovec ;
308 struct kiocb ;
309 struct pipe_inode_info ;
310 struct poll_table_struct ;
311 struct kstatfs ;
312 struct cred ;
313 struct swap_info_struct ;
314 struct iov_iter ;
315 struct fscrypt_info ;
316 struct fscrypt_operations ;
79 struct iattr { unsigned int ia_valid; umode_t ia_mode; kuid_t ia_uid; kgid_t ia_gid; loff_t ia_size; struct timespec ia_atime; struct timespec ia_mtime; struct timespec ia_ctime; struct file *ia_file; } ;
213 struct dquot ;
214 struct kqid ;
19 typedef __kernel_uid32_t projid_t;
23 struct __anonstruct_kprojid_t_296 { projid_t val; } ;
23 typedef struct __anonstruct_kprojid_t_296 kprojid_t;
181 enum quota_type { USRQUOTA = 0, GRPQUOTA = 1, PRJQUOTA = 2 } ;
66 typedef long long qsize_t;
67 union __anonunion____missing_field_name_297 { kuid_t uid; kgid_t gid; kprojid_t projid; } ;
67 struct kqid { union __anonunion____missing_field_name_297 __annonCompField55; enum quota_type type; } ;
194 struct mem_dqblk { qsize_t dqb_bhardlimit; qsize_t dqb_bsoftlimit; qsize_t dqb_curspace; qsize_t dqb_rsvspace; qsize_t dqb_ihardlimit; qsize_t dqb_isoftlimit; qsize_t dqb_curinodes; time64_t dqb_btime; time64_t dqb_itime; } ;
216 struct quota_format_type ;
217 struct mem_dqinfo { struct quota_format_type *dqi_format; int dqi_fmt_id; struct list_head dqi_dirty_list; unsigned long dqi_flags; unsigned int dqi_bgrace; unsigned int dqi_igrace; qsize_t dqi_max_spc_limit; qsize_t dqi_max_ino_limit; void *dqi_priv; } ;
282 struct dquot { struct hlist_node dq_hash; struct list_head dq_inuse; struct list_head dq_free; struct list_head dq_dirty; struct mutex dq_lock; atomic_t dq_count; wait_queue_head_t dq_wait_unused; struct super_block *dq_sb; struct kqid dq_id; loff_t dq_off; unsigned long dq_flags; struct mem_dqblk dq_dqb; } ;
309 struct quota_format_ops { int (*check_quota_file)(struct super_block *, int); int (*read_file_info)(struct super_block *, int); int (*write_file_info)(struct super_block *, int); int (*free_file_info)(struct super_block *, int); int (*read_dqblk)(struct dquot *); int (*commit_dqblk)(struct dquot *); int (*release_dqblk)(struct dquot *); int (*get_next_id)(struct super_block *, struct kqid *); } ;
321 struct dquot_operations { int (*write_dquot)(struct dquot *); struct dquot * (*alloc_dquot)(struct super_block *, int); void (*destroy_dquot)(struct dquot *); int (*acquire_dquot)(struct dquot *); int (*release_dquot)(struct dquot *); int (*mark_dirty)(struct dquot *); int (*write_info)(struct super_block *, int); qsize_t * (*get_reserved_space)(struct inode *); int (*get_projid)(struct inode *, kprojid_t *); int (*get_inode_usage)(struct inode *, qsize_t *); int (*get_next_id)(struct super_block *, struct kqid *); } ;
340 struct qc_dqblk { int d_fieldmask; u64 d_spc_hardlimit; u64 d_spc_softlimit; u64 d_ino_hardlimit; u64 d_ino_softlimit; u64 d_space; u64 d_ino_count; s64 d_ino_timer; s64 d_spc_timer; int d_ino_warns; int d_spc_warns; u64 d_rt_spc_hardlimit; u64 d_rt_spc_softlimit; u64 d_rt_space; s64 d_rt_spc_timer; int d_rt_spc_warns; } ;
363 struct qc_type_state { unsigned int flags; unsigned int spc_timelimit; unsigned int ino_timelimit; unsigned int rt_spc_timelimit; unsigned int spc_warnlimit; unsigned int ino_warnlimit; unsigned int rt_spc_warnlimit; unsigned long long ino; blkcnt_t blocks; blkcnt_t nextents; } ;
409 struct qc_state { unsigned int s_incoredqs; struct qc_type_state s_state[3U]; } ;
420 struct qc_info { int i_fieldmask; unsigned int i_flags; unsigned int i_spc_timelimit; unsigned int i_ino_timelimit; unsigned int i_rt_spc_timelimit; unsigned int i_spc_warnlimit; unsigned int i_ino_warnlimit; unsigned int i_rt_spc_warnlimit; } ;
433 struct quotactl_ops { int (*quota_on)(struct super_block *, int, int, const struct path *); int (*quota_off)(struct super_block *, int); int (*quota_enable)(struct super_block *, unsigned int); int (*quota_disable)(struct super_block *, unsigned int); int (*quota_sync)(struct super_block *, int); int (*set_info)(struct super_block *, int, struct qc_info *); int (*get_dqblk)(struct super_block *, struct kqid , struct qc_dqblk *); int (*get_nextdqblk)(struct super_block *, struct kqid *, struct qc_dqblk *); int (*set_dqblk)(struct super_block *, struct kqid , struct qc_dqblk *); int (*get_state)(struct super_block *, struct qc_state *); int (*rm_xquota)(struct super_block *, unsigned int); } ;
449 struct quota_format_type { int qf_fmt_id; const struct quota_format_ops *qf_ops; struct module *qf_owner; struct quota_format_type *qf_next; } ;
513 struct quota_info { unsigned int flags; struct mutex dqio_mutex; struct inode *files[3U]; struct mem_dqinfo info[3U]; const struct quota_format_ops *ops[3U]; } ;
542 struct writeback_control ;
543 enum rw_hint { WRITE_LIFE_NOT_SET = 0, WRITE_LIFE_NONE = 1, WRITE_LIFE_SHORT = 2, WRITE_LIFE_MEDIUM = 3, WRITE_LIFE_LONG = 4, WRITE_LIFE_EXTREME = 5 } ;
552 struct kiocb { struct file *ki_filp; loff_t ki_pos; void (*ki_complete)(struct kiocb *, long, long); void *private; int ki_flags; enum rw_hint ki_hint; } ;
326 struct address_space_operations { int (*writepage)(struct page *, struct writeback_control *); int (*readpage)(struct file *, struct page *); int (*writepages)(struct address_space *, struct writeback_control *); int (*set_page_dirty)(struct page *); int (*readpages)(struct file *, struct address_space *, struct list_head *, unsigned int); int (*write_begin)(struct file *, struct address_space *, loff_t , unsigned int, unsigned int, struct page **, void **); int (*write_end)(struct file *, struct address_space *, loff_t , unsigned int, unsigned int, struct page *, void *); sector_t (*bmap)(struct address_space *, sector_t ); void (*invalidatepage)(struct page *, unsigned int, unsigned int); int (*releasepage)(struct page *, gfp_t ); void (*freepage)(struct page *); ssize_t (*direct_IO)(struct kiocb *, struct iov_iter *); int (*migratepage)(struct address_space *, struct page *, struct page *, enum migrate_mode ); bool (*isolate_page)(struct page *, isolate_mode_t ); void (*putback_page)(struct page *); int (*launder_page)(struct page *); int (*is_partially_uptodate)(struct page *, unsigned long, unsigned long); void (*is_dirty_writeback)(struct page *, bool *, bool *); int (*error_remove_page)(struct address_space *, struct page *); int (*swap_activate)(struct swap_info_struct *, struct file *, sector_t *); void (*swap_deactivate)(struct file *); } ;
385 struct address_space { struct inode *host; struct radix_tree_root page_tree; spinlock_t tree_lock; atomic_t i_mmap_writable; struct rb_root i_mmap; struct rw_semaphore i_mmap_rwsem; unsigned long nrpages; unsigned long nrexceptional; unsigned long writeback_index; const struct address_space_operations *a_ops; unsigned long flags; spinlock_t private_lock; gfp_t gfp_mask; struct list_head private_list; void *private_data; errseq_t wb_err; } ;
408 struct request_queue ;
409 struct hd_struct ;
409 struct gendisk ;
409 struct block_device { dev_t bd_dev; int bd_openers; struct inode *bd_inode; struct super_block *bd_super; struct mutex bd_mutex; void *bd_claiming; void *bd_holder; int bd_holders; bool bd_write_holder; struct list_head bd_holder_disks; struct block_device *bd_contains; unsigned int bd_block_size; struct hd_struct *bd_part; unsigned int bd_part_count; int bd_invalidated; struct gendisk *bd_disk; struct request_queue *bd_queue; struct backing_dev_info *bd_bdi; struct list_head bd_list; unsigned long bd_private; int bd_fsfreeze_count; struct mutex bd_fsfreeze_mutex; } ;
525 struct posix_acl ;
552 struct fsnotify_mark_connector ;
553 struct inode_operations ;
553 union __anonunion____missing_field_name_302 { const unsigned int i_nlink; unsigned int __i_nlink; } ;
553 union __anonunion____missing_field_name_303 { struct hlist_head i_dentry; struct callback_head i_rcu; } ;
553 struct file_lock_context ;
553 struct cdev ;
553 union __anonunion____missing_field_name_304 { struct pipe_inode_info *i_pipe; struct block_device *i_bdev; struct cdev *i_cdev; char *i_link; unsigned int i_dir_seq; } ;
553 struct inode { umode_t i_mode; unsigned short i_opflags; kuid_t i_uid; kgid_t i_gid; unsigned int i_flags; struct posix_acl *i_acl; struct posix_acl *i_default_acl; const struct inode_operations *i_op; struct super_block *i_sb; struct address_space *i_mapping; void *i_security; unsigned long i_ino; union __anonunion____missing_field_name_302 __annonCompField56; dev_t i_rdev; loff_t i_size; struct timespec i_atime; struct timespec i_mtime; struct timespec i_ctime; spinlock_t i_lock; unsigned short i_bytes; unsigned int i_blkbits; enum rw_hint i_write_hint; blkcnt_t i_blocks; unsigned long i_state; struct rw_semaphore i_rwsem; unsigned long dirtied_when; unsigned long dirtied_time_when; struct hlist_node i_hash; struct list_head i_io_list; struct bdi_writeback *i_wb; int i_wb_frn_winner; u16 i_wb_frn_avg_time; u16 i_wb_frn_history; struct list_head i_lru; struct list_head i_sb_list; struct list_head i_wb_list; union __anonunion____missing_field_name_303 __annonCompField57; u64 i_version; atomic_t i_count; atomic_t i_dio_count; atomic_t i_writecount; atomic_t i_readcount; const struct file_operations *i_fop; struct file_lock_context *i_flctx; struct address_space i_data; struct list_head i_devices; union __anonunion____missing_field_name_304 __annonCompField58; __u32 i_generation; __u32 i_fsnotify_mask; struct fsnotify_mark_connector *i_fsnotify_marks; struct fscrypt_info *i_crypt_info; void *i_private; } ;
816 struct fown_struct { rwlock_t lock; struct pid *pid; enum pid_type pid_type; kuid_t uid; kuid_t euid; int signum; } ;
824 struct file_ra_state { unsigned long start; unsigned int size; unsigned int async_size; unsigned int ra_pages; unsigned int mmap_miss; loff_t prev_pos; } ;
847 union __anonunion_f_u_305 { struct llist_node fu_llist; struct callback_head fu_rcuhead; } ;
847 struct file { union __anonunion_f_u_305 f_u; struct path f_path; struct inode *f_inode; const struct file_operations *f_op; spinlock_t f_lock; enum rw_hint f_write_hint; atomic_long_t f_count; unsigned int f_flags; fmode_t f_mode; struct mutex f_pos_lock; loff_t f_pos; struct fown_struct f_owner; const struct cred *f_cred; struct file_ra_state f_ra; u64 f_version; void *f_security; void *private_data; struct list_head f_ep_links; struct list_head f_tfile_llink; struct address_space *f_mapping; errseq_t f_wb_err; } ;
936 typedef void *fl_owner_t;
937 struct file_lock ;
938 struct file_lock_operations { void (*fl_copy_lock)(struct file_lock *, struct file_lock *); void (*fl_release_private)(struct file_lock *); } ;
944 struct lock_manager_operations { int (*lm_compare_owner)(struct file_lock *, struct file_lock *); unsigned long int (*lm_owner_key)(struct file_lock *); fl_owner_t (*lm_get_owner)(fl_owner_t ); void (*lm_put_owner)(fl_owner_t ); void (*lm_notify)(struct file_lock *); int (*lm_grant)(struct file_lock *, int); bool (*lm_break)(struct file_lock *); int (*lm_change)(struct file_lock *, int, struct list_head *); void (*lm_setup)(struct file_lock *, void **); } ;
971 struct nlm_lockowner ;
972 struct nfs_lock_info { u32 state; struct nlm_lockowner *owner; struct list_head list; } ;
14 struct nfs4_lock_state ;
15 struct nfs4_lock_info { struct nfs4_lock_state *owner; } ;
19 struct fasync_struct ;
19 struct __anonstruct_afs_307 { struct list_head link; int state; } ;
19 union __anonunion_fl_u_306 { struct nfs_lock_info nfs_fl; struct nfs4_lock_info nfs4_fl; struct __anonstruct_afs_307 afs; } ;
19 struct file_lock { struct file_lock *fl_next; struct list_head fl_list; struct hlist_node fl_link; struct list_head fl_block; fl_owner_t fl_owner; unsigned int fl_flags; unsigned char fl_type; unsigned int fl_pid; int fl_link_cpu; struct pid *fl_nspid; wait_queue_head_t fl_wait; struct file *fl_file; loff_t fl_start; loff_t fl_end; struct fasync_struct *fl_fasync; unsigned long fl_break_time; unsigned long fl_downgrade_time; const struct file_lock_operations *fl_ops; const struct lock_manager_operations *fl_lmops; union __anonunion_fl_u_306 fl_u; } ;
1024 struct file_lock_context { spinlock_t flc_lock; struct list_head flc_flock; struct list_head flc_posix; struct list_head flc_lease; } ;
1089 struct files_struct ;
1242 struct fasync_struct { spinlock_t fa_lock; int magic; int fa_fd; struct fasync_struct *fa_next; struct file *fa_file; struct callback_head fa_rcu; } ;
1277 struct sb_writers { int frozen; wait_queue_head_t wait_unfrozen; struct percpu_rw_semaphore rw_sem[3U]; } ;
1307 struct super_operations ;
1307 struct xattr_handler ;
1307 struct mtd_info ;
1307 struct super_block { struct list_head s_list; dev_t s_dev; unsigned char s_blocksize_bits; unsigned long s_blocksize; loff_t s_maxbytes; struct file_system_type *s_type; const struct super_operations *s_op; const struct dquot_operations *dq_op; const struct quotactl_ops *s_qcop; const struct export_operations *s_export_op; unsigned long s_flags; unsigned long s_iflags; unsigned long s_magic; struct dentry *s_root; struct rw_semaphore s_umount; int s_count; atomic_t s_active; void *s_security; const struct xattr_handler **s_xattr; const struct fscrypt_operations *s_cop; struct hlist_bl_head s_anon; struct list_head s_mounts; struct block_device *s_bdev; struct backing_dev_info *s_bdi; struct mtd_info *s_mtd; struct hlist_node s_instances; unsigned int s_quota_types; struct quota_info s_dquot; struct sb_writers s_writers; char s_id[32U]; uuid_t s_uuid; void *s_fs_info; unsigned int s_max_links; fmode_t s_mode; u32 s_time_gran; struct mutex s_vfs_rename_mutex; char *s_subtype; const struct dentry_operations *s_d_op; int cleancache_poolid; struct shrinker s_shrink; atomic_long_t s_remove_count; int s_readonly_remount; struct workqueue_struct *s_dio_done_wq; struct hlist_head s_pins; struct user_namespace *s_user_ns; struct list_lru s_dentry_lru; struct list_lru s_inode_lru; struct callback_head rcu; struct work_struct destroy_work; struct mutex s_sync_lock; int s_stack_depth; spinlock_t s_inode_list_lock; struct list_head s_inodes; spinlock_t s_inode_wblist_lock; struct list_head s_inodes_wb; } ;
1588 struct fiemap_extent_info { unsigned int fi_flags; unsigned int fi_extents_mapped; unsigned int fi_extents_max; struct fiemap_extent *fi_extents_start; } ;
1601 struct dir_context ;
1626 struct dir_context { int (*actor)(struct dir_context *, const char *, int, loff_t , u64 , unsigned int); loff_t pos; } ;
1633 struct file_operations { struct module *owner; loff_t (*llseek)(struct file *, loff_t , int); ssize_t (*read)(struct file *, char *, size_t , loff_t *); ssize_t (*write)(struct file *, const char *, size_t , loff_t *); ssize_t (*read_iter)(struct kiocb *, struct iov_iter *); ssize_t (*write_iter)(struct kiocb *, struct iov_iter *); int (*iterate)(struct file *, struct dir_context *); int (*iterate_shared)(struct file *, struct dir_context *); unsigned int (*poll)(struct file *, struct poll_table_struct *); long int (*unlocked_ioctl)(struct file *, unsigned int, unsigned long); long int (*compat_ioctl)(struct file *, unsigned int, unsigned long); int (*mmap)(struct file *, struct vm_area_struct *); int (*open)(struct inode *, struct file *); int (*flush)(struct file *, fl_owner_t ); int (*release)(struct inode *, struct file *); int (*fsync)(struct file *, loff_t , loff_t , int); int (*fasync)(int, struct file *, int); int (*lock)(struct file *, int, struct file_lock *); ssize_t (*sendpage)(struct file *, struct page *, int, size_t , loff_t *, int); unsigned long int (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long); int (*check_flags)(int); int (*flock)(struct file *, int, struct file_lock *); ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t , unsigned int); ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t , unsigned int); int (*setlease)(struct file *, long, struct file_lock **, void **); long int (*fallocate)(struct file *, int, loff_t , loff_t ); void (*show_fdinfo)(struct seq_file *, struct file *); ssize_t (*copy_file_range)(struct file *, loff_t , struct file *, loff_t , size_t , unsigned int); int (*clone_file_range)(struct file *, loff_t , struct file *, loff_t , u64 ); ssize_t (*dedupe_file_range)(struct file *, u64 , u64 , struct file *, u64 ); } ;
1701 struct inode_operations { struct dentry * (*lookup)(struct inode *, struct dentry *, unsigned int); const char * (*get_link)(struct dentry *, struct inode *, struct delayed_call *); int (*permission)(struct inode *, int); struct posix_acl * (*get_acl)(struct inode *, int); int (*readlink)(struct dentry *, char *, int); int (*create)(struct inode *, struct dentry *, umode_t , bool ); int (*link)(struct dentry *, struct inode *, struct dentry *); int (*unlink)(struct inode *, struct dentry *); int (*symlink)(struct inode *, struct dentry *, const char *); int (*mkdir)(struct inode *, struct dentry *, umode_t ); int (*rmdir)(struct inode *, struct dentry *); int (*mknod)(struct inode *, struct dentry *, umode_t , dev_t ); int (*rename)(struct inode *, struct dentry *, struct inode *, struct dentry *, unsigned int); int (*setattr)(struct dentry *, struct iattr *); int (*getattr)(const struct path *, struct kstat *, u32 , unsigned int); ssize_t (*listxattr)(struct dentry *, char *, size_t ); int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 , u64 ); int (*update_time)(struct inode *, struct timespec *, int); int (*atomic_open)(struct inode *, struct dentry *, struct file *, unsigned int, umode_t , int *); int (*tmpfile)(struct inode *, struct dentry *, umode_t ); int (*set_acl)(struct inode *, struct posix_acl *, int); } ;
1774 struct super_operations { struct inode * (*alloc_inode)(struct super_block *); void (*destroy_inode)(struct inode *); void (*dirty_inode)(struct inode *, int); int (*write_inode)(struct inode *, struct writeback_control *); int (*drop_inode)(struct inode *); void (*evict_inode)(struct inode *); void (*put_super)(struct super_block *); int (*sync_fs)(struct super_block *, int); int (*freeze_super)(struct super_block *); int (*freeze_fs)(struct super_block *); int (*thaw_super)(struct super_block *); int (*unfreeze_fs)(struct super_block *); int (*statfs)(struct dentry *, struct kstatfs *); int (*remount_fs)(struct super_block *, int *, char *); void (*umount_begin)(struct super_block *); int (*show_options)(struct seq_file *, struct dentry *); int (*show_devname)(struct seq_file *, struct dentry *); int (*show_path)(struct seq_file *, struct dentry *); int (*show_stats)(struct seq_file *, struct dentry *); ssize_t (*quota_read)(struct super_block *, int, char *, size_t , loff_t ); ssize_t (*quota_write)(struct super_block *, int, const char *, size_t , loff_t ); struct dquot ** (*get_dquots)(struct inode *); int (*bdev_try_to_free_page)(struct super_block *, struct page *, gfp_t ); long int (*nr_cached_objects)(struct super_block *, struct shrink_control *); long int (*free_cached_objects)(struct super_block *, struct shrink_control *); } ;
2040 struct file_system_type { const char *name; int fs_flags; struct dentry * (*mount)(struct file_system_type *, int, const char *, void *); void (*kill_sb)(struct super_block *); struct module *owner; struct file_system_type *next; struct hlist_head fs_supers; struct lock_class_key s_lock_key; struct lock_class_key s_umount_key; struct lock_class_key s_vfs_rename_key; struct lock_class_key s_writers_key[3U]; struct lock_class_key i_lock_key; struct lock_class_key i_mutex_key; struct lock_class_key i_mutex_dir_key; } ;
836 struct nsproxy ;
228 struct assoc_array_ptr ;
228 struct assoc_array { struct assoc_array_ptr *root; unsigned long nr_leaves_on_tree; } ;
32 typedef int32_t key_serial_t;
35 typedef uint32_t key_perm_t;
36 struct key ;
37 struct user_struct ;
38 struct signal_struct ;
39 struct key_type ;
43 struct keyring_index_key { struct key_type *type; const char *description; size_t desc_len; } ;
92 union key_payload { void *rcu_data0; void *data[4U]; } ;
131 struct key_restriction { int (*check)(struct key *, const struct key_type *, const union key_payload *, struct key *); struct key *key; struct key_type *keytype; } ;
140 union __anonunion____missing_field_name_310 { struct list_head graveyard_link; struct rb_node serial_node; } ;
140 struct key_user ;
140 union __anonunion____missing_field_name_311 { time_t expiry; time_t revoked_at; } ;
140 struct __anonstruct____missing_field_name_313 { struct key_type *type; char *description; } ;
140 union __anonunion____missing_field_name_312 { struct keyring_index_key index_key; struct __anonstruct____missing_field_name_313 __annonCompField63; } ;
140 struct __anonstruct____missing_field_name_315 { struct list_head name_link; struct assoc_array keys; } ;
140 union __anonunion____missing_field_name_314 { union key_payload payload; struct __anonstruct____missing_field_name_315 __annonCompField65; int reject_error; } ;
140 struct key { refcount_t usage; key_serial_t serial; union __anonunion____missing_field_name_310 __annonCompField61; struct rw_semaphore sem; struct key_user *user; void *security; union __anonunion____missing_field_name_311 __annonCompField62; time_t last_used_at; kuid_t uid; kgid_t gid; key_perm_t perm; unsigned short quotalen; unsigned short datalen; unsigned long flags; union __anonunion____missing_field_name_312 __annonCompField64; union __anonunion____missing_field_name_314 __annonCompField66; struct key_restriction *restrict_link; } ;
390 struct audit_context ;
45 struct sem_undo_list ;
45 struct sysv_sem { struct sem_undo_list *undo_list; } ;
26 struct sysv_shm { struct list_head shm_clist; } ;
12 enum kcov_mode { KCOV_MODE_DISABLED = 0, KCOV_MODE_TRACE = 1 } ;
84 struct plist_node { int prio; struct list_head prio_list; struct list_head node_list; } ;
299 struct timerqueue_node { struct rb_node node; ktime_t expires; } ;
12 struct timerqueue_head { struct rb_root head; struct timerqueue_node *next; } ;
50 struct hrtimer_clock_base ;
51 struct hrtimer_cpu_base ;
60 enum hrtimer_restart { HRTIMER_NORESTART = 0, HRTIMER_RESTART = 1 } ;
65 struct hrtimer { struct timerqueue_node node; ktime_t _softexpires; enum hrtimer_restart (*function)(struct hrtimer *); struct hrtimer_clock_base *base; u8 state; u8 is_rel; } ;
113 struct hrtimer_clock_base { struct hrtimer_cpu_base *cpu_base; int index; clockid_t clockid; struct timerqueue_head active; ktime_t (*get_time)(); ktime_t offset; } ;
146 struct hrtimer_cpu_base { raw_spinlock_t lock; seqcount_t seq; struct hrtimer *running; unsigned int cpu; unsigned int active_bases; unsigned int clock_was_set_seq; bool migration_enabled; bool nohz_active; unsigned char in_hrtirq; unsigned char hres_active; unsigned char hang_detected; ktime_t expires_next; struct hrtimer *next_timer; unsigned int nr_events; unsigned int nr_retries; unsigned int nr_hangs; unsigned int max_hang_time; struct hrtimer_clock_base clock_base[4U]; } ;
43 struct seccomp_filter ;
44 struct seccomp { int mode; struct seccomp_filter *filter; } ;
11 struct latency_record { unsigned long backtrace[12U]; unsigned int count; unsigned long time; unsigned long max; } ;
24 struct __anonstruct_sigset_t_316 { unsigned long sig[1U]; } ;
24 typedef struct __anonstruct_sigset_t_316 sigset_t;
25 struct siginfo ;
38 union sigval { int sival_int; void *sival_ptr; } ;
10 typedef union sigval sigval_t;
11 struct __anonstruct__kill_318 { __kernel_pid_t _pid; __kernel_uid32_t _uid; } ;
11 struct __anonstruct__timer_319 { __kernel_timer_t _tid; int _overrun; char _pad[0U]; sigval_t _sigval; int _sys_private; } ;
11 struct __anonstruct__rt_320 { __kernel_pid_t _pid; __kernel_uid32_t _uid; sigval_t _sigval; } ;
11 struct __anonstruct__sigchld_321 { __kernel_pid_t _pid; __kernel_uid32_t _uid; int _status; __kernel_clock_t _utime; __kernel_clock_t _stime; } ;
11 struct __anonstruct__addr_bnd_324 { void *_lower; void *_upper; } ;
11 union __anonunion____missing_field_name_323 { struct __anonstruct__addr_bnd_324 _addr_bnd; __u32 _pkey; } ;
11 struct __anonstruct__sigfault_322 { void *_addr; short _addr_lsb; union __anonunion____missing_field_name_323 __annonCompField67; } ;
11 struct __anonstruct__sigpoll_325 { long _band; int _fd; } ;
11 struct __anonstruct__sigsys_326 { void *_call_addr; int _syscall; unsigned int _arch; } ;
11 union __anonunion__sifields_317 { int _pad[28U]; struct __anonstruct__kill_318 _kill; struct __anonstruct__timer_319 _timer; struct __anonstruct__rt_320 _rt; struct __anonstruct__sigchld_321 _sigchld; struct __anonstruct__sigfault_322 _sigfault; struct __anonstruct__sigpoll_325 _sigpoll; struct __anonstruct__sigsys_326 _sigsys; } ;
11 struct siginfo { int si_signo; int si_errno; int si_code; union __anonunion__sifields_317 _sifields; } ;
118 typedef struct siginfo siginfo_t;
21 struct sigpending { struct list_head list; sigset_t signal; } ;
65 struct task_io_accounting { u64 rchar; u64 wchar; u64 syscr; u64 syscw; u64 read_bytes; u64 write_bytes; u64 cancelled_write_bytes; } ;
45 struct bio_list ;
46 struct blk_plug ;
47 struct cfs_rq ;
48 struct fs_struct ;
49 struct futex_pi_state ;
50 struct io_context ;
51 struct nameidata ;
52 struct perf_event_context ;
54 struct reclaim_state ;
55 struct robust_list_head ;
58 struct sighand_struct ;
59 struct task_delay_info ;
60 struct task_group ;
187 struct prev_cputime { u64 utime; u64 stime; raw_spinlock_t lock; } ;
203 struct task_cputime { u64 utime; u64 stime; unsigned long long sum_exec_runtime; } ;
243 struct sched_info { unsigned long pcount; unsigned long long run_delay; unsigned long long last_arrival; unsigned long long last_queued; } ;
262 struct load_weight { unsigned long weight; u32 inv_weight; } ;
279 struct sched_avg { u64 last_update_time; u64 load_sum; u32 util_sum; u32 period_contrib; unsigned long load_avg; unsigned long util_avg; } ;
340 struct sched_statistics { u64 wait_start; u64 wait_max; u64 wait_count; u64 wait_sum; u64 iowait_count; u64 iowait_sum; u64 sleep_start; u64 sleep_max; s64 sum_sleep_runtime; u64 block_start; u64 block_max; u64 exec_max; u64 slice_max; u64 nr_migrations_cold; u64 nr_failed_migrations_affine; u64 nr_failed_migrations_running; u64 nr_failed_migrations_hot; u64 nr_forced_migrations; u64 nr_wakeups; u64 nr_wakeups_sync; u64 nr_wakeups_migrate; u64 nr_wakeups_local; u64 nr_wakeups_remote; u64 nr_wakeups_affine; u64 nr_wakeups_affine_attempts; u64 nr_wakeups_passive; u64 nr_wakeups_idle; } ;
375 struct sched_entity { struct load_weight load; struct rb_node run_node; struct list_head group_node; unsigned int on_rq; u64 exec_start; u64 sum_exec_runtime; u64 vruntime; u64 prev_sum_exec_runtime; u64 nr_migrations; struct sched_statistics statistics; int depth; struct sched_entity *parent; struct cfs_rq *cfs_rq; struct cfs_rq *my_q; struct sched_avg avg; } ;
411 struct rt_rq ;
411 struct sched_rt_entity { struct list_head run_list; unsigned long timeout; unsigned long watchdog_stamp; unsigned int time_slice; unsigned short on_rq; unsigned short on_list; struct sched_rt_entity *back; struct sched_rt_entity *parent; struct rt_rq *rt_rq; struct rt_rq *my_q; } ;
429 struct sched_dl_entity { struct rb_node rb_node; u64 dl_runtime; u64 dl_deadline; u64 dl_period; u64 dl_bw; u64 dl_density; s64 runtime; u64 deadline; unsigned int flags; int dl_throttled; int dl_boosted; int dl_yielded; int dl_non_contending; struct hrtimer dl_timer; struct hrtimer inactive_timer; } ;
514 struct wake_q_node { struct wake_q_node *next; } ;
518 struct sched_class ;
518 struct rt_mutex_waiter ;
518 struct css_set ;
518 struct compat_robust_list_head ;
518 struct numa_group ;
518 struct kcov ;
518 struct task_struct { struct thread_info thread_info; volatile long state; void *stack; atomic_t usage; unsigned int flags; unsigned int ptrace; struct llist_node wake_entry; int on_cpu; unsigned int cpu; unsigned int wakee_flips; unsigned long wakee_flip_decay_ts; struct task_struct *last_wakee; int wake_cpu; int on_rq; int prio; int static_prio; int normal_prio; unsigned int rt_priority; const struct sched_class *sched_class; struct sched_entity se; struct sched_rt_entity rt; struct task_group *sched_task_group; struct sched_dl_entity dl; struct hlist_head preempt_notifiers; unsigned int policy; int nr_cpus_allowed; cpumask_t cpus_allowed; unsigned long rcu_tasks_nvcsw; bool rcu_tasks_holdout; struct list_head rcu_tasks_holdout_list; int rcu_tasks_idle_cpu; struct sched_info sched_info; struct list_head tasks; struct plist_node pushable_tasks; struct rb_node pushable_dl_tasks; struct mm_struct *mm; struct mm_struct *active_mm; struct vmacache vmacache; struct task_rss_stat rss_stat; int exit_state; int exit_code; int exit_signal; int pdeath_signal; unsigned long jobctl; unsigned int personality; unsigned char sched_reset_on_fork; unsigned char sched_contributes_to_load; unsigned char sched_migrated; unsigned char sched_remote_wakeup; unsigned char; unsigned char in_execve; unsigned char in_iowait; unsigned char restore_sigmask; unsigned char memcg_may_oom; unsigned char memcg_kmem_skip_account; unsigned char brk_randomized; unsigned char no_cgroup_migration; unsigned long atomic_flags; struct restart_block restart_block; pid_t pid; pid_t tgid; struct task_struct *real_parent; struct task_struct *parent; struct list_head children; struct list_head sibling; struct task_struct *group_leader; struct list_head ptraced; struct list_head ptrace_entry; struct pid_link pids[3U]; struct list_head thread_group; struct list_head thread_node; struct completion *vfork_done; int *set_child_tid; int *clear_child_tid; u64 utime; u64 stime; u64 gtime; struct prev_cputime prev_cputime; unsigned long nvcsw; unsigned long nivcsw; u64 start_time; u64 real_start_time; unsigned long min_flt; unsigned long maj_flt; struct task_cputime cputime_expires; struct list_head cpu_timers[3U]; const struct cred *ptracer_cred; const struct cred *real_cred; const struct cred *cred; char comm[16U]; struct nameidata *nameidata; struct sysv_sem sysvsem; struct sysv_shm sysvshm; unsigned long last_switch_count; struct fs_struct *fs; struct files_struct *files; struct nsproxy *nsproxy; struct signal_struct *signal; struct sighand_struct *sighand; sigset_t blocked; sigset_t real_blocked; sigset_t saved_sigmask; struct sigpending pending; unsigned long sas_ss_sp; size_t sas_ss_size; unsigned int sas_ss_flags; struct callback_head *task_works; struct audit_context *audit_context; kuid_t loginuid; unsigned int sessionid; struct seccomp seccomp; u32 parent_exec_id; u32 self_exec_id; spinlock_t alloc_lock; raw_spinlock_t pi_lock; struct wake_q_node wake_q; struct rb_root pi_waiters; struct rb_node *pi_waiters_leftmost; struct task_struct *pi_top_task; struct rt_mutex_waiter *pi_blocked_on; struct mutex_waiter *blocked_on; unsigned int irq_events; unsigned long hardirq_enable_ip; unsigned long hardirq_disable_ip; unsigned int hardirq_enable_event; unsigned int hardirq_disable_event; int hardirqs_enabled; int hardirq_context; unsigned long softirq_disable_ip; unsigned long softirq_enable_ip; unsigned int softirq_disable_event; unsigned int softirq_enable_event; int softirqs_enabled; int softirq_context; u64 curr_chain_key; int lockdep_depth; unsigned int lockdep_recursion; struct held_lock held_locks[48U]; gfp_t lockdep_reclaim_gfp; unsigned int in_ubsan; void *journal_info; struct bio_list *bio_list; struct blk_plug *plug; struct reclaim_state *reclaim_state; struct backing_dev_info *backing_dev_info; struct io_context *io_context; unsigned long ptrace_message; siginfo_t *last_siginfo; struct task_io_accounting ioac; u64 acct_rss_mem1; u64 acct_vm_mem1; u64 acct_timexpd; nodemask_t mems_allowed; seqcount_t mems_allowed_seq; int cpuset_mem_spread_rotor; int cpuset_slab_spread_rotor; struct css_set *cgroups; struct list_head cg_list; int closid; struct robust_list_head *robust_list; struct compat_robust_list_head *compat_robust_list; struct list_head pi_state_list; struct futex_pi_state *pi_state_cache; struct perf_event_context *perf_event_ctxp[2U]; struct mutex perf_event_mutex; struct list_head perf_event_list; struct mempolicy *mempolicy; short il_prev; short pref_node_fork; int numa_scan_seq; unsigned int numa_scan_period; unsigned int numa_scan_period_max; int numa_preferred_nid; unsigned long numa_migrate_retry; u64 node_stamp; u64 last_task_numa_placement; u64 last_sum_exec_runtime; struct callback_head numa_work; struct list_head numa_entry; struct numa_group *numa_group; unsigned long *numa_faults; unsigned long total_numa_faults; unsigned long numa_faults_locality[3U]; unsigned long numa_pages_migrated; struct tlbflush_unmap_batch tlb_ubc; struct callback_head rcu; struct pipe_inode_info *splice_pipe; struct page_frag task_frag; struct task_delay_info *delays; int make_it_fail; unsigned int fail_nth; int nr_dirtied; int nr_dirtied_pause; unsigned long dirty_paused_when; int latency_record_count; struct latency_record latency_record[32U]; u64 timer_slack_ns; u64 default_timer_slack_ns; unsigned int kasan_depth; unsigned long trace; unsigned long trace_recursion; enum kcov_mode kcov_mode; unsigned int kcov_size; void *kcov_area; struct kcov *kcov; struct mem_cgroup *memcg_in_oom; gfp_t memcg_oom_gfp_mask; int memcg_oom_order; unsigned int memcg_nr_pages_over_high; struct uprobe_task *utask; unsigned int sequential_io; unsigned int sequential_io_avg; unsigned long task_state_change; int pagefault_disabled; struct task_struct *oom_reaper_list; atomic_t stack_refcount; int patch_state; void *security; struct thread_struct thread; } ;
1607 struct user_struct { atomic_t __count; atomic_t processes; atomic_t sigpending; atomic_t fanotify_listeners; atomic_long_t epoll_watches; unsigned long mq_bytes; unsigned long locked_shm; unsigned long unix_inflight; atomic_long_t pipe_bufs; struct key *uid_keyring; struct key *session_keyring; struct hlist_node uidhash_node; kuid_t uid; atomic_long_t locked_vm; } ;
60 struct group_info { atomic_t usage; int ngroups; kgid_t gid[0U]; } ;
86 struct cred { atomic_t usage; atomic_t subscribers; void *put_addr; unsigned int magic; kuid_t uid; kgid_t gid; kuid_t suid; kgid_t sgid; kuid_t euid; kgid_t egid; kuid_t fsuid; kgid_t fsgid; unsigned int securebits; kernel_cap_t cap_inheritable; kernel_cap_t cap_permitted; kernel_cap_t cap_effective; kernel_cap_t cap_bset; kernel_cap_t cap_ambient; unsigned char jit_keyring; struct key *session_keyring; struct key *process_keyring; struct key *thread_keyring; struct key *request_key_auth; void *security; struct user_struct *user; struct user_namespace *user_ns; struct group_info *group_info; struct callback_head rcu; } ;
369 struct seq_file { char *buf; size_t size; size_t from; size_t count; size_t pad_until; loff_t index; loff_t read_pos; u64 version; struct mutex lock; const struct seq_operations *op; int poll_event; const struct file *file; void *private; } ;
30 struct seq_operations { void * (*start)(struct seq_file *, loff_t *); void (*stop)(struct seq_file *, void *); void * (*next)(struct seq_file *, void *, loff_t *); int (*show)(struct seq_file *, void *); } ;
222 struct pinctrl ;
223 struct pinctrl_state ;
200 struct dev_pin_info { struct pinctrl *p; struct pinctrl_state *default_state; struct pinctrl_state *init_state; struct pinctrl_state *sleep_state; struct pinctrl_state *idle_state; } ;
58 struct pm_message { int event; } ;
64 typedef struct pm_message pm_message_t;
65 struct dev_pm_ops { int (*prepare)(struct device *); void (*complete)(struct device *); int (*suspend)(struct device *); int (*resume)(struct device *); int (*freeze)(struct device *); int (*thaw)(struct device *); int (*poweroff)(struct device *); int (*restore)(struct device *); int (*suspend_late)(struct device *); int (*resume_early)(struct device *); int (*freeze_late)(struct device *); int (*thaw_early)(struct device *); int (*poweroff_late)(struct device *); int (*restore_early)(struct device *); int (*suspend_noirq)(struct device *); int (*resume_noirq)(struct device *); int (*freeze_noirq)(struct device *); int (*thaw_noirq)(struct device *); int (*poweroff_noirq)(struct device *); int (*restore_noirq)(struct device *); int (*runtime_suspend)(struct device *); int (*runtime_resume)(struct device *); int (*runtime_idle)(struct device *); } ;
315 enum rpm_status { RPM_ACTIVE = 0, RPM_RESUMING = 1, RPM_SUSPENDED = 2, RPM_SUSPENDING = 3 } ;
322 enum rpm_request { RPM_REQ_NONE = 0, RPM_REQ_IDLE = 1, RPM_REQ_SUSPEND = 2, RPM_REQ_AUTOSUSPEND = 3, RPM_REQ_RESUME = 4 } ;
330 struct wakeup_source ;
331 struct wake_irq ;
332 struct pm_domain_data ;
333 struct pm_subsys_data { spinlock_t lock; unsigned int refcount; struct list_head clock_list; struct pm_domain_data *domain_data; } ;
551 struct dev_pm_qos ;
551 struct dev_pm_info { pm_message_t power_state; unsigned char can_wakeup; unsigned char async_suspend; bool in_dpm_list; bool is_prepared; bool is_suspended; bool is_noirq_suspended; bool is_late_suspended; bool early_init; bool direct_complete; spinlock_t lock; struct list_head entry; struct completion completion; struct wakeup_source *wakeup; bool wakeup_path; bool syscore; bool no_pm_callbacks; struct timer_list suspend_timer; unsigned long timer_expires; struct work_struct work; wait_queue_head_t wait_queue; struct wake_irq *wakeirq; atomic_t usage_count; atomic_t child_count; unsigned char disable_depth; unsigned char idle_notification; unsigned char request_pending; unsigned char deferred_resume; unsigned char runtime_auto; bool ignore_children; unsigned char no_callbacks; unsigned char irq_safe; unsigned char use_autosuspend; unsigned char timer_autosuspends; unsigned char memalloc_noio; unsigned int links_count; enum rpm_request request; enum rpm_status runtime_status; int runtime_error; int autosuspend_delay; unsigned long last_busy; unsigned long active_jiffies; unsigned long suspended_jiffies; unsigned long accounting_timestamp; struct pm_subsys_data *subsys_data; void (*set_latency_tolerance)(struct device *, s32 ); struct dev_pm_qos *qos; } ;
612 struct dev_pm_domain { struct dev_pm_ops ops; void (*detach)(struct device *, bool ); int (*activate)(struct device *); void (*sync)(struct device *); void (*dismiss)(struct device *); } ;
76 struct dev_archdata { void *iommu; } ;
8 struct dma_map_ops ;
18 struct pdev_archdata { } ;
21 struct device_private ;
22 struct device_driver ;
23 struct driver_private ;
24 struct class ;
25 struct subsys_private ;
26 struct bus_type ;
27 struct device_node ;
28 struct fwnode_handle ;
29 struct iommu_ops ;
30 struct iommu_group ;
31 struct iommu_fwspec ;
62 struct bus_type { const char *name; const char *dev_name; struct device *dev_root; const struct attribute_group **bus_groups; const struct attribute_group **dev_groups; const struct attribute_group **drv_groups; int (*match)(struct device *, struct device_driver *); int (*uevent)(struct device *, struct kobj_uevent_env *); int (*probe)(struct device *); int (*remove)(struct device *); void (*shutdown)(struct device *); int (*online)(struct device *); int (*offline)(struct device *); int (*suspend)(struct device *, pm_message_t ); int (*resume)(struct device *); int (*num_vf)(struct device *); const struct dev_pm_ops *pm; const struct iommu_ops *iommu_ops; struct subsys_private *p; struct lock_class_key lock_key; } ;
145 struct device_type ;
204 enum probe_type { PROBE_DEFAULT_STRATEGY = 0, PROBE_PREFER_ASYNCHRONOUS = 1, PROBE_FORCE_SYNCHRONOUS = 2 } ;
210 struct of_device_id ;
210 struct acpi_device_id ;
210 struct device_driver { const char *name; struct bus_type *bus; struct module *owner; const char *mod_name; bool suppress_bind_attrs; enum probe_type probe_type; const struct of_device_id *of_match_table; const struct acpi_device_id *acpi_match_table; int (*probe)(struct device *); int (*remove)(struct device *); void (*shutdown)(struct device *); int (*suspend)(struct device *, pm_message_t ); int (*resume)(struct device *); const struct attribute_group **groups; const struct dev_pm_ops *pm; struct driver_private *p; } ;
360 struct class { const char *name; struct module *owner; const struct attribute_group **class_groups; const struct attribute_group **dev_groups; struct kobject *dev_kobj; int (*dev_uevent)(struct device *, struct kobj_uevent_env *); char * (*devnode)(struct device *, umode_t *); void (*class_release)(struct class *); void (*dev_release)(struct device *); int (*suspend)(struct device *, pm_message_t ); int (*resume)(struct device *); int (*shutdown)(struct device *); const struct kobj_ns_type_operations *ns_type; const void * (*namespace)(struct device *); const struct dev_pm_ops *pm; struct subsys_private *p; } ;
523 struct device_type { const char *name; const struct attribute_group **groups; int (*uevent)(struct device *, struct kobj_uevent_env *); char * (*devnode)(struct device *, umode_t *, kuid_t *, kgid_t *); void (*release)(struct device *); const struct dev_pm_ops *pm; } ;
551 struct device_attribute { struct attribute attr; ssize_t (*show)(struct device *, struct device_attribute *, char *); ssize_t (*store)(struct device *, struct device_attribute *, const char *, size_t ); } ;
723 struct device_dma_parameters { unsigned int max_segment_size; unsigned long segment_boundary_mask; } ;
786 enum dl_dev_state { DL_DEV_NO_DRIVER = 0, DL_DEV_PROBING = 1, DL_DEV_DRIVER_BOUND = 2, DL_DEV_UNBINDING = 3 } ;
793 struct dev_links_info { struct list_head suppliers; struct list_head consumers; enum dl_dev_state status; } ;
813 struct irq_domain ;
813 struct dma_coherent_mem ;
813 struct cma ;
813 struct device { struct device *parent; struct device_private *p; struct kobject kobj; const char *init_name; const struct device_type *type; struct mutex mutex; struct bus_type *bus; struct device_driver *driver; void *platform_data; void *driver_data; struct dev_links_info links; struct dev_pm_info power; struct dev_pm_domain *pm_domain; struct irq_domain *msi_domain; struct dev_pin_info *pins; struct list_head msi_list; int numa_node; const struct dma_map_ops *dma_ops; u64 *dma_mask; u64 coherent_dma_mask; unsigned long dma_pfn_offset; struct device_dma_parameters *dma_parms; struct list_head dma_pools; struct dma_coherent_mem *dma_mem; struct cma *cma_area; struct dev_archdata archdata; struct device_node *of_node; struct fwnode_handle *fwnode; dev_t devt; u32 id; spinlock_t devres_lock; struct list_head devres_head; struct klist_node knode_class; struct class *class; const struct attribute_group **groups; void (*release)(struct device *); struct iommu_group *iommu_group; struct iommu_fwspec *iommu_fwspec; bool offline_disabled; bool offline; bool of_node_reused; } ;
975 struct wakeup_source { const char *name; struct list_head entry; spinlock_t lock; struct wake_irq *wakeirq; struct timer_list timer; unsigned long timer_expires; ktime_t total_time; ktime_t max_time; ktime_t last_time; ktime_t start_prevent_time; ktime_t prevent_sleep_time; unsigned long event_count; unsigned long active_count; unsigned long relax_count; unsigned long expire_count; unsigned long wakeup_count; bool active; bool autosleep_enabled; } ;
19 struct vdso_image { void *data; unsigned long size; unsigned long alt; unsigned long alt_len; long sym_vvar_start; long sym_vvar_page; long sym_hpet_page; long sym_pvclock_page; long sym_hvclock_page; long sym_VDSO32_NOTE_MASK; long sym___kernel_sigreturn; long sym___kernel_rt_sigreturn; long sym___kernel_vsyscall; long sym_int80_landing_pad; } ;
15 typedef __u64 Elf64_Addr;
16 typedef __u16 Elf64_Half;
18 typedef __u64 Elf64_Off;
20 typedef __u32 Elf64_Word;
21 typedef __u64 Elf64_Xword;
190 struct elf64_sym { Elf64_Word st_name; unsigned char st_info; unsigned char st_other; Elf64_Half st_shndx; Elf64_Addr st_value; Elf64_Xword st_size; } ;
198 typedef struct elf64_sym Elf64_Sym;
219 struct elf64_hdr { unsigned char e_ident[16U]; Elf64_Half e_type; Elf64_Half e_machine; Elf64_Word e_version; Elf64_Addr e_entry; Elf64_Off e_phoff; Elf64_Off e_shoff; Elf64_Word e_flags; Elf64_Half e_ehsize; Elf64_Half e_phentsize; Elf64_Half e_phnum; Elf64_Half e_shentsize; Elf64_Half e_shnum; Elf64_Half e_shstrndx; } ;
235 typedef struct elf64_hdr Elf64_Ehdr;
314 struct elf64_shdr { Elf64_Word sh_name; Elf64_Word sh_type; Elf64_Xword sh_flags; Elf64_Addr sh_addr; Elf64_Off sh_offset; Elf64_Xword sh_size; Elf64_Word sh_link; Elf64_Word sh_info; Elf64_Xword sh_addralign; Elf64_Xword sh_entsize; } ;
326 typedef struct elf64_shdr Elf64_Shdr;
55 struct kernel_param ;
60 struct kernel_param_ops { unsigned int flags; int (*set)(const char *, const struct kernel_param *); int (*get)(char *, const struct kernel_param *); void (*free)(void *); } ;
63 struct kparam_string ;
63 struct kparam_array ;
63 union __anonunion____missing_field_name_336 { void *arg; const struct kparam_string *str; const struct kparam_array *arr; } ;
63 struct kernel_param { const char *name; struct module *mod; const struct kernel_param_ops *ops; const u16 perm; s8 level; u8 flags; union __anonunion____missing_field_name_336 __annonCompField68; } ;
85 struct kparam_string { unsigned int maxlen; char *string; } ;
91 struct kparam_array { unsigned int max; unsigned int elemsize; unsigned int *num; const struct kernel_param_ops *ops; void *elem; } ;
533 struct latch_tree_node { struct rb_node node[2U]; } ;
211 struct mod_arch_specific { } ;
38 struct exception_table_entry ;
39 struct module_param_attrs ;
39 struct module_kobject { struct kobject kobj; struct module *mod; struct kobject *drivers_dir; struct module_param_attrs *mp; struct completion *kobj_completion; } ;
49 struct module_attribute { struct attribute attr; ssize_t (*show)(struct module_attribute *, struct module_kobject *, char *); ssize_t (*store)(struct module_attribute *, struct module_kobject *, const char *, size_t ); void (*setup)(struct module *, const char *); int (*test)(struct module *); void (*free)(struct module *); } ;
276 enum module_state { MODULE_STATE_LIVE = 0, MODULE_STATE_COMING = 1, MODULE_STATE_GOING = 2, MODULE_STATE_UNFORMED = 3 } ;
283 struct mod_tree_node { struct module *mod; struct latch_tree_node node; } ;
288 struct module_layout { void *base; unsigned int size; unsigned int text_size; unsigned int ro_size; unsigned int ro_after_init_size; struct mod_tree_node mtn; } ;
304 struct mod_kallsyms { Elf64_Sym *symtab; unsigned int num_symtab; char *strtab; } ;
318 struct klp_modinfo { Elf64_Ehdr hdr; Elf64_Shdr *sechdrs; char *secstrings; unsigned int symndx; } ;
326 struct module_sect_attrs ;
326 struct module_notes_attrs ;
326 struct trace_event_call ;
326 struct trace_eval_map ;
326 struct module { enum module_state state; struct list_head list; char name[56U]; struct module_kobject mkobj; struct module_attribute *modinfo_attrs; const char *version; const char *srcversion; struct kobject *holders_dir; const struct kernel_symbol *syms; const s32 *crcs; unsigned int num_syms; struct mutex param_lock; struct kernel_param *kp; unsigned int num_kp; unsigned int num_gpl_syms; const struct kernel_symbol *gpl_syms; const s32 *gpl_crcs; const struct kernel_symbol *unused_syms; const s32 *unused_crcs; unsigned int num_unused_syms; unsigned int num_unused_gpl_syms; const struct kernel_symbol *unused_gpl_syms; const s32 *unused_gpl_crcs; bool sig_ok; bool async_probe_requested; const struct kernel_symbol *gpl_future_syms; const s32 *gpl_future_crcs; unsigned int num_gpl_future_syms; unsigned int num_exentries; struct exception_table_entry *extable; int (*init)(); struct module_layout core_layout; struct module_layout init_layout; struct mod_arch_specific arch; unsigned long taints; unsigned int num_bugs; struct list_head bug_list; struct bug_entry *bug_table; struct mod_kallsyms *kallsyms; struct mod_kallsyms core_kallsyms; struct module_sect_attrs *sect_attrs; struct module_notes_attrs *notes_attrs; char *args; void *percpu; unsigned int percpu_size; unsigned int num_tracepoints; const struct tracepoint **tracepoints_ptrs; unsigned int num_trace_bprintk_fmt; const char **trace_bprintk_fmt_start; struct trace_event_call **trace_events; unsigned int num_trace_events; struct trace_eval_map **trace_evals; unsigned int num_trace_evals; bool klp; bool klp_alive; struct klp_modinfo *klp_info; struct list_head source_list; struct list_head target_list; void (*exit)(); atomic_t refcnt; ctor_fn_t (**ctors)(); unsigned int num_ctors; } ;
13 typedef unsigned long kernel_ulong_t;
187 struct acpi_device_id { __u8 id[9U]; kernel_ulong_t driver_data; __u32 cls; __u32 cls_msk; } ;
230 struct of_device_id { char name[32U]; char type[32U]; char compatible[128U]; const void *data; } ;
496 struct platform_device_id { char name[20U]; kernel_ulong_t driver_data; } ;
687 enum fwnode_type { FWNODE_INVALID = 0, FWNODE_OF = 1, FWNODE_ACPI = 2, FWNODE_ACPI_DATA = 3, FWNODE_ACPI_STATIC = 4, FWNODE_PDATA = 5, FWNODE_IRQCHIP = 6 } ;
697 struct fwnode_operations ;
698 struct fwnode_handle { enum fwnode_type type; struct fwnode_handle *secondary; const struct fwnode_operations *ops; } ;
34 struct fwnode_endpoint { unsigned int port; unsigned int id; const struct fwnode_handle *local_fwnode; } ;
46 struct fwnode_operations { void (*get)(struct fwnode_handle *); void (*put)(struct fwnode_handle *); bool (*device_is_available)(struct fwnode_handle *); bool (*property_present)(struct fwnode_handle *, const char *); int (*property_read_int_array)(struct fwnode_handle *, const char *, unsigned int, void *, size_t ); int (*property_read_string_array)(struct fwnode_handle *, const char *, const char **, size_t ); struct fwnode_handle * (*get_parent)(struct fwnode_handle *); struct fwnode_handle * (*get_next_child_node)(struct fwnode_handle *, struct fwnode_handle *); struct fwnode_handle * (*get_named_child_node)(struct fwnode_handle *, const char *); struct fwnode_handle * (*graph_get_next_endpoint)(struct fwnode_handle *, struct fwnode_handle *); struct fwnode_handle * (*graph_get_remote_endpoint)(struct fwnode_handle *); struct fwnode_handle * (*graph_get_port_parent)(struct fwnode_handle *); int (*graph_parse_endpoint)(struct fwnode_handle *, struct fwnode_endpoint *); } ;
32 typedef u32 phandle;
34 struct property { char *name; int length; void *value; struct property *next; unsigned long _flags; unsigned int unique_id; struct bin_attribute attr; } ;
44 struct device_node { const char *name; const char *type; phandle phandle; const char *full_name; struct fwnode_handle fwnode; struct property *properties; struct property *deadprops; struct device_node *parent; struct device_node *child; struct device_node *sibling; struct kobject kobj; unsigned long _flags; void *data; } ;
133 struct irq_desc ;
13 enum irqreturn { IRQ_NONE = 0, IRQ_HANDLED = 1, IRQ_WAKE_THREAD = 2 } ;
16 typedef enum irqreturn irqreturn_t;
30 struct msi_msg ;
31 enum irqchip_irq_state ;
63 struct msi_desc ;
64 struct irq_common_data { unsigned int state_use_accessors; unsigned int node; void *handler_data; struct msi_desc *msi_desc; cpumask_var_t affinity; cpumask_var_t effective_affinity; } ;
157 struct irq_chip ;
157 struct irq_data { u32 mask; unsigned int irq; unsigned long hwirq; struct irq_common_data *common; struct irq_chip *chip; struct irq_domain *domain; struct irq_data *parent_data; void *chip_data; } ;
376 struct irq_chip { struct device *parent_device; const char *name; unsigned int (*irq_startup)(struct irq_data *); void (*irq_shutdown)(struct irq_data *); void (*irq_enable)(struct irq_data *); void (*irq_disable)(struct irq_data *); void (*irq_ack)(struct irq_data *); void (*irq_mask)(struct irq_data *); void (*irq_mask_ack)(struct irq_data *); void (*irq_unmask)(struct irq_data *); void (*irq_eoi)(struct irq_data *); int (*irq_set_affinity)(struct irq_data *, const struct cpumask *, bool ); int (*irq_retrigger)(struct irq_data *); int (*irq_set_type)(struct irq_data *, unsigned int); int (*irq_set_wake)(struct irq_data *, unsigned int); void (*irq_bus_lock)(struct irq_data *); void (*irq_bus_sync_unlock)(struct irq_data *); void (*irq_cpu_online)(struct irq_data *); void (*irq_cpu_offline)(struct irq_data *); void (*irq_suspend)(struct irq_data *); void (*irq_resume)(struct irq_data *); void (*irq_pm_shutdown)(struct irq_data *); void (*irq_calc_mask)(struct irq_data *); void (*irq_print_chip)(struct irq_data *, struct seq_file *); int (*irq_request_resources)(struct irq_data *); void (*irq_release_resources)(struct irq_data *); void (*irq_compose_msi_msg)(struct irq_data *, struct msi_msg *); void (*irq_write_msi_msg)(struct irq_data *, struct msi_msg *); int (*irq_get_irqchip_state)(struct irq_data *, enum irqchip_irq_state , bool *); int (*irq_set_irqchip_state)(struct irq_data *, enum irqchip_irq_state , bool ); int (*irq_set_vcpu_affinity)(struct irq_data *, void *); void (*ipi_send_single)(struct irq_data *, unsigned int); void (*ipi_send_mask)(struct irq_data *, const struct cpumask *); unsigned long flags; } ;
477 struct irq_affinity_notify ;
478 struct proc_dir_entry ;
479 struct irqaction ;
479 struct irq_desc { struct irq_common_data irq_common_data; struct irq_data irq_data; unsigned int *kstat_irqs; void (*handle_irq)(struct irq_desc *); struct irqaction *action; unsigned int status_use_accessors; unsigned int core_internal_state__do_not_mess_with_it; unsigned int depth; unsigned int wake_depth; unsigned int irq_count; unsigned long last_unhandled; unsigned int irqs_unhandled; atomic_t threads_handled; int threads_handled_last; raw_spinlock_t lock; struct cpumask *percpu_enabled; const struct cpumask *percpu_affinity; const struct cpumask *affinity_hint; struct irq_affinity_notify *affinity_notify; cpumask_var_t pending_mask; unsigned long threads_oneshot; atomic_t threads_active; wait_queue_head_t wait_for_threads; unsigned int nr_actions; unsigned int no_suspend_depth; unsigned int cond_suspend_depth; unsigned int force_resume_depth; struct proc_dir_entry *dir; struct dentry *debugfs_file; struct callback_head rcu; struct kobject kobj; struct mutex request_mutex; int parent_irq; struct module *owner; const char *name; } ;
133 struct exception_table_entry { int insn; int fixup; int handler; } ;
843 struct irq_chip_regs { unsigned long enable; unsigned long disable; unsigned long mask; unsigned long ack; unsigned long eoi; unsigned long type; unsigned long polarity; } ;
882 struct irq_chip_type { struct irq_chip chip; struct irq_chip_regs regs; void (*handler)(struct irq_desc *); u32 type; u32 mask_cache_priv; u32 *mask_cache; } ;
904 struct irq_chip_generic { raw_spinlock_t lock; void *reg_base; u32 (*reg_readl)(void *); void (*reg_writel)(u32 , void *); void (*suspend)(struct irq_chip_generic *); void (*resume)(struct irq_chip_generic *); unsigned int irq_base; unsigned int irq_cnt; u32 mask_cache; u32 type_cache; u32 polarity_cache; u32 wake_enabled; u32 wake_active; unsigned int num_ct; void *private; unsigned long installed; unsigned long unused; struct irq_domain *domain; struct list_head list; struct irq_chip_type chip_types[0U]; } ;
960 enum irq_gc_flags { IRQ_GC_INIT_MASK_CACHE = 1, IRQ_GC_INIT_NESTED_LOCK = 2, IRQ_GC_MASK_CACHE_PER_TYPE = 4, IRQ_GC_NO_MASK = 8, IRQ_GC_BE_IO = 16 } ;
968 struct irq_domain_chip_generic { unsigned int irqs_per_chip; unsigned int num_chips; unsigned int irq_flags_to_clear; unsigned int irq_flags_to_set; enum irq_gc_flags gc_flags; struct irq_chip_generic *gc[0U]; } ;
1116 struct irq_fwspec { struct fwnode_handle *fwnode; int param_count; u32 param[16U]; } ;
64 enum irq_domain_bus_token { DOMAIN_BUS_ANY = 0, DOMAIN_BUS_WIRED = 1, DOMAIN_BUS_PCI_MSI = 2, DOMAIN_BUS_PLATFORM_MSI = 3, DOMAIN_BUS_NEXUS = 4, DOMAIN_BUS_IPI = 5, DOMAIN_BUS_FSL_MC_MSI = 6 } ;
74 struct irq_domain_ops { int (*match)(struct irq_domain *, struct device_node *, enum irq_domain_bus_token ); int (*select)(struct irq_domain *, struct irq_fwspec *, enum irq_domain_bus_token ); int (*map)(struct irq_domain *, unsigned int, irq_hw_number_t ); void (*unmap)(struct irq_domain *, unsigned int); int (*xlate)(struct irq_domain *, struct device_node *, const u32 *, unsigned int, unsigned long *, unsigned int *); int (*alloc)(struct irq_domain *, unsigned int, unsigned int, void *); void (*free)(struct irq_domain *, unsigned int, unsigned int); void (*activate)(struct irq_domain *, struct irq_data *); void (*deactivate)(struct irq_domain *, struct irq_data *); int (*translate)(struct irq_domain *, struct irq_fwspec *, unsigned long *, unsigned int *); } ;
122 struct irq_domain { struct list_head link; const char *name; const struct irq_domain_ops *ops; void *host_data; unsigned int flags; unsigned int mapcount; struct fwnode_handle *fwnode; enum irq_domain_bus_token bus_token; struct irq_domain_chip_generic *gc; struct irq_domain *parent; struct dentry *debugfs_file; irq_hw_number_t hwirq_max; unsigned int revmap_direct_max_irq; unsigned int revmap_size; struct radix_tree_root revmap_tree; unsigned int linear_revmap[]; } ;
165 struct mfd_cell ;
166 struct platform_device { const char *name; int id; bool id_auto; struct device dev; u32 num_resources; struct resource *resource; const struct platform_device_id *id_entry; char *driver_override; struct mfd_cell *mfd_cell; struct pdev_archdata archdata; } ;
110 struct clk ;
93 struct irqaction { irqreturn_t (*handler)(int, void *); void *dev_id; void *percpu_dev_id; struct irqaction *next; irqreturn_t (*thread_fn)(int, void *); struct task_struct *thread; struct irqaction *secondary; unsigned int irq; unsigned int flags; unsigned long thread_flags; unsigned long thread_mask; const char *name; struct proc_dir_entry *dir; } ;
223 struct irq_affinity_notify { unsigned int irq; struct kref kref; struct work_struct work; void (*notify)(struct irq_affinity_notify *, const cpumask_t *); void (*release)(struct kref *); } ;
413 enum irqchip_irq_state { IRQCHIP_STATE_PENDING = 0, IRQCHIP_STATE_ACTIVE = 1, IRQCHIP_STATE_MASKED = 2, IRQCHIP_STATE_LINE_LEVEL = 3 } ;
743 struct circ_buf { char *buf; int head; int tail; } ;
6 typedef unsigned char cc_t;
7 typedef unsigned int speed_t;
8 typedef unsigned int tcflag_t;
30 struct ktermios { tcflag_t c_iflag; tcflag_t c_oflag; tcflag_t c_cflag; tcflag_t c_lflag; cc_t c_line; cc_t c_cc[19U]; speed_t c_ispeed; speed_t c_ospeed; } ;
41 struct winsize { unsigned short ws_row; unsigned short ws_col; unsigned short ws_xpixel; unsigned short ws_ypixel; } ;
93 struct termiox { __u16 x_hflag; __u16 x_cflag; __u16 x_rflag[5U]; __u16 x_sflag; } ;
16 struct cdev { struct kobject kobj; struct module *owner; const struct file_operations *ops; struct list_head list; dev_t dev; unsigned int count; } ;
37 struct tty_struct ;
38 struct tty_driver ;
39 struct serial_icounter_struct ;
40 struct tty_operations { struct tty_struct * (*lookup)(struct tty_driver *, struct file *, int); int (*install)(struct tty_driver *, struct tty_struct *); void (*remove)(struct tty_driver *, struct tty_struct *); int (*open)(struct tty_struct *, struct file *); void (*close)(struct tty_struct *, struct file *); void (*shutdown)(struct tty_struct *); void (*cleanup)(struct tty_struct *); int (*write)(struct tty_struct *, const unsigned char *, int); int (*put_char)(struct tty_struct *, unsigned char); void (*flush_chars)(struct tty_struct *); int (*write_room)(struct tty_struct *); int (*chars_in_buffer)(struct tty_struct *); int (*ioctl)(struct tty_struct *, unsigned int, unsigned long); long int (*compat_ioctl)(struct tty_struct *, unsigned int, unsigned long); void (*set_termios)(struct tty_struct *, struct ktermios *); void (*throttle)(struct tty_struct *); void (*unthrottle)(struct tty_struct *); void (*stop)(struct tty_struct *); void (*start)(struct tty_struct *); void (*hangup)(struct tty_struct *); int (*break_ctl)(struct tty_struct *, int); void (*flush_buffer)(struct tty_struct *); void (*set_ldisc)(struct tty_struct *); void (*wait_until_sent)(struct tty_struct *, int); void (*send_xchar)(struct tty_struct *, char); int (*tiocmget)(struct tty_struct *); int (*tiocmset)(struct tty_struct *, unsigned int, unsigned int); int (*resize)(struct tty_struct *, struct winsize *); int (*set_termiox)(struct tty_struct *, struct termiox *); int (*get_icount)(struct tty_struct *, struct serial_icounter_struct *); int (*poll_init)(struct tty_driver *, int, char *); int (*poll_get_char)(struct tty_driver *, int); void (*poll_put_char)(struct tty_driver *, int, char); const struct file_operations *proc_fops; } ;
295 struct tty_port ;
295 struct tty_driver { int magic; struct kref kref; struct cdev **cdevs; struct module *owner; const char *driver_name; const char *name; int name_base; int major; int minor_start; unsigned int num; short type; short subtype; struct ktermios init_termios; unsigned long flags; struct proc_dir_entry *proc_entry; struct tty_driver *other; struct tty_struct **ttys; struct tty_port **ports; struct ktermios **termios; void *driver_state; const struct tty_operations *ops; struct list_head tty_drivers; } ;
362 struct ld_semaphore { long count; raw_spinlock_t wait_lock; unsigned int wait_readers; struct list_head read_wait; struct list_head write_wait; struct lockdep_map dep_map; } ;
159 struct tty_ldisc_ops { int magic; char *name; int num; int flags; int (*open)(struct tty_struct *); void (*close)(struct tty_struct *); void (*flush_buffer)(struct tty_struct *); ssize_t (*read)(struct tty_struct *, struct file *, unsigned char *, size_t ); ssize_t (*write)(struct tty_struct *, struct file *, const unsigned char *, size_t ); int (*ioctl)(struct tty_struct *, struct file *, unsigned int, unsigned long); long int (*compat_ioctl)(struct tty_struct *, struct file *, unsigned int, unsigned long); void (*set_termios)(struct tty_struct *, struct ktermios *); unsigned int (*poll)(struct tty_struct *, struct file *, struct poll_table_struct *); int (*hangup)(struct tty_struct *); void (*receive_buf)(struct tty_struct *, const unsigned char *, char *, int); void (*write_wakeup)(struct tty_struct *); void (*dcd_change)(struct tty_struct *, unsigned int); int (*receive_buf2)(struct tty_struct *, const unsigned char *, char *, int); struct module *owner; int refcount; } ;
207 struct tty_ldisc { struct tty_ldisc_ops *ops; struct tty_struct *tty; } ;
217 union __anonunion____missing_field_name_366 { struct tty_buffer *next; struct llist_node free; } ;
217 struct tty_buffer { union __anonunion____missing_field_name_366 __annonCompField82; int used; int size; int commit; int read; int flags; unsigned long data[0U]; } ;
82 struct tty_bufhead { struct tty_buffer *head; struct work_struct work; struct mutex lock; atomic_t priority; struct tty_buffer sentinel; struct llist_head free; atomic_t mem_used; int mem_limit; struct tty_buffer *tail; } ;
94 struct tty_port_operations { int (*carrier_raised)(struct tty_port *); void (*dtr_rts)(struct tty_port *, int); void (*shutdown)(struct tty_port *); int (*activate)(struct tty_port *, struct tty_struct *); void (*destruct)(struct tty_port *); } ;
220 struct tty_port_client_operations { int (*receive_buf)(struct tty_port *, const unsigned char *, const unsigned char *, size_t ); void (*write_wakeup)(struct tty_port *); } ;
225 struct tty_port { struct tty_bufhead buf; struct tty_struct *tty; struct tty_struct *itty; const struct tty_port_operations *ops; const struct tty_port_client_operations *client_ops; spinlock_t lock; int blocked_open; int count; wait_queue_head_t open_wait; wait_queue_head_t delta_msr_wait; unsigned long flags; unsigned long iflags; unsigned char console; unsigned char low_latency; struct mutex mutex; struct mutex buf_mutex; unsigned char *xmit_buf; unsigned int close_delay; unsigned int closing_wait; int drain_delay; struct kref kref; void *client_data; } ;
252 struct tty_struct { int magic; struct kref kref; struct device *dev; struct tty_driver *driver; const struct tty_operations *ops; int index; struct ld_semaphore ldisc_sem; struct tty_ldisc *ldisc; struct mutex atomic_write_lock; struct mutex legacy_mutex; struct mutex throttle_mutex; struct rw_semaphore termios_rwsem; struct mutex winsize_mutex; spinlock_t ctrl_lock; spinlock_t flow_lock; struct ktermios termios; struct ktermios termios_locked; struct termiox *termiox; char name[64U]; struct pid *pgrp; struct pid *session; unsigned long flags; int count; struct winsize winsize; unsigned char stopped; unsigned char flow_stopped; unsigned long unused; int hw_stopped; unsigned char ctrl_status; unsigned char packet; unsigned long unused_ctrl; unsigned int receive_room; int flow_change; struct tty_struct *link; struct fasync_struct *fasync; wait_queue_head_t write_wait; wait_queue_head_t read_wait; struct work_struct hangup_work; void *disc_data; void *driver_data; spinlock_t files_lock; struct list_head tty_files; int closing; unsigned char *write_buf; int write_cnt; struct work_struct SAK_work; struct tty_port *port; } ;
52 struct serial_struct { int type; int line; unsigned int port; int irq; int flags; int xmit_fifo_size; int custom_divisor; int baud_base; unsigned short close_delay; char io_type; char reserved_char[1U]; int hub6; unsigned short closing_wait; unsigned short closing_wait2; unsigned char *iomem_base; unsigned short iomem_reg_shift; unsigned int port_high; unsigned long iomap_base; } ;
96 struct serial_icounter_struct { int cts; int dsr; int rng; int dcd; int rx; int tx; int frame; int overrun; int parity; int brk; int buf_overrun; int reserved[9U]; } ;
108 struct serial_rs485 { __u32 flags; __u32 delay_rts_before_send; __u32 delay_rts_after_send; __u32 padding[5U]; } ;
25 struct uart_port ;
26 struct uart_ops { unsigned int (*tx_empty)(struct uart_port *); void (*set_mctrl)(struct uart_port *, unsigned int); unsigned int (*get_mctrl)(struct uart_port *); void (*stop_tx)(struct uart_port *); void (*start_tx)(struct uart_port *); void (*throttle)(struct uart_port *); void (*unthrottle)(struct uart_port *); void (*send_xchar)(struct uart_port *, char); void (*stop_rx)(struct uart_port *); void (*enable_ms)(struct uart_port *); void (*break_ctl)(struct uart_port *, int); int (*startup)(struct uart_port *); void (*shutdown)(struct uart_port *); void (*flush_buffer)(struct uart_port *); void (*set_termios)(struct uart_port *, struct ktermios *, struct ktermios *); void (*set_ldisc)(struct uart_port *, struct ktermios *); void (*pm)(struct uart_port *, unsigned int, unsigned int); const char * (*type)(struct uart_port *); void (*release_port)(struct uart_port *); int (*request_port)(struct uart_port *); void (*config_port)(struct uart_port *, int); int (*verify_port)(struct uart_port *, struct serial_struct *); int (*ioctl)(struct uart_port *, unsigned int, unsigned long); int (*poll_init)(struct uart_port *); void (*poll_put_char)(struct uart_port *, unsigned char); int (*poll_get_char)(struct uart_port *); } ;
94 struct uart_icount { __u32 cts; __u32 dsr; __u32 rng; __u32 dcd; __u32 rx; __u32 tx; __u32 frame; __u32 overrun; __u32 parity; __u32 brk; __u32 buf_overrun; } ;
114 typedef unsigned int upf_t;
115 typedef unsigned int upstat_t;
116 struct uart_state ;
116 struct console ;
116 struct uart_port { spinlock_t lock; unsigned long iobase; unsigned char *membase; unsigned int (*serial_in)(struct uart_port *, int); void (*serial_out)(struct uart_port *, int, int); void (*set_termios)(struct uart_port *, struct ktermios *, struct ktermios *); void (*set_ldisc)(struct uart_port *, struct ktermios *); unsigned int (*get_mctrl)(struct uart_port *); void (*set_mctrl)(struct uart_port *, unsigned int); int (*startup)(struct uart_port *); void (*shutdown)(struct uart_port *); void (*throttle)(struct uart_port *); void (*unthrottle)(struct uart_port *); int (*handle_irq)(struct uart_port *); void (*pm)(struct uart_port *, unsigned int, unsigned int); void (*handle_break)(struct uart_port *); int (*rs485_config)(struct uart_port *, struct serial_rs485 *); unsigned int irq; unsigned long irqflags; unsigned int uartclk; unsigned int fifosize; unsigned char x_char; unsigned char regshift; unsigned char iotype; unsigned char unused1; unsigned int read_status_mask; unsigned int ignore_status_mask; struct uart_state *state; struct uart_icount icount; struct console *cons; unsigned long sysrq; upf_t flags; upstat_t status; int hw_stopped; unsigned int mctrl; unsigned int timeout; unsigned int type; const struct uart_ops *ops; unsigned int custom_divisor; unsigned int line; unsigned int minor; resource_size_t mapbase; resource_size_t mapsize; struct device *dev; unsigned char hub6; unsigned char suspended; unsigned char irq_wake; unsigned char unused[2U]; const char *name; struct attribute_group *attr_group; const struct attribute_group **tty_groups; struct serial_rs485 rs485; void *private_data; } ;
267 enum uart_pm_state { UART_PM_STATE_ON = 0, UART_PM_STATE_OFF = 3, UART_PM_STATE_UNDEFINED = 4 } ;
273 struct uart_state { struct tty_port port; enum uart_pm_state pm_state; struct circ_buf xmit; atomic_t refcount; wait_queue_head_t remove_wait; struct uart_port *uart_port; } ;
61 struct uart_8250_dma ;
62 struct uart_8250_port ;
63 struct uart_8250_ops { int (*setup_irq)(struct uart_8250_port *); void (*release_irq)(struct uart_8250_port *); } ;
81 struct uart_8250_em485 { struct timer_list start_tx_timer; struct timer_list stop_tx_timer; struct timer_list *active_timer; } ;
87 struct uart_8250_port { struct uart_port port; struct timer_list timer; struct list_head list; u32 capabilities; unsigned short bugs; bool fifo_bug; unsigned int tx_loadsz; unsigned char acr; unsigned char fcr; unsigned char ier; unsigned char lcr; unsigned char mcr; unsigned char mcr_mask; unsigned char mcr_force; unsigned char cur_iotype; unsigned int rpm_tx_active; unsigned char canary; unsigned char probe; unsigned char lsr_saved_flags; unsigned char msr_saved_flags; struct uart_8250_dma *dma; const struct uart_8250_ops *ops; int (*dl_read)(struct uart_8250_port *); void (*dl_write)(struct uart_8250_port *, int); struct uart_8250_em485 *em485; } ;
174 struct iovec { void *iov_base; __kernel_size_t iov_len; } ;
21 struct kvec { void *iov_base; size_t iov_len; } ;
30 union __anonunion____missing_field_name_367 { const struct iovec *iov; const struct kvec *kvec; const struct bio_vec *bvec; struct pipe_inode_info *pipe; } ;
30 struct __anonstruct____missing_field_name_369 { int idx; int start_idx; } ;
30 union __anonunion____missing_field_name_368 { unsigned long nr_segs; struct __anonstruct____missing_field_name_369 __annonCompField84; } ;
30 struct iov_iter { int type; size_t iov_offset; size_t count; union __anonunion____missing_field_name_367 __annonCompField83; union __anonunion____missing_field_name_368 __annonCompField85; } ;
279 struct vm_fault { struct vm_area_struct *vma; unsigned int flags; gfp_t gfp_mask; unsigned long pgoff; unsigned long address; pmd_t *pmd; pud_t *pud; pte_t orig_pte; struct page *cow_page; struct mem_cgroup *memcg; struct page *page; pte_t *pte; spinlock_t *ptl; pgtable_t prealloc_pte; } ;
342 enum page_entry_size { PE_SIZE_PTE = 0, PE_SIZE_PMD = 1, PE_SIZE_PUD = 2 } ;
348 struct vm_operations_struct { void (*open)(struct vm_area_struct *); void (*close)(struct vm_area_struct *); int (*mremap)(struct vm_area_struct *); int (*fault)(struct vm_fault *); int (*huge_fault)(struct vm_fault *, enum page_entry_size ); void (*map_pages)(struct vm_fault *, unsigned long, unsigned long); int (*page_mkwrite)(struct vm_fault *); int (*pfn_mkwrite)(struct vm_fault *); int (*access)(struct vm_area_struct *, unsigned long, void *, int, int); const char * (*name)(struct vm_area_struct *); int (*set_policy)(struct vm_area_struct *, struct mempolicy *); struct mempolicy * (*get_policy)(struct vm_area_struct *, unsigned long); struct page * (*find_special_page)(struct vm_area_struct *, unsigned long); } ;
2556 struct scatterlist { unsigned long sg_magic; unsigned long page_link; unsigned int offset; unsigned int length; dma_addr_t dma_address; unsigned int dma_length; } ;
34 typedef s32 dma_cookie_t;
41 enum dma_status { DMA_COMPLETE = 0, DMA_IN_PROGRESS = 1, DMA_PAUSED = 2, DMA_ERROR = 3 } ;
66 enum dma_transfer_direction { DMA_MEM_TO_MEM = 0, DMA_MEM_TO_DEV = 1, DMA_DEV_TO_MEM = 2, DMA_DEV_TO_DEV = 3, DMA_TRANS_NONE = 4 } ;
74 struct data_chunk { size_t size; size_t icg; size_t dst_icg; size_t src_icg; } ;
140 struct dma_interleaved_template { dma_addr_t src_start; dma_addr_t dst_start; enum dma_transfer_direction dir; bool src_inc; bool dst_inc; bool src_sgl; bool dst_sgl; size_t numf; size_t frame_size; struct data_chunk sgl[0U]; } ;
171 enum dma_ctrl_flags { DMA_PREP_INTERRUPT = 1, DMA_CTRL_ACK = 2, DMA_PREP_PQ_DISABLE_P = 4, DMA_PREP_PQ_DISABLE_Q = 8, DMA_PREP_CONTINUE = 16, DMA_PREP_FENCE = 32, DMA_CTRL_REUSE = 64 } ;
186 enum sum_check_flags { SUM_CHECK_P_RESULT = 1, SUM_CHECK_Q_RESULT = 2 } ;
223 struct __anonstruct_dma_cap_mask_t_382 { unsigned long bits[1U]; } ;
223 typedef struct __anonstruct_dma_cap_mask_t_382 dma_cap_mask_t;
225 struct dma_chan_percpu { unsigned long memcpy_count; unsigned long bytes_transferred; } ;
236 struct dma_router { struct device *dev; void (*route_free)(struct device *, void *); } ;
246 struct dma_device ;
246 struct dma_chan_dev ;
246 struct dma_chan { struct dma_device *device; dma_cookie_t cookie; dma_cookie_t completed_cookie; int chan_id; struct dma_chan_dev *dev; struct list_head device_node; struct dma_chan_percpu *local; int client_count; int table_count; struct dma_router *router; void *route_data; void *private; } ;
282 struct dma_chan_dev { struct dma_chan *chan; struct device device; int dev_id; atomic_t *idr_ref; } ;
296 enum dma_slave_buswidth { DMA_SLAVE_BUSWIDTH_UNDEFINED = 0, DMA_SLAVE_BUSWIDTH_1_BYTE = 1, DMA_SLAVE_BUSWIDTH_2_BYTES = 2, DMA_SLAVE_BUSWIDTH_3_BYTES = 3, DMA_SLAVE_BUSWIDTH_4_BYTES = 4, DMA_SLAVE_BUSWIDTH_8_BYTES = 8, DMA_SLAVE_BUSWIDTH_16_BYTES = 16, DMA_SLAVE_BUSWIDTH_32_BYTES = 32, DMA_SLAVE_BUSWIDTH_64_BYTES = 64 } ;
308 struct dma_slave_config { enum dma_transfer_direction direction; phys_addr_t src_addr; phys_addr_t dst_addr; enum dma_slave_buswidth src_addr_width; enum dma_slave_buswidth dst_addr_width; u32 src_maxburst; u32 dst_maxburst; u32 src_port_window_size; u32 dst_port_window_size; bool device_fc; unsigned int slave_id; } ;
377 enum dma_residue_granularity { DMA_RESIDUE_GRANULARITY_DESCRIPTOR = 0, DMA_RESIDUE_GRANULARITY_SEGMENT = 1, DMA_RESIDUE_GRANULARITY_BURST = 2 } ;
451 enum dmaengine_tx_result { DMA_TRANS_NOERROR = 0, DMA_TRANS_READ_FAILED = 1, DMA_TRANS_WRITE_FAILED = 2, DMA_TRANS_ABORTED = 3 } ;
458 struct dmaengine_result { enum dmaengine_tx_result result; u32 residue; } ;
465 struct dmaengine_unmap_data { u8 map_cnt; u8 to_cnt; u8 from_cnt; u8 bidi_cnt; struct device *dev; struct kref kref; size_t len; dma_addr_t addr[0U]; } ;
477 struct dma_async_tx_descriptor { dma_cookie_t cookie; enum dma_ctrl_flags flags; dma_addr_t phys; struct dma_chan *chan; dma_cookie_t (*tx_submit)(struct dma_async_tx_descriptor *); int (*desc_free)(struct dma_async_tx_descriptor *); void (*callback)(void *); void (*callback_result)(void *, const struct dmaengine_result *); void *callback_param; struct dmaengine_unmap_data *unmap; struct dma_async_tx_descriptor *next; struct dma_async_tx_descriptor *parent; spinlock_t lock; } ;
604 struct dma_tx_state { dma_cookie_t last; dma_cookie_t used; u32 residue; } ;
620 enum dmaengine_alignment { DMAENGINE_ALIGN_1_BYTE = 0, DMAENGINE_ALIGN_2_BYTES = 1, DMAENGINE_ALIGN_4_BYTES = 2, DMAENGINE_ALIGN_8_BYTES = 3, DMAENGINE_ALIGN_16_BYTES = 4, DMAENGINE_ALIGN_32_BYTES = 5, DMAENGINE_ALIGN_64_BYTES = 6 } ;
630 struct dma_slave_map { const char *devname; const char *slave; void *param; } ;
647 struct dma_filter { bool (*fn)(struct dma_chan *, void *); int mapcnt; const struct dma_slave_map *map; } ;
660 struct dma_device { unsigned int chancnt; unsigned int privatecnt; struct list_head channels; struct list_head global_node; struct dma_filter filter; dma_cap_mask_t cap_mask; unsigned short max_xor; unsigned short max_pq; enum dmaengine_alignment copy_align; enum dmaengine_alignment xor_align; enum dmaengine_alignment pq_align; enum dmaengine_alignment fill_align; int dev_id; struct device *dev; u32 src_addr_widths; u32 dst_addr_widths; u32 directions; u32 max_burst; bool descriptor_reuse; enum dma_residue_granularity residue_granularity; int (*device_alloc_chan_resources)(struct dma_chan *); void (*device_free_chan_resources)(struct dma_chan *); struct dma_async_tx_descriptor * (*device_prep_dma_memcpy)(struct dma_chan *, dma_addr_t , dma_addr_t , size_t , unsigned long); struct dma_async_tx_descriptor * (*device_prep_dma_xor)(struct dma_chan *, dma_addr_t , dma_addr_t *, unsigned int, size_t , unsigned long); struct dma_async_tx_descriptor * (*device_prep_dma_xor_val)(struct dma_chan *, dma_addr_t *, unsigned int, size_t , enum sum_check_flags *, unsigned long); struct dma_async_tx_descriptor * (*device_prep_dma_pq)(struct dma_chan *, dma_addr_t *, dma_addr_t *, unsigned int, const unsigned char *, size_t , unsigned long); struct dma_async_tx_descriptor * (*device_prep_dma_pq_val)(struct dma_chan *, dma_addr_t *, dma_addr_t *, unsigned int, const unsigned char *, size_t , enum sum_check_flags *, unsigned long); struct dma_async_tx_descriptor * (*device_prep_dma_memset)(struct dma_chan *, dma_addr_t , int, size_t , unsigned long); struct dma_async_tx_descriptor * (*device_prep_dma_memset_sg)(struct dma_chan *, struct scatterlist *, unsigned int, int, unsigned long); struct dma_async_tx_descriptor * (*device_prep_dma_interrupt)(struct dma_chan *, unsigned long); struct dma_async_tx_descriptor * (*device_prep_dma_sg)(struct dma_chan *, struct scatterlist *, unsigned int, struct scatterlist *, unsigned int, unsigned long); struct dma_async_tx_descriptor * (*device_prep_slave_sg)(struct dma_chan *, struct scatterlist *, unsigned int, enum dma_transfer_direction , unsigned long, void *); struct dma_async_tx_descriptor * (*device_prep_dma_cyclic)(struct dma_chan *, dma_addr_t , size_t , size_t , enum dma_transfer_direction , unsigned long); struct dma_async_tx_descriptor * (*device_prep_interleaved_dma)(struct dma_chan *, struct dma_interleaved_template *, unsigned long); struct dma_async_tx_descriptor * (*device_prep_dma_imm_data)(struct dma_chan *, dma_addr_t , u64 , unsigned long); int (*device_config)(struct dma_chan *, struct dma_slave_config *); int (*device_pause)(struct dma_chan *); int (*device_resume)(struct dma_chan *); int (*device_terminate_all)(struct dma_chan *); void (*device_synchronize)(struct dma_chan *); enum dma_status (*device_tx_status)(struct dma_chan *, dma_cookie_t , struct dma_tx_state *); void (*device_issue_pending)(struct dma_chan *); } ;
1437 struct uart_8250_dma { int (*tx_dma)(struct uart_8250_port *); int (*rx_dma)(struct uart_8250_port *); bool (*fn)(struct dma_chan *, void *); void *rx_param; void *tx_param; struct dma_slave_config rxconf; struct dma_slave_config txconf; struct dma_chan *rxchan; struct dma_chan *txchan; phys_addr_t rx_dma_addr; phys_addr_t tx_dma_addr; dma_addr_t rx_addr; dma_addr_t tx_addr; dma_cookie_t rx_cookie; dma_cookie_t tx_cookie; void *rx_buf; size_t rx_size; size_t tx_size; unsigned char tx_running; unsigned char tx_err; unsigned char rx_running; } ;
262 struct aspeed_vuart { struct device *dev; void *regs; struct clk *clk; int line; } ;
284 int kstrtoull(const char *, unsigned int, unsigned long long *);
303 int kstrtoul(const char *s, unsigned int base, unsigned long *res);
420 int snprintf(char *, size_t , const char *, ...);
3 bool ldv_is_err(const void *ptr);
4 bool ldv_is_err_or_null(const void *ptr);
5 void * ldv_err_ptr(long error);
6 long int ldv_ptr_err(const void *ptr);
32 long int PTR_ERR(const void *ptr);
41 bool IS_ERR(const void *ptr);
59 void * __memset(void *, int, size_t );
56 unsigned char readb(const volatile void *addr);
64 void writeb(unsigned char val, volatile void *addr);
263 int ldv_sysfs_create_group_5(struct kobject *ldv_func_arg1, const struct attribute_group *ldv_func_arg2);
273 void ldv_sysfs_remove_group_6(struct kobject *ldv_func_arg1, const struct attribute_group *ldv_func_arg2);
10 void ldv_error();
20 void ldv_stop();
25 int ldv_undef_int();
30 int ldv_undef_int_negative();
15 int LDV_SYSFS_GROUPS = 0;
19 int ldv_sysfs_create_group(struct kobject *kobj, const struct attribute_group *grp);
29 void ldv_sysfs_remove_group(struct kobject *kobj, const struct attribute_group *grp);
33 void ldv_check_final_state();
193 resource_size_t resource_size(const struct resource *res);
656 void * devm_kmalloc(struct device *, size_t , gfp_t );
662 void * devm_kzalloc(struct device *dev, size_t size, gfp_t gfp);
687 void * devm_ioremap_resource(struct device *, struct resource *);
1025 void * dev_get_drvdata(const struct device *dev);
1030 void dev_set_drvdata(struct device *dev, void *data);
1262 void dev_warn(const struct device *, const char *, ...);
301 struct property * of_find_property(const struct device_node *, const char *, int *);
318 int of_property_read_variable_u32_array(const struct device_node *, const char *, u32 *, size_t , size_t );
384 int of_alias_get_id(struct device_node *, const char *);
481 int of_property_read_u32_array(const struct device_node *np, const char *propname, u32 *out_values, size_t sz);
1042 bool of_property_read_bool(const struct device_node *np, const char *propname);
1064 int of_property_read_u32(const struct device_node *np, const char *propname, u32 *out_value);
362 void irq_dispose_mapping(unsigned int);
107 unsigned int irq_of_parse_and_map(struct device_node *, int);
52 struct resource * platform_get_resource(struct platform_device *, unsigned int, unsigned int);
211 void * platform_get_drvdata(const struct platform_device *pdev);
216 void platform_set_drvdata(struct platform_device *pdev, void *data);
202 int clk_prepare(struct clk *);
229 void clk_unprepare(struct clk *);
316 struct clk * devm_clk_get(struct device *, const char *);
345 int clk_enable(struct clk *);
373 void clk_disable(struct clk *);
398 unsigned long int clk_get_rate(struct clk *);
639 int clk_prepare_enable(struct clk *clk);
654 void clk_disable_unprepare(struct clk *clk);
140 void __compiletime_assert_140();
138 struct uart_8250_port * up_to_u8250p(struct uart_port *up___0);
143 int serial8250_register_8250_port(struct uart_8250_port *);
144 void serial8250_unregister_port(int);
157 int serial8250_do_startup(struct uart_port *);
158 void serial8250_do_shutdown(struct uart_port *);
54 ssize_t lpc_address_show(struct device *dev, struct device_attribute *attr, char *buf);
66 ssize_t lpc_address_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count);
84 struct device_attribute dev_attr_lpc_address = { { "lpc_address", 420U, (_Bool)0, 0, { { { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 } } } }, &lpc_address_show, &lpc_address_store };
86 ssize_t sirq_show(struct device *dev, struct device_attribute *attr, char *buf);
99 ssize_t sirq_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count);
122 struct device_attribute dev_attr_sirq = { { "sirq", 420U, (_Bool)0, 0, { { { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 } } } }, &sirq_show, &sirq_store };
124 struct attribute *aspeed_vuart_attrs[3U] = { &(dev_attr_sirq.attr), &(dev_attr_lpc_address.attr), (struct attribute *)0 };
130 const struct attribute_group aspeed_vuart_attr_group = { 0, 0, 0, (struct attribute **)(&aspeed_vuart_attrs), 0 };
134 void aspeed_vuart_set_enabled(struct aspeed_vuart *vuart, bool enabled);
146 void aspeed_vuart_set_host_tx_discard(struct aspeed_vuart *vuart, bool discard);
162 int aspeed_vuart_startup(struct uart_port *uart_port);
177 void aspeed_vuart_shutdown(struct uart_port *uart_port);
187 int aspeed_vuart_probe(struct platform_device *pdev);
293 int aspeed_vuart_remove(struct platform_device *pdev);
345 void ldv_check_return_value(int);
348 void ldv_check_return_value_probe(int);
351 void ldv_initialize();
354 void ldv_handler_precall();
357 int nondet_int();
360 int LDV_IN_INTERRUPT = 0;
363 void ldv_main0_sequence_infinite_withcheck_stateful();
return ;
}
-entry_point
{
365 struct platform_device *var_group1;
366 int res_aspeed_vuart_probe_8;
367 int ldv_s_aspeed_vuart_driver_platform_driver;
368 int tmp;
369 int tmp___0;
413 ldv_s_aspeed_vuart_driver_platform_driver = 0;
403 LDV_IN_INTERRUPT = 1;
412 ldv_initialize() { /* Function call is skipped due to function is undefined */}
416 goto ldv_36985;
416 tmp___0 = nondet_int() { /* Function call is skipped due to function is undefined */}
416 assume(tmp___0 != 0);
419 goto ldv_36984;
417 ldv_36984:;
420 tmp = nondet_int() { /* Function call is skipped due to function is undefined */}
420 switch (tmp);
421 assume(tmp == 0);
425 assume(ldv_s_aspeed_vuart_driver_platform_driver == 0);
439 -aspeed_vuart_probe(var_group1)
{
189 struct uart_8250_port port;
190 struct aspeed_vuart *vuart;
191 struct device_node *np;
192 struct resource *res;
193 unsigned int clk;
194 unsigned int prop;
195 int rc;
196 void *tmp;
197 long tmp___0;
198 _Bool tmp___1;
199 long tmp___2;
200 _Bool tmp___3;
201 unsigned long tmp___4;
202 int tmp___5;
203 int tmp___6;
204 int tmp___7;
205 int tmp___8;
206 int tmp___9;
207 _Bool tmp___10;
208 _Bool tmp___11;
196 np = pdev->dev.of_node;
198 -devm_kzalloc(&(pdev->dev), 32UL, 20971712U)
{
664 void *tmp;
664 tmp = devm_kmalloc(dev, size, gfp | 32768U) { /* Function call is skipped due to function is undefined */}
664 return tmp;;
}
198 vuart = (struct aspeed_vuart *)tmp;
199 assume(!(((unsigned long)vuart) == ((unsigned long)((struct aspeed_vuart *)0))));
202 vuart->dev = &(pdev->dev);
204 res = platform_get_resource(pdev, 512U, 0U) { /* Function call is skipped due to function is undefined */}
205 vuart->regs = devm_ioremap_resource(&(pdev->dev), res) { /* Function call is skipped due to function is undefined */}
206 const void *__CPAchecker_TMP_0 = (const void *)(vuart->regs);
206 -IS_ERR(__CPAchecker_TMP_0)
{
86 _Bool tmp;
87 -ldv_is_err(ptr)
{
10 return ((unsigned long)ptr) > 2012UL;;
}
87 return tmp;;
}
206 assume(((int)tmp___1) == 0);
209 __memset((void *)(&port), 0, 640UL) { /* Function call is skipped due to function is undefined */}
210 port.port.private_data = (void *)vuart;
211 unsigned char *__CPAchecker_TMP_2 = (unsigned char *)(vuart->regs);
211 port.port.membase = __CPAchecker_TMP_2;
212 port.port.mapbase = res->start;
213 -resource_size((const struct resource *)res)
{
195 unsigned long long __CPAchecker_TMP_0 = (unsigned long long)(res->end);
195 unsigned long long __CPAchecker_TMP_1 = (unsigned long long)(res->start);
195 return (__CPAchecker_TMP_0 - __CPAchecker_TMP_1) + 1ULL;;
}
214 port.port.startup = &aspeed_vuart_startup;
215 port.port.shutdown = &aspeed_vuart_shutdown;
216 port.port.dev = &(pdev->dev);
218 -ldv_sysfs_create_group_5(&(vuart->dev->kobj), &aspeed_vuart_attr_group)
{
98 int tmp;
99 -ldv_sysfs_create_group(ldv_func_arg1, ldv_func_arg2)
{
21 int tmp;
22 int tmp___0;
21 tmp = ldv_undef_int() { /* Function call is skipped due to function is undefined */}
21 assume(tmp != 0);
22 LDV_SYSFS_GROUPS = LDV_SYSFS_GROUPS + 1;
23 return 0;;
}
99 return tmp;;
}
219 assume(!(rc < 0));
222 -of_property_read_u32((const struct device_node *)np, "clock-frequency", &clk)
{
1067 int tmp;
1068 -of_property_read_u32_array(np, propname, out_value, 1UL)
{
484 int ret;
485 int tmp;
485 tmp = of_property_read_variable_u32_array(np, propname, out_values, sz, 0UL) { /* Function call is skipped due to function is undefined */}
485 ret = tmp;
487 assume(!(ret >= 0));
490 return ret;;
}
1068 return tmp;;
}
222 assume(tmp___5 != 0);
223 vuart->clk = devm_clk_get(&(pdev->dev), (const char *)0) { /* Function call is skipped due to function is undefined */}
224 const void *__CPAchecker_TMP_3 = (const void *)(vuart->clk);
224 -IS_ERR(__CPAchecker_TMP_3)
{
86 _Bool tmp;
87 -ldv_is_err(ptr)
{
10 return ((unsigned long)ptr) > 2012UL;;
}
87 return tmp;;
}
224 assume(!(((int)tmp___3) == 0));
225 dev_warn((const struct device *)(&(pdev->dev)), "clk or clock-frequency not defined\n") { /* Function call is skipped due to function is undefined */}
227 const void *__CPAchecker_TMP_4 = (const void *)(vuart->clk);
227 -PTR_ERR(__CPAchecker_TMP_4)
{
80 long tmp;
81 -ldv_ptr_err(ptr)
{
24 return (long)(2012UL - ((unsigned long)ptr));;
}
81 return tmp;;
}
227 return (int)tmp___2;;
}
440 ldv_check_return_value(res_aspeed_vuart_probe_8) { /* Function call is skipped due to function is undefined */}
441 ldv_check_return_value_probe(res_aspeed_vuart_probe_8) { /* Function call is skipped due to function is undefined */}
442 assume(res_aspeed_vuart_probe_8 != 0);
443 goto ldv_module_exit;
486 -ldv_check_final_state()
{
34 assume(LDV_SYSFS_GROUPS != 0);
34 -ldv_error()
{
15 LDV_ERROR:;
}
}
}
Source code
1 2 /* 3 * Serial Port driver for Aspeed VUART device 4 * 5 * Copyright (C) 2016 Jeremy Kerr <jk@ozlabs.org>, IBM Corp. 6 * Copyright (C) 2006 Arnd Bergmann <arnd@arndb.de>, IBM Corp. 7 * 8 * This program is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU General Public License 10 * as published by the Free Software Foundation; either version 11 * 2 of the License, or (at your option) any later version. 12 */ 13 #include <linux/device.h> 14 #include <linux/module.h> 15 #include <linux/of_address.h> 16 #include <linux/of_irq.h> 17 #include <linux/of_platform.h> 18 #include <linux/clk.h> 19 20 #include "8250.h" 21 22 #define ASPEED_VUART_GCRA 0x20 23 #define ASPEED_VUART_GCRA_VUART_EN BIT(0) 24 #define ASPEED_VUART_GCRA_DISABLE_HOST_TX_DISCARD BIT(5) 25 #define ASPEED_VUART_GCRB 0x24 26 #define ASPEED_VUART_GCRB_HOST_SIRQ_MASK GENMASK(7, 4) 27 #define ASPEED_VUART_GCRB_HOST_SIRQ_SHIFT 4 28 #define ASPEED_VUART_ADDRL 0x28 29 #define ASPEED_VUART_ADDRH 0x2c 30 31 struct aspeed_vuart { 32 struct device *dev; 33 void __iomem *regs; 34 struct clk *clk; 35 int line; 36 }; 37 38 /* 39 * The VUART is basically two UART 'front ends' connected by their FIFO 40 * (no actual serial line in between). One is on the BMC side (management 41 * controller) and one is on the host CPU side. 42 * 43 * It allows the BMC to provide to the host a "UART" that pipes into 44 * the BMC itself and can then be turned by the BMC into a network console 45 * of some sort for example. 46 * 47 * This driver is for the BMC side. The sysfs files allow the BMC 48 * userspace which owns the system configuration policy, to specify 49 * at what IO port and interrupt number the host side will appear 50 * to the host on the Host <-> BMC LPC bus. It could be different on a 51 * different system (though most of them use 3f8/4). 52 */ 53 54 static ssize_t lpc_address_show(struct device *dev, 55 struct device_attribute *attr, char *buf) 56 { 57 struct aspeed_vuart *vuart = dev_get_drvdata(dev); 58 u16 addr; 59 60 addr = (readb(vuart->regs + ASPEED_VUART_ADDRH) << 8) | 61 (readb(vuart->regs + ASPEED_VUART_ADDRL)); 62 63 return snprintf(buf, PAGE_SIZE - 1, "0x%x\n", addr); 64 } 65 66 static ssize_t lpc_address_store(struct device *dev, 67 struct device_attribute *attr, 68 const char *buf, size_t count) 69 { 70 struct aspeed_vuart *vuart = dev_get_drvdata(dev); 71 unsigned long val; 72 int err; 73 74 err = kstrtoul(buf, 0, &val); 75 if (err) 76 return err; 77 78 writeb(val >> 8, vuart->regs + ASPEED_VUART_ADDRH); 79 writeb(val >> 0, vuart->regs + ASPEED_VUART_ADDRL); 80 81 return count; 82 } 83 84 static DEVICE_ATTR_RW(lpc_address); 85 86 static ssize_t sirq_show(struct device *dev, 87 struct device_attribute *attr, char *buf) 88 { 89 struct aspeed_vuart *vuart = dev_get_drvdata(dev); 90 u8 reg; 91 92 reg = readb(vuart->regs + ASPEED_VUART_GCRB); 93 reg &= ASPEED_VUART_GCRB_HOST_SIRQ_MASK; 94 reg >>= ASPEED_VUART_GCRB_HOST_SIRQ_SHIFT; 95 96 return snprintf(buf, PAGE_SIZE - 1, "%u\n", reg); 97 } 98 99 static ssize_t sirq_store(struct device *dev, struct device_attribute *attr, 100 const char *buf, size_t count) 101 { 102 struct aspeed_vuart *vuart = dev_get_drvdata(dev); 103 unsigned long val; 104 int err; 105 u8 reg; 106 107 err = kstrtoul(buf, 0, &val); 108 if (err) 109 return err; 110 111 val <<= ASPEED_VUART_GCRB_HOST_SIRQ_SHIFT; 112 val &= ASPEED_VUART_GCRB_HOST_SIRQ_MASK; 113 114 reg = readb(vuart->regs + ASPEED_VUART_GCRB); 115 reg &= ~ASPEED_VUART_GCRB_HOST_SIRQ_MASK; 116 reg |= val; 117 writeb(reg, vuart->regs + ASPEED_VUART_GCRB); 118 119 return count; 120 } 121 122 static DEVICE_ATTR_RW(sirq); 123 124 static struct attribute *aspeed_vuart_attrs[] = { 125 &dev_attr_sirq.attr, 126 &dev_attr_lpc_address.attr, 127 NULL, 128 }; 129 130 static const struct attribute_group aspeed_vuart_attr_group = { 131 .attrs = aspeed_vuart_attrs, 132 }; 133 134 static void aspeed_vuart_set_enabled(struct aspeed_vuart *vuart, bool enabled) 135 { 136 u8 reg = readb(vuart->regs + ASPEED_VUART_GCRA); 137 138 if (enabled) 139 reg |= ASPEED_VUART_GCRA_VUART_EN; 140 else 141 reg &= ~ASPEED_VUART_GCRA_VUART_EN; 142 143 writeb(reg, vuart->regs + ASPEED_VUART_GCRA); 144 } 145 146 static void aspeed_vuart_set_host_tx_discard(struct aspeed_vuart *vuart, 147 bool discard) 148 { 149 u8 reg; 150 151 reg = readb(vuart->regs + ASPEED_VUART_GCRA); 152 153 /* If the DISABLE_HOST_TX_DISCARD bit is set, discard is disabled */ 154 if (!discard) 155 reg |= ASPEED_VUART_GCRA_DISABLE_HOST_TX_DISCARD; 156 else 157 reg &= ~ASPEED_VUART_GCRA_DISABLE_HOST_TX_DISCARD; 158 159 writeb(reg, vuart->regs + ASPEED_VUART_GCRA); 160 } 161 162 static int aspeed_vuart_startup(struct uart_port *uart_port) 163 { 164 struct uart_8250_port *uart_8250_port = up_to_u8250p(uart_port); 165 struct aspeed_vuart *vuart = uart_8250_port->port.private_data; 166 int rc; 167 168 rc = serial8250_do_startup(uart_port); 169 if (rc) 170 return rc; 171 172 aspeed_vuart_set_host_tx_discard(vuart, false); 173 174 return 0; 175 } 176 177 static void aspeed_vuart_shutdown(struct uart_port *uart_port) 178 { 179 struct uart_8250_port *uart_8250_port = up_to_u8250p(uart_port); 180 struct aspeed_vuart *vuart = uart_8250_port->port.private_data; 181 182 aspeed_vuart_set_host_tx_discard(vuart, true); 183 184 serial8250_do_shutdown(uart_port); 185 } 186 187 static int aspeed_vuart_probe(struct platform_device *pdev) 188 { 189 struct uart_8250_port port; 190 struct aspeed_vuart *vuart; 191 struct device_node *np; 192 struct resource *res; 193 u32 clk, prop; 194 int rc; 195 196 np = pdev->dev.of_node; 197 198 vuart = devm_kzalloc(&pdev->dev, sizeof(*vuart), GFP_KERNEL); 199 if (!vuart) 200 return -ENOMEM; 201 202 vuart->dev = &pdev->dev; 203 204 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 205 vuart->regs = devm_ioremap_resource(&pdev->dev, res); 206 if (IS_ERR(vuart->regs)) 207 return PTR_ERR(vuart->regs); 208 209 memset(&port, 0, sizeof(port)); 210 port.port.private_data = vuart; 211 port.port.membase = vuart->regs; 212 port.port.mapbase = res->start; 213 port.port.mapsize = resource_size(res); 214 port.port.startup = aspeed_vuart_startup; 215 port.port.shutdown = aspeed_vuart_shutdown; 216 port.port.dev = &pdev->dev; 217 218 rc = sysfs_create_group(&vuart->dev->kobj, &aspeed_vuart_attr_group); 219 if (rc < 0) 220 return rc; 221 222 if (of_property_read_u32(np, "clock-frequency", &clk)) { 223 vuart->clk = devm_clk_get(&pdev->dev, NULL); 224 if (IS_ERR(vuart->clk)) { 225 dev_warn(&pdev->dev, 226 "clk or clock-frequency not defined\n"); 227 return PTR_ERR(vuart->clk); 228 } 229 230 rc = clk_prepare_enable(vuart->clk); 231 if (rc < 0) 232 return rc; 233 234 clk = clk_get_rate(vuart->clk); 235 } 236 237 /* If current-speed was set, then try not to change it. */ 238 if (of_property_read_u32(np, "current-speed", &prop) == 0) 239 port.port.custom_divisor = clk / (16 * prop); 240 241 /* Check for shifted address mapping */ 242 if (of_property_read_u32(np, "reg-offset", &prop) == 0) 243 port.port.mapbase += prop; 244 245 /* Check for registers offset within the devices address range */ 246 if (of_property_read_u32(np, "reg-shift", &prop) == 0) 247 port.port.regshift = prop; 248 249 /* Check for fifo size */ 250 if (of_property_read_u32(np, "fifo-size", &prop) == 0) 251 port.port.fifosize = prop; 252 253 /* Check for a fixed line number */ 254 rc = of_alias_get_id(np, "serial"); 255 if (rc >= 0) 256 port.port.line = rc; 257 258 port.port.irq = irq_of_parse_and_map(np, 0); 259 port.port.irqflags = IRQF_SHARED; 260 port.port.iotype = UPIO_MEM; 261 port.port.type = PORT_16550A; 262 port.port.uartclk = clk; 263 port.port.flags = UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF 264 | UPF_FIXED_PORT | UPF_FIXED_TYPE | UPF_NO_THRE_TEST; 265 266 if (of_property_read_bool(np, "no-loopback-test")) 267 port.port.flags |= UPF_SKIP_TEST; 268 269 if (port.port.fifosize) 270 port.capabilities = UART_CAP_FIFO; 271 272 if (of_property_read_bool(np, "auto-flow-control")) 273 port.capabilities |= UART_CAP_AFE; 274 275 rc = serial8250_register_8250_port(&port); 276 if (rc < 0) 277 goto err_clk_disable; 278 279 vuart->line = rc; 280 281 aspeed_vuart_set_enabled(vuart, true); 282 aspeed_vuart_set_host_tx_discard(vuart, true); 283 platform_set_drvdata(pdev, vuart); 284 285 return 0; 286 287 err_clk_disable: 288 clk_disable_unprepare(vuart->clk); 289 irq_dispose_mapping(port.port.irq); 290 return rc; 291 } 292 293 static int aspeed_vuart_remove(struct platform_device *pdev) 294 { 295 struct aspeed_vuart *vuart = platform_get_drvdata(pdev); 296 297 aspeed_vuart_set_enabled(vuart, false); 298 serial8250_unregister_port(vuart->line); 299 sysfs_remove_group(&vuart->dev->kobj, &aspeed_vuart_attr_group); 300 clk_disable_unprepare(vuart->clk); 301 302 return 0; 303 } 304 305 static const struct of_device_id aspeed_vuart_table[] = { 306 { .compatible = "aspeed,ast2400-vuart" }, 307 { .compatible = "aspeed,ast2500-vuart" }, 308 { }, 309 }; 310 311 static struct platform_driver aspeed_vuart_driver = { 312 .driver = { 313 .name = "aspeed-vuart", 314 .of_match_table = aspeed_vuart_table, 315 }, 316 .probe = aspeed_vuart_probe, 317 .remove = aspeed_vuart_remove, 318 }; 319 320 module_platform_driver(aspeed_vuart_driver); 321 322 MODULE_AUTHOR("Jeremy Kerr <jk@ozlabs.org>"); 323 MODULE_LICENSE("GPL"); 324 MODULE_DESCRIPTION("Driver for Aspeed VUART device"); 325 326 327 328 329 330 /* LDV_COMMENT_BEGIN_MAIN */ 331 #ifdef LDV_MAIN0_sequence_infinite_withcheck_stateful 332 333 /*###########################################################################*/ 334 335 /*############## Driver Environment Generator 0.2 output ####################*/ 336 337 /*###########################################################################*/ 338 339 340 341 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Test if all kernel resources are correctly released by driver before driver will be unloaded. */ 342 void ldv_check_final_state(void); 343 344 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Test correct return result. */ 345 void ldv_check_return_value(int res); 346 347 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Test correct return result of probe() function. */ 348 void ldv_check_return_value_probe(int res); 349 350 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Initializes the model. */ 351 void ldv_initialize(void); 352 353 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Reinitializes the model between distinct model function calls. */ 354 void ldv_handler_precall(void); 355 356 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Returns arbitrary interger value. */ 357 int nondet_int(void); 358 359 /* LDV_COMMENT_VAR_DECLARE_LDV Special variable for LDV verifier. */ 360 int LDV_IN_INTERRUPT; 361 362 /* LDV_COMMENT_FUNCTION_MAIN Main function for LDV verifier. */ 363 void ldv_main0_sequence_infinite_withcheck_stateful(void) { 364 365 366 367 /* LDV_COMMENT_BEGIN_VARIABLE_DECLARATION_PART */ 368 /*============================= VARIABLE DECLARATION PART =============================*/ 369 /** STRUCT: struct type: platform_driver, struct name: aspeed_vuart_driver **/ 370 /* content: static int aspeed_vuart_probe(struct platform_device *pdev)*/ 371 /* LDV_COMMENT_BEGIN_PREP */ 372 #define ASPEED_VUART_GCRA 0x20 373 #define ASPEED_VUART_GCRA_VUART_EN BIT(0) 374 #define ASPEED_VUART_GCRA_DISABLE_HOST_TX_DISCARD BIT(5) 375 #define ASPEED_VUART_GCRB 0x24 376 #define ASPEED_VUART_GCRB_HOST_SIRQ_MASK GENMASK(7, 4) 377 #define ASPEED_VUART_GCRB_HOST_SIRQ_SHIFT 4 378 #define ASPEED_VUART_ADDRL 0x28 379 #define ASPEED_VUART_ADDRH 0x2c 380 /* LDV_COMMENT_END_PREP */ 381 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "aspeed_vuart_probe" */ 382 struct platform_device * var_group1; 383 /* LDV_COMMENT_VAR_DECLARE Variable declaration for test return result from function call "aspeed_vuart_probe" */ 384 static int res_aspeed_vuart_probe_8; 385 /* content: static int aspeed_vuart_remove(struct platform_device *pdev)*/ 386 /* LDV_COMMENT_BEGIN_PREP */ 387 #define ASPEED_VUART_GCRA 0x20 388 #define ASPEED_VUART_GCRA_VUART_EN BIT(0) 389 #define ASPEED_VUART_GCRA_DISABLE_HOST_TX_DISCARD BIT(5) 390 #define ASPEED_VUART_GCRB 0x24 391 #define ASPEED_VUART_GCRB_HOST_SIRQ_MASK GENMASK(7, 4) 392 #define ASPEED_VUART_GCRB_HOST_SIRQ_SHIFT 4 393 #define ASPEED_VUART_ADDRL 0x28 394 #define ASPEED_VUART_ADDRH 0x2c 395 /* LDV_COMMENT_END_PREP */ 396 397 398 399 400 /* LDV_COMMENT_END_VARIABLE_DECLARATION_PART */ 401 /* LDV_COMMENT_BEGIN_VARIABLE_INITIALIZING_PART */ 402 /*============================= VARIABLE INITIALIZING PART =============================*/ 403 LDV_IN_INTERRUPT=1; 404 405 406 407 408 /* LDV_COMMENT_END_VARIABLE_INITIALIZING_PART */ 409 /* LDV_COMMENT_BEGIN_FUNCTION_CALL_SECTION */ 410 /*============================= FUNCTION CALL SECTION =============================*/ 411 /* LDV_COMMENT_FUNCTION_CALL Initialize LDV model. */ 412 ldv_initialize(); 413 int ldv_s_aspeed_vuart_driver_platform_driver = 0; 414 415 416 while( nondet_int() 417 || !(ldv_s_aspeed_vuart_driver_platform_driver == 0) 418 ) { 419 420 switch(nondet_int()) { 421 422 case 0: { 423 424 /** STRUCT: struct type: platform_driver, struct name: aspeed_vuart_driver **/ 425 if(ldv_s_aspeed_vuart_driver_platform_driver==0) { 426 427 /* content: static int aspeed_vuart_probe(struct platform_device *pdev)*/ 428 /* LDV_COMMENT_BEGIN_PREP */ 429 #define ASPEED_VUART_GCRA 0x20 430 #define ASPEED_VUART_GCRA_VUART_EN BIT(0) 431 #define ASPEED_VUART_GCRA_DISABLE_HOST_TX_DISCARD BIT(5) 432 #define ASPEED_VUART_GCRB 0x24 433 #define ASPEED_VUART_GCRB_HOST_SIRQ_MASK GENMASK(7, 4) 434 #define ASPEED_VUART_GCRB_HOST_SIRQ_SHIFT 4 435 #define ASPEED_VUART_ADDRL 0x28 436 #define ASPEED_VUART_ADDRH 0x2c 437 /* LDV_COMMENT_END_PREP */ 438 /* LDV_COMMENT_FUNCTION_CALL Function from field "probe" from driver structure with callbacks "aspeed_vuart_driver". Standart function test for correct return result. */ 439 res_aspeed_vuart_probe_8 = aspeed_vuart_probe( var_group1); 440 ldv_check_return_value(res_aspeed_vuart_probe_8); 441 ldv_check_return_value_probe(res_aspeed_vuart_probe_8); 442 if(res_aspeed_vuart_probe_8) 443 goto ldv_module_exit; 444 ldv_s_aspeed_vuart_driver_platform_driver++; 445 446 } 447 448 } 449 450 break; 451 case 1: { 452 453 /** STRUCT: struct type: platform_driver, struct name: aspeed_vuart_driver **/ 454 if(ldv_s_aspeed_vuart_driver_platform_driver==1) { 455 456 /* content: static int aspeed_vuart_remove(struct platform_device *pdev)*/ 457 /* LDV_COMMENT_BEGIN_PREP */ 458 #define ASPEED_VUART_GCRA 0x20 459 #define ASPEED_VUART_GCRA_VUART_EN BIT(0) 460 #define ASPEED_VUART_GCRA_DISABLE_HOST_TX_DISCARD BIT(5) 461 #define ASPEED_VUART_GCRB 0x24 462 #define ASPEED_VUART_GCRB_HOST_SIRQ_MASK GENMASK(7, 4) 463 #define ASPEED_VUART_GCRB_HOST_SIRQ_SHIFT 4 464 #define ASPEED_VUART_ADDRL 0x28 465 #define ASPEED_VUART_ADDRH 0x2c 466 /* LDV_COMMENT_END_PREP */ 467 /* LDV_COMMENT_FUNCTION_CALL Function from field "remove" from driver structure with callbacks "aspeed_vuart_driver" */ 468 ldv_handler_precall(); 469 aspeed_vuart_remove( var_group1); 470 ldv_s_aspeed_vuart_driver_platform_driver=0; 471 472 } 473 474 } 475 476 break; 477 default: break; 478 479 } 480 481 } 482 483 ldv_module_exit: 484 485 /* LDV_COMMENT_FUNCTION_CALL Checks that all resources and locks are correctly released before the driver will be unloaded. */ 486 ldv_final: ldv_check_final_state(); 487 488 /* LDV_COMMENT_END_FUNCTION_CALL_SECTION */ 489 return; 490 491 } 492 #endif 493 494 /* LDV_COMMENT_END_MAIN */
1 2 #include <linux/kernel.h> 3 bool ldv_is_err(const void *ptr); 4 bool ldv_is_err_or_null(const void *ptr); 5 void* ldv_err_ptr(long error); 6 long ldv_ptr_err(const void *ptr); 7 8 9 #include <linux/sysfs.h> 10 #include <verifier/rcv.h> 11 #include <verifier/multimap.h> 12 13 # 1 "/home/vitaly/ldv-inst/kernel-rules/kernel-model/ERR.inc" 1 14 #ifndef _LDV_ERR_ 15 #define _LDV_ERR_ 16 17 #include <linux/kernel.h> 18 19 /* LDV_COMMENT_MODEL_FUNCTION_DEFENITION(name='ldv_is_err') This function return result of checking if pointer is impossible. */ 20 bool ldv_is_err(const void *ptr) 21 { 22 /*LDV_COMMENT_RETURN Return value of function ldv_is_err_val().*/ 23 return ((unsigned long)ptr > LDV_PTR_MAX); 24 } 25 26 /* LDV_COMMENT_MODEL_FUNCTION_DEFENITION(name='ldv_err_ptr') This function return pointer. */ 27 void* ldv_err_ptr(long error) 28 { 29 /*LDV_COMMENT_RETURN Return error pointer.*/ 30 return (void *)(LDV_PTR_MAX - error); 31 } 32 33 /* LDV_COMMENT_MODEL_FUNCTION_DEFENITION(name='ldv_ptr_err') This function return error if pointer is impossible. */ 34 long ldv_ptr_err(const void *ptr) 35 { 36 /*LDV_COMMENT_RETURN Return error code.*/ 37 return (long)(LDV_PTR_MAX - (unsigned long)ptr); 38 } 39 40 /* LDV_COMMENT_MODEL_FUNCTION_DEFENITION(name='ldv_is_err_or_null') This function check if pointer is impossible or null. */ 41 bool ldv_is_err_or_null(const void *ptr) 42 { 43 /*LDV_COMMENT_RETURN Return 0 if pointer is possible and not zero, and 1 in other cases*/ 44 return !ptr || ldv_is_err((unsigned long)ptr); 45 } 46 47 #endif /* _LDV_ERR_ */ 48 # 11 "/home/vitaly/ldv-inst/kernel-rules/models/0151.aspect" 2 49 50 MultiMap LDV_SYSFS_GROUPS = ldv_multimap_init(LDV_SYSFS_GROUPS); 51 52 53 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_sysfs_create_group') Create some sysfs group for specified kernel object */ 54 int ldv_sysfs_create_group(struct kobject *kobj, const struct attribute_group *grp) { 55 ldv_assert(ldv_multimap_not_contains_key_value(LDV_SYSFS_GROUPS, kobj, grp)); 56 if (ldv_undef_int()) { 57 ldv_multimap_put(LDV_SYSFS_GROUPS, kobj, grp); 58 return 0; 59 } 60 return ldv_undef_int_negative(); 61 } 62 63 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_sysfs_remove_group') Remove some sysfs group from specified kernel object */ 64 void ldv_sysfs_remove_group(struct kobject *kobj, const struct attribute_group *grp) { 65 ldv_multimap_remove_value(LDV_SYSFS_GROUPS, kobj, grp); 66 } 67 68 void ldv_check_final_state(void) { 69 ldv_assert(ldv_multimap_is_empty(LDV_SYSFS_GROUPS)); 70 } 71 #line 1 "/home/vitaly/ldv-launches/work/current--X--.--X--defaultlinux-4.13-rc1--X--151_1a--X--cpachecker/linux-4.13-rc1/csd_deg_dscv/17588/dscv_tempdir/dscv/ri/151_1a/drivers/tty/serial/8250/8250_aspeed_vuart.c" 72 73 /* 74 * Serial Port driver for Aspeed VUART device 75 * 76 * Copyright (C) 2016 Jeremy Kerr <jk@ozlabs.org>, IBM Corp. 77 * Copyright (C) 2006 Arnd Bergmann <arnd@arndb.de>, IBM Corp. 78 * 79 * This program is free software; you can redistribute it and/or 80 * modify it under the terms of the GNU General Public License 81 * as published by the Free Software Foundation; either version 82 * 2 of the License, or (at your option) any later version. 83 */ 84 #include <linux/device.h> 85 #include <linux/module.h> 86 #include <linux/of_address.h> 87 #include <linux/of_irq.h> 88 #include <linux/of_platform.h> 89 #include <linux/clk.h> 90 91 #include "8250.h" 92 93 #define ASPEED_VUART_GCRA 0x20 94 #define ASPEED_VUART_GCRA_VUART_EN BIT(0) 95 #define ASPEED_VUART_GCRA_DISABLE_HOST_TX_DISCARD BIT(5) 96 #define ASPEED_VUART_GCRB 0x24 97 #define ASPEED_VUART_GCRB_HOST_SIRQ_MASK GENMASK(7, 4) 98 #define ASPEED_VUART_GCRB_HOST_SIRQ_SHIFT 4 99 #define ASPEED_VUART_ADDRL 0x28 100 #define ASPEED_VUART_ADDRH 0x2c 101 102 struct aspeed_vuart { 103 struct device *dev; 104 void __iomem *regs; 105 struct clk *clk; 106 int line; 107 }; 108 109 /* 110 * The VUART is basically two UART 'front ends' connected by their FIFO 111 * (no actual serial line in between). One is on the BMC side (management 112 * controller) and one is on the host CPU side. 113 * 114 * It allows the BMC to provide to the host a "UART" that pipes into 115 * the BMC itself and can then be turned by the BMC into a network console 116 * of some sort for example. 117 * 118 * This driver is for the BMC side. The sysfs files allow the BMC 119 * userspace which owns the system configuration policy, to specify 120 * at what IO port and interrupt number the host side will appear 121 * to the host on the Host <-> BMC LPC bus. It could be different on a 122 * different system (though most of them use 3f8/4). 123 */ 124 125 static ssize_t lpc_address_show(struct device *dev, 126 struct device_attribute *attr, char *buf) 127 { 128 struct aspeed_vuart *vuart = dev_get_drvdata(dev); 129 u16 addr; 130 131 addr = (readb(vuart->regs + ASPEED_VUART_ADDRH) << 8) | 132 (readb(vuart->regs + ASPEED_VUART_ADDRL)); 133 134 return snprintf(buf, PAGE_SIZE - 1, "0x%x\n", addr); 135 } 136 137 static ssize_t lpc_address_store(struct device *dev, 138 struct device_attribute *attr, 139 const char *buf, size_t count) 140 { 141 struct aspeed_vuart *vuart = dev_get_drvdata(dev); 142 unsigned long val; 143 int err; 144 145 err = kstrtoul(buf, 0, &val); 146 if (err) 147 return err; 148 149 writeb(val >> 8, vuart->regs + ASPEED_VUART_ADDRH); 150 writeb(val >> 0, vuart->regs + ASPEED_VUART_ADDRL); 151 152 return count; 153 } 154 155 static DEVICE_ATTR_RW(lpc_address); 156 157 static ssize_t sirq_show(struct device *dev, 158 struct device_attribute *attr, char *buf) 159 { 160 struct aspeed_vuart *vuart = dev_get_drvdata(dev); 161 u8 reg; 162 163 reg = readb(vuart->regs + ASPEED_VUART_GCRB); 164 reg &= ASPEED_VUART_GCRB_HOST_SIRQ_MASK; 165 reg >>= ASPEED_VUART_GCRB_HOST_SIRQ_SHIFT; 166 167 return snprintf(buf, PAGE_SIZE - 1, "%u\n", reg); 168 } 169 170 static ssize_t sirq_store(struct device *dev, struct device_attribute *attr, 171 const char *buf, size_t count) 172 { 173 struct aspeed_vuart *vuart = dev_get_drvdata(dev); 174 unsigned long val; 175 int err; 176 u8 reg; 177 178 err = kstrtoul(buf, 0, &val); 179 if (err) 180 return err; 181 182 val <<= ASPEED_VUART_GCRB_HOST_SIRQ_SHIFT; 183 val &= ASPEED_VUART_GCRB_HOST_SIRQ_MASK; 184 185 reg = readb(vuart->regs + ASPEED_VUART_GCRB); 186 reg &= ~ASPEED_VUART_GCRB_HOST_SIRQ_MASK; 187 reg |= val; 188 writeb(reg, vuart->regs + ASPEED_VUART_GCRB); 189 190 return count; 191 } 192 193 static DEVICE_ATTR_RW(sirq); 194 195 static struct attribute *aspeed_vuart_attrs[] = { 196 &dev_attr_sirq.attr, 197 &dev_attr_lpc_address.attr, 198 NULL, 199 }; 200 201 static const struct attribute_group aspeed_vuart_attr_group = { 202 .attrs = aspeed_vuart_attrs, 203 }; 204 205 static void aspeed_vuart_set_enabled(struct aspeed_vuart *vuart, bool enabled) 206 { 207 u8 reg = readb(vuart->regs + ASPEED_VUART_GCRA); 208 209 if (enabled) 210 reg |= ASPEED_VUART_GCRA_VUART_EN; 211 else 212 reg &= ~ASPEED_VUART_GCRA_VUART_EN; 213 214 writeb(reg, vuart->regs + ASPEED_VUART_GCRA); 215 } 216 217 static void aspeed_vuart_set_host_tx_discard(struct aspeed_vuart *vuart, 218 bool discard) 219 { 220 u8 reg; 221 222 reg = readb(vuart->regs + ASPEED_VUART_GCRA); 223 224 /* If the DISABLE_HOST_TX_DISCARD bit is set, discard is disabled */ 225 if (!discard) 226 reg |= ASPEED_VUART_GCRA_DISABLE_HOST_TX_DISCARD; 227 else 228 reg &= ~ASPEED_VUART_GCRA_DISABLE_HOST_TX_DISCARD; 229 230 writeb(reg, vuart->regs + ASPEED_VUART_GCRA); 231 } 232 233 static int aspeed_vuart_startup(struct uart_port *uart_port) 234 { 235 struct uart_8250_port *uart_8250_port = up_to_u8250p(uart_port); 236 struct aspeed_vuart *vuart = uart_8250_port->port.private_data; 237 int rc; 238 239 rc = serial8250_do_startup(uart_port); 240 if (rc) 241 return rc; 242 243 aspeed_vuart_set_host_tx_discard(vuart, false); 244 245 return 0; 246 } 247 248 static void aspeed_vuart_shutdown(struct uart_port *uart_port) 249 { 250 struct uart_8250_port *uart_8250_port = up_to_u8250p(uart_port); 251 struct aspeed_vuart *vuart = uart_8250_port->port.private_data; 252 253 aspeed_vuart_set_host_tx_discard(vuart, true); 254 255 serial8250_do_shutdown(uart_port); 256 } 257 258 static int aspeed_vuart_probe(struct platform_device *pdev) 259 { 260 struct uart_8250_port port; 261 struct aspeed_vuart *vuart; 262 struct device_node *np; 263 struct resource *res; 264 u32 clk, prop; 265 int rc; 266 267 np = pdev->dev.of_node; 268 269 vuart = devm_kzalloc(&pdev->dev, sizeof(*vuart), GFP_KERNEL); 270 if (!vuart) 271 return -ENOMEM; 272 273 vuart->dev = &pdev->dev; 274 275 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 276 vuart->regs = devm_ioremap_resource(&pdev->dev, res); 277 if (IS_ERR(vuart->regs)) 278 return PTR_ERR(vuart->regs); 279 280 memset(&port, 0, sizeof(port)); 281 port.port.private_data = vuart; 282 port.port.membase = vuart->regs; 283 port.port.mapbase = res->start; 284 port.port.mapsize = resource_size(res); 285 port.port.startup = aspeed_vuart_startup; 286 port.port.shutdown = aspeed_vuart_shutdown; 287 port.port.dev = &pdev->dev; 288 289 rc = sysfs_create_group(&vuart->dev->kobj, &aspeed_vuart_attr_group); 290 if (rc < 0) 291 return rc; 292 293 if (of_property_read_u32(np, "clock-frequency", &clk)) { 294 vuart->clk = devm_clk_get(&pdev->dev, NULL); 295 if (IS_ERR(vuart->clk)) { 296 dev_warn(&pdev->dev, 297 "clk or clock-frequency not defined\n"); 298 return PTR_ERR(vuart->clk); 299 } 300 301 rc = clk_prepare_enable(vuart->clk); 302 if (rc < 0) 303 return rc; 304 305 clk = clk_get_rate(vuart->clk); 306 } 307 308 /* If current-speed was set, then try not to change it. */ 309 if (of_property_read_u32(np, "current-speed", &prop) == 0) 310 port.port.custom_divisor = clk / (16 * prop); 311 312 /* Check for shifted address mapping */ 313 if (of_property_read_u32(np, "reg-offset", &prop) == 0) 314 port.port.mapbase += prop; 315 316 /* Check for registers offset within the devices address range */ 317 if (of_property_read_u32(np, "reg-shift", &prop) == 0) 318 port.port.regshift = prop; 319 320 /* Check for fifo size */ 321 if (of_property_read_u32(np, "fifo-size", &prop) == 0) 322 port.port.fifosize = prop; 323 324 /* Check for a fixed line number */ 325 rc = of_alias_get_id(np, "serial"); 326 if (rc >= 0) 327 port.port.line = rc; 328 329 port.port.irq = irq_of_parse_and_map(np, 0); 330 port.port.irqflags = IRQF_SHARED; 331 port.port.iotype = UPIO_MEM; 332 port.port.type = PORT_16550A; 333 port.port.uartclk = clk; 334 port.port.flags = UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF 335 | UPF_FIXED_PORT | UPF_FIXED_TYPE | UPF_NO_THRE_TEST; 336 337 if (of_property_read_bool(np, "no-loopback-test")) 338 port.port.flags |= UPF_SKIP_TEST; 339 340 if (port.port.fifosize) 341 port.capabilities = UART_CAP_FIFO; 342 343 if (of_property_read_bool(np, "auto-flow-control")) 344 port.capabilities |= UART_CAP_AFE; 345 346 rc = serial8250_register_8250_port(&port); 347 if (rc < 0) 348 goto err_clk_disable; 349 350 vuart->line = rc; 351 352 aspeed_vuart_set_enabled(vuart, true); 353 aspeed_vuart_set_host_tx_discard(vuart, true); 354 platform_set_drvdata(pdev, vuart); 355 356 return 0; 357 358 err_clk_disable: 359 clk_disable_unprepare(vuart->clk); 360 irq_dispose_mapping(port.port.irq); 361 return rc; 362 } 363 364 static int aspeed_vuart_remove(struct platform_device *pdev) 365 { 366 struct aspeed_vuart *vuart = platform_get_drvdata(pdev); 367 368 aspeed_vuart_set_enabled(vuart, false); 369 serial8250_unregister_port(vuart->line); 370 sysfs_remove_group(&vuart->dev->kobj, &aspeed_vuart_attr_group); 371 clk_disable_unprepare(vuart->clk); 372 373 return 0; 374 } 375 376 static const struct of_device_id aspeed_vuart_table[] = { 377 { .compatible = "aspeed,ast2400-vuart" }, 378 { .compatible = "aspeed,ast2500-vuart" }, 379 { }, 380 }; 381 382 static struct platform_driver aspeed_vuart_driver = { 383 .driver = { 384 .name = "aspeed-vuart", 385 .of_match_table = aspeed_vuart_table, 386 }, 387 .probe = aspeed_vuart_probe, 388 .remove = aspeed_vuart_remove, 389 }; 390 391 module_platform_driver(aspeed_vuart_driver); 392 393 MODULE_AUTHOR("Jeremy Kerr <jk@ozlabs.org>"); 394 MODULE_LICENSE("GPL"); 395 MODULE_DESCRIPTION("Driver for Aspeed VUART device"); 396 397 398 399 400 401 /* LDV_COMMENT_BEGIN_MAIN */ 402 #ifdef LDV_MAIN0_sequence_infinite_withcheck_stateful 403 404 /*###########################################################################*/ 405 406 /*############## Driver Environment Generator 0.2 output ####################*/ 407 408 /*###########################################################################*/ 409 410 411 412 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Test if all kernel resources are correctly released by driver before driver will be unloaded. */ 413 void ldv_check_final_state(void); 414 415 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Test correct return result. */ 416 void ldv_check_return_value(int res); 417 418 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Test correct return result of probe() function. */ 419 void ldv_check_return_value_probe(int res); 420 421 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Initializes the model. */ 422 void ldv_initialize(void); 423 424 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Reinitializes the model between distinct model function calls. */ 425 void ldv_handler_precall(void); 426 427 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Returns arbitrary interger value. */ 428 int nondet_int(void); 429 430 /* LDV_COMMENT_VAR_DECLARE_LDV Special variable for LDV verifier. */ 431 int LDV_IN_INTERRUPT; 432 433 /* LDV_COMMENT_FUNCTION_MAIN Main function for LDV verifier. */ 434 void ldv_main0_sequence_infinite_withcheck_stateful(void) { 435 436 437 438 /* LDV_COMMENT_BEGIN_VARIABLE_DECLARATION_PART */ 439 /*============================= VARIABLE DECLARATION PART =============================*/ 440 /** STRUCT: struct type: platform_driver, struct name: aspeed_vuart_driver **/ 441 /* content: static int aspeed_vuart_probe(struct platform_device *pdev)*/ 442 /* LDV_COMMENT_BEGIN_PREP */ 443 #define ASPEED_VUART_GCRA 0x20 444 #define ASPEED_VUART_GCRA_VUART_EN BIT(0) 445 #define ASPEED_VUART_GCRA_DISABLE_HOST_TX_DISCARD BIT(5) 446 #define ASPEED_VUART_GCRB 0x24 447 #define ASPEED_VUART_GCRB_HOST_SIRQ_MASK GENMASK(7, 4) 448 #define ASPEED_VUART_GCRB_HOST_SIRQ_SHIFT 4 449 #define ASPEED_VUART_ADDRL 0x28 450 #define ASPEED_VUART_ADDRH 0x2c 451 /* LDV_COMMENT_END_PREP */ 452 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "aspeed_vuart_probe" */ 453 struct platform_device * var_group1; 454 /* LDV_COMMENT_VAR_DECLARE Variable declaration for test return result from function call "aspeed_vuart_probe" */ 455 static int res_aspeed_vuart_probe_8; 456 /* content: static int aspeed_vuart_remove(struct platform_device *pdev)*/ 457 /* LDV_COMMENT_BEGIN_PREP */ 458 #define ASPEED_VUART_GCRA 0x20 459 #define ASPEED_VUART_GCRA_VUART_EN BIT(0) 460 #define ASPEED_VUART_GCRA_DISABLE_HOST_TX_DISCARD BIT(5) 461 #define ASPEED_VUART_GCRB 0x24 462 #define ASPEED_VUART_GCRB_HOST_SIRQ_MASK GENMASK(7, 4) 463 #define ASPEED_VUART_GCRB_HOST_SIRQ_SHIFT 4 464 #define ASPEED_VUART_ADDRL 0x28 465 #define ASPEED_VUART_ADDRH 0x2c 466 /* LDV_COMMENT_END_PREP */ 467 468 469 470 471 /* LDV_COMMENT_END_VARIABLE_DECLARATION_PART */ 472 /* LDV_COMMENT_BEGIN_VARIABLE_INITIALIZING_PART */ 473 /*============================= VARIABLE INITIALIZING PART =============================*/ 474 LDV_IN_INTERRUPT=1; 475 476 477 478 479 /* LDV_COMMENT_END_VARIABLE_INITIALIZING_PART */ 480 /* LDV_COMMENT_BEGIN_FUNCTION_CALL_SECTION */ 481 /*============================= FUNCTION CALL SECTION =============================*/ 482 /* LDV_COMMENT_FUNCTION_CALL Initialize LDV model. */ 483 ldv_initialize(); 484 int ldv_s_aspeed_vuart_driver_platform_driver = 0; 485 486 487 while( nondet_int() 488 || !(ldv_s_aspeed_vuart_driver_platform_driver == 0) 489 ) { 490 491 switch(nondet_int()) { 492 493 case 0: { 494 495 /** STRUCT: struct type: platform_driver, struct name: aspeed_vuart_driver **/ 496 if(ldv_s_aspeed_vuart_driver_platform_driver==0) { 497 498 /* content: static int aspeed_vuart_probe(struct platform_device *pdev)*/ 499 /* LDV_COMMENT_BEGIN_PREP */ 500 #define ASPEED_VUART_GCRA 0x20 501 #define ASPEED_VUART_GCRA_VUART_EN BIT(0) 502 #define ASPEED_VUART_GCRA_DISABLE_HOST_TX_DISCARD BIT(5) 503 #define ASPEED_VUART_GCRB 0x24 504 #define ASPEED_VUART_GCRB_HOST_SIRQ_MASK GENMASK(7, 4) 505 #define ASPEED_VUART_GCRB_HOST_SIRQ_SHIFT 4 506 #define ASPEED_VUART_ADDRL 0x28 507 #define ASPEED_VUART_ADDRH 0x2c 508 /* LDV_COMMENT_END_PREP */ 509 /* LDV_COMMENT_FUNCTION_CALL Function from field "probe" from driver structure with callbacks "aspeed_vuart_driver". Standart function test for correct return result. */ 510 res_aspeed_vuart_probe_8 = aspeed_vuart_probe( var_group1); 511 ldv_check_return_value(res_aspeed_vuart_probe_8); 512 ldv_check_return_value_probe(res_aspeed_vuart_probe_8); 513 if(res_aspeed_vuart_probe_8) 514 goto ldv_module_exit; 515 ldv_s_aspeed_vuart_driver_platform_driver++; 516 517 } 518 519 } 520 521 break; 522 case 1: { 523 524 /** STRUCT: struct type: platform_driver, struct name: aspeed_vuart_driver **/ 525 if(ldv_s_aspeed_vuart_driver_platform_driver==1) { 526 527 /* content: static int aspeed_vuart_remove(struct platform_device *pdev)*/ 528 /* LDV_COMMENT_BEGIN_PREP */ 529 #define ASPEED_VUART_GCRA 0x20 530 #define ASPEED_VUART_GCRA_VUART_EN BIT(0) 531 #define ASPEED_VUART_GCRA_DISABLE_HOST_TX_DISCARD BIT(5) 532 #define ASPEED_VUART_GCRB 0x24 533 #define ASPEED_VUART_GCRB_HOST_SIRQ_MASK GENMASK(7, 4) 534 #define ASPEED_VUART_GCRB_HOST_SIRQ_SHIFT 4 535 #define ASPEED_VUART_ADDRL 0x28 536 #define ASPEED_VUART_ADDRH 0x2c 537 /* LDV_COMMENT_END_PREP */ 538 /* LDV_COMMENT_FUNCTION_CALL Function from field "remove" from driver structure with callbacks "aspeed_vuart_driver" */ 539 ldv_handler_precall(); 540 aspeed_vuart_remove( var_group1); 541 ldv_s_aspeed_vuart_driver_platform_driver=0; 542 543 } 544 545 } 546 547 break; 548 default: break; 549 550 } 551 552 } 553 554 ldv_module_exit: 555 556 /* LDV_COMMENT_FUNCTION_CALL Checks that all resources and locks are correctly released before the driver will be unloaded. */ 557 ldv_final: ldv_check_final_state(); 558 559 /* LDV_COMMENT_END_FUNCTION_CALL_SECTION */ 560 return; 561 562 } 563 #endif 564 565 /* LDV_COMMENT_END_MAIN */ 566 567 #line 71 "/home/vitaly/ldv-launches/work/current--X--.--X--defaultlinux-4.13-rc1--X--151_1a--X--cpachecker/linux-4.13-rc1/csd_deg_dscv/17588/dscv_tempdir/dscv/ri/151_1a/drivers/tty/serial/8250/8250_aspeed_vuart.o.c.prepared"
1 #ifndef _LDV_ERR_ 2 #define _LDV_ERR_ 3 4 #include <linux/kernel.h> 5 6 /* LDV_COMMENT_MODEL_FUNCTION_DEFENITION(name='ldv_is_err') This function return result of checking if pointer is impossible. */ 7 bool ldv_is_err(const void *ptr) 8 { 9 /*LDV_COMMENT_RETURN Return value of function ldv_is_err_val().*/ 10 return ((unsigned long)ptr > LDV_PTR_MAX); 11 } 12 13 /* LDV_COMMENT_MODEL_FUNCTION_DEFENITION(name='ldv_err_ptr') This function return pointer. */ 14 void* ldv_err_ptr(long error) 15 { 16 /*LDV_COMMENT_RETURN Return error pointer.*/ 17 return (void *)(LDV_PTR_MAX - error); 18 } 19 20 /* LDV_COMMENT_MODEL_FUNCTION_DEFENITION(name='ldv_ptr_err') This function return error if pointer is impossible. */ 21 long ldv_ptr_err(const void *ptr) 22 { 23 /*LDV_COMMENT_RETURN Return error code.*/ 24 return (long)(LDV_PTR_MAX - (unsigned long)ptr); 25 } 26 27 /* LDV_COMMENT_MODEL_FUNCTION_DEFENITION(name='ldv_is_err_or_null') This function check if pointer is impossible or null. */ 28 bool ldv_is_err_or_null(const void *ptr) 29 { 30 /*LDV_COMMENT_RETURN Return 0 if pointer is possible and not zero, and 1 in other cases*/ 31 return !ptr || ldv_is_err((unsigned long)ptr); 32 } 33 34 #endif /* _LDV_ERR_ */
1 #ifndef _LDV_RCV_H_ 2 #define _LDV_RCV_H_ 3 4 /* If expr evaluates to zero, ldv_assert() causes a program to reach the error 5 label like the standard assert(). */ 6 #define ldv_assert(expr) ((expr) ? 0 : ldv_error()) 7 8 /* The error label wrapper. It is used because of some static verifiers (like 9 BLAST) don't accept multiple error labels through a program. */ 10 static inline void ldv_error(void) 11 { 12 LDV_ERROR: goto LDV_ERROR; 13 } 14 15 /* If expr evaluates to zero, ldv_assume() causes an infinite loop that is 16 avoided by verifiers. */ 17 #define ldv_assume(expr) ((expr) ? 0 : ldv_stop()) 18 19 /* Infinite loop, that causes verifiers to skip such paths. */ 20 static inline void ldv_stop(void) { 21 LDV_STOP: goto LDV_STOP; 22 } 23 24 /* Special nondeterministic functions. */ 25 int ldv_undef_int(void); 26 void *ldv_undef_ptr(void); 27 unsigned long ldv_undef_ulong(void); 28 long ldv_undef_long(void); 29 /* Return nondeterministic negative integer number. */ 30 static inline int ldv_undef_int_negative(void) 31 { 32 int ret = ldv_undef_int(); 33 34 ldv_assume(ret < 0); 35 36 return ret; 37 } 38 /* Return nondeterministic nonpositive integer number. */ 39 static inline int ldv_undef_int_nonpositive(void) 40 { 41 int ret = ldv_undef_int(); 42 43 ldv_assume(ret <= 0); 44 45 return ret; 46 } 47 48 /* Add explicit model for __builin_expect GCC function. Without the model a 49 return value will be treated as nondetermined by verifiers. */ 50 static inline long __builtin_expect(long exp, long c) 51 { 52 return exp; 53 } 54 55 /* This function causes the program to exit abnormally. GCC implements this 56 function by using a target-dependent mechanism (such as intentionally executing 57 an illegal instruction) or by calling abort. The mechanism used may vary from 58 release to release so you should not rely on any particular implementation. 59 http://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html */ 60 static inline void __builtin_trap(void) 61 { 62 ldv_assert(0); 63 } 64 65 /* The constant is for simulating an error of ldv_undef_ptr() function. */ 66 #define LDV_PTR_MAX 2012 67 68 #endif /* _LDV_RCV_H_ */
1 /* 2 * device.h - generic, centralized driver model 3 * 4 * Copyright (c) 2001-2003 Patrick Mochel <mochel@osdl.org> 5 * Copyright (c) 2004-2009 Greg Kroah-Hartman <gregkh@suse.de> 6 * Copyright (c) 2008-2009 Novell Inc. 7 * 8 * This file is released under the GPLv2 9 * 10 * See Documentation/driver-model/ for more information. 11 */ 12 13 #ifndef _DEVICE_H_ 14 #define _DEVICE_H_ 15 16 #include <linux/ioport.h> 17 #include <linux/kobject.h> 18 #include <linux/klist.h> 19 #include <linux/list.h> 20 #include <linux/lockdep.h> 21 #include <linux/compiler.h> 22 #include <linux/types.h> 23 #include <linux/mutex.h> 24 #include <linux/pinctrl/devinfo.h> 25 #include <linux/pm.h> 26 #include <linux/atomic.h> 27 #include <linux/ratelimit.h> 28 #include <linux/uidgid.h> 29 #include <linux/gfp.h> 30 #include <asm/device.h> 31 32 struct device; 33 struct device_private; 34 struct device_driver; 35 struct driver_private; 36 struct module; 37 struct class; 38 struct subsys_private; 39 struct bus_type; 40 struct device_node; 41 struct fwnode_handle; 42 struct iommu_ops; 43 struct iommu_group; 44 struct iommu_fwspec; 45 46 struct bus_attribute { 47 struct attribute attr; 48 ssize_t (*show)(struct bus_type *bus, char *buf); 49 ssize_t (*store)(struct bus_type *bus, const char *buf, size_t count); 50 }; 51 52 #define BUS_ATTR(_name, _mode, _show, _store) \ 53 struct bus_attribute bus_attr_##_name = __ATTR(_name, _mode, _show, _store) 54 #define BUS_ATTR_RW(_name) \ 55 struct bus_attribute bus_attr_##_name = __ATTR_RW(_name) 56 #define BUS_ATTR_RO(_name) \ 57 struct bus_attribute bus_attr_##_name = __ATTR_RO(_name) 58 59 extern int __must_check bus_create_file(struct bus_type *, 60 struct bus_attribute *); 61 extern void bus_remove_file(struct bus_type *, struct bus_attribute *); 62 63 /** 64 * struct bus_type - The bus type of the device 65 * 66 * @name: The name of the bus. 67 * @dev_name: Used for subsystems to enumerate devices like ("foo%u", dev->id). 68 * @dev_root: Default device to use as the parent. 69 * @bus_groups: Default attributes of the bus. 70 * @dev_groups: Default attributes of the devices on the bus. 71 * @drv_groups: Default attributes of the device drivers on the bus. 72 * @match: Called, perhaps multiple times, whenever a new device or driver 73 * is added for this bus. It should return a positive value if the 74 * given device can be handled by the given driver and zero 75 * otherwise. It may also return error code if determining that 76 * the driver supports the device is not possible. In case of 77 * -EPROBE_DEFER it will queue the device for deferred probing. 78 * @uevent: Called when a device is added, removed, or a few other things 79 * that generate uevents to add the environment variables. 80 * @probe: Called when a new device or driver add to this bus, and callback 81 * the specific driver's probe to initial the matched device. 82 * @remove: Called when a device removed from this bus. 83 * @shutdown: Called at shut-down time to quiesce the device. 84 * 85 * @online: Called to put the device back online (after offlining it). 86 * @offline: Called to put the device offline for hot-removal. May fail. 87 * 88 * @suspend: Called when a device on this bus wants to go to sleep mode. 89 * @resume: Called to bring a device on this bus out of sleep mode. 90 * @num_vf: Called to find out how many virtual functions a device on this 91 * bus supports. 92 * @pm: Power management operations of this bus, callback the specific 93 * device driver's pm-ops. 94 * @iommu_ops: IOMMU specific operations for this bus, used to attach IOMMU 95 * driver implementations to a bus and allow the driver to do 96 * bus-specific setup 97 * @p: The private data of the driver core, only the driver core can 98 * touch this. 99 * @lock_key: Lock class key for use by the lock validator 100 * 101 * A bus is a channel between the processor and one or more devices. For the 102 * purposes of the device model, all devices are connected via a bus, even if 103 * it is an internal, virtual, "platform" bus. Buses can plug into each other. 104 * A USB controller is usually a PCI device, for example. The device model 105 * represents the actual connections between buses and the devices they control. 106 * A bus is represented by the bus_type structure. It contains the name, the 107 * default attributes, the bus' methods, PM operations, and the driver core's 108 * private data. 109 */ 110 struct bus_type { 111 const char *name; 112 const char *dev_name; 113 struct device *dev_root; 114 const struct attribute_group **bus_groups; 115 const struct attribute_group **dev_groups; 116 const struct attribute_group **drv_groups; 117 118 int (*match)(struct device *dev, struct device_driver *drv); 119 int (*uevent)(struct device *dev, struct kobj_uevent_env *env); 120 int (*probe)(struct device *dev); 121 int (*remove)(struct device *dev); 122 void (*shutdown)(struct device *dev); 123 124 int (*online)(struct device *dev); 125 int (*offline)(struct device *dev); 126 127 int (*suspend)(struct device *dev, pm_message_t state); 128 int (*resume)(struct device *dev); 129 130 int (*num_vf)(struct device *dev); 131 132 const struct dev_pm_ops *pm; 133 134 const struct iommu_ops *iommu_ops; 135 136 struct subsys_private *p; 137 struct lock_class_key lock_key; 138 }; 139 140 extern int __must_check bus_register(struct bus_type *bus); 141 142 extern void bus_unregister(struct bus_type *bus); 143 144 extern int __must_check bus_rescan_devices(struct bus_type *bus); 145 146 /* iterator helpers for buses */ 147 struct subsys_dev_iter { 148 struct klist_iter ki; 149 const struct device_type *type; 150 }; 151 void subsys_dev_iter_init(struct subsys_dev_iter *iter, 152 struct bus_type *subsys, 153 struct device *start, 154 const struct device_type *type); 155 struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter); 156 void subsys_dev_iter_exit(struct subsys_dev_iter *iter); 157 158 int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data, 159 int (*fn)(struct device *dev, void *data)); 160 struct device *bus_find_device(struct bus_type *bus, struct device *start, 161 void *data, 162 int (*match)(struct device *dev, void *data)); 163 struct device *bus_find_device_by_name(struct bus_type *bus, 164 struct device *start, 165 const char *name); 166 struct device *subsys_find_device_by_id(struct bus_type *bus, unsigned int id, 167 struct device *hint); 168 int bus_for_each_drv(struct bus_type *bus, struct device_driver *start, 169 void *data, int (*fn)(struct device_driver *, void *)); 170 void bus_sort_breadthfirst(struct bus_type *bus, 171 int (*compare)(const struct device *a, 172 const struct device *b)); 173 /* 174 * Bus notifiers: Get notified of addition/removal of devices 175 * and binding/unbinding of drivers to devices. 176 * In the long run, it should be a replacement for the platform 177 * notify hooks. 178 */ 179 struct notifier_block; 180 181 extern int bus_register_notifier(struct bus_type *bus, 182 struct notifier_block *nb); 183 extern int bus_unregister_notifier(struct bus_type *bus, 184 struct notifier_block *nb); 185 186 /* All 4 notifers below get called with the target struct device * 187 * as an argument. Note that those functions are likely to be called 188 * with the device lock held in the core, so be careful. 189 */ 190 #define BUS_NOTIFY_ADD_DEVICE 0x00000001 /* device added */ 191 #define BUS_NOTIFY_DEL_DEVICE 0x00000002 /* device to be removed */ 192 #define BUS_NOTIFY_REMOVED_DEVICE 0x00000003 /* device removed */ 193 #define BUS_NOTIFY_BIND_DRIVER 0x00000004 /* driver about to be 194 bound */ 195 #define BUS_NOTIFY_BOUND_DRIVER 0x00000005 /* driver bound to device */ 196 #define BUS_NOTIFY_UNBIND_DRIVER 0x00000006 /* driver about to be 197 unbound */ 198 #define BUS_NOTIFY_UNBOUND_DRIVER 0x00000007 /* driver is unbound 199 from the device */ 200 #define BUS_NOTIFY_DRIVER_NOT_BOUND 0x00000008 /* driver fails to be bound */ 201 202 extern struct kset *bus_get_kset(struct bus_type *bus); 203 extern struct klist *bus_get_device_klist(struct bus_type *bus); 204 205 /** 206 * enum probe_type - device driver probe type to try 207 * Device drivers may opt in for special handling of their 208 * respective probe routines. This tells the core what to 209 * expect and prefer. 210 * 211 * @PROBE_DEFAULT_STRATEGY: Used by drivers that work equally well 212 * whether probed synchronously or asynchronously. 213 * @PROBE_PREFER_ASYNCHRONOUS: Drivers for "slow" devices which 214 * probing order is not essential for booting the system may 215 * opt into executing their probes asynchronously. 216 * @PROBE_FORCE_SYNCHRONOUS: Use this to annotate drivers that need 217 * their probe routines to run synchronously with driver and 218 * device registration (with the exception of -EPROBE_DEFER 219 * handling - re-probing always ends up being done asynchronously). 220 * 221 * Note that the end goal is to switch the kernel to use asynchronous 222 * probing by default, so annotating drivers with 223 * %PROBE_PREFER_ASYNCHRONOUS is a temporary measure that allows us 224 * to speed up boot process while we are validating the rest of the 225 * drivers. 226 */ 227 enum probe_type { 228 PROBE_DEFAULT_STRATEGY, 229 PROBE_PREFER_ASYNCHRONOUS, 230 PROBE_FORCE_SYNCHRONOUS, 231 }; 232 233 /** 234 * struct device_driver - The basic device driver structure 235 * @name: Name of the device driver. 236 * @bus: The bus which the device of this driver belongs to. 237 * @owner: The module owner. 238 * @mod_name: Used for built-in modules. 239 * @suppress_bind_attrs: Disables bind/unbind via sysfs. 240 * @probe_type: Type of the probe (synchronous or asynchronous) to use. 241 * @of_match_table: The open firmware table. 242 * @acpi_match_table: The ACPI match table. 243 * @probe: Called to query the existence of a specific device, 244 * whether this driver can work with it, and bind the driver 245 * to a specific device. 246 * @remove: Called when the device is removed from the system to 247 * unbind a device from this driver. 248 * @shutdown: Called at shut-down time to quiesce the device. 249 * @suspend: Called to put the device to sleep mode. Usually to a 250 * low power state. 251 * @resume: Called to bring a device from sleep mode. 252 * @groups: Default attributes that get created by the driver core 253 * automatically. 254 * @pm: Power management operations of the device which matched 255 * this driver. 256 * @p: Driver core's private data, no one other than the driver 257 * core can touch this. 258 * 259 * The device driver-model tracks all of the drivers known to the system. 260 * The main reason for this tracking is to enable the driver core to match 261 * up drivers with new devices. Once drivers are known objects within the 262 * system, however, a number of other things become possible. Device drivers 263 * can export information and configuration variables that are independent 264 * of any specific device. 265 */ 266 struct device_driver { 267 const char *name; 268 struct bus_type *bus; 269 270 struct module *owner; 271 const char *mod_name; /* used for built-in modules */ 272 273 bool suppress_bind_attrs; /* disables bind/unbind via sysfs */ 274 enum probe_type probe_type; 275 276 const struct of_device_id *of_match_table; 277 const struct acpi_device_id *acpi_match_table; 278 279 int (*probe) (struct device *dev); 280 int (*remove) (struct device *dev); 281 void (*shutdown) (struct device *dev); 282 int (*suspend) (struct device *dev, pm_message_t state); 283 int (*resume) (struct device *dev); 284 const struct attribute_group **groups; 285 286 const struct dev_pm_ops *pm; 287 288 struct driver_private *p; 289 }; 290 291 292 extern int __must_check driver_register(struct device_driver *drv); 293 extern void driver_unregister(struct device_driver *drv); 294 295 extern struct device_driver *driver_find(const char *name, 296 struct bus_type *bus); 297 extern int driver_probe_done(void); 298 extern void wait_for_device_probe(void); 299 300 301 /* sysfs interface for exporting driver attributes */ 302 303 struct driver_attribute { 304 struct attribute attr; 305 ssize_t (*show)(struct device_driver *driver, char *buf); 306 ssize_t (*store)(struct device_driver *driver, const char *buf, 307 size_t count); 308 }; 309 310 #define DRIVER_ATTR(_name, _mode, _show, _store) \ 311 struct driver_attribute driver_attr_##_name = __ATTR(_name, _mode, _show, _store) 312 #define DRIVER_ATTR_RW(_name) \ 313 struct driver_attribute driver_attr_##_name = __ATTR_RW(_name) 314 #define DRIVER_ATTR_RO(_name) \ 315 struct driver_attribute driver_attr_##_name = __ATTR_RO(_name) 316 #define DRIVER_ATTR_WO(_name) \ 317 struct driver_attribute driver_attr_##_name = __ATTR_WO(_name) 318 319 extern int __must_check driver_create_file(struct device_driver *driver, 320 const struct driver_attribute *attr); 321 extern void driver_remove_file(struct device_driver *driver, 322 const struct driver_attribute *attr); 323 324 extern int __must_check driver_for_each_device(struct device_driver *drv, 325 struct device *start, 326 void *data, 327 int (*fn)(struct device *dev, 328 void *)); 329 struct device *driver_find_device(struct device_driver *drv, 330 struct device *start, void *data, 331 int (*match)(struct device *dev, void *data)); 332 333 /** 334 * struct subsys_interface - interfaces to device functions 335 * @name: name of the device function 336 * @subsys: subsytem of the devices to attach to 337 * @node: the list of functions registered at the subsystem 338 * @add_dev: device hookup to device function handler 339 * @remove_dev: device hookup to device function handler 340 * 341 * Simple interfaces attached to a subsystem. Multiple interfaces can 342 * attach to a subsystem and its devices. Unlike drivers, they do not 343 * exclusively claim or control devices. Interfaces usually represent 344 * a specific functionality of a subsystem/class of devices. 345 */ 346 struct subsys_interface { 347 const char *name; 348 struct bus_type *subsys; 349 struct list_head node; 350 int (*add_dev)(struct device *dev, struct subsys_interface *sif); 351 void (*remove_dev)(struct device *dev, struct subsys_interface *sif); 352 }; 353 354 int subsys_interface_register(struct subsys_interface *sif); 355 void subsys_interface_unregister(struct subsys_interface *sif); 356 357 int subsys_system_register(struct bus_type *subsys, 358 const struct attribute_group **groups); 359 int subsys_virtual_register(struct bus_type *subsys, 360 const struct attribute_group **groups); 361 362 /** 363 * struct class - device classes 364 * @name: Name of the class. 365 * @owner: The module owner. 366 * @class_groups: Default attributes of this class. 367 * @dev_groups: Default attributes of the devices that belong to the class. 368 * @dev_kobj: The kobject that represents this class and links it into the hierarchy. 369 * @dev_uevent: Called when a device is added, removed from this class, or a 370 * few other things that generate uevents to add the environment 371 * variables. 372 * @devnode: Callback to provide the devtmpfs. 373 * @class_release: Called to release this class. 374 * @dev_release: Called to release the device. 375 * @suspend: Used to put the device to sleep mode, usually to a low power 376 * state. 377 * @resume: Used to bring the device from the sleep mode. 378 * @shutdown: Called at shut-down time to quiesce the device. 379 * @ns_type: Callbacks so sysfs can detemine namespaces. 380 * @namespace: Namespace of the device belongs to this class. 381 * @pm: The default device power management operations of this class. 382 * @p: The private data of the driver core, no one other than the 383 * driver core can touch this. 384 * 385 * A class is a higher-level view of a device that abstracts out low-level 386 * implementation details. Drivers may see a SCSI disk or an ATA disk, but, 387 * at the class level, they are all simply disks. Classes allow user space 388 * to work with devices based on what they do, rather than how they are 389 * connected or how they work. 390 */ 391 struct class { 392 const char *name; 393 struct module *owner; 394 395 const struct attribute_group **class_groups; 396 const struct attribute_group **dev_groups; 397 struct kobject *dev_kobj; 398 399 int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env); 400 char *(*devnode)(struct device *dev, umode_t *mode); 401 402 void (*class_release)(struct class *class); 403 void (*dev_release)(struct device *dev); 404 405 int (*suspend)(struct device *dev, pm_message_t state); 406 int (*resume)(struct device *dev); 407 int (*shutdown)(struct device *dev); 408 409 const struct kobj_ns_type_operations *ns_type; 410 const void *(*namespace)(struct device *dev); 411 412 const struct dev_pm_ops *pm; 413 414 struct subsys_private *p; 415 }; 416 417 struct class_dev_iter { 418 struct klist_iter ki; 419 const struct device_type *type; 420 }; 421 422 extern struct kobject *sysfs_dev_block_kobj; 423 extern struct kobject *sysfs_dev_char_kobj; 424 extern int __must_check __class_register(struct class *class, 425 struct lock_class_key *key); 426 extern void class_unregister(struct class *class); 427 428 /* This is a #define to keep the compiler from merging different 429 * instances of the __key variable */ 430 #define class_register(class) \ 431 ({ \ 432 static struct lock_class_key __key; \ 433 __class_register(class, &__key); \ 434 }) 435 436 struct class_compat; 437 struct class_compat *class_compat_register(const char *name); 438 void class_compat_unregister(struct class_compat *cls); 439 int class_compat_create_link(struct class_compat *cls, struct device *dev, 440 struct device *device_link); 441 void class_compat_remove_link(struct class_compat *cls, struct device *dev, 442 struct device *device_link); 443 444 extern void class_dev_iter_init(struct class_dev_iter *iter, 445 struct class *class, 446 struct device *start, 447 const struct device_type *type); 448 extern struct device *class_dev_iter_next(struct class_dev_iter *iter); 449 extern void class_dev_iter_exit(struct class_dev_iter *iter); 450 451 extern int class_for_each_device(struct class *class, struct device *start, 452 void *data, 453 int (*fn)(struct device *dev, void *data)); 454 extern struct device *class_find_device(struct class *class, 455 struct device *start, const void *data, 456 int (*match)(struct device *, const void *)); 457 458 struct class_attribute { 459 struct attribute attr; 460 ssize_t (*show)(struct class *class, struct class_attribute *attr, 461 char *buf); 462 ssize_t (*store)(struct class *class, struct class_attribute *attr, 463 const char *buf, size_t count); 464 }; 465 466 #define CLASS_ATTR_RW(_name) \ 467 struct class_attribute class_attr_##_name = __ATTR_RW(_name) 468 #define CLASS_ATTR_RO(_name) \ 469 struct class_attribute class_attr_##_name = __ATTR_RO(_name) 470 #define CLASS_ATTR_WO(_name) \ 471 struct class_attribute class_attr_##_name = __ATTR_WO(_name) 472 473 extern int __must_check class_create_file_ns(struct class *class, 474 const struct class_attribute *attr, 475 const void *ns); 476 extern void class_remove_file_ns(struct class *class, 477 const struct class_attribute *attr, 478 const void *ns); 479 480 static inline int __must_check class_create_file(struct class *class, 481 const struct class_attribute *attr) 482 { 483 return class_create_file_ns(class, attr, NULL); 484 } 485 486 static inline void class_remove_file(struct class *class, 487 const struct class_attribute *attr) 488 { 489 return class_remove_file_ns(class, attr, NULL); 490 } 491 492 /* Simple class attribute that is just a static string */ 493 struct class_attribute_string { 494 struct class_attribute attr; 495 char *str; 496 }; 497 498 /* Currently read-only only */ 499 #define _CLASS_ATTR_STRING(_name, _mode, _str) \ 500 { __ATTR(_name, _mode, show_class_attr_string, NULL), _str } 501 #define CLASS_ATTR_STRING(_name, _mode, _str) \ 502 struct class_attribute_string class_attr_##_name = \ 503 _CLASS_ATTR_STRING(_name, _mode, _str) 504 505 extern ssize_t show_class_attr_string(struct class *class, struct class_attribute *attr, 506 char *buf); 507 508 struct class_interface { 509 struct list_head node; 510 struct class *class; 511 512 int (*add_dev) (struct device *, struct class_interface *); 513 void (*remove_dev) (struct device *, struct class_interface *); 514 }; 515 516 extern int __must_check class_interface_register(struct class_interface *); 517 extern void class_interface_unregister(struct class_interface *); 518 519 extern struct class * __must_check __class_create(struct module *owner, 520 const char *name, 521 struct lock_class_key *key); 522 extern void class_destroy(struct class *cls); 523 524 /* This is a #define to keep the compiler from merging different 525 * instances of the __key variable */ 526 #define class_create(owner, name) \ 527 ({ \ 528 static struct lock_class_key __key; \ 529 __class_create(owner, name, &__key); \ 530 }) 531 532 /* 533 * The type of device, "struct device" is embedded in. A class 534 * or bus can contain devices of different types 535 * like "partitions" and "disks", "mouse" and "event". 536 * This identifies the device type and carries type-specific 537 * information, equivalent to the kobj_type of a kobject. 538 * If "name" is specified, the uevent will contain it in 539 * the DEVTYPE variable. 540 */ 541 struct device_type { 542 const char *name; 543 const struct attribute_group **groups; 544 int (*uevent)(struct device *dev, struct kobj_uevent_env *env); 545 char *(*devnode)(struct device *dev, umode_t *mode, 546 kuid_t *uid, kgid_t *gid); 547 void (*release)(struct device *dev); 548 549 const struct dev_pm_ops *pm; 550 }; 551 552 /* interface for exporting device attributes */ 553 struct device_attribute { 554 struct attribute attr; 555 ssize_t (*show)(struct device *dev, struct device_attribute *attr, 556 char *buf); 557 ssize_t (*store)(struct device *dev, struct device_attribute *attr, 558 const char *buf, size_t count); 559 }; 560 561 struct dev_ext_attribute { 562 struct device_attribute attr; 563 void *var; 564 }; 565 566 ssize_t device_show_ulong(struct device *dev, struct device_attribute *attr, 567 char *buf); 568 ssize_t device_store_ulong(struct device *dev, struct device_attribute *attr, 569 const char *buf, size_t count); 570 ssize_t device_show_int(struct device *dev, struct device_attribute *attr, 571 char *buf); 572 ssize_t device_store_int(struct device *dev, struct device_attribute *attr, 573 const char *buf, size_t count); 574 ssize_t device_show_bool(struct device *dev, struct device_attribute *attr, 575 char *buf); 576 ssize_t device_store_bool(struct device *dev, struct device_attribute *attr, 577 const char *buf, size_t count); 578 579 #define DEVICE_ATTR(_name, _mode, _show, _store) \ 580 struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store) 581 #define DEVICE_ATTR_RW(_name) \ 582 struct device_attribute dev_attr_##_name = __ATTR_RW(_name) 583 #define DEVICE_ATTR_RO(_name) \ 584 struct device_attribute dev_attr_##_name = __ATTR_RO(_name) 585 #define DEVICE_ATTR_WO(_name) \ 586 struct device_attribute dev_attr_##_name = __ATTR_WO(_name) 587 #define DEVICE_ULONG_ATTR(_name, _mode, _var) \ 588 struct dev_ext_attribute dev_attr_##_name = \ 589 { __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) } 590 #define DEVICE_INT_ATTR(_name, _mode, _var) \ 591 struct dev_ext_attribute dev_attr_##_name = \ 592 { __ATTR(_name, _mode, device_show_int, device_store_int), &(_var) } 593 #define DEVICE_BOOL_ATTR(_name, _mode, _var) \ 594 struct dev_ext_attribute dev_attr_##_name = \ 595 { __ATTR(_name, _mode, device_show_bool, device_store_bool), &(_var) } 596 #define DEVICE_ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) \ 597 struct device_attribute dev_attr_##_name = \ 598 __ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) 599 600 extern int device_create_file(struct device *device, 601 const struct device_attribute *entry); 602 extern void device_remove_file(struct device *dev, 603 const struct device_attribute *attr); 604 extern bool device_remove_file_self(struct device *dev, 605 const struct device_attribute *attr); 606 extern int __must_check device_create_bin_file(struct device *dev, 607 const struct bin_attribute *attr); 608 extern void device_remove_bin_file(struct device *dev, 609 const struct bin_attribute *attr); 610 611 /* device resource management */ 612 typedef void (*dr_release_t)(struct device *dev, void *res); 613 typedef int (*dr_match_t)(struct device *dev, void *res, void *match_data); 614 615 #ifdef CONFIG_DEBUG_DEVRES 616 extern void *__devres_alloc_node(dr_release_t release, size_t size, gfp_t gfp, 617 int nid, const char *name) __malloc; 618 #define devres_alloc(release, size, gfp) \ 619 __devres_alloc_node(release, size, gfp, NUMA_NO_NODE, #release) 620 #define devres_alloc_node(release, size, gfp, nid) \ 621 __devres_alloc_node(release, size, gfp, nid, #release) 622 #else 623 extern void *devres_alloc_node(dr_release_t release, size_t size, gfp_t gfp, 624 int nid) __malloc; 625 static inline void *devres_alloc(dr_release_t release, size_t size, gfp_t gfp) 626 { 627 return devres_alloc_node(release, size, gfp, NUMA_NO_NODE); 628 } 629 #endif 630 631 extern void devres_for_each_res(struct device *dev, dr_release_t release, 632 dr_match_t match, void *match_data, 633 void (*fn)(struct device *, void *, void *), 634 void *data); 635 extern void devres_free(void *res); 636 extern void devres_add(struct device *dev, void *res); 637 extern void *devres_find(struct device *dev, dr_release_t release, 638 dr_match_t match, void *match_data); 639 extern void *devres_get(struct device *dev, void *new_res, 640 dr_match_t match, void *match_data); 641 extern void *devres_remove(struct device *dev, dr_release_t release, 642 dr_match_t match, void *match_data); 643 extern int devres_destroy(struct device *dev, dr_release_t release, 644 dr_match_t match, void *match_data); 645 extern int devres_release(struct device *dev, dr_release_t release, 646 dr_match_t match, void *match_data); 647 648 /* devres group */ 649 extern void * __must_check devres_open_group(struct device *dev, void *id, 650 gfp_t gfp); 651 extern void devres_close_group(struct device *dev, void *id); 652 extern void devres_remove_group(struct device *dev, void *id); 653 extern int devres_release_group(struct device *dev, void *id); 654 655 /* managed devm_k.alloc/kfree for device drivers */ 656 extern void *devm_kmalloc(struct device *dev, size_t size, gfp_t gfp) __malloc; 657 extern __printf(3, 0) 658 char *devm_kvasprintf(struct device *dev, gfp_t gfp, const char *fmt, 659 va_list ap) __malloc; 660 extern __printf(3, 4) 661 char *devm_kasprintf(struct device *dev, gfp_t gfp, const char *fmt, ...) __malloc; 662 static inline void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp) 663 { 664 return devm_kmalloc(dev, size, gfp | __GFP_ZERO); 665 } 666 static inline void *devm_kmalloc_array(struct device *dev, 667 size_t n, size_t size, gfp_t flags) 668 { 669 if (size != 0 && n > SIZE_MAX / size) 670 return NULL; 671 return devm_kmalloc(dev, n * size, flags); 672 } 673 static inline void *devm_kcalloc(struct device *dev, 674 size_t n, size_t size, gfp_t flags) 675 { 676 return devm_kmalloc_array(dev, n, size, flags | __GFP_ZERO); 677 } 678 extern void devm_kfree(struct device *dev, void *p); 679 extern char *devm_kstrdup(struct device *dev, const char *s, gfp_t gfp) __malloc; 680 extern void *devm_kmemdup(struct device *dev, const void *src, size_t len, 681 gfp_t gfp); 682 683 extern unsigned long devm_get_free_pages(struct device *dev, 684 gfp_t gfp_mask, unsigned int order); 685 extern void devm_free_pages(struct device *dev, unsigned long addr); 686 687 void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res); 688 689 /* allows to add/remove a custom action to devres stack */ 690 int devm_add_action(struct device *dev, void (*action)(void *), void *data); 691 void devm_remove_action(struct device *dev, void (*action)(void *), void *data); 692 693 static inline int devm_add_action_or_reset(struct device *dev, 694 void (*action)(void *), void *data) 695 { 696 int ret; 697 698 ret = devm_add_action(dev, action, data); 699 if (ret) 700 action(data); 701 702 return ret; 703 } 704 705 /** 706 * devm_alloc_percpu - Resource-managed alloc_percpu 707 * @dev: Device to allocate per-cpu memory for 708 * @type: Type to allocate per-cpu memory for 709 * 710 * Managed alloc_percpu. Per-cpu memory allocated with this function is 711 * automatically freed on driver detach. 712 * 713 * RETURNS: 714 * Pointer to allocated memory on success, NULL on failure. 715 */ 716 #define devm_alloc_percpu(dev, type) \ 717 ((typeof(type) __percpu *)__devm_alloc_percpu((dev), sizeof(type), \ 718 __alignof__(type))) 719 720 void __percpu *__devm_alloc_percpu(struct device *dev, size_t size, 721 size_t align); 722 void devm_free_percpu(struct device *dev, void __percpu *pdata); 723 724 struct device_dma_parameters { 725 /* 726 * a low level driver may set these to teach IOMMU code about 727 * sg limitations. 728 */ 729 unsigned int max_segment_size; 730 unsigned long segment_boundary_mask; 731 }; 732 733 /** 734 * enum device_link_state - Device link states. 735 * @DL_STATE_NONE: The presence of the drivers is not being tracked. 736 * @DL_STATE_DORMANT: None of the supplier/consumer drivers is present. 737 * @DL_STATE_AVAILABLE: The supplier driver is present, but the consumer is not. 738 * @DL_STATE_CONSUMER_PROBE: The consumer is probing (supplier driver present). 739 * @DL_STATE_ACTIVE: Both the supplier and consumer drivers are present. 740 * @DL_STATE_SUPPLIER_UNBIND: The supplier driver is unbinding. 741 */ 742 enum device_link_state { 743 DL_STATE_NONE = -1, 744 DL_STATE_DORMANT = 0, 745 DL_STATE_AVAILABLE, 746 DL_STATE_CONSUMER_PROBE, 747 DL_STATE_ACTIVE, 748 DL_STATE_SUPPLIER_UNBIND, 749 }; 750 751 /* 752 * Device link flags. 753 * 754 * STATELESS: The core won't track the presence of supplier/consumer drivers. 755 * AUTOREMOVE: Remove this link automatically on consumer driver unbind. 756 * PM_RUNTIME: If set, the runtime PM framework will use this link. 757 * RPM_ACTIVE: Run pm_runtime_get_sync() on the supplier during link creation. 758 */ 759 #define DL_FLAG_STATELESS BIT(0) 760 #define DL_FLAG_AUTOREMOVE BIT(1) 761 #define DL_FLAG_PM_RUNTIME BIT(2) 762 #define DL_FLAG_RPM_ACTIVE BIT(3) 763 764 /** 765 * struct device_link - Device link representation. 766 * @supplier: The device on the supplier end of the link. 767 * @s_node: Hook to the supplier device's list of links to consumers. 768 * @consumer: The device on the consumer end of the link. 769 * @c_node: Hook to the consumer device's list of links to suppliers. 770 * @status: The state of the link (with respect to the presence of drivers). 771 * @flags: Link flags. 772 * @rpm_active: Whether or not the consumer device is runtime-PM-active. 773 * @rcu_head: An RCU head to use for deferred execution of SRCU callbacks. 774 */ 775 struct device_link { 776 struct device *supplier; 777 struct list_head s_node; 778 struct device *consumer; 779 struct list_head c_node; 780 enum device_link_state status; 781 u32 flags; 782 bool rpm_active; 783 #ifdef CONFIG_SRCU 784 struct rcu_head rcu_head; 785 #endif 786 }; 787 788 /** 789 * enum dl_dev_state - Device driver presence tracking information. 790 * @DL_DEV_NO_DRIVER: There is no driver attached to the device. 791 * @DL_DEV_PROBING: A driver is probing. 792 * @DL_DEV_DRIVER_BOUND: The driver has been bound to the device. 793 * @DL_DEV_UNBINDING: The driver is unbinding from the device. 794 */ 795 enum dl_dev_state { 796 DL_DEV_NO_DRIVER = 0, 797 DL_DEV_PROBING, 798 DL_DEV_DRIVER_BOUND, 799 DL_DEV_UNBINDING, 800 }; 801 802 /** 803 * struct dev_links_info - Device data related to device links. 804 * @suppliers: List of links to supplier devices. 805 * @consumers: List of links to consumer devices. 806 * @status: Driver status information. 807 */ 808 struct dev_links_info { 809 struct list_head suppliers; 810 struct list_head consumers; 811 enum dl_dev_state status; 812 }; 813 814 /** 815 * struct device - The basic device structure 816 * @parent: The device's "parent" device, the device to which it is attached. 817 * In most cases, a parent device is some sort of bus or host 818 * controller. If parent is NULL, the device, is a top-level device, 819 * which is not usually what you want. 820 * @p: Holds the private data of the driver core portions of the device. 821 * See the comment of the struct device_private for detail. 822 * @kobj: A top-level, abstract class from which other classes are derived. 823 * @init_name: Initial name of the device. 824 * @type: The type of device. 825 * This identifies the device type and carries type-specific 826 * information. 827 * @mutex: Mutex to synchronize calls to its driver. 828 * @bus: Type of bus device is on. 829 * @driver: Which driver has allocated this 830 * @platform_data: Platform data specific to the device. 831 * Example: For devices on custom boards, as typical of embedded 832 * and SOC based hardware, Linux often uses platform_data to point 833 * to board-specific structures describing devices and how they 834 * are wired. That can include what ports are available, chip 835 * variants, which GPIO pins act in what additional roles, and so 836 * on. This shrinks the "Board Support Packages" (BSPs) and 837 * minimizes board-specific #ifdefs in drivers. 838 * @driver_data: Private pointer for driver specific info. 839 * @links: Links to suppliers and consumers of this device. 840 * @power: For device power management. 841 * See Documentation/power/admin-guide/devices.rst for details. 842 * @pm_domain: Provide callbacks that are executed during system suspend, 843 * hibernation, system resume and during runtime PM transitions 844 * along with subsystem-level and driver-level callbacks. 845 * @pins: For device pin management. 846 * See Documentation/pinctrl.txt for details. 847 * @msi_list: Hosts MSI descriptors 848 * @msi_domain: The generic MSI domain this device is using. 849 * @numa_node: NUMA node this device is close to. 850 * @dma_mask: Dma mask (if dma'ble device). 851 * @coherent_dma_mask: Like dma_mask, but for alloc_coherent mapping as not all 852 * hardware supports 64-bit addresses for consistent allocations 853 * such descriptors. 854 * @dma_pfn_offset: offset of DMA memory range relatively of RAM 855 * @dma_parms: A low level driver may set these to teach IOMMU code about 856 * segment limitations. 857 * @dma_pools: Dma pools (if dma'ble device). 858 * @dma_mem: Internal for coherent mem override. 859 * @cma_area: Contiguous memory area for dma allocations 860 * @archdata: For arch-specific additions. 861 * @of_node: Associated device tree node. 862 * @fwnode: Associated device node supplied by platform firmware. 863 * @devt: For creating the sysfs "dev". 864 * @id: device instance 865 * @devres_lock: Spinlock to protect the resource of the device. 866 * @devres_head: The resources list of the device. 867 * @knode_class: The node used to add the device to the class list. 868 * @class: The class of the device. 869 * @groups: Optional attribute groups. 870 * @release: Callback to free the device after all references have 871 * gone away. This should be set by the allocator of the 872 * device (i.e. the bus driver that discovered the device). 873 * @iommu_group: IOMMU group the device belongs to. 874 * @iommu_fwspec: IOMMU-specific properties supplied by firmware. 875 * 876 * @offline_disabled: If set, the device is permanently online. 877 * @offline: Set after successful invocation of bus type's .offline(). 878 * @of_node_reused: Set if the device-tree node is shared with an ancestor 879 * device. 880 * 881 * At the lowest level, every device in a Linux system is represented by an 882 * instance of struct device. The device structure contains the information 883 * that the device model core needs to model the system. Most subsystems, 884 * however, track additional information about the devices they host. As a 885 * result, it is rare for devices to be represented by bare device structures; 886 * instead, that structure, like kobject structures, is usually embedded within 887 * a higher-level representation of the device. 888 */ 889 struct device { 890 struct device *parent; 891 892 struct device_private *p; 893 894 struct kobject kobj; 895 const char *init_name; /* initial name of the device */ 896 const struct device_type *type; 897 898 struct mutex mutex; /* mutex to synchronize calls to 899 * its driver. 900 */ 901 902 struct bus_type *bus; /* type of bus device is on */ 903 struct device_driver *driver; /* which driver has allocated this 904 device */ 905 void *platform_data; /* Platform specific data, device 906 core doesn't touch it */ 907 void *driver_data; /* Driver data, set and get with 908 dev_set/get_drvdata */ 909 struct dev_links_info links; 910 struct dev_pm_info power; 911 struct dev_pm_domain *pm_domain; 912 913 #ifdef CONFIG_GENERIC_MSI_IRQ_DOMAIN 914 struct irq_domain *msi_domain; 915 #endif 916 #ifdef CONFIG_PINCTRL 917 struct dev_pin_info *pins; 918 #endif 919 #ifdef CONFIG_GENERIC_MSI_IRQ 920 struct list_head msi_list; 921 #endif 922 923 #ifdef CONFIG_NUMA 924 int numa_node; /* NUMA node this device is close to */ 925 #endif 926 const struct dma_map_ops *dma_ops; 927 u64 *dma_mask; /* dma mask (if dma'able device) */ 928 u64 coherent_dma_mask;/* Like dma_mask, but for 929 alloc_coherent mappings as 930 not all hardware supports 931 64 bit addresses for consistent 932 allocations such descriptors. */ 933 unsigned long dma_pfn_offset; 934 935 struct device_dma_parameters *dma_parms; 936 937 struct list_head dma_pools; /* dma pools (if dma'ble) */ 938 939 struct dma_coherent_mem *dma_mem; /* internal for coherent mem 940 override */ 941 #ifdef CONFIG_DMA_CMA 942 struct cma *cma_area; /* contiguous memory area for dma 943 allocations */ 944 #endif 945 /* arch specific additions */ 946 struct dev_archdata archdata; 947 948 struct device_node *of_node; /* associated device tree node */ 949 struct fwnode_handle *fwnode; /* firmware device node */ 950 951 dev_t devt; /* dev_t, creates the sysfs "dev" */ 952 u32 id; /* device instance */ 953 954 spinlock_t devres_lock; 955 struct list_head devres_head; 956 957 struct klist_node knode_class; 958 struct class *class; 959 const struct attribute_group **groups; /* optional groups */ 960 961 void (*release)(struct device *dev); 962 struct iommu_group *iommu_group; 963 struct iommu_fwspec *iommu_fwspec; 964 965 bool offline_disabled:1; 966 bool offline:1; 967 bool of_node_reused:1; 968 }; 969 970 static inline struct device *kobj_to_dev(struct kobject *kobj) 971 { 972 return container_of(kobj, struct device, kobj); 973 } 974 975 /* Get the wakeup routines, which depend on struct device */ 976 #include <linux/pm_wakeup.h> 977 978 static inline const char *dev_name(const struct device *dev) 979 { 980 /* Use the init name until the kobject becomes available */ 981 if (dev->init_name) 982 return dev->init_name; 983 984 return kobject_name(&dev->kobj); 985 } 986 987 extern __printf(2, 3) 988 int dev_set_name(struct device *dev, const char *name, ...); 989 990 #ifdef CONFIG_NUMA 991 static inline int dev_to_node(struct device *dev) 992 { 993 return dev->numa_node; 994 } 995 static inline void set_dev_node(struct device *dev, int node) 996 { 997 dev->numa_node = node; 998 } 999 #else 1000 static inline int dev_to_node(struct device *dev) 1001 { 1002 return -1; 1003 } 1004 static inline void set_dev_node(struct device *dev, int node) 1005 { 1006 } 1007 #endif 1008 1009 static inline struct irq_domain *dev_get_msi_domain(const struct device *dev) 1010 { 1011 #ifdef CONFIG_GENERIC_MSI_IRQ_DOMAIN 1012 return dev->msi_domain; 1013 #else 1014 return NULL; 1015 #endif 1016 } 1017 1018 static inline void dev_set_msi_domain(struct device *dev, struct irq_domain *d) 1019 { 1020 #ifdef CONFIG_GENERIC_MSI_IRQ_DOMAIN 1021 dev->msi_domain = d; 1022 #endif 1023 } 1024 1025 static inline void *dev_get_drvdata(const struct device *dev) 1026 { 1027 return dev->driver_data; 1028 } 1029 1030 static inline void dev_set_drvdata(struct device *dev, void *data) 1031 { 1032 dev->driver_data = data; 1033 } 1034 1035 static inline struct pm_subsys_data *dev_to_psd(struct device *dev) 1036 { 1037 return dev ? dev->power.subsys_data : NULL; 1038 } 1039 1040 static inline unsigned int dev_get_uevent_suppress(const struct device *dev) 1041 { 1042 return dev->kobj.uevent_suppress; 1043 } 1044 1045 static inline void dev_set_uevent_suppress(struct device *dev, int val) 1046 { 1047 dev->kobj.uevent_suppress = val; 1048 } 1049 1050 static inline int device_is_registered(struct device *dev) 1051 { 1052 return dev->kobj.state_in_sysfs; 1053 } 1054 1055 static inline void device_enable_async_suspend(struct device *dev) 1056 { 1057 if (!dev->power.is_prepared) 1058 dev->power.async_suspend = true; 1059 } 1060 1061 static inline void device_disable_async_suspend(struct device *dev) 1062 { 1063 if (!dev->power.is_prepared) 1064 dev->power.async_suspend = false; 1065 } 1066 1067 static inline bool device_async_suspend_enabled(struct device *dev) 1068 { 1069 return !!dev->power.async_suspend; 1070 } 1071 1072 static inline void dev_pm_syscore_device(struct device *dev, bool val) 1073 { 1074 #ifdef CONFIG_PM_SLEEP 1075 dev->power.syscore = val; 1076 #endif 1077 } 1078 1079 static inline void device_lock(struct device *dev) 1080 { 1081 mutex_lock(&dev->mutex); 1082 } 1083 1084 static inline int device_lock_interruptible(struct device *dev) 1085 { 1086 return mutex_lock_interruptible(&dev->mutex); 1087 } 1088 1089 static inline int device_trylock(struct device *dev) 1090 { 1091 return mutex_trylock(&dev->mutex); 1092 } 1093 1094 static inline void device_unlock(struct device *dev) 1095 { 1096 mutex_unlock(&dev->mutex); 1097 } 1098 1099 static inline void device_lock_assert(struct device *dev) 1100 { 1101 lockdep_assert_held(&dev->mutex); 1102 } 1103 1104 static inline struct device_node *dev_of_node(struct device *dev) 1105 { 1106 if (!IS_ENABLED(CONFIG_OF)) 1107 return NULL; 1108 return dev->of_node; 1109 } 1110 1111 void driver_init(void); 1112 1113 /* 1114 * High level routines for use by the bus drivers 1115 */ 1116 extern int __must_check device_register(struct device *dev); 1117 extern void device_unregister(struct device *dev); 1118 extern void device_initialize(struct device *dev); 1119 extern int __must_check device_add(struct device *dev); 1120 extern void device_del(struct device *dev); 1121 extern int device_for_each_child(struct device *dev, void *data, 1122 int (*fn)(struct device *dev, void *data)); 1123 extern int device_for_each_child_reverse(struct device *dev, void *data, 1124 int (*fn)(struct device *dev, void *data)); 1125 extern struct device *device_find_child(struct device *dev, void *data, 1126 int (*match)(struct device *dev, void *data)); 1127 extern int device_rename(struct device *dev, const char *new_name); 1128 extern int device_move(struct device *dev, struct device *new_parent, 1129 enum dpm_order dpm_order); 1130 extern const char *device_get_devnode(struct device *dev, 1131 umode_t *mode, kuid_t *uid, kgid_t *gid, 1132 const char **tmp); 1133 1134 static inline bool device_supports_offline(struct device *dev) 1135 { 1136 return dev->bus && dev->bus->offline && dev->bus->online; 1137 } 1138 1139 extern void lock_device_hotplug(void); 1140 extern void unlock_device_hotplug(void); 1141 extern int lock_device_hotplug_sysfs(void); 1142 extern int device_offline(struct device *dev); 1143 extern int device_online(struct device *dev); 1144 extern void set_primary_fwnode(struct device *dev, struct fwnode_handle *fwnode); 1145 extern void set_secondary_fwnode(struct device *dev, struct fwnode_handle *fwnode); 1146 void device_set_of_node_from_dev(struct device *dev, const struct device *dev2); 1147 1148 static inline int dev_num_vf(struct device *dev) 1149 { 1150 if (dev->bus && dev->bus->num_vf) 1151 return dev->bus->num_vf(dev); 1152 return 0; 1153 } 1154 1155 /* 1156 * Root device objects for grouping under /sys/devices 1157 */ 1158 extern struct device *__root_device_register(const char *name, 1159 struct module *owner); 1160 1161 /* This is a macro to avoid include problems with THIS_MODULE */ 1162 #define root_device_register(name) \ 1163 __root_device_register(name, THIS_MODULE) 1164 1165 extern void root_device_unregister(struct device *root); 1166 1167 static inline void *dev_get_platdata(const struct device *dev) 1168 { 1169 return dev->platform_data; 1170 } 1171 1172 /* 1173 * Manual binding of a device to driver. See drivers/base/bus.c 1174 * for information on use. 1175 */ 1176 extern int __must_check device_bind_driver(struct device *dev); 1177 extern void device_release_driver(struct device *dev); 1178 extern int __must_check device_attach(struct device *dev); 1179 extern int __must_check driver_attach(struct device_driver *drv); 1180 extern void device_initial_probe(struct device *dev); 1181 extern int __must_check device_reprobe(struct device *dev); 1182 1183 extern bool device_is_bound(struct device *dev); 1184 1185 /* 1186 * Easy functions for dynamically creating devices on the fly 1187 */ 1188 extern __printf(5, 0) 1189 struct device *device_create_vargs(struct class *cls, struct device *parent, 1190 dev_t devt, void *drvdata, 1191 const char *fmt, va_list vargs); 1192 extern __printf(5, 6) 1193 struct device *device_create(struct class *cls, struct device *parent, 1194 dev_t devt, void *drvdata, 1195 const char *fmt, ...); 1196 extern __printf(6, 7) 1197 struct device *device_create_with_groups(struct class *cls, 1198 struct device *parent, dev_t devt, void *drvdata, 1199 const struct attribute_group **groups, 1200 const char *fmt, ...); 1201 extern void device_destroy(struct class *cls, dev_t devt); 1202 1203 /* 1204 * Platform "fixup" functions - allow the platform to have their say 1205 * about devices and actions that the general device layer doesn't 1206 * know about. 1207 */ 1208 /* Notify platform of device discovery */ 1209 extern int (*platform_notify)(struct device *dev); 1210 1211 extern int (*platform_notify_remove)(struct device *dev); 1212 1213 1214 /* 1215 * get_device - atomically increment the reference count for the device. 1216 * 1217 */ 1218 extern struct device *get_device(struct device *dev); 1219 extern void put_device(struct device *dev); 1220 1221 #ifdef CONFIG_DEVTMPFS 1222 extern int devtmpfs_create_node(struct device *dev); 1223 extern int devtmpfs_delete_node(struct device *dev); 1224 extern int devtmpfs_mount(const char *mntdir); 1225 #else 1226 static inline int devtmpfs_create_node(struct device *dev) { return 0; } 1227 static inline int devtmpfs_delete_node(struct device *dev) { return 0; } 1228 static inline int devtmpfs_mount(const char *mountpoint) { return 0; } 1229 #endif 1230 1231 /* drivers/base/power/shutdown.c */ 1232 extern void device_shutdown(void); 1233 1234 /* debugging and troubleshooting/diagnostic helpers. */ 1235 extern const char *dev_driver_string(const struct device *dev); 1236 1237 /* Device links interface. */ 1238 struct device_link *device_link_add(struct device *consumer, 1239 struct device *supplier, u32 flags); 1240 void device_link_del(struct device_link *link); 1241 1242 #ifdef CONFIG_PRINTK 1243 1244 extern __printf(3, 0) 1245 int dev_vprintk_emit(int level, const struct device *dev, 1246 const char *fmt, va_list args); 1247 extern __printf(3, 4) 1248 int dev_printk_emit(int level, const struct device *dev, const char *fmt, ...); 1249 1250 extern __printf(3, 4) 1251 void dev_printk(const char *level, const struct device *dev, 1252 const char *fmt, ...); 1253 extern __printf(2, 3) 1254 void dev_emerg(const struct device *dev, const char *fmt, ...); 1255 extern __printf(2, 3) 1256 void dev_alert(const struct device *dev, const char *fmt, ...); 1257 extern __printf(2, 3) 1258 void dev_crit(const struct device *dev, const char *fmt, ...); 1259 extern __printf(2, 3) 1260 void dev_err(const struct device *dev, const char *fmt, ...); 1261 extern __printf(2, 3) 1262 void dev_warn(const struct device *dev, const char *fmt, ...); 1263 extern __printf(2, 3) 1264 void dev_notice(const struct device *dev, const char *fmt, ...); 1265 extern __printf(2, 3) 1266 void _dev_info(const struct device *dev, const char *fmt, ...); 1267 1268 #else 1269 1270 static inline __printf(3, 0) 1271 int dev_vprintk_emit(int level, const struct device *dev, 1272 const char *fmt, va_list args) 1273 { return 0; } 1274 static inline __printf(3, 4) 1275 int dev_printk_emit(int level, const struct device *dev, const char *fmt, ...) 1276 { return 0; } 1277 1278 static inline void __dev_printk(const char *level, const struct device *dev, 1279 struct va_format *vaf) 1280 {} 1281 static inline __printf(3, 4) 1282 void dev_printk(const char *level, const struct device *dev, 1283 const char *fmt, ...) 1284 {} 1285 1286 static inline __printf(2, 3) 1287 void dev_emerg(const struct device *dev, const char *fmt, ...) 1288 {} 1289 static inline __printf(2, 3) 1290 void dev_crit(const struct device *dev, const char *fmt, ...) 1291 {} 1292 static inline __printf(2, 3) 1293 void dev_alert(const struct device *dev, const char *fmt, ...) 1294 {} 1295 static inline __printf(2, 3) 1296 void dev_err(const struct device *dev, const char *fmt, ...) 1297 {} 1298 static inline __printf(2, 3) 1299 void dev_warn(const struct device *dev, const char *fmt, ...) 1300 {} 1301 static inline __printf(2, 3) 1302 void dev_notice(const struct device *dev, const char *fmt, ...) 1303 {} 1304 static inline __printf(2, 3) 1305 void _dev_info(const struct device *dev, const char *fmt, ...) 1306 {} 1307 1308 #endif 1309 1310 /* 1311 * Stupid hackaround for existing uses of non-printk uses dev_info 1312 * 1313 * Note that the definition of dev_info below is actually _dev_info 1314 * and a macro is used to avoid redefining dev_info 1315 */ 1316 1317 #define dev_info(dev, fmt, arg...) _dev_info(dev, fmt, ##arg) 1318 1319 #if defined(CONFIG_DYNAMIC_DEBUG) 1320 #define dev_dbg(dev, format, ...) \ 1321 do { \ 1322 dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \ 1323 } while (0) 1324 #elif defined(DEBUG) 1325 #define dev_dbg(dev, format, arg...) \ 1326 dev_printk(KERN_DEBUG, dev, format, ##arg) 1327 #else 1328 #define dev_dbg(dev, format, arg...) \ 1329 ({ \ 1330 if (0) \ 1331 dev_printk(KERN_DEBUG, dev, format, ##arg); \ 1332 }) 1333 #endif 1334 1335 #ifdef CONFIG_PRINTK 1336 #define dev_level_once(dev_level, dev, fmt, ...) \ 1337 do { \ 1338 static bool __print_once __read_mostly; \ 1339 \ 1340 if (!__print_once) { \ 1341 __print_once = true; \ 1342 dev_level(dev, fmt, ##__VA_ARGS__); \ 1343 } \ 1344 } while (0) 1345 #else 1346 #define dev_level_once(dev_level, dev, fmt, ...) \ 1347 do { \ 1348 if (0) \ 1349 dev_level(dev, fmt, ##__VA_ARGS__); \ 1350 } while (0) 1351 #endif 1352 1353 #define dev_emerg_once(dev, fmt, ...) \ 1354 dev_level_once(dev_emerg, dev, fmt, ##__VA_ARGS__) 1355 #define dev_alert_once(dev, fmt, ...) \ 1356 dev_level_once(dev_alert, dev, fmt, ##__VA_ARGS__) 1357 #define dev_crit_once(dev, fmt, ...) \ 1358 dev_level_once(dev_crit, dev, fmt, ##__VA_ARGS__) 1359 #define dev_err_once(dev, fmt, ...) \ 1360 dev_level_once(dev_err, dev, fmt, ##__VA_ARGS__) 1361 #define dev_warn_once(dev, fmt, ...) \ 1362 dev_level_once(dev_warn, dev, fmt, ##__VA_ARGS__) 1363 #define dev_notice_once(dev, fmt, ...) \ 1364 dev_level_once(dev_notice, dev, fmt, ##__VA_ARGS__) 1365 #define dev_info_once(dev, fmt, ...) \ 1366 dev_level_once(dev_info, dev, fmt, ##__VA_ARGS__) 1367 #define dev_dbg_once(dev, fmt, ...) \ 1368 dev_level_once(dev_dbg, dev, fmt, ##__VA_ARGS__) 1369 1370 #define dev_level_ratelimited(dev_level, dev, fmt, ...) \ 1371 do { \ 1372 static DEFINE_RATELIMIT_STATE(_rs, \ 1373 DEFAULT_RATELIMIT_INTERVAL, \ 1374 DEFAULT_RATELIMIT_BURST); \ 1375 if (__ratelimit(&_rs)) \ 1376 dev_level(dev, fmt, ##__VA_ARGS__); \ 1377 } while (0) 1378 1379 #define dev_emerg_ratelimited(dev, fmt, ...) \ 1380 dev_level_ratelimited(dev_emerg, dev, fmt, ##__VA_ARGS__) 1381 #define dev_alert_ratelimited(dev, fmt, ...) \ 1382 dev_level_ratelimited(dev_alert, dev, fmt, ##__VA_ARGS__) 1383 #define dev_crit_ratelimited(dev, fmt, ...) \ 1384 dev_level_ratelimited(dev_crit, dev, fmt, ##__VA_ARGS__) 1385 #define dev_err_ratelimited(dev, fmt, ...) \ 1386 dev_level_ratelimited(dev_err, dev, fmt, ##__VA_ARGS__) 1387 #define dev_warn_ratelimited(dev, fmt, ...) \ 1388 dev_level_ratelimited(dev_warn, dev, fmt, ##__VA_ARGS__) 1389 #define dev_notice_ratelimited(dev, fmt, ...) \ 1390 dev_level_ratelimited(dev_notice, dev, fmt, ##__VA_ARGS__) 1391 #define dev_info_ratelimited(dev, fmt, ...) \ 1392 dev_level_ratelimited(dev_info, dev, fmt, ##__VA_ARGS__) 1393 #if defined(CONFIG_DYNAMIC_DEBUG) 1394 /* descriptor check is first to prevent flooding with "callbacks suppressed" */ 1395 #define dev_dbg_ratelimited(dev, fmt, ...) \ 1396 do { \ 1397 static DEFINE_RATELIMIT_STATE(_rs, \ 1398 DEFAULT_RATELIMIT_INTERVAL, \ 1399 DEFAULT_RATELIMIT_BURST); \ 1400 DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ 1401 if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT) && \ 1402 __ratelimit(&_rs)) \ 1403 __dynamic_dev_dbg(&descriptor, dev, fmt, \ 1404 ##__VA_ARGS__); \ 1405 } while (0) 1406 #elif defined(DEBUG) 1407 #define dev_dbg_ratelimited(dev, fmt, ...) \ 1408 do { \ 1409 static DEFINE_RATELIMIT_STATE(_rs, \ 1410 DEFAULT_RATELIMIT_INTERVAL, \ 1411 DEFAULT_RATELIMIT_BURST); \ 1412 if (__ratelimit(&_rs)) \ 1413 dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); \ 1414 } while (0) 1415 #else 1416 #define dev_dbg_ratelimited(dev, fmt, ...) \ 1417 do { \ 1418 if (0) \ 1419 dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); \ 1420 } while (0) 1421 #endif 1422 1423 #ifdef VERBOSE_DEBUG 1424 #define dev_vdbg dev_dbg 1425 #else 1426 #define dev_vdbg(dev, format, arg...) \ 1427 ({ \ 1428 if (0) \ 1429 dev_printk(KERN_DEBUG, dev, format, ##arg); \ 1430 }) 1431 #endif 1432 1433 /* 1434 * dev_WARN*() acts like dev_printk(), but with the key difference of 1435 * using WARN/WARN_ONCE to include file/line information and a backtrace. 1436 */ 1437 #define dev_WARN(dev, format, arg...) \ 1438 WARN(1, "%s %s: " format, dev_driver_string(dev), dev_name(dev), ## arg); 1439 1440 #define dev_WARN_ONCE(dev, condition, format, arg...) \ 1441 WARN_ONCE(condition, "%s %s: " format, \ 1442 dev_driver_string(dev), dev_name(dev), ## arg) 1443 1444 /* Create alias, so I can be autoloaded. */ 1445 #define MODULE_ALIAS_CHARDEV(major,minor) \ 1446 MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor)) 1447 #define MODULE_ALIAS_CHARDEV_MAJOR(major) \ 1448 MODULE_ALIAS("char-major-" __stringify(major) "-*") 1449 1450 #ifdef CONFIG_SYSFS_DEPRECATED 1451 extern long sysfs_deprecated; 1452 #else 1453 #define sysfs_deprecated 0 1454 #endif 1455 1456 /** 1457 * module_driver() - Helper macro for drivers that don't do anything 1458 * special in module init/exit. This eliminates a lot of boilerplate. 1459 * Each module may only use this macro once, and calling it replaces 1460 * module_init() and module_exit(). 1461 * 1462 * @__driver: driver name 1463 * @__register: register function for this driver type 1464 * @__unregister: unregister function for this driver type 1465 * @...: Additional arguments to be passed to __register and __unregister. 1466 * 1467 * Use this macro to construct bus specific macros for registering 1468 * drivers, and do not use it on its own. 1469 */ 1470 #define module_driver(__driver, __register, __unregister, ...) \ 1471 static int __init __driver##_init(void) \ 1472 { \ 1473 return __register(&(__driver) , ##__VA_ARGS__); \ 1474 } \ 1475 module_init(__driver##_init); \ 1476 static void __exit __driver##_exit(void) \ 1477 { \ 1478 __unregister(&(__driver) , ##__VA_ARGS__); \ 1479 } \ 1480 module_exit(__driver##_exit); 1481 1482 /** 1483 * builtin_driver() - Helper macro for drivers that don't do anything 1484 * special in init and have no exit. This eliminates some boilerplate. 1485 * Each driver may only use this macro once, and calling it replaces 1486 * device_initcall (or in some cases, the legacy __initcall). This is 1487 * meant to be a direct parallel of module_driver() above but without 1488 * the __exit stuff that is not used for builtin cases. 1489 * 1490 * @__driver: driver name 1491 * @__register: register function for this driver type 1492 * @...: Additional arguments to be passed to __register 1493 * 1494 * Use this macro to construct bus specific macros for registering 1495 * drivers, and do not use it on its own. 1496 */ 1497 #define builtin_driver(__driver, __register, ...) \ 1498 static int __init __driver##_init(void) \ 1499 { \ 1500 return __register(&(__driver) , ##__VA_ARGS__); \ 1501 } \ 1502 device_initcall(__driver##_init); 1503 1504 #endif /* _DEVICE_H_ */
1 /* 2 * ioport.h Definitions of routines for detecting, reserving and 3 * allocating system resources. 4 * 5 * Authors: Linus Torvalds 6 */ 7 8 #ifndef _LINUX_IOPORT_H 9 #define _LINUX_IOPORT_H 10 11 #ifndef __ASSEMBLY__ 12 #include <linux/compiler.h> 13 #include <linux/types.h> 14 /* 15 * Resources are tree-like, allowing 16 * nesting etc.. 17 */ 18 struct resource { 19 resource_size_t start; 20 resource_size_t end; 21 const char *name; 22 unsigned long flags; 23 unsigned long desc; 24 struct resource *parent, *sibling, *child; 25 }; 26 27 /* 28 * IO resources have these defined flags. 29 * 30 * PCI devices expose these flags to userspace in the "resource" sysfs file, 31 * so don't move them. 32 */ 33 #define IORESOURCE_BITS 0x000000ff /* Bus-specific bits */ 34 35 #define IORESOURCE_TYPE_BITS 0x00001f00 /* Resource type */ 36 #define IORESOURCE_IO 0x00000100 /* PCI/ISA I/O ports */ 37 #define IORESOURCE_MEM 0x00000200 38 #define IORESOURCE_REG 0x00000300 /* Register offsets */ 39 #define IORESOURCE_IRQ 0x00000400 40 #define IORESOURCE_DMA 0x00000800 41 #define IORESOURCE_BUS 0x00001000 42 43 #define IORESOURCE_PREFETCH 0x00002000 /* No side effects */ 44 #define IORESOURCE_READONLY 0x00004000 45 #define IORESOURCE_CACHEABLE 0x00008000 46 #define IORESOURCE_RANGELENGTH 0x00010000 47 #define IORESOURCE_SHADOWABLE 0x00020000 48 49 #define IORESOURCE_SIZEALIGN 0x00040000 /* size indicates alignment */ 50 #define IORESOURCE_STARTALIGN 0x00080000 /* start field is alignment */ 51 52 #define IORESOURCE_MEM_64 0x00100000 53 #define IORESOURCE_WINDOW 0x00200000 /* forwarded by bridge */ 54 #define IORESOURCE_MUXED 0x00400000 /* Resource is software muxed */ 55 56 #define IORESOURCE_EXT_TYPE_BITS 0x01000000 /* Resource extended types */ 57 #define IORESOURCE_SYSRAM 0x01000000 /* System RAM (modifier) */ 58 59 #define IORESOURCE_EXCLUSIVE 0x08000000 /* Userland may not map this resource */ 60 61 #define IORESOURCE_DISABLED 0x10000000 62 #define IORESOURCE_UNSET 0x20000000 /* No address assigned yet */ 63 #define IORESOURCE_AUTO 0x40000000 64 #define IORESOURCE_BUSY 0x80000000 /* Driver has marked this resource busy */ 65 66 /* I/O resource extended types */ 67 #define IORESOURCE_SYSTEM_RAM (IORESOURCE_MEM|IORESOURCE_SYSRAM) 68 69 /* PnP IRQ specific bits (IORESOURCE_BITS) */ 70 #define IORESOURCE_IRQ_HIGHEDGE (1<<0) 71 #define IORESOURCE_IRQ_LOWEDGE (1<<1) 72 #define IORESOURCE_IRQ_HIGHLEVEL (1<<2) 73 #define IORESOURCE_IRQ_LOWLEVEL (1<<3) 74 #define IORESOURCE_IRQ_SHAREABLE (1<<4) 75 #define IORESOURCE_IRQ_OPTIONAL (1<<5) 76 77 /* PnP DMA specific bits (IORESOURCE_BITS) */ 78 #define IORESOURCE_DMA_TYPE_MASK (3<<0) 79 #define IORESOURCE_DMA_8BIT (0<<0) 80 #define IORESOURCE_DMA_8AND16BIT (1<<0) 81 #define IORESOURCE_DMA_16BIT (2<<0) 82 83 #define IORESOURCE_DMA_MASTER (1<<2) 84 #define IORESOURCE_DMA_BYTE (1<<3) 85 #define IORESOURCE_DMA_WORD (1<<4) 86 87 #define IORESOURCE_DMA_SPEED_MASK (3<<6) 88 #define IORESOURCE_DMA_COMPATIBLE (0<<6) 89 #define IORESOURCE_DMA_TYPEA (1<<6) 90 #define IORESOURCE_DMA_TYPEB (2<<6) 91 #define IORESOURCE_DMA_TYPEF (3<<6) 92 93 /* PnP memory I/O specific bits (IORESOURCE_BITS) */ 94 #define IORESOURCE_MEM_WRITEABLE (1<<0) /* dup: IORESOURCE_READONLY */ 95 #define IORESOURCE_MEM_CACHEABLE (1<<1) /* dup: IORESOURCE_CACHEABLE */ 96 #define IORESOURCE_MEM_RANGELENGTH (1<<2) /* dup: IORESOURCE_RANGELENGTH */ 97 #define IORESOURCE_MEM_TYPE_MASK (3<<3) 98 #define IORESOURCE_MEM_8BIT (0<<3) 99 #define IORESOURCE_MEM_16BIT (1<<3) 100 #define IORESOURCE_MEM_8AND16BIT (2<<3) 101 #define IORESOURCE_MEM_32BIT (3<<3) 102 #define IORESOURCE_MEM_SHADOWABLE (1<<5) /* dup: IORESOURCE_SHADOWABLE */ 103 #define IORESOURCE_MEM_EXPANSIONROM (1<<6) 104 105 /* PnP I/O specific bits (IORESOURCE_BITS) */ 106 #define IORESOURCE_IO_16BIT_ADDR (1<<0) 107 #define IORESOURCE_IO_FIXED (1<<1) 108 #define IORESOURCE_IO_SPARSE (1<<2) 109 110 /* PCI ROM control bits (IORESOURCE_BITS) */ 111 #define IORESOURCE_ROM_ENABLE (1<<0) /* ROM is enabled, same as PCI_ROM_ADDRESS_ENABLE */ 112 #define IORESOURCE_ROM_SHADOW (1<<1) /* Use RAM image, not ROM BAR */ 113 114 /* PCI control bits. Shares IORESOURCE_BITS with above PCI ROM. */ 115 #define IORESOURCE_PCI_FIXED (1<<4) /* Do not move resource */ 116 #define IORESOURCE_PCI_EA_BEI (1<<5) /* BAR Equivalent Indicator */ 117 118 /* 119 * I/O Resource Descriptors 120 * 121 * Descriptors are used by walk_iomem_res_desc() and region_intersects() 122 * for searching a specific resource range in the iomem table. Assign 123 * a new descriptor when a resource range supports the search interfaces. 124 * Otherwise, resource.desc must be set to IORES_DESC_NONE (0). 125 */ 126 enum { 127 IORES_DESC_NONE = 0, 128 IORES_DESC_CRASH_KERNEL = 1, 129 IORES_DESC_ACPI_TABLES = 2, 130 IORES_DESC_ACPI_NV_STORAGE = 3, 131 IORES_DESC_PERSISTENT_MEMORY = 4, 132 IORES_DESC_PERSISTENT_MEMORY_LEGACY = 5, 133 }; 134 135 /* helpers to define resources */ 136 #define DEFINE_RES_NAMED(_start, _size, _name, _flags) \ 137 { \ 138 .start = (_start), \ 139 .end = (_start) + (_size) - 1, \ 140 .name = (_name), \ 141 .flags = (_flags), \ 142 .desc = IORES_DESC_NONE, \ 143 } 144 145 #define DEFINE_RES_IO_NAMED(_start, _size, _name) \ 146 DEFINE_RES_NAMED((_start), (_size), (_name), IORESOURCE_IO) 147 #define DEFINE_RES_IO(_start, _size) \ 148 DEFINE_RES_IO_NAMED((_start), (_size), NULL) 149 150 #define DEFINE_RES_MEM_NAMED(_start, _size, _name) \ 151 DEFINE_RES_NAMED((_start), (_size), (_name), IORESOURCE_MEM) 152 #define DEFINE_RES_MEM(_start, _size) \ 153 DEFINE_RES_MEM_NAMED((_start), (_size), NULL) 154 155 #define DEFINE_RES_IRQ_NAMED(_irq, _name) \ 156 DEFINE_RES_NAMED((_irq), 1, (_name), IORESOURCE_IRQ) 157 #define DEFINE_RES_IRQ(_irq) \ 158 DEFINE_RES_IRQ_NAMED((_irq), NULL) 159 160 #define DEFINE_RES_DMA_NAMED(_dma, _name) \ 161 DEFINE_RES_NAMED((_dma), 1, (_name), IORESOURCE_DMA) 162 #define DEFINE_RES_DMA(_dma) \ 163 DEFINE_RES_DMA_NAMED((_dma), NULL) 164 165 /* PC/ISA/whatever - the normal PC address spaces: IO and memory */ 166 extern struct resource ioport_resource; 167 extern struct resource iomem_resource; 168 169 extern struct resource *request_resource_conflict(struct resource *root, struct resource *new); 170 extern int request_resource(struct resource *root, struct resource *new); 171 extern int release_resource(struct resource *new); 172 void release_child_resources(struct resource *new); 173 extern void reserve_region_with_split(struct resource *root, 174 resource_size_t start, resource_size_t end, 175 const char *name); 176 extern struct resource *insert_resource_conflict(struct resource *parent, struct resource *new); 177 extern int insert_resource(struct resource *parent, struct resource *new); 178 extern void insert_resource_expand_to_fit(struct resource *root, struct resource *new); 179 extern int remove_resource(struct resource *old); 180 extern void arch_remove_reservations(struct resource *avail); 181 extern int allocate_resource(struct resource *root, struct resource *new, 182 resource_size_t size, resource_size_t min, 183 resource_size_t max, resource_size_t align, 184 resource_size_t (*alignf)(void *, 185 const struct resource *, 186 resource_size_t, 187 resource_size_t), 188 void *alignf_data); 189 struct resource *lookup_resource(struct resource *root, resource_size_t start); 190 int adjust_resource(struct resource *res, resource_size_t start, 191 resource_size_t size); 192 resource_size_t resource_alignment(struct resource *res); 193 static inline resource_size_t resource_size(const struct resource *res) 194 { 195 return res->end - res->start + 1; 196 } 197 static inline unsigned long resource_type(const struct resource *res) 198 { 199 return res->flags & IORESOURCE_TYPE_BITS; 200 } 201 static inline unsigned long resource_ext_type(const struct resource *res) 202 { 203 return res->flags & IORESOURCE_EXT_TYPE_BITS; 204 } 205 /* True iff r1 completely contains r2 */ 206 static inline bool resource_contains(struct resource *r1, struct resource *r2) 207 { 208 if (resource_type(r1) != resource_type(r2)) 209 return false; 210 if (r1->flags & IORESOURCE_UNSET || r2->flags & IORESOURCE_UNSET) 211 return false; 212 return r1->start <= r2->start && r1->end >= r2->end; 213 } 214 215 216 /* Convenience shorthand with allocation */ 217 #define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name), 0) 218 #define request_muxed_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name), IORESOURCE_MUXED) 219 #define __request_mem_region(start,n,name, excl) __request_region(&iomem_resource, (start), (n), (name), excl) 220 #define request_mem_region(start,n,name) __request_region(&iomem_resource, (start), (n), (name), 0) 221 #define request_mem_region_exclusive(start,n,name) \ 222 __request_region(&iomem_resource, (start), (n), (name), IORESOURCE_EXCLUSIVE) 223 #define rename_region(region, newname) do { (region)->name = (newname); } while (0) 224 225 extern struct resource * __request_region(struct resource *, 226 resource_size_t start, 227 resource_size_t n, 228 const char *name, int flags); 229 230 /* Compatibility cruft */ 231 #define release_region(start,n) __release_region(&ioport_resource, (start), (n)) 232 #define release_mem_region(start,n) __release_region(&iomem_resource, (start), (n)) 233 234 extern void __release_region(struct resource *, resource_size_t, 235 resource_size_t); 236 #ifdef CONFIG_MEMORY_HOTREMOVE 237 extern int release_mem_region_adjustable(struct resource *, resource_size_t, 238 resource_size_t); 239 #endif 240 241 /* Wrappers for managed devices */ 242 struct device; 243 244 extern int devm_request_resource(struct device *dev, struct resource *root, 245 struct resource *new); 246 extern void devm_release_resource(struct device *dev, struct resource *new); 247 248 #define devm_request_region(dev,start,n,name) \ 249 __devm_request_region(dev, &ioport_resource, (start), (n), (name)) 250 #define devm_request_mem_region(dev,start,n,name) \ 251 __devm_request_region(dev, &iomem_resource, (start), (n), (name)) 252 253 extern struct resource * __devm_request_region(struct device *dev, 254 struct resource *parent, resource_size_t start, 255 resource_size_t n, const char *name); 256 257 #define devm_release_region(dev, start, n) \ 258 __devm_release_region(dev, &ioport_resource, (start), (n)) 259 #define devm_release_mem_region(dev, start, n) \ 260 __devm_release_region(dev, &iomem_resource, (start), (n)) 261 262 extern void __devm_release_region(struct device *dev, struct resource *parent, 263 resource_size_t start, resource_size_t n); 264 extern int iomem_map_sanity_check(resource_size_t addr, unsigned long size); 265 extern int iomem_is_exclusive(u64 addr); 266 267 extern int 268 walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages, 269 void *arg, int (*func)(unsigned long, unsigned long, void *)); 270 extern int 271 walk_system_ram_res(u64 start, u64 end, void *arg, 272 int (*func)(u64, u64, void *)); 273 extern int 274 walk_iomem_res_desc(unsigned long desc, unsigned long flags, u64 start, u64 end, 275 void *arg, int (*func)(u64, u64, void *)); 276 277 /* True if any part of r1 overlaps r2 */ 278 static inline bool resource_overlaps(struct resource *r1, struct resource *r2) 279 { 280 return (r1->start <= r2->end && r1->end >= r2->start); 281 } 282 283 284 #endif /* __ASSEMBLY__ */ 285 #endif /* _LINUX_IOPORT_H */
1 #ifndef _LINUX_OF_H 2 #define _LINUX_OF_H 3 /* 4 * Definitions for talking to the Open Firmware PROM on 5 * Power Macintosh and other computers. 6 * 7 * Copyright (C) 1996-2005 Paul Mackerras. 8 * 9 * Updates for PPC64 by Peter Bergner & David Engebretsen, IBM Corp. 10 * Updates for SPARC64 by David S. Miller 11 * Derived from PowerPC and Sparc prom.h files by Stephen Rothwell, IBM Corp. 12 * 13 * This program is free software; you can redistribute it and/or 14 * modify it under the terms of the GNU General Public License 15 * as published by the Free Software Foundation; either version 16 * 2 of the License, or (at your option) any later version. 17 */ 18 #include <linux/types.h> 19 #include <linux/bitops.h> 20 #include <linux/errno.h> 21 #include <linux/kobject.h> 22 #include <linux/mod_devicetable.h> 23 #include <linux/spinlock.h> 24 #include <linux/topology.h> 25 #include <linux/notifier.h> 26 #include <linux/property.h> 27 #include <linux/list.h> 28 29 #include <asm/byteorder.h> 30 #include <asm/errno.h> 31 32 typedef u32 phandle; 33 typedef u32 ihandle; 34 35 struct property { 36 char *name; 37 int length; 38 void *value; 39 struct property *next; 40 unsigned long _flags; 41 unsigned int unique_id; 42 struct bin_attribute attr; 43 }; 44 45 #if defined(CONFIG_SPARC) 46 struct of_irq_controller; 47 #endif 48 49 struct device_node { 50 const char *name; 51 const char *type; 52 phandle phandle; 53 const char *full_name; 54 struct fwnode_handle fwnode; 55 56 struct property *properties; 57 struct property *deadprops; /* removed properties */ 58 struct device_node *parent; 59 struct device_node *child; 60 struct device_node *sibling; 61 struct kobject kobj; 62 unsigned long _flags; 63 void *data; 64 #if defined(CONFIG_SPARC) 65 const char *path_component_name; 66 unsigned int unique_id; 67 struct of_irq_controller *irq_trans; 68 #endif 69 }; 70 71 #define MAX_PHANDLE_ARGS 16 72 struct of_phandle_args { 73 struct device_node *np; 74 int args_count; 75 uint32_t args[MAX_PHANDLE_ARGS]; 76 }; 77 78 struct of_phandle_iterator { 79 /* Common iterator information */ 80 const char *cells_name; 81 int cell_count; 82 const struct device_node *parent; 83 84 /* List size information */ 85 const __be32 *list_end; 86 const __be32 *phandle_end; 87 88 /* Current position state */ 89 const __be32 *cur; 90 uint32_t cur_count; 91 phandle phandle; 92 struct device_node *node; 93 }; 94 95 struct of_reconfig_data { 96 struct device_node *dn; 97 struct property *prop; 98 struct property *old_prop; 99 }; 100 101 /* initialize a node */ 102 extern struct kobj_type of_node_ktype; 103 extern const struct fwnode_operations of_fwnode_ops; 104 static inline void of_node_init(struct device_node *node) 105 { 106 kobject_init(&node->kobj, &of_node_ktype); 107 node->fwnode.type = FWNODE_OF; 108 node->fwnode.ops = &of_fwnode_ops; 109 } 110 111 /* true when node is initialized */ 112 static inline int of_node_is_initialized(struct device_node *node) 113 { 114 return node && node->kobj.state_initialized; 115 } 116 117 /* true when node is attached (i.e. present on sysfs) */ 118 static inline int of_node_is_attached(struct device_node *node) 119 { 120 return node && node->kobj.state_in_sysfs; 121 } 122 123 #ifdef CONFIG_OF_DYNAMIC 124 extern struct device_node *of_node_get(struct device_node *node); 125 extern void of_node_put(struct device_node *node); 126 #else /* CONFIG_OF_DYNAMIC */ 127 /* Dummy ref counting routines - to be implemented later */ 128 static inline struct device_node *of_node_get(struct device_node *node) 129 { 130 return node; 131 } 132 static inline void of_node_put(struct device_node *node) { } 133 #endif /* !CONFIG_OF_DYNAMIC */ 134 135 /* Pointer for first entry in chain of all nodes. */ 136 extern struct device_node *of_root; 137 extern struct device_node *of_chosen; 138 extern struct device_node *of_aliases; 139 extern struct device_node *of_stdout; 140 extern raw_spinlock_t devtree_lock; 141 142 /* flag descriptions (need to be visible even when !CONFIG_OF) */ 143 #define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */ 144 #define OF_DETACHED 2 /* node has been detached from the device tree */ 145 #define OF_POPULATED 3 /* device already created for the node */ 146 #define OF_POPULATED_BUS 4 /* of_platform_populate recursed to children of this node */ 147 148 #define OF_BAD_ADDR ((u64)-1) 149 150 #ifdef CONFIG_OF 151 void of_core_init(void); 152 153 static inline bool is_of_node(const struct fwnode_handle *fwnode) 154 { 155 return !IS_ERR_OR_NULL(fwnode) && fwnode->type == FWNODE_OF; 156 } 157 158 #define to_of_node(__fwnode) \ 159 ({ \ 160 typeof(__fwnode) __to_of_node_fwnode = (__fwnode); \ 161 \ 162 is_of_node(__to_of_node_fwnode) ? \ 163 container_of(__to_of_node_fwnode, \ 164 struct device_node, fwnode) : \ 165 NULL; \ 166 }) 167 168 #define of_fwnode_handle(node) \ 169 ({ \ 170 typeof(node) __of_fwnode_handle_node = (node); \ 171 \ 172 __of_fwnode_handle_node ? \ 173 &__of_fwnode_handle_node->fwnode : NULL; \ 174 }) 175 176 static inline bool of_have_populated_dt(void) 177 { 178 return of_root != NULL; 179 } 180 181 static inline bool of_node_is_root(const struct device_node *node) 182 { 183 return node && (node->parent == NULL); 184 } 185 186 static inline int of_node_check_flag(struct device_node *n, unsigned long flag) 187 { 188 return test_bit(flag, &n->_flags); 189 } 190 191 static inline int of_node_test_and_set_flag(struct device_node *n, 192 unsigned long flag) 193 { 194 return test_and_set_bit(flag, &n->_flags); 195 } 196 197 static inline void of_node_set_flag(struct device_node *n, unsigned long flag) 198 { 199 set_bit(flag, &n->_flags); 200 } 201 202 static inline void of_node_clear_flag(struct device_node *n, unsigned long flag) 203 { 204 clear_bit(flag, &n->_flags); 205 } 206 207 static inline int of_property_check_flag(struct property *p, unsigned long flag) 208 { 209 return test_bit(flag, &p->_flags); 210 } 211 212 static inline void of_property_set_flag(struct property *p, unsigned long flag) 213 { 214 set_bit(flag, &p->_flags); 215 } 216 217 static inline void of_property_clear_flag(struct property *p, unsigned long flag) 218 { 219 clear_bit(flag, &p->_flags); 220 } 221 222 extern struct device_node *__of_find_all_nodes(struct device_node *prev); 223 extern struct device_node *of_find_all_nodes(struct device_node *prev); 224 225 /* 226 * OF address retrieval & translation 227 */ 228 229 /* Helper to read a big number; size is in cells (not bytes) */ 230 static inline u64 of_read_number(const __be32 *cell, int size) 231 { 232 u64 r = 0; 233 while (size--) 234 r = (r << 32) | be32_to_cpu(*(cell++)); 235 return r; 236 } 237 238 /* Like of_read_number, but we want an unsigned long result */ 239 static inline unsigned long of_read_ulong(const __be32 *cell, int size) 240 { 241 /* toss away upper bits if unsigned long is smaller than u64 */ 242 return of_read_number(cell, size); 243 } 244 245 #if defined(CONFIG_SPARC) 246 #include <asm/prom.h> 247 #endif 248 249 /* Default #address and #size cells. Allow arch asm/prom.h to override */ 250 #if !defined(OF_ROOT_NODE_ADDR_CELLS_DEFAULT) 251 #define OF_ROOT_NODE_ADDR_CELLS_DEFAULT 1 252 #define OF_ROOT_NODE_SIZE_CELLS_DEFAULT 1 253 #endif 254 255 #define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags) 256 #define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags) 257 258 static inline const char *of_node_full_name(const struct device_node *np) 259 { 260 return np ? np->full_name : "<no-node>"; 261 } 262 263 #define for_each_of_allnodes_from(from, dn) \ 264 for (dn = __of_find_all_nodes(from); dn; dn = __of_find_all_nodes(dn)) 265 #define for_each_of_allnodes(dn) for_each_of_allnodes_from(NULL, dn) 266 extern struct device_node *of_find_node_by_name(struct device_node *from, 267 const char *name); 268 extern struct device_node *of_find_node_by_type(struct device_node *from, 269 const char *type); 270 extern struct device_node *of_find_compatible_node(struct device_node *from, 271 const char *type, const char *compat); 272 extern struct device_node *of_find_matching_node_and_match( 273 struct device_node *from, 274 const struct of_device_id *matches, 275 const struct of_device_id **match); 276 277 extern struct device_node *of_find_node_opts_by_path(const char *path, 278 const char **opts); 279 static inline struct device_node *of_find_node_by_path(const char *path) 280 { 281 return of_find_node_opts_by_path(path, NULL); 282 } 283 284 extern struct device_node *of_find_node_by_phandle(phandle handle); 285 extern struct device_node *of_get_parent(const struct device_node *node); 286 extern struct device_node *of_get_next_parent(struct device_node *node); 287 extern struct device_node *of_get_next_child(const struct device_node *node, 288 struct device_node *prev); 289 extern struct device_node *of_get_next_available_child( 290 const struct device_node *node, struct device_node *prev); 291 292 extern struct device_node *of_get_child_by_name(const struct device_node *node, 293 const char *name); 294 295 /* cache lookup */ 296 extern struct device_node *of_find_next_cache_node(const struct device_node *); 297 extern int of_find_last_cache_level(unsigned int cpu); 298 extern struct device_node *of_find_node_with_property( 299 struct device_node *from, const char *prop_name); 300 301 extern struct property *of_find_property(const struct device_node *np, 302 const char *name, 303 int *lenp); 304 extern int of_property_count_elems_of_size(const struct device_node *np, 305 const char *propname, int elem_size); 306 extern int of_property_read_u32_index(const struct device_node *np, 307 const char *propname, 308 u32 index, u32 *out_value); 309 extern int of_property_read_u64_index(const struct device_node *np, 310 const char *propname, 311 u32 index, u64 *out_value); 312 extern int of_property_read_variable_u8_array(const struct device_node *np, 313 const char *propname, u8 *out_values, 314 size_t sz_min, size_t sz_max); 315 extern int of_property_read_variable_u16_array(const struct device_node *np, 316 const char *propname, u16 *out_values, 317 size_t sz_min, size_t sz_max); 318 extern int of_property_read_variable_u32_array(const struct device_node *np, 319 const char *propname, 320 u32 *out_values, 321 size_t sz_min, 322 size_t sz_max); 323 extern int of_property_read_u64(const struct device_node *np, 324 const char *propname, u64 *out_value); 325 extern int of_property_read_variable_u64_array(const struct device_node *np, 326 const char *propname, 327 u64 *out_values, 328 size_t sz_min, 329 size_t sz_max); 330 331 extern int of_property_read_string(const struct device_node *np, 332 const char *propname, 333 const char **out_string); 334 extern int of_property_match_string(const struct device_node *np, 335 const char *propname, 336 const char *string); 337 extern int of_property_read_string_helper(const struct device_node *np, 338 const char *propname, 339 const char **out_strs, size_t sz, int index); 340 extern int of_device_is_compatible(const struct device_node *device, 341 const char *); 342 extern int of_device_compatible_match(struct device_node *device, 343 const char *const *compat); 344 extern bool of_device_is_available(const struct device_node *device); 345 extern bool of_device_is_big_endian(const struct device_node *device); 346 extern const void *of_get_property(const struct device_node *node, 347 const char *name, 348 int *lenp); 349 extern struct device_node *of_get_cpu_node(int cpu, unsigned int *thread); 350 #define for_each_property_of_node(dn, pp) \ 351 for (pp = dn->properties; pp != NULL; pp = pp->next) 352 353 extern int of_n_addr_cells(struct device_node *np); 354 extern int of_n_size_cells(struct device_node *np); 355 extern const struct of_device_id *of_match_node( 356 const struct of_device_id *matches, const struct device_node *node); 357 extern int of_modalias_node(struct device_node *node, char *modalias, int len); 358 extern void of_print_phandle_args(const char *msg, const struct of_phandle_args *args); 359 extern struct device_node *of_parse_phandle(const struct device_node *np, 360 const char *phandle_name, 361 int index); 362 extern int of_parse_phandle_with_args(const struct device_node *np, 363 const char *list_name, const char *cells_name, int index, 364 struct of_phandle_args *out_args); 365 extern int of_parse_phandle_with_fixed_args(const struct device_node *np, 366 const char *list_name, int cells_count, int index, 367 struct of_phandle_args *out_args); 368 extern int of_count_phandle_with_args(const struct device_node *np, 369 const char *list_name, const char *cells_name); 370 371 /* phandle iterator functions */ 372 extern int of_phandle_iterator_init(struct of_phandle_iterator *it, 373 const struct device_node *np, 374 const char *list_name, 375 const char *cells_name, 376 int cell_count); 377 378 extern int of_phandle_iterator_next(struct of_phandle_iterator *it); 379 extern int of_phandle_iterator_args(struct of_phandle_iterator *it, 380 uint32_t *args, 381 int size); 382 383 extern void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align)); 384 extern int of_alias_get_id(struct device_node *np, const char *stem); 385 extern int of_alias_get_highest_id(const char *stem); 386 387 extern int of_machine_is_compatible(const char *compat); 388 389 extern int of_add_property(struct device_node *np, struct property *prop); 390 extern int of_remove_property(struct device_node *np, struct property *prop); 391 extern int of_update_property(struct device_node *np, struct property *newprop); 392 393 /* For updating the device tree at runtime */ 394 #define OF_RECONFIG_ATTACH_NODE 0x0001 395 #define OF_RECONFIG_DETACH_NODE 0x0002 396 #define OF_RECONFIG_ADD_PROPERTY 0x0003 397 #define OF_RECONFIG_REMOVE_PROPERTY 0x0004 398 #define OF_RECONFIG_UPDATE_PROPERTY 0x0005 399 400 extern int of_attach_node(struct device_node *); 401 extern int of_detach_node(struct device_node *); 402 403 #define of_match_ptr(_ptr) (_ptr) 404 405 /** 406 * of_property_read_u8_array - Find and read an array of u8 from a property. 407 * 408 * @np: device node from which the property value is to be read. 409 * @propname: name of the property to be searched. 410 * @out_values: pointer to return value, modified only if return value is 0. 411 * @sz: number of array elements to read 412 * 413 * Search for a property in a device node and read 8-bit value(s) from 414 * it. Returns 0 on success, -EINVAL if the property does not exist, 415 * -ENODATA if property does not have a value, and -EOVERFLOW if the 416 * property data isn't large enough. 417 * 418 * dts entry of array should be like: 419 * property = /bits/ 8 <0x50 0x60 0x70>; 420 * 421 * The out_values is modified only if a valid u8 value can be decoded. 422 */ 423 static inline int of_property_read_u8_array(const struct device_node *np, 424 const char *propname, 425 u8 *out_values, size_t sz) 426 { 427 int ret = of_property_read_variable_u8_array(np, propname, out_values, 428 sz, 0); 429 if (ret >= 0) 430 return 0; 431 else 432 return ret; 433 } 434 435 /** 436 * of_property_read_u16_array - Find and read an array of u16 from a property. 437 * 438 * @np: device node from which the property value is to be read. 439 * @propname: name of the property to be searched. 440 * @out_values: pointer to return value, modified only if return value is 0. 441 * @sz: number of array elements to read 442 * 443 * Search for a property in a device node and read 16-bit value(s) from 444 * it. Returns 0 on success, -EINVAL if the property does not exist, 445 * -ENODATA if property does not have a value, and -EOVERFLOW if the 446 * property data isn't large enough. 447 * 448 * dts entry of array should be like: 449 * property = /bits/ 16 <0x5000 0x6000 0x7000>; 450 * 451 * The out_values is modified only if a valid u16 value can be decoded. 452 */ 453 static inline int of_property_read_u16_array(const struct device_node *np, 454 const char *propname, 455 u16 *out_values, size_t sz) 456 { 457 int ret = of_property_read_variable_u16_array(np, propname, out_values, 458 sz, 0); 459 if (ret >= 0) 460 return 0; 461 else 462 return ret; 463 } 464 465 /** 466 * of_property_read_u32_array - Find and read an array of 32 bit integers 467 * from a property. 468 * 469 * @np: device node from which the property value is to be read. 470 * @propname: name of the property to be searched. 471 * @out_values: pointer to return value, modified only if return value is 0. 472 * @sz: number of array elements to read 473 * 474 * Search for a property in a device node and read 32-bit value(s) from 475 * it. Returns 0 on success, -EINVAL if the property does not exist, 476 * -ENODATA if property does not have a value, and -EOVERFLOW if the 477 * property data isn't large enough. 478 * 479 * The out_values is modified only if a valid u32 value can be decoded. 480 */ 481 static inline int of_property_read_u32_array(const struct device_node *np, 482 const char *propname, 483 u32 *out_values, size_t sz) 484 { 485 int ret = of_property_read_variable_u32_array(np, propname, out_values, 486 sz, 0); 487 if (ret >= 0) 488 return 0; 489 else 490 return ret; 491 } 492 493 /** 494 * of_property_read_u64_array - Find and read an array of 64 bit integers 495 * from a property. 496 * 497 * @np: device node from which the property value is to be read. 498 * @propname: name of the property to be searched. 499 * @out_values: pointer to return value, modified only if return value is 0. 500 * @sz: number of array elements to read 501 * 502 * Search for a property in a device node and read 64-bit value(s) from 503 * it. Returns 0 on success, -EINVAL if the property does not exist, 504 * -ENODATA if property does not have a value, and -EOVERFLOW if the 505 * property data isn't large enough. 506 * 507 * The out_values is modified only if a valid u64 value can be decoded. 508 */ 509 static inline int of_property_read_u64_array(const struct device_node *np, 510 const char *propname, 511 u64 *out_values, size_t sz) 512 { 513 int ret = of_property_read_variable_u64_array(np, propname, out_values, 514 sz, 0); 515 if (ret >= 0) 516 return 0; 517 else 518 return ret; 519 } 520 521 /* 522 * struct property *prop; 523 * const __be32 *p; 524 * u32 u; 525 * 526 * of_property_for_each_u32(np, "propname", prop, p, u) 527 * printk("U32 value: %x\n", u); 528 */ 529 const __be32 *of_prop_next_u32(struct property *prop, const __be32 *cur, 530 u32 *pu); 531 /* 532 * struct property *prop; 533 * const char *s; 534 * 535 * of_property_for_each_string(np, "propname", prop, s) 536 * printk("String value: %s\n", s); 537 */ 538 const char *of_prop_next_string(struct property *prop, const char *cur); 539 540 bool of_console_check(struct device_node *dn, char *name, int index); 541 542 #else /* CONFIG_OF */ 543 544 static inline void of_core_init(void) 545 { 546 } 547 548 static inline bool is_of_node(const struct fwnode_handle *fwnode) 549 { 550 return false; 551 } 552 553 static inline struct device_node *to_of_node(const struct fwnode_handle *fwnode) 554 { 555 return NULL; 556 } 557 558 static inline const char* of_node_full_name(const struct device_node *np) 559 { 560 return "<no-node>"; 561 } 562 563 static inline struct device_node *of_find_node_by_name(struct device_node *from, 564 const char *name) 565 { 566 return NULL; 567 } 568 569 static inline struct device_node *of_find_node_by_type(struct device_node *from, 570 const char *type) 571 { 572 return NULL; 573 } 574 575 static inline struct device_node *of_find_matching_node_and_match( 576 struct device_node *from, 577 const struct of_device_id *matches, 578 const struct of_device_id **match) 579 { 580 return NULL; 581 } 582 583 static inline struct device_node *of_find_node_by_path(const char *path) 584 { 585 return NULL; 586 } 587 588 static inline struct device_node *of_find_node_opts_by_path(const char *path, 589 const char **opts) 590 { 591 return NULL; 592 } 593 594 static inline struct device_node *of_find_node_by_phandle(phandle handle) 595 { 596 return NULL; 597 } 598 599 static inline struct device_node *of_get_parent(const struct device_node *node) 600 { 601 return NULL; 602 } 603 604 static inline struct device_node *of_get_next_child( 605 const struct device_node *node, struct device_node *prev) 606 { 607 return NULL; 608 } 609 610 static inline struct device_node *of_get_next_available_child( 611 const struct device_node *node, struct device_node *prev) 612 { 613 return NULL; 614 } 615 616 static inline struct device_node *of_find_node_with_property( 617 struct device_node *from, const char *prop_name) 618 { 619 return NULL; 620 } 621 622 #define of_fwnode_handle(node) NULL 623 624 static inline bool of_have_populated_dt(void) 625 { 626 return false; 627 } 628 629 static inline struct device_node *of_get_child_by_name( 630 const struct device_node *node, 631 const char *name) 632 { 633 return NULL; 634 } 635 636 static inline int of_device_is_compatible(const struct device_node *device, 637 const char *name) 638 { 639 return 0; 640 } 641 642 static inline int of_device_compatible_match(struct device_node *device, 643 const char *const *compat) 644 { 645 return 0; 646 } 647 648 static inline bool of_device_is_available(const struct device_node *device) 649 { 650 return false; 651 } 652 653 static inline bool of_device_is_big_endian(const struct device_node *device) 654 { 655 return false; 656 } 657 658 static inline struct property *of_find_property(const struct device_node *np, 659 const char *name, 660 int *lenp) 661 { 662 return NULL; 663 } 664 665 static inline struct device_node *of_find_compatible_node( 666 struct device_node *from, 667 const char *type, 668 const char *compat) 669 { 670 return NULL; 671 } 672 673 static inline int of_property_count_elems_of_size(const struct device_node *np, 674 const char *propname, int elem_size) 675 { 676 return -ENOSYS; 677 } 678 679 static inline int of_property_read_u32_index(const struct device_node *np, 680 const char *propname, u32 index, u32 *out_value) 681 { 682 return -ENOSYS; 683 } 684 685 static inline int of_property_read_u8_array(const struct device_node *np, 686 const char *propname, u8 *out_values, size_t sz) 687 { 688 return -ENOSYS; 689 } 690 691 static inline int of_property_read_u16_array(const struct device_node *np, 692 const char *propname, u16 *out_values, size_t sz) 693 { 694 return -ENOSYS; 695 } 696 697 static inline int of_property_read_u32_array(const struct device_node *np, 698 const char *propname, 699 u32 *out_values, size_t sz) 700 { 701 return -ENOSYS; 702 } 703 704 static inline int of_property_read_u64_array(const struct device_node *np, 705 const char *propname, 706 u64 *out_values, size_t sz) 707 { 708 return -ENOSYS; 709 } 710 711 static inline int of_property_read_string(const struct device_node *np, 712 const char *propname, 713 const char **out_string) 714 { 715 return -ENOSYS; 716 } 717 718 static inline int of_property_read_string_helper(const struct device_node *np, 719 const char *propname, 720 const char **out_strs, size_t sz, int index) 721 { 722 return -ENOSYS; 723 } 724 725 static inline const void *of_get_property(const struct device_node *node, 726 const char *name, 727 int *lenp) 728 { 729 return NULL; 730 } 731 732 static inline struct device_node *of_get_cpu_node(int cpu, 733 unsigned int *thread) 734 { 735 return NULL; 736 } 737 738 static inline int of_property_read_u64(const struct device_node *np, 739 const char *propname, u64 *out_value) 740 { 741 return -ENOSYS; 742 } 743 744 static inline int of_property_match_string(const struct device_node *np, 745 const char *propname, 746 const char *string) 747 { 748 return -ENOSYS; 749 } 750 751 static inline struct device_node *of_parse_phandle(const struct device_node *np, 752 const char *phandle_name, 753 int index) 754 { 755 return NULL; 756 } 757 758 static inline int of_parse_phandle_with_args(const struct device_node *np, 759 const char *list_name, 760 const char *cells_name, 761 int index, 762 struct of_phandle_args *out_args) 763 { 764 return -ENOSYS; 765 } 766 767 static inline int of_parse_phandle_with_fixed_args(const struct device_node *np, 768 const char *list_name, int cells_count, int index, 769 struct of_phandle_args *out_args) 770 { 771 return -ENOSYS; 772 } 773 774 static inline int of_count_phandle_with_args(struct device_node *np, 775 const char *list_name, 776 const char *cells_name) 777 { 778 return -ENOSYS; 779 } 780 781 static inline int of_phandle_iterator_init(struct of_phandle_iterator *it, 782 const struct device_node *np, 783 const char *list_name, 784 const char *cells_name, 785 int cell_count) 786 { 787 return -ENOSYS; 788 } 789 790 static inline int of_phandle_iterator_next(struct of_phandle_iterator *it) 791 { 792 return -ENOSYS; 793 } 794 795 static inline int of_phandle_iterator_args(struct of_phandle_iterator *it, 796 uint32_t *args, 797 int size) 798 { 799 return 0; 800 } 801 802 static inline int of_alias_get_id(struct device_node *np, const char *stem) 803 { 804 return -ENOSYS; 805 } 806 807 static inline int of_alias_get_highest_id(const char *stem) 808 { 809 return -ENOSYS; 810 } 811 812 static inline int of_machine_is_compatible(const char *compat) 813 { 814 return 0; 815 } 816 817 static inline bool of_console_check(const struct device_node *dn, const char *name, int index) 818 { 819 return false; 820 } 821 822 static inline const __be32 *of_prop_next_u32(struct property *prop, 823 const __be32 *cur, u32 *pu) 824 { 825 return NULL; 826 } 827 828 static inline const char *of_prop_next_string(struct property *prop, 829 const char *cur) 830 { 831 return NULL; 832 } 833 834 static inline int of_node_check_flag(struct device_node *n, unsigned long flag) 835 { 836 return 0; 837 } 838 839 static inline int of_node_test_and_set_flag(struct device_node *n, 840 unsigned long flag) 841 { 842 return 0; 843 } 844 845 static inline void of_node_set_flag(struct device_node *n, unsigned long flag) 846 { 847 } 848 849 static inline void of_node_clear_flag(struct device_node *n, unsigned long flag) 850 { 851 } 852 853 static inline int of_property_check_flag(struct property *p, unsigned long flag) 854 { 855 return 0; 856 } 857 858 static inline void of_property_set_flag(struct property *p, unsigned long flag) 859 { 860 } 861 862 static inline void of_property_clear_flag(struct property *p, unsigned long flag) 863 { 864 } 865 866 #define of_match_ptr(_ptr) NULL 867 #define of_match_node(_matches, _node) NULL 868 #endif /* CONFIG_OF */ 869 870 /* Default string compare functions, Allow arch asm/prom.h to override */ 871 #if !defined(of_compat_cmp) 872 #define of_compat_cmp(s1, s2, l) strcasecmp((s1), (s2)) 873 #define of_prop_cmp(s1, s2) strcmp((s1), (s2)) 874 #define of_node_cmp(s1, s2) strcasecmp((s1), (s2)) 875 #endif 876 877 #if defined(CONFIG_OF) && defined(CONFIG_NUMA) 878 extern int of_node_to_nid(struct device_node *np); 879 #else 880 static inline int of_node_to_nid(struct device_node *device) 881 { 882 return NUMA_NO_NODE; 883 } 884 #endif 885 886 #ifdef CONFIG_OF_NUMA 887 extern int of_numa_init(void); 888 #else 889 static inline int of_numa_init(void) 890 { 891 return -ENOSYS; 892 } 893 #endif 894 895 static inline struct device_node *of_find_matching_node( 896 struct device_node *from, 897 const struct of_device_id *matches) 898 { 899 return of_find_matching_node_and_match(from, matches, NULL); 900 } 901 902 /** 903 * of_property_count_u8_elems - Count the number of u8 elements in a property 904 * 905 * @np: device node from which the property value is to be read. 906 * @propname: name of the property to be searched. 907 * 908 * Search for a property in a device node and count the number of u8 elements 909 * in it. Returns number of elements on sucess, -EINVAL if the property does 910 * not exist or its length does not match a multiple of u8 and -ENODATA if the 911 * property does not have a value. 912 */ 913 static inline int of_property_count_u8_elems(const struct device_node *np, 914 const char *propname) 915 { 916 return of_property_count_elems_of_size(np, propname, sizeof(u8)); 917 } 918 919 /** 920 * of_property_count_u16_elems - Count the number of u16 elements in a property 921 * 922 * @np: device node from which the property value is to be read. 923 * @propname: name of the property to be searched. 924 * 925 * Search for a property in a device node and count the number of u16 elements 926 * in it. Returns number of elements on sucess, -EINVAL if the property does 927 * not exist or its length does not match a multiple of u16 and -ENODATA if the 928 * property does not have a value. 929 */ 930 static inline int of_property_count_u16_elems(const struct device_node *np, 931 const char *propname) 932 { 933 return of_property_count_elems_of_size(np, propname, sizeof(u16)); 934 } 935 936 /** 937 * of_property_count_u32_elems - Count the number of u32 elements in a property 938 * 939 * @np: device node from which the property value is to be read. 940 * @propname: name of the property to be searched. 941 * 942 * Search for a property in a device node and count the number of u32 elements 943 * in it. Returns number of elements on sucess, -EINVAL if the property does 944 * not exist or its length does not match a multiple of u32 and -ENODATA if the 945 * property does not have a value. 946 */ 947 static inline int of_property_count_u32_elems(const struct device_node *np, 948 const char *propname) 949 { 950 return of_property_count_elems_of_size(np, propname, sizeof(u32)); 951 } 952 953 /** 954 * of_property_count_u64_elems - Count the number of u64 elements in a property 955 * 956 * @np: device node from which the property value is to be read. 957 * @propname: name of the property to be searched. 958 * 959 * Search for a property in a device node and count the number of u64 elements 960 * in it. Returns number of elements on sucess, -EINVAL if the property does 961 * not exist or its length does not match a multiple of u64 and -ENODATA if the 962 * property does not have a value. 963 */ 964 static inline int of_property_count_u64_elems(const struct device_node *np, 965 const char *propname) 966 { 967 return of_property_count_elems_of_size(np, propname, sizeof(u64)); 968 } 969 970 /** 971 * of_property_read_string_array() - Read an array of strings from a multiple 972 * strings property. 973 * @np: device node from which the property value is to be read. 974 * @propname: name of the property to be searched. 975 * @out_strs: output array of string pointers. 976 * @sz: number of array elements to read. 977 * 978 * Search for a property in a device tree node and retrieve a list of 979 * terminated string values (pointer to data, not a copy) in that property. 980 * 981 * If @out_strs is NULL, the number of strings in the property is returned. 982 */ 983 static inline int of_property_read_string_array(const struct device_node *np, 984 const char *propname, const char **out_strs, 985 size_t sz) 986 { 987 return of_property_read_string_helper(np, propname, out_strs, sz, 0); 988 } 989 990 /** 991 * of_property_count_strings() - Find and return the number of strings from a 992 * multiple strings property. 993 * @np: device node from which the property value is to be read. 994 * @propname: name of the property to be searched. 995 * 996 * Search for a property in a device tree node and retrieve the number of null 997 * terminated string contain in it. Returns the number of strings on 998 * success, -EINVAL if the property does not exist, -ENODATA if property 999 * does not have a value, and -EILSEQ if the string is not null-terminated 1000 * within the length of the property data. 1001 */ 1002 static inline int of_property_count_strings(const struct device_node *np, 1003 const char *propname) 1004 { 1005 return of_property_read_string_helper(np, propname, NULL, 0, 0); 1006 } 1007 1008 /** 1009 * of_property_read_string_index() - Find and read a string from a multiple 1010 * strings property. 1011 * @np: device node from which the property value is to be read. 1012 * @propname: name of the property to be searched. 1013 * @index: index of the string in the list of strings 1014 * @out_string: pointer to null terminated return string, modified only if 1015 * return value is 0. 1016 * 1017 * Search for a property in a device tree node and retrieve a null 1018 * terminated string value (pointer to data, not a copy) in the list of strings 1019 * contained in that property. 1020 * Returns 0 on success, -EINVAL if the property does not exist, -ENODATA if 1021 * property does not have a value, and -EILSEQ if the string is not 1022 * null-terminated within the length of the property data. 1023 * 1024 * The out_string pointer is modified only if a valid string can be decoded. 1025 */ 1026 static inline int of_property_read_string_index(const struct device_node *np, 1027 const char *propname, 1028 int index, const char **output) 1029 { 1030 int rc = of_property_read_string_helper(np, propname, output, 1, index); 1031 return rc < 0 ? rc : 0; 1032 } 1033 1034 /** 1035 * of_property_read_bool - Findfrom a property 1036 * @np: device node from which the property value is to be read. 1037 * @propname: name of the property to be searched. 1038 * 1039 * Search for a property in a device node. 1040 * Returns true if the property exists false otherwise. 1041 */ 1042 static inline bool of_property_read_bool(const struct device_node *np, 1043 const char *propname) 1044 { 1045 struct property *prop = of_find_property(np, propname, NULL); 1046 1047 return prop ? true : false; 1048 } 1049 1050 static inline int of_property_read_u8(const struct device_node *np, 1051 const char *propname, 1052 u8 *out_value) 1053 { 1054 return of_property_read_u8_array(np, propname, out_value, 1); 1055 } 1056 1057 static inline int of_property_read_u16(const struct device_node *np, 1058 const char *propname, 1059 u16 *out_value) 1060 { 1061 return of_property_read_u16_array(np, propname, out_value, 1); 1062 } 1063 1064 static inline int of_property_read_u32(const struct device_node *np, 1065 const char *propname, 1066 u32 *out_value) 1067 { 1068 return of_property_read_u32_array(np, propname, out_value, 1); 1069 } 1070 1071 static inline int of_property_read_s32(const struct device_node *np, 1072 const char *propname, 1073 s32 *out_value) 1074 { 1075 return of_property_read_u32(np, propname, (u32*) out_value); 1076 } 1077 1078 #define of_for_each_phandle(it, err, np, ln, cn, cc) \ 1079 for (of_phandle_iterator_init((it), (np), (ln), (cn), (cc)), \ 1080 err = of_phandle_iterator_next(it); \ 1081 err == 0; \ 1082 err = of_phandle_iterator_next(it)) 1083 1084 #define of_property_for_each_u32(np, propname, prop, p, u) \ 1085 for (prop = of_find_property(np, propname, NULL), \ 1086 p = of_prop_next_u32(prop, NULL, &u); \ 1087 p; \ 1088 p = of_prop_next_u32(prop, p, &u)) 1089 1090 #define of_property_for_each_string(np, propname, prop, s) \ 1091 for (prop = of_find_property(np, propname, NULL), \ 1092 s = of_prop_next_string(prop, NULL); \ 1093 s; \ 1094 s = of_prop_next_string(prop, s)) 1095 1096 #define for_each_node_by_name(dn, name) \ 1097 for (dn = of_find_node_by_name(NULL, name); dn; \ 1098 dn = of_find_node_by_name(dn, name)) 1099 #define for_each_node_by_type(dn, type) \ 1100 for (dn = of_find_node_by_type(NULL, type); dn; \ 1101 dn = of_find_node_by_type(dn, type)) 1102 #define for_each_compatible_node(dn, type, compatible) \ 1103 for (dn = of_find_compatible_node(NULL, type, compatible); dn; \ 1104 dn = of_find_compatible_node(dn, type, compatible)) 1105 #define for_each_matching_node(dn, matches) \ 1106 for (dn = of_find_matching_node(NULL, matches); dn; \ 1107 dn = of_find_matching_node(dn, matches)) 1108 #define for_each_matching_node_and_match(dn, matches, match) \ 1109 for (dn = of_find_matching_node_and_match(NULL, matches, match); \ 1110 dn; dn = of_find_matching_node_and_match(dn, matches, match)) 1111 1112 #define for_each_child_of_node(parent, child) \ 1113 for (child = of_get_next_child(parent, NULL); child != NULL; \ 1114 child = of_get_next_child(parent, child)) 1115 #define for_each_available_child_of_node(parent, child) \ 1116 for (child = of_get_next_available_child(parent, NULL); child != NULL; \ 1117 child = of_get_next_available_child(parent, child)) 1118 1119 #define for_each_node_with_property(dn, prop_name) \ 1120 for (dn = of_find_node_with_property(NULL, prop_name); dn; \ 1121 dn = of_find_node_with_property(dn, prop_name)) 1122 1123 static inline int of_get_child_count(const struct device_node *np) 1124 { 1125 struct device_node *child; 1126 int num = 0; 1127 1128 for_each_child_of_node(np, child) 1129 num++; 1130 1131 return num; 1132 } 1133 1134 static inline int of_get_available_child_count(const struct device_node *np) 1135 { 1136 struct device_node *child; 1137 int num = 0; 1138 1139 for_each_available_child_of_node(np, child) 1140 num++; 1141 1142 return num; 1143 } 1144 1145 #if defined(CONFIG_OF) && !defined(MODULE) 1146 #define _OF_DECLARE(table, name, compat, fn, fn_type) \ 1147 static const struct of_device_id __of_table_##name \ 1148 __used __section(__##table##_of_table) \ 1149 = { .compatible = compat, \ 1150 .data = (fn == (fn_type)NULL) ? fn : fn } 1151 #else 1152 #define _OF_DECLARE(table, name, compat, fn, fn_type) \ 1153 static const struct of_device_id __of_table_##name \ 1154 __attribute__((unused)) \ 1155 = { .compatible = compat, \ 1156 .data = (fn == (fn_type)NULL) ? fn : fn } 1157 #endif 1158 1159 typedef int (*of_init_fn_2)(struct device_node *, struct device_node *); 1160 typedef int (*of_init_fn_1_ret)(struct device_node *); 1161 typedef void (*of_init_fn_1)(struct device_node *); 1162 1163 #define OF_DECLARE_1(table, name, compat, fn) \ 1164 _OF_DECLARE(table, name, compat, fn, of_init_fn_1) 1165 #define OF_DECLARE_1_RET(table, name, compat, fn) \ 1166 _OF_DECLARE(table, name, compat, fn, of_init_fn_1_ret) 1167 #define OF_DECLARE_2(table, name, compat, fn) \ 1168 _OF_DECLARE(table, name, compat, fn, of_init_fn_2) 1169 1170 /** 1171 * struct of_changeset_entry - Holds a changeset entry 1172 * 1173 * @node: list_head for the log list 1174 * @action: notifier action 1175 * @np: pointer to the device node affected 1176 * @prop: pointer to the property affected 1177 * @old_prop: hold a pointer to the original property 1178 * 1179 * Every modification of the device tree during a changeset 1180 * is held in a list of of_changeset_entry structures. 1181 * That way we can recover from a partial application, or we can 1182 * revert the changeset 1183 */ 1184 struct of_changeset_entry { 1185 struct list_head node; 1186 unsigned long action; 1187 struct device_node *np; 1188 struct property *prop; 1189 struct property *old_prop; 1190 }; 1191 1192 /** 1193 * struct of_changeset - changeset tracker structure 1194 * 1195 * @entries: list_head for the changeset entries 1196 * 1197 * changesets are a convenient way to apply bulk changes to the 1198 * live tree. In case of an error, changes are rolled-back. 1199 * changesets live on after initial application, and if not 1200 * destroyed after use, they can be reverted in one single call. 1201 */ 1202 struct of_changeset { 1203 struct list_head entries; 1204 }; 1205 1206 enum of_reconfig_change { 1207 OF_RECONFIG_NO_CHANGE = 0, 1208 OF_RECONFIG_CHANGE_ADD, 1209 OF_RECONFIG_CHANGE_REMOVE, 1210 }; 1211 1212 #ifdef CONFIG_OF_DYNAMIC 1213 extern int of_reconfig_notifier_register(struct notifier_block *); 1214 extern int of_reconfig_notifier_unregister(struct notifier_block *); 1215 extern int of_reconfig_notify(unsigned long, struct of_reconfig_data *rd); 1216 extern int of_reconfig_get_state_change(unsigned long action, 1217 struct of_reconfig_data *arg); 1218 1219 extern void of_changeset_init(struct of_changeset *ocs); 1220 extern void of_changeset_destroy(struct of_changeset *ocs); 1221 extern int of_changeset_apply(struct of_changeset *ocs); 1222 extern int of_changeset_revert(struct of_changeset *ocs); 1223 extern int of_changeset_action(struct of_changeset *ocs, 1224 unsigned long action, struct device_node *np, 1225 struct property *prop); 1226 1227 static inline int of_changeset_attach_node(struct of_changeset *ocs, 1228 struct device_node *np) 1229 { 1230 return of_changeset_action(ocs, OF_RECONFIG_ATTACH_NODE, np, NULL); 1231 } 1232 1233 static inline int of_changeset_detach_node(struct of_changeset *ocs, 1234 struct device_node *np) 1235 { 1236 return of_changeset_action(ocs, OF_RECONFIG_DETACH_NODE, np, NULL); 1237 } 1238 1239 static inline int of_changeset_add_property(struct of_changeset *ocs, 1240 struct device_node *np, struct property *prop) 1241 { 1242 return of_changeset_action(ocs, OF_RECONFIG_ADD_PROPERTY, np, prop); 1243 } 1244 1245 static inline int of_changeset_remove_property(struct of_changeset *ocs, 1246 struct device_node *np, struct property *prop) 1247 { 1248 return of_changeset_action(ocs, OF_RECONFIG_REMOVE_PROPERTY, np, prop); 1249 } 1250 1251 static inline int of_changeset_update_property(struct of_changeset *ocs, 1252 struct device_node *np, struct property *prop) 1253 { 1254 return of_changeset_action(ocs, OF_RECONFIG_UPDATE_PROPERTY, np, prop); 1255 } 1256 #else /* CONFIG_OF_DYNAMIC */ 1257 static inline int of_reconfig_notifier_register(struct notifier_block *nb) 1258 { 1259 return -EINVAL; 1260 } 1261 static inline int of_reconfig_notifier_unregister(struct notifier_block *nb) 1262 { 1263 return -EINVAL; 1264 } 1265 static inline int of_reconfig_notify(unsigned long action, 1266 struct of_reconfig_data *arg) 1267 { 1268 return -EINVAL; 1269 } 1270 static inline int of_reconfig_get_state_change(unsigned long action, 1271 struct of_reconfig_data *arg) 1272 { 1273 return -EINVAL; 1274 } 1275 #endif /* CONFIG_OF_DYNAMIC */ 1276 1277 /* CONFIG_OF_RESOLVE api */ 1278 extern int of_resolve_phandles(struct device_node *tree); 1279 1280 /** 1281 * of_device_is_system_power_controller - Tells if system-power-controller is found for device_node 1282 * @np: Pointer to the given device_node 1283 * 1284 * return true if present false otherwise 1285 */ 1286 static inline bool of_device_is_system_power_controller(const struct device_node *np) 1287 { 1288 return of_property_read_bool(np, "system-power-controller"); 1289 } 1290 1291 /** 1292 * Overlay support 1293 */ 1294 1295 enum of_overlay_notify_action { 1296 OF_OVERLAY_PRE_APPLY, 1297 OF_OVERLAY_POST_APPLY, 1298 OF_OVERLAY_PRE_REMOVE, 1299 OF_OVERLAY_POST_REMOVE, 1300 }; 1301 1302 struct of_overlay_notify_data { 1303 struct device_node *overlay; 1304 struct device_node *target; 1305 }; 1306 1307 #ifdef CONFIG_OF_OVERLAY 1308 1309 /* ID based overlays; the API for external users */ 1310 int of_overlay_create(struct device_node *tree); 1311 int of_overlay_destroy(int id); 1312 int of_overlay_destroy_all(void); 1313 1314 int of_overlay_notifier_register(struct notifier_block *nb); 1315 int of_overlay_notifier_unregister(struct notifier_block *nb); 1316 1317 #else 1318 1319 static inline int of_overlay_create(struct device_node *tree) 1320 { 1321 return -ENOTSUPP; 1322 } 1323 1324 static inline int of_overlay_destroy(int id) 1325 { 1326 return -ENOTSUPP; 1327 } 1328 1329 static inline int of_overlay_destroy_all(void) 1330 { 1331 return -ENOTSUPP; 1332 } 1333 1334 static inline int of_overlay_notifier_register(struct notifier_block *nb) 1335 { 1336 return 0; 1337 } 1338 1339 static inline int of_overlay_notifier_unregister(struct notifier_block *nb) 1340 { 1341 return 0; 1342 } 1343 1344 #endif 1345 1346 #endif /* _LINUX_OF_H */

Here is an explanation of a rule violation arisen while checking your driver against a corresponding kernel.

Note that it may be false positive, i.e. there isn't a real error indeed. Please analyze a given error trace and related source code to understand whether there is an error in your driver.

Error trace column contains a path on which the given rule is violated. You can expand/collapse some entity classes by clicking on corresponding checkboxes in a main menu or in an advanced Others menu. Also you can expand/collapse each particular entity by clicking on +/-. In hovering on some entities you can see some tips. Also the error trace is bound with related source code. Line numbers may be shown as links on the left. You can click on them to open corresponding lines in source code.

Source code column contains a content of files related with the error trace. There is source code of your driver (note that there are some LDV modifications at the end), kernel headers and rule model. Tabs show a currently opened file and other available files. In hovering on them you can see full file names. On clicking a corresponding file content will be shown.

Ядро Модуль Правило Верификатор Вердикт Статус Время создания Описание проблемы
linux-4.13-rc1 drivers/tty/serial/8250/8250_aspeed_vuart.ko 151_1a CPAchecker Bug Fixed 2017-07-28 22:17:22 L0284

Комментарий

Reported: 28 Jul 2017

[В начало]