aboutsummaryrefslogtreecommitdiff
path: root/src/disk.c
AgeCommit message (Collapse)AuthorFilesLines
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
2009-08-11Store cdrom emulated driveid directly.Kevin O'Connor1-1/+1
2009-08-11Use variable name "driveid" consistently (instead of "device").Kevin O'Connor1-104/+104
2009-08-11Separate ATA code from generic disk code.Kevin O'Connor1-37/+37
Move generic code from ata.c to new file block.c. Rename atabits.h to ata.h and move ata header definitions from disk.h. Rename ATA.channels to ATA_channels. Rename ATA structure to Drives. Support both CONFIG_DRIVES and CONFIG_ATA options.
2009-08-11Densely populate ATA.devices list.Kevin O'Connor1-12/+12
Populate ATA.devices in order of drives found; the array index no longer correlates with the ATA.channels list. Add cntl_id to device struct for finding the channel info.
2009-08-10Misc ATA cleanups.Kevin O'Connor1-13/+15
Remove some unused defines. Rename ATA_TYPE_* to DTYPE_* and move from atabits.h to disk.h. Rename ATA_TRANSLATION_* to TRANSLATION_* and move from atabits.h to disk.h. Convert bios is-drive-ready call to use send_disk_op(). Only add atapi devices to the cdmap if they are cd/dvd roms. Remove 'device' from struct ata_devices_s.
2009-08-09Route disk_op commands by drive type - not by command.Kevin O'Connor1-27/+23
Don't confuse op->command with low-level ata cmd->command. Modify __send_disk_op to route commands by drive type. Add commands for verify and seek operations. Do ata resets via disk_op also.
2009-08-09Remove unused cdemu ATA code.Kevin O'Connor1-2/+1
Remove the low-level ATA code for short reads on cdroms now that cd emulation is done at higher-level. Also, remove sector_count from ebda - ata code updates op->count now.
2009-08-09Implement cdrom disk emulation at high-level instead of in low-level ATA.Kevin O'Connor1-32/+69
Add a 2K buffer to the ebda to allow for cdrom 512 byte vs 2048 byte sector emulation. For unaliagned cdemu reads, just make multiple cdrom reads instead of using ata specific code for short reads. Also, define cdemu virtual sectors using struct chs_s, and update legacy_lba() func to take pointer to a chs_s struct.
2009-08-09Separate cdemu disk accesses from regular disk accesses.Kevin O'Connor1-53/+73
Breakup basic_access() into basic_access, cdemu_access, and legacy_lba. Also, check for verify and seek calls in __send_disk_op instead of all callers. Also, send_disk_op returns sector count in dop.count instead of via ebda.
2009-02-27Don't 'autodetect' ATA PIO32 mode - use compile def instead.Kevin O'Connor1-2/+1
The PIO32 detection appears to use a hack built for emulators. It wont work on real hardware. Implement with a compile time define instead. This also improves the quality of the compiled code.
2009-02-17Bug fix - cdrom media emulation only moves drives if of the same type.Kevin O'Connor1-2/+3
The bug caused floppies to move when hard drive emulation was in effect, and vice-versa. This patch fixes it.
2009-01-21Fix apparent bug in int1348 -- checksum didn't have regs->si offset.Kevin O'Connor1-1/+2
2009-01-19Implement memcpy_far and checksum_far, and replace _fl variants.Kevin O'Connor1-8/+8
The "flat" mode variants work in real mode, but will not work in protected mode. So, replace with versions that take explicit segments.
2009-01-19Rename MAKE_FARPTR (and similar) to MAKE_FLATPTR.Kevin O'Connor1-8/+8
The term "far pointer" is used in many 16bit specs, and it is different from what MAKE_FARPTR creates. So, use the term "flat pointer" in the code to distinguish between the two meanings. Also, use the suffix "_fl" consistently when working with "flat pointers".
2009-01-17Add extra test for CONFIG_ATA in src/disk.c.Kevin O'Connor1-0/+3
All the paths to send_disk_op apparently confuses gcc into always emitting __send_disk_op even when it can't be called. Add an extra exlicit check to help gcc out.
2009-01-17Move variables from assembler to C code.Kevin O'Connor1-0/+3
Define macro VAR16FIXED for declaring a variable at a fixed location. Introduce new file src/misc.c, and move non int15 calls from system.c to it. Implement all fixed location variables in C code. Move IDT/GDT defs to misc.c. Remove unused gdt entry 1.
2009-01-15Change license from GPLv3 to LGPLv3.Kevin O'Connor1-1/+1
Change license of contributions from Kevin O'Connor from GPLv3 to LGPLv3 (or later). Since the work as a whole is based on Kevin's contributions and the "bochs bios" which has a license of LGPL (v2 or later), this effectively makes the work as a whole available under LGPLv3 (or later).
2009-01-02Improve set_code_fail/floppy_ret/disk_ret code generation.Kevin O'Connor1-7/+8
Encode lineno and return code into one u32 parameter. This reduces the number of functions arguments to 3 - which gcc does a better job of scheduling. Also, consistently place *regs parameter in the first arg.
2009-01-02Fix bug in basic_access error path.Kevin O'Connor1-0/+1
A missing 'return' statement caused the error to not be returned.
2009-01-01Switch to new stack when calling ATA function in 16bit mode.Kevin O'Connor1-9/+20
This reduces stack usage (old dos programs don't provide much space).
2008-12-31Use new 'struct disk_op_s' to issue ata requests.Kevin O'Connor1-36/+51
Using the struct at all callers reduces the parameter assignments. Replace ata_op_s with new disk_op_s and update all users. Unify basic/extended_access methods to use new send_disk_op() func. Remove cdrom_read_emu -- integrate logic into callers. Remove ata.h -- move all defs to disk.h
2008-12-31Return CDEMU parameters to ebda segment (instead of using globals).Kevin O'Connor1-6/+8
The cdemu is setup in the boot stage after globals are made read-only. So, globals can't be used. Also, move hdcount from a global to BDA (it should be in BDA). Don't attempt to set blksize/sector count in atapi_is_ready() - it's not useful.
2008-12-29Introduce GET/SET_EBDA2() macros - they take a cached ebda seg.Kevin O'Connor1-16/+17
For those places that repeatedly read/write to the ebda, caching the ebda segment improves code generation.
2008-12-28Move most of ATA and CDEMU from ebda to global variables.Kevin O'Connor1-48/+48
The dpte, cdrom locks, and disk sector count remain in the ebda. Also, enhance SET_GLOBAL macro to avoid unused variable warnings.
2008-12-26Support a relocatable ebda segment.Kevin O'Connor1-2/+2
Some option roms will try to relocate the ebda. Also fix an apparent typo in the assignment of ivecs[0x46].
2008-10-26Misc minor cleanups.Kevin O'Connor1-1/+1