aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2015-10-15malloc: Use consistent naming for internal low-level "alloc" functionsKevin O'Connor1-51/+51
Use the "alloc_" prefix for all the low-level allocation functions and avoid camelCase naming. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-10-15virtio: Move standard definitions from virtio-ring.h to standard headersKevin O'Connor4-8/+16
Move PAGE_SHIFT / virt_to_phys() to memmap.h and smp_[rw]mb() to x86.h. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-10-15virtio: Simplify vring alignment codeKevin O'Connor1-20/+9
Don't do phys_to_virt(virt_to_phys(vaddr)) for page alignment - page alignment can be determined directly from the virtual address. Use the ALIGN() macro to make the code more readable. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-10-15e820: Update debugging messages to report 64bit valuesKevin O'Connor1-1/+1
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-10-15e820: Rename memmap.c to e820map.c and use consistent "e820_" prefixKevin O'Connor12-65/+72
Rename memmap.c to e820map.c as the code in that file only deals with maintaining the e820 map. Move all the e820 definitions to new file e820map.h and use a consistent "e820_" prefix on all exported functions. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-10-15e820: Introduce e820_remove() and avoid exporting E820_HOLEKevin O'Connor3-3/+11
The E820_HOLE definition is used internally in the e820 manipulation code to remove entries from the e820 map. Introduce the e820_remove() function so that the E820_HOLE definition does not need to be exported from the memmap.c code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-10-09Fix typos found by codespellStefan Weil10-11/+11
Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-10-09Always enable caching on transition32; backup/restore cr0 on call32Kevin O'Connor5-26/+35
Always enable caching at start of 32bit code and always make sure the paging flag is off. Because this alters the cr0 register, perform a backup and restore of it when using call32(). Also, rename get/setcr0() to cr0_read/write() to more closely match other register access functions. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-10-09Consolidate code16*() functionsKevin O'Connor1-34/+27
Introduce code16_override() for cases where call16() should not restore the previous 16bit state. All callers now use call16_back() to invoke 16bit code, so rename call16_back() to call16(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-09-14Use transition32_nmi_off from call32() and call16_back()Kevin O'Connor2-2/+3
The call32() and call16_back() functions will always disable NMI and enable a20 (via the call32_prep() function) so it is safe to use the _nmi_off variant of transition32. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-09-14Unify call32_sloppy() and call32()Kevin O'Connor1-18/+12
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-09-14Unify inline assembler in variants of call16 functionsKevin O'Connor2-77/+34
The assembler between call16(), call16big() and call16_sloppy() are very similar. Rework the functions so that a single version of the inline assembly can be used for all variants. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-09-14Rename Call32Data to Call16DataKevin O'Connor1-29/+29
The variable stores information on how and what to restore during a call to 16bit code, so Call16Data is a better name. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-09-14Unify smm/sloppy variants of call32_prep/post and call16_helperKevin O'Connor1-82/+50
The "smm" and "sloppy" variants of the 16bit to 32bit trampoline backup/restore code are very similar. They can be unified into a single copy of each function. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-09-03Simplify transition16/32 assembler codeKevin O'Connor1-49/+40
Backup and restore %eax only around code that needs to use %eax. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-09-03minor - correct spelling error in commentKevin O'Connor1-1/+1
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-09-03megasas: Use outl() on MFI_IDB registerKevin O'Connor1-1/+1
The outw() should be an outl(). Reported-by: Stefan Weil <sw@weilnetz.de> Reported-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-09-03megasas: Fix outw, outl argument orderStefan Weil1-4/+4
The value is the first argument and the port is the second, but the code was using the opposite order. Cc: Hannes Reinecke <hare@suse.de> Signed-off-by: Stefan Weil <sw@weilnetz.de>
2015-09-03sdcard: Obtain card capacity and report it on the boot menuKevin O'Connor1-5/+43
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-09-03sdcard: Display sdcard product name in boot menuKevin O'Connor1-2/+10
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-09-03sdcard: Turn card_type into a bitmap and store if card is MMC typeKevin O'Connor1-10/+9
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-09-03sdcard: Move drive registration to sdcard_card_setup()Kevin O'Connor1-15/+15
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-09-03sdcard: Move frequency setting into sdcard_card_setup()Kevin O'Connor1-8/+10
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-09-03sdcard: Move sdcard_set_frequency()/sdcard_set_power() in sdcard.cKevin O'Connor1-58/+58
Just code movement; no code changes. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-09-01rtc: Disable NMI in rtc_mask()Kevin O'Connor1-0/+1
The rtc_mask() function should make sure the NMI disable bit is set (just as rtc_read() and rtc_write() do). Reported-by: Tim Shearer <tim.shearer@overturenetworks.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-08-24xhci: Minor - add USB port type comments to xhci_hub_reset()Kevin O'Connor1-0/+2
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-08-24sdcard: Allow sdcard addresses to be specified in CBFS filesKevin O'Connor1-12/+36
Allow a hardcoded address to be specified in cbfs files with a prefix of "etc/sdcard". Some real-world devices have valid SDHCI controllers that do not show up as PCI devices. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-08-24ps2: Eliminate "etc/ps2-poll-only"; use CONFIG_HARDWARE_IRQ insteadKevin O'Connor1-10/+6
The "etc/ps2-poll-only" runtime setting is directly tied to the new CONFIG_HARDWARE_IRQ setting - use the compile time setting to control both. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-08-24Add minimal support for machines without hardware interruptsKevin O'Connor7-8/+62
Some Chromebooks (with Baytrail CPUs) apparently do not support routing of legacy interrupts. This patch adds minimal support for running SeaBIOS in such an environment. Even with this patch, it is known that old operating systems and even some recent bootloaders will not function without real hardware interrupts. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-08-17rtc: Support disabling the RTC timer irq supportKevin O'Connor4-2/+28
Add a build time config option to remove support for RTC timer interrupts along with the associated bios calls requiring that support. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-08-17sdcard: Allow the sdcard driver to run on real hardwareKevin O'Connor2-7/+1
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-08-17sdcard: Initial support for MMC cardsKevin O'Connor1-17/+26
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-08-17sdcard: Check for error events during sdcard_pio()Kevin O'Connor1-2/+13
Check for command errors and clear the error status if an error is found. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-08-17sdcard: Perform a controller reset at start of initKevin O'Connor1-0/+20
Ask the controller to reset itself during controller setup. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-08-17sdcard: Rename waitw() to sdcard_waitw() and simplifyKevin O'Connor1-16/+13
Calculate end timeout in code and return if any bit in the provided mask is set. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-08-17sdcard: Implement timeout on every block read in sdcard_pio_transfer()Kevin O'Connor1-5/+4
The sdcard specs don't specify a maximum time for arbitrary transfers. Instead, each block has a maximum timeout. So, change the code to check for a timeout on each block transferred. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-08-17sdcard: The card should never be in a busy state at start of sdcard_pio()Kevin O'Connor1-6/+9
Return an error if the controller is busy at the start of a command instead of waiting. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-08-17sdcard: Power down controller on failureKevin O'Connor1-4/+8
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-08-17sdcard: Power controller up to maximum voltage supportedKevin O'Connor1-4/+18
Don't error out if the controller does not support 3.3V - instead supply the most voltage the controller supports. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-08-17sdcard: Move power setup to new function sdcard_set_power()Kevin O'Connor1-13/+24
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-08-17sdcard: Support SDHCI v3.00 spec clock settingKevin O'Connor1-7/+22
The SDHCI v3 spec supports higher frequency clocks and has a different method to configure the clock divisor. This also fixes an error in v1/v2 clock calculation (ffs was used instead of fls). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-08-17sdcard: Fill command bits according to specKevin O'Connor1-11/+17
Set the proper command bits for each command according to the SDHCI specification. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-08-17sdcard: Fix typo - use sdcard_pio() instead of sdcard_pio_app()Kevin O'Connor1-2/+2
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-08-17Call cpu_relax() if yielding prior to interrupts being enabledKevin O'Connor1-1/+3
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-08-17Move CanInterrupt check to check_irqs()Kevin O'Connor1-7/+8
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-08-17edd: Reduce parameters to fill_generic_edd()Kevin O'Connor1-32/+45
Have callers of fill_generic_edd() calculate the edd iface_path field. Have callers determine if the bus type is PCI vs ISA. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-08-17edd: Pass the segment/offset from int 1348 calls using a 'struct segoff_s'Kevin O'Connor3-9/+11
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-08-12optionroms: Don't run option rom on PCI bar if CBFS/fw_cfg version existsKevin O'Connor1-18/+12
If there exists a "pci%04x,%04x.rom" file in CBFS/fw_cfg then the code should not attempt to run a rom found on the PCI device itself - even if the one in CBFS/fw_cfg is not a valid rom. This makes the code match the documentation. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-08-10xhci: Count new Max Scratchpad Bufs bits from XHCI 1.1Julius Werner1-1/+1
The 1.1 revision of the XHCI specification added an extra 5 bits to the Max Scratchpad Bufs field of HCSPARAMS2 that newer controllers make use of. Not honoring these bits means we're not allocating as many scratchpad buffers as the controller expects, which means it will interpret some uninitialized values from the end of the pointer array as scratchpad buffer pointers. We just fixed this in libpayload and it seems to apply the same way to SeaBIOS (I only compile-tested this, though... sorry). Signed-off-by: Julius Werner <jwerner@chromium.org>
2015-08-04mptable: Don't create mptable if it is very largeKevin O'Connor2-0/+7
Very large mptable structures can fill up the space in the f-segment and cause other important f-segment allocations to fail. Limit the maximum size of the mptable to prevent this. On QEMU, with the current maximum size of 600 bytes, the mptable will not be created in configurations of ~20 cpus or more. The mptable is rarely used in modern OSes so this should not be a problem. Reported-by: Huaitong Han <huaitong.han@intel.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>