mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2025-08-24 23:41:23 +01:00

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>
48 lines
1.1 KiB
C
48 lines
1.1 KiB
C
/*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*
|
|
* Copyright (c) 2019 Western Digital Corporation or its affiliates.
|
|
*
|
|
* Authors:
|
|
* Anup Patel <anup.patel@wdc.com>
|
|
*/
|
|
|
|
#ifndef __IRQCHIP_PLIC_H__
|
|
#define __IRQCHIP_PLIC_H__
|
|
|
|
#include <sbi/sbi_types.h>
|
|
|
|
struct plic_data {
|
|
unsigned long addr;
|
|
unsigned long size;
|
|
unsigned long num_src;
|
|
unsigned long flags;
|
|
void *pm_data;
|
|
s16 context_map[][2];
|
|
};
|
|
|
|
/** Work around a bug on Ariane that requires enabling interrupts at boot */
|
|
#define PLIC_FLAG_ARIANE_BUG BIT(0)
|
|
/** PLIC must be delegated to S-mode like T-HEAD C906 and C910 */
|
|
#define PLIC_FLAG_THEAD_DELEGATION BIT(1)
|
|
/** Allocate space for power management save/restore operations */
|
|
#define PLIC_FLAG_ENABLE_PM BIT(2)
|
|
|
|
#define PLIC_M_CONTEXT 0
|
|
#define PLIC_S_CONTEXT 1
|
|
|
|
#define PLIC_DATA_SIZE(__hart_count) (sizeof(struct plic_data) + \
|
|
(__hart_count) * 2 * sizeof(s16))
|
|
|
|
#define PLIC_IE_WORDS(__p) ((__p)->num_src / 32 + 1)
|
|
|
|
struct plic_data *plic_get(void);
|
|
|
|
void plic_suspend(void);
|
|
|
|
void plic_resume(void);
|
|
|
|
int plic_cold_irqchip_init(struct plic_data *plic);
|
|
|
|
#endif
|