From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56587) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bfTf3-00054r-JJ for qemu-devel@nongnu.org; Thu, 01 Sep 2016 11:12:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bfTf2-0001k1-JE for qemu-devel@nongnu.org; Thu, 01 Sep 2016 11:12:13 -0400 Received: from mail-wm0-x231.google.com ([2a00:1450:400c:c09::231]:33601) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bfTf2-0001jx-D3 for qemu-devel@nongnu.org; Thu, 01 Sep 2016 11:12:12 -0400 Received: by mail-wm0-x231.google.com with SMTP id v143so4376946wmv.0 for ; Thu, 01 Sep 2016 08:12:12 -0700 (PDT) Sender: Paolo Bonzini References: <6961327b-897d-0c01-102f-22f299e0362c@redhat.com> From: Paolo Bonzini Message-ID: Date: Thu, 1 Sep 2016 17:12:08 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] Implementation of BusLogic SCSI host adapter (BT-958) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Denis Dmitriev Cc: qemu-devel@nongnu.org, Pavel Dovgaluk On 01/09/2016 15:17, Denis Dmitriev wrote: > > I think that I am missing some initialization or something like that. > To work with the registers I create a memory region, and associate it > with the read and write handlers (as an example I used lsi53c895a.c). > Maybe work with memory in which mailboxes are located must be built > the same way? No, it doesn't. > To me, it looks like I'm trying to get the data to the right place but > I do not see them because there is something wrong with the mapping. > The basis of the initialization function I took from lsi53c895a.c. > Perhaps the root of evil in those lines, I commented out? If so, how > can I understand what parameters should be passed in > memory_region_init_io pci_register_bar and functions? > > void buslogic_scsi_realize(PCIDevice *dev, Error **errp) > { > BuslogicState *s = BUSLOGIC_BT958(dev); > DeviceState *d = DEVICE(dev); > uint8_t *pci_conf; > > pci_conf = dev->config; > > /* PCI latency timer = 255 */ > pci_conf[PCI_LATENCY_TIMER] = 0xff; > /* Interrupt pin A */ > pci_conf[PCI_INTERRUPT_PIN] = 0x01; > > > > memory_region_init_io(&s->port_io, OBJECT(s), &bl_port_ops, s, > "BusLogic", 0x4); If the BT958 has a single BAR, that would be fine. But is the length (0x4) correct? Paolo > // memory_region_init_io(&s->ram_io, OBJECT(s), &bl_ram_ops, s, > // "BusLogic-ram", 0x2000); > // memory_region_init_io(&s->io_io, OBJECT(s), &bl_io_ops, s, > // "BusLogic-io", 256); > > pci_register_bar(dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &s->port_io); > // pci_register_bar(dev, 1, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->mmio_io); > // pci_register_bar(dev, 2, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->ram_io); > > QTAILQ_INIT(&s->queue); > > scsi_bus_new(&s->bus, sizeof(s->bus), d, &bl_scsi_info, NULL); > if (!d->hotplugged) { > scsi_bus_legacy_handle_cmdline(&s->bus, errp); > }