diff options
Diffstat (limited to 'meta/recipes-devtools/syslinux/files/0003-PXELINUX-Add-bios-memscan-function.patch')
-rw-r--r-- | meta/recipes-devtools/syslinux/files/0003-PXELINUX-Add-bios-memscan-function.patch | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/meta/recipes-devtools/syslinux/files/0003-PXELINUX-Add-bios-memscan-function.patch b/meta/recipes-devtools/syslinux/files/0003-PXELINUX-Add-bios-memscan-function.patch new file mode 100644 index 0000000000..70d65fd71d --- /dev/null +++ b/meta/recipes-devtools/syslinux/files/0003-PXELINUX-Add-bios-memscan-function.patch | |||
@@ -0,0 +1,87 @@ | |||
1 | Upstream-Status: Backport [d2f94e74fbd60bf491753895d2474105efb3dedf] | ||
2 | Signed-off-by: Jonathan Liu <net147@gmail.com> | ||
3 | |||
4 | From 5d57e8eb46f209481069d70eaa778481f6fa3edb Mon Sep 17 00:00:00 2001 | ||
5 | From: Matt Fleming <matt.fleming@intel.com> | ||
6 | Date: Wed, 17 Jul 2013 13:04:30 +0100 | ||
7 | Subject: [PATCH 3/4] PXELINUX: Add bios memscan function | ||
8 | |||
9 | We can mark the memory region occupied by the PXE stack as SMT_TERMINAL | ||
10 | provided that KeepPXE isn't set. Historically some very old | ||
11 | non-relocatable kernel images (memtest86+) have a load address that | ||
12 | falls within the PXE stack region, so we need to attempt to load into | ||
13 | that region if at all possible. | ||
14 | |||
15 | Signed-off-by: Matt Fleming <matt.fleming@intel.com> | ||
16 | --- | ||
17 | core/fs/pxe/bios.c | 35 +++++++++++++++++++++++++++++++++++ | ||
18 | 1 file changed, 35 insertions(+) | ||
19 | |||
20 | diff --git a/core/fs/pxe/bios.c b/core/fs/pxe/bios.c | ||
21 | index 81aa715..5f61824 100644 | ||
22 | --- a/core/fs/pxe/bios.c | ||
23 | +++ b/core/fs/pxe/bios.c | ||
24 | @@ -1,4 +1,5 @@ | ||
25 | #include <syslinux/firmware.h> | ||
26 | +#include <syslinux/memscan.h> | ||
27 | #include <core.h> | ||
28 | #include "pxe.h" | ||
29 | #include <net.h> | ||
30 | @@ -10,6 +11,9 @@ static uint16_t real_base_mem; /* Amount of DOS memory after freeing */ | ||
31 | static bool has_gpxe; | ||
32 | static uint32_t gpxe_funcs; | ||
33 | |||
34 | +static addr_t pxe_code_start, pxe_code_size; | ||
35 | +static addr_t pxe_data_start, pxe_data_size; | ||
36 | + | ||
37 | /* | ||
38 | * Validity check on possible !PXE structure in buf | ||
39 | * return 1 for success, 0 for failure. | ||
40 | @@ -88,6 +92,29 @@ static const struct pxenv_t *memory_scan_for_pxenv_struct(void) | ||
41 | return memory_scan(0x10000, is_pxenv); | ||
42 | } | ||
43 | |||
44 | +static int pxelinux_scan_memory(scan_memory_callback_t callback, void *data) | ||
45 | +{ | ||
46 | + int rv = 0; | ||
47 | + | ||
48 | + /* | ||
49 | + * If we are planning on calling unload_pxe() and unmapping the PXE | ||
50 | + * region before we transfer control away from PXELINUX we can mark | ||
51 | + * that region as SMT_TERMINAL to indicate that the region will | ||
52 | + * become free at some point in the future. | ||
53 | + */ | ||
54 | + if (!KeepPXE) { | ||
55 | + dprintf("Marking PXE code region 0x%x - 0x%x as SMT_TERMINAL\n", | ||
56 | + pxe_code_start, pxe_code_start + pxe_code_size); | ||
57 | + rv = callback(data, pxe_code_start, pxe_code_size, SMT_TERMINAL); | ||
58 | + | ||
59 | + dprintf("Marking PXE data region 0x%x - 0x%x as SMT_TERMINAL\n", | ||
60 | + pxe_data_start, pxe_data_start + pxe_data_size); | ||
61 | + rv = callback(data, pxe_data_start, pxe_data_size, SMT_TERMINAL); | ||
62 | + } | ||
63 | + | ||
64 | + return rv; | ||
65 | +} | ||
66 | + | ||
67 | /* | ||
68 | * Find the !PXE structure; we search for the following, in order: | ||
69 | * | ||
70 | @@ -204,6 +231,14 @@ int pxe_init(bool quiet) | ||
71 | printf("UNDI data segment at %04X len %04X\n", data_seg, data_len); | ||
72 | } | ||
73 | |||
74 | + pxe_code_start = code_seg << 4; | ||
75 | + pxe_code_size = code_len; | ||
76 | + | ||
77 | + pxe_data_start = data_seg << 4; | ||
78 | + pxe_data_size = data_len; | ||
79 | + | ||
80 | + syslinux_memscan_new(pxelinux_scan_memory); | ||
81 | + | ||
82 | code_seg = code_seg + ((code_len + 15) >> 4); | ||
83 | data_seg = data_seg + ((data_len + 15) >> 4); | ||
84 | |||
85 | -- | ||
86 | 1.8.5.3 | ||
87 | |||