[ros-kernel] Removable Media Support is Broken.

James Tabor jimtabor at adsl-64-217-116-74.dsl.hstntx.swbell.net
Wed Jul 14 00:40:33 CEST 2004


Ok! This was fun!

Hartmut Birr wrote:
> 
> Hi,
> 
> I think this is a problem of DriveNotReady. Did you try to disable the
> DriveNotReady check in DiskClassCheckReadWrite? The problem is, it exist
> DriveNotReady for Partition0 and Partition1. If is no disk in the drive at
> boot time, DriveNotReady for Partition0 is set. This value is never changed
> again. DiskClassCheckReadWrite fails always, if the partition table is read
> from Partition0.
> 
> - Hartmut  
> 

Here is the dump w/o any changes other than your patch.

(io/xhaldrv.c:428) xHalIoAssignDriveLetters()
(io/xhaldrv.c:438) Physical disk drives: 3
(io/xhaldrv.c:471) Creating link: \??\PhysicalDrive0 ==> \Device\Harddisk0\Parti
tion0
(io/xhaldrv.c:471) Creating link: \??\PhysicalDrive1 ==> \Device\Harddisk1\Parti
tion0
(io/xhaldrv.c:471) Creating link: \??\PhysicalDrive2 ==> \Device\Harddisk2\Parti
tion0
(io/xhaldrv.c:82) xHalpQueryDriveLayout \Device\Harddisk0\Partition0 c15dbf30
(io/xhaldrv.c:139) DiskGeometry.BytesPerSector: 512
(io/xhaldrv.c:722) xHalIoReadPartitionTable(c1619348 512 0 c15dbf30)
(io/xhaldrv.c:730) \Device\Harddisk0\Partition0
(io/xhaldrv.c:287) xHalExamineMBR()
(io/xhaldrv.c:188) xHalpReadSector() called
(io/xhaldrv.c:329) Invalid MBRTypeIdentifier
(io/xhaldrv.c:287) xHalExamineMBR()
(io/xhaldrv.c:188) xHalpReadSector() called
(io/xhaldrv.c:329) Invalid MBRTypeIdentifier
(io/xhaldrv.c:793) PartitionOffset: 0
(io/xhaldrv.c:816) RealPartitionOffset: 0
(io/xhaldrv.c:188) xHalpReadSector() called
(io/xhaldrv.c:832) Magic aa55
(io/xhaldrv.c:857)   0: flags:80 type:b start:1:1:0 end:254:63:259 stblk:63 coun
t:4176837
(io/xhaldrv.c:857)   1: flags: 0 type:5 start:0:1:260 end:254:63:520 stblk:41769
00 count:4192965
(io/xhaldrv.c:857)   2: flags: 0 type:83 start:0:1:521 end:254:63:1023 stblk:836
9865 count:11663190
(io/xhaldrv.c:857)   3: flags: 0 type:0 start:0:0:0 end:0:0:0 stblk:0 count:0
(io/xhaldrv.c:868) Disk signature: 0
(io/xhaldrv.c:892) Partition 0: Normal Partition
(io/xhaldrv.c:894) Logical Partition 0
(io/xhaldrv.c:942)  0: nr: 1 boot: 1 type: b start: 0x7e00 count: 0x7f778a00
(io/xhaldrv.c:892) Partition 1: Normal Partition
(io/xhaldrv.c:894) Logical Partition 1
(io/xhaldrv.c:942)  1: nr: 0 boot: 0 type: 5 start: 0x7f780800 count: 0x7ff58a00
(io/xhaldrv.c:892) Partition 2: Normal Partition
(io/xhaldrv.c:894) Logical Partition 2
(io/xhaldrv.c:942)  2: nr: 0 boot: 0 type: 83 start: 0xff6d9200 count: 0x163eeac
00
(io/xhaldrv.c:892) Partition 3: Normal Partition
(io/xhaldrv.c:894) Logical Partition 3
(io/xhaldrv.c:942)  3: nr: 0 boot: 0 type: 0 start: 0x0 count: 0x0
(io/xhaldrv.c:793) PartitionOffset: 4176900
(io/xhaldrv.c:816) RealPartitionOffset: 4176900
(io/xhaldrv.c:188) xHalpReadSector() called
(io/xhaldrv.c:832) Magic aa55
(io/xhaldrv.c:857)   0: flags: 0 type:b start:1:1:260 end:254:63:520 stblk:63 co
unt:4192902
(io/xhaldrv.c:857)   1: flags: 0 type:0 start:0:0:0 end:0:0:0 stblk:0 count:0
(io/xhaldrv.c:857)   2: flags: 0 type:0 start:0:0:0 end:0:0:0 stblk:0 count:0
(io/xhaldrv.c:857)   3: flags: 0 type:0 start:0:0:0 end:0:0:0 stblk:0 count:0
(io/xhaldrv.c:892) Partition 0: Normal Partition
(io/xhaldrv.c:894) Logical Partition 4
(io/xhaldrv.c:942)  4: nr: 2 boot: 0 type: b start: 0x7f788600 count: 0x7ff50c00
(io/xhaldrv.c:892) Partition 1: Normal Partition
(io/xhaldrv.c:894) Logical Partition 5
(io/xhaldrv.c:942)  5: nr: 0 boot: 0 type: 0 start: 0x0 count: 0x0
(io/xhaldrv.c:892) Partition 2: Normal Partition
(io/xhaldrv.c:894) Logical Partition 6
(io/xhaldrv.c:942)  6: nr: 0 boot: 0 type: 0 start: 0x0 count: 0x0
(io/xhaldrv.c:892) Partition 3: Normal Partition
(io/xhaldrv.c:894) Logical Partition 7
(io/xhaldrv.c:942)  7: nr: 0 boot: 0 type: 0 start: 0x0 count: 0x0
(io/xhaldrv.c:82) xHalpQueryDriveLayout \Device\Harddisk1\Partition0 c15dbf34
(io/xhaldrv.c:139) DiskGeometry.BytesPerSector: 512
(io/xhaldrv.c:82) xHalpQueryDriveLayout \Device\Harddisk2\Partition0 c15dbf38
(io/xhaldrv.c:139) DiskGeometry.BytesPerSector: 512
(io/xhaldrv.c:507) Harddisk 0:
(io/xhaldrv.c:513) Logical partitions: 8
(io/xhaldrv.c:523)   0: nr:1 boot:1 type:b startblock:32256 count:2138540544
(io/xhaldrv.c:523)   1: nr:0 boot:0 type:5 startblock:2138572800 count:214679808
0
(io/xhaldrv.c:523)   2: nr:0 boot:0 type:83 startblock:4285370880 count:59715532
80
(io/xhaldrv.c:523)   3: nr:0 boot:0 type:0 startblock:0 count:0
(io/xhaldrv.c:523)   4: nr:2 boot:0 type:b startblock:2138605056 count:214676582
4
(io/xhaldrv.c:523)   5: nr:0 boot:0 type:0 startblock:0 count:0
(io/xhaldrv.c:523)   6: nr:0 boot:0 type:0 startblock:0 count:0
(io/xhaldrv.c:507) Harddisk 1:
(io/xhaldrv.c:513) Logical partitions: 1
(io/xhaldrv.c:523)   0: nr:0 boot:0 type:0 startblock:0 count:0
(io/xhaldrv.c:507) Harddisk 2:
(io/xhaldrv.c:513) Logical partitions: 1
(io/xhaldrv.c:523)   0: nr:0 boot:0 type:0 startblock:0 count:0
(io/xhaldrv.c:532) Assigning bootable primary partition on first harddisk:
(io/xhaldrv.c:548)   \Device\Harddisk0\Partition1
(io/xhaldrv.c:354) HalpAssignDrive()
(io/xhaldrv.c:386) DriveNumber 2
(io/xhaldrv.c:401)   \??\C: ==> \Device\Harddisk0\Partition1
(io/xhaldrv.c:557) Assigning remaining primary partitions:
(io/xhaldrv.c:586) Assigning extended (logical) partitions:
(io/xhaldrv.c:606)   \Device\Harddisk0\Partition2
(io/xhaldrv.c:354) HalpAssignDrive()
(io/xhaldrv.c:386) DriveNumber 3
(io/xhaldrv.c:401)   \??\D: ==> \Device\Harddisk0\Partition2

