Commit b2d597cb authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hpa/linux-2.6-x86setup

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hpa/linux-2.6-x86setup:
  [x86 setup] edd.c: make sure MBR signatures actually get reported
  [x86 setup] Don't use EDD to get the MBR signature
  [x86 setup] The current display page is returned in %bh, not %bl
parents edd5f25f 9a5f35d4
......@@ -19,40 +19,12 @@
#if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE)
struct edd_dapa {
u8 pkt_size;
u8 rsvd;
u16 sector_cnt;
u16 buf_off, buf_seg;
u64 lba;
u64 buf_lin_addr;
};
/*
* Read the MBR (first sector) from a specific device.
*/
static int read_mbr(u8 devno, void *buf)
{
struct edd_dapa dapa;
u16 ax, bx, cx, dx, si;
memset(&dapa, 0, sizeof dapa);
dapa.pkt_size = sizeof(dapa);
dapa.sector_cnt = 1;
dapa.buf_off = (size_t)buf;
dapa.buf_seg = ds();
/* dapa.lba = 0; */
ax = 0x4200; /* Extended Read */
si = (size_t)&dapa;
dx = devno;
asm("pushfl; stc; int $0x13; setc %%al; popfl"
: "+a" (ax), "+S" (si), "+d" (dx)
: "m" (dapa)
: "ebx", "ecx", "edi", "memory");
if (!(u8)ax)
return 0; /* OK */
u16 ax, bx, cx, dx;
ax = 0x0201; /* Legacy Read, one sector */
cx = 0x0001; /* Sector 0-0-1 */
......@@ -65,11 +37,10 @@ static int read_mbr(u8 devno, void *buf)
return -(u8)ax; /* 0 or -1 */
}
static u32 read_mbr_sig(u8 devno, struct edd_info *ei)
static u32 read_mbr_sig(u8 devno, struct edd_info *ei, u32 *mbrsig)
{
int sector_size;
char *mbrbuf_ptr, *mbrbuf_end;
u32 mbrsig;
u32 buf_base, mbr_base;
extern char _end[];
......@@ -85,15 +56,15 @@ static u32 read_mbr_sig(u8 devno, struct edd_info *ei)
/* Make sure we actually have space on the heap... */
if (!(boot_params.hdr.loadflags & CAN_USE_HEAP))
return 0;
return -1;
if (mbrbuf_end > (char *)(size_t)boot_params.hdr.heap_end_ptr)
return 0;
return -1;
if (read_mbr(devno, mbrbuf_ptr))
return 0;
return -1;
mbrsig = *(u32 *)&mbrbuf_ptr[EDD_MBR_SIG_OFFSET];
return mbrsig;
*mbrsig = *(u32 *)&mbrbuf_ptr[EDD_MBR_SIG_OFFSET];
return 0;
}
static int get_edd_info(u8 devno, struct edd_info *ei)
......@@ -160,6 +131,7 @@ void query_edd(void)
int do_edd = 1;
int devno;
struct edd_info ei, *edp;
u32 *mbrptr;
if (cmdline_find_option("edd", eddarg, sizeof eddarg) > 0) {
if (!strcmp(eddarg, "skipmbr") || !strcmp(eddarg, "skip"))
......@@ -168,7 +140,8 @@ void query_edd(void)
do_edd = 0;
}
edp = (struct edd_info *)boot_params.eddbuf;
edp = boot_params.eddbuf;
mbrptr = boot_params.edd_mbr_sig_buffer;
if (!do_edd)
return;
......@@ -186,11 +159,8 @@ void query_edd(void)
boot_params.eddbuf_entries++;
}
if (do_mbr) {
u32 mbr_sig;
mbr_sig = read_mbr_sig(devno, &ei);
boot_params.edd_mbr_sig_buffer[devno-0x80] = mbr_sig;
}
if (do_mbr && !read_mbr_sig(devno, &ei, mbrptr++))
boot_params.edd_mbr_sig_buf_entries = devno-0x80+1;
}
}
......
......@@ -61,7 +61,7 @@ static void store_video_mode(void)
/* Not all BIOSes are clean with respect to the top bit */
boot_params.screen_info.orig_video_mode = ax & 0x7f;
boot_params.screen_info.orig_video_page = page;
boot_params.screen_info.orig_video_page = page >> 8;
}
/*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment