Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AppleBCM5701Ethernet broken on iMac11,x and iMac12,x #45

Closed
grzegorz914 opened this issue Jan 15, 2021 · 17 comments
Closed

AppleBCM5701Ethernet broken on iMac11,x and iMac12,x #45

grzegorz914 opened this issue Jan 15, 2021 · 17 comments
Labels
bug Something isn't working

Comments

@grzegorz914
Copy link

grzegorz914 commented Jan 15, 2021

Hi,
I have run BS on iMac11.3 with Opencore-Legacy-Patcher 0.0.9 and probably the CatalinaBCM5701Ethernet.kext is not loaded correctly because in the System Report Ethernet Card does not exist. I have checked the config.plist and the kext is enabled.

In other things the sound with VoodoHD.kext is terrible, is it possible to install AppleHDA.kext using OC?

Thanks for Your support.

@Ausdauersportler
Copy link
Collaborator

Hi!

I can confirm that this CatalinaBCM5701Ethernet.kext is not working on iMac 11,1, 11,3 and 12.2 - I assume the 21.5" system will be no exception. Uses an unpatched Big Sur installation on external disk (OTA upgrade) and used all possible OCLP configs generated for these particular machines.

Atheros WiFi patch is working! VoodooHDA.kext, too.

@Ausdauersportler
Copy link
Collaborator

Another question about this CatalinaBCM5701Ethernet.kext:

After checking the FORCE option with OpenCore I found this comment which makes me believe one cannot inject a modified but still in the Big Sur system existing extension

I recently checked some or your (mostly network) patches on different machines. The patches containing extensions not any longer included with Big Sur work (Atheros), the one still included within the IONetworkingFamily.kext (BCM5701Ethernet.kext) will not load, although renamed. Is this just a coincidence or is this an expression of the comment mentioned above?

@khronokernel
Copy link
Member

Spent a bit of time looking into the Broadcom issue, so here's some of my notes:

Why AppleBCM5701Ethernet fails in Big Sur

Underlying issue is unknown, however it's clear there's some PCI allocation issues with the Broadcom device:

[    2.574157]: AppleBCM5701Ethernet [100000191, GIGE]:    60000     1000 MyAllocIOBuffer - failed to get physical address
[    2.574165]: 0x00060000, 0x00001000 MyAllocIOBuffer - failed to get physical address
[    2.574248]: AppleBCM5701Ethernet [100000191, GIGE]:        0        0 allocateMemory - fRxStdDmaVirt,fRxStdDmaPhy failed
[    2.642887]: 0x00000000, 0x00000000 allocateMemory - fRxStdDmaVirt,fRxStdDmaPhy failed
[    2.642890]: AppleBCM5701Ethernet [100000191, GIGE]:        0        0 start - allocateMemory failed
[    2.752461]: 0x00000000, 0x00000000 start - allocateMemory failed
[    3.022827]: AppleBCM5701Ethernet [100000191, GIGE]:    bf400     1000 MyAllocIOBuffer - failed to get physical address
[    3.022835]: 0x000bf400, 0x00001000 MyAllocIOBuffer - failed to get physical address
[    3.022925]: AppleBCM5701Ethernet [100000191, GIGE]:        0        0 allocateMemory - fRxStdDmaVirt,fRxStdDmaPhy failed
[    3.022931]: 0x00000000, 0x00000000 allocateMemory - fRxStdDmaVirt,fRxStdDmaPhy failed
[    3.022934]: AppleBCM5701Ethernet [100000191, GIGE]:        0        0 start - allocateMemory failed
[    3.022939]: 0x00000000, 0x00000000 start - allocateMemory failed

For long term, I would much prefer to support Apple's native driver however this would require much more extensive research as well as having the hardware locally(which is unlikely, legacy Macs are fairly rare locally)

Why our CatalinaBCM5701Ethernet fails

Something I didn't account for with Big Sur was that AppleBCM5701Ethernet would be loaded and have the same class names:

[    1.823379]: OSMetaClass: Kext com.apple.iokit.CatalinaBCM5701Ethernet class BCM5701Enet is a duplicate;kext com.apple.iokit.AppleBCM5701Ethernet already has a class by that name.
[    1.823387]: Kext com.apple.iokit.CatalinaBCM5701Ethernet did not start (return code 0xdc00400a).
[    1.823392]: Kext com.apple.iokit.CatalinaBCM5701Ethernet start failed (result 0xdc00400a).
[    1.823396]: Kext com.apple.iokit.CatalinaBCM5701Ethernet failed to load (0xdc008017).
[    1.823401]: Failed to load kext com.apple.iokit.CatalinaBCM5701Ethernet (error 0xdc008017).

I believe I patched out these classes previously however it looks to be that I overlooked some classes.

I uploaded a new patched kext below:

@NOTNlCE
Copy link

NOTNlCE commented Mar 8, 2021

Injecting this latest kext via OC on Big Sur yields no Ethernet on my iMac12,2. What logs can I provide you to help?

EDIT: kextstat shows the kernel extension is still not loaded, even with Force injection via OC.

