diff options
Diffstat (limited to 'hw')
-rw-r--r-- | hw/omap_gpio.c | 2 | ||||
-rw-r--r-- | hw/pc_piix.c | 12 | ||||
-rw-r--r-- | hw/spapr.c | 10 | ||||
-rw-r--r-- | hw/spapr_vio.c | 40 | ||||
-rw-r--r-- | hw/spapr_vty.c | 39 | ||||
-rw-r--r-- | hw/usb-net.c | 5 |
6 files changed, 88 insertions, 20 deletions
diff --git a/hw/omap_gpio.c b/hw/omap_gpio.c index 42e59c3a53..30630a8aa9 100644 --- a/hw/omap_gpio.c +++ b/hw/omap_gpio.c @@ -510,7 +510,7 @@ static void omap2_gpio_module_write(void *opaque, target_phys_addr_t addr, static uint32_t omap2_gpio_module_readp(void *opaque, target_phys_addr_t addr) { - return omap2_gpio_module_readp(opaque, addr) >> ((addr & 3) << 3); + return omap2_gpio_module_read(opaque, addr & ~3) >> ((addr & 3) << 3); } static void omap2_gpio_module_writep(void *opaque, target_phys_addr_t addr, diff --git a/hw/pc_piix.c b/hw/pc_piix.c index 27ea5707e2..970f43c99c 100644 --- a/hw/pc_piix.c +++ b/hw/pc_piix.c @@ -311,6 +311,18 @@ static QEMUMachine pc_machine_v0_14 = { .desc = "Standard PC", .init = pc_init_pci, .max_cpus = 255, + .compat_props = (GlobalProperty[]) { + { + .driver = "qxl", + .property = "revision", + .value = stringify(2), + },{ + .driver = "qxl-vga", + .property = "revision", + .value = stringify(2), + }, + { /* end of list */ } + }, }; static QEMUMachine pc_machine_v0_13 = { diff --git a/hw/spapr.c b/hw/spapr.c index bdaa938b6b..2b901f105e 100644 --- a/hw/spapr.c +++ b/hw/spapr.c @@ -57,7 +57,7 @@ #define FW_MAX_SIZE 0x400000 #define FW_FILE_NAME "slof.bin" -#define MIN_RAM_SLOF 512UL +#define MIN_RMA_SLOF 128UL #define TIMEBASE_FREQ 512000000ULL @@ -407,7 +407,9 @@ static void ppc_spapr_init(ram_addr_t ram_size, long pteg_shift = 17; char *filename; - spapr = g_malloc(sizeof(*spapr)); + spapr = g_malloc0(sizeof(*spapr)); + QLIST_INIT(&spapr->phbs); + cpu_ppc_hypercall = emulate_spapr_hypercall; /* Allocate RMA if necessary */ @@ -560,9 +562,9 @@ static void ppc_spapr_init(ram_addr_t ram_size, spapr->entry_point = KERNEL_LOAD_ADDR; } else { - if (ram_size < (MIN_RAM_SLOF << 20)) { + if (rma_size < (MIN_RMA_SLOF << 20)) { fprintf(stderr, "qemu: pSeries SLOF firmware requires >= " - "%ldM guest RAM\n", MIN_RAM_SLOF); + "%ldM guest RMA (Real Mode Area memory)\n", MIN_RMA_SLOF); exit(1); } filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, FW_FILE_NAME); diff --git a/hw/spapr_vio.c b/hw/spapr_vio.c index 25cfc9d912..2dcc0361ed 100644 --- a/hw/spapr_vio.c +++ b/hw/spapr_vio.c @@ -66,11 +66,24 @@ VIOsPAPRDevice *spapr_vio_find_by_reg(VIOsPAPRBus *bus, uint32_t reg) QTAILQ_FOREACH(qdev, &bus->bus.children, sibling) { dev = (VIOsPAPRDevice *)qdev; if (dev->reg == reg) { - break; + return dev; } } - return dev; + return NULL; +} + +static char *vio_format_dev_name(VIOsPAPRDevice *dev) +{ + VIOsPAPRDeviceInfo *info = (VIOsPAPRDeviceInfo *)dev->qdev.info; + char *name; + + /* Device tree style name device@reg */ + if (asprintf(&name, "%s@%x", info->dt_name, dev->reg) < 0) { + return NULL; + } + + return name; } #ifdef CONFIG_FDT @@ -78,15 +91,21 @@ static int vio_make_devnode(VIOsPAPRDevice *dev, void *fdt) { VIOsPAPRDeviceInfo *info = (VIOsPAPRDeviceInfo *)dev->qdev.info; - int vdevice_off, node_off; - int ret; + int vdevice_off, node_off, ret; + char *dt_name; vdevice_off = fdt_path_offset(fdt, "/vdevice"); if (vdevice_off < 0) { return vdevice_off; } - node_off = fdt_add_subnode(fdt, vdevice_off, dev->qdev.id); + dt_name = vio_format_dev_name(dev); + if (!dt_name) { + return -ENOMEM; + } + + node_off = fdt_add_subnode(fdt, vdevice_off, dt_name); + free(dt_name); if (node_off < 0) { return node_off; } @@ -608,12 +627,15 @@ static int spapr_vio_busdev_init(DeviceState *qdev, DeviceInfo *qinfo) VIOsPAPRDevice *dev = (VIOsPAPRDevice *)qdev; char *id; - if (asprintf(&id, "%s@%x", info->dt_name, dev->reg) < 0) { - return -1; + /* Don't overwrite ids assigned on the command line */ + if (!dev->qdev.id) { + id = vio_format_dev_name(dev); + if (!id) { + return -1; + } + dev->qdev.id = id; } - dev->qdev.id = id; - dev->qirq = spapr_allocate_irq(dev->vio_irq_num, &dev->vio_irq_num); if (!dev->qirq) { return -1; diff --git a/hw/spapr_vty.c b/hw/spapr_vty.c index a9d4b035e2..f23cc36231 100644 --- a/hw/spapr_vty.c +++ b/hw/spapr_vty.c @@ -58,12 +58,20 @@ static int spapr_vty_init(VIOsPAPRDevice *sdev) { VIOsPAPRVTYDevice *dev = (VIOsPAPRVTYDevice *)sdev; + if (!dev->chardev) { + fprintf(stderr, "spapr-vty: Can't create vty without a chardev!\n"); + exit(1); + } + qemu_chr_add_handlers(dev->chardev, vty_can_receive, vty_receive, NULL, dev); return 0; } +/* Forward declaration */ +static VIOsPAPRDevice *vty_lookup(sPAPREnvironment *spapr, target_ulong reg); + static target_ulong h_put_term_char(CPUState *env, sPAPREnvironment *spapr, target_ulong opcode, target_ulong *args) { @@ -71,9 +79,10 @@ static target_ulong h_put_term_char(CPUState *env, sPAPREnvironment *spapr, target_ulong len = args[1]; target_ulong char0_7 = args[2]; target_ulong char8_15 = args[3]; - VIOsPAPRDevice *sdev = spapr_vio_find_by_reg(spapr->vio_bus, reg); + VIOsPAPRDevice *sdev; uint8_t buf[16]; + sdev = vty_lookup(spapr, reg); if (!sdev) { return H_PARAMETER; } @@ -97,9 +106,10 @@ static target_ulong h_get_term_char(CPUState *env, sPAPREnvironment *spapr, target_ulong *len = args + 0; target_ulong *char0_7 = args + 1; target_ulong *char8_15 = args + 2; - VIOsPAPRDevice *sdev = spapr_vio_find_by_reg(spapr->vio_bus, reg); + VIOsPAPRDevice *sdev; uint8_t buf[16]; + sdev = vty_lookup(spapr, reg); if (!sdev) { return H_PARAMETER; } @@ -140,12 +150,35 @@ static VIOsPAPRDeviceInfo spapr_vty = { .qdev.name = "spapr-vty", .qdev.size = sizeof(VIOsPAPRVTYDevice), .qdev.props = (Property[]) { - DEFINE_SPAPR_PROPERTIES(VIOsPAPRVTYDevice, sdev, 0, 0), + DEFINE_SPAPR_PROPERTIES(VIOsPAPRVTYDevice, sdev, SPAPR_VTY_BASE_ADDRESS, 0), DEFINE_PROP_CHR("chardev", VIOsPAPRVTYDevice, chardev), DEFINE_PROP_END_OF_LIST(), }, }; +static VIOsPAPRDevice *vty_lookup(sPAPREnvironment *spapr, target_ulong reg) +{ + VIOsPAPRDevice *sdev; + + sdev = spapr_vio_find_by_reg(spapr->vio_bus, reg); + if (!sdev && reg == 0) { + DeviceState *qdev; + + /* Hack for kernel early debug, which always specifies reg==0. + * We search all VIO devices, and grab the first available vty + * device. This attempts to mimic existing PowerVM behaviour + * (early debug does work there, despite having no vty with + * reg==0. */ + QTAILQ_FOREACH(qdev, &spapr->vio_bus->bus.children, sibling) { + if (qdev->info == &spapr_vty.qdev) { + return DO_UPCAST(VIOsPAPRDevice, qdev, qdev); + } + } + } + + return sdev; +} + static void spapr_vty_register(void) { spapr_vio_bus_register_withprop(&spapr_vty); diff --git a/hw/usb-net.c b/hw/usb-net.c index f91fa32334..a8b7c8dd76 100644 --- a/hw/usb-net.c +++ b/hw/usb-net.c @@ -1268,9 +1268,8 @@ static ssize_t usbnet_receive(VLANClientState *nc, const uint8_t *buf, size_t si if (is_rndis(s)) { msg = (struct rndis_packet_msg_type *) s->in_buf; - if (s->rndis_state != RNDIS_DATA_INITIALIZED) { + if (!s->rndis_state == RNDIS_DATA_INITIALIZED) return -1; - } if (size + sizeof(struct rndis_packet_msg_type) > sizeof(s->in_buf)) return -1; @@ -1303,7 +1302,7 @@ static int usbnet_can_receive(VLANClientState *nc) { USBNetState *s = DO_UPCAST(NICState, nc, nc)->opaque; - if (is_rndis(s) && s->rndis_state != RNDIS_DATA_INITIALIZED) { + if (is_rndis(s) && !s->rndis_state == RNDIS_DATA_INITIALIZED) { return 1; } |