From ilepore@damnhippie.dyndns.org  Tue Apr 19 15:33:40 2011
Return-Path: <ilepore@damnhippie.dyndns.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8967F106564A
	for <freebsd-gnats-submit@freebsd.org>; Tue, 19 Apr 2011 15:33:40 +0000 (UTC)
	(envelope-from ilepore@damnhippie.dyndns.org)
Received: from qmta01.emeryville.ca.mail.comcast.net (qmta01.emeryville.ca.mail.comcast.net [76.96.30.16])
	by mx1.freebsd.org (Postfix) with ESMTP id 6E78B8FC0C
	for <freebsd-gnats-submit@freebsd.org>; Tue, 19 Apr 2011 15:33:40 +0000 (UTC)
Received: from omta21.emeryville.ca.mail.comcast.net ([76.96.30.88])
	by qmta01.emeryville.ca.mail.comcast.net with comcast
	id ZSVp1g0071u4NiLA1TLWNE; Tue, 19 Apr 2011 15:20:30 +0000
Received: from damnhippie.dyndns.org ([24.8.232.202])
	by omta21.emeryville.ca.mail.comcast.net with comcast
	id ZTLU1g01M4NgCEG8hTLVHb; Tue, 19 Apr 2011 15:20:29 +0000
Received: from revolution.hippie.lan (revolution.hippie.lan [172.22.42.240])
	by damnhippie.dyndns.org (8.14.3/8.14.3) with ESMTP id p3JFKRku067915
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 19 Apr 2011 09:20:27 -0600 (MDT)
	(envelope-from ilepore@damnhippie.dyndns.org)
Received: (from ilepore@localhost)
	by revolution.hippie.lan (8.14.4/8.14.4/Submit) id p3JFKQta028382;
	Tue, 19 Apr 2011 09:20:26 -0600 (MDT)
	(envelope-from ilepore)
Message-Id: <201104191520.p3JFKQta028382@revolution.hippie.lan>
Date: Tue, 19 Apr 2011 09:20:26 -0600 (MDT)
From: Ian Lepore <freebsd@damnhippie.dyndns.org>
Reply-To: Ian Lepore <freebsd@damnhippie.dyndns.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [patch] Minor bugfixes and enhancements to mmc and mmcsd drivers
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         156496
>Category:       arm
>Synopsis:       [patch] Minor bugfixes and enhancements to mmc and mmcsd drivers
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-arm
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Apr 19 15:40:03 UTC 2011
>Closed-Date:    Sat May 26 10:04:56 UTC 2012
>Last-Modified:  Sat May 26 10:04:56 UTC 2012
>Originator:     Ian Lepore <freebsd@damnhippie.dyndns.org>
>Release:        FreeBSD 8.2-RC3 arm
>Organization:
none
>Environment:
FreeBSD dvb 8.2-RC3 FreeBSD 8.2-RC3 #49: Tue Feb 15 22:52:14 UTC 2011     root@revolution.hippie.lan:/usr/obj/arm/usr/src/sys/DVB  arm

>Description:
This applies several fixes and minor enhancements to the mmc and mmcsd drivers.

Fixes:

 - When switching to 4-bit operation, send a SET_CLR_CARD_DETECT command
   to disconnect the card-detect pullup resistor from the DAT3 line before 
   sending the SET_BUS_WIDTH command.

 - Add the missing "reserved" zero entry to the mantissa table used to 
   decode various CSD fields.  This was causing SD cards to report that they
   could run at 30mhz instead of the maximum 25mhz mandated in the spec.

Enhancements:

 - At the MMC layer, format various info from the CID into a string that
   uniquely identifies the card instance (manufacturer number, serial 
   number, product name and revision,etc).  Export it as an instance variable.

 - At the MMCSD layer, display the formatted card id string, and also report
   the clock speed of the hardware (not the card's max speed), and the number
   of bits and number of blocks per transfer.  It comes out like this now:

     mmcsd0: 968MB <SD SD01G 8.0 SN 276886905 Mfg 08/2008 by 3 SD> at mmc0 22.5MHz/4bit/128-block

These diffs were generated against code from FreeBSD 9 as it existed on 
March 15 2011 (re-tested on April 19 2011).

These changes have been tested on ARM at91rm9200 hardware.  I don't have 
access to an sdhci controller for testing, but since these changes don't 
affect the mmc<->underlying-bridge-hardware interface in any way, I don't 
anticipate any problems.

Work sponsored by: Symmetricom, Inc.

>How-To-Repeat:

>Fix:

--- patch-mmcsd begins here ---
--- sys/dev/mmc/mmc.c	2011-03-15 08:45:51.000000000 -0600
+++ sys/dev/mmc2/mmc.c	2011-03-15 08:54:38.000000000 -0600
@@ -101,6 +101,7 @@
 	uint32_t tran_speed;	/* Max speed in normal mode */
 	uint32_t hs_tran_speed;	/* Max speed in high speed mode */
 	uint32_t erase_sector;	/* Card native erase sector size */
+	char card_id_string[64];/* Formatted CID info (serial, mfg, etc) */
 };
 
 #define CMD_RETRIES	3
