aboutsummaryrefslogtreecommitdiffstats
path: root/src/cdrom.c
Commit message (Collapse)AuthorAgeFilesLines
* cdrom: Demote `scsi_is_ready` return print to debug levelPaul Menzel2020-05-211-1/+1
| | | | | | | | | | | | | Printing the return value of `scsi_is_ready()` is a debug message, so change the log level from 1 to 5. Booting from DVD/CD... Device reports MEDIUM NOT PRESENT scsi_is_ready returned -1 Boot failed: Could not read from CDROM (code 0003) Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
* pretty boot menu entry for cdrom drivesGerd Hoffmann2018-10-051-0/+46
| | | | | | Show the volume label of bootable cdroms. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* block: Rename disk_op_s->drive_gf to drive_flKevin O'Connor2017-09-271-3/+3
| | | | | | | | | | 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>
* Minor - move declaration of CDRom_locks to code that uses itKevin O'Connor2015-07-241-3/+0
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* block: Rename process_XXX_op() functions to XXX_process_op()Kevin O'Connor2015-07-141-1/+1
| | | | | | Rename disk driver dispatch functions to a consistent naming style. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* block: Route scsi style commands through 'struct disk_op_s'Kevin O'Connor2015-07-141-3/+3
| | | | | | | | | Support sending scsi style "command data block" commands (cdbcmd) through the 'struct disk_op_s' command request structure. And change the blockcmd.c and cdrom.c code to route these commands through the process_op() code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* block: Introduce default_process_op() with common command handling codesKevin O'Connor2015-07-141-6/+1
| | | | | | | | 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>
* Make sure all code checks for malloc failuresKevin O'Connor2015-07-041-1/+0
| | | | | | | | This is the result of an audit of callers of the malloc_XXX() and memalign_XXX() calls. All callers need to check if these functions return NULL. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Add 'measurement' code to the BIOSStefan Berger2015-06-011-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds invocations of functions that measure various parts of the code and data through various parts of the BIOS code. It follows TCG specifications on what needs to be measured. It also adds the implementation of the called functions. Reference for what needs to be measured can be found in specs found here: http://www.trustedcomputinggroup.org/resources/pc_client_work_group_specific_implementation_specification_for_conventional_bios The first measurements are done once the ACPI tables have been initialized. Once booted into Linux, the current measurements produce the following logs which can be found in /sys/kernel/security/tpm0/ascii_bios_measurements. The below log also shows measurements from trusted grub. 1 3fb240d2a04085a4e84f81e4398e070ed5a18163 06 [SMBIOS] 2 cc812353fc277c1fab99e0b721752a1392984566 06 [Option ROM] 2 9dbd87163112e5670378abe4510491259a61f411 05 [Start Option ROM Scan] 2 6f74e357331b8dee11bbad85f27bc66cb873106c 06 [Option ROM] 2 5626eb7ac05c7231e46d7461e7d3839b03ae9fad 06 [Option ROM] 4 c1e25c3f6b0dc78d57296aa2870ca6f782ccf80f 05 [Calling INT 19h] 0 d9be6524a5f5047db5866813acf3277892a7a30a 04 [] 1 d9be6524a5f5047db5866813acf3277892a7a30a 04 [] 2 d9be6524a5f5047db5866813acf3277892a7a30a 04 [] 3 d9be6524a5f5047db5866813acf3277892a7a30a 04 [] 4 d9be6524a5f5047db5866813acf3277892a7a30a 04 [] 5 d9be6524a5f5047db5866813acf3277892a7a30a 04 [] 6 d9be6524a5f5047db5866813acf3277892a7a30a 04 [] 7 d9be6524a5f5047db5866813acf3277892a7a30a 04 [] 4 8cf2fe6c87d4d0b2998a43da630292e6d85ee8b6 05 [Booting BCV device 80h (HDD)] 4 5dff94459a3e2d13a433ef94afdc306144565bf7 0d [IPL] 5 d1b33afde65ad47502332af957c60f20c84c1edc 0e [IPL Partition Data] 4 487ce764b527ccad17f1d04243d0136fa981e6c4 0d [IPL] 4 91d285e4dead566324c8938a3cc75803f462d9a1 0d [IPL] 4 8ba79ac98bb491524fef29defc724daaf6263d35 0d [IPL] 4 c591c15b82e4ff30e7383a4ff1ef3b41b38521ac 06 [] 4 8cdc27ec545eda33fbba1e8b8dae4da5c7206972 04 [Grub Event Separator] 5 8cdc27ec545eda33fbba1e8b8dae4da5c7206972 04 [Grub Event Separator] 5 e8673b9e14b02dc12d8ccfd0176bca7a3de7fc3c 0e [IPL Partition Data] 5 0163e375a0af7525c5dac1a8e74b277359e40d1d 1105 [] 8 4be30f67c3d48ab7f04d9c0fd07f06d4c68379be 1205 [] 8 54c83965978de9708d026016ecb0e70660e04388 1305 [] 5 2431ed60130faeaf3a045f21963f71cacd46a029 04 [OS Event Separator] 8 2431ed60130faeaf3a045f21963f71cacd46a029 04 [OS Event Separator] 8 f3973cae05d6e2055062119d6e6e1e077b7df876 1005 [] Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
* cdrom: Break up very large read requests into smaller requestsKevin O'Connor2014-12-291-4/+13
| | | | | | | | | A cdrom boot image could be over 64K in size, but the low level drivers may not support very large reads. If a large cdrom image is found, issue multiple reads so that a read request over 64K is never issued. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* cdrom: call scsi_process_op() instead of cdb_read()Kevin O'Connor2014-12-291-3/+4
| | | | | | | Use the scsi_process_op() function instead of the lower level cdb_read() function. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Move cdemu call interface and disk_ret helper code to disk.c.Kevin O'Connor2014-06-041-17/+0
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* cdemu: store internal cdemu fields in standard "el-torito" spec format.Kevin O'Connor2014-06-041-47/+25
| | | | | | | | | 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>
* Remove unnecesary updates of the disk op->count field.Kevin O'Connor2013-12-271-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>
* Convert op->drive_g from a 16bit pointer to a 32 bit "GLOBALFLAT" pointer.Kevin O'Connor2013-10-261-16/+15
| | | | | | | | | | | | 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>
* Rename fields of 'struct chs_s' and use in floppy lba2chs().Kevin O'Connor2013-10-141-15/+15
| | | | | | | | | | 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>
* Split disk.h into block.h and std/disk.h.Kevin O'Connor2013-09-181-16/+3
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Move function definitions for output.c from util.h to new file output.h.Kevin O'Connor2013-09-181-3/+3
| | | | | | Also, sort the order of include files in the c files. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* 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.