Define and use MMC_SECTOR_SIZE.
Make mmc_get_media_size now return an off_t and remove now useless cast.
This commit is contained in:
parent
a84f3c7af9
commit
38c51cbe85
@ -760,13 +760,13 @@ mmc_read_ivar(device_t bus, device_t child, int which, u_char *result)
|
||||
*(int *)result = ivar->csd.dsr_imp;
|
||||
break;
|
||||
case MMC_IVAR_MEDIA_SIZE:
|
||||
*(int *)result = ivar->csd.capacity / DEV_BSIZE;
|
||||
*(off_t *)result = ivar->csd.capacity / MMC_SECTOR_SIZE;
|
||||
break;
|
||||
case MMC_IVAR_RCA:
|
||||
*(int *)result = ivar->rca;
|
||||
break;
|
||||
case MMC_IVAR_SECTOR_SIZE:
|
||||
*(int *)result = 512;
|
||||
*(int *)result = MMC_SECTOR_SIZE;
|
||||
break;
|
||||
case MMC_IVAR_TRAN_SPEED:
|
||||
*(int *)result = ivar->csd.tran_speed;
|
||||
|
@ -351,4 +351,12 @@ struct mmc_csd
|
||||
wp_grp_enable:1;
|
||||
};
|
||||
|
||||
/*
|
||||
* Older versions of the MMC standard had a variable sector size. However,
|
||||
* I've been able to find no old MMC or SD cards that have a non 512
|
||||
* byte sector size anywhere, so we assume that such cards are very rare
|
||||
* and only note their existance in passing here...
|
||||
*/
|
||||
#define MMC_SECTOR_SIZE 512
|
||||
|
||||
#endif /* DEV_MMCREG_H */
|
||||
|
@ -128,7 +128,7 @@ mmcsd_attach(device_t dev)
|
||||
sc->disk->d_drv1 = sc;
|
||||
sc->disk->d_maxsize = MAXPHYS; /* Maybe ask bridge? */
|
||||
sc->disk->d_sectorsize = mmc_get_sector_size(dev);
|
||||
sc->disk->d_mediasize = ((off_t)mmc_get_media_size(dev)) *
|
||||
sc->disk->d_mediasize = mmc_get_media_size(dev) *
|
||||
mmc_get_sector_size(dev);
|
||||
sc->disk->d_unit = device_get_unit(dev);
|
||||
|
||||
|
@ -72,7 +72,7 @@ enum mmc_device_ivars {
|
||||
__BUS_ACCESSOR(mmc, var, MMC, ivar, type)
|
||||
|
||||
MMC_ACCESSOR(dsr_imp, DSR_IMP, int)
|
||||
MMC_ACCESSOR(media_size, MEDIA_SIZE, int)
|
||||
MMC_ACCESSOR(media_size, MEDIA_SIZE, off_t)
|
||||
MMC_ACCESSOR(rca, RCA, int)
|
||||
MMC_ACCESSOR(sector_size, SECTOR_SIZE, int)
|
||||
MMC_ACCESSOR(tran_speed, TRAN_SPEED, int)
|
||||
|
Loading…
x
Reference in New Issue
Block a user