forked from Mirrors/opensbi

Have the SBI irqchip core keep track of registered irqchip devices. This is useful for any callbacks the irqchip driver may have, such as for warm initialization, the external interrupt handler function, and any future support for handling external interrupts (beyond IPIs) in M-mode. This improves on the tracking done in fdt_irqchip.c, as it tracks device instances, not just drivers, so callbacks can target a specific device. Signed-off-by: Samuel Holland <samuel.holland@sifive.com> Reviewed-by: Anup Patel <anup@brainfault.org>
54 lines
1.2 KiB
C
54 lines
1.2 KiB
C
/*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*
|
|
* Copyright (c) 2022 Ventana Micro Systems Inc.
|
|
*
|
|
* Authors:
|
|
* Anup Patel <apatel@ventanamicro.com>
|
|
*/
|
|
|
|
#ifndef __SBI_IRQCHIP_H__
|
|
#define __SBI_IRQCHIP_H__
|
|
|
|
#include <sbi/sbi_list.h>
|
|
#include <sbi/sbi_types.h>
|
|
|
|
struct sbi_scratch;
|
|
|
|
/** irqchip hardware device */
|
|
struct sbi_irqchip_device {
|
|
/** Node in the list of irqchip devices */
|
|
struct sbi_dlist node;
|
|
};
|
|
|
|
/**
|
|
* Set external interrupt handling function
|
|
*
|
|
* This function is called by OpenSBI platform code to set a handler for
|
|
* external interrupts
|
|
*
|
|
* @param fn function pointer for handling external irqs
|
|
*/
|
|
void sbi_irqchip_set_irqfn(int (*fn)(void));
|
|
|
|
/**
|
|
* Process external interrupts
|
|
*
|
|
* This function is called by sbi_trap_handler() to handle external
|
|
* interrupts.
|
|
*
|
|
* @param regs pointer for trap registers
|
|
*/
|
|
int sbi_irqchip_process(void);
|
|
|
|
/** Register an irqchip device to receive callbacks */
|
|
void sbi_irqchip_add_device(struct sbi_irqchip_device *dev);
|
|
|
|
/** Initialize interrupt controllers */
|
|
int sbi_irqchip_init(struct sbi_scratch *scratch, bool cold_boot);
|
|
|
|
/** Exit interrupt controllers */
|
|
void sbi_irqchip_exit(struct sbi_scratch *scratch);
|
|
|
|
#endif
|