Re: oddity mounting MMC/SD cards

From: Michael Butler <imb_at_protected-networks.net>
Date: Sun, 14 Aug 2011 09:34:10 -0400
On 08/14/11 07:13, Alexander Motin wrote:

> On 13.08.2011 23:56, Michael Butler wrote:
>> vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
>> Aug 13 16:53:38 toshi kernel: GEOM_PART: partition 1 has end offset
>> beyond last LBA: 31116287>  5950463
>> Aug 13 16:53:38 toshi kernel: GEOM_PART: integrity check failed (mmcsd0,
>> MBR)
>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> It looks like consequence of r222475. Could you try this patch:
> 
> --- dev/mmc/mmcsd.c.prev        2011-08-14 14:09:35.000000000 +0300
> +++ dev/mmc/mmcsd.c     2011-08-14 14:09:14.000000000 +0300
> _at__at_ -137,7 +137,7 _at__at_ mmcsd_attach(device_t dev)
>         d->d_drv1 = sc;
>         d->d_maxsize = 4*1024*1024;     /* Maximum defined SD card AU
> size. */
>         d->d_sectorsize = mmc_get_sector_size(dev);
> -       d->d_mediasize = mmc_get_media_size(dev) * d->d_sectorsize;
> +       d->d_mediasize = (off_t)mmc_get_media_size(dev) * d->d_sectorsize;
>         d->d_stripeoffset = 0;
>         d->d_stripesize = mmc_get_erase_sector(dev) * d->d_sectorsize;
>         d->d_unit = device_get_unit(dev);

That worked :-)

However, I found another (smaller) card where it didn't help :-(

sdhci0-slot0: Card inserted
mmc0: <MMC/SD bus> on sdhci0
mmc0: Probing bus
mmc0: SD probe: OK (OCR: 0x00ff8000)
mmc0: Current OCR: 0x00ff8000
mmc0: Probing cards
mmc0: New card detected (CID 02544d5341303447049c02a7f6009b00)
mmc0: Card at relative address 4660 added:
mmc0:  card: SD High Capacity (0x2/0x544d/"SA04G" rev 0.4 m/d 11.2009
s/n 9c02a7f6)
mmc0:  bus: 4bit, 50MHz, high speed timing
mmc0:  memory: 7733248 blocks, erase sector 8192 blocks, read-only
mmc0: setting transfer rate to 30.000MHz
mmcsd0: 3776MB <SDHC Memory Card> (read-only) at mmc0 24MHz/4bit
GEOM: new disk mmcsd0
mmc0: setting bus width to 4 bits
GEOM_PART: partition 1 has end offset beyond last LBA: 7741438 > 7733247
GEOM_PART: integrity check failed (mmcsd0, MBR)

The complaint appears to be valid, given fdisk's output .. is this
something to do with the 'relative address'?

imb_at_toshi:/usr/src> fdisk /dev/mmcsd0
******* Working on device /dev/mmcsd0 *******
parameters extracted from in-core disklabel are:
cylinders=481 heads=255 sectors/track=63 (16065 blks/cyl)

parameters to be used for BIOS calculations are:
cylinders=481 heads=255 sectors/track=63 (16065 blks/cyl)

Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 11 (0x0b),(DOS or Windows 95 with 32 bit FAT)
    start 8192, size 7733247 (3775 Meg), flag 0
        beg: cyl 1/ head 2/ sector 3;
        end: cyl 960/ head 48/ sector 48

	imb
Received on Sun Aug 14 2011 - 11:34:14 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:16 UTC