Error Trace

[Home]

Bug # 158

Show/hide error trace
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;
280 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;
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 *); } ;
115 typedef void (*ctor_fn_t)();
259 struct _ddebug { const char *modname; const char *function; const char *filename; const char *format; unsigned int lineno; unsigned char flags; } ;
58 struct device ;
450 struct file_operations ;
462 struct completion ;
463 struct pt_regs ;
557 struct bug_entry { int bug_addr_disp; int file_disp; unsigned short line; unsigned short flags; } ;
114 struct timespec ;
115 struct compat_timespec ;
116 struct thread_info { unsigned long flags; } ;
20 struct __anonstruct_futex_25 { u32 *uaddr; u32 val; u32 flags; u32 bitset; u64 time; u32 *uaddr2; } ;
20 struct __anonstruct_nanosleep_26 { clockid_t clockid; struct timespec *rmtp; struct compat_timespec *compat_rmtp; u64 expires; } ;
20 struct pollfd ;
20 struct __anonstruct_poll_27 { struct pollfd *ufds; int nfds; int has_timeout; unsigned long tv_sec; unsigned long tv_nsec; } ;
20 union __anonunion____missing_field_name_24 { struct __anonstruct_futex_25 futex; struct __anonstruct_nanosleep_26 nanosleep; struct __anonstruct_poll_27 poll; } ;
20 struct restart_block { long int (*fn)(struct restart_block *); union __anonunion____missing_field_name_24 __annonCompField4; } ;
39 struct page ;
26 struct task_struct ;
27 struct mm_struct ;
288 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_30 { unsigned int a; unsigned int b; } ;
66 struct __anonstruct____missing_field_name_31 { 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_29 { struct __anonstruct____missing_field_name_30 __annonCompField5; struct __anonstruct____missing_field_name_31 __annonCompField6; } ;
66 struct desc_struct { union __anonunion____missing_field_name_29 __annonCompField7; } ;
13 typedef unsigned long pteval_t;
14 typedef unsigned long pmdval_t;
16 typedef unsigned long pgdval_t;
17 typedef unsigned long pgprotval_t;
19 struct __anonstruct_pte_t_32 { pteval_t pte; } ;
19 typedef struct __anonstruct_pte_t_32 pte_t;
21 struct pgprot { pgprotval_t pgprot; } ;
256 typedef struct pgprot pgprot_t;
258 struct __anonstruct_pgd_t_33 { pgdval_t pgd; } ;
258 typedef struct __anonstruct_pgd_t_33 pgd_t;
297 struct __anonstruct_pmd_t_35 { pmdval_t pmd; } ;
297 typedef struct __anonstruct_pmd_t_35 pmd_t;
423 typedef struct page *pgtable_t;
434 struct file ;
445 struct seq_file ;
481 struct thread_struct ;
483 struct cpumask ;
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;
247 struct math_emu_info { long ___orig_eip; struct pt_regs *regs; } ;
83 struct static_key { atomic_t enabled; } ;
23 typedef atomic64_t atomic_long_t;
359 struct cpumask { unsigned long bits[128U]; } ;
15 typedef struct cpumask cpumask_t;
654 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; void (*regfunc)(); void (*unregfunc)(); struct tracepoint_func *funcs; } ;
246 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_59 { u64 rip; u64 rdp; } ;
26 struct __anonstruct____missing_field_name_60 { u32 fip; u32 fcs; u32 foo; u32 fos; } ;
26 union __anonunion____missing_field_name_58 { struct __anonstruct____missing_field_name_59 __annonCompField13; struct __anonstruct____missing_field_name_60 __annonCompField14; } ;
26 union __anonunion____missing_field_name_61 { u32 padding1[12U]; u32 sw_reserved[12U]; } ;
26 struct fxregs_state { u16 cwd; u16 swd; u16 twd; u16 fop; union __anonunion____missing_field_name_58 __annonCompField15; u32 mxcsr; u32 mxcsr_mask; u32 st_space[32U]; u32 xmm_space[64U]; u32 padding[12U]; union __anonunion____missing_field_name_61 __annonCompField16; } ;
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; unsigned char counter; union fpregs_state state; } ;
169 struct seq_operations ;
372 struct perf_event ;
377 struct __anonstruct_mm_segment_t_73 { unsigned long seg; } ;
377 typedef struct __anonstruct_mm_segment_t_73 mm_segment_t;
378 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; } ;
33 struct lockdep_map ;
55 struct stack_trace { unsigned int nr_entries; unsigned int max_entries; unsigned long *entries; int skip; } ;
28 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; } ;
572 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_75 { u8 __padding[24U]; struct lockdep_map dep_map; } ;
33 union __anonunion____missing_field_name_74 { struct raw_spinlock rlock; struct __anonstruct____missing_field_name_75 __annonCompField19; } ;
33 struct spinlock { union __anonunion____missing_field_name_74 __annonCompField20; } ;
76 typedef struct spinlock spinlock_t;
23 struct __anonstruct_rwlock_t_76 { 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_76 rwlock_t;
416 struct seqcount { unsigned int sequence; struct lockdep_map dep_map; } ;
52 typedef struct seqcount seqcount_t;
407 struct __anonstruct_seqlock_t_91 { struct seqcount seqcount; spinlock_t lock; } ;
407 typedef struct __anonstruct_seqlock_t_91 seqlock_t;
601 struct timespec { __kernel_time_t tv_sec; long tv_nsec; } ;
7 typedef __s64 time64_t;
83 struct user_namespace ;
22 struct __anonstruct_kuid_t_92 { uid_t val; } ;
22 typedef struct __anonstruct_kuid_t_92 kuid_t;
27 struct __anonstruct_kgid_t_93 { gid_t val; } ;
27 typedef struct __anonstruct_kgid_t_93 kgid_t;
139 struct kstat { u64 ino; dev_t dev; umode_t mode; unsigned int nlink; kuid_t uid; kgid_t gid; dev_t rdev; loff_t size; struct timespec atime; struct timespec mtime; struct timespec ctime; unsigned long blksize; unsigned long long blocks; } ;
36 struct vm_area_struct ;
38 struct __wait_queue_head { spinlock_t lock; struct list_head task_list; } ;
43 typedef struct __wait_queue_head wait_queue_head_t;
97 struct __anonstruct_nodemask_t_94 { unsigned long bits[16U]; } ;
97 typedef struct __anonstruct_nodemask_t_94 nodemask_t;
249 typedef unsigned int isolate_mode_t;
13 struct optimistic_spin_queue { atomic_t tail; } ;
39 struct mutex { atomic_t count; spinlock_t wait_lock; struct list_head wait_list; struct task_struct *owner; void *magic; struct lockdep_map dep_map; } ;
67 struct mutex_waiter { struct list_head list; struct task_struct *task; void *magic; } ;
177 struct rw_semaphore ;
178 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 completion { unsigned int done; wait_queue_head_t wait; } ;
450 union ktime { s64 tv64; } ;
41 typedef union ktime ktime_t;
1145 struct timer_list { struct hlist_node entry; unsigned long expires; void (*function)(unsigned long); unsigned long data; u32 flags; int start_pid; void *start_site; char start_comm[16U]; struct lockdep_map lockdep_map; } ;
254 struct hrtimer ;
255 enum hrtimer_restart ;
256 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; } ;
835 struct nsproxy ;
278 struct workqueue_struct ;
279 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; } ;
268 struct notifier_block ;
53 struct notifier_block { int (*notifier_call)(struct notifier_block *, unsigned long, void *); struct notifier_block *next; int priority; } ;
217 struct resource ;
66 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; } ;
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 *); } ;
320 enum rpm_status { RPM_ACTIVE = 0, RPM_RESUMING = 1, RPM_SUSPENDED = 2, RPM_SUSPENDING = 3 } ;
327 enum rpm_request { RPM_REQ_NONE = 0, RPM_REQ_IDLE = 1, RPM_REQ_SUSPEND = 2, RPM_REQ_AUTOSUSPEND = 3, RPM_REQ_RESUME = 4 } ;
335 struct wakeup_source ;
336 struct wake_irq ;
337 struct pm_domain_data ;
338 struct pm_subsys_data { spinlock_t lock; unsigned int refcount; struct list_head clock_list; struct pm_domain_data *domain_data; } ;
556 struct dev_pm_qos ;
556 struct dev_pm_info { pm_message_t power_state; unsigned char can_wakeup; unsigned char async_suspend; 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 run_wake; 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; 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; } ;
616 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 *); } ;
34 struct ldt_struct ;
34 struct vdso_image ;
34 struct __anonstruct_mm_context_t_165 { 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; } ;
34 typedef struct __anonstruct_mm_context_t_165 mm_context_t;
1290 struct llist_node ;
64 struct llist_node { struct llist_node *next; } ;
37 struct cred ;
19 struct inode ;
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_211 { struct arch_uprobe_task autask; unsigned long vaddr; } ;
73 struct __anonstruct____missing_field_name_212 { struct callback_head dup_xol_work; unsigned long dup_xol_addr; } ;
73 union __anonunion____missing_field_name_210 { struct __anonstruct____missing_field_name_211 __annonCompField35; struct __anonstruct____missing_field_name_212 __annonCompField36; } ;
73 struct uprobe ;
73 struct return_instance ;
73 struct uprobe_task { enum uprobe_task_state state; union __anonunion____missing_field_name_210 __annonCompField37; struct uprobe *active_uprobe; unsigned long xol_vaddr; struct return_instance *return_instances; unsigned int depth; } ;
94 struct return_instance { struct uprobe *uprobe; unsigned long func; unsigned long stack; unsigned long orig_ret_vaddr; bool chained; struct return_instance *next; } ;
110 struct xol_area ;
111 struct uprobes_state { struct xol_area *xol_area; } ;
150 struct address_space ;
151 struct mem_cgroup ;
152 union __anonunion____missing_field_name_213 { struct address_space *mapping; void *s_mem; atomic_t compound_mapcount; } ;
152 union __anonunion____missing_field_name_214 { unsigned long index; void *freelist; } ;
152 struct __anonstruct____missing_field_name_218 { unsigned short inuse; unsigned short objects; unsigned char frozen; } ;
152 union __anonunion____missing_field_name_217 { atomic_t _mapcount; unsigned int active; struct __anonstruct____missing_field_name_218 __annonCompField40; int units; } ;
152 struct __anonstruct____missing_field_name_216 { union __anonunion____missing_field_name_217 __annonCompField41; atomic_t _refcount; } ;
152 union __anonunion____missing_field_name_215 { unsigned long counters; struct __anonstruct____missing_field_name_216 __annonCompField42; } ;
152 struct dev_pagemap ;
152 struct __anonstruct____missing_field_name_220 { struct page *next; int pages; int pobjects; } ;
152 struct __anonstruct____missing_field_name_221 { unsigned long compound_head; unsigned int compound_dtor; unsigned int compound_order; } ;
152 struct __anonstruct____missing_field_name_222 { unsigned long __pad; pgtable_t pmd_huge_pte; } ;
152 union __anonunion____missing_field_name_219 { struct list_head lru; struct dev_pagemap *pgmap; struct __anonstruct____missing_field_name_220 __annonCompField44; struct callback_head callback_head; struct __anonstruct____missing_field_name_221 __annonCompField45; struct __anonstruct____missing_field_name_222 __annonCompField46; } ;
152 struct kmem_cache ;
152 union __anonunion____missing_field_name_223 { unsigned long private; spinlock_t *ptl; struct kmem_cache *slab_cache; } ;
152 struct page { unsigned long flags; union __anonunion____missing_field_name_213 __annonCompField38; union __anonunion____missing_field_name_214 __annonCompField39; union __anonunion____missing_field_name_215 __annonCompField43; union __anonunion____missing_field_name_219 __annonCompField47; union __anonunion____missing_field_name_223 __annonCompField48; struct mem_cgroup *mem_cgroup; } ;
197 struct page_frag { struct page *page; __u32 offset; __u32 size; } ;
282 struct userfaultfd_ctx ;
282 struct vm_userfaultfd_ctx { struct userfaultfd_ctx *ctx; } ;
289 struct __anonstruct_shared_224 { struct rb_node rb; unsigned long rb_subtree_last; } ;
289 struct anon_vma ;
289 struct vm_operations_struct ;
289 struct mempolicy ;
289 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_224 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; } ;
362 struct core_thread { struct task_struct *task; struct core_thread *next; } ;
367 struct core_state { atomic_t nr_threads; struct core_thread dumper; struct completion startup; } ;
381 struct task_rss_stat { int events; int count[4U]; } ;
389 struct mm_rss_stat { atomic_long_t count[4U]; } ;
394 struct kioctx_table ;
395 struct linux_binfmt ;
395 struct mmu_notifier_mm ;
395 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 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 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; void *bd_addr; atomic_long_t hugetlb_usage; struct work_struct async_put_work; } ;
563 struct vm_fault ;
617 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_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;
53 union __anonunion____missing_field_name_229 { unsigned long bitmap[4U]; struct callback_head callback_head; } ;
53 struct idr_layer { int prefix; int layer; struct idr_layer *ary[256U]; int count; union __anonunion____missing_field_name_229 __annonCompField49; } ;
41 struct idr { struct idr_layer *hint; struct idr_layer *top; int layers; int cur; spinlock_t lock; int id_free_cnt; struct idr_layer *id_free; } ;
124 struct ida_bitmap { long nr_busy; unsigned long bitmap[15U]; } ;
167 struct ida { struct idr idr; struct ida_bitmap *free_bitmap; } ;
199 struct dentry ;
200 struct iattr ;
201 struct super_block ;
202 struct file_system_type ;
203 struct kernfs_open_node ;
204 struct kernfs_iattrs ;
227 struct kernfs_root ;
227 struct kernfs_elem_dir { unsigned long subdirs; struct rb_root children; struct kernfs_root *root; } ;
85 struct kernfs_node ;
85 struct kernfs_elem_symlink { struct kernfs_node *target_kn; } ;
89 struct kernfs_ops ;
89 struct kernfs_elem_attr { const struct kernfs_ops *ops; struct kernfs_open_node *open; loff_t size; struct kernfs_node *notify_next; } ;
96 union __anonunion____missing_field_name_234 { struct kernfs_elem_dir dir; struct kernfs_elem_symlink symlink; struct kernfs_elem_attr attr; } ;
96 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_234 __annonCompField50; void *priv; unsigned short flags; umode_t mode; unsigned int ino; struct kernfs_iattrs *iattr; } ;
138 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 *); } ;
157 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; } ;
173 struct kernfs_open_file { struct kernfs_node *kn; struct file *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; const struct vm_operations_struct *vm_ops; } ;
191 struct kernfs_ops { 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; } ;
511 struct sock ;
512 struct kobject ;
513 enum kobj_ns_type { KOBJ_NS_TYPE_NONE = 0, KOBJ_NS_TYPE_NET = 1, KOBJ_NS_TYPES = 2 } ;
519 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 *); } ;
59 struct bin_attribute ;
60 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 ); } ;
530 struct kref { atomic_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; } ;
115 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 *); } ;
123 struct kobj_uevent_env { char *argv[3U]; char *envp[32U]; int envp_idx; char buf[2048U]; int buflen; } ;
131 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 *); } ;
148 struct kset { struct list_head list; spinlock_t list_lock; struct kobject kobj; const struct kset_uevent_ops *uevent_ops; } ;
223 struct kernel_param ;
228 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 *); } ;
62 struct kparam_string ;
62 struct kparam_array ;
62 union __anonunion____missing_field_name_237 { void *arg; const struct kparam_string *str; const struct kparam_array *arr; } ;
62 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_237 __annonCompField51; } ;
83 struct kparam_string { unsigned int maxlen; char *string; } ;
89 struct kparam_array { unsigned int max; unsigned int elemsize; unsigned int *num; const struct kernel_param_ops *ops; void *elem; } ;
470 struct exception_table_entry ;
24 struct latch_tree_node { struct rb_node node[2U]; } ;
211 struct mod_arch_specific { } ;
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; } ;
50 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 *); } ;
277 enum module_state { MODULE_STATE_LIVE = 0, MODULE_STATE_COMING = 1, MODULE_STATE_GOING = 2, MODULE_STATE_UNFORMED = 3 } ;
284 struct mod_tree_node { struct module *mod; struct latch_tree_node node; } ;
291 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; } ;
307 struct mod_kallsyms { Elf64_Sym *symtab; unsigned int num_symtab; char *strtab; } ;
321 struct klp_modinfo { Elf64_Ehdr hdr; Elf64_Shdr *sechdrs; char *secstrings; unsigned int symndx; } ;
329 struct module_sect_attrs ;
329 struct module_notes_attrs ;
329 struct trace_event_call ;
329 struct trace_enum_map ;
329 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 unsigned long *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 unsigned long *gpl_crcs; const struct kernel_symbol *unused_syms; const unsigned long *unused_crcs; unsigned int num_unused_syms; unsigned int num_unused_gpl_syms; const struct kernel_symbol *unused_gpl_syms; const unsigned long *unused_gpl_crcs; bool sig_ok; bool async_probe_requested; const struct kernel_symbol *gpl_future_syms; const unsigned long *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 int 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_enum_map **trace_enums; unsigned int num_trace_enums; 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; } ;
799 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_287 { spinlock_t lock; int count; } ;
114 union __anonunion____missing_field_name_286 { struct __anonstruct____missing_field_name_287 __annonCompField52; } ;
114 struct lockref { union __anonunion____missing_field_name_286 __annonCompField53; } ;
77 struct path ;
78 struct vfsmount ;
79 struct __anonstruct____missing_field_name_289 { u32 hash; u32 len; } ;
79 union __anonunion____missing_field_name_288 { struct __anonstruct____missing_field_name_289 __annonCompField54; u64 hash_len; } ;
79 struct qstr { union __anonunion____missing_field_name_288 __annonCompField55; const unsigned char *name; } ;
65 struct dentry_operations ;
65 union __anonunion____missing_field_name_290 { struct list_head d_lru; wait_queue_head_t *d_wait; } ;
65 union __anonunion_d_u_291 { struct hlist_node d_alias; struct hlist_bl_node d_in_lookup_hash; struct callback_head d_rcu; } ;
65 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_290 __annonCompField56; struct list_head d_child; struct list_head d_subdirs; union __anonunion_d_u_291 d_u; } ;
121 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)(struct dentry *, bool ); struct dentry * (*d_real)(struct dentry *, const struct inode *, unsigned int); } ;
592 struct path { struct vfsmount *mnt; struct dentry *dentry; } ;
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; } ;
47 struct list_lru { struct list_lru_node *node; struct list_head list; } ;
63 struct __anonstruct____missing_field_name_293 { struct radix_tree_node *parent; void *private_data; } ;
63 union __anonunion____missing_field_name_292 { struct __anonstruct____missing_field_name_293 __annonCompField57; struct callback_head callback_head; } ;
63 struct radix_tree_node { unsigned char shift; unsigned char offset; unsigned int count; union __anonunion____missing_field_name_292 __annonCompField58; struct list_head private_list; void *slots[64U]; unsigned long tags[3U][1U]; } ;
106 struct radix_tree_root { gfp_t gfp_mask; struct radix_tree_node *rnode; } ;
531 enum pid_type { PIDTYPE_PID = 0, PIDTYPE_PGID = 1, PIDTYPE_SID = 2, PIDTYPE_MAX = 3 } ;
538 struct pid_namespace ;
538 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; } ;
22 struct kernel_cap_struct { __u32 cap[2U]; } ;
25 typedef struct kernel_cap_struct kernel_cap_t;
45 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 enum rcu_sync_type { RCU_SYNC = 0, RCU_SCHED_SYNC = 1, RCU_BH_SYNC = 2 } ;
50 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; wait_queue_head_t writer; int readers_block; } ;
87 struct block_device ;
88 struct io_context ;
89 struct cgroup_subsys_state ;
273 struct delayed_call { void (*fn)(void *); void *arg; } ;
264 struct backing_dev_info ;
265 struct bdi_writeback ;
266 struct export_operations ;
269 struct kiocb ;
270 struct pipe_inode_info ;
271 struct poll_table_struct ;
272 struct kstatfs ;
273 struct swap_info_struct ;
274 struct iov_iter ;
275 struct fscrypt_info ;
276 struct fscrypt_operations ;
76 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_302 { projid_t val; } ;
23 typedef struct __anonstruct_kprojid_t_302 kprojid_t;
181 enum quota_type { USRQUOTA = 0, GRPQUOTA = 1, PRJQUOTA = 2 } ;
66 typedef long long qsize_t;
67 union __anonunion____missing_field_name_303 { kuid_t uid; kgid_t gid; kprojid_t projid; } ;
67 struct kqid { union __anonunion____missing_field_name_303 __annonCompField60; 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_next_id)(struct super_block *, struct kqid *); } ;
338 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; } ;
361 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; } ;
407 struct qc_state { unsigned int s_incoredqs; struct qc_type_state s_state[3U]; } ;
418 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; } ;
431 struct quotactl_ops { int (*quota_on)(struct super_block *, int, int, 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); } ;
447 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; } ;
511 struct quota_info { unsigned int flags; struct mutex dqio_mutex; struct mutex dqonoff_mutex; struct inode *files[3U]; struct mem_dqinfo info[3U]; const struct quota_format_ops *ops[3U]; } ;
541 struct writeback_control ;
542 struct kiocb { struct file *ki_filp; loff_t ki_pos; void (*ki_complete)(struct kiocb *, long, long); void *private; int ki_flags; } ;
368 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 *); } ;
427 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; } ;
449 struct request_queue ;
450 struct hd_struct ;
450 struct gendisk ;
450 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 list_head bd_list; unsigned long bd_private; int bd_fsfreeze_count; struct mutex bd_fsfreeze_mutex; } ;
565 struct posix_acl ;
592 struct inode_operations ;
592 union __anonunion____missing_field_name_308 { const unsigned int i_nlink; unsigned int __i_nlink; } ;
592 union __anonunion____missing_field_name_309 { struct hlist_head i_dentry; struct callback_head i_rcu; } ;
592 struct file_lock_context ;
592 struct cdev ;
592 union __anonunion____missing_field_name_310 { struct pipe_inode_info *i_pipe; struct block_device *i_bdev; struct cdev *i_cdev; char *i_link; unsigned int i_dir_seq; } ;
592 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_308 __annonCompField61; 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; 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_309 __annonCompField62; 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_310 __annonCompField63; __u32 i_generation; __u32 i_fsnotify_mask; struct hlist_head i_fsnotify_marks; struct fscrypt_info *i_crypt_info; void *i_private; } ;
847 struct fown_struct { rwlock_t lock; struct pid *pid; enum pid_type pid_type; kuid_t uid; kuid_t euid; int signum; } ;
855 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; } ;
878 union __anonunion_f_u_311 { struct llist_node fu_llist; struct callback_head fu_rcuhead; } ;
878 struct file { union __anonunion_f_u_311 f_u; struct path f_path; struct inode *f_inode; const struct file_operations *f_op; spinlock_t f_lock; 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; } ;
963 typedef void *fl_owner_t;
964 struct file_lock ;
965 struct file_lock_operations { void (*fl_copy_lock)(struct file_lock *, struct file_lock *); void (*fl_release_private)(struct file_lock *); } ;
971 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 **); } ;
998 struct nlm_lockowner ;
999 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_313 { struct list_head link; int state; } ;
19 union __anonunion_fl_u_312 { struct nfs_lock_info nfs_fl; struct nfs4_lock_info nfs4_fl; struct __anonstruct_afs_313 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_312 fl_u; } ;
1051 struct file_lock_context { spinlock_t flc_lock; struct list_head flc_flock; struct list_head flc_posix; struct list_head flc_lease; } ;
1118 struct files_struct ;
1271 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; } ;
1306 struct sb_writers { int frozen; wait_queue_head_t wait_unfrozen; struct percpu_rw_semaphore rw_sem[3U]; } ;
1336 struct super_operations ;
1336 struct xattr_handler ;
1336 struct mtd_info ;
1336 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]; u8 s_uuid[16U]; 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; char *s_options; 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; } ;
1620 struct fiemap_extent_info { unsigned int fi_flags; unsigned int fi_extents_mapped; unsigned int fi_extents_max; struct fiemap_extent *fi_extents_start; } ;
1633 struct dir_context ;
1658 struct dir_context { int (*actor)(struct dir_context *, const char *, int, loff_t , u64 , unsigned int); loff_t pos; } ;
1665 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 (*aio_fsync)(struct kiocb *, 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 ); } ;
1734 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)(struct vfsmount *, struct dentry *, struct kstat *); 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); } ;
1784 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 *); } ;
2027 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; } ;
3211 struct assoc_array_ptr ;
3211 struct assoc_array { struct assoc_array_ptr *root; unsigned long nr_leaves_on_tree; } ;
31 typedef int32_t key_serial_t;
34 typedef uint32_t key_perm_t;
35 struct key ;
36 struct user_struct ;
37 struct signal_struct ;
38 struct key_type ;
42 struct keyring_index_key { struct key_type *type; const char *description; size_t desc_len; } ;
91 union key_payload { void *rcu_data0; void *data[4U]; } ;
128 union __anonunion____missing_field_name_314 { struct list_head graveyard_link; struct rb_node serial_node; } ;
128 struct key_user ;
128 union __anonunion____missing_field_name_315 { time_t expiry; time_t revoked_at; } ;
128 struct __anonstruct____missing_field_name_317 { struct key_type *type; char *description; } ;
128 union __anonunion____missing_field_name_316 { struct keyring_index_key index_key; struct __anonstruct____missing_field_name_317 __annonCompField66; } ;
128 struct __anonstruct____missing_field_name_319 { struct list_head name_link; struct assoc_array keys; } ;
128 union __anonunion____missing_field_name_318 { union key_payload payload; struct __anonstruct____missing_field_name_319 __annonCompField68; int reject_error; } ;
128 struct key { atomic_t usage; key_serial_t serial; union __anonunion____missing_field_name_314 __annonCompField64; struct rw_semaphore sem; struct key_user *user; void *security; union __anonunion____missing_field_name_315 __annonCompField65; 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_316 __annonCompField67; union __anonunion____missing_field_name_318 __annonCompField69; int (*restrict_link)(struct key *, const struct key_type *, const union key_payload *); } ;
377 struct audit_context ;
27 struct group_info { atomic_t usage; int ngroups; kgid_t gid[0U]; } ;
85 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; } ;
368 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 ;
194 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; } ;
84 struct plist_node { int prio; struct list_head prio_list; struct list_head node_list; } ;
4 typedef unsigned long cputime_t;
26 struct sem_undo_list ;
26 struct sysv_sem { struct sem_undo_list *undo_list; } ;
26 struct sysv_shm { struct list_head shm_clist; } ;
24 struct __anonstruct_sigset_t_320 { unsigned long sig[1U]; } ;
24 typedef struct __anonstruct_sigset_t_320 sigset_t;
25 struct siginfo ;
17 typedef void __signalfn_t(int);
18 typedef __signalfn_t *__sighandler_t;
20 typedef void __restorefn_t();
21 typedef __restorefn_t *__sigrestore_t;
38 union sigval { int sival_int; void *sival_ptr; } ;
10 typedef union sigval sigval_t;
11 struct __anonstruct__kill_322 { __kernel_pid_t _pid; __kernel_uid32_t _uid; } ;
11 struct __anonstruct__timer_323 { __kernel_timer_t _tid; int _overrun; char _pad[0U]; sigval_t _sigval; int _sys_private; } ;
11 struct __anonstruct__rt_324 { __kernel_pid_t _pid; __kernel_uid32_t _uid; sigval_t _sigval; } ;
11 struct __anonstruct__sigchld_325 { __kernel_pid_t _pid; __kernel_uid32_t _uid; int _status; __kernel_clock_t _utime; __kernel_clock_t _stime; } ;
11 struct __anonstruct__addr_bnd_328 { void *_lower; void *_upper; } ;
11 union __anonunion____missing_field_name_327 { struct __anonstruct__addr_bnd_328 _addr_bnd; __u32 _pkey; } ;
11 struct __anonstruct__sigfault_326 { void *_addr; short _addr_lsb; union __anonunion____missing_field_name_327 __annonCompField70; } ;
11 struct __anonstruct__sigpoll_329 { long _band; int _fd; } ;
11 struct __anonstruct__sigsys_330 { void *_call_addr; int _syscall; unsigned int _arch; } ;
11 union __anonunion__sifields_321 { int _pad[28U]; struct __anonstruct__kill_322 _kill; struct __anonstruct__timer_323 _timer; struct __anonstruct__rt_324 _rt; struct __anonstruct__sigchld_325 _sigchld; struct __anonstruct__sigfault_326 _sigfault; struct __anonstruct__sigpoll_329 _sigpoll; struct __anonstruct__sigsys_330 _sigsys; } ;
11 struct siginfo { int si_signo; int si_errno; int si_code; union __anonunion__sifields_321 _sifields; } ;
118 typedef struct siginfo siginfo_t;
22 struct sigpending { struct list_head list; sigset_t signal; } ;
257 struct sigaction { __sighandler_t sa_handler; unsigned long sa_flags; __sigrestore_t sa_restorer; sigset_t sa_mask; } ;
271 struct k_sigaction { struct sigaction sa; } ;
43 struct seccomp_filter ;
44 struct seccomp { int mode; struct seccomp_filter *filter; } ;
40 struct rt_mutex_waiter ;
41 struct rlimit { __kernel_ulong_t rlim_cur; __kernel_ulong_t rlim_max; } ;
11 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; int start_pid; void *start_site; char start_comm[16U]; } ;
125 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; } ;
158 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]; } ;
12 enum kcov_mode { KCOV_MODE_DISABLED = 0, KCOV_MODE_TRACE = 1 } ;
17 struct task_io_accounting { u64 rchar; u64 wchar; u64 syscr; u64 syscw; u64 read_bytes; u64 write_bytes; u64 cancelled_write_bytes; } ;
45 struct latency_record { unsigned long backtrace[12U]; unsigned int count; unsigned long time; unsigned long max; } ;
41 struct percpu_ref ;
55 typedef void percpu_ref_func_t(struct percpu_ref *);
68 struct percpu_ref { atomic_long_t count; unsigned long percpu_count_ptr; percpu_ref_func_t *release; percpu_ref_func_t *confirm_switch; bool force_atomic; struct callback_head rcu; } ;
325 struct cgroup ;
326 struct cgroup_root ;
327 struct cgroup_subsys ;
328 struct cgroup_taskset ;
372 struct cgroup_file { struct kernfs_node *kn; } ;
90 struct cgroup_subsys_state { struct cgroup *cgroup; struct cgroup_subsys *ss; struct percpu_ref refcnt; struct cgroup_subsys_state *parent; struct list_head sibling; struct list_head children; int id; unsigned int flags; u64 serial_nr; atomic_t online_cnt; struct callback_head callback_head; struct work_struct destroy_work; } ;
141 struct css_set { atomic_t refcount; struct hlist_node hlist; struct list_head tasks; struct list_head mg_tasks; struct list_head cgrp_links; struct cgroup *dfl_cgrp; struct cgroup_subsys_state *subsys[13U]; struct list_head mg_preload_node; struct list_head mg_node; struct cgroup *mg_src_cgrp; struct cgroup *mg_dst_cgrp; struct css_set *mg_dst_cset; struct list_head e_cset_node[13U]; struct list_head task_iters; bool dead; struct callback_head callback_head; } ;
221 struct cgroup { struct cgroup_subsys_state self; unsigned long flags; int id; int level; int populated_cnt; struct kernfs_node *kn; struct cgroup_file procs_file; struct cgroup_file events_file; u16 subtree_control; u16 subtree_ss_mask; u16 old_subtree_control; u16 old_subtree_ss_mask; struct cgroup_subsys_state *subsys[13U]; struct cgroup_root *root; struct list_head cset_links; struct list_head e_csets[13U]; struct list_head pidlists; struct mutex pidlist_mutex; wait_queue_head_t offline_waitq; struct work_struct release_agent_work; int ancestor_ids[]; } ;
306 struct cgroup_root { struct kernfs_root *kf_root; unsigned int subsys_mask; int hierarchy_id; struct cgroup cgrp; int cgrp_ancestor_id_storage; atomic_t nr_cgrps; struct list_head root_list; unsigned int flags; struct idr cgroup_idr; char release_agent_path[4096U]; char name[64U]; } ;
345 struct cftype { char name[64U]; unsigned long private; size_t max_write_len; unsigned int flags; unsigned int file_offset; struct cgroup_subsys *ss; struct list_head node; struct kernfs_ops *kf_ops; u64 (*read_u64)(struct cgroup_subsys_state *, struct cftype *); s64 (*read_s64)(struct cgroup_subsys_state *, struct cftype *); 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 *); int (*write_u64)(struct cgroup_subsys_state *, struct cftype *, u64 ); int (*write_s64)(struct cgroup_subsys_state *, struct cftype *, s64 ); ssize_t (*write)(struct kernfs_open_file *, char *, size_t , loff_t ); struct lock_class_key lockdep_key; } ;
430 struct cgroup_subsys { struct cgroup_subsys_state * (*css_alloc)(struct cgroup_subsys_state *); int (*css_online)(struct cgroup_subsys_state *); void (*css_offline)(struct cgroup_subsys_state *); void (*css_released)(struct cgroup_subsys_state *); void (*css_free)(struct cgroup_subsys_state *); void (*css_reset)(struct cgroup_subsys_state *); int (*can_attach)(struct cgroup_taskset *); void (*cancel_attach)(struct cgroup_taskset *); void (*attach)(struct cgroup_taskset *); void (*post_attach)(); int (*can_fork)(struct task_struct *); void (*cancel_fork)(struct task_struct *); void (*fork)(struct task_struct *); void (*exit)(struct task_struct *); void (*free)(struct task_struct *); void (*bind)(struct cgroup_subsys_state *); bool early_init; bool implicit_on_dfl; bool broken_hierarchy; bool warned_broken_hierarchy; int id; const char *name; const char *legacy_name; struct cgroup_root *root; struct idr css_idr; struct list_head cfts; struct cftype *dfl_cftypes; struct cftype *legacy_cftypes; unsigned int depends_on; } ;
128 struct futex_pi_state ;
129 struct robust_list_head ;
130 struct bio_list ;
131 struct fs_struct ;
132 struct perf_event_context ;
133 struct blk_plug ;
134 struct nameidata ;
188 struct cfs_rq ;
189 struct task_group ;
495 struct sighand_struct { atomic_t count; struct k_sigaction action[64U]; spinlock_t siglock; wait_queue_head_t signalfd_wqh; } ;
539 struct pacct_struct { int ac_flag; long ac_exitcode; unsigned long ac_mem; cputime_t ac_utime; cputime_t ac_stime; unsigned long ac_minflt; unsigned long ac_majflt; } ;
547 struct cpu_itimer { cputime_t expires; cputime_t incr; u32 error; u32 incr_error; } ;
554 struct prev_cputime { cputime_t utime; cputime_t stime; raw_spinlock_t lock; } ;
579 struct task_cputime { cputime_t utime; cputime_t stime; unsigned long long sum_exec_runtime; } ;
595 struct task_cputime_atomic { atomic64_t utime; atomic64_t stime; atomic64_t sum_exec_runtime; } ;
617 struct thread_group_cputimer { struct task_cputime_atomic cputime_atomic; bool running; bool checking_timer; } ;
662 struct autogroup ;
663 struct tty_struct ;
663 struct taskstats ;
663 struct tty_audit_buf ;
663 struct signal_struct { atomic_t sigcnt; atomic_t live; int nr_threads; struct list_head thread_head; wait_queue_head_t wait_chldexit; struct task_struct *curr_target; struct sigpending shared_pending; int group_exit_code; int notify_count; struct task_struct *group_exit_task; int group_stop_count; unsigned int flags; unsigned char is_child_subreaper; unsigned char has_child_subreaper; int posix_timer_id; struct list_head posix_timers; struct hrtimer real_timer; struct pid *leader_pid; ktime_t it_real_incr; struct cpu_itimer it[2U]; struct thread_group_cputimer cputimer; struct task_cputime cputime_expires; struct list_head cpu_timers[3U]; struct pid *tty_old_pgrp; int leader; struct tty_struct *tty; struct autogroup *autogroup; seqlock_t stats_lock; cputime_t utime; cputime_t stime; cputime_t cutime; cputime_t cstime; cputime_t gtime; cputime_t cgtime; struct prev_cputime prev_cputime; unsigned long nvcsw; unsigned long nivcsw; unsigned long cnvcsw; unsigned long cnivcsw; unsigned long min_flt; unsigned long maj_flt; unsigned long cmin_flt; unsigned long cmaj_flt; unsigned long inblock; unsigned long oublock; unsigned long cinblock; unsigned long coublock; unsigned long maxrss; unsigned long cmaxrss; struct task_io_accounting ioac; unsigned long long sum_sched_runtime; struct rlimit rlim[16U]; struct pacct_struct pacct; struct taskstats *stats; unsigned int audit_tty; struct tty_audit_buf *tty_audit_buf; bool oom_flag_origin; short oom_score_adj; short oom_score_adj_min; struct mm_struct *oom_mm; struct mutex cred_guard_mutex; } ;
839 struct user_struct { atomic_t __count; atomic_t processes; atomic_t sigpending; atomic_t inotify_watches; atomic_t inotify_devs; 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; } ;
884 struct reclaim_state ;
885 struct sched_info { unsigned long pcount; unsigned long long run_delay; unsigned long long last_arrival; unsigned long long last_queued; } ;
900 struct task_delay_info { spinlock_t lock; unsigned int flags; u64 blkio_start; u64 blkio_delay; u64 swapin_delay; u32 blkio_count; u32 swapin_count; u64 freepages_start; u64 freepages_delay; u32 freepages_count; } ;
957 struct wake_q_node { struct wake_q_node *next; } ;
1235 struct load_weight { unsigned long weight; u32 inv_weight; } ;
1243 struct sched_avg { u64 last_update_time; u64 load_sum; u32 util_sum; u32 period_contrib; unsigned long load_avg; unsigned long util_avg; } ;
1301 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; } ;
1336 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; } ;
1373 struct rt_rq ;
1373 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; } ;
1391 struct sched_dl_entity { struct rb_node rb_node; u64 dl_runtime; u64 dl_deadline; u64 dl_period; u64 dl_bw; s64 runtime; u64 deadline; unsigned int flags; int dl_throttled; int dl_boosted; int dl_yielded; struct hrtimer dl_timer; } ;
1455 struct tlbflush_unmap_batch { struct cpumask cpumask; bool flush_required; bool writable; } ;
1474 struct sched_class ;
1474 struct compat_robust_list_head ;
1474 struct numa_group ;
1474 struct kcov ;
1474 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; u32 vmacache_seqnum; struct vm_area_struct *vmacache[4U]; 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 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; cputime_t utime; cputime_t stime; cputime_t utimescaled; cputime_t stimescaled; cputime_t 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 *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 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; cputime_t 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; 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_next; 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; 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; struct thread_struct thread; } ;
3606 struct ratelimit_state { raw_spinlock_t lock; int interval; int burst; int printed; int missed; unsigned long begin; unsigned long flags; } ;
76 struct dma_map_ops ;
76 struct dev_archdata { struct dma_map_ops *dma_ops; void *iommu; } ;
21 struct pdev_archdata { } ;
24 struct device_private ;
25 struct device_driver ;
26 struct driver_private ;
27 struct class ;
28 struct subsys_private ;
29 struct bus_type ;
30 struct device_node ;
31 struct fwnode_handle ;
32 struct iommu_ops ;
33 struct iommu_group ;
34 struct iommu_fwspec ;
62 struct device_attribute ;
62 struct bus_type { const char *name; const char *dev_name; struct device *dev_root; struct device_attribute *dev_attrs; 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 *); const struct dev_pm_ops *pm; const struct iommu_ops *iommu_ops; struct subsys_private *p; struct lock_class_key lock_key; } ;
143 struct device_type ;
202 enum probe_type { PROBE_DEFAULT_STRATEGY = 0, PROBE_PREFER_ASYNCHRONOUS = 1, PROBE_FORCE_SYNCHRONOUS = 2 } ;
208 struct of_device_id ;
208 struct acpi_device_id ;
208 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; } ;
358 struct class_attribute ;
358 struct class { const char *name; struct module *owner; struct class_attribute *class_attrs; 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 *); const struct kobj_ns_type_operations *ns_type; const void * (*namespace)(struct device *); const struct dev_pm_ops *pm; struct subsys_private *p; } ;
451 struct class_attribute { struct attribute attr; ssize_t (*show)(struct class *, struct class_attribute *, char *); ssize_t (*store)(struct class *, struct class_attribute *, const char *, size_t ); } ;
519 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; } ;
547 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 ); } ;
700 struct device_dma_parameters { unsigned int max_segment_size; unsigned long segment_boundary_mask; } ;
709 struct irq_domain ;
709 struct dma_coherent_mem ;
709 struct cma ;
709 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_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; 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; } ;
865 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; } ;
13 typedef unsigned long kernel_ulong_t;
186 struct acpi_device_id { __u8 id[9U]; kernel_ulong_t driver_data; __u32 cls; __u32 cls_msk; } ;
195 struct pnp_device_id { __u8 id[8U]; kernel_ulong_t driver_data; } ;
203 struct __anonstruct_devs_357 { __u8 id[8U]; } ;
203 struct pnp_card_device_id { __u8 id[8U]; kernel_ulong_t driver_data; struct __anonstruct_devs_357 devs[8U]; } ;
229 struct of_device_id { char name[32U]; char type[32U]; char compatible[128U]; const void *data; } ;
484 struct platform_device_id { char name[20U]; kernel_ulong_t driver_data; } ;
674 struct mfd_cell ;
676 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; } ;
179 struct platform_driver { int (*probe)(struct platform_device *); int (*remove)(struct platform_device *); void (*shutdown)(struct platform_device *); int (*suspend)(struct platform_device *, pm_message_t ); int (*resume)(struct platform_device *); struct device_driver driver; const struct platform_device_id *id_table; bool prevent_deferred_probe; } ;
352 enum irqreturn { IRQ_NONE = 0, IRQ_HANDLED = 1, IRQ_WAKE_THREAD = 2 } ;
16 typedef enum irqreturn irqreturn_t;
423 struct proc_dir_entry ;
130 struct exception_table_entry { int insn; int fixup; int handler; } ;
494 struct tasklet_struct { struct tasklet_struct *next; unsigned long state; atomic_t count; void (*func)(unsigned long); unsigned long data; } ;
716 struct scatterlist ;
96 enum dma_data_direction { DMA_BIDIRECTIONAL = 0, DMA_TO_DEVICE = 1, DMA_FROM_DEVICE = 2, DMA_NONE = 3 } ;
273 struct vm_fault { unsigned int flags; gfp_t gfp_mask; unsigned long pgoff; void *virtual_address; struct page *cow_page; struct page *page; void *entry; } ;
308 struct fault_env { struct vm_area_struct *vma; unsigned long address; unsigned int flags; pmd_t *pmd; pte_t *pte; spinlock_t *ptl; pgtable_t prealloc_pte; } ;
335 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_area_struct *, struct vm_fault *); int (*pmd_fault)(struct vm_area_struct *, unsigned long, pmd_t *, unsigned int); void (*map_pages)(struct fault_env *, unsigned long, unsigned long); int (*page_mkwrite)(struct vm_area_struct *, struct vm_fault *); int (*pfn_mkwrite)(struct vm_area_struct *, 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); } ;
2450 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; } ;
21 struct sg_table { struct scatterlist *sgl; unsigned int nents; unsigned int orig_nents; } ;
158 struct dma_map_ops { void * (*alloc)(struct device *, size_t , dma_addr_t *, gfp_t , unsigned long); void (*free)(struct device *, size_t , void *, dma_addr_t , unsigned long); int (*mmap)(struct device *, struct vm_area_struct *, void *, dma_addr_t , size_t , unsigned long); int (*get_sgtable)(struct device *, struct sg_table *, void *, dma_addr_t , size_t , unsigned long); dma_addr_t (*map_page)(struct device *, struct page *, unsigned long, size_t , enum dma_data_direction , unsigned long); void (*unmap_page)(struct device *, dma_addr_t , size_t , enum dma_data_direction , unsigned long); int (*map_sg)(struct device *, struct scatterlist *, int, enum dma_data_direction , unsigned long); void (*unmap_sg)(struct device *, struct scatterlist *, int, enum dma_data_direction , unsigned long); dma_addr_t (*map_resource)(struct device *, phys_addr_t , size_t , enum dma_data_direction , unsigned long); void (*unmap_resource)(struct device *, dma_addr_t , size_t , enum dma_data_direction , unsigned long); void (*sync_single_for_cpu)(struct device *, dma_addr_t , size_t , enum dma_data_direction ); void (*sync_single_for_device)(struct device *, dma_addr_t , size_t , enum dma_data_direction ); void (*sync_sg_for_cpu)(struct device *, struct scatterlist *, int, enum dma_data_direction ); void (*sync_sg_for_device)(struct device *, struct scatterlist *, int, enum dma_data_direction ); int (*mapping_error)(struct device *, dma_addr_t ); int (*dma_supported)(struct device *, u64 ); int (*set_dma_mask)(struct device *, u64 ); int is_phys; } ;
207 struct pnp_protocol ;
208 struct pnp_dev ;
195 struct pnp_id ;
195 struct pnp_card { struct device dev; unsigned char number; struct list_head global_list; struct list_head protocol_list; struct list_head devices; struct pnp_protocol *protocol; struct pnp_id *id; char name[50U]; unsigned char pnpver; unsigned char productver; unsigned int serial; unsigned char checksum; struct proc_dir_entry *procdir; } ;
218 struct pnp_card_driver ;
218 struct pnp_card_link { struct pnp_card *card; struct pnp_card_driver *driver; void *driver_data; pm_message_t pm_state; } ;
243 struct pnp_driver ;
243 struct pnp_dev { struct device dev; u64 dma_mask; unsigned int number; int status; struct list_head global_list; struct list_head protocol_list; struct list_head card_list; struct list_head rdev_list; struct pnp_protocol *protocol; struct pnp_card *card; struct pnp_driver *driver; struct pnp_card_link *card_link; struct pnp_id *id; int active; int capabilities; unsigned int num_dependent_sets; struct list_head resources; struct list_head options; char name[50U]; int flags; struct proc_dir_entry *procent; void *data; } ;
356 struct pnp_id { char id[8U]; struct pnp_id *next; } ;
379 struct pnp_driver { char *name; const struct pnp_device_id *id_table; unsigned int flags; int (*probe)(struct pnp_dev *, const struct pnp_device_id *); void (*remove)(struct pnp_dev *); void (*shutdown)(struct pnp_dev *); int (*suspend)(struct pnp_dev *, pm_message_t ); int (*resume)(struct pnp_dev *); struct device_driver driver; } ;
391 struct pnp_card_driver { struct list_head global_list; char *name; const struct pnp_card_device_id *id_table; unsigned int flags; int (*probe)(struct pnp_card_link *, const struct pnp_card_device_id *); void (*remove)(struct pnp_card_link *); int (*suspend)(struct pnp_card_link *, pm_message_t ); int (*resume)(struct pnp_card_link *); struct pnp_driver link; } ;
406 struct pnp_protocol { struct list_head protocol_list; char *name; int (*get)(struct pnp_dev *); int (*set)(struct pnp_dev *); int (*disable)(struct pnp_dev *); bool (*can_wakeup)(struct pnp_dev *); int (*suspend)(struct pnp_dev *, pm_message_t ); int (*resume)(struct pnp_dev *); unsigned char number; struct device dev; struct list_head cards; struct list_head devices; } ;
249 enum led_brightness { LED_OFF = 0, LED_HALF = 127, LED_FULL = 255 } ;
255 struct led_trigger ;
255 struct led_classdev { const char *name; enum led_brightness brightness; enum led_brightness max_brightness; int flags; void (*brightness_set)(struct led_classdev *, enum led_brightness ); int (*brightness_set_blocking)(struct led_classdev *, enum led_brightness ); enum led_brightness (*brightness_get)(struct led_classdev *); int (*blink_set)(struct led_classdev *, unsigned long *, unsigned long *); struct device *dev; const struct attribute_group **groups; struct list_head node; const char *default_trigger; unsigned long blink_delay_on; unsigned long blink_delay_off; struct timer_list blink_timer; int blink_brightness; void (*flash_resume)(struct led_classdev *); struct work_struct set_brightness_work; int delayed_set_value; struct rw_semaphore trigger_lock; struct led_trigger *trigger; struct list_head trig_list; void *trigger_data; bool activated; struct mutex led_access; } ;
221 struct led_trigger { const char *name; void (*activate)(struct led_classdev *); void (*deactivate)(struct led_classdev *); rwlock_t leddev_list_lock; struct list_head led_cdevs; struct list_head next_trig; } ;
171 struct fault_attr { unsigned long probability; unsigned long interval; atomic_t times; atomic_t space; unsigned long verbose; bool task_filter; unsigned long stacktrace_depth; unsigned long require_start; unsigned long require_end; unsigned long reject_start; unsigned long reject_end; unsigned long count; struct ratelimit_state ratelimit_state; struct dentry *dname; } ;
67 struct mmc_data ;
68 struct mmc_request ;
69 struct mmc_command { u32 opcode; u32 arg; u32 resp[4U]; unsigned int flags; unsigned int retries; int error; unsigned int busy_timeout; bool sanitize_busy; struct mmc_data *data; struct mmc_request *mrq; } ;
108 struct mmc_data { unsigned int timeout_ns; unsigned int timeout_clks; unsigned int blksz; unsigned int blocks; int error; unsigned int flags; unsigned int bytes_xfered; struct mmc_command *stop; struct mmc_request *mrq; unsigned int sg_len; int sg_count; struct scatterlist *sg; s32 host_cookie; } ;
130 struct mmc_host ;
131 struct mmc_request { struct mmc_command *sbc; struct mmc_command *cmd; struct mmc_data *data; struct mmc_command *stop; struct completion completion; struct completion cmd_completion; void (*done)(struct mmc_request *); struct mmc_host *host; bool cap_cmd_during_tfr; } ;
146 struct mmc_card ;
147 struct mmc_async_req ;
222 struct mmc_cid { unsigned int manfid; char prod_name[8U]; unsigned char prv; unsigned int serial; unsigned short oemid; unsigned short year; unsigned char hwrev; unsigned char fwrev; unsigned char month; } ;
28 struct mmc_csd { unsigned char structure; unsigned char mmca_vsn; unsigned short cmdclass; unsigned short tacc_clks; unsigned int tacc_ns; unsigned int c_size; unsigned int r2w_factor; unsigned int max_dtr; unsigned int erase_size; unsigned int read_blkbits; unsigned int write_blkbits; unsigned int capacity; unsigned char read_partial; unsigned char read_misalign; unsigned char write_partial; unsigned char write_misalign; unsigned char dsr_imp; } ;
48 struct mmc_ext_csd { u8 rev; u8 erase_group_def; u8 sec_feature_support; u8 rel_sectors; u8 rel_param; u8 part_config; u8 cache_ctrl; u8 rst_n_function; u8 max_packed_writes; u8 max_packed_reads; u8 packed_event_en; unsigned int part_time; unsigned int sa_timeout; unsigned int generic_cmd6_time; unsigned int power_off_longtime; u8 power_off_notification; unsigned int hs_max_dtr; unsigned int hs200_max_dtr; unsigned int sectors; unsigned int hc_erase_size; unsigned int hc_erase_timeout; unsigned int sec_trim_mult; unsigned int sec_erase_mult; unsigned int trim_timeout; bool partition_setting_completed; unsigned long long enhanced_area_offset; unsigned int enhanced_area_size; unsigned int cache_size; bool hpi_en; bool hpi; unsigned int hpi_cmd; bool bkops; bool man_bkops_en; unsigned int data_sector_size; unsigned int data_tag_unit_size; unsigned int boot_ro_lock; bool boot_ro_lockable; bool ffu_capable; u8 fwrev[8U]; u8 raw_exception_status; u8 raw_partition_support; u8 raw_rpmb_size_mult; u8 raw_erased_mem_count; u8 strobe_support; u8 raw_ext_csd_structure; u8 raw_card_type; u8 raw_driver_strength; u8 out_of_int_time; u8 raw_pwr_cl_52_195; u8 raw_pwr_cl_26_195; u8 raw_pwr_cl_52_360; u8 raw_pwr_cl_26_360; u8 raw_s_a_timeout; u8 raw_hc_erase_gap_size; u8 raw_erase_timeout_mult; u8 raw_hc_erase_grp_size; u8 raw_sec_trim_mult; u8 raw_sec_erase_mult; u8 raw_sec_feature_support; u8 raw_trim_mult; u8 raw_pwr_cl_200_195; u8 raw_pwr_cl_200_360; u8 raw_pwr_cl_ddr_52_195; u8 raw_pwr_cl_ddr_52_360; u8 raw_pwr_cl_ddr_200_360; u8 raw_bkops_status; u8 raw_sectors[4U]; unsigned int feature_support; } ;
125 struct sd_scr { unsigned char sda_vsn; unsigned char sda_spec3; unsigned char bus_widths; unsigned char cmds; } ;
135 struct sd_ssr { unsigned int au; unsigned int erase_timeout; unsigned int erase_offset; } ;
143 struct sd_switch_caps { unsigned int hs_max_dtr; unsigned int uhs_max_dtr; unsigned int sd3_bus_mode; unsigned int sd3_drv_type; unsigned int sd3_curr_limit; } ;
174 struct sdio_cccr { unsigned int sdio_vsn; unsigned int sd_vsn; unsigned char multi_block; unsigned char low_speed; unsigned char wide_bus; unsigned char high_power; unsigned char high_speed; unsigned char disable_cd; } ;
195 struct sdio_cis { unsigned short vendor; unsigned short device; unsigned short blksize; unsigned int max_dtr; } ;
202 struct mmc_ios ;
203 struct sdio_func ;
204 struct sdio_func_tuple ;
217 struct mmc_part { unsigned int size; unsigned int part_cfg; char name[20U]; bool force_ro; unsigned int area_type; } ;
241 struct mmc_card { struct mmc_host *host; struct device dev; u32 ocr; unsigned int rca; unsigned int type; unsigned int state; unsigned int quirks; unsigned int erase_size; unsigned int erase_shift; unsigned int pref_erase; unsigned int eg_boundary; u8 erased_byte; u32 raw_cid[4U]; u32 raw_csd[4U]; u32 raw_scr[2U]; u32 raw_ssr[16U]; struct mmc_cid cid; struct mmc_csd csd; struct mmc_ext_csd ext_csd; struct sd_scr scr; struct sd_ssr ssr; struct sd_switch_caps sw_caps; unsigned int sdio_funcs; struct sdio_cccr cccr; struct sdio_cis cis; struct sdio_func *sdio_func[7U]; struct sdio_func *sdio_single_irq; unsigned int num_info; const char **info; struct sdio_func_tuple *tuples; unsigned int sd_bus_speed; unsigned int mmc_avail_type; unsigned int drive_strength; struct dentry *debugfs_root; struct mmc_part part[7U]; unsigned int nr_parts; } ;
25 typedef unsigned int mmc_pm_flag_t;
26 struct mmc_ios { unsigned int clock; unsigned short vdd; unsigned char bus_mode; unsigned char chip_select; unsigned char power_mode; unsigned char bus_width; unsigned char timing; unsigned char signal_voltage; unsigned char drv_type; bool enhanced_strobe; } ;
84 struct mmc_host_ops { void (*post_req)(struct mmc_host *, struct mmc_request *, int); void (*pre_req)(struct mmc_host *, struct mmc_request *, bool ); void (*request)(struct mmc_host *, struct mmc_request *); void (*set_ios)(struct mmc_host *, struct mmc_ios *); int (*get_ro)(struct mmc_host *); int (*get_cd)(struct mmc_host *); void (*enable_sdio_irq)(struct mmc_host *, int); void (*init_card)(struct mmc_host *, struct mmc_card *); int (*start_signal_voltage_switch)(struct mmc_host *, struct mmc_ios *); int (*card_busy)(struct mmc_host *); int (*execute_tuning)(struct mmc_host *, u32 ); int (*prepare_hs400_tuning)(struct mmc_host *, struct mmc_ios *); void (*hs400_enhanced_strobe)(struct mmc_host *, struct mmc_ios *); int (*select_drive_strength)(struct mmc_card *, unsigned int, int, int, int *); void (*hw_reset)(struct mmc_host *); void (*card_event)(struct mmc_host *); int (*multi_io_quirk)(struct mmc_card *, unsigned int, int); } ;
164 struct mmc_async_req { struct mmc_request *mrq; int (*err_check)(struct mmc_card *, struct mmc_async_req *); } ;
178 struct mmc_slot { int cd_irq; void *handler_priv; } ;
194 struct mmc_context_info { bool is_done_rcv; bool is_new_req; bool is_waiting_last_req; wait_queue_head_t wait; spinlock_t lock; } ;
210 struct regulator ;
211 struct mmc_pwrseq ;
212 struct mmc_supply { struct regulator *vmmc; struct regulator *vqmmc; } ;
218 struct mmc_bus_ops ;
218 struct mmc_host { struct device *parent; struct device class_dev; int index; const struct mmc_host_ops *ops; struct mmc_pwrseq *pwrseq; unsigned int f_min; unsigned int f_max; unsigned int f_init; u32 ocr_avail; u32 ocr_avail_sdio; u32 ocr_avail_sd; u32 ocr_avail_mmc; struct notifier_block pm_notify; u32 max_current_330; u32 max_current_300; u32 max_current_180; u32 caps; u32 caps2; mmc_pm_flag_t pm_caps; unsigned int max_seg_size; unsigned short max_segs; unsigned short unused; unsigned int max_req_size; unsigned int max_blk_size; unsigned int max_blk_count; unsigned int max_busy_timeout; spinlock_t lock; struct mmc_ios ios; unsigned char use_spi_crc; unsigned char claimed; unsigned char bus_dead; unsigned char removed; unsigned char can_retune; unsigned char doing_retune; unsigned char retune_now; unsigned char retune_paused; int rescan_disable; int rescan_entered; int need_retune; int hold_retune; unsigned int retune_period; struct timer_list retune_timer; bool trigger_card_event; struct mmc_card *card; wait_queue_head_t wq; struct task_struct *claimer; int claim_cnt; struct delayed_work detect; int detect_change; struct mmc_slot slot; const struct mmc_bus_ops *bus_ops; unsigned int bus_refs; unsigned int sdio_irqs; struct task_struct *sdio_irq_thread; bool sdio_irq_pending; atomic_t sdio_irq_thread_abort; mmc_pm_flag_t pm_flags; struct led_trigger *led; bool regulator_enabled; struct mmc_supply supply; struct dentry *debugfs_root; struct mmc_async_req *areq; struct mmc_context_info context_info; struct mmc_request *ongoing_mrq; struct fault_attr fail_mmc_request; unsigned int actual_clock; unsigned int slotno; int dsr_req; u32 dsr; unsigned long private[0U]; } ;
313 struct wbsd_host { struct mmc_host *mmc; spinlock_t lock; int flags; struct mmc_request *mrq; u8 isr; struct scatterlist *cur_sg; unsigned int num_sg; unsigned int offset; unsigned int remain; char *dma_buffer; dma_addr_t dma_addr; int firsterr; u8 clk; unsigned char bus_width; int config; u8 unlock_code; int chip_id; int base; int irq; int dma; struct tasklet_struct card_tasklet; struct tasklet_struct fifo_tasklet; struct tasklet_struct crc_tasklet; struct tasklet_struct timeout_tasklet; struct tasklet_struct finish_tasklet; struct timer_list ignore_timer; } ;
1 long int __builtin_expect(long, long);
34 extern struct module __this_module;
204 bool test_and_set_bit(long nr, volatile unsigned long *addr);
163 int printk(const char *, ...);
55 void __dynamic_pr_debug(struct _ddebug *, const char *, ...);
8 void ldv_dma_map_page();
71 void warn_slowpath_null(const char *, const int);
7 extern unsigned long page_offset_base;
9 extern unsigned long vmemmap_base;
23 unsigned long int __phys_addr(unsigned long);
32 void * __memcpy(void *, const void *, size_t );
93 void __raw_spin_lock_init(raw_spinlock_t *, const char *, struct lock_class_key *);
22 void _raw_spin_lock(raw_spinlock_t *);
30 void _raw_spin_lock_bh(raw_spinlock_t *);
34 unsigned long int _raw_spin_lock_irqsave(raw_spinlock_t *);
41 void _raw_spin_unlock(raw_spinlock_t *);
42 void _raw_spin_unlock_bh(raw_spinlock_t *);
45 void _raw_spin_unlock_irqrestore(raw_spinlock_t *, unsigned long);
289 raw_spinlock_t * spinlock_check(spinlock_t *lock);
300 void spin_lock(spinlock_t *lock);
305 void spin_lock_bh(spinlock_t *lock);
345 void spin_unlock(spinlock_t *lock);
350 void spin_unlock_bh(spinlock_t *lock);
360 void spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags);
78 extern volatile unsigned long jiffies;
296 unsigned long int __msecs_to_jiffies(const unsigned int);
358 unsigned long int msecs_to_jiffies(const unsigned int m);
95 void init_timer_key(struct timer_list *, unsigned int, const char *, struct lock_class_key *);
191 int mod_timer(struct timer_list *, unsigned long);
245 int del_timer_sync(struct timer_list *);
166 extern struct resource ioport_resource;
225 struct resource * __request_region(struct resource *, resource_size_t , resource_size_t , const char *, int);
234 void __release_region(struct resource *, resource_size_t , resource_size_t );
316 void outb(unsigned char value, int port);
316 unsigned char inb(int port);
87 const char * kobject_name(const struct kobject *kobj);
868 const char * dev_name(const struct device *dev);
915 void * dev_get_drvdata(const struct device *dev);
920 void dev_set_drvdata(struct device *dev, void *data);
46 void platform_device_unregister(struct platform_device *);
168 struct platform_device * platform_device_alloc(const char *, int);
176 int platform_device_add(struct platform_device *);
178 void platform_device_put(struct platform_device *);
199 int __platform_driver_register(struct platform_driver *, struct module *);
201 void platform_driver_unregister(struct platform_driver *);
211 void * platform_get_drvdata(const struct platform_device *pdev);
139 int request_threaded_irq(unsigned int, irqreturn_t (*)(int, void *), irqreturn_t (*)(int, void *), unsigned long, const char *, void *);
144 int request_irq(unsigned int irq, irqreturn_t (*handler)(int, void *), unsigned long flags, const char *name, void *dev);
158 void free_irq(unsigned int, void *);
558 void __tasklet_schedule(struct tasklet_struct *);
560 void tasklet_schedule(struct tasklet_struct *t);
566 void __tasklet_hi_schedule(struct tasklet_struct *);
568 void tasklet_hi_schedule(struct tasklet_struct *t);
608 void tasklet_kill(struct tasklet_struct *);
610 void tasklet_init(struct tasklet_struct *, void (*)(unsigned long), unsigned long);
37 void debug_dma_map_page(struct device *, struct page *, size_t , size_t , int, dma_addr_t , bool );
44 void debug_dma_unmap_page(struct device *, dma_addr_t , size_t , int, bool );
1003 void * lowmem_page_address(const struct page *page);
120 struct page * sg_page(struct scatterlist *sg);
239 void * sg_virt(struct scatterlist *sg);
131 void kmemcheck_mark_initialized(void *address, unsigned int n);
136 int valid_dma_direction(int dma_direction);
28 extern struct dma_map_ops *dma_ops;
30 struct dma_map_ops * get_dma_ops(struct device *dev);
180 dma_addr_t ldv_dma_map_single_attrs_5(struct device *dev, void *ptr, size_t size, enum dma_data_direction dir, unsigned long attrs);
180 dma_addr_t dma_map_single_attrs(struct device *dev, void *ptr, size_t size, enum dma_data_direction dir, unsigned long attrs);
203 void dma_unmap_single_attrs(struct device *dev, dma_addr_t addr, size_t size, enum dma_data_direction dir, unsigned long attrs);
10 void __const_udelay(unsigned long);
26 struct resource * pnp_get_resource(struct pnp_dev *, unsigned long, unsigned int);
36 int pnp_resource_valid(struct resource *res);
58 resource_size_t pnp_port_start(struct pnp_dev *dev, unsigned int bar);
149 resource_size_t pnp_irq(struct pnp_dev *dev, unsigned int bar);
173 resource_size_t pnp_dma(struct pnp_dev *dev, unsigned int bar);
191 int pnp_dma_valid(struct pnp_dev *dev, unsigned int bar);
479 int pnp_register_driver(struct pnp_driver *);
480 void pnp_unregister_driver(struct pnp_driver *);
403 struct mmc_host * mmc_alloc_host(int, struct device *);
404 int mmc_add_host(struct mmc_host *);
405 void mmc_remove_host(struct mmc_host *);
406 void mmc_free_host(struct mmc_host *);
409 void * mmc_priv(struct mmc_host *host);
423 void mmc_detect_change(struct mmc_host *, unsigned long);
424 void mmc_request_done(struct mmc_host *, struct mmc_request *);
154 void kfree(const void *);
330 void * __kmalloc(size_t , gfp_t );
478 void * kmalloc(size_t size, gfp_t flags);
150 extern struct spinlock dma_spin_lock;
152 unsigned long int claim_dma_lock();
159 void release_dma_lock(unsigned long flags);
166 void enable_dma(unsigned int dmanr);
174 void disable_dma(unsigned int dmanr);
189 void clear_dma_ff(unsigned int dmanr);
198 void set_dma_mode(unsigned int dmanr, char mode);
211 void set_dma_page(unsigned int dmanr, char pagenr);
242 void set_dma_addr(unsigned int dmanr, unsigned int a);
263 void set_dma_count(unsigned int dmanr, unsigned int count);
287 int get_dma_residue(unsigned int dmanr);
305 int request_dma(unsigned int, const char *);
306 void free_dma(unsigned int);
58 const struct pnp_device_id pnp_dev_table[3U] = { { { 'W', 'E', 'C', '0', '5', '1', '7', '\x0' }, 0UL }, { { 'W', 'E', 'C', '0', '5', '1', '8', '\x0' }, 0UL }, { { '\x0' }, 0UL } };
64 const struct pnp_device_id __mod_pnp__pnp_dev_table_device_table[3U] = { };
68 const int config_ports[2U] = { 46, 78 };
69 const int unlock_codes[2U] = { 131, 135 };
71 const int valid_ids[1U] = { 28946 };
76 unsigned int param_nopnp = 0U;
80 unsigned int param_io = 584U;
81 unsigned int param_irq = 6U;
82 int param_dma = 2;
88 void wbsd_unlock_config(struct wbsd_host *host);
96 void wbsd_lock_config(struct wbsd_host *host);
103 void wbsd_write_config(struct wbsd_host *host, u8 reg, u8 value);
111 u8 wbsd_read_config(struct wbsd_host *host, u8 reg);
119 void wbsd_write_index(struct wbsd_host *host, u8 index, u8 value);
125 u8 wbsd_read_index(struct wbsd_host *host, u8 index);
135 void wbsd_init_device(struct wbsd_host *host);
194 void wbsd_reset(struct wbsd_host *host);
208 void wbsd_request_end(struct wbsd_host *host, struct mmc_request *mrq);
241 void wbsd_init_sg(struct wbsd_host *host, struct mmc_data *data);
253 int wbsd_next_sg(struct wbsd_host *host);
272 char * wbsd_sg_to_buffer(struct wbsd_host *host);
277 void wbsd_sg_to_dma(struct wbsd_host *host, struct mmc_data *data);
294 void wbsd_dma_to_sg(struct wbsd_host *host, struct mmc_data *data);
315 void wbsd_get_short_reply(struct wbsd_host *host, struct mmc_command *cmd);
333 void wbsd_get_long_reply(struct wbsd_host *host, struct mmc_command *cmd);
358 void wbsd_send_command(struct wbsd_host *host, struct mmc_command *cmd);
418 void wbsd_empty_fifo(struct wbsd_host *host);
480 void wbsd_fill_fifo(struct wbsd_host *host);
542 void wbsd_prepare_data(struct wbsd_host *host, struct mmc_data *data);
677 void wbsd_finish_data(struct wbsd_host *host, struct mmc_data *data);
755 void wbsd_request(struct mmc_host *mmc, struct mmc_request *mrq);
851 void wbsd_set_ios(struct mmc_host *mmc, struct mmc_ios *ios);
924 int wbsd_get_ro(struct mmc_host *mmc);
946 const struct mmc_host_ops wbsd_ops = { 0, 0, &wbsd_request, &wbsd_set_ios, &wbsd_get_ro, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
962 void wbsd_reset_ignore(unsigned long data);
987 struct mmc_data * wbsd_get_data(struct wbsd_host *host);
1004 void wbsd_tasklet_card(unsigned long param);
1053 void wbsd_tasklet_fifo(unsigned long param);
1084 void wbsd_tasklet_crc(unsigned long param);
1108 void wbsd_tasklet_timeout(unsigned long param);
1132 void wbsd_tasklet_finish(unsigned long param);
1157 irqreturn_t wbsd_irq(int irq, void *dev_id);
1199 int wbsd_alloc_mmc(struct device *dev);
1268 void wbsd_free_mmc(struct device *dev);
1291 int wbsd_scan(struct wbsd_host *host);
1347 int wbsd_request_region(struct wbsd_host *host, int base);
1360 void wbsd_release_regions(struct wbsd_host *host);
1377 void wbsd_request_dma(struct wbsd_host *host, int dma);
1436 void wbsd_release_dma(struct wbsd_host *host);
1455 int wbsd_request_irq(struct wbsd_host *host, int irq);
1485 void wbsd_release_irq(struct wbsd_host *host);
1505 int wbsd_request_resources(struct wbsd_host *host, int base, int irq, int dma);
1536 void wbsd_release_resources(struct wbsd_host *host);
1547 void wbsd_chip_config(struct wbsd_host *host);
1591 int wbsd_chip_validate(struct wbsd_host *host);
1631 void wbsd_chip_poweroff(struct wbsd_host *host);
1647 int wbsd_init(struct device *dev, int base, int irq, int dma, int pnp);
1733 void wbsd_shutdown(struct device *dev, int pnp);
1760 int wbsd_probe(struct platform_device *dev);
1766 int wbsd_remove(struct platform_device *dev);
1780 int wbsd_pnp_probe(struct pnp_dev *pnpdev, const struct pnp_device_id *dev_id);
1799 void wbsd_pnp_remove(struct pnp_dev *dev);
1812 int wbsd_platform_suspend(struct platform_device *dev, pm_message_t state);
1829 int wbsd_platform_resume(struct platform_device *dev);
1854 int wbsd_pnp_suspend(struct pnp_dev *pnp_dev, pm_message_t state);
1865 int wbsd_pnp_resume(struct pnp_dev *pnp_dev);
1908 struct platform_device *wbsd_device = 0;
1910 struct platform_driver wbsd_driver = { &wbsd_probe, &wbsd_remove, 0, &wbsd_platform_suspend, &wbsd_platform_resume, { "wbsd", 0, 0, 0, (_Bool)0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 0, (_Bool)0 };
1923 struct pnp_driver wbsd_pnp_driver = { (char *)"wbsd", (const struct pnp_device_id *)(&pnp_dev_table), 0U, &wbsd_pnp_probe, &wbsd_pnp_remove, 0, &wbsd_pnp_suspend, &wbsd_pnp_resume, { 0, 0, 0, 0, (_Bool)0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } };
1939 int wbsd_drv_init();
1978 void wbsd_drv_exit();
2032 void ldv_check_final_state();
2035 void ldv_check_return_value(int);
2038 void ldv_check_return_value_probe(int);
2041 void ldv_initialize();
2044 void ldv_handler_precall();
2047 int nondet_int();
2050 int LDV_IN_INTERRUPT = 0;
2053 void ldv_main0_sequence_infinite_withcheck_stateful();
10 void ldv_error();
7 bool ldv_is_err(const void *ptr);
14 void * ldv_err_ptr(long error);
21 long int ldv_ptr_err(const void *ptr);
28 bool ldv_is_err_or_null(const void *ptr);
5 int LDV_DMA_MAP_CALLS = 0;
16 void ldv_dma_mapping_error();
return ;
}
-entry_point
{
2055 struct mmc_host *var_group1;
2056 struct mmc_request *var_group2;
2057 struct mmc_ios *var_group3;
2058 struct platform_device *var_group4;
2059 int res_wbsd_probe_48;
2060 struct pm_message var_wbsd_platform_suspend_52_p1;
2061 struct pnp_dev *var_group5;
2062 const struct pnp_device_id *var_wbsd_pnp_probe_50_p1;
2063 int res_wbsd_pnp_probe_50;
2064 struct pm_message var_wbsd_pnp_suspend_54_p1;
2065 int var_wbsd_irq_31_p0;
2066 void *var_wbsd_irq_31_p1;
2067 unsigned long var_wbsd_reset_ignore_24_p0;
2068 int ldv_s_wbsd_driver_platform_driver;
2069 int ldv_s_wbsd_pnp_driver_pnp_driver;
2070 int tmp;
2071 int tmp___0;
2072 int tmp___1;
2675 ldv_s_wbsd_driver_platform_driver = 0;
2677 ldv_s_wbsd_pnp_driver_pnp_driver = 0;
2619 LDV_IN_INTERRUPT = 1;
2628 ldv_initialize() { /* Function call is skipped due to function is undefined */}
2662 ldv_handler_precall() { /* Function call is skipped due to function is undefined */}
2663 -wbsd_drv_init()
{
1941 int result;
1943 printk("\016wbsd: Winbond W83L51xD SD/MMC card interface driver\n") { /* Function call is skipped due to function is undefined */}
1945 printk("\016wbsd: Copyright(c) Pierre Ossman\n") { /* Function call is skipped due to function is undefined */}
1949 assume(param_nopnp == 0U);
1950 result = pnp_register_driver(&wbsd_pnp_driver) { /* Function call is skipped due to function is undefined */}
1951 assume(!(result < 0));
1956 assume(!(param_nopnp != 0U));
1975 return 0;;
}
2663 assume(!(tmp != 0));
2685 goto ldv_35745;
2685 tmp___1 = nondet_int() { /* Function call is skipped due to function is undefined */}
2685 assume(tmp___1 != 0);
2689 goto ldv_35744;
2686 ldv_35744:;
2690 tmp___0 = nondet_int() { /* Function call is skipped due to function is undefined */}
2690 switch (tmp___0);
2691 assume(!(tmp___0 == 0));
2745 assume(!(tmp___0 == 1));
2800 assume(!(tmp___0 == 2));
2855 assume(tmp___0 == 3);
2858 assume(ldv_s_wbsd_driver_platform_driver == 0);
2878 -wbsd_probe(var_group4)
{
1762 int tmp;
1763 -wbsd_init(&(dev->dev), (int)param_io, (int)param_irq, param_dma, 0)
{
1649 struct wbsd_host *host;
1650 struct mmc_host *mmc;
1651 int ret;
1652 void *tmp;
1653 void *tmp___0;
1654 int tmp___1;
1655 unsigned long __ms;
1656 unsigned long tmp___2;
1657 const char *tmp___3;
1650 host = (struct wbsd_host *)0;
1651 mmc = (struct mmc_host *)0;
1654 -wbsd_alloc_mmc(dev)
{
1201 struct mmc_host *mmc;
1202 struct wbsd_host *host;
1203 void *tmp;
1204 struct lock_class_key __key;
1205 struct lock_class_key __key___0;
1207 mmc = mmc_alloc_host(496, dev) { /* Function call is skipped due to function is undefined */}
1208 assume(!(((unsigned long)mmc) == ((unsigned long)((struct mmc_host *)0))));
1211 -mmc_priv(mmc)
{
411 return (void *)(&(host->private));;
}
1211 host = (struct wbsd_host *)tmp;
1212 host->mmc = mmc;
1214 host->dma = -1;
1219 mmc->ops = &wbsd_ops;
1220 mmc->f_min = 375000U;
1221 mmc->f_max = 24000000U;
1222 mmc->ocr_avail = 3145728U;
1223 mmc->caps = 1U;
1225 -spinlock_check(&(host->lock))
{
291 return &(lock->__annonCompField20.rlock);;
}
1225 __raw_spin_lock_init(&(host->lock.__annonCompField20.rlock), "&(&host->lock)->rlock", &__key) { /* Function call is skipped due to function is undefined */}
1230 init_timer_key(&(host->ignore_timer), 0U, "(&host->ignore_timer)", &__key___0) { /* Function call is skipped due to function is undefined */}
1231 host->ignore_timer.data = (unsigned long)host;
1232 host->ignore_timer.function = &wbsd_reset_ignore;
1238 mmc->max_segs = 128U;
1243 mmc->max_req_size = 65536U;
1249 mmc->max_seg_size = mmc->max_req_size;
1255 mmc->max_blk_size = 4087U;
1261 mmc->max_blk_count = mmc->max_req_size;
1263 -dev_set_drvdata(dev, (void *)mmc)
{
922 dev->driver_data = data;
923 return ;;
}
1265 return 0;;
}
1655 assume(!(ret != 0));
1658 -dev_get_drvdata((const struct device *)dev)
{
917 void *__CPAchecker_TMP_0 = (void *)(dev->driver_data);
917 return __CPAchecker_TMP_0;;
}
1658 mmc = (struct mmc_host *)tmp;
1659 -mmc_priv(mmc)
{
411 return (void *)(&(host->private));;
}
1659 host = (struct wbsd_host *)tmp___0;
1664 -wbsd_scan(host)
{
1293 int i;
1294 int j;
1295 int k;
1296 int id;
1297 struct resource *tmp;
1298 unsigned char tmp___0;
1299 unsigned char tmp___1;
1300 struct _ddebug descriptor;
1301 long tmp___2;
1300 i = 0;
1300 goto ldv_35470;
1300 assume(((unsigned int)i) <= 1U);
1302 goto ldv_35469;
1301 ldv_35469:;
1301 tmp = __request_region(&ioport_resource, (resource_size_t )(config_ports[i]), 2ULL, "wbsd", 0) { /* Function call is skipped due to function is undefined */}
1301 assume(!(((unsigned long)tmp) == ((unsigned long)((struct resource *)0))));
1304 j = 0;
1304 goto ldv_35467;
1304 assume(((unsigned int)j) <= 1U);
1306 goto ldv_35466;
1305 ldv_35466:;
1305 id = 65535;
1307 host->config = config_ports[i];
1308 host->unlock_code = (u8 )(unlock_codes[j]);
1310 -wbsd_unlock_config(host)
{
90 long tmp;
90 tmp = __builtin_expect((host->config) == 0, 0L) { /* Function call is skipped due to function is undefined */}
90 assume(!(tmp != 0L));
92 int __CPAchecker_TMP_0 = (int)(host->unlock_code);
92 -outb(__CPAchecker_TMP_0, host->config)
{
316 Ignored inline assembler code
317 return ;;
}
93 int __CPAchecker_TMP_1 = (int)(host->unlock_code);
93 -outb(__CPAchecker_TMP_1, host->config)
{
316 Ignored inline assembler code
317 return ;;
}
94 return ;;
}
1312 -outb(32, config_ports[i])
{
316 Ignored inline assembler code
317 return ;;
}
1313 -inb(((int)(config_ports[i])) + 1)
{
318 unsigned char value;
316 Ignored inline assembler code
316 return value;;
}
1313 id = ((int)tmp___0) << 8;
1315 -outb(33, config_ports[i])
{
316 Ignored inline assembler code
317 return ;;
}
1316 -inb(((int)(config_ports[i])) + 1)
{
318 unsigned char value;
316 Ignored inline assembler code
316 return value;;
}
1316 id = ((int)tmp___1) | id;
1318 -wbsd_lock_config(host)
{
98 long tmp;
98 tmp = __builtin_expect((host->config) == 0, 0L) { /* Function call is skipped due to function is undefined */}
98 assume(!(tmp != 0L));
100 -outb(170, host->config)
{
316 Ignored inline assembler code
317 return ;;
}
101 return ;;
}
1320 k = 0;
1320 goto ldv_35462;
1320 assume(k == 0);
1322 goto ldv_35461;
1321 ldv_35461:;
1321 assume(((int)(valid_ids[k])) == id);
1322 host->chip_id = id;
1324 return 0;;
}
1665 assume(!(ret != 0));
1677 -wbsd_request_resources(host, base, irq, dma)
{
1507 int ret;
1513 -wbsd_request_region(host, base)
{
1349 struct resource *tmp;
1349 assume(!((base & 7) != 0));
1352 tmp = __request_region(&ioport_resource, (resource_size_t )base, 8ULL, "wbsd", 0) { /* Function call is skipped due to function is undefined */}
1352 assume(!(((unsigned long)tmp) == ((unsigned long)((struct resource *)0))));
1355 host->base = base;
1357 return 0;;
}
1514 assume(!(ret != 0));
1520 -wbsd_request_irq(host, irq)
{
1457 int ret;
1462 tasklet_init(&(host->card_tasklet), &wbsd_tasklet_card, (unsigned long)host) { /* Function call is skipped due to function is undefined */}
1464 tasklet_init(&(host->fifo_tasklet), &wbsd_tasklet_fifo, (unsigned long)host) { /* Function call is skipped due to function is undefined */}
1466 tasklet_init(&(host->crc_tasklet), &wbsd_tasklet_crc, (unsigned long)host) { /* Function call is skipped due to function is undefined */}
1468 tasklet_init(&(host->timeout_tasklet), &wbsd_tasklet_timeout, (unsigned long)host) { /* Function call is skipped due to function is undefined */}
1470 tasklet_init(&(host->finish_tasklet), &wbsd_tasklet_finish, (unsigned long)host) { /* Function call is skipped due to function is undefined */}
1476 -request_irq((unsigned int)irq, &wbsd_irq, 128UL, "wbsd", (void *)host)
{
147 int tmp;
147 tmp = request_threaded_irq(irq, handler, (irqreturn_t (*)(int, void *))0, flags, name, dev) { /* Function call is skipped due to function is undefined */}
147 return tmp;;
}
1477 assume(!(ret != 0));
1480 host->irq = irq;
1482 return 0;;
}
1521 assume(!(ret != 0));
1527 -wbsd_request_dma(host, dma)
{
1379 int tmp;
1380 void *tmp___0;
1379 assume(!(dma < 0));
1382 tmp = request_dma((unsigned int)dma, "wbsd") { /* Function call is skipped due to function is undefined */}
1382 assume(!(tmp != 0));
1389 -kmalloc(65536UL, 37750273U)
{
480 void *tmp___2;
495 tmp___2 = __kmalloc(size, flags) { /* Function call is skipped due to function is undefined */}
495 return tmp___2;;
}
1389 host->dma_buffer = (char *)tmp___0;
1391 unsigned long __CPAchecker_TMP_0 = (unsigned long)(host->dma_buffer);
1391 assume(!(__CPAchecker_TMP_0 == ((unsigned long)((char *)0))));
1397 void *__CPAchecker_TMP_1 = (void *)(host->dma_buffer);
1397 -dma_map_single_attrs(host->mmc->parent, __CPAchecker_TMP_1, 65536UL, 0, 0UL)
{
38 unsigned long long tmp;
38 -ldv_dma_map_page()
{
10 assume(!(LDV_DMA_MAP_CALLS != 0));
12 LDV_DMA_MAP_CALLS = LDV_DMA_MAP_CALLS + 1;
13 return ;;
}
40 -ldv_dma_map_single_attrs_5(dev, ptr, size, dir, attrs)
{
184 struct dma_map_ops *ops;
185 struct dma_map_ops *tmp;
186 unsigned long long addr;
187 int tmp___0;
188 long tmp___1;
189 unsigned long tmp___2;
190 unsigned long tmp___3;
185 -get_dma_ops(dev)
{
32 long tmp;
35 tmp = __builtin_expect(((unsigned long)dev) == ((unsigned long)((struct device *)0)), 0L) { /* Function call is skipped due to function is undefined */}
35 assume(!(tmp != 0L));
35 assume(!(((unsigned long)(dev->archdata.dma_ops)) == ((unsigned long)((struct dma_map_ops *)0))));
38 return dev->archdata.dma_ops;;
}
185 ops = tmp;
188 -kmemcheck_mark_initialized(ptr, (unsigned int)size)
{
133 return ;;
}
189 -valid_dma_direction((int)dir)
{
138 int __CPAchecker_TMP_0;
138 assume(dma_direction == 0);
__CPAchecker_TMP_0 = 1;
138 return __CPAchecker_TMP_0;;
}
189 tmp___1 = __builtin_expect(tmp___0 == 0, 0L) { /* Function call is skipped due to function is undefined */}
189 assume(!(tmp___1 != 0L));
190 tmp___2 = __phys_addr((unsigned long)ptr) { /* Function call is skipped due to function is undefined */}
190 addr = (*(ops->map_page))(dev, (struct page *)((tmp___2 >> 12) + vmemmap_base), ((unsigned long)ptr) & 4095UL, size, dir, attrs);
193 tmp___3 = __phys_addr((unsigned long)ptr) { /* Function call is skipped due to function is undefined */}
193 debug_dma_map_page(dev, (struct page *)((tmp___3 >> 12) + vmemmap_base), ((unsigned long)ptr) & 4095UL, size, (int)dir, addr, 1) { /* Function call is skipped due to function is undefined */}
196 return addr;;
}
40 return tmp;;
}
1403 assume(!(((host->dma_addr) & 65535ULL) != 0ULL));
1408 assume(!((host->dma_addr) > 16777215ULL));
1411 host->dma = dma;
1413 return ;;
}
1529 return 0;;
}
1678 assume(!(ret != 0));
1687 assume(!(pnp != 0));
1693 -wbsd_chip_config(host)
{
1549 -wbsd_unlock_config(host)
{
90 long tmp;
90 tmp = __builtin_expect((host->config) == 0, 0L) { /* Function call is skipped due to function is undefined */}
90 assume(!(tmp != 0L));
92 int __CPAchecker_TMP_0 = (int)(host->unlock_code);
92 -outb(__CPAchecker_TMP_0, host->config)
{
316 Ignored inline assembler code
317 return ;;
}
93 int __CPAchecker_TMP_1 = (int)(host->unlock_code);
93 -outb(__CPAchecker_TMP_1, host->config)
{
316 Ignored inline assembler code
317 return ;;
}
94 return ;;
}
1554 -wbsd_write_config(host, 2, 1)
{
105 long tmp;
105 tmp = __builtin_expect((host->config) == 0, 0L) { /* Function call is skipped due to function is undefined */}
105 assume(!(tmp != 0L));
107 -outb((int)reg, host->config)
{
316 Ignored inline assembler code
317 return ;;
}
108 -outb((int)value, (host->config) + 1)
{
316 Ignored inline assembler code
317 return ;;
}
109 return ;;
}
1555 -wbsd_write_config(host, 2, 0)
{
105 long tmp;
105 tmp = __builtin_expect((host->config) == 0, 0L) { /* Function call is skipped due to function is undefined */}
105 assume(!(tmp != 0L));
107 -outb((int)reg, host->config)
{
316 Ignored inline assembler code
317 return ;;
}
108 -outb((int)value, (host->config) + 1)
{
316 Ignored inline assembler code
317 return ;;
}
109 return ;;
}
1560 -wbsd_write_config(host, 7, 3)
{
105 long tmp;
105 tmp = __builtin_expect((host->config) == 0, 0L) { /* Function call is skipped due to function is undefined */}
105 assume(!(tmp != 0L));
107 -outb((int)reg, host->config)
{
316 Ignored inline assembler code
317 return ;;
}
108 -outb((int)value, (host->config) + 1)
{
316 Ignored inline assembler code
317 return ;;
}
109 return ;;
}
1565 -wbsd_write_config(host, 240, 2)
{
105 long tmp;
105 tmp = __builtin_expect((host->config) == 0, 0L) { /* Function call is skipped due to function is undefined */}
105 assume(!(tmp != 0L));
107 -outb((int)reg, host->config)
{
316 Ignored inline assembler code
317 return ;;
}
108 -outb((int)value, (host->config) + 1)
{
316 Ignored inline assembler code
317 return ;;
}
109 return ;;
}
1570 -wbsd_write_config(host, 96, (int)((u8 )((host->base) >> 8)))
{
105 long tmp;
105 tmp = __builtin_expect((host->config) == 0, 0L) { /* Function call is skipped due to function is undefined */}
105 assume(!(tmp != 0L));
107 -outb((int)reg, host->config)
{
316 Ignored inline assembler code
317 return ;;
}
108 -outb((int)value, (host->config) + 1)
{
316 Ignored inline assembler code
317 return ;;
}
109 return ;;
}
1571 u8 __CPAchecker_TMP_0 = (u8 )(host->base);
1571 -wbsd_write_config(host, 97, (int)__CPAchecker_TMP_0)
{
105 long tmp;
105 tmp = __builtin_expect((host->config) == 0, 0L) { /* Function call is skipped due to function is undefined */}
105 assume(!(tmp != 0L));
107 -outb((int)reg, host->config)
{
316 Ignored inline assembler code
317 return ;;
}
108 -outb((int)value, (host->config) + 1)
{
316 Ignored inline assembler code
317 return ;;
}
109 return ;;
}
1573 u8 __CPAchecker_TMP_1 = (u8 )(host->irq);
1573 -wbsd_write_config(host, 112, (int)__CPAchecker_TMP_1)
{
105 long tmp;
105 tmp = __builtin_expect((host->config) == 0, 0L) { /* Function call is skipped due to function is undefined */}
105 assume(!(tmp != 0L));
107 -outb((int)reg, host->config)
{
316 Ignored inline assembler code
317 return ;;
}
108 -outb((int)value, (host->config) + 1)
{
316 Ignored inline assembler code
317 return ;;
}
109 return ;;
}
1575 assume((host->dma) >= 0);
1576 u8 __CPAchecker_TMP_2 = (u8 )(host->dma);
1576 -wbsd_write_config(host, 116, (int)__CPAchecker_TMP_2)
{
105 long tmp;
105 tmp = __builtin_expect((host->config) == 0, 0L) { /* Function call is skipped due to function is undefined */}
105 assume(!(tmp != 0L));
107 -outb((int)reg, host->config)
{
316 Ignored inline assembler code
317 return ;;
}
108 -outb((int)value, (host->config) + 1)
{
316 Ignored inline assembler code
317 return ;;
}
109 return ;;
}
1581 -wbsd_write_config(host, 48, 1)
{
105 long tmp;
105 tmp = __builtin_expect((host->config) == 0, 0L) { /* Function call is skipped due to function is undefined */}
105 assume(!(tmp != 0L));
107 -outb((int)reg, host->config)
{
316 Ignored inline assembler code
317 return ;;
}
108 -outb((int)value, (host->config) + 1)
{
316 Ignored inline assembler code
317 return ;;
}
109 return ;;
}
1582 -wbsd_write_config(host, 34, 32)
{
105 long tmp;
105 tmp = __builtin_expect((host->config) == 0, 0L) { /* Function call is skipped due to function is undefined */}
105 assume(!(tmp != 0L));
107 -outb((int)reg, host->config)
{
316 Ignored inline assembler code
317 return ;;
}
108 -outb((int)value, (host->config) + 1)
{
316 Ignored inline assembler code
317 return ;;
}
109 return ;;
}
1584 -wbsd_lock_config(host)
{
98 long tmp;
98 tmp = __builtin_expect((host->config) == 0, 0L) { /* Function call is skipped due to function is undefined */}
98 assume(!(tmp != 0L));
100 -outb(170, host->config)
{
316 Ignored inline assembler code
317 return ;;
}
101 return ;;
}
1585 return ;;
}
1700 assume(!((host->config) != 0));
1709 __const_udelay(21475000UL) { /* Function call is skipped due to function is undefined */}
1714 -wbsd_init_device(host)
{
137 unsigned char setup;
138 unsigned char ier;
139 unsigned char tmp;
142 -wbsd_read_index(host, 6)
{
127 unsigned char tmp;
127 -outb((int)index, (host->base) + 5)
{
316 Ignored inline assembler code
317 return ;;
}
128 -inb((host->base) + 6)
{
318 unsigned char value;
316 Ignored inline assembler code
316 return value;;
}
128 return tmp;;
}
143 setup = (u8 )(((unsigned int)setup) | 6U);
144 -wbsd_write_index(host, 6, (int)setup)
{
121 -outb((int)index, (host->base) + 5)
{
316 Ignored inline assembler code
317 return ;;
}
122 -outb((int)value, (host->base) + 6)
{
316 Ignored inline assembler code
317 return ;;
}
123 return ;;
}
149 setup = ((unsigned int)setup) & 247U;
150 -wbsd_write_index(host, 6, (int)setup)
{
121 -outb((int)index, (host->base) + 5)
{
316 Ignored inline assembler code
317 return ;;
}
122 -outb((int)value, (host->base) + 6)
{
316 Ignored inline assembler code
317 return ;;
}
123 return ;;
}
151 host->flags = (host->flags) & -3;
156 -wbsd_read_index(host, 1)
{
127 unsigned char tmp;
127 -outb((int)index, (host->base) + 5)
{
316 Ignored inline assembler code
317 return ;;
}
128 -inb((host->base) + 6)
{
318 unsigned char value;
316 Ignored inline assembler code
316 return value;;
}
128 return tmp;;
}
161 -outb(16, (host->base) + 7)
{
316 Ignored inline assembler code
317 return ;;
}
166 -wbsd_write_index(host, 3, 127)
{
121 -outb((int)index, (host->base) + 5)
{
316 Ignored inline assembler code
317 return ;;
}
122 -outb((int)value, (host->base) + 6)
{
316 Ignored inline assembler code
317 return ;;
}
123 return ;;
}
171 -inb((host->base) + 7)
{
318 unsigned char value;
316 Ignored inline assembler code
316 return value;;
}
171 assume(!((((int)tmp) & 1) == 0));
172 host->flags = (host->flags) | 1;
179 ier = 0U;
180 ier = (u8 )(((unsigned int)ier) | 64U);
181 ier = (u8 )(((unsigned int)ier) | 32U);
182 ier = (u8 )(((unsigned int)ier) | 16U);
183 ier = (u8 )(((unsigned int)ier) | 8U);
184 ier = (u8 )(((unsigned int)ier) | 1U);
186 -outb((int)ier, (host->base) + 2)
{
316 Ignored inline assembler code
317 return ;;
}
191 -inb((host->base) + 3)
{
318 unsigned char value;
316 Ignored inline assembler code
316 return value;;
}
192 return ;;
}
1716 mmc_add_host(mmc) { /* Function call is skipped due to function is undefined */}
1718 -dev_name((const struct device *)(&(mmc->class_dev)))
{
870 const char *tmp;
871 unsigned long __CPAchecker_TMP_0 = (unsigned long)(dev->init_name);
871 assume(!(__CPAchecker_TMP_0 != ((unsigned long)((const char *)0))));
874 -kobject_name(&(dev->kobj))
{
89 const char *__CPAchecker_TMP_0 = (const char *)(kobj->name);
89 return __CPAchecker_TMP_0;;
}
874 return tmp;;
}
1718 printk("\016%s: W83L51xD", tmp___3) { /* Function call is skipped due to function is undefined */}
1719 assume(!((host->chip_id) != 0));
1721 printk(" at 0x%x irq %d", host->base, host->irq) { /* Function call is skipped due to function is undefined */}
1722 assume((host->dma) >= 0);
1723 printk(" dma %d", host->dma) { /* Function call is skipped due to function is undefined */}
1726 assume(!(pnp != 0));
1728 printk("\n") { /* Function call is skipped due to function is undefined */}
1730 return 0;;
}
1763 return tmp;;
}
2879 ldv_check_return_value(res_wbsd_probe_48) { /* Function call is skipped due to function is undefined */}
2880 ldv_check_return_value_probe(res_wbsd_probe_48) { /* Function call is skipped due to function is undefined */}
2881 assume(!(res_wbsd_probe_48 != 0));
2906 ldv_s_wbsd_driver_platform_driver = ldv_s_wbsd_driver_platform_driver + 1;
2912 goto ldv_35729;
3413 ldv_35729:;
3414 ldv_35745:;
2685 tmp___1 = nondet_int() { /* Function call is skipped due to function is undefined */}
2685 assume(tmp___1 != 0);
2689 goto ldv_35744;
2686 ldv_35744:;
2690 tmp___0 = nondet_int() { /* Function call is skipped due to function is undefined */}
2690 switch (tmp___0);
2691 assume(!(tmp___0 == 0));
2745 assume(!(tmp___0 == 1));
2800 assume(!(tmp___0 == 2));
2855 assume(!(tmp___0 == 3));
2913 assume(!(tmp___0 == 4));
2968 assume(!(tmp___0 == 5));
3023 assume(!(tmp___0 == 6));
3078 assume(tmp___0 == 7);
3081 assume(ldv_s_wbsd_pnp_driver_pnp_driver == 0);
3102 -wbsd_pnp_probe(var_group5, var_wbsd_pnp_probe_50_p1)
{
1782 int io;
1783 int irq;
1784 int dma;
1785 unsigned long long tmp;
1786 unsigned long long tmp___0;
1787 unsigned long long tmp___1;
1788 int tmp___2;
1789 struct _ddebug descriptor;
1790 long tmp___3;
1791 int tmp___4;
1787 -pnp_port_start(pnpdev, 0U)
{
60 struct resource *res;
61 struct resource *tmp;
62 int tmp___0;
61 tmp = pnp_get_resource(dev, 256UL, bar) { /* Function call is skipped due to function is undefined */}
61 res = tmp;
63 -pnp_resource_valid(res)
{
38 assume(!(((unsigned long)res) != ((unsigned long)((struct resource *)0))));
40 return 0;;
}
63 assume(!(tmp___0 != 0));
65 return 0ULL;;
}
1787 io = (int)tmp;
1788 -pnp_irq(pnpdev, 0U)
{
151 struct resource *res;
152 struct resource *tmp;
153 int tmp___0;
151 tmp = pnp_get_resource(dev, 1024UL, bar) { /* Function call is skipped due to function is undefined */}
151 res = tmp;
153 -pnp_resource_valid(res)
{
38 assume(!(((unsigned long)res) != ((unsigned long)((struct resource *)0))));
40 return 0;;
}
153 assume(!(tmp___0 != 0));
155 return 18446744073709551615ULL;;
}
1788 irq = (int)tmp___0;
1789 -pnp_dma_valid(pnpdev, 0U)
{
193 struct resource *tmp;
194 int tmp___0;
193 tmp = pnp_get_resource(dev, 2048UL, bar) { /* Function call is skipped due to function is undefined */}
193 -pnp_resource_valid(tmp)
{
38 assume(((unsigned long)res) != ((unsigned long)((struct resource *)0)));
39 return 1;;
}
193 return tmp___0;;
}
1789 assume(tmp___2 != 0);
1790 -pnp_dma(pnpdev, 0U)
{
175 struct resource *res;
176 struct resource *tmp;
177 int tmp___0;
175 tmp = pnp_get_resource(dev, 2048UL, bar) { /* Function call is skipped due to function is undefined */}
175 res = tmp;
177 -pnp_resource_valid(res)
{
38 assume(((unsigned long)res) != ((unsigned long)((struct resource *)0)));
39 return 1;;
}
177 assume(tmp___0 != 0);
178 return res->start;;
}
1790 dma = (int)tmp___1;
1794 descriptor.modname = "wbsd";
1794 descriptor.function = "wbsd_pnp_probe";
1794 descriptor.filename = "/home/vitaly/ldv-launches/work/current--X--drivers--X--defaultlinux-4.9-rc1.tar.xz--X--331_1a--X--cpachecker/linux-4.9-rc1.tar.xz/csd_deg_dscv/2264/dscv_tempdir/dscv/ri/331_1a/drivers/mmc/host/wbsd.c";
1794 descriptor.format = "wbsd [%s()]: PnP resources: port %3x irq %d dma %d\n";
1794 descriptor.lineno = 1794U;
1794 descriptor.flags = 0U;
1794 tmp___3 = __builtin_expect(((long)(descriptor.flags)) & 1L, 0L) { /* Function call is skipped due to function is undefined */}
1794 assume(tmp___3 != 0L);
1794 __dynamic_pr_debug(&descriptor, "wbsd [%s()]: PnP resources: port %3x irq %d dma %d\n", "wbsd_pnp_probe", io, irq, dma) { /* Function call is skipped due to function is undefined */}
1796 -wbsd_init(&(pnpdev->dev), io, irq, dma, 1)
{
1649 struct wbsd_host *host;
1650 struct mmc_host *mmc;
1651 int ret;
1652 void *tmp;
1653 void *tmp___0;
1654 int tmp___1;
1655 unsigned long __ms;
1656 unsigned long tmp___2;
1657 const char *tmp___3;
1650 host = (struct wbsd_host *)0;
1651 mmc = (struct mmc_host *)0;
1654 -wbsd_alloc_mmc(dev)
{
1201 struct mmc_host *mmc;
1202 struct wbsd_host *host;
1203 void *tmp;
1204 struct lock_class_key __key;
1205 struct lock_class_key __key___0;
1207 mmc = mmc_alloc_host(496, dev) { /* Function call is skipped due to function is undefined */}
1208 assume(!(((unsigned long)mmc) == ((unsigned long)((struct mmc_host *)0))));
1211 -mmc_priv(mmc)
{
411 return (void *)(&(host->private));;
}
1211 host = (struct wbsd_host *)tmp;
1212 host->mmc = mmc;
1214 host->dma = -1;
1219 mmc->ops = &wbsd_ops;
1220 mmc->f_min = 375000U;
1221 mmc->f_max = 24000000U;
1222 mmc->ocr_avail = 3145728U;
1223 mmc->caps = 1U;
1225 -spinlock_check(&(host->lock))
{
291 return &(lock->__annonCompField20.rlock);;
}
1225 __raw_spin_lock_init(&(host->lock.__annonCompField20.rlock), "&(&host->lock)->rlock", &__key) { /* Function call is skipped due to function is undefined */}
1230 init_timer_key(&(host->ignore_timer), 0U, "(&host->ignore_timer)", &__key___0) { /* Function call is skipped due to function is undefined */}
1231 host->ignore_timer.data = (unsigned long)host;
1232 host->ignore_timer.function = &wbsd_reset_ignore;
1238 mmc->max_segs = 128U;
1243 mmc->max_req_size = 65536U;
1249 mmc->max_seg_size = mmc->max_req_size;
1255 mmc->max_blk_size = 4087U;
1261 mmc->max_blk_count = mmc->max_req_size;
1263 -dev_set_drvdata(dev, (void *)mmc)
{
922 dev->driver_data = data;
923 return ;;
}
1265 return 0;;
}
1655 assume(!(ret != 0));
1658 -dev_get_drvdata((const struct device *)dev)
{
917 void *__CPAchecker_TMP_0 = (void *)(dev->driver_data);
917 return __CPAchecker_TMP_0;;
}
1658 mmc = (struct mmc_host *)tmp;
1659 -mmc_priv(mmc)
{
411 return (void *)(&(host->private));;
}
1659 host = (struct wbsd_host *)tmp___0;
1664 -wbsd_scan(host)
{
1293 int i;
1294 int j;
1295 int k;
1296 int id;
1297 struct resource *tmp;
1298 unsigned char tmp___0;
1299 unsigned char tmp___1;
1300 struct _ddebug descriptor;
1301 long tmp___2;
1300 i = 0;
1300 goto ldv_35470;
1300 assume(((unsigned int)i) <= 1U);
1302 goto ldv_35469;
1301 ldv_35469:;
1301 tmp = __request_region(&ioport_resource, (resource_size_t )(config_ports[i]), 2ULL, "wbsd", 0) { /* Function call is skipped due to function is undefined */}
1301 assume(!(((unsigned long)tmp) == ((unsigned long)((struct resource *)0))));
1304 j = 0;
1304 goto ldv_35467;
1304 assume(((unsigned int)j) <= 1U);
1306 goto ldv_35466;
1305 ldv_35466:;
1305 id = 65535;
1307 host->config = config_ports[i];
1308 host->unlock_code = (u8 )(unlock_codes[j]);
1310 -wbsd_unlock_config(host)
{
90 long tmp;
90 tmp = __builtin_expect((host->config) == 0, 0L) { /* Function call is skipped due to function is undefined */}
90 assume(!(tmp != 0L));
92 int __CPAchecker_TMP_0 = (int)(host->unlock_code);
92 -outb(__CPAchecker_TMP_0, host->config)
{
316 Ignored inline assembler code
317 return ;;
}
93 int __CPAchecker_TMP_1 = (int)(host->unlock_code);
93 -outb(__CPAchecker_TMP_1, host->config)
{
316 Ignored inline assembler code
317 return ;;
}
94 return ;;
}
1312 -outb(32, config_ports[i])
{
316 Ignored inline assembler code
317 return ;;
}
1313 -inb(((int)(config_ports[i])) + 1)
{
318 unsigned char value;
316 Ignored inline assembler code
316 return value;;
}
1313 id = ((int)tmp___0) << 8;
1315 -outb(33, config_ports[i])
{
316 Ignored inline assembler code
317 return ;;
}
1316 -inb(((int)(config_ports[i])) + 1)
{
318 unsigned char value;
316 Ignored inline assembler code
316 return value;;
}
1316 id = ((int)tmp___1) | id;
1318 -wbsd_lock_config(host)
{
98 long tmp;
98 tmp = __builtin_expect((host->config) == 0, 0L) { /* Function call is skipped due to function is undefined */}
98 assume(!(tmp != 0L));
100 -outb(170, host->config)
{
316 Ignored inline assembler code
317 return ;;
}
101 return ;;
}
1320 k = 0;
1320 goto ldv_35462;
1320 assume(k == 0);
1322 goto ldv_35461;
1321 ldv_35461:;
1321 assume(((int)(valid_ids[k])) == id);
1322 host->chip_id = id;
1324 return 0;;
}
1665 assume(!(ret != 0));
1677 -wbsd_request_resources(host, base, irq, dma)
{
1507 int ret;
1513 -wbsd_request_region(host, base)
{
1349 struct resource *tmp;
1349 assume(!((base & 7) != 0));
1352 tmp = __request_region(&ioport_resource, (resource_size_t )base, 8ULL, "wbsd", 0) { /* Function call is skipped due to function is undefined */}
1352 assume(!(((unsigned long)tmp) == ((unsigned long)((struct resource *)0))));
1355 host->base = base;
1357 return 0;;
}
1514 assume(!(ret != 0));
1520 -wbsd_request_irq(host, irq)
{
1457 int ret;
1462 tasklet_init(&(host->card_tasklet), &wbsd_tasklet_card, (unsigned long)host) { /* Function call is skipped due to function is undefined */}
1464 tasklet_init(&(host->fifo_tasklet), &wbsd_tasklet_fifo, (unsigned long)host) { /* Function call is skipped due to function is undefined */}
1466 tasklet_init(&(host->crc_tasklet), &wbsd_tasklet_crc, (unsigned long)host) { /* Function call is skipped due to function is undefined */}
1468 tasklet_init(&(host->timeout_tasklet), &wbsd_tasklet_timeout, (unsigned long)host) { /* Function call is skipped due to function is undefined */}
1470 tasklet_init(&(host->finish_tasklet), &wbsd_tasklet_finish, (unsigned long)host) { /* Function call is skipped due to function is undefined */}
1476 -request_irq((unsigned int)irq, &wbsd_irq, 128UL, "wbsd", (void *)host)
{
147 int tmp;
147 tmp = request_threaded_irq(irq, handler, (irqreturn_t (*)(int, void *))0, flags, name, dev) { /* Function call is skipped due to function is undefined */}
147 return tmp;;
}
1477 assume(!(ret != 0));
1480 host->irq = irq;
1482 return 0;;
}
1521 assume(!(ret != 0));
1527 -wbsd_request_dma(host, dma)
{
1379 int tmp;
1380 void *tmp___0;
1379 assume(!(dma < 0));
1382 tmp = request_dma((unsigned int)dma, "wbsd") { /* Function call is skipped due to function is undefined */}
1382 assume(!(tmp != 0));
1389 -kmalloc(65536UL, 37750273U)
{
480 void *tmp___2;
495 tmp___2 = __kmalloc(size, flags) { /* Function call is skipped due to function is undefined */}
495 return tmp___2;;
}
1389 host->dma_buffer = (char *)tmp___0;
1391 unsigned long __CPAchecker_TMP_0 = (unsigned long)(host->dma_buffer);
1391 assume(!(__CPAchecker_TMP_0 == ((unsigned long)((char *)0))));
1397 void *__CPAchecker_TMP_1 = (void *)(host->dma_buffer);
1397 -dma_map_single_attrs(host->mmc->parent, __CPAchecker_TMP_1, 65536UL, 0, 0UL)
{
38 unsigned long long tmp;
38 -ldv_dma_map_page()
{
10 assume(LDV_DMA_MAP_CALLS != 0);
10 -ldv_error()
{
15 LDV_ERROR:;
}
}
}
}
}
}
}
}
Source code
1 #ifndef _ASM_X86_DMA_MAPPING_H 2 #define _ASM_X86_DMA_MAPPING_H 3 4 /* 5 * IOMMU interface. See Documentation/DMA-API-HOWTO.txt and 6 * Documentation/DMA-API.txt for documentation. 7 */ 8 9 #include <linux/kmemcheck.h> 10 #include <linux/scatterlist.h> 11 #include <linux/dma-debug.h> 12 #include <asm/io.h> 13 #include <asm/swiotlb.h> 14 #include <linux/dma-contiguous.h> 15 16 #ifdef CONFIG_ISA 17 # define ISA_DMA_BIT_MASK DMA_BIT_MASK(24) 18 #else 19 # define ISA_DMA_BIT_MASK DMA_BIT_MASK(32) 20 #endif 21 22 #define DMA_ERROR_CODE 0 23 24 extern int iommu_merge; 25 extern struct device x86_dma_fallback_dev; 26 extern int panic_on_overflow; 27 28 extern struct dma_map_ops *dma_ops; 29 30 static inline struct dma_map_ops *get_dma_ops(struct device *dev) 31 { 32 #ifndef CONFIG_X86_DEV_DMA_OPS 33 return dma_ops; 34 #else 35 if (unlikely(!dev) || !dev->archdata.dma_ops) 36 return dma_ops; 37 else 38 return dev->archdata.dma_ops; 39 #endif 40 } 41 42 bool arch_dma_alloc_attrs(struct device **dev, gfp_t *gfp); 43 #define arch_dma_alloc_attrs arch_dma_alloc_attrs 44 45 #define HAVE_ARCH_DMA_SUPPORTED 1 46 extern int dma_supported(struct device *hwdev, u64 mask); 47 48 extern void *dma_generic_alloc_coherent(struct device *dev, size_t size, 49 dma_addr_t *dma_addr, gfp_t flag, 50 unsigned long attrs); 51 52 extern void dma_generic_free_coherent(struct device *dev, size_t size, 53 void *vaddr, dma_addr_t dma_addr, 54 unsigned long attrs); 55 56 #ifdef CONFIG_X86_DMA_REMAP /* Platform code defines bridge-specific code */ 57 extern bool dma_capable(struct device *dev, dma_addr_t addr, size_t size); 58 extern dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr); 59 extern phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr); 60 #else 61 62 static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size) 63 { 64 if (!dev->dma_mask) 65 return 0; 66 67 return addr + size - 1 <= *dev->dma_mask; 68 } 69 70 static inline dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr) 71 { 72 return paddr; 73 } 74 75 static inline phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr) 76 { 77 return daddr; 78 } 79 #endif /* CONFIG_X86_DMA_REMAP */ 80 81 static inline void 82 dma_cache_sync(struct device *dev, void *vaddr, size_t size, 83 enum dma_data_direction dir) 84 { 85 flush_write_buffers(); 86 } 87 88 static inline unsigned long dma_alloc_coherent_mask(struct device *dev, 89 gfp_t gfp) 90 { 91 unsigned long dma_mask = 0; 92 93 dma_mask = dev->coherent_dma_mask; 94 if (!dma_mask) 95 dma_mask = (gfp & GFP_DMA) ? DMA_BIT_MASK(24) : DMA_BIT_MASK(32); 96 97 return dma_mask; 98 } 99 100 static inline gfp_t dma_alloc_coherent_gfp_flags(struct device *dev, gfp_t gfp) 101 { 102 unsigned long dma_mask = dma_alloc_coherent_mask(dev, gfp); 103 104 if (dma_mask <= DMA_BIT_MASK(24)) 105 gfp |= GFP_DMA; 106 #ifdef CONFIG_X86_64 107 if (dma_mask <= DMA_BIT_MASK(32) && !(gfp & GFP_DMA)) 108 gfp |= GFP_DMA32; 109 #endif 110 return gfp; 111 } 112 113 #endif
1 #ifndef _ASM_X86_IO_H 2 #define _ASM_X86_IO_H 3 4 /* 5 * This file contains the definitions for the x86 IO instructions 6 * inb/inw/inl/outb/outw/outl and the "string versions" of the same 7 * (insb/insw/insl/outsb/outsw/outsl). You can also use "pausing" 8 * versions of the single-IO instructions (inb_p/inw_p/..). 9 * 10 * This file is not meant to be obfuscating: it's just complicated 11 * to (a) handle it all in a way that makes gcc able to optimize it 12 * as well as possible and (b) trying to avoid writing the same thing 13 * over and over again with slight variations and possibly making a 14 * mistake somewhere. 15 */ 16 17 /* 18 * Thanks to James van Artsdalen for a better timing-fix than 19 * the two short jumps: using outb's to a nonexistent port seems 20 * to guarantee better timings even on fast machines. 21 * 22 * On the other hand, I'd like to be sure of a non-existent port: 23 * I feel a bit unsafe about using 0x80 (should be safe, though) 24 * 25 * Linus 26 */ 27 28 /* 29 * Bit simplified and optimized by Jan Hubicka 30 * Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999. 31 * 32 * isa_memset_io, isa_memcpy_fromio, isa_memcpy_toio added, 33 * isa_read[wl] and isa_write[wl] fixed 34 * - Arnaldo Carvalho de Melo <acme@conectiva.com.br> 35 */ 36 37 #define ARCH_HAS_IOREMAP_WC 38 #define ARCH_HAS_IOREMAP_WT 39 40 #include <linux/string.h> 41 #include <linux/compiler.h> 42 #include <asm/page.h> 43 #include <asm/early_ioremap.h> 44 #include <asm/pgtable_types.h> 45 46 #define build_mmio_read(name, size, type, reg, barrier) \ 47 static inline type name(const volatile void __iomem *addr) \ 48 { type ret; asm volatile("mov" size " %1,%0":reg (ret) \ 49 :"m" (*(volatile type __force *)addr) barrier); return ret; } 50 51 #define build_mmio_write(name, size, type, reg, barrier) \ 52 static inline void name(type val, volatile void __iomem *addr) \ 53 { asm volatile("mov" size " %0,%1": :reg (val), \ 54 "m" (*(volatile type __force *)addr) barrier); } 55 56 build_mmio_read(readb, "b", unsigned char, "=q", :"memory") 57 build_mmio_read(readw, "w", unsigned short, "=r", :"memory") 58 build_mmio_read(readl, "l", unsigned int, "=r", :"memory") 59 60 build_mmio_read(__readb, "b", unsigned char, "=q", ) 61 build_mmio_read(__readw, "w", unsigned short, "=r", ) 62 build_mmio_read(__readl, "l", unsigned int, "=r", ) 63 64 build_mmio_write(writeb, "b", unsigned char, "q", :"memory") 65 build_mmio_write(writew, "w", unsigned short, "r", :"memory") 66 build_mmio_write(writel, "l", unsigned int, "r", :"memory") 67 68 build_mmio_write(__writeb, "b", unsigned char, "q", ) 69 build_mmio_write(__writew, "w", unsigned short, "r", ) 70 build_mmio_write(__writel, "l", unsigned int, "r", ) 71 72 #define readb_relaxed(a) __readb(a) 73 #define readw_relaxed(a) __readw(a) 74 #define readl_relaxed(a) __readl(a) 75 #define __raw_readb __readb 76 #define __raw_readw __readw 77 #define __raw_readl __readl 78 79 #define writeb_relaxed(v, a) __writeb(v, a) 80 #define writew_relaxed(v, a) __writew(v, a) 81 #define writel_relaxed(v, a) __writel(v, a) 82 #define __raw_writeb __writeb 83 #define __raw_writew __writew 84 #define __raw_writel __writel 85 86 #define mmiowb() barrier() 87 88 #ifdef CONFIG_X86_64 89 90 build_mmio_read(readq, "q", unsigned long, "=r", :"memory") 91 build_mmio_write(writeq, "q", unsigned long, "r", :"memory") 92 93 #define readq_relaxed(a) readq(a) 94 #define writeq_relaxed(v, a) writeq(v, a) 95 96 #define __raw_readq(a) readq(a) 97 #define __raw_writeq(val, addr) writeq(val, addr) 98 99 /* Let people know that we have them */ 100 #define readq readq 101 #define writeq writeq 102 103 #endif 104 105 /** 106 * virt_to_phys - map virtual addresses to physical 107 * @address: address to remap 108 * 109 * The returned physical address is the physical (CPU) mapping for 110 * the memory address given. It is only valid to use this function on 111 * addresses directly mapped or allocated via kmalloc. 112 * 113 * This function does not give bus mappings for DMA transfers. In 114 * almost all conceivable cases a device driver should not be using 115 * this function 116 */ 117 118 static inline phys_addr_t virt_to_phys(volatile void *address) 119 { 120 return __pa(address); 121 } 122 123 /** 124 * phys_to_virt - map physical address to virtual 125 * @address: address to remap 126 * 127 * The returned virtual address is a current CPU mapping for 128 * the memory address given. It is only valid to use this function on 129 * addresses that have a kernel mapping 130 * 131 * This function does not handle bus mappings for DMA transfers. In 132 * almost all conceivable cases a device driver should not be using 133 * this function 134 */ 135 136 static inline void *phys_to_virt(phys_addr_t address) 137 { 138 return __va(address); 139 } 140 141 /* 142 * Change "struct page" to physical address. 143 */ 144 #define page_to_phys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT) 145 146 /* 147 * ISA I/O bus memory addresses are 1:1 with the physical address. 148 * However, we truncate the address to unsigned int to avoid undesirable 149 * promitions in legacy drivers. 150 */ 151 static inline unsigned int isa_virt_to_bus(volatile void *address) 152 { 153 return (unsigned int)virt_to_phys(address); 154 } 155 #define isa_page_to_bus(page) ((unsigned int)page_to_phys(page)) 156 #define isa_bus_to_virt phys_to_virt 157 158 /* 159 * However PCI ones are not necessarily 1:1 and therefore these interfaces 160 * are forbidden in portable PCI drivers. 161 * 162 * Allow them on x86 for legacy drivers, though. 163 */ 164 #define virt_to_bus virt_to_phys 165 #define bus_to_virt phys_to_virt 166 167 /** 168 * ioremap - map bus memory into CPU space 169 * @offset: bus address of the memory 170 * @size: size of the resource to map 171 * 172 * ioremap performs a platform specific sequence of operations to 173 * make bus memory CPU accessible via the readb/readw/readl/writeb/ 174 * writew/writel functions and the other mmio helpers. The returned 175 * address is not guaranteed to be usable directly as a virtual 176 * address. 177 * 178 * If the area you are trying to map is a PCI BAR you should have a 179 * look at pci_iomap(). 180 */ 181 extern void __iomem *ioremap_nocache(resource_size_t offset, unsigned long size); 182 extern void __iomem *ioremap_uc(resource_size_t offset, unsigned long size); 183 #define ioremap_uc ioremap_uc 184 185 extern void __iomem *ioremap_cache(resource_size_t offset, unsigned long size); 186 extern void __iomem *ioremap_prot(resource_size_t offset, unsigned long size, 187 unsigned long prot_val); 188 189 /* 190 * The default ioremap() behavior is non-cached: 191 */ 192 static inline void __iomem *ioremap(resource_size_t offset, unsigned long size) 193 { 194 return ioremap_nocache(offset, size); 195 } 196 197 extern void iounmap(volatile void __iomem *addr); 198 199 extern void set_iounmap_nonlazy(void); 200 201 #ifdef __KERNEL__ 202 203 #include <asm-generic/iomap.h> 204 205 /* 206 * Convert a virtual cached pointer to an uncached pointer 207 */ 208 #define xlate_dev_kmem_ptr(p) p 209 210 static inline void 211 memset_io(volatile void __iomem *addr, unsigned char val, size_t count) 212 { 213 memset((void __force *)addr, val, count); 214 } 215 216 static inline void 217 memcpy_fromio(void *dst, const volatile void __iomem *src, size_t count) 218 { 219 memcpy(dst, (const void __force *)src, count); 220 } 221 222 static inline void 223 memcpy_toio(volatile void __iomem *dst, const void *src, size_t count) 224 { 225 memcpy((void __force *)dst, src, count); 226 } 227 228 /* 229 * ISA space is 'always mapped' on a typical x86 system, no need to 230 * explicitly ioremap() it. The fact that the ISA IO space is mapped 231 * to PAGE_OFFSET is pure coincidence - it does not mean ISA values 232 * are physical addresses. The following constant pointer can be 233 * used as the IO-area pointer (it can be iounmapped as well, so the 234 * analogy with PCI is quite large): 235 */ 236 #define __ISA_IO_base ((char __iomem *)(PAGE_OFFSET)) 237 238 /* 239 * Cache management 240 * 241 * This needed for two cases 242 * 1. Out of order aware processors 243 * 2. Accidentally out of order processors (PPro errata #51) 244 */ 245 246 static inline void flush_write_buffers(void) 247 { 248 #if defined(CONFIG_X86_PPRO_FENCE) 249 asm volatile("lock; addl $0,0(%%esp)": : :"memory"); 250 #endif 251 } 252 253 #endif /* __KERNEL__ */ 254 255 extern void native_io_delay(void); 256 257 extern int io_delay_type; 258 extern void io_delay_init(void); 259 260 #if defined(CONFIG_PARAVIRT) 261 #include <asm/paravirt.h> 262 #else 263 264 static inline void slow_down_io(void) 265 { 266 native_io_delay(); 267 #ifdef REALLY_SLOW_IO 268 native_io_delay(); 269 native_io_delay(); 270 native_io_delay(); 271 #endif 272 } 273 274 #endif 275 276 #define BUILDIO(bwl, bw, type) \ 277 static inline void out##bwl(unsigned type value, int port) \ 278 { \ 279 asm volatile("out" #bwl " %" #bw "0, %w1" \ 280 : : "a"(value), "Nd"(port)); \ 281 } \ 282 \ 283 static inline unsigned type in##bwl(int port) \ 284 { \ 285 unsigned type value; \ 286 asm volatile("in" #bwl " %w1, %" #bw "0" \ 287 : "=a"(value) : "Nd"(port)); \ 288 return value; \ 289 } \ 290 \ 291 static inline void out##bwl##_p(unsigned type value, int port) \ 292 { \ 293 out##bwl(value, port); \ 294 slow_down_io(); \ 295 } \ 296 \ 297 static inline unsigned type in##bwl##_p(int port) \ 298 { \ 299 unsigned type value = in##bwl(port); \ 300 slow_down_io(); \ 301 return value; \ 302 } \ 303 \ 304 static inline void outs##bwl(int port, const void *addr, unsigned long count) \ 305 { \ 306 asm volatile("rep; outs" #bwl \ 307 : "+S"(addr), "+c"(count) : "d"(port)); \ 308 } \ 309 \ 310 static inline void ins##bwl(int port, void *addr, unsigned long count) \ 311 { \ 312 asm volatile("rep; ins" #bwl \ 313 : "+D"(addr), "+c"(count) : "d"(port)); \ 314 } 315 316 BUILDIO(b, b, char) 317 BUILDIO(w, w, short) 318 BUILDIO(l, , int) 319 320 extern void *xlate_dev_mem_ptr(phys_addr_t phys); 321 extern void unxlate_dev_mem_ptr(phys_addr_t phys, void *addr); 322 323 extern int ioremap_change_attr(unsigned long vaddr, unsigned long size, 324 enum page_cache_mode pcm); 325 extern void __iomem *ioremap_wc(resource_size_t offset, unsigned long size); 326 extern void __iomem *ioremap_wt(resource_size_t offset, unsigned long size); 327 328 extern bool is_early_ioremap_ptep(pte_t *ptep); 329 330 #ifdef CONFIG_XEN 331 #include <xen/xen.h> 332 struct bio_vec; 333 334 extern bool xen_biovec_phys_mergeable(const struct bio_vec *vec1, 335 const struct bio_vec *vec2); 336 337 #define BIOVEC_PHYS_MERGEABLE(vec1, vec2) \ 338 (__BIOVEC_PHYS_MERGEABLE(vec1, vec2) && \ 339 (!xen_domain() || xen_biovec_phys_mergeable(vec1, vec2))) 340 #endif /* CONFIG_XEN */ 341 342 #define IO_SPACE_LIMIT 0xffff 343 344 #ifdef CONFIG_MTRR 345 extern int __must_check arch_phys_wc_index(int handle); 346 #define arch_phys_wc_index arch_phys_wc_index 347 348 extern int __must_check arch_phys_wc_add(unsigned long base, 349 unsigned long size); 350 extern void arch_phys_wc_del(int handle); 351 #define arch_phys_wc_add arch_phys_wc_add 352 #endif 353 354 #endif /* _ASM_X86_IO_H */
1 2 /* 3 * linux/drivers/mmc/host/wbsd.c - Winbond W83L51xD SD/MMC driver 4 * 5 * Copyright (C) 2004-2007 Pierre Ossman, All Rights Reserved. 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; either version 2 of the License, or (at 10 * your option) any later version. 11 * 12 * 13 * Warning! 14 * 15 * Changes to the FIFO system should be done with extreme care since 16 * the hardware is full of bugs related to the FIFO. Known issues are: 17 * 18 * - FIFO size field in FSR is always zero. 19 * 20 * - FIFO interrupts tend not to work as they should. Interrupts are 21 * triggered only for full/empty events, not for threshold values. 22 * 23 * - On APIC systems the FIFO empty interrupt is sometimes lost. 24 */ 25 26 #include <linux/module.h> 27 #include <linux/moduleparam.h> 28 #include <linux/init.h> 29 #include <linux/ioport.h> 30 #include <linux/platform_device.h> 31 #include <linux/interrupt.h> 32 #include <linux/dma-mapping.h> 33 #include <linux/delay.h> 34 #include <linux/pnp.h> 35 #include <linux/highmem.h> 36 #include <linux/mmc/host.h> 37 #include <linux/scatterlist.h> 38 #include <linux/slab.h> 39 40 #include <asm/io.h> 41 #include <asm/dma.h> 42 43 #include "wbsd.h" 44 45 #define DRIVER_NAME "wbsd" 46 47 #define DBG(x...) \ 48 pr_debug(DRIVER_NAME ": " x) 49 #define DBGF(f, x...) \ 50 pr_debug(DRIVER_NAME " [%s()]: " f, __func__ , ##x) 51 52 /* 53 * Device resources 54 */ 55 56 #ifdef CONFIG_PNP 57 58 static const struct pnp_device_id pnp_dev_table[] = { 59 { "WEC0517", 0 }, 60 { "WEC0518", 0 }, 61 { "", 0 }, 62 }; 63 64 MODULE_DEVICE_TABLE(pnp, pnp_dev_table); 65 66 #endif /* CONFIG_PNP */ 67 68 static const int config_ports[] = { 0x2E, 0x4E }; 69 static const int unlock_codes[] = { 0x83, 0x87 }; 70 71 static const int valid_ids[] = { 72 0x7112, 73 }; 74 75 #ifdef CONFIG_PNP 76 static unsigned int param_nopnp = 0; 77 #else 78 static const unsigned int param_nopnp = 1; 79 #endif 80 static unsigned int param_io = 0x248; 81 static unsigned int param_irq = 6; 82 static int param_dma = 2; 83 84 /* 85 * Basic functions 86 */ 87 88 static inline void wbsd_unlock_config(struct wbsd_host *host) 89 { 90 BUG_ON(host->config == 0); 91 92 outb(host->unlock_code, host->config); 93 outb(host->unlock_code, host->config); 94 } 95 96 static inline void wbsd_lock_config(struct wbsd_host *host) 97 { 98 BUG_ON(host->config == 0); 99 100 outb(LOCK_CODE, host->config); 101 } 102 103 static inline void wbsd_write_config(struct wbsd_host *host, u8 reg, u8 value) 104 { 105 BUG_ON(host->config == 0); 106 107 outb(reg, host->config); 108 outb(value, host->config + 1); 109 } 110 111 static inline u8 wbsd_read_config(struct wbsd_host *host, u8 reg) 112 { 113 BUG_ON(host->config == 0); 114 115 outb(reg, host->config); 116 return inb(host->config + 1); 117 } 118 119 static inline void wbsd_write_index(struct wbsd_host *host, u8 index, u8 value) 120 { 121 outb(index, host->base + WBSD_IDXR); 122 outb(value, host->base + WBSD_DATAR); 123 } 124 125 static inline u8 wbsd_read_index(struct wbsd_host *host, u8 index) 126 { 127 outb(index, host->base + WBSD_IDXR); 128 return inb(host->base + WBSD_DATAR); 129 } 130 131 /* 132 * Common routines 133 */ 134 135 static void wbsd_init_device(struct wbsd_host *host) 136 { 137 u8 setup, ier; 138 139 /* 140 * Reset chip (SD/MMC part) and fifo. 141 */ 142 setup = wbsd_read_index(host, WBSD_IDX_SETUP); 143 setup |= WBSD_FIFO_RESET | WBSD_SOFT_RESET; 144 wbsd_write_index(host, WBSD_IDX_SETUP, setup); 145 146 /* 147 * Set DAT3 to input 148 */ 149 setup &= ~WBSD_DAT3_H; 150 wbsd_write_index(host, WBSD_IDX_SETUP, setup); 151 host->flags &= ~WBSD_FIGNORE_DETECT; 152 153 /* 154 * Read back default clock. 155 */ 156 host->clk = wbsd_read_index(host, WBSD_IDX_CLK); 157 158 /* 159 * Power down port. 160 */ 161 outb(WBSD_POWER_N, host->base + WBSD_CSR); 162 163 /* 164 * Set maximum timeout. 165 */ 166 wbsd_write_index(host, WBSD_IDX_TAAC, 0x7F); 167 168 /* 169 * Test for card presence 170 */ 171 if (inb(host->base + WBSD_CSR) & WBSD_CARDPRESENT) 172 host->flags |= WBSD_FCARD_PRESENT; 173 else 174 host->flags &= ~WBSD_FCARD_PRESENT; 175 176 /* 177 * Enable interesting interrupts. 178 */ 179 ier = 0; 180 ier |= WBSD_EINT_CARD; 181 ier |= WBSD_EINT_FIFO_THRE; 182 ier |= WBSD_EINT_CRC; 183 ier |= WBSD_EINT_TIMEOUT; 184 ier |= WBSD_EINT_TC; 185 186 outb(ier, host->base + WBSD_EIR); 187 188 /* 189 * Clear interrupts. 190 */ 191 inb(host->base + WBSD_ISR); 192 } 193 194 static void wbsd_reset(struct wbsd_host *host) 195 { 196 u8 setup; 197 198 pr_err("%s: Resetting chip\n", mmc_hostname(host->mmc)); 199 200 /* 201 * Soft reset of chip (SD/MMC part). 202 */ 203 setup = wbsd_read_index(host, WBSD_IDX_SETUP); 204 setup |= WBSD_SOFT_RESET; 205 wbsd_write_index(host, WBSD_IDX_SETUP, setup); 206 } 207 208 static void wbsd_request_end(struct wbsd_host *host, struct mmc_request *mrq) 209 { 210 unsigned long dmaflags; 211 212 if (host->dma >= 0) { 213 /* 214 * Release ISA DMA controller. 215 */ 216 dmaflags = claim_dma_lock(); 217 disable_dma(host->dma); 218 clear_dma_ff(host->dma); 219 release_dma_lock(dmaflags); 220 221 /* 222 * Disable DMA on host. 223 */ 224 wbsd_write_index(host, WBSD_IDX_DMA, 0); 225 } 226 227 host->mrq = NULL; 228 229 /* 230 * MMC layer might call back into the driver so first unlock. 231 */ 232 spin_unlock(&host->lock); 233 mmc_request_done(host->mmc, mrq); 234 spin_lock(&host->lock); 235 } 236 237 /* 238 * Scatter/gather functions 239 */ 240 241 static inline void wbsd_init_sg(struct wbsd_host *host, struct mmc_data *data) 242 { 243 /* 244 * Get info. about SG list from data structure. 245 */ 246 host->cur_sg = data->sg; 247 host->num_sg = data->sg_len; 248 249 host->offset = 0; 250 host->remain = host->cur_sg->length; 251 } 252 253 static inline int wbsd_next_sg(struct wbsd_host *host) 254 { 255 /* 256 * Skip to next SG entry. 257 */ 258 host->cur_sg++; 259 host->num_sg--; 260 261 /* 262 * Any entries left? 263 */ 264 if (host->num_sg > 0) { 265 host->offset = 0; 266 host->remain = host->cur_sg->length; 267 } 268 269 return host->num_sg; 270 } 271 272 static inline char *wbsd_sg_to_buffer(struct wbsd_host *host) 273 { 274 return sg_virt(host->cur_sg); 275 } 276 277 static inline void wbsd_sg_to_dma(struct wbsd_host *host, struct mmc_data *data) 278 { 279 unsigned int len, i; 280 struct scatterlist *sg; 281 char *dmabuf = host->dma_buffer; 282 char *sgbuf; 283 284 sg = data->sg; 285 len = data->sg_len; 286 287 for (i = 0; i < len; i++) { 288 sgbuf = sg_virt(&sg[i]); 289 memcpy(dmabuf, sgbuf, sg[i].length); 290 dmabuf += sg[i].length; 291 } 292 } 293 294 static inline void wbsd_dma_to_sg(struct wbsd_host *host, struct mmc_data *data) 295 { 296 unsigned int len, i; 297 struct scatterlist *sg; 298 char *dmabuf = host->dma_buffer; 299 char *sgbuf; 300 301 sg = data->sg; 302 len = data->sg_len; 303 304 for (i = 0; i < len; i++) { 305 sgbuf = sg_virt(&sg[i]); 306 memcpy(sgbuf, dmabuf, sg[i].length); 307 dmabuf += sg[i].length; 308 } 309 } 310 311 /* 312 * Command handling 313 */ 314 315 static inline void wbsd_get_short_reply(struct wbsd_host *host, 316 struct mmc_command *cmd) 317 { 318 /* 319 * Correct response type? 320 */ 321 if (wbsd_read_index(host, WBSD_IDX_RSPLEN) != WBSD_RSP_SHORT) { 322 cmd->error = -EILSEQ; 323 return; 324 } 325 326 cmd->resp[0] = wbsd_read_index(host, WBSD_IDX_RESP12) << 24; 327 cmd->resp[0] |= wbsd_read_index(host, WBSD_IDX_RESP13) << 16; 328 cmd->resp[0] |= wbsd_read_index(host, WBSD_IDX_RESP14) << 8; 329 cmd->resp[0] |= wbsd_read_index(host, WBSD_IDX_RESP15) << 0; 330 cmd->resp[1] = wbsd_read_index(host, WBSD_IDX_RESP16) << 24; 331 } 332 333 static inline void wbsd_get_long_reply(struct wbsd_host *host, 334 struct mmc_command *cmd) 335 { 336 int i; 337 338 /* 339 * Correct response type? 340 */ 341 if (wbsd_read_index(host, WBSD_IDX_RSPLEN) != WBSD_RSP_LONG) { 342 cmd->error = -EILSEQ; 343 return; 344 } 345 346 for (i = 0; i < 4; i++) { 347 cmd->resp[i] = 348 wbsd_read_index(host, WBSD_IDX_RESP1 + i * 4) << 24; 349 cmd->resp[i] |= 350 wbsd_read_index(host, WBSD_IDX_RESP2 + i * 4) << 16; 351 cmd->resp[i] |= 352 wbsd_read_index(host, WBSD_IDX_RESP3 + i * 4) << 8; 353 cmd->resp[i] |= 354 wbsd_read_index(host, WBSD_IDX_RESP4 + i * 4) << 0; 355 } 356 } 357 358 static void wbsd_send_command(struct wbsd_host *host, struct mmc_command *cmd) 359 { 360 int i; 361 u8 status, isr; 362 363 /* 364 * Clear accumulated ISR. The interrupt routine 365 * will fill this one with events that occur during 366 * transfer. 367 */ 368 host->isr = 0; 369 370 /* 371 * Send the command (CRC calculated by host). 372 */ 373 outb(cmd->opcode, host->base + WBSD_CMDR); 374 for (i = 3; i >= 0; i--) 375 outb((cmd->arg >> (i * 8)) & 0xff, host->base + WBSD_CMDR); 376 377 cmd->error = 0; 378 379 /* 380 * Wait for the request to complete. 381 */ 382 do { 383 status = wbsd_read_index(host, WBSD_IDX_STATUS); 384 } while (status & WBSD_CARDTRAFFIC); 385 386 /* 387 * Do we expect a reply? 388 */ 389 if (cmd->flags & MMC_RSP_PRESENT) { 390 /* 391 * Read back status. 392 */ 393 isr = host->isr; 394 395 /* Card removed? */ 396 if (isr & WBSD_INT_CARD) 397 cmd->error = -ENOMEDIUM; 398 /* Timeout? */ 399 else if (isr & WBSD_INT_TIMEOUT) 400 cmd->error = -ETIMEDOUT; 401 /* CRC? */ 402 else if ((cmd->flags & MMC_RSP_CRC) && (isr & WBSD_INT_CRC)) 403 cmd->error = -EILSEQ; 404 /* All ok */ 405 else { 406 if (cmd->flags & MMC_RSP_136) 407 wbsd_get_long_reply(host, cmd); 408 else 409 wbsd_get_short_reply(host, cmd); 410 } 411 } 412 } 413 414 /* 415 * Data functions 416 */ 417 418 static void wbsd_empty_fifo(struct wbsd_host *host) 419 { 420 struct mmc_data *data = host->mrq->cmd->data; 421 char *buffer; 422 int i, fsr, fifo; 423 424 /* 425 * Handle excessive data. 426 */ 427 if (host->num_sg == 0) 428 return; 429 430 buffer = wbsd_sg_to_buffer(host) + host->offset; 431 432 /* 433 * Drain the fifo. This has a tendency to loop longer 434 * than the FIFO length (usually one block). 435 */ 436 while (!((fsr = inb(host->base + WBSD_FSR)) & WBSD_FIFO_EMPTY)) { 437 /* 438 * The size field in the FSR is broken so we have to 439 * do some guessing. 440 */ 441 if (fsr & WBSD_FIFO_FULL) 442 fifo = 16; 443 else if (fsr & WBSD_FIFO_FUTHRE) 444 fifo = 8; 445 else 446 fifo = 1; 447 448 for (i = 0; i < fifo; i++) { 449 *buffer = inb(host->base + WBSD_DFR); 450 buffer++; 451 host->offset++; 452 host->remain--; 453 454 data->bytes_xfered++; 455 456 /* 457 * End of scatter list entry? 458 */ 459 if (host->remain == 0) { 460 /* 461 * Get next entry. Check if last. 462 */ 463 if (!wbsd_next_sg(host)) 464 return; 465 466 buffer = wbsd_sg_to_buffer(host); 467 } 468 } 469 } 470 471 /* 472 * This is a very dirty hack to solve a 473 * hardware problem. The chip doesn't trigger 474 * FIFO threshold interrupts properly. 475 */ 476 if ((data->blocks * data->blksz - data->bytes_xfered) < 16) 477 tasklet_schedule(&host->fifo_tasklet); 478 } 479 480 static void wbsd_fill_fifo(struct wbsd_host *host) 481 { 482 struct mmc_data *data = host->mrq->cmd->data; 483 char *buffer; 484 int i, fsr, fifo; 485 486 /* 487 * Check that we aren't being called after the 488 * entire buffer has been transferred. 489 */ 490 if (host->num_sg == 0) 491 return; 492 493 buffer = wbsd_sg_to_buffer(host) + host->offset; 494 495 /* 496 * Fill the fifo. This has a tendency to loop longer 497 * than the FIFO length (usually one block). 498 */ 499 while (!((fsr = inb(host->base + WBSD_FSR)) & WBSD_FIFO_FULL)) { 500 /* 501 * The size field in the FSR is broken so we have to 502 * do some guessing. 503 */ 504 if (fsr & WBSD_FIFO_EMPTY) 505 fifo = 0; 506 else if (fsr & WBSD_FIFO_EMTHRE) 507 fifo = 8; 508 else 509 fifo = 15; 510 511 for (i = 16; i > fifo; i--) { 512 outb(*buffer, host->base + WBSD_DFR); 513 buffer++; 514 host->offset++; 515 host->remain--; 516 517 data->bytes_xfered++; 518 519 /* 520 * End of scatter list entry? 521 */ 522 if (host->remain == 0) { 523 /* 524 * Get next entry. Check if last. 525 */ 526 if (!wbsd_next_sg(host)) 527 return; 528 529 buffer = wbsd_sg_to_buffer(host); 530 } 531 } 532 } 533 534 /* 535 * The controller stops sending interrupts for 536 * 'FIFO empty' under certain conditions. So we 537 * need to be a bit more pro-active. 538 */ 539 tasklet_schedule(&host->fifo_tasklet); 540 } 541 542 static void wbsd_prepare_data(struct wbsd_host *host, struct mmc_data *data) 543 { 544 u16 blksize; 545 u8 setup; 546 unsigned long dmaflags; 547 unsigned int size; 548 549 /* 550 * Calculate size. 551 */ 552 size = data->blocks * data->blksz; 553 554 /* 555 * Check timeout values for overflow. 556 * (Yes, some cards cause this value to overflow). 557 */ 558 if (data->timeout_ns > 127000000) 559 wbsd_write_index(host, WBSD_IDX_TAAC, 127); 560 else { 561 wbsd_write_index(host, WBSD_IDX_TAAC, 562 data->timeout_ns / 1000000); 563 } 564 565 if (data->timeout_clks > 255) 566 wbsd_write_index(host, WBSD_IDX_NSAC, 255); 567 else 568 wbsd_write_index(host, WBSD_IDX_NSAC, data->timeout_clks); 569 570 /* 571 * Inform the chip of how large blocks will be 572 * sent. It needs this to determine when to 573 * calculate CRC. 574 * 575 * Space for CRC must be included in the size. 576 * Two bytes are needed for each data line. 577 */ 578 if (host->bus_width == MMC_BUS_WIDTH_1) { 579 blksize = data->blksz + 2; 580 581 wbsd_write_index(host, WBSD_IDX_PBSMSB, (blksize >> 4) & 0xF0); 582 wbsd_write_index(host, WBSD_IDX_PBSLSB, blksize & 0xFF); 583 } else if (host->bus_width == MMC_BUS_WIDTH_4) { 584 blksize = data->blksz + 2 * 4; 585 586 wbsd_write_index(host, WBSD_IDX_PBSMSB, 587 ((blksize >> 4) & 0xF0) | WBSD_DATA_WIDTH); 588 wbsd_write_index(host, WBSD_IDX_PBSLSB, blksize & 0xFF); 589 } else { 590 data->error = -EINVAL; 591 return; 592 } 593 594 /* 595 * Clear the FIFO. This is needed even for DMA 596 * transfers since the chip still uses the FIFO 597 * internally. 598 */ 599 setup = wbsd_read_index(host, WBSD_IDX_SETUP); 600 setup |= WBSD_FIFO_RESET; 601 wbsd_write_index(host, WBSD_IDX_SETUP, setup); 602 603 /* 604 * DMA transfer? 605 */ 606 if (host->dma >= 0) { 607 /* 608 * The buffer for DMA is only 64 kB. 609 */ 610 BUG_ON(size > 0x10000); 611 if (size > 0x10000) { 612 data->error = -EINVAL; 613 return; 614 } 615 616 /* 617 * Transfer data from the SG list to 618 * the DMA buffer. 619 */ 620 if (data->flags & MMC_DATA_WRITE) 621 wbsd_sg_to_dma(host, data); 622 623 /* 624 * Initialise the ISA DMA controller. 625 */ 626 dmaflags = claim_dma_lock(); 627 disable_dma(host->dma); 628 clear_dma_ff(host->dma); 629 if (data->flags & MMC_DATA_READ) 630 set_dma_mode(host->dma, DMA_MODE_READ & ~0x40); 631 else 632 set_dma_mode(host->dma, DMA_MODE_WRITE & ~0x40); 633 set_dma_addr(host->dma, host->dma_addr); 634 set_dma_count(host->dma, size); 635 636 enable_dma(host->dma); 637 release_dma_lock(dmaflags); 638 639 /* 640 * Enable DMA on the host. 641 */ 642 wbsd_write_index(host, WBSD_IDX_DMA, WBSD_DMA_ENABLE); 643 } else { 644 /* 645 * This flag is used to keep printk 646 * output to a minimum. 647 */ 648 host->firsterr = 1; 649 650 /* 651 * Initialise the SG list. 652 */ 653 wbsd_init_sg(host, data); 654 655 /* 656 * Turn off DMA. 657 */ 658 wbsd_write_index(host, WBSD_IDX_DMA, 0); 659 660 /* 661 * Set up FIFO threshold levels (and fill 662 * buffer if doing a write). 663 */ 664 if (data->flags & MMC_DATA_READ) { 665 wbsd_write_index(host, WBSD_IDX_FIFOEN, 666 WBSD_FIFOEN_FULL | 8); 667 } else { 668 wbsd_write_index(host, WBSD_IDX_FIFOEN, 669 WBSD_FIFOEN_EMPTY | 8); 670 wbsd_fill_fifo(host); 671 } 672 } 673 674 data->error = 0; 675 } 676 677 static void wbsd_finish_data(struct wbsd_host *host, struct mmc_data *data) 678 { 679 unsigned long dmaflags; 680 int count; 681 u8 status; 682 683 WARN_ON(host->mrq == NULL); 684 685 /* 686 * Send a stop command if needed. 687 */ 688 if (data->stop) 689 wbsd_send_command(host, data->stop); 690 691 /* 692 * Wait for the controller to leave data 693 * transfer state. 694 */ 695 do { 696 status = wbsd_read_index(host, WBSD_IDX_STATUS); 697 } while (status & (WBSD_BLOCK_READ | WBSD_BLOCK_WRITE)); 698 699 /* 700 * DMA transfer? 701 */ 702 if (host->dma >= 0) { 703 /* 704 * Disable DMA on the host. 705 */ 706 wbsd_write_index(host, WBSD_IDX_DMA, 0); 707 708 /* 709 * Turn of ISA DMA controller. 710 */ 711 dmaflags = claim_dma_lock(); 712 disable_dma(host->dma); 713 clear_dma_ff(host->dma); 714 count = get_dma_residue(host->dma); 715 release_dma_lock(dmaflags); 716 717 data->bytes_xfered = host->mrq->data->blocks * 718 host->mrq->data->blksz - count; 719 data->bytes_xfered -= data->bytes_xfered % data->blksz; 720 721 /* 722 * Any leftover data? 723 */ 724 if (count) { 725 pr_err("%s: Incomplete DMA transfer. " 726 "%d bytes left.\n", 727 mmc_hostname(host->mmc), count); 728 729 if (!data->error) 730 data->error = -EIO; 731 } else { 732 /* 733 * Transfer data from DMA buffer to 734 * SG list. 735 */ 736 if (data->flags & MMC_DATA_READ) 737 wbsd_dma_to_sg(host, data); 738 } 739 740 if (data->error) { 741 if (data->bytes_xfered) 742 data->bytes_xfered -= data->blksz; 743 } 744 } 745 746 wbsd_request_end(host, host->mrq); 747 } 748 749 /*****************************************************************************\ 750 * * 751 * MMC layer callbacks * 752 * * 753 \*****************************************************************************/ 754 755 static void wbsd_request(struct mmc_host *mmc, struct mmc_request *mrq) 756 { 757 struct wbsd_host *host = mmc_priv(mmc); 758 struct mmc_command *cmd; 759 760 /* 761 * Disable tasklets to avoid a deadlock. 762 */ 763 spin_lock_bh(&host->lock); 764 765 BUG_ON(host->mrq != NULL); 766 767 cmd = mrq->cmd; 768 769 host->mrq = mrq; 770 771 /* 772 * Check that there is actually a card in the slot. 773 */ 774 if (!(host->flags & WBSD_FCARD_PRESENT)) { 775 cmd->error = -ENOMEDIUM; 776 goto done; 777 } 778 779 if (cmd->data) { 780 /* 781 * The hardware is so delightfully stupid that it has a list 782 * of "data" commands. If a command isn't on this list, it'll 783 * just go back to the idle state and won't send any data 784 * interrupts. 785 */ 786 switch (cmd->opcode) { 787 case 11: 788 case 17: 789 case 18: 790 case 20: 791 case 24: 792 case 25: 793 case 26: 794 case 27: 795 case 30: 796 case 42: 797 case 56: 798 break; 799 800 /* ACMDs. We don't keep track of state, so we just treat them 801 * like any other command. */ 802 case 51: 803 break; 804 805 default: 806 #ifdef CONFIG_MMC_DEBUG 807 pr_warn("%s: Data command %d is not supported by this controller\n", 808 mmc_hostname(host->mmc), cmd->opcode); 809 #endif 810 cmd->error = -EINVAL; 811 812 goto done; 813 } 814 } 815 816 /* 817 * Does the request include data? 818 */ 819 if (cmd->data) { 820 wbsd_prepare_data(host, cmd->data); 821 822 if (cmd->data->error) 823 goto done; 824 } 825 826 wbsd_send_command(host, cmd); 827 828 /* 829 * If this is a data transfer the request 830 * will be finished after the data has 831 * transferred. 832 */ 833 if (cmd->data && !cmd->error) { 834 /* 835 * Dirty fix for hardware bug. 836 */ 837 if (host->dma == -1) 838 tasklet_schedule(&host->fifo_tasklet); 839 840 spin_unlock_bh(&host->lock); 841 842 return; 843 } 844 845 done: 846 wbsd_request_end(host, mrq); 847 848 spin_unlock_bh(&host->lock); 849 } 850 851 static void wbsd_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) 852 { 853 struct wbsd_host *host = mmc_priv(mmc); 854 u8 clk, setup, pwr; 855 856 spin_lock_bh(&host->lock); 857 858 /* 859 * Reset the chip on each power off. 860 * Should clear out any weird states. 861 */ 862 if (ios->power_mode == MMC_POWER_OFF) 863 wbsd_init_device(host); 864 865 if (ios->clock >= 24000000) 866 clk = WBSD_CLK_24M; 867 else if (ios->clock >= 16000000) 868 clk = WBSD_CLK_16M; 869 else if (ios->clock >= 12000000) 870 clk = WBSD_CLK_12M; 871 else 872 clk = WBSD_CLK_375K; 873 874 /* 875 * Only write to the clock register when 876 * there is an actual change. 877 */ 878 if (clk != host->clk) { 879 wbsd_write_index(host, WBSD_IDX_CLK, clk); 880 host->clk = clk; 881 } 882 883 /* 884 * Power up card. 885 */ 886 if (ios->power_mode != MMC_POWER_OFF) { 887 pwr = inb(host->base + WBSD_CSR); 888 pwr &= ~WBSD_POWER_N; 889 outb(pwr, host->base + WBSD_CSR); 890 } 891 892 /* 893 * MMC cards need to have pin 1 high during init. 894 * It wreaks havoc with the card detection though so 895 * that needs to be disabled. 896 */ 897 setup = wbsd_read_index(host, WBSD_IDX_SETUP); 898 if (ios->chip_select == MMC_CS_HIGH) { 899 BUG_ON(ios->bus_width != MMC_BUS_WIDTH_1); 900 setup |= WBSD_DAT3_H; 901 host->flags |= WBSD_FIGNORE_DETECT; 902 } else { 903 if (setup & WBSD_DAT3_H) { 904 setup &= ~WBSD_DAT3_H; 905 906 /* 907 * We cannot resume card detection immediately 908 * because of capacitance and delays in the chip. 909 */ 910 mod_timer(&host->ignore_timer, jiffies + HZ / 100); 911 } 912 } 913 wbsd_write_index(host, WBSD_IDX_SETUP, setup); 914 915 /* 916 * Store bus width for later. Will be used when 917 * setting up the data transfer. 918 */ 919 host->bus_width = ios->bus_width; 920 921 spin_unlock_bh(&host->lock); 922 } 923 924 static int wbsd_get_ro(struct mmc_host *mmc) 925 { 926 struct wbsd_host *host = mmc_priv(mmc); 927 u8 csr; 928 929 spin_lock_bh(&host->lock); 930 931 csr = inb(host->base + WBSD_CSR); 932 csr |= WBSD_MSLED; 933 outb(csr, host->base + WBSD_CSR); 934 935 mdelay(1); 936 937 csr = inb(host->base + WBSD_CSR); 938 csr &= ~WBSD_MSLED; 939 outb(csr, host->base + WBSD_CSR); 940 941 spin_unlock_bh(&host->lock); 942 943 return !!(csr & WBSD_WRPT); 944 } 945 946 static const struct mmc_host_ops wbsd_ops = { 947 .request = wbsd_request, 948 .set_ios = wbsd_set_ios, 949 .get_ro = wbsd_get_ro, 950 }; 951 952 /*****************************************************************************\ 953 * * 954 * Interrupt handling * 955 * * 956 \*****************************************************************************/ 957 958 /* 959 * Helper function to reset detection ignore 960 */ 961 962 static void wbsd_reset_ignore(unsigned long data) 963 { 964 struct wbsd_host *host = (struct wbsd_host *)data; 965 966 BUG_ON(host == NULL); 967 968 DBG("Resetting card detection ignore\n"); 969 970 spin_lock_bh(&host->lock); 971 972 host->flags &= ~WBSD_FIGNORE_DETECT; 973 974 /* 975 * Card status might have changed during the 976 * blackout. 977 */ 978 tasklet_schedule(&host->card_tasklet); 979 980 spin_unlock_bh(&host->lock); 981 } 982 983 /* 984 * Tasklets 985 */ 986 987 static inline struct mmc_data *wbsd_get_data(struct wbsd_host *host) 988 { 989 WARN_ON(!host->mrq); 990 if (!host->mrq) 991 return NULL; 992 993 WARN_ON(!host->mrq->cmd); 994 if (!host->mrq->cmd) 995 return NULL; 996 997 WARN_ON(!host->mrq->cmd->data); 998 if (!host->mrq->cmd->data) 999 return NULL; 1000 1001 return host->mrq->cmd->data; 1002 } 1003 1004 static void wbsd_tasklet_card(unsigned long param) 1005 { 1006 struct wbsd_host *host = (struct wbsd_host *)param; 1007 u8 csr; 1008 int delay = -1; 1009 1010 spin_lock(&host->lock); 1011 1012 if (host->flags & WBSD_FIGNORE_DETECT) { 1013 spin_unlock(&host->lock); 1014 return; 1015 } 1016 1017 csr = inb(host->base + WBSD_CSR); 1018 WARN_ON(csr == 0xff); 1019 1020 if (csr & WBSD_CARDPRESENT) { 1021 if (!(host->flags & WBSD_FCARD_PRESENT)) { 1022 DBG("Card inserted\n"); 1023 host->flags |= WBSD_FCARD_PRESENT; 1024 1025 delay = 500; 1026 } 1027 } else if (host->flags & WBSD_FCARD_PRESENT) { 1028 DBG("Card removed\n"); 1029 host->flags &= ~WBSD_FCARD_PRESENT; 1030 1031 if (host->mrq) { 1032 pr_err("%s: Card removed during transfer!\n", 1033 mmc_hostname(host->mmc)); 1034 wbsd_reset(host); 1035 1036 host->mrq->cmd->error = -ENOMEDIUM; 1037 tasklet_schedule(&host->finish_tasklet); 1038 } 1039 1040 delay = 0; 1041 } 1042 1043 /* 1044 * Unlock first since we might get a call back. 1045 */ 1046 1047 spin_unlock(&host->lock); 1048 1049 if (delay != -1) 1050 mmc_detect_change(host->mmc, msecs_to_jiffies(delay)); 1051 } 1052 1053 static void wbsd_tasklet_fifo(unsigned long param) 1054 { 1055 struct wbsd_host *host = (struct wbsd_host *)param; 1056 struct mmc_data *data; 1057 1058 spin_lock(&host->lock); 1059 1060 if (!host->mrq) 1061 goto end; 1062 1063 data = wbsd_get_data(host); 1064 if (!data) 1065 goto end; 1066 1067 if (data->flags & MMC_DATA_WRITE) 1068 wbsd_fill_fifo(host); 1069 else 1070 wbsd_empty_fifo(host); 1071 1072 /* 1073 * Done? 1074 */ 1075 if (host->num_sg == 0) { 1076 wbsd_write_index(host, WBSD_IDX_FIFOEN, 0); 1077 tasklet_schedule(&host->finish_tasklet); 1078 } 1079 1080 end: 1081 spin_unlock(&host->lock); 1082 } 1083 1084 static void wbsd_tasklet_crc(unsigned long param) 1085 { 1086 struct wbsd_host *host = (struct wbsd_host *)param; 1087 struct mmc_data *data; 1088 1089 spin_lock(&host->lock); 1090 1091 if (!host->mrq) 1092 goto end; 1093 1094 data = wbsd_get_data(host); 1095 if (!data) 1096 goto end; 1097 1098 DBGF("CRC error\n"); 1099 1100 data->error = -EILSEQ; 1101 1102 tasklet_schedule(&host->finish_tasklet); 1103 1104 end: 1105 spin_unlock(&host->lock); 1106 } 1107 1108 static void wbsd_tasklet_timeout(unsigned long param) 1109 { 1110 struct wbsd_host *host = (struct wbsd_host *)param; 1111 struct mmc_data *data; 1112 1113 spin_lock(&host->lock); 1114 1115 if (!host->mrq) 1116 goto end; 1117 1118 data = wbsd_get_data(host); 1119 if (!data) 1120 goto end; 1121 1122 DBGF("Timeout\n"); 1123 1124 data->error = -ETIMEDOUT; 1125 1126 tasklet_schedule(&host->finish_tasklet); 1127 1128 end: 1129 spin_unlock(&host->lock); 1130 } 1131 1132 static void wbsd_tasklet_finish(unsigned long param) 1133 { 1134 struct wbsd_host *host = (struct wbsd_host *)param; 1135 struct mmc_data *data; 1136 1137 spin_lock(&host->lock); 1138 1139 WARN_ON(!host->mrq); 1140 if (!host->mrq) 1141 goto end; 1142 1143 data = wbsd_get_data(host); 1144 if (!data) 1145 goto end; 1146 1147 wbsd_finish_data(host, data); 1148 1149 end: 1150 spin_unlock(&host->lock); 1151 } 1152 1153 /* 1154 * Interrupt handling 1155 */ 1156 1157 static irqreturn_t wbsd_irq(int irq, void *dev_id) 1158 { 1159 struct wbsd_host *host = dev_id; 1160 int isr; 1161 1162 isr = inb(host->base + WBSD_ISR); 1163 1164 /* 1165 * Was it actually our hardware that caused the interrupt? 1166 */ 1167 if (isr == 0xff || isr == 0x00) 1168 return IRQ_NONE; 1169 1170 host->isr |= isr; 1171 1172 /* 1173 * Schedule tasklets as needed. 1174 */ 1175 if (isr & WBSD_INT_CARD) 1176 tasklet_schedule(&host->card_tasklet); 1177 if (isr & WBSD_INT_FIFO_THRE) 1178 tasklet_schedule(&host->fifo_tasklet); 1179 if (isr & WBSD_INT_CRC) 1180 tasklet_hi_schedule(&host->crc_tasklet); 1181 if (isr & WBSD_INT_TIMEOUT) 1182 tasklet_hi_schedule(&host->timeout_tasklet); 1183 if (isr & WBSD_INT_TC) 1184 tasklet_schedule(&host->finish_tasklet); 1185 1186 return IRQ_HANDLED; 1187 } 1188 1189 /*****************************************************************************\ 1190 * * 1191 * Device initialisation and shutdown * 1192 * * 1193 \*****************************************************************************/ 1194 1195 /* 1196 * Allocate/free MMC structure. 1197 */ 1198 1199 static int wbsd_alloc_mmc(struct device *dev) 1200 { 1201 struct mmc_host *mmc; 1202 struct wbsd_host *host; 1203 1204 /* 1205 * Allocate MMC structure. 1206 */ 1207 mmc = mmc_alloc_host(sizeof(struct wbsd_host), dev); 1208 if (!mmc) 1209 return -ENOMEM; 1210 1211 host = mmc_priv(mmc); 1212 host->mmc = mmc; 1213 1214 host->dma = -1; 1215 1216 /* 1217 * Set host parameters. 1218 */ 1219 mmc->ops = &wbsd_ops; 1220 mmc->f_min = 375000; 1221 mmc->f_max = 24000000; 1222 mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34; 1223 mmc->caps = MMC_CAP_4_BIT_DATA; 1224 1225 spin_lock_init(&host->lock); 1226 1227 /* 1228 * Set up timers 1229 */ 1230 init_timer(&host->ignore_timer); 1231 host->ignore_timer.data = (unsigned long)host; 1232 host->ignore_timer.function = wbsd_reset_ignore; 1233 1234 /* 1235 * Maximum number of segments. Worst case is one sector per segment 1236 * so this will be 64kB/512. 1237 */ 1238 mmc->max_segs = 128; 1239 1240 /* 1241 * Maximum request size. Also limited by 64KiB buffer. 1242 */ 1243 mmc->max_req_size = 65536; 1244 1245 /* 1246 * Maximum segment size. Could be one segment with the maximum number 1247 * of bytes. 1248 */ 1249 mmc->max_seg_size = mmc->max_req_size; 1250 1251 /* 1252 * Maximum block size. We have 12 bits (= 4095) but have to subtract 1253 * space for CRC. So the maximum is 4095 - 4*2 = 4087. 1254 */ 1255 mmc->max_blk_size = 4087; 1256 1257 /* 1258 * Maximum block count. There is no real limit so the maximum 1259 * request size will be the only restriction. 1260 */ 1261 mmc->max_blk_count = mmc->max_req_size; 1262 1263 dev_set_drvdata(dev, mmc); 1264 1265 return 0; 1266 } 1267 1268 static void wbsd_free_mmc(struct device *dev) 1269 { 1270 struct mmc_host *mmc; 1271 struct wbsd_host *host; 1272 1273 mmc = dev_get_drvdata(dev); 1274 if (!mmc) 1275 return; 1276 1277 host = mmc_priv(mmc); 1278 BUG_ON(host == NULL); 1279 1280 del_timer_sync(&host->ignore_timer); 1281 1282 mmc_free_host(mmc); 1283 1284 dev_set_drvdata(dev, NULL); 1285 } 1286 1287 /* 1288 * Scan for known chip id:s 1289 */ 1290 1291 static int wbsd_scan(struct wbsd_host *host) 1292 { 1293 int i, j, k; 1294 int id; 1295 1296 /* 1297 * Iterate through all ports, all codes to 1298 * find hardware that is in our known list. 1299 */ 1300 for (i = 0; i < ARRAY_SIZE(config_ports); i++) { 1301 if (!request_region(config_ports[i], 2, DRIVER_NAME)) 1302 continue; 1303 1304 for (j = 0; j < ARRAY_SIZE(unlock_codes); j++) { 1305 id = 0xFFFF; 1306 1307 host->config = config_ports[i]; 1308 host->unlock_code = unlock_codes[j]; 1309 1310 wbsd_unlock_config(host); 1311 1312 outb(WBSD_CONF_ID_HI, config_ports[i]); 1313 id = inb(config_ports[i] + 1) << 8; 1314 1315 outb(WBSD_CONF_ID_LO, config_ports[i]); 1316 id |= inb(config_ports[i] + 1); 1317 1318 wbsd_lock_config(host); 1319 1320 for (k = 0; k < ARRAY_SIZE(valid_ids); k++) { 1321 if (id == valid_ids[k]) { 1322 host->chip_id = id; 1323 1324 return 0; 1325 } 1326 } 1327 1328 if (id != 0xFFFF) { 1329 DBG("Unknown hardware (id %x) found at %x\n", 1330 id, config_ports[i]); 1331 } 1332 } 1333 1334 release_region(config_ports[i], 2); 1335 } 1336 1337 host->config = 0; 1338 host->unlock_code = 0; 1339 1340 return -ENODEV; 1341 } 1342 1343 /* 1344 * Allocate/free io port ranges 1345 */ 1346 1347 static int wbsd_request_region(struct wbsd_host *host, int base) 1348 { 1349 if (base & 0x7) 1350 return -EINVAL; 1351 1352 if (!request_region(base, 8, DRIVER_NAME)) 1353 return -EIO; 1354 1355 host->base = base; 1356 1357 return 0; 1358 } 1359 1360 static void wbsd_release_regions(struct wbsd_host *host) 1361 { 1362 if (host->base) 1363 release_region(host->base, 8); 1364 1365 host->base = 0; 1366 1367 if (host->config) 1368 release_region(host->config, 2); 1369 1370 host->config = 0; 1371 } 1372 1373 /* 1374 * Allocate/free DMA port and buffer 1375 */ 1376 1377 static void wbsd_request_dma(struct wbsd_host *host, int dma) 1378 { 1379 if (dma < 0) 1380 return; 1381 1382 if (request_dma(dma, DRIVER_NAME)) 1383 goto err; 1384 1385 /* 1386 * We need to allocate a special buffer in 1387 * order for ISA to be able to DMA to it. 1388 */ 1389 host->dma_buffer = kmalloc(WBSD_DMA_SIZE, 1390 GFP_NOIO | GFP_DMA | __GFP_REPEAT | __GFP_NOWARN); 1391 if (!host->dma_buffer) 1392 goto free; 1393 1394 /* 1395 * Translate the address to a physical address. 1396 */ 1397 host->dma_addr = dma_map_single(mmc_dev(host->mmc), host->dma_buffer, 1398 WBSD_DMA_SIZE, DMA_BIDIRECTIONAL); 1399 1400 /* 1401 * ISA DMA must be aligned on a 64k basis. 1402 */ 1403 if ((host->dma_addr & 0xffff) != 0) 1404 goto kfree; 1405 /* 1406 * ISA cannot access memory above 16 MB. 1407 */ 1408 else if (host->dma_addr >= 0x1000000) 1409 goto kfree; 1410 1411 host->dma = dma; 1412 1413 return; 1414 1415 kfree: 1416 /* 1417 * If we've gotten here then there is some kind of alignment bug 1418 */ 1419 BUG_ON(1); 1420 1421 dma_unmap_single(mmc_dev(host->mmc), host->dma_addr, 1422 WBSD_DMA_SIZE, DMA_BIDIRECTIONAL); 1423 host->dma_addr = 0; 1424 1425 kfree(host->dma_buffer); 1426 host->dma_buffer = NULL; 1427 1428 free: 1429 free_dma(dma); 1430 1431 err: 1432 pr_warn(DRIVER_NAME ": Unable to allocate DMA %d - falling back on FIFO\n", 1433 dma); 1434 } 1435 1436 static void wbsd_release_dma(struct wbsd_host *host) 1437 { 1438 if (host->dma_addr) { 1439 dma_unmap_single(mmc_dev(host->mmc), host->dma_addr, 1440 WBSD_DMA_SIZE, DMA_BIDIRECTIONAL); 1441 } 1442 kfree(host->dma_buffer); 1443 if (host->dma >= 0) 1444 free_dma(host->dma); 1445 1446 host->dma = -1; 1447 host->dma_buffer = NULL; 1448 host->dma_addr = 0; 1449 } 1450 1451 /* 1452 * Allocate/free IRQ. 1453 */ 1454 1455 static int wbsd_request_irq(struct wbsd_host *host, int irq) 1456 { 1457 int ret; 1458 1459 /* 1460 * Set up tasklets. Must be done before requesting interrupt. 1461 */ 1462 tasklet_init(&host->card_tasklet, wbsd_tasklet_card, 1463 (unsigned long)host); 1464 tasklet_init(&host->fifo_tasklet, wbsd_tasklet_fifo, 1465 (unsigned long)host); 1466 tasklet_init(&host->crc_tasklet, wbsd_tasklet_crc, 1467 (unsigned long)host); 1468 tasklet_init(&host->timeout_tasklet, wbsd_tasklet_timeout, 1469 (unsigned long)host); 1470 tasklet_init(&host->finish_tasklet, wbsd_tasklet_finish, 1471 (unsigned long)host); 1472 1473 /* 1474 * Allocate interrupt. 1475 */ 1476 ret = request_irq(irq, wbsd_irq, IRQF_SHARED, DRIVER_NAME, host); 1477 if (ret) 1478 return ret; 1479 1480 host->irq = irq; 1481 1482 return 0; 1483 } 1484 1485 static void wbsd_release_irq(struct wbsd_host *host) 1486 { 1487 if (!host->irq) 1488 return; 1489 1490 free_irq(host->irq, host); 1491 1492 host->irq = 0; 1493 1494 tasklet_kill(&host->card_tasklet); 1495 tasklet_kill(&host->fifo_tasklet); 1496 tasklet_kill(&host->crc_tasklet); 1497 tasklet_kill(&host->timeout_tasklet); 1498 tasklet_kill(&host->finish_tasklet); 1499 } 1500 1501 /* 1502 * Allocate all resources for the host. 1503 */ 1504 1505 static int wbsd_request_resources(struct wbsd_host *host, 1506 int base, int irq, int dma) 1507 { 1508 int ret; 1509 1510 /* 1511 * Allocate I/O ports. 1512 */ 1513 ret = wbsd_request_region(host, base); 1514 if (ret) 1515 return ret; 1516 1517 /* 1518 * Allocate interrupt. 1519 */ 1520 ret = wbsd_request_irq(host, irq); 1521 if (ret) 1522 return ret; 1523 1524 /* 1525 * Allocate DMA. 1526 */ 1527 wbsd_request_dma(host, dma); 1528 1529 return 0; 1530 } 1531 1532 /* 1533 * Release all resources for the host. 1534 */ 1535 1536 static void wbsd_release_resources(struct wbsd_host *host) 1537 { 1538 wbsd_release_dma(host); 1539 wbsd_release_irq(host); 1540 wbsd_release_regions(host); 1541 } 1542 1543 /* 1544 * Configure the resources the chip should use. 1545 */ 1546 1547 static void wbsd_chip_config(struct wbsd_host *host) 1548 { 1549 wbsd_unlock_config(host); 1550 1551 /* 1552 * Reset the chip. 1553 */ 1554 wbsd_write_config(host, WBSD_CONF_SWRST, 1); 1555 wbsd_write_config(host, WBSD_CONF_SWRST, 0); 1556 1557 /* 1558 * Select SD/MMC function. 1559 */ 1560 wbsd_write_config(host, WBSD_CONF_DEVICE, DEVICE_SD); 1561 1562 /* 1563 * Set up card detection. 1564 */ 1565 wbsd_write_config(host, WBSD_CONF_PINS, WBSD_PINS_DETECT_GP11); 1566 1567 /* 1568 * Configure chip 1569 */ 1570 wbsd_write_config(host, WBSD_CONF_PORT_HI, host->base >> 8); 1571 wbsd_write_config(host, WBSD_CONF_PORT_LO, host->base & 0xff); 1572 1573 wbsd_write_config(host, WBSD_CONF_IRQ, host->irq); 1574 1575 if (host->dma >= 0) 1576 wbsd_write_config(host, WBSD_CONF_DRQ, host->dma); 1577 1578 /* 1579 * Enable and power up chip. 1580 */ 1581 wbsd_write_config(host, WBSD_CONF_ENABLE, 1); 1582 wbsd_write_config(host, WBSD_CONF_POWER, 0x20); 1583 1584 wbsd_lock_config(host); 1585 } 1586 1587 /* 1588 * Check that configured resources are correct. 1589 */ 1590 1591 static int wbsd_chip_validate(struct wbsd_host *host) 1592 { 1593 int base, irq, dma; 1594 1595 wbsd_unlock_config(host); 1596 1597 /* 1598 * Select SD/MMC function. 1599 */ 1600 wbsd_write_config(host, WBSD_CONF_DEVICE, DEVICE_SD); 1601 1602 /* 1603 * Read configuration. 1604 */ 1605 base = wbsd_read_config(host, WBSD_CONF_PORT_HI) << 8; 1606 base |= wbsd_read_config(host, WBSD_CONF_PORT_LO); 1607 1608 irq = wbsd_read_config(host, WBSD_CONF_IRQ); 1609 1610 dma = wbsd_read_config(host, WBSD_CONF_DRQ); 1611 1612 wbsd_lock_config(host); 1613 1614 /* 1615 * Validate against given configuration. 1616 */ 1617 if (base != host->base) 1618 return 0; 1619 if (irq != host->irq) 1620 return 0; 1621 if ((dma != host->dma) && (host->dma != -1)) 1622 return 0; 1623 1624 return 1; 1625 } 1626 1627 /* 1628 * Powers down the SD function 1629 */ 1630 1631 static void wbsd_chip_poweroff(struct wbsd_host *host) 1632 { 1633 wbsd_unlock_config(host); 1634 1635 wbsd_write_config(host, WBSD_CONF_DEVICE, DEVICE_SD); 1636 wbsd_write_config(host, WBSD_CONF_ENABLE, 0); 1637 1638 wbsd_lock_config(host); 1639 } 1640 1641 /*****************************************************************************\ 1642 * * 1643 * Devices setup and shutdown * 1644 * * 1645 \*****************************************************************************/ 1646 1647 static int wbsd_init(struct device *dev, int base, int irq, int dma, 1648 int pnp) 1649 { 1650 struct wbsd_host *host = NULL; 1651 struct mmc_host *mmc = NULL; 1652 int ret; 1653 1654 ret = wbsd_alloc_mmc(dev); 1655 if (ret) 1656 return ret; 1657 1658 mmc = dev_get_drvdata(dev); 1659 host = mmc_priv(mmc); 1660 1661 /* 1662 * Scan for hardware. 1663 */ 1664 ret = wbsd_scan(host); 1665 if (ret) { 1666 if (pnp && (ret == -ENODEV)) { 1667 pr_warn(DRIVER_NAME ": Unable to confirm device presence - you may experience lock-ups\n"); 1668 } else { 1669 wbsd_free_mmc(dev); 1670 return ret; 1671 } 1672 } 1673 1674 /* 1675 * Request resources. 1676 */ 1677 ret = wbsd_request_resources(host, base, irq, dma); 1678 if (ret) { 1679 wbsd_release_resources(host); 1680 wbsd_free_mmc(dev); 1681 return ret; 1682 } 1683 1684 /* 1685 * See if chip needs to be configured. 1686 */ 1687 if (pnp) { 1688 if ((host->config != 0) && !wbsd_chip_validate(host)) { 1689 pr_warn(DRIVER_NAME ": PnP active but chip not configured! You probably have a buggy BIOS. Configuring chip manually.\n"); 1690 wbsd_chip_config(host); 1691 } 1692 } else 1693 wbsd_chip_config(host); 1694 1695 /* 1696 * Power Management stuff. No idea how this works. 1697 * Not tested. 1698 */ 1699 #ifdef CONFIG_PM 1700 if (host->config) { 1701 wbsd_unlock_config(host); 1702 wbsd_write_config(host, WBSD_CONF_PME, 0xA0); 1703 wbsd_lock_config(host); 1704 } 1705 #endif 1706 /* 1707 * Allow device to initialise itself properly. 1708 */ 1709 mdelay(5); 1710 1711 /* 1712 * Reset the chip into a known state. 1713 */ 1714 wbsd_init_device(host); 1715 1716 mmc_add_host(mmc); 1717 1718 pr_info("%s: W83L51xD", mmc_hostname(mmc)); 1719 if (host->chip_id != 0) 1720 printk(" id %x", (int)host->chip_id); 1721 printk(" at 0x%x irq %d", (int)host->base, (int)host->irq); 1722 if (host->dma >= 0) 1723 printk(" dma %d", (int)host->dma); 1724 else 1725 printk(" FIFO"); 1726 if (pnp) 1727 printk(" PnP"); 1728 printk("\n"); 1729 1730 return 0; 1731 } 1732 1733 static void wbsd_shutdown(struct device *dev, int pnp) 1734 { 1735 struct mmc_host *mmc = dev_get_drvdata(dev); 1736 struct wbsd_host *host; 1737 1738 if (!mmc) 1739 return; 1740 1741 host = mmc_priv(mmc); 1742 1743 mmc_remove_host(mmc); 1744 1745 /* 1746 * Power down the SD/MMC function. 1747 */ 1748 if (!pnp) 1749 wbsd_chip_poweroff(host); 1750 1751 wbsd_release_resources(host); 1752 1753 wbsd_free_mmc(dev); 1754 } 1755 1756 /* 1757 * Non-PnP 1758 */ 1759 1760 static int wbsd_probe(struct platform_device *dev) 1761 { 1762 /* Use the module parameters for resources */ 1763 return wbsd_init(&dev->dev, param_io, param_irq, param_dma, 0); 1764 } 1765 1766 static int wbsd_remove(struct platform_device *dev) 1767 { 1768 wbsd_shutdown(&dev->dev, 0); 1769 1770 return 0; 1771 } 1772 1773 /* 1774 * PnP 1775 */ 1776 1777 #ifdef CONFIG_PNP 1778 1779 static int 1780 wbsd_pnp_probe(struct pnp_dev *pnpdev, const struct pnp_device_id *dev_id) 1781 { 1782 int io, irq, dma; 1783 1784 /* 1785 * Get resources from PnP layer. 1786 */ 1787 io = pnp_port_start(pnpdev, 0); 1788 irq = pnp_irq(pnpdev, 0); 1789 if (pnp_dma_valid(pnpdev, 0)) 1790 dma = pnp_dma(pnpdev, 0); 1791 else 1792 dma = -1; 1793 1794 DBGF("PnP resources: port %3x irq %d dma %d\n", io, irq, dma); 1795 1796 return wbsd_init(&pnpdev->dev, io, irq, dma, 1); 1797 } 1798 1799 static void wbsd_pnp_remove(struct pnp_dev *dev) 1800 { 1801 wbsd_shutdown(&dev->dev, 1); 1802 } 1803 1804 #endif /* CONFIG_PNP */ 1805 1806 /* 1807 * Power management 1808 */ 1809 1810 #ifdef CONFIG_PM 1811 1812 static int wbsd_platform_suspend(struct platform_device *dev, 1813 pm_message_t state) 1814 { 1815 struct mmc_host *mmc = platform_get_drvdata(dev); 1816 struct wbsd_host *host; 1817 1818 if (mmc == NULL) 1819 return 0; 1820 1821 DBGF("Suspending...\n"); 1822 1823 host = mmc_priv(mmc); 1824 1825 wbsd_chip_poweroff(host); 1826 return 0; 1827 } 1828 1829 static int wbsd_platform_resume(struct platform_device *dev) 1830 { 1831 struct mmc_host *mmc = platform_get_drvdata(dev); 1832 struct wbsd_host *host; 1833 1834 if (mmc == NULL) 1835 return 0; 1836 1837 DBGF("Resuming...\n"); 1838 1839 host = mmc_priv(mmc); 1840 1841 wbsd_chip_config(host); 1842 1843 /* 1844 * Allow device to initialise itself properly. 1845 */ 1846 mdelay(5); 1847 1848 wbsd_init_device(host); 1849 return 0; 1850 } 1851 1852 #ifdef CONFIG_PNP 1853 1854 static int wbsd_pnp_suspend(struct pnp_dev *pnp_dev, pm_message_t state) 1855 { 1856 struct mmc_host *mmc = dev_get_drvdata(&pnp_dev->dev); 1857 1858 if (mmc == NULL) 1859 return 0; 1860 1861 DBGF("Suspending...\n"); 1862 return 0; 1863 } 1864 1865 static int wbsd_pnp_resume(struct pnp_dev *pnp_dev) 1866 { 1867 struct mmc_host *mmc = dev_get_drvdata(&pnp_dev->dev); 1868 struct wbsd_host *host; 1869 1870 if (mmc == NULL) 1871 return 0; 1872 1873 DBGF("Resuming...\n"); 1874 1875 host = mmc_priv(mmc); 1876 1877 /* 1878 * See if chip needs to be configured. 1879 */ 1880 if (host->config != 0) { 1881 if (!wbsd_chip_validate(host)) { 1882 pr_warn(DRIVER_NAME ": PnP active but chip not configured! You probably have a buggy BIOS. Configuring chip manually.\n"); 1883 wbsd_chip_config(host); 1884 } 1885 } 1886 1887 /* 1888 * Allow device to initialise itself properly. 1889 */ 1890 mdelay(5); 1891 1892 wbsd_init_device(host); 1893 return 0; 1894 } 1895 1896 #endif /* CONFIG_PNP */ 1897 1898 #else /* CONFIG_PM */ 1899 1900 #define wbsd_platform_suspend NULL 1901 #define wbsd_platform_resume NULL 1902 1903 #define wbsd_pnp_suspend NULL 1904 #define wbsd_pnp_resume NULL 1905 1906 #endif /* CONFIG_PM */ 1907 1908 static struct platform_device *wbsd_device; 1909 1910 static struct platform_driver wbsd_driver = { 1911 .probe = wbsd_probe, 1912 .remove = wbsd_remove, 1913 1914 .suspend = wbsd_platform_suspend, 1915 .resume = wbsd_platform_resume, 1916 .driver = { 1917 .name = DRIVER_NAME, 1918 }, 1919 }; 1920 1921 #ifdef CONFIG_PNP 1922 1923 static struct pnp_driver wbsd_pnp_driver = { 1924 .name = DRIVER_NAME, 1925 .id_table = pnp_dev_table, 1926 .probe = wbsd_pnp_probe, 1927 .remove = wbsd_pnp_remove, 1928 1929 .suspend = wbsd_pnp_suspend, 1930 .resume = wbsd_pnp_resume, 1931 }; 1932 1933 #endif /* CONFIG_PNP */ 1934 1935 /* 1936 * Module loading/unloading 1937 */ 1938 1939 static int __init wbsd_drv_init(void) 1940 { 1941 int result; 1942 1943 pr_info(DRIVER_NAME 1944 ": Winbond W83L51xD SD/MMC card interface driver\n"); 1945 pr_info(DRIVER_NAME ": Copyright(c) Pierre Ossman\n"); 1946 1947 #ifdef CONFIG_PNP 1948 1949 if (!param_nopnp) { 1950 result = pnp_register_driver(&wbsd_pnp_driver); 1951 if (result < 0) 1952 return result; 1953 } 1954 #endif /* CONFIG_PNP */ 1955 1956 if (param_nopnp) { 1957 result = platform_driver_register(&wbsd_driver); 1958 if (result < 0) 1959 return result; 1960 1961 wbsd_device = platform_device_alloc(DRIVER_NAME, -1); 1962 if (!wbsd_device) { 1963 platform_driver_unregister(&wbsd_driver); 1964 return -ENOMEM; 1965 } 1966 1967 result = platform_device_add(wbsd_device); 1968 if (result) { 1969 platform_device_put(wbsd_device); 1970 platform_driver_unregister(&wbsd_driver); 1971 return result; 1972 } 1973 } 1974 1975 return 0; 1976 } 1977 1978 static void __exit wbsd_drv_exit(void) 1979 { 1980 #ifdef CONFIG_PNP 1981 1982 if (!param_nopnp) 1983 pnp_unregister_driver(&wbsd_pnp_driver); 1984 1985 #endif /* CONFIG_PNP */ 1986 1987 if (param_nopnp) { 1988 platform_device_unregister(wbsd_device); 1989 1990 platform_driver_unregister(&wbsd_driver); 1991 } 1992 1993 DBG("unloaded\n"); 1994 } 1995 1996 module_init(wbsd_drv_init); 1997 module_exit(wbsd_drv_exit); 1998 #ifdef CONFIG_PNP 1999 module_param_named(nopnp, param_nopnp, uint, 0444); 2000 #endif 2001 module_param_named(io, param_io, uint, 0444); 2002 module_param_named(irq, param_irq, uint, 0444); 2003 module_param_named(dma, param_dma, int, 0444); 2004 2005 MODULE_LICENSE("GPL"); 2006 MODULE_AUTHOR("Pierre Ossman <pierre@ossman.eu>"); 2007 MODULE_DESCRIPTION("Winbond W83L51xD SD/MMC card interface driver"); 2008 2009 #ifdef CONFIG_PNP 2010 MODULE_PARM_DESC(nopnp, "Scan for device instead of relying on PNP. (default 0)"); 2011 #endif 2012 MODULE_PARM_DESC(io, "I/O base to allocate. Must be 8 byte aligned. (default 0x248)"); 2013 MODULE_PARM_DESC(irq, "IRQ to allocate. (default 6)"); 2014 MODULE_PARM_DESC(dma, "DMA channel to allocate. -1 for no DMA. (default 2)"); 2015 2016 2017 2018 2019 2020 /* LDV_COMMENT_BEGIN_MAIN */ 2021 #ifdef LDV_MAIN0_sequence_infinite_withcheck_stateful 2022 2023 /*###########################################################################*/ 2024 2025 /*############## Driver Environment Generator 0.2 output ####################*/ 2026 2027 /*###########################################################################*/ 2028 2029 2030 2031 /* 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. */ 2032 void ldv_check_final_state(void); 2033 2034 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Test correct return result. */ 2035 void ldv_check_return_value(int res); 2036 2037 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Test correct return result of probe() function. */ 2038 void ldv_check_return_value_probe(int res); 2039 2040 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Initializes the model. */ 2041 void ldv_initialize(void); 2042 2043 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Reinitializes the model between distinct model function calls. */ 2044 void ldv_handler_precall(void); 2045 2046 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Returns arbitrary interger value. */ 2047 int nondet_int(void); 2048 2049 /* LDV_COMMENT_VAR_DECLARE_LDV Special variable for LDV verifier. */ 2050 int LDV_IN_INTERRUPT; 2051 2052 /* LDV_COMMENT_FUNCTION_MAIN Main function for LDV verifier. */ 2053 void ldv_main0_sequence_infinite_withcheck_stateful(void) { 2054 2055 2056 2057 /* LDV_COMMENT_BEGIN_VARIABLE_DECLARATION_PART */ 2058 /*============================= VARIABLE DECLARATION PART =============================*/ 2059 /** STRUCT: struct type: mmc_host_ops, struct name: wbsd_ops **/ 2060 /* content: static void wbsd_request(struct mmc_host *mmc, struct mmc_request *mrq)*/ 2061 /* LDV_COMMENT_BEGIN_PREP */ 2062 #define DRIVER_NAME "wbsd" 2063 #define DBG(x...) \ 2064 pr_debug(DRIVER_NAME ": " x) 2065 #define DBGF(f, x...) \ 2066 pr_debug(DRIVER_NAME " [%s()]: " f, __func__ , ##x) 2067 #ifdef CONFIG_PNP 2068 #endif 2069 #ifdef CONFIG_PNP 2070 #else 2071 #endif 2072 /* LDV_COMMENT_END_PREP */ 2073 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "wbsd_request" */ 2074 struct mmc_host * var_group1; 2075 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "wbsd_request" */ 2076 struct mmc_request * var_group2; 2077 /* LDV_COMMENT_BEGIN_PREP */ 2078 #ifdef CONFIG_PM 2079 #endif 2080 #ifdef CONFIG_PNP 2081 #endif 2082 #ifdef CONFIG_PM 2083 #ifdef CONFIG_PNP 2084 #endif 2085 #else 2086 #define wbsd_platform_suspend NULL 2087 #define wbsd_platform_resume NULL 2088 #define wbsd_pnp_suspend NULL 2089 #define wbsd_pnp_resume NULL 2090 #endif 2091 #ifdef CONFIG_PNP 2092 #endif 2093 #ifdef CONFIG_PNP 2094 #endif 2095 #ifdef CONFIG_PNP 2096 #endif 2097 #ifdef CONFIG_PNP 2098 #endif 2099 #ifdef CONFIG_PNP 2100 #endif 2101 /* LDV_COMMENT_END_PREP */ 2102 /* content: static void wbsd_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)*/ 2103 /* LDV_COMMENT_BEGIN_PREP */ 2104 #define DRIVER_NAME "wbsd" 2105 #define DBG(x...) \ 2106 pr_debug(DRIVER_NAME ": " x) 2107 #define DBGF(f, x...) \ 2108 pr_debug(DRIVER_NAME " [%s()]: " f, __func__ , ##x) 2109 #ifdef CONFIG_PNP 2110 #endif 2111 #ifdef CONFIG_PNP 2112 #else 2113 #endif 2114 #ifdef CONFIG_MMC_DEBUG 2115 #endif 2116 /* LDV_COMMENT_END_PREP */ 2117 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "wbsd_set_ios" */ 2118 struct mmc_ios * var_group3; 2119 /* LDV_COMMENT_BEGIN_PREP */ 2120 #ifdef CONFIG_PM 2121 #endif 2122 #ifdef CONFIG_PNP 2123 #endif 2124 #ifdef CONFIG_PM 2125 #ifdef CONFIG_PNP 2126 #endif 2127 #else 2128 #define wbsd_platform_suspend NULL 2129 #define wbsd_platform_resume NULL 2130 #define wbsd_pnp_suspend NULL 2131 #define wbsd_pnp_resume NULL 2132 #endif 2133 #ifdef CONFIG_PNP 2134 #endif 2135 #ifdef CONFIG_PNP 2136 #endif 2137 #ifdef CONFIG_PNP 2138 #endif 2139 #ifdef CONFIG_PNP 2140 #endif 2141 #ifdef CONFIG_PNP 2142 #endif 2143 /* LDV_COMMENT_END_PREP */ 2144 /* content: static int wbsd_get_ro(struct mmc_host *mmc)*/ 2145 /* LDV_COMMENT_BEGIN_PREP */ 2146 #define DRIVER_NAME "wbsd" 2147 #define DBG(x...) \ 2148 pr_debug(DRIVER_NAME ": " x) 2149 #define DBGF(f, x...) \ 2150 pr_debug(DRIVER_NAME " [%s()]: " f, __func__ , ##x) 2151 #ifdef CONFIG_PNP 2152 #endif 2153 #ifdef CONFIG_PNP 2154 #else 2155 #endif 2156 #ifdef CONFIG_MMC_DEBUG 2157 #endif 2158 /* LDV_COMMENT_END_PREP */ 2159 /* LDV_COMMENT_BEGIN_PREP */ 2160 #ifdef CONFIG_PM 2161 #endif 2162 #ifdef CONFIG_PNP 2163 #endif 2164 #ifdef CONFIG_PM 2165 #ifdef CONFIG_PNP 2166 #endif 2167 #else 2168 #define wbsd_platform_suspend NULL 2169 #define wbsd_platform_resume NULL 2170 #define wbsd_pnp_suspend NULL 2171 #define wbsd_pnp_resume NULL 2172 #endif 2173 #ifdef CONFIG_PNP 2174 #endif 2175 #ifdef CONFIG_PNP 2176 #endif 2177 #ifdef CONFIG_PNP 2178 #endif 2179 #ifdef CONFIG_PNP 2180 #endif 2181 #ifdef CONFIG_PNP 2182 #endif 2183 /* LDV_COMMENT_END_PREP */ 2184 2185 /** STRUCT: struct type: platform_driver, struct name: wbsd_driver **/ 2186 /* content: static int wbsd_probe(struct platform_device *dev)*/ 2187 /* LDV_COMMENT_BEGIN_PREP */ 2188 #define DRIVER_NAME "wbsd" 2189 #define DBG(x...) \ 2190 pr_debug(DRIVER_NAME ": " x) 2191 #define DBGF(f, x...) \ 2192 pr_debug(DRIVER_NAME " [%s()]: " f, __func__ , ##x) 2193 #ifdef CONFIG_PNP 2194 #endif 2195 #ifdef CONFIG_PNP 2196 #else 2197 #endif 2198 #ifdef CONFIG_MMC_DEBUG 2199 #endif 2200 #ifdef CONFIG_PM 2201 #endif 2202 /* LDV_COMMENT_END_PREP */ 2203 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "wbsd_probe" */ 2204 struct platform_device * var_group4; 2205 /* LDV_COMMENT_VAR_DECLARE Variable declaration for test return result from function call "wbsd_probe" */ 2206 static int res_wbsd_probe_48; 2207 /* LDV_COMMENT_BEGIN_PREP */ 2208 #ifdef CONFIG_PNP 2209 #endif 2210 #ifdef CONFIG_PM 2211 #ifdef CONFIG_PNP 2212 #endif 2213 #else 2214 #define wbsd_platform_suspend NULL 2215 #define wbsd_platform_resume NULL 2216 #define wbsd_pnp_suspend NULL 2217 #define wbsd_pnp_resume NULL 2218 #endif 2219 #ifdef CONFIG_PNP 2220 #endif 2221 #ifdef CONFIG_PNP 2222 #endif 2223 #ifdef CONFIG_PNP 2224 #endif 2225 #ifdef CONFIG_PNP 2226 #endif 2227 #ifdef CONFIG_PNP 2228 #endif 2229 /* LDV_COMMENT_END_PREP */ 2230 /* content: static int wbsd_remove(struct platform_device *dev)*/ 2231 /* LDV_COMMENT_BEGIN_PREP */ 2232 #define DRIVER_NAME "wbsd" 2233 #define DBG(x...) \ 2234 pr_debug(DRIVER_NAME ": " x) 2235 #define DBGF(f, x...) \ 2236 pr_debug(DRIVER_NAME " [%s()]: " f, __func__ , ##x) 2237 #ifdef CONFIG_PNP 2238 #endif 2239 #ifdef CONFIG_PNP 2240 #else 2241 #endif 2242 #ifdef CONFIG_MMC_DEBUG 2243 #endif 2244 #ifdef CONFIG_PM 2245 #endif 2246 /* LDV_COMMENT_END_PREP */ 2247 /* LDV_COMMENT_BEGIN_PREP */ 2248 #ifdef CONFIG_PNP 2249 #endif 2250 #ifdef CONFIG_PM 2251 #ifdef CONFIG_PNP 2252 #endif 2253 #else 2254 #define wbsd_platform_suspend NULL 2255 #define wbsd_platform_resume NULL 2256 #define wbsd_pnp_suspend NULL 2257 #define wbsd_pnp_resume NULL 2258 #endif 2259 #ifdef CONFIG_PNP 2260 #endif 2261 #ifdef CONFIG_PNP 2262 #endif 2263 #ifdef CONFIG_PNP 2264 #endif 2265 #ifdef CONFIG_PNP 2266 #endif 2267 #ifdef CONFIG_PNP 2268 #endif 2269 /* LDV_COMMENT_END_PREP */ 2270 /* content: static int wbsd_platform_suspend(struct platform_device *dev, pm_message_t state)*/ 2271 /* LDV_COMMENT_BEGIN_PREP */ 2272 #define DRIVER_NAME "wbsd" 2273 #define DBG(x...) \ 2274 pr_debug(DRIVER_NAME ": " x) 2275 #define DBGF(f, x...) \ 2276 pr_debug(DRIVER_NAME " [%s()]: " f, __func__ , ##x) 2277 #ifdef CONFIG_PNP 2278 #endif 2279 #ifdef CONFIG_PNP 2280 #else 2281 #endif 2282 #ifdef CONFIG_MMC_DEBUG 2283 #endif 2284 #ifdef CONFIG_PM 2285 #endif 2286 #ifdef CONFIG_PNP 2287 #endif 2288 #ifdef CONFIG_PM 2289 /* LDV_COMMENT_END_PREP */ 2290 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "wbsd_platform_suspend" */ 2291 pm_message_t var_wbsd_platform_suspend_52_p1; 2292 /* LDV_COMMENT_BEGIN_PREP */ 2293 #ifdef CONFIG_PNP 2294 #endif 2295 #else 2296 #define wbsd_platform_suspend NULL 2297 #define wbsd_platform_resume NULL 2298 #define wbsd_pnp_suspend NULL 2299 #define wbsd_pnp_resume NULL 2300 #endif 2301 #ifdef CONFIG_PNP 2302 #endif 2303 #ifdef CONFIG_PNP 2304 #endif 2305 #ifdef CONFIG_PNP 2306 #endif 2307 #ifdef CONFIG_PNP 2308 #endif 2309 #ifdef CONFIG_PNP 2310 #endif 2311 /* LDV_COMMENT_END_PREP */ 2312 /* content: static int wbsd_platform_resume(struct platform_device *dev)*/ 2313 /* LDV_COMMENT_BEGIN_PREP */ 2314 #define DRIVER_NAME "wbsd" 2315 #define DBG(x...) \ 2316 pr_debug(DRIVER_NAME ": " x) 2317 #define DBGF(f, x...) \ 2318 pr_debug(DRIVER_NAME " [%s()]: " f, __func__ , ##x) 2319 #ifdef CONFIG_PNP 2320 #endif 2321 #ifdef CONFIG_PNP 2322 #else 2323 #endif 2324 #ifdef CONFIG_MMC_DEBUG 2325 #endif 2326 #ifdef CONFIG_PM 2327 #endif 2328 #ifdef CONFIG_PNP 2329 #endif 2330 #ifdef CONFIG_PM 2331 /* LDV_COMMENT_END_PREP */ 2332 /* LDV_COMMENT_BEGIN_PREP */ 2333 #ifdef CONFIG_PNP 2334 #endif 2335 #else 2336 #define wbsd_platform_suspend NULL 2337 #define wbsd_platform_resume NULL 2338 #define wbsd_pnp_suspend NULL 2339 #define wbsd_pnp_resume NULL 2340 #endif 2341 #ifdef CONFIG_PNP 2342 #endif 2343 #ifdef CONFIG_PNP 2344 #endif 2345 #ifdef CONFIG_PNP 2346 #endif 2347 #ifdef CONFIG_PNP 2348 #endif 2349 #ifdef CONFIG_PNP 2350 #endif 2351 /* LDV_COMMENT_END_PREP */ 2352 2353 /** STRUCT: struct type: pnp_driver, struct name: wbsd_pnp_driver **/ 2354 /* content: static int wbsd_pnp_probe(struct pnp_dev *pnpdev, const struct pnp_device_id *dev_id)*/ 2355 /* LDV_COMMENT_BEGIN_PREP */ 2356 #define DRIVER_NAME "wbsd" 2357 #define DBG(x...) \ 2358 pr_debug(DRIVER_NAME ": " x) 2359 #define DBGF(f, x...) \ 2360 pr_debug(DRIVER_NAME " [%s()]: " f, __func__ , ##x) 2361 #ifdef CONFIG_PNP 2362 #endif 2363 #ifdef CONFIG_PNP 2364 #else 2365 #endif 2366 #ifdef CONFIG_MMC_DEBUG 2367 #endif 2368 #ifdef CONFIG_PM 2369 #endif 2370 #ifdef CONFIG_PNP 2371 /* LDV_COMMENT_END_PREP */ 2372 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "wbsd_pnp_probe" */ 2373 struct pnp_dev * var_group5; 2374 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "wbsd_pnp_probe" */ 2375 const struct pnp_device_id * var_wbsd_pnp_probe_50_p1; 2376 /* LDV_COMMENT_VAR_DECLARE Variable declaration for test return result from function call "wbsd_pnp_probe" */ 2377 static int res_wbsd_pnp_probe_50; 2378 /* LDV_COMMENT_BEGIN_PREP */ 2379 #endif 2380 #ifdef CONFIG_PM 2381 #ifdef CONFIG_PNP 2382 #endif 2383 #else 2384 #define wbsd_platform_suspend NULL 2385 #define wbsd_platform_resume NULL 2386 #define wbsd_pnp_suspend NULL 2387 #define wbsd_pnp_resume NULL 2388 #endif 2389 #ifdef CONFIG_PNP 2390 #endif 2391 #ifdef CONFIG_PNP 2392 #endif 2393 #ifdef CONFIG_PNP 2394 #endif 2395 #ifdef CONFIG_PNP 2396 #endif 2397 #ifdef CONFIG_PNP 2398 #endif 2399 /* LDV_COMMENT_END_PREP */ 2400 /* content: static void wbsd_pnp_remove(struct pnp_dev *dev)*/ 2401 /* LDV_COMMENT_BEGIN_PREP */ 2402 #define DRIVER_NAME "wbsd" 2403 #define DBG(x...) \ 2404 pr_debug(DRIVER_NAME ": " x) 2405 #define DBGF(f, x...) \ 2406 pr_debug(DRIVER_NAME " [%s()]: " f, __func__ , ##x) 2407 #ifdef CONFIG_PNP 2408 #endif 2409 #ifdef CONFIG_PNP 2410 #else 2411 #endif 2412 #ifdef CONFIG_MMC_DEBUG 2413 #endif 2414 #ifdef CONFIG_PM 2415 #endif 2416 #ifdef CONFIG_PNP 2417 /* LDV_COMMENT_END_PREP */ 2418 /* LDV_COMMENT_BEGIN_PREP */ 2419 #endif 2420 #ifdef CONFIG_PM 2421 #ifdef CONFIG_PNP 2422 #endif 2423 #else 2424 #define wbsd_platform_suspend NULL 2425 #define wbsd_platform_resume NULL 2426 #define wbsd_pnp_suspend NULL 2427 #define wbsd_pnp_resume NULL 2428 #endif 2429 #ifdef CONFIG_PNP 2430 #endif 2431 #ifdef CONFIG_PNP 2432 #endif 2433 #ifdef CONFIG_PNP 2434 #endif 2435 #ifdef CONFIG_PNP 2436 #endif 2437 #ifdef CONFIG_PNP 2438 #endif 2439 /* LDV_COMMENT_END_PREP */ 2440 /* content: static int wbsd_pnp_suspend(struct pnp_dev *pnp_dev, pm_message_t state)*/ 2441 /* LDV_COMMENT_BEGIN_PREP */ 2442 #define DRIVER_NAME "wbsd" 2443 #define DBG(x...) \ 2444 pr_debug(DRIVER_NAME ": " x) 2445 #define DBGF(f, x...) \ 2446 pr_debug(DRIVER_NAME " [%s()]: " f, __func__ , ##x) 2447 #ifdef CONFIG_PNP 2448 #endif 2449 #ifdef CONFIG_PNP 2450 #else 2451 #endif 2452 #ifdef CONFIG_MMC_DEBUG 2453 #endif 2454 #ifdef CONFIG_PM 2455 #endif 2456 #ifdef CONFIG_PNP 2457 #endif 2458 #ifdef CONFIG_PM 2459 #ifdef CONFIG_PNP 2460 /* LDV_COMMENT_END_PREP */ 2461 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "wbsd_pnp_suspend" */ 2462 pm_message_t var_wbsd_pnp_suspend_54_p1; 2463 /* LDV_COMMENT_BEGIN_PREP */ 2464 #endif 2465 #else 2466 #define wbsd_platform_suspend NULL 2467 #define wbsd_platform_resume NULL 2468 #define wbsd_pnp_suspend NULL 2469 #define wbsd_pnp_resume NULL 2470 #endif 2471 #ifdef CONFIG_PNP 2472 #endif 2473 #ifdef CONFIG_PNP 2474 #endif 2475 #ifdef CONFIG_PNP 2476 #endif 2477 #ifdef CONFIG_PNP 2478 #endif 2479 #ifdef CONFIG_PNP 2480 #endif 2481 /* LDV_COMMENT_END_PREP */ 2482 /* content: static int wbsd_pnp_resume(struct pnp_dev *pnp_dev)*/ 2483 /* LDV_COMMENT_BEGIN_PREP */ 2484 #define DRIVER_NAME "wbsd" 2485 #define DBG(x...) \ 2486 pr_debug(DRIVER_NAME ": " x) 2487 #define DBGF(f, x...) \ 2488 pr_debug(DRIVER_NAME " [%s()]: " f, __func__ , ##x) 2489 #ifdef CONFIG_PNP 2490 #endif 2491 #ifdef CONFIG_PNP 2492 #else 2493 #endif 2494 #ifdef CONFIG_MMC_DEBUG 2495 #endif 2496 #ifdef CONFIG_PM 2497 #endif 2498 #ifdef CONFIG_PNP 2499 #endif 2500 #ifdef CONFIG_PM 2501 #ifdef CONFIG_PNP 2502 /* LDV_COMMENT_END_PREP */ 2503 /* LDV_COMMENT_BEGIN_PREP */ 2504 #endif 2505 #else 2506 #define wbsd_platform_suspend NULL 2507 #define wbsd_platform_resume NULL 2508 #define wbsd_pnp_suspend NULL 2509 #define wbsd_pnp_resume NULL 2510 #endif 2511 #ifdef CONFIG_PNP 2512 #endif 2513 #ifdef CONFIG_PNP 2514 #endif 2515 #ifdef CONFIG_PNP 2516 #endif 2517 #ifdef CONFIG_PNP 2518 #endif 2519 #ifdef CONFIG_PNP 2520 #endif 2521 /* LDV_COMMENT_END_PREP */ 2522 2523 /** CALLBACK SECTION request_irq **/ 2524 /* content: static irqreturn_t wbsd_irq(int irq, void *dev_id)*/ 2525 /* LDV_COMMENT_BEGIN_PREP */ 2526 #define DRIVER_NAME "wbsd" 2527 #define DBG(x...) \ 2528 pr_debug(DRIVER_NAME ": " x) 2529 #define DBGF(f, x...) \ 2530 pr_debug(DRIVER_NAME " [%s()]: " f, __func__ , ##x) 2531 #ifdef CONFIG_PNP 2532 #endif 2533 #ifdef CONFIG_PNP 2534 #else 2535 #endif 2536 #ifdef CONFIG_MMC_DEBUG 2537 #endif 2538 /* LDV_COMMENT_END_PREP */ 2539 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "wbsd_irq" */ 2540 int var_wbsd_irq_31_p0; 2541 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "wbsd_irq" */ 2542 void * var_wbsd_irq_31_p1; 2543 /* LDV_COMMENT_BEGIN_PREP */ 2544 #ifdef CONFIG_PM 2545 #endif 2546 #ifdef CONFIG_PNP 2547 #endif 2548 #ifdef CONFIG_PM 2549 #ifdef CONFIG_PNP 2550 #endif 2551 #else 2552 #define wbsd_platform_suspend NULL 2553 #define wbsd_platform_resume NULL 2554 #define wbsd_pnp_suspend NULL 2555 #define wbsd_pnp_resume NULL 2556 #endif 2557 #ifdef CONFIG_PNP 2558 #endif 2559 #ifdef CONFIG_PNP 2560 #endif 2561 #ifdef CONFIG_PNP 2562 #endif 2563 #ifdef CONFIG_PNP 2564 #endif 2565 #ifdef CONFIG_PNP 2566 #endif 2567 /* LDV_COMMENT_END_PREP */ 2568 2569 /** TIMER SECTION timer **/ 2570 /* content: static void wbsd_reset_ignore(unsigned long data)*/ 2571 /* LDV_COMMENT_BEGIN_PREP */ 2572 #define DRIVER_NAME "wbsd" 2573 #define DBG(x...) \ 2574 pr_debug(DRIVER_NAME ": " x) 2575 #define DBGF(f, x...) \ 2576 pr_debug(DRIVER_NAME " [%s()]: " f, __func__ , ##x) 2577 #ifdef CONFIG_PNP 2578 #endif 2579 #ifdef CONFIG_PNP 2580 #else 2581 #endif 2582 #ifdef CONFIG_MMC_DEBUG 2583 #endif 2584 /* LDV_COMMENT_END_PREP */ 2585 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "wbsd_reset_ignore" */ 2586 unsigned long var_wbsd_reset_ignore_24_p0; 2587 /* LDV_COMMENT_BEGIN_PREP */ 2588 #ifdef CONFIG_PM 2589 #endif 2590 #ifdef CONFIG_PNP 2591 #endif 2592 #ifdef CONFIG_PM 2593 #ifdef CONFIG_PNP 2594 #endif 2595 #else 2596 #define wbsd_platform_suspend NULL 2597 #define wbsd_platform_resume NULL 2598 #define wbsd_pnp_suspend NULL 2599 #define wbsd_pnp_resume NULL 2600 #endif 2601 #ifdef CONFIG_PNP 2602 #endif 2603 #ifdef CONFIG_PNP 2604 #endif 2605 #ifdef CONFIG_PNP 2606 #endif 2607 #ifdef CONFIG_PNP 2608 #endif 2609 #ifdef CONFIG_PNP 2610 #endif 2611 /* LDV_COMMENT_END_PREP */ 2612 2613 2614 2615 2616 /* LDV_COMMENT_END_VARIABLE_DECLARATION_PART */ 2617 /* LDV_COMMENT_BEGIN_VARIABLE_INITIALIZING_PART */ 2618 /*============================= VARIABLE INITIALIZING PART =============================*/ 2619 LDV_IN_INTERRUPT=1; 2620 2621 2622 2623 2624 /* LDV_COMMENT_END_VARIABLE_INITIALIZING_PART */ 2625 /* LDV_COMMENT_BEGIN_FUNCTION_CALL_SECTION */ 2626 /*============================= FUNCTION CALL SECTION =============================*/ 2627 /* LDV_COMMENT_FUNCTION_CALL Initialize LDV model. */ 2628 ldv_initialize(); 2629 2630 /** INIT: init_type: ST_MODULE_INIT **/ 2631 /* content: static int __init wbsd_drv_init(void)*/ 2632 /* LDV_COMMENT_BEGIN_PREP */ 2633 #define DRIVER_NAME "wbsd" 2634 #define DBG(x...) \ 2635 pr_debug(DRIVER_NAME ": " x) 2636 #define DBGF(f, x...) \ 2637 pr_debug(DRIVER_NAME " [%s()]: " f, __func__ , ##x) 2638 #ifdef CONFIG_PNP 2639 #endif 2640 #ifdef CONFIG_PNP 2641 #else 2642 #endif 2643 #ifdef CONFIG_MMC_DEBUG 2644 #endif 2645 #ifdef CONFIG_PM 2646 #endif 2647 #ifdef CONFIG_PNP 2648 #endif 2649 #ifdef CONFIG_PM 2650 #ifdef CONFIG_PNP 2651 #endif 2652 #else 2653 #define wbsd_platform_suspend NULL 2654 #define wbsd_platform_resume NULL 2655 #define wbsd_pnp_suspend NULL 2656 #define wbsd_pnp_resume NULL 2657 #endif 2658 #ifdef CONFIG_PNP 2659 #endif 2660 /* LDV_COMMENT_END_PREP */ 2661 /* LDV_COMMENT_FUNCTION_CALL Kernel calls driver init function after driver loading to kernel. This function declared as "MODULE_INIT(function name)". */ 2662 ldv_handler_precall(); 2663 if(wbsd_drv_init()) 2664 goto ldv_final; 2665 /* LDV_COMMENT_BEGIN_PREP */ 2666 #ifdef CONFIG_PNP 2667 #endif 2668 #ifdef CONFIG_PNP 2669 #endif 2670 #ifdef CONFIG_PNP 2671 #endif 2672 /* LDV_COMMENT_END_PREP */ 2673 2674 2675 int ldv_s_wbsd_driver_platform_driver = 0; 2676 2677 int ldv_s_wbsd_pnp_driver_pnp_driver = 0; 2678 2679 2680 2681 2682 2683 2684 2685 while( nondet_int() 2686 || !(ldv_s_wbsd_driver_platform_driver == 0) 2687 || !(ldv_s_wbsd_pnp_driver_pnp_driver == 0) 2688 ) { 2689 2690 switch(nondet_int()) { 2691 2692 case 0: { 2693 2694 /** STRUCT: struct type: mmc_host_ops, struct name: wbsd_ops **/ 2695 2696 2697 /* content: static void wbsd_request(struct mmc_host *mmc, struct mmc_request *mrq)*/ 2698 /* LDV_COMMENT_BEGIN_PREP */ 2699 #define DRIVER_NAME "wbsd" 2700 #define DBG(x...) \ 2701 pr_debug(DRIVER_NAME ": " x) 2702 #define DBGF(f, x...) \ 2703 pr_debug(DRIVER_NAME " [%s()]: " f, __func__ , ##x) 2704 #ifdef CONFIG_PNP 2705 #endif 2706 #ifdef CONFIG_PNP 2707 #else 2708 #endif 2709 /* LDV_COMMENT_END_PREP */ 2710 /* LDV_COMMENT_FUNCTION_CALL Function from field "request" from driver structure with callbacks "wbsd_ops" */ 2711 ldv_handler_precall(); 2712 wbsd_request( var_group1, var_group2); 2713 /* LDV_COMMENT_BEGIN_PREP */ 2714 #ifdef CONFIG_PM 2715 #endif 2716 #ifdef CONFIG_PNP 2717 #endif 2718 #ifdef CONFIG_PM 2719 #ifdef CONFIG_PNP 2720 #endif 2721 #else 2722 #define wbsd_platform_suspend NULL 2723 #define wbsd_platform_resume NULL 2724 #define wbsd_pnp_suspend NULL 2725 #define wbsd_pnp_resume NULL 2726 #endif 2727 #ifdef CONFIG_PNP 2728 #endif 2729 #ifdef CONFIG_PNP 2730 #endif 2731 #ifdef CONFIG_PNP 2732 #endif 2733 #ifdef CONFIG_PNP 2734 #endif 2735 #ifdef CONFIG_PNP 2736 #endif 2737 /* LDV_COMMENT_END_PREP */ 2738 2739 2740 2741 2742 } 2743 2744 break; 2745 case 1: { 2746 2747 /** STRUCT: struct type: mmc_host_ops, struct name: wbsd_ops **/ 2748 2749 2750 /* content: static void wbsd_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)*/ 2751 /* LDV_COMMENT_BEGIN_PREP */ 2752 #define DRIVER_NAME "wbsd" 2753 #define DBG(x...) \ 2754 pr_debug(DRIVER_NAME ": " x) 2755 #define DBGF(f, x...) \ 2756 pr_debug(DRIVER_NAME " [%s()]: " f, __func__ , ##x) 2757 #ifdef CONFIG_PNP 2758 #endif 2759 #ifdef CONFIG_PNP 2760 #else 2761 #endif 2762 #ifdef CONFIG_MMC_DEBUG 2763 #endif 2764 /* LDV_COMMENT_END_PREP */ 2765 /* LDV_COMMENT_FUNCTION_CALL Function from field "set_ios" from driver structure with callbacks "wbsd_ops" */ 2766 ldv_handler_precall(); 2767 wbsd_set_ios( var_group1, var_group3); 2768 /* LDV_COMMENT_BEGIN_PREP */ 2769 #ifdef CONFIG_PM 2770 #endif 2771 #ifdef CONFIG_PNP 2772 #endif 2773 #ifdef CONFIG_PM 2774 #ifdef CONFIG_PNP 2775 #endif 2776 #else 2777 #define wbsd_platform_suspend NULL 2778 #define wbsd_platform_resume NULL 2779 #define wbsd_pnp_suspend NULL 2780 #define wbsd_pnp_resume NULL 2781 #endif 2782 #ifdef CONFIG_PNP 2783 #endif 2784 #ifdef CONFIG_PNP 2785 #endif 2786 #ifdef CONFIG_PNP 2787 #endif 2788 #ifdef CONFIG_PNP 2789 #endif 2790 #ifdef CONFIG_PNP 2791 #endif 2792 /* LDV_COMMENT_END_PREP */ 2793 2794 2795 2796 2797 } 2798 2799 break; 2800 case 2: { 2801 2802 /** STRUCT: struct type: mmc_host_ops, struct name: wbsd_ops **/ 2803 2804 2805 /* content: static int wbsd_get_ro(struct mmc_host *mmc)*/ 2806 /* LDV_COMMENT_BEGIN_PREP */ 2807 #define DRIVER_NAME "wbsd" 2808 #define DBG(x...) \ 2809 pr_debug(DRIVER_NAME ": " x) 2810 #define DBGF(f, x...) \ 2811 pr_debug(DRIVER_NAME " [%s()]: " f, __func__ , ##x) 2812 #ifdef CONFIG_PNP 2813 #endif 2814 #ifdef CONFIG_PNP 2815 #else 2816 #endif 2817 #ifdef CONFIG_MMC_DEBUG 2818 #endif 2819 /* LDV_COMMENT_END_PREP */ 2820 /* LDV_COMMENT_FUNCTION_CALL Function from field "get_ro" from driver structure with callbacks "wbsd_ops" */ 2821 ldv_handler_precall(); 2822 wbsd_get_ro( var_group1); 2823 /* LDV_COMMENT_BEGIN_PREP */ 2824 #ifdef CONFIG_PM 2825 #endif 2826 #ifdef CONFIG_PNP 2827 #endif 2828 #ifdef CONFIG_PM 2829 #ifdef CONFIG_PNP 2830 #endif 2831 #else 2832 #define wbsd_platform_suspend NULL 2833 #define wbsd_platform_resume NULL 2834 #define wbsd_pnp_suspend NULL 2835 #define wbsd_pnp_resume NULL 2836 #endif 2837 #ifdef CONFIG_PNP 2838 #endif 2839 #ifdef CONFIG_PNP 2840 #endif 2841 #ifdef CONFIG_PNP 2842 #endif 2843 #ifdef CONFIG_PNP 2844 #endif 2845 #ifdef CONFIG_PNP 2846 #endif 2847 /* LDV_COMMENT_END_PREP */ 2848 2849 2850 2851 2852 } 2853 2854 break; 2855 case 3: { 2856 2857 /** STRUCT: struct type: platform_driver, struct name: wbsd_driver **/ 2858 if(ldv_s_wbsd_driver_platform_driver==0) { 2859 2860 /* content: static int wbsd_probe(struct platform_device *dev)*/ 2861 /* LDV_COMMENT_BEGIN_PREP */ 2862 #define DRIVER_NAME "wbsd" 2863 #define DBG(x...) \ 2864 pr_debug(DRIVER_NAME ": " x) 2865 #define DBGF(f, x...) \ 2866 pr_debug(DRIVER_NAME " [%s()]: " f, __func__ , ##x) 2867 #ifdef CONFIG_PNP 2868 #endif 2869 #ifdef CONFIG_PNP 2870 #else 2871 #endif 2872 #ifdef CONFIG_MMC_DEBUG 2873 #endif 2874 #ifdef CONFIG_PM 2875 #endif 2876 /* LDV_COMMENT_END_PREP */ 2877 /* LDV_COMMENT_FUNCTION_CALL Function from field "probe" from driver structure with callbacks "wbsd_driver". Standart function test for correct return result. */ 2878 res_wbsd_probe_48 = wbsd_probe( var_group4); 2879 ldv_check_return_value(res_wbsd_probe_48); 2880 ldv_check_return_value_probe(res_wbsd_probe_48); 2881 if(res_wbsd_probe_48) 2882 goto ldv_module_exit; 2883 /* LDV_COMMENT_BEGIN_PREP */ 2884 #ifdef CONFIG_PNP 2885 #endif 2886 #ifdef CONFIG_PM 2887 #ifdef CONFIG_PNP 2888 #endif 2889 #else 2890 #define wbsd_platform_suspend NULL 2891 #define wbsd_platform_resume NULL 2892 #define wbsd_pnp_suspend NULL 2893 #define wbsd_pnp_resume NULL 2894 #endif 2895 #ifdef CONFIG_PNP 2896 #endif 2897 #ifdef CONFIG_PNP 2898 #endif 2899 #ifdef CONFIG_PNP 2900 #endif 2901 #ifdef CONFIG_PNP 2902 #endif 2903 #ifdef CONFIG_PNP 2904 #endif 2905 /* LDV_COMMENT_END_PREP */ 2906 ldv_s_wbsd_driver_platform_driver++; 2907 2908 } 2909 2910 } 2911 2912 break; 2913 case 4: { 2914 2915 /** STRUCT: struct type: platform_driver, struct name: wbsd_driver **/ 2916 if(ldv_s_wbsd_driver_platform_driver==1) { 2917 2918 /* content: static int wbsd_platform_suspend(struct platform_device *dev, pm_message_t state)*/ 2919 /* LDV_COMMENT_BEGIN_PREP */ 2920 #define DRIVER_NAME "wbsd" 2921 #define DBG(x...) \ 2922 pr_debug(DRIVER_NAME ": " x) 2923 #define DBGF(f, x...) \ 2924 pr_debug(DRIVER_NAME " [%s()]: " f, __func__ , ##x) 2925 #ifdef CONFIG_PNP 2926 #endif 2927 #ifdef CONFIG_PNP 2928 #else 2929 #endif 2930 #ifdef CONFIG_MMC_DEBUG 2931 #endif 2932 #ifdef CONFIG_PM 2933 #endif 2934 #ifdef CONFIG_PNP 2935 #endif 2936 #ifdef CONFIG_PM 2937 /* LDV_COMMENT_END_PREP */ 2938 /* LDV_COMMENT_FUNCTION_CALL Function from field "suspend" from driver structure with callbacks "wbsd_driver" */ 2939 ldv_handler_precall(); 2940 wbsd_platform_suspend( var_group4, var_wbsd_platform_suspend_52_p1); 2941 /* LDV_COMMENT_BEGIN_PREP */ 2942 #ifdef CONFIG_PNP 2943 #endif 2944 #else 2945 #define wbsd_platform_suspend NULL 2946 #define wbsd_platform_resume NULL 2947 #define wbsd_pnp_suspend NULL 2948 #define wbsd_pnp_resume NULL 2949 #endif 2950 #ifdef CONFIG_PNP 2951 #endif 2952 #ifdef CONFIG_PNP 2953 #endif 2954 #ifdef CONFIG_PNP 2955 #endif 2956 #ifdef CONFIG_PNP 2957 #endif 2958 #ifdef CONFIG_PNP 2959 #endif 2960 /* LDV_COMMENT_END_PREP */ 2961 ldv_s_wbsd_driver_platform_driver++; 2962 2963 } 2964 2965 } 2966 2967 break; 2968 case 5: { 2969 2970 /** STRUCT: struct type: platform_driver, struct name: wbsd_driver **/ 2971 if(ldv_s_wbsd_driver_platform_driver==2) { 2972 2973 /* content: static int wbsd_platform_resume(struct platform_device *dev)*/ 2974 /* LDV_COMMENT_BEGIN_PREP */ 2975 #define DRIVER_NAME "wbsd" 2976 #define DBG(x...) \ 2977 pr_debug(DRIVER_NAME ": " x) 2978 #define DBGF(f, x...) \ 2979 pr_debug(DRIVER_NAME " [%s()]: " f, __func__ , ##x) 2980 #ifdef CONFIG_PNP 2981 #endif 2982 #ifdef CONFIG_PNP 2983 #else 2984 #endif 2985 #ifdef CONFIG_MMC_DEBUG 2986 #endif 2987 #ifdef CONFIG_PM 2988 #endif 2989 #ifdef CONFIG_PNP 2990 #endif 2991 #ifdef CONFIG_PM 2992 /* LDV_COMMENT_END_PREP */ 2993 /* LDV_COMMENT_FUNCTION_CALL Function from field "resume" from driver structure with callbacks "wbsd_driver" */ 2994 ldv_handler_precall(); 2995 wbsd_platform_resume( var_group4); 2996 /* LDV_COMMENT_BEGIN_PREP */ 2997 #ifdef CONFIG_PNP 2998 #endif 2999 #else 3000 #define wbsd_platform_suspend NULL 3001 #define wbsd_platform_resume NULL 3002 #define wbsd_pnp_suspend NULL 3003 #define wbsd_pnp_resume NULL 3004 #endif 3005 #ifdef CONFIG_PNP 3006 #endif 3007 #ifdef CONFIG_PNP 3008 #endif 3009 #ifdef CONFIG_PNP 3010 #endif 3011 #ifdef CONFIG_PNP 3012 #endif 3013 #ifdef CONFIG_PNP 3014 #endif 3015 /* LDV_COMMENT_END_PREP */ 3016 ldv_s_wbsd_driver_platform_driver++; 3017 3018 } 3019 3020 } 3021 3022 break; 3023 case 6: { 3024 3025 /** STRUCT: struct type: platform_driver, struct name: wbsd_driver **/ 3026 if(ldv_s_wbsd_driver_platform_driver==3) { 3027 3028 /* content: static int wbsd_remove(struct platform_device *dev)*/ 3029 /* LDV_COMMENT_BEGIN_PREP */ 3030 #define DRIVER_NAME "wbsd" 3031 #define DBG(x...) \ 3032 pr_debug(DRIVER_NAME ": " x) 3033 #define DBGF(f, x...) \ 3034 pr_debug(DRIVER_NAME " [%s()]: " f, __func__ , ##x) 3035 #ifdef CONFIG_PNP 3036 #endif 3037 #ifdef CONFIG_PNP 3038 #else 3039 #endif 3040 #ifdef CONFIG_MMC_DEBUG 3041 #endif 3042 #ifdef CONFIG_PM 3043 #endif 3044 /* LDV_COMMENT_END_PREP */ 3045 /* LDV_COMMENT_FUNCTION_CALL Function from field "remove" from driver structure with callbacks "wbsd_driver" */ 3046 ldv_handler_precall(); 3047 wbsd_remove( var_group4); 3048 /* LDV_COMMENT_BEGIN_PREP */ 3049 #ifdef CONFIG_PNP 3050 #endif 3051 #ifdef CONFIG_PM 3052 #ifdef CONFIG_PNP 3053 #endif 3054 #else 3055 #define wbsd_platform_suspend NULL 3056 #define wbsd_platform_resume NULL 3057 #define wbsd_pnp_suspend NULL 3058 #define wbsd_pnp_resume NULL 3059 #endif 3060 #ifdef CONFIG_PNP 3061 #endif 3062 #ifdef CONFIG_PNP 3063 #endif 3064 #ifdef CONFIG_PNP 3065 #endif 3066 #ifdef CONFIG_PNP 3067 #endif 3068 #ifdef CONFIG_PNP 3069 #endif 3070 /* LDV_COMMENT_END_PREP */ 3071 ldv_s_wbsd_driver_platform_driver=0; 3072 3073 } 3074 3075 } 3076 3077 break; 3078 case 7: { 3079 3080 /** STRUCT: struct type: pnp_driver, struct name: wbsd_pnp_driver **/ 3081 if(ldv_s_wbsd_pnp_driver_pnp_driver==0) { 3082 3083 /* content: static int wbsd_pnp_probe(struct pnp_dev *pnpdev, const struct pnp_device_id *dev_id)*/ 3084 /* LDV_COMMENT_BEGIN_PREP */ 3085 #define DRIVER_NAME "wbsd" 3086 #define DBG(x...) \ 3087 pr_debug(DRIVER_NAME ": " x) 3088 #define DBGF(f, x...) \ 3089 pr_debug(DRIVER_NAME " [%s()]: " f, __func__ , ##x) 3090 #ifdef CONFIG_PNP 3091 #endif 3092 #ifdef CONFIG_PNP 3093 #else 3094 #endif 3095 #ifdef CONFIG_MMC_DEBUG 3096 #endif 3097 #ifdef CONFIG_PM 3098 #endif 3099 #ifdef CONFIG_PNP 3100 /* LDV_COMMENT_END_PREP */ 3101 /* LDV_COMMENT_FUNCTION_CALL Function from field "probe" from driver structure with callbacks "wbsd_pnp_driver". Standart function test for correct return result. */ 3102 res_wbsd_pnp_probe_50 = wbsd_pnp_probe( var_group5, var_wbsd_pnp_probe_50_p1); 3103 ldv_check_return_value(res_wbsd_pnp_probe_50); 3104 ldv_check_return_value_probe(res_wbsd_pnp_probe_50); 3105 if(res_wbsd_pnp_probe_50) 3106 goto ldv_module_exit; 3107 /* LDV_COMMENT_BEGIN_PREP */ 3108 #endif 3109 #ifdef CONFIG_PM 3110 #ifdef CONFIG_PNP 3111 #endif 3112 #else 3113 #define wbsd_platform_suspend NULL 3114 #define wbsd_platform_resume NULL 3115 #define wbsd_pnp_suspend NULL 3116 #define wbsd_pnp_resume NULL 3117 #endif 3118 #ifdef CONFIG_PNP 3119 #endif 3120 #ifdef CONFIG_PNP 3121 #endif 3122 #ifdef CONFIG_PNP 3123 #endif 3124 #ifdef CONFIG_PNP 3125 #endif 3126 #ifdef CONFIG_PNP 3127 #endif 3128 /* LDV_COMMENT_END_PREP */ 3129 ldv_s_wbsd_pnp_driver_pnp_driver++; 3130 3131 } 3132 3133 } 3134 3135 break; 3136 case 8: { 3137 3138 /** STRUCT: struct type: pnp_driver, struct name: wbsd_pnp_driver **/ 3139 if(ldv_s_wbsd_pnp_driver_pnp_driver==1) { 3140 3141 /* content: static void wbsd_pnp_remove(struct pnp_dev *dev)*/ 3142 /* LDV_COMMENT_BEGIN_PREP */ 3143 #define DRIVER_NAME "wbsd" 3144 #define DBG(x...) \ 3145 pr_debug(DRIVER_NAME ": " x) 3146 #define DBGF(f, x...) \ 3147 pr_debug(DRIVER_NAME " [%s()]: " f, __func__ , ##x) 3148 #ifdef CONFIG_PNP 3149 #endif 3150 #ifdef CONFIG_PNP 3151 #else 3152 #endif 3153 #ifdef CONFIG_MMC_DEBUG 3154 #endif 3155 #ifdef CONFIG_PM 3156 #endif 3157 #ifdef CONFIG_PNP 3158 /* LDV_COMMENT_END_PREP */ 3159 /* LDV_COMMENT_FUNCTION_CALL Function from field "remove" from driver structure with callbacks "wbsd_pnp_driver" */ 3160 ldv_handler_precall(); 3161 wbsd_pnp_remove( var_group5); 3162 /* LDV_COMMENT_BEGIN_PREP */ 3163 #endif 3164 #ifdef CONFIG_PM 3165 #ifdef CONFIG_PNP 3166 #endif 3167 #else 3168 #define wbsd_platform_suspend NULL 3169 #define wbsd_platform_resume NULL 3170 #define wbsd_pnp_suspend NULL 3171 #define wbsd_pnp_resume NULL 3172 #endif 3173 #ifdef CONFIG_PNP 3174 #endif 3175 #ifdef CONFIG_PNP 3176 #endif 3177 #ifdef CONFIG_PNP 3178 #endif 3179 #ifdef CONFIG_PNP 3180 #endif 3181 #ifdef CONFIG_PNP 3182 #endif 3183 /* LDV_COMMENT_END_PREP */ 3184 ldv_s_wbsd_pnp_driver_pnp_driver=0; 3185 3186 } 3187 3188 } 3189 3190 break; 3191 case 9: { 3192 3193 /** STRUCT: struct type: pnp_driver, struct name: wbsd_pnp_driver **/ 3194 3195 3196 /* content: static int wbsd_pnp_suspend(struct pnp_dev *pnp_dev, pm_message_t state)*/ 3197 /* LDV_COMMENT_BEGIN_PREP */ 3198 #define DRIVER_NAME "wbsd" 3199 #define DBG(x...) \ 3200 pr_debug(DRIVER_NAME ": " x) 3201 #define DBGF(f, x...) \ 3202 pr_debug(DRIVER_NAME " [%s()]: " f, __func__ , ##x) 3203 #ifdef CONFIG_PNP 3204 #endif 3205 #ifdef CONFIG_PNP 3206 #else 3207 #endif 3208 #ifdef CONFIG_MMC_DEBUG 3209 #endif 3210 #ifdef CONFIG_PM 3211 #endif 3212 #ifdef CONFIG_PNP 3213 #endif 3214 #ifdef CONFIG_PM 3215 #ifdef CONFIG_PNP 3216 /* LDV_COMMENT_END_PREP */ 3217 /* LDV_COMMENT_FUNCTION_CALL Function from field "suspend" from driver structure with callbacks "wbsd_pnp_driver" */ 3218 ldv_handler_precall(); 3219 wbsd_pnp_suspend( var_group5, var_wbsd_pnp_suspend_54_p1); 3220 /* LDV_COMMENT_BEGIN_PREP */ 3221 #endif 3222 #else 3223 #define wbsd_platform_suspend NULL 3224 #define wbsd_platform_resume NULL 3225 #define wbsd_pnp_suspend NULL 3226 #define wbsd_pnp_resume NULL 3227 #endif 3228 #ifdef CONFIG_PNP 3229 #endif 3230 #ifdef CONFIG_PNP 3231 #endif 3232 #ifdef CONFIG_PNP 3233 #endif 3234 #ifdef CONFIG_PNP 3235 #endif 3236 #ifdef CONFIG_PNP 3237 #endif 3238 /* LDV_COMMENT_END_PREP */ 3239 3240 3241 3242 3243 } 3244 3245 break; 3246 case 10: { 3247 3248 /** STRUCT: struct type: pnp_driver, struct name: wbsd_pnp_driver **/ 3249 3250 3251 /* content: static int wbsd_pnp_resume(struct pnp_dev *pnp_dev)*/ 3252 /* LDV_COMMENT_BEGIN_PREP */ 3253 #define DRIVER_NAME "wbsd" 3254 #define DBG(x...) \ 3255 pr_debug(DRIVER_NAME ": " x) 3256 #define DBGF(f, x...) \ 3257 pr_debug(DRIVER_NAME " [%s()]: " f, __func__ , ##x) 3258 #ifdef CONFIG_PNP 3259 #endif 3260 #ifdef CONFIG_PNP 3261 #else 3262 #endif 3263 #ifdef CONFIG_MMC_DEBUG 3264 #endif 3265 #ifdef CONFIG_PM 3266 #endif 3267 #ifdef CONFIG_PNP 3268 #endif 3269 #ifdef CONFIG_PM 3270 #ifdef CONFIG_PNP 3271 /* LDV_COMMENT_END_PREP */ 3272 /* LDV_COMMENT_FUNCTION_CALL Function from field "resume" from driver structure with callbacks "wbsd_pnp_driver" */ 3273 ldv_handler_precall(); 3274 wbsd_pnp_resume( var_group5); 3275 /* LDV_COMMENT_BEGIN_PREP */ 3276 #endif 3277 #else 3278 #define wbsd_platform_suspend NULL 3279 #define wbsd_platform_resume NULL 3280 #define wbsd_pnp_suspend NULL 3281 #define wbsd_pnp_resume NULL 3282 #endif 3283 #ifdef CONFIG_PNP 3284 #endif 3285 #ifdef CONFIG_PNP 3286 #endif 3287 #ifdef CONFIG_PNP 3288 #endif 3289 #ifdef CONFIG_PNP 3290 #endif 3291 #ifdef CONFIG_PNP 3292 #endif 3293 /* LDV_COMMENT_END_PREP */ 3294 3295 3296 3297 3298 } 3299 3300 break; 3301 case 11: { 3302 3303 /** CALLBACK SECTION request_irq **/ 3304 LDV_IN_INTERRUPT=2; 3305 3306 /* content: static irqreturn_t wbsd_irq(int irq, void *dev_id)*/ 3307 /* LDV_COMMENT_BEGIN_PREP */ 3308 #define DRIVER_NAME "wbsd" 3309 #define DBG(x...) \ 3310 pr_debug(DRIVER_NAME ": " x) 3311 #define DBGF(f, x...) \ 3312 pr_debug(DRIVER_NAME " [%s()]: " f, __func__ , ##x) 3313 #ifdef CONFIG_PNP 3314 #endif 3315 #ifdef CONFIG_PNP 3316 #else 3317 #endif 3318 #ifdef CONFIG_MMC_DEBUG 3319 #endif 3320 /* LDV_COMMENT_END_PREP */ 3321 /* LDV_COMMENT_FUNCTION_CALL */ 3322 ldv_handler_precall(); 3323 wbsd_irq( var_wbsd_irq_31_p0, var_wbsd_irq_31_p1); 3324 /* LDV_COMMENT_BEGIN_PREP */ 3325 #ifdef CONFIG_PM 3326 #endif 3327 #ifdef CONFIG_PNP 3328 #endif 3329 #ifdef CONFIG_PM 3330 #ifdef CONFIG_PNP 3331 #endif 3332 #else 3333 #define wbsd_platform_suspend NULL 3334 #define wbsd_platform_resume NULL 3335 #define wbsd_pnp_suspend NULL 3336 #define wbsd_pnp_resume NULL 3337 #endif 3338 #ifdef CONFIG_PNP 3339 #endif 3340 #ifdef CONFIG_PNP 3341 #endif 3342 #ifdef CONFIG_PNP 3343 #endif 3344 #ifdef CONFIG_PNP 3345 #endif 3346 #ifdef CONFIG_PNP 3347 #endif 3348 /* LDV_COMMENT_END_PREP */ 3349 LDV_IN_INTERRUPT=1; 3350 3351 3352 3353 } 3354 3355 break; 3356 case 12: { 3357 3358 /** TIMER SECTION timer **/ 3359 3360 3361 /* content: static void wbsd_reset_ignore(unsigned long data)*/ 3362 /* LDV_COMMENT_BEGIN_PREP */ 3363 #define DRIVER_NAME "wbsd" 3364 #define DBG(x...) \ 3365 pr_debug(DRIVER_NAME ": " x) 3366 #define DBGF(f, x...) \ 3367 pr_debug(DRIVER_NAME " [%s()]: " f, __func__ , ##x) 3368 #ifdef CONFIG_PNP 3369 #endif 3370 #ifdef CONFIG_PNP 3371 #else 3372 #endif 3373 #ifdef CONFIG_MMC_DEBUG 3374 #endif 3375 /* LDV_COMMENT_END_PREP */ 3376 /* LDV_COMMENT_FUNCTION_CALL */ 3377 ldv_handler_precall(); 3378 wbsd_reset_ignore( var_wbsd_reset_ignore_24_p0); 3379 /* LDV_COMMENT_BEGIN_PREP */ 3380 #ifdef CONFIG_PM 3381 #endif 3382 #ifdef CONFIG_PNP 3383 #endif 3384 #ifdef CONFIG_PM 3385 #ifdef CONFIG_PNP 3386 #endif 3387 #else 3388 #define wbsd_platform_suspend NULL 3389 #define wbsd_platform_resume NULL 3390 #define wbsd_pnp_suspend NULL 3391 #define wbsd_pnp_resume NULL 3392 #endif 3393 #ifdef CONFIG_PNP 3394 #endif 3395 #ifdef CONFIG_PNP 3396 #endif 3397 #ifdef CONFIG_PNP 3398 #endif 3399 #ifdef CONFIG_PNP 3400 #endif 3401 #ifdef CONFIG_PNP 3402 #endif 3403 /* LDV_COMMENT_END_PREP */ 3404 3405 3406 3407 3408 } 3409 3410 break; 3411 default: break; 3412 3413 } 3414 3415 } 3416 3417 ldv_module_exit: 3418 3419 /** INIT: init_type: ST_MODULE_EXIT **/ 3420 /* content: static void __exit wbsd_drv_exit(void)*/ 3421 /* LDV_COMMENT_BEGIN_PREP */ 3422 #define DRIVER_NAME "wbsd" 3423 #define DBG(x...) \ 3424 pr_debug(DRIVER_NAME ": " x) 3425 #define DBGF(f, x...) \ 3426 pr_debug(DRIVER_NAME " [%s()]: " f, __func__ , ##x) 3427 #ifdef CONFIG_PNP 3428 #endif 3429 #ifdef CONFIG_PNP 3430 #else 3431 #endif 3432 #ifdef CONFIG_MMC_DEBUG 3433 #endif 3434 #ifdef CONFIG_PM 3435 #endif 3436 #ifdef CONFIG_PNP 3437 #endif 3438 #ifdef CONFIG_PM 3439 #ifdef CONFIG_PNP 3440 #endif 3441 #else 3442 #define wbsd_platform_suspend NULL 3443 #define wbsd_platform_resume NULL 3444 #define wbsd_pnp_suspend NULL 3445 #define wbsd_pnp_resume NULL 3446 #endif 3447 #ifdef CONFIG_PNP 3448 #endif 3449 #ifdef CONFIG_PNP 3450 #endif 3451 /* LDV_COMMENT_END_PREP */ 3452 /* LDV_COMMENT_FUNCTION_CALL Kernel calls driver release function before driver will be uploaded from kernel. This function declared as "MODULE_EXIT(function name)". */ 3453 ldv_handler_precall(); 3454 wbsd_drv_exit(); 3455 /* LDV_COMMENT_BEGIN_PREP */ 3456 #ifdef CONFIG_PNP 3457 #endif 3458 #ifdef CONFIG_PNP 3459 #endif 3460 /* LDV_COMMENT_END_PREP */ 3461 3462 /* LDV_COMMENT_FUNCTION_CALL Checks that all resources and locks are correctly released before the driver will be unloaded. */ 3463 ldv_final: ldv_check_final_state(); 3464 3465 /* LDV_COMMENT_END_FUNCTION_CALL_SECTION */ 3466 return; 3467 3468 } 3469 #endif 3470 3471 /* 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 extern void ldv_dma_map_page(void); 9 extern void ldv_dma_mapping_error(void); 10 #line 1 "/home/vitaly/ldv-launches/work/current--X--drivers--X--defaultlinux-4.9-rc1.tar.xz--X--331_1a--X--cpachecker/linux-4.9-rc1.tar.xz/csd_deg_dscv/2264/dscv_tempdir/dscv/ri/331_1a/drivers/mmc/host/wbsd.c" 11 12 /* 13 * linux/drivers/mmc/host/wbsd.c - Winbond W83L51xD SD/MMC driver 14 * 15 * Copyright (C) 2004-2007 Pierre Ossman, All Rights Reserved. 16 * 17 * This program is free software; you can redistribute it and/or modify 18 * it under the terms of the GNU General Public License as published by 19 * the Free Software Foundation; either version 2 of the License, or (at 20 * your option) any later version. 21 * 22 * 23 * Warning! 24 * 25 * Changes to the FIFO system should be done with extreme care since 26 * the hardware is full of bugs related to the FIFO. Known issues are: 27 * 28 * - FIFO size field in FSR is always zero. 29 * 30 * - FIFO interrupts tend not to work as they should. Interrupts are 31 * triggered only for full/empty events, not for threshold values. 32 * 33 * - On APIC systems the FIFO empty interrupt is sometimes lost. 34 */ 35 36 #include <linux/module.h> 37 #include <linux/moduleparam.h> 38 #include <linux/init.h> 39 #include <linux/ioport.h> 40 #include <linux/platform_device.h> 41 #include <linux/interrupt.h> 42 #include <linux/dma-mapping.h> 43 #include <linux/delay.h> 44 #include <linux/pnp.h> 45 #include <linux/highmem.h> 46 #include <linux/mmc/host.h> 47 #include <linux/scatterlist.h> 48 #include <linux/slab.h> 49 50 #include <asm/io.h> 51 #include <asm/dma.h> 52 53 #include "wbsd.h" 54 55 #define DRIVER_NAME "wbsd" 56 57 #define DBG(x...) \ 58 pr_debug(DRIVER_NAME ": " x) 59 #define DBGF(f, x...) \ 60 pr_debug(DRIVER_NAME " [%s()]: " f, __func__ , ##x) 61 62 /* 63 * Device resources 64 */ 65 66 #ifdef CONFIG_PNP 67 68 static const struct pnp_device_id pnp_dev_table[] = { 69 { "WEC0517", 0 }, 70 { "WEC0518", 0 }, 71 { "", 0 }, 72 }; 73 74 MODULE_DEVICE_TABLE(pnp, pnp_dev_table); 75 76 #endif /* CONFIG_PNP */ 77 78 static const int config_ports[] = { 0x2E, 0x4E }; 79 static const int unlock_codes[] = { 0x83, 0x87 }; 80 81 static const int valid_ids[] = { 82 0x7112, 83 }; 84 85 #ifdef CONFIG_PNP 86 static unsigned int param_nopnp = 0; 87 #else 88 static const unsigned int param_nopnp = 1; 89 #endif 90 static unsigned int param_io = 0x248; 91 static unsigned int param_irq = 6; 92 static int param_dma = 2; 93 94 /* 95 * Basic functions 96 */ 97 98 static inline void wbsd_unlock_config(struct wbsd_host *host) 99 { 100 BUG_ON(host->config == 0); 101 102 outb(host->unlock_code, host->config); 103 outb(host->unlock_code, host->config); 104 } 105 106 static inline void wbsd_lock_config(struct wbsd_host *host) 107 { 108 BUG_ON(host->config == 0); 109 110 outb(LOCK_CODE, host->config); 111 } 112 113 static inline void wbsd_write_config(struct wbsd_host *host, u8 reg, u8 value) 114 { 115 BUG_ON(host->config == 0); 116 117 outb(reg, host->config); 118 outb(value, host->config + 1); 119 } 120 121 static inline u8 wbsd_read_config(struct wbsd_host *host, u8 reg) 122 { 123 BUG_ON(host->config == 0); 124 125 outb(reg, host->config); 126 return inb(host->config + 1); 127 } 128 129 static inline void wbsd_write_index(struct wbsd_host *host, u8 index, u8 value) 130 { 131 outb(index, host->base + WBSD_IDXR); 132 outb(value, host->base + WBSD_DATAR); 133 } 134 135 static inline u8 wbsd_read_index(struct wbsd_host *host, u8 index) 136 { 137 outb(index, host->base + WBSD_IDXR); 138 return inb(host->base + WBSD_DATAR); 139 } 140 141 /* 142 * Common routines 143 */ 144 145 static void wbsd_init_device(struct wbsd_host *host) 146 { 147 u8 setup, ier; 148 149 /* 150 * Reset chip (SD/MMC part) and fifo. 151 */ 152 setup = wbsd_read_index(host, WBSD_IDX_SETUP); 153 setup |= WBSD_FIFO_RESET | WBSD_SOFT_RESET; 154 wbsd_write_index(host, WBSD_IDX_SETUP, setup); 155 156 /* 157 * Set DAT3 to input 158 */ 159 setup &= ~WBSD_DAT3_H; 160 wbsd_write_index(host, WBSD_IDX_SETUP, setup); 161 host->flags &= ~WBSD_FIGNORE_DETECT; 162 163 /* 164 * Read back default clock. 165 */ 166 host->clk = wbsd_read_index(host, WBSD_IDX_CLK); 167 168 /* 169 * Power down port. 170 */ 171 outb(WBSD_POWER_N, host->base + WBSD_CSR); 172 173 /* 174 * Set maximum timeout. 175 */ 176 wbsd_write_index(host, WBSD_IDX_TAAC, 0x7F); 177 178 /* 179 * Test for card presence 180 */ 181 if (inb(host->base + WBSD_CSR) & WBSD_CARDPRESENT) 182 host->flags |= WBSD_FCARD_PRESENT; 183 else 184 host->flags &= ~WBSD_FCARD_PRESENT; 185 186 /* 187 * Enable interesting interrupts. 188 */ 189 ier = 0; 190 ier |= WBSD_EINT_CARD; 191 ier |= WBSD_EINT_FIFO_THRE; 192 ier |= WBSD_EINT_CRC; 193 ier |= WBSD_EINT_TIMEOUT; 194 ier |= WBSD_EINT_TC; 195 196 outb(ier, host->base + WBSD_EIR); 197 198 /* 199 * Clear interrupts. 200 */ 201 inb(host->base + WBSD_ISR); 202 } 203 204 static void wbsd_reset(struct wbsd_host *host) 205 { 206 u8 setup; 207 208 pr_err("%s: Resetting chip\n", mmc_hostname(host->mmc)); 209 210 /* 211 * Soft reset of chip (SD/MMC part). 212 */ 213 setup = wbsd_read_index(host, WBSD_IDX_SETUP); 214 setup |= WBSD_SOFT_RESET; 215 wbsd_write_index(host, WBSD_IDX_SETUP, setup); 216 } 217 218 static void wbsd_request_end(struct wbsd_host *host, struct mmc_request *mrq) 219 { 220 unsigned long dmaflags; 221 222 if (host->dma >= 0) { 223 /* 224 * Release ISA DMA controller. 225 */ 226 dmaflags = claim_dma_lock(); 227 disable_dma(host->dma); 228 clear_dma_ff(host->dma); 229 release_dma_lock(dmaflags); 230 231 /* 232 * Disable DMA on host. 233 */ 234 wbsd_write_index(host, WBSD_IDX_DMA, 0); 235 } 236 237 host->mrq = NULL; 238 239 /* 240 * MMC layer might call back into the driver so first unlock. 241 */ 242 spin_unlock(&host->lock); 243 mmc_request_done(host->mmc, mrq); 244 spin_lock(&host->lock); 245 } 246 247 /* 248 * Scatter/gather functions 249 */ 250 251 static inline void wbsd_init_sg(struct wbsd_host *host, struct mmc_data *data) 252 { 253 /* 254 * Get info. about SG list from data structure. 255 */ 256 host->cur_sg = data->sg; 257 host->num_sg = data->sg_len; 258 259 host->offset = 0; 260 host->remain = host->cur_sg->length; 261 } 262 263 static inline int wbsd_next_sg(struct wbsd_host *host) 264 { 265 /* 266 * Skip to next SG entry. 267 */ 268 host->cur_sg++; 269 host->num_sg--; 270 271 /* 272 * Any entries left? 273 */ 274 if (host->num_sg > 0) { 275 host->offset = 0; 276 host->remain = host->cur_sg->length; 277 } 278 279 return host->num_sg; 280 } 281 282 static inline char *wbsd_sg_to_buffer(struct wbsd_host *host) 283 { 284 return sg_virt(host->cur_sg); 285 } 286 287 static inline void wbsd_sg_to_dma(struct wbsd_host *host, struct mmc_data *data) 288 { 289 unsigned int len, i; 290 struct scatterlist *sg; 291 char *dmabuf = host->dma_buffer; 292 char *sgbuf; 293 294 sg = data->sg; 295 len = data->sg_len; 296 297 for (i = 0; i < len; i++) { 298 sgbuf = sg_virt(&sg[i]); 299 memcpy(dmabuf, sgbuf, sg[i].length); 300 dmabuf += sg[i].length; 301 } 302 } 303 304 static inline void wbsd_dma_to_sg(struct wbsd_host *host, struct mmc_data *data) 305 { 306 unsigned int len, i; 307 struct scatterlist *sg; 308 char *dmabuf = host->dma_buffer; 309 char *sgbuf; 310 311 sg = data->sg; 312 len = data->sg_len; 313 314 for (i = 0; i < len; i++) { 315 sgbuf = sg_virt(&sg[i]); 316 memcpy(sgbuf, dmabuf, sg[i].length); 317 dmabuf += sg[i].length; 318 } 319 } 320 321 /* 322 * Command handling 323 */ 324 325 static inline void wbsd_get_short_reply(struct wbsd_host *host, 326 struct mmc_command *cmd) 327 { 328 /* 329 * Correct response type? 330 */ 331 if (wbsd_read_index(host, WBSD_IDX_RSPLEN) != WBSD_RSP_SHORT) { 332 cmd->error = -EILSEQ; 333 return; 334 } 335 336 cmd->resp[0] = wbsd_read_index(host, WBSD_IDX_RESP12) << 24; 337 cmd->resp[0] |= wbsd_read_index(host, WBSD_IDX_RESP13) << 16; 338 cmd->resp[0] |= wbsd_read_index(host, WBSD_IDX_RESP14) << 8; 339 cmd->resp[0] |= wbsd_read_index(host, WBSD_IDX_RESP15) << 0; 340 cmd->resp[1] = wbsd_read_index(host, WBSD_IDX_RESP16) << 24; 341 } 342 343 static inline void wbsd_get_long_reply(struct wbsd_host *host, 344 struct mmc_command *cmd) 345 { 346 int i; 347 348 /* 349 * Correct response type? 350 */ 351 if (wbsd_read_index(host, WBSD_IDX_RSPLEN) != WBSD_RSP_LONG) { 352 cmd->error = -EILSEQ; 353 return; 354 } 355 356 for (i = 0; i < 4; i++) { 357 cmd->resp[i] = 358 wbsd_read_index(host, WBSD_IDX_RESP1 + i * 4) << 24; 359 cmd->resp[i] |= 360 wbsd_read_index(host, WBSD_IDX_RESP2 + i * 4) << 16; 361 cmd->resp[i] |= 362 wbsd_read_index(host, WBSD_IDX_RESP3 + i * 4) << 8; 363 cmd->resp[i] |= 364 wbsd_read_index(host, WBSD_IDX_RESP4 + i * 4) << 0; 365 } 366 } 367 368 static void wbsd_send_command(struct wbsd_host *host, struct mmc_command *cmd) 369 { 370 int i; 371 u8 status, isr; 372 373 /* 374 * Clear accumulated ISR. The interrupt routine 375 * will fill this one with events that occur during 376 * transfer. 377 */ 378 host->isr = 0; 379 380 /* 381 * Send the command (CRC calculated by host). 382 */ 383 outb(cmd->opcode, host->base + WBSD_CMDR); 384 for (i = 3; i >= 0; i--) 385 outb((cmd->arg >> (i * 8)) & 0xff, host->base + WBSD_CMDR); 386 387 cmd->error = 0; 388 389 /* 390 * Wait for the request to complete. 391 */ 392 do { 393 status = wbsd_read_index(host, WBSD_IDX_STATUS); 394 } while (status & WBSD_CARDTRAFFIC); 395 396 /* 397 * Do we expect a reply? 398 */ 399 if (cmd->flags & MMC_RSP_PRESENT) { 400 /* 401 * Read back status. 402 */ 403 isr = host->isr; 404 405 /* Card removed? */ 406 if (isr & WBSD_INT_CARD) 407 cmd->error = -ENOMEDIUM; 408 /* Timeout? */ 409 else if (isr & WBSD_INT_TIMEOUT) 410 cmd->error = -ETIMEDOUT; 411 /* CRC? */ 412 else if ((cmd->flags & MMC_RSP_CRC) && (isr & WBSD_INT_CRC)) 413 cmd->error = -EILSEQ; 414 /* All ok */ 415 else { 416 if (cmd->flags & MMC_RSP_136) 417 wbsd_get_long_reply(host, cmd); 418 else 419 wbsd_get_short_reply(host, cmd); 420 } 421 } 422 } 423 424 /* 425 * Data functions 426 */ 427 428 static void wbsd_empty_fifo(struct wbsd_host *host) 429 { 430 struct mmc_data *data = host->mrq->cmd->data; 431 char *buffer; 432 int i, fsr, fifo; 433 434 /* 435 * Handle excessive data. 436 */ 437 if (host->num_sg == 0) 438 return; 439 440 buffer = wbsd_sg_to_buffer(host) + host->offset; 441 442 /* 443 * Drain the fifo. This has a tendency to loop longer 444 * than the FIFO length (usually one block). 445 */ 446 while (!((fsr = inb(host->base + WBSD_FSR)) & WBSD_FIFO_EMPTY)) { 447 /* 448 * The size field in the FSR is broken so we have to 449 * do some guessing. 450 */ 451 if (fsr & WBSD_FIFO_FULL) 452 fifo = 16; 453 else if (fsr & WBSD_FIFO_FUTHRE) 454 fifo = 8; 455 else 456 fifo = 1; 457 458 for (i = 0; i < fifo; i++) { 459 *buffer = inb(host->base + WBSD_DFR); 460 buffer++; 461 host->offset++; 462 host->remain--; 463 464 data->bytes_xfered++; 465 466 /* 467 * End of scatter list entry? 468 */ 469 if (host->remain == 0) { 470 /* 471 * Get next entry. Check if last. 472 */ 473 if (!wbsd_next_sg(host)) 474 return; 475 476 buffer = wbsd_sg_to_buffer(host); 477 } 478 } 479 } 480 481 /* 482 * This is a very dirty hack to solve a 483 * hardware problem. The chip doesn't trigger 484 * FIFO threshold interrupts properly. 485 */ 486 if ((data->blocks * data->blksz - data->bytes_xfered) < 16) 487 tasklet_schedule(&host->fifo_tasklet); 488 } 489 490 static void wbsd_fill_fifo(struct wbsd_host *host) 491 { 492 struct mmc_data *data = host->mrq->cmd->data; 493 char *buffer; 494 int i, fsr, fifo; 495 496 /* 497 * Check that we aren't being called after the 498 * entire buffer has been transferred. 499 */ 500 if (host->num_sg == 0) 501 return; 502 503 buffer = wbsd_sg_to_buffer(host) + host->offset; 504 505 /* 506 * Fill the fifo. This has a tendency to loop longer 507 * than the FIFO length (usually one block). 508 */ 509 while (!((fsr = inb(host->base + WBSD_FSR)) & WBSD_FIFO_FULL)) { 510 /* 511 * The size field in the FSR is broken so we have to 512 * do some guessing. 513 */ 514 if (fsr & WBSD_FIFO_EMPTY) 515 fifo = 0; 516 else if (fsr & WBSD_FIFO_EMTHRE) 517 fifo = 8; 518 else 519 fifo = 15; 520 521 for (i = 16; i > fifo; i--) { 522 outb(*buffer, host->base + WBSD_DFR); 523 buffer++; 524 host->offset++; 525 host->remain--; 526 527 data->bytes_xfered++; 528 529 /* 530 * End of scatter list entry? 531 */ 532 if (host->remain == 0) { 533 /* 534 * Get next entry. Check if last. 535 */ 536 if (!wbsd_next_sg(host)) 537 return; 538 539 buffer = wbsd_sg_to_buffer(host); 540 } 541 } 542 } 543 544 /* 545 * The controller stops sending interrupts for 546 * 'FIFO empty' under certain conditions. So we 547 * need to be a bit more pro-active. 548 */ 549 tasklet_schedule(&host->fifo_tasklet); 550 } 551 552 static void wbsd_prepare_data(struct wbsd_host *host, struct mmc_data *data) 553 { 554 u16 blksize; 555 u8 setup; 556 unsigned long dmaflags; 557 unsigned int size; 558 559 /* 560 * Calculate size. 561 */ 562 size = data->blocks * data->blksz; 563 564 /* 565 * Check timeout values for overflow. 566 * (Yes, some cards cause this value to overflow). 567 */ 568 if (data->timeout_ns > 127000000) 569 wbsd_write_index(host, WBSD_IDX_TAAC, 127); 570 else { 571 wbsd_write_index(host, WBSD_IDX_TAAC, 572 data->timeout_ns / 1000000); 573 } 574 575 if (data->timeout_clks > 255) 576 wbsd_write_index(host, WBSD_IDX_NSAC, 255); 577 else 578 wbsd_write_index(host, WBSD_IDX_NSAC, data->timeout_clks); 579 580 /* 581 * Inform the chip of how large blocks will be 582 * sent. It needs this to determine when to 583 * calculate CRC. 584 * 585 * Space for CRC must be included in the size. 586 * Two bytes are needed for each data line. 587 */ 588 if (host->bus_width == MMC_BUS_WIDTH_1) { 589 blksize = data->blksz + 2; 590 591 wbsd_write_index(host, WBSD_IDX_PBSMSB, (blksize >> 4) & 0xF0); 592 wbsd_write_index(host, WBSD_IDX_PBSLSB, blksize & 0xFF); 593 } else if (host->bus_width == MMC_BUS_WIDTH_4) { 594 blksize = data->blksz + 2 * 4; 595 596 wbsd_write_index(host, WBSD_IDX_PBSMSB, 597 ((blksize >> 4) & 0xF0) | WBSD_DATA_WIDTH); 598 wbsd_write_index(host, WBSD_IDX_PBSLSB, blksize & 0xFF); 599 } else { 600 data->error = -EINVAL; 601 return; 602 } 603 604 /* 605 * Clear the FIFO. This is needed even for DMA 606 * transfers since the chip still uses the FIFO 607 * internally. 608 */ 609 setup = wbsd_read_index(host, WBSD_IDX_SETUP); 610 setup |= WBSD_FIFO_RESET; 611 wbsd_write_index(host, WBSD_IDX_SETUP, setup); 612 613 /* 614 * DMA transfer? 615 */ 616 if (host->dma >= 0) { 617 /* 618 * The buffer for DMA is only 64 kB. 619 */ 620 BUG_ON(size > 0x10000); 621 if (size > 0x10000) { 622 data->error = -EINVAL; 623 return; 624 } 625 626 /* 627 * Transfer data from the SG list to 628 * the DMA buffer. 629 */ 630 if (data->flags & MMC_DATA_WRITE) 631 wbsd_sg_to_dma(host, data); 632 633 /* 634 * Initialise the ISA DMA controller. 635 */ 636 dmaflags = claim_dma_lock(); 637 disable_dma(host->dma); 638 clear_dma_ff(host->dma); 639 if (data->flags & MMC_DATA_READ) 640 set_dma_mode(host->dma, DMA_MODE_READ & ~0x40); 641 else 642 set_dma_mode(host->dma, DMA_MODE_WRITE & ~0x40); 643 set_dma_addr(host->dma, host->dma_addr); 644 set_dma_count(host->dma, size); 645 646 enable_dma(host->dma); 647 release_dma_lock(dmaflags); 648 649 /* 650 * Enable DMA on the host. 651 */ 652 wbsd_write_index(host, WBSD_IDX_DMA, WBSD_DMA_ENABLE); 653 } else { 654 /* 655 * This flag is used to keep printk 656 * output to a minimum. 657 */ 658 host->firsterr = 1; 659 660 /* 661 * Initialise the SG list. 662 */ 663 wbsd_init_sg(host, data); 664 665 /* 666 * Turn off DMA. 667 */ 668 wbsd_write_index(host, WBSD_IDX_DMA, 0); 669 670 /* 671 * Set up FIFO threshold levels (and fill 672 * buffer if doing a write). 673 */ 674 if (data->flags & MMC_DATA_READ) { 675 wbsd_write_index(host, WBSD_IDX_FIFOEN, 676 WBSD_FIFOEN_FULL | 8); 677 } else { 678 wbsd_write_index(host, WBSD_IDX_FIFOEN, 679 WBSD_FIFOEN_EMPTY | 8); 680 wbsd_fill_fifo(host); 681 } 682 } 683 684 data->error = 0; 685 } 686 687 static void wbsd_finish_data(struct wbsd_host *host, struct mmc_data *data) 688 { 689 unsigned long dmaflags; 690 int count; 691 u8 status; 692 693 WARN_ON(host->mrq == NULL); 694 695 /* 696 * Send a stop command if needed. 697 */ 698 if (data->stop) 699 wbsd_send_command(host, data->stop); 700 701 /* 702 * Wait for the controller to leave data 703 * transfer state. 704 */ 705 do { 706 status = wbsd_read_index(host, WBSD_IDX_STATUS); 707 } while (status & (WBSD_BLOCK_READ | WBSD_BLOCK_WRITE)); 708 709 /* 710 * DMA transfer? 711 */ 712 if (host->dma >= 0) { 713 /* 714 * Disable DMA on the host. 715 */ 716 wbsd_write_index(host, WBSD_IDX_DMA, 0); 717 718 /* 719 * Turn of ISA DMA controller. 720 */ 721 dmaflags = claim_dma_lock(); 722 disable_dma(host->dma); 723 clear_dma_ff(host->dma); 724 count = get_dma_residue(host->dma); 725 release_dma_lock(dmaflags); 726 727 data->bytes_xfered = host->mrq->data->blocks * 728 host->mrq->data->blksz - count; 729 data->bytes_xfered -= data->bytes_xfered % data->blksz; 730 731 /* 732 * Any leftover data? 733 */ 734 if (count) { 735 pr_err("%s: Incomplete DMA transfer. " 736 "%d bytes left.\n", 737 mmc_hostname(host->mmc), count); 738 739 if (!data->error) 740 data->error = -EIO; 741 } else { 742 /* 743 * Transfer data from DMA buffer to 744 * SG list. 745 */ 746 if (data->flags & MMC_DATA_READ) 747 wbsd_dma_to_sg(host, data); 748 } 749 750 if (data->error) { 751 if (data->bytes_xfered) 752 data->bytes_xfered -= data->blksz; 753 } 754 } 755 756 wbsd_request_end(host, host->mrq); 757 } 758 759 /*****************************************************************************\ 760 * * 761 * MMC layer callbacks * 762 * * 763 \*****************************************************************************/ 764 765 static void wbsd_request(struct mmc_host *mmc, struct mmc_request *mrq) 766 { 767 struct wbsd_host *host = mmc_priv(mmc); 768 struct mmc_command *cmd; 769 770 /* 771 * Disable tasklets to avoid a deadlock. 772 */ 773 spin_lock_bh(&host->lock); 774 775 BUG_ON(host->mrq != NULL); 776 777 cmd = mrq->cmd; 778 779 host->mrq = mrq; 780 781 /* 782 * Check that there is actually a card in the slot. 783 */ 784 if (!(host->flags & WBSD_FCARD_PRESENT)) { 785 cmd->error = -ENOMEDIUM; 786 goto done; 787 } 788 789 if (cmd->data) { 790 /* 791 * The hardware is so delightfully stupid that it has a list 792 * of "data" commands. If a command isn't on this list, it'll 793 * just go back to the idle state and won't send any data 794 * interrupts. 795 */ 796 switch (cmd->opcode) { 797 case 11: 798 case 17: 799 case 18: 800 case 20: 801 case 24: 802 case 25: 803 case 26: 804 case 27: 805 case 30: 806 case 42: 807 case 56: 808 break; 809 810 /* ACMDs. We don't keep track of state, so we just treat them 811 * like any other command. */ 812 case 51: 813 break; 814 815 default: 816 #ifdef CONFIG_MMC_DEBUG 817 pr_warn("%s: Data command %d is not supported by this controller\n", 818 mmc_hostname(host->mmc), cmd->opcode); 819 #endif 820 cmd->error = -EINVAL; 821 822 goto done; 823 } 824 } 825 826 /* 827 * Does the request include data? 828 */ 829 if (cmd->data) { 830 wbsd_prepare_data(host, cmd->data); 831 832 if (cmd->data->error) 833 goto done; 834 } 835 836 wbsd_send_command(host, cmd); 837 838 /* 839 * If this is a data transfer the request 840 * will be finished after the data has 841 * transferred. 842 */ 843 if (cmd->data && !cmd->error) { 844 /* 845 * Dirty fix for hardware bug. 846 */ 847 if (host->dma == -1) 848 tasklet_schedule(&host->fifo_tasklet); 849 850 spin_unlock_bh(&host->lock); 851 852 return; 853 } 854 855 done: 856 wbsd_request_end(host, mrq); 857 858 spin_unlock_bh(&host->lock); 859 } 860 861 static void wbsd_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) 862 { 863 struct wbsd_host *host = mmc_priv(mmc); 864 u8 clk, setup, pwr; 865 866 spin_lock_bh(&host->lock); 867 868 /* 869 * Reset the chip on each power off. 870 * Should clear out any weird states. 871 */ 872 if (ios->power_mode == MMC_POWER_OFF) 873 wbsd_init_device(host); 874 875 if (ios->clock >= 24000000) 876 clk = WBSD_CLK_24M; 877 else if (ios->clock >= 16000000) 878 clk = WBSD_CLK_16M; 879 else if (ios->clock >= 12000000) 880 clk = WBSD_CLK_12M; 881 else 882 clk = WBSD_CLK_375K; 883 884 /* 885 * Only write to the clock register when 886 * there is an actual change. 887 */ 888 if (clk != host->clk) { 889 wbsd_write_index(host, WBSD_IDX_CLK, clk); 890 host->clk = clk; 891 } 892 893 /* 894 * Power up card. 895 */ 896 if (ios->power_mode != MMC_POWER_OFF) { 897 pwr = inb(host->base + WBSD_CSR); 898 pwr &= ~WBSD_POWER_N; 899 outb(pwr, host->base + WBSD_CSR); 900 } 901 902 /* 903 * MMC cards need to have pin 1 high during init. 904 * It wreaks havoc with the card detection though so 905 * that needs to be disabled. 906 */ 907 setup = wbsd_read_index(host, WBSD_IDX_SETUP); 908 if (ios->chip_select == MMC_CS_HIGH) { 909 BUG_ON(ios->bus_width != MMC_BUS_WIDTH_1); 910 setup |= WBSD_DAT3_H; 911 host->flags |= WBSD_FIGNORE_DETECT; 912 } else { 913 if (setup & WBSD_DAT3_H) { 914 setup &= ~WBSD_DAT3_H; 915 916 /* 917 * We cannot resume card detection immediately 918 * because of capacitance and delays in the chip. 919 */ 920 mod_timer(&host->ignore_timer, jiffies + HZ / 100); 921 } 922 } 923 wbsd_write_index(host, WBSD_IDX_SETUP, setup); 924 925 /* 926 * Store bus width for later. Will be used when 927 * setting up the data transfer. 928 */ 929 host->bus_width = ios->bus_width; 930 931 spin_unlock_bh(&host->lock); 932 } 933 934 static int wbsd_get_ro(struct mmc_host *mmc) 935 { 936 struct wbsd_host *host = mmc_priv(mmc); 937 u8 csr; 938 939 spin_lock_bh(&host->lock); 940 941 csr = inb(host->base + WBSD_CSR); 942 csr |= WBSD_MSLED; 943 outb(csr, host->base + WBSD_CSR); 944 945 mdelay(1); 946 947 csr = inb(host->base + WBSD_CSR); 948 csr &= ~WBSD_MSLED; 949 outb(csr, host->base + WBSD_CSR); 950 951 spin_unlock_bh(&host->lock); 952 953 return !!(csr & WBSD_WRPT); 954 } 955 956 static const struct mmc_host_ops wbsd_ops = { 957 .request = wbsd_request, 958 .set_ios = wbsd_set_ios, 959 .get_ro = wbsd_get_ro, 960 }; 961 962 /*****************************************************************************\ 963 * * 964 * Interrupt handling * 965 * * 966 \*****************************************************************************/ 967 968 /* 969 * Helper function to reset detection ignore 970 */ 971 972 static void wbsd_reset_ignore(unsigned long data) 973 { 974 struct wbsd_host *host = (struct wbsd_host *)data; 975 976 BUG_ON(host == NULL); 977 978 DBG("Resetting card detection ignore\n"); 979 980 spin_lock_bh(&host->lock); 981 982 host->flags &= ~WBSD_FIGNORE_DETECT; 983 984 /* 985 * Card status might have changed during the 986 * blackout. 987 */ 988 tasklet_schedule(&host->card_tasklet); 989 990 spin_unlock_bh(&host->lock); 991 } 992 993 /* 994 * Tasklets 995 */ 996 997 static inline struct mmc_data *wbsd_get_data(struct wbsd_host *host) 998 { 999 WARN_ON(!host->mrq); 1000 if (!host->mrq) 1001 return NULL; 1002 1003 WARN_ON(!host->mrq->cmd); 1004 if (!host->mrq->cmd) 1005 return NULL; 1006 1007 WARN_ON(!host->mrq->cmd->data); 1008 if (!host->mrq->cmd->data) 1009 return NULL; 1010 1011 return host->mrq->cmd->data; 1012 } 1013 1014 static void wbsd_tasklet_card(unsigned long param) 1015 { 1016 struct wbsd_host *host = (struct wbsd_host *)param; 1017 u8 csr; 1018 int delay = -1; 1019 1020 spin_lock(&host->lock); 1021 1022 if (host->flags & WBSD_FIGNORE_DETECT) { 1023 spin_unlock(&host->lock); 1024 return; 1025 } 1026 1027 csr = inb(host->base + WBSD_CSR); 1028 WARN_ON(csr == 0xff); 1029 1030 if (csr & WBSD_CARDPRESENT) { 1031 if (!(host->flags & WBSD_FCARD_PRESENT)) { 1032 DBG("Card inserted\n"); 1033 host->flags |= WBSD_FCARD_PRESENT; 1034 1035 delay = 500; 1036 } 1037 } else if (host->flags & WBSD_FCARD_PRESENT) { 1038 DBG("Card removed\n"); 1039 host->flags &= ~WBSD_FCARD_PRESENT; 1040 1041 if (host->mrq) { 1042 pr_err("%s: Card removed during transfer!\n", 1043 mmc_hostname(host->mmc)); 1044 wbsd_reset(host); 1045 1046 host->mrq->cmd->error = -ENOMEDIUM; 1047 tasklet_schedule(&host->finish_tasklet); 1048 } 1049 1050 delay = 0; 1051 } 1052 1053 /* 1054 * Unlock first since we might get a call back. 1055 */ 1056 1057 spin_unlock(&host->lock); 1058 1059 if (delay != -1) 1060 mmc_detect_change(host->mmc, msecs_to_jiffies(delay)); 1061 } 1062 1063 static void wbsd_tasklet_fifo(unsigned long param) 1064 { 1065 struct wbsd_host *host = (struct wbsd_host *)param; 1066 struct mmc_data *data; 1067 1068 spin_lock(&host->lock); 1069 1070 if (!host->mrq) 1071 goto end; 1072 1073 data = wbsd_get_data(host); 1074 if (!data) 1075 goto end; 1076 1077 if (data->flags & MMC_DATA_WRITE) 1078 wbsd_fill_fifo(host); 1079 else 1080 wbsd_empty_fifo(host); 1081 1082 /* 1083 * Done? 1084 */ 1085 if (host->num_sg == 0) { 1086 wbsd_write_index(host, WBSD_IDX_FIFOEN, 0); 1087 tasklet_schedule(&host->finish_tasklet); 1088 } 1089 1090 end: 1091 spin_unlock(&host->lock); 1092 } 1093 1094 static void wbsd_tasklet_crc(unsigned long param) 1095 { 1096 struct wbsd_host *host = (struct wbsd_host *)param; 1097 struct mmc_data *data; 1098 1099 spin_lock(&host->lock); 1100 1101 if (!host->mrq) 1102 goto end; 1103 1104 data = wbsd_get_data(host); 1105 if (!data) 1106 goto end; 1107 1108 DBGF("CRC error\n"); 1109 1110 data->error = -EILSEQ; 1111 1112 tasklet_schedule(&host->finish_tasklet); 1113 1114 end: 1115 spin_unlock(&host->lock); 1116 } 1117 1118 static void wbsd_tasklet_timeout(unsigned long param) 1119 { 1120 struct wbsd_host *host = (struct wbsd_host *)param; 1121 struct mmc_data *data; 1122 1123 spin_lock(&host->lock); 1124 1125 if (!host->mrq) 1126 goto end; 1127 1128 data = wbsd_get_data(host); 1129 if (!data) 1130 goto end; 1131 1132 DBGF("Timeout\n"); 1133 1134 data->error = -ETIMEDOUT; 1135 1136 tasklet_schedule(&host->finish_tasklet); 1137 1138 end: 1139 spin_unlock(&host->lock); 1140 } 1141 1142 static void wbsd_tasklet_finish(unsigned long param) 1143 { 1144 struct wbsd_host *host = (struct wbsd_host *)param; 1145 struct mmc_data *data; 1146 1147 spin_lock(&host->lock); 1148 1149 WARN_ON(!host->mrq); 1150 if (!host->mrq) 1151 goto end; 1152 1153 data = wbsd_get_data(host); 1154 if (!data) 1155 goto end; 1156 1157 wbsd_finish_data(host, data); 1158 1159 end: 1160 spin_unlock(&host->lock); 1161 } 1162 1163 /* 1164 * Interrupt handling 1165 */ 1166 1167 static irqreturn_t wbsd_irq(int irq, void *dev_id) 1168 { 1169 struct wbsd_host *host = dev_id; 1170 int isr; 1171 1172 isr = inb(host->base + WBSD_ISR); 1173 1174 /* 1175 * Was it actually our hardware that caused the interrupt? 1176 */ 1177 if (isr == 0xff || isr == 0x00) 1178 return IRQ_NONE; 1179 1180 host->isr |= isr; 1181 1182 /* 1183 * Schedule tasklets as needed. 1184 */ 1185 if (isr & WBSD_INT_CARD) 1186 tasklet_schedule(&host->card_tasklet); 1187 if (isr & WBSD_INT_FIFO_THRE) 1188 tasklet_schedule(&host->fifo_tasklet); 1189 if (isr & WBSD_INT_CRC) 1190 tasklet_hi_schedule(&host->crc_tasklet); 1191 if (isr & WBSD_INT_TIMEOUT) 1192 tasklet_hi_schedule(&host->timeout_tasklet); 1193 if (isr & WBSD_INT_TC) 1194 tasklet_schedule(&host->finish_tasklet); 1195 1196 return IRQ_HANDLED; 1197 } 1198 1199 /*****************************************************************************\ 1200 * * 1201 * Device initialisation and shutdown * 1202 * * 1203 \*****************************************************************************/ 1204 1205 /* 1206 * Allocate/free MMC structure. 1207 */ 1208 1209 static int wbsd_alloc_mmc(struct device *dev) 1210 { 1211 struct mmc_host *mmc; 1212 struct wbsd_host *host; 1213 1214 /* 1215 * Allocate MMC structure. 1216 */ 1217 mmc = mmc_alloc_host(sizeof(struct wbsd_host), dev); 1218 if (!mmc) 1219 return -ENOMEM; 1220 1221 host = mmc_priv(mmc); 1222 host->mmc = mmc; 1223 1224 host->dma = -1; 1225 1226 /* 1227 * Set host parameters. 1228 */ 1229 mmc->ops = &wbsd_ops; 1230 mmc->f_min = 375000; 1231 mmc->f_max = 24000000; 1232 mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34; 1233 mmc->caps = MMC_CAP_4_BIT_DATA; 1234 1235 spin_lock_init(&host->lock); 1236 1237 /* 1238 * Set up timers 1239 */ 1240 init_timer(&host->ignore_timer); 1241 host->ignore_timer.data = (unsigned long)host; 1242 host->ignore_timer.function = wbsd_reset_ignore; 1243 1244 /* 1245 * Maximum number of segments. Worst case is one sector per segment 1246 * so this will be 64kB/512. 1247 */ 1248 mmc->max_segs = 128; 1249 1250 /* 1251 * Maximum request size. Also limited by 64KiB buffer. 1252 */ 1253 mmc->max_req_size = 65536; 1254 1255 /* 1256 * Maximum segment size. Could be one segment with the maximum number 1257 * of bytes. 1258 */ 1259 mmc->max_seg_size = mmc->max_req_size; 1260 1261 /* 1262 * Maximum block size. We have 12 bits (= 4095) but have to subtract 1263 * space for CRC. So the maximum is 4095 - 4*2 = 4087. 1264 */ 1265 mmc->max_blk_size = 4087; 1266 1267 /* 1268 * Maximum block count. There is no real limit so the maximum 1269 * request size will be the only restriction. 1270 */ 1271 mmc->max_blk_count = mmc->max_req_size; 1272 1273 dev_set_drvdata(dev, mmc); 1274 1275 return 0; 1276 } 1277 1278 static void wbsd_free_mmc(struct device *dev) 1279 { 1280 struct mmc_host *mmc; 1281 struct wbsd_host *host; 1282 1283 mmc = dev_get_drvdata(dev); 1284 if (!mmc) 1285 return; 1286 1287 host = mmc_priv(mmc); 1288 BUG_ON(host == NULL); 1289 1290 del_timer_sync(&host->ignore_timer); 1291 1292 mmc_free_host(mmc); 1293 1294 dev_set_drvdata(dev, NULL); 1295 } 1296 1297 /* 1298 * Scan for known chip id:s 1299 */ 1300 1301 static int wbsd_scan(struct wbsd_host *host) 1302 { 1303 int i, j, k; 1304 int id; 1305 1306 /* 1307 * Iterate through all ports, all codes to 1308 * find hardware that is in our known list. 1309 */ 1310 for (i = 0; i < ARRAY_SIZE(config_ports); i++) { 1311 if (!request_region(config_ports[i], 2, DRIVER_NAME)) 1312 continue; 1313 1314 for (j = 0; j < ARRAY_SIZE(unlock_codes); j++) { 1315 id = 0xFFFF; 1316 1317 host->config = config_ports[i]; 1318 host->unlock_code = unlock_codes[j]; 1319 1320 wbsd_unlock_config(host); 1321 1322 outb(WBSD_CONF_ID_HI, config_ports[i]); 1323 id = inb(config_ports[i] + 1) << 8; 1324 1325 outb(WBSD_CONF_ID_LO, config_ports[i]); 1326 id |= inb(config_ports[i] + 1); 1327 1328 wbsd_lock_config(host); 1329 1330 for (k = 0; k < ARRAY_SIZE(valid_ids); k++) { 1331 if (id == valid_ids[k]) { 1332 host->chip_id = id; 1333 1334 return 0; 1335 } 1336 } 1337 1338 if (id != 0xFFFF) { 1339 DBG("Unknown hardware (id %x) found at %x\n", 1340 id, config_ports[i]); 1341 } 1342 } 1343 1344 release_region(config_ports[i], 2); 1345 } 1346 1347 host->config = 0; 1348 host->unlock_code = 0; 1349 1350 return -ENODEV; 1351 } 1352 1353 /* 1354 * Allocate/free io port ranges 1355 */ 1356 1357 static int wbsd_request_region(struct wbsd_host *host, int base) 1358 { 1359 if (base & 0x7) 1360 return -EINVAL; 1361 1362 if (!request_region(base, 8, DRIVER_NAME)) 1363 return -EIO; 1364 1365 host->base = base; 1366 1367 return 0; 1368 } 1369 1370 static void wbsd_release_regions(struct wbsd_host *host) 1371 { 1372 if (host->base) 1373 release_region(host->base, 8); 1374 1375 host->base = 0; 1376 1377 if (host->config) 1378 release_region(host->config, 2); 1379 1380 host->config = 0; 1381 } 1382 1383 /* 1384 * Allocate/free DMA port and buffer 1385 */ 1386 1387 static void wbsd_request_dma(struct wbsd_host *host, int dma) 1388 { 1389 if (dma < 0) 1390 return; 1391 1392 if (request_dma(dma, DRIVER_NAME)) 1393 goto err; 1394 1395 /* 1396 * We need to allocate a special buffer in 1397 * order for ISA to be able to DMA to it. 1398 */ 1399 host->dma_buffer = kmalloc(WBSD_DMA_SIZE, 1400 GFP_NOIO | GFP_DMA | __GFP_REPEAT | __GFP_NOWARN); 1401 if (!host->dma_buffer) 1402 goto free; 1403 1404 /* 1405 * Translate the address to a physical address. 1406 */ 1407 host->dma_addr = dma_map_single(mmc_dev(host->mmc), host->dma_buffer, 1408 WBSD_DMA_SIZE, DMA_BIDIRECTIONAL); 1409 1410 /* 1411 * ISA DMA must be aligned on a 64k basis. 1412 */ 1413 if ((host->dma_addr & 0xffff) != 0) 1414 goto kfree; 1415 /* 1416 * ISA cannot access memory above 16 MB. 1417 */ 1418 else if (host->dma_addr >= 0x1000000) 1419 goto kfree; 1420 1421 host->dma = dma; 1422 1423 return; 1424 1425 kfree: 1426 /* 1427 * If we've gotten here then there is some kind of alignment bug 1428 */ 1429 BUG_ON(1); 1430 1431 dma_unmap_single(mmc_dev(host->mmc), host->dma_addr, 1432 WBSD_DMA_SIZE, DMA_BIDIRECTIONAL); 1433 host->dma_addr = 0; 1434 1435 kfree(host->dma_buffer); 1436 host->dma_buffer = NULL; 1437 1438 free: 1439 free_dma(dma); 1440 1441 err: 1442 pr_warn(DRIVER_NAME ": Unable to allocate DMA %d - falling back on FIFO\n", 1443 dma); 1444 } 1445 1446 static void wbsd_release_dma(struct wbsd_host *host) 1447 { 1448 if (host->dma_addr) { 1449 dma_unmap_single(mmc_dev(host->mmc), host->dma_addr, 1450 WBSD_DMA_SIZE, DMA_BIDIRECTIONAL); 1451 } 1452 kfree(host->dma_buffer); 1453 if (host->dma >= 0) 1454 free_dma(host->dma); 1455 1456 host->dma = -1; 1457 host->dma_buffer = NULL; 1458 host->dma_addr = 0; 1459 } 1460 1461 /* 1462 * Allocate/free IRQ. 1463 */ 1464 1465 static int wbsd_request_irq(struct wbsd_host *host, int irq) 1466 { 1467 int ret; 1468 1469 /* 1470 * Set up tasklets. Must be done before requesting interrupt. 1471 */ 1472 tasklet_init(&host->card_tasklet, wbsd_tasklet_card, 1473 (unsigned long)host); 1474 tasklet_init(&host->fifo_tasklet, wbsd_tasklet_fifo, 1475 (unsigned long)host); 1476 tasklet_init(&host->crc_tasklet, wbsd_tasklet_crc, 1477 (unsigned long)host); 1478 tasklet_init(&host->timeout_tasklet, wbsd_tasklet_timeout, 1479 (unsigned long)host); 1480 tasklet_init(&host->finish_tasklet, wbsd_tasklet_finish, 1481 (unsigned long)host); 1482 1483 /* 1484 * Allocate interrupt. 1485 */ 1486 ret = request_irq(irq, wbsd_irq, IRQF_SHARED, DRIVER_NAME, host); 1487 if (ret) 1488 return ret; 1489 1490 host->irq = irq; 1491 1492 return 0; 1493 } 1494 1495 static void wbsd_release_irq(struct wbsd_host *host) 1496 { 1497 if (!host->irq) 1498 return; 1499 1500 free_irq(host->irq, host); 1501 1502 host->irq = 0; 1503 1504 tasklet_kill(&host->card_tasklet); 1505 tasklet_kill(&host->fifo_tasklet); 1506 tasklet_kill(&host->crc_tasklet); 1507 tasklet_kill(&host->timeout_tasklet); 1508 tasklet_kill(&host->finish_tasklet); 1509 } 1510 1511 /* 1512 * Allocate all resources for the host. 1513 */ 1514 1515 static int wbsd_request_resources(struct wbsd_host *host, 1516 int base, int irq, int dma) 1517 { 1518 int ret; 1519 1520 /* 1521 * Allocate I/O ports. 1522 */ 1523 ret = wbsd_request_region(host, base); 1524 if (ret) 1525 return ret; 1526 1527 /* 1528 * Allocate interrupt. 1529 */ 1530 ret = wbsd_request_irq(host, irq); 1531 if (ret) 1532 return ret; 1533 1534 /* 1535 * Allocate DMA. 1536 */ 1537 wbsd_request_dma(host, dma); 1538 1539 return 0; 1540 } 1541 1542 /* 1543 * Release all resources for the host. 1544 */ 1545 1546 static void wbsd_release_resources(struct wbsd_host *host) 1547 { 1548 wbsd_release_dma(host); 1549 wbsd_release_irq(host); 1550 wbsd_release_regions(host); 1551 } 1552 1553 /* 1554 * Configure the resources the chip should use. 1555 */ 1556 1557 static void wbsd_chip_config(struct wbsd_host *host) 1558 { 1559 wbsd_unlock_config(host); 1560 1561 /* 1562 * Reset the chip. 1563 */ 1564 wbsd_write_config(host, WBSD_CONF_SWRST, 1); 1565 wbsd_write_config(host, WBSD_CONF_SWRST, 0); 1566 1567 /* 1568 * Select SD/MMC function. 1569 */ 1570 wbsd_write_config(host, WBSD_CONF_DEVICE, DEVICE_SD); 1571 1572 /* 1573 * Set up card detection. 1574 */ 1575 wbsd_write_config(host, WBSD_CONF_PINS, WBSD_PINS_DETECT_GP11); 1576 1577 /* 1578 * Configure chip 1579 */ 1580 wbsd_write_config(host, WBSD_CONF_PORT_HI, host->base >> 8); 1581 wbsd_write_config(host, WBSD_CONF_PORT_LO, host->base & 0xff); 1582 1583 wbsd_write_config(host, WBSD_CONF_IRQ, host->irq); 1584 1585 if (host->dma >= 0) 1586 wbsd_write_config(host, WBSD_CONF_DRQ, host->dma); 1587 1588 /* 1589 * Enable and power up chip. 1590 */ 1591 wbsd_write_config(host, WBSD_CONF_ENABLE, 1); 1592 wbsd_write_config(host, WBSD_CONF_POWER, 0x20); 1593 1594 wbsd_lock_config(host); 1595 } 1596 1597 /* 1598 * Check that configured resources are correct. 1599 */ 1600 1601 static int wbsd_chip_validate(struct wbsd_host *host) 1602 { 1603 int base, irq, dma; 1604 1605 wbsd_unlock_config(host); 1606 1607 /* 1608 * Select SD/MMC function. 1609 */ 1610 wbsd_write_config(host, WBSD_CONF_DEVICE, DEVICE_SD); 1611 1612 /* 1613 * Read configuration. 1614 */ 1615 base = wbsd_read_config(host, WBSD_CONF_PORT_HI) << 8; 1616 base |= wbsd_read_config(host, WBSD_CONF_PORT_LO); 1617 1618 irq = wbsd_read_config(host, WBSD_CONF_IRQ); 1619 1620 dma = wbsd_read_config(host, WBSD_CONF_DRQ); 1621 1622 wbsd_lock_config(host); 1623 1624 /* 1625 * Validate against given configuration. 1626 */ 1627 if (base != host->base) 1628 return 0; 1629 if (irq != host->irq) 1630 return 0; 1631 if ((dma != host->dma) && (host->dma != -1)) 1632 return 0; 1633 1634 return 1; 1635 } 1636 1637 /* 1638 * Powers down the SD function 1639 */ 1640 1641 static void wbsd_chip_poweroff(struct wbsd_host *host) 1642 { 1643 wbsd_unlock_config(host); 1644 1645 wbsd_write_config(host, WBSD_CONF_DEVICE, DEVICE_SD); 1646 wbsd_write_config(host, WBSD_CONF_ENABLE, 0); 1647 1648 wbsd_lock_config(host); 1649 } 1650 1651 /*****************************************************************************\ 1652 * * 1653 * Devices setup and shutdown * 1654 * * 1655 \*****************************************************************************/ 1656 1657 static int wbsd_init(struct device *dev, int base, int irq, int dma, 1658 int pnp) 1659 { 1660 struct wbsd_host *host = NULL; 1661 struct mmc_host *mmc = NULL; 1662 int ret; 1663 1664 ret = wbsd_alloc_mmc(dev); 1665 if (ret) 1666 return ret; 1667 1668 mmc = dev_get_drvdata(dev); 1669 host = mmc_priv(mmc); 1670 1671 /* 1672 * Scan for hardware. 1673 */ 1674 ret = wbsd_scan(host); 1675 if (ret) { 1676 if (pnp && (ret == -ENODEV)) { 1677 pr_warn(DRIVER_NAME ": Unable to confirm device presence - you may experience lock-ups\n"); 1678 } else { 1679 wbsd_free_mmc(dev); 1680 return ret; 1681 } 1682 } 1683 1684 /* 1685 * Request resources. 1686 */ 1687 ret = wbsd_request_resources(host, base, irq, dma); 1688 if (ret) { 1689 wbsd_release_resources(host); 1690 wbsd_free_mmc(dev); 1691 return ret; 1692 } 1693 1694 /* 1695 * See if chip needs to be configured. 1696 */ 1697 if (pnp) { 1698 if ((host->config != 0) && !wbsd_chip_validate(host)) { 1699 pr_warn(DRIVER_NAME ": PnP active but chip not configured! You probably have a buggy BIOS. Configuring chip manually.\n"); 1700 wbsd_chip_config(host); 1701 } 1702 } else 1703 wbsd_chip_config(host); 1704 1705 /* 1706 * Power Management stuff. No idea how this works. 1707 * Not tested. 1708 */ 1709 #ifdef CONFIG_PM 1710 if (host->config) { 1711 wbsd_unlock_config(host); 1712 wbsd_write_config(host, WBSD_CONF_PME, 0xA0); 1713 wbsd_lock_config(host); 1714 } 1715 #endif 1716 /* 1717 * Allow device to initialise itself properly. 1718 */ 1719 mdelay(5); 1720 1721 /* 1722 * Reset the chip into a known state. 1723 */ 1724 wbsd_init_device(host); 1725 1726 mmc_add_host(mmc); 1727 1728 pr_info("%s: W83L51xD", mmc_hostname(mmc)); 1729 if (host->chip_id != 0) 1730 printk(" id %x", (int)host->chip_id); 1731 printk(" at 0x%x irq %d", (int)host->base, (int)host->irq); 1732 if (host->dma >= 0) 1733 printk(" dma %d", (int)host->dma); 1734 else 1735 printk(" FIFO"); 1736 if (pnp) 1737 printk(" PnP"); 1738 printk("\n"); 1739 1740 return 0; 1741 } 1742 1743 static void wbsd_shutdown(struct device *dev, int pnp) 1744 { 1745 struct mmc_host *mmc = dev_get_drvdata(dev); 1746 struct wbsd_host *host; 1747 1748 if (!mmc) 1749 return; 1750 1751 host = mmc_priv(mmc); 1752 1753 mmc_remove_host(mmc); 1754 1755 /* 1756 * Power down the SD/MMC function. 1757 */ 1758 if (!pnp) 1759 wbsd_chip_poweroff(host); 1760 1761 wbsd_release_resources(host); 1762 1763 wbsd_free_mmc(dev); 1764 } 1765 1766 /* 1767 * Non-PnP 1768 */ 1769 1770 static int wbsd_probe(struct platform_device *dev) 1771 { 1772 /* Use the module parameters for resources */ 1773 return wbsd_init(&dev->dev, param_io, param_irq, param_dma, 0); 1774 } 1775 1776 static int wbsd_remove(struct platform_device *dev) 1777 { 1778 wbsd_shutdown(&dev->dev, 0); 1779 1780 return 0; 1781 } 1782 1783 /* 1784 * PnP 1785 */ 1786 1787 #ifdef CONFIG_PNP 1788 1789 static int 1790 wbsd_pnp_probe(struct pnp_dev *pnpdev, const struct pnp_device_id *dev_id) 1791 { 1792 int io, irq, dma; 1793 1794 /* 1795 * Get resources from PnP layer. 1796 */ 1797 io = pnp_port_start(pnpdev, 0); 1798 irq = pnp_irq(pnpdev, 0); 1799 if (pnp_dma_valid(pnpdev, 0)) 1800 dma = pnp_dma(pnpdev, 0); 1801 else 1802 dma = -1; 1803 1804 DBGF("PnP resources: port %3x irq %d dma %d\n", io, irq, dma); 1805 1806 return wbsd_init(&pnpdev->dev, io, irq, dma, 1); 1807 } 1808 1809 static void wbsd_pnp_remove(struct pnp_dev *dev) 1810 { 1811 wbsd_shutdown(&dev->dev, 1); 1812 } 1813 1814 #endif /* CONFIG_PNP */ 1815 1816 /* 1817 * Power management 1818 */ 1819 1820 #ifdef CONFIG_PM 1821 1822 static int wbsd_platform_suspend(struct platform_device *dev, 1823 pm_message_t state) 1824 { 1825 struct mmc_host *mmc = platform_get_drvdata(dev); 1826 struct wbsd_host *host; 1827 1828 if (mmc == NULL) 1829 return 0; 1830 1831 DBGF("Suspending...\n"); 1832 1833 host = mmc_priv(mmc); 1834 1835 wbsd_chip_poweroff(host); 1836 return 0; 1837 } 1838 1839 static int wbsd_platform_resume(struct platform_device *dev) 1840 { 1841 struct mmc_host *mmc = platform_get_drvdata(dev); 1842 struct wbsd_host *host; 1843 1844 if (mmc == NULL) 1845 return 0; 1846 1847 DBGF("Resuming...\n"); 1848 1849 host = mmc_priv(mmc); 1850 1851 wbsd_chip_config(host); 1852 1853 /* 1854 * Allow device to initialise itself properly. 1855 */ 1856 mdelay(5); 1857 1858 wbsd_init_device(host); 1859 return 0; 1860 } 1861 1862 #ifdef CONFIG_PNP 1863 1864 static int wbsd_pnp_suspend(struct pnp_dev *pnp_dev, pm_message_t state) 1865 { 1866 struct mmc_host *mmc = dev_get_drvdata(&pnp_dev->dev); 1867 1868 if (mmc == NULL) 1869 return 0; 1870 1871 DBGF("Suspending...\n"); 1872 return 0; 1873 } 1874 1875 static int wbsd_pnp_resume(struct pnp_dev *pnp_dev) 1876 { 1877 struct mmc_host *mmc = dev_get_drvdata(&pnp_dev->dev); 1878 struct wbsd_host *host; 1879 1880 if (mmc == NULL) 1881 return 0; 1882 1883 DBGF("Resuming...\n"); 1884 1885 host = mmc_priv(mmc); 1886 1887 /* 1888 * See if chip needs to be configured. 1889 */ 1890 if (host->config != 0) { 1891 if (!wbsd_chip_validate(host)) { 1892 pr_warn(DRIVER_NAME ": PnP active but chip not configured! You probably have a buggy BIOS. Configuring chip manually.\n"); 1893 wbsd_chip_config(host); 1894 } 1895 } 1896 1897 /* 1898 * Allow device to initialise itself properly. 1899 */ 1900 mdelay(5); 1901 1902 wbsd_init_device(host); 1903 return 0; 1904 } 1905 1906 #endif /* CONFIG_PNP */ 1907 1908 #else /* CONFIG_PM */ 1909 1910 #define wbsd_platform_suspend NULL 1911 #define wbsd_platform_resume NULL 1912 1913 #define wbsd_pnp_suspend NULL 1914 #define wbsd_pnp_resume NULL 1915 1916 #endif /* CONFIG_PM */ 1917 1918 static struct platform_device *wbsd_device; 1919 1920 static struct platform_driver wbsd_driver = { 1921 .probe = wbsd_probe, 1922 .remove = wbsd_remove, 1923 1924 .suspend = wbsd_platform_suspend, 1925 .resume = wbsd_platform_resume, 1926 .driver = { 1927 .name = DRIVER_NAME, 1928 }, 1929 }; 1930 1931 #ifdef CONFIG_PNP 1932 1933 static struct pnp_driver wbsd_pnp_driver = { 1934 .name = DRIVER_NAME, 1935 .id_table = pnp_dev_table, 1936 .probe = wbsd_pnp_probe, 1937 .remove = wbsd_pnp_remove, 1938 1939 .suspend = wbsd_pnp_suspend, 1940 .resume = wbsd_pnp_resume, 1941 }; 1942 1943 #endif /* CONFIG_PNP */ 1944 1945 /* 1946 * Module loading/unloading 1947 */ 1948 1949 static int __init wbsd_drv_init(void) 1950 { 1951 int result; 1952 1953 pr_info(DRIVER_NAME 1954 ": Winbond W83L51xD SD/MMC card interface driver\n"); 1955 pr_info(DRIVER_NAME ": Copyright(c) Pierre Ossman\n"); 1956 1957 #ifdef CONFIG_PNP 1958 1959 if (!param_nopnp) { 1960 result = pnp_register_driver(&wbsd_pnp_driver); 1961 if (result < 0) 1962 return result; 1963 } 1964 #endif /* CONFIG_PNP */ 1965 1966 if (param_nopnp) { 1967 result = platform_driver_register(&wbsd_driver); 1968 if (result < 0) 1969 return result; 1970 1971 wbsd_device = platform_device_alloc(DRIVER_NAME, -1); 1972 if (!wbsd_device) { 1973 platform_driver_unregister(&wbsd_driver); 1974 return -ENOMEM; 1975 } 1976 1977 result = platform_device_add(wbsd_device); 1978 if (result) { 1979 platform_device_put(wbsd_device); 1980 platform_driver_unregister(&wbsd_driver); 1981 return result; 1982 } 1983 } 1984 1985 return 0; 1986 } 1987 1988 static void __exit wbsd_drv_exit(void) 1989 { 1990 #ifdef CONFIG_PNP 1991 1992 if (!param_nopnp) 1993 pnp_unregister_driver(&wbsd_pnp_driver); 1994 1995 #endif /* CONFIG_PNP */ 1996 1997 if (param_nopnp) { 1998 platform_device_unregister(wbsd_device); 1999 2000 platform_driver_unregister(&wbsd_driver); 2001 } 2002 2003 DBG("unloaded\n"); 2004 } 2005 2006 module_init(wbsd_drv_init); 2007 module_exit(wbsd_drv_exit); 2008 #ifdef CONFIG_PNP 2009 module_param_named(nopnp, param_nopnp, uint, 0444); 2010 #endif