Revision 9ba4524c hw/lsi53c895a.c

b/hw/lsi53c895a.c
15 15
#include "hw.h"
16 16
#include "pci.h"
17 17
#include "scsi.h"
18
#include "block_int.h"
19
#include "dma.h"
18 20

  
19 21
//#define DEBUG_LSI
20 22
//#define DEBUG_LSI_REG
......
390 392
{
391 393
    uint32_t buf;
392 394

  
393
    /* XXX: an optimization here used to fast-path the read from scripts
394
     * memory.  But that bypasses any iommu.
395
     */
396
    cpu_physical_memory_read(addr, (uint8_t *)&buf, 4);
395
    pci_dma_read(&s->dev, addr, (uint8_t *)&buf, 4);
397 396
    return cpu_to_le32(buf);
398 397
}
399 398

  
......
532 531
static void lsi_do_dma(LSIState *s, int out)
533 532
{
534 533
    uint32_t count;
535
    target_phys_addr_t addr;
534
    dma_addr_t addr;
536 535
    SCSIDevice *dev;
537 536

  
538 537
    assert(s->current);
......
558 557
    else if (s->sbms)
559 558
        addr |= ((uint64_t)s->sbms << 32);
560 559

  
561
    DPRINTF("DMA addr=0x" TARGET_FMT_plx " len=%d\n", addr, count);
560
    DPRINTF("DMA addr=0x" DMA_ADDR_FMT " len=%d\n", addr, count);
562 561
    s->csbc += count;
563 562
    s->dnad += count;
564 563
    s->dbc -= count;
......
567 566
    }
568 567
    /* ??? Set SFBR to first data byte.  */
569 568
    if (out) {
570
        cpu_physical_memory_read(addr, s->current->dma_buf, count);
569
        pci_dma_read(&s->dev, addr, s->current->dma_buf, count);
571 570
    } else {
572
        cpu_physical_memory_write(addr, s->current->dma_buf, count);
571
        pci_dma_write(&s->dev, addr, s->current->dma_buf, count);
573 572
    }
574 573
    s->current->dma_len -= count;
575 574
    if (s->current->dma_len == 0) {
......
762 761
    DPRINTF("Send command len=%d\n", s->dbc);
763 762
    if (s->dbc > 16)
764 763
        s->dbc = 16;
765
    cpu_physical_memory_read(s->dnad, buf, s->dbc);
764
    pci_dma_read(&s->dev, s->dnad, buf, s->dbc);
766 765
    s->sfbr = buf[0];
767 766
    s->command_complete = 0;
768 767

  
......
813 812
    s->dbc = 1;
814 813
    status = s->status;
815 814
    s->sfbr = status;
816
    cpu_physical_memory_write(s->dnad, &status, 1);
815
    pci_dma_write(&s->dev, s->dnad, &status, 1);
817 816
    lsi_set_phase(s, PHASE_MI);
818 817
    s->msg_action = 1;
819 818
    lsi_add_msg_byte(s, 0); /* COMMAND COMPLETE */
......
827 826
    len = s->msg_len;
828 827
    if (len > s->dbc)
829 828
        len = s->dbc;
830
    cpu_physical_memory_write(s->dnad, s->msg, len);
829
    pci_dma_write(&s->dev, s->dnad, s->msg, len);
831 830
    /* Linux drivers rely on the last byte being in the SIDL.  */
832 831
    s->sidl = s->msg[len - 1];
833 832
    s->msg_len -= len;
......
859 858
static uint8_t lsi_get_msgbyte(LSIState *s)
860 859
{
861 860
    uint8_t data;
862
    cpu_physical_memory_read(s->dnad, &data, 1);
861
    pci_dma_read(&s->dev, s->dnad, &data, 1);
863 862
    s->dnad++;
864 863
    s->dbc--;
865 864
    return data;
......
1011 1010
    DPRINTF("memcpy dest 0x%08x src 0x%08x count %d\n", dest, src, count);
1012 1011
    while (count) {
1013 1012
        n = (count > LSI_BUF_SIZE) ? LSI_BUF_SIZE : count;
1014
        cpu_physical_memory_read(src, buf, n);
1015
        cpu_physical_memory_write(dest, buf, n);
1013
        pci_dma_read(&s->dev, src, buf, n);
1014
        pci_dma_write(&s->dev, dest, buf, n);
1016 1015
        src += n;
1017 1016
        dest += n;
1018 1017
        count -= n;
......
1080 1079

  
1081 1080
            /* 32-bit Table indirect */
1082 1081
            offset = sxt24(addr);
1083
            cpu_physical_memory_read(s->dsa + offset, (uint8_t *)buf, 8);
1082
            pci_dma_read(&s->dev, s->dsa + offset, (uint8_t *)buf, 8);
1084 1083
            /* byte count is stored in bits 0:23 only */
1085 1084
            s->dbc = cpu_to_le32(buf[0]) & 0xffffff;
1086 1085
            s->rbc = s->dbc;
......
1439 1438
            n = (insn & 7);
1440 1439
            reg = (insn >> 16) & 0xff;
1441 1440
            if (insn & (1 << 24)) {
1442
                cpu_physical_memory_read(addr, data, n);
1441
                pci_dma_read(&s->dev, addr, data, n);
1443 1442
                DPRINTF("Load reg 0x%x size %d addr 0x%08x = %08x\n", reg, n,
1444 1443
                        addr, *(int *)data);
1445 1444
                for (i = 0; i < n; i++) {
......
1450 1449
                for (i = 0; i < n; i++) {
1451 1450
                    data[i] = lsi_reg_readb(s, reg + i);
1452 1451
                }
1453
                cpu_physical_memory_write(addr, data, n);
1452
                pci_dma_write(&s->dev, addr, data, n);
1454 1453
            }
1455 1454
        }
1456 1455
    }

Also available in: Unified diff