aboutsummaryrefslogtreecommitdiff
path: root/src/disk.c
AgeCommit message (Collapse)AuthorFilesLines
2017-09-27block: Rename disk_op_s->drive_gf to drive_flKevin O'Connor1-109/+109
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-5/+5
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>
2016-03-31disk: Avoid stack_hop() path if already on the extra stackKevin O'Connor1-11/+7
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-0/+32
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>
2015-08-17edd: Pass the segment/offset from int 1348 calls using a 'struct segoff_s'Kevin O'Connor1-1/+1
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-07-24Minor - move declaration of CDRom_locks to code that uses itKevin O'Connor1-0/+3
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-12-29block: Check for read/write requests over 64KKevin O'Connor1-0/+2
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-06-04Move most of the VAR16FIXED() defs to misc.c.Kevin O'Connor1-3/+0
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-1/+52
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-06-04cdemu: store internal cdemu fields in standard "el-torito" spec format.Kevin O'Connor1-7/+8
Store the fields necessary to export the "el-torito" spec information directly in an internal copy of the "el-torito" struct. This simplifies the interface and obviates the need for an internal home grown struct with the same info. 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-178/+3
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-12-12On disk format request, verify cylinders and pass to driver.Kevin O'Connor1-6/+7
The regs->ch field contains the cylinder to format on a disk_1305 call. Verify that parameter and pass to the low-level driver code. 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-130/+127
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-14Rename fields of 'struct chs_s' and use in floppy lba2chs().Kevin O'Connor1-21/+21
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-18Split disk.h into block.h and std/disk.h.Kevin O'Connor1-26/+2
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-5/+5
Also, sort the order of include files in the c files. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-09-18Move stacks.c definitions from util.h to new file stacks.h.Kevin O'Connor1-0/+1
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-09-18Rename util.c to string.c and introduce string.h.Kevin O'Connor1-0/+1
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-09-02Move code centered around specific hardware devices to src/hw/Kevin O'Connor1-3/+3
Move many C files from the src/ directory to the new src/hw/ directory. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-07-14PIC code cleanups.Kevin O'Connor1-2/+2
Preface PIC functions with a pic_ to provide a more consistent naming. Convert the irqmask code to a more consistent pic_irqmask_read/write/mask form. Move code from pic.h to pic.c. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-10-27Provide correct dpte pointer to indicate absence of dpteBruce Rogers1-1/+1
The Pheonix EDD v3.0 spec says that if no dpte is present, the dpte pointer should contain ffffh:ffffh, not the 0h:0h which is currently used. This bit me when using NetWare as a KVM guest. Signed-off-by: Bruce Rogers <brogers@suse.com>
2012-07-21Unify ATAPI command processing.Kevin O'Connor1-3/+3
Unify the ATA and AHCI ATAPI command processing into one function in block.c (process_atapi_op). This patch disables the existing handlers for ATA ATAPI isready and reset. However, it's unlikely that support is needed and it does not appear that the implemented support is fully correct. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-06-02Fix winxp boot regression introduced in ecdc655a.Kevin O'Connor1-2/+2
The winxp boot loader does something curious - it sets an int 0x1c handler, records the stack location, and then spins in place with irqs enabled. The 0x1c handler alters the memory just past the stack pointer so that when the timer irq returns the code jumps to a new location and stop spinning. The winxp code relies on the fact that a hw irq will always place 6 bytes at a specific location and that it can alter those bytes. The ecdc655a patch does a full backup/restore of the register state. Unfortunately, the restore overwrites the changes made by the winxp 0x1c handler. This patch reverts much of ecdc655a. Hardware irqs are still handled on the extra stack, but only the essential register state is backed up and restored. Also, stack_hop_back is changed to only use %sp when changing states - this enables the entry code to store just %esp instead of both %esp and %sp. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-05-30Rework disk.c:fillLCHS to avoid using pointer parameters.Kevin O'Connor1-17/+19
The compiler does a better job when passing parameters by value. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-05-30Run all hardware irq handlers on the extra stack.Kevin O'Connor1-2/+2
Jump into the extra stack for all hardware irq handlers. This reduces the overall stack requirements of SeaBIOS. Replace all users of call16_simpint with call16_int. Only the hardware irq handlers used the old call, and they need to use the new call to ensure the extra stack is properly re-entrant. Also, pass in a 'struct bregs' to the hardware irq handlers now. It was not done previously to save stack space. Now that the extra stack is used, that is no longer an issue. Note that should an old OS invoke a hardware irq in 16bit protected mode, then this patch could break that OS. However, the chances of this causing a regression seem small as several existing hardware irq handlers already do not work in 16bit protected mode. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-05-24Remove disk GET/SET_INT13DPT and GET/SET_INT13EXT macros.Kevin O'Connor1-56/+59
The code generation is better if explicit 'struct int13ext_s' and 'struct int13dpt_s' pointers are used instead. The code is a little easier to understand as well. This patch also forces disk_1348 to not be inlined. If it gets inlined into its caller it can increase the stack usage for all disk calls. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-05-20Convert disk code EBDA variables to VARLOW variables.Kevin O'Connor1-43/+32
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-03-25Mark disk.c functions that take an address of a stack variable as noinline.Kevin O'Connor1-6/+6
Some versions of gcc have been found to inline these funcions and then cause the calling functions to use very large stack usage. Since these functions are called from 16bit mode, their stack space usage is very sensitive. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-03-06add virtio-scsi driverPaolo Bonzini1-1/+2
virtio-scsi is a simple HBA that talks to the host via a single vring. The implementation looks like a hybrid of usb-msc and virtio-blk. Reviewed-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-02-11disk: handle LBA I/O with zero sector countKevin O'Connor1-0/+5
Unlike basic_access, extended_access does not check for a zero sector count. However, this is a problem because for example it would be interpreted as 256 when processing an ATA request. Based on patch from: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2011-11-17always specify virtio-blk rather than virtioPaolo Bonzini1-2/+2
Avoid ambiguity when virtio-scsi will be introduced. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-01-16support T13 EDD3.0 specGleb Natapov1-15/+27
Some guests (such as Linux) expect BIOS to behave according to T13 EDD3.0 spec. T13 spec is much better then Phoenix since it provides more information about interface and device paths. This patch adds support for the spec. If guest provides buffer with enough space for T13 EDD info return EDD according to T13 spec otherwise use Phoenix one. Signed-off-by: Gleb Natapov <gleb@redhat.com>
2010-12-29Remove Drives global struct in favor of independent global variables.Kevin O'Connor1-1/+1
The "Drives" struct just held three global variables - declare the three global variables independently.
2010-12-24Provide full EDD 3.0 info for virtio diskGleb Natapov1-53/+73
Fill out entire EDD 3.0 structure for virtio disk. Currently only EDD 1.0 part is filled which is missing such important info as device path. Use SCSI device type since virtio is not defined by EDD spec and virtio disk pci device uses SCSI class. Signed-off-by: Gleb Natapov <gleb@redhat.com>
2010-03-20Call to int1552 (from int1346) should set regs->dl.Kevin O'Connor1-0/+1
2010-02-28Dynamically allocate ata_channel info; introduce custom atadrive_s struct.Kevin O'Connor1-12/+16
Don't limit the number of ATA controllers supported - just dynamically allocate the structs. Create an atadrive_s struct that extends the standard 'struct drive_s' and have the new struct store a pointer to the ata channel info. Also, prefer storing drive_s pointers as 32bit "flat" pointers - adjust them as needed in the 16bit code.
2010-02-14Introduce standard warnings for allocation failures and timeouts.Kevin O'Connor1-7/+3
There is no need for custom warnings for many common failures. Introduce a common warning which is consistent and more visible.
2010-01-03Be sure to add "void" to all function prototypes that take no args.Kevin O'Connor1-1/+1
Omitting "void" leads to a K&R style declaration which was not intended.
2009-12-30Commit compiled dsdt file; misc comment updates.Kevin O'Connor1-0/+1
Commit new dsdt with recent changes. Add some misc comments. Also, fix uninitialized warning in mptable code.
2009-12-13Distinguish between debug reports for unimplemented vs invalid calls.Kevin O'Connor1-5/+16
Don't use "fail" in the debug output - as this confuses users. When reporting on an invalid parameter - use the word "invalid". When reporting on an unimplemented call - state it is unimplemented. Add separate debug levels for unimplemented vs invalid calls. Also, increase the debug level of several entry points.
2009-12-05Support ISA ATA devices for qemu's "-M isapc" mode.Kevin O'Connor1-9/+19
Add probing for ISA ATA devices when no pci devices found. Also, add defines for common ATA ports. Also, make sure irq and pci_bdf are defined for both pci ata controllers.
2009-11-25Misc updates.Kevin O'Connor1-1/+1
Update todo list. Fix spelling errors in acpi debug messages. Don't call DISK_STUB() in format - use debug_stub() instead.
2009-10-22Pass 'drive_s' pointer instead of driveid.Kevin O'Connor1-143/+131
Pass a pointer to the drive_s struct instead of a driveid array offset. Don't allocate ata drive's until a real drive found. Introduce getDrive() and allocDrive() functions.
2009-09-12Unify cd emulation access and main disk access code.Kevin O'Connor1-101/+65
Add a new backend driver for cd emulation (DTYPE_CDEMU). This backend driver now does the work of scheduling mis-sized reads. Add mechanism for obtaining emulated drive geometry. Extend disk_1308() to support cdrom emulation. Use regular disk_13*() calls even for cdemu. Also, unify the X_SECTOR_SIZE definitions.
2009-09-09Replace common segment/offset pairs with struct segoff_s.Kevin O'Connor1-3/+1
Introduce 'struct segoff_s' to more places.
2009-08-18Merge cdrom 13xx handlers with main disk 13xx handlers.Kevin O'Connor1-24/+112
Most of the cdrom_13 code did the same thing as disk_13 - so merge them together. Add definitions for 0xe0 (EXTSTART_CD) and 0x80 (EXTSTART_HD). This changes the behavior for cdroms on 1315 and 1316 calls - previously 1315 returned an error and set ah=2, now it sets ah=1 and doesn't return an error; previously 1316 returned ok, not it returns EPARAM.
2009-08-16Unify floppy and harddrive command routing.Kevin O'Connor1-40/+40
Implement low-level floppy commands using the disk_op structure. The requests can then be filled using the regular disk_13xx functions.
2009-08-16Unify some floppy and disk functions.Kevin O'Connor1-11/+49
Merge floppy_1301/1308/1315/1316/_ret() functions with their disk equivalents. Store floppy type in drives structure.
2009-08-16Change send_disk_op() to return the bios status code.Kevin O'Connor1-24/+10
2009-08-16Add floppy controllers to "drives" list also.Kevin O'Connor1-17/+21
The Drives.drives list now contains floppies, harddrives, and cdroms. Add mapping table for external/internal drive ids for floppies. Rename CONFIG_FLOPPY_SUPPORT to CONFIG_FLOPPY (for consistency). Be consistent with "driveid" and "floppyid" variable names. Replace switch statements of drive parameters into a global array. There are some externally visible changes with this patch: - Some calls will now return EPARAM instead of ETIMEOUT (or ECHANGED) - floppy_1301/1308 are now only available when regs->dl is valid - floppy_1308/1315 return EPARAM on invalid drives