예제 #1
0
/* Open code a private version of pflash registration since we
 * need to set non-default device width for VExpress platform.
 */
static pflash_t *ve_pflash_cfi01_register(hwaddr base, const char *name,
                                          DriveInfo *di)
{
    DeviceState *dev = qdev_create(NULL, "cfi.pflash01");

    if (di && qdev_prop_set_drive(dev, "drive", di->bdrv)) {
        abort();
    }

    qdev_prop_set_uint32(dev, "num-blocks",
                         VEXPRESS_FLASH_SIZE / VEXPRESS_FLASH_SECT_SIZE);
    qdev_prop_set_uint64(dev, "sector-length", VEXPRESS_FLASH_SECT_SIZE);
    qdev_prop_set_uint8(dev, "width", 4);
    qdev_prop_set_uint8(dev, "device-width", 2);
    qdev_prop_set_uint8(dev, "big-endian", 0);
    qdev_prop_set_uint16(dev, "id0", 0x89);
    qdev_prop_set_uint16(dev, "id1", 0x18);
    qdev_prop_set_uint16(dev, "id2", 0x00);
    qdev_prop_set_uint16(dev, "id3", 0x00);
    qdev_prop_set_string(dev, "name", name);
    qdev_init_nofail(dev);

    sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base);
    return OBJECT_CHECK(pflash_t, (dev), "cfi.pflash01");
}
예제 #2
0
파일: xtfpga.c 프로젝트: JeremyAgost/qemu
static pflash_t *xtfpga_flash_init(MemoryRegion *address_space,
                                   const LxBoardDesc *board,
                                   DriveInfo *dinfo, int be)
{
    SysBusDevice *s;
    DeviceState *dev = qdev_create(NULL, "cfi.pflash01");

    qdev_prop_set_drive(dev, "drive", blk_by_legacy_dinfo(dinfo),
                        &error_abort);
    qdev_prop_set_uint32(dev, "num-blocks",
                         board->flash_size / board->flash_sector_size);
    qdev_prop_set_uint64(dev, "sector-length", board->flash_sector_size);
    qdev_prop_set_uint8(dev, "width", 4);
    qdev_prop_set_bit(dev, "big-endian", be);
    qdev_prop_set_string(dev, "name", "lx60.io.flash");
    qdev_init_nofail(dev);
    s = SYS_BUS_DEVICE(dev);
    memory_region_add_subregion(address_space, board->flash_base,
                                sysbus_mmio_get_region(s, 0));
    return OBJECT_CHECK(pflash_t, (dev), "cfi.pflash01");
}
예제 #3
0
파일: fw_cfg.c 프로젝트: Tracing345/qemu
FWCfgState *fw_cfg_find(void)
{
    return OBJECT_CHECK(FWCfgState, object_resolve_path(FW_CFG_PATH, NULL),
                        TYPE_FW_CFG);
}