babbleberry / rpi4-osdev

Tutorial: Writing a "bare metal" operating system for Raspberry Pi 4
https://www.rpi4os.com
Creative Commons Zero v1.0 Universal
3.43k stars 255 forks source link

mailbox tag value size specified twice #21

Closed dodecahedral-champion closed 2 years ago

dodecahedral-champion commented 2 years ago

In part5-framebuffer/fb.c line 15, you have given the value buffer size in bytes a second time for mbox[4].

Based on my understanding of https://github.com/raspberrypi/firmware/wiki/Mailbox-property-interface, this should actually be set to 0 for the "request code"; I think that this is coincidentally working right now because the only requirement is for bit 31 to be clear (which is the case for your sizes).

After the tag response has been written by the GPU, this value should have been changed to 0x80000000 (i.e. bit 31 set). These request/response values are the same as the buffer request/response code (which you correctly set on line 11 to mbox[1]), which can be a bit confusing.

babbleberry commented 2 years ago

Good spot - I think you're right. I'll make the change, test and update (providing it still works)! Thanks :)

babbleberry commented 2 years ago

I've made the changes as you suggest - thanks for the heads up!