mirror of https://gitee.com/openkylin/qemu.git
ppc/pnv: introduce pnv*_is_power9() helpers
These are useful when instantiating device models which are shared between the POWER8 and the POWER9 processor families. Signed-off-by: Cédric Le Goater <clg@kaod.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
09279d7e7b
commit
b3b066e9d8
|
@ -51,10 +51,9 @@ static void xscom_complete(CPUState *cs, uint64_t hmer_bits)
|
|||
|
||||
static uint32_t pnv_xscom_pcba(PnvChip *chip, uint64_t addr)
|
||||
{
|
||||
PnvChipClass *pcc = PNV_CHIP_GET_CLASS(chip);
|
||||
|
||||
addr &= (PNV_XSCOM_SIZE - 1);
|
||||
if (pcc->chip_type == PNV_CHIP_POWER9) {
|
||||
|
||||
if (pnv_chip_is_power9(chip)) {
|
||||
return addr >> 3;
|
||||
} else {
|
||||
return ((addr >> 4) & ~0xfull) | ((addr >> 3) & 0xf);
|
||||
|
@ -231,7 +230,6 @@ int pnv_dt_xscom(PnvChip *chip, void *fdt, int root_offset)
|
|||
int xscom_offset;
|
||||
ForeachPopulateArgs args;
|
||||
char *name;
|
||||
PnvChipClass *pcc = PNV_CHIP_GET_CLASS(chip);
|
||||
|
||||
name = g_strdup_printf("xscom@%" PRIx64, be64_to_cpu(reg[0]));
|
||||
xscom_offset = fdt_add_subnode(fdt, root_offset, name);
|
||||
|
@ -242,7 +240,7 @@ int pnv_dt_xscom(PnvChip *chip, void *fdt, int root_offset)
|
|||
_FDT((fdt_setprop_cell(fdt, xscom_offset, "#size-cells", 1)));
|
||||
_FDT((fdt_setprop(fdt, xscom_offset, "reg", reg, sizeof(reg))));
|
||||
|
||||
if (pcc->chip_type == PNV_CHIP_POWER9) {
|
||||
if (pnv_chip_is_power9(chip)) {
|
||||
_FDT((fdt_setprop(fdt, xscom_offset, "compatible", compat_p9,
|
||||
sizeof(compat_p9))));
|
||||
} else {
|
||||
|
|
|
@ -138,6 +138,16 @@ typedef struct PnvMachineState {
|
|||
Notifier powerdown_notifier;
|
||||
} PnvMachineState;
|
||||
|
||||
static inline bool pnv_chip_is_power9(const PnvChip *chip)
|
||||
{
|
||||
return PNV_CHIP_GET_CLASS(chip)->chip_type == PNV_CHIP_POWER9;
|
||||
}
|
||||
|
||||
static inline bool pnv_is_power9(PnvMachineState *pnv)
|
||||
{
|
||||
return pnv_chip_is_power9(pnv->chips[0]);
|
||||
}
|
||||
|
||||
#define PNV_FDT_ADDR 0x01000000
|
||||
#define PNV_TIMEBASE_FREQ 512000000ULL
|
||||
|
||||
|
|
Loading…
Reference in New Issue