cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

irqchip.h (2687B)


      1/*
      2 * Copyright (C) 2012 Thomas Petazzoni
      3 *
      4 * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
      5 *
      6 * This file is licensed under the terms of the GNU General Public
      7 * License version 2.  This program is licensed "as is" without any
      8 * warranty of any kind, whether express or implied.
      9 */
     10
     11#ifndef _LINUX_IRQCHIP_H
     12#define _LINUX_IRQCHIP_H
     13
     14#include <linux/acpi.h>
     15#include <linux/module.h>
     16#include <linux/of.h>
     17#include <linux/of_irq.h>
     18#include <linux/platform_device.h>
     19
     20/* Undefined on purpose */
     21extern of_irq_init_cb_t typecheck_irq_init_cb;
     22
     23#define typecheck_irq_init_cb(fn)					\
     24	(__typecheck(typecheck_irq_init_cb, &fn) ? fn : fn)
     25
     26/*
     27 * This macro must be used by the different irqchip drivers to declare
     28 * the association between their DT compatible string and their
     29 * initialization function.
     30 *
     31 * @name: name that must be unique across all IRQCHIP_DECLARE of the
     32 * same file.
     33 * @compat: compatible string of the irqchip driver
     34 * @fn: initialization function
     35 */
     36#define IRQCHIP_DECLARE(name, compat, fn)	\
     37	OF_DECLARE_2(irqchip, name, compat, typecheck_irq_init_cb(fn))
     38
     39extern int platform_irqchip_probe(struct platform_device *pdev);
     40
     41#define IRQCHIP_PLATFORM_DRIVER_BEGIN(drv_name) \
     42static const struct of_device_id drv_name##_irqchip_match_table[] = {
     43
     44#define IRQCHIP_MATCH(compat, fn) { .compatible = compat,		\
     45				    .data = typecheck_irq_init_cb(fn), },
     46
     47#define IRQCHIP_PLATFORM_DRIVER_END(drv_name)				\
     48	{},								\
     49};									\
     50MODULE_DEVICE_TABLE(of, drv_name##_irqchip_match_table);		\
     51static struct platform_driver drv_name##_driver = {			\
     52	.probe  = IS_ENABLED(CONFIG_IRQCHIP) ? 				\
     53			platform_irqchip_probe : NULL,			\
     54	.driver = {							\
     55		.name = #drv_name,					\
     56		.owner = THIS_MODULE,					\
     57		.of_match_table = drv_name##_irqchip_match_table,	\
     58		.suppress_bind_attrs = true,				\
     59	},								\
     60};									\
     61builtin_platform_driver(drv_name##_driver)
     62
     63/*
     64 * This macro must be used by the different irqchip drivers to declare
     65 * the association between their version and their initialization function.
     66 *
     67 * @name: name that must be unique across all IRQCHIP_ACPI_DECLARE of the
     68 * same file.
     69 * @subtable: Subtable to be identified in MADT
     70 * @validate: Function to be called on that subtable to check its validity.
     71 *            Can be NULL.
     72 * @data: data to be checked by the validate function.
     73 * @fn: initialization function
     74 */
     75#define IRQCHIP_ACPI_DECLARE(name, subtable, validate, data, fn)	\
     76	ACPI_DECLARE_SUBTABLE_PROBE_ENTRY(irqchip, name,		\
     77					  ACPI_SIG_MADT, subtable,	\
     78					  validate, data, fn)
     79
     80#ifdef CONFIG_IRQCHIP
     81void irqchip_init(void);
     82#else
     83static inline void irqchip_init(void) {}
     84#endif
     85
     86#endif