aboutsummaryrefslogtreecommitdiff
path: root/src/block.c
AgeCommit message (Collapse)AuthorFilesLines
2024-01-04block/ata: Fixes to allow building 64-bit firmwareHelge Deller1-1/+1
Signed-off-by: Helge Deller <deller@gmx.de>
2023-10-14parisc/block: Disable debug lineHelge Deller1-1/+1
Signed-off-by: Helge Deller <deller@gmx.de>
2021-09-24block.c: Allow PA-RISC to boot from ATA drivesHelge Deller1-1/+7
Boot directly from ATA drive without going through the process_op_32() function. Additionally PA-RISC can read/write chunks from disk which are bigger than 64kb, so don't abort when this is tried. Signed-off-by: Helge Deller <deller@gmx.de>
2021-09-24Drivers: Use get_bda_ptr() BDA accessorHelge Deller1-1/+1
Use the get_bda_ptr() accessor function instead of hardcoding with MAKE_FLATPTR(). Signed-off-by: Helge Deller <deller@gmx.de>
2019-11-18geometry: Apply LCHS values for boot devicesSam Eiderman1-1/+17
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>
2019-11-18Revert "geometry: Apply LCHS values for boot devices"Gerd Hoffmann1-20/+1
This reverts commit 9caa19be0e534c687081fbdfcd301406e728c98c.
2019-11-06geometry: Apply LCHS values for boot devicesSam Eiderman1-1/+20
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>
2017-09-27block: Rename disk_op_s->drive_gf to drive_flKevin O'Connor1-18/+18
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>
2017-09-27disk: Don't require the 'struct drive_s' to be in the f-segmentKevin O'Connor1-11/+11
Allow the 'struct drive_s' drive description structure to be in either the "low" memory segment or the f-segment. Tested-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-02-20block: add NVMe boot supportJulian Stecklina1-0/+4
This patch enables SeaBIOS to boot from NVMe. Finding namespaces and basic I/O works. Testing has been done in qemu and so far it works with Grub, syslinux, and the FreeBSD loader. You need a recent Qemu (>= 2.7.0), because older versions have buggy NVMe support. The NVMe code is currently only enabled on Qemu due to lack of testing on real hardware. Signed-off-by: Julian Stecklina <jsteckli@amazon.de>
2016-03-31disk: Avoid stack_hop() path if already on the extra stackKevin O'Connor1-0/+4
If CONFIG_ENTRY_EXTRASTACK is set (enabled by default) then the 16bit disk interface code is already running on the extra stack and it is not necessary to support stack switching on each disk request. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-03-31block: Move send_disk_op() from block.c to disk.cKevin O'Connor1-33/+1
The send_disk_op() function is only called from the 16bit handlers found in disk.c. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-03-29Support for booting from LSI Logic LSI53C1030, SAS1068, SAS1068eDon Slutz1-0/+4
Also known as Fusion MPT disk; this controller model is supported by VirtualBox and VMware, and QEMU support patches have been posted. Signed-off-by: Don Slutz <Don.Slutz@Gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-02-04block: Move drive setup to new function block_setup()Kevin O'Connor1-1/+16
Move the list of drive setup calls from post.c to a new function in block.c. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-12-28block: Report drive->sectors using "%u" instead of "%d"Kevin O'Connor1-1/+1
The sector count is a 64bit number that is often reported as a 32bit number (due to limitations in dprintf). Consistently use "%u" reporting to avoid confusing negative numbers. Reported-by: Tobias Diedrich <tobiasdiedrich@gmail.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-10-15stacks: Use macro wrappers for call32() and stack_hop_back()Kevin O'Connor1-4/+3
The C code only uses _cfuncX_ prefixes for parameters to the call32(), stack_hop_back(), and call32_params() functions. It's simpler to use macro wrappers around those functions which provide the required prefix. This also changes the parameter order of stack_hop() and stack_hop_back() to use the more natural (func, params) ordering. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-08-17edd: Reduce parameters to fill_generic_edd()Kevin O'Connor1-32/+45
Have callers of fill_generic_edd() calculate the edd iface_path field. Have callers determine if the bus type is PCI vs ISA. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-08-17edd: Pass the segment/offset from int 1348 calls using a 'struct segoff_s'Kevin O'Connor1-7/+9
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-07-14ata: Make sure "chanid" is relative to PCI device for bootorder fileKevin O'Connor1-4/+2
When specifying drives in the bootorder file, the "drive@x" parameter should be relative to the given PCI device and not relative to the total number of ATA controllers in the machine. This patch separates the tracking of "chanid" (channel number relative to a given PCI devices) from the "ataid" (channel number relative to the total number of ATA channels). Reported-by: Jonathan A. Kollasch <jakllsch@kollasch.net> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-07-14block: Rename process_XXX_op() functions to XXX_process_op()Kevin O'Connor1-7/+7
Rename disk driver dispatch functions to a consistent naming style. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-07-14pvscsi: Handle pvscsi drives directly via 'struct disk_op_s' requestsKevin O'Connor1-1/+2
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-07-14virtio-scsi: Handle virtio drives directly via 'struct disk_op_s' requestsKevin O'Connor1-0/+2
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-07-14megasas: Handle Megasas drives directly via 'struct disk_op_s' requestsKevin O'Connor1-1/+2
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-07-14esp-scsi: Handle ESP drives directly via 'struct disk_op_s' requestsKevin O'Connor1-0/+2
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-07-14lsi-scsi: Handle LSI drives directly via 'struct disk_op_s' requestsKevin O'Connor1-0/+2
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-07-14usb-uas: Handle USB drives directly via 'struct disk_op_s' requestsKevin O'Connor1-0/+3
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-07-14usb-msc: Handle USB drives directly via 'struct disk_op_s' requestsKevin O'Connor1-0/+3
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-07-14ahci: Handle AHCI ATAPI drives directly via 'struct disk_op_s' requestsKevin O'Connor1-13/+1
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-07-14ata: Handle ATA ATAPI drives directly via 'struct disk_op_s' requestsKevin O'Connor1-1/+1
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-07-14block: Introduce default_process_op() with common command handling codesKevin O'Connor1-0/+17
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>
2015-07-14block: Split process_op() command dispatch up into multiple functionsKevin O'Connor1-56/+69
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>
2015-07-01virtio: run drivers in 32bit modeGerd Hoffmann1-3/+5
virtio version 1.0 registers can (and actually do in the qemu implementation) live in mmio space. So we must run the blk and scsi virtio drivers in 32bit mode, otherwise we can't access them. This also allows to drop a bunch of GET_LOWFLAT calls from the virtio code in the following patches. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-12-29block: Check for read/write requests over 64KKevin O'Connor1-0/+4
The standard BIOS disk read/write request interface should never get a request for more than 64K of data. Explicitly check for overly large requests and reject them. This way, the low-level drivers do not need to check for or attempt to handle very large requests. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-12-29scsi: Move process_scsi_op() to hw/blockcmd.c and renameKevin O'Connor1-23/+4
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-12-29sdcard: Initial support for SD cards on PCI SDHCI controllers on QEMUKevin O'Connor1-0/+5
This adds basic read/write support for SD cards emulated by QEMU. This code is not expected to work on real hardware, because the current controller and card initialization is not robust. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-06-04Move cdemu call interface and disk_ret helper code to disk.c.Kevin O'Connor1-31/+0
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-06-04edd: Separate out ATA and virtio specific parts of fill_edd().Kevin O'Connor1-81/+88
This also changes DTYPE_VIRTIO_SCSI drives to report that they are using a "SCSI" bus instead of an "ATA" bus - it was obviously incorrect before. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-06-04edd: Use sectors==-1 to detect removable media.Kevin O'Connor1-3/+2
Don't look for DTYPE_ATA_ATAPI to determine if a removable media (such as a cdrom) is present, instead look for a -1 in the sector count. This improves the results for cdroms on controllers other than ATA ATAPI. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-06-04edd: Move EDD get drive parameters (int 1348) logic from disk.c to block.c.Kevin O'Connor1-0/+179
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-01-29xhci: Run the XHCI driver entirely in 32bit mode.Kevin O'Connor1-0/+2
Since the XHCI driver needs to jump into 32bit mode anyway, it is simpler to just run all of the code in 32bit mode. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-12-27pvscsi: Always run entirely in 32bit mode.Kevin O'Connor1-2/+6
Instead of jumping into 32bit mode to access the PCI config space, run the entire driver in 32bit mode. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-12-27Remove unnecesary updates of the disk op->count field.Kevin O'Connor1-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>
2013-12-27Clear the total block transfer count on error.Kevin O'Connor1-13/+27
The total number of blocks transferred is part of the return status of the BIOS API. This is normally the total number of blocks requested. However, in an error it is possible for this count to be less. Add a global check to ensure that on an error event the block count is updated - if it hasn't been updated, assume that no blocks have been transferred successfully (the common case). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-10-26Convert op->drive_g from a 16bit pointer to a 32 bit "GLOBALFLAT" pointer.Kevin O'Connor1-51/+49
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>
2013-10-26Add pvscsi boot supportEvgeny Budilovsky1-0/+1
Testing was done on windows images (win 2008/2012) taken from esx with vmware tools installed and boot disk configured to use pvscsi. Also I've used linux (ubuntu 12.04) where pvscsi drivers are installed by default and booted it using qemu cmd similar to this: ./x86_64-softmmu/qemu-system-x86_64 -snapshot -device pvscsi,id=pvscsi0 \ -device scsi-disk,bus=pvscsi0.0,drive=drive0 \ -drive id=drive0,if=none,file=ubuntu-12.04.qcow2 \ -bios roms/seabios/out/bios.bin Signed-off-by: Evgeny Budilovsky <evgeny.budilovsky@ravellosystems.com>
2013-10-14Run ahci code entirely in 32bit mode.Kevin O'Connor1-3/+10
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>
2013-10-14Rename fields of 'struct chs_s' and use in floppy lba2chs().Kevin O'Connor1-19/+19
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>
2013-09-28Rename hw/cmos.h to hw/rtc.h and copy RTC code from clock.c to hw/rtc.c.Kevin O'Connor1-2/+2
Group the Real Time Clock code into hw/rtc.[ch]. Also, use rtc_read/write/mask function naming (instead of inb/outb_cmos) to be more consistent with other register accessors. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-09-18Split disk.h into block.h and std/disk.h.Kevin O'Connor1-1/+34
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-09-18Move function definitions for output.c from util.h to new file output.h.Kevin O'Connor1-4/+4
Also, sort the order of include files in the c files. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>