Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Jan 2018 19:01:51 +0100
From:      "O. Hartmann" <ohartmann@walstatt.org>
To:        Scott Long <scottl@FreeBSD.org>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r328165 - in head: sbin/camcontrol sys/cam sys/cam/mmc
Message-ID:  <20180119190218.0d656a0d@thor.intern.walstatt.dynvpn.de>
In-Reply-To: <201801191532.w0JFWRFD066790@repo.freebsd.org>
References:  <201801191532.w0JFWRFD066790@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
--Sig_/veMgRZUNGAVttPavN_81umK
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Am Fri, 19 Jan 2018 15:32:27 +0000 (UTC)
Scott Long <scottl@FreeBSD.org> schrieb:

> Author: scottl
> Date: Fri Jan 19 15:32:27 2018
> New Revision: 328165
> URL: https://svnweb.freebsd.org/changeset/base/328165
>=20
> Log:
>   Revert ABI breakage to CAM that came in with MMC/SD support in r320844.
>   Make it possible to retrieve mmc parameters via the XPT_GET_ADVINFO
>   call instead.  Convert camcontrol to the new scheme.
>  =20
>   Reviewed by:	imp. kibab
>   Sponsored by:	Netflix
>   Differential Revision:	D13868
>=20
> Modified:
>   head/sbin/camcontrol/camcontrol.c
>   head/sys/cam/cam_ccb.h
>   head/sys/cam/cam_xpt.c
>   head/sys/cam/mmc/mmc_xpt.c
>=20
> Modified: head/sbin/camcontrol/camcontrol.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> --- head/sbin/camcontrol/camcontrol.c	Fri Jan 19 14:50:53 2018	(r328164)
> +++ head/sbin/camcontrol/camcontrol.c	Fri Jan 19 15:32:27 2018	(r328165)
> @@ -715,14 +715,50 @@ print_dev_semb(struct device_match_result *dev_resu=
lt,
>  static int
>  print_dev_mmcsd(struct device_match_result *dev_result, char *tmpstr)
>  {
> +	union ccb *ccb;
> +	struct ccb_dev_advinfo *advi;
> +	struct cam_device *dev;
> +	struct mmc_params mmc_ident_data;
> =20
> -	if (strlen(dev_result->mmc_ident_data.model) > 0) {
> -		sprintf(tmpstr, "<%s>", dev_result->mmc_ident_data.model);
> +	dev =3D cam_open_btl(dev_result->path_id, dev_result->target_id,
> +	    dev_result->target_lun, O_RDWR, NULL);
> +	if (dev =3D=3D NULL) {
> +		warnx("%s", cam_errbuf);
> +		return (1);
> +	}
> +
> +	ccb =3D cam_getccb(dev);
> +	if (ccb =3D=3D NULL) {
> +		warnx("couldn't allocate CCB");
> +		cam_close_device(dev);
> +		return (1);
> +	}
> +
> +	advi =3D &ccb->cdai;
> +	advi->ccb_h.flags =3D CAM_DIR_IN;
> +	advi->ccb_h.func_code =3D XPT_DEV_ADVINFO;
> +	advi->flags =3D CDAI_FLAG_NONE;
> +	advi->buftype =3D CDAI_TYPE_MMC_PARAMS;
> +	advi->bufsiz =3D sizeof(struct mmc_params);
> +	advi->buf =3D (uint8_t *)&mmc_ident_data;
> +
> +	if (cam_send_ccb(dev, ccb) < 0) {
> +		warn("error sending CAMIOCOMMAND ioctl");
> +		cam_freeccb(ccb);
> +		cam_close_device(dev);
> +		return (1);
> +	}
> +
> +	if (strlen(mmc_ident_data.model) > 0) {
> +		sprintf(tmpstr, "<%s>", mmc_ident_data.model);
>  	} else {
>  		sprintf(tmpstr, "<%s card>",
> -		    dev_result->mmc_ident_data.card_features &
> +		    mmc_ident_data.card_features &
>  		    CARD_FEATURE_SDIO ? "SDIO" : "unknown");
>  	}
> +
> +	cam_freeccb(ccb);
> +	cam_close_device(dev);
>  	return (0);
>  }
> =20
>=20
> Modified: head/sys/cam/cam_ccb.h
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> --- head/sys/cam/cam_ccb.h	Fri Jan 19 14:50:53 2018	(r328164)
> +++ head/sys/cam/cam_ccb.h	Fri Jan 19 15:32:27 2018	(r328165)
> @@ -506,7 +506,6 @@ struct device_match_result {
>  	struct scsi_inquiry_data	inq_data;
>  	struct ata_params		ident_data;
>  	dev_result_flags		flags;
> -	struct mmc_params		mmc_ident_data;
>  };
> =20
>  struct bus_match_result {
> @@ -1278,6 +1277,7 @@ struct ccb_dev_advinfo {
>  #define	CDAI_TYPE_EXT_INQ	5
>  #define	CDAI_TYPE_NVME_CNTRL	6	/* NVMe Identify Controller data */
>  #define	CDAI_TYPE_NVME_NS	7	/* NVMe Identify Namespace data */
> +#define	CDAI_TYPE_MMC_PARAMS	8	/* MMC/SD ident */
>  	off_t bufsiz;			/* IN: Size of external buffer */
>  #define	CAM_SCSI_DEVID_MAXLEN	65536	/* length in buffer is an
> uint16_t */ off_t provsiz;			/* OUT: Size required/used */
>=20
> Modified: head/sys/cam/cam_xpt.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> --- head/sys/cam/cam_xpt.c	Fri Jan 19 14:50:53 2018	(r328164)
> +++ head/sys/cam/cam_xpt.c	Fri Jan 19 15:32:27 2018	(r328165)
> @@ -1909,9 +1909,6 @@ xptedtdevicefunc(struct cam_ed *device, void *arg)
>  		bcopy(&device->ident_data,
>  		      &cdm->matches[j].result.device_result.ident_data,
>  		      sizeof(struct ata_params));
> -		bcopy(&device->mmc_ident_data,
> -		      &cdm->matches[j].result.device_result.mmc_ident_data,
> -		      sizeof(struct mmc_params));
> =20
>  		/* Let the user know whether this device is unconfigured */
>  		if (device->flags & CAM_DEV_UNCONFIGURED)
>=20
> Modified: head/sys/cam/mmc/mmc_xpt.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> --- head/sys/cam/mmc/mmc_xpt.c	Fri Jan 19 14:50:53 2018	(r328164)
> +++ head/sys/cam/mmc/mmc_xpt.c	Fri Jan 19 15:32:27 2018	(r328165)
> @@ -367,6 +367,13 @@ mmc_dev_advinfo(union ccb *start_ccb)
>          case CDAI_TYPE_PHYS_PATH: /* pass(4) wants this */
>                  cdai->provsiz =3D 0;
>                  break;
> +	case CDAI_TYPE_MMC_PARAMS:
> +		cdai->provsiz =3D device->mmc_ident_data;
> +		if (device->mmc_ident_data =3D=3D NULL)
> +			break;
> +		amt =3D MIN(cdai->provsiz, cdai->bufsiz);
> +		memcpy(cdai->buff, device->mmc_ident_data, amt);
> +		break;
>  	default:
>                  panic("Unknown buftype");
>  		return;
> _______________________________________________
> svn-src-head@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/svn-src-head
> To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org"
It seems, this broke buildkernel for me (and probably others):

[...]
=3D=3D=3D> bhnd/cores/bhnd_pci (all)
--- mmc_xpt.o ---
/usr/src/sys/cam/mmc/mmc_xpt.c:371:17: error: assigning to 'off_t' (aka 'lo=
ng') from
incompatible type 'struct mmc_params' cdai->provsiz =3D device->mmc_ident_d=
ata;
                              ^ ~~~~~~~~~~~~~~~~~~~~~~
/usr/src/sys/cam/mmc/mmc_xpt.c:372:30: error: invalid operands to binary ex=
pression
('struct mmc_params' and 'void *') if (device->mmc_ident_data =3D=3D NULL)
                    ~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~
/usr/src/sys/cam/mmc/mmc_xpt.c:375:16: error: no member named 'buff' in 'st=
ruct
ccb_dev_advinfo' memcpy(cdai->buff, device->mmc_ident_data, amt);
                       ~~~~  ^


--=20
O. Hartmann

Ich widerspreche der Nutzung oder =C3=9Cbermittlung meiner Daten f=C3=BCr
Werbezwecke oder f=C3=BCr die Markt- oder Meinungsforschung (=C2=A7 28 Abs.=
 4 BDSG).

--Sig_/veMgRZUNGAVttPavN_81umK
Content-Type: application/pgp-signature
Content-Description: OpenPGP digital signature

-----BEGIN PGP SIGNATURE-----

iLUEARMKAB0WIQQZVZMzAtwC2T/86TrS528fyFhYlAUCWmIyqgAKCRDS528fyFhY
lBuiAf9Ug1bGfiD4xIQPEdc5M1fbIN1PbehraCD3mgfCudbaVCR3U0bcBd6ePaBA
3LoZo0EnBnbZ2gR2dC8744V2JusWAf9ptVodX/uyZp+P5qUOTyk0nNSmjhfLFmwg
N1xuN99b8fC5LPhPpnpNvMe6UQPaGMfJ9OWXpIa+sCDspb5qsvA2
=LYzc
-----END PGP SIGNATURE-----

--Sig_/veMgRZUNGAVttPavN_81umK--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20180119190218.0d656a0d>