summaryrefslogtreecommitdiffstats
path: root/sys/dev/mmc/mmcsd.c
diff options
context:
space:
mode:
authorian <ian@FreeBSD.org>2014-07-31 16:54:54 +0000
committerian <ian@FreeBSD.org>2014-07-31 16:54:54 +0000
commit247a87cdab0fe70a30c73e81d5d634f5366f3c1e (patch)
treecabaea7ecb0221031ef5d14f345b5c38e5fb1a51 /sys/dev/mmc/mmcsd.c
parent3ae45206995c699d07d6d54d7ac06770461ca5ff (diff)
downloadFreeBSD-src-247a87cdab0fe70a30c73e81d5d634f5366f3c1e.zip
FreeBSD-src-247a87cdab0fe70a30c73e81d5d634f5366f3c1e.tar.gz
Export an mmc or sd card's serial number from the mmc layer as an ivar.
In the mmcsd layer use this value to populate disk->d_ident. Also set disk->d_descr to the full set of card identification info (includes vendor, model, manufacturing date, etc).
Diffstat (limited to 'sys/dev/mmc/mmcsd.c')
-rw-r--r--sys/dev/mmc/mmcsd.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/dev/mmc/mmcsd.c b/sys/dev/mmc/mmcsd.c
index f24537e..5b2bc2c 100644
--- a/sys/dev/mmc/mmcsd.c
+++ b/sys/dev/mmc/mmcsd.c
@@ -163,6 +163,9 @@ mmcsd_attach(device_t dev)
d->d_unit = device_get_unit(dev);
d->d_flags = DISKFLAG_CANDELETE;
d->d_delmaxsize = mmc_get_erase_sector(dev) * d->d_sectorsize * 1; /* conservative */
+ strlcpy(d->d_ident, mmc_get_card_sn_string(dev), sizeof(d->d_ident));
+ strlcpy(d->d_descr, mmc_get_card_id_string(dev), sizeof(d->d_descr));
+
/*
* Display in most natural units. There's no cards < 1MB. The SD
* standard goes to 2GiB due to its reliance on FAT, but the data
@@ -188,7 +191,7 @@ mmcsd_attach(device_t dev)
speed = mmcbr_get_clock(device_get_parent(dev));
maxblocks = mmc_get_max_data(dev);
device_printf(dev, "%ju%cB <%s>%s at %s %d.%01dMHz/%dbit/%d-block\n",
- mb, unit, mmc_get_card_id_string(dev),
+ mb, unit, d->d_descr,
mmc_get_read_only(dev) ? " (read-only)" : "",
device_get_nameunit(device_get_parent(dev)),
speed / 1000000, (speed / 100000) % 10,
OpenPOWER on IntegriCloud