Make a note here:

(io/xhaldrv.c:616) Assigning removable disk drives:
(io/xhaldrv.c:631)   \Device\Harddisk1\Partition1
(io/xhaldrv.c:354) HalpAssignDrive()
(io/xhaldrv.c:386) DriveNumber 4
(io/xhaldrv.c:401)   \??\E: ==> \Device\Harddisk1\Partition1
(io/xhaldrv.c:631)   \Device\Harddisk2\Partition1
(io/xhaldrv.c:354) HalpAssignDrive()
(io/xhaldrv.c:386) DriveNumber 5
(io/xhaldrv.c:401)   \??\F: ==> \Device\Harddisk2\Partition1
(io/xhaldrv.c:647) Floppy drives: 0
(io/xhaldrv.c:665) CD-Rom drives: 1
(io/xhaldrv.c:675)   \Device\CdRom0
(io/xhaldrv.c:354) HalpAssignDrive()
(io/xhaldrv.c:386) DriveNumber 6
(io/xhaldrv.c:401)   \??\G: ==> \Device\CdRom0

Snip

Select drive E:

(io/xhaldrv.c:722) xHalIoReadPartitionTable(c161a568 512 1 dee08aa8)
(io/xhaldrv.c:730) \Device\Harddisk1\Partition1
(io/xhaldrv.c:287) xHalExamineMBR()
(io/xhaldrv.c:188) xHalpReadSector() called
(io/xhaldrv.c:329) Invalid MBRTypeIdentifier
(io/xhaldrv.c:287) xHalExamineMBR()
(io/xhaldrv.c:188) xHalpReadSector() called
(io/xhaldrv.c:329) Invalid MBRTypeIdentifier
(io/xhaldrv.c:793) PartitionOffset: 0
(io/xhaldrv.c:816) RealPartitionOffset: 0
(io/xhaldrv.c:188) xHalpReadSector() called
(io/xhaldrv.c:832) Magic aa55
(io/xhaldrv.c:857)   0: flags: 0 type:0 start:0:0:0 end:0:0:0 stblk:0 count:0
(io/xhaldrv.c:857)   1: flags: 0 type:0 start:0:0:0 end:0:0:0 stblk:0 count:0
(io/xhaldrv.c:857)   2: flags: 0 type:0 start:0:0:0 end:0:0:0 stblk:0 count:0
(io/xhaldrv.c:857)   3: flags:80 type:6 start:1:1:0 end:63:32:95 stblk:32 count:
196576
(io/xhaldrv.c:868) Disk signature: edf1014e
(io/xhaldrv.c:892) Partition 3: Normal Partition
(io/xhaldrv.c:894) Logical Partition 0
(io/xhaldrv.c:942)  0: nr: 1 boot: 1 type: 6 start: 0x4000 count: 0x5ffc000
(disk.c:934) Partition 00: nr: 1 boot: 1 type: 6 offset: 32 size: 196576
(io/xhaldrv.c:722) xHalIoReadPartitionTable(c161a568 512 1 dee08aa8)
(io/xhaldrv.c:730) \Device\Harddisk1\Partition1
(io/xhaldrv.c:287) xHalExamineMBR()
(io/xhaldrv.c:188) xHalpReadSector() called
(io/xhaldrv.c:329) Invalid MBRTypeIdentifier
(io/xhaldrv.c:287) xHalExamineMBR()
(io/xhaldrv.c:188) xHalpReadSector() called
(io/xhaldrv.c:329) Invalid MBRTypeIdentifier
(io/xhaldrv.c:793) PartitionOffset: 0
(io/xhaldrv.c:816) RealPartitionOffset: 0
(io/xhaldrv.c:188) xHalpReadSector() called
(io/xhaldrv.c:832) Magic aa55
(io/xhaldrv.c:857)   0: flags: 0 type:0 start:0:0:0 end:0:0:0 stblk:0 count:0
(io/xhaldrv.c:857)   1: flags: 0 type:0 start:0:0:0 end:0:0:0 stblk:0 count:0
(io/xhaldrv.c:857)   2: flags: 0 type:0 start:0:0:0 end:0:0:0 stblk:0 count:0
(io/xhaldrv.c:857)   3: flags:80 type:6 start:1:1:0 end:63:32:95 stblk:32 count:
196576
(io/xhaldrv.c:868) Disk signature: edf1014e
(io/xhaldrv.c:892) Partition 3: Normal Partition
(io/xhaldrv.c:894) Logical Partition 0
(io/xhaldrv.c:942)  0: nr: 1 boot: 1 type: 6 start: 0x4000 count: 0x5ffc000
(disk.c:934) Partition 00: nr: 1 boot: 1 type: 6 offset: 32 size: 196576


