summaryrefslogtreecommitdiffstats
path: root/hw/ide
Commit message (Collapse)AuthorAgeFilesLines
* piix: tag as not hotpluggable.Gerd Hoffmann2011-01-101-0/+2
| | | | | | | | | This patch tags all pci devices which belong to the piix3/4 chipsets as not hotpluggable (Host bridge, ISA bridge, IDE controller, ACPI bridge). Acked-by: Aurelien Jarno <aurelien@aurel32.net> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* ahci: delete write-only variables (v2)Blue Swirl2010-12-191-4/+1
| | | | | | | | | | | | | | | Avoid these warnings with GCC 4.6.0: /src/qemu/hw/ide/ahci.c: In function 'ahci_reset_port': /src/qemu/hw/ide/ahci.c:810:14: error: variable 'tfd' set but not used [-Werror=unused-but-set-variable] /src/qemu/hw/ide/ahci.c: In function 'handle_cmd': /src/qemu/hw/ide/ahci.c:1103:19: error: variable 'pr' set but not used [-Werror=unused-but-set-variable] In the tfd variable case, fix the logic also. CC: Alexander Graf <agraf@suse.de> CC: Kevin Wolf <kwolf@redhat.com> Acked-by: Alexander Graf <agraf@suse.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* ide: Build fix for via.cKevin Wolf2010-12-171-1/+1
| | | | Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* ide: Fix build for cmd646.cKevin Wolf2010-12-171-2/+2
| | | | | Signed-off-by: Kevin Wolf <kwolf@redhat.com> Acked-by: Andreas Färber <andreas.faerber@web.de>
* ide: Register vm change state handler once onlyStefan Hajnoczi2010-12-173-28/+58
| | | | | | | | | | | | | | | We register the vm change state handler in a PCI BAR map() function. This function can be called multiple times throughout the lifetime of a PCI IDE device. This results in duplicate vm change state handlers being register, none of which are ever unregistered. Instead, register the vm change state handler in the device's init function once and for all. piix tested, cmd646 and via not tested. Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* ide: honor ncq for atapiAlexander Graf2010-12-171-0/+6
| | | | | | | | | ATAPI also can do ncq, so let's expose the capability. This patch makes CD-ROM support work on Windows 7 for me. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* ahci: set SATA Mode SelectSebastian Herbszt2010-12-171-0/+3
| | | | | | | Set SATA Mode Select to AHCI in the Address Map Register. Signed-off-by: Sebastian Herbszt <herbszt@gmx.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* ahci: add ahci emulationAlexander Graf2010-12-171-0/+1524
| | | | | | | | This patch adds an emulation layer for an ICH-9 AHCI controller. For now this controller does not do IDE legacy emulation. It is a pure AHCI controller. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* ide: add ncq identify data for ahci sata drivesRoland Elek2010-12-172-0/+9
| | | | | | | | | I modified ide_identify() to include the zero-based queue length value in word 75, and set bit 8 in word 76 to signal NCQ support in the identify data for AHCI SATA drives. Signed-off-by: Roland Elek <elek.roland@gmail.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* ide: move transfer_start after variable modificationAlexander Graf2010-12-171-4/+4
| | | | | | | | | | We hook into transfer_start and immediately call the end function for ahci. This means that everything needs to be in place for the end function when we start the transfer, so let's move the function down to where all state is in place. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* ide: Split out BMDMA code from ATA coreAlexander Graf2010-12-177-298/+446
| | | | | | | | | The ATA core is currently heavily intertwined with BMDMA code. Let's loosen that a bit, so we can happily replace the DMA backend with different implementations. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* ide: fix whitespace gap in ide_exec_cmdAlexander Graf2010-12-171-367/+367
| | | | | | | | | Now that we have the function split out, we have to reindent it. In order to increase the readability of the actual functional change, this is split out. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* ide: split ide command interpretation offAlexander Graf2010-12-172-6/+16
| | | | | | | | The ATA command interpretation code can be used for PATA and SATA interfaces alike. So let's split it out into a separate function. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* Add bootindex parameter to net/block/fd deviceGleb Natapov2010-12-111-0/+5
| | | | | | | | | If bootindex is specified on command line a string that describes device in firmware readable way is added into sorted list. Later this list will be passed into firmware to control boot order. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Add get_fw_dev_path callback to IDE bus.Gleb Natapov2010-12-111-0/+13
| | | | | Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Store IDE bus id in IDEBus structure for easy access.Gleb Natapov2010-12-116-9/+11
| | | | | Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Keep track of ISA ports ISA device is using in qdev.Gleb Natapov2010-12-111-0/+2
| | | | | | | Store all io ports used by device in ISADevice structure. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Introduce fw_name field to DeviceInfo structure.Gleb Natapov2010-12-112-0/+2
| | | | | | | | | Add "fw_name" to DeviceInfo to use in device path building. In contrast to "name" "fw_name" should refer to functionality device provides instead of particular device model like "name" does. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Add endianness as io mem parameterAlexander Graf2010-12-112-3/+6
| | | | | | | | | | | | | 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>
* Merge remote branch 'origin/master' into pciMichael S. Tsirkin2010-12-017-124/+83
|\ | | | | | | | | | | Conflicts: Makefile.objs hw/virtio.c
| * ide: Reset current_addr after stopping DMAKevin Wolf2010-11-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | Whenever SSBM is reset in the command register all state information is lost. Restarting DMA means that current_addr must be reset to the base address of the PRD table. The OS is not required to change the base address register before starting a DMA operation, it can reuse the value it wrote for an earlier request. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
| * ide: Ignore double DMA transfer starts/stopsKevin Wolf2010-11-291-28/+32
| | | | | | | | | | | | | | | | You can only start a DMA transfer if it's not running yet, and you can only cancel it if it's running. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
| * ide: Set bus master inactive on errorKevin Wolf2010-11-291-0/+2
| | | | | | | | | | | | | | | | BMIDEA in the status register must be cleared on error. This makes FreeBSD respond (more) correctly to I/O errors. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
| * ide: Factor ide_dma_set_inactive outKevin Wolf2010-11-291-16/+13
| | | | | | | | | | | | | | | | Several places that stop a DMA transfer duplicate this code. Factor it out into a common function. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
| * ide: convert bmdma address ioport to ioport_register()Avi Kivity2010-11-246-77/+27
| | | | | | | | | | | | | | cmd646, via compile tested, pci lightly boot tested. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
| * ide: Handle immediate bdrv_aio_flush failureKevin Wolf2010-11-041-3/+9
| | | | | | | | | | | | If bdrv_aio_flush returns NULL, this should be treated as an error. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* | pci: Replace unneeded type casts in calls of pci_register_barStefan Weil2010-11-221-1/+1
|/ | | | | | | | | | 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>
* ide: Handle flush failureKevin Wolf2010-10-222-2/+11
| | | | | | | | | | | | | | Instead of always assuming success for bdrv_aio_flush, actually do something with the error. This respects the werror option and accordingly ignores the error, reports it to the guest or stops the VM and retries after cont. Ignoring the error is trivial, obviously. For stopping the VM and retrying later old code can be reused, but we need to introduce a new status for "retry a flush". For reporting to the guest, fortunately the same action is required as for a failed read/write (status = DRDY | ERR, error = ABRT), so this code can be reused as well. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* ide: Factor ide_flush_cache outKevin Wolf2010-10-221-4/+10
| | | | | | The next patch reuses this code, so put it in its own function. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* ide: set WCACHE supported in IDENTIFY dataChristoph Hellwig2010-10-221-2/+2
| | | | | | | | | | | ATA does not only have the WCACHE enabled bit in identify word 85, but also a WCACHE supported bit in word 82. While the Linux kernel is fine with the latter at least hdparm also needs the former before correctly displaying the cache settings. There's also a non-zero chance other operating systems are more picky in their volatile write cache detection. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* ide: propagate the required alignmentChristoph Hellwig2010-09-211-1/+3
| | | | | | | | | | | | | IDE is a bit ugly in this respect. For one it doesn't really keep track of a sector size - most of the protocol is in units of 512 bytes, and we assume 2048 bytes for CDROMs which is correct most of the time. Second IDE allocates an I/O buffer long before we know if we're dealing with a CDROM or not, so increase the alignment for the io_buffer unconditionally. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* Improve ATA IDENTIFY word 64 contents.Jonathan A. Kollasch2010-09-081-2/+2
| | | | | | | | Fill in word 64 of IDENTIFY data to indicate support for PIO modes 3 and 4. This allows NetBSD guests to use UltraDMA modes instead of just PIO mode 0. Signed-off-by: Jonathan A. Kollasch <jakllsch@kollasch.net> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* Rearrange block headersBlue Swirl2010-08-242-0/+2
| | | | | | | | | 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>
* ide: Avoid canceling IDE DMAAndrea Arcangeli2010-08-031-2/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The reason for not actually canceling the I/O is because with virtualization and lots of VM running, a guest fs may mistake a overload of the host, as an IDE timeout. So rather than canceling the I/O, it's safer to wait I/O completion and simulate that the I/O has completed just before the io cancellation was requested by the guest. This way if ntfs or an app writes data without checking for -EIO retval, and it thinks the write has succeeded, it's less likely to run into troubles. Similar issues for reads. Furthermore because the DMA operation is splitted into many synchronous aio_read/write if there's more than one entry in the SG table, without this patch the DMA would be cancelled in the middle, something we've no idea if it happens on real hardware too or not. Overall this seems a great risk for zero gain. This approach is sure safer than previous code given we can't pretend all guest fs code out there to check for errors and reply the DMA if it was completed partially, given a timeout would never materialize on a real harddisk unless there are defective blocks (and defective blocks are practically only an issue for reads never for writes in any recent hardware as writing to blocks is the way to fix them) or the harddisk breaks as a whole. Signed-off-by: Izik Eidus <ieidus@redhat.com> Signed-off-by: Andrea Arcangeli <aarcange@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* Merge branch 'for-anthony' of git://repo.or.cz/qemu/kevinAurelien Jarno2010-07-301-0/+15
|\ | | | | | | | | | | | | | | | | | | | | * 'for-anthony' of git://repo.or.cz/qemu/kevin: Fix -snapshot deleting images on disk change block: Use error codes from lower levels for error message block: default to 0 minimal / optiomal I/O size move 'unsafe' to end of caching modes in help virtio-blk: Create exit function to unregister savevm block migration: propagate return value when bdrv_write() returns < 0 ide/atapi: add support for GET EVENT STATUS NOTIFICATION
| * ide/atapi: add support for GET EVENT STATUS NOTIFICATIONAurelien Jarno2010-07-261-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The GET EVENT STATUS NOTIFICATION is a mandatory command according to MMC-3, even if event status notification is not supported. This patch adds support for this command. It returns NEA ("No Event Available") with an empty "Supported Event Classes" to show that it doesn't event support status notification. If asychronous operation is requested, which requires NCQ support, it returns an error according to the specifications. This fixes HAL support on FreeBSD and derivatives, which fill up the logs every second with: acd0: FAILURE - unknown CMD (0x03) ILLEGAL REQUEST asc=0x20 ascq=0x00 Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* | Fix uint8_t comparisons with negative valuesBlue Swirl2010-07-271-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix the following warnings: /src/qemu/hw/ide/core.c: In function `ide_drive_pio_post_load': /src/qemu/hw/ide/core.c:2767: warning: comparison is always false due to limited range of data type /src/qemu/ui/vnc-enc-tight.c: In function `tight_detect_smooth_image': /src/qemu/ui/vnc-enc-tight.c:284: warning: comparison is always true due to limited range of data type /src/qemu/ui/vnc-enc-tight.c:297: warning: comparison is always true due to limited range of data type /src/qemu/ui/vnc-enc-tight.c: In function `tight_encode_indexed_rect16': /src/qemu/ui/vnc-enc-tight.c:456: warning: comparison is always false due to limited range of data type /src/qemu/ui/vnc-enc-tight.c: In function `tight_encode_indexed_rect32': /src/qemu/ui/vnc-enc-tight.c:457: warning: comparison is always false due to limited range of data type Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* | ide: fix migration in the middle of a bmdma transferJuan Quintela2010-07-261-0/+30
| | | | | | | | | | | | | | | | | | | | | | It reintroduces Revert "ide save/restore pio/atapi cmd transfer fields and io buffer" but using subsections. Added bonus is the addition of ide_dummy_transfer_stop to transfer_end_table, that was missing. Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* | ide: fix migration in the middle of pio operationJuan Quintela2010-07-262-1/+94
| | | | | | | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* | Revert "ide save/restore current transfer fields"Juan Quintela2010-07-261-6/+2
| | | | | | | | | | | | | | This reverts commit 42ee76fe82093ba914f0dc83d2decbcf68866144. Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* | Revert "ide save/restore pio/atapi cmd transfer fields and io buffer"Juan Quintela2010-07-262-65/+2
|/ | | | | | | | | | | | | | | This reverts commit ed487bb1d69040b9dac64a4fc076d8dd82b131d6. The conflicts are due to commit 4fc8d6711aff7a9c11e402c3d77b481609f9f486 that is a fix to the ide_drive_pre_save() function. It reverts both (and both are reinstantiated later in the series) Conflicts: hw/ide/core.c Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* ide scsi virtio-blk: Reject empty drives unless media is removableMarkus Armbruster2010-07-131-0/+4
| | | | | | | | | | | Disks without media make no sense. For SCSI, a Linux guest kernel complains during boot. I didn't try other combinations. scsi-generic doesn't need the additional check, because it already requires bdrv_is_sg(), which fails without media. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* pci/multi function bit: fix vt82c686.c.Isaku Yamahata2010-07-121-1/+0
| | | | | | | | | | | | | | | The file, vt82c686.c, was added after the change set of b80d4a9887fa4b6cc63f8c3a13ab2a45054d3e5c and fecb93c45c749a4c994d8d12bdee17ce2012de9e are created, but before the patch series was commit. So similar fix is needed to vt82c686.c. Cc: Huacai Chen <zltjiangshi@gmail.com> Cc: Aurelien Jarno <aurelien@aurel32.net> Cc: Michael S. Tsirkin <mst@redhat.com> Cc: Blue Swirl <blauwirbel@gmail.com> Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* pci: don't overwrite multi functio bit in pci header type.Isaku Yamahata2010-07-112-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't overwrite pci header type. Otherwise, multi function bit which pci_init_header_type() sets appropriately is lost. Anyway PCI_HEADER_TYPE_NORMAL is zero, so it is unnecessary to zero which is already zero cleared. how to test: run qemu and issue info pci to see whether a device in question is normal device, not pci-to-pci bridge. This is handy because guest os isn't required. tested changes: The following files are covered by using following commands. sparc64-softmmu apb_pci.c, vga-pci.c, cmd646.c, ne2k_pci.c, sun4u.c ppc-softmmu grackle_pci.c, cmd646.c, ne2k_pci.c, vga-pci.c, macio.c ppc-softmmu -M mac99 unin_pci.c(uni-north, uni-north-agp) ppc64-softmmu pci-ohci, ne2k_pci, vga-pci, unin_pci.c(u3-agp) x86_64-softmmu acpi_piix4.c, ide/piix.c, piix_pci.c -vga vmware vmware_vga.c -watchdog i6300esb wdt_i6300esb.c -usb usb-uhci.c -sound ac97 ac97.c -nic model=rtl8139 rtl8139.c -nic model=pcnet pcnet.c -balloon virtio virtio-pci.c: untested changes: The following changes aren't tested. prep_pci.c: ppc-softmmu -M prep should cover, but core dumped. unin_pci.c(uni-north-pci): the caller is commented out. openpic.c: the caller is commented out in ppc_prep.c Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Merge remote branch 'kwolf/for-anthony' into stagingAnthony Liguori2010-07-065-35/+61
|\
| * ide: Reject invalid CHS geometryMarkus Armbruster2010-07-061-0/+12
| | | | | | | | | | | | | | | | drive_init() doesn't permit invalid CHS for if=ide, but that's worthless: we get it via if=none and -device. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
| * ide: Reject readonly drives unless CD-ROMMarkus Armbruster2010-07-061-0/+5
| | | | | | | | | | | | | | | | drive_init() doesn't permit option readonly for if=ide, but that's worthless: we get it via if=none and -device. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
| * ide: Make ide_init_drive() return successMarkus Armbruster2010-07-063-7/+14
| | | | | | | | | | | | | | It still always succeeds. The next commits will add failures. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
| * ide: Replace IDEState members is_cdrom, is_cf by drive_kindMarkus Armbruster2010-07-064-24/+25
| | | | | | | | | | | | | | The two aren't independent variables. Make that obvious. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
| * ide: Improve error messagesMarkus Armbruster2010-07-061-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | Use error_report(), because it points to the error location. Reword "tried to assign twice" messages to make it clear that we're complaining about the unit property. Report invalid unit property instead of failing silently. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
OpenPOWER on IntegriCloud