aboutsummaryrefslogtreecommitdiffstats
path: root/src/hw/ahci.c
Commit message (Collapse)AuthorAgeFilesLines
* geometry: Apply LCHS values for boot devicesSam Eiderman2019-11-181-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Boot devices which use overriden LCHS values are: * ata * ahci * scsi * esp * lsi * megasas * mpt * pvscsi * virtio * virtio-blk We use these values in get_translation() and setup_translation() by introducing a new translation type: "TRANSLATION_HOST". We treat this translation as TRANSLATION_NONE in fill_ata_edd(), although this does not really matter since now the translation between physical and logical geometry does not exist. Reviewed-by: Karl Heubaum <karl.heubaum@oracle.com> Reviewed-by: Arbel Moshe <arbel.moshe@oracle.com> Signed-off-by: Sam Eiderman <shmuel.eiderman@oracle.com> Message-Id: <20190626123816.8907-6-shmuel.eiderman@oracle.com>
* Revert "geometry: Apply LCHS values for boot devices"Gerd Hoffmann2019-11-181-1/+0
| | | | This reverts commit 9caa19be0e534c687081fbdfcd301406e728c98c.
* ahci: zero-initialize port structGerd Hoffmann2019-11-131-0/+1
| | | | | | | | | Specifically port->drive.lchs needs clearing, otherwise seabios will try interpret whatever random crap happens to be there as disk geometry, which may or may not break boot depending on how lucky you are. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* geometry: Apply LCHS values for boot devicesSam Eiderman2019-11-061-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Boot devices which use overriden LCHS values are: * ata * ahci * scsi * esp * lsi * megasas * mpt * pvscsi * virtio * virtio-blk We use these values in get_translation() and setup_translation() by introducing a new translation type: "TRANSLATION_MACHINE". We treat this translation as TRANSLATION_NONE in fill_ata_edd(), although this does not really matter since now the translation between physical and logical geometry does not exist. Reviewed-by: Karl Heubaum <karl.heubaum@oracle.com> Reviewed-by: Arbel Moshe <arbel.moshe@oracle.com> Signed-off-by: Sam Eiderman <shmuel.eiderman@oracle.com> Message-Id: <20190612093704.47175-6-shmuel.eiderman@oracle.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* block: Rename disk_op_s->drive_gf to drive_flKevin O'Connor2017-09-271-2/+2
| | | | | | | | | | Now that the drive_s struct does not need to be in the f-segment, rename references to drive_gf in the generic drive code to drive_fl. This is just variable renames - no code changes. Tested-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* ahci: Disable Native Command QueueingZeh, Werner2017-07-021-1/+0
| | | | | | | | | | | The AHCI driver currently sets the NCQ bit for every command that is issued to the SATA drive. This is not needed as there is always only one command active at a time and in turn can lead to a hanging AHCI controller (true for Marvel 88SE9170). The following patch disables the usage of NCQ completely. With this patch the Marvel AHCI controller works just fine without any issues. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* ahci: Set upper 32-bit registers to zeroLadi Prosek2017-01-171-0/+5
| | | | | | | | | If the HBA supports 64-bit addressing, the registers may contain non-zero values, for example after reboot as a leftover from the OS driving the adapter. Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Ladi Prosek <lprosek@redhat.com>
* ahci: set transfer mode according to the capabilities of connected driveGerd Hoffmann2016-02-291-0/+57
| | | | | | | | | | Use case: cf cards behind sata-ide bridge, which might not support the default transfer mode. Based on a patch by Werner Zeh <werner.zeh@siemens.com>, with some minor tweaks applied. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* pci: Split low-level pci code from higher-level 'struct pci_device' codeKevin O'Connor2016-02-031-1/+2
| | | | | | | | | Split pci.c into pci.c and pcidevice.c. The low-level code that interacts directly with the PCI devices remains in pci.c, while functions dealing with the higher level pci_device cache move to pcidevice.c. Only pci.c is needed in 16bit mode. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pci: Implement '%pP' printf handler for 'struct pci_device' pointersKevin O'Connor2016-02-031-3/+2
| | | | | | | Handle '%pP' format descriptions as a pointer to a 'struct pci_device' and display it in bus:device.function (%02x:%02x.%x) format. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* ahci: Convert to new PCI BAR helper functionsKevin O'Connor2016-02-021-19/+16
| | | | | | | | | | | | | Use the pci_enable_x() functions. This patch also converts cntl->iobase from a 'u32' to a 'void*' so that it is clear that the address is a virtual memory address. After this change, the AHCI driver will no longer enable PCI_COMMAND_IO io accesses, as the AHCI driver doesn't actually attempt IO accesses to the device. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* block: Rename process_XXX_op() functions to XXX_process_op()Kevin O'Connor2015-07-141-1/+1
| | | | | | Rename disk driver dispatch functions to a consistent naming style. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* ahci: Handle AHCI ATAPI drives directly via 'struct disk_op_s' requestsKevin O'Connor2015-07-141-8/+7
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* block: Introduce default_process_op() with common command handling codesKevin O'Connor2015-07-141-8/+1
| | | | | | | | Most disk drivers only implement a couple of the available bios commands. Unify the common fallback handling code into a new function default_process_op() to reduce boiler-plate code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* block: Split process_op() command dispatch up into multiple functionsKevin O'Connor2015-07-141-1/+1
| | | | | | | | | Introduce process_op_32(), process_op_16(), and process_op_both() and split the disk driver command dispatch by its runtime mode requirements. This makes it more clear which modes each driver runs in. It also reduces the call32() boiler-plate code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Make sure all code checks for malloc failuresKevin O'Connor2015-07-041-0/+8
| | | | | | | | This is the result of an audit of callers of the malloc_XXX() and memalign_XXX() calls. All callers need to check if these functions return NULL. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* ahci: Ignore max_ports.Vladimir Serbinenko2015-05-211-1/+1
| | | | | | | | | At least AHCI on Intel on some machines claim to support only 6 ports while in fact higher port numbers are present and work. This is needed to access CD-ROM on PackardBell MS2290. Both GRUB and Linux have a similar workaround. Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
* Remove unnecesary updates of the disk op->count field.Kevin O'Connor2013-12-271-1/+0
| | | | | | | Now that the op->count field is cleared in a global location on simple errors, remove various local clears done in individual drivers. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* ahci: alloc structs in high memoryGerd Hoffmann2013-12-041-3/+3
| | | | | | | | | | With ahci running in 32bit mode we can also allocate the (ahci private) data structures in high memory. This reduces the real mode memory footprint as we only need to move struct ahci_port_s (which contains struct drive_s) to fseg in case the port probe was successful. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* ahci: remote some parenthesesGerd Hoffmann2013-12-041-3/+3
| | | | | | Minor cleanups. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* ahci: zap real mode macrosGerd Hoffmann2013-12-041-37/+37
| | | | | | | Not needed any more now that ahci runs in 32bit mode all the time. Script-based search & replace. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* Convert op->drive_g from a 16bit pointer to a 32 bit "GLOBALFLAT" pointer.Kevin O'Connor2013-10-261-14/+14
| | | | | | | | | | | | The "drive" structure is always malloc'ed and therefore always starts off described as a 32-bit "flat" pointer. Instead of switching to/from 16bit pointers, make all the code use the 32bit pointer. This eliminates the confusing 16/32 bit pointer switches. This patch also removes the "_g" suffixes on local variables in functions that are always called in 32bit mode. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Run ahci code entirely in 32bit mode.Kevin O'Connor2013-10-141-11/+4
| | | | | | | | | | The ahci driver needs to jump into 32bit mode in order to access portions of the ahci controllers PCI config space. Instead of jumping into 32bit mode just to toggle the ahci registers, jump into 32bit mode for all of the driver interactions. This shrinks the size of the overall code and can lead to further cleanups. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Rename fields of 'struct chs_s' and use in floppy lba2chs().Kevin O'Connor2013-10-141-3/+3
| | | | | | | | | | Rename the fields of 'struct chs_s' so that it can be used both to describe a drive and to describe a particular sector on a drive. Update floppy.c:lba2chs() to return a 'struct chs_s' instead of passing the results via pointers. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Remove ioport.h; disperse its contents to other header files.Kevin O'Connor2013-09-281-1/+1
| | | | | | | Move the inb(), insb(), etc. code from ioport.h to x86.h. Move the PORT_* definitions to their appropriate hardware files. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Merge bmp.h, boot.h, jpeg.h, and post.h into util.h.Kevin O'Connor2013-09-181-1/+0
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Split disk.h into block.h and std/disk.h.Kevin O'Connor2013-09-181-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Move function definitions for output.c from util.h to new file output.h.Kevin O'Connor2013-09-181-9/+9
| | | | | | Also, sort the order of include files in the c files. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Move malloc code from pmm.c to new files malloc.c and malloc.h.Kevin O'Connor2013-09-181-0/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Move stacks.c definitions from util.h to new file stacks.h.Kevin O'Connor2013-09-181-0/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Rename util.c to string.c and introduce string.h.Kevin O'Connor2013-09-181-0/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* ahci: add missing check for allocation failureGerd Hoffmann2013-09-161-9/+16
| | | | | | | Triggerable by creating a virtual machine with *lots* of ahci controllers and disks. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* Move code centered around specific hardware devices to src/hw/Kevin O'Connor2013-09-021-0/+638
Move many C files from the src/ directory to the new src/hw/ directory. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>