From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39024) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bf5sk-0000HM-5e for qemu-devel@nongnu.org; Wed, 31 Aug 2016 09:48:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bf5sj-0007iy-6w for qemu-devel@nongnu.org; Wed, 31 Aug 2016 09:48:46 -0400 Received: from mail-lf0-x22c.google.com ([2a00:1450:4010:c07::22c]:33445) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bf5si-0007iQ-RA for qemu-devel@nongnu.org; Wed, 31 Aug 2016 09:48:45 -0400 Received: by mail-lf0-x22c.google.com with SMTP id b199so37510439lfe.0 for ; Wed, 31 Aug 2016 06:48:43 -0700 (PDT) MIME-Version: 1.0 From: =?UTF-8?B?0JTQtdC90LjRgSDQlNC80LjRgtGA0LjQtdCy?= Date: Wed, 31 Aug 2016 16:48:42 +0300 Message-ID: Content-Type: text/plain; charset=UTF-8 Subject: [Qemu-devel] Implementation of BusLogic SCSI host adapter (BT-958) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Pavel Dovgaluk , pbonzini@redhat.com 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; }