aboutsummaryrefslogtreecommitdiff
path: root/src/ata.c
AgeCommit message (Collapse)AuthorFilesLines
2012-05-20Add mechanism to declare variables as "low mem" and use for extra stack.Kevin O'Connor1-4/+3
Add a mechanism (VARLOW declaration) to make a variable reside in the low memory (e-segment) area. This is useful for runtime variables that need to be accessed from 16bit code and need to be modifiable during runtime. Move the 16bit "extra stack" from the EBDA to the low memory area using this declaration mechanism. Also increase the size of this stack from 512 bytes to 2048 bytes. This also reworks tools/layoutrom.py a bit. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-03-21ata: send TEST UNIT READY correctlyPaolo Bonzini1-6/+8
The ATAPI driver does not need to support writes, but it does needs to avoid the PIO transfer and DRQ check when TEST UNIT READY is sent. Since TEST UNIT READY has no payload, checking for not busy is enough. This fixes a timeout when booting from CD/DVD, which fellaw@gmx.net reported to cause boot failures. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-07-10Push use of 'struct pci_device' to bootprio_find_ata_device().Kevin O'Connor1-9/+11
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2011-06-21Use 'struct pci_device' to note which devices have native drivers.Kevin O'Connor1-0/+1
Remove the check in optionroms.c for CONFIG_ATA and PCI_CLASS_STORAGE_IDE with a flag in 'struct pci_device'. This ensures devices using the ATA driver that aren't in PCI_CLASS_STORAGE_IDE don't have their optionroms executed. It also allows other drivers to disable option rom execution in the future.
2011-06-21Convert pci_init_device to use 'struct pci_device'.Kevin O'Connor1-6/+7
2011-06-20Convert ATA detection code to use struct pci_device.Kevin O'Connor1-10/+9
2011-06-19Rename foreachpci macro to foreachbdf.Kevin O'Connor1-2/+2
2011-06-19Add support for white-listing AHCI controllers as ATA compatible.Kevin O'Connor1-3/+19
To start, register the AMD ATA controller on the A50M chipset as compatible with ATA mode even if it comes up in AHCI mode.
2011-06-19Convert ATA pci scan to use pci_device_id table.Kevin O'Connor1-48/+56
2011-01-08Extract space trimming code from ATA and use in USB and bootorder code.Kevin O'Connor1-5/+1
Introduce function nullTrailingSpace() that nulls blank characters from the end of a string. Use this function in the ATA, USB MSC, and bootorder code.
2010-12-29Remove drive->desc field.Kevin O'Connor1-21/+17
The description field is only available during the POST phase - it is confusing to have it live in a structure available through all phases. The description was only used by the boot menu code - pass each drive description directly to the bootlist code. Add a helper (znprintf) to automatically malloc_tmp the required space. Also, fixup ramdisk handling - it was using an incorrect floppy priority.
2010-12-27Call setup_translation() from map_hd_drive().Kevin O'Connor1-3/+0
Unify the calling of setup_translation().
2010-12-27Add stubs to permit devices to specify their boot priority.Kevin O'Connor1-3/+10
Add support for passing in priorities to bootlist system. Based on patch by: Gleb Natapov <gleb@redhat.com>
2010-12-27Simplify boot ordering by building an inclusive boot list.Kevin O'Connor1-7/+6
Replace the bcv list with a full list of all "bootable objects". All ordering can then be done on this list. The final boot menu, drive mapping, and BEV list generation is then driven from this authoritative list. Move "Floppy" and "DVD/CD" description prefixes into drive description generation code to simplify boot menu generation. Rework QEMU's CMOS defined bootorder to work with priority scheme in new boot list. Have every CBFS entry create it's own BEV entry (instead of one entry for all CBFS payloads). Move CBFS payload detection code into coreboot.c.
2010-12-12Create separate IPL entry for each CD/DVDGleb Natapov1-1/+3
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>
2010-12-05Check if capability enabled in XXX_cmd_data functions.Kevin O'Connor1-0/+3
Make sure to check if CONFIG_AHCI, CONFIG_ATA, CONFIG_USB_MSC is enabled in their respective cmd_data functions. This reduces the compile size when they are not enabled.
2010-12-05ata: make helpers availableGerd Hoffmann1-9/+11
Make ata helper functions available outside ata.c, so others (i.e. upcoming ahci support) can use them. Prefix them with ata_ to avoid name clashes. Also don't hard-code buffer size for the model name. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2010-07-28Add FUNC16() helper macro for converting a 16bit func to a segoff_s.Kevin O'Connor1-1/+1
2010-06-10SeaBIOS CD/DVD abbreviationsStefan Reinauer1-1/+1
- Use the same description text for CD and DVD drives all over the tree. - Mention DVD first as it's more likely these days Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
2010-05-23Rename check_time() to check_tsc().Kevin O'Connor1-4/+4
2010-05-23Minor ata cleanups.Kevin O'Connor1-4/+10
Eliminate process_atapi_op() code if CONFIG_ATA not set. Use PCI_BASE_ADDRESS_IO_MASK instead of hardcoding it.
2010-04-17Minor - remove redundant check from ata_try_dma.Kevin O'Connor1-2/+0
2010-03-20Adjust debug levels of device discovery.Kevin O'Connor1-1/+3
Be sure to print at debug level 1 all devices found.
2010-02-28Dynamically allocate ata_channel info; introduce custom atadrive_s struct.Kevin O'Connor1-144/+140
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-21Cleanup - build drive description in temp memory during init.Kevin O'Connor1-54/+43
Remove describe_drive() mechanism for calling printf with a drive description. Instead, have each drive build a description in temporary ram during drive initialization. Also, remove fields now unneeded from 'struct disk_s' - model and cntl_info.
2010-02-17Move common "command data block" functions to new file blockcmd.c.Kevin O'Connor1-18/+4
Move common "cdb" request functions to a new file.
2010-02-15Dynamically allocate each drive_g with malloc_fseg().Kevin O'Connor1-4/+10
This eliminates the limit on the number of available drives. It also allows for each driver to allocate additional custom fields.
2010-02-15Add common "block command" definitions and update cdrom code.Kevin O'Connor1-28/+12
Introduce standard definitions and names for the "command data block" commands used in the cdrom code.
2010-02-14Introduce standard warnings for allocation failures and timeouts.Kevin O'Connor1-4/+4
There is no need for custom warnings for many common failures. Introduce a common warning which is consistent and more visible.
2010-02-13Add some ASSERT32FLAT() to help compiler eliminate dead code.Kevin O'Connor1-0/+1
The function pointer passed to run_thread() can confuse the compiler into thinking the function needs to be emitted. Add ASSERT32FLAT() to help the compiler eliminate this code.
2010-01-17Add CONFIG_ATA_DMA option; default to off for now.Kevin O'Connor1-1/+7
Allow compile option to disable ATA DMA support. Turn it off by default for now - some coreboot users are seeing issues with it.
2010-01-03Be sure to add "void" to all function prototypes that take no args.Kevin O'Connor1-2/+2
Omitting "void" leads to a K&R style declaration which was not intended.
2009-12-26Add initial support for ATA DMA.Kevin O'Connor1-68/+298
Add support for detecting and using SFF 8038 compatible PCI devices. Currently, only ATA transfers (not ATAPI) will use DMA.
2009-12-13ATA 48bit LBA should only be activated on read/write commands.Kevin O'Connor1-1/+2
Check explicitly for an extended read/write command instead of 0x04 bit set. The identify command has that bit set, but doesn't need the 48bit lba registers set.
2009-12-05Fix ATA iobase2 access on PCI native mode interfaces.Kevin O'Connor1-4/+11
The ctrl register is iorange + 2 not iorange + 6. Rework port definitions to be based on PCI offsets instead of ISA. Also, properly define ATA irqs when in PCI compatibility mode.
2009-12-05Support ISA ATA devices for qemu's "-M isapc" mode.Kevin O'Connor1-19/+30
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-20Make sure to reenable ata interrupts even on error.Kevin O'Connor1-28/+36
If the ata command fails, be sure to reenable errors. This fixes a report of MS Vista not seeing a cdrom drive.
2009-10-24Add simple cooperative threading scheme to allow parallel hw init.Kevin O'Connor1-14/+14
Enable system for running hardware initialization in parallel. The yield() call can now round-robin between "threads". Rework ata controller init to use a thread per controller. Make sure internal drives are registered in a defined order. Run keyboard initialization in a thread. Rework usb init to use a thread per controller.
2009-10-24Replace irq_enable() regions with explicit calls to check for irqs.Kevin O'Connor1-1/+3
Add new function yield() which will permit irqs to trigger. The yield() call enables irqs to occur in 32bit mode. Add [num]sleep calls that yield instead of just spinning. Rename existing int 1586 usleep call to biosusleep. Convert many calls to mdelay to msleep.
2009-10-22Handle tsc rollover.Kevin O'Connor1-3/+3
Handle case where timetamp counter overflows while waiting.
2009-10-22Pass 'drive_s' pointer instead of driveid.Kevin O'Connor1-79/+84
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-7/+4
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-12Add mechanism for describing internal drives in boot menu.Kevin O'Connor1-26/+40
Allow each drive type to describe itself on the boot menu. This fixes a bug where driveid was used in place of ataid in the boot menu. Also, expand descriptions for each drive type. Don't overload the IPL type for BCVs - instead introduce new types.
2009-09-09Rename VAR16_32 to VAR16VISIBLE.Kevin O'Connor1-1/+1
Sometimes VAR16_32 is used to export a definition to assembler, so clarify its naming.
2009-08-18Work around qemu quirk - dh not reset on ata drive reset.Kevin O'Connor1-0/+3
2009-08-16Unify floppy and harddrive command routing.Kevin O'Connor1-2/+10
Implement low-level floppy commands using the disk_op structure. The requests can then be filled using the regular disk_13xx functions.
2009-08-16Change send_disk_op() to return the bios status code.Kevin O'Connor1-5/+18
2009-08-16Add floppy controllers to "drives" list also.Kevin O'Connor1-2/+3
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-11Separate ATA code from generic disk code.Kevin O'Connor1-230/+54
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-11Minor - remove ATA specific version field from ATA.devices[].Kevin O'Connor1-10/+15