lm32 and BSP fixes
cover lm32 and BSP fixes
This patchset combines some lm32/bsp fixes and support for the new Milkymist minimac2 hardware.
PATCH 1/4 lm32: fix exception handling
Global interrupt enable bit is already saved within the exception handler helper routine. Thus remove extra code in translation routines.
Additionally, debug exceptions has always DEBA as base address.
--- target-lm32/helper.c | 6 +----- target-lm32/translate.c | 26 -------------------------- 2 files changed, 1 insertions(+), 31 deletions(-)
target-lm32/helper.c +1 -5
@@ -76,11 +76,7 @@ void do_interrupt(CPUState *env) env->regs[R_BA ] = env->pc; env->ie |= (env->ie &IE_IE ) ?IE_BIE :0 ; env->ie &= ~IE_IE ; -if (env->dc &DC_RE ) { - env->pc = env->deba + (env->exception_index *32 ); - }else { - env->pc = env->eba + (env->exception_index *32 ); - } + env->pc = env->deba + (env->exception_index *32 );log_cpu_state_mask (CPU_LOG_INT , env,0 );break ;default :
target-lm32/translate.c +0 -26
@@ -614,36 +614,10 @@ static void dec_scall(DisasContext *dc) t0 =tcg_temp_new (); l1 =gen_new_label (); -/* save IE.IE */ -tcg_gen_andi_tl (t0, cpu_ie,IE_IE ); - -/* IE.IE = 0 */ -tcg_gen_andi_tl (cpu_ie, cpu_ie, ~IE_IE ); -if (dc->imm5 ==7 ) { -/* IE.EIE = IE.IE */ -tcg_gen_ori_tl (cpu_ie, cpu_ie,IE_EIE ); -tcg_gen_brcondi_tl (TCG_COND_EQ , t0,IE_IE , l1); -tcg_gen_andi_tl (cpu_ie, cpu_ie, ~IE_EIE ); -gen_set_label (l1); - -/* gpr[ea] = PC */ -tcg_gen_movi_tl (cpu_R[R_EA ], dc->pc); -tcg_temp_free (t0); -tcg_gen_movi_tl (cpu_pc, dc->pc);t_gen_raise_exception (dc,EXCP_SYSTEMCALL ); }else { -/* IE.BIE = IE.IE */ -tcg_gen_ori_tl (cpu_ie, cpu_ie,IE_BIE ); -tcg_gen_brcondi_tl (TCG_COND_EQ , t0,IE_IE , l1); -tcg_gen_andi_tl (cpu_ie, cpu_ie, ~IE_BIE ); -gen_set_label (l1); - -/* gpr[ba] = PC */ -tcg_gen_movi_tl (cpu_R[R_BA ], dc->pc); -tcg_temp_free (t0); -tcg_gen_movi_tl (cpu_pc, dc->pc);t_gen_raise_exception (dc,EXCP_BREAKPOINT ); }
Signature · 1 line
1.7.2.3
PATCH 2/4 milkymist-vgafb: fix console resizing
In reply to Michael WalleAfter enabling the framebuffer, ensure that the console is resized.
--- hw/milkymist-vgafb.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
hw/milkymist-vgafb.c +3 -0
@@ -199,6 +199,9 @@ vgafb_write(void *opaque, target_phys_addr_t addr, uint32_t value) addr >>=2 ;switch (addr) {case R_CTRL : + s->regs[addr] = value; +vgafb_resize (s); +break ;case R_HSYNC_START :case R_HSYNC_END :case R_HSCAN :
Signature · 1 line
1.7.2.3
PATCH 3/4 milkymist-sysctl: fix timers
In reply to Michael WallePrevent timers from firing right after starting.
--- hw/milkymist-sysctl.c | 26 +++++++------------------- 1 files changed, 7 insertions(+), 19 deletions(-)
hw/milkymist-sysctl.c +7 -19
@@ -140,24 +140,8 @@ static void sysctl_write(void *opaque, target_phys_addr_t addr, uint32_t value)case R_GPIO_OUT :case R_GPIO_INTEN :case R_TIMER0_COUNTER : -if (value > s->regs[R_TIMER0_COUNTER ]) { - value = s->regs[R_TIMER0_COUNTER ]; -error_report ("milkymist_sysctl: timer0: trying to write a " -"value greater than the limit. Clipping." ); - } -/* milkymist timer counts up */ - value = s->regs[R_TIMER0_COUNTER ] - value; -ptimer_set_count (s->ptimer0, value); -break ;case R_TIMER1_COUNTER : -if (value > s->regs[R_TIMER1_COUNTER ]) { - value = s->regs[R_TIMER1_COUNTER ]; -error_report ("milkymist_sysctl: timer1: trying to write a " -"value greater than the limit. Clipping." ); - } -/* milkymist timer counts up */ - value = s->regs[R_TIMER1_COUNTER ] - value; -ptimer_set_count (s->ptimer1, value); + s->regs[addr] = value;break ;case R_TIMER0_COMPARE :ptimer_set_limit (s->ptimer0, value,0 );
@@ -170,10 +154,12 @@ static void sysctl_write(void *opaque, target_phys_addr_t addr, uint32_t value)case R_TIMER0_CONTROL : s->regs[addr] = value;if (s->regs[R_TIMER0_CONTROL ] &CTRL_ENABLE ) { -trace_milkymist_sysctl_start_timer1 (); +trace_milkymist_sysctl_start_timer0 (); +ptimer_set_count (s->ptimer0, + s->regs[R_TIMER0_COMPARE ] - s->regs[R_TIMER0_COUNTER ]);ptimer_run (s->ptimer0,0 ); }else { -trace_milkymist_sysctl_stop_timer1 (); +trace_milkymist_sysctl_stop_timer0 ();ptimer_stop (s->ptimer0); }break ;
@@ -181,6 +167,8 @@ static void sysctl_write(void *opaque, target_phys_addr_t addr, uint32_t value) s->regs[addr] = value;if (s->regs[R_TIMER1_CONTROL ] &CTRL_ENABLE ) {trace_milkymist_sysctl_start_timer1 (); +ptimer_set_count (s->ptimer1, + s->regs[R_TIMER1_COMPARE ] - s->regs[R_TIMER1_COUNTER ]);ptimer_run (s->ptimer1,0 ); }else {trace_milkymist_sysctl_stop_timer1 ();
Signature · 1 line
1.7.2.3
PATCH 4/4 lm32: add Milkymist Minimac2 support
In reply to Michael WalleThis patch adds support for Milkymist's minimal Ethernet MAC v2. It superseds minimac1.
--- Makefile.target | 2 +- hw/milkymist-hw.h | 20 ++ hw/milkymist-minimac.c | 568 ----------------------------------------------- hw/milkymist-minimac2.c | 539 ++++++++++++++++++++++++++++++++++++++++++++ hw/milkymist.c | 2 +- trace-events | 23 +- 6 files changed, 573 insertions(+), 581 deletions(-) delete mode 100644 hw/milkymist-minimac.c create mode 100644 hw/milkymist-minimac2.c
Makefile.target +1 -1
@@ -271,7 +271,7 @@ obj-lm32-y += lm32_sys.o obj-lm32-y += milkymist-ac97.o obj-lm32-y += milkymist-hpdmc.o obj-lm32-y += milkymist-memcard.o -obj-lm32-y += milkymist-minimac.o +obj-lm32-y += milkymist-minimac2.o obj-lm32-y += milkymist-pfpu.o obj-lm32-y += milkymist-softusb.o obj-lm32-y += milkymist-sysctl.o
hw/milkymist-hw.h +20 -0
@@ -1,6 +1,9 @@#ifndef QEMU_HW_MILKYMIST_H #define QEMU_HW_MILKYMIST_H +#include "qdev.h" +#include "qdev-addr.h" +static inline DeviceState *milkymist_uart_create (target_phys_addr_t base,qemu_irq rx_irq,qemu_irq tx_irq) {
@@ -183,6 +186,23 @@ static inline DeviceState *milkymist_minimac_create(target_phys_addr_t base,return dev; } +static inline DeviceState *milkymist_minimac2_create (target_phys_addr_t base, +target_phys_addr_t buffers_base,qemu_irq rx_irq,qemu_irq tx_irq) +{ +DeviceState *dev; + +qemu_check_nic_model (&nd_table[0 ],"minimac2" ); + dev =qdev_create (NULL ,"milkymist-minimac2" ); +qdev_prop_set_taddr (dev,"buffers_base" , buffers_base); +qdev_set_nic_properties (dev, &nd_table[0 ]); +qdev_init_nofail (dev); +sysbus_mmio_map (sysbus_from_qdev (dev),0 , base); +sysbus_connect_irq (sysbus_from_qdev (dev),0 , rx_irq); +sysbus_connect_irq (sysbus_from_qdev (dev),1 , tx_irq); + +return dev; +} +static inline DeviceState *milkymist_softusb_create (target_phys_addr_t base,qemu_irq irq,uint32_t pmem_base,uint32_t pmem_size,uint32_t dmem_base,uint32_t dmem_size)
hw/milkymist-minimac.c deleted +0 -568
568 lines not on this page · raw message
hw/milkymist-minimac2.c new file +539 -0
539 lines not on this page · raw message
hw/milkymist.c +1 -1
@@ -156,7 +156,7 @@ milkymist_init(ram_addr_t ram_size_not_used,milkymist_ac97_create (0x60005000 , irq[5 ], irq[6 ], irq[7 ], irq[8 ]);milkymist_pfpu_create (0x60006000 , irq[9 ]);milkymist_tmu2_create (0x60007000 , irq[10 ]); -milkymist_minimac_create (0x60008000 , irq[11 ], irq[12 ]); +milkymist_minimac2_create (0x60008000 ,0x30000000 , irq[11 ], irq[12 ]);milkymist_softusb_create (0x6000f000 , irq[17 ],0x20000000 ,0x1000 ,0x20020000 ,0x2000 );
trace-events +12 -11
@@ -308,17 +308,18 @@ disable milkymist_hpdmc_memory_write(uint32_t addr, uint32_t value) "addr=%08x v disable milkymist_memcard_memory_read(uint32_t addr, uint32_t value) "addr %08x value %08x" disable milkymist_memcard_memory_write(uint32_t addr, uint32_t value) "addr %08x value %08x" -# hw/milkymist-minimac.c -disable milkymist_minimac_memory_read(uint32_t addr, uint32_t value) "addr %08x value %08x" -disable milkymist_minimac_memory_write(uint32_t addr, uint32_t value) "addr %08x value %08x" -disable milkymist_minimac_mdio_write(uint8_t phy_addr, uint8_t addr, uint16_t value) "phy_addr %02x addr %02x value %04x" -disable milkymist_minimac_mdio_read(uint8_t phy_addr, uint8_t addr, uint16_t value) "phy_addr %02x addr %02x value %04x" -disable milkymist_minimac_tx_frame(uint32_t length) "length %u" -disable milkymist_minimac_rx_frame(const void *buf, uint32_t length) "buf %p length %u" -disable milkymist_minimac_drop_rx_frame(const void *buf) "buf %p" -disable milkymist_minimac_rx_transfer(const void *buf, uint32_t length) "buf %p length %d" -disable milkymist_minimac_pulse_irq_rx(void) "Pulse IRQ RX" -disable milkymist_minimac_pulse_irq_tx(void) "Pulse IRQ TX" +# hw/milkymist-minimac2.c +disable milkymist_minimac2_memory_read(uint32_t addr, uint32_t value) "addr %08x value %08x" +disable milkymist_minimac2_memory_write(uint32_t addr, uint32_t value) "addr %08x value %08x" +disable milkymist_minimac2_mdio_write(uint8_t phy_addr, uint8_t addr, uint16_t value) "phy_addr %02x addr %02x value %04x" +disable milkymist_minimac2_mdio_read(uint8_t phy_addr, uint8_t addr, uint16_t value) "phy_addr %02x addr %02x value %04x" +disable milkymist_minimac2_tx_frame(uint32_t length) "length %u" +disable milkymist_minimac2_rx_frame(const void *buf, uint32_t length) "buf %p length %u" +disable milkymist_minimac2_drop_rx_frame(const void *buf) "buf %p" +disable milkymist_minimac2_rx_transfer(const void *buf, uint32_t length) "buf %p length %d" +disable milkymist_minimac2_raise_irq_rx(void) "Raise IRQ RX" +disable milkymist_minimac2_lower_irq_rx(void) "Lower IRQ RX" +disable milkymist_minimac2_pulse_irq_tx(void) "Pulse IRQ TX" # hw/milkymist-pfpu.c disable milkymist_pfpu_memory_read(uint32_t addr, uint32_t value) "addr %08x value %08x"
Signature · 1 line
1.7.2.3
Am Mittwoch 13 April 2011, 00:29:32 schrieb Michael Walle:
Quoted 2 lines
This patchset combines some lm32/bsp fixes and support for the new Milkymist minimac2 hardware.
Ping :)
Signature · 1 line
Michael