This documentation is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
For more details see the file COPYING in the source distribution of Linux.
Table of Contents
parport_open
params
field var
value
i2c_new_device
Table of Contents
atomic_add — add integer to atomic variable
void fsfuncatomic_add ( | i, | |
v) ; |
int i
;atomic_t * v
;atomic_sub — subtract integer from atomic variable
void fsfuncatomic_sub ( | i, | |
v) ; |
int i
;atomic_t * v
;atomic_sub_and_test — subtract value from variable and test result
int fsfuncatomic_sub_and_test ( | i, | |
v) ; |
int i
;atomic_t * v
;atomic_dec_and_test — decrement and test
int fsfuncatomic_dec_and_test ( | v) ; |
atomic_t * v
;atomic_inc_and_test — increment and test
int fsfuncatomic_inc_and_test ( | v) ; |
atomic_t * v
;atomic_add_negative — add and test if negative
int fsfuncatomic_add_negative ( | i, | |
v) ; |
int i
;atomic_t * v
;atomic_add_return — add integer and return
int fsfuncatomic_add_return ( | i, | |
v) ; |
int i
;atomic_t * v
;atomic_sub_return — subtract integer and return
int fsfuncatomic_sub_return ( | i, | |
v) ; |
int i
;atomic_t * v
;__atomic_add_unless — add unless the number is already a given value
int fsfunc__atomic_add_unless ( | v, | |
a, | ||
u) ; |
atomic_t * v
;int a
;int u
;struct cputime — snaphsot of system and user cputime
struct cputime { cputime_t utime; cputime_t stime; };
struct task_cputime — collected CPU time counts
struct task_cputime { cputime_t utime; cputime_t stime; unsigned long long sum_exec_runtime; };
time spent in user mode, in cputime_t units
time spent in kernel mode, in cputime_t units
total time spent on the CPU, in nanoseconds
This is an extension of struct cputime that includes the total runtime spent by the task from the scheduler point of view.
As a result, this structure groups together three kinds of CPU time that are tracked for threads and thread groups. Most things considering CPU time want to group these counts together and treat all three of them in parallel.
struct thread_group_cputimer — thread group interval timer counts
struct thread_group_cputimer { struct task_cputime cputime; int running; raw_spinlock_t lock; };
pid_alive — check that a task structure is not stale
int fsfuncpid_alive ( | p) ; |
struct task_struct * p
;is_global_init — check if a task structure is init
int fsfuncis_global_init ( | tsk) ; |
struct task_struct * tsk
;is_idle_task — is the specified task an idle task?
bool fsfuncis_idle_task ( | p) ; |
const struct task_struct * p
;threadgroup_lock — lock threadgroup
void fsfuncthreadgroup_lock ( | tsk) ; |
struct task_struct * tsk
;
Lock the threadgroup tsk
belongs to. No new task is allowed to enter
and member tasks aren't allowed to exit (as indicated by PF_EXITING) or
change ->group_leader/pid. This is useful for cases where the threadgroup
needs to stay stable across blockable operations.
fork and exit paths explicitly call threadgroup_change_{begin|end}() for synchronization. While held, no new task will be added to threadgroup and no existing live task will have its PF_EXITING set.
de_thread
does threadgroup_change_{begin|end}() when a non-leader
sub-thread becomes a new leader.
threadgroup_unlock — unlock threadgroup
void fsfuncthreadgroup_unlock ( | tsk) ; |
struct task_struct * tsk
;wake_up_process — Wake up a specific process
int fsfuncwake_up_process ( | p) ; |
struct task_struct * p
;preempt_notifier_register — tell me when current is being preempted & rescheduled
void fsfuncpreempt_notifier_register ( | notifier) ; |
struct preempt_notifier * notifier
;preempt_notifier_unregister — no longer interested in preemption notifications
void fsfuncpreempt_notifier_unregister ( | notifier) ; |
struct preempt_notifier * notifier
;__wake_up — wake up threads blocked on a waitqueue.
void fsfunc__wake_up ( | q, | |
mode, | ||
nr_exclusive, | ||
key) ; |
wait_queue_head_t * q
;unsigned int mode
;int nr_exclusive
;void * key
;__wake_up_sync_key — wake up threads blocked on a waitqueue.
void fsfunc__wake_up_sync_key ( | q, | |
mode, | ||
nr_exclusive, | ||
key) ; |
wait_queue_head_t * q
;unsigned int mode
;int nr_exclusive
;void * key
;q
the waitqueue
mode
which threads
nr_exclusive
how many wake-one or wake-many threads to wake up
key
opaque value to be passed to wakeup targets
The sync wakeup differs that the waker knows that it will schedule away soon, so while the target thread will be woken up, it will not be migrated to another CPU - ie. the two threads are 'synchronized' with each other. This can prevent needless bouncing between CPUs.
On UP it can prevent extra preemption.
It may be assumed that this function implies a write memory barrier before changing the task state if and only if any tasks are woken up.
complete — signals a single thread waiting on this completion
void fsfunccomplete ( | x) ; |
struct completion * x
;This will wake up a single thread waiting on this completion. Threads will be awakened in the same order in which they were queued.
See also complete_all
, wait_for_completion
and related routines.
It may be assumed that this function implies a write memory barrier before changing the task state if and only if any tasks are woken up.
complete_all — signals all threads waiting on this completion
void fsfunccomplete_all ( | x) ; |
struct completion * x
;wait_for_completion — waits for completion of a task
void __sched fsfuncwait_for_completion ( | x) ; |
struct completion * x
;wait_for_completion_timeout — waits for completion of a task (w/timeout)
unsigned long __sched fsfuncwait_for_completion_timeout ( | x, | |
timeout) ; |
struct completion * x
;unsigned long timeout
;wait_for_completion_io — waits for completion of a task
void __sched fsfuncwait_for_completion_io ( | x) ; |
struct completion * x
;wait_for_completion_io_timeout — waits for completion of a task (w/timeout)
unsigned long __sched fsfuncwait_for_completion_io_timeout ( | x, | |
timeout) ; |
struct completion * x
;unsigned long timeout
;wait_for_completion_interruptible — waits for completion of a task (w/intr)
int __sched fsfuncwait_for_completion_interruptible ( | x) ; |
struct completion * x
;wait_for_completion_interruptible_timeout — waits for completion (w/(to,intr))
long __sched fsfuncwait_for_completion_interruptible_timeout ( | x, | |
timeout) ; |
struct completion * x
;unsigned long timeout
;wait_for_completion_killable — waits for completion of a task (killable)
int __sched fsfuncwait_for_completion_killable ( | x) ; |
struct completion * x
;wait_for_completion_killable_timeout — waits for completion of a task (w/(to,killable))
long __sched fsfuncwait_for_completion_killable_timeout ( | x, | |
timeout) ; |
struct completion * x
;unsigned long timeout
;try_wait_for_completion — try to decrement a completion without blocking
bool fsfunctry_wait_for_completion ( | x) ; |
struct completion * x
;completion_done — Test to see if a completion has any waiters
bool fsfunccompletion_done ( | x) ; |
struct completion * x
;task_nice — return the nice value of a given task.
int fsfunctask_nice ( | p) ; |
const struct task_struct * p
;sched_setscheduler — change the scheduling policy and/or RT priority of a thread.
int fsfuncsched_setscheduler ( | p, | |
policy, | ||
param) ; |
struct task_struct * p
;int policy
;const struct sched_param * param
;yield — yield the current processor to other threads.
void __sched fsfuncyield ( | void) ; |
void
;
Do not ever use this function, there's a 99% chance you're doing it wrong.
The scheduler is at all times free to pick the calling task as the most
eligible task to run, if removing the yield
call from your code breaks
it, its already broken.
while (!event)
yield
;
where one assumes that yield
will let 'the other' process run that will
make event true. If the current task is a SCHED_FIFO task that will never
happen. Never use yield
as a progress guarantee!!
If you want to use yield
to wait for something, use wait_event
.
If you want to use yield
to be 'nice' for others, use cond_resched
.
If you still want to use yield
, do not!
yield_to — yield the current processor to another thread in your thread group, or accelerate that thread toward the processor it's on.
bool __sched fsfuncyield_to ( | p, | |
preempt) ; |
struct task_struct * p
;bool preempt
;cpupri_find — find the best (lowest-pri) CPU in the system
int fsfunccpupri_find ( | cp, | |
p, | ||
lowest_mask) ; |
struct cpupri * cp
;struct task_struct * p
;struct cpumask * lowest_mask
;cp
The cpupri context
p
The task
lowest_mask
A mask to fill in with selected CPUs (or NULL)
This function returns the recommended CPUs as calculated during the current invocation. By the time the call returns, the CPUs may have in fact changed priorities any number of times. While not ideal, it is not an issue of correctness since the normal rebalancer logic will correct any discrepancies created by racing against the uncertainty of the current priority configuration.
cpupri_set — update the cpu priority setting
void fsfunccpupri_set ( | cp, | |
cpu, | ||
newpri) ; |
struct cpupri * cp
;int cpu
;int newpri
;cpupri_init — initialize the cpupri structure
int fsfunccpupri_init ( | cp) ; |
struct cpupri * cp
;cpupri_cleanup — clean up the cpupri structure
void fsfunccpupri_cleanup ( | cp) ; |
struct cpupri * cp
;get_sd_load_idx — Obtain the load index for a given sched domain.
int fsfuncget_sd_load_idx ( | sd, | |
idle) ; |
struct sched_domain * sd
;enum cpu_idle_type idle
;update_sg_lb_stats — Update sched_group's statistics for load balancing.
void fsfuncupdate_sg_lb_stats ( | env, | |
group, | ||
load_idx, | ||
local_group, | ||
sgs) ; |
struct lb_env * env
;struct sched_group * group
;int load_idx
;int local_group
;struct sg_lb_stats * sgs
;update_sd_pick_busiest — return 1 on busiest group
bool fsfuncupdate_sd_pick_busiest ( | env, | |
sds, | ||
sg, | ||
sgs) ; |
struct lb_env * env
;struct sd_lb_stats * sds
;struct sched_group * sg
;struct sg_lb_stats * sgs
;update_sd_lb_stats — Update sched_domain's statistics for load balancing.
void fsfuncupdate_sd_lb_stats ( | env, | |
sds) ; |
struct lb_env * env
;struct sd_lb_stats * sds
;check_asym_packing — Check to see if the group is packed into the sched doman.
int fsfunccheck_asym_packing ( | env, | |
sds) ; |
struct lb_env * env
;struct sd_lb_stats * sds
;env
The load balancing environment.
sds
Statistics of the sched_domain which is to be packed
This is primarily intended to used at the sibling level. Some cores like POWER7 prefer to use lower numbered SMT threads. In the case of POWER7, it can move to lower SMT modes only when higher threads are idle. When in lower SMT modes, the threads will perform better since they share less core resources. Hence when we have idle threads, we want them to be the higher ones.
This packing function is run on idle threads. It checks to see if the busiest CPU in this domain (core in the P7 case) has a higher CPU number than the packing function is being run on. Here we are assuming lower CPU number will be equivalent to lower a SMT thread number.
fix_small_imbalance — Calculate the minor imbalance that exists amongst the groups of a sched_domain, during load balancing.
void fsfuncfix_small_imbalance ( | env, | |
sds) ; |
struct lb_env * env
;struct sd_lb_stats * sds
;calculate_imbalance — Calculate the amount of imbalance present within the groups of a given sched_domain during load balance.
void fsfunccalculate_imbalance ( | env, | |
sds) ; |
struct lb_env * env
;struct sd_lb_stats * sds
;find_busiest_group — Returns the busiest group within the sched_domain if there is an imbalance. If there isn't an imbalance, and the user has opted for power-savings, it returns a group whose CPUs can be put to idle by rebalancing those tasks elsewhere, if such a group exists.
struct sched_group * fsfuncfind_busiest_group ( | env) ; |
struct lb_env * env
;DECLARE_COMPLETION — declare and initialize a completion structure
fsfuncDECLARE_COMPLETION ( | work) ; |
work
;DECLARE_COMPLETION_ONSTACK — declare and initialize a completion structure
fsfuncDECLARE_COMPLETION_ONSTACK ( | work) ; |
work
;init_completion — Initialize a dynamically allocated completion
void fsfuncinit_completion ( | x) ; |
struct completion * x
;__round_jiffies — function to round jiffies to a full second
unsigned long fsfunc__round_jiffies ( | j, | |
cpu) ; |
unsigned long j
;int cpu
;j
the time in (absolute) jiffies that should be rounded
cpu
the processor number on which the timeout will happen
__round_jiffies
rounds an absolute time in the future (in jiffies)
up or down to (approximately) full seconds. This is useful for timers
for which the exact time they fire does not matter too much, as long as
they fire approximately every X seconds.
By rounding these timers to whole seconds, all such timers will fire at the same time, rather than at various times spread out. The goal of this is to have the CPU wake up less, which saves power.
The exact rounding is skewed for each processor to avoid all processors firing at the exact same time, which could lead to lock contention or spurious cache line bouncing.
The return value is the rounded version of the j
parameter.
__round_jiffies_relative — function to round jiffies to a full second
unsigned long fsfunc__round_jiffies_relative ( | j, | |
cpu) ; |
unsigned long j
;int cpu
;j
the time in (relative) jiffies that should be rounded
cpu
the processor number on which the timeout will happen
__round_jiffies_relative
rounds a time delta in the future (in jiffies)
up or down to (approximately) full seconds. This is useful for timers
for which the exact time they fire does not matter too much, as long as
they fire approximately every X seconds.
By rounding these timers to whole seconds, all such timers will fire at the same time, rather than at various times spread out. The goal of this is to have the CPU wake up less, which saves power.
The exact rounding is skewed for each processor to avoid all processors firing at the exact same time, which could lead to lock contention or spurious cache line bouncing.
The return value is the rounded version of the j
parameter.
round_jiffies — function to round jiffies to a full second
unsigned long fsfuncround_jiffies ( | j) ; |
unsigned long j
;
round_jiffies
rounds an absolute time in the future (in jiffies)
up or down to (approximately) full seconds. This is useful for timers
for which the exact time they fire does not matter too much, as long as
they fire approximately every X seconds.
By rounding these timers to whole seconds, all such timers will fire at the same time, rather than at various times spread out. The goal of this is to have the CPU wake up less, which saves power.
The return value is the rounded version of the j
parameter.
round_jiffies_relative — function to round jiffies to a full second
unsigned long fsfuncround_jiffies_relative ( | j) ; |
unsigned long j
;
round_jiffies_relative
rounds a time delta in the future (in jiffies)
up or down to (approximately) full seconds. This is useful for timers
for which the exact time they fire does not matter too much, as long as
they fire approximately every X seconds.
By rounding these timers to whole seconds, all such timers will fire at the same time, rather than at various times spread out. The goal of this is to have the CPU wake up less, which saves power.
The return value is the rounded version of the j
parameter.
__round_jiffies_up — function to round jiffies up to a full second
unsigned long fsfunc__round_jiffies_up ( | j, | |
cpu) ; |
unsigned long j
;int cpu
;__round_jiffies_up_relative — function to round jiffies up to a full second
unsigned long fsfunc__round_jiffies_up_relative ( | j, | |
cpu) ; |
unsigned long j
;int cpu
;round_jiffies_up — function to round jiffies up to a full second
unsigned long fsfuncround_jiffies_up ( | j) ; |
unsigned long j
;round_jiffies_up_relative — function to round jiffies up to a full second
unsigned long fsfuncround_jiffies_up_relative ( | j) ; |
unsigned long j
;set_timer_slack — set the allowed slack for a timer
void fsfuncset_timer_slack ( | timer, | |
slack_hz) ; |
struct timer_list * timer
;int slack_hz
;timer
the timer to be modified
slack_hz
the amount of time (in jiffies) allowed for rounding
Set the amount of time, in jiffies, that a certain timer has
in terms of slack. By setting this value, the timer subsystem
will schedule the actual timer somewhere between
the time mod_timer
asks for, and that time plus the slack.
By setting the slack to -1, a percentage of the delay is used instead.
init_timer_key — initialize a timer
void fsfuncinit_timer_key ( | timer, | |
flags, | ||
name, | ||
key) ; |
struct timer_list * timer
;unsigned int flags
;const char * name
;struct lock_class_key * key
;mod_timer_pending — modify a pending timer's timeout
int fsfuncmod_timer_pending ( | timer, | |
expires) ; |
struct timer_list * timer
;unsigned long expires
;mod_timer — modify a timer's timeout
int fsfuncmod_timer ( | timer, | |
expires) ; |
struct timer_list * timer
;unsigned long expires
;
mod_timer
is a more efficient way to update the expire field of an
active timer (if the timer is inactive it will be activated)
mod_timer(timer, expires) is equivalent to:
del_timer(timer); timer->expires = expires; add_timer(timer);
Note that if there are multiple unserialized concurrent users of the
same timer, then mod_timer
is the only safe way to modify the timeout,
since add_timer
cannot modify an already running timer.
The function returns whether it has modified a pending timer or not.
(ie. mod_timer
of an inactive timer returns 0, mod_timer
of an
active timer returns 1.)
mod_timer_pinned — modify a timer's timeout
int fsfuncmod_timer_pinned ( | timer, | |
expires) ; |
struct timer_list * timer
;unsigned long expires
;
mod_timer_pinned
is a way to update the expire field of an
active timer (if the timer is inactive it will be activated)
and to ensure that the timer is scheduled on the current CPU.
Note that this does not prevent the timer from being migrated when the current CPU goes offline. If this is a problem for you, use CPU-hotplug notifiers to handle it correctly, for example, cancelling the timer when the corresponding CPU goes offline.
mod_timer_pinned(timer, expires) is equivalent to:
del_timer(timer); timer->expires = expires; add_timer(timer);
add_timer — start a timer
void fsfuncadd_timer ( | timer) ; |
struct timer_list * timer
;The kernel will do a ->function(->data) callback from the timer interrupt at the ->expires point in the future. The current time is 'jiffies'.
The timer's ->expires, ->function (and if the handler uses it, ->data) fields must be set prior calling this function.
Timers with an ->expires field in the past will be executed in the next timer tick.
add_timer_on — start a timer on a particular CPU
void fsfuncadd_timer_on ( | timer, | |
cpu) ; |
struct timer_list * timer
;int cpu
;try_to_del_timer_sync — Try to deactivate a timer
int fsfunctry_to_del_timer_sync ( | timer) ; |
struct timer_list * timer
;del_timer_sync — deactivate a timer and wait for the handler to finish.
int fsfuncdel_timer_sync ( | timer) ; |
struct timer_list * timer
;
This function only differs from del_timer
on SMP: besides deactivating
the timer it also makes sure the handler has finished executing on other
CPUs.
Callers must prevent restarting of the timer,
otherwise this function is meaningless. It must not be called from
interrupt contexts unless the timer is an irqsafe one. The caller must
not hold locks which would prevent completion of the timer's
handler. The timer's handler must not call add_timer_on
. Upon exit the
timer is not queued and the handler is not running on any CPU.
For !irqsafe timers, you must not hold locks that are held in interrupt context while calling this function. Even if the lock has nothing to do with the timer in question. Here's why:
CPU0 CPU1
---- ----
<SOFTIRQ>
call_timer_fn
;
base->running_timer = mytimer;
spin_lock_irq(somelock);
<IRQ>
spin_lock(somelock);
del_timer_sync(mytimer);
while (base->running_timer == mytimer);
Now del_timer_sync
will never return and never release somelock.
The interrupt on the other CPU is waiting to grab somelock but
it has interrupted the softirq that CPU0 is waiting to finish.
The function returns whether it has deactivated a pending timer or not.
schedule_timeout — sleep until timeout
signed long __sched fsfuncschedule_timeout ( | timeout) ; |
signed long timeout
;
Make the current task sleep until timeout
jiffies have
elapsed. The routine will return immediately unless
the current task state has been set (see set_current_state
).
You can set the task state as follows -
TASK_UNINTERRUPTIBLE
- at least timeout
jiffies are guaranteed to
pass before the routine returns. The routine will return 0
TASK_INTERRUPTIBLE
- the routine may return early if a signal is
delivered to the current task. In this case the remaining time
in jiffies will be returned, or 0 if the timer expired in time
The current task state is guaranteed to be TASK_RUNNING when this routine returns.
Specifying a timeout
value of MAX_SCHEDULE_TIMEOUT
will schedule
the CPU away without a bound on the timeout. In this case the return
value will be MAX_SCHEDULE_TIMEOUT
.
In all cases the return value is guaranteed to be non-negative.
msleep — sleep safely even with waitqueue interruptions
void fsfuncmsleep ( | msecs) ; |
unsigned int msecs
;wait_event — sleep until a condition gets true
fsfuncwait_event ( | wq, | |
condition) ; |
wq
; condition
;wait_event_timeout — sleep until a condition gets true or a timeout elapses
fsfuncwait_event_timeout ( | wq, | |
condition, | ||
timeout) ; |
wq
; condition
; timeout
;wq
the waitqueue to wait on
condition
a C expression for the event to wait for
timeout
timeout, in jiffies
The process is put to sleep (TASK_UNINTERRUPTIBLE) until the
condition
evaluates to true. The condition
is checked each time
the waitqueue wq
is woken up.
wake_up
has to be called after changing any variable that could
change the result of the wait condition.
The function returns 0 if the timeout
elapsed, or the remaining
jiffies (at least 1) if the condition
evaluated to true
before
the timeout
elapsed.
wait_event_interruptible — sleep until a condition gets true
fsfuncwait_event_interruptible ( | wq, | |
condition) ; |
wq
; condition
;
The process is put to sleep (TASK_INTERRUPTIBLE) until the
condition
evaluates to true or a signal is received.
The condition
is checked each time the waitqueue wq
is woken up.
wake_up
has to be called after changing any variable that could
change the result of the wait condition.
The function will return -ERESTARTSYS if it was interrupted by a
signal and 0 if condition
evaluated to true.
wait_event_interruptible_timeout — sleep until a condition gets true or a timeout elapses
fsfuncwait_event_interruptible_timeout ( | wq, | |
condition, | ||
timeout) ; |
wq
; condition
; timeout
;wq
the waitqueue to wait on
condition
a C expression for the event to wait for
timeout
timeout, in jiffies
wait_event_hrtimeout — sleep until a condition gets true or a timeout elapses
fsfuncwait_event_hrtimeout ( | wq, | |
condition, | ||
timeout) ; |
wq
; condition
; timeout
;wq
the waitqueue to wait on
condition
a C expression for the event to wait for
timeout
timeout, as a ktime_t
The process is put to sleep (TASK_UNINTERRUPTIBLE) until the
condition
evaluates to true or a signal is received.
The condition
is checked each time the waitqueue wq
is woken up.
wake_up
has to be called after changing any variable that could
change the result of the wait condition.
The function returns 0 if condition
became true, or -ETIME if the timeout
elapsed.
wait_event_interruptible_hrtimeout — sleep until a condition gets true or a timeout elapses
fsfuncwait_event_interruptible_hrtimeout ( | wq, | |
condition, | ||
timeout) ; |
wq
; condition
; timeout
;wq
the waitqueue to wait on
condition
a C expression for the event to wait for
timeout
timeout, as a ktime_t
The process is put to sleep (TASK_INTERRUPTIBLE) until the
condition
evaluates to true or a signal is received.
The condition
is checked each time the waitqueue wq
is woken up.
wake_up
has to be called after changing any variable that could
change the result of the wait condition.
The function returns 0 if condition
became true, -ERESTARTSYS if it was
interrupted by a signal, or -ETIME if the timeout elapsed.
wait_event_interruptible_locked — sleep until a condition gets true
fsfuncwait_event_interruptible_locked ( | wq, | |
condition) ; |
wq
; condition
;
The process is put to sleep (TASK_INTERRUPTIBLE) until the
condition
evaluates to true or a signal is received.
The condition
is checked each time the waitqueue wq
is woken up.
It must be called with wq.lock being held. This spinlock is
unlocked while sleeping but condition
testing is done while lock
is held and when this macro exits the lock is held.
The lock is locked/unlocked using spin_lock
/spin_unlock
functions which must match the way they are locked/unlocked outside
of this macro.
wake_up_locked
has to be called after changing any variable that could
change the result of the wait condition.
The function will return -ERESTARTSYS if it was interrupted by a
signal and 0 if condition
evaluated to true.
wait_event_interruptible_locked_irq — sleep until a condition gets true
fsfuncwait_event_interruptible_locked_irq ( | wq, | |
condition) ; |
wq
; condition
;
The process is put to sleep (TASK_INTERRUPTIBLE) until the
condition
evaluates to true or a signal is received.
The condition
is checked each time the waitqueue wq
is woken up.
It must be called with wq.lock being held. This spinlock is
unlocked while sleeping but condition
testing is done while lock
is held and when this macro exits the lock is held.
The lock is locked/unlocked using spin_lock_irq
/spin_unlock_irq
functions which must match the way they are locked/unlocked outside
of this macro.
wake_up_locked
has to be called after changing any variable that could
change the result of the wait condition.
The function will return -ERESTARTSYS if it was interrupted by a
signal and 0 if condition
evaluated to true.
wait_event_interruptible_exclusive_locked — sleep exclusively until a condition gets true
fsfuncwait_event_interruptible_exclusive_locked ( | wq, | |
condition) ; |
wq
; condition
;
The process is put to sleep (TASK_INTERRUPTIBLE) until the
condition
evaluates to true or a signal is received.
The condition
is checked each time the waitqueue wq
is woken up.
It must be called with wq.lock being held. This spinlock is
unlocked while sleeping but condition
testing is done while lock
is held and when this macro exits the lock is held.
The lock is locked/unlocked using spin_lock
/spin_unlock
functions which must match the way they are locked/unlocked outside
of this macro.
The process is put on the wait queue with an WQ_FLAG_EXCLUSIVE flag set thus when other process waits process on the list if this process is awaken further processes are not considered.
wake_up_locked
has to be called after changing any variable that could
change the result of the wait condition.
The function will return -ERESTARTSYS if it was interrupted by a
signal and 0 if condition
evaluated to true.
wait_event_interruptible_exclusive_locked_irq — sleep until a condition gets true
fsfuncwait_event_interruptible_exclusive_locked_irq ( | wq, | |
condition) ; |
wq
; condition
;
The process is put to sleep (TASK_INTERRUPTIBLE) until the
condition
evaluates to true or a signal is received.
The condition
is checked each time the waitqueue wq
is woken up.
It must be called with wq.lock being held. This spinlock is
unlocked while sleeping but condition
testing is done while lock
is held and when this macro exits the lock is held.
The lock is locked/unlocked using spin_lock_irq
/spin_unlock_irq
functions which must match the way they are locked/unlocked outside
of this macro.
The process is put on the wait queue with an WQ_FLAG_EXCLUSIVE flag set thus when other process waits process on the list if this process is awaken further processes are not considered.
wake_up_locked
has to be called after changing any variable that could
change the result of the wait condition.
The function will return -ERESTARTSYS if it was interrupted by a
signal and 0 if condition
evaluated to true.
wait_event_killable — sleep until a condition gets true
fsfuncwait_event_killable ( | wq, | |
condition) ; |
wq
; condition
;
The process is put to sleep (TASK_KILLABLE) until the
condition
evaluates to true or a signal is received.
The condition
is checked each time the waitqueue wq
is woken up.
wake_up
has to be called after changing any variable that could
change the result of the wait condition.
The function will return -ERESTARTSYS if it was interrupted by a
signal and 0 if condition
evaluated to true.
wait_event_lock_irq_cmd — sleep until a condition gets true. The condition is checked under the lock. This is expected to be called with the lock taken.
fsfuncwait_event_lock_irq_cmd ( | wq, | |
condition, | ||
lock, | ||
cmd) ; |
wq
; condition
; lock
; cmd
;wq
the waitqueue to wait on
condition
a C expression for the event to wait for
lock
a locked spinlock_t, which will be released before cmd
and schedule
and reacquired afterwards.
cmd
a command which is invoked outside the critical section before sleep
The process is put to sleep (TASK_UNINTERRUPTIBLE) until the
condition
evaluates to true. The condition
is checked each time
the waitqueue wq
is woken up.
wake_up
has to be called after changing any variable that could
change the result of the wait condition.
This is supposed to be called while holding the lock. The lock is dropped before invoking the cmd and going to sleep and is reacquired afterwards.
wait_event_lock_irq — sleep until a condition gets true. The condition is checked under the lock. This is expected to be called with the lock taken.
fsfuncwait_event_lock_irq ( | wq, | |
condition, | ||
lock) ; |
wq
; condition
; lock
;wq
the waitqueue to wait on
condition
a C expression for the event to wait for
lock
a locked spinlock_t, which will be released before schedule
and reacquired afterwards.
The process is put to sleep (TASK_UNINTERRUPTIBLE) until the
condition
evaluates to true. The condition
is checked each time
the waitqueue wq
is woken up.
wake_up
has to be called after changing any variable that could
change the result of the wait condition.
This is supposed to be called while holding the lock. The lock is dropped before going to sleep and is reacquired afterwards.
wait_event_interruptible_lock_irq_cmd — sleep until a condition gets true. The condition is checked under the lock. This is expected to be called with the lock taken.
fsfuncwait_event_interruptible_lock_irq_cmd ( | wq, | |
condition, | ||
lock, | ||
cmd) ; |
wq
; condition
; lock
; cmd
;wq
the waitqueue to wait on
condition
a C expression for the event to wait for
lock
a locked spinlock_t, which will be released before cmd and
schedule
and reacquired afterwards.
cmd
a command which is invoked outside the critical section before sleep
The process is put to sleep (TASK_INTERRUPTIBLE) until the
condition
evaluates to true or a signal is received. The condition
is
checked each time the waitqueue wq
is woken up.
wake_up
has to be called after changing any variable that could
change the result of the wait condition.
This is supposed to be called while holding the lock. The lock is dropped before invoking the cmd and going to sleep and is reacquired afterwards.
The macro will return -ERESTARTSYS if it was interrupted by a signal
and 0 if condition
evaluated to true.
wait_event_interruptible_lock_irq — sleep until a condition gets true. The condition is checked under the lock. This is expected to be called with the lock taken.
fsfuncwait_event_interruptible_lock_irq ( | wq, | |
condition, | ||
lock) ; |
wq
; condition
; lock
;wq
the waitqueue to wait on
condition
a C expression for the event to wait for
lock
a locked spinlock_t, which will be released before schedule
and reacquired afterwards.
The process is put to sleep (TASK_INTERRUPTIBLE) until the
condition
evaluates to true or signal is received. The condition
is
checked each time the waitqueue wq
is woken up.
wake_up
has to be called after changing any variable that could
change the result of the wait condition.
This is supposed to be called while holding the lock. The lock is dropped before going to sleep and is reacquired afterwards.
The macro will return -ERESTARTSYS if it was interrupted by a signal
and 0 if condition
evaluated to true.
wait_event_interruptible_lock_irq_timeout — sleep until a condition gets true or a timeout elapses. The condition is checked under the lock. This is expected to be called with the lock taken.
fsfuncwait_event_interruptible_lock_irq_timeout ( | wq, | |
condition, | ||
lock, | ||
timeout) ; |
wq
; condition
; lock
; timeout
;wq
the waitqueue to wait on
condition
a C expression for the event to wait for
lock
a locked spinlock_t, which will be released before schedule
and reacquired afterwards.
timeout
timeout, in jiffies
The process is put to sleep (TASK_INTERRUPTIBLE) until the
condition
evaluates to true or signal is received. The condition
is
checked each time the waitqueue wq
is woken up.
wake_up
has to be called after changing any variable that could
change the result of the wait condition.
This is supposed to be called while holding the lock. The lock is dropped before going to sleep and is reacquired afterwards.
The function returns 0 if the timeout
elapsed, -ERESTARTSYS if it
was interrupted by a signal, and the remaining jiffies otherwise
if the condition evaluated to true before the timeout elapsed.
wait_on_bit — wait for a bit to be cleared
int fsfuncwait_on_bit ( | word, | |
bit, | ||
action, | ||
mode) ; |
void * word
;int bit
;int (*action)
(
void *)
;unsigned mode
;word
the word being waited on, a kernel virtual address
bit
the bit of the word being waited on
action
the function used to sleep, which may take special actions
mode
the task state to sleep in
There is a standard hashed waitqueue table for generic use. This
is the part of the hashtable's accessor API that waits on a bit.
For instance, if one were to have waiters on a bitflag, one would
call wait_on_bit
in threads waiting for the bit to clear.
One uses wait_on_bit
where one is waiting for the bit to clear,
but has no intention of setting it.
wait_on_bit_lock — wait for a bit to be cleared, when wanting to set it
int fsfuncwait_on_bit_lock ( | word, | |
bit, | ||
action, | ||
mode) ; |
void * word
;int bit
;int (*action)
(
void *)
;unsigned mode
;word
the word being waited on, a kernel virtual address
bit
the bit of the word being waited on
action
the function used to sleep, which may take special actions
mode
the task state to sleep in
There is a standard hashed waitqueue table for generic use. This
is the part of the hashtable's accessor API that waits on a bit
when one intends to set it, for instance, trying to lock bitflags.
For instance, if one were to have waiters trying to set bitflag
and waiting for it to clear before setting it, one would call
wait_on_bit
in threads waiting to be able to set the bit.
One uses wait_on_bit_lock
where one is waiting for the bit to
clear with the intention of setting it, and when done, clearing it.
wait_on_atomic_t — Wait for an atomic_t to become 0
int fsfuncwait_on_atomic_t ( | val, | |
action, | ||
mode) ; |
atomic_t * val
;int (*action)
(
atomic_t *)
;unsigned mode
;finish_wait — clean up after waiting in a queue
void fsfuncfinish_wait ( | q, | |
wait) ; |
wait_queue_head_t * q
;wait_queue_t * wait
;abort_exclusive_wait — abort exclusive waiting in a queue
void fsfuncabort_exclusive_wait ( | q, | |
wait, | ||
mode, | ||
key) ; |
wait_queue_head_t * q
;wait_queue_t * wait
;unsigned int mode
;void * key
;q
waitqueue waited on
wait
wait descriptor
mode
runstate of the waiter to be woken
key
key to identify a wait bit queue or NULL
Sets current thread back to running state and removes the wait descriptor from the given waitqueue if still queued.
Wakes up the next waiter if the caller is concurrently woken up through the queue.
This prevents waiter starvation where an exclusive waiter aborts and is woken up concurrently and no one wakes up the next waiter.
wake_up_bit — wake up a waiter on a bit
void fsfuncwake_up_bit ( | word, | |
bit) ; |
void * word
;int bit
;word
the word being waited on, a kernel virtual address
bit
the bit of the word being waited on
There is a standard hashed waitqueue table for generic use. This
is the part of the hashtable's accessor API that wakes up waiters
on a bit. For instance, if one were to have waiters on a bitflag,
one would call wake_up_bit
after clearing the bit.
In order for this to function properly, as it uses waitqueue_active
internally, some kind of memory barrier must be done prior to calling
this. Typically, this will be smp_mb__after_clear_bit
, but in some
cases where bitflags are manipulated non-atomically under a lock, one
may need to use a less regular barrier, such fs/inode.c's smp_mb
,
because spin_unlock
does not guarantee a memory barrier.
ktime_set — Set a ktime_t variable from a seconds/nanoseconds value
ktime_t fsfuncktime_set ( | secs, | |
nsecs) ; |
const long secs
;const unsigned long nsecs
;ktime_sub — subtract two ktime_t variables
ktime_t fsfuncktime_sub ( | lhs, | |
rhs) ; |
const ktime_t lhs
;const ktime_t rhs
;ktime_add — add two ktime_t variables
ktime_t fsfuncktime_add ( | add1, | |
add2) ; |
const ktime_t add1
;const ktime_t add2
;timespec_to_ktime — convert a timespec to ktime_t format
ktime_t fsfunctimespec_to_ktime ( | ts) ; |
const struct timespec ts
;timeval_to_ktime — convert a timeval to ktime_t format
ktime_t fsfunctimeval_to_ktime ( | tv) ; |
const struct timeval tv
;ktime_to_timespec — convert a ktime_t variable to timespec format
struct timespec fsfuncktime_to_timespec ( | kt) ; |
const ktime_t kt
;ktime_to_timeval — convert a ktime_t variable to timeval format
struct timeval fsfuncktime_to_timeval ( | kt) ; |
const ktime_t kt
;ktime_to_ns — convert a ktime_t variable to scalar nanoseconds
s64 fsfuncktime_to_ns ( | kt) ; |
const ktime_t kt
;ktime_equal — Compares two ktime_t variables to see if they are equal
int fsfuncktime_equal ( | cmp1, | |
cmp2) ; |
const ktime_t cmp1
;const ktime_t cmp2
;ktime_compare — Compares two ktime_t variables for less, greater or equal
int fsfuncktime_compare ( | cmp1, | |
cmp2) ; |
const ktime_t cmp1
;const ktime_t cmp2
;ktime_to_timespec_cond — convert a ktime_t variable to timespec format only if the variable contains data
bool fsfuncktime_to_timespec_cond ( | kt, | |
ts) ; |
const ktime_t kt
;struct timespec * ts
;struct hrtimer — the basic hrtimer structure
struct hrtimer { struct timerqueue_node node; ktime_t _softexpires; enum hrtimer_restart (* function) (struct hrtimer *); struct hrtimer_clock_base * base; unsigned long state; #ifdef CONFIG_TIMER_STATS int start_pid; void * start_site; char start_comm[16]; #endif };
timerqueue node, which also manages node.expires, the absolute expiry time in the hrtimers internal representation. The time is related to the clock on which the timer is based. Is setup by adding slack to the _softexpires value. For non range timers identical to _softexpires.
the absolute earliest expiry time of the hrtimer. The time which was given as expiry time when the timer was armed.
timer expiry callback function
pointer to the timer base (per cpu and per clock)
state information (See bit values above)
timer statistics field to store the pid of the task which started the timer
timer statistics field to store the site where the timer was started
timer statistics field to store the name of the process which started the timer
struct hrtimer_sleeper — simple sleeper structure
struct hrtimer_sleeper { struct hrtimer timer; struct task_struct * task; };
struct hrtimer_clock_base — the timer base for a specific clock
struct hrtimer_clock_base { struct hrtimer_cpu_base * cpu_base; int index; clockid_t clockid; struct timerqueue_head active; ktime_t resolution; ktime_t (* get_time) (void); ktime_t softirq_time; ktime_t offset; };
per cpu clock base
clock type index for per_cpu support when moving a timer to a base on another cpu.
clock id for per_cpu support
red black tree root node for the active timers
the resolution of the clock, in nanoseconds
function to retrieve the current time of the clock
the time when running the hrtimer queue in the softirq
offset of this clock to the monotonic base
ktime_add_ns — Add a scalar nanoseconds value to a ktime_t variable
ktime_t fsfuncktime_add_ns ( | kt, | |
nsec) ; |
const ktime_t kt
;u64 nsec
;ktime_sub_ns — Subtract a scalar nanoseconds value from a ktime_t variable
ktime_t fsfuncktime_sub_ns ( | kt, | |
nsec) ; |
const ktime_t kt
;u64 nsec
;hrtimer_forward — forward the timer expiry
u64 fsfunchrtimer_forward ( | timer, | |
now, | ||
interval) ; |
struct hrtimer * timer
;ktime_t now
;ktime_t interval
;hrtimer_start_range_ns — (re)start an hrtimer on the current CPU
int fsfunchrtimer_start_range_ns ( | timer, | |
tim, | ||
delta_ns, | ||
mode) ; |
struct hrtimer * timer
;ktime_t tim
;unsigned long delta_ns
;const enum hrtimer_mode mode
;hrtimer_start — (re)start an hrtimer on the current CPU
int fsfunchrtimer_start ( | timer, | |
tim, | ||
mode) ; |
struct hrtimer * timer
;ktime_t tim
;const enum hrtimer_mode mode
;hrtimer_try_to_cancel — try to deactivate a timer
int fsfunchrtimer_try_to_cancel ( | timer) ; |
struct hrtimer * timer
;hrtimer_cancel — cancel a timer and wait for the handler to finish.
int fsfunchrtimer_cancel ( | timer) ; |
struct hrtimer * timer
;hrtimer_get_remaining — get remaining time for the timer
ktime_t fsfunchrtimer_get_remaining ( | timer) ; |
const struct hrtimer * timer
;hrtimer_init — initialize a timer to the given clock
void fsfunchrtimer_init ( | timer, | |
clock_id, | ||
mode) ; |
struct hrtimer * timer
;clockid_t clock_id
;enum hrtimer_mode mode
;hrtimer_get_res — get the timer resolution for a clock
int fsfunchrtimer_get_res ( | which_clock, | |
tp) ; |
const clockid_t which_clock
;struct timespec * tp
;schedule_hrtimeout_range — sleep until timeout
int __sched fsfuncschedule_hrtimeout_range ( | expires, | |
delta, | ||
mode) ; |
ktime_t * expires
;unsigned long delta
;const enum hrtimer_mode mode
;expires
timeout value (ktime_t)
delta
slack in expires timeout (ktime_t)
mode
timer mode, HRTIMER_MODE_ABS or HRTIMER_MODE_REL
Make the current task sleep until the given expiry time has
elapsed. The routine will return immediately unless
the current task state has been set (see set_current_state
).
The delta
argument gives the kernel the freedom to schedule the
actual wakeup to a time that is both power and performance friendly.
The kernel give the normal best effort behavior for “expires
+delta
”,
but may decide to fire the timer earlier, but no earlier than expires
.
You can set the task state as follows -
TASK_UNINTERRUPTIBLE
- at least timeout
time is guaranteed to
pass before the routine returns.
TASK_INTERRUPTIBLE
- the routine may return early if a signal is
delivered to the current task.
The current task state is guaranteed to be TASK_RUNNING when this routine returns.
Returns 0 when the timer has expired otherwise -EINTR
schedule_hrtimeout — sleep until timeout
int __sched fsfuncschedule_hrtimeout ( | expires, | |
mode) ; |
ktime_t * expires
;const enum hrtimer_mode mode
;
Make the current task sleep until the given expiry time has
elapsed. The routine will return immediately unless
the current task state has been set (see set_current_state
).
You can set the task state as follows -
TASK_UNINTERRUPTIBLE
- at least timeout
time is guaranteed to
pass before the routine returns.
TASK_INTERRUPTIBLE
- the routine may return early if a signal is
delivered to the current task.
The current task state is guaranteed to be TASK_RUNNING when this routine returns.
Returns 0 when the timer has expired otherwise -EINTR
queue_work_on — queue work on specific cpu
bool fsfuncqueue_work_on ( | cpu, | |
wq, | ||
work) ; |
int cpu
;struct workqueue_struct * wq
;struct work_struct * work
;queue_delayed_work_on — queue work on specific CPU after delay
bool fsfuncqueue_delayed_work_on ( | cpu, | |
wq, | ||
dwork, | ||
delay) ; |
int cpu
;struct workqueue_struct * wq
;struct delayed_work * dwork
;unsigned long delay
;mod_delayed_work_on — modify delay of or queue a delayed work on specific CPU
bool fsfuncmod_delayed_work_on ( | cpu, | |
wq, | ||
dwork, | ||
delay) ; |
int cpu
;struct workqueue_struct * wq
;struct delayed_work * dwork
;unsigned long delay
;cpu
CPU number to execute work on
wq
workqueue to use
dwork
work to queue
delay
number of jiffies to wait before queueing
flush_workqueue — ensure that any scheduled work has run to completion.
void fsfuncflush_workqueue ( | wq) ; |
struct workqueue_struct * wq
;drain_workqueue — drain a workqueue
void fsfuncdrain_workqueue ( | wq) ; |
struct workqueue_struct * wq
;
Wait until the workqueue becomes empty. While draining is in progress,
only chain queueing is allowed. IOW, only currently pending or running
work items on wq
can queue further work items on it. wq
is flushed
repeatedly until it becomes empty. The number of flushing is detemined
by the depth of chaining and should be relatively short. Whine if it
takes too long.
flush_work — wait for a work to finish executing the last queueing instance
bool fsfuncflush_work ( | work) ; |
struct work_struct * work
;cancel_work_sync — cancel a work and wait for it to finish
bool fsfunccancel_work_sync ( | work) ; |
struct work_struct * work
;
Cancel work
and wait for its execution to finish. This function
can be used even if the work re-queues itself or migrates to
another workqueue. On return from this function, work
is
guaranteed to be not pending or executing on any CPU.
cancel_work_sync(delayed_work->work) must not be used for
delayed_work's. Use cancel_delayed_work_sync
instead.
The caller must ensure that the workqueue on which work
was last
queued can't be destroyed before this function returns.
flush_delayed_work — wait for a dwork to finish executing the last queueing
bool fsfuncflush_delayed_work ( | dwork) ; |
struct delayed_work * dwork
;cancel_delayed_work — cancel a delayed work
bool fsfunccancel_delayed_work ( | dwork) ; |
struct delayed_work * dwork
;cancel_delayed_work_sync — cancel a delayed work and wait for it to finish
bool fsfunccancel_delayed_work_sync ( | dwork) ; |
struct delayed_work * dwork
;flush_scheduled_work — ensure that any scheduled work has run to completion.
void fsfuncflush_scheduled_work ( | void) ; |
void
;
Forces execution of the kernel-global workqueue and blocks until its completion.
Think twice before calling this function! It's very easy to get into trouble if you don't take great care. Either of the following situations
One of the work items currently on the workqueue needs to acquire a lock held by your code or its caller.
Your code is running in the context of a work routine.
They will be detected by lockdep when they occur, but the first might not occur very often. It depends on what work items are on the workqueue and what locks they need, which you have no control over.
In most situations flushing the entire workqueue is overkill; you merely
need to know that a particular work item isn't queued and isn't running.
In such cases you should use cancel_delayed_work_sync
or
cancel_work_sync
instead.
execute_in_process_context — reliably execute the routine with user context
int fsfuncexecute_in_process_context ( | fn, | |
ew) ; |
work_func_t fn
;struct execute_work * ew
;fn
the function to execute
ew
guaranteed storage for the execute work structure (must be available when the work executes)
destroy_workqueue — safely terminate a workqueue
void fsfuncdestroy_workqueue ( | wq) ; |
struct workqueue_struct * wq
;workqueue_set_max_active — adjust max_active of a workqueue
void fsfuncworkqueue_set_max_active ( | wq, | |
max_active) ; |
struct workqueue_struct * wq
;int max_active
;workqueue_congested — test whether a workqueue is congested
bool fsfuncworkqueue_congested ( | cpu, | |
wq) ; |
int cpu
;struct workqueue_struct * wq
;
Test whether wq
's cpu workqueue for cpu
is congested. There is
no synchronization around this function and the test result is
unreliable and only useful as advisory hints or for debugging.
If cpu
is WORK_CPU_UNBOUND, the test is performed on the local CPU.
Note that both per-cpu and unbound workqueues may be associated with
multiple pool_workqueues which have separate congested states. A
workqueue being congested on one CPU doesn't mean the workqueue is also
contested on other CPUs / NUMA nodes.
work_busy — test whether a work is currently pending or running
unsigned int fsfuncwork_busy ( | work) ; |
struct work_struct * work
;work_on_cpu — run a function in user context on a particular cpu
long fsfuncwork_on_cpu ( | cpu, | |
fn, | ||
arg) ; |
int cpu
;long (*fn)
(
void *)
;void * arg
;wait_task_stopped —
Wait for TASK_STOPPED
or TASK_TRACED
int fsfuncwait_task_stopped ( | wo, | |
ptrace, | ||
p) ; |
struct wait_opts * wo
;int ptrace
;struct task_struct * p
;task_set_jobctl_pending — set jobctl pending bits
bool fsfunctask_set_jobctl_pending ( | task, | |
mask) ; |
struct task_struct * task
;unsigned int mask
;task_clear_jobctl_trapping — clear jobctl trapping bit
void fsfunctask_clear_jobctl_trapping ( | task) ; |
struct task_struct * task
;task_clear_jobctl_pending — clear jobctl pending bits
void fsfunctask_clear_jobctl_pending ( | task, | |
mask) ; |
struct task_struct * task
;unsigned int mask
;task_participate_group_stop — participate in a group stop
bool fsfunctask_participate_group_stop ( | task) ; |
struct task_struct * task
;ptrace_trap_notify — schedule trap to notify ptracer
void fsfuncptrace_trap_notify ( | t) ; |
struct task_struct * t
;
This function schedules sticky ptrace trap which is cleared on the next
TRAP_STOP to notify ptracer of an event. t
must have been seized by
ptracer.
If t
is running, STOP trap will be taken. If trapped for STOP and
ptracer is listening for events, tracee is woken up so that it can
re-trap for the new event. If trapped otherwise, STOP trap will be
eventually taken without returning to userland after the existing traps
are finished by PTRACE_CONT.
do_notify_parent_cldstop — notify parent of stopped/continued state change
void fsfuncdo_notify_parent_cldstop ( | tsk, | |
for_ptracer, | ||
why) ; |
struct task_struct * tsk
;bool for_ptracer
;int why
;tsk
task reporting the state change
for_ptracer
the notification is for ptracer
why
CLD_{CONTINUED|STOPPED|TRAPPED} to report
do_signal_stop — handle group stop for SIGSTOP and other stop signals
bool fsfuncdo_signal_stop ( | signr) ; |
int signr
;
If JOBCTL_STOP_PENDING
is not set yet, initiate group stop with signr
and participate in it. If already set, participate in the existing
group stop. If participated in a group stop (and thus slept), true
is
returned with siglock released.
If ptraced, this function doesn't handle stop itself. Instead,
JOBCTL_TRAP_STOP
is scheduled and false
is returned with siglock
untouched. The caller must ensure that INTERRUPT trap handling takes
places afterwards.
do_jobctl_trap — take care of ptrace jobctl traps
void fsfuncdo_jobctl_trap ( | void) ; |
void
;
When PT_SEIZED, it's used for both group stop and explicit
SEIZE/INTERRUPT traps. Both generate PTRACE_EVENT_STOP trap with
accompanying siginfo. If stopped, lower eight bits of exit_code contain
the stop signal; otherwise, SIGTRAP
.
When !PT_SEIZED, it's used only for group stop trap with stop signal number as exit_code and no siginfo.
signal_delivered —
void fsfuncsignal_delivered ( | sig, | |
info, | ||
ka, | ||
regs, | ||
stepping) ; |
int sig
;siginfo_t * info
;struct k_sigaction * ka
;struct pt_regs * regs
;int stepping
;sys_restart_syscall — restart a system call
long fsfuncsys_restart_syscall ( | void) ; |
void
;set_current_blocked — change current->blocked mask
void fsfuncset_current_blocked ( | newset) ; |
sigset_t * newset
;sys_rt_sigprocmask — change the list of currently blocked signals
long fsfuncsys_rt_sigprocmask ( | how, | |
nset, | ||
oset, | ||
sigsetsize) ; |
int how
;sigset_t __user * nset
;sigset_t __user * oset
;size_t sigsetsize
;sys_rt_sigpending — examine a pending signal that has been raised while blocked
long fsfuncsys_rt_sigpending ( | uset, | |
sigsetsize) ; |
sigset_t __user * uset
;size_t sigsetsize
;do_sigtimedwait —
wait for queued signals specified in which
int fsfuncdo_sigtimedwait ( | which, | |
info, | ||
ts) ; |
const sigset_t * which
;siginfo_t * info
;const struct timespec * ts
;sys_rt_sigtimedwait —
synchronously wait for queued signals specified in uthese
long fsfuncsys_rt_sigtimedwait ( | uthese, | |
uinfo, | ||
uts, | ||
sigsetsize) ; |
const sigset_t __user * uthese
;siginfo_t __user * uinfo
;const struct timespec __user * uts
;size_t sigsetsize
;sys_kill — send a signal to a process
long fsfuncsys_kill ( | pid, | |
sig) ; |
pid_t pid
;int sig
;sys_tgkill — send signal to one specific thread
long fsfuncsys_tgkill ( | tgid, | |
pid, | ||
sig) ; |
pid_t tgid
;pid_t pid
;int sig
;sys_tkill — send signal to one specific task
long fsfuncsys_tkill ( | pid, | |
sig) ; |
pid_t pid
;int sig
;sys_rt_sigqueueinfo — send signal information to a signal
long fsfuncsys_rt_sigqueueinfo ( | pid, | |
sig, | ||
uinfo) ; |
pid_t pid
;int sig
;siginfo_t __user * uinfo
;sys_sigpending — examine pending signals
long fsfuncsys_sigpending ( | set) ; |
old_sigset_t __user * set
;sys_sigprocmask — examine and change blocked signals
long fsfuncsys_sigprocmask ( | how, | |
nset, | ||
oset) ; |
int how
;old_sigset_t __user * nset
;old_sigset_t __user * oset
;sys_rt_sigaction — alter an action taken by a process
long fsfuncsys_rt_sigaction ( | sig, | |
act, | ||
oact, | ||
sigsetsize) ; |
int sig
;const struct sigaction __user * act
;struct sigaction __user * oact
;size_t sigsetsize
;sys_rt_sigsuspend —
replace the signal mask for a value with the unewset
value until a signal is received
long fsfuncsys_rt_sigsuspend ( | unewset, | |
sigsetsize) ; |
sigset_t __user * unewset
;size_t sigsetsize
;kthread_run — create and wake a thread.
fsfunckthread_run ( | threadfn, | |
data, | ||
namefmt, | ||
...) ; |
threadfn
; data
; namefmt
; ...
;kthread_should_stop — should this kthread return now?
bool fsfunckthread_should_stop ( | void) ; |
void
;kthread_freezable_should_stop — should this freezable kthread return now?
bool fsfunckthread_freezable_should_stop ( | was_frozen) ; |
bool * was_frozen
;kthread_create_on_node — create a kthread.
struct task_struct * fsfunckthread_create_on_node ( | threadfn, | |
data, | ||
node, | ||
namefmt[], | ||
...) ; |
int (*threadfn)
(
void *data)
;void * data
;int node
;const char namefmt[]
; ...
;threadfn
the function to run until signal_pending(current).
data
data ptr for threadfn
.
node
memory node number.
namefmt[]
printf-style name for the thread.
...
variable arguments
This helper function creates and names a kernel
thread. The thread will be stopped: use wake_up_process
to start
it. See also kthread_run
.
If thread is going to be bound on a particular cpu, give its node
in node
, to get NUMA affinity for kthread stack, or else give -1.
When woken, the thread will run threadfn
() with data
as its
argument. threadfn
() can either call do_exit
directly if it is a
standalone thread for which no one will call kthread_stop
, or
return when 'kthread_should_stop
' is true (which means
kthread_stop
has been called). The return value should be zero
or a negative error number; it will be passed to kthread_stop
.
Returns a task_struct or ERR_PTR(-ENOMEM).
kthread_bind — bind a just-created kthread to a cpu.
void fsfunckthread_bind ( | p, | |
cpu) ; |
struct task_struct * p
;unsigned int cpu
;kthread_stop —
stop a thread created by kthread_create
.
int fsfunckthread_stop ( | k) ; |
struct task_struct * k
;
Sets kthread_should_stop
for k
to return true, wakes it, and
waits for it to exit. This can also be called after kthread_create
instead of calling wake_up_process
: the thread will exit without
calling threadfn
.
If threadfn
may call do_exit
itself, the caller must ensure
task_struct can't go away.
Returns the result of threadfn
, or -EINTR
if wake_up_process
was never called.
kthread_worker_fn — kthread function to process kthread_worker
int fsfunckthread_worker_fn ( | worker_ptr) ; |
void * worker_ptr
;
This function can be used as threadfn
to kthread_create
or
kthread_run
with worker_ptr
argument pointing to an initialized
kthread_worker. The started kthread will process work_list until
the it is stopped with kthread_stop
. A kthread can also call
this function directly after extra initialization.
Different kthreads can be used for the same kthread_worker as long as there's only one kthread attached to it at any given time. A kthread_worker without an attached kthread simply collects queued kthread_works.
queue_kthread_work — queue a kthread_work
bool fsfuncqueue_kthread_work ( | worker, | |
work) ; |
struct kthread_worker * worker
;struct kthread_work * work
;kobject_get_path — generate and return the path associated with a given kobj and kset pair.
char * fsfunckobject_get_path ( | kobj, | |
gfp_mask) ; |
struct kobject * kobj
;gfp_t gfp_mask
;kobject_set_name — Set the name of a kobject
int fsfunckobject_set_name ( | kobj, | |
fmt, | ||
...) ; |
struct kobject * kobj
;const char * fmt
; ...
;kobject_init — initialize a kobject structure
void fsfunckobject_init ( | kobj, | |
ktype) ; |
struct kobject * kobj
;struct kobj_type * ktype
;kobject_add — the main kobject add function
int fsfunckobject_add ( | kobj, | |
parent, | ||
fmt, | ||
...) ; |
struct kobject * kobj
;struct kobject * parent
;const char * fmt
; ...
;kobj
the kobject to add
parent
pointer to the parent of the kobject.
fmt
format to name the kobject with.
...
variable arguments
The kobject name is set and added to the kobject hierarchy in this function.
If parent
is set, then the parent of the kobj
will be set to it.
If parent
is NULL, then the parent of the kobj
will be set to the
kobject associted with the kset assigned to this kobject. If no kset
is assigned to the kobject, then the kobject will be located in the
root of the sysfs tree.
If this function returns an error, kobject_put
must be called to
properly clean up the memory associated with the object.
Under no instance should the kobject that is passed to this function
be directly freed with a call to kfree
, that can leak memory.
Note, no “add” uevent will be created with this call, the caller should set
up all of the necessary sysfs files for the object and then call
kobject_uevent
with the UEVENT_ADD parameter to ensure that
userspace is properly notified of this kobject's creation.
kobject_init_and_add — initialize a kobject structure and add it to the kobject hierarchy
int fsfunckobject_init_and_add ( | kobj, | |
ktype, | ||
parent, | ||
fmt, | ||
...) ; |
struct kobject * kobj
;struct kobj_type * ktype
;struct kobject * parent
;const char * fmt
; ...
;kobject_rename — change the name of an object
int fsfunckobject_rename ( | kobj, | |
new_name) ; |
struct kobject * kobj
;const char * new_name
;kobject_del — unlink kobject from hierarchy.
void fsfunckobject_del ( | kobj) ; |
struct kobject * kobj
;kobject_get — increment refcount for object.
struct kobject * fsfunckobject_get ( | kobj) ; |
struct kobject * kobj
;kobject_put — decrement refcount for object.
void fsfunckobject_put ( | kobj) ; |
struct kobject * kobj
;kobject_create_and_add — create a struct kobject dynamically and register it with sysfs
struct kobject * fsfunckobject_create_and_add ( | name, | |
parent) ; |
const char * name
;struct kobject * parent
;kset_register — initialize and add a kset.
int fsfunckset_register ( | k) ; |
struct kset * k
;kset_create_and_add — create a struct kset dynamically and add it to sysfs
struct kset * fsfunckset_create_and_add ( | name, | |
uevent_ops, | ||
parent_kobj) ; |
const char * name
;const struct kset_uevent_ops * uevent_ops
;struct kobject * parent_kobj
;kstrtoul — convert a string to an unsigned long
int fsfunckstrtoul ( | s, | |
base, | ||
res) ; |
const char * s
;unsigned int base
;unsigned long * res
;s
The start of the string. The string must be null-terminated, and may also include a single newline before its terminating null. The first character may also be a plus sign, but not a minus sign.
base
The number base to use. The maximum supported base is 16. If base is given as 0, then the base of the string is automatically detected with the conventional semantics - If it begins with 0x the number will be parsed as a hexadecimal (case insensitive), if it otherwise begins with 0, it will be parsed as an octal number. Otherwise it will be parsed as a decimal.
res
Where to write the result of the conversion on success.
kstrtol — convert a string to a long
int fsfunckstrtol ( | s, | |
base, | ||
res) ; |
const char * s
;unsigned int base
;long * res
;s
The start of the string. The string must be null-terminated, and may also include a single newline before its terminating null. The first character may also be a plus sign or a minus sign.
base
The number base to use. The maximum supported base is 16. If base is given as 0, then the base of the string is automatically detected with the conventional semantics - If it begins with 0x the number will be parsed as a hexadecimal (case insensitive), if it otherwise begins with 0, it will be parsed as an octal number. Otherwise it will be parsed as a decimal.
res
Where to write the result of the conversion on success.
trace_printk — printf formatting in the ftrace buffer
fsfunctrace_printk ( | fmt, | |
...) ; |
fmt
; ...
;
__trace_printk is an internal function for trace_printk and
the ip
is passed in via the trace_printk macro.
This function allows a kernel developer to debug fast path sections that printk is not appropriate for. By scattering in various printk like tracing in the code, a developer can quickly see where problems are occurring.
This is intended as a debugging tool for the developer only.
Please refrain from leaving trace_printks scattered around in
your code. (Extra memory is used for special buffers that are
allocated when trace_printk
is used)
A little optization trick is done here. If there's only one
argument, there's no need to scan the string for printf formats.
The trace_puts
will suffice. But how can we take advantage of
using trace_puts
when trace_printk
has only one argument?
By stringifying the args and checking the size we can tell
whether or not there are args. __stringify((__VA_ARGS__)) will
turn into “()\0” with a size of 3 when there are no args, anything
else will be bigger. All we need to do is define a string to this,
and then take its size and compare to 3. If it's bigger, use
do_trace_printk
otherwise, optimize it to trace_puts
. Then just
let gcc optimize the rest.
trace_puts — write a string into the ftrace buffer
fsfunctrace_puts ( | str) ; |
str
;
__trace_bputs is an internal function for trace_puts and
the ip
is passed in via the trace_puts macro.
This is similar to trace_printk
but is made for those really fast
paths that a developer wants the least amount of “Heisenbug” affects,
where the processing of the print format is still too much.
This function allows a kernel developer to debug fast path sections that printk is not appropriate for. By scattering in various printk like tracing in the code, a developer can quickly see where problems are occurring.
This is intended as a debugging tool for the developer only.
Please refrain from leaving trace_puts scattered around in
your code. (Extra memory is used for special buffers that are
allocated when trace_puts
is used)
min_not_zero — return the minimum that is _not_ zero, unless both are zero
fsfuncmin_not_zero ( | x, | |
y) ; |
x
; y
;clamp — return a value clamped to a given range with strict typechecking
fsfuncclamp ( | val, | |
min, | ||
max) ; |
val
; min
; max
;clamp_t — return a value clamped to a given range using a given type
fsfuncclamp_t ( | type, | |
val, | ||
min, | ||
max) ; |
type
; val
; min
; max
;clamp_val — return a value clamped to a given range using val's type
fsfuncclamp_val ( | val, | |
min, | ||
max) ; |
val
; min
; max
;container_of — cast a member of a structure out to the containing structure
fsfunccontainer_of ( | ptr, | |
type, | ||
member) ; |
ptr
; type
; member
;printk — print a kernel message
int fsfuncprintk ( | fmt, | |
...) ; |
const char * fmt
; ...
;
This is printk
. It can be called from any context. We want it to work.
We try to grab the console_lock. If we succeed, it's easy - we log the
output and call the console drivers. If we fail to get the semaphore, we
place the output into the log buffer and return. The current holder of
the console_sem will notice the new output in console_unlock
; and will
send it to the consoles before releasing the lock.
One effect of this deferred printing is that code which calls printk
and
then changes console_loglevel may break. This is because console_loglevel
is inspected when the actual printing occurs.
console_lock — lock the console system for exclusive use.
void fsfuncconsole_lock ( | void) ; |
void
;console_trylock — try to lock the console system for exclusive use.
int fsfuncconsole_trylock ( | void) ; |
void
;console_unlock — unlock the console system
void fsfuncconsole_unlock ( | void) ; |
void
;
Releases the console_lock which the caller holds on the console system and the console driver list.
While the console_lock was held, console output may have been buffered
by printk
. If this is the case, console_unlock
; emits
the output prior to releasing the lock.
If there is output waiting, we wake /dev/kmsg and syslog
users.
console_unlock
; may be called from any context.
console_conditional_schedule — yield the CPU if required
void __sched fsfuncconsole_conditional_schedule ( | void) ; |
void
;printk_timed_ratelimit — caller-controlled printk ratelimiting
bool fsfuncprintk_timed_ratelimit ( | caller_jiffies, | |
interval_msecs) ; |
unsigned long * caller_jiffies
;unsigned int interval_msecs
;kmsg_dump_register — register a kernel log dumper.
int fsfunckmsg_dump_register ( | dumper) ; |
struct kmsg_dumper * dumper
;kmsg_dump_unregister — unregister a kmsg dumper.
int fsfunckmsg_dump_unregister ( | dumper) ; |
struct kmsg_dumper * dumper
;kmsg_dump_get_line — retrieve one kmsg log line
bool fsfunckmsg_dump_get_line ( | dumper, | |
syslog, | ||
line, | ||
size, | ||
len) ; |
struct kmsg_dumper * dumper
;bool syslog
;char * line
;size_t size
;size_t * len
;dumper
registered kmsg dumper
syslog
include the “<4>” prefixes
line
buffer to copy the line to
size
maximum size of the buffer
len
length of line placed into buffer
Start at the beginning of the kmsg buffer, with the oldest kmsg record, and copy one record into the provided buffer.
Consecutive calls will return the next available record moving towards the end of the buffer with the youngest messages.
A return value of FALSE indicates that there are no more records to read.
kmsg_dump_get_buffer — copy kmsg log lines
bool fsfunckmsg_dump_get_buffer ( | dumper, | |
syslog, | ||
buf, | ||
size, | ||
len) ; |
struct kmsg_dumper * dumper
;bool syslog
;char * buf
;size_t size
;size_t * len
;dumper
registered kmsg dumper
syslog
include the “<4>” prefixes
buf
buffer to copy the line to
size
maximum size of the buffer
len
length of line placed into buffer
Start at the end of the kmsg buffer and fill the provided buffer with as many of the the *youngest* kmsg records that fit into it. If the buffer is large enough, all available kmsg records will be copied with a single call.
Consecutive calls will fill the buffer with the next block of available older records, not including the earlier retrieved ones.
A return value of FALSE indicates that there are no more records to read.
kmsg_dump_rewind — reset the interator
void fsfunckmsg_dump_rewind ( | dumper) ; |
struct kmsg_dumper * dumper
;add_taint —
void fsfuncadd_taint ( | flag, | |
lockdep_ok) ; |
unsigned flag
;enum lockdep_ok lockdep_ok
;rcu_read_lock_bh_held — might we be in RCU-bh read-side critical section?
int fsfuncrcu_read_lock_bh_held ( | void) ; |
void
;
Check for bottom half being disabled, which covers both the
CONFIG_PROVE_RCU and not cases. Note that if someone uses
rcu_read_lock_bh
, but then later enables BH, lockdep (if enabled)
will show the situation. This is useful for debug checks in functions
that require that they be called within an RCU read-side critical
section.
Check debug_lockdep_rcu_enabled
to prevent false positives during boot.
Note that rcu_read_lock
is disallowed if the CPU is either idle or
offline from an RCU perspective, so check for those as well.
init_rcu_head_on_stack — initialize on-stack rcu_head for debugobjects
void fsfuncinit_rcu_head_on_stack ( | head) ; |
struct rcu_head * head
;This function informs debugobjects of a new rcu_head structure that has been allocated as an auto variable on the stack. This function is not required for rcu_head structures that are statically defined or that are dynamically allocated on the heap. This function has no effect for !CONFIG_DEBUG_OBJECTS_RCU_HEAD kernel builds.
destroy_rcu_head_on_stack — destroy on-stack rcu_head for debugobjects
void fsfuncdestroy_rcu_head_on_stack ( | head) ; |
struct rcu_head * head
;
This function informs debugobjects that an on-stack rcu_head structure
is about to go out of scope. As with init_rcu_head_on_stack
, this
function is not required for rcu_head structures that are statically
defined or that are dynamically allocated on the heap. Also as with
init_rcu_head_on_stack
, this function has no effect for
!CONFIG_DEBUG_OBJECTS_RCU_HEAD kernel builds.
devres_alloc — Allocate device resource data
void * fsfuncdevres_alloc ( | release, | |
size, | ||
gfp) ; |
dr_release_t release
;size_t size
;gfp_t gfp
;release
Release function devres will be associated with
size
Allocation size
gfp
Allocation flags
devres_for_each_res — Resource iterator
void fsfuncdevres_for_each_res ( | dev, | |
release, | ||
match, | ||
match_data, | ||
fn, | ||
data) ; |
struct device * dev
;dr_release_t release
;dr_match_t match
;void * match_data
;void (*fn)
(
struct device *, void *, void *)
;void * data
;dev
Device to iterate resource from
release
Look for resources associated with this release function
match
Match function (optional)
match_data
Data for the match function
fn
Function to be called for each matched resource.
data
Data for fn
, the 3rd parameter of fn
devres_add — Register device resource
void fsfuncdevres_add ( | dev, | |
res) ; |
struct device * dev
;void * res
;devres_find — Find device resource
void * fsfuncdevres_find ( | dev, | |
release, | ||
match, | ||
match_data) ; |
struct device * dev
;dr_release_t release
;dr_match_t match
;void * match_data
;dev
Device to lookup resource from
release
Look for resources associated with this release function
match
Match function (optional)
match_data
Data for the match function
devres_get — Find devres, if non-existent, add one atomically
void * fsfuncdevres_get ( | dev, | |
new_res, | ||
match, | ||
match_data) ; |
struct device * dev
;void * new_res
;dr_match_t match
;void * match_data
;dev
Device to lookup or add devres for
new_res
Pointer to new initialized devres to add if not found
match
Match function (optional)
match_data
Data for the match function
devres_remove — Find a device resource and remove it
void * fsfuncdevres_remove ( | dev, | |
release, | ||
match, | ||
match_data) ; |
struct device * dev
;dr_release_t release
;dr_match_t match
;void * match_data
;dev
Device to find resource from
release
Look for resources associated with this release function
match
Match function (optional)
match_data
Data for the match function
devres_destroy — Find a device resource and destroy it
int fsfuncdevres_destroy ( | dev, | |
release, | ||
match, | ||
match_data) ; |
struct device * dev
;dr_release_t release
;dr_match_t match
;void * match_data
;dev
Device to find resource from
release
Look for resources associated with this release function
match
Match function (optional)
match_data
Data for the match function
Find the latest devres of dev
associated with release
and for
which match
returns 1. If match
is NULL, it's considered to
match all. If found, the resource is removed atomically and freed.
Note that the release function for the resource will not be called, only the devres-allocated data will be freed. The caller becomes responsible for freeing any other data.
devres_release — Find a device resource and destroy it, calling release
int fsfuncdevres_release ( | dev, | |
release, | ||
match, | ||
match_data) ; |
struct device * dev
;dr_release_t release
;dr_match_t match
;void * match_data
;dev
Device to find resource from
release
Look for resources associated with this release function
match
Match function (optional)
match_data
Data for the match function
devres_open_group — Open a new devres group
void * fsfuncdevres_open_group ( | dev, | |
id, | ||
gfp) ; |
struct device * dev
;void * id
;gfp_t gfp
;devres_close_group — Close a devres group
void fsfuncdevres_close_group ( | dev, | |
id) ; |
struct device * dev
;void * id
;devres_remove_group — Remove a devres group
void fsfuncdevres_remove_group ( | dev, | |
id) ; |
struct device * dev
;void * id
;devres_release_group — Release resources in a devres group
int fsfuncdevres_release_group ( | dev, | |
id) ; |
struct device * dev
;void * id
;devm_add_action — add a custom action to list of managed resources
int fsfuncdevm_add_action ( | dev, | |
action, | ||
data) ; |
struct device * dev
;void (*action)
(
void *)
;void * data
;devm_remove_action — removes previously added custom action
void fsfuncdevm_remove_action ( | dev, | |
action, | ||
data) ; |
struct device * dev
;void (*action)
(
void *)
;void * data
;devm_kzalloc — Resource-managed kzalloc
void * fsfuncdevm_kzalloc ( | dev, | |
size, | ||
gfp) ; |
struct device * dev
;size_t size
;gfp_t gfp
;Table of Contents
struct bus_type — The bus type of the device
struct bus_type { const char * name; const char * dev_name; struct device * dev_root; struct bus_attribute * bus_attrs; struct device_attribute * dev_attrs; struct driver_attribute * drv_attrs; const struct attribute_group ** bus_groups; const struct attribute_group ** dev_groups; const struct attribute_group ** drv_groups; int (* match) (struct device *dev, struct device_driver *drv); int (* uevent) (struct device *dev, struct kobj_uevent_env *env); int (* probe) (struct device *dev); int (* remove) (struct device *dev); void (* shutdown) (struct device *dev); int (* online) (struct device *dev); int (* offline) (struct device *dev); int (* suspend) (struct device *dev, pm_message_t state); int (* resume) (struct device *dev); const struct dev_pm_ops * pm; struct iommu_ops * iommu_ops; struct subsys_private * p; struct lock_class_key lock_key; };
The name of the bus.
Used for subsystems to enumerate devices like (“foou
”, dev->id).
Default device to use as the parent.
Default attributes of the bus.
Default attributes of the devices on the bus.
Default attributes of the device drivers on the bus.
Default attributes of the bus.
Default attributes of the devices on the bus.
Default attributes of the device drivers on the bus.
Called, perhaps multiple times, whenever a new device or driver is added for this bus. It should return a nonzero value if the given device can be handled by the given driver.
Called when a device is added, removed, or a few other things that generate uevents to add the environment variables.
Called when a new device or driver add to this bus, and callback the specific driver's probe to initial the matched device.
Called when a device removed from this bus.
Called at shut-down time to quiesce the device.
Called to put the device back online (after offlining it).
Called to put the device offline for hot-removal. May fail.
Called when a device on this bus wants to go to sleep mode.
Called to bring a device on this bus out of sleep mode.
Power management operations of this bus, callback the specific device driver's pm-ops.
IOMMU specific operations for this bus, used to attach IOMMU driver implementations to a bus and allow the driver to do bus-specific setup
The private data of the driver core, only the driver core can touch this.
Lock class key for use by the lock validator
A bus is a channel between the processor and one or more devices. For the purposes of the device model, all devices are connected via a bus, even if it is an internal, virtual, “platform” bus. Buses can plug into each other. A USB controller is usually a PCI device, for example. The device model represents the actual connections between buses and the devices they control. A bus is represented by the bus_type structure. It contains the name, the default attributes, the bus' methods, PM operations, and the driver core's private data.
struct device_driver — The basic device driver structure
struct device_driver { const char * name; struct bus_type * bus; struct module * owner; const char * mod_name; bool suppress_bind_attrs; const struct of_device_id * of_match_table; const struct acpi_device_id * acpi_match_table; int (* probe) (struct device *dev); int (* remove) (struct device *dev); void (* shutdown) (struct device *dev); int (* suspend) (struct device *dev, pm_message_t state); int (* resume) (struct device *dev); const struct attribute_group ** groups; const struct dev_pm_ops * pm; struct driver_private * p; };
Name of the device driver.
The bus which the device of this driver belongs to.
The module owner.
Used for built-in modules.
Disables bind/unbind via sysfs.
The open firmware table.
The ACPI match table.
Called to query the existence of a specific device, whether this driver can work with it, and bind the driver to a specific device.
Called when the device is removed from the system to unbind a device from this driver.
Called at shut-down time to quiesce the device.
Called to put the device to sleep mode. Usually to a low power state.
Called to bring a device from sleep mode.
Default attributes that get created by the driver core automatically.
Power management operations of the device which matched this driver.
Driver core's private data, no one other than the driver core can touch this.
The device driver-model tracks all of the drivers known to the system. The main reason for this tracking is to enable the driver core to match up drivers with new devices. Once drivers are known objects within the system, however, a number of other things become possible. Device drivers can export information and configuration variables that are independent of any specific device.
struct subsys_interface — interfaces to device functions
struct subsys_interface { const char * name; struct bus_type * subsys; struct list_head node; int (* add_dev) (struct device *dev, struct subsys_interface *sif); int (* remove_dev) (struct device *dev, struct subsys_interface *sif); };
struct class — device classes
struct class { const char * name; struct module * owner; struct class_attribute * class_attrs; struct device_attribute * dev_attrs; const struct attribute_group ** dev_groups; struct bin_attribute * dev_bin_attrs; struct kobject * dev_kobj; int (* dev_uevent) (struct device *dev, struct kobj_uevent_env *env); char *(* devnode) (struct device *dev, umode_t *mode); void (* class_release) (struct class *class); void (* dev_release) (struct device *dev); int (* suspend) (struct device *dev, pm_message_t state); int (* resume) (struct device *dev); const struct kobj_ns_type_operations * ns_type; const void *(* namespace) (struct device *dev); const struct dev_pm_ops * pm; struct subsys_private * p; };
Name of the class.
The module owner.
Default attributes of this class.
Default attributes of the devices belong to the class.
Default attributes of the devices that belong to the class.
Default binary attributes of the devices belong to the class.
The kobject that represents this class and links it into the hierarchy.
Called when a device is added, removed from this class, or a few other things that generate uevents to add the environment variables.
Callback to provide the devtmpfs.
Called to release this class.
Called to release the device.
Used to put the device to sleep mode, usually to a low power state.
Used to bring the device from the sleep mode.
Callbacks so sysfs can detemine namespaces.
Namespace of the device belongs to this class.
The default device power management operations of this class.
The private data of the driver core, no one other than the driver core can touch this.
A class is a higher-level view of a device that abstracts out low-level implementation details. Drivers may see a SCSI disk or an ATA disk, but, at the class level, they are all simply disks. Classes allow user space to work with devices based on what they do, rather than how they are connected or how they work.
struct device — The basic device structure
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; struct dev_pm_info power; struct dev_pm_domain * pm_domain; #ifdef CONFIG_PINCTRL struct dev_pin_info * pins; #endif #ifdef CONFIG_NUMA int numa_node; #endif u64 * dma_mask; u64 coherent_dma_mask; struct device_dma_parameters * dma_parms; struct list_head dma_pools; struct dma_coherent_mem * dma_mem; #ifdef CONFIG_DMA_CMA struct cma * cma_area; #endif struct dev_archdata archdata; struct device_node * of_node; struct acpi_dev_node acpi_node; 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 *dev); struct iommu_group * iommu_group; bool offline_disabled:1; bool offline:1; };
The device's “parent” device, the device to which it is attached. In most cases, a parent device is some sort of bus or host controller. If parent is NULL, the device, is a top-level device, which is not usually what you want.
Holds the private data of the driver core portions of the device. See the comment of the struct device_private for detail.
A top-level, abstract class from which other classes are derived.
Initial name of the device.
The type of device. This identifies the device type and carries type-specific information.
Mutex to synchronize calls to its driver.
Type of bus device is on.
Which driver has allocated this
Platform data specific to the device.
For device power management. See Documentation/power/devices.txt for details.
Provide callbacks that are executed during system suspend, hibernation, system resume and during runtime PM transitions along with subsystem-level and driver-level callbacks.
For device pin management. See Documentation/pinctrl.txt for details.
NUMA node this device is close to.
Dma mask (if dma'ble device).
Like dma_mask, but for alloc_coherent mapping as not all hardware supports 64-bit addresses for consistent allocations such descriptors.
A low level driver may set these to teach IOMMU code about segment limitations.
Dma pools (if dma'ble device).
Internal for coherent mem override.
Contiguous memory area for dma allocations
For arch-specific additions.
Associated device tree node.
Associated ACPI device node.
For creating the sysfs “dev”.
device instance
Spinlock to protect the resource of the device.
The resources list of the device.
The node used to add the device to the class list.
The class of the device.
Optional attribute groups.
Callback to free the device after all references have gone away. This should be set by the allocator of the device (i.e. the bus driver that discovered the device).
IOMMU group the device belongs to.
If set, the device is permanently online.
Set after successful invocation of bus type's .offline
.
For devices on custom boards, as typical of embedded
and SOC based hardware, Linux often uses platform_data to point
to board-specific structures describing devices and how they
are wired. That can include what ports are available, chip
variants, which GPIO pins act in what additional roles, and so
on. This shrinks the “Board Support Packages” (BSPs) and
minimizes board-specific #ifdefs in drivers.
At the lowest level, every device in a Linux system is represented by an instance of struct device. The device structure contains the information that the device model core needs to model the system. Most subsystems, however, track additional information about the devices they host. As a result, it is rare for devices to be represented by bare device structures; instead, that structure, like kobject structures, is usually embedded within a higher-level representation of the device.
module_driver —
Helper macro for drivers that don't do anything special in module init/exit. This eliminates a lot of boilerplate. Each module may only use this macro once, and calling it replaces module_init
and module_exit
.
fsfuncmodule_driver ( | __driver, | |
__register, | ||
__unregister, | ||
...) ; |
__driver
; __register
; __unregister
; ...
;driver_for_each_device — Iterator for devices bound to a driver.
int fsfuncdriver_for_each_device ( | drv, | |
start, | ||
data, | ||
fn) ; |
struct device_driver * drv
;struct device * start
;void * data
;int (*fn)
(
struct device *, void *)
;driver_find_device — device iterator for locating a particular device.
struct device * fsfuncdriver_find_device ( | drv, | |
start, | ||
data, | ||
match) ; |
struct device_driver * drv
;struct device * start
;void * data
;int (*match)
(
struct device *dev, void *data)
;drv
The device's driver
start
Device to begin with
data
Data to pass to match function
match
Callback function to check device
This is similar to the driver_for_each_device
function above, but
it returns a reference to a device that is 'found' for later use, as
determined by the match
callback.
The callback should return 0 if the device doesn't match and non-zero if it does. If the callback returns non-zero, this function will return to the caller and not iterate over any more devices.
driver_create_file — create sysfs file for driver.
int fsfuncdriver_create_file ( | drv, | |
attr) ; |
struct device_driver * drv
;const struct driver_attribute * attr
;driver_remove_file — remove sysfs file for driver.
void fsfuncdriver_remove_file ( | drv, | |
attr) ; |
struct device_driver * drv
;const struct driver_attribute * attr
;driver_register — register driver with bus
int fsfuncdriver_register ( | drv) ; |
struct device_driver * drv
;driver_unregister — remove driver from system.
void fsfuncdriver_unregister ( | drv) ; |
struct device_driver * drv
;driver_find — locate driver on a bus by its name.
struct device_driver * fsfuncdriver_find ( | name, | |
bus) ; |
const char * name
;struct bus_type * bus
;dev_driver_string — Return a device's driver name, if at all possible
const char * fsfuncdev_driver_string ( | dev) ; |
const struct device * dev
;device_create_file — create sysfs attribute file for device.
int fsfuncdevice_create_file ( | dev, | |
attr) ; |
struct device * dev
;const struct device_attribute * attr
;device_remove_file — remove sysfs attribute file.
void fsfuncdevice_remove_file ( | dev, | |
attr) ; |
struct device * dev
;const struct device_attribute * attr
;device_create_bin_file — create sysfs binary attribute file for device.
int fsfuncdevice_create_bin_file ( | dev, | |
attr) ; |
struct device * dev
;const struct bin_attribute * attr
;device_remove_bin_file — remove sysfs binary attribute file
void fsfuncdevice_remove_bin_file ( | dev, | |
attr) ; |
struct device * dev
;const struct bin_attribute * attr
;device_schedule_callback_owner — helper to schedule a callback for a device
int fsfuncdevice_schedule_callback_owner ( | dev, | |
func, | ||
owner) ; |
struct device * dev
;void (*func)
(
struct device *)
;struct module * owner
;dev
device.
func
callback function to invoke later.
owner
module owning the callback routine
Attribute methods must not unregister themselves or their parent device (which would amount to the same thing). Attempts to do so will deadlock, since unregistration is mutually exclusive with driver callbacks.
Instead methods can call this routine, which will attempt to allocate
and schedule a workqueue request to call back func
with dev
as its
argument in the workqueue's process context. dev
will be pinned until
func
returns.
This routine is usually called via the inline device_schedule_callback
,
which automatically sets owner
to THIS_MODULE.
Returns 0 if the request was submitted, -ENOMEM if storage could not
be allocated, -ENODEV if a reference to owner
isn't available.
device_initialize — init device structure.
void fsfuncdevice_initialize ( | dev) ; |
struct device * dev
;
This prepares the device for use by other layers by initializing
its fields.
It is the first half of device_register
, if called by
that function, though it can also be called separately, so one
may use dev
's fields. In particular, get_device
/put_device
may be used for reference counting of dev
after calling this
function.
All fields in dev
must be initialized by the caller to 0, except
for those explicitly set to some other value. The simplest
approach is to use kzalloc
to allocate the structure containing
dev
.
dev_set_name — set a device name
int fsfuncdev_set_name ( | dev, | |
fmt, | ||
...) ; |
struct device * dev
;const char * fmt
; ...
;device_add — add device to device hierarchy.
int fsfuncdevice_add ( | dev) ; |
struct device * dev
;
This is part 2 of device_register
, though may be called
separately _iff_ device_initialize
has been called separately.
This adds dev
to the kobject hierarchy via kobject_add
, adds it
to the global and sibling lists for the device, then
adds it to the other relevant subsystems of the driver model.
Do not call this routine or device_register
more than once for
any device structure. The driver model core is not designed to work
with devices that get unregistered and then spring back to life.
(Among other things, it's very hard to guarantee that all references
to the previous incarnation of dev
have been dropped.) Allocate
and register a fresh new struct device instead.
device_register — register a device with the system.
int fsfuncdevice_register ( | dev) ; |
struct device * dev
;This happens in two clean steps - initialize the device and add it to the system. The two steps can be called separately, but this is the easiest and most common. I.e. you should only call the two helpers separately if have a clearly defined need to use and refcount the device before it is added to the hierarchy.
For more information, see the kerneldoc for device_initialize
and device_add
.
get_device — increment reference count for device.
struct device * fsfuncget_device ( | dev) ; |
struct device * dev
;put_device — decrement reference count.
void fsfuncput_device ( | dev) ; |
struct device * dev
;device_del — delete device from system.
void fsfuncdevice_del ( | dev) ; |
struct device * dev
;device_unregister — unregister device from system.
void fsfuncdevice_unregister ( | dev) ; |
struct device * dev
;
We do this in two parts, like we do device_register
. First,
we remove it from all the subsystems with device_del
, then
we decrement the reference count via put_device
. If that
is the final reference count, the device will be cleaned up
via device_release
above. Otherwise, the structure will
stick around until the final reference to the device is dropped.
device_for_each_child — device child iterator.
int fsfuncdevice_for_each_child ( | parent, | |
data, | ||
fn) ; |
struct device * parent
;void * data
;int (*fn)
(
struct device *dev, void *data)
;device_find_child — device iterator for locating a particular device.
struct device * fsfuncdevice_find_child ( | parent, | |
data, | ||
match) ; |
struct device * parent
;void * data
;int (*match)
(
struct device *dev, void *data)
;parent
parent struct device
data
Data to pass to match function
match
Callback function to check device
This is similar to the device_for_each_child
function above, but it
returns a reference to a device that is 'found' for later use, as
determined by the match
callback.
The callback should return 0 if the device doesn't match and non-zero if it does. If the callback returns non-zero and a reference to the current device can be obtained, this function will return to the caller and not iterate over any more devices.
__root_device_register — allocate and register a root device
struct device * fsfunc__root_device_register ( | name, | |
owner) ; |
const char * name
;struct module * owner
;
This function allocates a root device and registers it
using device_register
. In order to free the returned
device, use root_device_unregister
.
Root devices are dummy devices which allow other devices to be grouped under /sys/devices. Use this function to allocate a root device and then use it as the parent of any device which should appear under /sys/devices/{name}
The /sys/devices/{name} directory will also contain a
'module' symlink which points to the owner
directory
in sysfs.
Returns struct device pointer on success, or ERR_PTR
on error.
root_device_unregister — unregister and free a root device
void fsfuncroot_device_unregister ( | dev) ; |
struct device * dev
;device_create_vargs — creates a device and registers it with sysfs
struct device * fsfuncdevice_create_vargs ( | class, | |
parent, | ||
devt, | ||
drvdata, | ||
fmt, | ||
args) ; |
struct class * class
;struct device * parent
;dev_t devt
;void * drvdata
;const char * fmt
;va_list args
;class
pointer to the struct class that this device should be registered to
parent
pointer to the parent struct device of this new device, if any
devt
the dev_t for the char device to be added
drvdata
the data to be added to the device for callbacks
fmt
string for the device's name
args
va_list for the device's name
This function can be used by char device classes. A struct device will be created in sysfs, registered to the specified class.
A “dev” file will be created, showing the dev_t for the device, if the dev_t is not 0,0. If a pointer to a parent struct device is passed in, the newly created struct device will be a child of that device in sysfs. The pointer to the struct device will be returned from the call. Any further sysfs files that might be required can be created using this pointer.
Returns struct device pointer on success, or ERR_PTR
on error.
device_create — creates a device and registers it with sysfs
struct device * fsfuncdevice_create ( | class, | |
parent, | ||
devt, | ||
drvdata, | ||
fmt, | ||
...) ; |
struct class * class
;struct device * parent
;dev_t devt
;void * drvdata
;const char * fmt
; ...
;class
pointer to the struct class that this device should be registered to
parent
pointer to the parent struct device of this new device, if any
devt
the dev_t for the char device to be added
drvdata
the data to be added to the device for callbacks
fmt
string for the device's name
...
variable arguments
This function can be used by char device classes. A struct device will be created in sysfs, registered to the specified class.
A “dev” file will be created, showing the dev_t for the device, if the dev_t is not 0,0. If a pointer to a parent struct device is passed in, the newly created struct device will be a child of that device in sysfs. The pointer to the struct device will be returned from the call. Any further sysfs files that might be required can be created using this pointer.
Returns struct device pointer on success, or ERR_PTR
on error.
device_create_with_groups — creates a device and registers it with sysfs
struct device * fsfuncdevice_create_with_groups ( | class, | |
parent, | ||
devt, | ||
drvdata, | ||
groups, | ||
fmt, | ||
...) ; |
struct class * class
;struct device * parent
;dev_t devt
;void * drvdata
;const struct attribute_group ** groups
;const char * fmt
; ...
;class
pointer to the struct class that this device should be registered to
parent
pointer to the parent struct device of this new device, if any
devt
the dev_t for the char device to be added
drvdata
the data to be added to the device for callbacks
groups
NULL-terminated list of attribute groups to be created
fmt
string for the device's name
...
variable arguments
This function can be used by char device classes. A struct device will be created in sysfs, registered to the specified class. Additional attributes specified in the groups parameter will also be created automatically.
A “dev” file will be created, showing the dev_t for the device, if the dev_t is not 0,0. If a pointer to a parent struct device is passed in, the newly created struct device will be a child of that device in sysfs. The pointer to the struct device will be returned from the call. Any further sysfs files that might be required can be created using this pointer.
Returns struct device pointer on success, or ERR_PTR
on error.
device_destroy —
removes a device that was created with device_create
void fsfuncdevice_destroy ( | class, | |
devt) ; |
struct class * class
;dev_t devt
;device_rename — renames a device
int fsfuncdevice_rename ( | dev, | |
new_name) ; |
struct device * dev
;const char * new_name
;It is the responsibility of the caller to provide mutual exclusion between two different calls of device_rename on the same device to ensure that new_name is valid and won't conflict with other devices.
Don't call this function. Currently, the networking layer calls this function, but that will change. The following text from Kay Sievers offers
Renaming devices is racy at many levels, symlinks and other stuff are not replaced atomically, and you get a “move” uevent, but it's not easy to connect the event to the old and new device. Device nodes are not renamed at all, there isn't even support for that in the kernel now.
In the meantime, during renaming, your target name might be taken by another driver, creating conflicts. Or the old name is taken directly after you renamed it -- then you get events for the same DEVPATH, before you even see the “move” event. It's just a mess, and nothing new should ever rely on kernel device renaming. Besides that, it's not even implemented now for other things than (driver-core wise very simple) network devices.
We are currently about to change network renaming in udev to completely disallow renaming of devices in the same namespace as the kernel uses, because we can't solve the problems properly, that arise with swapping names of multiple interfaces without races. Means, renaming of eth[0-9]* will only be allowed to some other name than eth[0-9]*, for the aforementioned reasons.
Make up a “real” name in the driver before you register anything, or add some other attributes for userspace to find the device, or use udev to add symlinks -- but never rename kernel devices later, it's a complete mess. We don't even want to get into that and try to implement the missing pieces in the core. We really have other pieces to fix in the driver core mess. :)
device_move — moves a device to a new parent
int fsfuncdevice_move ( | dev, | |
new_parent, | ||
dpm_order) ; |
struct device * dev
;struct device * new_parent
;enum dpm_order dpm_order
;register_syscore_ops — Register a set of system core operations.
void fsfuncregister_syscore_ops ( | ops) ; |
struct syscore_ops * ops
;unregister_syscore_ops — Unregister a set of system core operations.
void fsfuncunregister_syscore_ops ( | ops) ; |
struct syscore_ops * ops
;syscore_suspend — Execute all the registered system core suspend callbacks.
int fsfuncsyscore_suspend ( | void) ; |
void
;syscore_resume — Execute all the registered system core resume callbacks.
void fsfuncsyscore_resume ( | void) ; |
void
;__class_create — create a struct class structure
struct class * fsfunc__class_create ( | owner, | |
name, | ||
key) ; |
struct module * owner
;const char * name
;struct lock_class_key * key
;class_destroy — destroys a struct class structure
void fsfuncclass_destroy ( | cls) ; |
struct class * cls
;class_dev_iter_init — initialize class device iterator
void fsfuncclass_dev_iter_init ( | iter, | |
class, | ||
start, | ||
type) ; |
struct class_dev_iter * iter
;struct class * class
;struct device * start
;const struct device_type * type
;class_dev_iter_next — iterate to the next device
struct device * fsfuncclass_dev_iter_next ( | iter) ; |
struct class_dev_iter * iter
;
Proceed iter
to the next device and return it. Returns NULL if
iteration is complete.
The returned device is referenced and won't be released till iterator is proceed to the next device or exited. The caller is free to do whatever it wants to do with the device including calling back into class code.
class_dev_iter_exit — finish iteration
void fsfuncclass_dev_iter_exit ( | iter) ; |
struct class_dev_iter * iter
;class_for_each_device — device iterator
int fsfuncclass_for_each_device ( | class, | |
start, | ||
data, | ||
fn) ; |
struct class * class
;struct device * start
;void * data
;int (*fn)
(
struct device *, void *)
;class
the class we're iterating
start
the device to start with in the list, if any.
data
data for the callback
fn
function to be called for each device
Iterate over class
's list of devices, and call fn
for each,
passing it data
. If start
is set, the list iteration will start
there, otherwise if it is NULL, the iteration starts at the
beginning of the list.
We check the return of fn
each time. If it returns anything
other than 0, we break out and return that value.
fn
is allowed to do anything including calling back into class
code. There's no locking restriction.
class_find_device — device iterator for locating a particular device
struct device * fsfuncclass_find_device ( | class, | |
start, | ||
data, | ||
match) ; |
struct class * class
;struct device * start
;const void * data
;int (*match)
(
struct device *, const void *)
;class
the class we're iterating
start
Device to begin with
data
data for the match function
match
function to check device
This is similar to the class_for_each_dev
function above, but it
returns a reference to a device that is 'found' for later use, as
determined by the match
callback.
The callback should return 0 if the device doesn't match and non-zero if it does. If the callback returns non-zero, this function will return to the caller and not iterate over any more devices.
Note, you will need to drop the reference with put_device
after use.
fn
is allowed to do anything including calling back into class
code. There's no locking restriction.
class_compat_register — register a compatibility class
struct class_compat * fsfuncclass_compat_register ( | name) ; |
const char * name
;class_compat_unregister — unregister a compatibility class
void fsfuncclass_compat_unregister ( | cls) ; |
struct class_compat * cls
;class_compat_create_link — create a compatibility class device link to a bus device
int fsfuncclass_compat_create_link ( | cls, | |
dev, | ||
device_link) ; |
struct class_compat * cls
;struct device * dev
;struct device * device_link
;class_compat_remove_link — remove a compatibility class device link to a bus device
void fsfuncclass_compat_remove_link ( | cls, | |
dev, | ||
device_link) ; |
struct class_compat * cls
;struct device * dev
;struct device * device_link
;unregister_node — unregister a node device
void fsfuncunregister_node ( | node) ; |
struct node * node
;request_firmware — send firmware request and wait for it
int fsfuncrequest_firmware ( | firmware_p, | |
name, | ||
device) ; |
const struct firmware ** firmware_p
;const char * name
;struct device * device
;firmware_p
pointer to firmware image
name
name of firmware file
device
device for which firmware is being loaded
firmware_p
will be used to return a firmware image by the name
of name
for device device
.
Should be called from user context where sleeping is allowed.
name
will be used as $FIRMWARE
in the uevent environment and
should be distinctive enough not to be confused with any other
firmware image for this or any other device.
Caller must hold the reference count of device
.
The function can be called safely inside device's suspend and resume callback.
release_firmware — release the resource associated with a firmware image
void fsfuncrelease_firmware ( | fw) ; |
const struct firmware * fw
;request_firmware_nowait — asynchronous version of request_firmware
int fsfuncrequest_firmware_nowait ( | module, | |
uevent, | ||
name, | ||
device, | ||
gfp, | ||
context, | ||
cont) ; |
struct module * module
;bool uevent
;const char * name
;struct device * device
;gfp_t gfp
;void * context
;void (*cont)
(
const struct firmware *fw, void *context)
;module
module requesting the firmware
uevent
sends uevent to copy the firmware image if this flag is non-zero else the firmware copy must be done manually.
name
name of firmware file
device
device for which firmware is being loaded
gfp
allocation flags
context
will be passed over to cont
, and
fw
may be NULL
if firmware request fails.
cont
function will be called asynchronously when the firmware request is over.
Caller must hold the reference count of device
.
Asynchronous variant of request_firmware
for user contexts:
- sleep for as small periods as possible since it may
increase kernel boot time of built-in device drivers
requesting firmware in their ->probe
methods, if
gfp
is GFP_KERNEL.
- can't sleep at all if gfp
is GFP_ATOMIC.
transport_class_register — register an initial transport class
int fsfunctransport_class_register ( | tclass) ; |
struct transport_class * tclass
;
The transport class contains an embedded class which is used to
identify it. The caller should initialise this structure with
zeros and then generic class must have been initialised with the
actual transport class unique name. There's a macro
DECLARE_TRANSPORT_CLASS
to do this (declared classes still must
be registered).
Returns 0 on success or error on failure.
transport_class_unregister — unregister a previously registered class
void fsfunctransport_class_unregister ( | tclass) ; |
struct transport_class * tclass
;anon_transport_class_register — register an anonymous class
int fsfuncanon_transport_class_register ( | atc) ; |
struct anon_transport_class * atc
;
The anonymous transport class contains both a transport class and a
container. The idea of an anonymous class is that it never
actually has any device attributes associated with it (and thus
saves on container storage). So it can only be used for triggering
events. Use prezero and then use DECLARE_ANON_TRANSPORT_CLASS
to
initialise the anon transport class storage.
anon_transport_class_unregister — unregister an anon class
void fsfuncanon_transport_class_unregister ( | atc) ; |
struct anon_transport_class * atc
;transport_setup_device — declare a new dev for transport class association but don't make it visible yet.
void fsfunctransport_setup_device ( | dev) ; |
struct device * dev
;Usually, dev represents some component in the HBA system (either the HBA itself or a device remote across the HBA bus). This routine is simply a trigger point to see if any set of transport classes wishes to associate with the added device. This allocates storage for the class device and initialises it, but does not yet add it to the system or add attributes to it (you do this with transport_add_device). If you have no need for a separate setup and add operations, use transport_register_device (see transport_class.h).
transport_add_device — declare a new dev for transport class association
void fsfunctransport_add_device ( | dev) ; |
struct device * dev
;transport_configure_device — configure an already set up device
void fsfunctransport_configure_device ( | dev) ; |
struct device * dev
;The idea of configure is simply to provide a point within the setup process to allow the transport class to extract information from a device after it has been setup. This is used in SCSI because we have to have a setup device to begin using the HBA, but after we send the initial inquiry, we use configure to extract the device parameters. The device need not have been added to be configured.
transport_remove_device — remove the visibility of a device
void fsfunctransport_remove_device ( | dev) ; |
struct device * dev
;
This call removes the visibility of the device (to the user from
sysfs), but does not destroy it. To eliminate a device entirely
you must also call transport_destroy_device. If you don't need to
do remove and destroy as separate operations, use
transport_unregister_device
(see transport_class.h) which will
perform both calls for you.
transport_destroy_device — destroy a removed device
void fsfunctransport_destroy_device ( | dev) ; |
struct device * dev
;This call triggers the elimination of storage associated with the transport classdev. Note: all it really does is relinquish a reference to the classdev. The memory will not be freed until the last reference goes to zero. Note also that the classdev retains a reference count on dev, so dev too will remain for as long as the transport class device remains around.
device_bind_driver — bind a driver to one device.
int fsfuncdevice_bind_driver ( | dev) ; |
struct device * dev
;
Allow manual attachment of a driver to a device.
Caller must have already set dev
->driver.
Note that this does not modify the bus reference count
nor take the bus's rwsem. Please verify those are accounted
for before calling this. (It is ok to call with no other effort
from a driver's probe
method.)
This function must be called with the device lock held.
device_attach — try to attach device to a driver.
int fsfuncdevice_attach ( | dev) ; |
struct device * dev
;
Walk the list of drivers that the bus has and call
driver_probe_device
for each pair. If a compatible
pair is found, break out and return.
Returns 1 if the device was bound to a driver; 0 if no matching driver was found; -ENODEV if the device is not registered.
When called for a USB interface, dev
->parent lock must be held.
driver_attach — try to bind driver to devices.
int fsfuncdriver_attach ( | drv) ; |
struct device_driver * drv
;device_release_driver — manually detach device from driver.
void fsfuncdevice_release_driver ( | dev) ; |
struct device * dev
;platform_device_register_resndata — add a platform-level device with resources and platform-specific data
struct platform_device * fsfuncplatform_device_register_resndata ( | parent, | |
name, | ||
id, | ||
res, | ||
num, | ||
data, | ||
size) ; |
struct device * parent
;const char * name
;int id
;const struct resource * res
;unsigned int num
;const void * data
;size_t size
;platform_device_register_simple — add a platform-level device and its resources
struct platform_device * fsfuncplatform_device_register_simple ( | name, | |
id, | ||
res, | ||
num) ; |
const char * name
;int id
;const struct resource * res
;unsigned int num
;name
base name of the device we're adding
id
instance id
res
set of resources that needs to be allocated for the device
num
number of resources
This function creates a simple platform device that requires minimal resource and memory management. Canned release function freeing memory allocated for the device allows drivers using such devices to be unloaded without waiting for the last reference to the device to be dropped.
This interface is primarily intended for use with legacy drivers which probe hardware directly. Because such drivers create sysfs device nodes themselves, rather than letting system infrastructure handle such device enumeration tasks, they don't fully conform to the Linux driver model. In particular, when such drivers are built as modules, they can't be “hotplugged”.
Returns struct platform_device pointer on success, or ERR_PTR
on error.
platform_device_register_data — add a platform-level device with platform-specific data
struct platform_device * fsfuncplatform_device_register_data ( | parent, | |
name, | ||
id, | ||
data, | ||
size) ; |
struct device * parent
;const char * name
;int id
;const void * data
;size_t size
;parent
parent device for the device we're adding
name
base name of the device we're adding
id
instance id
data
platform specific data for this platform device
size
size of platform specific data
This function creates a simple platform device that requires minimal resource and memory management. Canned release function freeing memory allocated for the device allows drivers using such devices to be unloaded without waiting for the last reference to the device to be dropped.
Returns struct platform_device pointer on success, or ERR_PTR
on error.
platform_get_resource — get a resource for a device
struct resource * fsfuncplatform_get_resource ( | dev, | |
type, | ||
num) ; |
struct platform_device * dev
;unsigned int type
;unsigned int num
;platform_get_irq — get an IRQ for a device
int fsfuncplatform_get_irq ( | dev, | |
num) ; |
struct platform_device * dev
;unsigned int num
;platform_get_resource_byname — get a resource for a device by name
struct resource * fsfuncplatform_get_resource_byname ( | dev, | |
type, | ||
name) ; |
struct platform_device * dev
;unsigned int type
;const char * name
;platform_get_irq_byname — get an IRQ for a device by name
int fsfuncplatform_get_irq_byname ( | dev, | |
name) ; |
struct platform_device * dev
;const char * name
;platform_add_devices — add a numbers of platform devices
int fsfuncplatform_add_devices ( | devs, | |
num) ; |
struct platform_device ** devs
;int num
;platform_device_put — destroy a platform device
void fsfuncplatform_device_put ( | pdev) ; |
struct platform_device * pdev
;platform_device_alloc — create a platform device
struct platform_device * fsfuncplatform_device_alloc ( | name, | |
id) ; |
const char * name
;int id
;platform_device_add_resources — add resources to a platform device
int fsfuncplatform_device_add_resources ( | pdev, | |
res, | ||
num) ; |
struct platform_device * pdev
;const struct resource * res
;unsigned int num
;platform_device_add_data — add platform-specific data to a platform device
int fsfuncplatform_device_add_data ( | pdev, | |
data, | ||
size) ; |
struct platform_device * pdev
;const void * data
;size_t size
;platform_device_add — add a platform device to device hierarchy
int fsfuncplatform_device_add ( | pdev) ; |
struct platform_device * pdev
;platform_device_del — remove a platform-level device
void fsfuncplatform_device_del ( | pdev) ; |
struct platform_device * pdev
;platform_device_register — add a platform-level device
int fsfuncplatform_device_register ( | pdev) ; |
struct platform_device * pdev
;platform_device_unregister — unregister a platform-level device
void fsfuncplatform_device_unregister ( | pdev) ; |
struct platform_device * pdev
;platform_device_register_full — add a platform-level device with resources and platform-specific data
struct platform_device * fsfuncplatform_device_register_full ( | pdevinfo) ; |
const struct platform_device_info * pdevinfo
;__platform_driver_register — register a driver for platform-level devices
int fsfunc__platform_driver_register ( | drv, | |
owner) ; |
struct platform_driver * drv
;struct module * owner
;platform_driver_unregister — unregister a driver for platform-level devices
void fsfuncplatform_driver_unregister ( | drv) ; |
struct platform_driver * drv
;platform_driver_probe — register driver for non-hotpluggable device
int fsfuncplatform_driver_probe ( | drv, | |
probe) ; |
struct platform_driver * drv
;int (*probe)
(
struct platform_device *)
;drv
platform driver structure
probe
the driver probe routine, probably from an __init section, must not return -EPROBE_DEFER.
Use this instead of platform_driver_register
when you know the device
is not hotpluggable and has already been registered, and you want to
remove its run-once probe
infrastructure from memory after the driver
has bound to the device.
One typical use for this would be with drivers for controllers integrated into system-on-chip processors, where the controller devices have been configured as part of board setup.
This is incompatible with deferred probing so probe
must not
return -EPROBE_DEFER.
Returns zero if the driver registered and bound to a device, else returns a negative error code and with the driver not registered.
platform_create_bundle — register driver and create corresponding device
struct platform_device * fsfuncplatform_create_bundle ( | driver, | |
probe, | ||
res, | ||
n_res, | ||
data, | ||
size) ; |
struct platform_driver * driver
;int (*probe)
(
struct platform_device *)
;struct resource * res
;unsigned int n_res
;const void * data
;size_t size
;bus_for_each_dev — device iterator.
int fsfuncbus_for_each_dev ( | bus, | |
start, | ||
data, | ||
fn) ; |
struct bus_type * bus
;struct device * start
;void * data
;int (*fn)
(
struct device *, void *)
;bus
bus type.
start
device to start iterating from.
data
data for the callback.
fn
function to be called for each device.
bus_find_device — device iterator for locating a particular device.
struct device * fsfuncbus_find_device ( | bus, | |
start, | ||
data, | ||
match) ; |
struct bus_type * bus
;struct device * start
;void * data
;int (*match)
(
struct device *dev, void *data)
;bus
bus type
start
Device to begin with
data
Data to pass to match function
match
Callback function to check device
This is similar to the bus_for_each_dev
function above, but it
returns a reference to a device that is 'found' for later use, as
determined by the match
callback.
The callback should return 0 if the device doesn't match and non-zero if it does. If the callback returns non-zero, this function will return to the caller and not iterate over any more devices.
bus_find_device_by_name — device iterator for locating a particular device of a specific name
struct device * fsfuncbus_find_device_by_name ( | bus, | |
start, | ||
name) ; |
struct bus_type * bus
;struct device * start
;const char * name
;subsys_find_device_by_id — find a device with a specific enumeration number
struct device * fsfuncsubsys_find_device_by_id ( | subsys, | |
id, | ||
hint) ; |
struct bus_type * subsys
;unsigned int id
;struct device * hint
;bus_for_each_drv — driver iterator
int fsfuncbus_for_each_drv ( | bus, | |
start, | ||
data, | ||
fn) ; |
struct bus_type * bus
;struct device_driver * start
;void * data
;int (*fn)
(
struct device_driver *, void *)
;bus
bus we're dealing with.
start
driver to start iterating on.
data
data to pass to the callback.
fn
function to call for each driver.
This is nearly identical to the device iterator above.
We iterate over each driver that belongs to bus
, and call
fn
for each. If fn
returns anything but 0, we break out
and return it. If start
is not NULL, we use it as the head
of the list.
we don't return the driver that returns a non-zero value, nor do we leave the reference count incremented for that driver. If the caller needs to know that info, it must set it in the callback. It must also be sure to increment the refcount so it doesn't disappear before returning to the caller.
bus_rescan_devices — rescan devices on the bus for possible drivers
int fsfuncbus_rescan_devices ( | bus) ; |
struct bus_type * bus
;device_reprobe — remove driver for a device and probe for a new driver
int fsfuncdevice_reprobe ( | dev) ; |
struct device * dev
;bus_register — register a driver-core subsystem
int fsfuncbus_register ( | bus) ; |
struct bus_type * bus
;bus_unregister — remove a bus from the system
void fsfuncbus_unregister ( | bus) ; |
struct bus_type * bus
;subsys_dev_iter_init — initialize subsys device iterator
void fsfuncsubsys_dev_iter_init ( | iter, | |
subsys, | ||
start, | ||
type) ; |
struct subsys_dev_iter * iter
;struct bus_type * subsys
;struct device * start
;const struct device_type * type
;subsys_dev_iter_next — iterate to the next device
struct device * fsfuncsubsys_dev_iter_next ( | iter) ; |
struct subsys_dev_iter * iter
;
Proceed iter
to the next device and return it. Returns NULL if
iteration is complete.
The returned device is referenced and won't be released till iterator is proceed to the next device or exited. The caller is free to do whatever it wants to do with the device including calling back into subsys code.
subsys_dev_iter_exit — finish iteration
void fsfuncsubsys_dev_iter_exit ( | iter) ; |
struct subsys_dev_iter * iter
;subsys_system_register — register a subsystem at /sys/devices/system/
int fsfuncsubsys_system_register ( | subsys, | |
groups) ; |
struct bus_type * subsys
;const struct attribute_group ** groups
;All 'system' subsystems have a /sys/devices/system/<name> root device with the name of the subsystem. The root device can carry subsystem- wide attributes. All registered devices are below this single root device and are named after the subsystem with a simple enumeration number appended. The registered devices are not explicitely named; only 'id' in the device needs to be set.
Do not use this interface for anything new, it exists for compatibility with bad ideas only. New subsystems should use plain subsystems; and add the subsystem-wide attributes should be added to the subsystem directory itself and not some create fake root-device placed in /sys/devices/system/<name>.
subsys_virtual_register — register a subsystem at /sys/devices/virtual/
int fsfuncsubsys_virtual_register ( | subsys, | |
groups) ; |
struct bus_type * subsys
;const struct attribute_group ** groups
;All 'virtual' subsystems have a /sys/devices/system/<name> root device with the name of the subystem. The root device can carry subsystem-wide attributes. All registered devices are below this single root device. There's no restriction on device naming. This is for kernel software constructs which need sysfs interface.
dma_buf_export_named — Creates a new dma_buf, and associates an anon file with this buffer, so it can be exported. Also connect the allocator specific data and ops to the buffer. Additionally, provide a name string for exporter; useful in debugging.
struct dma_buf * fsfuncdma_buf_export_named ( | priv, | |
ops, | ||
size, | ||
flags, | ||
exp_name) ; |
void * priv
;const struct dma_buf_ops * ops
;size_t size
;int flags
;const char * exp_name
;dma_buf_fd — returns a file descriptor for the given dma_buf
int fsfuncdma_buf_fd ( | dmabuf, | |
flags) ; |
struct dma_buf * dmabuf
;int flags
;dma_buf_get — returns the dma_buf structure related to an fd
struct dma_buf * fsfuncdma_buf_get ( | fd) ; |
int fd
;dma_buf_put — decreases refcount of the buffer
void fsfuncdma_buf_put ( | dmabuf) ; |
struct dma_buf * dmabuf
;dma_buf_attach —
Add the device to dma_buf's attachments list; optionally, calls attach
of dma_buf_ops to allow device-specific attach functionality
struct dma_buf_attachment * fsfuncdma_buf_attach ( | dmabuf, | |
dev) ; |
struct dma_buf * dmabuf
;struct device * dev
;dma_buf_detach —
Remove the given attachment from dmabuf's attachments list; optionally calls detach
of dma_buf_ops for device-specific detach
void fsfuncdma_buf_detach ( | dmabuf, | |
attach) ; |
struct dma_buf * dmabuf
;struct dma_buf_attachment * attach
;dma_buf_map_attachment —
Returns the scatterlist table of the attachment; mapped into _device_ address space. Is a wrapper for map_dma_buf
of the dma_buf_ops.
struct sg_table * fsfuncdma_buf_map_attachment ( | attach, | |
direction) ; |
struct dma_buf_attachment * attach
;enum dma_data_direction direction
;dma_buf_unmap_attachment —
unmaps and decreases usecount of the buffer;might deallocate the scatterlist associated. Is a wrapper for unmap_dma_buf
of dma_buf_ops.
void fsfuncdma_buf_unmap_attachment ( | attach, | |
sg_table, | ||
direction) ; |
struct dma_buf_attachment * attach
;struct sg_table * sg_table
;enum dma_data_direction direction
;dma_buf_begin_cpu_access — Must be called before accessing a dma_buf from the cpu in the kernel context. Calls begin_cpu_access to allow exporter-specific preparations. Coherency is only guaranteed in the specified range for the specified access direction.
int fsfuncdma_buf_begin_cpu_access ( | dmabuf, | |
start, | ||
len, | ||
direction) ; |
struct dma_buf * dmabuf
;size_t start
;size_t len
;enum dma_data_direction direction
;dma_buf_end_cpu_access — Must be called after accessing a dma_buf from the cpu in the kernel context. Calls end_cpu_access to allow exporter-specific actions. Coherency is only guaranteed in the specified range for the specified access direction.
void fsfuncdma_buf_end_cpu_access ( | dmabuf, | |
start, | ||
len, | ||
direction) ; |
struct dma_buf * dmabuf
;size_t start
;size_t len
;enum dma_data_direction direction
;dma_buf_kmap_atomic — Map a page of the buffer object into kernel address space. The same restrictions as for kmap_atomic and friends apply.
void * fsfuncdma_buf_kmap_atomic ( | dmabuf, | |
page_num) ; |
struct dma_buf * dmabuf
;unsigned long page_num
;dma_buf_kunmap_atomic — Unmap a page obtained by dma_buf_kmap_atomic.
void fsfuncdma_buf_kunmap_atomic ( | dmabuf, | |
page_num, | ||
vaddr) ; |
struct dma_buf * dmabuf
;unsigned long page_num
;void * vaddr
;dma_buf_kmap — Map a page of the buffer object into kernel address space. The same restrictions as for kmap and friends apply.
void * fsfuncdma_buf_kmap ( | dmabuf, | |
page_num) ; |
struct dma_buf * dmabuf
;unsigned long page_num
;dma_buf_kunmap — Unmap a page obtained by dma_buf_kmap.
void fsfuncdma_buf_kunmap ( | dmabuf, | |
page_num, | ||
vaddr) ; |
struct dma_buf * dmabuf
;unsigned long page_num
;void * vaddr
;dma_buf_mmap — Setup up a userspace mmap with the given vma
int fsfuncdma_buf_mmap ( | dmabuf, | |
vma, | ||
pgoff) ; |
struct dma_buf * dmabuf
;struct vm_area_struct * vma
;unsigned long pgoff
;dmabuf
[in] buffer that should back the vma
vma
[in] vma for the mmap
pgoff
[in] offset in pages where this mmap should start within the dma-buf buffer.
This function adjusts the passed in vma so that it points at the file of the dma_buf operation. It alsog adjusts the starting pgoff and does bounds checking on the size of the vma. Then it calls the exporters mmap function to set up the mapping.
Can return negative error values, returns 0 on success.
dma_buf_vmap — Create virtual mapping for the buffer object into kernel address space. Same restrictions as for vmap and friends apply.
void * fsfuncdma_buf_vmap ( | dmabuf) ; |
struct dma_buf * dmabuf
;dma_buf_vunmap — Unmap a vmap obtained by dma_buf_vmap.
void fsfuncdma_buf_vunmap ( | dmabuf, | |
vaddr) ; |
struct dma_buf * dmabuf
;void * vaddr
;dma_alloc_from_coherent — try to allocate memory from the per-device coherent area
int fsfuncdma_alloc_from_coherent ( | dev, | |
size, | ||
dma_handle, | ||
ret) ; |
struct device * dev
;ssize_t size
;dma_addr_t * dma_handle
;void ** ret
;dma_release_from_coherent — try to free the memory allocated from per-device coherent memory pool
int fsfuncdma_release_from_coherent ( | dev, | |
order, | ||
vaddr) ; |
struct device * dev
;int order
;void * vaddr
;dma_mmap_from_coherent — try to mmap the memory allocated from per-device coherent memory pool to userspace
int fsfuncdma_mmap_from_coherent ( | dev, | |
vma, | ||
vaddr, | ||
size, | ||
ret) ; |
struct device * dev
;struct vm_area_struct * vma
;void * vaddr
;size_t size
;int * ret
;dmam_alloc_coherent —
Managed dma_alloc_coherent
void * fsfuncdmam_alloc_coherent ( | dev, | |
size, | ||
dma_handle, | ||
gfp) ; |
struct device * dev
;size_t size
;dma_addr_t * dma_handle
;gfp_t gfp
;dev
Device to allocate coherent memory for
size
Size of allocation
dma_handle
Out argument for allocated DMA handle
gfp
Allocation flags
dmam_free_coherent —
Managed dma_free_coherent
void fsfuncdmam_free_coherent ( | dev, | |
size, | ||
vaddr, | ||
dma_handle) ; |
struct device * dev
;size_t size
;void * vaddr
;dma_addr_t dma_handle
;dmam_alloc_noncoherent —
Managed dma_alloc_non_coherent
void * fsfuncdmam_alloc_noncoherent ( | dev, | |
size, | ||
dma_handle, | ||
gfp) ; |
struct device * dev
;size_t size
;dma_addr_t * dma_handle
;gfp_t gfp
;dev
Device to allocate non_coherent memory for
size
Size of allocation
dma_handle
Out argument for allocated DMA handle
gfp
Allocation flags
dmam_free_noncoherent —
Managed dma_free_noncoherent
void fsfuncdmam_free_noncoherent ( | dev, | |
size, | ||
vaddr, | ||
dma_handle) ; |
struct device * dev
;size_t size
;void * vaddr
;dma_addr_t dma_handle
;dmam_declare_coherent_memory —
Managed dma_declare_coherent_memory
int fsfuncdmam_declare_coherent_memory ( | dev, | |
bus_addr, | ||
device_addr, | ||
size, | ||
flags) ; |
struct device * dev
;dma_addr_t bus_addr
;dma_addr_t device_addr
;size_t size
;int flags
;dpm_resume_start — Execute “noirq” and “early” device callbacks.
void fsfuncdpm_resume_start ( | state) ; |
pm_message_t state
;dpm_resume_end — Execute “resume” callbacks and complete system transition.
void fsfuncdpm_resume_end ( | state) ; |
pm_message_t state
;dpm_suspend_end — Execute “late” and “noirq” device suspend callbacks.
int fsfuncdpm_suspend_end ( | state) ; |
pm_message_t state
;dpm_suspend_start — Prepare devices for PM transition and suspend them.
int fsfuncdpm_suspend_start ( | state) ; |
pm_message_t state
;device_pm_wait_for_dev — Wait for suspend/resume of a device to complete.
int fsfuncdevice_pm_wait_for_dev ( | subordinate, | |
dev) ; |
struct device * subordinate
;struct device * dev
;acpi_bus_hot_remove_device — remove a device and its children
void fsfuncacpi_bus_hot_remove_device ( | context) ; |
void * context
;acpi_match_device — Match a struct device against a given list of ACPI IDs
const struct acpi_device_id * fsfuncacpi_match_device ( | ids, | |
dev) ; |
const struct acpi_device_id * ids
;const struct device * dev
;acpi_bus_register_driver — register a driver with the ACPI bus
int fsfuncacpi_bus_register_driver ( | driver) ; |
struct acpi_driver * driver
;acpi_bus_unregister_driver — unregisters a driver with the APIC bus
void fsfuncacpi_bus_unregister_driver ( | driver) ; |
struct acpi_driver * driver
;acpi_bus_scan — Add ACPI device node objects in a given namespace scope.
int fsfuncacpi_bus_scan ( | handle) ; |
acpi_handle handle
;Scan a given ACPI tree (probably recently hot-plugged) and create and add found devices.
If no devices were found, -ENODEV is returned, but it does not mean that there has been a real error. There just have been no suitable ACPI objects in the table trunk from which the kernel could create a device and add an appropriate driver.
Must be called under acpi_scan_lock.
acpi_bus_trim — Remove ACPI device node and all of its descendants
void fsfuncacpi_bus_trim ( | start) ; |
struct acpi_device * start
;pnp_register_protocol — adds a pnp protocol to the pnp layer
int fsfuncpnp_register_protocol ( | protocol) ; |
struct pnp_protocol * protocol
;pnp_unregister_protocol — removes a pnp protocol from the pnp layer
void fsfuncpnp_unregister_protocol ( | protocol) ; |
struct pnp_protocol * protocol
;pnp_request_card_device — Searches for a PnP device under the specified card
struct pnp_dev * fsfuncpnp_request_card_device ( | clink, | |
id, | ||
from) ; |
struct pnp_card_link * clink
;const char * id
;struct pnp_dev * from
;pnp_release_card_device — call this when the driver no longer needs the device
void fsfuncpnp_release_card_device ( | dev) ; |
struct pnp_dev * dev
;pnp_register_card_driver — registers a PnP card driver with the PnP Layer
int fsfuncpnp_register_card_driver ( | drv) ; |
struct pnp_card_driver * drv
;pnp_unregister_card_driver — unregisters a PnP card driver from the PnP Layer
void fsfuncpnp_unregister_card_driver ( | drv) ; |
struct pnp_card_driver * drv
;pnp_add_id — adds an EISA id to the specified device
struct pnp_id * fsfuncpnp_add_id ( | dev, | |
id) ; |
struct pnp_dev * dev
;const char * id
;pnp_start_dev — low-level start of the PnP device
int fsfuncpnp_start_dev ( | dev) ; |
struct pnp_dev * dev
;pnp_stop_dev — low-level disable of the PnP device
int fsfuncpnp_stop_dev ( | dev) ; |
struct pnp_dev * dev
;pnp_activate_dev — activates a PnP device for use
int fsfuncpnp_activate_dev ( | dev) ; |
struct pnp_dev * dev
;uio_event_notify — trigger an interrupt event
void fsfuncuio_event_notify ( | info) ; |
struct uio_info * info
;__uio_register_device — register a new userspace IO device
int fsfunc__uio_register_device ( | owner, | |
parent, | ||
info) ; |
struct module * owner
;struct device * parent
;struct uio_info * info
;uio_unregister_device — unregister a industrial IO device
void fsfuncuio_unregister_device ( | info) ; |
struct uio_info * info
;struct uio_mem — description of a UIO memory region
struct uio_mem { const char * name; phys_addr_t addr; unsigned long size; int memtype; void __iomem * internal_addr; struct uio_map * map; };
name of the memory region for identification
address of the device's memory (phys_addr is used since addr can be logical, virtual, or physical & phys_addr_t should always be large enough to handle any of the address types)
size of IO
type of memory addr points to
ioremap-ped version of addr, for driver internal use
for use by the UIO core only.
struct uio_port — description of a UIO port region
struct uio_port { const char * name; unsigned long start; unsigned long size; int porttype; struct uio_portio * portio; };
struct uio_info — UIO device capabilities
struct uio_info { struct uio_device * uio_dev; const char * name; const char * version; struct uio_mem mem[MAX_UIO_MAPS]; struct uio_port port[MAX_UIO_PORT_REGIONS]; long irq; unsigned long irq_flags; void * priv; irqreturn_t (* handler) (int irq, struct uio_info *dev_info); int (* mmap) (struct uio_info *info, struct vm_area_struct *vma); int (* open) (struct uio_info *info, struct inode *inode); int (* release) (struct uio_info *info, struct inode *inode); int (* irqcontrol) (struct uio_info *info, s32 irq_on); };
the UIO device this info belongs to
device name
device driver version
list of mappable memory regions, size==0 for end of list
list of port regions, size==0 for end of list
interrupt number or UIO_IRQ_CUSTOM
flags for request_irq
optional private data
the device's irq handler
mmap operation for this uio device
open operation for this uio device
release operation for this uio device
disable/enable irqs when 0/1 is written to /dev/uioX
Table of Contents
parport_open
parport_yield — relinquish a parallel port temporarily
int fsfuncparport_yield ( | dev) ; |
struct pardevice * dev
;
This function relinquishes the port if it would be helpful to other
drivers to do so. Afterwards it tries to reclaim the port using
parport_claim
, and the return value is the same as for
parport_claim
. If it fails, the port is left unclaimed and it is
the driver's responsibility to reclaim the port.
The parport_yield
and parport_yield_blocking
functions are for
marking points in the driver at which other drivers may claim the
port and use their devices. Yielding the port is similar to
releasing it and reclaiming it, but is more efficient because no
action is taken if there are no other devices needing the port. In
fact, nothing is done even if there are other devices waiting but
the current device is still within its “timeslice”. The default
timeslice is half a second, but it can be adjusted via the /proc
interface.
parport_yield_blocking — relinquish a parallel port temporarily
int fsfuncparport_yield_blocking ( | dev) ; |
struct pardevice * dev
;parport_wait_event — wait for an event on a parallel port
int fsfuncparport_wait_event ( | port, | |
timeout) ; |
struct parport * port
;signed long timeout
;
This function waits for up to timeout
jiffies for an
interrupt to occur on a parallel port. If the port timeout is
set to zero, it returns immediately.
If an interrupt occurs before the timeout period elapses, this function returns zero immediately. If it times out, it returns one. An error code less than zero indicates an error (most likely a pending signal), and the calling code should finish what it's doing as soon as it can.
parport_wait_peripheral — wait for status lines to change in 35ms
int fsfuncparport_wait_peripheral ( | port, | |
mask, | ||
result) ; |
struct parport * port
;unsigned char mask
;unsigned char result
;
This function waits until the masked status lines have the
desired values, or until 35ms have elapsed (see IEEE 1284-1994
page 24 to 25 for why this value in particular is hardcoded).
The mask
and result
parameters are bitmasks, with the bits
defined by the constants in parport.h: PARPORT_STATUS_BUSY
,
and so on.
The port is polled quickly to start off with, in anticipation
of a fast response from the peripheral. This fast polling
time is configurable (using /proc), and defaults to 500usec.
If the timeout for this port (see parport_set_timeout
) is
zero, the fast polling time is 35ms, and this function does
not call schedule
.
If the timeout for this port is non-zero, after the fast
polling fails it uses parport_wait_event
to wait for up to
10ms, waking up if an interrupt occurs.
parport_negotiate — negotiate an IEEE 1284 mode
int fsfuncparport_negotiate ( | port, | |
mode) ; |
struct parport * port
;int mode
;
Use this to negotiate to a particular IEEE 1284 transfer mode.
The mode
parameter should be one of the constants in
parport.h starting IEEE1284_MODE_xxx
.
The return value is 0 if the peripheral has accepted the negotiation to the mode specified, -1 if the peripheral is not IEEE 1284 compliant (or not present), or 1 if the peripheral has rejected the negotiation.
parport_write — write a block of data to a parallel port
ssize_t fsfuncparport_write ( | port, | |
buffer, | ||
len) ; |
struct parport * port
;const void * buffer
;size_t len
;port
port to write to
buffer
data buffer (in kernel space)
len
number of bytes of data to transfer
This will write up to len
bytes of buffer
to the port
specified, using the IEEE 1284 transfer mode most recently
negotiated to (using parport_negotiate
), as long as that
mode supports forward transfers (host to peripheral).
It is the caller's responsibility to ensure that the first
len
bytes of buffer
are valid.
This function returns the number of bytes transferred (if zero or positive), or else an error code.
parport_read — read a block of data from a parallel port
ssize_t fsfuncparport_read ( | port, | |
buffer, | ||
len) ; |
struct parport * port
;void * buffer
;size_t len
;port
port to read from
buffer
data buffer (in kernel space)
len
number of bytes of data to transfer
This will read up to len
bytes of buffer
to the port
specified, using the IEEE 1284 transfer mode most recently
negotiated to (using parport_negotiate
), as long as that
mode supports reverse transfers (peripheral to host).
It is the caller's responsibility to ensure that the first
len
bytes of buffer
are available to write to.
This function returns the number of bytes transferred (if zero or positive), or else an error code.
parport_set_timeout — set the inactivity timeout for a device
long fsfuncparport_set_timeout ( | dev, | |
inactivity) ; |
struct pardevice * dev
;long inactivity
;
This sets the inactivity timeout for a particular device on a
port. This affects functions like parport_wait_peripheral
.
The special value 0 means not to call schedule
while dealing
with this device.
The return value is the previous inactivity timeout.
Any callers of parport_wait_event
for this device are woken
up.
parport_register_driver — register a parallel port device driver
int fsfuncparport_register_driver ( | drv) ; |
struct parport_driver * drv
;This can be called by a parallel port device driver in order to receive notifications about ports being found in the system, as well as ports no longer available.
The drv
structure is allocated by the caller and must not be
deallocated until after calling parport_unregister_driver
.
The driver's attach
function may block. The port that
attach
is given will be valid for the duration of the
callback, but if the driver wants to take a copy of the
pointer it must call parport_get_port
to do so. Calling
parport_register_device
on that port will do this for you.
The driver's detach
function may block. The port that
detach
is given will be valid for the duration of the
callback, but if the driver wants to take a copy of the
pointer it must call parport_get_port
to do so.
Returns 0 on success. Currently it always succeeds.
parport_unregister_driver — deregister a parallel port device driver
void fsfuncparport_unregister_driver ( | drv) ; |
struct parport_driver * drv
;
This should be called by a parallel port device driver that
has registered itself using parport_register_driver
when it
is about to be unloaded.
When it returns, the driver's attach
routine will no longer
be called, and for each port that attach
was called for, the
detach
routine will have been called.
All the driver's attach
and detach
calls are guaranteed to have
finished by the time this function returns.
parport_get_port — increment a port's reference count
struct parport * fsfuncparport_get_port ( | port) ; |
struct parport * port
;parport_put_port — decrement a port's reference count
void fsfuncparport_put_port ( | port) ; |
struct parport * port
;parport_register_port — register a parallel port
struct parport * fsfuncparport_register_port ( | base, | |
irq, | ||
dma, | ||
ops) ; |
unsigned long base
;int irq
;int dma
;struct parport_operations * ops
;base
base I/O address
irq
IRQ line
dma
DMA channel
ops
pointer to the port driver's port operations structure
When a parallel port (lowlevel) driver finds a port that
should be made available to parallel port device drivers, it
should call parport_register_port
. The base
, irq
, and
dma
parameters are for the convenience of port drivers, and
for ports where they aren't meaningful needn't be set to
anything special. They can be altered afterwards by adjusting
the relevant members of the parport structure that is returned
and represents the port. They should not be tampered with
after calling parport_announce_port, however.
If there are parallel port device drivers in the system that
have registered themselves using parport_register_driver
,
they are not told about the port at this time; that is done by
parport_announce_port
.
The ops
structure is allocated by the caller, and must not be
deallocated before calling parport_remove_port
.
If there is no memory to allocate a new parport structure,
this function will return NULL
.
parport_announce_port — tell device drivers about a parallel port
void fsfuncparport_announce_port ( | port) ; |
struct parport * port
;
After a port driver has registered a parallel port with
parport_register_port, and performed any necessary
initialisation or adjustments, it should call
parport_announce_port
in order to notify all device drivers
that have called parport_register_driver
. Their attach
functions will be called, with port
as the parameter.
parport_remove_port — deregister a parallel port
void fsfuncparport_remove_port ( | port) ; |
struct parport * port
;When a parallel port driver is forcibly unloaded, or a parallel port becomes inaccessible, the port driver must call this function in order to deal with device drivers that still want to use it.
The parport structure associated with the port has its operations structure replaced with one containing 'null' operations that return errors or just don't do anything.
Any drivers that have registered themselves using
parport_register_driver
are notified that the port is no
longer accessible by having their detach
routines called
with port
as the parameter.
parport_register_device — register a device on a parallel port
struct pardevice * fsfuncparport_register_device ( | port, | |
name, | ||
pf, | ||
kf, | ||
irq_func, | ||
flags, | ||
handle) ; |
struct parport * port
;const char * name
;int (*pf)
(
void *)
;void (*kf)
(
void *)
;void (*irq_func)
(
void *)
;int flags
;void * handle
;port
port to which the device is attached
name
a name to refer to the device
pf
preemption callback
kf
kick callback (wake-up)
irq_func
interrupt handler
flags
registration flags
handle
data for callback functions
This function, called by parallel port device drivers, declares that a device is connected to a port, and tells the system all it needs to know.
The name
is allocated by the caller and must not be
deallocated until the caller calls parport_unregister_device
for that device.
The preemption callback function, pf
, is called when this
device driver has claimed access to the port but another
device driver wants to use it. It is given handle
as its
parameter, and should return zero if it is willing for the
system to release the port to another driver on its behalf.
If it wants to keep control of the port it should return
non-zero, and no action will be taken. It is good manners for
the driver to try to release the port at the earliest
opportunity after its preemption callback rejects a preemption
attempt. Note that if a preemption callback is happy for
preemption to go ahead, there is no need to release the port;
it is done automatically. This function may not block, as it
may be called from interrupt context. If the device driver
does not support preemption, pf
can be NULL
.
The wake-up (“kick”) callback function, kf
, is called when
the port is available to be claimed for exclusive access; that
is, parport_claim
is guaranteed to succeed when called from
inside the wake-up callback function. If the driver wants to
claim the port it should do so; otherwise, it need not take
any action. This function may not block, as it may be called
from interrupt context. If the device driver does not want to
be explicitly invited to claim the port in this way, kf
can
be NULL
.
The interrupt handler, irq_func
, is called when an interrupt
arrives from the parallel port. Note that if a device driver
wants to use interrupts it should use parport_enable_irq
,
and can also check the irq member of the parport structure
representing the port.
The parallel port (lowlevel) driver is the one that has called
request_irq
and whose interrupt handler is called first.
This handler does whatever needs to be done to the hardware to
acknowledge the interrupt (for PC-style ports there is nothing
special to be done). It then tells the IEEE 1284 code about
the interrupt, which may involve reacting to an IEEE 1284
event depending on the current IEEE 1284 phase. After this,
it calls irq_func
. Needless to say, irq_func
will be called
from interrupt context, and may not block.
The PARPORT_DEV_EXCL
flag is for preventing port sharing, and
so should only be used when sharing the port with other device
drivers is impossible and would lead to incorrect behaviour.
Use it sparingly! Normally, flags
will be zero.
This function returns a pointer to a structure that represents
the device on the port, or NULL
if there is not enough memory
to allocate space for that structure.
parport_unregister_device — deregister a device on a parallel port
void fsfuncparport_unregister_device ( | dev) ; |
struct pardevice * dev
;parport_find_number — find a parallel port by number
struct parport * fsfuncparport_find_number ( | number) ; |
int number
;parport_find_base — find a parallel port by base address
struct parport * fsfuncparport_find_base ( | base) ; |
unsigned long base
;parport_claim — claim access to a parallel port device
int fsfuncparport_claim ( | dev) ; |
struct pardevice * dev
;
This function will not block and so can be used from interrupt
context. If parport_claim
succeeds in claiming access to
the port it returns zero and the port is available to use. It
may fail (returning non-zero) if the port is in use by another
driver and that driver is not willing to relinquish control of
the port.
parport_claim_or_block — claim access to a parallel port device
int fsfuncparport_claim_or_block ( | dev) ; |
struct pardevice * dev
;parport_release — give up access to a parallel port device
void fsfuncparport_release ( | dev) ; |
struct pardevice * dev
;Table of Contents
mpt_register — Register protocol-specific main callback handler.
u8 fsfuncmpt_register ( | cbfunc, | |
dclass, | ||
func_name) ; |
MPT_CALLBACK cbfunc
;MPT_DRIVER_CLASS dclass
;char * func_name
;cbfunc
callback function pointer
dclass
Protocol driver's class (MPT_DRIVER_CLASS
enum value)
func_name
call function's name
This routine is called by a protocol-specific driver (SCSI host, LAN, SCSI target) to register its reply callback routine. Each protocol-specific driver must do this before it will be able to use any IOC resources, such as obtaining request frames.
The SCSI protocol driver currently calls this routine thrice in order to register separate callbacks; one for “normal” SCSI IO; one for MptScsiTaskMgmt requests; one for Scan/DV requests.
Returns u8 valued “handle” in the range (and S.O.D. order) {N,...,7,6,5,...,1} if successful. A return value of MPT_MAX_PROTOCOL_DRIVERS (including zero!) should be considered an error by the caller.
mpt_deregister — Deregister a protocol drivers resources.
void fsfuncmpt_deregister ( | cb_idx) ; |
u8 cb_idx
;mpt_event_register — Register protocol-specific event callback handler.
int fsfuncmpt_event_register ( | cb_idx, | |
ev_cbfunc) ; |
u8 cb_idx
;MPT_EVHANDLER ev_cbfunc
;mpt_event_deregister — Deregister protocol-specific event callback handler
void fsfuncmpt_event_deregister ( | cb_idx) ; |
u8 cb_idx
;mpt_reset_register — Register protocol-specific IOC reset handler.
int fsfuncmpt_reset_register ( | cb_idx, | |
reset_func) ; |
u8 cb_idx
;MPT_RESETHANDLER reset_func
;mpt_reset_deregister — Deregister protocol-specific IOC reset handler.
void fsfuncmpt_reset_deregister ( | cb_idx) ; |
u8 cb_idx
;mpt_device_driver_register — Register device driver hooks
int fsfuncmpt_device_driver_register ( | dd_cbfunc, | |
cb_idx) ; |
struct mpt_pci_driver * dd_cbfunc
;u8 cb_idx
;mpt_device_driver_deregister — DeRegister device driver hooks
void fsfuncmpt_device_driver_deregister ( | cb_idx) ; |
u8 cb_idx
;mpt_get_msg_frame — Obtain an MPT request frame from the pool
MPT_FRAME_HDR* fsfuncmpt_get_msg_frame ( | cb_idx, | |
ioc) ; |
u8 cb_idx
;MPT_ADAPTER * ioc
;mpt_put_msg_frame — Send a protocol-specific MPT request frame to an IOC
void fsfuncmpt_put_msg_frame ( | cb_idx, | |
ioc, | ||
mf) ; |
u8 cb_idx
;MPT_ADAPTER * ioc
;MPT_FRAME_HDR * mf
;mpt_put_msg_frame_hi_pri — Send a hi-pri protocol-specific MPT request frame
void fsfuncmpt_put_msg_frame_hi_pri ( | cb_idx, | |
ioc, | ||
mf) ; |
u8 cb_idx
;MPT_ADAPTER * ioc
;MPT_FRAME_HDR * mf
;mpt_free_msg_frame — Place MPT request frame back on FreeQ.
void fsfuncmpt_free_msg_frame ( | ioc, | |
mf) ; |
MPT_ADAPTER * ioc
;MPT_FRAME_HDR * mf
;mpt_send_handshake_request — Send MPT request via doorbell handshake method.
int fsfuncmpt_send_handshake_request ( | cb_idx, | |
ioc, | ||
reqBytes, | ||
req, | ||
sleepFlag) ; |
u8 cb_idx
;MPT_ADAPTER * ioc
;int reqBytes
;u32 * req
;int sleepFlag
;cb_idx
Handle of registered MPT protocol driver
ioc
Pointer to MPT adapter structure
reqBytes
Size of the request in bytes
req
Pointer to MPT request frame
sleepFlag
Use schedule if CAN_SLEEP else use udelay.
mpt_verify_adapter — Given IOC identifier, set pointer to its adapter structure.
int fsfuncmpt_verify_adapter ( | iocid, | |
iocpp) ; |
int iocid
;MPT_ADAPTER ** iocpp
;mpt_attach — Install a PCI intelligent MPT adapter.
int fsfuncmpt_attach ( | pdev, | |
id) ; |
struct pci_dev * pdev
;const struct pci_device_id * id
;This routine performs all the steps necessary to bring the IOC of a MPT adapter to a OPERATIONAL state. This includes registering memory regions, registering the interrupt, and allocating request and reply memory pools.
This routine also pre-fetches the LAN MAC address of a Fibre Channel MPT adapter.
Returns 0 for success, non-zero for failure.
mpt_detach — Remove a PCI intelligent MPT adapter.
void fsfuncmpt_detach ( | pdev) ; |
struct pci_dev * pdev
;mpt_suspend — Fusion MPT base driver suspend routine.
int fsfuncmpt_suspend ( | pdev, | |
state) ; |
struct pci_dev * pdev
;pm_message_t state
;mpt_resume — Fusion MPT base driver resume routine.
int fsfuncmpt_resume ( | pdev) ; |
struct pci_dev * pdev
;mpt_GetIocState — Get the current state of a MPT adapter.
u32 fsfuncmpt_GetIocState ( | ioc, | |
cooked) ; |
MPT_ADAPTER * ioc
;int cooked
;mpt_alloc_fw_memory — allocate firmware memory
int fsfuncmpt_alloc_fw_memory ( | ioc, | |
size) ; |
MPT_ADAPTER * ioc
;int size
;mpt_free_fw_memory — free firmware memory
void fsfuncmpt_free_fw_memory ( | ioc) ; |
MPT_ADAPTER * ioc
;mptbase_sas_persist_operation — Perform operation on SAS Persistent Table
int fsfuncmptbase_sas_persist_operation ( | ioc, | |
persist_opcode) ; |
MPT_ADAPTER * ioc
;u8 persist_opcode
;mpt_raid_phys_disk_pg0 — returns phys disk page zero
int fsfuncmpt_raid_phys_disk_pg0 ( | ioc, | |
phys_disk_num, | ||
phys_disk) ; |
MPT_ADAPTER * ioc
;u8 phys_disk_num
;RaidPhysDiskPage0_t * phys_disk
;mpt_raid_phys_disk_get_num_paths — returns number paths associated to this phys_num
int fsfuncmpt_raid_phys_disk_get_num_paths ( | ioc, | |
phys_disk_num) ; |
MPT_ADAPTER * ioc
;u8 phys_disk_num
;mpt_raid_phys_disk_pg1 — returns phys disk page 1
int fsfuncmpt_raid_phys_disk_pg1 ( | ioc, | |
phys_disk_num, | ||
phys_disk) ; |
MPT_ADAPTER * ioc
;u8 phys_disk_num
;RaidPhysDiskPage1_t * phys_disk
;mpt_findImVolumes — Identify IDs of hidden disks and RAID Volumes
int fsfuncmpt_findImVolumes ( | ioc) ; |
MPT_ADAPTER * ioc
;mpt_config — Generic function to issue config message
int fsfuncmpt_config ( | ioc, | |
pCfg) ; |
MPT_ADAPTER * ioc
;CONFIGPARMS * pCfg
;mpt_print_ioc_summary — Write ASCII summary of IOC to a buffer.
void fsfuncmpt_print_ioc_summary ( | ioc, | |
buffer, | ||
size, | ||
len, | ||
showlan) ; |
MPT_ADAPTER * ioc
;char * buffer
;int * size
;int len
;int showlan
;mpt_set_taskmgmt_in_progress_flag — set flags associated with task management
int fsfuncmpt_set_taskmgmt_in_progress_flag ( | ioc) ; |
MPT_ADAPTER * ioc
;mpt_clear_taskmgmt_in_progress_flag — clear flags associated with task management
void fsfuncmpt_clear_taskmgmt_in_progress_flag ( | ioc) ; |
MPT_ADAPTER * ioc
;mpt_halt_firmware — Halts the firmware if it is operational and panic the kernel
void fsfuncmpt_halt_firmware ( | ioc) ; |
MPT_ADAPTER * ioc
;mpt_Soft_Hard_ResetHandler — Try less expensive reset
int fsfuncmpt_Soft_Hard_ResetHandler ( | ioc, | |
sleepFlag) ; |
MPT_ADAPTER * ioc
;int sleepFlag
;mpt_HardResetHandler — Generic reset handler
int fsfuncmpt_HardResetHandler ( | ioc, | |
sleepFlag) ; |
MPT_ADAPTER * ioc
;int sleepFlag
;ioc
Pointer to MPT_ADAPTER structure
sleepFlag
Indicates if sleep or schedule must be called.
Issues SCSI Task Management call based on input arg values. If TaskMgmt fails, returns associated SCSI request.
mpt_get_cb_idx — obtain cb_idx for registered driver
u8 fsfuncmpt_get_cb_idx ( | dclass) ; |
MPT_DRIVER_CLASS dclass
;mpt_is_discovery_complete — determine if discovery has completed
int fsfuncmpt_is_discovery_complete ( | ioc) ; |
MPT_ADAPTER * ioc
;mpt_remove_dead_ioc_func — kthread context to remove dead ioc
int fsfuncmpt_remove_dead_ioc_func ( | arg) ; |
void * arg
;mpt_fault_reset_work — work performed on workq after ioc fault
void fsfuncmpt_fault_reset_work ( | work) ; |
struct work_struct * work
;mpt_interrupt — MPT adapter (IOC) specific interrupt handler.
irqreturn_t fsfuncmpt_interrupt ( | irq, | |
bus_id) ; |
int irq
;void * bus_id
;
This routine is registered via the request_irq
kernel API call,
and handles all interrupts generated from a specific MPT adapter
(also referred to as a IO Controller or IOC).
This routine must clear the interrupt from the adapter and does
so by reading the reply FIFO. Multiple replies may be processed
per single call to this routine.
This routine handles register-level access of the adapter but dispatches (calls) a protocol-specific callback routine to handle the protocol-specific details of the MPT request completion.
mptbase_reply — MPT base driver's callback routine
int fsfuncmptbase_reply ( | ioc, | |
req, | ||
reply) ; |
MPT_ADAPTER * ioc
;MPT_FRAME_HDR * req
;MPT_FRAME_HDR * reply
;mpt_add_sge — Place a simple 32 bit SGE at address pAddr.
void fsfuncmpt_add_sge ( | pAddr, | |
flagslength, | ||
dma_addr) ; |
void * pAddr
;u32 flagslength
;dma_addr_t dma_addr
;mpt_add_sge_64bit — Place a simple 64 bit SGE at address pAddr.
void fsfuncmpt_add_sge_64bit ( | pAddr, | |
flagslength, | ||
dma_addr) ; |
void * pAddr
;u32 flagslength
;dma_addr_t dma_addr
;mpt_add_sge_64bit_1078 — Place a simple 64 bit SGE at address pAddr (1078 workaround).
void fsfuncmpt_add_sge_64bit_1078 ( | pAddr, | |
flagslength, | ||
dma_addr) ; |
void * pAddr
;u32 flagslength
;dma_addr_t dma_addr
;mpt_add_chain — Place a 32 bit chain SGE at address pAddr.
void fsfuncmpt_add_chain ( | pAddr, | |
next, | ||
length, | ||
dma_addr) ; |
void * pAddr
;u8 next
;u16 length
;dma_addr_t dma_addr
;mpt_add_chain_64bit — Place a 64 bit chain SGE at address pAddr.
void fsfuncmpt_add_chain_64bit ( | pAddr, | |
next, | ||
length, | ||
dma_addr) ; |
void * pAddr
;u8 next
;u16 length
;dma_addr_t dma_addr
;mpt_host_page_access_control — control the IOC's Host Page Buffer access
int fsfuncmpt_host_page_access_control ( | ioc, | |
access_control_value, | ||
sleepFlag) ; |
MPT_ADAPTER * ioc
;u8 access_control_value
;int sleepFlag
;ioc
Pointer to MPT adapter structure
access_control_value
define bits below
sleepFlag
Specifies whether the process can sleep
Provides mechanism for the host driver to control the IOC's Host Page Buffer access.
Access Control Value - bits[15:12] 0h Reserved 1h Enable Access { MPI_DB_HPBAC_ENABLE_ACCESS } 2h Disable Access { MPI_DB_HPBAC_DISABLE_ACCESS } 3h Free Buffer { MPI_DB_HPBAC_FREE_BUFFER }
Returns 0 for success, non-zero for failure.
mpt_host_page_alloc — allocate system memory for the fw
int fsfuncmpt_host_page_alloc ( | ioc, | |
ioc_init) ; |
MPT_ADAPTER * ioc
;pIOCInit_t ioc_init
;mpt_get_product_name — returns product string
void fsfuncmpt_get_product_name ( | vendor, | |
device, | ||
revision, | ||
prod_name) ; |
u16 vendor
;u16 device
;u8 revision
;char * prod_name
;mpt_mapresources — map in memory mapped io
int fsfuncmpt_mapresources ( | ioc) ; |
MPT_ADAPTER * ioc
;mpt_do_ioc_recovery — Initialize or recover MPT adapter.
int fsfuncmpt_do_ioc_recovery ( | ioc, | |
reason, | ||
sleepFlag) ; |
MPT_ADAPTER * ioc
;u32 reason
;int sleepFlag
;ioc
Pointer to MPT adapter structure
reason
Event word / reason
sleepFlag
Use schedule if CAN_SLEEP else use udelay.
mpt_detect_bound_ports — Search for matching PCI bus/dev_function
void fsfuncmpt_detect_bound_ports ( | ioc, | |
pdev) ; |
MPT_ADAPTER * ioc
;struct pci_dev * pdev
;mpt_adapter_disable — Disable misbehaving MPT adapter.
void fsfuncmpt_adapter_disable ( | ioc) ; |
MPT_ADAPTER * ioc
;mpt_adapter_dispose — Free all resources associated with an MPT adapter
void fsfuncmpt_adapter_dispose ( | ioc) ; |
MPT_ADAPTER * ioc
;MptDisplayIocCapabilities — Disply IOC's capabilities.
void fsfuncMptDisplayIocCapabilities ( | ioc) ; |
MPT_ADAPTER * ioc
;MakeIocReady — Get IOC to a READY state, using KickStart if needed.
int fsfuncMakeIocReady ( | ioc, | |
force, | ||
sleepFlag) ; |
MPT_ADAPTER * ioc
;int force
;int sleepFlag
;GetIocFacts — Send IOCFacts request to MPT adapter.
int fsfuncGetIocFacts ( | ioc, | |
sleepFlag, | ||
reason) ; |
MPT_ADAPTER * ioc
;int sleepFlag
;int reason
;GetPortFacts — Send PortFacts request to MPT adapter.
int fsfuncGetPortFacts ( | ioc, | |
portnum, | ||
sleepFlag) ; |
MPT_ADAPTER * ioc
;int portnum
;int sleepFlag
;SendIocInit — Send IOCInit request to MPT adapter.
int fsfuncSendIocInit ( | ioc, | |
sleepFlag) ; |
MPT_ADAPTER * ioc
;int sleepFlag
;SendPortEnable — Send PortEnable request to MPT adapter port.
int fsfuncSendPortEnable ( | ioc, | |
portnum, | ||
sleepFlag) ; |
MPT_ADAPTER * ioc
;int portnum
;int sleepFlag
;mpt_do_upload — Construct and Send FWUpload request to MPT adapter port.
int fsfuncmpt_do_upload ( | ioc, | |
sleepFlag) ; |
MPT_ADAPTER * ioc
;int sleepFlag
;mpt_downloadboot — DownloadBoot code
int fsfuncmpt_downloadboot ( | ioc, | |
pFwHeader, | ||
sleepFlag) ; |
MPT_ADAPTER * ioc
;MpiFwHeader_t * pFwHeader
;int sleepFlag
;KickStart — Perform hard reset of MPT adapter.
int fsfuncKickStart ( | ioc, | |
force, | ||
sleepFlag) ; |
MPT_ADAPTER * ioc
;int force
;int sleepFlag
;ioc
Pointer to MPT_ADAPTER structure
force
Force hard reset
sleepFlag
Specifies whether the process can sleep
This routine places MPT adapter in diagnostic mode via the WriteSequence register, and then performs a hard reset of adapter via the Diagnostic register.
mpt_diag_reset — Perform hard reset of the adapter.
int fsfuncmpt_diag_reset ( | ioc, | |
ignore, | ||
sleepFlag) ; |
MPT_ADAPTER * ioc
;int ignore
;int sleepFlag
;ioc
Pointer to MPT_ADAPTER structure
ignore
Set if to honor and clear to ignore the reset history bit
sleepFlag
CAN_SLEEP if called in a non-interrupt thread, else set to NO_SLEEP (use mdelay instead)
SendIocReset — Send IOCReset request to MPT adapter.
int fsfuncSendIocReset ( | ioc, | |
reset_type, | ||
sleepFlag) ; |
MPT_ADAPTER * ioc
;u8 reset_type
;int sleepFlag
;initChainBuffers — Allocate memory for and initialize chain buffers
int fsfuncinitChainBuffers ( | ioc) ; |
MPT_ADAPTER * ioc
;PrimeIocFifos — Initialize IOC request and reply FIFOs.
int fsfuncPrimeIocFifos ( | ioc) ; |
MPT_ADAPTER * ioc
;mpt_handshake_req_reply_wait — Send MPT request to and receive reply from IOC via doorbell handshake method.
int fsfuncmpt_handshake_req_reply_wait ( | ioc, | |
reqBytes, | ||
req, | ||
replyBytes, | ||
u16reply, | ||
maxwait, | ||
sleepFlag) ; |
MPT_ADAPTER * ioc
;int reqBytes
;u32 * req
;int replyBytes
;u16 * u16reply
;int maxwait
;int sleepFlag
;ioc
Pointer to MPT_ADAPTER structure
reqBytes
Size of the request in bytes
req
Pointer to MPT request frame
replyBytes
Expected size of the reply in bytes
u16reply
Pointer to area where reply should be written
maxwait
Max wait time for a reply (in seconds)
sleepFlag
Specifies whether the process can sleep
WaitForDoorbellAck — Wait for IOC doorbell handshake acknowledge
int fsfuncWaitForDoorbellAck ( | ioc, | |
howlong, | ||
sleepFlag) ; |
MPT_ADAPTER * ioc
;int howlong
;int sleepFlag
;WaitForDoorbellInt — Wait for IOC to set its doorbell interrupt bit
int fsfuncWaitForDoorbellInt ( | ioc, | |
howlong, | ||
sleepFlag) ; |
MPT_ADAPTER * ioc
;int howlong
;int sleepFlag
;WaitForDoorbellReply — Wait for and capture an IOC handshake reply.
int fsfuncWaitForDoorbellReply ( | ioc, | |
howlong, | ||
sleepFlag) ; |
MPT_ADAPTER * ioc
;int howlong
;int sleepFlag
;GetLanConfigPages — Fetch LANConfig pages.
int fsfuncGetLanConfigPages ( | ioc) ; |
MPT_ADAPTER * ioc
;GetIoUnitPage2 — Retrieve BIOS version and boot order information.
int fsfuncGetIoUnitPage2 ( | ioc) ; |
MPT_ADAPTER * ioc
;mpt_GetScsiPortSettings — read SCSI Port Page 0 and 2
int fsfuncmpt_GetScsiPortSettings ( | ioc, | |
portnum) ; |
MPT_ADAPTER * ioc
;int portnum
;mpt_readScsiDevicePageHeaders — save version and length of SDP1
int fsfuncmpt_readScsiDevicePageHeaders ( | ioc, | |
portnum) ; |
MPT_ADAPTER * ioc
;int portnum
;mpt_inactive_raid_list_free — This clears this link list.
void fsfuncmpt_inactive_raid_list_free ( | ioc) ; |
MPT_ADAPTER * ioc
;mpt_inactive_raid_volumes — sets up link list of phy_disk_nums for devices belonging in an inactive volume
void fsfuncmpt_inactive_raid_volumes ( | ioc, | |
channel, | ||
id) ; |
MPT_ADAPTER * ioc
;u8 channel
;u8 id
;SendEventNotification — Send EventNotification (on or off) request to adapter
int fsfuncSendEventNotification ( | ioc, | |
EvSwitch, | ||
sleepFlag) ; |
MPT_ADAPTER * ioc
;u8 EvSwitch
;int sleepFlag
;SendEventAck — Send EventAck request to MPT adapter.
int fsfuncSendEventAck ( | ioc, | |
evnp) ; |
MPT_ADAPTER * ioc
;EventNotificationReply_t * evnp
;mpt_ioc_reset — Base cleanup for hard reset
int fsfuncmpt_ioc_reset ( | ioc, | |
reset_phase) ; |
MPT_ADAPTER * ioc
;int reset_phase
;procmpt_create —
Create MPT_PROCFS_MPTBASEDIR
entries.
int fsfuncprocmpt_create ( | void) ; |
void
;procmpt_destroy —
Tear down MPT_PROCFS_MPTBASEDIR
entries.
void fsfuncprocmpt_destroy ( | void) ; |
void
;mpt_SoftResetHandler — Issues a less expensive reset
int fsfuncmpt_SoftResetHandler ( | ioc, | |
sleepFlag) ; |
MPT_ADAPTER * ioc
;int sleepFlag
;ioc
Pointer to MPT_ADAPTER structure
sleepFlag
Indicates if sleep or schedule must be called.
Returns 0 for SUCCESS or -1 if FAILED.
Message Unit Reset - instructs the IOC to reset the Reply Post and Free FIFO's. All the Message Frames on Reply Free FIFO are discarded. All posted buffers are freed, and event notification is turned off. IOC doesn't reply to any outstanding request. This will transfer IOC to READY state.
ProcessEventNotification — Route EventNotificationReply to all event handlers
int fsfuncProcessEventNotification ( | ioc, | |
pEventReply, | ||
evHandlers) ; |
MPT_ADAPTER * ioc
;EventNotificationReply_t * pEventReply
;int * evHandlers
;mpt_fc_log_info — Log information returned from Fibre Channel IOC.
void fsfuncmpt_fc_log_info ( | ioc, | |
log_info) ; |
MPT_ADAPTER * ioc
;u32 log_info
;mpt_spi_log_info — Log information returned from SCSI Parallel IOC.
void fsfuncmpt_spi_log_info ( | ioc, | |
log_info) ; |
MPT_ADAPTER * ioc
;u32 log_info
;mpt_sas_log_info — Log information returned from SAS IOC.
void fsfuncmpt_sas_log_info ( | ioc, | |
log_info, | ||
cb_idx) ; |
MPT_ADAPTER * ioc
;u32 log_info
;u8 cb_idx
;mpt_iocstatus_info_config — IOCSTATUS information for config pages
void fsfuncmpt_iocstatus_info_config ( | ioc, | |
ioc_status, | ||
mf) ; |
MPT_ADAPTER * ioc
;u32 ioc_status
;MPT_FRAME_HDR * mf
;mpt_iocstatus_info — IOCSTATUS information returned from IOC.
void fsfuncmpt_iocstatus_info ( | ioc, | |
ioc_status, | ||
mf) ; |
MPT_ADAPTER * ioc
;u32 ioc_status
;MPT_FRAME_HDR * mf
;fusion_init — Fusion MPT base driver initialization routine.
int fsfuncfusion_init ( | void) ; |
void
;fusion_exit — Perform driver unload cleanup.
void __exit fsfuncfusion_exit ( | void) ; |
void
;mptscsih_info — Return information about MPT adapter
const char * fsfuncmptscsih_info ( | SChost) ; |
struct Scsi_Host * SChost
;mptscsih_qcmd — Primary Fusion MPT SCSI initiator IO start routine.
int fsfuncmptscsih_qcmd ( | SCpnt, | |
done) ; |
struct scsi_cmnd * SCpnt
;void (*done)
(
struct scsi_cmnd *)
;mptscsih_IssueTaskMgmt — Generic send Task Management function.
int fsfuncmptscsih_IssueTaskMgmt ( | hd, | |
type, | ||
channel, | ||
id, | ||
lun, | ||
ctx2abort, | ||
timeout) ; |
MPT_SCSI_HOST * hd
;u8 type
;u8 channel
;u8 id
;int lun
;int ctx2abort
;ulong timeout
;hd
Pointer to MPT_SCSI_HOST structure
type
Task Management type
channel
channel number for task management
id
Logical Target ID for reset (if appropriate)
lun
Logical Unit for reset (if appropriate)
ctx2abort
Context for the task to be aborted (if appropriate)
timeout
timeout for task management control
mptscsih_abort — Abort linux scsi_cmnd routine, new_eh variant
int fsfuncmptscsih_abort ( | SCpnt) ; |
struct scsi_cmnd * SCpnt
;mptscsih_dev_reset — Perform a SCSI TARGET_RESET! new_eh variant
int fsfuncmptscsih_dev_reset ( | SCpnt) ; |
struct scsi_cmnd * SCpnt
;mptscsih_bus_reset — Perform a SCSI BUS_RESET! new_eh variant
int fsfuncmptscsih_bus_reset ( | SCpnt) ; |
struct scsi_cmnd * SCpnt
;mptscsih_host_reset — Perform a SCSI host adapter RESET (new_eh variant)
int fsfuncmptscsih_host_reset ( | SCpnt) ; |
struct scsi_cmnd * SCpnt
;mptscsih_taskmgmt_complete — Registered with Fusion MPT base driver
int fsfuncmptscsih_taskmgmt_complete ( | ioc, | |
mf, | ||
mr) ; |
MPT_ADAPTER * ioc
;MPT_FRAME_HDR * mf
;MPT_FRAME_HDR * mr
;mptscsih_get_scsi_lookup — retrieves scmd entry
struct scsi_cmnd * fsfuncmptscsih_get_scsi_lookup ( | ioc, | |
i) ; |
MPT_ADAPTER * ioc
;int i
;mptscsih_info_scsiio — debug print info on reply frame
void fsfuncmptscsih_info_scsiio ( | ioc, | |
sc, | ||
pScsiReply) ; |
MPT_ADAPTER * ioc
;struct scsi_cmnd * sc
;SCSIIOReply_t * pScsiReply
;mptscsih_getclear_scsi_lookup — retrieves and clears scmd entry from ScsiLookup[] array list
struct scsi_cmnd * fsfuncmptscsih_getclear_scsi_lookup ( | ioc, | |
i) ; |
MPT_ADAPTER * ioc
;int i
;mptscsih_set_scsi_lookup — write a scmd entry into the ScsiLookup[] array list
void fsfuncmptscsih_set_scsi_lookup ( | ioc, | |
i, | ||
scmd) ; |
MPT_ADAPTER * ioc
;int i
;struct scsi_cmnd * scmd
;SCPNT_TO_LOOKUP_IDX — searches for a given scmd in the ScsiLookup[] array list
int fsfuncSCPNT_TO_LOOKUP_IDX ( | ioc, | |
sc) ; |
MPT_ADAPTER * ioc
;struct scsi_cmnd * sc
;mptscsih_get_completion_code — get completion code from MPT request
int fsfuncmptscsih_get_completion_code ( | ioc, | |
req, | ||
reply) ; |
MPT_ADAPTER * ioc
;MPT_FRAME_HDR * req
;MPT_FRAME_HDR * reply
;mptscsih_do_cmd — Do internal command.
int fsfuncmptscsih_do_cmd ( | hd, | |
io) ; |
MPT_SCSI_HOST * hd
;INTERNAL_CMD * io
;mptscsih_synchronize_cache — Send SYNCHRONIZE_CACHE to all disks.
void fsfuncmptscsih_synchronize_cache ( | hd, | |
vdevice) ; |
MPT_SCSI_HOST * hd
;VirtDevice * vdevice
;mptctl_syscall_down — Down the MPT adapter syscall semaphore.
int fsfuncmptctl_syscall_down ( | ioc, | |
nonblock) ; |
MPT_ADAPTER * ioc
;int nonblock
;mptspi_setTargetNegoParms — Update the target negotiation parameters
void fsfuncmptspi_setTargetNegoParms ( | hd, | |
target, | ||
sdev) ; |
MPT_SCSI_HOST * hd
;VirtTarget * target
;struct scsi_device * sdev
;mptspi_writeIOCPage4 — write IOC Page 4
int fsfuncmptspi_writeIOCPage4 ( | hd, | |
channel, | ||
id) ; |
MPT_SCSI_HOST * hd
;u8 channel
;u8 id
;mptspi_initTarget — Target, LUN alloc/free functionality.
void fsfuncmptspi_initTarget ( | hd, | |
vtarget, | ||
sdev) ; |
MPT_SCSI_HOST * hd
;VirtTarget * vtarget
;struct scsi_device * sdev
;mptspi_is_raid — Determines whether target is belonging to volume
int fsfuncmptspi_is_raid ( | hd, | |
id) ; |
struct _MPT_SCSI_HOST * hd
;u32 id
;mptspi_print_write_nego — negotiation parameters debug info that is being sent
void fsfuncmptspi_print_write_nego ( | hd, | |
starget, | ||
ii) ; |
struct _MPT_SCSI_HOST * hd
;struct scsi_target * starget
;u32 ii
;mptspi_print_read_nego — negotiation parameters debug info that is being read
void fsfuncmptspi_print_read_nego ( | hd, | |
starget, | ||
ii) ; |
struct _MPT_SCSI_HOST * hd
;struct scsi_target * starget
;u32 ii
;mptspi_init — Register MPT adapter(s) as SCSI host(s) with SCSI mid-layer.
int fsfuncmptspi_init ( | void) ; |
void
;mptfc_init — Register MPT adapter(s) as SCSI host(s) with SCSI mid-layer.
int fsfuncmptfc_init ( | void) ; |
void
;mptfc_remove — Remove fc infrastructure for devices
void fsfuncmptfc_remove ( | pdev) ; |
struct pci_dev * pdev
;lan_reply — Handle all data sent from the hardware.
int fsfunclan_reply ( | ioc, | |
mf, | ||
reply) ; |
MPT_ADAPTER * ioc
;MPT_FRAME_HDR * mf
;MPT_FRAME_HDR * reply
;i2o_driver_notify_controller_add — Send notification of added controller
void fsfunci2o_driver_notify_controller_add ( | drv, | |
c) ; |
struct i2o_driver * drv
;struct i2o_controller * c
;i2o_driver_notify_controller_remove — Send notification of removed controller
void fsfunci2o_driver_notify_controller_remove ( | drv, | |
c) ; |
struct i2o_driver * drv
;struct i2o_controller * c
;i2o_driver_notify_device_add — Send notification of added device
void fsfunci2o_driver_notify_device_add ( | drv, | |
i2o_dev) ; |
struct i2o_driver * drv
;struct i2o_device * i2o_dev
;i2o_driver_notify_device_remove — Send notification of removed device
void fsfunci2o_driver_notify_device_remove ( | drv, | |
i2o_dev) ; |
struct i2o_driver * drv
;struct i2o_device * i2o_dev
;i2o_msg_out_to_virt — Turn an I2O message to a virtual address
struct i2o_message * fsfunci2o_msg_out_to_virt ( | c, | |
m) ; |
struct i2o_controller * c
;u32 m
;i2o_msg_in_to_virt — Turn an I2O message to a virtual address
struct i2o_message __iomem * fsfunci2o_msg_in_to_virt ( | c, | |
m) ; |
struct i2o_controller * c
;u32 m
;i2o_msg_get — obtain an I2O message from the IOP
struct i2o_message * fsfunci2o_msg_get ( | c) ; |
struct i2o_controller * c
;
This function tries to get a message frame. If no message frame is
available do not wait until one is available (see also i2o_msg_get_wait).
The returned pointer to the message frame is not in I/O memory, it is
allocated from a mempool. But because a MFA is allocated from the
controller too it is guaranteed that i2o_msg_post
will never fail.
On a success a pointer to the message frame is returned. If the message queue is empty -EBUSY is returned and if no memory is available -ENOMEM is returned.
i2o_msg_post — Post I2O message to I2O controller
void fsfunci2o_msg_post ( | c, | |
msg) ; |
struct i2o_controller * c
;struct i2o_message * msg
;i2o_msg_post_wait — Post and wait a message and wait until return
int fsfunci2o_msg_post_wait ( | c, | |
msg, | ||
timeout) ; |
struct i2o_controller * c
;struct i2o_message * msg
;unsigned long timeout
;i2o_msg_nop_mfa — Returns a fetched MFA back to the controller
void fsfunci2o_msg_nop_mfa ( | c, | |
mfa) ; |
struct i2o_controller * c
;u32 mfa
;i2o_msg_nop — Returns a message which is not used
void fsfunci2o_msg_nop ( | c, | |
msg) ; |
struct i2o_controller * c
;struct i2o_message * msg
;i2o_flush_reply — Flush reply from I2O controller
void fsfunci2o_flush_reply ( | c, | |
m) ; |
struct i2o_controller * c
;u32 m
;i2o_iop_free — Free the i2o_controller struct
void fsfunci2o_iop_free ( | c) ; |
struct i2o_controller * c
;i2o_msg_get_wait — obtain an I2O message from the IOP
struct i2o_message * fsfunci2o_msg_get_wait ( | c, | |
wait) ; |
struct i2o_controller * c
;int wait
;This function waits up to wait seconds for a message slot to be available.
On a success the message is returned and the pointer to the message is set in msg. The returned message is the physical page frame offset address from the read port (see the i2o spec). If no message is available returns I2O_QUEUE_EMPTY and msg is leaved untouched.
i2o_cntxt_list_add — Append a pointer to context list and return a id
u32 fsfunci2o_cntxt_list_add ( | c, | |
ptr) ; |
struct i2o_controller * c
;void * ptr
;i2o_cntxt_list_remove — Remove a pointer from the context list
u32 fsfunci2o_cntxt_list_remove ( | c, | |
ptr) ; |
struct i2o_controller * c
;void * ptr
;i2o_cntxt_list_get — Get a pointer from the context list and remove it
void * fsfunci2o_cntxt_list_get ( | c, | |
context) ; |
struct i2o_controller * c
;u32 context
;i2o_cntxt_list_get_ptr — Get a context id from the context list
u32 fsfunci2o_cntxt_list_get_ptr ( | c, | |
ptr) ; |
struct i2o_controller * c
;void * ptr
;i2o_find_iop — Find an I2O controller by id
struct i2o_controller * fsfunci2o_find_iop ( | unit) ; |
int unit
;i2o_iop_find_device — Find a I2O device on an I2O controller
struct i2o_device * fsfunci2o_iop_find_device ( | c, | |
tid) ; |
struct i2o_controller * c
;u16 tid
;i2o_status_get — Get the status block from the I2O controller
int fsfunci2o_status_get ( | c) ; |
struct i2o_controller * c
;i2o_event_register — Turn on/off event notification for a I2O device
int fsfunci2o_event_register ( | dev, | |
drv, | ||
tcntxt, | ||
evt_mask) ; |
struct i2o_device * dev
;struct i2o_driver * drv
;int tcntxt
;u32 evt_mask
;i2o_iop_quiesce — quiesce controller
int fsfunci2o_iop_quiesce ( | c) ; |
struct i2o_controller * c
;i2o_iop_enable — move controller from ready to OPERATIONAL
int fsfunci2o_iop_enable ( | c) ; |
struct i2o_controller * c
;i2o_iop_quiesce_all — Quiesce all I2O controllers on the system
void fsfunci2o_iop_quiesce_all ( | void) ; |
void
;i2o_iop_enable_all — Enables all controllers on the system
void fsfunci2o_iop_enable_all ( | void) ; |
void
;i2o_iop_clear — Bring I2O controller into HOLD state
int fsfunci2o_iop_clear ( | c) ; |
struct i2o_controller * c
;Clear an IOP to HOLD state, ie. terminate external operations, clear all input queues and prepare for a system restart. IOP's internal operation continues normally and the outbound queue is alive. The IOP is not expected to rebuild its LCT.
Returns 0 on success or negative error code on failure.
i2o_iop_init_outbound_queue — setup the outbound message queue
int fsfunci2o_iop_init_outbound_queue ( | c) ; |
struct i2o_controller * c
;i2o_iop_reset — reset an I2O controller
int fsfunci2o_iop_reset ( | c) ; |
struct i2o_controller * c
;i2o_iop_activate — Bring controller up to HOLD
int fsfunci2o_iop_activate ( | c) ; |
struct i2o_controller * c
;i2o_iop_systab_set — Set the I2O System Table of the specified IOP
int fsfunci2o_iop_systab_set ( | c) ; |
struct i2o_controller * c
;i2o_iop_online — Bring a controller online into OPERATIONAL state.
int fsfunci2o_iop_online ( | c) ; |
struct i2o_controller * c
;i2o_iop_remove — Remove the I2O controller from the I2O core
void fsfunci2o_iop_remove ( | c) ; |
struct i2o_controller * c
;i2o_systab_build — Build system table
int fsfunci2o_systab_build ( | void) ; |
void
;
The system table contains information about all the IOPs in the system (duh) and is used by the Executives on the IOPs to establish peer2peer connections. We're not supporting peer2peer at the moment, but this will be needed down the road for things like lan2lan forwarding.
Returns 0 on success or negative error code on failure.
i2o_parse_hrt — Parse the hardware resource table.
int fsfunci2o_parse_hrt ( | c) ; |
struct i2o_controller * c
;i2o_iop_release — release the memory for a I2O controller
void fsfunci2o_iop_release ( | dev) ; |
struct device * dev
;i2o_iop_alloc — Allocate and initialize a i2o_controller struct
struct i2o_controller * fsfunci2o_iop_alloc ( | void) ; |
void
;i2o_iop_add — Initialize the I2O controller and add him to the I2O core
int fsfunci2o_iop_add ( | c) ; |
struct i2o_controller * c
;i2o_config_init — Configuration OSM initialization function
int fsfunci2o_config_init ( | void) ; |
void
;i2o_config_exit — Configuration OSM exit function
void fsfunci2o_config_exit ( | void) ; |
void
;i2o_msg_post_wait_mem — Post and wait a message with DMA buffers
int fsfunci2o_msg_post_wait_mem ( | c, | |
msg, | ||
timeout, | ||
dma) ; |
struct i2o_controller * c
;struct i2o_message * msg
;unsigned long timeout
;struct i2o_dma * dma
;c
controller
msg
message to post
timeout
time in seconds to wait
dma
i2o_dma struct of the DMA buffer to free on failure
This API allows an OSM to post a message and then be told whether or not the system received a successful reply. If the message times out then the value '-ETIMEDOUT' is returned. This is a special case. In this situation the message may (should) complete at an indefinite time in the future. When it completes it will use the memory buffer attached to the request. If -ETIMEDOUT is returned then the memory buffer must not be freed. Instead the event completion will free them for you. In all other cases the buffer are your problem.
Returns 0 on success, negative error code on timeout or positive error code from reply.
i2o_exec_lct_get — Get the IOP's Logical Configuration Table
int fsfunci2o_exec_lct_get ( | c) ; |
struct i2o_controller * c
;i2o_exec_wait_alloc — Allocate a i2o_exec_wait struct an initialize it
struct i2o_exec_wait * fsfunci2o_exec_wait_alloc ( | void) ; |
void
;i2o_exec_wait_free — Free an i2o_exec_wait struct
void fsfunci2o_exec_wait_free ( | wait) ; |
struct i2o_exec_wait * wait
;i2o_msg_post_wait_complete — Reply to a i2o_msg_post request from IOP
int fsfunci2o_msg_post_wait_complete ( | c, | |
m, | ||
msg, | ||
context) ; |
struct i2o_controller * c
;u32 m
;struct i2o_message * msg
;u32 context
;c
I2O controller which answers
m
message id
msg
pointer to the I2O reply message
context
transaction context of request
This function is called in interrupt context only. If the reply reached before the timeout, the i2o_exec_wait struct is filled with the message and the task will be waked up. The task is now responsible for returning the message m back to the controller! If the message reaches us after the timeout clean up the i2o_exec_wait struct (including allocated DMA buffer).
Return 0 on success and if the message m should not be given back to the I2O controller, or >0 on success and if the message should be given back afterwords. Returns negative error code on failure. In this case the message must also be given back to the controller.
i2o_exec_show_vendor_id — Displays Vendor ID of controller
ssize_t fsfunci2o_exec_show_vendor_id ( | d, | |
attr, | ||
buf) ; |
struct device * d
;struct device_attribute * attr
;char * buf
;i2o_exec_show_product_id — Displays Product ID of controller
ssize_t fsfunci2o_exec_show_product_id ( | d, | |
attr, | ||
buf) ; |
struct device * d
;struct device_attribute * attr
;char * buf
;i2o_exec_probe — Called if a new I2O device (executive class) appears
int fsfunci2o_exec_probe ( | dev) ; |
struct device * dev
;i2o_exec_remove — Called on I2O device removal
int fsfunci2o_exec_remove ( | dev) ; |
struct device * dev
;i2o_exec_lct_notify — Send a asynchronus LCT NOTIFY request
int fsfunci2o_exec_lct_notify ( | c, | |
change_ind) ; |
struct i2o_controller * c
;u32 change_ind
;i2o_exec_lct_modified — Called on LCT NOTIFY reply
void fsfunci2o_exec_lct_modified ( | _work) ; |
struct work_struct * _work
;i2o_exec_reply — I2O Executive reply handler
int fsfunci2o_exec_reply ( | c, | |
m, | ||
msg) ; |
struct i2o_controller * c
;u32 m
;struct i2o_message * msg
;c
I2O controller from which the reply comes
m
message id
msg
pointer to the I2O reply message
This function is always called from interrupt context. If a POST WAIT reply was received, pass it to the complete function. If a LCT NOTIFY reply was received, a new event is created to handle the update.
Returns 0 on success and if the reply should not be flushed or > 0 on success and if the reply should be flushed. Returns negative error code on failure and if the reply should be flushed.
i2o_exec_event — Event handling function
void fsfunci2o_exec_event ( | work) ; |
struct work_struct * work
;i2o_bus_scan — Scan the bus for new devices
int fsfunci2o_bus_scan ( | dev) ; |
struct i2o_device * dev
;i2o_bus_store_scan — Scan the I2O Bus Adapter
ssize_t fsfunci2o_bus_store_scan ( | d, | |
attr, | ||
buf, | ||
count) ; |
struct device * d
;struct device_attribute * attr
;const char * buf
;size_t count
;i2o_bus_probe — verify if dev is a I2O Bus Adapter device and install it
int fsfunci2o_bus_probe ( | dev) ; |
struct device * dev
;i2o_bus_remove — remove the I2O Bus Adapter device from the system again
int fsfunci2o_bus_remove ( | dev) ; |
struct device * dev
;i2o_bus_init — Bus Adapter OSM initialization function
int fsfunci2o_bus_init ( | void) ; |
void
;i2o_bus_exit — Bus Adapter OSM exit function
void __exit fsfunci2o_bus_exit ( | void) ; |
void
;i2o_device_claim — claim a device for use by an OSM
int fsfunci2o_device_claim ( | dev) ; |
struct i2o_device * dev
;i2o_device_claim_release — release a device that the OSM is using
int fsfunci2o_device_claim_release ( | dev) ; |
struct i2o_device * dev
;Drop a claim by an OSM on a given I2O device.
AC - some devices seem to want to refuse an unclaim until they have finished internal processing. It makes sense since you don't want a new device to go reconfiguring the entire system until you are done. Thus we are prepared to wait briefly.
Returns 0 on success or negative error code on failure.
i2o_device_issue_claim — claim or release a device
int fsfunci2o_device_issue_claim ( | dev, | |
cmd, | ||
type) ; |
struct i2o_device * dev
;u32 cmd
;u32 type
;i2o_device_release — release the memory for a I2O device
void fsfunci2o_device_release ( | dev) ; |
struct device * dev
;i2o_device_show_class_id — Displays class id of I2O device
ssize_t fsfunci2o_device_show_class_id ( | dev, | |
attr, | ||
buf) ; |
struct device * dev
;struct device_attribute * attr
;char * buf
;i2o_device_show_tid — Displays TID of I2O device
ssize_t fsfunci2o_device_show_tid ( | dev, | |
attr, | ||
buf) ; |
struct device * dev
;struct device_attribute * attr
;char * buf
;i2o_device_alloc — Allocate a I2O device and initialize it
struct i2o_device * fsfunci2o_device_alloc ( | void) ; |
void
;i2o_device_add — allocate a new I2O device and add it to the IOP
int fsfunci2o_device_add ( | c, | |
entry) ; |
struct i2o_controller * c
;i2o_lct_entry * entry
;i2o_device_remove — remove an I2O device from the I2O core
void fsfunci2o_device_remove ( | i2o_dev) ; |
struct i2o_device * i2o_dev
;i2o_device_parse_lct — Parse a previously fetched LCT and create devices
int fsfunci2o_device_parse_lct ( | c) ; |
struct i2o_controller * c
;i2o_bus_match — Tell if I2O device class id matches the class ids of the I2O driver (OSM)
int fsfunci2o_bus_match ( | dev, | |
drv) ; |
struct device * dev
;struct device_driver * drv
;i2o_driver_dispatch — dispatch an I2O reply message
int fsfunci2o_driver_dispatch ( | c, | |
m) ; |
struct i2o_controller * c
;u32 m
;The reply is delivered to the driver from which the original message was. This function is only called from interrupt context.
Returns 0 on success and the message should not be flushed. Returns > 0 on success and if the message should be flushed afterwords. Returns negative error code on failure (the message will be flushed too).
i2o_pci_free — Frees the DMA memory for the I2O controller
void fsfunci2o_pci_free ( | c) ; |
struct i2o_controller * c
;i2o_pci_alloc — Allocate DMA memory, map IO memory for I2O controller
int fsfunci2o_pci_alloc ( | c) ; |
struct i2o_controller * c
;i2o_pci_interrupt — Interrupt handler for I2O controller
irqreturn_t fsfunci2o_pci_interrupt ( | irq, | |
dev_id) ; |
int irq
;void * dev_id
;i2o_pci_irq_enable — Allocate interrupt for I2O controller
int fsfunci2o_pci_irq_enable ( | c) ; |
struct i2o_controller * c
;i2o_pci_irq_disable — Free interrupt for I2O controller
void fsfunci2o_pci_irq_disable ( | c) ; |
struct i2o_controller * c
;i2o_pci_probe — Probe the PCI device for an I2O controller
int fsfunci2o_pci_probe ( | pdev, | |
id) ; |
struct pci_dev * pdev
;const struct pci_device_id * id
;i2o_pci_remove — Removes a I2O controller from the system
void fsfunci2o_pci_remove ( | pdev) ; |
struct pci_dev * pdev
;i2o_pci_init — registers I2O PCI driver in PCI subsystem
int fsfunci2o_pci_init ( | void) ; |
void
;i2o_pci_exit — unregisters I2O PCI driver from PCI subsystem
void __exit fsfunci2o_pci_exit ( | void) ; |
void
;i2o_block_device_free — free the memory of the I2O Block device
void fsfunci2o_block_device_free ( | dev) ; |
struct i2o_block_device * dev
;i2o_block_remove — remove the I2O Block device from the system again
int fsfunci2o_block_remove ( | dev) ; |
struct device * dev
;i2o_block_device_flush — Flush all dirty data of I2O device dev
int fsfunci2o_block_device_flush ( | dev) ; |
struct i2o_device * dev
;i2o_block_device_mount — Mount (load) the media of device dev
int fsfunci2o_block_device_mount ( | dev, | |
media_id) ; |
struct i2o_device * dev
;u32 media_id
;i2o_block_device_lock — Locks the media of device dev
int fsfunci2o_block_device_lock ( | dev, | |
media_id) ; |
struct i2o_device * dev
;u32 media_id
;i2o_block_device_unlock — Unlocks the media of device dev
int fsfunci2o_block_device_unlock ( | dev, | |
media_id) ; |
struct i2o_device * dev
;u32 media_id
;i2o_block_device_power — Power management for device dev
int fsfunci2o_block_device_power ( | dev, | |
op) ; |
struct i2o_block_device * dev
;u8 op
;i2o_block_request_alloc — Allocate an I2O block request struct
struct i2o_block_request * fsfunci2o_block_request_alloc ( | void) ; |
void
;i2o_block_request_free — Frees a I2O block request
void fsfunci2o_block_request_free ( | ireq) ; |
struct i2o_block_request * ireq
;i2o_block_sglist_alloc — Allocate the SG list and map it
int fsfunci2o_block_sglist_alloc ( | c, | |
ireq, | ||
mptr) ; |
struct i2o_controller * c
;struct i2o_block_request * ireq
;u32 ** mptr
;i2o_block_sglist_free — Frees the SG list
void fsfunci2o_block_sglist_free ( | ireq) ; |
struct i2o_block_request * ireq
;i2o_block_prep_req_fn — Allocates I2O block device specific struct
int fsfunci2o_block_prep_req_fn ( | q, | |
req) ; |
struct request_queue * q
;struct request * req
;i2o_block_delayed_request_fn — delayed request queue function
void fsfunci2o_block_delayed_request_fn ( | work) ; |
struct work_struct * work
;i2o_block_end_request — Post-processing of completed commands
void fsfunci2o_block_end_request ( | req, | |
error, | ||
nr_bytes) ; |
struct request * req
;int error
;int nr_bytes
;i2o_block_reply — Block OSM reply handler.
int fsfunci2o_block_reply ( | c, | |
m, | ||
msg) ; |
struct i2o_controller * c
;u32 m
;struct i2o_message * msg
;i2o_block_open — Open the block device
int fsfunci2o_block_open ( | bdev, | |
mode) ; |
struct block_device * bdev
;fmode_t mode
;i2o_block_release — Release the I2O block device
void fsfunci2o_block_release ( | disk, | |
mode) ; |
struct gendisk * disk
;fmode_t mode
;i2o_block_ioctl — Issue device specific ioctl calls.
int fsfunci2o_block_ioctl ( | bdev, | |
mode, | ||
cmd, | ||
arg) ; |
struct block_device * bdev
;fmode_t mode
;unsigned int cmd
;unsigned long arg
;i2o_block_check_events — Have we seen a media change?
unsigned int fsfunci2o_block_check_events ( | disk, | |
clearing) ; |
struct gendisk * disk
;unsigned int clearing
;i2o_block_transfer — Transfer a request to/from the I2O controller
int fsfunci2o_block_transfer ( | req) ; |
struct request * req
;This function converts the request into a I2O message. The necessary DMA buffers are allocated and after everything is setup post the message to the I2O controller. No cleanup is done by this function. It is done on the interrupt side when the reply arrives.
Return 0 on success or negative error code on failure.
i2o_block_request_fn — request queue handling function
void fsfunci2o_block_request_fn ( | q) ; |
struct request_queue * q
;i2o_block_device_alloc — Allocate memory for a I2O Block device
struct i2o_block_device * fsfunci2o_block_device_alloc ( | void) ; |
void
;i2o_block_probe — verify if dev is a I2O Block device and install it
int fsfunci2o_block_probe ( | dev) ; |
struct device * dev
;i2o_block_init — Block OSM initialization function
int fsfunci2o_block_init ( | void) ; |
void
;i2o_scsi_get_host — Get an I2O SCSI host
struct i2o_scsi_host * fsfunci2o_scsi_get_host ( | c) ; |
struct i2o_controller * c
;i2o_scsi_remove — Remove I2O device from SCSI core
int fsfunci2o_scsi_remove ( | dev) ; |
struct device * dev
;i2o_scsi_probe — verify if dev is a I2O SCSI device and install it
int fsfunci2o_scsi_probe ( | dev) ; |
struct device * dev
;i2o_scsi_reply — SCSI OSM message reply handler
int fsfunci2o_scsi_reply ( | c, | |
m, | ||
msg) ; |
struct i2o_controller * c
;u32 m
;struct i2o_message * msg
;c
controller issuing the reply
m
message id for flushing
msg
the message from the controller
Process reply messages (interrupts in normal scsi controller think). We can get a variety of messages to process. The normal path is scsi command completions. We must also deal with IOP failures, the reply to a bus reset and the reply to a LUN query.
Returns 0 on success and if the reply should not be flushed or > 0 on success and if the reply should be flushed. Returns negative error code on failure and if the reply should be flushed.
i2o_scsi_notify_device_add — Retrieve notifications of added devices
void fsfunci2o_scsi_notify_device_add ( | i2o_dev) ; |
struct i2o_device * i2o_dev
;i2o_scsi_notify_device_remove — Retrieve notifications of removed devices
void fsfunci2o_scsi_notify_device_remove ( | i2o_dev) ; |
struct i2o_device * i2o_dev
;i2o_scsi_notify_controller_add — Retrieve notifications of added controllers
void fsfunci2o_scsi_notify_controller_add ( | c) ; |
struct i2o_controller * c
;i2o_scsi_notify_controller_remove — Retrieve notifications of removed controllers
void fsfunci2o_scsi_notify_controller_remove ( | c) ; |
struct i2o_controller * c
;i2o_scsi_queuecommand_lck — queue a SCSI command
int fsfunci2o_scsi_queuecommand_lck ( | SCpnt, | |
done) ; |
struct scsi_cmnd * SCpnt
;void (*done)
(
struct scsi_cmnd *)
;Issue a scsi command asynchronously. Return 0 on success or 1 if we hit an error (normally message queue congestion). The only minor complication here is that I2O deals with the device addressing so we have to map the bus/dev/lun back to an I2O handle as well as faking absent devices ourself.
i2o_scsi_abort — abort a running command
int fsfunci2o_scsi_abort ( | SCpnt) ; |
struct scsi_cmnd * SCpnt
;i2o_scsi_bios_param — Invent disk geometry
int fsfunci2o_scsi_bios_param ( | sdev, | |
dev, | ||
capacity, | ||
ip) ; |
struct scsi_device * sdev
;struct block_device * dev
;sector_t capacity
;int * ip
;i2o_get_class_name — do i2o class name lookup
const char * fsfunci2o_get_class_name ( | class) ; |
int class
;i2o_proc_create_entries — Creates proc dir entries
int fsfunci2o_proc_create_entries ( | dir, | |
i2o_pe, | ||
data) ; |
struct proc_dir_entry * dir
;i2o_proc_entry * i2o_pe
;void * data
;i2o_proc_device_add — Add an I2O device to the proc dir
void fsfunci2o_proc_device_add ( | dir, | |
dev) ; |
struct proc_dir_entry * dir
;struct i2o_device * dev
;i2o_proc_iop_add — Add an I2O controller to the i2o proc tree
int fsfunci2o_proc_iop_add ( | dir, | |
c) ; |
struct proc_dir_entry * dir
;struct i2o_controller * c
;i2o_proc_fs_destroy — Cleanup the all i2o proc entries
int __exit fsfunci2o_proc_fs_destroy ( | void) ; |
void
;Table of Contents
params
field var
value
snd_register_device — Register the ALSA device file for the card
int fsfuncsnd_register_device ( | type, | |
card, | ||
dev, | ||
f_ops, | ||
private_data, | ||
name) ; |
int type
;struct snd_card * card
;int dev
;const struct file_operations * f_ops
;void * private_data
;const char * name
;type
the device type, SNDRV_DEVICE_TYPE_XXX
card
the card instance
dev
the device index
f_ops
the file operations
private_data
user pointer for f_ops->open
name
the device file name
register_sound_special_device — register a special sound node
int fsfuncregister_sound_special_device ( | fops, | |
unit, | ||
dev) ; |
const struct file_operations * fops
;int unit
;struct device * dev
;register_sound_mixer — register a mixer device
int fsfuncregister_sound_mixer ( | fops, | |
dev) ; |
const struct file_operations * fops
;int dev
;register_sound_midi — register a midi device
int fsfuncregister_sound_midi ( | fops, | |
dev) ; |
const struct file_operations * fops
;int dev
;register_sound_dsp — register a DSP device
int fsfuncregister_sound_dsp ( | fops, | |
dev) ; |
const struct file_operations * fops
;int dev
;unregister_sound_special — unregister a special sound device
void fsfuncunregister_sound_special ( | unit) ; |
int unit
;unregister_sound_mixer — unregister a mixer
void fsfuncunregister_sound_mixer ( | unit) ; |
int unit
;unregister_sound_midi — unregister a midi device
void fsfuncunregister_sound_midi ( | unit) ; |
int unit
;unregister_sound_dsp — unregister a DSP device
void fsfuncunregister_sound_dsp ( | unit) ; |
int unit
;snd_pcm_playback_ready — check whether the playback buffer is available
int fsfuncsnd_pcm_playback_ready ( | substream) ; |
struct snd_pcm_substream * substream
;snd_pcm_capture_ready — check whether the capture buffer is available
int fsfuncsnd_pcm_capture_ready ( | substream) ; |
struct snd_pcm_substream * substream
;snd_pcm_playback_data — check whether any data exists on the playback buffer
int fsfuncsnd_pcm_playback_data ( | substream) ; |
struct snd_pcm_substream * substream
;snd_pcm_playback_empty — check whether the playback buffer is empty
int fsfuncsnd_pcm_playback_empty ( | substream) ; |
struct snd_pcm_substream * substream
;snd_pcm_capture_empty — check whether the capture buffer is empty
int fsfuncsnd_pcm_capture_empty ( | substream) ; |
struct snd_pcm_substream * substream
;snd_pcm_format_cpu_endian — Check the PCM format is CPU-endian
int fsfuncsnd_pcm_format_cpu_endian ( | format) ; |
snd_pcm_format_t format
;snd_pcm_lib_alloc_vmalloc_buffer — allocate virtual DMA buffer
int fsfuncsnd_pcm_lib_alloc_vmalloc_buffer ( | substream, | |
size) ; |
struct snd_pcm_substream * substream
;size_t size
;snd_pcm_lib_alloc_vmalloc_32_buffer — allocate 32-bit-addressable buffer
int fsfuncsnd_pcm_lib_alloc_vmalloc_32_buffer ( | substream, | |
size) ; |
struct snd_pcm_substream * substream
;size_t size
;snd_pcm_stream_str — Get a string naming the direction of a stream
const char * fsfuncsnd_pcm_stream_str ( | substream) ; |
struct snd_pcm_substream * substream
;snd_pcm_new_stream — create a new PCM stream
int fsfuncsnd_pcm_new_stream ( | pcm, | |
stream, | ||
substream_count) ; |
struct snd_pcm * pcm
;int stream
;int substream_count
;pcm
the pcm instance
stream
the stream direction, SNDRV_PCM_STREAM_XXX
substream_count
the number of substreams
snd_pcm_new — create a new PCM instance
int fsfuncsnd_pcm_new ( | card, | |
id, | ||
device, | ||
playback_count, | ||
capture_count, | ||
rpcm) ; |
struct snd_card * card
;const char * id
;int device
;int playback_count
;int capture_count
;struct snd_pcm ** rpcm
;card
the card instance
id
the id string
device
the device index (zero based)
playback_count
the number of substreams for playback
capture_count
the number of substreams for capture
rpcm
the pointer to store the new pcm instance
snd_pcm_new_internal — create a new internal PCM instance
int fsfuncsnd_pcm_new_internal ( | card, | |
id, | ||
device, | ||
playback_count, | ||
capture_count, | ||
rpcm) ; |
struct snd_card * card
;const char * id
;int device
;int playback_count
;int capture_count
;struct snd_pcm ** rpcm
;card
the card instance
id
the id string
device
the device index (zero based - shared with normal PCMs)
playback_count
the number of substreams for playback
capture_count
the number of substreams for capture
rpcm
the pointer to store the new pcm instance
Creates a new internal PCM instance with no userspace device or procfs entries. This is used by ASoC Back End PCMs in order to create a PCM that will only be used internally by kernel drivers. i.e. it cannot be opened by userspace. It provides existing ASoC components drivers with a substream and access to any private data.
The pcm operators have to be set afterwards to the new instance
via snd_pcm_set_ops
.
snd_device_new — create an ALSA device component
int fsfuncsnd_device_new ( | card, | |
type, | ||
device_data, | ||
ops) ; |
struct snd_card * card
;snd_device_type_t type
;void * device_data
;struct snd_device_ops * ops
;card
the card instance
type
the device type, SNDRV_DEV_XXX
device_data
the data pointer of this device
ops
the operator table
snd_device_free — release the device from the card
int fsfuncsnd_device_free ( | card, | |
device_data) ; |
struct snd_card * card
;void * device_data
;snd_device_register — register the device
int fsfuncsnd_device_register ( | card, | |
device_data) ; |
struct snd_card * card
;void * device_data
;snd_iprintf — printf on the procfs buffer
int fsfuncsnd_iprintf ( | buffer, | |
fmt, | ||
...) ; |
struct snd_info_buffer * buffer
;const char * fmt
; ...
;snd_info_get_line — read one line from the procfs buffer
int fsfuncsnd_info_get_line ( | buffer, | |
line, | ||
len) ; |
struct snd_info_buffer * buffer
;char * line
;int len
;snd_info_get_str — parse a string token
const char * fsfuncsnd_info_get_str ( | dest, | |
src, | ||
len) ; |
char * dest
;const char * src
;int len
;snd_info_create_module_entry — create an info entry for the given module
struct snd_info_entry * fsfuncsnd_info_create_module_entry ( | module, | |
name, | ||
parent) ; |
struct module * module
;const char * name
;struct snd_info_entry * parent
;snd_info_create_card_entry — create an info entry for the given card
struct snd_info_entry * fsfuncsnd_info_create_card_entry ( | card, | |
name, | ||
parent) ; |
struct snd_card * card
;const char * name
;struct snd_info_entry * parent
;snd_card_proc_new — create an info entry for the given card
int fsfuncsnd_card_proc_new ( | card, | |
name, | ||
entryp) ; |
struct snd_card * card
;const char * name
;struct snd_info_entry ** entryp
;
Creates a new info entry and assigns it to the given card.
Unlike snd_info_create_card_entry
, this function registers the
info entry as an ALSA device component, so that it can be
unregistered/released without explicit call.
Also, you don't have to register this entry via snd_info_register
,
since this will be registered by snd_card_register
automatically.
The parent is assumed as card->proc_root.
For releasing this entry, use snd_device_free
instead of
snd_info_free_entry
.
snd_info_free_entry — release the info entry
void fsfuncsnd_info_free_entry ( | entry) ; |
struct snd_info_entry * entry
;snd_info_register — register the info entry
int fsfuncsnd_info_register ( | entry) ; |
struct snd_info_entry * entry
;snd_rawmidi_receive — receive the input data from the device
int fsfuncsnd_rawmidi_receive ( | substream, | |
buffer, | ||
count) ; |
struct snd_rawmidi_substream * substream
;const unsigned char * buffer
;int count
;snd_rawmidi_transmit_empty — check whether the output buffer is empty
int fsfuncsnd_rawmidi_transmit_empty ( | substream) ; |
struct snd_rawmidi_substream * substream
;snd_rawmidi_transmit_peek — copy data from the internal buffer
int fsfuncsnd_rawmidi_transmit_peek ( | substream, | |
buffer, | ||
count) ; |
struct snd_rawmidi_substream * substream
;unsigned char * buffer
;int count
;snd_rawmidi_transmit_ack — acknowledge the transmission
int fsfuncsnd_rawmidi_transmit_ack ( | substream, | |
count) ; |
struct snd_rawmidi_substream * substream
;int count
;snd_rawmidi_transmit — copy from the buffer to the device
int fsfuncsnd_rawmidi_transmit ( | substream, | |
buffer, | ||
count) ; |
struct snd_rawmidi_substream * substream
;unsigned char * buffer
;int count
;snd_rawmidi_new — create a rawmidi instance
int fsfuncsnd_rawmidi_new ( | card, | |
id, | ||
device, | ||
output_count, | ||
input_count, | ||
rrawmidi) ; |
struct snd_card * card
;char * id
;int device
;int output_count
;int input_count
;struct snd_rawmidi ** rrawmidi
;card
the card instance
id
the id string
device
the device index
output_count
the number of output streams
input_count
the number of input streams
rrawmidi
the pointer to store the new rawmidi instance
snd_rawmidi_set_ops — set the rawmidi operators
void fsfuncsnd_rawmidi_set_ops ( | rmidi, | |
stream, | ||
ops) ; |
struct snd_rawmidi * rmidi
;int stream
;struct snd_rawmidi_ops * ops
;snd_request_card — try to load the card module
void fsfuncsnd_request_card ( | card) ; |
int card
;snd_lookup_minor_data — get user data of a registered device
void * fsfuncsnd_lookup_minor_data ( | minor, | |
type) ; |
unsigned int minor
;int type
;Checks that a minor device with the specified type is registered, and returns its user data pointer.
This function increments the reference counter of the card instance
if an associated instance with the given minor number and type is found.
The caller must call snd_card_unref
appropriately later.
snd_register_device_for_dev — Register the ALSA device file for the card
int fsfuncsnd_register_device_for_dev ( | type, | |
card, | ||
dev, | ||
f_ops, | ||
private_data, | ||
name, | ||
device) ; |
int type
;struct snd_card * card
;int dev
;const struct file_operations * f_ops
;void * private_data
;const char * name
;struct device * device
;type
the device type, SNDRV_DEVICE_TYPE_XXX
card
the card instance
dev
the device index
f_ops
the file operations
private_data
user pointer for f_ops->open
name
the device file name
device
the struct device to link this new device to
snd_unregister_device — unregister the device on the given card
int fsfuncsnd_unregister_device ( | type, | |
card, | ||
dev) ; |
int type
;struct snd_card * card
;int dev
;copy_to_user_fromio — copy data from mmio-space to user-space
int fsfunccopy_to_user_fromio ( | dst, | |
src, | ||
count) ; |
void __user * dst
;const volatile void __iomem * src
;size_t count
;copy_from_user_toio — copy data from user-space to mmio-space
int fsfunccopy_from_user_toio ( | dst, | |
src, | ||
count) ; |
volatile void __iomem * dst
;const void __user * src
;size_t count
;snd_pcm_lib_preallocate_free_for_all — release all pre-allocated buffers on the pcm
int fsfuncsnd_pcm_lib_preallocate_free_for_all ( | pcm) ; |
struct snd_pcm * pcm
;snd_pcm_lib_preallocate_pages — pre-allocation for the given DMA type
int fsfuncsnd_pcm_lib_preallocate_pages ( | substream, | |
type, | ||
data, | ||
size, | ||
max) ; |
struct snd_pcm_substream * substream
;int type
;struct device * data
;size_t size
;size_t max
;substream
the pcm substream instance
type
DMA type (SNDRV_DMA_TYPE_*)
data
DMA type dependent data
size
the requested pre-allocation size in bytes
max
the max. allowed pre-allocation size
Do pre-allocation for the given DMA buffer type.
When substream->dma_buf_id is set, the function tries to look for
the reserved buffer, and the buffer is not freed but reserved at
destruction time. The dma_buf_id must be unique for all systems
(in the same DMA buffer type) e.g. using snd_dma_pci_buf_id
.
snd_pcm_lib_preallocate_pages_for_all — pre-allocation for continuous memory type (all substreams)
int fsfuncsnd_pcm_lib_preallocate_pages_for_all ( | pcm, | |
type, | ||
data, | ||
size, | ||
max) ; |
struct snd_pcm * pcm
;int type
;void * data
;size_t size
;size_t max
;snd_pcm_sgbuf_ops_page — get the page struct at the given offset
struct page * fsfuncsnd_pcm_sgbuf_ops_page ( | substream, | |
offset) ; |
struct snd_pcm_substream * substream
;unsigned long offset
;snd_pcm_lib_malloc_pages — allocate the DMA buffer
int fsfuncsnd_pcm_lib_malloc_pages ( | substream, | |
size) ; |
struct snd_pcm_substream * substream
;size_t size
;substream
the substream to allocate the DMA buffer to
size
the requested buffer size in bytes
snd_pcm_lib_free_pages — release the allocated DMA buffer.
int fsfuncsnd_pcm_lib_free_pages ( | substream) ; |
struct snd_pcm_substream * substream
;snd_pcm_lib_free_vmalloc_buffer — free vmalloc buffer
int fsfuncsnd_pcm_lib_free_vmalloc_buffer ( | substream) ; |
struct snd_pcm_substream * substream
;snd_pcm_lib_get_vmalloc_page — map vmalloc buffer offset to page struct
struct page * fsfuncsnd_pcm_lib_get_vmalloc_page ( | substream, | |
offset) ; |
struct snd_pcm_substream * substream
;unsigned long offset
;snd_card_create — create and initialize a soundcard structure
int fsfuncsnd_card_create ( | idx, | |
xid, | ||
module, | ||
extra_size, | ||
card_ret) ; |
int idx
;const char * xid
;struct module * module
;int extra_size
;struct snd_card ** card_ret
;idx
card index (address) [0 ... (SNDRV_CARDS-1)]
xid
card identification (ASCII string)
module
top level module for locking
extra_size
allocate this extra size after the main soundcard structure
card_ret
the pointer to store the created card instance
snd_card_disconnect — disconnect all APIs from the file-operations (user space)
int fsfuncsnd_card_disconnect ( | card) ; |
struct snd_card * card
;snd_card_unref — release the reference counter
void fsfuncsnd_card_unref ( | card) ; |
struct snd_card * card
;snd_card_set_id — set card identification name
void fsfuncsnd_card_set_id ( | card, | |
nid) ; |
struct snd_card * card
;const char * nid
;snd_card_register — register the soundcard
int fsfuncsnd_card_register ( | card) ; |
struct snd_card * card
;snd_component_add — add a component string
int fsfuncsnd_component_add ( | card, | |
component) ; |
struct snd_card * card
;const char * component
;snd_card_file_add — add the file to the file list of the card
int fsfuncsnd_card_file_add ( | card, | |
file) ; |
struct snd_card * card
;struct file * file
;snd_card_file_remove — remove the file from the file list
int fsfuncsnd_card_file_remove ( | card, | |
file) ; |
struct snd_card * card
;struct file * file
;snd_power_wait — wait until the power-state is changed.
int fsfuncsnd_power_wait ( | card, | |
power_state) ; |
struct snd_card * card
;unsigned int power_state
;snd_dma_program — program an ISA DMA transfer
void fsfuncsnd_dma_program ( | dma, | |
addr, | ||
size, | ||
mode) ; |
unsigned long dma
;unsigned long addr
;unsigned int size
;unsigned short mode
;snd_dma_disable — stop the ISA DMA transfer
void fsfuncsnd_dma_disable ( | dma) ; |
unsigned long dma
;snd_dma_pointer — return the current pointer to DMA transfer buffer in bytes
unsigned int fsfuncsnd_dma_pointer ( | dma, | |
size) ; |
unsigned long dma
;unsigned int size
;snd_ctl_new1 — create a control instance from the template
struct snd_kcontrol * fsfuncsnd_ctl_new1 ( | ncontrol, | |
private_data) ; |
const struct snd_kcontrol_new * ncontrol
;void * private_data
;snd_ctl_free_one — release the control instance
void fsfuncsnd_ctl_free_one ( | kcontrol) ; |
struct snd_kcontrol * kcontrol
;snd_ctl_add — add the control instance to the card
int fsfuncsnd_ctl_add ( | card, | |
kcontrol) ; |
struct snd_card * card
;struct snd_kcontrol * kcontrol
;snd_ctl_replace — replace the control instance of the card
int fsfuncsnd_ctl_replace ( | card, | |
kcontrol, | ||
add_on_replace) ; |
struct snd_card * card
;struct snd_kcontrol * kcontrol
;bool add_on_replace
;card
the card instance
kcontrol
the control instance to replace
add_on_replace
add the control if not already added
snd_ctl_remove — remove the control from the card and release it
int fsfuncsnd_ctl_remove ( | card, | |
kcontrol) ; |
struct snd_card * card
;struct snd_kcontrol * kcontrol
;snd_ctl_remove_id — remove the control of the given id and release it
int fsfuncsnd_ctl_remove_id ( | card, | |
id) ; |
struct snd_card * card
;struct snd_ctl_elem_id * id
;snd_ctl_activate_id — activate/inactivate the control of the given id
int fsfuncsnd_ctl_activate_id ( | card, | |
id, | ||
active) ; |
struct snd_card * card
;struct snd_ctl_elem_id * id
;int active
;card
the card instance
id
the control id to activate/inactivate
active
non-zero to activate
snd_ctl_rename_id — replace the id of a control on the card
int fsfuncsnd_ctl_rename_id ( | card, | |
src_id, | ||
dst_id) ; |
struct snd_card * card
;struct snd_ctl_elem_id * src_id
;struct snd_ctl_elem_id * dst_id
;snd_ctl_find_numid — find the control instance with the given number-id
struct snd_kcontrol * fsfuncsnd_ctl_find_numid ( | card, | |
numid) ; |
struct snd_card * card
;unsigned int numid
;snd_ctl_find_id — find the control instance with the given id
struct snd_kcontrol * fsfuncsnd_ctl_find_id ( | card, | |
id) ; |
struct snd_card * card
;struct snd_ctl_elem_id * id
;snd_ctl_enum_info — fills the info structure for an enumerated control
int fsfuncsnd_ctl_enum_info ( | info, | |
channels, | ||
items, | ||
names[]) ; |
struct snd_ctl_elem_info * info
;unsigned int channels
;unsigned int items
;const char *const names[]
;info
the structure to be filled
channels
the number of the control's channels; often one
items
the number of control values; also the size of names
names[]
an array containing the names of all control values
snd_pcm_set_ops — set the PCM operators
void fsfuncsnd_pcm_set_ops ( | pcm, | |
direction, | ||
ops) ; |
struct snd_pcm * pcm
;int direction
;const struct snd_pcm_ops * ops
;snd_pcm_set_sync — set the PCM sync id
void fsfuncsnd_pcm_set_sync ( | substream) ; |
struct snd_pcm_substream * substream
;snd_interval_refine — refine the interval value of configurator
int fsfuncsnd_interval_refine ( | i, | |
v) ; |
struct snd_interval * i
;const struct snd_interval * v
;snd_interval_ratnum — refine the interval value
int fsfuncsnd_interval_ratnum ( | i, | |
rats_count, | ||
rats, | ||
nump, | ||
denp) ; |
struct snd_interval * i
;unsigned int rats_count
;struct snd_ratnum * rats
;unsigned int * nump
;unsigned int * denp
;snd_interval_list — refine the interval value from the list
int fsfuncsnd_interval_list ( | i, | |
count, | ||
list, | ||
mask) ; |
struct snd_interval * i
;unsigned int count
;const unsigned int * list
;unsigned int mask
;i
the interval value to refine
count
the number of elements in the list
list
the value list
mask
the bit-mask to evaluate
snd_pcm_hw_rule_add — add the hw-constraint rule
int fsfuncsnd_pcm_hw_rule_add ( | runtime, | |
cond, | ||
var, | ||
func, | ||
private, | ||
dep, | ||
...) ; |
struct snd_pcm_runtime * runtime
;unsigned int cond
;int var
;snd_pcm_hw_rule_func_t func
;void * private
;int dep
; ...
;snd_pcm_hw_constraint_integer — apply an integer constraint to an interval
int fsfuncsnd_pcm_hw_constraint_integer ( | runtime, | |
var) ; |
struct snd_pcm_runtime * runtime
;snd_pcm_hw_param_t var
;snd_pcm_hw_constraint_minmax — apply a min/max range constraint to an interval
int fsfuncsnd_pcm_hw_constraint_minmax ( | runtime, | |
var, | ||
min, | ||
max) ; |
struct snd_pcm_runtime * runtime
;snd_pcm_hw_param_t var
;unsigned int min
;unsigned int max
;snd_pcm_hw_constraint_list — apply a list of constraints to a parameter
int fsfuncsnd_pcm_hw_constraint_list ( | runtime, | |
cond, | ||
var, | ||
l) ; |
struct snd_pcm_runtime * runtime
;unsigned int cond
;snd_pcm_hw_param_t var
;const struct snd_pcm_hw_constraint_list * l
;snd_pcm_hw_constraint_ratnums — apply ratnums constraint to a parameter
int fsfuncsnd_pcm_hw_constraint_ratnums ( | runtime, | |
cond, | ||
var, | ||
r) ; |
struct snd_pcm_runtime * runtime
;unsigned int cond
;snd_pcm_hw_param_t var
;struct snd_pcm_hw_constraint_ratnums * r
;snd_pcm_hw_constraint_ratdens — apply ratdens constraint to a parameter
int fsfuncsnd_pcm_hw_constraint_ratdens ( | runtime, | |
cond, | ||
var, | ||
r) ; |
struct snd_pcm_runtime * runtime
;unsigned int cond
;snd_pcm_hw_param_t var
;struct snd_pcm_hw_constraint_ratdens * r
;snd_pcm_hw_constraint_msbits — add a hw constraint msbits rule
int fsfuncsnd_pcm_hw_constraint_msbits ( | runtime, | |
cond, | ||
width, | ||
msbits) ; |
struct snd_pcm_runtime * runtime
;unsigned int cond
;unsigned int width
;unsigned int msbits
;snd_pcm_hw_constraint_step — add a hw constraint step rule
int fsfuncsnd_pcm_hw_constraint_step ( | runtime, | |
cond, | ||
var, | ||
step) ; |
struct snd_pcm_runtime * runtime
;unsigned int cond
;snd_pcm_hw_param_t var
;unsigned long step
;snd_pcm_hw_constraint_pow2 — add a hw constraint power-of-2 rule
int fsfuncsnd_pcm_hw_constraint_pow2 ( | runtime, | |
cond, | ||
var) ; |
struct snd_pcm_runtime * runtime
;unsigned int cond
;snd_pcm_hw_param_t var
;snd_pcm_hw_rule_noresample — add a rule to allow disabling hw resampling
int fsfuncsnd_pcm_hw_rule_noresample ( | runtime, | |
base_rate) ; |
struct snd_pcm_runtime * runtime
;unsigned int base_rate
;snd_pcm_hw_param_value —
return params
field var
value
int fsfuncsnd_pcm_hw_param_value ( | params, | |
var, | ||
dir) ; |
const struct snd_pcm_hw_params * params
;snd_pcm_hw_param_t var
;int * dir
;snd_pcm_hw_param_first — refine config space and return minimum value
int fsfuncsnd_pcm_hw_param_first ( | pcm, | |
params, | ||
var, | ||
dir) ; |
struct snd_pcm_substream * pcm
;struct snd_pcm_hw_params * params
;snd_pcm_hw_param_t var
;int * dir
;pcm
PCM instance
params
the hw_params instance
var
parameter to retrieve
dir
pointer to the direction (-1,0,1) or NULL
snd_pcm_hw_param_last — refine config space and return maximum value
int fsfuncsnd_pcm_hw_param_last ( | pcm, | |
params, | ||
var, | ||
dir) ; |
struct snd_pcm_substream * pcm
;struct snd_pcm_hw_params * params
;snd_pcm_hw_param_t var
;int * dir
;pcm
PCM instance
params
the hw_params instance
var
parameter to retrieve
dir
pointer to the direction (-1,0,1) or NULL
snd_pcm_lib_ioctl — a generic PCM ioctl callback
int fsfuncsnd_pcm_lib_ioctl ( | substream, | |
cmd, | ||
arg) ; |
struct snd_pcm_substream * substream
;unsigned int cmd
;void * arg
;snd_pcm_period_elapsed — update the pcm status for the next period
void fsfuncsnd_pcm_period_elapsed ( | substream) ; |
struct snd_pcm_substream * substream
;snd_pcm_add_chmap_ctls — create channel-mapping control elements
int fsfuncsnd_pcm_add_chmap_ctls ( | pcm, | |
stream, | ||
chmap, | ||
max_channels, | ||
private_value, | ||
info_ret) ; |
struct snd_pcm * pcm
;int stream
;const struct snd_pcm_chmap_elem * chmap
;int max_channels
;unsigned long private_value
;struct snd_pcm_chmap ** info_ret
;snd_hwdep_new — create a new hwdep instance
int fsfuncsnd_hwdep_new ( | card, | |
id, | ||
device, | ||
rhwdep) ; |
struct snd_card * card
;char * id
;int device
;struct snd_hwdep ** rhwdep
;card
the card instance
id
the id string
device
the device index (zero-based)
rhwdep
the pointer to store the new hwdep instance
snd_pcm_stop — try to stop all running streams in the substream group
int fsfuncsnd_pcm_stop ( | substream, | |
state) ; |
struct snd_pcm_substream * substream
;snd_pcm_state_t state
;snd_pcm_suspend — trigger SUSPEND to all linked streams
int fsfuncsnd_pcm_suspend ( | substream) ; |
struct snd_pcm_substream * substream
;snd_pcm_suspend_all — trigger SUSPEND to all substreams in the given pcm
int fsfuncsnd_pcm_suspend_all ( | pcm) ; |
struct snd_pcm * pcm
;snd_malloc_pages — allocate pages with the given size
void * fsfuncsnd_malloc_pages ( | size, | |
gfp_flags) ; |
size_t size
;gfp_t gfp_flags
;snd_free_pages — release the pages
void fsfuncsnd_free_pages ( | ptr, | |
size) ; |
void * ptr
;size_t size
;snd_dma_alloc_pages — allocate the buffer area according to the given type
int fsfuncsnd_dma_alloc_pages ( | type, | |
device, | ||
size, | ||
dmab) ; |
int type
;struct device * device
;size_t size
;struct snd_dma_buffer * dmab
;snd_dma_alloc_pages_fallback — allocate the buffer area according to the given type with fallback
int fsfuncsnd_dma_alloc_pages_fallback ( | type, | |
device, | ||
size, | ||
dmab) ; |
int type
;struct device * device
;size_t size
;struct snd_dma_buffer * dmab
;type
the DMA buffer type
device
the device pointer
size
the buffer size to allocate
dmab
buffer allocation record to store the allocated data
snd_dma_free_pages — release the allocated buffer
void fsfuncsnd_dma_free_pages ( | dmab) ; |
struct snd_dma_buffer * dmab
;snd_dma_get_reserved_buf — get the reserved buffer for the given device
size_t fsfuncsnd_dma_get_reserved_buf ( | dmab, | |
id) ; |
struct snd_dma_buffer * dmab
;unsigned int id
;Table of Contents
uart_update_timeout — update per-port FIFO timeout.
void fsfuncuart_update_timeout ( | port, | |
cflag, | ||
baud) ; |
struct uart_port * port
;unsigned int cflag
;unsigned int baud
;uart_get_baud_rate — return baud rate for a particular port
unsigned int fsfuncuart_get_baud_rate ( | port, | |
termios, | ||
old, | ||
min, | ||
max) ; |
struct uart_port * port
;struct ktermios * termios
;struct ktermios * old
;unsigned int min
;unsigned int max
;port
uart_port structure describing the port in question.
termios
desired termios settings.
old
old termios (or NULL)
min
minimum acceptable baud rate
max
maximum acceptable baud rate
Decode the termios structure into a numeric baud rate,
taking account of the magic 38400 baud rate (with spd_*
flags), and mapping the B0
rate to 9600 baud.
If the new baud rate is invalid, try the old termios setting. If it's still invalid, we try 9600 baud.
Update the termios
structure to reflect the baud rate
we're actually going to be using. Don't do this for the case
where B0 is requested (“hang up”).
uart_get_divisor — return uart clock divisor
unsigned int fsfuncuart_get_divisor ( | port, | |
baud) ; |
struct uart_port * port
;unsigned int baud
;uart_parse_options — Parse serial port baud/parity/bits/flow contro.
void fsfuncuart_parse_options ( | options, | |
baud, | ||
parity, | ||
bits, | ||
flow) ; |
char * options
;int * baud
;int * parity
;int * bits
;int * flow
;options
pointer to option string
baud
pointer to an 'int' variable for the baud rate.
parity
pointer to an 'int' variable for the parity.
bits
pointer to an 'int' variable for the number of data bits.
flow
pointer to an 'int' variable for the flow control character.
uart_set_options — setup the serial console parameters
int fsfuncuart_set_options ( | port, | |
co, | ||
baud, | ||
parity, | ||
bits, | ||
flow) ; |
struct uart_port * port
;struct console * co
;int baud
;int parity
;int bits
;int flow
;uart_register_driver — register a driver with the uart core layer
int fsfuncuart_register_driver ( | drv) ; |
struct uart_driver * drv
;Register a uart driver with the core driver. We in turn register with the tty layer, and initialise the core driver per-port state.
We have a proc file in /proc/tty/driver which is named after the normal driver.
drv->port should be NULL, and the per-port structures should be registered using uart_add_one_port after this call has succeeded.
uart_unregister_driver — remove a driver from the uart core layer
void fsfuncuart_unregister_driver ( | drv) ; |
struct uart_driver * drv
;uart_add_one_port — attach a driver-defined port structure
int fsfuncuart_add_one_port ( | drv, | |
uport) ; |
struct uart_driver * drv
;struct uart_port * uport
;uart_remove_one_port — detach a driver defined port structure
int fsfuncuart_remove_one_port ( | drv, | |
uport) ; |
struct uart_driver * drv
;struct uart_port * uport
;uart_handle_dcd_change — handle a change of carrier detect state
void fsfuncuart_handle_dcd_change ( | uport, | |
status) ; |
struct uart_port * uport
;unsigned int status
;uart_handle_cts_change — handle a change of clear-to-send state
void fsfuncuart_handle_cts_change ( | uport, | |
status) ; |
struct uart_port * uport
;unsigned int status
;uart_insert_char — push a char to the uart layer
void fsfuncuart_insert_char ( | port, | |
status, | ||
overrun, | ||
ch, | ||
flag) ; |
struct uart_port * port
;unsigned int status
;unsigned int overrun
;unsigned int ch
;unsigned int flag
;serial8250_suspend_port — suspend one serial port
void fsfuncserial8250_suspend_port ( | line) ; |
int line
;serial8250_resume_port — resume one serial port
void fsfuncserial8250_resume_port ( | line) ; |
int line
;serial8250_register_8250_port — register a serial port
int fsfuncserial8250_register_8250_port ( | up) ; |
struct uart_8250_port * up
;Configure the serial port specified by the request. If the port exists and is in use, it is hung up and unregistered first.
The port is then probed and if necessary the IRQ is autodetected If this fails an error is returned.
On success the port is ready to use and the line number is returned.
Table of Contents
The frame buffer drivers depend heavily on four data structures. These structures are declared in include/linux/fb.h. They are fb_info, fb_var_screeninfo, fb_fix_screeninfo and fb_monospecs. The last three can be made available to and from userland.
fb_info defines the current state of a particular video card. Inside fb_info, there exists a fb_ops structure which is a collection of needed functions to make fbdev and fbcon work. fb_info is only visible to the kernel.
fb_var_screeninfo is used to describe the features of a video card that are user defined. With fb_var_screeninfo, things such as depth and the resolution may be defined.
The next structure is fb_fix_screeninfo. This defines the properties of a card that are created when a mode is set and can't be changed otherwise. A good example of this is the start of the frame buffer memory. This "locks" the address of the frame buffer memory, so that it cannot be changed or moved.
The last structure is fb_monospecs. In the old API, there was little importance for fb_monospecs. This allowed for forbidden things such as setting a mode of 800x600 on a fix frequency monitor. With the new API, fb_monospecs prevents such things, and if used correctly, can prevent a monitor from being cooked. fb_monospecs will not be useful until kernels 2.5.x.
register_framebuffer — registers a frame buffer device
int fsfuncregister_framebuffer ( | fb_info) ; |
struct fb_info * fb_info
;unregister_framebuffer — releases a frame buffer device
int fsfuncunregister_framebuffer ( | fb_info) ; |
struct fb_info * fb_info
;
Unregisters a frame buffer device fb_info
.
Returns negative errno on error, or zero for success.
This function will also notify the framebuffer console to release the driver.
This is meant to be called within a driver's module_exit
function. If this is called outside module_exit
, ensure
that the driver implements fb_open
and fb_release
to
check that no processes are using the device.
fb_set_suspend — low level driver signals suspend
void fsfuncfb_set_suspend ( | info, | |
state) ; |
struct fb_info * info
;int state
;fb_dealloc_cmap — deallocate a colormap
void fsfuncfb_dealloc_cmap ( | cmap) ; |
struct fb_cmap * cmap
;fb_copy_cmap — copy a colormap
int fsfuncfb_copy_cmap ( | from, | |
to) ; |
const struct fb_cmap * from
;struct fb_cmap * to
;fb_set_cmap — set the colormap
int fsfuncfb_set_cmap ( | cmap, | |
info) ; |
struct fb_cmap * cmap
;struct fb_info * info
;fb_try_mode — test a video mode
int fsfuncfb_try_mode ( | var, | |
info, | ||
mode, | ||
bpp) ; |
struct fb_var_screeninfo * var
;struct fb_info * info
;const struct fb_videomode * mode
;unsigned int bpp
;fb_delete_videomode — removed videomode entry from modelist
void fsfuncfb_delete_videomode ( | mode, | |
head) ; |
const struct fb_videomode * mode
;struct list_head * head
;fb_find_mode — finds a valid video mode
int fsfuncfb_find_mode ( | var, | |
info, | ||
mode_option, | ||
db, | ||
dbsize, | ||
default_mode, | ||
default_bpp) ; |
struct fb_var_screeninfo * var
;struct fb_info * info
;const char * mode_option
;const struct fb_videomode * db
;unsigned int dbsize
;const struct fb_videomode * default_mode
;unsigned int default_bpp
;var
frame buffer user defined part of display
info
frame buffer info structure
mode_option
string video mode to find
db
video mode database
dbsize
size of db
default_mode
default video mode to fall back to
default_bpp
default color depth in bits per pixel
Finds a suitable video mode, starting with the specified mode
in mode_option
with fallback to default_mode
. If
default_mode
fails, all modes in the video mode database will
be tried.
Valid mode specifiers for mode_option
:
<xres>x<yres>[M][R][-<bpp>][@<refresh>][i][m] or <name>[-<bpp>][@<refresh>]
with <xres>, <yres>, <bpp> and <refresh> decimal numbers and <name> a string.
If 'M' is present after yres (and before refresh/bpp if present), the function will compute the timings using VESA(tm) Coordinated Video Timings (CVT). If 'R' is present after 'M', will compute with reduced blanking (for flatpanels). If 'i' is present, compute interlaced mode. If 'm' is present, add margins equal to 1.8% of xres rounded down to 8 pixels, and 1.8% of yres. The char 'i' and 'm' must be after 'M' and 'R'. Example:
1024x768MR-860m
- Reduced blank with margins at 60Hz.
The passed struct var
is _not_ cleared! This allows you
to supply values for e.g. the grayscale and accel_flags fields.
Returns zero for failure, 1 if using specified mode_option
,
2 if using specified mode_option
with an ignored refresh rate,
3 if default mode is used, 4 if fall back to any valid mode.
fb_var_to_videomode — convert fb_var_screeninfo to fb_videomode
void fsfuncfb_var_to_videomode ( | mode, | |
var) ; |
struct fb_videomode * mode
;const struct fb_var_screeninfo * var
;fb_videomode_to_var — convert fb_videomode to fb_var_screeninfo
void fsfuncfb_videomode_to_var ( | var, | |
mode) ; |
struct fb_var_screeninfo * var
;const struct fb_videomode * mode
;fb_mode_is_equal — compare 2 videomodes
int fsfuncfb_mode_is_equal ( | mode1, | |
mode2) ; |
const struct fb_videomode * mode1
;const struct fb_videomode * mode2
;fb_find_best_mode — find best matching videomode
const struct fb_videomode * fsfuncfb_find_best_mode ( | var, | |
head) ; |
const struct fb_var_screeninfo * var
;struct list_head * head
;fb_find_nearest_mode — find closest videomode
const struct fb_videomode * fsfuncfb_find_nearest_mode ( | mode, | |
head) ; |
const struct fb_videomode * mode
;struct list_head * head
;fb_match_mode — find a videomode which exactly matches the timings in var
const struct fb_videomode * fsfuncfb_match_mode ( | var, | |
head) ; |
const struct fb_var_screeninfo * var
;struct list_head * head
;fb_add_videomode — adds videomode entry to modelist
int fsfuncfb_add_videomode ( | mode, | |
head) ; |
const struct fb_videomode * mode
;struct list_head * head
;fb_destroy_modelist — destroy modelist
void fsfuncfb_destroy_modelist ( | head) ; |
struct list_head * head
;mac_vmode_to_var — converts vmode/cmode pair to var structure
int fsfuncmac_vmode_to_var ( | vmode, | |
cmode, | ||
var) ; |
int vmode
;int cmode
;struct fb_var_screeninfo * var
;mac_map_monitor_sense — Convert monitor sense to vmode
int fsfuncmac_map_monitor_sense ( | sense) ; |
int sense
;mac_find_mode — find a video mode
int fsfuncmac_find_mode ( | var, | |
info, | ||
mode_option, | ||
default_bpp) ; |
struct fb_var_screeninfo * var
;struct fb_info * info
;const char * mode_option
;unsigned int default_bpp
;var
frame buffer user defined part of display
info
frame buffer info structure
mode_option
video mode name (see mac_modedb[])
default_bpp
default color depth in bits per pixel
Table of Contents
struct input_value — input value representation
struct input_value { __u16 type; __u16 code; __s32 value; };
struct input_dev — represents an input device
struct input_dev { const char * name; const char * phys; const char * uniq; struct input_id id; unsigned long propbit[BITS_TO_LONGS(INPUT_PROP_CNT)]; unsigned long evbit[BITS_TO_LONGS(EV_CNT)]; unsigned long keybit[BITS_TO_LONGS(KEY_CNT)]; unsigned long relbit[BITS_TO_LONGS(REL_CNT)]; unsigned long absbit[BITS_TO_LONGS(ABS_CNT)]; unsigned long mscbit[BITS_TO_LONGS(MSC_CNT)]; unsigned long ledbit[BITS_TO_LONGS(LED_CNT)]; unsigned long sndbit[BITS_TO_LONGS(SND_CNT)]; unsigned long ffbit[BITS_TO_LONGS(FF_CNT)]; unsigned long swbit[BITS_TO_LONGS(SW_CNT)]; unsigned int hint_events_per_packet; unsigned int keycodemax; unsigned int keycodesize; void * keycode; int (* setkeycode) (struct input_dev *dev,const struct input_keymap_entry *ke,unsigned int *old_keycode); int (* getkeycode) (struct input_dev *dev,struct input_keymap_entry *ke); struct ff_device * ff; unsigned int repeat_key; struct timer_list timer; int rep[REP_CNT]; struct input_mt * mt; struct input_absinfo * absinfo; unsigned long key[BITS_TO_LONGS(KEY_CNT)]; unsigned long led[BITS_TO_LONGS(LED_CNT)]; unsigned long snd[BITS_TO_LONGS(SND_CNT)]; unsigned long sw[BITS_TO_LONGS(SW_CNT)]; int (* open) (struct input_dev *dev); void (* close) (struct input_dev *dev); int (* flush) (struct input_dev *dev, struct file *file); int (* event) (struct input_dev *dev, unsigned int type, unsigned int code, int value); struct input_handle __rcu * grab; spinlock_t event_lock; struct mutex mutex; unsigned int users; bool going_away; struct device dev; struct list_head h_list; struct list_head node; unsigned int num_vals; unsigned int max_vals; struct input_value * vals; bool devres_managed; };
name of the device
physical path to the device in the system hierarchy
unique identification code for the device (if device has it)
id of the device (struct input_id)
bitmap of device properties and quirks
bitmap of types of events supported by the device (EV_KEY, EV_REL, etc.)
bitmap of keys/buttons this device has
bitmap of relative axes for the device
bitmap of absolute axes for the device
bitmap of miscellaneous events supported by the device
bitmap of leds present on the device
bitmap of sound effects supported by the device
bitmap of force feedback effects supported by the device
bitmap of switches present on the device
average number of events generated by the device in a packet (between EV_SYN/SYN_REPORT events). Used by event handlers to estimate size of the buffer needed to hold events.
size of keycode table
size of elements in keycode table
map of scancodes to keycodes for this device
optional method to alter current keymap, used to implement sparse keymaps. If not supplied default mechanism will be used. The method is being called while holding event_lock and thus must not sleep
optional legacy method to retrieve current keymap.
force feedback structure associated with the device if device supports force feedback effects
stores key code of the last key pressed; used to implement software autorepeat
timer for software autorepeat
current values for autorepeat parameters (delay, rate)
pointer to multitouch state
array of struct input_absinfo elements holding information about absolute axes (current value, min, max, flat, fuzz, resolution)
reflects current state of device's keys/buttons
reflects current state of device's LEDs
reflects current state of sound effects
reflects current state of device's switches
this method is called when the very first user calls
input_open_device
. The driver must prepare the device
to start generating events (start polling thread,
request an IRQ, submit URB, etc.)
this method is called when the very last user calls
input_close_device
.
purges the device. Most commonly used to get rid of force feedback effects loaded into the device when disconnecting from it
event handler for events sent _to_ the device, like EV_LED
or EV_SND. The device is expected to carry out the requested
action (turn on a LED, play sound, etc.) The call is protected
by event_lock
and must not sleep
input handle that currently has the device grabbed (via EVIOCGRAB ioctl). When a handle grabs a device it becomes sole recipient for all input events coming from the device
this spinlock is is taken when input core receives
and processes a new event for the device (in input_event
).
Code that accesses and/or modifies parameters of a device
(such as keymap or absmin, absmax, absfuzz, etc.) after device
has been registered with input core must take this lock.
serializes calls to open
, close
and flush
methods
stores number of users (input handlers) that opened this
device. It is used by input_open_device
and input_close_device
to make sure that dev->open
is only called when the first
user opens device and dev->close
is called when the very
last user closes the device
marks devices that are in a middle of unregistering and causes input_open_device*() fail with -ENODEV.
driver model's view of this device
list of input handles associated with the device. When accessing the list dev->mutex must be held
used to place the device onto input_dev_list
number of values queued in the current frame
maximum number of values queued in a frame
array of values queued in the current frame
indicates that devices is managed with devres framework and needs not be explicitly unregistered or freed.
struct input_handler — implements one of interfaces for input devices
struct input_handler { void * private; void (* event) (struct input_handle *handle, unsigned int type, unsigned int code, int value); void (* events) (struct input_handle *handle,const struct input_value *vals, unsigned int count); bool (* filter) (struct input_handle *handle, unsigned int type, unsigned int code, int value); bool (* match) (struct input_handler *handler, struct input_dev *dev); int (* connect) (struct input_handler *handler, struct input_dev *dev, const struct input_device_id *id); void (* disconnect) (struct input_handle *handle); void (* start) (struct input_handle *handle); bool legacy_minors; int minor; const char * name; const struct input_device_id * id_table; struct list_head h_list; struct list_head node; };
driver-specific data
event handler. This method is being called by input core with interrupts disabled and dev->event_lock spinlock held and so it may not sleep
event sequence handler. This method is being called by input core with interrupts disabled and dev->event_lock spinlock held and so it may not sleep
similar to event
; separates normal event handlers from
“filters”.
called after comparing device's id with handler's id_table to perform fine-grained matching between device and handler
called when attaching a handler to an input device
disconnects a handler from input device
starts handler for given handle. This function is called by
input core right after connect
method and also when a process
that “grabbed” a device releases it
set to true
by drivers using legacy minor ranges
beginning of range of 32 legacy minors for devices this driver can provide
name of the handler, to be shown in /proc/bus/input/handlers
pointer to a table of input_device_ids this driver can handle
list of input handles associated with the handler
for placing the driver onto input_handler_list
Input handlers attach to input devices and create input handles. There are likely several handlers attached to any given input device at the same time. All of them will get their copy of input event generated by the device.
The very same structure is used to implement input filters. Input core
allows filters to run first and will not pass event to regular handlers
if any of the filters indicate that the event should be filtered (by
returning true
from their filter
method).
Note that input core serializes calls to connect
and disconnect
methods.
struct input_handle — links input device with an input handler
struct input_handle { void * private; int open; const char * name; struct input_dev * dev; struct input_handler * handler; struct list_head d_node; struct list_head h_node; };
handler-specific data
counter showing whether the handle is 'open', i.e. should deliver events from its device
name given to the handle by handler that created it
input device the handle is attached to
handler that works with the device through this handle
used to put the handle on device's list of attached handles
used to put the handle on handler's list of handles from which it gets events
input_set_events_per_packet — tell handlers about the driver event rate
void fsfuncinput_set_events_per_packet ( | dev, | |
n_events) ; |
struct input_dev * dev
;int n_events
;struct ff_device — force-feedback part of an input device
struct ff_device { int (* upload) (struct input_dev *dev, struct ff_effect *effect,struct ff_effect *old); int (* erase) (struct input_dev *dev, int effect_id); int (* playback) (struct input_dev *dev, int effect_id, int value); void (* set_gain) (struct input_dev *dev, u16 gain); void (* set_autocenter) (struct input_dev *dev, u16 magnitude); void (* destroy) (struct ff_device *); void * private; unsigned long ffbit[BITS_TO_LONGS(FF_CNT)]; struct mutex mutex; int max_effects; struct ff_effect * effects; struct file * effect_owners[]; };
Called to upload an new effect into device
Called to erase an effect from device
Called to request device to start playing specified effect
Called to set specified gain
Called to auto-center device
called by input core when parent input device is being destroyed
driver-specific data, will be freed automatically
bitmap of force feedback capabilities truly supported by device (not emulated like ones in input_dev->ffbit)
mutex for serializing access to the device
maximum number of effects supported by device
pointer to an array of effects currently loaded into device
array of effect owners; when file handle owning an effect gets closed the effect is automatically erased
Every force-feedback device must implement upload
and playback
methods; erase
is optional. set_gain
and set_autocenter
need
only be implemented if driver sets up FF_GAIN and FF_AUTOCENTER
bits.
Note that playback
, set_gain
and set_autocenter
are called with
dev->event_lock spinlock held and interrupts off and thus may not
sleep.
input_event — report new input event
void fsfuncinput_event ( | dev, | |
type, | ||
code, | ||
value) ; |
struct input_dev * dev
;unsigned int type
;unsigned int code
;int value
;dev
device that generated the event
type
type of the event
code
event code
value
value of the event
This function should be used by drivers implementing various input
devices to report input events. See also input_inject_event
.
input_event
may be safely used right after input device was
allocated with input_allocate_device
, even before it is registered
with input_register_device
, but the event will not reach any of the
input handlers. Such early invocation of input_event
may be used
to 'seed' initial state of a switch or initial position of absolute
axis, etc.
input_inject_event — send input event from input handler
void fsfuncinput_inject_event ( | handle, | |
type, | ||
code, | ||
value) ; |
struct input_handle * handle
;unsigned int type
;unsigned int code
;int value
;input_alloc_absinfo — allocates array of input_absinfo structs
void fsfuncinput_alloc_absinfo ( | dev) ; |
struct input_dev * dev
;input_grab_device — grabs device for exclusive use
int fsfuncinput_grab_device ( | handle) ; |
struct input_handle * handle
;input_release_device — release previously grabbed device
void fsfuncinput_release_device ( | handle) ; |
struct input_handle * handle
;input_open_device — open input device
int fsfuncinput_open_device ( | handle) ; |
struct input_handle * handle
;input_close_device — close input device
void fsfuncinput_close_device ( | handle) ; |
struct input_handle * handle
;input_scancode_to_scalar — converts scancode in struct input_keymap_entry
int fsfuncinput_scancode_to_scalar ( | ke, | |
scancode) ; |
const struct input_keymap_entry * ke
;unsigned int * scancode
;input_get_keycode — retrieve keycode currently mapped to a given scancode
int fsfuncinput_get_keycode ( | dev, | |
ke) ; |
struct input_dev * dev
;struct input_keymap_entry * ke
;input_set_keycode — attribute a keycode to a given scancode
int fsfuncinput_set_keycode ( | dev, | |
ke) ; |
struct input_dev * dev
;const struct input_keymap_entry * ke
;input_reset_device — reset/restore the state of input device
void fsfuncinput_reset_device ( | dev) ; |
struct input_dev * dev
;input_allocate_device — allocate memory for new input device
struct input_dev * fsfuncinput_allocate_device ( | void) ; |
void
;devm_input_allocate_device — allocate managed input device
struct input_dev * fsfuncdevm_input_allocate_device ( | dev) ; |
struct device * dev
;
Returns prepared struct input_dev or NULL
.
Managed input devices do not need to be explicitly unregistered or
freed as it will be done automatically when owner device unbinds from
its driver (or binding fails). Once managed input device is allocated,
it is ready to be set up and registered in the same fashion as regular
input device. There are no special devm_input_device_[un]register
variants, regular ones work with both managed and unmanaged devices,
should you need them. In most cases however, managed input device need
not be explicitly unregistered or freed.
input_free_device — free memory occupied by input_dev structure
void fsfuncinput_free_device ( | dev) ; |
struct input_dev * dev
;input_set_capability — mark device as capable of a certain event
void fsfuncinput_set_capability ( | dev, | |
type, | ||
code) ; |
struct input_dev * dev
;unsigned int type
;unsigned int code
;input_register_device — register device with input core
int fsfuncinput_register_device ( | dev) ; |
struct input_dev * dev
;
This function registers device with input core. The device must be
allocated with input_allocate_device
and all it's capabilities
set up before registering.
If function fails the device must be freed with input_free_device
.
Once device has been successfully registered it can be unregistered
with input_unregister_device
; input_free_device
should not be
called in this case.
Note that this function is also used to register managed input devices
(ones allocated with devm_input_allocate_device
). Such managed input
devices need not be explicitly unregistered or freed, their tear down
is controlled by the devres infrastructure. It is also worth noting
that tear down of managed input devices is internally a 2-step process:
registered managed input device is first unregistered, but stays in
memory and can still handle input_event
calls (although events will
not be delivered anywhere). The freeing of managed input device will
happen later, when devres stack is unwound to the point where device
allocation was made.
input_unregister_device — unregister previously registered device
void fsfuncinput_unregister_device ( | dev) ; |
struct input_dev * dev
;input_register_handler — register a new input handler
int fsfuncinput_register_handler ( | handler) ; |
struct input_handler * handler
;input_unregister_handler — unregisters an input handler
void fsfuncinput_unregister_handler ( | handler) ; |
struct input_handler * handler
;input_handler_for_each_handle — handle iterator
int fsfuncinput_handler_for_each_handle ( | handler, | |
data, | ||
fn) ; |
struct input_handler * handler
;void * data
;int (*fn)
(
struct input_handle *, void *)
;handler
input handler to iterate
data
data for the callback
fn
function to be called for each handle
Iterate over bus
's list of devices, and call fn
for each, passing
it data
and stop when fn
returns a non-zero value. The function is
using RCU to traverse the list and therefore may be usind in atonic
contexts. The fn
callback is invoked from RCU critical section and
thus must not sleep.
input_register_handle — register a new input handle
int fsfuncinput_register_handle ( | handle) ; |
struct input_handle * handle
;input_unregister_handle — unregister an input handle
void fsfuncinput_unregister_handle ( | handle) ; |
struct input_handle * handle
;input_get_new_minor — allocates a new input minor number
int fsfuncinput_get_new_minor ( | legacy_base, | |
legacy_num, | ||
allow_dynamic) ; |
int legacy_base
;unsigned int legacy_num
;bool allow_dynamic
;input_free_minor — release previously allocated minor
void fsfuncinput_free_minor ( | minor) ; |
unsigned int minor
;input_ff_upload — upload effect into force-feedback device
int fsfuncinput_ff_upload ( | dev, | |
effect, | ||
file) ; |
struct input_dev * dev
;struct ff_effect * effect
;struct file * file
;input_ff_erase — erase a force-feedback effect from device
int fsfuncinput_ff_erase ( | dev, | |
effect_id, | ||
file) ; |
struct input_dev * dev
;int effect_id
;struct file * file
;input_ff_event — generic handler for force-feedback events
int fsfuncinput_ff_event ( | dev, | |
type, | ||
code, | ||
value) ; |
struct input_dev * dev
;unsigned int type
;unsigned int code
;int value
;input_ff_create — create force-feedback device
int fsfuncinput_ff_create ( | dev, | |
max_effects) ; |
struct input_dev * dev
;unsigned int max_effects
;dev
input device supporting force-feedback
max_effects
maximum number of effects supported by the device
This function allocates all necessary memory for a force feedback
portion of an input device and installs all default handlers.
dev
->ffbit should be already set up before calling this function.
Once ff device is created you need to setup its upload, erase,
playback and other handlers before registering input device
input_ff_destroy — frees force feedback portion of input device
void fsfuncinput_ff_destroy ( | dev) ; |
struct input_dev * dev
;struct input_mt_slot — represents the state of an input MT slot
struct input_mt_slot { int abs[ABS_MT_LAST - ABS_MT_FIRST + 1]; unsigned int frame; unsigned int key; };
struct input_mt — state of tracked contacts
struct input_mt { int trkid; int num_slots; int slot; unsigned int flags; unsigned int frame; int * red; struct input_mt_slot slots[]; };
stores MT tracking ID for the next contact
number of MT slots the device uses
MT slot currently being transmitted
input_mt operation flags
increases every time input_mt_sync_frame
is called
reduced cost matrix for in-kernel tracking
array of slots holding current values of tracked contacts
input_mt_init_slots — initialize MT input slots
int fsfuncinput_mt_init_slots ( | dev, | |
num_slots, | ||
flags) ; |
struct input_dev * dev
;unsigned int num_slots
;unsigned int flags
;dev
input device supporting MT events and finger tracking
num_slots
number of slots used by the device
flags
mt tasks to handle in core
This function allocates all necessary memory for MT slot handling in the input device, prepares the ABS_MT_SLOT and ABS_MT_TRACKING_ID events for use and sets up appropriate buffers. Depending on the flags set, it also performs pointer emulation and frame synchronization.
May be called repeatedly. Returns -EINVAL if attempting to reinitialize with a different number of slots.
input_mt_destroy_slots — frees the MT slots of the input device
void fsfuncinput_mt_destroy_slots ( | dev) ; |
struct input_dev * dev
;input_mt_report_slot_state — report contact state
void fsfuncinput_mt_report_slot_state ( | dev, | |
tool_type, | ||
active) ; |
struct input_dev * dev
;unsigned int tool_type
;bool active
;input_mt_report_finger_count — report contact count
void fsfuncinput_mt_report_finger_count ( | dev, | |
count) ; |
struct input_dev * dev
;int count
;input_mt_report_pointer_emulation — common pointer emulation
void fsfuncinput_mt_report_pointer_emulation ( | dev, | |
use_count) ; |
struct input_dev * dev
;bool use_count
;input_mt_sync_frame — synchronize mt frame
void fsfuncinput_mt_sync_frame ( | dev) ; |
struct input_dev * dev
;input_mt_assign_slots — perform a best-match assignment
int fsfuncinput_mt_assign_slots ( | dev, | |
slots, | ||
pos, | ||
num_pos) ; |
struct input_dev * dev
;int * slots
;const struct input_mt_pos * pos
;int num_pos
;struct input_polled_dev — simple polled input device
struct input_polled_dev { void * private; void (* open) (struct input_polled_dev *dev); void (* close) (struct input_polled_dev *dev); void (* poll) (struct input_polled_dev *dev); unsigned int poll_interval; unsigned int poll_interval_max; unsigned int poll_interval_min; struct input_dev * input; };
private driver data.
driver-supplied method that prepares device for polling (enabled the device and maybe flushes device state).
driver-supplied method that is called when device is no longer being polled. Used to put device into low power mode.
driver-supplied method that polls the device and posts input events (mandatory).
specifies how often the poll
method should be called.
Defaults to 500 msec unless overridden when registering the device.
specifies upper bound for the poll interval.
Defaults to the initial value of poll_interval
.
specifies lower bound for the poll interval. Defaults to 0.
input device structure associated with the polled device. Must be properly initialized by the driver (id, name, phys, bits).
input_allocate_polled_device — allocate memory for polled device
struct input_polled_dev * fsfuncinput_allocate_polled_device ( | void) ; |
void
;input_free_polled_device — free memory allocated for polled device
void fsfuncinput_free_polled_device ( | dev) ; |
struct input_polled_dev * dev
;input_register_polled_device — register polled device
int fsfuncinput_register_polled_device ( | dev) ; |
struct input_polled_dev * dev
;struct matrix_keymap_data — keymap for matrix keyboards
struct matrix_keymap_data { const uint32_t * keymap; unsigned int keymap_size; };
struct matrix_keypad_platform_data — platform-dependent keypad data
struct matrix_keypad_platform_data { const struct matrix_keymap_data * keymap_data; const unsigned int * row_gpios; const unsigned int * col_gpios; unsigned int num_row_gpios; unsigned int num_col_gpios; unsigned int col_scan_delay_us; unsigned int debounce_ms; unsigned int clustered_irq; unsigned int clustered_irq_flags; bool active_low; bool wakeup; bool no_autorepeat; };
pointer to matrix_keymap_data
pointer to array of gpio numbers representing rows
pointer to array of gpio numbers reporesenting colums
actual number of row gpios used by device
actual number of col gpios used by device
delay, measured in microseconds, that is needed before we can keypad after activating column gpio
debounce interval in milliseconds
may be specified if interrupts of all row/column GPIOs are bundled to one single irq
flags that are needed for the clustered irq
gpio polarity
controls whether the device should be set up as wakeup source
disable key autorepeat
struct key_entry — keymap entry for use in sparse keymap
struct key_entry { int type; u32 code; union {unnamed_union}; };
sparse_keymap_entry_from_scancode — perform sparse keymap lookup
struct key_entry * fsfuncsparse_keymap_entry_from_scancode ( | dev, | |
code) ; |
struct input_dev * dev
;unsigned int code
;sparse_keymap_entry_from_keycode — perform sparse keymap lookup
struct key_entry * fsfuncsparse_keymap_entry_from_keycode ( | dev, | |
keycode) ; |
struct input_dev * dev
;unsigned int keycode
;sparse_keymap_setup — set up sparse keymap for an input device
int fsfuncsparse_keymap_setup ( | dev, | |
keymap, | ||
setup) ; |
struct input_dev * dev
;const struct key_entry * keymap
;int (*setup)
(
struct input_dev *, struct key_entry *)
;sparse_keymap_free — free memory allocated for sparse keymap
void fsfuncsparse_keymap_free ( | dev) ; |
struct input_dev * dev
;sparse_keymap_report_entry — report event corresponding to given key entry
void fsfuncsparse_keymap_report_entry ( | dev, | |
ke, | ||
value, | ||
autorelease) ; |
struct input_dev * dev
;const struct key_entry * ke
;unsigned int value
;bool autorelease
;sparse_keymap_report_event — report event corresponding to given scancode
bool fsfuncsparse_keymap_report_event ( | dev, | |
code, | ||
value, | ||
autorelease) ; |
struct input_dev * dev
;unsigned int code
;unsigned int value
;bool autorelease
;Table of Contents
SPI is the "Serial Peripheral Interface", widely used with embedded systems because it is a simple and efficient interface: basically a multiplexed shift register. Its three signal wires hold a clock (SCK, often in the range of 1-20 MHz), a "Master Out, Slave In" (MOSI) data line, and a "Master In, Slave Out" (MISO) data line. SPI is a full duplex protocol; for each bit shifted out the MOSI line (one per clock) another is shifted in on the MISO line. Those bits are assembled into words of various sizes on the way to and from system memory. An additional chipselect line is usually active-low (nCS); four signals are normally used for each peripheral, plus sometimes an interrupt.
The SPI bus facilities listed here provide a generalized interface to declare SPI busses and devices, manage them according to the standard Linux driver model, and perform input/output operations. At this time, only "master" side interfaces are supported, where Linux talks to SPI peripherals and does not implement such a peripheral itself. (Interfaces to support implementing SPI slaves would necessarily look different.)
The programming interface is structured around two kinds of driver, and two kinds of device. A "Controller Driver" abstracts the controller hardware, which may be as simple as a set of GPIO pins or as complex as a pair of FIFOs connected to dual DMA engines on the other side of the SPI shift register (maximizing throughput). Such drivers bridge between whatever bus they sit on (often the platform bus) and SPI, and expose the SPI side of their device as a struct spi_master. SPI devices are children of that master, represented as a struct spi_device and manufactured from struct spi_board_info descriptors which are usually provided by board-specific initialization code. A struct spi_driver is called a "Protocol Driver", and is bound to a spi_device using normal driver model calls.
The I/O model is a set of queued messages. Protocol drivers submit one or more struct spi_message objects, which are processed and completed asynchronously. (There are synchronous wrappers, however.) Messages are built from one or more struct spi_transfer objects, each of which wraps a full duplex SPI transfer. A variety of protocol tweaking options are needed, because different chips adopt very different policies for how they use the bits transferred with SPI.
struct spi_device — Master side proxy for an SPI slave device
struct spi_device { struct device dev; struct spi_master * master; u32 max_speed_hz; u8 chip_select; u16 mode; #define SPI_CPHA 0x01 #define SPI_CPOL 0x02 #define SPI_MODE_0 (0|0) #define SPI_MODE_1 (0|SPI_CPHA) #define SPI_MODE_2 (SPI_CPOL|0) #define SPI_MODE_3 (SPI_CPOL|SPI_CPHA) #define SPI_CS_HIGH 0x04 #define SPI_LSB_FIRST 0x08 #define SPI_3WIRE 0x10 #define SPI_LOOP 0x20 #define SPI_NO_CS 0x40 #define SPI_READY 0x80 #define SPI_TX_DUAL 0x100 #define SPI_TX_QUAD 0x200 #define SPI_RX_DUAL 0x400 #define SPI_RX_QUAD 0x800 u8 bits_per_word; int irq; void * controller_state; void * controller_data; char modalias[SPI_NAME_SIZE]; int cs_gpio; };
Driver model representation of the device.
SPI controller used with the device.
Maximum clock rate to be used with this chip (on this board); may be changed by the device's driver. The spi_transfer.speed_hz can override this for each transfer.
Chipselect, distinguishing chips handled by master
.
The spi mode defines how data is clocked out and in. This may be changed by the device's driver. The “active low” default for chipselect mode can be overridden (by specifying SPI_CS_HIGH) as can the “MSB first” default for each word in a transfer (by specifying SPI_LSB_FIRST).
Data transfers involve one or more words; word sizes like eight or 12 bits are common. In-memory wordsizes are powers of two bytes (e.g. 20 bit samples use 32 bits). This may be changed by the device's driver, or left at the default (0) indicating protocol words are eight bit bytes. The spi_transfer.bits_per_word can override this for each transfer.
Negative, or the number passed to request_irq
to receive
interrupts from this device.
Controller's runtime state
Board-specific definitions for controller, such as FIFO initialization parameters; from board_info.controller_data
Name of the driver to use with this device, or an alias for that name. This appears in the sysfs “modalias” attribute for driver coldplugging, and in uevents used for hotplugging
gpio number of the chipselect line (optional, -ENOENT when when not using a GPIO line)
A spi_device
is used to interchange data between an SPI slave
(usually a discrete chip) and CPU memory.
In dev
, the platform_data is used to hold information about this
device that's meaningful to the device's protocol driver, but not
to its controller. One example might be an identifier for a chip
variant with slightly different functionality; another might be
information about how this particular board wires the chip's pins.
struct spi_driver — Host side “protocol” driver
struct spi_driver { const struct spi_device_id * id_table; int (* probe) (struct spi_device *spi); int (* remove) (struct spi_device *spi); void (* shutdown) (struct spi_device *spi); int (* suspend) (struct spi_device *spi, pm_message_t mesg); int (* resume) (struct spi_device *spi); struct device_driver driver; };
List of SPI devices supported by this driver
Binds this driver to the spi device. Drivers can verify that the device is actually present, and may need to configure characteristics (such as bits_per_word) which weren't needed for the initial configuration done during system setup.
Unbinds this driver from the spi device
Standard shutdown callback used during system state transitions such as powerdown/halt and kexec
Standard suspend callback used during system state transitions
Standard resume callback used during system state transitions
SPI device drivers should initialize the name and owner field of this structure.
This represents the kind of device driver that uses SPI messages to interact with the hardware at the other end of a SPI link. It's called a “protocol” driver because it works through messages rather than talking directly to SPI hardware (which is what the underlying SPI controller driver does to pass those messages). These protocols are defined in the specification for the device(s) supported by the driver.
As a rule, those device protocols represent the lowest level interface supported by a driver, and it will support upper level interfaces too. Examples of such upper levels include frameworks like MTD, networking, MMC, RTC, filesystem character device nodes, and hardware monitoring.
spi_unregister_driver — reverse effect of spi_register_driver
void fsfuncspi_unregister_driver ( | sdrv) ; |
struct spi_driver * sdrv
;module_spi_driver — Helper macro for registering a SPI driver
fsfuncmodule_spi_driver ( | __spi_driver) ; |
__spi_driver
;struct spi_master — interface to SPI master controller
struct spi_master { struct device dev; struct list_head list; s16 bus_num; u16 num_chipselect; u16 dma_alignment; u16 mode_bits; u32 bits_per_word_mask; #define SPI_BPW_MASK(bits) BIT((bits) - 1) #define SPI_BIT_MASK(bits) (((bits) == 32) ? ~0U : (BIT(bits) - 1)) #define SPI_BPW_RANGE_MASK(min# max) (SPI_BIT_MASK(max) - SPI_BIT_MASK(min - 1)) u32 min_speed_hz; u32 max_speed_hz; u16 flags; #define SPI_MASTER_HALF_DUPLEX BIT(0) #define SPI_MASTER_NO_RX BIT(1) #define SPI_MASTER_NO_TX BIT(2) spinlock_t bus_lock_spinlock; struct mutex bus_lock_mutex; bool bus_lock_flag; int (* setup) (struct spi_device *spi); int (* transfer) (struct spi_device *spi,struct spi_message *mesg); void (* cleanup) (struct spi_device *spi); bool queued; struct kthread_worker kworker; struct task_struct * kworker_task; struct kthread_work pump_messages; spinlock_t queue_lock; struct list_head queue; struct spi_message * cur_msg; bool busy; bool running; bool rt; bool auto_runtime_pm; int (* prepare_transfer_hardware) (struct spi_master *master); int (* transfer_one_message) (struct spi_master *master,struct spi_message *mesg); int (* unprepare_transfer_hardware) (struct spi_master *master); int * cs_gpios; };
device interface to this driver
link with the global spi_master list
board-specific (and often SOC-specific) identifier for a given SPI controller.
chipselects are used to distinguish individual SPI slaves, and are numbered from zero to num_chipselects. each slave has a chipselect signal, but it's common that not every chipselect is connected to a slave.
SPI controller constraint on DMA buffers alignment.
flags understood by this controller driver
A mask indicating which values of bits_per_word are supported by the driver. Bit n indicates that a bits_per_word n+1 is suported. If set, the SPI core will reject any transfer with an unsupported bits_per_word. If not set, this value is simply ignored, and it's up to the individual driver to perform any validation.
Lowest supported transfer speed
Highest supported transfer speed
other constraints relevant to this driver
spinlock for SPI bus locking
mutex for SPI bus locking
indicates that the SPI bus is locked for exclusive use
updates the device mode and clocking records used by a device's SPI controller; protocol code may call this. This must fail if an unrecognized or unsupported mode is requested. It's always safe to call this unless transfers are pending on the device whose settings are being modified.
adds a message to the controller's transfer queue.
frees controller-specific state
whether this master is providing an internal message queue
thread struct for message pump
pointer to task for message pump kworker thread
work struct for scheduling work to the message pump
spinlock to syncronise access to message queue
message queue
the currently in-flight message
message pump is busy
message pump is running
whether this queue is set to run as a realtime task
the core should ensure a runtime PM reference is held while the hardware is prepared, using the parent device for the spidev
a message will soon arrive from the queue so the subsystem requests the driver to prepare the transfer hardware by issuing this call
the subsystem calls the driver to transfer a single
message while queuing transfers that arrive in the meantime. When the
driver is finished with this message, it must call
spi_finalize_current_message
so the subsystem can issue the next
transfer
there are currently no more messages on the queue so the subsystem notifies the driver that it may relax the hardware by issuing this call
Array of GPIOs to use as chip select lines; one per CS number. Any individual value may be -ENOENT for CS lines that are not GPIOs (driven by the SPI controller itself).
Each SPI master controller can communicate with one or more spi_device
children. These make a small bus, sharing MOSI, MISO and SCK signals
but not chip select signals. Each device may be configured to use a
different clock rate, since those shared signals are ignored unless
the chip is selected.
The driver for an SPI controller manages access to those devices through a queue of spi_message transactions, copying data between CPU memory and an SPI slave device. For each such message it queues, it calls the message's completion function when the transaction completes.
struct spi_transfer — a read/write buffer pair
struct spi_transfer { const void * tx_buf; void * rx_buf; unsigned len; dma_addr_t tx_dma; dma_addr_t rx_dma; unsigned cs_change:1; u8 tx_nbits; u8 rx_nbits; #define SPI_NBITS_SINGLE 0x01 #define SPI_NBITS_DUAL 0x02 #define SPI_NBITS_QUAD 0x04 u8 bits_per_word; u16 delay_usecs; u32 speed_hz; struct list_head transfer_list; };
data to be written (dma-safe memory), or NULL
data to be read (dma-safe memory), or NULL
size of rx and tx buffers (in bytes)
DMA address of tx_buf, if spi_message
.is_dma_mapped
DMA address of rx_buf, if spi_message
.is_dma_mapped
affects chipselect after this transfer completes
number of bits used for writting. If 0 the default (SPI_NBITS_SINGLE) is used.
number of bits used for reading. If 0 the default (SPI_NBITS_SINGLE) is used.
select a bits_per_word other than the device default
for this transfer. If 0 the default (from spi_device
) is used.
microseconds to delay after this transfer before
(optionally) changing the chipselect status, then starting
the next transfer or completing this spi_message
.
Select a speed other than the device default for this
transfer. If 0 the default (from spi_device
) is used.
transfers are sequenced through spi_message
.transfers
SPI transfers always write the same number of bytes as they read.
Protocol drivers should always provide rx_buf
and/or tx_buf
.
In some cases, they may also want to provide DMA addresses for
the data being transferred; that may reduce overhead, when the
underlying driver uses dma.
If the transmit buffer is null, zeroes will be shifted out
while filling rx_buf
. If the receive buffer is null, the data
shifted in will be discarded. Only “len” bytes shift out (or in).
It's an error to try to shift out a partial word. (For example, by
shifting out three bytes with word size of sixteen or twenty bits;
the former uses two bytes per word, the latter uses four bytes.)
In-memory data values are always in native CPU byte order, translated
from the wire byte order (big-endian except with SPI_LSB_FIRST). So
for example when bits_per_word is sixteen, buffers are 2N bytes long
(len
= 2N) and hold N sixteen bit words in CPU byte order.
When the word size of the SPI transfer is not a power-of-two multiple of eight bits, those in-memory words include extra bits. In-memory words are always seen by protocol drivers as right-justified, so the undefined (rx) or unused (tx) bits are always the most significant bits.
All SPI transfers start with the relevant chipselect active. Normally it stays selected until after the last transfer in a message. Drivers can affect the chipselect signal using cs_change.
(i) If the transfer isn't the last one in the message, this flag is used to make the chipselect briefly go inactive in the middle of the message. Toggling chipselect in this way may be needed to terminate a chip command, letting a single spi_message perform all of group of chip transactions together.
(ii) When the transfer is the last one in the message, the chip may stay selected until the next transfer. On multi-device SPI busses with nothing blocking messages going to other devices, this is just a performance hint; starting a message to another device deselects this one. But in other cases, this can be used to ensure correctness. Some devices need protocol transactions to be built from a series of spi_message submissions, where the content of one message is determined by the results of previous messages and where the whole transaction ends when the chipselect goes intactive.
When SPI can transfer in 1x,2x or 4x. It can get this tranfer information
from device through tx_nbits
and rx_nbits
. In Bi-direction, these
two should both be set. User can set transfer mode with SPI_NBITS_SINGLE(1x)
SPI_NBITS_DUAL(2x) and SPI_NBITS_QUAD(4x) to support these three transfer.
The code that submits an spi_message (and its spi_transfers) to the lower layers is responsible for managing its memory. Zero-initialize every field you don't set up explicitly, to insulate against future API updates. After you submit a message and its transfers, ignore them until its completion callback.
struct spi_message — one multi-segment SPI transaction
struct spi_message { struct list_head transfers; struct spi_device * spi; unsigned is_dma_mapped:1; void (* complete) (void *context); void * context; unsigned actual_length; int status; struct list_head queue; void * state; };
list of transfer segments in this transaction
SPI device to which the transaction is queued
if true, the caller provided both dma and cpu virtual addresses for each transfer buffer
called to report transaction completions
the argument to complete
when it's called
the total number of bytes that were transferred in all successful segments
zero for success, else negative errno
for use by whichever driver currently owns the message
for use by whichever driver currently owns the message
A spi_message
is used to execute an atomic sequence of data transfers,
each represented by a struct spi_transfer. The sequence is “atomic”
in the sense that no other spi_message may use that SPI bus until that
sequence completes. On some systems, many such sequences can execute as
as single programmed DMA transfer. On all systems, these messages are
queued, and might complete after transactions to other devices. Messages
sent to a given spi_device are alway executed in FIFO order.
The code that submits an spi_message (and its spi_transfers) to the lower layers is responsible for managing its memory. Zero-initialize every field you don't set up explicitly, to insulate against future API updates. After you submit a message and its transfers, ignore them until its completion callback.
spi_message_init_with_transfers — Initialize spi_message and append transfers
void fsfuncspi_message_init_with_transfers ( | m, | |
xfers, | ||
num_xfers) ; |
struct spi_message * m
;struct spi_transfer * xfers
;unsigned int num_xfers
;spi_write — SPI synchronous write
int fsfuncspi_write ( | spi, | |
buf, | ||
len) ; |
struct spi_device * spi
;const void * buf
;size_t len
;spi_read — SPI synchronous read
int fsfuncspi_read ( | spi, | |
buf, | ||
len) ; |
struct spi_device * spi
;void * buf
;size_t len
;spi_sync_transfer — synchronous SPI data transfer
int fsfuncspi_sync_transfer ( | spi, | |
xfers, | ||
num_xfers) ; |
struct spi_device * spi
;struct spi_transfer * xfers
;unsigned int num_xfers
;spi_w8r8 — SPI synchronous 8 bit write followed by 8 bit read
ssize_t fsfuncspi_w8r8 ( | spi, | |
cmd) ; |
struct spi_device * spi
;u8 cmd
;spi_w8r16 — SPI synchronous 8 bit write followed by 16 bit read
ssize_t fsfuncspi_w8r16 ( | spi, | |
cmd) ; |
struct spi_device * spi
;u8 cmd
;struct spi_board_info — board-specific template for a SPI device
struct spi_board_info { char modalias[SPI_NAME_SIZE]; const void * platform_data; void * controller_data; int irq; u32 max_speed_hz; u16 bus_num; u16 chip_select; u16 mode; };
Initializes spi_device.modalias; identifies the driver.
Initializes spi_device.platform_data; the particular data stored there is driver-specific.
Initializes spi_device.controller_data; some controllers need hints about hardware setup, e.g. for DMA.
Initializes spi_device.irq; depends on how the board is wired.
Initializes spi_device.max_speed_hz; based on limits from the chip datasheet and board-specific signal quality issues.
Identifies which spi_master parents the spi_device; unused
by spi_new_device
, and otherwise depends on board wiring.
Initializes spi_device.chip_select; depends on how the board is wired.
Initializes spi_device.mode; based on the chip datasheet, board wiring (some devices support both 3WIRE and standard modes), and possibly presence of an inverter in the chipselect path.
When adding new SPI devices to the device tree, these structures serve
as a partial device template. They hold information which can't always
be determined by drivers. Information that probe
can establish (such
as the default transfer wordsize) is not included here.
These structures are used in two places. Their primary role is to
be stored in tables of board-specific device descriptors, which are
declared early in board initialization and then used (much later) to
populate a controller's device tree after the that controller's driver
initializes. A secondary (and atypical) role is as a parameter to
spi_new_device
call, which happens after those controller drivers
are active in some dynamic board configuration models.
spi_register_board_info — register SPI devices for a given board
int fsfuncspi_register_board_info ( | info, | |
n) ; |
struct spi_board_info const * info
;unsigned n
;Board-specific early init code calls this (probably during arch_initcall) with segments of the SPI device table. Any device nodes are created later, after the relevant parent SPI controller (bus_num) is defined. We keep this table of devices forever, so that reloading a controller driver will not make Linux forget about these hard-wired devices.
Other code can also call this, e.g. a particular add-on board might provide SPI devices through its expansion connector, so code initializing that board would naturally declare its SPI devices.
The board info passed can safely be __initdata ... but be careful of any embedded pointers (platform_data, etc), they're copied as-is.
spi_register_driver — register a SPI driver
int fsfuncspi_register_driver ( | sdrv) ; |
struct spi_driver * sdrv
;spi_alloc_device — Allocate a new SPI device
struct spi_device * fsfuncspi_alloc_device ( | master) ; |
struct spi_master * master
;
Allows a driver to allocate and initialize a spi_device without
registering it immediately. This allows a driver to directly
fill the spi_device with device parameters before calling
spi_add_device
on it.
Caller is responsible to call spi_add_device
on the returned
spi_device structure to add it to the SPI master. If the caller
needs to discard the spi_device without adding it, then it should
call spi_dev_put
on it.
Returns a pointer to the new device, or NULL.
spi_add_device — Add spi_device allocated with spi_alloc_device
int fsfuncspi_add_device ( | spi) ; |
struct spi_device * spi
;spi_new_device — instantiate one new SPI device
struct spi_device * fsfuncspi_new_device ( | master, | |
chip) ; |
struct spi_master * master
;struct spi_board_info * chip
;On typical mainboards, this is purely internal; and it's not needed after board init creates the hard-wired devices. Some development platforms may not be able to use spi_register_board_info though, and this is exported so that for example a USB or parport based adapter driver could add devices (which it would learn about out-of-band).
Returns the new device, or NULL.
spi_get_next_queued_message — called by driver to check for queued messages
struct spi_message * fsfuncspi_get_next_queued_message ( | master) ; |
struct spi_master * master
;spi_finalize_current_message — the current message is complete
void fsfuncspi_finalize_current_message ( | master) ; |
struct spi_master * master
;spi_alloc_master — allocate SPI master controller
struct spi_master * fsfuncspi_alloc_master ( | dev, | |
size) ; |
struct device * dev
;unsigned size
;dev
the controller, possibly using the platform_bus
size
how much zeroed driver-private data to allocate; the pointer to this
memory is in the driver_data field of the returned device,
accessible with spi_master_get_devdata
.
This call is used only by SPI master controller drivers, which are the
only ones directly touching chip registers. It's how they allocate
an spi_master structure, prior to calling spi_register_master
.
This must be called from context that can sleep. It returns the SPI master structure on success, else NULL.
The caller is responsible for assigning the bus number and initializing
the master's methods before calling spi_register_master
; and (after errors
adding the device) calling spi_master_put
and kfree
to prevent a memory
leak.
spi_register_master — register SPI master controller
int fsfuncspi_register_master ( | master) ; |
struct spi_master * master
;
SPI master controllers connect to their drivers using some non-SPI bus,
such as the platform bus. The final stage of probe
in that code
includes calling spi_register_master
to hook up to this SPI bus glue.
SPI controllers use board specific (often SOC specific) bus numbers, and board-specific addressing for SPI devices combines those numbers with chip select numbers. Since SPI does not directly support dynamic device identification, boards need configuration tables telling which chip is at which address.
This must be called from context that can sleep. It returns zero on
success, else a negative error code (dropping the master's refcount).
After a successful return, the caller is responsible for calling
spi_unregister_master
.
spi_unregister_master — unregister SPI master controller
void fsfuncspi_unregister_master ( | master) ; |
struct spi_master * master
;spi_busnum_to_master — look up master associated with bus_num
struct spi_master * fsfuncspi_busnum_to_master ( | bus_num) ; |
u16 bus_num
;spi_setup — setup SPI mode and clock rate
int fsfuncspi_setup ( | spi) ; |
struct spi_device * spi
;SPI protocol drivers may need to update the transfer mode if the device doesn't work with its default. They may likewise need to update clock rates or word sizes from initial values. This function changes those settings, and must be called from a context that can sleep. Except for SPI_CS_HIGH, which takes effect immediately, the changes take effect the next time the device is selected and data is transferred to or from it. When this function returns, the spi device is deselected.
Note that this call will fail if the protocol driver specifies an option that the underlying controller or its driver does not support. For example, not all hardware supports wire transfers using nine bit words, LSB-first wire encoding, or active-high chipselects.
spi_async — asynchronous SPI transfer
int fsfuncspi_async ( | spi, | |
message) ; |
struct spi_device * spi
;struct spi_message * message
;spi
device with which data will be exchanged
message
describes the data transfers, including completion callback
This call may be used in_irq and other contexts which can't sleep, as well as from task contexts which can sleep.
The completion callback is invoked in a context which can't sleep. Before that invocation, the value of message->status is undefined. When the callback is issued, message->status holds either zero (to indicate complete success) or a negative error code. After that callback returns, the driver which issued the transfer request may deallocate the associated memory; it's no longer in use by any SPI core or controller driver code.
Note that although all messages to a spi_device are handled in FIFO order, messages may go to different devices in other orders. Some device might be higher priority, or have various “hard” access time requirements, for example.
On detection of any fault during the transfer, processing of the entire message is aborted, and the device is deselected. Until returning from the associated message completion callback, no other spi_message queued to that device will be processed. (This rule applies equally to all the synchronous transfer calls, which are wrappers around this core asynchronous primitive.)
spi_async_locked — version of spi_async with exclusive bus usage
int fsfuncspi_async_locked ( | spi, | |
message) ; |
struct spi_device * spi
;struct spi_message * message
;spi
device with which data will be exchanged
message
describes the data transfers, including completion callback
This call may be used in_irq and other contexts which can't sleep, as well as from task contexts which can sleep.
The completion callback is invoked in a context which can't sleep. Before that invocation, the value of message->status is undefined. When the callback is issued, message->status holds either zero (to indicate complete success) or a negative error code. After that callback returns, the driver which issued the transfer request may deallocate the associated memory; it's no longer in use by any SPI core or controller driver code.
Note that although all messages to a spi_device are handled in FIFO order, messages may go to different devices in other orders. Some device might be higher priority, or have various “hard” access time requirements, for example.
On detection of any fault during the transfer, processing of the entire message is aborted, and the device is deselected. Until returning from the associated message completion callback, no other spi_message queued to that device will be processed. (This rule applies equally to all the synchronous transfer calls, which are wrappers around this core asynchronous primitive.)
spi_sync — blocking/synchronous SPI data transfers
int fsfuncspi_sync ( | spi, | |
message) ; |
struct spi_device * spi
;struct spi_message * message
;This call may only be used from a context that may sleep. The sleep is non-interruptible, and has no timeout. Low-overhead controller drivers may DMA directly into and out of the message buffers.
Note that the SPI device's chip select is active during the message, and then is normally disabled between messages. Drivers for some frequently-used devices may want to minimize costs of selecting a chip, by leaving it selected in anticipation that the next message will go to the same chip. (That may increase power usage.)
Also, the caller is guaranteeing that the memory associated with the message will not be freed before this call returns.
It returns zero on success, else a negative error code.
spi_sync_locked — version of spi_sync with exclusive bus usage
int fsfuncspi_sync_locked ( | spi, | |
message) ; |
struct spi_device * spi
;struct spi_message * message
;This call may only be used from a context that may sleep. The sleep is non-interruptible, and has no timeout. Low-overhead controller drivers may DMA directly into and out of the message buffers.
This call should be used by drivers that require exclusive access to the SPI bus. It has to be preceded by a spi_bus_lock call. The SPI bus must be released by a spi_bus_unlock call when the exclusive access is over.
It returns zero on success, else a negative error code.
spi_bus_lock — obtain a lock for exclusive SPI bus usage
int fsfuncspi_bus_lock ( | master) ; |
struct spi_master * master
;This call may only be used from a context that may sleep. The sleep is non-interruptible, and has no timeout.
This call should be used by drivers that require exclusive access to the SPI bus. The SPI bus must be released by a spi_bus_unlock call when the exclusive access is over. Data transfer must be done by spi_sync_locked and spi_async_locked calls when the SPI bus lock is held.
It returns zero on success, else a negative error code.
spi_bus_unlock — release the lock for exclusive SPI bus usage
int fsfuncspi_bus_unlock ( | master) ; |
struct spi_master * master
;spi_write_then_read — SPI synchronous write followed by read
int fsfuncspi_write_then_read ( | spi, | |
txbuf, | ||
n_tx, | ||
rxbuf, | ||
n_rx) ; |
struct spi_device * spi
;const void * txbuf
;unsigned n_tx
;void * rxbuf
;unsigned n_rx
;spi
device with which data will be exchanged
txbuf
data to be written (need not be dma-safe)
n_tx
size of txbuf, in bytes
rxbuf
buffer into which data will be read (need not be dma-safe)
n_rx
size of rxbuf, in bytes
This performs a half duplex MicroWire style transaction with the device, sending txbuf and then reading rxbuf. The return value is zero for success, else a negative errno status code. This call may only be used from a context that may sleep.
Parameters to this routine are always copied using a small buffer; portable code should never use this for more than 32 bytes. Performance-sensitive or bulk transfer code should instead use spi_{async,sync}() calls with dma-safe buffers.
Table of Contents
i2c_new_device
I2C (or without fancy typography, "I2C") is an acronym for the "Inter-IC" bus, a simple bus protocol which is widely used where low data rate communications suffice. Since it's also a licensed trademark, some vendors use another name (such as "Two-Wire Interface", TWI) for the same bus. I2C only needs two signals (SCL for clock, SDA for data), conserving board real estate and minimizing signal quality issues. Most I2C devices use seven bit addresses, and bus speeds of up to 400 kHz; there's a high speed extension (3.4 MHz) that's not yet found wide use. I2C is a multi-master bus; open drain signaling is used to arbitrate between masters, as well as to handshake and to synchronize clocks from slower clients.
The Linux I2C programming interfaces support only the master side of bus interactions, not the slave side. The programming interface is structured around two kinds of driver, and two kinds of device. An I2C "Adapter Driver" abstracts the controller hardware; it binds to a physical device (perhaps a PCI device or platform_device) and exposes a struct i2c_adapter representing each I2C bus segment it manages. On each I2C bus segment will be I2C devices represented by a struct i2c_client. Those devices will be bound to a struct i2c_driver, which should follow the standard Linux driver model. (At this writing, a legacy model is more widely used.) There are functions to perform various I2C protocol operations; at this writing all such functions are usable only from task context.
The System Management Bus (SMBus) is a sibling protocol. Most SMBus systems are also I2C conformant. The electrical constraints are tighter for SMBus, and it standardizes particular protocol messages and idioms. Controllers that support I2C can also support most SMBus operations, but SMBus controllers don't support all the protocol options that an I2C controller will. There are functions to perform various SMBus protocol operations, either using I2C primitives or by issuing SMBus commands to i2c_adapter devices which don't support those I2C operations.
struct i2c_driver — represent an I2C device driver
struct i2c_driver { unsigned int class; int (* attach_adapter) (struct i2c_adapter *); int (* probe) (struct i2c_client *, const struct i2c_device_id *); int (* remove) (struct i2c_client *); void (* shutdown) (struct i2c_client *); int (* suspend) (struct i2c_client *, pm_message_t mesg); int (* resume) (struct i2c_client *); void (* alert) (struct i2c_client *, unsigned int data); int (* command) (struct i2c_client *client, unsigned int cmd, void *arg); struct device_driver driver; const struct i2c_device_id * id_table; int (* detect) (struct i2c_client *, struct i2c_board_info *); const unsigned short * address_list; struct list_head clients; };
What kind of i2c device we instantiate (for detect)
Callback for bus addition (deprecated)
Callback for device binding
Callback for device unbinding
Callback for device shutdown
Callback for device suspend
Callback for device resume
Alert callback, for example for the SMBus alert protocol
Callback for bus-wide signaling (optional)
Device driver model driver
List of I2C devices supported by this driver
Callback for device detection
The I2C addresses to probe (for detect)
List of detected clients we created (for i2c-core use only)
The driver.owner field should be set to the module owner of this driver. The driver.name field should be set to the name of this driver.
For automatic device detection, both detect
and address_list
must
be defined. class
should also be set, otherwise only devices forced
with module parameters will be created. The detect function must
fill at least the name field of the i2c_board_info structure it is
handed upon successful detection, and possibly also the flags field.
If detect
is missing, the driver will still work fine for enumerated
devices. Detected devices simply won't be supported. This is expected
for the many I2C/SMBus devices which can't be detected reliably, and
the ones which can always be enumerated in practice.
The i2c_client structure which is handed to the detect
callback is
not a real i2c_client. It is initialized just enough so that you can
call i2c_smbus_read_byte_data and friends on it. Don't do anything
else with it. In particular, calling dev_dbg and friends on it is
not allowed.
struct i2c_client — represent an I2C slave device
struct i2c_client { unsigned short flags; unsigned short addr; char name[I2C_NAME_SIZE]; struct i2c_adapter * adapter; struct i2c_driver * driver; struct device dev; int irq; struct list_head detected; };
I2C_CLIENT_TEN indicates the device uses a ten bit chip address; I2C_CLIENT_PEC indicates it uses SMBus Packet Error Checking
Address used on the I2C bus connected to the parent adapter.
Indicates the type of the device, usually a chip name that's generic enough to hide second-sourcing and compatible revisions.
manages the bus segment hosting this I2C device
device's driver, hence pointer to access routines
Driver model device node for the slave.
indicates the IRQ generated by this device (if any)
member of an i2c_driver.clients list or i2c-core's userspace_devices list
struct i2c_board_info — template for device creation
struct i2c_board_info { char type[I2C_NAME_SIZE]; unsigned short flags; unsigned short addr; void * platform_data; struct dev_archdata * archdata; struct device_node * of_node; struct acpi_dev_node acpi_node; int irq; };
chip type, to initialize i2c_client.name
to initialize i2c_client.flags
stored in i2c_client.addr
stored in i2c_client.dev.platform_data
copied into i2c_client.dev.archdata
pointer to OpenFirmware device node
ACPI device node
stored in i2c_client.irq
I2C doesn't actually support hardware probing, although controllers and devices may be able to use I2C_SMBUS_QUICK to tell whether or not there's a device at a given address. Drivers commonly need more information than that, such as chip type, configuration, associated IRQ, and so on.
i2c_board_info is used to build tables of information listing I2C devices
that are present. This information is used to grow the driver model tree.
For mainboards this is done statically using i2c_register_board_info
;
bus numbers identify adapters that aren't yet available. For add-on boards,
i2c_new_device
does this dynamically with the adapter already known.
I2C_BOARD_INFO — macro used to list an i2c device and its address
fsfuncI2C_BOARD_INFO ( | dev_type, | |
dev_addr) ; |
dev_type
; dev_addr
;struct i2c_bus_recovery_info — I2C bus recovery information
struct i2c_bus_recovery_info { int (* recover_bus) (struct i2c_adapter *); int (* get_scl) (struct i2c_adapter *); void (* set_scl) (struct i2c_adapter *, int val); int (* get_sda) (struct i2c_adapter *); void (* prepare_recovery) (struct i2c_bus_recovery_info *bri); void (* unprepare_recovery) (struct i2c_bus_recovery_info *bri); int scl_gpio; int sda_gpio; };
Recover routine. Either pass driver's recover_bus
routine, or
i2c_generic_scl_recovery
or i2c_generic_gpio_recovery
.
This gets current value of SCL line. Mandatory for generic SCL recovery. Used internally for generic GPIO recovery.
This sets/clears SCL line. Mandatory for generic SCL recovery. Used internally for generic GPIO recovery.
This gets current value of SDA line. Optional for generic SCL recovery. Used internally, if sda_gpio is a valid GPIO, for generic GPIO recovery.
This will be called before starting recovery. Platform may configure padmux here for SDA/SCL line or something else they want.
This will be called after completing recovery. Platform may configure padmux here for SDA/SCL line or something else they want.
gpio number of the SCL line. Only required for GPIO recovery.
gpio number of the SDA line. Only required for GPIO recovery.
module_i2c_driver — Helper macro for registering a I2C driver
fsfuncmodule_i2c_driver ( | __i2c_driver) ; |
__i2c_driver
;i2c_register_board_info — statically declare I2C devices
int fsfunci2c_register_board_info ( | busnum, | |
info, | ||
len) ; |
int busnum
;struct i2c_board_info const * info
;unsigned len
;busnum
identifies the bus to which these devices belong
info
vector of i2c device descriptors
len
how many descriptors in the vector; may be zero to reserve the specified bus number.
Systems using the Linux I2C driver stack can declare tables of board info
while they initialize. This should be done in board-specific init code
near arch_initcall
time, or equivalent, before any I2C adapter driver is
registered. For example, mainboard init code could define several devices,
as could the init code for each daughtercard in a board stack.
The I2C devices will be created later, after the adapter for the relevant bus has been registered. After that moment, standard driver model tools are used to bind “new style” I2C drivers to the devices. The bus number for any device declared using this routine is not available for dynamic allocation.
The board info passed can safely be __initdata, but be careful of embedded pointers (for platform_data, functions, etc) since that won't be copied.
i2c_verify_client — return parameter as i2c_client, or NULL
struct i2c_client * fsfunci2c_verify_client ( | dev) ; |
struct device * dev
;i2c_lock_adapter — Get exclusive access to an I2C bus segment
void fsfunci2c_lock_adapter ( | adapter) ; |
struct i2c_adapter * adapter
;i2c_unlock_adapter — Release exclusive access to an I2C bus segment
void fsfunci2c_unlock_adapter ( | adapter) ; |
struct i2c_adapter * adapter
;i2c_new_device — instantiate an i2c device
struct i2c_client * fsfunci2c_new_device ( | adap, | |
info) ; |
struct i2c_adapter * adap
;struct i2c_board_info const * info
;
Create an i2c device. Binding is handled through driver model
probe
/remove
methods. A driver may be bound to this device when we
return from this function, or any later moment (e.g. maybe hotplugging will
load the driver module). This call is not appropriate for use by mainboard
initialization logic, which usually runs during an arch_initcall
long
before any i2c_adapter could exist.
This returns the new i2c client, which may be saved for later use with
i2c_unregister_device
; or NULL to indicate an error.
i2c_unregister_device —
reverse effect of i2c_new_device
void fsfunci2c_unregister_device ( | client) ; |
struct i2c_client * client
;i2c_new_dummy — return a new i2c device bound to a dummy driver
struct i2c_client * fsfunci2c_new_dummy ( | adapter, | |
address) ; |
struct i2c_adapter * adapter
;u16 address
;This returns an I2C client bound to the “dummy” driver, intended for use with devices that consume multiple addresses. Examples of such chips include various EEPROMS (like 24c04 and 24c08 models).
These dummy devices have two main uses. First, most I2C and SMBus calls
except i2c_transfer
need a client handle; the dummy will be that handle.
And second, this prevents the specified address from being bound to a
different driver.
This returns the new i2c client, which should be saved for later use with
i2c_unregister_device
; or NULL to indicate an error.
i2c_verify_adapter — return parameter as i2c_adapter or NULL
struct i2c_adapter * fsfunci2c_verify_adapter ( | dev) ; |
struct device * dev
;i2c_add_adapter — declare i2c adapter, use dynamic bus number
int fsfunci2c_add_adapter ( | adapter) ; |
struct i2c_adapter * adapter
;This routine is used to declare an I2C adapter when its bus number doesn't matter or when its bus number is specified by an dt alias. Examples of bases when the bus number doesn't matter: I2C adapters dynamically added by USB links or PCI plugin cards.
When this returns zero, a new bus number was allocated and stored in adap->nr, and the specified adapter became available for clients. Otherwise, a negative errno value is returned.
i2c_add_numbered_adapter — declare i2c adapter, use static bus number
int fsfunci2c_add_numbered_adapter ( | adap) ; |
struct i2c_adapter * adap
;This routine is used to declare an I2C adapter when its bus number matters. For example, use it for I2C adapters from system-on-chip CPUs, or otherwise built in to the system's mainboard, and where i2c_board_info is used to properly configure I2C devices.
If the requested bus number is set to -1, then this function will behave identically to i2c_add_adapter, and will dynamically assign a bus number.
If no devices have pre-been declared for this bus, then be sure to register the adapter before any dynamically allocated ones. Otherwise the required bus ID may not be available.
When this returns zero, the specified adapter became available for
clients using the bus number provided in adap->nr. Also, the table
of I2C devices pre-declared using i2c_register_board_info
is scanned,
and the appropriate driver model device nodes are created. Otherwise, a
negative errno value is returned.
i2c_del_adapter — unregister I2C adapter
void fsfunci2c_del_adapter ( | adap) ; |
struct i2c_adapter * adap
;i2c_del_driver — unregister I2C driver
void fsfunci2c_del_driver ( | driver) ; |
struct i2c_driver * driver
;i2c_use_client — increments the reference count of the i2c client structure
struct i2c_client * fsfunci2c_use_client ( | client) ; |
struct i2c_client * client
;i2c_release_client — release a use of the i2c client structure
void fsfunci2c_release_client ( | client) ; |
struct i2c_client * client
;__i2c_transfer — unlocked flavor of i2c_transfer
int fsfunc__i2c_transfer ( | adap, | |
msgs, | ||
num) ; |
struct i2c_adapter * adap
;struct i2c_msg * msgs
;int num
;i2c_transfer — execute a single or combined I2C message
int fsfunci2c_transfer ( | adap, | |
msgs, | ||
num) ; |
struct i2c_adapter * adap
;struct i2c_msg * msgs
;int num
;i2c_master_send — issue a single I2C message in master transmit mode
int fsfunci2c_master_send ( | client, | |
buf, | ||
count) ; |
const struct i2c_client * client
;const char * buf
;int count
;i2c_master_recv — issue a single I2C message in master receive mode
int fsfunci2c_master_recv ( | client, | |
buf, | ||
count) ; |
const struct i2c_client * client
;char * buf
;int count
;i2c_smbus_read_byte — SMBus “receive byte” protocol
s32 fsfunci2c_smbus_read_byte ( | client) ; |
const struct i2c_client * client
;i2c_smbus_write_byte — SMBus “send byte” protocol
s32 fsfunci2c_smbus_write_byte ( | client, | |
value) ; |
const struct i2c_client * client
;u8 value
;i2c_smbus_read_byte_data — SMBus “read byte” protocol
s32 fsfunci2c_smbus_read_byte_data ( | client, | |
command) ; |
const struct i2c_client * client
;u8 command
;i2c_smbus_write_byte_data — SMBus “write byte” protocol
s32 fsfunci2c_smbus_write_byte_data ( | client, | |
command, | ||
value) ; |
const struct i2c_client * client
;u8 command
;u8 value
;i2c_smbus_read_word_data — SMBus “read word” protocol
s32 fsfunci2c_smbus_read_word_data ( | client, | |
command) ; |
const struct i2c_client * client
;u8 command
;i2c_smbus_write_word_data — SMBus “write word” protocol
s32 fsfunci2c_smbus_write_word_data ( | client, | |
command, | ||
value) ; |
const struct i2c_client * client
;u8 command
;u16 value
;i2c_smbus_read_block_data — SMBus “block read” protocol
s32 fsfunci2c_smbus_read_block_data ( | client, | |
command, | ||
values) ; |
const struct i2c_client * client
;u8 command
;u8 * values
;client
Handle to slave device
command
Byte interpreted by slave
values
Byte array into which data will be read; big enough to hold the data returned by the slave. SMBus allows at most 32 bytes.
This executes the SMBus “block read” protocol, returning negative errno else the number of data bytes in the slave's response.
Note that using this function requires that the client's adapter support the I2C_FUNC_SMBUS_READ_BLOCK_DATA functionality. Not all adapter drivers support this; its emulation through I2C messaging relies on a specific mechanism (I2C_M_RECV_LEN) which may not be implemented.
i2c_smbus_write_block_data — SMBus “block write” protocol
s32 fsfunci2c_smbus_write_block_data ( | client, | |
command, | ||
length, | ||
values) ; |
const struct i2c_client * client
;u8 command
;u8 length
;const u8 * values
;i2c_smbus_xfer — execute SMBus protocol operations
s32 fsfunci2c_smbus_xfer ( | adapter, | |
addr, | ||
flags, | ||
read_write, | ||
command, | ||
protocol, | ||
data) ; |
struct i2c_adapter * adapter
;u16 addr
;unsigned short flags
;char read_write
;u8 command
;int protocol
;union i2c_smbus_data * data
;adapter
Handle to I2C bus
addr
Address of SMBus slave on that bus
flags
I2C_CLIENT_* flags (usually zero or I2C_CLIENT_PEC)
read_write
I2C_SMBUS_READ or I2C_SMBUS_WRITE
command
Byte interpreted by slave, for protocols which use such bytes
protocol
SMBus protocol operation to execute, such as I2C_SMBUS_PROC_CALL
data
Data to be read or written
Table of Contents
High Speed Synchronous Serial Interface (HSI) is a serial interface mainly used for connecting application engines (APE) with cellular modem engines (CMT) in cellular handsets. HSI provides multiplexing for up to 16 logical channels, low-latency and full duplex communication.
struct hsi_config — Configuration for RX/TX HSI modules
struct hsi_config { unsigned int mode; unsigned int channels; unsigned int speed; union {unnamed_union}; };
struct hsi_board_info — HSI client board info
struct hsi_board_info { const char * name; unsigned int hsi_id; unsigned int port; struct hsi_config tx_cfg; struct hsi_config rx_cfg; void * platform_data; struct dev_archdata * archdata; };
struct hsi_client — HSI client attached to an HSI port
struct hsi_client { struct device device; struct hsi_config tx_cfg; struct hsi_config rx_cfg; };
struct hsi_client_driver — Driver associated to an HSI client
struct hsi_client_driver { struct device_driver driver; };
struct hsi_msg — HSI message descriptor
struct hsi_msg { struct list_head link; struct hsi_client * cl; struct sg_table sgt; void * context; void (* complete) (struct hsi_msg *msg); void (* destructor) (struct hsi_msg *msg); int status; unsigned int actual_len; unsigned int channel; unsigned int ttype:1; unsigned int break_frame:1; };
Free to use by the current descriptor owner
HSI device client that issues the transfer
Head of the scatterlist array
Client context data associated to the transfer
Transfer completion callback
Destructor to free resources when flushing
Status of the transfer when completed
Actual length of data transfered on completion
Channel were to TX/RX the message
Transfer type (TX if set, RX otherwise)
if true HSI will send/receive a break frame. Data buffers are ignored in the request.
struct hsi_port — HSI port device
struct hsi_port { struct device device; struct hsi_config tx_cfg; struct hsi_config rx_cfg; unsigned int num; unsigned int shared:1; int claimed; struct mutex lock; int (* async) (struct hsi_msg *msg); int (* setup) (struct hsi_client *cl); int (* flush) (struct hsi_client *cl); int (* start_tx) (struct hsi_client *cl); int (* stop_tx) (struct hsi_client *cl); int (* release) (struct hsi_client *cl); struct atomic_notifier_head n_head; };
Driver model representation of the device
Current TX path configuration
Current RX path configuration
Port number
Set when port can be shared by different clients
Reference count of clients which claimed the port
Serialize port claim
Asynchronous transfer callback
Callback to set the HSI client configuration
Callback to clean the HW state and destroy all pending transfers
Callback to inform that a client wants to TX data
Callback to inform that a client no longer wishes to TX data
Callback to inform that a client no longer uses the port
Notifier chain for signaling port events to the clients.
struct hsi_controller — HSI controller device
struct hsi_controller { struct device device; struct module * owner; unsigned int id; unsigned int num_ports; struct hsi_port ** port; };
hsi_id — Get HSI controller ID associated to a client
unsigned int fsfunchsi_id ( | cl) ; |
struct hsi_client * cl
;hsi_port_id — Gets the port number a client is attached to
unsigned int fsfunchsi_port_id ( | cl) ; |
struct hsi_client * cl
;hsi_setup — Configure the client's port
int fsfunchsi_setup ( | cl) ; |
struct hsi_client * cl
;hsi_flush — Flush all pending transactions on the client's port
int fsfunchsi_flush ( | cl) ; |
struct hsi_client * cl
;hsi_async_read — Submit a read transfer
int fsfunchsi_async_read ( | cl, | |
msg) ; |
struct hsi_client * cl
;struct hsi_msg * msg
;hsi_async_write — Submit a write transfer
int fsfunchsi_async_write ( | cl, | |
msg) ; |
struct hsi_client * cl
;struct hsi_msg * msg
;hsi_start_tx — Signal the port that the client wants to start a TX
int fsfunchsi_start_tx ( | cl) ; |
struct hsi_client * cl
;hsi_stop_tx — Signal the port that the client no longer wants to transmit
int fsfunchsi_stop_tx ( | cl) ; |
struct hsi_client * cl
;hsi_unregister_controller — Unregister an HSI controller
void fsfunchsi_unregister_controller ( | hsi) ; |
struct hsi_controller * hsi
;hsi_register_controller — Register an HSI controller and its ports
int fsfunchsi_register_controller ( | hsi) ; |
struct hsi_controller * hsi
;hsi_register_client_driver — Register an HSI client to the HSI bus
int fsfunchsi_register_client_driver ( | drv) ; |
struct hsi_client_driver * drv
;hsi_put_controller — Free an HSI controller
void fsfunchsi_put_controller ( | hsi) ; |
struct hsi_controller * hsi
;hsi_alloc_controller — Allocate an HSI controller and its ports
struct hsi_controller * fsfunchsi_alloc_controller ( | n_ports, | |
flags) ; |
unsigned int n_ports
;gfp_t flags
;hsi_alloc_msg — Allocate an HSI message
struct hsi_msg * fsfunchsi_alloc_msg ( | nents, | |
flags) ; |
unsigned int nents
;gfp_t flags
;hsi_async — Submit an HSI transfer to the controller
int fsfunchsi_async ( | cl, | |
msg) ; |
struct hsi_client * cl
;struct hsi_msg * msg
;The HSI message must have the channel, ttype, complete and destructor fields set beforehand. If nents > 0 then the client has to initialize also the scatterlists to point to the buffers to write to or read from.
HSI controllers relay on pre-allocated buffers from their clients and they do not allocate buffers on their own.
Once the HSI message transfer finishes, the HSI controller calls the complete callback with the status and actual_len fields of the HSI message updated. The complete callback can be called before returning from hsi_async.
Returns -errno on failure or 0 on success
hsi_claim_port — Claim the HSI client's port
int fsfunchsi_claim_port ( | cl, | |
share) ; |
struct hsi_client * cl
;unsigned int share
;hsi_release_port — Release the HSI client's port
void fsfunchsi_release_port ( | cl) ; |
struct hsi_client * cl
;hsi_register_port_event — Register a client to receive port events
int fsfunchsi_register_port_event ( | cl, | |
handler) ; |
struct hsi_client * cl
;void (*handler)
(
struct hsi_client *, unsigned long)
;hsi_unregister_port_event — Stop receiving port events for a client
int fsfunchsi_unregister_port_event ( | cl) ; |
struct hsi_client * cl
;hsi_event — Notifies clients about port events
int fsfunchsi_event ( | port, | |
event) ; |
struct hsi_port * port
;unsigned long event
;