[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 01/14] ARM: s5pc210: Basic support of s5pc210 bo
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PATCH 01/14] ARM: s5pc210: Basic support of s5pc210 boards |
Date: |
Wed, 7 Dec 2011 11:01:28 +0000 |
If you split this patch up so it is:
1 cmu
2 uart
3 initial basic board
this will be easier to review than a 2000 line patch.
> +DeviceState *s5pc210_uart_create(target_phys_addr_t addr,
> + int fifo_size,
> + int channel,
> + CharDriverState *chr,
> + qemu_irq irq)
> +{
> + DeviceState *dev;
> + SysBusDevice *bus;
> + S5pc210UartState *state;
> +
> + dev = qdev_create(NULL, "s5pc210.uart");
> +
> + if (!chr) {
> + if (channel >= MAX_SERIAL_PORTS) {
> + hw_error("Only %d serial ports are supported by QEMU.\n",
> + MAX_SERIAL_PORTS);
> + }
> + chr = serial_hds[channel];
> + if (!chr) {
> + chr = qemu_chr_new("s5pc210.uart", "null", NULL);
> + if (!(chr)) {
> + hw_error("Can't assign serial port to UART%d.\n", channel);
> + }
> + }
> + }
> +
> + qdev_prop_set_chr(dev, "chardev", chr);
> + qdev_prop_set_uint32(dev, "channel", channel);
> +
> + bus = sysbus_from_qdev(dev);
> + qdev_init_nofail(dev);
> + if (addr != (target_phys_addr_t)-1) {
> + sysbus_mmio_map(bus, 0, addr);
> + }
> + sysbus_connect_irq(bus, 0, irq);
> +
> + state = FROM_SYSBUS(S5pc210UartState, bus);
> +
> + state->rx.size = fifo_size;
> + state->tx.size = fifo_size;
This is wrong. Code at the "qdev_create(something)" level should
not then reach in and mess with the underlying state structure
of the device it's just created. fifo_size should probably be passed
to the device as a qdev property.
> +static int s5pc210_uart_init(SysBusDevice *dev)
> +{
> + S5pc210UartState *s = FROM_SYSBUS(S5pc210UartState, dev);
> +
> + /* memory mapping */
> + memory_region_init_io(&s->iomem, &s5pc210_uart_ops, s, "s5pc210.uart",
> + S5PC210_UART_REGS_MEM_SIZE);
> + sysbus_init_mmio_region(dev, &s->iomem);
> +
> + sysbus_init_irq(dev, &s->irq);
> +
> + qemu_chr_add_handlers(s->chr, s5pc210_uart_can_receive,
> + s5pc210_uart_receive, s5pc210_uart_event, s);
> +
> + vmstate_register(&dev->qdev, -1, &vmstate_s5pc210_uart, s);
> +
> + qemu_register_reset(s5pc210_uart_reset, s);
You can set these up using .qdev.reset and .qdev.vmsd fields
in your SysBusDeviceInfo struct, which is cleaner than calling
functions to register them.
-- PMM
- [Qemu-devel] [PATCH 00/14] ARM: Samsung S5PC210-based boards support., Evgeny Voevodin, 2011/12/07
- [Qemu-devel] [PATCH 02/14] hw/sysbus.h: Increase maximum number of device IRQs., Evgeny Voevodin, 2011/12/07
- [Qemu-devel] [PATCH 05/14] hw/arm_boot.c: Add new secondary CPU bootloader., Evgeny Voevodin, 2011/12/07
- [Qemu-devel] [PATCH 04/14] ARM: s5pc210: PWM support., Evgeny Voevodin, 2011/12/07
- [Qemu-devel] [PATCH 01/14] ARM: s5pc210: Basic support of s5pc210 boards, Evgeny Voevodin, 2011/12/07
- Re: [Qemu-devel] [PATCH 01/14] ARM: s5pc210: Basic support of s5pc210 boards,
Peter Maydell <=
- [Qemu-devel] [PATCH 03/14] ARM: s5pc210: IRQ subsystem support., Evgeny Voevodin, 2011/12/07
- [Qemu-devel] [PATCH 09/14] hw/lan9118.c: Basic byte/word/long access support., Evgeny Voevodin, 2011/12/07
- [Qemu-devel] [PATCH 08/14] ARM: s5pc210: Boot secondary CPU., Evgeny Voevodin, 2011/12/07
- [Qemu-devel] [PATCH 12/14] SD card: add query function to check wether SD card currently ready to recieve data Before executing data transfer to card, we must check that previously issued command wasn't a simple query command (for ex. CMD13), which doesn't require data transfer. Currently, we only can aquire information about whether SD card is in sending data state or not. This patch allows us to query wether previous command was data write command and it was successfully accepted by card (meaning that SD card in recieving data state)., Evgeny Voevodin, 2011/12/07
- [Qemu-devel] [PATCH 06/14] hw/arm_gic.c: lower IRQ only on changing of enable bit., Evgeny Voevodin, 2011/12/07
- [Qemu-devel] [PATCH 14/14] s5pc210: Switch to sysbus_init_mmio., Evgeny Voevodin, 2011/12/07