![Daniel Henrique Barboza](/assets/img/avatar_default.png)
The PnvPHB device is going to be the base device for all other powernv PHBs. It consists of a device that has the same user API as the other PHB, namely being a PCIHostBridge and having chip-id and index properties. It also has a 'backend' pointer that will be initialized with the PHB implementation that the device is going to use. The initialization of the PHB backend is done by checking the PHB version via a 'version' attribute that can be set via a global machine property. The 'version' field will be used to make adjustments based on the running version, e.g. PHB3 uses a 'chip' reference while PHB4 uses 'pec'. To init the PnvPHB bus we'll rely on helpers for each version. The version 3 helper is already added (pnv_phb3_bus_init), the PHB4 helper will be added later on. For now let's add the basic logic of the PnvPHB object, which consists mostly of pnv_phb_realize() doing all the work of checking the phb->version set, initializing the proper backend, passing through its attributes to the chosen backend, finalizing the backend realize and adding a root port in the end. Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com> Reviewed-by: Frederic Barrat <fbarrat@linux.ibm.com> Message-Id: <20220624084921.399219-3-danielhb413@gmail.com>
40 lines
802 B
C
40 lines
802 B
C
/*
|
|
* QEMU PowerPC PowerNV Proxy PHB model
|
|
*
|
|
* Copyright (c) 2022, IBM Corporation.
|
|
*
|
|
* This code is licensed under the GPL version 2 or later. See the
|
|
* COPYING file in the top-level directory.
|
|
*/
|
|
|
|
#ifndef PCI_HOST_PNV_PHB_H
|
|
#define PCI_HOST_PNV_PHB_H
|
|
|
|
#include "hw/pci/pcie_host.h"
|
|
#include "hw/pci/pcie_port.h"
|
|
#include "qom/object.h"
|
|
|
|
typedef struct PnvChip PnvChip;
|
|
typedef struct PnvPhb4PecState PnvPhb4PecState;
|
|
|
|
struct PnvPHB {
|
|
PCIExpressHost parent_obj;
|
|
|
|
uint32_t chip_id;
|
|
uint32_t phb_id;
|
|
uint32_t version;
|
|
char bus_path[8];
|
|
|
|
PnvChip *chip;
|
|
|
|
PnvPhb4PecState *pec;
|
|
|
|
/* The PHB backend (PnvPHB3, PnvPHB4 ...) being used */
|
|
Object *backend;
|
|
};
|
|
|
|
#define TYPE_PNV_PHB "pnv-phb"
|
|
OBJECT_DECLARE_SIMPLE_TYPE(PnvPHB, PNV_PHB)
|
|
|
|
#endif /* PCI_HOST_PNV_PHB_H */
|