Good enough.
Alexander Bluhm <[email protected]> wrote:
> On Wed, Sep 04, 2019 at 03:54:25PM +0200, Mark Kettenis wrote:
> > > If the mapping cannot be solved, maybe the activate function can skip
> > > all work if sc->sc.sc_size is 0.
> >
> > So this is, IMHO, the only viable approach. I just wanted to trick
> > somebody else into doing the work ;).
>
> ehci does that.
>
> ----------------------------
> revision 1.31
> date: 2019/05/02 20:28:46; author: kettenis; state: Exp; lines: +8 -4;
> commitid: UueNy7svryPLHN1X;
> Avoid running the activate function for a partially attached ehci(4) driver.
> The Realtek DASH ehci(4) doesn't have a properly set SBRN register which
> prevents us from fully attaching the device. This would result in a panic
> during suspend because the activate function will access register that
> aren't mapped.
>
> ok deraadt@
> ----------------------------
>
> If I do the same for uhci, it solves my problem.
>
> ok?
>
> bluhm
>
> Index: dev/pci/uhci_pci.c
> ===================================================================
> RCS file: /data/mirror/openbsd/cvs/src/sys/dev/pci/uhci_pci.c,v
> retrieving revision 1.33
> diff -u -p -r1.33 uhci_pci.c
> --- dev/pci/uhci_pci.c 16 May 2014 18:17:03 -0000 1.33
> +++ dev/pci/uhci_pci.c 5 Sep 2019 16:15:44 -0000
> @@ -86,6 +86,9 @@ uhci_pci_activate(struct device *self, i
> {
> struct uhci_pci_softc *sc = (struct uhci_pci_softc *)self;
>
> + if (sc->sc.sc_size == 0)
> + return 0;
> +
> /* On resume, set legacy support attribute and enable intrs */
> switch (act) {
> case DVACT_RESUME:
> @@ -190,6 +193,7 @@ uhci_pci_attach(struct device *parent, s
>
> unmap_ret:
> bus_space_unmap(sc->sc.iot, sc->sc.ioh, sc->sc.sc_size);
> + sc->sc.sc_size = 0;
> splx(s);
> }
>
> @@ -218,6 +222,7 @@ uhci_pci_attach_deferred(struct device *
> unmap_ret:
> bus_space_unmap(sc->sc.iot, sc->sc.ioh, sc->sc.sc_size);
> pci_intr_disestablish(sc->sc_pc, sc->sc_ih);
> + sc->sc.sc_size = 0;
> splx(s);
> }
>