On Thu, Apr 28, 2011 at 3:33 AM, Linus Walleij <linus.walleij@xxxxxxxxxx> wrote: > 2011/3/5 Linus Walleij <linus.walleij@xxxxxxxxxxxxxx>: > >> This patch is a squash of patches from Gary King and Ulf >> Hansson done in Android trees, hopefully fixing the issue properly. >> >> The csd sector count reported by eMMC 4.3+ cards includes the boot >> partition size; subtract this from the size reported to the disk >> since the boot partition is inaccessible. > > I'm trying to get somewhere with this. > > AFAICT reading the spec it does not say anything about the > boot sectors being subtracted from the pool of available sectors, > i.e. either you set these sectors aside permanently or you do not > support the feature. > > So the behaviour fixed in this patch should be a per-card quirk, > not generic. > > Then this: > >> + /* size is in 256K chunks, i.e. 512 sectors each */ >> + boot_sectors = ext_csd[EXT_CSD_BOOT_SIZE_MULTI] * 512; > > This is not what the spec says. It states that the size is > in 128KB chunks, so the correct code shoul be: > > boot_sectors = ext_csd[EXT_CSD_BOOT_SIZE_MULTI] * 256; > > Any comments on this? I guess it's been working, the > patch prent in the Android kernels simply remove twice as > many sectors as required from the card sector pool :-/ This patch was dropped from the Android tree, it is clearly not correct for all eMMC devices. We have worked around the problem on the affected by letting the bootloader tell us where it put the GPT near the end of the device, in which case the actual size of the device becomes irrelevant. I'm not convinced that any eMMC chip has this problem, it may have just been confusion on the part of nVidia caused by their bootloader's "logical block" addressing system, where the boot sectors are addressed as 0, and the regular area starts at sizeof(boot sector). The off-by-two error may have been caused by the affected eMMC having two boot sectors. I would suggest forgetting about this patch unless someone can prove that there is a device that fails to write at the end. -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html