File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change
1
+ #include <linux/efi.h>
1
2
#include <asm/e820/types.h>
2
3
#include <asm/processor.h>
4
+ #include <asm/efi.h>
3
5
#include "pgtable.h"
4
6
#include "../string.h"
5
7
@@ -37,18 +39,29 @@ int cmdline_find_option_bool(const char *option);
37
39
38
40
static unsigned long find_trampoline_placement (void )
39
41
{
40
- unsigned long bios_start , ebda_start ;
42
+ unsigned long bios_start = 0 , ebda_start = 0 ;
41
43
unsigned long trampoline_start ;
42
44
struct boot_e820_entry * entry ;
45
+ char * signature ;
43
46
int i ;
44
47
45
48
/*
46
49
* Find a suitable spot for the trampoline.
47
50
* This code is based on reserve_bios_regions().
48
51
*/
49
52
50
- ebda_start = * (unsigned short * )0x40e << 4 ;
51
- bios_start = * (unsigned short * )0x413 << 10 ;
53
+ /*
54
+ * EFI systems may not provide legacy ROM. The memory may not be mapped
55
+ * at all.
56
+ *
57
+ * Only look for values in the legacy ROM for non-EFI system.
58
+ */
59
+ signature = (char * )& boot_params -> efi_info .efi_loader_signature ;
60
+ if (strncmp (signature , EFI32_LOADER_SIGNATURE , 4 ) &&
61
+ strncmp (signature , EFI64_LOADER_SIGNATURE , 4 )) {
62
+ ebda_start = * (unsigned short * )0x40e << 4 ;
63
+ bios_start = * (unsigned short * )0x413 << 10 ;
64
+ }
52
65
53
66
if (bios_start < BIOS_START_MIN || bios_start > BIOS_START_MAX )
54
67
bios_start = BIOS_START_MAX ;
You can’t perform that action at this time.
0 commit comments