Now with DiskClassCheckReadWrite main check code body commented out and
DiskDeviceExtension->PhysicalDevice used in IoReadPartitionTable. We get Partition0.

Select drive E:

(io/xhaldrv.c:722) xHalIoReadPartitionTable(c1619f50 512 1 dee08aa8)
(io/xhaldrv.c:730) \Device\Harddisk1\Partition0
(io/xhaldrv.c:287) xHalExamineMBR()
(io/xhaldrv.c:188) xHalpReadSector() called
(io/xhaldrv.c:329) Invalid MBRTypeIdentifier
(io/xhaldrv.c:287) xHalExamineMBR()
(io/xhaldrv.c:188) xHalpReadSector() called
(io/xhaldrv.c:329) Invalid MBRTypeIdentifier
(io/xhaldrv.c:793) PartitionOffset: 0
(io/xhaldrv.c:816) RealPartitionOffset: 0
(io/xhaldrv.c:188) xHalpReadSector() called
(io/xhaldrv.c:832) Magic aa55
(io/xhaldrv.c:857)   0: flags:80 type:6 start:1:1:0 end:63:32:95 stblk:32 count:
196576
(io/xhaldrv.c:857)   1: flags: 0 type:0 start:0:0:0 end:0:0:0 stblk:0 count:0
(io/xhaldrv.c:857)   2: flags: 0 type:0 start:0:0:0 end:0:0:0 stblk:0 count:0
(io/xhaldrv.c:857)   3: flags: 0 type:0 start:0:0:0 end:0:0:0 stblk:0 count:0
(io/xhaldrv.c:868) Disk signature: 0
(io/xhaldrv.c:892) Partition 0: Normal Partition
(io/xhaldrv.c:894) Logical Partition 0
(io/xhaldrv.c:942)  0: nr: 1 boot: 1 type: 6 start: 0x4000 count: 0x5ffc000
(disk.c:934) Partition 00: nr: 1 boot: 1 type: 6 offset: 32 size: 196576
(io/xhaldrv.c:722) xHalIoReadPartitionTable(c1619f50 512 1 dee08aa8)
(io/xhaldrv.c:730) \Device\Harddisk1\Partition0
(io/xhaldrv.c:287) xHalExamineMBR()
(io/xhaldrv.c:188) xHalpReadSector() called
(io/xhaldrv.c:329) Invalid MBRTypeIdentifier
(io/xhaldrv.c:287) xHalExamineMBR()
(io/xhaldrv.c:188) xHalpReadSector() called
(io/xhaldrv.c:329) Invalid MBRTypeIdentifier
(io/xhaldrv.c:793) PartitionOffset: 0
(io/xhaldrv.c:816) RealPartitionOffset: 0
(io/xhaldrv.c:188) xHalpReadSector() called
(io/xhaldrv.c:832) Magic aa55
(io/xhaldrv.c:857)   0: flags:80 type:6 start:1:1:0 end:63:32:95 stblk:32 count:
196576
(io/xhaldrv.c:857)   1: flags: 0 type:0 start:0:0:0 end:0:0:0 stblk:0 count:0
(io/xhaldrv.c:857)   2: flags: 0 type:0 start:0:0:0 end:0:0:0 stblk:0 count:0
(io/xhaldrv.c:857)   3: flags: 0 type:0 start:0:0:0 end:0:0:0 stblk:0 count:0
(io/xhaldrv.c:868) Disk signature: 0
(io/xhaldrv.c:894) Logical Partition 0
(io/xhaldrv.c:942)  0: nr: 1 boot: 1 type: 6 start: 0x4000 count: 0x5ffc000
(disk.c:934) Partition 00: nr: 1 boot: 1 type: 6 offset: 32 size: 196576


