• Andrew Morton's avatar
    [PATCH] EDD: Get Legacy Parameters · 66b61a5c
    Andrew Morton authored
    From: Matt Domsch <Matt_Domsch@dell.com>
    
    Patch below from Patrick J. LoPresti and myself.  Patrick describes:
    
    Why this patch?  The problem is that the legacy BIOS interface
    (INT13/AH=3D08) for querying the disk geometry returns different values
    than the extended INT13 interface which the EDD code currently uses.  This
    is because the legacy interface only provides a 10-bit cylinder field, so
    modern BIOSes "lie" about the head/sector counts in order to make more of
    the disk visible within the first 1024 cylinders.
    
    Many non-Linux applications, including the stock Windows boot loader, DOS
    fdisk, etc., rely upon the legacy interface and geometry.  So it is useful
    to be able to obtain the legacy values from a running Linux kernel.
    
    What this patch does is to add new entries under
    /sys/firmware/edd/int13_devXX named "legacy_cylinders", "legacy_heads", and
    "legacy_sectors".  These provide the geometry given by the legacy
    INT13/AH=3D08 BIOS interface, just like the current "default_cylinders"
    etc.  provide the the geometry given by the INT13/AH=3D48 interface.
    
    Without this patch, I cannot use Linux to partition a drive and install
    Windows, which happens to be my application.
    
     - Pat
       http://unattended.sourceforge.net/
    
    In addition, this adds two buggy BIOS workarounds  in the EDD int13
    calls as suggested by Ralf Brown's interrupt list.
    
    I'm also interested in moving this code out of arch/i386/kernel/edd.c and
    include/asm-i386/edd.h, as I believe it is applicable on x86-64 as well.
    However, there's no good place under drivers/ to put edd.c when it's not
    tied to a bus, but to several CPU architectures and their firmwares...
    Maybe a new directory drivers/firmware?
    66b61a5c
edd.c 21.4 KB