summaryrefslogtreecommitdiff
path: root/efi/main.c
Commit message (Collapse)AuthorAgeFilesLines
* efi: Merge cleanupGene Cumm2015-09-101-3/+3
|\ | | | | | | | | | | Merge git://github.com/Celelibi/syslinux.git branch 'fix/efi/cleanup' Signed-off-by: Gene Cumm <gene.cumm@gmail.com>
| * efi: fix pointer-type mismatch assigment warningSylvain Gault2015-08-261-1/+1
| | | | | | | | | | | | | | The assignment looks suspicious but is actually legit since it is protected by the type check. Signed-off-by: Sylvain Gault <sylvain.gault@gmail.com>
| * efi: fix warnings about argument typesSylvain Gault2015-08-261-2/+2
| | | | | | | | | | | | | | The function efi_get_MAC was given a pointer to array instead of a simple pointer, generating a warning with gcc. Signed-off-by: Sylvain Gault <sylvain.gault@gmail.com>
* | efi: Change status check when draining keyboardOliver Wagner2015-09-021-1/+1
|/ | | | | | | PCs without keyboards may hang as they might return a status other than EFI_NOT_READY. Signed-off-by: Gene Cumm <gene.cumm@gmail.com>
* efi/main: set/check for NULL in efi_create_binding()Patrick Masotta2015-08-011-2/+2
| | | | | | | | If LibLocateHandle() returns success and either 0 handles or we find no matching handles, treat it the same. Originally-By: Patrick Masotta <masottaus@yahoo.com> Signed-off-by: Gene Cumm <gene.cumm@gmail.com>
* efi: Hunt for service binding handle if neededGene Cumm2015-07-191-7/+39
| | | | Signed-off-by: Gene Cumm <gene.cumm@gmail.com>
* efi: add efi_get_MAC()Gene Cumm2015-07-191-0/+36
| | | | | | | | Extracts a MAC address from a device path Originally-By: Patrick Masotta <masottaus@yahoo.com> [gene.cumm@gmail.com: Respace] Signed-off-by: Gene Cumm <gene.cumm@gmail.com>
* efi: rename pxe_handle to image_device_handleGene Cumm2015-07-191-7/+7
| | | | Signed-off-by: Gene Cumm <gene.cumm@gmail.com>
* efi/main.c: don't close handle earlyPatrick Masotta2015-06-271-3/+0
| | | | | | This clause closes the protocol before creating the child Signed-off-by: Gene Cumm <gene.cumm@gmail.com>
* efi/pxe: Reuse handleGene Cumm2015-06-251-24/+16
| | | | | | | | | | | | | | | Store and reuse handle found with EFI_LOADED_IMAGE_PROTOCOL for EFI_PXE_BASE_CODE_PROTOCOL and EFI_UDP4_SERVICE_BINDING_PROTOCOL This caused machines with multiple NICs to not reliably attach to the correct NIC handle. gnu-efi LoadedImageProtocol PxeBaseCodeProtocol Udp4ServiceBindingProtocol Reported-By: Holger Baust <holger.baust@freenet.ag> Reported-By: Michael Glasgow <glasgow@beer.net> Reported-By: Da Shi Cao <dscao999@gmail.com> Signed-off-by: Gene Cumm <gene.cumm@gmail.com>
* efi: Tag __syslinux_adv* with __exportMatt Fleming2014-06-241-2/+2
| | | | | | | | | | | | | | | | | | | | | commit 415d571 ("adv: Remove double defintion") introduced a regression for the EFI boot loader. The commit is correct, but should have tagged the __syslinux_adv_ptr and __syslinux_adv_size data objects in the EFI core as __export. This change is required because symbols in the EFI code are not global by default, and so, when ldlinux.{e32,e64} tries to bind to the adv symbols it fails. The following demonstrates the ELF symbol changes, Before: 659: 0000000000034f40 8 OBJECT LOCAL DEFAULT 16 __syslinux_adv_ptr After: 957: 0000000000036fe0 8 OBJECT GLOBAL DEFAULT 16 __syslinux_adv_ptr Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* Merge branch 'nocomapi'syslinux-6.03-pre7H. Peter Anvin2014-03-031-4/+0
|\
| * comapi: Remove the comapi interfaces completelyH. Peter Anvin2014-02-131-4/+0
| | | | | | | | | | | | | | | | | | | | Remove the last bits of the comapi interfaces completely. This does not install stub handlers for the INT 20-3Fh handlers, as we don't support loading old COMBOOT/COM32/COM32R images anymore. We could put those back if we really need them. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* | shuffler: Actually get the shuffler size sanelysyslinux-6.03-pre4H. Peter Anvin2014-02-271-1/+0
|/ | | | | | | | | Actually get the shuffler size sanely. At least for now, we are BIOS only, so stub out the functions on EFI (they shouldn't even be compiled for EFI; this stuff should be moved into some kind of BIOS-only directory.) Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* efi: Suspicious size reduction in emallocSylvain Gault2014-02-131-3/+1
| | | | | | | | | | | It could happen on 32 bits architecture that the memory size really allocated could be less than required. On 64 bits, allocate_pages may be called more times than needed. This closes bug #39. Signed-off-by: Sylvain Gault <sylvain.gault@gmail.com> Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* efi: Add Intel copyright noticesfirmwareMatt Fleming2014-01-241-0/+4
| | | | Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* efi/: Fix displayed version; add DATEGene Cumm2013-10-311-2/+3
| | | | | | | Version string appeared to be a temporary generic string; complete out in the standard fashion Signed-off-by: Gene Cumm <gene.cumm@gmail.com>
* efi: implement LOCALBOOTsyslinux-6.02-pre16Matt Fleming2013-08-021-1/+10
| | | | | | | | | | | | Booting the next device is in fact fairly trivial under EFI. We simply need to return control to the firmware with an error code that indicates we couldn't execute our OS loader properly. Unlike under BIOS, we don't take any notice of any integer arguments passed to LOCALBOOT for EFI, since there is no variation for "boot next entry". Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* memscan: build a linked list of memory scannersMatt Fleming2013-07-171-5/+9
| | | | | | | | | | | By registering memory scanners at runtime we can support multiple memory scanner functions, which helps us to isolate them and keep things modular, only registering them for specific platform/derivative combinations. This is preparation for adding a memory scanner that is specific to PXELINUX on bios and understands when the memory region occupied by the PXE stack can be reused. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* efi: restore console before invoking handover_boot()syslinux-6.02-pre3Matt Fleming2013-07-091-0/+1
| | | | | | | | Otherwise the kernel may print "invisible" characters on the serial console, because it doesn't reset the output device's character attributes. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* efi: setup ramdisk before invoking handover protocolMatt Fleming2013-07-091-3/+3
| | | | | | | | | | | | | The EFI handover protocol expects us to have setup the following fields, o hdr.code32_start o hdr.cmd_line_ptr o hdr.ramdisk_image (if applicable) o hdr.ramdisk_size (if applicable) Which means we need to call handle_ramdisks() before handover_boot(). Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* efi: Convert printf() to Print()Matt Fleming2013-07-091-1/+1
| | | | | | | | We haven't loaded ldlinux.* at this point so we can't rely on the console code being in a useful state. Use the EFI-specific Print() instead. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* Merge branch 'kernel-loader' into for-hpa/elflink/firmwareMatt Fleming2013-07-081-232/+310
|\ | | | | | | | | Conflicts: efi/efi.h
| * efi, console: save/restore attributes before exitingMatt Fleming2013-07-081-1/+5
| | | | | | | | | | | | | | | | | | The Linux kernel doesn't use ANSI attributes when writing to the serial console, so make sure we restore the default attributes that were set when we were initially executed by the firmware. Failure to do so can result in 'invisible' characters being written to the console. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
| * efi: move all screen twiddling to setup_screen()Matt Fleming2013-07-081-6/+1
| | | | | | | | | | | | We can defer all modifications of ->screen_info to setup_screen(). Signed-off-by: Matt Fleming <matt.fleming@intel.com>
| * efi: only want one linux_header variableMatt Fleming2013-07-081-17/+23
| | | | | | | | | | | | | | | | There have been various bugs as a result of having multiple variables for the linux_header struct. Move the header validation to another function so that we don't have to keep track of two copies. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
| * efi: update the correct linux_header pointer for cmdlineMatt Fleming2013-07-081-1/+1
| | | | | | | | | | | | | | We're updating the cmd_line_ptr field of the wrong linux_header, so the command line isn't being passed to the kernel. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
| * efi: get rid of _bp variableMatt Fleming2013-07-081-24/+23
| | | | | | | | | | | | | | | | It's super confusing having 'bp' and '_bp'. Move the allocation of our boot_params much earlier so that we only need one variable to track a boot params structure. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
| * efi: refactor into smaller functionsMatt Fleming2013-07-081-170/+225
| | | | | | | | | | | | | | efi_main() is pretty large and could definitely be made clearer by moving various chunks into their own functions. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
| * efi: implement Linux kernel handover protocol supportMatt Fleming2013-07-081-5/+86
| | | | | | | | | | | | | | | | | | | | | | | | The handover protocol is the preferred method of booting kernels on EFI because it allows workarounds for various firmware bugs to be contained in one place and applied irrespective of the chosen bootloader. Use it if available, but ensure that we fallback to the legacy boot method. Also, update the linux_header structure with recent changes made in the kernel source. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
| * efi: try harder to boot non-relocatable kernelsMatt Fleming2013-07-081-8/+8
| | | | | | | | | | | | | | | | | | We don't absolutely need a kernel to be built with CONFIG_RELOCATABLE=y in order to boot it. We can try and place the kernel image as its preferred address, and if that fails and the image isn't relocatable, then we can bail. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
| * efi: Support booting 32-bit kernels from 64-bit EFIMatt Fleming2013-06-251-64/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The default scheme for booting Linux kernels should be to switch to 32-bit protected mode and jump to the start of the kernel image. The kernel has always had the know-how to switch 64-bit capable CPUs into 64-bit mode if necessary. By using this scheme, we can transparently boot either 32-bit or 64-bit kernels. This change necessitated moving kernel_jump() to a .S file for both i386 and x86-64. Writing inline assembly is fun for about 5 minutes, but then becomes monstrously tedious. Cc: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* | efi: use unsigned long to represent addressesMatt Fleming2013-07-041-2/+2
| | | | | | | | | | | | | | This fixes a valid compiler warning on 64-bit about "cast from pointer to integer of different size". Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* | firmware: s/set_mode/text_mode/Matt Fleming2013-07-041-2/+2
| | | | | | | | | | | | | | We only ever use ->set_mode() to transition into text mode, so rename it to something more suitable and drop the unused 'mode' argument. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* | efi: update derivative info on bootMatt Fleming2013-07-031-1/+4
| | | | | | | | | | | | | | | | Various bits of Syslinux use the filesystem type of the derivative info structure to figure out how we were booted. Update this for SYSLINUX and PXELINUX. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* | Merge tag 'syslinux-5.11-pre3' into firmwaresyslinux-6.01-pre5Matt Fleming2013-06-281-1/+1
|/ | | | | | | syslinux-5.11-pre3 Conflicts: core/Makefile
* efi: Tag symbols with __exportMatt Fleming2013-06-211-1/+1
| | | | | | | I missed some symbols previously that are required to be exported when loading vesamenu.c32. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* efi: Export __bcopyxx_lenMatt Fleming2013-06-211-0/+1
| | | | | | | | We need to provide a __bcopyxx_len symbol for EFI because it's referenced in generic code in libcom32.c32. Without this change, libcom32.c32 will fail to load under EFI. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* efi: delete unused varaiblessyslinux-6.00Matt Fleming2013-06-201-2/+0
| | | | | | | | efi/main.c: In function ‘find_addr’: efi/main.c:527:9: warning: unused variable ‘addr’ [-Wunused-variable] efi/main.c:524:13: warning: unused variable ‘status’ [-Wunused-variable] Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* efi: return a value from sem_down()Matt Fleming2013-06-201-0/+1
| | | | | | | | | | | | | GCC is rightly complaining that we aren't returning a value from sem_down() like we should be, efi/main.c: In function ‘sem_down’: efi/main.c:174:1: warning: control reaches end of non-void function [-Wreturn-type] It doesn't really matter what value we return because the return value is only used in core/thread which EFI doesn't need. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* efi: provide prototype for load_env32()Matt Fleming2013-06-201-1/+1
| | | | | | | | To get rid of the following GCC warning, efi/main.c:1237:2: warning: implicit declaration of function ‘load_env32’ [-Wimplicit-function-declaration] Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* efi: fix a bunch of casting to different size warnings,Matt Fleming2013-06-201-4/+9
| | | | | | | | | e.g. efi/main.c:997:30: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] efi/main.c:999:30: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* efi: fix comparison between signed and unsigned typesMatt Fleming2013-06-201-8/+4
| | | | | | | | GCC is complaining, efi/main.c:534:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* efi: fix prototype of efi_erase()Matt Fleming2013-06-201-2/+1
| | | | | | | | | and address the following compiler warning, efi/main.c:263:2: warning: initialization from incompatible pointer type [enabled by default] efi/main.c:263:2: warning: (near initialization for ‘efi_ops.erase’) [enabled by default] Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* efi: forward declare 'struct semaphore'Matt Fleming2013-06-191-0/+1
| | | | | | | | | | | | We don't need to include thread.h because struct semaphore is never actually used in the EFI code. Fixes, efi/main.c:171:26: warning: ‘struct semaphore’ declared inside parameter list [enabled by default] efi/main.c:171:26: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default] Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* ipappend: delete .ipappend_strings()Matt Fleming2013-06-191-9/+0
| | | | | | | It's no longer referenced anywhere as everything has now moved to *sysappend*. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* firmware: correct the get_cursor() argument typesMatt Fleming2013-06-191-1/+1
| | | | | | | | | | | | | We only ever pass uint8_t * to get_cursor(), so update the prototypes and fix the following compiler warnings, In function ‘__ansicon_open’: com32/lib/sys/ansicon_write.c:93:6: warning: passing argument 1 of ‘firmware->o_ops->get_cursor’ from incompatible pointer type [enabled by default] com32/lib/sys/ansicon_write.c:93:6: note: expected ‘int *’ but argument is of type ‘uint8_t *’ com32/lib/sys/ansicon_write.c:93:6: warning: passing argument 2 of ‘firmware->o_ops->get_cursor’ from incompatible pointer type [enabled by default] com32/lib/sys/ansicon_write.c:93:6: note: expected ‘int *’ but argument is of type ‘uint8_t *’ Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* efi: Turn on symbol export whitelistMatt Fleming2013-06-191-5/+5
| | | | | | | Reduce the default visibility of objects in efi/ as was done for BIOS in commit e4b3ce2dd82c ("Symbol export whitelist"). Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* efi: Mark global BIOS-only symbols as __weakMatt Fleming2013-06-191-4/+0
| | | | | | | | | | | | | | Unfortunately, there are still some references in generic code to symbols that only make sense under BIOS. Use the __weak tag to allow building for EFI without having to declare these symbols. Accessing these __weak symbols under EFI will generate an error at runtime, indicating to the user that they're executing a BIOS code path. The long-term solution is to move these BIOS-specific symbols into core/bios.c or somewhere equally BIOS-centric so that these symbols are no longer global. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* efi: Lookup which file system we were loaded fromMatt Fleming2013-05-101-8/+18
| | | | | | | | | | commit fe283b78c973 ("efi: Add network support") made the assumption that we were always booting via PXE and therefore wanted to register pxe_fs_ops with fs_init(). Obviously we need to lookup which file system syslinux.efi was loaded from at runtime and register the correct ops vector. Signed-off-by: Matt Fleming <matt.fleming@intel.com>