aboutsummaryrefslogtreecommitdiffstats
path: root/src/cdrom.c
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* Extract 'struct bregs' out of biosvar.h; clean up header includes.Kevin O'Connor2008-07-041-0/+2
|
* Improve some debugging output.Kevin O'Connor2008-06-281-16/+13
| | | | | | Replace DEBUGF calls with dprintf calls. Make ata calls consistently use 'int' return codes. Make each error return code in ata.c use a unique negative number.
* Improve control of debug messages.Kevin O'Connor2008-05-241-1/+1
| | | | | | Rename BX_INFO() to dprintf() and add a "severity level" parameter. Add CONFIG_DEBUG_LEVEL compile option to control debug verbosity. Add more debug info to init steps of post.c.
* Reduce ide stack usage by reorganizing ata calls.Kevin O'Connor2008-05-131-1/+1
| | | | Break up some functions and play with inlining to reduce stack usage.
* Compile fixes for gcc 4.3.Kevin O'Connor2008-04-131-1/+1
| | | | | Clean up some warnings. Make sure floppy_dbt structure is aliagned to 1 byte boundary.
* Limit cdrom emulation available functions.Kevin O'Connor2008-03-221-2/+17
| | | | | The extended read methods must be disabled. Resynch with original bochs bios list of available functions.
* Cleanup cdrom emulation.Kevin O'Connor2008-03-221-23/+20
| | | | | | | | | Remove 'header' param for ata_cmd_packet - the only code that uses it is cdrom emulation. So, bury this detail in ata.c. Introduce new helpers cdrom_read_emu and cdrom_read_512 for working with emulated cdrom drives. Unify basic_access() and emu_access() - now basic_access() can read from cdrom drives.
* Use "FARPTR" consistently in macros.Kevin O'Connor2008-03-221-5/+5
| | | | | | Rename MAKE_32_PTR to MAKE_FARPTR. Rename PTR_TO_SEG to FARPTR_TO_SEG. Rename PTR_TO_OFFSET to FARPTR_TO_OFFSET.
* Breakout cdrom emulation support into CONFIG_CDROM_EMU.Kevin O'Connor2008-03-221-25/+34
| | | | | This allows one to support just booting from cdroms that don't require floppy/harddisk emulation.
* Use 32bit absolute pointers for buffers in ATA code.Kevin O'Connor2008-03-121-5/+9
| | | | | | | | | | Using 32bit pointers makes the code a little simpler. It also allows the code to be used from 32 bit mode. It does require all callers to encode the segment/offset into an absolute address. The ins/outs functions also need to know how to convert from 32bit back to segment/offset addresses. The change also includes a minor cleanup of the macros in farptr.h.
* Fix bug in atapi_get_sense.Kevin O'Connor2008-03-111-2/+2
| | | | | Buffer size was in wrong argument position. Clarify code by using sizeof().
* Minor debugging improvements.Kevin O'Connor2008-03-091-3/+4
|