Skip to content

Commit

Permalink
Merge remote-tracking branch 'pmaydell/tags/pull-arm-devs-20130715' i…
Browse files Browse the repository at this point in the history
…nto staging

arm-devs queue

# gpg: Signature made Mon 15 Jul 2013 10:53:44 AM CDT using RSA key ID 14360CDE
# gpg: Can't check signature: public key not found

# By Peter Maydell (4) and others
# Via Peter Maydell
* pmaydell/tags/pull-arm-devs-20130715:
  ARM/highbank: add support for Calxeda ECX-2000 / Midway
  ARM/highbank: prepare for adding similar machines
  hw/arm/vexpress: Add alias for flash at address 0 on A15 board
  hw/dma/omap_dma: Fix bugs with DMA requests above 32
  sd/pl181.c: Avoid undefined shift behaviour in RWORD macro
  hw/cpu/a15mpcore: Correct default value for num-irq
  char/cadence_uart: Fix reset for unattached instances

Message-id: 1373904095-27592-1-git-send-email-peter.maydell@linaro.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
  • Loading branch information
Anthony Liguori committed Jul 15, 2013
2 parents a34001f + b25a83f commit 1750d01
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 22 deletions.
61 changes: 50 additions & 11 deletions hw/arm/highbank.c
Expand Up @@ -183,20 +183,25 @@ type_init(highbank_regs_register_types)

static struct arm_boot_info highbank_binfo;

enum cxmachines {
CALXEDA_HIGHBANK,
CALXEDA_MIDWAY,
};

/* ram_size must be set to match the upper bound of memory in the
* device tree (linux/arch/arm/boot/dts/highbank.dts), which is
* normally 0xff900000 or -m 4089. When running this board on a
* 32-bit host, set the reg value of memory to 0xf7ff00000 in the
* device tree and pass -m 2047 to QEMU.
*/
static void highbank_init(QEMUMachineInitArgs *args)
static void calxeda_init(QEMUMachineInitArgs *args, enum cxmachines machine)
{
ram_addr_t ram_size = args->ram_size;
const char *cpu_model = args->cpu_model;
const char *kernel_filename = args->kernel_filename;
const char *kernel_cmdline = args->kernel_cmdline;
const char *initrd_filename = args->initrd_filename;
DeviceState *dev;
DeviceState *dev = NULL;
SysBusDevice *busdev;
qemu_irq *irqp;
qemu_irq pic[128];
Expand All @@ -208,7 +213,14 @@ static void highbank_init(QEMUMachineInitArgs *args)
char *sysboot_filename;

if (!cpu_model) {
cpu_model = "cortex-a9";
switch (machine) {
case CALXEDA_HIGHBANK:
cpu_model = "cortex-a9";
break;
case CALXEDA_MIDWAY:
cpu_model = "cortex-a15";
break;
}
}

for (n = 0; n < smp_cpus; n++) {
Expand Down Expand Up @@ -246,7 +258,19 @@ static void highbank_init(QEMUMachineInitArgs *args)
}
}

dev = qdev_create(NULL, "a9mpcore_priv");
switch (machine) {
case CALXEDA_HIGHBANK:
dev = qdev_create(NULL, "l2x0");
qdev_init_nofail(dev);
busdev = SYS_BUS_DEVICE(dev);
sysbus_mmio_map(busdev, 0, 0xfff12000);

dev = qdev_create(NULL, "a9mpcore_priv");
break;
case CALXEDA_MIDWAY:
dev = qdev_create(NULL, "a15mpcore_priv");
break;
}
qdev_prop_set_uint32(dev, "num-cpu", smp_cpus);
qdev_prop_set_uint32(dev, "num-irq", NIRQ_GIC);
qdev_init_nofail(dev);
Expand All @@ -260,11 +284,6 @@ static void highbank_init(QEMUMachineInitArgs *args)
pic[n] = qdev_get_gpio_in(dev, n);
}

dev = qdev_create(NULL, "l2x0");
qdev_init_nofail(dev);
busdev = SYS_BUS_DEVICE(dev);
sysbus_mmio_map(busdev, 0, 0xfff12000);

dev = qdev_create(NULL, "sp804");
qdev_prop_set_uint32(dev, "freq0", 150000000);
qdev_prop_set_uint32(dev, "freq1", 150000000);
Expand Down Expand Up @@ -324,6 +343,16 @@ static void highbank_init(QEMUMachineInitArgs *args)
arm_load_kernel(ARM_CPU(first_cpu), &highbank_binfo);
}

static void highbank_init(QEMUMachineInitArgs *args)
{
calxeda_init(args, CALXEDA_HIGHBANK);
}

static void midway_init(QEMUMachineInitArgs *args)
{
calxeda_init(args, CALXEDA_MIDWAY);
}

static QEMUMachine highbank_machine = {
.name = "highbank",
.desc = "Calxeda Highbank (ECX-1000)",
Expand All @@ -333,9 +362,19 @@ static QEMUMachine highbank_machine = {
DEFAULT_MACHINE_OPTIONS,
};

static void highbank_machine_init(void)
static QEMUMachine midway_machine = {
.name = "midway",
.desc = "Calxeda Midway (ECX-2000)",
.init = midway_init,
.block_default_type = IF_SCSI,
.max_cpus = 4,
DEFAULT_MACHINE_OPTIONS,
};

static void calxeda_machines_init(void)
{
qemu_register_machine(&highbank_machine);
qemu_register_machine(&midway_machine);
}

machine_init(highbank_machine_init);
machine_init(calxeda_machines_init);
19 changes: 17 additions & 2 deletions hw/arm/vexpress.c
Expand Up @@ -67,6 +67,7 @@ enum {
VE_CLCD,
VE_NORFLASH0,
VE_NORFLASH1,
VE_NORFLASHALIAS,
VE_SRAM,
VE_VIDEORAM,
VE_ETHERNET,
Expand Down Expand Up @@ -104,9 +105,11 @@ static hwaddr motherboard_legacy_map[] = {
[VE_VIDEORAM] = 0x4c000000,
[VE_ETHERNET] = 0x4e000000,
[VE_USB] = 0x4f000000,
[VE_NORFLASHALIAS] = -1, /* not present */
};

static hwaddr motherboard_aseries_map[] = {
[VE_NORFLASHALIAS] = 0,
/* CS0: 0x08000000 .. 0x0c000000 */
[VE_NORFLASH0] = 0x08000000,
/* CS4: 0x0c000000 .. 0x10000000 */
Expand Down Expand Up @@ -400,10 +403,13 @@ static void vexpress_common_init(const VEDBoardInfo *daughterboard,
qemu_irq pic[64];
uint32_t sys_id;
DriveInfo *dinfo;
pflash_t *pflash0;
ram_addr_t vram_size, sram_size;
MemoryRegion *sysmem = get_system_memory();
MemoryRegion *vram = g_new(MemoryRegion, 1);
MemoryRegion *sram = g_new(MemoryRegion, 1);
MemoryRegion *flashalias = g_new(MemoryRegion, 1);
MemoryRegion *flash0mem;
const hwaddr *map = daughterboard->motherboard_map;
int i;

Expand Down Expand Up @@ -471,15 +477,24 @@ static void vexpress_common_init(const VEDBoardInfo *daughterboard,
sysbus_create_simple("pl111", map[VE_CLCD], pic[14]);

dinfo = drive_get_next(IF_PFLASH);
if (!pflash_cfi01_register(map[VE_NORFLASH0], NULL, "vexpress.flash0",
pflash0 = pflash_cfi01_register(map[VE_NORFLASH0], NULL, "vexpress.flash0",
VEXPRESS_FLASH_SIZE, dinfo ? dinfo->bdrv : NULL,
VEXPRESS_FLASH_SECT_SIZE,
VEXPRESS_FLASH_SIZE / VEXPRESS_FLASH_SECT_SIZE, 4,
0x00, 0x89, 0x00, 0x18, 0)) {
0x00, 0x89, 0x00, 0x18, 0);
if (!pflash0) {
fprintf(stderr, "vexpress: error registering flash 0.\n");
exit(1);
}

if (map[VE_NORFLASHALIAS] != -1) {
/* Map flash 0 as an alias into low memory */
flash0mem = sysbus_mmio_get_region(SYS_BUS_DEVICE(pflash0), 0);
memory_region_init_alias(flashalias, NULL, "vexpress.flashalias",
flash0mem, 0, VEXPRESS_FLASH_SIZE);
memory_region_add_subregion(sysmem, map[VE_NORFLASHALIAS], flashalias);
}

dinfo = drive_get_next(IF_PFLASH);
if (!pflash_cfi01_register(map[VE_NORFLASH1], NULL, "vexpress.flash1",
VEXPRESS_FLASH_SIZE, dinfo ? dinfo->bdrv : NULL,
Expand Down
4 changes: 3 additions & 1 deletion hw/char/cadence_uart.c
Expand Up @@ -157,7 +157,9 @@ static void uart_rx_reset(UartState *s)
{
s->rx_wpos = 0;
s->rx_count = 0;
qemu_chr_accept_input(s->chr);
if (s->chr) {
qemu_chr_accept_input(s->chr);
}

s->r[R_SR] |= UART_SR_INTR_REMPTY;
s->r[R_SR] &= ~UART_SR_INTR_RFUL;
Expand Down
4 changes: 2 additions & 2 deletions hw/cpu/a15mpcore.c
Expand Up @@ -82,12 +82,12 @@ static int a15mp_priv_init(SysBusDevice *dev)
static Property a15mp_priv_properties[] = {
DEFINE_PROP_UINT32("num-cpu", A15MPPrivState, num_cpu, 1),
/* The Cortex-A15MP may have anything from 0 to 224 external interrupt
* IRQ lines (with another 32 internal). We default to 64+32, which
* IRQ lines (with another 32 internal). We default to 128+32, which
* is the number provided by the Cortex-A15MP test chip in the
* Versatile Express A15 development board.
* Other boards may differ and should set this property appropriately.
*/
DEFINE_PROP_UINT32("num-irq", A15MPPrivState, num_irq, 96),
DEFINE_PROP_UINT32("num-irq", A15MPPrivState, num_irq, 160),
DEFINE_PROP_END_OF_LIST(),
};

Expand Down
11 changes: 6 additions & 5 deletions hw/dma/omap_dma.c
Expand Up @@ -248,7 +248,7 @@ static void omap_dma_deactivate_channel(struct omap_dma_s *s,

/* Don't deactive the channel if it is synchronized and the DMA request is
active */
if (ch->sync && ch->enable && (s->dma->drqbmp & (1 << ch->sync)))
if (ch->sync && ch->enable && (s->dma->drqbmp & (1ULL << ch->sync)))
return;

if (ch->active) {
Expand All @@ -268,8 +268,9 @@ static void omap_dma_enable_channel(struct omap_dma_s *s,
/* TODO: theoretically if ch->sync && ch->prefetch &&
* !s->dma->drqbmp[ch->sync], we should also activate and fetch
* from source and then stall until signalled. */
if ((!ch->sync) || (s->dma->drqbmp & (1 << ch->sync)))
if ((!ch->sync) || (s->dma->drqbmp & (1ULL << ch->sync))) {
omap_dma_activate_channel(s, ch);
}
}
}

Expand Down Expand Up @@ -1551,12 +1552,12 @@ static void omap_dma_request(void *opaque, int drq, int req)
struct omap_dma_s *s = (struct omap_dma_s *) opaque;
/* The request pins are level triggered in QEMU. */
if (req) {
if (~s->dma->drqbmp & (1 << drq)) {
s->dma->drqbmp |= 1 << drq;
if (~s->dma->drqbmp & (1ULL << drq)) {
s->dma->drqbmp |= 1ULL << drq;
omap_dma_process_request(s, drq);
}
} else
s->dma->drqbmp &= ~(1 << drq);
s->dma->drqbmp &= ~(1ULL << drq);
}

/* XXX: this won't be needed once soc_dma knows about clocks. */
Expand Down
2 changes: 1 addition & 1 deletion hw/sd/pl181.c
Expand Up @@ -175,7 +175,7 @@ static void pl181_send_command(pl181_state *s)
if (rlen < 0)
goto error;
if (s->cmd & PL181_CMD_RESPONSE) {
#define RWORD(n) ((response[n] << 24) | (response[n + 1] << 16) \
#define RWORD(n) (((uint32_t)response[n] << 24) | (response[n + 1] << 16) \
| (response[n + 2] << 8) | response[n + 3])
if (rlen == 0 || (rlen == 4 && (s->cmd & PL181_CMD_LONGRESP)))
goto error;
Expand Down

0 comments on commit 1750d01

Please sign in to comment.