Re: Configuring disk geometry from SCSI miniport driver
From: Maxim S. Shatskih (maxim_at_storagecraft.com)
Date: 10/31/04
- Previous message: Alexander Grigoriev: "Re: Fatal bug in DDK sample?"
- In reply to: Konstantin S.: "Re: Configuring disk geometry from SCSI miniport driver"
- Messages sorted by: [ date ] [ thread ]
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
- Previous message: Alexander Grigoriev: "Re: Fatal bug in DDK sample?"
- In reply to: Konstantin S.: "Re: Configuring disk geometry from SCSI miniport driver"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|