Patch to allow disk support to work with non CHS devices
Andy Jackson
andy@xylanta.com
Mon Aug 21 14:16:00 GMT 2006
Hi Andrew,
> Is there any way i can easily test this?
My understanding is that the LBA entries in the MBR should be valid even
when the disk supports CHS, so changing
cyg_disk_identify_t ident;
ident.serial[0] = '\0';
ident.firmware_rev[0] = '\0';
ident.model_num[0] = '\0';
ident.lba_sectors_num = synth_info->size / 512;
ident.cylinders_num = synth_info->cylinders_num;
ident.heads_num = synth_info->heads_num;
ident.sectors_num = synth_info->sectors_num;
if (!(chan->callbacks->disk_init)(tab))
return false;
if (ENOERR != (chan->callbacks->disk_connected)(tab, &ident))
return false;
to
ident.cylinders_num = 0
ident.heads_num = 0;
ident.sectors_num = 0;
in the synth disk driver should still work *if* the MBR LBA data is valid.
The same thing should work with the ide driver if the disk MBR has all the
information with a few caveats such as some older versions of fdisk are
reported to put duff values in the LBA entries. There is also an issue that
CHS address mode has a limit of 16,515,072 sectors, which is ~8Gb whereas
LBA addressing extends this to ~2 Tb. My understanding is that when dealing
with partitions beyond the 8Gb size, the packed CHS information in the
'Start of partition' and 'End of partition' fields should be set to the
maximum possible, signalling that only the LBA address should be used, but
this patch doesn't address that.
The issue that I'm addressing here relates to SD cards (which is what I'm
working on at present) where the specs say that the LBA data should be used
as the CHS data is impossible to decode as there appears to be no fixed
values for the number of heads/sectors. Therefore a method is needed to
force the LBA data to be used.
Sorry if this don't help any....
Andy..
----- Original Message -----
From: "Andrew Lunn" <andrew@lunn.ch>
To: "Andy Jackson" <andy@xylanta.com>
Cc: "eCos Patches" <ecos-patches@ecos.sourceware.org>
Sent: Monday, August 21, 2006 2:34 PM
Subject: Re: Patch to allow disk support to work with non CHS devices
> On Sun, Aug 20, 2006 at 11:09:23PM +0100, Andy Jackson wrote:
>> The attached patch allows a non CHS disk type device (flash based for
>> example) to signal that the LBA information in the MBR should be used to
>> determine disk/partition size rather than the CHS values. It also makes
>> debugging CDL controlled.
>
> Hi Andy
>
> Is there any way i can easily test this? What i normally do is uses
> the synthetic target with its synthetic disk support, which just uses
> a file to represent the disk. The script
> packages/fs/fat/current/doc/mkdisk0 uses the mtools mpartition to
> create a "disk" with two partitions. It would be nice if there was
> some way to create a disk using LBA for testing.
>
> Do you have any ideas about this?
>
> Thanks
> Andrew
More information about the Ecos-patches
mailing list