aboutsummaryrefslogtreecommitdiff
path: root/include/hw/intc/bcm2836_control.h
blob: a410c817e8face3ec748c9fcf146a2cca2cf1512 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
 * Raspberry Pi emulation (c) 2012 Gregory Estrade
 * Upstreaming code cleanup [including bcm2835_*] (c) 2013 Jan Petrous
 *
 * Rasperry Pi 2 emulation and refactoring Copyright (c) 2015, Microsoft
 * Written by Andrew Baumann
 *
 * ARM Local Timer IRQ Copyright (c) 2019. Zoltán Baldaszti
 * Added basic IRQ_TIMER interrupt support
 *
 * This work is licensed under the terms of the GNU GPL, version 2 or later.
 * See the COPYING file in the top-level directory.
 */

#ifndef BCM2836_CONTROL_H
#define BCM2836_CONTROL_H

#include "hw/sysbus.h"
#include "qemu/timer.h"
#include "qom/object.h"

/* 4 mailboxes per core, for 16 total */
#define BCM2836_NCORES 4
#define BCM2836_MBPERCORE 4

#define TYPE_BCM2836_CONTROL "bcm2836-control"
OBJECT_DECLARE_SIMPLE_TYPE(BCM2836ControlState, BCM2836_CONTROL)

struct BCM2836ControlState {
    /*< private >*/
    SysBusDevice busdev;
    /*< public >*/
    MemoryRegion iomem;

    /* mailbox state */
    uint32_t mailboxes[BCM2836_NCORES * BCM2836_MBPERCORE];

    /* interrupt routing/control registers */
    uint8_t route_gpu_irq, route_gpu_fiq;
    uint32_t timercontrol[BCM2836_NCORES];
    uint32_t mailboxcontrol[BCM2836_NCORES];

    /* interrupt status regs (derived from input pins; not visible to user) */
    bool gpu_irq, gpu_fiq;
    uint8_t timerirqs[BCM2836_NCORES];

    /* local timer */
    QEMUTimer timer;
    uint32_t local_timer_control;
    uint8_t route_localtimer;

    /* interrupt source registers, post-routing (also input-derived; visible) */
    uint32_t irqsrc[BCM2836_NCORES];
    uint32_t fiqsrc[BCM2836_NCORES];

    /* outputs to CPU cores */
    qemu_irq irq[BCM2836_NCORES];
    qemu_irq fiq[BCM2836_NCORES];
};

#endif