summaryrefslogtreecommitdiffstats
path: root/include/hw/ppc/pnv_occ.h
blob: b78185aecaf2fbdd86cadc1ad0970a1369c63e6b (plain) (blame)
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
62
63
/*
 * QEMU PowerPC PowerNV Emulation of a few OCC related registers
 *
 * Copyright (c) 2015-2017, IBM Corporation.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */

#ifndef PPC_PNV_OCC_H
#define PPC_PNV_OCC_H

#include "hw/ppc/pnv_psi.h"
#include "qom/object.h"

#define TYPE_PNV_OCC "pnv-occ"
OBJECT_DECLARE_TYPE(PnvOCC, PnvOCCClass,
                    PNV_OCC)
#define TYPE_PNV8_OCC TYPE_PNV_OCC "-POWER8"
DECLARE_INSTANCE_CHECKER(PnvOCC, PNV8_OCC,
                         TYPE_PNV8_OCC)
#define TYPE_PNV9_OCC TYPE_PNV_OCC "-POWER9"
DECLARE_INSTANCE_CHECKER(PnvOCC, PNV9_OCC,
                         TYPE_PNV9_OCC)

#define PNV_OCC_SENSOR_DATA_BLOCK_OFFSET 0x00580000
#define PNV_OCC_SENSOR_DATA_BLOCK_SIZE   0x00025800

struct PnvOCC {
    DeviceState xd;

    /* OCC Misc interrupt */
    uint64_t occmisc;

    PnvPsi *psi;

    MemoryRegion xscom_regs;
    MemoryRegion sram_regs;
};


struct PnvOCCClass {
    DeviceClass parent_class;

    int xscom_size;
    const MemoryRegionOps *xscom_ops;
    int psi_irq;
};

#define PNV_OCC_SENSOR_DATA_BLOCK_BASE(i)                               \
    (PNV_OCC_SENSOR_DATA_BLOCK_OFFSET + (i) * PNV_OCC_SENSOR_DATA_BLOCK_SIZE)

#endif /* PPC_PNV_OCC_H */