529
521
PCIC1_PCIDMA0, PCIC1_PCIDMA1, PCIC1_PCIDMA2, PCIC1_PCIDMA3),
532
/**********************************************************************
533
Memory mapped cache and TLB
534
**********************************************************************/
536
#define MM_REGION_MASK 0x07000000
537
#define MM_ICACHE_ADDR (0)
538
#define MM_ICACHE_DATA (1)
539
#define MM_ITLB_ADDR (2)
540
#define MM_ITLB_DATA (3)
541
#define MM_OCACHE_ADDR (4)
542
#define MM_OCACHE_DATA (5)
543
#define MM_UTLB_ADDR (6)
544
#define MM_UTLB_DATA (7)
545
#define MM_REGION_TYPE(addr) ((addr & MM_REGION_MASK) >> 24)
547
static uint32_t invalid_read(void *opaque, target_phys_addr_t addr)
554
static uint32_t sh7750_mmct_readl(void *opaque, target_phys_addr_t addr)
558
switch (MM_REGION_TYPE(addr)) {
584
static void invalid_write(void *opaque, target_phys_addr_t addr,
590
static void sh7750_mmct_writel(void *opaque, target_phys_addr_t addr,
593
SH7750State *s = opaque;
595
switch (MM_REGION_TYPE(addr)) {
610
cpu_sh4_write_mmaped_utlb_addr(s->cpu, addr, mem_value);
622
static CPUReadMemoryFunc *sh7750_mmct_read[] = {
628
static CPUWriteMemoryFunc *sh7750_mmct_write[] = {
524
#define SH_CPU_SH7750 (1 << 0)
525
#define SH_CPU_SH7750S (1 << 1)
526
#define SH_CPU_SH7750R (1 << 2)
527
#define SH_CPU_SH7751 (1 << 3)
528
#define SH_CPU_SH7751R (1 << 4)
529
#define SH_CPU_SH7750_ALL (SH_CPU_SH7750 | SH_CPU_SH7750S | SH_CPU_SH7750R)
530
#define SH_CPU_SH7751_ALL (SH_CPU_SH7751 | SH_CPU_SH7751R)
634
532
SH7750State *sh7750_init(CPUSH4State * cpu)
637
535
int sh7750_io_memory;
638
int sh7750_mm_cache_and_tlb; /* memory mapped cache and tlb */
536
int cpu_model = SH_CPU_SH7751R; /* for now */
640
538
s = qemu_mallocz(sizeof(SH7750State));
645
543
sh7750_mem_write, s);
646
544
cpu_register_physical_memory(0x1c000000, 0x04000000, sh7750_io_memory);
648
sh7750_mm_cache_and_tlb = cpu_register_io_memory(0,
650
sh7750_mmct_write, s);
651
cpu_register_physical_memory(0xf0000000, 0x08000000,
652
sh7750_mm_cache_and_tlb);
654
546
sh_intc_init(&s->intc, NR_SOURCES,
655
547
_INTC_ARRAY(mask_registers),
656
548
_INTC_ARRAY(prio_registers));
658
sh_intc_register_sources(&s->intc,
550
sh_intc_register_sources(&s->intc,
659
551
_INTC_ARRAY(vectors),
660
552
_INTC_ARRAY(groups));
662
cpu->intc_handle = &s->intc;
664
sh_serial_init(0x1fe00000, 0, s->periph_freq, serial_hds[0],
665
sh_intc_source(&s->intc, SCI1_ERI),
666
sh_intc_source(&s->intc, SCI1_RXI),
667
sh_intc_source(&s->intc, SCI1_TXI),
668
sh_intc_source(&s->intc, SCI1_TEI),
554
sh_serial_init(0x1fe00000, 0, s->periph_freq, serial_hds[0]);
670
555
sh_serial_init(0x1fe80000, SH_SERIAL_FEAT_SCIF,
671
s->periph_freq, serial_hds[1],
672
sh_intc_source(&s->intc, SCIF_ERI),
673
sh_intc_source(&s->intc, SCIF_RXI),
674
sh_intc_source(&s->intc, SCIF_TXI),
676
sh_intc_source(&s->intc, SCIF_BRI));
556
s->periph_freq, serial_hds[1]);
678
558
tmu012_init(0x1fd80000,
679
559
TMU012_FEAT_TOCR | TMU012_FEAT_3CHAN | TMU012_FEAT_EXTCLK,
681
sh_intc_source(&s->intc, TMU0),
682
sh_intc_source(&s->intc, TMU1),
683
sh_intc_source(&s->intc, TMU2_TUNI),
684
sh_intc_source(&s->intc, TMU2_TICPI));
686
if (cpu->id & (SH_CPU_SH7750 | SH_CPU_SH7750S | SH_CPU_SH7751)) {
687
sh_intc_register_sources(&s->intc,
563
if (cpu_model & (SH_CPU_SH7750 | SH_CPU_SH7750S | SH_CPU_SH7751)) {
564
sh_intc_register_sources(&s->intc,
688
565
_INTC_ARRAY(vectors_dma4),
689
566
_INTC_ARRAY(groups_dma4));
692
if (cpu->id & (SH_CPU_SH7750R | SH_CPU_SH7751R)) {
693
sh_intc_register_sources(&s->intc,
569
if (cpu_model & (SH_CPU_SH7750R | SH_CPU_SH7751R)) {
570
sh_intc_register_sources(&s->intc,
694
571
_INTC_ARRAY(vectors_dma8),
695
572
_INTC_ARRAY(groups_dma8));
698
if (cpu->id & (SH_CPU_SH7750R | SH_CPU_SH7751 | SH_CPU_SH7751R)) {
699
sh_intc_register_sources(&s->intc,
575
if (cpu_model & (SH_CPU_SH7750R | SH_CPU_SH7751 | SH_CPU_SH7751R)) {
576
sh_intc_register_sources(&s->intc,
700
577
_INTC_ARRAY(vectors_tmu34),
702
tmu012_init(0x1e100000, 0, s->periph_freq,
703
sh_intc_source(&s->intc, TMU3),
704
sh_intc_source(&s->intc, TMU4),
579
tmu012_init(0x1e100000, 0, s->periph_freq);
708
if (cpu->id & (SH_CPU_SH7751_ALL)) {
709
sh_intc_register_sources(&s->intc,
582
if (cpu_model & (SH_CPU_SH7751_ALL)) {
583
sh_intc_register_sources(&s->intc,
710
584
_INTC_ARRAY(vectors_pci),
711
585
_INTC_ARRAY(groups_pci));
714
if (cpu->id & (SH_CPU_SH7750S | SH_CPU_SH7750R | SH_CPU_SH7751_ALL)) {
715
sh_intc_register_sources(&s->intc,
588
if (cpu_model & (SH_CPU_SH7750S | SH_CPU_SH7750R | SH_CPU_SH7751_ALL)) {
589
sh_intc_register_sources(&s->intc,
716
590
_INTC_ARRAY(vectors_irlm),