@@ -606,19 +607,26 @@
 
 	if (mmcbr_get_mode(sc->dev) == mode_sd) {
 		memset(&cmd, 0, sizeof(struct mmc_command));
-		cmd.opcode = ACMD_SET_BUS_WIDTH;
+		cmd.opcode = ACMD_SET_CLR_CARD_DETECT;
 		cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
-		switch (width) {
-		case bus_width_1:
-			cmd.arg = SD_BUS_WIDTH_1;
-			break;
-		case bus_width_4:
-			cmd.arg = SD_BUS_WIDTH_4;
-			break;
-		default:
-			return (MMC_ERR_INVALID);
-		}
+		cmd.arg   = SD_CLR_CARD_DETECT;
 		err = mmc_wait_for_app_cmd(sc, rca, &cmd, CMD_RETRIES);
+		if (err == 0) {
+			memset(&cmd, 0, sizeof(struct mmc_command));
+			cmd.opcode = ACMD_SET_BUS_WIDTH;
+			cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
+			switch (width) {
+			case bus_width_1:
+				cmd.arg = SD_BUS_WIDTH_1;
+				break;
+			case bus_width_4:
+				cmd.arg = SD_BUS_WIDTH_4;
+				break;
+			default:
+				return (MMC_ERR_INVALID);
+			}
+			err = mmc_wait_for_app_cmd(sc, rca, &cmd, CMD_RETRIES);
+		}
 	} else {
 		switch (width) {
 		case bus_width_1:
@@ -788,11 +796,45 @@
 	cid->mdt_year = mmc_get_bits(raw_cid, 128, 8, 4) + 1997;
 }
 
+static void
+mmc_format_card_id_string(struct mmc_ivars * ivar)
+{
+	char oidstr[8];
+	uint8_t c1 = (ivar->cid.oid >> 8) & 0x0FF;
+	uint8_t c2 = ivar->cid.oid & 0x0FF;
+
+	/* Format a card ID string for use by the mmcsd driver, it's what 
+	 * appears between the <> in the following:
+	 *
+	 * mmcsd0: 968MB <SD SD01G 8.0 SN 2686905 Mfg 08/2008 by 3 TN> at mmc0
+	 * 22.5MHz/4bit/128-block
+	 *
+	 * The card_id_string in mmc_ivars is currently allocated as 64 bytes,
+	 * and our max formatted length is currently 55 bytes if every field
+	 * contains the largest value.
+	 *
+	 * Sometimes the oid is two printable ascii chars; when it's not,
+	 * format it as 0xnnnn instead.
+	 */
+
+	if (c1 > 0x1F && c1 < 0x7F && c2 > 0x1F && c2 < 0x7F)
+		snprintf(oidstr, sizeof(oidstr), "%c%c", c1, c2);
+	else
+		snprintf(oidstr, sizeof(oidstr), "0x%04X", ivar->cid.oid);
+        
+	snprintf(ivar->card_id_string, sizeof(ivar->card_id_string),
+            "%s%s %s %d.%d SN %d Mfg %02d/%04d by %d %s",
+		 ivar->mode == mode_sd ? "SD" : "MMC", ivar->high_cap ? "HC" : "", 
+		 ivar->cid.pnm, ivar->cid.prv >> 4, ivar->cid.prv & 0x0f,
+		 ivar->cid.psn, ivar->cid.mdt_month, ivar->cid.mdt_year,
+		 ivar->cid.mid, oidstr);
+}
+
 static const int exp[8] = {
 	1, 10, 100, 1000, 10000, 100000, 1000000, 10000000
 };
 static const int mant[16] = {
-	10, 12, 13, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 70, 80
+	0, 10, 12, 13, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 70, 80
 };
 static const int cur_min[8] = {
 	500, 1000, 5000, 10000, 25000, 35000, 60000, 100000
@@ -1080,13 +1109,8 @@
 {
 	device_printf(dev, "Card at relative address %d%s:\n",
 	    ivar->rca, newcard ? " added" : "");
-	device_printf(dev, " card: %s%s (0x%x/0x%x/\"%s\" rev %d.%d "
-	    "m/d %02d.%04d s/n %08x)\n",
-	    ivar->mode == mode_sd ? "SD" : "MMC",
-	    ivar->high_cap ? " High Capacity" : "", 
-	    ivar->cid.mid, ivar->cid.oid,
-	    ivar->cid.pnm, ivar->cid.prv >> 4, ivar->cid.prv & 0x0f,
-	    ivar->cid.mdt_month, ivar->cid.mdt_year, ivar->cid.psn);
+	device_printf(dev, " card: %s\n",
+		      ivar->card_id_string);
 	device_printf(dev, " bus: %ubit, %uMHz%s\n",
 	    (ivar->bus_width == bus_width_1 ? 1 :
 	    (ivar->bus_width == bus_width_4 ? 4 : 8)),
@@ -1188,6 +1212,7 @@
 			if ((mmcbr_get_caps(sc->dev) & MMC_CAP_4_BIT_DATA) &&
 			    (ivar->scr.bus_widths & SD_SCR_BUS_WIDTH_4))
 				ivar->bus_width = bus_width_4;
+			mmc_format_card_id_string(ivar);
 			if (bootverbose || mmc_debug)
 				mmc_log_card(sc->dev, ivar, newcard);
 			if (newcard) {
@@ -1245,6 +1270,7 @@
 			ivar->bus_width = bus_width_1;
 			ivar->timing = bus_timing_normal;
 		}
+		mmc_format_card_id_string(ivar);
 		if (bootverbose || mmc_debug)
 			mmc_log_card(sc->dev, ivar, newcard);
 		if (newcard) {
@@ -1477,6 +1503,9 @@
 	case MMC_IVAR_MAX_DATA:
 		*(int *)result = mmcbr_get_max_data(bus);
 		break;
+	case MMC_IVAR_CARD_ID_STRING:
+		*(char **)result = ivar->card_id_string;
+		break;
 	}
 	return (0);
 }
--- sys/dev/mmc/mmcsd.c	2011-03-15 08:45:51.000000000 -0600
+++ sys/dev/mmc2/mmcsd.c	2011-03-15 07:29:59.000000000 -0600
@@ -68,9 +68,17 @@
 
 #include <dev/mmc/mmcvar.h>
 #include <dev/mmc/mmcreg.h>
-
+#include <dev/mmc/mmcbrvar.h>
 #include "mmcbus_if.h"
 
+/* The kthread_* functions were renamed to kproc_* in FreeBSD 8;
+ * these defines help backport this code to earlier versions.
+ */
+#if __FreeBSD__ < 8
+#define kproc_create   kthread_create
+#define kproc_exit     kthread_exit
+#endif
+
 struct mmcsd_softc {
 	device_t dev;
 	struct mtx sc_mtx;
@@ -95,7 +103,6 @@
 	off_t offset, size_t length);
 static void mmcsd_task(void *arg);
 
-static const char *mmcsd_card_name(device_t dev);
 static int mmcsd_bus_bit_width(device_t dev);
 
 #define MMCSD_LOCK(_sc)		mtx_lock(&(_sc)->sc_mtx)
@@ -122,6 +129,8 @@
 	struct mmcsd_softc *sc;
 	struct disk *d;
 	intmax_t mb;
+	uint32_t speed;
+	uint32_t maxblocks;
 	char unit;
 
 	sc = device_get_softc(dev);
@@ -157,11 +166,21 @@
 		unit = 'G';
 		mb /= 1024;
 	}
-	device_printf(dev, "%ju%cB <%s Memory Card>%s at %s %dMHz/%dbit\n",
-	    mb, unit, mmcsd_card_name(dev),
+        /* Report the clock speed of the underlying hardware, which might be
+         * different than what the card reports due to hardware limitations.
+         * Report how many blocks the hardware transfers at once, but clip the
+         * number to MAXPHYS since the system won't initiate bigger transfers.
+         */
+	speed = mmcbr_get_clock(device_get_parent(dev));
+	maxblocks = mmc_get_max_data(dev);
+	if (maxblocks > MAXPHYS)
+		maxblocks = MAXPHYS;
+	device_printf(dev, "%ju%cB <%s>%s at %s %d.%01dMHz/%dbit/%d-block\n",
+	    mb, unit, mmc_get_card_id_string(dev),
 	    mmc_get_read_only(dev) ? " (read-only)" : "",
 	    device_get_nameunit(device_get_parent(dev)),
-	    mmc_get_tran_speed(dev) / 1000000, mmcsd_bus_bit_width(dev));
+	    speed / 1000000, (speed / 100000) % 10, 
+	    mmcsd_bus_bit_width(dev), maxblocks);
 	disk_create(d, DISK_VERSION);
 	bioq_init(&sc->bio_queue);
 
@@ -500,16 +519,6 @@
 	kproc_exit(0);
 }
 
-static const char *
-mmcsd_card_name(device_t dev)
-{
-	if (mmc_get_card_type(dev) == mode_mmc)
-		return ("MMC");
-	if (mmc_get_high_cap(dev))
-		return ("SDHC");
-	return ("SD");
-}
-
 static int
 mmcsd_bus_bit_width(device_t dev)
 {
--- sys/dev/mmc/mmcreg.h	2011-03-15 08:45:51.000000000 -0600
+++ sys/dev/mmc2/mmcreg.h	2011-03-14 18:10:10.000000000 -0600
@@ -330,6 +330,9 @@
 #define SD_SWITCH_HS_MODE	1
 #define SD_SWITCH_NOCHANGE	0xF
 
+#define SD_CLR_CARD_DETECT      0
+#define SD_SET_CARD_DETECT      1
+
 #define	SD_MAX_HS		50000000
 
 /* OCR bits */
--- sys/dev/mmc/mmcvar.h	2011-03-15 08:45:51.000000000 -0600
+++ sys/dev/mmc2/mmcvar.h	2011-03-15 08:13:20.000000000 -0600
@@ -69,6 +69,7 @@
     MMC_IVAR_BUS_WIDTH,
     MMC_IVAR_ERASE_SECTOR,
     MMC_IVAR_MAX_DATA,
+    MMC_IVAR_CARD_ID_STRING,
 //    MMC_IVAR_,
 };
 
@@ -89,5 +90,6 @@
 MMC_ACCESSOR(bus_width, BUS_WIDTH, int)
 MMC_ACCESSOR(erase_sector, ERASE_SECTOR, int)
 MMC_ACCESSOR(max_data, MAX_DATA, int)
+MMC_ACCESSOR(card_id_string, CARD_ID_STRING, const char *)
 
 #endif /* DEV_MMC_MMCVAR_H */
--- patch-mmcsd ends here ---

>Release-Note:
>Audit-Trail:

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: arm/156496: commit references a PR
Date: Sat, 21 Apr 2012 01:52:06 +0000 (UTC)

 Author: marius
 Date: Sat Apr 21 01:51:16 2012
 New Revision: 234524
 URL: http://svn.freebsd.org/changeset/base/234524
 
 Log:
   o Fixes:
     - When switching to 4-bit operation, send a SET_CLR_CARD_DETECT command
       to disconnect the card-detect pull-up resistor from the DAT3 line before
       sending the SET_BUS_WIDTH command.
     - Add the missing "reserved" zero entry to the mantissa table used to
       decode various CSD fields. This was causing SD cards to report that they
       could run at 30 MHz instead of the maximum 25 MHz mandated in the spec.
   o Enhancements:
     - At the MMC layer, format various info from the CID into a string that
       uniquely identifies the card instance (manufacturer number, serial
       number, product name and revision, etc). Export it as an instance
       variable.
     - At the MMCSD layer, display the formatted card ID string, and also
       report the clock speed of the hardware (not the card's max speed), and
       the number of bits and number of blocks per transfer. It comes out like
       this now:
       mmcsd0: 968MB <SD SD01G 8.0 SN 276886905 MFG 08/2008 by 3 SD> at mmc0
       22.5MHz/4bit/128-block
   o Use DEVMETHOD_END.
   o Use NULL instead of 0 for pointers.
   
   PR:		156496
   Submitted by:	Ian Lepore
   MFC after:	1 week
 
 Modified:
   head/sys/dev/mmc/mmc.c
   head/sys/dev/mmc/mmcbrvar.h
   head/sys/dev/mmc/mmcreg.h
   head/sys/dev/mmc/mmcsd.c
   head/sys/dev/mmc/mmcvar.h
   head/sys/modules/mmcsd/Makefile
 
 Modified: head/sys/dev/mmc/mmc.c
 ==============================================================================
 --- head/sys/dev/mmc/mmc.c	Sat Apr 21 00:51:28 2012	(r234523)
 +++ head/sys/dev/mmc/mmc.c	Sat Apr 21 01:51:16 2012	(r234524)
 @@ -101,6 +101,7 @@ struct mmc_ivars {
  	uint32_t tran_speed;	/* Max speed in normal mode */
  	uint32_t hs_tran_speed;	/* Max speed in high speed mode */
  	uint32_t erase_sector;	/* Card native erase sector size */
 +	char card_id_string[64];/* Formatted CID info (serial, MFG, etc) */
  };
  
  #define CMD_RETRIES	3
 @@ -140,6 +141,7 @@ static void mmc_app_decode_scr(uint32_t 
  static int mmc_send_ext_csd(struct mmc_softc *sc, uint8_t *rawextcsd);
  static void mmc_scan(struct mmc_softc *sc);
  static int mmc_delete_cards(struct mmc_softc *sc);
 +static void mmc_format_card_id_string(struct mmc_ivars *ivar);
  
  static void
  mmc_ms_delay(int ms)
 @@ -606,6 +608,13 @@ mmc_set_card_bus_width(struct mmc_softc 
  
  	if (mmcbr_get_mode(sc->dev) == mode_sd) {
  		memset(&cmd, 0, sizeof(struct mmc_command));
 +		cmd.opcode = ACMD_SET_CLR_CARD_DETECT;
 +		cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
 +		cmd.arg = SD_CLR_CARD_DETECT;
 +		err = mmc_wait_for_app_cmd(sc, rca, &cmd, CMD_RETRIES);
 +		if (err != 0)
 +			return (err);
 +		memset(&cmd, 0, sizeof(struct mmc_command));
  		cmd.opcode = ACMD_SET_BUS_WIDTH;
  		cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
  		switch (width) {
 @@ -788,15 +797,52 @@ mmc_decode_cid_mmc(uint32_t *raw_cid, st
  	cid->mdt_year = mmc_get_bits(raw_cid, 128, 8, 4) + 1997;
  }
  
 +static void
 +mmc_format_card_id_string(struct mmc_ivars *ivar)
 +{
 +	char oidstr[8];
 +	uint8_t c1;
 +	uint8_t c2;
 +
 +	/*
 +	 * Format a card ID string for use by the mmcsd driver, it's what
 +	 * appears between the <> in the following:
 +	 * mmcsd0: 968MB <SD SD01G 8.0 SN 2686905 Mfg 08/2008 by 3 TN> at mmc0
 +	 * 22.5MHz/4bit/128-block
 +	 *
 +	 * The card_id_string in mmc_ivars is currently allocated as 64 bytes,
 +	 * and our max formatted length is currently 55 bytes if every field
 +	 * contains the largest value.
 +	 *
 +	 * Sometimes the oid is two printable ascii chars; when it's not,
 +	 * format it as 0xnnnn instead.
 +	 */
 +	c1 = (ivar->cid.oid >> 8) & 0x0ff;
 +	c2 = ivar->cid.oid & 0x0ff;
 +	if (c1 > 0x1f && c1 < 0x7f && c2 > 0x1f && c2 < 0x7f)
 +		snprintf(oidstr, sizeof(oidstr), "%c%c", c1, c2);
 +	else
 +		snprintf(oidstr, sizeof(oidstr), "0x%04x", ivar->cid.oid);
 +	snprintf(ivar->card_id_string, sizeof(ivar->card_id_string),
 +	    "%s%s %s %d.%d SN %d MFG %02d/%04d by %d %s",
 +	    ivar->mode == mode_sd ? "SD" : "MMC", ivar->high_cap ? "HC" : "",
 +	    ivar->cid.pnm, ivar->cid.prv >> 4, ivar->cid.prv & 0x0f,
 +	    ivar->cid.psn, ivar->cid.mdt_month, ivar->cid.mdt_year,
 +	    ivar->cid.mid, oidstr);
 +}
 +
  static const int exp[8] = {
  	1, 10, 100, 1000, 10000, 100000, 1000000, 10000000
  };
 +
  static const int mant[16] = {
 -	10, 12, 13, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 70, 80
 +	0, 10, 12, 13, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 70, 80
  };
 +
  static const int cur_min[8] = {
  	500, 1000, 5000, 10000, 25000, 35000, 60000, 100000
  };
 +
  static const int cur_max[8] = {
  	1000, 5000, 10000, 25000, 35000, 45000, 800000, 200000
  };
 @@ -1080,13 +1126,7 @@ mmc_log_card(device_t dev, struct mmc_iv
  {
  	device_printf(dev, "Card at relative address %d%s:\n",
  	    ivar->rca, newcard ? " added" : "");
 -	device_printf(dev, " card: %s%s (0x%x/0x%x/\"%s\" rev %d.%d "
 -	    "m/d %02d.%04d s/n %08x)\n",
 -	    ivar->mode == mode_sd ? "SD" : "MMC",
 -	    ivar->high_cap ? " High Capacity" : "", 
 -	    ivar->cid.mid, ivar->cid.oid,
 -	    ivar->cid.pnm, ivar->cid.prv >> 4, ivar->cid.prv & 0x0f,
 -	    ivar->cid.mdt_month, ivar->cid.mdt_year, ivar->cid.psn);
 +	device_printf(dev, " card: %s\n", ivar->card_id_string);
  	device_printf(dev, " bus: %ubit, %uMHz%s\n",
  	    (ivar->bus_width == bus_width_1 ? 1 :
  	    (ivar->bus_width == bus_width_4 ? 4 : 8)),
 @@ -1188,6 +1228,7 @@ mmc_discover_cards(struct mmc_softc *sc)
  			if ((mmcbr_get_caps(sc->dev) & MMC_CAP_4_BIT_DATA) &&
  			    (ivar->scr.bus_widths & SD_SCR_BUS_WIDTH_4))
  				ivar->bus_width = bus_width_4;
 +			mmc_format_card_id_string(ivar);
  			if (bootverbose || mmc_debug)
  				mmc_log_card(sc->dev, ivar, newcard);
  			if (newcard) {
 @@ -1245,6 +1286,7 @@ mmc_discover_cards(struct mmc_softc *sc)
  			ivar->bus_width = bus_width_1;
  			ivar->timing = bus_timing_normal;
  		}
 +		mmc_format_card_id_string(ivar);
  		if (bootverbose || mmc_debug)
  			mmc_log_card(sc->dev, ivar, newcard);
  		if (newcard) {
 @@ -1477,6 +1519,9 @@ mmc_read_ivar(device_t bus, device_t chi
  	case MMC_IVAR_MAX_DATA:
  		*result = mmcbr_get_max_data(bus);
  		break;
 +	case MMC_IVAR_CARD_ID_STRING:
 +		*(char **)result = ivar->card_id_string;
 +		break;
  	}
  	return (0);
  }
 @@ -1527,7 +1572,7 @@ static device_method_t mmc_methods[] = {
  	DEVMETHOD(mmcbus_acquire_bus, mmc_acquire_bus),
  	DEVMETHOD(mmcbus_release_bus, mmc_release_bus),
  
 -	{0, 0},
 +	DEVMETHOD_END
  };
  
  static driver_t mmc_driver = {
 @@ -1537,6 +1582,5 @@ static driver_t mmc_driver = {
  };
  static devclass_t mmc_devclass;
  
 -
  DRIVER_MODULE(mmc, at91_mci, mmc_driver, mmc_devclass, NULL, NULL);
  DRIVER_MODULE(mmc, sdhci, mmc_driver, mmc_devclass, NULL, NULL);
 
 Modified: head/sys/dev/mmc/mmcbrvar.h
 ==============================================================================
 --- head/sys/dev/mmc/mmcbrvar.h	Sat Apr 21 00:51:28 2012	(r234523)
 +++ head/sys/dev/mmc/mmcbrvar.h	Sat Apr 21 01:51:16 2012	(r234524)
 @@ -56,6 +56,7 @@
  #define DEV_MMC_MMCBRVAR_H
  
  #include <dev/mmc/bridge.h>
 +#include <dev/mmc/mmcreg.h>
  #include "mmcbr_if.h"
  
  enum mmcbr_device_ivars {
 @@ -72,8 +73,7 @@ enum mmcbr_device_ivars {
      MMCBR_IVAR_VDD,
      MMCBR_IVAR_CAPS,
      MMCBR_IVAR_TIMING,
 -    MMCBR_IVAR_MAX_DATA,
 -//    MMCBR_IVAR_,
 +    MMCBR_IVAR_MAX_DATA
  };
  
  /*
 
 Modified: head/sys/dev/mmc/mmcreg.h
 ==============================================================================
 --- head/sys/dev/mmc/mmcreg.h	Sat Apr 21 00:51:28 2012	(r234523)
 +++ head/sys/dev/mmc/mmcreg.h	Sat Apr 21 01:51:16 2012	(r234524)
 @@ -139,8 +139,8 @@ struct mmc_command {
  #define	R1_READY_FOR_DATA (1u << 8)		/* sx, a */
  #define	R1_APP_CMD (1u << 5)			/* sr, c */
  #define	R1_AKE_SEQ_ERROR (1u << 3)		/* er, c */
 -#define	R1_STATUS(x)            (x & 0xFFFFE000
 -#define	R1_CURRENT_STATE(x) ((x) & R1_CURRENT_STATE_MASK) >> 9
 +#define	R1_STATUS(x)		((x) & 0xFFFFE000)
 +#define	R1_CURRENT_STATE(x)	(((x) & R1_CURRENT_STATE_MASK) >> 9)
  #define	R1_STATE_IDLE	0
  #define	R1_STATE_READY	1
  #define	R1_STATE_IDENT	2
 @@ -330,6 +330,9 @@ struct mmc_request {
  #define SD_SWITCH_HS_MODE	1
  #define SD_SWITCH_NOCHANGE	0xF
  
 +#define	SD_CLR_CARD_DETECT	0
 +#define	SD_SET_CARD_DETECT	1
 +
  #define	SD_MAX_HS		50000000
  
  /* OCR bits */
 @@ -380,7 +383,7 @@ struct mmc_cid {
  	uint8_t fwrev;
  };
  
 -struct mmc_csd 
 +struct mmc_csd
  {
  	uint8_t csd_structure;
  	uint8_t spec_vers;
 
 Modified: head/sys/dev/mmc/mmcsd.c
 ==============================================================================
 --- head/sys/dev/mmc/mmcsd.c	Sat Apr 21 00:51:28 2012	(r234523)
 +++ head/sys/dev/mmc/mmcsd.c	Sat Apr 21 01:51:16 2012	(r234524)
 @@ -66,11 +66,17 @@ __FBSDID("$FreeBSD$");
  #include <sys/mutex.h>
  #include <geom/geom_disk.h>
  
 -#include <dev/mmc/mmcvar.h>
 +#include <dev/mmc/mmcbrvar.h>
  #include <dev/mmc/mmcreg.h>
 +#include <dev/mmc/mmcvar.h>
  
  #include "mmcbus_if.h"
  
 +#if __FreeBSD_version < 800002
 +#define	kproc_create	kthread_create
 +#define	kproc_exit	kthread_exit
 +#endif
 +
  struct mmcsd_softc {
  	device_t dev;
  	struct mtx sc_mtx;
 @@ -95,7 +101,6 @@ static int mmcsd_dump(void *arg, void *v
  	off_t offset, size_t length);
  static void mmcsd_task(void *arg);
  
 -static const char *mmcsd_card_name(device_t dev);
  static int mmcsd_bus_bit_width(device_t dev);
  
  #define MMCSD_LOCK(_sc)		mtx_lock(&(_sc)->sc_mtx)
 @@ -122,6 +127,8 @@ mmcsd_attach(device_t dev)
  	struct mmcsd_softc *sc;
  	struct disk *d;
  	intmax_t mb;
 +	uint32_t speed;
 +	uint32_t maxblocks;
  	char unit;
  
  	sc = device_get_softc(dev);
 @@ -157,11 +164,22 @@ mmcsd_attach(device_t dev)
  		unit = 'G';
  		mb /= 1024;
  	}
 -	device_printf(dev, "%ju%cB <%s Memory Card>%s at %s %dMHz/%dbit\n",
 -	    mb, unit, mmcsd_card_name(dev),
 +	/*
 +	 * Report the clock speed of the underlying hardware, which might be
 +	 * different than what the card reports due to hardware limitations.
 +	 * Report how many blocks the hardware transfers at once, but clip the
 +	 * number to MAXPHYS since the system won't initiate larger transfers.
 +	 */
 +	speed = mmcbr_get_clock(device_get_parent(dev));
 +	maxblocks = mmc_get_max_data(dev);
 +	if (maxblocks > MAXPHYS)
 +		maxblocks = MAXPHYS;
 +	device_printf(dev, "%ju%cB <%s>%s at %s %d.%01dMHz/%dbit/%d-block\n",
 +	    mb, unit, mmc_get_card_id_string(dev),
  	    mmc_get_read_only(dev) ? " (read-only)" : "",
  	    device_get_nameunit(device_get_parent(dev)),
 -	    mmc_get_tran_speed(dev) / 1000000, mmcsd_bus_bit_width(dev));
 +	    speed / 1000000, (speed / 100000) % 10,
 +	    mmcsd_bus_bit_width(dev), maxblocks);
  	disk_create(d, DISK_VERSION);
  	bioq_init(&sc->bio_queue);
  
 @@ -500,16 +518,6 @@ out:
  	kproc_exit(0);
  }
  
 -static const char *
 -mmcsd_card_name(device_t dev)
 -{
 -	if (mmc_get_card_type(dev) == mode_mmc)
 -		return ("MMC");
 -	if (mmc_get_high_cap(dev))
 -		return ("SDHC");
 -	return ("SD");
 -}
 -
  static int
  mmcsd_bus_bit_width(device_t dev)
  {
 @@ -526,7 +534,7 @@ static device_method_t mmcsd_methods[] =
  	DEVMETHOD(device_detach, mmcsd_detach),
  	DEVMETHOD(device_suspend, mmcsd_suspend),
  	DEVMETHOD(device_resume, mmcsd_resume),
 -	{0, 0},
 +	DEVMETHOD_END
  };
  
  static driver_t mmcsd_driver = {
 @@ -536,4 +544,4 @@ static driver_t mmcsd_driver = {
  };
  static devclass_t mmcsd_devclass;
  
 -DRIVER_MODULE(mmcsd, mmc, mmcsd_driver, mmcsd_devclass, 0, 0);
 +DRIVER_MODULE(mmcsd, mmc, mmcsd_driver, mmcsd_devclass, NULL, NULL);
 
 Modified: head/sys/dev/mmc/mmcvar.h
 ==============================================================================
 --- head/sys/dev/mmc/mmcvar.h	Sat Apr 21 00:51:28 2012	(r234523)
 +++ head/sys/dev/mmc/mmcvar.h	Sat Apr 21 01:51:16 2012	(r234524)
 @@ -69,7 +69,7 @@ enum mmc_device_ivars {
      MMC_IVAR_BUS_WIDTH,
      MMC_IVAR_ERASE_SECTOR,
      MMC_IVAR_MAX_DATA,
 -//    MMC_IVAR_,
 +    MMC_IVAR_CARD_ID_STRING
  };
  
  /*
 @@ -89,5 +89,6 @@ MMC_ACCESSOR(card_type, CARD_TYPE, int)
  MMC_ACCESSOR(bus_width, BUS_WIDTH, int)
  MMC_ACCESSOR(erase_sector, ERASE_SECTOR, int)
  MMC_ACCESSOR(max_data, MAX_DATA, int)
 +MMC_ACCESSOR(card_id_string, CARD_ID_STRING, const char *)
  
  #endif /* DEV_MMC_MMCVAR_H */
 
 Modified: head/sys/modules/mmcsd/Makefile
 ==============================================================================
 --- head/sys/modules/mmcsd/Makefile	Sat Apr 21 00:51:28 2012	(r234523)
 +++ head/sys/modules/mmcsd/Makefile	Sat Apr 21 01:51:16 2012	(r234524)
 @@ -3,6 +3,6 @@
  .PATH: ${.CURDIR}/../../dev/mmc
  
  KMOD=	mmcsd
 -SRCS=	mmcsd.c mmcbus_if.h device_if.h bus_if.h
 +SRCS=	bus_if.h device_if.h mmcbr_if.h mmcbus_if.h mmcsd.c
  
  .include <bsd.kmod.mk>
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: arm/156496: commit references a PR
Date: Sat, 26 May 2012 09:31:35 +0000 (UTC)

 Author: marius
 Date: Sat May 26 09:31:23 2012
 New Revision: 236089
 URL: http://svn.freebsd.org/changeset/base/236089
 
 Log:
   MFC: r234524
   
   o Fixes:
     - When switching to 4-bit operation, send a SET_CLR_CARD_DETECT command
       to disconnect the card-detect pull-up resistor from the DAT3 line before
       sending the SET_BUS_WIDTH command.
     - Add the missing "reserved" zero entry to the mantissa table used to
       decode various CSD fields. This was causing SD cards to report that they
       could run at 30 MHz instead of the maximum 25 MHz mandated in the spec.
   o Enhancements:
     - At the MMC layer, format various info from the CID into a string that
       uniquely identifies the card instance (manufacturer number, serial
       number, product name and revision, etc). Export it as an instance
       variable.
     - At the MMCSD layer, display the formatted card ID string, and also
       report the clock speed of the hardware (not the card's max speed), and
       the number of bits and number of blocks per transfer. It comes out like
       this now:
       mmcsd0: 968MB <SD SD01G 8.0 SN 276886905 MFG 08/2008 by 3 SD> at mmc0
       22.5MHz/4bit/128-block
   o Use DEVMETHOD_END.
   o Use NULL instead of 0 for pointers.
   
   PR:		156496
   Submitted by:	Ian Lepore
 
 Modified:
   stable/9/sys/dev/mmc/mmc.c
   stable/9/sys/dev/mmc/mmcbrvar.h
   stable/9/sys/dev/mmc/mmcreg.h
   stable/9/sys/dev/mmc/mmcsd.c
   stable/9/sys/dev/mmc/mmcvar.h
   stable/9/sys/modules/mmcsd/Makefile
 Directory Properties:
   stable/9/sys/   (props changed)
   stable/9/sys/amd64/include/xen/   (props changed)
   stable/9/sys/boot/   (props changed)
   stable/9/sys/boot/i386/efi/   (props changed)
   stable/9/sys/boot/ia64/efi/   (props changed)
   stable/9/sys/boot/ia64/ski/   (props changed)
   stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
   stable/9/sys/boot/powerpc/ofw/   (props changed)
   stable/9/sys/cddl/contrib/opensolaris/   (props changed)
   stable/9/sys/conf/   (props changed)
   stable/9/sys/contrib/dev/acpica/   (props changed)
   stable/9/sys/contrib/octeon-sdk/   (props changed)
   stable/9/sys/contrib/pf/   (props changed)
   stable/9/sys/contrib/x86emu/   (props changed)
   stable/9/sys/dev/   (props changed)
   stable/9/sys/dev/e1000/   (props changed)
   stable/9/sys/dev/ixgbe/   (props changed)
   stable/9/sys/fs/   (props changed)
   stable/9/sys/fs/ntfs/   (props changed)
   stable/9/sys/modules/   (props changed)
 
 Modified: stable/9/sys/dev/mmc/mmc.c
 ==============================================================================
 --- stable/9/sys/dev/mmc/mmc.c	Sat May 26 09:16:37 2012	(r236088)
 +++ stable/9/sys/dev/mmc/mmc.c	Sat May 26 09:31:23 2012	(r236089)
 @@ -101,6 +101,7 @@ struct mmc_ivars {
  	uint32_t tran_speed;	/* Max speed in normal mode */
  	uint32_t hs_tran_speed;	/* Max speed in high speed mode */
  	uint32_t erase_sector;	/* Card native erase sector size */
 +	char card_id_string[64];/* Formatted CID info (serial, MFG, etc) */
  };
  
  #define CMD_RETRIES	3
 @@ -140,6 +141,7 @@ static void mmc_app_decode_scr(uint32_t 
  static int mmc_send_ext_csd(struct mmc_softc *sc, uint8_t *rawextcsd);
  static void mmc_scan(struct mmc_softc *sc);
  static int mmc_delete_cards(struct mmc_softc *sc);
 +static void mmc_format_card_id_string(struct mmc_ivars *ivar);
  
  static void
  mmc_ms_delay(int ms)
 @@ -606,6 +608,13 @@ mmc_set_card_bus_width(struct mmc_softc 
  
  	if (mmcbr_get_mode(sc->dev) == mode_sd) {
  		memset(&cmd, 0, sizeof(struct mmc_command));
 +		cmd.opcode = ACMD_SET_CLR_CARD_DETECT;
 +		cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
 +		cmd.arg = SD_CLR_CARD_DETECT;
 +		err = mmc_wait_for_app_cmd(sc, rca, &cmd, CMD_RETRIES);
 +		if (err != 0)
 +			return (err);
 +		memset(&cmd, 0, sizeof(struct mmc_command));
  		cmd.opcode = ACMD_SET_BUS_WIDTH;
  		cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
  		switch (width) {
 @@ -788,15 +797,52 @@ mmc_decode_cid_mmc(uint32_t *raw_cid, st
  	cid->mdt_year = mmc_get_bits(raw_cid, 128, 8, 4) + 1997;
  }
  
 +static void
 +mmc_format_card_id_string(struct mmc_ivars *ivar)
 +{
 +	char oidstr[8];
 +	uint8_t c1;
 +	uint8_t c2;
 +
 +	/*
 +	 * Format a card ID string for use by the mmcsd driver, it's what
 +	 * appears between the <> in the following:
 +	 * mmcsd0: 968MB <SD SD01G 8.0 SN 2686905 Mfg 08/2008 by 3 TN> at mmc0
 +	 * 22.5MHz/4bit/128-block
 +	 *
 +	 * The card_id_string in mmc_ivars is currently allocated as 64 bytes,
 +	 * and our max formatted length is currently 55 bytes if every field
 +	 * contains the largest value.
 +	 *
 +	 * Sometimes the oid is two printable ascii chars; when it's not,
 +	 * format it as 0xnnnn instead.
 +	 */
 +	c1 = (ivar->cid.oid >> 8) & 0x0ff;
 +	c2 = ivar->cid.oid & 0x0ff;
 +	if (c1 > 0x1f && c1 < 0x7f && c2 > 0x1f && c2 < 0x7f)
 +		snprintf(oidstr, sizeof(oidstr), "%c%c", c1, c2);
 +	else
 +		snprintf(oidstr, sizeof(oidstr), "0x%04x", ivar->cid.oid);
 +	snprintf(ivar->card_id_string, sizeof(ivar->card_id_string),
 +	    "%s%s %s %d.%d SN %d MFG %02d/%04d by %d %s",
 +	    ivar->mode == mode_sd ? "SD" : "MMC", ivar->high_cap ? "HC" : "",
 +	    ivar->cid.pnm, ivar->cid.prv >> 4, ivar->cid.prv & 0x0f,
 +	    ivar->cid.psn, ivar->cid.mdt_month, ivar->cid.mdt_year,
 +	    ivar->cid.mid, oidstr);
 +}
 +
  static const int exp[8] = {
  	1, 10, 100, 1000, 10000, 100000, 1000000, 10000000
  };
 +
  static const int mant[16] = {
 -	10, 12, 13, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 70, 80
 +	0, 10, 12, 13, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 70, 80
  };
 +
  static const int cur_min[8] = {
  	500, 1000, 5000, 10000, 25000, 35000, 60000, 100000
  };
 +
  static const int cur_max[8] = {
  	1000, 5000, 10000, 25000, 35000, 45000, 800000, 200000
  };
 @@ -1080,13 +1126,7 @@ mmc_log_card(device_t dev, struct mmc_iv
  {
  	device_printf(dev, "Card at relative address %d%s:\n",
  	    ivar->rca, newcard ? " added" : "");
 -	device_printf(dev, " card: %s%s (0x%x/0x%x/\"%s\" rev %d.%d "
 -	    "m/d %02d.%04d s/n %08x)\n",
 -	    ivar->mode == mode_sd ? "SD" : "MMC",
 -	    ivar->high_cap ? " High Capacity" : "", 
 -	    ivar->cid.mid, ivar->cid.oid,
 -	    ivar->cid.pnm, ivar->cid.prv >> 4, ivar->cid.prv & 0x0f,
 -	    ivar->cid.mdt_month, ivar->cid.mdt_year, ivar->cid.psn);
 +	device_printf(dev, " card: %s\n", ivar->card_id_string);
  	device_printf(dev, " bus: %ubit, %uMHz%s\n",
  	    (ivar->bus_width == bus_width_1 ? 1 :
  	    (ivar->bus_width == bus_width_4 ? 4 : 8)),
 @@ -1188,6 +1228,7 @@ mmc_discover_cards(struct mmc_softc *sc)
  			if ((mmcbr_get_caps(sc->dev) & MMC_CAP_4_BIT_DATA) &&
  			    (ivar->scr.bus_widths & SD_SCR_BUS_WIDTH_4))
  				ivar->bus_width = bus_width_4;
 +			mmc_format_card_id_string(ivar);
  			if (bootverbose || mmc_debug)
  				mmc_log_card(sc->dev, ivar, newcard);
  			if (newcard) {
 @@ -1245,6 +1286,7 @@ mmc_discover_cards(struct mmc_softc *sc)
  			ivar->bus_width = bus_width_1;
  			ivar->timing = bus_timing_normal;
  		}
 +		mmc_format_card_id_string(ivar);
  		if (bootverbose || mmc_debug)
  			mmc_log_card(sc->dev, ivar, newcard);
  		if (newcard) {
 @@ -1477,6 +1519,9 @@ mmc_read_ivar(device_t bus, device_t chi
  	case MMC_IVAR_MAX_DATA:
  		*result = mmcbr_get_max_data(bus);
  		break;
 +	case MMC_IVAR_CARD_ID_STRING:
 +		*(char **)result = ivar->card_id_string;
 +		break;
  	}
  	return (0);
  }
 @@ -1527,7 +1572,7 @@ static device_method_t mmc_methods[] = {
  	DEVMETHOD(mmcbus_acquire_bus, mmc_acquire_bus),
  	DEVMETHOD(mmcbus_release_bus, mmc_release_bus),
  
 -	{0, 0},
 +	DEVMETHOD_END
  };
  
  static driver_t mmc_driver = {
 @@ -1537,6 +1582,5 @@ static driver_t mmc_driver = {
  };
  static devclass_t mmc_devclass;
  
 -
  DRIVER_MODULE(mmc, at91_mci, mmc_driver, mmc_devclass, NULL, NULL);
  DRIVER_MODULE(mmc, sdhci, mmc_driver, mmc_devclass, NULL, NULL);
 
 Modified: stable/9/sys/dev/mmc/mmcbrvar.h
 ==============================================================================
 --- stable/9/sys/dev/mmc/mmcbrvar.h	Sat May 26 09:16:37 2012	(r236088)
 +++ stable/9/sys/dev/mmc/mmcbrvar.h	Sat May 26 09:31:23 2012	(r236089)
 @@ -56,6 +56,7 @@
  #define DEV_MMC_MMCBRVAR_H
  
  #include <dev/mmc/bridge.h>
 +#include <dev/mmc/mmcreg.h>
  #include "mmcbr_if.h"
  
  enum mmcbr_device_ivars {
 @@ -72,8 +73,7 @@ enum mmcbr_device_ivars {
      MMCBR_IVAR_VDD,
      MMCBR_IVAR_CAPS,
      MMCBR_IVAR_TIMING,
 -    MMCBR_IVAR_MAX_DATA,
 -//    MMCBR_IVAR_,
 +    MMCBR_IVAR_MAX_DATA
  };
  
  /*
 
 Modified: stable/9/sys/dev/mmc/mmcreg.h
 ==============================================================================
 --- stable/9/sys/dev/mmc/mmcreg.h	Sat May 26 09:16:37 2012	(r236088)
 +++ stable/9/sys/dev/mmc/mmcreg.h	Sat May 26 09:31:23 2012	(r236089)
 @@ -139,8 +139,8 @@ struct mmc_command {
  #define	R1_READY_FOR_DATA (1u << 8)		/* sx, a */
  #define	R1_APP_CMD (1u << 5)			/* sr, c */
  #define	R1_AKE_SEQ_ERROR (1u << 3)		/* er, c */
 -#define	R1_STATUS(x)            (x & 0xFFFFE000
 -#define	R1_CURRENT_STATE(x) ((x) & R1_CURRENT_STATE_MASK) >> 9
 +#define	R1_STATUS(x)		((x) & 0xFFFFE000)
 +#define	R1_CURRENT_STATE(x)	(((x) & R1_CURRENT_STATE_MASK) >> 9)
  #define	R1_STATE_IDLE	0
  #define	R1_STATE_READY	1
  #define	R1_STATE_IDENT	2
 @@ -330,6 +330,9 @@ struct mmc_request {
  #define SD_SWITCH_HS_MODE	1
  #define SD_SWITCH_NOCHANGE	0xF
  
 +#define	SD_CLR_CARD_DETECT	0
 +#define	SD_SET_CARD_DETECT	1
 +
  #define	SD_MAX_HS		50000000
  
  /* OCR bits */
 @@ -380,7 +383,7 @@ struct mmc_cid {
  	uint8_t fwrev;
  };
  
 -struct mmc_csd 
 +struct mmc_csd
  {
  	uint8_t csd_structure;
  	uint8_t spec_vers;
 
 Modified: stable/9/sys/dev/mmc/mmcsd.c
 ==============================================================================
 --- stable/9/sys/dev/mmc/mmcsd.c	Sat May 26 09:16:37 2012	(r236088)
 +++ stable/9/sys/dev/mmc/mmcsd.c	Sat May 26 09:31:23 2012	(r236089)
 @@ -66,11 +66,17 @@ __FBSDID("$FreeBSD$");
  #include <sys/mutex.h>
  #include <geom/geom_disk.h>
  
 -#include <dev/mmc/mmcvar.h>
 +#include <dev/mmc/mmcbrvar.h>
  #include <dev/mmc/mmcreg.h>
 +#include <dev/mmc/mmcvar.h>
  
  #include "mmcbus_if.h"
  
 +#if __FreeBSD_version < 800002
 +#define	kproc_create	kthread_create
 +#define	kproc_exit	kthread_exit
 +#endif
 +
  struct mmcsd_softc {
  	device_t dev;
  	struct mtx sc_mtx;
 @@ -95,7 +101,6 @@ static int mmcsd_dump(void *arg, void *v
  	off_t offset, size_t length);
  static void mmcsd_task(void *arg);
  
 -static const char *mmcsd_card_name(device_t dev);
  static int mmcsd_bus_bit_width(device_t dev);
  
  #define MMCSD_LOCK(_sc)		mtx_lock(&(_sc)->sc_mtx)
 @@ -122,6 +127,8 @@ mmcsd_attach(device_t dev)
  	struct mmcsd_softc *sc;
  	struct disk *d;
  	intmax_t mb;
 +	uint32_t speed;
 +	uint32_t maxblocks;
  	char unit;
  
  	sc = device_get_softc(dev);
 @@ -157,11 +164,22 @@ mmcsd_attach(device_t dev)
  		unit = 'G';
  		mb /= 1024;
  	}
 -	device_printf(dev, "%ju%cB <%s Memory Card>%s at %s %dMHz/%dbit\n",
 -	    mb, unit, mmcsd_card_name(dev),
 +	/*
 +	 * Report the clock speed of the underlying hardware, which might be
 +	 * different than what the card reports due to hardware limitations.
 +	 * Report how many blocks the hardware transfers at once, but clip the
 +	 * number to MAXPHYS since the system won't initiate larger transfers.
 +	 */
 +	speed = mmcbr_get_clock(device_get_parent(dev));
 +	maxblocks = mmc_get_max_data(dev);
 +	if (maxblocks > MAXPHYS)
 +		maxblocks = MAXPHYS;
 +	device_printf(dev, "%ju%cB <%s>%s at %s %d.%01dMHz/%dbit/%d-block\n",
 +	    mb, unit, mmc_get_card_id_string(dev),
  	    mmc_get_read_only(dev) ? " (read-only)" : "",
  	    device_get_nameunit(device_get_parent(dev)),
 -	    mmc_get_tran_speed(dev) / 1000000, mmcsd_bus_bit_width(dev));
 +	    speed / 1000000, (speed / 100000) % 10,
 +	    mmcsd_bus_bit_width(dev), maxblocks);
  	disk_create(d, DISK_VERSION);
  	bioq_init(&sc->bio_queue);
  
 @@ -500,16 +518,6 @@ out:
  	kproc_exit(0);
  }
  
 -static const char *
 -mmcsd_card_name(device_t dev)
 -{
 -	if (mmc_get_card_type(dev) == mode_mmc)
 -		return ("MMC");
 -	if (mmc_get_high_cap(dev))
 -		return ("SDHC");
 -	return ("SD");
 -}
 -
  static int
  mmcsd_bus_bit_width(device_t dev)
  {
 @@ -526,7 +534,7 @@ static device_method_t mmcsd_methods[] =
  	DEVMETHOD(device_detach, mmcsd_detach),
  	DEVMETHOD(device_suspend, mmcsd_suspend),
  	DEVMETHOD(device_resume, mmcsd_resume),
 -	{0, 0},
 +	DEVMETHOD_END
  };
  
  static driver_t mmcsd_driver = {
 @@ -536,4 +544,4 @@ static driver_t mmcsd_driver = {
  };
  static devclass_t mmcsd_devclass;
  
 -DRIVER_MODULE(mmcsd, mmc, mmcsd_driver, mmcsd_devclass, 0, 0);
 +DRIVER_MODULE(mmcsd, mmc, mmcsd_driver, mmcsd_devclass, NULL, NULL);
 
 Modified: stable/9/sys/dev/mmc/mmcvar.h
 ==============================================================================
 --- stable/9/sys/dev/mmc/mmcvar.h	Sat May 26 09:16:37 2012	(r236088)
 +++ stable/9/sys/dev/mmc/mmcvar.h	Sat May 26 09:31:23 2012	(r236089)
 @@ -69,7 +69,7 @@ enum mmc_device_ivars {
      MMC_IVAR_BUS_WIDTH,
      MMC_IVAR_ERASE_SECTOR,
      MMC_IVAR_MAX_DATA,
 -//    MMC_IVAR_,
 +    MMC_IVAR_CARD_ID_STRING
  };
  
  /*
 @@ -89,5 +89,6 @@ MMC_ACCESSOR(card_type, CARD_TYPE, int)
  MMC_ACCESSOR(bus_width, BUS_WIDTH, int)
  MMC_ACCESSOR(erase_sector, ERASE_SECTOR, int)
  MMC_ACCESSOR(max_data, MAX_DATA, int)
 +MMC_ACCESSOR(card_id_string, CARD_ID_STRING, const char *)
  
  #endif /* DEV_MMC_MMCVAR_H */
 
 Modified: stable/9/sys/modules/mmcsd/Makefile
 ==============================================================================
 --- stable/9/sys/modules/mmcsd/Makefile	Sat May 26 09:16:37 2012	(r236088)
 +++ stable/9/sys/modules/mmcsd/Makefile	Sat May 26 09:31:23 2012	(r236089)
 @@ -3,6 +3,6 @@
  .PATH: ${.CURDIR}/../../dev/mmc
  
  KMOD=	mmcsd
 -SRCS=	mmcsd.c mmcbus_if.h device_if.h bus_if.h
 +SRCS=	bus_if.h device_if.h mmcbr_if.h mmcbus_if.h mmcsd.c
  
  .include <bsd.kmod.mk>
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: arm/156496: commit references a PR
Date: Sat, 26 May 2012 09:31:51 +0000 (UTC)

 Author: marius
 Date: Sat May 26 09:31:25 2012
 New Revision: 236090
 URL: http://svn.freebsd.org/changeset/base/236090
 
 Log:
   MFC: r234524
   
   o Fixes:
     - When switching to 4-bit operation, send a SET_CLR_CARD_DETECT command
       to disconnect the card-detect pull-up resistor from the DAT3 line before
       sending the SET_BUS_WIDTH command.
     - Add the missing "reserved" zero entry to the mantissa table used to
       decode various CSD fields. This was causing SD cards to report that they
       could run at 30 MHz instead of the maximum 25 MHz mandated in the spec.
   o Enhancements:
     - At the MMC layer, format various info from the CID into a string that
       uniquely identifies the card instance (manufacturer number, serial
       number, product name and revision, etc). Export it as an instance
       variable.
     - At the MMCSD layer, display the formatted card ID string, and also
       report the clock speed of the hardware (not the card's max speed), and
       the number of bits and number of blocks per transfer. It comes out like
       this now:
       mmcsd0: 968MB <SD SD01G 8.0 SN 276886905 MFG 08/2008 by 3 SD> at mmc0
       22.5MHz/4bit/128-block
   o Use DEVMETHOD_END.
   o Use NULL instead of 0 for pointers.
   
   PR:		156496
   Submitted by:	Ian Lepore
 
 Modified:
   stable/8/sys/dev/mmc/mmc.c
   stable/8/sys/dev/mmc/mmcbrvar.h
   stable/8/sys/dev/mmc/mmcreg.h
   stable/8/sys/dev/mmc/mmcsd.c
   stable/8/sys/dev/mmc/mmcvar.h
   stable/8/sys/modules/mmcsd/Makefile
 Directory Properties:
   stable/8/sys/   (props changed)
   stable/8/sys/amd64/include/xen/   (props changed)
   stable/8/sys/boot/   (props changed)
   stable/8/sys/cddl/contrib/opensolaris/   (props changed)
   stable/8/sys/contrib/dev/acpica/   (props changed)
   stable/8/sys/contrib/pf/   (props changed)
   stable/8/sys/dev/e1000/   (props changed)
 
 Modified: stable/8/sys/dev/mmc/mmc.c
 ==============================================================================
 --- stable/8/sys/dev/mmc/mmc.c	Sat May 26 09:31:23 2012	(r236089)
 +++ stable/8/sys/dev/mmc/mmc.c	Sat May 26 09:31:25 2012	(r236090)
 @@ -101,6 +101,7 @@ struct mmc_ivars {
  	uint32_t tran_speed;	/* Max speed in normal mode */
  	uint32_t hs_tran_speed;	/* Max speed in high speed mode */
  	uint32_t erase_sector;	/* Card native erase sector size */
 +	char card_id_string[64];/* Formatted CID info (serial, MFG, etc) */
  };
  
  #define CMD_RETRIES	3
 @@ -140,6 +141,7 @@ static void mmc_app_decode_scr(uint32_t 
  static int mmc_send_ext_csd(struct mmc_softc *sc, uint8_t *rawextcsd);
  static void mmc_scan(struct mmc_softc *sc);
  static int mmc_delete_cards(struct mmc_softc *sc);
 +static void mmc_format_card_id_string(struct mmc_ivars *ivar);
  
  static void
  mmc_ms_delay(int ms)
 @@ -606,6 +608,13 @@ mmc_set_card_bus_width(struct mmc_softc 
  
  	if (mmcbr_get_mode(sc->dev) == mode_sd) {
  		memset(&cmd, 0, sizeof(struct mmc_command));
 +		cmd.opcode = ACMD_SET_CLR_CARD_DETECT;
 +		cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
 +		cmd.arg = SD_CLR_CARD_DETECT;
 +		err = mmc_wait_for_app_cmd(sc, rca, &cmd, CMD_RETRIES);
 +		if (err != 0)
 +			return (err);
 +		memset(&cmd, 0, sizeof(struct mmc_command));
  		cmd.opcode = ACMD_SET_BUS_WIDTH;
  		cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
  		switch (width) {
 @@ -788,15 +797,52 @@ mmc_decode_cid_mmc(uint32_t *raw_cid, st
  	cid->mdt_year = mmc_get_bits(raw_cid, 128, 8, 4) + 1997;
  }
  
 +static void
 +mmc_format_card_id_string(struct mmc_ivars *ivar)
 +{
 +	char oidstr[8];
 +	uint8_t c1;
 +	uint8_t c2;
 +
 +	/*
 +	 * Format a card ID string for use by the mmcsd driver, it's what
 +	 * appears between the <> in the following:
 +	 * mmcsd0: 968MB <SD SD01G 8.0 SN 2686905 Mfg 08/2008 by 3 TN> at mmc0
 +	 * 22.5MHz/4bit/128-block
 +	 *
 +	 * The card_id_string in mmc_ivars is currently allocated as 64 bytes,
 +	 * and our max formatted length is currently 55 bytes if every field
 +	 * contains the largest value.
 +	 *
 +	 * Sometimes the oid is two printable ascii chars; when it's not,
 +	 * format it as 0xnnnn instead.
 +	 */
 +	c1 = (ivar->cid.oid >> 8) & 0x0ff;
 +	c2 = ivar->cid.oid & 0x0ff;
 +	if (c1 > 0x1f && c1 < 0x7f && c2 > 0x1f && c2 < 0x7f)
 +		snprintf(oidstr, sizeof(oidstr), "%c%c", c1, c2);
 +	else
 +		snprintf(oidstr, sizeof(oidstr), "0x%04x", ivar->cid.oid);
 +	snprintf(ivar->card_id_string, sizeof(ivar->card_id_string),
 +	    "%s%s %s %d.%d SN %d MFG %02d/%04d by %d %s",
 +	    ivar->mode == mode_sd ? "SD" : "MMC", ivar->high_cap ? "HC" : "",
 +	    ivar->cid.pnm, ivar->cid.prv >> 4, ivar->cid.prv & 0x0f,
 +	    ivar->cid.psn, ivar->cid.mdt_month, ivar->cid.mdt_year,
 +	    ivar->cid.mid, oidstr);
 +}
 +
  static const int exp[8] = {
  	1, 10, 100, 1000, 10000, 100000, 1000000, 10000000
  };
 +
  static const int mant[16] = {
 -	10, 12, 13, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 70, 80
 +	0, 10, 12, 13, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 70, 80
  };
 +
  static const int cur_min[8] = {
  	500, 1000, 5000, 10000, 25000, 35000, 60000, 100000
  };
 +
  static const int cur_max[8] = {
  	1000, 5000, 10000, 25000, 35000, 45000, 800000, 200000
  };
 @@ -1080,13 +1126,7 @@ mmc_log_card(device_t dev, struct mmc_iv
  {
  	device_printf(dev, "Card at relative address %d%s:\n",
  	    ivar->rca, newcard ? " added" : "");
 -	device_printf(dev, " card: %s%s (0x%x/0x%x/\"%s\" rev %d.%d "
 -	    "m/d %02d.%04d s/n %08x)\n",
 -	    ivar->mode == mode_sd ? "SD" : "MMC",
 -	    ivar->high_cap ? " High Capacity" : "", 
 -	    ivar->cid.mid, ivar->cid.oid,
 -	    ivar->cid.pnm, ivar->cid.prv >> 4, ivar->cid.prv & 0x0f,
 -	    ivar->cid.mdt_month, ivar->cid.mdt_year, ivar->cid.psn);
 +	device_printf(dev, " card: %s\n", ivar->card_id_string);
  	device_printf(dev, " bus: %ubit, %uMHz%s\n",
  	    (ivar->bus_width == bus_width_1 ? 1 :
  	    (ivar->bus_width == bus_width_4 ? 4 : 8)),
 @@ -1188,6 +1228,7 @@ mmc_discover_cards(struct mmc_softc *sc)
  			if ((mmcbr_get_caps(sc->dev) & MMC_CAP_4_BIT_DATA) &&
  			    (ivar->scr.bus_widths & SD_SCR_BUS_WIDTH_4))
  				ivar->bus_width = bus_width_4;
 +			mmc_format_card_id_string(ivar);
  			if (bootverbose || mmc_debug)
  				mmc_log_card(sc->dev, ivar, newcard);
  			if (newcard) {
 @@ -1245,6 +1286,7 @@ mmc_discover_cards(struct mmc_softc *sc)
  			ivar->bus_width = bus_width_1;
  			ivar->timing = bus_timing_normal;
  		}
 +		mmc_format_card_id_string(ivar);
  		if (bootverbose || mmc_debug)
  			mmc_log_card(sc->dev, ivar, newcard);
  		if (newcard) {
 @@ -1477,6 +1519,9 @@ mmc_read_ivar(device_t bus, device_t chi
  	case MMC_IVAR_MAX_DATA:
  		*result = mmcbr_get_max_data(bus);
  		break;
 +	case MMC_IVAR_CARD_ID_STRING:
 +		*(char **)result = ivar->card_id_string;
 +		break;
  	}
  	return (0);
  }
 @@ -1527,7 +1572,7 @@ static device_method_t mmc_methods[] = {
  	DEVMETHOD(mmcbus_acquire_bus, mmc_acquire_bus),
  	DEVMETHOD(mmcbus_release_bus, mmc_release_bus),
  
 -	{0, 0},
 +	DEVMETHOD_END
  };
  
  static driver_t mmc_driver = {
 @@ -1537,6 +1582,5 @@ static driver_t mmc_driver = {
  };
  static devclass_t mmc_devclass;
  
 -
  DRIVER_MODULE(mmc, at91_mci, mmc_driver, mmc_devclass, NULL, NULL);
  DRIVER_MODULE(mmc, sdhci, mmc_driver, mmc_devclass, NULL, NULL);
 
 Modified: stable/8/sys/dev/mmc/mmcbrvar.h
 ==============================================================================
 --- stable/8/sys/dev/mmc/mmcbrvar.h	Sat May 26 09:31:23 2012	(r236089)
 +++ stable/8/sys/dev/mmc/mmcbrvar.h	Sat May 26 09:31:25 2012	(r236090)
 @@ -56,6 +56,7 @@
  #define DEV_MMC_MMCBRVAR_H
  
  #include <dev/mmc/bridge.h>
 +#include <dev/mmc/mmcreg.h>
  #include "mmcbr_if.h"
  
  enum mmcbr_device_ivars {
 @@ -72,8 +73,7 @@ enum mmcbr_device_ivars {
      MMCBR_IVAR_VDD,
      MMCBR_IVAR_CAPS,
      MMCBR_IVAR_TIMING,
 -    MMCBR_IVAR_MAX_DATA,
 -//    MMCBR_IVAR_,
 +    MMCBR_IVAR_MAX_DATA
  };
  
  /*
 
 Modified: stable/8/sys/dev/mmc/mmcreg.h
 ==============================================================================
 --- stable/8/sys/dev/mmc/mmcreg.h	Sat May 26 09:31:23 2012	(r236089)
 +++ stable/8/sys/dev/mmc/mmcreg.h	Sat May 26 09:31:25 2012	(r236090)
 @@ -139,8 +139,8 @@ struct mmc_command {
  #define	R1_READY_FOR_DATA (1u << 8)		/* sx, a */
  #define	R1_APP_CMD (1u << 5)			/* sr, c */
  #define	R1_AKE_SEQ_ERROR (1u << 3)		/* er, c */
 -#define	R1_STATUS(x)            (x & 0xFFFFE000
 -#define	R1_CURRENT_STATE(x) ((x) & R1_CURRENT_STATE_MASK) >> 9
 +#define	R1_STATUS(x)		((x) & 0xFFFFE000)
 +#define	R1_CURRENT_STATE(x)	(((x) & R1_CURRENT_STATE_MASK) >> 9)
  #define	R1_STATE_IDLE	0
  #define	R1_STATE_READY	1
  #define	R1_STATE_IDENT	2
 @@ -330,6 +330,9 @@ struct mmc_request {
  #define SD_SWITCH_HS_MODE	1
  #define SD_SWITCH_NOCHANGE	0xF
  
 +#define	SD_CLR_CARD_DETECT	0
 +#define	SD_SET_CARD_DETECT	1
 +
  #define	SD_MAX_HS		50000000
  
  /* OCR bits */
 @@ -380,7 +383,7 @@ struct mmc_cid {
  	uint8_t fwrev;
  };
  
 -struct mmc_csd 
 +struct mmc_csd
  {
  	uint8_t csd_structure;
  	uint8_t spec_vers;
 
 Modified: stable/8/sys/dev/mmc/mmcsd.c
 ==============================================================================
 --- stable/8/sys/dev/mmc/mmcsd.c	Sat May 26 09:31:23 2012	(r236089)
 +++ stable/8/sys/dev/mmc/mmcsd.c	Sat May 26 09:31:25 2012	(r236090)
 @@ -66,11 +66,17 @@ __FBSDID("$FreeBSD$");
  #include <sys/mutex.h>
  #include <geom/geom_disk.h>
  
 -#include <dev/mmc/mmcvar.h>
 +#include <dev/mmc/mmcbrvar.h>
  #include <dev/mmc/mmcreg.h>
 +#include <dev/mmc/mmcvar.h>
  
  #include "mmcbus_if.h"
  
 +#if __FreeBSD_version < 800002
 +#define	kproc_create	kthread_create
 +#define	kproc_exit	kthread_exit
 +#endif
 +
  struct mmcsd_softc {
  	device_t dev;
  	struct mtx sc_mtx;
 @@ -95,7 +101,6 @@ static int mmcsd_dump(void *arg, void *v
  	off_t offset, size_t length);
  static void mmcsd_task(void *arg);
  
 -static const char *mmcsd_card_name(device_t dev);
  static int mmcsd_bus_bit_width(device_t dev);
  
  #define MMCSD_LOCK(_sc)		mtx_lock(&(_sc)->sc_mtx)
 @@ -122,6 +127,8 @@ mmcsd_attach(device_t dev)
  	struct mmcsd_softc *sc;
  	struct disk *d;
  	intmax_t mb;
 +	uint32_t speed;
 +	uint32_t maxblocks;
  	char unit;
  
  	sc = device_get_softc(dev);
 @@ -157,11 +164,22 @@ mmcsd_attach(device_t dev)
  		unit = 'G';
  		mb /= 1024;
  	}
 -	device_printf(dev, "%ju%cB <%s Memory Card>%s at %s %dMHz/%dbit\n",
 -	    mb, unit, mmcsd_card_name(dev),
 +	/*
 +	 * Report the clock speed of the underlying hardware, which might be
 +	 * different than what the card reports due to hardware limitations.
 +	 * Report how many blocks the hardware transfers at once, but clip the
 +	 * number to MAXPHYS since the system won't initiate larger transfers.
 +	 */
 +	speed = mmcbr_get_clock(device_get_parent(dev));
 +	maxblocks = mmc_get_max_data(dev);
 +	if (maxblocks > MAXPHYS)
 +		maxblocks = MAXPHYS;
 +	device_printf(dev, "%ju%cB <%s>%s at %s %d.%01dMHz/%dbit/%d-block\n",
 +	    mb, unit, mmc_get_card_id_string(dev),
  	    mmc_get_read_only(dev) ? " (read-only)" : "",
  	    device_get_nameunit(device_get_parent(dev)),
 -	    mmc_get_tran_speed(dev) / 1000000, mmcsd_bus_bit_width(dev));
 +	    speed / 1000000, (speed / 100000) % 10,
 +	    mmcsd_bus_bit_width(dev), maxblocks);
  	disk_create(d, DISK_VERSION);
  	bioq_init(&sc->bio_queue);
  
 @@ -500,16 +518,6 @@ out:
  	kproc_exit(0);
  }
  
 -static const char *
 -mmcsd_card_name(device_t dev)
 -{
 -	if (mmc_get_card_type(dev) == mode_mmc)
 -		return ("MMC");
 -	if (mmc_get_high_cap(dev))
 -		return ("SDHC");
 -	return ("SD");
 -}
 -
  static int
  mmcsd_bus_bit_width(device_t dev)
  {
 @@ -526,7 +534,7 @@ static device_method_t mmcsd_methods[] =
  	DEVMETHOD(device_detach, mmcsd_detach),
  	DEVMETHOD(device_suspend, mmcsd_suspend),
  	DEVMETHOD(device_resume, mmcsd_resume),
 -	{0, 0},
 +	DEVMETHOD_END
  };
  
  static driver_t mmcsd_driver = {
 @@ -536,4 +544,4 @@ static driver_t mmcsd_driver = {
  };
  static devclass_t mmcsd_devclass;
  
 -DRIVER_MODULE(mmcsd, mmc, mmcsd_driver, mmcsd_devclass, 0, 0);
 +DRIVER_MODULE(mmcsd, mmc, mmcsd_driver, mmcsd_devclass, NULL, NULL);
 
 Modified: stable/8/sys/dev/mmc/mmcvar.h
 ==============================================================================
 --- stable/8/sys/dev/mmc/mmcvar.h	Sat May 26 09:31:23 2012	(r236089)
 +++ stable/8/sys/dev/mmc/mmcvar.h	Sat May 26 09:31:25 2012	(r236090)
 @@ -69,7 +69,7 @@ enum mmc_device_ivars {
      MMC_IVAR_BUS_WIDTH,
      MMC_IVAR_ERASE_SECTOR,
      MMC_IVAR_MAX_DATA,
 -//    MMC_IVAR_,
 +    MMC_IVAR_CARD_ID_STRING
  };
  
  /*
 @@ -89,5 +89,6 @@ MMC_ACCESSOR(card_type, CARD_TYPE, int)
  MMC_ACCESSOR(bus_width, BUS_WIDTH, int)
  MMC_ACCESSOR(erase_sector, ERASE_SECTOR, int)
  MMC_ACCESSOR(max_data, MAX_DATA, int)
 +MMC_ACCESSOR(card_id_string, CARD_ID_STRING, const char *)
  
  #endif /* DEV_MMC_MMCVAR_H */
 
 Modified: stable/8/sys/modules/mmcsd/Makefile
 ==============================================================================
 --- stable/8/sys/modules/mmcsd/Makefile	Sat May 26 09:31:23 2012	(r236089)
 +++ stable/8/sys/modules/mmcsd/Makefile	Sat May 26 09:31:25 2012	(r236090)
 @@ -3,6 +3,6 @@
  .PATH: ${.CURDIR}/../../dev/mmc
  
  KMOD=	mmcsd
 -SRCS=	mmcsd.c mmcbus_if.h device_if.h bus_if.h
 +SRCS=	bus_if.h device_if.h mmcbr_if.h mmcbus_if.h mmcsd.c
  
  .include <bsd.kmod.mk>
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->closed 
State-Changed-By: marius 
State-Changed-When: Sat May 26 10:04:43 UTC 2012 
State-Changed-Why:  
Close 

http://www.freebsd.org/cgi/query-pr.cgi?pr=156496 
>Unformatted:
