svn commit: r338477 - stable/10/sys/dev/mmc

Marius Strobl marius at FreeBSD.org
Wed Sep 5 20:47:52 UTC 2018


Author: marius
Date: Wed Sep  5 20:47:51 2018
New Revision: 338477
URL: https://svnweb.freebsd.org/changeset/base/338477

Log:
  MFC: r338304
  
  The read accessors generated by __BUS_ACCESSOR() have the problem that
  they don't check the result of BUS_READ_IVAR(9) and silently return stack
  garbage on failure in case a bus doesn't implement a particular instance
  variable for example. With MMC bridges not providing MMCBR_IVAR_RETUNE_REQ,
  yet, this in turn can cause mmc(4) to get into a state in which re-tuning
  seems to be necessary but is inappropriate, causing mmc_wait_for_request()
  to fail. Thus, don't use __BUS_ACCESSOR() for mmcbr_get_retune_req() and
  instead provide a version of the latter which returns retune_req_none if
  reading MMCBR_IVAR_RETUNE_REQ fails.

Modified:
  stable/10/sys/dev/mmc/mmcbrvar.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/mmc/mmcbrvar.h
==============================================================================
--- stable/10/sys/dev/mmc/mmcbrvar.h	Wed Sep  5 20:43:46 2018	(r338476)
+++ stable/10/sys/dev/mmc/mmcbrvar.h	Wed Sep  5 20:47:51 2018	(r338477)
@@ -95,7 +95,6 @@ MMCBR_ACCESSOR(host_ocr, HOST_OCR, int)
 MMCBR_ACCESSOR(mode, MODE, int)
 MMCBR_ACCESSOR(ocr, OCR, int)
 MMCBR_ACCESSOR(power_mode, POWER_MODE, int)
-MMCBR_ACCESSOR(retune_req, RETUNE_REQ, int)
 MMCBR_ACCESSOR(vdd, VDD, int)
 MMCBR_ACCESSOR(vccq, VCCQ, int)
 MMCBR_ACCESSOR(caps, CAPS, int)
@@ -103,6 +102,20 @@ MMCBR_ACCESSOR(timing, TIMING, int)
 MMCBR_ACCESSOR(max_data, MAX_DATA, int)
 MMCBR_ACCESSOR(max_busy_timeout, MAX_BUSY_TIMEOUT, u_int)
 
+static int __inline
+mmcbr_get_retune_req(device_t dev)
+{
+	uintptr_t v;
+
+	if (__predict_false(BUS_READ_IVAR(device_get_parent(dev), dev,
+	    MMCBR_IVAR_RETUNE_REQ, &v) != 0))
+		return (retune_req_none);
+	return ((int)v);
+}
+
+/*
+ * Convenience wrappers for the mmcbr interface
+ */
 static int __inline
 mmcbr_update_ios(device_t dev)
 {


More information about the svn-src-all mailing list