Page MenuHomeFreeBSD

pmu: avoid NULL ofw_get_bus_type(); handle pmu_send() calls w/ NULL recv buffers
Needs ReviewPublic

Authored by adrian on Mon, Jan 19, 1:20 AM.

Details

Reviewers
None
Group Reviewers
PowerPC
Summary

When booting in qemu with "-machine=mac99,via=pmu" I found two
things:

  • the "extint-gpio1" check returned NULL, so doing a strcmp() on it is wrong, and
  • a couple of places (notably the LED path) was calling pmu_send() with no receive buffer, leading to results being written to a NULL buffer.

Fix both of these, allowing boot to continue.

Locally tested:

  • qemu-system-ppc64 -machine=mac99,via=pmu -cpu 970fx -smp 1

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 69977
Build 66860: arc lint + arc unit

Event Timeline

The type NULL checks are good. I think the whole of the changes for pmu_send() are a bit overkill. Could you test with just the one line I pointed out, and the rest reverted?

sys/powerpc/powermac/pmu.c
634

I *think* this is the only change needed in this function. The expectation is that the callers (all in this file) know already that a response is needed or not. PMU_SET_SLEEPLED, 0xee, has a pmu_receive_cmd_type entry of -1,

the "extint-gpio1" check returned NULL

Passed NULL because ofw_bus_get_type returned NULL?

sys/powerpc/powermac/pmu.c
634

else after a goto is a bit confusing... may be worth making that less weird as a separate change? Then I'd probably swap this with the out_len read, groups the out_msg writes together rather than interleaving things.

641

Unnecessary change