qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Implementation of BusLogic SCSI host adapter (BT-958)


From: Денис Дмитриев
Subject: [Qemu-devel] Implementation of BusLogic SCSI host adapter (BT-958)
Date: Wed, 31 Aug 2016 16:48:42 +0300

Hi,
I'm trying to implement a buslogic scsi adapter(BT-958) for qemu. I
realized the driver interaction with the ports through which the driver can
write / read commands and parameters for the adapter. The driver was able
to make an adapter sample procedure. The problem is that I do not
understand how to establish communication between the driver and adapter
for transferring mailboxes. I got the address of the mailboxes from the
driver. Then I calculated the start address of the desired mailbox (the
same address to which a driver recorded a mailbox). After that, I try to
read the data at this address using pci_dma_read function but no buffer
data after reading.


uint64_t buslogicReadOutgoingMailbox(BuslogicState *s, BUSLOGICTASKSTATE
*TaskState)
{
    uint64_t    GCMailbox;
    Mailbox24   Mbx24;
    Mbx24.uCmdState = 0;
    PCIDevice *pci_dev = PCI_DEVICE(s);
    if (s->fMbxIs24Bit)
    {
        //try to calculate mailbox address
        GCMailbox = s->GCPhysAddrMailboxOutgoingBase +
(s->uMailboxOutgoingPositionCurrent * sizeof(Mailbox24));
        //try to read mailbox
        pci_dma_read(pci_dev, GCMailbox, &Mbx24, sizeof(Mailbox24));
        //after that i  have empty buffer
        TaskState->MailboxGuest.u32PhysAddrCCB    =
ADDR_TO_U32(Mbx24.aPhysAddrCCB);
        TaskState->MailboxGuest.u.out.uActionCode = Mbx24.uCmdState;
    }
    else
    {
        GCMailbox = s->GCPhysAddrMailboxOutgoingBase +
(s->uMailboxOutgoingPositionCurrent * sizeof(Mailbox32));
        pci_dma_read(pci_dev, GCMailbox, &TaskState->MailboxGuest,
sizeof(Mailbox32));
    }
    return GCMailbox;
}


reply via email to

[Prev in Thread] Current Thread [Next in Thread]