diff options
author | H. Peter Anvin <hpa@zytor.com> | 2007-08-14 20:36:00 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2007-08-14 20:55:31 -0400 |
commit | 9a5f35d4ede43fee791a486e0850e9e3afdde0a7 (patch) | |
tree | 653790015cf2b8ee60fba7af52c09659d62a1174 | |
parent | c1a6e2b082a7cefe58315af7a461bbf2f33221a3 (diff) |
[x86 setup] edd.c: make sure MBR signatures actually get reported
When filling in the MBR signature array, the setup code failed to advance
boot_params.edd_mbr_sig_buf_entries, which resulted in the valid data
being ignored.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r-- | arch/i386/boot/edd.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/arch/i386/boot/edd.c b/arch/i386/boot/edd.c index d65dd21c09f2..82b5c846a194 100644 --- a/arch/i386/boot/edd.c +++ b/arch/i386/boot/edd.c | |||
@@ -37,11 +37,10 @@ static int read_mbr(u8 devno, void *buf) | |||
37 | return -(u8)ax; /* 0 or -1 */ | 37 | return -(u8)ax; /* 0 or -1 */ |
38 | } | 38 | } |
39 | 39 | ||
40 | static u32 read_mbr_sig(u8 devno, struct edd_info *ei) | 40 | static u32 read_mbr_sig(u8 devno, struct edd_info *ei, u32 *mbrsig) |
41 | { | 41 | { |
42 | int sector_size; | 42 | int sector_size; |
43 | char *mbrbuf_ptr, *mbrbuf_end; | 43 | char *mbrbuf_ptr, *mbrbuf_end; |
44 | u32 mbrsig; | ||
45 | u32 buf_base, mbr_base; | 44 | u32 buf_base, mbr_base; |
46 | extern char _end[]; | 45 | extern char _end[]; |
47 | 46 | ||
@@ -57,15 +56,15 @@ static u32 read_mbr_sig(u8 devno, struct edd_info *ei) | |||
57 | 56 | ||
58 | /* Make sure we actually have space on the heap... */ | 57 | /* Make sure we actually have space on the heap... */ |
59 | if (!(boot_params.hdr.loadflags & CAN_USE_HEAP)) | 58 | if (!(boot_params.hdr.loadflags & CAN_USE_HEAP)) |
60 | return 0; | 59 | return -1; |
61 | if (mbrbuf_end > (char *)(size_t)boot_params.hdr.heap_end_ptr) | 60 | if (mbrbuf_end > (char *)(size_t)boot_params.hdr.heap_end_ptr) |
62 | return 0; | 61 | return -1; |
63 | 62 | ||
64 | if (read_mbr(devno, mbrbuf_ptr)) | 63 | if (read_mbr(devno, mbrbuf_ptr)) |
65 | return 0; | 64 | return -1; |
66 | 65 | ||
67 | mbrsig = *(u32 *)&mbrbuf_ptr[EDD_MBR_SIG_OFFSET]; | 66 | *mbrsig = *(u32 *)&mbrbuf_ptr[EDD_MBR_SIG_OFFSET]; |
68 | return mbrsig; | 67 | return 0; |
69 | } | 68 | } |
70 | 69 | ||
71 | static int get_edd_info(u8 devno, struct edd_info *ei) | 70 | static int get_edd_info(u8 devno, struct edd_info *ei) |
@@ -132,6 +131,7 @@ void query_edd(void) | |||
132 | int do_edd = 1; | 131 | int do_edd = 1; |
133 | int devno; | 132 | int devno; |
134 | struct edd_info ei, *edp; | 133 | struct edd_info ei, *edp; |
134 | u32 *mbrptr; | ||
135 | 135 | ||
136 | if (cmdline_find_option("edd", eddarg, sizeof eddarg) > 0) { | 136 | if (cmdline_find_option("edd", eddarg, sizeof eddarg) > 0) { |
137 | if (!strcmp(eddarg, "skipmbr") || !strcmp(eddarg, "skip")) | 137 | if (!strcmp(eddarg, "skipmbr") || !strcmp(eddarg, "skip")) |
@@ -140,7 +140,8 @@ void query_edd(void) | |||
140 | do_edd = 0; | 140 | do_edd = 0; |
141 | } | 141 | } |
142 | 142 | ||
143 | edp = (struct edd_info *)boot_params.eddbuf; | 143 | edp = boot_params.eddbuf; |
144 | mbrptr = boot_params.edd_mbr_sig_buffer; | ||
144 | 145 | ||
145 | if (!do_edd) | 146 | if (!do_edd) |
146 | return; | 147 | return; |
@@ -158,11 +159,8 @@ void query_edd(void) | |||
158 | boot_params.eddbuf_entries++; | 159 | boot_params.eddbuf_entries++; |
159 | } | 160 | } |
160 | 161 | ||
161 | if (do_mbr) { | 162 | if (do_mbr && !read_mbr_sig(devno, &ei, mbrptr++)) |
162 | u32 mbr_sig; | 163 | boot_params.edd_mbr_sig_buf_entries = devno-0x80+1; |
163 | mbr_sig = read_mbr_sig(devno, &ei); | ||
164 | boot_params.edd_mbr_sig_buffer[devno-0x80] = mbr_sig; | ||
165 | } | ||
166 | } | 164 | } |
167 | } | 165 | } |
168 | 166 | ||