Re: Configuring disk geometry from SCSI miniport driver

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Maxim S. Shatskih (maxim_at_storagecraft.com)
Date: 10/31/04

  • Next message: Tim Roberts: "Re: USB question"
    Date: Sun, 31 Oct 2004 22:21:18 +0300
    
    

    Note that, if you use any NT-based tool (WinDisk or Setup) to write the
    partition table, it will be written according to CHS values reported by
    Disk.sys - which are explained below.

    After this, when the MBR boostrap will call the BIOS to read the sectors via
    non-extended path, the BIOS will translate CHS to LBA using the current BIOS's
    info. So, if the BIOS's info mismatches with the info used by Disk.sys, you
    will have failure to boot.

    This was a well-known issue with NT4 pre-SP4, which could not use extended
    int13h to boot. The solutions were a) always write the partition tables with
    FDISK and not with NT Setup OR b) use the LBA mode only, which always have
    H=255 and S=63.

    > My BIOS doesn't supports extended int 13h.

    Possible solutions:

    - support extended int13h in the BIOS, note that this is primary mechanism, and
    the old CHS based mechanism can be emulated on top of it.
    - hardcode H=255 and S=63 in your BIOS, so it will always report a drive with
    these values, and always use them for CHS-based int13h read/write.

    > Can SCSI miniport report correct disk geometry with MODE_SENSE (rigid

    The complete list of how XP's Disk.sys determines the H and S geometry values:

    1) NTLDR (or possibly NTDETECT.COM runned from NTLDR) queries the BIOS's drive
    table (the one which is edited via NVRAM setup before the OS is booted) and
    transfers this information to the HARDWARE registry, namely to:

        HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System

        value "Configuration Data", which is interpreted as
    CM_FULL_RESOURCE_DESCRIPTOR.

    The CmResourceTypeDeviceSpecific resources there hold the BIOS-known CHS values
    as CM_INT13_DRIVE_PARAMETER structures.

    Surely only the drives known to BIOS are there. Drives not registered in NVRAM
    setup are not there at all.

    2) Then, if the disk is not known to BIOS, the Disk.sys driver queries the
    underlying storage port for this information.

    Not all ports support this query. SCSIPORT does NOT. Floppy does support it.
    Dunno on ATAPI, maybe it also supports it.

    3) Otherwise, the driver uses TracksPerCylinder = 255 and SectorsPerTrack = 63,
    which are the values valid for LBA addressing mode.

    The rigid geometry mode page is NOT used by Disk.sys.

    So, one of the simplest solutions for you will be to hard-code H=255 and S=63
    inside your device logic and your BIOS (so the usual non-extended int 13h will
    always assume these values), and make the C value to be NumberOfLBASectors /
    ( H * S ).

    I expect most BIOSes onboard the SCSI controllers to use the same way.

    -- 
    Maxim Shatskih, Windows DDK MVP
    StorageCraft Corporation
    maxim@storagecraft.com
    http://www.storagecraft.com
    

  • Next message: Tim Roberts: "Re: USB question"

    Relevant Pages

    • Re: FreeBSD/FDisk geometry problems - SOLVED!
      ... > I've found a bug in FDisk which is responsible for all the problems I've ... That has always been the problem for CHS conversions. ... LBA is the only common mode known to all BIOS vendors, ... put the IDE drives to LBA and you'll see that you get ...
      (freebsd-questions)
    • Re: During reinstallation Im told that setup cant find the hard drive/mass storage device - whY?
      ... I then rebooted and went into Setup. ... Looked again in Device Manager and see the following entry in "Disk Drives": ... BIOS ver. ... I've got both drivers on diskette now. ...
      (microsoft.public.windows.server.sbs)
    • Re: New Crisis! POST halt
      ... long pause displays lots of info on my masters and slaves, ... please enter setup and re-configure your system ... Since I haven't messed with the BIOS at all for a long time, ... I have two SATA drives; a ENERMAX LIBERTY 500W modular PSU; Corsair ...
      (microsoft.public.windowsxp.basics)
    • Re: hard drive not detected/no operating system found
      ... > the only thing that i can get to load is the setup page. ... can i check bios boot menu from setup page? ... your memory, not any drives. ... this also applies) connector on the motherboard. ...
      (microsoft.public.windowsxp.general)
    • Re: ASUS P5W DH Deluxe problem
      ... I cannot do anything because I cannot access the Setup BIOS. ... It's freezing to detect the 4th Master and that's it, ... fields with the stringextracted from the drives. ...
      (alt.comp.periphs.mainboard.asus)