summaryrefslogtreecommitdiffstats
path: root/hw/lsi53c895a.c
Commit message (Collapse)AuthorAgeFilesLines
...
* lsi53c895a: fix endianness issuesAurelien Jarno2011-01-141-2/+2
| | | | | | | | | | | | lsi_ram_read*() and lsi_ram_write*() are not consistent, one uses leXX_to_cpu() the other uses nothing. As the comment above the RAM declaration says: "Script ram is stored as 32-bit words in host byteorder.", remove the leXX_to_cpu() calls. This fixes the boot of an ARM versatile machine on MIPS and PowerPC hosts. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* Add endianness as io mem parameterAlexander Graf2010-12-111-2/+4
| | | | | | | | | | | | | As stated before, devices can be little, big or native endian. The target endianness is not of their concern, so we need to push things down a level. This patch adds a parameter to cpu_register_io_memory that allows a device to choose its endianness. For now, all devices simply choose native endian, because that's the same behavior as before. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* pci: Replace unneeded type casts in calls of pci_register_barStefan Weil2010-11-221-4/+3
| | | | | | | | | | There is no need for these type casts (as other existing code shows). So re-write the first argument without type cast (and remove a related TODO comment). Cc: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* lsi53c895a: avoid a write only variableBlue Swirl2010-10-131-0/+1
| | | | | | | | | | | Compiling with GCC 4.6.0 20100925 produced a warning: /src/qemu/hw/lsi53c895a.c: In function 'lsi_do_msgout': /src/qemu/hw/lsi53c895a.c:848:9: error: variable 'len' set but not used [-Werror=unused-but-set-variable] Fix by adding a dummy cast so that the variable is not unused for non-debug case. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* scsi: fix and improve debug printsBernhard Kohl2010-09-081-2/+2
| | | | | | | Some of them are not compile clean. Signed-off-by: Bernhard Kohl <bernhard.kohl@nsn.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* scsi: Fix SCSI bus resetJan Kiszka2010-07-061-2/+13
| | | | | | | | | | When the controller raises the SCSI reset line, we have to perform the requested reset on all disks attached to the controller's bus. Moreover, reset is edge triggered, so avoid repeating it if the line was already high. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* scsi: scsi_bus_legacy_handle_cmdline() can fail, fix callersMarkus Armbruster2010-07-021-1/+1
| | | | | | | | | | | | | | None of its callers checks for failure. scsi_hot_add() can crash because of that: (qemu) drive_add 4 if=scsi,format=host_device,file=/dev/sg1 scsi-generic: scsi generic interface too old Segmentation fault (core dumped) Fix all callers, not just scsi_hot_add(). Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* lsi53c895a: fix Phase Mismatch JumpPaolo Bonzini2010-06-291-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | lsi_bad_phase has a bug in the choice of pmjad1/pmjad2. This does not matter with Linux guests because it uses just one routine for both, but it breaks Windows 64-bit guests. This is the text from the spec: "[The PMJCTL] bit controls which decision mechanism is used when jumping on phase mismatch. When this bit is cleared the LSI53C895A will use Phase Mismatch Jump Address 1 (PMJAD1) when the WSR bit is cleared and Phase Mismatch Jump Address 2 (PMJAD2) when the WSR bit is set. When this bit is set the LSI53C895A will use jump address one (PMJAD1) on data out (data out, command, message out) transfers and jump address two (PMJAD2) on data in (data in, status, message in) transfers." Which means: CCNTL0.PMJCTL 0 SCNTL2.WSR = 0 PMJAD1 0 SCNTL2.WSR = 1 PMJAD2 1 out PMJAD1 1 in PMJAD2 In qemu, what you get instead is: CCNTL0.PMJCTL 0 out PMJAD1 0 in PMJAD2 <<<<< 1 out PMJAD1 1 in PMJAD1 <<<<< Considering that qemu always has SCNTL2.WSR cleared, the two marked cases (corresponding to phase mismatch on input) are always jumping to the wrong PMJAD register. The patch implements the correct semantics. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* lsi: Fix value overflow in request tag processingJan Kiszka2010-05-221-2/+2
| | | | | | | | | This fixes a mismerge of 64d564094cac5f72eeaeb950c442b773a00d3586 (wrong patch version): We need to mask the tag value properly to obtain its device ID. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* lsi: Handle removal of selected devicesJan Kiszka2010-05-101-22/+38
| | | | | | | | | We must not store references to selected devices as they may be hot-removed. Instead, look up the device based on its tag right before using it. If the device disappeared, throw an interrupt and disconnect. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* lsi: Adjust some register reset valuesJan Kiszka2010-05-101-3/+5
| | | | | | | | | According to the LSI spec, the reset value of dcmd, dstat, and ctest2 were wrong, and sdid as well as ssid require zero initialization. There are surely more discrepancies, this is just another increment. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* lsi: Purge message queue on resetJan Kiszka2010-05-101-0/+2
| | | | | | | | | Declare the input message queue empty and initialize the related state machine properly on controller reset. This fixes unrecoverable errors when the controller was reset during ongoing requests. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* lsi: Properly initialize controller state on resetJan Kiszka2010-05-031-2/+8
| | | | | | | | | The LSI controller was lacking a system reset handler. Simply invoke the existing soft reset handler in this case. This also allows to drop its explicit invocation during init. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* lsi: Purge request queue on soft resetJan Kiszka2010-05-031-0/+11
| | | | | | | | Avoid keeping zombie requests across controller reset by purging the queue and also dropping the currently active request. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* lsi: fix segfault in lsi_command_completeGerd Hoffmann2010-04-091-1/+1
| | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* lsi: pass lsi_request to lsi_reselectGerd Hoffmann2010-01-111-16/+7
| | | | | | | | | All callers of lsi_reselect have a lsi_request struct at hand anyway. So just pass it directly instead of having lsi_reselect search for it using the tag. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* lsi: move dma_len+dma_buf into lsi_requestGerd Hoffmann2010-01-111-22/+23
| | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* lsi: move current_dev into lsi_requestGerd Hoffmann2010-01-111-11/+12
| | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* lsi: have lsi_request for the whole life time of the request.Gerd Hoffmann2010-01-111-21/+32
| | | | | | | | | | | | Right now lsi_request is allocated when a request is queued and released when a request is unqueued. With this patch applied the lsi_request is kept for the whole lifetime of the scsi request. Rationale: We can use it for per-request data then. The patch does that already for the request tag. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* lsi: use QTAILQ for lsi_queueGerd Hoffmann2010-01-111-40/+28
| | | | | | | | Replace the funky array logic for queued commands with standard qemu list functions. Also rename lsi_queue to lsi_request. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Merge remote branch 'mst/for_anthony' into stagingAnthony Liguori2010-01-061-4/+6
|\
| * lsi: symbolic names for pci registersMichael S. Tsirkin2009-12-231-4/+6
| | | | | | | | | | | | | | | | | | No functional changes. I verified that the generated binary does not change. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Juan Quintela <quintela@redhat.com> Acked-by: Glauber Costa <glommer@gmail.com>
* | Fix Sparse warning: dubious: !x & yBlue Swirl2009-12-251-1/+1
|/ | | | Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Fix compile error when LSI_DEBUG is definedRyan Harper2009-12-031-3/+3
| | | | | | | | | | | | | | | | | | This patch fixes the follow error when LSI_DEBUG is set. CC libhw64/lsi53c895a.o cc1: warnings being treated as errors qemu/hw/lsi53c895a.c: In function 'lsi_io_mapfunc': qemu/hw/lsi53c895a.c:1932: error: format '%08x' expects type 'unsigned int', but argument 2 has type 'pcibus_t' qemu/hw/lsi53c895a.c: In function 'lsi_ram_mapfunc': /qemu/hw/lsi53c895a.c:1947: error: format '%08x' expects type 'unsigned int', but argument 2 has type 'pcibus_t' qemu/hw/lsi53c895a.c: In function 'lsi_mmio_mapfunc': qemu/hw/lsi53c895a.c:1957: error: format '%08x' expects type 'unsigned int', but argument 2 has type 'pcibus_t' make[1]: *** [lsi53c895a.o] Error 1 make: *** [subdir-libhw64] Error 2 Signed-off-by: Ryan Harper <ryanh@us.ibm.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* savevm: Port to qdev.vmsd all devices that have qdevJuan Quintela2009-12-031-1/+1
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* lsi53c895a: Implement IRQ on reselectionLaszlo Ast2009-12-031-3/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The critical part of this change is how to deal with simultaneaous generation of interrupts. The only (normal) case when this happens in the emulation is near simultaneous reselection + selection. If selection comes first, there is no problem, since the target attempting reselection loses the arbitration (in the emulation it only means that the reselect function will not be started). In the worst case the host adapter is reselected, but the device driver already started a selection, so we jump to the alternative address to handle the situation. The SCRIPTS code can trigger another interrupt to notify the driver that the new task has to be postponed. I suppose that on real hardware there is enough time after the reselection interrupt to set the SIP bit before the next interrupt comes, so it would result in 2 stacked interrupts (a SCSI and a DMA one). However, in the emulation there is no interrupt stacking, so there is a good chance that the 2 interrupts will get to the interrupt handler at the same time. Nevertheless, it should not make a big difference in interrupt handling, since in both cases both interrupts have to be fetched first, and after that the new task (that failed during the selection phase) has to be prepared/reset for a later restart, and the reconnected device has to be serviced. The changes do not modify the host adapter's behavior if this interrupt is not enabled. See also LSI53C895A technical manual, SCID and SIEN0. Signed-off-by: Laszlo Ast <laszlo.ast@siemens-enterprise.com> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* lsi53c895a: Use alternative address when already reselectedLaszlo Ast2009-12-031-2/+3
| | | | | | | | See SCRIPTS, 3.2.17 SELECT. Signed-off-by: Laszlo Ast <laszlo.ast@siemens-enterprise.com> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* lsi53c895a: Fix SDID in SELECT ID commandLaszlo Ast2009-12-031-1/+1
| | | | | | | | See SCRIPTS Programming Guide, 3.2.17 SELECT. Signed-off-by: Laszlo Ast <laszlo.ast@siemens-enterprise.com> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* lsi53c895a: Fix message code of DISCONNECTLaszlo Ast2009-12-031-1/+1
| | | | | | | | See SCSI-2, 6.5 Message system description/message codes. Signed-off-by: Laszlo Ast <laszlo.ast@siemens-enterprise.com> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* lsi53c895a: Add support for LSI53C700 Family Compatibility bitLaszlo Ast2009-12-031-0/+4
| | | | | | Signed-off-by: Laszlo Ast <laszlo.ast@siemens-enterprise.com> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* lsi53c895a: Whitespace and typo fixesLaszlo Ast2009-12-031-5/+5
| | | | | | Signed-off-by: Laszlo Ast <laszlo.ast@siemens-enterprise.com> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* pci: pci.h cleanup: move out stuff not in pci.cMichael S. Tsirkin2009-12-011-0/+2
| | | | | | | | pci.h declares some functions which aren't defined in pci.h. Clean up moving things to appropriate headers, and update all users. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* pci: introduce pcibus_t to represent pci bus address/size instead of uint32_tIsaku Yamahata2009-11-091-3/+3
| | | | | | | | | | | This patch is preliminary for 64 bit BAR support. Introduce dedicated type, pcibus_t, to represent pci bus address/size instead of uint32_t. Later this type will be changed to uint64_t. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* pci: s/PCI_ADDRESS_SPACE_/PCI_BASE_ADDRESS_SPACE_/ to match pci_regs.hIsaku Yamahata2009-11-091-3/+3
| | | | | | | | | make constants for pci base address match pci_regs.h by renaming PCI_ADDRESS_SPACE_xxx to PCI_BASE_ADDRESS_SPACE_xxx. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* scsi: move scsi-disk.h -> scsi.hGerd Hoffmann2009-11-091-1/+1
| | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* scsi: move scsi.h -> esp.hGerd Hoffmann2009-11-091-1/+0
| | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* lsi_scsi: port to vmstateJuan Quintela2009-10-271-159/+83
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* hotplug: fix "pci_add storage if=scsi"Gerd Hoffmann2009-10-271-1/+3
| | | | | | | | | Explicitly add the drive to the bus of the newly created scsi adapter instead of hoping that scsi_bus_legacy_handle_cmdline() picks it up correctly. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* pci: move unregister from PCIDevice to PCIDeviceInfoGerd Hoffmann2009-10-051-1/+1
| | | | | | | One more cleanup while being at it ;) Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* switch scsi bus to inplace allocation.Gerd Hoffmann2009-10-051-6/+6
| | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Revert "Get rid of _t suffix"Anthony Liguori2009-10-011-13/+13
| | | | | | | | | | | | In the very least, a change like this requires discussion on the list. The naming convention is goofy and it causes a massive merge problem. Something like this _must_ be presented on the list first so people can provide input and cope with it. This reverts commit 99a0949b720a0936da2052cb9a46db04ffc6db29. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Get rid of _t suffixmalc2009-10-011-13/+13
| | | | | | | Some not so obvious bits, slirp and Xen were left alone for the time being. Signed-off-by: malc <av1474@comtv.ru>
* qdev/scsi: add scsi bus support to qdev, convert drivers.Gerd Hoffmann2009-09-091-44/+21
| | | | | | | | | | | | | | | | | | * Add SCSIBus. * Add SCSIDeviceInfo, move device callbacks here. * add qdev/scsi helper functions. * convert drivers. Adding scsi disks via -device works now, i.e. you can do: -drive id=sda,if=none,... -device lsi -device scsi-disk,drive=sda legacy command lines (-drive if=scsi,...) continue to work. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* lsi53c895a: LSIState is a DeviceHostJuan Quintela2009-08-271-1/+1
| | | | | | | Go figure. Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* lsi53c895a: rename PCIDevice field from pci_dev to dev (consistence)Juan Quintela2009-08-271-12/+12
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* lsi53c895a: use DO_UPCAST to cast from PCIDeviceJuan Quintela2009-08-271-5/+5
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* lsi53c895a: remove pointless cast from void *Juan Quintela2009-08-271-19/+19
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qdev: add return value to init() callbacks.Gerd Hoffmann2009-08-271-1/+2
| | | | | | | | | | | | | | | | | | Sorry folks, but it has to be. One more of these invasive qdev patches. We have a serious design bug in the qdev interface: device init callbacks can't signal failure because the init() callback has no return value. This patch fixes it. We have already one case in-tree where this is needed: Try -device virtio-blk-pci (without drive= specified) and watch qemu segfault. This patch fixes it. With usb+scsi being converted to qdev we'll get more devices where the init callback can fail for various reasons. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Make CPURead/WriteFunc structure 'const'Blue Swirl2009-08-251-4/+4
| | | | Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Add save/restore support to the LSI logic SCSI device model.Nolan2009-07-221-0/+172
| | | | | | | | | | This patch requires "Handle BH's queued by AIO completions in qemu_aio_flush()" to work reliably. The combination of those two patches survived 300+ migrations with heavy IO load running in the guest. Signed-off-by: Nolan Leake <nolan <at> sigbus.net> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
OpenPOWER on IntegriCloud