Giter Club home page Giter Club logo

Comments (5)

bztsrc avatar bztsrc commented on July 27, 2024

Hi,

Thanks for the through testing!

The mbox[4]=8 is correct, because "set clock rate" has an 8 bytes response, see https://github.com/raspberrypi/firmware/wiki/Mailbox-property-interface#set-clock-rate
According to my tests, with some tags on real hardware you have to tell the GPU how much space you've allocated for the response, so I like to set the response buffer size for all tags (won't hurt even if it's not strictly required). You'll see that with the LFB Mailbox as well. Spending some time with ARM documentations and you'll realize that they are sometimes contradictional, and real hardware does not necessarily work as described.

And about the 12 bytes input, you're right. I've copied this code from my production ready bootloader, where readibility wasn't a goal. It's working because the "last tag" macro is 0, so this also works as a third parameter which clears turbo as intended. To be 100% correct, it should be

mbox[0]=9*4;
...
mbox[7]=0;
mbox[8]=MBOX_TAG_LAST;

But doesn't really matter because now mbox[7] is zero anyway and we have mbox[0]=8*4, so GPU won't read mbox[8] (MBOX_TAG_LAST is not mandatory, mbox size is more important).

But I'll fix that to make the code clearer, give me a day or so, unfortunately right now I've other things to attend to. If you find anything else in the meantime, I'll commit them too.

Thanks again,
bzt

from raspi3-tutorial.

marcinszajner avatar marcinszajner commented on July 27, 2024

hmm compare to this tutorial:
http://www.valvers.com/open-software/raspberry-pi/step05-bare-metal-programming-in-c-pt5/

After set tag and size of buffer is olways 0 as /* Request */. I didn't find anywhere info about setting response buffer size.

from raspi3-tutorial.

bztsrc avatar bztsrc commented on July 27, 2024

hmm compare to this tutorial:

That tutorial has other issues as well, although I give you that using va args for mbox tags is pretty smart and elegant. Btw that's not for BCM2837, and I'm not sure they have tested it on RPi3 at all.

I didn't find anywhere info about setting response buffer size.

Me neither :-) I know that empirically. I've also made that mistake first to trust ARM documentation. Never do that. Use any documentation as a guide, and ALWAYS test your code on a real machine. I've spent more than a week figuring out what's wrong with my MMU code. As it turned out, it was a documentation issue, as the official ARM Developer Guide neglected to mention that the encoding of 4k page size in TCR differs for TTBR0 and TTBR1. Who'd have thought of that?
Also compare the doc with the arm trusted firmware example code. There'll be lots of differences, but thankfully you can try out the code :-) For example this little nuance about CnP bit is not mentioned in the docs at all (at least it wasn't last time I checked).
Oh, and always look for errata. There are lots of fixes for the BCM2835/6/7 which can save your day.

bzt

from raspi3-tutorial.

marcinszajner avatar marcinszajner commented on July 27, 2024

Hi again,

It took me a while, but at last I have my raspberry pi 3 A+. I test it with this 0 after buffer size and it work well. However your version work too, so this is only detail.

from raspi3-tutorial.

toothbrush7777777 avatar toothbrush7777777 commented on July 27, 2024

I know that this is a little late, but I'd like to point out that the mailbox interface is not hardware and is monitored by the software running on the GPU.

from raspi3-tutorial.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.