forked from Mirrors/opensbi

Currently, each platform keeps track of which irqchip driver is in use and calls its warm init function. Since the generic platform may use multiple irqchip drivers, it has logic to track an array of drivers. The code is simplified and made common across platforms by treating warm init and exit as properties of the driver, not the platform. Then the platform's only role is to select and prepare a driver during cold boot. For now, only add a .warm_init hook, since none of the existing drivers need an .exit hook. It could be added in the future if needed. Signed-off-by: Samuel Holland <samuel.holland@sifive.com> Reviewed-by: Anup Patel <anup@brainfault.org>
59 lines
1.2 KiB
C
59 lines
1.2 KiB
C
/*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*
|
|
* Copyright (c) 2021 Western Digital Corporation or its affiliates.
|
|
* Copyright (c) 2022 Ventana Micro Systems Inc.
|
|
*
|
|
* Authors:
|
|
* Anup Patel <anup.patel@wdc.com>
|
|
*/
|
|
|
|
#ifndef __IRQCHIP_IMSIC_H__
|
|
#define __IRQCHIP_IMSIC_H__
|
|
|
|
#include <sbi/sbi_types.h>
|
|
|
|
#define IMSIC_MMIO_PAGE_SHIFT 12
|
|
#define IMSIC_MMIO_PAGE_SZ (1UL << IMSIC_MMIO_PAGE_SHIFT)
|
|
|
|
#define IMSIC_MAX_REGS 16
|
|
|
|
struct imsic_regs {
|
|
unsigned long addr;
|
|
unsigned long size;
|
|
};
|
|
|
|
struct imsic_data {
|
|
bool targets_mmode;
|
|
u32 guest_index_bits;
|
|
u32 hart_index_bits;
|
|
u32 group_index_bits;
|
|
u32 group_index_shift;
|
|
unsigned long num_ids;
|
|
struct imsic_regs regs[IMSIC_MAX_REGS];
|
|
};
|
|
|
|
#ifdef CONFIG_IRQCHIP_IMSIC
|
|
|
|
int imsic_map_hartid_to_data(u32 hartid, struct imsic_data *imsic, int file);
|
|
|
|
struct imsic_data *imsic_get_data(u32 hartindex);
|
|
|
|
int imsic_get_target_file(u32 hartindex);
|
|
|
|
void imsic_local_irqchip_init(void);
|
|
|
|
int imsic_data_check(struct imsic_data *imsic);
|
|
|
|
int imsic_cold_irqchip_init(struct imsic_data *imsic);
|
|
|
|
#else
|
|
|
|
static inline void imsic_local_irqchip_init(void) { }
|
|
|
|
static inline int imsic_data_check(struct imsic_data *imsic) { return 0; }
|
|
|
|
#endif
|
|
|
|
#endif
|