From 247a87cdab0fe70a30c73e81d5d634f5366f3c1e Mon Sep 17 00:00:00 2001 From: ian Date: Thu, 31 Jul 2014 16:54:54 +0000 Subject: 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). --- sys/dev/mmc/mmcsd.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'sys/dev/mmc/mmcsd.c') 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, -- cgit v1.1