Changes to xhaldrv.c, Lines 615 to 636:

   /* Assign removable disk drives */
   DPRINT("Assigning removable disk drives:\n");
   for (i = 0; i < ConfigInfo->DiskCount; i++)
     {
       /* Search for virtual partitions */
       if (LayoutArray[i]->PartitionCount == 1 &&
           LayoutArray[i]->PartitionEntry[0].PartitionType == 0)
         {
           swprintf(Buffer2,
                    L"\\Device\\Harddisk%d\\Partition0",  // *was 1*
                    i);
           RtlInitUnicodeString(&UnicodeString2,
                                Buffer2);

           /* Assign drive */
           DPRINT("  %wZ\n",
                  &UnicodeString2);
           HalpAssignDrive(&UnicodeString2,
                           AUTO_DRIVE,
                           DOSDEVICE_DRIVE_REMOVABLE);
         }
     }



DiskClassCheckReadWrite code restored and DiskDeviceObject used in IoReadPartitionTable.


(io/xhaldrv.c:616) Assigning removable disk drives:
(io/xhaldrv.c:631)   \Device\Harddisk1\Partition0
(io/xhaldrv.c:354) HalpAssignDrive()
(io/xhaldrv.c:386) DriveNumber 4
(io/xhaldrv.c:401)   \??\E: ==> \Device\Harddisk1\Partition0
(io/xhaldrv.c:631)   \Device\Harddisk2\Partition0
(io/xhaldrv.c:354) HalpAssignDrive()
(io/xhaldrv.c:386) DriveNumber 5
(io/xhaldrv.c:401)   \??\F: ==> \Device\Harddisk2\Partition0
(io/xhaldrv.c:647) Floppy drives: 0
(io/xhaldrv.c:665) CD-Rom drives: 1
(io/xhaldrv.c:675)   \Device\CdRom0
(io/xhaldrv.c:354) HalpAssignDrive()
(io/xhaldrv.c:386) DriveNumber 6
(io/xhaldrv.c:401)   \??\G: ==> \Device\CdRom0

snip.

Select drive e:

(io/xhaldrv.c:722) xHalIoReadPartitionTable(c1619f50 512 1 dee08aa8)
(io/xhaldrv.c:730) \Device\Harddisk1\Partition0
(io/xhaldrv.c:287) xHalExamineMBR()
(io/xhaldrv.c:188) xHalpReadSector() called
(io/xhaldrv.c:329) Invalid MBRTypeIdentifier
(io/xhaldrv.c:287) xHalExamineMBR()
(io/xhaldrv.c:188) xHalpReadSector() called
(io/xhaldrv.c:329) Invalid MBRTypeIdentifier
(io/xhaldrv.c:793) PartitionOffset: 0
(io/xhaldrv.c:816) RealPartitionOffset: 0
(io/xhaldrv.c:188) xHalpReadSector() called
(io/xhaldrv.c:832) Magic aa55
(io/xhaldrv.c:857)   0: flags: 0 type:0 start:0:0:0 end:0:0:0 stblk:0 count:0
(io/xhaldrv.c:857)   1: flags: 0 type:0 start:0:0:0 end:0:0:0 stblk:0 count:0
(io/xhaldrv.c:857)   2: flags: 0 type:0 start:0:0:0 end:0:0:0 stblk:0 count:0
(io/xhaldrv.c:857)   3: flags:80 type:6 start:1:1:0 end:63:32:95 stblk:32 count:
196576
(io/xhaldrv.c:868) Disk signature: edf1014e
(io/xhaldrv.c:892) Partition 3: Normal Partition
(io/xhaldrv.c:894) Logical Partition 0
(io/xhaldrv.c:942)  0: nr: 1 boot: 1 type: 6 start: 0x4000 count: 0x5ffc000
(disk.c:934) Partition 00: nr: 1 boot: 1 type: 6 offset: 32 size: 196576


Now in disk.c DiskDeviceExtension->PhysicalDevice used in IoReadPartitionTable.

Select Drive E:

(io/xhaldrv.c:722) xHalIoReadPartitionTable(c1619f50 512 1 dee08aa8)
(io/xhaldrv.c:730) \Device\Harddisk1\Partition0
(io/xhaldrv.c:287) xHalExamineMBR()
(io/xhaldrv.c:188) xHalpReadSector() called
(io/xhaldrv.c:329) Invalid MBRTypeIdentifier
(io/xhaldrv.c:287) xHalExamineMBR()
(io/xhaldrv.c:188) xHalpReadSector() called
(io/xhaldrv.c:329) Invalid MBRTypeIdentifier
(io/xhaldrv.c:793) PartitionOffset: 0
(io/xhaldrv.c:816) RealPartitionOffset: 0
(io/xhaldrv.c:188) xHalpReadSector() called
(io/xhaldrv.c:832) Magic aa55
(io/xhaldrv.c:857)   0: flags: 0 type:0 start:0:0:0 end:0:0:0 stblk:0 count:0
(io/xhaldrv.c:857)   1: flags: 0 type:0 start:0:0:0 end:0:0:0 stblk:0 count:0
(io/xhaldrv.c:857)   2: flags: 0 type:0 start:0:0:0 end:0:0:0 stblk:0 count:0
(io/xhaldrv.c:857)   3: flags:80 type:6 start:1:1:0 end:63:32:95 stblk:32 count:
196576
(io/xhaldrv.c:868) Disk signature: edf1014e
(io/xhaldrv.c:892) Partition 3: Normal Partition
(io/xhaldrv.c:894) Logical Partition 0
(io/xhaldrv.c:942)  0: nr: 1 boot: 1 type: 6 start: 0x4000 count: 0x5ffc000
(disk.c:934) Partition 00: nr: 1 boot: 1 type: 6 offset: 32 size: 196576


Now DiskDeviceExtension->PhysicalDevice and DiskDeviceObject are interchangeable.

The change to assigning removable media in xhaldrv.c fixed your problem?

So drive C should be Partition0 and drive D should have Partition1, I guess?
Eric Kohl wrote the patch for removable media in xhaldrv.c 1.9.


8^o Puzzled,
James


More information about the Ros-kernel mailing list