Changeset 3627
- Timestamp:
- 12/10/07 18:51:36 (5 years ago)
- Location:
- trunk/src/host/qemu-neo1973
- Files:
-
- 1 added
- 42 edited
-
Makefile (modified) (2 diffs)
-
Makefile.target (modified) (1 diff)
-
configure (modified) (1 diff)
-
cpu-defs.h (modified) (1 diff)
-
exec.c (modified) (2 diffs)
-
hw/eccmemctl.c (added)
-
hw/esp.c (modified) (6 diffs)
-
hw/flash.h (modified) (2 diffs)
-
hw/gumstix.c (modified) (2 diffs)
-
hw/ide.c (modified) (1 diff)
-
hw/lsi53c895a.c (modified) (7 diffs)
-
hw/mainstone.c (modified) (3 diffs)
-
hw/mainstone.h (modified) (1 diff)
-
hw/mips_r4k.c (modified) (2 diffs)
-
hw/omap.c (modified) (22 diffs)
-
hw/omap.h (modified) (2 diffs)
-
hw/pci.c (modified) (5 diffs)
-
hw/pflash_cfi01.c (modified) (1 diff)
-
hw/pflash_cfi02.c (modified) (1 diff)
-
hw/piix_pci.c (modified) (7 diffs)
-
hw/ppc405_boards.c (modified) (3 diffs)
-
hw/scsi-disk.c (modified) (16 diffs)
-
hw/scsi-disk.h (modified) (1 diff)
-
hw/sun4m.c (modified) (5 diffs)
-
hw/sun4m.h (modified) (1 diff)
-
hw/usb-msd.c (modified) (5 diffs)
-
linux-user/ppc/syscall.h (modified) (1 diff)
-
linux-user/ppc/target_signal.h (modified) (1 diff)
-
linux-user/socket.h (modified) (2 diffs)
-
linux-user/syscall.c (modified) (11 diffs)
-
linux-user/syscall_defs.h (modified) (3 diffs)
-
target-arm/helper.c (modified) (1 diff)
-
target-i386/exec.h (modified) (1 diff)
-
target-i386/helper.c (modified) (2 diffs)
-
target-i386/helper2.c (modified) (2 diffs)
-
target-i386/op.c (modified) (1 diff)
-
target-i386/translate.c (modified) (1 diff)
-
target-m68k/helper.c (modified) (1 diff)
-
target-mips/translate.c (modified) (1 diff)
-
target-ppc/cpu.h (modified) (5 diffs)
-
target-ppc/helper.c (modified) (1 diff)
-
target-ppc/translate_init.c (modified) (21 diffs)
-
target-sparc/translate.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/host/qemu-neo1973/Makefile
r3517 r3627 265 265 $(bindir)/qemu-system-m68k \ 266 266 $(bindir)/qemu-system-sh4 \ 267 $(bindir)/qemu-system-sh4eb \ 267 268 $(bindir)/qemu-i386 \ 268 269 $(bindir)/qemu-arm \ … … 280 281 $(bindir)/qemu-m68k \ 281 282 $(bindir)/qemu-sh4 \ 283 $(bindir)/qemu-sh4eb \ 282 284 $(bindir)/qemu-img \ 283 285 $(datadir)/bios.bin \ -
trunk/src/host/qemu-neo1973/Makefile.target
r3555 r3627 491 491 VL_OBJS+= sun4m.o tcx.o pcnet.o iommu.o m48t59.o slavio_intctl.o 492 492 VL_OBJS+= slavio_timer.o slavio_serial.o slavio_misc.o fdc.o esp.o sparc32_dma.o 493 VL_OBJS+= cs4231.o ptimer.o 493 VL_OBJS+= cs4231.o ptimer.o eccmemctl.o 494 494 endif 495 495 endif -
trunk/src/host/qemu-neo1973/configure
r3443 r3627 527 527 # these targets are portable 528 528 if [ "$softmmu" = "yes" ] ; then 529 target_list="i386-softmmu sparc-softmmu x86_64-softmmu mips-softmmu mipsel-softmmu mips64-softmmu mips64el-softmmu arm-softmmu ppc-softmmu ppcemb-softmmu ppc64-softmmu m68k-softmmu sh4-softmmu cris-softmmu"529 target_list="i386-softmmu sparc-softmmu x86_64-softmmu mips-softmmu mipsel-softmmu mips64-softmmu mips64el-softmmu arm-softmmu ppc-softmmu ppcemb-softmmu ppc64-softmmu m68k-softmmu sh4-softmmu sh4eb-softmmu cris-softmmu" 530 530 fi 531 531 # the following are Linux specific 532 532 if [ "$linux_user" = "yes" ] ; then 533 target_list="i386-linux-user arm-linux-user armeb-linux-user sparc-linux-user sparc64-linux-user sparc32plus-linux-user mips-linux-user mipsel-linux-user m68k-linux-user alpha-linux-user sh4-linux-user ppc-linux-user ppc64-linux-user ppc64abi32-linux-user x86_64-linux-user cris-linux-user $target_list"533 target_list="i386-linux-user arm-linux-user armeb-linux-user sparc-linux-user sparc64-linux-user sparc32plus-linux-user mips-linux-user mipsel-linux-user m68k-linux-user alpha-linux-user sh4-linux-user sh4eb-linux-user ppc-linux-user ppc64-linux-user ppc64abi32-linux-user x86_64-linux-user cris-linux-user $target_list" 534 534 fi 535 535 # the following are Darwin specific -
trunk/src/host/qemu-neo1973/cpu-defs.h
r3443 r3627 147 147 int cpu_index; /* CPU index (informative) */ \ 148 148 /* user data */ \ 149 void *opaque; 149 void *opaque; \ 150 \ 151 const char *cpu_model_str; 150 152 151 153 #endif -
trunk/src/host/qemu-neo1973/exec.c
r3517 r3627 1318 1318 CPUState *cpu_copy(CPUState *env) 1319 1319 { 1320 #if 0 1321 /* XXX: broken, must be handled by each CPU */ 1322 CPUState *new_env = cpu_init(); 1320 CPUState *new_env = cpu_init(env->cpu_model_str); 1323 1321 /* preserve chaining and index */ 1324 1322 CPUState *next_cpu = new_env->next_cpu; … … 1328 1326 new_env->cpu_index = cpu_index; 1329 1327 return new_env; 1330 #else1331 return NULL;1332 #endif1333 1328 } 1334 1329 -
trunk/src/host/qemu-neo1973/hw/esp.c
r3555 r3627 166 166 if (s->current_dev) { 167 167 /* Started a new command before the old one finished. Cancel it. */ 168 s csi_cancel_io(s->current_dev, 0);168 s->current_dev->cancel_io(s->current_dev, 0); 169 169 s->async_len = 0; 170 170 } … … 189 189 DPRINTF("do_cmd: busid 0x%x\n", buf[0]); 190 190 lun = buf[0] & 7; 191 datalen = s csi_send_command(s->current_dev, 0, &buf[1], lun);191 datalen = s->current_dev->send_command(s->current_dev, 0, &buf[1], lun); 192 192 s->ti_size = datalen; 193 193 if (datalen != 0) { … … 197 197 if (datalen > 0) { 198 198 s->rregs[ESP_RSTAT] |= STAT_DI; 199 s csi_read_data(s->current_dev, 0);199 s->current_dev->read_data(s->current_dev, 0); 200 200 } else { 201 201 s->rregs[ESP_RSTAT] |= STAT_DO; 202 s csi_write_data(s->current_dev, 0);202 s->current_dev->write_data(s->current_dev, 0); 203 203 } 204 204 } … … 299 299 if (to_device) { 300 300 // ti_size is negative 301 s csi_write_data(s->current_dev, 0);301 s->current_dev->write_data(s->current_dev, 0); 302 302 } else { 303 s csi_read_data(s->current_dev, 0);303 s->current_dev->read_data(s->current_dev, 0); 304 304 /* If there is still data to be read from the device then 305 305 complete the DMA operation immeriately. Otherwise defer … … 336 336 DPRINTF("transfer %d/%d\n", s->dma_left, s->ti_size); 337 337 s->async_len = arg; 338 s->async_buf = s csi_get_buf(s->current_dev, 0);338 s->async_buf = s->current_dev->get_buf(s->current_dev, 0); 339 339 if (s->dma_left) { 340 340 esp_do_dma(s); … … 612 612 if (s->scsi_dev[id]) { 613 613 DPRINTF("Destroying device %d\n", id); 614 s csi_disk_destroy(s->scsi_dev[id]);614 s->scsi_dev[id]->destroy(s->scsi_dev[id]); 615 615 } 616 616 DPRINTF("Attaching block device %d\n", id); -
trunk/src/host/qemu-neo1973/hw/flash.h
r3443 r3627 2 2 typedef struct pflash_t pflash_t; 3 3 4 pflash_t *pflash_register (target_phys_addr_t base, ram_addr_t off, 5 BlockDriverState *bs, 6 uint32_t sector_len, int nb_blocs, int width, 7 uint16_t id0, uint16_t id1, 8 uint16_t id2, uint16_t id3); 4 /* pflash_cfi01.c */ 5 pflash_t *pflash_cfi01_register(target_phys_addr_t base, ram_addr_t off, 6 BlockDriverState *bs, 7 uint32_t sector_len, int nb_blocs, int width, 8 uint16_t id0, uint16_t id1, 9 uint16_t id2, uint16_t id3); 10 11 /* pflash_cfi02.c */ 12 pflash_t *pflash_cfi02_register(target_phys_addr_t base, ram_addr_t off, 13 BlockDriverState *bs, uint32_t sector_len, 14 int nb_blocs, int width, 15 uint16_t id0, uint16_t id1, 16 uint16_t id2, uint16_t id3); 9 17 10 18 /* nand.c */ … … 38 46 void ecc_put(QEMUFile *f, struct ecc_state_s *s); 39 47 void ecc_get(QEMUFile *f, struct ecc_state_s *s); 40 -
trunk/src/host/qemu-neo1973/hw/gumstix.c
r3555 r3627 68 68 } 69 69 70 if (!pflash_ register(0x00000000, qemu_ram_alloc(connex_rom),70 if (!pflash_cfi01_register(0x00000000, qemu_ram_alloc(connex_rom), 71 71 drives_table[index].bdrv, sector_len, connex_rom / sector_len, 72 72 2, 0, 0, 0, 0)) { … … 108 108 } 109 109 110 if (!pflash_ register(0x00000000, qemu_ram_alloc(verdex_rom),110 if (!pflash_cfi01_register(0x00000000, qemu_ram_alloc(verdex_rom), 111 111 drives_table[index].bdrv, sector_len, verdex_rom / sector_len, 112 112 2, 0, 0, 0, 0)) { -
trunk/src/host/qemu-neo1973/hw/ide.c
r3443 r3627 1362 1362 buf[8] = 0x2a; 1363 1363 buf[9] = 0x12; 1364 buf[10] = 0x0 8;1364 buf[10] = 0x00; 1365 1365 buf[11] = 0x00; 1366 1366 -
trunk/src/host/qemu-neo1973/hw/lsi53c895a.c
r3555 r3627 188 188 uint32_t current_tag; 189 189 uint32_t current_dma_len; 190 int command_complete; 190 191 uint8_t *dma_buf; 191 192 lsi_queue *queue; … … 466 467 467 468 if (s->dma_buf == NULL) { 468 s->dma_buf = scsi_get_buf(s->current_dev, s->current_tag); 469 s->dma_buf = s->current_dev->get_buf(s->current_dev, 470 s->current_tag); 469 471 } 470 472 … … 480 482 if (out) { 481 483 /* Write the data. */ 482 s csi_write_data(s->current_dev, s->current_tag);484 s->current_dev->write_data(s->current_dev, s->current_tag); 483 485 } else { 484 486 /* Request any remaining data. */ 485 s csi_read_data(s->current_dev, s->current_tag);487 s->current_dev->read_data(s->current_dev, s->current_tag); 486 488 } 487 489 } else { … … 597 599 DPRINTF("Command complete sense=%d\n", (int)arg); 598 600 s->sense = arg; 601 s->command_complete = 2; 599 602 if (s->waiting && s->dbc != 0) { 600 603 /* Raise phase mismatch for short transfers. */ … … 613 616 DPRINTF("Data ready tag=0x%x len=%d\n", tag, arg); 614 617 s->current_dma_len = arg; 618 s->command_complete = 1; 615 619 if (!s->waiting) 616 620 return; … … 632 636 cpu_physical_memory_read(s->dnad, buf, s->dbc); 633 637 s->sfbr = buf[0]; 634 n = scsi_send_command(s->current_dev, s->current_tag, buf, s->current_lun); 638 s->command_complete = 0; 639 n = s->current_dev->send_command(s->current_dev, s->current_tag, buf, 640 s->current_lun); 635 641 if (n > 0) { 636 642 lsi_set_phase(s, PHASE_DI); 637 s csi_read_data(s->current_dev, s->current_tag);643 s->current_dev->read_data(s->current_dev, s->current_tag); 638 644 } else if (n < 0) { 639 645 lsi_set_phase(s, PHASE_DO); 640 scsi_write_data(s->current_dev, s->current_tag); 641 } 642 if (n && s->current_dma_len == 0) { 643 /* Command did not complete immediately so disconnect. */ 644 lsi_add_msg_byte(s, 2); /* SAVE DATA POINTER */ 645 lsi_add_msg_byte(s, 4); /* DISCONNECT */ 646 lsi_set_phase(s, PHASE_MI); 647 s->msg_action = 1; 648 lsi_queue_command(s); 646 s->current_dev->write_data(s->current_dev, s->current_tag); 647 } 648 649 if (!s->command_complete) { 650 if (n) { 651 /* Command did not complete immediately so disconnect. */ 652 lsi_add_msg_byte(s, 2); /* SAVE DATA POINTER */ 653 lsi_add_msg_byte(s, 4); /* DISCONNECT */ 654 /* wait data */ 655 lsi_set_phase(s, PHASE_MI); 656 s->msg_action = 1; 657 lsi_queue_command(s); 658 } else { 659 /* wait command complete */ 660 lsi_set_phase(s, PHASE_DI); 661 } 649 662 } 650 663 } … … 1823 1836 if (s->scsi_dev[id]) { 1824 1837 DPRINTF("Destroying device %d\n", id); 1825 s csi_disk_destroy(s->scsi_dev[id]);1838 s->scsi_dev[id]->destroy(s->scsi_dev[id]); 1826 1839 } 1827 1840 DPRINTF("Attaching block device %d\n", id); -
trunk/src/host/qemu-neo1973/hw/mainstone.c
r3555 r3627 56 56 exit(1); 57 57 } 58 if (!pflash_register(MST_FLASH_0, mainstone_ram + PXA2XX_INTERNAL_SIZE, 58 if (!pflash_cfi01_register(MST_FLASH_0, 59 mainstone_ram + PXA2XX_INTERNAL_SIZE, 59 60 drives_table[index].bdrv, 60 61 256 * 1024, 128, 4, 0, 0, 0, 0)) { … … 69 70 exit(1); 70 71 } 71 if (!pflash_register(MST_FLASH_1, mainstone_ram + PXA2XX_INTERNAL_SIZE, 72 if (!pflash_cfi01_register(MST_FLASH_1, 73 mainstone_ram + PXA2XX_INTERNAL_SIZE, 72 74 drives_table[index].bdrv, 73 75 256 * 1024, 128, 4, 0, 0, 0, 0)) { … … 77 79 78 80 mst_irq = mst_irq_init(cpu, MST_FPGA_PHYS, PXA2XX_PIC_GPIO_0); 81 82 /* MMC/SD host */ 83 pxa2xx_mmci_handlers(cpu->mmc, NULL, mst_irq[MMC_IRQ]); 84 79 85 smc91c111_init(&nd_table[0], MST_ETH_PHYS, mst_irq[ETHERNET_IRQ]); 80 86 -
trunk/src/host/qemu-neo1973/hw/mainstone.h
r3555 r3627 18 18 19 19 /* IRQ definitions */ 20 #define ETHERNET_IRQ 3 20 #define MMC_IRQ 0 21 #define USIM_IRQ 1 22 #define USBC_IRQ 2 23 #define ETHERNET_IRQ 3 24 #define AC97_IRQ 4 25 #define PEN_IRQ 5 26 #define MSINS_IRQ 6 27 #define EXBRD_IRQ 7 28 #define S0_CD_IRQ 9 29 #define S0_STSCHG_IRQ 10 30 #define S0_IRQ 11 31 #define S1_CD_IRQ 13 32 #define S1_STSCHG_IRQ 14 33 #define S1_IRQ 15 21 34 22 35 extern qemu_irq -
trunk/src/host/qemu-neo1973/hw/mips_r4k.c
r3555 r3627 39 39 static PITState *pit; /* PIT i8254 */ 40 40 41 /* i8254 PIT is attached to the IRQ0 at PIC i8259 */41 /* i8254 PIT is attached to the IRQ0 at PIC i8259 */ 42 42 43 43 static struct _loaderparams { … … 269 269 270 270 i8042_init(i8259[1], i8259[12], 0x60); 271 ds1225y_init(0x9000, "nvram");272 271 } 273 272 -
trunk/src/host/qemu-neo1973/hw/omap.c
r3613 r3627 403 403 404 404 /* OMAP1 DMA module */ 405 typedef enum {406 constant = 0,407 post_incremented,408 single_index,409 double_index,410 } omap_dma_addressing_t;411 412 405 struct omap_dma_channel_s { 406 /* transfer data */ 413 407 int burst[2]; 414 408 int pack[2]; … … 416 410 target_phys_addr_t addr[2]; 417 411 omap_dma_addressing_t mode[2]; 412 uint16_t elements; 413 uint16_t frames; 414 int16_t frame_index[2]; 415 int16_t element_index[2]; 418 416 int data_type; 417 418 /* transfer type */ 419 int transparent_copy; 420 int constant_fill; 421 uint32_t color; 422 423 /* auto init and linked channel data */ 419 424 int end_prog; 420 425 int repeat; 421 426 int auto_init; 422 int priority;423 int fs;424 int sync; 425 int running;427 int link_enabled; 428 int link_next_ch; 429 430 /* interruption data */ 426 431 int interrupts; 427 432 int status; 428 int signalled; 429 int post_sync;430 int transfer;431 uint16_t elements;432 uint16_t frames;433 uint16_t frame_index;434 uint16_t element_index;433 434 /* state data */ 435 int active; 436 int enable; 437 int sync; 438 int pending_request; 439 int waiting_end_prog; 435 440 uint16_t cpc; 441 442 /* sync type */ 443 int fs; 444 int bs; 445 446 /* compatibility */ 447 int omap_3_1_compatible_disable; 448 449 qemu_irq irq; 450 struct omap_dma_channel_s *sibling; 436 451 437 452 struct omap_dma_reg_set_s { … … 444 459 int elements; 445 460 } active_set; 461 462 /* unused parameters */ 463 int priority; 464 int interleave_disabled; 465 int type; 446 466 }; 447 467 448 468 struct omap_dma_s { 449 qemu_irq *ih;450 469 QEMUTimer *tm; 451 470 struct omap_mpu_state_s *mpu; … … 454 473 int64_t delay; 455 474 uint32_t drq; 475 enum omap_dma_model model; 476 int omap_3_1_mapping_disabled; 456 477 457 478 uint16_t gcr; … … 463 484 }; 464 485 486 /* Interrupts */ 487 #define TIMEOUT_INTR (1 << 0) 488 #define EVENT_DROP_INTR (1 << 1) 489 #define HALF_FRAME_INTR (1 << 2) 490 #define END_FRAME_INTR (1 << 3) 491 #define LAST_FRAME_INTR (1 << 4) 492 #define END_BLOCK_INTR (1 << 5) 493 #define SYNC (1 << 6) 494 465 495 static void omap_dma_interrupts_update(struct omap_dma_s *s) 466 496 { 467 /* First three interrupts are shared between two channels each. */ 468 qemu_set_irq(s->ih[OMAP_INT_DMA_CH0_6], 469 (s->ch[0].status | s->ch[6].status) & 0x3f); 470 qemu_set_irq(s->ih[OMAP_INT_DMA_CH1_7], 471 (s->ch[1].status | s->ch[7].status) & 0x3f); 472 qemu_set_irq(s->ih[OMAP_INT_DMA_CH2_8], 473 (s->ch[2].status | s->ch[8].status) & 0x3f); 474 qemu_set_irq(s->ih[OMAP_INT_DMA_CH3], 475 (s->ch[3].status) & 0x3f); 476 qemu_set_irq(s->ih[OMAP_INT_DMA_CH4], 477 (s->ch[4].status) & 0x3f); 478 qemu_set_irq(s->ih[OMAP_INT_DMA_CH5], 479 (s->ch[5].status) & 0x3f); 480 } 481 482 static void omap_dma_channel_load(struct omap_dma_s *s, int ch) 483 { 484 struct omap_dma_reg_set_s *a = &s->ch[ch].active_set; 497 struct omap_dma_channel_s *ch = s->ch; 485 498 int i; 499 500 if (s->omap_3_1_mapping_disabled) { 501 for (i = 0; i < s->chans; i ++, ch ++) 502 if (ch->status) 503 qemu_irq_raise(ch->irq); 504 } else { 505 /* First three interrupts are shared between two channels each. */ 506 for (i = 0; i < 6; i ++, ch ++) { 507 if (ch->status || (ch->sibling && ch->sibling->status)) 508 qemu_irq_raise(ch->irq); 509 } 510 } 511 } 512 513 static void omap_dma_channel_load(struct omap_dma_s *s, 514 struct omap_dma_channel_s *ch) 515 { 516 struct omap_dma_reg_set_s *a = &ch->active_set; 517 int i; 518 int omap_3_1 = !ch->omap_3_1_compatible_disable; 486 519 487 520 /* … … 490 523 */ 491 524 492 a->src = s->ch[ch].addr[0];493 a->dest = s->ch[ch].addr[1];494 a->frames = s->ch[ch].frames;495 a->elements = s->ch[ch].elements;525 a->src = ch->addr[0]; 526 a->dest = ch->addr[1]; 527 a->frames = ch->frames; 528 a->elements = ch->elements; 496 529 a->frame = 0; 497 530 a->element = 0; 498 531 499 if (unlikely(! s->ch[ch].elements || !s->ch[ch].frames)) {532 if (unlikely(!ch->elements || !ch->frames)) { 500 533 printf("%s: bad DMA request\n", __FUNCTION__); 501 534 return; … … 503 536 504 537 for (i = 0; i < 2; i ++) 505 switch ( s->ch[ch].mode[i]) {538 switch (ch->mode[i]) { 506 539 case constant: 507 540 a->elem_delta[i] = 0; … … 509 542 break; 510 543 case post_incremented: 511 a->elem_delta[i] = s->ch[ch].data_type;544 a->elem_delta[i] = ch->data_type; 512 545 a->frame_delta[i] = 0; 513 546 break; 514 547 case single_index: 515 a->elem_delta[i] = s->ch[ch].data_type + 516 s->ch[ch].element_index - 1; 517 if (s->ch[ch].element_index > 0x7fff) 518 a->elem_delta[i] -= 0x10000; 548 a->elem_delta[i] = ch->data_type + 549 ch->element_index[omap_3_1 ? 0 : i] - 1; 519 550 a->frame_delta[i] = 0; 520 551 break; 521 552 case double_index: 522 a->elem_delta[i] = s->ch[ch].data_type + 523 s->ch[ch].element_index - 1; 524 if (s->ch[ch].element_index > 0x7fff) 525 a->elem_delta[i] -= 0x10000; 526 a->frame_delta[i] = s->ch[ch].frame_index - 527 s->ch[ch].element_index; 528 if (s->ch[ch].frame_index > 0x7fff) 529 a->frame_delta[i] -= 0x10000; 553 a->elem_delta[i] = ch->data_type + 554 ch->element_index[omap_3_1 ? 0 : i] - 1; 555 a->frame_delta[i] = ch->frame_index[omap_3_1 ? 0 : i] - 556 ch->element_index[omap_3_1 ? 0 : i]; 530 557 break; 531 558 default: … … 534 561 } 535 562 536 static inline void omap_dma_request_run(struct omap_dma_s *s, 537 int channel, int request) 538 { 539 next_channel: 540 if (request > 0) 541 for (; channel < 9; channel ++) 542 if (s->ch[channel].sync == request && s->ch[channel].running) 543 break; 544 if (channel >= 9) 545 return; 546 547 if (s->ch[channel].transfer) { 548 if (request > 0) { 549 s->ch[channel ++].post_sync = request; 550 goto next_channel; 551 } 552 s->ch[channel].status |= 0x02; /* Synchronisation drop */ 553 omap_dma_interrupts_update(s); 554 return; 555 } 556 557 if (!s->ch[channel].signalled) 563 static void omap_dma_activate_channel(struct omap_dma_s *s, 564 struct omap_dma_channel_s *ch) 565 { 566 if (!ch->active) { 567 ch->active = 1; 568 if (ch->sync) 569 ch->status |= SYNC; 558 570 s->run_count ++; 559 s->ch[channel].signalled = 1; 560 561 if (request > 0) 562 s->ch[channel].status |= 0x40; /* External request */ 571 } 563 572 564 573 if (s->delay && !qemu_timer_pending(s->tm)) 565 574 qemu_mod_timer(s->tm, qemu_get_clock(vm_clock) + s->delay); 566 567 if (request > 0) { 568 channel ++; 569 goto next_channel; 570 } 571 } 572 573 static inline void omap_dma_request_stop(struct omap_dma_s *s, int channel) 574 { 575 if (s->ch[channel].signalled) 575 } 576 577 static void omap_dma_deactivate_channel(struct omap_dma_s *s, 578 struct omap_dma_channel_s *ch) 579 { 580 /* Update cpc */ 581 ch->cpc = ch->active_set.dest & 0xffff; 582 583 if (ch->pending_request && !ch->waiting_end_prog) { 584 /* Don't deactivate the channel */ 585 ch->pending_request = 0; 586 return; 587 } 588 589 /* Don't deactive the channel if it is synchronized and the DMA request is 590 active */ 591 if (ch->sync && (s->drq & (1 << ch->sync))) 592 return; 593 594 if (ch->active) { 595 ch->active = 0; 596 ch->status &= ~SYNC; 576 597 s->run_count --; 577 s->ch[channel].signalled = 0;598 } 578 599 579 600 if (!s->run_count) … … 581 602 } 582 603 604 static void omap_dma_enable_channel(struct omap_dma_s *s, 605 struct omap_dma_channel_s *ch) 606 { 607 if (!ch->enable) { 608 ch->enable = 1; 609 ch->waiting_end_prog = 0; 610 omap_dma_channel_load(s, ch); 611 if ((!ch->sync) || (s->drq & (1 << ch->sync))) 612 omap_dma_activate_channel(s, ch); 613 } 614 } 615 616 static void omap_dma_disable_channel(struct omap_dma_s *s, 617 struct omap_dma_channel_s *ch) 618 { 619 if (ch->enable) { 620 ch->enable = 0; 621 /* Discard any pending request */ 622 ch->pending_request = 0; 623 omap_dma_deactivate_channel(s, ch); 624 } 625 } 626 627 static void omap_dma_channel_end_prog(struct omap_dma_s *s, 628 struct omap_dma_channel_s *ch) 629 { 630 if (ch->waiting_end_prog) { 631 ch->waiting_end_prog = 0; 632 if (!ch->sync || ch->pending_request) { 633 ch->pending_request = 0; 634 omap_dma_activate_channel(s, ch); 635 } 636 } 637 } 638 639 static void omap_dma_enable_3_1_mapping(struct omap_dma_s *s) 640 { 641 s->omap_3_1_mapping_disabled = 0; 642 s->chans = 9; 643 } 644 645 static void omap_dma_disable_3_1_mapping(struct omap_dma_s *s) 646 { 647 s->omap_3_1_mapping_disabled = 1; 648 s->chans = 16; 649 } 650 651 static void omap_dma_process_request(struct omap_dma_s *s, int request) 652 { 653 int channel; 654 int drop_event = 0; 655 struct omap_dma_channel_s *ch = s->ch; 656 657 for (channel = 0; channel < s->chans; channel ++, ch ++) { 658 if (ch->enable && ch->sync == request) { 659 if (!ch->active) 660 omap_dma_activate_channel(s, ch); 661 else if (!ch->pending_request) 662 ch->pending_request = 1; 663 else { 664 /* Request collision */ 665 /* Second request received while processing other request */ 666 ch->status |= EVENT_DROP_INTR; 667 drop_event = 1; 668 } 669 } 670 } 671 672 if (drop_event) 673 omap_dma_interrupts_update(s); 674 } 675 583 676 static void omap_dma_channel_run(struct omap_dma_s *s) 584 677 { 585 int ch;678 int n = s->chans; 586 679 uint16_t status; 587 680 uint8_t value[4]; 588 681 struct omap_dma_port_if_s *src_p, *dest_p; 589 682 struct omap_dma_reg_set_s *a; 590 591 for (ch = 0; ch < 9; ch ++) { 592 a = &s->ch[ch].active_set; 593 594 src_p = &s->mpu->port[s->ch[ch].port[0]]; 595 dest_p = &s->mpu->port[s->ch[ch].port[1]]; 596 if (s->ch[ch].signalled && (!src_p->addr_valid(s->mpu, a->src) || 597 !dest_p->addr_valid(s->mpu, a->dest))) { 683 struct omap_dma_channel_s *ch; 684 685 for (ch = s->ch; n; n --, ch ++) { 686 if (!ch->active) 687 continue; 688 689 a = &ch->active_set; 690 691 src_p = &s->mpu->port[ch->port[0]]; 692 dest_p = &s->mpu->port[ch->port[1]]; 693 if ((!ch->constant_fill && !src_p->addr_valid(s->mpu, a->src)) || 694 (!dest_p->addr_valid(s->mpu, a->dest))) { 598 695 #if 0 599 696 /* Bus time-out */ 600 if ( s->ch[ch].interrupts & 0x01)601 s->ch[ch].status |= 0x01;602 omap_dma_ request_stop(s, ch);697 if (ch->interrupts & TIMEOUT_INTR) 698 ch->status |= TIMEOUT_INTR; 699 omap_dma_deactivate_channel(s, ch); 603 700 continue; 604 701 #endif 605 printf("%s: Bus time-out in DMA%i operation\n", __FUNCTION__, ch); 702 printf("%s: Bus time-out in DMA%i operation\n", 703 __FUNCTION__, s->chans - n); 606 704 } 607 705 608 status = s->ch[ch].status;609 while (status == s->ch[ch].status && s->ch[ch].signalled) {706 status = ch->status; 707 while (status == ch->status && ch->active) { 610 708 /* Transfer a single element */ 611 s->ch[ch].transfer = 1; 612 cpu_physical_memory_read(a->src, value, s->ch[ch].data_type); 613 cpu_physical_memory_write(a->dest, value, s->ch[ch].data_type); 614 s->ch[ch].transfer = 0; 709 /* FIXME: check the endianness */ 710 if (!ch->constant_fill) 711 cpu_physical_memory_read(a->src, value, ch->data_type); 712 else 713 *(uint32_t *) value = ch->color; 714 715 if (!ch->transparent_copy || 716 *(uint32_t *) value != ch->color) 717 cpu_physical_memory_write(a->dest, value, ch->data_type); 615 718 616 719 a->src += a->elem_delta[0]; … … 618 721 a->element ++; 619 722 620 /* Check interrupt conditions */ 723 /* If the channel is element synchronized, deactivate it */ 724 if (ch->sync && !ch->fs && !ch->bs) 725 omap_dma_deactivate_channel(s, ch); 726 727 /* If it is the last frame, set the LAST_FRAME interrupt */ 728 if (a->element == 1 && a->frame == a->frames - 1) 729 if (ch->interrupts & LAST_FRAME_INTR) 730 ch->status |= LAST_FRAME_INTR; 731 732 /* If the half of the frame was reached, set the HALF_FRAME 733 interrupt */ 734 if (a->element == (a->elements >> 1)) 735 if (ch->interrupts & HALF_FRAME_INTR) 736 ch->status |= HALF_FRAME_INTR; 737 621 738 if (a->element == a->elements) { 739 /* End of Frame */ 622 740 a->element = 0; 623 741 a->src += a->frame_delta[0]; … … 625 743 a->frame ++; 626 744 745 /* If the channel is frame synchronized, deactivate it */ 746 if (ch->sync && ch->fs) 747 omap_dma_deactivate_channel(s, ch); 748 749 /* If the channel is async, update cpc */ 750 if (!ch->sync) 751 ch->cpc = a->dest & 0xffff; 752 753 /* Set the END_FRAME interrupt */ 754 if (ch->interrupts & END_FRAME_INTR) 755 ch->status |= END_FRAME_INTR; 756 627 757 if (a->frame == a->frames) { 628 if (!s->ch[ch].repeat || !s->ch[ch].auto_init) 629 s->ch[ch].running = 0; 630 631 if (s->ch[ch].auto_init && 632 (s->ch[ch].repeat || 633 s->ch[ch].end_prog)) 634 omap_dma_channel_load(s, ch); 635 636 if (s->ch[ch].interrupts & 0x20) 637 s->ch[ch].status |= 0x20; 638 639 if (!s->ch[ch].sync) 640 omap_dma_request_stop(s, ch); 641 } 642 643 if (s->ch[ch].interrupts & 0x08) 644 s->ch[ch].status |= 0x08; 645 646 if (s->ch[ch].sync && s->ch[ch].fs && 647 !(s->drq & (1 << s->ch[ch].sync))) { 648 s->ch[ch].status &= ~0x40; 649 omap_dma_request_stop(s, ch); 758 /* End of Block */ 759 /* Disable the channel */ 760 761 if (ch->omap_3_1_compatible_disable) { 762 omap_dma_disable_channel(s, ch); 763 if (ch->link_enabled) 764 omap_dma_enable_channel(s, 765 &s->ch[ch->link_next_ch]); 766 } else { 767 if (!ch->auto_init) 768 omap_dma_disable_channel(s, ch); 769 else if (ch->repeat || ch->end_prog) 770 omap_dma_channel_load(s, ch); 771 else { 772 ch->waiting_end_prog = 1; 773 omap_dma_deactivate_channel(s, ch); 774 } 775 } 776 777 if (ch->interrupts & END_BLOCK_INTR) 778 ch->status |= END_BLOCK_INTR; 650 779 } 651 780 } 652 653 if (a->element == 1 && a->frame == a->frames - 1)654 if (s->ch[ch].interrupts & 0x10)655 s->ch[ch].status |= 0x10;656 657 if (a->element == (a->elements >> 1))658 if (s->ch[ch].interrupts & 0x04)659 s->ch[ch].status |= 0x04;660 661 if (s->ch[ch].sync && !s->ch[ch].fs &&662 !(s->drq & (1 << s->ch[ch].sync))) {663 s->ch[ch].status &= ~0x40;664 omap_dma_request_stop(s, ch);665 }666 667 /*668 * Process requests made while the element was669 * being transferred.670 */671 if (s->ch[ch].post_sync) {672 omap_dma_request_run(s, 0, s->ch[ch].post_sync);673 s->ch[ch].post_sync = 0;674 }675 676 #if 0677 break;678 #endif679 781 } 680 681 s->ch[ch].cpc = a->dest & 0x0000ffff;682 782 } 683 783 … … 687 787 } 688 788 789 static void omap_dma_reset(struct omap_dma_s *s) 790 { 791 int i; 792 793 qemu_del_timer(s->tm); 794 s->gcr = 0x0004; 795 s->drq = 0x00000000; 796 s->run_count = 0; 797 s->lcd_ch.src = emiff; 798 s->lcd_ch.condition = 0; 799 s->lcd_ch.interrupts = 0; 800 s->lcd_ch.dual = 0; 801 omap_dma_enable_3_1_mapping(s); 802 for (i = 0; i < s->chans; i ++) { 803 memset(&s->ch[i].burst, 0, sizeof(s->ch[i].burst)); 804 memset(&s->ch[i].port, 0, sizeof(s->ch[i].port)); 805 memset(&s->ch[i].mode, 0, sizeof(s->ch[i].mode)); 806 memset(&s->ch[i].elements, 0, sizeof(s->ch[i].elements)); 807 memset(&s->ch[i].frames, 0, sizeof(s->ch[i].frames)); 808 memset(&s->ch[i].frame_index, 0, sizeof(s->ch[i].frame_index)); 809 memset(&s->ch[i].element_index, 0, sizeof(s->ch[i].element_index)); 810 memset(&s->ch[i].data_type, 0, sizeof(s->ch[i].data_type)); 811 memset(&s->ch[i].transparent_copy, 0, 812 sizeof(s->ch[i].transparent_copy)); 813 memset(&s->ch[i].constant_fill, 0, sizeof(s->ch[i].constant_fill)); 814 memset(&s->ch[i].color, 0, sizeof(s->ch[i].color)); 815 memset(&s->ch[i].end_prog, 0, sizeof(s->ch[i].end_prog)); 816 memset(&s->ch[i].repeat, 0, sizeof(s->ch[i].repeat)); 817 memset(&s->ch[i].auto_init, 0, sizeof(s->ch[i].auto_init)); 818 memset(&s->ch[i].link_enabled, 0, sizeof(s->ch[i].link_enabled)); 819 memset(&s->ch[i].link_next_ch, 0, sizeof(s->ch[i].link_next_ch)); 820 s->ch[i].interrupts = 0x0003; 821 memset(&s->ch[i].status, 0, sizeof(s->ch[i].status)); 822 memset(&s->ch[i].active, 0, sizeof(s->ch[i].active)); 823 memset(&s->ch[i].enable, 0, sizeof(s->ch[i].enable)); 824 memset(&s->ch[i].sync, 0, sizeof(s->ch[i].sync)); 825 memset(&s->ch[i].pending_request, 0, sizeof(s->ch[i].pending_request)); 826 memset(&s->ch[i].waiting_end_prog, 0, 827 sizeof(s->ch[i].waiting_end_prog)); 828 memset(&s->ch[i].cpc, 0, sizeof(s->ch[i].cpc)); 829 memset(&s->ch[i].fs, 0, sizeof(s->ch[i].fs)); 830 memset(&s->ch[i].bs, 0, sizeof(s->ch[i].bs)); 831 memset(&s->ch[i].omap_3_1_compatible_disable, 0, 832 sizeof(s->ch[i].omap_3_1_compatible_disable)); 833 memset(&s->ch[i].active_set, 0, sizeof(s->ch[i].active_set)); 834 memset(&s->ch[i].priority, 0, sizeof(s->ch[i].priority)); 835 memset(&s->ch[i].interleave_disabled, 0, 836 sizeof(s->ch[i].interleave_disabled)); 837 memset(&s->ch[i].type, 0, sizeof(s->ch[i].type)); 838 } 839 } 840 689 841 static int omap_dma_ch_reg_read(struct omap_dma_s *s, 690 int ch, int reg, uint16_t *value) { 842 struct omap_dma_channel_s *ch, int reg, uint16_t *value) 843 { 691 844 switch (reg) { 692 845 case 0x00: /* SYS_DMA_CSDP_CH0 */ 693 *value = ( s->ch[ch].burst[1] << 14) |694 ( s->ch[ch].pack[1] << 13) |695 ( s->ch[ch].port[1] << 9) |696 ( s->ch[ch].burst[0] << 7) |697 ( s->ch[ch].pack[0] << 6) |698 ( s->ch[ch].port[0] << 2) |699 ( s->ch[ch].data_type >> 1);846 *value = (ch->burst[1] << 14) | 847 (ch->pack[1] << 13) | 848 (ch->port[1] << 9) | 849 (ch->burst[0] << 7) | 850 (ch->pack[0] << 6) | 851 (ch->port[0] << 2) | 852 (ch->data_type >> 1); 700 853 break; 701 854 702 855 case 0x02: /* SYS_DMA_CCR_CH0 */ 703 *value = (s->ch[ch].mode[1] << 14) | 704 (s->ch[ch].mode[0] << 12) | 705 (s->ch[ch].end_prog << 11) | 706 (s->ch[ch].repeat << 9) | 707 (s->ch[ch].auto_init << 8) | 708 (s->ch[ch].running << 7) | 709 (s->ch[ch].priority << 6) | 710 (s->ch[ch].fs << 5) | s->ch[ch].sync; 856 if (s->model == omap_dma_3_1) 857 *value = 0 << 10; /* FIFO_FLUSH reads as 0 */ 858 else 859 *value = ch->omap_3_1_compatible_disable << 10; 860 *value |= (ch->mode[1] << 14) | 861 (ch->mode[0] << 12) | 862 (ch->end_prog << 11) | 863 (ch->repeat << 9) | 864 (ch->auto_init << 8) | 865 (ch->enable << 7) | 866 (ch->priority << 6) | 867 (ch->fs << 5) | ch->sync; 711 868 break; 712 869 713 870 case 0x04: /* SYS_DMA_CICR_CH0 */ 714 *value = s->ch[ch].interrupts;871 *value = ch->interrupts; 715 872 break; 716 873 717 874 case 0x06: /* SYS_DMA_CSR_CH0 */ 718 /* FIXME: shared CSR for channels sharing the interrupts */ 719 *value = s->ch[ch].status; 720 s->ch[ch].status &= 0x40; 721 omap_dma_interrupts_update(s); 875 *value = ch->status; 876 ch->status &= SYNC; 877 if (!ch->omap_3_1_compatible_disable && ch->sibling) { 878 *value |= (ch->sibling->status & 0x3f) << 6; 879 ch->sibling->status &= SYNC; 880 } 881 qemu_irq_lower(ch->irq); 722 882 break; 723 883 724 884 case 0x08: /* SYS_DMA_CSSA_L_CH0 */ 725 *value = s->ch[ch].addr[0] & 0x0000ffff;885 *value = ch->addr[0] & 0x0000ffff; 726 886 break; 727 887 728 888 case 0x0a: /* SYS_DMA_CSSA_U_CH0 */ 729 *value = s->ch[ch].addr[0] >> 16;889 *value = ch->addr[0] >> 16; 730 890 break; 731 891 732 892 case 0x0c: /* SYS_DMA_CDSA_L_CH0 */ 733 *value = s->ch[ch].addr[1] & 0x0000ffff;893 *value = ch->addr[1] & 0x0000ffff; 734 894 break; 735 895 736 896 case 0x0e: /* SYS_DMA_CDSA_U_CH0 */ 737 *value = s->ch[ch].addr[1] >> 16;897 *value = ch->addr[1] >> 16; 738 898 break; 739 899 740 900 case 0x10: /* SYS_DMA_CEN_CH0 */ 741 *value = s->ch[ch].elements;901 *value = ch->elements; 742 902 break; 743 903 744 904 case 0x12: /* SYS_DMA_CFN_CH0 */ 745 *value = s->ch[ch].frames;905 *value = ch->frames; 746 906 break; 747 907 748 908 case 0x14: /* SYS_DMA_CFI_CH0 */ 749 *value = s->ch[ch].frame_index;909 *value = ch->frame_index[0]; 750 910 break; 751 911 752 912 case 0x16: /* SYS_DMA_CEI_CH0 */ 753 *value = s->ch[ch].element_index; 754 break; 755 756 case 0x18: /* SYS_DMA_CPC_CH0 */ 757 *value = s->ch[ch].cpc; 913 *value = ch->element_index[0]; 914 break; 915 916 case 0x18: /* SYS_DMA_CPC_CH0 or DMA_CSAC */ 917 if (ch->omap_3_1_compatible_disable) 918 *value = ch->active_set.src & 0xffff; /* CSAC */ 919 else 920 *value = ch->cpc; 921 break; 922 923 case 0x1a: /* DMA_CDAC */ 924 *value = ch->active_set.dest & 0xffff; /* CDAC */ 925 break; 926 927 case 0x1c: /* DMA_CDEI */ 928 *value = ch->element_index[1]; 929 break; 930 931 case 0x1e: /* DMA_CDFI */ 932 *value = ch->frame_index[1]; 933 break; 934 935 case 0x20: /* DMA_COLOR_L */ 936 *value = ch->color & 0xffff; 937 break; 938 939 case 0x22: /* DMA_COLOR_U */ 940 *value = ch->color >> 16; 941 break; 942 943 case 0x24: /* DMA_CCR2 */ 944 *value = (ch->bs << 2) | 945 (ch->transparent_copy << 1) | 946 ch->constant_fill; 947 break; 948 949 case 0x28: /* DMA_CLNK_CTRL */ 950 *value = (ch->link_enabled << 15) | 951 (ch->link_next_ch & 0xf); 952 break; 953 954 case 0x2a: /* DMA_LCH_CTRL */ 955 *value = (ch->interleave_disabled << 15) | 956 ch->type; 758 957 break; 759 958 … … 765 964 766 965 static int omap_dma_ch_reg_write(struct omap_dma_s *s, 767 int ch, int reg, uint16_t value) { 966 struct omap_dma_channel_s *ch, int reg, uint16_t value) 967 { 768 968 switch (reg) { 769 969 case 0x00: /* SYS_DMA_CSDP_CH0 */ 770 s->ch[ch].burst[1] = (value & 0xc000) >> 14;771 s->ch[ch].pack[1] = (value & 0x2000) >> 13;772 s->ch[ch].port[1] = (enum omap_dma_port) ((value & 0x1e00) >> 9);773 s->ch[ch].burst[0] = (value & 0x0180) >> 7;774 s->ch[ch].pack[0] = (value & 0x0040) >> 6;775 s->ch[ch].port[0] = (enum omap_dma_port) ((value & 0x003c) >> 2);776 s->ch[ch].data_type = (1 << (value & 3));777 if ( s->ch[ch].port[0] >= omap_dma_port_last)970 ch->burst[1] = (value & 0xc000) >> 14; 971 ch->pack[1] = (value & 0x2000) >> 13; 972 ch->port[1] = (enum omap_dma_port) ((value & 0x1e00) >> 9); 973 ch->burst[0] = (value & 0x0180) >> 7; 974 ch->pack[0] = (value & 0x0040) >> 6; 975 ch->port[0] = (enum omap_dma_port) ((value & 0x003c) >> 2); 976 ch->data_type = (1 << (value & 3)); 977 if (ch->port[0] >= omap_dma_port_last) 778 978 printf("%s: invalid DMA port %i\n", __FUNCTION__, 779 s->ch[ch].port[0]);780 if ( s->ch[ch].port[1] >= omap_dma_port_last)979 ch->port[0]); 980 if (ch->port[1] >= omap_dma_port_last) 781 981 printf("%s: invalid DMA port %i\n", __FUNCTION__, 782 s->ch[ch].port[1]);982 ch->port[1]); 783 983 if ((value & 3) == 3) 784 printf("%s: bad data_type for DMA channel %i\n", __FUNCTION__, ch);984 printf("%s: bad data_type for DMA channel\n", __FUNCTION__); 785 985 break; 786 986 787 987 case 0x02: /* SYS_DMA_CCR_CH0 */ 788 s->ch[ch].mode[1] = (omap_dma_addressing_t) ((value & 0xc000) >> 14); 789 s->ch[ch].mode[0] = (omap_dma_addressing_t) ((value & 0x3000) >> 12); 790 s->ch[ch].end_prog = (value & 0x0800) >> 11; 791 s->ch[ch].repeat = (value & 0x0200) >> 9; 792 s->ch[ch].auto_init = (value & 0x0100) >> 8; 793 s->ch[ch].priority = (value & 0x0040) >> 6; 794 s->ch[ch].fs = (value & 0x0020) >> 5; 795 s->ch[ch].sync = value & 0x001f; 796 if (value & 0x0080) { 797 if (s->ch[ch].running) { 798 if (!s->ch[ch].signalled && 799 s->ch[ch].auto_init && s->ch[ch].end_prog) 800 omap_dma_channel_load(s, ch); 801 } else { 802 s->ch[ch].running = 1; 803 omap_dma_channel_load(s, ch); 804 } 805 if (!s->ch[ch].sync || (s->drq & (1 << s->ch[ch].sync))) 806 omap_dma_request_run(s, ch, 0); 807 } else { 808 s->ch[ch].running = 0; 809 omap_dma_request_stop(s, ch); 988 ch->mode[1] = (omap_dma_addressing_t) ((value & 0xc000) >> 14); 989 ch->mode[0] = (omap_dma_addressing_t) ((value & 0x3000) >> 12); 990 ch->end_prog = (value & 0x0800) >> 11; 991 if (s->model > omap_dma_3_1) 992 ch->omap_3_1_compatible_disable = (value >> 10) & 0x1; 993 ch->repeat = (value & 0x0200) >> 9; 994 ch->auto_init = (value & 0x0100) >> 8; 995 ch->priority = (value & 0x0040) >> 6; 996 ch->fs = (value & 0x0020) >> 5; 997 ch->sync = value & 0x001f; 998 999 if (value & 0x0080) 1000 omap_dma_enable_channel(s, ch); 1001 else 1002 omap_dma_disable_channel(s, ch); 1003 1004 if (ch->end_prog) 1005 omap_dma_channel_end_prog(s, ch); 1006 1007 break; 1008 1009 case 0x04: /* SYS_DMA_CICR_CH0 */ 1010 ch->interrupts = value; 1011 break; 1012 1013 case 0x06: /* SYS_DMA_CSR_CH0 */ 1014 OMAP_RO_REG((target_phys_addr_t) reg); 1015 break; 1016 1017 case 0x08: /* SYS_DMA_CSSA_L_CH0 */ 1018 ch->addr[0] &= 0xffff0000; 1019 ch->addr[0] |= value; 1020 break; 1021 1022 case 0x0a: /* SYS_DMA_CSSA_U_CH0 */ 1023 ch->addr[0] &= 0x0000ffff; 1024 ch->addr[0] |= (uint32_t) value << 16; 1025 break; 1026 1027 case 0x0c: /* SYS_DMA_CDSA_L_CH0 */ 1028 ch->addr[1] &= 0xffff0000; 1029 ch->addr[1] |= value; 1030 break; 1031 1032 case 0x0e: /* SYS_DMA_CDSA_U_CH0 */ 1033 ch->addr[1] &= 0x0000ffff; 1034 ch->addr[1] |= (uint32_t) value << 16; 1035 break; 1036 1037 case 0x10: /* SYS_DMA_CEN_CH0 */ 1038 ch->elements = value; 1039 break; 1040 1041 case 0x12: /* SYS_DMA_CFN_CH0 */ 1042 ch->frames = value; 1043 break; 1044 1045 case 0x14: /* SYS_DMA_CFI_CH0 */ 1046 ch->frame_index[0] = (int16_t) value; 1047 break; 1048 1049 case 0x16: /* SYS_DMA_CEI_CH0 */ 1050 ch->element_index[0] = (int16_t) value; 1051 break; 1052 1053 case 0x18: /* SYS_DMA_CPC_CH0 or DMA_CSAC */ 1054 OMAP_RO_REG((target_phys_addr_t) reg); 1055 break; 1056 1057 case 0x1c: /* DMA_CDEI */ 1058 ch->element_index[1] = (int16_t) value; 1059 break; 1060 1061 case 0x1e: /* DMA_CDFI */ 1062 ch->frame_index[1] = (int16_t) value; 1063 break; 1064 1065 case 0x20: /* DMA_COLOR_L */ 1066 ch->color &= 0xffff0000; 1067 ch->color |= value; 1068 break; 1069 1070 case 0x22: /* DMA_COLOR_U */ 1071 ch->color &= 0xffff; 1072 ch->color |= value << 16; 1073 break; 1074 1075 case 0x24: /* DMA_CCR2 */ 1076 ch->bs = (value >> 2) & 0x1; 1077 ch->transparent_copy = (value >> 1) & 0x1; 1078 ch->constant_fill = value & 0x1; 1079 break; 1080 1081 case 0x28: /* DMA_CLNK_CTRL */ 1082 ch->link_enabled = (value >> 15) & 0x1; 1083 if (value & (1 << 14)) { /* Stop_Lnk */ 1084 ch->link_enabled = 0; 1085 omap_dma_disable_channel(s, ch); 810 1086 } 811 break; 812 813 case 0x04: /* SYS_DMA_CICR_CH0 */ 814 s->ch[ch].interrupts = value & 0x003f; 815 break; 816 817 case 0x06: /* SYS_DMA_CSR_CH0 */ 1087 ch->link_next_ch = value & 0x1f; 1088 break; 1089 1090 case 0x2a: /* DMA_LCH_CTRL */ 1091 ch->interleave_disabled = (value >> 15) & 0x1; 1092 ch->type = value & 0xf; 1093 break; 1094 1095 default: 818 1096 return 1; 819 820 case 0x08: /* SYS_DMA_CSSA_L_CH0 */ 821 s->ch[ch].addr[0] &= 0xffff0000; 822 s->ch[ch].addr[0] |= value; 823 break; 824 825 case 0x0a: /* SYS_DMA_CSSA_U_CH0 */ 826 s->ch[ch].addr[0] &= 0x0000ffff; 827 s->ch[ch].addr[0] |= (uint32_t) value << 16; 828 break; 829 830 case 0x0c: /* SYS_DMA_CDSA_L_CH0 */ 831 s->ch[ch].addr[1] &= 0xffff0000; 832 s->ch[ch].addr[1] |= value; 833 break; 834 835 case 0x0e: /* SYS_DMA_CDSA_U_CH0 */ 836 s->ch[ch].addr[1] &= 0x0000ffff; 837 s->ch[ch].addr[1] |= (uint32_t) value << 16; 838 break; 839 840 case 0x10: /* SYS_DMA_CEN_CH0 */ 841 s->ch[ch].elements = value & 0xffff; 842 break; 843 844 case 0x12: /* SYS_DMA_CFN_CH0 */ 845 s->ch[ch].frames = value & 0xffff; 846 break; 847 848 case 0x14: /* SYS_DMA_CFI_CH0 */ 849 s->ch[ch].frame_index = value & 0xffff; 850 break; 851 852 case 0x16: /* SYS_DMA_CEI_CH0 */ 853 s->ch[ch].element_index = value & 0xffff; 854 break; 855 856 case 0x18: /* SYS_DMA_CPC_CH0 */ 1097 } 1098 return 0; 1099 } 1100 1101 static int omap_dma_3_2_lcd_write(struct omap_dma_lcd_channel_s *s, int offset, 1102 uint16_t value) 1103 { 1104 switch (offset) { 1105 case 0xbc0: /* DMA_LCD_CSDP */ 1106 s->brust_f2 = (value >> 14) & 0x3; 1107 s->pack_f2 = (value >> 13) & 0x1; 1108 s->data_type_f2 = (1 << ((value >> 11) & 0x3)); 1109 s->brust_f1 = (value >> 7) & 0x3; 1110 s->pack_f1 = (value >> 6) & 0x1; 1111 s->data_type_f1 = (1 << ((value >> 0) & 0x3)); 1112 break; 1113 1114 case 0xbc2: /* DMA_LCD_CCR */ 1115 s->mode_f2 = (value >> 14) & 0x3; 1116 s->mode_f1 = (value >> 12) & 0x3; 1117 s->end_prog = (value >> 11) & 0x1; 1118 s->omap_3_1_compatible_disable = (value >> 10) & 0x1; 1119 s->repeat = (value >> 9) & 0x1; 1120 s->auto_init = (value >> 8) & 0x1; 1121 s->running = (value >> 7) & 0x1; 1122 s->priority = (value >> 6) & 0x1; 1123 s->bs = (value >> 4) & 0x1; 1124 break; 1125 1126 case 0xbc4: /* DMA_LCD_CTRL */ 1127 s->dst = (value >> 8) & 0x1; 1128 s->src = ((value >> 6) & 0x3) << 1; 1129 s->condition = 0; 1130 /* Assume no bus errors and thus no BUS_ERROR irq bits. */ 1131 s->interrupts = (value >> 1) & 1; 1132 s->dual = value & 1; 1133 break; 1134 1135 case 0xbc8: /* TOP_B1_L */ 1136 s->src_f1_top &= 0xffff0000; 1137 s->src_f1_top |= 0x0000ffff & value; 1138 break; 1139 1140 case 0xbca: /* TOP_B1_U */ 1141 s->src_f1_top &= 0x0000ffff; 1142 s->src_f1_top |= value << 16; 1143 break; 1144 1145 case 0xbcc: /* BOT_B1_L */ 1146 s->src_f1_bottom &= 0xffff0000; 1147 s->src_f1_bottom |= 0x0000ffff & value; 1148 break; 1149 1150 case 0xbce: /* BOT_B1_U */ 1151 s->src_f1_bottom &= 0x0000ffff; 1152 s->src_f1_bottom |= (uint32_t) value << 16; 1153 break; 1154 1155 case 0xbd0: /* TOP_B2_L */ 1156 s->src_f2_top &= 0xffff0000; 1157 s->src_f2_top |= 0x0000ffff & value; 1158 break; 1159 1160 case 0xbd2: /* TOP_B2_U */ 1161 s->src_f2_top &= 0x0000ffff; 1162 s->src_f2_top |= (uint32_t) value << 16; 1163 break; 1164 1165 case 0xbd4: /* BOT_B2_L */ 1166 s->src_f2_bottom &= 0xffff0000; 1167 s->src_f2_bottom |= 0x0000ffff & value; 1168 break; 1169 1170 case 0xbd6: /* BOT_B2_U */ 1171 s->src_f2_bottom &= 0x0000ffff; 1172 s->src_f2_bottom |= (uint32_t) value << 16; 1173 break; 1174 1175 case 0xbd8: /* DMA_LCD_SRC_EI_B1 */ 1176 s->element_index_f1 = value; 1177 break; 1178 1179 case 0xbda: /* DMA_LCD_SRC_FI_B1_L */ 1180 s->frame_index_f1 &= 0xffff0000; 1181 s->frame_index_f1 |= 0x0000ffff & value; 1182 break; 1183 1184 case 0xbf4: /* DMA_LCD_SRC_FI_B1_U */ 1185 s->frame_index_f1 &= 0x0000ffff; 1186 s->frame_index_f1 |= (uint32_t) value << 16; 1187 break; 1188 1189 case 0xbdc: /* DMA_LCD_SRC_EI_B2 */ 1190 s->element_index_f2 = value; 1191 break; 1192 1193 case 0xbde: /* DMA_LCD_SRC_FI_B2_L */ 1194 s->frame_index_f2 &= 0xffff0000; 1195 s->frame_index_f2 |= 0x0000ffff & value; 1196 break; 1197 1198 case 0xbf6: /* DMA_LCD_SRC_FI_B2_U */ 1199 s->frame_index_f2 &= 0x0000ffff; 1200 s->frame_index_f2 |= (uint32_t) value << 16; 1201 break; 1202 1203 case 0xbe0: /* DMA_LCD_SRC_EN_B1 */ 1204 s->elements_f1 = value; 1205 break; 1206 1207 case 0xbe4: /* DMA_LCD_SRC_FN_B1 */ 1208 s->frames_f1 = value; 1209 break; 1210 1211 case 0xbe2: /* DMA_LCD_SRC_EN_B2 */ 1212 s->elements_f2 = value; 1213 break; 1214 1215 case 0xbe6: /* DMA_LCD_SRC_FN_B2 */ 1216 s->frames_f2 = value; 1217 break; 1218 1219 case 0xbea: /* DMA_LCD_LCH_CTRL */ 1220 s->lch_type = value & 0xf; 1221 break; 1222 1223 default: 857 1224 return 1; 1225 } 1226 return 0; 1227 } 1228 1229 static int omap_dma_3_2_lcd_read(struct omap_dma_lcd_channel_s *s, int offset, 1230 uint16_t *ret) 1231 { 1232 switch (offset) { 1233 case 0xbc0: /* DMA_LCD_CSDP */ 1234 *ret = (s->brust_f2 << 14) | 1235 (s->pack_f2 << 13) | 1236 ((s->data_type_f2 >> 1) << 11) | 1237 (s->brust_f1 << 7) | 1238 (s->pack_f1 << 6) | 1239 ((s->data_type_f1 >> 1) << 0); 1240 break; 1241 1242 case 0xbc2: /* DMA_LCD_CCR */ 1243 *ret = (s->mode_f2 << 14) | 1244 (s->mode_f1 << 12) | 1245 (s->end_prog << 11) | 1246 (s->omap_3_1_compatible_disable << 10) | 1247 (s->repeat << 9) | 1248 (s->auto_init << 8) | 1249 (s->running << 7) | 1250 (s->priority << 6) | 1251 (s->bs << 4); 1252 break; 1253 1254 case 0xbc4: /* DMA_LCD_CTRL */ 1255 qemu_irq_lower(s->irq); 1256 *ret = (s->dst << 8) | 1257 ((s->src & 0x6) << 5) | 1258 (s->condition << 3) | 1259 (s->interrupts << 1) | 1260 s->dual; 1261 break; 1262 1263 case 0xbc8: /* TOP_B1_L */ 1264 *ret = s->src_f1_top & 0xffff; 1265 break; 1266 1267 case 0xbca: /* TOP_B1_U */ 1268 *ret = s->src_f1_top >> 16; 1269 break; 1270 1271 case 0xbcc: /* BOT_B1_L */ 1272 *ret = s->src_f1_bottom & 0xffff; 1273 break; 1274 1275 case 0xbce: /* BOT_B1_U */ 1276 *ret = s->src_f1_bottom >> 16; 1277 break; 1278 1279 case 0xbd0: /* TOP_B2_L */ 1280 *ret = s->src_f2_top & 0xffff; 1281 break; 1282 1283 case 0xbd2: /* TOP_B2_U */ 1284 *ret = s->src_f2_top >> 16; 1285 break; 1286 1287 case 0xbd4: /* BOT_B2_L */ 1288 *ret = s->src_f2_bottom & 0xffff; 1289 break; 1290 1291 case 0xbd6: /* BOT_B2_U */ 1292 *ret = s->src_f2_bottom >> 16; 1293 break; 1294 1295 case 0xbd8: /* DMA_LCD_SRC_EI_B1 */ 1296 *ret = s->element_index_f1; 1297 break; 1298 1299 case 0xbda: /* DMA_LCD_SRC_FI_B1_L */ 1300 *ret = s->frame_index_f1 & 0xffff; 1301 break; 1302 1303 case 0xbf4: /* DMA_LCD_SRC_FI_B1_U */ 1304 *ret = s->frame_index_f1 >> 16; 1305 break; 1306 1307 case 0xbdc: /* DMA_LCD_SRC_EI_B2 */ 1308 *ret = s->element_index_f2; 1309 break; 1310 1311 case 0xbde: /* DMA_LCD_SRC_FI_B2_L */ 1312 *ret = s->frame_index_f2 & 0xffff; 1313 break; 1314 1315 case 0xbf6: /* DMA_LCD_SRC_FI_B2_U */ 1316 *ret = s->frame_index_f2 >> 16; 1317 break; 1318 1319 case 0xbe0: /* DMA_LCD_SRC_EN_B1 */ 1320 *ret = s->elements_f1; 1321 break; 1322 1323 case 0xbe4: /* DMA_LCD_SRC_FN_B1 */ 1324 *ret = s->frames_f1; 1325 break; 1326 1327 case 0xbe2: /* DMA_LCD_SRC_EN_B2 */ 1328 *ret = s->elements_f2; 1329 break; 1330 1331 case 0xbe6: /* DMA_LCD_SRC_FN_B2 */ 1332 *ret = s->frames_f2; 1333 break; 1334 1335 case 0xbea: /* DMA_LCD_LCH_CTRL */ 1336 *ret = s->lch_type; 1337 break; 858 1338 859 1339 default: 860 OMAP_BAD_REG((target_phys_addr_t) reg);1340 return 1; 861 1341 } 862 1342 return 0; 863 1343 } 864 1344 1345 static int omap_dma_3_1_lcd_write(struct omap_dma_lcd_channel_s *s, int offset, 1346 uint16_t value) 1347 { 1348 switch (offset) { 1349 case 0x300: /* SYS_DMA_LCD_CTRL */ 1350 s->src = (value & 0x40) ? imif : emiff; 1351 s->condition = 0; 1352 /* Assume no bus errors and thus no BUS_ERROR irq bits. */ 1353 s->interrupts = (value >> 1) & 1; 1354 s->dual = value & 1; 1355 break; 1356 1357 case 0x302: /* SYS_DMA_LCD_TOP_F1_L */ 1358 s->src_f1_top &= 0xffff0000; 1359 s->src_f1_top |= 0x0000ffff & value; 1360 break; 1361 1362 case 0x304: /* SYS_DMA_LCD_TOP_F1_U */ 1363 s->src_f1_top &= 0x0000ffff; 1364 s->src_f1_top |= value << 16; 1365 break; 1366 1367 case 0x306: /* SYS_DMA_LCD_BOT_F1_L */ 1368 s->src_f1_bottom &= 0xffff0000; 1369 s->src_f1_bottom |= 0x0000ffff & value; 1370 break; 1371 1372 case 0x308: /* SYS_DMA_LCD_BOT_F1_U */ 1373 s->src_f1_bottom &= 0x0000ffff; 1374 s->src_f1_bottom |= value << 16; 1375 break; 1376 1377 case 0x30a: /* SYS_DMA_LCD_TOP_F2_L */ 1378 s->src_f2_top &= 0xffff0000; 1379 s->src_f2_top |= 0x0000ffff & value; 1380 break; 1381 1382 case 0x30c: /* SYS_DMA_LCD_TOP_F2_U */ 1383 s->src_f2_top &= 0x0000ffff; 1384 s->src_f2_top |= value << 16; 1385 break; 1386 1387 case 0x30e: /* SYS_DMA_LCD_BOT_F2_L */ 1388 s->src_f2_bottom &= 0xffff0000; 1389 s->src_f2_bottom |= 0x0000ffff & value; 1390 break; 1391 1392 case 0x310: /* SYS_DMA_LCD_BOT_F2_U */ 1393 s->src_f2_bottom &= 0x0000ffff; 1394 s->src_f2_bottom |= value << 16; 1395 break; 1396 1397 default: 1398 return 1; 1399 } 1400 return 0; 1401 } 1402 1403 static int omap_dma_3_1_lcd_read(struct omap_dma_lcd_channel_s *s, int offset, 1404 uint16_t *ret) 1405 { 1406 int i; 1407 1408 switch (offset) { 1409 case 0x300: /* SYS_DMA_LCD_CTRL */ 1410 i = s->condition; 1411 s->condition = 0; 1412 qemu_irq_lower(s->irq); 1413 *ret = ((s->src == imif) << 6) | (i << 3) | 1414 (s->interrupts << 1) | s->dual; 1415 break; 1416 1417 case 0x302: /* SYS_DMA_LCD_TOP_F1_L */ 1418 *ret = s->src_f1_top & 0xffff; 1419 break; 1420 1421 case 0x304: /* SYS_DMA_LCD_TOP_F1_U */ 1422 *ret = s->src_f1_top >> 16; 1423 break; 1424 1425 case 0x306: /* SYS_DMA_LCD_BOT_F1_L */ 1426 *ret = s->src_f1_bottom & 0xffff; 1427 break; 1428 1429 case 0x308: /* SYS_DMA_LCD_BOT_F1_U */ 1430 *ret = s->src_f1_bottom >> 16; 1431 break; 1432 1433 case 0x30a: /* SYS_DMA_LCD_TOP_F2_L */ 1434 *ret = s->src_f2_top & 0xffff; 1435 break; 1436 1437 case 0x30c: /* SYS_DMA_LCD_TOP_F2_U */ 1438 *ret = s->src_f2_top >> 16; 1439 break; 1440 1441 case 0x30e: /* SYS_DMA_LCD_BOT_F2_L */ 1442 *ret = s->src_f2_bottom & 0xffff; 1443 break; 1444 1445 case 0x310: /* SYS_DMA_LCD_BOT_F2_U */ 1446 *ret = s->src_f2_bottom >> 16; 1447 break; 1448 1449 default: 1450 return 1; 1451 } 1452 return 0; 1453 } 1454 1455 static int omap_dma_sys_write(struct omap_dma_s *s, int offset, uint16_t value) 1456 { 1457 switch (offset) { 1458 case 0x400: /* SYS_DMA_GCR */ 1459 s->gcr = value; 1460 break; 1461 1462 case 0x404: /* DMA_GSCR */ 1463 if (value & 0x8) 1464 omap_dma_disable_3_1_mapping(s); 1465 else 1466 omap_dma_enable_3_1_mapping(s); 1467 break; 1468 1469 case 0x408: /* DMA_GRST */ 1470 if (value & 0x1) 1471 omap_dma_reset(s); 1472 break; 1473 1474 default: 1475 return 1; 1476 } 1477 return 0; 1478 } 1479 1480 static int omap_dma_sys_read(struct omap_dma_s *s, int offset, 1481 uint16_t *ret) 1482 { 1483 switch (offset) { 1484 case 0x400: /* SYS_DMA_GCR */ 1485 *ret = s->gcr; 1486 break; 1487 1488 case 0x404: /* DMA_GSCR */ 1489 *ret = s->omap_3_1_mapping_disabled << 3; 1490 break; 1491 1492 case 0x408: /* DMA_GRST */ 1493 *ret = 0; 1494 break; 1495 1496 case 0x442: /* DMA_HW_ID */ 1497 case 0x444: /* DMA_PCh2_ID */ 1498 case 0x446: /* DMA_PCh0_ID */ 1499 case 0x448: /* DMA_PCh1_ID */ 1500 case 0x44a: /* DMA_PChG_ID */ 1501 case 0x44c: /* DMA_PChD_ID */ 1502 *ret = 1; 1503 break; 1504 1505 case 0x44e: /* DMA_CAPS_0_U */ 1506 *ret = (1 << 3) | /* Constant Fill Capacity */ 1507 (1 << 2); /* Transparent BLT Capacity */ 1508 break; 1509 1510 case 0x450: /* DMA_CAPS_0_L */ 1511 case 0x452: /* DMA_CAPS_1_U */ 1512 *ret = 0; 1513 break; 1514 1515 case 0x454: /* DMA_CAPS_1_L */ 1516 *ret = (1 << 1); /* 1-bit palletized capability */ 1517 break; 1518 1519 case 0x456: /* DMA_CAPS_2 */ 1520 *ret = (1 << 8) | /* SSDIC */ 1521 (1 << 7) | /* DDIAC */ 1522 (1 << 6) | /* DSIAC */ 1523 (1 << 5) | /* DPIAC */ 1524 (1 << 4) | /* DCAC */ 1525 (1 << 3) | /* SDIAC */ 1526 (1 << 2) | /* SSIAC */ 1527 (1 << 1) | /* SPIAC */ 1528 1; /* SCAC */ 1529 break; 1530 1531 case 0x458: /* DMA_CAPS_3 */ 1532 *ret = (1 << 5) | /* CCC */ 1533 (1 << 4) | /* IC */ 1534 (1 << 3) | /* ARC */ 1535 (1 << 2) | /* AEC */ 1536 (1 << 1) | /* FSC */ 1537 1; /* ESC */ 1538 break; 1539 1540 case 0x45a: /* DMA_CAPS_4 */ 1541 *ret = (1 << 6) | /* SSC */ 1542 (1 << 5) | /* BIC */ 1543 (1 << 4) | /* LFIC */ 1544 (1 << 3) | /* FIC */ 1545 (1 << 2) | /* HFIC */ 1546 (1 << 1) | /* EDIC */ 1547 1; /* TOIC */ 1548 break; 1549 1550 case 0x460: /* DMA_PCh2_SR */ 1551 case 0x480: /* DMA_PCh0_SR */ 1552 case 0x482: /* DMA_PCh1_SR */ 1553 case 0x4c0: /* DMA_PChD_SR_0 */ 1554 printf("%s: Physical Channel Status Registers not implemented.\n", 1555 __FUNCTION__); 1556 *ret = 0xff; 1557 break; 1558 1559 default: 1560 return 1; 1561 } 1562 return 0; 1563 } 1564 865 1565 static uint32_t omap_dma_read(void *opaque, target_phys_addr_t addr) 866 1566 { 867 1567 struct omap_dma_s *s = (struct omap_dma_s *) opaque; 868 int i,reg, ch, offset = addr - s->base;1568 int reg, ch, offset = addr - s->base; 869 1569 uint16_t ret; 870 1570 871 1571 switch (offset) { 1572 case 0x300 ... 0x3fe: 1573 if (s->model == omap_dma_3_1 || !s->omap_3_1_mapping_disabled) { 1574 if (omap_dma_3_1_lcd_read(&s->lcd_ch, offset, &ret)) 1575 break; 1576 return ret; 1577 } 1578 /* Fall through. */ 872 1579 case 0x000 ... 0x2fe: 873 1580 reg = offset & 0x3f; 874 1581 ch = (offset >> 6) & 0x0f; 875 if (omap_dma_ch_reg_read(s, ch, reg, &ret))1582 if (omap_dma_ch_reg_read(s, &s->ch[ch], reg, &ret)) 876 1583 break; 877 1584 return ret; 878 1585 879 case 0x300: /* SYS_DMA_LCD_CTRL */ 880 i = s->lcd_ch.condition; 881 s->lcd_ch.condition = 0; 882 qemu_irq_lower(s->lcd_ch.irq); 883 return ((s->lcd_ch.src == imif) << 6) | (i << 3) | 884 (s->lcd_ch.interrupts << 1) | s->lcd_ch.dual; 885 886 case 0x302: /* SYS_DMA_LCD_TOP_F1_L */ 887 return s->lcd_ch.src_f1_top & 0xffff; 888 889 case 0x304: /* SYS_DMA_LCD_TOP_F1_U */ 890 return s->lcd_ch.src_f1_top >> 16; 891 892 case 0x306: /* SYS_DMA_LCD_BOT_F1_L */ 893 return s->lcd_ch.src_f1_bottom & 0xffff; 894 895 case 0x308: /* SYS_DMA_LCD_BOT_F1_U */ 896 return s->lcd_ch.src_f1_bottom >> 16; 897 898 case 0x30a: /* SYS_DMA_LCD_TOP_F2_L */ 899 return s->lcd_ch.src_f2_top & 0xffff; 900 901 case 0x30c: /* SYS_DMA_LCD_TOP_F2_U */ 902 return s->lcd_ch.src_f2_top >> 16; 903 904 case 0x30e: /* SYS_DMA_LCD_BOT_F2_L */ 905 return s->lcd_ch.src_f2_bottom & 0xffff; 906 907 case 0x310: /* SYS_DMA_LCD_BOT_F2_U */ 908 return s->lcd_ch.src_f2_bottom >> 16; 909 910 case 0x400: /* SYS_DMA_GCR */ 911 return s->gcr; 1586 case 0x404 ... 0x4fe: 1587 if (s->model == omap_dma_3_1) 1588 break; 1589 /* Fall through. */ 1590 case 0x400: 1591 if (omap_dma_sys_read(s, offset, &ret)) 1592 break; 1593 return ret; 1594 1595 case 0xb00 ... 0xbfe: 1596 if (s->model == omap_dma_3_2 && s->omap_3_1_mapping_disabled) { 1597 if (omap_dma_3_2_lcd_read(&s->lcd_ch, offset, &ret)) 1598 break; 1599 return ret; 1600 } 1601 break; 912 1602 } 913 1603 … … 923 1613 924 1614 switch (offset) { 1615 case 0x300 ... 0x3fe: 1616 if (s->model == omap_dma_3_1 || !s->omap_3_1_mapping_disabled) { 1617 if (omap_dma_3_1_lcd_write(&s->lcd_ch, offset, value)) 1618 break; 1619 return; 1620 } 1621 /* Fall through. */ 925 1622 case 0x000 ... 0x2fe: 926 1623 reg = offset & 0x3f; 927 1624 ch = (offset >> 6) & 0x0f; 928 if (omap_dma_ch_reg_write(s, ch, reg, value)) 929 OMAP_RO_REG(addr); 930 break; 931 932 case 0x300: /* SYS_DMA_LCD_CTRL */ 933 s->lcd_ch.src = (value & 0x40) ? imif : emiff; 934 s->lcd_ch.condition = 0; 935 /* Assume no bus errors and thus no BUS_ERROR irq bits. */ 936 s->lcd_ch.interrupts = (value >> 1) & 1; 937 s->lcd_ch.dual = value & 1; 938 break; 939 940 case 0x302: /* SYS_DMA_LCD_TOP_F1_L */ 941 s->lcd_ch.src_f1_top &= 0xffff0000; 942 s->lcd_ch.src_f1_top |= 0x0000ffff & value; 943 break; 944 945 case 0x304: /* SYS_DMA_LCD_TOP_F1_U */ 946 s->lcd_ch.src_f1_top &= 0x0000ffff; 947 s->lcd_ch.src_f1_top |= value << 16; 948 break; 949 950 case 0x306: /* SYS_DMA_LCD_BOT_F1_L */ 951 s->lcd_ch.src_f1_bottom &= 0xffff0000; 952 s->lcd_ch.src_f1_bottom |= 0x0000ffff & value; 953 break; 954 955 case 0x308: /* SYS_DMA_LCD_BOT_F1_U */ 956 s->lcd_ch.src_f1_bottom &= 0x0000ffff; 957 s->lcd_ch.src_f1_bottom |= value << 16; 958 break; 959 960 case 0x30a: /* SYS_DMA_LCD_TOP_F2_L */ 961 s->lcd_ch.src_f2_top &= 0xffff0000; 962 s->lcd_ch.src_f2_top |= 0x0000ffff & value; 963 break; 964 965 case 0x30c: /* SYS_DMA_LCD_TOP_F2_U */ 966 s->lcd_ch.src_f2_top &= 0x0000ffff; 967 s->lcd_ch.src_f2_top |= value << 16; 968 break; 969 970 case 0x30e: /* SYS_DMA_LCD_BOT_F2_L */ 971 s->lcd_ch.src_f2_bottom &= 0xffff0000; 972 s->lcd_ch.src_f2_bottom |= 0x0000ffff & value; 973 break; 974 975 case 0x310: /* SYS_DMA_LCD_BOT_F2_U */ 976 s->lcd_ch.src_f2_bottom &= 0x0000ffff; 977 s->lcd_ch.src_f2_bottom |= value << 16; 978 break; 979 980 case 0x400: /* SYS_DMA_GCR */ 981 s->gcr = value & 0x000c; 982 break; 983 984 default: 985 OMAP_BAD_REG(addr); 986 } 1625 if (omap_dma_ch_reg_write(s, &s->ch[ch], reg, value)) 1626 break; 1627 return; 1628 1629 case 0x404 ... 0x4fe: 1630 if (s->model == omap_dma_3_1) 1631 break; 1632 case 0x400: 1633 /* Fall through. */ 1634 if (omap_dma_sys_write(s, offset, value)) 1635 break; 1636 return; 1637 1638 case 0xb00 ... 0xbfe: 1639 if (s->model == omap_dma_3_2 && s->omap_3_1_mapping_disabled) { 1640 if (omap_dma_3_2_lcd_write(&s->lcd_ch, offset, value)) 1641 break; 1642 return; 1643 } 1644 break; 1645 } 1646 1647 OMAP_BAD_REG(addr); 987 1648 } 988 1649 … … 1006 1667 if (~s->drq & (1 << drq)) { 1007 1668 s->drq |= 1 << drq; 1008 omap_dma_ request_run(s, 0, drq);1669 omap_dma_process_request(s, drq); 1009 1670 } 1010 1671 } else … … 1027 1688 } 1028 1689 1029 static void omap_dma_reset(struct omap_dma_s *s) 1030 { 1031 int i; 1032 1033 qemu_del_timer(s->tm); 1034 s->gcr = 0x0004; 1035 s->drq = 0x00000000; 1036 s->run_count = 0; 1037 s->lcd_ch.src = emiff; 1038 s->lcd_ch.condition = 0; 1039 s->lcd_ch.interrupts = 0; 1040 s->lcd_ch.dual = 0; 1041 memset(s->ch, 0, sizeof(s->ch)); 1042 for (i = 0; i < s->chans; i ++) 1043 s->ch[i].interrupts = 0x0003; 1044 } 1045 1046 struct omap_dma_s *omap_dma_init(target_phys_addr_t base, 1047 qemu_irq pic[], struct omap_mpu_state_s *mpu, omap_clk clk) 1048 { 1049 int iomemtype; 1690 struct omap_dma_s *omap_dma_init(target_phys_addr_t base, qemu_irq *irqs, 1691 qemu_irq lcd_irq, struct omap_mpu_state_s *mpu, omap_clk clk, 1692 enum omap_dma_model model) 1693 { 1694 int iomemtype, num_irqs, memsize, i; 1050 1695 struct omap_dma_s *s = (struct omap_dma_s *) 1051 1696 qemu_mallocz(sizeof(struct omap_dma_s)); 1052 1697 1053 s->ih = pic; 1698 if (model == omap_dma_3_1) { 1699 num_irqs = 6; 1700 memsize = 0x800; 1701 } else { 1702 num_irqs = 16; 1703 memsize = 0xc00; 1704 } 1054 1705 s->base = base; 1055 s-> chans = 9;1706 s->model = model; 1056 1707 s->mpu = mpu; 1057 1708 s->clk = clk; 1058 s->lcd_ch.irq = pic[OMAP_INT_DMA_LCD];1709 s->lcd_ch.irq = lcd_irq; 1059 1710 s->lcd_ch.mpu = mpu; 1711 while (num_irqs --) 1712 s->ch[num_irqs].irq = irqs[num_irqs]; 1713 for (i = 0; i < 3; i ++) { 1714 s->ch[i].sibling = &s->ch[i + 6]; 1715 s->ch[i + 6].sibling = &s->ch[i]; 1716 } 1060 1717 s->tm = qemu_new_timer(vm_clock, (QEMUTimerCB *) omap_dma_channel_run, s); 1061 1718 omap_clk_adduser(s->clk, qemu_allocate_irqs(omap_dma_clk_update, s, 1)[0]); … … 1066 1723 iomemtype = cpu_register_io_memory(0, omap_dma_readfn, 1067 1724 omap_dma_writefn, s); 1068 cpu_register_physical_memory(s->base, 0x800, iomemtype);1725 cpu_register_physical_memory(s->base, memsize, iomemtype); 1069 1726 1070 1727 return s; … … 2920 3577 rows |= i; 2921 3578 2922 qemu_set_irq(s->kbd_irq, rows && ~s->kbd_mask && s->clk);2923 s->row_latch = rows ^ 0x1f;3579 qemu_set_irq(s->kbd_irq, rows && !s->kbd_mask && s->clk); 3580 s->row_latch = ~rows; 2924 3581 } 2925 3582 … … 2953 3610 2954 3611 case 0x20: /* KBD_INT */ 2955 return ( s->row_latch !=0x1f) && !s->kbd_mask;3612 return (~s->row_latch & 0x1f) && !s->kbd_mask; 2956 3613 2957 3614 case 0x24: /* GPIO_INT */ … … 4920 5577 } 4921 5578 5579 struct dma_irq_map { 5580 int ih; 5581 int intr; 5582 }; 5583 5584 static const struct dma_irq_map omap_dma_irq_map[] = { 5585 { 0, OMAP_INT_DMA_CH0_6 }, 5586 { 0, OMAP_INT_DMA_CH1_7 }, 5587 { 0, OMAP_INT_DMA_CH2_8 }, 5588 { 0, OMAP_INT_DMA_CH3 }, 5589 { 0, OMAP_INT_DMA_CH4 }, 5590 { 0, OMAP_INT_DMA_CH5 }, 5591 { 1, OMAP_INT_1610_DMA_CH6 }, 5592 { 1, OMAP_INT_1610_DMA_CH7 }, 5593 { 1, OMAP_INT_1610_DMA_CH8 }, 5594 { 1, OMAP_INT_1610_DMA_CH9 }, 5595 { 1, OMAP_INT_1610_DMA_CH10 }, 5596 { 1, OMAP_INT_1610_DMA_CH11 }, 5597 { 1, OMAP_INT_1610_DMA_CH12 }, 5598 { 1, OMAP_INT_1610_DMA_CH13 }, 5599 { 1, OMAP_INT_1610_DMA_CH14 }, 5600 { 1, OMAP_INT_1610_DMA_CH15 } 5601 }; 5602 4922 5603 struct omap_mpu_state_s *omap310_mpu_init(unsigned long sdram_size, 4923 5604 DisplayState *ds, const char *core) 4924 5605 { 5606 int i; 4925 5607 struct omap_mpu_state_s *s = (struct omap_mpu_state_s *) 4926 5608 qemu_mallocz(sizeof(struct omap_mpu_state_s)); 4927 5609 ram_addr_t imif_base, emiff_base; 4928 5610 qemu_irq *cpu_irq; 5611 qemu_irq dma_irqs[6]; 4929 5612 int sdindex; 4930 5613 … … 4965 5648 s->irq[1] = s->ih[1]->pins; 4966 5649 4967 s->dma = omap_dma_init(0xfffed800, s->irq[0], s, 4968 omap_findclk(s, "dma_ck")); 5650 for (i = 0; i < 6; i ++) 5651 dma_irqs[i] = s->irq[omap_dma_irq_map[i].ih][omap_dma_irq_map[i].intr]; 5652 s->dma = omap_dma_init(0xfffed800, dma_irqs, s->irq[0][OMAP_INT_DMA_LCD], 5653 s, omap_findclk(s, "dma_ck"), omap_dma_3_1); 5654 4969 5655 s->port[emiff ].addr_valid = omap_validate_emiff_addr; 4970 5656 s->port[emifs ].addr_valid = omap_validate_emifs_addr; -
trunk/src/host/qemu-neo1973/hw/omap.h
r3613 r3627 337 337 # define OMAP_INT_243X_CARKIT 94 338 338 339 enum omap_dma_model { 340 omap_dma_3_1 = 0, 341 omap_dma_3_2 342 }; 343 339 344 struct omap_dma_s; 340 struct omap_dma_s *omap_dma_init(target_phys_addr_t base, 341 qemu_irq pic[], struct omap_mpu_state_s *mpu, omap_clk clk); 345 struct omap_dma_s *omap_dma_init(target_phys_addr_t base, qemu_irq *irqs, 346 qemu_irq lcd_irq, struct omap_mpu_state_s *mpu, omap_clk clk, 347 enum omap_dma_model model); 342 348 343 349 enum omap_dma_port { 344 350 emiff = 0, 345 351 emifs, 346 imif, 352 imif, /* omap16xx: ocp_t1 */ 347 353 tipb, 348 local, 354 local, /* omap16xx: ocp_t2 */ 349 355 tipb_mpui, 350 356 omap_dma_port_last, 351 357 }; 358 359 typedef enum { 360 constant = 0, 361 post_incremented, 362 single_index, 363 double_index, 364 } omap_dma_addressing_t; 352 365 353 366 struct omap_dma_lcd_channel_s { … … 357 370 target_phys_addr_t src_f2_top; 358 371 target_phys_addr_t src_f2_bottom; 372 373 /* Used in OMAP DMA 3.2 gigacell */ 374 unsigned char brust_f1; 375 unsigned char pack_f1; 376 unsigned char data_type_f1; 377 unsigned char brust_f2; 378 unsigned char pack_f2; 379 unsigned char data_type_f2; 380 unsigned char end_prog; 381 unsigned char repeat; 382 unsigned char auto_init; 383 unsigned char priority; 384 unsigned char fs; 385 unsigned char running; 386 unsigned char bs; 387 unsigned char omap_3_1_compatible_disable; 388 unsigned char dst; 389 unsigned char lch_type; 390 int16_t element_index_f1; 391 int16_t element_index_f2; 392 int32_t frame_index_f1; 393 int32_t frame_index_f2; 394 uint16_t elements_f1; 395 uint16_t frames_f1; 396 uint16_t elements_f2; 397 uint16_t frames_f2; 398 omap_dma_addressing_t mode_f1; 399 omap_dma_addressing_t mode_f2; 400 359 401 /* Destination port is fixed. */ 360 402 int interrupts; -
trunk/src/host/qemu-neo1973/hw/pci.c
r3443 r3627 43 43 /* The bus IRQ state is the logical OR of the connected devices. 44 44 Keep a count of the number of devices with raised IRQs. */ 45 int nirq; 45 46 int irq_count[]; 46 47 }; … … 53 54 static PCIBus *first_bus; 54 55 56 static void pcibus_save(QEMUFile *f, void *opaque) 57 { 58 PCIBus *bus = (PCIBus *)opaque; 59 int i; 60 61 qemu_put_be32(f, bus->nirq); 62 for (i = 0; i < bus->nirq; i++) 63 qemu_put_be32(f, bus->irq_count[i]); 64 } 65 66 static int pcibus_load(QEMUFile *f, void *opaque, int version_id) 67 { 68 PCIBus *bus = (PCIBus *)opaque; 69 int i, nirq; 70 71 if (version_id != 1) 72 return -EINVAL; 73 74 nirq = qemu_get_be32(f); 75 if (bus->nirq != nirq) { 76 fprintf(stderr, "pcibus_load: nirq mismatch: src=%d dst=%d\n", 77 nirq, bus->nirq); 78 return -EINVAL; 79 } 80 81 for (i = 0; i < nirq; i++) 82 bus->irq_count[i] = qemu_get_be32(f); 83 84 return 0; 85 } 86 55 87 PCIBus *pci_register_bus(pci_set_irq_fn set_irq, pci_map_irq_fn map_irq, 56 88 qemu_irq *pic, int devfn_min, int nirq) 57 89 { 58 90 PCIBus *bus; 91 static int nbus = 0; 92 59 93 bus = qemu_mallocz(sizeof(PCIBus) + (nirq * sizeof(int))); 60 94 bus->set_irq = set_irq; … … 62 96 bus->irq_opaque = pic; 63 97 bus->devfn_min = devfn_min; 98 bus->nirq = nirq; 64 99 first_bus = bus; 100 register_savevm("PCIBUS", nbus++, 1, pcibus_save, pcibus_load, bus); 65 101 return bus; 66 102 } … … 84 120 void pci_device_save(PCIDevice *s, QEMUFile *f) 85 121 { 86 qemu_put_be32(f, 1); /* PCI device version */ 122 int i; 123 124 qemu_put_be32(f, 2); /* PCI device version */ 87 125 qemu_put_buffer(f, s->config, 256); 126 for (i = 0; i < 4; i++) 127 qemu_put_be32(f, s->irq_state[i]); 88 128 } 89 129 … … 91 131 { 92 132 uint32_t version_id; 133 int i; 134 93 135 version_id = qemu_get_be32(f); 94 if (version_id != 1)136 if (version_id > 2) 95 137 return -EINVAL; 96 138 qemu_get_buffer(f, s->config, 256); 97 139 pci_update_mappings(s); 140 141 if (version_id >= 2) 142 for (i = 0; i < 4; i ++) 143 s->irq_state[i] = qemu_get_be32(f); 144 98 145 return 0; 99 146 } -
trunk/src/host/qemu-neo1973/hw/pflash_cfi01.c
r3443 r3627 484 484 } 485 485 486 pflash_t *pflash_ register(target_phys_addr_t base, ram_addr_t off,487 BlockDriverState *bs,488 target_ulong sector_len,int nb_blocs, int width,489 uint16_t id0, uint16_t id1,490 uint16_t id2, uint16_t id3)486 pflash_t *pflash_cfi01_register(target_phys_addr_t base, ram_addr_t off, 487 BlockDriverState *bs, target_ulong sector_len, 488 int nb_blocs, int width, 489 uint16_t id0, uint16_t id1, 490 uint16_t id2, uint16_t id3) 491 491 { 492 492 pflash_t *pfl; -
trunk/src/host/qemu-neo1973/hw/pflash_cfi02.c
r3443 r3627 525 525 } 526 526 527 pflash_t *pflash_ register(target_phys_addr_t base, ram_addr_t off,528 BlockDriverState *bs,529 uint32_t sector_len,int nb_blocs, int width,530 uint16_t id0, uint16_t id1,531 uint16_t id2, uint16_t id3)527 pflash_t *pflash_cfi02_register(target_phys_addr_t base, ram_addr_t off, 528 BlockDriverState *bs, uint32_t sector_len, 529 int nb_blocs, int width, 530 uint16_t id0, uint16_t id1, 531 uint16_t id2, uint16_t id3) 532 532 { 533 533 pflash_t *pfl; -
trunk/src/host/qemu-neo1973/hw/piix_pci.c
r3443 r3627 58 58 static uint32_t isa_page_descs[384 / 4]; 59 59 static uint8_t smm_enabled; 60 static int pci_irq_levels[4]; 60 61 61 62 static void update_pam(PCIDevice *d, uint32_t start, uint32_t end, int r) … … 140 141 { 141 142 PCIDevice *d = opaque; 143 int i; 144 142 145 pci_device_save(d, f); 143 146 qemu_put_8s(f, &smm_enabled); 147 148 for (i = 0; i < 4; i++) 149 qemu_put_be32(f, pci_irq_levels[i]); 144 150 } 145 151 … … 147 153 { 148 154 PCIDevice *d = opaque; 149 int ret ;150 151 if (version_id != 1)155 int ret, i; 156 157 if (version_id > 2) 152 158 return -EINVAL; 153 159 ret = pci_device_load(d, f); … … 156 162 i440fx_update_memory_mappings(d); 157 163 qemu_get_8s(f, &smm_enabled); 164 165 if (version_id >= 2) 166 for (i = 0; i < 4; i++) 167 pci_irq_levels[i] = qemu_get_be32(f); 168 158 169 return 0; 159 170 } … … 193 204 d->config[0x72] = 0x02; /* SMRAM */ 194 205 195 register_savevm("I440FX", 0, 1, i440fx_save, i440fx_load, d);206 register_savevm("I440FX", 0, 2, i440fx_save, i440fx_load, d); 196 207 *pi440fx_state = d; 197 208 return b; … … 205 216 /* just used for simpler irq handling. */ 206 217 #define PCI_IRQ_WORDS ((PCI_DEVICES_MAX + 31) / 32) 207 208 static int pci_irq_levels[4];209 218 210 219 static void piix3_set_irq(qemu_irq *pic, int irq_num, int level) … … 315 324 } 316 325 317 static int piix_init(PCIBus *bus, int devfn)318 {319 PCIDevice *d;320 uint8_t *pci_conf;321 322 d = pci_register_device(bus, "PIIX", sizeof(PCIDevice),323 devfn, NULL, NULL);324 register_savevm("PIIX", 0, 2, piix_save, piix_load, d);325 326 piix3_dev = d;327 pci_conf = d->config;328 329 pci_conf[0x00] = 0x86; // Intel330 pci_conf[0x01] = 0x80;331 pci_conf[0x02] = 0x2E; // 82371FB PIIX PCI-to-ISA bridge332 pci_conf[0x03] = 0x12;333 pci_conf[0x08] = 0x02; // Step A1334 pci_conf[0x0a] = 0x01; // class_sub = PCI_ISA335 pci_conf[0x0b] = 0x06; // class_base = PCI_bridge336 pci_conf[0x0e] = 0x80; // header_type = PCI_multifunction, generic337 338 piix3_reset(d);339 return d->devfn;340 }341 342 326 int piix3_init(PCIBus *bus, int devfn) 343 327 { -
trunk/src/host/qemu-neo1973/hw/ppc405_boards.c
r3555 r3627 235 235 bdrv_get_device_name(drives_table[index].bdrv), fl_sectors); 236 236 #endif 237 pflash_ register((uint32_t)(-bios_size), bios_offset,238 drives_table[index].bdrv, 65536, fl_sectors, 2,239 0x0001, 0x22DA, 0x0000, 0x0000);237 pflash_cfi02_register((uint32_t)(-bios_size), bios_offset, 238 drives_table[index].bdrv, 65536, fl_sectors, 2, 239 0x0001, 0x22DA, 0x0000, 0x0000); 240 240 fl_idx++; 241 241 } else … … 552 552 bdrv_get_device_name(drives_table[index].bdrv), fl_sectors); 553 553 #endif 554 pflash_ register((uint32_t)(-bios_size), bios_offset,555 drives_table[index].bdrv, 65536, fl_sectors, 4,556 0x0001, 0x22DA, 0x0000, 0x0000);554 pflash_cfi02_register((uint32_t)(-bios_size), bios_offset, 555 drives_table[index].bdrv, 65536, fl_sectors, 4, 556 0x0001, 0x22DA, 0x0000, 0x0000); 557 557 fl_idx++; 558 558 } else … … 588 588 bdrv_get_device_name(drives_table[index].bdrv)); 589 589 #endif 590 pflash_ register(0xfc000000, bios_offset, drives_table[index].bdrv,591 65536, fl_sectors, 4,592 0x0001, 0x22DA, 0x0000, 0x0000);590 pflash_cfi02_register(0xfc000000, bios_offset, 591 drives_table[index].bdrv, 65536, fl_sectors, 4, 592 0x0001, 0x22DA, 0x0000, 0x0000); 593 593 fl_idx++; 594 594 } -
trunk/src/host/qemu-neo1973/hw/scsi-disk.c
r3443 r3627 38 38 39 39 typedef struct SCSIRequest { 40 SCSIDevice *dev;40 SCSIDeviceState *dev; 41 41 uint32_t tag; 42 42 /* ??? We should probably keep track of whether the data trasfer is … … 52 52 } SCSIRequest; 53 53 54 struct SCSIDevice 54 struct SCSIDeviceState 55 55 { 56 56 BlockDriverState *bdrv; … … 70 70 static SCSIRequest *free_requests = NULL; 71 71 72 static SCSIRequest *scsi_new_request(SCSIDevice *s, uint32_t tag)72 static SCSIRequest *scsi_new_request(SCSIDeviceState *s, uint32_t tag) 73 73 { 74 74 SCSIRequest *r; … … 94 94 { 95 95 SCSIRequest *last; 96 SCSIDevice *s = r->dev;96 SCSIDeviceState *s = r->dev; 97 97 98 98 if (s->requests == r) { … … 112 112 } 113 113 114 static SCSIRequest *scsi_find_request(SCSIDevice *s, uint32_t tag)114 static SCSIRequest *scsi_find_request(SCSIDeviceState *s, uint32_t tag) 115 115 { 116 116 SCSIRequest *r; … … 126 126 static void scsi_command_complete(SCSIRequest *r, int sense) 127 127 { 128 SCSIDevice *s = r->dev;128 SCSIDeviceState *s = r->dev; 129 129 uint32_t tag; 130 130 DPRINTF("Command complete tag=0x%x sense=%d\n", r->tag, sense); … … 136 136 137 137 /* Cancel a pending data transfer. */ 138 void scsi_cancel_io(SCSIDevice *s, uint32_t tag) 139 { 138 static void scsi_cancel_io(SCSIDevice *d, uint32_t tag) 139 { 140 SCSIDeviceState *s = d->state; 140 141 SCSIRequest *r; 141 142 DPRINTF("Cancel tag=0x%x\n", tag); … … 152 153 { 153 154 SCSIRequest *r = (SCSIRequest *)opaque; 154 SCSIDevice *s = r->dev;155 SCSIDeviceState *s = r->dev; 155 156 156 157 if (ret) { … … 165 166 166 167 /* Read more data from scsi device into buffer. */ 167 void scsi_read_data(SCSIDevice *s, uint32_t tag) 168 { 168 static void scsi_read_data(SCSIDevice *d, uint32_t tag) 169 { 170 SCSIDeviceState *s = d->state; 169 171 SCSIRequest *r; 170 172 uint32_t n; … … 205 207 { 206 208 SCSIRequest *r = (SCSIRequest *)opaque; 207 SCSIDevice *s = r->dev;209 SCSIDeviceState *s = r->dev; 208 210 uint32_t len; 209 211 … … 229 231 /* Write data to a scsi device. Returns nonzero on failure. 230 232 The transfer may complete asynchronously. */ 231 int scsi_write_data(SCSIDevice *s, uint32_t tag) 232 { 233 static int scsi_write_data(SCSIDevice *d, uint32_t tag) 234 { 235 SCSIDeviceState *s = d->state; 233 236 SCSIRequest *r; 234 237 uint32_t n; … … 260 263 261 264 /* Return a pointer to the data buffer. */ 262 uint8_t *scsi_get_buf(SCSIDevice *s, uint32_t tag) 263 { 265 static uint8_t *scsi_get_buf(SCSIDevice *d, uint32_t tag) 266 { 267 SCSIDeviceState *s = d->state; 264 268 SCSIRequest *r; 265 269 … … 277 281 and zero if the command does not transfer any data. */ 278 282 279 int32_t scsi_send_command(SCSIDevice *s, uint32_t tag, uint8_t *buf, int lun) 280 { 283 static int32_t scsi_send_command(SCSIDevice *d, uint32_t tag, 284 uint8_t *buf, int lun) 285 { 286 SCSIDeviceState *s = d->state; 281 287 int64_t nb_sectors; 282 288 uint32_t lba; … … 292 298 if (r) { 293 299 BADF("Tag 0x%x already in use\n", tag); 294 scsi_cancel_io( s, tag);300 scsi_cancel_io(d, tag); 295 301 } 296 302 /* ??? Tags are not unique for different luns. We only implement a … … 577 583 } 578 584 579 void scsi_disk_destroy(SCSIDevice *s)580 { 581 qemu_free( s);582 } 583 584 SCSIDevice *scsi_disk_init(BlockDriverState *bdrv, 585 int tcq,586 scsi_completionfn completion, 587 void *opaque) 588 { 589 SCSIDevice *s;590 591 s = (SCSIDevice *)qemu_mallocz(sizeof(SCSIDevice));585 static void scsi_destroy(SCSIDevice *d) 586 { 587 qemu_free(d->state); 588 qemu_free(d); 589 } 590 591 SCSIDevice *scsi_disk_init(BlockDriverState *bdrv, int tcq, 592 scsi_completionfn completion, void *opaque) 593 { 594 SCSIDevice *d; 595 SCSIDeviceState *s; 596 597 s = (SCSIDeviceState *)qemu_mallocz(sizeof(SCSIDeviceState)); 592 598 s->bdrv = bdrv; 593 599 s->tcq = tcq; … … 600 606 } 601 607 602 return s; 603 } 604 608 d = (SCSIDevice *)qemu_mallocz(sizeof(SCSIDevice)); 609 d->state = s; 610 d->destroy = scsi_destroy; 611 d->send_command = scsi_send_command; 612 d->read_data = scsi_read_data; 613 d->write_data = scsi_write_data; 614 d->cancel_io = scsi_cancel_io; 615 d->get_buf = scsi_get_buf; 616 617 return d; 618 } -
trunk/src/host/qemu-neo1973/hw/scsi-disk.h
r3443 r3627 8 8 }; 9 9 10 typedef struct SCSIDeviceState SCSIDeviceState; 10 11 typedef struct SCSIDevice SCSIDevice; 11 12 typedef void (*scsi_completionfn)(void *opaque, int reason, uint32_t tag, 12 13 uint32_t arg); 13 14 14 SCSIDevice *scsi_disk_init(BlockDriverState *bdrv, 15 int tcq, 16 scsi_completionfn completion, 17 void *opaque); 18 void scsi_disk_destroy(SCSIDevice *s); 15 struct SCSIDevice 16 { 17 SCSIDeviceState *state; 18 void (*destroy)(SCSIDevice *s); 19 int32_t (*send_command)(SCSIDevice *s, uint32_t tag, uint8_t *buf, 20 int lun); 21 void (*read_data)(SCSIDevice *s, uint32_t tag); 22 int (*write_data)(SCSIDevice *s, uint32_t tag); 23 void (*cancel_io)(SCSIDevice *s, uint32_t tag); 24 uint8_t *(*get_buf)(SCSIDevice *s, uint32_t tag); 25 }; 19 26 20 int32_t scsi_send_command(SCSIDevice *s, uint32_t tag, uint8_t *buf, int lun); 21 /* SCSI data transfers are asynchrnonous. However, unlike the block IO 22 layer the completion routine may be called directly by 23 scsi_{read,write}_data. */ 24 void scsi_read_data(SCSIDevice *s, uint32_t tag); 25 int scsi_write_data(SCSIDevice *s, uint32_t tag); 26 void scsi_cancel_io(SCSIDevice *s, uint32_t tag); 27 uint8_t *scsi_get_buf(SCSIDevice *s, uint32_t tag); 27 SCSIDevice *scsi_disk_init(BlockDriverState *bdrv, int tcq, 28 scsi_completionfn completion, void *opaque); 28 29 29 30 /* cdrom.c */ -
trunk/src/host/qemu-neo1973/hw/sun4m.c
r3613 r3627 73 73 target_phys_addr_t dma_base, esp_base, le_base; 74 74 target_phys_addr_t tcx_base, cs_base, power_base; 75 target_phys_addr_t ecc_base; 76 uint32_t ecc_version; 75 77 long vram_size, nvram_size; 76 78 // IRQ numbers are not PIL ones, but master interrupt controller register … … 480 482 boot_device, RAM_size, kernel_size, graphic_width, 481 483 graphic_height, graphic_depth, hwdef->machine_id); 484 485 if (hwdef->ecc_base != (target_phys_addr_t)-1) 486 ecc_init(hwdef->ecc_base, hwdef->ecc_version); 482 487 } 483 488 … … 499 504 .le_base = 0x78c00000, 500 505 .power_base = 0x7a000000, 506 .ecc_base = -1, 501 507 .vram_size = 0x00100000, 502 508 .nvram_size = 0x2000, … … 535 541 .le_base = 0xef0c00000ULL, 536 542 .power_base = 0xefa000000ULL, 543 .ecc_base = 0xf00000000ULL, 544 .ecc_version = 0x10000000, // version 0, implementation 1 537 545 .vram_size = 0x00100000, 538 546 .nvram_size = 0x2000, … … 571 579 .le_base = 0xef0060000ULL, 572 580 .power_base = 0xefa000000ULL, 581 .ecc_base = 0xf00000000ULL, 582 .ecc_version = 0x00000000, // version 0, implementation 0 573 583 .vram_size = 0x00100000, 574 584 .nvram_size = 0x2000, -
trunk/src/host/qemu-neo1973/hw/sun4m.h
r3613 r3627 73 73 qemu_irq irq, qemu_irq *reset); 74 74 75 /* eccmemctl.c */ 76 void *ecc_init(target_phys_addr_t base, uint32_t version); 77 75 78 #endif -
trunk/src/host/qemu-neo1973/hw/usb-msd.c
r3443 r3627 150 150 if (s->scsi_len == 0) { 151 151 if (s->mode == USB_MSDM_DATAIN) { 152 s csi_read_data(s->scsi_dev, s->tag);152 s->scsi_dev->read_data(s->scsi_dev, s->tag); 153 153 } else if (s->mode == USB_MSDM_DATAOUT) { 154 s csi_write_data(s->scsi_dev, s->tag);154 s->scsi_dev->write_data(s->scsi_dev, s->tag); 155 155 } 156 156 } … … 205 205 } 206 206 s->scsi_len = arg; 207 s->scsi_buf = s csi_get_buf(s->scsi_dev, tag);207 s->scsi_buf = s->scsi_dev->get_buf(s->scsi_dev, tag); 208 208 if (p) { 209 209 usb_msd_copy_data(s); … … 343 343 { 344 344 MSDState *s = opaque; 345 s csi_cancel_io(s->scsi_dev, s->tag);345 s->scsi_dev->cancel_io(s->scsi_dev, s->tag); 346 346 s->packet = NULL; 347 347 s->scsi_len = 0; … … 391 391 s->tag, cbw.flags, cbw.cmd_len, s->data_len); 392 392 s->residue = 0; 393 s csi_send_command(s->scsi_dev, s->tag, cbw.cmd, 0);393 s->scsi_dev->send_command(s->scsi_dev, s->tag, cbw.cmd, 0); 394 394 /* ??? Should check that USB and SCSI data transfer 395 395 directions match. */ 396 396 if (s->residue == 0) { 397 397 if (s->mode == USB_MSDM_DATAIN) { 398 s csi_read_data(s->scsi_dev, s->tag);398 s->scsi_dev->read_data(s->scsi_dev, s->tag); 399 399 } else if (s->mode == USB_MSDM_DATAOUT) { 400 s csi_write_data(s->scsi_dev, s->tag);400 s->scsi_dev->write_data(s->scsi_dev, s->tag); 401 401 } 402 402 } … … 509 509 MSDState *s = (MSDState *)dev; 510 510 511 s csi_disk_destroy(s->scsi_dev);511 s->scsi_dev->destroy(s->scsi_dev); 512 512 bdrv_delete(s->bs); 513 513 qemu_free(s); -
trunk/src/host/qemu-neo1973/linux-user/ppc/syscall.h
r3303 r3627 27 27 28 28 struct target_pt_regs { 29 unsigned long gpr[32]; 30 unsigned long nip; 31 unsigned long msr; 32 unsigned long orig_gpr3; /* Used for restarting system calls */ 33 unsigned long ctr; 34 unsigned long link; 35 unsigned long xer; 36 unsigned long ccr; 37 unsigned long mq; /* 601 only (not used at present) */ 29 abi_ulong gpr[32]; 30 abi_ulong nip; 31 abi_ulong msr; 32 abi_ulong orig_gpr3; /* Used for restarting system calls */ 33 abi_ulong ctr; 34 abi_ulong link; 35 abi_ulong xer; 36 abi_ulong ccr; 37 #if defined(TARGET_PPC64) && !defined(TARGET_ABI32) 38 abi_ulong softe; 39 #else 40 abi_ulong mq; /* 601 only (not used at present) */ 41 #endif 38 42 /* Used on APUS to hold IPL value. */ 39 unsignedlong trap; /* Reason for being here */40 unsignedlong dar; /* Fault registers */41 unsignedlong dsisr;42 unsignedlong result; /* Result of a system call */43 abi_ulong trap; /* Reason for being here */ 44 abi_ulong dar; /* Fault registers */ 45 abi_ulong dsisr; 46 abi_ulong result; /* Result of a system call */ 43 47 }; 44 48 -
trunk/src/host/qemu-neo1973/linux-user/ppc/target_signal.h
r3303 r3627 8 8 typedef struct target_sigaltstack { 9 9 abi_ulong ss_sp; 10 abi_longss_flags;10 int ss_flags; 11 11 abi_ulong ss_size; 12 12 } target_stack_t; -
trunk/src/host/qemu-neo1973/linux-user/socket.h
r1640 r3627 110 110 #define TARGET_SO_BSDCOMPAT 14 111 111 /* To add :#define TARGET_SO_REUSEPORT 15 */ 112 #if defined(TARGET_PPC) 113 #define TARGET_SO_RCVLOWAT 16 114 #define TARGET_SO_SNDLOWAT 17 115 #define TARGET_SO_RCVTIMEO 18 116 #define TARGET_SO_SNDTIMEO 19 117 #define TARGET_SO_PASSCRED 20 118 #define TARGET_SO_PEERCRED 21 119 #else 112 120 #define TARGET_SO_PASSCRED 16 113 121 #define TARGET_SO_PEERCRED 17 … … 116 124 #define TARGET_SO_RCVTIMEO 20 117 125 #define TARGET_SO_SNDTIMEO 21 126 #endif 118 127 119 128 /* Security levels - as per NRL IPv6 - don't actually do anything */ -
trunk/src/host/qemu-neo1973/linux-user/syscall.c
r3555 r3627 444 444 } 445 445 446 static inline fd_set *target_to_host_fds(fd_set *fds, 447 abi_long *target_fds, int n) 448 { 449 #if !defined(BSWAP_NEEDED) && !defined(WORDS_BIGENDIAN) 450 return (fd_set *)target_fds; 451 #else 452 int i, b; 453 if (target_fds) { 454 FD_ZERO(fds); 455 for(i = 0;i < n; i++) { 456 b = (tswapl(target_fds[i / TARGET_ABI_BITS]) >> 457 (i & (TARGET_ABI_BITS - 1))) & 1; 458 if (b) 459 FD_SET(i, fds); 460 } 461 return fds; 462 } else { 463 return NULL; 446 static inline abi_long copy_from_user_fdset(fd_set *fds, 447 abi_ulong target_fds_addr, 448 int n) 449 { 450 int i, nw, j, k; 451 abi_ulong b, *target_fds; 452 453 nw = (n + TARGET_ABI_BITS - 1) / TARGET_ABI_BITS; 454 if (!(target_fds = lock_user(VERIFY_READ, 455 target_fds_addr, 456 sizeof(abi_ulong) * nw, 457 1))) 458 return -TARGET_EFAULT; 459 460 FD_ZERO(fds); 461 k = 0; 462 for (i = 0; i < nw; i++) { 463 /* grab the abi_ulong */ 464 __get_user(b, &target_fds[i]); 465 for (j = 0; j < TARGET_ABI_BITS; j++) { 466 /* check the bit inside the abi_ulong */ 467 if ((b >> j) & 1) 468 FD_SET(k, fds); 469 k++; 470 } 464 471 } 465 #endif 466 } 467 468 static inline void host_to_target_fds(abi_long *target_fds, 469 fd_set *fds, int n) 470 { 471 #if !defined(BSWAP_NEEDED) && !defined(WORDS_BIGENDIAN) 472 /* nothing to do */ 473 #else 472 473 unlock_user(target_fds, target_fds_addr, 0); 474 475 return 0; 476 } 477 478 static inline abi_long copy_to_user_fdset(abi_ulong target_fds_addr, 479 const fd_set *fds, 480 int n) 481 { 474 482 int i, nw, j, k; 475 483 abi_long v; 476 477 if (target_fds) { 478 nw = (n + TARGET_ABI_BITS - 1) / TARGET_ABI_BITS; 479 k = 0; 480 for(i = 0;i < nw; i++) { 481 v = 0; 482 for(j = 0; j < TARGET_ABI_BITS; j++) { 483 v |= ((FD_ISSET(k, fds) != 0) << j); 484 k++; 485 } 486 target_fds[i] = tswapl(v); 487 } 484 abi_ulong *target_fds; 485 486 nw = (n + TARGET_ABI_BITS - 1) / TARGET_ABI_BITS; 487 if (!(target_fds = lock_user(VERIFY_WRITE, 488 target_fds_addr, 489 sizeof(abi_ulong) * nw, 490 0))) 491 return -TARGET_EFAULT; 492 493 k = 0; 494 for (i = 0; i < nw; i++) { 495 v = 0; 496 for (j = 0; j < TARGET_ABI_BITS; j++) { 497 v |= ((FD_ISSET(k, fds) != 0) << j); 498 k++; 499 } 500 __put_user(v, &target_fds[i]); 488 501 } 489 #endif 502 503 unlock_user(target_fds, target_fds_addr, sizeof(abi_ulong) * nw); 504 505 return 0; 490 506 } 491 507 … … 535 551 } 536 552 537 static inline abi_long target_to_host_timeval(struct timeval *tv,538 abi_ulong target_ addr)553 static inline abi_long copy_from_user_timeval(struct timeval *tv, 554 abi_ulong target_tv_addr) 539 555 { 540 556 struct target_timeval *target_tv; 541 557 542 if (!lock_user_struct(VERIFY_READ, target_tv, target_ addr, 1))558 if (!lock_user_struct(VERIFY_READ, target_tv, target_tv_addr, 1)) 543 559 return -TARGET_EFAULT; 544 tv->tv_sec = tswapl(target_tv->tv_sec); 545 tv->tv_usec = tswapl(target_tv->tv_usec); 546 unlock_user_struct(target_tv, target_addr, 0); 560 561 __get_user(tv->tv_sec, &target_tv->tv_sec); 562 __get_user(tv->tv_usec, &target_tv->tv_usec); 563 564 unlock_user_struct(target_tv, target_tv_addr, 0); 547 565 548 566 return 0; 549 567 } 550 568 551 static inline abi_long host_to_target_timeval(abi_ulong target_addr,552 const struct timeval *tv)569 static inline abi_long copy_to_user_timeval(abi_ulong target_tv_addr, 570 const struct timeval *tv) 553 571 { 554 572 struct target_timeval *target_tv; 555 573 556 if (!lock_user_struct(VERIFY_WRITE, target_tv, target_ addr, 0))574 if (!lock_user_struct(VERIFY_WRITE, target_tv, target_tv_addr, 0)) 557 575 return -TARGET_EFAULT; 558 target_tv->tv_sec = tswapl(tv->tv_sec); 559 target_tv->tv_usec = tswapl(tv->tv_usec); 560 unlock_user_struct(target_tv, target_addr, 1); 576 577 __put_user(tv->tv_sec, &target_tv->tv_sec); 578 __put_user(tv->tv_usec, &target_tv->tv_usec); 579 580 unlock_user_struct(target_tv, target_tv_addr, 1); 561 581 562 582 return 0; … … 566 586 /* do_select() must return target values and target errnos. */ 567 587 static abi_long do_select(int n, 568 abi_ulong rfd_ p, abi_ulong wfd_p,569 abi_ulong efd_ p, abi_ulong target_tv)588 abi_ulong rfd_addr, abi_ulong wfd_addr, 589 abi_ulong efd_addr, abi_ulong target_tv_addr) 570 590 { 571 591 fd_set rfds, wfds, efds; 572 592 fd_set *rfds_ptr, *wfds_ptr, *efds_ptr; 573 abi_long *target_rfds, *target_wfds, *target_efds;574 593 struct timeval tv, *tv_ptr; 575 594 abi_long ret; 576 int ok; 577 578 if (rfd_p) { 579 target_rfds = lock_user(VERIFY_WRITE, rfd_p, sizeof(abi_long) * n, 1); 580 if (!target_rfds) { 581 ret = -TARGET_EFAULT; 582 goto end; 583 } 584 rfds_ptr = target_to_host_fds(&rfds, target_rfds, n); 595 596 if (rfd_addr) { 597 if (copy_from_user_fdset(&rfds, rfd_addr, n)) 598 return -TARGET_EFAULT; 599 rfds_ptr = &rfds; 585 600 } else { 586 target_rfds = NULL;587 601 rfds_ptr = NULL; 588 602 } 589 if (wfd_p) { 590 target_wfds = lock_user(VERIFY_WRITE, wfd_p, sizeof(abi_long) * n, 1); 591 if (!target_wfds) { 592 ret = -TARGET_EFAULT; 593 goto end; 594 } 595 wfds_ptr = target_to_host_fds(&wfds, target_wfds, n); 603 if (wfd_addr) { 604 if (copy_from_user_fdset(&wfds, wfd_addr, n)) 605 return -TARGET_EFAULT; 606 wfds_ptr = &wfds; 596 607 } else { 597 target_wfds = NULL;598 608 wfds_ptr = NULL; 599 609 } 600 if (efd_p) { 601 target_efds = lock_user(VERIFY_WRITE, efd_p, sizeof(abi_long) * n, 1); 602 if (!target_efds) { 603 ret = -TARGET_EFAULT; 604 goto end; 605 } 606 efds_ptr = target_to_host_fds(&efds, target_efds, n); 610 if (efd_addr) { 611 if (copy_from_user_fdset(&efds, efd_addr, n)) 612 return -TARGET_EFAULT; 613 efds_ptr = &efds; 607 614 } else { 608 target_efds = NULL;609 615 efds_ptr = NULL; 610 616 } 611 617 612 if (target_tv) { 613 target_to_host_timeval(&tv, target_tv); 618 if (target_tv_addr) { 619 if (copy_from_user_timeval(&tv, target_tv_addr)) 620 return -TARGET_EFAULT; 614 621 tv_ptr = &tv; 615 622 } else { 616 623 tv_ptr = NULL; 617 624 } 625 618 626 ret = get_errno(select(n, rfds_ptr, wfds_ptr, efds_ptr, tv_ptr)); 619 ok = !is_error(ret); 620 621 if (ok) { 622 host_to_target_fds(target_rfds, rfds_ptr, n); 623 host_to_target_fds(target_wfds, wfds_ptr, n); 624 host_to_target_fds(target_efds, efds_ptr, n); 625 626 if (target_tv) { 627 host_to_target_timeval(target_tv, &tv); 628 } 627 628 if (!is_error(ret)) { 629 if (rfd_addr && copy_to_user_fdset(rfd_addr, &rfds, n)) 630 return -TARGET_EFAULT; 631 if (wfd_addr && copy_to_user_fdset(wfd_addr, &wfds, n)) 632 return -TARGET_EFAULT; 633 if (efd_addr && copy_to_user_fdset(efd_addr, &efds, n)) 634 return -TARGET_EFAULT; 635 636 if (target_tv_addr && copy_to_user_timeval(target_tv_addr, &tv)) 637 return -TARGET_EFAULT; 629 638 } 630 631 end:632 unlock_user(target_rfds, rfd_p, ok ? sizeof(abi_long) * n : 0);633 unlock_user(target_wfds, wfd_p, ok ? sizeof(abi_long) * n : 0);634 unlock_user(target_efds, efd_p, ok ? sizeof(abi_long) * n : 0);635 639 636 640 return ret; … … 3187 3191 argc = 0; 3188 3192 guest_argp = arg2; 3189 for (gp = guest_argp; ; gp ++) {3193 for (gp = guest_argp; ; gp += sizeof(abi_ulong)) { 3190 3194 if (get_user_ual(addr, gp)) 3191 3195 goto efault; … … 3196 3200 envc = 0; 3197 3201 guest_envp = arg3; 3198 for (gp = guest_envp; ; gp ++) {3202 for (gp = guest_envp; ; gp += sizeof(abi_ulong)) { 3199 3203 if (get_user_ual(addr, gp)) 3200 3204 goto efault; … … 3392 3396 struct timeval *tvp, tv[2]; 3393 3397 if (arg2) { 3394 target_to_host_timeval(&tv[0], arg2); 3395 target_to_host_timeval(&tv[1], 3396 arg2 + sizeof (struct target_timeval)); 3398 if (copy_from_user_timeval(&tv[0], arg2) 3399 || copy_from_user_timeval(&tv[1], 3400 arg2 + sizeof(struct target_timeval))) 3401 goto efault; 3397 3402 tvp = tv; 3398 3403 } else { … … 3933 3938 ret = get_errno(gettimeofday(&tv, NULL)); 3934 3939 if (!is_error(ret)) { 3935 host_to_target_timeval(arg1, &tv); 3940 if (copy_to_user_timeval(arg1, &tv)) 3941 goto efault; 3936 3942 } 3937 3943 } … … 3940 3946 { 3941 3947 struct timeval tv; 3942 target_to_host_timeval(&tv, arg1); 3948 if (copy_from_user_timeval(&tv, arg1)) 3949 goto efault; 3943 3950 ret = get_errno(settimeofday(&tv, NULL)); 3944 3951 } … … 4315 4322 if (arg2) { 4316 4323 pvalue = &value; 4317 target_to_host_timeval(&pvalue->it_interval,4318 arg2);4319 target_to_host_timeval(&pvalue->it_value,4320 arg2 + sizeof(struct target_timeval));4324 if (copy_from_user_timeval(&pvalue->it_interval, arg2) 4325 || copy_from_user_timeval(&pvalue->it_value, 4326 arg2 + sizeof(struct target_timeval))) 4327 goto efault; 4321 4328 } else { 4322 4329 pvalue = NULL; … … 4324 4331 ret = get_errno(setitimer(arg1, pvalue, &ovalue)); 4325 4332 if (!is_error(ret) && arg3) { 4326 host_to_target_timeval(arg3, 4327 &ovalue.it_interval); 4328 host_to_target_timeval(arg3 + sizeof(struct target_timeval), 4329 &ovalue.it_value); 4333 if (copy_to_user_timeval(arg3, 4334 &ovalue.it_interval) 4335 || copy_to_user_timeval(arg3 + sizeof(struct target_timeval), 4336 &ovalue.it_value)) 4337 goto efault; 4330 4338 } 4331 4339 } … … 4337 4345 ret = get_errno(getitimer(arg1, &value)); 4338 4346 if (!is_error(ret) && arg2) { 4339 host_to_target_timeval(arg2, 4340 &value.it_interval); 4341 host_to_target_timeval(arg2 + sizeof(struct target_timeval), 4342 &value.it_value); 4347 if (copy_to_user_timeval(arg2, 4348 &value.it_interval) 4349 || copy_to_user_timeval(arg2 + sizeof(struct target_timeval), 4350 &value.it_value)) 4351 goto efault; 4343 4352 } 4344 4353 } -
trunk/src/host/qemu-neo1973/linux-user/syscall_defs.h
r3517 r3627 1087 1087 1088 1088 struct target_stat { 1089 unsigned shortst_dev;1089 abi_ulong st_dev; 1090 1090 abi_ulong st_ino; 1091 1091 #if defined(TARGET_PPC64) && !defined(TARGET_ABI32) 1092 unsigned shortst_nlink;1092 abi_ulong st_nlink; 1093 1093 unsigned int st_mode; 1094 1094 #else … … 1098 1098 unsigned int st_uid; 1099 1099 unsigned int st_gid; 1100 unsigned shortst_rdev;1100 abi_ulong st_rdev; 1101 1101 abi_ulong st_size; 1102 1102 abi_ulong st_blksize; 1103 1103 abi_ulong st_blocks; 1104 1104 abi_ulong target_st_atime; 1105 abi_ulong __unused1;1105 abi_ulong target_st_atime_nsec; 1106 1106 abi_ulong target_st_mtime; 1107 abi_ulong __unused2;1107 abi_ulong target_st_mtime_nsec; 1108 1108 abi_ulong target_st_ctime; 1109 abi_ulong __unused3;1109 abi_ulong target_st_ctime_nsec; 1110 1110 abi_ulong __unused4; 1111 1111 abi_ulong __unused5; … … 1123 1123 unsigned int st_gid; 1124 1124 unsigned long long st_rdev; 1125 long long pad0; 1126 long long st_size; 1127 abi_ulong st_blksize; 1128 abi_ulong pad1; 1129 long long st_blocks; /* Number 512-byte blocks allocated. */ 1130 abi_ulong target_st_atime; 1131 abi_ulong target_st_atime_nsec; 1132 abi_ulong target_st_mtime; 1133 abi_ulong target_st_mtime_nsec; 1134 abi_ulong target_st_ctime; 1135 abi_ulong target_st_ctime_nsec; 1136 abi_ulong __unused4; 1137 abi_ulong __unused5; 1125 unsigned short pad0; 1126 long long st_size; 1127 int st_blksize; 1128 long long st_blocks; /* Number 512-byte blocks allocated. */ 1129 int target_st_atime; 1130 unsigned int target_st_atime_nsec; 1131 int target_st_mtime; 1132 unsigned int target_st_mtime_nsec; 1133 int target_st_ctime; 1134 unsigned int target_st_ctime_nsec; 1135 unsigned int __unused4; 1136 unsigned int __unused5; 1138 1137 }; 1139 1138 -
trunk/src/host/qemu-neo1973/target-arm/helper.c
r3517 r3627 188 188 return NULL; 189 189 cpu_exec_init(env); 190 env->cpu_model_str = cpu_model; 190 191 env->cp15.c0_cpuid = id; 191 192 cpu_reset(env); -
trunk/src/host/qemu-neo1973/target-i386/exec.h
r3406 r3627 200 200 void helper_sysret(int dflag); 201 201 void helper_rdtsc(void); 202 void helper_rdpmc(void); 202 203 void helper_rdmsr(void); 203 204 void helper_wrmsr(void); -
trunk/src/host/qemu-neo1973/target-i386/helper.c
r3443 r3627 2744 2744 } 2745 2745 2746 void helper_rdpmc(void) 2747 { 2748 if ((env->cr[4] & CR4_PCE_MASK) && ((env->hflags & HF_CPL_MASK) != 0)) { 2749 raise_exception(EXCP0D_GPF); 2750 } 2751 2752 if (!svm_check_intercept_param(SVM_EXIT_RDPMC, 0)) { 2753 /* currently unimplemented */ 2754 raise_exception_err(EXCP06_ILLOP, 0); 2755 } 2756 } 2757 2746 2758 #if defined(CONFIG_USER_ONLY) 2747 2759 void helper_wrmsr(void) … … 4251 4263 uint16_t port = (uint16_t) (param >> 16); 4252 4264 4253 if(ldub_phys(addr + port / 8) & (1 << (port % 8))) 4265 uint16_t mask = (1 << ((param >> 4) & 7)) - 1; 4266 if(lduw_phys(addr + port / 8) & (mask << (port & 7))) 4254 4267 vmexit(type, param); 4255 4268 } -
trunk/src/host/qemu-neo1973/target-i386/helper2.c
r3517 r3627 100 100 return NULL; 101 101 cpu_exec_init(env); 102 env->cpu_model_str = cpu_model; 102 103 103 104 /* init various static tables */ … … 256 257 x86_cpu_def->stepping = stepping; 257 258 } else { 258 fprintf(stderr, "unre gnized feature %s\n", featurestr);259 fprintf(stderr, "unrecognized feature %s\n", featurestr); 259 260 x86_cpu_def = 0; 260 261 goto error; -
trunk/src/host/qemu-neo1973/target-i386/op.c
r3303 r3627 954 954 } 955 955 956 void OPPROTO op_rdpmc(void) 957 { 958 helper_rdpmc(); 959 } 960 956 961 void OPPROTO op_cpuid(void) 957 962 { -
trunk/src/host/qemu-neo1973/target-i386/translate.c
r3387 r3627 5659 5659 gen_op_rdtsc(); 5660 5660 break; 5661 case 0x133: /* rdpmc */ 5662 gen_jmp_im(pc_start - s->cs_base); 5663 gen_op_rdpmc(); 5664 break; 5661 5665 case 0x134: /* sysenter */ 5662 5666 if (CODE64(s)) -
trunk/src/host/qemu-neo1973/target-m68k/helper.c
r3443 r3627 127 127 cpu_exec_init(env); 128 128 129 env->cpu_model_str = cpu_model; 130 129 131 if (cpu_m68k_set_model(env, cpu_model) < 0) { 130 132 cpu_m68k_close(env); 131 133 return NULL; 132 134 } 133 135 134 136 cpu_reset(env); 135 137 return env; -
trunk/src/host/qemu-neo1973/target-mips/translate.c
r3517 r3627 6787 6787 6788 6788 cpu_exec_init(env); 6789 env->cpu_model_str = cpu_model; 6789 6790 cpu_reset(env); 6790 6791 return env; -
trunk/src/host/qemu-neo1973/target-ppc/cpu.h
r3517 r3627 29 29 /* PowerPC 64 definitions */ 30 30 typedef uint64_t ppc_gpr_t; 31 #define TARGET_GPR_BITS 6432 31 #define TARGET_LONG_BITS 64 33 32 #define TARGET_PAGE_BITS 12 … … 42 41 */ 43 42 typedef uint64_t ppc_gpr_t; 44 #define TARGET_GPR_BITS 6445 43 #else /* (HOST_LONG_BITS >= 64) */ 46 44 typedef uint32_t ppc_gpr_t; 47 #define TARGET_GPR_BITS 3248 45 #endif /* (HOST_LONG_BITS >= 64) */ 49 46 … … 1236 1233 #define SPR_L3PM (0x3D7) 1237 1234 #define SPR_403_CDBCR (0x3D7) 1238 #define SPR_L3 OHCR(0x3D8)1235 #define SPR_L3ITCR0 (0x3D8) 1239 1236 #define SPR_TCR (0x3D8) 1240 1237 #define SPR_40x_TSR (0x3D8) … … 1249 1246 #define SPR_SER (0x3DF) 1250 1247 #define SPR_40x_SRR3 (0x3DF) 1251 #define SPR_L3 ITCR0(0x3E8)1248 #define SPR_L3OHCR (0x3E8) 1252 1249 #define SPR_L3ITCR1 (0x3E9) 1253 1250 #define SPR_L3ITCR2 (0x3EA) … … 1278 1275 #define SPR_970_HID5 (0x3F6) 1279 1276 #define SPR_MSSSR0 (0x3F7) 1277 #define SPR_MSSCR1 (0x3F7) 1280 1278 #define SPR_DABRX (0x3F7) 1281 1279 #define SPR_40x_DAC2 (0x3F7) -
trunk/src/host/qemu-neo1973/target-ppc/helper.c
r3517 r3627 2977 2977 return NULL; 2978 2978 cpu_exec_init(env); 2979 env->cpu_model_str = cpu_model; 2979 2980 cpu_ppc_register_internal(env, def); 2980 2981 cpu_ppc_reset(env); -
trunk/src/host/qemu-neo1973/target-ppc/translate_init.c
r3517 r3627 1150 1150 0x00000000); 1151 1151 /* XXX : not implemented */ 1152 spr_register(env, SPR_UBAMR, "UBAMR",1153 &spr_read_ureg, SPR_NOACCESS,1154 &spr_read_ureg, SPR_NOACCESS,1155 0x00000000);1156 /* XXX : not implemented */1157 1152 spr_register(env, SPR_MSSCR0, "MSSCR0", 1158 1153 SPR_NOACCESS, SPR_NOACCESS, … … 1193 1188 /* XXX : not implemented */ 1194 1189 spr_register(env, SPR_L3ITCR0, "L3ITCR0", 1195 SPR_NOACCESS, SPR_NOACCESS,1196 &spr_read_generic, &spr_write_generic,1197 0x00000000);1198 /* L3ITCR1 */1199 /* XXX : not implemented */1200 spr_register(env, SPR_L3ITCR1, "L3ITCR1",1201 SPR_NOACCESS, SPR_NOACCESS,1202 &spr_read_generic, &spr_write_generic,1203 0x00000000);1204 /* L3ITCR2 */1205 /* XXX : not implemented */1206 spr_register(env, SPR_L3ITCR2, "L3ITCR2",1207 SPR_NOACCESS, SPR_NOACCESS,1208 &spr_read_generic, &spr_write_generic,1209 0x00000000);1210 /* L3ITCR3 */1211 /* XXX : not implemented */1212 spr_register(env, SPR_L3ITCR3, "L3ITCR3",1213 SPR_NOACCESS, SPR_NOACCESS,1214 &spr_read_generic, &spr_write_generic,1215 0x00000000);1216 /* L3OHCR */1217 /* XXX : not implemented */1218 spr_register(env, SPR_L3OHCR, "L3OHCR",1219 1190 SPR_NOACCESS, SPR_NOACCESS, 1220 1191 &spr_read_generic, &spr_write_generic, … … 3048 3019 { 3049 3020 if (env->spr[SPR_HID0] & 0x00E00000) 3021 return 1; 3022 3023 return 0; 3024 } 3025 3026 static int check_pow_hid0_74xx (CPUPPCState *env) 3027 { 3028 if (env->spr[SPR_HID0] & 0x00600000) 3050 3029 return 1; 3051 3030 … … 4830 4809 } 4831 4810 4811 /* PowerPC 750CX */ 4832 4812 #define POWERPC_INSNS_750cx (PPC_INSNS_BASE | PPC_STRING | PPC_MFTB | \ 4833 4813 PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES | \ … … 4877 4857 /* Memory management */ 4878 4858 gen_low_BATs(env); 4879 /* XXX: high BATs are also present but are known to be bugged on 4880 * die version 1.x 4881 */ 4859 /* PowerPC 750cx has 8 DBATs and 8 IBATs */ 4860 gen_high_BATs(env); 4882 4861 init_excp_750cx(env); 4883 4862 env->dcache_line_size = 32; … … 5148 5127 POWERPC_FLAG_BE | POWERPC_FLAG_PMM | \ 5149 5128 POWERPC_FLAG_BUS_CLK) 5150 #define check_pow_7400 check_pow_hid0 5129 #define check_pow_7400 check_pow_hid0_74xx 5151 5130 5152 5131 static void init_proc_7400 (CPUPPCState *env) … … 5158 5137 /* 74xx specific SPR */ 5159 5138 gen_spr_74xx(env); 5139 /* XXX : not implemented */ 5140 spr_register(env, SPR_UBAMR, "UBAMR", 5141 &spr_read_ureg, SPR_NOACCESS, 5142 &spr_read_ureg, SPR_NOACCESS, 5143 0x00000000); 5144 /* XXX: this seems not implemented on all revisions. */ 5145 /* XXX : not implemented */ 5146 spr_register(env, SPR_MSSCR1, "MSSCR1", 5147 SPR_NOACCESS, SPR_NOACCESS, 5148 &spr_read_generic, &spr_write_generic, 5149 0x00000000); 5160 5150 /* Thermal management */ 5161 5151 gen_spr_thrm(env); … … 5189 5179 POWERPC_FLAG_BE | POWERPC_FLAG_PMM | \ 5190 5180 POWERPC_FLAG_BUS_CLK) 5191 #define check_pow_7410 check_pow_hid0 5181 #define check_pow_7410 check_pow_hid0_74xx 5192 5182 5193 5183 static void init_proc_7410 (CPUPPCState *env) … … 5199 5189 /* 74xx specific SPR */ 5200 5190 gen_spr_74xx(env); 5191 /* XXX : not implemented */ 5192 spr_register(env, SPR_UBAMR, "UBAMR", 5193 &spr_read_ureg, SPR_NOACCESS, 5194 &spr_read_ureg, SPR_NOACCESS, 5195 0x00000000); 5201 5196 /* Thermal management */ 5202 5197 gen_spr_thrm(env); … … 5242 5237 POWERPC_FLAG_BE | POWERPC_FLAG_PMM | \ 5243 5238 POWERPC_FLAG_BUS_CLK) 5244 #define check_pow_7440 check_pow_hid0 5239 #define check_pow_7440 check_pow_hid0_74xx 5245 5240 5246 5241 __attribute__ (( unused )) … … 5253 5248 /* 74xx specific SPR */ 5254 5249 gen_spr_74xx(env); 5250 /* XXX : not implemented */ 5251 spr_register(env, SPR_UBAMR, "UBAMR", 5252 &spr_read_ureg, SPR_NOACCESS, 5253 &spr_read_ureg, SPR_NOACCESS, 5254 0x00000000); 5255 5255 /* LDSTCR */ 5256 5256 /* XXX : not implemented */ … … 5322 5322 POWERPC_FLAG_BE | POWERPC_FLAG_PMM | \ 5323 5323 POWERPC_FLAG_BUS_CLK) 5324 #define check_pow_7450 check_pow_hid0 5324 #define check_pow_7450 check_pow_hid0_74xx 5325 5325 5326 5326 __attribute__ (( unused )) … … 5335 5335 /* Level 3 cache control */ 5336 5336 gen_l3_ctrl(env); 5337 /* L3ITCR1 */ 5338 /* XXX : not implemented */ 5339 spr_register(env, SPR_L3ITCR1, "L3ITCR1", 5340 SPR_NOACCESS, SPR_NOACCESS, 5341 &spr_read_generic, &spr_write_generic, 5342 0x00000000); 5343 /* L3ITCR2 */ 5344 /* XXX : not implemented */ 5345 spr_register(env, SPR_L3ITCR2, "L3ITCR2", 5346 SPR_NOACCESS, SPR_NOACCESS, 5347 &spr_read_generic, &spr_write_generic, 5348 0x00000000); 5349 /* L3ITCR3 */ 5350 /* XXX : not implemented */ 5351 spr_register(env, SPR_L3ITCR3, "L3ITCR3", 5352 SPR_NOACCESS, SPR_NOACCESS, 5353 &spr_read_generic, &spr_write_generic, 5354 0x00000000); 5355 /* L3OHCR */ 5356 /* XXX : not implemented */ 5357 spr_register(env, SPR_L3OHCR, "L3OHCR", 5358 SPR_NOACCESS, SPR_NOACCESS, 5359 &spr_read_generic, &spr_write_generic, 5360 0x00000000); 5361 /* XXX : not implemented */ 5362 spr_register(env, SPR_UBAMR, "UBAMR", 5363 &spr_read_ureg, SPR_NOACCESS, 5364 &spr_read_ureg, SPR_NOACCESS, 5365 0x00000000); 5337 5366 /* LDSTCR */ 5338 5367 /* XXX : not implemented */ … … 5404 5433 POWERPC_FLAG_BE | POWERPC_FLAG_PMM | \ 5405 5434 POWERPC_FLAG_BUS_CLK) 5406 #define check_pow_7445 check_pow_hid0 5435 #define check_pow_7445 check_pow_hid0_74xx 5407 5436 5408 5437 __attribute__ (( unused )) … … 5518 5547 POWERPC_FLAG_BE | POWERPC_FLAG_PMM | \ 5519 5548 POWERPC_FLAG_BUS_CLK) 5520 #define check_pow_7455 check_pow_hid0 5549 #define check_pow_7455 check_pow_hid0_74xx 5521 5550 5522 5551 __attribute__ (( unused )) … … 5531 5560 /* Level 3 cache control */ 5532 5561 gen_l3_ctrl(env); 5562 /* LDSTCR */ 5563 /* XXX : not implemented */ 5564 spr_register(env, SPR_LDSTCR, "LDSTCR", 5565 SPR_NOACCESS, SPR_NOACCESS, 5566 &spr_read_generic, &spr_write_generic, 5567 0x00000000); 5568 /* ICTRL */ 5569 /* XXX : not implemented */ 5570 spr_register(env, SPR_ICTRL, "ICTRL", 5571 SPR_NOACCESS, SPR_NOACCESS, 5572 &spr_read_generic, &spr_write_generic, 5573 0x00000000); 5574 /* MSSSR0 */ 5575 /* XXX : not implemented */ 5576 spr_register(env, SPR_MSSSR0, "MSSSR0", 5577 SPR_NOACCESS, SPR_NOACCESS, 5578 &spr_read_generic, &spr_write_generic, 5579 0x00000000); 5580 /* PMC */ 5581 /* XXX : not implemented */ 5582 spr_register(env, SPR_PMC5, "PMC5", 5583 SPR_NOACCESS, SPR_NOACCESS, 5584 &spr_read_generic, &spr_write_generic, 5585 0x00000000); 5586 /* XXX : not implemented */ 5587 spr_register(env, SPR_UPMC5, "UPMC5", 5588 &spr_read_ureg, SPR_NOACCESS, 5589 &spr_read_ureg, SPR_NOACCESS, 5590 0x00000000); 5591 /* XXX : not implemented */ 5592 spr_register(env, SPR_PMC6, "PMC6", 5593 SPR_NOACCESS, SPR_NOACCESS, 5594 &spr_read_generic, &spr_write_generic, 5595 0x00000000); 5596 /* XXX : not implemented */ 5597 spr_register(env, SPR_UPMC6, "UPMC6", 5598 &spr_read_ureg, SPR_NOACCESS, 5599 &spr_read_ureg, SPR_NOACCESS, 5600 0x00000000); 5601 /* SPRGs */ 5602 spr_register(env, SPR_SPRG4, "SPRG4", 5603 SPR_NOACCESS, SPR_NOACCESS, 5604 &spr_read_generic, &spr_write_generic, 5605 0x00000000); 5606 spr_register(env, SPR_USPRG4, "USPRG4", 5607 &spr_read_ureg, SPR_NOACCESS, 5608 &spr_read_ureg, SPR_NOACCESS, 5609 0x00000000); 5610 spr_register(env, SPR_SPRG5, "SPRG5", 5611 SPR_NOACCESS, SPR_NOACCESS, 5612 &spr_read_generic, &spr_write_generic, 5613 0x00000000); 5614 spr_register(env, SPR_USPRG5, "USPRG5", 5615 &spr_read_ureg, SPR_NOACCESS, 5616 &spr_read_ureg, SPR_NOACCESS, 5617 0x00000000); 5618 spr_register(env, SPR_SPRG6, "SPRG6", 5619 SPR_NOACCESS, SPR_NOACCESS, 5620 &spr_read_generic, &spr_write_generic, 5621 0x00000000); 5622 spr_register(env, SPR_USPRG6, "USPRG6", 5623 &spr_read_ureg, SPR_NOACCESS, 5624 &spr_read_ureg, SPR_NOACCESS, 5625 0x00000000); 5626 spr_register(env, SPR_SPRG7, "SPRG7", 5627 SPR_NOACCESS, SPR_NOACCESS, 5628 &spr_read_generic, &spr_write_generic, 5629 0x00000000); 5630 spr_register(env, SPR_USPRG7, "USPRG7", 5631 &spr_read_ureg, SPR_NOACCESS, 5632 &spr_read_ureg, SPR_NOACCESS, 5633 0x00000000); 5634 /* Memory management */ 5635 gen_low_BATs(env); 5636 gen_high_BATs(env); 5637 gen_74xx_soft_tlb(env, 128, 2); 5638 init_excp_7450(env); 5639 env->dcache_line_size = 32; 5640 env->icache_line_size = 32; 5641 /* Allocate hardware IRQ controller */ 5642 ppc6xx_irq_init(env); 5643 } 5644 5645 /* PowerPC 7457 (aka G4) */ 5646 #define POWERPC_INSNS_7457 (PPC_INSNS_BASE | PPC_STRING | PPC_MFTB | \ 5647 PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES | \ 5648 PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE | \ 5649 PPC_FLOAT_STFIWX | \ 5650 PPC_CACHE | PPC_CACHE_ICBI | \ 5651 PPC_CACHE_DCBA | PPC_CACHE_DCBZ | \ 5652 PPC_MEM_SYNC | PPC_MEM_EIEIO | \ 5653 PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | \ 5654 PPC_MEM_TLBIA | PPC_74xx_TLB | \ 5655 PPC_SEGMENT | PPC_EXTERN | \ 5656 PPC_ALTIVEC) 5657 #define POWERPC_MSRM_7457 (0x000000000205FF77ULL) 5658 #define POWERPC_MMU_7457 (POWERPC_MMU_SOFT_74xx) 5659 #define POWERPC_EXCP_7457 (POWERPC_EXCP_74xx) 5660 #define POWERPC_INPUT_7457 (PPC_FLAGS_INPUT_6xx) 5661 #define POWERPC_BFDM_7457 (bfd_mach_ppc_7400) 5662 #define POWERPC_FLAG_7457 (POWERPC_FLAG_VRE | POWERPC_FLAG_SE | \ 5663 POWERPC_FLAG_BE | POWERPC_FLAG_PMM | \ 5664 POWERPC_FLAG_BUS_CLK) 5665 #define check_pow_7457 check_pow_hid0_74xx 5666 5667 __attribute__ (( unused )) 5668 static void init_proc_7457 (CPUPPCState *env) 5669 { 5670 gen_spr_ne_601(env); 5671 gen_spr_7xx(env); 5672 /* Time base */ 5673 gen_tbl(env); 5674 /* 74xx specific SPR */ 5675 gen_spr_74xx(env); 5676 /* Level 3 cache control */ 5677 gen_l3_ctrl(env); 5678 /* L3ITCR1 */ 5679 /* XXX : not implemented */ 5680 spr_register(env, SPR_L3ITCR1, "L3ITCR1", 5681 SPR_NOACCESS, SPR_NOACCESS, 5682 &spr_read_generic, &spr_write_generic, 5683 0x00000000); 5684 /* L3ITCR2 */ 5685 /* XXX : not implemented */ 5686 spr_register(env, SPR_L3ITCR2, "L3ITCR2", 5687 SPR_NOACCESS, SPR_NOACCESS, 5688 &spr_read_generic, &spr_write_generic, 5689 0x00000000); 5690 /* L3ITCR3 */ 5691 /* XXX : not implemented */ 5692 spr_register(env, SPR_L3ITCR3, "L3ITCR3", 5693 SPR_NOACCESS, SPR_NOACCESS, 5694 &spr_read_generic, &spr_write_generic, 5695 0x00000000); 5696 /* L3OHCR */ 5697 /* XXX : not implemented */ 5698 spr_register(env, SPR_L3OHCR, "L3OHCR", 5699 SPR_NOACCESS, SPR_NOACCESS, 5700 &spr_read_generic, &spr_write_generic, 5701 0x00000000); 5533 5702 /* LDSTCR */ 5534 5703 /* XXX : not implemented */ … … 6652 6821 CPU_POWERPC_7400_v11 = 0x000C0101, 6653 6822 CPU_POWERPC_7400_v20 = 0x000C0200, 6823 CPU_POWERPC_7400_v21 = 0x000C0201, 6654 6824 CPU_POWERPC_7400_v22 = 0x000C0202, 6655 6825 CPU_POWERPC_7400_v26 = 0x000C0206, … … 6672 6842 CPU_POWERPC_7450_v11 = 0x80000101, 6673 6843 CPU_POWERPC_7450_v12 = 0x80000102, 6674 CPU_POWERPC_7450_v20 = 0x80000200, /* aka D: 2.04 */6844 CPU_POWERPC_7450_v20 = 0x80000200, /* aka A, B, C, D: 2.04 */ 6675 6845 CPU_POWERPC_7450_v21 = 0x80000201, /* aka E */ 6676 CPU_POWERPC_74x1 = 0x80000203, 6677 CPU_POWERPC_74x1G = 0x80000210, /* aka G: 2.3 */ 6846 #define CPU_POWERPC_74x1 CPU_POWERPC_74x1_v23 6847 CPU_POWERPC_74x1_v23 = 0x80000203, /* aka G: 2.3 */ 6848 /* XXX: this entry might be a bug in some documentation */ 6849 CPU_POWERPC_74x1_v210 = 0x80000210, /* aka G: 2.3 ? */ 6678 6850 #define CPU_POWERPC_74x5 CPU_POWERPC_74x5_v32 6679 6851 CPU_POWERPC_74x5_v10 = 0x80010100, … … 8301 8473 /* PowerPC 7400 v2.0 (G4) */ 8302 8474 POWERPC_DEF("7400_v2.0", CPU_POWERPC_7400_v20, 7400), 8475 /* PowerPC 7400 v2.1 (G4) */ 8476 POWERPC_DEF("7400_v2.1", CPU_POWERPC_7400_v21, 7400), 8303 8477 /* PowerPC 7400 v2.2 (G4) */ 8304 8478 POWERPC_DEF("7400_v2.2", CPU_POWERPC_7400_v22, 7400), … … 8353 8527 /* PowerPC 7451 (G4) */ 8354 8528 POWERPC_DEF("7451", CPU_POWERPC_74x1, 7450), 8355 /* PowerPC 7441g (G4) */ 8356 POWERPC_DEF("7441g", CPU_POWERPC_74x1G, 7440), 8357 /* PowerPC 7451g (G4) */ 8358 POWERPC_DEF("7451g", CPU_POWERPC_74x1G, 7450), 8529 /* PowerPC 7441 v2.1 (G4) */ 8530 POWERPC_DEF("7441_v2.1", CPU_POWERPC_7450_v21, 7440), 8531 /* PowerPC 7441 v2.3 (G4) */ 8532 POWERPC_DEF("7441_v2.3", CPU_POWERPC_74x1_v23, 7440), 8533 /* PowerPC 7451 v2.3 (G4) */ 8534 POWERPC_DEF("7451_v2.3", CPU_POWERPC_74x1_v23, 7450), 8535 /* PowerPC 7441 v2.10 (G4) */ 8536 POWERPC_DEF("7441_v2.10", CPU_POWERPC_74x1_v210, 7440), 8537 /* PowerPC 7451 v2.10 (G4) */ 8538 POWERPC_DEF("7451_v2.10", CPU_POWERPC_74x1_v210, 7450), 8359 8539 /* PowerPC 7445 (G4) */ 8360 8540 POWERPC_DEF("7445", CPU_POWERPC_74x5, 7445), … … 8397 8577 /* PowerPC 7457 v1.1 (G4) */ 8398 8578 POWERPC_DEF("7457_v1.1", CPU_POWERPC_74x7_v11, 7455), 8399 /* PowerPC 7447 v1.2 (G4) */8400 POWERPC_DEF("7447_v1.2", CPU_POWERPC_74x7_v12, 7445),8401 8579 /* PowerPC 7457 v1.2 (G4) */ 8402 8580 POWERPC_DEF("7457_v1.2", CPU_POWERPC_74x7_v12, 7455), -
trunk/src/host/qemu-neo1973/target-sparc/translate.c
r3517 r3627 3793 3793 return NULL; 3794 3794 cpu_exec_init(env); 3795 env->cpu_model_str = cpu_model; 3795 3796 env->version = def->iu_version; 3796 3797 env->fsr = def->fpu_version;
Note: See TracChangeset
for help on using the changeset viewer.
