Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Nov 2019 22:21:07 +0100
From:      Ilya Bakulin <ilya@bakulin.de>
To:        Emmanuel Vadot <manu@bidouilliste.com>
Cc:        Ilya Bakulin <kibab@freebsd.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r354206 - head/sys/arm/allwinner
Message-ID:  <CADzbx%2BpQUPLt%2Bd8pxeLY__-=XWvUzahz7wq7ZvEmTgONxO0JWg@mail.gmail.com>
In-Reply-To: <20191031135118.4e9222bb05879d1602bf3161@bidouilliste.com>
References:  <201910302043.x9UKhRth083957@repo.freebsd.org> <20191031135118.4e9222bb05879d1602bf3161@bidouilliste.com>

next in thread | previous in thread | raw e-mail | index | archive | help
The first part (cam_sim_alloc -> cam_sim_alloc_dev) is necessary to
properly fill cam_sim structure so that sdiob(4) can attach to the SDIO
card. See https://svnweb.freebsd.org/base?view=revision&revision=r348800 for
the details.
The second part (new DEVMETHOD) is needed because now MMC adapter becomes a
bus (like, something that has children) and without this change the kernel
panics when trying to attach sdiob(4).


On Thu, Oct 31, 2019 at 1:51 PM Emmanuel Vadot <manu@bidouilliste.com>
wrote:

> On Wed, 30 Oct 2019 20:43:27 +0000 (UTC)
> Ilya Bakulin <kibab@FreeBSD.org> wrote:
>
> > Author: kibab
> > Date: Wed Oct 30 20:43:27 2019
> > New Revision: 354206
> > URL: https://svnweb.freebsd.org/changeset/base/354206
> >
> > Log:
> >   Use the new cam_sim_alloc_dev function to properly initialize SIM
> >
> >   Using cam_sim_alloc_dev() allows to properly set sim_dev field so that
> >   sdiob(4) can attach to the CAM device that represents SDIO card.
> >   The same change for SDHCI driver happened in r348800.
> >
> >   Approved by:                imp (mentor)
> >   Differential Revision:      https://reviews.freebsd.org/D22192
> >
> > Modified:
> >   head/sys/arm/allwinner/aw_mmc.c
> >
> > Modified: head/sys/arm/allwinner/aw_mmc.c
> >
> ==============================================================================
> > --- head/sys/arm/allwinner/aw_mmc.c   Wed Oct 30 20:08:10 2019
> (r354205)
> > +++ head/sys/arm/allwinner/aw_mmc.c   Wed Oct 30 20:43:27 2019
> (r354206)
> > @@ -526,8 +526,8 @@ aw_mmc_attach(device_t dev)
> >       }
> >
> >       mtx_init(&sc->sim_mtx, "awmmcsim", NULL, MTX_DEF);
> > -     sc->sim = cam_sim_alloc(aw_mmc_cam_action, aw_mmc_cam_poll,
> > -         "aw_mmc_sim", sc, device_get_unit(dev),
> > +     sc->sim = cam_sim_alloc_dev(aw_mmc_cam_action, aw_mmc_cam_poll,
> > +         "aw_mmc_sim", sc, dev,
> >           &sc->sim_mtx, 1, 1, sc->devq);
> >
> >       if (sc->sim == NULL) {
> > @@ -1514,6 +1514,7 @@ static device_method_t aw_mmc_methods[] = {
> >       /* Bus interface */
> >       DEVMETHOD(bus_read_ivar,        aw_mmc_read_ivar),
> >       DEVMETHOD(bus_write_ivar,       aw_mmc_write_ivar),
> > +     DEVMETHOD(bus_add_child,        bus_generic_add_child),
>
>  Why is this change needed ?
>
> >
> >       /* MMC bridge interface */
> >       DEVMETHOD(mmcbr_update_ios,     aw_mmc_update_ios),
>
>
> --
> Emmanuel Vadot <manu@bidouilliste.com>
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CADzbx%2BpQUPLt%2Bd8pxeLY__-=XWvUzahz7wq7ZvEmTgONxO0JWg>