aboutsummaryrefslogtreecommitdiff
path: root/hw/ppc/pnv.c
diff options
context:
space:
mode:
authorCédric Le Goater <clg@fr.ibm.com>2019-10-21 15:12:11 +0200
committerDavid Gibson <david@gibson.dropbear.id.au>2019-12-17 10:39:47 +1100
commit35dde5766211cac0e608b29b3f71922f116b5932 (patch)
treed30d9e4af9f39d6f1b81951b7cb59d2be5f2565c /hw/ppc/pnv.c
parentcb88904a54903ef6ba21a68a61d9cd51e2166304 (diff)
downloadqemu-35dde5766211cac0e608b29b3f71922f116b5932.zip
qemu-35dde5766211cac0e608b29b3f71922f116b5932.tar.gz
qemu-35dde5766211cac0e608b29b3f71922f116b5932.tar.bz2
ppc/pnv: Add a PNOR model
On a POWERPC PowerNV system, the host firmware is stored in a PNOR flash chip which contents is mapped on the LPC bus. This model adds a simple dummy device to map the contents of a block device in the host address space. Signed-off-by: Cédric Le Goater <clg@kaod.org> Message-Id: <20191021131215.3693-2-clg@kaod.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'hw/ppc/pnv.c')
-rw-r--r--hw/ppc/pnv.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
index 627c08e..d0c1d42 100644
--- a/hw/ppc/pnv.c
+++ b/hw/ppc/pnv.c
@@ -44,6 +44,7 @@
#include "hw/ppc/xics.h"
#include "hw/qdev-properties.h"
#include "hw/ppc/pnv_xscom.h"
+#include "hw/ppc/pnv_pnor.h"
#include "hw/isa/isa.h"
#include "hw/boards.h"
@@ -633,6 +634,8 @@ static void pnv_init(MachineState *machine)
long fw_size;
int i;
char *chip_typename;
+ DriveInfo *pnor = drive_get(IF_MTD, 0, 0);
+ DeviceState *dev;
/* allocate RAM */
if (machine->ram_size < (1 * GiB)) {
@@ -644,6 +647,17 @@ static void pnv_init(MachineState *machine)
machine->ram_size);
memory_region_add_subregion(get_system_memory(), 0, ram);
+ /*
+ * Create our simple PNOR device
+ */
+ dev = qdev_create(NULL, TYPE_PNV_PNOR);
+ if (pnor) {
+ qdev_prop_set_drive(dev, "drive", blk_by_legacy_dinfo(pnor),
+ &error_abort);
+ }
+ qdev_init_nofail(dev);
+ pnv->pnor = PNV_PNOR(dev);
+
/* load skiboot firmware */
if (bios_name == NULL) {
bios_name = FW_FILE_NAME;