Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
irqdomain.c File Reference
#include <linux/debugfs.h>
#include <linux/hardirq.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/irqdesc.h>
#include <linux/irqdomain.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/topology.h>
#include <linux/seq_file.h>
#include <linux/slab.h>
#include <linux/smp.h>
#include <linux/fs.h>

Go to the source code of this file.

Macros

#define pr_fmt(fmt)   "irq: " fmt
 
#define IRQ_DOMAIN_MAP_LEGACY
 
#define IRQ_DOMAIN_MAP_NOMAP   1 /* no fast reverse mapping */
 
#define IRQ_DOMAIN_MAP_LINEAR   2 /* linear map of interrupts */
 
#define IRQ_DOMAIN_MAP_TREE   3 /* radix tree */
 

Functions

void irq_domain_remove (struct irq_domain *domain)
 
 EXPORT_SYMBOL_GPL (irq_domain_remove)
 
struct irq_domainirq_domain_add_simple (struct device_node *of_node, unsigned int size, unsigned int first_irq, const struct irq_domain_ops *ops, void *host_data)
 
struct irq_domainirq_domain_add_legacy (struct device_node *of_node, unsigned int size, unsigned int first_irq, irq_hw_number_t first_hwirq, const struct irq_domain_ops *ops, void *host_data)
 
 EXPORT_SYMBOL_GPL (irq_domain_add_legacy)
 
struct irq_domainirq_domain_add_linear (struct device_node *of_node, unsigned int size, const struct irq_domain_ops *ops, void *host_data)
 
 EXPORT_SYMBOL_GPL (irq_domain_add_linear)
 
struct irq_domainirq_domain_add_nomap (struct device_node *of_node, unsigned int max_irq, const struct irq_domain_ops *ops, void *host_data)
 
 EXPORT_SYMBOL_GPL (irq_domain_add_nomap)
 
struct irq_domainirq_domain_add_tree (struct device_node *of_node, const struct irq_domain_ops *ops, void *host_data)
 
 EXPORT_SYMBOL_GPL (irq_domain_add_tree)
 
struct irq_domainirq_find_host (struct device_node *node)
 
 EXPORT_SYMBOL_GPL (irq_find_host)
 
void irq_set_default_host (struct irq_domain *domain)
 
 EXPORT_SYMBOL_GPL (irq_set_default_host)
 
int irq_domain_associate_many (struct irq_domain *domain, unsigned int irq_base, irq_hw_number_t hwirq_base, int count)
 
 EXPORT_SYMBOL_GPL (irq_domain_associate_many)
 
unsigned int irq_create_direct_mapping (struct irq_domain *domain)
 
 EXPORT_SYMBOL_GPL (irq_create_direct_mapping)
 
unsigned int irq_create_mapping (struct irq_domain *domain, irq_hw_number_t hwirq)
 
 EXPORT_SYMBOL_GPL (irq_create_mapping)
 
int irq_create_strict_mappings (struct irq_domain *domain, unsigned int irq_base, irq_hw_number_t hwirq_base, int count)
 
 EXPORT_SYMBOL_GPL (irq_create_strict_mappings)
 
unsigned int irq_create_of_mapping (struct device_node *controller, const u32 *intspec, unsigned int intsize)
 
 EXPORT_SYMBOL_GPL (irq_create_of_mapping)
 
void irq_dispose_mapping (unsigned int virq)
 
 EXPORT_SYMBOL_GPL (irq_dispose_mapping)
 
unsigned int irq_find_mapping (struct irq_domain *domain, irq_hw_number_t hwirq)
 
 EXPORT_SYMBOL_GPL (irq_find_mapping)
 
unsigned int irq_linear_revmap (struct irq_domain *domain, irq_hw_number_t hwirq)
 
 EXPORT_SYMBOL_GPL (irq_linear_revmap)
 
int irq_domain_xlate_onecell (struct irq_domain *d, struct device_node *ctrlr, const u32 *intspec, unsigned int intsize, unsigned long *out_hwirq, unsigned int *out_type)
 
 EXPORT_SYMBOL_GPL (irq_domain_xlate_onecell)
 
int irq_domain_xlate_twocell (struct irq_domain *d, struct device_node *ctrlr, const u32 *intspec, unsigned int intsize, irq_hw_number_t *out_hwirq, unsigned int *out_type)
 
 EXPORT_SYMBOL_GPL (irq_domain_xlate_twocell)
 
int irq_domain_xlate_onetwocell (struct irq_domain *d, struct device_node *ctrlr, const u32 *intspec, unsigned int intsize, unsigned long *out_hwirq, unsigned int *out_type)
 
 EXPORT_SYMBOL_GPL (irq_domain_xlate_onetwocell)
 
 EXPORT_SYMBOL_GPL (irq_domain_simple_ops)
 

Variables

struct irq_domain_ops irq_domain_simple_ops
 

Macro Definition Documentation

#define IRQ_DOMAIN_MAP_LEGACY
Value:
0 /* driver allocated fixed range of irqs.
* ie. legacy 8259, gets irqs 1..15 */

