2 * QEMU PowerPC PowerNV various definitions
4 * Copyright (c) 2014-2016 BenH, IBM Corporation.
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
22 #include "hw/boards.h"
23 #include "hw/sysbus.h"
24 #include "hw/ppc/pnv_lpc.h"
26 #define TYPE_PNV_CHIP "powernv-chip"
27 #define PNV_CHIP(obj) OBJECT_CHECK(PnvChip, (obj), TYPE_PNV_CHIP)
28 #define PNV_CHIP_CLASS(klass) \
29 OBJECT_CLASS_CHECK(PnvChipClass, (klass), TYPE_PNV_CHIP)
30 #define PNV_CHIP_GET_CLASS(obj) \
31 OBJECT_GET_CLASS(PnvChipClass, (obj), TYPE_PNV_CHIP)
33 typedef enum PnvChipType
{
34 PNV_CHIP_POWER8E
, /* AKA Murano (default) */
35 PNV_CHIP_POWER8
, /* AKA Venice */
36 PNV_CHIP_POWER8NVL
, /* AKA Naples */
37 PNV_CHIP_POWER9
, /* AKA Nimbus */
40 typedef struct PnvChip
{
42 SysBusDevice parent_obj
;
54 MemoryRegion xscom_mmio
;
56 AddressSpace xscom_as
;
61 typedef struct PnvChipClass
{
63 SysBusDeviceClass parent_class
;
66 const char *cpu_model
;
67 PnvChipType chip_type
;
68 uint64_t chip_cfam_id
;
72 hwaddr xscom_core_base
;
74 uint32_t (*core_pir
)(PnvChip
*chip
, uint32_t core_id
);
77 #define TYPE_PNV_CHIP_POWER8E TYPE_PNV_CHIP "-POWER8E"
78 #define PNV_CHIP_POWER8E(obj) \
79 OBJECT_CHECK(PnvChip, (obj), TYPE_PNV_CHIP_POWER8E)
81 #define TYPE_PNV_CHIP_POWER8 TYPE_PNV_CHIP "-POWER8"
82 #define PNV_CHIP_POWER8(obj) \
83 OBJECT_CHECK(PnvChip, (obj), TYPE_PNV_CHIP_POWER8)
85 #define TYPE_PNV_CHIP_POWER8NVL TYPE_PNV_CHIP "-POWER8NVL"
86 #define PNV_CHIP_POWER8NVL(obj) \
87 OBJECT_CHECK(PnvChip, (obj), TYPE_PNV_CHIP_POWER8NVL)
89 #define TYPE_PNV_CHIP_POWER9 TYPE_PNV_CHIP "-POWER9"
90 #define PNV_CHIP_POWER9(obj) \
91 OBJECT_CHECK(PnvChip, (obj), TYPE_PNV_CHIP_POWER9)
94 * This generates a HW chip id depending on an index:
96 * 0x0, 0x1, 0x10, 0x11
98 * 4 chips should be the maximum
100 #define PNV_CHIP_HWID(i) ((((i) & 0x3e) << 3) | ((i) & 0x1))
102 #define TYPE_POWERNV_MACHINE MACHINE_TYPE_NAME("powernv")
103 #define POWERNV_MACHINE(obj) \
104 OBJECT_CHECK(PnvMachineState, (obj), TYPE_POWERNV_MACHINE)
106 typedef struct PnvMachineState
{
108 MachineState parent_obj
;
110 uint32_t initrd_base
;
119 #define PNV_FDT_ADDR 0x01000000
120 #define PNV_TIMEBASE_FREQ 512000000ULL
123 * POWER8 MMIO base addresses
125 #define PNV_XSCOM_SIZE 0x800000000ull
126 #define PNV_XSCOM_BASE(chip) \
127 (chip->xscom_base + ((uint64_t)(chip)->chip_id) * PNV_XSCOM_SIZE)
129 #endif /* _PPC_PNV_H */