On Mon, Oct 21, 2024 at 10:10:44PM GMT, Mark Kettenis wrote:
> > Date: Mon, 21 Oct 2024 20:40:38 +0200
> > From: Tobias Heider <[email protected]>
> >
> > On Mon, Oct 21, 2024 at 08:33:53PM GMT, Mark Kettenis wrote:
> > > > Date: Mon, 21 Oct 2024 14:12:33 +0200
> > > > From: Tobias Heider <[email protected]>
> > > >
> > > > On Mon, Oct 21, 2024 at 01:04:10PM GMT, Stuart Henderson wrote:
> > > > > On 2024/10/21 13:54, Sylvain Saboua wrote:
> > > > > > Are we to understand that the default wireless device
> > > > > > of the Apple M1 is not functional yet with openbsd ?
> > > > >
> > > > > It was working on M1, but based on this report it looks like a change
> > > > > on
> > > > > the MacOS side might have broken it for newer MacOS versions.
> > > > >
> > > >
> > > > Yeah, can confirm that it breaks with the latest macos update.
> > > > I haven't found the cause yet but I think it breaks at a lower layer,
> > > > battery charge level and some other things also seem to not work
> > > > anymore.
> > >
> > > That makes (some) sense. The bwfm(4) device needs to be powered on
> > > using a GPIO pin that is managed by the SMC. The SMC also manages the
> > > batter charge level. So the problem is in aplsmc(4).
> > >
> > > Most of the firmwares on these machines are tied to the OS and the
> > > stripped down macOS installation used by the Asahi boot process comes
> > > with its own copy of those firmwares. So in general upgrading the
> > > main macOS installation will not break things. But the SMC firmware
> > > is an exception as that is part of the system firmware.
> > >
> > > Tobias, does Linux still work on the upgraded system?
> >
> > It does yeah. I haven't seen an obvious fix in their tree yet.
> > aplsmc was also my guess, if I remember correctly it even throws
> > an error here:
> > https://github.com/openbsd/src/blob/master/sys/arch/arm64/dev/aplsmc.c#L259-L264
>
> Hmm, does the diff below help?
Sadly not, still seeing:
aplsmc0 at simplebus0: can't get SRAM address
>
> Index: arch/arm64/dev/aplsmc.c
> ===================================================================
> RCS file: /cvs/src/sys/arch/arm64/dev/aplsmc.c,v
> diff -u -p -r1.25 aplsmc.c
> --- arch/arm64/dev/aplsmc.c 16 Jul 2023 16:11:11 -0000 1.25
> +++ arch/arm64/dev/aplsmc.c 21 Oct 2024 20:09:38 -0000
> @@ -126,6 +126,7 @@ struct aplsmc_softc {
> struct rtkit_state *sc_rs;
> uint8_t sc_msgid;
> uint64_t sc_data;
> + int sc_ready;
>
> struct gpio_controller sc_gc;
>
> @@ -272,6 +273,7 @@ aplsmc_attach(struct device *parent, str
> printf("\n");
>
> aplsmc_sc = sc;
> + sc->sc_ready = 1;
>
> node = OF_getnodebyname(faa->fa_node, "gpio");
> if (node) {
> @@ -479,13 +481,13 @@ aplsmc_callback(void *arg, uint64_t data
> {
> struct aplsmc_softc *sc = arg;
>
> - if (SMC_CMD(data) == SMC_NOTIFICATION) {
> - aplsmc_handle_notification(sc, data);
> + if (!sc->sc_ready || SMC_CMD(data) != SMC_NOTIFICATION) {
> + sc->sc_data = data;
> + wakeup(&sc->sc_data);
> return;
> }
>
> - sc->sc_data = data;
> - wakeup(&sc->sc_data);
> + aplsmc_handle_notification(sc, data);
> }
>
> int
>