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

Use mailbox to get hwrev #495

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cdsteinkuehler
Copy link

I ran into some trouble using this library on my system because (see below for details if interested).

Anyway, I was having issues with identifying the Raspberry Pi hardware platform. Since the code is already talking to the firmware mailbox register I just switched to directly asking the firmware for the hardware revision. I have no idea if this is a desired change or not, but to me it seems to make the code somewhat cleaner (as well as fixing my use case). I wonder if someone had intended to do something like this previously as there is a "dangling" definition for a get_version() function in mailbox.h that has no code behind it.

Details on my issue:
I'm using Buildroot + U-Boot + RAUC to provide a system that supports safe firmware updates and a fallback rescue partition (see: https://github.com/cdsteinkuehler/br2rauc). I'm using a 64-bit OS so I don't get the hardware details in /proc/cpuinfo. The /system device-tree entries the existing code in rpihw.c is looking for are actually populated by the RPi firmware. Since I load the device-tree from the selected root filesystem (allowing for kernel and device-tree updates over time) I don't have these entries in my device tree. I may see about having my U-Boot script copy over some of these RPi firmware populated device-tree nodes, but it was quicker in the short term to just update the hardware detection logic.

Thanks for the great project!

Since we're already using the mailbox interface, use it to get the
hardware revision instead of parsing /proc/cpuinfo or the device tree

Signed-off-by: Charles Steinkuehler <[email protected]>
@Gadgetoid
Copy link
Collaborator

I'd take a wild guess that this would elevate the privilege level required for the library to say "your board is not supported, go away" (since IIRC mailbox requires root?) but I don't really see that as a problem.

This might take some significant regression testing, and potentially be obsolete once we figure out #183, but the code is much cleaner.

I have never been all that comfortable with the /proc/cpuinfo method of grabbing the revision, and your case is one I didn't consider in my argument against it.

I don't believe it's that you're using a 64bit OS, but rather that you're not including this patch (and whatever related patches make it show up in /proc/cpuinfo) - raspberrypi/linux@3e787f9

Looks like Revision ID in /proc/cpuinfo is- in fact- doomed to be the downstream hack I suspected it was.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants