r2d add pflash support
PATCH 1/3 r2d add pflash support
--- Makefile.target | 2 +- hw/r2d.c | 27 +++++++++++++++++++++------ hw/sh7750_regs.h | 12 ++++++++++++ 3 files changed, 34 insertions(+), 7 deletions(-)
Makefile.target +1 -1
@@ -681,7 +681,7 @@ endif ifeq ($(TARGET_BASE_ARCH), sh4) OBJS+= shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o OBJS+= sh_timer.o sh_serial.o sh_intc.o sh_pci.o sm501.o serial.o -OBJS+= ide.o +OBJS+= ide.o pflash_cfi02.o endif ifeq ($(TARGET_BASE_ARCH), m68k) OBJS+= an5206.o mcf5206.o mcf_uart.o mcf_intc.o mcf5208.o mcf_fec.o
hw/r2d.c +21 -6
@@ -31,9 +31,11 @@#include "pci.h" #include "net.h" #include "sh7750_regs.h" +#include "flash.h" -#define SDRAM_BASE 0x0c000000/* Physical location of SDRAM: Area 3 */ -#define SDRAM_SIZE 0x04000000 +#define SDRAM_BASE SH7750_A3_BASE/* Physical location of SDRAM: Area 3 */ +#define SDRAM_SIZE 0x04000000 +#define FLASH_SIZE 0x02000000#define SM501_VRAM_SIZE 0x800000
@@ -204,6 +206,7 @@ static void r2d_init(ram_addr_t ram_size, int vga_ram_size,qemu_irq *irq;PCIBus *pci;int i; +int index;if (!cpu_model) cpu_model ="SH7751R" ;
@@ -219,10 +222,10 @@ static void r2d_init(ram_addr_t ram_size, int vga_ram_size,cpu_register_physical_memory (SDRAM_BASE ,SDRAM_SIZE , sdram_addr);/* Register peripherals */ s =sh7750_init (env); - irq =r2d_fpga_init (0x04000000 ,sh7750_irl (s)); + irq =r2d_fpga_init (SH7750_A1_BASE ,sh7750_irl (s)); pci =sh_pci_register_bus (r2d_pci_set_irq, r2d_pci_map_irq, irq,0 ,4 ); -sm501_init (0x10000000 ,SM501_VRAM_SIZE , irq[SM501 ], serial_hds[2 ]); +sm501_init (SH7750_A4_BASE ,SM501_VRAM_SIZE , irq[SM501 ], serial_hds[2 ]);/* onboard CF (True IDE mode, Master only). */ if ((i =drive_get_index (IF_IDE ,0 ,0 )) !=-1 )
@@ -233,6 +236,18 @@ static void r2d_init(ram_addr_t ram_size, int vga_ram_size,for (i =0 ; i < nb_nics; i++)pci_nic_init (pci, &nd_table[i], (i==0 )?2 <<3 :-1 ,"rtl8139" ); +if ((index =drive_get_index (IF_PFLASH ,0 ,0 )) >-1 ) { +uint32_t sector_len =128 *1024 ; + +if (!pflash_cfi02_register (SH7750_A0_BASE ,qemu_ram_alloc (FLASH_SIZE ), + drives_table[index].bdrv, sector_len,FLASH_SIZE / sector_len, +1 ,4 ,0 ,0 ,0 ,0 ,0 ,0 )) { +fprintf (stderr,"qemu: Error registering flash memory.\n" ); + }else { + env->pc =SH7750_P2_BASE ; + } + } +/* Todo: register on board registers */ if (kernel_filename) {int kernel_size;
@@ -244,11 +259,11 @@ static void r2d_init(ram_addr_t ram_size, int vga_ram_size, kernel_size =load_image_targphys (kernel_filename,SDRAM_BASE +LINUX_LOAD_OFFSET ,SDRAM_SIZE -LINUX_LOAD_OFFSET ); - env->pc = (SDRAM_BASE +LINUX_LOAD_OFFSET ) |0xa0000000 ; + env->pc = (SDRAM_BASE +LINUX_LOAD_OFFSET ) |SH7750_P2_BASE ;pstrcpy_targphys (SDRAM_BASE +0x10100 ,256 , kernel_cmdline); }else { kernel_size =load_image_targphys (kernel_filename,SDRAM_BASE ,SDRAM_SIZE ); - env->pc =SDRAM_BASE |0xa0000000 ;/* Start from P2 area */ + env->pc =SDRAM_BASE |SH7750_P2_BASE ;/* Start from P2 area */ }if (kernel_size <0 ) {
hw/sh7750_regs.h +12 -0
@@ -23,6 +23,7 @@* All register has 2 addresses: in 0xff000000 - 0xffffffff (P4 address) and * in 0x1f000000 - 0x1fffffff (area 7 address) */ +#define SH7750_P2_BASE 0xa0000000#define SH7750_P4_BASE 0xff000000/* Accessable only in priveleged mode */ #define SH7750_A7_BASE 0x1f000000/* Accessable only using TLB */
@@ -31,6 +32,17 @@#define SH7750_A7_REG32 (ofs) (SH7750_A7_BASE + (ofs))/* +* External Memory Space +*/ +#define SH7750_A0_BASE 0x00000000 +#define SH7750_A1_BASE 0x04000000 +#define SH7750_A2_BASE 0x08000000 +#define SH7750_A3_BASE 0x0C000000 +#define SH7750_A4_BASE 0x10000000 +#define SH7750_A5_BASE 0x14000000 +#define SH7750_A6_BASE 0x18000000 + +/* * MMU Registers */
Signature · 1 line
1.6.2.1
PATCH 2/3 sh: SCI improvements
From: Shin-ichiro KAWASAKI <[email protected]>
SE7750 uses SCI := Serial Communication Interface for one of consoles. This patch completes the SCI implementation, and makes SCI available for a console.
# Tabs and spaces are mixed in "hw/sh_serial.c" so much. # Some clean up might be useful.
--- hw/sh_serial.c | 92 ++++++++++++++++++++++++++++++++----------------------- 1 files changed, 53 insertions(+), 39 deletions(-)
hw/sh_serial.c +53 -39
@@ -96,7 +96,7 @@ static void sh_serial_ioport_write(void *opaque, uint32_t offs, uint32_t val) s->scr = val & ((s->feat &SH_SERIAL_FEAT_SCIF ) ?0xfa :0xff );if (!(val & (1 <<5 ))) s->flags |=SH_SERIAL_FLAG_TEND ; -if ((s->feat &SH_SERIAL_FEAT_SCIF ) && s->txi) { +if (s->txi) {qemu_set_irq (s->txi, val & (1 <<7 )); }if (!(val & (1 <<6 ))) {
@@ -109,13 +109,15 @@ static void sh_serial_ioport_write(void *opaque, uint32_t offs, uint32_t val)qemu_chr_write (s->chr, &ch,1 ); } s->dr = val; - s->flags &= ~SH_SERIAL_FLAG_TDE ; +if (s->feat &SH_SERIAL_FEAT_SCIF ) + s->flags &= ~SH_SERIAL_FLAG_TDE ; +else + s->flags |=SH_SERIAL_FLAG_TDE ;return ; -#if 0 case 0x14 :/* FRDR / RDR */ - ret =0 ; +/* do nothing */ +return ;break ; -#endif }if (s->feat &SH_SERIAL_FEAT_SCIF ) {switch (offs) {
@@ -165,17 +167,33 @@ static void sh_serial_ioport_write(void *opaque, uint32_t offs, uint32_t val)case 0x24 :/* LSR */ return ; } - } -else { + }else {/* SCI */ switch (offs) { -#if 0 -case 0x0c : - ret = s->dr; -break ; -case 0x10 : - ret =0 ; -break ; -#endif +case 0x0c :/* TDR */ +if (s->chr) { + ch = val; +qemu_chr_write (s->chr, &ch,1 ); + } + s->dr = val; + s->flags |=SH_SERIAL_FLAG_TDE |SH_SERIAL_FLAG_TEND ; +if (s->scr & (1 <<7 ) && s->txi) { +qemu_set_irq (s->txi,1 ); + } +return ; +case 0x10 :/* SSR */ +/* +* Ignore TDRE (1 << 7) bit because TDR is always +* writable in this SCI emulation. +*/ +if (!(val & (1 <<6 ))) { + s->flags &= ~SH_SERIAL_FLAG_RDF ; + } +if (!(val & (1 <<6 ))) { +if (s->rxi) { +qemu_set_irq (s->rxi,0 ); + } + } +return ;case 0x1c : s->sptr = val &0x8f ;return ;
@@ -191,30 +209,19 @@ static uint32_t sh_serial_ioport_read(void *opaque, uint32_t offs)sh_serial_state *s = opaque;uint32_t ret = ~0 ; -#if 0 switch (offs) { -case 0x00 : +case 0x00 :/* SMR */ ret = s->smr;break ; -case 0x04 : +case 0x04 :/* BRR */ ret = s->brr;break ; -case 0x08 : +case 0x08 :/* SCR */ ret = s->scr;break ; -case 0x14 : - ret =0 ; -break ; } -#endif if (s->feat &SH_SERIAL_FEAT_SCIF ) {switch (offs) { -case 0x00 :/* SMR */ - ret = s->smr; -break ; -case 0x08 :/* SCR */ - ret = s->scr; -break ;case 0x10 :/* FSR */ ret =0 ;if (s->flags &SH_SERIAL_FLAG_TEND )
@@ -242,11 +249,9 @@ static uint32_t sh_serial_ioport_read(void *opaque, uint32_t offs) s->flags &= ~SH_SERIAL_FLAG_RDF ; }break ; -#if 0 case 0x18 : ret = s->fcr;break ; -#endif case 0x1c : ret = s->rx_cnt;break ;
@@ -257,21 +262,26 @@ static uint32_t sh_serial_ioport_read(void *opaque, uint32_t offs) ret =0 ;break ; } - } -else { + }else {switch (offs) { -#if 0 -case 0x0c : +case 0x0c :/* TDR */ ret = s->dr;break ; -case 0x10 : +case 0x10 :/* SSR */ ret =0 ; +if (s->flags &SH_SERIAL_FLAG_TDE ) + ret |= (1 <<7 ); +if (s->flags &SH_SERIAL_FLAG_RDF ) + ret |= (1 <<6 ); +if (s->flags &SH_SERIAL_FLAG_TEND ) + ret |= (1 <<2 ); +/* TODO : handle bit MPBT */ break ; -case 0x14 : +case 0x14 :/* RDR */ ret = s->rx_fifo[0 ]; + s->flags &= ~SH_SERIAL_FLAG_RDF ;break ; -#endif -case 0x1c : +case 0x1c :/* SPTR */ ret = s->sptr;break ; }
@@ -311,6 +321,10 @@ static void sh_serial_receive_byte(sh_serial_state *s, int ch) } }else { s->rx_fifo[0 ] = ch; + s->flags |=SH_SERIAL_FLAG_RDF ; +if (s->scr & (1 <<6 ) && s->rxi) { +qemu_set_irq (s->rxi,1 ); + } } }
Signature · 1 line
1.6.2.1
PATCH 3/3 sh/serial: allow cpu regs definition
sh_serial_regs will allow to define the SCI/SCIF cpu regs need to add SH cpu other than sh7750
--- hw/sh.h | 2 + hw/sh7750.c | 30 +++++++++++++++++++- hw/sh_serial.c | 86 ++++++++++++++++++++++++++----------------------------- hw/sh_serial.h | 42 +++++++++++++++++++++++++++ 4 files changed, 114 insertions(+), 46 deletions(-) create mode 100644 hw/sh_serial.h
hw/sh.h +2 -0
@@ -3,6 +3,7 @@/* Definitions for SH board emulation. */ #include "sh_intc.h" +#include "sh_serial.h" #define A7ADDR (x) ((x) & 0x1fffffff)#define P4ADDR (x) ((x) | 0xe0000000)
@@ -38,6 +39,7 @@ void tmu012_init(target_phys_addr_t base, int feat, uint32_t freq,/* sh_serial.c */ #define SH_SERIAL_FEAT_SCIF (1 << 0) void sh_serial_init (target_phys_addr_t base, int feat, + sh_serial_regs *regs, uint32_t freq, CharDriverState *chr, qemu_irq eri_source, qemu_irq rxi_source,
hw/sh7750.c +29 -1
@@ -30,6 +30,7 @@#include "sh7750_regs.h" #include "sh7750_regnames.h" #include "sh_intc.h" +#include "sh_serial.h" #include "exec-all.h" #include "cpu.h"
@@ -701,6 +702,31 @@ static CPUWriteMemoryFunc *sh7750_mmct_write[] = { sh7750_mmct_writel }; +sh_serial_regs sh7750_sci = { + .scsmr =0x0 , + .scbrr =0x4 , + .scscr =0x8 , + .scftdr =0xc ,/* AS TDR for SCI */ + .scfsr =0x10 ,/* AS SSR for SCI */ + .scfrdr =0x14 ,/* AS RDR for SCI */ + .scscmr =0x18 , + .scsptr =0x1c , +}; + +sh_serial_regs sh7750_scif = { + .scsmr =0x0 , + .scbrr =0x4 , + .scscr =0x8 , + .scftdr =0xc , + .scfsr =0x10 , + .scfrdr =0x14 , + .scfcr =0x18 , + .scfdr =0x1c , + .scsptr =0x20 , + .sclsr =0x24 , +}; + +SH7750State *sh7750_init (CPUSH4State * cpu) {SH7750State *s;
@@ -742,13 +768,15 @@ SH7750State *sh7750_init(CPUSH4State * cpu) cpu->intc_handle = &s->intc; -sh_serial_init (0x1fe00000 ,0 , s->periph_freq, serial_hds[0 ], +sh_serial_init (0x1fe00000 ,0 , &sh7750_sci, + s->periph_freq, serial_hds[0 ], s->intc.irqs[SCI1_ERI ], s->intc.irqs[SCI1_RXI ], s->intc.irqs[SCI1_TXI ], s->intc.irqs[SCI1_TEI ],NULL ); sh_serial_init(0x1fe80000, SH_SERIAL_FEAT_SCIF, + &sh7750_scif, s->periph_freq, serial_hds[1], s->intc.irqs[SCIF_ERI], s->intc.irqs[SCIF_RXI],
hw/sh_serial.c +41 -45
212 lines not on this page · raw message
hw/sh_serial.h new file +42 -0
42 lines not on this page · raw message
Signature · 1 line
1.6.2.1
PATCH 1/1 r2dplus: add cfi flash support and enable it
--- arch/sh/boards/mach-r2d/setup.c | 49 ++++++++++++++++ arch/sh/configs/rts7751r2dplus_defconfig | 91 +++++++++++++++++++++++++++++- 2 files changed, 137 insertions(+), 3 deletions(-)
arch/sh/boards/mach-r2d/setup.c +49 -0
@@ -10,6 +10,10 @@*/ #include <linux/init.h> #include <linux/platform_device.h> +#include <linux/mtd/mtd.h> +#include <linux/mtd/partitions.h> +#include <linux/mtd/physmap.h> +#include <linux/mtd/map.h> #include <linux/ata_platform.h> #include <linux/sm501.h> #include <linux/sm501-regs.h>
@@ -181,10 +185,55 @@ static struct platform_device sm501_device = { .resource = sm501_resources, }; +static struct mtd_partition r2d_partitions[] = { + { + .name ="U-Boot" , + .offset =0x00000000 , + .size =0x00040000 , + .mask_flags =MTD_WRITEABLE , + }, { + .name ="Environment" , + .offset =MTDPART_OFS_NXTBLK , + .size =0x00040000 , + .mask_flags =MTD_WRITEABLE , + }, { + .name ="Kernel" , + .offset =MTDPART_OFS_NXTBLK , + .size =0x001c0000 , + }, { + .name ="Flash_FS" , + .offset =MTDPART_OFS_NXTBLK , + .size =MTDPART_SIZ_FULL , + } +}; + +static struct physmap_flash_data flash_data = { + .width =2 , + .nr_parts =ARRAY_SIZE (r2d_partitions), + .parts = r2d_partitions, +}; + +static struct resource flash_resource = { + .start =0x00000000 , + .end =0x02000000 , + .flags =IORESOURCE_MEM , +}; + +static struct platform_device flash_device = { + .name ="physmap-flash" , + .id =-1 , + .resource = &flash_resource, + .num_resources =1 , + .dev = { + .platform_data = &flash_data, + }, +}; +static struct platform_device *rts7751r2d_devices[]__initdata = { &sm501_device, &heartbeat_device, &spi_sh_sci_device, + &flash_device, };/*
arch/sh/configs/rts7751r2dplus_defconfig +88 -3
102 lines not on this page · raw message
Signature · 1 line
1.6.1.3
PATCH 1/1 sh/r2d: add default pflash file support
In reply to Jean-Christophe PLAGNIOL-VILLARDthe default flash file containt the last U-Boot release : 2009.03
it's store compressed (gzip) as it's a dump of a 32MB CFI Flash and will be uncompressed at the install
--- Makefile | 13 +++++++++++++ configure | 14 ++++++++++++++ hw/r2d.c | 26 +++++++++++++++++--------- pc-bios/r2d-flash.bin.gz | Bin 0 -> 106561 bytes sysemu.h | 7 +++++++ vl.c | 7 ------- 6 files changed, 51 insertions(+), 16 deletions(-) create mode 100644 pc-bios/r2d-flash.bin.gz
Makefile +13 -0
@@ -259,6 +259,12 @@ else BLOBS= endif +ifdef INSTALL_COMPRESSED_PFLASHS +PFLASHS=r2d-flash.bin.gz +else +PFLASHS= +endif + install-doc: $(DOCS) $(INSTALL_DIR) "$(DESTDIR)$(docdir)" $(INSTALL_DATA) qemu-doc.html qemu-tech.html "$(DESTDIR)$(docdir)"
@@ -280,6 +286,13 @@ ifneq ($(BLOBS),) $(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \ done endif +ifneq ($(PFLASHS),) + $(INSTALL_DIR) "$(DESTDIR)$(datadir)" + set -e; for x in $(PFLASHS); do \ + $(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \ + $(GUNZIP) "$(DESTDIR)$(datadir)/$$x"; \ + done +endif ifndef CONFIG_WIN32 $(INSTALL_DIR) "$(DESTDIR)$(datadir)/keymaps" set -e; for x in $(KEYMAPS); do \
configure +14 -0
@@ -33,6 +33,7 @@ host_cc="gcc" ar="ar" make="make" install="install" +gunzip="gunzip" strip="strip" # parse CC options first
@@ -191,6 +192,7 @@ kvm="yes" kerneldir="" aix="no" blobs="yes" +flashs="yes" fdt="yes" sdl_x11="no" xen="yes"
@@ -380,6 +382,8 @@ for opt do ;; --install=*) install="$optarg" ;; + --gunzip=*) gunzip="$optarg" + ;; --extra-cflags=*) CFLAGS="$optarg" ;; --extra-ldflags=*) LDFLAGS="$optarg"
@@ -489,6 +493,8 @@ for opt do ;; --disable-blobs) blobs="no" ;; + --disable-flashs) flashs="no" + ;; --kerneldir=*) kerneldir="$optarg" ;; --with-pkgversion=*) pkgversion=" ($optarg)"
@@ -581,6 +587,7 @@ echo " --extra-cflags=CFLAGS add C compiler flags CFLAGS" echo " --extra-ldflags=LDFLAGS add linker flags LDFLAGS" echo " --make=MAKE use specified make [$make]" echo " --install=INSTALL use specified install [$install]" +echo " --gunzip=GUNZIP use specified gunzip [$gunzip]" echo " --static enable static build [$static]" echo " --enable-debug-tcg enable TCG debugging" echo " --disable-debug-tcg disable TCG debugging (default)"
@@ -621,6 +628,7 @@ echo " --disable-pthread disable pthread support" echo " --disable-aio disable AIO support" echo " --enable-io-thread enable IO thread" echo " --disable-blobs disable installing provided firmware blobs" +echo " --disable-pflafhs disable installing provided firmware flashs" echo " --kerneldir=PATH look for kernel includes in PATH" echo "" echo "NOTE: The object files are built at the place where configure is launched"
@@ -1293,6 +1301,7 @@ echo "Host C compiler $host_cc" echo "ARCH_CFLAGS $ARCH_CFLAGS" echo "make $make" echo "install $install" +echo "gunzip $gunzip" echo "host CPU $cpu" echo "host big endian $bigendian" echo "target list $target_list"
@@ -1339,6 +1348,7 @@ echo "vde support $vde" echo "AIO support $aio" echo "IO thread $io_thread" echo "Install blobs $blobs" +echo "Install flashs $flashs" echo "KVM support $kvm" echo "fdt support $fdt" echo "preadv support $preadv"
@@ -1377,6 +1387,7 @@ echo "INSTALL=$install" >> $config_mak echo "INSTALL_DIR=$install -d -m0755 -p" >> $config_mak echo "INSTALL_DATA=$install -m0644 -p" >> $config_mak echo "INSTALL_PROG=$install -m0755 -p" >> $config_mak +echo "GUNZIP=$gunzip" >> $config_mak echo "CC=$cc" >> $config_mak echo "HOST_CC=$host_cc" >> $config_mak echo "AR=$ar" >> $config_mak
@@ -1662,6 +1673,9 @@ fi if test "$blobs" = "yes" ; then echo "INSTALL_BLOBS=yes" >> $config_mak fi +if test "$flashs" = "yes" ; then + echo "INSTALL_COMPRESSED_PFLASHS=yes" >> $config_mak +fi if test "$iovec" = "yes" ; then echo "#define HAVE_IOVEC 1" >> $config_h fi
hw/r2d.c +17 -9
@@ -33,6 +33,8 @@#include "sh7750_regs.h" #include "flash.h" +#define DEFAULT_PFLASH "r2d-flash.bin" +#define SDRAM_BASE SH7750_A3_BASE/* Physical location of SDRAM: Area 3 */ #define SDRAM_SIZE 0x04000000#define FLASH_SIZE 0x02000000
@@ -207,6 +209,7 @@ static void r2d_init(ram_addr_t ram_size, int vga_ram_size,PCIBus *pci;int i;int index; +uint32_t sector_len =128 *1024 ;if (!cpu_model) cpu_model ="SH7751R" ;
@@ -236,16 +239,21 @@ static void r2d_init(ram_addr_t ram_size, int vga_ram_size,for (i =0 ; i < nb_nics; i++)pci_nic_init (pci, &nd_table[i], (i==0 )?2 <<3 :-1 ,"rtl8139" ); -if ((index =drive_get_index (IF_PFLASH ,0 ,0 )) >-1 ) { -uint32_t sector_len =128 *1024 ; +if ((index =drive_get_index (IF_PFLASH ,0 ,0 )) <0 ) { +char buf[1024 ]; -if (!pflash_cfi02_register (SH7750_A0_BASE ,qemu_ram_alloc (FLASH_SIZE ), - drives_table[index].bdrv, sector_len,FLASH_SIZE / sector_len, -1 ,4 ,0 ,0 ,0 ,0 ,0 ,0 )) { -fprintf (stderr,"qemu: Error registering flash memory.\n" ); - }else { - env->pc =SH7750_P2_BASE ; - } +snprintf (buf,sizeof (buf),"%s/%s" , bios_dir,DEFAULT_PFLASH ); +fprintf (stderr,"use default pflash : '%s'\n" , buf); + index =drive_add (buf,PFLASH_ALIAS ); +drive_init (&drives_opt[index],0 , &r2d_machine); + index =drive_get_index (IF_PFLASH ,0 ,0 ); + } +if (index >-1 && !pflash_cfi02_register (SH7750_A0_BASE ,qemu_ram_alloc (FLASH_SIZE ), + drives_table[index].bdrv, sector_len,FLASH_SIZE / sector_len, +1 ,4 ,0 ,0 ,0 ,0 ,0 ,0 )) { +fprintf (stderr,"qemu: Error registering flash memory.\n" ); + }else { + env->pc =SH7750_P2_BASE ; }/* Todo: register on board registers */
pc-bios/r2d-flash.bin.gz new file binary +0 -0
sysemu.h +7 -0
@@ -131,6 +131,13 @@ extern unsigned int nb_prom_envs;#define BIOS_SIZE (4 * 1024 * 1024)#endif +#define HD_ALIAS "index=%d,media=disk" +#define CDROM_ALIAS "index=2,media=cdrom" +#define FD_ALIAS "index=%d,if=floppy" +#define PFLASH_ALIAS "if=pflash" +#define MTD_ALIAS "if=mtd" +#define SD_ALIAS "index=0,if=sd" +typedef enum {IF_IDE ,IF_SCSI ,IF_FLOPPY ,IF_PFLASH ,IF_MTD ,IF_SD ,IF_VIRTIO ,IF_XEN }BlockInterfaceType ;
vl.c +0 -7
@@ -2085,13 +2085,6 @@ static int bt_parse(const char *opt)/***********************************************************/ /* QEMU Block devices */ -#define HD_ALIAS "index=%d,media=disk" -#define CDROM_ALIAS "index=2,media=cdrom" -#define FD_ALIAS "index=%d,if=floppy" -#define PFLASH_ALIAS "if=pflash" -#define MTD_ALIAS "if=mtd" -#define SD_ALIAS "index=0,if=sd" -static int drive_opt_get_free_idx (void ) {int index;
Signature · 1 line
1.6.1.3
[Qemu-devel] Re: [PATCH 2/3] sh: SCI improvements
In reply to Jean-Christophe PLAGNIOL-VILLARDHi, Jean.
I guess this patch conflicts with Vladimir's patch, which is almost ready for merge.
http://lists.gnu.org/archive/html/qemu-devel/2009-04/msg01110.html
Revise and repost are necessary.
I suggest you not to expect whole this patch to be applied. How about
making it smaller? I think the following part will be enough for
the purpose to run u-boot on qemu-sh. Could you try it?
hw/sh_serial.c static uint32_t sh_serial_ioport_read(void *opaque, uint32_t offs) · line 257
Quoted 12 lines
hw/sh_serial.c +0
-2@@ -242,11 +249,9 @@ static uint32_t sh_serial_ioport_read(void *opaque, uint32_t offs) s->flags &= ~SH_SERIAL_FLAG_RDF ; }break ; -#if 0 case 0x18 : ret = s->fcr;break ; -#endif case 0x1c : ret = s->rx_cnt;break ;
Regards,
Shin-ichiro KAWASAKI
Quoted 183 lines · Jean-Christophe PLAGNIOL-VILLARD
From: Shin-ichiro KAWASAKI <[email protected]>
SE7750 uses SCI := Serial Communication Interface for one of consoles. This patch completes the SCI implementation, and makes SCI available for a console.
# Tabs and spaces are mixed in "
hw/sh_serial.c" so much. # Some clean up might be useful.Signed-off-by Shin-ichiro KAWASAKI <[email protected]>--- hw/sh_serial.c | 92 ++++++++++++++++++++++++++++++++----------------------- 1 files changed, 53 insertions(+), 39 deletions(-)hw/sh_serial.c +53
-39@@ -96,7 +96,7 @@ static void sh_serial_ioport_write(void *opaque, uint32_t offs, uint32_t val) s->scr = val & ((s->feat &SH_SERIAL_FEAT_SCIF ) ?0xfa :0xff );if (!(val & (1 <<5 ))) s->flags |=SH_SERIAL_FLAG_TEND ; -if ((s->feat &SH_SERIAL_FEAT_SCIF ) && s->txi) { +if (s->txi) {qemu_set_irq (s->txi, val & (1 <<7 )); }if (!(val & (1 <<6 ))) {@@ -109,13 +109,15 @@ static void sh_serial_ioport_write(void *opaque, uint32_t offs, uint32_t val)qemu_chr_write (s->chr, &ch,1 ); } s->dr = val; - s->flags &= ~SH_SERIAL_FLAG_TDE ; +if (s->feat &SH_SERIAL_FEAT_SCIF ) + s->flags &= ~SH_SERIAL_FLAG_TDE ; +else + s->flags |=SH_SERIAL_FLAG_TDE ;return ; -#if 0 case 0x14 :/* FRDR / RDR */ - ret =0 ; +/* do nothing */ +return ;break ; -#endif }if (s->feat &SH_SERIAL_FEAT_SCIF ) {switch (offs) {@@ -165,17 +167,33 @@ static void sh_serial_ioport_write(void *opaque, uint32_t offs, uint32_t val)case 0x24 :/* LSR */ return ; } - } -else { + }else {/* SCI */ switch (offs) { -#if 0 -case 0x0c : - ret = s->dr; -break ; -case 0x10 : - ret =0 ; -break ; -#endif +case 0x0c :/* TDR */ +if (s->chr) { + ch = val; +qemu_chr_write (s->chr, &ch,1 ); + } + s->dr = val; + s->flags |=SH_SERIAL_FLAG_TDE |SH_SERIAL_FLAG_TEND ; +if (s->scr & (1 <<7 ) && s->txi) { +qemu_set_irq (s->txi,1 ); + } +return ; +case 0x10 :/* SSR */ +/* +* Ignore TDRE (1 << 7) bit because TDR is always +* writable in this SCI emulation. +*/ +if (!(val & (1 <<6 ))) { + s->flags &= ~SH_SERIAL_FLAG_RDF ; + } +if (!(val & (1 <<6 ))) { +if (s->rxi) { +qemu_set_irq (s->rxi,0 ); + } + } +return ;case 0x1c : s->sptr = val &0x8f ;return ;@@ -191,30 +209,19 @@ static uint32_t sh_serial_ioport_read(void *opaque, uint32_t offs)sh_serial_state *s = opaque;uint32_t ret = ~0 ; -#if 0 switch (offs) { -case 0x00 : +case 0x00 :/* SMR */ ret = s->smr;break ; -case 0x04 : +case 0x04 :/* BRR */ ret = s->brr;break ; -case 0x08 : +case 0x08 :/* SCR */ ret = s->scr;break ; -case 0x14 : - ret =0 ; -break ; } -#endif if (s->feat &SH_SERIAL_FEAT_SCIF ) {switch (offs) { -case 0x00 :/* SMR */ - ret = s->smr; -break ; -case 0x08 :/* SCR */ - ret = s->scr; -break ;case 0x10 :/* FSR */ ret =0 ;if (s->flags &SH_SERIAL_FLAG_TEND )@@ -242,11 +249,9 @@ static uint32_t sh_serial_ioport_read(void *opaque, uint32_t offs) s->flags &= ~SH_SERIAL_FLAG_RDF ; }break ; -#if 0 case 0x18 : ret = s->fcr;break ; -#endif case 0x1c : ret = s->rx_cnt;break ;@@ -257,21 +262,26 @@ static uint32_t sh_serial_ioport_read(void *opaque, uint32_t offs) ret =0 ;break ; } - } -else { + }else {switch (offs) { -#if 0 -case 0x0c : +case 0x0c :/* TDR */ ret = s->dr;break ; -case 0x10 : +case 0x10 :/* SSR */ ret =0 ; +if (s->flags &SH_SERIAL_FLAG_TDE ) + ret |= (1 <<7 ); +if (s->flags &SH_SERIAL_FLAG_RDF ) + ret |= (1 <<6 ); +if (s->flags &SH_SERIAL_FLAG_TEND ) + ret |= (1 <<2 ); +/* TODO : handle bit MPBT */ break ; -case 0x14 : +case 0x14 :/* RDR */ ret = s->rx_fifo[0 ]; + s->flags &= ~SH_SERIAL_FLAG_RDF ;break ; -#endif -case 0x1c : +case 0x1c :/* SPTR */ ret = s->sptr;break ; }@@ -311,6 +321,10 @@ static void sh_serial_receive_byte(sh_serial_state *s, int ch) } }else { s->rx_fifo[0 ] = ch; + s->flags |=SH_SERIAL_FLAG_RDF ; +if (s->scr & (1 <<6 ) && s->rxi) { +qemu_set_irq (s->rxi,1 ); + } } }