Page MenuHomeFreeBSD

asmc: try PIO before MMIO to avoid false T2 detection
AcceptedPublic

Authored by guest-seuros on Thu, Jun 25, 3:23 PM.
Referenced Files
Unknown Object (File)
Sun, Jun 28, 2:29 AM
Unknown Object (File)
Fri, Jun 26, 5:29 PM
Subscribers

Details

Reviewers
adrian
Group Reviewers
drivers
apple (x86)
Summary

Add hw.asmc.system-state and hw.asmc.board-id read-only sysctls to
expose the T2 system state register and Mac board identifier via SMC.

Try PIO access before MMIO during probe to prevent false T2 detection
on Macs that happen to have something mapped at the T2 BAR address.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 74335
Build 71218: arc lint + arc unit

Event Timeline

make sure you add a "tested" block showing a couple of devices you tested this on just to verify

adrian added projects: drivers, apple (x86).

oh and i think you should split this into two parts:

  • one that changes the probe order due to apple revisions
  • one that adds all the extra keys/sysctl stuff

I'm splitting them into 3 into a stack.

The fix is this diff, the next ones is how you can test it and some cleanup.

sys/dev/asmc/asmc.c
446

Just change this to if (sc->sc_ioport == NULL) so you don't need the empty section

ngie added inline comments.
sys/dev/asmc/asmc.c
444–446
sys/dev/asmc/asmc.c
447–465

This logic seems like a good candidate for another helper probe function for clarity and to make the logic cleaner for humans to parse.

452

I know this requires additional changes, but this seems best expressed via a bool quantity (true/false).

guest-seuros retitled this revision from asmc: add system state, board identity sysctls, and PIO-first probe order to asmc: try PIO before MMIO to avoid false T2 detection.Sat, Jun 27, 6:50 PM
guest-seuros added inline comments.
sys/dev/asmc/asmc.c
444–446

I had it empty because i don't know if T1 Mac will need it..
We still need to test this driver in some 2016s hardware.

sys/dev/asmc/asmc.c
444–446

I had it empty because i don't know if T1 Mac will need it..
We still need to test this driver in some 2016s hardware.

I can confirm that after this lands (I have a '16 MBP, which has a T1 chip).

This revision is now accepted and ready to land.Sat, Jun 27, 8:30 PM

The other diff is how i verified that this change worked, it is not a requirement.

You can land this one standalone.