ETRAX machine updates.
* Move DMA_run into the dma controller to allow for multiple ETRAX/CRIS machines. * Support both ELF and kimage kernel images. * Correct emulation of the DMA RW_DATA register. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4678 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
96768ff79c
commit
fa1bdde4a3
28
hw/etraxfs.c
28
hw/etraxfs.c
|
@ -44,7 +44,6 @@ void etraxfs_ser_init(CPUState *env, qemu_irq *irq, CharDriverState *chr,
|
||||||
#define FLASH_SIZE 0x2000000
|
#define FLASH_SIZE 0x2000000
|
||||||
#define INTMEM_SIZE (128 * 1024)
|
#define INTMEM_SIZE (128 * 1024)
|
||||||
|
|
||||||
static void *etraxfs_dmac;
|
|
||||||
static uint32_t bootstrap_pc;
|
static uint32_t bootstrap_pc;
|
||||||
|
|
||||||
static void main_cpu_reset(void *opaque)
|
static void main_cpu_reset(void *opaque)
|
||||||
|
@ -64,6 +63,7 @@ void bareetraxfs_init (ram_addr_t ram_size, int vga_ram_size,
|
||||||
{
|
{
|
||||||
CPUState *env;
|
CPUState *env;
|
||||||
qemu_irq *pic;
|
qemu_irq *pic;
|
||||||
|
void *etraxfs_dmac;
|
||||||
struct etraxfs_dma_client *eth[2] = {NULL, NULL};
|
struct etraxfs_dma_client *eth[2] = {NULL, NULL};
|
||||||
int kernel_size;
|
int kernel_size;
|
||||||
int i;
|
int i;
|
||||||
|
@ -138,19 +138,20 @@ void bareetraxfs_init (ram_addr_t ram_size, int vga_ram_size,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (kernel_filename) {
|
if (kernel_filename) {
|
||||||
#if 1
|
uint64_t entry;
|
||||||
/* Boots a kernel elf binary, os/linux-2.6/vmlinux from the axis
|
/* Boots a kernel elf binary, os/linux-2.6/vmlinux from the axis
|
||||||
devboard SDK. */
|
devboard SDK. */
|
||||||
kernel_size = load_elf(kernel_filename, 0,
|
kernel_size = load_elf(kernel_filename, 0,
|
||||||
&bootstrap_pc, NULL, NULL);
|
&entry, NULL, NULL);
|
||||||
#else
|
bootstrap_pc = entry;
|
||||||
/* Takes a kimage from the axis devboard SDK. */
|
if (kernel_size < 0) {
|
||||||
kernel_size = load_image(kernel_filename, phys_ram_base + 0x4000);
|
/* Takes a kimage from the axis devboard SDK. */
|
||||||
bootstrap_pc = 0x40004000;
|
kernel_size = load_image(kernel_filename, phys_ram_base + 0x4000);
|
||||||
/* magic for boot. */
|
bootstrap_pc = 0x40004000;
|
||||||
env->regs[8] = 0x56902387;
|
/* magic for boot. */
|
||||||
env->regs[9] = 0x40004000 + kernel_size;
|
env->regs[8] = 0x56902387;
|
||||||
#endif
|
env->regs[9] = 0x40004000 + kernel_size;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
env->pc = bootstrap_pc;
|
env->pc = bootstrap_pc;
|
||||||
|
|
||||||
|
@ -158,11 +159,6 @@ void bareetraxfs_init (ram_addr_t ram_size, int vga_ram_size,
|
||||||
printf ("ram size =%ld\n", ram_size);
|
printf ("ram size =%ld\n", ram_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DMA_run(void)
|
|
||||||
{
|
|
||||||
etraxfs_dmac_run(etraxfs_dmac);
|
|
||||||
}
|
|
||||||
|
|
||||||
QEMUMachine bareetraxfs_machine = {
|
QEMUMachine bareetraxfs_machine = {
|
||||||
"bareetraxfs",
|
"bareetraxfs",
|
||||||
"Bare ETRAX FS board",
|
"Bare ETRAX FS board",
|
||||||
|
|
|
@ -273,6 +273,7 @@ static void channel_load_d(struct fs_dma_ctrl *ctrl, int c)
|
||||||
sizeof ctrl->channels[c].current_d);
|
sizeof ctrl->channels[c].current_d);
|
||||||
|
|
||||||
D(dump_d(c, &ctrl->channels[c].current_d));
|
D(dump_d(c, &ctrl->channels[c].current_d));
|
||||||
|
ctrl->channels[c].regs[RW_DATA] = addr;
|
||||||
ctrl->channels[c].regs[RW_SAVED_DATA_BUF] =
|
ctrl->channels[c].regs[RW_SAVED_DATA_BUF] =
|
||||||
(uint32_t)ctrl->channels[c].current_d.buf;
|
(uint32_t)ctrl->channels[c].current_d.buf;
|
||||||
}
|
}
|
||||||
|
@ -561,7 +562,7 @@ dma_writel (void *opaque, target_phys_addr_t addr, uint32_t value)
|
||||||
switch (addr)
|
switch (addr)
|
||||||
{
|
{
|
||||||
case RW_DATA:
|
case RW_DATA:
|
||||||
printf("RW_DATA=%x\n", value);
|
ctrl->channels[c].regs[addr] = value;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RW_CFG:
|
case RW_CFG:
|
||||||
|
@ -658,6 +659,13 @@ void etraxfs_dmac_connect_client(void *opaque, int c,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void *etraxfs_dmac;
|
||||||
|
void DMA_run(void)
|
||||||
|
{
|
||||||
|
if (etraxfs_dmac)
|
||||||
|
etraxfs_dmac_run(etraxfs_dmac);
|
||||||
|
}
|
||||||
|
|
||||||
void *etraxfs_dmac_init(CPUState *env,
|
void *etraxfs_dmac_init(CPUState *env,
|
||||||
target_phys_addr_t base, int nr_channels)
|
target_phys_addr_t base, int nr_channels)
|
||||||
{
|
{
|
||||||
|
@ -686,6 +694,8 @@ void *etraxfs_dmac_init(CPUState *env,
|
||||||
ctrl->channels[i].regmap);
|
ctrl->channels[i].regmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Hax, we only support one DMA controller at a time. */
|
||||||
|
etraxfs_dmac = ctrl;
|
||||||
return ctrl;
|
return ctrl;
|
||||||
err:
|
err:
|
||||||
qemu_free(ctrl->channels);
|
qemu_free(ctrl->channels);
|
||||||
|
|
Loading…
Reference in a new issue