]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[x86 setup] EDD: Fix the computation of the MBR sector buffer
authorH. Peter Anvin <hpa@zytor.com>
Tue, 31 Jul 2007 20:17:13 +0000 (16:17 -0400)
committerH. Peter Anvin <hpa@zytor.com>
Tue, 31 Jul 2007 20:18:05 +0000 (16:18 -0400)
Some BIOSes require that sector buffers not cross 64K
boundaries.  As a result, we compute a dynamic address on the
setup heap.  Unfortunately, this address computation was just
totally wrong.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
arch/i386/boot/edd.c

index 25a282494f4c91afde98fef701d19c1701d6bbb2..77d92daf7923505d45580899a5476aa74f6ed989 100644 (file)
@@ -72,17 +72,18 @@ static u32 read_mbr_sig(u8 devno, struct edd_info *ei)
        u32 mbrsig;
        u32 buf_base, mbr_base;
        extern char _end[];
-       static char mbr_buf[1024];
 
        sector_size = ei->params.bytes_per_sector;
        if (!sector_size)
                sector_size = 512; /* Best available guess */
 
+       /* Produce a naturally aligned buffer on the heap */
        buf_base = (ds() << 4) + (u32)&_end;
        mbr_base = (buf_base+sector_size-1) & ~(sector_size-1);
-       mbrbuf_ptr = mbr_buf + (mbr_base-buf_base);
+       mbrbuf_ptr = _end + (mbr_base-buf_base);
        mbrbuf_end = mbrbuf_ptr + sector_size;
 
+       /* Make sure we actually have space on the heap... */
        if (!(boot_params.hdr.loadflags & CAN_USE_HEAP))
                return 0;
        if (mbrbuf_end > (char *)(size_t)boot_params.hdr.heap_end_ptr)