This is the mail archive of the
ecos-patches@sourceware.org
mailing list for the eCos project.
Re: Patch to allow disk support to work with non CHS devices
- From: "Andy Jackson" <andy at xylanta dot com>
- To: "Andrew Lunn" <andrew at lunn dot ch>
- Cc: "eCos Patches" <ecos-patches at ecos dot sourceware dot org>
- Date: Mon, 21 Aug 2006 15:16:40 +0100
- Subject: Re: Patch to allow disk support to work with non CHS devices
- Organization: Xylanta Ltd
- References: <446B4BBB.9030605@arcom.com> <20060517162333.GP14082@lunn.ch> <446B50E8.4010804@arcom.com> <20060519101759.GF7128@lunn.ch> <000b01c6c4a5$4b3e2650$a001a8c0@Kimbara> <20060821133452.GH2053@lunn.ch>
- Reply-to: "Andy Jackson" <andy at xylanta dot com>
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