summaryrefslogtreecommitdiffstats
path: root/hw/scsi-bus.c
Commit message (Collapse)AuthorAgeFilesLines
* Add get_fw_dev_path callback to scsi bus.Gleb Natapov2010-12-111-0/+23
| | | | | Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* scsi: Move sense handling into the driverHannes Reinecke2010-11-251-10/+0
| | | | | | | | | | | The current sense handling in scsi-bus is only used by the scsi-disk driver; the scsi-generic driver is using its own. So we should move the current sense handling into the scsi-disk driver. Signed-off-by: Hannes Reinecke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* scsi: Increase the number of possible devicesHannes Reinecke2010-11-251-1/+1
| | | | | | | | | | | | The SCSI parallel interface has a limit of 8 devices, but not the SCSI stack in general. So we should be removing the hard-coded limit and use MAX_SCSI_DEVS instead. And we only need to scan those devices which are allocated by the bus. Signed-off-by: Hannes Reinecke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* scsi_bus: fix length and xfer_mode for RESERVE and RELEASE commandsBernhard Kohl2010-09-211-1/+2
| | | | | | | | For the RESERVE and RELEASE commands the length must be zero and xfer_mode must be SCSI_XFER_NONE. Signed-off-by: Bernhard Kohl <bernhard.kohl@nsn.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* Rearrange block headersBlue Swirl2010-08-241-0/+1
| | | | | | | | | Changing block.h or blockdev.h resulted in recompiling most objects. Move DriveInfo typedef and BlockInterfaceType enum definitions to qemu-common.h and rearrange blockdev.h use to decrease churn. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* scsi: Dequeue requests before invoking completion callbackJan Kiszka2010-07-221-1/+11
| | | | | | | | | | | | | The request completion callback of the LSI controller may start the next request that can use the same tag as the completed one. As the latter is still enqueued at that point, scsi_send_command will complain about the tag reuse and cancel the completed request. That will cause a double free later on when the completion path cleans up as well. Fix this by dequeuing the request before invoking the callback. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* scsi: Error locations for -drive if=scsi device initializationMarkus Armbruster2010-07-061-0/+4
| | | | | Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* block: Catch attempt to attach multiple devices to a blockdevMarkus Armbruster2010-07-021-1/+4
| | | | | | | | | | | | | | | For instance, -device scsi-disk,drive=foo -device scsi-disk,drive=foo happily creates two SCSI disks connected to the same block device. It's all downhill from there. Device usb-storage deliberately attaches twice to the same blockdev, which fails with the fix in place. Detach before the second attach there. Also catch attempt to delete while a guest device model is attached. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* qdev: Decouple qdev_prop_drive from DriveInfoMarkus Armbruster2010-07-021-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Make the property point to BlockDriverState, cutting out the DriveInfo middleman. This prepares the ground for block devices that don't have a DriveInfo. Currently all user-defined ones have a DriveInfo, because the only way to define one is -drive & friends (they go through drive_init()). DriveInfo is closely tied to -drive, and like -drive, it mixes information about host and guest part of the block device. I'm working towards a new way to define block devices, with clean host/guest separation, and I need to get DriveInfo out of the way for that. Fortunately, the device models are perfectly happy with BlockDriverState, except for two places: ide_drive_initfn() and scsi_disk_initfn() need to check the DriveInfo for a serial number set with legacy -drive serial=... Use drive_get_by_blockdev() there. Device model code should now use DriveInfo only when explicitly dealing with drives defined the old way, i.e. without -device. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* scsi: scsi_bus_legacy_handle_cmdline() can fail, fix callersMarkus Armbruster2010-07-021-4/+7
| | | | | | | | | | | | | | 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>
* scsi-bus: Add MAINTENANCE_IN and MAINTENANCE_OUT SCSIRequest xfer and mode ↵Nicholas Bellinger2010-06-221-0/+10
| | | | | | | | | | | | assignments This patch updates hw/scsi-bus.c to add MAINTENANCE_IN and MAINTENANCE_OUT case in scsi_req_length() for TYPE_ROM with MMC commands. It also adds the MAINTENANCE_OUT case in scsi_req_xfer_mode() to set SCSI_XFER_TO_DEV for outgoing write data. Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* scsi-bus: Add PERSISTENT_RESERVE_OUT SCSIRequest->cmd.mode setupNicholas Bellinger2010-06-221-0/+1
| | | | | | | | | This patch updates hw/scsi-bus.c to add the PERSISTENT_RESERVE_OUT cdb case in scsi_req_xfer_mode() to set SCSI_XFER_TO_DEV for outgoing WRITE data. Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* blockdev: Collect block device code in new blockdev.cMarkus Armbruster2010-06-041-1/+0
| | | | | | | Anything that moves hundreds of lines out of vl.c can't be all bad. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* error: Replace qemu_error() by error_report()Markus Armbruster2010-03-161-1/+1
| | | | | | | | | | | | | error_report() terminates the message with a newline. Strip it it from its arguments. This fixes a few error messages lacking a newline: net_handle_fd_param()'s "No file descriptor named %s found", and tap_open()'s "vnet_hdr=1 requested, but no kernel support for IFF_VNET_HDR available" (all three versions). There's one place that passes arguments without newlines intentionally: load_vmstate(). Fix it up.
* error: Move qemu_error & friends into their own headerMarkus Armbruster2010-03-161-1/+1
|
* scsi: fix Sparse warning: Initializer entry defined twiceBlue Swirl2009-12-251-2/+2
| | | | | | | Both REWIND and REZERO_UNIT use 0x01, READ_POSITION and PRE_FETCH share 0x34. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* scsi: add read/write 16 commands.Gerd Hoffmann2009-12-031-0/+8
| | | | | | | | | | Add READ_16 + friends to scsi-defs.h, scsi_command_name() and the request parsing helper functions. Use them in scsi-disk.c too. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* scsi-disk: restruct emulation: REPORT_LUNSGerd Hoffmann2009-12-031-0/+1
| | | | | | | | | | Move REPORT_LUNS emulation from scsi_send_command() to scsi_disk_emulate_command(). Also add REPORT_LUNS to scsi-defs.h and scsi_command_name(). Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* scsi-disk: restruct emulation: SERVICE_ACTION_INGerd Hoffmann2009-12-031-0/+1
| | | | | | | | | | Move SERVICE_ACTION_IN emulation from scsi_send_command() to scsi_disk_emulate_command(). Also add SERVICE_ACTION_IN to scsi-defs.h and scsi_command_name(). Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* scsi-disk: restruct emulation: GET_CONFIGURATIONGerd Hoffmann2009-12-031-0/+1
| | | | | | | | | | Move GET_CONFIGURATION emulation from scsi_send_command() to scsi_disk_emulate_command(). Also add GET_CONFIGURATION to scsi-defs.h and scsi_command_name(). Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* scsi: add scsi_req_print()Gerd Hoffmann2009-12-031-0/+114
| | | | | | | Handy for debugging. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* scsi: move status to SCSIRequest.Gerd Hoffmann2009-12-031-0/+9
| | | | | | | | Also add and use the scsi_req_complete() helper function for calling the completion callback. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* scsi: move sense to SCSIDevice, create SCSISense struct.Gerd Hoffmann2009-12-031-0/+10
| | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* scsi: add xfer modeGerd Hoffmann2009-12-031-0/+46
| | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* scsi: add request parsing helpers to common code.Gerd Hoffmann2009-12-031-0/+164
| | | | | | | | Add helper functions for scsi request parsing to common code. Getting command length, transfer size, and linear block address is handled. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* scsi: move SCSIRequest management to common code.Gerd Hoffmann2009-12-031-0/+31
| | | | | | | | Create generic functions to allocate, find and release SCSIRequest structs. Make scsi-disk and scsi-generic use them. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* scsi: move request lists to QTAILQ.Gerd Hoffmann2009-12-031-0/+1
| | | | | | | | | | | | Changes: * Move from open-coded lists to QTAILQ macros. * Move the struct elements to the common data structures (SCSIDevice + SCSIRequest). * Drop free request pools. * Fix request cleanup in the destroy callback. Signed-off-by: Gerd Hoffmann <kraxel@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>
* Check return value of qdev_init()Markus Armbruster2009-10-071-1/+3
| | | | | | | | | But do so only where it may actually fail. Leave the rest for the next commit. Patchworks-ID: 35167 Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* scsi: hotplug windupGerd Hoffmann2009-10-051-0/+2
| | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Implement scsi device destructionGerd Hoffmann2009-10-051-3/+21
| | | | | 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/+3
| | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qdev/scsi: add scsi bus support to qdev, convert drivers.Gerd Hoffmann2009-09-091-0/+93
* 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>
OpenPOWER on IntegriCloud