Definition at line 19 of file irqdomain.c.

#define IRQ_DOMAIN_MAP_LINEAR   2 /* linear map of interrupts */

Definition at line 21 of file irqdomain.c.

#define IRQ_DOMAIN_MAP_NOMAP   1 /* no fast reverse mapping */

Definition at line 20 of file irqdomain.c.

#define IRQ_DOMAIN_MAP_TREE   3 /* radix tree */

Definition at line 22 of file irqdomain.c.

#define pr_fmt (   fmt)    "irq: " fmt

Definition at line 1 of file irqdomain.c.

Function Documentation

EXPORT_SYMBOL_GPL ( irq_domain_remove  )
EXPORT_SYMBOL_GPL ( irq_domain_add_legacy  )
EXPORT_SYMBOL_GPL ( irq_domain_add_linear  )
EXPORT_SYMBOL_GPL ( irq_domain_add_nomap  )
EXPORT_SYMBOL_GPL ( irq_domain_add_tree  )
EXPORT_SYMBOL_GPL ( irq_find_host  )
EXPORT_SYMBOL_GPL ( irq_set_default_host  )
EXPORT_SYMBOL_GPL ( irq_domain_associate_many  )
EXPORT_SYMBOL_GPL ( irq_create_direct_mapping  )
EXPORT_SYMBOL_GPL ( irq_create_mapping  )
EXPORT_SYMBOL_GPL ( irq_create_strict_mappings  )
EXPORT_SYMBOL_GPL ( irq_create_of_mapping  )
EXPORT_SYMBOL_GPL ( irq_dispose_mapping  )
EXPORT_SYMBOL_GPL ( irq_find_mapping  )
EXPORT_SYMBOL_GPL ( irq_linear_revmap  )
EXPORT_SYMBOL_GPL ( irq_domain_xlate_onecell  )
EXPORT_SYMBOL_GPL ( irq_domain_xlate_twocell  )
EXPORT_SYMBOL_GPL ( irq_domain_xlate_onetwocell  )
EXPORT_SYMBOL_GPL ( irq_domain_simple_ops  )
unsigned int irq_create_direct_mapping ( struct irq_domain domain)

irq_create_direct_mapping() - Allocate an irq for direct mapping : domain to allocate the irq for or NULL for default domain

This routine is used for irq controllers which can choose the hardware interrupt numbers they generate. In such a case it's simplest to use the linux irq as the hardware interrupt number.

Definition at line 504 of file irqdomain.c.

unsigned int irq_create_mapping ( struct irq_domain domain,
irq_hw_number_t  hwirq 
)

irq_create_mapping() - Map a hardware interrupt into linux irq space : domain owning this hardware interrupt or NULL for default domain : hardware irq number in that domain space

Only one mapping per hardware interrupt is permitted. Returns a linux irq number. If the sense/trigger is to be specified, set_irq_type() should be called on the number returned from that call.

Definition at line 546 of file irqdomain.c.

unsigned int irq_create_of_mapping ( struct device_node controller,
const u32 intspec,
unsigned int  intsize 
)

Definition at line 638 of file irqdomain.c.

int irq_create_strict_mappings ( struct irq_domain domain,
unsigned int  irq_base,
irq_hw_number_t  hwirq_base,
int  count 
)

irq_create_strict_mappings() - Map a range of hw irqs to fixed linux irqs : domain owning the interrupt range : beginning of linux IRQ range : beginning of hardware IRQ range : Number of interrupts to map

This routine is used for allocating and mapping a range of hardware irqs to linux irqs where the linux irq numbers are at pre-defined locations. For use by controllers that already have static mappings to insert in to the domain.

Non-linear users can use irq_create_identity_mapping() for IRQ-at-a-time domain insertion.

0 is returned upon success, while any failure to establish a static mapping is treated as an error.

Definition at line 618 of file irqdomain.c.

void irq_dispose_mapping ( unsigned int  virq)

irq_dispose_mapping() - Unmap an interrupt : linux irq number of the interrupt to unmap

Definition at line 691 of file irqdomain.c.

struct irq_domain* irq_domain_add_legacy ( struct device_node of_node,
unsigned int  size,
unsigned int  first_irq,
irq_hw_number_t  first_hwirq,
const struct irq_domain_ops ops,
void host_data 
)
read

irq_domain_add_legacy() - Allocate and register a legacy revmap irq_domain. : pointer to interrupt controller's device tree node. : total number of irqs in legacy mapping : first number of irq block assigned to the domain : first hwirq number to use for the translation. Should normally be '0', but a positive integer can be used if the effective hwirqs numbering does not begin at zero. : map/unmap domain callbacks : Controller private data pointer

Note: the map() callback will be called before this function returns for all legacy interrupts except 0 (which is always the invalid irq for a legacy controller).

Definition at line 209 of file irqdomain.c.

struct irq_domain* irq_domain_add_linear ( struct device_node of_node,
unsigned int  size,
const struct irq_domain_ops ops,
void host_data 
)
read