@grzegorz914
Copy link
Author

Same for me no Ethernet card installed.

@khronokernel
Copy link
Member

Alright, I have 3 more tests I have in mind. The best way to get logs would be:

  • Add msgbuf=1048576 to boot-args
  • Run sudo dmesg > ~/Desktop/DMESG.txt

Test 1: Attempt to fix DMA access

Enable DisableIoMapper under Kernel -> Quirks and just use the stock AppleBCM5701Ethernet in Big Sur. No other patches should be needed.

Test 2: Try to outmatch AppleBCM5701Ethernet

For this, simply inject the following kext:

AppleBCM5701Ethernet.kext.zip

Test 3: Kick out AppleBCM5701Ethernet and inject CatalinaBCM5701Ethernet

For this you will need these 2 kexts:

@NOTNlCE
Copy link

NOTNlCE commented Mar 8, 2021

Test 1: Same results.
Test 2: Kernel Panic
Test 3: Kernel Panic

Here's the files:

DMESG.txt

@khronokernel
Copy link
Member

@NOTNlCE Thank you for the tests, looks like we will need to go with plan B. Vit discussed actually excluding a kext personality from the prelinked cache, he asked to open an issue:

Also @NOTNlCE, where the panics just listing invalid kext in cache or something similar?

@khronokernel khronokernel added the bug Something isn't working label Mar 8, 2021
@khronokernel khronokernel changed the title iMac11.3 CatalinaBCM5701Etherne not working AppleBCM5701Ethernet broken on iMac11,x and iMac12,x Mar 8, 2021
@NOTNlCE
Copy link

NOTNlCE commented Mar 8, 2021

Also @NOTNlCE, where the panics just listing invalid kext in cache or something similar?

Yes, just invalid kexts. Instant panic, didn't even log in my OC boot logs. Odd that even explicitly blocking com.apple.iokit.AppleBCM5701Ethernet in OpenCore does not prevent it from loading.

Thanks for your hard work, as always. Happy to test any future endevours.

@khronokernel
Copy link
Member

If anyone's interested at taking a crack as to why Big Sur's AppleBCM5701Ethernet fails, I've provided kexts from roughly the same time period:

For reference, Beta 3 (20A5323I) seems to be when the driver really broke. Beta 1 and 2 also had issues however there seemed to be reports of it still working

@khronokernel
Copy link
Member

Have there been any reports of MacBookPro6,x, MacBookPro8,x or Macmini5,x with these issues? Wondering how much of these issues are tied to the older hardware and how much is actually broken within the iMac's firmware specifically

@khronokernel
Copy link
Member

So splurged a bit and bought myself an iMac11,2, and I was able to get the Ethernet issue resolved:

Screen Shot 2021-03-26 at 9 07 40 PM

This means there's zero root volume patching required for Broadcom ethernet so quite happy overall, latest build can be found below:

https://github.com/dortania/OpenCore-Legacy-Patcher/suites/2356889498/artifacts/49881654

@Ausdauersportler
Copy link
Collaborator

Really great., could you explain how you did it and if this (renaming) method may work with AppleHDA (High Sierra), too?

@khronokernel
Copy link
Member

Oh it was just a class issue this whole time, I had forgotten to patch the BCM5701Enet class to match IOService's expectation

Regarding AppleHDA, it's impossible to inject for a few reasons:

  • AppleHDA itself is a big bundle of kexts and so makes injection very difficult without hitting linking issues within OpenCore
  • OpenCore can only inject binaries and info.plist, nothing else

The last point is the most important as what we actually need to inject is not AppleHDA itself but instead their resources. AppleHDA as a kext is an engine that takes "layouts" as input. These layouts define hardware characteristics of the audio controller and the machine's configuration, and without them there's nothing for AppleHDA to do. These layouts are stored on disk under AppleHDA.kext/Contents/Resources/ and unfortunately cannot be injected by OpenCore.

So how do we work around this without root patching? Well AppleALC is a patching engine for AppleHDA that injects custom "layouts" into memory. You can pipe in new layouts as well as custom patches to apply to AppleHDA and in theory will provide native AppleHDA support with zero need for rolling back the kext.

Regarding why AppleALC fails, not entirely sure. I bought the iMac11,2 to run tests locally which I hope will speed up the process greatly with fixing audio.

@Ausdauersportler
Copy link
Collaborator

Thanks, let me know if I can help with further testing!

@kocoman1
Copy link

kocoman1 commented Apr 13, 2021

So splurged a bit and bought myself an iMac11,2, and I was able to get the Ethernet issue resolved:

Screen Shot 2021-03-26 at 9 07 40 PM

This means there's zero root volume patching required for Broadcom ethernet so quite happy overall, latest build can be found below:

https://github.com/dortania/OpenCore-Legacy-Patcher/suites/2356889498/artifacts/49881654

I tried to download the latest build above? but its deleted? why is it deleted?

What Kext link should I download to get working ethernet as above? thx

@khronokernel
Copy link
Member

@kocoman1 Please do not spam the GitHub issue, final warning

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants