master
h 61 lines 1.77 KB
Raw
1 /*
2 * QEMU L2VIC Interrupt Controller
3 *
4 * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 */
7
8 #ifndef HW_INTC_HEX_L2VIC_H
9 #define HW_INTC_HEX_L2VIC_H
10
11 #include "qom/object.h"
12
13 #define TYPE_HEX_L2VIC "hex-l2vic"
14 /*
15 * L2VIC Interface for CPU/GlobalReg interaction
16 */
17 #define TYPE_HEX_L2VIC_INTERFACE "hex-l2vic-if"
18
19 typedef struct HexL2VicInterface HexL2VicInterface;
20
21 typedef struct HexL2VicInterfaceClass {
22 InterfaceClass parent_class;
23
24 uint32_t (*read_vid)(HexL2VicInterface *l2vic, uint32_t group);
25
26 /*
27 * Write the VID: unpack the fields into per-group VIDs. This does
28 * not deliver or clear any interrupt; a pending interrupt stays
29 * gated until ciad.
30 */
31 void (*update_vid)(HexL2VicInterface *l2vic, uint32_t group,
32 uint32_t value);
33
34 /* Clear interrupt using CIAD instruction */
35 void (*clear_interrupt)(HexL2VicInterface *l2vic);
36 } HexL2VicInterfaceClass;
37
38 DECLARE_OBJ_CHECKERS(HexL2VicInterface, HexL2VicInterfaceClass,
39 HEX_L2VIC_INTERFACE, TYPE_HEX_L2VIC_INTERFACE);
40
41 static inline uint32_t l2vic_read_vid(HexL2VicInterface *l2vic,
42 uint32_t group)
43 {
44 HexL2VicInterfaceClass *k = HEX_L2VIC_INTERFACE_GET_CLASS(l2vic);
45 return k->read_vid(l2vic, group);
46 }
47
48 static inline void l2vic_update_vid(HexL2VicInterface *l2vic, uint32_t group,
49 uint32_t value)
50 {
51 HexL2VicInterfaceClass *k = HEX_L2VIC_INTERFACE_GET_CLASS(l2vic);
52 k->update_vid(l2vic, group, value);
53 }
54
55 static inline void l2vic_clear_interrupt(HexL2VicInterface *l2vic)
56 {
57 HexL2VicInterfaceClass *k = HEX_L2VIC_INTERFACE_GET_CLASS(l2vic);
58 k->clear_interrupt(l2vic);
59 }
60
61 #endif /* HW_INTC_HEX_L2VIC_H */