irq_domain_add_linear() - Allocate and register a linear revmap irq_domain. : pointer to interrupt controller's device tree node. : Number of interrupts in the domain. : map/unmap domain callbacks : Controller private data pointer

Definition at line 279 of file irqdomain.c.

struct irq_domain* irq_domain_add_nomap ( struct device_node of_node,
unsigned int  max_irq,
const struct irq_domain_ops ops,
void host_data 
)
read

Definition at line 304 of file irqdomain.c.

struct irq_domain* irq_domain_add_simple ( struct device_node of_node,
unsigned int  size,
unsigned int  first_irq,
const struct irq_domain_ops ops,
void host_data 
)
read

irq_domain_add_simple() - Allocate and register a simple irq_domain. : pointer to interrupt controller's device tree node. : total number of irqs in mapping : first number of irq block assigned to the domain : map/unmap domain callbacks : Controller private data pointer

Allocates a legacy irq_domain if irq_base is positive or a linear domain otherwise. For the legacy domain, IRQ descriptors will also be allocated.

This is intended to implement the expected behaviour for most interrupt controllers which is that a linear mapping should normally be used unless the system requires a legacy mapping in order to support supplying interrupt numbers during non-DT registration of devices.

Definition at line 159 of file irqdomain.c.

struct irq_domain* irq_domain_add_tree ( struct device_node of_node,
const struct irq_domain_ops ops,
void host_data 
)
read

irq_domain_add_tree() : pointer to interrupt controller's device tree node. : map/unmap domain callbacks

Note: The radix tree will be allocated later during boot automatically (the reverse mapping will use the slow path until that happens).

Definition at line 327 of file irqdomain.c.

int irq_domain_associate_many ( struct irq_domain domain,
unsigned int  irq_base,
irq_hw_number_t  hwirq_base,
int  count 
)

Definition at line 435 of file irqdomain.c.

void irq_domain_remove ( struct irq_domain domain)

irq_domain_remove() - Remove an irq domain. : domain to remove

This routine is used to remove an irq domain. The caller must ensure that all mappings within the domain have been disposed of prior to use, depending on the revmap type.

Definition at line 85 of file irqdomain.c.

int irq_domain_xlate_onecell ( struct irq_domain d,
struct device_node ctrlr,
const u32 intspec,
unsigned int  intsize,
unsigned long out_hwirq,
unsigned int out_type 
)

irq_domain_xlate_onecell() - Generic xlate for direct one cell bindings

Device Tree IRQ specifier translation function which works with one cell bindings where the cell value maps directly to the hwirq number.

Definition at line 851 of file irqdomain.c.

int irq_domain_xlate_onetwocell ( struct irq_domain d,
struct device_node ctrlr,
const u32 intspec,
unsigned int  intsize,
unsigned long out_hwirq,
unsigned int out_type 
)

irq_domain_xlate_onetwocell() - Generic xlate for one or two cell bindings

Device Tree IRQ specifier translation function which works with either one or two cell bindings where the cell values map directly to the hwirq number and linux irq flags.

Note: don't use this function unless your interrupt controller explicitly supports both one and two cell bindings. For the majority of controllers the _onecell() or _twocell() variants above should be used.

Definition at line 893 of file irqdomain.c.

int irq_domain_xlate_twocell ( struct irq_domain d,
struct device_node ctrlr,
const u32 intspec,
unsigned int  intsize,
irq_hw_number_t out_hwirq,
unsigned int out_type 
)

irq_domain_xlate_twocell() - Generic xlate for direct two cell bindings

Device Tree IRQ specifier translation function which works with two cell bindings where the cell values map directly to the hwirq number and linux irq flags.

Definition at line 870 of file irqdomain.c.

struct irq_domain* irq_find_host ( struct device_node node)
read

irq_find_host() - Locates a domain for a given device node : device-tree node of the interrupt controller

Definition at line 345 of file irqdomain.c.

unsigned int irq_find_mapping ( struct irq_domain domain,
irq_hw_number_t  hwirq 
)

irq_find_mapping() - Find a linux irq from an hw irq number. : domain owning this hardware interrupt : hardware irq number in that domain space

Definition at line 717 of file irqdomain.c.

unsigned int irq_linear_revmap ( struct irq_domain domain,
irq_hw_number_t  hwirq 
)

irq_linear_revmap() - Find a linux irq from a hw irq number. : domain owning this hardware interrupt : hardware irq number in that domain space

This is a fast path that can be called directly by irq controller code to save a handful of instructions.

Definition at line 759 of file irqdomain.c.

void irq_set_default_host ( struct irq_domain domain)

irq_set_default_host() - Set a "default" irq domain : default domain pointer

For convenience, it's possible to set a "default" domain that will be used whenever NULL is passed to irq_create_mapping(). It makes life easier for platforms that want to manipulate a few hard coded interrupt numbers that aren't properly represented in the device-tree.

Definition at line 381 of file irqdomain.c.

Variable Documentation

struct irq_domain_ops irq_domain_simple_ops
Initial value:

Definition at line 906 of file irqdomain.c.