aboutsummaryrefslogtreecommitdiffstats
path: root/src/cdrom.c
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* Rename util.c to string.c and introduce string.h.Kevin O'Connor2013-09-181-1/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Move code centered around specific hardware devices to src/hw/Kevin O'Connor2013-09-021-2/+2
| | | | | | Move many C files from the src/ directory to the new src/hw/ directory. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Use CONFIG_ prefix for Kconfig variables; use BUILD_ for others.Kevin O'Connor2013-02-201-1/+1
| | | | | | | Rename remaining "build" settings in config.h that used the CONFIG_ prefix to use a BUILD_ prefix. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Convert VAR16VISIBLE, VAR16EXPORT, and VAR32VISIBLE to VARFSEG.Kevin O'Connor2013-02-181-1/+1
| | | | | | | | | | | Convert all users of the alternative variable exports to VARFSEG. There isn't a significant distinction between the existing types of exports, so it's simpler to just use one type going forward. The new VARFSEG declaration is only emitting when in 32bit mode, so update and move some variables as needed. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Normalize POST initialization function name suffixes.Kevin O'Connor2013-02-051-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The POST phase has to invoke many initialization functions, and these functions can have complex inter-dependencies. Try to categorize the functions into 4 classes: preinit - functions called very early in POST where function ordering is very important and the code has limited access to other interfaces. init - functions that initialize internal interfaces and standard external interfaces. This code is generally not dependent on particular hardware and typically does not communicate directly with any hardware devices. setup - functions which access hardware or are dependent on particular hardware or platform devices. prepboot - functions that finalize internal interfaces and that prepare for the boot phase. This patch attempts to normalize the suffixes - functions that used _init(), _setup(), _finalize(), or similar that did not follow the above pattern were renamed. Other than function name changes, there should be no code impact to this patch. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Unify ATAPI command processing.Kevin O'Connor2012-07-211-1/+1
| | | | | | | | | | | 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>
* Minor - remove CLEARBITS_BDA and SETBITS_BDA macros.Kevin O'Connor2012-06-101-1/+1
| | | | | | | Remove these infrequently used macros and replace with explicit GET_BDA/SET_BDA calls. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Convert disk code EBDA variables to VARLOW variables.Kevin O'Connor2012-05-201-42/+42
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* usb-msc: go through TEST UNIT READY for hard disks.Paolo Bonzini2011-11-171-46/+2
| | | | | | | Add the wait loop that CDs are already using to usb-msc in the HD case, to cope with a NOT READY or UNIT ATTENTION condition. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* cdrom: use TEST UNIT READY to detect ready mediumPaolo Bonzini2011-11-171-13/+3
| | | | | | | | | The READ CAPACITY output is not used except for some debugging messages. In the future, we will use this code for USB sticks too, but those already send READ CAPACITY. To avoid code duplication, switch to TEST UNIT READY for this task. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* ahci/cdrom: shared bounce bufferGerd Hoffmann2011-08-061-6/+4
| | | | | | | This patch creates a common bounce buffer in block.c which is shared by the cdrom and ahci drivers. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* Remove Drives global struct in favor of independent global variables.Kevin O'Connor2010-12-291-1/+1
| | | | | The "Drives" struct just held three global variables - declare the three global variables independently.
* Create separate IPL entry for each CD/DVDGleb Natapov2010-12-121-3/+4
| | | | | | | | | | Current code creates only one IPL entry of type IPL_TYPE_CDROM even if there are more then one CDROM drive present. If CDROM that the entry refers to is not bootable there is no way to retry boot from another CDROM. Fix this by creating IPL entry for each CDROM drive found. First CDROM will always be placed in IPL entry 3 for backwards compatibility. Signed-off-by: Gleb Natapov <gleb@redhat.com>
* Cleanup - it's no longer necessary to manually reset global variables.Kevin O'Connor2010-09-251-2/+0
| | | | | Now that a soft-reboot forces a hard-reboot, it is no longer necessary to manually reset global variables.
* Allocate cdemu buffer in low mem instead of ebda.Kevin O'Connor2010-06-061-15/+18
| | | | | | | Using the low memory buffer gives more flexibility with the final location of the buffer. Don't allocate the buffer at all if no cdrom drives are present.
* Rename check_time() to check_tsc().Kevin O'Connor2010-05-231-1/+1
|
* Dynamically allocate ata_channel info; introduce custom atadrive_s struct.Kevin O'Connor2010-02-281-8/+11
| | | | | | | | | | | 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.
* Move common "command data block" functions to new file blockcmd.c.Kevin O'Connor2010-02-171-48/+11
| | | | Move common "cdb" request functions to a new file.
* Dynamically allocate each drive_g with malloc_fseg().Kevin O'Connor2010-02-151-4/+6
| | | | | This eliminates the limit on the number of available drives. It also allows for each driver to allocate additional custom fields.
* Add common "block command" definitions and update cdrom code.Kevin O'Connor2010-02-151-33/+36
| | | | | Introduce standard definitions and names for the "command data block" commands used in the cdrom code.
* Be sure to add "void" to all function prototypes that take no args.Kevin O'Connor2010-01-031-1/+1
| | | | Omitting "void" leads to a K&R style declaration which was not intended.
* Handle tsc rollover.Kevin O'Connor2009-10-221-1/+1
| | | | Handle case where timetamp counter overflows while waiting.
* Pass 'drive_s' pointer instead of driveid.Kevin O'Connor2009-10-221-30/+27
| | | | | | 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.
* Unify cd emulation access and main disk access code.Kevin O'Connor2009-09-121-68/+96
| | | | | | | | | 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.
* Merge cdrom 13xx handlers with main disk 13xx handlers.Kevin O'Connor2009-08-181-164/+9
| | | | | | | | | | 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.
* Add floppy controllers to "drives" list also.Kevin O'Connor2009-08-161-1/+1
| | | | | | | | | | | | 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
* Store cdrom emulated driveid directly.Kevin O'Connor2009-08-111-11/+11
|
* Use variable name "driveid" consistently (instead of "device").Kevin O'Connor2009-08-111-50/+50
|
* Separate ATA code from generic disk code.Kevin O'Connor2009-08-111-5/+5
| | | | | | | | 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.
* Misc ATA cleanups.Kevin O'Connor2009-08-101-3/+1
| | | | | | | | | 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.
* Route disk_op commands by drive type - not by command.Kevin O'Connor2009-08-091-2/+3
| | | | | | | 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.
* Implement cdrom disk emulation at high-level instead of in low-level ATA.Kevin O'Connor2009-08-091-18/+19
| | | | | | | | | 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.
* Separate cdemu disk accesses from regular disk accesses.Kevin O'Connor2009-08-091-7/+15
| | | | | | | 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.
* Use regular CD reading to load initial CDROM boot image.Kevin O'Connor2009-08-091-3/+3
| | | | | | | Use cdrom_read() instead of cdrom_read_512() for loading the initial image. The initial image will always start on a 2K block, and it should be okay to load extra sectors if the sector count doesn't end on a 2K boundary.
* Replace memeq/streq functions with memcmp/strcmp.Kevin O'Connor2009-04-181-1/+1
| | | | The standard functions are better known and not harder to implement.
* Initial support for finding option roms in coreboot flash layout.Kevin O'Connor2009-04-111-17/+2
| | | | | | | Add code to search for roms in the "coreboot file system". Change hardcode option rom detection to use vendor/deviceid instead of bus/device/fn. Move streq() function to generic place so cbfs functions can use it.
* Enhance boot menu to allow user to select which CD drive to boot from.Kevin O'Connor2009-02-161-32/+11
|
* Enhance cdrom capacity/media sensing timers.Kevin O'Connor2009-02-121-38/+41
| | | | | | Don't just loop 50/300 times for 5/30 seconds - use real timers. Reorganize code - move read capacity to its own function. Fix apparent bug - atapi_get_sense() returns zero on success.
* Introduce MBR struct; simplify cdrom emulation code.Kevin O'Connor2009-02-071-27/+27
| | | | | | | Define and use a struct for the master boot record. Simplify cdrom emulation chs setting code. Fix an apparent bug in harddrive chs setting - it wasn't properly masking the spt/cyl fields.
* Rename MAKE_FARPTR (and similar) to MAKE_FLATPTR.Kevin O'Connor2009-01-191-4/+4
| | | | | | | | 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".
* Change license from GPLv3 to LGPLv3.Kevin O'Connor2009-01-151-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).
* Use new 'struct disk_op_s' to issue ata requests.Kevin O'Connor2008-12-311-15/+13
| | | | | | | | 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
* Return CDEMU parameters to ebda segment (instead of using globals).Kevin O'Connor2008-12-311-52/+50
| | | | | | | | 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.
* Introduce GET/SET_EBDA2() macros - they take a cached ebda seg.Kevin O'Connor2008-12-291-4/+6
| | | | | For those places that repeatedly read/write to the ebda, caching the ebda segment improves code generation.
* Add more linker protections around variables accessed from 16bit mode.Kevin O'Connor2008-12-291-1/+1
| | | | | | | Rename VAR16 to VAR16_32 -- that macro supports accesses from both 16bit and 32bit mode. Introduce a new macro VAR16 that must be present on all global variables accessed from 16bit mode.
* Move most of ATA and CDEMU from ebda to global variables.Kevin O'Connor2008-12-281-55/+57
| | | | | The dpte, cdrom locks, and disk sector count remain in the ebda. Also, enhance SET_GLOBAL macro to avoid unused variable warnings.
* Implement GET/SET_GLOBAL(...) instead of using GET/SET_VAR(CS, ...)Kevin O'Connor2008-12-131-1/+1
|
* Make sure to exit from cdrom_boot() if a cdrom is not found.Kevin O'Connor2008-11-091-0/+3
|
* Misc fixes and updates.Kevin O'Connor2008-07-191-5/+1
| | | | | | | | Minor code cleanups. Fix parenthesis imbalance in keyboard led test. The printf() call is only used in 32bit mode - make this explicit to the compiler - it improves the code generation. Clear the screen after initializing the vga option rom.